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

📄 usbd_descriptor.c

📁 凌阳SPCE3200 系统开发板随机自带源程序。共安排了32个子目录
💻 C
字号:



/////////////////////////////////////////////////////////////////////////////
//Descriptor Content of MSDC
//---- Device Descriptor ----
//#define K_MSDC_DEVICE_DESCRIPTOR_SIZE        0x0012
//unsigned char K_MSDC_Device_Descriptor[K_MSDC_DEVICE_DESCRIPTOR_SIZE]=
unsigned char K_MSDC_Device_Descriptor[]=
{
		//-------------------------------------------------------------------
		//TotalLength = 0x0012 byte
		//-------------------------------------------------------------------
		
		//Device (0x12 byte)
		0x12,                   //bLength: 0x12 byte
		0x01,                   //bDescriptorType: DEVICE
		0x10, 0x01,             //bcdUSB: version 110 // 0x00,0x01
		0x00,                   //bDeviceClass: independent interfaces
		0x00,                   //bDeviceSubClass: 0
		0x00,                   //bDeviceProtocol: class specific protocols NOT used on device basis
		0x08,                   //bMaxPacketSize0: maximum packet size for endpoint zero
		0xfc, 0x04,             //idVendor: vendor ID
		0x90, 0x72,             //idProduct: product ID (for MSDC)
		0x02, 0x01,             //bcdDevice: device release number in BCD //0x00,0x01
		0x01,                   //iManufacturer: index of string
		0x02,                   //iProduct: index of string 
		0x03,                   //iSerialNumber: index of string
		0x01                    //bNumConfigurations: 1 configuration
};
	

//---- Configuration Descriptor of MSDC ----
//#define K_MSDC_CONFIGURATION_DESCRIPTOR_SIZE 0x0020
//unsigned char   K_MSDC_ConfigurationDescriptor[K_MSDC_CONFIGURATION_DESCRIPTOR_SIZE] =
unsigned char   K_MSDC_ConfigurationDescriptor[] =
{
        //-------------------------------------------------------------------
        //SubLength = 0x0009 byte 
        //-------------------------------------------------------------------

        //Configuration (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x02,                   //bDescriptorType: CONFIGURATION        
//        K_MSDC_CONFIGURATION_DESCRIPTOR_SIZE, 0x00,             //wTotalLength:
        0x0020, 0x00,             //wTotalLength:
        0x01,                   //bNumInterfaces: 1 interfaces
        0x01,                   //bConfigurationValue: configuration 1
        0x00,                   //iConfiguration: index of string
        0xC0,                   //bmAttributes: self powered
        0x32,                   //MaxPower: 100 mA     

        //-------------------------------------------------------------------
        //SubLength = 0x001e byte
        //-------------------------------------------------------------------

        //Interface 1 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x00,                   //bInterfaceNumber: interface 0
        0x00,                   //bAlternateSetting: alternate setting 0
        0x02,                   //bNumEndpoints: 2 endpoints
        0x08,                   //bInterfaceClass: Mass Storage Devices Class
        0x06,                   //bInterfaceSubClass:
    	0x50,		            //Bulk Only
        0x00,                   //iInterface: index of string

        //Endpoint 1 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x81,                   //bEndpointAddress: IN endpoint 1
        0x02,                   //bmAttributes: Bulk
        0x40, 0x00,             //wMaxPacketSize: 64 byte
        0x00,                   //bInterval: ignored

        //Endpoint 2 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x02,                   //bEndpointAddress: OUT endpoint 2
        0x02,                   //bmAttributes: Bulk
        0x40, 0x00,             //wMaxPacketSize: 64 byte
        0x00,                   //bInterval: ignored
};


//#define K_LANGUAGE_ID_STRING_SIZE       0x0004              
//unsigned char   K_LanguageIdString[K_LANGUAGE_ID_STRING_SIZE] =
unsigned char   K_LanguageIdString[] =
{
        //----------
        //0x04 Bytes
        //----------
        0x04,           //bLength
        0x03,           //bDescriptorType: STRING
        0x09, 0x04      //bString: English (US)
};

