![]() |
Synergy Software Package User's Manual
|
Driver for the High-performance Flash Memory (S7G2 and S5D9). More...
Data Structures | |
| struct | flash_hp_instance_ctrl_t |
Functions | |
| ssp_err_t | R_FLASH_HP_Open (flash_ctrl_t *const p_api_ctrl, flash_cfg_t const *const p_cfg) |
| Initializes the flash peripheral. Implements flash_api_t::open. More... | |
| ssp_err_t | R_FLASH_HP_Write (flash_ctrl_t *const p_api_ctrl, uint32_t const src_address, uint32_t flash_address, uint32_t const num_bytes) |
| Writes to the specified Code or Data Flash memory area. Implements flash_api_t::write. More... | |
| ssp_err_t | R_FLASH_HP_Read (flash_ctrl_t *const p_api_ctrl, uint8_t *p_dest_address, uint32_t const flash_address, uint32_t const num_bytes) |
| Reads the requested number of bytes from the supplied Data or Code Flash memory address. Implements flash_api_t::read. More... | |
| ssp_err_t | R_FLASH_HP_Erase (flash_ctrl_t *const p_api_ctrl, uint32_t const address, uint32_t const num_blocks) |
| Erases the specified Code or Data Flash blocks. Implements flash_api_t::erase by the block_erase_address. More... | |
| ssp_err_t | R_FLASH_HP_BlankCheck (flash_ctrl_t *const p_api_ctrl, uint32_t const address, uint32_t num_bytes, flash_result_t *p_blank_check_result) |
| Performs a blank check on the specified address area. Implements flash_api_t::blankCheck. More... | |
| ssp_err_t | R_FLASH_HP_StatusGet (flash_ctrl_t *const p_api_ctrl) |
| Query the FLASH peripheral for its status. Implements flash_api_t::statusGet. More... | |
| ssp_err_t | R_FLASH_HP_IdCodeSet (flash_ctrl_t *const p_api_ctrl, uint8_t const *const p_id_code, flash_id_code_mode_t mode) |
| Implements flash_api_t::idCodeSet. More... | |
| ssp_err_t | R_FLASH_HP_AccessWindowSet (flash_ctrl_t *const p_api_ctrl, uint32_t const start_addr, uint32_t const end_addr) |
| Configure an access window for the Code Flash memory using the provided start and end address. An access window defines a contiguous area in Code Flash for which programming/erase is enabled. This area is on block boundaries. The block containing start_addr is the first block. The block containing end_addr is the last block. The access window then becomes first block –> last block inclusive. Anything outside this range of Code Flash is then write protected. More... | |
| ssp_err_t | R_FLASH_HP_AccessWindowClear (flash_ctrl_t *const p_api_ctrl) |
| Remove any access window that is currently configured in the Code Flash. Subsequent to this call all Code Flash is writable. Implements flash_api_t::accessWindowClear. More... | |
| ssp_err_t | R_FLASH_HP_Reset (flash_ctrl_t *const p_api_ctrl) |
| Resets the FLASH peripheral. Implements flash_api_t::reset. No attempt is made to grab the Flash software lock before executing the reset since the assumption is that a reset will terminate any existing operation. More... | |
| ssp_err_t | R_FLASH_HP_StartUpAreaSelect (flash_ctrl_t *const p_api_ctrl, flash_startup_area_swap_t swap_type, bool is_temporary) |
| Selects which block - Default (Block 0) or Alternate (Block 1) is used as the startup area block. The provided parameters determine which block will become the active startup block and whether that action will be immediate (but temporary), or permanent subsequent to the next reset. Doing a temporary switch might appear to have limited usefulness. If there is an access window in place such that Block 0 is write protected, then one could do a temporary switch, update the block and switch them back without having to touch the access window. Implements flash_api_t::startupAreaSelect. More... | |
| ssp_err_t | R_FLASH_HP_UpdateFlashClockFreq (flash_ctrl_t *const p_api_ctrl) |
| Indicate to the already open Flash API, that the FCLK has changed since the Open(). This could be the case if the application has changed the system clock, and therefore the FCLK. Failure to call this function subsequent to changing the FCLK could result in damage to the flash macro. This function uses R_CGC_SystemClockFreqGet() to get the current FCLK frequency. Implements flash_api_t::updateFlashClockFreq. More... | |
| ssp_err_t | R_FLASH_HP_InfoGet (flash_ctrl_t *const p_api_ctrl, flash_info_t *const p_info) |
| Returns the information about the flash regions. Implements flash_api_t::infoGet. More... | |
| ssp_err_t | R_FLASH_HP_Close (flash_ctrl_t *const p_api_ctrl) |
| Releases any resources that were allocated by the Open() or any subsequent Flash operations. Implements flash_api_t::close. More... | |
| ssp_err_t | R_FLASH_HP_VersionGet (ssp_version_t *const p_version) |
| This function gets FLASH HAL driver version. More... | |
Driver for the High-performance Flash Memory (S7G2 and S5D9).
This module supports the Flash interface for the High Performance FLASH peripheral.
| ssp_err_t R_FLASH_HP_AccessWindowClear | ( | flash_ctrl_t *const | p_api_ctrl | ) |
Remove any access window that is currently configured in the Code Flash. Subsequent to this call all Code Flash is writable. Implements flash_api_t::accessWindowClear.
| SSP_SUCCESS | Access window successfully removed. |
| SSP_ERR_IN_USE | FLASH peripheral is busy with a prior operation. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl. |
| SSP_ERR_INVALID_ARGUMENT | Code Flash Programming is not enabled. |
| SSP_ERR_NOT_OPEN | Flash API has not yet been opened. |
| SSP_ERR_INVALID_HW_CONDITION | The configuration area cannot be written while DTC/DMAC, EDMAC, LCDC/2DG/JPEG are enabled. This is to prevent prohibited memory accesses while the flash sequencer is running. Refer to the technical update number TN-SY*-A033A/E. This check can be disabled by defining R_FLASH_HP_CHECK_MODULE_STOP_BITS to 0. To disable DMAC/DTC, close all modules using DMAC/DTC and call the following: ssp_err_t err; ssp_feature_t ssp_feature = {{(ssp_ip_t) 0U}}; ssp_feature.id = SSP_IP_DTC; err = R_BSP_ModuleStopAlways(&ssp_feature); |
| SSP_ERR_INVALID_LINKED_ADDRESS | HW_FLASH_HP_configurationSet is linked to an invalid region of memory. This function must not reside in prohibited regions of memory. It is recommended that the following changes be made to the linker script. For information about prohibited regions refer to the S5 series flash technical update. Technical Update number TN-SY*-A033A/E Recommended Changes: For GCC: Add the following immediately after "__data_start__ = .": . = ALIGN(4); __Code_In_RAM_Start = .; KEEP(*(.code_in_ram*)) __Code_In_RAM_End = .; For IAR: Change: place at start of RAM_region { block START_OF_RAM }; To: define block START_OF_RAM with fixed order { rw section .ssp_dtc_vector_table, block RAM_CODE }; place at start of RAM_region { block START_OF_RAM }; |
< For consistency with _LP API we return error if Code Flash not enabled
| ssp_err_t R_FLASH_HP_AccessWindowSet | ( | flash_ctrl_t *const | p_api_ctrl, |
| uint32_t const | start_addr, | ||
| uint32_t const | end_addr | ||
| ) |
Configure an access window for the Code Flash memory using the provided start and end address. An access window defines a contiguous area in Code Flash for which programming/erase is enabled. This area is on block boundaries. The block containing start_addr is the first block. The block containing end_addr is the last block. The access window then becomes first block –> last block inclusive. Anything outside this range of Code Flash is then write protected.
Implements flash_api_t::accessWindowSet.
| SSP_SUCCESS | Access window successfully configured. |
| SSP_ERR_INVALID_ADDRESS | Invalid settings for start_addr and/or end_addr. |
| SSP_ERR_IN_USE | FLASH peripheral is busy with a prior operation. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl. |
| SSP_ERR_INVALID_ARGUMENT | Code Flash Programming is not enabled. |
| SSP_ERR_NOT_OPEN | Flash API has not yet been opened. |
| SSP_ERR_INVALID_HW_CONDITION | The configuration area cannot be written while DTC/DMAC, EDMAC, LCDC/2DG/JPEG are enabled. This is to prevent prohibited memory accesses while the flash sequencer is running. Refer to the technical update number TN-SY*-A033A/E. This check can be disabled by defining R_FLASH_HP_CHECK_MODULE_STOP_BITS to 0. To disable DMAC/DTC, close all modules using DMAC/DTC and call the following: ssp_err_t err; ssp_feature_t ssp_feature = {{(ssp_ip_t) 0U}}; ssp_feature.id = SSP_IP_DTC; err = R_BSP_ModuleStopAlways(&ssp_feature); |
| SSP_ERR_INVALID_LINKED_ADDRESS | HW_FLASH_HP_configurationSet is linked to an invalid region of memory. This function must not reside in prohibited regions of memory. It is recommended that the following changes be made to the linker script. For information about prohibited regions refer to the S5 series flash technical update. Technical Update number TN-SY*-A033A/E Recommended Changes: For GCC: Add the following immediately after "__data_start__ = .": . = ALIGN(4); __Code_In_RAM_Start = .; KEEP(*(.code_in_ram*)) __Code_In_RAM_End = .; For IAR: Change: place at start of RAM_region { block START_OF_RAM }; To: define block START_OF_RAM with fixed order { rw section .ssp_dtc_vector_table, block RAM_CODE }; place at start of RAM_region { block START_OF_RAM }; |
< For consistency with _LP API we return error if Code Flash not enabled
Return status.
| ssp_err_t R_FLASH_HP_BlankCheck | ( | flash_ctrl_t *const | p_api_ctrl, |
| uint32_t const | address, | ||
| uint32_t | num_bytes, | ||
| flash_result_t * | p_blank_check_result | ||
| ) |
Performs a blank check on the specified address area. Implements flash_api_t::blankCheck.
| SSP_SUCCESS | Blankcheck operation completed with result in p_blank_check_result, or blankcheck started and in-progess (BGO mode). |
| SSP_ERR_INVALID_ADDRESS | Invalid data flash address was input. |
| SSP_ERR_INVALID_SIZE | 'num_bytes' was either too large or not aligned for the CF/DF boundary size. |
| SSP_ERR_IN_USE | Other flash operation in progress or API not initialized. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl. |
Get the block information for this address. If failure return error.
Setup blank check. If failure return error.
Initiate the Blank Check operation
Complete the flash operation.
| ssp_err_t R_FLASH_HP_Close | ( | flash_ctrl_t *const | p_api_ctrl | ) |
Releases any resources that were allocated by the Open() or any subsequent Flash operations. Implements flash_api_t::close.
| SSP_SUCCESS | Successful close. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl or p_cfg. |
Return the hardware lock for the Flash
Disable interrupts
Release the lock
Close the API
| ssp_err_t R_FLASH_HP_Erase | ( | flash_ctrl_t *const | p_api_ctrl, |
| uint32_t const | address, | ||
| uint32_t const | num_blocks | ||
| ) |
Erases the specified Code or Data Flash blocks. Implements flash_api_t::erase by the block_erase_address.
| SSP_SUCCESS | Successful open. |
| SSP_ERR_INVALID_BLOCKS | Invalid number of blocks specified |
| SSP_ERR_INVALID_ADDRESS | Invalid address specified |
| SSP_ERR_IN_USE | Other flash operation in progress, or API not initialized |
| SSP_ERR_CMD_LOCKED | FCU is in locked state, typically as a result of attempting to Erase an area that is protected by an Access Window. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl |
| SSP_ERR_NOT_OPEN | The Flash API is not Open. |
| SSP_ERR_INVALID_ARGUMENT | Code Flash Programming is not enabled and a request to erase CF was requested. |
Get the block information for this address. If failure return error.
Update Flash state and enter the respective Code or Data Flash P/E mode, may return SSP_ERR_IN_USE. If failure return error.
Configure current operation parameters based on user input.
Erase the Blocks. If not a DF BGO erase then exit PE mode and return status.
Complete the flash operation.
| ssp_err_t R_FLASH_HP_IdCodeSet | ( | flash_ctrl_t *const | p_api_ctrl, |
| uint8_t const *const | p_id_code, | ||
| flash_id_code_mode_t | mode | ||
| ) |
Implements flash_api_t::idCodeSet.
| SSP_SUCCESS | ID Code successfully configured. |
| SSP_ERR_IN_USE | FLASH peripheral is busy with a prior operation. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl. |
| SSP_ERR_INVALID_ARGUMENT | Code Flash Programming is not enabled. |
| SSP_ERR_NOT_OPEN | Flash API has not yet been opened. |
| SSP_ERR_INVALID_HW_CONDITION | The configuration area cannot be written while DTC/DMAC, EDMAC, LCDC/2DG/JPEG are enabled. This is to prevent prohibited memory accesses while the flash sequencer is running. Refer to the technical update number TN-SY*-A033A/E. This check can be disabled by defining R_FLASH_HP_CHECK_MODULE_STOP_BITS to 0. To disable DMAC/DTC, close all modules using DMAC/DTC and call the following: ssp_err_t err; ssp_feature_t ssp_feature = {{(ssp_ip_t) 0U}}; ssp_feature.id = SSP_IP_DTC; err = R_BSP_ModuleStopAlways(&ssp_feature); |
| SSP_ERR_INVALID_LINKED_ADDRESS | HW_FLASH_HP_configurationSet is linked to an invalid region of memory. This function must not reside in prohibited regions of memory. It is recommended that the following changes be made to the linker script. For information about prohibited regions refer to the S5 series flash technical update. Technical Update number TN-SY*-A033A/E Recommended Changes: For GCC: Add the following immediately after "__data_start__ = .": . = ALIGN(4); __Code_In_RAM_Start = .; KEEP(*(.code_in_ram*)) __Code_In_RAM_End = .; For IAR: Change: place at start of RAM_region { block START_OF_RAM }; To: define block START_OF_RAM with fixed order { rw section .ssp_dtc_vector_table, block RAM_CODE }; place at start of RAM_region { block START_OF_RAM }; |
Return status.
| ssp_err_t R_FLASH_HP_InfoGet | ( | flash_ctrl_t *const | p_api_ctrl, |
| flash_info_t *const | p_info | ||
| ) |
Returns the information about the flash regions. Implements flash_api_t::infoGet.
| SSP_SUCCESS | Successful retrieved the request information. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl or p_info. |
Eliminate warning if parameter checking is disabled.
Copy information about the code and data flash to the user structure.
| ssp_err_t R_FLASH_HP_Open | ( | flash_ctrl_t *const | p_api_ctrl, |
| flash_cfg_t const *const | p_cfg | ||
| ) |
Initializes the flash peripheral. Implements flash_api_t::open.
The Open function initializes the Flash. It first copies the FCU firmware to FCURAM and sets the FCU Clock based on the current FCLK frequency. In addition, if Code Flash programming is enabled, the API code responsible for Code Flash programming will be copied to RAM.
This function must be called once prior to calling any other FLASH API functions. If a user supplied callback function is supplied, then the Flash Ready and Error interrupts will be configured to call the users callback routine with an Event type describing the source of the interrupt.
Subsequent to a successful Open(), the Flash is ready to process additional Flash commands.
| SSP_SUCCESS | Initialization was successful and timer has started. |
| SSP_FLASH_ERR_FAILURE | Failed to successfully enter Programming/Erase mode. |
| SSP_ERR_TIMEOUT | Timed out waiting for FCU to be ready. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl or p_cfg or problem getting FMI info. |
| SSP_ERR_IRQ_BSP_DISABLED | Caller is requesting BGO but the Flash interrupts are not enabled. |
| SSP_ERR_FCLK | FCLK must be a minimum of 4 MHz for Flash operations. |
| SSP_ERR_HW_LOCKED | FLASH peripheral has already been initialized and is in use. |
Setup the flash FMI and acquire the hardware lock. If failure return error.
Allow Initialization if not initialized or if no operation is ongoing and re-initialization is desired
Acquire the flash hp software lock.
Set the parameters struct based on the user supplied settings
If BGO is enabled for data flash configure the callback and enable flash iterrupts. Otherwise disable interrupts.
Flash open setup.
Save callback function pointer
| ssp_err_t R_FLASH_HP_Read | ( | flash_ctrl_t *const | p_api_ctrl, |
| uint8_t * | p_dest_address, | ||
| uint32_t const | flash_address, | ||
| uint32_t const | num_bytes | ||
| ) |
Reads the requested number of bytes from the supplied Data or Code Flash memory address. Implements flash_api_t::read.
| SSP_SUCCESS | Operation successful. |
| SSP_ERR_INVALID_ADDRESS | Invalid Flash address was supplied. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl or p_dest_address |
Eliminate warning if parameter checking is disabled.
Copy data to the destination buffer.
| ssp_err_t R_FLASH_HP_Reset | ( | flash_ctrl_t *const | p_api_ctrl | ) |
Resets the FLASH peripheral. Implements flash_api_t::reset. No attempt is made to grab the Flash software lock before executing the reset since the assumption is that a reset will terminate any existing operation.
| SSP_SUCCESS | Flash circuit successfully reset. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl. |
Reset the flash.
Release the flash.
| ssp_err_t R_FLASH_HP_StartUpAreaSelect | ( | flash_ctrl_t *const | p_api_ctrl, |
| flash_startup_area_swap_t | swap_type, | ||
| bool | is_temporary | ||
| ) |
Selects which block - Default (Block 0) or Alternate (Block 1) is used as the startup area block. The provided parameters determine which block will become the active startup block and whether that action will be immediate (but temporary), or permanent subsequent to the next reset. Doing a temporary switch might appear to have limited usefulness. If there is an access window in place such that Block 0 is write protected, then one could do a temporary switch, update the block and switch them back without having to touch the access window. Implements flash_api_t::startupAreaSelect.
| SSP_SUCCESS | Start-up area successfully toggled. |
| SSP_ERR_IN_USE | FLASH peripheral is busy with a prior operation. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl. |
| SSP_ERR_INVALID_HW_CONDITION | The configuration area cannot be written while DTC/DMAC, EDMAC, LCDC/2DG/JPEG are enabled. This is to prevent prohibited memory accesses while the flash sequencer is running. Refer to the technical update number TN-SY*-A033A/E. This check can be disabled by defining R_FLASH_HP_CHECK_MODULE_STOP_BITS to 0. To disable DMAC/DTC, close all modules using DMAC/DTC and call the following: ssp_err_t err; ssp_feature_t ssp_feature = {{(ssp_ip_t) 0U}}; ssp_feature.id = SSP_IP_DTC; err = R_BSP_ModuleStopAlways(&ssp_feature); |
| SSP_ERR_INVALID_LINKED_ADDRESS | HW_FLASH_HP_configurationSet is linked to an invalid region of memory. This function must not reside in prohibited regions of memory. It is recommended that the following changes be made to the linker script. For information about prohibited regions refer to the S5 series flash technical update. Technical Update number TN-SY*-A033A/E Recommended Changes: For GCC: Add the following immediately after "__data_start__ = .": . = ALIGN(4); __Code_In_RAM_Start = .; KEEP(*(.code_in_ram*)) __Code_In_RAM_End = .; For IAR: Change: place at start of RAM_region { block START_OF_RAM }; To: define block START_OF_RAM with fixed order { rw section .ssp_dtc_vector_table, block RAM_CODE }; place at start of RAM_region { block START_OF_RAM }; |
Enter PE Mode.
Swap the block temporarily or permantly based on caller.
If failure reset the flash.
Release the flash and return status.
| ssp_err_t R_FLASH_HP_StatusGet | ( | flash_ctrl_t *const | p_api_ctrl | ) |
Query the FLASH peripheral for its status. Implements flash_api_t::statusGet.
| SSP_SUCCESS | FLASH peripheral is ready to use. |
| SSP_ERR_IN_USE | FLASH peripheral is busy with a prior operation. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl. |
Eliminate warning if parameter checking is disabled.
Return flash status
| ssp_err_t R_FLASH_HP_UpdateFlashClockFreq | ( | flash_ctrl_t *const | p_api_ctrl | ) |
Indicate to the already open Flash API, that the FCLK has changed since the Open(). This could be the case if the application has changed the system clock, and therefore the FCLK. Failure to call this function subsequent to changing the FCLK could result in damage to the flash macro. This function uses R_CGC_SystemClockFreqGet() to get the current FCLK frequency. Implements flash_api_t::updateFlashClockFreq.
| SSP_SUCCESS | Start-up area successfully toggled. |
| SSP_ERR_IN_USE | Flash is busy with an on-going operation. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl |
| SSP_ERR_NOT_OPEN | Flash API has not yet been opened. |
Lock the flash state. If failure return error.
Flash Setup
Release the flash.
| ssp_err_t R_FLASH_HP_VersionGet | ( | ssp_version_t *const | p_version | ) |
This function gets FLASH HAL driver version.
| SSP_SUCCESS | - operation performed successfully |
Copy the version information.
| ssp_err_t R_FLASH_HP_Write | ( | flash_ctrl_t *const | p_api_ctrl, |
| uint32_t const | src_address, | ||
| uint32_t | flash_address, | ||
| uint32_t const | num_bytes | ||
| ) |
Writes to the specified Code or Data Flash memory area. Implements flash_api_t::write.
| SSP_SUCCESS | Operation successful. If BGO is enabled this means the operation was started successfully. |
| SSP_ERR_IN_USE | The Flash peripheral is busy with a prior on-going transaction. |
| SSP_ERR_NOT_OPEN | The Flash API is not Open. |
| SSP_ERR_CMD_LOCKED | FCU is in locked state, typically as a result of attempting to Write an area that is protected by an Access Window. |
| SSP_ERR_WRITE_FAILED | Status is indicating a Programming error for the requested operation. This may be returned if the requested Flash area is not blank. |
| SSP_ERR_TIMEOUT | Timed out waiting for FCU operation to complete. |
| SSP_ERR_INVALID_SIZE | Number of bytes provided was not a multiple of the programming size or exceeded the maximum range. |
| SSP_ERR_INVALID_ADDRESS | Invalid address was input or address not on programming boundary. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl. |
| SSP_ERR_INVALID_ARGUMENT | Code Flash Programming is not enabled and a request to write CF was requested. |
Get the block information for this address. If failure return error.
Initiate the write operation, may return SSP_ERR_IN_USE via setup_for_pe_mode()
Execute a reset if any error, release the state if not BGO