#include "dwc_otg_hcd.h"
#include "dwc_otg_regs.h"
Go to the source code of this file.
Defines | |
#define | BitStuffTime(bytecount) ((8 * 7* bytecount) / 6) |
#define | HS_HOST_DELAY 5 |
#define | FS_LS_HOST_DELAY 1000 |
#define | HUB_LS_SETUP 333 |
#define | NS_TO_US(ns) ((ns + 500) / 1000) |
#define | SCHEDULE_SLOP 10 |
Initializes a QH structure. | |
Functions | |
void | dwc_otg_hcd_qh_free (dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) |
Free each QTD in the QH's QTD-list then free the QH. | |
static uint32_t | calc_bus_time (int speed, int is_in, int is_isoc, int bytecount) |
void | qh_init (dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh, dwc_otg_hcd_urb_t *urb) |
dwc_otg_qh_t * | dwc_otg_hcd_qh_create (dwc_otg_hcd_t *hcd, dwc_otg_hcd_urb_t *urb) |
This function allocates and initializes a QH. | |
static int | periodic_channel_available (dwc_otg_hcd_t *hcd) |
Checks that a channel is available for a periodic transfer. | |
static int | check_periodic_bandwidth (dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) |
Checks that there is sufficient bandwidth for the specified QH in the periodic schedule. | |
static int | check_max_xfer_size (dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) |
Checks that the max transfer size allowed in a host channel is large enough to handle the maximum data transfer in a single (micro)frame for a periodic transfer. | |
static int | schedule_periodic (dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) |
Schedules an interrupt or isochronous transfer in the periodic schedule. | |
int | dwc_otg_hcd_qh_add (dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) |
This function adds a QH to either the non periodic or periodic schedule if it is not already in the schedule. | |
static void | deschedule_periodic (dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) |
Removes an interrupt or isochronous transfer from the periodic schedule. | |
void | dwc_otg_hcd_qh_remove (dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) |
Removes a QH from either the non-periodic or periodic schedule. | |
void | dwc_otg_hcd_qh_deactivate (dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh, int sched_next_periodic_split) |
Deactivates a QH. | |
dwc_otg_qtd_t * | dwc_otg_hcd_qtd_create (dwc_otg_hcd_urb_t *urb) |
This function allocates and initializes a QTD. | |
void | dwc_otg_hcd_qtd_init (dwc_otg_qtd_t *qtd, dwc_otg_hcd_urb_t *urb) |
Initializes a QTD structure. | |
int | dwc_otg_hcd_qtd_add (dwc_otg_qtd_t *qtd, dwc_otg_hcd_t *hcd, dwc_otg_qh_t **qh) |
This function adds a QTD to the QTD-list of a QH. |
Definition in file dwc_otg_hcd_queue.c.
#define SCHEDULE_SLOP 10 |
Initializes a QH structure.
hcd | The HCD state structure for the DWC OTG controller. | |
qh | The QH to init. | |
urb | Holds the information about the device/endpoint that we need to initialize the QH. |
Definition at line 159 of file dwc_otg_hcd_queue.c.
void dwc_otg_hcd_qh_free | ( | dwc_otg_hcd_t * | hcd, | |
dwc_otg_qh_t * | qh | |||
) |
Free each QTD in the QH's QTD-list then free the QH.
QH should already be removed from a list. QTD list should already be empty if called from URB Dequeue.
hcd | HCD instance. | |
qh | The QH to free. |
Definition at line 53 of file dwc_otg_hcd_queue.c.
void qh_init | ( | dwc_otg_hcd_t * | hcd, | |
dwc_otg_qh_t * | qh, | |||
dwc_otg_hcd_urb_t * | urb | |||
) |
Definition at line 160 of file dwc_otg_hcd_queue.c.
dwc_otg_qh_t* dwc_otg_hcd_qh_create | ( | dwc_otg_hcd_t * | hcd, | |
dwc_otg_hcd_urb_t * | urb | |||
) |
This function allocates and initializes a QH.
hcd | The HCD state structure for the DWC OTG controller. | |
urb | Holds the information about the device/endpoint that we need to initialize the QH. |
Definition at line 296 of file dwc_otg_hcd_queue.c.
static int periodic_channel_available | ( | dwc_otg_hcd_t * | hcd | ) | [static] |
Checks that a channel is available for a periodic transfer.
Definition at line 323 of file dwc_otg_hcd_queue.c.
static int check_periodic_bandwidth | ( | dwc_otg_hcd_t * | hcd, | |
dwc_otg_qh_t * | qh | |||
) | [static] |
Checks that there is sufficient bandwidth for the specified QH in the periodic schedule.
For simplicity, this calculation assumes that all the transfers in the periodic schedule may occur in the same (micro)frame.
hcd | The HCD state structure for the DWC OTG controller. | |
qh | QH containing periodic bandwidth required. |
Definition at line 356 of file dwc_otg_hcd_queue.c.
static int check_max_xfer_size | ( | dwc_otg_hcd_t * | hcd, | |
dwc_otg_qh_t * | qh | |||
) | [static] |
Checks that the max transfer size allowed in a host channel is large enough to handle the maximum data transfer in a single (micro)frame for a periodic transfer.
hcd | The HCD state structure for the DWC OTG controller. | |
qh | QH for a periodic endpoint. |
Definition at line 396 of file dwc_otg_hcd_queue.c.
static int schedule_periodic | ( | dwc_otg_hcd_t * | hcd, | |
dwc_otg_qh_t * | qh | |||
) | [static] |
Schedules an interrupt or isochronous transfer in the periodic schedule.
hcd | The HCD state structure for the DWC OTG controller. | |
qh | QH for the periodic transfer. The QH should already contain the scheduling information. |
Definition at line 425 of file dwc_otg_hcd_queue.c.
int dwc_otg_hcd_qh_add | ( | dwc_otg_hcd_t * | hcd, | |
dwc_otg_qh_t * | qh | |||
) |
This function adds a QH to either the non periodic or periodic schedule if it is not already in the schedule.
If the QH is already in the schedule, no action is taken.
Definition at line 472 of file dwc_otg_hcd_queue.c.
static void deschedule_periodic | ( | dwc_otg_hcd_t * | hcd, | |
dwc_otg_qh_t * | qh | |||
) | [static] |
Removes an interrupt or isochronous transfer from the periodic schedule.
hcd | The HCD state structure for the DWC OTG controller. | |
qh | QH for the periodic transfer. |
Definition at line 505 of file dwc_otg_hcd_queue.c.
void dwc_otg_hcd_qh_remove | ( | dwc_otg_hcd_t * | hcd, | |
dwc_otg_qh_t * | qh | |||
) |
Removes a QH from either the non-periodic or periodic schedule.
Memory is not freed.
hcd | The HCD state structure. | |
qh | QH to remove from schedule. |
Definition at line 522 of file dwc_otg_hcd_queue.c.
void dwc_otg_hcd_qh_deactivate | ( | dwc_otg_hcd_t * | hcd, | |
dwc_otg_qh_t * | qh, | |||
int | sched_next_periodic_split | |||
) |
Deactivates a QH.
For non-periodic QHs, removes the QH from the active non-periodic schedule. The QH is added to the inactive non-periodic schedule if any QTDs are still attached to the QH.
For periodic QHs, the QH is removed from the periodic queued schedule. If there are any QTDs still attached to the QH, the QH is added to either the periodic inactive schedule or the periodic ready schedule and its next scheduled frame is calculated. The QH is placed in the ready schedule if the scheduled frame has been reached already. Otherwise it's placed in the inactive schedule. If there are no QTDs attached to the QH, the QH is completely removed from the periodic schedule.
Definition at line 559 of file dwc_otg_hcd_queue.c.
dwc_otg_qtd_t* dwc_otg_hcd_qtd_create | ( | dwc_otg_hcd_urb_t * | urb | ) |
This function allocates and initializes a QTD.
urb | The URB to create a QTD from. Each URB-QTD pair will end up pointing to each other so each pair should have a unique correlation. |
Definition at line 643 of file dwc_otg_hcd_queue.c.
void dwc_otg_hcd_qtd_init | ( | dwc_otg_qtd_t * | qtd, | |
dwc_otg_hcd_urb_t * | urb | |||
) |
Initializes a QTD structure.
qtd | The QTD to initialize. | |
urb | The URB to use for initialization. |
Definition at line 661 of file dwc_otg_hcd_queue.c.
int dwc_otg_hcd_qtd_add | ( | dwc_otg_qtd_t * | qtd, | |
dwc_otg_hcd_t * | hcd, | |||
dwc_otg_qh_t ** | qh | |||
) |
This function adds a QTD to the QTD-list of a QH.
It will find the correct QH to place the QTD into. If it does not find a QH, then it will create a new QH. If the QH to which the QTD is added is not currently scheduled, it is placed into the proper schedule based on its EP type.
[in] | qtd | The QTD to add |
[in] | hcd | The DWC HCD structure |
[out] | qh | out parameter to return queue head |
Definition at line 698 of file dwc_otg_hcd_queue.c.