AM261x MCU+ SDK  11.00.00

Introduction

These routines are only used for Control endpoint 0.

This module has APIs for USB Synopsis IP device driver.

Functions

void dwc_usb3_ep0_activate (volatile dwc_usb3_pcd_t *pcd, int restore)
 This routine configures EP0 OUT to receive SETUP packets and configures EP0 IN for transmitting packets. More...
 
void dwc_usb3_pcd_ep0_out_start (volatile dwc_usb3_pcd_t *pcd)
 This routine sets up a SETUP stage transfer for EP0 and starts the transfer. More...
 
void dwc_usb3_pcd_ep0_start_transfer (volatile dwc_usb3_pcd_t *pcd, volatile dwc_usb3_pcd_req_t *req)
 This routine sets up a data/status stage transfer for EP0 and starts the transfer. If pcd->ep0->dwc_ep.is_in is 0 it will be an OUT transfer, otherwise it will be an IN transfer. More...
 
void dwc_usb3_pcd_ep0_data_stage (volatile dwc_usb3_pcd_t *pcd, int length)
 This routine starts the data stage of a 3-stage control command. pcd->ep0state must be set to EP0_OUT_DATA_PHASE or EP0_IN_DATA_PHASE, and pcd->ep0->dwc_ep.is_in must be set to 0 or 1 before calling this routine. For IN, the data to be sent must be placed in pcd->ep0_status_buf before the call. More...
 
void dwc_usb3_handle_ep0_xfer (volatile dwc_usb3_pcd_t *pcd, u32 event)
 This routine handles EP0 transfers. More...
 
static void dwc_usb3_do_setup (volatile dwc_usb3_pcd_t *pcd)
 This routine processes SETUP commands. The USB Command processing is done in two places - the first being the PCD and the second being the Gadget driver (for example, the File-Backed Storage Gadget driver). More...
 
static void ep0_do_stall (volatile dwc_usb3_pcd_t *pcd, int err_val)
 This routine stalls EP0. More...
 
static void do_clear_halt (volatile dwc_usb3_pcd_t *pcd, volatile dwc_usb3_pcd_ep_t *ep)
 Clear the EP halt (STALL), and if there are pending requests start the transfer. More...
 
static void do_get_status (volatile dwc_usb3_pcd_t *pcd)
 This routine processes the GET_STATUS Setup Commands. More...
 
static void do_clear_feature (volatile dwc_usb3_pcd_t *pcd)
 This routine processes the CLEAR_FEATURE Setup Commands. More...
 
static void do_set_feature (volatile dwc_usb3_pcd_t *pcd)
 This routine processes the SET_FEATURE Setup Commands. More...
 
static void do_set_address (volatile dwc_usb3_pcd_t *pcd)
 This routine processes the SET_ADDRESS Setup Commands. More...
 
static void do_get_descriptor (volatile dwc_usb3_pcd_t *pcd)
 This routine handles the Get Descriptor request for the BOS descriptor and the OTG descriptor, and passes all other requests to the Gadget driver. More...
 
static void ep0_continue_transfer (volatile dwc_usb3_pcd_t *pcd, volatile dwc_usb3_pcd_req_t *req)
 This routine continues control IN transfers started by ep0_start_transfer, when the transfer does not fit in a single request. More...
 
static int ep0_complete_request (volatile dwc_usb3_pcd_t *pcd, volatile dwc_usb3_pcd_req_t *req, dwc_usb3_dma_desc_t *desc, int status)
 This routine completes the ep0 control transfer. More...
 
static void setup_in_status_phase (volatile dwc_usb3_pcd_t *pcd, void *buf, dwc_dma_t dma)
 This routine starts the Zero-Length Packet for the IN status phase of a control write transfer. More...
 
static void setup_out_status_phase (volatile dwc_usb3_pcd_t *pcd, void *buf, dwc_dma_t dma)
 This routine starts the Zero-Length Packet for the OUT status phase of a control read transfer. More...
 
static void dwc_usb3_handle_ep0 (volatile dwc_usb3_pcd_t *pcd, volatile dwc_usb3_pcd_req_t *req, u32 event)
 This routine handles EP0 Control transfers. More...
 

Function Documentation

◆ dwc_usb3_ep0_activate()

void dwc_usb3_ep0_activate ( volatile dwc_usb3_pcd_t pcd,
int  restore 
)

This routine configures EP0 OUT to receive SETUP packets and configures EP0 IN for transmitting packets.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
restoreTrue if restoring endpoint state after hibernation.

◆ dwc_usb3_pcd_ep0_out_start()

void dwc_usb3_pcd_ep0_out_start ( volatile dwc_usb3_pcd_t pcd)

This routine sets up a SETUP stage transfer for EP0 and starts the transfer.

Parameters
pcdProgramming view of the PCD.

◆ dwc_usb3_pcd_ep0_start_transfer()

void dwc_usb3_pcd_ep0_start_transfer ( volatile dwc_usb3_pcd_t pcd,
volatile dwc_usb3_pcd_req_t req 
)

This routine sets up a data/status stage transfer for EP0 and starts the transfer. If pcd->ep0->dwc_ep.is_in is 0 it will be an OUT transfer, otherwise it will be an IN transfer.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
reqThe request to start.

◆ dwc_usb3_pcd_ep0_data_stage()

void dwc_usb3_pcd_ep0_data_stage ( volatile dwc_usb3_pcd_t pcd,
int  length 
)

