MCUXpresso SDK API Reference Manual  Rev 2.15.000
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ftfx controller

Overview

Modules

 ftfx utilities
 

Data Structures

struct  _ftfx_swap_state_config
 Flash Swap information. More...
 
struct  _ftfx_special_mem
 ftfx special memory access information. More...
 
struct  _ftfx_mem_descriptor
 Flash memory descriptor. More...
 
struct  _ftfx_ops_config
 Active FTFx information for the current operation. More...
 
struct  _ftfx_ifr_descriptor
 Flash IFR memory descriptor. More...
 
struct  _ftfx_config
 Flash driver state information. More...
 

Typedefs

typedef enum
_ftfx_partition_flexram_load_option 
ftfx_partition_flexram_load_opt_t
 Enumeration for the FlexRAM load during reset option.
 
typedef enum
_ftfx_read_resource_opt 
ftfx_read_resource_opt_t
 Enumeration for the two possible options of flash read resource command.
 
typedef enum _ftfx_margin_value ftfx_margin_value_t
 Enumeration for supported FTFx margin levels.
 
typedef enum _ftfx_security_state ftfx_security_state_t
 Enumeration for the three possible FTFx security states.
 
typedef enum
_ftfx_flexram_function_option 
ftfx_flexram_func_opt_t
 Enumeration for the two possilbe options of set FlexRAM function command.
 
typedef enum
_ftfx_swap_control_option 
ftfx_swap_control_opt_t
 Enumeration for the possible options of Swap control commands.
 
typedef enum _ftfx_swap_state ftfx_swap_state_t
 Enumeration for the possible flash Swap status.
 
typedef enum
_ftfx_swap_block_status 
ftfx_swap_block_status_t
 Enumeration for the possible flash Swap block status.
 
typedef struct
_ftfx_swap_state_config 
ftfx_swap_state_config_t
 Flash Swap information.
 
typedef struct _ftfx_special_mem ftfx_spec_mem_t
 ftfx special memory access information.
 
typedef struct _ftfx_mem_descriptor ftfx_mem_desc_t
 Flash memory descriptor.
 
typedef struct _ftfx_ops_config ftfx_ops_config_t
 Active FTFx information for the current operation.
 
typedef struct _ftfx_ifr_descriptor ftfx_ifr_desc_t
 Flash IFR memory descriptor.
 
typedef struct _ftfx_config ftfx_config_t
 Flash driver state information. More...
 

Enumerations

enum  _ftfx_partition_flexram_load_option {
  kFTFx_PartitionFlexramLoadOptLoadedWithValidEepromData,
  kFTFx_PartitionFlexramLoadOptNotLoaded = 0x01U
}
 Enumeration for the FlexRAM load during reset option. More...
 
enum  _ftfx_read_resource_opt {
  kFTFx_ResourceOptionFlashIfr,
  kFTFx_ResourceOptionVersionId = 0x01U
}
 Enumeration for the two possible options of flash read resource command. More...
 
enum  _ftfx_margin_value {
  kFTFx_MarginValueNormal,
  kFTFx_MarginValueUser,
  kFTFx_MarginValueFactory,
  kFTFx_MarginValueInvalid
}
 Enumeration for supported FTFx margin levels. More...
 
enum  _ftfx_security_state {
  kFTFx_SecurityStateNotSecure = (int)0xc33cc33cu,
  kFTFx_SecurityStateBackdoorEnabled = (int)0x5aa55aa5u,
  kFTFx_SecurityStateBackdoorDisabled = (int)0x5ac33ca5u
}
 Enumeration for the three possible FTFx security states. More...
 
enum  _ftfx_flexram_function_option {
  kFTFx_FlexramFuncOptAvailableAsRam = 0xFFU,
  kFTFx_FlexramFuncOptAvailableForEeprom = 0x00U
}
 Enumeration for the two possilbe options of set FlexRAM function command. More...
 
enum  _flash_acceleration_ram_property
 Enumeration for acceleration ram property.
 
enum  _ftfx_swap_control_option {
  kFTFx_SwapControlOptionIntializeSystem = 0x01U,
  kFTFx_SwapControlOptionSetInUpdateState = 0x02U,
  kFTFx_SwapControlOptionSetInCompleteState = 0x04U,
  kFTFx_SwapControlOptionReportStatus = 0x08U,
  kFTFx_SwapControlOptionDisableSystem = 0x10U
}
 Enumeration for the possible options of Swap control commands. More...
 
enum  _ftfx_swap_state {
  kFTFx_SwapStateUninitialized = 0x00U,
  kFTFx_SwapStateReady = 0x01U,
  kFTFx_SwapStateUpdate = 0x02U,
  kFTFx_SwapStateUpdateErased = 0x03U,
  kFTFx_SwapStateComplete = 0x04U,
  kFTFx_SwapStateDisabled = 0x05U
}
 Enumeration for the possible flash Swap status. More...
 
enum  _ftfx_swap_block_status {
  kFTFx_SwapBlockStatusLowerHalfProgramBlocksAtZero,
  kFTFx_SwapBlockStatusUpperHalfProgramBlocksAtZero
}
 Enumeration for the possible flash Swap block status. More...
 
enum  _ftfx_memory_type
 Enumeration for FTFx memory type.
 

FTFx status

enum  {
  kStatus_FTFx_Success = MAKE_STATUS(kStatusGroupGeneric, 0),
  kStatus_FTFx_InvalidArgument = MAKE_STATUS(kStatusGroupGeneric, 4),
  kStatus_FTFx_SizeError = MAKE_STATUS(kStatusGroupFtfxDriver, 0),
  kStatus_FTFx_AlignmentError,
  kStatus_FTFx_AddressError = MAKE_STATUS(kStatusGroupFtfxDriver, 2),
  kStatus_FTFx_AccessError,
  kStatus_FTFx_ProtectionViolation,
  kStatus_FTFx_CommandFailure,
  kStatus_FTFx_UnknownProperty = MAKE_STATUS(kStatusGroupFtfxDriver, 6),
  kStatus_FTFx_EraseKeyError = MAKE_STATUS(kStatusGroupFtfxDriver, 7),
  kStatus_FTFx_RegionExecuteOnly = MAKE_STATUS(kStatusGroupFtfxDriver, 8),
  kStatus_FTFx_ExecuteInRamFunctionNotReady,
  kStatus_FTFx_PartitionStatusUpdateFailure,
  kStatus_FTFx_SetFlexramAsEepromError,
  kStatus_FTFx_RecoverFlexramAsRamError,
  kStatus_FTFx_SetFlexramAsRamError = MAKE_STATUS(kStatusGroupFtfxDriver, 13),
  kStatus_FTFx_RecoverFlexramAsEepromError,
  kStatus_FTFx_CommandNotSupported = MAKE_STATUS(kStatusGroupFtfxDriver, 15),
  kStatus_FTFx_SwapSystemNotInUninitialized,
  kStatus_FTFx_SwapIndicatorAddressError,
  kStatus_FTFx_ReadOnlyProperty = MAKE_STATUS(kStatusGroupFtfxDriver, 18),
  kStatus_FTFx_InvalidPropertyValue,
  kStatus_FTFx_InvalidSpeculationOption,
  kStatus_FTFx_CommandOperationInProgress
}
 FTFx driver status codes. More...
 

FTFx API key

enum  _ftfx_driver_api_keys { kFTFx_ApiEraseKey = FOUR_CHAR_CODE('k', 'f', 'e', 'k') }
 Enumeration for FTFx driver API keys. More...
 

Initialization

void FTFx_API_Init (ftfx_config_t *config)
 Initializes the global flash properties structure members. More...
 

Erasing

