📄 usb_standard_desc.h
字号:
/** @file
* Definition of USB standard descriptors.
* @addtogroup usb_descriptors
* @{
*/
//-----------------------------------------------------------------------------
// F3xx_USB0_Descriptor.h
//-----------------------------------------------------------------------------
// Copyright 2005 Silicon Laboratories, Inc.
// http://www.silabs.com
//
// Program Description:
//
// Source file for USB firmware. Includes descriptor data.
//
//
// How To Test: See Readme.txt
//
//
// FID 3XX000011
// Target: C8051F32x/C8051F340
// Tool chain: Keil C51 7.50 / Keil EVAL C51
// Silicon Laboratories IDE version 2.6
// Command Line: See Readme.txt
// Project Name: F3xx_FirmwareTemplate
//
//
// Release 1.3
// - Changes by PD, GP
// - Modified Descriptors
// - Changed name from USB_Descriptor.c
// - 07 December 2005
// Release 1.0
// -Initial Revision (DM)
// -22 NOV 2002
//
#ifndef _USB_STANDARD_DESC_H_
#define _USB_STANDARD_DESC_H_
#include <stdint.h>
//------------------------------------------
// Standard Device Descriptor Type Defintion
//------------------------------------------
typedef /*code*/ struct
{
uint8_t bLength; // Size of this Descriptor in Bytes
uint8_t bDescriptorType; // Descriptor Type (=1)
WORD bcdUSB; // USB Spec Release Number in BCD
uint8_t bDeviceClass; // Device Class Code
uint8_t bDeviceSubClass; // Device Subclass Code
uint8_t bDeviceProtocol; // Device Protocol Code
uint8_t bMaxPacketSize0; // Maximum Packet Size for EP0
WORD idVendor; // Vendor ID
WORD idProduct; // Product ID
WORD bcdDevice; // Device Release Number in BCD
uint8_t iManufacturer; // Index of String Desc for Manufacturer
uint8_t iProduct; // Index of String Desc for Product
uint8_t iSerialNumber; // Index of String Desc for SerNo
uint8_t bNumConfigurations; // Number of possible Configurations
} device_desc; // End of Device Descriptor Type
//--------------------------------------------------
// Standard Configuration Descriptor Type Definition
//--------------------------------------------------
typedef /*code*/ struct
{
uint8_t bLength; // Size of this Descriptor in Bytes
uint8_t bDescriptorType; // Descriptor Type (=2)
WORD wTotalLength; // Total Length of Data for this Conf
uint8_t bNumInterfaces; // No of Interfaces supported by this conf
uint8_t bConfigurationValue; // Designator Value for *this* Configuration
uint8_t iConfiguration; // Index of String Desc for this Conf
uint8_t bmAttributes; // Configuration Characteristics (see below)
uint8_t bMaxPower; // Max. Power Consumption in thisConf (*2mA)
} configuration_desc; // End of Configuration Descriptor Type
//----------------------------------------------
// Standard Interface Descriptor Type Definition
//----------------------------------------------
typedef /*code*/ struct
{
uint8_t bLength; // Size of this Descriptor in Bytes
uint8_t bDescriptorType; // Descriptor Type (=4)
uint8_t bInterfaceNumber; // Number of *this* Interface (0..)
uint8_t bAlternateSetting; // Alternative for this Interface (if any)
uint8_t bNumEndpoints; // No of EPs used by this IF (excl. EP0)
uint8_t bInterfaceClass; // Interface Class Code
uint8_t bInterfaceSubClass; // Interface Subclass Code
uint8_t bInterfaceProtocol; // Interface Protocol Code
uint8_t iInterface; // Index of String Desc for this Interface
} interface_desc; // End of Interface Descriptor Type
//------------------------------------------
// Standard Class Descriptor Type Definition
//------------------------------------------
typedef /*code */struct
{
uint8_t bLength; // Size of this Descriptor in Bytes (=9)
uint8_t bDescriptorType; // Descriptor Type (HID=0x21)
WORD bcdHID; // HID Class Specification
// release number (=1.01)
uint8_t bCountryCode; // Localized country code
uint8_t bNumDescriptors; // Number of class descriptors to follow
uint8_t bReportDescriptorType; // Report descriptor type (HID=0x22)
uint16_t wItemLength; // Total length of report descriptor table
} class_desc; // End of Class Descriptor Type
//---------------------------------------------
// Standard Endpoint Descriptor Type Definition
//---------------------------------------------
typedef /*code*/ struct
{
uint8_t bLength; // Size of this Descriptor in Bytes
uint8_t bDescriptorType; // Descriptor Type (=5)
uint8_t bEndpointAddress; // Endpoint Address (Number + Direction)
uint8_t bmAttributes; // Endpoint Attributes (Transfer Type)
WORD wMaxPacketSize; // Max. Endpoint Packet Size
uint8_t bInterval; // Polling Interval (Interrupt) ms
} endpoint_desc; // End of Endpoint Descriptor Type
#endif /* _USB_DESC_H_ */
/** @} */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -