Subversion Repositories NaviCtrl

Rev

Rev 1 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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