Modules | Functions | Variables
Global interrupt management
Collaboration diagram for Global interrupt management:

Modules

 Deprecated interrupt definitions
 

Functions

void cpu_irq_enter_critical (void)
 
void cpu_irq_leave_critical (void)
 

Variables

static volatile uint32_t cpu_irq_critical_section_counter
 
static volatile bool cpu_irq_prev_interrupt_state
 
volatile bool g_interrupt_enabled
 

Interrupt Service Routine definition

#define ISR(func)   void func (void)
 Define service routine. More...
 
#define irq_initialize_vectors()
 Initialize interrupt vectors. More...
 
#define irq_register_handler(int_num, int_prio)
 Register handler for interrupt. More...
 

Global interrupt flags

typedef uint32_t irqflags_t
 Type used for holding state of interrupt flag. More...
 
static irqflags_t cpu_irq_save (void)
 Get and clear the global interrupt flags. More...
 
static bool cpu_irq_is_enabled_flags (irqflags_t flags)
 Check if interrupts are globally enabled in supplied flags. More...
 
static void cpu_irq_restore (irqflags_t flags)
 Restore global interrupt flags. More...
 
#define cpu_irq_enable()
 Enable interrupts globally. More...
 
#define cpu_irq_disable()
 Disable interrupts globally. More...
 
#define cpu_irq_is_enabled()   (__get_PRIMASK() == 0)
 Check if interrupts are globally enabled. More...
 

Interrupt Service Routine definition

#define Enable_global_interrupt()   cpu_irq_enable()
 
#define Disable_global_interrupt()   cpu_irq_disable()
 
#define Is_global_interrupt_enabled()   cpu_irq_is_enabled()
 

Usual Constants

#define DISABLE   0
 
#define ENABLE   1
 
#define DISABLED   0
 
#define ENABLED   1
 
#define OFF   0
 
#define ON   1
 
#define FALSE   0
 
#define TRUE   1
 
#define false   FALSE
 
#define true   TRUE
 
#define KO   0
 
#define OK   1
 
#define PASS   0
 
#define FAIL   1
 
#define LOW   0
 
#define HIGH   1
 
#define CLR   0
 
#define SET   1
 

Detailed Description

This is a driver for global enabling and disabling of interrupts.

Macro Definition Documentation

◆ CLR

#define CLR   0

Definition at line 421 of file libchip_compiler.h.

◆ cpu_irq_disable

#define cpu_irq_disable ( )
Value:
do { \
__disable_irq(); \
__DMB(); \
g_interrupt_enabled = false; \
} while (0)

Disable interrupts globally.

◆ cpu_irq_enable

#define cpu_irq_enable ( )
Value:
do { \
g_interrupt_enabled = true; \
__DMB(); \
__enable_irq(); \
} while (0)

Enable interrupts globally.

◆ cpu_irq_is_enabled

#define cpu_irq_is_enabled ( )    (__get_PRIMASK() == 0)

Check if interrupts are globally enabled.

Returns
True if interrupts are enabled.

◆ DISABLE

#define DISABLE   0

Definition at line 401 of file libchip_compiler.h.

◆ Disable_global_interrupt

#define Disable_global_interrupt ( )    cpu_irq_disable()

Definition at line 392 of file libchip_compiler.h.

◆ DISABLED

#define DISABLED   0

Definition at line 403 of file libchip_compiler.h.

◆ ENABLE

#define ENABLE   1

Definition at line 402 of file libchip_compiler.h.

◆ Enable_global_interrupt

#define Enable_global_interrupt ( )    cpu_irq_enable()

Definition at line 391 of file libchip_compiler.h.

◆ ENABLED

#define ENABLED   1

Definition at line 404 of file libchip_compiler.h.

◆ FAIL

#define FAIL   1

Definition at line 418 of file libchip_compiler.h.

◆ FALSE

#define FALSE   0

Definition at line 407 of file libchip_compiler.h.

◆ false

#define false   FALSE

Definition at line 411 of file libchip_compiler.h.

◆ HIGH

#define HIGH   1

Definition at line 420 of file libchip_compiler.h.

◆ irq_initialize_vectors

#define irq_initialize_vectors ( )
Value:
do { \
} while(0)

Initialize interrupt vectors.

