@@ -42,7 +42,7 @@ static const struct flash_parameters flash_stm32_parameters = {
42
42
#endif
43
43
};
44
44
45
- static int flash_stm32_write_protection (const struct device * dev , bool enable );
45
+ static int flash_stm32_cr_lock (const struct device * dev , bool enable );
46
46
47
47
bool __weak flash_stm32_valid_range (const struct device * dev , off_t offset ,
48
48
uint32_t len , bool write )
@@ -175,14 +175,14 @@ static int flash_stm32_erase(const struct device *dev, off_t offset,
175
175
176
176
LOG_DBG ("Erase offset: %ld, len: %zu" , (long int ) offset , len );
177
177
178
- rc = flash_stm32_write_protection (dev , false);
178
+ rc = flash_stm32_cr_lock (dev , false);
179
179
if (rc == 0 ) {
180
180
rc = flash_stm32_block_erase_loop (dev , offset , len );
181
181
}
182
182
183
183
flash_stm32_flush_caches (dev , offset , len );
184
184
185
- int rc2 = flash_stm32_write_protection (dev , true);
185
+ int rc2 = flash_stm32_cr_lock (dev , true);
186
186
187
187
if (!rc ) {
188
188
rc = rc2 ;
@@ -212,12 +212,12 @@ static int flash_stm32_write(const struct device *dev, off_t offset,
212
212
213
213
LOG_DBG ("Write offset: %ld, len: %zu" , (long int ) offset , len );
214
214
215
- rc = flash_stm32_write_protection (dev , false);
215
+ rc = flash_stm32_cr_lock (dev , false);
216
216
if (rc == 0 ) {
217
217
rc = flash_stm32_write_range (dev , offset , data , len );
218
218
}
219
219
220
- int rc2 = flash_stm32_write_protection (dev , true);
220
+ int rc2 = flash_stm32_cr_lock (dev , true);
221
221
222
222
if (!rc ) {
223
223
rc = rc2 ;
@@ -228,7 +228,7 @@ static int flash_stm32_write(const struct device *dev, off_t offset,
228
228
return rc ;
229
229
}
230
230
231
- static int flash_stm32_write_protection (const struct device * dev , bool enable )
231
+ static int flash_stm32_cr_lock (const struct device * dev , bool enable )
232
232
{
233
233
FLASH_TypeDef * regs = FLASH_STM32_REGS (dev );
234
234
@@ -304,7 +304,7 @@ int flash_stm32_option_bytes_lock(const struct device *dev, bool enable)
304
304
305
305
/* Unlock CR/PECR/NSCR register if needed. */
306
306
if (!enable ) {
307
- rc = flash_stm32_write_protection (dev , false);
307
+ rc = flash_stm32_cr_lock (dev , false);
308
308
if (rc ) {
309
309
return rc ;
310
310
}
@@ -347,7 +347,7 @@ int flash_stm32_option_bytes_lock(const struct device *dev, bool enable)
347
347
#endif
348
348
/* Lock CR/PECR/NSCR register if needed. */
349
349
if (enable ) {
350
- rc = flash_stm32_write_protection (dev , true);
350
+ rc = flash_stm32_cr_lock (dev , true);
351
351
if (rc ) {
352
352
return rc ;
353
353
}
0 commit comments