AM261x MCU+ SDK: Function Driver callback routines

| AM261x MCU+ SDK 26.00.00 |

Functions
Function Driver callback routines
APIs for SOC Specific Device Drivers » APIs for USB » APIs for Synopsys driver

## Introduction

The PCD calls these routines when it needs something from the Function Driver.

## Functions
void * | dwc_usb3_gadget_alloc_dma (dwc_usb3_pcd_ep_t *ep, int size, dwc_dma_t *mem_dma_ret)
| This routine allocates coherent DMA memory. It is used by the PCD to allocate memory for TRBs. The block of memory returned must have a start address aligned to a 16-byte boundary. More...
void | dwc_usb3_gadget_free_dma (dwc_usb3_pcd_ep_t *ep, int size, void *mem, dwc_dma_t mem_dma)
| This routine frees DMA memory allocated by dwc_usb3_gadget_alloc_dma(). More...
dwc_usb3_pcd_req_t * | dwc_usb3_gadget_get_request (dwc_usb3_pcd_t *pcd, dwc_usb3_pcd_ep_t *ep)
| This routine returns the PCD request corresponding to the current transfer request for an endpoint. The current transfer request is the first request submitted that has not been completed yet. More...
void | dwc_usb3_gadget_start_next_request (dwc_usb3_pcd_t *pcd, dwc_usb3_pcd_ep_t *ep)
| This routine checks to see if there is another transfer request waiting on an endpoint that has not been started yet. If so then that transfer is started. More...
void | dwc_usb3_gadget_isoc_ep_start (dwc_usb3_pcd_t *pcd, dwc_usb3_pcd_ep_t *ep, u32 event)
| This routine starts an Isoc EP running at the proper interval, after receiving the initial XferNrdy event. More...
void | dwc_usb3_gadget_request_nuke (dwc_usb3_pcd_t *pcd, dwc_usb3_pcd_ep_t *ep)
| This routine terminates all requests which are pending on an endpoint. More...
void | dwc_usb3_gadget_set_ep_not_started (dwc_usb3_pcd_t *pcd, dwc_usb3_pcd_ep_t *ep)
| This routine marks all pending requests for an EP as not started. More...

## Function Documentation

## ◆ dwc_usb3_gadget_alloc_dma()

void* dwc_usb3_gadget_alloc_dma | ( | dwc_usb3_pcd_ep_t * | pcd_ep,
|  | int | size,
|  | dwc_dma_t * | mem_dma_ret
| ) |  |

This routine allocates coherent DMA memory. It is used by the PCD to allocate memory for TRBs. The block of memory returned must have a start address aligned to a 16-byte boundary.

This routine may be called from interrupt context, so it must be able to allocate coherent DMA memory in that context. One strategy would be to preallocate a block of memory at initialization time, and hand out chunks from that block in this routine.

Parameters

  pcd_ep | PCD EP that memory block will be associated with.
  size | Size of memory block to allocate, in bytes.
  mem_dma_ret | Physical address of allocated memory block is returned through this pointer.

Returns
  Address of allocated memory block, or NULL if allocation fails.

## ◆ dwc_usb3_gadget_free_dma()

void dwc_usb3_gadget_free_dma | ( | dwc_usb3_pcd_ep_t * | pcd_ep,
|  | int | size,
|  | void * | mem,
|  | dwc_dma_t | mem_dma
| ) |  |

This routine frees DMA memory allocated by dwc_usb3_gadget_alloc_dma().

Parameters

  pcd_ep | PCD EP that memory block is associated with.
  size | Size of memory block to free, in bytes.
  mem | Address of memory block.
  mem_dma | Physical address of memory block.

## ◆ dwc_usb3_gadget_get_request()

dwc_usb3_pcd_req_t* dwc_usb3_gadget_get_request | ( | dwc_usb3_pcd_t * | pcd,
|  | dwc_usb3_pcd_ep_t * | pcd_ep
| ) |  |

This routine returns the PCD request corresponding to the current transfer request for an endpoint. The current transfer request is the first request submitted that has not been completed yet.

Parameters

  pcd | Programming view of DWC_usb3 peripheral controller.
  pcd_ep | PCD EP to operate on.

Returns
  Pointer to PCD request, or NULL if no request available.

## ◆ dwc_usb3_gadget_start_next_request()

void dwc_usb3_gadget_start_next_request | ( | dwc_usb3_pcd_t * | pcd,
|  | dwc_usb3_pcd_ep_t * | pcd_ep
| ) |  |

This routine checks to see if there is another transfer request waiting on an endpoint that has not been started yet. If so then that transfer is started.

Parameters

  pcd | Programming view of DWC_usb3 peripheral controller.
  pcd_ep | PCD EP to operate on.

## ◆ dwc_usb3_gadget_isoc_ep_start()

void dwc_usb3_gadget_isoc_ep_start | ( | dwc_usb3_pcd_t * | pcd,
|  | dwc_usb3_pcd_ep_t * | pcd_ep,
|  | u32 | event
| ) |  |

This routine starts an Isoc EP running at the proper interval, after receiving the initial XferNrdy event.

Parameters

  pcd | Programming view of DWC_usb3 peripheral controller.
  pcd_ep | EP to operate on.
  event | Event data containing the XferNrdy microframe.

## ◆ dwc_usb3_gadget_request_nuke()

void dwc_usb3_gadget_request_nuke | ( | dwc_usb3_pcd_t * | pcd,
|  | dwc_usb3_pcd_ep_t * | pcd_ep
| ) |  |

This routine terminates all requests which are pending on an endpoint.

Parameters

  pcd | Programming view of DWC_usb3 peripheral controller.
  pcd_ep | EP to operate on.

## ◆ dwc_usb3_gadget_set_ep_not_started()

void dwc_usb3_gadget_set_ep_not_started | ( | dwc_usb3_pcd_t * | pcd,
|  | dwc_usb3_pcd_ep_t * | pcd_ep
| ) |  |

This routine marks all pending requests for an EP as not started.

Parameters

  pcd | Programming view of DWC_usb3 peripheral controller.
  pcd_ep | EP to operate on.