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...
 

Detailed Description

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.

Summary

Extends Quad SPI Flash Interface.

Function Documentation

◆ R_QSPI_BankSelect()

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.

Return values
SSP_SUCCESSBank successfully selected.

Return back to ROM access mode

◆ R_QSPI_Close()

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.

Return values
SSP_SUCCESSConfiguration was successful.
SSP_ERR_ASSERTIONp_ctrl is NULL.
SSP_ERR_NOT_OPENDriver 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

◆ R_QSPI_Erase()

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.

Return values
SSP_SUCCESSThe command to erase the flash was executed successfully.
SSP_ERR_UNSUPPORTEDThe device address is invalid.
SSP_ERR_ASSERTIONp_ctrl or p_device_address is NULL.
SSP_ERR_INVALID_ARGUMENTInvalid byte_count entered.
SSP_ERR_NOT_OPENDriver 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

◆ R_QSPI_InfoGet()

ssp_err_t R_QSPI_InfoGet ( qspi_ctrl_t p_api_ctrl,
qspi_info_t *const  p_info 
)

Returns the information about the flash.

Return values
SSP_SUCCESSOperation was successful.
SSP_ERR_ASSERTIONp_ctrl or p_info is NULL.
SSP_ERR_NOT_OPENDriver is not opened.

Check if the device is open

Get the information of underlying flash

◆ R_QSPI_Open()

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.

Return values
SSP_SUCCESSConfiguration was successful.
SSP_ERR_ASSERTIONThe parameter p_ctrl or p_cfg is NULL.
SSP_ERR_UNSUPPORTEDDriver not able to query the following information from the flash manufacturer id,memory capacity and memory type.
SSP_ERR_IN_USEQSPI resource is locked.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:

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

◆ R_QSPI_PageProgram()

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.

Return values
SSP_SUCCESSThe flash was programmed successfully.
SSP_ERR_UNSUPPORTEDThe device address is invalid.
SSP_ERR_ASSERTIONp_ctrl, p_device_address or p_memory_address is NULL.
SSP_ERR_INVALID_ARGUMENTInvalid parameter is passed.
SSP_ERR_NOT_OPENDriver 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

◆ R_QSPI_Read()

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.

Return values
SSP_SUCCESSThe flash was programmed successfully.
SSP_ERR_UNSUPPORTEDThe device address is invalid.
SSP_ERR_ASSERTIONp_ctrl,p_device_address or p_memory_address is NULL.
SSP_ERR_NOT_OPENDriver is not opened.
SSP_ERR_TRANSFER_BUSYAnother 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.

◆ R_QSPI_SectorErase()

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.

Return values
SSP_SUCCESSThe command to erase the sector of flash was executed successfully.
SSP_ERR_UNSUPPORTEDThe device address is invalid.
SSP_ERR_ASSERTIONp_ctrl or p_device_address is NULL.
SSP_ERR_NOT_OPENDriver 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

◆ R_QSPI_StatusGet()

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.

Return values
SSP_SUCCESSThe write status is correct.
SSP_ERR_ASSERTIONp_ctrl or p_write_in_progress is NULL.
SSP_ERR_NOT_OPENDriver 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

◆ R_QSPI_VersionGet()

ssp_err_t R_QSPI_VersionGet ( ssp_version_t *const  p_version)

Get the driver version based on compile time macros.

Return values
SSP_SUCCESSSuccessful close.
SSP_ERR_ASSERTIONp_version is NULL.