@@ -122,12 +122,9 @@ int32_t flash_program_page(flash_t *obj, uint32_t address,
122
122
IAP .cmd = 51 ;// Copy RAM to Flash
123
123
IAP .par [0 ] = address ;// Destination Flash Address
124
124
125
- if ((unsigned long )data %4 == 0 )// Word boundary
126
- {
125
+ if ((unsigned long )data %4 == 0 ){// Word boundary
127
126
IAP .par [1 ] = (unsigned long )data ;// Source RAM Address
128
- }
129
- else
130
- {
127
+ } else {
131
128
alignedData = malloc (size );
132
129
memcpy (alignedData ,data ,size );
133
130
IAP .par [1 ] = (unsigned long )alignedData ;// Source RAM Address
@@ -137,8 +134,7 @@ int32_t flash_program_page(flash_t *obj, uint32_t address,
137
134
IAP .par [3 ] = CCLK ;// CCLK in kHz
138
135
IAP_Call (& IAP .cmd , & IAP .stat );// Call IAP Command
139
136
140
- if (alignedData != 0 )//We allocated our own memory
141
- {
137
+ if (alignedData != 0 ){//We allocated our own memory
142
138
free (alignedData );
143
139
}
144
140
@@ -149,16 +145,12 @@ int32_t flash_program_page(flash_t *obj, uint32_t address,
149
145
150
146
uint32_t flash_get_sector_size (const flash_t * obj , uint32_t address )
151
147
{
152
- if (address < flash_get_start_address (obj ) || address >= flash_get_start_address (obj ) + flash_get_size (obj ))
153
- {
148
+ if (address < flash_get_start_address (obj ) || address >= flash_get_start_address (obj ) + flash_get_size (obj )){
154
149
return MBED_FLASH_INVALID_SIZE ;
155
150
}
156
- if (GetSecNum (address )>=0x10 )
157
- {
151
+ if (GetSecNum (address )>=0x10 ){
158
152
return 0x8000 ;
159
- }
160
- else
161
- {
153
+ } else {
162
154
return 0x1000 ;
163
155
}
164
156
}
0 commit comments