libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
Cortex-M System Control Block

The System Control Block is a section of the System Control Space. More...

Collaboration diagram for Cortex-M System Control Block:

Data Structures

struct  scb_exception_stack_frame
 

Modules

 SCB Registers
 
 SCB_CPUID Values
 
 SCB_ICSR Values
 
 SCB_VTOR Values
 
 SCB_AICR Values
 
 SCB_SCR Values
 
 SCB_CCR Values
 

Macros

#define SCB_SHPR_PRI_4_MEMMANAGE   0
 
#define SCB_SHPR_PRI_5_BUSFAULT   1
 
#define SCB_SHPR_PRI_6_USAGEFAULT   2
 
#define SCB_SHPR_PRI_7_RESERVED   3
 
#define SCB_SHPR_PRI_8_RESERVED   4
 
#define SCB_SHPR_PRI_9_RESERVED   5
 
#define SCB_SHPR_PRI_10_RESERVED   6
 
#define SCB_SHPR_PRI_11_SVCALL   7
 
#define SCB_SHPR_PRI_12_RESERVED   8
 
#define SCB_SHPR_PRI_13_RESERVED   9
 
#define SCB_SHPR_PRI_14_PENDSV   10
 
#define SCB_SHPR_PRI_15_SYSTICK   11
 
#define SCB_SHCSR_USGFAULTENA   (1 << 18)
 
#define SCB_SHCSR_BUSFAULTENA   (1 << 17)
 
#define SCB_SHCSR_MEMFAULTENA   (1 << 16)
 
#define SCB_SHCSR_SVCALLPENDED   (1 << 15)
 
#define SCB_SHCSR_BUSFAULTPENDED   (1 << 14)
 
#define SCB_SHCSR_MEMFAULTPENDED   (1 << 13)
 
#define SCB_SHCSR_USGFAULTPENDED   (1 << 12)
 
#define SCB_SHCSR_SYSTICKACT   (1 << 11)
 
#define SCB_SHCSR_PENDSVACT   (1 << 10)
 
#define SCB_SHCSR_MONITORACT   (1 << 8)
 
#define SCB_SHCSR_SVCALLACT   (1 << 7)
 
#define SCB_SHCSR_USGFAULTACT   (1 << 3)
 
#define SCB_SHCSR_BUSFAULTACT   (1 << 1)
 
#define SCB_SHCSR_MEMFAULTACT   (1 << 0)
 
#define SCB_CFSR_DIVBYZERO   (1 << 25)
 
#define SCB_CFSR_UNALIGNED   (1 << 24)
 
#define SCB_CFSR_NOCP   (1 << 19)
 
#define SCB_CFSR_INVPC   (1 << 18)
 
#define SCB_CFSR_INVSTATE   (1 << 17)
 
#define SCB_CFSR_UNDEFINSTR   (1 << 16)
 
#define SCB_CFSR_BFARVALID   (1 << 15)
 
#define SCB_CFSR_STKERR   (1 << 12)
 
#define SCB_CFSR_UNSTKERR   (1 << 11)
 
#define SCB_CFSR_IMPRECISERR   (1 << 10)
 
#define SCB_CFSR_PRECISERR   (1 << 9)
 
#define SCB_CFSR_IBUSERR   (1 << 8)
 
#define SCB_CFSR_MMARVALID   (1 << 7)
 
#define SCB_CFSR_MSTKERR   (1 << 4)
 
#define SCB_CFSR_MUNSTKERR   (1 << 3)
 
#define SCB_CFSR_DACCVIOL   (1 << 1)
 
#define SCB_CFSR_IACCVIOL   (1 << 0)
 
#define SCB_HFSR_DEBUG_VT   (1 << 31)
 
#define SCB_HFSR_FORCED   (1 << 30)
 
#define SCB_HFSR_VECTTBL   (1 << 1)
 
#define SCB_CTR_FORMAT_SHIFT   29
 
#define SCB_CTR_FORMAT_MASK   0x7
 
#define SCB_CTR_CWG_SHIFT   24
 
#define SCB_CTR_CWG_MASK   0xf
 
#define SCB_CTR_ERG_SHIFT   20
 
#define SCB_CTR_ERG_MASK   0xf
 
#define SCB_CTR_DMINLINE_SHIFT   16
 
#define SCB_CTR_DMINLINE_MASK   0x1f
 
#define SCB_CTR_IMINLINE_SHIFT   0
 
#define SCB_CTR_IMINLINE_MASK   0xf
 
#define SCB_CPACR_NONE   0 /* Access denied */
 
#define SCB_CPACR_PRIV   1 /* Privileged access only */
 
#define SCB_CPACR_FULL   3 /* Full access */
 
#define SCB_CPACR_CP10   (1 << 20)
 
#define SCB_CPACR_CP11   (1 << 22)
 
#define SCB_GET_EXCEPTION_STACK_FRAME(f)
 

Functions

void scb_reset_system (void)
 
void scb_reset_core (void)
 
void scb_set_priority_grouping (uint32_t prigroup)
 

Detailed Description

The System Control Block is a section of the System Control Space.

Other members of the SCS are, for instance, DWT, ITM, SYSTICKK. The exact details of the SCB are defined in the "Architecture Reference Manual" for either ARMv7-M or ARMV6-m.

Macro Definition Documentation

◆ SCB_CFSR_BFARVALID

#define SCB_CFSR_BFARVALID   (1 << 15)

Definition at line 458 of file scb.h.

◆ SCB_CFSR_DACCVIOL

#define SCB_CFSR_DACCVIOL   (1 << 1)

Definition at line 479 of file scb.h.

◆ SCB_CFSR_DIVBYZERO

#define SCB_CFSR_DIVBYZERO   (1 << 25)

Definition at line 445 of file scb.h.

◆ SCB_CFSR_IACCVIOL

#define SCB_CFSR_IACCVIOL   (1 << 0)

Definition at line 481 of file scb.h.

◆ SCB_CFSR_IBUSERR

#define SCB_CFSR_IBUSERR   (1 << 8)

Definition at line 469 of file scb.h.

◆ SCB_CFSR_IMPRECISERR

#define SCB_CFSR_IMPRECISERR   (1 << 10)

Definition at line 465 of file scb.h.

◆ SCB_CFSR_INVPC

#define SCB_CFSR_INVPC   (1 << 18)

Definition at line 452 of file scb.h.

◆ SCB_CFSR_INVSTATE

#define SCB_CFSR_INVSTATE   (1 << 17)

Definition at line 454 of file scb.h.

◆ SCB_CFSR_MMARVALID

#define SCB_CFSR_MMARVALID   (1 << 7)

Definition at line 471 of file scb.h.

◆ SCB_CFSR_MSTKERR

#define SCB_CFSR_MSTKERR   (1 << 4)

Definition at line 474 of file scb.h.

◆ SCB_CFSR_MUNSTKERR

#define SCB_CFSR_MUNSTKERR   (1 << 3)

Definition at line 476 of file scb.h.

◆ SCB_CFSR_NOCP

#define SCB_CFSR_NOCP   (1 << 19)

Definition at line 450 of file scb.h.

◆ SCB_CFSR_PRECISERR

#define SCB_CFSR_PRECISERR   (1 << 9)

Definition at line 467 of file scb.h.

◆ SCB_CFSR_STKERR

#define SCB_CFSR_STKERR   (1 << 12)

Definition at line 461 of file scb.h.

◆ SCB_CFSR_UNALIGNED

#define SCB_CFSR_UNALIGNED   (1 << 24)

Definition at line 447 of file scb.h.

◆ SCB_CFSR_UNDEFINSTR

#define SCB_CFSR_UNDEFINSTR   (1 << 16)

Definition at line 456 of file scb.h.

◆ SCB_CFSR_UNSTKERR

#define SCB_CFSR_UNSTKERR   (1 << 11)

Definition at line 463 of file scb.h.

◆ SCB_CPACR_CP10

#define SCB_CPACR_CP10   (1 << 20)

Definition at line 530 of file scb.h.

◆ SCB_CPACR_CP11

#define SCB_CPACR_CP11   (1 << 22)

Definition at line 532 of file scb.h.

◆ SCB_CPACR_FULL

#define SCB_CPACR_FULL   3 /* Full access */

Definition at line 527 of file scb.h.

◆ SCB_CPACR_NONE

#define SCB_CPACR_NONE   0 /* Access denied */

Definition at line 525 of file scb.h.

◆ SCB_CPACR_PRIV

#define SCB_CPACR_PRIV   1 /* Privileged access only */

Definition at line 526 of file scb.h.

◆ SCB_CTR_CWG_MASK

#define SCB_CTR_CWG_MASK   0xf

Definition at line 509 of file scb.h.

◆ SCB_CTR_CWG_SHIFT

#define SCB_CTR_CWG_SHIFT   24

Definition at line 508 of file scb.h.

◆ SCB_CTR_DMINLINE_MASK

#define SCB_CTR_DMINLINE_MASK   0x1f

Definition at line 515 of file scb.h.

◆ SCB_CTR_DMINLINE_SHIFT

#define SCB_CTR_DMINLINE_SHIFT   16

Definition at line 514 of file scb.h.

◆ SCB_CTR_ERG_MASK

#define SCB_CTR_ERG_MASK   0xf

Definition at line 512 of file scb.h.

◆ SCB_CTR_ERG_SHIFT

#define SCB_CTR_ERG_SHIFT   20

Definition at line 511 of file scb.h.

◆ SCB_CTR_FORMAT_MASK

#define SCB_CTR_FORMAT_MASK   0x7

Definition at line 506 of file scb.h.

◆ SCB_CTR_FORMAT_SHIFT

#define SCB_CTR_FORMAT_SHIFT   29

Definition at line 505 of file scb.h.

◆ SCB_CTR_IMINLINE_MASK

#define SCB_CTR_IMINLINE_MASK   0xf

Definition at line 518 of file scb.h.

◆ SCB_CTR_IMINLINE_SHIFT

#define SCB_CTR_IMINLINE_SHIFT   0

Definition at line 517 of file scb.h.

◆ SCB_GET_EXCEPTION_STACK_FRAME

#define SCB_GET_EXCEPTION_STACK_FRAME (   f)
Value:
do { \
asm volatile ("mov %[frameptr], sp" \
: [frameptr]"=r" (f)); \
} while (0)

Definition at line 550 of file scb.h.

◆ SCB_HFSR_DEBUG_VT

#define SCB_HFSR_DEBUG_VT   (1 << 31)

Definition at line 486 of file scb.h.

◆ SCB_HFSR_FORCED

#define SCB_HFSR_FORCED   (1 << 30)

Definition at line 488 of file scb.h.

◆ SCB_HFSR_VECTTBL

#define SCB_HFSR_VECTTBL   (1 << 1)

Definition at line 491 of file scb.h.

◆ SCB_SHCSR_BUSFAULTACT

#define SCB_SHCSR_BUSFAULTACT   (1 << 1)

Definition at line 437 of file scb.h.

◆ SCB_SHCSR_BUSFAULTENA

#define SCB_SHCSR_BUSFAULTENA   (1 << 17)

Definition at line 407 of file scb.h.

◆ SCB_SHCSR_BUSFAULTPENDED

#define SCB_SHCSR_BUSFAULTPENDED   (1 << 14)

Definition at line 418 of file scb.h.

◆ SCB_SHCSR_MEMFAULTACT

#define SCB_SHCSR_MEMFAULTACT   (1 << 0)

Definition at line 439 of file scb.h.

◆ SCB_SHCSR_MEMFAULTENA

#define SCB_SHCSR_MEMFAULTENA   (1 << 16)

Definition at line 409 of file scb.h.

◆ SCB_SHCSR_MEMFAULTPENDED

#define SCB_SHCSR_MEMFAULTPENDED   (1 << 13)

Definition at line 420 of file scb.h.

◆ SCB_SHCSR_MONITORACT

#define SCB_SHCSR_MONITORACT   (1 << 8)

Definition at line 429 of file scb.h.

◆ SCB_SHCSR_PENDSVACT

#define SCB_SHCSR_PENDSVACT   (1 << 10)

Definition at line 426 of file scb.h.

◆ SCB_SHCSR_SVCALLACT

#define SCB_SHCSR_SVCALLACT   (1 << 7)

Definition at line 431 of file scb.h.

◆ SCB_SHCSR_SVCALLPENDED

#define SCB_SHCSR_SVCALLPENDED   (1 << 15)

Definition at line 413 of file scb.h.

◆ SCB_SHCSR_SYSTICKACT

#define SCB_SHCSR_SYSTICKACT   (1 << 11)

Definition at line 424 of file scb.h.

◆ SCB_SHCSR_USGFAULTACT

#define SCB_SHCSR_USGFAULTACT   (1 << 3)

Definition at line 434 of file scb.h.

◆ SCB_SHCSR_USGFAULTENA

#define SCB_SHCSR_USGFAULTENA   (1 << 18)

Definition at line 405 of file scb.h.

◆ SCB_SHCSR_USGFAULTPENDED

#define SCB_SHCSR_USGFAULTPENDED   (1 << 12)

Definition at line 422 of file scb.h.

◆ SCB_SHPR_PRI_10_RESERVED

#define SCB_SHPR_PRI_10_RESERVED   6

Definition at line 390 of file scb.h.

◆ SCB_SHPR_PRI_11_SVCALL

#define SCB_SHPR_PRI_11_SVCALL   7

Definition at line 391 of file scb.h.

◆ SCB_SHPR_PRI_12_RESERVED

#define SCB_SHPR_PRI_12_RESERVED   8

Definition at line 393 of file scb.h.

◆ SCB_SHPR_PRI_13_RESERVED

#define SCB_SHPR_PRI_13_RESERVED   9

Definition at line 394 of file scb.h.

◆ SCB_SHPR_PRI_14_PENDSV

#define SCB_SHPR_PRI_14_PENDSV   10

Definition at line 395 of file scb.h.

◆ SCB_SHPR_PRI_15_SYSTICK

#define SCB_SHPR_PRI_15_SYSTICK   11

Definition at line 396 of file scb.h.

◆ SCB_SHPR_PRI_4_MEMMANAGE

#define SCB_SHPR_PRI_4_MEMMANAGE   0

Definition at line 383 of file scb.h.

◆ SCB_SHPR_PRI_5_BUSFAULT

#define SCB_SHPR_PRI_5_BUSFAULT   1

Definition at line 384 of file scb.h.

◆ SCB_SHPR_PRI_6_USAGEFAULT

#define SCB_SHPR_PRI_6_USAGEFAULT   2

Definition at line 385 of file scb.h.

◆ SCB_SHPR_PRI_7_RESERVED

#define SCB_SHPR_PRI_7_RESERVED   3

Definition at line 386 of file scb.h.

◆ SCB_SHPR_PRI_8_RESERVED

#define SCB_SHPR_PRI_8_RESERVED   4

Definition at line 388 of file scb.h.

◆ SCB_SHPR_PRI_9_RESERVED

#define SCB_SHPR_PRI_9_RESERVED   5

Definition at line 389 of file scb.h.

Function Documentation

◆ scb_reset_core()

void scb_reset_core ( void  )

Definition at line 46 of file scb.c.

References SCB_AIRCR, SCB_AIRCR_VECTKEY, and SCB_AIRCR_VECTRESET.

◆ scb_reset_system()

void scb_reset_system ( void  )

Definition at line 54 of file scb.c.

References SCB_AIRCR, SCB_AIRCR_SYSRESETREQ, and SCB_AIRCR_VECTKEY.

◆ scb_set_priority_grouping()

void scb_set_priority_grouping ( uint32_t  prigroup)

Definition at line 63 of file scb.c.

References SCB_AIRCR, and SCB_AIRCR_VECTKEY.