?? descriptor.c
字號:
/****************************************Copyright (c)**************************************************
** Guangzou ZLG-MCU Development Co.,LTD.
** graduate school
** http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name: Descriptor.c
** Last modified Date: 2005-8-6
** Last Version: V1.0
** Descriptions: USB 設備描述符
** USB device descriptor
**------------------------------------------------------------------------------------------------------
** Created by: 鄭明遠 MingYuan Zheng
** Created date: 2005-8-6
** Version: V1.0
** Descriptions: 初始版本 The original version
**
**------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
**
**------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
**
********************************************************************************************************/
#include "config.h"
#include "USBConfig.h"
#include "Descriptor.h"
/* device descriptor: test device type */
#define USB_CLASS_CODE_TEST_CLASS_DEVICE 0xdc /* 設備描述符: 測試設備類型 */
/* interface descriptor: subclass code */
#define USB_SUBCLASS_CODE_TEST_CLASS_D12 0xA0 /* 接口描述符: 子類代碼 */
/* interface descriptor: protocol code */
#define USB_PROTOCOL_CODE_TEST_CLASS_D12 0xB0 /* 接口描述符: 協議代碼 */
/* device descriptor */
const USB_DEVICE_DESCRIPTOR DeviceDescr =
{
sizeof(USB_DEVICE_DESCRIPTOR), // 設備描述符長度,= 12H device descriptor length = 12H
USB_DEVICE_DESCRIPTOR_TYPE, // 設備描述符類型,= 01H device descriptor type = 01H
0x00,0x01, // 協議版本,= 1.10 protocol version = 1.10
USB_CLASS_CODE_TEST_CLASS_DEVICE, // 測試設備類型, = 0DCH Class code = 0DCH
0, 0, // 設備子類,設備協議 Subclass code, Protocol code
EP0_PACKET_SIZE, // 端點0最大數據包大小,= 40H Maximum packet size for endpoint 0, = 40H
0x71,0x04, // PHILIPS公司的設備ID Vendor ID = PHILIPS Semiconductor,Inc.
0x99,0x09, // 設備制造商定的產品ID Product ID
0x00,0x01, // 設備系列號 Device release number in binary-coded decimal
0, 0, 0, // 索引 Index
1 // 可能的配置數 Number of possible configurations
};
const USB_DESCRIPTOR usb_descr =
{
//configuration descriptor // 配置描述符
{
sizeof(USB_CONFIGURATION_DESCRIPTOR), // 配置描述符長度,= 09H Size of this descriptor in bytes = 09H
USB_CONFIGURATION_DESCRIPTOR_TYPE, // 配置描述符類型,= 02H configuration descriptor type = 02H
CONFIG_DESCRIPTOR_LENGTH,0x00, // 描述符總長度, = 002EH Total length of data returned for this configuration, = 002EH
1, // 只支持1個接口 only support a interface
1, // 配置值 configuration value
0, // 字符串描述符指針(無) Index of string descriptor describing this configuration(no)
0x60, // 自供電,支持遠程喚醒 Configuration characteristics: support Self-powered, Remote Wakeup
0x32 // 最大功耗(100mA) Maximum power consumption(100mA)
},
//interface descriptor // 接口描述符
{
sizeof(USB_INTERFACE_DESCRIPTOR), // 接口描述符長度,= 09H Size of this descriptor in bytes = 09H
USB_INTERFACE_DESCRIPTOR_TYPE, // 接口描述符類型,= 04H interface descriptor type = 04H
0, // 接口數,只有1個 Number of this interface, only one
0, // 可選配置,只有1個 optional configuration, only one
NUM_ENDPOINTS, // 除端點0的端點索引數目,=04H Number of endpoints used by this interface (excluding endpoint zero) = 04H
USB_CLASS_CODE_TEST_CLASS_DEVICE, // 測試設備類型,= 0DCH Class code = 0DCH
USB_SUBCLASS_CODE_TEST_CLASS_D12, // 子類代碼,= 0A0H Subclass code = 0A0H
USB_PROTOCOL_CODE_TEST_CLASS_D12, // 協議代碼,= 0B0H Protocol code = 0B0H
0 // 字符串描述符索引 Index of string descriptor describing this interface
},
//endpoint descriptor, logic endpoint 1 IN // 邏輯端點 1 輸入
{
sizeof(USB_ENDPOINT_DESCRIPTOR), // 端點描述符長度,= 07H endpoint descriptor length = 07H
USB_ENDPOINT_DESCRIPTOR_TYPE, // 端點描述符類型,= 05H endpoint descriptor type = 05H
0x81, // 端點1 IN endpoint 1 IN
USB_ENDPOINT_TYPE_INTERRUPT, // 中斷傳輸, = 03H interrupt transfer = 03H
EP1_PACKET_SIZE,0x00, // 端點最大包的大小,= 0010H endpoint max packet size = 0010H
1 // 傳輸間隔時間,= 10ms Interval for polling endpoint for data transfers = 1ms
},
//endpoint descriptor, logic endpoint 1 OUT // 邏輯端點 1 輸出
{
sizeof(USB_ENDPOINT_DESCRIPTOR), // 端點描述符長度,= 07H endpoint descriptor length = 07H
USB_ENDPOINT_DESCRIPTOR_TYPE, // 端點描述符類型,= 05H endpoint descriptor type = 05H
0x1, // 端點1 OUT endpoint 1 OUT
USB_ENDPOINT_TYPE_INTERRUPT, // 中斷傳輸,= 03H interrupt transfer = 03H
EP1_PACKET_SIZE,0x00, // 端點最大包的大小,= 0010H endpoint max packet size = 0010H
1 // 傳輸間隔時間,= 10ms Interval for polling endpoint for data transfers = 1ms
},
//endpoint descriptor, logic endpoint 2 IN // 邏輯端點 2 輸入
{
sizeof(USB_ENDPOINT_DESCRIPTOR), // 端點描述符長度,= 07H endpoint descriptor length = 07H
USB_ENDPOINT_DESCRIPTOR_TYPE, // 端點描述符類型,= 05H endpoint descriptor type = 05H
0x82, // 端點2 IN endpoint 2 IN
USB_ENDPOINT_TYPE_BULK, // 批量傳輸,= 02H bulk transfer = 02H
EP2_PACKET_SIZE,0x00, // 端點最大包的大小,= 0040H endpoint max packet size = 0040H
10 // 批量傳輸時該值無效 the value is invalid when bulk transfer
},
//endpoint descriptor, logic endpoint 2 OUT // 邏輯端點 2 輸出
{
sizeof(USB_ENDPOINT_DESCRIPTOR), // 端點描述符長度,= 07H endpoint descriptor length = 07H
USB_ENDPOINT_DESCRIPTOR_TYPE, // 端點描述符類型,= 05H endpoint descriptor type = 05H
0x2, // 端點2 OUT endpoint 2 OUT
USB_ENDPOINT_TYPE_BULK, // 批量傳輸,= 02H bulk transfer = 02H
EP2_PACKET_SIZE,0x00, // 端點最大包的大小,= 0040H endpoint max packet size = 0040H
10 // 批量傳輸時該值無效 the value is invalid when bulk transfer
}
};
/*******************************************************************************************************
** End Of File
********************************************************************************************************/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -