![]() |
Synergy Software Package User's Manual
|
Driver for the Quad Serial Peripheral Interface (QSPI). More...
Data Structures | |
| struct | qspi_instance_ctrl_t |
Functions | |
| ssp_err_t | R_QSPI_Open (qspi_ctrl_t *p_api_ctrl, qspi_cfg_t const *const p_cfg) |
| Open the QSPI driver module. More... | |
| ssp_err_t | R_QSPI_Close (qspi_ctrl_t *p_api_ctrl) |
| Close the QSPI driver module. More... | |
| ssp_err_t | R_QSPI_Read (qspi_ctrl_t *p_api_ctrl, uint8_t *p_device_address, uint8_t *p_memory_address, uint32_t byte_count) |
| Read data from the flash. More... | |
| ssp_err_t | R_QSPI_PageProgram (qspi_ctrl_t *p_api_ctrl, uint8_t *p_device_address, uint8_t *p_memory_address, uint32_t byte_count) |
| Program a page of data to the flash. More... | |
| ssp_err_t | R_QSPI_Erase (qspi_ctrl_t *p_api_ctrl, uint8_t *p_device_address, uint32_t byte_count) |
| Erase a number of byte from the flash. More... | |
| ssp_err_t | R_QSPI_InfoGet (qspi_ctrl_t *p_api_ctrl, qspi_info_t *const p_info) |
| Returns the information about the flash. More... | |
| ssp_err_t | R_QSPI_SectorErase (qspi_ctrl_t *p_api_ctrl, uint8_t *p_device_address) |
| Erase a sector on the flash. More... | |
| ssp_err_t | R_QSPI_StatusGet (qspi_ctrl_t *p_api_ctrl, bool *p_write_in_progress) |
| Get the write or erase status of the flash. More... | |
| ssp_err_t | R_QSPI_BankSelect (uint32_t bank) |
| Select the bank to access. More... | |
| ssp_err_t | R_QSPI_VersionGet (ssp_version_t *const p_version) |
| Get the driver version based on compile time macros. More... | |
Driver for the Quad Serial Peripheral Interface (QSPI).
This is a driver for the Quad-SPI module (QSPI) which is a memory controller for connecting a serial ROM (non-volatile memory such as a serial flash memory, serial EEPROM, or serial FeRAM) that has an SPI-compatible interface.
Extends Quad SPI Flash Interface.
| ssp_err_t R_QSPI_BankSelect | ( | uint32_t | bank | ) |
Select the bank to access.
A bank is a 64MB sliding access window into the flash memory space. This function sets the current bank.
| SSP_SUCCESS | Bank successfully selected. |
Return back to ROM access mode
| ssp_err_t R_QSPI_Close | ( | qspi_ctrl_t * | p_api_ctrl | ) |
Close the QSPI driver module.
Return the QSPI module back to ROM access mode.
| SSP_SUCCESS | Configuration was successful. |
| SSP_ERR_ASSERTION | p_ctrl is NULL. |
| SSP_ERR_NOT_OPEN | Driver is not opened. |
Check if the device is open
Re-enter XIP mode if it was running in this mode before entering opening the driver
Clearing the manufacturing_id, memory_type and memory_capacity
| ssp_err_t R_QSPI_Erase | ( | qspi_ctrl_t * | p_api_ctrl, |
| uint8_t * | p_device_address, | ||
| uint32_t | byte_count | ||
| ) |
Erase a number of byte from the flash.
| SSP_SUCCESS | The command to erase the flash was executed successfully. |
| SSP_ERR_UNSUPPORTED | The device address is invalid. |
| SSP_ERR_ASSERTION | p_ctrl or p_device_address is NULL. |
| SSP_ERR_INVALID_ARGUMENT | Invalid byte_count entered. |
| SSP_ERR_NOT_OPEN | Driver is not opened. |
Check if the device is open
Check whether the device address is valid
Get the information of underlying flash
If requested byte_count is supported by underlying flash, assign the value of size_index to cmd_index for searching the command
Send command to enable writing
Get the erase command
Send command to erase
If the command is not a chip erase command then send the start address
Send command to write data
Send command to disable writing
| ssp_err_t R_QSPI_InfoGet | ( | qspi_ctrl_t * | p_api_ctrl, |
| qspi_info_t *const | p_info | ||
| ) |
Returns the information about the flash.
| SSP_SUCCESS | Operation was successful. |
| SSP_ERR_ASSERTION | p_ctrl or p_info is NULL. |
| SSP_ERR_NOT_OPEN | Driver is not opened. |
Check if the device is open
Get the information of underlying flash
| ssp_err_t R_QSPI_Open | ( | qspi_ctrl_t * | p_api_ctrl, |
| qspi_cfg_t const *const | p_cfg | ||
| ) |
Open the QSPI driver module.
Open the QSPI module driver in direct communication mode for the purposes of reading and writing flash memory via SPI protocols.
| SSP_SUCCESS | Configuration was successful. |
| SSP_ERR_ASSERTION | The parameter p_ctrl or p_cfg is NULL. |
| SSP_ERR_UNSUPPORTED | Driver not able to query the following information from the flash manufacturer id,memory capacity and memory type. |
| SSP_ERR_IN_USE | QSPI resource is locked. |
Set the default bank to the first bank
Get the configuration of the quad SPI flash device and remember it for subsequent operations
If populated flash is 16MB & address mode configured as 4-byte,returns an unsupported error
A zero in the manufacturer_id mean the flash device is broken, misconfigured, or not populated
Mark driver as opened by initializing it to "RQSP" in its ASCII equivalent for this unit.
Exit XIP mode while the driver is open
| ssp_err_t R_QSPI_PageProgram | ( | qspi_ctrl_t * | p_api_ctrl, |
| uint8_t * | p_device_address, | ||
| uint8_t * | p_memory_address, | ||
| uint32_t | byte_count | ||
| ) |
Program a page of data to the flash.
| SSP_SUCCESS | The flash was programmed successfully. |
| SSP_ERR_UNSUPPORTED | The device address is invalid. |
| SSP_ERR_ASSERTION | p_ctrl, p_device_address or p_memory_address is NULL. |
| SSP_ERR_INVALID_ARGUMENT | Invalid parameter is passed. |
| SSP_ERR_NOT_OPEN | Driver is not opened. |
Check whether the device address is valid
Send command to enable writing
If the peripheral is in extended SPI mode, and the configuration provided in the BSP allows for programming on multiple data lines, and a unique command is provided for the required mode, update the SPI protocol to send data on multiple lines.
Send command to write data
Write the address.
Write the data.
If the SPI protocol was modified in this function, restore it.
Send command to disable writing
| ssp_err_t R_QSPI_Read | ( | qspi_ctrl_t * | p_api_ctrl, |
| uint8_t * | p_device_address, | ||
| uint8_t * | p_memory_address, | ||
| uint32_t | byte_count | ||
| ) |
Read data from the flash.
Read a block of data from a particular address on the SPI flash device.
| SSP_SUCCESS | The flash was programmed successfully. |
| SSP_ERR_UNSUPPORTED | The device address is invalid. |
| SSP_ERR_ASSERTION | p_ctrl,p_device_address or p_memory_address is NULL. |
| SSP_ERR_NOT_OPEN | Driver is not opened. |
| SSP_ERR_TRANSFER_BUSY | Another serial communications transfer is in progress. |
Check if the device is open
Check whether the device address is valid
Make sure no other communication is in progress.
| ssp_err_t R_QSPI_SectorErase | ( | qspi_ctrl_t * | p_api_ctrl, |
| uint8_t * | p_device_address | ||
| ) |
Erase a sector on the flash.
Erase one sector on the SPI flash device. Any passed in address within the sector to be erased is acceptable.
| SSP_SUCCESS | The command to erase the sector of flash was executed successfully. |
| SSP_ERR_UNSUPPORTED | The device address is invalid. |
| SSP_ERR_ASSERTION | p_ctrl or p_device_address is NULL. |
| SSP_ERR_NOT_OPEN | Driver is not opened. |
Check whether the device address is valid
Check if the device is open
Place the QSPI block into Direct Communication mode
Send command to enable writing
Close the SPI bus cycle
Send command to erase
Send command to write data
Send command to erase
Close the SPI bus cycle
Send command to disable writing
Close the SPI bus cycle
Return to ROM access mode
| ssp_err_t R_QSPI_StatusGet | ( | qspi_ctrl_t * | p_api_ctrl, |
| bool * | p_write_in_progress | ||
| ) |
Get the write or erase status of the flash.
Return the write status of the flash. This is most useful for determining if erases are complete.
| SSP_SUCCESS | The write status is correct. |
| SSP_ERR_ASSERTION | p_ctrl or p_write_in_progress is NULL. |
| SSP_ERR_NOT_OPEN | Driver is not opened. |
Check if the device is open
Place the QSPI block into Direct Communication mode
Get the write status from the device
Return to ROM access mode
| ssp_err_t R_QSPI_VersionGet | ( | ssp_version_t *const | p_version | ) |
Get the driver version based on compile time macros.
| SSP_SUCCESS | Successful close. |
| SSP_ERR_ASSERTION | p_version is NULL. |