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

📄 chp9.c

📁 DSP+MP3+USB+FAT12的所有源程序(C语言编写)
💻 C
字号:



#include "general.h"

//---- Descriptor Content -------------
//standard Device Descriptor

UWord16 USB_Device_Descriptor[18] =
{
        //-------------------------------------------------------------------
        //TotalLength = 0x0012 bytes
        //-------------------------------------------------------------------

        //Device (0x12 bytes)
        0x12,                   //bLength: 0x12 bytes
        0x01,                   //bDescriptorType: DEVICE
        0x10, 0x01,             //bcdUSB: version 1.10
        0x00,                   //bDeviceClass: independent interfaces
        0x00,                   //bDeviceSubClass: 0
        0x00,                   //bDeviceProtocol: class specific protocols NOT used on device basis
        0x40,                   //bMaxPacketSize0: maximum packet size for endpoint zero
        0x71, 0x04,             //idVendor: vendor ID
        0x50, 0x01,             //idProduct: product ID //900515But org=503
        0x00, 0x01,             //bcdDevice: device release number in BCD
        0x00,                   //iManufacturer: index of string
        0x00,                   //iProduct: index of string
        0x00,                   //iSerialNumber: index of string
        0x01,                   //bNumConfigurations: 1 configuration
};

//*******************************************************************
//配置描述符
 UWord16 USB_CONFIGURATION_DESCRIPTOR [] =
 {
        0x09,
        0x02,
        0x2e, 00,//
	    0x01,
	    0x01,
        0x00,
	    0xc0,
	    0x01,
//};

//接口描述符
//UCHAR USB_INTERFACE_DESCRIPTOR [9] =
//{
    //Interface 0, AlternateSetting 0 (0x09 bytes)
        0x09,                   //bLength: 0x09 bytes
        0x04,                   //bDescriptorType: INTERFACE
        0x00,                   //bInterfaceNumber: interface 0
        0x00,                   //bAlternateSetting: alternate setting 0
        0x03,                   //bNumEndpoints: 4 endpoint
        0xFF,                   //bInterfaceClass: vendor specific interface
        0x00,                   //bInterfaceSubClass: 0
        0x00,                   //bInterfaceProtocol: class specific protocol NOT used on this interface
        0x00,                   //iInterface: index of string

//};

//端点描述符
//UCHAR USB_ENDPOINT_DESCRIPTOR_EP1_TXDescr [7] =
//{
	//Endpoint 1 (0x07 bytes)
        0x07,                   //bLength: 0x07 bytes
        0x05,                   //bDescriptorType: ENDPOINT
        0x81,                   //bEndpointAddress: IN endpoint 1
        0x01,                   //bmAttributes: Isochronous
        0x10, 0x00,             //wMaxPacketSize: 0 bytes
        0x01,                   //bInterval: polling interval is 1 ms
//};


//UCHAR USB_ENDPOINT_DESCRIPTOR_EP1_RXDescr [7] =
//{
	//Endpoint 1 (0x07 bytes)
        0x07,                   //bLength: 0x07 bytes
        0x05,                   //bDescriptorType: ENDPOINT
        0x01,                   //bEndpointAddress: out endpoint 1
        0x01,                   //bmAttributes: Isochronous
        0x10, 0x00,             //wMaxPacketSize: 0 bytes
        0x01,        
//};

//UCHAR USB_ENDPOINT_DESCRIPTOR_EP2_TXDescr [7] =
//{
	//Endpoint 2 (0x07 bytes)
        0x07,                   //bLength: 0x07 bytes
        0x05,                   //bDescriptorType: ENDPOINT
        0x82,                   //bEndpointAddress: IN endpoint 2
        0x02,                   //bmAttributes: Bulk
        0x40, 0x00,             //wMaxPacketSize: 64 bytes
        0x00,                   //bInterval: ignored
//};

//UCHAR USB_ENDPOINT_DESCRIPTOR_EP2_RXDescr [7] =
//{
	//Endpoint 2 (0x07 bytes)
        0x07,                   //bLength: 0x07 bytes
        0x05,                   //bDescriptorType: ENDPOINT
	    0x02,                   //bEndpointAddress: out endpoint 2
	    0x02,                   //bmAttributes: Bulk
        0x40, 0x00,             //wMaxPacketSize: 64 bytes
	    0x10,
 };
 
