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

📄 hc_struct.h

📁 Dsp控制1362芯片做主机
💻 H
字号:
/****************************************************************************/
/*	constants (1/2)															*/
/****************************************************************************/

/*	bRequest	*/
//	Table 9-4. Standard Request Codes

#define		GET_STATUS					0
#define		CLEAR_FEATURE				1
#define		Reserved_for_future_use_2	2
#define		SET_FEATURE					3
#define		Reserved_for_future_use_4	4
#define		SET_ADDRESS					5
#define		GET_DESCRIPTOR				6
#define		SET_DESCRIPTOR				7
#define		GET_CONFIGURATION			8
#define		SET_CONFIGURATION			9
#define		GET_INTERFACE				10
#define		SET_INTERFACE				11
#define		SYNCH_FRAME					12


/*
 *  Standard Device Requests
 *      std_Dv_request_...(15:08)   = Standard Device Requests; Sec 9.4, Table 9-3, page250
 *      std_Dv_request_...(07:00)   = Standard Request Codes;   Sec 9.4, Table 9-4, page251
 */

#define     std_Dv_request_CLEAR_FEATURE_Dv         0x0001
#define     std_Dv_request_CLEAR_FEATURE_If         0x0101
#define     std_Dv_request_CLEAR_FEATURE_Ep         0x0201
#define     std_Dv_request_GET_CONFIGURATION        0x8008
#define     std_Dv_request_GET_DESCRIPTOR           0x8006
#define     std_Dv_request_GET_INTERFACE            0x810A
#define     std_Dv_request_GET_STATUS_Dv            0x8000
#define     std_Dv_request_GET_STATUS_If            0x8100
#define     std_Dv_request_GET_STATUS_Ep            0x8200
#define     std_Dv_request_SET_ADDRESS              0x0005
#define     std_Dv_request_SET_CONFIGURATION        0x0009
#define     std_Dv_request_SET_DESCRIPTOR           0x0007
#define     std_Dv_request_SET_FEATURE_Dv           0x0003
#define     std_Dv_request_SET_FEATURE_If           0x0103
#define     std_Dv_request_SET_FEATURE_Ep           0x0203
#define     std_Dv_request_SET_INTERFACE            0x010B
#define     std_Dv_request_SYNCH_FRAME              0x820C


/*
 *  Descriptor Types
 *      Sec 9.4, Table 9-5, page251
 */

#define     descriptor_type_DEVICE                      0x0100
#define     descriptor_type_CONFIGURATION               0x0200
#define     descriptor_type_STRING                      0x0300
#define     descriptor_type_INTERFACE                   0x0400
#define     descriptor_type_ENDPOINT                    0x0500
#define     descriptor_type_DEVICE_QUALIFIER            0x0600
#define     descriptor_type_OTHER_SPEED_CONFIGURATION   0x0700
#define     descriptor_type_INTERFACE_POWER             0x0800

/*
 *  Descriptor Type for OTG
 *      6.4 "OTG Descriptor", in On-The-Go standard, page 49
 */

#define     descriptor_type_OTG  			           0x0900


/****************************************************************************/
/*	types																	*/
/****************************************************************************/

typedef	struct		req			{
									unsigned char	bmRequestType;
									unsigned char	bRequest;
									unsigned short	wValue;
									unsigned short	wIndex;
									unsigned short	wLength;
								} 
								USB_Device_Request;

/*
 *  Standard USB Descriptor Definitions
 *      Sec 9.6, page 261
 */

typedef struct  std_dev_desc    {   /*  Sec9.6.1, Table 9-8, p262   */

                                    unsigned char   bLength;
                                    unsigned char   bDescriptorType;
                                    unsigned short  bcdUSB;
                                    unsigned char   bDeviceClass;
                                    unsigned char   bDeviceSubClass;
                                    unsigned char   bDeviceProtocol;
                                    unsigned char   bMaxPacketSize0;
                                    unsigned short  idVendor;
                                    unsigned short  idProduct;
                                    unsigned short  bcdDevice;
                                    unsigned char   iManufacturer;
                                    unsigned char   iProduct;
                                    unsigned char   iSerialNumber;
                                    unsigned char   bNumConfigurations;
                                }
                                std_dev_descriptor;                              
                                
 typedef struct  dev_qual_desc   {   /*  Sec 9.6.2, Table 9-9, p264  */
                                    /*  This is for Hi-speed        */

                                    unsigned char   bLength;
                                    unsigned char   bDescriptorType;
                                    unsigned short  bcdUSB;
                                    unsigned char   bDeviceClass;
                                    unsigned char   bDeviceSubClass;
                                    unsigned char   bDeviceProtocol;
                                    unsigned char   bMaxPacketSize0;
                                    unsigned char   bNumConfigurations;
                                }
                                dev_qualifier_descriptor;
           
