Mistake on this page?
Report an issue in GitHub or email us
Public Member Functions
USBPhy Class Referenceabstract

Abstract interface to physical USB hardware. More...

#include <USBPhy.h>

Inheritance diagram for USBPhy:
USBPhyHw

Public Member Functions

virtual void init (USBPhyEvents *events)=0
 Initialize this USBPhy instance. More...
 
virtual void deinit ()=0
 Power down this USBPhy instance. More...
 
virtual bool powered ()=0
 Check if USB power is present. More...
 
virtual void connect ()=0
 Make the USB phy visible to the USB host. More...
 
virtual void disconnect ()=0
 Detach the USB phy. More...
 
virtual void configure ()=0
 Set this device to the configured state. More...
 
virtual void unconfigure ()=0
 Leave the configured state. More...
 
virtual void sof_enable ()=0
 Enable the start of frame interrupt. More...
 
virtual void sof_disable ()=0
 Disable the start of frame interrupt. More...
 
virtual void set_address (uint8_t address)=0
 Set the USBPhy's address. More...
 
virtual void remote_wakeup ()=0
 Wake upstream devices. More...
 
virtual const usb_ep_table_tendpoint_table ()=0
 Get the endpoint table. More...
 
virtual uint32_t ep0_set_max_packet (uint32_t max_packet)=0
 Set wMaxPacketSize of endpoint 0. More...
 
virtual void ep0_setup_read_result (uint8_t *buffer, uint32_t size)=0
 Read the contents of the SETUP packet. More...
 
virtual void ep0_read (uint8_t *data, uint32_t size)=0
 Start receiving a packet of up to wMaxPacketSize on endpoint 0. More...
 
virtual uint32_t ep0_read_result ()=0
 Read the contents of a received packet. More...
 
virtual void ep0_write (uint8_t *buffer, uint32_t size)=0
 Write a packet on endpoint 0. More...
 
virtual void ep0_stall ()=0
 Protocol stall on endpoint 0. More...
 
virtual bool endpoint_add (usb_ep_t endpoint, uint32_t max_packet, usb_ep_type_t type)=0
 Configure and enable an endpoint. More...
 
virtual void endpoint_remove (usb_ep_t endpoint)=0
 Disable an endpoint. More...
 
virtual void endpoint_stall (usb_ep_t endpoint)=0
 Perform a functional stall on the given endpoint. More...
 
virtual void endpoint_unstall (usb_ep_t endpoint)=0
 Un-stall the endpoint. More...
 
virtual bool endpoint_read (usb_ep_t endpoint, uint8_t *data, uint32_t size)=0
 Start a read on the given endpoint. More...
 
virtual uint32_t endpoint_read_result (usb_ep_t endpoint)=0
 Finish a read on the given endpoint. More...
 
virtual bool endpoint_write (usb_ep_t endpoint, uint8_t *data, uint32_t size)=0
 Start a write on the given endpoint. More...
 
virtual void endpoint_abort (usb_ep_t endpoint)=0
 Abort the current transfer if it has not yet been sent. More...
 
virtual void process ()=0
 Callback used for performing USB processing. More...
 

Detailed Description

Abstract interface to physical USB hardware.

Defined behavior

Undefined behavior

Notes

Definition at line 82 of file USBPhy.h.

Member Function Documentation

virtual void configure ( )
pure virtual

Set this device to the configured state.

Enable added endpoints if they are not enabled already.

Implemented in USBPhyHw.

virtual void connect ( )
pure virtual

Make the USB phy visible to the USB host.

Enable either the D+ or D- pullup so the host can detect the presence of this device.

Implemented in USBPhyHw.

virtual void deinit ( )
pure virtual

Power down this USBPhy instance.

Disable interrupts and stop sending events.

Implemented in USBPhyHw.

virtual void disconnect ( )
pure virtual

Detach the USB phy.

Disable the D+ and D- pullup and stop responding to USB traffic.

Implemented in USBPhyHw.

virtual void endpoint_abort ( usb_ep_t  endpoint)
pure virtual

Abort the current transfer if it has not yet been sent.

Parameters
endpointEndpoint to abort the transfer on. It is implementation defined if this function has an effect on receive endpoints.

Implemented in USBPhyHw.

virtual bool endpoint_add ( usb_ep_t  endpoint,
uint32_t  max_packet,
usb_ep_type_t  type 
)
pure virtual

Configure and enable an endpoint.

Parameters
endpointEndpoint to configure and enable
max_packetThe maximum packet size that can be sent or received
typeThe type of endpoint this should be configured as - USB_EP_TYPE_BULK, USB_EP_TYPE_INT or USB_EP_TYPE_ISO
Note
This function cannot be used to configure endpoint 0. That must be done with ep0_set_max_packet

Implemented in USBPhyHw.

virtual bool endpoint_read ( usb_ep_t  endpoint,
uint8_t *  data,
uint32_t  size 
)
pure virtual

