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.
Communication Device Class driver. More...
Go to the source code of this file.
Functions | |
__weak int32_t | USBD_CDC_ACM_PortInitialize (void) |
Vitual COM Port initialization. | |
__weak int32_t | USBD_CDC_ACM_PortUninitialize (void) |
Vitual COM Port uninitialization. | |
__weak int32_t | USBD_CDC_ACM_PortReset (void) |
Vitual COM Port reset. | |
__weak int32_t | USBD_CDC_ACM_PortSetLineCoding (CDC_LINE_CODING *line_coding) |
Virtual COM Port change communication settings. | |
__weak int32_t | USBD_CDC_ACM_PortGetLineCoding (CDC_LINE_CODING *line_coding) |
Vitual COM Port retrieve communication settings. | |
__weak int32_t | USBD_CDC_ACM_PortSetControlLineState (uint16_t ctrl_bmp) |
Virtual COM Port set control line state. | |
int32_t | USBD_CDC_ACM_DataSend (const uint8_t *buf, int32_t len) |
Sends data over the USB CDC ACM Virtual COM Port. | |
int32_t | USBD_CDC_ACM_PutChar (const uint8_t ch) |
Sends a single character over the USB CDC ACM Virtual COM Port. | |
int32_t | USBD_CDC_ACM_DataRead (uint8_t *buf, int32_t len) |
Reads data received over the USB CDC ACM Virtual COM Port. | |
int32_t | USBD_CDC_ACM_GetChar (void) |
Reads one character of data received over the USB CDC ACM Virtual COM Port. | |
int32_t | USBD_CDC_ACM_DataAvailable (void) |
Retrieves number of bytes received over the USB CDC ACM Virtual COM Port. | |
int32_t | USBD_CDC_ACM_Notify (uint16_t stat) |
Sends a notification of Virtual COM Port statuses and line states. | |
static void | USBD_CDC_ACM_EP_BULKOUT_HandleData () |
Handle Bulk Out Endpoint Received Data. | |
static void | USBD_CDC_ACM_EP_BULKIN_HandleData (void) |
Handle Bulk In Endpoint Data to Send. | |
__weak int32_t | USBD_CDC_ACM_Initialize (void) |
Initialization of the USB CDC class (ACM) | |
__weak int32_t | USBD_CDC_ACM_Uninitialization (void) |
Uninitialization of the USB CDC class (ACM) | |
__weak int32_t | USBD_CDC_ACM_Reset (void) |
Reset of the USB CDC class (ACM) variables and states. | |
__weak int32_t | USBD_CDC_ACM_SetLineCoding (void) |
Sets Line Coding for the USB CDC ACM Virtual COM Port. | |
__weak int32_t | USBD_CDC_ACM_GetLineCoding (void) |
Gets Line Coding from the USB CDC ACM Virtual COM Port. | |
__weak int32_t | USBD_CDC_ACM_SetControlLineState (uint16_t ctrl_bmp) |
Sets Control Line State for the USB CDC ACM Virtual COM Port. | |
int32_t | USBD_CDC_ACM_DataFree (void) |
Number of free bytes in the Send buffer. | |
void | USBD_CDC_ACM_Reset_Event (void) |
Handle Reset Events. | |
void | USBD_CDC_ACM_SOF_Event (void) |
Handle SOF Events. | |
void | USBD_CDC_ACM_EP_INTIN_Event (uint32_t event) |
Handle Interrupt In Endpoint Events. | |
void | USBD_CDC_ACM_EP_BULKOUT_Event (uint32_t event) |
Handle Bulk Out Endpoint Events. | |
void | USBD_CDC_ACM_EP_BULKIN_Event (uint32_t event) |
Handle Bulk In Endpoint Events. | |
void | USBD_CDC_ACM_EP_BULK_Event (uint32_t event) |
Handle Bulk In/Out Endpoint Events. | |
void | USBD_RTX_CDC_ACM_EP_INTIN_Event (void) |
Task Handling Interrupt In Endpoint Events. | |
void | USBD_RTX_CDC_ACM_EP_BULKIN_Event (void) |
Task Handling Bulk In Endpoint Events. | |
void | USBD_RTX_CDC_ACM_EP_BULKOUT_Event (void) |
Task Handling Bulk Out Endpoint Events. | |
void | USBD_RTX_CDC_ACM_EP_BULK_Event (void) |
Task Handling Bulk In/Out Endpoint Events. | |
Variables | |
int32_t | data_send_access |
int32_t | data_send_active |
int32_t | data_send_zlp |
int32_t | data_to_send_wr |
int32_t | data_to_send_rd |
uint8_t * | ptr_data_to_send |
uint8_t * | ptr_data_sent |
int32_t | data_read_access |
int32_t | data_receive_int_access |
int32_t | data_received_pending_pckts |
int32_t | data_no_space_for_receive |
uint8_t * | ptr_data_received |
uint8_t * | ptr_data_read |
uint16_t | control_line_state |
CDC_LINE_CODING | line_coding |
Detailed Description
Communication Device Class driver.
DAPLink Interface Firmware Copyright (c) 2009-2016, ARM Limited, All Rights Reserved SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
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_acm.c.
Function Documentation
int32_t USBD_CDC_ACM_DataAvailable | ( | void | ) |
Retrieves number of bytes received over the USB CDC ACM Virtual COM Port.
The function retrieves number of bytes available in the intermediate buffer that were received over the Virtual COM Port.
- Returns:
- Number of bytes available for read.
Definition at line 427 of file usbd_cdc_acm.c.
int32_t USBD_CDC_ACM_DataFree | ( | void | ) |
Number of free bytes in the Send buffer.
Definition at line 287 of file usbd_cdc_acm.c.
int32_t USBD_CDC_ACM_DataRead | ( | uint8_t * | buf, |
int32_t | len | ||
) |
Reads data received over the USB CDC ACM Virtual COM Port.
The function reads data from the receive intermediate buffer that was received over the Virtual COM Port.
- Parameters:
-
[in] buf Buffer to where data will be read. [in] len Maximum number of bytes to be read.
- Returns:
- Number of bytes actually read.
Definition at line 377 of file usbd_cdc_acm.c.
int32_t USBD_CDC_ACM_DataSend | ( | const uint8_t * | buf, |
int32_t | len | ||
) |
Sends data over the USB CDC ACM Virtual COM Port.
The function puts requested data to the send intermediate buffer and prepares it for sending over the Virtual COM Port.
- Parameters:
-
[in] buf Buffer containing data to be sent. [in] len Maximum number of bytes to be sent.
- Returns:
- Number of bytes accepted to be sent.
Definition at line 302 of file usbd_cdc_acm.c.
void USBD_CDC_ACM_EP_BULK_Event | ( | uint32_t | event ) |
Handle Bulk In/Out Endpoint Events.
The function handles Bulk In/Out endpoint events. It is used for endpoints that do In and Out functionality on the same endpoint number. It dispatches events to appropriate In or Out event handlers.
- Parameters:
-
[in] event Type of event ( USBD_EVT_IN - input event, USBD_EVT_OUT - output event).
Definition at line 744 of file usbd_cdc_acm.c.
void USBD_CDC_ACM_EP_BULKIN_Event | ( | uint32_t | event ) |
Handle Bulk In Endpoint Events.
The function handles Bulk In endpoint events. It calls USBD_CDC_ACM_EP_BULKIN_HandleData function to handle send data unless data was being accessed in which case function just returns.
- Parameters:
-
[in] event Type of event (USBD_EVT_IN - input event).
Definition at line 719 of file usbd_cdc_acm.c.
static void USBD_CDC_ACM_EP_BULKIN_HandleData | ( | void | ) | [static] |
Handle Bulk In Endpoint Data to Send.
The function handles data to be sent on the Bulk In endpoint. It transmits pending data to be sent that is already in the send intermediate buffer, and it also sends Zero Length Packet if last packet sent was not a short packet.
Definition at line 609 of file usbd_cdc_acm.c.
void USBD_CDC_ACM_EP_BULKOUT_Event | ( | uint32_t | event ) |
Handle Bulk Out Endpoint Events.
The function handles Bulk Out endpoint events. It calls USBD_CDC_ACM_EP_BULKOUT_HandleData function to handle received data unless data was being accessed in which case function just acknowledges that there is data to be handled later.
- Parameters:
-
[in] event Type of event (USBD_EVT_OUT - output event).
Definition at line 686 of file usbd_cdc_acm.c.
static void USBD_CDC_ACM_EP_BULKOUT_HandleData | ( | ) | [static] |
Handle Bulk Out Endpoint Received Data.
The function handles data received on the Bulk Out endpoint. It reads the received data to the receive intermediate buffer if there is enough space available.
Definition at line 572 of file usbd_cdc_acm.c.
void USBD_CDC_ACM_EP_INTIN_Event | ( | uint32_t | event ) |
Handle Interrupt In Endpoint Events.
The function handles Interrupt In endpoint events.
- Parameters:
-
[in] event Type of event (USBD_EVT_IN - input event).
Definition at line 558 of file usbd_cdc_acm.c.
int32_t USBD_CDC_ACM_GetChar | ( | void | ) |
Reads one character of data received over the USB CDC ACM Virtual COM Port.
The function reads data character from the receive intermediate buffer that was received over the Virtual COM Port.
- Returns:
- -1 No character available.
- Received character.
Definition at line 407 of file usbd_cdc_acm.c.
__weak int32_t USBD_CDC_ACM_GetLineCoding | ( | void | ) |
Gets Line Coding from the USB CDC ACM Virtual COM Port.
The function is a callback function that forwards USB CDC ACM request to get communication settings from the Virtual COM Port.
- Returns:
- 0 Function failed.
- 1 Function succeeded.
Definition at line 247 of file usbd_cdc_acm.c.
__weak int32_t USBD_CDC_ACM_Initialize | ( | void | ) |
Initialization of the USB CDC class (ACM)
The function calls USBD_CDC_ACM_PortInitialize function which initializes Virtual COM Port.
- Returns:
- 0 Function failed.
- 1 Function succeeded.
Definition at line 140 of file usbd_cdc_acm.c.
int32_t USBD_CDC_ACM_Notify | ( | uint16_t | stat ) |
Sends a notification of Virtual COM Port statuses and line states.
The function sends error and line status of the Virtual COM Port over the Interrupt endpoint. (SerialState notification is defined in usbcdc11.pdf, 6.3.5.)
- Parameters:
-
[in] stat Error and line statuses ( 6. bit - bOverRun, 5. bit - bParity, 4. bit - bFraming, 3. bit - bRingSignal, 2. bit - bBreak, 1. bit - bTxCarrier (DSR line state), 0. bit - bRxCarrier (DCD line status)).
- Returns:
- 0 Function failed.
- 1 Function succeeded.
Definition at line 450 of file usbd_cdc_acm.c.
__weak int32_t USBD_CDC_ACM_PortGetLineCoding | ( | CDC_LINE_CODING * | line_coding ) |
Vitual COM Port retrieve communication settings.
The function retrieves communication settings of the port used as the Virtual COM Port.
- Parameters:
-
[in] line_coding Pointer to the CDC_LINE_CODING structure.
- Returns:
- 0 Function failed.
- 1 Function succeeded.
Definition at line 74 of file usbd_cdc_acm.c.
__weak int32_t USBD_CDC_ACM_PortInitialize | ( | void | ) |
Vitual COM Port initialization.
The function inititalizes the hardware resources of the port used as the Virtual COM Port.
- Returns:
- 0 Function failed.
- 1 Function succeeded.
Definition at line 58 of file usbd_cdc_acm.c.
__weak int32_t USBD_CDC_ACM_PortReset | ( | void | ) |
Vitual COM Port reset.
The function resets the internal states of the port used as the Virtual COM Port.
- Returns:
- 0 Function failed.
- 1 Function succeeded.
Definition at line 66 of file usbd_cdc_acm.c.
__weak int32_t USBD_CDC_ACM_PortSetControlLineState | ( | uint16_t | ctrl_bmp ) |
Virtual COM Port set control line state.
The function sets control line state on the port used as the Virtual COM Port.
- Parameters:
-
[in] ctrl_bmp Control line settings bitmap (0. bit - DTR state, 1. bit - RTS state).
- Returns:
- 0 Function failed.
- 1 Function succeeded.
Definition at line 78 of file usbd_cdc_acm.c.
__weak int32_t USBD_CDC_ACM_PortSetLineCoding | ( | CDC_LINE_CODING * | line_coding ) |
Virtual COM Port change communication settings.
The function changes communication settings of the port used as the Virtual COM Port.
- Parameters:
-
[in] line_coding Pointer to the loaded CDC_LINE_CODING structure.
- Returns:
- 0 Function failed.
- 1 Function succeeded.
Definition at line 70 of file usbd_cdc_acm.c.
__weak int32_t USBD_CDC_ACM_PortUninitialize | ( | void | ) |
Vitual COM Port uninitialization.
The function uninititalizes/releases the hardware resources of the port used as the Virtual COM Port.
- Returns:
- 0 Function failed.
- 1 Function succeeded.
Definition at line 62 of file usbd_cdc_acm.c.
int32_t USBD_CDC_ACM_PutChar | ( | const uint8_t | ch ) |
Sends a single character over the USB CDC ACM Virtual COM Port.
The function puts requested data character to the send intermediate buffer and prepares it for sending over the Virtual COM Port.
- Parameters:
-
[in] ch Character to be sent.
- Returns:
- -1 Function failed.
- Character accepted to be sent.
Definition at line 357 of file usbd_cdc_acm.c.
__weak int32_t USBD_CDC_ACM_Reset | ( | void | ) |
Reset of the USB CDC class (ACM) variables and states.
The function resets class variables and states, it calls USBD_CDC_ACM_PortReset function which resets Virtual COM Port variables and states and calls USBD_CDC_ACM_PortSetLineCoding function with default parameters to set default communication settings for the Virtual COM Port.
- Returns:
- 0 Function failed.
- 1 Function succeeded.
Definition at line 191 of file usbd_cdc_acm.c.
void USBD_CDC_ACM_Reset_Event | ( | void | ) |
Handle Reset Events.
The function handles Reset events.
Definition at line 480 of file usbd_cdc_acm.c.
__weak int32_t USBD_CDC_ACM_SetControlLineState | ( | uint16_t | ctrl_bmp ) |
Sets Control Line State for the USB CDC ACM Virtual COM Port.
The function is a callback function that forwards USB CDC ACM request to set desired control line state to the Virtual COM Port.
- Parameters:
-
[in] ctrl_bmp Control line settings bitmap ( 0. bit - DTR state, 1. bit - RTS state).
- Returns:
- 0 Function failed.
- 1 Function succeeded.
Definition at line 276 of file usbd_cdc_acm.c.
__weak int32_t USBD_CDC_ACM_SetLineCoding | ( | void | ) |
Sets Line Coding for the USB CDC ACM Virtual COM Port.
The function is a callback function that forwards USB CDC ACM request to set communication settings to the Virtual COM Port.
- Returns:
- 0 Function failed.
- 1 Function succeeded.
Definition at line 225 of file usbd_cdc_acm.c.
void USBD_CDC_ACM_SOF_Event | ( | void | ) |
Handle SOF Events.
The function handles Start Of Frame events. It checks if there is pending data on the Bulk Out endpoint and handles it (USBD_CDC_ACM_EP_BULKOUT_HandleData) if there is enough space in the intermediate receive buffer and it calls received function callback (USBD_CDC_ACM_DataReceived) it also activates data send over the Bulk In endpoint if there is data to be sent (USBD_CDC_ACM_EP_BULKIN_HandleData).
Definition at line 496 of file usbd_cdc_acm.c.
__weak int32_t USBD_CDC_ACM_Uninitialization | ( | void | ) |
Uninitialization of the USB CDC class (ACM)
The function calls USBD_CDC_ACM_PortUninitialize function which uninitializes Virtual COM Port.
- Returns:
- 0 Function failed.
- 1 Function succeeded.
Definition at line 173 of file usbd_cdc_acm.c.
void USBD_RTX_CDC_ACM_EP_BULK_Event | ( | void | ) |
Task Handling Bulk In/Out Endpoint Events.
The task dispatches Bulk In/Out events to the Bulk In/Out handling function (USBD_CDC_ACM_EP_BULK_Event).
Definition at line 815 of file usbd_cdc_acm.c.
void USBD_RTX_CDC_ACM_EP_BULKIN_Event | ( | void | ) |
Task Handling Bulk In Endpoint Events.
The task dispatches Bulk In events to the Bulk In handling function (USBD_CDC_ACM_EP_BULKIN_Event).
Definition at line 779 of file usbd_cdc_acm.c.
void USBD_RTX_CDC_ACM_EP_BULKOUT_Event | ( | void | ) |
Task Handling Bulk Out Endpoint Events.
The task dispatches Bulk Out events to the Bulk Out handling function (USBD_CDC_ACM_EP_BULKOUT_Event).
Definition at line 797 of file usbd_cdc_acm.c.
void USBD_RTX_CDC_ACM_EP_INTIN_Event | ( | void | ) |
Task Handling Interrupt In Endpoint Events.
The task dispatches Interrupt In events to the Interrupt In handling function (USBD_CDC_ACM_EP_INTIN_Event).
Definition at line 764 of file usbd_cdc_acm.c.
Variable Documentation
uint16_t control_line_state |
Control line state settings bitmap (0. bit - DTR state, 1. bit - RTS state)
Definition at line 49 of file usbd_cdc_acm.c.
int32_t data_no_space_for_receive |
Flag active while there is no more space for reception
Definition at line 45 of file usbd_cdc_acm.c.
int32_t data_read_access |
Flag active while read data (in the receive intermediate buffer) is being accessed
Definition at line 42 of file usbd_cdc_acm.c.
int32_t data_receive_int_access |
Flag active while read data (in the receive intermediate buffer) is being accessed from the IRQ function
Definition at line 43 of file usbd_cdc_acm.c.
int32_t data_received_pending_pckts |
Number of packets received but not handled (pending)
Definition at line 44 of file usbd_cdc_acm.c.
int32_t data_send_access |
Flag active while send data (in the send intermediate buffer) is being accessed
Definition at line 34 of file usbd_cdc_acm.c.
int32_t data_send_active |
Flag active while data is being sent
Definition at line 35 of file usbd_cdc_acm.c.
int32_t data_send_zlp |
Flag active when ZLP needs to be sent
Definition at line 36 of file usbd_cdc_acm.c.
int32_t data_to_send_rd |
Number of bytes read from the send intermediate buffer
Definition at line 38 of file usbd_cdc_acm.c.
int32_t data_to_send_wr |
Number of bytes written to the send intermediate buffer
Definition at line 37 of file usbd_cdc_acm.c.
CDC_LINE_CODING line_coding |
Communication settings
Definition at line 51 of file usbd_cdc_acm.c.
uint8_t* ptr_data_read |
Pointer to the receive intermediate buffer to the received read data
Definition at line 47 of file usbd_cdc_acm.c.
uint8_t* ptr_data_received |
Pointer to the receive intermediate buffer to the received unread data
Definition at line 46 of file usbd_cdc_acm.c.
uint8_t* ptr_data_sent |
Pointer to the send intermediate buffer to the data already sent
Definition at line 40 of file usbd_cdc_acm.c.
uint8_t* ptr_data_to_send |
Pointer to the send intermediate buffer to the data to be sent
Definition at line 39 of file usbd_cdc_acm.c.
Generated on Tue Jul 12 2022 15:37:31 by