#if(MSDC_OPTION == 1)

UWord16 MSDC_Device_Descriptor[18] =
{
        //-------------------------------------------------------------------
        //TotalLength = 0x0012 bytes
        //-------------------------------------------------------------------

        //Device (0x12 bytes)
        0x12,                   //bLength: 0x12 bytes
        0x01,                   //bDescriptorType: DEVICE
        0x10, 0x01,             //bcdUSB: version 1.10
        0x00,                   //bDeviceClass: independent interfaces
        0x00,                   //bDeviceSubClass: 0
        0x00,                   //bDeviceProtocol: class specific protocols NOT used on device basis
        0x40,                   //bMaxPacketSize0: maximum packet size for endpoint zero
        0x71, 0x04,             //idVendor: vendor ID
        0x50, 0x01,             //idProduct: product ID //900515But org=503
        0x00, 0x01,             //bcdDevice: device release number in BCD
        0x00,                   //iManufacturer: index of string
        0x00,                   //iProduct: index of string
        0x00,                   //iSerialNumber: index of string
        0x01,                   //bNumConfigurations: 1 configuration
};

//*******************************************************************
//配置描述符
 UWord16 MSDC_CONFIGURATION_DESCRIPTOR [] =
 {
        0x09,
        0x02,
        0x27, 00,//
	    0x01,
	    0x01,
        0x00,
	    0x80,
	    0x32,
//};

//接口描述符
//UCHAR USB_INTERFACE_DESCRIPTOR [9] =
//{
    //Interface 0, AlternateSetting 0 (0x09 bytes)
        0x09,                   //bLength: 0x09 bytes
        0x04,                   //bDescriptorType: INTERFACE
        0x00,                   //bInterfaceNumber: interface 0
        0x00,                   //bAlternateSetting: alternate setting 0
        0x03,                   //bNumEndpoints: 4 endpoint
        0x08,                   //bInterfaceClass: Mass Storage Devices Class
        0x06,                   //bInterfaceSubClass: 0
        0x50,                   //bInterfaceProtocol: class specific protocol NOT used on this interface
        0x00,                   //iInterface: index of string

//};

//端点描述符
//UCHAR USB_ENDPOINT_DESCRIPTOR_EP1_TXDescr [7] =
//{
	//Endpoint 2 (0x07 bytes)
        0x07,                   //bLength: 0x07 bytes
        0x05,                   //bDescriptorType: ENDPOINT
        0x81,                   //bEndpointAddress: IN endpoint 2
        0x03,                   //bmAttributes: Control
        0x10, 0x00,             //wMaxPacketSize: 16 bytes
        0x01,                   //bInterval: polling interval is 1 ms
//};


//UCHAR USB_ENDPOINT_DESCRIPTOR_EP1_RXDescr [7] =
//{
	//Endpoint 3 (0x07 bytes)
      /*  0x07,                   //bLength: 0x07 bytes
        0x05,                   //bDescriptorType: ENDPOINT
        0x03,                   //bEndpointAddress: out endpoint 3
        0x03,                   //bmAttributes: Interrupt
        0x10, 0x00,             //wMaxPacketSize: 0 bytes
        0x01,   */   
//};

//UCHAR USB_ENDPOINT_DESCRIPTOR_EP2_TXDescr [7] =
//{
	//Endpoint 4 (0x07 bytes)
        0x07,                   //bLength: 0x07 bytes
        0x05,                   //bDescriptorType: ENDPOINT
        0x82,                   //bEndpointAddress: IN endpoint 4
        0x02,                   //bmAttributes: Bulk
        0x40, 0x00,             //wMaxPacketSize: 64 bytes
        0x00,                   //bInterval: ignored
//};

//UCHAR USB_ENDPOINT_DESCRIPTOR_EP2_RXDescr [7] =
//{
	//Endpoint 5 (0x07 bytes)
        0x07,                   //bLength: 0x07 bytes
        0x05,                   //bDescriptorType: ENDPOINT
	    0x02,                   //bEndpointAddress: out endpoint 5
	    0x02,                   //bmAttributes: Bulk
        0x40, 0x00,             //wMaxPacketSize: 64 bytes
	    0x00,
 };
UWord16  Zero[]={0x00,0x00,};
#endif


⌨️ 快捷键说明

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