并行 IO
简介
并行 IO 外设是一个通用的并行接口,可用于连接外部设备,如 LED 矩阵、LCD 显示器、打印机和摄像头。该外设具有独立的 TX 和 RX 单元。每个单元最多可以具有 8 或 16 个数据信号以及 1 或 2 个时钟信号。1
并行 IO 外设的 TX 和 RX 驱动程序有各自独立的设计,可分别通过包含头文件 driver/parlio_tx.h
或 driver/parlio_rx.h
来使用。
应用示例
带有 HUB75 接口的简单 REG LED 矩阵:peripherals/parlio/parlio_tx/simple_rgb_led_matrix。
API 参考
Header File
This header file can be included with:
#include "driver/parlio_tx.h"
This header file is a part of the API provided by the
esp_driver_parlio
component. To declare that your component depends onesp_driver_parlio
, add the following to your CMakeLists.txt:REQUIRES esp_driver_parlio
or
PRIV_REQUIRES esp_driver_parlio
Functions
-
esp_err_t parlio_new_tx_unit(const parlio_tx_unit_config_t *config, parlio_tx_unit_handle_t *ret_unit)
Create a Parallel IO TX unit.
- 参数
config -- [in] Parallel IO TX unit configuration
ret_unit -- [out] Returned Parallel IO TX unit handle
- 返回
ESP_OK: Create Parallel IO TX unit successfully
ESP_ERR_INVALID_ARG: Create Parallel IO TX unit failed because of invalid argument
ESP_ERR_NO_MEM: Create Parallel IO TX unit failed because of out of memory
ESP_ERR_NOT_FOUND: Create Parallel IO TX unit failed because all TX units are used up and no more free one
ESP_ERR_NOT_SUPPORTED: Create Parallel IO TX unit failed because some feature is not supported by hardware, e.g. clock gating
ESP_FAIL: Create Parallel IO TX unit failed because of other error
-
esp_err_t parlio_del_tx_unit(parlio_tx_unit_handle_t unit)
Delete a Parallel IO TX unit.
- 参数
unit -- [in] Parallel IO TX unit that created by
parlio_new_tx_unit
- 返回
ESP_OK: Delete Parallel IO TX unit successfully
ESP_ERR_INVALID_ARG: Delete Parallel IO TX unit failed because of invalid argument
ESP_ERR_INVALID_STATE: Delete Parallel IO TX unit failed because it is still in working
ESP_FAIL: Delete Parallel IO TX unit failed because of other error
-
esp_err_t parlio_tx_unit_enable(parlio_tx_unit_handle_t unit)
Enable the Parallel IO TX unit.
备注
This function will transit the driver state from init to enable
备注
This function will acquire a PM lock that might be installed during channel allocation
备注
If there're transaction pending in the queue, this function will pick up the first one and start the transfer
- 参数
unit -- [in] Parallel IO TX unit that created by
parlio_new_tx_unit
- 返回
ESP_OK: Enable Parallel IO TX unit successfully
ESP_ERR_INVALID_ARG: Enable Parallel IO TX unit failed because of invalid argument
ESP_ERR_INVALID_STATE: Enable Parallel IO TX unit failed because it is already enabled
ESP_FAIL: Enable Parallel IO TX unit failed because of other error
-
esp_err_t parlio_tx_unit_disable(parlio_tx_unit_handle_t unit)
Disable the Parallel IO TX unit.
备注
This function will transit the driver state from enable to init
备注
This function will release the PM lock that might be installed during channel allocation
备注
If one transaction is undergoing, this function will terminate it immediately
- 参数
unit -- [in] Parallel IO TX unit that created by
parlio_new_tx_unit
- 返回
ESP_OK: Disable Parallel IO TX unit successfully
ESP_ERR_INVALID_ARG: Disable Parallel IO TX unit failed because of invalid argument
ESP_ERR_INVALID_STATE: Disable Parallel IO TX unit failed because it's not enabled yet
ESP_FAIL: Disable Parallel IO TX unit failed because of other error
-
esp_err_t parlio_tx_unit_register_event_callbacks(parlio_tx_unit_handle_t tx_unit, const parlio_tx_event_callbacks_t *cbs, void *user_data)
Set event callbacks for Parallel IO TX unit.
备注
User can deregister a previously registered callback by calling this function and setting the callback member in the
cbs
structure to NULL.备注
When CONFIG_PARLIO_ISR_IRAM_SAFE is enabled, the callback itself and functions called by it should be placed in IRAM. The variables used in the function should be in the SRAM as well. The
user_data
should also reside in SRAM.- 参数
tx_unit -- [in] Parallel IO TX unit that created by
parlio_new_tx_unit
cbs -- [in] Group of callback functions
user_data -- [in] User data, which will be passed to callback functions directly
- 返回
ESP_OK: Set event callbacks successfully
ESP_ERR_INVALID_ARG: Set event callbacks failed because of invalid argument
ESP_FAIL: Set event callbacks failed because of other error
-
esp_err_t parlio_tx_unit_transmit(parlio_tx_unit_handle_t tx_unit, const void *payload, size_t payload_bits, const parlio_transmit_config_t *config)
Transmit data on by Parallel IO TX unit.
备注
After the function returns, it doesn't mean the transaction is finished. This function only constructs a transaction structure and push into a queue.
- 参数
tx_unit -- [in] Parallel IO TX unit that created by
parlio_new_tx_unit
payload -- [in] Pointer to the data to be transmitted
payload_bits -- [in] Length of the data to be transmitted, in bits
config -- [in] Transmit configuration
- 返回
ESP_OK: Transmit data successfully
ESP_ERR_INVALID_ARG: Transmit data failed because of invalid argument
ESP_ERR_INVALID_STATE: Transmit data failed because the Parallel IO TX unit is not enabled
ESP_FAIL: Transmit data failed because of other error
-
esp_err_t parlio_tx_unit_wait_all_done(parlio_tx_unit_handle_t tx_unit, int timeout_ms)
Wait for all pending TX transactions done.
- 参数
tx_unit -- [in] Parallel IO TX unit that created by
parlio_new_tx_unit
timeout_ms -- [in] Timeout in milliseconds,
-1
means to wait forever
- 返回
ESP_OK: All pending TX transactions is finished and recycled
ESP_ERR_INVALID_ARG: Wait for all pending TX transactions done failed because of invalid argument
ESP_ERR_TIMEOUT: Wait for all pending TX transactions done timeout
ESP_FAIL: Wait for all pending TX transactions done failed because of other error
Structures
-
struct parlio_tx_unit_config_t
Parallel IO TX unit configuration.
Public Members
-
parlio_clock_source_t clk_src
Parallel IO internal clock source
-
gpio_num_t clk_in_gpio_num
If the clock source is input from external, set the corresponding GPIO number. Otherwise, set to
-1
and the driver will use the internalclk_src
as clock source. This option has higher priority thanclk_src
-
uint32_t input_clk_src_freq_hz
Frequency of the input clock source, valid only if
clk_in_gpio_num
is not-1
-
uint32_t output_clk_freq_hz
Frequency of the output clock. It's divided from either internal
clk_src
or external clock source
-
size_t data_width
Parallel IO data width, can set to 1/2/4/8/..., but can't bigger than PARLIO_TX_UNIT_MAX_DATA_WIDTH
-
gpio_num_t data_gpio_nums[PARLIO_TX_UNIT_MAX_DATA_WIDTH]
Parallel IO data GPIO numbers, if any GPIO is not used, you can set it to
-1
-
gpio_num_t clk_out_gpio_num
GPIO number of the output clock signal, the clock is synced with TX data
-
gpio_num_t valid_gpio_num
GPIO number of the valid signal, which stays high when transferring data. Note that, the valid signal will always occupy the MSB data bit
-
size_t trans_queue_depth
Depth of internal transaction queue
-
size_t max_transfer_size
Maximum transfer size in one transaction, in bytes. This decides the number of DMA nodes will be used for each transaction
-
size_t dma_burst_size
DMA burst size, in bytes
-
parlio_sample_edge_t sample_edge
Parallel IO sample edge
-
parlio_bit_pack_order_t bit_pack_order
Set the order of packing the bits into bytes (only works when
data_width
< 8)
-
uint32_t clk_gate_en
Enable TX clock gating, the output clock will be controlled by the MSB bit of the data bus, i.e. by data_gpio_nums[PARLIO_TX_UNIT_MAX_DATA_WIDTH-1]. High level to enable the clock output, low to disable
-
uint32_t io_loop_back
For debug/test, the signal output from the GPIO will be fed to the input path as well
-
struct parlio_tx_unit_config_t::[anonymous] flags
Extra configuration flags
-
parlio_clock_source_t clk_src
-
struct parlio_tx_done_event_data_t
Type of Parallel IO TX done event data.
-
struct parlio_tx_event_callbacks_t
Group of Parallel IO TX callbacks.
备注
The callbacks are all running under ISR environment
备注
When CONFIG_PARLIO_ISR_IRAM_SAFE is enabled, the callback itself and functions called by it should be placed in IRAM. The variables used in the function should be in the SRAM as well.
Public Members
-
parlio_tx_done_callback_t on_trans_done
Event callback, invoked when one transmission is finished
-
parlio_tx_done_callback_t on_trans_done
-
struct parlio_transmit_config_t
Parallel IO transmit configuration.
Public Members
-
uint32_t idle_value
The value on the data line when the parallel IO is in idle state
-
uint32_t queue_nonblocking
If set, when the transaction queue is full, driver will not block the thread but return directly
-
struct parlio_transmit_config_t::[anonymous] flags
Transmit specific config flags
-
uint32_t idle_value
Type Definitions
-
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)
Prototype of parlio tx event callback.
- Param tx_unit
[in] Parallel IO TX unit that created by
parlio_new_tx_unit
- Param edata
[in] 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 user_ctx
[in] 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
Header File
This header file can be included with:
#include "driver/parlio_rx.h"
This header file is a part of the API provided by the
esp_driver_parlio
component. To declare that your component depends onesp_driver_parlio
, add the following to your CMakeLists.txt:REQUIRES esp_driver_parlio
or
PRIV_REQUIRES esp_driver_parlio
Functions
-
esp_err_t parlio_new_rx_unit(const parlio_rx_unit_config_t *config, parlio_rx_unit_handle_t *ret_unit)
Create a Parallel IO RX unit.
- 参数
config -- [in] Parallel IO RX unit configuration
ret_unit -- [out] Returned Parallel IO RX unit handle
- 返回
ESP_ERR_INVALID_ARG Invalid arguments in the parameter list or the rx unit configuration
ESP_ERR_NOT_FOUND No available rx unit found
ESP_ERR_NO_MEM No enough memory for the rx unit resources
ESP_OK Success to allocate the rx unit
-
esp_err_t parlio_del_rx_unit(parlio_rx_unit_handle_t rx_unit)
Delete a Parallel IO RX unit.
- 参数
rx_unit -- [in] Parallel IO RX unit handle that created by
parlio_new_rx_unit
- 返回
ESP_ERR_INVALID_ARG rx_unit is NULL
ESP_ERR_INVALID_STATE The rx unit is enabled, can't delete an enabled rx unit
ESP_OK Success to delete the rx unit
-
esp_err_t parlio_new_rx_level_delimiter(const parlio_rx_level_delimiter_config_t *config, parlio_rx_delimiter_handle_t *ret_delimiter)
Create a level delimiter.
备注
This function only allocate the software resources, the hardware configurations will lazy installed while the transaction that using this delimiter start processing
备注
The enable signal must be aligned with the valid data.
备注
There're at most
SOC_PARLIO_RX_UNIT_MAX_DATA_WIDTH - 1
IO pins left for RXD- 参数
config -- [in] Level delimiter configuration
ret_delimiter -- [out] Returned delimiter handle
- 返回
ESP_ERR_INVALID_ARG Invalid arguments in the parameter list or the level delimiter configuration
ESP_ERR_NO_MEM No enough memory for the level delimiter resources
ESP_OK Success to allocate the level delimiter
-
esp_err_t parlio_new_rx_pulse_delimiter(const parlio_rx_pulse_delimiter_config_t *config, parlio_rx_delimiter_handle_t *ret_delimiter)
Create a pulse delimiter.
备注
This function only allocate the software resources, the hardware configurations will lazy installed while the transaction that using this delimiter start processing
备注
There're at most
SOC_PARLIO_RX_UNIT_MAX_DATA_WIDTH - 1
IO pins left for RXD- 参数
config -- [in] Pulse delimiter configuration
ret_delimiter -- [out] Returned delimiter handle
- 返回
ESP_ERR_INVALID_ARG Invalid arguments in the parameter list or the pulse delimiter configuration
ESP_ERR_NO_MEM No enough memory for the pulse delimiter resources
ESP_OK Success to allocate the pulse delimiter
-
esp_err_t parlio_new_rx_soft_delimiter(const parlio_rx_soft_delimiter_config_t *config, parlio_rx_delimiter_handle_t *ret_delimiter)
Create a pulse delimiter.
备注
This function only allocate the software resources, the hardware configurations will lazy installed while the transaction that using this delimiter start processing
- 参数
config -- [in] Soft delimiter configuration
ret_delimiter -- [out] Returned delimiter handle
- 返回
ESP_ERR_INVALID_ARG Invalid arguments in the parameter list or the soft delimiter configuration
ESP_ERR_NO_MEM No enough memory for the soft delimiter resources
ESP_OK Success to allocate the soft delimiter
-
esp_err_t parlio_rx_soft_delimiter_start_stop(parlio_rx_unit_handle_t rx_unit, parlio_rx_delimiter_handle_t delimiter, bool start_stop)
Start/stop the soft delimiter.
备注
Soft delimiter need to start or stop manually because it has no validating/enabling signal to indicate the data has started or stopped
- 参数
rx_unit -- [in] Parallel IO RX unit handle that created by
parlio_new_rx_unit
delimiter -- [in] Delimiter handle
start_stop -- [in] Set true to start, set false to stop
- 返回
ESP_ERR_INVALID_ARG Invalid arguments in the parameter list or not soft delimiter
ESP_ERR_INVALID_STATE The rx unit not enabled
ESP_OK Success to start or stop the soft delimiter
-
esp_err_t parlio_del_rx_delimiter(parlio_rx_delimiter_handle_t delimiter)
Delete the delimiter.
备注
To delete the delimiter safely, please delete it after disable all the RX units
- 参数
delimiter -- [in] Delimiter handle
- 返回
ESP_ERR_INVALID_ARG The input delimiter is NULL
ESP_ERR_INVALID_STATE The delimiter is on receiving
ESP_OK Success to delete the delimiter
-
esp_err_t parlio_rx_unit_enable(parlio_rx_unit_handle_t rx_unit, bool reset_queue)
Enable the Parallel IO RX unit.
- 参数
rx_unit -- [in] Parallel IO RX unit handle that created by
parlio_new_rx_unit
reset_queue -- [in] Whether to reset the receiving queue. If set to false, the legacy receive transactions in the queue are still available, If set to true, the legacy receive transactions in the queue are dropped.
- 返回
ESP_ERR_INVALID_ARG The input rx_unit is NULL
ESP_ERR_INVALID_STATE The rx unit has been enabled
ESP_OK Success to enable the rx unit
-
esp_err_t parlio_rx_unit_disable(parlio_rx_unit_handle_t rx_unit)
Disable the Parallel IO RX unit.
- 参数
rx_unit -- [in] Parallel IO RX unit handle that created by
parlio_new_rx_unit
- 返回
ESP_ERR_INVALID_ARG The input rx_unit is NULL
ESP_ERR_INVALID_STATE The rx unit has been disabled
ESP_OK Success to disable the rx unit
-
esp_err_t parlio_rx_unit_receive(parlio_rx_unit_handle_t rx_unit, void *payload, size_t payload_size, const parlio_receive_config_t *recv_cfg)
Receive data by Parallel IO RX unit.
备注
This is a non-blocking and asynchronous function. To block or realize synchronous receive, please call
parlio_rx_unit_wait_all_done
after this function备注
The receive transaction will start immediately when there is not other transaction on receiving, Otherwise it will be sent to the transaction queue to wait for the bus.
- 参数
rx_unit -- [in] Parallel IO RX unit handle that created by
parlio_new_rx_unit
payload -- [in] The payload buffer pointer
payload_size -- [in] The size of the payload buffer, in bytes.
recv_cfg -- [in] The configuration of this receive transaction
- 返回
ESP_ERR_INVALID_ARG Invalid arguments in the parameter list or the receive configuration
ESP_ERR_NO_MEM No memory for the internal DMA buffer (only when parlio_receive_config_t::indirect_mount enabled)
ESP_ERR_INVALID_STATE Transaction queue is full, failed to queue the current transaction. Or the internal buffer is under using by an infinite transaction, can't allocate a new one
ESP_OK Success to queue the current receiving transaction
-
esp_err_t parlio_rx_unit_wait_all_done(parlio_rx_unit_handle_t rx_unit, int timeout_ms)
Wait for all pending RX transactions done.
备注
This function will block until all receiving transactions done or timeout. When timeout occurs, either the timeout limitation too short for all transactions done, or the peripheral got stuck and no more interrupts trigger (e.g., external clock stopped).
- 参数
rx_unit -- [in] Parallel IO RX unit handle that created by
parlio_new_rx_unit
timeout_ms -- [in] Timeout in milliseconds,
-1
means to wait forever (software timeout)
- 返回
ESP_ERR_INVALID_ARG The input rx_unit is NULL
ESP_ERR_TIMEOUT Wait for all transactions done timeout
ESP_OK All transaction done
-
esp_err_t parlio_rx_unit_register_event_callbacks(parlio_rx_unit_handle_t rx_unit, const parlio_rx_event_callbacks_t *cbs, void *user_data)
Register event callbacks for Parallel IO RX unit.
- 参数
rx_unit -- [in] Parallel IO RX unit handle that created by
parlio_new_rx_unit
cbs -- [in] Callback group, set callback to NULL to deregister the corresponding callback (callback group pointer shouldn't be NULL)
user_data -- [in] User specified data that will be transported to the callbacks
- 返回
ESP_ERR_INVALID_ARG The input rx_unit is NULL
ESP_ERR_INVALID_STATE The rx unit has been enabled, callback should be registered before enabling the unit
ESP_OK Success to register the callbacks
Structures
-
struct parlio_rx_unit_config_t
Parallel IO RX unit configuration.
Public Members
-
size_t trans_queue_depth
Depth of internal transaction queue
-
size_t max_recv_size
Maximum receive size in one transaction, in bytes. This decides the number of DMA nodes will be used for each transaction
-
size_t data_width
Parallel IO data width, can set to 1/2/4/8/..., but can't be greater than PARLIO_RX_UNIT_MAX_DATA_WIDTH
-
parlio_clock_source_t clk_src
Parallel IO clock source
-
uint32_t ext_clk_freq_hz
The external source clock frequency. Only be valid when select PARLIO_CLK_SRC_EXTERNAL as clock source
-
uint32_t exp_clk_freq_hz
The expected sample/bit clock frequency, which is divided from the internal or external clock regarding the clock source
-
gpio_num_t clk_in_gpio_num
The the external clock input pin. Only be valid when select PARLIO_CLK_SRC_EXTERNAL as clock source. Set to -1 if not needed
-
gpio_num_t clk_out_gpio_num
The sample/bit clock output pin. Set to -1 if not needed
-
gpio_num_t valid_gpio_num
GPIO number of the valid signal. The signal on this pin is used to indicate whether the data on the data lines are valid. Only takes effect when using level or pulse delimiter, set to
-1
if only use the soft delimiter
-
gpio_num_t data_gpio_nums[PARLIO_RX_UNIT_MAX_DATA_WIDTH]
Parallel IO data GPIO numbers, set to
-1
if it's not used, The driver will take [0 .. (data_width - 1)] as the data pins
-
uint32_t free_clk
Whether the input external clock is a free-running clock. A free-running clock will always keep running (e.g. I2S bclk), a non-free-running clock will start when there are data transporting and stop when the bus idle (e.g. SPI). This flag only takes effect when select PARLIO_CLK_SRC_EXTERNAL as clock source
-
uint32_t clk_gate_en
Enable RX clock gating, only available when the clock direction is output(not supported on ESP32-C6) the output clock will be controlled by the valid gpio, i.e. high level of valid gpio to enable the clock output, low to disable
-
uint32_t io_loop_back
For debug/test, the signal output from the GPIO will be fed to the input path as well
-
uint32_t io_no_init
Set to skip initializing the GPIO, but only attach the pralio rx signals to those GPIOs via IO Matrix. So that the signals that have attached to those GPIO won't be overwritten. Mainly used for self communication or self monitoring
-
struct parlio_rx_unit_config_t::[anonymous] flags
RX driver flags
-
size_t trans_queue_depth
-
struct parlio_rx_level_delimiter_config_t
Configuration of level delimiter.
Public Members
-
uint32_t valid_sig_line_id
The data line id of valid/enable signal. The selected data line will be used as the valid/enable signal (i.e. level signal) in this delimiter. As the line of valid/enable signal is shared with the data line, this line_id will be conflict with the data line if set the id within 'data_width', therefore the range is (data_width, PARLIO_RX_UNIT_MAX_DATA_WIDTH].
-
parlio_sample_edge_t sample_edge
Parallel IO sample edge
-
parlio_bit_pack_order_t bit_pack_order
Set how we pack the bits into one bytes
-
uint32_t eof_data_len
Set the data length to trigger the End Of Frame (EOF, i.e. transaction done) interrupt, if the data length is set to
0
, that mean the EOF will only triggers when the enable signal inactivated
-
uint32_t timeout_ticks
The number of source clock ticks to trigger timeout interrupt. Set 0 to disable the receive timeout interrupt The timeout counter starts when the valid/enable signal is invalid/disabled.
-
uint32_t active_low_en
Set true to set the valid signal active when the level is low, otherwise, the valid signal becomes active when its level is high
-
struct parlio_rx_level_delimiter_config_t::[anonymous] flags
Extra flags
-
uint32_t valid_sig_line_id
-
struct parlio_rx_pulse_delimiter_config_t
Configuration of pulse delimiter.
Public Members
-
uint32_t valid_sig_line_id
The data line id of valid/enable signal. The selected data line will be used as the valid/enable signal (i.e. pulse signal) in this delimiter. As the line of valid/enable signal is shared with the data line, this line_id will be conflict with the data line if set the id within 'data_width', therefore the range is (data_width, PARLIO_RX_UNIT_MAX_DATA_WIDTH].
-
parlio_sample_edge_t sample_edge
Parallel IO sample edge
-
parlio_bit_pack_order_t bit_pack_order
Set how we pack the bits into one bytes
-
uint32_t eof_data_len
Set the data length to trigger the End Of Frame (EOF, i.e. transaction done) interrupt, if the data length is set to
0
, that mean the EOF will only triggers when the end pulse detected, please ensure there is an end pulse for a frame andhas_end_pulse
flag is set
-
uint32_t timeout_ticks
The number of source clock ticks to trigger timeout interrupt. Set 0 to disable the receive timeout interrupt The timeout counter starts when the valid/enable signal is invalid/disabled.
-
uint32_t start_bit_included
Whether data bit is included in the start pulse
-
uint32_t end_bit_included
Whether data bit is included in the end pulse, only valid when
has_end_pulse
is true
-
uint32_t has_end_pulse
Whether there's an end pulse to terminate the transaction, if no, the transaction will be terminated by user configured transaction length
-
uint32_t pulse_invert
Whether to invert the pulse
-
struct parlio_rx_pulse_delimiter_config_t::[anonymous] flags
Extra flags
-
uint32_t valid_sig_line_id
-
struct parlio_rx_soft_delimiter_config_t
Configuration of soft delimiter.
Public Members
-
parlio_sample_edge_t sample_edge
Parallel IO sample edge
-
parlio_bit_pack_order_t bit_pack_order
Set how we pack the bits into one bytes, set 1 to pack the bits into a byte from LSB, otherwise from MSB
-
uint32_t eof_data_len
Set the data length to trigger the End Of Frame (EOF, i.e. transaction done) interrupt, if the data length is set to
0
, that mean the EOF will only triggers when the end pulse detected, please ensure there is an end pulse for a frame andparlio_rx_pulse_delimiter_config_t::has_end_pulse
flag is set
-
uint32_t timeout_ticks
The number of APB clock ticks to trigger timeout interrupt. Set 0 to disable the receive timeout interrupt
-
parlio_sample_edge_t sample_edge
-
struct parlio_receive_config_t
Configuration of a receive transaction.
Public Members
-
parlio_rx_delimiter_handle_t delimiter
The delimiter of this receiving transaction
-
uint32_t partial_rx_en
Whether this is an infinite transaction that supposed to receive continuously and partially
-
uint32_t indirect_mount
This flag only take effect when
partial_rx_en
is enabled. Enable this flag, an INTERNAL DMA buffer will be mounted to the DMA descriptor instead, The data will be copy to the payload in every interrupt. So that to guarantee the payload buffer is valid during theon_receive_done
callback. Eitherpartial_rx_en
orindirect_mount
is disabled, the user given finite payload will be mounted to the DMA descriptor directly. By default, the user given receive payload will be mounted to the DMA descriptor directly.
-
struct parlio_receive_config_t::[anonymous] flags
Extra flags
-
parlio_rx_delimiter_handle_t delimiter
-
struct parlio_rx_event_data_t
Event callback data.
Public Members
-
parlio_rx_delimiter_handle_t delimiter
The current delimiter of this receiving event
-
void *data
The data buffer address that just finished receiving
-
size_t recv_bytes
The number of received bytes in the data buffer
-
parlio_rx_delimiter_handle_t delimiter
-
struct parlio_rx_event_callbacks_t
Parallel IO RX event callbacks.
Public Members
-
parlio_rx_callback_t on_partial_receive
Callback of received partial data
-
parlio_rx_callback_t on_receive_done
Callback of receiving transaction done
-
parlio_rx_callback_t on_timeout
Callback of hardware receiving timeout
-
parlio_rx_callback_t on_partial_receive
Type Definitions
-
typedef bool (*parlio_rx_callback_t)(parlio_rx_unit_handle_t rx_unit, const parlio_rx_event_data_t *edata, void *user_data)
The template of the Parallel IO RX callback function.
- Param rx_unit
[in] Parallel IO RX unit handle that given from ISR
- Param edata
[in] The event data that given from ISR
- Param user_data
[in] The user specified data that given while registering the callbacks
- Return
True: to awoke high priority tasks
False: not to awoke high priority tasks
Header File
This header file can be included with:
#include "driver/parlio_types.h"
This header file is a part of the API provided by the
esp_driver_parlio
component. To declare that your component depends onesp_driver_parlio
, add the following to your CMakeLists.txt:REQUIRES esp_driver_parlio
or
PRIV_REQUIRES esp_driver_parlio
Type Definitions
-
typedef struct parlio_tx_unit_t *parlio_tx_unit_handle_t
Type of Parallel IO TX unit handle.
-
typedef struct parlio_rx_unit_t *parlio_rx_unit_handle_t
Type of Parallel IO RX unit handle.
-
typedef struct parlio_rx_delimiter_t *parlio_rx_delimiter_handle_t
Type of Parallel IO RX frame delimiter handle.
Header File
This header file can be included with:
#include "hal/parlio_types.h"
Macros
-
PARLIO_TX_UNIT_MAX_DATA_WIDTH
Maximum data width of TX unit.
-
PARLIO_RX_UNIT_MAX_DATA_WIDTH
Maximum data width of RX unit.
Type Definitions
-
typedef soc_periph_parlio_clk_src_t parlio_clock_source_t
Parallel IO clock source.
备注
User should select the clock source based on the power and resolution requirement
Enumerations
-
enum parlio_sample_edge_t
Parallel IO sample edge.
Values:
-
enumerator PARLIO_SAMPLE_EDGE_NEG
Sample data on falling edge of clock
-
enumerator PARLIO_SAMPLE_EDGE_POS
Sample data on rising edge of clock
-
enumerator PARLIO_SAMPLE_EDGE_NEG
-
enum parlio_bit_pack_order_t
Parallel IO bit packing order.
Data in memory: Byte 0: MSB < B0.7 B0.6 B0.5 B0.4 B0.3 B0.2 B0.1 B0.0 > LSB Byte 1: MSB < B1.7 B1.6 B1.5 B1.4 B1.3 B1.2 B1.1 B1.0 > LSB
Output on line (PARLIO_BIT_PACK_ORDER_LSB): Cycle 0 Cycle 1 Cycle 2 —> time GPIO 0: B0.0 B0.4 B1.0 GPIO 1: B0.1 B0.5 B1.1 GPIO 2: B0.2 B0.6 B1.2 GPIO 3: B0.3 B0.7 B1.3
Output on line (PARLIO_BIT_PACK_ORDER_MSB): Cycle 0 Cycle 1 Cycle 2 —> time GPIO 0: B0.4 B0.0 B1.4 GPIO 1: B0.5 B0.1 B1.5 GPIO 2: B0.6 B0.2 B1.6 GPIO 3: B0.7 B0.3 B1.7
Values:
-
enumerator PARLIO_BIT_PACK_ORDER_LSB
Bit pack order: LSB
-
enumerator PARLIO_BIT_PACK_ORDER_MSB
Bit pack order: MSB
-
enumerator PARLIO_BIT_PACK_ORDER_LSB
- 1
不同的 ESP 系列芯片可能具有不同数量的并行 IO TX/RX 实例,数据总线的最大宽度也会有所不同。更多信息,请参阅 ESP32-H2 技术参考手册 > 并行 IO 控制器 (PARLIO) 章节 [PDF]。驱动程序允许你创建更多的驱动程序对象,但当所有可用的硬件资源都被用完时,将会显示返回错误。在进行资源分配时,请时刻注意返回值 (e.g.,
parlio_new_tx_unit()
)。