Altera HWLIB  16.0
The Altera HW Manager API Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups
SPI Slave Controller Transfer Functions

Description

The transfer functions in this group are for SPI controllers configured as slaves.

Functions

ALT_STATUS_CODE alt_spi_slave_tx_rx_transfer (ALT_SPI_DEV_t *spi_dev, const uint16_t *tx_buf, uint16_t *rx_buf, const size_t buf_len)
 
ALT_STATUS_CODE alt_spi_slave_tx_transfer (ALT_SPI_DEV_t *spi_dev, const uint16_t *tx_buf, const size_t buf_len)
 
ALT_STATUS_CODE alt_spi_slave_rx_transfer (ALT_SPI_DEV_t *spi_dev, uint16_t *rx_buf, const size_t buf_len)
 

Function Documentation

ALT_STATUS_CODE alt_spi_slave_tx_rx_transfer ( ALT_SPI_DEV_t *  spi_dev,
const uint16_t *  tx_buf,
uint16_t *  rx_buf,
const size_t  buf_len 
)

This function performs a slave SPI/SSP serial transmit and receive transfer.

This API is suitable for being called during an interrupt context. It is the programmer's responsibility to ensure that there is enough space in the TX FIFO and space in the RX FIFO to accomodate the request made.

Parameters
spi_devA pointer to the SPI controller device block instance.
tx_bufA buffer of data frames to transmit. The tx_buf element type is sized large enough to contain the widest possible data frame size. The data in each frame should be right justified within its tx_buf element.
rx_buf[out] An buffer to receive data frames sent from the master. The buffer is expected to be at least buf_len data frames in length.
buf_lenThe length in data frames of the tx_buf and rx_buf buffers.
Return values
ALT_E_SUCCESSSuccessful status.
ALT_E_ERRORDetails about error status code
ALT_STATUS_CODE alt_spi_slave_tx_transfer ( ALT_SPI_DEV_t *  spi_dev,
const uint16_t *  tx_buf,
const size_t  buf_len 
)

This function performs a slave SPI/SSP serial transmit only transfer.

This API is suitable for being called during an interrupt context. It is the programmer's responsibility to ensure that there is enough space in the TX FIFO to accomodate the request made.

Parameters
spi_devA pointer to the SPI controller device block instance.
tx_bufA buffer of data frames to transmit. The tx_buf element type is sized large enough to contain the widest possible data frame size. The data in each frame should be right justified within its tx_buf element.
buf_lenThe length in data frames of the tx_buf buffer.
ALT_STATUS_CODE alt_spi_slave_rx_transfer ( ALT_SPI_DEV_t *  spi_dev,
uint16_t *  rx_buf,
const size_t  buf_len 
)

This function performs a slave SPI/SSP serial receive only transfer.

This API is suitable for being called during an interrupt context. It is the programmer's responsibility to ensure that there is enough data in the RX FIFO to accomodate the request made.

Parameters
spi_devA pointer to the SPI controller device block instance.
rx_buf[out] An buffer to receive data frames sent from the master. The buffer is expected to be at least buf_len data frames in length.
buf_lenThe length in data frames of the rx_buf buffer.