![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
Files | |
file | fsl_iap_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 = 0, kFfrPageOffset_CFPA_Scratch = 0, kFfrPageOffset_CFPA_Cfg = 1, kFfrPageOffset_CFPA_CfgPong = 2, kFfrPageOffset_CMPA = 3, kFfrPageOffset_CMPA_Cfg = 3, kFfrPageOffset_CMPA_Key = 4, kFfrPageOffset_NMPA = 7, kFfrPageOffset_NMPA_Romcp = 7, kFfrPageOffset_NMPA_Repair = 9, kFfrPageOffset_NMPA_Cfg = 15, kFfrPageOffset_NMPA_End = 16 } |
flash ffr page offset. More... | |
enum | _flash_ffr_page_num { kFfrPageNum_CFPA = 3, kFfrPageNum_CMPA = 4, kFfrPageNum_NMPA = 10 } |
flash ffr page number. More... | |
Flash IFR version | |
#define | FSL_FLASH_IFR_DRIVER_VERSION (MAKE_VERSION(2, 1, 0)) |
Flash IFR driver version for SDK. More... | |
FFR APIs | |
status_t | FFR_Init (flash_config_t *config) |
Initializes the global FFR properties structure members. More... | |
status_t | FFR_Lock_All (flash_config_t *config) |
Enable firewall for all flash banks. 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_GetUUID (flash_config_t *config, uint8_t *uuid) |
APIs to access CMPA page. More... | |
status_t | FFR_KeystoreWrite (flash_config_t *config, ffr_key_store_t *pKeyStore) |
This routine writes the 3 pages allocated for Key store data,. More... | |
status_t | FFR_KeystoreGetAC (flash_config_t *config, uint8_t *pActivationCode) |
Get/Read Key store code routines. More... | |
status_t | FFR_KeystoreGetKC (flash_config_t *config, uint8_t *pKeyCode, ffr_key_type_t keyIndex) |
Get/Read Key store code routines. More... | |
#define FSL_FLASH_IFR_DRIVER_VERSION (MAKE_VERSION(2, 1, 0)) |
Version 2.1.0.
#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. |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
status_t FFR_Lock_All | ( | 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. |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
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_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. |
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_CommandFailure | access error. |
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_CommandFailure | access error. |
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_FTFx_AddressError | Address is out of range. |
kStatus_FLASH_CommandFailure | access error. |
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.
status_t FFR_KeystoreWrite | ( | flash_config_t * | config, |
ffr_key_store_t * | pKeyStore | ||
) |
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. |
status_t FFR_KeystoreGetAC | ( | flash_config_t * | config, |
uint8_t * | pActivationCode | ||
) |
status_t FFR_KeystoreGetKC | ( | flash_config_t * | config, |
uint8_t * | pKeyCode, | ||
ffr_key_type_t | keyIndex | ||
) |