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

Overview

Modules

 ftfx utilities
 

Data Structures

struct  ftfx_spec_mem_t
 ftfx special memory access information. More...
 
struct  ftfx_mem_desc_t
 Flash memory descriptor. More...
 
struct  ftfx_ops_config_t
 Active FTFx information for the current operation. More...
 
struct  ftfx_ifr_desc_t
 Flash IFR memory descriptor. More...
 
struct  ftfx_config_t
 Flash driver state information. More...
 

Enumerations

enum  ftfx_partition_flexram_load_opt_t {
  kFTFx_PartitionFlexramLoadOptLoadedWithValidEepromData,
  kFTFx_PartitionFlexramLoadOptNotLoaded = 0x01U
}
 Enumeration for the FlexRAM load during reset option. More...
 
enum  ftfx_read_resource_opt_t {
  kFTFx_ResourceOptionFlashIfr,
  kFTFx_ResourceOptionVersionId = 0x01U
}
 Enumeration for the two possible options of flash read resource command. More...
 
enum  ftfx_margin_value_t {
  kFTFx_MarginValueNormal,
  kFTFx_MarginValueUser,
  kFTFx_MarginValueFactory,
  kFTFx_MarginValueInvalid
}
 Enumeration for supported FTFx margin levels. More...
 
enum  ftfx_security_state_t {
  kFTFx_SecurityStateNotSecure = (int)0xc33cc33c,
  kFTFx_SecurityStateBackdoorEnabled = (int)0x5aa55aa5,
  kFTFx_SecurityStateBackdoorDisabled = (int)0x5ac33ca5
}
 Enumeration for the three possible FTFx security states. More...
 
enum  ftfx_flexram_func_opt_t {
  kFTFx_FlexramFuncOptAvailableAsRam = 0xFFU,
  kFTFx_FlexramFuncOptAvailableForEeprom = 0x00U
}
 Enumeration for the two possilbe options of set FlexRAM function command. More...
 
enum  ftfx_swap_state_t {
  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_memory_type
 Enumeration for FTFx memory type.
 

Variables

uint32_t ftfx_spec_mem_t::base
 Base address of flash special memory. More...
 
uint32_t ftfx_spec_mem_t::size
 size of flash special memory. More...
 
uint32_t ftfx_spec_mem_t::count
 flash special memory count. More...
 
uint8_t ftfx_mem_desc_t::type
 Type of flash block. More...
 
uint8_t ftfx_mem_desc_t::index
 Index of flash block. More...
 
uint32_t ftfx_mem_desc_t::blockBase
 A base address of the flash block.
 
uint32_t ftfx_mem_desc_t::totalSize
 The size of the flash block. More...
 
uint32_t ftfx_mem_desc_t::sectorSize
 The size in bytes of a sector of flash. More...
 
uint32_t ftfx_mem_desc_t::blockCount
 A number of flash blocks. More...
 
uint32_t ftfx_ops_config_t::convertedAddress
 A converted address for the current flash type. More...
 
uint32_t ftfx_config_t::flexramBlockBase
 The base address of the FlexRAM/acceleration RAM.
 
uint32_t ftfx_config_t::flexramTotalSize
 The size of the FlexRAM/acceleration RAM.
 
uint16_t ftfx_config_t::eepromTotalSize
 The size of EEPROM area which was partitioned from FlexRAM.
 
uint32_t * ftfx_config_t::runCmdFuncAddr
 An buffer point to the flash execute-in-RAM function. More...
 

FTFx status

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

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

status_t FTFx_API_Init (ftfx_config_t *config)
 Initializes the global flash properties structure members. More...
 
status_t FTFx_API_UpdateFlexnvmPartitionStatus (ftfx_config_t *config)
 Updates FlexNVM memory partition status according to data flash 0 IFR. 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_EraseAll (ftfx_config_t *config, uint32_t key)
 Erases entire flash. More...
 
status_t FTFx_CMD_EraseAllExecuteOnlySegments (ftfx_config_t *config, uint32_t key)
 Erases the entire flash, including protected sectors. 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...
 
status_t FTFx_CMD_ProgramPartition (ftfx_config_t *config, ftfx_partition_flexram_load_opt_t option, uint32_t eepromDataSizeCode, uint32_t flexnvmPartitionCode)
 Prepares the FlexNVM block for use as data flash, EEPROM backup, or a combination of both and initializes the FlexRAM. 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...
 
status_t FTFx_CMD_ReadResource (ftfx_config_t *config, uint32_t start, uint8_t *dst, uint32_t lengthInBytes, ftfx_read_resource_opt_t option)
 Reads the resource with data at locations passed in 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...
 

FlexRAM

status_t FTFx_CMD_SetFlexramFunction (ftfx_config_t *config, ftfx_flexram_func_opt_t option)
 Sets the FlexRAM function command. More...
 

Data Structure Documentation

struct ftfx_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...
 
struct ftfx_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...
 
struct ftfx_ops_config_t

Data Fields

uint32_t convertedAddress
 A converted address for the current flash type. More...
 
struct ftfx_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...
 

Macro Definition Documentation

#define kStatusGroupGeneric   0

Enumeration Type Documentation

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.

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

Function Documentation

status_t 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.
Return values
kStatus_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_ExecuteInRamFunctionNotReadyExecute-in-RAM function is not available.
status_t FTFx_API_UpdateFlexnvmPartitionStatus ( ftfx_config_t config)

This function updates FlexNVM memory partition status.

Parameters
configPointer to the storage for the driver runtime state.
Return values
kStatus_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_PartitionStatusUpdateFailureFailed to update the partition status.
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_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_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 command execution.
kStatus_FTFx_PartitionStatusUpdateFailureFailed to update the partition status.

Erases all program flash execute-only segments defined by the FXACC registers.

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_ProgramPartition ( ftfx_config_t config,
ftfx_partition_flexram_load_opt_t  option,
uint32_t  eepromDataSizeCode,
uint32_t  flexnvmPartitionCode 
)
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_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentInvalid 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 command execution.
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_ReadResource ( ftfx_config_t config,
uint32_t  start,
uint8_t *  dst,
uint32_t  lengthInBytes,
ftfx_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 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_FTFx_SuccessAPI was executed successfully.
kStatus_FTFx_InvalidArgumentAn invalid argument is provided.
kStatus_FTFx_AlignmentErrorParameter is not aligned with the specified baseline.
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_SetFlexramFunction ( ftfx_config_t config,
ftfx_flexram_func_opt_t  option 
)
Parameters
configA pointer to the storage for the driver runtime state.
optionThe option used to set the work mode of FlexRAM.
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.

Variable Documentation

uint32_t ftfx_spec_mem_t::base
uint32_t ftfx_spec_mem_t::size
uint32_t ftfx_spec_mem_t::count
uint8_t ftfx_mem_desc_t::type
uint8_t ftfx_mem_desc_t::index
uint32_t ftfx_mem_desc_t::totalSize
uint32_t ftfx_mem_desc_t::sectorSize
uint32_t ftfx_mem_desc_t::blockCount
uint32_t ftfx_ops_config_t::convertedAddress
uint32_t* ftfx_config_t::runCmdFuncAddr