71__attribute__((naked, aligned(4)))
75 "addi sp,sp, -(16*" STR(
WORD)
")\n"
127 volatile uintptr_t id;
168 __asm__
volatile (
"wfi");
186 volatile uintptr_t mhartid =
csr_read(mhartid);
189 volatile intptr_t mcause =
csr_read(mcause);
192 intptr_t interrupt = mcause < 0;
193 intptr_t cause = mcause & 0xF;
#define LOG_ERR(debug, fmt,...)
#define DBG_MOD_FAULT
Hard Faults / Errors.
void irq_handleExt()
External Interrupt Handler (PLIC).
void trap_entry(void)
The Main Trap Entry Point (Naked).
void crash()
Fatal Exception Handler.
int irq_handleSoft(void)
Handlers for CPU interrupts (Software).
void trap()
Main C Trap Dispatcher.
int irq_handleTimer(void)
Handlers for CPU interrupts (Timer).
#define LOAD
Load Word (32-bit).
#define STR(x)
Context Helper Only.
#define WORD
Word size in bytes.
#define STORE
Store Word (32-bit).
int(* interrupt_vector_table[64])(void)
Global Interrupt Vector Table.
int irq_m_gpio1_1_handler(void)
int irq_m_user_h_handler(void)
int irq_m_user_c_handler(void)
int irq_m_gpio0_0_handler(void)
GPIO (IDs 16-19).
int irq_m_spi1_handler(void)
int irq_m_user_f_handler(void)
int irq_m_gpio0_1_handler(void)
int irq_m_userTimer2_handler(void)
int irq_m_userTimer4_handler(void)
int irq_m_uart1_handler(void)
int irq_m_watchDog1_handler(void)
int irq_m_i2c3_handler(void)
int irq_m_invalid_handler(void)
System Interrupts.
int irq_m_l2Cache_handler(void)
L2 Cache Control (ID 31).
int irq_m_user_e_handler(void)
int irq_m_i2c0_handler(void)
I2C (IDs 11-15).
int irq_m_userTimer1_handler(void)
int irq_m_user_g_handler(void)
int irq_m_userTimer0_handler(void)
User Timer (IDs 21-25).
int irq_m_i2c1_handler(void)
int irq_m_uart0_handler(void)
UART (IDs 1-3) Meaning: Machine Mode UART 0 Handler.
int irq_m_i2c2_handler(void)
int irq_m_axiA_handler(void)
AXI A (ID 30).
int irq_m_gpio1_0_handler(void)
int irq_m_watchDog0_handler(void)
WatchDog Timer (IDs 26-27).
int irq_m_userTimer3_handler(void)
int irq_m_user_b_handler(void)
int irq_m_spi0_handler(void)
SPI (IDs 6-8).
int irq_m_uart2_handler(void)
int irq_m_spi2_handler(void)
int irq_m_user_d_handler(void)
int irq_m_i2c4_handler(void)
int irq_m_user_a_handler(void)
User Interrupts (IDs 32-39) /*.
void plic_releaseExtIRQ_m(u32 gateway)
Release ID source from external IRQ.
u32 plic_claimExtIRQ_m()
Initialize the PLIC instance with a base address. Calculates the internal pointers for the register b...
#define CAUSE_ILLEGAL_INSTRUCTION
Exception: Illegal Instruction.
#define CAUSE_ENV_CALL_M_MODE
Exception: Environment Call from M Mode.
#define CAUSE_STORE_AMO_PAGE_FAULT
Exception: Store/AMO Page Fault.
#define CAUSE_MACHINE_EXTERNAL
Interrupt: Machine External.
#define CAUSE_MACHINE_SOFTWARE
Interrupt: Machine Software.
#define CAUSE_ENV_CALL_U_MODE
Exception: Environment Call from U Mode.
#define CAUSE_LOAD_ADDR_MISALIGNED
Exception: Load Address Misaligned.
#define CAUSE_ACCESS_FAULT
Exception: Instruction Access Fault.
#define CAUSE_BREAKPOINT
Exception: Breakpoint.
#define CAUSE_STORE_AMO_ACCESS_FAULT
Exception: Store/AMO Access Fault.
#define CAUSE_INSTRUCTION_ADDR_MISALIGNED
Exception: Instruction Address Misaligned.
#define CAUSE_LOAD_ACCESS_FAULT
Exception: Load Access Fault.
#define CAUSE_INSTRUCTION_PAGE_FAULT
Exception: Instruction Page Fault.
#define CAUSE_MACHINE_TIMER
Interrupt: Machine Timer.
#define CAUSE_LOAD_PAGE_FAULT
Exception: Load Page Fault.
#define CAUSE_STORE_AMO_ADDR_MISALIGNED
Exception: Store/AMO Address Misaligned.
#define CAUSE_ENV_CALL_S_MODE
Exception: Environment Call from S Mode.
#define csr_read(csr)
This function is used to read the value of a CSR.
void irq_handleException()
Trap (Interrupt) and Exception Handling Definitions.