src/drivers/flash/fsl_flash.h
/*
* Copyright (c) 2013-2016, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _FSL_FLASH_H_
#define _FSL_FLASH_H_
#if (defined(BL_TARGET_FLASH) || defined(BL_TARGET_ROM) || defined(BL_TARGET_RAM))
#include <assert.h>
#include <string.h>
#include "fsl_device_registers.h"
#include "bootloader_common.h"
#else
#include "fsl_common.h"
#endif
/*******************************************************************************
* Definitions
******************************************************************************/
#if !defined(MAKE_VERSION)
#define MAKE_VERSION(major, minor, bugfix) (((major) << 16) | ((minor) << 8) | (bugfix))
#endif
#define FSL_FLASH_DRIVER_VERSION (MAKE_VERSION(2, 1, 0))
enum _flash_driver_version_constants
{
kFLASH_DriverVersionName = 'F',
kFLASH_DriverVersionMajor = 2,
kFLASH_DriverVersionMinor = 1,
kFLASH_DriverVersionBugfix = 0
};
#if !defined(FLASH_SSD_CONFIG_ENABLE_FLEXNVM_SUPPORT)
#define FLASH_SSD_CONFIG_ENABLE_FLEXNVM_SUPPORT 1
#endif
#define FLASH_SSD_IS_FLEXNVM_ENABLED (FLASH_SSD_CONFIG_ENABLE_FLEXNVM_SUPPORT && FSL_FEATURE_FLASH_HAS_FLEX_NVM)
#if !defined(FLASH_DRIVER_IS_FLASH_RESIDENT)
#if (!defined(BL_TARGET_ROM) && !defined(BL_TARGET_RAM))
#define FLASH_DRIVER_IS_FLASH_RESIDENT 1
#else
#define FLASH_DRIVER_IS_FLASH_RESIDENT 0
#endif
#endif
#if !defined(FLASH_DRIVER_IS_EXPORTED)
#if (defined(BL_TARGET_ROM) || defined(BL_TARGET_FLASH))
#define FLASH_DRIVER_IS_EXPORTED 1
#else
#define FLASH_DRIVER_IS_EXPORTED 0
#endif
#endif
#if defined(kStatusGroup_FlashDriver)
#define kStatusGroupGeneric kStatusGroup_Generic
#define kStatusGroupFlashDriver kStatusGroup_FlashDriver
#elif defined(kStatusGroup_FLASH)
#define kStatusGroupGeneric kStatusGroup_Generic
#define kStatusGroupFlashDriver kStatusGroup_FLASH
#else
#define kStatusGroupGeneric 0
#define kStatusGroupFlashDriver 1
#endif
#if !defined(MAKE_STATUS)
#define MAKE_STATUS(group, code) ((((group)*100) + (code)))
#endif
enum _flash_status
{
kStatus_FLASH_Success = MAKE_STATUS(kStatusGroupGeneric, 0),
kStatus_FLASH_InvalidArgument = MAKE_STATUS(kStatusGroupGeneric, 4),
kStatus_FLASH_SizeError = MAKE_STATUS(kStatusGroupFlashDriver, 0),
kStatus_FLASH_AlignmentError =
MAKE_STATUS(kStatusGroupFlashDriver, 1),
kStatus_FLASH_AddressError = MAKE_STATUS(kStatusGroupFlashDriver, 2),
kStatus_FLASH_AccessError =
MAKE_STATUS(kStatusGroupFlashDriver, 3),
kStatus_FLASH_ProtectionViolation = MAKE_STATUS(
kStatusGroupFlashDriver, 4),
kStatus_FLASH_CommandFailure =
MAKE_STATUS(kStatusGroupFlashDriver, 5),
kStatus_FLASH_UnknownProperty = MAKE_STATUS(kStatusGroupFlashDriver, 6),
kStatus_FLASH_EraseKeyError = MAKE_STATUS(kStatusGroupFlashDriver, 7),
kStatus_FLASH_RegionExecuteOnly = MAKE_STATUS(kStatusGroupFlashDriver, 8),
kStatus_FLASH_ExecuteInRamFunctionNotReady =
MAKE_STATUS(kStatusGroupFlashDriver, 9),
kStatus_FLASH_PartitionStatusUpdateFailure =
MAKE_STATUS(kStatusGroupFlashDriver, 10),
kStatus_FLASH_SetFlexramAsEepromError =
MAKE_STATUS(kStatusGroupFlashDriver, 11),
kStatus_FLASH_RecoverFlexramAsRamError =
MAKE_STATUS(kStatusGroupFlashDriver, 12),
kStatus_FLASH_SetFlexramAsRamError = MAKE_STATUS(kStatusGroupFlashDriver, 13),
kStatus_FLASH_RecoverFlexramAsEepromError =
MAKE_STATUS(kStatusGroupFlashDriver, 14),
kStatus_FLASH_CommandNotSupported = MAKE_STATUS(kStatusGroupFlashDriver, 15),
kStatus_FLASH_SwapSystemNotInUninitialized =
MAKE_STATUS(kStatusGroupFlashDriver, 16),
kStatus_FLASH_SwapIndicatorAddressError =
MAKE_STATUS(kStatusGroupFlashDriver, 17),
};
#if !defined(FOUR_CHAR_CODE)
#define FOUR_CHAR_CODE(a, b, c, d) (((d) << 24) | ((c) << 16) | ((b) << 8) | ((a)))
#endif
enum _flash_driver_api_keys
{
kFLASH_ApiEraseKey = FOUR_CHAR_CODE('k', 'f', 'e', 'k')
};
typedef enum _flash_margin_value
{
kFLASH_MarginValueNormal,
kFLASH_MarginValueUser,
kFLASH_MarginValueFactory,
kFLASH_MarginValueInvalid
} flash_margin_value_t;
typedef enum _flash_security_state
{
kFLASH_SecurityStateNotSecure,
kFLASH_SecurityStateBackdoorEnabled,
kFLASH_SecurityStateBackdoorDisabled
} flash_security_state_t;
typedef enum _flash_protection_state
{
kFLASH_ProtectionStateUnprotected,
kFLASH_ProtectionStateProtected,
kFLASH_ProtectionStateMixed
} flash_protection_state_t;
typedef enum _flash_execute_only_access_state
{
kFLASH_AccessStateUnLimited,
kFLASH_AccessStateExecuteOnly,
kFLASH_AccessStateMixed
} flash_execute_only_access_state_t;
typedef enum _flash_property_tag
{
kFLASH_PropertyPflashSectorSize = 0x00U,
kFLASH_PropertyPflashTotalSize = 0x01U,
kFLASH_PropertyPflashBlockSize = 0x02U,
kFLASH_PropertyPflashBlockCount = 0x03U,
kFLASH_PropertyPflashBlockBaseAddr = 0x04U,
kFLASH_PropertyPflashFacSupport = 0x05U,
kFLASH_PropertyPflashAccessSegmentSize = 0x06U,
kFLASH_PropertyPflashAccessSegmentCount = 0x07U,
kFLASH_PropertyFlexRamBlockBaseAddr = 0x08U,
kFLASH_PropertyFlexRamTotalSize = 0x09U,
kFLASH_PropertyDflashSectorSize = 0x10U,
kFLASH_PropertyDflashTotalSize = 0x11U,
kFLASH_PropertyDflashBlockSize = 0x12U,
kFLASH_PropertyDflashBlockCount = 0x13U,
kFLASH_PropertyDflashBlockBaseAddr = 0x14U,
kFLASH_PropertyEepromTotalSize = 0x15U
} flash_property_tag_t;
enum _flash_execute_in_ram_function_constants
{
kFLASH_ExecuteInRamFunctionMaxSize = 64U,
kFLASH_ExecuteInRamFunctionTotalNum = 2U
};
typedef struct _flash_execute_in_ram_function_config
{
uint32_t activeFunctionCount;
uint8_t *flashRunCommand;
uint8_t *flashCacheClearCommand;
} flash_execute_in_ram_function_config_t;
typedef enum _flash_read_resource_option
{
kFLASH_ResourceOptionFlashIfr =
0x00U,
kFLASH_ResourceOptionVersionId = 0x01U
} flash_read_resource_option_t;
enum _flash_read_resource_range
{
#if (FSL_FEATURE_FLASH_IS_FTFE == 1)
kFLASH_ResourceRangePflashIfrSizeInBytes = 1024U,
kFLASH_ResourceRangeVersionIdSizeInBytes = 8U,
kFLASH_ResourceRangeVersionIdStart = 0x08U,
kFLASH_ResourceRangeVersionIdEnd = 0x0FU,
kFLASH_ResourceRangePflashSwapIfrStart = 0x40000U,
kFLASH_ResourceRangePflashSwapIfrEnd =
(kFLASH_ResourceRangePflashSwapIfrStart + 0x3FFU),
#else /* FSL_FEATURE_FLASH_IS_FTFL == 1 or FSL_FEATURE_FLASH_IS_FTFA = =1 */
kFLASH_ResourceRangePflashIfrSizeInBytes = 256U,
kFLASH_ResourceRangeVersionIdSizeInBytes = 8U,
kFLASH_ResourceRangeVersionIdStart = 0x00U,
kFLASH_ResourceRangeVersionIdEnd = 0x07U,
#if 0x20000U == (FSL_FEATURE_FLASH_PFLASH_BLOCK_COUNT * FSL_FEATURE_FLASH_PFLASH_BLOCK_SIZE)
kFLASH_ResourceRangePflashSwapIfrStart = 0x8000U,
#elif 0x40000U == (FSL_FEATURE_FLASH_PFLASH_BLOCK_COUNT * FSL_FEATURE_FLASH_PFLASH_BLOCK_SIZE)
kFLASH_ResourceRangePflashSwapIfrStart = 0x10000U,
#elif 0x80000U == (FSL_FEATURE_FLASH_PFLASH_BLOCK_COUNT * FSL_FEATURE_FLASH_PFLASH_BLOCK_SIZE)
kFLASH_ResourceRangePflashSwapIfrStart = 0x20000U,
#else
kFLASH_ResourceRangePflashSwapIfrStart = 0,
#endif
kFLASH_ResourceRangePflashSwapIfrEnd =
(kFLASH_ResourceRangePflashSwapIfrStart + 0xFFU),
#endif
kFLASH_ResourceRangeDflashIfrStart = 0x800000U,
kFLASH_ResourceRangeDflashIfrEnd = 0x8003FFU,
};
typedef enum _flash_flexram_function_option
{
kFLASH_FlexramFunctionOptionAvailableAsRam = 0xFFU,
kFLASH_FlexramFunctionOptionAvailableForEeprom = 0x00U
} flash_flexram_function_option_t;
enum _flash_acceleration_ram_property
{
kFLASH_AccelerationRamSize = 0x400U
};
typedef enum _flash_swap_function_option
{
kFLASH_SwapFunctionOptionEnable = 0x00U,
kFLASH_SwapFunctionOptionDisable = 0x01U
} flash_swap_function_option_t;
typedef enum _flash_swap_control_option
{
kFLASH_SwapControlOptionIntializeSystem = 0x01U,
kFLASH_SwapControlOptionSetInUpdateState = 0x02U,
kFLASH_SwapControlOptionSetInCompleteState = 0x04U,
kFLASH_SwapControlOptionReportStatus = 0x08U,
kFLASH_SwapControlOptionDisableSystem = 0x10U
} flash_swap_control_option_t;
typedef enum _flash_swap_state
{
kFLASH_SwapStateUninitialized = 0x00U,
kFLASH_SwapStateReady = 0x01U,
kFLASH_SwapStateUpdate = 0x02U,
kFLASH_SwapStateUpdateErased = 0x03U,
kFLASH_SwapStateComplete = 0x04U,
kFLASH_SwapStateDisabled = 0x05U
} flash_swap_state_t;
typedef enum _flash_swap_block_status
{
kFLASH_SwapBlockStatusLowerHalfProgramBlocksAtZero =
0x00U,
kFLASH_SwapBlockStatusUpperHalfProgramBlocksAtZero =
0x01U,
} flash_swap_block_status_t;
typedef struct _flash_swap_state_config
{
flash_swap_state_t flashSwapState;
flash_swap_block_status_t currentSwapBlockStatus;
flash_swap_block_status_t nextSwapBlockStatus;
} flash_swap_state_config_t;
typedef struct _flash_swap_ifr_field_config
{
uint16_t swapIndicatorAddress;
uint16_t swapEnableWord;
uint8_t reserved0[4];
#if (FSL_FEATURE_FLASH_IS_FTFE == 1)
uint8_t reserved1[2];
uint16_t swapDisableWord;
uint8_t reserved2[4];
#endif
} flash_swap_ifr_field_config_t;
typedef union _flash_swap_ifr_field_data
{
uint32_t flashSwapIfrData[2];
flash_swap_ifr_field_config_t flashSwapIfrField;
} flash_swap_ifr_field_data_t;
typedef enum _flash_partition_flexram_load_option
{
kFLASH_PartitionFlexramLoadOptionLoadedWithValidEepromData =
0x00U,
kFLASH_PartitionFlexramLoadOptionNotLoaded = 0x01U
} flash_partition_flexram_load_option_t;
typedef void (*flash_callback_t)(void);
typedef struct _flash_operation_config
{
uint32_t convertedAddress;
uint32_t activeSectorSize;
uint32_t activeBlockSize;
uint32_t blockWriteUnitSize;
uint32_t sectorCmdAddressAligment;
uint32_t sectionCmdAddressAligment;
uint32_t resourceCmdAddressAligment;
uint32_t checkCmdAddressAligment;
} flash_operation_config_t;
typedef struct _flash_config
{
uint32_t PFlashBlockBase;
uint32_t PFlashTotalSize;
uint32_t PFlashBlockCount;
uint32_t PFlashSectorSize;
flash_callback_t PFlashCallback;
uint32_t PFlashAccessSegmentSize;
uint32_t PFlashAccessSegmentCount;
uint32_t *flashExecuteInRamFunctionInfo;
uint32_t FlexRAMBlockBase;
uint32_t FlexRAMTotalSize;
uint32_t DFlashBlockBase;
uint32_t DFlashTotalSize;
uint32_t EEpromTotalSize;
} flash_config_t;
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
status_t FLASH_Init(flash_config_t *config);
status_t FLASH_SetCallback(flash_config_t *config, flash_callback_t callback);
#if FLASH_DRIVER_IS_FLASH_RESIDENT
status_t FLASH_PrepareExecuteInRamFunctions(flash_config_t *config);
#endif
status_t FLASH_EraseAll(flash_config_t *config, uint32_t key);
status_t FLASH_Erase(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, uint32_t key);
#if defined(FSL_FEATURE_FLASH_HAS_ERASE_ALL_BLOCKS_UNSECURE_CMD) && FSL_FEATURE_FLASH_HAS_ERASE_ALL_BLOCKS_UNSECURE_CMD
status_t FLASH_EraseAllUnsecure(flash_config_t *config, uint32_t key);
#endif
status_t FLASH_EraseAllExecuteOnlySegments(flash_config_t *config, uint32_t key);
status_t FLASH_Program(flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes);
status_t FLASH_ProgramOnce(flash_config_t *config, uint32_t index, uint32_t *src, uint32_t lengthInBytes);
#if defined(FSL_FEATURE_FLASH_HAS_PROGRAM_SECTION_CMD) && FSL_FEATURE_FLASH_HAS_PROGRAM_SECTION_CMD
status_t FLASH_ProgramSection(flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes);
#endif
#if FLASH_SSD_IS_FLEXNVM_ENABLED
status_t FLASH_EepromWrite(flash_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes);
#endif
#if defined(FSL_FEATURE_FLASH_HAS_READ_RESOURCE_CMD) && FSL_FEATURE_FLASH_HAS_READ_RESOURCE_CMD
status_t FLASH_ReadResource(
flash_config_t *config, uint32_t start, uint32_t *dst, uint32_t lengthInBytes, flash_read_resource_option_t option);
#endif
status_t FLASH_ReadOnce(flash_config_t *config, uint32_t index, uint32_t *dst, uint32_t lengthInBytes);
status_t FLASH_GetSecurityState(flash_config_t *config, flash_security_state_t *state);
status_t FLASH_SecurityBypass(flash_config_t *config, const uint8_t *backdoorKey);
status_t FLASH_VerifyEraseAll(flash_config_t *config, flash_margin_value_t margin);
status_t FLASH_VerifyErase(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, flash_margin_value_t margin);
status_t FLASH_VerifyProgram(flash_config_t *config,
uint32_t start,
uint32_t lengthInBytes,
const uint32_t *expectedData,
flash_margin_value_t margin,
uint32_t *failedAddress,
uint32_t *failedData);
status_t FLASH_VerifyEraseAllExecuteOnlySegments(flash_config_t *config, flash_margin_value_t margin);
status_t FLASH_IsProtected(flash_config_t *config,
uint32_t start,
uint32_t lengthInBytes,
flash_protection_state_t *protection_state);
status_t FLASH_IsExecuteOnly(flash_config_t *config,
uint32_t start,
uint32_t lengthInBytes,
flash_execute_only_access_state_t *access_state);
status_t FLASH_GetProperty(flash_config_t *config, flash_property_tag_t whichProperty, uint32_t *value);
#if defined(FSL_FEATURE_FLASH_HAS_SET_FLEXRAM_FUNCTION_CMD) && FSL_FEATURE_FLASH_HAS_SET_FLEXRAM_FUNCTION_CMD
status_t FLASH_SetFlexramFunction(flash_config_t *config, flash_flexram_function_option_t option);
#endif
#if defined(FSL_FEATURE_FLASH_HAS_SWAP_CONTROL_CMD) && FSL_FEATURE_FLASH_HAS_SWAP_CONTROL_CMD
status_t FLASH_SwapControl(flash_config_t *config,
uint32_t address,
flash_swap_control_option_t option,
flash_swap_state_config_t *returnInfo);
#endif
#if defined(FSL_FEATURE_FLASH_HAS_PFLASH_BLOCK_SWAP) && FSL_FEATURE_FLASH_HAS_PFLASH_BLOCK_SWAP
status_t FLASH_Swap(flash_config_t *config, uint32_t address, flash_swap_function_option_t option);
#endif
#if defined(FSL_FEATURE_FLASH_HAS_PROGRAM_PARTITION_CMD) && FSL_FEATURE_FLASH_HAS_PROGRAM_PARTITION_CMD
status_t FLASH_ProgramPartition(flash_config_t *config,
flash_partition_flexram_load_option_t option,
uint32_t eepromDataSizeCode,
uint32_t flexnvmPartitionCode);
#endif
status_t FLASH_PflashSetProtection(flash_config_t *config, uint32_t protectStatus);
status_t FLASH_PflashGetProtection(flash_config_t *config, uint32_t *protectStatus);
#if FLASH_SSD_IS_FLEXNVM_ENABLED
status_t FLASH_DflashSetProtection(flash_config_t *config, uint8_t protectStatus);
#endif
#if FLASH_SSD_IS_FLEXNVM_ENABLED
status_t FLASH_DflashGetProtection(flash_config_t *config, uint8_t *protectStatus);
#endif
#if FLASH_SSD_IS_FLEXNVM_ENABLED
status_t FLASH_EepromSetProtection(flash_config_t *config, uint8_t protectStatus);
#endif
#if FLASH_SSD_IS_FLEXNVM_ENABLED
status_t FLASH_EepromGetProtection(flash_config_t *config, uint8_t *protectStatus);
#endif
#if defined(__cplusplus)
}
#endif
#endif /* _FSL_FLASH_H_ */
kFLASH_ProtectionStateMixed
Definition: src/drivers/flash/fsl_flash.h:215
flash_swap_ifr_field_data_t
Flash Swap IFR field data.
Definition: src/drivers/flash/fsl_flash.h:404
FLASH_IsProtected
status_t FLASH_IsProtected(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, flash_protection_state_t *protection_state)
Returns the protection state of desired flash area via the pointer passed into the function...
Definition: fsl_flash.c:1367
kFLASH_SwapStateUninitialized
Definition: src/drivers/flash/fsl_flash.h:357
kFLASH_SecurityStateBackdoorDisabled
Definition: src/drivers/flash/fsl_flash.h:205
flash_operation_config_t::sectionCmdAddressAligment
uint32_t sectionCmdAddressAligment
Definition: src/drivers/flash/fsl_flash.h:433
flash_config_t::PFlashSectorSize
uint32_t PFlashSectorSize
Definition: src/drivers/flash/fsl_flash.h:448
kFLASH_PropertyPflashAccessSegmentSize
Definition: src/drivers/flash/fsl_flash.h:239
flash_swap_state_config_t::currentSwapBlockStatus
flash_swap_block_status_t currentSwapBlockStatus
Definition: src/drivers/flash/fsl_flash.h:382
_flash_read_resource_range
_flash_read_resource_range
Enumeration for the range of special-purpose flash resource.
Definition: src/drivers/flash/fsl_flash.h:283
kStatus_FLASH_SetFlexramAsEepromError
Definition: src/drivers/flash/fsl_flash.h:150
flash_swap_ifr_field_config_t::swapEnableWord
uint16_t swapEnableWord
Definition: src/drivers/flash/fsl_flash.h:392
flash_swap_ifr_field_config_t::swapDisableWord
uint16_t swapDisableWord
Definition: src/drivers/flash/fsl_flash.h:396
kFLASH_ExecuteInRamFunctionTotalNum
Definition: src/drivers/flash/fsl_flash.h:257
flash_swap_state_config_t::flashSwapState
flash_swap_state_t flashSwapState
Definition: src/drivers/flash/fsl_flash.h:381
FLASH_GetSecurityState
status_t FLASH_GetSecurityState(flash_config_t *config, flash_security_state_t *state)
Returns the security state via the pointer passed into the function.
Definition: fsl_flash.c:1152
kFLASH_SwapBlockStatusLowerHalfProgramBlocksAtZero
Definition: src/drivers/flash/fsl_flash.h:370
flash_swap_block_status_t
flash_swap_block_status_t
Definition: src/drivers/flash/fsl_flash.h:368
FLASH_ReadResource
status_t FLASH_ReadResource(flash_config_t *config, uint32_t start, uint32_t *dst, uint32_t lengthInBytes, flash_read_resource_option_t option)
Read resource with data at locations passed in through parameters.
Definition: fsl_flash.c:1056
kStatus_FLASH_CommandNotSupported
Definition: src/drivers/flash/fsl_flash.h:157
kStatus_FLASH_RecoverFlexramAsRamError
Definition: src/drivers/flash/fsl_flash.h:152
flash_execute_in_ram_function_config_t::flashCacheClearCommand
uint8_t * flashCacheClearCommand
Definition: src/drivers/flash/fsl_flash.h:267
kFLASH_ResourceRangePflashSwapIfrStart
Definition: src/drivers/flash/fsl_flash.h:290
flash_operation_config_t::resourceCmdAddressAligment
uint32_t resourceCmdAddressAligment
Definition: src/drivers/flash/fsl_flash.h:434
kFLASH_ApiEraseKey
Definition: src/drivers/flash/fsl_flash.h:183
flash_callback_t
void(* flash_callback_t)(void)
callback type used for pflash block
Definition: src/drivers/flash/fsl_flash.h:421
kFLASH_SwapStateComplete
Definition: src/drivers/flash/fsl_flash.h:361
flash_swap_state_t
flash_swap_state_t
Enumeration for the possible flash swap status.
Definition: src/drivers/flash/fsl_flash.h:355
kFLASH_PartitionFlexramLoadOptionLoadedWithValidEepromData
Definition: src/drivers/flash/fsl_flash.h:415
flash_swap_ifr_field_config_t::swapIndicatorAddress
uint16_t swapIndicatorAddress
Definition: src/drivers/flash/fsl_flash.h:391
flash_swap_ifr_field_config_t
Flash Swap IFR fields.
Definition: src/drivers/flash/fsl_flash.h:389
FLASH_VerifyErase
status_t FLASH_VerifyErase(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, flash_margin_value_t margin)
Verifies erasure of desired flash area at specified margin level.
Definition: fsl_flash.c:1236
kFLASH_SwapFunctionOptionDisable
Definition: src/drivers/flash/fsl_flash.h:337
kFLASH_PropertyPflashTotalSize
Definition: src/drivers/flash/fsl_flash.h:234
flash_config_t::DFlashBlockBase
uint32_t DFlashBlockBase
Definition: src/drivers/flash/fsl_flash.h:457
kFLASH_ExecuteInRamFunctionMaxSize
Definition: src/drivers/flash/fsl_flash.h:256
kStatus_FLASH_RegionExecuteOnly
Definition: src/drivers/flash/fsl_flash.h:145
flash_operation_config_t::activeBlockSize
uint32_t activeBlockSize
Definition: src/drivers/flash/fsl_flash.h:430
kFLASH_MarginValueUser
Definition: src/drivers/flash/fsl_flash.h:193
FLASH_Erase
status_t FLASH_Erase(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, uint32_t key)
Erases flash sectors encompassed by parameters passed into function.
Definition: fsl_flash.c:604
FLASH_DflashGetProtection
status_t FLASH_DflashGetProtection(flash_config_t *config, uint8_t *protectStatus)
Get DFLASH Protection Status.
Definition: fsl_flash.c:1914
kFLASH_ResourceRangeVersionIdStart
Definition: src/drivers/flash/fsl_flash.h:288
kFLASH_ResourceRangePflashSwapIfrEnd
Definition: src/drivers/flash/fsl_flash.h:291
flash_swap_state_config_t
Flash Swap information.
Definition: src/drivers/flash/fsl_flash.h:379
flash_partition_flexram_load_option_t
flash_partition_flexram_load_option_t
Enumeration for FlexRAM load during reset option.
Definition: src/drivers/flash/fsl_flash.h:413
kFLASH_SwapStateReady
Definition: src/drivers/flash/fsl_flash.h:358
kFLASH_DriverVersionName
Definition: src/drivers/flash/fsl_flash.h:67
flash_operation_config_t::sectorCmdAddressAligment
uint32_t sectorCmdAddressAligment
Definition: src/drivers/flash/fsl_flash.h:432
flash_read_resource_option_t
flash_read_resource_option_t
Enumeration for the two possible options of flash read resource command.
Definition: src/drivers/flash/fsl_flash.h:273
kFLASH_SwapStateUpdate
Definition: src/drivers/flash/fsl_flash.h:359
flash_config_t::PFlashCallback
flash_callback_t PFlashCallback
Definition: src/drivers/flash/fsl_flash.h:449
flash_operation_config_t::blockWriteUnitSize
uint32_t blockWriteUnitSize
Definition: src/drivers/flash/fsl_flash.h:431
kStatus_FLASH_RecoverFlexramAsEepromError
Definition: src/drivers/flash/fsl_flash.h:155
FLASH_VerifyProgram
status_t FLASH_VerifyProgram(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, const uint32_t *expectedData, flash_margin_value_t margin, uint32_t *failedAddress, uint32_t *failedData)
Verifies programming of desired flash area at specified margin level.
Definition: fsl_flash.c:1295
kStatus_FLASH_CommandFailure
Definition: src/drivers/flash/fsl_flash.h:141
kStatus_FLASH_SwapIndicatorAddressError
Definition: src/drivers/flash/fsl_flash.h:160
_flash_execute_in_ram_function_constants
_flash_execute_in_ram_function_constants
Constants for execute-in-ram flash function.
Definition: src/drivers/flash/fsl_flash.h:254
FLASH_VerifyEraseAll
status_t FLASH_VerifyEraseAll(flash_config_t *config, flash_margin_value_t margin)
Verifies erasure of entire flash at specified margin level.
Definition: fsl_flash.c:1222
FLASH_Swap
status_t FLASH_Swap(flash_config_t *config, uint32_t address, flash_swap_function_option_t option)
Swap the lower half flash with the higher half flaock.
Definition: fsl_flash.c:1731
kFLASH_PropertyDflashBlockBaseAddr
Definition: src/drivers/flash/fsl_flash.h:247
flash_execute_in_ram_function_config_t
Flash execute-in-ram function information.
Definition: src/drivers/flash/fsl_flash.h:263
kFLASH_PropertyPflashSectorSize
Definition: src/drivers/flash/fsl_flash.h:233
FLASH_EepromGetProtection
status_t FLASH_EepromGetProtection(flash_config_t *config, uint8_t *protectStatus)
Get DFLASH Protection Status.
Definition: fsl_flash.c:1957
flash_operation_config_t::activeSectorSize
uint32_t activeSectorSize
Definition: src/drivers/flash/fsl_flash.h:429
FLASH_VerifyEraseAllExecuteOnlySegments
status_t FLASH_VerifyEraseAllExecuteOnlySegments(flash_config_t *config, flash_margin_value_t margin)
Verifies if the program flash executeonly segments have been erased to the specified read margin leve...
Definition: fsl_flash.c:1353
kFLASH_PropertyPflashBlockSize
Definition: src/drivers/flash/fsl_flash.h:235
kFLASH_MarginValueInvalid
Definition: src/drivers/flash/fsl_flash.h:195
flash_config_t::PFlashBlockCount
uint32_t PFlashBlockCount
Definition: src/drivers/flash/fsl_flash.h:447
FLASH_EepromWrite
status_t FLASH_EepromWrite(flash_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes)
Programs EEPROM with data at locations passed in through parameters.
Definition: fsl_flash.c:974
FLASH_PflashSetProtection
status_t FLASH_PflashSetProtection(flash_config_t *config, uint32_t protectStatus)
Set PFLASH Protection to the intended protection status.
Definition: fsl_flash.c:1860
kFLASH_PropertyDflashSectorSize
Definition: src/drivers/flash/fsl_flash.h:243
FLASH_EraseAll
status_t FLASH_EraseAll(flash_config_t *config, uint32_t key)
Erases entire flash.
Definition: fsl_flash.c:568
kFLASH_SwapBlockStatusUpperHalfProgramBlocksAtZero
Definition: src/drivers/flash/fsl_flash.h:372
FLASH_ProgramSection
status_t FLASH_ProgramSection(flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes)
Programs flash with data at locations passed in through parameters via Program Section command...
Definition: fsl_flash.c:845
kFLASH_PropertyPflashAccessSegmentCount
Definition: src/drivers/flash/fsl_flash.h:240
kFLASH_SwapControlOptionSetInCompleteState
Definition: src/drivers/flash/fsl_flash.h:347
kFLASH_AccessStateExecuteOnly
Definition: src/drivers/flash/fsl_flash.h:224
kStatus_FLASH_SizeError
Definition: src/drivers/flash/fsl_flash.h:133
kStatus_FLASH_UnknownProperty
Definition: src/drivers/flash/fsl_flash.h:143
_flash_status
_flash_status
Flash driver status codes.
Definition: src/drivers/flash/fsl_flash.h:129
flash_config_t::PFlashAccessSegmentCount
uint32_t PFlashAccessSegmentCount
Definition: src/drivers/flash/fsl_flash.h:451
kFLASH_PropertyDflashBlockCount
Definition: src/drivers/flash/fsl_flash.h:246
kFLASH_PropertyFlexRamBlockBaseAddr
Definition: src/drivers/flash/fsl_flash.h:241
kFLASH_ResourceRangeVersionIdEnd
Definition: src/drivers/flash/fsl_flash.h:289
kFLASH_PropertyPflashBlockBaseAddr
Definition: src/drivers/flash/fsl_flash.h:237
flash_execute_in_ram_function_config_t::flashRunCommand
uint8_t * flashRunCommand
Definition: src/drivers/flash/fsl_flash.h:266
flash_protection_state_t
flash_protection_state_t
Enumeration for the three possible flash protection levels.
Definition: src/drivers/flash/fsl_flash.h:211
flash_operation_config_t::convertedAddress
uint32_t convertedAddress
Definition: src/drivers/flash/fsl_flash.h:428
FLASH_SecurityBypass
status_t FLASH_SecurityBypass(flash_config_t *config, const uint8_t *backdoorKey)
Allows user to bypass security with a backdoor key.
Definition: fsl_flash.c:1190
kFLASH_PropertyPflashFacSupport
Definition: src/drivers/flash/fsl_flash.h:238
kFLASH_ResourceOptionFlashIfr
Definition: src/drivers/flash/fsl_flash.h:275
kStatus_FLASH_InvalidArgument
Definition: src/drivers/flash/fsl_flash.h:132
flash_config_t::flashExecuteInRamFunctionInfo
uint32_t * flashExecuteInRamFunctionInfo
Definition: src/drivers/flash/fsl_flash.h:452
_flash_acceleration_ram_property
_flash_acceleration_ram_property
Enumeration for acceleration ram property.
Definition: src/drivers/flash/fsl_flash.h:326
kFLASH_ResourceRangeVersionIdSizeInBytes
Definition: src/drivers/flash/fsl_flash.h:287
flash_flexram_function_option_t
flash_flexram_function_option_t
Enumeration for the two possilbe options of set flexram function command.
Definition: src/drivers/flash/fsl_flash.h:317
kFLASH_SwapControlOptionReportStatus
Definition: src/drivers/flash/fsl_flash.h:348
kFLASH_PropertyFlexRamTotalSize
Definition: src/drivers/flash/fsl_flash.h:242
kFLASH_ResourceRangePflashIfrSizeInBytes
Definition: src/drivers/flash/fsl_flash.h:286
flash_property_tag_t
flash_property_tag_t
Enumeration for various flash properties.
Definition: src/drivers/flash/fsl_flash.h:231
FLASH_Init
status_t FLASH_Init(flash_config_t *config)
Initializes global flash properties structure members.
Definition: fsl_flash.c:468
flash_swap_state_config_t::nextSwapBlockStatus
flash_swap_block_status_t nextSwapBlockStatus
Definition: src/drivers/flash/fsl_flash.h:383
kStatus_FLASH_SetFlexramAsRamError
Definition: src/drivers/flash/fsl_flash.h:154
kFLASH_SwapStateDisabled
Definition: src/drivers/flash/fsl_flash.h:362
FLASH_EraseAllUnsecure
status_t FLASH_EraseAllUnsecure(flash_config_t *config, uint32_t key)
Erases entire flash, including protected sectors.
Definition: fsl_flash.c:676
kFLASH_ResourceRangeDflashIfrStart
Definition: src/drivers/flash/fsl_flash.h:310
FLASH_PrepareExecuteInRamFunctions
status_t FLASH_PrepareExecuteInRamFunctions(flash_config_t *config)
Prepare flash execute-in-ram functions.
Definition: fsl_flash.c:549
flash_config_t::EEpromTotalSize
uint32_t EEpromTotalSize
Definition: src/drivers/flash/fsl_flash.h:461
kFLASH_SwapControlOptionDisableSystem
Definition: src/drivers/flash/fsl_flash.h:349
kFLASH_ProtectionStateUnprotected
Definition: src/drivers/flash/fsl_flash.h:213
FLASH_SetCallback
status_t FLASH_SetCallback(flash_config_t *config, flash_callback_t callback)
Set the desired flash callback function.
Definition: fsl_flash.c:536
kFLASH_SecurityStateBackdoorEnabled
Definition: src/drivers/flash/fsl_flash.h:204
kFLASH_PartitionFlexramLoadOptionNotLoaded
Definition: src/drivers/flash/fsl_flash.h:417
kFLASH_SwapFunctionOptionEnable
Definition: src/drivers/flash/fsl_flash.h:336
flash_swap_control_option_t
flash_swap_control_option_t
Enumeration for the possible options of Swap Control commands.
Definition: src/drivers/flash/fsl_flash.h:343
FLASH_GetProperty
status_t FLASH_GetProperty(flash_config_t *config, flash_property_tag_t whichProperty, uint32_t *value)
Returns the desired flash property.
Definition: fsl_flash.c:1588
flash_swap_ifr_field_data_t::flashSwapIfrField
flash_swap_ifr_field_config_t flashSwapIfrField
Definition: src/drivers/flash/fsl_flash.h:407
flash_config_t::FlexRAMBlockBase
uint32_t FlexRAMBlockBase
Definition: src/drivers/flash/fsl_flash.h:453
flash_security_state_t
flash_security_state_t
Enumeration for the three possible flash security states.
Definition: src/drivers/flash/fsl_flash.h:201
flash_config_t::PFlashTotalSize
uint32_t PFlashTotalSize
Definition: src/drivers/flash/fsl_flash.h:446
kFLASH_ResourceOptionVersionId
Definition: src/drivers/flash/fsl_flash.h:277
kFLASH_PropertyPflashBlockCount
Definition: src/drivers/flash/fsl_flash.h:236
flash_margin_value_t
flash_margin_value_t
Enumeration for supported flash margin levels.
Definition: src/drivers/flash/fsl_flash.h:190
kFLASH_FlexramFunctionOptionAvailableForEeprom
Definition: src/drivers/flash/fsl_flash.h:320
kStatus_FLASH_PartitionStatusUpdateFailure
Definition: src/drivers/flash/fsl_flash.h:148
FLASH_EepromSetProtection
status_t FLASH_EepromSetProtection(flash_config_t *config, uint8_t protectStatus)
Set EEPROM Protection to the intended protection status.
Definition: fsl_flash.c:1933
FLASH_EraseAllExecuteOnlySegments
status_t FLASH_EraseAllExecuteOnlySegments(flash_config_t *config, uint32_t key)
Erases all program flash execute-only segments defined by the FXACC registers.
Definition: fsl_flash.c:713
FLASH_SwapControl
status_t FLASH_SwapControl(flash_config_t *config, uint32_t address, flash_swap_control_option_t option, flash_swap_state_config_t *returnInfo)
Configure Swap function or Check the swap state of Flash Module.
Definition: fsl_flash.c:1686
kStatus_FLASH_Success
Definition: src/drivers/flash/fsl_flash.h:131
_flash_driver_api_keys
_flash_driver_api_keys
Enumeration for flash driver API keys.
Definition: src/drivers/flash/fsl_flash.h:181
kFLASH_SwapStateUpdateErased
Definition: src/drivers/flash/fsl_flash.h:360
flash_config_t
Flash driver state information.
Definition: src/drivers/flash/fsl_flash.h:443
kFLASH_AccessStateUnLimited
Definition: src/drivers/flash/fsl_flash.h:223
kFLASH_SwapControlOptionSetInUpdateState
Definition: src/drivers/flash/fsl_flash.h:346
kStatus_FLASH_ProtectionViolation
Definition: src/drivers/flash/fsl_flash.h:139
flash_operation_config_t::checkCmdAddressAligment
uint32_t checkCmdAddressAligment
Definition: src/drivers/flash/fsl_flash.h:435
kStatus_FLASH_AddressError
Definition: src/drivers/flash/fsl_flash.h:136
kStatus_FLASH_AlignmentError
Definition: src/drivers/flash/fsl_flash.h:134
FLASH_PflashGetProtection
status_t FLASH_PflashGetProtection(flash_config_t *config, uint32_t *protectStatus)
Get PFLASH Protection Status.
Definition: fsl_flash.c:1877
FLASH_ProgramOnce
status_t FLASH_ProgramOnce(flash_config_t *config, uint32_t index, uint32_t *src, uint32_t lengthInBytes)
Programs Program Once Field through parameters.
Definition: fsl_flash.c:808
flash_config_t::FlexRAMTotalSize
uint32_t FlexRAMTotalSize
Definition: src/drivers/flash/fsl_flash.h:455
flash_execute_only_access_state_t
flash_execute_only_access_state_t
Enumeration for the three possible flash execute access levels.
Definition: src/drivers/flash/fsl_flash.h:221
flash_config_t::PFlashAccessSegmentSize
uint32_t PFlashAccessSegmentSize
Definition: src/drivers/flash/fsl_flash.h:450
kFLASH_SecurityStateNotSecure
Definition: src/drivers/flash/fsl_flash.h:203
kStatus_FLASH_SwapSystemNotInUninitialized
Definition: src/drivers/flash/fsl_flash.h:158
FLASH_DflashSetProtection
status_t FLASH_DflashSetProtection(flash_config_t *config, uint8_t protectStatus)
Set DFLASH Protection to the intended protection status.
Definition: fsl_flash.c:1890
kFLASH_PropertyEepromTotalSize
Definition: apps/flash_driver_api/src/fsl_flash.h:224
kFLASH_MarginValueFactory
Definition: src/drivers/flash/fsl_flash.h:194
kStatus_FLASH_AccessError
Definition: src/drivers/flash/fsl_flash.h:137
kFLASH_MarginValueNormal
Definition: src/drivers/flash/fsl_flash.h:192
kFLASH_AccessStateMixed
Definition: src/drivers/flash/fsl_flash.h:225
flash_execute_in_ram_function_config_t::activeFunctionCount
uint32_t activeFunctionCount
Definition: src/drivers/flash/fsl_flash.h:265
kFLASH_DriverVersionMajor
Definition: src/drivers/flash/fsl_flash.h:68
FLASH_SetFlexramFunction
status_t FLASH_SetFlexramFunction(flash_config_t *config, flash_flexram_function_option_t option)
Set FlexRAM Function command.
Definition: fsl_flash.c:1662
FLASH_IsExecuteOnly
status_t FLASH_IsExecuteOnly(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, flash_execute_only_access_state_t *access_state)
Returns the access state of desired flash area via the pointer passed into the function.
Definition: fsl_flash.c:1505
status_t
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:121
kStatus_FLASH_ExecuteInRamFunctionNotReady
Definition: src/drivers/flash/fsl_flash.h:146
kStatus_FLASH_EraseKeyError
Definition: src/drivers/flash/fsl_flash.h:144
kFLASH_ResourceRangeDflashIfrEnd
Definition: src/drivers/flash/fsl_flash.h:311
kFLASH_DriverVersionMinor
Definition: src/drivers/flash/fsl_flash.h:69
kFLASH_ProtectionStateProtected
Definition: src/drivers/flash/fsl_flash.h:214
kFLASH_PropertyDflashTotalSize
Definition: src/drivers/flash/fsl_flash.h:244
kFLASH_FlexramFunctionOptionAvailableAsRam
Definition: src/drivers/flash/fsl_flash.h:319
flash_swap_function_option_t
flash_swap_function_option_t
Enumeration for the possible options of Swap function.
Definition: src/drivers/flash/fsl_flash.h:334
FLASH_ProgramPartition
status_t FLASH_ProgramPartition(flash_config_t *config, flash_partition_flexram_load_option_t option, uint32_t eepromDataSizeCode, uint32_t flexnvmPartitionCode)
Prepares the FlexNVM block for use as data flash, EEPROM backup, or a combination of both and initial...
Definition: fsl_flash.c:1823
flash_config_t::DFlashTotalSize
uint32_t DFlashTotalSize
Definition: src/drivers/flash/fsl_flash.h:459
kFLASH_PropertyDflashBlockSize
Definition: src/drivers/flash/fsl_flash.h:245
flash_operation_config_t
Active flash information for current operation.
Definition: src/drivers/flash/fsl_flash.h:426
FLASH_ReadOnce
status_t FLASH_ReadOnce(flash_config_t *config, uint32_t index, uint32_t *dst, uint32_t lengthInBytes)
Read Program Once Field through parameters.
Definition: fsl_flash.c:1116
kFLASH_SwapControlOptionIntializeSystem
Definition: src/drivers/flash/fsl_flash.h:345
flash_config_t::PFlashBlockBase
uint32_t PFlashBlockBase
Definition: src/drivers/flash/fsl_flash.h:445
kFLASH_DriverVersionBugfix
Definition: src/drivers/flash/fsl_flash.h:70
FLASH_Program
status_t FLASH_Program(flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes)
Programs flash with data at locations passed in through parameters.
Definition: fsl_flash.c:741