TianoCore EDK2 master
Loading...
Searching...
No Matches
EhciUrb.h File Reference

Go to the source code of this file.

Data Structures

struct  QTD_HW
 
struct  QH_HW
 
struct  _USB_ENDPOINT
 
struct  _PEI_EHC_QTD
 
struct  _PEI_EHC_QH
 
struct  _PEI_URB
 

Macros

#define EHC_CTRL_TRANSFER   0x01
 
#define EHC_BULK_TRANSFER   0x02
 
#define EHC_INT_TRANSFER_SYNC   0x04
 
#define EHC_INT_TRANSFER_ASYNC   0x08
 
#define EHC_QTD_SIG   SIGNATURE_32 ('U', 'S', 'B', 'T')
 
#define EHC_QH_SIG   SIGNATURE_32 ('U', 'S', 'B', 'H')
 
#define EHC_URB_SIG   SIGNATURE_32 ('U', 'S', 'B', 'R')
 
#define EHC_TYPE_ITD   0x00
 
#define EHC_TYPE_QH   0x02
 
#define EHC_TYPE_SITD   0x04
 
#define EHC_TYPE_FSTN   0x06
 
#define QH_NAK_RELOAD   3
 
#define QH_HSHBW_MULTI   1
 
#define QTD_MAX_ERR   3
 
#define QTD_PID_OUTPUT   0x00
 
#define QTD_PID_INPUT   0x01
 
#define QTD_PID_SETUP   0x02
 
#define QTD_STAT_DO_OUT   0
 
#define QTD_STAT_DO_SS   0
 
#define QTD_STAT_DO_PING   0x01
 
#define QTD_STAT_DO_CS   0x02
 
#define QTD_STAT_TRANS_ERR   0x08
 
#define QTD_STAT_BABBLE_ERR   0x10
 
#define QTD_STAT_BUFF_ERR   0x20
 
#define QTD_STAT_HALTED   0x40
 
#define QTD_STAT_ACTIVE   0x80
 
#define QTD_STAT_ERR_MASK   (QTD_STAT_TRANS_ERR | QTD_STAT_BABBLE_ERR | QTD_STAT_BUFF_ERR)
 
#define QTD_MAX_BUFFER   4
 
#define QTD_BUF_LEN   4096
 
#define QTD_BUF_MASK   0x0FFF
 
#define QH_MICROFRAME_0   0x01
 
#define QH_MICROFRAME_1   0x02
 
#define QH_MICROFRAME_2   0x04
 
#define QH_MICROFRAME_3   0x08
 
#define QH_MICROFRAME_4   0x10
 
#define QH_MICROFRAME_5   0x20
 
#define QH_MICROFRAME_6   0x40
 
#define QH_MICROFRAME_7   0x80
 
#define USB_ERR_SHORT_PACKET   0x200
 
#define QH_LINK(Addr, Type, Term)    ((UINT32) ((EHC_LOW_32BIT (Addr) & 0xFFFFFFE0) | (Type) | ((Term) ? 1 : 0)))
 
#define QTD_LINK(Addr, Term)   QH_LINK((Addr), 0, (Term))
 

Typedefs

typedef struct _PEI_EHC_QTD PEI_EHC_QTD
 
typedef struct _PEI_EHC_QH PEI_EHC_QH
 
typedef struct _PEI_URB PEI_URB
 
typedef struct _USB_ENDPOINT USB_ENDPOINT
 

Functions

PEI_EHC_QTDEhcCreateQtd (IN PEI_USB2_HC_DEV *Ehc, IN UINT8 *Data, IN UINTN DataLen, IN UINT8 PktId, IN UINT8 Toggle, IN UINTN MaxPacket)
 
PEI_EHC_QHEhcCreateQh (IN PEI_USB2_HC_DEV *Ehci, IN USB_ENDPOINT *Ep)
 
VOID EhcFreeUrb (IN PEI_USB2_HC_DEV *Ehc, IN PEI_URB *Urb)
 
PEI_URBEhcCreateUrb (IN PEI_USB2_HC_DEV *Ehc, IN UINT8 DevAddr, IN UINT8 EpAddr, IN UINT8 DevSpeed, IN UINT8 Toggle, IN UINTN MaxPacket, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Hub, IN UINTN Type, IN EFI_USB_DEVICE_REQUEST *Request, IN VOID *Data, IN UINTN DataLen, IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback, IN VOID *Context, IN UINTN Interval)
 

Detailed Description

Private Header file for Usb Host Controller PEIM

Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file EhciUrb.h.

Macro Definition Documentation

◆ EHC_BULK_TRANSFER

#define EHC_BULK_TRANSFER   0x02

Definition at line 18 of file EhciUrb.h.

◆ EHC_CTRL_TRANSFER

