mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
add missing feature flags to usb device crate
This commit is contained in:
parent
b7c4587505
commit
215f15f138
3 changed files with 16 additions and 9 deletions
|
|
@ -33,8 +33,11 @@ pub(crate) enum Opcode {
|
||||||
/// Query if the HID driver was able to start
|
/// Query if the HID driver was able to start
|
||||||
IsSocCompatible,
|
IsSocCompatible,
|
||||||
|
|
||||||
|
#[cfg(feature="mass-storage")]
|
||||||
SetBlockDevice,
|
SetBlockDevice,
|
||||||
|
#[cfg(feature="mass-storage")]
|
||||||
SetBlockDeviceSID,
|
SetBlockDeviceSID,
|
||||||
|
#[cfg(feature="mass-storage")]
|
||||||
ResetBlockDevice,
|
ResetBlockDevice,
|
||||||
|
|
||||||
/// Handle the USB interrupt
|
/// Handle the USB interrupt
|
||||||
|
|
|
||||||
|
|
@ -24,24 +24,24 @@ impl UsbHid {
|
||||||
conn
|
conn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature="mass-storage")]
|
||||||
pub fn set_block_device(&self, read_id: usize, write_id: usize, max_lba_id: usize) {
|
pub fn set_block_device(&self, read_id: usize, write_id: usize, max_lba_id: usize) {
|
||||||
send_message(self.conn,
|
send_message(self.conn,
|
||||||
Message::new_blocking_scalar(
|
Message::new_blocking_scalar(
|
||||||
Opcode::SetBlockDevice.to_usize().unwrap(),
|
Opcode::SetBlockDevice.to_usize().unwrap(),
|
||||||
read_id,
|
read_id,
|
||||||
write_id,
|
write_id,
|
||||||
max_lba_id,
|
max_lba_id,
|
||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
).unwrap();
|
).unwrap();
|
||||||
}
|
}
|
||||||
|
#[cfg(feature="mass-storage")]
|
||||||
pub fn set_block_device_sid(&self, app_sid: xous::SID) {
|
pub fn set_block_device_sid(&self, app_sid: xous::SID) {
|
||||||
let sid = app_sid.to_u32();
|
let sid = app_sid.to_u32();
|
||||||
send_message(self.conn,
|
send_message(self.conn,
|
||||||
Message::new_blocking_scalar(
|
Message::new_blocking_scalar(
|
||||||
Opcode::SetBlockDeviceSID.to_usize().unwrap(),
|
Opcode::SetBlockDeviceSID.to_usize().unwrap(),
|
||||||
sid.0 as usize,
|
sid.0 as usize,
|
||||||
sid.1 as usize,
|
sid.1 as usize,
|
||||||
sid.2 as usize,
|
sid.2 as usize,
|
||||||
|
|
@ -49,11 +49,11 @@ impl UsbHid {
|
||||||
)
|
)
|
||||||
).unwrap();
|
).unwrap();
|
||||||
}
|
}
|
||||||
|
#[cfg(feature="mass-storage")]
|
||||||
pub fn reset_block_device(&self) {
|
pub fn reset_block_device(&self) {
|
||||||
send_message(self.conn,
|
send_message(self.conn,
|
||||||
Message::new_blocking_scalar(
|
Message::new_blocking_scalar(
|
||||||
Opcode::ResetBlockDevice.to_usize().unwrap(),
|
Opcode::ResetBlockDevice.to_usize().unwrap(),
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
|
||||||
|
|
@ -226,8 +226,9 @@ pub(crate) fn main_hw() -> ! {
|
||||||
let ums_alloc = UsbBusAllocator::new(ums_dev);
|
let ums_alloc = UsbBusAllocator::new(ums_dev);
|
||||||
#[cfg(feature="mass-storage")]
|
#[cfg(feature="mass-storage")]
|
||||||
let abd = apps_block_device::AppsBlockDevice::new();
|
let abd = apps_block_device::AppsBlockDevice::new();
|
||||||
|
#[cfg(feature="mass-storage")]
|
||||||
let abdcid = abd.conn();
|
let abdcid = abd.conn();
|
||||||
|
#[cfg(feature="mass-storage")]
|
||||||
let mut ums = usbd_scsi::Scsi::new(
|
let mut ums = usbd_scsi::Scsi::new(
|
||||||
&ums_alloc,
|
&ums_alloc,
|
||||||
64,
|
64,
|
||||||
|
|
@ -352,6 +353,7 @@ pub(crate) fn main_hw() -> ! {
|
||||||
let opcode: Option<Opcode> = FromPrimitive::from_usize(msg.body.id());
|
let opcode: Option<Opcode> = FromPrimitive::from_usize(msg.body.id());
|
||||||
log::debug!("{:?}", opcode);
|
log::debug!("{:?}", opcode);
|
||||||
match opcode {
|
match opcode {
|
||||||
|
#[cfg(feature="mass-storage")]
|
||||||
Some(Opcode::SetBlockDevice) => msg_blocking_scalar_unpack!(msg, read_id, write_id, max_lba_id, _, {
|
Some(Opcode::SetBlockDevice) => msg_blocking_scalar_unpack!(msg, read_id, write_id, max_lba_id, _, {
|
||||||
xous::send_message(
|
xous::send_message(
|
||||||
abdcid,
|
abdcid,
|
||||||
|
|
@ -361,6 +363,7 @@ pub(crate) fn main_hw() -> ! {
|
||||||
).unwrap();
|
).unwrap();
|
||||||
xous::return_scalar(msg.sender, 0).unwrap();
|
xous::return_scalar(msg.sender, 0).unwrap();
|
||||||
}),
|
}),
|
||||||
|
#[cfg(feature="mass-storage")]
|
||||||
Some(Opcode::SetBlockDeviceSID) => msg_blocking_scalar_unpack!(msg, sid1, sid2, sid3, sid4, {
|
Some(Opcode::SetBlockDeviceSID) => msg_blocking_scalar_unpack!(msg, sid1, sid2, sid3, sid4, {
|
||||||
xous::send_message(abdcid,
|
xous::send_message(abdcid,
|
||||||
xous::Message::new_blocking_scalar(
|
xous::Message::new_blocking_scalar(
|
||||||
|
|
@ -369,6 +372,7 @@ pub(crate) fn main_hw() -> ! {
|
||||||
).unwrap();
|
).unwrap();
|
||||||
xous::return_scalar(msg.sender, 0).unwrap();
|
xous::return_scalar(msg.sender, 0).unwrap();
|
||||||
}),
|
}),
|
||||||
|
#[cfg(feature="mass-storage")]
|
||||||
Some(Opcode::ResetBlockDevice) => msg_blocking_scalar_unpack!(msg, 0, 0, 0, 0, {
|
Some(Opcode::ResetBlockDevice) => msg_blocking_scalar_unpack!(msg, 0, 0, 0, 0, {
|
||||||
xous::send_message(abdcid,
|
xous::send_message(abdcid,
|
||||||
xous::Message::new_blocking_scalar(
|
xous::Message::new_blocking_scalar(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue