|
KallistiOS git master
Independent SDK for the Sega Dreamcast
|
Interrupt and exception handling. More...
#include <kos/irq.h>#include <stdalign.h>#include <stdbool.h>#include <stdint.h>#include <kos/cdefs.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 | IRQ_TRAP_CODE(code) |
| #define | IRQ_PRIO_MAX 15 |
| Minimum/maximum values for IRQ priorities. | |
| #define | IRQ_PRIO_MIN 1 |
| #define | IRQ_PRIO_MASKED 0 |
| #define | REG_BYTE_CNT 256 |
| Thread execution state and accessors. | |
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. | |
Functions | |
| static int | arch_irq_inside_int (void) |
| static void | arch_irq_restore (irq_mask_t old) |
| static irq_mask_t | arch_irq_disable (void) |
| static void | arch_irq_enable (void) |
| void | arch_irq_create_context (irq_context_t *context, uintptr_t stack_pointer, uintptr_t routine, const uintptr_t *args) |
| int | arch_irq_set_handler (irq_t code, irq_hdl_t hnd, void *data) |
| irq_cb_t | arch_irq_get_handler (irq_t code) |
| int | arch_irq_set_global_handler (irq_hdl_t hnd, void *data) |
| irq_cb_t | arch_irq_get_global_handler (void) |
| void | arch_irq_set_context (irq_context_t *cxt) |
| irq_context_t * | arch_irq_get_context (void) |
| void | irq_set_priority (irq_src_t src, unsigned int prio) |
| Set the priority of a given IRQ source. | |
| unsigned int | irq_get_priority (irq_src_t src) |
| Get the priority of a given IRQ source. | |
Variables | |
| int | inside_int |
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.
| #define IRQ_PRIO_MASKED 0 |
| #define IRQ_PRIO_MAX 15 |
Minimum/maximum values for IRQ priorities.
A priority of zero means the interrupt is masked. The maximum priority that can be set is 15.
| #define IRQ_PRIO_MIN 1 |
| #define IRQ_TRAP_CODE | ( | code | ) |
| enum irq_exception |
Interrupt exception codes.
SH-specific exception codes. Used to identify the source or type of an interrupt. Each exception code is of a certain "type" which dictates how the interrupt is generated and handled.
List of exception types:
| Type | Description |
|---|---|
RESET | Caused by system reset. Uncatchable and fatal. Automatically branch to address 0xA0000000. |
REEXEC | Restarts current instruction after interrupt processing. Context PC is the triggering instruction. |
POST | Continues with next instruciton after interrupt processing. Context PC is the next instruction. |
SOFT | Software-driven exceptions for triggering interrupts upon special events. |
UNUSED | Known to not be present and usable with the DC's SH4 configuration. |
TRAP | Virtual type (not a SH hardware type) for trap codes. |
List of exception codes:
| enum irq_src_t |
|
inlinestatic |
References arch_irq_restore().
Referenced by irq_disable().
|
inlinestatic |
References arch_irq_restore().
Referenced by irq_enable().
|
inlinestatic |
References inside_int.
Referenced by irq_inside_int().
|
inlinestatic |
Referenced by arch_irq_disable(), arch_irq_enable(), and irq_restore().
| unsigned int irq_get_priority | ( | irq_src_t | src | ) |
Get the priority of a given IRQ source.
This function returns the priority of a given IRQ source.
| src | The interrupt source whose priority should be set |
| void irq_set_priority | ( | irq_src_t | src, |
| unsigned int | prio ) |
Set the priority of a given IRQ source.
This function can be used to set the priority of a given IRQ source.
| src | The interrupt source whose priority should be set |
| prio | The priority to set, in the range [0..15], 0 meaning the IRQs from that source are masked. |
|
extern |
Referenced by arch_irq_inside_int().