Subversion Repositories NaviCtrl

Rev

Rev 1 | 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_fmi.h
2
* File Name          : 91x_fmi.h
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 contains all the functions prototypes for the
6
* Description        : This file contains all the functions prototypes for the
6
*                      FMI software library.
7
*                      FMI firmware library.
7
********************************************************************************
-
 
8
* History:
-
 
9
* 05/22/2007 : Version 1.2
-
 
10
* 05/24/2006 : Version 1.1
-
 
11
* 05/18/2006 : Version 1.0
-
 
12
********************************************************************************
8
********************************************************************************
13
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
9
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
14
* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
10
* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
15
* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
11
* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
16
* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
12
* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
Line 22... Line 18...
22
/* Define to prevent recursive inclusion ------------------------------------ */
18
/* Define to prevent recursive inclusion ------------------------------------ */
Line 23... Line 19...
23
 
19
 
24
#ifndef __91x_FMI_H
20
#ifndef __91x_FMI_H
Line 25... Line -...
25
#define __91x_FMI_H
-
 
26
 
-
 
27
/* ========================================================================== */
-
 
28
/*    When bank 1 is remapped at address 0x0, decomment the following line    */
-
 
29
/* ========================================================================== */
-
 
Line 30... Line 21...
30
 
21
#define __91x_FMI_H
Line 31... Line 22...
31
//#define Remap_Bank_1
22
 
Line 38... Line 29...
38
/* Exported types ------------------------------------------------------------*/
29
/* Exported types ------------------------------------------------------------*/
39
/* Exported constants --------------------------------------------------------*/
30
/* Exported constants --------------------------------------------------------*/
Line 40... Line 31...
40
 
31
 
Line 41... Line 32...
41
/* FMI banks */
32
/* FMI banks */
-
 
33
 
Line 42... Line 34...
42
 
34
#ifdef Boot_Bank_1            /* Boot from Bank 1 */
43
#ifdef Remap_Bank_1
35
 
Line -... Line 36...
-
 
36
 
-
 
37
#define    FMI_BANK_0     ((*(vu32*)0x54000010) << 2)   /* FMI Bank 0 */
44
 
38
#define    FMI_BANK_1     ((*(vu32*)0x5400000C) << 2)   /* FMI Bank 1 */
Line 45... Line 39...
45
#define    FMI_BANK_0     ((*(vu32*)0x54000010) << 2)   /* FMI Bank 0 */
39
 
46
#define    FMI_BANK_1     ((*(vu32*)0x5400000C) << 2)   /* FMI Bank 1 */
40
#endif
Line 47... Line 41...
47
 
41
 
Line 48... Line -...
48
#else /* Remap Bank 0 */
-
 
Line 49... Line 42...
49
 
42
#ifdef Boot_Bank_0            /* Boot from Bank 0 */
50
#define    FMI_BANK_0     ((*(vu32*)0x5400000C) << 2)   /* FMI Bank 0 */
43
 
51
#define    FMI_BANK_1     ((*(vu32*)0x54000010) << 2)   /* FMI Bank 1 */
44
#define    FMI_BANK_0     ((*(vu32*)0x5400000C) << 2)   /* FMI Bank 0 */
52
 
45
#define    FMI_BANK_1     ((*(vu32*)0x54000010) << 2)   /* FMI Bank 1 */
53
#endif
46
 
54
 
47
#endif
55
/* FMI sectors */
48
 
56
 
49
 
-
 
50
#define    FMI_B0S0     0x00000000 + FMI_BANK_0     /* Bank 0 sector 0*/
-
 
51
#define    FMI_B0S1     0x00010000 + FMI_BANK_0     /* Bank 0 sector 1*/
-
 
52
#define    FMI_B0S2     0x00020000 + FMI_BANK_0     /* Bank 0 sector 2*/
-
 
53
#define    FMI_B0S3     0x00030000 + FMI_BANK_0     /* Bank 0 sector 3*/
-
 
54
#define    FMI_B0S4     0x00040000 + FMI_BANK_0     /* Bank 0 sector 4*/
-
 
55
#define    FMI_B0S5     0x00050000 + FMI_BANK_0     /* Bank 0 sector 5*/
-
 
56
#define    FMI_B0S6     0x00060000 + FMI_BANK_0     /* Bank 0 sector 6*/
-
 
57
#define    FMI_B0S7     0x00070000 + FMI_BANK_0     /* Bank 0 sector 7*/
-
 
58
#define    FMI_B0S8     0x00080000 + FMI_BANK_0     /* Bank 0 sector 8*/
-
 
59
#define    FMI_B0S9     0x00090000 + FMI_BANK_0     /* Bank 0 sector 9*/
-
 
60
#define    FMI_B0S10    0x000A0000 + FMI_BANK_0     /* Bank 0 sector 10*/
-
 
61
#define    FMI_B0S11    0x000B0000 + FMI_BANK_0     /* Bank 0 sector 11*/
-
 
62
#define    FMI_B0S12    0x000C0000 + FMI_BANK_0     /* Bank 0 sector 12*/
-
 
