mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
fix(uhci): rx fsm race condition and buffer size check
Closes https://github.com/espressif/esp-idf/issues/18819 Closes https://github.com/espressif/esp-idf/issues/18820
This commit is contained in:
@@ -52,7 +52,7 @@ If the configurations in :cpp:type:`uhci_controller_config_t` is specified, user
|
||||
uhci_controller_config_t uhci_cfg = {
|
||||
.uart_port = EX_UART_NUM, // Connect uart port to UHCI hardware.
|
||||
.tx_trans_queue_depth = 30, // Queue depth of transaction queue.
|
||||
.max_receive_internal_mem = 10 * 1024, // internal memory usage, for more information, please refer to API reference.
|
||||
.max_receive_internal_mem = 10 * 1024, // Expected max uhci_receive() buffer size; also sizes the RX DMA descriptor chain. For large transfers, configure it so that at least two descriptors are available for ping-pong operation.
|
||||
.max_transmit_size = 10 * 1024, // Maximum transfer size in one transaction, in bytes (including all buffers).
|
||||
.max_transmit_buffer_count = 1, // Maximum number of buffers in one transmit transaction. 0 or 1 means only single-buffer transmit is used.
|
||||
.dma_burst_size = 32, // Burst size.
|
||||
@@ -190,7 +190,7 @@ Data can be received via UHCI as follows:
|
||||
}
|
||||
}
|
||||
|
||||
In the API :cpp:func:`uhci_receive` interface, the parameter `read_buffer` is a buffer that must be provided by the user, and parameter `buffer_size` represents the size of the buffer supplied by the user. In the configuration structure of the UHCI controller, the parameter :cpp:member:`uhci_controller_config_t::max_receive_internal_mem` specifies the desired size of the internal DMA working space. The software allocates a certain number of DMA nodes based on this working space size. These nodes form a circular linked list.
|
||||
In the API :cpp:func:`uhci_receive` interface, the parameter ``read_buffer`` is a buffer that must be provided by the user, and parameter ``buffer_size`` represents the size of the buffer supplied by the user. ``buffer_size`` should generally not exceed :cpp:member:`uhci_controller_config_t::max_receive_internal_mem`.
|
||||
|
||||
When a node is filled, but the reception has not yet completed, the event :cpp:member:`uhci_event_callbacks_t::on_rx_trans_event` will be triggered, accompanied by :cpp:member:`uhci_rx_event_data_t::flags::totally_received` set to 0. When all the data has been fully received, the :cpp:member:`uhci_event_callbacks_t::on_rx_trans_event` event will be triggered again with :cpp:member:`uhci_rx_event_data_t::flags::totally_received` set to 1.
|
||||
|
||||
@@ -198,7 +198,7 @@ This mechanism allows the user to achieve continuous and fast reception using a
|
||||
|
||||
.. note::
|
||||
|
||||
The parameter `read_buffer` of :cpp:func:`uhci_receive` cannot be freed until receive finishes.
|
||||
The parameter ``read_buffer`` of :cpp:func:`uhci_receive` cannot be freed until receive finishes.
|
||||
|
||||
Uninstall UHCI controller
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Reference in New Issue
Block a user