| NUC472_NUC442_BSP V3.03.003 The Board Support Package for NUC472/NUC442

pdma.h
Go to the documentation of this file.
1/**************************************************************************/
12#ifndef __PDMA_H__
13#define __PDMA_H__
14
15#ifdef __cplusplus
16 extern "C"
17{
18#endif
19
20
32#define PDMA_CH_MAX 16
34/*---------------------------------------------------------------------------------------------------------*/
35/* operation Mode Constant Definitions */
36/*---------------------------------------------------------------------------------------------------------*/
37#define PDMA_OP_STOP 0x00000000UL
38#define PDMA_OP_BASIC 0x00000001UL
39#define PDMA_OP_SCATTER 0x00000002UL
41/*---------------------------------------------------------------------------------------------------------*/
42/* Data Width Constant Definitions */
43/*---------------------------------------------------------------------------------------------------------*/
44#define PDMA_WIDTH_8 0x00000000UL
45#define PDMA_WIDTH_16 0x00001000UL
46#define PDMA_WIDTH_32 0x00002000UL
48/*---------------------------------------------------------------------------------------------------------*/
49/* Address Attribute Constant Definitions */
50/*---------------------------------------------------------------------------------------------------------*/
51#define PDMA_SAR_INC 0x00000000UL
52#define PDMA_SAR_FIX 0x00000300UL
53#define PDMA_DAR_INC 0x00000000UL
54#define PDMA_DAR_FIX 0x00000C00UL
56/*---------------------------------------------------------------------------------------------------------*/
57/* Burst Mode Constant Definitions */
58/*---------------------------------------------------------------------------------------------------------*/
59#define PDMA_REQ_SINGLE 0x00000004UL
60#define PDMA_REQ_BURST 0x00000000UL
62#define PDMA_BURST_128 0x00000000UL
63#define PDMA_BURST_64 0x00000010UL
64#define PDMA_BURST_32 0x00000020UL
65#define PDMA_BURST_16 0x00000030UL
66#define PDMA_BURST_8 0x00000040UL
67#define PDMA_BURST_4 0x00000050UL
68#define PDMA_BURST_2 0x00000060UL
69#define PDMA_BURST_1 0x00000070UL
71/*---------------------------------------------------------------------------------------------------------*/
72/* Peripheral Transfer Mode Constant Definitions */
73/*---------------------------------------------------------------------------------------------------------*/
74#define PDMA_SPI0_TX 0x00000000UL
75#define PDMA_SPI1_TX 0x00000001UL
76#define PDMA_SPI2_TX 0x00000002UL
77#define PDMA_SPI3_TX 0x00000003UL
78#define PDMA_UART0_TX 0x00000004UL
79#define PDMA_UART1_TX 0x00000005UL
80#define PDMA_UART2_TX 0x00000006UL
81#define PDMA_UART3_TX 0x00000007UL
82#define PDMA_UART4_TX 0x00000008UL
83#define PDMA_UART5_TX 0x00000009UL
84#define PDMA_I2S0_TX 0x0000000BUL
85#define PDMA_I2S1_TX 0x0000000CUL
86#define PDMA_SPI0_RX 0x0000000DUL
87#define PDMA_SPI1_RX 0x0000000EUL
88#define PDMA_SPI2_RX 0x0000000FUL
89#define PDMA_SPI3_RX 0x00000010UL
90#define PDMA_UART0_RX 0x00000011UL
91#define PDMA_UART1_RX 0x00000012UL
92#define PDMA_UART2_RX 0x00000013UL
93#define PDMA_UART3_RX 0x00000014UL
94#define PDMA_UART4_RX 0x00000015UL
95#define PDMA_UART5_RX 0x00000016UL
96#define PDMA_ADC 0x00000018UL
97#define PDMA_I2S0_RX 0x00000019UL
98#define PDMA_I2S1_RX 0x0000001AUL
99#define PDMA_MEM 0x0000001FUL /* end of group NUC472_442_PDMA_EXPORTED_CONSTANTS */
102
117#define PDMA_GET_INT_STATUS() ((uint32_t)(PDMA->INTSTS))
118
129#define PDMA_GET_TD_STS() ((uint32_t)(PDMA->TDSTS))
130
141#define PDMA_CLR_TD_FLAG(u32Mask) ((uint32_t)(PDMA->TDSTS = u32Mask))
142
153#define PDMA_GET_ABORT_STS() ((uint32_t)(PDMA->ABTSTS))
154
165#define PDMA_CLR_ABORT_FLAG(u32Mask) ((uint32_t)(PDMA->ABTSTS = u32Mask))
166
177#define PDMA_GET_EMPTY_STS() ((uint32_t)(PDMA->SCATSTS))
178
189#define PDMA_CLR_EMPTY_FLAG(u32Mask) ((uint32_t)(PDMA->SCATSTS = u32Mask))
190
191
202#define PDMA_IS_CH_BUSY(u32Ch) ((uint32_t)(PDMA->TRGSTS & (1 << u32Ch))? 1 : 0)
203
215#define PDMA_SET_SRC_ADDR(u32Ch, u32Addr) ((uint32_t)(PDMA->DSCT[u32Ch].ENDSA = u32Addr))
216
228#define PDMA_SET_DST_ADDR(u32Ch, u32Addr) ((uint32_t)(PDMA->DSCT[u32Ch].ENDDA = u32Addr))
229
241#define PDMA_SET_TRANS_CNT(u32Ch, u32Count) ((uint32_t)(PDMA->DSCT[u32Ch].CTL=(PDMA->DSCT[u32Ch].CTL&~PDMA_DSCT_CTL_TXCNT_Msk)|((u32Count-1) << PDMA_DSCT_CTL_TXCNT_Pos))
242
254#define PDMA_SET_SCATTER_DESC(u32Ch, u32Addr) ((uint32_t)(PDMA->DSCT[u32Ch].NEXT = u32Addr - (PDMA->SCATBA)))
255
266#define PDMA_STOP(u32Ch) ((uint32_t)(PDMA->STOP = (1 << u32Ch)))
267
268
269
270 void PDMA_Open(uint32_t u32Mask);
271 void PDMA_Close(void);
272 void PDMA_SetTransferCnt(uint32_t u32Ch, uint32_t u32Width, uint32_t u32TransCount);
273 void PDMA_SetTransferAddr(uint32_t u32Ch, uint32_t u32SrcAddr, uint32_t u32SrcCtrl, uint32_t u32DstAddr, uint32_t u32DstCtrl);
274 void PDMA_SetTransferMode(uint32_t u32Ch, uint32_t u32Periphral, uint32_t u32ScatterEn, uint32_t u32DescAddr);
275 void PDMA_SetBurstType(uint32_t u32Ch, uint32_t u32BurstType, uint32_t u32BurstSize);
276 void PDMA_Trigger(uint32_t u32Ch);
277 void PDMA_EnableInt(uint32_t u32Ch, uint32_t u32Mask);
278 void PDMA_DisableInt(uint32_t u32Ch, uint32_t u32Mask);
279
280
281 /* end of group NUC472_442_PDMA_EXPORTED_FUNCTIONS */
283 /* end of group NUC472_442_PDMA_Driver */
285 /* end of group NUC472_442_Device_Driver */
287
288#ifdef __cplusplus
289}
290#endif
291
292#endif //__PDMA_H__
293
294/*** (C) COPYRIGHT 2013 Nuvoton Technology Corp. ***/
PDMA_SetTransferAddr
void PDMA_SetTransferAddr(uint32_t u32Ch, uint32_t u32SrcAddr, uint32_t u32SrcCtrl, uint32_t u32DstAddr, uint32_t u32DstCtrl)
Set PDMA Transfer Address.
Definition: pdma.c:96
PDMA_Trigger
void PDMA_Trigger(uint32_t u32Ch)
Trigger PDMA.
Definition: pdma.c:209
PDMA_EnableInt
void PDMA_EnableInt(uint32_t u32Ch, uint32_t u32Mask)
Enable Interrupt.
Definition: pdma.c:225
PDMA_Open
void PDMA_Open(uint32_t u32Mask)
PDMA Open.
Definition: pdma.c:39
PDMA_Close
void PDMA_Close(void)
PDMA Close.
Definition: pdma.c:61
PDMA_DisableInt
void PDMA_DisableInt(uint32_t u32Ch, uint32_t u32Mask)
Disable Interrupt.
Definition: pdma.c:240
PDMA_SetTransferMode
void PDMA_SetTransferMode(uint32_t u32Ch, uint32_t u32Periphral, uint32_t u32ScatterEn, uint32_t u32DescAddr)
Set PDMA Transfer Mode.
Definition: pdma.c:116
PDMA_SetBurstType
void PDMA_SetBurstType(uint32_t u32Ch, uint32_t u32BurstType, uint32_t u32BurstSize)
Set PDMA Burst Type.
Definition: pdma.c:193
PDMA_SetTransferCnt
void PDMA_SetTransferCnt(uint32_t u32Ch, uint32_t u32Width, uint32_t u32TransCount)
Set PDMA Transfer Count.
Definition: pdma.c:77