CPU Module

The cpu API includes a header file with basic functions to read and set some core registers like enabling or disabling interrupts, reading or setting PRIMASK, BASEPRI registers etc.

group cpu_api

The module is used for configuring Cortex-M core registers.

Defines

NOP __asm(" NOP")

Functions

uint32_t CPU_setFAULTMASK(void)

Returns the state of FAULTMASK register on entry and disable all interrupts except NMI.

This function is wrapper function for the CPSID instruction. It returns the state of FAULTMASK on entry and disable all interrupts except NMI.

Return

Returns the state of FAULTMASK register.

uint32_t CPU_getFAULTMASK(void)

Returns the state of FAULTMASK register

This function is wrapper function for returning the state of FAULTMASK register(indicating whether interrupts except NMI are enabled or disabled).

Return

Returns the state of FAULTMASK register.

uint32_t CPU_clearFAULTMASK(void)

Returns the state of FAULTMASK register and enable the interrupts

This function is wrapper function for returning the state of FAULTMASK register and enabling the interrupts.

Return

Returns the state of FAULTMASK register.

uint32_t CPU_setPRIMASK(void)

Returns the state of PRIMASK register on entry and disable interrupts

This function is wrapper function for the CPSID instruction. It returns the state of PRIMASK on entry and disable interrupts.

Return

Returns the state of PRIMASK register.

uint32_t CPU_getPRIMASK(void)

Returns the state of PRIMASK register

This function is wrapper function for returning the state of PRIMASK register(indicating whether interrupts are enabled or disabled).

Return

Returns the state of PRIMASK register.

uint32_t CPU_clearPRIMASK(void)

Returns the state of PRIMASK register and enable the interrupts

This function is wrapper function for returning the state of PRIMASK register and enabling the interrupts.

Return

Returns the state of PRIMASK register.

void CPU_wfi(void)

Wrapper function for the WFI instruction

This function is wrapper function for the WFI instruction.

Return

None

void CPU_setBASEPRI(uint32_t basePriority)

Writes the BASEPRI register

This function is wrapper function for writing the BASEPRI register. MSB 3-bits are enabled for setting the priority and non-implemented low-order bits read as zero and ignore writes. To set the base priority of 0x2U, the param

basePriority to be passed should be 0x20U.
Parameters
  • basePriority: is the value to be set

Return

None.

uint32_t CPU_getBASEPRI(void)

Returns the state of BASEPRI register

This function is wrapper function for reading the BASEPRI register.

Return

Returns the state of BASEPRI register

uint32_t __get_PRIMASK(void)
uint32_t _disable_interrupts(void)
uint32_t _enable_interrupts()
uint32_t _disable_IRQ()
uint32_t _enable_IRQ()
uint32_t _set_interrupt_priority(uint32_t priority)

The code for this module is contained in driverlib_cm/cpu.h