[!AUTOSPACING!]
[!CODE!][!//
/**
*   @file    Fls_Cfg.h
*   @implements Fls_Cfg.h_Artifact
*   @version 1.0.0
*
*   @brief   AUTOSAR Fls - AUTOSAR Module Flash Driver.
*   @details Definitions of all pre-compile configuration parameters.
*
*   @addtogroup FLS
*   @{
*/
/*==================================================================================================
*   Project              : AUTOSAR 4.3 MCAL
*   Platform             : PA
*   Peripheral           : IPV_FLASHV2
*   Dependencies         : none
*
*   Autosar Version      : 4.3.1
*   Autosar Revision     : ASR_REL_4_3_REV_0001
*   Autosar Conf.Variant :
*   SW Version           : 1.0.0
*   Build Version        : MPC5777C_MCAL_1_0_0_RTM_ASR_REL_4_3_REV_0001_20190315
*
*   (c) Copyright 2006-2016 Freescale Semiconductor, Inc. 
*       Copyright 2017-2019 NXP
*   All Rights Reserved.
==================================================================================================*/
/*==================================================================================================
==================================================================================================*/

#ifndef FLS_CFG_H
#define FLS_CFG_H

#ifdef __cplusplus
extern "C"{
#endif

/**
* @page misra_violations MISRA-C:2012 violations
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.1, External identifiers shall be distinct.
* Identifiers (internal and external) shall not rely on the significance of more than 31 characters.
* The used compilers use more than 31 chars for identifiers.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.2, Identifiers declared in the same scope and namespace shall be distinct.
* This violation is due to the requirement that requests to have a file version check.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.4, Macro identifiers shall be distinct.
* This violation is due to the requirement that requests to have a file version check.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.5, Identifiers shall be distinct from macro names.
* This violation is due to the requirement that requests to have a file version check.
*
* @section Fls_Cfg_h_REF_1
* Violates MISRA 2012 Required Directive 4.10, Precautions shall be taken in order to prevent the contents of a header file being included more than once.
* This violation is not fixed since the inclusion of <MA>_MemMap.h is as per AUTOSAR requirement [SWS_MemMap_00003].
*
* @section Fls_Cfg_h_REF_2
* Violates MISRA 2012 Advisory Rule 8.9, An object should be defined at block scope if its identifier only appears in a single function.
* The data structure of type Fls_ConfigType shall be defined as external according to FLS352.
*
* @section Fls_Cfg_h_REF_3
* Violates MISRA 2012 Advisory Rule 2.5, A project should not contain unused macro declarations.
* This definition uses by FEE driver.
*/

[!INDENT "0"!][!//
/*==================================================================================================
*                                        INCLUDE FILES
* 1) system and project includes
* 2) needed interfaces from external units
* 3) internal and external interfaces from this unit
==================================================================================================*/
#include "Fls_Types.h"
#include "Mcal.h"
[!ENDINDENT!][!//
#include "MemIf_Types.h"

#include "Fls_Flash_Types.h"
/*==================================================================================================
*                              SOURCE FILE VERSION INFORMATION
==================================================================================================*/
#define FLS_VENDOR_ID_CFG                    43
#define FLS_AR_RELEASE_MAJOR_VERSION_CFG     4
#define FLS_AR_RELEASE_MINOR_VERSION_CFG     3
#define FLS_AR_RELEASE_REVISION_VERSION_CFG  1
#define FLS_SW_MAJOR_VERSION_CFG             1
#define FLS_SW_MINOR_VERSION_CFG             0
#define FLS_SW_PATCH_VERSION_CFG             0

/*==================================================================================================
*                                     FILE VERSION CHECKS
==================================================================================================*/
/* Check if current file and Fls configuration header file are of the same vendor */
#if (FLS_TYPES_VENDOR_ID != FLS_VENDOR_ID_CFG)
#error "Fls_Types.h and Fls_Cfg.h have different vendor ids"
#endif
/* Check if current file and Fls configuration header file are of the same Autosar version */
#if ((FLS_TYPES_AR_RELEASE_MAJOR_VERSION    != FLS_AR_RELEASE_MAJOR_VERSION_CFG) || \
     (FLS_TYPES_AR_RELEASE_MINOR_VERSION    != FLS_AR_RELEASE_MINOR_VERSION_CFG) || \
     (FLS_TYPES_AR_RELEASE_REVISION_VERSION != FLS_AR_RELEASE_REVISION_VERSION_CFG) \
    )
#error "AutoSar Version Numbers of Fls_Types.h and Fls_Cfg.h are different"
#endif
/* Check if current file and Fls configuration header file are of the same software version */
#if ((FLS_TYPES_SW_MAJOR_VERSION != FLS_SW_MAJOR_VERSION_CFG) || \
     (FLS_TYPES_SW_MINOR_VERSION != FLS_SW_MINOR_VERSION_CFG) || \
     (FLS_TYPES_SW_PATCH_VERSION != FLS_SW_PATCH_VERSION_CFG) \
    )
#error "Software Version Numbers of Fls_Types.h and Fls_Cfg.h are different"
#endif

#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
    /* Check if current file and Std_Types header file are of the same version */
    #if ((FLS_AR_RELEASE_MAJOR_VERSION_CFG != MCAL_AR_RELEASE_MAJOR_VERSION) || \
         (FLS_AR_RELEASE_MINOR_VERSION_CFG != MCAL_AR_RELEASE_MINOR_VERSION)\
        )
        #error "AutoSar Version Numbers of Fls_Types.h and Mcal.h are different"
    #endif
#endif

#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
    /* Check if current file and MemIf_Types.h file are of the same Autosar version */
    #if ((FLS_AR_RELEASE_MAJOR_VERSION_CFG    != MEMIF_AR_RELEASE_MAJOR_VERSION) || \
         (FLS_AR_RELEASE_MINOR_VERSION_CFG    != MEMIF_AR_RELEASE_MINOR_VERSION) \
        )
        #error "AutoSar Version Numbers of Fls_Cfg.h and MemIf_Types.h are different"
    #endif
