aboutsummaryrefslogtreecommitdiffstats
path: root/Bootloaders/Printer/BootloaderAPI.c
diff options
context:
space:
mode:
Diffstat (limited to 'Bootloaders/Printer/BootloaderAPI.c')
-rw-r--r--Bootloaders/Printer/BootloaderAPI.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/Bootloaders/Printer/BootloaderAPI.c b/Bootloaders/Printer/BootloaderAPI.c
index 2be156808..5198ea7f0 100644
--- a/Bootloaders/Printer/BootloaderAPI.c
+++ b/Bootloaders/Printer/BootloaderAPI.c
@@ -37,16 +37,22 @@
void BootloaderAPI_ErasePage(const uint32_t Address)
{
- boot_page_erase_safe(Address);
- boot_spm_busy_wait();
- boot_rww_enable();
+ ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
+ {
+ boot_page_erase_safe(Address);
+ boot_spm_busy_wait();
+ boot_rww_enable();
+ }
}
void BootloaderAPI_WritePage(const uint32_t Address)
{
- boot_page_write_safe(Address);
- boot_spm_busy_wait();
- boot_rww_enable();
+ ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
+ {
+ boot_page_write_safe(Address);
+ boot_spm_busy_wait();
+ boot_rww_enable();
+ }
}
void BootloaderAPI_FillWord(const uint32_t Address, const uint16_t Word)
@@ -71,5 +77,8 @@ uint8_t BootloaderAPI_ReadLock(void)
void BootloaderAPI_WriteLock(const uint8_t LockBits)
{
- boot_lock_bits_set_safe(LockBits);
+ ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
+ {
+ boot_lock_bits_set_safe(LockBits);
+ }
}