embassy-mcxa

Crates

git

Versions

mcx-a256

Flavors

Module ostimer

Module ostimer 

Source
Expand description

§OSTIMER Driver with Robustness Features

This module provides an async timer driver for the NXP MCXA276 OSTIMER peripheral with protection against race conditions and timer rollover issues.

§Features

  • Async timing with embassy-time integration
  • Gray code counter handling (42-bit counter)
  • Interrupt-driven wakeups
  • Configurable interrupt priority
  • Race condition protection: Critical sections and atomic operations
  • Timer rollover handling: Bounds checking and rollover prevention

§Clock Frequency Configuration

The OSTIMER frequency depends on your system’s clock configuration. You must provide the actual frequency when calling time_driver::init().

§Race Condition Protection

  • Critical sections in interrupt handlers prevent concurrent access
  • Atomic register operations with memory barriers
  • Proper interrupt flag clearing and validation

§Timer Rollover Handling

  • Bounds checking prevents scheduling beyond timer capacity
  • Immediate wake for timestamps that would cause rollover issues

Modules§

time_driver

Structs§

Alarm
Single-shot alarm functionality for OSTIMER
Config
Configuration for Ostimer::new()
Ostimer
OSTIMER peripheral instance

Traits§

Instance