?? usbhubcommon.h
字號:
/* usbHubCommon.h - Macro definitions used in USB Hub class driver */
/* Copyright 2004 Wind River Systems, Inc.
This software includes software licensed to Wind River Systems, Inc.
by Wipro, Ltd. Wind River licensees may use this software according
to the terms of their Wind River license agreement(s) applicable to
this software.
*/
/*
Modification history
--------------------
01b,18aug05,ami Fix for enumerating hubs with class code 0x101
01a,30may03,nrv Changing the code to WRS standards
*/
/*
DESCRIPTION
This file contains the macro definitions that are used through
out the USB Hub Class Driver.
*/
/*
INTERNAL
******************************************************************************
* Filename : HUB_Common.h
*
* Copyright :
*
* THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO
* LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING
* ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE
* 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY
* ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY
* PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE
* ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL.
* THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF
* THIS COPYRIGHT AS PER APPLICABLE LAWS.
*
*
* Description : This contains the macro definitions that are used through
* out the USB Hub Class Driver.
*
******************************************************************************/
#ifndef __USBHUBCOMMON_H__
#define __USBHUBCOMMON_H__
#ifdef __cplusplus
extern "C" {
#endif
/* includes */
#include "usb2/usbOsal.h"
#include "usb2/usbHst.h"
/* defines */
#define USB_HUB_VERSION_NUMBER "Devel_0.01"
#define USB_HUB_VERSION_DATE "4th April 2003"
/* Priority of the Hub's Threads */
#define USB_HUB_THREAD_PRIORITY (100)
/* The default configuration Index for a Hub */
#define USB_DEF_ACTIVE_HUB_CONFIG_INDEX ((UINT8)0x00)
/* Maximum retries for connection attempt */
#define USB_HUB_CONFIG_RETRY_MAX ((UINT8)0x03)
/* Maximum frame number 11 bits are allowed for this field */
#define USB_HUB_MAXIMUM_FRAME_NUMBER ((UINT16) 2048)
/* The Debounce Time intreval */
#define USB_HUB_PORT_DEBOUNCE_TIME ((UINT16) 100)
/* Define for the Maximum power per root hub */
#define USB_MAXIMUM_POWER_PER_ROOT_HUB ((UINT8)0x5)
/* Port number not found */
#define USB_PORT_NUMBER_NOT_FOUND ((UINT8)255)
/* The Maximum depth that the USB Tree can grow in USB1.1 */
#define HUB_MAX_ALLOWED_DEPTH_USB1_1 ((UINT8)5)
/* The Maximum depth that the USB Tree can grow in USB2.0 */
#define HUB_MAX_ALLOWED_DEPTH_USB2_0 ((UINT8)7)
/* The default endpoint */
#define USB_HUB_DEFAULT_ENDPOINT ((UINT8)0x0)
/* Flag for indicating a port as not a High Speed port */
#define USB_NOT_HIGH_SPEED_HUB_PORT ((UINT8)0xFF)
/* Defines for the Usb Version of Hub */
#define USB_HUB_VERSION_0200 ((UINT16)0x0200)
#define USB_HUB_VERSION_0110 ((UINT16)0x0110)
#define USB_HUB_VERSION_0100 ((UINT16)0x0100)
#define USB_HUB_VERSION_0101 ((UINT16)0x0101)
/* Defines Status bits USB2.0 spec- table 11-7 (wValue) */
#define USB_HUB_LOCAL_POWER ((UINT8)0X0)
#define USB_HUB_OVER_CURRENT ((UINT8)0X1)
#define USB_PORT_CONNECTION ((UINT8)0X0)
#define USB_PORT_ENABLE ((UINT8)0X1)
#define USB_PORT_SUSPEND ((UINT8)0X2)
#define USB_PORT_OVER_CURRENT ((UINT8)0X3)
#define USB_PORT_RESET ((UINT8)0X4)
#define USB_PORT_POWER ((UINT8)0X8)
#define USB_PORT_LOW_SPEED ((UINT8)0X9)
#define USB_C_PORT_CONNECTION ((UINT8)0X10)
#define USB_C_PORT_ENABLE ((UINT8)0X11)
#define USB_C_PORT_SUSPEND ((UINT8)0X12)
#define USB_C_PORT_OVER_CURRENT ((UINT8)0X13)
#define USB_C_PORT_RESET ((UINT8)0X14)
/* defines for the bit value of the wHubStatus */
#define USB_HUB_LOCAL_POWER_VALUE ((UINT16)0X1)
#define USB_HUB_OVER_CURRENT_VALUE ((UINT16)0X2)
/* defines for the bit value of the wHubStatusChange */
#define USB_C_HUB_LOCAL_POWER_VALUE ((UINT16)0X1)
#define USB_C_HUB_OVER_CURRENT_VALUE ((UINT16)0X2)
/* defines for the bit value of the wPortStatus */
#define USB_PORT_CONNECTION_VALUE ((UINT16)0X0001)
#define USB_PORT_ENABLE_VALUE ((UINT16)0X0002)
#define USB_PORT_SUSPEND_VALUE ((UINT16)0X0004)
#define USB_PORT_OVER_CURRENT_VALUE ((UINT16)0X0008)
#define USB_PORT_RESET_VALUE ((UINT16)0X0010)
#define USB_PORT_POWER_VALUE ((UINT16)0X0100)
#define USB_PORT_SPEED_VALUE ((UINT16)0X0600)
/* defines for the bit value of the wPortStatus */
#define USB_C_PORT_CONNECTION_VALUE ((UINT16)0X0001)
#define USB_C_PORT_ENABLE_VALUE ((UINT16)0X0002)
#define USB_C_PORT_SUSPEND_VALUE ((UINT16)0X0004)
#define USB_C_PORT_OVER_CURRENT_VALUE ((UINT16)0X0008)
#define USB_C_PORT_RESET_VALUE ((UINT16)0X0010)
/* Defines for the Features USB2.0 spec- table 9-4 (bRequest) */
#define USB_CLEAR_FEATURE ((UINT8) 0x01)
#define USB_SET_FEATURE ((UINT8) 0x03)
#define USB_GET_DESCRIPTOR ((UINT8) 0x06)
#define USB_SET_CONFIGURATION ((UINT8) 0x09)
#define USB_GET_STATUS ((UINT8) 0x00)
#define USB_GET_HUB_DESCRIPTOR ((UINT8) 0xA0)
/* Defines for Hub Class Request */
#define USB_CLEAR_TT_REQUEST ((UINT8) 0x08)
#define USB_RESET_TT ((UINT8) 0x09)
/* Defines for the bmRequest Field */
#define USB_HUB_TARGET_GET ((UINT8) 0xA0)
#define USB_HUB_TARGET_SET ((UINT8) 0x20)
#define USB_PORT_TARGET_GET ((UINT8) 0xA3)
#define USB_PORT_TARGET_SET ((UINT8) 0x23)
#define USB_DEVICE_TARGET_GET ((UINT8) 0x80)
/* Defines for the Descriptor Types */
#define USB_HUB_DESCRIPTOR ((UINT8) 0x29)
#define USB_CONFIGURATION_DESCRIPTOR ((UINT8) 0x02)
/* Defines for the hub states */
#define USB_HUB_STATES UINT8
#define USB_HUB_NO_STATE ((USB_HUB_STATES) 0x00)
#define USB_MARKED_FOR_DELETION ((USB_HUB_STATES) 0x01)
#define USB_HUB_DEBOUNCE_PENDING ((USB_HUB_STATES) 0x02)
#define USB_HUB_RESET_PENDING ((USB_HUB_STATES) 0x03)
#define USB_HUB_RESET_COMPLETION_PENDING ((USB_HUB_STATES) 0x04)
#define USB_HUB_RESET_COMPLETED ((USB_HUB_STATES) 0x05)
#define USB_HUB_PORT_DEFAULT ((USB_HUB_STATES) 0x06)
#define USB_HUB_PORT_ADDRESSED ((USB_HUB_STATES) 0x07)
#define USB_HUB_PORT_CONFIGURED ((USB_HUB_STATES) 0x08)
/*******************************************************************************
* Macro Name : HUB_DESC_bNbrPorts
* Description : This returns the number of ports that a specific hub contains
* by parsing the hub descriptor.
* Parameters : pHubDescriptor IN pointer to the Hub descriptor.
* Return Type : UINT8
******************************************************************************/
#define USB_HUB_DESC_bNbrPorts(pHubDescriptor) \
((UINT8*) (pHubDescriptor))[2] \
/*******************************************************************************
* Macro Name : HUB_DESC_wHubCharacteristics
* Description : This parses the hub descriptor and returns the
* wHubCharacteristic.
* Parameters : pHubDescriptor IN pointer to the Hub descriptor.
* Return Type : UINT16
******************************************************************************/
#define USB_HUB_DESC_wHubCharacteristics(pHubDescriptor) \
( ( ( (UINT8*) (pHubDescriptor))[4]<<8) | \
( ( (UINT8*) (pHubDescriptor))[3]) ) \
/*******************************************************************************
* Macro Name : HUB_DESC_bPwrOn2PwrGood
* Description : This parses the hub descriptor and returns the bPwrOn2PwrGood.
* Parameters : pHubDescriptor IN pointer to the Hub descriptor.
* Return Type : UINT8
******************************************************************************/
#define USB_HUB_DESC_bPwrOn2PwrGood(pHubDescriptor) \
( ( (UINT8*) (pHubDescriptor) )[5] ) \
/*******************************************************************************
* Macro Name : HUB_DESC_bHubContrCurrent
* Description : This parses the hub descriptor and returns the bHubContrCurrent.
* Parameters : pHubDescriptor IN pointer to the Hub descriptor.
* Return Type : UINT8
******************************************************************************/
#define USB_HUB_DESC_bHubContrCurrent(pHubDescriptor) \
( ( (UINT8*) (pHubDescriptor) )[6] ) \
/*******************************************************************************
* Macro Name : HUB_DESC_GET_NUMPORT_OFFSET
* Description : This parses the hub descriptor and returns the offset required
* for data of the DeviceRemovableMap and PortPWrCtrlMask fields
* as per the byte granularity.
* Parameters : pHubDescriptor IN pointer to the Hub descriptor.
* uOffset OUT the offset for the number of ports
* Return Type : None
******************************************************************************/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -