refactor(uhci): improve uart_dma_ota example & uhci docs

add const to UHCI rx callback edata->data
This commit is contained in:
Hu Rui
2026-05-25 10:57:16 +08:00
parent 8f3d8b41c3
commit 98128e8b56
8 changed files with 88 additions and 75 deletions
@@ -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.
*