This routine starts the data stage of a 3-stage control command. pcd->ep0state must be set to EP0_OUT_DATA_PHASE or EP0_IN_DATA_PHASE, and pcd->ep0->dwc_ep.is_in must be set to 0 or 1 before calling this routine. For IN, the data to be sent must be placed in pcd->ep0_status_buf before the call.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
lengthLength of the data stage transfer.

◆ dwc_usb3_handle_ep0_xfer()

void dwc_usb3_handle_ep0_xfer ( volatile dwc_usb3_pcd_t pcd,
u32  event 
)

This routine handles EP0 transfers.

This routine gets the request corresponding to the current EP0 transfer. If EP0 is in IDLE state, it calls dwc_usb3_do_setup() to begin processing the next Setup request, otherwise it calls dwc_usb3_handle_ep0() to handle the next stage of the current transfer.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
eventThe event that triggered the transfer.

◆ dwc_usb3_do_setup()

static void dwc_usb3_do_setup ( volatile dwc_usb3_pcd_t pcd)
static

This routine processes SETUP commands. The USB Command processing is done in two places - the first being the PCD and the second being the Gadget driver (for example, the File-Backed Storage Gadget driver).

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
Command Driver

Description

GET_STATUS PCD

Command is processed as defined in chapter 9 of the USB 2.0 Specification.

SET_FEATURE PCD / Gadget driver

Device and Endpoint requests are processed by the PCD. Interface requests are passed to the Gadget driver.

CLEAR_FEATURE PCD

Device and Endpoint requests are processed by the PCD. Interface requests are ignored. The only Endpoint feature handled is ENDPOINT_HALT.

SET_ADDRESS PCD

Program the DCFG register with device address received.

GET_DESCRIPTOR Gadget driver

Return the requested descriptor.

SET_DESCRIPTOR Gadget driver

Optional - not implemented by any of the existing Gadget drivers.

GET_CONFIGURATION Gadget driver

Return the current configuration.

SET_CONFIGURATION Gadget driver

Disable all EPs and enable EPs for new configuration.

GET_INTERFACE Gadget driver

Return the current interface.

SET_INTERFACE Gadget driver Disable all EPs and enable EPs for new interface.

When the SETUP Phase Done interrupt occurs, the generic SETUP commands are processed by dwc_usb3_do_setup(). Calling the Gadget driver's dwc_usb3_gadget_setup() routine from dwc_usb3_do_setup() processes the gadget-specific SETUP commands.

◆ ep0_do_stall()

static void ep0_do_stall ( volatile dwc_usb3_pcd_t pcd,
int  err_val 
)
static

This routine stalls EP0.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
err_valError value that triggered the stall

◆ do_clear_halt()

static void do_clear_halt ( volatile dwc_usb3_pcd_t pcd,
volatile dwc_usb3_pcd_ep_t ep 
)
static

Clear the EP halt (STALL), and if there are pending requests start the transfer.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
epPointer to the endpoint that is being cleared.

◆ do_get_status()

static void do_get_status ( volatile dwc_usb3_pcd_t pcd)
static

This routine processes the GET_STATUS Setup Commands.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.

◆ do_clear_feature()

static void do_clear_feature ( volatile dwc_usb3_pcd_t pcd)
static

This routine processes the CLEAR_FEATURE Setup Commands.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.

◆ do_set_feature()

static void do_set_feature ( volatile dwc_usb3_pcd_t pcd)
static

This routine processes the SET_FEATURE Setup Commands.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.

◆ do_set_address()

static void do_set_address ( volatile dwc_usb3_pcd_t pcd)
static

This routine processes the SET_ADDRESS Setup Commands.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.

◆ do_get_descriptor()

static void do_get_descriptor ( volatile dwc_usb3_pcd_t pcd)
static

This routine handles the Get Descriptor request for the BOS descriptor and the OTG descriptor, and passes all other requests to the Gadget driver.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.

◆ ep0_continue_transfer()

static void ep0_continue_transfer ( volatile dwc_usb3_pcd_t pcd,
volatile dwc_usb3_pcd_req_t req 
)
static

This routine continues control IN transfers started by ep0_start_transfer, when the transfer does not fit in a single request.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
reqThe request to continue.

◆ ep0_complete_request()

static int ep0_complete_request ( volatile dwc_usb3_pcd_t pcd,
volatile dwc_usb3_pcd_req_t req,
dwc_usb3_dma_desc_t desc,
int  status 
)
static

This routine completes the ep0 control transfer.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
reqThe request to complete.
descThe DMA descriptor for the transfer.
statusThe status of the transfer.
Returns
1 if the request is completed, 0 otherwise.

◆ setup_in_status_phase()

static void setup_in_status_phase ( volatile dwc_usb3_pcd_t pcd,
void *  buf,
dwc_dma_t  dma 
)
static

This routine starts the Zero-Length Packet for the IN status phase of a control write transfer.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
bufPointer to the buffer to be used for the ZLP.
dmaDMA address of the buffer to be used for the ZLP.

◆ setup_out_status_phase()

static void setup_out_status_phase ( volatile dwc_usb3_pcd_t pcd,
void *  buf,
dwc_dma_t  dma 
)
static

This routine starts the Zero-Length Packet for the OUT status phase of a control read transfer.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
bufPointer to the buffer to be used for the ZLP.
dmaDMA address of the buffer to be used for the ZLP.

◆ dwc_usb3_handle_ep0()

static void dwc_usb3_handle_ep0 ( volatile dwc_usb3_pcd_t pcd,
volatile dwc_usb3_pcd_req_t req,
u32  event 
)
static

This routine handles EP0 Control transfers.

The state of the control tranfers are tracked in ep0state.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
reqThe request to handle.
eventThe event that triggered this handler.