//#define K_MANUFACTURER_STRING_SIZE      0x0022
//unsigned char   K_ManufacturerString[K_MANUFACTURER_STRING_SIZE] =
unsigned char   K_ManufacturerString[] =
{
//        K_MANUFACTURER_STRING_SIZE,		//bLength
        0x22,		//bLength
        0x03,           				//bDescriptorType: STRING
         'S', 0x00,     				//bString: Sunplus Co Ltd
         'u', 0x00,
         'n', 0x00,
         'p', 0x00,
         'l', 0x00,
         'u', 0x00,
         's', 0x00,
         ' ', 0x00,
         'C', 0x00,
         'o', 0x00,
         ' ', 0x00,
         'L', 0x00,
         't', 0x00,
         'd', 0x00,
         ' ', 0x00, 
         ' ', 0x00 
};

//#define K_PRODUCT_STRING_SIZE           0x0038
//unsigned char   K_ProductString[K_PRODUCT_STRING_SIZE] =
unsigned char   K_ProductString[] =
{
        //----------
        //0x30 Bytes
        //----------
//        K_PRODUCT_STRING_SIZE,		//bLength
        0x3c,		//bLength
        0x03,          				//bDescriptorType: STRING
         'S', 0x00,     			//bString: Sunplus SPG290 Mass Storage
         'u', 0x00,
         'n', 0x00,
         'p', 0x00,
         'l', 0x00,
         'u', 0x00,
         's', 0x00,
         ' ', 0x00,
         'S', 0x00,
         'P', 0x00,
         'C', 0x00,
         'E', 0x00,
         '3', 0x00,
         '2', 0x00,
         '0', 0x00,
         '0', 0x00,
         ' ', 0x00,
         'M', 0x00,
         'a', 0x00,
         's', 0x00,
         's', 0x00,
         ' ', 0x00,
         'S', 0x00,
         't', 0x00,
         'o', 0x00,
         'r', 0x00,
         'a', 0x00,
         'g', 0x00,
         'e', 0x00
};

//#define K_SERIAL_NUMBER_STRING_SIZE     0x0012
//unsigned char   K_SerialNumberString[K_SERIAL_NUMBER_STRING_SIZE] =
unsigned char   K_SerialNumberString[] =
{
        //----------
        //0x12 Bytes
        //----------
//        K_SERIAL_NUMBER_STRING_SIZE,           //bLength
        0x12,           //bLength
        0x03,       						   //bDescriptorType: STRING
         '0', 0x00,     						//bString: 01.00.00
         '1', 0x00,     
         '.', 0x00,
         '0', 0x00,
         '0', 0x00,
         '.', 0x00,
         '0', 0x00,
         '0', 0x00 
};

unsigned char K_MaxLUN_ConfigurationDescriptor[0x01]=
{
	0x00	// for one logic disk
	//0x01	// for two logic disk
};

unsigned char R_SCSIVendorInformation[]=	// Should be 8 bytes
{
	'S',
	'U',
	'N',
	'P',
	'L',
	'U',
	'S',
	0x20
};

unsigned char R_SCSIPID_Disk0[]=			// Should be 16 bytes
{
	'S',
	'P',
	'C',
	'E',
	'3',
	'2',
	'0',
	'0',
	' ',
	'U',
	'S',
	'B',
	' ',
	'D',
	'I',
	'S',
	'K',
	'0'
};

unsigned char R_SCSIPID_Disk1[]=			// Should be 16 bytes
{
	'S',
	'P',
	'C',
	'E',
	'3',
	'2',
	'0',
	'0',
	' ',
	'U',
	'S',
	'B',
	' ',
	'D',
	'I',
	'S',
	'K',
	'1'
};

unsigned char R_SCSIProductRevisionLevel[]=	// Should be 4 bytes
{
	'1',
	'.',
	'0',
	'0'
};

⌨️ 快捷键说明

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