RegisterBlock

Struct RegisterBlock 

Source
#[repr(C)]
pub struct RegisterBlock { /* private fields */ }
Expand description

Register block

Implementations§

Source§

impl RegisterBlock

Source

pub const fn control(&self) -> &CONTROL

0x00 - Control register address: Controls the current device’s USB address. Should be written after a SET_ADDRESS request is received. Automatically resets back to zero on a USB reset.

Source

pub const fn endpoint(&self) -> &ENDPOINT

0x01 - Endpoint register number: Selects the endpoint number to prime. This interface allows priming multiple endpoints at once. That is, multiple endpoints can be ready to receive data at a time. See the prime and enable bits for usage.

Source

pub const fn enable(&self) -> &ENABLE

0x02 - Enable register enabled: Controls whether any data can be received on any primed OUT endpoint. This bit is automatically cleared on receive in order to give the controller time to read data from the FIFO. It must be re-enabled once the FIFO has been emptied.

Source

pub const fn prime(&self) -> &PRIME

0x03 - Prime register primed: Controls “priming” an out endpoint. To receive data on any endpoint, the CPU must first select the endpoint with the epno register; and then write a ‘1’ into the prime and enable register. This prepares our FIFO to receive data; and the next OUT transaction will be captured into the FIFO. When a transaction is complete, the enable bit is reset; the prime is not. This effectively means that enable controls receiving on any of the primed endpoints; while prime can be used to build a collection of endpoints willing to participate in receipt. Note that this does not apply to the control endpoint. Once the control endpoint has received a packet it will be un-primed and need to be re-primed before it can receive again. This is to ensure that we can establish an order on the receipt of the setup packet and any associated data. Only one transaction / data packet is captured per enable write; repeated enabling is necessary to capture multiple packets.

Source

pub const fn stall(&self) -> &STALL

0x04 - Stall register stalled: Controls STALL’ing the active endpoint. Setting or clearing this bit will set or clear STALL on the provided endpoint. Endpoint STALLs persist even after epno is changed; so multiple endpoints can be stalled at once by writing their respective endpoint numbers into epno register and then setting their stall bits.

Source

pub const fn pid(&self) -> &PID

0x05 - Pid register toggle: Sets the current PID toggle bit for the given endpoint.

Source

pub const fn status(&self) -> &STATUS

0x06 - Status register epno: Contains the endpoint number associated with the data in the FIFO – that is, the endpoint number on which the relevant data was received. have: 1 iff data is available in the FIFO. pid: Contains the current PID toggle bit for the given endpoint.

Source

pub const fn reset(&self) -> &RESET

0x08 - Reset register fifo: Local reset for the OUT handler; clears the out FIFO.

Source

pub const fn data(&self) -> &DATA

0x09 - Data register Read-only register. A FIFO that returns the bytes from the most recently captured OUT transaction. Reading a byte from this register advances the FIFO. byte: Contains the most recently received byte.

Source

pub const fn ev_enable(&self) -> &EV_ENABLE

0x20 - A CSR register. Parameters ––––– fields : :class:dict or :class:list or :class:Field Collection of register fields. If None (default), a dict is populated from Python :term:variable annotations <python:variable annotations>. fields is used to create a :class:FieldActionMap, :class:FieldActionArray, or :class:FieldAction, depending on its type (dict, list, or Field). Interface attributes –––––––––– element : :class:Element Interface between this register and a CSR bus primitive. Attributes ––––– field : :class:FieldActionMap or :class:FieldActionArray or :class:FieldAction Collection of field instances. f : :class:FieldActionMap or :class:FieldActionArray or :class:FieldAction Shorthand for :attr:Register.field. Raises —— :exc:TypeError If fields is neither None, a :class:dict, a :class:list, or a :class:Field. :exc:ValueError If fields is not None and at least one variable annotation is a :class:Field. :exc:ValueError If element.access is not readable and at least one field is readable. :exc:ValueError If element.access is not writable and at least one field is writable.

Source

pub const fn ev_pending(&self) -> &EV_PENDING

0x21 - A CSR register. Parameters ––––– fields : :class:dict or :class:list or :class:Field Collection of register fields. If None (default), a dict is populated from Python :term:variable annotations <python:variable annotations>. fields is used to create a :class:FieldActionMap, :class:FieldActionArray, or :class:FieldAction, depending on its type (dict, list, or Field). Interface attributes –––––––––– element : :class:Element Interface between this register and a CSR bus primitive. Attributes ––––– field : :class:FieldActionMap or :class:FieldActionArray or :class:FieldAction Collection of field instances. f : :class:FieldActionMap or :class:FieldActionArray or :class:FieldAction Shorthand for :attr:Register.field. Raises —— :exc:TypeError If fields is neither None, a :class:dict, a :class:list, or a :class:Field. :exc:ValueError If fields is not None and at least one variable annotation is a :class:Field. :exc:ValueError If element.access is not readable and at least one field is readable. :exc:ValueError If element.access is not writable and at least one field is writable.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.