1- /*******************************************************************************
2- * @file descriptors.c
3- * @brief USB descriptors.
4- * @author PLACEHOLDER
5- * @version PLACEHOLDER
6- *******************************************************************************/
7- //LICENSE PLACEHOLDER
8-
9-
10- //=============================================================================
11- // src/descriptors.c: generated by Hardware Configurator
12- //
13- // This file is only generated if it does not exist. Modifications in this file
14- // will persist even if Configurator generates code. To refresh this file,
15- // you must first delete it and then regenerate code.
16- //=============================================================================
17-
181//-----------------------------------------------------------------------------
19- // Includes
2+ // descriptors.c
203//-----------------------------------------------------------------------------
4+ // Copyright 2018 AstroKey
5+ // https://github.com/AstroKey/astrokey_firmware/blob/master/LICENSE
6+ //
7+ // File Description:
8+ //
9+ // Implementations of AstroKey USB descriptors.
10+ //
2111#include <si_toolchain.h>
2212#include <endian.h>
2313#include <stdlib.h>
@@ -76,6 +66,7 @@ SI_SEGMENT_VARIABLE(ReportDescriptor0[69],
7666
7767};
7868
69+ // USB Device Descriptor
7970SI_SEGMENT_VARIABLE (deviceDesc [],
8071 const USB_DeviceDescriptor_TypeDef ,
8172 SI_SEG_CODE ) =
@@ -96,6 +87,7 @@ SI_SEGMENT_VARIABLE(deviceDesc[],
9687 1 , // bNumConfigurations
9788};
9889
90+ // USB Configuration Descriptor for Configuration 1
9991SI_SEGMENT_VARIABLE (configDesc [],
10092 const uint8_t ,
10193 SI_SEG_CODE ) =
@@ -155,6 +147,7 @@ SI_SEGMENT_VARIABLE(configDesc[],
155147 1 , // bInterval
156148};
157149
150+ // USB Binary Object Store Descriptor
158151SI_SEGMENT_VARIABLE (bosDesc ,
159152 const USB_BOS_TypeDef ,
160153 SI_SEG_CODE ) =
@@ -198,6 +191,7 @@ SI_SEGMENT_VARIABLE(bosDesc,
198191 }
199192};
200193
194+ // Microsoft OS 2.0 Descriptor Set
201195SI_SEGMENT_VARIABLE (msDesc , const MS_OS_20_DescriptorSet_TypeDef , SI_SEG_CODE ) =
202196{
203197 {
@@ -257,15 +251,15 @@ UTF16LE_PACKED_STATIC_CONST_STRING_DESC( mfrDesc[], MFR_STRING, MFR_SIZE );
257251UTF16LE_PACKED_STATIC_CONST_STRING_DESC ( prodDesc [], PROD_STRING , PROD_SIZE );
258252UTF16LE_PACKED_STATIC_CONST_STRING_DESC ( serDesc [], SER_STRING , SER_SIZE );
259253
260- //-----------------------------------------------------------------------------
254+ // USB String Table
261255SI_SEGMENT_VARIABLE_SEGMENT_POINTER (myUsbStringTable_USEnglish [], static const USB_StringDescriptor_TypeDef , SI_SEG_GENERIC , const SI_SEG_CODE ) =
262256{
263257 (SI_VARIABLE_SEGMENT_POINTER (, uint8_t , SI_SEG_CODE ))langDesc ,
264258 mfrDesc ,
265259 prodDesc ,
266260 serDesc ,
267261};
268- //-----------------------------------------------------------------------------
262+ // USB Initalization Struct
269263SI_SEGMENT_VARIABLE (initstruct ,
270264 const USBD_Init_TypeDef ,
271265 SI_SEG_CODE ) =
@@ -279,8 +273,10 @@ SI_SEGMENT_VARIABLE(initstruct,
279273#define URL0_STRING 'a','s','t','r','o','k','e','y','.','g','i','t','h','u','b','.','i','o'
280274#define URL0_SIZE 18
281275
276+ // WebUSB Landing Page URL Descriptor
282277URL_DESC ( landingPage [] , URL0_SIZE , WEBUSB_SCHEME_HTTPS , URL0_STRING );
283278
279+ // WebUSB URL Descriptor Table
284280SI_SEGMENT_VARIABLE_SEGMENT_POINTER (myURLs [], const USB_URLDescriptor_TypeDef , SI_SEG_GENERIC , const SI_SEG_CODE ) =
285281{
286282 landingPage ,
0 commit comments