The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
Diff: TARGET_USENSE/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/drivers/fsl_flash.h
- Revision:
- 167:84c0a372a020
- Parent:
- 145:64910690c574
diff -r 5aab5a7997ee -r 84c0a372a020 TARGET_USENSE/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/drivers/fsl_flash.h --- a/TARGET_USENSE/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/drivers/fsl_flash.h Fri Apr 20 11:08:29 2018 +0100 +++ b/TARGET_USENSE/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/drivers/fsl_flash.h Fri May 11 16:51:14 2018 +0100 @@ -53,20 +53,20 @@ * @name Flash version * @{ */ -/*! @brief Construct the version number for drivers. */ +/*! @brief Constructs the version number for drivers. */ #if !defined(MAKE_VERSION) #define MAKE_VERSION(major, minor, bugfix) (((major) << 16) | ((minor) << 8) | (bugfix)) #endif -/*! @brief FLASH driver version for SDK*/ -#define FSL_FLASH_DRIVER_VERSION (MAKE_VERSION(2, 1, 0)) /*!< Version 2.1.0. */ +/*! @brief Flash driver version for SDK*/ +#define FSL_FLASH_DRIVER_VERSION (MAKE_VERSION(2, 2, 0)) /*!< Version 2.2.0. */ -/*! @brief FLASH driver version for ROM*/ +/*! @brief Flash driver version for ROM*/ enum _flash_driver_version_constants { kFLASH_DriverVersionName = 'F', /*!< Flash driver version name.*/ kFLASH_DriverVersionMajor = 2, /*!< Major flash driver version.*/ - kFLASH_DriverVersionMinor = 1, /*!< Minor flash driver version.*/ + kFLASH_DriverVersionMinor = 2, /*!< Minor flash driver version.*/ kFLASH_DriverVersionBugfix = 0 /*!< Bugfix for flash driver version.*/ }; /*@}*/ @@ -75,29 +75,50 @@ * @name Flash configuration * @{ */ -/*! @brief Whether to support FlexNVM in flash driver */ +/*! @brief Indicates whether to support FlexNVM in the Flash driver */ #if !defined(FLASH_SSD_CONFIG_ENABLE_FLEXNVM_SUPPORT) -#define FLASH_SSD_CONFIG_ENABLE_FLEXNVM_SUPPORT 1 /*!< Enable FlexNVM support by default. */ +#define FLASH_SSD_CONFIG_ENABLE_FLEXNVM_SUPPORT 1 /*!< Enables the FlexNVM support by default. */ #endif -/*! @brief Whether the FlexNVM is enabled in flash driver */ +/*! @brief Indicates whether the FlexNVM is enabled in the Flash driver */ #define FLASH_SSD_IS_FLEXNVM_ENABLED (FLASH_SSD_CONFIG_ENABLE_FLEXNVM_SUPPORT && FSL_FEATURE_FLASH_HAS_FLEX_NVM) +/*! @brief Indicates whether the secondary flash is supported in the Flash driver */ +#if defined(FSL_FEATURE_FLASH_HAS_MULTIPLE_FLASH) || defined(FSL_FEATURE_FLASH_PFLASH_1_START_ADDRESS) +#define FLASH_SSD_IS_SECONDARY_FLASH_SUPPORTED (1) +#else +#define FLASH_SSD_IS_SECONDARY_FLASH_SUPPORTED (0) +#endif + +/*! @brief Indicates whether the secondary flash has its own protection register in flash module */ +#if defined(FSL_FEATURE_FLASH_HAS_MULTIPLE_FLASH) && defined(FTFE_FPROTS_PROTS_MASK) +#define FLASH_SSD_SECONDARY_FLASH_HAS_ITS_OWN_PROTECTION_REGISTER (1) +#else +#define FLASH_SSD_SECONDARY_FLASH_HAS_ITS_OWN_PROTECTION_REGISTER (0) +#endif + +/*! @brief Indicates whether the secondary flash has its own Execute-Only access register in flash module */ +#if defined(FSL_FEATURE_FLASH_HAS_MULTIPLE_FLASH) && defined(FTFE_FACSSS_SGSIZE_S_MASK) +#define FLASH_SSD_SECONDARY_FLASH_HAS_ITS_OWN_ACCESS_REGISTER (1) +#else +#define FLASH_SSD_SECONDARY_FLASH_HAS_ITS_OWN_ACCESS_REGISTER (0) +#endif + /*! @brief Flash driver location. */ #if !defined(FLASH_DRIVER_IS_FLASH_RESIDENT) #if (!defined(BL_TARGET_ROM) && !defined(BL_TARGET_RAM)) -#define FLASH_DRIVER_IS_FLASH_RESIDENT 1 /*!< Used for flash resident application. */ +#define FLASH_DRIVER_IS_FLASH_RESIDENT 1 /*!< Used for the flash resident application. */ #else -#define FLASH_DRIVER_IS_FLASH_RESIDENT 0 /*!< Used for non-flash resident application. */ +#define FLASH_DRIVER_IS_FLASH_RESIDENT 0 /*!< Used for the non-flash resident application. */ #endif #endif /*! @brief Flash Driver Export option */ #if !defined(FLASH_DRIVER_IS_EXPORTED) #if (defined(BL_TARGET_ROM) || defined(BL_TARGET_FLASH)) -#define FLASH_DRIVER_IS_EXPORTED 1 /*!< Used for ROM bootloader. */ +#define FLASH_DRIVER_IS_EXPORTED 1 /*!< Used for the ROM bootloader. */ #else -#define FLASH_DRIVER_IS_EXPORTED 0 /*!< Used for SDK application. */ +#define FLASH_DRIVER_IS_EXPORTED 0 /*!< Used for the KSDK application. */ #endif #endif /*@}*/ @@ -118,7 +139,7 @@ #define kStatusGroupFlashDriver 1 #endif -/*! @brief Construct a status code value from a group and code number. */ +/*! @brief Constructs a status code value from a group and a code number. */ #if !defined(MAKE_STATUS) #define MAKE_STATUS(group, code) ((((group)*100) + (code))) #endif @@ -132,33 +153,39 @@ kStatus_FLASH_InvalidArgument = MAKE_STATUS(kStatusGroupGeneric, 4), /*!< Invalid argument*/ kStatus_FLASH_SizeError = MAKE_STATUS(kStatusGroupFlashDriver, 0), /*!< Error size*/ kStatus_FLASH_AlignmentError = - MAKE_STATUS(kStatusGroupFlashDriver, 1), /*!< Parameter is not aligned with specified baseline*/ + MAKE_STATUS(kStatusGroupFlashDriver, 1), /*!< Parameter is not aligned with the specified baseline*/ kStatus_FLASH_AddressError = MAKE_STATUS(kStatusGroupFlashDriver, 2), /*!< Address is out of range */ kStatus_FLASH_AccessError = - MAKE_STATUS(kStatusGroupFlashDriver, 3), /*!< Invalid instruction codes and out-of bounds addresses */ + MAKE_STATUS(kStatusGroupFlashDriver, 3), /*!< Invalid instruction codes and out-of bound addresses */ kStatus_FLASH_ProtectionViolation = MAKE_STATUS( kStatusGroupFlashDriver, 4), /*!< The program/erase operation is requested to execute on protected areas */ kStatus_FLASH_CommandFailure = MAKE_STATUS(kStatusGroupFlashDriver, 5), /*!< Run-time error during command execution. */ - kStatus_FLASH_UnknownProperty = MAKE_STATUS(kStatusGroupFlashDriver, 6), /*!< Unknown property.*/ - kStatus_FLASH_EraseKeyError = MAKE_STATUS(kStatusGroupFlashDriver, 7), /*!< API erase key is invalid.*/ - kStatus_FLASH_RegionExecuteOnly = MAKE_STATUS(kStatusGroupFlashDriver, 8), /*!< Current region is execute only.*/ + kStatus_FLASH_UnknownProperty = MAKE_STATUS(kStatusGroupFlashDriver, 6), /*!< Unknown property.*/ + kStatus_FLASH_EraseKeyError = MAKE_STATUS(kStatusGroupFlashDriver, 7), /*!< API erase key is invalid.*/ + kStatus_FLASH_RegionExecuteOnly = + MAKE_STATUS(kStatusGroupFlashDriver, 8), /*!< The current region is execute-only.*/ kStatus_FLASH_ExecuteInRamFunctionNotReady = MAKE_STATUS(kStatusGroupFlashDriver, 9), /*!< Execute-in-RAM function is not available.*/ kStatus_FLASH_PartitionStatusUpdateFailure = MAKE_STATUS(kStatusGroupFlashDriver, 10), /*!< Failed to update partition status.*/ kStatus_FLASH_SetFlexramAsEepromError = - MAKE_STATUS(kStatusGroupFlashDriver, 11), /*!< Failed to set flexram as eeprom.*/ + MAKE_STATUS(kStatusGroupFlashDriver, 11), /*!< Failed to set FlexRAM as EEPROM.*/ kStatus_FLASH_RecoverFlexramAsRamError = - MAKE_STATUS(kStatusGroupFlashDriver, 12), /*!< Failed to recover flexram as RAM.*/ - kStatus_FLASH_SetFlexramAsRamError = MAKE_STATUS(kStatusGroupFlashDriver, 13), /*!< Failed to set flexram as RAM.*/ + MAKE_STATUS(kStatusGroupFlashDriver, 12), /*!< Failed to recover FlexRAM as RAM.*/ + kStatus_FLASH_SetFlexramAsRamError = MAKE_STATUS(kStatusGroupFlashDriver, 13), /*!< Failed to set FlexRAM as RAM.*/ kStatus_FLASH_RecoverFlexramAsEepromError = - MAKE_STATUS(kStatusGroupFlashDriver, 14), /*!< Failed to recover flexram as eeprom.*/ + MAKE_STATUS(kStatusGroupFlashDriver, 14), /*!< Failed to recover FlexRAM as EEPROM.*/ kStatus_FLASH_CommandNotSupported = MAKE_STATUS(kStatusGroupFlashDriver, 15), /*!< Flash API is not supported.*/ kStatus_FLASH_SwapSystemNotInUninitialized = - MAKE_STATUS(kStatusGroupFlashDriver, 16), /*!< Swap system is not in uninitialzed state.*/ + MAKE_STATUS(kStatusGroupFlashDriver, 16), /*!< Swap system is not in an uninitialzed state.*/ kStatus_FLASH_SwapIndicatorAddressError = - MAKE_STATUS(kStatusGroupFlashDriver, 17), /*!< Swap indicator address is invalid.*/ + MAKE_STATUS(kStatusGroupFlashDriver, 17), /*!< The swap indicator address is invalid.*/ + kStatus_FLASH_ReadOnlyProperty = MAKE_STATUS(kStatusGroupFlashDriver, 18), /*!< The flash property is read-only.*/ + kStatus_FLASH_InvalidPropertyValue = + MAKE_STATUS(kStatusGroupFlashDriver, 19), /*!< The flash property value is out of range.*/ + kStatus_FLASH_InvalidSpeculationOption = + MAKE_STATUS(kStatusGroupFlashDriver, 20), /*!< The option of flash prefetch speculation is invalid.*/ }; /*@}*/ @@ -166,13 +193,13 @@ * @name Flash API key * @{ */ -/*! @brief Construct the four char code for flash driver API key. */ +/*! @brief Constructs the four character code for the Flash driver API key. */ #if !defined(FOUR_CHAR_CODE) #define FOUR_CHAR_CODE(a, b, c, d) (((d) << 24) | ((c) << 16) | ((b) << 8) | ((a))) #endif /*! - * @brief Enumeration for flash driver API keys. + * @brief Enumeration for Flash driver API keys. * * @note The resulting value is built with a byte order such that the string * being readable in expected order when viewed in a hex editor, if the value @@ -220,9 +247,9 @@ */ typedef enum _flash_execute_only_access_state { - kFLASH_AccessStateUnLimited, /*!< Flash region is unLimited.*/ + kFLASH_AccessStateUnLimited, /*!< Flash region is unlimited.*/ kFLASH_AccessStateExecuteOnly, /*!< Flash region is execute only.*/ - kFLASH_AccessStateMixed /*!< Flash is mixed with unLimited and execute only region.*/ + kFLASH_AccessStateMixed /*!< Flash is mixed with unlimited and execute only region.*/ } flash_execute_only_access_state_t; /*! @@ -242,10 +269,11 @@ kFLASH_PropertyFlexRamTotalSize = 0x09U, /*!< FlexRam total size property.*/ kFLASH_PropertyDflashSectorSize = 0x10U, /*!< Dflash sector size property.*/ kFLASH_PropertyDflashTotalSize = 0x11U, /*!< Dflash total size property.*/ - kFLASH_PropertyDflashBlockSize = 0x12U, /*!< Dflash block count property.*/ - kFLASH_PropertyDflashBlockCount = 0x13U, /*!< Dflash block base address property.*/ - kFLASH_PropertyDflashBlockBaseAddr = 0x14U, /*!< Eeprom total size property.*/ - kFLASH_PropertyEepromTotalSize = 0x15U + kFLASH_PropertyDflashBlockSize = 0x12U, /*!< Dflash block size property.*/ + kFLASH_PropertyDflashBlockCount = 0x13U, /*!< Dflash block count property.*/ + kFLASH_PropertyDflashBlockBaseAddr = 0x14U, /*!< Dflash block base address property.*/ + kFLASH_PropertyEepromTotalSize = 0x15U, /*!< EEPROM total size property.*/ + kFLASH_PropertyFlashMemoryIndex = 0x20U /*!< Flash memory index property.*/ } flash_property_tag_t; /*! @@ -253,7 +281,7 @@ */ enum _flash_execute_in_ram_function_constants { - kFLASH_ExecuteInRamFunctionMaxSizeInWords = 16U, /*!< Max size of execute-in-RAM function.*/ + kFLASH_ExecuteInRamFunctionMaxSizeInWords = 16U, /*!< The maximum size of execute-in-RAM function.*/ kFLASH_ExecuteInRamFunctionTotalNum = 2U /*!< Total number of execute-in-RAM functions.*/ }; @@ -262,9 +290,9 @@ */ typedef struct _flash_execute_in_ram_function_config { - uint32_t activeFunctionCount; /*!< Number of available execute-in-RAM functions.*/ - uint32_t *flashRunCommand; /*!< execute-in-RAM function: flash_run_command.*/ - uint32_t *flashCacheClearCommand; /*!< execute-in-RAM function: flash_cache_clear_command.*/ + uint32_t activeFunctionCount; /*!< Number of available execute-in-RAM functions.*/ + uint32_t *flashRunCommand; /*!< Execute-in-RAM function: flash_run_command.*/ + uint32_t *flashCommonBitOperation; /*!< Execute-in-RAM function: flash_common_bit_operation.*/ } flash_execute_in_ram_function_config_t; /*! @@ -274,7 +302,7 @@ { kFLASH_ResourceOptionFlashIfr = 0x00U, /*!< Select code for Program flash 0 IFR, Program flash swap 0 IFR, Data flash 0 IFR */ - kFLASH_ResourceOptionVersionId = 0x01U /*!< Select code for Version ID*/ + kFLASH_ResourceOptionVersionId = 0x01U /*!< Select code for the version ID*/ } flash_read_resource_option_t; /*! @@ -312,12 +340,12 @@ }; /*! - * @brief Enumeration for the two possilbe options of set flexram function command. + * @brief Enumeration for the two possilbe options of set FlexRAM function command. */ typedef enum _flash_flexram_function_option { - kFLASH_FlexramFunctionOptionAvailableAsRam = 0xFFU, /*!< Option used to make FlexRAM available as RAM */ - kFLASH_FlexramFunctionOptionAvailableForEeprom = 0x00U /*!< Option used to make FlexRAM available for EEPROM */ + kFLASH_FlexramFunctionOptionAvailableAsRam = 0xFFU, /*!< An option used to make FlexRAM available as RAM */ + kFLASH_FlexramFunctionOptionAvailableForEeprom = 0x00U /*!< An option used to make FlexRAM available for EEPROM */ } flash_flexram_function_option_t; /*! @@ -333,37 +361,37 @@ */ typedef enum _flash_swap_function_option { - kFLASH_SwapFunctionOptionEnable = 0x00U, /*!< Option used to enable Swap function */ - kFLASH_SwapFunctionOptionDisable = 0x01U /*!< Option used to Disable Swap function */ + kFLASH_SwapFunctionOptionEnable = 0x00U, /*!< An option used to enable the Swap function */ + kFLASH_SwapFunctionOptionDisable = 0x01U /*!< An option used to disable the Swap function */ } flash_swap_function_option_t; /*! - * @brief Enumeration for the possible options of Swap Control commands + * @brief Enumeration for the possible options of Swap control commands */ typedef enum _flash_swap_control_option { - kFLASH_SwapControlOptionIntializeSystem = 0x01U, /*!< Option used to Intialize Swap System */ - kFLASH_SwapControlOptionSetInUpdateState = 0x02U, /*!< Option used to Set Swap in Update State */ - kFLASH_SwapControlOptionSetInCompleteState = 0x04U, /*!< Option used to Set Swap in Complete State */ - kFLASH_SwapControlOptionReportStatus = 0x08U, /*!< Option used to Report Swap Status */ - kFLASH_SwapControlOptionDisableSystem = 0x10U /*!< Option used to Disable Swap Status */ + kFLASH_SwapControlOptionIntializeSystem = 0x01U, /*!< An option used to initialize the Swap system */ + kFLASH_SwapControlOptionSetInUpdateState = 0x02U, /*!< An option used to set the Swap in an update state */ + kFLASH_SwapControlOptionSetInCompleteState = 0x04U, /*!< An option used to set the Swap in a complete state */ + kFLASH_SwapControlOptionReportStatus = 0x08U, /*!< An option used to report the Swap status */ + kFLASH_SwapControlOptionDisableSystem = 0x10U /*!< An option used to disable the Swap status */ } flash_swap_control_option_t; /*! - * @brief Enumeration for the possible flash swap status. + * @brief Enumeration for the possible flash Swap status. */ typedef enum _flash_swap_state { - kFLASH_SwapStateUninitialized = 0x00U, /*!< Flash swap system is in uninitialized state.*/ - kFLASH_SwapStateReady = 0x01U, /*!< Flash swap system is in ready state.*/ - kFLASH_SwapStateUpdate = 0x02U, /*!< Flash swap system is in update state.*/ - kFLASH_SwapStateUpdateErased = 0x03U, /*!< Flash swap system is in updateErased state.*/ - kFLASH_SwapStateComplete = 0x04U, /*!< Flash swap system is in complete state.*/ - kFLASH_SwapStateDisabled = 0x05U /*!< Flash swap system is in disabled state.*/ + kFLASH_SwapStateUninitialized = 0x00U, /*!< Flash Swap system is in an uninitialized state.*/ + kFLASH_SwapStateReady = 0x01U, /*!< Flash Swap system is in a ready state.*/ + kFLASH_SwapStateUpdate = 0x02U, /*!< Flash Swap system is in an update state.*/ + kFLASH_SwapStateUpdateErased = 0x03U, /*!< Flash Swap system is in an updateErased state.*/ + kFLASH_SwapStateComplete = 0x04U, /*!< Flash Swap system is in a complete state.*/ + kFLASH_SwapStateDisabled = 0x05U /*!< Flash Swap system is in a disabled state.*/ } flash_swap_state_t; /*! - * @breif Enumeration for the possible flash swap block status + * @breif Enumeration for the possible flash Swap block status */ typedef enum _flash_swap_block_status { @@ -374,41 +402,72 @@ } flash_swap_block_status_t; /*! - * @brief Flash Swap information. + * @brief Flash Swap information */ typedef struct _flash_swap_state_config { - flash_swap_state_t flashSwapState; /*!< Current swap system status.*/ - flash_swap_block_status_t currentSwapBlockStatus; /*!< Current swap block status.*/ - flash_swap_block_status_t nextSwapBlockStatus; /*!< Next swap block status.*/ + flash_swap_state_t flashSwapState; /*!<The current Swap system status.*/ + flash_swap_block_status_t currentSwapBlockStatus; /*!< The current Swap block status.*/ + flash_swap_block_status_t nextSwapBlockStatus; /*!< The next Swap block status.*/ } flash_swap_state_config_t; /*! - * @brief Flash Swap IFR fields. + * @brief Flash Swap IFR fields */ typedef struct _flash_swap_ifr_field_config { - uint16_t swapIndicatorAddress; /*!< Swap indicator address field.*/ - uint16_t swapEnableWord; /*!< Swap enable word field.*/ - uint8_t reserved0[4]; /*!< Reserved field.*/ + uint16_t swapIndicatorAddress; /*!< A Swap indicator address field.*/ + uint16_t swapEnableWord; /*!< A Swap enable word field.*/ + uint8_t reserved0[4]; /*!< A reserved field.*/ #if (FSL_FEATURE_FLASH_IS_FTFE == 1) - uint8_t reserved1[2]; /*!< Reserved field.*/ - uint16_t swapDisableWord; /*!< Swap disable word field.*/ - uint8_t reserved2[4]; /*!< Reserved field.*/ + uint8_t reserved1[2]; /*!< A reserved field.*/ + uint16_t swapDisableWord; /*!< A Swap disable word field.*/ + uint8_t reserved2[4]; /*!< A reserved field.*/ #endif } flash_swap_ifr_field_config_t; /*! - * @brief Flash Swap IFR field data. + * @brief Flash Swap IFR field data */ typedef union _flash_swap_ifr_field_data { - uint32_t flashSwapIfrData[2]; /*!< Flash Swap IFR field data .*/ - flash_swap_ifr_field_config_t flashSwapIfrField; /*!< Flash Swap IFR field struct.*/ + uint32_t flashSwapIfrData[2]; /*!< A flash Swap IFR field data .*/ + flash_swap_ifr_field_config_t flashSwapIfrField; /*!< A flash Swap IFR field structure.*/ } flash_swap_ifr_field_data_t; /*! - * @brief Enumeration for FlexRAM load during reset option. + * @brief PFlash protection status - low 32bit + */ +typedef union _pflash_protection_status_low +{ + uint32_t protl32b; /*!< PROT[31:0] .*/ + struct + { + uint8_t protsl; /*!< PROTS[7:0] .*/ + uint8_t protsh; /*!< PROTS[15:8] .*/ + uint8_t reserved[2]; + } prots16b; +} pflash_protection_status_low_t; + +/*! + * @brief PFlash protection status - full + */ +typedef struct _pflash_protection_status +{ + pflash_protection_status_low_t valueLow32b; /*!< PROT[31:0] or PROTS[15:0].*/ +#if ((FSL_FEATURE_FLASH_IS_FTFA == 1) && (defined(FTFA_FPROT_PROT_MASK))) || \ + ((FSL_FEATURE_FLASH_IS_FTFE == 1) && (defined(FTFE_FPROT_PROT_MASK))) || \ + ((FSL_FEATURE_FLASH_IS_FTFL == 1) && (defined(FTFL_FPROT_PROT_MASK))) + // uint32_t protHigh; /*!< PROT[63:32].*/ + struct + { + uint32_t proth32b; + } valueHigh32b; +#endif +} pflash_protection_status_t; + +/*! + * @brief Enumeration for the FlexRAM load during reset option. */ typedef enum _flash_partition_flexram_load_option { @@ -417,22 +476,69 @@ kFLASH_PartitionFlexramLoadOptionNotLoaded = 0x01U /*!< FlexRAM is not loaded during reset sequence.*/ } flash_partition_flexram_load_option_t; -/*! @brief callback type used for pflash block*/ +/*! + * @brief Enumeration for the flash memory index. + */ +typedef enum _flash_memory_index +{ + kFLASH_MemoryIndexPrimaryFlash = 0x00U, /*!< Current flash memory is primary flash.*/ + kFLASH_MemoryIndexSecondaryFlash = 0x01U, /*!< Current flash memory is secondary flash.*/ +} flash_memory_index_t; + +/*! @brief A callback type used for the Pflash block*/ typedef void (*flash_callback_t)(void); /*! - * @brief Active flash information for current operation. + * @brief Enumeration for the two possible options of flash prefetch speculation. + */ +typedef enum _flash_prefetch_speculation_option +{ + kFLASH_prefetchSpeculationOptionEnable = 0x00000000U, + kFLASH_prefetchSpeculationOptionDisable = 0xFFFFFFFFU +} flash_prefetch_speculation_option_t; + +/*! + * @brief Flash prefetch speculation status. + */ +typedef struct _flash_prefetch_speculation_status +{ + flash_prefetch_speculation_option_t instructionOption; /*!< Instruction speculation.*/ + flash_prefetch_speculation_option_t dataOption; /*!< Data speculation.*/ +} flash_prefetch_speculation_status_t; + +/*! + * @brief Active flash protection information for the current operation. + */ +typedef struct _flash_protection_config +{ + uint32_t regionBase; /*!< Base address of flash protection region.*/ + uint32_t regionSize; /*!< size of flash protection region.*/ + uint32_t regionCount; /*!< flash protection region count.*/ +} flash_protection_config_t; + +/*! + * @brief Active flash Execute-Only access information for the current operation. + */ +typedef struct _flash_access_config +{ + uint32_t SegmentBase; /*!< Base address of flash Execute-Only segment.*/ + uint32_t SegmentSize; /*!< size of flash Execute-Only segment.*/ + uint32_t SegmentCount; /*!< flash Execute-Only segment count.*/ +} flash_access_config_t; + +/*! + * @brief Active flash information for the current operation. */ typedef struct _flash_operation_config { - uint32_t convertedAddress; /*!< Converted address for current flash type.*/ - uint32_t activeSectorSize; /*!< Sector size of current flash type.*/ - uint32_t activeBlockSize; /*!< Block size of current flash type.*/ - uint32_t blockWriteUnitSize; /*!< write unit size.*/ - uint32_t sectorCmdAddressAligment; /*!< Erase sector command address alignment.*/ - uint32_t sectionCmdAddressAligment; /*!< Program/Verify section command address alignment.*/ - uint32_t resourceCmdAddressAligment; /*!< Read resource command address alignment.*/ - uint32_t checkCmdAddressAligment; /*!< Program check command address alignment.*/ + uint32_t convertedAddress; /*!< A converted address for the current flash type.*/ + uint32_t activeSectorSize; /*!< A sector size of the current flash type.*/ + uint32_t activeBlockSize; /*!< A block size of the current flash type.*/ + uint32_t blockWriteUnitSize; /*!< The write unit size.*/ + uint32_t sectorCmdAddressAligment; /*!< An erase sector command address alignment.*/ + uint32_t sectionCmdAddressAligment; /*!< A program/verify section command address alignment.*/ + uint32_t resourceCmdAddressAligment; /*!< A read resource command address alignment.*/ + uint32_t checkCmdAddressAligment; /*!< A program check command address alignment.*/ } flash_operation_config_t; /*! @brief Flash driver state information. @@ -442,25 +548,29 @@ */ typedef struct _flash_config { - uint32_t PFlashBlockBase; /*!< Base address of the first PFlash block */ - uint32_t PFlashTotalSize; /*!< Size of all combined PFlash block. */ - uint32_t PFlashBlockCount; /*!< Number of PFlash blocks. */ - uint32_t PFlashSectorSize; /*!< Size in bytes of a sector of PFlash. */ - flash_callback_t PFlashCallback; /*!< Callback function for flash API. */ - uint32_t PFlashAccessSegmentSize; /*!< Size in bytes of a access segment of PFlash. */ - uint32_t PFlashAccessSegmentCount; /*!< Number of PFlash access segments. */ - uint32_t *flashExecuteInRamFunctionInfo; /*!< Info struct of flash execute-in-RAM function. */ - uint32_t FlexRAMBlockBase; /*!< For FlexNVM device, this is the base address of FlexRAM - For non-FlexNVM device, this is the base address of acceleration RAM memory */ - uint32_t FlexRAMTotalSize; /*!< For FlexNVM device, this is the size of FlexRAM - For non-FlexNVM device, this is the size of acceleration RAM memory */ - uint32_t DFlashBlockBase; /*!< For FlexNVM device, this is the base address of D-Flash memory (FlexNVM memory); - For non-FlexNVM device, this field is unused */ - uint32_t DFlashTotalSize; /*!< For FlexNVM device, this is total size of the FlexNVM memory; - For non-FlexNVM device, this field is unused */ - uint32_t EEpromTotalSize; /*!< For FlexNVM device, this is the size in byte of EEPROM area which was partitioned - from FlexRAM; - For non-FlexNVM device, this field is unused */ + uint32_t PFlashBlockBase; /*!< A base address of the first PFlash block */ + uint32_t PFlashTotalSize; /*!< The size of the combined PFlash block. */ + uint32_t PFlashBlockCount; /*!< A number of PFlash blocks. */ + uint32_t PFlashSectorSize; /*!< The size in bytes of a sector of PFlash. */ + flash_callback_t PFlashCallback; /*!< The callback function for the flash API. */ + uint32_t PFlashAccessSegmentSize; /*!< A size in bytes of an access segment of PFlash. */ + uint32_t PFlashAccessSegmentCount; /*!< A number of PFlash access segments. */ + uint32_t *flashExecuteInRamFunctionInfo; /*!< An information structure of the flash execute-in-RAM function. */ + uint32_t + FlexRAMBlockBase; /*!< For the FlexNVM device, this is the base address of the FlexRAM + For the non-FlexNVM device, this is the base address of the acceleration RAM memory */ + uint32_t FlexRAMTotalSize; /*!< For the FlexNVM device, this is the size of the FlexRAM + For the non-FlexNVM device, this is the size of the acceleration RAM memory */ + uint32_t + DFlashBlockBase; /*!< For the FlexNVM device, this is the base address of the D-Flash memory (FlexNVM memory) + For the non-FlexNVM device, this field is unused */ + uint32_t DFlashTotalSize; /*!< For the FlexNVM device, this is the total size of the FlexNVM memory; + For the non-FlexNVM device, this field is unused */ + uint32_t + EEpromTotalSize; /*!< For the FlexNVM device, this is the size in bytes of the EEPROM area which was partitioned + from FlexRAM + For the non-FlexNVM device, this field is unused */ + uint32_t FlashMemoryIndex; /*!< 0 - primary flash; 1 - secondary flash*/ } flash_config_t; /******************************************************************************* @@ -477,37 +587,37 @@ */ /*! - * @brief Initializes global flash properties structure members + * @brief Initializes the global flash properties structure members. * - * This function checks and initializes Flash module for the other Flash APIs. + * This function checks and initializes the Flash module for the other Flash APIs. * - * @param config Pointer to storage for the driver runtime state. + * @param config Pointer to the storage for the driver runtime state. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. - * @retval #kStatus_FLASH_PartitionStatusUpdateFailure Failed to update partition status. + * @retval #kStatus_FLASH_PartitionStatusUpdateFailure Failed to update the partition status. */ status_t FLASH_Init(flash_config_t *config); /*! - * @brief Set the desired flash callback function + * @brief Sets the desired flash callback function. * - * @param config Pointer to storage for the driver runtime state. - * @param callback callback function to be stored in driver + * @param config Pointer to the storage for the driver runtime state. + * @param callback A callback function to be stored in the driver. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. */ status_t FLASH_SetCallback(flash_config_t *config, flash_callback_t callback); /*! - * @brief Prepare flash execute-in-RAM functions + * @brief Prepares flash execute-in-RAM functions. * - * @param config Pointer to storage for the driver runtime state. + * @param config Pointer to the storage for the driver runtime state. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. */ #if FLASH_DRIVER_IS_FLASH_RESIDENT status_t FLASH_PrepareExecuteInRamFunctions(flash_config_t *config); @@ -523,59 +633,59 @@ /*! * @brief Erases entire flash * - * @param config Pointer to storage for the driver runtime state. - * @param key value used to validate all flash erase APIs. + * @param config Pointer to the storage for the driver runtime state. + * @param key A value used to validate all flash erase APIs. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_EraseKeyError API erase key is invalid. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. - * @retval #kStatus_FLASH_PartitionStatusUpdateFailure Failed to update partition status + * @retval #kStatus_FLASH_PartitionStatusUpdateFailure Failed to update the partition status. */ status_t FLASH_EraseAll(flash_config_t *config, uint32_t key); /*! - * @brief Erases flash sectors encompassed by parameters passed into function + * @brief Erases the flash sectors encompassed by parameters passed into function. * * This function erases the appropriate number of flash sectors based on the * desired start address and length. * - * @param config Pointer to storage for the driver runtime state. + * @param config The pointer to the storage for the driver runtime state. * @param 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. + * The start address does not need to be sector-aligned but must be word-aligned. * @param lengthInBytes The length, given in bytes (not words or long-words) - * to be erased. Must be word aligned. - * @param key value used to validate all flash erase APIs. + * to be erased. Must be word-aligned. + * @param key The value used to validate all flash erase APIs. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. - * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. - * @retval #kStatus_FLASH_AddressError Address is out of range. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. + * @retval #kStatus_FLASH_AlignmentError The parameter is not aligned with the specified baseline. + * @retval #kStatus_FLASH_AddressError The address is out of range. + * @retval #kStatus_FLASH_EraseKeyError The API erase key is invalid. + * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. + * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. + * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. + * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution. + */ +status_t FLASH_Erase(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, uint32_t key); + +/*! + * @brief Erases the entire flash, including protected sectors. + * + * @param config Pointer to the storage for the driver runtime state. + * @param key A value used to validate all flash erase APIs. + * + * @retval #kStatus_FLASH_Success API was executed successfully. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_EraseKeyError API erase key is invalid. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. - */ -status_t FLASH_Erase(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, uint32_t key); - -/*! - * @brief Erases entire flash, including protected sectors. - * - * @param config Pointer to storage for the driver runtime state. - * @param key value used to validate all flash erase APIs. - * - * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. - * @retval #kStatus_FLASH_EraseKeyError API erase key is invalid. - * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. - * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. - * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. - * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. - * @retval #kStatus_FLASH_PartitionStatusUpdateFailure Failed to update partition status + * @retval #kStatus_FLASH_PartitionStatusUpdateFailure Failed to update the partition status. */ #if defined(FSL_FEATURE_FLASH_HAS_ERASE_ALL_BLOCKS_UNSECURE_CMD) && FSL_FEATURE_FLASH_HAS_ERASE_ALL_BLOCKS_UNSECURE_CMD status_t FLASH_EraseAllUnsecure(flash_config_t *config, uint32_t key); @@ -584,16 +694,16 @@ /*! * @brief Erases all program flash execute-only segments defined by the FXACC registers. * - * @param config Pointer to storage for the driver runtime state. - * @param key value used to validate all flash erase APIs. + * @param config Pointer to the storage for the driver runtime state. + * @param key A value used to validate all flash erase APIs. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_EraseKeyError API erase key is invalid. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. - * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. + * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution. */ status_t FLASH_EraseAllExecuteOnlySegments(flash_config_t *config, uint32_t key); @@ -605,101 +715,101 @@ */ /*! - * @brief Programs flash with data at locations passed in through parameters + * @brief Programs flash with data at locations passed in through parameters. * - * This function programs the flash memory with desired data for a given - * flash area as determined by the start address and length. + * This function programs the flash memory with the desired data for a given + * flash area as determined by the start address and the length. * - * @param config Pointer to storage for the driver runtime state. + * @param config A pointer to the storage for the driver runtime state. * @param start The start address of the desired flash memory to be programmed. Must be * word-aligned. - * @param src Pointer to the source buffer of data that is to be programmed + * @param src A pointer to the source buffer of data that is to be programmed * into the flash. - * @param lengthInBytes The length, given in bytes (not words or long-words) + * @param lengthInBytes The length, given in bytes (not words or long-words), * to be programmed. Must be word-aligned. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. - * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. + * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with the specified baseline. * @retval #kStatus_FLASH_AddressError Address is out of range. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. - * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. + * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution. */ status_t FLASH_Program(flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes); /*! - * @brief Programs Program Once Field through parameters + * @brief Programs Program Once Field through parameters. * - * This function programs the Program Once Field with desired data for a given + * This function programs the Program Once Field with the desired data for a given * flash area as determined by the index and length. * - * @param config Pointer to storage for the driver runtime state. - * @param index The index indicating which area of Program Once Field to be programmed. - * @param src Pointer to the source buffer of data that is to be programmed + * @param config A pointer to the storage for the driver runtime state. + * @param index The index indicating which area of the Program Once Field to be programmed. + * @param src A pointer to the source buffer of data that is to be programmed * into the Program Once Field. - * @param lengthInBytes The length, given in bytes (not words or long-words) + * @param lengthInBytes The length, given in bytes (not words or long-words), * to be programmed. Must be word-aligned. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. - * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. + * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution. */ status_t FLASH_ProgramOnce(flash_config_t *config, uint32_t index, uint32_t *src, uint32_t lengthInBytes); /*! - * @brief Programs flash with data at locations passed in through parameters via Program Section command + * @brief Programs flash with data at locations passed in through parameters via the Program Section command. * - * This function programs the flash memory with desired data for a given + * This function programs the flash memory with the desired data for a given * flash area as determined by the start address and length. * - * @param config Pointer to storage for the driver runtime state. + * @param config A pointer to the storage for the driver runtime state. * @param start The start address of the desired flash memory to be programmed. Must be * word-aligned. - * @param src Pointer to the source buffer of data that is to be programmed + * @param src A pointer to the source buffer of data that is to be programmed * into the flash. - * @param lengthInBytes The length, given in bytes (not words or long-words) + * @param lengthInBytes The length, given in bytes (not words or long-words), * to be programmed. Must be word-aligned. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. * @retval #kStatus_FLASH_AddressError Address is out of range. - * @retval #kStatus_FLASH_SetFlexramAsRamError Failed to set flexram as RAM + * @retval #kStatus_FLASH_SetFlexramAsRamError Failed to set flexram as RAM. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. - * @retval #kStatus_FLASH_RecoverFlexramAsEepromError Failed to recover flexram as eeprom + * @retval #kStatus_FLASH_RecoverFlexramAsEepromError Failed to recover FlexRAM as EEPROM. */ #if defined(FSL_FEATURE_FLASH_HAS_PROGRAM_SECTION_CMD) && FSL_FEATURE_FLASH_HAS_PROGRAM_SECTION_CMD status_t FLASH_ProgramSection(flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes); #endif /*! - * @brief Programs EEPROM with data at locations passed in through parameters + * @brief Programs the EEPROM with data at locations passed in through parameters. * - * This function programs the Emulated EEPROM with desired data for a given + * This function programs the emulated EEPROM with the desired data for a given * flash area as determined by the start address and length. * - * @param config Pointer to storage for the driver runtime state. + * @param config A pointer to the storage for the driver runtime state. * @param start The start address of the desired flash memory to be programmed. Must be * word-aligned. - * @param src Pointer to the source buffer of data that is to be programmed + * @param src A pointer to the source buffer of data that is to be programmed * into the flash. - * @param lengthInBytes The length, given in bytes (not words or long-words) + * @param lengthInBytes The length, given in bytes (not words or long-words), * to be programmed. Must be word-aligned. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_AddressError Address is out of range. * @retval #kStatus_FLASH_SetFlexramAsEepromError Failed to set flexram as eeprom. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. - * @retval #kStatus_FLASH_RecoverFlexramAsRamError Failed to recover flexram as RAM + * @retval #kStatus_FLASH_RecoverFlexramAsRamError Failed to recover the FlexRAM as RAM. */ #if FLASH_SSD_IS_FLEXNVM_ENABLED status_t FLASH_EepromWrite(flash_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes); @@ -713,27 +823,27 @@ */ /*! - * @brief Read resource with data at locations passed in through parameters + * @brief Reads the resource with data at locations passed in through parameters. * - * This function reads the flash memory with desired location for a given + * This function reads the flash memory with the desired location for a given * flash area as determined by the start address and length. * - * @param config Pointer to storage for the driver runtime state. + * @param config A pointer to the storage for the driver runtime state. * @param start The start address of the desired flash memory to be programmed. Must be * word-aligned. - * @param dst Pointer to the destination buffer of data that is used to store + * @param dst A pointer to the destination buffer of data that is used to store * data to be read. - * @param lengthInBytes The length, given in bytes (not words or long-words) + * @param lengthInBytes The length, given in bytes (not words or long-words), * to be read. Must be word-aligned. * @param option The resource option which indicates which area should be read back. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. - * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. + * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with the specified baseline. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. - * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. + * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution. */ #if defined(FSL_FEATURE_FLASH_HAS_READ_RESOURCE_CMD) && FSL_FEATURE_FLASH_HAS_READ_RESOURCE_CMD status_t FLASH_ReadResource( @@ -741,23 +851,23 @@ #endif /*! - * @brief Read Program Once Field through parameters + * @brief Reads the Program Once Field through parameters. * - * This function reads the read once feild with given index and length + * This function reads the read once feild with given index and length. * - * @param config Pointer to storage for the driver runtime state. + * @param config A pointer to the storage for the driver runtime state. * @param index The index indicating the area of program once field to be read. - * @param dst Pointer to the destination buffer of data that is used to store + * @param dst A pointer to the destination buffer of data that is used to store * data to be read. - * @param lengthInBytes The length, given in bytes (not words or long-words) + * @param lengthInBytes The length, given in bytes (not words or long-words), * to be programmed. Must be word-aligned. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. - * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. + * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution. */ status_t FLASH_ReadOnce(flash_config_t *config, uint32_t index, uint32_t *dst, uint32_t lengthInBytes); @@ -769,35 +879,35 @@ */ /*! - * @brief Returns the security state via the pointer passed into the function + * @brief Returns the security state via the pointer passed into the function. * - * This function retrieves the current Flash security status, including the + * This function retrieves the current flash security status, including the * security enabling state and the backdoor key enabling state. * - * @param config Pointer to storage for the driver runtime state. - * @param state Pointer to the value returned for the current security status code: + * @param config A pointer to storage for the driver runtime state. + * @param state A pointer to the value returned for the current security status code: * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. */ status_t FLASH_GetSecurityState(flash_config_t *config, flash_security_state_t *state); /*! - * @brief Allows user to bypass security with a backdoor key + * @brief Allows users to bypass security with a backdoor key. * - * If the MCU is in secured state, this function will unsecure the MCU by - * comparing the provided backdoor key with ones in the Flash Configuration - * Field. + * 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. * - * @param config Pointer to storage for the driver runtime state. - * @param backdoorKey Pointer to the user buffer containing the backdoor key. + * @param config A pointer to the storage for the driver runtime state. + * @param backdoorKey A pointer to the user buffer containing the backdoor key. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. - * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. + * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution. */ status_t FLASH_SecurityBypass(flash_config_t *config, const uint8_t *backdoorKey); @@ -809,75 +919,75 @@ */ /*! - * @brief Verifies erasure of entire flash at specified margin level + * @brief Verifies erasure of the entire flash at a specified margin level. * - * This function will check to see if the flash have been erased to the + * This function checks whether the flash is erased to the * specified read margin level. * - * @param config Pointer to storage for the driver runtime state. - * @param margin Read margin choice + * @param config A pointer to the storage for the driver runtime state. + * @param margin Read margin choice. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. - * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. + * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution. */ status_t FLASH_VerifyEraseAll(flash_config_t *config, flash_margin_value_t margin); /*! - * @brief Verifies erasure of desired flash area at specified margin level + * @brief Verifies an erasure of the desired flash area at a specified margin level. * - * This function will check the appropriate number of flash sectors based on - * the desired start address and length to see if the flash have been erased + * 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. * - * @param config Pointer to storage for the driver runtime state. + * @param config A pointer to the storage for the driver runtime state. * @param 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. - * @param lengthInBytes The length, given in bytes (not words or long-words) + * The start address does not need to be sector-aligned but must be word-aligned. + * @param lengthInBytes The length, given in bytes (not words or long-words), * to be verified. Must be word-aligned. - * @param margin Read margin choice + * @param margin Read margin choice. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. * @retval #kStatus_FLASH_AddressError Address is out of range. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. - * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. + * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution. */ status_t FLASH_VerifyErase(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, flash_margin_value_t margin); /*! - * @brief Verifies programming of desired flash area at specified margin level + * @brief Verifies programming of the desired flash area at a specified margin level. * * This function verifies the data programed in the flash memory using the - * Flash Program Check Command and compares it with expected data for a given + * Flash Program Check Command and compares it to the expected data for a given * flash area as determined by the start address and length. * - * @param config Pointer to storage for the driver runtime state. + * @param config A pointer to the storage for the driver runtime state. * @param start The start address of the desired flash memory to be verified. Must be word-aligned. - * @param lengthInBytes The length, given in bytes (not words or long-words) + * @param lengthInBytes The length, given in bytes (not words or long-words), * to be verified. Must be word-aligned. - * @param expectedData Pointer to the expected data that is to be + * @param expectedData A pointer to the expected data that is to be * verified against. - * @param margin Read margin choice - * @param failedAddress Pointer to returned failing address. - * @param failedData Pointer to returned failing data. Some derivitives do - * not included failed data as part of the FCCOBx registers. In this + * @param margin Read margin choice. + * @param failedAddress A pointer to the returned failing address. + * @param 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. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. * @retval #kStatus_FLASH_AddressError Address is out of range. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. - * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. + * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution. */ status_t FLASH_VerifyProgram(flash_config_t *config, uint32_t start, @@ -888,18 +998,18 @@ uint32_t *failedData); /*! - * @brief Verifies if the program flash executeonly segments have been erased to - * the specified read margin level + * @brief Verifies whether the program flash execute-only segments have been erased to + * the specified read margin level. * - * @param config Pointer to storage for the driver runtime state. - * @param margin Read margin choice + * @param config A pointer to the storage for the driver runtime state. + * @param margin Read margin choice. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. - * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. + * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution. */ status_t FLASH_VerifyEraseAllExecuteOnlySegments(flash_config_t *config, flash_margin_value_t margin); @@ -911,22 +1021,22 @@ */ /*! - * @brief Returns the protection state of desired flash area via the pointer passed into the function + * @brief Returns the protection state of the desired flash area via the pointer passed into the function. * - * This function retrieves the current Flash protect status for a given + * This function retrieves the current flash protect status for a given * flash area as determined by the start address and length. * - * @param config Pointer to storage for the driver runtime state. + * @param config A pointer to the storage for the driver runtime state. * @param start The start address of the desired flash memory to be checked. Must be word-aligned. * @param lengthInBytes The length, given in bytes (not words or long-words) * to be checked. Must be word-aligned. - * @param protection_state Pointer to the value returned for the current + * @param protection_state A pointer to the value returned for the current * protection status code for the desired flash area. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. - * @retval #kStatus_FLASH_AddressError Address is out of range. + * @retval #kStatus_FLASH_AddressError The address is out of range. */ status_t FLASH_IsProtected(flash_config_t *config, uint32_t start, @@ -934,22 +1044,22 @@ flash_protection_state_t *protection_state); /*! - * @brief Returns the access state of desired flash area via the pointer passed into the function + * @brief Returns the access state of the desired flash area via the pointer passed into the function. * - * This function retrieves the current Flash access status for a given + * This function retrieves the current flash access status for a given * flash area as determined by the start address and length. * - * @param config Pointer to storage for the driver runtime state. + * @param config A pointer to the storage for the driver runtime state. * @param start The start address of the desired flash memory to be checked. Must be word-aligned. - * @param lengthInBytes The length, given in bytes (not words or long-words) + * @param lengthInBytes The length, given in bytes (not words or long-words), * to be checked. Must be word-aligned. - * @param access_state Pointer to the value returned for the current + * @param access_state A pointer to the value returned for the current * access status code for the desired flash area. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. - * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. - * @retval #kStatus_FLASH_AddressError Address is out of range. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. + * @retval #kStatus_FLASH_AlignmentError The parameter is not aligned to the specified baseline. + * @retval #kStatus_FLASH_AddressError The address is out of range. */ status_t FLASH_IsExecuteOnly(flash_config_t *config, uint32_t start, @@ -966,17 +1076,35 @@ /*! * @brief Returns the desired flash property. * - * @param config Pointer to storage for the driver runtime state. + * @param config A pointer to the storage for the driver runtime state. * @param whichProperty The desired property from the list of properties in * enum flash_property_tag_t - * @param value Pointer to the value returned for the desired flash property + * @param value A pointer to the value returned for the desired flash property. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. - * @retval #kStatus_FLASH_UnknownProperty unknown property tag + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. + * @retval #kStatus_FLASH_UnknownProperty An unknown property tag. */ status_t FLASH_GetProperty(flash_config_t *config, flash_property_tag_t whichProperty, uint32_t *value); +/*! + * @brief Sets the desired flash property. + * + * @param config A pointer to the storage for the driver runtime state. + * @param whichProperty The desired property from the list of properties in + * enum flash_property_tag_t + * @param value A to set for the desired flash property. + * + * @retval #kStatus_FLASH_Success API was executed successfully. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. + * @retval #kStatus_FLASH_UnknownProperty An unknown property tag. + * @retval #kStatus_FLASH_InvalidPropertyValue An invalid property value. + * @retval #kStatus_FLASH_ReadOnlyProperty An read-only property tag. + */ +#if FLASH_SSD_IS_SECONDARY_FLASH_SUPPORTED +status_t FLASH_SetProperty(flash_config_t *config, flash_property_tag_t whichProperty, uint32_t value); +#endif + /*@}*/ /*! @@ -985,17 +1113,17 @@ */ /*! - * @brief Set FlexRAM Function command + * @brief Sets the FlexRAM function command. * - * @param config Pointer to storage for the driver runtime state. - * @param option The option used to set work mode of FlexRAM + * @param config A pointer to the storage for the driver runtime state. + * @param option The option used to set the work mode of FlexRAM. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. - * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. + * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution. */ #if defined(FSL_FEATURE_FLASH_HAS_SET_FLEXRAM_FUNCTION_CMD) && FSL_FEATURE_FLASH_HAS_SET_FLEXRAM_FUNCTION_CMD status_t FLASH_SetFlexramFunction(flash_config_t *config, flash_flexram_function_option_t option); @@ -1009,21 +1137,21 @@ */ /*! - * @brief Configure Swap function or Check the swap state of Flash Module + * @brief Configures the Swap function or checks the the swap state of the Flash module. * - * @param config Pointer to storage for the driver runtime state. - * @param address Address used to configure the flash swap function - * @param option The possible option used to configure Flash Swap function or check the flash swap status - * @param returnInfo Pointer to the data which is used to return the information of flash swap. + * @param config A pointer to the storage for the driver runtime state. + * @param address Address used to configure the flash Swap function. + * @param option The possible option used to configure Flash Swap function or check the flash Swap status + * @param returnInfo A pointer to the data which is used to return the information of flash Swap. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. - * @retval #kStatus_FLASH_SwapIndicatorAddressError Swap indicator address is invalid + * @retval #kStatus_FLASH_SwapIndicatorAddressError Swap indicator address is invalid. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. - * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. + * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution. */ #if defined(FSL_FEATURE_FLASH_HAS_SWAP_CONTROL_CMD) && FSL_FEATURE_FLASH_HAS_SWAP_CONTROL_CMD status_t FLASH_SwapControl(flash_config_t *config, @@ -1033,21 +1161,21 @@ #endif /*! - * @brief Swap the lower half flash with the higher half flaock + * @brief Swaps the lower half flash with the higher half flash. * - * @param config Pointer to storage for the driver runtime state. + * @param config A pointer to the storage for the driver runtime state. * @param address Address used to configure the flash swap function - * @param option The possible option used to configure Flash Swap function or check the flash swap status + * @param option The possible option used to configure the Flash Swap function or check the flash Swap status. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. - * @retval #kStatus_FLASH_SwapIndicatorAddressError Swap indicator address is invalid + * @retval #kStatus_FLASH_SwapIndicatorAddressError Swap indicator address is invalid. * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. - * @retval #kStatus_FLASH_SwapSystemNotInUninitialized Swap system is not in uninitialzed state + * @retval #kStatus_FLASH_SwapSystemNotInUninitialized Swap system is not in an uninitialzed state. */ #if defined(FSL_FEATURE_FLASH_HAS_PFLASH_BLOCK_SWAP) && FSL_FEATURE_FLASH_HAS_PFLASH_BLOCK_SWAP status_t FLASH_Swap(flash_config_t *config, uint32_t address, flash_swap_function_option_t option); @@ -1090,51 +1218,54 @@ */ /*! - * @brief Set PFLASH Protection to the intended protection status. + * @brief Sets the PFlash Protection to the intended protection status. * - * @param config Pointer to storage for the driver runtime state. - * @param protectStatus The expected protect status user wants to set to PFlash protection register. Each bit is - * corresponding to protection of 1/32 of the total PFlash. The least significant bit is corresponding to the lowest - * address area of P-Flash. The most significant bit is corresponding to the highest address area of PFlash. There are + * @param config A pointer to storage for the driver runtime state. + * @param protectStatus The expected protect status to set to the PFlash protection register. Each bit is + * corresponding to protection of 1/32(64) of the total PFlash. The least significant bit is corresponding to the lowest + * address area of PFlash. The most significant bit is corresponding to the highest address area of PFlash. There are * two possible cases as shown below: * 0: this area is protected. * 1: this area is unprotected. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. */ -status_t FLASH_PflashSetProtection(flash_config_t *config, uint32_t protectStatus); +status_t FLASH_PflashSetProtection(flash_config_t *config, pflash_protection_status_t *protectStatus); /*! - * @brief Get PFLASH Protection Status. + * @brief Gets the PFlash protection status. * - * @param config Pointer to storage for the driver runtime state. - * @param protectStatus Protect status returned by PFlash IP. Each bit is corresponding to protection of 1/32 of the - * total PFlash. The least significant bit is corresponding to the lowest address area of PFlash. The most significant - * bit is corresponding to the highest address area of PFlash. Thee are two possible cases as below: + * @param config A pointer to the storage for the driver runtime state. + * @param protectStatus Protect status returned by the PFlash IP. Each bit is corresponding to the protection of + * 1/32(64) + * of the + * total PFlash. The least significant bit corresponds to the lowest address area of the PFlash. The most significant + * bit corresponds to the highest address area of PFlash. There are two possible cases as shown below: * 0: this area is protected. * 1: this area is unprotected. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. */ -status_t FLASH_PflashGetProtection(flash_config_t *config, uint32_t *protectStatus); +status_t FLASH_PflashGetProtection(flash_config_t *config, pflash_protection_status_t *protectStatus); /*! - * @brief Set DFLASH Protection to the intended protection status. + * @brief Sets the DFlash protection to the intended protection status. * - * @param config Pointer to storage for the driver runtime state. - * @param protectStatus The expected protect status user wants to set to DFlash protection register. Each bit is - * corresponding to protection of 1/8 of the total DFlash. The least significant bit is corresponding to the lowest - * address area of DFlash. The most significant bit is corresponding to the highest address area of DFlash. There are + * @param config A pointer to the storage for the driver runtime state. + * @param protectStatus The expected protect status to set to the DFlash protection register. Each bit + * corresponds to the protection of the 1/8 of the total DFlash. The least significant bit corresponds to the lowest + * address area of the DFlash. The most significant bit corresponds to the highest address area of the DFlash. There + * are * two possible cases as shown below: * 0: this area is protected. * 1: this area is unprotected. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. - * @retval #kStatus_FLASH_CommandNotSupported Flash API is not supported + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. + * @retval #kStatus_FLASH_CommandNotSupported Flash API is not supported. * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. */ #if FLASH_SSD_IS_FLEXNVM_ENABLED @@ -1142,38 +1273,39 @@ #endif /*! - * @brief Get DFLASH Protection Status. + * @brief Gets the DFlash protection status. * - * @param config Pointer to storage for the driver runtime state. - * @param protectStatus DFlash Protect status returned by PFlash IP. Each bit is corresponding to protection of 1/8 of - * the total DFlash. The least significant bit is corresponding to the lowest address area of DFlash. The most - * significant bit is corresponding to the highest address area of DFlash and so on. There are two possible cases as + * @param config A pointer to the storage for the driver runtime state. + * @param protectStatus DFlash Protect status returned by the PFlash IP. Each bit corresponds to the protection of the + * 1/8 of + * the total DFlash. The least significant bit corresponds to the lowest address area of the DFlash. The most + * significant bit corresponds to the highest address area of the DFlash, and so on. There are two possible cases as * below: * 0: this area is protected. * 1: this area is unprotected. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. - * @retval #kStatus_FLASH_CommandNotSupported Flash API is not supported + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. + * @retval #kStatus_FLASH_CommandNotSupported Flash API is not supported. */ #if FLASH_SSD_IS_FLEXNVM_ENABLED status_t FLASH_DflashGetProtection(flash_config_t *config, uint8_t *protectStatus); #endif /*! - * @brief Set EEPROM Protection to the intended protection status. + * @brief Sets the EEPROM protection to the intended protection status. * - * @param config Pointer to storage for the driver runtime state. - * @param protectStatus The expected protect status user wants to set to EEPROM protection register. Each bit is - * corresponding to protection of 1/8 of the total EEPROM. The least significant bit is corresponding to the lowest - * address area of EEPROM. The most significant bit is corresponding to the highest address area of EEPROM, and so on. + * @param config A pointer to the storage for the driver runtime state. + * @param protectStatus The expected protect status to set to the EEPROM protection register. Each bit + * corresponds to the protection of the 1/8 of the total EEPROM. The least significant bit corresponds to the lowest + * address area of the EEPROM. The most significant bit corresponds to the highest address area of EEPROM, and so on. * There are two possible cases as shown below: * 0: this area is protected. * 1: this area is unprotected. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. - * @retval #kStatus_FLASH_CommandNotSupported Flash API is not supported + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. + * @retval #kStatus_FLASH_CommandNotSupported Flash API is not supported. * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. */ #if FLASH_SSD_IS_FLEXNVM_ENABLED @@ -1181,17 +1313,18 @@ #endif /*! - * @brief Get DFLASH Protection Status. + * @brief Gets the DFlash protection status. * - * @param config Pointer to storage for the driver runtime state. - * @param protectStatus DFlash Protect status returned by PFlash IP. Each bit is corresponding to protection of 1/8 of - * the total EEPROM. The least significant bit is corresponding to the lowest address area of EEPROM. The most - * significant bit is corresponding to the highest address area of EEPROM. There are two possible cases as below: + * @param config A pointer to the storage for the driver runtime state. + * @param protectStatus DFlash Protect status returned by the PFlash IP. Each bit corresponds to the protection of the + * 1/8 of + * the total EEPROM. The least significant bit corresponds to the lowest address area of the EEPROM. The most + * significant bit corresponds to the highest address area of the EEPROM. There are two possible cases as below: * 0: this area is protected. * 1: this area is unprotected. * * @retval #kStatus_FLASH_Success API was executed successfully. - * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. + * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided. * @retval #kStatus_FLASH_CommandNotSupported Flash API is not supported. */ #if FLASH_SSD_IS_FLEXNVM_ENABLED @@ -1200,6 +1333,32 @@ /*@}*/ +/*@}*/ + +/*! +* @name Flash Speculation Utilities +* @{ +*/ + +/*! + * @brief Sets the PFlash prefetch speculation to the intended speculation status. + * + * @param speculationStatus The expected protect status to set to the PFlash protection register. Each bit is + * @retval #kStatus_FLASH_Success API was executed successfully. + * @retval #kStatus_FLASH_InvalidSpeculationOption An invalid speculation option argument is provided. + */ +status_t FLASH_PflashSetPrefetchSpeculation(flash_prefetch_speculation_status_t *speculationStatus); + +/*! + * @brief Gets the PFlash prefetch speculation status. + * + * @param speculationStatus Speculation status returned by the PFlash IP. + * @retval #kStatus_FLASH_Success API was executed successfully. + */ +status_t FLASH_PflashGetPrefetchSpeculation(flash_prefetch_speculation_status_t *speculationStatus); + +/*@}*/ + #if defined(__cplusplus) } #endif