base.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include <stdint.h>
  3. #include <stdbool.h>
  4. // FreeRTOS part
  5. #include <FreeRTOS.h>
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. // Timeout value.
  10. #define osWaitForever 0xFFFFFFFFU ///< Wait forever timeout value.
  11. // Flags options (\ref furi_thread_flags_wait and \ref osEventFlagsWait).
  12. #define osFlagsWaitAny 0x00000000U ///< Wait for any flag (default).
  13. #define osFlagsWaitAll 0x00000001U ///< Wait for all flags.
  14. #define osFlagsNoClear 0x00000002U ///< Do not clear flags which have been specified to wait for.
  15. // Flags errors (returned by osThreadFlagsXxxx and osEventFlagsXxxx).
  16. #define osFlagsError 0x80000000U ///< Error indicator.
  17. #define osFlagsErrorUnknown 0xFFFFFFFFU ///< osError (-1).
  18. #define osFlagsErrorTimeout 0xFFFFFFFEU ///< osErrorTimeout (-2).
  19. #define osFlagsErrorResource 0xFFFFFFFDU ///< osErrorResource (-3).
  20. #define osFlagsErrorParameter 0xFFFFFFFCU ///< osErrorParameter (-4).
  21. #define osFlagsErrorISR 0xFFFFFFFAU ///< osErrorISR (-6).
  22. /// Status code values returned by CMSIS-RTOS functions.
  23. typedef enum {
  24. osOK = 0, ///< Operation completed successfully.
  25. osError = -1, ///< Unspecified RTOS error: run-time error but no other error message fits.
  26. osErrorTimeout = -2, ///< Operation not completed within the timeout period.
  27. osErrorResource = -3, ///< Resource not available.
  28. osErrorParameter = -4, ///< Parameter error.
  29. osErrorNoMemory =
  30. -5, ///< System is out of memory: it was impossible to allocate or reserve memory for the operation.
  31. osErrorISR =
  32. -6, ///< Not allowed in ISR context: the function cannot be called from interrupt service routines.
  33. osStatusReserved = 0x7FFFFFFF ///< Prevents enum down-size compiler optimization.
  34. } osStatus_t;
  35. #ifdef __cplusplus
  36. }
  37. #endif