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

📄 usb_descriptor.c

📁 基于C8051单片机的USB Device driver
💻 C
字号:
/*
This file includes the Descriptor Declarations of the USB Device
*/

#include "USB_Descriptor.h"
#include "USB_Definition.h"

//---------------------------
// Descriptor Declarations
//---------------------------
const DEVICE_DESCRIPTOR gDevice_Desc =
{
   0x12,                // bLength
   0x01,                // bDescriptorType
   0x1001,              // bcdUSB (LITTLE ENDIAN)
   0x00,                // bDeviceClass
   0x00,                // bDeviceSubClass
   0x00,                // bDeviceProtocol
   EP0_PACKET_SIZE,     // bMaxPacketSize0
   0xC410,              // idVendor (LITTLE ENDIAN)
   0x0000,              // idProduct (LITTLE ENDIAN)
   0x0000,              // bcdDevice (LITTLE ENDIAN)
   0x00,                // iManufacturer
   0x00,                // iProduct
   0x00,                // iSerialNumber
   0x01                 // bNumConfigurations
}; //end of Device_Desc

const CONFIGURATION_DESCRIPTOR gConfig_Desc =
{
   0x09,                // Length
   0x02,                // Type
   0x2000,              // Totallength (LITTLE ENDIAN)
   0x01,                // NumInterfaces
   0x01,                // bConfigurationValue
   0x00,                // iConfiguration
   0x80,                // bmAttributes (no remote wakeup)
   0x0F                 // MaxPower (*2mA)
}; //end of Config_Desc

const INTERFACE_DESCRIPTOR gInterface_Desc =
{
   0x09,                // bLength
   0x04,                // bDescriptorType
   0x00,                // bInterfaceNumber
   0x00,                // bAlternateSetting
   0x02,                // bNumEndpoints
   0x08,                // bInterfaceClass // MASS STORAGE DEVICE
   0x06,                // bInterfaceSubClass // SCSI Transparent command set
   0x50,                // bInterfaceProcotol // Bulk-Only transport
   0x00                 // iInterface
}; //end of Interface_Desc

const ENDPOINT_DESCRIPTOR gEndpoint1_Desc =
{
   0x07,                // bLength
   0x05,                // bDescriptorType
   0x81,                // bEndpointAddress (ep1,IN)
   0x02,                // bmAttributes (This is Bulk endpoint)
   EP1_PACKET_SIZE,           // MaxPacketSize (LITTLE ENDIAN)
   0x00                 // bInterval
}; //end of Endpoint1_Desc

const ENDPOINT_DESCRIPTOR gEndpoint2_Desc =
{
   0x07,                // bLength
   0x05,                // bDescriptorType
   0x02,                // bEndpointAddress (ep2,OUT)
   0x02,                // bmAttributes (This is Bulk endpoint)
   EP2_PACKET_SIZE,           // MaxPacketSize (LITTLE ENDIAN)
   0x00                 // bInterval
}; //end of Endpoint2_Desc

⌨️ 快捷键说明

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