sc8-gat-stand/gat_stand_fw/usblib/driver/inc/usb_def.h

83 lines
1.8 KiB
C

/********************************** (C) COPYRIGHT *******************************
* File Name : usb_def.h
* Author : WCH
* Version : V1.0.0
* Date : 2021/08/08
* Description : This file contains all the functions prototypes for the
* USB definition 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_DEF_H
#define __USB_DEF_H
#ifdef __cplusplus
extern "C" {
#endif
#include "ch32v20x.h"
typedef enum _RECIPIENT_TYPE
{
DEVICE_RECIPIENT,
INTERFACE_RECIPIENT,
ENDPOINT_RECIPIENT,
OTHER_RECIPIENT
} RECIPIENT_TYPE;
typedef enum _STANDARD_REQUESTS
{
GET_STATUS = 0,
CLEAR_FEATURE,
RESERVED1,
SET_FEATURE,
RESERVED2,
SET_ADDRESS,
GET_DESCRIPTOR,
SET_DESCRIPTOR,
GET_CONFIGURATION,
SET_CONFIGURATION,
GET_INTERFACE,
SET_INTERFACE,
TOTAL_sREQUEST,
SYNCH_FRAME = 12
} STANDARD_REQUESTS;
/* Definition of "USBwValue" */
typedef enum _DESCRIPTOR_TYPE
{
DEVICE_DESCRIPTOR = 1,
CONFIG_DESCRIPTOR,
STRING_DESCRIPTOR,
INTERFACE_DESCRIPTOR,
ENDPOINT_DESCRIPTOR
} DESCRIPTOR_TYPE;
/* Feature selector of a SET_FEATURE or CLEAR_FEATURE */
typedef enum _FEATURE_SELECTOR
{
ENDPOINT_STALL,
DEVICE_REMOTE_WAKEUP
} FEATURE_SELECTOR;
/* Definition of "USBbmRequestType" */
#define REQUEST_TYPE 0x60
#define STANDARD_REQUEST 0x00
#define CLASS_REQUEST 0x20
#define VENDOR_REQUEST 0x40
#define RECIPIENT 0x1F
#ifdef __cplusplus
}
#endif
#endif /* __USB_DEF_H */