author | William Roberts <williamr@symbian.org> |
Fri, 01 Oct 2010 11:40:18 +0100 | |
changeset 2 | 048b58430d46 |
parent 0 | 5de814552237 |
permissions | -rw-r--r-- |
0
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1 |
/* |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
8 |
* |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
11 |
* |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
13 |
* |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
15 |
* naviengine_assp\dmapsl.cpp |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
16 |
* DMA Platform Specific Layer (PSL) for Navi Engine. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
17 |
* |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
18 |
*/ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
19 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
20 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
21 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
22 |
#include <kernel/kern_priv.h> |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
23 |
#include <assp.h> |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
24 |
#include <naviengine_priv.h> |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
25 |
#include <navienginedma.h> |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
26 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
27 |
#include <dma.h> |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
28 |
#include <dma_hai.h> |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
29 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
30 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
31 |
// This macro was used to print debug info in the DMAC64 isr. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
32 |
// It may be useful to reenable it as it appears to provoke an SMP |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
33 |
// race condition, which needs fixing |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
34 |
//#define _DEBUG_PRINT_ISR |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
35 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
36 |
// Debug support |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
37 |
static const char KDmaPanicCat[] = "DMA PSL"; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
38 |
static const TInt KDesCount = 1024; // DMA descriptor count - sufficient to serve all channels at the time. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
39 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
40 |
/* Maps logical DMA channels into physical ones */ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
41 |
static const TDMAChannelLocator KDMAChannelLocator[EDmaChannelCount]= |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
42 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
43 |
// controller, group, subchannel DCHS (exc. SEL) TransferShiftSize |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
44 |
{EDMACtrl32 ,2 ,2 ,KHvDMACHC_SDR, 1}, //EDMAChannelSD0, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
45 |
{EDMACtrl32 ,2 ,3 ,KHvDMACHC_SDW, 1}, //EDMAChannelSD1, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
46 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
47 |
{EDMACtrl32 ,3 ,0 ,KHvDMACHC_I2SR, 1}, //EDMAChannelI2S0RX, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
48 |
{EDMACtrl32 ,3 ,1 ,KHvDMACHC_I2SW, 1}, //EDMAChannelI2S0TX, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
49 |
{EDMACtrl32 ,3 ,2 ,KHvDMACHC_I2SR, 1}, //EDMAChannelI2S1RX, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
50 |
{EDMACtrl32 ,3 ,3 ,KHvDMACHC_I2SW, 1}, //EDMAChannelI2S1TX, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
51 |
{EDMACtrl32 ,3 ,4 ,KHvDMACHC_I2SR, 1}, //EDMAChannelI2S2RX, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
52 |
{EDMACtrl32 ,3 ,5 ,KHvDMACHC_I2SW, 1}, //EDMAChannelI2S2TX, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
53 |
{EDMACtrl32 ,3 ,6 ,KHvDMACHC_I2SR, 1}, //EDMAChannelI2S3RX, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
54 |
{EDMACtrl32 ,3 ,7 ,KHvDMACHC_I2SW, 1}, //EDMAChannelI2S3TX, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
55 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
56 |
{EDMACtrl32 ,0 ,2 ,KHvDMACHC_SW, 2}, //EDMAChannelUART0RX, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
57 |
{EDMACtrl32 ,0 ,3 ,KHvDMACHC_SW, 2}, //EDMAChannelUART0TX, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
58 |
{EDMACtrl32 ,0 ,4 ,KHvDMACHC_SW, 2}, //EDMAChannelUART1RX, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
59 |
{EDMACtrl32 ,0 ,5 ,KHvDMACHC_SW, 2}, //EDMAChannelUART1TX, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
60 |
{EDMACtrl32 ,0 ,6 ,KHvDMACHC_SW, 2}, //EDMAChannelUART2RX, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
61 |
{EDMACtrl32 ,0 ,7 ,KHvDMACHC_SW, 2}, //EDMAChannelUART2TX, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
62 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
63 |
{EDMACtrl32 ,0 ,0 ,KHvDMACHC_SW, 2}, //EDmaMemToMem0, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
64 |
{EDMACtrl32 ,0 ,1 ,KHvDMACHC_SW, 2}, //EDmaMemToMem1, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
65 |
{EDMACtrl32 ,2 ,4 ,KHvDMACHC_SW, 2}, //EDmaMemToMem2, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
66 |
{EDMACtrl32 ,2 ,5 ,KHvDMACHC_SW, 2}, //EDmaMemToMem3, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
67 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
68 |
{EDmaCtrl64 ,NULL ,NULL ,NULL, NULL}, //EDma64MemToMem0, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
69 |
{EDmaCtrl64 ,NULL ,NULL ,NULL, NULL}, //EDma64MemToMem1, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
70 |
{EDmaCtrl64 ,NULL ,NULL ,NULL, NULL}, //EDma64MemToMem2, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
71 |
{EDmaCtrl64 ,NULL ,NULL ,NULL, NULL}, //EDma64MemToMem3, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
72 |
}; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
73 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
74 |
/* Maps physical EDMACtrl32 channels into logical ones */ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
75 |
static const int DMAC32_HWChannelsLocator[KDmaHWCtrl32Count][KDmaCtrl32HWSubChannelCount] = |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
76 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
77 |
{EDmaMemToMem0,EDmaMemToMem1,EDMAChannelUART0RX,EDMAChannelUART0TX, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
78 |
EDMAChannelUART1RX,EDMAChannelUART1TX,EDMAChannelUART2RX,EDMAChannelUART2TX}, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
79 |
{-1,-1,-1,-1,-1,-1,-1,-1}, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
80 |
{-1,-1,EDMAChannelSD0,EDMAChannelSD1,EDmaMemToMem2,EDmaMemToMem3,-1,-1}, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
81 |
{ EDMAChannelI2S0RX,EDMAChannelI2S0TX,EDMAChannelI2S1RX,EDMAChannelI2S1TX, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
82 |
EDMAChannelI2S2RX,EDMAChannelI2S2TX,EDMAChannelI2S3RX,EDMAChannelI2S3TX}, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
83 |
{-1,-1,-1,-1,-1,-1,-1,-1}, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
84 |
}; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
85 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
86 |
class TDmaDesc |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
87 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
88 |
// Hardware DMA descriptor |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
89 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
90 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
91 |
public: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
92 |
TPhysAddr iSrcAddr; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
93 |
TPhysAddr iDestAddr; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
94 |
TUint iCount; // Transfer counter in bytes |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
95 |
}; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
96 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
97 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
98 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
99 |
// Test Support |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
100 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
101 |
//The list of S/W channels to be tested by t_dma |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
102 |
TUint32 TestNEChannels[] = { EDmaMemToMem0, EDmaMemToMem1, EDmaMemToMem2, EDmaMemToMem3}; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
103 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
104 |
//Sg channels on the 64 bit controller |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
105 |
TUint32 TestNESgChannels[] = { EDma64MemToMem0, EDma64MemToMem1, EDma64MemToMem2, EDma64MemToMem3}; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
106 |
const TInt TestNESgChannelsSize = sizeof(TestNESgChannels)/sizeof(TestNESgChannels[0]); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
107 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
108 |
/** |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
109 |
Information about the DMA drivers and available |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
110 |
channel cookies for the test harness |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
111 |
*/ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
112 |
TDmaTestInfo TestInfo = |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
113 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
114 |
4 * KMaxDMAUnitTransferLen, //a word is a unit of transfer for mem-to-mem DMA |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
115 |
3, // Word alignement applies fow S/W (mem-to-mem) transfer |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
116 |
0, // No need for cookie. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
117 |
4, // The number of S/W DMA channels to test |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
118 |
TestNEChannels, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
119 |
0, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
120 |
NULL, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
121 |
TestNESgChannelsSize, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
122 |
TestNESgChannels, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
123 |
}; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
124 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
125 |
EXPORT_C const TDmaTestInfo& DmaTestInfo() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
126 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
127 |
return TestInfo; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
128 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
129 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
130 |
/** |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
131 |
Information about the DMA drivers and available |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
132 |
channel cookies for the test harness (V2) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
133 |
*/ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
134 |
TDmaV2TestInfo TestInfov2 = |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
135 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
136 |
4 * KMaxDMAUnitTransferLen, //a word is a unit of transfer for mem-to-mem DMA |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
137 |
3, // Word alignement applies fow S/W (mem-to-mem) transfer |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
138 |
0, // No need for cookie. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
139 |
4, // The number of S/W DMA channels to test |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
140 |
{EDmaMemToMem0, EDmaMemToMem1, EDmaMemToMem2, EDmaMemToMem3}, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
141 |
0, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
142 |
{NULL,}, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
143 |
TestNESgChannelsSize, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
144 |
{EDma64MemToMem0, EDma64MemToMem1, EDma64MemToMem2, EDma64MemToMem3} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
145 |
}; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
146 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
147 |
EXPORT_C const TDmaV2TestInfo& DmaTestInfoV2() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
148 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
149 |
return TestInfov2; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
150 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
151 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
152 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
153 |
// Helper Functions |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
154 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
155 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
156 |
inline TBool IsHwDesAligned(const TAny* aDes) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
157 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
158 |
// We do no need H/W descriptors to be aligned as Navi Engine DMA32 cotroller doesn't |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
159 |
// support linked descriptors. Instead, they are linked by S/W. Therefore, the ordinary |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
160 |
// word alignement applies (which is enforced by compiler). |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
161 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
162 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
163 |
return ((TLinAddr)aDes & 0x3) == 0; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
164 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
165 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
166 |
// Channel class. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
167 |
// For double buffering, TDmaDbChannel::DoQueue must be overridden. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
168 |
// NE DMA has two sets of registers (base & work) - which is not supported by the original |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
169 |
#if defined(NE1_DMA_DOUBLE_BUFFER) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
170 |
class TNE1DmaChannel : public TDmaDbChannel |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
171 |
#else |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
172 |
class TNE1DmaChannel : public TDmaSbChannel |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
173 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
174 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
175 |
public: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
176 |
TNE1DmaChannel(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
177 |
void ProcessIrq(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
178 |
void ProcessErrorIrq(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
179 |
void StopTransfer(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
180 |
void Close(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
181 |
inline TBool IsIdle() const; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
182 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
183 |
private: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
184 |
#if defined(NE1_DMA_DOUBLE_BUFFER) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
185 |
virtual void DoQueue(const DDmaRequest& aReq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
186 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
187 |
virtual void QueuedRequestCountChanged(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
188 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
189 |
inline void ProcessTC(TBool aClearStatus); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
190 |
inline void ProcessEnd(TBool aClearStatus); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
191 |
inline void ClearStatus(TUint32 aBitmask); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
192 |
inline void HandleIsr(TBool aIsComplete); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
193 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
194 |
public: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
195 |
TInt iHWCtrlBase;// Base address of H/W registers for this channel. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
196 |
TInt iSubChannel;// Subchannel number (0-7) within H/W controller. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
197 |
TInt iDMACHCReg; // The content of configuration (CHC) register for this channel. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
198 |
TInt iTransferDataShift;//log2 of basic unit of transfer. See TDMAChannelLocator::iTransferShiftSize |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
199 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
200 |
// The following members are public so that they can be |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
201 |
// modified by the TNaviEngineDmac class |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
202 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
203 |
/** |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
204 |
This flag is set when the base register set is filled |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
205 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
206 |
It allows the ISR to detect the case where a base to work |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
207 |
register set changeover has happened (END interrupt) but has been masked by |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
208 |
the completion of the work register set |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
209 |
*/ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
210 |
TBool iBaseValidSet; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
211 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
212 |
/** |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
213 |
This counter is incremented each time a LaunchTransfer is started |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
214 |
and decremented when the ISR handles the transfer complete (TC |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
215 |
bit). Ie. it does not keep count of the number of times the base |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
216 |
register set is filled. This allows missed TC interrupts to be |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
217 |
detected. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
218 |
*/ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
219 |
TInt iTcIrqCount; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
220 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
221 |
/** |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
222 |
This spinlock is used to protect both the iBaseValidSet and iTcIrqCount |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
223 |
variables. It synchronises access between threads and the ISR. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
224 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
225 |
For the ISR the setting of iBaseValidSet must appear to be atomic with |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
226 |
the launch of the transfer. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
227 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
228 |
For iTcIrqCount The spinlock makes the transfer launch and subsequent |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
229 |
increase of the count appear atomic to the ISR. Otherwise it could |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
230 |
observe a completed transfer before the count was incremented or |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
231 |
vice-versa |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
232 |
*/ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
233 |
TSpinLock iIsrLock; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
234 |
}; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
235 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
236 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
237 |
// Derived Controller Class |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
238 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
239 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
240 |
using namespace Dma64; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
241 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
242 |
class TNaviEngineDmac : public TDmac |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
243 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
244 |
public: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
245 |
TNaviEngineDmac(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
246 |
TInt Create(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
247 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
248 |
friend void TNE1DmaChannel::HandleIsr(TBool); // Allow channel HandleIsr to call TDmac::HandleIsr |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
249 |
private: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
250 |
// from TDmac (PIL pure virtual) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
251 |
virtual void StopTransfer(const TDmaChannel& aChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
252 |
virtual TBool IsIdle(const TDmaChannel& aChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
253 |
virtual TUint MaxTransferLength(TDmaChannel& aChannel, TUint aSrcFlags, TUint aDstFlags, TUint32 aPslInfo); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
254 |
virtual TUint AddressAlignMask(TDmaChannel& aChannel, TUint aSrcFlags, TUint aDstFlags, TUint32 aPslInfo); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
255 |
// from TDmac (PIL virtual) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
256 |
virtual void Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
257 |
virtual TInt InitHwDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
258 |
virtual TInt UpdateHwDes(const SDmaDesHdr& aHdr, TUint32 aSrcAddr, TUint32 aDstAddr, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
259 |
TUint aTransferCount, TUint32 aPslRequestInfo); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
260 |
virtual void ChainHwDes(const SDmaDesHdr& aHdr, const SDmaDesHdr& aNextHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
261 |
virtual void AppendHwDes(const TDmaChannel& aChannel, const SDmaDesHdr& aLastHdr, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
262 |
const SDmaDesHdr& aNewHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
263 |
virtual void UnlinkHwDes(const TDmaChannel& aChannel, SDmaDesHdr& aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
264 |
// other |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
265 |
static void DMAC32_Isr(TAny* aThis, TInt aController, TInt aTcsMask, TInt aCompleted); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
266 |
static void DMAC32_0_End_Isr(TAny* aThis); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
267 |
static void DMAC32_0_Err_Isr(TAny* aThis); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
268 |
static void DMAC32_2_End_Isr(TAny* aThis); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
269 |
static void DMAC32_2_Err_Isr(TAny* aThis); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
270 |
static void DMAC32_3_End_Isr(TAny* aThis); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
271 |
static void DMAC32_3_Err_Isr(TAny* aThis); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
272 |
static void InitHWChannel (ENaviEngineDmaController aNEController, TInt aGroup, TInt aSubChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
273 |
static void InitAllHWChannels (); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
274 |
inline TDmaDesc* HdrToHwDes(const SDmaDesHdr& aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
275 |
private: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
276 |
static const SCreateInfo KInfo; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
277 |
public: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
278 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
279 |
void PopulateWorkSet(TNE1DmaChannel& aChannel, const SDmaDesHdr& aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
280 |
void LaunchTransfer(TNE1DmaChannel& aChannel, TBool aBaseSetValid); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
281 |
#if defined(NE1_DMA_DOUBLE_BUFFER) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
282 |
void PopulateBaseSet(TNE1DmaChannel& aChannel, const SDmaDesHdr& aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
283 |
void ContinueTransfer(TNE1DmaChannel& aChannel, TBool aBaseSetValid); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
284 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
285 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
286 |
TNE1DmaChannel iChannels[EDmaChannelCount]; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
287 |
static const SDmacCaps KCaps; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
288 |
}; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
289 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
290 |
static TNaviEngineDmac Controller; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
291 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
292 |
// The following values report to the PIL what the PSL has been implemented |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
293 |
// to support, not necessarily what the hardware actually supports. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
294 |
const SDmacCaps TNaviEngineDmac::KCaps = |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
295 |
{0, // TInt iChannelPriorities; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
296 |
EFalse, // TBool iChannelPauseAndResume; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
297 |
ETrue, // TBool iAddrAlignedToElementSize; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
298 |
EFalse, // TBool i1DIndexAddressing; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
299 |
EFalse, // TBool i2DIndexAddressing; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
300 |
KDmaSyncAuto, // TUint iSynchronizationTypes; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
301 |
KDmaBurstSizeAny, // TUint iBurstTransactions; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
302 |
EFalse, // TBool iDescriptorInterrupt; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
303 |
EFalse, // TBool iFrameInterrupt; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
304 |
EFalse, // TBool iLinkedListPausedInterrupt; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
305 |
EFalse, // TBool iEndiannessConversion; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
306 |
KDmaGraphicsOpNone, // TUint iGraphicsOps; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
307 |
EFalse, // TBool iRepeatingTransfers; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
308 |
EFalse, // TBool iChannelLinking; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
309 |
ETrue, // TBool iHwDescriptors; // DMAC does not really use Hw descriptors |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
310 |
EFalse, // TBool iSrcDstAsymmetry; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
311 |
EFalse, // TBool iAsymHwDescriptors; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
312 |
EFalse, // TBool iBalancedAsymSegments; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
313 |
EFalse, // TBool iAsymCompletionInterrupt; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
314 |
EFalse, // TBool iAsymDescriptorInterrupt; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
315 |
EFalse, // TBool iAsymFrameInterrupt; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
316 |
{0, 0, 0, 0, 0} // TUint32 iReserved[5]; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
317 |
}; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
318 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
319 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
320 |
const TDmac::SCreateInfo TNaviEngineDmac::KInfo = |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
321 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
322 |
ETrue, // iCapsHwDes |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
323 |
KDesCount, // iDesCount |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
324 |
sizeof(TDmaDesc), // iDesSize |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
325 |
EMapAttrSupRw | EMapAttrFullyBlocking // iDesChunkAttribs |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
326 |
}; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
327 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
328 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
329 |
////////////////////////////////////////////////////////////////////////////// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
330 |
// AXI 64bit DMAC - (Scatter Gather |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
331 |
////////////////////////////////////////////////////////////////////////////// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
332 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
333 |
class TNaviEngineDmac64Sg; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
334 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
335 |
class TNeSgChannel : public TDmaSgChannel |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
336 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
337 |
friend class TNaviEngineDmac64Sg; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
338 |
public: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
339 |
TNeSgChannel(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
340 |
TNeSgChannel(TInt aPslId); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
341 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
342 |
inline TUint BaseAddr() {return iBaseAddr;} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
343 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
344 |
#ifdef _DEBUG_PRINT_ISR |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
345 |
void Print(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
346 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
347 |
inline void Pause() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
348 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
349 |
using namespace Channel; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
350 |
AsspRegister::Modify32(iBaseAddr + Ctrl::KHoBase, NULL, Ctrl::KHtSetSuspend); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
351 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
352 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
353 |
inline void Resume() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
354 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
355 |
using namespace Channel; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
356 |
AsspRegister::Modify32(iBaseAddr + Ctrl::KHoBase, NULL, Ctrl::KHtClrSuspend); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
357 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
358 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
359 |
inline void MaskInterrupt() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
360 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
361 |
using namespace Channel; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
362 |
AsspRegister::Modify32(iBaseAddr + Cfg::KHoBase, NULL, Cfg::KHtEndMask|Cfg::KHtCompMask); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
363 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
364 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
365 |
inline TUint32 CurrSrcAddr() const |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
366 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
367 |
using namespace Channel; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
368 |
return AsspRegister::Read32(iBaseAddr + RegSet::KHoBases[RegSet::ECurrent] + RegSet::KHoSrcAddr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
369 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
370 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
371 |
inline TUint32 CurrDstAddr() const |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
372 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
373 |
using namespace Channel; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
374 |
return AsspRegister::Read32(iBaseAddr + RegSet::KHoBases[RegSet::ECurrent] + RegSet::KHoDstAddr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
375 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
376 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
377 |
inline TUint32 CurrByteCount() const |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
378 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
379 |
using namespace Channel; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
380 |
return AsspRegister::Read32(iBaseAddr + RegSet::KHoBases[RegSet::ECurrent] + RegSet::KHoTranByte); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
381 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
382 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
383 |
inline TUint32 Status() const |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
384 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
385 |
return AsspRegister::Read32(iBaseAddr + Channel::Status::KHoBase); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
386 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
387 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
388 |
inline TUint32 Config() const |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
389 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
390 |
return AsspRegister::Read32(iBaseAddr + Channel::Cfg::KHoBase); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
391 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
392 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
393 |
inline TUint32 NextLink() const |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
394 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
395 |
return AsspRegister::Read32(iBaseAddr + Channel::KHoNxtLnkAddr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
396 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
397 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
398 |
inline TUint32 CurrLink() const |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
399 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
400 |
return AsspRegister::Read32(iBaseAddr + Channel::KHoCurrtLnkAddr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
401 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
402 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
403 |
virtual void QueuedRequestCountChanged(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
404 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
405 |
inline TBool IsIdle() const |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
406 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
407 |
const TUint channelStatus = Status(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
408 |
using namespace Channel::Status; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
409 |
const TBool isIdle = (channelStatus & (KHtEnabled | KHtDescLoad)) == 0; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
410 |
return isIdle; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
411 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
412 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
413 |
void Transfer(TDma64Desc* aHwDes); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
414 |
void Close(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
415 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
416 |
private: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
417 |
TUint32 iBaseAddr; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
418 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
419 |
TInt iTransferCount; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
420 |
TSpinLock iLock; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
421 |
}; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
422 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
423 |
/** |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
424 |
Represents the 64 bit controller on the AXI bus - in scatter gather |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
425 |
mode. The controller supports both scatter gather and double buffered |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
426 |
mode but the framework dicatates that separate logical DMACs are |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
427 |
required for each mode of operation. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
428 |
*/ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
429 |
class TNaviEngineDmac64Sg : public TDmac |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
430 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
431 |
public: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
432 |
TNaviEngineDmac64Sg(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
433 |
TInt Create(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
434 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
435 |
private: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
436 |
// from TDmac (PIL pure virtual) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
437 |
virtual void StopTransfer(const TDmaChannel& aChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
438 |
virtual TBool IsIdle(const TDmaChannel& aChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
439 |
virtual TUint MaxTransferLength(TDmaChannel& aChannel, TUint aSrcFlags, TUint aDstFlags, TUint32 aPslInfo); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
440 |
virtual TUint AddressAlignMask(TDmaChannel& aChannel, TUint aSrcFlags, TUint aDstFlags, TUint32 aPslInfo); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
441 |
// from TDmac (PIL virtual) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
442 |
virtual void Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
443 |
virtual TInt InitHwDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
444 |
virtual TInt UpdateHwDes(const SDmaDesHdr& aHdr, TUint32 aSrcAddr, TUint32 aDstAddr, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
445 |
TUint aTransferCount, TUint32 aPslRequestInfo); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
446 |
virtual void ChainHwDes(const SDmaDesHdr& aHdr, const SDmaDesHdr& aNextHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
447 |
virtual void AppendHwDes(const TDmaChannel& aChannel, const SDmaDesHdr& aLastHdr, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
448 |
const SDmaDesHdr& aNewHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
449 |
virtual void UnlinkHwDes(const TDmaChannel& aChannel, SDmaDesHdr& aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
450 |
// other |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
451 |
static void IsrEnd(TAny* aThis); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
452 |
static void IsrErr(TAny* aThis); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
453 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
454 |
inline TDma64Desc* HdrToHwDes(const SDmaDesHdr& aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
455 |
static void JoinHwDes(TDma64Desc& aHwDes, const TDma64Desc& aNextHwDes); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
456 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
457 |
private: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
458 |
static const SCreateInfo KInfo; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
459 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
460 |
public: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
461 |
TNeSgChannel iChannels[Dma64::KChannelCount]; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
462 |
static const SDmacCaps KCaps; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
463 |
}; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
464 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
465 |
static TNaviEngineDmac64Sg Controller64; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
466 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
467 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
468 |
// The following values report to the PIL what the PSL has been implemented |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
469 |
// to support, not necessarily what the hardware actually supports. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
470 |
const SDmacCaps TNaviEngineDmac64Sg::KCaps = |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
471 |
{0, // TInt iChannelPriorities; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
472 |
EFalse, // TBool iChannelPauseAndResume; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
473 |
EFalse, // TBool iAddrAlignedToElementSize; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
474 |
EFalse, // TBool i1DIndexAddressing; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
475 |
EFalse, // TBool i2DIndexAddressing; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
476 |
KDmaSyncAuto, // TUint iSynchronizationTypes; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
477 |
KDmaBurstSizeAny, // TUint iBurstTransactions; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
478 |
EFalse, // TBool iDescriptorInterrupt; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
479 |
EFalse, // TBool iFrameInterrupt; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
480 |
EFalse, // TBool iLinkedListPausedInterrupt; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
481 |
EFalse, // TBool iEndiannessConversion; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
482 |
KDmaGraphicsOpNone, // TUint iGraphicsOps; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
483 |
EFalse, // TBool iRepeatingTransfers; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
484 |
EFalse, // TBool iChannelLinking; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
485 |
ETrue, // TBool iHwDescriptors; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
486 |
EFalse, // TBool iSrcDstAsymmetry; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
487 |
EFalse, // TBool iAsymHwDescriptors; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
488 |
EFalse, // TBool iBalancedAsymSegments; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
489 |
EFalse, // TBool iAsymCompletionInterrupt; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
490 |
EFalse, // TBool iAsymDescriptorInterrupt; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
491 |
EFalse, // TBool iAsymFrameInterrupt; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
492 |
{0, 0, 0, 0, 0} // TUint32 iReserved[5]; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
493 |
}; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
494 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
495 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
496 |
const TDmac::SCreateInfo TNaviEngineDmac64Sg::KInfo = |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
497 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
498 |
ETrue, // iCapsHwDes |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
499 |
KDesCount, // iDesCount |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
500 |
sizeof(TDma64Desc), // iDesSize |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
501 |
EMapAttrSupRw | EMapAttrFullyBlocking // iDesChunkAttribs |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
502 |
}; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
503 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
504 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
505 |
TNaviEngineDmac::TNaviEngineDmac() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
506 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
507 |
// Constructor. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
508 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
509 |
: TDmac(KInfo) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
510 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
511 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
512 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
513 |
TInt TNaviEngineDmac::Create() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
514 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
515 |
// Second phase construction. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
516 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
517 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
518 |
TInt r = TDmac::Create(KInfo); // Base class Create() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
519 |
if (r == KErrNone) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
520 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
521 |
// Read KDMAChannelLocator constants and populate the values in channel objects. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
522 |
for (TInt i=0; i < EDma32ChannelCount; ++i) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
523 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
524 |
TUint ctrlBase = 0; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
525 |
switch (KDMAChannelLocator[i].iDMACtrl) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
526 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
527 |
case EDmaCtrlExBus: ctrlBase = KDMACExBusBase; break; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
528 |
case EDMACtrl32: ctrlBase = KDMAC32Base; break; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
529 |
default: __DMA_CANT_HAPPEN(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
530 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
531 |
iChannels[i].iHWCtrlBase = ctrlBase + KDMAChannelLocator[i].iGroup * KDMAGroupOffset + |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
532 |
KDMAChannelLocator[i].iSubChannel * KDMAChannelOffset; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
533 |
iChannels[i].iSubChannel = KDMAChannelLocator[i].iSubChannel; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
534 |
iChannels[i].iDMACHCReg = KDMAChannelLocator[i].iDMACHCReg | iChannels[i].iSubChannel; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
535 |
iChannels[i].iTransferDataShift = KDMAChannelLocator[i].iTransferShiftSize; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
536 |
iFreeHdr = iFreeHdr->iNext; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
537 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
538 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
539 |
//Bind DMA interrupt for channels we support |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
540 |
TInt irqh0 = Interrupt::Bind(KIntDMAC32_0_End, DMAC32_0_End_Isr, this); __DMA_ASSERTA(irqh0>=0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
541 |
TInt irqh1 = Interrupt::Bind(KIntDMAC32_0_Err, DMAC32_0_Err_Isr, this); __DMA_ASSERTA(irqh1>=0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
542 |
TInt irqh2 = Interrupt::Bind(KIntDMAC32_2_End, DMAC32_2_End_Isr, this); __DMA_ASSERTA(irqh2>=0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
543 |
TInt irqh3 = Interrupt::Bind(KIntDMAC32_2_Err, DMAC32_2_Err_Isr, this); __DMA_ASSERTA(irqh3>=0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
544 |
TInt irqh4 = Interrupt::Bind(KIntDMAC32_3_End, DMAC32_3_End_Isr, this); __DMA_ASSERTA(irqh4>=0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
545 |
TInt irqh5 = Interrupt::Bind(KIntDMAC32_3_Err, DMAC32_3_Err_Isr, this); __DMA_ASSERTA(irqh5>=0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
546 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
547 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
548 |
InitAllHWChannels(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
549 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
550 |
r = Interrupt::Enable(irqh0); __DMA_ASSERTA(r==KErrNone); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
551 |
r = Interrupt::Enable(irqh1); __DMA_ASSERTA(r==KErrNone); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
552 |
r = Interrupt::Enable(irqh2); __DMA_ASSERTA(r==KErrNone); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
553 |
r = Interrupt::Enable(irqh3); __DMA_ASSERTA(r==KErrNone); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
554 |
r = Interrupt::Enable(irqh4); __DMA_ASSERTA(r==KErrNone); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
555 |
r = Interrupt::Enable(irqh5); __DMA_ASSERTA(r==KErrNone); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
556 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
557 |
return r; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
558 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
559 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
560 |
// Initialises all H/W channels. This will make sure they are off on soft restart. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
561 |
void TNaviEngineDmac::InitAllHWChannels() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
562 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
563 |
int i,j; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
564 |
for (i=0;i<KDmaHWCtrl32Count;i++) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
565 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
566 |
for (j=0;j<KDmaCtrl32HWSubChannelCount; j++) InitHWChannel(EDMACtrl32, i, j); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
567 |
AsspRegister::Write32(KDMAC32Base+i*KDMAGroupOffset+KHoDMACONT, 0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
568 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
569 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
570 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
571 |
//Initialises a single H/W channel |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
572 |
void TNaviEngineDmac::InitHWChannel (ENaviEngineDmaController aNEController, TInt aGroup, TInt aSubChannel) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
573 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
574 |
TUint neCtrlBase = 0; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
575 |
switch(aNEController) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
576 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
577 |
case EDMACtrl32: neCtrlBase = KDMAC32Base ; break; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
578 |
default: __DMA_CANT_HAPPEN(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
579 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
580 |
neCtrlBase += aGroup*KDMAGroupOffset + aSubChannel*KDMAChannelOffset; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
581 |
AsspRegister::Write32(neCtrlBase+KHoDMACHS, KHtDMACHS_EN_EN); //disable channel |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
582 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
583 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
584 |
#if defined(NE1_DMA_DOUBLE_BUFFER) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
585 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
586 |
#ifdef _DEBUG |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
587 |
//These values indicate whether all corner cases are running. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
588 |
//Proper test shouldn't leave any of these values to zero. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
589 |
TInt InterruptCounter_DMA32 = 0; // Interrupt counter |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
590 |
TInt Transfer_IdleOnStart = 0; // DMA channel is idle on the start of Transfer. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
591 |
TInt Transfer_NotIdleOnStart = 0; // DMA channel is not idle on the start of Transfer. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
592 |
TInt Transfer_MatchWorkSetTrue = 0; // Descriptor matches "work set" registers |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
593 |
TInt Transfer_MatchWorkSetFalse = 0;// Descriptor doesn't match "work set" descriptor. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
594 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
595 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
596 |
void TNaviEngineDmac::Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aHdr) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
597 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
598 |
// Initiates a (previously constructed) request on a specific channel. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
599 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
600 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
601 |
TDmaChannel& mutableChannel = const_cast<TDmaChannel&>(aChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
602 |
TNE1DmaChannel& channel = static_cast<TNE1DmaChannel&>(mutableChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
603 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
604 |
const TBool isIsr = (NKern::CurrentContext() == NKern::EInterrupt); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
605 |
TInt irq = 0; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
606 |
if(!isIsr) // If we are in ISR context, assume that the lock is already held |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
607 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
608 |
irq = __SPIN_LOCK_IRQSAVE(channel.iIsrLock); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
609 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
610 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
611 |
// The fragment descriptor (src/dest address, size) should be placed into either "Work Set" or "Base Set" |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
612 |
// depending on the actual state of the H/W |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
613 |
if (IsIdle(channel)) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
614 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
615 |
// The channel is idle, for the (most likely) reason that both "Work Set" and "Base Set" transfers are |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
616 |
// completed since the last time we run this function. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
617 |
#ifdef _DEBUG |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
618 |
Transfer_IdleOnStart++; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
619 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
620 |
PopulateWorkSet(channel, aHdr); // Populate "Work Set" |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
621 |
LaunchTransfer(channel, EFalse); // Start the transfer, base set is invalid |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
622 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
623 |
else |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
624 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
625 |
// "Work Set" transfer is still going on. It seems we will manage to place |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
626 |
// the next fragment in time for continious traffic flow. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
627 |
#ifdef _DEBUG |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
628 |
Transfer_NotIdleOnStart++; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
629 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
630 |
PopulateBaseSet(channel, aHdr); // Populate "Base Set" |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
631 |
ContinueTransfer(channel, ETrue);// Indicate Base Set is valid (bvalid = ETrue) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
632 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
633 |
// We should expect here that the "work set" traffic is still in progress. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
634 |
// Once it is completed, "Base Set" content is copied into "Work Set" and the traffic will go on. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
635 |
// However, there is a corner case where we configure "Base Set" too late. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
636 |
// Therefore, check if transfer is still active. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
637 |
if (IsIdle(channel)) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
638 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
639 |
// There is no DMA traffic. There could be two reason for that. Either, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
640 |
// 1. The transfer we have just configured in "Base Set" has already completed, or |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
641 |
// 2. We configured base set too late, after "Work Set" transfer has already finished. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
642 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
643 |
// Check BVALID bit |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
644 |
// if its now clear, then it was set in time, if it's |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
645 |
// still set it was set too late |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
646 |
const TUint32 dchs = AsspRegister::Read32(channel.iHWCtrlBase+KHoDMACHS); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
647 |
const TBool bvalidSet = dchs & KHtDMACHS_BVALID; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
648 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
649 |
if (!bvalidSet) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
650 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
651 |
DMA_PSL_CHAN_TRACE_STATIC(channel, "Base set transferred already"); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
652 |
#ifdef _DEBUG |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
653 |
Transfer_MatchWorkSetTrue++; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
654 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
655 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
656 |
else |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
657 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
658 |
DMA_PSL_CHAN_TRACE_STATIC(channel, "Too late for base set"); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
659 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
660 |
// BVALID bit was set after "Work Set" transfer completed, and DMA H/W didn't |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
661 |
// copy the content of "Base Set" into "Work Set". We have to re-launch the transfer. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
662 |
// This time we have to configure "Work Set" |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
663 |
#ifdef _DEBUG |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
664 |
Transfer_MatchWorkSetFalse++; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
665 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
666 |
PopulateWorkSet(channel, aHdr); // Populate "Work Set". |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
667 |
LaunchTransfer(channel, EFalse); // Start the transfer, "Base Set" is invalid. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
668 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
669 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
670 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
671 |
if(!isIsr) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
672 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
673 |
__SPIN_UNLOCK_IRQRESTORE(channel.iIsrLock, irq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
674 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
675 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
676 |
#else |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
677 |
void TNaviEngineDmac::Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aHdr) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
678 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
679 |
// Initiates a (previously constructed) request on a specific channel. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
680 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
681 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
682 |
TDmaChannel& mutableChannel = const_cast<TDmaChannel&>(aChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
683 |
TNE1DmaChannel& channel = static_cast<TNE1DmaChannel&>(mutableChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
684 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
685 |
DMA_PSL_CHAN_TRACE_STATIC1(channel, "TNaviEngineDmac::Transfer des=0x%08X", HdrToHwDes(aHdr)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
686 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
687 |
const TBool isIsr = (NKern::CurrentContext() == NKern::EInterrupt); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
688 |
TInt irq = 0; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
689 |
if(!isIsr) // If we are in ISR context, assume that the lock is already held |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
690 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
691 |
irq = __SPIN_LOCK_IRQSAVE(channel.iIsrLock); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
692 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
693 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
694 |
// The fragment descriptor (src/dest address, size) should be placed into either "Work Set" or "Base Set" |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
695 |
// depending on the actual state of the H/W |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
696 |
__NK_ASSERT_ALWAYS(IsIdle(channel)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
697 |
PopulateWorkSet(channel, aHdr); // Populate "Work Set" |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
698 |
LaunchTransfer(channel, EFalse); // Start the transfer, base set is invalid |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
699 |
if(!isIsr) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
700 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
701 |
__SPIN_UNLOCK_IRQRESTORE(channel.iIsrLock, irq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
702 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
703 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
704 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
705 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
706 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
707 |
void TNaviEngineDmac::StopTransfer(const TDmaChannel& aChannel) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
708 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
709 |
// Stops a running channel. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
710 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
711 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
712 |
TDmaChannel& mutableChannel = const_cast<TDmaChannel&>(aChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
713 |
TNE1DmaChannel& channel = static_cast<TNE1DmaChannel&>(mutableChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
714 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
715 |
__KTRACE_OPT(KDMA, Kern::Printf("TNaviEngineDmac::StopTransfer channel=%d", channel.PslId())); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
716 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
717 |
channel.StopTransfer(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
718 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
719 |
__KTRACE_OPT(KDMA, Kern::Printf("<TNaviEngineDmac::StopTransfer channel=%d", channel.PslId())); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
720 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
721 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
722 |
TBool TNaviEngineDmac::IsIdle(const TDmaChannel& aChannel) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
723 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
724 |
// Returns the state of a given channel. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
725 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
726 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
727 |
TDmaChannel& mutableChannel = const_cast<TDmaChannel&>(aChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
728 |
TNE1DmaChannel& channel = static_cast<TNE1DmaChannel&>(mutableChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
729 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
730 |
const TBool idle = channel.IsIdle(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
731 |
__KTRACE_OPT(KDMA, Kern::Printf(">Dmac::IsIdle channel=%d, idle=%d", channel.PslId(), idle)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
732 |
return idle; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
733 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
734 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
735 |
// Places the descriptor into "Work Set" |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
736 |
void TNaviEngineDmac::PopulateWorkSet(TNE1DmaChannel& aChannel, const SDmaDesHdr& aHdr) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
737 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
738 |
TDmaDesc* pD = HdrToHwDes(aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
739 |
__KTRACE_OPT(KDMA, Kern::Printf("TNaviEngineDmac::PopulateWorkSet channel=%d des=0x%08X", |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
740 |
aChannel.PslId(), pD)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
741 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
742 |
AsspRegister::Write32(aChannel.iHWCtrlBase+KHoDMACHC, aChannel.iDMACHCReg); //configure channel |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
743 |
AsspRegister::Write32(aChannel.iHWCtrlBase+KHoDMASAW, pD->iSrcAddr); //source addr |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
744 |
AsspRegister::Write32(aChannel.iHWCtrlBase+KHoDMADAW, pD->iDestAddr); //dest addr |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
745 |
AsspRegister::Write32(aChannel.iHWCtrlBase+KHoDMATCW, (pD->iCount>>aChannel.iTransferDataShift)-1); //transfer counter |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
746 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
747 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
748 |
// Starts the transfer. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
749 |
// @pre The chanel is idle. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
750 |
// @arg aBaseSetValid if true, BVALID bit should be set. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
751 |
// @pre iIsrLock must be held |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
752 |
void TNaviEngineDmac::LaunchTransfer(TNE1DmaChannel& aChannel, TBool aBaseSetValid) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
753 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
754 |
__KTRACE_OPT(KDMA, Kern::Printf("TNaviEngineDmac::LaunchTransfer channel=%d", aChannel.PslId())); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
755 |
TInt val = KHtDMACHS_EN|KHtDMACHS_EN_EN; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
756 |
if (TUint(aChannel.iDMACHCReg ^ aChannel.iSubChannel) == (TUint)KHvDMACHC_SW) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
757 |
val |=KHtDMACHS_STG; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
758 |
if (aBaseSetValid) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
759 |
val|=KHtDMACHS_BVALID; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
760 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
761 |
aChannel.iBaseValidSet = aBaseSetValid; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
762 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
763 |
AsspRegister::Write32(aChannel.iHWCtrlBase+KHoDMACHS, val); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
764 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
765 |
aChannel.iTcIrqCount++; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
766 |
DMA_PSL_CHAN_TRACE_STATIC1(aChannel, "inc iTcIrqCount to %d", aChannel.iTcIrqCount); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
767 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
768 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
769 |
#if defined(NE1_DMA_DOUBLE_BUFFER) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
770 |
// Places the descriptor into "Base Set" |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
771 |
void TNaviEngineDmac::PopulateBaseSet(TNE1DmaChannel& aChannel, const SDmaDesHdr& aHdr) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
772 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
773 |
TDmaDesc* pD = HdrToHwDes(aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
774 |
__KTRACE_OPT(KDMA, Kern::Printf(">TNaviEngineDmac::PopulateBaseSet channel=%d des=0x%08X", aChannel.PslId(), pD)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
775 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
776 |
AsspRegister::Write32(aChannel.iHWCtrlBase+KHoDMASAB, pD->iSrcAddr); // Source addr |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
777 |
AsspRegister::Write32(aChannel.iHWCtrlBase+KHoDMADAB, pD->iDestAddr); // Dest addr |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
778 |
AsspRegister::Write32(aChannel.iHWCtrlBase+KHoDMATCB, (pD->iCount>>aChannel.iTransferDataShift)-1); // Transfer counter |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
779 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
780 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
781 |
// @pre DMA transfer is in progress. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
782 |
// @arg aBaseSetValid if true, BVALID bit should be set. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
783 |
// @pre iIsrLock must be held |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
784 |
void TNaviEngineDmac::ContinueTransfer(TNE1DmaChannel& aChannel, TBool aBaseSetValid) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
785 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
786 |
__KTRACE_OPT(KDMA, Kern::Printf("TNaviEngineDmac::ContinueTransfer channel=%d", aChannel.PslId())); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
787 |
TInt val = 0; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
788 |
if (TUint(aChannel.iDMACHCReg ^ aChannel.iSubChannel) == (TUint)KHvDMACHC_SW) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
789 |
val |=KHtDMACHS_STG; // Set software trigger |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
790 |
if (aBaseSetValid) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
791 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
792 |
__NK_ASSERT_DEBUG(!aChannel.iBaseValidSet); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
793 |
aChannel.iBaseValidSet = ETrue; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
794 |
val|=KHtDMACHS_BVALID; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
795 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
796 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
797 |
if (val) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
798 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
799 |
AsspRegister::Write32(aChannel.iHWCtrlBase+KHoDMACHS, val); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
800 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
801 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
802 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
803 |
// As in TDmaDbChannel, except for EIdle state as we have place the 1st and the 2nd |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
804 |
// fragment into different registers. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
805 |
void TNE1DmaChannel::DoQueue(const DDmaRequest& aReq) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
806 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
807 |
TNaviEngineDmac* controller = (TNaviEngineDmac*)iController; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
808 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
809 |
switch (iState) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
810 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
811 |
case EIdle: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
812 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
813 |
controller->PopulateWorkSet(*this, *iCurHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
814 |
const TInt irq = __SPIN_LOCK_IRQSAVE(iIsrLock); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
815 |
if (iCurHdr->iNext) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
816 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
817 |
controller->PopulateBaseSet(*this, *(iCurHdr->iNext)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
818 |
controller->LaunchTransfer(*this, ETrue);//BaseSetValid=True |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
819 |
iState = ETransferring; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
820 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
821 |
else |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
822 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
823 |
controller->LaunchTransfer(*this, EFalse);//BaseSetValid=False |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
824 |
iState = ETransferringLast; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
825 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
826 |
__SPIN_UNLOCK_IRQRESTORE(iIsrLock, irq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
827 |
break; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
828 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
829 |
case ETransferring: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
830 |
// nothing to do |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
831 |
break; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
832 |
case ETransferringLast: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
833 |
iController->Transfer(*this, *(aReq.iFirstHdr)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
834 |
iState = ETransferring; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
835 |
break; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
836 |
default: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
837 |
__DMA_CANT_HAPPEN(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
838 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
839 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
840 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
841 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
842 |
TNE1DmaChannel::TNE1DmaChannel() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
843 |
:iBaseValidSet(EFalse), iTcIrqCount(0), iIsrLock(TSpinLock::EOrderGenericIrqHigh0) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
844 |
{} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
845 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
846 |
/** |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
847 |
Handles normal interrupts as well as recovering from missed interrupts. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
848 |
It must therefore be called during an ISR, for every valid, open channel |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
849 |
on a DMAC .ie not just channels which have status bits set. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
850 |
*/ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
851 |
void TNE1DmaChannel::ProcessIrq() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
852 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
853 |
// The spinlock protects access to the iBaseValidSet flag |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
854 |
// This is needed because it is possible for TNaviEngineDmac::Transfer to |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
855 |
// attempt to populate the base set, set iBaseValidSet, but then |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
856 |
// realize it was too late, and have to unset it. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
857 |
const TInt irq = __SPIN_LOCK_IRQSAVE(iIsrLock); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
858 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
859 |
// check that channel is open |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
860 |
if(iController == NULL) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
861 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
862 |
__SPIN_UNLOCK_IRQRESTORE(iIsrLock, irq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
863 |
return; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
864 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
865 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
866 |
const TInt irqCount = iTcIrqCount; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
867 |
__NK_ASSERT_ALWAYS(irqCount >= 0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
868 |
__NK_ASSERT_ALWAYS(irqCount < 3); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
869 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
870 |
TUint32 dchs = AsspRegister::Read32(iHWCtrlBase+KHoDMACHS); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
871 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
872 |
// Detect if we have missed 1 TC interrupt. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
873 |
// This can happen when there is one transfer in progress, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
874 |
// and the channel attempts to populate the base reg set, but |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
875 |
// is too late and launches a new transfer. The second transfer |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
876 |
// may then complete during the ISR of the first, or the ISR may |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
877 |
// not run untill after the second has already completed. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
878 |
if((irqCount > 0) && IsIdle()) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
879 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
880 |
// Reread status now that we have observed channel as idle. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
881 |
// If a transfer completed between the first read and now, we |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
882 |
// can handle that as a normal interrupt instead of as a |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
883 |
// missed interrupt. This is not essential, just neater |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
884 |
dchs = AsspRegister::Read32(iHWCtrlBase+KHoDMACHS); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
885 |
if(irqCount == 1) // There may or may not be a missed IRQ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
886 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
887 |
if((dchs & KHtDMACHS_TC) == 0) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
888 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
889 |
DMA_PSL_CHAN_TRACE1("Channel had missed TC IRQ irqs=%d", irqCount); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
890 |
ProcessTC(EFalse); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
891 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
892 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
893 |
else if(irqCount == 2) // There is 1 missed and 1 normal IRQ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
894 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
895 |
DMA_PSL_CHAN_TRACE1("Channel had missed TC IRQ irqs=%d", irqCount); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
896 |
ProcessTC(EFalse); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
897 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
898 |
// Ensure that remaining IRQ will be dealt with in next block |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
899 |
__NK_ASSERT_ALWAYS((dchs & KHtDMACHS_TC)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
900 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
901 |
else |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
902 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
903 |
// It should not be possible for there to be more than 2 |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
904 |
// outstanding transfers launched |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
905 |
FAULT(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
906 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
907 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
908 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
909 |
// Deal with normal interrupts |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
910 |
if (dchs&KHtDMACHS_TC) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
911 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
912 |
// ISR should not be able to observe the BVALID bit itself |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
913 |
// since TNaviEngineDmac::Transfer should hold iIsrLock whilst |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
914 |
// it decides if it was set in time |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
915 |
__NK_ASSERT_DEBUG(!(dchs & KHtDMACHS_BVALID)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
916 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
917 |
// Here we find out if a base-set-copy (END) interrupt has |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
918 |
// been missed. If a TC comes shortly after an END IRQ then |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
919 |
// it would be impossible to tell by looking at the status |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
920 |
// register alone |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
921 |
if(iBaseValidSet) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
922 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
923 |
DMA_PSL_CHAN_TRACE("END irq missed "); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
924 |
ProcessEnd(EFalse); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
925 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
926 |
ProcessTC(ETrue); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
927 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
928 |
else if (dchs&KHtDMACHS_END) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
929 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
930 |
ProcessEnd(ETrue); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
931 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
932 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
933 |
__SPIN_UNLOCK_IRQRESTORE(iIsrLock, irq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
934 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
935 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
936 |
void TNE1DmaChannel::ProcessErrorIrq() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
937 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
938 |
const TInt irq = __SPIN_LOCK_IRQSAVE(iIsrLock); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
939 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
940 |
// check that channel is open |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
941 |
if(iController == NULL) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
942 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
943 |
__SPIN_UNLOCK_IRQRESTORE(iIsrLock, irq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
944 |
return; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
945 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
946 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
947 |
// reset channel |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
948 |
ClearStatus(KHtDMACHS_FCLR); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
949 |
TInt badIrqCount = iTcIrqCount; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
950 |
iTcIrqCount = 0; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
951 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
952 |
if(iBaseValidSet) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
953 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
954 |
iBaseValidSet = EFalse; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
955 |
badIrqCount++; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
956 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
957 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
958 |
// complete all outstanding requests as being in error |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
959 |
for(TInt i=0; i < badIrqCount; i++) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
960 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
961 |
HandleIsr(EFalse); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
962 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
963 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
964 |
__SPIN_UNLOCK_IRQRESTORE(iIsrLock, irq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
965 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
966 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
967 |
/** |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
968 |
Handle a transfer complete (work set transfer complete and base set was |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
969 |
empty) on this channel. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
970 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
971 |
@param aClearStatus - Status bits should be cleared |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
972 |
*/ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
973 |
void TNE1DmaChannel::ProcessTC(TBool aClearStatus) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
974 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
975 |
// iTcIrqCount may be zero if StopTransfer were called |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
976 |
// between the transfer being started and the ISR running |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
977 |
if(iTcIrqCount>0) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
978 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
979 |
DMA_PSL_CHAN_TRACE1("dec iTcIrqCount to %d", iTcIrqCount); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
980 |
iTcIrqCount--; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
981 |
DMA_PSL_CHAN_TRACE("TC"); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
982 |
HandleIsr(ETrue); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
983 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
984 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
985 |
__NK_ASSERT_DEBUG(iTcIrqCount >= 0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
986 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
987 |
if(aClearStatus) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
988 |
ClearStatus(KHtDMACHS_TC|KHtDMACHS_END); //Traffic completed BVALID=OFF |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
989 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
990 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
991 |
/** |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
992 |
Handle a END (transfer complete, base set loaded in to work set) on this channel. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
993 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
994 |
@param aClearStatus - Status bit should be cleared |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
995 |
*/ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
996 |
void TNE1DmaChannel::ProcessEnd(TBool aClearStatus) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
997 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
998 |
if(iBaseValidSet) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
999 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1000 |
DMA_PSL_CHAN_TRACE("END"); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1001 |
iBaseValidSet = EFalse; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1002 |
HandleIsr(ETrue); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1003 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1004 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1005 |
if(aClearStatus) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1006 |
ClearStatus(KHtDMACHS_END); //Traffic completed BVALID=ON |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1007 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1008 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1009 |
/** |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1010 |
@param aBitmask The bits to be cleared in this channel's status register |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1011 |
*/ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1012 |
void TNE1DmaChannel::ClearStatus(TUint32 aBitmask) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1013 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1014 |
if (TUint((this->iDMACHCReg) ^ (this->iSubChannel)) == (TUint)KHvDMACHC_SW) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1015 |
aBitmask |= KHtDMACHS_STG; //Add STG for S/W channel |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1016 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1017 |
AsspRegister::Write32(iHWCtrlBase+KHoDMACHS, aBitmask); //End-of-Int |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1018 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1019 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1020 |
/** |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1021 |
Call HandleIsr for this channel |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1022 |
*/ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1023 |
void TNE1DmaChannel::HandleIsr(TBool aIsComplete) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1024 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1025 |
// iController must be casted so that the private method |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1026 |
// TDmac::HandleIsr can be called since this method is |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1027 |
// a friend of TNaviEngineDmac, but not TDmac. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1028 |
static_cast<TNaviEngineDmac*>(iController)->HandleIsr(*this, EDmaCallbackRequestCompletion, aIsComplete); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1029 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1030 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1031 |
/** |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1032 |
Stop transfer for this channel |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1033 |
*/ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1034 |
void TNE1DmaChannel::StopTransfer() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1035 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1036 |
const TInt irq = __SPIN_LOCK_IRQSAVE(iIsrLock); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1037 |
// At this point, device driver should have cancelled DMA request. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1038 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1039 |
// The procedure for clearing the EN bit to 0 via CPU access during DMA transfer (EN bit = 1) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1040 |
TUint32 dmaCHS = AsspRegister::Read32(iHWCtrlBase+KHoDMACHS); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1041 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1042 |
// Read the DCHSn register to be cleared at the relevant channel and confirm that |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1043 |
// both the RQST and ACT bits are cleared to 0. If either or both of them are 1, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1044 |
// perform polling until their values become 0.. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1045 |
// OR unless KHtDMACHS_EN is already cleared by the HW at the end of the transfer - |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1046 |
// while we're polling... |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1047 |
while( (dmaCHS & KHtDMACHS_EN) && |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1048 |
dmaCHS & (KHtDMACHS_RQST | KHtDMACHS_ACT) ) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1049 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1050 |
dmaCHS = AsspRegister::Read32(iHWCtrlBase+KHoDMACHS); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1051 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1052 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1053 |
// enable writing to EN bit.. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1054 |
dmaCHS |= KHtDMACHS_EN_EN; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1055 |
AsspRegister::Write32(iHWCtrlBase+KHoDMACHS, dmaCHS); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1056 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1057 |
// clear the EN bit to 0 |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1058 |
// and set the FCLR bit of the DCHSn register to 1. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1059 |
dmaCHS &= (~KHtDMACHS_EN); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1060 |
dmaCHS |= KHtDMACHS_FCLR; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1061 |
AsspRegister::Write32(iHWCtrlBase+KHoDMACHS, dmaCHS); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1062 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1063 |
// check that channel is idle, and status bits have been cleared |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1064 |
__NK_ASSERT_ALWAYS(IsIdle()); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1065 |
dmaCHS = AsspRegister::Read32(iHWCtrlBase+KHoDMACHS); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1066 |
__NK_ASSERT_ALWAYS((dmaCHS & (KHtDMACHS_TC | KHtDMACHS_END)) == 0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1067 |
__NK_ASSERT_ALWAYS(iTcIrqCount >=0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1068 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1069 |
// given the above checks, clear the iTcIrqCount and iBaseValidSet so |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1070 |
// that the ISR won't mistakenly think there are missed interrupts |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1071 |
iTcIrqCount = 0; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1072 |
iBaseValidSet = EFalse; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1073 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1074 |
__SPIN_UNLOCK_IRQRESTORE(iIsrLock, irq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1075 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1076 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1077 |
/** |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1078 |
@pre Channel has been stopped |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1079 |
*/ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1080 |
void TNE1DmaChannel::Close() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1081 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1082 |
// The lock prevents a channel being closed |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1083 |
// during an ISR. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1084 |
const TInt irq = __SPIN_LOCK_IRQSAVE(iIsrLock); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1085 |
DMA_PSL_CHAN_TRACE("Close"); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1086 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1087 |
// Check that the channel was Idle and Stopped |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1088 |
__NK_ASSERT_ALWAYS(IsIdle()); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1089 |
__NK_ASSERT_ALWAYS(iTcIrqCount == 0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1090 |
__NK_ASSERT_ALWAYS(!iBaseValidSet); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1091 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1092 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1093 |
// Here we clear iController in advance of the PIL |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1094 |
// If we did not do this, then when we release the lock, the ISR |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1095 |
// could observe it as non-null, proceed, but then have the PIL |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1096 |
// clear it mid-isr |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1097 |
iController = NULL; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1098 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1099 |
__SPIN_UNLOCK_IRQRESTORE(iIsrLock, irq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1100 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1101 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1102 |
TBool TNE1DmaChannel::IsIdle() const |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1103 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1104 |
TUint status = AsspRegister::Read32(iHWCtrlBase+KHoDMACHS); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1105 |
return !(status & KHtDMACHS_EN); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1106 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1107 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1108 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1109 |
void TNE1DmaChannel::QueuedRequestCountChanged() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1110 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1111 |
const TInt qreqs = __e32_atomic_load_acq32(&iQueuedRequests); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1112 |
DMA_PSL_CHAN_TRACE1("TNE1DmaChannel::QueuedRequestCountChanged() %d", qreqs); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1113 |
__DMA_ASSERTA(qreqs >= 0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1114 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1115 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1116 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1117 |
TUint TNaviEngineDmac::MaxTransferLength(TDmaChannel& aChannel, TUint /*aSrcFlags*/, TUint /*aDstFlags*/, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1118 |
TUint32 /*aPslInfo*/) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1119 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1120 |
// Returns the maximum transfer size for a given transfer. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1121 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1122 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1123 |
TNE1DmaChannel& channel = (TNE1DmaChannel&)aChannel; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1124 |
return (1u<<channel.iTransferDataShift) * KMaxDMAUnitTransferLen; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1125 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1126 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1127 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1128 |
TUint TNaviEngineDmac::AddressAlignMask(TDmaChannel& aChannel, TUint /*aSrcFlags*/, TUint /*aDstFlags*/, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1129 |
TUint32 /*aPslInfo*/) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1130 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1131 |
// Returns the memory buffer alignment restrictions mask for a given transfer. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1132 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1133 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1134 |
TNE1DmaChannel& channel = (TNE1DmaChannel&)aChannel; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1135 |
return (1<<channel.iTransferDataShift) - 1; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1136 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1137 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1138 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1139 |
TInt TNaviEngineDmac::InitHwDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1140 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1141 |
// Sets up (from a passed in request) the descriptor with that fragment's |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1142 |
// transfer parameters. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1143 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1144 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1145 |
TDmaDesc* pD = HdrToHwDes(aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1146 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1147 |
__KTRACE_OPT(KDMA, Kern::Printf("TNaviEngineDmac::InitHwDes 0x%08X", pD)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1148 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1149 |
// Unaligned descriptor? Bug in generic layer! |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1150 |
__DMA_ASSERTD(IsHwDesAligned(pD)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1151 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1152 |
const TDmaTransferConfig& src = aTransferArgs.iSrcConfig; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1153 |
const TDmaTransferConfig& dst = aTransferArgs.iDstConfig; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1154 |
pD->iSrcAddr = (src.iFlags & KDmaPhysAddr) ? src.iAddr : Epoc::LinearToPhysical(src.iAddr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1155 |
__DMA_ASSERTD(pD->iSrcAddr != KPhysAddrInvalid); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1156 |
pD->iDestAddr = (dst.iFlags & KDmaPhysAddr) ? dst.iAddr : Epoc::LinearToPhysical(dst.iAddr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1157 |
__DMA_ASSERTD(pD->iDestAddr != KPhysAddrInvalid); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1158 |
pD->iCount = aTransferArgs.iTransferCount; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1159 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1160 |
__KTRACE_OPT(KDMA, Kern::Printf(" src=0x%08X dest=0x%08X count=%d", |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1161 |
pD->iSrcAddr, pD->iDestAddr, pD->iCount)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1162 |
return KErrNone; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1163 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1164 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1165 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1166 |
TInt TNaviEngineDmac::UpdateHwDes(const SDmaDesHdr& aHdr, TUint32 aSrcAddr, TUint32 aDstAddr, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1167 |
TUint aTransferCount, TUint32 aPslRequestInfo) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1168 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1169 |
// Updates (from the passed in arguments) fields of the descriptor. This |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1170 |
// function is called by the PIL in ISR context. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1171 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1172 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1173 |
TDmaDesc* pD = HdrToHwDes(aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1174 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1175 |
__KTRACE_OPT(KDMA, Kern::Printf("TNaviEngineDmac::UpdateHwDes 0x%08X", pD)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1176 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1177 |
// Unaligned descriptor? Bug in generic layer! |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1178 |
__DMA_ASSERTD(IsHwDesAligned(pD)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1179 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1180 |
// Addresses passed into this function are always physical ones. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1181 |
if (aSrcAddr != KPhysAddrInvalid) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1182 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1183 |
__KTRACE_OPT(KDMA, Kern::Printf(" Changing src addr, old: 0x%08X new: 0x%08X", |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1184 |
pD->iSrcAddr, aSrcAddr)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1185 |
pD->iSrcAddr = aSrcAddr; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1186 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1187 |
if (aDstAddr != KPhysAddrInvalid) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1188 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1189 |
__KTRACE_OPT(KDMA, Kern::Printf(" Changing dst addr, old: 0x%08X new: 0x%08X", |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1190 |
pD->iDestAddr, aDstAddr)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1191 |
pD->iDestAddr = aDstAddr; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1192 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1193 |
if (aTransferCount != 0) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1194 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1195 |
__KTRACE_OPT(KDMA, Kern::Printf(" Changing xfer count, old: %d new: %d", |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1196 |
pD->iCount, aTransferCount)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1197 |
pD->iCount = aTransferCount; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1198 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1199 |
if (aPslRequestInfo != 0) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1200 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1201 |
__KTRACE_OPT(KDMA, Kern::Printf(" aPslRequestInfo specified (0x%08X) but ignored", |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1202 |
aPslRequestInfo)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1203 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1204 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1205 |
__KTRACE_OPT(KDMA, Kern::Printf(" src=0x%08X dst=0x%08X count=%d", |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1206 |
pD->iSrcAddr, pD->iDestAddr, pD->iCount)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1207 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1208 |
return KErrNone; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1209 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1210 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1211 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1212 |
void TNaviEngineDmac::ChainHwDes(const SDmaDesHdr& /*aHdr*/, const SDmaDesHdr& /*aNextHd*/) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1213 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1214 |
// Chains hardware descriptors together. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1215 |
// DMAC32 doesn't support linked descriptors, therefore there is nothing we have to do here. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1216 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1217 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1218 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1219 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1220 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1221 |
void TNaviEngineDmac::AppendHwDes(const TDmaChannel& /*aChannel*/, const SDmaDesHdr& /*aLastHdr*/, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1222 |
const SDmaDesHdr& /*aNewHdr*/) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1223 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1224 |
// Appends a descriptor to the chain while the channel is running. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1225 |
// DMAC32 doesn't support linked descriptors, therefore there is nothing we have to do here. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1226 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1227 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1228 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1229 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1230 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1231 |
void TNaviEngineDmac::UnlinkHwDes(const TDmaChannel& /*aChannel*/, SDmaDesHdr& /*aHdr*/) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1232 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1233 |
// Unlink the last item in the h/w descriptor chain from a subsequent chain that it was possibly linked to. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1234 |
// DMAC32 doesn't support linked descriptors, therefore there is nothing we have to do here. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1235 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1236 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1237 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1238 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1239 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1240 |
void TNaviEngineDmac::DMAC32_Isr(TAny* aThis, TInt aController, TInt aDmaStat, TInt aCompleted) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1241 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1242 |
// Generic part for all DMA32 interrupts. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1243 |
// Reads the interrupt identification and calls back into the base class |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1244 |
// interrupt service handler with the channel identifier and an indication whether the |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1245 |
// transfer completed correctly or with an error. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1246 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1247 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1248 |
DMA_PSL_TRACE("Begin ISR"); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1249 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1250 |
TNaviEngineDmac& me = *static_cast<TNaviEngineDmac*>(aThis); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1251 |
int i; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1252 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1253 |
if (aCompleted) // Transfer-completed interrupt has occured |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1254 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1255 |
// Go through the all eight subchannels to check which event has occured. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1256 |
for (i=0;i<KDmaCtrl32HWSubChannelCount;i++) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1257 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1258 |
TInt channel = DMAC32_HWChannelsLocator[aController][i]; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1259 |
#ifdef _DEBUG |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1260 |
if (channel >= EDma32ChannelCount) __DMA_CANT_HAPPEN(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1261 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1262 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1263 |
// Skip unused physical channels |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1264 |
// .ie those with no corresponding entry |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1265 |
// in KDMAChannelLocator |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1266 |
if(channel == -1) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1267 |
continue; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1268 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1269 |
TNE1DmaChannel& ne1Chan = me.iChannels[channel]; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1270 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1271 |
ne1Chan.ProcessIrq(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1272 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1273 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1274 |
else // Error interrupt has occured. aDmaStat is not valid. Should read H/W registers. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1275 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1276 |
// Go through the all eight subchannels to check which event has occured. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1277 |
for (i=0;i<KDmaCtrl32HWSubChannelCount;i++) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1278 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1279 |
TInt dchs= AsspRegister::Read32(KDMAC32Base+aController*KDMAGroupOffset+i*KDMAChannelOffset+KHoDMACHS); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1280 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1281 |
if (dchs&KHtDMACHS_ERR) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1282 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1283 |
TInt channel = DMAC32_HWChannelsLocator[aController][i]; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1284 |
#ifdef _DEBUG |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1285 |
if (channel >= EDma32ChannelCount) __DMA_CANT_HAPPEN(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1286 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1287 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1288 |
TNE1DmaChannel& ne1Chan = me.iChannels[channel]; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1289 |
ne1Chan.ProcessErrorIrq(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1290 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1291 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1292 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1293 |
#if defined(NE1_DMA_DOUBLE_BUFFER) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1294 |
#ifdef _DEBUG |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1295 |
InterruptCounter_DMA32++; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1296 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1297 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1298 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1299 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1300 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1301 |
void TNaviEngineDmac::DMAC32_0_End_Isr(TAny* aThis) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1302 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1303 |
TInt stat = (TInt)AsspRegister::Read32(KDMAC32Base+0*KDMAGroupOffset+KHoDMASTAT); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1304 |
DMAC32_Isr(aThis, 0, stat, 1); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1305 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1306 |
void TNaviEngineDmac::DMAC32_2_End_Isr(TAny* aThis) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1307 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1308 |
TInt stat = (TInt)AsspRegister::Read32(KDMAC32Base+2*KDMAGroupOffset+KHoDMASTAT); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1309 |
DMAC32_Isr(aThis, 2, stat, 1); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1310 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1311 |
void TNaviEngineDmac::DMAC32_3_End_Isr(TAny* aThis) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1312 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1313 |
TInt stat = (TInt)AsspRegister::Read32(KDMAC32Base+3*KDMAGroupOffset+KHoDMASTAT); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1314 |
DMAC32_Isr(aThis, 3, stat, 1); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1315 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1316 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1317 |
void TNaviEngineDmac::DMAC32_0_Err_Isr(TAny* aThis) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1318 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1319 |
DMAC32_Isr(aThis, 0, 0, 0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1320 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1321 |
void TNaviEngineDmac::DMAC32_2_Err_Isr(TAny* aThis) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1322 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1323 |
DMAC32_Isr(aThis, 2, 0, 0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1324 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1325 |
void TNaviEngineDmac::DMAC32_3_Err_Isr(TAny* aThis) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1326 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1327 |
DMAC32_Isr(aThis, 3, 0, 0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1328 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1329 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1330 |
inline TDmaDesc* TNaviEngineDmac::HdrToHwDes(const SDmaDesHdr& aHdr) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1331 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1332 |
// Changes return type of base class call. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1333 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1334 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1335 |
return static_cast<TDmaDesc*>(TDmac::HdrToHwDes(aHdr)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1336 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1337 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1338 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1339 |
// Channel Opening/Closing (Channel Allocator) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1340 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1341 |
TDmaChannel* DmaChannelMgr::Open(TUint32 aOpenId, TBool aDynChannel, TUint aPriority) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1342 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1343 |
__KTRACE_OPT(KDMA, Kern::Printf("DmaChannelMgr::Open Id=%d DynChannel=%d Priority=%d", |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1344 |
aOpenId, aDynChannel, aPriority)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1345 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1346 |
__DMA_ASSERTA(aOpenId < static_cast<TUint32>(EDmaChannelCount)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1347 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1348 |
if (aDynChannel) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1349 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1350 |
__KTRACE_OPT(KPANIC, Kern::Printf("DmaChannelMgr::Open failed as dynamic channel allocation is not supported")); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1351 |
return NULL; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1352 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1353 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1354 |
const ENaviEngineDmaController controllerId = KDMAChannelLocator[aOpenId].iDMACtrl; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1355 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1356 |
TUint32 pslId = NULL; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1357 |
TDmaChannel* pC = NULL; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1358 |
TDmac* dmac = NULL; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1359 |
const SDmacCaps* caps = NULL; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1360 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1361 |
switch (controllerId) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1362 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1363 |
case EDmaCtrlExBus: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1364 |
// fall through, EDmaCtrlExBus and EDMACtrl32 contollers work the same way |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1365 |
case EDMACtrl32: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1366 |
pslId = aOpenId; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1367 |
pC = Controller.iChannels + pslId; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1368 |
dmac = &Controller; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1369 |
caps = &TNaviEngineDmac::KCaps; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1370 |
break; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1371 |
case EDmaCtrl64: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1372 |
pslId = aOpenId - EDma64MemToMem0; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1373 |
pC = Controller64.iChannels + pslId; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1374 |
dmac = &Controller64; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1375 |
caps = &TNaviEngineDmac64Sg::KCaps; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1376 |
break; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1377 |
default: |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1378 |
__DMA_CANT_HAPPEN(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1379 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1380 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1381 |
if (pC->IsOpened()) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1382 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1383 |
pC = NULL; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1384 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1385 |
else |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1386 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1387 |
pC->iController = dmac; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1388 |
pC->iDmacCaps = caps; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1389 |
pC->iPslId = pslId; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1390 |
// Note: Dynamic channel allocation not currently supported by PIL |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1391 |
pC->iDynChannel = EFalse; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1392 |
// Note: Channel priority setting not currently supported by PIL |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1393 |
pC->iPriority = aPriority; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1394 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1395 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1396 |
return pC; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1397 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1398 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1399 |
void DmaChannelMgr::Close(TDmaChannel* aChannel) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1400 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1401 |
if(aChannel->iController == &Controller) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1402 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1403 |
// Check if this is a TNE1DmaChannel |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1404 |
TNE1DmaChannel* channel = static_cast<TNE1DmaChannel*>(aChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1405 |
channel->Close(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1406 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1407 |
else if(aChannel->iController == &Controller64) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1408 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1409 |
TNeSgChannel* channel = static_cast<TNeSgChannel*>(aChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1410 |
channel->Close(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1411 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1412 |
else |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1413 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1414 |
FAULT(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1415 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1416 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1417 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1418 |
TInt DmaChannelMgr::StaticExtension(TInt /* aCmd */, TAny* /* aArg */) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1419 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1420 |
return KErrNotSupported; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1421 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1422 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1423 |
TNeSgChannel::TNeSgChannel() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1424 |
:TDmaSgChannel(), iBaseAddr(NULL), iTransferCount(0), iLock(TSpinLock::EOrderGenericIrqHigh0) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1425 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1426 |
FUNC_LOG; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1427 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1428 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1429 |
TNeSgChannel::TNeSgChannel(TInt aPslId) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1430 |
:TDmaSgChannel(), iTransferCount(0), iLock(TSpinLock::EOrderGenericIrqHigh0) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1431 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1432 |
FUNC_LOG; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1433 |
iPslId = aPslId; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1434 |
iBaseAddr = Channel::KHoBases[iPslId] + KHwDMAC64Base; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1435 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1436 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1437 |
void TNeSgChannel::Transfer(TDma64Desc* aHwDes) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1438 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1439 |
__DMA_ASSERTD(aHwDes); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1440 |
#ifdef _DEBUG_PRINT |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1441 |
Print(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1442 |
aHwDes->Print(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1443 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1444 |
const TPhysAddr descAddr = iController->HwDesLinToPhys(aHwDes); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1445 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1446 |
__NK_ASSERT_DEBUG(IsIdle()); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1447 |
// We shouldn't be clobbering the "next link" register. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1448 |
// When a descriptor chain has completed the |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1449 |
// register should be empty. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1450 |
__NK_ASSERT_DEBUG(NextLink() == NULL); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1451 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1452 |
const TBool isIsr = (NKern::CurrentContext() == NKern::EInterrupt); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1453 |
TInt irq = 0; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1454 |
if(!isIsr) // If we are in ISR context, assume that the lock is already held |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1455 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1456 |
irq = __SPIN_LOCK_IRQSAVE(iLock); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1457 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1458 |
DMA_PSL_CHAN_TRACE1("Transfer iTransferCount %d", iTransferCount); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1459 |
iTransferCount++; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1460 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1461 |
AsspRegister::Write32(iBaseAddr + Channel::KHoNxtLnkAddr, descAddr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1462 |
AsspRegister::Modify32(iBaseAddr + Channel::Cfg::KHoBase, 0, Channel::Cfg::KHtLinkMode); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1463 |
AsspRegister::Modify32(iBaseAddr + Channel::Ctrl::KHoBase, 0, Channel::Ctrl::KHtSetEnable); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1464 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1465 |
#ifdef _DEBUG_PRINT |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1466 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1467 |
TUint32 status = NULL; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1468 |
do |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1469 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1470 |
status = Status(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1471 |
__NK_ASSERT_ALWAYS((status & Channel::Status::KHtDescErr) == 0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1472 |
} while (status & Channel::Status::KHtDescLoad); // are we still loading desc? |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1473 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1474 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1475 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1476 |
AsspRegister::Modify32(iBaseAddr + Channel::Ctrl::KHoBase, 0, Channel::Ctrl::KHtSwTrigger); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1477 |
if(!isIsr) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1478 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1479 |
__SPIN_UNLOCK_IRQRESTORE(iLock, irq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1480 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1481 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1482 |
#ifdef _DEBUG_PRINT |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1483 |
Print(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1484 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1485 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1486 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1487 |
void TNeSgChannel::Close() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1488 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1489 |
// The lock prevents a channel being closed |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1490 |
// during an ISR. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1491 |
const TInt irq = __SPIN_LOCK_IRQSAVE(iLock); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1492 |
DMA_PSL_CHAN_TRACE("Close"); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1493 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1494 |
// Check that the channel was Idle and Stopped |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1495 |
__NK_ASSERT_ALWAYS(IsIdle()); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1496 |
__NK_ASSERT_ALWAYS(iTransferCount == 0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1497 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1498 |
// Here we clear iController in advance of the PIL |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1499 |
// If we did not do this, then when we release the lock, the ISR |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1500 |
// could observe it as non-null, proceed, but then have the PIL |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1501 |
// clear it mid-isr |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1502 |
iController = NULL; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1503 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1504 |
__SPIN_UNLOCK_IRQRESTORE(iLock, irq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1505 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1506 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1507 |
#ifdef _DEBUG_PRINT_ISR |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1508 |
void TNeSgChannel::Print() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1509 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1510 |
FUNC_LOG; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1511 |
PRINT(CurrSrcAddr()); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1512 |
PRINT(CurrDstAddr()); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1513 |
PRINT(CurrByteCount()); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1514 |
PRINT(Status()); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1515 |
PRINT(Config()); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1516 |
PRINT(CurrLink()); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1517 |
PRINT(NextLink()); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1518 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1519 |
Kern::Printf(""); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1520 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1521 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1522 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1523 |
void TNeSgChannel::QueuedRequestCountChanged() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1524 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1525 |
const TInt qreqs = __e32_atomic_load_acq32(&iQueuedRequests); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1526 |
DMA_PSL_CHAN_TRACE1("TNE1DmaChannel::QueuedRequestCountChanged() %d", qreqs); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1527 |
__DMA_ASSERTA(qreqs >= 0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1528 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1529 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1530 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1531 |
TNaviEngineDmac64Sg::TNaviEngineDmac64Sg() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1532 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1533 |
// Constructor. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1534 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1535 |
: TDmac(KInfo) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1536 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1537 |
FUNC_LOG; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1538 |
for(TInt i = 0; i < Dma64::KChannelCount; i++) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1539 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1540 |
// cannot use assignment since internal refernces |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1541 |
// eg. iNullPtr = &iCurHdr will become invalid |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1542 |
new (&iChannels[i]) TNeSgChannel(i); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1543 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1544 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1545 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1546 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1547 |
TInt TNaviEngineDmac64Sg::Create() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1548 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1549 |
// Second phase construction. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1550 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1551 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1552 |
FUNC_LOG; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1553 |
TInt r = TDmac::Create(KInfo); // Base class Create() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1554 |
if (r == KErrNone) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1555 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1556 |
r = Interrupt::Bind(KIntDMAC64_End, IsrEnd, this); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1557 |
__DMA_ASSERTA(r >= KErrNone); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1558 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1559 |
r = Interrupt::Enable(KIntDMAC64_End); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1560 |
__DMA_ASSERTA(r >= KErrNone); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1561 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1562 |
r = Interrupt::Bind(KIntDMAC64_Err, IsrErr, this); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1563 |
__DMA_ASSERTA(r >= KErrNone); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1564 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1565 |
r = Interrupt::Enable(KIntDMAC64_Err); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1566 |
__DMA_ASSERTA(r >= KErrNone); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1567 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1568 |
return r; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1569 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1570 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1571 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1572 |
void TNaviEngineDmac64Sg::Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aHdr) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1573 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1574 |
// Initiates a (previously constructed) request on a specific channel. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1575 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1576 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1577 |
TDma64Desc* hwDes = HdrToHwDes(aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1578 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1579 |
TDmaChannel& mutableChannel = const_cast<TDmaChannel&>(aChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1580 |
TNeSgChannel& channel = static_cast<TNeSgChannel&>(mutableChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1581 |
channel.Transfer(hwDes); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1582 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1583 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1584 |
// Note for if Pause and Resume is ever made externally |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1585 |
// accessible for this driver. This function has potentially |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1586 |
// undesirable behaviour if it is called while the channel is |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1587 |
// paused. Although any remaining transfers in the linked list |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1588 |
// will be abandoned it will allow the current transfer to |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1589 |
// complete. It would need to be modified to prevent this. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1590 |
void TNaviEngineDmac64Sg::StopTransfer(const TDmaChannel& aChannel) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1591 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1592 |
// Stops a running channel. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1593 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1594 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1595 |
const TInt id = aChannel.PslId(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1596 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1597 |
DMA_PSL_CHAN_TRACE_STATIC(aChannel, "StopTransfer"); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1598 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1599 |
#ifdef _DEBUG_PRINT |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1600 |
iChannels[id].Print(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1601 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1602 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1603 |
//This implements the ForcedEnd procdure on page 2-10-82 of NaviEngine TRM |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1604 |
const TUint32 channelBase = iChannels[id].BaseAddr(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1605 |
volatile TUint32 channelStatus = NULL; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1606 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1607 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1608 |
AsspRegister::Write32(channelBase + Channel::Interval::KHo, 0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1609 |
FOREVER |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1610 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1611 |
FOREVER |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1612 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1613 |
AsspRegister::Modify32(channelBase + Channel::Ctrl::KHoBase, NULL, Channel::Ctrl::KHtSetSuspend); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1614 |
channelStatus = AsspRegister::Read32(channelBase + Channel::Status::KHoBase); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1615 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1616 |
if((channelStatus & (Channel::Status::KHtDescWb|Channel::Status::KHtDescLoad)) == 0) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1617 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1618 |
//we can leave loop if there is no descriptor load or |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1619 |
//writeback in progress |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1620 |
break; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1621 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1622 |
AsspRegister::Modify32(channelBase + Channel::Ctrl::KHoBase, NULL, Channel::Ctrl::KHtClrSuspend); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1623 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1624 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1625 |
//Switch back to single transfer + register mode, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1626 |
//mask completion + end interrupts. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1627 |
AsspRegister::Modify32(channelBase + Channel::Cfg::KHoBase, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1628 |
Channel::Cfg::KHtTransMode | Channel::Cfg::KHtLinkMode, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1629 |
Channel::Cfg::KHtEndMask | Channel::Cfg::KHtCompMask); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1630 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1631 |
AsspRegister::Modify32(channelBase + Channel::Ctrl::KHoBase, NULL, Channel::Ctrl::KHtClrSuspend); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1632 |
AsspRegister::Modify32(channelBase + Channel::Ctrl::KHoBase, NULL, Channel::Ctrl::KHtSetSuspend); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1633 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1634 |
channelStatus = AsspRegister::Read32(channelBase + Channel::Status::KHoBase); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1635 |
AsspRegister::Modify32(channelBase + Channel::Ctrl::KHoBase, NULL, Channel::Ctrl::KHtClrSuspend); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1636 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1637 |
if((channelStatus & (Channel::Status::KHtDescWb|Channel::Status::KHtDescLoad)) == 0) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1638 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1639 |
break; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1640 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1641 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1642 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1643 |
//WARNING: This step is not mentioned in the forced stop |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1644 |
//procedure. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1645 |
//We have now broken out of linked mode, and just want to finish |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1646 |
//transfer of the current desc, so switch back to block transfer |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1647 |
//mode and set the software trigger so we can complete. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1648 |
AsspRegister::Modify32(channelBase + Channel::Cfg::KHoBase, 0, Channel::Cfg::KHtTransMode); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1649 |
AsspRegister::Modify32(channelBase + Channel::Ctrl::KHoBase, 0, Channel::Ctrl::KHtSwTrigger); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1650 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1651 |
FOREVER |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1652 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1653 |
if( |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1654 |
((channelStatus & (Channel::Status::KHtAct | Channel::Status::KHtRqst)) == 0) || |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1655 |
((channelStatus & Channel::Status::KHtEnabled) == 0) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1656 |
) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1657 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1658 |
break; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1659 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1660 |
channelStatus = AsspRegister::Read32(channelBase + Channel::Status::KHoBase); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1661 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1662 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1663 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1664 |
AsspRegister::Modify32(channelBase + Channel::Ctrl::KHoBase, NULL, Channel::Ctrl::KHtSwReset); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1665 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1666 |
#ifdef _DEBUG |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1667 |
//we are deliberatly breaking a descriptor chain |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1668 |
//so clear Next Link Address |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1669 |
AsspRegister::Write32(channelBase + Channel::KHoNxtLnkAddr, NULL); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1670 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1671 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1672 |
TDmaChannel& mutableChannel = const_cast<TDmaChannel&>(aChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1673 |
TNeSgChannel& channel = static_cast<TNeSgChannel&>(mutableChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1674 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1675 |
const TInt irq = __SPIN_LOCK_IRQSAVE(channel.iLock); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1676 |
channel.iTransferCount = 0; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1677 |
__SPIN_UNLOCK_IRQRESTORE(channel.iLock, irq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1678 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1679 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1680 |
TBool TNaviEngineDmac64Sg::IsIdle(const TDmaChannel& aChannel) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1681 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1682 |
// Returns the state of a given channel. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1683 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1684 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1685 |
const TNeSgChannel& channel = static_cast<const TNeSgChannel&>(aChannel); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1686 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1687 |
__KTRACE_OPT(KDMA, Kern::Printf("TNaviEngineDmac64Sg::IsIdle channel=%d, chanStatus=0x%08x", |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1688 |
channel.PslId(), channel.Status())); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1689 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1690 |
return channel.IsIdle(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1691 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1692 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1693 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1694 |
TUint TNaviEngineDmac64Sg::MaxTransferLength(TDmaChannel& /*aChannel*/, TUint /*aSrcFlags*/, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1695 |
TUint /*aDstFlags*/, TUint32 /*aPslInfo*/) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1696 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1697 |
// Returns the maximum transfer size for a given transfer. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1698 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1699 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1700 |
return KDma64MaxTransferBytes; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1701 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1702 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1703 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1704 |
TUint TNaviEngineDmac64Sg::AddressAlignMask(TDmaChannel& /*aChannel*/, TUint /*aSrcFlags*/, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1705 |
TUint /*aDstFlags*/, TUint32 /*aPslInfo*/) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1706 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1707 |
// Returns the memory buffer alignment restrictions mask for a given transfer. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1708 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1709 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1710 |
// The 64 bit DMAC does not impose any alignment restriction on |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1711 |
// src and dst buffers, for any channel |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1712 |
return 0x0; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1713 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1714 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1715 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1716 |
TInt TNaviEngineDmac64Sg::InitHwDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1717 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1718 |
// Sets up (from a passed in request) the descriptor with that fragment's |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1719 |
// transfer parameters. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1720 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1721 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1722 |
TDma64Desc* pD = HdrToHwDes(aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1723 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1724 |
__KTRACE_OPT(KDMA, Kern::Printf("TNaviEngineDmac64Sg::InitHwDes 0x%08X", pD)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1725 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1726 |
// Unaligned descriptor? Bug in generic layer! |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1727 |
__DMA_ASSERTD(IsHwDesAligned(pD)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1728 |
pD->Clear(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1729 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1730 |
// The DMAC supports write back (ie. marking a descriptor as dirty after |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1731 |
// it's been transferred) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1732 |
// We disable it here, because the test code (and other clients?) assume |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1733 |
// they may simply requeue a transfer after it has run |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1734 |
pD->iHeader = HwDesHeader::KHtLe | HwDesHeader::KHtLv | HwDesHeader::KHtWbd; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1735 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1736 |
const TDmaTransferConfig& src = aTransferArgs.iSrcConfig; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1737 |
const TDmaTransferConfig& dst = aTransferArgs.iDstConfig; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1738 |
pD->iSrcAddr = (src.iFlags & KDmaPhysAddr) ? src.iAddr : Epoc::LinearToPhysical(src.iAddr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1739 |
__DMA_ASSERTD(pD->iSrcAddr != KPhysAddrInvalid); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1740 |
pD->iDestAddr = (dst.iFlags & KDmaPhysAddr) ? dst.iAddr : Epoc::LinearToPhysical(dst.iAddr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1741 |
__DMA_ASSERTD(pD->iDestAddr != KPhysAddrInvalid); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1742 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1743 |
pD->iTransactionByte = aTransferArgs.iTransferCount; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1744 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1745 |
__KTRACE_OPT(KDMA, Kern::Printf(" src=0x%08X dest=0x%08X count=%d", |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1746 |
pD->iSrcAddr, pD->iDestAddr, pD->iTransactionByte)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1747 |
pD->iConfig = 0; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1748 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1749 |
// Since this controller only supports memory to memory transfers |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1750 |
// we enable block transfer for every descriptor |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1751 |
pD->iConfig |= Channel::Cfg::KHtTransMode; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1752 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1753 |
pD->SetSourceDataSize(TDma64Desc::E512Bit); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1754 |
pD->SetDestDataSize(TDma64Desc::E512Bit); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1755 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1756 |
return KErrNone; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1757 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1758 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1759 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1760 |
TInt TNaviEngineDmac64Sg::UpdateHwDes(const SDmaDesHdr& aHdr, TUint32 aSrcAddr, TUint32 aDstAddr, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1761 |
TUint aTransferCount, TUint32 aPslRequestInfo) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1762 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1763 |
// Updates (from the passed in arguments) fields of the descriptor. This |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1764 |
// function is called by the PIL in ISR context. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1765 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1766 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1767 |
TDma64Desc* pD = HdrToHwDes(aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1768 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1769 |
__KTRACE_OPT(KDMA, Kern::Printf("TNaviEngineDmac64Sg::UpdateHwDes 0x%08X", pD)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1770 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1771 |
// Unaligned descriptor? Bug in generic layer! |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1772 |
__DMA_ASSERTD(IsHwDesAligned(pD)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1773 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1774 |
// Addresses passed into this function are always physical ones. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1775 |
if (aSrcAddr != KPhysAddrInvalid) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1776 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1777 |
__KTRACE_OPT(KDMA, Kern::Printf(" Changing src addr, old: 0x%08X new: 0x%08X", |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1778 |
pD->iSrcAddr, aSrcAddr)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1779 |
pD->iSrcAddr = aSrcAddr; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1780 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1781 |
if (aDstAddr != KPhysAddrInvalid) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1782 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1783 |
__KTRACE_OPT(KDMA, Kern::Printf(" Changing dst addr, old: 0x%08X new: 0x%08X", |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1784 |
pD->iDestAddr, aDstAddr)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1785 |
pD->iDestAddr = aDstAddr; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1786 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1787 |
if (aTransferCount != 0) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1788 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1789 |
__KTRACE_OPT(KDMA, Kern::Printf(" Changing xfer count, old: %d new: %d", |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1790 |
pD->iTransactionByte, aTransferCount)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1791 |
pD->iTransactionByte = aTransferCount; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1792 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1793 |
if (aPslRequestInfo != 0) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1794 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1795 |
__KTRACE_OPT(KDMA, Kern::Printf(" aPslRequestInfo specified (0x%08X) but ignored", |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1796 |
aPslRequestInfo)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1797 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1798 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1799 |
__KTRACE_OPT(KDMA, Kern::Printf(" src=0x%08X dest=0x%08X count=%d", |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1800 |
pD->iSrcAddr, pD->iDestAddr, pD->iTransactionByte)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1801 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1802 |
return KErrNone; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1803 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1804 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1805 |
/** |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1806 |
Like ChainHwDes, but does not suppress interrupts in the descriptor |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1807 |
being appended to. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1808 |
*/ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1809 |
void TNaviEngineDmac64Sg::JoinHwDes(TDma64Desc& aHwDes, const TDma64Desc& aNextHwDes) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1810 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1811 |
// Unaligned descriptor? Bug in generic layer! |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1812 |
__DMA_ASSERTD(IsHwDesAligned(&aHwDes) && IsHwDesAligned(&aNextHwDes)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1813 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1814 |
aHwDes.iHeader &= ~(HwDesHeader::KHtLe); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1815 |
__NK_ASSERT_DEBUG(aHwDes.iNextLink == NULL); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1816 |
aHwDes.iNextLink = Epoc::LinearToPhysical(reinterpret_cast<TLinAddr>(&aNextHwDes)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1817 |
__DMA_ASSERTD(aHwDes.iNextLink != KPhysAddrInvalid); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1818 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1819 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1820 |
void TNaviEngineDmac64Sg::ChainHwDes(const SDmaDesHdr& aHdr, const SDmaDesHdr& aNextHdr) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1821 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1822 |
// Chains hardware descriptors together by setting the next pointer of the original descriptor |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1823 |
// to the physical address of the descriptor to be chained. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1824 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1825 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1826 |
TDma64Desc* pD = HdrToHwDes(aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1827 |
TDma64Desc* pN = HdrToHwDes(aNextHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1828 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1829 |
__KTRACE_OPT(KDMA, Kern::Printf("TNaviEngineDmac64Sg::ChainHwDes des=0x%08X next des=0x%08X", pD, pN)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1830 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1831 |
JoinHwDes(*pD, *pN); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1832 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1833 |
//only the last link in the chain should produce an interrupt or |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1834 |
//set the "transfer complete" bit |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1835 |
pD->iConfig |= (Channel::Cfg::KHtEndMask|Channel::Cfg::KHtCompMask); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1836 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1837 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1838 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1839 |
void TNaviEngineDmac64Sg::AppendHwDes(const TDmaChannel& aChannel, const SDmaDesHdr& aLastHdr, |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1840 |
const SDmaDesHdr& aNewHdr) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1841 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1842 |
// Appends a descriptor to the chain while the channel is running. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1843 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1844 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1845 |
const TUint32 i = static_cast<TUint8>(aChannel.PslId()); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1846 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1847 |
TDma64Desc* pL = HdrToHwDes(aLastHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1848 |
TDma64Desc* pN = HdrToHwDes(aNewHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1849 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1850 |
__KTRACE_OPT(KDMA, Kern::Printf("TNaviEngineDmac64Sg::AppendHwDes channel=%d last des=0x%08X new des=0x%08X", |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1851 |
i, pL, pN)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1852 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1853 |
TNeSgChannel& channel(iChannels[i]); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1854 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1855 |
channel.Pause(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1856 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1857 |
#ifdef _DEBUG_PRINT |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1858 |
__KTRACE_OPT(KDMA, Kern::Printf("Last descriptor:")); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1859 |
pL->Print(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1860 |
__KTRACE_OPT(KDMA, Kern::Printf("Next descriptor:")); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1861 |
pN->Print(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1862 |
iChannels[i].Print(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1863 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1864 |
//Check we are really appending on to the end of a chain |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1865 |
__NK_ASSERT_DEBUG(pL->iNextLink == 0); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1866 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1867 |
if(channel.NextLink()) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1868 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1869 |
//Simple case, the dmac is still working through the desriptor |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1870 |
//chain - just add new link to the end. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1871 |
JoinHwDes(*pL, *pN); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1872 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1873 |
const TInt irq = __SPIN_LOCK_IRQSAVE(channel.iLock); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1874 |
channel.iTransferCount++; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1875 |
__SPIN_UNLOCK_IRQRESTORE(channel.iLock, irq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1876 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1877 |
DMA_PSL_CHAN_TRACE_STATIC1(aChannel, "requests chained iTransferCount %d", channel.iTransferCount); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1878 |
channel.Resume(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1879 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1880 |
else |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1881 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1882 |
// If the next link register is not set, then the controller is |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1883 |
// either on last descriptor or has completed (though PIL not yet aware) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1884 |
channel.Resume(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1885 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1886 |
// Wait till the channel is idle so that we don't disrupt the |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1887 |
// transfer of the final descriptor, if it's still running. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1888 |
while(!channel.IsIdle()) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1889 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1890 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1891 |
Transfer(aChannel, aNewHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1892 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1893 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1894 |
#ifdef _DEBUG_PRINT |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1895 |
__KTRACE_OPT(KDMA, Kern::Printf("Last descriptor:")); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1896 |
pL->Print(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1897 |
iChannels[i].Print(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1898 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1899 |
__KTRACE_OPT(KDMA, Kern::Printf("<TNaviEngineDmac64Sg::AppendHwDes")); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1900 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1901 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1902 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1903 |
void TNaviEngineDmac64Sg::UnlinkHwDes(const TDmaChannel& /*aChannel*/, SDmaDesHdr& aHdr) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1904 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1905 |
// Unlink the last item in the h/w descriptor chain from a subsequent chain that it was |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1906 |
// possibly linked to. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1907 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1908 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1909 |
__KTRACE_OPT(KDMA, Kern::Printf("TNaviEngineDmac64Sg::UnlinkHwDes")); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1910 |
TDma64Desc* pD = HdrToHwDes(aHdr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1911 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1912 |
//Descriptor is now an end link |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1913 |
pD->iHeader |= HwDesHeader::KHtLe; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1914 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1915 |
//Allow this descriptor to raise completion interrupts again. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1916 |
pD->iConfig &= ~(Channel::Cfg::KHtEndMask|Channel::Cfg::KHtCompMask); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1917 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1918 |
pD->iNextLink = 0; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1919 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1920 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1921 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1922 |
void TNaviEngineDmac64Sg::IsrEnd(TAny* aThis) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1923 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1924 |
// This ISR reads the interrupt identification and calls back into the base class |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1925 |
// interrupt service handler with the channel identifier and an indication whether the |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1926 |
// transfer completed correctly or with an error. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1927 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1928 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1929 |
FUNC_LOG; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1930 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1931 |
TNaviEngineDmac64Sg& me = *static_cast<TNaviEngineDmac64Sg*>(aThis); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1932 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1933 |
const TUint32 channelTcStates = AsspRegister::Read32(KHwDMAC64Base + Cmn::KHoTc); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1934 |
const TUint32 channelErrStates = AsspRegister::Read32(KHwDMAC64Base + Cmn::KHoErr); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1935 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1936 |
TNeSgChannel* channel = NULL; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1937 |
for (TInt i=0; i<Dma64::KChannelCount; i++) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1938 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1939 |
const TUint32 mask = (1<<i); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1940 |
const TBool transferComplete = (channelTcStates & mask); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1941 |
const TBool error = (channelErrStates & mask); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1942 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1943 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1944 |
channel = me.iChannels + i; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1945 |
const TInt irq = __SPIN_LOCK_IRQSAVE(channel->iLock); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1946 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1947 |
if(channel->iController == NULL) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1948 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1949 |
// skip closed channel |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1950 |
__SPIN_UNLOCK_IRQRESTORE(channel->iLock, irq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1951 |
continue; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1952 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1953 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1954 |
// If error then it could have been raised by any of the |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1955 |
// previous requests - they must all be completed with |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1956 |
// an error status |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1957 |
if(error) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1958 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1959 |
// Reset the channel and iTransferCount before |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1960 |
// calling HandleIsr since each one could lead |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1961 |
// to a new transfer |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1962 |
TUint32 clearMask = Channel::Ctrl::KHtSwReset; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1963 |
AsspRegister::Modify32(channel->BaseAddr() + Channel::Ctrl::KHoBase, 0, clearMask); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1964 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1965 |
const TInt badTransfers = channel->iTransferCount; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1966 |
channel->iTransferCount = 0; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1967 |
for(TInt j=0; j < badTransfers; j++) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1968 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1969 |
HandleIsr(*channel, EDmaCallbackRequestCompletion, EFalse); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1970 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1971 |
__SPIN_UNLOCK_IRQRESTORE(channel->iLock, irq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1972 |
continue; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1973 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1974 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1975 |
if((channel->iTransferCount > 0) && channel->IsIdle()) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1976 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1977 |
TInt missedCount = channel->iTransferCount; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1978 |
if(transferComplete) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1979 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1980 |
// If a transfer has completed normally |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1981 |
// then allow that to be handled in the next block |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1982 |
missedCount--; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1983 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1984 |
DMA_PSL_CHAN_TRACE_STATIC1((*channel), "clearing %d missed irqs", missedCount); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1985 |
for(TInt j=0; j < missedCount; j++) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1986 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1987 |
HandleIsr(*channel, EDmaCallbackRequestCompletion, ETrue); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1988 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1989 |
channel->iTransferCount -= missedCount; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1990 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1991 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1992 |
if (transferComplete) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1993 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1994 |
#ifdef _DEBUG_PRINT_ISR |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1995 |
channel->Print(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1996 |
#endif |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1997 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1998 |
using namespace Channel::Ctrl; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
1999 |
TUint32 setMask = KHtClrTc | KHtClrEnd | KHtSwTrigger; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2000 |
AsspRegister::Modify32(channel->BaseAddr() + KHoBase, 0, setMask); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2001 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2002 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2003 |
// Only signal the PIL if iTransferCount is not 0. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2004 |
// StopTransfer could have reset the count. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2005 |
if(channel->iTransferCount > 0) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2006 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2007 |
HandleIsr(*channel, EDmaCallbackRequestCompletion, ETrue); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2008 |
channel->iTransferCount--; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2009 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2010 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2011 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2012 |
__SPIN_UNLOCK_IRQRESTORE(channel->iLock, irq); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2013 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2014 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2015 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2016 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2017 |
void TNaviEngineDmac64Sg::IsrErr(TAny* aThis) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2018 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2019 |
// This ISR reads the interrupt identification and calls back into the base class |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2020 |
// interrupt service handler with the channel identifier and an indication whether the |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2021 |
// transfer completed correctly or with an error. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2022 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2023 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2024 |
FUNC_LOG; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2025 |
IsrEnd(aThis); // IsrEnd will report the error |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2026 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2027 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2028 |
inline TDma64Desc* TNaviEngineDmac64Sg::HdrToHwDes(const SDmaDesHdr& aHdr) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2029 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2030 |
// Changes return type of base class call. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2031 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2032 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2033 |
return static_cast<TDma64Desc*>(TDmac::HdrToHwDes(aHdr)); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2034 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2035 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2036 |
// DLL Exported Function |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2037 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2038 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2039 |
DECLARE_STANDARD_EXTENSION() |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2040 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2041 |
// Creates and initializes a new DMA controller object on the kernel heap. |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2042 |
// |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2043 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2044 |
__KTRACE_OPT2(KBOOT, KDMA, Kern::Printf("Starting DMA Extension")); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2045 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2046 |
TInt r = DmaChannelMgr::Initialise(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2047 |
if(r!=KErrNone) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2048 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2049 |
return r; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2050 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2051 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2052 |
r = Controller64.Create(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2053 |
if(r!=KErrNone) |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2054 |
{ |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2055 |
return r; |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2056 |
} |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2057 |
|
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2058 |
return Controller.Create(); |
5de814552237
Initial contribution supporting NaviEngine 1
Ryan Harkin <ryan.harkin@nokia.com>
parents:
diff
changeset
|
2059 |
} |