typedef struct  std_conf_desc   {   /*  Sec9.6.3, Table 9-10, p265  */

                                    unsigned char   bLength;
                                    unsigned char   bDescriptorType;
                                    unsigned short  wTotalLength;
                                    unsigned char   bNumInterfaces;
                                    unsigned char   bConfigurationValue;
                                    unsigned char   iConfiguration;
                                    unsigned char   bmAttributes;
                                    unsigned char   bMaxPower;
                                }
                                std_conf_descriptor;

typedef struct  std_if_desc     {   /*  Sec9.6.5, Table 9-12, p268  */

                                    unsigned char   bLength;
                                    unsigned char   bDescriptorType;
                                    unsigned char   bInterfaceNumber;
                                    unsigned char   bAlternateSetting;
                                    unsigned char   bNumEndpoints;
                                    unsigned char   bInterfaceClass;
                                    unsigned char   bInterfaceSubClass;
                                    unsigned char   bInterfaceProtocol;
                                    unsigned char   iInterface;
                                }
                                std_interface_descriptor;
                                
typedef struct  std_ep_desc     {   /*  Sec9.6.6, Table 9-13, p269  */

                                    unsigned char   bLength;
                                    unsigned char   bDescriptorType;
                                    unsigned char   bEndpointAddress;
                                    unsigned char   bmAttributes;
                                    unsigned short  wMaxPacketSize;
                                    unsigned char   bInterval;
                                }
                                std_endpoint_descriptor; 
                                
typedef struct  std_str_desc    {   /*  Sec9.6.7, Table 9-15, p273  */

                                    unsigned char   bLength;
                                    unsigned char   bDescriptorType;
                                    unsigned short  bString;			//	bString[ (254) >> 1 ];
                                }
                                std_string_descriptor;  
                                
//**************************************************************************
//Structure for Mass storage
//**************************************************************************
typedef struct
{
	unsigned char dCBWSignature[4];		//the signature field shall contain the value 43425355
	unsigned char dCBWTag[4];			//the device shall echo the contents of this field back to the host in the dCSWTag field of the associated CSW.
	unsigned char dCBWDataTransferLength[4];	//the number of bytes of data that the host expects to transfer on the Bulk_in or Bulk_out endpoint during the execution of the command.
	unsigned char  bmCBWFlags;		//bit 7 direction:0 data out;1 data in
					//bit 6 obsolete.the host shall set this bit to zero.
					//bit 5..0 reserved .the host shall set these bit to zero
	unsigned char  bCBWLUN;			//zero
	unsigned char  bCBWCBLength;		//the valid length of the CBWCB in bytes.
	unsigned char  CBWCB[16];
}sCBW,*pCBW;

typedef struct
{
	unsigned char dCSWSignature[4];		//contain the value 53425355
	unsigned char dCSWTag[4];			//same as the associated CBW
	unsigned char dCSWDataResidue[4];		//the difference between the amount of data expected transfer and the actual amount of data processed.
	unsigned char  bCSWStatus;		//indicates the success or failure of the command.00:command passed,01:command failed,02:phase error.
}sCSW,*pCSW;

/*-------------------------------------------------------------------------
 * Structure for USB HUB
 *------------------------------------------------------------------------*/
// Hub Standard Descriptor
typedef struct  hub_d_param    {	//	Hub Descriptor
									//	See USB2.0 specification 11.23.2.1 Table 11-13 p.417

                                    unsigned char   bLength;
                                    unsigned char   bDescriptorType;
                                    unsigned char	bNbrPorts;
                                    unsigned short  wHubCharacteristics;
                                    unsigned char   bPwrOn2PwrGood;
                                    unsigned char   bHubContrCurrent;
                                    unsigned char   DeviceRemovable;	//	This field may have variable length
                                    unsigned char   PortPwrCtrlMask;	//	This field may have variable length
                                }
     hub_descriptor_params;     

⌨️ 快捷键说明

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