1use crate::exchange;
5use crate::systypes::*;
6
7#[no_mangle]
9pub extern "C" fn __sys_get_process_handle(process: TaskLabel) -> Status {
10 crate::syscall::get_process_handle(process)
11}
12
13#[no_mangle]
15pub extern "C" fn __sys_exit(status: i32) -> Status {
16 crate::syscall::exit(status)
17}
18
19#[no_mangle]
21pub extern "C" fn __sys_get_shm_handle(shm: ShmLabel) -> Status {
22 crate::syscall::get_shm_handle(shm)
23}
24
25#[no_mangle]
27pub extern "C" fn __sys_get_dma_stream_handle(stream: StreamLabel) -> Status {
28 crate::syscall::get_dma_stream_handle(stream)
29}
30
31#[no_mangle]
33pub extern "C" fn __sys_sched_yield() -> Status {
34 crate::syscall::sched_yield()
35}
36
37#[no_mangle]
39pub extern "C" fn __sys_sleep(duration_ms: SleepDuration, mode: SleepMode) -> Status {
40 crate::syscall::sleep(duration_ms, mode)
41}
42
43#[no_mangle]
45pub extern "C" fn __sys_start(process: TaskLabel) -> Status {
46 crate::syscall::start(process)
47}
48
49#[no_mangle]
51pub extern "C" fn __sys_map_dev(dev: DeviceHandle) -> Status {
52 crate::syscall::map_dev(dev as DeviceHandle)
53}
54
55#[no_mangle]
57pub extern "C" fn __sys_map_shm(shm: ShmHandle) -> Status {
58 crate::syscall::map_shm(shm as ShmHandle)
59}
60
61#[no_mangle]
63pub extern "C" fn __sys_unmap_dev(dev: DeviceHandle) -> Status {
64 crate::syscall::unmap_dev(dev as DeviceHandle)
65}
66
67#[no_mangle]
69pub extern "C" fn __sys_unmap_shm(shm: ShmHandle) -> Status {
70 crate::syscall::unmap_shm(shm as ShmHandle)
71}
72
73#[no_mangle]
75pub extern "C" fn __sys_shm_set_credential(
76 shm: ShmHandle,
77 id: TaskHandle,
78 shm_perm: u32,
79) -> Status {
80 crate::syscall::shm_set_credential(shm, id, shm_perm)
81}
82
83#[no_mangle]
85pub extern "C" fn __sys_send_ipc(target: TaskHandle, length: u8) -> Status {
86 crate::syscall::send_ipc(target, length)
87}
88
89#[no_mangle]
91pub extern "C" fn __sys_send_signal(resource: u32, signal_type: Signal) -> Status {
92 crate::syscall::send_signal(resource, signal_type)
93}
94
95#[no_mangle]
97pub extern "C" fn __sys_gpio_get(resource: u32, io: u8) -> Status {
98 crate::syscall::gpio_get(resource, io)
99}
100
101#[no_mangle]
103pub extern "C" fn __sys_gpio_set(resource: u32, io: u8, val: bool) -> Status {
104 crate::syscall::gpio_set(resource, io, val)
105}
106
107#[no_mangle]
109pub extern "C" fn __sys_gpio_reset(resource: u32, io: u8) -> Status {
110 crate::syscall::gpio_reset(resource, io)
111}
112
113#[no_mangle]
115pub extern "C" fn __sys_gpio_toggle(resource: u32, io: u8) -> Status {
116 crate::syscall::gpio_toggle(resource, io)
117}
118
119#[no_mangle]
121pub extern "C" fn __sys_gpio_configure(resource: u32, io: u8) -> Status {
122 crate::syscall::gpio_configure(resource, io)
123}
124
125#[no_mangle]
127pub extern "C" fn __sys_get_device_handle(devlabel: u8) -> Status {
128 crate::syscall::get_device_handle(devlabel)
129}
130
131#[no_mangle]
133pub extern "C" fn __sys_irq_acknowledge(irq: u16) -> Status {
134 crate::syscall::irq_acknowledge(irq)
135}
136
137#[no_mangle]
139pub extern "C" fn __sys_irq_enable(irq: u16) -> Status {
140 crate::syscall::irq_enable(irq)
141}
142
143#[no_mangle]
145pub extern "C" fn __sys_irq_disable(irq: u16) -> Status {
146 crate::syscall::irq_disable(irq)
147}
148
149#[no_mangle]
151pub extern "C" fn __sys_wait_for_event(mask: u8, timeout: i32) -> Status {
152 crate::syscall::wait_for_event(mask, timeout)
153}
154
155#[no_mangle]
157pub extern "C" fn __sys_pm_manage(mode: CPUSleep) -> Status {
158 crate::syscall::pm_manage(mode)
159}
160
161#[no_mangle]
163pub extern "C" fn __sys_alarm(timeout_ms: u32, flag: AlarmFlag) -> Status {
164 crate::syscall::alarm(timeout_ms, flag)
165}
166
167#[no_mangle]
169pub extern "C" fn __sys_log(length: usize) -> Status {
170 crate::syscall::log(length)
171}
172
173#[no_mangle]
175pub extern "C" fn __sys_get_random() -> Status {
176 crate::syscall::get_random()
177}
178
179#[no_mangle]
181pub extern "C" fn __sys_get_cycle(precision: Precision) -> Status {
182 crate::syscall::get_cycle(precision)
183}
184
185#[no_mangle]
187pub extern "C" fn __sys_pm_set_clock(clk_reg: u32, clkmsk: u32, val: u32) -> Status {
188 crate::syscall::pm_set_clock(clk_reg, clkmsk, val)
189}
190
191#[no_mangle]
193pub extern "C" fn __sys_dma_start_stream(dmah: StreamHandle) -> Status {
194 crate::syscall::dma_start_stream(dmah)
195}
196
197#[no_mangle]
199pub extern "C" fn __sys_dma_suspend_stream(dmah: StreamHandle) -> Status {
200 crate::syscall::dma_suspend_stream(dmah)
201}
202
203#[no_mangle]
205pub extern "C" fn __sys_dma_get_stream_status(dmah: StreamHandle) -> Status {
206 crate::syscall::dma_get_stream_status(dmah)
207}
208
209#[no_mangle]
211pub extern "C" fn __sys_shm_get_infos(shm: ShmHandle) -> Status {
212 crate::syscall::shm_get_infos(shm)
213}
214
215#[no_mangle]
217pub extern "C" fn __sys_dma_assign_stream(dmah: StreamHandle) -> Status {
218 crate::syscall::dma_assign_stream(dmah)
219}
220
221#[no_mangle]
223pub extern "C" fn __sys_dma_unassign_stream(dmah: StreamHandle) -> Status {
224 crate::syscall::dma_unassign_stream(dmah)
225}
226
227#[no_mangle]
229pub extern "C" fn __sys_dma_get_stream_info(dmah: StreamHandle) -> Status {
230 crate::syscall::dma_get_stream_info(dmah)
231}
232
233#[no_mangle]
235pub extern "C" fn __sys_dma_resume_stream(dmah: StreamHandle) -> Status {
236 crate::syscall::dma_resume_stream(dmah)
237}
238
239#[no_mangle]
241pub extern "C" fn copy_to_kernel(from: *mut u8, length: usize) -> Status {
242 let u8_slice: &[u8] = unsafe { core::slice::from_raw_parts(from, length) };
243 match exchange::copy_to_kernel(&u8_slice) {
244 Ok(_) => Status::Ok,
245 Err(err) => err,
246 }
247}
248
249#[no_mangle]
251pub extern "C" fn copy_from_kernel(to: *mut u8, length: usize) -> Status {
252 let mut u8_slice: &mut [u8] =
253 unsafe { core::slice::from_raw_parts_mut(to, length) as &mut [u8] };
254 match exchange::copy_from_kernel(&mut u8_slice) {
255 Ok(_) => Status::Ok,
256 Err(err) => err,
257 }
258}