📄 descript.c
字号:
/**************** (c) 2000 STMicroelectronics **********************
PROJECT : USB - ST7 FULL SPEED
VERSION : v 0.96
CREATION DATE : 01/12/2000
AUTHOR : MICROCONTROLLER DIVISION / ST Rousset
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
MODIFICATIONS :
******************************************************************************/
#include "mcu_conf.h"
#include "usb_lib.h"
#include "appli.h"
#include "descript.h"
#pragma CONST_SEG USER_CONST
const char Appli_DeviceDescriptor0[SIZE_DEVICE_DESC] = {
SIZE_DEVICE_DESC, /* Size of this descriptor in bytes */
0x01, /* DEVICE descriptor type */
0x10,
0x01, /* bcdUSB version = 1.10 */
0x00, /* Class is specified in the interface descriptor */
0x00, /* Subclass is specified in the interface descriptor */
0x00, /* Protocol is specified in the interface descriptor */
MAX_PACKET_SIZE, /* Maximum packet size for default pipe = 16 for 7265, 8 for 72SCR */
0x83, 0x04, /* Vendor ID */
0x02, 0x13, // Product ID 0x1302
// 0x04, 0x13, // new product ID for Ekey+Udisk device
0x34,
0x01, /* bcdDevice = 1.34 */
0x0, /* iManufacturer */
0x2, /* iProduct */
0x0, /* iSerialNumber */
MAX_NUM_CONFIG /* Number of possible configuration = MAX_NUM_CONFIG */
};
const char Appli_DeviceDescriptor1[SIZE_DEVICE_DESC] = {
SIZE_DEVICE_DESC, /* Size of this descriptor in bytes */
0x01, /* DEVICE descriptor type */
0x10,
0x01, /* bcdUSB version = 1.10 */
0x00, /* Class is specified in the interface descriptor */
0x00, /* Subclass is specified in the interface descriptor */
0x00, /* Protocol is specified in the interface descriptor */
MAX_PACKET_SIZE, /* Maximum packet size for default pipe = 16 for 7265, 8 for 72SCR */
0x83, 0x04, /* Vendor ID */
0x02, 0x13, // Product ID 0x1302
// 0x04, 0x13, // new product ID for Ekey+Udisk device
0x32,
0x01, /* bcdDevice = 1.32 */
0x0, /* iManufacturer */
0x2, /* iProduct */
0x3, /* iSerialNumber */
MAX_NUM_CONFIG /* Number of possible configuration = MAX_NUM_CONFIG */
};
const char Appli_StringDescriptor[SIZE_STRING_DESCRIPTOR] = {
SIZE_STRING_DESCRIPTOR,
0x03,
0x09,
0x04 /* LangID = 0x0409: U.S. English */
};
const char Appli_StringVendor[SIZE_STRING_VENDOR] = {
SIZE_STRING_VENDOR,
0x03,
/* Manufacturer: "STMicroelectronics" */
'S',0, '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
};
const char Appli_StringProduct[SIZE_STRING_PRODUCT] = {
SIZE_STRING_PRODUCT,
0x03,
/* Product name: */
'U',0, 'S',0, 'B',0, ' ',0, 'M',0, 'a',0, 's',0, 's',0,
' ',0, 'S',0, 't',0, 'o',0, 'r',0, 'a',0, 'g',0, 'e',0,
' ',0, 'd',0, 'e',0, 'v',0, 'i',0, 'c',0, 'e',0
};
/* Serial number is the must for the BOT device */
/* There must be at least 12 digits */
/* Each digit must be 0-9 or A-F */
const char Appli_StringSerial[SIZE_STRING_SERIAL] = {
SIZE_STRING_SERIAL,
0x03,
'M',0, 'a',0, 's',0, 's',0, ' ',0, 'S',0, 't',0, 'o',0,
'r',0, 'a',0, 'g',0, 'e',0, ' ',0, '-',0, ' ',0, '7',0
};
const char Appli_StringInterface[SIZE_STRING_INTERFACE] = {
SIZE_STRING_INTERFACE,
0x03,
'P',0, 'F',0, 'D',0, 'P',0, ' ',0, 'P',0, 'F',0, 'D',0, 'S',0
};
const char Appli_ReportDescriptor[94] = {
0x06, 0x13, 0xff, // vendor defined usage page
0x09, 0x05, // any usage
0xa1, 0x01, // collection
0x19, 0x00, // usage_manimun
0x29, 0xff, // usage_maximum
0x75, 0x08, // report size
0x85, 0x01, // report ID
0x95, 0x0f, // One byte length + 5 bytes CMD
0x09, 0x01, // usage
0x91, 0x02, // The data from the card
0x85, 0x02, // report ID
0x95, 0x1f, // One byte length + 5 bytes CMD
0x09, 0x01, // usage
0x91, 0x02, // The data from the card
0x85, 0x03, // report ID
0x95, 0x2f, // One byte length + 5 bytes CMD
0x09, 0x01, // usage
0x91, 0x02,
0x85, 0x04, // report ID
0x95, 0x3f, // One byte length + 5 bytes CMD
0x09, 0x01, // usage
0x91, 0x02, // The data from the card, // The data from the card
0x85, 0x05, // report ID
0x95, 0x4f, // One byte length + 5 bytes CMD
0x09, 0x01, // usage
0x91, 0x02, // The data from the card
0x85, 0x06, // report ID
0x95, 0x5f, // One byte length + 5 bytes CMD
0x09, 0x01, // usage
0x91, 0x02, // The data from the card
0x85, 0x07, // report ID
0x95, 0x6f, // One byte length + 5 bytes CMD
0x09, 0x01, // usage
0x91, 0x02, // The data from the card
0x85, 0x08, // report ID
0x95, 0x7f, // One byte length + 6 bytes CMD + 15 bytes data
0x09, 0x01, // usage
0x91, 0x02, // The data from the card
0x85, 0x09, // report ID
0x95, 0x8f, // One byte length + 6 bytes CMD + 128 bytes
0x09, 0x01, // usage
0x91, 0x02, //The command from PC
0x85, 0x01, // report ID
0x95, 0x84, // 84 bytes for data response
0x09, 0x02, // usage
0xb1, 0x02, // feature report
0xc0 // end_collection
};
const char Appli_ConfigDescriptor[SIZE_CONFIG_DESC] = {
/*-------------------------- Configuation Descriptor ------------------------*/
0x09, /* bLength: Configuation Descriptor size */
0x02, /* bDescriptorType: Configuration */
/*********************** wTotalLength: 25 Bytess **********************/
SIZE_CONFIG_DESC, /* wTotalLength: 32 Bytes returned */
0x00,
/*********************** 2 interface **********************/
MAX_NUM_INTERFACE, /* bNumInterfaces */
/***********************************************************/
0x01, /* bConfigurationValue: Configuration value */
0x00, /* iConfiguration: Index of the configuration string descriptor */
0x80, /* bmAttributes: bus powered */
0x32, /* MaxPower 100 mA */
/*------------------- Bulk Only Data Interface Descriptor -------------------*/
0x09, /* bLength: Interface Descriptor size */
0x04, /* bDescriptorType: Interface descriptor type */
0x00, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x02, /* bNumEndpoints: Two endpoints used */
0x08, /* bInterfaceClass: MASS STORAGE CLASS */
0x06, /* bInterfaceSubClass: No subclass */
0x50, /* bInterfaceProtocol: Bulk Only Transport */
0x04, /* iInterface: Index of string descriptor */
/*------------------------ BULK IN Endpoint Descriptor ----------------------*/
0x07, /* bLength: Endpoint Descriptor size */
0x05, /* bDescriptorType: Endpoint descriptor type */
0x82, /* bEndpointAddress: Endpoint Address (IN) */
0x02, /* bmAttributes: Bulk endpoint */
MAX_EP2_PACKET_SIZE, /* wMaxPacketSize: Bulk endpoint maximum packet size is 64 bytes */
0x00,
0x00, /* bInterval: ignore for Bulk transfer */
/*----------------------- BULK OUT Endpoint Descriptor ----------------------*/
0x07, /* bLength: Endpoint Descriptor size */
0x05, /* bDescriptorType: Endpoint descriptor type */
0x02, /* bEndpointAddress: Endpoint Address (OUT) */
0x02, /* bmAttributes: Bulk endpoint */
MAX_EP2_PACKET_SIZE, /* wMaxPacketSize: Bulk endpoint maximum packet size is 64 bytes */
0x00,
0x00, /* bInterval: ignore for Bulk transfer */
/*--------------------------HID Interface Descriptor------------------------------------*/
0x09, //Descriptor size
0x04, // Interface descriptor type
0x01, // Interface Number
0x00, // Alternate Setting
0x00, // 0 endpoint used
0x03, // HID interface
0x00, // No subclass
0x00, // No protocol
0x00, // index of string descriptor
/*------------------- HID descriptor---------------------------------------------------*/
0x09, // Descriptor size
0x21, // HID Descriptor Type:
0x10, // Specification release number
0x01,
0x00, // Hardware target country US
0x01, // Number of HID class descriptors to follow
0x22, // Report descriptor type
sizeof(Appli_ReportDescriptor), // Report desciptor length low byte
0x00,
};
/**************** (c) 2000 STMicroelectronics **********************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -