![]() |
MCUXpresso SDK API Reference Manual
Rev 2.16.000
NXP Semiconductors
|
The ROMAPI driver provides the functionalities to operate the internal Flash.
The ROMAPI driver provides the functionalities to operate the Flash and ROM.
Data Structures | |
struct | flash_ffr_config_t |
Flash controller paramter config. More... | |
struct | flash_config_t |
Flash driver state information. More... | |
struct | flash_driver_interface_t |
Interface for the flash driver. More... | |
struct | bootloader_tree_t |
Root of the bootloader API tree. More... | |
Macros | |
#define | FOUR_CHAR_CODE(a, b, c, d) (((d) << 24) | ((c) << 16) | ((b) << 8) | ((a))) |
Constructs the four character code for the Flash driver API key. More... | |
#define | ROM_API_BASE (0x03003fe0u) |
#define | ROM_API ((bootloader_tree_t *)ROM_API_BASE) |
#define | FLASH_API (ROM_API->flash_driver) |
Enumerations | |
enum | flash_property_tag_t { kFLASH_PropertyPflashSectorSize = 0x00U, kFLASH_PropertyPflashTotalSize = 0x01U, kFLASH_PropertyPflashBlockSize = 0x02U, kFLASH_PropertyPflashBlockCount = 0x03U, kFLASH_PropertyPflashBlockBaseAddr = 0x04U, kFLASH_PropertyPflashPageSize = 0x30U, kFLASH_PropertyPflashSystemFreq = 0x31U, kFLASH_PropertyFfrSectorSize = 0x40U, kFLASH_PropertyFfrTotalSize = 0x41U, kFLASH_PropertyFfrBlockBaseAddr = 0x42U, kFLASH_PropertyFfrPageSize = 0x43U } |
Enumeration for various flash properties. More... | |
enum | _flash_driver_api_keys { kFLASH_ApiEraseKey = FOUR_CHAR_CODE('l', 'f', 'e', 'k') } |
Enumeration for Flash driver API keys. More... | |
Driver version | |
#define | FSL_ROMAPI_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
romapi driver version 2.0.0. More... | |
Flash status | |
enum | { kStatus_FLASH_Success = MAKE_STATUS(kStatusGroupGeneric, 0), kStatus_FLASH_InvalidArgument = MAKE_STATUS(kStatusGroupGeneric, 4), kStatus_FLASH_SizeError = MAKE_STATUS(kStatusGroupFlashDriver, 0), kStatus_FLASH_AlignmentError, kStatus_FLASH_AddressError = MAKE_STATUS(kStatusGroupFlashDriver, 2), kStatus_FLASH_AccessError, kStatus_FLASH_ProtectionViolation, kStatus_FLASH_CommandFailure, kStatus_FLASH_UnknownProperty = MAKE_STATUS(kStatusGroupFlashDriver, 6), kStatus_FLASH_EraseKeyError = MAKE_STATUS(kStatusGroupFlashDriver, 7) } |
Flash driver status codes. More... | |
#define | kStatusGroupGeneric 0 |
Flash driver status group. More... | |
#define | kStatusGroupFlashDriver 1 |
#define | MAKE_STATUS(group, code) ((((group) * 100) + (code))) |
Constructs a status code value from a group and a code number. More... | |
Flash API | |
static status_t | FLASH_Init (flash_config_t *config) |
Initializes the global flash properties structure members. More... | |
static status_t | FLASH_EraseSector (flash_config_t *config, uint32_t start, uint32_t lengthInBytes, uint32_t key) |
Erases the flash sectors encompassed by parameters passed into function. More... | |
static status_t | FLASH_ProgramPhrase (flash_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes) |
Programs flash phrases with data at locations passed in through parameters. More... | |
static status_t | FLASH_ProgramPage (flash_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes) |
Programs flash page with data at locations passed in through parameters. More... | |
static status_t | FLASH_VerifyProgram (flash_config_t *config, uint32_t start, uint32_t lengthInBytes, const uint8_t *expectedData, uint32_t *failedAddress, uint32_t *failedData) |
Verifies programming of the desired flash area. More... | |
static status_t | FLASH_VerifyErasePhrase (flash_config_t *config, uint32_t start, uint32_t lengthInBytes) |
Verify that the flash phrases are erased. More... | |
static status_t | FLASH_VerifyErasePage (flash_config_t *config, uint32_t start, uint32_t lengthInBytes) |
Verify that the flash pages are erased. More... | |
static status_t | FLASH_VerifyEraseSector (flash_config_t *config, uint32_t start, uint32_t lengthInBytes) |
Verify that the flash sectors are erased. More... | |
static status_t | FLASH_GetProperty (flash_config_t *config, flash_property_tag_t whichProperty, uint32_t *value) |
Returns the desired flash property. More... | |
static status_t | IFR_VerifyErasePhrase (flash_config_t *config, uint32_t start, uint32_t lengthInBytes) |
Verify that the IFR0 phrases are erased. More... | |
static status_t | IFR_VerifyErasePage (flash_config_t *config, uint32_t start, uint32_t lengthInBytes) |
Verify that the IFR0 pages are erased. More... | |
static status_t | IFR_VerifyEraseSector (flash_config_t *config, uint32_t start, uint32_t lengthInBytes) |
Verify that the IFR0 sectors are erased. More... | |
static status_t | FLASH_Read (flash_config_t *config, uint32_t start, uint8_t *dest, uint32_t lengthInBytes) |
Reads flash at locations passed in through parameters. More... | |
static uint32_t | ROMAPI_GetVersion (void) |
Get ROM API version. More... | |
static void | ROMAPI_RunBootloader (void *arg) |
Run the Bootloader API to force into the ISP mode base on the user arg. More... | |
static void | ROMAPI_GetUUID (uint8_t *uuid) |
Get the UUID. More... | |
struct flash_ffr_config_t |
struct flash_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 | PFlashBlockBase |
A base address of the first PFlash block. | |
uint32_t | PFlashTotalSize |
The size of the combined PFlash block. More... | |
uint32_t | PFlashBlockCount |
A number of PFlash blocks. More... | |
uint32_t | PFlashPageSize |
The size in bytes of a page of PFlash. More... | |
uint32_t | PFlashSectorSize |
The size in bytes of a sector of PFlash. More... | |
uint32_t flash_config_t::PFlashTotalSize |
uint32_t flash_config_t::PFlashBlockCount |
uint32_t flash_config_t::PFlashPageSize |
uint32_t flash_config_t::PFlashSectorSize |
struct flash_driver_interface_t |
struct bootloader_tree_t |
An instance of this struct resides in read-only memory in the bootloader. It provides a user application access to APIs exported by the bootloader.
Data Fields | |
void(* | run_bootloader )(void *arg) |
Function to start the bootloader executing. More... | |
const flash_driver_interface_t * | flash_driver |
Internal Flash driver API. More... | |
void(* bootloader_tree_t::run_bootloader)(void *arg) |
const flash_driver_interface_t* bootloader_tree_t::flash_driver |
#define FSL_ROMAPI_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
#define kStatusGroupGeneric 0 |
#define MAKE_STATUS | ( | group, | |
code | |||
) | ((((group) * 100) + (code))) |
#define FOUR_CHAR_CODE | ( | a, | |
b, | |||
c, | |||
d | |||
) | (((d) << 24) | ((c) << 16) | ((b) << 8) | ((a))) |
#define ROM_API_BASE (0x03003fe0u) |
ROM API base address
#define ROM_API ((bootloader_tree_t *)ROM_API_BASE) |
ROM API base pointer
#define FLASH_API (ROM_API->flash_driver) |
FLASH API base pointer
anonymous enum |
enum flash_property_tag_t |
|
inlinestatic |
This function checks and initializes the Flash module for the other Flash APIs.
config | Pointer to the storage for the driver runtime state. |
|
inlinestatic |
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. NOTE: The start address need to be 4 Bytes-aligned. |
lengthInBytes | The length, given in bytes need be 4 Bytes-aligned. |
key | The value used to validate all flash erase APIs. |
|
inlinestatic |
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. |
|
inlinestatic |
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. |
|
inlinestatic |
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. |
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. |
|
inlinestatic |
This function checks the appropriate number of flash sectors based on the desired start address and length to check whether the flash is erased
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. |
|
inlinestatic |
This function checks the appropriate number of flash sectors based on the desired start address and length to check whether the flash is erased
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. |
|
inlinestatic |
This function checks the appropriate number of flash sectors based on the desired start address and length to check whether the flash is erased
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. |
|
inlinestatic |
config | A pointer to the storage for the driver runtime state. |
whichProperty | The desired property from the list of properties in enum flash_property_tag_t |
value | A pointer to the value returned for the desired flash property. |
|
inlinestatic |
This function checks the appropriate number of flash sectors based on the desired start address and length to check whether the flash is erased
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. |
|
inlinestatic |
This function checks the appropriate number of flash sectors based on the desired start address and length to check whether the flash is erased
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. |
|
inlinestatic |
This function checks the appropriate number of flash sectors based on the desired start address and length to check whether the flash is erased
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. |
|
inlinestatic |
This function read the flash memory from 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 read. |
dest | A pointer to the dest buffer of data that is to be read from the flash. |
lengthInBytes | The length, given in bytes (not words or long-words), to be read. |
|
inlinestatic |
This function read the ROM API version.
|
inlinestatic |
arg | Indicates API prototype fields definition. Refer to the above #user_app_boot_invoke_option_t structure |
|
inlinestatic |
uuid | UUID data array |