1 |
577 |
jeremybenn |
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
|
2 |
|
|
* File Name : template.h
|
3 |
|
|
* Author : MCD Application Team
|
4 |
|
|
* Date First Issued : 05/18/2006 : Version 1.0
|
5 |
|
|
* Description : provide a short description of the source file indicating
|
6 |
|
|
* its purpose.
|
7 |
|
|
********************************************************************************
|
8 |
|
|
* History:
|
9 |
|
|
* 05/24/2006 : Version 1.1
|
10 |
|
|
* 05/18/2006 : Version 1.0
|
11 |
|
|
********************************************************************************
|
12 |
|
|
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
13 |
|
|
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
14 |
|
|
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
15 |
|
|
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
16 |
|
|
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
17 |
|
|
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
18 |
|
|
*******************************************************************************/
|
19 |
|
|
|
20 |
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
21 |
|
|
#ifndef __91x_DMA_H
|
22 |
|
|
#define __91x_DMA_H
|
23 |
|
|
|
24 |
|
|
/* Includes ------------------------------------------------------------------*/
|
25 |
|
|
#include"91x_map.h"
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
/* Exported types ------------------------------------------------------------*/
|
29 |
|
|
|
30 |
|
|
typedef struct
|
31 |
|
|
{
|
32 |
|
|
u32 DMA_Channel_SrcAdd; /* The current source address (byte-aligned) of the data to be transferred.*/
|
33 |
|
|
|
34 |
|
|
u32 DMA_Channel_DesAdd; /* The current destination address (byte-aligned) of the data to be transferred.*/
|
35 |
|
|
|
36 |
|
|
u32 DMA_Channel_LLstItm; /* The word- aligned address for the next Linked List Item. */
|
37 |
|
|
|
38 |
|
|
u32 DMA_Channel_DesWidth; /* Destination transfer width. */
|
39 |
|
|
|
40 |
|
|
u32 DMA_Channel_SrcWidth; /* Source transfer width. */
|
41 |
|
|
|
42 |
|
|
u32 DMA_Channel_DesBstSize; /* The destination burst size which indicates the number of transfers that make up a destination burst transfer request.*/
|
43 |
|
|
|
44 |
|
|
u32 DMA_Channel_SrcBstSize; /* The source burst size.Indicates the number of transfers that make up a source burst */
|
45 |
|
|
|
46 |
|
|
u32 DMA_Channel_TrsfSize; /* Transfer size which indicates the size of the transfer when the DMA controller is the flow controller*/
|
47 |
|
|
|
48 |
|
|
u32 DMA_Channel_FlowCntrl; /* Flow control and transfer type. */
|
49 |
|
|
|
50 |
|
|
u32 DMA_Channel_Src; /* Source peripheral: selects the DMA source request peripheral. */
|
51 |
|
|
|
52 |
|
|
u32 DMA_Channel_Des; /* Destination peripheral:selects the DMA destination request peripheral. */
|
53 |
|
|
|
54 |
|
|
} DMA_InitTypeDef;
|
55 |
|
|
|
56 |
|
|
/* Exported constants --------------------------------------------------------*/
|
57 |
|
|
|
58 |
|
|
/* Interrupts masks */
|
59 |
|
|
|
60 |
|
|
#define DMA_ITMask_IE 0x4000 /* Interrupt error mask. */
|
61 |
|
|
#define DMA_ITMask_ITC 0x8000 /* Terminal count interrupt mask.*/
|
62 |
|
|
#define DMA_ITMask_ALL 0xC000 /* All DMA_Channelx interrupts enable/disable mask*/
|
63 |
|
|
|
64 |
|
|
/* Sources Request (used as masks) */
|
65 |
|
|
|
66 |
|
|
#define DMA_USB_RX_Mask 0x0001
|
67 |
|
|
#define DMA_USB_TX_Mask 0x0002
|
68 |
|
|
#define DMA_TIM0_Mask 0x0004
|
69 |
|
|
#define DMA_TIM1_Mask 0x0008
|
70 |
|
|
#define DMA_UART0_RX_Mask 0x0010
|
71 |
|
|
#define DMA_UART0_TX_Mask 0x0020
|
72 |
|
|
#define DMA_UART1_RX_Mask 0x0040
|
73 |
|
|
#define DMA_UART1_TX_Mask 0x0080
|
74 |
|
|
#define DMA_External_Req0_Mask 0x0100
|
75 |
|
|
#define DMA_External_Req1_Mask 0x0200
|
76 |
|
|
#define DMA_I2C0_Mask 0x0400
|
77 |
|
|
#define DMA_I2C1_Mask 0x0800
|
78 |
|
|
#define DMA_SSP0_RX_Mask 0x1000
|
79 |
|
|
#define DMA_SSP0_TX_Mask 0x2000
|
80 |
|
|
#define DMA_SSP1_RX_Mask 0x4000
|
81 |
|
|
#define DMA_SSP1_TX_Mask 0x8000
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
/* Previleged Mode and user mode */
|
85 |
|
|
|
86 |
|
|
#define DMA_PrevilegedMode 0x10000000
|
87 |
|
|
#define DMA_UserMode 0xEFFFFFFF
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
/* Error and Terminal Count interrupts Status, after and before"raw" masking */
|
91 |
|
|
#define DMA_IS 0x01
|
92 |
|
|
#define DMA_TCS 0x02
|
93 |
|
|
#define DMA_ES 0x03
|
94 |
|
|
#define DMA_TCRS 0x04
|
95 |
|
|
#define DMA_ERS 0x05
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
/* interrupt clear: Terminal Count flag Clear and Error flag clear*/
|
99 |
|
|
|
100 |
|
|
#define DMA_TCC 0x01
|
101 |
|
|
#define DMA_EC 0x02
|
102 |
|
|
|
103 |
|
|
/* channel index "0...7"*/
|
104 |
|
|
|
105 |
|
|
#define Channel0 0
|
106 |
|
|
#define Channel1 1
|
107 |
|
|
#define Channel2 2
|
108 |
|
|
#define Channel3 3
|
109 |
|
|
#define Channel4 4
|
110 |
|
|
#define Channel5 5
|
111 |
|
|
#define Channel6 6
|
112 |
|
|
#define Channel7 7
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
/* Destination request selection: selects the DMA Destination request peripheral */
|
117 |
|
|
|
118 |
|
|
#define DMA_DES_USB_RX 0x00
|
119 |
|
|
#define DMA_DES_USB_TX 0x40
|
120 |
|
|
#define DMA_DES_TIM1 0x80
|
121 |
|
|
#define DMA_DES_TIM2 0xC0
|
122 |
|
|
#define DMA_DES_UART0_RX 0x100
|
123 |
|
|
#define DMA_DES_UART0_TX 0x140
|
124 |
|
|
#define DMA_DES_UART1_RX 0x180
|
125 |
|
|
#define DMA_DES_UART1_TX 0x1C0
|
126 |
|
|
#define DMA_DES_External_Req0 0x200
|
127 |
|
|
#define DMA_DES_External_Req1 0x240
|
128 |
|
|
#define DMA_DES_I2C0 0x280
|
129 |
|
|
#define DMA_DES_I2C1 0x2C0
|
130 |
|
|
#define DMA_DES_SSP0_RX 0x300
|
131 |
|
|
#define DMA_DES_SSP0_TX 0x340
|
132 |
|
|
#define DMA_DES_SSP1_RX 0x380
|
133 |
|
|
#define DMA_DES_SSP1_TX 0x3C0
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
|
138 |
|
|
/* Source request selection: selects the DMA Source request peripheral */
|
139 |
|
|
|
140 |
|
|
#define DMA_SRC_USB_RX 0x00
|
141 |
|
|
#define DMA_SRC_USB_TX 0x02
|
142 |
|
|
#define DMA_SRC_TIM1 0x04
|
143 |
|
|
#define DMA_SRC_TIM2 0x06
|
144 |
|
|
#define DMA_SRC_UART0_RX 0x08
|
145 |
|
|
#define DMA_SRC_UART0_TX 0x0A
|
146 |
|
|
#define DMA_SRC_UART1_RX 0x0C
|
147 |
|
|
#define DMA_SRC_UART1_TX 0x0E
|
148 |
|
|
#define DMA_SRC_External_Req0 0x10
|
149 |
|
|
#define DMA_SRC_External_Req1 0x12
|
150 |
|
|
#define DMA_SRC_I2C0 0x14
|
151 |
|
|
#define DMA_SRC_I2C1 0x16
|
152 |
|
|
#define DMA_SRC_SSP0_RX 0x18
|
153 |
|
|
#define DMA_SRC_SSP0_TX 0x1A
|
154 |
|
|
#define DMA_SRC_SSP1_RX 0x1C
|
155 |
|
|
#define DMA_SRC_SSP1_TX 0x1E
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
|
161 |
|
|
#define DMA_FlowCntrlt0_DMA 0x00000000 /* transfer type :Memory-to-memory, flow controller:DMA */
|
162 |
|
|
#define DMA_FlowCntrl1_DMA 0x00000800 /* transfer type :Memory-to-peripheral, flow controller:DMA */
|
163 |
|
|
#define DMA_FlowCntrl2_DMA 0x00001000 /* transfer type :Peripheral-to-memory, flow controller:DMA */
|
164 |
|
|
#define DMA_FlowCntrl3_DMA 0x00001800 /* transfer type :Source peripheral-to-destination peripheral, flow controller:DMA */
|
165 |
|
|
#define DMA_FlowCntrl_DestPerip 0x00002000 /* transfer type :Source peripheral-to-destination peripheral, flow controller:Destination peripheral */
|
166 |
|
|
#define DMA_FlowCntrl_Perip1 0x00002800 /* transfer type :Memory-to-peripheral, flow controller:peripheral */
|
167 |
|
|
#define DMA_FlowCntrl_Perip2 0x00003000 /* transfer type : Peripheral-to-memory, flow controller:peripheral */
|
168 |
|
|
#define DMA_FlowCntrl_SrcPerip 0x00003800 /* transfer type :Source peripheral-to-destination peripheral, flow controller:Source peripheral */
|
169 |
|
|
|
170 |
|
|
|
171 |
|
|
|
172 |
|
|
|
173 |
|
|
#define DMA_SrcBst_1Data 0x00000000 /* Source Burst transfer request IS 1 Data ( DATA = Source transfer width ) */
|
174 |
|
|
#define DMA_SrcBst_4Data 0x00001000 /* Source Burst transfer request IS 4 Data */
|
175 |
|
|
#define DMA_SrcBst_8Data 0x00002000 /* Source Burst transfer request IS 8 Data */
|
176 |
|
|
#define DMA_SrcBst_16Data 0x00003000 /* Source Burst transfer request IS 16 Data */
|
177 |
|
|
#define DMA_SrcBst_32Data 0x00004000 /* Source Burst transfer request IS 32 Data */
|
178 |
|
|
#define DMA_SrcBst_64Data 0x00005000 /* Source Burst transfer request IS 64Data */
|
179 |
|
|
#define DMA_SrcBst_128Data 0x00006000 /* Source Burst transfer request IS 128 Data */
|
180 |
|
|
#define DMA_SrcBst_256Data 0x00007000 /* Source Burst transfer request IS 256 Data */
|
181 |
|
|
|
182 |
|
|
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
#define DMA_DesBst_1Data 0x00000000 /*Destination Burst transfer request IS 1Data ( DATA = destination transfer width ) */
|
186 |
|
|
#define DMA_DesBst_4Data 0x00008000 /*Destination Burst transfer request IS 1 Data */
|
187 |
|
|
#define DMA_DesBst_8Data 0x00010000 /*Destination Burst transfer request IS 4 Data */
|
188 |
|
|
#define DMA_DesBst_16Data 0x00018000 /*Destination Burst transfer request IS 8 Data */
|
189 |
|
|
#define DMA_DesBst_32Data 0x00020000 /*Destination Burst transfer request IS 16 Data */
|
190 |
|
|
#define DMA_DesBst_64Data 0x00028000 /*Destination Burst transfer request IS 32 Data */
|
191 |
|
|
#define DMA_DesBst_128Data 0x00030000 /*Destination Burst transfer request IS 128 Data */
|
192 |
|
|
#define DMA_DesBst_256Data 0x00038000 /*Destination Burst transfer request IS 256 Data */
|
193 |
|
|
|
194 |
|
|
|
195 |
|
|
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
#define DMA_SrcWidth_Byte 0x00000000 /* source Width is one Byte */
|
199 |
|
|
#define DMA_SrcWidth_HalfWord 0x00040000 /* source Width is one HalfWord */
|
200 |
|
|
#define DMA_SrcWidth_Word 0x00080000 /* source Width is one Word */
|
201 |
|
|
|
202 |
|
|
|
203 |
|
|
|
204 |
|
|
|
205 |
|
|
#define DMA_DesWidth_Byte 0x00000000 /* Destination Width is one Byte */
|
206 |
|
|
#define DMA_DesWidth_HalfWord 0x00200000 /* Destination Width is one HalfWord */
|
207 |
|
|
#define DMA_DesWidth_Word 0x00400000 /* Destination Width is one Word */
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
|
214 |
|
|
/* Exported macro ------------------------------------------------------------*/
|
215 |
|
|
/* Exported functions ------------------------------------------------------- */
|
216 |
|
|
|
217 |
|
|
void DMA_DeInit(void);
|
218 |
|
|
void DMA_Init(DMA_Channel_TypeDef * DMA_Channelx, DMA_InitTypeDef * DMA_InitStruct);
|
219 |
|
|
void DMA_StructInit(DMA_InitTypeDef *DMA_InitStruct);
|
220 |
|
|
void DMA_Cmd(FunctionalState NewState);
|
221 |
|
|
void DMA_ITMaskConfig(DMA_Channel_TypeDef * DMA_Channelx, u16 DMA_ITMask, FunctionalState NewState);
|
222 |
|
|
void DMA_ITConfig(DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState);
|
223 |
|
|
FlagStatus DMA_GetChannelStatus(u8 ChannelIndx );
|
224 |
|
|
ITStatus DMA_GetITStatus(u8 ChannelIndx,u8 DMA_ITReq);
|
225 |
|
|
void DMA_ClearIT(u8 ChannelIndx,u8 DMA_ITClr);
|
226 |
|
|
void DMA_SyncConfig(u16 DMA_SrcReq, FunctionalState NewState);
|
227 |
|
|
FlagStatus DMA_GetSReq(u16 DMA_SrcReq);
|
228 |
|
|
FlagStatus DMA_GetLSReq(u16 DMA_SrcReq);
|
229 |
|
|
FlagStatus DMA_GetBReq(u16 DMA_SrcReq);
|
230 |
|
|
FlagStatus DMA_GetLBReq(u16 DMA_SrcReq);
|
231 |
|
|
FlagStatus DMA_GetChannelActiveStatus( DMA_Channel_TypeDef * DMA_Channelx);
|
232 |
|
|
void DMA_SetSReq(u16 DMA_SrcReq);
|
233 |
|
|
void DMA_SetLSReq(u16 DMA_SrcReq);
|
234 |
|
|
void DMA_SetBReq(u16 DMA_SrcReq);
|
235 |
|
|
void DMA_SetLBReq(u16 DMA_SrcReq);
|
236 |
|
|
void DMA_ChannelCmd (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
|
237 |
|
|
void DMA_ChannelHalt (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
|
238 |
|
|
void DMA_ChannelBuffering (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
|
239 |
|
|
void DMA_ChannelLockTrsf(DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
|
240 |
|
|
void DMA_ChannelCache(DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
|
241 |
|
|
void DMA_ChannelProt0Mode(DMA_Channel_TypeDef * DMA_Channelx,u32 Prot0Mode);
|
242 |
|
|
void DMA_ChannelSRCIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState);
|
243 |
|
|
void DMA_ChannelDESIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState);
|
244 |
|
|
|
245 |
|
|
#endif /* __91x_DMA_H */
|
246 |
|
|
|
247 |
|
|
/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
|