drivers: timer: nrf_rtc_timer: Add Lock Zero Latency IRQs Kconfig
Add an explicit Kconfig option to enable use of
__disable_irq() in nRF RTC timer driver to prevent higher
priority contexts (including ZLIs) that might preempt the
handler and call nrf_rtc_timer API from destroying the
internal state in nrf_rtc_timer.
Relates to commit fcda8699cb
("drivers: timer: extend
nrf_rtc_timer").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
095001cdd1
commit
4eb5c375e1
2 changed files with 13 additions and 2 deletions
|
@ -23,6 +23,17 @@ config NRF_RTC_TIMER_USER_CHAN_COUNT
|
||||||
help
|
help
|
||||||
Use nrf_rtc_timer.h API. Driver is not managing allocation of channels.
|
Use nrf_rtc_timer.h API. Driver is not managing allocation of channels.
|
||||||
|
|
||||||
|
config NRF_RTC_TIMER_LOCK_ZERO_LATENCY_IRQS
|
||||||
|
# hidden option
|
||||||
|
bool
|
||||||
|
depends on ZERO_LATENCY_IRQS
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable use of __disable_irq() to disable Zero Latency IRQs to prevent
|
||||||
|
higher priority contexts (including ZLIs) that might preempt the
|
||||||
|
handler and call nrf_rtc_timer API from destroying the internal state
|
||||||
|
in nrf_rtc_timer.
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "Clock startup policy"
|
prompt "Clock startup policy"
|
||||||
default SYSTEM_CLOCK_WAIT_FOR_STABILITY
|
default SYSTEM_CLOCK_WAIT_FOR_STABILITY
|
||||||
|
|
|
@ -98,7 +98,7 @@ static uint32_t full_int_lock(void)
|
||||||
{
|
{
|
||||||
uint32_t mcu_critical_state;
|
uint32_t mcu_critical_state;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_ZERO_LATENCY_IRQS)) {
|
if (IS_ENABLED(CONFIG_NRF_RTC_TIMER_LOCK_ZERO_LATENCY_IRQS)) {
|
||||||
mcu_critical_state = __get_PRIMASK();
|
mcu_critical_state = __get_PRIMASK();
|
||||||
__disable_irq();
|
__disable_irq();
|
||||||
} else {
|
} else {
|
||||||
|
@ -110,7 +110,7 @@ static uint32_t full_int_lock(void)
|
||||||
|
|
||||||
static void full_int_unlock(uint32_t mcu_critical_state)
|
static void full_int_unlock(uint32_t mcu_critical_state)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_ZERO_LATENCY_IRQS)) {
|
if (IS_ENABLED(CONFIG_NRF_RTC_TIMER_LOCK_ZERO_LATENCY_IRQS)) {
|
||||||
__set_PRIMASK(mcu_critical_state);
|
__set_PRIMASK(mcu_critical_state);
|
||||||
} else {
|
} else {
|
||||||
irq_unlock(mcu_critical_state);
|
irq_unlock(mcu_critical_state);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue