MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
C90TFS Flash Driver

Overview

The flash provides the C90TFS Flash driver of MCUXpresso SDK devices with the C90TFS Flash module inside. The flash driver provides general APIs to handle specific operations on C90TFS/FTFx Flash module. The user can use those APIs directly in the application. In addition, it provides internal functions called by the driver. Although these functions are not meant to be called from the user's application directly, the APIs can still be used.

Data Structures

struct  flash_execute_in_ram_function_config_t
 Flash execute-in-RAM function information. More...
 
struct  flash_swap_state_config_t
 Flash Swap information. More...
 
struct  flash_swap_ifr_field_config_t
 Flash Swap IFR fields. More...
 
union  flash_swap_ifr_field_data_t
 Flash Swap IFR field data. More...
 
union  pflash_protection_status_low_t
 PFlash protection status - low 32bit. More...
 
struct  pflash_protection_status_t
 PFlash protection status - full. More...
 
struct  flash_prefetch_speculation_status_t
 Flash prefetch speculation status. More...
 
struct  flash_protection_config_t
 Active flash protection information for the current operation. More...
 
struct  flash_access_config_t
 Active flash Execute-Only access information for the current operation. More...
 
struct  flash_operation_config_t
 Active flash information for the current operation. More...
 
struct  flash_config_t
 Flash driver state information. More...
 

Typedefs

typedef void(* flash_callback_t )(void)
 A callback type used for the Pflash block.
 

Enumerations

enum  flash_margin_value_t {
  kFLASH_MarginValueNormal,
  kFLASH_MarginValueUser,
  kFLASH_MarginValueFactory,
  kFLASH_MarginValueInvalid
}
 Enumeration for supported flash margin levels. More...
 
enum  flash_security_state_t {
  kFLASH_SecurityStateNotSecure,
  kFLASH_SecurityStateBackdoorEnabled,
  kFLASH_SecurityStateBackdoorDisabled
}
 Enumeration for the three possible flash security states. More...
 
enum  flash_protection_state_t {
  kFLASH_ProtectionStateUnprotected,
  kFLASH_ProtectionStateProtected,
  kFLASH_ProtectionStateMixed
}
 Enumeration for the three possible flash protection levels. More...
 
enum  flash_execute_only_access_state_t {
  kFLASH_AccessStateUnLimited,
  kFLASH_AccessStateExecuteOnly,
  kFLASH_AccessStateMixed
}
 Enumeration for the three possible flash execute access levels. More...
 
enum  flash_property_tag_t {
  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,
  kFLASH_PropertyEepromTotalSize = 0x15U,
  kFLASH_PropertyFlashMemoryIndex = 0x20U,
  kFLASH_PropertyFlashCacheControllerIndex = 0x21U
}
 Enumeration for various flash properties. More...
 
enum  _flash_execute_in_ram_function_constants {
  kFLASH_ExecuteInRamFunctionMaxSizeInWords = 16U,
  kFLASH_ExecuteInRamFunctionTotalNum = 2U
}
 Constants for execute-in-RAM flash function. More...
 
enum  flash_read_resource_option_t {
  kFLASH_ResourceOptionFlashIfr,
  kFLASH_ResourceOptionVersionId = 0x01U
}
 Enumeration for the two possible options of flash read resource command. More...
 
enum  _flash_read_resource_range {
  kFLASH_ResourceRangePflashIfrSizeInBytes = 256U,
  kFLASH_ResourceRangeVersionIdSizeInBytes = 8U,
  kFLASH_ResourceRangeVersionIdStart = 0x00U,
  kFLASH_ResourceRangeVersionIdEnd = 0x07U ,
  kFLASH_ResourceRangePflashSwapIfrEnd,
  kFLASH_ResourceRangeDflashIfrStart = 0x800000U,
  kFLASH_ResourceRangeDflashIfrEnd = 0x8003FFU
}
 Enumeration for the range of special-purpose flash resource. More...
 
enum  _k3_flash_read_once_index {
  kFLASH_RecordIndexSwapAddr = 0xA1U,
  kFLASH_RecordIndexSwapEnable = 0xA2U,
  kFLASH_RecordIndexSwapDisable = 0xA3U
}
 Enumeration for the index of read/program once record. More...
 
enum  flash_flexram_function_option_t {
  kFLASH_FlexramFunctionOptionAvailableAsRam = 0xFFU,
  kFLASH_FlexramFunctionOptionAvailableForEeprom = 0x00U
}
 Enumeration for the two possilbe options of set FlexRAM function command. More...
 
enum  _flash_acceleration_ram_property
 Enumeration for acceleration RAM property.
 
enum  flash_swap_function_option_t {
  kFLASH_SwapFunctionOptionEnable = 0x00U,
  kFLASH_SwapFunctionOptionDisable = 0x01U
}
 Enumeration for the possible options of Swap function. More...
 
