KallistiOS git master
Independent SDK for the Sega Dreamcast
|
Interrupt and exception handling. More...
#include <stdbool.h>
#include <stdint.h>
#include <sys/cdefs.h>
#include <arch/types.h>
#include <arch/trap.h>
Go to the source code of this file.
Data Structures | |
struct | irq_context_t |
Architecture-specific structure for holding the processor state. More... | |
Macros | |
#define | REG_BYTE_CNT 256 |
The number of bytes required to save thread context. | |
#define | EXC_OFFSET_000 0 |
Offset 0x000. | |
#define | EXC_OFFSET_100 1 |
Offset 0x100. | |
#define | EXC_OFFSET_400 2 |
Offset 0x400. | |
#define | EXC_OFFSET_600 3 |
Offset 0x600. | |
#define | TIMER_IRQ EXC_TMU0_TUNI0 |
The value of the timer IRQ. | |
#define | irq_disable_scoped() |
Disable interrupts with scope management. | |
Register Accessors | |
Convenience macros for accessing context registers | |
#define | CONTEXT_PC(c) |
Fetch the program counter from an irq_context_t. | |
#define | CONTEXT_FP(c) |
Fetch the frame pointer from an irq_context_t. | |
#define | CONTEXT_SP(c) |
Fetch the stack pointer from an irq_context_t. | |
#define | CONTEXT_RET(c) |
Fetch the return value from an irq_context_t. | |
Typedefs | |
typedef uint32_t | irq_mask_t |
Type representing an interrupt mask state. | |
typedef void(* | irq_handler) (irq_t code, irq_context_t *context, void *data) |
The type of an IRQ handler. | |
Functions | |
void | irq_set_context (irq_context_t *regbank) |
Switch out contexts (for interrupt return). | |
irq_context_t * | irq_get_context (void) |
Get the current IRQ context. | |
void | irq_create_context (irq_context_t *context, uint32_t stack_pointer, uint32_t routine, const uint32_t *args, bool usermode) |
Fill a newly allocated context block. | |
int | irq_inside_int (void) |
Returns whether inside of an interrupt context. | |
irq_mask_t | irq_disable (void) |
Disable interrupts. | |
void | irq_enable (void) |
Enable all interrupts. | |
void | irq_restore (irq_mask_t v) |
Restore IRQ state. | |
void | irq_force_return (void) |
Resume normal execution from IRQ context. | |
int | irq_set_handler (irq_t code, irq_handler hnd, void *data) |
Set or remove an IRQ handler. | |
irq_handler | irq_get_handler (irq_t code) |
Get the address of the current handler for the IRQ type. | |
int | irq_set_global_handler (irq_handler handler, void *data) |
Set a global exception handler. | |
irq_handler | irq_get_global_handler (void) |
Get the global exception handler. | |
Interrupt and exception handling.
This file contains various definitions and declarations related to handling interrupts and exceptions on the Dreamcast. This level deals with IRQs and exceptions generated on the SH4, versus the asic layer which deals with actually differentiating "external" interrupts.