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
svc.h
Go to the documentation of this file.
1
23
#ifndef ICARUS_SVC_H
24
#define ICARUS_SVC_H
25
26
#ifdef __cplusplus
27
extern
"C"
{
28
#endif
29
30
#include <stdint.h>
31
32
#define SVC_TASK_ACTIVE_SLEEP 0
33
#define SVC_TASK_BLOCKING_SLEEP 1
34
35
#define SVC_ENTER_CRITICAL 2
36
#define SVC_EXIT_CRITICAL 3
37
38
#define SVC_PIPE_INIT 4
39
#define SVC_PIPE_ENQUEUE 5
40
#define SVC_PIPE_DEQUEUE 6
41
42
#define SVC_OS_INIT 7
43
#define SVC_OS_START 8
44
#define SVC_OS_YIELD 9
45
#define SVC_OS_REGISTER_TASK 10
46
#define SVC_OS_GET_CURRENT_TASK_NAME 11
47
#define SVC_OS_GET_TICK_COUNT 12
48
#define SVC_OS_EXIT_TASK 13
49
#define SVC_OS_KILL_PROCESS 14
50
#define SVC_OS_TASK_SUICIDE 15
51
52
#define SVC_SEMAPHORE_INIT 16
53
#define SVC_SEMAPHORE_CONSUME 17
54
#define SVC_SEMAPHORE_FEED 18
55
#define SVC_SEMAPHORE_GET_COUNT 19
56
#define SVC_SEMAPHORE_GET_MAX_COUNT 20
57
58
#define SVC_PIPE_GET_COUNT 21
59
#define SVC_PIPE_GET_MAX_COUNT 22
60
61
#define SVC_TASK_BUSY_WAIT 23
62
#define SVC_OS_GET_RUNNING_TASK_COUNT 24
63
#define SVC_OS_GET_TASK_TICKS_REMAINING 25
64
65
#define SVC_KERNEL_GET_STACK 26
66
#define SVC_KERNEL_GET_DATA 27
67
#define SVC_KERNEL_PROTECTED_DATA 28
68
69
/* Call gates for spinning functions — read kernel state from priv mode */
70
/* so DTCM can be made priv-only without faulting the spin loops */
71
#define SVC_SEM_CAN_FEED 29
/* bool: count < max && engaged */
72
#define SVC_SEM_CAN_CONSUME 30
/* bool: count > 0 && engaged */
73
#define SVC_PIPE_CAN_ENQUEUE 31
/* bool: free >= bytes && engaged */
74
#define SVC_PIPE_CAN_DEQUEUE 32
/* bool: count >= bytes && engaged*/
75
76
/* Write gates for spinning functions — modify kernel state from priv mode */
77
#define SVC_SEM_INCREMENT 33
/* ++count, update tick */
78
#define SVC_SEM_DECREMENT 34
/* --count, update tick */
79
#define SVC_PIPE_WRITE_BYTES 35
/* write to buffer, update tick */
80
#define SVC_PIPE_READ_BYTES 36
/* read from buffer, update tick */
81
82
/* Read gates for display/diagnostics — read task metadata from priv mode */
83
#define SVC_GET_TASK_NAME 37
/* const char*: task_list[i]->name */
84
#define SVC_GET_NUM_TASKS 38
/* uint8_t: num_created_tasks */
85
#define SVC_OS_IS_RUNNING 39
/* uint8_t: os_running flag */
86
87
/* CDC RX ring buffer (data in DTCM_PRIV) */
88
#define SVC_CDC_RX_INIT 40
/* clear head/tail */
89
#define SVC_CDC_RX_READ_BYTE 41
/* bool: pop one byte if any */
90
#define SVC_CDC_RX_AVAILABLE 42
/* uint32_t: bytes available */
91
92
/* Event ring buffer + per-module squelch (data in DTCM_PRIV) */
93
#define SVC_EVENT_INIT 43
/* clear ring + squelch */
94
#define SVC_OS_EVENT 44
/* emit one entry */
95
#define SVC_EVENT_SET_SQUELCH 45
/* set per-module threshold */
96
#define SVC_EVENT_GET_SQUELCH 46
/* read per-module threshold */
97
#define SVC_EVENT_DRAIN 47
/* copy entries into caller buf */
98
#define SVC_EVENT_GET_COUNT 48
/* uint32_t: ring fill */
99
100
/* Ground-loadable table engine (data in DTCM_PRIV) */
101
#define SVC_TBL_INIT 49
/* clear registry */
102
#define SVC_TBL_REGISTER 50
/* add a descriptor */
103
#define SVC_TBL_LOAD 51
/* append bytes to staging */
104
#define SVC_TBL_ACTIVATE_PREPARE 52
/* validate + copy staging→tmp */
105
#define SVC_TBL_ACTIVATE_COMMIT 53
/* copy tmp→active */
106
#define SVC_TBL_DUMP 54
/* copy active→caller buf */
107
#define SVC_TBL_GET_DESCRIPTOR 55
/* return descriptor pointer */
108
#define SVC_TBL_COUNT 56
/* uint8_t: registered count */
109
110
/* Task lifecycle extensions */
111
#define SVC_OS_RESTART_TASK 57
/* restart killed/finished task */
112
113
/* Timed semaphore wait */
114
#define SVC_SEMAPHORE_CONSUME_TIMEOUT 58
/* bool: acquire with timeout */
115
116
/* Task diagnostics */
117
#define SVC_GET_TASK_STATE 59
/* icarus_task_state_t */
118
#define SVC_GET_TASK_DISPATCH_COUNT 60
/* uint32_t: dispatch counter */
119
#define SVC_GET_STACK_WATERMARK 61
/* uint32_t: min free words */
120
#define SVC_UPDATE_STACK_WATERMARK 62
/* void: scan + update */
121
122
/* Checksum integrity monitor (data in DTCM_PRIV) */
123
#define SVC_CS_INIT 63
/* void: clear regions */
124
#define SVC_CS_SET_CALLBACK 64
/* void: set mismatch callback */
125
#define SVC_CS_ADD_REGION 65
/* bool: register + baseline CRC */
126
#define SVC_CS_ENABLE 66
/* bool: enable/disable region */
127
#define SVC_CS_REBASELINE 67
/* bool: recompute baseline */
128
#define SVC_CS_CHECK_ALL 68
/* uint8_t: scan all regions */
129
#define SVC_CS_GET_REGION 69
/* bool: read region descriptor */
130
#define SVC_CS_REGION_COUNT 70
131
132
/* Generic BKPRAM write gate (data in RAM_D3, priv-only by default MPU) */
133
#define SVC_BKPRAM_WRITE 71
/* bool: memcpy src→BKPRAM */
134
135
/* Software Bus (data in DTCM_PRIV) */
136
#define SVC_SB_INIT 72
/* void: clear routes */
137
#define SVC_SB_SUBSCRIBE 73
/* bool: add (msg,pipe) binding */
138
#define SVC_SB_UNSUBSCRIBE 74
/* bool: remove binding */
139
#define SVC_SB_PUBLISH 75
/* uint8_t: enqueue to all subs */
140
#define SVC_SB_SUBSCRIBER_COUNT 76
/* uint8_t: count for msg_id */
141
#define SVC_SB_ROUTE_COUNT 77
/* uint8_t: total route entries */
142
143
/* Filesystem (data in .bss, accessed via critical sections) */
144
#define SVC_FS_INIT 78
/* void: clear table + data */
145
#define SVC_FS_CREATE 79
/* bool: allocate new file */
146
#define SVC_FS_OPEN 80
/* bool: open existing file */
147
#define SVC_FS_WRITE 81
/* bool: append to file */
148
#define SVC_FS_READ 82
/* uint16_t: read from offset */
149
#define SVC_FS_DELETE 83
/* bool: remove by name */
150
#define SVC_FS_LIST 84
/* uint8_t: enumerate files */
151
#define SVC_FS_STATS 85
/* void: fill stats struct */
152
153
/* ============================================================================
154
* COMPILE-TIME SVC VALIDATION
155
* ========================================================================= */
156
157
/* SVC instruction encodes number in 1 byte (0-255) */
158
_Static_assert
(
SVC_FS_STATS
<= 255,
159
"Highest SVC number must fit in 8-bit immediate"
);
160
161
_Static_assert
(
SVC_FS_STATS
>=
SVC_KERNEL_PROTECTED_DATA
,
162
"SVC_FS_STATS must be >= all other SVC numbers"
);
163
164
/* ============================================================================
165
* SVC HANDLER (called from assembly - target only)
166
* ========================================================================= */
167
168
#ifndef HOST_TEST
173
void
SVC_Handler_C
(uint32_t *stack_frame);
174
#endif
175
176
#ifdef __cplusplus
177
}
178
#endif
179
180
#endif
/* ICARUS_SVC_H */
SVC_Handler_C
void SVC_Handler_C(uint32_t *stack_frame)
C-level SVC dispatcher called from SVC_Handler assembly.
Definition
svc.c:50
SVC_FS_STATS
#define SVC_FS_STATS
Definition
svc.h:151
SVC_KERNEL_PROTECTED_DATA
#define SVC_KERNEL_PROTECTED_DATA
Definition
svc.h:67
Core
Inc
icarus
svc.h
Generated on Fri Apr 17 2026 13:48:31 for ICARUS OS (Intelligent Cooperative Architecture for Real-time Unified Systems) by
1.9.8