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  _EHC_QTD
 
struct  _EHC_QH
 
struct  _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 _EHC_QTD EHC_QTD
 
typedef struct _EHC_QH EHC_QH
 
typedef struct _URB URB
 
typedef struct _USB_ENDPOINT USB_ENDPOINT
 

Functions

EHC_QTDEhcCreateQtd (IN USB2_HC_DEV *Ehc, IN UINT8 *Data, IN UINT8 *DataPhy, IN UINTN DataLen, IN UINT8 PktId, IN UINT8 Toggle, IN UINTN MaxPacket)
 
EHC_QHEhcCreateQh (IN USB2_HC_DEV *Ehci, IN USB_ENDPOINT *Ep)
 
VOID EhcFreeUrb (IN USB2_HC_DEV *Ehc, IN URB *Urb)
 
URBEhcCreateUrb (IN 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

This file contains URB request, each request is warpped in a URB (Usb Request Block).

Copyright (c) 2007 - 2010, 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 22 of file EhciUrb.h.

◆ EHC_CTRL_TRANSFER

#define EHC_CTRL_TRANSFER   0x01

Definition at line 21 of file EhciUrb.h.

◆ EHC_INT_TRANSFER_ASYNC

#define EHC_INT_TRANSFER_ASYNC   0x08

Definition at line 24 of file EhciUrb.h.

◆ EHC_INT_TRANSFER_SYNC

#define EHC_INT_TRANSFER_SYNC   0x04

Definition at line 23 of file EhciUrb.h.

◆ EHC_QH_SIG

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

Definition at line 27 of file EhciUrb.h.

◆ EHC_QTD_SIG

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

Definition at line 26 of file EhciUrb.h.

◆ EHC_TYPE_FSTN

#define EHC_TYPE_FSTN   0x06

Definition at line 36 of file EhciUrb.h.

◆ EHC_TYPE_ITD

#define EHC_TYPE_ITD   0x00

Definition at line 33 of file EhciUrb.h.

◆ EHC_TYPE_QH

#define EHC_TYPE_QH   0x02

Definition at line 34 of file EhciUrb.h.

◆ EHC_TYPE_SITD

#define EHC_TYPE_SITD   0x04

Definition at line 35 of file EhciUrb.h.

◆ EHC_URB_SIG

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

Definition at line 28 of file EhciUrb.h.

◆ QH_HSHBW_MULTI

#define QH_HSHBW_MULTI   1

Definition at line 39 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 76 of file EhciUrb.h.

◆ QH_MICROFRAME_0

#define QH_MICROFRAME_0   0x01

Definition at line 61 of file EhciUrb.h.

◆ QH_MICROFRAME_1

#define QH_MICROFRAME_1   0x02

Definition at line 62 of file EhciUrb.h.

◆ QH_MICROFRAME_2

#define QH_MICROFRAME_2   0x04

Definition at line 63 of file EhciUrb.h.

◆ QH_MICROFRAME_3

#define QH_MICROFRAME_3   0x08

Definition at line 64 of file EhciUrb.h.

◆ QH_MICROFRAME_4

#define QH_MICROFRAME_4   0x10

Definition at line 65 of file EhciUrb.h.

◆ QH_MICROFRAME_5

#define QH_MICROFRAME_5   0x20

Definition at line 66 of file EhciUrb.h.

◆ QH_MICROFRAME_6

#define QH_MICROFRAME_6   0x40

Definition at line 67 of file EhciUrb.h.

◆ QH_MICROFRAME_7

#define QH_MICROFRAME_7   0x80

Definition at line 68 of file EhciUrb.h.

◆ QH_NAK_RELOAD

#define QH_NAK_RELOAD   3

Definition at line 38 of file EhciUrb.h.

◆ QTD_BUF_LEN

#define QTD_BUF_LEN   4096

Definition at line 58 of file EhciUrb.h.

◆ QTD_BUF_MASK

#define QTD_BUF_MASK   0x0FFF

Definition at line 59 of file EhciUrb.h.

◆ QTD_LINK

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

Definition at line 79 of file EhciUrb.h.

◆ QTD_MAX_BUFFER

#define QTD_MAX_BUFFER   4

Definition at line 57 of file EhciUrb.h.

◆ QTD_MAX_ERR

#define QTD_MAX_ERR   3

Definition at line 41 of file EhciUrb.h.

◆ QTD_PID_INPUT

#define QTD_PID_INPUT   0x01

Definition at line 43 of file EhciUrb.h.

◆ QTD_PID_OUTPUT

#define QTD_PID_OUTPUT   0x00

Definition at line 42 of file EhciUrb.h.

◆ QTD_PID_SETUP

#define QTD_PID_SETUP   0x02

Definition at line 44 of file EhciUrb.h.

◆ QTD_STAT_ACTIVE

#define QTD_STAT_ACTIVE   0x80

Definition at line 54 of file EhciUrb.h.

◆ QTD_STAT_BABBLE_ERR

#define QTD_STAT_BABBLE_ERR   0x10

Definition at line 51 of file EhciUrb.h.

◆ QTD_STAT_BUFF_ERR

#define QTD_STAT_BUFF_ERR   0x20

Definition at line 52 of file EhciUrb.h.

◆ QTD_STAT_DO_CS

#define QTD_STAT_DO_CS   0x02

Definition at line 49 of file EhciUrb.h.

◆ QTD_STAT_DO_OUT

#define QTD_STAT_DO_OUT   0

Definition at line 46 of file EhciUrb.h.

◆ QTD_STAT_DO_PING

#define QTD_STAT_DO_PING   0x01

Definition at line 48 of file EhciUrb.h.

◆ QTD_STAT_DO_SS

#define QTD_STAT_DO_SS   0

Definition at line 47 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 55 of file EhciUrb.h.

◆ QTD_STAT_HALTED

#define QTD_STAT_HALTED   0x40

Definition at line 53 of file EhciUrb.h.

◆ QTD_STAT_TRANS_ERR

#define QTD_STAT_TRANS_ERR   0x08

Definition at line 50 of file EhciUrb.h.

◆ USB_ERR_SHORT_PACKET

#define USB_ERR_SHORT_PACKET   0x200

Definition at line 70 of file EhciUrb.h.

Typedef Documentation

◆ EHC_QH

typedef struct _EHC_QH EHC_QH

Definition at line 15 of file EhciUrb.h.

◆ EHC_QTD

typedef struct _EHC_QTD EHC_QTD

Definition at line 14 of file EhciUrb.h.

◆ URB

typedef struct _URB URB

Definition at line 16 of file EhciUrb.h.

Function Documentation

◆ EhcCreateQh()

EHC_QH * EhcCreateQh ( IN 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.
Returns
Created queue head or NULL if failed to create one.

Definition at line 167 of file EhciUrb.c.

◆ EhcCreateQtd()

EHC_QTD * EhcCreateQtd ( IN USB2_HC_DEV Ehc,
IN UINT8 *  Data,
IN UINT8 *  DataPhy,
IN UINTN  DataLen,
IN UINT8  PktId,
IN UINT8  Toggle,
IN UINTN  MaxPacket 
)

Create a single QTD to hold the data.

Parameters
EhcThe EHCI device.
DataThe cpu memory address of current data not associated with a QTD.
DataPhyThe pci bus address of current 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.
Returns
Created QTD or NULL if failed to create one.

Definition at line 29 of file EhciUrb.c.

◆ EhcCreateUrb()

URB * EhcCreateUrb ( IN 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.
Returns
Created URB or NULL.

Definition at line 528 of file EhciUrb.c.

◆ EhcFreeUrb()

VOID EhcFreeUrb ( IN USB2_HC_DEV Ehc,
IN 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 313 of file EhciUrb.c.