38#ifndef _FSL_FTFX_CONTROLLER_H_
39#define _FSL_FTFX_CONTROLLER_H_
49#ifndef FSL_COMPONENT_ID
50#define FSL_COMPONENT_ID "platform.drivers.flash"
58#if defined(kStatusGroup_FlashDriver)
59#define kStatusGroupGeneric kStatusGroup_Generic
60#define kStatusGroupFtfxDriver kStatusGroup_FlashDriver
61#elif defined(kStatusGroup_FLASH)
62#define kStatusGroupGeneric kStatusGroup_Generic
63#define kStatusGroupFtfxDriver kStatusGroup_FLASH
65#define kStatusGroupGeneric 0
66#define kStatusGroupFtfxDriver 1
78 MAKE_STATUS(kStatusGroupFtfxDriver, 1),
81 MAKE_STATUS(kStatusGroupFtfxDriver, 3),
83 kStatusGroupFtfxDriver, 4),
85 MAKE_STATUS(kStatusGroupFtfxDriver, 5),
89 MAKE_STATUS(kStatusGroupFtfxDriver, 8),
91 MAKE_STATUS(kStatusGroupFtfxDriver, 9),
93 MAKE_STATUS(kStatusGroupFtfxDriver, 10),
95 MAKE_STATUS(kStatusGroupFtfxDriver, 11),
97 MAKE_STATUS(kStatusGroupFtfxDriver, 12),
100 MAKE_STATUS(kStatusGroupFtfxDriver, 14),
103 MAKE_STATUS(kStatusGroupFtfxDriver, 16),
105 MAKE_STATUS(kStatusGroupFtfxDriver, 17),
108 MAKE_STATUS(kStatusGroupFtfxDriver, 19),
110 MAKE_STATUS(kStatusGroupFtfxDriver, 20),
334#if defined(__cplusplus)
401 uint32_t lengthInBytes,
436#if defined(FSL_FEATURE_FLASH_HAS_ERASE_ALL_BLOCKS_UNSECURE_CMD) && FSL_FEATURE_FLASH_HAS_ERASE_ALL_BLOCKS_UNSECURE_CMD
489 uint32_t lengthInBytes);
538#if defined(FSL_FEATURE_FLASH_HAS_PROGRAM_SECTION_CMD) && FSL_FEATURE_FLASH_HAS_PROGRAM_SECTION_CMD
542 uint32_t lengthInBytes);
562#if defined(FSL_FEATURE_FLASH_HAS_PROGRAM_PARTITION_CMD) && FSL_FEATURE_FLASH_HAS_PROGRAM_PARTITION_CMD
565 uint32_t eepromDataSizeCode,
566 uint32_t flexnvmPartitionCode);
620#if defined(FSL_FEATURE_FLASH_HAS_READ_RESOURCE_CMD) && FSL_FEATURE_FLASH_HAS_READ_RESOURCE_CMD
624 uint32_t lengthInBytes,
660 uint32_t lengthInBytes,
727 uint32_t lengthInBytes,
728 const uint8_t *expectedData,
730 uint32_t *failedAddress,
731 uint32_t *failedData);
793#if defined(FSL_FEATURE_FLASH_HAS_SET_FLEXRAM_FUNCTION_CMD) && FSL_FEATURE_FLASH_HAS_SET_FLEXRAM_FUNCTION_CMD
821#if defined(FSL_FEATURE_FLASH_HAS_SWAP_CONTROL_CMD) && FSL_FEATURE_FLASH_HAS_SWAP_CONTROL_CMD
830#if defined(__cplusplus)
static constexpr persistent_config_s * config
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.
enum _ftfx_read_resource_opt ftfx_read_resource_opt_t
Enumeration for the two possible options of flash read resource command.
_ftfx_security_state
Enumeration for the three possible FTFx security states.
@ kFTFx_SecurityStateBackdoorEnabled
@ kFTFx_SecurityStateNotSecure
@ kFTFx_SecurityStateBackdoorDisabled
enum _ftfx_swap_control_option ftfx_swap_control_opt_t
Enumeration for the possible options of Swap control commands.
struct _ftfx_ops_config ftfx_ops_config_t
Active FTFx information for the current operation.
status_t FTFx_CMD_Program(ftfx_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes)
Programs flash with data at locations passed in through parameters.
_ftfx_swap_control_option
Enumeration for the possible options of Swap control commands.
@ kFTFx_SwapControlOptionReportStatus
@ kFTFx_SwapControlOptionSetInCompleteState
@ kFTFx_SwapControlOptionDisableSystem
@ kFTFx_SwapControlOptionSetInUpdateState
@ kFTFx_SwapControlOptionIntializeSystem
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.
status_t FTFx_CMD_ProgramSection(ftfx_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.
struct _ftfx_swap_state_config ftfx_swap_state_config_t
Flash Swap information.
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.
status_t FTFx_API_UpdateFlexnvmPartitionStatus(ftfx_config_t *config)
Updates FlexNVM memory partition status according to data flash 0 IFR.
status_t FTFx_CMD_ProgramOnce(ftfx_config_t *config, uint32_t index, uint8_t *src, uint32_t lengthInBytes)
Programs Program Once Field through parameters.
status_t FTFx_API_Init(ftfx_config_t *config)
Initializes the global flash properties structure members.
_ftfx_status
FTFx driver status codes.
@ kStatus_FTFx_AlignmentError
@ kStatus_FTFx_SetFlexramAsRamError
@ kStatus_FTFx_RegionExecuteOnly
@ kStatus_FTFx_CommandFailure
@ kStatus_FTFx_UnknownProperty
@ kStatus_FTFx_RecoverFlexramAsRamError
@ kStatus_FTFx_EraseKeyError
@ kStatus_FTFx_RecoverFlexramAsEepromError
@ kStatus_FTFx_InvalidArgument
@ kStatus_FTFx_AddressError
@ kStatus_FTFx_ReadOnlyProperty
@ kStatus_FTFx_ExecuteInRamFunctionNotReady
@ kStatus_FTFx_SwapSystemNotInUninitialized
@ kStatus_FTFx_InvalidPropertyValue
@ kStatus_FTFx_InvalidSpeculationOption
@ kStatus_FTFx_PartitionStatusUpdateFailure
@ kStatus_FTFx_CommandNotSupported
@ kStatus_FTFx_SwapIndicatorAddressError
@ kStatus_FTFx_ProtectionViolation
@ kStatus_FTFx_AccessError
@ kStatus_FTFx_SetFlexramAsEepromError
struct _ftfx_special_mem ftfx_spec_mem_t
ftfx special memory access information.
enum _ftfx_swap_block_status ftfx_swap_block_status_t
_ftfx_partition_flexram_load_option
Enumeration for the FlexRAM load during reset option.
@ kFTFx_PartitionFlexramLoadOptNotLoaded
@ kFTFx_PartitionFlexramLoadOptLoadedWithValidEepromData
status_t FTFx_CMD_EraseAll(ftfx_config_t *config, uint32_t key)
Erases entire flash.
status_t FTFx_CMD_EraseAllUnsecure(ftfx_config_t *config, uint32_t key)
Erases the entire flash, including protected sectors.
enum _ftfx_margin_value ftfx_margin_value_t
Enumeration for supported FTFx margin levels.
_ftfx_flexram_function_option
Enumeration for the two possilbe options of set FlexRAM function command.
@ kFTFx_FlexramFuncOptAvailableForEeprom
@ kFTFx_FlexramFuncOptAvailableAsRam
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 margi...
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.
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.
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.
enum _ftfx_swap_state ftfx_swap_state_t
Enumeration for the possible flash Swap status.
enum _ftfx_flexram_function_option ftfx_flexram_func_opt_t
Enumeration for the two possilbe options of set FlexRAM function command.
status_t FTFx_CMD_SecurityBypass(ftfx_config_t *config, const uint8_t *backdoorKey)
Allows users to bypass security with a backdoor key.
struct _ftfx_config ftfx_config_t
Flash driver state information.
_ftfx_driver_api_keys
Enumeration for FTFx driver API keys.
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.
_ftfx_memory_type
Enumeration for FTFx memory type.
status_t FTFx_CMD_SetFlexramFunction(ftfx_config_t *config, ftfx_flexram_func_opt_t option)
Sets the FlexRAM function command.
struct _ftfx_mem_descriptor ftfx_mem_desc_t
Flash memory descriptor.
_ftfx_swap_state
Enumeration for the possible flash Swap status.
@ kFTFx_SwapStateUninitialized
@ kFTFx_SwapStateComplete
@ kFTFx_SwapStateDisabled
@ kFTFx_SwapStateUpdateErased
enum _ftfx_security_state ftfx_security_state_t
Enumeration for the three possible FTFx security states.
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 initial...
@ kFTFx_SwapBlockStatusUpperHalfProgramBlocksAtZero
@ kFTFx_SwapBlockStatusLowerHalfProgramBlocksAtZero
_ftfx_read_resource_opt
Enumeration for the two possible options of flash read resource command.
@ kFTFx_ResourceOptionVersionId
@ kFTFx_ResourceOptionFlashIfr
_ftfx_margin_value
Enumeration for supported FTFx margin levels.
@ kFTFx_MarginValueNormal
@ kFTFx_MarginValueInvalid
@ kFTFx_MarginValueFactory
struct _ftfx_ifr_descriptor ftfx_ifr_desc_t
Flash IFR memory descriptor.
enum _ftfx_partition_flexram_load_option ftfx_partition_flexram_load_opt_t
Enumeration for the FlexRAM load during reset option.
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.
status_t FTFx_CMD_EraseAllExecuteOnlySegments(ftfx_config_t *config, uint32_t key)
Erases all program flash execute-only segments defined by the FXACC registers.
int32_t status_t
Type used for all status and error return values.
state("state", SensorCategory.SENSOR_INPUTS, FieldType.INT8, 1871, 1.0, -1.0, -1.0, "")
Flash driver state information.
ftfx_ops_config_t opsConfig
uint32_t * runCmdFuncAddr
uint32_t flexramTotalSize
uint32_t flexramBlockBase
ftfx_mem_desc_t flashDesc
Flash IFR memory descriptor.
uint32_t pflashSwapIfrStart
struct _ftfx_ifr_descriptor::@3 resRange
uint16_t mix8byteIdxStart
uint32_t has8ByteIdxSupport
uint32_t has4ByteIdxSupport
struct _ftfx_ifr_descriptor::@4 idxInfo
struct _ftfx_ifr_descriptor::@2 feature
ftfx_spec_mem_t accessSegmentMem
ftfx_spec_mem_t protectRegionMem
struct _ftfx_mem_descriptor::@0 feature
Active FTFx information for the current operation.
struct _ftfx_ops_config::@1 addrAligment
uint8_t blockWriteUnitSize
uint32_t convertedAddress
ftfx special memory access information.
ftfx_swap_block_status_t nextSwapBlockStatus
ftfx_swap_state_t flashSwapState
ftfx_swap_block_status_t currentSwapBlockStatus