Skip to content

Commit 58ed5c2

Browse files
c1728p90xc0170
authored andcommitted
Change MPU lock name for readability in FlashIAP
Change the variable names in FlashIAP from 'xn' to 'make_ram_executable' and from 'wn' to 'make_rom_writable' to make the code more readable.
1 parent 24f002d commit 58ed5c2

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/FlashIAP.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ int FlashIAP::init()
5959
int ret = 0;
6060
_mutex->lock();
6161
{
62-
ScopedMpuXnLock xn;
63-
ScopedMpuWnLock wn;
62+
ScopedMpuXnLock make_ram_executable;
63+
ScopedMpuWnLock make_rom_writable;
6464
if (flash_init(&_flash)) {
6565
ret = -1;
6666
}
@@ -77,8 +77,8 @@ int FlashIAP::deinit()
7777
int ret = 0;
7878
_mutex->lock();
7979
{
80-
ScopedMpuXnLock xn;
81-
ScopedMpuWnLock wn;
80+
ScopedMpuXnLock make_ram_executable;
81+
ScopedMpuWnLock make_rom_writable;
8282
if (flash_free(&_flash)) {
8383
ret = -1;
8484
}
@@ -94,8 +94,8 @@ int FlashIAP::read(void *buffer, uint32_t addr, uint32_t size)
9494
int32_t ret = -1;
9595
_mutex->lock();
9696
{
97-
ScopedMpuXnLock xn;
98-
ScopedMpuWnLock wn;
97+
ScopedMpuXnLock make_ram_executable;
98+
ScopedMpuWnLock make_rom_writable;
9999
ret = flash_read(&_flash, addr, (uint8_t *) buffer, size);
100100
}
101101
_mutex->unlock();
@@ -141,8 +141,8 @@ int FlashIAP::program(const void *buffer, uint32_t addr, uint32_t size)
141141
prog_size = chunk;
142142
}
143143
{
144-
ScopedMpuXnLock xn;
145-
ScopedMpuWnLock wn;
144+
ScopedMpuXnLock make_ram_executable;
145+
ScopedMpuWnLock make_rom_writable;
146146
if (flash_program_page(&_flash, addr, prog_buf, prog_size)) {
147147
ret = -1;
148148
break;
@@ -189,8 +189,8 @@ int FlashIAP::erase(uint32_t addr, uint32_t size)
189189
_mutex->lock();
190190
while (size) {
191191
{
192-
ScopedMpuXnLock xn;
193-
ScopedMpuWnLock wn;
192+
ScopedMpuXnLock make_ram_executable;
193+
ScopedMpuWnLock make_rom_writable;
194194
ret = flash_erase_sector(&_flash, addr);
195195
}
196196
if (ret != 0) {

0 commit comments

Comments
 (0)