Altera HWLIB  16.0
The Altera HW Manager API Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups
SD/MMC Controller FIFO

Description

Macros

#define ALT_SDMMC_FIFO_NUM_ENTRIES   1024
 

Typedefs

typedef enum ALT_SDMMC_MULT_TRANS_e ALT_SDMMC_MULT_TRANS_t
 

ENUMS

enum  ALT_SDMMC_MULT_TRANS_e {
  ALT_SDMMC_MULT_TRANS_TXMSIZE1 = 0x0, ALT_SDMMC_MULT_TRANS_TXMSIZE4 = 0x1, ALT_SDMMC_MULT_TRANS_TXMSIZEK8 = 0x2, ALT_SDMMC_MULT_TRANS_TXMSIZEK16 = 0x3,
  ALT_SDMMC_MULT_TRANS_RXMSIZEK1 = 0x5, ALT_SDMMC_MULT_TRANS_RXMSIZEK4 = 0x6, ALT_SDMMC_MULT_TRANS_RXMSIZE8 = 0x7
}
 

Functions

ALT_STATUS_CODE alt_sdmmc_fifo_reset (void)
 
ALT_STATUS_CODE alt_sdmmc_fifo_param_get (uint32_t *rx_wtrmk, uint32_t *tx_wtrmk, ALT_SDMMC_MULT_TRANS_t *mult_trans_size)
 
ALT_STATUS_CODE alt_sdmmc_fifo_param_set (uint32_t rx_wtrmk, uint32_t tx_wtrmk, ALT_SDMMC_MULT_TRANS_t mult_trans_size)
 
bool alt_sdmmc_fifo_is_rx_wtrmk_reached (void)
 
bool alt_sdmmc_fifo_is_tx_wtrmk_reached (void)
 
bool alt_sdmmc_fifo_is_empty (void)
 
bool alt_sdmmc_fifo_is_full (void)
 
int32_t alt_sdmmc_fifo_count (void)
 
ALT_STATUS_CODE alt_sdmmc_fifo_read (void *dest, const size_t size)
 
ALT_STATUS_CODE alt_sdmmc_fifo_write (const void *src, const size_t size)
 

Macro Definitions

#define ALT_SDMMC_FIFO_NUM_ENTRIES   1024

The number of entries (depth) of the SDMMC controller FIFO.

Typedef Documentation

This type enumerates the burst size of multiple transaction available to the SD/MMC internal DMA controller.

Enumeration Type Documentation

This type enumerates the burst size of multiple transaction available to the SD/MMC internal DMA controller.

Enumerator:
ALT_SDMMC_MULT_TRANS_TXMSIZE1 

Msize 1 and TX_WMARK 1-1023

ALT_SDMMC_MULT_TRANS_TXMSIZE4 

Msize 1 and TX_WMARK 1-1023

ALT_SDMMC_MULT_TRANS_TXMSIZEK8 

Msize 4 and TX_WMARK 256

ALT_SDMMC_MULT_TRANS_TXMSIZEK16 

Msize 16 and TX_WMARK 64

ALT_SDMMC_MULT_TRANS_RXMSIZEK1 

Msize 1 and RX_WMARK 512

ALT_SDMMC_MULT_TRANS_RXMSIZEK4 

Msize 1 and RX_WMARK 512

ALT_SDMMC_MULT_TRANS_RXMSIZE8 

Msize 8 and RX_WMARK 64

Function Documentation

ALT_STATUS_CODE alt_sdmmc_fifo_reset ( void  )

Resets the SD/MMC controller FIFO.

Return values
ALT_E_SUCCESSThe operation was successful.
ALT_E_ERRORThe operation failed.
ALT_STATUS_CODE alt_sdmmc_fifo_param_get ( uint32_t *  rx_wtrmk,
uint32_t *  tx_wtrmk,
ALT_SDMMC_MULT_TRANS_t mult_trans_size 
)

Gets the configured FIFO operational parameter values.

This function returns the FIFO configuration parameter set for the receive and transmit watermark threshold values and the DMA multiple transaction size.

Parameters
rx_wtrmk[out] FIFO threshold watermark value when receiving data to card.
tx_wtrmk[out] FIFO threshold watermark value when transmitting data to card.
mult_trans_size[out] Burst size of multiple transaction.
Return values
ALT_E_SUCCESSThe operation was successful.
ALT_E_ERRORThe operation failed.
ALT_STATUS_CODE alt_sdmmc_fifo_param_set ( uint32_t  rx_wtrmk,
uint32_t  tx_wtrmk,
ALT_SDMMC_MULT_TRANS_t  mult_trans_size 
)

Sets the configured FIFO operational parameter values.

This function sets the FIFO configuration parameter for the receive and transmit watermark threshold values and the DMA multiple transaction size.

Parameters
rx_wtrmkFIFO threshold watermark value when receiving data to card.
tx_wtrmkFIFO threshold watermark value when transmitting data to card.
mult_trans_sizeBurst size of multiple transaction.
Return values
ALT_E_SUCCESSThe operation was successful.
ALT_E_ERRORThe operation failed.
bool alt_sdmmc_fifo_is_rx_wtrmk_reached ( void  )

Returns true if SD/MMC controller FIFO has reached the receive watermark level otherwise returns false.

Return values
trueThe FIFO has reached the receive watermark level.
falseThe FIFO has not reached the receive watermark level.
bool alt_sdmmc_fifo_is_tx_wtrmk_reached ( void  )

Returns true if SD/MMC controller FIFO has reached the transmit watermark level otherwise returns false.

Return values
trueThe FIFO has reached the transmit watermark level.
falseThe FIFO has not reached the transmit watermark level.
bool alt_sdmmc_fifo_is_empty ( void  )

Returns true if SD/MMC controller FIFO is empty otherwise returns false.

Return values
trueThe FIFO is empty.
falseThe FIFO is not empty.
bool alt_sdmmc_fifo_is_full ( void  )

Returns true if SD/MMC controller FIFO is full otherwise returns false.

Return values
trueThe FIFO is full.
falseThe FIFO is not full.
int32_t alt_sdmmc_fifo_count ( void  )

Returns the number of filled FIFO locations.

Returns
The number of filled FIFO locations.
ALT_STATUS_CODE alt_sdmmc_fifo_read ( void *  dest,
const size_t  size 
)

Read data from the SD/MMC controller FIFO.

Reads the requested number of bytes (rounded up to nearest whole 32-bit word) from the FIFO. The function returns when the requested number of bytes has been read from the FIFO or if an error occurs.

Parameters
destA pointer to a user supplied destination buffer for the data read from the FIFO. The buffer must be as large the requested number of bytes rounded up to the nearest 32-bit word size.
sizeThe requested number of bytes to read from the FIFO.
Return values
ALT_E_SUCCESSSuccessful status.
ALT_E_ERRORDetails about error status code
ALT_STATUS_CODE alt_sdmmc_fifo_write ( const void *  src,
const size_t  size 
)

Writes data to the SD/MMC controller FIFO.

Writes the requested number of bytes (rounded up to nearest whole 32-bit word) to the FIFO. The function returns when the requested number of bytes has been written to the FIFO or if an error occurs.

Parameters
srcA pointer to A pointer to the source buffer containing the data to be written to the FIFO. The buffer must be as large the requested number of bytes rounded up to the nearest 32-bit word size.
sizeThe number of bytes to write to the FIFO. If size is not a multiple of 4 then the number of bytes is rounded up to the next 32-but word size and the byte difference padded with zeroes.
Return values
ALT_E_SUCCESSSuccessful status.
ALT_E_ERRORDetails about error status code