Altera HWLIB  16.0
The Altera HW Manager API Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups
TX FIFO Management

Description

The transmit FIFO has a configurable threshold value that controls the level of entries (or below) that sets the TX_EMPTY status condition and triggers an interrupt. The valid range is 0..(ALT_SPI_TX_FIFO_NUM_ENTRIES - 1), with the additional restriction that SPI controller does not allow this value to be set to a value larger than the depth of the buffer. If an attempt is made to do that, the actual value set will be the maximum depth of the buffer. A value of 0 sets the threshold for 0 entries, and a value of (ALT_SPI_TX_FIFO_NUM_ENTRIES - 1) sets the threshold for (ALT_SPI_TX_FIFO_NUM_ENTRIES - 1) entries.

Macros

#define ALT_SPI_TX_FIFO_NUM_ENTRIES   256
 

Functions

ALT_STATUS_CODE alt_spi_tx_fifo_enq (ALT_SPI_DEV_t *spi_dev, const uint16_t data)
 
ALT_STATUS_CODE alt_spi_tx_fifo_is_empty (ALT_SPI_DEV_t *spi_dev)
 
ALT_STATUS_CODE alt_spi_tx_fifo_is_full (ALT_SPI_DEV_t *spi_dev)
 
ALT_STATUS_CODE alt_spi_tx_fifo_level_get (ALT_SPI_DEV_t *spi_dev, uint32_t *num_entries)
 
ALT_STATUS_CODE alt_spi_tx_fifo_threshold_get (ALT_SPI_DEV_t *spi_dev, uint8_t *threshold)
 
ALT_STATUS_CODE alt_spi_tx_fifo_threshold_set (ALT_SPI_DEV_t *spi_dev, const uint8_t threshold)
 

Macro Definitions

#define ALT_SPI_TX_FIFO_NUM_ENTRIES   256

The number of entries (depth) of the SPI controller transmit FIFO.

Function Documentation

ALT_STATUS_CODE alt_spi_tx_fifo_enq ( ALT_SPI_DEV_t *  spi_dev,
const uint16_t  data 
)

Writes a data frame to the transmit (Tx) FIFO for transmittal.

Parameters
spi_devA pointer to the SPI controller device block instance.
dataThe data frame to put into the Tx FIFO. The data parameter type is sized large enough to contain the widest possible data frame size. The data in each frame should be right justified within the data parameter.
Return values
ALT_E_SUCCESSSuccessful status.
ALT_E_ERRORDetails about error status code
ALT_STATUS_CODE alt_spi_tx_fifo_is_empty ( ALT_SPI_DEV_t *  spi_dev)

Returns ALT_E_TRUE when the transmit FIFO is empty.

Parameters
spi_devA pointer to the SPI controller device block instance.
Return values
ALT_E_SUCCESSSuccessful status.
ALT_E_ERRORDetails about error status code
ALT_STATUS_CODE alt_spi_tx_fifo_is_full ( ALT_SPI_DEV_t *  spi_dev)

Returns ALT_E_TRUE when the transmit FIFO is completely full.

Parameters
spi_devA pointer to the SPI controller device block instance.
Return values
ALT_E_SUCCESSSuccessful status.
ALT_E_ERRORDetails about error status code
ALT_STATUS_CODE alt_spi_tx_fifo_level_get ( ALT_SPI_DEV_t *  spi_dev,
uint32_t *  num_entries 
)

Returns the number of valid entries in the transmit FIFO.

Parameters
spi_devA pointer to the SPI controller device block instance.
num_entries[out] The number of entries in the transmit FIFO.
Return values
ALT_E_SUCCESSSuccessful status.
ALT_E_ERRORDetails about error status code
ALT_STATUS_CODE alt_spi_tx_fifo_threshold_get ( ALT_SPI_DEV_t *  spi_dev,
uint8_t *  threshold 
)

Gets the current transmit FIFO threshold level value.

Parameters
spi_devA pointer to the SPI controller device block instance.
threshold[out] The current threshold value.
Return values
ALT_E_SUCCESSSuccessful status.
ALT_E_ERRORDetails about error status code
ALT_STATUS_CODE alt_spi_tx_fifo_threshold_set ( ALT_SPI_DEV_t *  spi_dev,
const uint8_t  threshold 
)

Sets the current transmit FIFO threshold level value.

Parameters
spi_devA pointer to the SPI controller device block instance.
thresholdThe threshold value.
Return values
ALT_E_SUCCESSSuccessful status.
ALT_E_ERRORDetails about error status code