#define EHC_CTRL_TRANSFER   0x01

Definition at line 17 of file EhciUrb.h.

◆ EHC_INT_TRANSFER_ASYNC

#define EHC_INT_TRANSFER_ASYNC   0x08

Definition at line 20 of file EhciUrb.h.

◆ EHC_INT_TRANSFER_SYNC

#define EHC_INT_TRANSFER_SYNC   0x04

Definition at line 19 of file EhciUrb.h.

◆ EHC_QH_SIG

#define EHC_QH_SIG   SIGNATURE_32 ('U', 'S', 'B', 'H')

Definition at line 23 of file EhciUrb.h.

◆ EHC_QTD_SIG

#define EHC_QTD_SIG   SIGNATURE_32 ('U', 'S', 'B', 'T')

Definition at line 22 of file EhciUrb.h.

◆ EHC_TYPE_FSTN

#define EHC_TYPE_FSTN   0x06

Definition at line 32 of file EhciUrb.h.

◆ EHC_TYPE_ITD

#define EHC_TYPE_ITD   0x00

Definition at line 29 of file EhciUrb.h.

◆ EHC_TYPE_QH

#define EHC_TYPE_QH   0x02

Definition at line 30 of file EhciUrb.h.

◆ EHC_TYPE_SITD

#define EHC_TYPE_SITD   0x04

Definition at line 31 of file EhciUrb.h.

◆ EHC_URB_SIG

#define EHC_URB_SIG   SIGNATURE_32 ('U', 'S', 'B', 'R')

Definition at line 24 of file EhciUrb.h.

◆ QH_HSHBW_MULTI

#define QH_HSHBW_MULTI   1

Definition at line 35 of file EhciUrb.h.

◆ QH_LINK

#define QH_LINK (   Addr,
  Type,
  Term 
)     ((UINT32) ((EHC_LOW_32BIT (Addr) & 0xFFFFFFE0) | (Type) | ((Term) ? 1 : 0)))

Definition at line 72 of file EhciUrb.h.

◆ QH_MICROFRAME_0

#define QH_MICROFRAME_0   0x01

Definition at line 57 of file EhciUrb.h.

◆ QH_MICROFRAME_1

#define QH_MICROFRAME_1   0x02

Definition at line 58 of file EhciUrb.h.

◆ QH_MICROFRAME_2

#define QH_MICROFRAME_2   0x04

Definition at line 59 of file EhciUrb.h.

◆ QH_MICROFRAME_3

#define QH_MICROFRAME_3   0x08

Definition at line 60 of file EhciUrb.h.

◆ QH_MICROFRAME_4

#define QH_MICROFRAME_4   0x10

Definition at line 61 of file EhciUrb.h.

◆ QH_MICROFRAME_5

#define QH_MICROFRAME_5   0x20

Definition at line 62 of file EhciUrb.h.

◆ QH_MICROFRAME_6

#define QH_MICROFRAME_6   0x40

Definition at line 63 of file EhciUrb.h.

◆ QH_MICROFRAME_7

#define QH_MICROFRAME_7   0x80

Definition at line 64 of file EhciUrb.h.

◆ QH_NAK_RELOAD

#define QH_NAK_RELOAD   3

Definition at line 34 of file EhciUrb.h.

◆ QTD_BUF_LEN

#define QTD_BUF_LEN   4096

Definition at line 54 of file EhciUrb.h.

◆ QTD_BUF_MASK

#define QTD_BUF_MASK   0x0FFF

Definition at line 55 of file EhciUrb.h.

◆ QTD_LINK

#define QTD_LINK (   Addr,
  Term 
)    QH_LINK((Addr), 0, (Term))

Definition at line 75 of file EhciUrb.h.

◆ QTD_MAX_BUFFER

#define QTD_MAX_BUFFER   4

Definition at line 53 of file EhciUrb.h.

◆ QTD_MAX_ERR

#define QTD_MAX_ERR   3

Definition at line 37 of file EhciUrb.h.

◆ QTD_PID_INPUT

#define QTD_PID_INPUT   0x01

Definition at line 39 of file EhciUrb.h.

◆ QTD_PID_OUTPUT

#define QTD_PID_OUTPUT   0x00

Definition at line 38 of file EhciUrb.h.

◆ QTD_PID_SETUP

#define QTD_PID_SETUP   0x02

Definition at line 40 of file EhciUrb.h.

◆ QTD_STAT_ACTIVE

#define QTD_STAT_ACTIVE   0x80

Definition at line 50 of file EhciUrb.h.

◆ QTD_STAT_BABBLE_ERR

#define QTD_STAT_BABBLE_ERR   0x10

Definition at line 47 of file EhciUrb.h.

◆ QTD_STAT_BUFF_ERR

#define QTD_STAT_BUFF_ERR   0x20

Definition at line 48 of file EhciUrb.h.

◆ QTD_STAT_DO_CS

#define QTD_STAT_DO_CS   0x02

Definition at line 45 of file EhciUrb.h.

◆ QTD_STAT_DO_OUT

#define QTD_STAT_DO_OUT   0

Definition at line 42 of file EhciUrb.h.

◆ QTD_STAT_DO_PING

#define QTD_STAT_DO_PING   0x01

Definition at line 44 of file EhciUrb.h.

◆ QTD_STAT_DO_SS

#define QTD_STAT_DO_SS   0

Definition at line 43 of file EhciUrb.h.

◆ QTD_STAT_ERR_MASK

#define QTD_STAT_ERR_MASK   (QTD_STAT_TRANS_ERR | QTD_STAT_BABBLE_ERR | QTD_STAT_BUFF_ERR)

Definition at line 51 of file EhciUrb.h.

◆ QTD_STAT_HALTED

#define QTD_STAT_HALTED   0x40

Definition at line 49 of file EhciUrb.h.

◆ QTD_STAT_TRANS_ERR

#define QTD_STAT_TRANS_ERR   0x08

Definition at line 46 of file EhciUrb.h.

◆ USB_ERR_SHORT_PACKET

#define USB_ERR_SHORT_PACKET   0x200

Definition at line 66 of file EhciUrb.h.

Typedef Documentation

◆ PEI_EHC_QH

typedef struct _PEI_EHC_QH PEI_EHC_QH

Definition at line 14 of file EhciUrb.h.

◆ PEI_EHC_QTD

typedef struct _PEI_EHC_QTD PEI_EHC_QTD

Definition at line 13 of file EhciUrb.h.

◆ PEI_URB

typedef struct _PEI_URB PEI_URB

Definition at line 15 of file EhciUrb.h.

Function Documentation

◆ EhcCreateQh()

PEI_EHC_QH * EhcCreateQh ( IN PEI_USB2_HC_DEV Ehci,
IN USB_ENDPOINT Ep 
)

Allocate and initialize a EHCI queue head.

Parameters
EhciThe EHCI device.
EpThe endpoint to create queue head for.
Return values
thepointer to the created queue head or NULL if failed to create one.

Definition at line 165 of file EhciUrb.c.

◆ EhcCreateQtd()

PEI_EHC_QTD * EhcCreateQtd ( IN PEI_USB2_HC_DEV Ehc,
IN UINT8 *  Data,
IN UINTN  DataLen,
IN UINT8  PktId,
IN UINT8  Toggle,
IN UINTN  MaxPacket 
)

Delete a single asynchronous interrupt transfer for the device and endpoint.

Parameters
EhcThe EHCI device.
DataCurrent data not associated with a QTD.
DataLenThe length of the data.
PktIdPacket ID to use in the QTD.
ToggleData toggle to use in the QTD.
MaxPacketMaximu packet length of the endpoint.
Return values
thepointer to the created QTD or NULL if failed to create one.

Definition at line 29 of file EhciUrb.c.

◆ EhcCreateUrb()

PEI_URB * EhcCreateUrb ( IN PEI_USB2_HC_DEV Ehc,
IN UINT8  DevAddr,
IN UINT8  EpAddr,
IN UINT8  DevSpeed,
IN UINT8  Toggle,
IN UINTN  MaxPacket,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR Hub,
IN UINTN  Type,
IN EFI_USB_DEVICE_REQUEST Request,
IN VOID *  Data,
IN UINTN  DataLen,
IN EFI_ASYNC_USB_TRANSFER_CALLBACK  Callback,
IN VOID *  Context,
IN UINTN  Interval 
)

Create a new URB and its associated QTD.

Parameters
EhcThe EHCI device.
DevAddrThe device address.
EpAddrEndpoint addrress & its direction.
DevSpeedThe device speed.
ToggleInitial data toggle to use.
MaxPacketThe max packet length of the endpoint.
HubThe transaction translator to use.
TypeThe transaction type.
RequestThe standard USB request for control transfer.
DataThe user data to transfer.
DataLenThe length of data buffer.
CallbackThe function to call when data is transferred.
ContextThe context to the callback.
IntervalThe interval for interrupt transfer.
Return values
thepointer to the created URB or NULL.

Definition at line 514 of file EhciUrb.c.

◆ EhcFreeUrb()

VOID EhcFreeUrb ( IN PEI_USB2_HC_DEV Ehc,
IN PEI_URB Urb 
)

Free an allocated URB. It is possible for it to be partially inited.

Parameters
EhcThe EHCI device.
UrbThe URB to free.

Definition at line 311 of file EhciUrb.c.