1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
/*********************************************************************
* Descriptor specific type definitions are defined in:
* usb_device.h
*
* Configuration options are defined in:
* usb_config.h
********************************************************************/
#ifndef __USB_DESCRIPTORS_C
#define __USB_DESCRIPTORS_C
/** INCLUDES *******************************************************/
#include "usb.h"
#include "usb_function_hid.h"
/** CONSTANTS ******************************************************/
#if defined(__18CXX)
// JMCV #pragma romdata
#endif
/* Device Descriptor */
const /* ROM JMCV */ USB_DEVICE_DESCRIPTOR device_dsc=
{
0x09,/*sizeof(USB_DEVICE_DESCRIPTOR),*/ // Size of this descriptor in bytes
USB_DESCRIPTOR_DEVICE, // DEVICE descriptor type
0x0200, // USB Spec Release Number in BCD format
0x00, // Class Code
0x00, // Subclass code
0x00, // Protocol code
USB_EP0_BUFF_SIZE, // Max packet size for EP0, see usbcfg.h
MY_VID, // Vendor ID yts
MY_PID, // Product ID: Mouse in a circle fw demo yts
0x0001, // Device release number in BCD format
0x01, // Manufacturer string index
0x02, // Product string index
0x00, // Device serial number string index
0x01 // Number of possible configurations
};
/* Configuration 1 Descriptor */
const /* ROM JMCV */BYTE configDescriptor1[]={
/* Configuration Descriptor */
0x09,/*sizeof(USB_DESCRIPTOR_CONFIGURATION), */ // Size of this descriptor in bytes
USB_DESCRIPTOR_CONFIGURATION, // CONFIGURATION descriptor type
DESC_CONFIG_WORD((UINT16) 0x0029), // Total length of data for this cfg/*sizeof(configDescriptor1),*/ // Total length of data for this cfg
1, // Number of interfaces in this cfg
1, // Index value of this configuration
0, // Configuration string index
_DEFAULT/*JMCV | _SELF*/ | _RWU, // Attributes, see usb_device.h
50, // Max power consumption (2X mA)
/* Interface Descriptor */
0x09,/*sizeof(USB_DESCRIPTOR_INTERFACE),*/ // Size of this descriptor in bytes
USB_DESCRIPTOR_INTERFACE, // INTERFACE descriptor type
0, // Interface Number
0, // Alternate Setting Number
1, // Number of endpoints in this intf
HID_INTF, // Class code
BOOT_INTF_SUBCLASS, // Subclass code
HID_PROTOCOL_MOUSE, // Protocol code
0, // Interface string index
/* HID Class-Specific Descriptor */
0x09,/*sizeof(USB_HID_DSC)+3,*/ // Size of this descriptor in bytes RRoj hack
DSC_HID, // HID descriptor type
DESC_CONFIG_WORD(0x0101), // HID Spec Release Number in BCD format (1.11)
0x00, // Country Code (0x00 for Not supported)
HID_NUM_OF_DSC, // Number of class descriptors, see usbcfg.h
DSC_RPT, // Report descriptor type
DESC_CONFIG_WORD((UINT16) 52), // Size of the report descriptor
/* Endpoint Descriptor */
0x07,/*sizeof(USB_DESCRIPTOR_ENDPOINT),*/
USB_DESCRIPTOR_ENDPOINT, //Endpoint Descriptor
HID_EP | _EP_IN, //EndpointAddress
_INTERRUPT, //Attributes
DESC_CONFIG_WORD((UINT16) 8), //size
0x01, //Interval
};
//Language code string descriptor
const /*ROM JMCV */struct{BYTE bLength;BYTE bDscType;WORD string[1];}sd000={
sizeof(sd000),USB_DESCRIPTOR_STRING,{0x0409
}};
//Manufacturer string descriptor
const /* ROM JMCV */struct{BYTE bLength;BYTE bDscType;WORD string[25];}sd001={
sizeof(sd001),USB_DESCRIPTOR_STRING,
{'M','i','c','r','o','c','h','i','p',' ',
'T','e','c','h','n','o','l','o','g','y',' ','I','n','c','.'
}};
//Product string descriptor
const /*ROM JMCV */struct{BYTE bLength;BYTE bDscType;WORD string[13];}sd002={
sizeof(sd002),USB_DESCRIPTOR_STRING,
{'M','o','u','s','e','b','y','t',' ','D','e','m','o'
}};
//Class specific descriptor - HID Mouse
const /*ROM JMCV */struct{BYTE report[HID_RPT01_SIZE];}hid_rpt01={
{ 0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x02, /* Usage (Mouse) */
0xA1, 0x01, /* Collection (Application) */
0x09, 0x01, /* Usage (Pointer) */
0xA1, 0x00, /* Collection (Physical) */
0x85, 0x01, /* Report ID */
0x05, 0x09, /* Usage Page (Buttons) */
0x19, 0x01, /* Usage Minimum (01) */
0x29, 0x03, /* Usage Maximum (03) */
0x15, 0x00, /* Logical Minimum (0) */
0x25, 0x01, /* Logical Maximum (0) */
0x95, 0x03, /* Report Count (3) */
0x75, 0x01, /* Report Size (1) */
0x81, 0x02, /* Input (Data, Variable, Absolute) */
0x95, 0x01, /* Report Count (1) */
0x75, 0x05, /* Report Size (5) */
0x81, 0x01, /* Input (Constant) ;5 bit padding */
0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x30, /* Usage (X) */
0x09, 0x31, /* Usage (Y) */
0x15, 0x81, /* Logical Minimum (-127) */
0x25, 0x7F, /* Logical Maximum (127) */
0x75, 0x08, /* Report Size (8) */
0x95, 0x02, /* Report Count (2) */
0x81, 0x06, /* Input (Data, Variable, Relative) */
0xC0, /* End Collection*/
0xC0,/* End Collection */
}
};
//Array of configuration descriptors
// JMCV ROM BYTE *ROM USB_CD_Ptr[]=
const BYTE *const USB_CD_Ptr[]=
{
/* (ROM BYTE *ROM) JMCV*/ &configDescriptor1
};
//Array of string descriptors
// JMCV ROM BYTE *ROM USB_SD_Ptr[]=
const BYTE *const USB_SD_Ptr[]=
{
/* JMCV
(ROM BYTE *ROM)&sd000,
(ROM BYTE *ROM)&sd001,
(ROM BYTE *ROM)&sd002
*/
&sd000,
&sd001,
&sd002
};
/** EOF usb_descriptors.c ***************************************************/
#endif |
Partager