lpc17xx_gpdma.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. #ifndef _LPC17XX_GPDMA_H_
  2. #define _LPC17XX_GPDMA_H_
  3. /*
  4. * Copyright (C) 2012 by Ole Reinhardt (ole.reinhardt@embedded-it.de)
  5. *
  6. * All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in the
  16. * documentation and/or other materials provided with the distribution.
  17. * 3. Neither the name of the copyright holders nor the names of
  18. * contributors may be used to endorse or promote products derived
  19. * from this software without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  28. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  29. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  31. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32. * SUCH DAMAGE.
  33. *
  34. * For additional information see http://www.ethernut.de/
  35. *
  36. *
  37. * Parts taken from lpc177x_8x_gpdma.h 2011-06-02
  38. *
  39. * file lpc177x_8x_gpdma.h
  40. * brief Contains all macro definitions and function prototypes
  41. * support for GPDMA firmware library on LPC177x_8x
  42. * version 1.0
  43. * date 02. June. 2011
  44. * author NXP MCU SW Application Team
  45. *
  46. * Copyright(C) 2011, NXP Semiconductor
  47. * All rights reserved.
  48. *
  49. ***********************************************************************
  50. * Software that is described herein is for illustrative purposes only
  51. * which provides customers with programming information regarding the
  52. * products. This software is supplied "AS IS" without any warranties.
  53. * NXP Semiconductors assumes no responsibility or liability for the
  54. * use of the software, conveys no license or title under any patent,
  55. * copyright, or mask work right to the product. NXP Semiconductors
  56. * reserves the right to make changes in the software without
  57. * notification. NXP Semiconductors also make no representation or
  58. * warranty that such application will be suitable for the specified
  59. * use without further testing or modification.
  60. * Permission to use, copy, modify, and distribute this software and its
  61. * documentation is hereby granted, under NXP Semiconductors'
  62. * relevant copyright in the software, without fee, provided that it
  63. * is used in conjunction with NXP Semiconductors microcontrollers. This
  64. * copyright, permission, and disclaimer notice must appear in all copies of
  65. * this code.
  66. **********************************************************************/
  67. /*!
  68. * \verbatim
  69. * $Id: $
  70. * \endverbatim
  71. */
  72. /*============================================================================*
  73. Public definitions
  74. *============================================================================*/
  75. #define GPDMA_NUM_CHANNELS 8 /* Number of DMA channels */
  76. /*----------------------------------------------------------------------------*
  77. DMA Connection number definitions
  78. *----------------------------------------------------------------------------*/
  79. #if defined(MCU_LPC176x)
  80. # define GPDMA_CONN_SSP0_Tx 0 /* SSP0 Tx */
  81. # define GPDMA_CONN_SSP0_Rx 1 /* SSP0 Rx */
  82. # define GPDMA_CONN_SSP1_Tx 2 /* SSP1 Tx */
  83. # define GPDMA_CONN_SSP1_Rx 3 /* SSP1 Rx */
  84. # define GPDMA_CONN_ADC 4 /* ADC */
  85. # define GPDMA_CONN_I2S_Channel_0 5 /* I2S channel 0 */
  86. # define GPDMA_CONN_I2S_Channel_1 6 /* I2S channel 1 */
  87. # define GPDMA_CONN_DAC 7 /* DAC */
  88. # define GPDMA_CONN_UART0_Tx 8 /* UART0 Tx */
  89. # define GPDMA_CONN_UART0_Rx 9 /* UART0 Rx */
  90. # define GPDMA_CONN_UART1_Tx 10 /* UART1 Tx */
  91. # define GPDMA_CONN_UART1_Rx 11 /* UART1 Rx */
  92. # define GPDMA_CONN_UART2_Tx 12 /* UART2 Tx */
  93. # define GPDMA_CONN_UART2_Rx 13 /* UART2 Rx */
  94. # define GPDMA_CONN_UART3_Tx 14 /* UART3 Tx */
  95. # define GPDMA_CONN_UART3_Rx 15 /* UART3 Rx */
  96. # define GPDMA_CONN_MAT0_0 16 /* MAT0.0 */
  97. # define GPDMA_CONN_MAT0_1 17 /* MAT0.1 */
  98. # define GPDMA_CONN_MAT1_0 18 /* MAT1.0 */
  99. # define GPDMA_CONN_MAT1_1 19 /* MAT1.1 */
  100. # define GPDMA_CONN_MAT2_0 20 /* MAT2.0 */
  101. # define GPDMA_CONN_MAT2_1 21 /* MAT2.1 */
  102. # define GPDMA_CONN_MAT3_0 22 /* MAT3.0 */
  103. # define GPDMA_CONN_MAT3_1 23 /* MAT3.1 */
  104. #elif defined(MCU_LPC177x_8x) || defined(MCU_LPC407x_8x)
  105. /* 0 reserved */
  106. # define GPDMA_CONN_MCI 1 /* SD card */
  107. # define GPDMA_CONN_SSP0_Tx 2 /* SSP0 Tx */
  108. # define GPDMA_CONN_SSP0_Rx 3 /* SSP0 Rx */
  109. # define GPDMA_CONN_SSP1_Tx 4 /* SSP1 Tx */
  110. # define GPDMA_CONN_SSP1_Rx 5 /* SSP1 Rx */
  111. # define GPDMA_CONN_SSP2_Tx 6 /* SSP2 Tx */
  112. # define GPDMA_CONN_SSP2_Rx 7 /* SSP2 Rx */
  113. # define GPDMA_CONN_ADC 8 /* ADC */
  114. # define GPDMA_CONN_DAC 9 /* DAC */
  115. # define GPDMA_CONN_UART0_Tx 10 /* UART0 Tx */
  116. # define GPDMA_CONN_UART0_Rx 11 /* UART0 Rx */
  117. # define GPDMA_CONN_UART1_Tx 12 /* UART1 Tx */
  118. # define GPDMA_CONN_UART1_Rx 13 /* UART1 Rx */
  119. # define GPDMA_CONN_UART2_Tx 14 /* UART2 Tx */
  120. # define GPDMA_CONN_UART2_Rx 15 /* UART2 Rx */
  121. # define GPDMA_CONN_MAT0_0 16 /* MAT0.0 */
  122. # define GPDMA_CONN_MAT0_1 17 /* MAT0.1 */
  123. # define GPDMA_CONN_MAT1_0 18 /* MAT1.0 */
  124. # define GPDMA_CONN_MAT1_1 19 /* MAT1.1 */
  125. # define GPDMA_CONN_MAT2_0 20 /* MAT2.0 */
  126. # define GPDMA_CONN_MAT2_1 21 /* MAT2.1 */
  127. # define GPDMA_CONN_I2S_Channel_0 22 /* I2S channel 0 */
  128. # define GPDMA_CONN_I2S_Channel_1 23 /* I2S channel 1 */
  129. /* 24 reserved */
  130. /* 25 reserved */
  131. # define GPDMA_CONN_UART3_Tx 26 /* UART3 Tx */
  132. # define GPDMA_CONN_UART3_Rx 27 /* UART3 Rx */
  133. # define GPDMA_CONN_UART4_Tx 28 /* UART3 Tx */
  134. # define GPDMA_CONN_UART4_Rx 29 /* UART3 Rx */
  135. # define GPDMA_CONN_MAT3_0 30 /* MAT3.0 */
  136. # define GPDMA_CONN_MAT3_1 31 /* MAT3.1 */
  137. #endif
  138. /*----------------------------------------------------------------------------*
  139. GPDMA Transfer type definitions
  140. *----------------------------------------------------------------------------*/
  141. #define GPDMA_TRANSFERTYPE_M2M 0 /* Memory to memory - DMA control */
  142. #define GPDMA_TRANSFERTYPE_M2P 1 /* Memory to peripheral - DMA control */
  143. #define GPDMA_TRANSFERTYPE_P2M 2 /* Peripheral to memory - DMA control */
  144. #define GPDMA_TRANSFERTYPE_P2P 3 /* Source peripheral to destination peripheral - DMA control */
  145. #define GPDMA_TRANSFERTYPE_M2P_DEST_CTRL 5 /* Memory to peripheral - Destination peripheral control */
  146. #define GPDMA_TRANSFERTYPE_P2M_SRC_CTRL 6 /* Peripheral to memory - Source peripheral control */
  147. /*----------------------------------------------------------------------------*
  148. Burst size in Source and Destination definitions
  149. *----------------------------------------------------------------------------*/
  150. #define GPDMA_BSIZE_1 0 /* Burst size = 1 */
  151. #define GPDMA_BSIZE_4 1 /* Burst size = 4 */
  152. #define GPDMA_BSIZE_8 2 /* Burst size = 8 */
  153. #define GPDMA_BSIZE_16 3 /* Burst size = 16 */
  154. #define GPDMA_BSIZE_32 4 /* Burst size = 32 */
  155. #define GPDMA_BSIZE_64 5 /* Burst size = 64 */
  156. #define GPDMA_BSIZE_128 6 /* Burst size = 128 */
  157. #define GPDMA_BSIZE_256 7 /* Burst size = 256 */
  158. /*----------------------------------------------------------------------------*
  159. Width in Source transfer width and Destination transfer width definitions
  160. *----------------------------------------------------------------------------*/
  161. #define GPDMA_WIDTH_BYTE 0 /* Width = 1 byte */
  162. #define GPDMA_WIDTH_HALFWORD 1 /* Width = 2 bytes */
  163. #define GPDMA_WIDTH_WORD 2 /* Width = 4 bytes */
  164. /*----------------------------------------------------------------------------*
  165. DMA Request Select Mode definitions
  166. *----------------------------------------------------------------------------*/
  167. #define GPDMA_REQSEL_UART 0 /* UART TX/RX is selected */
  168. #define GPDMA_REQSEL_TIMER 1 /* Timer match is selected */
  169. /*============================================================================*
  170. Bit definitions
  171. *============================================================================*/
  172. /*----------------------------------------------------------------------------*
  173. Macro defines for DMA Interrupt Status register
  174. *----------------------------------------------------------------------------*/
  175. #define GPDMA_DMACIntStat_Ch(n) ((1UL << n) & 0xFF)
  176. #define GPDMA_DMACIntStat_BITMASK 0xFF
  177. /*----------------------------------------------------------------------------*
  178. Macro defines for DMA Interrupt Terminal Count Request Status register
  179. *----------------------------------------------------------------------------*/
  180. #define GPDMA_DMACIntTCStat_Ch(n) ((1UL << n) & 0xFF)
  181. #define GPDMA_DMACIntTCStat_BITMASK 0xFF
  182. /*----------------------------------------------------------------------------*
  183. Macro defines for DMA Interrupt Terminal Count Request Clear register
  184. *----------------------------------------------------------------------------*/
  185. #define GPDMA_DMACIntTCClear_Ch(n) ((1UL << n) & 0xFF)
  186. #define GPDMA_DMACIntTCClear_BITMASK 0xFF
  187. /*----------------------------------------------------------------------------*
  188. Macro defines for DMA Interrupt Error Status register
  189. *----------------------------------------------------------------------------*/
  190. #define GPDMA_DMACIntErrStat_Ch(n) ((1UL << n) & 0xFF)
  191. #define GPDMA_DMACIntErrStat_BITMASK 0xFF
  192. /*----------------------------------------------------------------------------*
  193. Macro defines for DMA Interrupt Error Clear register
  194. *----------------------------------------------------------------------------*/
  195. #define GPDMA_DMACIntErrClr_Ch(n) ((1UL << n) & 0xFF)
  196. #define GPDMA_DMACIntErrClr_BITMASK 0xFF
  197. /*----------------------------------------------------------------------------*
  198. Macro defines for DMA Raw Interrupt Terminal Count Status register
  199. *----------------------------------------------------------------------------*/
  200. #define GPDMA_DMACRawIntTCStat_Ch(n) ((1UL << n) & 0xFF)
  201. #define GPDMA_DMACRawIntTCStat_BITMASK 0xFF
  202. /*----------------------------------------------------------------------------*
  203. Macro defines for DMA Raw Error Interrupt Status register
  204. *----------------------------------------------------------------------------*/
  205. #define GPDMA_DMACRawIntErrStat_Ch(n) ((1UL << n) & 0xFF)
  206. #define GPDMA_DMACRawIntErrStat_BITMASK 0xFF
  207. /*----------------------------------------------------------------------------*
  208. Macro defines for DMA Enabled Channel register
  209. *----------------------------------------------------------------------------*/
  210. #define GPDMA_DMACEnbldChns_Ch(n) ((1UL << n) & 0xFF)
  211. #define GPDMA_DMACEnbldChns_BITMASK 0xFF
  212. /*----------------------------------------------------------------------------*
  213. Macro defines for DMA Software Burst Request register
  214. *----------------------------------------------------------------------------*/
  215. #define GPDMA_DMACSoftBReq_Src(n) ((1UL << n) & 0xFFFF)
  216. #define GPDMA_DMACSoftBReq_BITMASK 0xFFFF
  217. /*----------------------------------------------------------------------------*
  218. Macro defines for DMA Software Single Request register
  219. *----------------------------------------------------------------------------*/
  220. #define GPDMA_DMACSoftSReq_Src(n) ((1UL << n) & 0xFFFF)
  221. #define GPDMA_DMACSoftSReq_BITMASK 0xFFFF
  222. /*----------------------------------------------------------------------------*
  223. Macro defines for DMA Software Last Burst Request register
  224. *----------------------------------------------------------------------------*/
  225. #define GPDMA_DMACSoftLBReq_Src(n) ((1UL << n) & 0xFFFF)
  226. #define GPDMA_DMACSoftLBReq_BITMASK 0xFFFF
  227. /*----------------------------------------------------------------------------*
  228. Macro defines for DMA Software Last Single Request register
  229. *----------------------------------------------------------------------------*/
  230. #define GPDMA_DMACSoftLSReq_Src(n) ((1UL << n) & 0xFFFF)
  231. #define GPDMA_DMACSoftLSReq_BITMASK 0xFFFF
  232. /*----------------------------------------------------------------------------*
  233. Macro defines for DMA Configuration register
  234. *----------------------------------------------------------------------------*/
  235. #define GPDMA_DMACConfig_E 0x01 /* DMA Controller enable*/
  236. #define GPDMA_DMACConfig_M 0x02 /* AHB Master endianness configuration*/
  237. #define GPDMA_DMACConfig_BITMASK 0x03
  238. /*----------------------------------------------------------------------------*
  239. Macro defines for DMA Synchronization register
  240. *----------------------------------------------------------------------------*/
  241. #define GPDMA_DMACSync_Src(n) ((1UL << n) & 0xFFFF)
  242. #define GPDMA_DMACSync_BITMASK 0xFFFF
  243. /*----------------------------------------------------------------------------*
  244. Macro defines for DMA Request Select register
  245. *----------------------------------------------------------------------------*/
  246. #define GPDMA_DMAReqSel_Input(n) ((1UL << (n - 8)) & 0xFF)
  247. #define GPDMA_DMAReqSel_BITMASK 0xFF
  248. /*----------------------------------------------------------------------------*
  249. Macro defines for DMA Channel Linker List Item registers
  250. *----------------------------------------------------------------------------*/
  251. #define GPDMA_DMACCxLLI_BITMASK 0xFFFFFFFC /* DMA Channel Linker List Item registers bit mask */
  252. /*----------------------------------------------------------------------------*
  253. Macro defines for DMA channel control registers
  254. *----------------------------------------------------------------------------*/
  255. #define GPDMA_DMACCxControl_TransferSize(n) ((n & 0xFFF) << 0) /* Transfer size*/
  256. #define GPDMA_DMACCxControl_SBSize(n) ((n & 0x07) << 12) /* Source burst size */
  257. #define GPDMA_DMACCxControl_DBSize(n) ((n & 0x07) << 15) /* Destination burst size */
  258. #define GPDMA_DMACCxControl_SWidth(n) ((n & 0x07) << 18) /* Source transfer width */
  259. #define GPDMA_DMACCxControl_DWidth(n) ((n & 0x07) << 21) /* Destination transfer width */
  260. #define GPDMA_DMACCxControl_SI (1UL << 26) /* Source increment */
  261. #define GPDMA_DMACCxControl_DI (1UL << 27) /* Destination increment */
  262. #define GPDMA_DMACCxControl_Prot1 (1UL << 28) /* Indicates that the access is in user mode or privileged mode */
  263. #define GPDMA_DMACCxControl_Prot2 (1UL << 29) /* Indicates that the access is bufferable or not bufferable */
  264. #define GPDMA_DMACCxControl_Prot3 (1UL << 30) /* Indicates that the access is cacheable or not cacheable */
  265. #define GPDMA_DMACCxControl_I (1UL << 31) /* Terminal count interrupt enable bit */
  266. #define GPDMA_DMACCxControl_BITMASK 0xFCFFFFFF /* DMA channel control registers bit mask */
  267. /*----------------------------------------------------------------------------*
  268. Macro defines for DMA Channel Configuration registers
  269. *----------------------------------------------------------------------------*/
  270. #define GPDMA_DMACCxConfig_E (1UL << 0) /* DMA control enable */
  271. #define GPDMA_DMACCxConfig_SrcPeripheral(n) ((n & 0x1F) << 1) /* Source peripheral */
  272. #define GPDMA_DMACCxConfig_DestPeripheral(n) ((n & 0x1F) << 6) /* Destination peripheral */
  273. #define GPDMA_DMACCxConfig_TransferType(n) ((n & 0x7) << 11) /* This value indicates the type of transfer */
  274. #define GPDMA_DMACCxConfig_IE (1UL << 14) /* Interrupt error mask */
  275. #define GPDMA_DMACCxConfig_ITC (1UL << 15) /* Terminal count interrupt mask */
  276. #define GPDMA_DMACCxConfig_L (1UL << 16) /* Lock */
  277. #define GPDMA_DMACCxConfig_A (1UL << 17) /* Active */
  278. #define GPDMA_DMACCxConfig_H (1UL << 18) /* Halt */
  279. #define GPDMA_DMACCxConfig_BITMASK 0x7FFFF /* DMA Channel Configuration registers bit mask */
  280. /*============================================================================*
  281. Type definitions
  282. *============================================================================*/
  283. /*----------------------------------------------------------------------------*
  284. GPDMA Status enumeration
  285. *----------------------------------------------------------------------------*/
  286. typedef enum {
  287. GPDMA_STAT_INT = 0x01, /* GPDMA Interrupt Status */
  288. GPDMA_STAT_INTTC = 0x02, /* GPDMA Interrupt Terminal Count Request Status */
  289. GPDMA_STAT_INTERR = 0x04, /* GPDMA Interrupt Error Status */
  290. GPDMA_STAT_RAWINTTC = 0x08, /* GPDMA Raw Interrupt Terminal Count Status */
  291. GPDMA_STAT_RAWINTERR = 0x10, /* GPDMA Raw Error Interrupt Status */
  292. GPDMA_STAT_ENABLED_CH = 0x20 /* GPDMA Enabled Channel Status */
  293. } gpdma_status_t;
  294. /*----------------------------------------------------------------------------*
  295. GPDMA Interrupt clear status enumeration
  296. *----------------------------------------------------------------------------*/
  297. typedef enum{
  298. GPDMA_STATCLR_INTTC, /* GPDMA Interrupt Terminal Count Request Clear */
  299. GPDMA_STATCLR_INTERR /* GPDMA Interrupt Error Clear */
  300. } gpdma_state_clear_t;
  301. /*----------------------------------------------------------------------------*
  302. GPDMA Channel info struct
  303. *----------------------------------------------------------------------------*/
  304. typedef struct {
  305. void (*handler) (int ch, uint32_t status, void *);
  306. void *arg;
  307. } gpdma_vector_t;
  308. /*----------------------------------------------------------------------------*
  309. GPDMA Channel configuration structure type definition
  310. *----------------------------------------------------------------------------*/
  311. typedef struct {
  312. uint32_t ch; /* DMA channel number, should be in
  313. range from 0 to 7.
  314. Note: DMA channel 0 has the highest priority
  315. and DMA channel 7 the lowest priority.
  316. */
  317. uint32_t transfer_size; /* Length/Size of transfer */
  318. uint32_t transfer_width;/* Transfer width - used for TransferType is GPDMA_TRANSFERTYPE_M2M only */
  319. uint32_t src_addr; /* Physical Source Address, used in case TransferType is chosen as
  320. GPDMA_TRANSFERTYPE_M2M or GPDMA_TRANSFERTYPE_M2P */
  321. uint32_t dst_addr; /* Physical Destination Address, used in case TransferType is chosen as
  322. GPDMA_TRANSFERTYPE_M2M or GPDMA_TRANSFERTYPE_P2M */
  323. uint32_t transfer_type; /* Transfer Type, should be one of the following:
  324. - GPDMA_TRANSFERTYPE_M2M: Memory to memory - DMA control
  325. - GPDMA_TRANSFERTYPE_M2P: Memory to peripheral - DMA control
  326. - GPDMA_TRANSFERTYPE_P2M: Peripheral to memory - DMA control
  327. - GPDMA_TRANSFERTYPE_P2P: Source peripheral to destination peripheral - DMA control
  328. */
  329. uint32_t src_conn; /* Peripheral Source Connection type, used in case TransferType is chosen as
  330. GPDMA_TRANSFERTYPE_P2M or GPDMA_TRANSFERTYPE_P2P, should be one of
  331. following:
  332. - GPDMA_CONN_SSP0_Tx: SSP0, Tx
  333. - GPDMA_CONN_SSP0_Rx: SSP0, Rx
  334. - GPDMA_CONN_SSP1_Tx: SSP1, Tx
  335. - GPDMA_CONN_SSP1_Rx: SSP1, Rx
  336. - GPDMA_CONN_ADC: ADC
  337. - GPDMA_CONN_I2S_Channel_0: I2S Channel 0
  338. - GPDMA_CONN_I2S_Channel_1: I2S Channel 1
  339. - GPDMA_CONN_DAC: DAC
  340. - GPDMA_CONN_UART0_Tx_MAT0_0: UART0 Tx / MAT0.0
  341. - GPDMA_CONN_UART0_Rx_MAT0_1: UART0 Rx / MAT0.1
  342. - GPDMA_CONN_UART1_Tx_MAT1_0: UART1 Tx / MAT1.0
  343. - GPDMA_CONN_UART1_Rx_MAT1_1: UART1 Rx / MAT1.1
  344. - GPDMA_CONN_UART2_Tx_MAT2_0: UART2 Tx / MAT2.0
  345. - GPDMA_CONN_UART2_Rx_MAT2_1: UART2 Rx / MAT2.1
  346. - GPDMA_CONN_UART3_Tx_MAT3_0: UART3 Tx / MAT3.0
  347. - GPDMA_CONN_UART3_Rx_MAT3_1: UART3 Rx / MAT3.1
  348. */
  349. uint32_t dst_conn; /* Peripheral Destination Connection type, used in case TransferType is chosen as
  350. GPDMA_TRANSFERTYPE_M2P or GPDMA_TRANSFERTYPE_P2P, should be one of
  351. following:
  352. - GPDMA_CONN_SSP0_Tx: SSP0, Tx
  353. - GPDMA_CONN_SSP0_Rx: SSP0, Rx
  354. - GPDMA_CONN_SSP1_Tx: SSP1, Tx
  355. - GPDMA_CONN_SSP1_Rx: SSP1, Rx
  356. - GPDMA_CONN_ADC: ADC
  357. - GPDMA_CONN_I2S_Channel_0: I2S Channel 0
  358. - GPDMA_CONN_I2S_Channel_1: I2S Channel 1
  359. - GPDMA_CONN_DAC: DAC
  360. - GPDMA_CONN_UART0_Tx_MAT0_0: UART0 Tx / MAT0.0
  361. - GPDMA_CONN_UART0_Rx_MAT0_1: UART0 Rx / MAT0.1
  362. - GPDMA_CONN_UART1_Tx_MAT1_0: UART1 Tx / MAT1.0
  363. - GPDMA_CONN_UART1_Rx_MAT1_1: UART1 Rx / MAT1.1
  364. - GPDMA_CONN_UART2_Tx_MAT2_0: UART2 Tx / MAT2.0
  365. - GPDMA_CONN_UART2_Rx_MAT2_1: UART2 Rx / MAT2.1
  366. - GPDMA_CONN_UART3_Tx_MAT3_0: UART3 Tx / MAT3.0
  367. - GPDMA_CONN_UART3_Rx_MAT3_1: UART3 Rx / MAT3.1
  368. */
  369. uint32_t dma_lli; /* Linker list item structure data address
  370. if there's no linker list, set as '0'
  371. */
  372. } gpdma_channel_cfg_t;
  373. /*----------------------------------------------------------------------------*
  374. GPDMA Linker List Item structure type definition
  375. *----------------------------------------------------------------------------*/
  376. typedef struct {
  377. uint32_t SrcAddr; /* Source Address */
  378. uint32_t DstAddr; /* Destination address */
  379. uint32_t NextLLI; /* Next LLI address, otherwise set to '0' */
  380. uint32_t Control; /* GPDMA Control of this LLI */
  381. } gpdma_lli_t;
  382. int Lpc17xxGPDMA_Init(void);
  383. int Lpc17xxGPDMA_Setup(gpdma_channel_cfg_t *ch_config, void (*handler) (int ch, uint32_t status, void *), void* arg);
  384. int Lpc17xxGPDMA_IntGetStatus(gpdma_status_t type, uint8_t ch);
  385. void Lpc17xxGPDMA_ClearIntPending(gpdma_state_clear_t type, uint8_t ch);
  386. void Lpc17xxGPDMA_ChannelCmd(uint8_t ch, int enabled);
  387. #endif /* _LPC17XX_GPDMA_H_ */