The DMA peripheral request controller is only used for the indirect mode of operation where data is temporarily stored in the SRAM. The QSPI flash controller uses the DMA peripheral request interface to trigger the external DMA into performing data transfers between memory and the QSPI controller.
There are two DMA peripheral request interfaces, one for indirect reads and one for indirect writes. The DMA peripheral request controller can issue two types of DMA requests, single or burst, to the external DMA. The number of bytes for each single or burst request is specified using the alt_qspi_dma_config_set(). The DMA peripheral request controller splits the total amount of data to be transferred into a number of DMA burst and single requests by dividing the total number of bytes by the number of bytes specified in the burst request, and then dividing the remainder by the number of bytes in a single request.
When programming the DMA controller, the burst request size must match the burst request size set in the quad SPI controller to avoid quickly reaching an overflow or underflow condition.
ALT_STATUS_CODE alt_qspi_dma_disable |
( |
void |
| ) |
|
Disable the QSPI DMA peripheral interface.
- Return values
-
ALT_E_SUCCESS | Indicates successful completion. |
ALT_E_ERROR | Indicates an error occurred. |
ALT_STATUS_CODE alt_qspi_dma_enable |
( |
void |
| ) |
|
Enable the QSPI DMA peripheral interface.
Enable the QSPI DMA handshaking logic. When enabled the QSPI will trigger DMA transfer requests via the DMA peripheral interface.
- Return values
-
ALT_E_SUCCESS | Indicates successful completion. |
ALT_E_ERROR | Indicates an error occurred. |
ALT_STATUS_CODE alt_qspi_dma_config_get |
( |
uint32_t * |
single_type_sz, |
|
|
uint32_t * |
burst_type_sz |
|
) |
| |
Get the current DMA peripheral configuration.
This function returns the QSPI DMA peripheral interface single and burst type transfer size configurations.
- Parameters
-
single_type_sz | [out] The number of bytes for each DMA single type request. Value must be a power of 2 between 1 and 32728. |
burst_type_sz | [out] The number of bytes for each DMA burst type request. Value must be a power of 2 between 1 and 32728. |
- Return values
-
ALT_E_SUCCESS | Indicates successful completion. |
ALT_E_ERROR | Indicates an error occurred. |
ALT_STATUS_CODE alt_qspi_dma_config_set |
( |
const uint32_t |
single_type_sz, |
|
|
const uint32_t |
burst_type_sz |
|
) |
| |
Set the DMA peripheral configuration.
This function configures the QSPI DMA peripheral interface single and burst type transfer sizes. The DMA configruation should be setup while the controller is idle. Because all transfers are required to be word aligned, the smallest DMA request is 4 bytes.
This API requires that the QSPI controller be idle, as determined by alt_qspi_is_idle().
- Parameters
-
single_type_sz | The number of bytes for each DMA single type request. Currently limited to 4. |
burst_type_sz | The number of bytes for each DMA burst type request. Currently limited to 4. |
- Return values
-
ALT_E_SUCCESS | Indicates successful completion. |
ALT_E_ERROR | Indicates an error occurred. |
uint32_t alt_qspi_get_device_size |
( |
void |
| ) |
|
Retrieves the size of the current QSPI device
uint32_t get_smallest_sector_size |
( |
void |
| ) |
|
Retrieves the size of the smallest amount of memory that can be erased for the current QSPI device
const char* alt_qspi_get_friendly_name |
( |
void |
| ) |
|
Returns the human readable name for the current QSPI part
bool alt_qspi_is_multidie |
( |
void |
| ) |
|
Indicates whether the qspi device is a multi-die device. This is necessary for customers who wish to DMA to qspi and must change dies before switching
- Return values
-
bool | Whether or not the device is multi-die |
uint32_t alt_qspi_get_die_size |
( |
void |
| ) |
|
If the device is a multi-die device, this function will return the size of each die. This is necessary for customers who wish to DMA to qspi and must change dies before switching
- Return values
-
uint32_t | The size of each die in a multi-die device |
uint32_t alt_qspi_get_page_size |
( |
void |
| ) |
|
Indicates the page-size of the qspi device. This can be useful for aligning read/writes for optimization
- Return values
-
uint32_t | The device page-size |