@web-font-path: "roboto-debian.css";
Loading...
Searching...
No Matches
exception.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef _HARDWARE_EXCEPTION_H
8#define _HARDWARE_EXCEPTION_H
9
10#include "pico.h"
12
26// PICO_CONFIG: PARAM_ASSERTIONS_ENABLED_HARDWARE_EXCEPTION, Enable/disable assertions in the hardware_exception module, type=bool, default=0, group=hardware_exception
27#ifndef PARAM_ASSERTIONS_ENABLED_HARDWARE_EXCEPTION
28#ifdef PARAM_ASSERTIONS_ENABLED_EXCEPTION // backwards compatibility with SDK < 2.0.0
29#define PARAM_ASSERTIONS_ENABLED_HARDWARE_EXCEPTION PARAM_ASSERTIONS_ENABLED_EXCEPTION
30#else
31#define PARAM_ASSERTIONS_ENABLED_HARDWARE_EXCEPTION 0
32#endif
33#endif
34#ifdef __cplusplus
35extern "C" {
36#endif
37
76#ifdef __riscv
78 // Assigned to non-IRQ xcause values
79 MIN_EXCEPTION_NUM = 0,
80 INSTR_ALIGN_EXCEPTION = 0,
81 INSTR_FAULT_EXCEPTION = 1,
82 INSTR_ILLEGAL_EXCEPTION = 2,
83 EBREAK_EXCEPTION = 3,
84 LOAD_ALIGN_EXCEPTION = 4,
85 LOAD_FAULT_EXCEPTION = 5,
86 STORE_ALIGN_EXCEPTION = 6,
87 STORE_FAULT_EXCEPTION = 7,
88 ECALL_UMODE_EXCEPTION = 8,
89 ECALL_SMODE_EXCEPTION = 9,
90 ECALL_MMODE_EXCEPTION = 11,
91 MAX_EXCEPTION_NUM = 11
92};
93#else
95 // Assigned to VTOR indices
96 MIN_EXCEPTION_NUM = 2,
99#if PICO_RP2350
100 MEMMANAGE_EXCEPTION = 4,
101 BUSFAULT_EXCEPTION = 5,
102 USAGEFAULT_EXCEPTION = 6,
103 SECUREFAULT_EXCEPTION = 7,
104#endif
108 MAX_EXCEPTION_NUM = 15
109};
110#endif
111
112#define PICO_LOWEST_EXCEPTION_PRIORITY 0xff
113#define PICO_HIGHEST_EXCEPTION_PRIORITY 0x00
114
115
121typedef void (*exception_handler_t)(void);
122
137
149void exception_restore_handler(enum exception_number num, exception_handler_t original_handler);
150
159
160#ifndef __riscv
179bool exception_set_priority(uint num, uint8_t hardware_priority);
180
199uint exception_get_priority(uint num);
200#endif
201
202#ifdef __cplusplus
203}
204#endif
205
206#endif
exception_handler_t exception_set_exclusive_handler(enum exception_number num, exception_handler_t handler)
Set the exception handler for an exception on the executing core.
Definition exception.c:50
void(* exception_handler_t)(void)
Exception handler function type.
Definition exception.h:121
exception_number
Exception number definitions.
Definition exception.h:94
exception_handler_t exception_get_vtable_handler(enum exception_number num)
Get the current exception handler for the specified exception from the currently installed vector tab...
Definition exception.c:45
bool exception_set_priority(uint num, uint8_t hardware_priority)
Set specified exception's priority.
Definition exception.c:87
uint exception_get_priority(uint num)
Get specified exception's priority.
Definition exception.c:97
void exception_restore_handler(enum exception_number num, exception_handler_t original_handler)
Restore the original exception handler for an exception on this core.
Definition exception.c:63
@ SYSTICK_EXCEPTION
System Tick Interrupt.
Definition exception.h:107
@ SVCALL_EXCEPTION
SV Call Interrupt.
Definition exception.h:105
@ NMI_EXCEPTION
Non Maskable Interrupt.
Definition exception.h:97
@ HARDFAULT_EXCEPTION
HardFault Interrupt.
Definition exception.h:98
@ PENDSV_EXCEPTION
Pend SV Interrupt.
Definition exception.h:106