Karg  v0.2.0
The kernel of CargOS
sbi.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <types.h>
4 
5 typedef struct {
8 } sbi_res_t;
9 
10 sbi_res_t sbi_ecall(i32 eid, i32 fid, ...);
11 i32 sbi_map_err(isize err);
12 
13 #define SBI_EID_TIME 0x54494D45
14 
15 static inline i32 sbi_set_timer(u64 time) {
16  return sbi_map_err(sbi_ecall(SBI_EID_TIME, 0, time).err);
17 }
18 
19 #define SBI_EID_SRST 0x53525354
20 
21 typedef enum {
25 
26 typedef enum {
29 
30 static inline i32 sbi_reboot(sbi_reboot_type_t type,
31  sbi_reboot_reason_t reason) {
32  return sbi_map_err(sbi_ecall(SBI_EID_SRST, 0, type, reason).err);
33 }
sbi_reboot_reason_t
Definition: sbi.h:26
@ SBI_REBOOT_REASON_NONE
Definition: sbi.h:27
#define SBI_EID_SRST
Definition: sbi.h:19
sbi_reboot_type_t
Definition: sbi.h:21
@ SBI_REBOOT_TYPE_SHUTDOWN
Definition: sbi.h:22
@ SBI_REBOOT_TYPE_REBOOT
Definition: sbi.h:23
i32 sbi_map_err(isize err)
Definition: sbi.c:38
sbi_res_t sbi_ecall(i32 eid, i32 fid,...)
#define SBI_EID_TIME
Definition: sbi.h:13
Definition: sbi.h:5
isize err
Definition: sbi.h:6
isize val
Definition: sbi.h:7
time_t time(void)
Definition: time.c:5
__INTPTR_TYPE__ isize
Definition: types.h:29
__INT32_TYPE__ i32
Definition: types.h:15
__UINT64_TYPE__ u64
Definition: types.h:6