diff --git a/services/cram-hal-service/src/api.rs b/services/cram-hal-service/src/api.rs index c6a1fd3a9..6858610c4 100644 --- a/services/cram-hal-service/src/api.rs +++ b/services/cram-hal-service/src/api.rs @@ -1,66 +1,3 @@ -/// The Opcode numbers here should not be changed. You can add new ones, -/// but do not re-use old numbers or repurpose them. This is because the -/// numbers are hard-coded in other libraries in order to break circular -/// dependencies on this file. -#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)] -#[repr(usize)] -pub enum Opcode { - /// Allocate an IFRAM block - MapIfram = 0, - /// Deallocate an IFRAM block - UnmapIfram = 1, - - /// Manage PIO behaviors. PIO requires real-time behaviors, so - /// the idea is that this service encodes a set of "behaviors" that - /// are API extensions which are modular. The behaviors are set up as - /// feature flags. Fast bulk data transfer to/from the behaviors is - /// done using IFRAM blocks, which are managed by the above API calls; - /// otherwise "singleton" peeks and pokes to the PIO should be handled - /// with specific ScalarMessage calls to minimize OS overhead in - /// context-switching to the block. - #[cfg(feature = "pio")] - ConfigurePioBehavior = 2, - - /// Gutter for Invalid Calls - InvalidCall = 3, - - /// Configure Iox (memory mutable lend) - ConfigureIox = 4, - /// Set the whole bank with a value/bitmask pair (blocking scalar) - SetGpioBank = 5, - /// Return the value of a GPIO bank (blocking scalar) - GetGpioBank = 6, - - /// Configure UDMA clocks & events - // blocking scalar - ConfigureUdmaClock = 7, - // blocking scalar - ConfigureUdmaEvent = 8, - - /// I2C operations - I2c = 9, - - /// Peripheral reset - PeriphReset = 10, - - /// Configure Iox IRQ - ConfigureIoxIrq = 11, - IrqLocalHandler = 12, - - /// Exit server - Quit = 255, - - /// Behavior opcode base - #[cfg(feature = "pio")] - BehaviorBase0 = 0x1000, - #[cfg(feature = "pio")] - BehaviorBase1 = 0x2000, - #[cfg(feature = "pio")] - BehaviorBase2 = 0x3000, - #[cfg(feature = "pio")] - BehaviorBase3 = 0x4000, -} - #[derive(Debug, Copy, Clone, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)] #[cfg(feature = "pio")] pub enum PioBehavior { diff --git a/services/cram-hal-service/src/i2c_lib.rs b/services/cram-hal-service/src/i2c_lib.rs index f33d0297f..7a93c9243 100644 --- a/services/cram-hal-service/src/i2c_lib.rs +++ b/services/cram-hal-service/src/i2c_lib.rs @@ -3,7 +3,7 @@ use core::sync::atomic::{AtomicU32, Ordering}; use cramium_api::*; use xous_ipc::Buffer; -use crate::api::Opcode; +use crate::api::HalOpcode; pub struct I2c { conn: xous::CID, @@ -23,7 +23,7 @@ impl I2c { /// No further I2C requests may happen while this is processing. pub fn i2c_transactions(&self, list: I2cTransactions) -> Result { let mut buf = Buffer::into_buf(list).map_err(|_| xous::Error::InternalError)?; - buf.lend_mut(self.conn, Opcode::I2c as u32)?; + buf.lend_mut(self.conn, HalOpcode::I2c as u32)?; buf.to_original() } } diff --git a/services/cram-hal-service/src/lib.rs b/services/cram-hal-service/src/lib.rs index 5ad152cba..37082e724 100644 --- a/services/cram-hal-service/src/lib.rs +++ b/services/cram-hal-service/src/lib.rs @@ -4,7 +4,6 @@ pub mod trng; use core::sync::atomic::{AtomicU32, Ordering}; -use api::Opcode; use cramium_api::*; pub use i2c_lib::*; use num_traits::*; @@ -27,7 +26,7 @@ impl UdmaGlobal { xous::send_message( self.conn, xous::Message::new_blocking_scalar( - Opcode::ConfigureUdmaClock.to_usize().unwrap(), + HalOpcode::ConfigureUdmaClock.to_usize().unwrap(), peripheral as u32 as usize, if enable { 1 } else { 0 }, 0, @@ -49,7 +48,7 @@ impl UdmaGlobal { xous::send_message( self.conn, xous::Message::new_blocking_scalar( - Opcode::ConfigureUdmaEvent.to_usize().unwrap(), + HalOpcode::ConfigureUdmaEvent.to_usize().unwrap(), peripheral as u32 as usize, et_u32 as usize, to_channel as u32 as usize, @@ -63,7 +62,7 @@ impl UdmaGlobal { xous::send_message( self.conn, xous::Message::new_blocking_scalar( - Opcode::PeriphReset.to_usize().unwrap(), + HalOpcode::PeriphReset.to_usize().unwrap(), peripheral as u32 as usize, 0, 0,