RTEMS: Indirect Access Mode

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Modules | Functions
Indirect Access Mode
Board Support Packages » ARM » Intel Cyclone V » Contributed Code » QSPI Flash Controller Module

## Modules
| SRAM Partition

## Functions
ALT_STATUS_CODE | alt_qspi_indirect_read_start (const uint32_t flash_addr, const size_t num_bytes)
ALT_STATUS_CODE | alt_qspi_indirect_read_finish (void)
ALT_STATUS_CODE | alt_qspi_indirect_read_cancel (void)
uint32_t | alt_qspi_indirect_read_fill_level (void)
uint32_t | alt_qspi_indirect_read_watermark_get (void)
ALT_STATUS_CODE | alt_qspi_indirect_read_watermark_set (const uint32_t watermark)
bool | alt_qspi_indirect_read_is_complete (void)
ALT_STATUS_CODE | alt_qspi_indirect_write_start (const uint32_t flash_addr, const size_t num_bytes)
ALT_STATUS_CODE | alt_qspi_indirect_write_finish (void)
ALT_STATUS_CODE | alt_qspi_indirect_write_cancel (void)
uint32_t | alt_qspi_indirect_write_fill_level (void)
uint32_t | alt_qspi_indirect_write_watermark_get (void)
ALT_STATUS_CODE | alt_qspi_indirect_write_watermark_set (const uint32_t watermark)
bool | alt_qspi_indirect_write_is_complete (void)

## Detailed Description

In indirect access mode, flash data is temporarily buffered in the QSPI controller's SRAM. Software controls and triggers indirect accesses through the APB register slave interface. The controller transfers data through the AHB data slave interface.

An indirect read operation reads data from the flash memory, places the data into the SRAM, and transfers the data to an external master through the AHB data slave interface.

An indirect write operation programs data from the SRAM to the flash memory.

## Function Documentation

## ◆ alt_qspi_indirect_read_cancel()

ALT_STATUS_CODE alt_qspi_indirect_read_cancel | ( | void |  | ) |

Cancel all indirect read transfers in progress.

Return values

  ALT_E_SUCCESS | Indicates successful completion.
  ALT_E_ERROR | Indicates an error occurred.

## ◆ alt_qspi_indirect_read_fill_level()

uint32_t alt_qspi_indirect_read_fill_level | ( | void |  | ) |

Get the current indirect read SRAM fill level value.

Returns the SRAM fill level for the indirect read partition in units of SRAM words (4 bytes).

Returns
  The SRAM fill level for the indirect read partition in units of SRAM words (4 bytes).

## ◆ alt_qspi_indirect_read_finish()

ALT_STATUS_CODE alt_qspi_indirect_read_finish | ( | void |  | ) |

Finish the indirect read operation that was completed or canceled. This function should be called before another indirect read is started.

Return values

  ALT_E_SUCCESS | Indicates successful completion.
  ALT_E_ERROR | Indicates an error occurred.

## ◆ alt_qspi_indirect_read_is_complete()

bool alt_qspi_indirect_read_is_complete | ( | void |  | ) |

Returns true when an indirect read has completed otherwise false.

Returns
  Returns true when an indirect read has completed otherwise false.

## ◆ alt_qspi_indirect_read_start()

ALT_STATUS_CODE alt_qspi_indirect_read_start | ( | const uint32_t | flash_addr,
|  | const size_t | num_bytes
| ) |  |

Starts an indirect read transfer.

Initiates an indirect read transfer of the requested number of bytes from the designated flash address.

After calling this function, flash data may be read from the QSPI SRAM buffer as it becomes available via one of the following methods:

- Directly from the AHB data slave interface at the configured AHB trigger address. If the requested data is not immediately available in the SRAM buffer then AHB wait states will be applied until the data has been read from flash into the SRAM buffer. Alternatively, data may be read from the AHB data slave as the SRAM is filled. The availability of data in the SRAM buffer may be determined by an SRAM watermark interrupt notification or by polling the SRAM fill level.
- Configuring and enabling the QSPI DMA peripheral controller.

The following is a list of restrictions:

- flash_addr must be word aligned.
- num_bytes must be word aligned.
- The transfer must not cross the 3-byte addressing boundary. This restriction may be device specific and may be lifted in the future.

Parameters

  flash_addr | The flash source address to read data from.
  num_bytes | The number of bytes to read from the flash source address.

Return values

  ALT_E_SUCCESS | Indicates successful completion.
  ALT_E_ERROR | Indicates an error occurred.

## ◆ alt_qspi_indirect_read_watermark_get()

uint32_t alt_qspi_indirect_read_watermark_get | ( | void |  | ) |

Get the current indirect read watermark value.