enum  flash_swap_control_option_t {
  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_t {
  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_t {
  kFLASH_SwapBlockStatusLowerHalfProgramBlocksAtZero,
  kFLASH_SwapBlockStatusUpperHalfProgramBlocksAtZero
}
 Enumeration for the possible flash Swap block status More...
 
enum  flash_partition_flexram_load_option_t {
  kFLASH_PartitionFlexramLoadOptionLoadedWithValidEepromData,
  kFLASH_PartitionFlexramLoadOptionNotLoaded = 0x01U
}
 Enumeration for the FlexRAM load during reset option. More...
 
enum  flash_memory_index_t {
  kFLASH_MemoryIndexPrimaryFlash = 0x00U,
  kFLASH_MemoryIndexSecondaryFlash = 0x01U
}
 Enumeration for the flash memory index. More...
 
enum  flash_cache_controller_index_t {
  kFLASH_CacheControllerIndexForCore0 = 0x00U,
  kFLASH_CacheControllerIndexForCore1 = 0x01U
}
 Enumeration for the flash cache controller index. More...
 
enum  flash_prefetch_speculation_option_t
 Enumeration for the two possible options of flash prefetch speculation.
 
enum  flash_cache_clear_process_t {
  kFLASH_CacheClearProcessPre = 0x00U,
  kFLASH_CacheClearProcessPost = 0x01U
}
 Flash cache clear process code. More...
 

Flash version

enum  _flash_driver_version_constants {
  kFLASH_DriverVersionName = 'F',
  kFLASH_DriverVersionMajor = 2,
  kFLASH_DriverVersionMinor = 3,
  kFLASH_DriverVersionBugfix = 1
}
 Flash driver version for ROM. More...
 
#define MAKE_VERSION(major, minor, bugfix)   (((major) << 16) | ((minor) << 8) | (bugfix))
 Constructs the version number for drivers. More...
 
#define FSL_FLASH_DRIVER_VERSION   (MAKE_VERSION(2, 3, 1))
 Flash driver version for SDK. More...
 

Flash configuration

#define FLASH_SSD_CONFIG_ENABLE_FLEXNVM_SUPPORT   1
 Indicates whether to support FlexNVM in the Flash driver. More...
 
#define FLASH_SSD_IS_FLEXNVM_ENABLED   (FLASH_SSD_CONFIG_ENABLE_FLEXNVM_SUPPORT && FSL_FEATURE_FLASH_HAS_FLEX_NVM)
 Indicates whether the FlexNVM is enabled in the Flash driver.
 
#define FLASH_SSD_CONFIG_ENABLE_SECONDARY_FLASH_SUPPORT   1
 Indicates whether to support Secondary flash in the Flash driver. More...
 
#define FLASH_SSD_IS_SECONDARY_FLASH_ENABLED   (0)
 Indicates whether the secondary flash is supported in the Flash driver.
 
#define FLASH_DRIVER_IS_FLASH_RESIDENT   1
 Flash driver location. More...
 
#define FLASH_DRIVER_IS_EXPORTED   0
 Flash Driver Export option. 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,
  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,
  kStatus_FLASH_ReadOnlyProperty = MAKE_STATUS(kStatusGroupFlashDriver, 18),
  kStatus_FLASH_InvalidPropertyValue,
  kStatus_FLASH_InvalidSpeculationOption
}
 Flash driver status codes. More...
 
#define kStatusGroupGeneric   0
 Flash driver status group. More...
 
#define kStatusGroupFlashDriver   1
 
#define MAKE_STATUS(group, code)   ((((group)*100) + (code)))
 Constructs a status code value from a group and a code number. 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...
 
#define FOUR_CHAR_CODE(a, b, c, d)   (((d) << 24) | ((c) << 16) | ((b) << 8) | ((a)))
 Constructs the four character code for the Flash driver API key. More...
 

Initialization

status_t FLASH_Init (flash_config_t *config)
 Initializes the global flash properties structure members. More...
 
status_t FLASH_SetCallback (flash_config_t *config, flash_callback_t callback)
 Sets the desired flash callback function. More...
 
status_t FLASH_PrepareExecuteInRamFunctions (flash_config_t *config)
 Prepares flash execute-in-RAM functions. More...
 

Erasing

status_t FLASH_EraseAll (flash_config_t *config, uint32_t key)
 Erases entire flash. More...
 
status_t FLASH_Erase (flash_config_t *config, uint32_t start, uint32_t lengthInBytes, uint32_t key)
 Erases the flash sectors encompassed by parameters passed into function. More...
 
status_t FLASH_EraseAllUnsecure (flash_config_t *config, uint32_t key)
 Erases the entire flash, including protected sectors. More...
 
status_t FLASH_EraseAllExecuteOnlySegments (flash_config_t *config, uint32_t key)
 Erases all program flash execute-only segments defined by the FXACC registers. More...
 

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. More...
 
status_t FLASH_ProgramOnce (flash_config_t *config, uint32_t index, uint32_t *src, uint32_t lengthInBytes)
 Programs Program Once Field through parameters. More...
 

Reading

Programs flash with data at locations passed in through parameters via the Program Section command.

This function programs the flash memory with the desired data for a given flash area as determined by the start address and length.

Parameters
configA pointer to the storage for the driver runtime state.
startThe start address of the desired flash memory to be programmed. Must be word-aligned.
srcA pointer to the source buffer of data that is to be programmed into the flash.
lengthInBytesThe length, given in bytes (not words or long-words), to be programmed. Must be word-aligned.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_AlignmentErrorParameter is not aligned with specified baseline.
kStatus_FLASH_AddressErrorAddress is out of range.
kStatus_FLASH_SetFlexramAsRamErrorFailed to set flexram as RAM.
kStatus_FLASH_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FLASH_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FLASH_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FLASH_CommandFailureRun-time error during command execution.
kStatus_FLASH_RecoverFlexramAsEepromErrorFailed to recover FlexRAM as EEPROM.

Programs the EEPROM with data at locations passed in through parameters.

This function programs the emulated EEPROM with the desired data for a given flash area as determined by the start address and length.

Parameters
configA pointer to the storage for the driver runtime state.
startThe start address of the desired flash memory to be programmed. Must be word-aligned.
srcA pointer to the source buffer of data that is to be programmed into the flash.
lengthInBytesThe length, given in bytes (not words or long-words), to be programmed. Must be word-aligned.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_AddressErrorAddress is out of range.
kStatus_FLASH_SetFlexramAsEepromErrorFailed to set flexram as eeprom.
kStatus_FLASH_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FLASH_RecoverFlexramAsRamErrorFailed to recover the FlexRAM as RAM.
status_t FLASH_ReadResource (flash_config_t *config, uint32_t start, uint32_t *dst, uint32_t lengthInBytes, flash_read_resource_option_t option)
 Reads the resource with data at locations passed in through parameters. More...
 
status_t FLASH_ReadOnce (flash_config_t *config, uint32_t index, uint32_t *dst, uint32_t lengthInBytes)
 Reads the Program Once Field through parameters. More...
 

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. More...
 
status_t FLASH_SecurityBypass (flash_config_t *config, const uint8_t *backdoorKey)
 Allows users to bypass security with a backdoor key. More...
 

Verification

status_t FLASH_VerifyEraseAll (flash_config_t *config, flash_margin_value_t margin)
 Verifies erasure of the entire flash at a specified margin level. More...
 
status_t FLASH_VerifyErase (flash_config_t *config, uint32_t start, uint32_t lengthInBytes, flash_margin_value_t margin)
 Verifies an erasure of the desired flash area at a specified margin level. More...
 
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 the desired flash area at a specified margin level. More...
 
status_t FLASH_VerifyEraseAllExecuteOnlySegments (flash_config_t *config, flash_margin_value_t margin)
 Verifies whether the program flash execute-only segments have been erased to the specified read margin level. More...
 

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 the desired flash area via the pointer passed into the function. More...
 
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 the desired flash area via the pointer passed into the function. More...
 

Properties

status_t FLASH_GetProperty (flash_config_t *config, flash_property_tag_t whichProperty, uint32_t *value)
 Returns the desired flash property. More...
 
status_t FLASH_SetProperty (flash_config_t *config, flash_property_tag_t whichProperty, uint32_t value)
 Sets the desired flash property. More...
 

Flash Protection Utilities

Prepares the FlexNVM block for use as data flash, EEPROM backup, or a combination of both and initializes the FlexRAM.

Parameters
configPointer to storage for the driver runtime state.
optionThe option used to set FlexRAM load behavior during reset.
eepromDataSizeCodeDetermines the amount of FlexRAM used in each of the available EEPROM subsystems.
flexnvmPartitionCodeSpecifies how to split the FlexNVM block between data flash memory and EEPROM backup memory supporting EEPROM functions.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentInvalid argument is provided.
kStatus_FLASH_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FLASH_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FLASH_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FLASH_CommandFailureRun-time error during command execution.
status_t FLASH_PflashSetProtection (flash_config_t *config, pflash_protection_status_t *protectStatus)
 Sets the PFlash Protection to the intended protection status. More...
 
status_t FLASH_PflashGetProtection (flash_config_t *config, pflash_protection_status_t *protectStatus)
 Gets the PFlash protection status. More...
 

Data Structure Documentation

struct flash_execute_in_ram_function_config_t

Data Fields

uint32_t activeFunctionCount
 Number of available execute-in-RAM functions. More...
 
uint32_t * flashRunCommand
 Execute-in-RAM function: flash_run_command. More...
 
uint32_t * flashCommonBitOperation
 Execute-in-RAM function: flash_common_bit_operation. More...
 

Field Documentation

uint32_t flash_execute_in_ram_function_config_t::activeFunctionCount
uint32_t* flash_execute_in_ram_function_config_t::flashRunCommand
uint32_t* flash_execute_in_ram_function_config_t::flashCommonBitOperation
struct flash_swap_state_config_t

Data Fields

flash_swap_state_t flashSwapState
 The current Swap system status. More...
 
flash_swap_block_status_t currentSwapBlockStatus
 The current Swap block status. More...
 
flash_swap_block_status_t nextSwapBlockStatus
 The next Swap block status. More...
 

Field Documentation

flash_swap_state_t flash_swap_state_config_t::flashSwapState
flash_swap_block_status_t flash_swap_state_config_t::currentSwapBlockStatus
flash_swap_block_status_t flash_swap_state_config_t::nextSwapBlockStatus
struct flash_swap_ifr_field_config_t

Data Fields

uint16_t swapIndicatorAddress
 A Swap indicator address field. More...
 
uint16_t swapEnableWord
 A Swap enable word field. More...
 
uint8_t reserved0 [4]
 A reserved field. More...
 

Field Documentation

uint16_t flash_swap_ifr_field_config_t::swapIndicatorAddress
uint16_t flash_swap_ifr_field_config_t::swapEnableWord
uint8_t flash_swap_ifr_field_config_t::reserved0[4]
union flash_swap_ifr_field_data_t

Data Fields

uint32_t flashSwapIfrData [2]
 A flash Swap IFR field data . More...
 
flash_swap_ifr_field_config_t flashSwapIfrField
 A flash Swap IFR field structure. More...
 

Field Documentation

uint32_t flash_swap_ifr_field_data_t::flashSwapIfrData[2]
flash_swap_ifr_field_config_t flash_swap_ifr_field_data_t::flashSwapIfrField
union pflash_protection_status_low_t

Data Fields

uint32_t protl32b
 PROT[31:0] . More...
 
uint8_t protsl
 PROTS[7:0] . More...
 
uint8_t protsh
 PROTS[15:8] . More...
 

Field Documentation

uint32_t pflash_protection_status_low_t::protl32b
uint8_t pflash_protection_status_low_t::protsl
uint8_t pflash_protection_status_low_t::protsh
struct pflash_protection_status_t

Data Fields

pflash_protection_status_low_t valueLow32b
 PROT[31:0] or PROTS[15:0]. More...
 

Field Documentation

pflash_protection_status_low_t pflash_protection_status_t::valueLow32b
struct flash_prefetch_speculation_status_t

Data Fields

flash_prefetch_speculation_option_t instructionOption
 Instruction speculation. More...
 
flash_prefetch_speculation_option_t dataOption
 Data speculation. More...
 

Field Documentation

flash_prefetch_speculation_option_t flash_prefetch_speculation_status_t::instructionOption
flash_prefetch_speculation_option_t flash_prefetch_speculation_status_t::dataOption
struct flash_protection_config_t

Data Fields

uint32_t regionBase
 Base address of flash protection region. More...
 
uint32_t regionSize
 size of flash protection region. More...
 
uint32_t regionCount
 flash protection region count. More...
 

Field Documentation

uint32_t flash_protection_config_t::regionBase
uint32_t flash_protection_config_t::regionSize
uint32_t flash_protection_config_t::regionCount
struct flash_access_config_t

Data Fields

uint32_t SegmentBase
 Base address of flash Execute-Only segment. More...
 
uint32_t SegmentSize
 size of flash Execute-Only segment. More...
 
uint32_t SegmentCount
 flash Execute-Only segment count. More...
 

Field Documentation

uint32_t flash_access_config_t::SegmentBase
uint32_t flash_access_config_t::SegmentSize
uint32_t flash_access_config_t::SegmentCount
struct flash_operation_config_t

Data Fields

uint32_t convertedAddress
 A converted address for the current flash type. More...
 
uint32_t activeSectorSize
 A sector size of the current flash type. More...
 
uint32_t activeBlockSize
 A block size of the current flash type. More...
 
uint32_t blockWriteUnitSize
 The write unit size. More...
 
uint32_t sectorCmdAddressAligment
 An erase sector command address alignment. More...
 
uint32_t sectionCmdAddressAligment
 A program/verify section command address alignment. More...
 
uint32_t resourceCmdAddressAligment
 A read resource command address alignment. More...
 
uint32_t checkCmdAddressAligment
 A program check command address alignment. More...
 

Field Documentation

uint32_t flash_operation_config_t::convertedAddress
uint32_t flash_operation_config_t::activeSectorSize
uint32_t flash_operation_config_t::activeBlockSize
uint32_t flash_operation_config_t::blockWriteUnitSize
uint32_t flash_operation_config_t::sectorCmdAddressAligment
uint32_t flash_operation_config_t::sectionCmdAddressAligment
uint32_t flash_operation_config_t::resourceCmdAddressAligment
uint32_t flash_operation_config_t::checkCmdAddressAligment
struct flash_config_t

An instance of this structure is allocated by the user of the flash driver and passed into each of the driver APIs.

Data Fields

uint32_t PFlashBlockBase
 A base address of the first PFlash block.
 
uint32_t PFlashTotalSize
 The size of the combined PFlash block. More...
 
uint8_t PFlashBlockCount
 A number of PFlash blocks. More...
 
uint8_t FlashMemoryIndex
 0 - primary flash; 1 - secondary flash
 
uint8_t FlashCacheControllerIndex
 0 - Controller for core 0; 1 - Controller for core 1
 
uint8_t Reserved0
 Reserved field 0.
 
uint32_t PFlashSectorSize
 The size in bytes of a sector of PFlash. More...
 
flash_callback_t PFlashCallback
 The callback function for the flash API. More...
 
uint32_t PFlashAccessSegmentSize
 A size in bytes of an access segment of PFlash. More...
 
uint32_t PFlashAccessSegmentCount
 A number of PFlash access segments. More...
 
uint32_t * flashExecuteInRamFunctionInfo
 An information structure of the flash execute-in-RAM function. More...
 
uint32_t FlexRAMBlockBase
 For the FlexNVM device, this is the base address of the FlexRAM. More...
 
uint32_t FlexRAMTotalSize
 For the FlexNVM device, this is the size of the FlexRAM. More...
 
uint32_t DFlashBlockBase
 For the FlexNVM device, this is the base address of the D-Flash memory (FlexNVM memory) More...
 
uint32_t DFlashTotalSize
 For the FlexNVM device, this is the total size of the FlexNVM memory;. More...
 
uint32_t EEpromTotalSize
 For the FlexNVM device, this is the size in bytes of the EEPROM area which was partitioned from FlexRAM. More...
 

Field Documentation

uint32_t flash_config_t::PFlashTotalSize
uint8_t flash_config_t::PFlashBlockCount
uint32_t flash_config_t::PFlashSectorSize
flash_callback_t flash_config_t::PFlashCallback
uint32_t flash_config_t::PFlashAccessSegmentSize
uint32_t flash_config_t::PFlashAccessSegmentCount
uint32_t* flash_config_t::flashExecuteInRamFunctionInfo
uint32_t flash_config_t::FlexRAMBlockBase

For the non-FlexNVM device, this is the base address of the acceleration RAM memory

uint32_t flash_config_t::FlexRAMTotalSize

For the non-FlexNVM device, this is the size of the acceleration RAM memory

uint32_t flash_config_t::DFlashBlockBase

For the non-FlexNVM device, this field is unused

uint32_t flash_config_t::DFlashTotalSize

For the non-FlexNVM device, this field is unused

uint32_t flash_config_t::EEpromTotalSize

For the non-FlexNVM device, this field is unused

Macro Definition Documentation

#define MAKE_VERSION (   major,
  minor,
  bugfix 
)    (((major) << 16) | ((minor) << 8) | (bugfix))
#define FSL_FLASH_DRIVER_VERSION   (MAKE_VERSION(2, 3, 1))

