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

Description

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

Functions

ALT_STATUS_CODE alt_spi_master_tx_rx_transfer (ALT_SPI_DEV_t *spi_dev, const uint32_t slave_select, const size_t num_frames, const uint16_t *tx_buf, uint16_t *rx_buf)
 
ALT_STATUS_CODE alt_spi_master_tx_transfer (ALT_SPI_DEV_t *spi_dev, const uint32_t slave_select, const size_t num_frames, const uint16_t *tx_buf)
 
ALT_STATUS_CODE alt_spi_master_rx_transfer (ALT_SPI_DEV_t *spi_dev, const uint32_t slave_select, const size_t num_frames, uint16_t *rx_buf)
 
ALT_STATUS_CODE alt_spi_master_eeprom_transfer (ALT_SPI_DEV_t *spi_dev, const uint32_t slave_select, const uint8_t opcode, const uint16_t eeprom_addr, const size_t num_frames, uint16_t *rx_buf)
 

Function Documentation

ALT_STATUS_CODE alt_spi_master_tx_rx_transfer ( ALT_SPI_DEV_t *  spi_dev,
const uint32_t  slave_select,
const size_t  num_frames,
const uint16_t *  tx_buf,
uint16_t *  rx_buf 
)

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

Parameters
spi_devA pointer to the SPI controller device block instance.
slave_selectA mask of the slave select output signal line(s) to enable. slave_selects is a mask of logically OR'ed ALT_SPI_SS_t values that designate the slave select outputs to enable during the transfer operation.
num_framesThe number of data frames involved in the transfer operation. Valid range: 1 to 65536.
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. The buffer is expected to contain num_frames data frames for transmittal.
rx_buf[out] An buffer to receive data frames sent from the slave. The buffer is expected to be at least num_frames data frames in length.
Return values
ALT_E_SUCCESSSuccessful status.
ALT_E_ERRORDetails about error status code
ALT_STATUS_CODE alt_spi_master_tx_transfer ( ALT_SPI_DEV_t *  spi_dev,
const uint32_t  slave_select,
const size_t  num_frames,
const uint16_t *  tx_buf 
)

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

Parameters
spi_devA pointer to the SPI controller device block instance.
slave_selectA mask of the slave select output signal line(s) to enable. slave_selects is a mask of logically OR'ed ALT_SPI_SS_t values that designate the slave select outputs to enable during the transfer operation.
num_framesThe number of data frames involved in the transfer operation. Valid range: 1 to 65536.
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. The buffer is expected to contain num_frames data frames for transmittal.
ALT_STATUS_CODE alt_spi_master_rx_transfer ( ALT_SPI_DEV_t *  spi_dev,
const uint32_t  slave_select,
const size_t  num_frames,
uint16_t *  rx_buf 
)

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

Parameters
spi_devA pointer to the SPI controller device block instance.
slave_selectA mask of the slave select output signal line(s) to enable. slave_selects is a mask of logically OR'ed ALT_SPI_SS_t values that designate the slave select outputs to enable during the transfer operation.
num_framesThe number of data frames involved in the transfer operation. Valid range: 1 to 65536.
rx_buf[out] An buffer to receive data frames sent from the slave. The buffer is expected to be at least num_frames data frames in length.
ALT_STATUS_CODE alt_spi_master_eeprom_transfer ( ALT_SPI_DEV_t *  spi_dev,
const uint32_t  slave_select,
const uint8_t  opcode,
const uint16_t  eeprom_addr,
const size_t  num_frames,
uint16_t *  rx_buf 
)

This function performs a master SPI EEPROM read transfer.

Parameters
spi_devA pointer to the SPI controller device block instance.
slave_selectA mask of the slave select output signal line(s) to enable. slave_selects is a mask of logically OR'ed ALT_SPI_SS_t values that designate the slave select outputs to enable during the transfer operation.
opcodeThe opcode to transmit to the EEPROM device.
eeprom_addrThe address transmitted to access the EEPROM device.
num_framesThe number of data frames involved in the transfer operation. Valid range: 1 to 65536.
rx_buf[out] An buffer to receive data frames sent from the slave. The buffer is expected to be at least num_frames data frames in length.