X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FBus%2FPci%2FEhciDxe%2FEhciUrb.h;h=6342bf6b1c2f7ce1d66411e493027d8bc321ddc6;hp=a1dc8e6c0a3b90f918e13c0a7971be2d643c1b91;hb=9d510e61fceee7b92955ef9a3c20343752d8ce3f;hpb=c52fa98ca98ceaab75e8ddf9ebcfbcbd323bab13 diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.h b/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.h index a1dc8e6c0a..6342bf6b1c 100644 --- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.h +++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.h @@ -1,24 +1,10 @@ /** @file -Copyright (c) 2007, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - - EhciUrb.h - -Abstract: - This file contains URB request, each request is warpped in a - URB (Usb Request Block) + URB (Usb Request Block). -Revision History +Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -30,61 +16,59 @@ typedef struct _EHC_QTD EHC_QTD; typedef struct _EHC_QH EHC_QH; typedef struct _URB URB; -enum { - // - // Transfer types, used in URB to identify the transfer type - // - EHC_CTRL_TRANSFER = 0x01, - EHC_BULK_TRANSFER = 0x02, - EHC_INT_TRANSFER_SYNC = 0x04, - EHC_INT_TRANSFER_ASYNC = 0x08, +// +// Transfer types, used in URB to identify the transfer type +// +#define EHC_CTRL_TRANSFER 0x01 +#define EHC_BULK_TRANSFER 0x02 +#define EHC_INT_TRANSFER_SYNC 0x04 +#define EHC_INT_TRANSFER_ASYNC 0x08 - EHC_QTD_SIG = EFI_SIGNATURE_32 ('U', 'S', 'B', 'T'), - EHC_QH_SIG = EFI_SIGNATURE_32 ('U', 'S', 'B', 'H'), - EHC_URB_SIG = EFI_SIGNATURE_32 ('U', 'S', 'B', 'R'), +#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') - // - // Hardware related bit definitions - // - EHC_TYPE_ITD = 0x00, - EHC_TYPE_QH = 0x02, - EHC_TYPE_SITD = 0x04, - EHC_TYPE_FSTN = 0x06, - - QH_NAK_RELOAD = 3, - QH_HSHBW_MULTI = 1, - - QTD_MAX_ERR = 3, - QTD_PID_OUTPUT = 0x00, - QTD_PID_INPUT = 0x01, - QTD_PID_SETUP = 0x02, - - QTD_STAT_DO_OUT = 0, - QTD_STAT_DO_SS = 0, - QTD_STAT_DO_PING = 0x01, - QTD_STAT_DO_CS = 0x02, - QTD_STAT_TRANS_ERR = 0x08, - QTD_STAT_BABBLE_ERR = 0x10, - QTD_STAT_BUFF_ERR = 0x20, - QTD_STAT_HALTED = 0x40, - QTD_STAT_ACTIVE = 0x80, - QTD_STAT_ERR_MASK = QTD_STAT_TRANS_ERR | QTD_STAT_BABBLE_ERR | QTD_STAT_BUFF_ERR, - - QTD_MAX_BUFFER = 4, - QTD_BUF_LEN = 4096, - QTD_BUF_MASK = 0x0FFF, - - QH_MICROFRAME_0 = 0x01, - QH_MICROFRAME_1 = 0x02, - QH_MICROFRAME_2 = 0x04, - QH_MICROFRAME_3 = 0x08, - QH_MICROFRAME_4 = 0x10, - QH_MICROFRAME_5 = 0x20, - QH_MICROFRAME_6 = 0x40, - QH_MICROFRAME_7 = 0x80, - - USB_ERR_SHORT_PACKET = 0x200 -}; +// +// Hardware related bit definitions +// +#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 // // Fill in the hardware link point: pass in a EHC_QH/QH_HW @@ -110,7 +94,7 @@ typedef struct { UINT32 Pid : 2; UINT32 ErrCnt : 2; UINT32 CurPage : 3; - UINT32 IOC : 1; + UINT32 Ioc : 1; UINT32 TotalBytes : 15; UINT32 DataToggle : 1; @@ -150,7 +134,7 @@ typedef struct { UINT32 Pid : 2; UINT32 ErrCnt : 2; UINT32 CurPage : 3; - UINT32 IOC : 1; + UINT32 Ioc : 1; UINT32 TotalBytes : 15; UINT32 DataToggle : 1; @@ -249,84 +233,81 @@ struct _URB { /** - Create a single QTD to hold the data + Create a single QTD to hold the data. - @param Ehc The EHCI device - @param Data Current data not associated with a QTD - @param DataLen The length of the data - @param PktId Packet ID to use in the QTD - @param Toggle Data toggle to use in the QTD - @param MaxPacket Maximu packet length of the endpoint + @param Ehc The EHCI device. + @param Data The cpu memory address of current data not associated with a QTD. + @param DataPhy The pci bus address of current data not associated with a QTD. + @param DataLen The length of the data. + @param PktId Packet ID to use in the QTD. + @param Toggle Data toggle to use in the QTD. + @param MaxPacket Maximu packet length of the endpoint. - @return Created QTD or NULL if failed to create one + @return Created QTD or NULL if failed to create one. **/ 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 - ) -; + ); /** - Allocate and initialize a EHCI queue head + Allocate and initialize a EHCI queue head. - @param Ehci The EHCI device - @param Ep The endpoint to create queue head for + @param Ehci The EHCI device. + @param Ep The endpoint to create queue head for. - @return Created queue head or NULL if failed to create one + @return Created queue head or NULL if failed to create one. **/ EHC_QH * EhcCreateQh ( IN USB2_HC_DEV *Ehci, IN USB_ENDPOINT *Ep - ) -; + ); /** Free an allocated URB. It is possible for it to be partially inited. - @param Ehc The EHCI device - @param Urb The URB to free - - @return None + @param Ehc The EHCI device. + @param Urb The URB to free. **/ VOID EhcFreeUrb ( IN USB2_HC_DEV *Ehc, IN URB *Urb - ) -; + ); /** - Create a new URB and its associated QTD - - @param Ehc The EHCI device - @param DevAddr The device address - @param EpAddr Endpoint addrress & its direction - @param DevSpeed The device speed - @param Toggle Initial data toggle to use - @param MaxPacket The max packet length of the endpoint - @param Hub The transaction translator to use - @param Type The transaction type - @param Request The standard USB request for control transfer - @param Data The user data to transfer - @param DataLen The length of data buffer - @param Callback The function to call when data is transferred - @param Context The context to the callback - @param Interval The interval for interrupt transfer - - @return Created URB or NULL + Create a new URB and its associated QTD. + + @param Ehc The EHCI device. + @param DevAddr The device address. + @param EpAddr Endpoint addrress & its direction. + @param DevSpeed The device speed. + @param Toggle Initial data toggle to use. + @param MaxPacket The max packet length of the endpoint. + @param Hub The transaction translator to use. + @param Type The transaction type. + @param Request The standard USB request for control transfer. + @param Data The user data to transfer. + @param DataLen The length of data buffer. + @param Callback The function to call when data is transferred. + @param Context The context to the callback. + @param Interval The interval for interrupt transfer. + + @return Created URB or NULL. **/ URB * @@ -345,6 +326,5 @@ EhcCreateUrb ( IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback, IN VOID *Context, IN UINTN Interval - ) -; + ); #endif