MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
Data Structures | |
struct | flexnvm_config_t |
Flexnvm driver state information. More... | |
Enumerations | |
enum | flexnvm_property_tag_t { kFLEXNVM_PropertyDflashSectorSize = 0x00U, kFLEXNVM_PropertyDflashTotalSize = 0x01U, kFLEXNVM_PropertyDflashBlockSize = 0x02U, kFLEXNVM_PropertyDflashBlockCount = 0x03U, kFLEXNVM_PropertyDflashBlockBaseAddr = 0x04U, kFLEXNVM_PropertyFlexRamBlockBaseAddr = 0x05U, kFLEXNVM_PropertyFlexRamTotalSize = 0x06U, kFLEXNVM_PropertyEepromTotalSize = 0x07U } |
Enumeration for various flexnvm properties. More... | |
Functions | |
status_t | FLEXNVM_EepromWrite (flexnvm_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes) |
Programs the EEPROM with data at locations passed in through parameters. More... | |
Flexnvm version | |
#define | FSL_FLEXNVM_DRIVER_VERSION (MAKE_VERSION(3, 0, 0)) |
Flexnvm driver version for SDK. More... | |
Initialization | |
status_t | FLEXNVM_Init (flexnvm_config_t *config) |
Initializes the global flash properties structure members. More... | |
Erasing | |
status_t | FLEXNVM_DflashErase (flexnvm_config_t *config, uint32_t start, uint32_t lengthInBytes, uint32_t key) |
Erases the Dflash sectors encompassed by parameters passed into function. More... | |
status_t | FLEXNVM_EraseAll (flexnvm_config_t *config, uint32_t key) |
Erases entire flexnvm. More... | |
Programming | |||||||||||||||||||||
Erases the entire flexnvm, including protected sectors.
| |||||||||||||||||||||
status_t | FLEXNVM_DflashProgram (flexnvm_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes) | ||||||||||||||||||||
Programs flash with data at locations passed in through parameters. More... | |||||||||||||||||||||
status_t | FLEXNVM_DflashProgramSection (flexnvm_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... | |||||||||||||||||||||
status_t | FLEXNVM_ProgramPartition (flexnvm_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 | FLEXNVM_ReadResource (flexnvm_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 | FLEXNVM_DflashVerifyErase (flexnvm_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 | FLEXNVM_VerifyEraseAll (flexnvm_config_t *config, ftfx_margin_value_t margin) |
Verifies erasure of the entire flash at a specified margin level. More... | |
status_t | FLEXNVM_DflashVerifyProgram (flexnvm_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 | FLEXNVM_GetSecurityState (flexnvm_config_t *config, ftfx_security_state_t *state) |
Returns the security state via the pointer passed into the function. More... | |
status_t | FLEXNVM_SecurityBypass (flexnvm_config_t *config, const uint8_t *backdoorKey) |
Allows users to bypass security with a backdoor key. More... | |
FlexRAM | |
status_t | FLEXNVM_SetFlexramFunction (flexnvm_config_t *config, ftfx_flexram_func_opt_t option) |
Sets the FlexRAM function command. More... | |
Flash Protection Utilities | |
status_t | FLEXNVM_DflashSetProtection (flexnvm_config_t *config, uint8_t protectStatus) |
Sets the DFlash protection to the intended protection status. More... | |
status_t | FLEXNVM_DflashGetProtection (flexnvm_config_t *config, uint8_t *protectStatus) |
Gets the DFlash protection status. More... | |
status_t | FLEXNVM_EepromSetProtection (flexnvm_config_t *config, uint8_t protectStatus) |
Sets the EEPROM protection to the intended protection status. More... | |
status_t | FLEXNVM_EepromGetProtection (flexnvm_config_t *config, uint8_t *protectStatus) |
Gets the EEPROM protection status. More... | |
Properties | |
status_t | FLEXNVM_GetProperty (flexnvm_config_t *config, flexnvm_property_tag_t whichProperty, uint32_t *value) |
Returns the desired flexnvm property. More... | |
struct flexnvm_config_t |
An instance of this structure is allocated by the user of the Flexnvm driver and passed into each of the driver APIs.
#define FSL_FLEXNVM_DRIVER_VERSION (MAKE_VERSION(3, 0, 0)) |
Version 1.0.0.
status_t FLEXNVM_Init | ( | flexnvm_config_t * | config | ) |
This function checks and initializes the Flash module for the other Flash APIs.
config | Pointer to the storage for the driver runtime state. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_ExecuteInRamFunctionNotReady | Execute-in-RAM function is not available. |
kStatus_FTFx_PartitionStatusUpdateFailure | Failed to update the partition status. |
status_t FLEXNVM_DflashErase | ( | flexnvm_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.
config | The pointer to the storage for the driver runtime state. |
start | The 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. |
lengthInBytes | The length, given in bytes (not words or long-words) to be erased. Must be word-aligned. |
key | The value used to validate all flash erase APIs. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_AlignmentError | The parameter is not aligned with the specified baseline. |
kStatus_FTFx_AddressError | The address is out of range. |
kStatus_FTFx_EraseKeyError | The API erase key is invalid. |
kStatus_FTFx_ExecuteInRamFunctionNotReady | Execute-in-RAM function is not available. |
kStatus_FTFx_AccessError | Invalid instruction codes and out-of bounds addresses. |
kStatus_FTFx_ProtectionViolation | The program/erase operation is requested to execute on protected areas. |
kStatus_FTFx_CommandFailure | Run-time error during the command execution. |
status_t FLEXNVM_EraseAll | ( | flexnvm_config_t * | config, |
uint32_t | key | ||
) |
config | Pointer to the storage for the driver runtime state. |
key | A value used to validate all flash erase APIs. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_EraseKeyError | API erase key is invalid. |
kStatus_FTFx_ExecuteInRamFunctionNotReady | Execute-in-RAM function is not available. |
kStatus_FTFx_AccessError | Invalid instruction codes and out-of bounds 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_PartitionStatusUpdateFailure | Failed to update the partition status. |
status_t FLEXNVM_DflashProgram | ( | flexnvm_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 the length.
config | A pointer to the storage for the driver runtime state. |
start | The start address of the desired flash memory to be programmed. Must be word-aligned. |
src | A pointer to the source buffer of data that is to be programmed into the flash. |
lengthInBytes | The length, given in bytes (not words or long-words), to be programmed. Must be word-aligned. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_AlignmentError | Parameter is not aligned with the specified baseline. |
kStatus_FTFx_AddressError | Address is out of range. |
kStatus_FTFx_ExecuteInRamFunctionNotReady | Execute-in-RAM function is not available. |
kStatus_FTFx_AccessError | Invalid instruction codes and out-of bounds addresses. |
kStatus_FTFx_ProtectionViolation | The program/erase operation is requested to execute on protected areas. |
kStatus_FTFx_CommandFailure | Run-time error during the command execution. |
status_t FLEXNVM_DflashProgramSection | ( | flexnvm_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.
config | A pointer to the storage for the driver runtime state. |
start | The start address of the desired flash memory to be programmed. Must be word-aligned. |
src | A pointer to the source buffer of data that is to be programmed into the flash. |
lengthInBytes | The length, given in bytes (not words or long-words), to be programmed. Must be word-aligned. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_AlignmentError | Parameter is not aligned with specified baseline. |
kStatus_FTFx_AddressError | Address is out of range. |
kStatus_FTFx_SetFlexramAsRamError | Failed to set flexram as RAM. |
kStatus_FTFx_ExecuteInRamFunctionNotReady | Execute-in-RAM function is not available. |
kStatus_FTFx_AccessError | Invalid instruction codes and out-of bounds 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_RecoverFlexramAsEepromError | Failed to recover FlexRAM as EEPROM. |
status_t FLEXNVM_ProgramPartition | ( | flexnvm_config_t * | config, |
ftfx_partition_flexram_load_opt_t | option, | ||
uint32_t | eepromDataSizeCode, | ||
uint32_t | flexnvmPartitionCode | ||
) |
config | Pointer to storage for the driver runtime state. |
option | The option used to set FlexRAM load behavior during reset. |
eepromDataSizeCode | Determines the amount of FlexRAM used in each of the available EEPROM subsystems. |
flexnvmPartitionCode | Specifies how to split the FlexNVM block between data flash memory and EEPROM backup memory supporting EEPROM functions. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | Invalid argument is provided. |
kStatus_FTFx_ExecuteInRamFunctionNotReady | Execute-in-RAM function is not available. |
kStatus_FTFx_AccessError | Invalid instruction codes and out-of bounds addresses. |
kStatus_FTFx_ProtectionViolation | The program/erase operation is requested to execute on protected areas. |
kStatus_FTFx_CommandFailure | Run-time error during command execution. |
status_t FLEXNVM_ReadResource | ( | flexnvm_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.
config | A pointer to the storage for the driver runtime state. |
start | The start address of the desired flash memory to be programmed. Must be word-aligned. |
dst | A pointer to the destination buffer of data that is used to store data to be read. |
lengthInBytes | The length, given in bytes (not words or long-words), to be read. Must be word-aligned. |
option | The resource option which indicates which area should be read back. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_AlignmentError | Parameter is not aligned with the specified baseline. |
kStatus_FTFx_ExecuteInRamFunctionNotReady | Execute-in-RAM function is not available. |
kStatus_FTFx_AccessError | Invalid instruction codes and out-of bounds addresses. |
kStatus_FTFx_ProtectionViolation | The program/erase operation is requested to execute on protected areas. |
kStatus_FTFx_CommandFailure | Run-time error during the command execution. |
status_t FLEXNVM_DflashVerifyErase | ( | flexnvm_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.
config | A pointer to the storage for the driver runtime state. |
start | The 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. |
lengthInBytes | The length, given in bytes (not words or long-words), to be verified. Must be word-aligned. |
margin | Read margin choice. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_AlignmentError | Parameter is not aligned with specified baseline. |
kStatus_FTFx_AddressError | Address is out of range. |
kStatus_FTFx_ExecuteInRamFunctionNotReady | Execute-in-RAM function is not available. |
kStatus_FTFx_AccessError | Invalid instruction codes and out-of bounds addresses. |
kStatus_FTFx_ProtectionViolation | The program/erase operation is requested to execute on protected areas. |
kStatus_FTFx_CommandFailure | Run-time error during the command execution. |
status_t FLEXNVM_VerifyEraseAll | ( | flexnvm_config_t * | config, |
ftfx_margin_value_t | margin | ||
) |
This function checks whether the flash is erased to the specified read margin level.
config | A pointer to the storage for the driver runtime state. |
margin | Read margin choice. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_ExecuteInRamFunctionNotReady | Execute-in-RAM function is not available. |
kStatus_FTFx_AccessError | Invalid instruction codes and out-of bounds addresses. |
kStatus_FTFx_ProtectionViolation | The program/erase operation is requested to execute on protected areas. |
kStatus_FTFx_CommandFailure | Run-time error during the command execution. |
status_t FLEXNVM_DflashVerifyProgram | ( | flexnvm_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 programmed 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.
config | A pointer to the storage for the driver runtime state. |
start | The start address of the desired flash memory to be verified. Must be word-aligned. |
lengthInBytes | The length, given in bytes (not words or long-words), to be verified. Must be word-aligned. |
expectedData | A pointer to the expected data that is to be verified against. |
margin | Read margin choice. |
failedAddress | A pointer to the returned failing address. |
failedData | A 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. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_AlignmentError | Parameter is not aligned with specified baseline. |
kStatus_FTFx_AddressError | Address is out of range. |
kStatus_FTFx_ExecuteInRamFunctionNotReady | Execute-in-RAM function is not available. |
kStatus_FTFx_AccessError | Invalid instruction codes and out-of bounds addresses. |
kStatus_FTFx_ProtectionViolation | The program/erase operation is requested to execute on protected areas. |
kStatus_FTFx_CommandFailure | Run-time error during the command execution. |
status_t FLEXNVM_GetSecurityState | ( | flexnvm_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.
config | A pointer to storage for the driver runtime state. |
state | A pointer to the value returned for the current security status code: |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
status_t FLEXNVM_SecurityBypass | ( | flexnvm_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.
config | A pointer to the storage for the driver runtime state. |
backdoorKey | A pointer to the user buffer containing the backdoor key. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_ExecuteInRamFunctionNotReady | Execute-in-RAM function is not available. |
kStatus_FTFx_AccessError | Invalid instruction codes and out-of bounds addresses. |
kStatus_FTFx_ProtectionViolation | The program/erase operation is requested to execute on protected areas. |
kStatus_FTFx_CommandFailure | Run-time error during the command execution. |
status_t FLEXNVM_SetFlexramFunction | ( | flexnvm_config_t * | config, |
ftfx_flexram_func_opt_t | option | ||
) |
config | A pointer to the storage for the driver runtime state. |
option | The option used to set the work mode of FlexRAM. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_ExecuteInRamFunctionNotReady | Execute-in-RAM function is not available. |
kStatus_FTFx_AccessError | Invalid instruction codes and out-of bounds addresses. |
kStatus_FTFx_ProtectionViolation | The program/erase operation is requested to execute on protected areas. |
kStatus_FTFx_CommandFailure | Run-time error during the command execution. |
status_t FLEXNVM_EepromWrite | ( | flexnvm_config_t * | config, |
uint32_t | start, | ||
uint8_t * | src, | ||
uint32_t | lengthInBytes | ||
) |
This function programs the emulated EEPROM with the desired data for a given flash area as determined by the start address and length.
config | A pointer to the storage for the driver runtime state. |
start | The start address of the desired flash memory to be programmed. Must be word-aligned. |
src | A pointer to the source buffer of data that is to be programmed into the flash. |
lengthInBytes | The length, given in bytes (not words or long-words), to be programmed. Must be word-aligned. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_AddressError | Address is out of range. |
kStatus_FTFx_SetFlexramAsEepromError | Failed to set flexram as eeprom. |
kStatus_FTFx_ProtectionViolation | The program/erase operation is requested to execute on protected areas. |
kStatus_FTFx_RecoverFlexramAsRamError | Failed to recover the FlexRAM as RAM. |
status_t FLEXNVM_DflashSetProtection | ( | flexnvm_config_t * | config, |
uint8_t | protectStatus | ||
) |
config | A pointer to the storage for the driver runtime state. |
protectStatus | The expected protect status to set to the DFlash protection register. Each bit corresponds to the protection of the 1/8 of the total DFlash. The least significant bit corresponds to the lowest address area of the DFlash. The most significant bit corresponds to the highest address area of the DFlash. There are two possible cases as shown below: 0: this area is protected. 1: this area is unprotected. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_CommandNotSupported | Flash API is not supported. |
kStatus_FTFx_CommandFailure | Run-time error during command execution. |
status_t FLEXNVM_DflashGetProtection | ( | flexnvm_config_t * | config, |
uint8_t * | protectStatus | ||
) |
config | A pointer to the storage for the driver runtime state. |
protectStatus | DFlash Protect status returned by the PFlash IP. Each bit corresponds to the protection of the 1/8 of the total DFlash. The least significant bit corresponds to the lowest address area of the DFlash. The most significant bit corresponds to the highest address area of the DFlash, and so on. There are two possible cases as below: 0: this area is protected. 1: this area is unprotected. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_CommandNotSupported | Flash API is not supported. |
status_t FLEXNVM_EepromSetProtection | ( | flexnvm_config_t * | config, |
uint8_t | protectStatus | ||
) |
config | A pointer to the storage for the driver runtime state. |
protectStatus | The expected protect status to set to the EEPROM protection register. Each bit corresponds to the protection of the 1/8 of the total EEPROM. The least significant bit corresponds to the lowest address area of the EEPROM. The most significant bit corresponds to the highest address area of EEPROM, and so on. There are two possible cases as shown below: 0: this area is protected. 1: this area is unprotected. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_CommandNotSupported | Flash API is not supported. |
kStatus_FTFx_CommandFailure | Run-time error during command execution. |
status_t FLEXNVM_EepromGetProtection | ( | flexnvm_config_t * | config, |
uint8_t * | protectStatus | ||
) |
config | A pointer to the storage for the driver runtime state. |
protectStatus | DFlash Protect status returned by the PFlash IP. Each bit corresponds to the protection of the 1/8 of the total EEPROM. The least significant bit corresponds to the lowest address area of the EEPROM. The most significant bit corresponds to the highest address area of the EEPROM. There are two possible cases as below: 0: this area is protected. 1: this area is unprotected. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_CommandNotSupported | Flash API is not supported. |
status_t FLEXNVM_GetProperty | ( | flexnvm_config_t * | config, |
flexnvm_property_tag_t | whichProperty, | ||
uint32_t * | value | ||
) |
config | A pointer to the storage for the driver runtime state. |
whichProperty | The desired property from the list of properties in enum flexnvm_property_tag_t |
value | A pointer to the value returned for the desired flexnvm property. |
kStatus_FTFx_Success | API was executed successfully. |
kStatus_FTFx_InvalidArgument | An invalid argument is provided. |
kStatus_FTFx_UnknownProperty | An unknown property tag. |