⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hub.hpp

📁 ISP1161 USB Driver under WinCE for StrongARM processor implementation
💻 HPP
字号:
#ifndef _HUB_HPP_
#define _HUB_HPP_

const UINT gcHubPortUnpowered = 0xFF;
const UINT gcHubPortFree = 0x00;


#define USB_HUB_DESCRIPTOR_TYPE				0x00

#define USB_HUB_FEATURE_C_HUB_LOCAL_POWER   0x00
#define USB_HUB_FEATURE_C_HUB_OVER_CURRENT  0x01

#define USB_HUB_FEATURE_PORT_CONNECTION     0x00
#define USB_HUB_FEATURE_PORT_ENABLE         0x01
#define USB_HUB_FEATURE_PORT_SUSPEND        0x02
#define USB_HUB_FEATURE_PORT_OVER_CURRENT   0x03
#define USB_HUB_FEATURE_PORT_RESET          0x04
#define USB_HUB_FEATURE_PORT_POWER			0x08
#define USB_HUB_FEATURE_PORT_LOW_SPEED      0x09

#define USB_HUB_FEATURE_C_PORT_CONNECTION 	0x10
#define USB_HUB_FEATURE_C_PORT_ENABLE 		0x11
#define USB_HUB_FEATURE_C_PORT_SUSPEND 		0x12
#define USB_HUB_FEATURE_C_PORT_OVER_CURRENT	0x13
#define USB_HUB_FEATURE_C_PORT_RESET 		0x14

#define USB_HUB_FEATURE_INVALID             0xFF

const UCHAR gcHubPortFlagCConnection =  0x01;
const UCHAR gcHubPortFlagCEnable =      0x02;
const UCHAR gcHubPortFlagCSuspend =     0x04;
const UCHAR gcHubPortFlagCOverCurrent = 0x08;
const UCHAR gcHubPortFlagCReset =       0x10;

const UCHAR gcNumFlags = 5;


inline UCHAR ConvertFeatureToFlags(DWORD feature)
{
    return((UCHAR)((feature >> 16) & 0x1F));
}    

inline USHORT ConvertFlagToFeature(UCHAR flag)
{
    return(flag | 0x10);
}    


typedef struct _USB_HUB_PORT_STATUS 
{
    DWORD bfPortConnected:1;                // bit 0
    DWORD bfPortEnabled:1;                  // bit 1
    DWORD bfPortSuspended:1;                // bit 2
    DWORD bfPortOverCurrent:1;              // bit 3
    DWORD bfPortReset:1;                    // bit 4
    DWORD bfReserved1:3;                    // bits 5-7
    DWORD bfPortPower:1;                    // bit 8
    DWORD bfDeviceIsLowSpeed:1;             // bit 9
    DWORD bfReserved2:6;                    // bits 10-15
    DWORD bfConnectStatusChange:1;          // bit 16
    DWORD bfPortEnableChange:1;             // bit 17
    DWORD bfSuspendChange:1;                // bit 18
    DWORD bfOverCurrentChange:1;            // bit 19
    DWORD bfResetChange:1;                  // bit 20
    DWORD bfReserved3:11;                   // bits 21-32
} USB_HUB_PORT_STATUS, *PUSB_HUB_PORT_STATUS;



#endif //_HUB_HPP_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -