#[repr(C, align(16))]pub struct Trb {
pub parameter_lo: u32,
pub parameter_hi: u32,
pub status: u32,
pub control: u32,
}Expand description
Generic 16-byte Transfer Request Block
All TRBs share this common layout per xHCI spec Section 4.11.
Fields§
§parameter_lo: u32Parameter low DWORD (meaning varies by TRB type)
parameter_hi: u32Parameter high DWORD
status: u32Status DWORD (transfer length, completion code, etc.)
control: u32Control DWORD (TRB type, cycle bit, flags)
Implementations§
Source§impl Trb
impl Trb
Sourcepub fn set_trb_type(&mut self, trb_type: u8)
pub fn set_trb_type(&mut self, trb_type: u8)
Set the TRB type field
Sourcepub fn set_cycle_bit(&mut self, cycle: bool)
pub fn set_cycle_bit(&mut self, cycle: bool)
Set the cycle bit
Sourcepub fn completion_code(&self) -> u8
pub fn completion_code(&self) -> u8
Get completion code from status DWORD (bits 31:24)
Sourcepub fn set_slot_id(&mut self, slot: u8)
pub fn set_slot_id(&mut self, slot: u8)
Set the slot ID in control DWORD (bits 31:24)
Sourcepub fn transfer_length(&self) -> u32
pub fn transfer_length(&self) -> u32
Get the transfer length from status DWORD (bits 16:0)
Sourcepub fn set_transfer_length(&mut self, len: u32)
pub fn set_transfer_length(&mut self, len: u32)
Set the transfer length in status DWORD (bits 16:0)
Sourcepub fn normal(data_phys: u64, length: u32, ioc: bool, cycle: bool) -> Self
pub fn normal(data_phys: u64, length: u32, ioc: bool, cycle: bool) -> Self
Create a Normal TRB for bulk/interrupt transfers
Sourcepub fn setup_stage(
request_type: u8,
request: u8,
value: u16,
index: u16,
length: u16,
transfer_type: SetupTransferType,
cycle: bool,
) -> Self
pub fn setup_stage( request_type: u8, request: u8, value: u16, index: u16, length: u16, transfer_type: SetupTransferType, cycle: bool, ) -> Self
Create a Setup Stage TRB for control transfers
Sourcepub fn data_stage(
data_phys: u64,
length: u32,
direction_in: bool,
cycle: bool,
) -> Self
pub fn data_stage( data_phys: u64, length: u32, direction_in: bool, cycle: bool, ) -> Self
Create a Data Stage TRB for control transfers
Sourcepub fn status_stage(direction_in: bool, ioc: bool, cycle: bool) -> Self
pub fn status_stage(direction_in: bool, ioc: bool, cycle: bool) -> Self
Create a Status Stage TRB for control transfers
Sourcepub fn link(segment_phys: u64, toggle_cycle: bool, cycle: bool) -> Self
pub fn link(segment_phys: u64, toggle_cycle: bool, cycle: bool) -> Self
Create a Link TRB pointing to the start of a ring segment
Sourcepub fn event_data(data: u64, ioc: bool, cycle: bool) -> Self
pub fn event_data(data: u64, ioc: bool, cycle: bool) -> Self
Create an Event Data TRB
Sourcepub fn enable_slot(cycle: bool) -> Self
pub fn enable_slot(cycle: bool) -> Self
Create an Enable Slot Command TRB
Sourcepub fn disable_slot(slot_id: u8, cycle: bool) -> Self
pub fn disable_slot(slot_id: u8, cycle: bool) -> Self
Create a Disable Slot Command TRB
Sourcepub fn address_device(
input_context_phys: u64,
slot_id: u8,
bsr: bool,
cycle: bool,
) -> Self
pub fn address_device( input_context_phys: u64, slot_id: u8, bsr: bool, cycle: bool, ) -> Self
Create an Address Device Command TRB
Sourcepub fn configure_endpoint(
input_context_phys: u64,
slot_id: u8,
deconfigure: bool,
cycle: bool,
) -> Self
pub fn configure_endpoint( input_context_phys: u64, slot_id: u8, deconfigure: bool, cycle: bool, ) -> Self
Create a Configure Endpoint Command TRB
Trait Implementations§
impl Copy for Trb
impl Eq for Trb
impl StructuralPartialEq for Trb
Auto Trait Implementations§
impl Freeze for Trb
impl RefUnwindSafe for Trb
impl Send for Trb
impl Sync for Trb
impl Unpin for Trb
impl UnwindSafe for Trb
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
§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)
clone_to_uninit)