Skip to content

Commit 9a82e95

Browse files
benothmn-stkartben
authored andcommitted
soc: stm32wbax: hci_if: Re-write enable/disable IRQs
Migrate LINKLAYER_PLAT_EnableIRQ and LINKLAYER_PLAT_DisableIRQ from linklayer_plat.c (hal/stm32 module). Signed-off-by: Nidhal BEN OTHMEN <[email protected]>
1 parent b357f81 commit 9a82e95

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

soc/st/stm32/stm32wbax/hci_if/linklayer_plat_adapt.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ volatile int32_t prio_high_isr_counter;
2929
volatile int32_t prio_low_isr_counter;
3030
volatile int32_t prio_sys_isr_counter;
3131
volatile uint32_t local_basepri_value;
32+
volatile uint8_t irq_counter;
33+
static uint32_t primask_bit;
3234

3335
/* Radio SW low ISR global variable */
3436
volatile uint8_t radio_sw_low_isr_is_running_high_prio;
@@ -149,6 +151,26 @@ void LINKLAYER_PLAT_Assert(uint8_t condition)
149151
__ASSERT_NO_MSG(condition);
150152
}
151153

154+
void LINKLAYER_PLAT_EnableIRQ(void)
155+
{
156+
if (irq_counter > 0) {
157+
irq_counter--;
158+
if (irq_counter == 0) {
159+
__set_PRIMASK(primask_bit);
160+
}
161+
}
162+
}
163+
164+
void LINKLAYER_PLAT_DisableIRQ(void)
165+
{
166+
if (irq_counter == 0) {
167+
/* Save primask bit at first time interrupts disabling */
168+
primask_bit = __get_PRIMASK();
169+
}
170+
__disable_irq();
171+
irq_counter++;
172+
}
173+
152174
void LINKLAYER_PLAT_EnableSpecificIRQ(uint8_t isr_type)
153175
{
154176

0 commit comments

Comments
 (0)