mirror of https://github.com/ARMmbed/mbed-os.git
use core_util_critical_section_enter/exit instead of __enable_irq/__disable_irq
parent
7e2a2ca1df
commit
1d1df9e172
|
@ -41,6 +41,7 @@
|
||||||
#include "app_util.h"
|
#include "app_util.h"
|
||||||
#include "nrf_drv_common.h"
|
#include "nrf_drv_common.h"
|
||||||
#include "lp_ticker_api.h"
|
#include "lp_ticker_api.h"
|
||||||
|
#include "mbed_critical.h"
|
||||||
|
|
||||||
#if defined(NRF52_ERRATA_20)
|
#if defined(NRF52_ERRATA_20)
|
||||||
#include "softdevice_handler.h"
|
#include "softdevice_handler.h"
|
||||||
|
@ -531,7 +532,7 @@ static void register_next_tick()
|
||||||
// the RTC1 keeps running.
|
// the RTC1 keeps running.
|
||||||
// This code is very short 20-38 cycles in the worst case, it shouldn't
|
// This code is very short 20-38 cycles in the worst case, it shouldn't
|
||||||
// disturb softdevice.
|
// disturb softdevice.
|
||||||
__disable_irq();
|
core_util_critical_section_enter();
|
||||||
uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE);
|
uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE);
|
||||||
|
|
||||||
// If an overflow occur, set the next tick in COUNTER + delta clock cycles
|
// If an overflow occur, set the next tick in COUNTER + delta clock cycles
|
||||||
|
@ -543,7 +544,7 @@ static void register_next_tick()
|
||||||
// Enable generation of the compare event for the value set above (this
|
// Enable generation of the compare event for the value set above (this
|
||||||
// event will trigger the interrupt).
|
// event will trigger the interrupt).
|
||||||
nrf_rtc_event_enable(COMMON_RTC_INSTANCE, OS_TICK_INT_MASK);
|
nrf_rtc_event_enable(COMMON_RTC_INSTANCE, OS_TICK_INT_MASK);
|
||||||
__enable_irq();
|
core_util_critical_section_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue