APM:Libraries
Functions | Variables
usbd_cdc_core.c File Reference

This file provides the high layer firmware functions to manage the following functionalities of the USB CDC Class: More...

#include "usbd_cdc_core.h"
#include "usbd_desc.h"
#include "usbd_req.h"
#include "ring_buff.h"
#include "min_max.h"
Include dependency graph for usbd_cdc_core.c:

Go to the source code of this file.

Functions

static uint8_t usbd_cdc_Init (void *pdev, uint8_t cfgidx)
 usbd_cdc_Init Initilaize the CDC interface More...
 
static uint8_t usbd_cdc_DeInit (void *pdev, uint8_t cfgidx)
 usbd_cdc_Init DeInitialize the CDC layer More...
 
static uint8_t usbd_cdc_Setup (void *pdev, USB_SETUP_REQ *req)
 usbd_cdc_Setup Handle the CDC specific requests More...
 
static uint8_t usbd_cdc_EP0_RxReady (void *pdev)
 usbd_cdc_EP0_RxReady Data received on control endpoint More...
 
static uint8_t usbd_cdc_DataIn (void *pdev, uint8_t epnum)
 usbd_audio_DataIn Data sent on non-control IN endpoint More...
 
static uint8_t usbd_cdc_DataOut (void *pdev, uint8_t epnum)
 usbd_cdc_DataOut Data received on non-control Out endpoint More...
 
static uint8_t usbd_cdc_SOF (void *pdev)
 usbd_audio_SOF Start Of Frame event management More...
 
static uint8_t * USBD_cdc_GetCfgDesc (uint8_t speed, uint16_t *length)
 USBD_cdc_GetCfgDesc Return configuration descriptor. More...
 
static uint32_t last_tx_packet_size (void *pdev, uint8_t epnum)
 
static uint32_t last_rx_data_size (void *pdev, uint8_t epnum)
 
static int try_start_rx (void *pdev)
 
static void schedule_cdc_out (void *pdev)
 
static void schedule_cdc_in (void *pdev)
 

Variables

CDC_IF_Prop_TypeDef APP_FOPS
 
const uint8_t USBD_DeviceDesc [USB_SIZ_DEVICE_DESC]
 
__ALIGN_BEGIN uint8_t const usbd_cdc_CfgDesc [USB_CDC_CONFIG_DESC_SIZ__ALIGN_END = 0
 
uint32_t USB_Rx_buff_head = 0
 
uint32_t USB_Rx_buff_tail = 0
 
uint32_t USB_Rx_buff_size = USB_RX_BUFF_SIZE
 
uint32_t USB_Rx_total_bytes = 0
 
uint32_t USB_Tx_buff_head = 0
 
uint32_t USB_Tx_buff_tail = 0
 
uint32_t USB_Tx_total_bytes = 0
 
uint8_t USB_Tx_Active = 0
 
uint8_t USB_Rx_Active = 0
 
static uint32_t cdcCmd = 0xFF
 
static uint32_t cdcLen = 0
 
USBD_Class_cb_TypeDef const USBD_CDC_cb
 

Detailed Description

This file provides the high layer firmware functions to manage the following functionalities of the USB CDC Class:

Author
MCD Application Team
Version
V1.1.0
Date
19-March-2012
  • Initialization and Configuration of high and low layer
  • Enumeration as CDC Device (and enumeration for each implemented memory interface)
  • OUT/IN data transfer
  • Command IN transfer (class requests management)
  • Error management
*      
*          ===================================================================      
*                                CDC Class Driver Description
*          =================================================================== 
*           This driver manages the "Universal Serial Bus Class Definitions for Communications Devices
*           Revision 1.2 November 16, 2007" and the sub-protocol specification of "Universal Serial Bus 
*           Communications Class Subclass Specification for PSTN Devices Revision 1.2 February 9, 2007"
*           This driver implements the following aspects of the specification:
*             - Device descriptor management
*             - Configuration descriptor management
*             - Enumeration as CDC device with 2 data endpoints (IN and OUT) and 1 command endpoint (IN)
*             - Requests management (as described in section 6.2 in specification)
*             - Abstract Control Model compliant
*             - Union Functional collection (using 1 IN endpoint for control)
*             - Data interface class

*           @note
*             For the Abstract Control Model, this core allows only transmitting the requests to
*             lower layer dispatcher (ie. usbd_cdc_vcp.c/.h) which should manage each request and
*             perform relative actions.
* 
*           These aspects may be enriched or modified for a specific user application.
*          
*            This driver doesn't implement the following aspects of the specification 
*            (but it is possible to manage these features with some modifications on this driver):
*             - Any class-specific aspect relative to communication classes should be managed by user application.
*             - All communication classes other than PSTN are not managed
*      
*  
Attention

© COPYRIGHT 2012 STMicroelectronics

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at:

   http://www.st.com/software_license_agreement_liberty_v2

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file usbd_cdc_core.c.