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

Read Guidance

The flash driver provides general APIs to handle specific operations on chip flash; The user can use those APIs directly in the application. The flash supports:

Driver Overview

 Driver Change Log
 The current FLASH driver version is 3.0.0.
 

Data Structures

struct  flash_swap_state_config_t
 Flash Swap information. More...
 
struct  flash_spec_mem_t
 ftfx special memory access information. More...
 
struct  flash_mem_desc_t
 Flash memory descriptor. More...
 
struct  flash_ops_config_t
 Active FTFx information for the current operation. More...
 
struct  flash_ifr_desc_t
 Flash IFR memory descriptor. More...
 
struct  ftfx_config_t
 Flash driver state information. More...
 

Macros

#define MAKE_STATUS(group, code)   ((((group)*100) + (code)))
 Construct a status code value from a group and code number. More...
 
#define FTFx_FLASH_COUNT   1
 Flash driver state information. More...
 

Enumerations

enum  _flash_driver_api_keys
 Enumeration for FLASH driver API keys. More...
 
enum  flash_read_resource_opt_t {
  kFLASH_ResourceOptionFlashIfr,
  kFLASH_ResourceOptionVersionId = 0x01U
}
 Enumeration for the two possible options of flash read resource command. More...
 
enum  flash_margin_value_t {
  kFLASH_MarginValueNormal,
  kFLASH_MarginValueUser,
  kFLASH_MarginValueFactory,
  kFLASH_MarginValueInvalid
}
 Enumeration for supported FTFx margin levels. More...
 
enum  flash_security_state_t {
  kFLASH_SecurityStateNotSecure = 0xc33cc33cU,
  kFLASH_SecurityStateBackdoorEnabled = 0x5aa55aa5U,
  kFLASH_SecurityStateBackdoorDisabled = 0x5ac33ca5U
}
 Enumeration for the three possible FTFx security states. More...
 
enum  flash_swap_control_opt_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_memory_type
 Enumeration for FTFx memory type.
 
enum  flash_property_tag_t {
  kFLASH_PropertyPflashSectorSize = 0x00U,
  kFLASH_PropertyPflashTotalSize = 0x01U,
  kFLASH_PropertyPflashBlockSize = 0x02U,
  kFLASH_PropertyPflashBlockCount = 0x03U,
  kFLASH_PropertyPflashBlockBaseAddr = 0x04U
}
 Enumeration for various flash properties. More...
 
enum  _flash_status {
  kStatus_FLASH_Success = 0U,
  kStatus_FLASH_InvalidArgument = 4,
  kStatus_FLASH_SizeError = 100,
  kStatus_FLASH_AlignmentError = 101,
  kStatus_FLASH_AddressError = 102,
  kStatus_FLASH_AccessError = 103,
  kStatus_FLASH_ProtectionViolation,
  kStatus_FLASH_CommandFailure = 105,
  kStatus_FLASH_UnknownProperty = 106,
  kStatus_FLASH_EraseKeyError = 107,
  kStatus_FLASH_CommandNotSupported = 115,
  kStatus_FLASH_SwapSystemNotInUninitialized = 116,
  kStatus_FLASH_SwapIndicatorAddressError = 117,
  kStatus_FLASH_ReadOnlyProperty = 118,
  kStatus_FLASH_InvalidPropertyValue = 119,
  kStatus_FLASH_InvalidSpeculationOption = 120
}
 FTFx driver status codes. More...
 

Flash version

enum  _flash_driver_version_constants {
  kFLASH_DriverVersionName = 'F',
  kFLASH_DriverVersionMajor = 3,
  kFLASH_DriverVersionMinor = 0,
  kFLASH_DriverVersionBugfix = 0
}
 Flash driver version for ROM. More...
 
#define FSL_FLASH_DRIVER_VERSION   (MAKE_VERSION(3U, 0U, 0U))
 Flash driver version for SDK. More...
 
#define FSL_FLASH_DRIVER_VERSION_ROM   (MAKE_VERSION(3U, 0U, 0U))
 Flash driver version for ROM. More...
 

Initialization

flash_status_t FLASH_Init (flash_config_t *config)
 Initializes the global flash properties structure members. More...
 

Properties

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

Erasing

flash_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...
 
flash_status_t FLASH_EraseAll (flash_config_t *config, uint32_t key)
 Erases entire flash, after done flash is on security status. More...
 
flash_status_t FLASH_EraseAllUnsecure (flash_config_t *config, uint32_t key)
 Erases the entire flash, after done flash is on unsecurity status. More...
 

Programming

flash_status_t FLASH_ProgramSection (flash_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes)
 Programs flash with data at locations passed in through parameters via the Program Section command. More...
 
flash_status_t FLASH_ProgramOnce (ftfx_config_t *config, uint32_t index, uint8_t *src, uint32_t lengthInBytes)
 Programs Program Once Field through parameters. More...
 

Verification

flash_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...
 
flash_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...
 
