#[repr(C, packed(1))]pub struct CommandBlockWrapper {
pub signature: u32,
pub tag: u32,
pub data_transfer_length: u32,
pub flags: u8,
pub lun: u8,
pub cb_length: u8,
pub cb: [u8; 16],
}Expand description
Command Block Wrapper (31 bytes)
Sent from host to device on the Bulk-Out endpoint to initiate a command.
Fields§
§signature: u32Signature: must be CBW_SIGNATURE (0x43425355)
tag: u32Tag: unique per-command identifier, echoed in CSW
data_transfer_length: u32Data transfer length in bytes
flags: u8Flags: bit 7 = direction (0 = OUT, 1 = IN)
lun: u8Logical Unit Number (bits 3:0)
cb_length: u8Length of the command block (1-16)
cb: [u8; 16]SCSI Command Descriptor Block (16 bytes, zero-padded)
Implementations§
Source§impl CommandBlockWrapper
impl CommandBlockWrapper
Sourcepub fn new(
tag: u32,
data_length: u32,
direction: u8,
lun: u8,
command: &[u8],
) -> Self
pub fn new( tag: u32, data_length: u32, direction: u8, lun: u8, command: &[u8], ) -> Self
Create a new CBW with default values
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, KernelError>
pub fn from_bytes(data: &[u8]) -> Result<Self, KernelError>
Deserialize a CBW from a 31-byte slice
Trait Implementations§
Source§impl Clone for CommandBlockWrapper
impl Clone for CommandBlockWrapper
Source§fn clone(&self) -> CommandBlockWrapper
fn clone(&self) -> CommandBlockWrapper
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CommandBlockWrapper
impl Debug for CommandBlockWrapper
impl Copy for CommandBlockWrapper
Auto Trait Implementations§
impl Freeze for CommandBlockWrapper
impl RefUnwindSafe for CommandBlockWrapper
impl Send for CommandBlockWrapper
impl Sync for CommandBlockWrapper
impl Unpin for CommandBlockWrapper
impl UnwindSafe for CommandBlockWrapper
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)