The watermark value (in bytes) represents the minimum fill level of the SRAM before a DMA peripheral access is permitted. When the SRAM fill level passes the watermark, an interrupt source is also generated. This can be disabled by writing a value of all zeroes.

Returns
  The current indirect read watermark value.

## ◆ alt_qspi_indirect_read_watermark_set()

ALT_STATUS_CODE alt_qspi_indirect_read_watermark_set | ( | const uint32_t | watermark | ) |

Set the indirect read watermark value.

The watermark value (in bytes) represents the minimum fill level of the SRAM before a DMA peripheral access is permitted. When the SRAM fill level passes the watermark, an interrupt source is also generated. This can be disabled by writing a value of all zeroes. The watermark can only be set when no indirect read is in progress.

Parameters

  watermark | The watermark value (in bytes).

Return values

  ALT_E_SUCCESS | Indicates successful completion.
  ALT_E_ERROR | Indicates an error occurred.

## ◆ alt_qspi_indirect_write_cancel()

ALT_STATUS_CODE alt_qspi_indirect_write_cancel | ( | void |  | ) |

Cancel all indirect write transfers in progress.

Return values

  ALT_E_SUCCESS | Indicates successful completion.
  ALT_E_ERROR | Indicates an error occurred.

## ◆ alt_qspi_indirect_write_fill_level()

uint32_t alt_qspi_indirect_write_fill_level | ( | void |  | ) |

Get the current indirect write SRAM fill level value.

Returns the SRAM fill level for the indirect write partition in units of SRAM words (4 bytes).

Returns
  The SRAM fill level for the indirect write partition in units of SRAM words (4 bytes).

## ◆ alt_qspi_indirect_write_finish()

ALT_STATUS_CODE alt_qspi_indirect_write_finish | ( | void |  | ) |

Finish the indirect write operation that was completed or canceled. This function should be called before another indirect write is started.

Return values

  ALT_E_SUCCESS | Indicates successful completion.
  ALT_E_ERROR | Indicates an error occurred.

## ◆ alt_qspi_indirect_write_is_complete()

bool alt_qspi_indirect_write_is_complete | ( | void |  | ) |

Returns true when an indirect write has completed otherwise false.

Returns
  Returns true when an indirect write has completed otherwise false.

## ◆ alt_qspi_indirect_write_start()

ALT_STATUS_CODE alt_qspi_indirect_write_start | ( | const uint32_t | flash_addr,
|  | const size_t | num_bytes
| ) |  |

Starts an indirect write transfer.

Initiates an indirect write transfer of the requested number of bytes to the designated flash address.

After calling this function, flash data may be written to the QSPI SRAM buffer there is space via one of the following methods:

- Directly from the AHB data slave interface at the configured AHB trigger address. If the requested space is not immediately available in the SRAM buffer then AHB wait states will be applied until the space becomes available. Alternatively, the data may be written to the AHB data slave as the SRAM is drained. The space in the SRAM buffer may be determined by an SRAM watermark interrupt notification or by polling the SRAM fill level and subtracting that value from the SRAM space devoted to writes.
- Configuring and enabling the QSPI DMA peripheral controller.

The following is a list of restrictions:

- flash_addr must be word aligned.
- num_bytes must be word aligned.
- num_bytes must be 256 or below. This is due to a device specific limitation and may be lifted in the future.
- The transfer must not cross the page (256 byte) addressing boundary. This restriction may be device specific and may be lifted in the future.

Parameters

  flash_addr | The flash destination address to write data to.
  num_bytes | The number of bytes to write to the flash.

Return values

  ALT_E_SUCCESS | Indicates successful completion.
  ALT_E_ERROR | Indicates an error occurred.

## ◆ alt_qspi_indirect_write_watermark_get()

uint32_t alt_qspi_indirect_write_watermark_get | ( | void |  | ) |

Get the current indirect write watermark value.

The watermark value (in bytes) represents the maximum fill level of the SRAM before a DMA peripheral access is permitted. When the SRAM fill level falls below the watermark, an interrupt is also generated. This can be disabled by writing a value of all ones.

Returns
  The current indirect write watermark value.

## ◆ alt_qspi_indirect_write_watermark_set()

ALT_STATUS_CODE alt_qspi_indirect_write_watermark_set | ( | const uint32_t | watermark | ) |

Set the indirect write watermark value.

The watermark value (in bytes) represents the maximum fill level of the SRAM before a DMA peripheral access is permitted. When the SRAM fill level falls below the watermark, an interrupt is also generated. This can be disabled by writing a value of all ones. The watermark can only be set when no indirect write is in progress.

Parameters

  watermark | The watermark value (in bytes).

Return values

  ALT_E_SUCCESS | Indicates successful completion.
  ALT_E_ERROR | Indicates an error occurred.