Version 2.3.1.

#define FLASH_SSD_CONFIG_ENABLE_FLEXNVM_SUPPORT   1

Enables the FlexNVM support by default.

#define FLASH_SSD_CONFIG_ENABLE_SECONDARY_FLASH_SUPPORT   1

Enables the secondary flash support by default.

#define FLASH_DRIVER_IS_FLASH_RESIDENT   1

Used for the flash resident application.

#define FLASH_DRIVER_IS_EXPORTED   0

Used for the KSDK application.

#define kStatusGroupGeneric   0
#define MAKE_STATUS (   group,
  code 
)    ((((group)*100) + (code)))
#define FOUR_CHAR_CODE (   a,
  b,
  c,
 
)    (((d) << 24) | ((c) << 16) | ((b) << 8) | ((a)))

Enumeration Type Documentation

Enumerator
kFLASH_DriverVersionName 

Flash driver version name.

kFLASH_DriverVersionMajor 

Major flash driver version.

kFLASH_DriverVersionMinor 

Minor flash driver version.

kFLASH_DriverVersionBugfix 

Bugfix for flash driver version.

Enumerator
kStatus_FLASH_Success 

API is executed successfully.

kStatus_FLASH_InvalidArgument 

Invalid argument.

kStatus_FLASH_SizeError 

Error size.

kStatus_FLASH_AlignmentError 

Parameter is not aligned with the specified baseline.

kStatus_FLASH_AddressError 

Address is out of range.

kStatus_FLASH_AccessError 

Invalid instruction codes and out-of bound 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_UnknownProperty 

Unknown property.

kStatus_FLASH_EraseKeyError 

API erase key is invalid.

kStatus_FLASH_RegionExecuteOnly 

The current region is execute-only.

kStatus_FLASH_ExecuteInRamFunctionNotReady 

Execute-in-RAM function is not available.

kStatus_FLASH_PartitionStatusUpdateFailure 

Failed to update partition status.

kStatus_FLASH_SetFlexramAsEepromError 

Failed to set FlexRAM as EEPROM.

kStatus_FLASH_RecoverFlexramAsRamError 

Failed to recover FlexRAM as RAM.

kStatus_FLASH_SetFlexramAsRamError 

Failed to set FlexRAM as RAM.

kStatus_FLASH_RecoverFlexramAsEepromError 

Failed to recover FlexRAM as EEPROM.

kStatus_FLASH_CommandNotSupported 

Flash API is not supported.

kStatus_FLASH_SwapSystemNotInUninitialized 

Swap system is not in an uninitialzed state.

kStatus_FLASH_SwapIndicatorAddressError 

