InPlay API
|
HAL_SPI. More...
Enumerations | |
enum | spi_id { MSPI_ID, SSPI0_ID, SSPI1_ID } |
SPI ID. More... | |
enum | spi_fmt { SPI_STD_FMT, SPI_DUAL_FMT, SPI_QUAD_FMT } |
SPI format. More... | |
enum | spi_tmod { SPI_TMOD_TX_AND_RX, SPI_TMOD_TX_ONLY, SPI_TMOD_RX_ONLY, SPI_TMOD_EEPROM_READ } |
SPI transfer mode. More... | |
enum | spi_dfs_bit |
SPI data frame size. | |
enum | spi_err |
SPI error code. | |
enum | spi_dir |
SPI DMA direction. | |
enum | spi_mstr_cs |
SPI CS (master only) | |
enum | qspi_cmd_width |
Dual or Quad SPI command width. | |
enum | qspi_addr_width |
Dual or Quad SPI address width. | |
enum | qspi_ttype |
Quad SPI command and address transfer type. | |
Functions | |
void * | hal_spi_open (int id, int speed, int phase, int polarity, int prio) |
Open the SPI driver. More... | |
int | hal_spi_close (void *hdl) |
Close the SPI driver. More... | |
int | hal_spi_int_prio (void *hdl, int prio) |
Set SPI interrupt priority. More... | |
int | hal_spi_tx_non_block (void *hdl, int cs, int dfs, void *buffer, uint16_t buffer_len, void *arg, void(*callback)(void *arg, int status, uint16_t size)) |
Master or Slave SPI transmit function. More... | |
int | hal_spi_rx_non_block (void *hdl, int cs, int dfs, void *buffer, uint16_t buffer_len, void *arg, void(*callback)(void *arg, int status, uint16_t size)) |
Master or Slave SPI Receive function. More... | |
int | hal_spi_trx_non_block (void *hdl, int cs, int dfs, void *wbuf, void *rbuf, uint16_t buf_len, void *arg, void(*callback)(void *arg, int status, uint16_t actual_size)) |
Master or Slave SPI Transmit and Receive function (bi-direction) More... | |
int | hal_spi_tx_dma (void *hdl, int cs, void *buffer, uint16_t buffer_len, uint16_t *actual_size) |
Master or Slave SPI transmit DMA function. More... | |
int | hal_spi_rx_dma (void *hdl, int cs, void *buffer, uint16_t buffer_len, uint16_t *actual_size) |
Master or Slave SPI Receive DMA function. More... | |
int | hal_spi_trx_dma (void *hdl, int cs, void *wbuf, void *rbuf, uint16_t buffer_len, uint16_t *actual_size) |
Master or Slave SPI Transmit and Receive DMA function (bi-direction) More... | |
int | hal_slv_spi_tx (void *hdl, int phase, int polarity, int dfs, void *buf, uint16_t buf_len, uint16_t *wlen) |
Slave SPI transmit function. More... | |
int | hal_slv_spi_rx (void *hdl, int phase, int polarity, int dfs, void *buf, uint16_t buf_len, uint16_t *rlen) |
Slave SPI Receive function. More... | |
int | hal_slv_spi_trx (void *hdl, int phase, int polarity, int dfs, void *wbuf, void *rbuf, uint16_t buf_len, uint16_t *wlen, uint16_t *rlen) |
Slave SPI Transmit and Receive function (bi-direction) More... | |
void | hal_slv_spi_stop (void *hdl) |
Slave SPI stop function. More... | |
int | hal_spi_busy (void *hdl) |
Get SPI busy status. More... | |
int | hal_spi_trx_dma_chain_start (void *hdl, int cs, int speed, int phase, int polarity, int dfs, void *wbuf[2], void *rbuf[2], uint16_t buffer_len, void *arg, void(*callback)(void *arg, int dir, int id, int status)) |
Master SPI Transmit and Receive DMA block chain function (bi-direction) More... | |
int | hal_spi_trx_dma_chain_stop (void *hdl) |
Master or Slave SPI Transmit and Receive DMA block chain function (bi-direction) More... | |
HAL_SPI.
enum spi_fmt |
enum spi_id |
enum spi_tmod |
int hal_slv_spi_rx | ( | void * | hdl, |
int | phase, | ||
int | polarity, | ||
int | dfs, | ||
void * | buf, | ||
uint16_t | buf_len, | ||
uint16_t * | rlen | ||
) |
Slave SPI Receive function.
[in] | hdl | The handle from the "open" function call. |
[in] | phase | The SPI clock phase. 0: first edge of SPI clock, 1: trailing edge of SPI clock. |
[in] | polarity | The SPI clock polarity. 0: rising, 1: falling. |
[in] | dfs | The data frame size, |
[in] | buffer | The void pointer point to the RX buffer. This pointer, depends on the data frame size, will be cast by the driver to byte, short, or long. |
[in] | buffer_len | The RX buffer length. |
[out] | rlen | Actual RX length. |
void hal_slv_spi_stop | ( | void * | hdl | ) |
Slave SPI stop function.
[in] | hdl | The handle from the "open" function call. |
int hal_slv_spi_trx | ( | void * | hdl, |
int | phase, | ||
int | polarity, | ||
int | dfs, | ||
void * | wbuf, | ||
void * | rbuf, | ||
uint16_t | buf_len, | ||
uint16_t * | wlen, | ||
uint16_t * | rlen | ||
) |
Slave SPI Transmit and Receive function (bi-direction)
[in] | hdl | The handle from the "open" function call. |
[in] | phase | The SPI clock phase. 0: first edge of SPI clock, 1: trailing edge of SPI clock. |
[in] | polarity | The SPI clock polarity. 0: rising, 1: falling. |
[in] | dfs | The data frame size, |
[in] | wbuf | The void pointer point to the TX buffer. This pointer, depends on the data frame size, will be cast by the driver to byte, short, or long. |
[in] | rbuf | The void pointer point to the RX buffer. This pointer, depends on the data frame size, will be cast by the driver to byte, short, or long. |
[in] | buf_len | The TX and RX buffer length. |
[out] | wlen | Actual TX length. |
[out] | rlen | Actual RX length. |
int hal_slv_spi_tx | ( | void * | hdl, |
int | phase, | ||
int | polarity, | ||
int | dfs, | ||
void * | buf, | ||
uint16_t | buf_len, | ||
uint16_t * | wlen | ||
) |
Slave SPI transmit function.
Experimental slave SPI API
[in] | hdl | The handle from the "open" function call. |
[in] | phase | The SPI clock phase. 0: first edge of SPI clock, 1: trailing edge of SPI clock. |
[in] | polarity | The SPI clock polarity. 0: rising, 1: falling. |
[in] | dfs | The data frame size, |
[in] | buffer | The void pointer point to the TX buffer. This pointer, depends on the data frame size, will be cast by the driver to byte, short, or long. |
[in] | buffer_len | The TX buffer length. |
[out] | wlen | Actual TX length. |
int hal_spi_busy | ( | void * | hdl | ) |
Get SPI busy status.
[in] | hdl | The handle from the "open" function call. |
int hal_spi_close | ( | void * | hdl | ) |
Close the SPI driver.
[in] | hdl | The handle from the "open" function call. |
int hal_spi_int_prio | ( | void * | hdl, |
int | prio | ||
) |
Set SPI interrupt priority.
[in] | hdl | The handle from the "open" function call. |
[in] | prio | Interrupt priority. |
void* hal_spi_open | ( | int | id, |
int | speed, | ||
int | phase, | ||
int | polarity, | ||
int | prio | ||
) |
Open the SPI driver.
[in] | id | The SPI ID, |
int hal_spi_rx_dma | ( | void * | hdl, |
int | cs, | ||
void * | buffer, | ||
uint16_t | buffer_len, | ||
uint16_t * | actual_size | ||
) |
Master or Slave SPI Receive DMA function.
[in] | hdl | The handle from the "open" function call. |
[in] | cs | The SPI slave select. This is only valid for master SPI and the possible value are 0 or 1. |
[in] | speed | The SPI serial clock rate. They can be 16, 8, 4, 2, or 1 Mhz. Only for master. |
[in] | phase | The SPI clock phase. 0: first edge of SPI clock, 1: trailing edge of SPI clock. |
[in] | polarity | The SPI clock polarity. 0: rising, 1: falling. |
[in] | dfs | The data frame size, |
[in] | buffer | The void pointer point to the RX buffer. This pointer, depends on the data frame size, will be cast by the driver to byte, short, or long. |
[in] | buffer_len | The RX buffer length. |
int hal_spi_rx_non_block | ( | void * | hdl, |
int | cs, | ||
int | dfs, | ||
void * | buffer, | ||
uint16_t | buffer_len, | ||
void * | arg, | ||
void(*)(void *arg, int status, uint16_t size) | callback | ||
) |
Master or Slave SPI Receive function.
[in] | hdl | The handle from the "open" function call. |
[in] | cs | The SPI slave select. This is only valid for master SPI and the possible value are 0 or 1. |
[in] | speed | The SPI serial clock rate. They can be 16, 8, 4, 2, or 1 Mhz. Only for master. |
[in] | phase | The SPI clock phase. 0: first edge of SPI clock, 1: trailing edge of SPI clock. |
[in] | polarity | The SPI clock polarity. 0: rising, 1: falling. |
[in] | dfs | The data frame size, |
[in] | buffer | The void pointer point to the RX buffer. This pointer, depends on the data frame size, will be cast by the driver to byte, short, or long. |
[in] | buffer_len | The RX buffer length. |
int hal_spi_trx_dma | ( | void * | hdl, |
int | cs, | ||
void * | wbuf, | ||
void * | rbuf, | ||
uint16_t | buffer_len, | ||
uint16_t * | actual_size | ||
) |
Master or Slave SPI Transmit and Receive DMA function (bi-direction)
[in] | hdl | The handle from the "open" function call. |
[in] | cs | The SPI slave select. This is only valid for master SPI and the possible value are 0 or 1. |
[in] | speed | The SPI serial clock rate. They can be 16, 8, 4, 2, or 1 Mhz. Only for master. |
[in] | phase | The SPI clock phase. 0: first edge of SPI clock, 1: trailing edge of SPI clock. |
[in] | polarity | The SPI clock polarity. 0: rising, 1: falling. |
[in] | dfs | The data frame size, |
[in] | wbuf | The void pointer point to the TX buffer. This pointer, depends on the data frame size, will be cast by the driver to byte, short, or long. |
[in] | rbuf | The void pointer point to the RX buffer. This pointer, depends on the data frame size, will be cast by the driver to byte, short, or long. |
[in] | buffer_len | The TX and RX buffer length. |
int hal_spi_trx_dma_chain_start | ( | void * | hdl, |
int | cs, | ||
int | speed, | ||
int | phase, | ||
int | polarity, | ||
int | dfs, | ||
void * | wbuf[2], | ||
void * | rbuf[2], | ||
uint16_t | buffer_len, | ||
void * | arg, | ||
void(*)(void *arg, int dir, int id, int status) | callback | ||
) |
Master SPI Transmit and Receive DMA block chain function (bi-direction)
[in] | hdl | The handle from the "open" function call. |
[in] | cs | The SPI slave select. This is only valid for master SPI and the possible value are 0 or 1. |
[in] | speed | The SPI serial clock rate. They can be 16, 8, 4, 2, or 1 Mhz. Only for master. |
[in] | phase | The SPI clock phase. 0: first edge of SPI clock, 1: trailing edge of SPI clock. |
[in] | polarity | The SPI clock polarity. 0: rising, 1: falling. |
[in] | dfs | The data frame size, |
[in] | wbuf | The ping/pong buffers pointer array for the TX. This pointer, depends on the data frame size, will be cast by the driver to byte, short, or long. |
[in] | rbuf | The ping/pong buffer pointer array for the RX. This pointer, depends on the data frame size, will be cast by the driver to byte, short, or long. |
[in] | buffer_len | The ping/pong buffer size. |
[in] | arg | The user provided argument for the ping/pong completed call back function. |
[in] | callback | The user provided ping/pong completed call back function: |
int hal_spi_trx_dma_chain_stop | ( | void * | hdl | ) |
Master or Slave SPI Transmit and Receive DMA block chain function (bi-direction)
[in] | hdl | The handle from the "open" function call. |
int hal_spi_trx_non_block | ( | void * | hdl, |
int | cs, | ||
int | dfs, | ||
void * | wbuf, | ||
void * | rbuf, | ||
uint16_t | buf_len, | ||
void * | arg, | ||
void(*)(void *arg, int status, uint16_t actual_size) | callback | ||
) |
Master or Slave SPI Transmit and Receive function (bi-direction)
[in] | hdl | The handle from the "open" function call. |
[in] | cs | The SPI slave select. This is only valid for master SPI and the possible value are 0 or 1. |
[in] | speed | The SPI serial clock rate. They can be 16, 8, 4, 2, or 1 Mhz. Only for master. |
[in] | phase | The SPI clock phase. 0: first edge of SPI clock, 1: trailing edge of SPI clock. |
[in] | polarity | The SPI clock polarity. 0: rising, 1: falling. |
[in] | dfs | The data frame size, |
[in] | wbuf | The void pointer point to the TX buffer. This pointer, depends on the data frame size, will be cast by the driver to byte, short, or long. |
[in] | rbuf | The void pointer point to the RX buffer. This pointer, depends on the data frame size, will be cast by the driver to byte, short, or long. |
[in] | buf_len | The TX and RX buffer length. |
int hal_spi_tx_dma | ( | void * | hdl, |
int | cs, | ||
void * | buffer, | ||
uint16_t | buffer_len, | ||
uint16_t * | actual_size | ||
) |
Master or Slave SPI transmit DMA function.
[in] | hdl | The handle from the "open" function call. |
[in] | cs | The SPI slave select. This is only valid for SPI master and the possible value are 0 or 1. |
[in] | speed | The SPI serial clock rate. They can be 16, 8, 4, 2, or 1 Mhz. Only for master. |
[in] | phase | The SPI clock phase. 0: first edge of SPI clock, 1: trailing edge of SPI clock. |
[in] | polarity | The SPI clock polarity. 0: rising, 1: falling. |
[in] | dfs | The data frame size, |
[in] | buffer | The void pointer point to the TX buffer. This pointer, depends on the data frame size, will be cast by the driver to byte, short, or long. |
[in] | buffer_len | The TX buffer length. |
int hal_spi_tx_non_block | ( | void * | hdl, |
int | cs, | ||
int | dfs, | ||
void * | buffer, | ||
uint16_t | buffer_len, | ||
void * | arg, | ||
void(*)(void *arg, int status, uint16_t size) | callback | ||
) |
Master or Slave SPI transmit function.
[in] | hdl | The handle from the "open" function call. |
[in] | cs | The SPI slave select. This is only valid for SPI master and the possible value are 0 or 1. |
[in] | speed | The SPI serial clock rate. They can be 16, 8, 4, 2, or 1 Mhz. Only for master. |
[in] | phase | The SPI clock phase. 0: first edge of SPI clock, 1: trailing edge of SPI clock. |
[in] | polarity | The SPI clock polarity. 0: rising, 1: falling. |
[in] | dfs | The data frame size, |
[in] | buffer | The void pointer point to the TX buffer. This pointer, depends on the data frame size, will be cast by the driver to byte, short, or long. |
[in] | buffer_len | The TX buffer length. |