Loading...
Searching...
No Matches
Busy Waiting low-level helpers

This modules provides helper functions for busy waiting on short intervals before timers are initialized, e.g. More...

Detailed Description

This modules provides helper functions for busy waiting on short intervals before timers are initialized, e.g.

in board_init().

Author
Benjamin Valentin benja.nosp@m.min..nosp@m.valen.nosp@m.tin@.nosp@m.ml-pa.nosp@m..com

Macros

#define CPU_CYCLES_PER_LOOP   3
 CPU cycles per busy wait loop iteration.
 

Functions

static void busy_wait (unsigned loops)
 Spin for a number of cycles.
 
static void busy_wait_us (unsigned usec)
 Spin for a number of microseconds.
 

Macro Definition Documentation

◆ CPU_CYCLES_PER_LOOP

#define CPU_CYCLES_PER_LOOP   3

CPU cycles per busy wait loop iteration.

This can be used to roughly estimate the number of cycles for a given wait time.

Definition at line 39 of file busy_wait.h.

Function Documentation

◆ busy_wait()

static void busy_wait ( unsigned  loops)
inlinestatic

Spin for a number of cycles.

This will not take into account cycles spent on interrupts if they are enabled and occur.

Parameters
loopsNumber of loop iterations to take

Definition at line 50 of file busy_wait.h.

◆ busy_wait_us()

static void busy_wait_us ( unsigned  usec)
inlinestatic

Spin for a number of microseconds.

This will roughly try to match the requested delay time, but don't expect high accuracy.

This will not take into account cycles spent on interrupts if they are enabled and occur.

Parameters
usecNumber of µs to spin for.

Definition at line 77 of file busy_wait.h.