2016-03-29 04:35:26 +00:00
|
|
|
//=============================================================================
|
|
|
|
// src/descriptors.c: generated by Hardware Configurator
|
|
|
|
//
|
|
|
|
// This file is only generated if it does not exist. Modifications in this file
|
|
|
|
// will persist even if Configurator generates code. To refresh this file,
|
|
|
|
// you must first delete it and then regenerate code.
|
|
|
|
//=============================================================================
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Includes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
#include <si_toolchain.h>
|
|
|
|
#include <endian.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <efm8_usb.h>
|
|
|
|
#include "descriptors.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// HID Report Descriptor for Interface 0
|
|
|
|
SI_SEGMENT_VARIABLE(ReportDescriptor0[34],
|
|
|
|
const uint8_t,
|
|
|
|
SI_SEG_CODE) =
|
|
|
|
{
|
|
|
|
|
|
|
|
0x06, 0xd0, 0xf1,// USAGE_PAGE (FIDO Alliance)
|
|
|
|
0x09, 0x01,// USAGE (Keyboard)
|
|
|
|
0xa1, 0x01,// COLLECTION (Application)
|
|
|
|
|
|
|
|
0x09, 0x20, // USAGE (Input Report Data)
|
|
|
|
0x15, 0x00, // LOGICAL_MINIMUM (0)
|
|
|
|
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
|
|
|
|
0x75, 0x08, // REPORT_SIZE (8)
|
|
|
|
0x95, HID_PACKET_SIZE, // REPORT_COUNT (64)
|
|
|
|
0x81, 0x02, // INPUT (Data,Var,Abs)
|
|
|
|
0x09, 0x21, // USAGE(Output Report Data)
|
|
|
|
0x15, 0x00, // LOGICAL_MINIMUM (0)
|
|
|
|
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
|
|
|
|
0x75, 0x08, // REPORT_SIZE (8)
|
|
|
|
0x95, HID_PACKET_SIZE, // REPORT_COUNT (64)
|
|
|
|
0x91, 0x02, // OUTPUT (Data,Var,Abs)
|
|
|
|
|
|
|
|
|
|
|
|
0xc0,// END_COLLECTION
|
|
|
|
|
|
|
|
};
|
|
|
|
SI_SEGMENT_VARIABLE(deviceDesc[],
|
|
|
|
const USB_DeviceDescriptor_TypeDef,
|
|
|
|
SI_SEG_CODE) =
|
|
|
|
{
|
|
|
|
USB_DEVICE_DESCSIZE, // bLength
|
|
|
|
USB_DEVICE_DESCRIPTOR,// bLength
|
|
|
|
htole16(0x0200),// bcdUSB
|
|
|
|
0,// bDeviceClass
|
|
|
|
0,// bDeviceSubClass
|
|
|
|
0,// bDeviceProtocol
|
|
|
|
64,// bMaxPacketSize
|
|
|
|
USB_VENDOR_ID,// idVendor
|
|
|
|
USB_PRODUCT_ID,// idProduct
|
|
|
|
htole16(0x0100),// bcdDevice
|
|
|
|
1,// iManufacturer
|
|
|
|
2,// iProduct
|
|
|
|
3,// iSerialNumber
|
|
|
|
1,// bNumConfigurations
|
|
|
|
};
|
|
|
|
|
|
|
|
SI_SEGMENT_VARIABLE(configDesc[],
|
|
|
|
const uint8_t,
|
|
|
|
SI_SEG_CODE) =
|
|
|
|
{
|
|
|
|
USB_CONFIG_DESCSIZE, // bLength
|
|
|
|
USB_CONFIG_DESCRIPTOR,// bLength
|
|
|
|
0x29,// wTotalLength(LSB)
|
|
|
|
0x00,// wTotalLength(MSB)
|
|
|
|
1,// bNumInterfaces
|
|
|
|
1,// bConfigurationValue
|
|
|
|
0,// iConfiguration
|
|
|
|
|
|
|
|
CONFIG_DESC_BM_RESERVED_D7,// bmAttrib: Bus powered
|
|
|
|
|
|
|
|
CONFIG_DESC_MAXPOWER_mA(100),// bMaxPower: 100 mA
|
|
|
|
|
|
|
|
//Interface 0 Descriptor
|
|
|
|
USB_INTERFACE_DESCSIZE,// bLength
|
|
|
|
USB_INTERFACE_DESCRIPTOR,// bDescriptorType
|
|
|
|
0,// bInterfaceNumber
|
|
|
|
0,// bAlternateSetting
|
|
|
|
2,// bNumEndpoints
|
|
|
|
3,// bInterfaceClass: HID (Human Interface Device)
|
|
|
|
0,// bInterfaceSubClass
|
|
|
|
0,// bInterfaceProtocol
|
|
|
|
4,// iInterface
|
|
|
|
|
|
|
|
//HID Descriptor
|
|
|
|
USB_HID_DESCSIZE,// bLength
|
|
|
|
USB_HID_DESCRIPTOR,// bLength
|
|
|
|
0x11,// bcdHID (LSB)
|
|
|
|
0x01,// bcdHID (MSB)
|
|
|
|
0,// bCountryCode
|
|
|
|
1,// bNumDescriptors
|
|
|
|
USB_HID_REPORT_DESCRIPTOR,// bDescriptorType
|
|
|
|
sizeof( ReportDescriptor0 ),// wDescriptorLength(LSB)
|
|
|
|
sizeof( ReportDescriptor0 )>>8,// wDescriptorLength(MSB)
|
|
|
|
|
|
|
|
//Endpoint 1 IN Descriptor
|
|
|
|
USB_ENDPOINT_DESCSIZE,// bLength
|
|
|
|
USB_ENDPOINT_DESCRIPTOR,// bDescriptorType
|
|
|
|
0x81,// bEndpointAddress
|
|
|
|
USB_EPTYPE_INTR,// bAttrib
|
|
|
|
HID_PACKET_SIZE,// wMaxPacketSize (LSB)
|
|
|
|
0x00,// wMaxPacketSize (MSB)
|
|
|
|
5,// bInterval
|
|
|
|
|
|
|
|
//Endpoint 1 OUT Descriptor
|
|
|
|
USB_ENDPOINT_DESCSIZE,// bLength
|
|
|
|
USB_ENDPOINT_DESCRIPTOR,// bDescriptorType
|
|
|
|
0x01,// bEndpointAddress
|
|
|
|
USB_EPTYPE_INTR,// bAttrib
|
|
|
|
HID_PACKET_SIZE,// wMaxPacketSize (LSB)
|
|
|
|
0x00,// wMaxPacketSize (MSB)
|
|
|
|
5,// bInterval
|
|
|
|
};
|
|
|
|
|
|
|
|
#define LANG_STRING htole16( SLAB_USB_LANGUAGE )
|
|
|
|
#define MFR_STRING "Silicon Labs"
|
|
|
|
#define PROD_STRING "U2F Zero"
|
2016-08-15 03:40:37 +00:00
|
|
|
#define SER_STRING "CAFEBABEFFFFFFFF"
|
2016-07-25 07:11:10 +00:00
|
|
|
#define INT0_STRING "U2F Zero"
|
|
|
|
|
2016-03-29 04:35:26 +00:00
|
|
|
|
|
|
|
LANGID_STATIC_CONST_STRING_DESC( langDesc[], LANG_STRING );
|
|
|
|
UTF16LE_PACKED_STATIC_CONST_STRING_DESC( mfrDesc[], MFR_STRING );
|
|
|
|
UTF16LE_PACKED_STATIC_CONST_STRING_DESC( prodDesc[], PROD_STRING );
|
|
|
|
UTF16LE_PACKED_STATIC_CONST_STRING_DESC( serDesc[], SER_STRING );
|
|
|
|
UTF16LE_PACKED_STATIC_CONST_STRING_DESC( int0Desc[], INT0_STRING );
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
SI_SEGMENT_POINTER(myUsbStringTable_USEnglish[],
|
|
|
|
static const USB_StringDescriptor_TypeDef,
|
|
|
|
const SI_SEG_CODE) =
|
|
|
|
{
|
|
|
|
langDesc,
|
|
|
|
mfrDesc,
|
|
|
|
prodDesc,
|
|
|
|
serDesc,
|
|
|
|
int0Desc,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
SI_SEGMENT_VARIABLE(initstruct,
|
|
|
|
const USBD_Init_TypeDef,
|
|
|
|
SI_SEG_CODE) =
|
|
|
|
{
|
|
|
|
deviceDesc, // deviceDescriptor
|
|
|
|
configDesc,// configDescriptor
|
|
|
|
myUsbStringTable_USEnglish,// stringDescriptors
|
|
|
|
sizeof(myUsbStringTable_USEnglish) / sizeof(void *)// numberOfStrings
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|