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

📄 hub.h

📁 CH374EVT.ZIP
💻 H
字号:
#define CLEAR_HUB_FEATURE	0x20
#define CLEAR_PORT_FEATURE	0x23
#define GET_BUS_STATE		0xa3
#define GET_HUB_DESCRIPTOR	0xa0
#define GET_HUB_STATUS		0xa0
#define GET_PORT_STATUS		0xa3
#define SET_HUB_DESCRIPTOR	0x20
#define SET_HUB_FEATURE		0x20
#define SET_PORT_FEATURE	0x23

//////Hub Class Feature Selectors
#define	C_HUB_LOCAL_POWER	0
#define C_HUB_OVER_CURRENT	1
#define PORT_CONNECTION		0
#define PORT_ENABLE			1
#define PORT_SUSPEND		2
#define PORT_OVER_CURRENT	3
#define PORT_RESET			4
#define PORT_POWER			8
#define	PORT_LOW_SPEED		9
#define C_PORT_CONNECTION	16
#define C_PORT_ENABLE		17
#define C_PORT_SUSPEND		18
#define C_PORT_OVER_CURRENT	19
#define C_PORT_RESET		20

////////Hub Class Request Codes
#define GET_STATUS			0
#define CLEAR_FEATURE		1
#define GET_STATE			2
#define SET_FEATURE			3
#define GET_DESCRIPTOR		6
#define SET_DESCRIPTOR		7

typedef struct _HUB_DESCRIPTOR
{
	unsigned char bDescLength;
	unsigned char bDescriptorType;
	unsigned char bNbrPorts;
	unsigned char wHubCharacteristics[2];
	unsigned char bPwrOn2PwrGood;
	unsigned char bHubContrCurrent;
	unsigned char DeviceRemovable;
	
}
HUBDescr,*PHUBDescr;

/////////// 动态集线器信息分配表
typedef struct _INF
{
	unsigned char bAddr; // 本设备的地址
	unsigned char bDevType; // 设备是HUB还是功能设备
	unsigned char bUpPort; // 上一级端口地址,0xff代表主端口
	unsigned char bEndpSize; // 端点0包大小
	
	union _KUNO
	{
		struct _HUB
		{
			unsigned char bNumPort; // 从属端口数量
			unsigned char bHUBendp; // 中断端点地址
			unsigned char bInterval; // 最大中断间隔时间
			unsigned char bSlavePort[7]; // 从属端口的地址,默认集线器最多7个端口
		}
		HUB; // 集线器属性

		struct _DEV
		{
			unsigned char bSpeed; // 功能设备的速度,全速还是低速
			// 剩余保留,可放置功能设备的其他属性

		}
		DEV; // 功能设备属性
	}
	KUNO; // 集线器属性,功能设备属性共用
}
INF, *PINF; // 设备信息

typedef struct _NUM
{
	//INF Num[127]; // 最多127个设备连接
	INF Num[50]; // 最多127个设备连接
}
NUM, *PNUM;

// 自己定义的便于区分
#define	HUB_TYPE		0x66
#define FUNCTION_DEV	0x77
#define	FULL_SPEED		0x88
#define LOW_SPEED		0x99
#define FIND_ATTACH		0xaa
#define FIND_REMOVE		0xbb

⌨️ 快捷键说明

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