Sound Byte Libs 1ee2ca6
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
sbl::core::hal::interrupts Namespace Reference

Typedefs

using Handler = void(*)()
 Interrupt handler function type.
 

Enumerations

enum class  Priority : uint8_t {
  Highest = 0 , High = 4 , Medium = 8 , Low = 12 ,
  Lowest = 15
}
 Interrupt priority levels for ARM Cortex-M. More...
 
enum class  Trigger : uint8_t {
  Rising , Falling , Change , Low ,
  High
}
 External interrupt trigger types. More...
 

Functions

uint32_t disable_and_save ()
 Disable ARM interrupts and return previous state.
 
void restore (uint32_t saved_state)
 Restore ARM interrupt state.
 
uint32_t get_state ()
 Get current ARM interrupt state.
 
bool are_enabled ()
 Check if ARM interrupts are enabled.
 

Typedef Documentation

◆ Handler

using sbl::core::hal::interrupts::Handler = typedef void(*)()

Interrupt handler function type.

Keep interrupt handlers fast and minimal. Avoid blocking operations in ISR context.

Definition at line 51 of file types.hpp.

Enumeration Type Documentation

◆ Priority

enum class sbl::core::hal::interrupts::Priority : uint8_t
strong

Interrupt priority levels for ARM Cortex-M.

ARM Cortex-M uses lower numerical values for higher priority. These values map directly to ARM NVIC priority levels.

Enumerator
Highest 

Highest priority (0)

High 

High priority

Medium 

Medium priority.

Low 

Low priority.

Lowest 

Lowest priority (15)

Definition at line 26 of file types.hpp.

◆ Trigger

enum class sbl::core::hal::interrupts::Trigger : uint8_t
strong

External interrupt trigger types.

Enumerator
Rising 

Rising edge trigger.

Falling 

Falling edge trigger

Change 

Any edge (rising or falling)

Low 

Low level trigger.

High 

High level trigger.

Definition at line 37 of file types.hpp.

Function Documentation

◆ are_enabled()

bool sbl::core::hal::interrupts::are_enabled ( )
inline

Check if ARM interrupts are enabled.

Returns
true if interrupts enabled, false if disabled

Definition at line 73 of file control.hpp.

References __get_PRIMASK.

◆ disable_and_save()

uint32_t sbl::core::hal::interrupts::disable_and_save ( )
inline

Disable ARM interrupts and return previous state.

Disables all interrupts (except NMI/Hard Fault) using ARM PRIMASK register. Returns previous PRIMASK state for later restoration.

Returns
Previous PRIMASK register value

Definition at line 41 of file control.hpp.

References __disable_irq, and __get_PRIMASK.

◆ get_state()

uint32_t sbl::core::hal::interrupts::get_state ( )
inline

Get current ARM interrupt state.

Returns
Current PRIMASK register value (0 = enabled, 1 = disabled)

Definition at line 64 of file control.hpp.

References __get_PRIMASK.

◆ restore()

void sbl::core::hal::interrupts::restore ( uint32_t  saved_state)
inline

Restore ARM interrupt state.

Restores PRIMASK register to specified state. Typically used with value returned from disable_and_save().

Parameters
saved_statePrevious PRIMASK value to restore

Definition at line 55 of file control.hpp.

References __set_PRIMASK.

Referenced by sbl::core::patterns::synchronization::CriticalSection::~CriticalSection().

Here is the caller graph for this function: