CC26xx Driver Library
[cpu] CPU

Functions

uint32_t CPUcpsid (void)
 Disable all external interrupts. More...
 
uint32_t CPUprimask (void)
 Get the current interrupt state. More...
 
uint32_t CPUcpsie (void)
 Enable all external interrupts. More...
 
static void CPUwfi (void)
 Wait for interrupt. More...
 
static void CPUwfe (void)
 Wait for event. More...
 
static void CPUsev (void)
 Send event. More...
 
static void CPUbasepriSet (uint32_t ui32NewBasepri)
 Update the interrupt priority disable level. More...
 
uint32_t CPUbasepriGet (void)
 Get the interrupt priority disable level. More...
 
void CPUdelay (uint32_t ui32Count)
 Provide a small delay. More...
 
static void CPU_WriteBufferDisable (void)
 Disable CPU write buffering (recommended for debug purpose only). More...
 
static void CPU_WriteBufferEnable (void)
 Enable CPU write buffering (default setting). More...
 

Detailed Description

Introduction

The CPU API provides a set of functions performing very low-level control of the system CPU. All functions in this API are written in assembler in order to either access special registers or avoid any compiler optimizations. Each function exists in several compiler specific versions: One version for each supported compiler.

Function Documentation

static void CPU_WriteBufferDisable ( void  )
inlinestatic

Disable CPU write buffering (recommended for debug purpose only).

This function helps debugging "bus fault crashes". Disables write buffer use during default memory map accesses.

This causes all bus faults to be precise bus faults but decreases the performance of the processor because the stores to memory have to complete before the next instruction can be executed.

Returns
None
See also
CPU_WriteBufferEnable()
352 {
354 }
static void CPU_WriteBufferEnable ( void  )
inlinestatic

Enable CPU write buffering (default setting).

Re-enables write buffer during default memory map accesses if CPU_WriteBufferDisable() has been used for bus fault debugging.

Returns
None
See also
CPU_WriteBufferDisable()
370 {
372 }
uint32_t CPUbasepriGet ( void  )

Get the interrupt priority disable level.

Use this function to get the the level of priority that will disable interrupts with a lower priority level.

Returns
Returns the value of the BASEPRI register.

Referenced by IntPriorityMaskGet().

278 {
279  // Read BASEPRI.
280  __asm(" mrs r0, BASEPRI\n"
281  " bx lr\n");
282 
283  // The following keeps the compiler happy, because it wants to see a
284  // return value from this function. It will generate code to return
285  // a zero. However, the real return is the "bx lr" above, so the
286  // return(0) is never executed and the function returns with the value
287  // you expect in R0.
288  return(0);
289 }
__asm(" .sect \".text:NOROM_CPUdelay\"\n"" .clink\n"" .thumbfunc NOROM_CPUdelay\n"" .thumb\n"" .global NOROM_CPUdelay\n""NOROM_CPUdelay:\n"" subs r0, #1\n"" bne.n NOROM_CPUdelay\n"" bx lr\n")
Provide a small delay.

Here is the call graph for this function:

static void CPUbasepriSet ( uint32_t  ui32NewBasepri)
inlinestatic

Update the interrupt priority disable level.

Use this function to change the level of priority that will disable interrupts with a lower priority level.

Parameters
ui32NewBasepriis the new basis priority level to set.
Returns
None

Referenced by IntPriorityMaskSet().

288 {
289  // Set the BASEPRI register.
290  __asm(" msr BASEPRI, r0\n");
291 }
__asm(" .sect \".text:NOROM_CPUdelay\"\n"" .clink\n"" .thumbfunc NOROM_CPUdelay\n"" .thumb\n"" .global NOROM_CPUdelay\n""NOROM_CPUdelay:\n"" subs r0, #1\n"" bne.n NOROM_CPUdelay\n"" bx lr\n")
Provide a small delay.

Here is the call graph for this function:

uint32_t CPUcpsid ( void  )

Disable all external interrupts.

Use this function to disable all system interrupts. This function is implemented as a wrapper function for the CPSID instruction.

Returns
Returns the state of PRIMASK on entry

Referenced by AuxAdiDdiSafeRead(), AuxAdiDdiSafeWrite(), IntMasterDisable(), SafeHapiAuxAdiSelect(), SafeHapiVoid(), and SysCtrlSystemReset().

92 {
93  // Read PRIMASK and disable interrupts.
94  __asm(" mrs r0, PRIMASK\n"
95  " cpsid i\n"
96  " bx lr\n");
97 
98  // The following keeps the compiler happy, because it wants to see a
99  // return value from this function. It will generate code to return
100  // a zero. However, the real return is the "bx lr" above, so the
101  // return(0) is never executed and the function returns with the value
102  // you expect in R0.
103  return(0);
104 }
__asm(" .sect \".text:NOROM_CPUdelay\"\n"" .clink\n"" .thumbfunc NOROM_CPUdelay\n"" .thumb\n"" .global NOROM_CPUdelay\n""NOROM_CPUdelay:\n"" subs r0, #1\n"" bne.n NOROM_CPUdelay\n"" bx lr\n")
Provide a small delay.

