RISC-V/V203F6P6/ch32v203/usbd/usb_desc.h

81 lines
3.4 KiB
C
Raw Normal View History

2025-02-01 21:38:31 +01:00
/********************************** (C) COPYRIGHT *******************************
* File Name : usb_desc.h
* Author : WCH
* Version : V1.0.0
* Date : 2021/08/08
* Description : This file contains all the functions prototypes for the
* USB description firmware library.
*********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/
#ifndef __USB_DESC_H
#define __USB_DESC_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
/* file version */
#define DEF_FILE_VERSION 0x01
/* usb device info define */
#define DEF_USB_VID 0x1A86
#define DEF_USB_PID 0xFE0C
/* USB device descriptor, device serial number(bcdDevice) */
#define DEF_IC_PRG_VER DEF_FILE_VERSION
/******************************************************************************/
/* usb device endpoint size define */
#define DEF_USBD_UEP0_SIZE 64 /* usb hs/fs device end-point 0 size */
/* FS */
#define DEF_USBD_FS_PACK_SIZE 64 /* usb fs device max bluk/int pack size */
#define DEF_USBD_FS_ISO_PACK_SIZE 1023 /* usb fs device max iso pack size */
/* LS */
#define DEF_USBD_LS_UEP0_SIZE 8 /* usb ls device end-point 0 size */
#define DEF_USBD_LS_PACK_SIZE 64 /* usb ls device max int pack size */
/* Pack size */
#define DEF_USBD_ENDP1_SIZE DEF_USBD_FS_PACK_SIZE
#define DEF_USBD_ENDP2_SIZE DEF_USBD_FS_PACK_SIZE
#define DEF_USBD_ENDP3_SIZE DEF_USBD_FS_PACK_SIZE
#define DEF_USBD_ENDP4_SIZE DEF_USBD_FS_PACK_SIZE
#define DEF_USBD_ENDP5_SIZE DEF_USBD_FS_PACK_SIZE
#define DEF_USBD_ENDP6_SIZE DEF_USBD_FS_PACK_SIZE
#define DEF_USBD_ENDP7_SIZE DEF_USBD_FS_PACK_SIZE
#define DEF_USBD_REPORT_DESC_LEN 0
#define DEF_MAX_STRINGS (4)
#define USB_DEVICE_DESCRIPTOR_TYPE 0x01
#define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02
#define USB_STRING_DESCRIPTOR_TYPE 0x03
#define USB_INTERFACE_DESCRIPTOR_TYPE 0x04
#define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05
#define DEF_USBD_UEP0_SIZE 64
#define DEF_USBD_MAX_PACK_SIZE 64
#define USBD_SIZE_DEVICE_DESC ((uint16_t) USBD_DeviceDescriptor[0])
#define USBD_SIZE_CONFIG_DESC ((uint16_t)(USBD_ConfigDescriptor[2] + ((uint16_t)(USBD_ConfigDescriptor[3]) << 8)))
#define USBD_SIZE_STRING_LANGID ((uint16_t) USBD_StringLangID [0])
#define USBD_SIZE_STRING_VENDOR ((uint16_t) USBD_StringVendor [0])
#define USBD_SIZE_STRING_PRODUCT ((uint16_t) USBD_StringProduct[0])
#define USBD_SIZE_STRING_SERIAL ((uint16_t) USBD_StringSerial [0])
extern const uint8_t USBD_DeviceDescriptor[];
extern const uint8_t USBD_ConfigDescriptor[];
extern const uint8_t * USBD_StringLangID;
extern const uint8_t * USBD_StringVendor;
extern const uint8_t * USBD_StringProduct;
extern const uint8_t * USBD_StringSerial;
#ifdef __cplusplus
}
#endif
#endif /* __USB_DESC_H */