Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
usbd_cdc.h
00001 /** 00002 ****************************************************************************** 00003 * @file usbd_cdc.h 00004 * @author MCD Application Team 00005 * @version V2.4.2 00006 * @date 11-December-2015 00007 * @brief header file for the usbd_cdc.c file. 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2> 00012 * 00013 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 00014 * You may not use this file except in compliance with the License. 00015 * You may obtain a copy of the License at: 00016 * 00017 * http://www.st.com/software_license_agreement_liberty_v2 00018 * 00019 * Unless required by applicable law or agreed to in writing, software 00020 * distributed under the License is distributed on an "AS IS" BASIS, 00021 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00022 * See the License for the specific language governing permissions and 00023 * limitations under the License. 00024 * 00025 ****************************************************************************** 00026 */ 00027 00028 /* Define to prevent recursive inclusion -------------------------------------*/ 00029 #ifndef __USB_CDC_H 00030 #define __USB_CDC_H 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif 00035 00036 /* Includes ------------------------------------------------------------------*/ 00037 #include "usbd_ioreq.h" 00038 00039 /** @addtogroup STM32_USB_DEVICE_LIBRARY 00040 * @{ 00041 */ 00042 00043 /** @defgroup usbd_cdc 00044 * @brief This file is the Header file for usbd_cdc.c 00045 * @{ 00046 */ 00047 00048 00049 /** @defgroup usbd_cdc_Exported_Defines 00050 * @{ 00051 */ 00052 #define CDC_IN_EP 0x81 /* EP1 for data IN */ 00053 #define CDC_OUT_EP 0x01 /* EP1 for data OUT */ 00054 #define CDC_CMD_EP 0x82 /* EP2 for CDC commands */ 00055 00056 /* CDC Endpoints parameters: you can fine tune these values depending on the needed baudrates and performance. */ 00057 #define CDC_DATA_HS_MAX_PACKET_SIZE 512 /* Endpoint IN & OUT Packet size */ 00058 #define CDC_DATA_FS_MAX_PACKET_SIZE 64 /* Endpoint IN & OUT Packet size */ 00059 #define CDC_CMD_PACKET_SIZE 8 /* Control Endpoint Packet size */ 00060 00061 #define USB_CDC_CONFIG_DESC_SIZ 67 00062 #define CDC_DATA_HS_IN_PACKET_SIZE CDC_DATA_HS_MAX_PACKET_SIZE 00063 #define CDC_DATA_HS_OUT_PACKET_SIZE CDC_DATA_HS_MAX_PACKET_SIZE 00064 00065 #define CDC_DATA_FS_IN_PACKET_SIZE CDC_DATA_FS_MAX_PACKET_SIZE 00066 #define CDC_DATA_FS_OUT_PACKET_SIZE CDC_DATA_FS_MAX_PACKET_SIZE 00067 00068 /*---------------------------------------------------------------------*/ 00069 /* CDC definitions */ 00070 /*---------------------------------------------------------------------*/ 00071 #define CDC_SEND_ENCAPSULATED_COMMAND 0x00 00072 #define CDC_GET_ENCAPSULATED_RESPONSE 0x01 00073 #define CDC_SET_COMM_FEATURE 0x02 00074 #define CDC_GET_COMM_FEATURE 0x03 00075 #define CDC_CLEAR_COMM_FEATURE 0x04 00076 #define CDC_SET_LINE_CODING 0x20 00077 #define CDC_GET_LINE_CODING 0x21 00078 #define CDC_SET_CONTROL_LINE_STATE 0x22 00079 #define CDC_SEND_BREAK 0x23 00080 00081 /** 00082 * @} 00083 */ 00084 00085 00086 /** @defgroup USBD_CORE_Exported_TypesDefinitions 00087 * @{ 00088 */ 00089 00090 /** 00091 * @} 00092 */ 00093 typedef struct 00094 { 00095 uint32_t bitrate; 00096 uint8_t format; 00097 uint8_t paritytype; 00098 uint8_t datatype; 00099 }USBD_CDC_LineCodingTypeDef; 00100 00101 typedef struct _USBD_CDC_Itf 00102 { 00103 int8_t (* Init) (void); 00104 int8_t (* DeInit) (void); 00105 int8_t (* Control) (uint8_t, uint8_t * , uint16_t); 00106 int8_t (* Receive) (uint8_t *, uint32_t *); 00107 00108 }USBD_CDC_ItfTypeDef; 00109 00110 00111 typedef struct 00112 { 00113 uint32_t data[CDC_DATA_HS_MAX_PACKET_SIZE/4]; /* Force 32bits alignment */ 00114 uint8_t CmdOpCode; 00115 uint8_t CmdLength; 00116 uint8_t *RxBuffer; 00117 uint8_t *TxBuffer; 00118 uint32_t RxLength; 00119 uint32_t TxLength; 00120 00121 __IO uint32_t TxState; 00122 __IO uint32_t RxState; 00123 } 00124 USBD_CDC_HandleTypeDef; 00125 00126 00127 00128 /** @defgroup USBD_CORE_Exported_Macros 00129 * @{ 00130 */ 00131 00132 /** 00133 * @} 00134 */ 00135 00136 /** @defgroup USBD_CORE_Exported_Variables 00137 * @{ 00138 */ 00139 00140 extern USBD_ClassTypeDef USBD_CDC; 00141 #define USBD_CDC_CLASS &USBD_CDC 00142 /** 00143 * @} 00144 */ 00145 00146 /** @defgroup USB_CORE_Exported_Functions 00147 * @{ 00148 */ 00149 uint8_t USBD_CDC_RegisterInterface (USBD_HandleTypeDef *pdev, 00150 USBD_CDC_ItfTypeDef *fops); 00151 00152 uint8_t USBD_CDC_SetTxBuffer (USBD_HandleTypeDef *pdev, 00153 uint8_t *pbuff, 00154 uint16_t length); 00155 00156 uint8_t USBD_CDC_SetRxBuffer (USBD_HandleTypeDef *pdev, 00157 uint8_t *pbuff); 00158 00159 uint8_t USBD_CDC_ReceivePacket (USBD_HandleTypeDef *pdev); 00160 00161 uint8_t USBD_CDC_TransmitPacket (USBD_HandleTypeDef *pdev); 00162 /** 00163 * @} 00164 */ 00165 00166 #ifdef __cplusplus 00167 } 00168 #endif 00169 00170 #endif /* __USB_CDC_H */ 00171 /** 00172 * @} 00173 */ 00174 00175 /** 00176 * @} 00177 */ 00178 00179 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 22:19:21 by
