mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
checking in a refactor that we're going to abort
This commit is contained in:
parent
d68e3e8cf4
commit
f9439b48d6
4 changed files with 34 additions and 17 deletions
18
Cargo.lock
generated
18
Cargo.lock
generated
|
|
@ -34,12 +34,12 @@ checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1"
|
|||
|
||||
[[package]]
|
||||
name = "as-slice"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb4d1c23475b74e3672afa8c2be22040b8b7783ad9b461021144ed10a46bb0e6"
|
||||
checksum = "45403b49e3954a4b8428a0ac21a4b7afadccf92bfd96273f1a58cd4812496ae0"
|
||||
dependencies = [
|
||||
"generic-array 0.12.3",
|
||||
"generic-array 0.13.2",
|
||||
"generic-array 0.12.4",
|
||||
"generic-array 0.13.3",
|
||||
"generic-array 0.14.4",
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
|
@ -424,18 +424,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.12.3"
|
||||
version = "0.12.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
|
||||
checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.13.2"
|
||||
version = "0.13.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ed1e761351b56f54eb9dcd0cfaca9fd0daecf93918e1cfc01c8a3d26ee7adcd"
|
||||
checksum = "f797e67af32588215eaaab8327027ee8e71b9dd0b2b26996aedf20c030fce309"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
]
|
||||
|
|
@ -511,7 +511,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "74911a68a1658cfcfb61bc0ccfbd536e3b6e906f8c2f7883ee50157e3e2184f1"
|
||||
dependencies = [
|
||||
"as-slice",
|
||||
"generic-array 0.13.2",
|
||||
"generic-array 0.13.3",
|
||||
"hash32",
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -47,8 +47,6 @@ pub fn post_textview(gam_cid: xous::CID, tv: &mut TextView) -> Result<(), xous::
|
|||
tv.bounds_computed = tvr.bounds_computed;
|
||||
tv.cursor = tvr.cursor;
|
||||
} else {
|
||||
let tvr = returned.deserialize();
|
||||
info!("got {:?}", tvr);
|
||||
panic!("GAM_API: post_textview got a return value from the server that isn't expected or handled");
|
||||
}
|
||||
|
||||
|
|
@ -132,8 +130,6 @@ pub fn set_canvas_bounds_request(gam_cid: xous::CID, req: &mut SetCanvasBoundsRe
|
|||
let ret: SetCanvasBoundsRequest = result.deserialize();
|
||||
req.granted = ret.granted;
|
||||
} else {
|
||||
let ret = returned.deserialize();
|
||||
info!("got {:?}", ret);
|
||||
panic!("GAM_API: set_canvas_bounds_request view got a return value from the server that isn't expected or handled");
|
||||
}
|
||||
Ok(())
|
||||
|
|
@ -160,8 +156,6 @@ pub fn request_content_canvas(gam_cid: xous::CID, requestor_name: &str) -> Resul
|
|||
let ret: ContentCanvasRequest = result.deserialize();
|
||||
Ok(ret.canvas)
|
||||
} else {
|
||||
let ret = returned.deserialize();
|
||||
info!("got {:?}", ret);
|
||||
log::error!("GAM_API: request_content_canvas got a return value from the server that isn't expected or handled");
|
||||
Err(xous::Error::InternalError)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,13 +75,34 @@ pub struct I2cTransaction {
|
|||
rxlen: u32,
|
||||
timeout_ms: u32,
|
||||
// response field to the calling server
|
||||
pub status: I2cStatus,
|
||||
status: I2cStatus,
|
||||
}
|
||||
impl I2cTransaction {
|
||||
pub fn new() -> Self {
|
||||
I2cTransaction{ bus_addr: 0, txbuf: None, txlen: 0, rxbuf: None, rxlen: 0, timeout_ms: 100, status: I2cStatus::Uninitialized }
|
||||
}
|
||||
pub fn status(&self) -> I2cStatus { self.status }
|
||||
}
|
||||
use core::ops::{DerefMut, Deref};
|
||||
impl Deref for I2cTransaction {
|
||||
type Target = [u8];
|
||||
fn deref(&self) -> &[u8] {
|
||||
unsafe {
|
||||
core::slice::from_raw_parts(self as *const I2cTransaction as *const u8, core::mem::size_of::<I2cTransaction>())
|
||||
as &[u8]
|
||||
}
|
||||
}
|
||||
}
|
||||
impl DerefMut for I2cTransaction {
|
||||
fn deref_mut(&mut self) -> &mut [u8] {
|
||||
unsafe {
|
||||
core::slice::from_raw_parts_mut(self as *mut I2cTransaction as *mut u8, core::mem::size_of::<I2cTransaction>())
|
||||
as &mut [u8]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////// VIBE
|
||||
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
|
||||
|
|
|
|||
|
|
@ -34,7 +34,9 @@ pub fn send_i2c_request(cid: CID, transaction: I2cTransaction) -> Result<I2cStat
|
|||
|
||||
let returned = unsafe { rkyv::archived_value::<api::Opcode>(buf.as_ref(), pos)};
|
||||
if let rkyv::Archived::<api::Opcode>::I2cTxRx(result) = returned {
|
||||
Ok(result.status)
|
||||
use core::ops::DerefMut;
|
||||
transaction.deref_mut() = result.as_slice();
|
||||
Ok(transaction.status)
|
||||
} else {
|
||||
log::info!("send_i2c_request saw an unhandled return type of {:?}", buf);
|
||||
Err(xous::Error::InternalError)
|
||||
|
|
|
|||
Loading…
Reference in a new issue