freertos_rust/
base.rs

1/// Basic error type for the library.
2#[derive(Copy, Clone, Debug, Eq, PartialEq)]
3pub enum FreeRtosError {
4    OutOfMemory,
5    QueueSendTimeout,
6    QueueReceiveTimeout,
7    MutexTimeout,
8    Timeout,
9    QueueFull,
10    StringConversionError,
11    TaskNotFound,
12    InvalidQueueSize,
13    ProcessorHasShutDown,
14}
15
16unsafe impl Send for CVoid {}
17
18#[repr(u32)]
19pub enum CVoid {
20    _Variant1,
21    _Variant2,
22}
23
24pub type FreeRtosVoidPtr = *const CVoid;
25pub type FreeRtosMutVoidPtr = *mut CVoid;
26pub type FreeRtosCharPtr = *const u8;
27pub type FreeRtosChar = u8;
28
29pub type FreeRtosBaseType = i32;
30pub type FreeRtosUBaseType = u32;
31pub type FreeRtosTickType = u32;
32pub type FreeRtosBaseTypeMutPtr = *mut FreeRtosBaseType;
33
34pub type FreeRtosTaskHandle = *const CVoid;
35pub type FreeRtosMutTaskHandle = *mut CVoid;
36pub type FreeRtosQueueHandle = *const CVoid;
37pub type FreeRtosSemaphoreHandle = *const CVoid;
38pub type FreeRtosTaskFunction = *const CVoid;
39pub type FreeRtosTimerHandle = *const CVoid;
40pub type FreeRtosTimerCallback = *const CVoid;
41#[allow(dead_code)]
42pub type FreeRtosStackType = *const CVoid;
43
44pub type FreeRtosUnsignedLong = u32;
45pub type FreeRtosUnsignedShort = u16;
46
47#[derive(Copy, Clone, Debug)]
48#[repr(C)]
49pub struct FreeRtosTaskStatusFfi {
50    pub handle: FreeRtosTaskHandle,
51    pub task_name: FreeRtosCharPtr,
52    pub task_number: FreeRtosUBaseType,
53    pub task_state: FreeRtosTaskState,
54    pub current_priority: FreeRtosUBaseType,
55    pub base_priority: FreeRtosUBaseType,
56    pub run_time_counter: FreeRtosUnsignedLong,
57    pub stack_high_water_mark: FreeRtosUnsignedShort,
58}
59
60#[derive(Copy, Clone, Debug)]
61#[repr(u8)]
62pub enum FreeRtosTaskState {
63    /// A task is querying the state of itself, so must be running.
64    Running = 0,
65    /// The task being queried is in a read or pending ready list.
66    Ready = 1,
67    /// The task being queried is in the Blocked state.
68    Blocked = 2,
69    /// The task being queried is in the Suspended state, or is in the Blocked state with an infinite time out.
70    Suspended = 3,
71    /// The task being queried has been deleted, but its TCB has not yet been freed.
72    Deleted = 4,
73}