USB Device Communication Device Class (CDC) interface. More...
#include <FreeRTOS.h>
#include <task.h>
#include "conf_usb.h"
#include "usb_protocol.h"
#include "usb_protocol_cdc.h"
#include "udd.h"
#include "udc.h"
#include "udi_cdc.h"
#include <string.h>
Go to the source code of this file.
Macros | |
#define | UDI_CDC_DATA_EP_IN_TO_PORT(index, unused) |
#define | UDI_CDC_DATA_EP_OUT_TO_PORT(index, unused) |
#define | UDI_CDC_GET_PORT_FROM_COMM_EP(iface, unused) |
#define | UDI_CDC_IFACE_COMM_TO_PORT(iface, unused) |
#define | UDI_CDC_PORT_TO_COMM_EP(index, unused) |
#define | UDI_CDC_PORT_TO_DATA_EP_IN(index, unused) |
#define | UDI_CDC_PORT_TO_DATA_EP_OUT(index, unused) |
#define | UDI_CDC_PORT_TO_IFACE_COMM(index, unused) |
#define | UDI_CDC_RX_BUFFERS (5*UDI_CDC_DATA_EPS_FS_SIZE) |
#define | UDI_CDC_TRANS_HALTED 2 |
#define | UDI_CDC_TX_BUFFERS (5*UDI_CDC_DATA_EPS_FS_SIZE) |
#define | UDI_CDC_TX_EMPTY_NOTIFY(port) |
#define | WRITE_TIMEOUT 10 |
Functions | |
bool | udi_cdc_comm_enable (void) |
Routines to control serial line | |
static uint8_t | udi_cdc_setup_to_port (void) |
Returns the port number corresponding at current setup request. More... | |
static void | udi_cdc_line_coding_received (void) |
Sends line coding to application. More... | |
static void | udi_cdc_ctrl_state_change (uint8_t port, bool b_set, le16_t bit_mask) |
Records new state. More... | |
static void | udi_cdc_ctrl_state_notify (uint8_t port, udd_ep_id_t ep) |
Check and eventually notify the USB host of new state. More... | |
static void | udi_cdc_serial_state_msg_sent (udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep) |
Ack sent of serial state message Callback called after serial state message sent. More... | |
Routines to process data transfer | |
static bool | udi_cdc_rx_start (uint8_t port) |
Enable the reception of data from the USB host. More... | |
static void | udi_cdc_data_received (udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep) |
Update rx buffer management with a new data Callback called after data reception on USB line. More... | |
static void | udi_cdc_data_sent (udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep) |
Ack sent of tx buffer Callback called after data transfer on USB line. More... | |
static void | udi_cdc_tx_send (uint8_t port) |
Send buffer on line or wait a SOF event. More... | |
Variables | |
UDC_DESC_STORAGE udi_api_t | udi_api_cdc_comm |
Global structure which contains standard UDI API for UDC. More... | |
UDC_DESC_STORAGE udi_api_t | udi_api_cdc_data |
Information about configuration of communication line | |
static COMPILER_WORD_ALIGNED usb_cdc_line_coding_t | udi_cdc_line_coding [UDI_CDC_PORT_NB] |
static bool | udi_cdc_serial_state_msg_ongoing [UDI_CDC_PORT_NB] |
static volatile le16_t | udi_cdc_state [UDI_CDC_PORT_NB] |
static COMPILER_WORD_ALIGNED usb_cdc_notify_serial_state_t | uid_cdc_state_msg [UDI_CDC_PORT_NB] |
static volatile uint8_t | udi_cdc_nb_comm_enabled = 0 |
Status of CDC COMM interfaces. More... | |
Variables to manage RX/TX transfer requests | |
static volatile uint8_t | udi_cdc_nb_data_enabled = 0 |
Status of CDC DATA interfaces. More... | |
static volatile bool | udi_cdc_data_running = false |
void | udi_cdc_comm_disable (void) |
bool | udi_cdc_comm_setup (void) |
bool | udi_cdc_data_enable (void) |
void | udi_cdc_data_disable (void) |
bool | udi_cdc_data_setup (void) |
uint8_t | udi_cdc_getsetting (void) |
void | udi_cdc_data_sof_notify (void) |
COMPILER_ALIGNED (32) | |
Buffer to receive data. More... | |
void | udi_cdc_ctrl_signal_dcd (bool b_set) |
Notify a state change of DCD signal. More... | |
void | udi_cdc_ctrl_signal_dsr (bool b_set) |
Notify a state change of DSR signal. More... | |
void | udi_cdc_signal_framing_error (void) |
Notify a framing error. More... | |
void | udi_cdc_signal_parity_error (void) |
Notify a parity error. More... | |
void | udi_cdc_signal_overrun (void) |
Notify a overrun. More... | |
void | udi_cdc_multi_ctrl_signal_dcd (uint8_t port, bool b_set) |
Notify a state change of DCD signal. More... | |
void | udi_cdc_multi_ctrl_signal_dsr (uint8_t port, bool b_set) |
Notify a state change of DSR signal. More... | |
void | udi_cdc_multi_signal_framing_error (uint8_t port) |
Notify a framing error. More... | |
void | udi_cdc_multi_signal_parity_error (uint8_t port) |
Notify a parity error. More... | |
void | udi_cdc_multi_signal_overrun (uint8_t port) |
Notify a overrun. More... | |
iram_size_t | udi_cdc_multi_get_nb_received_data (uint8_t port) |
Gets the number of byte received. More... | |
iram_size_t | udi_cdc_get_nb_received_data (void) |
Gets the number of byte received. More... | |
bool | udi_cdc_multi_is_rx_ready (uint8_t port) |
This function checks if a character has been received on the CDC line. More... | |
bool | udi_cdc_is_rx_ready (void) |
This function checks if a character has been received on the CDC line. More... | |
int | udi_cdc_multi_getc (uint8_t port) |
Waits and gets a value on CDC line. More... | |
int | udi_cdc_getc (void) |
Waits and gets a value on CDC line. More... | |
iram_size_t | udi_cdc_multi_read_buf (uint8_t port, void *buf, iram_size_t size) |
Reads a RAM buffer on CDC line. More... | |
static iram_size_t | udi_cdc_multi_read_no_polling (uint8_t port, void *buf, iram_size_t size) |
iram_size_t | udi_cdc_read_no_polling (void *buf, iram_size_t size) |
Non polling reads of a up to 'size' data from CDC line. More... | |
iram_size_t | udi_cdc_read_buf (void *buf, iram_size_t size) |
Reads a RAM buffer on CDC line. More... | |
iram_size_t | udi_cdc_multi_get_free_tx_buffer (uint8_t port) |
Gets the number of free byte in TX buffer. More... | |
iram_size_t | udi_cdc_get_free_tx_buffer (void) |
Gets the number of free byte in TX buffer. More... | |
bool | udi_cdc_multi_is_tx_ready (uint8_t port) |
This function checks if a new character sent is possible The type int is used to support scanf redirection from compiler LIB. More... | |
bool | udi_cdc_is_tx_ready (void) |
This function checks if a new character sent is possible The type int is used to support scanf redirection from compiler LIB. More... | |
int | udi_cdc_multi_putc (uint8_t port, int value) |
Puts a byte on CDC line The type int is used to support printf redirection from compiler LIB. More... | |
int | udi_cdc_putc (int value) |
Puts a byte on CDC line The type int is used to support printf redirection from compiler LIB. More... | |
iram_size_t | udi_cdc_multi_write_buf (uint8_t port, const void *buf, iram_size_t size) |
Writes a RAM buffer on CDC line. More... | |
iram_size_t | udi_cdc_write_buf (const void *buf, iram_size_t size) |
Writes a RAM buffer on CDC line. More... | |
USB Device Communication Device Class (CDC) interface.
Copyright (c) 2009-2018 Microchip Technology Inc. and its subsidiaries.
Definition in file udi_cdc.c.
#define UDI_CDC_DATA_EP_IN_TO_PORT | ( | index, | |
unused | |||
) |
#define UDI_CDC_DATA_EP_OUT_TO_PORT | ( | index, | |
unused | |||
) |
#define UDI_CDC_GET_PORT_FROM_COMM_EP | ( | iface, | |
unused | |||
) |
#define UDI_CDC_IFACE_COMM_TO_PORT | ( | iface, | |
unused | |||
) |
#define UDI_CDC_PORT_TO_COMM_EP | ( | index, | |
unused | |||
) |
#define UDI_CDC_PORT_TO_DATA_EP_IN | ( | index, | |
unused | |||
) |
#define UDI_CDC_PORT_TO_DATA_EP_OUT | ( | index, | |
unused | |||
) |
#define UDI_CDC_PORT_TO_IFACE_COMM | ( | index, | |
unused | |||
) |
#define UDI_CDC_RX_BUFFERS (5*UDI_CDC_DATA_EPS_FS_SIZE) |
#define UDI_CDC_TRANS_HALTED 2 |
#define UDI_CDC_TX_BUFFERS (5*UDI_CDC_DATA_EPS_FS_SIZE) |
#define WRITE_TIMEOUT 10 |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |