|
ESP-IDF Firmware
Firmware architecture and call graph
|
#include <stdint.h>#include "esp_check.h"#include "esp_err.h"#include "esp_log.h"#include "freertos/FreeRTOS.h"#include "freertos/task.h"#include "freertos/ringbuf.h"#include "tusb.h"#include "tusb_cdc_acm.h"#include "cdc.h"#include "sdkconfig.h"Go to the source code of this file.
Data Structures | |
| struct | esp_tusb_cdcacm_t |
Macros | |
| #define | RX_UNREADBUF_SZ_DEFAULT 64 |
| #define | MIN(x, y) |
Functions | |
| static esp_tusb_cdcacm_t * | get_acm (tinyusb_cdcacm_itf_t itf) |
| void | tud_cdc_line_state_cb (uint8_t itf, bool dtr, bool rts) |
| void | tud_cdc_rx_cb (uint8_t itf) |
| void | tud_cdc_line_coding_cb (uint8_t itf, cdc_line_coding_t const *p_line_coding) |
| void | tud_cdc_rx_wanted_cb (uint8_t itf, char wanted_char) |
| esp_err_t | tinyusb_cdcacm_register_callback (tinyusb_cdcacm_itf_t itf, cdcacm_event_type_t event_type, tusb_cdcacm_callback_t callback) |
| Register a callback invoking on CDC event. If the callback had been already registered, it will be overwritten. | |
| esp_err_t | tinyusb_cdcacm_unregister_callback (tinyusb_cdcacm_itf_t itf, cdcacm_event_type_t event_type) |
| Unregister a callback invoking on CDC event. | |
| static esp_err_t | read_from_rx_unread_to_buffer (esp_tusb_cdcacm_t *acm, uint8_t *out_buf, size_t req_bytes, size_t *read_bytes) |
| static esp_err_t | ringbuf_mux_take (esp_tusb_cdcacm_t *acm) |
| static esp_err_t | ringbuf_mux_give (esp_tusb_cdcacm_t *acm) |
| esp_err_t | tinyusb_cdcacm_read (tinyusb_cdcacm_itf_t itf, uint8_t *out_buf, size_t out_buf_sz, size_t *rx_data_size) |
| Read a content to the array, and defines it's size to the sz_store. | |
| size_t | tinyusb_cdcacm_write_queue_char (tinyusb_cdcacm_itf_t itf, char ch) |
| Sent one character to a write buffer. | |
| size_t | tinyusb_cdcacm_write_queue (tinyusb_cdcacm_itf_t itf, const uint8_t *in_buf, size_t in_size) |
| Write data to write buffer from a byte array. | |
| static uint32_t | tud_cdc_n_write_occupied (tinyusb_cdcacm_itf_t itf) |
| esp_err_t | tinyusb_cdcacm_write_flush (tinyusb_cdcacm_itf_t itf, uint32_t timeout_ticks) |
| Send all data from a write buffer. Use tinyusb_cdcacm_write_queue to add data to the buffer. | |
| static esp_err_t | alloc_obj (tinyusb_cdcacm_itf_t itf) |
| static void | free_obj (tinyusb_cdcacm_itf_t itf) |
| esp_err_t | tusb_cdc_acm_init (const tinyusb_config_cdcacm_t *cfg) |
| Initialize CDC ACM. Initialization will be finished with the tud_cdc_line_state_cb callback. | |
| bool | tusb_cdc_acm_initialized (tinyusb_cdcacm_itf_t itf) |
| Check if the ACM initialized. | |
Variables | |
| static const char * | TAG = "tusb_cdc_acm" |
| #define RX_UNREADBUF_SZ_DEFAULT 64 |
Definition at line 19 of file tusb_cdc_acm.c.
Referenced by tusb_cdc_acm_init().
|
static |
Definition at line 334 of file tusb_cdc_acm.c.
References ESP_OK, esp_tusb_cdc_t::subclass_obj, and tinyusb_cdc_get_intf().
Referenced by tusb_cdc_acm_init().
|
static |
Definition at line 345 of file tusb_cdc_acm.c.
References esp_tusb_cdc_t::subclass_obj, and tinyusb_cdc_get_intf().
Referenced by tusb_cdc_acm_init().
|
inlinestatic |
Definition at line 36 of file tusb_cdc_acm.c.
References esp_tusb_cdc_t::subclass_obj, and tinyusb_cdc_get_intf().
Referenced by tinyusb_cdcacm_read(), tinyusb_cdcacm_register_callback(), tinyusb_cdcacm_unregister_callback(), tinyusb_cdcacm_write_flush(), tinyusb_cdcacm_write_queue(), tinyusb_cdcacm_write_queue_char(), tud_cdc_line_coding_cb(), tud_cdc_line_state_cb(), tud_cdc_rx_cb(), tud_cdc_rx_wanted_cb(), tusb_cdc_acm_init(), and tusb_cdc_acm_initialized().
|
static |
Definition at line 219 of file tusb_cdc_acm.c.
References ESP_OK, and esp_tusb_cdcacm_t::rx_unread_buf.
Referenced by tinyusb_cdcacm_read().
|
static |
Definition at line 240 of file tusb_cdc_acm.c.
References ESP_OK, and esp_tusb_cdcacm_t::ringbuf_read_mux.
Referenced by tinyusb_cdcacm_read().
|
static |
Definition at line 231 of file tusb_cdc_acm.c.
References ESP_OK, esp_tusb_cdcacm_t::ringbuf_read_mux, and TAG.
Referenced by tinyusb_cdcacm_read().
| esp_err_t tinyusb_cdcacm_read | ( | tinyusb_cdcacm_itf_t | itf, |
| uint8_t * | out_buf, | ||
| size_t | out_buf_sz, | ||
| size_t * | rx_data_size ) |
Read a content to the array, and defines it's size to the sz_store.
| itf | - number of a CDC object |
| out_buf | - to this array will be stored the object from a CDC buffer |
| out_buf_sz | - size of buffer for results |
| rx_data_size | - to this address will be stored the object's size |
Definition at line 247 of file tusb_cdc_acm.c.
References ESP_OK, ESP_RETURN_ON_ERROR, get_acm(), read_from_rx_unread_to_buffer(), ringbuf_mux_give(), ringbuf_mux_take(), and TAG.
| esp_err_t tinyusb_cdcacm_register_callback | ( | tinyusb_cdcacm_itf_t | itf, |
| cdcacm_event_type_t | event_type, | ||
| tusb_cdcacm_callback_t | callback ) |
Register a callback invoking on CDC event. If the callback had been already registered, it will be overwritten.
| itf | - number of a CDC object |
| event_type | - type of registered event for a callback |
| callback | - callback function |
Definition at line 159 of file tusb_cdc_acm.c.
References esp_tusb_cdcacm_t::callback_line_coding_changed, esp_tusb_cdcacm_t::callback_line_state_changed, esp_tusb_cdcacm_t::callback_rx, esp_tusb_cdcacm_t::callback_rx_wanted_char, CDC_EVENT_LINE_CODING_CHANGED, CDC_EVENT_LINE_STATE_CHANGED, CDC_EVENT_RX, CDC_EVENT_RX_WANTED_CHAR, ESP_OK, get_acm(), and TAG.
Referenced by tusb_cdc_acm_init().
| esp_err_t tinyusb_cdcacm_unregister_callback | ( | tinyusb_cdcacm_itf_t | itf, |
| cdcacm_event_type_t | event_type ) |
Unregister a callback invoking on CDC event.
| itf | - number of a CDC object |
| event_type | - type of registered event for a callback |
Definition at line 188 of file tusb_cdc_acm.c.
References esp_tusb_cdcacm_t::callback_line_coding_changed, esp_tusb_cdcacm_t::callback_line_state_changed, esp_tusb_cdcacm_t::callback_rx, esp_tusb_cdcacm_t::callback_rx_wanted_char, CDC_EVENT_LINE_CODING_CHANGED, CDC_EVENT_LINE_STATE_CHANGED, CDC_EVENT_RX, CDC_EVENT_RX_WANTED_CHAR, ESP_OK, get_acm(), and TAG.
| esp_err_t tinyusb_cdcacm_write_flush | ( | tinyusb_cdcacm_itf_t | itf, |
| uint32_t | timeout_ticks ) |
Send all data from a write buffer. Use tinyusb_cdcacm_write_queue to add data to the buffer.
WARNING! TinyUSB can block output Endpoint for several RX callbacks, after will do additional flush after the each trasfer. That can leads to the situation when you requested a flush, but it will fail until ont of the next callbacks ends. SO USING OF THE FLUSH WITH TIMEOUTS IN CALLBACKS IS NOT RECOMENDED - YOU CAN GET A LOCK FOR THE TIMEOUT
| itf | - number of a CDC object |
| timeout_ticks | - waiting until flush will be considered as failed |
Definition at line 294 of file tusb_cdc_acm.c.
References ESP_OK, get_acm(), TAG, and tud_cdc_n_write_occupied().
Referenced by safe_cdcacm_write_flush().
| size_t tinyusb_cdcacm_write_queue | ( | tinyusb_cdcacm_itf_t | itf, |
| const uint8_t * | in_buf, | ||
| size_t | in_size ) |
Write data to write buffer from a byte array.
| itf | - number of a CDC object |
| in_buf | - a source array |
| in_size | - size to write from arr_src |
Definition at line 280 of file tusb_cdc_acm.c.
References get_acm(), and MIN.
Referenced by cdc_tx_task().
| size_t tinyusb_cdcacm_write_queue_char | ( | tinyusb_cdcacm_itf_t | itf, |
| char | ch ) |
Sent one character to a write buffer.
| itf | - number of a CDC object |
| ch | - character to send |
Definition at line 272 of file tusb_cdc_acm.c.
References get_acm().
Referenced by tusb_write().
| void tud_cdc_line_coding_cb | ( | uint8_t | itf, |
| cdc_line_coding_t const * | p_line_coding ) |
Definition at line 120 of file tusb_cdc_acm.c.
References esp_tusb_cdcacm_t::callback_line_coding_changed, CDC_EVENT_LINE_CODING_CHANGED, and get_acm().
| void tud_cdc_line_state_cb | ( | uint8_t | itf, |
| bool | dtr, | ||
| bool | rts ) |
Definition at line 50 of file tusb_cdc_acm.c.
References esp_tusb_cdcacm_t::callback_line_state_changed, CDC_EVENT_LINE_STATE_CHANGED, get_acm(), and TAG.
|
static |
Definition at line 289 of file tusb_cdc_acm.c.
References CFG_TUD_CDC_TX_BUFSIZE.
Referenced by tinyusb_cdcacm_write_flush().
| void tud_cdc_rx_cb | ( | uint8_t | itf | ) |
Definition at line 83 of file tusb_cdc_acm.c.
References esp_tusb_cdcacm_t::callback_rx, CDC_EVENT_RX, get_acm(), esp_tusb_cdcacm_t::rx_tfbuf, esp_tusb_cdcacm_t::rx_unread_buf, and TAG.
| void tud_cdc_rx_wanted_cb | ( | uint8_t | itf, |
| char | wanted_char ) |
Definition at line 140 of file tusb_cdc_acm.c.
References esp_tusb_cdcacm_t::callback_rx_wanted_char, CDC_EVENT_RX_WANTED_CHAR, and get_acm().
| esp_err_t tusb_cdc_acm_init | ( | const tinyusb_config_cdcacm_t * | cfg | ) |
Initialize CDC ACM. Initialization will be finished with the tud_cdc_line_state_cb callback.
| cfg | - init configuration structure |
Definition at line 352 of file tusb_cdc_acm.c.
References alloc_obj(), tinyusb_config_cdcacm_t::callback_line_coding_changed, tinyusb_config_cdcacm_t::callback_line_state_changed, tinyusb_config_cdcacm_t::callback_rx, tinyusb_config_cdcacm_t::callback_rx_wanted_char, CDC_EVENT_LINE_CODING_CHANGED, CDC_EVENT_LINE_STATE_CHANGED, CDC_EVENT_RX, CDC_EVENT_RX_WANTED_CHAR, tinyusb_config_cdcacm_t::cdc_port, ESP_LOGD, ESP_OK, ESP_RETURN_ON_ERROR, free_obj(), get_acm(), esp_tusb_cdcacm_t::ringbuf_read_mux, esp_tusb_cdcacm_t::rx_tfbuf, esp_tusb_cdcacm_t::rx_unread_buf, esp_tusb_cdcacm_t::rx_unread_buf_sz, tinyusb_config_cdcacm_t::rx_unread_buf_sz, RX_UNREADBUF_SZ_DEFAULT, TAG, tinyusb_cdc_deinit(), tinyusb_cdc_init(), tinyusb_cdcacm_register_callback(), and tinyusb_config_cdcacm_t::usb_dev.
Referenced by app_main().
| bool tusb_cdc_acm_initialized | ( | tinyusb_cdcacm_itf_t | itf | ) |
Check if the ACM initialized.
| itf | - number of a CDC object |
Definition at line 407 of file tusb_cdc_acm.c.
References get_acm().
Referenced by cdc_tx_task(), and esp_vfs_tusb_cdc_register().
|
static |
Definition at line 34 of file tusb_cdc_acm.c.