64 #include <inc/hw_types.h>
65 #include <inc/hw_ints.h>
66 #include <inc/hw_memmap.h>
67 #include <inc/hw_udma.h>
85 #define uDMAChannelAttributeEnable NOROM_uDMAChannelAttributeEnable
86 #define uDMAChannelAttributeDisable NOROM_uDMAChannelAttributeDisable
87 #define uDMAChannelAttributeGet NOROM_uDMAChannelAttributeGet
88 #define uDMAChannelControlSet NOROM_uDMAChannelControlSet
89 #define uDMAChannelTransferSet NOROM_uDMAChannelTransferSet
90 #define uDMAChannelScatterGatherSet NOROM_uDMAChannelScatterGatherSet
91 #define uDMAChannelSizeGet NOROM_uDMAChannelSizeGet
92 #define uDMAChannelModeGet NOROM_uDMAChannelModeGet
180 #define uDMATaskStructEntry(ui32TransferCount, \
189 (((ui32SrcIncrement) == UDMA_SRC_INC_NONE) ? (pvSrcAddr) : \
190 ((void *)(&((uint8_t *)(pvSrcAddr))[((ui32TransferCount) << \
191 ((ui32SrcIncrement) >> 26)) - 1]))), \
192 (((ui32DstIncrement) == UDMA_DST_INC_NONE) ? (pvDstAddr) : \
193 ((void *)(&((uint8_t *)(pvDstAddr))[((ui32TransferCount) << \
194 ((ui32DstIncrement) >> 30)) - 1]))), \
195 (ui32SrcIncrement) | (ui32DstIncrement) | (ui32ItemSize) | \
196 (ui32ArbSize) | (((ui32TransferCount) - 1) << 4) | \
197 ((((ui32Mode) == UDMA_MODE_MEM_SCATTER_GATHER) || \
198 ((ui32Mode) == UDMA_MODE_PER_SCATTER_GATHER)) ? \
199 (ui32Mode) | UDMA_MODE_ALT_SELECT : (ui32Mode)), 0 \
207 #define UDMA_NUM_CHANNELS 21
214 #define UDMA_PRIORITY_LOW 0x00000000
215 #define UDMA_PRIORITY_HIGH 0x00000001
223 #define UDMA_ATTR_USEBURST 0x00000001
224 #define UDMA_ATTR_ALTSELECT 0x00000002
225 #define UDMA_ATTR_HIGH_PRIORITY 0x00000004
226 #define UDMA_ATTR_REQMASK 0x00000008
227 #define UDMA_ATTR_ALL 0x0000000F
235 #define UDMA_MODE_STOP 0x00000000
236 #define UDMA_MODE_BASIC 0x00000001
237 #define UDMA_MODE_AUTO 0x00000002
238 #define UDMA_MODE_PINGPONG 0x00000003
239 #define UDMA_MODE_MEM_SCATTER_GATHER \
241 #define UDMA_MODE_PER_SCATTER_GATHER \
243 #define UDMA_MODE_M 0x00000007 // uDMA Transfer Mode
244 #define UDMA_MODE_ALT_SELECT 0x00000001
251 #define UDMA_DST_INC_8 0x00000000
252 #define UDMA_DST_INC_16 0x40000000
253 #define UDMA_DST_INC_32 0x80000000
254 #define UDMA_DST_INC_NONE 0xC0000000
255 #define UDMA_DST_INC_M 0xC0000000 // Destination Address Increment
256 #define UDMA_DST_INC_S 30
257 #define UDMA_SRC_INC_8 0x00000000
258 #define UDMA_SRC_INC_16 0x04000000
259 #define UDMA_SRC_INC_32 0x08000000
260 #define UDMA_SRC_INC_NONE 0x0c000000
261 #define UDMA_SRC_INC_M 0x0C000000 // Source Address Increment
262 #define UDMA_SRC_INC_S 26
263 #define UDMA_SIZE_8 0x00000000
264 #define UDMA_SIZE_16 0x11000000
265 #define UDMA_SIZE_32 0x22000000
266 #define UDMA_SIZE_M 0x33000000 // Data Size
267 #define UDMA_SIZE_S 24
268 #define UDMA_ARB_1 0x00000000
269 #define UDMA_ARB_2 0x00004000
270 #define UDMA_ARB_4 0x00008000
271 #define UDMA_ARB_8 0x0000c000
272 #define UDMA_ARB_16 0x00010000
273 #define UDMA_ARB_32 0x00014000
274 #define UDMA_ARB_64 0x00018000
275 #define UDMA_ARB_128 0x0001c000
276 #define UDMA_ARB_256 0x00020000
277 #define UDMA_ARB_512 0x00024000
278 #define UDMA_ARB_1024 0x00028000
279 #define UDMA_ARB_M 0x0003C000 // Arbitration Size
280 #define UDMA_ARB_S 14
281 #define UDMA_NEXT_USEBURST 0x00000008
282 #define UDMA_XFER_SIZE_MAX 1024
283 #define UDMA_XFER_SIZE_M 0x00003FF0 // Transfer size
284 #define UDMA_XFER_SIZE_S 4
292 #define UDMA_CHAN_SW_EVT0 0 // Software Event Channel 0
293 #define UDMA_CHAN_UART0_RX 1 // UART0 RX Data
294 #define UDMA_CHAN_UART0_TX 2 // UART0 RX Data
295 #define UDMA_CHAN_SSI0_RX 3 // SSI0 RX Data
296 #define UDMA_CHAN_SSI0_TX 4 // SSI0 RX Data
297 #define UDMA_CHAN_SPIS_RX 5 // SPIS RX Data
298 #define UDMA_CHAN_SPIS_TX 6 // SPIS RX Data
299 #define UDMA_CHAN_AUX_ADC 7 // AUX ADC event
300 #define UDMA_CHAN_AUX_SW 8 // AUX Software event
301 #define UDMA_CHAN_TIMER0_A 9 // Timer0 A event
302 #define UDMA_CHAN_TIMER0_B 10 // Timer0 B event
303 #define UDMA_CHAN_TIMER1_A 11
304 #define UDMA_CHAN_TIMER1_B 12
305 #define UDMA_CHAN_AON_PROG2 13
306 #define UDMA_CHAN_DMA_PROG 14
307 #define UDMA_CHAN_AON_RTC 15
308 #define UDMA_CHAN_SSI1_RX 16
309 #define UDMA_CHAN_SSI1_TX 17
310 #define UDMA_CHAN_SW_EVT1 18
311 #define UDMA_CHAN_SW_EVT2 19
312 #define UDMA_CHAN_SW_EVT3 20
320 #define UDMA_PRI_SELECT 0x00000000
321 #define UDMA_ALT_SELECT 0x00000020
329 #ifdef DRIVERLIB_DEBUG
345 uDMABaseValid(uint32_t ui32Base)
369 ASSERT(uDMABaseValid(ui32Base));
395 ASSERT(uDMABaseValid(ui32Base));
416 __STATIC_INLINE uint32_t
422 ASSERT(uDMABaseValid(ui32Base));
448 ASSERT(uDMABaseValid(ui32Base));
480 ASSERT(uDMABaseValid(ui32Base));
509 ASSERT(uDMABaseValid(ui32Base));
540 ASSERT(uDMABaseValid(ui32Base));
585 ASSERT(uDMABaseValid(ui32Base));
586 ASSERT(((uint32_t)pControlTable & ~0x3FF) ==
587 (uint32_t)pControlTable);
593 HWREG(ui32Base +
UDMA_O_CTRL) = (uint32_t)pControlTable;
609 __STATIC_INLINE
void *
616 ASSERT(uDMABaseValid(ui32Base));
637 __STATIC_INLINE
void *
643 ASSERT(uDMABaseValid(ui32Base));
679 ASSERT(uDMABaseValid(ui32Base));
709 uint32_t ui32ChannelNum,
733 uint32_t ui32ChannelNum,
757 uint32_t ui32ChannelNum);
802 uint32_t ui32ChannelStructIndex,
803 uint32_t ui32Control);
866 uint32_t ui32ChannelStructIndex,
867 uint32_t ui32Mode,
void *pvSrcAddr,
868 void *pvDstAddr, uint32_t ui32TransferSize);
899 uint32_t ui32ChannelNum,
900 uint32_t ui32TaskCount,
902 uint32_t ui32IsPeriphSG);
923 uint32_t ui32ChannelStructIndex);
949 uint32_t ui32ChannelStructIndex);
980 void (*pfnHandler)(
void))
985 ASSERT(uDMABaseValid(ui32Base));
987 ASSERT((ui32IntChannel == INT_UDMA) || (ui32IntChannel == INT_UDMAERR));
1020 __STATIC_INLINE
void
1026 ASSERT(uDMABaseValid(ui32Base));
1027 ASSERT((ui32IntChannel == INT_UDMA) || (ui32IntChannel == INT_UDMAERR));
1055 __STATIC_INLINE
void
1061 ASSERT(uDMABaseValid(ui32Base));
1082 __STATIC_INLINE uint32_t
1088 ASSERT(uDMABaseValid(ui32Base));
1114 __STATIC_INLINE
void
1120 ASSERT(uDMABaseValid(ui32Base));
1145 __STATIC_INLINE
void
1151 ASSERT(uDMABaseValid(ui32Base));
1171 __STATIC_INLINE uint32_t
1177 ASSERT(uDMABaseValid(ui32Base));
1198 __STATIC_INLINE
void
1204 ASSERT(uDMABaseValid(ui32Base));
1225 __STATIC_INLINE
bool
1231 ASSERT(uDMABaseValid(ui32Base));
1254 __STATIC_INLINE
void
1260 ASSERT(uDMABaseValid(ui32Base));
1275 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
1277 #ifdef ROM_uDMAChannelAttributeEnable
1278 #undef uDMAChannelAttributeEnable
1279 #define uDMAChannelAttributeEnable ROM_uDMAChannelAttributeEnable
1281 #ifdef ROM_uDMAChannelAttributeDisable
1282 #undef uDMAChannelAttributeDisable
1283 #define uDMAChannelAttributeDisable ROM_uDMAChannelAttributeDisable
1285 #ifdef ROM_uDMAChannelAttributeGet
1286 #undef uDMAChannelAttributeGet
1287 #define uDMAChannelAttributeGet ROM_uDMAChannelAttributeGet
1289 #ifdef ROM_uDMAChannelControlSet
1290 #undef uDMAChannelControlSet
1291 #define uDMAChannelControlSet ROM_uDMAChannelControlSet
1293 #ifdef ROM_uDMAChannelTransferSet
1294 #undef uDMAChannelTransferSet
1295 #define uDMAChannelTransferSet ROM_uDMAChannelTransferSet
1297 #ifdef ROM_uDMAChannelScatterGatherSet
1298 #undef uDMAChannelScatterGatherSet
1299 #define uDMAChannelScatterGatherSet ROM_uDMAChannelScatterGatherSet
1301 #ifdef ROM_uDMAChannelSizeGet
1302 #undef uDMAChannelSizeGet
1303 #define uDMAChannelSizeGet ROM_uDMAChannelSizeGet
1305 #ifdef ROM_uDMAChannelModeGet
1306 #undef uDMAChannelModeGet
1307 #define uDMAChannelModeGet ROM_uDMAChannelModeGet
1320 #endif // __UDMA_H__
#define UDMA_NUM_CHANNELS
uint32_t uDMAChannelModeGet(uint32_t ui32Base, uint32_t ui32ChannelStructIndex)
Gets the transfer mode for a uDMA channel control structure.
volatile void * pvSrcEndAddr
The ending source address of the data transfer.
static void uDMAIntUnregister(uint32_t ui32Base, uint32_t ui32IntChannel)
Unregisters an interrupt handler for the uDMA controller.
void uDMAChannelScatterGatherSet(uint32_t ui32Base, uint32_t ui32ChannelNum, uint32_t ui32TaskCount, void *pvTaskList, uint32_t ui32IsPeriphSG)
Configures a uDMA channel for scatter-gather mode.
#define UDMA_PRIORITY_LOW
static uint32_t uDMAGetStatus(uint32_t ui32Base)
Return the status of the uDMA module.
static void uDMAEnable(uint32_t ui32Base)
Enables the uDMA controller for use.
static void uDMAErrorStatusClear(uint32_t ui32Base)
Clears the uDMA error interrupt.
static void * uDMAControlBaseGet(uint32_t ui32Base)
Gets the base address for the channel control table.
static void uDMAChannelEnable(uint32_t ui32Base, uint32_t ui32ChannelNum)
Enables a uDMA channel for operation.
void uDMAChannelAttributeDisable(uint32_t ui32Base, uint32_t ui32ChannelNum, uint32_t ui32Attr)
Disables attributes of an uDMA channel.
void uDMAChannelAttributeEnable(uint32_t ui32Base, uint32_t ui32ChannelNum, uint32_t ui32Attr)
Enables attributes of a uDMA channel.
void uDMAChannelControlSet(uint32_t ui32Base, uint32_t ui32ChannelStructIndex, uint32_t ui32Control)
Sets the control parameters for a uDMA channel control structure.
volatile uint32_t ui32Spare
An unused location.
static void uDMAChannelDisable(uint32_t ui32Base, uint32_t ui32ChannelNum)
Disables a uDMA channel for operation.
volatile uint32_t ui32Control
The channel control mode.
volatile void * pvDstEndAddr
The ending destination address of the data transfer.
static void uDMAIntSwEventDisable(uint32_t ui32Base, uint32_t ui32IntChannel)
Disable interrupt on software event driven uDMA transfers.
static uint32_t uDMAIntStatus(uint32_t ui32Base)
Get the uDMA interrupt status.
static void uDMAIntClear(uint32_t ui32Base, uint32_t ui32ChanMask)
Clears uDMA interrupt done status.
void IntUnregister(uint32_t ui32Interrupt)
Unregisters the function to be called when an interrupt occurs.
void uDMAChannelTransferSet(uint32_t ui32Base, uint32_t ui32ChannelStructIndex, uint32_t ui32Mode, void *pvSrcAddr, void *pvDstAddr, uint32_t ui32TransferSize)
Sets the transfer parameters for a uDMA channel control structure.
static uint32_t uDMAErrorStatusGet(uint32_t ui32Base)
Gets the uDMA error status.
static void uDMAChannelPrioritySet(uint32_t ui32Base, uint32_t ui32ChannelNum)
Set the priority of a uDMA channel.
static bool uDMAChannelIsEnabled(uint32_t ui32Base, uint32_t ui32ChannelNum)
Checks if a uDMA channel is enabled for operation.
static void uDMAChannelPriorityClear(uint32_t ui32Base, uint32_t ui32ChannelNum)
Clear the priority of a uDMA channel.
A structure that defines an entry in the channel control table.
uint32_t uDMAChannelAttributeGet(uint32_t ui32Base, uint32_t ui32ChannelNum)
Gets the enabled attributes of a uDMA channel.
static void uDMAIntRegister(uint32_t ui32Base, uint32_t ui32IntChannel, void(*pfnHandler)(void))
Registers an interrupt handler for the uDMA controller.
static void uDMAControlBaseSet(uint32_t ui32Base, void *pControlTable)
Sets the base address for the channel control table.
uint32_t uDMAChannelSizeGet(uint32_t ui32Base, uint32_t ui32ChannelStructIndex)
Gets the current transfer size for a uDMA channel control structure.
static void * uDMAControlAlternateBaseGet(uint32_t ui32Base)
Gets the base address for the channel control table alternate structures.
#define UDMA_PRIORITY_HIGH
static void uDMAIntSwEventEnable(uint32_t ui32Base, uint32_t ui32IntChannel)
Enable interrupt on software event driven uDMA transfers.
static void uDMADisable(uint32_t ui32Base)
Disables the uDMA controller for use.
void IntDisable(uint32_t ui32Interrupt)
Disables an interrupt.
void IntRegister(uint32_t ui32Interrupt, void(*pfnHandler)(void))
Registers a function to be called when an interrupt occurs.
static bool uDMAChannelPriorityGet(uint32_t ui32Base, uint32_t ui32ChannelNum)
Get the priority of a uDMA channel.
void IntEnable(uint32_t ui32Interrupt)
Enables an interrupt.
static void uDMAChannelRequest(uint32_t ui32Base, uint32_t ui32ChannelNum)
Requests a uDMA channel to start a transfer.