For NVIC the interrupt vectors are put in vector table. So nothing to do to initialize them, except defined the vector function with right name.

This must be called prior to irq_register_handler.

Definition at line 89 of file interrupt_sam_nvic.h.

◆ irq_register_handler

#define irq_register_handler (   int_num,
  int_prio 
)
Value:
NVIC_SetPriority( (IRQn_Type)int_num, int_prio); \
NVIC_EnableIRQ( (IRQn_Type)int_num); \
__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
Clear Pending Interrupt.
Definition: core_cm7.h:1736
enum IRQn IRQn_Type

Register handler for interrupt.

For NVIC the interrupt vectors are put in vector table. So nothing to do to register them, except defined the vector function with right name.

Usage:

Note
The function func must be defined with the ISR macro.
The functions prototypes can be found in the device exception header files (exceptions.h).

Definition at line 110 of file interrupt_sam_nvic.h.

◆ Is_global_interrupt_enabled

#define Is_global_interrupt_enabled ( )    cpu_irq_is_enabled()

Definition at line 393 of file libchip_compiler.h.

◆ ISR

#define ISR (   func)    void func (void)

Define service routine.

Note
For NVIC devices the interrupt service routines are predefined to add to vector table in binary generation, so there is no service register at run time. The routine collections are in exceptions.h.

Usage:

ISR(foo_irq_handler)
{
// Function definition
...
}
Parameters
funcName for the function.

Definition at line 77 of file interrupt_sam_nvic.h.

◆ KO

#define KO   0

Definition at line 415 of file libchip_compiler.h.

◆ LOW

#define LOW   0

Definition at line 419 of file libchip_compiler.h.

◆ OFF

#define OFF   0

Definition at line 405 of file libchip_compiler.h.

◆ OK

#define OK   1

Definition at line 416 of file libchip_compiler.h.

◆ ON

#define ON   1

Definition at line 406 of file libchip_compiler.h.

◆ PASS

#define PASS   0

Definition at line 417 of file libchip_compiler.h.

◆ SET

#define SET   1

Definition at line 422 of file libchip_compiler.h.

◆ TRUE

#define TRUE   1

Definition at line 408 of file libchip_compiler.h.

◆ true

#define true   TRUE

Definition at line 412 of file libchip_compiler.h.

Typedef Documentation

◆ irqflags_t

Type used for holding state of interrupt flag.

Definition at line 130 of file interrupt_sam_nvic.h.

Function Documentation

◆ cpu_irq_enter_critical()

void cpu_irq_enter_critical ( void  )

Definition at line 47 of file interrupt_sam_nvic.c.

◆ cpu_irq_is_enabled_flags()

bool cpu_irq_is_enabled_flags ( irqflags_t  flags)
inlinestatic

Check if interrupts are globally enabled in supplied flags.

Parameters
flagsCurrents state of interrupt flags.
Returns
True if interrupts are enabled.

Definition at line 148 of file interrupt_sam_nvic.h.

◆ cpu_irq_leave_critical()

void cpu_irq_leave_critical ( void  )

Definition at line 63 of file interrupt_sam_nvic.c.

◆ cpu_irq_restore()

void cpu_irq_restore ( irqflags_t  flags)
inlinestatic

Restore global interrupt flags.

Use in conjunction with cpu_irq_save.

Parameters
flagsState to set interrupt flag to.

Definition at line 153 of file interrupt_sam_nvic.h.

◆ cpu_irq_save()

irqflags_t cpu_irq_save ( void  )
inlinestatic

Get and clear the global interrupt flags.

Use in conjunction with cpu_irq_restore.

Returns
Current state of interrupt flags.
Note
This function leaves interrupts disabled.

Definition at line 141 of file interrupt_sam_nvic.h.

Variable Documentation

◆ cpu_irq_critical_section_counter

volatile uint32_t cpu_irq_critical_section_counter
static

Definition at line 138 of file interrupt_sam_nvic.h.

◆ cpu_irq_prev_interrupt_state

volatile bool cpu_irq_prev_interrupt_state
static

Definition at line 139 of file interrupt_sam_nvic.h.

◆ g_interrupt_enabled

volatile bool g_interrupt_enabled

Definition at line 44 of file interrupt_sam_nvic.c.



inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:07