18#ifndef LIBRISHKA_IMPL_H
19#define LIBRISHKA_IMPL_H
29 RISHKA_SC_IO_READLINE,
30 RISHKA_SC_IO_AVAILABLE,
33 RISHKA_SC_IO_FIND_UNTIL,
34 RISHKA_SC_IO_SET_TIMEOUT,
35 RISHKA_SC_IO_GET_TIMEOUT,
37 RISHKA_SC_SYS_DELAY_MS,
40 RISHKA_SC_SYS_SHELLEXEC,
48 RISHKA_SC_GPIO_PIN_MODE,
49 RISHKA_SC_GPIO_DIGITAL_READ,
50 RISHKA_SC_GPIO_DIGITAL_WRITE,
51 RISHKA_SC_GPIO_ANALOG_READ,
52 RISHKA_SC_GPIO_ANALOG_WRITE,
53 RISHKA_SC_GPIO_PULSE_IN,
54 RISHKA_SC_GPIO_PULSE_IN_LONG,
55 RISHKA_SC_GPIO_SHIFT_IN,
56 RISHKA_SC_GPIO_SHIFT_OUT,
58 RISHKA_SC_GPIO_NO_TONE,
61 RISHKA_SC_INT_DISABLE,
73 RISHKA_SC_FS_AVAILABLE,
87 RISHKA_SC_FS_LASTWRITE,
89 RISHKA_SC_FS_NEXT_NAME,
97 RISHKA_SC_I2C_BEGIN_TRANSMISSION,
98 RISHKA_SC_I2C_END_TRANSMISSION,
100 RISHKA_SC_I2C_SLAVE_WRITE,
103 RISHKA_SC_I2C_REQUEST,
104 RISHKA_SC_I2C_AVAILABLE,
106 RISHKA_SC_I2C_ON_RECEIVE,
107 RISHKA_SC_I2C_ON_REQUEST,
108 RISHKA_SC_I2C_GET_TIMEOUT,
109 RISHKA_SC_I2C_SET_TIMEOUT,
110 RISHKA_SC_I2C_GET_CLOCK,
111 RISHKA_SC_I2C_SET_CLOCK,
113 RISHKA_SC_I2C_BUFSIZE,
115 RISHKA_SC_KB_LAYOUT_NAME,
116 RISHKA_SC_KB_LAYOUT_DESC,
117 RISHKA_SC_KB_LED_GET_NUM,
118 RISHKA_SC_KB_LED_GET_CAPS,
119 RISHKA_SC_KB_LED_GET_SCROLL,
120 RISHKA_SC_KB_LED_SET_NUM,
121 RISHKA_SC_KB_LED_SET_CAPS,
122 RISHKA_SC_KB_LED_SET_SCROLL,
123 RISHKA_SC_KB_NEXT_SCAN_CODE,
124 RISHKA_SC_KB_DEVICE_TYPE,
125 RISHKA_SC_KB_AVAILABLE_VK,
126 RISHKA_SC_KB_IS_AVAILABLE,
127 RISHKA_SC_KB_IS_VK_DOWN,
132 RISHKA_SC_DISPLAY_SCREEN_HEIGHT,
133 RISHKA_SC_DISPLAY_SCREEN_WIDTH,
134 RISHKA_SC_DISPLAY_VIEWPORT_HEIGHT,
135 RISHKA_SC_DISPLAY_VIEWPORT_WIDTH,
136 RISHKA_SC_DISPLAY_SUPPORTED_COLORS,
138 RISHKA_SC_NVS_COMMIT,
140 RISHKA_SC_NVS_ERASE_ALL,
141 RISHKA_SC_NVS_SET_I8,
142 RISHKA_SC_NVS_SET_I16,
143 RISHKA_SC_NVS_SET_I32,
144 RISHKA_SC_NVS_SET_I64,
145 RISHKA_SC_NVS_SET_U8,
146 RISHKA_SC_NVS_SET_U16,
147 RISHKA_SC_NVS_SET_U32,
148 RISHKA_SC_NVS_SET_U64,
149 RISHKA_SC_NVS_SET_STRING,
150 RISHKA_SC_NVS_GET_I8,
151 RISHKA_SC_NVS_GET_I16,
152 RISHKA_SC_NVS_GET_I32,
153 RISHKA_SC_NVS_GET_I64,
154 RISHKA_SC_NVS_GET_U8,
155 RISHKA_SC_NVS_GET_U16,
156 RISHKA_SC_NVS_GET_U32,
157 RISHKA_SC_NVS_GET_U64,
158 RISHKA_SC_NVS_GET_STRING,
159 RISHKA_SC_NVS_HAS_WIFI_CONFIG,
160 RISHKA_SC_NVS_SET_WIFI_SSID,
161 RISHKA_SC_NVS_SET_WIFI_PWORD,
163 RISHKA_SC_WIFI_CONNECT,
164 RISHKA_SC_WIFI_RECONNECT,
165 RISHKA_SC_WIFI_DISCONNECT,
166 RISHKA_SC_WIFI_ERASE_AP,
167 RISHKA_SC_WIFI_IS_CONNECTED,
168 RISHKA_SC_WIFI_SET_AUTO_RECONNECT,
169 RISHKA_SC_WIFI_GET_AUTO_RECONNECT,
170 RISHKA_SC_WIFI_WAIT_FOR_RESULT,
171 RISHKA_SC_WIFI_SET_MINSEC,
172 RISHKA_SC_WIFI_SET_SCAN_METHOD,
173 RISHKA_SC_WIFI_SET_SORT_METHOD,
174 RISHKA_SC_WIFI_STATUS,
177 RISHKA_SC_WIFI_BSSID,
179 RISHKA_SC_WIFI_SET_LOCAL_IP,
180 RISHKA_SC_WIFI_GET_LOCAL_IP,
181 RISHKA_SC_WIFI_SET_GATEWAY_IP,
182 RISHKA_SC_WIFI_GET_GATEWAY_IP,
183 RISHKA_SC_WIFI_SET_SUBNET_MASK,
184 RISHKA_SC_WIFI_GET_SUBNET_MASK,
185 RISHKA_SC_WIFI_SET_DNS_IP,
186 RISHKA_SC_WIFI_GET_DNS_IP,
187 RISHKA_SC_WIFI_MAC_ADDR,
188 RISHKA_SC_WIFI_BROADCAST_IP,
189 RISHKA_SC_WIFI_NETWORK_ID,
190 RISHKA_SC_WIFI_ENABLE_IPV6,
191 RISHKA_SC_WIFI_LINK_LOCAL_IPV6,
192 RISHKA_SC_WIFI_GLOBAL_IPV6,
194 RISHKA_SC_RT_STRPASS,
196 RISHKA_SC_RT_FORK_STREAM
199static inline long long int double_to_long(
double d) {
202 long long int output;
209static inline double long_to_float(
long long int l) {
219static inline i64 rishka_sc_0(
i32 scallid) {
220 register i64 a0
asm(
"a0") = 0;
221 register i64 scid
asm(
"a7") = scallid;
223 asm volatile (
"scall" :
"+r"(a0) :
"r"(scid));
227static inline i64 rishka_sc_1(
i32 scallid,
i64 arg0) {
228 register i64 a0
asm(
"a0") = arg0;
229 register i64 scid
asm(
"a7") = scallid;
231 asm volatile (
"scall" :
"+r"(a0) :
"r"(scid));
235static inline i64 rishka_sc_2(
i32 scallid,
i64 arg0,
i64 arg1) {
236 register i64 a0
asm(
"a0") = arg0;
237 register i64 a1
asm(
"a1") = arg1;
238 register i64 scid
asm(
"a7") = scallid;
240 asm volatile (
"scall" :
"+r"(a0) :
"r"(a1),
"r"(scid));
244static inline i64 rishka_sc_3(
i32 scallid,
i64 arg0,
i64 arg1,
i64 arg2) {
245 register i64 a0
asm(
"a0") = arg0;
246 register i64 a1
asm(
"a1") = arg1;
247 register i64 a2
asm(
"a2") = arg2;
248 register i64 scid
asm(
"a7") = scallid;
250 asm volatile (
"scall" :
"+r"(a0) :
"r"(a1),
"r"(a2),
"r"(scid));
255 register i64 a0
asm(
"a0") = arg0;
256 register i64 a1
asm(
"a1") = arg1;
257 register i64 a2
asm(
"a2") = arg2;
258 register i64 a3
asm(
"a3") = arg3;
259 register i64 scid
asm(
"a7") = scallid;
261 asm volatile (
"scall" :
"+r"(a0) :
"r"(a1),
"r"(a2),
"r"(a3),
"r"(scid));
265static inline rune rt_strpass() {
266 return (
rune) rishka_sc_0(RISHKA_SC_RT_STRPASS);
269static inline string get_rt_string(
u32 len) {
271 for(
u32 i = 0; i < len; i++)
272 str[i] = rt_strpass();
static any alloc(usize size)
Allocate memory.
Definition: librishka_mem.cpp:69
Main header file for the Rishka SDK.
char * string
Alias for the string type.
Definition: types.h:40
signed int i32
Alias for the signed 32-bit integer type.
Definition: types.h:58
char rune
Alias for the Unicode character type.
Definition: types.h:34
unsigned int u32
Alias for the unsigned 32-bit integer type.
Definition: types.h:82
signed long int i64
Alias for the signed 64-bit integer type.
Definition: types.h:64