unleashed-firmware/furi/core/common_defines.h
あく 0bc400a3ae
Code Cleanup: unused includes, useless checks, unused variables, etc... (#3696)
* Remove unnecessary checks
* Sublime: never insert missing headers
* Cleanup furi defines use
* Cleanup startup. Cleanup linker scripts. Explicitly define all interrupts hadlers, including uninmplemented one.
* Startup routine in C
* Drop assembler startup
* Move linker defines to stm32wb55_linker.h, cleanup naming, unify usage. Mpu: protect last 32b of main stack. Document various obscure things.
* Move furi_hal_switch documentation to appropriate place, use 0x0 for updater jump.
* UnitTests: move all temporary test files into tmp folder

---------

Co-authored-by: SG <who.just.the.doctor@gmail.com>
2024-06-11 03:04:29 +10:00

80 lines
1.6 KiB
C

#pragma once
#include "core_defines.h"
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#define FURI_NORETURN [[noreturn]]
#else
#include <stdnoreturn.h>
#define FURI_NORETURN noreturn
#endif
#include <cmsis_compiler.h>
#ifndef FURI_WARN_UNUSED
#define FURI_WARN_UNUSED __attribute__((warn_unused_result))
#endif
#ifndef FURI_DEPRECATED
#define FURI_DEPRECATED __attribute__((deprecated))
#endif
#ifndef FURI_WEAK
#define FURI_WEAK __attribute__((weak))
#endif
#ifndef FURI_PACKED
#define FURI_PACKED __attribute__((packed))
#endif
#ifndef FURI_ALWAYS_STATIC_INLINE
#define FURI_ALWAYS_STATIC_INLINE __attribute__((always_inline)) static inline
#endif
#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
#define FURI_IS_ISR() (FURI_IS_IRQ_MODE() || FURI_IS_IRQ_MASKED())
#endif
typedef struct {
uint32_t isrm;
bool from_isr;
bool kernel_running;
} __FuriCriticalInfo;
__FuriCriticalInfo __furi_critical_enter(void);
void __furi_critical_exit(__FuriCriticalInfo info);
#ifndef FURI_CRITICAL_ENTER
#define FURI_CRITICAL_ENTER() __FuriCriticalInfo __furi_critical_info = __furi_critical_enter();
#endif
#ifndef FURI_CRITICAL_EXIT
#define FURI_CRITICAL_EXIT() __furi_critical_exit(__furi_critical_info);
#endif
#ifndef FURI_CHECK_RETURN
#define FURI_CHECK_RETURN __attribute__((__warn_unused_result__))
#endif
#ifndef FURI_NAKED
#define FURI_NAKED __attribute__((naked))
#endif
#ifndef FURI_DEFAULT
#define FURI_DEFAULT(x) __attribute__((weak, alias(x)))
#endif
#ifdef __cplusplus
}
#endif