![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
Files | |
file | fsl_flash.h |
Data Structures | |
struct | flash_ecc_log_t |
Flash ECC log info. More... | |
struct | flash_mode_config_t |
Flash controller paramter config. More... | |
struct | flash_ffr_config_t |
Flash controller paramter config. More... | |
struct | flash_config_t |
Flash driver state information. More... | |
Flash version | |
enum | _flash_driver_version_constants { kFLASH_DriverVersionName = 'F', kFLASH_DriverVersionMajor = 1, kFLASH_DriverVersionMinor = 0, kFLASH_DriverVersionBugfix = 1 } |
Flash driver version for ROM. More... | |
#define | MAKE_VERSION(major, minor, bugfix) (((major) << 16) | ((minor) << 8) | (bugfix)) |
Constructs the version number for drivers. More... | |
#define | FSL_FLASH_DRIVER_VERSION (MAKE_VERSION(1, 0, 1)) |
Flash driver version for SDK. More... | |
Flash driver support feature | |
#define | FSL_SUPPORT_ERASE_SECTOR_NON_BLOCKING 1U |
IAP driver support non-block erase function. | |
#define | FSL_FEATURE_SYSCON_HAS_FLASH_HIDING 1U |
#define | FSL_FEATURE_SYSCON_HAS_CDPA 1U |
Flash API key | |
enum | _flash_driver_api_keys { kFLASH_ApiEraseKey = FOUR_CHAR_CODE('l', 'f', 'e', 'k') } |
Enumeration for Flash driver API keys. More... | |
#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... | |
Initialization | |
status_t | FLASH_Init (flash_config_t *config) |
Initializes the global flash properties structure members. More... | |
Erasing | |
status_t | FLASH_Erase (flash_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 | FLASH_EraseNonBlocking (flash_config_t *config, uint32_t start, uint32_t lengthInBytes, uint32_t key) |
Non-blocking Erases the flash sectors encompassed by parameters passed into function. More... | |
Programming | |
status_t | FLASH_Program (flash_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes) |
Programs flash with data at locations passed in through parameters. More... | |
Reading | |
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... | |
Verification | |
status_t | FLASH_VerifyErase (flash_config_t *config, uint32_t start, uint32_t lengthInBytes) |
Verifies an erasure of the desired flash area at a specified margin level. More... | |
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 at a specified margin level. More... | |
Properties | |
status_t | FLASH_GetProperty (flash_config_t *config, flash_property_tag_t whichProperty, uint32_t *value) |
Returns the desired flash property. More... | |
command status | |
status_t | FLASH_GetCommandState (flash_config_t *config) |
Get flash command execute status. More... | |
struct flash_ecc_log_t |
struct flash_mode_config_t |
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 |
#define MAKE_VERSION | ( | major, | |
minor, | |||
bugfix | |||
) | (((major) << 16) | ((minor) << 8) | (bugfix)) |
#define FSL_FLASH_DRIVER_VERSION (MAKE_VERSION(1, 0, 1)) |
Version 1.0.1.
#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))) |
anonymous enum |
enum flash_property_tag_t |
status_t FLASH_Init | ( | flash_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_FLASH_Success | API was executed successfully. |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
kStatus_FLASH_CommandFailure | Run-time error during the command execution. |
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 FLASH_Erase | ( | flash_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. 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. |
kStatus_FLASH_Success | API was executed successfully. |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
kStatus_FLASH_AlignmentError | The parameter is not aligned with the specified baseline. |
kStatus_FLASH_AddressError | The address is out of range. |
kStatus_FLASH_EraseKeyError | The API erase key is invalid. |
kStatus_FLASH_ModifyProtectedAreaDisallowed | Flash firewall page locked erase and program are not allowed |
kStatus_FLASH_CommandFailure | Run-time error during the command execution. |
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 FLASH_EraseNonBlocking | ( | flash_config_t * | config, |
uint32_t | start, | ||
uint32_t | lengthInBytes, | ||
uint32_t | key | ||
) |
This is a non-blocking function, which returns right away. This function erases the appropriate number of flash sectors based on the desired start address and length, and get the command execute status from the "FLASH_GetCommandState".
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 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. |
kStatus_FLASH_Success | API was executed successfully. |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
kStatus_FLASH_AlignmentError | The parameter is not aligned with the specified baseline. |
kStatus_FLASH_AddressError | The address is out of range. |
kStatus_FLASH_EraseKeyError | The API erase key is invalid. |
kStatus_FLASH_ModifyProtectedAreaDisallowed | Flash firewall page locked erase and program are not allowed |
status_t FLASH_Program | ( | flash_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_FLASH_Success | API was executed successfully. |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
kStatus_FLASH_AlignmentError | Parameter is not aligned with the specified baseline. |
kStatus_FLASH_AddressError | Address is out of range. |
kStatus_FLASH_AccessError | Invalid instruction codes and out-of bounds addresses. |
kStatus_FLASH_ModifyProtectedAreaDisallowed | Flash firewall page locked erase and program are not allowed |
kStatus_FLASH_CommandFailure | Run-time error during the command execution. |
kStatus_FLASH_CommandNotSupported | Flash API is not supported. |
kStatus_FLASH_RegulationLoss | A loss of regulation during read. |
kStatus_FLASH_EccError | A correctable or uncorrectable error during command execution. |
status_t FLASH_Read | ( | flash_config_t * | config, |
uint32_t | start, | ||
uint8_t * | dest, | ||
uint32_t | lengthInBytes | ||
) |
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. |
kStatus_FLASH_Success | API was executed successfully. |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
kStatus_FLASH_AlignmentError | Parameter is not aligned with the specified baseline. |
kStatus_FLASH_AddressError | Address is out of range. |
kStatus_FLASH_ReadHidingAreaDisallowed | Flash hiding read is not allowed |
kStatus_FLASH_CommandFailure | Run-time error during the command execution. |
kStatus_FLASH_CommandNotSupported | Flash API is not supported. |
kStatus_FLASH_RegulationLoss | A loss of regulation during read. |
kStatus_FLASH_EccError | A correctable or uncorrectable error during command execution. |
status_t FLASH_VerifyErase | ( | flash_config_t * | config, |
uint32_t | start, | ||
uint32_t | lengthInBytes | ||
) |
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_FLASH_Success | API was executed successfully. |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
kStatus_FLASH_AlignmentError | Parameter is not aligned with specified baseline. |
kStatus_FLASH_AddressError | Address is out of range. |
kStatus_FLASH_CommandFailure | Run-time error during the command execution. |
kStatus_FLASH_CommandFailure | Run-time error during the command execution. |
kStatus_FLASH_CommandNotSupported | Flash API is not supported. |
kStatus_FLASH_RegulationLoss | A loss of regulation during read. |
kStatus_FLASH_EccError | A correctable or uncorrectable error during command execution. |
status_t FLASH_VerifyProgram | ( | flash_config_t * | config, |
uint32_t | start, | ||
uint32_t | lengthInBytes, | ||
const uint8_t * | expectedData, | ||
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_FLASH_Success | API was executed successfully. |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
kStatus_FLASH_AlignmentError | Parameter is not aligned with specified baseline. |
kStatus_FLASH_AddressError | Address is out of range. |
kStatus_FLASH_AccessError | Invalid instruction codes and out-of bounds addresses. |
kStatus_FLASH_ReadHidingAreaDisallowed | Flash hiding read is not allowed |
kStatus_FLASH_CommandFailure | Run-time error during the command execution. |
kStatus_FLASH_CommandNotSupported | Flash API is not supported. |
kStatus_FLASH_RegulationLoss | A loss of regulation during read. |
kStatus_FLASH_EccError | A correctable or uncorrectable error during command execution. |
status_t FLASH_GetProperty | ( | flash_config_t * | config, |
flash_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 flash_property_tag_t |
value | A pointer to the value returned for the desired flash property. |
kStatus_FLASH_Success | API was executed successfully. |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
kStatus_FLASH_UnknownProperty | An unknown property tag. |
status_t FLASH_IsFlashAreaReadable | ( | flash_config_t * | config, |
uint32_t | startAddress, | ||
uint32_t | lengthInBytes | ||
) |
config | A pointer to the storage for the driver runtime state. |
startAddress | The start address of the desired flash memory to be verified. |
lengthInBytes | The length, given in bytes (not words or long-words), to be verified. |
kStatus_FLASH_Success | API was executed successfully. |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
kStatus_FLASH_ReadHidingAreaDisallowed | Flash hiding read is not allowed. |
status_t FLASH_IsFlashAreaModifiable | ( | flash_config_t * | config, |
uint32_t | startAddress, | ||
uint32_t | lengthInBytes | ||
) |
config | A pointer to the storage for the driver runtime state. |
startAddress | The start address of the desired flash memory to be verified. |
lengthInBytes | The length, given in bytes (not words or long-words), to be verified. |
kStatus_FLASH_Success | API was executed successfully. |
kStatus_FLASH_InvalidArgument | An invalid argument is provided. |
kStatus_FLASH_ModifyProtectedAreaDisallowed | Flash hiding read is not allowed. |
status_t FLASH_GetCommandState | ( | flash_config_t * | config | ) |
This function is used to obtain the status after the command "FLASH_EraseNonBlocking" is executed.
config | A pointer to the storage for the driver runtime state. |
kStatus_FLASH_CommandOperationInProgress | Indicate that a flash command in progress. |
kStatus_FLASH_CommandFailure | Run-time error during the command execution. |
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_Success | API was executed successfully. |