![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
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... | |
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_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... | |
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... | |
struct ftfx_spec_mem_t |
struct ftfx_mem_desc_t |
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... | |
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 |
struct ftfx_ops_config_t |
Data Fields | |
uint32_t | convertedAddress |
A converted address for the current flash type. More... | |
uint32_t ftfx_ops_config_t::convertedAddress |
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. | |
function_ptr_t | runCmdFuncAddr |
An buffer point to the flash execute-in-RAM function. More... | |
function_ptr_t ftfx_config_t::runCmdFuncAddr |
#define kStatusGroupGeneric 0 |
anonymous enum |
enum ftfx_margin_value_t |
enum ftfx_swap_state_t |
void FTFx_API_Init | ( | ftfx_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. |
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.
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 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.
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. |
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. |
status_t FTFx_CMD_EraseAll | ( | ftfx_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 FTFx_CMD_EraseAllExecuteOnlySegments | ( | ftfx_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 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.
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 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.
config | A pointer to the storage for the driver runtime state. |
index | The index indicating which area of the Program Once Field to be programmed. |
src | A pointer to the source buffer of data that is to be programmed into the Program Once Field. |
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_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 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.
config | A pointer to the storage for the driver runtime state. |
index | The index indicating the area of program once field to be read. |
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 programmed. Must be word-aligned. |
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 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.
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 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.
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 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.
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 FTFx_CMD_VerifyEraseAllExecuteOnlySegments | ( | ftfx_config_t * | config, |
ftfx_margin_value_t | margin | ||
) |
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 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.
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 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.
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 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.
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. |