KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
IRQ context handling

API for handling IRQ contexts More...

Functions

static void irq_create_context (irq_context_t *context, uintptr_t stack_pointer, uintptr_t routine, const uintptr_t *args)
 Fill a newly allocated context block.
 
static void irq_set_context (irq_context_t *cxt)
 Switch out contexts (for interrupt return).
 
static irq_context_tirq_get_context (void)
 Get the current IRQ context.
 

Detailed Description

API for handling IRQ contexts

This API provides functions to create a new IRQ context, get a pointer to the current context, or set the context that will be used when returning from an exception.

Function Documentation

◆ irq_create_context()

static void irq_create_context ( irq_context_t * context,
uintptr_t stack_pointer,
uintptr_t routine,
const uintptr_t * args )
inlinestatic

Fill a newly allocated context block.

The given parameters will be passed to the called routine (up to the architecture maximum). For the Dreamcast, this maximum is 4.

Parameters
contextThe IRQ context to fill in.
stack_pointerThe value to set in the stack pointer.
routineThe address of the program counter for the context.
argsAny arguments to set in the registers. This cannot be NULL, and must have enough values to fill in up to the architecture maximum.

◆ irq_get_context()

static irq_context_t * irq_get_context ( void )
inlinestatic

Get the current IRQ context.

This will fetch the processor context prior to the exception handling during an IRQ service routine.

Returns
The current IRQ context.
See also
irq_set_context()

◆ irq_set_context()

static void irq_set_context ( irq_context_t * cxt)
inlinestatic

Switch out contexts (for interrupt return).

This function will set the processor state that will be restored when the exception returns.

Parameters
cxtThe IRQ context to restore.
See also
irq_get_context()

References cxt.