AM261x MCU+ SDK  11.00.00

Introduction

These routines handle all the functionality required for configuring, enabling, controlling, and submitting transfers to an endpoint

Note: For Control endpoint 0, only the submit_req, cancel_req, request_done, and set_halt routines are used; the remaining functionality is handled either by the Control Endpoint 0 API Routines below or internally by the PCD.

Functions

void dwc_usb3_ep_activate (volatile dwc_usb3_pcd_t *pcd, volatile dwc_usb3_pcd_ep_t *ep, int restore)
 This routine activates an EP. The Device EP control registers for the EP are configured as defined in the EP structure. More...
 
int dwc_usb3_pcd_ep_enable (volatile dwc_usb3_pcd_t *pcd, volatile dwc_usb3_pcd_ep_t *ep, const usb_endpoint_descriptor_t *ep_desc, const ss_endpoint_companion_descriptor_t *ep_comp)
 This routine is called by the Function Driver for each EP (except EP0) to be configured for the current configuration (SET_CONFIGURATION). More...
 
int dwc_usb3_pcd_ep_disable (volatile dwc_usb3_pcd_t *pcd, volatile dwc_usb3_pcd_ep_t *ep)
 This routine is called when an EP (except EP0) is disabled due to disconnect or change in configuration. Any pending requests will terminate with a status of -ESHUTDOWN. More...
 
int dwc_usb3_pcd_ep_submit_req (volatile dwc_usb3_pcd_t *pcd, dwc_usb3_pcd_ep_t *ep, dwc_usb3_pcd_req_t *req, u32 req_flags)
 This routine submits an I/O Request to an EP. More...
 
void dwc_usb3_pcd_ep_cancel_req (volatile dwc_usb3_pcd_t *pcd, dwc_usb3_pcd_ep_t *ep, dwc_usb3_pcd_req_t *req, u32 stream)
 This routine cancels an I/O request from an EP. More...
 
void dwc_usb3_pcd_request_done (volatile dwc_usb3_pcd_t *pcd, volatile dwc_usb3_pcd_ep_t *ep, volatile dwc_usb3_pcd_req_t *req, int status)
 This routine completes a request. It calls the request callback. More...
 
void dwc_usb3_pcd_ep_start_transfer (volatile dwc_usb3_pcd_t *pcd, volatile dwc_usb3_pcd_ep_t *ep, volatile dwc_usb3_pcd_req_t *req, u32 event)
 This routine does the setup for a data transfer for an EP and starts the transfer. More...
 
void dwc_usb3_pcd_ep_set_stall (volatile dwc_usb3_pcd_t *pcd, volatile dwc_usb3_pcd_ep_t *ep)
 Set the EP to STALL. More...
 
void dwc_usb3_pcd_ep_clear_stall (volatile dwc_usb3_pcd_t *pcd, volatile dwc_usb3_pcd_ep_t *ep)
 Clear the EP STALL. More...
 
void dwc_usb3_pcd_ep_set_halt (volatile dwc_usb3_pcd_t *pcd, volatile dwc_usb3_pcd_ep_t *ep, int value)
 This function sets or clears a stall condition on an endpoint. More...
 

Function Documentation

◆ dwc_usb3_ep_activate()

void dwc_usb3_ep_activate ( volatile dwc_usb3_pcd_t pcd,
volatile dwc_usb3_pcd_ep_t ep,
int  restore 
)

This routine activates an EP. The Device EP control registers for the EP are configured as defined in the EP structure.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
epThe EP to activate.
restoreTrue if restoring endpoint state after hibernation.

◆ dwc_usb3_pcd_ep_enable()

int dwc_usb3_pcd_ep_enable ( volatile dwc_usb3_pcd_t pcd,
volatile dwc_usb3_pcd_ep_t ep,
const usb_endpoint_descriptor_t ep_desc,
const ss_endpoint_companion_descriptor_t ep_comp 
)

This routine is called by the Function Driver for each EP (except EP0) to be configured for the current configuration (SET_CONFIGURATION).

This routine initializes the dwc_usb3_ep_t data structure, and then calls dwc_usb3_ep_activate.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
epThe EP to enable.
ep_descPointer to the USB endpoint descriptor.
ep_compPointer to the USB SuperSpeed endpoint companion descriptor.
Returns
0 on success, negative error code on failure.

