xous_api_ticktimer/
api.rs

1/// Do not modify the discriminants in this structure. They are used in `libstd` directly.
2#[repr(usize)]
3#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
4pub enum Opcode {
5    /// Get the elapsed time in milliseconds
6    ElapsedMs = 0,
7
8    /// Sleep for the specified numer of milliseconds
9    SleepMs = 1,
10
11    /// Recalculate the sleep time
12    RecalculateSleep = 2,
13
14    /// Suspend/resume callback
15    SuspendResume = 3,
16
17    /// force a WDT update
18    PingWdt = 4,
19
20    /// Return the version string of Xous. We bury it here because this is a small, lightweight server we can
21    /// rebuild on every run.
22    GetVersion = 5,
23
24    /// Lock the given Mutex, blocking if it is already locked.
25    ///
26    /// # Arguments
27    ///
28    /// *arg1*: An integer of some sort, such as the address of the Mutex
29    LockMutex = 6,
30
31    /// Unlock the given Mutex
32    ///
33    /// # Arguments
34    ///
35    /// *arg1*: An integer of some sort, such as the address of the Mutex
36    UnlockMutex = 7,
37
38    /// Wait for a given condition to be signalled
39    ///
40    /// # Arguments
41    ///
42    /// *arg1*: An integer of some sort, such as the address of the Condvar
43    /// *arg2*: The number of milliseconds to wait, or 0 to wait forever
44    WaitForCondition = 8,
45
46    /// Notify a condition
47    ///
48    /// # Arguments
49    ///
50    /// *arg1*: An integer of some sort, such as the address of the Condvar
51    /// *arg2*: The number of conditions to notify
52    NotifyCondition = 9,
53
54    /// Free a Mutex
55    ///
56    /// This call will free a Mutex that was previously Locked or Unlocked.
57    /// Doing so causes the Mutex to be unlocked.
58    ///
59    /// # Arguments
60    ///
61    /// *arg1*: The integer that matches the Mutex value
62    FreeMutex = 10,
63
64    /// Free a Condition
65    ///
66    /// This call will free a Condition that was previously waited upon. All
67    /// pending threads will be forgotten.
68    ///
69    /// # Arguments
70    ///
71    /// *arg1*: The integer that matches the Condition value
72    FreeCondition = 11,
73
74    /// Invalid call -- an error occurred decoding the opcode
75    InvalidCall = u32::MAX as usize,
76}
77
78#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
79pub struct VersionString {
80    pub version: String,
81}