Furi Kernel primitives. More...
#include <core/base.h>
Go to the source code of this file.
Functions | |
bool | furi_kernel_is_irq_or_masked (void) |
Check if CPU is in IRQ or kernel running and IRQ is masked. | |
bool | furi_kernel_is_running (void) |
Check if kernel is running. | |
int32_t | furi_kernel_lock (void) |
Lock kernel, pause process scheduling. | |
int32_t | furi_kernel_unlock (void) |
Unlock kernel, resume process scheduling. | |
int32_t | furi_kernel_restore_lock (int32_t lock) |
Restore kernel lock state. | |
uint32_t | furi_kernel_get_tick_frequency (void) |
Get kernel systick frequency. | |
void | furi_delay_tick (uint32_t ticks) |
Delay execution. | |
FuriStatus | furi_delay_until_tick (uint32_t tick) |
Delay until tick. | |
uint32_t | furi_get_tick (void) |
Get current tick counter. | |
uint32_t | furi_ms_to_ticks (uint32_t milliseconds) |
Convert milliseconds to ticks. | |
void | furi_delay_ms (uint32_t milliseconds) |
Delay in milliseconds. | |
void | furi_delay_us (uint32_t microseconds) |
Delay in microseconds. | |
Furi Kernel primitives.
void furi_delay_ms | ( | uint32_t | milliseconds | ) |
Delay in milliseconds.
This method uses kernel ticks on the inside, which causes delay to be aliased to scheduler timer intervals. Real wait time will be between X+ milliseconds. Special value: 0, will cause task yield. Also if used when kernel is not running will fall back to furi_delay_us
.
[in] | milliseconds | milliseconds to wait |
void furi_delay_tick | ( | uint32_t | ticks | ) |
Delay execution.
Also keep in mind delay is aliased to scheduler timer intervals.
[in] | ticks | The ticks count to pause |
FuriStatus furi_delay_until_tick | ( | uint32_t | tick | ) |
Delay until tick.
[in] | tick | The tick until which kernel should delay task execution |
void furi_delay_us | ( | uint32_t | microseconds | ) |
Delay in microseconds.
Implemented using Cortex DWT counter. Blocking and non aliased.
[in] | microseconds | microseconds to wait |
uint32_t furi_get_tick | ( | void | ) |
Get current tick counter.
System uptime, may overflow.
uint32_t furi_kernel_get_tick_frequency | ( | void | ) |
Get kernel systick frequency.
bool furi_kernel_is_irq_or_masked | ( | void | ) |
Check if CPU is in IRQ or kernel running and IRQ is masked.
Originally this primitive was born as a workaround for FreeRTOS kernel primitives shenanigans with PRIMASK.
Meaningful use cases are:
As you can see there will be edge case when kernel is not started and PRIMASK is not 0 that may cause some funky behavior. Most likely it will happen after kernel primitives being used, but control not yet passed to kernel. It's up to you to figure out if it is safe for your code or not.
bool furi_kernel_is_running | ( | void | ) |
Check if kernel is running.
int32_t furi_kernel_lock | ( | void | ) |
Lock kernel, pause process scheduling.
int32_t furi_kernel_restore_lock | ( | int32_t | lock | ) |
Restore kernel lock state.
[in] | lock | The lock state |
int32_t furi_kernel_unlock | ( | void | ) |
Unlock kernel, resume process scheduling.
uint32_t furi_ms_to_ticks | ( | uint32_t | milliseconds | ) |
Convert milliseconds to ticks.
[in] | milliseconds | time in milliseconds |