◆ dwc_usb3_pcd_ep_disable()

int dwc_usb3_pcd_ep_disable ( volatile dwc_usb3_pcd_t pcd,
volatile dwc_usb3_pcd_ep_t ep 
)

This routine is called when an EP (except EP0) is disabled due to disconnect or change in configuration. Any pending requests will terminate with a status of -ESHUTDOWN.

This routine modifies the dwc_usb3_ep_t data structure for this EP, and then calls ep_deactivate.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
epThe EP to disable.
Returns
0 on success, negative error code on failure.

◆ dwc_usb3_pcd_ep_submit_req()

int dwc_usb3_pcd_ep_submit_req ( volatile dwc_usb3_pcd_t pcd,
dwc_usb3_pcd_ep_t ep,
dwc_usb3_pcd_req_t req,
u32  req_flags 
)

This routine submits an I/O Request to an EP.

  • When the request completes the request's completion callback is called to return the request to the driver.
  • An EP, except control EPs, may have multiple requests pending.
  • Once submitted the request cannot be examined or modified.
  • Each request is turned into one or more packets.
  • A BULK EP can queue any amount of data; the transfer is packetized.
  • Zero-length packets are specified with the request 'zero' flag.
Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
epThe EP to submit the request to.
reqThe request to submit.
req_flagsFlags for the request.
Returns
0 on success, negative error code on failure.

◆ dwc_usb3_pcd_ep_cancel_req()

void dwc_usb3_pcd_ep_cancel_req ( volatile dwc_usb3_pcd_t pcd,
dwc_usb3_pcd_ep_t ep,
dwc_usb3_pcd_req_t req,
u32  stream 
)

This routine cancels an I/O request from an EP.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
epThe EP to cancel the request on.
reqThe request to cancel.
streamThe stream number for the request.

◆ dwc_usb3_pcd_request_done()

void dwc_usb3_pcd_request_done ( volatile dwc_usb3_pcd_t pcd,
volatile dwc_usb3_pcd_ep_t ep,
volatile dwc_usb3_pcd_req_t req,
int  status 
)

This routine completes a request. It calls the request callback.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
epThe EP to complete the request on.
reqThe request to complete.
statusThe status of the request completion.

◆ dwc_usb3_pcd_ep_start_transfer()

void dwc_usb3_pcd_ep_start_transfer ( volatile dwc_usb3_pcd_t pcd,
volatile dwc_usb3_pcd_ep_t ep,
volatile dwc_usb3_pcd_req_t req,
u32  event 
)

This routine does the setup for a data transfer for an EP and starts the transfer.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
epThe EP to start the transfer on.
reqThe request to start.
eventIf non-zero, this is the first transfer for an Isoc EP, so we must calculate the starting uFrame and do a startxfer instead of an updatexfer.

◆ dwc_usb3_pcd_ep_set_stall()

void dwc_usb3_pcd_ep_set_stall ( volatile dwc_usb3_pcd_t pcd,
volatile dwc_usb3_pcd_ep_t ep 
)

Set the EP to STALL.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
epThe EP to set the stall on.

◆ dwc_usb3_pcd_ep_clear_stall()

void dwc_usb3_pcd_ep_clear_stall ( volatile dwc_usb3_pcd_t pcd,
volatile dwc_usb3_pcd_ep_t ep 
)

Clear the EP STALL.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
epThe EP to clear the stall on.

◆ dwc_usb3_pcd_ep_set_halt()

void dwc_usb3_pcd_ep_set_halt ( volatile dwc_usb3_pcd_t pcd,
volatile dwc_usb3_pcd_ep_t ep,
int  value 
)

This function sets or clears a stall condition on an endpoint.

This function can be used to stall an endpoint, clear a stall condition, or manage the stall lock flag for the endpoint. The behavior depends on the value argument provided:

Parameters
pcdThe PCD structure representing the USB peripheral controller.
epThe endpoint to set or clear the stall condition.
value- 0: Clears the stall condition and resets the data toggle.
  • 1: Sets the stall condition on the endpoint.
  • 2: Clears the stall lock flag.
  • 3: Sets the stall lock flag and stalls the endpoint.