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
Go to the documentation of this file.
1
2// Copyright (C) 2013-2026 Efinix Inc. All rights reserved.
3// Full license header bsp/efinix/EfxSapphireSocRV64/include/LICENSE.MD
5
6#ifndef MTRAP_H
7#define MTRAP_H
8
20
21#include <stdio.h>
22#include "riscv.h"
23#include "type.h"
24#include "debug.h"
25#include "plic/plic.h"
26#include "irq_handler_stub.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
44
45/* ========================================================================== */
46/* SUB-GROUP 1: ASSEMBLY HELPERS (Context Saving) */
47/* ========================================================================== */
48
57 #if __riscv_xlen == 64
58 #define STORE "sd"
59 #define LOAD "ld"
60 #define WORD 8
61 #else
62 #define STORE "sw"
63 #define LOAD "lw"
64 #define WORD 4
65 #endif
66
67 #define STR1(x) #x
68 #define STR(x) STR1(x)
70
71
72/* ========================================================================== */
73/* SUB-GROUP: FUNCTIONS */
74/* ========================================================================== */
75
82
101 void trap_entry(void) __attribute__((naked, aligned(4)));
103
111
119 int irq_handleSoft(void) __attribute__((weak));
127 int irq_handleTimer(void) __attribute__((weak));
133 void irq_handleExt(void) __attribute__((weak));
135
136
137
153 void trap(void) __attribute__((weak));
154
163 void crash(void) __attribute__((weak));
164
166 // End of MTRAP_Funcs group
168#ifdef __cplusplus
169}
170#endif
171 // End of MAIN MTRAP Group
173
174#endif // MTRAP_H
DEBUG driver API definitions.
void irq_handleExt(void)
External Interrupt Handler (PLIC).
Definition mtrap.c:125
void trap_entry(void)
The Main Trap Entry Point (Naked).
Definition mtrap.c:72
void crash(void)
Fatal Exception Handler.
Definition mtrap.c:164
int irq_handleSoft(void)
Handlers for CPU interrupts (Software).
void trap(void)
Main C Trap Dispatcher.
Definition mtrap.c:184
int irq_handleTimer(void)
Handlers for CPU interrupts (Timer).
Weak Vector Table Definitions.
PLIC driver API definitions.
RISC-V related functions and definitions.