pub struct USBCTRL_REGS { /* private fields */ }
Expand description

USB FS/LS controller device registers

Implementations§

source§

impl USBCTRL_REGS

source

pub const PTR: *const RegisterBlock = {0x50110000 as *const usbctrl_regs::RegisterBlock}

Pointer to the register block

source

pub const fn ptr() -> *const RegisterBlock

Return the pointer to the register block

source

pub unsafe fn steal() -> Self

Steal an instance of this peripheral

§Safety

Ensure that the new instance of the peripheral cannot be used in a way that may race with any existing instances, for example by only accessing read-only or write-only registers, or by consuming the original peripheral and using critical sections to coordinate access between multiple new instances.

Additionally, other software such as HALs may rely on only one peripheral instance existing to ensure memory safety; ensure no stolen instances are passed to such software.

Methods from Deref<Target = RegisterBlock>§

source

pub fn addr_endp(&self) -> &ADDR_ENDP

0x00 - Device address and endpoint control

source

pub fn host_addr_endp(&self, n: usize) -> &HOST_ADDR_ENDP

0x04..0x40 - Interrupt endpoints. Only valid in HOST mode.

source

pub fn host_addr_endp_iter(&self) -> impl Iterator<Item = &HOST_ADDR_ENDP>

Iterator for array of: 0x04..0x40 - Interrupt endpoints. Only valid in HOST mode.

source

pub fn host_addr_endp1(&self) -> &HOST_ADDR_ENDP

0x04 - Interrupt endpoints. Only valid in HOST mode.

source

pub fn host_addr_endp2(&self) -> &HOST_ADDR_ENDP

0x08 - Interrupt endpoints. Only valid in HOST mode.

source

pub fn host_addr_endp3(&self) -> &HOST_ADDR_ENDP

0x0c - Interrupt endpoints. Only valid in HOST mode.

source

pub fn host_addr_endp4(&self) -> &HOST_ADDR_ENDP

0x10 - Interrupt endpoints. Only valid in HOST mode.

source

pub fn host_addr_endp5(&self) -> &HOST_ADDR_ENDP

0x14 - Interrupt endpoints. Only valid in HOST mode.

source

pub fn host_addr_endp6(&self) -> &HOST_ADDR_ENDP

0x18 - Interrupt endpoints. Only valid in HOST mode.

source

pub fn host_addr_endp7(&self) -> &HOST_ADDR_ENDP

0x1c - Interrupt endpoints. Only valid in HOST mode.

source

pub fn host_addr_endp8(&self) -> &HOST_ADDR_ENDP

0x20 - Interrupt endpoints. Only valid in HOST mode.

source

pub fn host_addr_endp9(&self) -> &HOST_ADDR_ENDP

0x24 - Interrupt endpoints. Only valid in HOST mode.

source

pub fn host_addr_endp10(&self) -> &HOST_ADDR_ENDP

0x28 - Interrupt endpoints. Only valid in HOST mode.

source

pub fn host_addr_endp11(&self) -> &HOST_ADDR_ENDP

0x2c - Interrupt endpoints. Only valid in HOST mode.

source

pub fn host_addr_endp12(&self) -> &HOST_ADDR_ENDP

0x30 - Interrupt endpoints. Only valid in HOST mode.

source

pub fn host_addr_endp13(&self) -> &HOST_ADDR_ENDP

0x34 - Interrupt endpoints. Only valid in HOST mode.

source

pub fn host_addr_endp14(&self) -> &HOST_ADDR_ENDP

0x38 - Interrupt endpoints. Only valid in HOST mode.

source

pub fn host_addr_endp15(&self) -> &HOST_ADDR_ENDP

0x3c - Interrupt endpoints. Only valid in HOST mode.

source

pub fn main_ctrl(&self) -> &MAIN_CTRL

0x40 - Main control register

source

pub fn sof_wr(&self) -> &SOF_WR

0x44 - 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 fn sof_rd(&self) -> &SOF_RD

0x48 - 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 fn sie_ctrl(&self) -> &SIE_CTRL

0x4c - SIE control register

source

pub fn sie_status(&self) -> &SIE_STATUS

0x50 - SIE status register

source

pub fn int_ep_ctrl(&self) -> &INT_EP_CTRL

0x54 - interrupt endpoint control register

source

pub fn buff_status(&self) -> &BUFF_STATUS

0x58 - 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 fn buff_cpu_should_handle(&self) -> &BUFF_CPU_SHOULD_HANDLE

0x5c - 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 fn ep_abort(&self) -> &EP_ABORT

0x60 - 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 fn ep_abort_done(&self) -> &EP_ABORT_DONE

0x64 - 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 fn ep_stall_arm(&self) -> &EP_STALL_ARM

0x68 - 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 fn nak_poll(&self) -> &NAK_POLL

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

source

pub fn ep_status_stall_nak(&self) -> &EP_STATUS_STALL_NAK

0x70 - 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 fn usb_muxing(&self) -> &USB_MUXING

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

source

pub fn usb_pwr(&self) -> &USB_PWR

0x78 - 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 fn usbphy_direct(&self) -> &USBPHY_DIRECT

0x7c - 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 fn usbphy_direct_override(&self) -> &USBPHY_DIRECT_OVERRIDE

0x80 - Override enable for each control in usbphy_direct

source

pub fn usbphy_trim(&self) -> &USBPHY_TRIM

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

source

pub fn intr(&self) -> &INTR

0x8c - Raw Interrupts

source

pub fn inte(&self) -> &INTE

0x90 - Interrupt Enable

source

pub fn intf(&self) -> &INTF

0x94 - Interrupt Force

source

pub fn ints(&self) -> &INTS

0x98 - Interrupt status after masking & forcing

Trait Implementations§

source§

impl Debug for USBCTRL_REGS

source§

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

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

impl Deref for USBCTRL_REGS

§

type Target = RegisterBlock

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl Send for USBCTRL_REGS

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>,

§

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>,

§

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.