bao1x_api/api.rs
1/// The Opcode numbers here should not be changed. You can add new ones,
2/// but do not re-use old numbers or repurpose them. This is because the
3/// numbers are hard-coded in other libraries in order to break circular
4/// dependencies on this file.
5#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)]
6#[repr(usize)]
7pub enum HalOpcode {
8 /// Allocate an IFRAM block
9 MapIfram = 0,
10 /// Deallocate an IFRAM block
11 UnmapIfram = 1,
12
13 /// Manage BIO behaviors. BIO requires real-time behaviors, so
14 /// the idea is that this service encodes a set of "behaviors" that
15 /// are API extensions which are modular. The behaviors are set up as
16 /// feature flags. Fast bulk data transfer to/from the behaviors is
17 /// done using IFRAM blocks, which are managed by the above API calls;
18 /// otherwise "singleton" peeks and pokes to the BIO should be handled
19 /// with specific ScalarMessage calls to minimize OS overhead in
20 /// context-switching to the block.
21 #[cfg(feature = "bio")]
22 ConfigurePioBehavior = 2,
23
24 /// Gutter for Invalid Calls
25 InvalidCall = 3,
26
27 /// Configure Iox (memory mutable lend)
28 ConfigureIox = 4,
29 /// Set the whole bank with a value/bitmask pair (blocking scalar)
30 SetGpioBank = 5,
31 /// Return the value of a GPIO bank (blocking scalar)
32 GetGpioBank = 6,
33 /// Configure BIO pins
34 ConfigureBio = 17,
35
36 /// Configure UDMA clocks & events
37 // blocking scalar
38 ConfigureUdmaClock = 7,
39 // blocking scalar
40 ConfigureUdmaEvent = 8,
41 // blocking scalar
42 UdmaIrqStatusBits = 16,
43
44 /// I2C operations
45 I2c = 9,
46
47 /// Peripheral reset
48 PeriphReset = 10,
49
50 /// Configure Iox IRQ
51 ConfigureIoxIrq = 11,
52 IrqLocalHandler = 12,
53
54 /// Manipulate the OS timer
55 SetPreemptionState = 64,
56
57 /// Behavior opcode base
58 #[cfg(feature = "bio")]
59 BehaviorBase0 = 0x1000,
60 #[cfg(feature = "bio")]
61 BehaviorBase1 = 0x2000,
62 #[cfg(feature = "bio")]
63 BehaviorBase2 = 0x3000,
64 #[cfg(feature = "bio")]
65 BehaviorBase3 = 0x4000,
66}