RZV Flexible Software Package Documentation
Release v3.0.0
|
|
Interface for SPI communications.
Provides a common interface for communication using the SPI Protocol.
Data Structures | |
struct | spi_callback_args_t |
struct | spi_write_read_guard_args_t |
struct | spi_cfg_t |
struct | spi_api_t |
struct | spi_instance_t |
Typedefs | |
typedef void | spi_ctrl_t |
Enumerations | |
enum | spi_bit_width_t |
enum | spi_mode_t |
enum | spi_clk_phase_t |
enum | spi_clk_polarity_t |
enum | spi_mode_fault_t |
enum | spi_bit_order_t |
enum | spi_event_t |
struct spi_callback_args_t |
Common callback parameter definition
Data Fields | ||
---|---|---|
uint32_t | channel | Device channel number. |
spi_event_t | event | Event code. |
void const * | p_context | Context provided to user during callback. |
struct spi_write_read_guard_args_t |
Non-secure arguments for write-read guard function
struct spi_cfg_t |
SPI interface configuration
Data Fields | |
uint8_t | channel |
Channel number to be used. | |
IRQn_Type | rxi_irq |
Receive Buffer Full IRQ number. | |
IRQn_Type | txi_irq |
Transmit Buffer Empty IRQ number. | |
IRQn_Type | tei_irq |
Transfer Complete IRQ number. | |
IRQn_Type | eri_irq |
Error IRQ number. | |
uint8_t | rxi_ipl |
Receive Interrupt priority. | |
uint8_t | txi_ipl |
Transmit Interrupt priority. | |
uint8_t | tei_ipl |
Transfer Complete Interrupt priority. | |
uint8_t | eri_ipl |
Error Interrupt priority. | |
spi_mode_t | operating_mode |
Select master or slave operating mode. | |
spi_clk_phase_t | clk_phase |
Data sampling on odd or even clock edge. | |
spi_clk_polarity_t | clk_polarity |
Clock level when idle. | |
spi_mode_fault_t | mode_fault |
Mode fault error (master/slave conflict) flag. | |
spi_bit_order_t | bit_order |
Select to transmit MSB/LSB first. | |
transfer_instance_t const * | p_transfer_tx |
To use SPI DTC/DMAC write transfer, link a transfer instance here. Set to NULL if unused. | |
transfer_instance_t const * | p_transfer_rx |
To use SPI DTC/DMAC read transfer, link a transfer instance here. Set to NULL if unused. | |
void(* | p_callback )(spi_callback_args_t *p_args) |
Pointer to user callback function. | |
void const * | p_context |
User defined context passed to callback function. | |
void const * | p_extend |
Extended SPI hardware dependent configuration. | |
struct spi_api_t |
Shared Interface definition for SPI
Data Fields | |
fsp_err_t(* | open )(spi_ctrl_t *p_ctrl, spi_cfg_t const *const p_cfg) |
fsp_err_t(* | read )(spi_ctrl_t *const p_ctrl, void *p_dest, uint32_t const length, spi_bit_width_t const bit_width) |
fsp_err_t(* | write )(spi_ctrl_t *const p_ctrl, void const *p_src, uint32_t const length, spi_bit_width_t const bit_width) |
fsp_err_t(* | writeRead )(spi_ctrl_t *const p_ctrl, void const *p_src, void *p_dest, uint32_t const length, spi_bit_width_t const bit_width) |
fsp_err_t(* | callbackSet )(spi_ctrl_t *const p_ctrl, void(*p_callback)(spi_callback_args_t *), void const *const p_context, spi_callback_args_t *const p_callback_memory) |
fsp_err_t(* | close )(spi_ctrl_t *const p_ctrl) |
fsp_err_t(* spi_api_t::open) (spi_ctrl_t *p_ctrl, spi_cfg_t const *const p_cfg) |
Initialize a channel for SPI communication mode.
[in,out] | p_ctrl | Pointer to user-provided storage for the control block. |
[in] | p_cfg | Pointer to SPI configuration structure. |
fsp_err_t(* spi_api_t::read) (spi_ctrl_t *const p_ctrl, void *p_dest, uint32_t const length, spi_bit_width_t const bit_width) |
Receive data from a SPI device.
[in] | p_ctrl | Pointer to the control block for the channel. |
[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 | Number of units of data to be transferred (unit size specified by the bit_width). |
[in] | bit_width | Data bit width to be transferred. |
fsp_err_t(* spi_api_t::write) (spi_ctrl_t *const p_ctrl, void const *p_src, uint32_t const length, spi_bit_width_t const bit_width) |
Transmit data to a SPI device.
[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. |
[in] | length | Number of units of data to be transferred (unit size specified by the bit_width). |
[in] | bit_width | Data bit width to be transferred. |
fsp_err_t(* spi_api_t::writeRead) (spi_ctrl_t *const p_ctrl, void const *p_src, void *p_dest, uint32_t const length, spi_bit_width_t const bit_width) |
Simultaneously transmit data to a SPI device while receiving data from a SPI device (full duplex).
[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. The argument must not be NULL. |
[in] | length | Number of units of data to be transferred (unit size specified by the bit_width). |
[in] | bit_width | Data bit width to be transferred. |
fsp_err_t(* spi_api_t::callbackSet) (spi_ctrl_t *const p_ctrl, void(*p_callback)(spi_callback_args_t *), void const *const p_context, spi_callback_args_t *const p_callback_memory) |
Specify callback function and optional context pointer and working memory pointer.
[in] | p_ctrl | Pointer to the SPI control block. |
[in] | p_callback | Callback function |
[in] | p_context | Pointer to send to callback function |
[in] | p_working_memory | Pointer to volatile memory where callback structure can be allocated. Callback arguments allocated here are only valid during the callback. |
fsp_err_t(* spi_api_t::close) (spi_ctrl_t *const p_ctrl) |
Remove power to the SPI channel designated by the handle and disable the associated interrupts.
[in] | p_ctrl | Pointer to the control block for the channel. |
struct spi_instance_t |
This structure encompasses everything that is needed to use an instance of this interface.
Data Fields | ||
---|---|---|
spi_ctrl_t * | p_ctrl | Pointer to the control structure for this instance. |
spi_cfg_t const * | p_cfg | Pointer to the configuration structure for this instance. |
spi_api_t const * | p_api | Pointer to the API structure for this instance. |
typedef void spi_ctrl_t |
SPI control block. Allocate an instance specific control block to pass into the SPI API calls.
enum spi_bit_width_t |
Data bit width
enum spi_mode_t |
enum spi_clk_phase_t |
enum spi_clk_polarity_t |
enum spi_mode_fault_t |
Mode fault error flag. This error occurs when the device is setup as a master, but the SSLA line does not seem to be controlled by the master. This usually happens when the connecting device is also acting as master. A similar situation can also happen when configured as a slave.
Enumerator | |
---|---|
SPI_MODE_FAULT_ERROR_ENABLE | Mode fault error flag on. |
SPI_MODE_FAULT_ERROR_DISABLE | Mode fault error flag off. |
enum spi_bit_order_t |
enum spi_event_t |
SPI events