23
23
static uint32_t GetSector (uint32_t Address );
24
24
static uint32_t GetSectorSize (uint32_t Sector );
25
25
26
- /** Initialize the flash peripheral and the flash_t object
27
- *
28
- * @param obj The flash object
29
- * @return 0 for success, -1 for error
30
- */
31
- int32_t flash_init (flash_t * obj )
32
- {
33
- return 0 ;
34
- }
35
-
36
- /** Uninitialize the flash peripheral and the flash_t object
37
- *
38
- * @param obj The flash object
39
- * @return 0 for success, -1 for error
40
- */
41
- int32_t flash_free (flash_t * obj )
42
- {
43
- return 0 ;
44
- }
45
-
46
26
static int32_t flash_unlock (void )
47
27
{
48
28
/* Allow Access to Flash control registers and user Falsh */
@@ -64,13 +44,16 @@ static int32_t flash_lock(void)
64
44
}
65
45
}
66
46
67
- /** Erase one sector starting at defined address
68
- *
69
- * The address should be at sector boundary. This function does not do any check for address alignments
70
- * @param obj The flash object
71
- * @param address The sector starting address
72
- * @return 0 for success, -1 for error
73
- */
47
+ int32_t flash_init (flash_t * obj )
48
+ {
49
+ return 0 ;
50
+ }
51
+
52
+ int32_t flash_free (flash_t * obj )
53
+ {
54
+ return 0 ;
55
+ }
56
+
74
57
int32_t flash_erase_sector (flash_t * obj , uint32_t address )
75
58
{
76
59
static FLASH_EraseInitTypeDef EraseInitStruct ;
@@ -104,17 +87,6 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address)
104
87
return status ;
105
88
}
106
89
107
- /** Program one page starting at defined address
108
- *
109
- * The page should be at page boundary, should not cross multiple sectors.
110
- * This function does not do any check for address alignments or if size
111
- * is aligned to a page size.
112
- * @param obj The flash object
113
- * @param address The sector starting address
114
- * @param data The data buffer to be programmed
115
- * @param size The number of bytes to program
116
- * @return 0 for success, -1 for error
117
- */
118
90
int32_t flash_program_page (flash_t * obj , uint32_t address , const uint8_t * data , uint32_t size )
119
91
{
120
92
int32_t status = 0 ;
@@ -155,13 +127,7 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
155
127
return status ;
156
128
}
157
129
158
- /** Get sector size
159
- *
160
- * @param obj The flash object
161
- * @param address The sector starting address
162
- * @return The size of a sector (in our case considering 1 sector = 1 page)
163
- */
164
- uint32_t flash_get_sector_size (const flash_t * obj , uint32_t address )
130
+ uint32_t flash_get_sector_size (const flash_t * obj , uint32_t address )
165
131
{
166
132
if ((address >= (FLASH_BASE + FLASH_SIZE )) || (address < FLASH_BASE )) {
167
133
return MBED_FLASH_INVALID_SIZE ;
@@ -170,34 +136,18 @@ uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
170
136
}
171
137
}
172
138
173
- /** Get page size
174
- *
175
- * @param obj The flash object
176
- * @param address The page starting address
177
- * @return The size of a page (in our case the minimum programmable size)
178
- */
179
139
uint32_t flash_get_page_size (const flash_t * obj )
180
140
{
181
141
// Flash of STM32F2 devices can be programed 1 byte at a time
182
142
return 1 ;
183
143
}
184
144
185
- /** Get start address for the flash region
186
- *
187
- * @param obj The flash object
188
- * @return The start address for the flash region
189
- */
190
- uint32_t flash_get_start_address (const flash_t * obj )
145
+ uint32_t flash_get_start_address (const flash_t * obj )
191
146
{
192
147
return FLASH_BASE ;
193
148
}
194
149
195
- /** Get the flash region size
196
- *
197
- * @param obj The flash object
198
- * @return The flash region size
199
- */
200
- uint32_t flash_get_size (const flash_t * obj )
150
+ uint32_t flash_get_size (const flash_t * obj )
201
151
{
202
152
return FLASH_SIZE ;
203
153
}
0 commit comments