The swap indicator address is invalid.

kStatus_FLASH_ReadOnlyProperty 

The flash property is read-only.

kStatus_FLASH_InvalidPropertyValue 

The flash property value is out of range.

kStatus_FLASH_InvalidSpeculationOption 

The option of flash prefetch speculation is invalid.

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

Key value used to validate all flash erase APIs.

Enumerator
kFLASH_MarginValueNormal 

Use the 'normal' read level for 1s.

kFLASH_MarginValueUser 

Apply the 'User' margin to the normal read-1 level.

kFLASH_MarginValueFactory 

Apply the 'Factory' margin to the normal read-1 level.

kFLASH_MarginValueInvalid 

Not real margin level, Used to determine the range of valid margin level.

Enumerator
kFLASH_SecurityStateNotSecure 

Flash is not secure.

kFLASH_SecurityStateBackdoorEnabled 

Flash backdoor is enabled.

kFLASH_SecurityStateBackdoorDisabled 

Flash backdoor is disabled.

Enumerator
kFLASH_ProtectionStateUnprotected 

Flash region is not protected.

kFLASH_ProtectionStateProtected 

Flash region is protected.

kFLASH_ProtectionStateMixed 

Flash is mixed with protected and unprotected region.

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.

Enumerator
kFLASH_PropertyPflashSectorSize 

Pflash sector size property.

kFLASH_PropertyPflashTotalSize 

Pflash total size property.

kFLASH_PropertyPflashBlockSize 

Pflash block size property.

kFLASH_PropertyPflashBlockCount 

Pflash block count property.

kFLASH_PropertyPflashBlockBaseAddr 

Pflash block base address property.

kFLASH_PropertyPflashFacSupport 

Pflash fac support property.

kFLASH_PropertyPflashAccessSegmentSize 

Pflash access segment size property.

kFLASH_PropertyPflashAccessSegmentCount 

Pflash access segment count property.

kFLASH_PropertyFlexRamBlockBaseAddr 

FlexRam block base address property.

kFLASH_PropertyFlexRamTotalSize 

FlexRam total size property.

kFLASH_PropertyDflashSectorSize 

Dflash sector size property.

kFLASH_PropertyDflashTotalSize 

Dflash total size property.

kFLASH_PropertyDflashBlockSize 

Dflash block size property.

kFLASH_PropertyDflashBlockCount 

Dflash block count property.

kFLASH_PropertyDflashBlockBaseAddr 

Dflash block base address property.

kFLASH_PropertyEepromTotalSize 

EEPROM total size property.

kFLASH_PropertyFlashMemoryIndex 

Flash memory index property.

kFLASH_PropertyFlashCacheControllerIndex 

Flash cache controller index property.

Enumerator
kFLASH_ExecuteInRamFunctionMaxSizeInWords 

The maximum size of execute-in-RAM function.

kFLASH_ExecuteInRamFunctionTotalNum 

Total number of execute-in-RAM functions.

Enumerator
kFLASH_ResourceOptionFlashIfr 

Select code for Program flash 0 IFR, Program flash swap 0 IFR, Data flash 0 IFR.

kFLASH_ResourceOptionVersionId 

Select code for the version ID.

Enumerator
kFLASH_ResourceRangePflashIfrSizeInBytes 

Pflash IFR size in byte.

kFLASH_ResourceRangeVersionIdSizeInBytes 

Version ID IFR size in byte.

kFLASH_ResourceRangeVersionIdStart 

Version ID IFR start address.

kFLASH_ResourceRangeVersionIdEnd 

Version ID IFR end address.

kFLASH_ResourceRangePflashSwapIfrEnd 

Pflash swap IFR end address.

kFLASH_ResourceRangeDflashIfrStart 

Dflash IFR start address.

kFLASH_ResourceRangeDflashIfrEnd 

Dflash IFR end address.

Enumerator
kFLASH_RecordIndexSwapAddr 

Index of Swap indicator address.

kFLASH_RecordIndexSwapEnable 

Index of Swap system enable.

kFLASH_RecordIndexSwapDisable 

Index of Swap system disable.

Enumerator
kFLASH_FlexramFunctionOptionAvailableAsRam 

An option used to make FlexRAM available as RAM.

kFLASH_FlexramFunctionOptionAvailableForEeprom 

An option used to make FlexRAM available for EEPROM.

Enumerator
kFLASH_SwapFunctionOptionEnable 

An option used to enable the Swap function.

kFLASH_SwapFunctionOptionDisable 

An option used to disable the Swap function.

Enumerator
kFLASH_SwapControlOptionIntializeSystem 

An option used to initialize the Swap system.

kFLASH_SwapControlOptionSetInUpdateState 

An option used to set the Swap in an update state.

kFLASH_SwapControlOptionSetInCompleteState 

An option used to set the Swap in a complete state.

kFLASH_SwapControlOptionReportStatus 

An option used to report the Swap status.

kFLASH_SwapControlOptionDisableSystem 

An option used to disable the Swap status.

Enumerator
kFLASH_SwapStateUninitialized 

Flash Swap system is in an uninitialized state.

kFLASH_SwapStateReady 

Flash Swap system is in a ready state.

kFLASH_SwapStateUpdate 

Flash Swap system is in an update state.

kFLASH_SwapStateUpdateErased 

Flash Swap system is in an updateErased state.

kFLASH_SwapStateComplete 

Flash Swap system is in a complete state.

kFLASH_SwapStateDisabled 

Flash Swap system is in a disabled state.

Enumerator
kFLASH_SwapBlockStatusLowerHalfProgramBlocksAtZero 

Swap block status is that lower half program block at zero.

kFLASH_SwapBlockStatusUpperHalfProgramBlocksAtZero 

Swap block status is that upper half program block at zero.

Enumerator
kFLASH_PartitionFlexramLoadOptionLoadedWithValidEepromData 

FlexRAM is loaded with valid EEPROM data during reset sequence.

kFLASH_PartitionFlexramLoadOptionNotLoaded 

FlexRAM is not loaded during reset sequence.

Enumerator
kFLASH_MemoryIndexPrimaryFlash 

Current flash memory is primary flash.

kFLASH_MemoryIndexSecondaryFlash 

Current flash memory is secondary flash.

Enumerator
kFLASH_CacheControllerIndexForCore0 

Current flash cache controller is for core 0.

kFLASH_CacheControllerIndexForCore1 

Current flash cache controller is for core 1.

Enumerator
kFLASH_CacheClearProcessPre 

Pre flash cache clear process.

kFLASH_CacheClearProcessPost 

Post flash cache clear process.

Function Documentation

status_t FLASH_Init ( flash_config_t config)

This function checks and initializes the Flash module for the other Flash APIs.

