Rishka
RISC-V virtual runtime in C/C++ made for ESP32-WROVER
sys.h
Go to the documentation of this file.
1/*
2 * This file is part of the Rishka distribution (https://github.com/nthnn/rishka).
3 * Copyright (c) 2024 Nathanne Isip.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
27#ifndef LIBRISHKA_SYS_H
28#define LIBRISHKA_SYS_H
29
30#include <librishka/types.h>
31
39typedef enum {
62
70typedef enum {
75
82typedef enum {
89
97class Sys final {
98public:
106 static void delay(u64 ms);
107
115 static u64 micros();
116
124 static u64 millis();
125
137 static i64 shellexec(string cmdline);
138
146 static void exit(i32 code);
147
157 static string info_str(sysinfos_t key);
158
168 static i64 info_num(sysinfon_t key);
169
181 static i64 random();
182
191 static bool change_dir(char* directory);
192
200 static string working_dir();
201};
202
203#endif /* LIBRISHKA_SYS_H */
Class for handling system utilities in Rishka applications.
Definition: sys.h:97
static i64 shellexec(string cmdline)
Execute a shell command.
Definition: librishka_sys.cpp:33
static void exit(i32 code)
Terminate the application with an exit code.
Definition: librishka_sys.cpp:37
static i64 random()
Generate a random integer value.
Definition: librishka_sys.cpp:50
static string info_str(sysinfos_t key)
Get system information as a string.
Definition: librishka_sys.cpp:41
static string working_dir()
Retrieves the current working directory.
Definition: librishka_sys.cpp:58
static void delay(u64 ms)
Delay execution for a specified duration.
Definition: librishka_sys.cpp:21
static u64 micros()
Get the current system time in microseconds.
Definition: librishka_sys.cpp:25
static u64 millis()
Get the current system time in milliseconds.
Definition: librishka_sys.cpp:29
static bool change_dir(char *directory)
Changes the current working directory.
Definition: librishka_sys.cpp:54
static i64 info_num(sysinfon_t key)
Get system information as a numeric value.
Definition: librishka_sys.cpp:46
sysinfon_t
Enumeration for system information numeric keys.
Definition: sys.h:39
@ SYSINFO_MIN_FREE_HEAP
Definition: sys.h:51
@ SYSINFO_MIN_FREE_PSRAM
Definition: sys.h:52
@ SYSINFO_MAX_ALLOC_HEAP
Definition: sys.h:50
@ SYSINFO_USED_STORAGE
Definition: sys.h:60
@ SYSINFO_FREE_HEAP
Definition: sys.h:47
@ SYSINFO_TOTAL_STORAGE
Definition: sys.h:59
@ SYSINFO_NUM_SECTORS
Definition: sys.h:57
@ SYSINFO_CHIP_REV
Definition: sys.h:41
@ SYSINFO_FLASH_MODE
Definition: sys.h:45
@ SYSINFO_CARD_TYPE
Definition: sys.h:55
@ SYSINFO_TEMP_VAL
Definition: sys.h:54
@ SYSINFO_CYCLE_COUNT
Definition: sys.h:43
@ SYSINFO_FREE_PSRAM
Definition: sys.h:48
@ SYSINFO_FLASH_SPEED
Definition: sys.h:46
@ SYSINFO_SECTOR_SIZE
Definition: sys.h:58
@ SYSINFO_PSRAM_SIZE
Definition: sys.h:53
@ SYSINFO_EFUSE_MAC
Definition: sys.h:44
@ SYSINFO_HEAP_SIZE
Definition: sys.h:49
@ SYSINFO_CHIPCORES
Definition: sys.h:40
@ SYSINFO_CPU_FREQ
Definition: sys.h:42
@ SYSINFO_CARD_SIZE
Definition: sys.h:56
sysinfos_t
Enumeration for system information string keys.
Definition: sys.h:70
@ SYSINFO_SKETCH_MD5
Definition: sys.h:73
@ SYSINFO_CHIPMODEL
Definition: sys.h:71
@ SYSINFO_SDK_VERSION
Definition: sys.h:72
sdcard_t
Enumeration for SD card types.
Definition: sys.h:82
@ SD_CARD_SDHC
Definition: sys.h:86
@ SD_CARD_UNKNOWN
Definition: sys.h:87
@ SD_CARD_SD
Definition: sys.h:85
@ SD_CARD_NONE
Definition: sys.h:83
@ SD_CARD_MMC
Definition: sys.h:84
Header file for common data types used in Rishka applications.
signed int i32
Alias for the signed 32-bit integer type.
Definition: types.h:58
signed long int i64
Alias for the signed 64-bit integer type.
Definition: types.h:64
unsigned long int u64
Alias for the unsigned 64-bit integer type.
Definition: types.h:88