63
#define    FMI_B0S13    0x000D0000 + FMI_BANK_0     /* Bank 0 sector 13*/
-
 
64
#define    FMI_B0S14    0x000E0000 + FMI_BANK_0     /* Bank 0 sector 14*/
-
 
65
#define    FMI_B0S15    0x000F0000 + FMI_BANK_0     /* Bank 0 sector 15*/
-
 
66
#define    FMI_B0S16    0x00100000 + FMI_BANK_0     /* Bank 0 sector 16*/
-
 
67
#define    FMI_B0S17    0x00110000 + FMI_BANK_0     /* Bank 0 sector 17*/
-
 
68
#define    FMI_B0S18    0x00120000 + FMI_BANK_0     /* Bank 0 sector 18*/
-
 
69
#define    FMI_B0S19    0x00130000 + FMI_BANK_0     /* Bank 0 sector 19*/
-
 
70
#define    FMI_B0S20    0x00140000 + FMI_BANK_0     /* Bank 0 sector 20*/
-
 
71
#define    FMI_B0S21    0x00150000 + FMI_BANK_0     /* Bank 0 sector 21*/
-
 
72
#define    FMI_B0S22    0x00160000 + FMI_BANK_0     /* Bank 0 sector 22*/
-
 
73
#define    FMI_B0S23    0x00170000 + FMI_BANK_0     /* Bank 0 sector 23*/
-
 
74
#define    FMI_B0S24    0x00180000 + FMI_BANK_0     /* Bank 0 sector 24*/
-
 
75
#define    FMI_B0S25    0x00190000 + FMI_BANK_0     /* Bank 0 sector 25*/
-
 
76
#define    FMI_B0S26    0x001A0000 + FMI_BANK_0     /* Bank 0 sector 26*/
-
 
77
#define    FMI_B0S27    0x001B0000 + FMI_BANK_0     /* Bank 0 sector 27*/
-
 
78
#define    FMI_B0S28    0x001C0000 + FMI_BANK_0     /* Bank 0 sector 28*/
-
 
79
#define    FMI_B0S29    0x001D0000 + FMI_BANK_0     /* Bank 0 sector 29*/
-
 
80
#define    FMI_B0S30    0x001E0000 + FMI_BANK_0     /* Bank 0 sector 30*/
-
 
81
#define    FMI_B0S31    0x001F0000 + FMI_BANK_0     /* Bank 0 sector 31*/
-
 
82
 
-
 
83
 
-
 
84
#ifdef Flash_2MB_1MB
-
 
85
 
-
 
86
#define    FMI_B1S0     0x00000000 + FMI_BANK_1     /* Bank 1 sector 0 */
-
 
87
#define    FMI_B1S1     0x00004000 + FMI_BANK_1     /* Bank 1 sector 1 */
-
 
88
#define    FMI_B1S2     0x00008000 + FMI_BANK_1     /* Bank 1 sector 2 */
-
 
89
#define    FMI_B1S3     0x0000C000 + FMI_BANK_1     /* Bank 1 sector 3 */
Line 57... Line 90...
57
#define    FMI_B0S0     0x00000000 + FMI_BANK_0     /* Bank 0 sector 0 */
90
#define    FMI_B1S4     0x00010000 + FMI_BANK_1     /* Bank 1 sector 4 */
58
#define    FMI_B0S1     0x00010000 + FMI_BANK_0     /* Bank 0 sector 1 */
91
#define    FMI_B1S5     0x00014000 + FMI_BANK_1     /* Bank 1 sector 5 */
59
#define    FMI_B0S2     0x00020000 + FMI_BANK_0     /* Bank 0 sector 2 */
92
#define    FMI_B1S6     0x00018000 + FMI_BANK_1     /* Bank 1 sector 6 */
60
#define    FMI_B0S3     0x00030000 + FMI_BANK_0     /* Bank 0 sector 3 */
93
#define    FMI_B1S7     0x0001C000 + FMI_BANK_1     /* Bank 1 sector 7 */
Line -... Line 94...
-
 
94
 
-
 
95
#endif
-
 
96
 
-
 
97
#ifdef Flash_512KB_256KB
61
#define    FMI_B0S4     0x00040000 + FMI_BANK_0     /* Bank 0 sector 4 */
98
 