status_t FTFx_CMD_Erase (ftfx_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 FTFx_CMD_EraseSectorNonBlocking (ftfx_config_t *config, uint32_t start, uint32_t key)
 Erases the flash sectors encompassed by parameters passed into function. More...
 
status_t FTFx_CMD_EraseAll (ftfx_config_t *config, uint32_t key)
 Erases entire flash. More...
 
status_t FTFx_CMD_EraseAllUnsecure (ftfx_config_t *config, uint32_t key)
 Erases the entire flash, including protected sectors. More...
 
status_t FTFx_CMD_EraseAllExecuteOnlySegments (ftfx_config_t *config, uint32_t key)
 Erases all program flash execute-only segments defined by the FXACC registers. More...
 

Programming

status_t FTFx_CMD_Program (ftfx_config_t *config, uint32_t start, const uint8_t *src, uint32_t lengthInBytes)
 Programs flash with data at locations passed in through parameters. More...
 
status_t FTFx_CMD_ProgramOnce (ftfx_config_t *config, uint32_t index, const uint8_t *src, uint32_t lengthInBytes)
 Programs Program Once Field through parameters. More...
 
status_t FTFx_CMD_ProgramSection (ftfx_config_t *config, uint32_t start, const uint8_t *src, uint32_t lengthInBytes)
 Programs flash with data at locations passed in through parameters via the Program Section command. More...
 

Reading

status_t FTFx_CMD_ReadOnce (ftfx_config_t *config, uint32_t index, uint8_t *dst, uint32_t lengthInBytes)
 Reads the Program Once Field through parameters. More...
 

Verification

status_t FTFx_CMD_VerifyErase (ftfx_config_t *config, uint32_t start, uint32_t lengthInBytes, ftfx_margin_value_t margin)
 Verifies an erasure of the desired flash area at a specified margin level. More...
 
status_t FTFx_CMD_VerifyEraseAll (ftfx_config_t *config, ftfx_margin_value_t margin)
 Verifies erasure of the entire flash at a specified margin level. More...
 
status_t FTFx_CMD_VerifyEraseAllExecuteOnlySegments (ftfx_config_t *config, ftfx_margin_value_t margin)
 Verifies whether the program flash execute-only segments have been erased to the specified read margin level. More...
 
status_t FTFx_CMD_VerifyProgram (ftfx_config_t *config, uint32_t start, uint32_t lengthInBytes, const uint8_t *expectedData, ftfx_margin_value_t margin, uint32_t *failedAddress, uint32_t *failedData)
 Verifies programming of the desired flash area at a specified margin level. More...
 

Security

status_t FTFx_REG_GetSecurityState (ftfx_config_t *config, ftfx_security_state_t *state)
 Returns the security state via the pointer passed into the function. More...
 
status_t FTFx_CMD_SecurityBypass (ftfx_config_t *config, const uint8_t *backdoorKey)
 Allows users to bypass security with a backdoor key. More...
 

Swap

status_t FTFx_CMD_SwapControl (ftfx_config_t *config, uint32_t address, ftfx_swap_control_opt_t option, ftfx_swap_state_config_t *returnInfo)
 Configures the Swap function or checks the swap state of the Flash module. More...
 

Data Structure Documentation

struct _ftfx_swap_state_config

Data Fields

ftfx_swap_state_t flashSwapState
 The current Swap system status. More...
 
ftfx_swap_block_status_t currentSwapBlockStatus
 The current Swap block status. More...
 
ftfx_swap_block_status_t nextSwapBlockStatus
 The next Swap block status. More...
 

Field Documentation

ftfx_swap_state_t _ftfx_swap_state_config::flashSwapState
ftfx_swap_block_status_t _ftfx_swap_state_config::currentSwapBlockStatus
ftfx_swap_block_status_t _ftfx_swap_state_config::nextSwapBlockStatus
struct _ftfx_special_mem

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 _ftfx_special_mem::base
uint32_t _ftfx_special_mem::size
uint32_t _ftfx_special_mem::count
struct _ftfx_mem_descriptor

Data Fields

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...
 
uint8_t type
 Type of flash block. More...
 
uint8_t index
 Index of flash block. More...
 

Field Documentation

uint8_t _ftfx_mem_descriptor::type
uint8_t _ftfx_mem_descriptor::index
uint32_t _ftfx_mem_descriptor::totalSize
uint32_t _ftfx_mem_descriptor::sectorSize
uint32_t _ftfx_mem_descriptor::blockCount
struct _ftfx_ops_config

Data Fields

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

Field Documentation

uint32_t _ftfx_ops_config::convertedAddress
struct _ftfx_ifr_descriptor
struct _ftfx_config

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.
 
function_ptr_t runCmdFuncAddr
 An buffer point to the flash execute-in-RAM function. More...
 

Field Documentation

function_ptr_t _ftfx_config::runCmdFuncAddr

Typedef Documentation

typedef struct _ftfx_config 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.

Enumeration Type Documentation

anonymous enum
Enumerator
kStatus_FTFx_Success 

API is executed successfully.

kStatus_FTFx_InvalidArgument 

Invalid argument.

kStatus_FTFx_SizeError 

Error size.

kStatus_FTFx_AlignmentError 

Parameter is not aligned with the specified baseline.

kStatus_FTFx_AddressError 

Address is out of range.

kStatus_FTFx_AccessError 

Invalid instruction codes and out-of bound addresses.

kStatus_FTFx_ProtectionViolation 

The program/erase operation is requested to execute on protected areas.

kStatus_FTFx_CommandFailure 

Run-time error during command execution.

kStatus_FTFx_UnknownProperty 

Unknown property.

kStatus_FTFx_EraseKeyError 

API erase key is invalid.

kStatus_FTFx_RegionExecuteOnly 

The current region is execute-only.

kStatus_FTFx_ExecuteInRamFunctionNotReady 

Execute-in-RAM function is not available.

kStatus_FTFx_PartitionStatusUpdateFailure 

Failed to update partition status.

kStatus_FTFx_SetFlexramAsEepromError 

Failed to set FlexRAM as EEPROM.

kStatus_FTFx_RecoverFlexramAsRamError 

Failed to recover FlexRAM as RAM.

kStatus_FTFx_SetFlexramAsRamError 

Failed to set FlexRAM as RAM.

kStatus_FTFx_RecoverFlexramAsEepromError 

Failed to recover FlexRAM as EEPROM.

kStatus_FTFx_CommandNotSupported 

Flash API is not supported.

kStatus_FTFx_SwapSystemNotInUninitialized 

Swap system is not in an uninitialzed state.

kStatus_FTFx_SwapIndicatorAddressError 

The swap indicator address is invalid.

kStatus_FTFx_ReadOnlyProperty 

The flash property is read-only.

kStatus_FTFx_InvalidPropertyValue 

The flash property value is out of range.

kStatus_FTFx_InvalidSpeculationOption 

The option of flash prefetch speculation is invalid.

kStatus_FTFx_CommandOperationInProgress 

The option of flash command is processing.

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
kFTFx_ApiEraseKey 

Key value used to validate all FTFx erase APIs.

Enumerator
kFTFx_PartitionFlexramLoadOptLoadedWithValidEepromData 

FlexRAM is loaded with valid EEPROM data during reset sequence.

kFTFx_PartitionFlexramLoadOptNotLoaded 

FlexRAM is not loaded during reset sequence.

Enumerator
kFTFx_ResourceOptionFlashIfr 

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

kFTFx_ResourceOptionVersionId 

Select code for the version ID.

Enumerator
kFTFx_MarginValueNormal 

Use the 'normal' read level for 1s.

kFTFx_MarginValueUser 

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

kFTFx_MarginValueFactory 

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

kFTFx_MarginValueInvalid 

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

Enumerator
kFTFx_SecurityStateNotSecure 

Flash is not secure.

kFTFx_SecurityStateBackdoorEnabled 

Flash backdoor is enabled.

kFTFx_SecurityStateBackdoorDisabled 

Flash backdoor is disabled.

Enumerator
kFTFx_FlexramFuncOptAvailableAsRam 

An option used to make FlexRAM available as RAM.

kFTFx_FlexramFuncOptAvailableForEeprom 

An option used to make FlexRAM available for EEPROM.

Enumerator
kFTFx_SwapControlOptionIntializeSystem 

An option used to initialize the Swap system.

kFTFx_SwapControlOptionSetInUpdateState 

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

kFTFx_SwapControlOptionSetInCompleteState 

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

kFTFx_SwapControlOptionReportStatus 

An option used to report the Swap status.

kFTFx_SwapControlOptionDisableSystem 

An option used to disable the Swap status.

Enumerator
kFTFx_SwapStateUninitialized 

Flash Swap system is in an uninitialized state.

kFTFx_SwapStateReady 

Flash Swap system is in a ready state.

kFTFx_SwapStateUpdate 

Flash Swap system is in an update state.

kFTFx_SwapStateUpdateErased 

Flash Swap system is in an updateErased state.

kFTFx_SwapStateComplete 

Flash Swap system is in a complete state.

kFTFx_SwapStateDisabled 

Flash Swap system is in a disabled state.

Enumerator
kFTFx_SwapBlockStatusLowerHalfProgramBlocksAtZero 

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

kFTFx_SwapBlockStatusUpperHalfProgramBlocksAtZero 

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

Function Documentation

void FTFx_API_Init ( ftfx_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.
status_t FTFx_CMD_Erase ( ftfx_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_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_AlignmentErrorThe parameter is not aligned with the specified baseline.
kStatus_FTFx_AddressErrorThe address is out of range.
kStatus_FTFx_EraseKeyErrorThe API erase key is invalid.
kStatus_FTFx_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FTFx_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FTFx_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FTFx_CommandFailureRun-time error during the command execution.
status_t FTFx_CMD_EraseSectorNonBlocking ( ftfx_config_t config,
uint32_t  start,
uint32_t  key 
)

This function erases one flash sector size based on the start address.

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.
keyThe value used to validate all flash erase APIs.
Return values
kStatus_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_AlignmentErrorThe parameter is not aligned with the specified baseline.
kStatus_FTFx_AddressErrorThe address is out of range.
kStatus_FTFx_EraseKeyErrorThe API erase key is invalid.
kStatus_FTFx_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
status_t FTFx_CMD_EraseAll ( ftfx_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_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_EraseKeyErrorAPI erase key is invalid.
kStatus_FTFx_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FTFx_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FTFx_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FTFx_CommandFailureRun-time error during command execution.
kStatus_FTFx_PartitionStatusUpdateFailureFailed to update the partition status.
status_t FTFx_CMD_EraseAllUnsecure ( ftfx_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_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_EraseKeyErrorAPI erase key is invalid.
kStatus_FTFx_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FTFx_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FTFx_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FTFx_CommandFailureRun-time error during command execution.
kStatus_FTFx_PartitionStatusUpdateFailureFailed to update the partition status.
status_t FTFx_CMD_EraseAllExecuteOnlySegments ( ftfx_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_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_EraseKeyErrorAPI erase key is invalid.
kStatus_FTFx_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FTFx_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FTFx_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FTFx_CommandFailureRun-time error during the command execution.
status_t FTFx_CMD_Program ( ftfx_config_t config,
uint32_t  start,
const 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 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_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_AlignmentErrorParameter is not aligned with the specified baseline.
kStatus_FTFx_AddressErrorAddress is out of range.
kStatus_FTFx_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FTFx_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FTFx_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FTFx_CommandFailureRun-time error during the command execution.
status_t FTFx_CMD_ProgramOnce ( ftfx_config_t config,
uint32_t  index,
const 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.
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_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FTFx_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FTFx_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FTFx_CommandFailureRun-time error during the command execution.
status_t FTFx_CMD_ProgramSection ( ftfx_config_t config,
uint32_t  start,
const 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 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_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_AlignmentErrorParameter is not aligned with specified baseline.
kStatus_FTFx_AddressErrorAddress is out of range.
kStatus_FTFx_SetFlexramAsRamErrorFailed to set flexram as RAM.
kStatus_FTFx_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FTFx_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FTFx_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FTFx_CommandFailureRun-time error during command execution.
kStatus_FTFx_RecoverFlexramAsEepromErrorFailed to recover FlexRAM as EEPROM.
status_t FTFx_CMD_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.
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_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FTFx_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FTFx_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FTFx_CommandFailureRun-time error during the command execution.
status_t FTFx_CMD_VerifyErase ( ftfx_config_t config,
uint32_t  start,
uint32_t  lengthInBytes,
ftfx_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_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_AlignmentErrorParameter is not aligned with specified baseline.
kStatus_FTFx_AddressErrorAddress is out of range.
kStatus_FTFx_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FTFx_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FTFx_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FTFx_CommandFailureRun-time error during the command execution.
status_t FTFx_CMD_VerifyEraseAll ( ftfx_config_t config,
ftfx_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_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FTFx_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FTFx_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FTFx_CommandFailureRun-time error during the command execution.
status_t FTFx_CMD_VerifyEraseAllExecuteOnlySegments ( ftfx_config_t config,
ftfx_margin_value_t  margin 
)
Parameters
configA pointer to the storage for the driver runtime state.
marginRead margin choice.
Return values
kStatus_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FTFx_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FTFx_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FTFx_CommandFailureRun-time error during the command execution.
status_t FTFx_CMD_VerifyProgram ( ftfx_config_t config,
uint32_t  start,
uint32_t  lengthInBytes,
const uint8_t *  expectedData,
ftfx_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_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_AlignmentErrorParameter is not aligned with specified baseline.
kStatus_FTFx_AddressErrorAddress is out of range.
kStatus_FTFx_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FTFx_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FTFx_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FTFx_CommandFailureRun-time error during the command execution.
status_t FTFx_REG_GetSecurityState ( ftfx_config_t config,
ftfx_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_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
status_t FTFx_CMD_SecurityBypass ( ftfx_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_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FTFx_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FTFx_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FTFx_CommandFailureRun-time error during the command execution.
status_t FTFx_CMD_SwapControl ( ftfx_config_t config,
uint32_t  address,
ftfx_swap_control_opt_t  option,
ftfx_swap_state_config_t returnInfo 
)
Parameters
configA pointer to the storage for the driver runtime state.
addressAddress used to configure the flash Swap function.
optionThe possible option used to configure Flash Swap function or check the flash Swap status
returnInfoA pointer to the data which is used to return the information of flash Swap.
Return values
kStatus_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_AlignmentErrorParameter is not aligned with specified baseline.
kStatus_FTFx_SwapIndicatorAddressErrorSwap indicator address is invalid.
kStatus_FTFx_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
kStatus_FTFx_AccessErrorInvalid instruction codes and out-of bounds addresses.
kStatus_FTFx_ProtectionViolationThe program/erase operation is requested to execute on protected areas.
kStatus_FTFx_CommandFailureRun-time error during the command execution.