/*!
* @file             Fls_Cfg.h
*
* @version          1.0.0
*
* @brief            Header file of flash parameter configuration.
*
* @details          This file contains the used configuration parameters generated by EB tresos studio 
*
*/

/*******************************************************************************
* Project Name      : AUTOSAR MCAL
* Platform          : Arm
* Peripheral        : Fls
* Autosar Standard  : Classic Platform 4.4.0
* Revision Number   :
* Compiled Version  : G32A10xx_MCAL_1_0_0_01-Otc-25
*
* Copyright (C) 2026 Geehy Semiconductor
*
* You may not use this file except in compliance with the GEEHY COPYRIGHT NOTICE
* (Geehy Semiconductor Software License Agreement).
*
* The program is only for reference, which is distributed in the hope that it
* will be useful and instructional for customers to develop their software.
* Unless required by applicable law or agreed to in writing, the program is
* distributed on an "AS IS" BASIS, WITHOUT ANY WARRANTY OR CONDITIONS OF ANY
* KIND, either express or implied. See the Geehy Semiconductor Software License Agreement for
* the governing permissions and limitations under the License.
*
*******************************************************************************/

#ifndef FLS_CFG_H
#define FLS_CFG_H

#ifdef __cplusplus
extern "C"{
#endif

#include "Fls_FmcTypes.h"
#include "Mcal.h"
#include "MemIf_Types.h"

/**************************************************************************
                  VENDOR ID & AUTOSAR VERSION INFO
**************************************************************************/
/** Vendor ID (vendorId) of the dedicated implementation of this module according to the AUTOSAR vendor list. */
#define FLS_CFG_H_VENDOR_ID                             0x00C1U
/** Module ID of this module, as defined in the BSW Module List. */
#define FLS_CFG_H_MODULE_ID                             0x005CU
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */
#define FLS_CFG_H_AR_RELEASE_MAJOR_VERSION              0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define FLS_CFG_H_AR_RELEASE_MINOR_VERSION              0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define FLS_CFG_H_AR_RELEASE_REVISION_VERSION           0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define FLS_CFG_H_SW_MAJOR_VERSION                      0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define FLS_CFG_H_SW_MINOR_VERSION                      0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define FLS_CFG_H_SW_PATCH_VERSION                      0x00U

/**************************************************************************
                    VERSION INFOMATION VERIFICATION
**************************************************************************/
/* Make sure the vendor id is the same between Fls_Cfg.h and Fls_FmcTypes.h */
#if (FLS_CFG_H_VENDOR_ID != FLS_FMC_TYPES_H_VENDOR_ID)
    #error "Vendor id mismatch between Fls_Cfg.h and Fls_FmcTypes.h"
#endif
/* Make sure the AUTOSAR major version number is the same between Fls_Cfg.h and Fls_FmcTypes.h */
#if (FLS_CFG_H_AR_RELEASE_MAJOR_VERSION != FLS_FMC_TYPES_H_AR_RELEASE_MAJOR_VERSION) 
    #error "AUTOSAR Major Version Number mismatch between Fls_Cfg.h and Fls_FmcTypes.h"
#endif
/* Make sure the AUTOSAR minor version number is the same between Fls_Cfg.h and Fls_FmcTypes.h */
#if (FLS_CFG_H_AR_RELEASE_MINOR_VERSION != FLS_FMC_TYPES_H_AR_RELEASE_MINOR_VERSION) 
    #error "AUTOSAR Minor Version Number mismatch between Fls_Cfg.h and Fls_FmcTypes.h"
#endif
/* Make sure the AUTOSAR revision version number is the same between Fls_Cfg.h and Fls_FmcTypes.h */
#if (FLS_CFG_H_AR_RELEASE_REVISION_VERSION != FLS_FMC_TYPES_H_AR_RELEASE_REVISION_VERSION)
    #error "AUTOSAR Revision Version Number mismatch between Fls_Cfg.h and Fls_FmcTypes.h"
#endif
/* Make sure the software major version number is the same between Fls_Cfg.h and Fls_FmcTypes.h */
#if (FLS_CFG_H_SW_MAJOR_VERSION != FLS_FMC_TYPES_H_SW_MAJOR_VERSION) 
    #error "Software Major Version Number mismatch between Fls_Cfg.h and Fls_FmcTypes.h"
#endif
/* Make sure the software minor version number is the same between Fls_Cfg.h and Fls_FmcTypes.h */
#if (FLS_CFG_H_SW_MINOR_VERSION != FLS_FMC_TYPES_H_SW_MINOR_VERSION) 
    #error "Software Minor Version Number mismatch between Fls_Cfg.h and Fls_FmcTypes.h"
#endif
/* Make sure the software patch version number is the same between Fls_Cfg.h and Fls_FmcTypes.h */
#if (FLS_CFG_H_SW_PATCH_VERSION != FLS_FMC_TYPES_H_SW_PATCH_VERSION)
    #error "Software Patch Version Number mismatch between Fls_Cfg.h and Fls_FmcTypes.h"
#endif

/**************************************************************************
                           MACRO DEFINITION
**************************************************************************/
/** Compile switch to enable and disable the existence status of internal flash on this platform */
#define FLS_SUPPORT_INTERNAL_FLASH     (STD_ON)
/** ECC syndrome. */
#define FLASH_EXCEPT_SYNDROME          (0x8200UL)
/** Compile switch to enable and disable the flash access code loaded on job start / unloaded on job end or error */
#define FLS_JOBSTART_WITH_ACLOAD       (STD_ON)
/** Compile switch to enable and disable the Fls_BlankCheck function */
#define FLS_BLANKCHECK_API_EN          (STD_ON)
/** Compile switch to enable and disable the Fls_Cancel function */
#define FLS_CANCEL_API_EN              (STD_ON)
/** Compile switch to enable and disable the Fls_Compare function */
#define FLS_COMPARE_API_EN             (STD_ON)
/** Compile switch to enable and disable the development error detection function */
#define FLS_DETECT_DEV_ERROR_EN        (STD_OFF)
/** Compile switch to enable and disable erase verification function */
#define FLS_ERASE_VERIFICATION_EN      (STD_ON)
/** Compile switch to enable and disable the Fls_GetJobResult function */
#define FLS_GETJOBRESULT_API_EN        (STD_ON)
/** Compile switch to enable and disable the Fls_GetStatus function */
#define FLS_GETSTATUS_API_EN           (STD_ON)
/** Compile switch to enable and disable the Fls_SetMode function */
#define FLS_SETMODE_API_EN             (STD_ON)
/** Compile switch to enable and disable write verification function */
#define FLS_WRITE_VERIFICATION_EN      (STD_ON)
/** Compile switch to enable and disable the Fls_GetVersionInfo function */
#define FLS_VERSIONINFO_API_EN         (STD_ON)
/** Compile switch to enable and disable the transient fault detection function */
#define FLS_DETECT_TRANSIENT_FAULT_EN  (STD_ON)
/** Compile switch to enable and disable the runtime error detection function */
#define FLS_DETECT_RUNTIME_ERROR_EN    (STD_ON)
/** Compile switch to enable and disable the API to proces ECC errors */
#define FLS_DSIHANDLER_API_EN          (STD_ON)
/** Compile switch to enable and disable timeout supervision function */
#define FLS_TIMEOUT_SUPERVISION_EN     (STD_ON)
/** Compile switch to enable and disable the Fls_WriteOptionByte function */
#define FLS_WRITE_OPTION_BYTE_API_EN   (STD_OFF)
/** Compile switch to enable and disable the Fls_ErasePflashDflash function */
#define FLS_ERASE_PFLASH_DFLASH_API_EN (STD_OFF)
/** Compile switch to enable and disable the write blank check function */
#define FLS_WRITEBLANK_VERFY_EN         FLS_ERASE_VERIFICATION_EN
/** Timeout value of aborting an ongoing flash operation */
#define FLS_ABORT_TIMEOUT_CFG          (32767U)
/** Timeout value for erase operation */
#define FLS_ERASE_TIMEOUT_SYNC         (2147483647U)
/** Timeout value for write operation */
#define FLS_WRITE_TIMEOUT_SYNC         (2147483647U)
/** The contents of an erased flash memory cell */
#define FLS_ERASED_VALUE               (0xFFFFFFFFU)
/** Compile switch to enable and disable the internal flash sectors */
#define FLS_CFG_INTERNAL_SECTOR        (STD_ON)
/** Compile switch to enable and disable the invalidation of prefetch buffer function */
#define FLASH_PREFETCH_BUFFERS_INVALID (STD_ON)
/** The number of bytes to be written each time when programming the flash */
#define FLS_PROGRAMMING_LENGTH         (8U)
/** Compile switch to enable and disable the additionally check of syndrome and data address in Fls_DsiHandler api */
#define FLS_CHECK_SYNDROME_DATAADDR_EN (STD_ON)
/** PFlash base address */
#define PFLASH_BASEADDR                (0x08000000UL)
/** PFlash capacity */
#define PFLASH_SIZE                    (0x40000U)
/** DFlash base address */
#define DFLASH_BASEADDR                (0x08040000UL)
/** DFlash capacity */
#define DFLASH_SIZE                    (0x8000U)
/** page size */
#define PAGE_SIZE                      (0x200U)

/**************************************************************************
                    STRUCT and OTHERS DEFINITION
**************************************************************************/
/** Define access routine type according to the status of timeout supervision */
#if (STD_ON == FLS_TIMEOUT_SUPERVISION_EN)
    /** Erase / Write access routine type with timeout parameters */
    typedef Fls_OnAcErasePtrType Fls_AcErasePtrType;
    typedef Fls_OnAcWritePtrType Fls_AcWritePtrType;
#else
    /** Erase / Write access routine type without timeout parameters */
    typedef Fls_OffAcErasePtrType Fls_AcErasePtrType;
    typedef Fls_OffAcWritePtrType Fls_AcWritePtrType;
#endif 

/**
 * @brief    Fls config structure used for flash module initialization
 */
typedef struct
{
    Fls_AcErasePtrType acErasePtr; //!< FlsAcErase Pointer to erase access code position in RAM
    Fls_AcWritePtrType acWritePtr; //!< FlsAcWrite Pointer to write access code position in RAM or ROM
    Fls_AC_CBPtrType acNotificationPtr; //!< Fls_AccessCodeNotification pointer
    Fls_JobEndNotifyPtrType jobEndNotifyPtr; //!< Fls Job End Notification pointer 
    Fls_JobErrorNotifyPtrType jobErrorNotifyPtr; //!< Fls job error notification pointer
    Fls_StartFlsAccessNotifyPtrType startFlsAcNotifyPtr; //!< Fls start access notification pointer
    Fls_EndFlsAccessNotifyPtrType endFlsAcNotifyPtr; //!< Fls finish access notification pointer
    MemIf_ModeType memIfDefaultMode; //!< Default FLS device mode :MEMIF_MODE_FAST or MEMIF_MODE_SLOW
    Fls_LengthType fastModeReadMax; //!< The maximum number (bytes) to read or compare in one cycle from FlsMaxReadFastMode
    Fls_LengthType normalModeReadMax; //!< The maximum number (bytes) to read or compare in one cycle from FlsMaxReadNormalMode
    Fls_LengthType fastlModeWriteMax; //!< The maximum number (bytes) to write in one cycle from FlsMaxWriteFastMode.
    Fls_LengthType normalModeWriteMax; //!< The maximum number (bytes) to write in one cycle from FlsMaxWriteNormalMode.
    Fls_SectorCntType sectorCnt; //!< logical sectors count
    CONST( Fls_AddressType, FLS_CONST) (*sectorEndAddrPtr)[]; //!< pointer to array containing each configured sector end address
    CONST( Fls_AddressType, FLS_CONST) (*sectorBeginAddrPtr)[]; //!< pointer to array containing each configured sector begin address
    CONSTP2CONST( Fls_IntlSectorInfoType, FLS_VAR, FLS_APPL_CONST) (*sectorlistPtr)[]; //!< pointer to array containing each configured sector information
} Fls_ConfigType;

/**************************************************************************
                    GLOBAL VARIABLE
**************************************************************************/
#define FLS_START_SEC_CONFIG_DATA_UNSPECIFIED
#include "Fls_MemMap.h"

/** Declaration of fls config set structure (post-build) */
extern CONST(Fls_ConfigType, FLS_CONST) g_flsConfig;

#define FLS_STOP_SEC_CONFIG_DATA_UNSPECIFIED
#include "Fls_MemMap.h"

#ifdef __cplusplus
}
#endif
#endif
