Ready-to-use implementation of Timing provider API for RP2350 RISC-V cores. More...
Functions | |
| void | timing_provider_setup (int interval_ms) |
| void | timing_provider_schedule (long delay_us) |
| Schedule next timer callback to kernel. | |
| void | timing_provider_delay (long delay_us) |
| Perform tight busy-wait delay. | |
| void | cmrx_machine_timer_handler (void) |
| Machine timer tick handler. | |
Ready-to-use implementation of Timing provider API for RP2350 RISC-V cores.
The kernel tick is generated by the RISC-V machine timer (mtime/mtimecmp), accessed through Pico SDK's hardware/riscv_platform_timer.h.
Call timing_provider_setup() once, before os_start(), with the tick period in milliseconds. It only stores the period; the timer is armed when the kernel first calls timing_provider_schedule(). The tick period is fixed, so the kernel's tickless feature is not used.
The library also defines cmrx_machine_timer_handler(), which the quirks/pico-sdk-riscv machine-timer interrupt handler calls on every tick.
| void cmrx_machine_timer_handler | ( | void | ) |
Machine timer tick handler.
Re-arms the timer and notifies the kernel. Called by the quirks/pico-sdk-riscv machine timer ISR; not meant to be called by applications.
| void timing_provider_delay | ( | long | delay_us | ) |
Perform tight busy-wait delay.
Kernel calls this function whenever tight delay is required. If delays are in orders of microseconds, then it usually makes no sense to yield or try to do anything else because the overhead of thread switching will consume all the time. Timing timing provider shall perform busy-wait delay, waiting for given amount of microseconds.
| [in] | delay_us | amount of microseconds to wait before resuming execution |
| void timing_provider_schedule | ( | long | delay_us | ) |
Schedule next timer callback to kernel.
Re-configure timing provider so that next timed kernel call will happen after given delay. This is the only function, whose implementation is mandatory and whose prototype nor behavior cannot be changed. If kernel calls this function, then timing provider must reconfigure itself so that it will be able to call back to the kernel as close as possible to time delay_us microseconds in the future. This must happen even if kernel previously signalized that there is no expected timed event and timers were turned off entirely.
| [in] | delay_us | delay time, in microseconds after which kernel shall be called by the timing provider. The value of 0 means that timing provider should not trigger the kernel timer callback until further notice. |
| void timing_provider_setup | ( | int | interval_ms | ) |