📄 hw_nvic.h
字号:
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_CPUID register.
//
//*****************************************************************************
#define NVIC_CPUID_IMP_M 0xFF000000 // Implementer Code
#define NVIC_CPUID_IMP_ARM 0x41000000 // ARM
#define NVIC_CPUID_VAR_M 0x00F00000 // Variant Number
#define NVIC_CPUID_CON_M 0x000F0000 // Constant
#define NVIC_CPUID_PARTNO_M 0x0000FFF0 // Part Number
#define NVIC_CPUID_PARTNO_CM3 0x0000C230 // Cortex-M3 processor
#define NVIC_CPUID_REV_M 0x0000000F // Revision Number
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_INT_CTRL register.
//
//*****************************************************************************
#define NVIC_INT_CTRL_NMI_SET 0x80000000 // NMI Set Pending
#define NVIC_INT_CTRL_PEND_SV 0x10000000 // PendSV Set Pending
#define NVIC_INT_CTRL_UNPEND_SV 0x08000000 // PendSV Clear Pending
#define NVIC_INT_CTRL_PENDSTSET 0x04000000 // SysTick Set Pending
#define NVIC_INT_CTRL_PENDSTCLR 0x02000000 // SysTick Clear Pending
#define NVIC_INT_CTRL_ISR_PRE 0x00800000 // Debug Interrupt Handling
#define NVIC_INT_CTRL_ISR_PEND 0x00400000 // Interrupt Pending
#define NVIC_INT_CTRL_VEC_PEN_M 0x0007F000 // Interrupt Pending Vector Number
#define NVIC_INT_CTRL_VEC_PEN_NMI \
0x00002000 // NMI
#define NVIC_INT_CTRL_VEC_PEN_HARD \
0x00003000 // Hard fault
#define NVIC_INT_CTRL_VEC_PEN_MEM \
0x00004000 // Memory management fault
#define NVIC_INT_CTRL_VEC_PEN_BUS \
0x00005000 // Bus fault
#define NVIC_INT_CTRL_VEC_PEN_USG \
0x00006000 // Usage fault
#define NVIC_INT_CTRL_VEC_PEN_SVC \
0x0000B000 // SVCall
#define NVIC_INT_CTRL_VEC_PEN_PNDSV \
0x0000E000 // PendSV
#define NVIC_INT_CTRL_VEC_PEN_TICK \
0x0000F000 // SysTick
#define NVIC_INT_CTRL_RET_BASE 0x00000800 // Return to Base
#define NVIC_INT_CTRL_VEC_ACT_M 0x0000007F // Interrupt Pending Vector Number
#define NVIC_INT_CTRL_VEC_PEN_S 12
#define NVIC_INT_CTRL_VEC_ACT_S 0
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_VTABLE register.
//
//*****************************************************************************
#define NVIC_VTABLE_BASE 0x20000000 // Vector Table Base
#define NVIC_VTABLE_OFFSET_M 0x1FFFFE00 // Vector Table Offset
#define NVIC_VTABLE_OFFSET_S 9
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_APINT register.
//
//*****************************************************************************
#define NVIC_APINT_VECTKEY_M 0xFFFF0000 // Register Key
#define NVIC_APINT_VECTKEY 0x05FA0000 // Vector key
#define NVIC_APINT_ENDIANESS 0x00008000 // Data Endianess
#define NVIC_APINT_PRIGROUP_M 0x00000700 // Interrupt Priority Grouping
#define NVIC_APINT_PRIGROUP_7_1 0x00000000 // Priority group 7.1 split
#define NVIC_APINT_PRIGROUP_6_2 0x00000100 // Priority group 6.2 split
#define NVIC_APINT_PRIGROUP_5_3 0x00000200 // Priority group 5.3 split
#define NVIC_APINT_PRIGROUP_4_4 0x00000300 // Priority group 4.4 split
#define NVIC_APINT_PRIGROUP_3_5 0x00000400 // Priority group 3.5 split
#define NVIC_APINT_PRIGROUP_2_6 0x00000500 // Priority group 2.6 split
#define NVIC_APINT_PRIGROUP_1_7 0x00000600 // Priority group 1.7 split
#define NVIC_APINT_PRIGROUP_0_8 0x00000700 // Priority group 0.8 split
#define NVIC_APINT_SYSRESETREQ 0x00000004 // System Reset Request
#define NVIC_APINT_VECT_CLR_ACT 0x00000002 // Clear Active NMI / Fault
#define NVIC_APINT_VECT_RESET 0x00000001 // System Reset
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_SYS_CTRL register.
//
//*****************************************************************************
#define NVIC_SYS_CTRL_SEVONPEND 0x00000010 // Wake Up on Pending
#define NVIC_SYS_CTRL_SLEEPDEEP 0x00000004 // Deep Sleep Enable
#define NVIC_SYS_CTRL_SLEEPEXIT 0x00000002 // Sleep on ISR Exit
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_CFG_CTRL register.
//
//*****************************************************************************
#define NVIC_CFG_CTRL_STKALIGN 0x00000200 // Stack Alignment on Exception
// Entry
#define NVIC_CFG_CTRL_BFHFNMIGN 0x00000100 // Ignore Bus Fault in NMI and
// Fault
#define NVIC_CFG_CTRL_DIV0 0x00000010 // Trap on Divide by 0
#define NVIC_CFG_CTRL_UNALIGNED 0x00000008 // Trap on Unaligned Access
#define NVIC_CFG_CTRL_MAIN_PEND 0x00000002 // Allow Main Interrupt Trigger
#define NVIC_CFG_CTRL_BASE_THR 0x00000001 // Thread State Control
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_SYS_PRI1 register.
//
//*****************************************************************************
#define NVIC_SYS_PRI1_USAGE_M 0x00E00000 // Usage Fault Priority
#define NVIC_SYS_PRI1_BUS_M 0x0000E000 // Bus Fault Priority
#define NVIC_SYS_PRI1_MEM_M 0x000000E0 // Memory Management Fault Priority
#define NVIC_SYS_PRI1_USAGE_S 21
#define NVIC_SYS_PRI1_BUS_S 13
#define NVIC_SYS_PRI1_MEM_S 5
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_SYS_PRI2 register.
//
//*****************************************************************************
#define NVIC_SYS_PRI2_SVC_M 0xE0000000 // SVCall Priority
#define NVIC_SYS_PRI2_SVC_S 29
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_SYS_PRI3 register.
//
//*****************************************************************************
#define NVIC_SYS_PRI3_TICK_M 0xE0000000 // SysTick Exception Priority
#define NVIC_SYS_PRI3_PENDSV_M 0x00E00000 // PendSV Priority
#define NVIC_SYS_PRI3_DEBUG_M 0x000000E0 // Debug Priority
#define NVIC_SYS_PRI3_TICK_S 29
#define NVIC_SYS_PRI3_PENDSV_S 21
#define NVIC_SYS_PRI3_DEBUG_S 5
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_SYS_HND_CTRL
// register.
//
//*****************************************************************************
#define NVIC_SYS_HND_CTRL_USAGE 0x00040000 // Usage Fault Enable
#define NVIC_SYS_HND_CTRL_BUS 0x00020000 // Bus Fault Enable
#define NVIC_SYS_HND_CTRL_MEM 0x00010000 // Memory Management Fault Enable
#define NVIC_SYS_HND_CTRL_SVC 0x00008000 // SVC Call Pending
#define NVIC_SYS_HND_CTRL_BUSP 0x00004000 // Bus Fault Pending
#define NVIC_SYS_HND_CTRL_MEMP 0x00002000 // Memory Management Fault Pending
#define NVIC_SYS_HND_CTRL_USAGEP \
0x00001000 // Usage Fault Pending
#define NVIC_SYS_HND_CTRL_TICK 0x00000800 // SysTick Exception Active
#define NVIC_SYS_HND_CTRL_PNDSV 0x00000400 // PendSV Exception Active
#define NVIC_SYS_HND_CTRL_MON 0x00000100 // Debug Monitor Active
#define NVIC_SYS_HND_CTRL_SVCA 0x00000080 // SVC Call Active
#define NVIC_SYS_HND_CTRL_USGA 0x00000008 // Usage Fault Active
#define NVIC_SYS_HND_CTRL_BUSA 0x00000002 // Bus Fault Active
#define NVIC_SYS_HND_CTRL_MEMA 0x00000001 // Memory Management Fault Active
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_FAULT_STAT
// register.
//
//*****************************************************************************
#define NVIC_FAULT_STAT_DIV0 0x02000000 // Divide-by-Zero Usage Fault
#define NVIC_FAULT_STAT_UNALIGN 0x01000000 // Unaligned Access Usage Fault
#define NVIC_FAULT_STAT_NOCP 0x00080000 // No Coprocessor Usage Fault
#define NVIC_FAULT_STAT_INVPC 0x00040000 // Invalid PC Load Usage Fault
#define NVIC_FAULT_STAT_INVSTAT 0x00020000 // Invalid State Usage Fault
#define NVIC_FAULT_STAT_UNDEF 0x00010000 // Undefined Instruction Usage
// Fault
#define NVIC_FAULT_STAT_BFARV 0x00008000 // Bus Fault Address Register Valid
#define NVIC_FAULT_STAT_BSTKE 0x00001000 // Stack Bus Fault
#define NVIC_FAULT_STAT_BUSTKE 0x00000800 // Unstack Bus Fault
#define NVIC_FAULT_STAT_IMPRE 0x00000400 // Imprecise Data Bus Error
#define NVIC_FAULT_STAT_PRECISE 0x00000200 // Precise Data Bus Error
#define NVIC_FAULT_STAT_IBUS 0x00000100 // Instruction Bus Error
#define NVIC_FAULT_STAT_MMARV 0x00000080 // Memory Management Fault Address
// Register Valid
#define NVIC_FAULT_STAT_MSTKE 0x00000010 // Stack Access Violation
#define NVIC_FAULT_STAT_MUSTKE 0x00000008 // Unstack Access Violation
#define NVIC_FAULT_STAT_DERR 0x00000002 // Data Access Violation
#define NVIC_FAULT_STAT_IERR 0x00000001 // Instruction Access Violation
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_HFAULT_STAT
// register.
//
//*****************************************************************************
#define NVIC_HFAULT_STAT_DBG 0x80000000 // Debug Event
#define NVIC_HFAULT_STAT_FORCED 0x40000000 // Forced Hard Fault
#define NVIC_HFAULT_STAT_VECT 0x00000002 // Vector Table Read Fault
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_DEBUG_STAT
// register.
//
//*****************************************************************************
#define NVIC_DEBUG_STAT_EXTRNL 0x00000010 // EDBGRQ asserted
#define NVIC_DEBUG_STAT_VCATCH 0x00000008 // Vector catch
#define NVIC_DEBUG_STAT_DWTTRAP 0x00000004 // DWT match
#define NVIC_DEBUG_STAT_BKPT 0x00000002 // Breakpoint instruction
#define NVIC_DEBUG_STAT_HALTED 0x00000001 // Halt request
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_MM_ADDR register.
//
//*****************************************************************************
#define NVIC_MM_ADDR_M 0xFFFFFFFF // Fault Address
#define NVIC_MM_ADDR_S 0
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_FAULT_ADDR
// register.
//
//*****************************************************************************
#define NVIC_FAULT_ADDR_M 0xFFFFFFFF // Fault Address
#define NVIC_FAULT_ADDR_S 0
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_MPU_TYPE register.
//
//*****************************************************************************
#define NVIC_MPU_TYPE_IREGION_M 0x00FF0000 // Number of I Regions
#define NVIC_MPU_TYPE_DREGION_M 0x0000FF00 // Number of D Regions
#define NVIC_MPU_TYPE_SEPARATE 0x00000001 // Separate or Unified MPU
#define NVIC_MPU_TYPE_IREGION_S 16
#define NVIC_MPU_TYPE_DREGION_S 8
//*****************************************************************************
//
// The following are defines for the bit fields in the NVIC_MPU_CTRL register.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -