Files
AT32F413_Firmware_Library/middlewares/usbd_class/cdc/cdc_class.h

118 lines
2.8 KiB
C
Raw Normal View History

2021-12-14 13:33:09 +08:00
/**
**************************************************************************
* @file cdc_class.h
2022-05-23 20:00:00 +08:00
* @version v2.0.5
* @date 2022-05-20
2021-12-14 13:33:09 +08:00
* @brief usb cdc class file
**************************************************************************
* Copyright notice & Disclaimer
*
2022-04-11 19:27:58 +08:00
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
2021-12-14 13:33:09 +08:00
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
2022-04-11 19:27:58 +08:00
2021-12-14 13:33:09 +08:00
/* define to prevent recursive inclusion -------------------------------------*/
#ifndef __CDC_CLASS_H
#define __CDC_CLASS_H
#ifdef __cplusplus
extern "C" {
#endif
2022-04-11 19:27:58 +08:00
2021-12-14 13:33:09 +08:00
#include "usb_std.h"
#include "usbd_core.h"
/** @addtogroup AT32F413_middlewares_usbd_class
* @{
*/
2022-04-11 19:27:58 +08:00
2021-12-14 13:33:09 +08:00
/** @addtogroup USB_cdc_class
* @{
*/
2022-04-11 19:27:58 +08:00
/** @defgroup USB_cdc_class_definition
2021-12-14 13:33:09 +08:00
* @{
*/
/**
* @brief usb cdc use endpoint define
*/
#define USBD_CDC_INT_EPT 0x82
#define USBD_CDC_BULK_IN_EPT 0x81
#define USBD_CDC_BULK_OUT_EPT 0x01
/**
* @brief usb cdc in and out max packet size define
*/
2022-03-03 19:34:56 +08:00
#define USBD_CDC_IN_MAXPACKET_SIZE 0x40
#define USBD_CDC_OUT_MAXPACKET_SIZE 0x40
#define USBD_CDC_CMD_MAXPACKET_SIZE 0x08
2021-12-14 13:33:09 +08:00
/**
* @}
*/
/** @defgroup USB_cdc_class_exported_types
* @{
*/
/**
2022-03-03 19:34:56 +08:00
* @brief usb cdc class struct
2021-12-14 13:33:09 +08:00
*/
2022-03-03 19:34:56 +08:00
typedef struct
2021-12-14 13:33:09 +08:00
{
2022-03-03 19:34:56 +08:00
uint32_t alt_setting;
uint8_t g_rx_buff[USBD_CDC_OUT_MAXPACKET_SIZE];
uint8_t g_cmd[USBD_CDC_CMD_MAXPACKET_SIZE];
uint8_t g_req;
uint16_t g_len, g_rxlen;
__IO uint8_t g_tx_completed, g_rx_completed;
linecoding_type linecoding;
}cdc_struct_type;
2021-12-14 13:33:09 +08:00
/**
* @}
*/
/** @defgroup USB_cdc_class_exported_functions
* @{
*/
2022-03-03 19:34:56 +08:00
extern usbd_class_handler cdc_class_handler;
2021-12-14 13:33:09 +08:00
uint16_t usb_vcp_get_rxdata(void *udev, uint8_t *recv_data);
error_status usb_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len);
/**
* @}
*/
/**
* @}
*/
2022-04-11 19:27:58 +08:00
2021-12-14 13:33:09 +08:00
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif