| /****************************************************************************** |
| ** |
| ** INTEL CONFIDENTIAL |
| ** Copyright 2003-2004 Intel Corporation All Rights Reserved. |
| ** |
| ** The source code contained or described herein and all documents |
| ** related to the source code (Material) are owned by Intel Corporation |
| ** or its suppliers or licensors. Title to the Material remains with |
| ** Intel Corporation or its suppliers and licensors. The Material contains |
| ** trade secrets and proprietary and confidential information of Intel |
| ** or its suppliers and licensors. The Material is protected by worldwide |
| ** copyright and trade secret laws and treaty provisions. No part of the |
| ** Material may be used, copied, reproduced, modified, published, uploaded, |
| ** posted, transmitted, distributed, or disclosed in any way without Intel's |
| ** prior express written permission. |
| ** |
| ** No license under any patent, copyright, trade secret or other intellectual |
| ** property right is granted to or conferred upon you by disclosure or |
| ** delivery of the Materials, either expressly, by implication, inducement, |
| ** estoppel or otherwise. Any license under such intellectual property rights |
| ** must be express and approved by Intel in writing. |
| ** |
| ** usbdefs.h |
| ******************************************************************************//****************************************************************************** |
| * |
| * (C)Copyright 2005 - 2011 Marvell. All Rights Reserved. |
| * |
| * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MARVELL. |
| * The copyright notice above does not evidence any actual or intended |
| * publication of such source code. |
| * This Module contains Proprietary Information of Marvell and should be |
| * treated as Confidential. |
| * The information in this file is provided for the exclusive use of the |
| * licensees of Marvell. |
| * Such users have the right to use, modify, and incorporate this code into |
| * products for purposes authorized by the license agreement provided they |
| * include this notice and the associated copyright notice with any such |
| * product. |
| * The information in this file is provided "AS IS" without warranty. |
| |
| ****************************************************************************** |
| ** FILENAME: usbdefs.h |
| ** |
| ** PURPOSE: This file defines constants for USB |
| ** |
| ** |
| ******************************************************************************/ |
| |
| #ifndef __USBDEFS_H |
| #define __USBDEFS_H |
| #include "xllp_defs.h" |
| |
| |
| #define XLLP_USB_REQ_TYPE_MASK (0x3 << 5) // Used to identify a Request Type |
| |
| |
| #define DESC_TYPE_OFFSET 16 |
| #define DESC_TYPE_MASK 0xFF |
| #define DESC_TYPE_DEVICE 0x01 |
| #define DESC_TYPE_CONFIG 0x02 |
| #define DESC_TYPE_STRING 0x03 |
| #define DESC_TYPE_INTERFACE 0x04 |
| #define DESC_TYPE_ENDPOINT 0x05 |
| #define DESC_TYPE_QUALIFIER 0x06 |
| #define DESC_TYPE_OTHER_SPEED 0x07 |
| #define DESC_TYPE_INTF_POWER 0x08 |
| #define DESC_TYPE_OTG 0x09 |
| |
| // USB Setup transaction structure |
| typedef struct XLLP_USB_SETUP_DATA_S |
| { |
| XLLP_UINT8_T bmRequestType; |
| XLLP_UINT8_T bRequest; |
| XLLP_UINT16_T wValue; |
| XLLP_UINT16_T wIndex; |
| XLLP_UINT16_T wLength; |
| } XLLP_USB_SETUP_DATA_T, *P_XLLP_USB_SETUP_DATA_T; |
| |
| // Enumerate Request types |
| typedef enum XLLP_USB_REQUEST_TYPE_E |
| { |
| STANDARD_REQ = 0x00, |
| CLASS_REQ = 0x01, |
| VENDOR_REQ = 0x02 |
| } XLLP_USB_REQUEST_TYPE_T; |
| |
| // Enumerate USB Endpoint Double Buffering Enabled/Disabled |
| typedef enum XLLP_USB_EP_DOUBLE_BUFF_E |
| { |
| DB_DIS = 0, |
| DB_EN = 1 |
| } XLLP_USB_EP_DOUBLE_BUFF_T; |
| |
| // Enumerate USB Endpoint Enabled/Disabled |
| typedef enum XLLP_USB_EP_ENABLED_E |
| { |
| EP_DIS = 0, |
| EP_EN = 1 |
| } XLLP_USB_EP_ENABLED_T; |
| |
| //Standard device requests |
| typedef enum |
| { |
| REQ_GET_STATUS = 0x00, |
| REQ_CLEAR_FEATURE = 0x01, |
| REQ_RSVD = 0x02, |
| REQ_SET_FEATURE = 0x03, |
| REQ_RSVD1 = 0x04, |
| REQ_SET_ADDRESS = 0x05, |
| REQ_GET_DESCRIPTOR = 0x06, |
| REQ_SET_DESCRIPTOR = 0x07, |
| REQ_GET_CONFIGURATION = 0x08, |
| REQ_SET_CONFIGURATION = 0x09, |
| REQ_GET_INTERFACE = 0x0A, |
| REQ_SET_INTERFACE = 0x0B, |
| REQ_SYNC_FRAME = 0x0C, |
| REQ_SET_SEL = 0x30, |
| }BREQUEST; |
| |
| // USB Descriptor types |
| typedef enum XLLP_USB_DESCRIPTORS_E |
| { |
| DEVICE_DESCRIPTOR = 0x01, |
| CONFIG_DESCRIPTOR = 0x02, |
| STRING_DESCRIPTOR = 0x03, |
| INTERFACE_DESCRIPTOR = 0x04, |
| ENDPOINT_DESCRIPTOR = 0x05, |
| DEVICE_QUALIFIER_DESCRIPTOR = 0x06, |
| OTHER_SPEED_CONFIG_DESCRIPTOR = 0x07, |
| COMPANION_EP_DESCRIPTOR = 0x30 |
| } XLLP_USB_DESCRIPTORS_T; |
| |
| |
| #define XLLP_USB_REQ_RECIPIENT_MASK 0x1f |
| |
| |
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| /* |
| *Adding the USB2 headers here from xllp_u2d.h |
| */ |
| //------------------------------------------- |
| // USB 2.0 Device Register |
| // endpoint offsets |
| //------------------------------------------- |
| typedef enum XLLP_USB_REGISTER_OFFSETS_ |
| { |
| USB_ENDPOINT_0 = 0, |
| USB_ENDPOINT_A, |
| USB_ENDPOINT_B, |
| USB_ENDPOINT_C, |
| USB_ENDPOINT_D, |
| USB_ENDPOINT_E, |
| USB_ENDPOINT_F, |
| USB_ENDPOINT_G, |
| USB_ENDPOINT_BAD |
| } XLLP_USB_REG_ENDPOINT_OFFSET_T, XLLP_USB_ENDPOINT_ID_T, XLLP_USB_DMA_CHANNEL_ID;//, XLLP_USB_EP_T; |
| |
| //U2DMAINT -> U2DMA interrrupt register -> Interrupt per channel |
| //-------------------------------------------------------------- |
| #define XLLP_USBMAINT_INTERRUPT_MASK (0x000000FFU) // Interrupt pending on channel bit0 == CHAN0, bit7 == CHAN7 |
| |
| typedef enum XLLP_USB_EP_MPS_E |
| { |
| USB_MPS_0 = 0, |
| USB_MPS_CNTRL_8 = 8, |
| USB_MPS_CNTRL_16 = 16, |
| USB_MPS_CNTRL_32 = 32, |
| USB_MPS_CNTRL_64 = 64, |
| USB_MPS_BULK_8 = 8, |
| USB_MPS_BULK_16 = 16, |
| USB_MPS_BULK_32 = 32, |
| USB_MPS_BULK_64 = 64, |
| USB_MPS_BULK_512 = 512 |
| //MPS_INT_8 = 8, |
| //MPS_INT_16 = 16, |
| //MPS_INT_32 = 32, |
| //MPS_INT_64 = 64, |
| //MPS_ISO_256 = 256, |
| //MPS_ISO_512 = 512, |
| //MPS_ISO_1023 = 1023, |
| //MPS_ISO_LSB_256 = 0x00, |
| //MPS_ISO_MSB_256 = 0x01, |
| //MPS_ISO_LSB_512 = 0x00, |
| //MPS_ISO_MSB_512 = 0x02, |
| //MPS_ISO_LSB_1023 = 0xff, |
| //MPS_ISO_MSB_1023 = 0x03 |
| } XLLP_USB_EP_MPS_T; |
| |
| |
| // Enumerate USB Transfers Types |
| typedef enum XLLP_USB_EP_TYPE_E |
| { |
| USB_CNTRL = 0x00, |
| // USB_ISO = 0x01, |
| USB_BULK = 0x02, |
| // USB_INTERPT = 0x03 |
| } XLLP_USB_EP_TYPE_T; |
| |
| // Enumerate USB Endpoint Direction |
| // Note that the names are defined from the HOST perspective: |
| // to wit: "OUT" mean an endpoint where data goes OUT of a HOST -> DEVICE |
| // for a HOST endpoint, "OUT" would be a Transmit Endpoint |
| // for a DEVICE endpoint, "OUT" would be a Receive Endpoint |
| typedef enum XLLP_USB_EP_DIR_E |
| { |
| USB_OUT = 0x00, |
| USB_IN = 0x01 |
| } XLLP_USB_EP_DIR_T; |
| |
| // Enumerate USB Endpoints |
| typedef enum XLLP_USB_EP_E |
| { |
| USB_EP_0 = 0, |
| USB_EP_1, |
| USB_EP_2 |
| } XLLP_USB_EP_T; |
| |
| |
| // USB Endpoint Configuration Structure |
| typedef struct XLLP_USB_EP_CONFIG_TABLE_S |
| { |
| XLLP_USB_ENDPOINT_ID_T EndpointNum; // Usb Endpoint Number: (0-7) [0, A, B, BAD, etc] |
| XLLP_UINT8_T usbConfigNum; // Usb Configuration Number: (1-3) |
| XLLP_UINT8_T usbInterfaceNum; // Usb Interface Number: (1-7) |
| XLLP_UINT8_T usbIntAltSettingsNum; // Usb Interface Alternate Settings Number: (1-7) |
| XLLP_USB_EP_T usbEndpointNum; // Usb Endpoint Num: (0-15) [EP0, EP1, EP2, etc] |
| XLLP_USB_EP_TYPE_T usbEndpointType; // Usb Endpoint type: Bulk, Iso, Interrupt |
| XLLP_USB_EP_DIR_T usbEndpointDirection; // Usb Endpoint direction: IN, OUT |
| XLLP_USB_EP_MPS_T maxPacketSize; // Max. Packet Size: (1-1023) |
| XLLP_USB_EP_DOUBLE_BUFF_T doubleBuffEnabled; // Double Buffering Enabled if set to one |
| XLLP_USB_EP_ENABLED_T endpointEnabled; // Endpoint Enabled if set to one |
| XLLP_UINT16_T dmaFifoSize; // Fifo allocation size |
| XLLP_UINT32_T endpointConfigValue; // Endpoint Configuration Register Value |
| XLLP_UINT32_T endpointInfoValue; // Endpoint Info Register Value |
| } XLLP_USB_EP_CONFIG_TABLE_T, *P_XLLP_USB_EP_CONFIG_TABLE_T; |
| |
| |
| //#define XLLP_USB_MAX_EP_NUM 16 |
| //#define XLLP_USB_MAX_EP_NUM 8 |
| #define XLLP_USB_MAX_EP_NUM 4 |
| #define XLLP_USB_MAX_EP_COUNT 8 |
| |
| |
| // USB Interrupt statistics structure |
| typedef struct XLLP_USB_INT_STATISTICS_S |
| { |
| XLLP_UINT32_T ResetIntCount; |
| XLLP_UINT32_T SuspendIntCount; |
| XLLP_UINT32_T ResumeIntCount; |
| XLLP_UINT32_T SOFIntCount; |
| XLLP_UINT32_T ConfigIntCount; |
| XLLP_UINT32_T EpIntCount[XLLP_USB_MAX_EP_NUM]; |
| P_XLLP_UINT32_T pRegDbg; |
| XLLP_UINT32_T totalCapturedCnt; |
| } XLLP_USB_INT_STATISTICS_T, *P_XLLP_USB_INT_STATISTICS_T; |
| |
| // USB Endpoints transfers structure |
| typedef struct XLLP_USB_XFER_S |
| { |
| P_XLLP_UINT32_T pDataEp; |
| XLLP_UINT32_T dmaChannel; |
| XLLP_UINT32_T xferLength; |
| XLLP_UINT32_T xferDataCounter; |
| XLLP_UINT32_T maxPacketSize; |
| XLLP_BOOL_T TxXferComplete; |
| XLLP_BOOL_T RxXferComplete; |
| XLLP_BOOL_T RxBlockXferComplete; |
| XLLP_BOOL_T enableLoopback; |
| } XLLP_USB_XFER_T, *P_XLLP_USB_XFER_T; |
| |
| // USB Control Transfer structure |
| typedef struct XLLP_USB_CTRL_XFER_S |
| { |
| XLLP_UINT32_T statusEp0; |
| P_XLLP_UINT32_T pTxBuffEp0; |
| P_XLLP_UINT32_T pRxBuffEp0; |
| XLLP_UINT32_T outDataEp0[64]; |
| XLLP_UINT16_T descIndexEp0; |
| XLLP_UINT16_T descTypeEp0; |
| XLLP_UINT32_T dataLengthEp0; |
| } XLLP_USB_CTRL_XFER_T, *P_XLLP_USB_CTRL_XFER_T; |
| |
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| /* |
| *Adding the USB2 headers here from xllp_u2d.h. |
| */ |
| |
| |
| #endif |