![]() |
Synergy Software Package User's Manual
|
#include <sf_spi_api.h>
Data Fields | |
| ssp_err_t(* | open )(sf_spi_ctrl_t *p_ctrl, sf_spi_cfg_t const *const p_cfg) |
| Open a designated SPI device on a bus. More... | |
| ssp_err_t(* | read )(sf_spi_ctrl_t *const p_ctrl, void *const p_dest, uint32_t const length, spi_bit_width_t const bit_width, uint32_t const timeout) |
| Receive data from SPI device. More... | |
| ssp_err_t(* | write )(sf_spi_ctrl_t *const p_ctrl, void *const p_src, uint32_t const length, spi_bit_width_t const bit_width, uint32_t const timeout) |
| Transmit data to SPI device. More... | |
| ssp_err_t(* | writeRead )(sf_spi_ctrl_t *const p_ctrl, void *const p_src, void *const p_dest, uint32_t const length, spi_bit_width_t const bit_width, uint32_t const timeout) |
| Simultaneously transmit data to an SPI device while receiving data from an SPI device (full duplex). More... | |
| ssp_err_t(* | close )(sf_spi_ctrl_t *const p_ctrl) |
| Disable the SPI device designated by the control handle and close the RTOS services used by the bus if no devices are connected to the bus. This function removes power to the SPI channel designated by the handle and disables the associated interrupts. More... | |
| ssp_err_t(* | lock )(sf_spi_ctrl_t *const p_ctrl) |
| Lock the bus for a device. The locking allows devices to reserve a bus to themselves for a given period of time (i.e. between lock and unlock). This allows devices to complete several reads and writes on the bus without interrupt. More... | |
| ssp_err_t(* | lockWait )(sf_spi_ctrl_t *const p_ctrl, uint32_t const timeout) |
| Lock the bus for a device. The locking allows devices to reserve a bus to themselves for a given period of time (i.e. between lock and unlock). This allows devices to complete several reads and writes on the bus without interrupt. The wait option allows thread to wait for the specified timeout when acquiring the bus mutex. More... | |
| ssp_err_t(* | unlock )(sf_spi_ctrl_t *const p_ctrl) |
| Unlock the bus for a particular device and make the bus usable for other devices. More... | |
| ssp_err_t(* | version )(ssp_version_t *const p_version) |
| Get the version information of the underlying driver. More... | |
Definition of the SPI framework interface.
| ssp_err_t(* sf_spi_api_t::close) (sf_spi_ctrl_t *const p_ctrl) |
Disable the SPI device designated by the control handle and close the RTOS services used by the bus if no devices are connected to the bus. This function removes power to the SPI channel designated by the handle and disables the associated interrupts.
| [in] | p_ctrl | Pointer to the control block for the device. |
| ssp_err_t(* sf_spi_api_t::lock) (sf_spi_ctrl_t *const p_ctrl) |
Lock the bus for a device. The locking allows devices to reserve a bus to themselves for a given period of time (i.e. between lock and unlock). This allows devices to complete several reads and writes on the bus without interrupt.
| [in] | p_ctrl | Pointer to the control block for the device. |
| ssp_err_t(* sf_spi_api_t::lockWait) (sf_spi_ctrl_t *const p_ctrl, uint32_t const timeout) |
Lock the bus for a device. The locking allows devices to reserve a bus to themselves for a given period of time (i.e. between lock and unlock). This allows devices to complete several reads and writes on the bus without interrupt. The wait option allows thread to wait for the specified timeout when acquiring the bus mutex.
| [in] | p_ctrl | Pointer to the control block for the device. |
| [in] | timeout | ThreadX timeout. Options include TX_NO_WAIT (0x00000000), TX_WAIT_FOREVER (0xFFFFFFFF), and timeout value (0x00000001 through 0xFFFFFFFE) in ThreadX tick counts. |
| ssp_err_t(* sf_spi_api_t::open) (sf_spi_ctrl_t *p_ctrl, sf_spi_cfg_t const *const p_cfg) |
Open a designated SPI device on a bus.
| [in,out] | p_ctrl | Pointer to user-provided storage for the control block. |
| [in] | p_cfg | Pointer to SPI Framework configuration structure. |
| ssp_err_t(* sf_spi_api_t::read) (sf_spi_ctrl_t *const p_ctrl, void *const p_dest, uint32_t const length, spi_bit_width_t const bit_width, uint32_t const timeout) |
Receive data from SPI device.
| [in] | p_ctrl | Pointer to the control block for the device. |
| [out] | p_dest | Pointer to destination buffer into which data will be copied that is received from a SPI device. It is the responsibility of the caller to ensure that adequate space is available to hold the requested data count. |
| [in] | length | Indicates the number of units of data to be transferred (unit size specified by the bit_width). |
| [in] | bit_width | Indicates data bit width to be transferred. |
| [in] | timeout | Timeout. Options include TX_NO_WAIT (0x00000000), TX_WAIT_FOREVER (0xFFFFFFFF), and timeout value (0x00000001 through 0xFFFFFFFE) in ThreadX tick counts. |
| ssp_err_t(* sf_spi_api_t::unlock) (sf_spi_ctrl_t *const p_ctrl) |
Unlock the bus for a particular device and make the bus usable for other devices.
| [in] | p_ctrl | Pointer to the control block for the device. |
| ssp_err_t(* sf_spi_api_t::version) (ssp_version_t *const p_version) |
Get the version information of the underlying driver.
| [out] | p_version | pointer to memory location to return version number |
| ssp_err_t(* sf_spi_api_t::write) (sf_spi_ctrl_t *const p_ctrl, void *const p_src, uint32_t const length, spi_bit_width_t const bit_width, uint32_t const timeout) |
Transmit data to SPI device.
| [in] | p_ctrl | Pointer to the control block for the device. |
| [in] | p_src | Pointer to a source data buffer from which data will be transmitted to a SPI device. The argument must not be NULL. |
| [in] | length | Indicates the number of units of data to be transferred (unit size specified by the bit_width). |
| [in] | bit_width | Indicates data bit width to be transferred. |
| [in] | timeout | Timeout. Options include TX_NO_WAIT (0x00000000), TX_WAIT_FOREVER (0xFFFFFFFF), and timeout value (0x00000001 through 0xFFFFFFFE) in ThreadX tick counts. |
| ssp_err_t(* sf_spi_api_t::writeRead) (sf_spi_ctrl_t *const p_ctrl, void *const p_src, void *const p_dest, uint32_t const length, spi_bit_width_t const bit_width, uint32_t const timeout) |
Simultaneously transmit data to an SPI device while receiving data from an SPI device (full duplex).
The writeread API gets mutex object, handles SPI data transmission at SPI HAL layer and receive data from the SPI HAL layer. The API uses the event flag wait to synchronize to completion of data transfer .
| [in] | p_ctrl | Pointer to the control block for the channel. |
| [in] | p_src | Pointer to a source data buffer from which data will be transmitted to a SPI device. The argument must not be NULL. |
| [out] | p_dest | Pointer to destination buffer into which data will be copied that is received from a SPI device. It is the responsibility of the caller to ensure that adequate space is available to hold the requested data count. |
| [in] | length | Indicates the number of units of data to be transferred (unit size specified by the bit_width). |
| [in] | bit_width | Indicates data bit width to be transferred. |
| [in] | timeout | Timeout. Options include TX_NO_WAIT (0x00000000), TX_WAIT_FOREVER (0xFFFFFFFF), and timeout value (0x00000001 through 0xFFFFFFFE) in ThreadX tick counts. |