Start a read on the given endpoint.

Parameters
endpointEndpoint to start the read on
dataBuffer to fill with data
sizeSize of the read buffer. This must be at least the max packet size for this endpoint.
Returns
true if the read was successfully started, false otherwise

Implemented in USBPhyHw.

virtual uint32_t endpoint_read_result ( usb_ep_t  endpoint)
pure virtual

Finish a read on the given endpoint.

Parameters
endpointEndpoint to check
Returns
The number of bytes received

Implemented in USBPhyHw.

virtual void endpoint_remove ( usb_ep_t  endpoint)
pure virtual

Disable an endpoint.

Parameters
endpointEndpoint to disable

Implemented in USBPhyHw.

virtual void endpoint_stall ( usb_ep_t  endpoint)
pure virtual

Perform a functional stall on the given endpoint.

Set the HALT feature for this endpoint so that all further communication is aborted.

Parameters
endpointEndpoint to stall

Implemented in USBPhyHw.

virtual const usb_ep_table_t* endpoint_table ( )
pure virtual

Get the endpoint table.

This function returns a table which describes the endpoints can be used, the functionality of those endpoints and the resource cost.

Implemented in USBPhyHw.

virtual void endpoint_unstall ( usb_ep_t  endpoint)
pure virtual

Un-stall the endpoint.

Clear the HALT feature on this endpoint so communication can resume.

Parameters
endpointEndpoint to stall

Implemented in USBPhyHw.

virtual bool endpoint_write ( usb_ep_t  endpoint,
uint8_t *  data,
uint32_t  size 
)
pure virtual

Start a write on the given endpoint.

Parameters
endpointEndpoint to write to
dataBuffer to write
sizeSize of data to write
Returns
true if the data was prepared for transmit, false otherwise

Implemented in USBPhyHw.

virtual void ep0_read ( uint8_t *  data,
uint32_t  size 
)
pure virtual

Start receiving a packet of up to wMaxPacketSize on endpoint 0.

Parameters
dataBuffer to fill with the data read
sizeSize of buffer

Implemented in USBPhyHw.

virtual uint32_t ep0_read_result ( )
pure virtual

Read the contents of a received packet.

Returns
Size of data read

Implemented in USBPhyHw.

virtual uint32_t ep0_set_max_packet ( uint32_t  max_packet)
pure virtual

Set wMaxPacketSize of endpoint 0.

Parameters
max_packetThe wMaxPacketSize value for endpoint 0
Returns
The actual size of endpoint 0

Implemented in USBPhyHw.

virtual void ep0_setup_read_result ( uint8_t *  buffer,
uint32_t  size 
)
pure virtual

Read the contents of the SETUP packet.

Parameters
bufferBuffer to fill with data
sizeSize of buffer passed in

Implemented in USBPhyHw.

virtual void ep0_stall ( )
pure virtual

Protocol stall on endpoint 0.

Stall all IN and OUT packets on endpoint 0 until a setup packet is received.

Note
The stall is cleared automatically when a setup packet is received

Implemented in USBPhyHw.

virtual void ep0_write ( uint8_t *  buffer,
uint32_t  size 
)
pure virtual

Write a packet on endpoint 0.

Parameters
bufferBuffer fill with data to send
sizeSize of data to send

Implemented in USBPhyHw.

virtual void init ( USBPhyEvents events)
pure virtual

Initialize this USBPhy instance.

This function must be called before calling any other functions of this class, unless specifically noted.

Parameters
eventsCallback class to handle USB events

Implemented in USBPhyHw.

virtual bool powered ( )
pure virtual

Check if USB power is present.

Devices which don't support checking the USB power state must always return true.

Returns
true if USB power is present, false otherwise

Implemented in USBPhyHw.

virtual void process ( )
pure virtual

Callback used for performing USB processing.

USBPhy processing should be triggered by calling USBPhyEvents::start_process and done inside process. All USBPhyEvents callbacks aside from USBPhyEvents::start_process must be called in the context of process

Implemented in USBPhyHw.

virtual void remote_wakeup ( )
pure virtual

Wake upstream devices.

Implemented in USBPhyHw.

virtual void set_address ( uint8_t  address)
pure virtual

Set the USBPhy's address.

Parameters
addressThis device's USB address

Implemented in USBPhyHw.

virtual void sof_disable ( )
pure virtual

Disable the start of frame interrupt.

Stop calling USBPhyEvents::sof.

Implemented in USBPhyHw.

virtual void sof_enable ( )
pure virtual

Enable the start of frame interrupt.

Call USBPhyEvents::sof on every frame.

Implemented in USBPhyHw.

virtual void unconfigure ( )
pure virtual

Leave the configured state.

This is a notification to the USBPhy indicating that the device is leaving the configured state. The USBPhy can disable all endpoints other than endpoint 0.

Implemented in USBPhyHw.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.