mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-22 12:51:39 +03:00
aa06328516
* Furi: remove direct FreeRTOS timers use * Furi: eliminate FreeRTOS headers leak. What did it cost? Everything... * SubGhz: proper public api for protocols. Format Sources. * Furi: slightly less redundant declarations * Desktop: proper types in printf * Sync API Symbols * Furi: add timer reset and fix dolphin service, fix unit tests * Furi: proper timer restart method naming and correct behavior in timer stopped state. --------- Co-authored-by: hedger <hedger@nanode.su>
32 lines
724 B
C
32 lines
724 B
C
#include "common_defines.h"
|
|
|
|
#include <FreeRTOS.h>
|
|
#include <task.h>
|
|
|
|
__FuriCriticalInfo __furi_critical_enter(void) {
|
|
__FuriCriticalInfo info;
|
|
|
|
info.isrm = 0;
|
|
info.from_isr = FURI_IS_ISR();
|
|
info.kernel_running = (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING);
|
|
|
|
if(info.from_isr) {
|
|
info.isrm = taskENTER_CRITICAL_FROM_ISR();
|
|
} else if(info.kernel_running) {
|
|
taskENTER_CRITICAL();
|
|
} else {
|
|
__disable_irq();
|
|
}
|
|
|
|
return info;
|
|
}
|
|
|
|
void __furi_critical_exit(__FuriCriticalInfo info) {
|
|
if(info.from_isr) {
|
|
taskEXIT_CRITICAL_FROM_ISR(info.isrm);
|
|
} else if(info.kernel_running) {
|
|
taskEXIT_CRITICAL();
|
|
} else {
|
|
__enable_irq();
|
|
}
|
|
} |