CC13xx Driver Library
udma.h
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: udma.h
3 * Revised: 2015-11-17 09:50:14 +0100 (Tue, 17 Nov 2015)
4 * Revision: 45101
5 *
6 * Description: Defines and prototypes for the uDMA controller.
7 *
8 * Copyright (c) 2015, Texas Instruments Incorporated
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 *
14 * 1) Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 *
17 * 2) Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 *
21 * 3) Neither the name of the ORGANIZATION nor the names of its contributors may
22 * be used to endorse or promote products derived from this software without
23 * specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *
37 ******************************************************************************/
38 
39 //*****************************************************************************
40 //
45 //
46 //*****************************************************************************
47 
48 #ifndef __UDMA_H__
49 #define __UDMA_H__
50 
51 //*****************************************************************************
52 //
53 // If building with a C++ compiler, make all of the definitions in this header
54 // have a C binding.
55 //
56 //*****************************************************************************
57 #ifdef __cplusplus
58 extern "C"
59 {
60 #endif
61 
62 #include <stdbool.h>
63 #include <stdint.h>
64 #include <inc/hw_types.h>
65 #include <inc/hw_ints.h>
66 #include <inc/hw_memmap.h>
67 #include <inc/hw_udma.h>
68 #include <driverlib/debug.h>
69 #include <driverlib/interrupt.h>
70 
71 //*****************************************************************************
72 //
73 // Support for DriverLib in ROM:
74 // This section renames all functions that are not "static inline", so that
75 // calling these functions will default to implementation in flash. At the end
76 // of this file a second renaming will change the defaults to implementation in
77 // ROM for available functions.
78 //
79 // To force use of the implementation in flash, e.g. for debugging:
80 // - Globally: Define DRIVERLIB_NOROM at project level
81 // - Per function: Use prefix "NOROM_" when calling the function
82 //
83 //*****************************************************************************
84 #if !defined(DOXYGEN)
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
93 #endif
94 
95 //*****************************************************************************
96 //
101 //
102 //*****************************************************************************
103 typedef struct
104 {
105  volatile void *pvSrcEndAddr;
106  volatile void *pvDstEndAddr;
107  volatile uint32_t ui32Control;
108  volatile uint32_t ui32Spare;
109 }
111 
112 //*****************************************************************************
113 //
127 
139 //
179 //*****************************************************************************
180 #define uDMATaskStructEntry(ui32TransferCount, \
181  ui32ItemSize, \
182  ui32SrcIncrement, \
183  pvSrcAddr, \
184  ui32DstIncrement, \
185  pvDstAddr, \
186  ui32ArbSize, \
187  ui32Mode) \
188  { \
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 \
200  }
201 
202 //*****************************************************************************
203 //
204 // The hardware configured number of uDMA channels.
205 //
206 //*****************************************************************************
207 #define UDMA_NUM_CHANNELS 21
208 
209 //*****************************************************************************
210 //
211 // The level of priority for the uDMA channels
212 //
213 //*****************************************************************************
214 #define UDMA_PRIORITY_LOW 0x00000000
215 #define UDMA_PRIORITY_HIGH 0x00000001
216 
217 //*****************************************************************************
218 //
219 // Flags that can be passed to uDMAChannelAttributeEnable(),
220 // uDMAChannelAttributeDisable(), and returned from uDMAChannelAttributeGet().
221 //
222 //*****************************************************************************
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
228 
229 //*****************************************************************************
230 //
231 // DMA control modes that can be passed to uDMAChannelModeSet() and returned
232 // uDMAChannelModeGet().
233 //
234 //*****************************************************************************
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 \
240  0x00000004
241 #define UDMA_MODE_PER_SCATTER_GATHER \
242  0x00000006
243 #define UDMA_MODE_M 0x00000007 // uDMA Transfer Mode
244 #define UDMA_MODE_ALT_SELECT 0x00000001
245 
246 //*****************************************************************************
247 //
248 // Channel configuration values that can be passed to uDMAControlSet().
249 //
250 //*****************************************************************************
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
285 
286 //*****************************************************************************
287 //
288 // Channel numbers to be passed to API functions that require a channel number
289 // ID.
290 //
291 //*****************************************************************************
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
311 
312 //*****************************************************************************
313 //
314 // Flags to be OR'd with the channel ID to indicate if the primary or alternate
315 // control structure should be used.
316 //
317 //*****************************************************************************
318 #define UDMA_PRI_SELECT 0x00000000
319 #define UDMA_ALT_SELECT 0x00000020
320 
321 //*****************************************************************************
322 //
323 // API Functions and prototypes
324 //
325 //*****************************************************************************
326 
327 #ifdef DRIVERLIB_DEBUG
328 //*****************************************************************************
329 //
340 //
341 //*****************************************************************************
342 static bool
343 uDMABaseValid(uint32_t ui32Base)
344 {
345  return(ui32Base == UDMA0_BASE);
346 }
347 #endif
348 
349 //*****************************************************************************
350 //
359 //
360 //*****************************************************************************
361 __STATIC_INLINE void
362 uDMAEnable(uint32_t ui32Base)
363 {
364  //
365  // Check the arguments.
366  //
367  ASSERT(uDMABaseValid(ui32Base));
368 
369  //
370  // Set the master enable bit in the config register.
371  //
372  HWREG(ui32Base + UDMA_O_CFG) = UDMA_CFG_MASTERENABLE;
373 }
374 
375 //*****************************************************************************
376 //
385 //
386 //*****************************************************************************
387 __STATIC_INLINE void
388 uDMADisable(uint32_t ui32Base)
389 {
390  //
391  // Check the arguments.
392  //
393  ASSERT(uDMABaseValid(ui32Base));
394 
395  //
396  // Clear the master enable bit in the config register.
397  //
398  HWREG(ui32Base + UDMA_O_CFG) = 0;
399 }
400 
401 //*****************************************************************************
402 //
412 //
413 //*****************************************************************************
414 __STATIC_INLINE uint32_t
415 uDMAErrorStatusGet(uint32_t ui32Base)
416 {
417  //
418  // Check the arguments.
419  //
420  ASSERT(uDMABaseValid(ui32Base));
421 
422  //
423  // Return the uDMA error status.
424  //
425  return(HWREG(ui32Base + UDMA_O_ERROR));
426 }
427 
428 //*****************************************************************************
429 //
438 //
439 //*****************************************************************************
440 __STATIC_INLINE void
441 uDMAErrorStatusClear(uint32_t ui32Base)
442 {
443  //
444  // Check the arguments.
445  //
446  ASSERT(uDMABaseValid(ui32Base));
447 
448  //
449  // Clear the uDMA error interrupt.
450  //
451  HWREG(ui32Base + UDMA_O_ERROR) = UDMA_ERROR_STATUS;
452 }
453 
454 //*****************************************************************************
455 //
470 //
471 //*****************************************************************************
472 __STATIC_INLINE void
473 uDMAChannelEnable(uint32_t ui32Base, uint32_t ui32ChannelNum)
474 {
475  //
476  // Check the arguments.
477  //
478  ASSERT(uDMABaseValid(ui32Base));
479  ASSERT(ui32ChannelNum < UDMA_NUM_CHANNELS);
480 
481  //
482  // Set the bit for this channel in the enable set register.
483  //
484  HWREG(ui32Base + UDMA_O_SETCHANNELEN) = 1 << ui32ChannelNum;
485 }
486 
487 //*****************************************************************************
488 //
499 //
500 //*****************************************************************************
501 __STATIC_INLINE void
502 uDMAChannelDisable(uint32_t ui32Base, uint32_t ui32ChannelNum)
503 {
504  //
505  // Check the arguments.
506  //
507  ASSERT(uDMABaseValid(ui32Base));
508  ASSERT(ui32ChannelNum < UDMA_NUM_CHANNELS);
509 
510  //
511  // Set the bit for this channel in the enable clear register.
512  //
513  HWREG(ui32Base + UDMA_O_CLEARCHANNELEN) = 1 << ui32ChannelNum;
514 }
515 
516 //*****************************************************************************
517 //
530 //
531 //*****************************************************************************
532 __STATIC_INLINE bool
533 uDMAChannelIsEnabled(uint32_t ui32Base, uint32_t ui32ChannelNum)
534 {
535  //
536  // Check the arguments.
537  //
538  ASSERT(uDMABaseValid(ui32Base));
539  ASSERT(ui32ChannelNum < UDMA_NUM_CHANNELS);
540 
541  //
542  // AND the specified channel bit with the enable register, and return the
543  // result.
544  //
545  return((HWREG(ui32Base + UDMA_O_SETCHANNELEN) & (1 << ui32ChannelNum)) ?
546  true : false);
547 }
548 
549 //*****************************************************************************
550 //
575 //
576 //*****************************************************************************
577 __STATIC_INLINE void
578 uDMAControlBaseSet(uint32_t ui32Base, void *pControlTable)
579 {
580  //
581  // Check the arguments.
582  //
583  ASSERT(uDMABaseValid(ui32Base));
584  ASSERT(((uint32_t)pControlTable & ~0x3FF) ==
585  (uint32_t)pControlTable);
586  ASSERT((uint32_t)pControlTable >= SRAM_BASE);
587 
588  //
589  // Program the base address into the register.
590  //
591  HWREG(ui32Base + UDMA_O_CTRL) = (uint32_t)pControlTable;
592 }
593 
594 //*****************************************************************************
595 //
605 //
606 //*****************************************************************************
607 __STATIC_INLINE void *
608 uDMAControlBaseGet(uint32_t ui32Base)
609 {
610  //
611  // Check the arguments.
612  //
613 
614  ASSERT(uDMABaseValid(ui32Base));
615  //
616  // Read the current value of the control base register, and return it to
617  // the caller.
618  //
619  return((void *)HWREG(ui32Base + UDMA_O_CTRL));
620 }
621 
622 //*****************************************************************************
623 //
633 //
634 //*****************************************************************************
635 __STATIC_INLINE void *
636 uDMAControlAlternateBaseGet(uint32_t ui32Base)
637 {
638  //
639  // Check the arguments.
640  //
641  ASSERT(uDMABaseValid(ui32Base));
642 
643  //
644  // Read the current value of the control base register, and return it to
645  // the caller.
646  //
647  return((void *)HWREG(ui32Base + UDMA_O_ALTCTRL));
648 }
649 
650 //*****************************************************************************
651 //
669 //
670 //*****************************************************************************
671 __STATIC_INLINE void
672 uDMAChannelRequest(uint32_t ui32Base, uint32_t ui32ChannelNum)
673 {
674  //
675  // Check the arguments.
676  //
677  ASSERT(uDMABaseValid(ui32Base));
678  ASSERT(ui32ChannelNum < UDMA_NUM_CHANNELS);
679 
680  //
681  // Set the bit for this channel in the software uDMA request register.
682  //
683  HWREG(ui32Base + UDMA_O_SOFTREQ) = 1 << ui32ChannelNum;
684 }
685 
686 //*****************************************************************************
687 //
704 //
705 //*****************************************************************************
706 extern void uDMAChannelAttributeEnable(uint32_t ui32Base,
707  uint32_t ui32ChannelNum,
708  uint32_t ui32Attr);
709 
710 //*****************************************************************************
711 //
728 //
729 //*****************************************************************************
730 extern void uDMAChannelAttributeDisable(uint32_t ui32Base,
731  uint32_t ui32ChannelNum,
732  uint32_t ui32Attr);
733 
734 //*****************************************************************************
735 //
752 //
753 //*****************************************************************************
754 extern uint32_t uDMAChannelAttributeGet(uint32_t ui32Base,
755  uint32_t ui32ChannelNum);
756 
757 //*****************************************************************************
758 //
797 //
798 //*****************************************************************************
799 extern void uDMAChannelControlSet(uint32_t ui32Base,
800  uint32_t ui32ChannelStructIndex,
801  uint32_t ui32Control);
802 
803 //*****************************************************************************
804 //
861 //
862 //*****************************************************************************
863 extern void uDMAChannelTransferSet(uint32_t ui32Base,
864  uint32_t ui32ChannelStructIndex,
865  uint32_t ui32Mode, void *pvSrcAddr,
866  void *pvDstAddr, uint32_t ui32TransferSize);
867 
868 //*****************************************************************************
869 //
894 //
895 //*****************************************************************************
896 extern void uDMAChannelScatterGatherSet(uint32_t ui32Base,
897  uint32_t ui32ChannelNum,
898  uint32_t ui32TaskCount,
899  void *pvTaskList,
900  uint32_t ui32IsPeriphSG);
901 
902 //*****************************************************************************
903 //
918 //
919 //*****************************************************************************
920 extern uint32_t uDMAChannelSizeGet(uint32_t ui32Base,
921  uint32_t ui32ChannelStructIndex);
922 
923 //*****************************************************************************
924 //
944 //
945 //*****************************************************************************
946 extern uint32_t uDMAChannelModeGet(uint32_t ui32Base,
947  uint32_t ui32ChannelStructIndex);
948 
949 //*****************************************************************************
950 //
974 //
975 //*****************************************************************************
976 __STATIC_INLINE void
977 uDMAIntRegister(uint32_t ui32Base, uint32_t ui32IntChannel,
978  void (*pfnHandler)(void))
979 {
980  //
981  // Check the arguments.
982  //
983  ASSERT(uDMABaseValid(ui32Base));
984  ASSERT(pfnHandler);
985  ASSERT((ui32IntChannel == INT_DMA_DONE_COMB) || (ui32IntChannel == INT_DMA_ERR));
986 
987  //
988  // Register the interrupt handler.
989  //
990  IntRegister(ui32IntChannel, pfnHandler);
991 
992  //
993  // Enable the memory management fault.
994  //
995  IntEnable(ui32IntChannel);
996 }
997 
998 //*****************************************************************************
999 //
1016 //
1017 //*****************************************************************************
1018 __STATIC_INLINE void
1019 uDMAIntUnregister(uint32_t ui32Base, uint32_t ui32IntChannel)
1020 {
1021  //
1022  // Check the arguments.
1023  //
1024  ASSERT(uDMABaseValid(ui32Base));
1025  ASSERT((ui32IntChannel == INT_DMA_DONE_COMB) || (ui32IntChannel == INT_DMA_ERR));
1026 
1027  //
1028  // Disable the interrupt.
1029  //
1030  IntDisable(ui32IntChannel);
1031 
1032  //
1033  // Unregister the interrupt handler.
1034  //
1035  IntUnregister(ui32IntChannel);
1036 }
1037 
1038 //*****************************************************************************
1039 //
1051 //
1052 //*****************************************************************************
1053 __STATIC_INLINE void
1054 uDMAIntClear(uint32_t ui32Base, uint32_t ui32ChanMask)
1055 {
1056  //
1057  // Check the arguments.
1058  //
1059  ASSERT(uDMABaseValid(ui32Base));
1060 
1061  //
1062  // Clear the requested bits in the uDMA interrupt status register.
1063  //
1064  HWREG(ui32Base + UDMA_O_REQDONE) = ui32ChanMask;
1065 }
1066 
1067 //*****************************************************************************
1068 //
1078 //
1079 //*****************************************************************************
1080 __STATIC_INLINE uint32_t
1081 uDMAIntStatus(uint32_t ui32Base)
1082 {
1083  //
1084  // Check the arguments.
1085  //
1086  ASSERT(uDMABaseValid(ui32Base));
1087 
1088  //
1089  // Return the uDMA interrupt status register.
1090  //
1091  return (HWREG(ui32Base + UDMA_O_REQDONE));
1092 }
1093 
1094 //*****************************************************************************
1095 //
1110 //
1111 //*****************************************************************************
1112 __STATIC_INLINE void
1113 uDMAIntSwEventEnable(uint32_t ui32Base, uint32_t ui32IntChannel)
1114 {
1115  //
1116  // Check the arguments.
1117  //
1118  ASSERT(uDMABaseValid(ui32Base));
1119  ASSERT(ui32IntChannel < UDMA_NUM_CHANNELS);
1120 
1121  //
1122  // Enable the channel.
1123  //
1124  HWREGBITW(ui32Base + UDMA_O_DONEMASK, ui32IntChannel) = 1;
1125 }
1126 
1127 //*****************************************************************************
1128 //
1141 //
1142 //*****************************************************************************
1143 __STATIC_INLINE void
1144 uDMAIntSwEventDisable(uint32_t ui32Base, uint32_t ui32IntChannel)
1145 {
1146  //
1147  // Check the arguments.
1148  //
1149  ASSERT(uDMABaseValid(ui32Base));
1150  ASSERT(ui32IntChannel < UDMA_NUM_CHANNELS);
1151 
1152  //
1153  // Disable the SW channel.
1154  //
1155  HWREGBITW(ui32Base + UDMA_O_DONEMASK, ui32IntChannel) = 0;
1156 }
1157 
1158 //*****************************************************************************
1159 //
1167 //
1168 //*****************************************************************************
1169 __STATIC_INLINE uint32_t
1170 uDMAGetStatus(uint32_t ui32Base)
1171 {
1172  //
1173  // Check the arguments.
1174  //
1175  ASSERT(uDMABaseValid(ui32Base));
1176 
1177  //
1178  // Read and return the status register.
1179  //
1180  return HWREG(ui32Base + UDMA_O_STATUS);
1181 }
1182 
1183 //*****************************************************************************
1184 //
1194 //
1195 //*****************************************************************************
1196 __STATIC_INLINE void
1197 uDMAChannelPrioritySet(uint32_t ui32Base, uint32_t ui32ChannelNum)
1198 {
1199  //
1200  // Check the arguments.
1201  //
1202  ASSERT(uDMABaseValid(ui32Base));
1203  ASSERT(ui32ChannelNum < UDMA_NUM_CHANNELS);
1204 
1205  //
1206  // Set the channel priority to high.
1207  //
1208  HWREG(ui32Base + UDMA_O_SETCHNLPRIORITY) = 1 << ui32ChannelNum;
1209 }
1210 
1211 //*****************************************************************************
1212 //
1221 //
1222 //*****************************************************************************
1223 __STATIC_INLINE bool
1224 uDMAChannelPriorityGet(uint32_t ui32Base, uint32_t ui32ChannelNum)
1225 {
1226  //
1227  // Check the arguments.
1228  //
1229  ASSERT(uDMABaseValid(ui32Base));
1230  ASSERT(ui32ChannelNum < UDMA_NUM_CHANNELS);
1231 
1232  //
1233  // Return the channel priority.
1234  //
1235  return(HWREG(ui32Base + UDMA_O_SETCHNLPRIORITY) & (1 << ui32ChannelNum) ?
1237 }
1238 
1239 //*****************************************************************************
1240 //
1250 //
1251 //*****************************************************************************
1252 __STATIC_INLINE void
1253 uDMAChannelPriorityClear(uint32_t ui32Base, uint32_t ui32ChannelNum)
1254 {
1255  //
1256  // Check the arguments.
1257  //
1258  ASSERT(uDMABaseValid(ui32Base));
1259  ASSERT(ui32ChannelNum < UDMA_NUM_CHANNELS);
1260 
1261  //
1262  // Clear the channel priority.
1263  //
1264  HWREG(ui32Base + UDMA_O_CLEARCHNLPRIORITY) = 1 << ui32ChannelNum;
1265 }
1266 
1267 //*****************************************************************************
1268 //
1269 // Support for DriverLib in ROM:
1270 // Redirect to implementation in ROM when available.
1271 //
1272 //*****************************************************************************
1273 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
1274  #include <driverlib/rom.h>
1275  #ifdef ROM_uDMAChannelAttributeEnable
1276  #undef uDMAChannelAttributeEnable
1277  #define uDMAChannelAttributeEnable ROM_uDMAChannelAttributeEnable
1278  #endif
1279  #ifdef ROM_uDMAChannelAttributeDisable
1280  #undef uDMAChannelAttributeDisable
1281  #define uDMAChannelAttributeDisable ROM_uDMAChannelAttributeDisable
1282  #endif
1283  #ifdef ROM_uDMAChannelAttributeGet
1284  #undef uDMAChannelAttributeGet
1285  #define uDMAChannelAttributeGet ROM_uDMAChannelAttributeGet
1286  #endif
1287  #ifdef ROM_uDMAChannelControlSet
1288  #undef uDMAChannelControlSet
1289  #define uDMAChannelControlSet ROM_uDMAChannelControlSet
1290  #endif
1291  #ifdef ROM_uDMAChannelTransferSet
1292  #undef uDMAChannelTransferSet
1293  #define uDMAChannelTransferSet ROM_uDMAChannelTransferSet
1294  #endif
1295  #ifdef ROM_uDMAChannelScatterGatherSet
1296  #undef uDMAChannelScatterGatherSet
1297  #define uDMAChannelScatterGatherSet ROM_uDMAChannelScatterGatherSet
1298  #endif
1299  #ifdef ROM_uDMAChannelSizeGet
1300  #undef uDMAChannelSizeGet
1301  #define uDMAChannelSizeGet ROM_uDMAChannelSizeGet
1302  #endif
1303  #ifdef ROM_uDMAChannelModeGet
1304  #undef uDMAChannelModeGet
1305  #define uDMAChannelModeGet ROM_uDMAChannelModeGet
1306  #endif
1307 #endif
1308 
1309 //*****************************************************************************
1310 //
1311 // Mark the end of the C bindings section for C++ compilers.
1312 //
1313 //*****************************************************************************
1314 #ifdef __cplusplus
1315 }
1316 #endif
1317 
1318 #endif // __UDMA_H__
1319 
1320 //*****************************************************************************
1321 //
1325 //
1326 //*****************************************************************************
#define UDMA_NUM_CHANNELS
Definition: udma.h:207
uint32_t uDMAChannelModeGet(uint32_t ui32Base, uint32_t ui32ChannelStructIndex)
Gets the transfer mode for a uDMA channel control structure.
Definition: udma.c:514
volatile void * pvSrcEndAddr
The ending source address of the data transfer.
Definition: udma.h:105
static void uDMAIntUnregister(uint32_t ui32Base, uint32_t ui32IntChannel)
Unregisters an interrupt handler for the uDMA controller.
Definition: udma.h:1019
void uDMAChannelScatterGatherSet(uint32_t ui32Base, uint32_t ui32ChannelNum, uint32_t ui32TaskCount, void *pvTaskList, uint32_t ui32IsPeriphSG)
Configures a uDMA channel for scatter-gather mode.
Definition: udma.c:391
#define UDMA_PRIORITY_LOW
Definition: udma.h:214
static uint32_t uDMAGetStatus(uint32_t ui32Base)
Return the status of the uDMA module.
Definition: udma.h:1170
static void uDMAEnable(uint32_t ui32Base)
Enables the uDMA controller for use.
Definition: udma.h:362
static void uDMAErrorStatusClear(uint32_t ui32Base)
Clears the uDMA error interrupt.
Definition: udma.h:441
static void * uDMAControlBaseGet(uint32_t ui32Base)
Gets the base address for the channel control table.
Definition: udma.h:608
static void uDMAChannelEnable(uint32_t ui32Base, uint32_t ui32ChannelNum)
Enables a uDMA channel for operation.
Definition: udma.h:473
void uDMAChannelAttributeDisable(uint32_t ui32Base, uint32_t ui32ChannelNum, uint32_t ui32Attr)
Disables attributes of an uDMA channel.
Definition: udma.c:123
void uDMAChannelAttributeEnable(uint32_t ui32Base, uint32_t ui32ChannelNum, uint32_t ui32Attr)
Enables attributes of a uDMA channel.
Definition: udma.c:72
void uDMAChannelControlSet(uint32_t ui32Base, uint32_t ui32ChannelStructIndex, uint32_t ui32Control)
Sets the control parameters for a uDMA channel control structure.
Definition: udma.c:228
volatile uint32_t ui32Spare
An unused location.
Definition: udma.h:108
static void uDMAChannelDisable(uint32_t ui32Base, uint32_t ui32ChannelNum)
Disables a uDMA channel for operation.
Definition: udma.h:502
#define ASSERT(expr)
Definition: debug.h:74
volatile uint32_t ui32Control
The channel control mode.
Definition: udma.h:107
volatile void * pvDstEndAddr
The ending destination address of the data transfer.
Definition: udma.h:106
static void uDMAIntSwEventDisable(uint32_t ui32Base, uint32_t ui32IntChannel)
Disable interrupt on software event driven uDMA transfers.
Definition: udma.h:1144
static uint32_t uDMAIntStatus(uint32_t ui32Base)
Get the uDMA interrupt status.
Definition: udma.h:1081
static void uDMAIntClear(uint32_t ui32Base, uint32_t ui32ChanMask)
Clears uDMA interrupt done status.
Definition: udma.h:1054
void IntUnregister(uint32_t ui32Interrupt)
Unregisters the function to be called when an interrupt occurs.
Definition: interrupt.c:200
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.
Definition: udma.c:265
static uint32_t uDMAErrorStatusGet(uint32_t ui32Base)
Gets the uDMA error status.
Definition: udma.h:415
static void uDMAChannelPrioritySet(uint32_t ui32Base, uint32_t ui32ChannelNum)
Set the priority of a uDMA channel.
Definition: udma.h:1197
static bool uDMAChannelIsEnabled(uint32_t ui32Base, uint32_t ui32ChannelNum)
Checks if a uDMA channel is enabled for operation.
Definition: udma.h:533
static void uDMAChannelPriorityClear(uint32_t ui32Base, uint32_t ui32ChannelNum)
Clear the priority of a uDMA channel.
Definition: udma.h:1253
A structure that defines an entry in the channel control table.
Definition: udma.h:103
uint32_t uDMAChannelAttributeGet(uint32_t ui32Base, uint32_t ui32ChannelNum)
Gets the enabled attributes of a uDMA channel.
Definition: udma.c:174
static void uDMAIntRegister(uint32_t ui32Base, uint32_t ui32IntChannel, void(*pfnHandler)(void))
Registers an interrupt handler for the uDMA controller.
Definition: udma.h:977
static void uDMAControlBaseSet(uint32_t ui32Base, void *pControlTable)
Sets the base address for the channel control table.
Definition: udma.h:578
uint32_t uDMAChannelSizeGet(uint32_t ui32Base, uint32_t ui32ChannelStructIndex)
Gets the current transfer size for a uDMA channel control structure.
Definition: udma.c:462
static void * uDMAControlAlternateBaseGet(uint32_t ui32Base)
Gets the base address for the channel control table alternate structures.
Definition: udma.h:636
#define UDMA_PRIORITY_HIGH
Definition: udma.h:215
static void uDMAIntSwEventEnable(uint32_t ui32Base, uint32_t ui32IntChannel)
Enable interrupt on software event driven uDMA transfers.
Definition: udma.h:1113
static void uDMADisable(uint32_t ui32Base)
Disables the uDMA controller for use.
Definition: udma.h:388
void IntDisable(uint32_t ui32Interrupt)
Disables an interrupt.
Definition: interrupt.c:378
void IntRegister(uint32_t ui32Interrupt, void(*pfnHandler)(void))
Registers a function to be called when an interrupt occurs.
Definition: interrupt.c:152
static bool uDMAChannelPriorityGet(uint32_t ui32Base, uint32_t ui32ChannelNum)
Get the priority of a uDMA channel.
Definition: udma.h:1224
void IntEnable(uint32_t ui32Interrupt)
Enables an interrupt.
Definition: interrupt.c:318
static void uDMAChannelRequest(uint32_t ui32Base, uint32_t ui32ChannelNum)
Requests a uDMA channel to start a transfer.
Definition: udma.h:672