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

📄 upsd3400_usb_desc.h

📁 upsd34xx系列单片机keil环境中的开发例程
💻 H
字号:
/*------------------------------------------------------------------------------
upsd3400_usb_desc.h

Version:
March 22, 2005 - Version 1.0 - Initial Release.

Description:  USB descriptors for Flash Disk.


Copyright (c) 2005 STMicroelectronics Inc.

This example demo code is provided as is and has no warranty,
implied or otherwise.  You are free to use/modify any of the provided
code at your own risk in your applications with the expressed limitation
of liability (see below) so long as your product using the code contains
at least one uPSD product (device).

LIMITATION OF LIABILITY:   NEITHER STMicroelectronics NOR ITS VENDORS OR 
AGENTS SHALL BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA,
INTERRUPTION OF BUSINESS, NOR FOR INDIRECT, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER THIS AGREEMENT OR
OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
------------------------------------------------------------------------------*/

const uchar code string1Desc[];
const uchar code string2Desc[];
const uchar code string3Desc[];
const uchar code stringXDesc[];


#define EP_ATTR_CONTROL     (0x0)
#define EP_ATTR_ISOCHRONOUS (0x1)
#define EP_ATTR_BULK        (0x2)
#define EP_ATTR_INTERRUPT   (0x3)


#define EnRemoteWakeup  (0x20)
#define DisRemoteWakeup (0x00)


const device_descriptor code deviceDesc =
 {
  sizeof(device_descriptor),                 // Size of this Descriptor in Bytes
  DT_DEVICE,                                 // Descriptor Type (=1)
   {
    0x00, 0x02                // USB Spec Release Number in BCD = 2.00 = 0x00,0x02
   }
  ,
  0,                                         // Device Class Code (none)
  0,                                         // Device Subclass Code (none)
  0,                                         // Device Protocol Code (none)
  EP0_PKT_SIZE,                              // Maximum Packet Size for EP0
   {
    0x83, 0x04   }
  ,                                          // Vendor ID
   {
    0x20, 0x34   }
  ,                                          // Product ID
   {
    0x00, 0x01   }
  ,                                          // Device Release Number in BCD
  1,                                      // Index of String Desc for Manufacturer
  2,                                         // Index of String Desc for Product
  3,                                         // Index of String Desc for SerNo
  1                                          // Number of possible Configurations
 }
  ;



const uchar code configDesc[] =
 {
  9,                                         // Configuration descriptor length
  2,                                         // Descriptor type (configuration)
  32, 0,                                     // Total length of this descriptor
  1,                                         // Number of interfaces
  1,                                   // Configuration value (OnSetConfiguration)
  0,                                         // Index of string descriptor (none)
  0x80,
// |EnRemoteWakeup,                          // USB powered, no remote wakeup
  75,
// 150 mA max power consumption including user application (50mA max for uPSD), 2mA steps


                           /*===== Interface =====*/
  9,                                         // Descriptor length
  4,                                         // Descriptor type (interface)
  0,                                         // Number of interface
  0,                                         // Alternate setting
  2,                                         // Number of endpoints (except EP0)

  0x08,                                      // Class code - Mass Storage Class
  0x06,                                      // Subclass - SCSI Type
  0x50,                                      // Protocol - Bulk Only
  0,                                         // Index of string descriptor (none)


                      /*===== Endpoint descriptor =====*/
/* EP1 */
  7,                                         // Descriptor length (7 bytes)
  5,                                         // Descriptor type (endpoint)
  0x81,                                      // Address (IN1)
  EP_ATTR_BULK,                              // Attributes
  EP1_PKT_SIZE, 0,                           // Maximum packet size
  0,                                         // Polling interval not used

/* EP3 */
  7,                                         // Descriptor length (7 bytes)
  5,                                         // Descriptor type (endpoint)
  0x03,                                      // Address (OUT3)
  EP_ATTR_BULK,                              // Attributes
  EP3_PKT_SIZE, 0,                           // Maximum packet size
  0                                          // Polling interval not used
 }
  ;


// Language IDs
const uchar code string0Desc[] =
 {
  0x04, DT_STRING ,                          // Size, Type
  0x09, 0x04                                 // LangID Codes
 }
  ;


// Manufacturer String
#define SD1LEN sizeof("STMicroelectronics")*2
const uchar code string1Desc[] =
 {
  SD1LEN, DT_STRING ,                        // Size, Type
  'S', 0,                                    // Unicode String
  'T', 0,
  'M', 0,
  'i', 0,
  'c', 0,
  'r', 0,
  'o', 0,
  'e', 0,
  'l', 0,
  'e', 0,
  'c', 0,
  't', 0,
  'r', 0,
  'o', 0,
  'n', 0,
  'i', 0,
  'c', 0,
  's', 0
 }
  ;

// Product String
#define SD2LEN sizeof("uPSD34xx - USB Reference Design")*2
const uchar code string2Desc[] =
 {
  SD2LEN, DT_STRING ,                        // Size, Type
  'u', 0,                                    // Unicode String
  'P', 0,
  'S', 0,
  'D', 0,
  '3', 0,
  '4', 0,                                    // Unicode String
  'x', 0,
  'x', 0,
  ' ', 0,
  '-', 0,
  ' ', 0,
  'U', 0,
  'S', 0,
  'B', 0,
  ' ', 0,
  'R', 0,
  'e', 0,
  'f', 0,
  'e', 0,
  'r', 0,
  'e', 0,
  'n', 0,
  'c', 0,
  'e', 0,
  ' ', 0,
  'D', 0,
  'e', 0,
  's', 0,
  'i', 0,
  'g', 0,
  'n', 0
 }
  ;

// Serial Number String
#define SD3LEN sizeof("Version 1.0")*2
const uchar code string3Desc[] =
 {
  SD3LEN, DT_STRING ,                        // Size, Type
  'V', 0,                                    // Unicode String
  'e', 0,
  'r', 0,
  's', 0,
  'i', 0,
  'o', 0,
  'n', 0,
  ' ', 0,
  '1', 0,
  '.', 0,
  '0', 0
 }
  ;


const uchar code stringXDesc[2] =
 {
  0, 0,                                      // Size, Type
 }
  ;


// Table of String Descriptors
const uchar * const code stringDescTable[] =
 {
  string0Desc,
  string1Desc,
  string2Desc,
  string3Desc,
  stringXDesc                                //no string
 }
  ;



/* *************************************************************************
  ***                                                                      ***
  **                         *** End of File ***                            **
  ***                                                                      ***
   *************************************************************************  */

⌨️ 快捷键说明

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