Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
timer.hpp File Reference

The system timer: the count, 64-bit time, busy waits and millis() More...

Detailed Description

The system timer: the count, 64-bit time, busy waits and millis()

The system layer's timebase over the target's tick port (<sbl/system/port/tick.hpp>, contract tick_requirements.hpp), modeled on CMSIS-RTOS2's kernel system timer: count() is the rolling 32-bit count (osKernelGetSysTimerCount), rate() its frequency (osKernelGetSysTimerFreq), a constexpr here. count64() extends it with Epoch; millis() is that in milliseconds, truncated to 32 bits so it wraps at 2^32 ms, which is what TinyUSB's millisecond hook expects. The busy waits spin on count deltas with no interrupt involved, so they work at any execution level.

The driver's init() calls init() once the port counts, on every boot path; apps call neither.

Definition in file timer.hpp.

#include <cstdint>
#include <sbl/system/epoch.hpp>
#include <sbl/system/port/tick.hpp>
#include <sbl/system/port/tick_requirements.hpp>

Go to the source code of this file.

Classes

struct  sbl::system::timer::MillisTimestamp
 

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs code.
 
namespace  sbl::system
 The system layer: execution levels, the control critical section, ring buffers, assertions and the fault handler, profiling, and the port contracts.
 
namespace  sbl::system::timer
 The system timer over the tick port: the count, the 64-bit count, busy waits and milliseconds.
 

Typedefs

using sbl::system::timer::Port = sbl::driver::Tick
 

Functions

constexpr uint32_t sbl::system::timer::rate ()
 
uint32_t sbl::system::timer::count ()
 
uint64_t sbl::system::timer::count64 ()
 
void sbl::system::timer::init ()
 
void sbl::system::timer::busy_wait_us (uint32_t us)
 
void sbl::system::timer::busy_wait_ms (uint32_t ms)
 
uint32_t sbl::system::timer::millis ()