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

📄 dscr.h

📁 SdCard_V2.1TinyFatFs.rar是单片机实现SD卡功能的FAT文件系统
💻 H
字号:
/*
*********************************************************************************************************
* File:     Dscr.H
* Contents: This file contains descriptor data tables
*
* $Date:    04/06/06    Kimi    v0.1
*
* Copyright (c) 2006 Fameg, Inc. All rights reserved
*********************************************************************************************************
*/

#ifndef _DSCR_H_
#define _DSCR_H_

/*
*********************************************************************************************************
*                                          GLOBAL VARIABLES
*********************************************************************************************************
*/
#define DSCR_DEVICE                         1          // Descriptor type: Device
#define DSCR_CONFIGURATION                  2          // Descriptor type: Configuration
#define DSCR_STRING                         3          // Descriptor type: String
#define DSCR_INTERFACE                      4          // Descriptor type: Interface
#define DSCR_ENDPOINT                       5          // Descriptor type: Endpoint
#define DSCR_DEVICE_QUALIFIER               6          // Descriptor type: Device Qualifier
#define DSCR_OTHER_SPEED_CONFIGURATION      7          // Descriptor type: Other Speed Configuration
#define DSCR_INTERFACE_POWER                8          // Descriptor type: Interface Power

#define ET_CONTROL                          0          // Endpoint type: Control
#define ET_ISO                              1          // Endpoint type: Isochronous
#define ET_BULK                             2          // Endpoint type: Bulk
#define ET_INT                              3          // Endpoint type: Interrupt

#define VendorIDL                           0x21       // Vendor ID
#define VendorIDH                           0x51
#define ProductIDL                          0x20       // Product ID
#define ProductIDH                          0x40


/*
*********************************************************************************************************
*                                  DESCRIPTOR DEFINITION
*********************************************************************************************************
*/
xdata BYTE DeviceDscr[DSCR_DEVICE_LEN] =
        {
        DSCR_DEVICE_LEN,                               // Descriptor length
        DSCR_DEVICE,                                   // Descriptor type
        0x00, 0x02,                                    // Specification Version (BCD)
        0x00,                                          // Device class
        0x00,                                          // Device sub-class
        0x00,                                          // Device sub-sub-class
        0x40,                                          // Maximum packet size
        VendorIDL, VendorIDH,                          // Vendor ID
        ProductIDL, ProductIDH,                        // Product ID (Sample Device)
        0x00, 0x00,                                    // Product version ID
        0x01,                                          // Manufacturer string index
        0x02,                                          // Product string index
        0x03,                                          // Serial number string index
        0x01                                           // Number of configurations
        };

xdata BYTE DeviceQualDscr[DSCR_DEVICE_QUALIFIER_LEN] =
        {
        DSCR_DEVICE_QUALIFIER_LEN,                     // Descriptor length
        DSCR_DEVICE_QUALIFIER,                         // Decriptor type
        0x00, 0x02,                                    // Specification Version (BCD)
        0x08,          									// MASS STORAGE Class
        0x06,          									// SCSI transparent command set
        0x50,          									// BULK-ONLY TRANSPORT
        0x40,                                          // Maximum packet size
        0x01,                                          // Number of configurations
        0x00                                           // Reserved
        };

xdata BYTE HighSpeedConfigDscr[DSCR_CONFIGURATION_TOTALLEN] =
        {
        DSCR_CONFIGURATION_LEN,                        // Descriptor length
        DSCR_CONFIGURATION,                            // Descriptor type
        DSCR_CONFIGURATION_TOTALLEN,                   // Total Length (LSB)
        0x00,                                          // Total Length (MSB)
        0x01,                                          // Number of interfaces
        0x01,                                          // Configuration number
        0x00,                                          // Configuration string
        0x80,                                          // Attributes (b7 - buspwr, b6 - selfpwr, b5 - rwu)
        50,                                            // Power requirement (div 2 ma)

// Interface Descriptor
        DSCR_INTERFACE_LEN,                            // Descriptor length
        DSCR_INTERFACE,                                // Descriptor type
        0x00,                                          // Zero-based index of this interface
        0x00,                                          // Alternate setting
        0x02,                                          // Number of end points
        0x08,                                          // MASS STORAGE Class
        0x06,          									// SCSI transparent command set
        0x50,          									// BULK-ONLY TRANSPORT
        0x00,                                          // Interface descriptor string index

// Endpoint1 Descriptor
        DSCR_ENDPOINT_LEN,                             // Descriptor length
        DSCR_ENDPOINT,                                 // Descriptor type                            
        0x01,				 						  // Endpoint number1, and direction OUT
		ET_BULK,
        0x00,                                          // Maximun packet size (LSB) 512byte
        0x02,                                          // Max packect size (MSB)
        0x00,                                          // Polling interval

// Endpoint2 Descriptor
        DSCR_ENDPOINT_LEN,                             // Descriptor length
        DSCR_ENDPOINT,                                 // Descriptor type
        0x82,										  // Endpoint number2, and direction IN
		ET_BULK,
        0x00,                                          // Maximun packet size (LSB) 512byte
        0x02,                                          // Max packect size (MSB)
        0x00                                           // Polling interval
        };

xdata BYTE FullSpeedConfigDscr[DSCR_CONFIGURATION_TOTALLEN] =
        {
        DSCR_CONFIGURATION_LEN,                        // Descriptor length
        DSCR_CONFIGURATION,                            // Descriptor type
        DSCR_CONFIGURATION_TOTALLEN,                   // Total Length (LSB)
        0x00,                                          // Total Length (MSB)
        0x01,                                          // Number of interfaces
        0x01,                                          // Configuration number
        0x00,                                          // Configuration string
        0x80,                                          // Attributes (b7 - buspwr, b6 - selfpwr, b5 - rwu)
        50,                                            // Power requirement (div 2 ma)

// Interface Descriptor
        DSCR_INTERFACE_LEN,                            // Descriptor length
        DSCR_INTERFACE,                                // Descriptor type
        0x00,                                          // Zero-based index of this interface
        0x00,                                          // Alternate setting
        0x02,                                          // Number of end points
        0x08,                                          // MASS STORAGE Class
        0x06,          									// SCSI transparent command set
        0x50,          									// BULK-ONLY TRANSPORT
        0x00,                                          // Interface descriptor string index

// Endpoint1 Descriptor
        DSCR_ENDPOINT_LEN,                             // Descriptor length
        DSCR_ENDPOINT,                                 // Descriptor type                              
        0x01,										   // Endpoint number1, and direction OUT
		ET_BULK,
        0x40,                                          // Maximun packet size (LSB) 64byte
        0x00,                                          // Max packect size (MSB)
        0x00,                                          // Polling interval

// Endpoint2 Descriptor
        DSCR_ENDPOINT_LEN,                             // Descriptor length
        DSCR_ENDPOINT,                                 // Descriptor type
        0x82,                                         // Endpoint number2, and direction IN
        ET_BULK,
        0x40,                                          // Maximun packet size (LSB) 64byte
        0x00,                                          // Max packect size (MSB)
        0x00                                           // Polling interval
        };

xdata BYTE StringDscr0[DSCR_STRING0_LEN] =	  //Serial string
        {
        DSCR_STRING0_LEN,                              // Descriptor length
        DSCR_STRING,                                   // Decriptor type
        0x09,
        0x04                                           // Specification Version (BCD)
        };

xdata BYTE StringDscr1[DSCR_STRING1_LEN] =	 //Manufacture string
        {
        DSCR_STRING1_LEN,
        DSCR_STRING,
        'F', 00,
        'a', 00,
        'm', 00,
        'e', 00,
        'G', 00
        };

xdata BYTE StringDscr2[DSCR_STRING2_LEN] =	//Product string
        {
        DSCR_STRING2_LEN,
        DSCR_STRING,
        'T', 00,
        '5', 00,
        ' ', 00,
        'U', 00,
        'S', 00,
        'B', 00,
        '-', 00,
        'D', 00,
        'e', 00,
        'v', 00,
        'i', 00,
        'c', 00,
        'e', 00
        };
xdata BYTE StringDscr3[DSCR_STRING3_LEN] =	 //Serial number string
       { 0x16, 								 //Derek 06.11.14
         0x03, 
         '0', 0x00, 
         '0', 0x00, 
         '0', 0x00, 
         '0', 0x00, 
         '0', 0x00,
         '0', 0x00, 
         '0', 0x00, 
         '0', 0x00, 
         '0', 0x00, 
         '1', 0x00 };
#endif

⌨️ 快捷键说明

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