forked from PAWPAW-Mirror/lib_xua
Define descriptor values
This commit is contained in:
@@ -7,38 +7,55 @@
|
||||
* This file lists the contents of the HID Endpoint descriptor returned during enumeration.
|
||||
*/
|
||||
|
||||
#ifndef _HID_DESCRIPTOR_CONTENTS_
|
||||
#define _HID_DESCRIPTOR_CONTENTS_
|
||||
|
||||
#include "xua_hid_descriptor.h"
|
||||
|
||||
#define HID_DESCRIPTOR_LENGTH_0 0x09 /* Size of descriptor in Bytes */
|
||||
#define HID_DESCRIPTOR_TYPE_0 0x21 /* HID 0x21 */
|
||||
#define HID_BCD_VERSION_LO 0x10 /* HID class specification release */
|
||||
#define HID_BCD_VERSION_HI 0x01
|
||||
#define HID_COUNTRY_CODE 0x00 /* Country code of localized hardware */
|
||||
#define HID_NUM_DESCRIPTORS 0x01 /* Number of class descriptors */
|
||||
#define HID_DESCRIPTOR_TYPE_1 0x22 /* Type of 1st class descriptor, Report 0x22 */
|
||||
#define HID_DESCRIPTOR_LENGTH_1_LO sizeof(hidReportDescriptor) & 0xff
|
||||
#define HID_DESCRIPTOR_LENGTH_1_HI sizeof(hidReportDescriptor) >> 8
|
||||
|
||||
#endif // _HID_DESCRIPTOR_CONTENTS_
|
||||
|
||||
#if (AUDIO_CLASS == 1)
|
||||
|
||||
/* HID descriptor */
|
||||
0x09, /* 0 bLength : Size of descriptor in Bytes */
|
||||
0x21, /* 1 bDescriptorType (HID) */
|
||||
0x10, /* 2 bcdHID */
|
||||
0x01, /* 3 bcdHID */
|
||||
0x00, /* 4 bCountryCode */
|
||||
0x01, /* 5 bNumDescriptors */
|
||||
0x22, /* 6 bDescriptorType[0] (Report) */
|
||||
sizeof(hidReportDescriptor) & 0xff, /* 7 wDescriptorLength[0] */
|
||||
sizeof(hidReportDescriptor) >> 8, /* 8 wDescriptorLength[0] */
|
||||
HID_DESCRIPTOR_LENGTH_0, /* 0 bLength */
|
||||
HID_DESCRIPTOR_TYPE_0, /* 1 bDescriptorType (HID) */
|
||||
HID_BCD_VERSION_LO, /* 2 bcdHID */
|
||||
HID_BCD_VERSION_HI, /* 3 bcdHID */
|
||||
HID_COUNTRY_CODE, /* 4 bCountryCode */
|
||||
HID_NUM_DESCRIPTORS, /* 5 bNumDescriptors */
|
||||
HID_DESCRIPTOR_TYPE_1, /* 6 bDescriptorType[0] */
|
||||
HID_DESCRIPTOR_LENGTH_1_LO, /* 7 wDescriptorLength[0] */
|
||||
HID_DESCRIPTOR_LENGTH_1_HI, /* 8 wDescriptorLength[0] */
|
||||
|
||||
#elif (AUDIO_CLASS == 2)
|
||||
|
||||
.HID_Descriptor =
|
||||
{
|
||||
/* HID descriptor */
|
||||
.bLength = 0x09,
|
||||
.bDescriptorType0 = 0x21,
|
||||
.bLength = sizeof(USB_HID_Descriptor_t),
|
||||
.bDescriptorType0 = HID_DESCRIPTOR_TYPE_0,
|
||||
.bcdHID =
|
||||
{
|
||||
0x10,
|
||||
0x01,
|
||||
HID_BCD_VERSION_LO,
|
||||
HID_BCD_VERSION_HI,
|
||||
},
|
||||
.bCountryCode = 0x00,
|
||||
.bNumDescriptors = 0x01,
|
||||
.bDescriptorType1 = 0x22,
|
||||
.bCountryCode = HID_COUNTRY_CODE,
|
||||
.bNumDescriptors = HID_NUM_DESCRIPTORS,
|
||||
.bDescriptorType1 = HID_DESCRIPTOR_TYPE_1,
|
||||
.wDescriptorLength1 =
|
||||
{
|
||||
sizeof(hidReportDescriptor) & 0xff,
|
||||
sizeof(hidReportDescriptor) >> 8,
|
||||
HID_DESCRIPTOR_LENGTH_1_LO,
|
||||
HID_DESCRIPTOR_LENGTH_1_HI,
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -7,29 +7,40 @@
|
||||
* This file lists the contents of the HID Endpoint descriptor returned during enumeration.
|
||||
*/
|
||||
|
||||
#ifndef _HID_ENDPOINT_DESCRIPTOR_CONTENTS_
|
||||
#define _HID_ENDPOINT_DESCRIPTOR_CONTENTS_
|
||||
|
||||
#include "descriptor_defs.h"
|
||||
|
||||
#define HID_ENDPOINT_DESCRIPTOR_LENGTH 0x07 /* Size of descriptor in Bytes */
|
||||
#define HID_ENDPOINT_DESCRIPTOR_TYPE 0x05 /* Endpoint 0x05 */
|
||||
#define HID_ENDPOINT_ATTRIBUTES 0x03 /* Interrupt */
|
||||
#define HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_LO 0x40
|
||||
#define HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_HI 0x00
|
||||
|
||||
#endif // _HID_ENDPOINT_DESCRIPTOR_CONTENTS_
|
||||
|
||||
#if (AUDIO_CLASS == 1)
|
||||
|
||||
/* HID Endpoint descriptor (IN) */
|
||||
0x07, /* 0 bLength */
|
||||
0x05, /* 1 bDescriptorType */
|
||||
ENDPOINT_ADDRESS_IN_HID, /* 2 bEndpointAddress */
|
||||
0x03, /* 3 bmAttributes (INTERRUPT) */
|
||||
0x40, /* 4 wMaxPacketSize */
|
||||
0x00, /* 5 wMaxPacketSize */
|
||||
ENDPOINT_INT_INTERVAL_IN_HID, /* 6 bInterval */
|
||||
HID_ENDPOINT_DESCRIPTOR_LENGTH, /* 0 bLength */
|
||||
HID_ENDPOINT_DESCRIPTOR_TYPE, /* 1 bDescriptorType */
|
||||
ENDPOINT_ADDRESS_IN_HID, /* 2 bEndpointAddress */
|
||||
HID_ENDPOINT_ATTRIBUTES, /* 3 bmAttributes (INTERRUPT) */
|
||||
HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_LO, /* 4 wMaxPacketSize */
|
||||
HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_HI, /* 5 wMaxPacketSize */
|
||||
ENDPOINT_INT_INTERVAL_IN_HID, /* 6 bInterval */
|
||||
|
||||
#elif (AUDIO_CLASS == 2)
|
||||
|
||||
.HID_In_Endpoint =
|
||||
{
|
||||
/* Endpoint descriptor (IN) */
|
||||
.bLength = 0x7,
|
||||
.bDescriptorType = 5,
|
||||
.bLength = sizeof(USB_Descriptor_Endpoint_t),
|
||||
.bDescriptorType = HID_ENDPOINT_DESCRIPTOR_TYPE,
|
||||
.bEndpointAddress = ENDPOINT_ADDRESS_IN_HID,
|
||||
.bmAttributes = 3,
|
||||
.wMaxPacketSize = 64,
|
||||
.bmAttributes = HID_ENDPOINT_ATTRIBUTES,
|
||||
.wMaxPacketSize = HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_LO,
|
||||
.bInterval = ENDPOINT_INT_INTERVAL_IN_HID,
|
||||
},
|
||||
|
||||
|
||||
@@ -7,35 +7,49 @@
|
||||
* This file lists the contents of the HID Interface descriptor returned during enumeration.
|
||||
*/
|
||||
|
||||
#ifndef _HID_INTERFACE_DESCRIPTOR_CONTENTS_
|
||||
#define _HID_INTERFACE_DESCRIPTOR_CONTENTS_
|
||||
|
||||
#include "descriptor_defs.h"
|
||||
|
||||
#define HID_INTERFACE_DESCRIPTOR_LENGTH 0x09 /* Size of descriptor in Bytes */
|
||||
#define HID_INTERFACE_DESCRIPTOR_TYPE 0x04 /* Interface 0x04 */
|
||||
#define HID_INTERFACE_ALTERNATE_SETTING 0x00 /* Value used alternate interfaces using SetInterface Request */
|
||||
#define HID_INTERFACE_NUMBER_OF_ENDPOINTS 0x01 /* Number of endpoitns for this interface (excluding 0) */
|
||||
#define HID_INTERFACE_CLASS 0x03
|
||||
#define HID_INTERFACE_SUBCLASS 0x00 /* No boot device */
|
||||
#define HID_INTERFACE_PROTOCOL 0x00
|
||||
#define HID_INTERFACE_STRING_DESCRIPTOR_INDEX 0x00
|
||||
|
||||
#endif // _HID_INTERFACE_DESCRIPTOR_CONTENTS_
|
||||
|
||||
#if (AUDIO_CLASS == 1)
|
||||
|
||||
/* HID interface descriptor */
|
||||
0x09, /* 0 bLength : Size of descriptor in Bytes */
|
||||
0x04, /* 1 bDescriptorType (Interface: 0x04)*/
|
||||
INTERFACE_NUMBER_HID, /* 2 bInterfaceNumber : Number of interface */
|
||||
0x00, /* 3 bAlternateSetting : Value used alternate interfaces using SetInterface Request */
|
||||
0x01, /* 4: bNumEndpoints : Number of endpoitns for this interface (excluding 0) */
|
||||
0x03, /* 5: bInterfaceClass */
|
||||
0x00, /* 6: bInterfaceSubClass - no boot device */
|
||||
0x00, /* 7: bInterfaceProtocol*/
|
||||
0x00, /* 8 iInterface */
|
||||
HID_INTERFACE_DESCRIPTOR_LENGTH, /* 0 bLength */
|
||||
HID_INTERFACE_DESCRIPTOR_TYPE, /* 1 bDescriptorType */
|
||||
INTERFACE_NUMBER_HID, /* 2 bInterfaceNumber : Number of interface */
|
||||
HID_INTERFACE_ALTERNATE_SETTING, /* 3 bAlternateSetting */
|
||||
HID_INTERFACE_NUMBER_OF_ENDPOINTS, /* 4: bNumEndpoints */
|
||||
HID_INTERFACE_CLASS, /* 5: bInterfaceClass */
|
||||
HID_INTERFACE_SUBCLASS, /* 6: bInterfaceSubClass */
|
||||
HID_INTERFACE_PROTOCOL, /* 7: bInterfaceProtocol*/
|
||||
HID_INTERFACE_STRING_DESCRIPTOR_INDEX, /* 8 iInterface */
|
||||
|
||||
#elif (AUDIO_CLASS == 2)
|
||||
|
||||
.HID_Interface =
|
||||
{
|
||||
/* HID interface descriptor */
|
||||
.bLength = 0x09,
|
||||
.bDescriptorType = 0x04,
|
||||
.bLength = sizeof(USB_Descriptor_Interface_t),
|
||||
.bDescriptorType = HID_INTERFACE_DESCRIPTOR_TYPE,
|
||||
.bInterfaceNumber = INTERFACE_NUMBER_HID,
|
||||
.bAlternateSetting = 0x00, /* alternate interfaces using SetInterface Request */
|
||||
.bNumEndpoints = 0x01,
|
||||
.bInterfaceClass = 0x03,
|
||||
.bInterfaceSubClass = 0x00, /* no boot device */
|
||||
.bInterfaceProtocol = 0x00,
|
||||
.iInterface = 0x00,
|
||||
.bAlternateSetting = HID_INTERFACE_ALTERNATE_SETTING,
|
||||
.bNumEndpoints = HID_INTERFACE_NUMBER_OF_ENDPOINTS,
|
||||
.bInterfaceClass = HID_INTERFACE_CLASS,
|
||||
.bInterfaceSubClass = HID_INTERFACE_SUBCLASS,
|
||||
.bInterfaceProtocol = HID_INTERFACE_PROTOCOL,
|
||||
.iInterface = HID_INTERFACE_STRING_DESCRIPTOR_INDEX,
|
||||
},
|
||||
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user