2021-05-18 10:51:00 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-08-22 17:06:17 +00:00
|
|
|
#include "core_defines.h"
|
2022-03-29 17:37:23 +00:00
|
|
|
#include <stdbool.h>
|
2022-07-20 10:56:33 +00:00
|
|
|
#include <FreeRTOS.h>
|
|
|
|
#include <task.h>
|
2022-03-29 17:37:23 +00:00
|
|
|
|
2022-03-30 15:23:40 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <cmsis_compiler.h>
|
|
|
|
|
2022-12-16 22:20:10 +00:00
|
|
|
#ifndef FURI_WARN_UNUSED
|
|
|
|
#define FURI_WARN_UNUSED __attribute__((warn_unused_result))
|
|
|
|
#endif
|
|
|
|
|
2023-05-03 03:58:59 +00:00
|
|
|
#ifndef FURI_WEAK
|
|
|
|
#define FURI_WEAK __attribute__((weak))
|
|
|
|
#endif
|
|
|
|
|
2022-03-29 17:37:23 +00:00
|
|
|
#ifndef FURI_IS_IRQ_MASKED
|
|
|
|
#define FURI_IS_IRQ_MASKED() (__get_PRIMASK() != 0U)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FURI_IS_IRQ_MODE
|
|
|
|
#define FURI_IS_IRQ_MODE() (__get_IPSR() != 0U)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FURI_IS_ISR
|
2022-04-13 20:50:25 +00:00
|
|
|
#define FURI_IS_ISR() (FURI_IS_IRQ_MODE() || FURI_IS_IRQ_MASKED())
|
2022-03-29 17:37:23 +00:00
|
|
|
#endif
|
|
|
|
|
2023-06-06 19:00:43 +00:00
|
|
|
typedef struct {
|
|
|
|
uint32_t isrm;
|
|
|
|
bool from_isr;
|
|
|
|
bool kernel_running;
|
|
|
|
} __FuriCriticalInfo;
|
|
|
|
|
|
|
|
__FuriCriticalInfo __furi_critical_enter(void);
|
|
|
|
|
|
|
|
void __furi_critical_exit(__FuriCriticalInfo info);
|
|
|
|
|
2021-11-30 22:07:17 +00:00
|
|
|
#ifndef FURI_CRITICAL_ENTER
|
2023-06-06 19:00:43 +00:00
|
|
|
#define FURI_CRITICAL_ENTER() __FuriCriticalInfo __furi_critical_info = __furi_critical_enter();
|
2021-11-30 22:07:17 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FURI_CRITICAL_EXIT
|
2023-06-06 19:00:43 +00:00
|
|
|
#define FURI_CRITICAL_EXIT() __furi_critical_exit(__furi_critical_info);
|
2022-01-02 21:39:56 +00:00
|
|
|
#endif
|
2022-03-30 15:23:40 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|