Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_irq.c
1 #include <bc_irq.h>
2 #include <stm32l0xx.h>
3 
4 static volatile uint32_t _bc_irq_primask = 0;
5 static volatile uint32_t _bc_irq_disable = 0;
6 
7 void bc_irq_disable(void)
8 {
9  uint32_t primask = __get_PRIMASK();
10 
11  __disable_irq();
12 
13  if (_bc_irq_disable == 0)
14  {
15  _bc_irq_primask = primask & 1;
16  }
17 
18  _bc_irq_disable++;
19 }
20 
21 void bc_irq_enable(void)
22 {
23  if (_bc_irq_disable != 0)
24  {
25  _bc_irq_disable--;
26 
27  if (_bc_irq_disable == 0 && _bc_irq_primask == 0)
28  {
29  __enable_irq();
30  }
31  }
32 }
void bc_irq_enable(void)
Enable interrupt requests globally (call can be nested)
Definition: bc_irq.c:21
void bc_irq_disable(void)
Disable interrupt requests globally (call can be nested)
Definition: bc_irq.c:7