/*!
* @file     Fee.h
*
* @version  1.0.0
*
* @brief    AUTOSAR Module Fee Driver - Fee driver header 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_H
#define FEE_H

#ifdef __cplusplus
extern "C"{
#endif

#include "Fee_Cfg.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_H_VENDOR_ID                   0x00C1U
/** Module ID of this module, as defined in the BSW Module List. */
#define FEE_H_MODULE_ID                   0x0015U
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */
#define FEE_H_AR_RELEASE_MAJOR_VERSION    0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define FEE_H_AR_RELEASE_MINOR_VERSION    0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define FEE_H_AR_RELEASE_REVISION_VERSION 0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define FEE_H_SW_MAJOR_VERSION            0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define FEE_H_SW_MINOR_VERSION            0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define FEE_H_SW_PATCH_VERSION            0x00U

/**@} end of group FEE_Macros */

/**********************************************************************************************************************
                    VERSION INFOMATION VERIFICATION
**********************************************************************************************************************/
/* Make sure the vendor id is the same between Fee.h and Fee_Cfg.h */
#if (FEE_H_VENDOR_ID != FEE_CFG_H_VENDOR_ID)
  #error "Vendor id mismatch between Fee.h and Fee_Cfg.h"
#endif
/* Make sure the AUTOSAR major version number is the same between Fee.h and Fee_Cfg.h */
#if (FEE_H_AR_RELEASE_MAJOR_VERSION != FEE_CFG_H_AR_RELEASE_MAJOR_VERSION)
    #error "AUTOSAR Major Version Number mismatch between Fee.h and Fee_Cfg.h"
#endif
/* Make sure the AUTOSAR minor version number is the same between Fee.h and Fee_Cfg.h */
#if (FEE_H_AR_RELEASE_MINOR_VERSION != FEE_CFG_H_AR_RELEASE_MINOR_VERSION)
    #error "AUTOSAR minor Version Number mismatch between Fee.h and Fee_Cfg.h"
#endif
/* Make sure the AUTOSAR revision version number is the same between Fee.h and Fee_Cfg.h */
#if (FEE_H_AR_RELEASE_REVISION_VERSION != FEE_CFG_H_AR_RELEASE_REVISION_VERSION)
    #error "AUTOSAR revision Version Number mismatch between Fee.h and Fee_Cfg.h"
#endif
/* Make sure the software major version number is the same between Fee.h and Fee_Cfg.h */
#if (FEE_H_SW_MAJOR_VERSION != FEE_CFG_H_SW_MAJOR_VERSION)
    #error "Software Major Version Number mismatch between Fee.h and Fee_Cfg.h"
#endif
/* Make sure the software minor version number is the same between Fee.h and Fee_Cfg.h */
#if (FEE_H_SW_MINOR_VERSION != FEE_CFG_H_SW_MINOR_VERSION)
    #error "Software Minor Version Number mismatch between Fee.h and Fee_Cfg.h"
#endif
/* Make sure the software patch version number is the same between Fee.h and Fee_Cfg.h */
#if (FEE_H_SW_PATCH_VERSION != FEE_CFG_H_SW_PATCH_VERSION)
    #error "Software Patch Version Number mismatch between Fee.h and Fee_Cfg.h"
#endif

/***********************************************************************************************************************
                    MACRO DEFINETION 
***********************************************************************************************************************/
/** @defgroup FEE_Macros
  @{
*/

/** Development error codes */

/** API service called when module was not initialized */
#define FEE_E_UNINIT                      0x01U
/** API service called with invalid block number */
#define FEE_E_INVALID_BLOCK_NO            0x02U
/** API service called with invalid block offset */
#define FEE_E_INVALID_BLOCK_OFS           0x03U
/** API service called with invalid data pointer */
#define FEE_E_PARAM_POINTER               0x04U
/** API service called with invalid length information */
#define FEE_E_INVALID_BLOCK_LEN           0x05U
/** API service called while module is busy processing a user request */
#define FEE_E_BUSY                        0x06U
/** API service called while module is busy doing internal management operations */
#define FEE_E_BUSY_INTERNAL               0x07U
/** Fee_Cancel called while no job was pending */
#define FEE_E_INVALID_CANCEL              0x08U
/** Fee_Init failed. */
#define FEE_E_INIT_FAILED                 0x09U
/** API service called when underlying driver has cancel API disabled */
#define FEE_E_CANCEL_API_DISABLE          0x0AU
/** API service called with invalid cluster group index */
#define FEE_E_CLUSTER_GROUP_ID            0x0BU
/** number of foreign blocks exceeds the total number of blocks (FEE_MAX_NUMBER_OF_BLOCKS) */
#define FEE_E_FOREIGN_BLOCKS_OVERFLOW     0x0CU

/** The instance identification of AUTOSAR Eeprom module */
#define FEE_INSTANCE_ID                   0

/** API service IDs */
/** The API service id for Fee_Init() */
#define FEE_INIT_SRVID                    0x00U
/** The API service id for Fee_SetMode() */
#define FEE_SETMODE_SRVID                 0x01U
/** The API service id for Fee_Read() */
#define FEE_READ_SRVID                    0x02U
/** The API service id for Fee_Write() */
#define FEE_WRITE_SRVID                   0x03U
/** The API service id for Fee_Cancel() */
#define FEE_CANCEL_SRVID                  0x04U
/** The API service id for Fee_GetStatus() */
#define FEE_GETSTATUS_SRVID               0x05U
/** The API service id for Fee_GetJobResult() */
#define FEE_GETJOBRESULT_SRVID            0x06U
/** The API service id for Fee_InvalidateBlock() */
#define FEE_INVALIDATEBLOCK_SRVID         0x07U
/** The API service id for Fee_GetVersionInfo() */
#define FEE_GETVERSIONINFO_SRVID          0x08U
/** The API service id for Fee_EraseImmediateBlock() */
#define FEE_ERASEIMMEDIATEBLOCK_SRVID     0x09U
/** The API service id for Fee_JobEndNotification() */
#define FEE_JOBENDNOTIFICATION_SRVID      0x10U
/** The API service id for Fee_JobErrorNotification() */
#define FEE_JOBERRORNOTIFICATION_SRVID    0x11U
/** The API service id for Fee_MainFunction() */
#define FEE_MAINFUNCTION_SRVID            0x12U
/** The API service id for Fee_ForceSwapNextWrite() */
#define FEE_FORCESWAPNEXTWRITE_SRVID      0x13U
/** The API service id for Fee_GetClrGrpRunTimeInfo() */
#define FEE_GETCLRGRPRUNTIMEINFO_SRVID    0x14U

#define FLS_ABSOLUTE_BASE_ADDRESS         0x8000000U
#define FEE_RALATIVE_BASE_ADDRESS         0x40000U
#define BLOCK_SIZE_BYTE                   0x10U

/**@} end of group FEE_Macros */
/***********************************************************************************************************************
                    FUNCTION DECLARATION 
***********************************************************************************************************************/
#define FEE_START_SEC_CODE
#include "Fee_MemMap.h"

/** @defgroup FEE_Fuctions
  @{
*/

extern FUNC(void, FEE_CODE) Fee_Init(P2CONST(Fee_BlkCfgType, AUTOMATIC, FEE_APPL_CONST) ConfigPtr);

#if(STD_ON == FEE_SET_MODE_API_ENABLE)
extern FUNC(void, FEE_CODE) Fee_SetMode(VAR(MemIf_ModeType, AUTOMATIC) Mode);
#endif

extern FUNC(Std_ReturnType, FEE_CODE)
    Fee_Read(VAR(uint16, AUTOMATIC) BlockNumber, VAR(uint16, AUTOMATIC) BlockOffset,
             P2VAR(uint8, AUTOMATIC, FEE_APPL_DATA) DataBufferPtr, VAR(uint16, AUTOMATIC) Length);

extern FUNC(Std_ReturnType, FEE_CODE)
    Fee_Write(VAR(uint16, AUTOMATIC) BlockNumber, P2CONST(uint8, AUTOMATIC, FEE_APPL_CONST) DataBufferPtr);

extern FUNC(void, FEE_CODE) Fee_Cancel(void);

extern FUNC(MemIf_StatusType, FEE_CODE) Fee_GetStatus(void);

extern FUNC(MemIf_JobResultType, FEE_CODE) Fee_GetJobResult(void);

extern FUNC(Std_ReturnType, FEE_CODE) Fee_InvalidateBlock(VAR(uint16, AUTOMATIC) BlockNumber);

#if(STD_ON == FEE_GET_VERSION_INFO_API_ENABLE )
extern FUNC(void, FEE_CODE) Fee_GetVersionInfo(P2VAR(Std_VersionInfoType, AUTOMATIC, FEE_APPL_DATA) VersionInfoPtr);
#endif

extern FUNC(Std_ReturnType, FEE_CODE) Fee_EraseImmediateBlock(VAR(uint16, AUTOMATIC) BlockNumber);

extern FUNC(void, FEE_CODE) Fee_MainFunction(void);

extern FUNC(Std_ReturnType, FEE_CODE) Fee_ForceSwapNextWrite(VAR(uint8, AUTOMATIC) ClrGrpIndex);

extern FUNC(void, FEE_CODE)
    Fee_GetClrGrpRunTimeInfo(VAR(uint8, AUTOMATIC) ClrGrpIndex,
                             P2VAR(Fee_ClrGrpRTInfoType, AUTOMATIC, FEE_APPL_DATA) ClrGrpRTInfoPtr);
#if (STD_ON == FEE_ECC_ISR_ENABLE)
extern FUNC(void, FEE_CODE) Fee_EccCompletionNotificaiton(void);
#endif
/**@} end of group FEE_Fuctions */

#define FEE_STOP_SEC_CODE
#include "Fee_MemMap.h"

#ifdef __cplusplus
}
#endif

#endif

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