nr.rs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #![allow(missing_docs)]
  8. pub const CLOCK: usize = 0x10;
  9. pub const CLOSE: usize = 0x02;
  10. pub const ELAPSED: usize = 0x30;
  11. pub const ERRNO: usize = 0x13;
  12. pub const FLEN: usize = 0x0c;
  13. pub const GET_CMDLINE: usize = 0x15;
  14. pub const HEAPINFO: usize = 0x16;
  15. pub const ISERROR: usize = 0x08;
  16. pub const ISTTY: usize = 0x09;
  17. pub const OPEN: usize = 0x01;
  18. pub const READ: usize = 0x06;
  19. pub const READC: usize = 0x07;
  20. pub const REMOVE: usize = 0x0e;
  21. pub const RENAME: usize = 0x0f;
  22. pub const SEEK: usize = 0x0a;
  23. pub const SYSTEM: usize = 0x12;
  24. pub const TICKFREQ: usize = 0x31;
  25. pub const TIME: usize = 0x11;
  26. pub const TMPNAM: usize = 0x0d;
  27. pub const WRITE0: usize = 0x04;
  28. pub const WRITE: usize = 0x05;
  29. pub const WRITEC: usize = 0x03;
  30. pub const ENTER_SVC: usize = 0x17;
  31. pub const REPORT_EXCEPTION: usize = 0x18;
  32. /// Values for the mode parameter of the OPEN syscall.
  33. pub mod open {
  34. /// Mode corresponding to fopen "r" mode.
  35. pub const R: usize = 0;
  36. /// Mode corresponding to fopen "rb" mode.
  37. pub const R_BINARY: usize = 1;
  38. /// Mode corresponding to fopen "r+" mode.
  39. pub const RW: usize = 2;
  40. /// Mode corresponding to fopen "r+b" mode.
  41. pub const RW_BINARY: usize = 3;
  42. /// Mode corresponding to fopen "w" mode.
  43. pub const W_TRUNC: usize = 4;
  44. /// Mode corresponding to fopen "wb" mode.
  45. pub const W_TRUNC_BINARY: usize = 5;
  46. /// Mode corresponding to fopen "w+" mode.
  47. pub const RW_TRUNC: usize = 6;
  48. /// Mode corresponding to fopen "w+b" mode.
  49. pub const RW_TRUNC_BINARY: usize = 7;
  50. /// Mode corresponding to fopen "a" mode.
  51. pub const W_APPEND: usize = 8;
  52. /// Mode corresponding to fopen "ab" mode.
  53. pub const W_APPEND_BINARY: usize = 9;
  54. /// Mode corresponding to fopen "a+" mode.
  55. pub const RW_APPEND: usize = 10;
  56. /// Mode corresponding to fopen "a+b" mode.
  57. pub const RW_APPEND_BINARY: usize = 11;
  58. }