rp-pac

Crates

git

Versions

rp235x

Flavors

Struct rp_pac::usb::Usb

source ·
pub struct Usb { /* private fields */ }
Expand description

USB FS/LS controller device registers

Implementations§

source§

impl Usb

source

pub const unsafe fn from_ptr(ptr: *mut ()) -> Self

source

pub const fn as_ptr(&self) -> *mut ()

source

pub const fn addr_endp(self) -> Reg<AddrEndp, RW>

Device address and endpoint control

source

pub const fn addr_endp_x(self, n: usize) -> Reg<AddrEndpX, RW>

Interrupt endpoint 1. Only valid for HOST mode.

source

pub const fn main_ctrl(self) -> Reg<MainCtrl, RW>

Main control register

source

pub const fn sof_wr(self) -> Reg<SofWr, RW>

Set the SOF (Start of Frame) frame number in the host controller. The SOF packet is sent every 1ms and the host will increment the frame number by 1 each time.

source

pub const fn sof_rd(self) -> Reg<SofRd, RW>

Read the last SOF (Start of Frame) frame number seen. In device mode the last SOF received from the host. In host mode the last SOF sent by the host.

source

pub const fn sie_ctrl(self) -> Reg<SieCtrl, RW>

SIE control register

source

pub const fn sie_status(self) -> Reg<SieStatus, RW>

SIE status register

source

pub const fn int_ep_ctrl(self) -> Reg<IntEpCtrl, RW>

interrupt endpoint control register

source

pub const fn buff_status(self) -> Reg<BuffStatus, RW>

Buffer status register. A bit set here indicates that a buffer has completed on the endpoint (if the buffer interrupt is enabled). It is possible for 2 buffers to be completed, so clearing the buffer status bit may instantly re set it on the next clock cycle.

source

pub const fn buff_cpu_should_handle(self) -> Reg<BuffCpuShouldHandle, RW>

Which of the double buffers should be handled. Only valid if using an interrupt per buffer (i.e. not per 2 buffers). Not valid for host interrupt endpoint polling because they are only single buffered.

source

pub const fn ep_abort(self) -> Reg<EpAbort, RW>

Device only: Can be set to ignore the buffer control register for this endpoint in case you would like to revoke a buffer. A NAK will be sent for every access to the endpoint until this bit is cleared. A corresponding bit in EP_ABORT_DONE is set when it is safe to modify the buffer control register.

source

pub const fn ep_abort_done(self) -> Reg<EpAbortDone, RW>

Device only: Used in conjunction with EP_ABORT. Set once an endpoint is idle so the programmer knows it is safe to modify the buffer control register.

source

pub const fn ep_stall_arm(self) -> Reg<EpStallArm, RW>

Device: this bit must be set in conjunction with the STALL bit in the buffer control register to send a STALL on EP0. The device controller clears these bits when a SETUP packet is received because the USB spec requires that a STALL condition is cleared when a SETUP packet is received.

source

pub const fn nak_poll(self) -> Reg<NakPoll, RW>

Used by the host controller. Sets the wait time in microseconds before trying again if the device replies with a NAK.

source

pub const fn ep_status_stall_nak(self) -> Reg<EpStatusStallNak, RW>

Device: bits are set when the IRQ_ON_NAK or IRQ_ON_STALL bits are set. For EP0 this comes from SIE_CTRL. For all other endpoints it comes from the endpoint control register.

source

pub const fn usb_muxing(self) -> Reg<UsbMuxing, RW>

Where to connect the USB controller. Should be to_phy by default.

source

pub const fn usb_pwr(self) -> Reg<UsbPwr, RW>

Overrides for the power signals in the event that the VBUS signals are not hooked up to GPIO. Set the value of the override and then the override enable to switch over to the override value.

source

pub const fn usbphy_direct(self) -> Reg<UsbphyDirect, RW>

This register allows for direct control of the USB phy. Use in conjunction with usbphy_direct_override register to enable each override bit.

source

pub const fn usbphy_direct_override(self) -> Reg<UsbphyDirectOverride, RW>

Override enable for each control in usbphy_direct

source

pub const fn usbphy_trim(self) -> Reg<UsbphyTrim, RW>

Used to adjust trim values of USB phy pull down resistors.

source

pub const fn linestate_tuning(self) -> Reg<LinestateTuning, RW>

Used for debug only.

source

pub const fn intr(self) -> Reg<Int, RW>

Raw Interrupts

source

pub const fn inte(self) -> Reg<Int, RW>

Interrupt Enable

source

pub const fn intf(self) -> Reg<Int, RW>

Interrupt Force

source

pub const fn ints(self) -> Reg<Int, RW>

Interrupt status after masking & forcing

source

pub const fn sof_timestamp_raw(self) -> Reg<SofTimestampRaw, RW>

Device only. Raw value of free-running PHY clock counter @48MHz. Used to calculate time between SOF events.

source

pub const fn sof_timestamp_last(self) -> Reg<SofTimestampLast, RW>

Device only. Value of free-running PHY clock counter @48MHz when last SOF event occurred.

source

pub const fn sm_state(self) -> Reg<SmState, RW>

source

pub const fn ep_tx_error(self) -> Reg<EpTxError, RW>

TX error count for each endpoint. Write to each field to reset the counter to 0.

source

pub const fn ep_rx_error(self) -> Reg<EpRxError, RW>

RX error count for each endpoint. Write to each field to reset the counter to 0.

source

pub const fn dev_sm_watchdog(self) -> Reg<DevSmWatchdog, RW>

Watchdog that forces the device state machine to idle and raises an interrupt if the device stays in a state that isn’t idle for the configured limit. The counter is reset on every state transition. Set limit while enable is low and then set the enable.

Trait Implementations§

source§

impl Clone for Usb

source§

fn clone(&self) -> Usb

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl PartialEq for Usb

source§

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

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

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 Usb

source§

impl Eq for Usb

source§

impl Send for Usb

source§

impl StructuralPartialEq for Usb

source§

impl Sync for Usb

Auto Trait Implementations§

§

impl Freeze for Usb

§

impl RefUnwindSafe for Usb

§

impl Unpin for Usb

§

impl UnwindSafe for Usb

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.