Line 62... Line 99...
62
#define    FMI_B0S5     0x00050000 + FMI_BANK_0     /* Bank 0 sector 5 */
99
#define    FMI_B1S0     0x00000000 + FMI_BANK_1     /* Bank 1 sector 0 */
63
#define    FMI_B0S6     0x00060000 + FMI_BANK_0     /* Bank 0 sector 6 */
100
#define    FMI_B1S1     0x00002000 + FMI_BANK_1     /* Bank 1 sector 1 */
64
#define    FMI_B0S7     0x00070000 + FMI_BANK_0     /* Bank 0 sector 7 */
101
#define    FMI_B1S2     0x00004000 + FMI_BANK_1     /* Bank 1 sector 2 */
Line 131... Line 168...
131
#define    FMI_OTP_LOW_HALFWORD_6       0x18   /* OTP Low halfword 6  */
168
#define    FMI_OTP_LOW_HALFWORD_6       0x18   /* OTP Low halfword 6  */
132
#define    FMI_OTP_HIGH_HALFWORD_6      0x1A   /* OTP High halfword 6 */
169
#define    FMI_OTP_HIGH_HALFWORD_6      0x1A   /* OTP High halfword 6 */
133
#define    FMI_OTP_LOW_HALFWORD_7       0x1C   /* OTP Low halfword 7  */
170
#define    FMI_OTP_LOW_HALFWORD_7       0x1C   /* OTP Low halfword 7  */
134
#define    FMI_OTP_HIGH_HALFWORD_7      0x1E   /* OTP High halfword 7 */
171
#define    FMI_OTP_HIGH_HALFWORD_7      0x1E   /* OTP High halfword 7 */
Line 135... Line 172...
135
 
172
 
Line 136... Line 173...
136
/* FMI sectors Masks */
173
/*FMI LSB RSIG Address*/
137
 
174
 
138
#define FMI_B0S0_MASK   0x0001       /* FMI B0S0 mask */
175
#define    FMI_ReadRSIGData_0           0x00    /*Manufacturer Code*/
139
#define FMI_B0S1_MASK   0x0002       /* FMI B0S1 mask */
176
#define    FMI_ReadRSIGData_1           0x01    /*Device Code*/
140
#define FMI_B0S2_MASK   0x0004       /* FMI B0S2 mask */
177
#define    FMI_ReadRSIGData_2           0x02    /*Die Revision Code*/
141
#define FMI_B0S3_MASK   0x0008       /* FMI B0S3 mask */
178
#define    FMI_ReadRSIGData_3           0x03    /*Protection Level 2 Register for 512KB Flash */
-
 
179
                                                /*or Protection Level 1 Register (sectors of bank0)*/
142
#define FMI_B0S4_MASK   0x0010       /* FMI B0S4 mask */
180
                                                /* for 2MB flash*/
-
 
181
 
143
#define FMI_B0S5_MASK   0x0020       /* FMI B0S5 mask */
182
#define    FMI_ReadRSIGData_4           0x04    /*Protection Level 1 Register for 512KB Flash*/
144
#define FMI_B0S6_MASK   0x0040       /* FMI B0S6 mask */
183
                                                /* or Protection Level 1 Register (sectors of bank1)*/
145
#define FMI_B0S7_MASK   0x0080       /* FMI B0S7 mask */
184
                                                /* for 2MB flash*/
-
 
185
 
146
 
186
#define    FMI_ReadRSIGData_5           0x05    /*Protection Status Register(sectors of bank0)*/
147
#define FMI_B1S0_MASK   0x0100       /* FMI B1S0 mask */
187
                                                /*for 2MB flash or Flash Configuration Register*/
-
 
188
                                                /*for 512KB flash*/
148
#define FMI_B1S1_MASK   0x0200       /* FMI B1S1 mask */
189
#define    FMI_ReadRSIGData_6           0x06    /*Protection Status Register (sectors of bank1)*/
-
 
190
                                                /*available only for 2MB flash*/
-
 
191
#define    FMI_ReadRSIGData_7           0x07    /*Flash Configuration Register*/
Line 149... Line 192...
149
#define FMI_B1S2_MASK   0x0400       /* FMI B1S2 mask */
192
                                                /*available only for 2MB flash*/
Line 150... Line 193...
150
#define FMI_B1S3_MASK   0x0800       /* FMI B1S3 mask */
193
                   
151
 
194
 
Line 174... Line 217...
174
u16 FMI_GetWriteWaitStateValue(void);
217
u16 FMI_GetWriteWaitStateValue(void);
175
void FMI_SuspendEnable(vu32 FMI_Bank);
218
void FMI_SuspendEnable(vu32 FMI_Bank);
176
void FMI_ResumeEnable(vu32 FMI_Bank);
219
void FMI_ResumeEnable(vu32 FMI_Bank);
177
void FMI_ClearFlag(vu32 FMI_Bank);
220
void FMI_ClearFlag(vu32 FMI_Bank);
178
void FMI_WriteProtectionCmd(vu32 FMI_Sector, FunctionalState FMI_NewState);
221
void FMI_WriteProtectionCmd(vu32 FMI_Sector, FunctionalState FMI_NewState);
179
FlagStatus FMI_GetWriteProtectionStatus(u32 FMI_Sector_Protection);
-
 
180
u8 FMI_WaitForLastOperation(vu32 FMI_Bank);
222
u8 FMI_WaitForLastOperation(vu32 FMI_Bank);
-
 
223
u32 FMI_ReadRSIGData(u8 FMI_LSB_RSIGAddress);
Line 181... Line 224...
181
 
224
 
Line 182... Line 225...
182
#endif /* __91x_FMI_H */
225
#endif /* __91x_FMI_H */