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.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 143:86740a56073b 1 /*
AnnaBridge 143:86740a56073b 2 * Copyright (c) 2013-2016, Freescale Semiconductor, Inc.
AnnaBridge 143:86740a56073b 3 * Copyright 2016-2017 NXP
AnnaBridge 143:86740a56073b 4 *
AnnaBridge 143:86740a56073b 5 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 143:86740a56073b 6 * are permitted provided that the following conditions are met:
AnnaBridge 143:86740a56073b 7 *
AnnaBridge 143:86740a56073b 8 * o Redistributions of source code must retain the above copyright notice, this list
AnnaBridge 143:86740a56073b 9 * of conditions and the following disclaimer.
AnnaBridge 143:86740a56073b 10 *
AnnaBridge 143:86740a56073b 11 * o Redistributions in binary form must reproduce the above copyright notice, this
AnnaBridge 143:86740a56073b 12 * list of conditions and the following disclaimer in the documentation and/or
AnnaBridge 143:86740a56073b 13 * other materials provided with the distribution.
AnnaBridge 143:86740a56073b 14 *
AnnaBridge 143:86740a56073b 15 * o Neither the name of the copyright holder nor the names of its
AnnaBridge 143:86740a56073b 16 * contributors may be used to endorse or promote products derived from this
AnnaBridge 143:86740a56073b 17 * software without specific prior written permission.
AnnaBridge 143:86740a56073b 18 *
AnnaBridge 143:86740a56073b 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
AnnaBridge 143:86740a56073b 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
AnnaBridge 143:86740a56073b 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 143:86740a56073b 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
AnnaBridge 143:86740a56073b 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
AnnaBridge 143:86740a56073b 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
AnnaBridge 143:86740a56073b 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
AnnaBridge 143:86740a56073b 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
AnnaBridge 143:86740a56073b 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
AnnaBridge 143:86740a56073b 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 143:86740a56073b 29 */
AnnaBridge 143:86740a56073b 30
AnnaBridge 143:86740a56073b 31 #ifndef _FSL_FLASH_H_
AnnaBridge 143:86740a56073b 32 #define _FSL_FLASH_H_
AnnaBridge 143:86740a56073b 33
AnnaBridge 143:86740a56073b 34 #if (defined(BL_TARGET_FLASH) || defined(BL_TARGET_ROM) || defined(BL_TARGET_RAM))
AnnaBridge 143:86740a56073b 35 #include <assert.h>
AnnaBridge 143:86740a56073b 36 #include <string.h>
AnnaBridge 143:86740a56073b 37 #include "fsl_device_registers.h"
AnnaBridge 143:86740a56073b 38 #include "bootloader_common.h"
AnnaBridge 143:86740a56073b 39 #else
AnnaBridge 143:86740a56073b 40 #include "fsl_common.h"
AnnaBridge 143:86740a56073b 41 #endif
AnnaBridge 143:86740a56073b 42
AnnaBridge 143:86740a56073b 43 /*******************************************************************************
AnnaBridge 143:86740a56073b 44 * Definitions
AnnaBridge 143:86740a56073b 45 ******************************************************************************/
AnnaBridge 143:86740a56073b 46
AnnaBridge 143:86740a56073b 47 /*!
AnnaBridge 143:86740a56073b 48 * @addtogroup flash_driver
AnnaBridge 143:86740a56073b 49 * @{
AnnaBridge 143:86740a56073b 50 */
AnnaBridge 143:86740a56073b 51
AnnaBridge 143:86740a56073b 52 /*!
AnnaBridge 143:86740a56073b 53 * @name Flash version
AnnaBridge 143:86740a56073b 54 * @{
AnnaBridge 143:86740a56073b 55 */
AnnaBridge 143:86740a56073b 56 /*! @brief Constructs the version number for drivers. */
AnnaBridge 143:86740a56073b 57 #if !defined(MAKE_VERSION)
AnnaBridge 143:86740a56073b 58 #define MAKE_VERSION(major, minor, bugfix) (((major) << 16) | ((minor) << 8) | (bugfix))
AnnaBridge 143:86740a56073b 59 #endif
AnnaBridge 143:86740a56073b 60
AnnaBridge 143:86740a56073b 61 /*! @brief Flash driver version for SDK*/
AnnaBridge 143:86740a56073b 62 #define FSL_FLASH_DRIVER_VERSION (MAKE_VERSION(2, 3, 1)) /*!< Version 2.3.1. */
AnnaBridge 143:86740a56073b 63
AnnaBridge 143:86740a56073b 64 /*! @brief Flash driver version for ROM*/
AnnaBridge 143:86740a56073b 65 enum _flash_driver_version_constants
AnnaBridge 143:86740a56073b 66 {
AnnaBridge 143:86740a56073b 67 kFLASH_DriverVersionName = 'F', /*!< Flash driver version name.*/
AnnaBridge 143:86740a56073b 68 kFLASH_DriverVersionMajor = 2, /*!< Major flash driver version.*/
AnnaBridge 143:86740a56073b 69 kFLASH_DriverVersionMinor = 3, /*!< Minor flash driver version.*/
AnnaBridge 143:86740a56073b 70 kFLASH_DriverVersionBugfix = 1 /*!< Bugfix for flash driver version.*/
AnnaBridge 143:86740a56073b 71 };
AnnaBridge 143:86740a56073b 72 /*@}*/
AnnaBridge 143:86740a56073b 73
AnnaBridge 143:86740a56073b 74 /*!
AnnaBridge 143:86740a56073b 75 * @name Flash configuration
AnnaBridge 143:86740a56073b 76 * @{
AnnaBridge 143:86740a56073b 77 */
AnnaBridge 143:86740a56073b 78 /*! @brief Indicates whether to support FlexNVM in the Flash driver */
AnnaBridge 143:86740a56073b 79 #if !defined(FLASH_SSD_CONFIG_ENABLE_FLEXNVM_SUPPORT)
AnnaBridge 143:86740a56073b 80 #define FLASH_SSD_CONFIG_ENABLE_FLEXNVM_SUPPORT 1 /*!< Enables the FlexNVM support by default. */
AnnaBridge 143:86740a56073b 81 #endif
AnnaBridge 143:86740a56073b 82
AnnaBridge 143:86740a56073b 83 /*! @brief Indicates whether the FlexNVM is enabled in the Flash driver */
AnnaBridge 143:86740a56073b 84 #define FLASH_SSD_IS_FLEXNVM_ENABLED (FLASH_SSD_CONFIG_ENABLE_FLEXNVM_SUPPORT && FSL_FEATURE_FLASH_HAS_FLEX_NVM)
AnnaBridge 143:86740a56073b 85
AnnaBridge 143:86740a56073b 86 /*! @brief Indicates whether to support Secondary flash in the Flash driver */
AnnaBridge 143:86740a56073b 87 #if !defined(FLASH_SSD_CONFIG_ENABLE_SECONDARY_FLASH_SUPPORT)
AnnaBridge 143:86740a56073b 88 #define FLASH_SSD_CONFIG_ENABLE_SECONDARY_FLASH_SUPPORT 1 /*!< Enables the secondary flash support by default. */
AnnaBridge 143:86740a56073b 89 #endif
AnnaBridge 143:86740a56073b 90
AnnaBridge 143:86740a56073b 91 /*! @brief Indicates whether the secondary flash is supported in the Flash driver */
AnnaBridge 143:86740a56073b 92 #if defined(FSL_FEATURE_FLASH_HAS_MULTIPLE_FLASH) || defined(FSL_FEATURE_FLASH_PFLASH_1_START_ADDRESS)
AnnaBridge 143:86740a56073b 93 #define FLASH_SSD_IS_SECONDARY_FLASH_ENABLED (FLASH_SSD_CONFIG_ENABLE_SECONDARY_FLASH_SUPPORT)
AnnaBridge 143:86740a56073b 94 #else
AnnaBridge 143:86740a56073b 95 #define FLASH_SSD_IS_SECONDARY_FLASH_ENABLED (0)
AnnaBridge 143:86740a56073b 96 #endif
AnnaBridge 143:86740a56073b 97
AnnaBridge 143:86740a56073b 98 /*! @brief Flash driver location. */
AnnaBridge 143:86740a56073b 99 #if !defined(FLASH_DRIVER_IS_FLASH_RESIDENT)
AnnaBridge 143:86740a56073b 100 #if (!defined(BL_TARGET_ROM) && !defined(BL_TARGET_RAM))
AnnaBridge 143:86740a56073b 101 #define FLASH_DRIVER_IS_FLASH_RESIDENT 1 /*!< Used for the flash resident application. */
AnnaBridge 143:86740a56073b 102 #else
AnnaBridge 143:86740a56073b 103 #define FLASH_DRIVER_IS_FLASH_RESIDENT 0 /*!< Used for the non-flash resident application. */
AnnaBridge 143:86740a56073b 104 #endif
AnnaBridge 143:86740a56073b 105 #endif
AnnaBridge 143:86740a56073b 106
AnnaBridge 143:86740a56073b 107 /*! @brief Flash Driver Export option */
AnnaBridge 143:86740a56073b 108 #if !defined(FLASH_DRIVER_IS_EXPORTED)
AnnaBridge 143:86740a56073b 109 #if (defined(BL_TARGET_ROM) || defined(BL_TARGET_FLASH))
AnnaBridge 143:86740a56073b 110 #define FLASH_DRIVER_IS_EXPORTED 1 /*!< Used for the ROM bootloader. */
AnnaBridge 143:86740a56073b 111 #else
AnnaBridge 143:86740a56073b 112 #define FLASH_DRIVER_IS_EXPORTED 0 /*!< Used for the MCUXpresso SDK application. */
AnnaBridge 143:86740a56073b 113 #endif
AnnaBridge 143:86740a56073b 114 #endif
AnnaBridge 143:86740a56073b 115 /*@}*/
AnnaBridge 143:86740a56073b 116
AnnaBridge 143:86740a56073b 117 /*!
AnnaBridge 143:86740a56073b 118 * @name Flash status
AnnaBridge 143:86740a56073b 119 * @{
AnnaBridge 143:86740a56073b 120 */
AnnaBridge 143:86740a56073b 121 /*! @brief Flash driver status group. */
AnnaBridge 143:86740a56073b 122 #if defined(kStatusGroup_FlashDriver)
AnnaBridge 143:86740a56073b 123 #define kStatusGroupGeneric kStatusGroup_Generic
AnnaBridge 143:86740a56073b 124 #define kStatusGroupFlashDriver kStatusGroup_FlashDriver
AnnaBridge 143:86740a56073b 125 #elif defined(kStatusGroup_FLASH)
AnnaBridge 143:86740a56073b 126 #define kStatusGroupGeneric kStatusGroup_Generic
AnnaBridge 143:86740a56073b 127 #define kStatusGroupFlashDriver kStatusGroup_FLASH
AnnaBridge 143:86740a56073b 128 #else
AnnaBridge 143:86740a56073b 129 #define kStatusGroupGeneric 0
AnnaBridge 143:86740a56073b 130 #define kStatusGroupFlashDriver 1
AnnaBridge 143:86740a56073b 131 #endif
AnnaBridge 143:86740a56073b 132
AnnaBridge 143:86740a56073b 133 /*! @brief Constructs a status code value from a group and a code number. */
AnnaBridge 143:86740a56073b 134 #if !defined(MAKE_STATUS)
AnnaBridge 143:86740a56073b 135 #define MAKE_STATUS(group, code) ((((group)*100) + (code)))
AnnaBridge 143:86740a56073b 136 #endif
AnnaBridge 143:86740a56073b 137
AnnaBridge 143:86740a56073b 138 /*!
AnnaBridge 143:86740a56073b 139 * @brief Flash driver status codes.
AnnaBridge 143:86740a56073b 140 */
AnnaBridge 143:86740a56073b 141 enum _flash_status
AnnaBridge 143:86740a56073b 142 {
AnnaBridge 143:86740a56073b 143 kStatus_FLASH_Success = MAKE_STATUS(kStatusGroupGeneric, 0), /*!< API is executed successfully*/
AnnaBridge 143:86740a56073b 144 kStatus_FLASH_InvalidArgument = MAKE_STATUS(kStatusGroupGeneric, 4), /*!< Invalid argument*/
AnnaBridge 143:86740a56073b 145 kStatus_FLASH_SizeError = MAKE_STATUS(kStatusGroupFlashDriver, 0), /*!< Error size*/
AnnaBridge 143:86740a56073b 146 kStatus_FLASH_AlignmentError =
AnnaBridge 143:86740a56073b 147 MAKE_STATUS(kStatusGroupFlashDriver, 1), /*!< Parameter is not aligned with the specified baseline*/
AnnaBridge 143:86740a56073b 148 kStatus_FLASH_AddressError = MAKE_STATUS(kStatusGroupFlashDriver, 2), /*!< Address is out of range */
AnnaBridge 143:86740a56073b 149 kStatus_FLASH_AccessError =
AnnaBridge 143:86740a56073b 150 MAKE_STATUS(kStatusGroupFlashDriver, 3), /*!< Invalid instruction codes and out-of bound addresses */
AnnaBridge 143:86740a56073b 151 kStatus_FLASH_ProtectionViolation = MAKE_STATUS(
AnnaBridge 143:86740a56073b 152 kStatusGroupFlashDriver, 4), /*!< The program/erase operation is requested to execute on protected areas */
AnnaBridge 143:86740a56073b 153 kStatus_FLASH_CommandFailure =
AnnaBridge 143:86740a56073b 154 MAKE_STATUS(kStatusGroupFlashDriver, 5), /*!< Run-time error during command execution. */
AnnaBridge 143:86740a56073b 155 kStatus_FLASH_UnknownProperty = MAKE_STATUS(kStatusGroupFlashDriver, 6), /*!< Unknown property.*/
AnnaBridge 143:86740a56073b 156 kStatus_FLASH_EraseKeyError = MAKE_STATUS(kStatusGroupFlashDriver, 7), /*!< API erase key is invalid.*/
AnnaBridge 143:86740a56073b 157 kStatus_FLASH_RegionExecuteOnly =
AnnaBridge 143:86740a56073b 158 MAKE_STATUS(kStatusGroupFlashDriver, 8), /*!< The current region is execute-only.*/
AnnaBridge 143:86740a56073b 159 kStatus_FLASH_ExecuteInRamFunctionNotReady =
AnnaBridge 143:86740a56073b 160 MAKE_STATUS(kStatusGroupFlashDriver, 9), /*!< Execute-in-RAM function is not available.*/
AnnaBridge 143:86740a56073b 161 kStatus_FLASH_PartitionStatusUpdateFailure =
AnnaBridge 143:86740a56073b 162 MAKE_STATUS(kStatusGroupFlashDriver, 10), /*!< Failed to update partition status.*/
AnnaBridge 143:86740a56073b 163 kStatus_FLASH_SetFlexramAsEepromError =
AnnaBridge 143:86740a56073b 164 MAKE_STATUS(kStatusGroupFlashDriver, 11), /*!< Failed to set FlexRAM as EEPROM.*/
AnnaBridge 143:86740a56073b 165 kStatus_FLASH_RecoverFlexramAsRamError =
AnnaBridge 143:86740a56073b 166 MAKE_STATUS(kStatusGroupFlashDriver, 12), /*!< Failed to recover FlexRAM as RAM.*/
AnnaBridge 143:86740a56073b 167 kStatus_FLASH_SetFlexramAsRamError = MAKE_STATUS(kStatusGroupFlashDriver, 13), /*!< Failed to set FlexRAM as RAM.*/
AnnaBridge 143:86740a56073b 168 kStatus_FLASH_RecoverFlexramAsEepromError =
AnnaBridge 143:86740a56073b 169 MAKE_STATUS(kStatusGroupFlashDriver, 14), /*!< Failed to recover FlexRAM as EEPROM.*/
AnnaBridge 143:86740a56073b 170 kStatus_FLASH_CommandNotSupported = MAKE_STATUS(kStatusGroupFlashDriver, 15), /*!< Flash API is not supported.*/
AnnaBridge 143:86740a56073b 171 kStatus_FLASH_SwapSystemNotInUninitialized =
AnnaBridge 143:86740a56073b 172 MAKE_STATUS(kStatusGroupFlashDriver, 16), /*!< Swap system is not in an uninitialzed state.*/
AnnaBridge 143:86740a56073b 173 kStatus_FLASH_SwapIndicatorAddressError =
AnnaBridge 143:86740a56073b 174 MAKE_STATUS(kStatusGroupFlashDriver, 17), /*!< The swap indicator address is invalid.*/
AnnaBridge 143:86740a56073b 175 kStatus_FLASH_ReadOnlyProperty = MAKE_STATUS(kStatusGroupFlashDriver, 18), /*!< The flash property is read-only.*/
AnnaBridge 143:86740a56073b 176 kStatus_FLASH_InvalidPropertyValue =
AnnaBridge 143:86740a56073b 177 MAKE_STATUS(kStatusGroupFlashDriver, 19), /*!< The flash property value is out of range.*/
AnnaBridge 143:86740a56073b 178 kStatus_FLASH_InvalidSpeculationOption =
AnnaBridge 143:86740a56073b 179 MAKE_STATUS(kStatusGroupFlashDriver, 20), /*!< The option of flash prefetch speculation is invalid.*/
AnnaBridge 143:86740a56073b 180 };
AnnaBridge 143:86740a56073b 181 /*@}*/
AnnaBridge 143:86740a56073b 182
AnnaBridge 143:86740a56073b 183 /*!
AnnaBridge 143:86740a56073b 184 * @name Flash API key
AnnaBridge 143:86740a56073b 185 * @{
AnnaBridge 143:86740a56073b 186 */
AnnaBridge 143:86740a56073b 187 /*! @brief Constructs the four character code for the Flash driver API key. */
AnnaBridge 143:86740a56073b 188 #if !defined(FOUR_CHAR_CODE)
AnnaBridge 143:86740a56073b 189 #define FOUR_CHAR_CODE(a, b, c, d) (((d) << 24) | ((c) << 16) | ((b) << 8) | ((a)))
AnnaBridge 143:86740a56073b 190 #endif
AnnaBridge 143:86740a56073b 191
AnnaBridge 143:86740a56073b 192 /*!
AnnaBridge 143:86740a56073b 193 * @brief Enumeration for Flash driver API keys.
AnnaBridge 143:86740a56073b 194 *
AnnaBridge 143:86740a56073b 195 * @note The resulting value is built with a byte order such that the string
AnnaBridge 143:86740a56073b 196 * being readable in expected order when viewed in a hex editor, if the value
AnnaBridge 143:86740a56073b 197 * is treated as a 32-bit little endian value.
AnnaBridge 143:86740a56073b 198 */
AnnaBridge 143:86740a56073b 199 enum _flash_driver_api_keys
AnnaBridge 143:86740a56073b 200 {
AnnaBridge 143:86740a56073b 201 kFLASH_ApiEraseKey = FOUR_CHAR_CODE('k', 'f', 'e', 'k') /*!< Key value used to validate all flash erase APIs.*/
AnnaBridge 143:86740a56073b 202 };
AnnaBridge 143:86740a56073b 203 /*@}*/
AnnaBridge 143:86740a56073b 204
AnnaBridge 143:86740a56073b 205 /*!
AnnaBridge 143:86740a56073b 206 * @brief Enumeration for supported flash margin levels.
AnnaBridge 143:86740a56073b 207 */
AnnaBridge 143:86740a56073b 208 typedef enum _flash_margin_value
AnnaBridge 143:86740a56073b 209 {
AnnaBridge 143:86740a56073b 210 kFLASH_MarginValueNormal, /*!< Use the 'normal' read level for 1s.*/
AnnaBridge 143:86740a56073b 211 kFLASH_MarginValueUser, /*!< Apply the 'User' margin to the normal read-1 level.*/
AnnaBridge 143:86740a56073b 212 kFLASH_MarginValueFactory, /*!< Apply the 'Factory' margin to the normal read-1 level.*/
AnnaBridge 143:86740a56073b 213 kFLASH_MarginValueInvalid /*!< Not real margin level, Used to determine the range of valid margin level. */
AnnaBridge 143:86740a56073b 214 } flash_margin_value_t;
AnnaBridge 143:86740a56073b 215
AnnaBridge 143:86740a56073b 216 /*!
AnnaBridge 143:86740a56073b 217 * @brief Enumeration for the three possible flash security states.
AnnaBridge 143:86740a56073b 218 */
AnnaBridge 143:86740a56073b 219 typedef enum _flash_security_state
AnnaBridge 143:86740a56073b 220 {
AnnaBridge 143:86740a56073b 221 kFLASH_SecurityStateNotSecure, /*!< Flash is not secure.*/
AnnaBridge 143:86740a56073b 222 kFLASH_SecurityStateBackdoorEnabled, /*!< Flash backdoor is enabled.*/
AnnaBridge 143:86740a56073b 223 kFLASH_SecurityStateBackdoorDisabled /*!< Flash backdoor is disabled.*/
AnnaBridge 143:86740a56073b 224 } flash_security_state_t;
AnnaBridge 143:86740a56073b 225
AnnaBridge 143:86740a56073b 226 /*!
AnnaBridge 143:86740a56073b 227 * @brief Enumeration for the three possible flash protection levels.
AnnaBridge 143:86740a56073b 228 */
AnnaBridge 143:86740a56073b 229 typedef enum _flash_protection_state
AnnaBridge 143:86740a56073b 230 {
AnnaBridge 143:86740a56073b 231 kFLASH_ProtectionStateUnprotected, /*!< Flash region is not protected.*/
AnnaBridge 143:86740a56073b 232 kFLASH_ProtectionStateProtected, /*!< Flash region is protected.*/
AnnaBridge 143:86740a56073b 233 kFLASH_ProtectionStateMixed /*!< Flash is mixed with protected and unprotected region.*/
AnnaBridge 143:86740a56073b 234 } flash_protection_state_t;
AnnaBridge 143:86740a56073b 235
AnnaBridge 143:86740a56073b 236 /*!
AnnaBridge 143:86740a56073b 237 * @brief Enumeration for the three possible flash execute access levels.
AnnaBridge 143:86740a56073b 238 */
AnnaBridge 143:86740a56073b 239 typedef enum _flash_execute_only_access_state
AnnaBridge 143:86740a56073b 240 {
AnnaBridge 143:86740a56073b 241 kFLASH_AccessStateUnLimited, /*!< Flash region is unlimited.*/
AnnaBridge 143:86740a56073b 242 kFLASH_AccessStateExecuteOnly, /*!< Flash region is execute only.*/
AnnaBridge 143:86740a56073b 243 kFLASH_AccessStateMixed /*!< Flash is mixed with unlimited and execute only region.*/
AnnaBridge 143:86740a56073b 244 } flash_execute_only_access_state_t;
AnnaBridge 143:86740a56073b 245
AnnaBridge 143:86740a56073b 246 /*!
AnnaBridge 143:86740a56073b 247 * @brief Enumeration for various flash properties.
AnnaBridge 143:86740a56073b 248 */
AnnaBridge 143:86740a56073b 249 typedef enum _flash_property_tag
AnnaBridge 143:86740a56073b 250 {
AnnaBridge 143:86740a56073b 251 kFLASH_PropertyPflashSectorSize = 0x00U, /*!< Pflash sector size property.*/
AnnaBridge 143:86740a56073b 252 kFLASH_PropertyPflashTotalSize = 0x01U, /*!< Pflash total size property.*/
AnnaBridge 143:86740a56073b 253 kFLASH_PropertyPflashBlockSize = 0x02U, /*!< Pflash block size property.*/
AnnaBridge 143:86740a56073b 254 kFLASH_PropertyPflashBlockCount = 0x03U, /*!< Pflash block count property.*/
AnnaBridge 143:86740a56073b 255 kFLASH_PropertyPflashBlockBaseAddr = 0x04U, /*!< Pflash block base address property.*/
AnnaBridge 143:86740a56073b 256 kFLASH_PropertyPflashFacSupport = 0x05U, /*!< Pflash fac support property.*/
AnnaBridge 143:86740a56073b 257 kFLASH_PropertyPflashAccessSegmentSize = 0x06U, /*!< Pflash access segment size property.*/
AnnaBridge 143:86740a56073b 258 kFLASH_PropertyPflashAccessSegmentCount = 0x07U, /*!< Pflash access segment count property.*/
AnnaBridge 143:86740a56073b 259 kFLASH_PropertyFlexRamBlockBaseAddr = 0x08U, /*!< FlexRam block base address property.*/
AnnaBridge 143:86740a56073b 260 kFLASH_PropertyFlexRamTotalSize = 0x09U, /*!< FlexRam total size property.*/
AnnaBridge 143:86740a56073b 261 kFLASH_PropertyDflashSectorSize = 0x10U, /*!< Dflash sector size property.*/
AnnaBridge 143:86740a56073b 262 kFLASH_PropertyDflashTotalSize = 0x11U, /*!< Dflash total size property.*/
AnnaBridge 143:86740a56073b 263 kFLASH_PropertyDflashBlockSize = 0x12U, /*!< Dflash block size property.*/
AnnaBridge 143:86740a56073b 264 kFLASH_PropertyDflashBlockCount = 0x13U, /*!< Dflash block count property.*/
AnnaBridge 143:86740a56073b 265 kFLASH_PropertyDflashBlockBaseAddr = 0x14U, /*!< Dflash block base address property.*/
AnnaBridge 143:86740a56073b 266 kFLASH_PropertyEepromTotalSize = 0x15U, /*!< EEPROM total size property.*/
AnnaBridge 143:86740a56073b 267 kFLASH_PropertyFlashMemoryIndex = 0x20U, /*!< Flash memory index property.*/
AnnaBridge 143:86740a56073b 268 kFLASH_PropertyFlashCacheControllerIndex = 0x21U /*!< Flash cache controller index property.*/
AnnaBridge 143:86740a56073b 269 } flash_property_tag_t;
AnnaBridge 143:86740a56073b 270
AnnaBridge 143:86740a56073b 271 /*!
AnnaBridge 143:86740a56073b 272 * @brief Constants for execute-in-RAM flash function.
AnnaBridge 143:86740a56073b 273 */
AnnaBridge 143:86740a56073b 274 enum _flash_execute_in_ram_function_constants
AnnaBridge 143:86740a56073b 275 {
AnnaBridge 143:86740a56073b 276 kFLASH_ExecuteInRamFunctionMaxSizeInWords = 16U, /*!< The maximum size of execute-in-RAM function.*/
AnnaBridge 143:86740a56073b 277 kFLASH_ExecuteInRamFunctionTotalNum = 2U /*!< Total number of execute-in-RAM functions.*/
AnnaBridge 143:86740a56073b 278 };
AnnaBridge 143:86740a56073b 279
AnnaBridge 143:86740a56073b 280 /*!
AnnaBridge 143:86740a56073b 281 * @brief Flash execute-in-RAM function information.
AnnaBridge 143:86740a56073b 282 */
AnnaBridge 143:86740a56073b 283 typedef struct _flash_execute_in_ram_function_config
AnnaBridge 143:86740a56073b 284 {
AnnaBridge 143:86740a56073b 285 uint32_t activeFunctionCount; /*!< Number of available execute-in-RAM functions.*/
AnnaBridge 143:86740a56073b 286 uint32_t *flashRunCommand; /*!< Execute-in-RAM function: flash_run_command.*/
AnnaBridge 143:86740a56073b 287 uint32_t *flashCommonBitOperation; /*!< Execute-in-RAM function: flash_common_bit_operation.*/
AnnaBridge 143:86740a56073b 288 } flash_execute_in_ram_function_config_t;
AnnaBridge 143:86740a56073b 289
AnnaBridge 143:86740a56073b 290 /*!
AnnaBridge 143:86740a56073b 291 * @brief Enumeration for the two possible options of flash read resource command.
AnnaBridge 143:86740a56073b 292 */
AnnaBridge 143:86740a56073b 293 typedef enum _flash_read_resource_option
AnnaBridge 143:86740a56073b 294 {
AnnaBridge 143:86740a56073b 295 kFLASH_ResourceOptionFlashIfr =
AnnaBridge 143:86740a56073b 296 0x00U, /*!< Select code for Program flash 0 IFR, Program flash swap 0 IFR, Data flash 0 IFR */
AnnaBridge 143:86740a56073b 297 kFLASH_ResourceOptionVersionId = 0x01U /*!< Select code for the version ID*/
AnnaBridge 143:86740a56073b 298 } flash_read_resource_option_t;
AnnaBridge 143:86740a56073b 299
AnnaBridge 143:86740a56073b 300 /*!
AnnaBridge 143:86740a56073b 301 * @brief Enumeration for the range of special-purpose flash resource
AnnaBridge 143:86740a56073b 302 */
AnnaBridge 143:86740a56073b 303 enum _flash_read_resource_range
AnnaBridge 143:86740a56073b 304 {
AnnaBridge 143:86740a56073b 305 #if (FSL_FEATURE_FLASH_IS_FTFE == 1)
AnnaBridge 143:86740a56073b 306 kFLASH_ResourceRangePflashIfrSizeInBytes = 1024U, /*!< Pflash IFR size in byte.*/
AnnaBridge 143:86740a56073b 307 kFLASH_ResourceRangeVersionIdSizeInBytes = 8U, /*!< Version ID IFR size in byte.*/
AnnaBridge 143:86740a56073b 308 kFLASH_ResourceRangeVersionIdStart = 0x08U, /*!< Version ID IFR start address.*/
AnnaBridge 143:86740a56073b 309 kFLASH_ResourceRangeVersionIdEnd = 0x0FU, /*!< Version ID IFR end address.*/
AnnaBridge 143:86740a56073b 310 kFLASH_ResourceRangePflashSwapIfrStart = 0x40000U, /*!< Pflash swap IFR start address.*/
AnnaBridge 143:86740a56073b 311 kFLASH_ResourceRangePflashSwapIfrEnd =
AnnaBridge 143:86740a56073b 312 (kFLASH_ResourceRangePflashSwapIfrStart + 0x3FFU), /*!< Pflash swap IFR end address.*/
AnnaBridge 143:86740a56073b 313 #else /* FSL_FEATURE_FLASH_IS_FTFL == 1 or FSL_FEATURE_FLASH_IS_FTFA = =1 */
AnnaBridge 143:86740a56073b 314 kFLASH_ResourceRangePflashIfrSizeInBytes = 256U, /*!< Pflash IFR size in byte.*/
AnnaBridge 143:86740a56073b 315 kFLASH_ResourceRangeVersionIdSizeInBytes = 8U, /*!< Version ID IFR size in byte.*/
AnnaBridge 143:86740a56073b 316 kFLASH_ResourceRangeVersionIdStart = 0x00U, /*!< Version ID IFR start address.*/
AnnaBridge 143:86740a56073b 317 kFLASH_ResourceRangeVersionIdEnd = 0x07U, /*!< Version ID IFR end address.*/
AnnaBridge 143:86740a56073b 318 #if 0x20000U == (FSL_FEATURE_FLASH_PFLASH_BLOCK_COUNT * FSL_FEATURE_FLASH_PFLASH_BLOCK_SIZE)
AnnaBridge 143:86740a56073b 319 kFLASH_ResourceRangePflashSwapIfrStart = 0x8000U, /*!< Pflash swap IFR start address.*/
AnnaBridge 143:86740a56073b 320 #elif 0x40000U == (FSL_FEATURE_FLASH_PFLASH_BLOCK_COUNT * FSL_FEATURE_FLASH_PFLASH_BLOCK_SIZE)
AnnaBridge 143:86740a56073b 321 kFLASH_ResourceRangePflashSwapIfrStart = 0x10000U, /*!< Pflash swap IFR start address.*/
AnnaBridge 143:86740a56073b 322 #elif 0x80000U == (FSL_FEATURE_FLASH_PFLASH_BLOCK_COUNT * FSL_FEATURE_FLASH_PFLASH_BLOCK_SIZE)
AnnaBridge 143:86740a56073b 323 kFLASH_ResourceRangePflashSwapIfrStart = 0x20000U, /*!< Pflash swap IFR start address.*/
AnnaBridge 143:86740a56073b 324 #else
AnnaBridge 143:86740a56073b 325 kFLASH_ResourceRangePflashSwapIfrStart = 0,
AnnaBridge 143:86740a56073b 326 #endif
AnnaBridge 143:86740a56073b 327 kFLASH_ResourceRangePflashSwapIfrEnd =
AnnaBridge 143:86740a56073b 328 (kFLASH_ResourceRangePflashSwapIfrStart + 0xFFU), /*!< Pflash swap IFR end address.*/
AnnaBridge 143:86740a56073b 329 #endif
AnnaBridge 143:86740a56073b 330 kFLASH_ResourceRangeDflashIfrStart = 0x800000U, /*!< Dflash IFR start address.*/
AnnaBridge 143:86740a56073b 331 kFLASH_ResourceRangeDflashIfrEnd = 0x8003FFU, /*!< Dflash IFR end address.*/
AnnaBridge 143:86740a56073b 332 };
AnnaBridge 143:86740a56073b 333
AnnaBridge 143:86740a56073b 334 /*!
AnnaBridge 143:86740a56073b 335 * @brief Enumeration for the index of read/program once record
AnnaBridge 143:86740a56073b 336 */
AnnaBridge 143:86740a56073b 337 enum _k3_flash_read_once_index
AnnaBridge 143:86740a56073b 338 {
AnnaBridge 143:86740a56073b 339 kFLASH_RecordIndexSwapAddr = 0xA1U, /*!< Index of Swap indicator address.*/
AnnaBridge 143:86740a56073b 340 kFLASH_RecordIndexSwapEnable = 0xA2U, /*!< Index of Swap system enable.*/
AnnaBridge 143:86740a56073b 341 kFLASH_RecordIndexSwapDisable = 0xA3U, /*!< Index of Swap system disable.*/
AnnaBridge 143:86740a56073b 342 };
AnnaBridge 143:86740a56073b 343
AnnaBridge 143:86740a56073b 344 /*!
AnnaBridge 143:86740a56073b 345 * @brief Enumeration for the two possilbe options of set FlexRAM function command.
AnnaBridge 143:86740a56073b 346 */
AnnaBridge 143:86740a56073b 347 typedef enum _flash_flexram_function_option
AnnaBridge 143:86740a56073b 348 {
AnnaBridge 143:86740a56073b 349 kFLASH_FlexramFunctionOptionAvailableAsRam = 0xFFU, /*!< An option used to make FlexRAM available as RAM */
AnnaBridge 143:86740a56073b 350 kFLASH_FlexramFunctionOptionAvailableForEeprom = 0x00U /*!< An option used to make FlexRAM available for EEPROM */
AnnaBridge 143:86740a56073b 351 } flash_flexram_function_option_t;
AnnaBridge 143:86740a56073b 352
AnnaBridge 143:86740a56073b 353 /*!
AnnaBridge 143:86740a56073b 354 * @brief Enumeration for acceleration RAM property.
AnnaBridge 143:86740a56073b 355 */
AnnaBridge 143:86740a56073b 356 enum _flash_acceleration_ram_property
AnnaBridge 143:86740a56073b 357 {
AnnaBridge 143:86740a56073b 358 kFLASH_AccelerationRamSize = 0x400U
AnnaBridge 143:86740a56073b 359 };
AnnaBridge 143:86740a56073b 360
AnnaBridge 143:86740a56073b 361 /*!
AnnaBridge 143:86740a56073b 362 * @brief Enumeration for the possible options of Swap function
AnnaBridge 143:86740a56073b 363 */
AnnaBridge 143:86740a56073b 364 typedef enum _flash_swap_function_option
AnnaBridge 143:86740a56073b 365 {
AnnaBridge 143:86740a56073b 366 kFLASH_SwapFunctionOptionEnable = 0x00U, /*!< An option used to enable the Swap function */
AnnaBridge 143:86740a56073b 367 kFLASH_SwapFunctionOptionDisable = 0x01U /*!< An option used to disable the Swap function */
AnnaBridge 143:86740a56073b 368 } flash_swap_function_option_t;
AnnaBridge 143:86740a56073b 369
AnnaBridge 143:86740a56073b 370 /*!
AnnaBridge 143:86740a56073b 371 * @brief Enumeration for the possible options of Swap control commands
AnnaBridge 143:86740a56073b 372 */
AnnaBridge 143:86740a56073b 373 typedef enum _flash_swap_control_option
AnnaBridge 143:86740a56073b 374 {
AnnaBridge 143:86740a56073b 375 kFLASH_SwapControlOptionIntializeSystem = 0x01U, /*!< An option used to initialize the Swap system */
AnnaBridge 143:86740a56073b 376 kFLASH_SwapControlOptionSetInUpdateState = 0x02U, /*!< An option used to set the Swap in an update state */
AnnaBridge 143:86740a56073b 377 kFLASH_SwapControlOptionSetInCompleteState = 0x04U, /*!< An option used to set the Swap in a complete state */
AnnaBridge 143:86740a56073b 378 kFLASH_SwapControlOptionReportStatus = 0x08U, /*!< An option used to report the Swap status */
AnnaBridge 143:86740a56073b 379 kFLASH_SwapControlOptionDisableSystem = 0x10U /*!< An option used to disable the Swap status */
AnnaBridge 143:86740a56073b 380 } flash_swap_control_option_t;
AnnaBridge 143:86740a56073b 381
AnnaBridge 143:86740a56073b 382 /*!
AnnaBridge 143:86740a56073b 383 * @brief Enumeration for the possible flash Swap status.
AnnaBridge 143:86740a56073b 384 */
AnnaBridge 143:86740a56073b 385 typedef enum _flash_swap_state
AnnaBridge 143:86740a56073b 386 {
AnnaBridge 143:86740a56073b 387 kFLASH_SwapStateUninitialized = 0x00U, /*!< Flash Swap system is in an uninitialized state.*/
AnnaBridge 143:86740a56073b 388 kFLASH_SwapStateReady = 0x01U, /*!< Flash Swap system is in a ready state.*/
AnnaBridge 143:86740a56073b 389 kFLASH_SwapStateUpdate = 0x02U, /*!< Flash Swap system is in an update state.*/
AnnaBridge 143:86740a56073b 390 kFLASH_SwapStateUpdateErased = 0x03U, /*!< Flash Swap system is in an updateErased state.*/
AnnaBridge 143:86740a56073b 391 kFLASH_SwapStateComplete = 0x04U, /*!< Flash Swap system is in a complete state.*/
AnnaBridge 143:86740a56073b 392 kFLASH_SwapStateDisabled = 0x05U /*!< Flash Swap system is in a disabled state.*/
AnnaBridge 143:86740a56073b 393 } flash_swap_state_t;
AnnaBridge 143:86740a56073b 394
AnnaBridge 143:86740a56073b 395 /*!
AnnaBridge 143:86740a56073b 396 * @breif Enumeration for the possible flash Swap block status
AnnaBridge 143:86740a56073b 397 */
AnnaBridge 143:86740a56073b 398 typedef enum _flash_swap_block_status
AnnaBridge 143:86740a56073b 399 {
AnnaBridge 143:86740a56073b 400 kFLASH_SwapBlockStatusLowerHalfProgramBlocksAtZero =
AnnaBridge 143:86740a56073b 401 0x00U, /*!< Swap block status is that lower half program block at zero.*/
AnnaBridge 143:86740a56073b 402 kFLASH_SwapBlockStatusUpperHalfProgramBlocksAtZero =
AnnaBridge 143:86740a56073b 403 0x01U, /*!< Swap block status is that upper half program block at zero.*/
AnnaBridge 143:86740a56073b 404 } flash_swap_block_status_t;
AnnaBridge 143:86740a56073b 405
AnnaBridge 143:86740a56073b 406 /*!
AnnaBridge 143:86740a56073b 407 * @brief Flash Swap information
AnnaBridge 143:86740a56073b 408 */
AnnaBridge 143:86740a56073b 409 typedef struct _flash_swap_state_config
AnnaBridge 143:86740a56073b 410 {
AnnaBridge 143:86740a56073b 411 flash_swap_state_t flashSwapState; /*!<The current Swap system status.*/
AnnaBridge 143:86740a56073b 412 flash_swap_block_status_t currentSwapBlockStatus; /*!< The current Swap block status.*/
AnnaBridge 143:86740a56073b 413 flash_swap_block_status_t nextSwapBlockStatus; /*!< The next Swap block status.*/
AnnaBridge 143:86740a56073b 414 } flash_swap_state_config_t;
AnnaBridge 143:86740a56073b 415
AnnaBridge 143:86740a56073b 416 /*!
AnnaBridge 143:86740a56073b 417 * @brief Flash Swap IFR fields
AnnaBridge 143:86740a56073b 418 */
AnnaBridge 143:86740a56073b 419 typedef struct _flash_swap_ifr_field_config
AnnaBridge 143:86740a56073b 420 {
AnnaBridge 143:86740a56073b 421 uint16_t swapIndicatorAddress; /*!< A Swap indicator address field.*/
AnnaBridge 143:86740a56073b 422 uint16_t swapEnableWord; /*!< A Swap enable word field.*/
AnnaBridge 143:86740a56073b 423 uint8_t reserved0[4]; /*!< A reserved field.*/
AnnaBridge 143:86740a56073b 424 #if (FSL_FEATURE_FLASH_IS_FTFE == 1)
AnnaBridge 143:86740a56073b 425 uint8_t reserved1[2]; /*!< A reserved field.*/
AnnaBridge 143:86740a56073b 426 uint16_t swapDisableWord; /*!< A Swap disable word field.*/
AnnaBridge 143:86740a56073b 427 uint8_t reserved2[4]; /*!< A reserved field.*/
AnnaBridge 143:86740a56073b 428 #endif
AnnaBridge 143:86740a56073b 429 } flash_swap_ifr_field_config_t;
AnnaBridge 143:86740a56073b 430
AnnaBridge 143:86740a56073b 431 /*!
AnnaBridge 143:86740a56073b 432 * @brief Flash Swap IFR field data
AnnaBridge 143:86740a56073b 433 */
AnnaBridge 143:86740a56073b 434 typedef union _flash_swap_ifr_field_data
AnnaBridge 143:86740a56073b 435 {
AnnaBridge 143:86740a56073b 436 uint32_t flashSwapIfrData[2]; /*!< A flash Swap IFR field data .*/
AnnaBridge 143:86740a56073b 437 flash_swap_ifr_field_config_t flashSwapIfrField; /*!< A flash Swap IFR field structure.*/
AnnaBridge 143:86740a56073b 438 } flash_swap_ifr_field_data_t;
AnnaBridge 143:86740a56073b 439
AnnaBridge 143:86740a56073b 440 /*!
AnnaBridge 143:86740a56073b 441 * @brief PFlash protection status - low 32bit
AnnaBridge 143:86740a56073b 442 */
AnnaBridge 143:86740a56073b 443 typedef union _pflash_protection_status_low
AnnaBridge 143:86740a56073b 444 {
AnnaBridge 143:86740a56073b 445 uint32_t protl32b; /*!< PROT[31:0] .*/
AnnaBridge 143:86740a56073b 446 struct
AnnaBridge 143:86740a56073b 447 {
AnnaBridge 143:86740a56073b 448 uint8_t protsl; /*!< PROTS[7:0] .*/
AnnaBridge 143:86740a56073b 449 uint8_t protsh; /*!< PROTS[15:8] .*/
AnnaBridge 143:86740a56073b 450 uint8_t reserved[2];
AnnaBridge 143:86740a56073b 451 } prots16b;
AnnaBridge 143:86740a56073b 452 } pflash_protection_status_low_t;
AnnaBridge 143:86740a56073b 453
AnnaBridge 143:86740a56073b 454 /*!
AnnaBridge 143:86740a56073b 455 * @brief PFlash protection status - full
AnnaBridge 143:86740a56073b 456 */
AnnaBridge 143:86740a56073b 457 typedef struct _pflash_protection_status
AnnaBridge 143:86740a56073b 458 {
AnnaBridge 143:86740a56073b 459 pflash_protection_status_low_t valueLow32b; /*!< PROT[31:0] or PROTS[15:0].*/
AnnaBridge 143:86740a56073b 460 #if ((FSL_FEATURE_FLASH_IS_FTFA == 1) && (defined(FTFA_FPROTH0_PROT_MASK))) || \
AnnaBridge 143:86740a56073b 461 ((FSL_FEATURE_FLASH_IS_FTFE == 1) && (defined(FTFE_FPROTH0_PROT_MASK))) || \
AnnaBridge 143:86740a56073b 462 ((FSL_FEATURE_FLASH_IS_FTFL == 1) && (defined(FTFL_FPROTH0_PROT_MASK)))
AnnaBridge 143:86740a56073b 463 // uint32_t protHigh; /*!< PROT[63:32].*/
AnnaBridge 143:86740a56073b 464 struct
AnnaBridge 143:86740a56073b 465 {
AnnaBridge 143:86740a56073b 466 uint32_t proth32b;
AnnaBridge 143:86740a56073b 467 } valueHigh32b;
AnnaBridge 143:86740a56073b 468 #endif
AnnaBridge 143:86740a56073b 469 } pflash_protection_status_t;
AnnaBridge 143:86740a56073b 470
AnnaBridge 143:86740a56073b 471 /*!
AnnaBridge 143:86740a56073b 472 * @brief Enumeration for the FlexRAM load during reset option.
AnnaBridge 143:86740a56073b 473 */
AnnaBridge 143:86740a56073b 474 typedef enum _flash_partition_flexram_load_option
AnnaBridge 143:86740a56073b 475 {
AnnaBridge 143:86740a56073b 476 kFLASH_PartitionFlexramLoadOptionLoadedWithValidEepromData =
AnnaBridge 143:86740a56073b 477 0x00U, /*!< FlexRAM is loaded with valid EEPROM data during reset sequence.*/
AnnaBridge 143:86740a56073b 478 kFLASH_PartitionFlexramLoadOptionNotLoaded = 0x01U /*!< FlexRAM is not loaded during reset sequence.*/
AnnaBridge 143:86740a56073b 479 } flash_partition_flexram_load_option_t;
AnnaBridge 143:86740a56073b 480
AnnaBridge 143:86740a56073b 481 /*!
AnnaBridge 143:86740a56073b 482 * @brief Enumeration for the flash memory index.
AnnaBridge 143:86740a56073b 483 */
AnnaBridge 143:86740a56073b 484 typedef enum _flash_memory_index
AnnaBridge 143:86740a56073b 485 {
AnnaBridge 143:86740a56073b 486 kFLASH_MemoryIndexPrimaryFlash = 0x00U, /*!< Current flash memory is primary flash.*/
AnnaBridge 143:86740a56073b 487 kFLASH_MemoryIndexSecondaryFlash = 0x01U, /*!< Current flash memory is secondary flash.*/
AnnaBridge 143:86740a56073b 488 } flash_memory_index_t;
AnnaBridge 143:86740a56073b 489
AnnaBridge 143:86740a56073b 490 /*!
AnnaBridge 143:86740a56073b 491 * @brief Enumeration for the flash cache controller index.
AnnaBridge 143:86740a56073b 492 */
AnnaBridge 143:86740a56073b 493 typedef enum _flash_cache_controller_index
AnnaBridge 143:86740a56073b 494 {
AnnaBridge 143:86740a56073b 495 kFLASH_CacheControllerIndexForCore0 = 0x00U, /*!< Current flash cache controller is for core 0.*/
AnnaBridge 143:86740a56073b 496 kFLASH_CacheControllerIndexForCore1 = 0x01U, /*!< Current flash cache controller is for core 1.*/
AnnaBridge 143:86740a56073b 497 } flash_cache_controller_index_t;
AnnaBridge 143:86740a56073b 498
AnnaBridge 143:86740a56073b 499 /*! @brief A callback type used for the Pflash block*/
AnnaBridge 143:86740a56073b 500 typedef void (*flash_callback_t)(void);
AnnaBridge 143:86740a56073b 501
AnnaBridge 143:86740a56073b 502 /*!
AnnaBridge 143:86740a56073b 503 * @brief Enumeration for the two possible options of flash prefetch speculation.
AnnaBridge 143:86740a56073b 504 */
AnnaBridge 143:86740a56073b 505 typedef enum _flash_prefetch_speculation_option
AnnaBridge 143:86740a56073b 506 {
AnnaBridge 143:86740a56073b 507 kFLASH_prefetchSpeculationOptionEnable = 0x00U,
AnnaBridge 143:86740a56073b 508 kFLASH_prefetchSpeculationOptionDisable = 0x01U
AnnaBridge 143:86740a56073b 509 } flash_prefetch_speculation_option_t;
AnnaBridge 143:86740a56073b 510
AnnaBridge 143:86740a56073b 511 /*!
AnnaBridge 143:86740a56073b 512 * @brief Flash prefetch speculation status.
AnnaBridge 143:86740a56073b 513 */
AnnaBridge 143:86740a56073b 514 typedef struct _flash_prefetch_speculation_status
AnnaBridge 143:86740a56073b 515 {
AnnaBridge 143:86740a56073b 516 flash_prefetch_speculation_option_t instructionOption; /*!< Instruction speculation.*/
AnnaBridge 143:86740a56073b 517 flash_prefetch_speculation_option_t dataOption; /*!< Data speculation.*/
AnnaBridge 143:86740a56073b 518 } flash_prefetch_speculation_status_t;
AnnaBridge 143:86740a56073b 519
AnnaBridge 143:86740a56073b 520 /*!
AnnaBridge 143:86740a56073b 521 * @brief Flash cache clear process code.
AnnaBridge 143:86740a56073b 522 */
AnnaBridge 143:86740a56073b 523 typedef enum _flash_cache_clear_process
AnnaBridge 143:86740a56073b 524 {
AnnaBridge 143:86740a56073b 525 kFLASH_CacheClearProcessPre = 0x00U, /*!< Pre flash cache clear process.*/
AnnaBridge 143:86740a56073b 526 kFLASH_CacheClearProcessPost = 0x01U, /*!< Post flash cache clear process.*/
AnnaBridge 143:86740a56073b 527 } flash_cache_clear_process_t;
AnnaBridge 143:86740a56073b 528
AnnaBridge 143:86740a56073b 529 /*!
AnnaBridge 143:86740a56073b 530 * @brief Active flash protection information for the current operation.
AnnaBridge 143:86740a56073b 531 */
AnnaBridge 143:86740a56073b 532 typedef struct _flash_protection_config
AnnaBridge 143:86740a56073b 533 {
AnnaBridge 143:86740a56073b 534 uint32_t regionBase; /*!< Base address of flash protection region.*/
AnnaBridge 143:86740a56073b 535 uint32_t regionSize; /*!< size of flash protection region.*/
AnnaBridge 143:86740a56073b 536 uint32_t regionCount; /*!< flash protection region count.*/
AnnaBridge 143:86740a56073b 537 } flash_protection_config_t;
AnnaBridge 143:86740a56073b 538
AnnaBridge 143:86740a56073b 539 /*!
AnnaBridge 143:86740a56073b 540 * @brief Active flash Execute-Only access information for the current operation.
AnnaBridge 143:86740a56073b 541 */
AnnaBridge 143:86740a56073b 542 typedef struct _flash_access_config
AnnaBridge 143:86740a56073b 543 {
AnnaBridge 143:86740a56073b 544 uint32_t SegmentBase; /*!< Base address of flash Execute-Only segment.*/
AnnaBridge 143:86740a56073b 545 uint32_t SegmentSize; /*!< size of flash Execute-Only segment.*/
AnnaBridge 143:86740a56073b 546 uint32_t SegmentCount; /*!< flash Execute-Only segment count.*/
AnnaBridge 143:86740a56073b 547 } flash_access_config_t;
AnnaBridge 143:86740a56073b 548
AnnaBridge 143:86740a56073b 549 /*!
AnnaBridge 143:86740a56073b 550 * @brief Active flash information for the current operation.
AnnaBridge 143:86740a56073b 551 */
AnnaBridge 143:86740a56073b 552 typedef struct _flash_operation_config
AnnaBridge 143:86740a56073b 553 {
AnnaBridge 143:86740a56073b 554 uint32_t convertedAddress; /*!< A converted address for the current flash type.*/
AnnaBridge 143:86740a56073b 555 uint32_t activeSectorSize; /*!< A sector size of the current flash type.*/
AnnaBridge 143:86740a56073b 556 uint32_t activeBlockSize; /*!< A block size of the current flash type.*/
AnnaBridge 143:86740a56073b 557 uint32_t blockWriteUnitSize; /*!< The write unit size.*/
AnnaBridge 143:86740a56073b 558 uint32_t sectorCmdAddressAligment; /*!< An erase sector command address alignment.*/
AnnaBridge 143:86740a56073b 559 uint32_t sectionCmdAddressAligment; /*!< A program/verify section command address alignment.*/
AnnaBridge 143:86740a56073b 560 uint32_t resourceCmdAddressAligment; /*!< A read resource command address alignment.*/
AnnaBridge 143:86740a56073b 561 uint32_t checkCmdAddressAligment; /*!< A program check command address alignment.*/
AnnaBridge 143:86740a56073b 562 } flash_operation_config_t;
AnnaBridge 143:86740a56073b 563
AnnaBridge 143:86740a56073b 564 /*! @brief Flash driver state information.
AnnaBridge 143:86740a56073b 565 *
AnnaBridge 143:86740a56073b 566 * An instance of this structure is allocated by the user of the flash driver and
AnnaBridge 143:86740a56073b 567 * passed into each of the driver APIs.
AnnaBridge 143:86740a56073b 568 */
AnnaBridge 143:86740a56073b 569 typedef struct _flash_config
AnnaBridge 143:86740a56073b 570 {
AnnaBridge 143:86740a56073b 571 uint32_t PFlashBlockBase; /*!< A base address of the first PFlash block */
AnnaBridge 143:86740a56073b 572 uint32_t PFlashTotalSize; /*!< The size of the combined PFlash block. */
AnnaBridge 143:86740a56073b 573 uint8_t PFlashBlockCount; /*!< A number of PFlash blocks. */
AnnaBridge 143:86740a56073b 574 uint8_t FlashMemoryIndex; /*!< 0 - primary flash; 1 - secondary flash*/
AnnaBridge 143:86740a56073b 575 uint8_t FlashCacheControllerIndex; /*!< 0 - Controller for core 0; 1 - Controller for core 1 */
AnnaBridge 143:86740a56073b 576 uint8_t Reserved0; /*!< Reserved field 0 */
AnnaBridge 143:86740a56073b 577 uint32_t PFlashSectorSize; /*!< The size in bytes of a sector of PFlash. */
AnnaBridge 143:86740a56073b 578 flash_callback_t PFlashCallback; /*!< The callback function for the flash API. */
AnnaBridge 143:86740a56073b 579 uint32_t PFlashAccessSegmentSize; /*!< A size in bytes of an access segment of PFlash. */
AnnaBridge 143:86740a56073b 580 uint32_t PFlashAccessSegmentCount; /*!< A number of PFlash access segments. */
AnnaBridge 143:86740a56073b 581 uint32_t *flashExecuteInRamFunctionInfo; /*!< An information structure of the flash execute-in-RAM function. */
AnnaBridge 143:86740a56073b 582 uint32_t FlexRAMBlockBase; /*!< For the FlexNVM device, this is the base address of the FlexRAM */
AnnaBridge 143:86740a56073b 583 /*!< For the non-FlexNVM device, this is the base address of the acceleration RAM memory */
AnnaBridge 143:86740a56073b 584 uint32_t FlexRAMTotalSize; /*!< For the FlexNVM device, this is the size of the FlexRAM */
AnnaBridge 143:86740a56073b 585 /*!< For the non-FlexNVM device, this is the size of the acceleration RAM memory */
AnnaBridge 143:86740a56073b 586 uint32_t
AnnaBridge 143:86740a56073b 587 DFlashBlockBase; /*!< For the FlexNVM device, this is the base address of the D-Flash memory (FlexNVM memory) */
AnnaBridge 143:86740a56073b 588 /*!< For the non-FlexNVM device, this field is unused */
AnnaBridge 143:86740a56073b 589 uint32_t DFlashTotalSize; /*!< For the FlexNVM device, this is the total size of the FlexNVM memory; */
AnnaBridge 143:86740a56073b 590 /*!< For the non-FlexNVM device, this field is unused */
AnnaBridge 143:86740a56073b 591 uint32_t EEpromTotalSize; /*!< For the FlexNVM device, this is the size in bytes of the EEPROM area which was
AnnaBridge 143:86740a56073b 592 partitioned from FlexRAM */
AnnaBridge 143:86740a56073b 593 /*!< For the non-FlexNVM device, this field is unused */
AnnaBridge 143:86740a56073b 594 } flash_config_t;
AnnaBridge 143:86740a56073b 595
AnnaBridge 143:86740a56073b 596 /*******************************************************************************
AnnaBridge 143:86740a56073b 597 * API
AnnaBridge 143:86740a56073b 598 ******************************************************************************/
AnnaBridge 143:86740a56073b 599
AnnaBridge 143:86740a56073b 600 #if defined(__cplusplus)
AnnaBridge 143:86740a56073b 601 extern "C" {
AnnaBridge 143:86740a56073b 602 #endif
AnnaBridge 143:86740a56073b 603
AnnaBridge 143:86740a56073b 604 /*!
AnnaBridge 143:86740a56073b 605 * @name Initialization
AnnaBridge 143:86740a56073b 606 * @{
AnnaBridge 143:86740a56073b 607 */
AnnaBridge 143:86740a56073b 608
AnnaBridge 143:86740a56073b 609 /*!
AnnaBridge 143:86740a56073b 610 * @brief Initializes the global flash properties structure members.
AnnaBridge 143:86740a56073b 611 *
AnnaBridge 143:86740a56073b 612 * This function checks and initializes the Flash module for the other Flash APIs.
AnnaBridge 143:86740a56073b 613 *
AnnaBridge 143:86740a56073b 614 * @param config Pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 615 *
AnnaBridge 143:86740a56073b 616 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 617 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 618 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 619 * @retval #kStatus_FLASH_PartitionStatusUpdateFailure Failed to update the partition status.
AnnaBridge 143:86740a56073b 620 */
AnnaBridge 143:86740a56073b 621 status_t FLASH_Init(flash_config_t *config);
AnnaBridge 143:86740a56073b 622
AnnaBridge 143:86740a56073b 623 /*!
AnnaBridge 143:86740a56073b 624 * @brief Sets the desired flash callback function.
AnnaBridge 143:86740a56073b 625 *
AnnaBridge 143:86740a56073b 626 * @param config Pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 627 * @param callback A callback function to be stored in the driver.
AnnaBridge 143:86740a56073b 628 *
AnnaBridge 143:86740a56073b 629 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 630 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 631 */
AnnaBridge 143:86740a56073b 632 status_t FLASH_SetCallback(flash_config_t *config, flash_callback_t callback);
AnnaBridge 143:86740a56073b 633
AnnaBridge 143:86740a56073b 634 /*!
AnnaBridge 143:86740a56073b 635 * @brief Prepares flash execute-in-RAM functions.
AnnaBridge 143:86740a56073b 636 *
AnnaBridge 143:86740a56073b 637 * @param config Pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 638 *
AnnaBridge 143:86740a56073b 639 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 640 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 641 */
AnnaBridge 143:86740a56073b 642 #if FLASH_DRIVER_IS_FLASH_RESIDENT
AnnaBridge 143:86740a56073b 643 status_t FLASH_PrepareExecuteInRamFunctions(flash_config_t *config);
AnnaBridge 143:86740a56073b 644 #endif
AnnaBridge 143:86740a56073b 645
AnnaBridge 143:86740a56073b 646 /*@}*/
AnnaBridge 143:86740a56073b 647
AnnaBridge 143:86740a56073b 648 /*!
AnnaBridge 143:86740a56073b 649 * @name Erasing
AnnaBridge 143:86740a56073b 650 * @{
AnnaBridge 143:86740a56073b 651 */
AnnaBridge 143:86740a56073b 652
AnnaBridge 143:86740a56073b 653 /*!
AnnaBridge 143:86740a56073b 654 * @brief Erases entire flash
AnnaBridge 143:86740a56073b 655 *
AnnaBridge 143:86740a56073b 656 * @param config Pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 657 * @param key A value used to validate all flash erase APIs.
AnnaBridge 143:86740a56073b 658 *
AnnaBridge 143:86740a56073b 659 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 660 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 661 * @retval #kStatus_FLASH_EraseKeyError API erase key is invalid.
AnnaBridge 143:86740a56073b 662 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 663 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 664 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 665 * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution.
AnnaBridge 143:86740a56073b 666 * @retval #kStatus_FLASH_PartitionStatusUpdateFailure Failed to update the partition status.
AnnaBridge 143:86740a56073b 667 */
AnnaBridge 143:86740a56073b 668 status_t FLASH_EraseAll(flash_config_t *config, uint32_t key);
AnnaBridge 143:86740a56073b 669
AnnaBridge 143:86740a56073b 670 /*!
AnnaBridge 143:86740a56073b 671 * @brief Erases the flash sectors encompassed by parameters passed into function.
AnnaBridge 143:86740a56073b 672 *
AnnaBridge 143:86740a56073b 673 * This function erases the appropriate number of flash sectors based on the
AnnaBridge 143:86740a56073b 674 * desired start address and length.
AnnaBridge 143:86740a56073b 675 *
AnnaBridge 143:86740a56073b 676 * @param config The pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 677 * @param start The start address of the desired flash memory to be erased.
AnnaBridge 143:86740a56073b 678 * The start address does not need to be sector-aligned but must be word-aligned.
AnnaBridge 143:86740a56073b 679 * @param lengthInBytes The length, given in bytes (not words or long-words)
AnnaBridge 143:86740a56073b 680 * to be erased. Must be word-aligned.
AnnaBridge 143:86740a56073b 681 * @param key The value used to validate all flash erase APIs.
AnnaBridge 143:86740a56073b 682 *
AnnaBridge 143:86740a56073b 683 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 684 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 685 * @retval #kStatus_FLASH_AlignmentError The parameter is not aligned with the specified baseline.
AnnaBridge 143:86740a56073b 686 * @retval #kStatus_FLASH_AddressError The address is out of range.
AnnaBridge 143:86740a56073b 687 * @retval #kStatus_FLASH_EraseKeyError The API erase key is invalid.
AnnaBridge 143:86740a56073b 688 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 689 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 690 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 691 * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
AnnaBridge 143:86740a56073b 692 */
AnnaBridge 143:86740a56073b 693 status_t FLASH_Erase(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, uint32_t key);
AnnaBridge 143:86740a56073b 694
AnnaBridge 143:86740a56073b 695 /*!
AnnaBridge 143:86740a56073b 696 * @brief Erases the entire flash, including protected sectors.
AnnaBridge 143:86740a56073b 697 *
AnnaBridge 143:86740a56073b 698 * @param config Pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 699 * @param key A value used to validate all flash erase APIs.
AnnaBridge 143:86740a56073b 700 *
AnnaBridge 143:86740a56073b 701 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 702 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 703 * @retval #kStatus_FLASH_EraseKeyError API erase key is invalid.
AnnaBridge 143:86740a56073b 704 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 705 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 706 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 707 * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution.
AnnaBridge 143:86740a56073b 708 * @retval #kStatus_FLASH_PartitionStatusUpdateFailure Failed to update the partition status.
AnnaBridge 143:86740a56073b 709 */
AnnaBridge 143:86740a56073b 710 #if defined(FSL_FEATURE_FLASH_HAS_ERASE_ALL_BLOCKS_UNSECURE_CMD) && FSL_FEATURE_FLASH_HAS_ERASE_ALL_BLOCKS_UNSECURE_CMD
AnnaBridge 143:86740a56073b 711 status_t FLASH_EraseAllUnsecure(flash_config_t *config, uint32_t key);
AnnaBridge 143:86740a56073b 712 #endif
AnnaBridge 143:86740a56073b 713
AnnaBridge 143:86740a56073b 714 /*!
AnnaBridge 143:86740a56073b 715 * @brief Erases all program flash execute-only segments defined by the FXACC registers.
AnnaBridge 143:86740a56073b 716 *
AnnaBridge 143:86740a56073b 717 * @param config Pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 718 * @param key A value used to validate all flash erase APIs.
AnnaBridge 143:86740a56073b 719 *
AnnaBridge 143:86740a56073b 720 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 721 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 722 * @retval #kStatus_FLASH_EraseKeyError API erase key is invalid.
AnnaBridge 143:86740a56073b 723 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 724 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 725 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 726 * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
AnnaBridge 143:86740a56073b 727 */
AnnaBridge 143:86740a56073b 728 status_t FLASH_EraseAllExecuteOnlySegments(flash_config_t *config, uint32_t key);
AnnaBridge 143:86740a56073b 729
AnnaBridge 143:86740a56073b 730 /*@}*/
AnnaBridge 143:86740a56073b 731
AnnaBridge 143:86740a56073b 732 /*!
AnnaBridge 143:86740a56073b 733 * @name Programming
AnnaBridge 143:86740a56073b 734 * @{
AnnaBridge 143:86740a56073b 735 */
AnnaBridge 143:86740a56073b 736
AnnaBridge 143:86740a56073b 737 /*!
AnnaBridge 143:86740a56073b 738 * @brief Programs flash with data at locations passed in through parameters.
AnnaBridge 143:86740a56073b 739 *
AnnaBridge 143:86740a56073b 740 * This function programs the flash memory with the desired data for a given
AnnaBridge 143:86740a56073b 741 * flash area as determined by the start address and the length.
AnnaBridge 143:86740a56073b 742 *
AnnaBridge 143:86740a56073b 743 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 744 * @param start The start address of the desired flash memory to be programmed. Must be
AnnaBridge 143:86740a56073b 745 * word-aligned.
AnnaBridge 143:86740a56073b 746 * @param src A pointer to the source buffer of data that is to be programmed
AnnaBridge 143:86740a56073b 747 * into the flash.
AnnaBridge 143:86740a56073b 748 * @param lengthInBytes The length, given in bytes (not words or long-words),
AnnaBridge 143:86740a56073b 749 * to be programmed. Must be word-aligned.
AnnaBridge 143:86740a56073b 750 *
AnnaBridge 143:86740a56073b 751 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 752 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 753 * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with the specified baseline.
AnnaBridge 143:86740a56073b 754 * @retval #kStatus_FLASH_AddressError Address is out of range.
AnnaBridge 143:86740a56073b 755 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 756 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 757 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 758 * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
AnnaBridge 143:86740a56073b 759 */
AnnaBridge 143:86740a56073b 760 status_t FLASH_Program(flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes);
AnnaBridge 143:86740a56073b 761
AnnaBridge 143:86740a56073b 762 /*!
AnnaBridge 143:86740a56073b 763 * @brief Programs Program Once Field through parameters.
AnnaBridge 143:86740a56073b 764 *
AnnaBridge 143:86740a56073b 765 * This function programs the Program Once Field with the desired data for a given
AnnaBridge 143:86740a56073b 766 * flash area as determined by the index and length.
AnnaBridge 143:86740a56073b 767 *
AnnaBridge 143:86740a56073b 768 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 769 * @param index The index indicating which area of the Program Once Field to be programmed.
AnnaBridge 143:86740a56073b 770 * @param src A pointer to the source buffer of data that is to be programmed
AnnaBridge 143:86740a56073b 771 * into the Program Once Field.
AnnaBridge 143:86740a56073b 772 * @param lengthInBytes The length, given in bytes (not words or long-words),
AnnaBridge 143:86740a56073b 773 * to be programmed. Must be word-aligned.
AnnaBridge 143:86740a56073b 774 *
AnnaBridge 143:86740a56073b 775 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 776 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 777 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 778 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 779 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 780 * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
AnnaBridge 143:86740a56073b 781 */
AnnaBridge 143:86740a56073b 782 status_t FLASH_ProgramOnce(flash_config_t *config, uint32_t index, uint32_t *src, uint32_t lengthInBytes);
AnnaBridge 143:86740a56073b 783
AnnaBridge 143:86740a56073b 784 /*!
AnnaBridge 143:86740a56073b 785 * @brief Programs flash with data at locations passed in through parameters via the Program Section command.
AnnaBridge 143:86740a56073b 786 *
AnnaBridge 143:86740a56073b 787 * This function programs the flash memory with the desired data for a given
AnnaBridge 143:86740a56073b 788 * flash area as determined by the start address and length.
AnnaBridge 143:86740a56073b 789 *
AnnaBridge 143:86740a56073b 790 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 791 * @param start The start address of the desired flash memory to be programmed. Must be
AnnaBridge 143:86740a56073b 792 * word-aligned.
AnnaBridge 143:86740a56073b 793 * @param src A pointer to the source buffer of data that is to be programmed
AnnaBridge 143:86740a56073b 794 * into the flash.
AnnaBridge 143:86740a56073b 795 * @param lengthInBytes The length, given in bytes (not words or long-words),
AnnaBridge 143:86740a56073b 796 * to be programmed. Must be word-aligned.
AnnaBridge 143:86740a56073b 797 *
AnnaBridge 143:86740a56073b 798 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 799 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 800 * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline.
AnnaBridge 143:86740a56073b 801 * @retval #kStatus_FLASH_AddressError Address is out of range.
AnnaBridge 143:86740a56073b 802 * @retval #kStatus_FLASH_SetFlexramAsRamError Failed to set flexram as RAM.
AnnaBridge 143:86740a56073b 803 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 804 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 805 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 806 * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution.
AnnaBridge 143:86740a56073b 807 * @retval #kStatus_FLASH_RecoverFlexramAsEepromError Failed to recover FlexRAM as EEPROM.
AnnaBridge 143:86740a56073b 808 */
AnnaBridge 143:86740a56073b 809 #if defined(FSL_FEATURE_FLASH_HAS_PROGRAM_SECTION_CMD) && FSL_FEATURE_FLASH_HAS_PROGRAM_SECTION_CMD
AnnaBridge 143:86740a56073b 810 status_t FLASH_ProgramSection(flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes);
AnnaBridge 143:86740a56073b 811 #endif
AnnaBridge 143:86740a56073b 812
AnnaBridge 143:86740a56073b 813 /*!
AnnaBridge 143:86740a56073b 814 * @brief Programs the EEPROM with data at locations passed in through parameters.
AnnaBridge 143:86740a56073b 815 *
AnnaBridge 143:86740a56073b 816 * This function programs the emulated EEPROM with the desired data for a given
AnnaBridge 143:86740a56073b 817 * flash area as determined by the start address and length.
AnnaBridge 143:86740a56073b 818 *
AnnaBridge 143:86740a56073b 819 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 820 * @param start The start address of the desired flash memory to be programmed. Must be
AnnaBridge 143:86740a56073b 821 * word-aligned.
AnnaBridge 143:86740a56073b 822 * @param src A pointer to the source buffer of data that is to be programmed
AnnaBridge 143:86740a56073b 823 * into the flash.
AnnaBridge 143:86740a56073b 824 * @param lengthInBytes The length, given in bytes (not words or long-words),
AnnaBridge 143:86740a56073b 825 * to be programmed. Must be word-aligned.
AnnaBridge 143:86740a56073b 826 *
AnnaBridge 143:86740a56073b 827 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 828 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 829 * @retval #kStatus_FLASH_AddressError Address is out of range.
AnnaBridge 143:86740a56073b 830 * @retval #kStatus_FLASH_SetFlexramAsEepromError Failed to set flexram as eeprom.
AnnaBridge 143:86740a56073b 831 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 832 * @retval #kStatus_FLASH_RecoverFlexramAsRamError Failed to recover the FlexRAM as RAM.
AnnaBridge 143:86740a56073b 833 */
AnnaBridge 143:86740a56073b 834 #if FLASH_SSD_IS_FLEXNVM_ENABLED
AnnaBridge 143:86740a56073b 835 status_t FLASH_EepromWrite(flash_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes);
AnnaBridge 143:86740a56073b 836 #endif
AnnaBridge 143:86740a56073b 837
AnnaBridge 143:86740a56073b 838 /*@}*/
AnnaBridge 143:86740a56073b 839
AnnaBridge 143:86740a56073b 840 /*!
AnnaBridge 143:86740a56073b 841 * @name Reading
AnnaBridge 143:86740a56073b 842 * @{
AnnaBridge 143:86740a56073b 843 */
AnnaBridge 143:86740a56073b 844
AnnaBridge 143:86740a56073b 845 /*!
AnnaBridge 143:86740a56073b 846 * @brief Reads the resource with data at locations passed in through parameters.
AnnaBridge 143:86740a56073b 847 *
AnnaBridge 143:86740a56073b 848 * This function reads the flash memory with the desired location for a given
AnnaBridge 143:86740a56073b 849 * flash area as determined by the start address and length.
AnnaBridge 143:86740a56073b 850 *
AnnaBridge 143:86740a56073b 851 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 852 * @param start The start address of the desired flash memory to be programmed. Must be
AnnaBridge 143:86740a56073b 853 * word-aligned.
AnnaBridge 143:86740a56073b 854 * @param dst A pointer to the destination buffer of data that is used to store
AnnaBridge 143:86740a56073b 855 * data to be read.
AnnaBridge 143:86740a56073b 856 * @param lengthInBytes The length, given in bytes (not words or long-words),
AnnaBridge 143:86740a56073b 857 * to be read. Must be word-aligned.
AnnaBridge 143:86740a56073b 858 * @param option The resource option which indicates which area should be read back.
AnnaBridge 143:86740a56073b 859 *
AnnaBridge 143:86740a56073b 860 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 861 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 862 * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with the specified baseline.
AnnaBridge 143:86740a56073b 863 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 864 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 865 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 866 * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
AnnaBridge 143:86740a56073b 867 */
AnnaBridge 143:86740a56073b 868 #if defined(FSL_FEATURE_FLASH_HAS_READ_RESOURCE_CMD) && FSL_FEATURE_FLASH_HAS_READ_RESOURCE_CMD
AnnaBridge 143:86740a56073b 869 status_t FLASH_ReadResource(
AnnaBridge 143:86740a56073b 870 flash_config_t *config, uint32_t start, uint32_t *dst, uint32_t lengthInBytes, flash_read_resource_option_t option);
AnnaBridge 143:86740a56073b 871 #endif
AnnaBridge 143:86740a56073b 872
AnnaBridge 143:86740a56073b 873 /*!
AnnaBridge 143:86740a56073b 874 * @brief Reads the Program Once Field through parameters.
AnnaBridge 143:86740a56073b 875 *
AnnaBridge 143:86740a56073b 876 * This function reads the read once feild with given index and length.
AnnaBridge 143:86740a56073b 877 *
AnnaBridge 143:86740a56073b 878 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 879 * @param index The index indicating the area of program once field to be read.
AnnaBridge 143:86740a56073b 880 * @param dst A pointer to the destination buffer of data that is used to store
AnnaBridge 143:86740a56073b 881 * data to be read.
AnnaBridge 143:86740a56073b 882 * @param lengthInBytes The length, given in bytes (not words or long-words),
AnnaBridge 143:86740a56073b 883 * to be programmed. Must be word-aligned.
AnnaBridge 143:86740a56073b 884 *
AnnaBridge 143:86740a56073b 885 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 886 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 887 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 888 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 889 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 890 * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
AnnaBridge 143:86740a56073b 891 */
AnnaBridge 143:86740a56073b 892 status_t FLASH_ReadOnce(flash_config_t *config, uint32_t index, uint32_t *dst, uint32_t lengthInBytes);
AnnaBridge 143:86740a56073b 893
AnnaBridge 143:86740a56073b 894 /*@}*/
AnnaBridge 143:86740a56073b 895
AnnaBridge 143:86740a56073b 896 /*!
AnnaBridge 143:86740a56073b 897 * @name Security
AnnaBridge 143:86740a56073b 898 * @{
AnnaBridge 143:86740a56073b 899 */
AnnaBridge 143:86740a56073b 900
AnnaBridge 143:86740a56073b 901 /*!
AnnaBridge 143:86740a56073b 902 * @brief Returns the security state via the pointer passed into the function.
AnnaBridge 143:86740a56073b 903 *
AnnaBridge 143:86740a56073b 904 * This function retrieves the current flash security status, including the
AnnaBridge 143:86740a56073b 905 * security enabling state and the backdoor key enabling state.
AnnaBridge 143:86740a56073b 906 *
AnnaBridge 143:86740a56073b 907 * @param config A pointer to storage for the driver runtime state.
AnnaBridge 143:86740a56073b 908 * @param state A pointer to the value returned for the current security status code:
AnnaBridge 143:86740a56073b 909 *
AnnaBridge 143:86740a56073b 910 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 911 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 912 */
AnnaBridge 143:86740a56073b 913 status_t FLASH_GetSecurityState(flash_config_t *config, flash_security_state_t *state);
AnnaBridge 143:86740a56073b 914
AnnaBridge 143:86740a56073b 915 /*!
AnnaBridge 143:86740a56073b 916 * @brief Allows users to bypass security with a backdoor key.
AnnaBridge 143:86740a56073b 917 *
AnnaBridge 143:86740a56073b 918 * If the MCU is in secured state, this function unsecures the MCU by
AnnaBridge 143:86740a56073b 919 * comparing the provided backdoor key with ones in the flash configuration
AnnaBridge 143:86740a56073b 920 * field.
AnnaBridge 143:86740a56073b 921 *
AnnaBridge 143:86740a56073b 922 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 923 * @param backdoorKey A pointer to the user buffer containing the backdoor key.
AnnaBridge 143:86740a56073b 924 *
AnnaBridge 143:86740a56073b 925 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 926 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 927 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 928 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 929 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 930 * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
AnnaBridge 143:86740a56073b 931 */
AnnaBridge 143:86740a56073b 932 status_t FLASH_SecurityBypass(flash_config_t *config, const uint8_t *backdoorKey);
AnnaBridge 143:86740a56073b 933
AnnaBridge 143:86740a56073b 934 /*@}*/
AnnaBridge 143:86740a56073b 935
AnnaBridge 143:86740a56073b 936 /*!
AnnaBridge 143:86740a56073b 937 * @name Verification
AnnaBridge 143:86740a56073b 938 * @{
AnnaBridge 143:86740a56073b 939 */
AnnaBridge 143:86740a56073b 940
AnnaBridge 143:86740a56073b 941 /*!
AnnaBridge 143:86740a56073b 942 * @brief Verifies erasure of the entire flash at a specified margin level.
AnnaBridge 143:86740a56073b 943 *
AnnaBridge 143:86740a56073b 944 * This function checks whether the flash is erased to the
AnnaBridge 143:86740a56073b 945 * specified read margin level.
AnnaBridge 143:86740a56073b 946 *
AnnaBridge 143:86740a56073b 947 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 948 * @param margin Read margin choice.
AnnaBridge 143:86740a56073b 949 *
AnnaBridge 143:86740a56073b 950 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 951 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 952 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 953 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 954 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 955 * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
AnnaBridge 143:86740a56073b 956 */
AnnaBridge 143:86740a56073b 957 status_t FLASH_VerifyEraseAll(flash_config_t *config, flash_margin_value_t margin);
AnnaBridge 143:86740a56073b 958
AnnaBridge 143:86740a56073b 959 /*!
AnnaBridge 143:86740a56073b 960 * @brief Verifies an erasure of the desired flash area at a specified margin level.
AnnaBridge 143:86740a56073b 961 *
AnnaBridge 143:86740a56073b 962 * This function checks the appropriate number of flash sectors based on
AnnaBridge 143:86740a56073b 963 * the desired start address and length to check whether the flash is erased
AnnaBridge 143:86740a56073b 964 * to the specified read margin level.
AnnaBridge 143:86740a56073b 965 *
AnnaBridge 143:86740a56073b 966 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 967 * @param start The start address of the desired flash memory to be verified.
AnnaBridge 143:86740a56073b 968 * The start address does not need to be sector-aligned but must be word-aligned.
AnnaBridge 143:86740a56073b 969 * @param lengthInBytes The length, given in bytes (not words or long-words),
AnnaBridge 143:86740a56073b 970 * to be verified. Must be word-aligned.
AnnaBridge 143:86740a56073b 971 * @param margin Read margin choice.
AnnaBridge 143:86740a56073b 972 *
AnnaBridge 143:86740a56073b 973 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 974 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 975 * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline.
AnnaBridge 143:86740a56073b 976 * @retval #kStatus_FLASH_AddressError Address is out of range.
AnnaBridge 143:86740a56073b 977 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 978 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 979 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 980 * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
AnnaBridge 143:86740a56073b 981 */
AnnaBridge 143:86740a56073b 982 status_t FLASH_VerifyErase(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, flash_margin_value_t margin);
AnnaBridge 143:86740a56073b 983
AnnaBridge 143:86740a56073b 984 /*!
AnnaBridge 143:86740a56073b 985 * @brief Verifies programming of the desired flash area at a specified margin level.
AnnaBridge 143:86740a56073b 986 *
AnnaBridge 143:86740a56073b 987 * This function verifies the data programed in the flash memory using the
AnnaBridge 143:86740a56073b 988 * Flash Program Check Command and compares it to the expected data for a given
AnnaBridge 143:86740a56073b 989 * flash area as determined by the start address and length.
AnnaBridge 143:86740a56073b 990 *
AnnaBridge 143:86740a56073b 991 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 992 * @param start The start address of the desired flash memory to be verified. Must be word-aligned.
AnnaBridge 143:86740a56073b 993 * @param lengthInBytes The length, given in bytes (not words or long-words),
AnnaBridge 143:86740a56073b 994 * to be verified. Must be word-aligned.
AnnaBridge 143:86740a56073b 995 * @param expectedData A pointer to the expected data that is to be
AnnaBridge 143:86740a56073b 996 * verified against.
AnnaBridge 143:86740a56073b 997 * @param margin Read margin choice.
AnnaBridge 143:86740a56073b 998 * @param failedAddress A pointer to the returned failing address.
AnnaBridge 143:86740a56073b 999 * @param failedData A pointer to the returned failing data. Some derivatives do
AnnaBridge 143:86740a56073b 1000 * not include failed data as part of the FCCOBx registers. In this
AnnaBridge 143:86740a56073b 1001 * case, zeros are returned upon failure.
AnnaBridge 143:86740a56073b 1002 *
AnnaBridge 143:86740a56073b 1003 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1004 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 1005 * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline.
AnnaBridge 143:86740a56073b 1006 * @retval #kStatus_FLASH_AddressError Address is out of range.
AnnaBridge 143:86740a56073b 1007 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 1008 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 1009 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 1010 * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
AnnaBridge 143:86740a56073b 1011 */
AnnaBridge 143:86740a56073b 1012 status_t FLASH_VerifyProgram(flash_config_t *config,
AnnaBridge 143:86740a56073b 1013 uint32_t start,
AnnaBridge 143:86740a56073b 1014 uint32_t lengthInBytes,
AnnaBridge 143:86740a56073b 1015 const uint32_t *expectedData,
AnnaBridge 143:86740a56073b 1016 flash_margin_value_t margin,
AnnaBridge 143:86740a56073b 1017 uint32_t *failedAddress,
AnnaBridge 143:86740a56073b 1018 uint32_t *failedData);
AnnaBridge 143:86740a56073b 1019
AnnaBridge 143:86740a56073b 1020 /*!
AnnaBridge 143:86740a56073b 1021 * @brief Verifies whether the program flash execute-only segments have been erased to
AnnaBridge 143:86740a56073b 1022 * the specified read margin level.
AnnaBridge 143:86740a56073b 1023 *
AnnaBridge 143:86740a56073b 1024 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 1025 * @param margin Read margin choice.
AnnaBridge 143:86740a56073b 1026 *
AnnaBridge 143:86740a56073b 1027 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1028 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 1029 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 1030 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 1031 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 1032 * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
AnnaBridge 143:86740a56073b 1033 */
AnnaBridge 143:86740a56073b 1034 status_t FLASH_VerifyEraseAllExecuteOnlySegments(flash_config_t *config, flash_margin_value_t margin);
AnnaBridge 143:86740a56073b 1035
AnnaBridge 143:86740a56073b 1036 /*@}*/
AnnaBridge 143:86740a56073b 1037
AnnaBridge 143:86740a56073b 1038 /*!
AnnaBridge 143:86740a56073b 1039 * @name Protection
AnnaBridge 143:86740a56073b 1040 * @{
AnnaBridge 143:86740a56073b 1041 */
AnnaBridge 143:86740a56073b 1042
AnnaBridge 143:86740a56073b 1043 /*!
AnnaBridge 143:86740a56073b 1044 * @brief Returns the protection state of the desired flash area via the pointer passed into the function.
AnnaBridge 143:86740a56073b 1045 *
AnnaBridge 143:86740a56073b 1046 * This function retrieves the current flash protect status for a given
AnnaBridge 143:86740a56073b 1047 * flash area as determined by the start address and length.
AnnaBridge 143:86740a56073b 1048 *
AnnaBridge 143:86740a56073b 1049 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 1050 * @param start The start address of the desired flash memory to be checked. Must be word-aligned.
AnnaBridge 143:86740a56073b 1051 * @param lengthInBytes The length, given in bytes (not words or long-words)
AnnaBridge 143:86740a56073b 1052 * to be checked. Must be word-aligned.
AnnaBridge 143:86740a56073b 1053 * @param protection_state A pointer to the value returned for the current
AnnaBridge 143:86740a56073b 1054 * protection status code for the desired flash area.
AnnaBridge 143:86740a56073b 1055 *
AnnaBridge 143:86740a56073b 1056 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1057 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 1058 * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline.
AnnaBridge 143:86740a56073b 1059 * @retval #kStatus_FLASH_AddressError The address is out of range.
AnnaBridge 143:86740a56073b 1060 */
AnnaBridge 143:86740a56073b 1061 status_t FLASH_IsProtected(flash_config_t *config,
AnnaBridge 143:86740a56073b 1062 uint32_t start,
AnnaBridge 143:86740a56073b 1063 uint32_t lengthInBytes,
AnnaBridge 143:86740a56073b 1064 flash_protection_state_t *protection_state);
AnnaBridge 143:86740a56073b 1065
AnnaBridge 143:86740a56073b 1066 /*!
AnnaBridge 143:86740a56073b 1067 * @brief Returns the access state of the desired flash area via the pointer passed into the function.
AnnaBridge 143:86740a56073b 1068 *
AnnaBridge 143:86740a56073b 1069 * This function retrieves the current flash access status for a given
AnnaBridge 143:86740a56073b 1070 * flash area as determined by the start address and length.
AnnaBridge 143:86740a56073b 1071 *
AnnaBridge 143:86740a56073b 1072 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 1073 * @param start The start address of the desired flash memory to be checked. Must be word-aligned.
AnnaBridge 143:86740a56073b 1074 * @param lengthInBytes The length, given in bytes (not words or long-words),
AnnaBridge 143:86740a56073b 1075 * to be checked. Must be word-aligned.
AnnaBridge 143:86740a56073b 1076 * @param access_state A pointer to the value returned for the current
AnnaBridge 143:86740a56073b 1077 * access status code for the desired flash area.
AnnaBridge 143:86740a56073b 1078 *
AnnaBridge 143:86740a56073b 1079 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1080 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 1081 * @retval #kStatus_FLASH_AlignmentError The parameter is not aligned to the specified baseline.
AnnaBridge 143:86740a56073b 1082 * @retval #kStatus_FLASH_AddressError The address is out of range.
AnnaBridge 143:86740a56073b 1083 */
AnnaBridge 143:86740a56073b 1084 status_t FLASH_IsExecuteOnly(flash_config_t *config,
AnnaBridge 143:86740a56073b 1085 uint32_t start,
AnnaBridge 143:86740a56073b 1086 uint32_t lengthInBytes,
AnnaBridge 143:86740a56073b 1087 flash_execute_only_access_state_t *access_state);
AnnaBridge 143:86740a56073b 1088
AnnaBridge 143:86740a56073b 1089 /*@}*/
AnnaBridge 143:86740a56073b 1090
AnnaBridge 143:86740a56073b 1091 /*!
AnnaBridge 143:86740a56073b 1092 * @name Properties
AnnaBridge 143:86740a56073b 1093 * @{
AnnaBridge 143:86740a56073b 1094 */
AnnaBridge 143:86740a56073b 1095
AnnaBridge 143:86740a56073b 1096 /*!
AnnaBridge 143:86740a56073b 1097 * @brief Returns the desired flash property.
AnnaBridge 143:86740a56073b 1098 *
AnnaBridge 143:86740a56073b 1099 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 1100 * @param whichProperty The desired property from the list of properties in
AnnaBridge 143:86740a56073b 1101 * enum flash_property_tag_t
AnnaBridge 143:86740a56073b 1102 * @param value A pointer to the value returned for the desired flash property.
AnnaBridge 143:86740a56073b 1103 *
AnnaBridge 143:86740a56073b 1104 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1105 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 1106 * @retval #kStatus_FLASH_UnknownProperty An unknown property tag.
AnnaBridge 143:86740a56073b 1107 */
AnnaBridge 143:86740a56073b 1108 status_t FLASH_GetProperty(flash_config_t *config, flash_property_tag_t whichProperty, uint32_t *value);
AnnaBridge 143:86740a56073b 1109
AnnaBridge 143:86740a56073b 1110 /*!
AnnaBridge 143:86740a56073b 1111 * @brief Sets the desired flash property.
AnnaBridge 143:86740a56073b 1112 *
AnnaBridge 143:86740a56073b 1113 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 1114 * @param whichProperty The desired property from the list of properties in
AnnaBridge 143:86740a56073b 1115 * enum flash_property_tag_t
AnnaBridge 143:86740a56073b 1116 * @param value A to set for the desired flash property.
AnnaBridge 143:86740a56073b 1117 *
AnnaBridge 143:86740a56073b 1118 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1119 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 1120 * @retval #kStatus_FLASH_UnknownProperty An unknown property tag.
AnnaBridge 143:86740a56073b 1121 * @retval #kStatus_FLASH_InvalidPropertyValue An invalid property value.
AnnaBridge 143:86740a56073b 1122 * @retval #kStatus_FLASH_ReadOnlyProperty An read-only property tag.
AnnaBridge 143:86740a56073b 1123 */
AnnaBridge 143:86740a56073b 1124 status_t FLASH_SetProperty(flash_config_t *config, flash_property_tag_t whichProperty, uint32_t value);
AnnaBridge 143:86740a56073b 1125
AnnaBridge 143:86740a56073b 1126 /*@}*/
AnnaBridge 143:86740a56073b 1127
AnnaBridge 143:86740a56073b 1128 /*!
AnnaBridge 143:86740a56073b 1129 * @name FlexRAM
AnnaBridge 143:86740a56073b 1130 * @{
AnnaBridge 143:86740a56073b 1131 */
AnnaBridge 143:86740a56073b 1132
AnnaBridge 143:86740a56073b 1133 /*!
AnnaBridge 143:86740a56073b 1134 * @brief Sets the FlexRAM function command.
AnnaBridge 143:86740a56073b 1135 *
AnnaBridge 143:86740a56073b 1136 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 1137 * @param option The option used to set the work mode of FlexRAM.
AnnaBridge 143:86740a56073b 1138 *
AnnaBridge 143:86740a56073b 1139 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1140 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 1141 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 1142 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 1143 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 1144 * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
AnnaBridge 143:86740a56073b 1145 */
AnnaBridge 143:86740a56073b 1146 #if defined(FSL_FEATURE_FLASH_HAS_SET_FLEXRAM_FUNCTION_CMD) && FSL_FEATURE_FLASH_HAS_SET_FLEXRAM_FUNCTION_CMD
AnnaBridge 143:86740a56073b 1147 status_t FLASH_SetFlexramFunction(flash_config_t *config, flash_flexram_function_option_t option);
AnnaBridge 143:86740a56073b 1148 #endif
AnnaBridge 143:86740a56073b 1149
AnnaBridge 143:86740a56073b 1150 /*@}*/
AnnaBridge 143:86740a56073b 1151
AnnaBridge 143:86740a56073b 1152 /*!
AnnaBridge 143:86740a56073b 1153 * @name Swap
AnnaBridge 143:86740a56073b 1154 * @{
AnnaBridge 143:86740a56073b 1155 */
AnnaBridge 143:86740a56073b 1156
AnnaBridge 143:86740a56073b 1157 /*!
AnnaBridge 143:86740a56073b 1158 * @brief Configures the Swap function or checks the the swap state of the Flash module.
AnnaBridge 143:86740a56073b 1159 *
AnnaBridge 143:86740a56073b 1160 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 1161 * @param address Address used to configure the flash Swap function.
AnnaBridge 143:86740a56073b 1162 * @param option The possible option used to configure Flash Swap function or check the flash Swap status
AnnaBridge 143:86740a56073b 1163 * @param returnInfo A pointer to the data which is used to return the information of flash Swap.
AnnaBridge 143:86740a56073b 1164 *
AnnaBridge 143:86740a56073b 1165 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1166 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 1167 * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline.
AnnaBridge 143:86740a56073b 1168 * @retval #kStatus_FLASH_SwapIndicatorAddressError Swap indicator address is invalid.
AnnaBridge 143:86740a56073b 1169 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 1170 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 1171 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 1172 * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
AnnaBridge 143:86740a56073b 1173 */
AnnaBridge 143:86740a56073b 1174 #if defined(FSL_FEATURE_FLASH_HAS_SWAP_CONTROL_CMD) && FSL_FEATURE_FLASH_HAS_SWAP_CONTROL_CMD
AnnaBridge 143:86740a56073b 1175 status_t FLASH_SwapControl(flash_config_t *config,
AnnaBridge 143:86740a56073b 1176 uint32_t address,
AnnaBridge 143:86740a56073b 1177 flash_swap_control_option_t option,
AnnaBridge 143:86740a56073b 1178 flash_swap_state_config_t *returnInfo);
AnnaBridge 143:86740a56073b 1179 #endif
AnnaBridge 143:86740a56073b 1180
AnnaBridge 143:86740a56073b 1181 /*!
AnnaBridge 143:86740a56073b 1182 * @brief Swaps the lower half flash with the higher half flash.
AnnaBridge 143:86740a56073b 1183 *
AnnaBridge 143:86740a56073b 1184 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 1185 * @param address Address used to configure the flash swap function
AnnaBridge 143:86740a56073b 1186 * @param option The possible option used to configure the Flash Swap function or check the flash Swap status.
AnnaBridge 143:86740a56073b 1187 *
AnnaBridge 143:86740a56073b 1188 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1189 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 1190 * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline.
AnnaBridge 143:86740a56073b 1191 * @retval #kStatus_FLASH_SwapIndicatorAddressError Swap indicator address is invalid.
AnnaBridge 143:86740a56073b 1192 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 1193 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 1194 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 1195 * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution.
AnnaBridge 143:86740a56073b 1196 * @retval #kStatus_FLASH_SwapSystemNotInUninitialized Swap system is not in an uninitialzed state.
AnnaBridge 143:86740a56073b 1197 */
AnnaBridge 143:86740a56073b 1198 #if defined(FSL_FEATURE_FLASH_HAS_PFLASH_BLOCK_SWAP) && FSL_FEATURE_FLASH_HAS_PFLASH_BLOCK_SWAP
AnnaBridge 143:86740a56073b 1199 status_t FLASH_Swap(flash_config_t *config, uint32_t address, flash_swap_function_option_t option);
AnnaBridge 143:86740a56073b 1200 #endif
AnnaBridge 143:86740a56073b 1201
AnnaBridge 143:86740a56073b 1202 /*!
AnnaBridge 143:86740a56073b 1203 * @name FlexNVM
AnnaBridge 143:86740a56073b 1204 * @{
AnnaBridge 143:86740a56073b 1205 */
AnnaBridge 143:86740a56073b 1206
AnnaBridge 143:86740a56073b 1207 /*!
AnnaBridge 143:86740a56073b 1208 * @brief Prepares the FlexNVM block for use as data flash, EEPROM backup, or a combination of both and initializes the
AnnaBridge 143:86740a56073b 1209 * FlexRAM.
AnnaBridge 143:86740a56073b 1210 *
AnnaBridge 143:86740a56073b 1211 * @param config Pointer to storage for the driver runtime state.
AnnaBridge 143:86740a56073b 1212 * @param option The option used to set FlexRAM load behavior during reset.
AnnaBridge 143:86740a56073b 1213 * @param eepromDataSizeCode Determines the amount of FlexRAM used in each of the available EEPROM subsystems.
AnnaBridge 143:86740a56073b 1214 * @param flexnvmPartitionCode Specifies how to split the FlexNVM block between data flash memory and EEPROM backup
AnnaBridge 143:86740a56073b 1215 * memory supporting EEPROM functions.
AnnaBridge 143:86740a56073b 1216 *
AnnaBridge 143:86740a56073b 1217 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1218 * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided.
AnnaBridge 143:86740a56073b 1219 * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
AnnaBridge 143:86740a56073b 1220 * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
AnnaBridge 143:86740a56073b 1221 * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas.
AnnaBridge 143:86740a56073b 1222 * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution.
AnnaBridge 143:86740a56073b 1223 */
AnnaBridge 143:86740a56073b 1224 #if defined(FSL_FEATURE_FLASH_HAS_PROGRAM_PARTITION_CMD) && FSL_FEATURE_FLASH_HAS_PROGRAM_PARTITION_CMD
AnnaBridge 143:86740a56073b 1225 status_t FLASH_ProgramPartition(flash_config_t *config,
AnnaBridge 143:86740a56073b 1226 flash_partition_flexram_load_option_t option,
AnnaBridge 143:86740a56073b 1227 uint32_t eepromDataSizeCode,
AnnaBridge 143:86740a56073b 1228 uint32_t flexnvmPartitionCode);
AnnaBridge 143:86740a56073b 1229 #endif
AnnaBridge 143:86740a56073b 1230
AnnaBridge 143:86740a56073b 1231 /*@}*/
AnnaBridge 143:86740a56073b 1232
AnnaBridge 143:86740a56073b 1233 /*!
AnnaBridge 143:86740a56073b 1234 * @name Flash Protection Utilities
AnnaBridge 143:86740a56073b 1235 * @{
AnnaBridge 143:86740a56073b 1236 */
AnnaBridge 143:86740a56073b 1237
AnnaBridge 143:86740a56073b 1238 /*!
AnnaBridge 143:86740a56073b 1239 * @brief Sets the PFlash Protection to the intended protection status.
AnnaBridge 143:86740a56073b 1240 *
AnnaBridge 143:86740a56073b 1241 * @param config A pointer to storage for the driver runtime state.
AnnaBridge 143:86740a56073b 1242 * @param protectStatus The expected protect status to set to the PFlash protection register. Each bit is
AnnaBridge 143:86740a56073b 1243 * corresponding to protection of 1/32(64) of the total PFlash. The least significant bit is corresponding to the lowest
AnnaBridge 143:86740a56073b 1244 * address area of PFlash. The most significant bit is corresponding to the highest address area of PFlash. There are
AnnaBridge 143:86740a56073b 1245 * two possible cases as shown below:
AnnaBridge 143:86740a56073b 1246 * 0: this area is protected.
AnnaBridge 143:86740a56073b 1247 * 1: this area is unprotected.
AnnaBridge 143:86740a56073b 1248 *
AnnaBridge 143:86740a56073b 1249 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1250 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 1251 * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution.
AnnaBridge 143:86740a56073b 1252 */
AnnaBridge 143:86740a56073b 1253 status_t FLASH_PflashSetProtection(flash_config_t *config, pflash_protection_status_t *protectStatus);
AnnaBridge 143:86740a56073b 1254
AnnaBridge 143:86740a56073b 1255 /*!
AnnaBridge 143:86740a56073b 1256 * @brief Gets the PFlash protection status.
AnnaBridge 143:86740a56073b 1257 *
AnnaBridge 143:86740a56073b 1258 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 1259 * @param protectStatus Protect status returned by the PFlash IP. Each bit is corresponding to the protection of
AnnaBridge 143:86740a56073b 1260 * 1/32(64)
AnnaBridge 143:86740a56073b 1261 * of the
AnnaBridge 143:86740a56073b 1262 * total PFlash. The least significant bit corresponds to the lowest address area of the PFlash. The most significant
AnnaBridge 143:86740a56073b 1263 * bit corresponds to the highest address area of PFlash. There are two possible cases as shown below:
AnnaBridge 143:86740a56073b 1264 * 0: this area is protected.
AnnaBridge 143:86740a56073b 1265 * 1: this area is unprotected.
AnnaBridge 143:86740a56073b 1266 *
AnnaBridge 143:86740a56073b 1267 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1268 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 1269 */
AnnaBridge 143:86740a56073b 1270 status_t FLASH_PflashGetProtection(flash_config_t *config, pflash_protection_status_t *protectStatus);
AnnaBridge 143:86740a56073b 1271
AnnaBridge 143:86740a56073b 1272 /*!
AnnaBridge 143:86740a56073b 1273 * @brief Sets the DFlash protection to the intended protection status.
AnnaBridge 143:86740a56073b 1274 *
AnnaBridge 143:86740a56073b 1275 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 1276 * @param protectStatus The expected protect status to set to the DFlash protection register. Each bit
AnnaBridge 143:86740a56073b 1277 * corresponds to the protection of the 1/8 of the total DFlash. The least significant bit corresponds to the lowest
AnnaBridge 143:86740a56073b 1278 * address area of the DFlash. The most significant bit corresponds to the highest address area of the DFlash. There
AnnaBridge 143:86740a56073b 1279 * are
AnnaBridge 143:86740a56073b 1280 * two possible cases as shown below:
AnnaBridge 143:86740a56073b 1281 * 0: this area is protected.
AnnaBridge 143:86740a56073b 1282 * 1: this area is unprotected.
AnnaBridge 143:86740a56073b 1283 *
AnnaBridge 143:86740a56073b 1284 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1285 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 1286 * @retval #kStatus_FLASH_CommandNotSupported Flash API is not supported.
AnnaBridge 143:86740a56073b 1287 * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution.
AnnaBridge 143:86740a56073b 1288 */
AnnaBridge 143:86740a56073b 1289 #if FLASH_SSD_IS_FLEXNVM_ENABLED
AnnaBridge 143:86740a56073b 1290 status_t FLASH_DflashSetProtection(flash_config_t *config, uint8_t protectStatus);
AnnaBridge 143:86740a56073b 1291 #endif
AnnaBridge 143:86740a56073b 1292
AnnaBridge 143:86740a56073b 1293 /*!
AnnaBridge 143:86740a56073b 1294 * @brief Gets the DFlash protection status.
AnnaBridge 143:86740a56073b 1295 *
AnnaBridge 143:86740a56073b 1296 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 1297 * @param protectStatus DFlash Protect status returned by the PFlash IP. Each bit corresponds to the protection of the
AnnaBridge 143:86740a56073b 1298 * 1/8 of
AnnaBridge 143:86740a56073b 1299 * the total DFlash. The least significant bit corresponds to the lowest address area of the DFlash. The most
AnnaBridge 143:86740a56073b 1300 * significant bit corresponds to the highest address area of the DFlash, and so on. There are two possible cases as
AnnaBridge 143:86740a56073b 1301 * below:
AnnaBridge 143:86740a56073b 1302 * 0: this area is protected.
AnnaBridge 143:86740a56073b 1303 * 1: this area is unprotected.
AnnaBridge 143:86740a56073b 1304 *
AnnaBridge 143:86740a56073b 1305 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1306 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 1307 * @retval #kStatus_FLASH_CommandNotSupported Flash API is not supported.
AnnaBridge 143:86740a56073b 1308 */
AnnaBridge 143:86740a56073b 1309 #if FLASH_SSD_IS_FLEXNVM_ENABLED
AnnaBridge 143:86740a56073b 1310 status_t FLASH_DflashGetProtection(flash_config_t *config, uint8_t *protectStatus);
AnnaBridge 143:86740a56073b 1311 #endif
AnnaBridge 143:86740a56073b 1312
AnnaBridge 143:86740a56073b 1313 /*!
AnnaBridge 143:86740a56073b 1314 * @brief Sets the EEPROM protection to the intended protection status.
AnnaBridge 143:86740a56073b 1315 *
AnnaBridge 143:86740a56073b 1316 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 1317 * @param protectStatus The expected protect status to set to the EEPROM protection register. Each bit
AnnaBridge 143:86740a56073b 1318 * corresponds to the protection of the 1/8 of the total EEPROM. The least significant bit corresponds to the lowest
AnnaBridge 143:86740a56073b 1319 * address area of the EEPROM. The most significant bit corresponds to the highest address area of EEPROM, and so on.
AnnaBridge 143:86740a56073b 1320 * There are two possible cases as shown below:
AnnaBridge 143:86740a56073b 1321 * 0: this area is protected.
AnnaBridge 143:86740a56073b 1322 * 1: this area is unprotected.
AnnaBridge 143:86740a56073b 1323 *
AnnaBridge 143:86740a56073b 1324 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1325 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 1326 * @retval #kStatus_FLASH_CommandNotSupported Flash API is not supported.
AnnaBridge 143:86740a56073b 1327 * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution.
AnnaBridge 143:86740a56073b 1328 */
AnnaBridge 143:86740a56073b 1329 #if FLASH_SSD_IS_FLEXNVM_ENABLED
AnnaBridge 143:86740a56073b 1330 status_t FLASH_EepromSetProtection(flash_config_t *config, uint8_t protectStatus);
AnnaBridge 143:86740a56073b 1331 #endif
AnnaBridge 143:86740a56073b 1332
AnnaBridge 143:86740a56073b 1333 /*!
AnnaBridge 143:86740a56073b 1334 * @brief Gets the DFlash protection status.
AnnaBridge 143:86740a56073b 1335 *
AnnaBridge 143:86740a56073b 1336 * @param config A pointer to the storage for the driver runtime state.
AnnaBridge 143:86740a56073b 1337 * @param protectStatus DFlash Protect status returned by the PFlash IP. Each bit corresponds to the protection of the
AnnaBridge 143:86740a56073b 1338 * 1/8 of
AnnaBridge 143:86740a56073b 1339 * the total EEPROM. The least significant bit corresponds to the lowest address area of the EEPROM. The most
AnnaBridge 143:86740a56073b 1340 * significant bit corresponds to the highest address area of the EEPROM. There are two possible cases as below:
AnnaBridge 143:86740a56073b 1341 * 0: this area is protected.
AnnaBridge 143:86740a56073b 1342 * 1: this area is unprotected.
AnnaBridge 143:86740a56073b 1343 *
AnnaBridge 143:86740a56073b 1344 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1345 * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
AnnaBridge 143:86740a56073b 1346 * @retval #kStatus_FLASH_CommandNotSupported Flash API is not supported.
AnnaBridge 143:86740a56073b 1347 */
AnnaBridge 143:86740a56073b 1348 #if FLASH_SSD_IS_FLEXNVM_ENABLED
AnnaBridge 143:86740a56073b 1349 status_t FLASH_EepromGetProtection(flash_config_t *config, uint8_t *protectStatus);
AnnaBridge 143:86740a56073b 1350 #endif
AnnaBridge 143:86740a56073b 1351
AnnaBridge 143:86740a56073b 1352 /*@}*/
AnnaBridge 143:86740a56073b 1353
AnnaBridge 143:86740a56073b 1354 /*@}*/
AnnaBridge 143:86740a56073b 1355
AnnaBridge 143:86740a56073b 1356 /*!
AnnaBridge 143:86740a56073b 1357 * @name Flash Speculation Utilities
AnnaBridge 143:86740a56073b 1358 * @{
AnnaBridge 143:86740a56073b 1359 */
AnnaBridge 143:86740a56073b 1360
AnnaBridge 143:86740a56073b 1361 /*!
AnnaBridge 143:86740a56073b 1362 * @brief Sets the PFlash prefetch speculation to the intended speculation status.
AnnaBridge 143:86740a56073b 1363 *
AnnaBridge 143:86740a56073b 1364 * @param speculationStatus The expected protect status to set to the PFlash protection register. Each bit is
AnnaBridge 143:86740a56073b 1365 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1366 * @retval #kStatus_FLASH_InvalidSpeculationOption An invalid speculation option argument is provided.
AnnaBridge 143:86740a56073b 1367 */
AnnaBridge 143:86740a56073b 1368 status_t FLASH_PflashSetPrefetchSpeculation(flash_prefetch_speculation_status_t *speculationStatus);
AnnaBridge 143:86740a56073b 1369
AnnaBridge 143:86740a56073b 1370 /*!
AnnaBridge 143:86740a56073b 1371 * @brief Gets the PFlash prefetch speculation status.
AnnaBridge 143:86740a56073b 1372 *
AnnaBridge 143:86740a56073b 1373 * @param speculationStatus Speculation status returned by the PFlash IP.
AnnaBridge 143:86740a56073b 1374 * @retval #kStatus_FLASH_Success API was executed successfully.
AnnaBridge 143:86740a56073b 1375 */
AnnaBridge 143:86740a56073b 1376 status_t FLASH_PflashGetPrefetchSpeculation(flash_prefetch_speculation_status_t *speculationStatus);
AnnaBridge 143:86740a56073b 1377
AnnaBridge 143:86740a56073b 1378 /*@}*/
AnnaBridge 143:86740a56073b 1379
AnnaBridge 143:86740a56073b 1380 #if defined(__cplusplus)
AnnaBridge 143:86740a56073b 1381 }
AnnaBridge 143:86740a56073b 1382 #endif
AnnaBridge 143:86740a56073b 1383
AnnaBridge 143:86740a56073b 1384 /*! @}*/
AnnaBridge 143:86740a56073b 1385
AnnaBridge 143:86740a56073b 1386 #endif /* _FSL_FLASH_H_ */