Parameters
configPointer to the storage for the driver runtime state.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FLASH_PartitionStatusUpdateFailureFailed to update the partition status.
status_t FLASH_SetCallback ( flash_config_t config,
flash_callback_t  callback 
)
Parameters
configPointer to the storage for the driver runtime state.
callbackA callback function to be stored in the driver.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
status_t FLASH_PrepareExecuteInRamFunctions ( flash_config_t config)
Parameters
configPointer to the storage for the driver runtime state.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
status_t FLASH_EraseAll ( flash_config_t config,
uint32_t  key 
)
Parameters
configPointer to the storage for the driver runtime state.
keyA value used to validate all flash erase APIs.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_EraseKeyErrorAPI erase key is invalid.
kStatus_FLASH_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FLASH_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FLASH_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FLASH_CommandFailureRun-time error during command execution.
kStatus_FLASH_PartitionStatusUpdateFailureFailed to update the partition status.
status_t FLASH_Erase ( flash_config_t config,
uint32_t  start,
uint32_t  lengthInBytes,
uint32_t  key 
)

This function erases the appropriate number of flash sectors based on the desired start address and length.

Parameters
configThe pointer to the storage for the driver runtime state.
startThe 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.
lengthInBytesThe length, given in bytes (not words or long-words) to be erased. Must be word-aligned.
keyThe value used to validate all flash erase APIs.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_AlignmentErrorThe parameter is not aligned with the specified baseline.
kStatus_FLASH_AddressErrorThe address is out of range.
kStatus_FLASH_EraseKeyErrorThe API erase key is invalid.
kStatus_FLASH_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FLASH_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FLASH_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FLASH_CommandFailureRun-time error during the command execution.
status_t FLASH_EraseAllUnsecure ( flash_config_t config,
uint32_t  key 
)
Parameters
configPointer to the storage for the driver runtime state.
keyA value used to validate all flash erase APIs.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_EraseKeyErrorAPI erase key is invalid.
kStatus_FLASH_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FLASH_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FLASH_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FLASH_CommandFailureRun-time error during command execution.
kStatus_FLASH_PartitionStatusUpdateFailureFailed to update the partition status.
status_t FLASH_EraseAllExecuteOnlySegments ( flash_config_t config,
uint32_t  key 
)
Parameters
configPointer to the storage for the driver runtime state.
keyA value used to validate all flash erase APIs.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_EraseKeyErrorAPI erase key is invalid.
kStatus_FLASH_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FLASH_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FLASH_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FLASH_CommandFailureRun-time error during the command execution.
status_t FLASH_Program ( flash_config_t config,
uint32_t  start,
uint32_t *  src,
uint32_t  lengthInBytes 
)

This function programs the flash memory with the desired data for a given flash area as determined by the start address and the length.

Parameters
configA pointer to the storage for the driver runtime state.
startThe start address of the desired flash memory to be programmed. Must be word-aligned.
srcA pointer to the source buffer of data that is to be programmed into the flash.
lengthInBytesThe length, given in bytes (not words or long-words), to be programmed. Must be word-aligned.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_AlignmentErrorParameter is not aligned with the specified baseline.
kStatus_FLASH_AddressErrorAddress is out of range.
kStatus_FLASH_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FLASH_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FLASH_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FLASH_CommandFailureRun-time error during the command execution.
status_t FLASH_ProgramOnce ( flash_config_t config,
uint32_t  index,
uint32_t *  src,
uint32_t  lengthInBytes 
)

This function programs the Program Once Field with the desired data for a given flash area as determined by the index and length.

Parameters
configA pointer to the storage for the driver runtime state.
indexThe index indicating which area of the Program Once Field to be programmed.
srcA pointer to the source buffer of data that is to be programmed into the Program Once Field.
lengthInBytesThe length, given in bytes (not words or long-words), to be programmed. Must be word-aligned.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FLASH_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FLASH_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FLASH_CommandFailureRun-time error during the 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 
)

This function reads the flash memory with the desired location for a given flash area as determined by the start address and length.

Parameters
configA pointer to the storage for the driver runtime state.
startThe start address of the desired flash memory to be programmed. Must be word-aligned.
dstA pointer to the destination buffer of data that is used to store data to be read.
lengthInBytesThe length, given in bytes (not words or long-words), to be read. Must be word-aligned.
optionThe resource option which indicates which area should be read back.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_AlignmentErrorParameter is not aligned with the specified baseline.
kStatus_FLASH_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FLASH_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FLASH_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FLASH_CommandFailureRun-time error during the command execution.
status_t FLASH_ReadOnce ( flash_config_t config,
uint32_t  index,
uint32_t *  dst,
uint32_t  lengthInBytes 
)

This function reads the read once feild with given index and length.

Parameters
configA pointer to the storage for the driver runtime state.
indexThe index indicating the area of program once field to be read.
dstA pointer to the destination buffer of data that is used to store data to be read.
lengthInBytesThe length, given in bytes (not words or long-words), to be programmed. Must be word-aligned.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FLASH_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FLASH_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FLASH_CommandFailureRun-time error during the command execution.
status_t FLASH_GetSecurityState ( flash_config_t config,
flash_security_state_t state 
)

This function retrieves the current flash security status, including the security enabling state and the backdoor key enabling state.

Parameters
configA pointer to storage for the driver runtime state.
stateA pointer to the value returned for the current security status code:
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
status_t FLASH_SecurityBypass ( flash_config_t config,
const uint8_t *  backdoorKey 
)

If the MCU is in secured state, this function unsecures the MCU by comparing the provided backdoor key with ones in the flash configuration field.