Here is the call graph for this function:

uint32_t CPUcpsie ( void  )

Enable all external interrupts.

Use this function to enable all system interrupts. This function is implemented as a wrapper function for the CPSIE instruction.

Returns
Returns the state of PRIMASK on entry.

Referenced by AuxAdiDdiSafeRead(), AuxAdiDdiSafeWrite(), IntMasterEnable(), SafeHapiAuxAdiSelect(), and SafeHapiVoid().

216 {
217  // Read PRIMASK and enable interrupts.
218  __asm(" mrs r0, PRIMASK\n"
219  " cpsie i\n"
220  " bx lr\n");
221 
222  // The following keeps the compiler happy, because it wants to see a
223  // return value from this function. It will generate code to return
224  // a zero. However, the real return is the "bx lr" above, so the
225  // return(0) is never executed and the function returns with the value
226  // you expect in R0.
227  return(0);
228 }
__asm(" .sect \".text:NOROM_CPUdelay\"\n"" .clink\n"" .thumbfunc NOROM_CPUdelay\n"" .thumb\n"" .global NOROM_CPUdelay\n""NOROM_CPUdelay:\n"" subs r0, #1\n"" bne.n NOROM_CPUdelay\n"" bx lr\n")
Provide a small delay.

Here is the call graph for this function:

void CPUdelay ( uint32_t  ui32Count)

Provide a small delay.

This function provides means for generating a constant length delay. It is written in assembly to keep the delay consistent across tool chains, avoiding the need to tune the delay based on the tool chain in use.

The loop takes 3 cycles/loop.

Parameters
ui32Countis the number of delay loop iterations to perform.
Returns
None

Referenced by CRYPTOAesCbc(), CRYPTOAesEcb(), CRYPTOAesLoadKey(), CRYPTOCcmAuthEncrypt(), CRYPTOCcmAuthEncryptResultGet(), CRYPTOCcmInvAuthDecrypt(), CRYPTOCcmInvAuthDecryptResultGet(), and I2CMasterControl().

uint32_t CPUprimask ( void  )

Get the current interrupt state.

Use this function to retrieve the current state of the interrupts. This function is implemented as a wrapper function returning the state of PRIMASK.

Returns
Returns the state of the PRIMASK (indicating whether interrupts are enabled or disabled).
154 {
155  // Read PRIMASK.
156  __asm(" mrs r0, PRIMASK\n"
157  " bx lr\n");
158 
159  // The following keeps the compiler happy, because it wants to see a
160  // return value from this function. It will generate code to return
161  // a zero. However, the real return is the "bx lr" above, so the
162  // return(0) is never executed and the function returns with the value
163  // you expect in R0.
164  return(0);
165 }
__asm(" .sect \".text:NOROM_CPUdelay\"\n"" .clink\n"" .thumbfunc NOROM_CPUdelay\n"" .thumb\n"" .global NOROM_CPUdelay\n""NOROM_CPUdelay:\n"" subs r0, #1\n"" bne.n NOROM_CPUdelay\n"" bx lr\n")
Provide a small delay.

Here is the call graph for this function:

static void CPUsev ( void  )
inlinestatic

Send event.

Use this function to let the System CPU send an event. This function is implemented as a wrapper function for the SEV instruction.

Returns
None
244 {
245  // Send event.
246  __asm(" sev\n");
247 }
__asm(" .sect \".text:NOROM_CPUdelay\"\n"" .clink\n"" .thumbfunc NOROM_CPUdelay\n"" .thumb\n"" .global NOROM_CPUdelay\n""NOROM_CPUdelay:\n"" subs r0, #1\n"" bne.n NOROM_CPUdelay\n"" bx lr\n")
Provide a small delay.

Here is the call graph for this function:

static void CPUwfe ( void  )
inlinestatic

Wait for event.

Use this function to let the System CPU wait for the next event. This function is implemented as a wrapper function for the WFE instruction.

Returns
None
203 {
204  // Wait for the next event.
205  __asm(" wfe\n");
206 }
__asm(" .sect \".text:NOROM_CPUdelay\"\n"" .clink\n"" .thumbfunc NOROM_CPUdelay\n"" .thumb\n"" .global NOROM_CPUdelay\n""NOROM_CPUdelay:\n"" subs r0, #1\n"" bne.n NOROM_CPUdelay\n"" bx lr\n")
Provide a small delay.

Here is the call graph for this function:

static void CPUwfi ( void  )
inlinestatic

Wait for interrupt.

Use this function to let the System CPU wait for the next interrupt. This function is implemented as a wrapper function for the WFI instruction.

Returns
None

Referenced by PRCMDeepSleep(), and PRCMSleep().

162 {
163  // Wait for the next interrupt.
164  __asm(" wfi\n");
165 }
__asm(" .sect \".text:NOROM_CPUdelay\"\n"" .clink\n"" .thumbfunc NOROM_CPUdelay\n"" .thumb\n"" .global NOROM_CPUdelay\n""NOROM_CPUdelay:\n"" subs r0, #1\n"" bne.n NOROM_CPUdelay\n"" bx lr\n")
Provide a small delay.

Here is the call graph for this function: