feat(parlio_tx): support to mount bitscrambler

This commit is contained in:
Chen Jichang
2025-04-28 14:54:05 +08:00
committed by morris
parent 39f6aeb536
commit d3dba7597d
15 changed files with 486 additions and 68 deletions

View File

@@ -0,0 +1,51 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "esp_err.h"
#include "driver/parlio_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Decorate Parlio TX units with BitScrambler
*
* @note This function creates a BitScrambler instance and associates it with the Parlio TX unit.
* The decorated TX unit will be able to do some pre-process to the user data with the help of BitScrambler
* Only can be called before enable the TX unit
*
* @param[in] tx_unit Parlio TX unit handle
* @return
* - ESP_OK: Decorate Parlio TX units with BitScrambler success
* - ESP_ERR_INVALID_ARG: Failed because of invalid argument
* - ESP_ERR_INVALID_STATE: Failed because the TX unit is already decorated with BitScrambler
* - ESP_FAIL: Failed because of other error
*/
esp_err_t parlio_tx_unit_decorate_bitscrambler(parlio_tx_unit_handle_t tx_unit);
/**
* @brief Remove the BitScrambler decoration from the Parlio TX unit
*
* @note This function removes the BitScrambler decoration from the Parlio TX unit, restoring the original functionality.
* Only can be called before enable the TX unit
*
* @param[in] tx_unit Parlio TX unit handle
* @return
* - ESP_OK: Remove the BitScrambler decoration from the Parlio TX unit success
* - ESP_ERR_INVALID_ARG: Failed because of invalid argument
* - ESP_ERR_INVALID_STATE: Failed because the TX unit is not decorated with BitScrambler
* - ESP_FAIL: Failed because of other error
*/
esp_err_t parlio_tx_unit_undecorate_bitscrambler(parlio_tx_unit_handle_t tx_unit);
#ifdef __cplusplus
}
#endif

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -108,23 +108,6 @@ esp_err_t parlio_tx_unit_enable(parlio_tx_unit_handle_t unit);
*/
esp_err_t parlio_tx_unit_disable(parlio_tx_unit_handle_t unit);
/**
* @brief Type of Parallel IO TX done event data
*/
typedef struct {
} parlio_tx_done_event_data_t;
/**
* @brief Prototype of parlio tx event callback
* @param[in] tx_unit Parallel IO TX unit that created by `parlio_new_tx_unit`
* @param[in] edata Point to Parallel IO TX event data. The lifecycle of this pointer memory is inside this function,
* user should copy it into static memory if used outside this function.
* @param[in] user_ctx User registered context, passed from `parlio_tx_unit_register_event_callbacks`
*
* @return Whether a high priority task has been waken up by this callback function
*/
typedef bool (*parlio_tx_done_callback_t)(parlio_tx_unit_handle_t tx_unit, const parlio_tx_done_event_data_t *edata, void *user_ctx);
/**
* @brief Group of Parallel IO TX callbacks
* @note The callbacks are all running under ISR environment
@@ -157,6 +140,7 @@ esp_err_t parlio_tx_unit_register_event_callbacks(parlio_tx_unit_handle_t tx_uni
*/
typedef struct {
uint32_t idle_value; /*!< The value on the data line when the parallel IO is in idle state */
const void *bitscrambler_program; /*!< BitScrambler program binary, NULL if not use BitScrambler */
struct {
uint32_t queue_nonblocking : 1; /*!< If set, when the transaction queue is full, driver will not block the thread but return directly */
uint32_t loop_transmission : 1; /*!< If set, the transmission will be repeated continuously, until the tx_unit is disabled by `parlio_tx_unit_disable` */

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -31,6 +31,23 @@ typedef struct parlio_rx_unit_t *parlio_rx_unit_handle_t;
*/
typedef struct parlio_rx_delimiter_t *parlio_rx_delimiter_handle_t;
/**
* @brief Type of Parallel IO TX done event data
*/
typedef struct {
} parlio_tx_done_event_data_t;
/**
* @brief Prototype of parlio tx event callback
* @param[in] tx_unit Parallel IO TX unit that created by `parlio_new_tx_unit`
* @param[in] edata Point to Parallel IO TX event data. The lifecycle of this pointer memory is inside this function,
* user should copy it into static memory if used outside this function.
* @param[in] user_ctx User registered context, passed from `parlio_tx_unit_register_event_callbacks`
*
* @return Whether a high priority task has been waken up by this callback function
*/
typedef bool (*parlio_tx_done_callback_t)(parlio_tx_unit_handle_t tx_unit, const parlio_tx_done_event_data_t *edata, void *user_ctx);
#ifdef __cplusplus
}
#endif