#endif

/* Check if current file and Fls_Flash_Types configuration header file are of the same vendor */
#if (FLS_FLASH_TYPES_VENDOR_ID != FLS_VENDOR_ID_CFG)
#error "Fls_Flash_Types.h and Fls_Cfg.h have different vendor ids"
#endif
/* Check if current file and Fls_Flash_Types configuration header file are of the same Autosar version */
#if ((FLS_FLASH_TYPES_AR_RELEASE_MAJOR_VERSION    != FLS_AR_RELEASE_MAJOR_VERSION_CFG) || \
     (FLS_FLASH_TYPES_AR_RELEASE_MINOR_VERSION    != FLS_AR_RELEASE_MINOR_VERSION_CFG) || \
     (FLS_FLASH_TYPES_AR_RELEASE_REVISION_VERSION != FLS_AR_RELEASE_REVISION_VERSION_CFG) \
    )
#error "AutoSar Version Numbers of Fls_Flash_Types.h and Fls_Cfg.h are different"
#endif
/* Check if current file and Fls_Flash_Types configuration header file are of the same software version */
#if ((FLS_FLASH_TYPES_SW_MAJOR_VERSION != FLS_SW_MAJOR_VERSION_CFG) || \
     (FLS_FLASH_TYPES_SW_MINOR_VERSION != FLS_SW_MINOR_VERSION_CFG) || \
     (FLS_FLASH_TYPES_SW_PATCH_VERSION != FLS_SW_PATCH_VERSION_CFG) \
    )
#error "Software Version Numbers of Fls_Flash_Types.h and Fls_Cfg.h are different"
#endif