Parameters
configA pointer to the storage for the driver runtime state.
backdoorKeyA pointer to the user buffer containing the backdoor key.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FLASH_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FLASH_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FLASH_CommandFailureRun-time error during the command execution.
status_t FLASH_VerifyEraseAll ( flash_config_t config,
flash_margin_value_t  margin 
)

This function checks whether the flash is erased to the specified read margin level.

Parameters
configA pointer to the storage for the driver runtime state.
marginRead margin choice.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FLASH_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FLASH_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FLASH_CommandFailureRun-time error during the command execution.
status_t FLASH_VerifyErase ( flash_config_t config,
uint32_t  start,
uint32_t  lengthInBytes,
flash_margin_value_t  margin 
)

This function checks the appropriate number of flash sectors based on the desired start address and length to check whether the flash is erased to the specified read margin level.

Parameters
configA pointer to the storage for the driver runtime state.
startThe 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.
lengthInBytesThe length, given in bytes (not words or long-words), to be verified. Must be word-aligned.
marginRead margin choice.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_AlignmentErrorParameter is not aligned with specified baseline.
kStatus_FLASH_AddressErrorAddress is out of range.
kStatus_FLASH_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FLASH_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FLASH_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FLASH_CommandFailureRun-time error during the 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 
)

This function verifies the data programed in the flash memory using the Flash Program Check Command and compares it to the expected data for a given flash area as determined by the start address and length.

Parameters
configA pointer to the storage for the driver runtime state.
startThe start address of the desired flash memory to be verified. Must be word-aligned.
lengthInBytesThe length, given in bytes (not words or long-words), to be verified. Must be word-aligned.
expectedDataA pointer to the expected data that is to be verified against.
marginRead margin choice.
failedAddressA pointer to the returned failing address.
failedDataA pointer to the returned failing data. Some derivatives do not include failed data as part of the FCCOBx registers. In this case, zeros are returned upon failure.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_AlignmentErrorParameter is not aligned with specified baseline.
kStatus_FLASH_AddressErrorAddress is out of range.
kStatus_FLASH_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FLASH_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FLASH_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FLASH_CommandFailureRun-time error during the command execution.
status_t FLASH_VerifyEraseAllExecuteOnlySegments ( flash_config_t config,
flash_margin_value_t  margin 
)
Parameters
configA pointer to the storage for the driver runtime state.
marginRead margin choice.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FLASH_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FLASH_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FLASH_CommandFailureRun-time error during the command execution.
status_t FLASH_IsProtected ( flash_config_t config,
uint32_t  start,
uint32_t  lengthInBytes,
flash_protection_state_t protection_state 
)

This function retrieves the current flash protect status for a given flash area as determined by the start address and length.

Parameters
configA pointer to the storage for the driver runtime state.
startThe start address of the desired flash memory to be checked. Must be word-aligned.
lengthInBytesThe length, given in bytes (not words or long-words) to be checked. Must be word-aligned.
protection_stateA pointer to the value returned for the current protection status code for the desired flash area.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_AlignmentErrorParameter is not aligned with specified baseline.
kStatus_FLASH_AddressErrorThe address is out of range.
status_t FLASH_IsExecuteOnly ( flash_config_t config,
uint32_t  start,
uint32_t  lengthInBytes,
flash_execute_only_access_state_t access_state 
)

This function retrieves the current flash access status for a given flash area as determined by the start address and length.

Parameters
configA pointer to the storage for the driver runtime state.
startThe start address of the desired flash memory to be checked. Must be word-aligned.
lengthInBytesThe length, given in bytes (not words or long-words), to be checked. Must be word-aligned.
access_stateA pointer to the value returned for the current access status code for the desired flash area.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_AlignmentErrorThe parameter is not aligned to the specified baseline.
kStatus_FLASH_AddressErrorThe address is out of range.
status_t FLASH_GetProperty ( flash_config_t config,
flash_property_tag_t  whichProperty,
uint32_t *  value 
)
Parameters
configA pointer to the storage for the driver runtime state.
whichPropertyThe desired property from the list of properties in enum flash_property_tag_t
valueA pointer to the value returned for the desired flash property.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_UnknownPropertyAn unknown property tag.
status_t FLASH_SetProperty ( flash_config_t config,
flash_property_tag_t  whichProperty,
uint32_t  value 
)
Parameters
configA pointer to the storage for the driver runtime state.
whichPropertyThe desired property from the list of properties in enum flash_property_tag_t
valueA to set for the desired flash property.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_UnknownPropertyAn unknown property tag.
kStatus_FLASH_InvalidPropertyValueAn invalid property value.
kStatus_FLASH_ReadOnlyPropertyAn read-only property tag.
status_t FLASH_PflashSetProtection ( flash_config_t config,
pflash_protection_status_t protectStatus 
)
Parameters
configA pointer to storage for the driver runtime state.
protectStatusThe expected protect status to set to the PFlash protection register. Each bit is corresponding to protection of 1/32(64) 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. There are two possible cases as shown below: 0: this area is protected. 1: this area is unprotected.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_CommandFailureRun-time error during command execution.
status_t FLASH_PflashGetProtection ( flash_config_t config,
pflash_protection_status_t protectStatus 
)
Parameters
configA pointer to the storage for the driver runtime state.
protectStatusProtect status returned by the PFlash IP. Each bit is corresponding to the protection of 1/32(64) of the total PFlash. The least significant bit corresponds to the lowest address area of the PFlash. The most significant bit corresponds 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_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.