Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.
Upstream: https://github.com/ARMmbed/DAPLink
source/hic_hal/freescale/iap/fsl_flash.h@0:01f31e923fe2, 2020-04-07 (annotated)
- Committer:
- Pawel Zarembski
- Date:
- Tue Apr 07 12:55:42 2020 +0200
- Revision:
- 0:01f31e923fe2
hani: DAPLink with reset workaround
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pawel Zarembski |
0:01f31e923fe2 | 1 | /* |
Pawel Zarembski |
0:01f31e923fe2 | 2 | * Copyright (c) 2013-2015, Freescale Semiconductor, Inc. |
Pawel Zarembski |
0:01f31e923fe2 | 3 | * All rights reserved. |
Pawel Zarembski |
0:01f31e923fe2 | 4 | * |
Pawel Zarembski |
0:01f31e923fe2 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
Pawel Zarembski |
0:01f31e923fe2 | 6 | * are permitted provided that the following conditions are met: |
Pawel Zarembski |
0:01f31e923fe2 | 7 | * |
Pawel Zarembski |
0:01f31e923fe2 | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
Pawel Zarembski |
0:01f31e923fe2 | 9 | * of conditions and the following disclaimer. |
Pawel Zarembski |
0:01f31e923fe2 | 10 | * |
Pawel Zarembski |
0:01f31e923fe2 | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
Pawel Zarembski |
0:01f31e923fe2 | 12 | * list of conditions and the following disclaimer in the documentation and/or |
Pawel Zarembski |
0:01f31e923fe2 | 13 | * other materials provided with the distribution. |
Pawel Zarembski |
0:01f31e923fe2 | 14 | * |
Pawel Zarembski |
0:01f31e923fe2 | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
Pawel Zarembski |
0:01f31e923fe2 | 16 | * contributors may be used to endorse or promote products derived from this |
Pawel Zarembski |
0:01f31e923fe2 | 17 | * software without specific prior written permission. |
Pawel Zarembski |
0:01f31e923fe2 | 18 | * |
Pawel Zarembski |
0:01f31e923fe2 | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
Pawel Zarembski |
0:01f31e923fe2 | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
Pawel Zarembski |
0:01f31e923fe2 | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Pawel Zarembski |
0:01f31e923fe2 | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
Pawel Zarembski |
0:01f31e923fe2 | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
Pawel Zarembski |
0:01f31e923fe2 | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
Pawel Zarembski |
0:01f31e923fe2 | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
Pawel Zarembski |
0:01f31e923fe2 | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
Pawel Zarembski |
0:01f31e923fe2 | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
Pawel Zarembski |
0:01f31e923fe2 | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Pawel Zarembski |
0:01f31e923fe2 | 29 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 30 | |
Pawel Zarembski |
0:01f31e923fe2 | 31 | #ifndef _FSL_FLASH_H_ |
Pawel Zarembski |
0:01f31e923fe2 | 32 | #define _FSL_FLASH_H_ |
Pawel Zarembski |
0:01f31e923fe2 | 33 | |
Pawel Zarembski |
0:01f31e923fe2 | 34 | #if (defined(BL_TARGET_FLASH) || defined(BL_TARGET_ROM) || defined(BL_TARGET_RAM)) |
Pawel Zarembski |
0:01f31e923fe2 | 35 | #include <assert.h> |
Pawel Zarembski |
0:01f31e923fe2 | 36 | #include <string.h> |
Pawel Zarembski |
0:01f31e923fe2 | 37 | #include "fsl_device_registers.h" |
Pawel Zarembski |
0:01f31e923fe2 | 38 | #include "bootloader_common.h" |
Pawel Zarembski |
0:01f31e923fe2 | 39 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 40 | #include "fsl_common.h" |
Pawel Zarembski |
0:01f31e923fe2 | 41 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 42 | |
Pawel Zarembski |
0:01f31e923fe2 | 43 | /******************************************************************************* |
Pawel Zarembski |
0:01f31e923fe2 | 44 | * Definitions |
Pawel Zarembski |
0:01f31e923fe2 | 45 | ******************************************************************************/ |
Pawel Zarembski |
0:01f31e923fe2 | 46 | |
Pawel Zarembski |
0:01f31e923fe2 | 47 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 48 | * @addtogroup flash_driver |
Pawel Zarembski |
0:01f31e923fe2 | 49 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 50 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 51 | |
Pawel Zarembski |
0:01f31e923fe2 | 52 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 53 | * @name Flash version |
Pawel Zarembski |
0:01f31e923fe2 | 54 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 55 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 56 | /*! @brief Construct the version number for drivers. */ |
Pawel Zarembski |
0:01f31e923fe2 | 57 | #if !defined(MAKE_VERSION) |
Pawel Zarembski |
0:01f31e923fe2 | 58 | #define MAKE_VERSION(major, minor, bugfix) (((major) << 16) | ((minor) << 8) | (bugfix)) |
Pawel Zarembski |
0:01f31e923fe2 | 59 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 60 | |
Pawel Zarembski |
0:01f31e923fe2 | 61 | /*! @brief FLASH driver version for SDK*/ |
Pawel Zarembski |
0:01f31e923fe2 | 62 | #define FSL_FLASH_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) /*!< Version 2.0.0. */ |
Pawel Zarembski |
0:01f31e923fe2 | 63 | |
Pawel Zarembski |
0:01f31e923fe2 | 64 | /*! @brief FLASH driver version for ROM*/ |
Pawel Zarembski |
0:01f31e923fe2 | 65 | enum _flash_driver_version_constants |
Pawel Zarembski |
0:01f31e923fe2 | 66 | { |
Pawel Zarembski |
0:01f31e923fe2 | 67 | kFLASH_driverVersionName = 'F', /*!< Flash driver version name.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 68 | kFLASH_driverVersionMajor = 2, /*!< Major flash driver version.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 69 | kFLASH_driverVersionMinor = 0, /*!< Minor flash driver version.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 70 | kFLASH_driverVersionBugfix = 0 /*!< Bugfix for flash driver version.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 71 | }; |
Pawel Zarembski |
0:01f31e923fe2 | 72 | /*@}*/ |
Pawel Zarembski |
0:01f31e923fe2 | 73 | |
Pawel Zarembski |
0:01f31e923fe2 | 74 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 75 | * @name Flash configuration |
Pawel Zarembski |
0:01f31e923fe2 | 76 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 77 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 78 | /*! @brief Whether to support FlexNVM in flash driver */ |
Pawel Zarembski |
0:01f31e923fe2 | 79 | #if !defined(FLASH_SSD_CONFIG_ENABLE_FLEXNVM_SUPPORT) |
Pawel Zarembski |
0:01f31e923fe2 | 80 | #define FLASH_SSD_CONFIG_ENABLE_FLEXNVM_SUPPORT 1 /*!< Enable FlexNVM support by default. */ |
Pawel Zarembski |
0:01f31e923fe2 | 81 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 82 | |
Pawel Zarembski |
0:01f31e923fe2 | 83 | /*! @brief Whether the FlexNVM is enabled in flash driver */ |
Pawel Zarembski |
0:01f31e923fe2 | 84 | #define FLASH_SSD_IS_FLEXNVM_ENABLED (FLASH_SSD_CONFIG_ENABLE_FLEXNVM_SUPPORT && FSL_FEATURE_FLASH_HAS_FLEX_NVM) |
Pawel Zarembski |
0:01f31e923fe2 | 85 | |
Pawel Zarembski |
0:01f31e923fe2 | 86 | /*! @brief Flash driver location. */ |
Pawel Zarembski |
0:01f31e923fe2 | 87 | #if !defined(FLASH_DRIVER_IS_FLASH_RESIDENT) |
Pawel Zarembski |
0:01f31e923fe2 | 88 | #if (!defined(BL_TARGET_ROM) && !defined(BL_TARGET_RAM)) |
Pawel Zarembski |
0:01f31e923fe2 | 89 | #define FLASH_DRIVER_IS_FLASH_RESIDENT 1 /*!< Used for flash resident application. */ |
Pawel Zarembski |
0:01f31e923fe2 | 90 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 91 | #define FLASH_DRIVER_IS_FLASH_RESIDENT 0 /*!< Used for non-flash resident application. */ |
Pawel Zarembski |
0:01f31e923fe2 | 92 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 93 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 94 | |
Pawel Zarembski |
0:01f31e923fe2 | 95 | /*! @brief Flash Driver Export option */ |
Pawel Zarembski |
0:01f31e923fe2 | 96 | #if !defined(FLASH_DRIVER_IS_EXPORTED) |
Pawel Zarembski |
0:01f31e923fe2 | 97 | #if (defined(BL_TARGET_ROM) || defined(BL_TARGET_FLASH)) |
Pawel Zarembski |
0:01f31e923fe2 | 98 | #define FLASH_DRIVER_IS_EXPORTED 1 /*!< Used for ROM bootloader. */ |
Pawel Zarembski |
0:01f31e923fe2 | 99 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 100 | #define FLASH_DRIVER_IS_EXPORTED 0 /*!< Used for SDK application. */ |
Pawel Zarembski |
0:01f31e923fe2 | 101 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 102 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 103 | /*@}*/ |
Pawel Zarembski |
0:01f31e923fe2 | 104 | |
Pawel Zarembski |
0:01f31e923fe2 | 105 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 106 | * @name Flash status |
Pawel Zarembski |
0:01f31e923fe2 | 107 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 108 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 109 | /*! @brief Flash driver status group. */ |
Pawel Zarembski |
0:01f31e923fe2 | 110 | #if defined(kStatusGroup_FlashDriver) |
Pawel Zarembski |
0:01f31e923fe2 | 111 | #define kStatusGroupGeneric kStatusGroup_Generic |
Pawel Zarembski |
0:01f31e923fe2 | 112 | #define kStatusGroupFlashDriver kStatusGroup_FlashDriver |
Pawel Zarembski |
0:01f31e923fe2 | 113 | #elif defined(kStatusGroup_FLASH) |
Pawel Zarembski |
0:01f31e923fe2 | 114 | #define kStatusGroupGeneric kStatusGroup_Generic |
Pawel Zarembski |
0:01f31e923fe2 | 115 | #define kStatusGroupFlashDriver kStatusGroup_FLASH |
Pawel Zarembski |
0:01f31e923fe2 | 116 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 117 | #define kStatusGroupGeneric 0 |
Pawel Zarembski |
0:01f31e923fe2 | 118 | #define kStatusGroupFlashDriver 1 |
Pawel Zarembski |
0:01f31e923fe2 | 119 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 120 | |
Pawel Zarembski |
0:01f31e923fe2 | 121 | /*! @brief Construct a status code value from a group and code number. */ |
Pawel Zarembski |
0:01f31e923fe2 | 122 | #if !defined(MAKE_STATUS) |
Pawel Zarembski |
0:01f31e923fe2 | 123 | #define MAKE_STATUS(group, code) ((((group)*100) + (code))) |
Pawel Zarembski |
0:01f31e923fe2 | 124 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 125 | |
Pawel Zarembski |
0:01f31e923fe2 | 126 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 127 | * @brief Flash driver status codes. |
Pawel Zarembski |
0:01f31e923fe2 | 128 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 129 | enum _flash_status |
Pawel Zarembski |
0:01f31e923fe2 | 130 | { |
Pawel Zarembski |
0:01f31e923fe2 | 131 | kStatus_FLASH_Success = MAKE_STATUS(kStatusGroupGeneric, 0), /*!< Api is executed successfully*/ |
Pawel Zarembski |
0:01f31e923fe2 | 132 | kStatus_FLASH_InvalidArgument = MAKE_STATUS(kStatusGroupGeneric, 4), /*!< Invalid argument*/ |
Pawel Zarembski |
0:01f31e923fe2 | 133 | kStatus_FLASH_SizeError = MAKE_STATUS(kStatusGroupFlashDriver, 0), /*!< Error size*/ |
Pawel Zarembski |
0:01f31e923fe2 | 134 | kStatus_FLASH_AlignmentError = |
Pawel Zarembski |
0:01f31e923fe2 | 135 | MAKE_STATUS(kStatusGroupFlashDriver, 1), /*!< Parameter is not aligned with specified baseline*/ |
Pawel Zarembski |
0:01f31e923fe2 | 136 | kStatus_FLASH_AddressError = MAKE_STATUS(kStatusGroupFlashDriver, 2), /*!< Address is out of range */ |
Pawel Zarembski |
0:01f31e923fe2 | 137 | kStatus_FLASH_AccessError = |
Pawel Zarembski |
0:01f31e923fe2 | 138 | MAKE_STATUS(kStatusGroupFlashDriver, 3), /*!< Invalid instruction codes and out-of bounds addresses */ |
Pawel Zarembski |
0:01f31e923fe2 | 139 | kStatus_FLASH_ProtectionViolation = MAKE_STATUS( |
Pawel Zarembski |
0:01f31e923fe2 | 140 | kStatusGroupFlashDriver, 4), /*!< The program/erase operation is requested to execute on protected areas */ |
Pawel Zarembski |
0:01f31e923fe2 | 141 | kStatus_FLASH_CommandFailure = |
Pawel Zarembski |
0:01f31e923fe2 | 142 | MAKE_STATUS(kStatusGroupFlashDriver, 5), /*!< Run-time error during command execution. */ |
Pawel Zarembski |
0:01f31e923fe2 | 143 | kStatus_FLASH_UnknownProperty = MAKE_STATUS(kStatusGroupFlashDriver, 6), /*!< Unknown property.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 144 | kStatus_FLASH_EraseKeyError = MAKE_STATUS(kStatusGroupFlashDriver, 7), /*!< Api erase key is invalid.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 145 | kStatus_FLASH_RegionExecuteOnly = MAKE_STATUS(kStatusGroupFlashDriver, 8), /*!< Current region is execute only.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 146 | kStatus_FLASH_ExecuteInRamFunctionNotReady = |
Pawel Zarembski |
0:01f31e923fe2 | 147 | MAKE_STATUS(kStatusGroupFlashDriver, 9), /*!< Execute-in-ram function is not available.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 148 | kStatus_FLASH_PartitionStatusUpdateFailure = |
Pawel Zarembski |
0:01f31e923fe2 | 149 | MAKE_STATUS(kStatusGroupFlashDriver, 10), /*!< Failed to update partition status.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 150 | kStatus_FLASH_SetFlexramAsEepromError = |
Pawel Zarembski |
0:01f31e923fe2 | 151 | MAKE_STATUS(kStatusGroupFlashDriver, 11), /*!< Failed to set flexram as eeprom.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 152 | kStatus_FLASH_RecoverFlexramAsRamError = |
Pawel Zarembski |
0:01f31e923fe2 | 153 | MAKE_STATUS(kStatusGroupFlashDriver, 12), /*!< Failed to recover flexram as ram.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 154 | kStatus_FLASH_SetFlexramAsRamError = MAKE_STATUS(kStatusGroupFlashDriver, 13), /*!< Failed to set flexram as ram.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 155 | kStatus_FLASH_RecoverFlexramAsEepromError = |
Pawel Zarembski |
0:01f31e923fe2 | 156 | MAKE_STATUS(kStatusGroupFlashDriver, 14), /*!< Failed to recover flexram as eeprom.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 157 | kStatus_FLASH_CommandNotSupported = MAKE_STATUS(kStatusGroupFlashDriver, 15), /*!< Flash api is not supported.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 158 | kStatus_FLASH_SwapSystemNotInUninitialized = |
Pawel Zarembski |
0:01f31e923fe2 | 159 | MAKE_STATUS(kStatusGroupFlashDriver, 16), /*!< Swap system is not in uninitialzed state.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 160 | kStatus_FLASH_SwapIndicatorAddressError = |
Pawel Zarembski |
0:01f31e923fe2 | 161 | MAKE_STATUS(kStatusGroupFlashDriver, 17), /*!< Swap indicator address is invalid.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 162 | }; |
Pawel Zarembski |
0:01f31e923fe2 | 163 | /*@}*/ |
Pawel Zarembski |
0:01f31e923fe2 | 164 | |
Pawel Zarembski |
0:01f31e923fe2 | 165 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 166 | * @name Flash API key |
Pawel Zarembski |
0:01f31e923fe2 | 167 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 168 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 169 | /*! @brief Construct the four char code for flash driver API key. */ |
Pawel Zarembski |
0:01f31e923fe2 | 170 | #if !defined(FOUR_CHAR_CODE) |
Pawel Zarembski |
0:01f31e923fe2 | 171 | #define FOUR_CHAR_CODE(a, b, c, d) (((d) << 24) | ((c) << 16) | ((b) << 8) | ((a))) |
Pawel Zarembski |
0:01f31e923fe2 | 172 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 173 | |
Pawel Zarembski |
0:01f31e923fe2 | 174 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 175 | * @brief Enumeration for flash driver API keys. |
Pawel Zarembski |
0:01f31e923fe2 | 176 | * |
Pawel Zarembski |
0:01f31e923fe2 | 177 | * @note The resulting value is built with a byte order such that the string |
Pawel Zarembski |
0:01f31e923fe2 | 178 | * being readable in expected order when viewed in a hex editor, if the value |
Pawel Zarembski |
0:01f31e923fe2 | 179 | * is treated as a 32-bit little endian value. |
Pawel Zarembski |
0:01f31e923fe2 | 180 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 181 | enum _flash_driver_api_keys |
Pawel Zarembski |
0:01f31e923fe2 | 182 | { |
Pawel Zarembski |
0:01f31e923fe2 | 183 | kFLASH_apiEraseKey = FOUR_CHAR_CODE('k', 'f', 'e', 'k') /*!< Key value used to validate all flash erase APIs.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 184 | }; |
Pawel Zarembski |
0:01f31e923fe2 | 185 | /*@}*/ |
Pawel Zarembski |
0:01f31e923fe2 | 186 | |
Pawel Zarembski |
0:01f31e923fe2 | 187 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 188 | * @brief Enumeration for supported flash margin levels. |
Pawel Zarembski |
0:01f31e923fe2 | 189 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 190 | typedef enum _flash_margin_value |
Pawel Zarembski |
0:01f31e923fe2 | 191 | { |
Pawel Zarembski |
0:01f31e923fe2 | 192 | kFLASH_marginValueNormal, /*!< Use the 'normal' read level for 1s.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 193 | kFLASH_marginValueUser, /*!< Apply the 'User' margin to the normal read-1 level.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 194 | kFLASH_marginValueFactory, /*!< Apply the 'Factory' margin to the normal read-1 level.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 195 | kFLASH_marginValueInvalid /*!< Not real margin level, Used to determine the range of valid margin level. */ |
Pawel Zarembski |
0:01f31e923fe2 | 196 | } flash_margin_value_t; |
Pawel Zarembski |
0:01f31e923fe2 | 197 | |
Pawel Zarembski |
0:01f31e923fe2 | 198 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 199 | * @brief Enumeration for the three possible flash security states. |
Pawel Zarembski |
0:01f31e923fe2 | 200 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 201 | typedef enum _flash_security_state |
Pawel Zarembski |
0:01f31e923fe2 | 202 | { |
Pawel Zarembski |
0:01f31e923fe2 | 203 | kFLASH_securityStateNotSecure, /*!< Flash is not secure.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 204 | kFLASH_securityStateBackdoorEnabled, /*!< Flash backdoor is enabled.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 205 | kFLASH_securityStateBackdoorDisabled /*!< Flash backdoor is disabled.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 206 | } flash_security_state_t; |
Pawel Zarembski |
0:01f31e923fe2 | 207 | |
Pawel Zarembski |
0:01f31e923fe2 | 208 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 209 | * @brief Enumeration for the three possible flash protection levels. |
Pawel Zarembski |
0:01f31e923fe2 | 210 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 211 | typedef enum _flash_protection_state |
Pawel Zarembski |
0:01f31e923fe2 | 212 | { |
Pawel Zarembski |
0:01f31e923fe2 | 213 | kFLASH_protectionStateUnprotected, /*!< Flash region is not protected.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 214 | kFLASH_protectionStateProtected, /*!< Flash region is protected.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 215 | kFLASH_protectionStateMixed /*!< Flash is mixed with protected and unprotected region.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 216 | } flash_protection_state_t; |
Pawel Zarembski |
0:01f31e923fe2 | 217 | |
Pawel Zarembski |
0:01f31e923fe2 | 218 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 219 | * @brief Enumeration for the three possible flash execute access levels. |
Pawel Zarembski |
0:01f31e923fe2 | 220 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 221 | typedef enum _flash_execute_only_access_state |
Pawel Zarembski |
0:01f31e923fe2 | 222 | { |
Pawel Zarembski |
0:01f31e923fe2 | 223 | kFLASH_accessStateUnLimited, /*!< Flash region is unLimited.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 224 | kFLASH_accessStateExecuteOnly, /*!< Flash region is execute only.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 225 | kFLASH_accessStateMixed /*!< Flash is mixed with unLimited and execute only region.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 226 | } flash_execute_only_access_state_t; |
Pawel Zarembski |
0:01f31e923fe2 | 227 | |
Pawel Zarembski |
0:01f31e923fe2 | 228 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 229 | * @brief Enumeration for various flash properties. |
Pawel Zarembski |
0:01f31e923fe2 | 230 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 231 | typedef enum _flash_property_tag |
Pawel Zarembski |
0:01f31e923fe2 | 232 | { |
Pawel Zarembski |
0:01f31e923fe2 | 233 | kFLASH_propertyPflashSectorSize = 0x00U, /*!< Pflash sector size property.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 234 | kFLASH_propertyPflashTotalSize = 0x01U, /*!< Pflash total size property.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 235 | kFLASH_propertyPflashBlockSize = 0x02U, /*!< Pflash block size property.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 236 | kFLASH_propertyPflashBlockCount = 0x03U, /*!< Pflash block count property.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 237 | kFLASH_propertyPflashBlockBaseAddr = 0x04U, /*!< Pflash block base address property.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 238 | kFLASH_propertyPflashFacSupport = 0x05U, /*!< Pflash fac support property.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 239 | kFLASH_propertyPflashAccessSegmentSize = 0x06U, /*!< Pflash access segment size property.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 240 | kFLASH_propertyPflashAccessSegmentCount = 0x07U, /*!< Pflash access segment count property.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 241 | kFLASH_propertyFlexRamBlockBaseAddr = 0x08U, /*!< FlexRam block base address property.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 242 | kFLASH_propertyFlexRamTotalSize = 0x09U, /*!< FlexRam total size property.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 243 | kFLASH_propertyDflashSectorSize = 0x10U, /*!< Dflash sector size property.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 244 | kFLASH_propertyDflashTotalSize = 0x11U, /*!< Dflash total size property.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 245 | kFLASH_propertyDflashBlockSize = 0x12U, /*!< Dflash block count property.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 246 | kFLASH_propertyDflashBlockCount = 0x13U, /*!< Dflash block base address property.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 247 | kFLASH_propertyDflashBlockBaseAddr = 0x14U, /*!< Eeprom total size property.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 248 | kFLASH_propertyEepromTotalSize = 0x15U |
Pawel Zarembski |
0:01f31e923fe2 | 249 | } flash_property_tag_t; |
Pawel Zarembski |
0:01f31e923fe2 | 250 | |
Pawel Zarembski |
0:01f31e923fe2 | 251 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 252 | * @brief Constants for execute-in-ram flash function. |
Pawel Zarembski |
0:01f31e923fe2 | 253 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 254 | enum _flash_execute_in_ram_function_constants |
Pawel Zarembski |
0:01f31e923fe2 | 255 | { |
Pawel Zarembski |
0:01f31e923fe2 | 256 | kFLASH_executeInRamFunctionMaxSize = 64U, /*!< Max size of execute-in-ram function.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 257 | kFLASH_executeInRamFunctionTotalNum = 2U /*!< Total number of execute-in-ram functions.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 258 | }; |
Pawel Zarembski |
0:01f31e923fe2 | 259 | |
Pawel Zarembski |
0:01f31e923fe2 | 260 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 261 | * @brief Flash execute-in-ram function information. |
Pawel Zarembski |
0:01f31e923fe2 | 262 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 263 | typedef struct _flash_execute_in_ram_function_config |
Pawel Zarembski |
0:01f31e923fe2 | 264 | { |
Pawel Zarembski |
0:01f31e923fe2 | 265 | uint32_t activeFunctionCount; /*!< Number of available execute-in-ram functions.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 266 | uint8_t *flashRunCommand; /*!< execute-in-ram function: flash_run_command.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 267 | uint8_t *flashCacheClearCommand; /*!< execute-in-ram function: flash_cache_clear_command.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 268 | } flash_execute_in_ram_function_config_t; |
Pawel Zarembski |
0:01f31e923fe2 | 269 | |
Pawel Zarembski |
0:01f31e923fe2 | 270 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 271 | * @brief Enumeration for the two possible options of flash read resource command. |
Pawel Zarembski |
0:01f31e923fe2 | 272 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 273 | typedef enum _flash_read_resource_option |
Pawel Zarembski |
0:01f31e923fe2 | 274 | { |
Pawel Zarembski |
0:01f31e923fe2 | 275 | kFLASH_resourceOptionFlashIfr = |
Pawel Zarembski |
0:01f31e923fe2 | 276 | 0x00U, /*!< Select code for Program flash 0 IFR, Program flash swap 0 IFR, Data flash 0 IFR */ |
Pawel Zarembski |
0:01f31e923fe2 | 277 | kFLASH_resourceOptionVersionId = 0x01U /*!< Select code for Version ID*/ |
Pawel Zarembski |
0:01f31e923fe2 | 278 | } flash_read_resource_option_t; |
Pawel Zarembski |
0:01f31e923fe2 | 279 | |
Pawel Zarembski |
0:01f31e923fe2 | 280 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 281 | * @brief Enumeration for the range of special-purpose flash resource |
Pawel Zarembski |
0:01f31e923fe2 | 282 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 283 | enum _flash_read_resource_range |
Pawel Zarembski |
0:01f31e923fe2 | 284 | { |
Pawel Zarembski |
0:01f31e923fe2 | 285 | #if (FSL_FEATURE_FLASH_IS_FTFE == 1) |
Pawel Zarembski |
0:01f31e923fe2 | 286 | kFLASH_resourceRangePflashIfrSizeInBytes = 1024U, /*!< Pflash IFR size in byte.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 287 | kFLASH_resourceRangeVersionIdSizeInBytes = 8U, /*!< Version ID IFR size in byte.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 288 | kFLASH_resourceRangeVersionIdStart = 0x08U, /*!< Version ID IFR start address.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 289 | kFLASH_resourceRangeVersionIdEnd = 0x0FU, /*!< Version ID IFR end address.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 290 | #else /* FSL_FEATURE_FLASH_IS_FTFL == 1 or FSL_FEATURE_FLASH_IS_FTFA = =1 */ |
Pawel Zarembski |
0:01f31e923fe2 | 291 | kFLASH_resourceRangePflashIfrSizeInBytes = 256U, /*!< Pflash IFR size in byte.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 292 | kFLASH_resourceRangeVersionIdSizeInBytes = 8U, /*!< Version ID IFR size in byte.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 293 | kFLASH_resourceRangeVersionIdStart = 0x00U, /*!< Version ID IFR start address.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 294 | kFLASH_resourceRangeVersionIdEnd = 0x07U, /*!< Version ID IFR end address.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 295 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 296 | kFLASH_resourceRangePflashSwapIfrStart = 0x40000U, /*!< Pflash swap IFR start address.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 297 | kFLASH_resourceRangePflashSwapIfrEnd = 0x403FFU, /*!< Pflash swap IFR end address.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 298 | kFLASH_resourceRangeDflashIfrStart = 0x800000U, /*!< Dflash IFR start address.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 299 | kFLASH_resourceRangeDflashIfrEnd = 0x8003FFU, /*!< Dflash IFR end address.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 300 | }; |
Pawel Zarembski |
0:01f31e923fe2 | 301 | |
Pawel Zarembski |
0:01f31e923fe2 | 302 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 303 | * @brief Enumeration for the two possilbe options of set flexram function command. |
Pawel Zarembski |
0:01f31e923fe2 | 304 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 305 | typedef enum _flash_flexram_function_option |
Pawel Zarembski |
0:01f31e923fe2 | 306 | { |
Pawel Zarembski |
0:01f31e923fe2 | 307 | kFLASH_flexramFunctionOptionAvailableAsRam = 0xFFU, /*!< Option used to make FlexRAM available as RAM */ |
Pawel Zarembski |
0:01f31e923fe2 | 308 | kFLASH_flexramFunctionOptionAvailableForEeprom = 0x00U /*!< Option used to make FlexRAM available for EEPROM */ |
Pawel Zarembski |
0:01f31e923fe2 | 309 | } flash_flexram_function_option_t; |
Pawel Zarembski |
0:01f31e923fe2 | 310 | |
Pawel Zarembski |
0:01f31e923fe2 | 311 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 312 | * @brief Enumeration for the possible options of Swap function |
Pawel Zarembski |
0:01f31e923fe2 | 313 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 314 | typedef enum _flash_swap_function_option |
Pawel Zarembski |
0:01f31e923fe2 | 315 | { |
Pawel Zarembski |
0:01f31e923fe2 | 316 | kFLASH_swapFunctionOptionEnable = 0x00U, /*!< Option used to enable Swap function */ |
Pawel Zarembski |
0:01f31e923fe2 | 317 | kFLASH_swapFunctionOptionDisable = 0x01U /*!< Option used to Disable Swap function */ |
Pawel Zarembski |
0:01f31e923fe2 | 318 | } flash_swap_function_option_t; |
Pawel Zarembski |
0:01f31e923fe2 | 319 | |
Pawel Zarembski |
0:01f31e923fe2 | 320 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 321 | * @brief Enumeration for the possible options of Swap Control commands |
Pawel Zarembski |
0:01f31e923fe2 | 322 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 323 | typedef enum _flash_swap_control_option |
Pawel Zarembski |
0:01f31e923fe2 | 324 | { |
Pawel Zarembski |
0:01f31e923fe2 | 325 | kFLASH_swapControlOptionIntializeSystem = 0x01U, /*!< Option used to Intialize Swap System */ |
Pawel Zarembski |
0:01f31e923fe2 | 326 | kFLASH_swapControlOptionSetInUpdateState = 0x02U, /*!< Option used to Set Swap in Update State */ |
Pawel Zarembski |
0:01f31e923fe2 | 327 | kFLASH_swapControlOptionSetInCompleteState = 0x04U, /*!< Option used to Set Swap in Complete State */ |
Pawel Zarembski |
0:01f31e923fe2 | 328 | kFLASH_swapControlOptionReportStatus = 0x08U, /*!< Option used to Report Swap Status */ |
Pawel Zarembski |
0:01f31e923fe2 | 329 | kFLASH_swapControlOptionDisableSystem = 0x10U /*!< Option used to Disable Swap Status */ |
Pawel Zarembski |
0:01f31e923fe2 | 330 | } flash_swap_control_option_t; |
Pawel Zarembski |
0:01f31e923fe2 | 331 | |
Pawel Zarembski |
0:01f31e923fe2 | 332 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 333 | * @brief Enumeration for the possible flash swap status. |
Pawel Zarembski |
0:01f31e923fe2 | 334 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 335 | typedef enum _flash_swap_state |
Pawel Zarembski |
0:01f31e923fe2 | 336 | { |
Pawel Zarembski |
0:01f31e923fe2 | 337 | kFLASH_swapStateUninitialized = 0x00U, /*!< Flash swap system is in uninitialized state.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 338 | kFLASH_swapStateReady = 0x01U, /*!< Flash swap system is in ready state.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 339 | kFLASH_swapStateUpdate = 0x02U, /*!< Flash swap system is in update state.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 340 | kFLASH_swapStateUpdateErased = 0x03U, /*!< Flash swap system is in updateErased state.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 341 | kFLASH_swapStateComplete = 0x04U, /*!< Flash swap system is in complete state.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 342 | kFLASH_swapStateDisabled = 0x05U /*!< Flash swap system is in disabled state.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 343 | } flash_swap_state_t; |
Pawel Zarembski |
0:01f31e923fe2 | 344 | |
Pawel Zarembski |
0:01f31e923fe2 | 345 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 346 | * @breif Enumeration for the possible flash swap block status |
Pawel Zarembski |
0:01f31e923fe2 | 347 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 348 | typedef enum _flash_swap_block_status |
Pawel Zarembski |
0:01f31e923fe2 | 349 | { |
Pawel Zarembski |
0:01f31e923fe2 | 350 | kFLASH_swapBlockStatusLowerHalfProgramBlocksAtZero = |
Pawel Zarembski |
0:01f31e923fe2 | 351 | 0x00U, /*!< Swap block status is that lower half program block at zero.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 352 | kFLASH_swapBlockStatusUpperHalfProgramBlocksAtZero = |
Pawel Zarembski |
0:01f31e923fe2 | 353 | 0x01U, /*!< Swap block status is that upper half program block at zero.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 354 | } flash_swap_block_status_t; |
Pawel Zarembski |
0:01f31e923fe2 | 355 | |
Pawel Zarembski |
0:01f31e923fe2 | 356 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 357 | * @brief Flash Swap information. |
Pawel Zarembski |
0:01f31e923fe2 | 358 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 359 | typedef struct _flash_swap_state_config |
Pawel Zarembski |
0:01f31e923fe2 | 360 | { |
Pawel Zarembski |
0:01f31e923fe2 | 361 | flash_swap_state_t flashSwapState; /*!< Current swap system status.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 362 | flash_swap_block_status_t currentSwapBlockStatus; /*!< Current swap block status.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 363 | flash_swap_block_status_t nextSwapBlockStatus; /*!< Next swap block status.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 364 | } flash_swap_state_config_t; |
Pawel Zarembski |
0:01f31e923fe2 | 365 | |
Pawel Zarembski |
0:01f31e923fe2 | 366 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 367 | * @brief Flash Swap IFR fileds. |
Pawel Zarembski |
0:01f31e923fe2 | 368 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 369 | typedef struct _flash_swap_ifr_field_config |
Pawel Zarembski |
0:01f31e923fe2 | 370 | { |
Pawel Zarembski |
0:01f31e923fe2 | 371 | uint16_t swapIndicatorAddress; /*!< Swap indicator address field.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 372 | uint16_t swapEnableWord; /*!< Swap enable word field.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 373 | uint8_t reserved0[6]; /*!< Reserved field.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 374 | uint16_t swapDisableWord; /*!< Swap disable word field.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 375 | uint8_t reserved1[4]; /*!< Reserved field.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 376 | } flash_swap_ifr_field_config_t; |
Pawel Zarembski |
0:01f31e923fe2 | 377 | |
Pawel Zarembski |
0:01f31e923fe2 | 378 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 379 | * @brief Enumeration for FlexRAM load during reset option. |
Pawel Zarembski |
0:01f31e923fe2 | 380 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 381 | typedef enum _flash_partition_flexram_load_option |
Pawel Zarembski |
0:01f31e923fe2 | 382 | { |
Pawel Zarembski |
0:01f31e923fe2 | 383 | kFLASH_partitionFlexramLoadOptionLoadedWithValidEepromData = |
Pawel Zarembski |
0:01f31e923fe2 | 384 | 0x00U, /*!< FlexRAM is loaded with valid EEPROM data during reset sequence.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 385 | kFLASH_partitionFlexramLoadOptionNotLoaded = 0x01U /*!< FlexRAM is not loaded during reset sequence.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 386 | } flash_partition_flexram_load_option_t; |
Pawel Zarembski |
0:01f31e923fe2 | 387 | |
Pawel Zarembski |
0:01f31e923fe2 | 388 | /*! @brief callback type used for pflash block*/ |
Pawel Zarembski |
0:01f31e923fe2 | 389 | typedef void (*flash_callback_t)(void); |
Pawel Zarembski |
0:01f31e923fe2 | 390 | |
Pawel Zarembski |
0:01f31e923fe2 | 391 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 392 | * @brief Active flash information for current operation. |
Pawel Zarembski |
0:01f31e923fe2 | 393 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 394 | typedef struct _flash_operation_config |
Pawel Zarembski |
0:01f31e923fe2 | 395 | { |
Pawel Zarembski |
0:01f31e923fe2 | 396 | uint32_t convertedAddress; /*!< Converted address for current flash type.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 397 | uint32_t activeSectorSize; /*!< Sector size of current flash type.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 398 | uint32_t activeBlockSize; /*!< Block size of current flash type.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 399 | uint32_t blockWriteUnitSize; /*!< write unit size.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 400 | uint32_t sectorCmdAddressAligment; /*!< Erase sector command address alignment.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 401 | uint32_t sectionCmdAddressAligment; /*!< Program/Verify section command address alignment.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 402 | uint32_t resourceCmdAddressAligment; /*!< Read resource command address alignment.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 403 | uint32_t checkCmdAddressAligment; /*!< Program check command address alignment.*/ |
Pawel Zarembski |
0:01f31e923fe2 | 404 | } flash_operation_config_t; |
Pawel Zarembski |
0:01f31e923fe2 | 405 | |
Pawel Zarembski |
0:01f31e923fe2 | 406 | /*! @brief Flash driver state information. |
Pawel Zarembski |
0:01f31e923fe2 | 407 | * |
Pawel Zarembski |
0:01f31e923fe2 | 408 | * An instance of this structure is allocated by the user of the flash driver and |
Pawel Zarembski |
0:01f31e923fe2 | 409 | * passed into each of the driver APIs. |
Pawel Zarembski |
0:01f31e923fe2 | 410 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 411 | typedef struct _flash_config |
Pawel Zarembski |
0:01f31e923fe2 | 412 | { |
Pawel Zarembski |
0:01f31e923fe2 | 413 | uint32_t PFlashBlockBase; /*!< Base address of the first PFlash block */ |
Pawel Zarembski |
0:01f31e923fe2 | 414 | uint32_t PFlashTotalSize; /*!< Size of all combined PFlash block. */ |
Pawel Zarembski |
0:01f31e923fe2 | 415 | uint32_t PFlashBlockCount; /*!< Number of PFlash blocks. */ |
Pawel Zarembski |
0:01f31e923fe2 | 416 | uint32_t PFlashSectorSize; /*!< Size in bytes of a sector of PFlash. */ |
Pawel Zarembski |
0:01f31e923fe2 | 417 | flash_callback_t PFlashCallback; /*!< Callback function for flash API. */ |
Pawel Zarembski |
0:01f31e923fe2 | 418 | uint32_t PFlashAccessSegmentSize; /*!< Size in bytes of a access segment of PFlash. */ |
Pawel Zarembski |
0:01f31e923fe2 | 419 | uint32_t PFlashAccessSegmentCount; /*!< Number of PFlash access segments. */ |
Pawel Zarembski |
0:01f31e923fe2 | 420 | uint32_t *flashExecuteInRamFunctionInfo; /*!< Info struct of flash execute-in-ram function. */ |
Pawel Zarembski |
0:01f31e923fe2 | 421 | uint32_t FlexRAMBlockBase; /*!< For FlexNVM device, this is the base address of FlexRAM |
Pawel Zarembski |
0:01f31e923fe2 | 422 | For non-FlexNVM device, this is the base address of acceleration RAM memory */ |
Pawel Zarembski |
0:01f31e923fe2 | 423 | uint32_t FlexRAMTotalSize; /*!< For FlexNVM device, this is the size of FlexRAM |
Pawel Zarembski |
0:01f31e923fe2 | 424 | For non-FlexNVM device, this is the size of acceleration RAM memory */ |
Pawel Zarembski |
0:01f31e923fe2 | 425 | uint32_t DFlashBlockBase; /*!< For FlexNVM device, this is the base address of D-Flash memory (FlexNVM memory); |
Pawel Zarembski |
0:01f31e923fe2 | 426 | For non-FlexNVM device, this field is unused */ |
Pawel Zarembski |
0:01f31e923fe2 | 427 | uint32_t DFlashTotalSize; /*!< For FlexNVM device, this is total size of the FlexNVM memory; |
Pawel Zarembski |
0:01f31e923fe2 | 428 | For non-FlexNVM device, this field is unused */ |
Pawel Zarembski |
0:01f31e923fe2 | 429 | uint32_t EEpromTotalSize; /*!< For FlexNVM device, this is the size in byte of EEPROM area which was partitioned |
Pawel Zarembski |
0:01f31e923fe2 | 430 | from FlexRAM; |
Pawel Zarembski |
0:01f31e923fe2 | 431 | For non-FlexNVM device, this field is unused */ |
Pawel Zarembski |
0:01f31e923fe2 | 432 | } flash_config_t; |
Pawel Zarembski |
0:01f31e923fe2 | 433 | |
Pawel Zarembski |
0:01f31e923fe2 | 434 | /******************************************************************************* |
Pawel Zarembski |
0:01f31e923fe2 | 435 | * API |
Pawel Zarembski |
0:01f31e923fe2 | 436 | ******************************************************************************/ |
Pawel Zarembski |
0:01f31e923fe2 | 437 | |
Pawel Zarembski |
0:01f31e923fe2 | 438 | #if defined(__cplusplus) |
Pawel Zarembski |
0:01f31e923fe2 | 439 | extern "C" { |
Pawel Zarembski |
0:01f31e923fe2 | 440 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 441 | |
Pawel Zarembski |
0:01f31e923fe2 | 442 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 443 | * @name Initialization |
Pawel Zarembski |
0:01f31e923fe2 | 444 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 445 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 446 | |
Pawel Zarembski |
0:01f31e923fe2 | 447 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 448 | * @brief Initializes global flash properties structure members |
Pawel Zarembski |
0:01f31e923fe2 | 449 | * |
Pawel Zarembski |
0:01f31e923fe2 | 450 | * This function checks and initializes Flash module for the other Flash APIs. |
Pawel Zarembski |
0:01f31e923fe2 | 451 | * |
Pawel Zarembski |
0:01f31e923fe2 | 452 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 453 | * |
Pawel Zarembski |
0:01f31e923fe2 | 454 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 455 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 456 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 457 | * @retval #kStatus_FLASH_PartitionStatusUpdateFailure Failed to update partition status. |
Pawel Zarembski |
0:01f31e923fe2 | 458 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 459 | status_t FLASH_Init(flash_config_t *config); |
Pawel Zarembski |
0:01f31e923fe2 | 460 | |
Pawel Zarembski |
0:01f31e923fe2 | 461 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 462 | * @brief Set the desired flash callback function |
Pawel Zarembski |
0:01f31e923fe2 | 463 | * |
Pawel Zarembski |
0:01f31e923fe2 | 464 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 465 | * @param callback callback function to be stored in driver |
Pawel Zarembski |
0:01f31e923fe2 | 466 | * |
Pawel Zarembski |
0:01f31e923fe2 | 467 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 468 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 469 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 470 | status_t FLASH_SetCallback(flash_config_t *config, flash_callback_t callback); |
Pawel Zarembski |
0:01f31e923fe2 | 471 | |
Pawel Zarembski |
0:01f31e923fe2 | 472 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 473 | * @brief Prepare flash execute-in-ram functions |
Pawel Zarembski |
0:01f31e923fe2 | 474 | * |
Pawel Zarembski |
0:01f31e923fe2 | 475 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 476 | * |
Pawel Zarembski |
0:01f31e923fe2 | 477 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 478 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 479 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 480 | #if FLASH_DRIVER_IS_FLASH_RESIDENT |
Pawel Zarembski |
0:01f31e923fe2 | 481 | status_t FLASH_PrepareExecuteInRamFunctions(flash_config_t *config); |
Pawel Zarembski |
0:01f31e923fe2 | 482 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 483 | |
Pawel Zarembski |
0:01f31e923fe2 | 484 | /*@}*/ |
Pawel Zarembski |
0:01f31e923fe2 | 485 | |
Pawel Zarembski |
0:01f31e923fe2 | 486 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 487 | * @name Erasing |
Pawel Zarembski |
0:01f31e923fe2 | 488 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 489 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 490 | |
Pawel Zarembski |
0:01f31e923fe2 | 491 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 492 | * @brief Erases entire flash |
Pawel Zarembski |
0:01f31e923fe2 | 493 | * |
Pawel Zarembski |
0:01f31e923fe2 | 494 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 495 | * @param key value used to validate all flash erase APIs. |
Pawel Zarembski |
0:01f31e923fe2 | 496 | * |
Pawel Zarembski |
0:01f31e923fe2 | 497 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 498 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 499 | * @retval #kStatus_FLASH_EraseKeyError Api erase key is invalid. |
Pawel Zarembski |
0:01f31e923fe2 | 500 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 501 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 502 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 503 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 504 | * @retval #kStatus_FLASH_PartitionStatusUpdateFailure Failed to update partition status |
Pawel Zarembski |
0:01f31e923fe2 | 505 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 506 | status_t FLASH_EraseAll(flash_config_t *config, uint32_t key); |
Pawel Zarembski |
0:01f31e923fe2 | 507 | |
Pawel Zarembski |
0:01f31e923fe2 | 508 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 509 | * @brief Erases flash sectors encompassed by parameters passed into function |
Pawel Zarembski |
0:01f31e923fe2 | 510 | * |
Pawel Zarembski |
0:01f31e923fe2 | 511 | * This function erases the appropriate number of flash sectors based on the |
Pawel Zarembski |
0:01f31e923fe2 | 512 | * desired start address and length. |
Pawel Zarembski |
0:01f31e923fe2 | 513 | * |
Pawel Zarembski |
0:01f31e923fe2 | 514 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 515 | * @param start The start address of the desired flash memory to be erased. |
Pawel Zarembski |
0:01f31e923fe2 | 516 | * The start address does not need to be sector aligned but must be word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 517 | * @param lengthInBytes The length, given in bytes (not words or long-words) |
Pawel Zarembski |
0:01f31e923fe2 | 518 | * to be erased. Must be word aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 519 | * @param key value used to validate all flash erase APIs. |
Pawel Zarembski |
0:01f31e923fe2 | 520 | * |
Pawel Zarembski |
0:01f31e923fe2 | 521 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 522 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 523 | * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. |
Pawel Zarembski |
0:01f31e923fe2 | 524 | * @retval #kStatus_FLASH_AddressError Address is out of range. |
Pawel Zarembski |
0:01f31e923fe2 | 525 | * @retval #kStatus_FLASH_EraseKeyError Api erase key is invalid. |
Pawel Zarembski |
0:01f31e923fe2 | 526 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 527 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 528 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 529 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 530 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 531 | status_t FLASH_Erase(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, uint32_t key); |
Pawel Zarembski |
0:01f31e923fe2 | 532 | |
Pawel Zarembski |
0:01f31e923fe2 | 533 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 534 | * @brief Erases entire flash, including protected sectors. |
Pawel Zarembski |
0:01f31e923fe2 | 535 | * |
Pawel Zarembski |
0:01f31e923fe2 | 536 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 537 | * @param key value used to validate all flash erase APIs. |
Pawel Zarembski |
0:01f31e923fe2 | 538 | * |
Pawel Zarembski |
0:01f31e923fe2 | 539 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 540 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 541 | * @retval #kStatus_FLASH_EraseKeyError Api erase key is invalid. |
Pawel Zarembski |
0:01f31e923fe2 | 542 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 543 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 544 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 545 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 546 | * @retval #kStatus_FLASH_PartitionStatusUpdateFailure Failed to update partition status |
Pawel Zarembski |
0:01f31e923fe2 | 547 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 548 | #if defined(FSL_FEATURE_FLASH_HAS_ERASE_ALL_BLOCKS_UNSECURE_CMD) && FSL_FEATURE_FLASH_HAS_ERASE_ALL_BLOCKS_UNSECURE_CMD |
Pawel Zarembski |
0:01f31e923fe2 | 549 | status_t FLASH_EraseAllUnsecure(flash_config_t *config, uint32_t key); |
Pawel Zarembski |
0:01f31e923fe2 | 550 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 551 | |
Pawel Zarembski |
0:01f31e923fe2 | 552 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 553 | * @brief Erases all program flash execute-only segments defined by the FXACC registers. |
Pawel Zarembski |
0:01f31e923fe2 | 554 | * |
Pawel Zarembski |
0:01f31e923fe2 | 555 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 556 | * @param key value used to validate all flash erase APIs. |
Pawel Zarembski |
0:01f31e923fe2 | 557 | * |
Pawel Zarembski |
0:01f31e923fe2 | 558 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 559 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 560 | * @retval #kStatus_FLASH_EraseKeyError Api erase key is invalid. |
Pawel Zarembski |
0:01f31e923fe2 | 561 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 562 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 563 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 564 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 565 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 566 | status_t FLASH_EraseAllExecuteOnlySegments(flash_config_t *config, uint32_t key); |
Pawel Zarembski |
0:01f31e923fe2 | 567 | |
Pawel Zarembski |
0:01f31e923fe2 | 568 | /*@}*/ |
Pawel Zarembski |
0:01f31e923fe2 | 569 | |
Pawel Zarembski |
0:01f31e923fe2 | 570 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 571 | * @name Programming |
Pawel Zarembski |
0:01f31e923fe2 | 572 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 573 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 574 | |
Pawel Zarembski |
0:01f31e923fe2 | 575 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 576 | * @brief Programs flash with data at locations passed in through parameters |
Pawel Zarembski |
0:01f31e923fe2 | 577 | * |
Pawel Zarembski |
0:01f31e923fe2 | 578 | * This function programs the flash memory with desired data for a given |
Pawel Zarembski |
0:01f31e923fe2 | 579 | * flash area as determined by the start address and length. |
Pawel Zarembski |
0:01f31e923fe2 | 580 | * |
Pawel Zarembski |
0:01f31e923fe2 | 581 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 582 | * @param start The start address of the desired flash memory to be programmed. Must be |
Pawel Zarembski |
0:01f31e923fe2 | 583 | * word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 584 | * @param src Pointer to the source buffer of data that is to be programmed |
Pawel Zarembski |
0:01f31e923fe2 | 585 | * into the flash. |
Pawel Zarembski |
0:01f31e923fe2 | 586 | * @param lengthInBytes The length, given in bytes (not words or long-words) |
Pawel Zarembski |
0:01f31e923fe2 | 587 | * to be programmed. Must be word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 588 | * |
Pawel Zarembski |
0:01f31e923fe2 | 589 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 590 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 591 | * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. |
Pawel Zarembski |
0:01f31e923fe2 | 592 | * @retval #kStatus_FLASH_AddressError Address is out of range. |
Pawel Zarembski |
0:01f31e923fe2 | 593 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 594 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 595 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 596 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 597 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 598 | status_t FLASH_Program(flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes); |
Pawel Zarembski |
0:01f31e923fe2 | 599 | |
Pawel Zarembski |
0:01f31e923fe2 | 600 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 601 | * @brief Programs Program Once Field through parameters |
Pawel Zarembski |
0:01f31e923fe2 | 602 | * |
Pawel Zarembski |
0:01f31e923fe2 | 603 | * This function programs the Program Once Field with desired data for a given |
Pawel Zarembski |
0:01f31e923fe2 | 604 | * flash area as determined by the index and length. |
Pawel Zarembski |
0:01f31e923fe2 | 605 | * |
Pawel Zarembski |
0:01f31e923fe2 | 606 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 607 | * @param index The index indicating which area of Program Once Field to be programmed. |
Pawel Zarembski |
0:01f31e923fe2 | 608 | * @param src Pointer to the source buffer of data that is to be programmed |
Pawel Zarembski |
0:01f31e923fe2 | 609 | * into the Program Once Field. |
Pawel Zarembski |
0:01f31e923fe2 | 610 | * @param lengthInBytes The length, given in bytes (not words or long-words) |
Pawel Zarembski |
0:01f31e923fe2 | 611 | * to be programmed. Must be word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 612 | * |
Pawel Zarembski |
0:01f31e923fe2 | 613 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 614 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 615 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 616 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 617 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 618 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 619 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 620 | status_t FLASH_ProgramOnce(flash_config_t *config, uint32_t index, uint32_t *src, uint32_t lengthInBytes); |
Pawel Zarembski |
0:01f31e923fe2 | 621 | |
Pawel Zarembski |
0:01f31e923fe2 | 622 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 623 | * @brief Programs flash with data at locations passed in through parameters via Program Section command |
Pawel Zarembski |
0:01f31e923fe2 | 624 | * |
Pawel Zarembski |
0:01f31e923fe2 | 625 | * This function programs the flash memory with desired data for a given |
Pawel Zarembski |
0:01f31e923fe2 | 626 | * flash area as determined by the start address and length. |
Pawel Zarembski |
0:01f31e923fe2 | 627 | * |
Pawel Zarembski |
0:01f31e923fe2 | 628 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 629 | * @param start The start address of the desired flash memory to be programmed. Must be |
Pawel Zarembski |
0:01f31e923fe2 | 630 | * word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 631 | * @param src Pointer to the source buffer of data that is to be programmed |
Pawel Zarembski |
0:01f31e923fe2 | 632 | * into the flash. |
Pawel Zarembski |
0:01f31e923fe2 | 633 | * @param lengthInBytes The length, given in bytes (not words or long-words) |
Pawel Zarembski |
0:01f31e923fe2 | 634 | * to be programmed. Must be word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 635 | * |
Pawel Zarembski |
0:01f31e923fe2 | 636 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 637 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 638 | * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. |
Pawel Zarembski |
0:01f31e923fe2 | 639 | * @retval #kStatus_FLASH_AddressError Address is out of range. |
Pawel Zarembski |
0:01f31e923fe2 | 640 | * @retval #kStatus_FLASH_SetFlexramAsRamError Failed to set flexram as ram |
Pawel Zarembski |
0:01f31e923fe2 | 641 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 642 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 643 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 644 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 645 | * @retval #kStatus_FLASH_RecoverFlexramAsEepromError Failed to recover flexram as eeprom |
Pawel Zarembski |
0:01f31e923fe2 | 646 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 647 | #if defined(FSL_FEATURE_FLASH_HAS_PROGRAM_SECTION_CMD) && FSL_FEATURE_FLASH_HAS_PROGRAM_SECTION_CMD |
Pawel Zarembski |
0:01f31e923fe2 | 648 | status_t FLASH_ProgramSection(flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes); |
Pawel Zarembski |
0:01f31e923fe2 | 649 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 650 | |
Pawel Zarembski |
0:01f31e923fe2 | 651 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 652 | * @brief Programs EEPROM with data at locations passed in through parameters |
Pawel Zarembski |
0:01f31e923fe2 | 653 | * |
Pawel Zarembski |
0:01f31e923fe2 | 654 | * This function programs the Emulated EEPROM with desired data for a given |
Pawel Zarembski |
0:01f31e923fe2 | 655 | * flash area as determined by the start address and length. |
Pawel Zarembski |
0:01f31e923fe2 | 656 | * |
Pawel Zarembski |
0:01f31e923fe2 | 657 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 658 | * @param start The start address of the desired flash memory to be programmed. Must be |
Pawel Zarembski |
0:01f31e923fe2 | 659 | * word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 660 | * @param src Pointer to the source buffer of data that is to be programmed |
Pawel Zarembski |
0:01f31e923fe2 | 661 | * into the flash. |
Pawel Zarembski |
0:01f31e923fe2 | 662 | * @param lengthInBytes The length, given in bytes (not words or long-words) |
Pawel Zarembski |
0:01f31e923fe2 | 663 | * to be programmed. Must be word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 664 | * |
Pawel Zarembski |
0:01f31e923fe2 | 665 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 666 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 667 | * @retval #kStatus_FLASH_AddressError Address is out of range. |
Pawel Zarembski |
0:01f31e923fe2 | 668 | * @retval #kStatus_FLASH_SetFlexramAsEepromError Failed to set flexram as eeprom. |
Pawel Zarembski |
0:01f31e923fe2 | 669 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 670 | * @retval #kStatus_FLASH_RecoverFlexramAsRamError Failed to recover flexram as ram |
Pawel Zarembski |
0:01f31e923fe2 | 671 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 672 | #if FLASH_SSD_IS_FLEXNVM_ENABLED |
Pawel Zarembski |
0:01f31e923fe2 | 673 | status_t FLASH_EepromWrite(flash_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes); |
Pawel Zarembski |
0:01f31e923fe2 | 674 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 675 | |
Pawel Zarembski |
0:01f31e923fe2 | 676 | /*@}*/ |
Pawel Zarembski |
0:01f31e923fe2 | 677 | |
Pawel Zarembski |
0:01f31e923fe2 | 678 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 679 | * @name Reading |
Pawel Zarembski |
0:01f31e923fe2 | 680 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 681 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 682 | |
Pawel Zarembski |
0:01f31e923fe2 | 683 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 684 | * @brief Read resource with data at locations passed in through parameters |
Pawel Zarembski |
0:01f31e923fe2 | 685 | * |
Pawel Zarembski |
0:01f31e923fe2 | 686 | * This function reads the flash memory with desired location for a given |
Pawel Zarembski |
0:01f31e923fe2 | 687 | * flash area as determined by the start address and length. |
Pawel Zarembski |
0:01f31e923fe2 | 688 | * |
Pawel Zarembski |
0:01f31e923fe2 | 689 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 690 | * @param start The start address of the desired flash memory to be programmed. Must be |
Pawel Zarembski |
0:01f31e923fe2 | 691 | * word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 692 | * @param dst Pointer to the destination buffer of data that is used to store |
Pawel Zarembski |
0:01f31e923fe2 | 693 | * data to be read. |
Pawel Zarembski |
0:01f31e923fe2 | 694 | * @param lengthInBytes The length, given in bytes (not words or long-words) |
Pawel Zarembski |
0:01f31e923fe2 | 695 | * to be read. Must be word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 696 | * @param option The resource option which indicates which area should be read back. |
Pawel Zarembski |
0:01f31e923fe2 | 697 | * |
Pawel Zarembski |
0:01f31e923fe2 | 698 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 699 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 700 | * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. |
Pawel Zarembski |
0:01f31e923fe2 | 701 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 702 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 703 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 704 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 705 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 706 | #if defined(FSL_FEATURE_FLASH_HAS_READ_RESOURCE_CMD) && FSL_FEATURE_FLASH_HAS_READ_RESOURCE_CMD |
Pawel Zarembski |
0:01f31e923fe2 | 707 | status_t FLASH_ReadResource( |
Pawel Zarembski |
0:01f31e923fe2 | 708 | flash_config_t *config, uint32_t start, uint32_t *dst, uint32_t lengthInBytes, flash_read_resource_option_t option); |
Pawel Zarembski |
0:01f31e923fe2 | 709 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 710 | |
Pawel Zarembski |
0:01f31e923fe2 | 711 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 712 | * @brief Read Program Once Field through parameters |
Pawel Zarembski |
0:01f31e923fe2 | 713 | * |
Pawel Zarembski |
0:01f31e923fe2 | 714 | * This function reads the read once feild with given index and length |
Pawel Zarembski |
0:01f31e923fe2 | 715 | * |
Pawel Zarembski |
0:01f31e923fe2 | 716 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 717 | * @param index The index indicating the area of program once field to be read. |
Pawel Zarembski |
0:01f31e923fe2 | 718 | * @param dst Pointer to the destination buffer of data that is used to store |
Pawel Zarembski |
0:01f31e923fe2 | 719 | * data to be read. |
Pawel Zarembski |
0:01f31e923fe2 | 720 | * @param lengthInBytes The length, given in bytes (not words or long-words) |
Pawel Zarembski |
0:01f31e923fe2 | 721 | * to be programmed. Must be word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 722 | * |
Pawel Zarembski |
0:01f31e923fe2 | 723 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 724 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 725 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 726 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 727 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 728 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 729 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 730 | status_t FLASH_ReadOnce(flash_config_t *config, uint32_t index, uint32_t *dst, uint32_t lengthInBytes); |
Pawel Zarembski |
0:01f31e923fe2 | 731 | |
Pawel Zarembski |
0:01f31e923fe2 | 732 | /*@}*/ |
Pawel Zarembski |
0:01f31e923fe2 | 733 | |
Pawel Zarembski |
0:01f31e923fe2 | 734 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 735 | * @name Security |
Pawel Zarembski |
0:01f31e923fe2 | 736 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 737 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 738 | |
Pawel Zarembski |
0:01f31e923fe2 | 739 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 740 | * @brief Returns the security state via the pointer passed into the function |
Pawel Zarembski |
0:01f31e923fe2 | 741 | * |
Pawel Zarembski |
0:01f31e923fe2 | 742 | * This function retrieves the current Flash security status, including the |
Pawel Zarembski |
0:01f31e923fe2 | 743 | * security enabling state and the backdoor key enabling state. |
Pawel Zarembski |
0:01f31e923fe2 | 744 | * |
Pawel Zarembski |
0:01f31e923fe2 | 745 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 746 | * @param state Pointer to the value returned for the current security status code: |
Pawel Zarembski |
0:01f31e923fe2 | 747 | * |
Pawel Zarembski |
0:01f31e923fe2 | 748 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 749 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 750 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 751 | status_t FLASH_GetSecurityState(flash_config_t *config, flash_security_state_t *state); |
Pawel Zarembski |
0:01f31e923fe2 | 752 | |
Pawel Zarembski |
0:01f31e923fe2 | 753 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 754 | * @brief Allows user to bypass security with a backdoor key |
Pawel Zarembski |
0:01f31e923fe2 | 755 | * |
Pawel Zarembski |
0:01f31e923fe2 | 756 | * If the MCU is in secured state, this function will unsecure the MCU by |
Pawel Zarembski |
0:01f31e923fe2 | 757 | * comparing the provided backdoor key with ones in the Flash Configuration |
Pawel Zarembski |
0:01f31e923fe2 | 758 | * Field. |
Pawel Zarembski |
0:01f31e923fe2 | 759 | * |
Pawel Zarembski |
0:01f31e923fe2 | 760 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 761 | * @param backdoorKey Pointer to the user buffer containing the backdoor key. |
Pawel Zarembski |
0:01f31e923fe2 | 762 | * |
Pawel Zarembski |
0:01f31e923fe2 | 763 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 764 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 765 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 766 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 767 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 768 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 769 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 770 | status_t FLASH_SecurityBypass(flash_config_t *config, const uint8_t *backdoorKey); |
Pawel Zarembski |
0:01f31e923fe2 | 771 | |
Pawel Zarembski |
0:01f31e923fe2 | 772 | /*@}*/ |
Pawel Zarembski |
0:01f31e923fe2 | 773 | |
Pawel Zarembski |
0:01f31e923fe2 | 774 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 775 | * @name Verification |
Pawel Zarembski |
0:01f31e923fe2 | 776 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 777 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 778 | |
Pawel Zarembski |
0:01f31e923fe2 | 779 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 780 | * @brief Verifies erasure of entire flash at specified margin level |
Pawel Zarembski |
0:01f31e923fe2 | 781 | * |
Pawel Zarembski |
0:01f31e923fe2 | 782 | * This function will check to see if the flash have been erased to the |
Pawel Zarembski |
0:01f31e923fe2 | 783 | * specified read margin level. |
Pawel Zarembski |
0:01f31e923fe2 | 784 | * |
Pawel Zarembski |
0:01f31e923fe2 | 785 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 786 | * @param margin Read margin choice |
Pawel Zarembski |
0:01f31e923fe2 | 787 | * |
Pawel Zarembski |
0:01f31e923fe2 | 788 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 789 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 790 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 791 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 792 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 793 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 794 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 795 | status_t FLASH_VerifyEraseAll(flash_config_t *config, flash_margin_value_t margin); |
Pawel Zarembski |
0:01f31e923fe2 | 796 | |
Pawel Zarembski |
0:01f31e923fe2 | 797 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 798 | * @brief Verifies erasure of desired flash area at specified margin level |
Pawel Zarembski |
0:01f31e923fe2 | 799 | * |
Pawel Zarembski |
0:01f31e923fe2 | 800 | * This function will check the appropriate number of flash sectors based on |
Pawel Zarembski |
0:01f31e923fe2 | 801 | * the desired start address and length to see if the flash have been erased |
Pawel Zarembski |
0:01f31e923fe2 | 802 | * to the specified read margin level. |
Pawel Zarembski |
0:01f31e923fe2 | 803 | * |
Pawel Zarembski |
0:01f31e923fe2 | 804 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 805 | * @param start The start address of the desired flash memory to be verified. |
Pawel Zarembski |
0:01f31e923fe2 | 806 | * The start address does not need to be sector aligned but must be word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 807 | * @param lengthInBytes The length, given in bytes (not words or long-words) |
Pawel Zarembski |
0:01f31e923fe2 | 808 | * to be verified. Must be word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 809 | * @param margin Read margin choice |
Pawel Zarembski |
0:01f31e923fe2 | 810 | * |
Pawel Zarembski |
0:01f31e923fe2 | 811 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 812 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 813 | * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. |
Pawel Zarembski |
0:01f31e923fe2 | 814 | * @retval #kStatus_FLASH_AddressError Address is out of range. |
Pawel Zarembski |
0:01f31e923fe2 | 815 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 816 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 817 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 818 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 819 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 820 | status_t FLASH_VerifyErase(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, flash_margin_value_t margin); |
Pawel Zarembski |
0:01f31e923fe2 | 821 | |
Pawel Zarembski |
0:01f31e923fe2 | 822 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 823 | * @brief Verifies programming of desired flash area at specified margin level |
Pawel Zarembski |
0:01f31e923fe2 | 824 | * |
Pawel Zarembski |
0:01f31e923fe2 | 825 | * This function verifies the data programed in the flash memory using the |
Pawel Zarembski |
0:01f31e923fe2 | 826 | * Flash Program Check Command and compares it with expected data for a given |
Pawel Zarembski |
0:01f31e923fe2 | 827 | * flash area as determined by the start address and length. |
Pawel Zarembski |
0:01f31e923fe2 | 828 | * |
Pawel Zarembski |
0:01f31e923fe2 | 829 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 830 | * @param start The start address of the desired flash memory to be verified. Must be word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 831 | * @param lengthInBytes The length, given in bytes (not words or long-words) |
Pawel Zarembski |
0:01f31e923fe2 | 832 | * to be verified. Must be word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 833 | * @param expectedData Pointer to the expected data that is to be |
Pawel Zarembski |
0:01f31e923fe2 | 834 | * verified against. |
Pawel Zarembski |
0:01f31e923fe2 | 835 | * @param margin Read margin choice |
Pawel Zarembski |
0:01f31e923fe2 | 836 | * @param failedAddress Pointer to returned failing address. |
Pawel Zarembski |
0:01f31e923fe2 | 837 | * @param failedData Pointer to returned failing data. Some derivitives do |
Pawel Zarembski |
0:01f31e923fe2 | 838 | * not included failed data as part of the FCCOBx registers. In this |
Pawel Zarembski |
0:01f31e923fe2 | 839 | * case, zeros are returned upon failure. |
Pawel Zarembski |
0:01f31e923fe2 | 840 | * |
Pawel Zarembski |
0:01f31e923fe2 | 841 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 842 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 843 | * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. |
Pawel Zarembski |
0:01f31e923fe2 | 844 | * @retval #kStatus_FLASH_AddressError Address is out of range. |
Pawel Zarembski |
0:01f31e923fe2 | 845 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 846 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 847 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 848 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 849 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 850 | status_t FLASH_VerifyProgram(flash_config_t *config, |
Pawel Zarembski |
0:01f31e923fe2 | 851 | uint32_t start, |
Pawel Zarembski |
0:01f31e923fe2 | 852 | uint32_t lengthInBytes, |
Pawel Zarembski |
0:01f31e923fe2 | 853 | const uint32_t *expectedData, |
Pawel Zarembski |
0:01f31e923fe2 | 854 | flash_margin_value_t margin, |
Pawel Zarembski |
0:01f31e923fe2 | 855 | uint32_t *failedAddress, |
Pawel Zarembski |
0:01f31e923fe2 | 856 | uint32_t *failedData); |
Pawel Zarembski |
0:01f31e923fe2 | 857 | |
Pawel Zarembski |
0:01f31e923fe2 | 858 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 859 | * @brief Verifies if the program flash executeonly segments have been erased to |
Pawel Zarembski |
0:01f31e923fe2 | 860 | * the specified read margin level |
Pawel Zarembski |
0:01f31e923fe2 | 861 | * |
Pawel Zarembski |
0:01f31e923fe2 | 862 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 863 | * @param margin Read margin choice |
Pawel Zarembski |
0:01f31e923fe2 | 864 | * |
Pawel Zarembski |
0:01f31e923fe2 | 865 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 866 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 867 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 868 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 869 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 870 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 871 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 872 | status_t FLASH_VerifyEraseAllExecuteOnlySegments(flash_config_t *config, flash_margin_value_t margin); |
Pawel Zarembski |
0:01f31e923fe2 | 873 | |
Pawel Zarembski |
0:01f31e923fe2 | 874 | /*@}*/ |
Pawel Zarembski |
0:01f31e923fe2 | 875 | |
Pawel Zarembski |
0:01f31e923fe2 | 876 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 877 | * @name Protection |
Pawel Zarembski |
0:01f31e923fe2 | 878 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 879 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 880 | |
Pawel Zarembski |
0:01f31e923fe2 | 881 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 882 | * @brief Returns the protection state of desired flash area via the pointer passed into the function |
Pawel Zarembski |
0:01f31e923fe2 | 883 | * |
Pawel Zarembski |
0:01f31e923fe2 | 884 | * This function retrieves the current Flash protect status for a given |
Pawel Zarembski |
0:01f31e923fe2 | 885 | * flash area as determined by the start address and length. |
Pawel Zarembski |
0:01f31e923fe2 | 886 | * |
Pawel Zarembski |
0:01f31e923fe2 | 887 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 888 | * @param start The start address of the desired flash memory to be checked. Must be word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 889 | * @param lengthInBytes The length, given in bytes (not words or long-words) |
Pawel Zarembski |
0:01f31e923fe2 | 890 | * to be checked. Must be word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 891 | * @param protection_state Pointer to the value returned for the current |
Pawel Zarembski |
0:01f31e923fe2 | 892 | * protection status code for the desired flash area. |
Pawel Zarembski |
0:01f31e923fe2 | 893 | * |
Pawel Zarembski |
0:01f31e923fe2 | 894 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 895 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 896 | * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. |
Pawel Zarembski |
0:01f31e923fe2 | 897 | * @retval #kStatus_FLASH_AddressError Address is out of range. |
Pawel Zarembski |
0:01f31e923fe2 | 898 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 899 | status_t FLASH_IsProtected(flash_config_t *config, |
Pawel Zarembski |
0:01f31e923fe2 | 900 | uint32_t start, |
Pawel Zarembski |
0:01f31e923fe2 | 901 | uint32_t lengthInBytes, |
Pawel Zarembski |
0:01f31e923fe2 | 902 | flash_protection_state_t *protection_state); |
Pawel Zarembski |
0:01f31e923fe2 | 903 | |
Pawel Zarembski |
0:01f31e923fe2 | 904 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 905 | * @brief Returns the access state of desired flash area via the pointer passed into the function |
Pawel Zarembski |
0:01f31e923fe2 | 906 | * |
Pawel Zarembski |
0:01f31e923fe2 | 907 | * This function retrieves the current Flash access status for a given |
Pawel Zarembski |
0:01f31e923fe2 | 908 | * flash area as determined by the start address and length. |
Pawel Zarembski |
0:01f31e923fe2 | 909 | * |
Pawel Zarembski |
0:01f31e923fe2 | 910 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 911 | * @param start The start address of the desired flash memory to be checked. Must be word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 912 | * @param lengthInBytes The length, given in bytes (not words or long-words) |
Pawel Zarembski |
0:01f31e923fe2 | 913 | * to be checked. Must be word-aligned. |
Pawel Zarembski |
0:01f31e923fe2 | 914 | * @param access_state Pointer to the value returned for the current |
Pawel Zarembski |
0:01f31e923fe2 | 915 | * access status code for the desired flash area. |
Pawel Zarembski |
0:01f31e923fe2 | 916 | * |
Pawel Zarembski |
0:01f31e923fe2 | 917 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 918 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 919 | * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. |
Pawel Zarembski |
0:01f31e923fe2 | 920 | * @retval #kStatus_FLASH_AddressError Address is out of range. |
Pawel Zarembski |
0:01f31e923fe2 | 921 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 922 | status_t FLASH_IsExecuteOnly(flash_config_t *config, |
Pawel Zarembski |
0:01f31e923fe2 | 923 | uint32_t start, |
Pawel Zarembski |
0:01f31e923fe2 | 924 | uint32_t lengthInBytes, |
Pawel Zarembski |
0:01f31e923fe2 | 925 | flash_execute_only_access_state_t *access_state); |
Pawel Zarembski |
0:01f31e923fe2 | 926 | |
Pawel Zarembski |
0:01f31e923fe2 | 927 | /*@}*/ |
Pawel Zarembski |
0:01f31e923fe2 | 928 | |
Pawel Zarembski |
0:01f31e923fe2 | 929 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 930 | * @name Properties |
Pawel Zarembski |
0:01f31e923fe2 | 931 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 932 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 933 | |
Pawel Zarembski |
0:01f31e923fe2 | 934 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 935 | * @brief Returns the desired flash property. |
Pawel Zarembski |
0:01f31e923fe2 | 936 | * |
Pawel Zarembski |
0:01f31e923fe2 | 937 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 938 | * @param whichProperty The desired property from the list of properties in |
Pawel Zarembski |
0:01f31e923fe2 | 939 | * enum flash_property_tag_t |
Pawel Zarembski |
0:01f31e923fe2 | 940 | * @param value Pointer to the value returned for the desired flash property |
Pawel Zarembski |
0:01f31e923fe2 | 941 | * |
Pawel Zarembski |
0:01f31e923fe2 | 942 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 943 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 944 | * @retval #kStatus_FLASH_UnknownProperty unknown property tag |
Pawel Zarembski |
0:01f31e923fe2 | 945 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 946 | status_t FLASH_GetProperty(flash_config_t *config, flash_property_tag_t whichProperty, uint32_t *value); |
Pawel Zarembski |
0:01f31e923fe2 | 947 | |
Pawel Zarembski |
0:01f31e923fe2 | 948 | /*@}*/ |
Pawel Zarembski |
0:01f31e923fe2 | 949 | |
Pawel Zarembski |
0:01f31e923fe2 | 950 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 951 | * @name FlexRAM |
Pawel Zarembski |
0:01f31e923fe2 | 952 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 953 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 954 | |
Pawel Zarembski |
0:01f31e923fe2 | 955 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 956 | * @brief Set FlexRAM Function command |
Pawel Zarembski |
0:01f31e923fe2 | 957 | * |
Pawel Zarembski |
0:01f31e923fe2 | 958 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 959 | * @param option The option used to set work mode of FlexRAM |
Pawel Zarembski |
0:01f31e923fe2 | 960 | * |
Pawel Zarembski |
0:01f31e923fe2 | 961 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 962 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 963 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 964 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 965 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 966 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 967 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 968 | #if defined(FSL_FEATURE_FLASH_HAS_SET_FLEXRAM_FUNCTION_CMD) && FSL_FEATURE_FLASH_HAS_SET_FLEXRAM_FUNCTION_CMD |
Pawel Zarembski |
0:01f31e923fe2 | 969 | status_t FLASH_SetFlexramFunction(flash_config_t *config, flash_flexram_function_option_t option); |
Pawel Zarembski |
0:01f31e923fe2 | 970 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 971 | |
Pawel Zarembski |
0:01f31e923fe2 | 972 | /*@}*/ |
Pawel Zarembski |
0:01f31e923fe2 | 973 | |
Pawel Zarembski |
0:01f31e923fe2 | 974 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 975 | * @name Swap |
Pawel Zarembski |
0:01f31e923fe2 | 976 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 977 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 978 | |
Pawel Zarembski |
0:01f31e923fe2 | 979 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 980 | * @brief Configure Swap function or Check the swap state of Flash Module |
Pawel Zarembski |
0:01f31e923fe2 | 981 | * |
Pawel Zarembski |
0:01f31e923fe2 | 982 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 983 | * @param address Address used to configure the flash swap function |
Pawel Zarembski |
0:01f31e923fe2 | 984 | * @param option The possible option used to configure Flash Swap function or check the flash swap status |
Pawel Zarembski |
0:01f31e923fe2 | 985 | * @param returnInfo Pointer to the data which is used to return the information of flash swap. |
Pawel Zarembski |
0:01f31e923fe2 | 986 | * |
Pawel Zarembski |
0:01f31e923fe2 | 987 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 988 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 989 | * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. |
Pawel Zarembski |
0:01f31e923fe2 | 990 | * @retval #kStatus_FLASH_SwapIndicatorAddressError Swap indicator address is invalid |
Pawel Zarembski |
0:01f31e923fe2 | 991 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 992 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 993 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 994 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 995 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 996 | #if defined(FSL_FEATURE_FLASH_HAS_SWAP_CONTROL_CMD) && FSL_FEATURE_FLASH_HAS_SWAP_CONTROL_CMD |
Pawel Zarembski |
0:01f31e923fe2 | 997 | status_t FLASH_SwapControl(flash_config_t *config, |
Pawel Zarembski |
0:01f31e923fe2 | 998 | uint32_t address, |
Pawel Zarembski |
0:01f31e923fe2 | 999 | flash_swap_control_option_t option, |
Pawel Zarembski |
0:01f31e923fe2 | 1000 | flash_swap_state_config_t *returnInfo); |
Pawel Zarembski |
0:01f31e923fe2 | 1001 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 1002 | |
Pawel Zarembski |
0:01f31e923fe2 | 1003 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 1004 | * @brief Swap the lower half flash with the higher half flaock |
Pawel Zarembski |
0:01f31e923fe2 | 1005 | * |
Pawel Zarembski |
0:01f31e923fe2 | 1006 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 1007 | * @param address Address used to configure the flash swap function |
Pawel Zarembski |
0:01f31e923fe2 | 1008 | * @param option The possible option used to configure Flash Swap function or check the flash swap status |
Pawel Zarembski |
0:01f31e923fe2 | 1009 | * |
Pawel Zarembski |
0:01f31e923fe2 | 1010 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 1011 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 1012 | * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline. |
Pawel Zarembski |
0:01f31e923fe2 | 1013 | * @retval #kStatus_FLASH_SwapIndicatorAddressError Swap indicator address is invalid |
Pawel Zarembski |
0:01f31e923fe2 | 1014 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 1015 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 1016 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 1017 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 1018 | * @retval #kStatus_FLASH_SwapSystemNotInUninitialized Swap system is not in uninitialzed state |
Pawel Zarembski |
0:01f31e923fe2 | 1019 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 1020 | #if defined(FSL_FEATURE_FLASH_HAS_PFLASH_BLOCK_SWAP) && FSL_FEATURE_FLASH_HAS_PFLASH_BLOCK_SWAP |
Pawel Zarembski |
0:01f31e923fe2 | 1021 | status_t FLASH_Swap(flash_config_t *config, uint32_t address, flash_swap_function_option_t option); |
Pawel Zarembski |
0:01f31e923fe2 | 1022 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 1023 | |
Pawel Zarembski |
0:01f31e923fe2 | 1024 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 1025 | * @name FlexNVM |
Pawel Zarembski |
0:01f31e923fe2 | 1026 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 1027 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 1028 | |
Pawel Zarembski |
0:01f31e923fe2 | 1029 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 1030 | * @brief Prepares the FlexNVM block for use as data flash, EEPROM backup, or a combination of both and initializes the |
Pawel Zarembski |
0:01f31e923fe2 | 1031 | * FlexRAM. |
Pawel Zarembski |
0:01f31e923fe2 | 1032 | * |
Pawel Zarembski |
0:01f31e923fe2 | 1033 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 1034 | * @param option The option used to set FlexRAM load behavior during reset. |
Pawel Zarembski |
0:01f31e923fe2 | 1035 | * @param eepromDataSizeCode Determines the amount of FlexRAM used in each of the available EEPROM subsystems. |
Pawel Zarembski |
0:01f31e923fe2 | 1036 | * @param flexnvmPartitionCode Specifies how to split the FlexNVM block between data flash memory and EEPROM backup |
Pawel Zarembski |
0:01f31e923fe2 | 1037 | * memory supporting EEPROM functions. |
Pawel Zarembski |
0:01f31e923fe2 | 1038 | * |
Pawel Zarembski |
0:01f31e923fe2 | 1039 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 1040 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 1041 | * @retval #kStatus_FLASH_ExecuteInRamFunctionNotReady Execute-in-ram function is not available. |
Pawel Zarembski |
0:01f31e923fe2 | 1042 | * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses. |
Pawel Zarembski |
0:01f31e923fe2 | 1043 | * @retval #kStatus_FLASH_ProtectionViolation The program/erase operation is requested to execute on protected areas. |
Pawel Zarembski |
0:01f31e923fe2 | 1044 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 1045 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 1046 | #if defined(FSL_FEATURE_FLASH_HAS_PROGRAM_PARTITION_CMD) && FSL_FEATURE_FLASH_HAS_PROGRAM_PARTITION_CMD |
Pawel Zarembski |
0:01f31e923fe2 | 1047 | status_t FLASH_ProgramPartition(flash_config_t *config, |
Pawel Zarembski |
0:01f31e923fe2 | 1048 | flash_partition_flexram_load_option_t option, |
Pawel Zarembski |
0:01f31e923fe2 | 1049 | uint32_t eepromDataSizeCode, |
Pawel Zarembski |
0:01f31e923fe2 | 1050 | uint32_t flexnvmPartitionCode); |
Pawel Zarembski |
0:01f31e923fe2 | 1051 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 1052 | |
Pawel Zarembski |
0:01f31e923fe2 | 1053 | /*@}*/ |
Pawel Zarembski |
0:01f31e923fe2 | 1054 | |
Pawel Zarembski |
0:01f31e923fe2 | 1055 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 1056 | * @name Flash Protection Utilities |
Pawel Zarembski |
0:01f31e923fe2 | 1057 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 1058 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 1059 | |
Pawel Zarembski |
0:01f31e923fe2 | 1060 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 1061 | * @brief Set PFLASH Protection to the intended protection status. |
Pawel Zarembski |
0:01f31e923fe2 | 1062 | * |
Pawel Zarembski |
0:01f31e923fe2 | 1063 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 1064 | * @param protectStatus The expected protect status user wants to set to PFlash protection register. Each bit is |
Pawel Zarembski |
0:01f31e923fe2 | 1065 | * corresponding to protection of 1/32 of the total PFlash. The least significant bit is corresponding to the lowest |
Pawel Zarembski |
0:01f31e923fe2 | 1066 | * address area of P-Flash. The most significant bit is corresponding to the highest address area of PFlash. There are |
Pawel Zarembski |
0:01f31e923fe2 | 1067 | * two possible cases as shown below: |
Pawel Zarembski |
0:01f31e923fe2 | 1068 | * 0: this area is protected. |
Pawel Zarembski |
0:01f31e923fe2 | 1069 | * 1: this area is unprotected. |
Pawel Zarembski |
0:01f31e923fe2 | 1070 | * |
Pawel Zarembski |
0:01f31e923fe2 | 1071 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 1072 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 1073 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 1074 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 1075 | status_t FLASH_PflashSetProtection(flash_config_t *config, uint32_t protectStatus); |
Pawel Zarembski |
0:01f31e923fe2 | 1076 | |
Pawel Zarembski |
0:01f31e923fe2 | 1077 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 1078 | * @brief Get PFLASH Protection Status. |
Pawel Zarembski |
0:01f31e923fe2 | 1079 | * |
Pawel Zarembski |
0:01f31e923fe2 | 1080 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 1081 | * @param protectStatus Protect status returned by PFlash IP. Each bit is corresponding to protection of 1/32 of the |
Pawel Zarembski |
0:01f31e923fe2 | 1082 | * total PFlash. The least significant bit is corresponding to the lowest address area of PFlash. The most significant |
Pawel Zarembski |
0:01f31e923fe2 | 1083 | * bit is corresponding to the highest address area of PFlash. Thee are two possible cases as below: |
Pawel Zarembski |
0:01f31e923fe2 | 1084 | * 0: this area is protected. |
Pawel Zarembski |
0:01f31e923fe2 | 1085 | * 1: this area is unprotected. |
Pawel Zarembski |
0:01f31e923fe2 | 1086 | * |
Pawel Zarembski |
0:01f31e923fe2 | 1087 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 1088 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 1089 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 1090 | status_t FLASH_PflashGetProtection(flash_config_t *config, uint32_t *protectStatus); |
Pawel Zarembski |
0:01f31e923fe2 | 1091 | |
Pawel Zarembski |
0:01f31e923fe2 | 1092 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 1093 | * @brief Set DFLASH Protection to the intended protection status. |
Pawel Zarembski |
0:01f31e923fe2 | 1094 | * |
Pawel Zarembski |
0:01f31e923fe2 | 1095 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 1096 | * @param protectStatus The expected protect status user wants to set to DFlash protection register. Each bit is |
Pawel Zarembski |
0:01f31e923fe2 | 1097 | * corresponding to protection of 1/8 of the total DFlash. The least significant bit is corresponding to the lowest |
Pawel Zarembski |
0:01f31e923fe2 | 1098 | * address area of DFlash. The most significant bit is corresponding to the highest address area of DFlash. There are |
Pawel Zarembski |
0:01f31e923fe2 | 1099 | * two possible cases as shown below: |
Pawel Zarembski |
0:01f31e923fe2 | 1100 | * 0: this area is protected. |
Pawel Zarembski |
0:01f31e923fe2 | 1101 | * 1: this area is unprotected. |
Pawel Zarembski |
0:01f31e923fe2 | 1102 | * |
Pawel Zarembski |
0:01f31e923fe2 | 1103 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 1104 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 1105 | * @retval #kStatus_FLASH_CommandNotSupported Flash api is not supported |
Pawel Zarembski |
0:01f31e923fe2 | 1106 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 1107 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 1108 | #if FLASH_SSD_IS_FLEXNVM_ENABLED |
Pawel Zarembski |
0:01f31e923fe2 | 1109 | status_t FLASH_DflashSetProtection(flash_config_t *config, uint8_t protectStatus); |
Pawel Zarembski |
0:01f31e923fe2 | 1110 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 1111 | |
Pawel Zarembski |
0:01f31e923fe2 | 1112 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 1113 | * @brief Get DFLASH Protection Status. |
Pawel Zarembski |
0:01f31e923fe2 | 1114 | * |
Pawel Zarembski |
0:01f31e923fe2 | 1115 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 1116 | * @param protectStatus DFlash Protect status returned by PFlash IP. Each bit is corresponding to protection of 1/8 of |
Pawel Zarembski |
0:01f31e923fe2 | 1117 | * the total DFlash. The least significant bit is corresponding to the lowest address area of DFlash. The most |
Pawel Zarembski |
0:01f31e923fe2 | 1118 | * significant bit is corresponding to the highest address area of DFlash and so on. There are two possible cases as |
Pawel Zarembski |
0:01f31e923fe2 | 1119 | * below: |
Pawel Zarembski |
0:01f31e923fe2 | 1120 | * 0: this area is protected. |
Pawel Zarembski |
0:01f31e923fe2 | 1121 | * 1: this area is unprotected. |
Pawel Zarembski |
0:01f31e923fe2 | 1122 | * |
Pawel Zarembski |
0:01f31e923fe2 | 1123 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 1124 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 1125 | * @retval #kStatus_FLASH_CommandNotSupported Flash api is not supported |
Pawel Zarembski |
0:01f31e923fe2 | 1126 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 1127 | #if FLASH_SSD_IS_FLEXNVM_ENABLED |
Pawel Zarembski |
0:01f31e923fe2 | 1128 | status_t FLASH_DflashGetProtection(flash_config_t *config, uint8_t *protectStatus); |
Pawel Zarembski |
0:01f31e923fe2 | 1129 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 1130 | |
Pawel Zarembski |
0:01f31e923fe2 | 1131 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 1132 | * @brief Set EEPROM Protection to the intended protection status. |
Pawel Zarembski |
0:01f31e923fe2 | 1133 | * |
Pawel Zarembski |
0:01f31e923fe2 | 1134 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 1135 | * @param protectStatus The expected protect status user wants to set to EEPROM protection register. Each bit is |
Pawel Zarembski |
0:01f31e923fe2 | 1136 | * corresponding to protection of 1/8 of the total EEPROM. The least significant bit is corresponding to the lowest |
Pawel Zarembski |
0:01f31e923fe2 | 1137 | * address area of EEPROM. The most significant bit is corresponding to the highest address area of EEPROM, and so on. |
Pawel Zarembski |
0:01f31e923fe2 | 1138 | * There are two possible cases as shown below: |
Pawel Zarembski |
0:01f31e923fe2 | 1139 | * 0: this area is protected. |
Pawel Zarembski |
0:01f31e923fe2 | 1140 | * 1: this area is unprotected. |
Pawel Zarembski |
0:01f31e923fe2 | 1141 | * |
Pawel Zarembski |
0:01f31e923fe2 | 1142 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 1143 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 1144 | * @retval #kStatus_FLASH_CommandNotSupported Flash api is not supported |
Pawel Zarembski |
0:01f31e923fe2 | 1145 | * @retval #kStatus_FLASH_CommandFailure Run-time error during command execution. |
Pawel Zarembski |
0:01f31e923fe2 | 1146 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 1147 | #if FLASH_SSD_IS_FLEXNVM_ENABLED |
Pawel Zarembski |
0:01f31e923fe2 | 1148 | status_t FLASH_EepromSetProtection(flash_config_t *config, uint8_t protectStatus); |
Pawel Zarembski |
0:01f31e923fe2 | 1149 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 1150 | |
Pawel Zarembski |
0:01f31e923fe2 | 1151 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 1152 | * @brief Get DFLASH Protection Status. |
Pawel Zarembski |
0:01f31e923fe2 | 1153 | * |
Pawel Zarembski |
0:01f31e923fe2 | 1154 | * @param config Pointer to storage for the driver runtime state. |
Pawel Zarembski |
0:01f31e923fe2 | 1155 | * @param protectStatus DFlash Protect status returned by PFlash IP. Each bit is corresponding to protection of 1/8 of |
Pawel Zarembski |
0:01f31e923fe2 | 1156 | * the total EEPROM. The least significant bit is corresponding to the lowest address area of EEPROM. The most |
Pawel Zarembski |
0:01f31e923fe2 | 1157 | * significant bit is corresponding to the highest address area of EEPROM. There are two possible cases as below: |
Pawel Zarembski |
0:01f31e923fe2 | 1158 | * 0: this area is protected. |
Pawel Zarembski |
0:01f31e923fe2 | 1159 | * 1: this area is unprotected. |
Pawel Zarembski |
0:01f31e923fe2 | 1160 | * |
Pawel Zarembski |
0:01f31e923fe2 | 1161 | * @retval #kStatus_FLASH_Success Api was executed successfully. |
Pawel Zarembski |
0:01f31e923fe2 | 1162 | * @retval #kStatus_FLASH_InvalidArgument Invalid argument is provided. |
Pawel Zarembski |
0:01f31e923fe2 | 1163 | * @retval #kStatus_FLASH_CommandNotSupported Flash api is not supported. |
Pawel Zarembski |
0:01f31e923fe2 | 1164 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 1165 | #if FLASH_SSD_IS_FLEXNVM_ENABLED |
Pawel Zarembski |
0:01f31e923fe2 | 1166 | status_t FLASH_EepromGetProtection(flash_config_t *config, uint8_t *protectStatus); |
Pawel Zarembski |
0:01f31e923fe2 | 1167 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 1168 | |
Pawel Zarembski |
0:01f31e923fe2 | 1169 | /*@}*/ |
Pawel Zarembski |
0:01f31e923fe2 | 1170 | |
Pawel Zarembski |
0:01f31e923fe2 | 1171 | #if defined(__cplusplus) |
Pawel Zarembski |
0:01f31e923fe2 | 1172 | } |
Pawel Zarembski |
0:01f31e923fe2 | 1173 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 1174 | |
Pawel Zarembski |
0:01f31e923fe2 | 1175 | /*! @}*/ |
Pawel Zarembski |
0:01f31e923fe2 | 1176 | |
Pawel Zarembski |
0:01f31e923fe2 | 1177 | #endif /* _FSL_FLASH_H_ */ |