riscv_semihosting/
nr.rs

1//! Semihosting operations
2//!
3//! The details of what each operation does can be found in the
4//! [ARM Semihosting Specification](https://github.com/ARM-software/abi-aa/blob/main/semihosting/semihosting.rst#semihosting-operations).
5//! The RISC-V Semihosting operations are identiacal to ARM's, so their
6//! documentation is sufficient.
7
8#![allow(missing_docs)]
9
10pub const CLOCK: usize = 0x10;
11pub const CLOSE: usize = 0x02;
12pub const ELAPSED: usize = 0x30;
13pub const ERRNO: usize = 0x13;
14pub const FLEN: usize = 0x0c;
15pub const GET_CMDLINE: usize = 0x15;
16pub const HEAPINFO: usize = 0x16;
17pub const ISERROR: usize = 0x08;
18pub const ISTTY: usize = 0x09;
19pub const OPEN: usize = 0x01;
20pub const READ: usize = 0x06;
21pub const READC: usize = 0x07;
22pub const REMOVE: usize = 0x0e;
23pub const RENAME: usize = 0x0f;
24pub const SEEK: usize = 0x0a;
25pub const SYSTEM: usize = 0x12;
26pub const TICKFREQ: usize = 0x31;
27pub const TIME: usize = 0x11;
28pub const TMPNAM: usize = 0x0d;
29pub const WRITE0: usize = 0x04;
30pub const WRITE: usize = 0x05;
31pub const WRITEC: usize = 0x03;
32pub const ENTER_SVC: usize = 0x17;
33pub const REPORT_EXCEPTION: usize = 0x18;
34
35/// Values for the mode parameter of the OPEN syscall.
36pub mod open {
37    /// Mode corresponding to fopen "r" mode.
38    pub const R: usize = 0;
39    /// Mode corresponding to fopen "rb" mode.
40    pub const R_BINARY: usize = 1;
41    /// Mode corresponding to fopen "r+" mode.
42    pub const RW: usize = 2;
43    /// Mode corresponding to fopen "r+b" mode.
44    pub const RW_BINARY: usize = 3;
45    /// Mode corresponding to fopen "w" mode.
46    pub const W_TRUNC: usize = 4;
47    /// Mode corresponding to fopen "wb" mode.
48    pub const W_TRUNC_BINARY: usize = 5;
49    /// Mode corresponding to fopen "w+" mode.
50    pub const RW_TRUNC: usize = 6;
51    /// Mode corresponding to fopen "w+b" mode.
52    pub const RW_TRUNC_BINARY: usize = 7;
53    /// Mode corresponding to fopen "a" mode.
54    pub const W_APPEND: usize = 8;
55    /// Mode corresponding to fopen "ab" mode.
56    pub const W_APPEND_BINARY: usize = 9;
57    /// Mode corresponding to fopen "a+" mode.
58    pub const RW_APPEND: usize = 10;
59    /// Mode corresponding to fopen "a+b" mode.
60    pub const RW_APPEND_BINARY: usize = 11;
61}