Data transfer functions. More...
Functions | |
hal_status_t | hal_spi_transmit (spi_handle_t *p_spi, uint8_t *p_data, uint32_t length, uint32_t timeout) |
Transmit an amount of data in blocking mode. More... | |
hal_status_t | hal_spi_receive (spi_handle_t *p_spi, uint8_t *p_data, uint32_t length, uint32_t timeout) |
Receive an amount of data in blocking mode. More... | |
hal_status_t | hal_spi_transmit_receive (spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t length, uint32_t timeout) |
Transmit and Receive an amount of data in blocking mode. More... | |
hal_status_t | hal_spi_read_eeprom (spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_number_data, uint32_t rx_number_data, uint32_t timeout) |
Read an amount of data from EEPROM in blocking mode. More... | |
hal_status_t | hal_spi_transmit_it (spi_handle_t *p_spi, uint8_t *p_data, uint32_t length) |
Transmit an amount of data in non-blocking mode with Interrupt. More... | |
hal_status_t | hal_spi_receive_it (spi_handle_t *p_spi, uint8_t *p_data, uint32_t length) |
Receive an amount of data in non-blocking mode with Interrupt. More... | |
hal_status_t | hal_spi_transmit_receive_it (spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t length) |
Transmit and Receive an amount of data in non-blocking mode with Interrupt. More... | |
hal_status_t | hal_spi_read_eeprom_it (spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_number_data, uint32_t rx_number_data) |
Read an amount of data from EEPROM in non-blocking mode with Interrupt. More... | |
hal_status_t | hal_spi_transmit_dma (spi_handle_t *p_spi, uint8_t *p_data, uint32_t length) |
Transmit an amount of data in non-blocking mode with DMA. More... | |
hal_status_t | hal_spi_receive_dma (spi_handle_t *p_spi, uint8_t *p_data, uint32_t length) |
Receive an amount of data in non-blocking mode with DMA. More... | |
hal_status_t | hal_spi_transmit_receive_dma (spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t length) |
Transmit and Receive an amount of data in non-blocking mode with DMA. More... | |
hal_status_t | hal_spi_read_eeprom_dma (spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_number_data, uint32_t rx_number_data) |
Read an amount of data from EEPROM in non-blocking mode with DMA. More... | |
hal_status_t | hal_spi_transmit_dma_llp (spi_handle_t *p_spi, dma_llp_config_t *p_llp_config, uint32_t data_length) |
Transmit an amount of data in non-blocking mode with DMA LLP. More... | |
hal_status_t | hal_spi_read_eeprom_dma_scatter (spi_handle_t *p_spi, uint8_t *p_tx_data, uint32_t tx_data_length, uint8_t *p_rx_data, uint32_t rx_data_length, uint32_t sct_interval, uint32_t sct_count) |
Receive an amount of data in non-blocking mode with DMA. More... | |
hal_status_t | hal_spi_transmit_with_ia (spi_handle_t *p_spi, uint8_t inst, uint32_t addr, uint8_t *p_data, uint32_t length, uint32_t timeout) |
Transmit an amount of data in non-blocking mode with polling. Support Setting C&A. More... | |
hal_status_t | hal_spi_transmit_dma_with_ia (spi_handle_t *p_spi, uint8_t inst, uint32_t addr, uint8_t *p_data, uint32_t length) |
Transmit an amount of data in non-blocking mode with DMA. Support Setting C&A. More... | |
hal_status_t | hal_spi_abort (spi_handle_t *p_spi) |
Abort ongoing transfer (blocking mode). More... | |
hal_status_t | hal_spi_abort_it (spi_handle_t *p_spi) |
Abort ongoing transfer (Interrupt mode). More... | |
Data transfer functions.
============================================================================== ##### SPI operation functions ##### =============================================================================== [..] This subsection provides a set of functions allowing to manage the SPI data transfer. [..] The SPI supports master and slave mode: (#) There are two modes of transfer: (++) Blocking mode: The communication is performed in polling mode. The HAL status of all data processing is returned by the same function after finishing transfer. (++) No-Blocking mode: The communication is performed using Interrupts or DMA, These APIs return the HAL status. The end of the data processing will be indicated through the dedicated SPI IRQ when using Interrupt mode or the DMA IRQ when using DMA mode. The hal_spi_tx_cplt_callback(), hal_spi_rx_cplt_callback() and hal_spi_txrx_cplt_callback() user callbacks will be executed respectively at the end of the transmit or Receive process The hal_spi_error_callback() user callback will be executed when a communication error is detected. (#) APIs provided for these 2 transfer modes (Blocking mode or Non blocking mode using either Interrupt or DMA) exist for 1-Line (simplex) and 2-Line (full duplex) modes.
hal_status_t hal_spi_abort | ( | spi_handle_t * | p_spi | ) |
Abort ongoing transfer (blocking mode).
[in] | p_spi | SPI handle. |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_spi_abort_it | ( | spi_handle_t * | p_spi | ) |
Abort ongoing transfer (Interrupt mode).
[in] | p_spi | SPI handle. |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_spi_read_eeprom | ( | spi_handle_t * | p_spi, |
uint8_t * | p_tx_data, | ||
uint8_t * | p_rx_data, | ||
uint32_t | tx_number_data, | ||
uint32_t | rx_number_data, | ||
uint32_t | timeout | ||
) |
Read an amount of data from EEPROM in blocking mode.
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | p_tx_data | Pointer to transmission data buffer |
[out] | p_rx_data | Pointer to reception data buffer |
[in] | tx_number_data | Amount of data to be sent in bytes |
[in] | rx_number_data | Amount of data to be received in bytes |
[in] | timeout | Timeout duration |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_spi_read_eeprom_dma | ( | spi_handle_t * | p_spi, |
uint8_t * | p_tx_data, | ||
uint8_t * | p_rx_data, | ||
uint32_t | tx_number_data, | ||
uint32_t | rx_number_data | ||
) |
Read an amount of data from EEPROM in non-blocking mode with DMA.
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | p_tx_data | Pointer to transmission data buffer |
[out] | p_rx_data | Pointer to reception data buffer |
[in] | tx_number_data | Amount of data to be sent in bytes |
[in] | rx_number_data | Amount of data to be received in bytes, ranging between 0 and 4095. |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_spi_read_eeprom_dma_scatter | ( | spi_handle_t * | p_spi, |
uint8_t * | p_tx_data, | ||
uint32_t | tx_data_length, | ||
uint8_t * | p_rx_data, | ||
uint32_t | rx_data_length, | ||
uint32_t | sct_interval, | ||
uint32_t | sct_count | ||
) |
Receive an amount of data in non-blocking mode with DMA.
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | p_tx_data | Pointer to transmit data buffer |
[in] | tx_data_length | Amount of data to be sent in bytes |
[in] | p_rx_data | Pointer to receive data buffer |
[in] | rx_data_length | Amount of data to be received in bytes |
[in] | sct_interval | Scatter interval in beat |
[in] | sct_count | Scatter count in beat |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_spi_read_eeprom_it | ( | spi_handle_t * | p_spi, |
uint8_t * | p_tx_data, | ||
uint8_t * | p_rx_data, | ||
uint32_t | tx_number_data, | ||
uint32_t | rx_number_data | ||
) |
Read an amount of data from EEPROM in non-blocking mode with Interrupt.
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | p_tx_data | Pointer to transmission data buffer |
[out] | p_rx_data | Pointer to reception data buffer |
[in] | tx_number_data | Amount of data to be sent in bytes |
[in] | rx_number_data | Amount of data to be received in bytes |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_spi_receive | ( | spi_handle_t * | p_spi, |
uint8_t * | p_data, | ||
uint32_t | length, | ||
uint32_t | timeout | ||
) |
Receive an amount of data in blocking mode.
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[out] | p_data | Pointer to data buffer |
[in] | length | Amount of data to be received in bytes |
[in] | timeout | Timeout duration |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_spi_receive_dma | ( | spi_handle_t * | p_spi, |
uint8_t * | p_data, | ||
uint32_t | length | ||
) |
Receive an amount of data in non-blocking mode with DMA.
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[out] | p_data | Pointer to data buffer |
[in] | length | Amount of data to be sent in bytes, ranging between 0 and 4095. |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_spi_receive_it | ( | spi_handle_t * | p_spi, |
uint8_t * | p_data, | ||
uint32_t | length | ||
) |
Receive an amount of data in non-blocking mode with Interrupt.
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[out] | p_data | Pointer to data buffer |
[in] | length | Amount of data to be sent in bytes |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_spi_transmit | ( | spi_handle_t * | p_spi, |
uint8_t * | p_data, | ||
uint32_t | length, | ||
uint32_t | timeout | ||
) |
Transmit an amount of data in blocking mode.
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | p_data | Pointer to data buffer |
[in] | length | Amount of data to be sent in bytes |
[in] | timeout | Timeout duration |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_spi_transmit_dma | ( | spi_handle_t * | p_spi, |
uint8_t * | p_data, | ||
uint32_t | length | ||
) |
Transmit an amount of data in non-blocking mode with DMA.
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | p_data | Pointer to data buffer |
[in] | length | Amount of data to be sent in bytes, ranging between 0 and 4095. |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_spi_transmit_dma_llp | ( | spi_handle_t * | p_spi, |
dma_llp_config_t * | p_llp_config, | ||
uint32_t | data_length | ||
) |
Transmit an amount of data in non-blocking mode with DMA LLP.
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | p_llp_config | Pointer to Linked List Block |
[in] | data_length | Total data in all Blocks to be transmitted, unit in Byte |
hal_status_t hal_spi_transmit_dma_with_ia | ( | spi_handle_t * | p_spi, |
uint8_t | inst, | ||
uint32_t | addr, | ||
uint8_t * | p_data, | ||
uint32_t | length | ||
) |
Transmit an amount of data in non-blocking mode with DMA. Support Setting C&A.
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | inst | 1 byte instruction |
[in] | addr | 3 bytes address |
[in] | p_data | Pointer to data buffer |
[in] | length | Amount of data to be sent in bytes, ranging between 0 and 4095. |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_spi_transmit_it | ( | spi_handle_t * | p_spi, |
uint8_t * | p_data, | ||
uint32_t | length | ||
) |
Transmit an amount of data in non-blocking mode with Interrupt.
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | p_data | Pointer to data buffer |
[in] | length | Amount of data to be sent in bytes |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_spi_transmit_receive | ( | spi_handle_t * | p_spi, |
uint8_t * | p_tx_data, | ||
uint8_t * | p_rx_data, | ||
uint32_t | length, | ||
uint32_t | timeout | ||
) |
Transmit and Receive an amount of data in blocking mode.
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | p_tx_data | Pointer to transmission data buffer |
[out] | p_rx_data | Pointer to reception data buffer |
[in] | length | Amount of data to be sent and received in bytes |
[in] | timeout | Timeout duration |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_spi_transmit_receive_dma | ( | spi_handle_t * | p_spi, |
uint8_t * | p_tx_data, | ||
uint8_t * | p_rx_data, | ||
uint32_t | length | ||
) |
Transmit and Receive an amount of data in non-blocking mode with DMA.
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | p_tx_data | Pointer to transmission data buffer |
[out] | p_rx_data | Pointer to reception data buffer |
[in] | length | Amount of data to be sent in bytes, ranging between 0 and 4095. |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_spi_transmit_receive_it | ( | spi_handle_t * | p_spi, |
uint8_t * | p_tx_data, | ||
uint8_t * | p_rx_data, | ||
uint32_t | length | ||
) |
Transmit and Receive an amount of data in non-blocking mode with Interrupt.
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | p_tx_data | Pointer to transmission data buffer |
[out] | p_rx_data | Pointer to reception data buffer |
[in] | length | Amount of data to be sent and received in bytes |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_spi_transmit_with_ia | ( | spi_handle_t * | p_spi, |
uint8_t | inst, | ||
uint32_t | addr, | ||
uint8_t * | p_data, | ||
uint32_t | length, | ||
uint32_t | timeout | ||
) |
Transmit an amount of data in non-blocking mode with polling. Support Setting C&A.
[in] | p_spi | Pointer to an SPI handle which contains the configuration information for the specified SPI module. |
[in] | inst | 1 byte instruction |
[in] | addr | 3 bytes address |
[in] | p_data | Pointer to data buffer |
[in] | length | Amount of data to be sent in bytes, ranging between 0 and 4095. |
[in] | timeout | Timeout duration |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |