![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
Files | |
file | fsl_flash_ffr.h |
Macros | |
#define | ALIGN_DOWN(x, a) ((x) & (uint32_t)(-((int32_t)(a)))) |
Alignment(down) utility. More... | |
#define | ALIGN_UP(x, a) (-((int32_t)((uint32_t)(-((int32_t)(x))) & (uint32_t)(-((int32_t)(a)))))) |
Alignment(up) utility. More... | |
Enumerations | |
enum | flash_ffr_page_offset { kFfrPageOffset_CFPA = 0U, kFfrPageOffset_CFPA_Scratch = 0U, kFfrPageOffset_CFPA_CfgPing = 1U, kFfrPageOffset_CFPA_CfgPong = 2U, kFfrPageOffset_CMPA = 3U, kFfrPageOffset_CMPA_Cfg = 3U, kFfrPageOffset_CMPA_Key = 4U, kFfrPageOffset_NMPA = 7U, kFfrPageOffset_NMPA_Romcp = 7U, kFfrPageOffset_NMPA_Repair = 9U, kFfrPageOffset_NMPA_Cfg = 15U, kFfrPageOffset_NMPA_End = 16U } |
enum | flash_ffr_page_num { kFfrPageNum_CFPA = 3U, kFfrPageNum_CMPA = 4U, kFfrPageNum_NMPA = 13U } |
FFR APIs | |
status_t | FFR_Init (flash_config_t *config) |
Initializes the global FFR properties structure members. More... | |
status_t | FFR_Lock (flash_config_t *config) |
Enable firewall for all flash banks. More... | |
status_t | FFR_SecLibInit (flash_config_t *config, uint32_t *context) |
Initialize the Security Library for FFR driver. More... | |
status_t | FFR_GetCustKeystoreData (flash_config_t *config, uint8_t *pData, uint32_t offset, uint32_t len) |
The API is used for getting the customer key store data from the customer key store region(0x3e400 ¨C 0x3e600), and the API should be called after the FLASH_Init and FFR_Init. More... | |
status_t | FFR_CustomerPagesInit (flash_config_t *config) |
APIs to access CFPA pages. More... | |
status_t | FFR_InfieldPageWrite (flash_config_t *config, uint8_t *page_data, uint32_t valid_len) |
APIs to access CFPA pages. More... | |
status_t | FFR_GetCustomerInfieldData (flash_config_t *config, uint8_t *pData, uint32_t offset, uint32_t len) |
APIs to access CFPA pages. More... | |
status_t | FFR_CustFactoryPageWrite (flash_config_t *config, uint8_t *page_data, bool seal_part) |
APIs to access CMPA pages. More... | |
status_t | FFR_GetCustomerData (flash_config_t *config, uint8_t *pData, uint32_t offset, uint32_t len) |
APIs to access CMPA page. More... | |
status_t | FFR_CustKeystoreWrite (flash_config_t *config, ffr_key_store_t *pKeyStore) |
This routine writes the 3 pages allocated for Key store data. More... | |
status_t | FFR_GetUUID (flash_config_t *config, uint8_t *uuid) |
APIs to access CMPA page. More... | |
#define ALIGN_DOWN | ( | x, | |
a | |||
) | ((x) & (uint32_t)(-((int32_t)(a)))) |
#define ALIGN_UP | ( | x, | |
a | |||
) | (-((int32_t)((uint32_t)(-((int32_t)(x))) & (uint32_t)(-((int32_t)(a)))))) |
enum flash_ffr_page_num |
status_t FFR_Init | ( | flash_config_t * | config | ) |
config | A pointer to the storage for the driver runtime state. |
kStatus_FLASH_Success | API was executed successfully. |
status_t FFR_Lock | ( | flash_config_t * | config | ) |
CFPA, CMPA, and NMPA flash areas region will be locked, After this function executed; Unless the board is reset again.
config | A pointer to the storage for the driver runtime state. |
kStatus_FLASH_Success | An invalid argument is provided. |
status_t FFR_SecLibInit | ( | flash_config_t * | config, |
uint32_t * | context | ||
) |
config | A pointer to the storage for the driver runtime state. |
context | A pointer to the storage for the nboot data. |
kStatus_FLASH_Success | An invalid argument is provided. |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
status_t FFR_GetCustKeystoreData | ( | flash_config_t * | config, |
uint8_t * | pData, | ||
uint32_t | offset, | ||
uint32_t | len | ||
) |
config | A pointer to the storage for the driver runtime state. |
pData | A pointer to the dest buffer of data that is to be read from the Customer Factory CFG Page. |
offset | Address offset relative to the CMPA area. |
len | The length, given in bytes to be read. |
kStatus_FLASH_Success | Get data from 'Customer Factory CFG Page'. |
kStatus_FLASH_InvalidArgument | Parameter is not aligned with the specified baseline. |
#kStatus_FTFx_AddressError | Address is out of range. |
kStatus_FLASH_AddressError | Address is out of range |
kStatus_FLASH_AlignmentError | Parameter is not aligned with the specified baseline. |
kStatus_FLASH_ReadHidingAreaDisallowed | Flash hiding read is not allowed |
kStatus_FLASH_CommandFailure | access error. |
kStatus_FLASH_CommandNotSupported | Flash API is not supported |
kStatus_FLASH_EccError | A correctable or uncorrectable error during command execution. |
kStatus_FLASH_RegulationLoss | A loss of regulation during read. |
status_t FFR_CustomerPagesInit | ( | flash_config_t * | config | ) |
This routine will erase CFPA and program the CFPA page with passed data.
config | A pointer to the storage for the driver runtime state. |
kStatus_FLASH_Success | The desire page-data were programed successfully into CFPA. |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
kStatus_FLASH_FfrBankIsLocked | The FFR bank region is locked. |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
#kStatus_FTFx_AddressError | Address is out of range. |
kStatus_FLASH_ReadHidingAreaDisallowed | Flash hiding read is not allowed |
kStatus_FLASH_CfpaScratchPageInvalid | CFPA Scratch Page is invalid |
kStatus_FLASH_CfpaVersionRollbackDisallowed | CFPA version rollback is not allowed |
kStatus_FLASH_AlignmentError | Parameter is not aligned with the specified baseline |
kStatus_FLASH_EraseKeyError | API erase key is invalid. |
kStatus_FLASH_ModifyProtectedAreaDisallowed | Flash firewall page locked erase and program are not allowed |
kStatus_FLASH_FfrBankIsLocked | The CFPA was locked. |
kStatus_FLASH_OutOfDateCfpaPage | It is not newest CFPA page. |
kStatus_FLASH_CommandFailure | access error. |
kStatus_FLASH_CommandNotSupported | Flash API is not supported |
kStatus_FLASH_EccError | A correctable or uncorrectable error during command execution. |
kStatus_FLASH_RegulationLoss | A loss of regulation during read. |
status_t FFR_InfieldPageWrite | ( | flash_config_t * | config, |
uint8_t * | page_data, | ||
uint32_t | valid_len | ||
) |
This routine will erase CFPA and program the CFPA page with passed data.
config | A pointer to the storage for the driver runtime state. |
page_data | A pointer to the source buffer of data that is to be programmed into the CFPA. |
valid_len | The length, given in bytes, to be programmed. |
kStatus_FLASH_Success | The desire page-data were programed successfully into CFPA. |
kStatus_FLASH_SizeError | Error size |
kStatus_FLASH_ReadHidingAreaDisallowed | Flash hiding read is not allowed |
kStatus_FLASH_AlignmentError | Parameter is not aligned with the specified baseline |
kStatus_FLASH_ModifyProtectedAreaDisallowed | Flash firewall page locked erase and program are not allowed |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
#kStatus_FTFx_AddressError | Address is out of range. |
kStatus_FLASH_FfrBankIsLocked | The CFPA was locked. |
kStatus_FLASH_OutOfDateCfpaPage | It is not newest CFPA page. |
kStatus_FLASH_CommandFailure | access error. |
kStatus_FLASH_CommandNotSupported | Flash API is not supported |
kStatus_FLASH_EccError | A correctable or uncorrectable error during command execution. |
kStatus_FLASH_RegulationLoss | A loss of regulation during read. |
status_t FFR_GetCustomerInfieldData | ( | flash_config_t * | config, |
uint8_t * | pData, | ||
uint32_t | offset, | ||
uint32_t | len | ||
) |
Generic read function, used by customer to read data stored in 'Customer In-field Page'.
config | A pointer to the storage for the driver runtime state. |
pData | A pointer to the dest buffer of data that is to be read from 'Customer In-field Page'. |
offset | An offset from the 'Customer In-field Page' start address. |
len | The length, given in bytes, to be read. |
kStatus_FLASH_Success | Get data from 'Customer In-field Page'. |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
#kStatus_FTFx_AddressError | Address is out of range. |
kStatus_FLASH_AlignmentError | Parameter is not aligned with the specified baseline. |
kStatus_FLASH_ReadHidingAreaDisallowed | Flash hiding read is not allowed |
kStatus_FLASH_CommandFailure | access error. |
kStatus_FLASH_CommandNotSupported | Flash API is not supported |
kStatus_FLASH_EccError | A correctable or uncorrectable error during command execution. |
kStatus_FLASH_RegulationLoss | A loss of regulation during read. |
status_t FFR_CustFactoryPageWrite | ( | flash_config_t * | config, |
uint8_t * | page_data, | ||
bool | seal_part | ||
) |
This routine will erase "customer factory page" and program the page with passed data. If 'seal_part' parameter is TRUE then the routine will compute SHA256 hash of the page contents and then programs the pages. 1.During development customer code uses this API with 'seal_part' set to FALSE. 2.During manufacturing this parameter should be set to TRUE to seal the part from further modifications 3.This routine checks if the page is sealed or not. A page is said to be sealed if the SHA256 value in the page has non-zero value. On boot ROM locks the firewall for the region if hash is programmed anyways. So, write/erase commands will fail eventually.
config | A pointer to the storage for the driver runtime state. |
page_data | A pointer to the source buffer of data that is to be programmed into the "customer factory page". |
seal_part | Set fasle for During development customer code. |
kStatus_FLASH_Success | The desire page-data were programed successfully into CMPA. |
kStatus_FLASH_InvalidArgument | Parameter is not aligned with the specified baseline. |
#kStatus_FTFx_AddressError | Address is out of range. |
kStatus_FLASH_AlignmentError | Parameter is not aligned with the specified baseline. |
kStatus_FLASH_EraseKeyError | API erase key is invalid. |
kStatus_FLASH_ModifyProtectedAreaDisallowed | Flash firewall page locked erase and program are not allowed |
kStatus_Fail | Generic status for Fail. |
kStatus_FLASH_CommandFailure | access error. |
kStatus_FLASH_CommandNotSupported | Flash API is not supported |
kStatus_FLASH_EccError | A correctable or uncorrectable error during command execution. |
kStatus_FLASH_RegulationLoss | A loss of regulation during read. |
status_t FFR_GetCustomerData | ( | flash_config_t * | config, |
uint8_t * | pData, | ||
uint32_t | offset, | ||
uint32_t | len | ||
) |
Read data stored in 'Customer Factory CFG Page'.
config | A pointer to the storage for the driver runtime state. |
pData | A pointer to the dest buffer of data that is to be read from the Customer Factory CFG Page. |
offset | Address offset relative to the CMPA area. |
len | The length, given in bytes to be read. |
kStatus_FLASH_Success | Get data from 'Customer Factory CFG Page'. |
kStatus_FLASH_InvalidArgument | Parameter is not aligned with the specified baseline. |
kStatus_FLASH_AlignmentError | Parameter is not aligned with the specified baseline. |
#kStatus_FTFx_AddressError | Address is out of range. |
kStatus_FLASH_CommandFailure | access error. |
kStatus_FLASH_CommandNotSupported | Flash API is not supported |
kStatus_FLASH_EccError | A correctable or uncorrectable error during command execution. |
kStatus_FLASH_RegulationLoss | A loss of regulation during read. |
kStatus_FLASH_ReadHidingAreaDisallowed | Flash hiding read is not allowed |
status_t FFR_CustKeystoreWrite | ( | flash_config_t * | config, |
ffr_key_store_t * | pKeyStore | ||
) |
This routine writes the 3 pages allocated for Key store data,.
config | A pointer to the storage for the driver runtime state. |
pKeyStore | A pointer to the source buffer of data that is to be programmed into the "Key store". |
kStatus_FLASH_Success | Get data from 'Customer Factory CFG Page'. |
kStatus_FLASH_InvalidArgument | Parameter is not aligned with the specified baseline. |
kStatus_FLASH_CommandFailure | access error. |
kStatus_FLASH_CommandNotSupported | Flash API is not supported |
kStatus_FLASH_EccError | A correctable or uncorrectable error during command execution. |
kStatus_FLASH_RegulationLoss | A loss of regulation during read. |
kStatus_FLASH_SealedFfrRegion | The FFR region is sealed. |
kStatus_FLASH_FfrBankIsLocked | The FFR bank region is locked. |
kStatus_FLASH_AddressError | Address is out of range |
kStatus_FLASH_AlignmentError | Parameter is not aligned with the specified baseline. |
kStatus_FLASH_ModifyProtectedAreaDisallowed | Flash firewall page locked erase and program are not allowed |
1.Used during manufacturing. Should write pages when 'customer factory page' is not in sealed state. 2.Optional routines to set individual data members (activation code, key codes etc) to construct the key store structure in RAM before committing it to IFR/FFR.
config | A pointer to the storage for the driver runtime state. |
pKeyStore | A Pointer to the 3 pages allocated for Key store data. that will be written to 'customer factory page'. |
kStatus_FLASH_Success | The key were programed successfully into FFR. |
kStatus_FLASH_InvalidArgument | Parameter is not aligned with the specified baseline. |
#kStatus_FTFx_AddressError | Address is out of range. |
kStatus_FLASH_CommandFailure | access error. |
kStatus_FLASH_SealedFfrRegion | The FFR region is sealed. |
kStatus_FLASH_AlignmentError | Parameter is not aligned with the specified baseline. |
kStatus_FLASH_AddressError | Address is out of range |
kStatus_FLASH_EraseKeyError | API erase key is invalid. |
kStatus_FLASH_ModifyProtectedAreaDisallowed | Flash firewall page locked erase and program are not allowed |
kStatus_FLASH_CommandNotSupported | Flash API is not supported |
kStatus_FLASH_RegulationLoss | A loss of regulation during read. |
status_t FFR_GetUUID | ( | flash_config_t * | config, |
uint8_t * | uuid | ||
) |
1.SW should use this API routine to get the UUID of the chip. 2.Calling routine should pass a pointer to buffer which can hold 128-bit value.
kStatus_FLASH_Success | Get data from 'Customer Factory CFG Page'. |
kStatus_FLASH_InvalidArgument | Parameter is not aligned with the specified baseline. |
kStatus_FLASH_ReadHidingAreaDisallowed | Flash hiding read is not allowed |
kStatus_FLASH_CommandFailure | Run-time error during command execution. |
kStatus_FLASH_CommandNotSupported | Flash API is not supported |
kStatus_FLASH_RegulationLoss | A loss of regulation during read. |