flash_status_t FLASH_VerifyProgram (flash_config_t *config, uint32_t start, uint32_t lengthInBytes, const uint8_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...
 

Security

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

Reading

flash_status_t FLASH_ReadOnce (ftfx_config_t *config, uint32_t index, uint8_t *dst, uint32_t lengthInBytes)
 Reads the Program Once Field through parameters. More...
 
flash_status_t FLASH_ReadResource (flash_config_t *config, uint32_t start, uint8_t *dst, uint32_t lengthInBytes, flash_read_resource_opt_t option)
 Reads the resource with data at locations passed in through parameters. More...
 

Swap

flash_status_t FLASH_Swap (flash_config_t *config, uint32_t address, uint8_t isSetEnable)
 Swaps the lower half flash with the higher half flash. More...
 

Data Structure Documentation

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_spec_mem_t

Data Fields

uint32_t base
 Base address of flash special memory. More...
 
uint32_t size
 size of flash special memory. More...
 
uint32_t count
 flash special memory count. More...
 

Field Documentation

uint32_t flash_spec_mem_t::base
uint32_t flash_spec_mem_t::size
uint32_t flash_spec_mem_t::count
struct flash_mem_desc_t

Data Fields

uint8_t type
 Type of flash block. More...
 
uint8_t index
 Index of flash block. More...
 
uint32_t blockBase
 A base address of the flash block.
 
uint32_t totalSize
 The size of the flash block. More...
 
uint32_t sectorSize
 The size in bytes of a sector of flash. More...
 
uint32_t blockCount
 A number of flash blocks. More...
 

Field Documentation

uint8_t flash_mem_desc_t::type
uint8_t flash_mem_desc_t::index
uint32_t flash_mem_desc_t::totalSize
uint32_t flash_mem_desc_t::sectorSize
uint32_t flash_mem_desc_t::blockCount
struct flash_ops_config_t

Data Fields

uint32_t convertedAddress
 A converted address for the current flash type. More...
 

Field Documentation

uint32_t flash_ops_config_t::convertedAddress
struct flash_ifr_desc_t
struct ftfx_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 flexramBlockBase
 The base address of the FlexRAM/acceleration RAM.
 
uint32_t flexramTotalSize
 The size of the FlexRAM/acceleration RAM.
 
uint16_t eepromTotalSize
 The size of EEPROM area which was partitioned from FlexRAM.
 
uint32_t * runCmdFuncAddr
 An buffer point to the flash execute-in-RAM function. More...
 

Field Documentation

uint32_t* ftfx_config_t::runCmdFuncAddr

Macro Definition Documentation

#define FSL_FLASH_DRIVER_VERSION   (MAKE_VERSION(3U, 0U, 0U))

Version 3.0.0.

#define FSL_FLASH_DRIVER_VERSION_ROM   (MAKE_VERSION(3U, 0U, 0U))

Version 3.0.0.

#define MAKE_STATUS (   group,
  code 
)    ((((group)*100) + (code)))
#define FTFx_FLASH_COUNT   1

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

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.

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

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

Function Documentation

flash_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.
flash_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; the flash property was stored to value.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_UnknownPropertyAn unknown property tag.
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.
flash_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 phrase-aligned (64 bits).
lengthInBytesThe length, given in bytes (not words or long-words) to be erased. Must be phrase-aligned (64 bits).
keyThe value used to validate all flash erase APIs. Use kFLASH_ApiEraseKey here.
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_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.
flash_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. Use kFLASH_ApiEraseKey here.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_EraseKeyErrorAPI erase key is invalid.
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.
flash_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. Use kFLASH_ApiEraseKey here.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_EraseKeyErrorAPI erase key is invalid.
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.
flash_status_t FLASH_ProgramSection ( flash_config_t *  config,
uint32_t  start,
uint8_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 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 phrase-aligned (64 bits).
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 phrase-aligned (64 bits).
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_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.
flash_status_t FLASH_ProgramOnce ( ftfx_config_t config,
uint32_t  index,
uint8_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.Index is 0~7.
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 phrase-aligned (64 bits). This value is ignored, it's always 8 bytes that are written into specified IFR area.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
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.
flash_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 phrase-aligned (64 bits).
lengthInBytesThe length, given in bytes (not words or long-words), to be verified. Must be phrase-aligned (64 bits).
marginRead margin choice. Choose from the members in flash_margin_value_t.
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_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.
flash_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. Choose from the members in flash_margin_value_t.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
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.
flash_status_t FLASH_VerifyProgram ( flash_config_t *  config,
uint32_t  start,
uint32_t  lengthInBytes,
const uint8_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 longword-aligned (32 bits).
lengthInBytesThe length, given in bytes (not words or long-words), to be verified. Must be longword-aligned (32 bits).
expectedDataA pointer to the expected data that is to be verified against.
marginRead margin choice. Choose from the members in flash_margin_value_t. "kFLASH_MarginValueNormal" is not for this command.
failedAddressA pointer to the returned failing address, which is used by PGMCHK command. So it's always longword-aligned.
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_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.
flash_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: one of the members in flash_security_state_t.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
flash_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_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.
flash_status_t FLASH_ReadOnce ( ftfx_config_t config,
uint32_t  index,
uint8_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. Index is 0~7.
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. This value is ignored, it's always 8 bytes that are read out from the specified IFR area.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
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.
flash_status_t FLASH_ReadResource ( flash_config_t *  config,
uint32_t  start,
uint8_t *  dst,
uint32_t  lengthInBytes,
flash_read_resource_opt_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 resource to be read. Must be phrase-aligned (64 bits).
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 phrase-aligned (64 bits). When option is "kFLASH_ResourceOptionFlashIfr", lengthInBytes can't be larger than 64. When option is "kFLASH_ResourceOptionVersionId", lengthInBytes should be set to 8.
optionThe resource option which indicates which area should be read back. Choose from "kFLASH_ResourceOptionFlashIfr" and "kFLASH_ResourceOptionVersionId".
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_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.
flash_status_t FLASH_Swap ( flash_config_t *  config,
uint32_t  address,
uint8_t  isSetEnable 
)
Parameters
configA pointer to the storage for the driver runtime state.
addressAddress used to configure the flash swap function
isSetEnableThe possible option used to configure the Flash Swap function or check the flash Swap status.
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_SwapIndicatorAddressErrorSwap indicator address is invalid.
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_SwapSystemNotInUninitializedSwap system is not in an uninitialzed state.