Sapphire SoC DS Sapphire SoC UG Sapphire HP SoC DS Sapphire HP SoC UG RISC-V Embedded IDE UG Board Support Package
Loading...
Searching...
No Matches
mtrap.h File Reference
#include <stdio.h>
#include "riscv.h"
#include "type.h"
#include "debug.h"
#include "plic/plic.h"
#include "irq_handler_stub.h"

Go to the source code of this file.

Overview

Trap (Interrupt) and Exception Handling Definitions.

Author
Efinix Inc

This file defines the entry point for all processor traps (trap_entry), as well as the C-level dispatchers for Interrupts (trap()) and Exceptions (crash()).

Definition in file mtrap.h.

Macros

#define STORE   "sw"
 Store Word (32-bit).
#define LOAD   "lw"
 Load Word (32-bit).
#define WORD   4
 Word size in bytes.
#define STR1(x)
 Context Helper Only.
#define STR(x)
 Context Helper Only.

Functions

Main Trap Entry Point (Naked).

Hardware vector target (written to mtvec).

void trap_entry (void)
 The Main Trap Entry Point (Naked).
CPU Interrupt Handler.

Handle interrupt from external, timer, software interrupts.

Note
These are weak aliases pointing to irq_handleDefault. The user can override them by defining a function with the same name.
int irq_handleSoft (void)
 Handlers for CPU interrupts (Software).
int irq_handleTimer (void)
 Handlers for CPU interrupts (Timer).
void irq_handleExt (void)
 External Interrupt Handler (PLIC).
Dispatcher/Exception Handlers (Function)

Trap Dispatcher mainly for external interrupt and exception handler.

Note
These are weak aliases pointing to irq_handleDefault. The user can override them by defining a function with the same name.
void trap (void)
 Main C Trap Dispatcher.
void crash (void)
 Fatal Exception Handler.