/** ****************************************************************************** * @file usbh_cdc.h * @author MCD Application Team * @brief This file contains all the prototypes for the usbh_cdc.c ****************************************************************************** * @attention * * Copyright (c) 2015 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... *//* Define to prevent recursive ----------------------------------------------*/#ifndef__USBH_CDC_H#define__USBH_CDC_H#ifdef__cplusplusextern"C"{#endif/* Includes ------------------------------------------------------------------*/#include"usbh_core.h"/** @addtogroup USBH_LIB * @{ *//* ... *//** @addtogroup USBH_CLASS * @{ *//* ... *//** @addtogroup USBH_CDC_CLASS * @{ *//* ... *//** @defgroup USBH_CDC_CORE * @brief This file is the Header file for usbh_core.c * @{ *//* ... *//*Communication Class codes*/#defineUSB_CDC_CLASS0x02U#defineCOMMUNICATION_INTERFACE_CLASS_CODE0x02U/*Data Interface Class Codes*/#defineDATA_INTERFACE_CLASS_CODE0x0AU/*Communication sub class codes*/#defineRESERVED0x00U#defineDIRECT_LINE_CONTROL_MODEL0x01U#defineABSTRACT_CONTROL_MODEL0x02U#defineTELEPHONE_CONTROL_MODEL0x03U#defineMULTICHANNEL_CONTROL_MODEL0x04U#defineCAPI_CONTROL_MODEL0x05U#defineETHERNET_NETWORKING_CONTROL_MODEL0x06U#defineATM_NETWORKING_CONTROL_MODEL0x07U/*Communication Interface Class Control Protocol Codes*/#defineNO_CLASS_SPECIFIC_PROTOCOL_CODE0x00U#defineCOMMON_AT_COMMAND0x01U#defineVENDOR_SPECIFIC0xFFU#defineCS_INTERFACE0x24U#defineCDC_PAGE_SIZE_640x40U/*Class-Specific Request Codes*/#defineCDC_SEND_ENCAPSULATED_COMMAND0x00U#defineCDC_GET_ENCAPSULATED_RESPONSE0x01U#defineCDC_SET_COMM_FEATURE0x02U#defineCDC_GET_COMM_FEATURE0x03U#defineCDC_CLEAR_COMM_FEATURE0x04U#defineCDC_SET_AUX_LINE_STATE0x10U#defineCDC_SET_HOOK_STATE0x11U#defineCDC_PULSE_SETUP0x12U#defineCDC_SEND_PULSE0x13U#defineCDC_SET_PULSE_TIME0x14U#defineCDC_RING_AUX_JACK0x15U#defineCDC_SET_LINE_CODING0x20U#defineCDC_GET_LINE_CODING0x21U#defineCDC_SET_CONTROL_LINE_STATE0x22U#defineCDC_SEND_BREAK0x23U#defineCDC_SET_RINGER_PARMS0x30U#defineCDC_GET_RINGER_PARMS0x31U#defineCDC_SET_OPERATION_PARMS0x32U#defineCDC_GET_OPERATION_PARMS0x33U#defineCDC_SET_LINE_PARMS0x34U#defineCDC_GET_LINE_PARMS0x35U#defineCDC_DIAL_DIGITS0x36U#defineCDC_SET_UNIT_PARAMETER0x37U#defineCDC_GET_UNIT_PARAMETER0x38U#defineCDC_CLEAR_UNIT_PARAMETER0x39U#defineCDC_GET_PROFILE0x3AU#defineCDC_SET_ETHERNET_MULTICAST_FILTERS0x40U#defineCDC_SET_ETHERNET_POWER_MANAGEMENT_PATTERNFILTER0x41U#defineCDC_GET_ETHERNET_POWER_MANAGEMENT_PATTERNFILTER0x42U#defineCDC_SET_ETHERNET_PACKET_FILTER0x43U#defineCDC_GET_ETHERNET_STATISTIC0x44U#defineCDC_SET_ATM_DATA_FORMAT0x50U#defineCDC_GET_ATM_DEVICE_STATISTICS0x51U#defineCDC_SET_ATM_DEFAULT_VC0x52U#defineCDC_GET_ATM_VC_STATISTICS0x53U/* wValue for SetControlLineState*/#defineCDC_ACTIVATE_CARRIER_SIGNAL_RTS0x0002U#defineCDC_DEACTIVATE_CARRIER_SIGNAL_RTS0x0000U#defineCDC_ACTIVATE_SIGNAL_DTR0x0001U#defineCDC_DEACTIVATE_SIGNAL_DTR0x0000U#defineLINE_CODING_STRUCTURE_SIZE0x07U56 defines/** * @} *//* ... *//** @defgroup USBH_CDC_CORE_Exported_Types * @{ *//* ... *//* States for CDC State Machine */typedefenum{CDC_IDLE=0U,CDC_SEND_DATA,CDC_SEND_DATA_WAIT,CDC_RECEIVE_DATA,CDC_RECEIVE_DATA_WAIT,...}CDC_DataStateTypeDef;typedefenum{CDC_IDLE_STATE=0U,CDC_SET_LINE_CODING_STATE,CDC_GET_LAST_LINE_CODING_STATE,CDC_TRANSFER_DATA,CDC_ERROR_STATE,...}CDC_StateTypeDef;/*Line coding structure*/typedefunion_CDC_LineCodingStructure{uint8_tArray[LINE_CODING_STRUCTURE_SIZE];struct{uint32_tdwDTERate;/*Data terminal rate, in bits per second*/uint8_tbCharFormat;/*Stop bits 0 - 1 Stop bit 1 - 1.5 Stop bits 2 - 2 Stop bits*//* ... */uint8_tbParityType;/* Parity 0 - None 1 - Odd 2 - Even 3 - Mark 4 - Space*//* ... */uint8_tbDataBits;/* Data bits (5, 6, 7, 8 or 16). */...}b;...}CDC_LineCodingTypeDef;/* Header Functional Descriptor--------------------------------------------------------------------------------Offset| field | Size | Value | Description------|---------------------|-------|------------|------------------------------0 | bFunctionLength | 1 | number | Size of this descriptor.1 | bDescriptorType | 1 | Constant | CS_INTERFACE (0x24)2 | bDescriptorSubtype | 1 | Constant | Identifier (ID) of functional | | | | descriptor.3 | bcdCDC | 2 | | | | | Number | USB Class Definitions for | | | | Communication Devices Specification | | | | release number in binary-coded | | | | decimal------|---------------------|-------|------------|------------------------------ *//* ... */typedefstruct_FunctionalDescriptorHeader{uint8_tbLength;/*Size of this descriptor.*/uint8_tbDescriptorType;/*CS_INTERFACE (0x24)*/uint8_tbDescriptorSubType;/* Header functional descriptor subtype as*/uint16_tbcdCDC;/* USB Class Definitions for Communication Devices Specification release number in binary-coded decimal. *//* ... */...}CDC_HeaderFuncDesc_TypeDef;/* Call Management Functional Descriptor--------------------------------------------------------------------------------Offset| field | Size | Value | Description------|---------------------|-------|------------|------------------------------0 | bFunctionLength | 1 | number | Size of this descriptor.1 | bDescriptorType | 1 | Constant | CS_INTERFACE (0x24)2 | bDescriptorSubtype | 1 | Constant | Call Management functional | | | | descriptor subtype.3 | bmCapabilities | 1 | Bitmap | The capabilities that this configuration | | | | supports: | | | | D7..D2: RESERVED (Reset to zero) | | | | D1: 0 - Device sends/receives call | | | | management information only over | | | | the Communication Class | | | | interface. | | | | 1 - Device can send/receive call | \ | | management information over a | | | | Data Class interface. | | | | D0: 0 - Device does not handle call | | | | management itself. | | | | 1 - Device handles call | | | | management itself. | | | | The previous bits, in combination, identify | | | | which call management scenario is used. If bit | | | | D0 is reset to 0, then the value of bit D1 is | | | | ignored. In this case, bit D1 is reset to zero for | | | | future compatibility.4 | bDataInterface | 1 | Number | Interface number of Data Class interface | | | | optionally used for call management.------|---------------------|-------|------------|------------------------------ *//* ... */typedefstruct_CallMgmtFunctionalDescriptor{uint8_tbLength;/*Size of this functional descriptor, in bytes.*/uint8_tbDescriptorType;/*CS_INTERFACE (0x24)*/uint8_tbDescriptorSubType;/* Call Management functional descriptor subtype*/uint8_tbmCapabilities;/* bmCapabilities: D0+D1 */uint8_tbDataInterface;/*bDataInterface: 1*/...}CDC_CallMgmtFuncDesc_TypeDef;/* Abstract Control Management Functional Descriptor--------------------------------------------------------------------------------Offset| field | Size | Value | Description------|---------------------|-------|------------|------------------------------0 | bFunctionLength | 1 | number | Size of functional descriptor, in bytes.1 | bDescriptorType | 1 | Constant | CS_INTERFACE (0x24)2 | bDescriptorSubtype | 1 | Constant | Abstract Control Management | | | | functional descriptor subtype.3 | bmCapabilities | 1 | Bitmap | The capabilities that this configuration | | | | supports ((A bit value of zero means that the | | | | request is not supported.) ) D7..D4: RESERVED (Reset to zero) | | | | D3: 1 - Device supports the notification | | | | Network_Connection. | | | | D2: 1 - Device supports the request | | | | Send_Break | | | | D1: 1 - Device supports the request | \ | | combination of Set_Line_Coding, | | | | Set_Control_Line_State, Get_Line_Coding, and the notification Serial_State. | | | | D0: 1 - Device supports the request | | | | combination of Set_Comm_Feature, | | | | Clear_Comm_Feature, and Get_Comm_Feature. | | | | The previous bits, in combination, identify | | | | which requests/notifications are supported by | | | | a Communication Class interface with the | | | | SubClass code of Abstract Control Model.------|---------------------|-------|------------|------------------------------ *//* ... */typedefstruct_AbstractCntrlMgmtFunctionalDescriptor{uint8_tbLength;/*Size of this functional descriptor, in bytes.*/uint8_tbDescriptorType;/*CS_INTERFACE (0x24)*/uint8_tbDescriptorSubType;/* Abstract Control Management functional descriptor subtype*//* ... */uint8_tbmCapabilities;/* The capabilities that this configuration supports */...}CDC_AbstCntrlMgmtFuncDesc_TypeDef;/* Union Functional Descriptor--------------------------------------------------------------------------------Offset| field | Size | Value | Description------|---------------------|-------|------------|------------------------------0 | bFunctionLength | 1 | number | Size of this descriptor.1 | bDescriptorType | 1 | Constant | CS_INTERFACE (0x24)2 | bDescriptorSubtype | 1 | Constant | Union functional | | | | descriptor subtype.3 | bMasterInterface | 1 | Constant | The interface number of the | | | | Communication or Data Class interface4 | bSlaveInterface0 | 1 | Number | nterface number of first slave or associated | | | | interface in the union.------|---------------------|-------|------------|------------------------------ *//* ... */typedefstruct_UnionFunctionalDescriptor{uint8_tbLength;/*Size of this functional descriptor, in bytes*/uint8_tbDescriptorType;/*CS_INTERFACE (0x24)*/uint8_tbDescriptorSubType;/* Union functional descriptor SubType*/uint8_tbMasterInterface;/* The interface number of the Communication or Data Class interface,*//* ... */uint8_tbSlaveInterface0;/*Interface number of first slave*/...}CDC_UnionFuncDesc_TypeDef;typedefstruct_USBH_CDCInterfaceDesc{CDC_HeaderFuncDesc_TypeDefCDC_HeaderFuncDesc;CDC_CallMgmtFuncDesc_TypeDefCDC_CallMgmtFuncDesc;CDC_AbstCntrlMgmtFuncDesc_TypeDefCDC_AbstCntrlMgmtFuncDesc;CDC_UnionFuncDesc_TypeDefCDC_UnionFuncDesc;...}CDC_InterfaceDesc_Typedef;/* Structure for CDC process */typedefstruct{uint8_tNotifPipe;uint8_tNotifEp;uint8_tbuff[8];uint16_tNotifEpSize;...}CDC_CommItfTypedef;typedefstruct{uint8_tInPipe;uint8_tOutPipe;uint8_tOutEp;uint8_tInEp;uint8_tbuff[8];uint16_tOutEpSize;uint16_tInEpSize;...}CDC_DataItfTypedef;/* Structure for CDC process */typedefstruct_CDC_Process{CDC_CommItfTypedefCommItf;CDC_DataItfTypedefDataItf;uint8_t*pTxData;uint8_t*pRxData;uint32_tTxDataLength;uint32_tRxDataLength;CDC_InterfaceDesc_TypedefCDC_Desc;CDC_LineCodingTypeDefLineCoding;CDC_LineCodingTypeDef*pUserLineCoding;CDC_StateTypeDefstate;CDC_DataStateTypeDefdata_tx_state;CDC_DataStateTypeDefdata_rx_state;uint8_tRx_Poll;...}CDC_HandleTypeDef;/** * @} *//* ... *//** @defgroup USBH_CDC_CORE_Exported_Defines * @{ *//* ... *//** * @} *//* ... *//** @defgroup USBH_CDC_CORE_Exported_Macros * @{ *//* ... *//** * @} *//* ... *//** @defgroup USBH_CDC_CORE_Exported_Variables * @{ *//* ... */externUSBH_ClassTypeDefCDC_Class;#defineUSBH_CDC_CLASS&CDC_Class/** * @} *//* ... *//** @defgroup USBH_CDC_CORE_Exported_FunctionsPrototype * @{ *//* ... */USBH_StatusTypeDefUSBH_CDC_SetLineCoding(USBH_HandleTypeDef*phost,CDC_LineCodingTypeDef*linecoding);USBH_StatusTypeDefUSBH_CDC_GetLineCoding(USBH_HandleTypeDef*phost,CDC_LineCodingTypeDef*linecoding);USBH_StatusTypeDefUSBH_CDC_Transmit(USBH_HandleTypeDef*phost,uint8_t*pbuff,uint32_tlength);USBH_StatusTypeDefUSBH_CDC_Receive(USBH_HandleTypeDef*phost,uint8_t*pbuff,uint32_tlength);uint16_tUSBH_CDC_GetLastReceivedDataSize(USBH_HandleTypeDef*phost);USBH_StatusTypeDefUSBH_CDC_Stop(USBH_HandleTypeDef*phost);voidUSBH_CDC_LineCodingChanged(USBH_HandleTypeDef*phost);voidUSBH_CDC_TransmitCallback(USBH_HandleTypeDef*phost);voidUSBH_CDC_ReceiveCallback(USBH_HandleTypeDef*phost);/** * @} *//* ... */#ifdef__cplusplus}extern "C" { ... }#endif/* ... */#endif/* __USBH_CDC_H *//** * @} *//* ... *//** * @} *//* ... *//** * @} *//* ... *//** * @} *//* ... */
Details
Show: from
Types: Columns:
All items filtered out
All items filtered out
This file uses the notable symbols shown below. Click anywhere in the file to view more details.