/*!
* @file     CDD_Irme.h
*
* @version  1.0.0
*
* @brief    The header of IRME moudle API
*
* @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 CDD_IRME_H
#define CDD_IRME_H

#ifdef __cplusplus
extern "C"{
#endif

#include "CDD_Irme_Cfg.h"

/** @addtogroup G32A10xx_StdPeriphDriver
  @{
*/

/** @defgroup IRME_Driver
  * @brief IRME driver modules
  @{
*/

/** @defgroup IRME_Macros
  @{
*/
/***********************************************************************************************************************
                                    VENDOR ID & AUTOSAR VERSION INFO
***********************************************************************************************************************/
/** Vendor ID (vendorId) of the dedicated implementation of this module according to the AUTOSAR vendor list. */
#define CDD_IRME_H_VENDOR_ID                       0x00C1U
/** Module ID of this module, as defined in the BSW Module List. */
#define CDD_IRME_H_MODULE_ID                       0x0000U
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CDD_IRME_H_AR_RELEASE_MAJOR_VERSION        0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CDD_IRME_H_AR_RELEASE_MINOR_VERSION        0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CDD_IRME_H_AR_RELEASE_REVISION_VERSION     0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CDD_IRME_H_SW_MAJOR_VERSION                0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CDD_IRME_H_SW_MINOR_VERSION                0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CDD_IRME_H_SW_PATCH_VERSION                0x00U

/**@} end of group IRME_Macros */

/***********************************************************************************************************
                                  VERSION INFOMATION VERIFICATION
*************************************************************************************************************/
/* Make sure the vendor ids are the same between CDD_Irme.h and CDD_Irme_Cfg.h */
#if (CDD_IRME_H_VENDOR_ID != CDD_IRME_CFG_H_VENDOR_ID)
    #error "Vendor ids mismatch between CDD_Irme.h and CDD_Irme_Cfg.h"
#endif
/* Make sure the AUTOSAR major version number is the same between CDD_Irme.h and CDD_Irme_Cfg.h */
#if (CDD_IRME_H_AR_RELEASE_MAJOR_VERSION    != CDD_IRME_CFG_H_AR_RELEASE_MAJOR_VERSION)
    #error "AUTOSAR Major Version Number mismatch between CDD_Irme.h and CDD_Irme_Cfg.h"
#endif
/* Make sure the AUTOSAR minor version number is the same between CDD_Irme.h and CDD_Irme_Cfg.h */
#if (CDD_IRME_H_AR_RELEASE_MINOR_VERSION    != CDD_IRME_CFG_H_AR_RELEASE_MINOR_VERSION)
    #error "AUTOSAR Minor Version Number mismatch between CDD_Irme.h and CDD_Irme_Cfg.h"
#endif
/* Make sure the AUTOSAR revision version number is the same between CDD_Irme.h and CDD_Irme_Cfg.h */
#if (CDD_IRME_H_AR_RELEASE_REVISION_VERSION != CDD_IRME_CFG_H_AR_RELEASE_REVISION_VERSION)
    #error "AUTOSAR Revision Version Number mismatch between CDD_Irme.h and CDD_Irme_Cfg.h"
#endif
/* Make sure the software major version number is the same between CDD_Irme.h and CDD_Irme_Cfg.h */
#if (CDD_IRME_H_SW_MAJOR_VERSION != CDD_IRME_CFG_H_SW_MAJOR_VERSION)
    #error "Software Major Version Number mismatch between CDD_Irme.h and CDD_Irme_Cfg.h"
#endif
/* Make sure the software minor version number is the same between CDD_Irme.h and CDD_Irme_Cfg.h */
#if (CDD_IRME_H_SW_MINOR_VERSION != CDD_IRME_CFG_H_SW_MINOR_VERSION)
    #error "Software Minor Version Number mismatch between CDD_Irme.h and CDD_Irme_Cfg.h"
#endif
/* Make sure the software patch version number is the same between CDD_Irme.h and CDD_Irme_Cfg.h */
#if (CDD_IRME_H_SW_PATCH_VERSION != CDD_IRME_CFG_H_SW_PATCH_VERSION)
    #error "Software Patch Version Number mismatch between CDD_Irme.h and CDD_Irme_Cfg.h"
#endif

/***********************************************************************************************************
                                            MACRO DEFINITION
************************************************************************************************************/
/** @defgroup IRME_Macros
  @{
*/

