PebbleOS v4.47.0-1362-gd278268fe
Loading...
Searching...
No Matches
Interrupt controller drivers

Interface for interrupt controller drivers. More...

Data Structures

struct  pbl_intc_ops
 Interrupt controller driver operations, called with interrupts locked. More...
 
struct  pbl_intc_line
 Runtime state of a line. More...
 
struct  pbl_intc
 An interrupt controller. More...
 

Macros

#define PBL_INTC_STATE_DEFINE(sym, _num_irqs)
 Define the class state of interrupt controller sym, for the driver's define macro.
 
#define PBL_INTC_INIT(sym, _name, _init, _parent, _ops)
 Initializer for the struct pbl_intc of controller sym.
 

Functions

void pbl_intc_dispatch (const struct pbl_intc *intc, uint32_t hwirq)
 Run the handler of a pending line.
 

Variables

const struct pbl_device_class pbl_intc_class
 Class of the interrupt controllers.
 

Detailed Description

Interface for interrupt controller drivers.

A driver embeds a struct pbl_intc in its instance, sets it up with PBL_INTC_STATE_DEFINE() and PBL_INTC_INIT(), implements the struct pbl_intc_ops the class calls, and calls pbl_intc_dispatch() for each pending line.


Data Structure Documentation

◆ pbl_intc_line

struct pbl_intc_line

Runtime state of a line.

Data Fields
void * arg Handler argument.
pbl_intc_handler_t handler Handler, NULL if the line is free.

◆ pbl_intc

struct pbl_intc

An interrupt controller.

Data Fields
struct pbl_device dev Device.
uint32_t * enabled Enabled lines, one bit each.
struct pbl_intc_line * lines State of each line.
uint16_t num_irqs Number of lines.
const struct pbl_intc_ops * ops Driver operations.

Macro Definition Documentation

◆ PBL_INTC_INIT

#define PBL_INTC_INIT (   sym,
  _name,
  _init,
  _parent,
  _ops 
)
Value:
{ \
.dev = PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, &pbl_intc_class), \
.ops = (_ops), \
.lines = sym##_intc_lines, \
.enabled = sym##_intc_enabled, \
.num_irqs = PBL_ARRAY_SIZE(sym##_intc_lines), \
}
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:153
const struct pbl_device_class pbl_intc_class
Class of the interrupt controllers.
#define PBL_ARRAY_SIZE(array)
Get the number of elements of an array.
Definition size.h:40

Initializer for the struct pbl_intc of controller sym.

Parameters
symSymbol of the controller instance, with its state defined by PBL_INTC_STATE_DEFINE().
_nameName.
_initDevice init function, or NULL.
_parentParent device, or NULL.
_opsDriver operations.

◆ PBL_INTC_STATE_DEFINE

#define PBL_INTC_STATE_DEFINE (   sym,
  _num_irqs 
)
Value:
static struct pbl_intc_line sym##_intc_lines[_num_irqs]; \
static uint32_t sym##_intc_enabled[PBL_DIV_ROUND_UP(_num_irqs, 32U)]
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132
Runtime state of a line.
Definition driver.h:45
#define PBL_DIV_ROUND_UP(num, denom)
Divide, rounding up for positive results.
Definition math.h:85

Define the class state of interrupt controller sym, for the driver's define macro.

Parameters
symSymbol of the controller instance.
_num_irqsNumber of lines.

Function Documentation

◆ pbl_intc_dispatch()

void pbl_intc_dispatch ( const struct pbl_intc *  intc,
uint32_t  hwirq 
)

Run the handler of a pending line.

A line without a handler is disabled.

Parameters
intcController.
hwirqPending line.

Variable Documentation

◆ pbl_intc_class

const struct pbl_device_class pbl_intc_class
extern

Class of the interrupt controllers.