ICARUS OS (Intelligent Cooperative Architecture for Real-time Unified Systems) 0.1.0
Preemptive Real-Time Operating System for ARM Cortex-M7
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1
23#ifndef ICARUS_TYPES_H
24#define ICARUS_TYPES_H
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#include <stdint.h>
31#include <stdbool.h>
32#include "icarus/config.h"
33
34/* ============================================================================
35 * TASK STATE DEFINITIONS
36 * ========================================================================= */
37
83
95
96/* ============================================================================
97 * TASK CONTROL BLOCK (TCB)
98 * ========================================================================= */
99
115typedef struct {
116 /* ---- Fields accessed by C code only ---- */
117 void (*function)(void);
118 uint32_t *stack_base;
119 uint32_t stack_size;
121 /* ---- Fields accessed by assembly (offsets hardcoded) ---- */
122 uint32_t *stack_pointer;
125 uint32_t ticks_to_pause;
127 uint32_t *data_pointer;
129 /* ---- Additional metadata ---- */
132 uint32_t dispatch_count;
135
136/* ============================================================================
137 * SYNCHRONIZATION PRIMITIVES
138 * ========================================================================= */
139
151typedef struct {
152 bool engaged;
153 uint32_t count;
154 uint32_t max_count;
157
169typedef struct {
170 bool engaged;
171 uint16_t count;
172 uint16_t max_count;
173 uint16_t enqueue_idx;
174 uint16_t dequeue_idx;
176 uint8_t buffer[ICARUS_MAX_MESSAGE_BYTES];
178
179#ifdef __cplusplus
180}
181#endif
182
183#endif /* ICARUS_TYPES_H */
#define ICARUS_MAX_TASK_NAME_LEN
Maximum length of task name string (including null terminator)
Definition config.h:102
#define ICARUS_MAX_MESSAGE_BYTES
Maximum bytes per message pipe buffer.
Definition config.h:76
ICARUS OS Configuration Header.
Message Pipe (Queue)
Definition types.h:169
uint16_t count
Current number of bytes in buffer.
Definition types.h:171
uint16_t dequeue_idx
Read index (circular)
Definition types.h:174
uint16_t max_count
Maximum buffer capacity in bytes.
Definition types.h:172
uint16_t enqueue_idx
Write index (circular)
Definition types.h:173
uint32_t tick_updated_at
Last modification timestamp.
Definition types.h:175
bool engaged
true if pipe is initialized and active
Definition types.h:170
Counting Semaphore.
Definition types.h:151
uint32_t tick_updated_at
Last modification timestamp (for debugging)
Definition types.h:155
uint32_t max_count
Maximum count (initial value)
Definition types.h:154
bool engaged
true if semaphore is initialized and active
Definition types.h:152
uint32_t count
Current semaphore count.
Definition types.h:153
Task Control Block (TCB)
Definition types.h:115
icarus_task_priority_t task_priority
Task priority level.
Definition types.h:130
uint32_t global_tick_paused
Tick count when blocked (offset 20)
Definition types.h:124
icarus_task_state_t task_state
Current task state (offset 16)
Definition types.h:123
uint32_t dispatch_count
Times this task has been dispatched.
Definition types.h:132
uint32_t * stack_base
Base address of task stack.
Definition types.h:118
uint32_t stack_size
Stack size in 32-bit words.
Definition types.h:119
uint32_t * data_pointer
Current data pointer (offset 28)
Definition types.h:127
uint32_t * stack_pointer
Current stack pointer (offset 12)
Definition types.h:122
uint32_t stack_watermark
Minimum free stack words observed.
Definition types.h:133
uint32_t ticks_to_pause
Ticks to remain blocked (offset 24)
Definition types.h:125
icarus_task_state_t
Task state enumeration.
Definition types.h:75
@ TASK_STATE_RUNNING
Task currently executing on CPU.
Definition types.h:77
@ TASK_STATE_FINISHED
Task completed execution normally.
Definition types.h:81
@ TASK_STATE_BLOCKED
Task waiting for timeout or event.
Definition types.h:79
@ TASK_STATE_READY
Task ready to run, waiting for CPU.
Definition types.h:78
@ TASK_STATE_KILLED
Task terminated by another task.
Definition types.h:80
@ TASK_STATE_COLD
Task created but never started.
Definition types.h:76
icarus_task_priority_t
Task priority levels.
Definition types.h:90
@ TASK_PRIORITY_MED
Normal application priority.
Definition types.h:92
@ TASK_PRIORITY_LOW
Background/idle priority.
Definition types.h:91
@ TASK_PRIORITY_HIGH
Time-critical priority.
Definition types.h:93