abse/smart-ring-flex
A tscircuit package created by abse.
- Version
- 0.0.24
- License
- unset
- Stars
- 0
firmware/onboard-programmer/ring-service-candidate/src/usb_descr.h
// ===================================================================================
// USB Descriptors and Definitions
// ===================================================================================
//
// Definition of USB descriptors and endpoint sizes and addresses.
//
// The following must be defined in config.h:
// USB_VENDOR_ID - Vendor ID (16-bit word)
// USB_PRODUCT_ID - Product ID (16-bit word)
// USB_DEVICE_VERSION - Device version (16-bit BCD)
// USB_MAX_POWER_mA - Device max power in mA
// All string descriptors.
#pragma once
#include <stdint.h>
#include "usb.h"
// ===================================================================================
// USB Endpoint Definitions
// ===================================================================================
#define EP0_SIZE 8
#define EP1_SIZE 64
#define EP0_ADDR 0
#define EP1_ADDR (EP0_ADDR + EP0_BUF_SIZE)
#define EP0_BUF_SIZE EP_BUF_SIZE(EP0_SIZE)
#define EP1_BUF_SIZE EP_BUF_SIZE(EP1_SIZE) + 64
#define EP_BUF_SIZE(x) (x+2<64 ? x+2 : 64)
__xdata __at (EP0_ADDR) uint8_t EP0_buffer[EP0_BUF_SIZE];
__xdata __at (EP1_ADDR) uint8_t EP1_buffer[EP1_BUF_SIZE];
// ===================================================================================
// Device and Configuration Descriptors
// ===================================================================================
typedef struct _USB_CFG_DESCR_HID {
USB_CFG_DESCR config;
USB_ITF_DESCR interface0;
USB_HID_DESCR hid0;
USB_ENDP_DESCR ep1IN;
USB_ENDP_DESCR ep1OUT;
} USB_CFG_DESCR_HID, *PUSB_CFG_DESCR_HID;
typedef USB_CFG_DESCR_HID __xdata *PXUSB_CFG_DESCR_HID;
extern __code USB_DEV_DESCR DevDescr;
extern __code USB_CFG_DESCR_HID CfgDescr;
// ===================================================================================
// HID Report Descriptors
// ===================================================================================
extern __code uint8_t ReportDescr[];
extern __code uint8_t ReportDescrLen;
#define USB_REPORT_DESCR ReportDescr
#define USB_REPORT_DESCR_LEN ReportDescrLen
// ===================================================================================
// String Descriptors
// ===================================================================================
extern __code uint16_t LangDescr[];
extern __code uint16_t ManufDescr[];
extern __code uint16_t ProdDescr[];
extern __code uint16_t SerDescr[];
extern __code uint16_t InterfDescr[];
#define USB_STR_DESCR_i0 (uint8_t*)LangDescr
#define USB_STR_DESCR_i1 (uint8_t*)ManufDescr
#define USB_STR_DESCR_i2 (uint8_t*)ProdDescr
#define USB_STR_DESCR_i3 (uint8_t*)SerDescr
#define USB_STR_DESCR_i4 (uint8_t*)InterfDescr
#define USB_STR_DESCR_ix (uint8_t*)SerDescr