Subversion Repositories NaviCtrl

Rev

Rev 1 | Rev 238 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1 Rev 196
Line 1... Line 1...
1
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
1
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
2
* File Name          : 91x_dma.c
2
* File Name          : 91x_dma.c
3
* Author             : MCD Application Team
3
* Author             : MCD Application Team
-
 
4
* Version            : V2.1
4
* Date First Issued  : 05/18/2006 : Version 1.0
5
* Date               : 12/22/2008
5
* Description        : This file provides all the DMA software functions
6
* Description        : This file provides all the DMA firmware functions
6
*                      needed to access all DMA registers.
7
*                      needed to access all DMA registers.
7
********************************************************************************
8
********************************************************************************
8
* History:v 1.0
-
 
9
* 05/22/2007 : Version 1.2
-
 
10
* 05/24/2006 : Version 1.1
-
 
11
* 05/18/2006 : Version 1.0
-
 
12
********************************************************************************
-
 
13
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
9
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
14
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
10
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
15
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
11
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
16
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
12
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
17
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
13
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
Line 29... Line 25...
29
/* Private variables ---------------------------------------------------------*/
25
/* Private variables ---------------------------------------------------------*/
Line 30... Line 26...
30
 
26
 
Line 31... Line 27...
31
 
27
 
32
/* DMA Masks "used" only in this module */
28
/* DMA Masks "used" only in this module */
33
 
29
 
34
#define       DMA_Width_DES_MASK                    0xFF1FFFFF
30
#define       DMA_Width_DES_MASK                0xFF1FFFFF
35
#define       DMA_Width_SRC_MASK                    0xFFE3FFFF
31
#define       DMA_Width_SRC_MASK                0xFFE3FFFF
36
#define       DMA_Bst_DES_MASK                      0xFFFC7FFF
32
#define       DMA_Bst_DES_MASK                  0xFFFC7FFF
37
#define       DMA_Bst_SRC_MASK                  0xFFFF8FFF
33
#define       DMA_Bst_SRC_MASK                  0xFFFF8FFF
38
#define       DMA_FlowCntrl_Mask                    0xFFFFC7FF
34
#define       DMA_FlowCntrl_Mask                0xFFFFC7FF
39
#define       DMA_TrsfSisze_Mask                    0xFFFFF000
35
#define       DMA_TrsfSisze_Mask                0xFFFFF000
40
#define       SRC_Mask                          0xFFFFFFE1
36
#define       SRC_Mask                          0xFFFFFFE1
41
#define       DES_Mask                          0xFFFFFC3F
37
#define       DES_Mask                          0xFFFFFC3F
Line 48... Line 44...
48
#define       DMA_CacheChannel                  0x40000000
44
#define       DMA_CacheChannel                  0x40000000
49
#define       DMA_ChannelActive                 0x00020000
45
#define       DMA_ChannelActive                 0x00020000
50
#define       DMA_Enable                        0x00000001
46
#define       DMA_Enable                        0x00000001
51
#define       DMA_ChannelEnable                 0x00000001
47
#define       DMA_ChannelEnable                 0x00000001
Line -... Line 48...
-
 
48
 
Line -... Line 49...
-
 
49
/*LLI Masks used for linked list's control word stucture*/
-
 
50
 
-
 
51
#define   DMA_SrcIncrement_MASK                 0xFBFFFFFF
-
 
52
#define   DMA_DesIncrement_MASK                 0xF7FFFFFF
-
 
53
#define   DMA_CacheableAccess_MASK              0xEFFFFFFF
-
 
54
#define   DMA_BufferableAccess_MASK             0xDFFFFFFF
-
 
55
#define   DMA_PrivilegedAccess_MASK             0xBFFFFFFF
Line 52... Line 56...
52
 
56
#define   DMA_TCInterrupt_MASK                  0x7FFFFFFF
53
 
57
   
Line 1121... Line 1125...
1121
 
1125
 
Line -... Line 1126...
-
 
1126
 
-
 
1127
}
-
 
1128
 
-
 
1129
 
-
 
1130
/********************************************************************************
-
 
1131
* Function Name  : DMA_LLI_CCR_Init
-
 
1132
* Description    : Return linked list's control word  according to the specified
-
 
1133
*                  parameters in the LLI_CCR_InitStruct .
-
 
1134
*
-
 
1135
* Input          : -LLI_CCR_InitStruct: pointer to a LLI_CCR_InitTypeDef structure
-
 
1136
*                ( Structure Config to be load in DMA Registers). .
-
 
1137
*
-
 
1138
* Output         :  None.
-
 
1139
*
-
 
1140
* Return         : Control word
-
 
1141
*******************************************************************************/
-
 
1142
 
-
 
1143
 
-
 
1144
u32 DMA_LLI_CCR_Init(LLI_CCR_InitTypeDef * LLI_CCR_InitStruct)
-
 
1145
 
-
 
1146
{
-
 
1147
    u32 CC=0;
-
 
1148
   /* Set The Destination width */
-
 
1149
    CC &= DMA_Width_DES_MASK;
-
 
1150
    CC |= LLI_CCR_InitStruct->LLI_DesWidth;
-
 
1151
 
-
 
1152
    /* Set The Source width  */
-
 
1153
    CC &= DMA_Width_SRC_MASK;
-
 
1154
    CC |= LLI_CCR_InitStruct->LLI_SrcWidth;
-
 
1155
 
-
 
1156
    /* Set The Burst Size for the Destination */
-
 
1157
    CC &= DMA_Bst_DES_MASK;
-
 
1158
    CC |= LLI_CCR_InitStruct->LLI_DesBstSize;
-
 
1159
 
-
 
1160
   /* Set The Burst Size for the Source */
-
 
1161
    CC &= DMA_Bst_SRC_MASK;
-
 
1162
    CC |= LLI_CCR_InitStruct->LLI_SrcBstSize;
-
 
1163
 
-
 
1164
    /* Initialize The Transfer Size for the Source */
-
 
1165
    CC &= DMA_TrsfSisze_Mask;
-
 
1166
    CC |= LLI_CCR_InitStruct->LLI_TrsfSize;
-
 
1167
   
-
 
1168
    /* Enable or disable source increment*/
-
 
1169
    CC &= DMA_SrcIncrement_MASK ;
-
 
1170
    CC |= LLI_CCR_InitStruct->LLI_SrcIncrement;
-
 
1171
   
-
 
1172
    /* Enable or disable destination increment*/
-
 
1173
    CC &= DMA_DesIncrement_MASK ;
-
 
1174
    CC |= LLI_CCR_InitStruct->LLI_DesIncrement;
-
 
1175
   
-
 
1176
    /* Enable or disable cacheable access*/
-
 
1177
    CC &= DMA_CacheableAccess_MASK;
-
 
1178
    CC |= LLI_CCR_InitStruct->LLI_PROT0;
-
 
1179
   
-
 
1180
    /* Enable or disable bufferable access*/
-
 
1181
    CC &= DMA_BufferableAccess_MASK;
-
 
1182
    CC |= LLI_CCR_InitStruct->LLI_PROT1;
-
 
1183
   
-
 
1184
    /* Enable or disablePrivileged mode*/
-
 
1185
    CC &=  DMA_PrivilegedAccess_MASK;
-
 
1186
    CC |= LLI_CCR_InitStruct->LLI_PROT2;
-
 
1187
   
-
 
1188
    /* Enable or disable Terminal count interrupt*/
-
 
1189
    CC &=  DMA_TCInterrupt_MASK ;
1122
 
1190
    CC |= LLI_CCR_InitStruct->LLI_TCInterrupt;