mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
Merge branch 'test/uart_dma_ota_fix_v6.0' into 'release/v6.0'
refactor(uhci): refactor uart_dma_ota example (v6.0) See merge request espressif/esp-idf!48755
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -48,11 +48,11 @@ typedef bool (*uhci_tx_done_callback_t)(uhci_controller_handle_t uhci_ctrl, cons
|
||||
* @brief UHCI RX Done Event Data Structure
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t *data; /*!< Pointer to the received data buffer */
|
||||
const uint8_t *data; /*!< Pointer to the received data buffer. Data pointed to by this pointer is typically only guaranteed to be readable during the callback. If you need to use it after callback returns, copy it to external buffer first or refer to advanced zero-copy usage. */
|
||||
size_t recv_size; /*!< Number of bytes received */
|
||||
struct {
|
||||
uint32_t totally_received: 1; /*!< When callback is invoked, while this bit is not set, means the current event gives partial of whole data, the transaction has not been finished. If set, means the current event gives whole data, the transaction finished. */
|
||||
} flags; /*!< I2C master config flags */
|
||||
} flags; /*!< UHCI RX event flags */
|
||||
} uhci_rx_event_data_t;
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,8 @@ typedef struct {
|
||||
* @param uhci_ctrl Handle to the UHCI controller that initiated the transmission.
|
||||
* @param edata Pointer to a structure containing event data related to receive event.
|
||||
* This structure provides details such as the number of bytes received and any
|
||||
* status information relevant to the operation.
|
||||
* status information relevant to the operation. The `edata` pointer is only valid
|
||||
* during the callback. So do not save this pointer and use it outside the callback.
|
||||
* @param user_ctx User-defined context passed during the callback registration.
|
||||
* It can be used to maintain application-specific state or data.
|
||||
*
|
||||
|
||||
@@ -131,7 +131,7 @@ static bool uhci_gdma_rx_callback_done(gdma_channel_handle_t dma_chan, gdma_even
|
||||
if (cache_line > 0) {
|
||||
// The per-node buffer base is aligned to cache_line (see uhci_receive), and rx_size here
|
||||
// equals buffer_size_per_desc_node[] which is also a multiple of cache_line.
|
||||
esp_cache_msync(evt_data.data, rx_size, ESP_CACHE_MSYNC_FLAG_DIR_M2C);
|
||||
esp_cache_msync((void *)evt_data.data, rx_size, ESP_CACHE_MSYNC_FLAG_DIR_M2C);
|
||||
}
|
||||
if (uhci_ctrl->rx_dir.on_rx_trans_event) {
|
||||
need_yield |= uhci_ctrl->rx_dir.on_rx_trans_event(uhci_ctrl, &evt_data, uhci_ctrl->user_data);
|
||||
@@ -167,7 +167,7 @@ static bool uhci_gdma_rx_callback_done(gdma_channel_handle_t dma_chan, gdma_even
|
||||
// is harmless.
|
||||
if (cache_line > 0) {
|
||||
size_t sync_size = (rx_size + cache_line - 1) & ~(cache_line - 1);
|
||||
esp_cache_msync(evt_data.data, sync_size, ESP_CACHE_MSYNC_FLAG_DIR_M2C);
|
||||
esp_cache_msync((void *)evt_data.data, sync_size, ESP_CACHE_MSYNC_FLAG_DIR_M2C);
|
||||
}
|
||||
if (uhci_ctrl->rx_dir.on_rx_trans_event) {
|
||||
need_yield |= uhci_ctrl->rx_dir.on_rx_trans_event(uhci_ctrl, &evt_data, uhci_ctrl->user_data);
|
||||
|
||||
Reference in New Issue
Block a user