/*!
* @file     Dem.h
*
* @version  1.0.0
*
* @brief    The header of the dem driver
*
* @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.
*/

/*
* MISRA-C:2012 compliance checks
*
*     Dem_h_MISRA_REF1
*         Breaks the required Dir-1.1-C90 of MISRA 2012 guidelines,
*         Any implementation-defined behaviour on which the output of the program depends shall be documented and understood.
*/

#ifndef DEM_H
#define DEM_H

/*** @warning Dem_h_MISRA_REF1 [L] More than 8 levels of nested conditional inclusion - program does not conform strictly to ISO:C90. */
#ifdef __cplusplus
extern "C"{
#endif

#include "Dem_IntErrId.h"
#include "Dem_Types.h"

/** @addtogroup G32A10xx_StdPeriphDriver
  @{
*/

/** @defgroup DEM_Driver
  * @brief DEM driver modules
  @{
*/

/** @defgroup DEM_Macros
  @{
*/
/***********************************************************************************************************************
                                    VENDOR ID & AUTOSAR VERSION INFO
***********************************************************************************************************************/
/** Vendor ID (vendorId) of the dedicated implementation of this module according to the AUTOSAR vendor list. */
#define DEM_H_VENDOR_ID                        0x00C1U
/** Module ID of this module, as defined in the BSW Module List. */
#define DEM_H_MODULE_ID                        0x0036U
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */
#define DEM_H_AR_RELEASE_MAJOR_VERSION         0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define DEM_H_AR_RELEASE_MINOR_VERSION         0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define DEM_H_AR_RELEASE_REVISION_VERSION      0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define DEM_H_SW_MAJOR_VERSION                 0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define DEM_H_SW_MINOR_VERSION                 0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define DEM_H_SW_PATCH_VERSION                 0x00U

/**@} end of group DEM_Macros */

/**********************************************************************************************************************
                                  VERSION INFOMATION VERIFICATION
***********************************************************************************************************************/
/* Make sure the vendor id is the same between Dem.h and Dem_Types.h */
/*** @warning Dem_h_MISRA_REF1 [L] More than 8 levels of nested conditional inclusion - program does not conform strictly to ISO:C90. */
#if (DEM_H_VENDOR_ID != DEM_TYPES_H_VENDOR_ID)
    #error "Vendor id mismatch between Dem.h and Dem_Types.h"
#endif
/* Make sure the AUTOSAR major version number is the same between Dem.h and Dem_Types.h */
/*** @warning Dem_h_MISRA_REF1 [L] More than 8 levels of nested conditional inclusion - program does not conform strictly to ISO:C90. */
#if (DEM_H_AR_RELEASE_MAJOR_VERSION != DEM_TYPES_H_AR_RELEASE_MAJOR_VERSION)
    #error "AUTOSAR Major Version Number mismatch between Dem.h and Dem_Types.h"
#endif
/* Make sure the AUTOSAR minor version number is the same between Dem.h and Dem_Types.h */
/*** @warning Dem_h_MISRA_REF1 [L] More than 8 levels of nested conditional inclusion - program does not conform strictly to ISO:C90. */
#if (DEM_H_AR_RELEASE_MINOR_VERSION != DEM_TYPES_H_AR_RELEASE_MINOR_VERSION)
    #error "AUTOSAR Minor Version Number mismatch between Dem.h and Dem_Types.h"
#endif
/* Make sure the AUTOSAR revision version number is the same between Dem.h and Dem_Types.h */
/*** @warning Dem_h_MISRA_REF1 [L] More than 8 levels of nested conditional inclusion - program does not conform strictly to ISO:C90. */
#if (DEM_H_AR_RELEASE_REVISION_VERSION != DEM_TYPES_H_AR_RELEASE_REVISION_VERSION)
    #error "AUTOSAR Revision Version Number mismatch between Dem.h and Dem_Types.h"
#endif
/* Make sure the software major version number is the same between Dem.h and Dem_Types.h */
/*** @warning Dem_h_MISRA_REF1 [L] More than 8 levels of nested conditional inclusion - program does not conform strictly to ISO:C90. */
#if (DEM_H_SW_MAJOR_VERSION != DEM_TYPES_H_SW_MAJOR_VERSION)
    #error "Software Major Version Number mismatch between Dem.h and Dem_Types.h"
#endif
/* Make sure the software minor version number is the same between Dem.h and Dem_Types.h */
/*** @warning Dem_h_MISRA_REF1 [L] More than 8 levels of nested conditional inclusion - program does not conform strictly to ISO:C90. */
#if (DEM_H_SW_MINOR_VERSION != DEM_TYPES_H_SW_MINOR_VERSION)
    #error "Software Minor Version Number mismatch between Dem.h and Dem_Types.h"
#endif
/* Make sure the software patch version number is the same between Dem.h and Dem_Types.h */
/*** @warning Dem_h_MISRA_REF1 [L] More than 8 levels of nested conditional inclusion - program does not conform strictly to ISO:C90. */
#if(DEM_H_SW_PATCH_VERSION != DEM_TYPES_H_SW_PATCH_VERSION)
    #error "Software Patch Version Number mismatch between Dem.h and Dem_Types.h"
#endif

/* Make sure the vendor id is the same between Dem.h and Dem_IntErrId.h */
/*** @warning Dem_h_MISRA_REF1 [L] More than 8 levels of nested conditional inclusion - program does not conform strictly to ISO:C90. */
#if (DEM_H_VENDOR_ID != DEM_EVENTID_H_VENDOR_ID)
    #error "Vendor id mismatch between Dem.h and Dem_IntErrId.h"
#endif
/* Make sure the AUTOSAR major version number is the same between Dem.h and Dem_IntErrId.h */
/*** @warning Dem_h_MISRA_REF1 [L] More than 8 levels of nested conditional inclusion - program does not conform strictly to ISO:C90. */
#if (DEM_H_AR_RELEASE_MAJOR_VERSION != DEM_EVENTID_H_AR_RELEASE_MAJOR_VERSION)
    #error "AUTOSAR Major Version Number mismatch between Dem.h and Dem_IntErrId.h"
#endif
/* Make sure the AUTOSAR minor version number is the same between Dem.h and Dem_IntErrId.h */
/*** @warning Dem_h_MISRA_REF1 [L] More than 8 levels of nested conditional inclusion - program does not conform strictly to ISO:C90. */
#if (DEM_H_AR_RELEASE_MINOR_VERSION != DEM_EVENTID_H_AR_RELEASE_MINOR_VERSION)
    #error "AUTOSAR Minor Version Number mismatch between Dem.h and Dem_IntErrId.h"
#endif
/* Make sure the AUTOSAR revision version number is the same between Dem.h and Dem_IntErrId.h */
/*** @warning Dem_h_MISRA_REF1 [L] More than 8 levels of nested conditional inclusion - program does not conform strictly to ISO:C90. */
#if (DEM_H_AR_RELEASE_REVISION_VERSION != DEM_EVENTID_H_AR_RELEASE_REVISION_VERSION)
    #error "AUTOSAR Revision Version Number mismatch between Dem.h and Dem_IntErrId.h"
#endif
/* Make sure the software major version number is the same between Dem.h and Dem_IntErrId.h */
/*** @warning Dem_h_MISRA_REF1 [L] More than 8 levels of nested conditional inclusion - program does not conform strictly to ISO:C90. */
#if (DEM_H_SW_MAJOR_VERSION != DEM_EVENTID_H_SW_MAJOR_VERSION)
    #error "Software Major Version Number mismatch between Dem.h and Dem_IntErrId.h"
#endif
/* Make sure the software minor version number is the same between Dem.h and Dem_IntErrId.h */
/*** @warning Dem_h_MISRA_REF1 [L] More than 8 levels of nested conditional inclusion - program does not conform strictly to ISO:C90. */
#if (DEM_H_SW_MINOR_VERSION != DEM_EVENTID_H_SW_MINOR_VERSION)
    #error "Software Minor Version Number mismatch between Dem.h and Dem_IntErrId.h"
#endif
/* Make sure the software patch version number is the same between Dem.h and Dem_IntErrId.h */
/*** @warning Dem_h_MISRA_REF1 [L] More than 8 levels of nested conditional inclusion - program does not conform strictly to ISO:C90. */
#if (DEM_H_SW_PATCH_VERSION != DEM_EVENTID_H_SW_PATCH_VERSION)
    #error "Software Patch Version Number mismatch between Dem.h and Dem_IntErrId.h"
#endif

/**********************************************************************************************************************
                                            MACRO DEFINITION
***********************************************************************************************************************/
/** @defgroup DEM_Macros
  @{
*/

#define DEM_MAX_EXTEND_DATA_LEN    ((uint8) 100U)

#define DEM_MAX_EVENTS_NUM         ((uint32)256)

/**@} end of group DEM_Macros */

/**********************************************************************************************************************
                                             GLOBAL VARIABLE
***********************************************************************************************************************/
/** @defgroup DEM_Variable
  @{
*/

extern VAR(uint8, DEM_VAR) g_demOverflowEvent;
extern VAR(Dem_EventStatusType, DEM_VAR) g_demExtendData[DEM_MAX_EXTEND_DATA_LEN];
extern VAR(Dem_EventIdType, DEM_VAR) g_demEventId[DEM_MAX_EVENTS_NUM];
extern VAR(Dem_EventStatusType, DEM_VAR) g_demEventStatus[DEM_MAX_EVENTS_NUM];
extern VAR(uint32, DEM_VAR) g_demEventErrNum;

/**@} end of group DEM_Variable */

/**********************************************************************************************************************
                                              FUNCTION DECLARATION
***********************************************************************************************************************/
/** @defgroup DEM_Fuctions
  @{
*/

FUNC(Std_ReturnType, DEM_CODE) Dem_RepErrStatusPreExtData(VAR(Dem_EventIdType, AUTOMATIC) EventIdRaw,
                                                          VAR(Dem_EventStatusType, AUTOMATIC) EventStatusRaw,
                                                          CONSTP2CONST(uint8, DEM_CONST, DEM_APPL_CONST) PreExtDataPtr,
                                                          VAR(uint8, AUTOMATIC) PreExtDataLen);

FUNC(Std_ReturnType, DEM_CODE) Dem_SetEventStatus(VAR(Dem_EventIdType, AUTOMATIC) EventId,
                                                  VAR(Dem_EventStatusType, AUTOMATIC) EventStatus);

/**@} end of group DEM_Fuctions */

/*** @warning Dem_h_MISRA_REF1 [L] More than 8 levels of nested conditional inclusion - program does not conform strictly to ISO:C90. */
#ifdef __cplusplus
}
#endif

#endif

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