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_AUX_ADC 7 // AUX ADC event
298 #define UDMA_CHAN_AUX_SW 8 // AUX Software event
299 #define UDMA_CHAN_TIMER0_A 9 // Timer0 A event
300 #define UDMA_CHAN_TIMER0_B 10 // Timer0 B event
301 #define UDMA_CHAN_TIMER1_A 11
302 #define UDMA_CHAN_TIMER1_B 12
303 #define UDMA_CHAN_AON_PROG2 13
304 #define UDMA_CHAN_DMA_PROG 14
305 #define UDMA_CHAN_AON_RTC 15
306 #define UDMA_CHAN_SSI1_RX 16
307 #define UDMA_CHAN_SSI1_TX 17
308 #define UDMA_CHAN_SW_EVT1 18
309 #define UDMA_CHAN_SW_EVT2 19
310 #define UDMA_CHAN_SW_EVT3 20
318 #define UDMA_PRI_SELECT 0x00000000
319 #define UDMA_ALT_SELECT 0x00000020
327 #ifdef DRIVERLIB_DEBUG
343 uDMABaseValid(uint32_t ui32Base)
367 ASSERT(uDMABaseValid(ui32Base));
393 ASSERT(uDMABaseValid(ui32Base));
414 __STATIC_INLINE uint32_t
420 ASSERT(uDMABaseValid(ui32Base));
446 ASSERT(uDMABaseValid(ui32Base));
478 ASSERT(uDMABaseValid(ui32Base));
507 ASSERT(uDMABaseValid(ui32Base));
538 ASSERT(uDMABaseValid(ui32Base));
583 ASSERT(uDMABaseValid(ui32Base));
584 ASSERT(((uint32_t)pControlTable & ~0x3FF) ==
585 (uint32_t)pControlTable);
591 HWREG(ui32Base +
UDMA_O_CTRL) = (uint32_t)pControlTable;
607 __STATIC_INLINE
void *
614 ASSERT(uDMABaseValid(ui32Base));
635 __STATIC_INLINE
void *
641 ASSERT(uDMABaseValid(ui32Base));
677 ASSERT(uDMABaseValid(ui32Base));
707 uint32_t ui32ChannelNum,
731 uint32_t ui32ChannelNum,
755 uint32_t ui32ChannelNum);
800 uint32_t ui32ChannelStructIndex,
801 uint32_t ui32Control);
864 uint32_t ui32ChannelStructIndex,
865 uint32_t ui32Mode,
void *pvSrcAddr,
866 void *pvDstAddr, uint32_t ui32TransferSize);
897 uint32_t ui32ChannelNum,
898 uint32_t ui32TaskCount,
900 uint32_t ui32IsPeriphSG);
921 uint32_t ui32ChannelStructIndex);
947 uint32_t ui32ChannelStructIndex);
978 void (*pfnHandler)(
void))
983 ASSERT(uDMABaseValid(ui32Base));
985 ASSERT((ui32IntChannel == INT_DMA_DONE_COMB) || (ui32IntChannel == INT_DMA_ERR));
1018 __STATIC_INLINE
void
1024 ASSERT(uDMABaseValid(ui32Base));
1025 ASSERT((ui32IntChannel == INT_DMA_DONE_COMB) || (ui32IntChannel == INT_DMA_ERR));
1053 __STATIC_INLINE
void
1059 ASSERT(uDMABaseValid(ui32Base));
1080 __STATIC_INLINE uint32_t
1086 ASSERT(uDMABaseValid(ui32Base));
1112 __STATIC_INLINE
void
1118 ASSERT(uDMABaseValid(ui32Base));
1143 __STATIC_INLINE
void
1149 ASSERT(uDMABaseValid(ui32Base));
1169 __STATIC_INLINE uint32_t
1175 ASSERT(uDMABaseValid(ui32Base));
1196 __STATIC_INLINE
void
1202 ASSERT(uDMABaseValid(ui32Base));
1223 __STATIC_INLINE
bool
1229 ASSERT(uDMABaseValid(ui32Base));
1252 __STATIC_INLINE
void
1258 ASSERT(uDMABaseValid(ui32Base));
1273 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
1275 #ifdef ROM_uDMAChannelAttributeEnable
1276 #undef uDMAChannelAttributeEnable
1277 #define uDMAChannelAttributeEnable ROM_uDMAChannelAttributeEnable
1279 #ifdef ROM_uDMAChannelAttributeDisable
1280 #undef uDMAChannelAttributeDisable
1281 #define uDMAChannelAttributeDisable ROM_uDMAChannelAttributeDisable
1283 #ifdef ROM_uDMAChannelAttributeGet
1284 #undef uDMAChannelAttributeGet
1285 #define uDMAChannelAttributeGet ROM_uDMAChannelAttributeGet
1287 #ifdef ROM_uDMAChannelControlSet
1288 #undef uDMAChannelControlSet
1289 #define uDMAChannelControlSet ROM_uDMAChannelControlSet
1291 #ifdef ROM_uDMAChannelTransferSet
1292 #undef uDMAChannelTransferSet
1293 #define uDMAChannelTransferSet ROM_uDMAChannelTransferSet
1295 #ifdef ROM_uDMAChannelScatterGatherSet
1296 #undef uDMAChannelScatterGatherSet
1297 #define uDMAChannelScatterGatherSet ROM_uDMAChannelScatterGatherSet
1299 #ifdef ROM_uDMAChannelSizeGet
1300 #undef uDMAChannelSizeGet
1301 #define uDMAChannelSizeGet ROM_uDMAChannelSizeGet
1303 #ifdef ROM_uDMAChannelModeGet
1304 #undef uDMAChannelModeGet
1305 #define uDMAChannelModeGet ROM_uDMAChannelModeGet
1318 #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.