Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
sbl::system::interrupts Namespace Reference

Execution levels and the control critical section. More...

Detailed Description

Execution levels and the control critical section.

Classes

class  ScopedControlCritical
 RAII critical section against the control tick and everything below. More...
 

Enumerations

enum class  Level : uint8_t {
  Reserved = 0 , ShortDeadline = 1 , Audio = 2 , UsbMidi = 4 ,
  Dma = 5 , Bus = 6 , ControlTick = 8 , SoftPwm = 9 ,
  Exti = 10 , SoftPend = 11 , Debug = 12 , SysTick = 14 ,
  PendSv = 15
}
 Execution levels, most urgent first. More...
 

Functions

constexpr bool masked_by_ceiling (Level level)
 

Variables

constexpr Level CONTROL_CEILING = Level::ControlTick
 

Enumeration Type Documentation

◆ Level

enum class sbl::system::interrupts::Level : uint8_t
strong

Execution levels, most urgent first.

The invariants the scheme guarantees:

  • Level 0 stays empty, so nothing can ever tie with audio and nothing escapes the ceiling.
  • Audio has its own level. Any handler that shares it would delay audio by its full length (equal priority cannot preempt).
  • ControlTick is the control ceiling: a ScopedControlCritical masks this level and everything below it, and nothing above it may touch state that main or the tick protect. Audio's blocking term is therefore zero.
  • SysTick, PendSV and SVCall are assigned explicitly; unassigned system handlers reset to level 0, above audio.
Enumerator
Reserved 

Empty by design (never masked by the ceiling)

ShortDeadline 

Reserved for microsecond handlers that touch only SPSC queues

Audio 

Audio DMA half/complete - the audio streams only

UsbMidi 

USB interrupt, MIDI UART RX (both FIFO-elastic)

Dma 

Every other DMA stream (ADC, SD card)

Bus 

I2C / SPI event handlers, if interrupt-driven

ControlTick 

Control-rate timer tick - the control ceiling

SoftPwm 

Software PWM / BCM timer (tolerates tick preemption)

Exti 

External pin interrupts (encoders, buttons)

SoftPend 

Software-pended work: tud_task(), USB-MIDI parse

Debug 

Debug UART, diagnostics drain

SysTick 

Unused; assigned so it never sits at level 0

PendSv 

PendSV and SVCall (unused)

Definition at line 38 of file interrupts.hpp.

Function Documentation

◆ masked_by_ceiling()

constexpr bool sbl::system::interrupts::masked_by_ceiling ( Level  level)
constexpr

True if a handler at level is masked while the mask sits at the ceiling.

Definition at line 58 of file interrupts.hpp.

References CONTROL_CEILING.

Variable Documentation

◆ CONTROL_CEILING

constexpr Level sbl::system::interrupts::CONTROL_CEILING = Level::ControlTick
inlineconstexpr

The level a ScopedControlCritical raises the mask to.

Definition at line 55 of file interrupts.hpp.

Referenced by masked_by_ceiling().