/** The instance id of the IRME moudle. */
#define CDD_IRME_INSTANCE_ID                     (0U)

/** The function is idle and can be called */
#define IRME_API_IDLE_STATE                      ((Irme_ApiStateType)0)
/** The function is busy and can not be called again until it is idle  */
#define IRME_API_BUSY_STATE                      ((Irme_ApiStateType)1)

/** The IRME module has not been initialized */
#define IRME_STATE_UNINIT                        ((Irme_StateType)0)
/** The IRME module has been initialized without soft-lock */
#define IRME_STATE_INITIALIZED                   ((Irme_StateType)1)
/** The IRME module has been initialized with soft-lock */
#define IRME_STATE_LOCKED                        ((Irme_StateType)2)

/**@} end of group IRME_Macros */

/**********************************************************************************************************************
                                             OTHER TYPE DEFINITION
***********************************************************************************************************************/
/** @defgroup IRME_Enumerations
  @{
*/

/**
 * @brief    Defines Irme module development errors.
 */
typedef enum
{
  CDD_IRME_E_UNINIT               = 2,  //!<The function is called before driver is initialized
  CDD_IRME_E_PARAM_SET            = 4,  //!<The function Irme_Init is called with an invalid parameter
  CDD_IRME_E_PARAM_VERSION_INFO   = 8,  //!<The function Irme_GetVersionInfo is called with an invalid parameter
  CDD_IRME_E_PARAM_FAULT          = 16,  //!<The function is called with an invalid parameter
  CDD_IRME_E_CONFIG_LOCK          = 17,  //!<The function is called when the IRME driver is locked
  CDD_IRME_E_REENTRANT            = 18,  //!<The function is called when the same non-reentrant function is running
  CDD_IRME_E_PROHIBIT_RUN         = 20   //!<The function is called when the driver does not permit the function to run
}Irme_ErrorIdType;

/**
 * @brief    Defines Irme module function service ids.
 */
typedef enum
{
  SID_IRME_INIT                   = 0U,  //!<The service ID of the API Irme_Init function
  SID_IRME_INJECT_FAULT           = 0x01U,  //!<The service ID of the API Irme_InjectFaults function
  SID_IRME_ACQUIRE_ERRORS         = 0x02U,  //!<The service ID of the API Irme_AcquireErrors function
  SID_IRME_CLEAR_FAULTS           = 0x03U,  //!<The service ID of the API Irme_ClearFaults function
  SID_IRME_GET_VERSION_INFO       = 0x05U  //!<The service ID of the API Irme_GetVersionInfo function
}Irme_ServiceIdType;

/**@} end of group IRME_Enumerations */

/***********************************************************************************************************
                                        FUNCTION DECLARATION
************************************************************************************************************/
#define  IRME_START_SEC_CODE
#include "Irme_MemMap.h"

/** @defgroup IRME_Fuctions
  @{
*/

#if(STD_ON == IRME_VERSION_INFO_API_ENABLE)
FUNC(void, IRME_CODE) Irme_GetVersionInfo(P2VAR(Std_VersionInfoType,AUTOMATIC,IRME_APPL_DATA) VersionInfoPtr);
#endif

FUNC(Std_ReturnType, IRME_CODE) Irme_Init(P2CONST(Irme_ConfigType, AUTOMATIC, IRME_APPL_CONST) ConfigPtr);

FUNC(void, IRME_CODE) Irme_InjectFaults(VAR(Irme_InjectBitErrType, AUTOMATIC) InjectBitErr);

FUNC(Std_ReturnType, IRME_CODE)  Irme_FaultPending(P2CONST(Irme_FaultPoolType, AUTOMATIC, IRME_APPL_DATA) ErrorPtr,
                                                     VAR(Irme_FaultIdType, AUTOMATIC) FaultId);

FUNC(Std_ReturnType, IRME_CODE) Irme_AcquireErrors(P2VAR(Irme_FaultPoolType, AUTOMATIC, IRME_APPL_DATA) FaultPoolPtr);

FUNC(Std_ReturnType, IRME_CODE) Irme_ClearFaults(void);

FUNC(uint32, IRME_CODE) Irme_GetErrorAddr(void);

/**@} end of group IRME_Fuctions */

#define IRME_STOP_SEC_CODE
#include "Irme_MemMap.h"

#ifdef __cplusplus
}
#endif

#endif

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