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
epoch.hpp File Reference

A 32-bit counter extended to 64 bits by counting its overflows. More...

Detailed Description

A 32-bit counter extended to 64 bits by counting its overflows.

The port's counter wraps at 2^32; its overflow interrupt calls on_overflow(), which counts the wrap and acknowledges the flag. count64() reads the epoch, the count and the pending flag and retries if the epoch moved under it. A wrap the handler has not serviced yet shows as the flag set with a small count, and counts as one more epoch.

The handler's two writes are not atomic as a pair, so the overflow interrupt must run at a level no reader of count64() preempts. The bound: the handler runs within half a wrap period, 35.8 minutes at 1 MHz.

A template over the port so it is unit-tested with a fake counter.

Definition in file epoch.hpp.

#include <cstdint>

Go to the source code of this file.

Classes

class  sbl::system::Epoch< Port >
 

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.