lpc_gpdma.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. /**********************************************************************
  2. * $Id$ lpc_gpdma.c 2011-06-02
  3. *//**
  4. * @file lpc_gpdma.c
  5. * @brief Contains all functions support for GPDMA firmware library
  6. * on LPC
  7. * @version 1.0
  8. * @date 02. June. 2011
  9. * @author NXP MCU SW Application Team
  10. *
  11. * Copyright(C) 2011, NXP Semiconductor
  12. * All rights reserved.
  13. *
  14. ***********************************************************************
  15. * Software that is described herein is for illustrative purposes only
  16. * which provides customers with programming information regarding the
  17. * products. This software is supplied "AS IS" without any warranties.
  18. * NXP Semiconductors assumes no responsibility or liability for the
  19. * use of the software, conveys no license or title under any patent,
  20. * copyright, or mask work right to the product. NXP Semiconductors
  21. * reserves the right to make changes in the software without
  22. * notification. NXP Semiconductors also make no representation or
  23. * warranty that such application will be suitable for the specified
  24. * use without further testing or modification.
  25. * Permission to use, copy, modify, and distribute this software and its
  26. * documentation is hereby granted, under NXP Semiconductors'
  27. * relevant copyright in the software, without fee, provided that it
  28. * is used in conjunction with NXP Semiconductors microcontrollers. This
  29. * copyright, permission, and disclaimer notice must appear in all copies of
  30. * this code.
  31. **********************************************************************/
  32. /* Peripheral group ----------------------------------------------------------- */
  33. /** @addtogroup GPDMA
  34. * @{
  35. */
  36. #ifdef __BUILD_WITH_EXAMPLE__
  37. #include "lpc_libcfg.h"
  38. #else
  39. #include "lpc_libcfg_default.h"
  40. #endif /* __BUILD_WITH_EXAMPLE__ */
  41. #ifdef _GPDMA
  42. /* Includes ------------------------------------------------------------------- */
  43. #include "lpc_gpdma.h"
  44. #include "lpc_clkpwr.h"
  45. /* Private Variables ---------------------------------------------------------- */
  46. /** @defgroup GPDMA_Private_Variables GPDMA Private Variables
  47. * @{
  48. */
  49. /**
  50. * @brief Lookup Table of Connection Type matched with
  51. * Peripheral Data (FIFO) register base address
  52. */
  53. volatile const void *GPDMA_LUTPerAddr[] = {
  54. 0, // Revered
  55. (&LPC_MCI->FIFO), // SD Card
  56. (&LPC_SSP0->DR), // SSP0 Tx
  57. (&LPC_SSP0->DR), // SSP0 Rx
  58. (&LPC_SSP1->DR), // SSP1 Tx
  59. (&LPC_SSP1->DR), // SSP1 Rx
  60. (&LPC_SSP2->DR), // SSP2 Tx
  61. (&LPC_SSP2->DR), // SSP2 Rx
  62. (&LPC_ADC->GDR), // ADC
  63. (&LPC_DAC->CR), // DAC
  64. (&LPC_UART0->/*RBTHDLR.*/THR), // UART0 Tx
  65. (&LPC_UART0->/*RBTHDLR.*/RBR), // UART0 Rx
  66. (&LPC_UART1->/*RBTHDLR.*/THR), // UART1 Tx
  67. (&LPC_UART1->/*RBTHDLR.*/RBR), // UART1 Rx
  68. (&LPC_UART2->/*RBTHDLR.*/THR), // UART2 Tx
  69. (&LPC_UART2->/*RBTHDLR.*/RBR), // UART2 Rx
  70. (&LPC_TIM0->MR0), // MAT0.0
  71. (&LPC_TIM0->MR1), // MAT0.1
  72. (&LPC_TIM1->MR0), // MAT1.0
  73. (&LPC_TIM1->MR1), // MAT1.1
  74. (&LPC_TIM2->MR0), // MAT2.0
  75. (&LPC_TIM2->MR1), // MAT2.1
  76. (&LPC_I2S->TXFIFO), // I2S Tx
  77. (&LPC_I2S->RXFIFO), // I2S Rx
  78. 0, // Reverse
  79. 0, // Reverse
  80. (&LPC_UART3->/*RBTHDLR.*/THR), // UART3 Tx
  81. (&LPC_UART3->/*RBTHDLR.*/RBR), // UART3 Rx
  82. (&LPC_UART4->/*RBTHDLR.*/THR), // UART4 Tx
  83. (&LPC_UART4->/*RBTHDLR.*/RBR), // UART4 Rx
  84. (&LPC_TIM3->MR0), // MAT3.0
  85. (&LPC_TIM3->MR1), // MAT3.1
  86. };
  87. /**
  88. * @brief Lookup Table of GPDMA Channel Number matched with
  89. * GPDMA channel pointer
  90. */
  91. const LPC_GPDMACH_TypeDef *pGPDMACh[8] = {
  92. LPC_GPDMACH0, // GPDMA Channel 0
  93. LPC_GPDMACH1, // GPDMA Channel 1
  94. LPC_GPDMACH2, // GPDMA Channel 2
  95. LPC_GPDMACH3, // GPDMA Channel 3
  96. LPC_GPDMACH4, // GPDMA Channel 4
  97. LPC_GPDMACH5, // GPDMA Channel 5
  98. LPC_GPDMACH6, // GPDMA Channel 6
  99. LPC_GPDMACH7, // GPDMA Channel 7
  100. };
  101. /**
  102. * @brief Optimized Peripheral Source and Destination burst size
  103. */
  104. const uint8_t GPDMA_LUTPerBurst[] = {
  105. 0, // Reserved
  106. GPDMA_BSIZE_8, // SD Card
  107. GPDMA_BSIZE_4, // SSP0 Tx
  108. GPDMA_BSIZE_4, // SSP0 Rx
  109. GPDMA_BSIZE_4, // SSP1 Tx
  110. GPDMA_BSIZE_4, // SSP1 Rx
  111. GPDMA_BSIZE_4, // SSP2 Tx
  112. GPDMA_BSIZE_4, // SSP2 Rx
  113. GPDMA_BSIZE_1, // ADC
  114. GPDMA_BSIZE_1, // DAC
  115. GPDMA_BSIZE_1, // UART0 Tx
  116. GPDMA_BSIZE_1, // UART0 Rx
  117. GPDMA_BSIZE_1, // UART1 Tx
  118. GPDMA_BSIZE_1, // UART1 Rx
  119. GPDMA_BSIZE_1, // UART2 Tx
  120. GPDMA_BSIZE_1, // UART2 Rx
  121. GPDMA_BSIZE_1, // MAT0.0
  122. GPDMA_BSIZE_1, // MAT0.1
  123. GPDMA_BSIZE_1, // MAT1.0
  124. GPDMA_BSIZE_1, // MAT1.1
  125. GPDMA_BSIZE_1, // MAT2.0
  126. GPDMA_BSIZE_1, // MAT2.1
  127. GPDMA_BSIZE_32, // I2S channel 0
  128. GPDMA_BSIZE_32, // I2S channel 1
  129. 0, // Reserved
  130. 0, // Reserved
  131. GPDMA_BSIZE_1, // UART3 Tx
  132. GPDMA_BSIZE_1, // UART3 Rx
  133. GPDMA_BSIZE_1, // UART4 Tx
  134. GPDMA_BSIZE_1, // UART4 Rx
  135. GPDMA_BSIZE_1, // MAT3.0
  136. GPDMA_BSIZE_1, // MAT3.1
  137. };
  138. /**
  139. * @brief Optimized Peripheral Source and Destination transfer width
  140. */
  141. const uint8_t GPDMA_LUTPerWid[] = {
  142. 0, // Reserved
  143. GPDMA_WIDTH_WORD, // SD Card
  144. GPDMA_WIDTH_BYTE, // SSP0 Tx
  145. GPDMA_WIDTH_BYTE, // SSP0 Rx
  146. GPDMA_WIDTH_BYTE, // SSP1 Tx
  147. GPDMA_WIDTH_BYTE, // SSP1 Rx
  148. GPDMA_WIDTH_BYTE, // SSP2 Tx
  149. GPDMA_WIDTH_BYTE, // SSP2 Rx
  150. GPDMA_WIDTH_WORD, // ADC
  151. GPDMA_WIDTH_BYTE, // DAC
  152. GPDMA_WIDTH_BYTE, // UART0 Tx
  153. GPDMA_WIDTH_BYTE, // UART0 Rx
  154. GPDMA_WIDTH_BYTE, // UART1 Tx
  155. GPDMA_WIDTH_BYTE, // UART1 Rx
  156. GPDMA_WIDTH_BYTE, // UART2 Tx
  157. GPDMA_WIDTH_BYTE, // UART2 Rx
  158. GPDMA_WIDTH_WORD, // MAT0.0
  159. GPDMA_WIDTH_WORD, // MAT0.1
  160. GPDMA_WIDTH_WORD, // MAT1.0
  161. GPDMA_WIDTH_WORD, // MAT1.1
  162. GPDMA_WIDTH_WORD, // MAT2.0
  163. GPDMA_WIDTH_WORD, // MAT2.1
  164. GPDMA_WIDTH_WORD, // I2S channel 0
  165. GPDMA_WIDTH_WORD, // I2S channel 1
  166. 0, // Reserved
  167. 0, // Reserved
  168. GPDMA_WIDTH_BYTE, // UART3 Tx
  169. GPDMA_WIDTH_BYTE, // UART3 Rx
  170. GPDMA_WIDTH_BYTE, // UART4 Tx
  171. GPDMA_WIDTH_BYTE, // UART4 Rx
  172. GPDMA_WIDTH_WORD, // MAT3.0
  173. GPDMA_WIDTH_WORD, // MAT3.1
  174. };
  175. /**
  176. * @}
  177. */
  178. /* Public Functions ----------------------------------------------------------- */
  179. /** @addtogroup GPDMA_Public_Functions
  180. * @{
  181. */
  182. /********************************************************************//**
  183. * @brief Initialize GPDMA controller
  184. * @param None
  185. * @return None
  186. *********************************************************************/
  187. void GPDMA_Init(void)
  188. {
  189. /* Enable GPDMA clock */
  190. CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCGPDMA, ENABLE);
  191. // Reset all channel configuration register
  192. LPC_GPDMACH0->CConfig = 0;
  193. LPC_GPDMACH1->CConfig = 0;
  194. LPC_GPDMACH2->CConfig = 0;
  195. LPC_GPDMACH3->CConfig = 0;
  196. LPC_GPDMACH4->CConfig = 0;
  197. LPC_GPDMACH5->CConfig = 0;
  198. LPC_GPDMACH6->CConfig = 0;
  199. LPC_GPDMACH7->CConfig = 0;
  200. /* Clear all DMA interrupt and error flag */
  201. LPC_GPDMA->IntTCClear = 0xFF;
  202. LPC_GPDMA->IntErrClr = 0xFF;
  203. }
  204. /********************************************************************//**
  205. * @brief Setup GPDMA channel peripheral according to the specified
  206. * parameters in the GPDMAChannelConfig.
  207. * @param[in] GPDMAChannelConfig Pointer to a GPDMA_CH_CFG_Type
  208. * structure that contains the configuration
  209. * information for the specified GPDMA channel peripheral.
  210. * @return ERROR if selected channel is enabled before
  211. * or SUCCESS if channel is configured successfully
  212. *********************************************************************/
  213. Status GPDMA_Setup(GPDMA_Channel_CFG_Type *GPDMAChannelConfig)
  214. {
  215. LPC_GPDMACH_TypeDef *pDMAch;
  216. uint32_t tmp1, tmp2;
  217. if (LPC_GPDMA->EnbldChns & (GPDMA_DMACEnbldChns_Ch(GPDMAChannelConfig->ChannelNum))) {
  218. // This channel is enabled, return ERROR, need to release this channel first
  219. return ERROR;
  220. }
  221. // Get Channel pointer
  222. pDMAch = (LPC_GPDMACH_TypeDef *) pGPDMACh[GPDMAChannelConfig->ChannelNum];
  223. // Reset the Interrupt status
  224. LPC_GPDMA->IntTCClear = GPDMA_DMACIntTCClear_Ch(GPDMAChannelConfig->ChannelNum);
  225. LPC_GPDMA->IntErrClr = GPDMA_DMACIntErrClr_Ch(GPDMAChannelConfig->ChannelNum);
  226. // Clear DMA configure
  227. pDMAch->CControl = 0x00;
  228. pDMAch->CConfig = 0x00;
  229. /* Assign Linker List Item value */
  230. pDMAch->CLLI = GPDMAChannelConfig->DMALLI;
  231. /* Set value to Channel Control Registers */
  232. switch (GPDMAChannelConfig->TransferType)
  233. {
  234. // Memory to memory
  235. case GPDMA_TRANSFERTYPE_M2M:
  236. // Assign physical source and destination address
  237. pDMAch->CSrcAddr = GPDMAChannelConfig->SrcMemAddr;
  238. pDMAch->CDestAddr = GPDMAChannelConfig->DstMemAddr;
  239. pDMAch->CControl
  240. = GPDMA_DMACCxControl_TransferSize(GPDMAChannelConfig->TransferSize) \
  241. | GPDMA_DMACCxControl_SBSize(GPDMA_BSIZE_32) \
  242. | GPDMA_DMACCxControl_DBSize(GPDMA_BSIZE_32) \
  243. | GPDMA_DMACCxControl_SWidth(GPDMAChannelConfig->TransferWidth) \
  244. | GPDMA_DMACCxControl_DWidth(GPDMAChannelConfig->TransferWidth) \
  245. | GPDMA_DMACCxControl_SI \
  246. | GPDMA_DMACCxControl_DI \
  247. | GPDMA_DMACCxControl_I;
  248. break;
  249. // Memory to peripheral
  250. case GPDMA_TRANSFERTYPE_M2P:
  251. case GPDMA_TRANSFERTYPE_M2P_DEST_CTRL:
  252. // Assign physical source
  253. pDMAch->CSrcAddr = GPDMAChannelConfig->SrcMemAddr;
  254. // Assign peripheral destination address
  255. pDMAch->CDestAddr = (uint32_t)GPDMA_LUTPerAddr[GPDMAChannelConfig->DstConn];
  256. pDMAch->CControl
  257. = GPDMA_DMACCxControl_TransferSize((uint32_t)GPDMAChannelConfig->TransferSize) \
  258. | GPDMA_DMACCxControl_SBSize((uint32_t)GPDMA_LUTPerBurst[GPDMAChannelConfig->DstConn]) \
  259. | GPDMA_DMACCxControl_DBSize((uint32_t)GPDMA_LUTPerBurst[GPDMAChannelConfig->DstConn]) \
  260. | GPDMA_DMACCxControl_SWidth((uint32_t)GPDMA_LUTPerWid[GPDMAChannelConfig->DstConn]) \
  261. | GPDMA_DMACCxControl_DWidth((uint32_t)GPDMA_LUTPerWid[GPDMAChannelConfig->DstConn]) \
  262. | GPDMA_DMACCxControl_SI \
  263. | GPDMA_DMACCxControl_I;
  264. break;
  265. // Peripheral to memory
  266. case GPDMA_TRANSFERTYPE_P2M:
  267. case GPDMA_TRANSFERTYPE_P2M_SRC_CTRL:
  268. // Assign peripheral source address
  269. pDMAch->CSrcAddr = (uint32_t)GPDMA_LUTPerAddr[GPDMAChannelConfig->SrcConn];
  270. // Assign memory destination address
  271. pDMAch->CDestAddr = GPDMAChannelConfig->DstMemAddr;
  272. pDMAch->CControl
  273. = GPDMA_DMACCxControl_TransferSize((uint32_t)GPDMAChannelConfig->TransferSize) \
  274. | GPDMA_DMACCxControl_SBSize((uint32_t)GPDMA_LUTPerBurst[GPDMAChannelConfig->SrcConn]) \
  275. | GPDMA_DMACCxControl_DBSize((uint32_t)GPDMA_LUTPerBurst[GPDMAChannelConfig->SrcConn]) \
  276. | GPDMA_DMACCxControl_SWidth((uint32_t)GPDMA_LUTPerWid[GPDMAChannelConfig->SrcConn]) \
  277. | GPDMA_DMACCxControl_DWidth((uint32_t)GPDMA_LUTPerWid[GPDMAChannelConfig->SrcConn]) \
  278. | GPDMA_DMACCxControl_DI \
  279. | GPDMA_DMACCxControl_I;
  280. break;
  281. // Peripheral to peripheral
  282. case GPDMA_TRANSFERTYPE_P2P:
  283. // Assign peripheral source address
  284. pDMAch->CSrcAddr = (uint32_t)GPDMA_LUTPerAddr[GPDMAChannelConfig->SrcConn];
  285. // Assign peripheral destination address
  286. pDMAch->CDestAddr = (uint32_t)GPDMA_LUTPerAddr[GPDMAChannelConfig->DstConn];
  287. pDMAch->CControl = GPDMA_DMACCxControl_TransferSize((uint32_t)GPDMAChannelConfig->TransferSize) \
  288. | GPDMA_DMACCxControl_SBSize((uint32_t)GPDMA_LUTPerBurst[GPDMAChannelConfig->SrcConn]) \
  289. | GPDMA_DMACCxControl_DBSize((uint32_t)GPDMA_LUTPerBurst[GPDMAChannelConfig->DstConn]) \
  290. | GPDMA_DMACCxControl_SWidth((uint32_t)GPDMA_LUTPerWid[GPDMAChannelConfig->SrcConn]) \
  291. | GPDMA_DMACCxControl_DWidth((uint32_t)GPDMA_LUTPerWid[GPDMAChannelConfig->DstConn]) \
  292. | GPDMA_DMACCxControl_I;
  293. break;
  294. // Do not support any more transfer type, return ERROR
  295. default:
  296. return ERROR;
  297. }
  298. /* Re-Configure DMA Request Select for source peripheral */
  299. if((GPDMAChannelConfig->SrcConn != 8)&&(GPDMAChannelConfig->SrcConn != 9))
  300. {
  301. if (GPDMAChannelConfig->SrcConn > 15)
  302. {
  303. LPC_SC->DMAREQSEL |= (1<<(GPDMAChannelConfig->SrcConn - 16));
  304. } else {
  305. LPC_SC->DMAREQSEL &= ~(1<<(GPDMAChannelConfig->SrcConn));
  306. }
  307. }
  308. /* Re-Configure DMA Request Select for Destination peripheral */
  309. if((GPDMAChannelConfig->DstConn != 8)&&(GPDMAChannelConfig->DstConn != 9))
  310. {
  311. if (GPDMAChannelConfig->DstConn > 15)
  312. {
  313. LPC_SC->DMAREQSEL |= (1<<(GPDMAChannelConfig->DstConn - 16));
  314. } else {
  315. LPC_SC->DMAREQSEL &= ~(1<<(GPDMAChannelConfig->DstConn));
  316. }
  317. }
  318. /* Enable DMA channels, little endian */
  319. LPC_GPDMA->Config = GPDMA_DMACConfig_E;
  320. while (!(LPC_GPDMA->Config & GPDMA_DMACConfig_E));
  321. // Calculate absolute value for Connection number
  322. tmp1 = GPDMAChannelConfig->SrcConn;
  323. tmp1 = ((tmp1 > 15) ? (tmp1 - 16) : tmp1);
  324. tmp2 = GPDMAChannelConfig->DstConn;
  325. tmp2 = ((tmp2 > 15) ? (tmp2 - 16) : tmp2);
  326. // Configure DMA Channel, enable Error Counter and Terminate counter
  327. pDMAch->CConfig = GPDMA_DMACCxConfig_IE | GPDMA_DMACCxConfig_ITC /*| GPDMA_DMACCxConfig_E*/ \
  328. | GPDMA_DMACCxConfig_TransferType((uint32_t)GPDMAChannelConfig->TransferType) \
  329. | GPDMA_DMACCxConfig_SrcPeripheral(tmp1) \
  330. | GPDMA_DMACCxConfig_DestPeripheral(tmp2);
  331. return SUCCESS;
  332. }
  333. /*********************************************************************//**
  334. * @brief Enable/Disable DMA channel
  335. * @param[in] channelNum GPDMA channel, should be in range from 0 to 7
  336. * @param[in] NewState New State of this command, should be:
  337. * - ENABLE.
  338. * - DISABLE.
  339. * @return None
  340. **********************************************************************/
  341. void GPDMA_ChannelCmd(uint8_t channelNum, FunctionalState NewState)
  342. {
  343. LPC_GPDMACH_TypeDef *pDMAch;
  344. // Get Channel pointer
  345. pDMAch = (LPC_GPDMACH_TypeDef *) pGPDMACh[channelNum];
  346. if (NewState == ENABLE) {
  347. pDMAch->CConfig |= GPDMA_DMACCxConfig_E;
  348. } else {
  349. pDMAch->CConfig &= ~GPDMA_DMACCxConfig_E;
  350. }
  351. }
  352. /*********************************************************************//**
  353. * @brief Check if corresponding channel does have an active interrupt
  354. * request or not
  355. * @param[in] type type of status, should be:
  356. * - GPDMA_STAT_INT: GPDMA Interrupt Status
  357. * - GPDMA_STAT_INTTC: GPDMA Interrupt Terminal Count Request Status
  358. * - GPDMA_STAT_INTERR: GPDMA Interrupt Error Status
  359. * - GPDMA_STAT_RAWINTTC: GPDMA Raw Interrupt Terminal Count Status
  360. * - GPDMA_STAT_RAWINTERR: GPDMA Raw Error Interrupt Status
  361. * - GPDMA_STAT_ENABLED_CH:GPDMA Enabled Channel Status
  362. * @param[in] channel GPDMA channel, should be in range from 0 to 7
  363. * @return IntStatus status of DMA channel interrupt after masking
  364. * Should be:
  365. * - SET: the corresponding channel has no active interrupt request
  366. * - RESET: the corresponding channel does have an active interrupt request
  367. **********************************************************************/
  368. IntStatus GPDMA_IntGetStatus(GPDMA_Status_Type type, uint8_t channel)
  369. {
  370. switch (type)
  371. {
  372. case GPDMA_STAT_INT: //check status of DMA channel interrupts
  373. if (LPC_GPDMA->IntStat & (GPDMA_DMACIntStat_Ch(channel)))
  374. return SET;
  375. return RESET;
  376. case GPDMA_STAT_INTTC: // check terminal count interrupt request status for DMA
  377. if (LPC_GPDMA->IntTCStat & GPDMA_DMACIntTCStat_Ch(channel))
  378. return SET;
  379. return RESET;
  380. case GPDMA_STAT_INTERR: //check interrupt status for DMA channels
  381. if (LPC_GPDMA->IntErrStat & GPDMA_DMACIntTCClear_Ch(channel))
  382. return SET;
  383. return RESET;
  384. case GPDMA_STAT_RAWINTTC: //check status of the terminal count interrupt for DMA channels
  385. if (LPC_GPDMA->RawIntErrStat & GPDMA_DMACRawIntTCStat_Ch(channel))
  386. return SET;
  387. return RESET;
  388. case GPDMA_STAT_RAWINTERR: //check status of the error interrupt for DMA channels
  389. if (LPC_GPDMA->RawIntTCStat & GPDMA_DMACRawIntErrStat_Ch(channel))
  390. return SET;
  391. return RESET;
  392. default: //check enable status for DMA channels
  393. if (LPC_GPDMA->EnbldChns & GPDMA_DMACEnbldChns_Ch(channel))
  394. return SET;
  395. return RESET;
  396. }
  397. }
  398. /*********************************************************************//**
  399. * @brief Clear one or more interrupt requests on DMA channels
  400. * @param[in] type type of interrupt request, should be:
  401. * - GPDMA_STATCLR_INTTC: GPDMA Interrupt Terminal Count Request Clear
  402. * - GPDMA_STATCLR_INTERR: GPDMA Interrupt Error Clear
  403. * @param[in] channel GPDMA channel, should be in range from 0 to 7
  404. * @return None
  405. **********************************************************************/
  406. void GPDMA_ClearIntPending(GPDMA_StateClear_Type type, uint8_t channel)
  407. {
  408. if (type == GPDMA_STATCLR_INTTC) // clears the terminal count interrupt request on DMA channel
  409. LPC_GPDMA->IntTCClear = GPDMA_DMACIntTCClear_Ch(channel);
  410. else // clear the error interrupt request
  411. LPC_GPDMA->IntErrClr = GPDMA_DMACIntErrClr_Ch(channel);
  412. }
  413. /**
  414. * @}
  415. */
  416. #endif /* _GPDMA */
  417. /**
  418. * @}
  419. */
  420. /* --------------------------------- End Of File ------------------------------ */