|
ESP-IDF Firmware
Firmware architecture and call graph
|
#include <stdint.h>#include "freertos/FreeRTOS.h"#include "freertos/semphr.h"#include "freertos/timers.h"#include "tusb.h"#include "tinyusb.h"Go to the source code of this file.
Data Structures | |
| struct | cdcacm_event_rx_wanted_char_data_t |
| Data provided to the input of the callback_rx_wanted_char callback. More... | |
| struct | cdcacm_event_line_state_changed_data_t |
| Data provided to the input of the callback_line_state_changed callback. More... | |
| struct | cdcacm_event_line_coding_changed_data_t |
| Data provided to the input of the line_coding_changed callback. More... | |
| struct | cdcacm_event_t |
| Describes an event passing to the input of a callbacks. More... | |
| struct | tinyusb_config_cdcacm_t |
| Configuration structure for CDC-ACM. More... | |
Typedefs | |
| typedef void(* | tusb_cdcacm_callback_t) (int itf, cdcacm_event_t *event) |
| CDC-ACM callback type. | |
Enumerations | |
| enum | tinyusb_cdcacm_itf_t { TINYUSB_CDC_ACM_0 = 0x0 , TINYUSB_CDC_ACM_1 , TINYUSB_CDC_ACM_MAX } |
| CDC ports available to setup. More... | |
| enum | cdcacm_event_type_t { CDC_EVENT_RX , CDC_EVENT_RX_WANTED_CHAR , CDC_EVENT_LINE_STATE_CHANGED , CDC_EVENT_LINE_CODING_CHANGED } |
| Types of CDC ACM events. More... | |
Functions | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| bool | tusb_cdc_acm_initialized (tinyusb_cdcacm_itf_t itf) |
| Check if the ACM initialized. | |
| typedef void(* tusb_cdcacm_callback_t) (int itf, cdcacm_event_t *event) |
CDC-ACM callback type.
Definition at line 79 of file tusb_cdc_acm.h.
| enum cdcacm_event_type_t |
Types of CDC ACM events.
| Enumerator | |
|---|---|
| CDC_EVENT_RX | |
| CDC_EVENT_RX_WANTED_CHAR | |
| CDC_EVENT_LINE_STATE_CHANGED | |
| CDC_EVENT_LINE_CODING_CHANGED | |
Definition at line 57 of file tusb_cdc_acm.h.
| enum tinyusb_cdcacm_itf_t |
CDC ports available to setup.
| Enumerator | |
|---|---|
| TINYUSB_CDC_ACM_0 | |
| TINYUSB_CDC_ACM_1 | |
| TINYUSB_CDC_ACM_MAX | |
Definition at line 23 of file tusb_cdc_acm.h.
| 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().
| 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().