LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gpdma_17xx_40xx.h
Go to the documentation of this file.
1 /*
2  * @brief LPC17xx/40xx General Purpose DMA driver
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products. This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licensor disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights. NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers. This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 
32 #ifndef __GPDMA_17XX_40XX_H_
33 #define __GPDMA_17XX_40XX_H_
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
47 #define GPDMA_NUMBER_CHANNELS 8
48 #if defined(CHIP_LPC177X_8X) || defined(CHIP_LPC407X_8X)
49 
52 #define GPDMA_CONN_MEMORY ((0UL))
53 #define GPDMA_CONN_SDC ((1UL))
54 #define GPDMA_CONN_SSP0_Tx ((2UL))
55 #define GPDMA_CONN_SSP0_Rx ((3UL))
56 #define GPDMA_CONN_SSP1_Tx ((4UL))
57 #define GPDMA_CONN_SSP1_Rx ((5UL))
58 #define GPDMA_CONN_SSP2_Tx ((6UL))
59 #define GPDMA_CONN_SSP2_Rx ((7UL))
60 #define GPDMA_CONN_ADC ((8UL))
61 #define GPDMA_CONN_DAC ((9UL))
62 #define GPDMA_CONN_UART0_Tx ((10UL))
63 #define GPDMA_CONN_UART0_Rx ((11UL))
64 #define GPDMA_CONN_UART1_Tx ((12UL))
65 #define GPDMA_CONN_UART1_Rx ((13UL))
66 #define GPDMA_CONN_UART2_Tx ((14UL))
67 #define GPDMA_CONN_UART2_Rx ((15UL))
68 #define GPDMA_CONN_MAT0_0 ((16UL))
69 #define GPDMA_CONN_MAT0_1 ((17UL))
70 #define GPDMA_CONN_MAT1_0 ((18UL))
71 #define GPDMA_CONN_MAT1_1 ((19UL))
72 #define GPDMA_CONN_MAT2_0 ((20UL))
73 #define GPDMA_CONN_MAT2_1 ((21UL))
74 #define GPDMA_CONN_I2S_Channel_0 ((22UL))
75 #define GPDMA_CONN_I2S_Channel_1 ((23UL))
76 #define GPDMA_CONN_UART3_Tx ((26UL))
77 #define GPDMA_CONN_UART3_Rx ((27UL))
78 #define GPDMA_CONN_UART4_Tx ((28UL))
79 #define GPDMA_CONN_UART4_Rx ((29UL))
80 #define GPDMA_CONN_MAT3_0 ((30UL))
81 #define GPDMA_CONN_MAT3_1 ((31UL))
83 #elif defined(CHIP_LPC175X_6X)
84 #define GPDMA_CONN_SSP0_Tx ((0UL))
85 #define GPDMA_CONN_SSP0_Rx ((1UL))
86 #define GPDMA_CONN_SSP1_Tx ((2UL))
87 #define GPDMA_CONN_SSP1_Rx ((3UL))
88 #define GPDMA_CONN_ADC ((4UL))
89 #define GPDMA_CONN_I2S_Channel_0 ((5UL))
90 #define GPDMA_CONN_I2S_Channel_1 ((6UL))
91 #define GPDMA_CONN_DAC ((7UL))
92 #define GPDMA_CONN_UART0_Tx ((8UL))
93 #define GPDMA_CONN_UART0_Rx ((9UL))
94 #define GPDMA_CONN_UART1_Tx ((10UL))
95 #define GPDMA_CONN_UART1_Rx ((11UL))
96 #define GPDMA_CONN_UART2_Tx ((12UL))
97 #define GPDMA_CONN_UART2_Rx ((13UL))
98 #define GPDMA_CONN_UART3_Tx ((14UL))
99 #define GPDMA_CONN_UART3_Rx ((15UL))
100 #define GPDMA_CONN_MAT0_0 ((16UL))
101 #define GPDMA_CONN_MAT0_1 ((17UL))
102 #define GPDMA_CONN_MAT1_0 ((18UL))
103 #define GPDMA_CONN_MAT1_1 ((19UL))
104 #define GPDMA_CONN_MAT2_0 ((20UL))
105 #define GPDMA_CONN_MAT2_1 ((21UL))
106 #define GPDMA_CONN_MAT3_0 ((22UL))
107 #define GPDMA_CONN_MAT3_1 ((23UL))
108 #define GPDMA_CONN_MEMORY ((24UL))
109 #endif
110 
113 #define GPDMA_BSIZE_1 ((0UL))
114 #define GPDMA_BSIZE_4 ((1UL))
115 #define GPDMA_BSIZE_8 ((2UL))
116 #define GPDMA_BSIZE_16 ((3UL))
117 #define GPDMA_BSIZE_32 ((4UL))
118 #define GPDMA_BSIZE_64 ((5UL))
119 #define GPDMA_BSIZE_128 ((6UL))
120 #define GPDMA_BSIZE_256 ((7UL))
125 #define GPDMA_WIDTH_BYTE ((0UL))
126 #define GPDMA_WIDTH_HALFWORD ((1UL))
127 #define GPDMA_WIDTH_WORD ((2UL))
132 #define DMA_CONTROLLER 0
133 #define SRC_PER_CONTROLLER 1
134 #define DST_PER_CONTROLLER 2
139 typedef struct {
142 
146 typedef struct DMA_TransferDescriptor {
152 
167 {
168  return IP_GPDMA_IntGetStatus(pGPDMA, type, channel);
169 }
170 
181 {
182  IP_GPDMA_ClearIntPending(pGPDMA, type, channel);
183 }
184 
192 STATIC INLINE void Chip_GPDMA_ChannelCmd(LPC_GPDMA_T *pGPDMA, uint8_t channelNum, FunctionalState NewState)
193 {
194  IP_GPDMA_ChannelCmd(pGPDMA, channelNum, NewState);
195 }
196 
202 void Chip_GPDMA_Init(LPC_GPDMA_T *pGPDMA);
203 
209 void Chip_GPDMA_DeInit(LPC_GPDMA_T *pGPDMA);
210 
217 void Chip_DMA_Stop(LPC_GPDMA_T *pGPDMA, uint8_t ChannelNum);
218 
227 Status Chip_DMA_Interrupt(LPC_GPDMA_T *pGPDMA, uint8_t ChannelNum);
228 
235 uint8_t Chip_DMA_GetFreeChannel(LPC_GPDMA_T *pGPDMA,
236  uint32_t PeripheralConnection_ID);
237 
257  uint8_t ChannelNum,
258  uint32_t src,
259  uint32_t dst,
260  IP_GPDMA_FLOW_CONTROL_T TransferType,
261  uint32_t Size);
262 
272  uint8_t ChannelNum,
274  IP_GPDMA_FLOW_CONTROL_T TransferType);
275 
291  uint32_t src,
292  uint32_t dst,
293  uint32_t Size,
294  IP_GPDMA_FLOW_CONTROL_T TransferType,
295  const DMA_TransferDescriptor_t *NextDescriptor);
296 
311  GPDMA_Channel_CFG_T *GPDMACfg,
312  uint8_t ChannelNum,
313  uint32_t src,
314  uint32_t dst,
315  uint32_t Size,
316  IP_GPDMA_FLOW_CONTROL_T TransferType);
317 
322 #ifdef __cplusplus
323 }
324 #endif
325 
326 #endif /* __GPDMA_17XX_40XX_H_ */