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

📄 upsd3400_usb_desc.h

📁 U-disk reference design
💻 H
字号:
/*------------------------------------------------------------------------------
upsd3400_usb_desc.h

Version:
September 13, 2005 - Version 1.1 - Updated disclaimer, renamed file.
March 22, 2005 - Version 1.0 - Initial Release.

Description:  USB descriptors for Flash Disk.

Copyright (c) 2005 STMicroelectronics Inc.

THIS INFORMATION (or THIS SOFTWARE or THIS DOCUMENT) IS FOR GUIDANCE ONLY. ST 
MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS 
SOFTWARE nor for any infringement of patents or other rights of third parties 
which may result from its use. ST MICROELECTRONICS SHALL NOT BE HELD LIABLE FOR 
ANY DIRECT, INDIRECT INCIDENTAL OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY 
CLAIMS ARISING IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, 
OR USE OF THIS SOFTWARE. Specifications mentioned in this publication are 
subject to change without notice. This publication supersedes and replaces all 
information previously supplied. STMicroelectronics products are not authorized 
for use as critical components in life support devices or systems without the 
express written approval of STMicroelectronics.
------------------------------------------------------------------------------*/

#ifndef UPSD3400_USB_DESC_H
#define UPSD3400_USB_DESC_H

#include "upsd3400_hardware.h"
#include "upsd3400_usb.h"

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
   {
    0x00, 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)
  BM_ATTRIBUTES,							 // Bus powered or self powered
// |EnRemoteWakeup,                          // USB powered, no remote wakeup
  MAX_POWER,		                             // max power consumption, 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)
  0x01,                                      // 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, Inc.")*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,
  ',', 0,
  ' ', 0,
  'I', 0,
  'n', 0,
  'c', 0,
  '.', 0
 }
  ;

#ifdef DK3400
// Product String
#define SD2LEN sizeof("DK3400 - Flash Disc Demo")*2
const uchar code string2Desc[] =
 {
  SD2LEN, DT_STRING ,                        // Size, Type
  'D', 0,                                    // Unicode String
  'K', 0,
  '3', 0,
  '4', 0,
  '0', 0,
  '0', 0,                                    // Unicode String
  ' ', 0,
  '-', 0,
  ' ', 0,
  'F', 0,
  'l', 0,
  'a', 0,
  's', 0,
  'h', 0,
  ' ', 0,
  'D', 0,
  'i', 0,
  's', 0,
  'c', 0,
  ' ', 0,
  'D', 0,
  'e', 0,
  'm', 0,
  'o', 0
 }
  ;
#else //(DK3420)
// Product String
#define SD2LEN sizeof("DK3420 - Flash Disc Demo")*2
const uchar code string2Desc[] =
 {
  SD2LEN, DT_STRING ,                        // Size, Type
  'D', 0,                                    // Unicode String
  'K', 0,
  '3', 0,
  '4', 0,
  '2', 0,
  '0', 0,                                    // Unicode String
  ' ', 0,
  '-', 0,
  ' ', 0,
  'F', 0,
  'l', 0,
  'a', 0,
  's', 0,
  'h', 0,
  ' ', 0,
  'D', 0,
  'i', 0,
  's', 0,
  'c', 0,
  ' ', 0,
  'D', 0,
  'e', 0,
  'm', 0,
  'o', 0
 }
  ;
#endif


// Serial Number String
#define SD3LEN sizeof("SN 09132005-01")*2
const uchar code string3Desc[] =
 {
  SD3LEN, DT_STRING ,                        // Size, Type
  'S', 0,                                    // Unicode String
  'N', 0,
  ' ', 0,
  '0', 0,
  '9', 0,
  '1', 0,
  '3', 0,
  '2', 0,
  '0', 0,
  '0', 0,
  '5', 0,
  '-', 0,
  '0', 0,
  '1', 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
 }
  ;

#endif

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

⌨️ 快捷键说明

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