⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Trb

Struct Trb 

Source
#[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: u32

Parameter low DWORD (meaning varies by TRB type)

§parameter_hi: u32

Parameter high DWORD

§status: u32

Status DWORD (transfer length, completion code, etc.)

§control: u32

Control DWORD (TRB type, cycle bit, flags)

Implementations§

Source§

impl Trb

Source

pub const fn zeroed() -> Self

Create a zeroed TRB

Source

pub fn trb_type(&self) -> u8

Get the TRB type field (bits 15:10 of control)

Source

pub fn set_trb_type(&mut self, trb_type: u8)

Set the TRB type field

Source

pub fn cycle_bit(&self) -> bool

Get the cycle bit

Source

pub fn set_cycle_bit(&mut self, cycle: bool)

Set the cycle bit

Source

pub fn completion_code(&self) -> u8

Get completion code from status DWORD (bits 31:24)

Source

pub fn slot_id(&self) -> u8

Get the slot ID from control DWORD (bits 31:24)

Source

pub fn set_slot_id(&mut self, slot: u8)

Set the slot ID in control DWORD (bits 31:24)

Source

pub fn transfer_length(&self) -> u32

Get the transfer length from status DWORD (bits 16:0)

Source

pub fn set_transfer_length(&mut self, len: u32)

Set the transfer length in status DWORD (bits 16:0)

Source

pub fn normal(data_phys: u64, length: u32, ioc: bool, cycle: bool) -> Self

Create a Normal TRB for bulk/interrupt transfers

Source

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

Source

pub fn data_stage( data_phys: u64, length: u32, direction_in: bool, cycle: bool, ) -> Self

Create a Data Stage TRB for control transfers

Source

pub fn status_stage(direction_in: bool, ioc: bool, cycle: bool) -> Self

Create a Status Stage TRB for control transfers

Create a Link TRB pointing to the start of a ring segment

Source

pub fn event_data(data: u64, ioc: bool, cycle: bool) -> Self

Create an Event Data TRB

Source

pub fn noop(ioc: bool, cycle: bool) -> Self

Create a No-Op TRB (transfer ring)

Source

pub fn enable_slot(cycle: bool) -> Self

Create an Enable Slot Command TRB

Source

pub fn disable_slot(slot_id: u8, cycle: bool) -> Self

Create a Disable Slot Command TRB

Source

pub fn address_device( input_context_phys: u64, slot_id: u8, bsr: bool, cycle: bool, ) -> Self

Create an Address Device Command TRB

Source

pub fn configure_endpoint( input_context_phys: u64, slot_id: u8, deconfigure: bool, cycle: bool, ) -> Self

Create a Configure Endpoint Command TRB

Source

pub fn noop_cmd(cycle: bool) -> Self

Create a No-Op Command TRB

Trait Implementations§

Source§

impl Clone for Trb

Source§

fn clone(&self) -> Trb

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Trb

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Trb

Source§

fn eq(&self, other: &Trb) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Trb

Source§

impl Eq for Trb

Source§

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 T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.