/*!
* @file     Fee_Types.h
*
* @version  1.0.0
*
* @brief    AUTOSAR Module Fee Driver - Fee driver types head file
*
* @attention
*
* Project Name      : AUTOSAR MCAL
*
* Platform          : Arm
*
* Autosar Standard  : Classic Platform 4.4.0
*
* 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 usefull 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 FEE_TYPES_H
#define FEE_TYPES_H

#ifdef __cplusplus
extern "C"{
#endif

#include "Std_Types.h"
#include "MemIf_Types.h"
#include "Fls.h"

/** @addtogroup G32A10xx_StdPeriphDriver
  @{
*/

/** @defgroup FEE_Driver
  * @brief FEE driver modules
  @{
*/

/** @defgroup FEE_Macros
  @{
*/
/**********************************************************************************************************************
                    VENDOR ID & AUTOSAR VERSION INFO
**********************************************************************************************************************/
/** Vendor ID (vendorId) of the dedicated implementation of this module according to the AUTOSAR vendor list. */
#define FEE_TYPES_H_VENDOR_ID                   0x00C1U
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */
#define FEE_TYPES_H_AR_RELEASE_MAJOR_VERSION    0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define FEE_TYPES_H_AR_RELEASE_MINOR_VERSION    0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define FEE_TYPES_H_AR_RELEASE_REVISION_VERSION 0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define FEE_TYPES_H_SW_MAJOR_VERSION            0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define FEE_TYPES_H_SW_MINOR_VERSION            0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define FEE_TYPES_H_SW_PATCH_VERSION            0x00U

/**@} end of group FEE_Macros */

/**********************************************************************************************************************
                    VERSION INFOMATION VERIFICATION
**********************************************************************************************************************/
#ifdef ENABLE_INTERMODULE_MCAL_CHECK
/* Make sure the AUTOSAR major version number is the same between Fee_Types.h and Std_Types.h */
#if (FEE_TYPES_H_AR_RELEASE_MAJOR_VERSION != STD_TYPES_H_AR_RELEASE_MAJOR_VERSION)
    #error "AUTOSAR Major Version Number mismatch between Fee_Types.h and Std_Types.h"
#endif
/* Make sure the AUTOSAR minor version number is the same between Fee_Types.h and Std_Types.h */
#if (FEE_TYPES_H_AR_RELEASE_MINOR_VERSION != STD_TYPES_H_AR_RELEASE_MINOR_VERSION)
    #error "AUTOSAR Minor Version Number mismatch between Fee_Types.h and Std_Types.h"
#endif
/* Make sure the AUTOSAR major version number is the same between Fee_Types.h and Fls.h */
#if (FEE_TYPES_H_AR_RELEASE_MAJOR_VERSION != FLS_H_AR_RELEASE_MAJOR_VERSION)
    #error "AUTOSAR Major Version Number mismatch between Fee_Types.h and Fls.h"
#endif
/* Make sure the AUTOSAR minor version number is the same between Fee_Types.h and Fls.h */
#if (FEE_TYPES_H_AR_RELEASE_MINOR_VERSION != FLS_H_AR_RELEASE_MINOR_VERSION)
    #error "AUTOSAR Minor Version Number mismatch between Fee_Types.h and Fls.h"
#endif
/* Make sure the AUTOSAR major version number is the same between Fee_Types.h and MemIf_Types.h */
#if (FEE_TYPES_H_AR_RELEASE_MAJOR_VERSION != MEMIF_TYPES_H_AR_RELEASE_MAJOR_VERSION)
    #error "AUTOSAR Major Version Number mismatch between Fee_Types.h and MemIf_Types.h"
#endif
/* Make sure the AUTOSAR minor version number is the same between Fee_Types.h and MemIf_Types.h */
#if (FEE_TYPES_H_AR_RELEASE_MINOR_VERSION != MEMIF_TYPES_H_AR_RELEASE_MINOR_VERSION)
    #error "AUTOSAR Minor Version Number mismatch between Fee_Types.h and MemIf_Types.h"
#endif
#endif

/**********************************************************************************************************************
                    ENUMERATION DEFINITION
**********************************************************************************************************************/
/** @defgroup FEE_Enumerations
  @{
*/

/**
 * @brief    Fee block project assignment type
 */
typedef enum
{
    FEE_PRJASGMT_SHR            = 0x01,     //!< block is used for share by all the projects
    FEE_PRJASGMT_APP            = 0x02,     //!< block is used for only the application project
    FEE_PRJASGMT_BTL            = 0x03,     //!< block is used for only the bootloader project
    FEE_PRJASGMT_RESERVED       = 0xFF      //!< this value is reserved
} Fee_BlkPrjAsgmtType;

/**@} end of group FEE_Enumerations */

/**********************************************************************************************************************
                    STRUCT DEFINITION
**********************************************************************************************************************/
/** @defgroup FEE_Structure
  @{
*/

/** FEE ECC callback function */
typedef P2FUNC(void, FEE_CODE, Fee_EccNotifyPtrType)(CONST(uint32, AUTOMATIC) Addr);

/**
 * @brief    the configuration structure type of Fee block
 */
typedef struct
{
    uint16              blkNum;   //!< Fee block number
    uint16              blkSize;  //!< Size of Fee block in bytes
    uint8               clrGrp;   //!< Index of cluster group which Fee block belongs to
    boolean             iDataFlg; //!< immediate data block support flag
    Fee_BlkPrjAsgmtType blkAsgmt; //!< specifies which project assignment uses this block
    Fee_EccNotifyPtrType eccCallback; //!< When an ECC interrupt occurs in the block, configure user notification.
} Fee_BlkCfgType;

/** The Fee Configuration type is a placeholder type that is not utilized, yet it is mandated by ASR 4.2.2. */
typedef Fee_BlkCfgType Fee_ConfigType;

/**
 * @brief    the configuration structure type of Fee cluster
 */
typedef struct
{
    Fls_AddressType srcAddr; //!< the start Address of Fee cluster
    Fls_LengthType  len;     //!< the length of Fee cluster
} Fee_ClrType;

/**
 * @brief the configuration structure type of Fee cluster group
 */
typedef struct
{
    CONSTP2CONST(Fee_ClrType, FEE_CONST, FEE_APPL_CONST) clrPtr; //!< Pointer to array of Fee cluster configurations
    uint32         clrCount;                                     //!< Number of clusters in cluster group
    Fls_LengthType rsvdSize; //!< Size of reserved area in the given cluster group (for immediate blocks)
} Fee_ClusterGroupType;

/**
 * @brief        the run-time Information of Fee cluster group
 */
typedef struct
{
    Fls_AddressType clusterTotalSize;        //!< Total size of the selected cluster group
    Fls_AddressType clusterFreeSize;         //!< Free size of the selected cluster group
    uint16          blockHeaderOverheadSize; //!< Block overhead size (header valid and inval flag)
    uint16          virtualPageSize;         //!< Fee virtual page size
    uint32          swapNumber;              //!< Number of cluster swap performed in the selected cluster group
} Fee_ClrGrpRTInfoType;

/**@} end of group FEE_Structure */

#ifdef __cplusplus
}
#endif

#endif

/**@} end of group FEE_Driver */
/**@} end of group G32A10xx_StdPeriphDriver */
