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