[!INCLUDE "Fls_VersionCheck.m"!][!//

[!MACRO "FlsExportDriverConfiguration"!][!//
[!NOCODE!][!//
[!VAR "configName" = "as:name(FlsConfigSet)"!][!//
[!IF "var:defined('postBuildVariant')"!][!//
    [!VAR "variantIndex"="0"!][!//
    [!VAR "variantNumber"="variant:size()"!][!//
    [!LOOP "variant:all()"!][!VAR "variantIndex"="$variantIndex + 1"!][!//
    [!//
        [!CODE!][!WS4!][!CR!][!ENDCODE!]
        [!CODE!][!WS4!]extern CONST(Fls_ConfigType, FLS_CONST) [!"$configName"!]_[!"."!];[!CR!][!ENDCODE!]
    [!ENDLOOP!][!//
[!ELSE!][!//
    [!CODE!][!WS4!][!CR!][!ENDCODE!]
    [!CODE!][!WS4!]extern CONST(Fls_ConfigType, FLS_CONST) [!"$configName"!];[!CR!][!ENDCODE!]
[!ENDIF!][!//
[!ENDNOCODE!][!//
[!ENDMACRO!]
/*==================================================================================================
                                       DEFINES AND MACROS
==================================================================================================*/
/* STD_ON: Internal flash is present on the current platform. */
#define FLS_INTERNAL_FLASH_AVAILABLE    ([!"ecu:get('Fls.Internal.Flash.Available')"!])
/* STD_ON: Flash access code loaded on job start / unloaded on job end or error */
#define FLS_AC_LOAD_ON_JOB_START    ([!IF "FlsGeneral/FlsAcLoadOnJobStart"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/* Compile switch to enable and disable the Fls_Cancel function */
#define FLS_CANCEL_API              ([!IF "FlsGeneral/FlsCancelApi"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/* Compile switch to enable and disable the Fls_Compare function */
#define FLS_COMPARE_API             ([!IF "FlsGeneral/FlsCompareApi"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/* Compile switch to enable and disable the Fls_BlankCheck function */
#define FLS_BLANK_CHECK_API         ([!IF "FlsGeneral/FlsBlankCheckApi"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/* Pre-processor switch to enable and disable development error detection */
#define FLS_DEV_ERROR_DETECT        ([!IF "FlsGeneral/FlsDevErrorDetect"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/* Compile switch to enable and disable the Fls_GetJobResult function */
#define FLS_GET_JOB_RESULT_API      ([!IF "FlsGeneral/FlsGetJobResultApi"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/* Compile switch to enable and disable the Fls_GetStatus function */
#define FLS_GET_STATUS_API          ([!IF "FlsGeneral/FlsGetStatusApi"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/* Compile switch to enable and disable the Fls_SetMode function */
#define FLS_SET_MODE_API            ([!IF "FlsGeneral/FlsSetModeApi"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])
/* Pre-processor switch to enable / disable the API to read out the modules version information */
#define FLS_VERSION_INFO_API        ([!IF "FlsGeneral/FlsVersionInfoApi"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/* Pre-processor switch to enable / disable the API to report data storage (ECC) errors to the flash driver */
#define FLS_ECC_CHECK               ([!IF "FlsGeneral/FlsECCCheck"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/* Pre-processor switch to enable / disable the erase blank check */
#define FLS_ERASE_VERIFICATION_ENABLED       ([!IF "FlsGeneral/FlsEraseVerificationEnabled"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/* Pre-processor switch to enable / disable the write verify check */
#define FLS_WRITE_VERIFICATION_ENABLED      ([!IF "FlsGeneral/FlsWriteVerificationEnabled"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

#if( FLS_ERASE_VERIFICATION_ENABLED == STD_ON )
    /* The maximum number of bytes to blank check in one cycle of the flash driver's job processing function */
    #define FLS_MAX_ERASE_BLANK_CHECK   ([!"FlsGeneral/FlsMaxEraseBlankCheck"!]U)
#endif /*#if( FLS_ERASE_VERIFICATION_ENABLED == STD_ON )*/

/* Timeout handling enabled */
#define FLS_TIMEOUT_SUPERVISION_ENABLED        ([!IF "FlsGeneral/FlsTimeoutSupervisionEnabled"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])
[!INDENT "0"!][!//
[!IF "FlsGeneral/FlsTimeoutSupervisionEnabled"!]
    /*
    * @brief          Define that the timeout is implemented as real time.
    *                 STD_ON : It is implemented as a loop counting cycles
    *                 STD_OFF: It is implemented using an OS service(default option).
    */
    #define FLS_TIMEOUT_AS_LOOP   ([!IF "FlsGeneral/FlsAllowLoopAsCycle"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])
    [!IF "FlsGeneral/FlsAllowLoopAsCycle"!]
    [!ELSE!][!//
    [!IF "node:exists(FlsGeneral/FlsOsCounterRef)"!][!//
        [!SELECT "node:ref(FlsGeneral/FlsOsCounterRef)"!][!//
            /*
            * @brief          Reference to OS counter
            * @details        Define the OS counter used by Flsdriver
            */
            #define FLS_TIMEOUT_COUNTER_NAME   [!"@name"!]
            /*
            * @brief          Macro to convert TimeOut
            * @details        Define the ns time specify by 1 tick
            */
            #define FLS_TIMEOUT_COUNTER_TICK2NS()   OS_TicksToNs_[!"@name"!](1U)
        [!ENDSELECT!][!//
    [!ELSE!][!//
        [!ERROR!]FlsOsCounterRef node will ref to OS service which checks the time passed so it should be enabled when FlsAllowLoopAsCycle node was disabled [!ENDERROR!]
    [!ENDIF!][!//
    [!ENDIF!][!//

    [!IF "FlsGeneral/FlsAllowLoopAsCycle = 'true'"!][!// if select the TimeOut as loop cycle
        /* Timeout value for Erase and Write operation - internal flash operations. */
        #define FLS_ASYNC_WRITE_TIMEOUT_VALUE       ([!"FlsGeneral/FlsAsyncWriteTimeoutLoop"!]U)
        #define FLS_ASYNC_ERASE_TIMEOUT_VALUE       ([!"FlsGeneral/FlsAsyncEraseTimeoutLoop"!]U)
        #define FLS_SYNC_WRITE_TIMEOUT_VALUE        ([!"FlsGeneral/FlsSyncWriteTimeoutLoop"!]U)
        #define FLS_SYNC_ERASE_TIMEOUT_VALUE        ([!"FlsGeneral/FlsSyncEraseTimeoutLoop"!]U)
                /* Timeout value for Abort operation */
        #define FLS_ABT_TIMEOUT_VALUE           ([!"FlsGeneral/FlsAbortTimeoutLoop"!]U)
                [!IF "AutosarExt/FlsMCoreEnable"!]
            /* Multicore operations timeout */
            #define FLS_MCORE_ERASE_TIMEOUT_VALUE       ([!"FlsGeneral/FlsMCoreEraseTimeoutLoop"!]U)
            #define FLS_MCORE_WRITE_TIMEOUT_VALUE       ([!"FlsGeneral/FlsMCoreWriteTimeoutLoop"!]U)
            #define FLS_MCORE_READ_TIMEOUT_VALUE        ([!"FlsGeneral/FlsMCoreReadTimeoutLoop"!]U)
            #define FLS_MCORE_HIPRIO_TIMEOUT_VALUE      ([!"FlsGeneral/FlsMCoreHiprioTimeoutLoop"!]U)
            #define FLS_MCORE_INIT_TIMEOUT_VALUE        ([!"FlsGeneral/FlsMCoreInitTimeoutLoop"!]U)
            #define FLS_MCORE_BUSY_WAIT_TIMEOUT_VALUE   ([!"FlsGeneral/FlsMCoreBusyWaitTimeoutLoop"!]U)
            [!IF "FlsGeneral/FlsCancelApi"!]
                #define FLS_MCORE_CANCEL_TIMEOUT_VALUE   ([!"FlsGeneral/FlsMCoreCancelTimeoutLoop"!]U)
            [!ENDIF!]
        [!ENDIF!]
    [!ELSE!][!// default case, when using counter from OS
    /* Convert nano sec by *1000000000 in order to same OS_TicksToNs in OS driver*/
        /* Timeout value for Erase and Write operation - internal flash operations. */
        #define FLS_ASYNC_WRITE_TIMEOUT_VALUE       ([!SELECT "FlsGeneral"!][!"num:i(FlsAsyncWriteTimeoutTime * 1000000000)"!]U[!ENDSELECT!])
        #define FLS_ASYNC_ERASE_TIMEOUT_VALUE       ([!SELECT "FlsGeneral"!][!"num:i(FlsAsyncEraseTimeoutTime * 1000000000)"!]U[!ENDSELECT!])
        #define FLS_SYNC_WRITE_TIMEOUT_VALUE        ([!SELECT "FlsGeneral"!][!"num:i(FlsSyncWriteTimeoutTime * 1000000000)"!]U[!ENDSELECT!])
        #define FLS_SYNC_ERASE_TIMEOUT_VALUE        ([!SELECT "FlsGeneral"!][!"num:i(FlsSyncEraseTimeoutTime * 1000000000)"!]U[!ENDSELECT!])
                /* Timeout value for Abort operation */
        #define FLS_ABT_TIMEOUT_VALUE               ([!SELECT "FlsGeneral"!][!"num:i(FlsAbortTimeoutTime * 1000000000)"!]U[!ENDSELECT!])
                [!IF "AutosarExt/FlsMCoreEnable"!]
            /* Multicore operations timeout */
            #define FLS_MCORE_ERASE_TIMEOUT_VALUE       ([!SELECT "FlsGeneral"!][!"num:i(FlsMCoreEraseTimeoutTime * 1000000000)"!]U[!ENDSELECT!])
            #define FLS_MCORE_WRITE_TIMEOUT_VALUE       ([!SELECT "FlsGeneral"!][!"num:i(FlsMCoreWriteTimeoutTime * 1000000000)"!]U[!ENDSELECT!])
            #define FLS_MCORE_READ_TIMEOUT_VALUE        ([!SELECT "FlsGeneral"!][!"num:i(FlsMCoreReadTimeoutTime * 1000000000)"!]U[!ENDSELECT!])
            #define FLS_MCORE_HIPRIO_TIMEOUT_VALUE      ([!SELECT "FlsGeneral"!][!"num:i(FlsMCoreHiprioTimeoutTime * 1000000000)"!]U[!ENDSELECT!])
            #define FLS_MCORE_INIT_TIMEOUT_VALUE        ([!SELECT "FlsGeneral"!][!"num:i(FlsMCoreInitTimeoutTime * 1000000000)"!]U[!ENDSELECT!])
            #define FLS_MCORE_BUSY_WAIT_TIMEOUT_VALUE   ([!SELECT "FlsGeneral"!][!"num:i(FlsMCoreBusyWaitTimeoutTime * 1000000000)"!]U[!ENDSELECT!])
            [!IF "FlsGeneral/FlsCancelApi"!]
                #define FLS_MCORE_CANCEL_TIMEOUT_VALUE   ([!SELECT "FlsGeneral"!][!"num:i(FlsMCoreCancelTimeoutTime * 1000000000)"!]U[!ENDSELECT!])
            [!ENDIF!]
        [!ENDIF!]
   [!ENDIF!]
[!ELSE!][!//
/*
 * @brief          Define that the timeout is implemented as real time.
 *                 STD_ON : It is implemented as a loop counting cycles
 *                 STD_OFF: It is implemented using an OS service(default option).
 */
#define FLS_TIMEOUT_AS_LOOP   (STD_OFF)
[!ENDIF!]
[!IF "AutosarExt/FlsMCoreEnable"!]
    #define FLS_MCORE_SEMA4_ERASE               ([!"num:inttohex(AutosarExt/FlsMCoreEraseSemaphoreChannelNo)"!]UL)
    #define FLS_MCORE_SEMA4_WRITE               ([!"num:inttohex(AutosarExt/FlsMCoreWriteSemaphoreChannelNo)"!]UL)
    #define FLS_MCORE_SEMA4_HIPRIO              ([!"num:inttohex(AutosarExt/FlsMCoreHiprioSemaphoreChannelNo)"!]UL)
    #define FLS_MCORE_SEMA4_EXCLUSIVE           ([!"num:inttohex(AutosarExt/FlsMCoreExclusiveSemaphoreChannelNo)"!]UL)

    /* The current core number. Used for identifying the semaphores taken uniquely. */
    #define FLS_CORE_NO                 (uint8)([!"num:i(AutosarExt/FlsMCoreNo)"!]U)
[!ENDIF!]
[!ENDINDENT!][!//
/* The contents of an erased flash memory cell */
#define FLS_ERASED_VALUE            ([!"num:inttohex(FlsPublishedInformation/FlsErasedValue)"!]U)

/* Fls Driver Index */
/* @violates @ref Fls_Cfg_h_REF_3 A project should not contain unused macro declarations */
#define FLS_DRIVER_INDEX            ([!"num:i(FlsGeneral/FlsDriverIndex)"!]U)

[!IF "ecu:get('Fls.UserModeSupport')='true'"!] [!//
/* User mode support */
    #define FLS_ENABLE_USER_MODE_SUPPORT        ([!IF "AutosarExt/FlsEnableUserModeSupport"!]STD_ON [!ELSE!] STD_OFF [!ENDIF!])
    #if (STD_ON == FLS_ENABLE_USER_MODE_SUPPORT)
        #define USER_MODE_REG_PROT_ENABLED      (STD_OFF)
    #endif /* (STD_ON == FLS_ENABLE_USER_MODE_SUPPORT) */
[!IF "ecu:has('Fls.C55fmcOrC40asfRegisterProtectionAvailable')"!][!//
[!IF "ecu:get('Fls.C55fmcOrC40asfRegisterProtectionAvailable') = 'true'"!][!//
#define FLS_FLASH_REG_PROT_AVAILABLE
[!ENDIF!] [!//
[!ENDIF!] [!//
#ifndef MCAL_ENABLE_USER_MODE_SUPPORT
    #if (STD_ON == FLS_ENABLE_USER_MODE_SUPPORT)
        #error "MCAL_ENABLE_USER_MODE_SUPPORT is not enabled. For running Fls in user mode the MCAL_ENABLE_USER_MODE_SUPPORT needs to be defined"
    #endif /* (STD_ON == FLS_ENABLE_USER_MODE_SUPPORT) */
#endif /* ifndef MCAL_ENABLE_USER_MODE_SUPPORT */
[!ELSE!] [!//
/* User mode support */
#define FLS_ENABLE_USER_MODE_SUPPORT        (STD_OFF)
[!ENDIF!] [!//

[!IF "ecu:has('Fls.SupportSynchronizeCacheFeature')"!][!//
    [!IF "ecu:get('Fls.SupportSynchronizeCacheFeature') = 'true'"!][!//
        /* Enable the use of cache invalidate */
        #define FLS_SYNCRONIZE_CACHE    [!WS "4"!]([!IF "AutosarExt/FlsSynchronizeCache"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])
    [!ELSE!] [!//
        #define FLS_SYNCRONIZE_CACHE    [!WS "4"!](STD_OFF)
    [!ENDIF!] [!//
[!ELSE!] [!//
    #define FLS_SYNCRONIZE_CACHE    [!WS "4"!](STD_OFF)
[!ENDIF!] [!//

/* Is there at least one (DATA) flash sector where ECCs does not lead to the exception? yes/no => STD_ON/STD_OFF */
#define FLS_DATA_FLASH_EXISTS           ([!IF "ecu:get('Fls.DataFlashExists')='true'"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])
#if( FLS_ECC_CHECK == STD_ON )
    /* The contents of an ECC flash memory line */
    #define FLS_ECC_VALUE                   ([!"num:inttohex(FlsPublishedInformation/FlsECCValue)"!]U)
    #define FLASH_DSI_EXC_SYNDROME          ([!"num:inttohex(num:hextoint(ecu:get('Fls.ECCSyndrome')))"!]UL)
    #define FLASH_DSI_EXC_SYNDROME_CACHE    ([!"num:inttohex(num:hextoint(ecu:get('Fls.ECCSyndromeCache')))"!]UL)
#endif /*#if( FLS_ECC_CHECK == STD_ON )*/

/* Internal sectors are present or not in the current configuration. */
#define FLS_INTERNAL_SECTORS_CONFIGURED     ([!IF "AutosarExt/FlsInternalSectorsConfigured"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])
/* External QSPI sectors are present or not in the current configuration. */
#define FLS_QSPI_SECTORS_CONFIGURED         ([!IF "AutosarExt/FlsExternalSectorsConfigured"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])
/*==================================================================================================
                                 STRUCTURES AND OTHER TYPEDEFS
==================================================================================================*/

/* Map access routine type according to the timeout handling setting */
#if (FLS_TIMEOUT_SUPERVISION_ENABLED == STD_ON)
    /* access routine with timeout parameters */
    typedef Fls_AcErasePtrTOType Fls_AcErasePtrType;
    typedef Fls_AcWritePtrTOType Fls_AcWritePtrType;
#else
    /* access routine without timeout parameters */
    typedef Fls_AcErasePtrNoTOType Fls_AcErasePtrType;
    typedef Fls_AcWritePtrNoTOType Fls_AcWritePtrType;
#endif /* FLS_TIMEOUT_SUPERVISION_ENABLED == STD_ON */

/**
* @brief          Fls Config Type
* @details        Fls module initialization data structure
* @implements     Fls_ConfigType_typedef
*/
typedef struct
{
    /**
    * @brief pointer to erase access code function in RAM or ROM
    */
    Fls_AcErasePtrType acErasePtr;
    /**
    * @brief pointer to write access code function in RAM or ROM
    */
    Fls_AcWritePtrType acWritePtr;
    /**
    * @brief pointer to ac callback function
    */
    Fls_ACCallbackPtrType acCallBackPtr;
    /**
    * @brief pointer to job end notification function
    */
    Fls_JobEndNotificationPtrType jobEndNotificationPtr;
    /**
    * @brief pointer to job error notification function
    */
    Fls_JobErrorNotificationPtrType jobErrorNotificationPtr;
    /**
    * @brief pointer to start flash access notification
    */
    Fls_StartFlashAccessNotifPtrType startFlashAccessNotifPtr;
    /**
    * @brief pointer to finished flash access notification
    */
    Fls_FinishedFlashAccessNotifPtrType finishedFlashAccessNotifPtr;
    /**
    * @brief pointer to finished flash access notification
    */
    Fls_MCoreTimeoutNotifPtrType MCoreTimeoutNotifPtr;
    /**
    * @brief default FLS device mode after initialization (MEMIF_MODE_FAST, MEMIF_MODE_SLOW)
    */
    MemIf_ModeType eDefaultMode;
    /**
    * @brief max number of bytes to read in one cycle of Fls_MainFunction (fast mode)
    */
    Fls_LengthType u32MaxReadFastMode;
    /**
    * @brief max number of bytes to read in one cycle of  Fls_MainFunction (normal mode)
    */
    Fls_LengthType u32MaxReadNormalMode;
    /**
    * @brief max number of bytes to write in one cycle of Fls_MainFunction (fast mode)
    */
    Fls_LengthType u32MaxWriteFastMode;
    /**
    * @brief max number of bytes to write in one cycle of  Fls_MainFunction (normal mode)
    */
    Fls_LengthType u32MaxWriteNormalMode;
    /**
    * @brief number of configured logical sectors
    */
    Fls_SectorCountType u32SectorCount;
    /**
    * @brief pointer to array containing last logical address of each configured sector
    */
    CONST( Fls_AddressType, FLS_CONST) (*paSectorEndAddr)[];
    /**
    * @brief pointer to array containing physical sector ID of each configured sector
    */
    CONSTP2CONST( Fls_Flash_InternalSectorInfoType, FLS_VAR, FLS_APPL_CONST) (*pSectorList)[];
    /**
    * @brief pointer to array containing flags set of each configured sector
    */
    CONST( uint8, FLS_CONST) (*paSectorFlags)[];
    /**
    * @brief pointer to array containing program size of each configured sector
    */
    CONST( Fls_LengthType, FLS_CONST) (*paSectorProgSize)[];
    /**
    * @brief pointer to array containing page size information of each configured sector
    */
    CONST( Fls_LengthType, FLS_CONST) (*paSectorPageSize)[];
    /**
    * @brief pointer to array containing Unlock information of each configured sector
    */
    CONST( uint8, FLS_CONST) (*paSectorUnlock)[];
    /**
    * @brief Pointer to array containing the hardware channel(internal, external_qspi, external_emmc) of each configured sector.
    */
    CONST( Fls_HwChType, FLS_CONST) (*paHwCh)[];
    /**
    * @brief Pointer to array containing the configured hardware start address of each external sector.
    */
    CONST( uint32, FLS_CONST) (*paSectorHwAddress)[];


    /**
     * @brief FLS Config Set CRC checksum
     */
    Fls_CrcType u16ConfigCrc;

} Fls_ConfigType;

/*==================================================================================================
                                 GLOBAL CONSTANT DECLARATIONS
==================================================================================================*/

#define FLS_START_SEC_CONFIG_DATA_UNSPECIFIED
[!INDENT "0"!][!//
/* @violates @ref Fls_Cfg_h_REF_1 Precautions shall be taken in order to prevent the contents of a header file being included more than once */
#include "Fls_MemMap.h"
[!IF "((IMPLEMENTATION_CONFIG_VARIANT != 'VariantPostBuild') and (variant:size()>1)) or (IMPLEMENTATION_CONFIG_VARIANT = 'VariantPostBuild')"!][!//

 /* Declaration of post-build configuration set structure */
    [!CALL "FlsExportDriverConfiguration"!][!//
[!ENDIF!][!//

[!IF "IMPLEMENTATION_CONFIG_VARIANT='VariantPreCompile'"!][!//
  [!IF "variant:size()<=1"!][!//
#define FLS_PRECOMPILE_SUPPORT
/* Declaration of pre-compile configuration set structure */
#define Fls_PBCfgVariantPredefined [!"as:name(FlsConfigSet)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!]

/* @violates @ref Fls_Cfg_h_REF_2 An object should be defined at block scope if its identifier only appears in a single function */
extern CONST(Fls_ConfigType, FLS_CONST) Fls_PBCfgVariantPredefined;
  [!ENDIF!][!//
[!ENDIF!][!//

#define FLS_STOP_SEC_CONFIG_DATA_UNSPECIFIED
/* @violates @ref Fls_Cfg_h_REF_1 Precautions shall be taken in order to prevent the contents of a header file being included more than once */
#include "Fls_MemMap.h"

[!ENDINDENT!][!//
[!ENDCODE!][!//
#ifdef __cplusplus
}
#endif

#endif /* FLS_CFG_H */

