CI130X SDK API手册  2.2.0
本手册用于描述CI130X SDK各个组件和驱动API
ci130x_dma.h
浏览该文件的文档.
1 
12 #ifndef __CI100X_DMAC_H
13 #define __CI100X_DMAC_H
14 
15 #include "ci130x_system.h"
16 #include "ci130x_dtrflash.h"
17 
18 
19 #ifdef __cplusplus
20 extern "C"{
21 #endif
22 
23 
24 #define GDMA_SDRAM_ADDR (0x70000000UL)
25 #define GDMA_SDRAM_SIZE (16*1024*1024)
26 
27 #define GDMA_CSRAM_ADDR (0x1FFF8000UL)
28 #define GDMA_CSRAM_SIZE (32*1024)
29 
30 #define GDMA_SRAM0_ADDR (0x1FFE8000UL)
31 #define GDMA_SRAM0_SIZE (64*1024)
32 
33 #define GDMA_SRAM1_ADDR (0x20000000UL)
34 #define GDMA_SRAM1_SIZE (64*1024)
35 
36 #define GDMA_PCMRAM_ADDR (0x20020000UL)
37 #define GDMA_PCMRAM_SIZE (16*1024)
38 
39 #define GDMA_FFTRAM_ADDR (0x200FF800UL)
40 #define GDMA_FFTRAM_SIZE (2*1024)
41 
52 typedef enum
53 {
56  // DMACChannel2 = 2,
57  // DMACChannel3 = 3,
58  // DMACChannel4 = 4,
59  // DMACChannel5 = 5,
60  // DMACChannel6 = 6,
61  // DMACChannel7 = 7,
64 
68 typedef enum
69 {
73 
77 typedef enum
78 {
81 }ENDIANMODE;
82 
86 typedef enum
87 {
88  INCREMENT = 1,
90 }INCREMENTx;
91 
95 typedef enum
96 {
101 
105 typedef enum
106 {
115 }BURSTSIZEx;
116 /*Programmable DMA burst size. You can programme the DMA burst size to
117 transfer data more efficiently. The burst size is usually set to half the size of the
118 FIFO in the peripheral.
119 Busrts do not cross the 1KB address boundary*/
120 
125 typedef enum
126 {
130 
135 typedef enum
136 {
139 }BUFFERABLEx;
140 
145 typedef enum
146 {
147  CACHEABLE = 1,
149 }CACHEABLEx;
150 
155 typedef enum
156 {
160 
165 typedef enum
166 {
167  M2M_DMA = 0,
168  M2P_DMA = 1,
169  P2M_DMA = 2,
170  // SP2DP_DMA = 3,
171  // SP2DP_DP = 4,
172  M2P_P = 5,
173  P2M_P = 6,
174  // SP2DP_SP = 7,
176 
181 typedef enum
182 {
184  // DMAC_Peripherals_SPI1_RX = 1,
185  // DMAC_Peripherals_SPI1_TX = 2,
186  // DMAC_Peripherals_QSPI2 = 3,
194 
199 typedef struct
200 {
213  unsigned short TransferSize;
214 }LLI_Control;
215 
216 #if SPIC_DMA_MODEFI
217 typedef struct
218 {
219  DMAC_FLOWCTRL flowctrl;
220  BURSTSIZEx busrtsize;
221  TRANSFERWIDTHx transferwidth;
222 }dma_config_temp;
223 
224 #else
225 
230 typedef struct
231 {
235  uint32_t srcaddr;
236  uint32_t destaddr;
237  uint32_t transfersize;
238 }dma_config_t;
239 #endif //#if SPIC_DMA_MODEFI
240 
245 typedef void (*dma_callback_func_ptr_t)(void);
246 
247 void clear_dma_translate_flag(DMACChannelx dmachannel);
248 int wait_dma_translate_flag(DMACChannelx dmachannel,uint32_t timeout);
249 //void dma_with_os_int(void);
250 void dma_without_os_int(void);
251 //void dma_int_event_group_init(void);
252 void dma_irq_handler(void);
253 
254 int DMAC_IntStatus(DMACChannelx dmachannel);
255 int DMAC_IntTCStatus(DMACChannelx dmachannel);
256 void DMAC_IntTCClear(DMACChannelx dmachannel);
257 int DMAC_IntErrorStatus(DMACChannelx dmachannel);
258 void DMAC_IntErrorClear(DMACChannelx dmachannel);
259 int DMAC_RawIntTCStatus(DMACChannelx dmachannel);
260 int DMAC_RawErrorIntStatus(DMACChannelx dmachannel);
261 int DMAC_ChannelEnableStatus(DMACChannelx dmachannel);
262 void DMAC_SoftwareBurstReq(DMACChannelx dmachannel);
263 void DMAC_SoftwareSingleReq(DMACChannelx dmachannel);
264 void DMAC_SoftwareLastBurstReq(DMACChannelx dmachannel);
266 void DMAC_Config(DMAC_AHBMasterx dmamaster,ENDIANMODE endianmode);
267 void DMAC_EN(FunctionalState cmd);
268 void DMAC_ChannelSoureAddr(DMACChannelx dmachannel,unsigned int addr);
269 void DMAC_ChannelDestAddr(DMACChannelx dmachannel,unsigned int addr);
270 void DMAC_ChannelLLI(DMACChannelx dmachannel,unsigned int dmalli,DMAC_AHBMasterx dmamaster);
272  DMAC_AHBMasterx dmamaster,TRANSFERWIDTHx transferwidth,BURSTSIZEx brustsize);
273 void DMAC_ChannelDestConfig(DMACChannelx dmachannel,INCREMENTx inc,\
274  DMAC_AHBMasterx dmamaster,TRANSFERWIDTHx transferwidth,BURSTSIZEx brustsize);
275 void DMAC_ChannelTCInt(DMACChannelx dmachannel,FunctionalState cmd);
276 void DMAC_ChannelProtectionConfig(DMACChannelx dmachannel,DMAC_ACCESS_MODE access_mode,\
277  BUFFERABLEx bufferable,CACHEABLEx cacheable);
278 void DMAC_ChannelTransferSize(DMACChannelx dmachannel,unsigned short size);
279 unsigned int DMAC_ChannelCurrentTransferSize( DMACChannelx dmachannel );
280 void DMAC_ChannelDisable(DMACChannelx dmachannel);
281 void DMAC_ChannelEnable(DMACChannelx dmachannel);
283  channelintmask,FunctionalState cmd);
285 void DMAC_ChannelHalt(DMACChannelx dmachannel,FunctionalState cmd);
286 void DMAC_ChannelConfig(DMACChannelx dmachannel,char destperiph,char srcperiph ,DMAC_FLOWCTRL flowctrl);
287 void DMAC_ChannelLock(DMACChannelx dmachannel,FunctionalState cmd);
288 void DMAC_M2MConfig(DMACChannelx dmachannel,unsigned int srcaddr,unsigned int destaddr,unsigned int bytesize,DMAC_AHBMasterx master);
289 
291  DMAC_FLOWCTRL flowctrl,unsigned int srcaddr,unsigned int destaddr,\
292  unsigned int bytesize,TRANSFERWIDTHx datawidth,BURSTSIZEx burstsize,DMAC_AHBMasterx master);
293 
294 void DMAC_M2P_P2MConfig(DMACChannelx dmachannel,DMAC_Peripherals periph,DMAC_FLOWCTRL flowctrl,\
295  unsigned int srcaddr,unsigned int destaddr,unsigned int bytesize);
296 //void DMAC_P2PConfig(DMACChannelx dmachannel,DMAC_Peripherals srcperiph,DMAC_Peripherals destperiph,unsigned int bytesize);
297 #if SPIC_DMA_MODEFI
298 void spic_dma_stady_init(DMACChannelx channel);
299 void spic_dma_transfer_config(uint32_t srcaddr, uint32_t destaddr, uint32_t transfersize);
300 #else
301 void spic_dma_config(DMACChannelx channel,dma_config_t* config);
302 #endif
303 unsigned int DMAC_LLIContrlreturn(LLI_Control* lli_ctrl);
304 void DMAC_ChannelLLIControl(DMACChannelx dmachannel,unsigned int val);
305 
308 #ifdef __cplusplus
309 }
310 #endif
311 
312 #endif /*__CI130X_DMA_H*/
INCREMENTx SrcInc
Definition: ci130x_dma.h:206
Definition: ci130x_dma.h:189
int DMAC_IntErrorStatus(DMACChannelx dmachannel)
DMA通道传输错误中断状态
Definition: ci130x_dma.c:225
Definition: ci130x_dma.h:110
void DMAC_M2P_P2MConfig(DMACChannelx dmachannel, DMAC_Peripherals periph, DMAC_FLOWCTRL flowctrl, unsigned int srcaddr, unsigned int destaddr, unsigned int bytesize)
DMA通道传输 内存到外设,外设到内存
Definition: ci130x_dma.c:727
int wait_dma_translate_flag(DMACChannelx dmachannel, uint32_t timeout)
等待dma中断标志
Definition: ci130x_dma.c:60
Definition: ci130x_dma.h:55
void clear_dma_translate_flag(DMACChannelx dmachannel)
清除dma中断标志
Definition: ci130x_dma.c:45
Definition: ci130x_dma.h:137
void DMAC_M2P_P2M_advance_config(DMACChannelx dmachannel, DMAC_Peripherals periph, DMAC_FLOWCTRL flowctrl, unsigned int srcaddr, unsigned int destaddr, unsigned int bytesize, TRANSFERWIDTHx datawidth, BURSTSIZEx burstsize, DMAC_AHBMasterx master)
DMA通道传输 内存到外设,外设到内存
Definition: ci130x_dma.c:664
Definition: ci130x_dma.h:168
uint32_t destaddr
Definition: ci130x_dma.h:236
void DMAC_ChannelDestConfig(DMACChannelx dmachannel, INCREMENTx inc, DMAC_AHBMasterx dmamaster, TRANSFERWIDTHx transferwidth, BURSTSIZEx brustsize)
DMA通道目标的相关配置
Definition: ci130x_dma.c:416
void DMAC_ChannelPowerDown(DMACChannelx dmachannel, FunctionalState cmd)
DMA通道传输Power控制
Definition: ci130x_dma.c:590
Definition: ci130x_dma.h:79
DMAC_AHBMasterx SrcMaster
Definition: ci130x_dma.h:208
Definition: ci130x_dma.h:127
void DMAC_ChannelTransferSize(DMACChannelx dmachannel, unsigned short size)
DMA通道传输大小配置
Definition: ci130x_dma.c:464
void(* dma_callback_func_ptr_t)(void)
dma完成回调函数指针
Definition: ci130x_dma.h:245
DMAC_ACCESS_MODE
DMA的访问模式选择
Definition: ci130x_dma.h:125
BURSTSIZEx DestBurstSize
Definition: ci130x_dma.h:211
unsigned short TransferSize
Definition: ci130x_dma.h:213
Definition: ci130x_dma.h:114
TRANSFERWIDTHx transferwidth
Definition: ci130x_dma.h:234
Definition: ci130x_dma.h:173
Definition: ci130x_dma.h:190
Definition: ci130x_dma.h:108
uint32_t transfersize
Definition: ci130x_dma.h:237
Definition: ci130x_dma.h:188
BURSTSIZEx
DMA 突发传输大小选择
Definition: ci130x_dma.h:105
void DMAC_ChannelDestAddr(DMACChannelx dmachannel, unsigned int addr)
DMA通道目标地址配置
Definition: ci130x_dma.c:373
void dma_irq_handler(void)
DMA中断处理函数
Definition: ci130x_dma.c:171
void DMAC_SoftwareLastBurstReq(DMACChannelx dmachannel)
DMA通道软件最后一次突发传输请求
Definition: ci130x_dma.c:305
Definition: ci130x_dma.h:187
BUFFERABLEx BufferAble
Definition: ci130x_dma.h:203
Definition: ci130x_dma.h:54
Definition: ci130x_dma.h:71
Definition: ci130x_dma.h:113
Definition: ci130x_dma.h:107
Definition: ci130x_dma.h:157
void DMAC_ChannelLLIControl(DMACChannelx dmachannel, unsigned int val)
DMA配置控制寄存器
Definition: ci130x_dma.c:780
Definition: ci130x_dma.h:147
DMAC_FLOWCTRL
DMA的传输方向选择
Definition: ci130x_dma.h:165
Definition: ci130x_dma.h:191
TRANSFERWIDTHx
DMA 数据宽度选择
Definition: ci130x_dma.h:95
Definition: ci130x_dma.h:88
void spic_dma_config(DMACChannelx channel, dma_config_t *config)
配置FLASH的DMA传输
Definition: ci130x_dma.c:1048
Definition: ci130x_dma.h:183
void DMAC_ChannelSourceConfig(DMACChannelx dmachannel, INCREMENTx inc, DMAC_AHBMasterx dmamaster, TRANSFERWIDTHx transferwidth, BURSTSIZEx brustsize)
DMA通道源的相关配置
Definition: ci130x_dma.c:398
void DMAC_ChannelHalt(DMACChannelx dmachannel, FunctionalState cmd)
DMA通道传输(中停)Halt
Definition: ci130x_dma.c:572
Definition: ci130x_dma.h:148
void DMAC_ChannelInterruptMask(DMACChannelx dmachannel, CHANNELINTMASKx channelintmask, FunctionalState cmd)
DMA通道中断屏蔽配置
Definition: ci130x_dma.c:521
Definition: ci130x_dma.h:158
void DMAC_ChannelProtectionConfig(DMACChannelx dmachannel, DMAC_ACCESS_MODE access_mode, BUFFERABLEx bufferable, CACHEABLEx cacheable)
DMA通道保护位的设置
Definition: ci130x_dma.c:451
unsigned int DMAC_ChannelCurrentTransferSize(DMACChannelx dmachannel)
当前DMA通道,还剩余多少数据尚未传输,以字节为单位
Definition: ci130x_dma.c:482
Definition: ci130x_dma.h:62
uint32_t srcaddr
Definition: ci130x_dma.h:235
FLASH的DMA传输配置结构体
Definition: ci130x_dma.h:230
void DMAC_EN(FunctionalState cmd)
DMA控制器使能
Definition: ci130x_dma.c:337
void DMAC_ChannelLLI(DMACChannelx dmachannel, unsigned int dmalli, DMAC_AHBMasterx dmamaster)
DMA通道 LLI 配置
Definition: ci130x_dma.c:384
CACHEABLEx
DMA的cache缓冲配置选择
Definition: ci130x_dma.h:145
void DMAC_ChannelEnable(DMACChannelx dmachannel)
DMA通道传输使能
Definition: ci130x_dma.c:508
BURSTSIZEx busrtsize
Definition: ci130x_dma.h:233
Definition: ci130x_dma.h:98
DMAC_ACCESS_MODE AccessMode
Definition: ci130x_dma.h:204
Definition: ci130x_dma.h:80
DMAC_AHBMasterx DestMaster
Definition: ci130x_dma.h:207
void DMAC_Config(DMAC_AHBMasterx dmamaster, ENDIANMODE endianmode)
DMA控制器AHB MASTER 字节端序的配置
Definition: ci130x_dma.c:326
void DMAC_ChannelDisable(DMACChannelx dmachannel)
DMA通道传输禁止
Definition: ci130x_dma.c:495
void DMAC_IntErrorClear(DMACChannelx dmachannel)
清除DMA通道传输错误中断状态
Definition: ci130x_dma.c:235
void dma_without_os_int(void)
使用全局变量设置中断触发状态,并清除中断
Definition: ci130x_dma.c:84
Definition: ci130x_dma.h:128
DMAC_AHBMasterx
DMA master选择
Definition: ci130x_dma.h:68
void DMAC_ChannelTCInt(DMACChannelx dmachannel, FunctionalState cmd)
DMA通道传输完成中断使能配置
Definition: ci130x_dma.c:431
DMACChannelx
DMA 通道选择
Definition: ci130x_dma.h:52
DMA的链表传输配置结构体
Definition: ci130x_dma.h:199
void DMAC_IntTCClear(DMACChannelx dmachannel)
清除DMA通道传输完成中断状态
Definition: ci130x_dma.c:207
Definition: ci130x_dma.h:169
INCREMENTx DestInc
Definition: ci130x_dma.h:205
Definition: ci130x_dma.h:192
chip级定义
INCREMENTx
DMA 地址递增选择
Definition: ci130x_dma.h:86
Definition: ci130x_dma.h:99
Definition: ci130x_dma.h:70
DMAC_FLOWCTRL flowctrl
Definition: ci130x_dma.h:232
Definition: ci130x_dma.h:89
BUFFERABLEx
DMA的缓冲配置选择
Definition: ci130x_dma.h:135
void DMAC_ChannelConfig(DMACChannelx dmachannel, char destperiph, char srcperiph, DMAC_FLOWCTRL flowctrl)
DMA通道其他相关配置
Definition: ci130x_dma.c:541
int DMAC_IntStatus(DMACChannelx dmachannel)
DMA通道屏蔽后的中断状态(只要有通道传输完成中断或者通道传输错误中断的一个)
Definition: ci130x_dma.c:186
void DMAC_SoftwareSingleReq(DMACChannelx dmachannel)
DMA通道软件单次传输请求
Definition: ci130x_dma.c:295
Definition: ci130x_dma.h:172
void DMAC_ChannelSoureAddr(DMACChannelx dmachannel, unsigned int addr)
DMA通道源地址配置
Definition: ci130x_dma.c:362
Definition: ci130x_dma.h:109
FunctionalState TCInt
Definition: ci130x_dma.h:201
int DMAC_RawIntTCStatus(DMACChannelx dmachannel)
DMA通道原始的(屏蔽前)中断状态(只要有通道传输完成中断或者通道传输错误中断的一个)
Definition: ci130x_dma.c:253
FunctionalState
Definition: ci130x_system.h:86
CHANNELINTMASKx
DMA的中断选择
Definition: ci130x_dma.h:155
ENDIANMODE
DMA 数据大小端选择
Definition: ci130x_dma.h:77
Definition: ci130x_dma.h:167
TRANSFERWIDTHx SrcTransferWidth
Definition: ci130x_dma.h:210
DMAC_Peripherals
DMA的外设选择
Definition: ci130x_dma.h:181
TRANSFERWIDTHx DestTransferWidth
Definition: ci130x_dma.h:209
void DMAC_ChannelLock(DMACChannelx dmachannel, FunctionalState cmd)
DMA通道传输锁
Definition: ci130x_dma.c:554
Definition: ci130x_dma.h:138
int DMAC_IntTCStatus(DMACChannelx dmachannel)
DMA通道传输完成中断状态
Definition: ci130x_dma.c:197
BURSTSIZEx SrcBurstSize
Definition: ci130x_dma.h:212
int DMAC_RawErrorIntStatus(DMACChannelx dmachannel)
DMA通道传输错误原始(屏蔽前)中断状态
Definition: ci130x_dma.c:264
unsigned int DMAC_LLIContrlreturn(LLI_Control *lli_ctrl)
DMA 链表配置结构体初始化
Definition: ci130x_dma.c:827
void DMAC_SoftwareLastSingleReq(DMACChannelx dmachannel)
DMA通道软件最后一次单次传输请求
Definition: ci130x_dma.c:315
void DMAC_SoftwareBurstReq(DMACChannelx dmachannel)
DMA通道软件突发传输请求
Definition: ci130x_dma.c:285
Definition: ci130x_dma.h:112
void DMAC_M2MConfig(DMACChannelx dmachannel, unsigned int srcaddr, unsigned int destaddr, unsigned int bytesize, DMAC_AHBMasterx master)
DMA通道传输 内存到内存
Definition: ci130x_dma.c:612
Definition: ci130x_dma.h:97
int DMAC_ChannelEnableStatus(DMACChannelx dmachannel)
DMA通道使能状态
Definition: ci130x_dma.c:275
Definition: ci130x_dma.h:111
CACHEABLEx CacheAble
Definition: ci130x_dma.h:202