NMSIS-Core
Version 1.3.1
NMSIS-Core support for Nuclei processor-based devices
|
Functions for interrupt, exception and nmi handle available in system_<device>.c. More...
Macros | |
#define | MAX_SYSTEM_EXCEPTION_NUM 26 |
Max exception handler number, don't include the NMI(0xFFF) one. More... | |
Typedefs | |
typedef void(* | EXC_HANDLER) (unsigned long cause, unsigned long sp) |
Exception Handler Function Typedef. More... | |
Functions | |
static void | system_default_exception_handler (unsigned long mcause, unsigned long sp) |
System Default Exception Handler. More... | |
static void | Exception_Init (void) |
Initialize all the default core exception handlers. More... | |
void | Exception_DumpFrame (unsigned long sp, uint8_t mode) |
Dump Exception Frame. More... | |
void | Exception_Register_EXC (uint32_t EXCn, unsigned long exc_handler) |
Register an exception handler for exception code EXCn. More... | |
unsigned long | Exception_Get_EXC (uint32_t EXCn) |
Get current exception handler for exception code EXCn. More... | |
uint32_t | core_exception_handler (unsigned long mcause, unsigned long sp) |
Common NMI and Exception handler entry. More... | |
static void | system_default_exception_handler_s (unsigned long scause, unsigned long sp) |
Supervisor mode system Default Exception Handler. More... | |
void | Exception_Register_EXC_S (uint32_t EXCn, unsigned long exc_handler) |
Register an exception handler for exception code EXCn of supervisor mode. More... | |
unsigned long | Exception_Get_EXC_S (uint32_t EXCn) |
Get current exception handler for exception code EXCn of supervisor mode. More... | |
uint32_t | core_exception_handler_s (unsigned long scause, unsigned long sp) |
common Exception handler entry of supervisor mode More... | |
Variables | |
static unsigned long | SystemExceptionHandlers [MAX_SYSTEM_EXCEPTION_NUM+1] |
Store the exception handlers for each exception ID. More... | |
static unsigned long | SystemExceptionHandlers_S [MAX_SYSTEM_EXCEPTION_NUM] |
Store the exception handlers for each exception ID in supervisor mode. More... | |
Functions for interrupt, exception and nmi handle available in system_<device>.c.
Nuclei provide a template for interrupt, exception and NMI handling. Silicon Vendor could adapat according to their requirement. Silicon vendor could implement interface for different exception code and replace current implementation.
#define MAX_SYSTEM_EXCEPTION_NUM 26 |
Max exception handler number, don't include the NMI(0xFFF) one.
Definition at line 269 of file system_Device.c.
typedef void(* EXC_HANDLER) (unsigned long cause, unsigned long sp) |
Exception Handler Function Typedef.
Definition at line 297 of file system_Device.c.
uint32_t core_exception_handler | ( | unsigned long | mcause, |
unsigned long | sp | ||
) |
Common NMI and Exception handler entry.
This function provided a command entry for NMI and exception. Silicon Vendor could modify this template implementation according to requirement.
[in] | mcause | code indicating the reason that caused the trap in machine mode |
[in] | sp | stack pointer |
Definition at line 425 of file system_Device.c.
uint32_t core_exception_handler_s | ( | unsigned long | scause, |
unsigned long | sp | ||
) |
common Exception handler entry of supervisor mode
This function provided a supervisor mode common entry for exception. Silicon Vendor could modify this template implementation according to requirement.
[in] | scause | code indicating the reason that caused the trap in supervisor mode |
[in] | sp | stack pointer |
Definition at line 514 of file system_Device.c.
void Exception_DumpFrame | ( | unsigned long | sp, |
uint8_t | mode | ||
) |
Dump Exception Frame.
This function provided feature to dump exception frame stored in stack.
[in] | sp | stackpoint |
[in] | mode | privileged mode to decide whether to dump msubm CSR |
Definition at line 351 of file system_Device.c.
unsigned long Exception_Get_EXC | ( | uint32_t | EXCn | ) |
Get current exception handler for exception code EXCn.
[in] | EXCn | See EXCn_Type |
Definition at line 401 of file system_Device.c.
unsigned long Exception_Get_EXC_S | ( | uint32_t | EXCn | ) |
Get current exception handler for exception code EXCn of supervisor mode.
[in] | EXCn | See EXCn_Type |
Definition at line 492 of file system_Device.c.
|
static |
Initialize all the default core exception handlers.
The core exception handler for each exception id will be initialized to system_default_exception_handler.
Definition at line 333 of file system_Device.c.
void Exception_Register_EXC | ( | uint32_t | EXCn, |
unsigned long | exc_handler | ||
) |
Register an exception handler for exception code EXCn.
[in] | EXCn | See EXCn_Type |
[in] | exc_handler | The exception handler for this exception code EXCn |
Definition at line 384 of file system_Device.c.
void Exception_Register_EXC_S | ( | uint32_t | EXCn, |
unsigned long | exc_handler | ||
) |
Register an exception handler for exception code EXCn of supervisor mode.
-For EXCn < MAX_SYSTEM_EXCEPTION_NUM, it will be registered into SystemExceptionHandlers_S[EXCn-1]. -For EXCn == NMI_EXCn, The NMI (Non-maskable-interrupt) cannot be trapped to the supervisor-mode or user-mode for any configuration, so NMI won't be registered into SystemExceptionHandlers_S.
[in] | EXCn | See EXCn_Type |
[in] | exc_handler | The exception handler for this exception code EXCn |
Definition at line 478 of file system_Device.c.
|
static |
System Default Exception Handler.
This function provides a default exception and NMI handler for all exception ids. By default, It will just print some information for debug, Vendor can customize it according to its requirements.
[in] | mcause | code indicating the reason that caused the trap in machine mode |
[in] | sp | stack pointer |
Definition at line 307 of file system_Device.c.
|
static |
Supervisor mode system Default Exception Handler.
This function provided a default supervisor mode exception and NMI handling code for all exception ids. By default, It will just print some information for debug, Vendor can customize it according to its requirements.
[in] | scause | code indicating the reason that caused the trap in supervisor mode |
[in] | sp | stack pointer |
Definition at line 452 of file system_Device.c.
|
static |
Store the exception handlers for each exception ID.
Definition at line 278 of file system_Device.c.
|
static |
Store the exception handlers for each exception ID in supervisor mode.
Definition at line 289 of file system_Device.c.