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.
|
* 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)
|
#if (AUDIO_CLASS == 1)
|
||||||
|
|
||||||
/* HID descriptor */
|
/* HID descriptor */
|
||||||
0x09, /* 0 bLength : Size of descriptor in Bytes */
|
HID_DESCRIPTOR_LENGTH_0, /* 0 bLength */
|
||||||
0x21, /* 1 bDescriptorType (HID) */
|
HID_DESCRIPTOR_TYPE_0, /* 1 bDescriptorType (HID) */
|
||||||
0x10, /* 2 bcdHID */
|
HID_BCD_VERSION_LO, /* 2 bcdHID */
|
||||||
0x01, /* 3 bcdHID */
|
HID_BCD_VERSION_HI, /* 3 bcdHID */
|
||||||
0x00, /* 4 bCountryCode */
|
HID_COUNTRY_CODE, /* 4 bCountryCode */
|
||||||
0x01, /* 5 bNumDescriptors */
|
HID_NUM_DESCRIPTORS, /* 5 bNumDescriptors */
|
||||||
0x22, /* 6 bDescriptorType[0] (Report) */
|
HID_DESCRIPTOR_TYPE_1, /* 6 bDescriptorType[0] */
|
||||||
sizeof(hidReportDescriptor) & 0xff, /* 7 wDescriptorLength[0] */
|
HID_DESCRIPTOR_LENGTH_1_LO, /* 7 wDescriptorLength[0] */
|
||||||
sizeof(hidReportDescriptor) >> 8, /* 8 wDescriptorLength[0] */
|
HID_DESCRIPTOR_LENGTH_1_HI, /* 8 wDescriptorLength[0] */
|
||||||
|
|
||||||
#elif (AUDIO_CLASS == 2)
|
#elif (AUDIO_CLASS == 2)
|
||||||
|
|
||||||
.HID_Descriptor =
|
.HID_Descriptor =
|
||||||
{
|
{
|
||||||
/* HID descriptor */
|
/* HID descriptor */
|
||||||
.bLength = 0x09,
|
.bLength = sizeof(USB_HID_Descriptor_t),
|
||||||
.bDescriptorType0 = 0x21,
|
.bDescriptorType0 = HID_DESCRIPTOR_TYPE_0,
|
||||||
.bcdHID =
|
.bcdHID =
|
||||||
{
|
{
|
||||||
0x10,
|
HID_BCD_VERSION_LO,
|
||||||
0x01,
|
HID_BCD_VERSION_HI,
|
||||||
},
|
},
|
||||||
.bCountryCode = 0x00,
|
.bCountryCode = HID_COUNTRY_CODE,
|
||||||
.bNumDescriptors = 0x01,
|
.bNumDescriptors = HID_NUM_DESCRIPTORS,
|
||||||
.bDescriptorType1 = 0x22,
|
.bDescriptorType1 = HID_DESCRIPTOR_TYPE_1,
|
||||||
.wDescriptorLength1 =
|
.wDescriptorLength1 =
|
||||||
{
|
{
|
||||||
sizeof(hidReportDescriptor) & 0xff,
|
HID_DESCRIPTOR_LENGTH_1_LO,
|
||||||
sizeof(hidReportDescriptor) >> 8,
|
HID_DESCRIPTOR_LENGTH_1_HI,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -7,17 +7,28 @@
|
|||||||
* This file lists the contents of the HID Endpoint descriptor returned during enumeration.
|
* 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"
|
#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)
|
#if (AUDIO_CLASS == 1)
|
||||||
|
|
||||||
/* HID Endpoint descriptor (IN) */
|
/* HID Endpoint descriptor (IN) */
|
||||||
0x07, /* 0 bLength */
|
HID_ENDPOINT_DESCRIPTOR_LENGTH, /* 0 bLength */
|
||||||
0x05, /* 1 bDescriptorType */
|
HID_ENDPOINT_DESCRIPTOR_TYPE, /* 1 bDescriptorType */
|
||||||
ENDPOINT_ADDRESS_IN_HID, /* 2 bEndpointAddress */
|
ENDPOINT_ADDRESS_IN_HID, /* 2 bEndpointAddress */
|
||||||
0x03, /* 3 bmAttributes (INTERRUPT) */
|
HID_ENDPOINT_ATTRIBUTES, /* 3 bmAttributes (INTERRUPT) */
|
||||||
0x40, /* 4 wMaxPacketSize */
|
HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_LO, /* 4 wMaxPacketSize */
|
||||||
0x00, /* 5 wMaxPacketSize */
|
HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_HI, /* 5 wMaxPacketSize */
|
||||||
ENDPOINT_INT_INTERVAL_IN_HID, /* 6 bInterval */
|
ENDPOINT_INT_INTERVAL_IN_HID, /* 6 bInterval */
|
||||||
|
|
||||||
#elif (AUDIO_CLASS == 2)
|
#elif (AUDIO_CLASS == 2)
|
||||||
@@ -25,11 +36,11 @@
|
|||||||
.HID_In_Endpoint =
|
.HID_In_Endpoint =
|
||||||
{
|
{
|
||||||
/* Endpoint descriptor (IN) */
|
/* Endpoint descriptor (IN) */
|
||||||
.bLength = 0x7,
|
.bLength = sizeof(USB_Descriptor_Endpoint_t),
|
||||||
.bDescriptorType = 5,
|
.bDescriptorType = HID_ENDPOINT_DESCRIPTOR_TYPE,
|
||||||
.bEndpointAddress = ENDPOINT_ADDRESS_IN_HID,
|
.bEndpointAddress = ENDPOINT_ADDRESS_IN_HID,
|
||||||
.bmAttributes = 3,
|
.bmAttributes = HID_ENDPOINT_ATTRIBUTES,
|
||||||
.wMaxPacketSize = 64,
|
.wMaxPacketSize = HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_LO,
|
||||||
.bInterval = ENDPOINT_INT_INTERVAL_IN_HID,
|
.bInterval = ENDPOINT_INT_INTERVAL_IN_HID,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -7,35 +7,49 @@
|
|||||||
* This file lists the contents of the HID Interface descriptor returned during enumeration.
|
* 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"
|
#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)
|
#if (AUDIO_CLASS == 1)
|
||||||
|
|
||||||
/* HID interface descriptor */
|
/* HID interface descriptor */
|
||||||
0x09, /* 0 bLength : Size of descriptor in Bytes */
|
HID_INTERFACE_DESCRIPTOR_LENGTH, /* 0 bLength */
|
||||||
0x04, /* 1 bDescriptorType (Interface: 0x04)*/
|
HID_INTERFACE_DESCRIPTOR_TYPE, /* 1 bDescriptorType */
|
||||||
INTERFACE_NUMBER_HID, /* 2 bInterfaceNumber : Number of interface */
|
INTERFACE_NUMBER_HID, /* 2 bInterfaceNumber : Number of interface */
|
||||||
0x00, /* 3 bAlternateSetting : Value used alternate interfaces using SetInterface Request */
|
HID_INTERFACE_ALTERNATE_SETTING, /* 3 bAlternateSetting */
|
||||||
0x01, /* 4: bNumEndpoints : Number of endpoitns for this interface (excluding 0) */
|
HID_INTERFACE_NUMBER_OF_ENDPOINTS, /* 4: bNumEndpoints */
|
||||||
0x03, /* 5: bInterfaceClass */
|
HID_INTERFACE_CLASS, /* 5: bInterfaceClass */
|
||||||
0x00, /* 6: bInterfaceSubClass - no boot device */
|
HID_INTERFACE_SUBCLASS, /* 6: bInterfaceSubClass */
|
||||||
0x00, /* 7: bInterfaceProtocol*/
|
HID_INTERFACE_PROTOCOL, /* 7: bInterfaceProtocol*/
|
||||||
0x00, /* 8 iInterface */
|
HID_INTERFACE_STRING_DESCRIPTOR_INDEX, /* 8 iInterface */
|
||||||
|
|
||||||
#elif (AUDIO_CLASS == 2)
|
#elif (AUDIO_CLASS == 2)
|
||||||
|
|
||||||
.HID_Interface =
|
.HID_Interface =
|
||||||
{
|
{
|
||||||
/* HID interface descriptor */
|
/* HID interface descriptor */
|
||||||
.bLength = 0x09,
|
.bLength = sizeof(USB_Descriptor_Interface_t),
|
||||||
.bDescriptorType = 0x04,
|
.bDescriptorType = HID_INTERFACE_DESCRIPTOR_TYPE,
|
||||||
.bInterfaceNumber = INTERFACE_NUMBER_HID,
|
.bInterfaceNumber = INTERFACE_NUMBER_HID,
|
||||||
.bAlternateSetting = 0x00, /* alternate interfaces using SetInterface Request */
|
.bAlternateSetting = HID_INTERFACE_ALTERNATE_SETTING,
|
||||||
.bNumEndpoints = 0x01,
|
.bNumEndpoints = HID_INTERFACE_NUMBER_OF_ENDPOINTS,
|
||||||
.bInterfaceClass = 0x03,
|
.bInterfaceClass = HID_INTERFACE_CLASS,
|
||||||
.bInterfaceSubClass = 0x00, /* no boot device */
|
.bInterfaceSubClass = HID_INTERFACE_SUBCLASS,
|
||||||
.bInterfaceProtocol = 0x00,
|
.bInterfaceProtocol = HID_INTERFACE_PROTOCOL,
|
||||||
.iInterface = 0x00,
|
.iInterface = HID_INTERFACE_STRING_DESCRIPTOR_INDEX,
|
||||||
},
|
},
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user