Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Flash_driver
Data Structures | |
struct | _flash_execute_in_ram_function_config |
Flash execute-in-ram function information. More... | |
struct | _flash_swap_state_config |
Flash Swap information. More... | |
struct | _flash_swap_ifr_field_config |
Flash Swap IFR fileds. More... | |
struct | _flash_operation_config |
Active flash information for current operation. More... | |
struct | _flash_config |
Flash driver state information. More... | |
Typedefs | |
typedef enum _flash_margin_value | flash_margin_value_t |
Enumeration for supported flash margin levels. | |
typedef enum _flash_security_state | flash_security_state_t |
Enumeration for the three possible flash security states. | |
typedef enum _flash_protection_state | flash_protection_state_t |
Enumeration for the three possible flash protection levels. | |
typedef enum _flash_execute_only_access_state | flash_execute_only_access_state_t |
Enumeration for the three possible flash execute access levels. | |
typedef enum _flash_property_tag | flash_property_tag_t |
Enumeration for various flash properties. | |
typedef struct _flash_execute_in_ram_function_config | flash_execute_in_ram_function_config_t |
Flash execute-in-ram function information. | |
typedef enum _flash_read_resource_option | flash_read_resource_option_t |
Enumeration for the two possible options of flash read resource command. | |
typedef enum _flash_flexram_function_option | flash_flexram_function_option_t |
Enumeration for the two possilbe options of set flexram function command. | |
typedef enum _flash_swap_function_option | flash_swap_function_option_t |
Enumeration for the possible options of Swap function. | |
typedef enum _flash_swap_control_option | flash_swap_control_option_t |
Enumeration for the possible options of Swap Control commands. | |
typedef enum _flash_swap_state | flash_swap_state_t |
Enumeration for the possible flash swap status. | |
typedef enum _flash_swap_block_status | flash_swap_block_status_t |
typedef struct _flash_swap_state_config | flash_swap_state_config_t |
Flash Swap information. | |
typedef struct _flash_swap_ifr_field_config | flash_swap_ifr_field_config_t |
Flash Swap IFR fileds. | |
typedef enum _flash_partition_flexram_load_option | flash_partition_flexram_load_option_t |
Enumeration for FlexRAM load during reset option. | |
typedef void(* | flash_callback_t )(void) |
callback type used for pflash block | |
typedef struct _flash_operation_config | flash_operation_config_t |
Active flash information for current operation. | |
typedef struct _flash_config | flash_config_t |
Flash driver state information. | |
Enumerations | |
enum | _flash_margin_value { kFLASH_marginValueNormal, kFLASH_marginValueUser, kFLASH_marginValueFactory, kFLASH_marginValueInvalid } |
Enumeration for supported flash margin levels. More... | |
enum | _flash_security_state { kFLASH_securityStateNotSecure, kFLASH_securityStateBackdoorEnabled, kFLASH_securityStateBackdoorDisabled } |
Enumeration for the three possible flash security states. More... | |
enum | _flash_protection_state { kFLASH_protectionStateUnprotected, kFLASH_protectionStateProtected, kFLASH_protectionStateMixed } |
Enumeration for the three possible flash protection levels. More... | |
enum | _flash_execute_only_access_state { kFLASH_accessStateUnLimited, kFLASH_accessStateExecuteOnly, kFLASH_accessStateMixed } |
Enumeration for the three possible flash execute access levels. More... | |
enum | _flash_property_tag { kFLASH_propertyPflashSectorSize = 0x00U, kFLASH_propertyPflashTotalSize = 0x01U, kFLASH_propertyPflashBlockSize = 0x02U, kFLASH_propertyPflashBlockCount = 0x03U, kFLASH_propertyPflashBlockBaseAddr = 0x04U, kFLASH_propertyPflashFacSupport = 0x05U, kFLASH_propertyPflashAccessSegmentSize = 0x06U, kFLASH_propertyPflashAccessSegmentCount = 0x07U, kFLASH_propertyFlexRamBlockBaseAddr = 0x08U, kFLASH_propertyFlexRamTotalSize = 0x09U, kFLASH_propertyDflashSectorSize = 0x10U, kFLASH_propertyDflashTotalSize = 0x11U, kFLASH_propertyDflashBlockSize = 0x12U, kFLASH_propertyDflashBlockCount = 0x13U, kFLASH_propertyDflashBlockBaseAddr = 0x14U } |
Enumeration for various flash properties. More... | |
enum | _flash_execute_in_ram_function_constants { kFLASH_executeInRamFunctionMaxSize = 64U, kFLASH_executeInRamFunctionTotalNum = 2U } |
Constants for execute-in-ram flash function. More... | |
enum | _flash_read_resource_option { kFLASH_resourceOptionFlashIfr, kFLASH_resourceOptionVersionId = 0x01U } |
Enumeration for the two possible options of flash read resource command. More... | |
enum | _flash_read_resource_range { kFLASH_resourceRangePflashIfrSizeInBytes = 1024U, kFLASH_resourceRangeVersionIdSizeInBytes = 8U, kFLASH_resourceRangeVersionIdStart = 0x08U, kFLASH_resourceRangeVersionIdEnd = 0x0FU, kFLASH_resourceRangePflashIfrSizeInBytes = 1024U, kFLASH_resourceRangeVersionIdSizeInBytes = 8U, kFLASH_resourceRangeVersionIdStart = 0x08U, kFLASH_resourceRangeVersionIdEnd = 0x0FU, kFLASH_resourceRangePflashSwapIfrStart = 0x40000U, kFLASH_resourceRangePflashSwapIfrEnd = 0x403FFU, kFLASH_resourceRangeDflashIfrStart = 0x800000U, kFLASH_resourceRangeDflashIfrEnd = 0x8003FFU } |
Enumeration for the range of special-purpose flash resource. More... | |
enum | _flash_flexram_function_option { kFLASH_flexramFunctionOptionAvailableAsRam = 0xFFU, kFLASH_flexramFunctionOptionAvailableForEeprom = 0x00U } |
Enumeration for the two possilbe options of set flexram function command. More... | |
enum | _flash_swap_function_option { kFLASH_swapFunctionOptionEnable = 0x00U, kFLASH_swapFunctionOptionDisable = 0x01U } |
Enumeration for the possible options of Swap function. More... | |
enum | _flash_swap_control_option { kFLASH_swapControlOptionIntializeSystem = 0x01U, kFLASH_swapControlOptionSetInUpdateState = 0x02U, kFLASH_swapControlOptionSetInCompleteState = 0x04U, kFLASH_swapControlOptionReportStatus = 0x08U, kFLASH_swapControlOptionDisableSystem = 0x10U } |
Enumeration for the possible options of Swap Control commands. More... | |
enum | _flash_swap_state { kFLASH_swapStateUninitialized = 0x00U, kFLASH_swapStateReady = 0x01U, kFLASH_swapStateUpdate = 0x02U, kFLASH_swapStateUpdateErased = 0x03U, kFLASH_swapStateComplete = 0x04U, kFLASH_swapStateDisabled = 0x05U } |
Enumeration for the possible flash swap status. More... | |
enum | _flash_swap_block_status { kFLASH_swapBlockStatusLowerHalfProgramBlocksAtZero, kFLASH_swapBlockStatusUpperHalfProgramBlocksAtZero } |
enum | _flash_partition_flexram_load_option { kFLASH_partitionFlexramLoadOptionLoadedWithValidEepromData, kFLASH_partitionFlexramLoadOptionNotLoaded = 0x01U } |
Enumeration for FlexRAM load during reset option. More... | |
Flash version | |
enum | _flash_driver_version_constants { kFLASH_driverVersionName = 'F', kFLASH_driverVersionMajor = 2, kFLASH_driverVersionMinor = 0, kFLASH_driverVersionBugfix = 0 } |
FLASH driver version for ROM. More... | |
Flash status | |
enum | _flash_status { kStatus_FLASH_Success = MAKE_STATUS(kStatusGroupGeneric, 0), kStatus_FLASH_InvalidArgument = MAKE_STATUS(kStatusGroupGeneric, 4), kStatus_FLASH_SizeError = MAKE_STATUS(kStatusGroupFlashDriver, 0), kStatus_FLASH_AlignmentError, kStatus_FLASH_AddressError = MAKE_STATUS(kStatusGroupFlashDriver, 2), kStatus_FLASH_AccessError, kStatus_FLASH_ProtectionViolation, kStatus_FLASH_CommandFailure, kStatus_FLASH_UnknownProperty = MAKE_STATUS(kStatusGroupFlashDriver, 6), kStatus_FLASH_EraseKeyError = MAKE_STATUS(kStatusGroupFlashDriver, 7), kStatus_FLASH_RegionExecuteOnly = MAKE_STATUS(kStatusGroupFlashDriver, 8), kStatus_FLASH_ExecuteInRamFunctionNotReady, kStatus_FLASH_PartitionStatusUpdateFailure, kStatus_FLASH_SetFlexramAsEepromError, kStatus_FLASH_RecoverFlexramAsRamError, kStatus_FLASH_SetFlexramAsRamError = MAKE_STATUS(kStatusGroupFlashDriver, 13), kStatus_FLASH_RecoverFlexramAsEepromError, kStatus_FLASH_CommandNotSupported = MAKE_STATUS(kStatusGroupFlashDriver, 15), kStatus_FLASH_SwapSystemNotInUninitialized, kStatus_FLASH_SwapIndicatorAddressError } |
Flash driver status codes. More... | |
Flash API key | |
enum | _flash_driver_api_keys { kFLASH_apiEraseKey = FOUR_CHAR_CODE('k', 'f', 'e', 'k') } |
Enumeration for flash driver API keys. More... | |
Initialization | |
status_t | FLASH_Init (flash_config_t *config) |
Initializes global flash properties structure members. | |
status_t | FLASH_SetCallback (flash_config_t *config, flash_callback_t callback) |
Set the desired flash callback function. | |
status_t | FLASH_PrepareExecuteInRamFunctions (flash_config_t *config) |
Prepare flash execute-in-ram functions. | |
Erasing | |
status_t | FLASH_EraseAll (flash_config_t *config, uint32_t key) |
Erases entire flash. | |
status_t | FLASH_Erase (flash_config_t *config, uint32_t start, uint32_t lengthInBytes, uint32_t key) |
Erases flash sectors encompassed by parameters passed into function. | |
status_t | FLASH_EraseAllUnsecure (flash_config_t *config, uint32_t key) |
Erases entire flash, including protected sectors. | |
status_t | FLASH_EraseAllExecuteOnlySegments (flash_config_t *config, uint32_t key) |
Erases all program flash execute-only segments defined by the FXACC registers. | |
Programming | |
status_t | FLASH_Program (flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes) |
Programs flash with data at locations passed in through parameters. | |
status_t | FLASH_ProgramOnce (flash_config_t *config, uint32_t index, uint32_t *src, uint32_t lengthInBytes) |
Programs Program Once Field through parameters. | |
status_t | FLASH_ProgramSection (flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes) |
Programs flash with data at locations passed in through parameters via Program Section command. | |
status_t | FLASH_EepromWrite (flash_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes) |
Programs EEPROM with data at locations passed in through parameters. | |
Reading | |
status_t | FLASH_ReadResource (flash_config_t *config, uint32_t start, uint32_t *dst, uint32_t lengthInBytes, flash_read_resource_option_t option) |
Read resource with data at locations passed in through parameters. | |
status_t | FLASH_ReadOnce (flash_config_t *config, uint32_t index, uint32_t *dst, uint32_t lengthInBytes) |
Read Program Once Field through parameters. | |
Security | |
status_t | FLASH_GetSecurityState (flash_config_t *config, flash_security_state_t *state) |
Returns the security state via the pointer passed into the function. | |
status_t | FLASH_SecurityBypass (flash_config_t *config, const uint8_t *backdoorKey) |
Allows user to bypass security with a backdoor key. | |
Verification | |
status_t | FLASH_VerifyEraseAll (flash_config_t *config, flash_margin_value_t margin) |
Verifies erasure of entire flash at specified margin level. | |
status_t | FLASH_VerifyErase (flash_config_t *config, uint32_t start, uint32_t lengthInBytes, flash_margin_value_t margin) |
Verifies erasure of desired flash area at specified margin level. | |
status_t | FLASH_VerifyProgram (flash_config_t *config, uint32_t start, uint32_t lengthInBytes, const uint32_t *expectedData, flash_margin_value_t margin, uint32_t *failedAddress, uint32_t *failedData) |
Verifies programming of desired flash area at specified margin level. | |
status_t | FLASH_VerifyEraseAllExecuteOnlySegments (flash_config_t *config, flash_margin_value_t margin) |
Verifies if the program flash executeonly segments have been erased to the specified read margin level. | |
Protection | |
status_t | FLASH_IsProtected (flash_config_t *config, uint32_t start, uint32_t lengthInBytes, flash_protection_state_t *protection_state) |
Returns the protection state of desired flash area via the pointer passed into the function. | |
status_t | FLASH_IsExecuteOnly (flash_config_t *config, uint32_t start, uint32_t lengthInBytes, flash_execute_only_access_state_t *access_state) |
Returns the access state of desired flash area via the pointer passed into the function. | |
Properties | |
status_t | FLASH_GetProperty (flash_config_t *config, flash_property_tag_t whichProperty, uint32_t *value) |
Returns the desired flash property. | |
FlexRAM | |
status_t | FLASH_SetFlexramFunction (flash_config_t *config, flash_flexram_function_option_t option) |
Set FlexRAM Function command. | |
Swap | |
status_t | FLASH_SwapControl (flash_config_t *config, uint32_t address, flash_swap_control_option_t option, flash_swap_state_config_t *returnInfo) |
Configure Swap function or Check the swap state of Flash Module. | |
status_t | FLASH_Swap (flash_config_t *config, uint32_t address, flash_swap_function_option_t option) |
Swap the lower half flash with the higher half flaock. | |
FlexNVM | |
status_t | FLASH_ProgramPartition (flash_config_t *config, flash_partition_flexram_load_option_t option, uint32_t eepromDataSizeCode, uint32_t flexnvmPartitionCode) |
Prepares the FlexNVM block for use as data flash, EEPROM backup, or a combination of both and initializes the FlexRAM. | |
Flash Protection Utilities | |
status_t | FLASH_PflashSetProtection (flash_config_t *config, uint32_t protectStatus) |
Set PFLASH Protection to the intended protection status. | |
status_t | FLASH_PflashGetProtection (flash_config_t *config, uint32_t *protectStatus) |
Get PFLASH Protection Status. | |
status_t | FLASH_DflashSetProtection (flash_config_t *config, uint8_t protectStatus) |
Set DFLASH Protection to the intended protection status. | |
status_t | FLASH_DflashGetProtection (flash_config_t *config, uint8_t *protectStatus) |
Get DFLASH Protection Status. | |
status_t | FLASH_EepromSetProtection (flash_config_t *config, uint8_t protectStatus) |
Set EEPROM Protection to the intended protection status. | |
status_t | FLASH_EepromGetProtection (flash_config_t *config, uint8_t *protectStatus) |
Get DFLASH Protection Status. |
Typedef Documentation
typedef void(* flash_callback_t)(void) |
callback type used for pflash block
Definition at line 389 of file fsl_flash.h.
typedef struct _flash_config flash_config_t |
Flash driver state information.
An instance of this structure is allocated by the user of the flash driver and passed into each of the driver APIs.
Flash execute-in-ram function information.
Enumeration for the three possible flash execute access levels.
Enumeration for the two possilbe options of set flexram function command.
typedef enum _flash_margin_value flash_margin_value_t |
Enumeration for supported flash margin levels.
typedef struct _flash_operation_config flash_operation_config_t |
Active flash information for current operation.
Enumeration for FlexRAM load during reset option.
typedef enum _flash_property_tag flash_property_tag_t |
Enumeration for various flash properties.
typedef enum _flash_protection_state flash_protection_state_t |
Enumeration for the three possible flash protection levels.
typedef enum _flash_read_resource_option flash_read_resource_option_t |
Enumeration for the two possible options of flash read resource command.
typedef enum _flash_security_state flash_security_state_t |
Enumeration for the three possible flash security states.
typedef enum _flash_swap_block_status flash_swap_block_status_t |
Enumeration for the possible flash swap block status
typedef enum _flash_swap_control_option flash_swap_control_option_t |
Enumeration for the possible options of Swap Control commands.
typedef enum _flash_swap_function_option flash_swap_function_option_t |
Enumeration for the possible options of Swap function.
typedef struct _flash_swap_ifr_field_config flash_swap_ifr_field_config_t |
Flash Swap IFR fileds.
typedef struct _flash_swap_state_config flash_swap_state_config_t |
Flash Swap information.
typedef enum _flash_swap_state flash_swap_state_t |
Enumeration for the possible flash swap status.
Enumeration Type Documentation
Enumeration for flash driver API keys.
- Note:
- The resulting value is built with a byte order such that the string being readable in expected order when viewed in a hex editor, if the value is treated as a 32-bit little endian value.
Definition at line 181 of file fsl_flash.h.
FLASH driver version for ROM.
- Enumerator:
Definition at line 65 of file fsl_flash.h.
Constants for execute-in-ram flash function.
- Enumerator:
kFLASH_executeInRamFunctionMaxSize Max size of execute-in-ram function.
kFLASH_executeInRamFunctionTotalNum Total number of execute-in-ram functions.
Definition at line 254 of file fsl_flash.h.
Enumeration for the three possible flash execute access levels.
- Enumerator:
kFLASH_accessStateUnLimited Flash region is unLimited.
kFLASH_accessStateExecuteOnly Flash region is execute only.
kFLASH_accessStateMixed Flash is mixed with unLimited and execute only region.
Definition at line 221 of file fsl_flash.h.
Enumeration for the two possilbe options of set flexram function command.
- Enumerator:
kFLASH_flexramFunctionOptionAvailableAsRam Option used to make FlexRAM available as RAM
kFLASH_flexramFunctionOptionAvailableForEeprom Option used to make FlexRAM available for EEPROM
Definition at line 305 of file fsl_flash.h.
enum _flash_margin_value |
Enumeration for supported flash margin levels.
- Enumerator:
Definition at line 190 of file fsl_flash.h.
Enumeration for FlexRAM load during reset option.
- Enumerator:
Definition at line 381 of file fsl_flash.h.
enum _flash_property_tag |
Enumeration for various flash properties.
- Enumerator:
Definition at line 231 of file fsl_flash.h.
Enumeration for the three possible flash protection levels.
- Enumerator:
Definition at line 211 of file fsl_flash.h.
Enumeration for the two possible options of flash read resource command.
- Enumerator:
kFLASH_resourceOptionFlashIfr Select code for Program flash 0 IFR, Program flash swap 0 IFR, Data flash 0 IFR
kFLASH_resourceOptionVersionId Select code for Version ID
Definition at line 273 of file fsl_flash.h.
Enumeration for the range of special-purpose flash resource.
- Enumerator:
Definition at line 283 of file fsl_flash.h.
Enumeration for the three possible flash security states.
- Enumerator:
kFLASH_securityStateNotSecure Flash is not secure.
kFLASH_securityStateBackdoorEnabled Flash backdoor is enabled.
kFLASH_securityStateBackdoorDisabled Flash backdoor is disabled.
Definition at line 201 of file fsl_flash.h.
enum _flash_status |
Flash driver status codes.
- Enumerator:
Definition at line 129 of file fsl_flash.h.
Enumeration for the possible flash swap block status
- Enumerator:
Definition at line 348 of file fsl_flash.h.
Enumeration for the possible options of Swap Control commands.
- Enumerator:
Definition at line 323 of file fsl_flash.h.
Enumeration for the possible options of Swap function.
- Enumerator:
kFLASH_swapFunctionOptionEnable Option used to enable Swap function
kFLASH_swapFunctionOptionDisable Option used to Disable Swap function
Definition at line 314 of file fsl_flash.h.
enum _flash_swap_state |
Enumeration for the possible flash swap status.
- Enumerator:
Definition at line 335 of file fsl_flash.h.
Function Documentation
status_t FLASH_DflashGetProtection | ( | flash_config_t * | config, |
uint8_t * | protectStatus | ||
) |
Get DFLASH Protection Status.
- Parameters:
-
config Pointer to storage for the driver runtime state. protectStatus DFlash Protect status returned by PFlash IP. Each bit is corresponding to protection of 1/8 of the total DFlash. The least significant bit is corresponding to the lowest address area of DFlash. The most significant bit is corresponding to the highest address area of DFlash and so on. There are two possible cases as below: 0: this area is protected. 1: this area is unprotected.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_CommandNotSupported Flash api is not supported
status_t FLASH_DflashSetProtection | ( | flash_config_t * | config, |
uint8_t | protectStatus | ||
) |
Set DFLASH Protection to the intended protection status.
- Parameters:
-
config Pointer to storage for the driver runtime state. protectStatus The expected protect status user wants to set to DFlash protection register. Each bit is corresponding to protection of 1/8 of the total DFlash. The least significant bit is corresponding to the lowest address area of DFlash. The most significant bit is corresponding to the highest address area of DFlash. There are two possible cases as shown below: 0: this area is protected. 1: this area is unprotected.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_CommandNotSupported Flash api is not supported kStatus_FLASH_CommandFailure Run-time error during command execution.
status_t FLASH_EepromGetProtection | ( | flash_config_t * | config, |
uint8_t * | protectStatus | ||
) |
Get DFLASH Protection Status.
- Parameters:
-
config Pointer to storage for the driver runtime state. protectStatus DFlash Protect status returned by PFlash IP. Each bit is corresponding to protection of 1/8 of the total EEPROM. The least significant bit is corresponding to the lowest address area of EEPROM. The most significant bit is corresponding to the highest address area of EEPROM. There are two possible cases as below: 0: this area is protected. 1: this area is unprotected.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_CommandNotSupported Flash api is not supported.
status_t FLASH_EepromSetProtection | ( | flash_config_t * | config, |
uint8_t | protectStatus | ||
) |
Set EEPROM Protection to the intended protection status.
- Parameters:
-
config Pointer to storage for the driver runtime state. protectStatus The expected protect status user wants to set to EEPROM protection register. Each bit is corresponding to protection of 1/8 of the total EEPROM. The least significant bit is corresponding to the lowest address area of EEPROM. The most significant bit is corresponding to the highest address area of EEPROM, and so on. There are two possible cases as shown below: 0: this area is protected. 1: this area is unprotected.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_CommandNotSupported Flash api is not supported kStatus_FLASH_CommandFailure Run-time error during command execution.
status_t FLASH_EepromWrite | ( | flash_config_t * | config, |
uint32_t | start, | ||
uint8_t * | src, | ||
uint32_t | lengthInBytes | ||
) |
Programs EEPROM with data at locations passed in through parameters.
This function programs the Emulated EEPROM with desired data for a given flash area as determined by the start address and length.
- Parameters:
-
config Pointer to storage for the driver runtime state. start The start address of the desired flash memory to be programmed. Must be word-aligned. src Pointer to the source buffer of data that is to be programmed into the flash. lengthInBytes The length, given in bytes (not words or long-words) to be programmed. Must be word-aligned.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_AddressError Address is out of range. kStatus_FLASH_SetFlexramAsEepromError Failed to set flexram as eeprom. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_RecoverFlexramAsRamError Failed to recover flexram as ram
status_t FLASH_Erase | ( | flash_config_t * | config, |
uint32_t | start, | ||
uint32_t | lengthInBytes, | ||
uint32_t | key | ||
) |
Erases flash sectors encompassed by parameters passed into function.
This function erases the appropriate number of flash sectors based on the desired start address and length.
- Parameters:
-
config Pointer to storage for the driver runtime state. start The start address of the desired flash memory to be erased. The start address does not need to be sector aligned but must be word-aligned. lengthInBytes The length, given in bytes (not words or long-words) to be erased. Must be word aligned. key value used to validate all flash erase APIs.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. kStatus_FLASH_AddressError Address is out of range. kStatus_FLASH_EraseKeyError Api erase key is invalid. kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution.
Definition at line 513 of file fsl_flash.c.
status_t FLASH_EraseAll | ( | flash_config_t * | config, |
uint32_t | key | ||
) |
Erases entire flash.
- Parameters:
-
config Pointer to storage for the driver runtime state. key value used to validate all flash erase APIs.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_EraseKeyError Api erase key is invalid. kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution. kStatus_FLASH_PartitionStatusUpdateFailure Failed to update partition status
Definition at line 477 of file fsl_flash.c.
status_t FLASH_EraseAllExecuteOnlySegments | ( | flash_config_t * | config, |
uint32_t | key | ||
) |
Erases all program flash execute-only segments defined by the FXACC registers.
- Parameters:
-
config Pointer to storage for the driver runtime state. key value used to validate all flash erase APIs.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_EraseKeyError Api erase key is invalid. kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution.
status_t FLASH_EraseAllUnsecure | ( | flash_config_t * | config, |
uint32_t | key | ||
) |
Erases entire flash, including protected sectors.
- Parameters:
-
config Pointer to storage for the driver runtime state. key value used to validate all flash erase APIs.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_EraseKeyError Api erase key is invalid. kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution. kStatus_FLASH_PartitionStatusUpdateFailure Failed to update partition status
status_t FLASH_GetProperty | ( | flash_config_t * | config, |
flash_property_tag_t | whichProperty, | ||
uint32_t * | value | ||
) |
Returns the desired flash property.
- Parameters:
-
config Pointer to storage for the driver runtime state. whichProperty The desired property from the list of properties in enum flash_property_tag_t value Pointer to the value returned for the desired flash property
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_UnknownProperty unknown property tag
status_t FLASH_GetSecurityState | ( | flash_config_t * | config, |
flash_security_state_t * | state | ||
) |
Returns the security state via the pointer passed into the function.
This function retrieves the current Flash security status, including the security enabling state and the backdoor key enabling state.
- Parameters:
-
config Pointer to storage for the driver runtime state. state Pointer to the value returned for the current security status code:
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided.
status_t FLASH_Init | ( | flash_config_t * | config ) |
Initializes global flash properties structure members.
This function checks and initializes Flash module for the other Flash APIs.
- Parameters:
-
config Pointer to storage for the driver runtime state.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_PartitionStatusUpdateFailure Failed to update partition status.
Definition at line 377 of file fsl_flash.c.
status_t FLASH_IsExecuteOnly | ( | flash_config_t * | config, |
uint32_t | start, | ||
uint32_t | lengthInBytes, | ||
flash_execute_only_access_state_t * | access_state | ||
) |
Returns the access state of desired flash area via the pointer passed into the function.
This function retrieves the current Flash access status for a given flash area as determined by the start address and length.
- Parameters:
-
config Pointer to storage for the driver runtime state. start The start address of the desired flash memory to be checked. Must be word-aligned. lengthInBytes The length, given in bytes (not words or long-words) to be checked. Must be word-aligned. access_state Pointer to the value returned for the current access status code for the desired flash area.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. kStatus_FLASH_AddressError Address is out of range.
status_t FLASH_IsProtected | ( | flash_config_t * | config, |
uint32_t | start, | ||
uint32_t | lengthInBytes, | ||
flash_protection_state_t * | protection_state | ||
) |
Returns the protection state of desired flash area via the pointer passed into the function.
This function retrieves the current Flash protect status for a given flash area as determined by the start address and length.
- Parameters:
-
config Pointer to storage for the driver runtime state. start The start address of the desired flash memory to be checked. Must be word-aligned. lengthInBytes The length, given in bytes (not words or long-words) to be checked. Must be word-aligned. protection_state Pointer to the value returned for the current protection status code for the desired flash area.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. kStatus_FLASH_AddressError Address is out of range.
status_t FLASH_PflashGetProtection | ( | flash_config_t * | config, |
uint32_t * | protectStatus | ||
) |
Get PFLASH Protection Status.
- Parameters:
-
config Pointer to storage for the driver runtime state. protectStatus Protect status returned by PFlash IP. Each bit is corresponding to protection of 1/32 of the total PFlash. The least significant bit is corresponding to the lowest address area of PFlash. The most significant bit is corresponding to the highest address area of PFlash. Thee are two possible cases as below: 0: this area is protected. 1: this area is unprotected.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided.
status_t FLASH_PflashSetProtection | ( | flash_config_t * | config, |
uint32_t | protectStatus | ||
) |
Set PFLASH Protection to the intended protection status.
- Parameters:
-
config Pointer to storage for the driver runtime state. protectStatus The expected protect status user wants to set to PFlash protection register. Each bit is corresponding to protection of 1/32 of the total PFlash. The least significant bit is corresponding to the lowest address area of P-Flash. The most significant bit is corresponding to the highest address area of PFlash. There are two possible cases as shown below: 0: this area is protected. 1: this area is unprotected.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_CommandFailure Run-time error during command execution.
status_t FLASH_PrepareExecuteInRamFunctions | ( | flash_config_t * | config ) |
Prepare flash execute-in-ram functions.
- Parameters:
-
config Pointer to storage for the driver runtime state.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided.
Definition at line 458 of file fsl_flash.c.
status_t FLASH_Program | ( | flash_config_t * | config, |
uint32_t | start, | ||
uint32_t * | src, | ||
uint32_t | lengthInBytes | ||
) |
Programs flash with data at locations passed in through parameters.
This function programs the flash memory with desired data for a given flash area as determined by the start address and length.
- Parameters:
-
config Pointer to storage for the driver runtime state. start The start address of the desired flash memory to be programmed. Must be word-aligned. src Pointer to the source buffer of data that is to be programmed into the flash. lengthInBytes The length, given in bytes (not words or long-words) to be programmed. Must be word-aligned.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. kStatus_FLASH_AddressError Address is out of range. kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution.
Definition at line 650 of file fsl_flash.c.
status_t FLASH_ProgramOnce | ( | flash_config_t * | config, |
uint32_t | index, | ||
uint32_t * | src, | ||
uint32_t | lengthInBytes | ||
) |
Programs Program Once Field through parameters.
This function programs the Program Once Field with desired data for a given flash area as determined by the index and length.
- Parameters:
-
config Pointer to storage for the driver runtime state. index The index indicating which area of Program Once Field to be programmed. src Pointer to the source buffer of data that is to be programmed into the Program Once Field. lengthInBytes The length, given in bytes (not words or long-words) to be programmed. Must be word-aligned.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution.
status_t FLASH_ProgramPartition | ( | flash_config_t * | config, |
flash_partition_flexram_load_option_t | option, | ||
uint32_t | eepromDataSizeCode, | ||
uint32_t | flexnvmPartitionCode | ||
) |
Prepares the FlexNVM block for use as data flash, EEPROM backup, or a combination of both and initializes the FlexRAM.
- Parameters:
-
config Pointer to storage for the driver runtime state. option The option used to set FlexRAM load behavior during reset. eepromDataSizeCode Determines the amount of FlexRAM used in each of the available EEPROM subsystems. flexnvmPartitionCode Specifies how to split the FlexNVM block between data flash memory and EEPROM backup memory supporting EEPROM functions.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution.
status_t FLASH_ProgramSection | ( | flash_config_t * | config, |
uint32_t | start, | ||
uint32_t * | src, | ||
uint32_t | lengthInBytes | ||
) |
Programs flash with data at locations passed in through parameters via Program Section command.
This function programs the flash memory with desired data for a given flash area as determined by the start address and length.
- Parameters:
-
config Pointer to storage for the driver runtime state. start The start address of the desired flash memory to be programmed. Must be word-aligned. src Pointer to the source buffer of data that is to be programmed into the flash. lengthInBytes The length, given in bytes (not words or long-words) to be programmed. Must be word-aligned.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. kStatus_FLASH_AddressError Address is out of range. kStatus_FLASH_SetFlexramAsRamError Failed to set flexram as ram kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution. kStatus_FLASH_RecoverFlexramAsEepromError Failed to recover flexram as eeprom
status_t FLASH_ReadOnce | ( | flash_config_t * | config, |
uint32_t | index, | ||
uint32_t * | dst, | ||
uint32_t | lengthInBytes | ||
) |
Read Program Once Field through parameters.
This function reads the read once feild with given index and length
- Parameters:
-
config Pointer to storage for the driver runtime state. index The index indicating the area of program once field to be read. dst Pointer to the destination buffer of data that is used to store data to be read. lengthInBytes The length, given in bytes (not words or long-words) to be programmed. Must be word-aligned.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution.
status_t FLASH_ReadResource | ( | flash_config_t * | config, |
uint32_t | start, | ||
uint32_t * | dst, | ||
uint32_t | lengthInBytes, | ||
flash_read_resource_option_t | option | ||
) |
Read resource with data at locations passed in through parameters.
This function reads the flash memory with desired location for a given flash area as determined by the start address and length.
- Parameters:
-
config Pointer to storage for the driver runtime state. start The start address of the desired flash memory to be programmed. Must be word-aligned. dst Pointer to the destination buffer of data that is used to store data to be read. lengthInBytes The length, given in bytes (not words or long-words) to be read. Must be word-aligned. option The resource option which indicates which area should be read back.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution.
status_t FLASH_SecurityBypass | ( | flash_config_t * | config, |
const uint8_t * | backdoorKey | ||
) |
Allows user to bypass security with a backdoor key.
If the MCU is in secured state, this function will unsecure the MCU by comparing the provided backdoor key with ones in the Flash Configuration Field.
- Parameters:
-
config Pointer to storage for the driver runtime state. backdoorKey Pointer to the user buffer containing the backdoor key.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution.
status_t FLASH_SetCallback | ( | flash_config_t * | config, |
flash_callback_t | callback | ||
) |
Set the desired flash callback function.
- Parameters:
-
config Pointer to storage for the driver runtime state. callback callback function to be stored in driver
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided.
Definition at line 445 of file fsl_flash.c.
status_t FLASH_SetFlexramFunction | ( | flash_config_t * | config, |
flash_flexram_function_option_t | option | ||
) |
Set FlexRAM Function command.
- Parameters:
-
config Pointer to storage for the driver runtime state. option The option used to set work mode of FlexRAM
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution.
status_t FLASH_Swap | ( | flash_config_t * | config, |
uint32_t | address, | ||
flash_swap_function_option_t | option | ||
) |
Swap the lower half flash with the higher half flaock.
- Parameters:
-
config Pointer to storage for the driver runtime state. address Address used to configure the flash swap function option The possible option used to configure Flash Swap function or check the flash swap status
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. kStatus_FLASH_SwapIndicatorAddressError Swap indicator address is invalid kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution. kStatus_FLASH_SwapSystemNotInUninitialized Swap system is not in uninitialzed state
status_t FLASH_SwapControl | ( | flash_config_t * | config, |
uint32_t | address, | ||
flash_swap_control_option_t | option, | ||
flash_swap_state_config_t * | returnInfo | ||
) |
Configure Swap function or Check the swap state of Flash Module.
- Parameters:
-
config Pointer to storage for the driver runtime state. address Address used to configure the flash swap function option The possible option used to configure Flash Swap function or check the flash swap status returnInfo Pointer to the data which is used to return the information of flash swap.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. kStatus_FLASH_SwapIndicatorAddressError Swap indicator address is invalid kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution.
status_t FLASH_VerifyErase | ( | flash_config_t * | config, |
uint32_t | start, | ||
uint32_t | lengthInBytes, | ||
flash_margin_value_t | margin | ||
) |
Verifies erasure of desired flash area at specified margin level.
This function will check the appropriate number of flash sectors based on the desired start address and length to see if the flash have been erased to the specified read margin level.
- Parameters:
-
config Pointer to storage for the driver runtime state. start The start address of the desired flash memory to be verified. The start address does not need to be sector aligned but must be word-aligned. lengthInBytes The length, given in bytes (not words or long-words) to be verified. Must be word-aligned. margin Read margin choice
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. kStatus_FLASH_AddressError Address is out of range. kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution.
Definition at line 1145 of file fsl_flash.c.
status_t FLASH_VerifyEraseAll | ( | flash_config_t * | config, |
flash_margin_value_t | margin | ||
) |
Verifies erasure of entire flash at specified margin level.
This function will check to see if the flash have been erased to the specified read margin level.
- Parameters:
-
config Pointer to storage for the driver runtime state. margin Read margin choice
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution.
Definition at line 1131 of file fsl_flash.c.
status_t FLASH_VerifyEraseAllExecuteOnlySegments | ( | flash_config_t * | config, |
flash_margin_value_t | margin | ||
) |
Verifies if the program flash executeonly segments have been erased to the specified read margin level.
- Parameters:
-
config Pointer to storage for the driver runtime state. margin Read margin choice
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution.
status_t FLASH_VerifyProgram | ( | flash_config_t * | config, |
uint32_t | start, | ||
uint32_t | lengthInBytes, | ||
const uint32_t * | expectedData, | ||
flash_margin_value_t | margin, | ||
uint32_t * | failedAddress, | ||
uint32_t * | failedData | ||
) |
Verifies programming of desired flash area at specified margin level.
This function verifies the data programed in the flash memory using the Flash Program Check Command and compares it with expected data for a given flash area as determined by the start address and length.
- Parameters:
-
config Pointer to storage for the driver runtime state. start The start address of the desired flash memory to be verified. Must be word-aligned. lengthInBytes The length, given in bytes (not words or long-words) to be verified. Must be word-aligned. expectedData Pointer to the expected data that is to be verified against. margin Read margin choice failedAddress Pointer to returned failing address. failedData Pointer to returned failing data. Some derivitives do not included failed data as part of the FCCOBx registers. In this case, zeros are returned upon failure.
- Return values:
-
kStatus_FLASH_Success Api was executed successfully. kStatus_FLASH_InvalidArgument Invalid argument is provided. kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. kStatus_FLASH_AddressError Address is out of range. kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. kStatus_FLASH_CommandFailure Run-time error during command execution.
Definition at line 1204 of file fsl_flash.c.
Generated on Tue Jul 12 2022 15:37:33 by
