@web-font-path: "roboto-debian.css";
v2.2.0 (RP2040)
Loading...
Searching...
No Matches
exception.h
Go to the documentation of this file.
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _HARDWARE_EXCEPTION_H
#define _HARDWARE_EXCEPTION_H
#include "pico.h"
#include "hardware/address_mapped.h"
// PICO_CONFIG: PARAM_ASSERTIONS_ENABLED_HARDWARE_EXCEPTION, Enable/disable assertions in the hardware_exception module, type=bool, default=0, group=hardware_exception
#ifndef PARAM_ASSERTIONS_ENABLED_HARDWARE_EXCEPTION
#ifdef PARAM_ASSERTIONS_ENABLED_EXCEPTION // backwards compatibility with SDK < 2.0.0
#define PARAM_ASSERTIONS_ENABLED_HARDWARE_EXCEPTION PARAM_ASSERTIONS_ENABLED_EXCEPTION
#else
#define PARAM_ASSERTIONS_ENABLED_HARDWARE_EXCEPTION 0
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __riscv
enum exception_number {
// Assigned to non-IRQ xcause values
MIN_EXCEPTION_NUM = 0,
INSTR_ALIGN_EXCEPTION = 0,
INSTR_FAULT_EXCEPTION = 1,
INSTR_ILLEGAL_EXCEPTION = 2,
EBREAK_EXCEPTION = 3,
LOAD_ALIGN_EXCEPTION = 4,
LOAD_FAULT_EXCEPTION = 5,
STORE_ALIGN_EXCEPTION = 6,
STORE_FAULT_EXCEPTION = 7,
ECALL_UMODE_EXCEPTION = 8,
ECALL_SMODE_EXCEPTION = 9,
ECALL_MMODE_EXCEPTION = 11,
MAX_EXCEPTION_NUM = 11
};
#else
enum exception_number {
// Assigned to VTOR indices
MIN_EXCEPTION_NUM = 2,
NMI_EXCEPTION = 2,
HARDFAULT_EXCEPTION = 3,
#if PICO_RP2350
MEMMANAGE_EXCEPTION = 4,
BUSFAULT_EXCEPTION = 5,
USAGEFAULT_EXCEPTION = 6,
SECUREFAULT_EXCEPTION = 7,
#endif
SVCALL_EXCEPTION = 11,
PENDSV_EXCEPTION = 14,
SYSTICK_EXCEPTION = 15,
MAX_EXCEPTION_NUM = 15
};
#endif
#define PICO_LOWEST_EXCEPTION_PRIORITY 0xff
#define PICO_HIGHEST_EXCEPTION_PRIORITY 0x00
typedef void (*exception_handler_t)(void);
exception_handler_t exception_set_exclusive_handler(enum exception_number num, exception_handler_t handler);
void exception_restore_handler(enum exception_number num, exception_handler_t original_handler);
exception_handler_t exception_get_vtable_handler(enum exception_number num);
#ifndef __riscv
bool exception_set_priority(uint num, uint8_t hardware_priority);
uint exception_get_priority(uint num);
#endif
#ifdef __cplusplus
}
#endif
#endif
address_mapped.h
exception_set_exclusive_handler
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:52
exception_handler_t
void(* exception_handler_t)(void)
Exception handler function type.
Definition exception.h:121
exception_number
exception_number
Exception number definitions.
Definition exception.h:94
exception_get_vtable_handler
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:47
exception_set_priority
bool exception_set_priority(uint num, uint8_t hardware_priority)
Set specified exception's priority.
Definition exception.c:93
exception_get_priority
uint exception_get_priority(uint num)
Get specified exception's priority.
Definition exception.c:103
exception_restore_handler
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:67
SYSTICK_EXCEPTION
@ SYSTICK_EXCEPTION
System Tick Interrupt.
Definition exception.h:107
SVCALL_EXCEPTION
@ SVCALL_EXCEPTION
SV Call Interrupt.
Definition exception.h:105
NMI_EXCEPTION
@ NMI_EXCEPTION
Non Maskable Interrupt.
Definition exception.h:97
HARDFAULT_EXCEPTION
@ HARDFAULT_EXCEPTION
HardFault Interrupt.
Definition exception.h:98
PENDSV_EXCEPTION
@ PENDSV_EXCEPTION
Pend SV Interrupt.
Definition exception.h:106
pico.h