/*!
* @file     Wdg_PBcfg.c
*
* @version  1.0.0
*
* @brief    Code file of AUTOSAR Wdg parameter configuration(post-build)
*
* @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.
*/

#ifdef __cplusplus
extern "C"{
#endif

#include "Wdg.h"

#if (STD_ON == WDG_INSTANCE0)

/** @addtogroup G32A10xx_StdPeriphDriver
  @{
*/

/** @defgroup WDG_Driver
  * @brief WDG driver modules
  @{
*/

/** @defgroup WDG_Macros
  @{
*/
/*************************************************************************************************
*                              VENDOR ID & AUTOSAR VERSION RECORD INFO
*************************************************************************************************/
/** Vendor ID (vendorId) of the dedicated implementation of this module according to the AUTOSAR vendor list. */
#define WDG_PBCFG_VENDOR_ID                    0x00C1U
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */
#define WDG_PBCFG_AR_RELEASE_MAJOR_VERSION     0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define WDG_PBCFG_AR_RELEASE_MINOR_VERSION     0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define WDG_PBCFG_AR_RELEASE_REVISION_VERSION  0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define WDG_PBCFG_SW_MAJOR_VERSION             0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define WDG_PBCFG_SW_MINOR_VERSION             0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define WDG_PBCFG_SW_PATCH_VERSION             0x00U

/**@} end of group WDG_Macros */

/*************************************************************************************************
                                  VERSION INFOMATION VERIFICATION
*************************************************************************************************/
/* Make sure the vendor id is the same between Wdg_PBcfg.c and Wdg.h */
#if (WDG_PBCFG_VENDOR_ID != WDG_H_VENDOR_ID)
    #error "Vendor id mismatch between Wdg_PBcfg.c and Wdg.h."
#endif
/* Make sure the AUTOSAR major version number is the same between Wdg_PBcfg.c and Wdg.h */
#if (WDG_PBCFG_AR_RELEASE_MAJOR_VERSION != WDG_H_AR_RELEASE_MAJOR_VERSION) 
    #error "AUTOSAR Major Version Number mismatch between Wdg_PBcfg.c and Wdg.h."
#endif
/* Make sure the AUTOSAR minor version number is the same between Wdg_PBcfg.c and Wdg.h */
#if (WDG_PBCFG_AR_RELEASE_MINOR_VERSION != WDG_H_AR_RELEASE_MINOR_VERSION) 
    #error "AUTOSAR Minor Version Number mismatch between Wdg_PBcfg.c and Wdg.h."
#endif
/* Make sure the AUTOSAR revision version number is the same between Wdg_PBcfg.c and Wdg.h */
#if (WDG_PBCFG_AR_RELEASE_REVISION_VERSION != WDG_H_AR_RELEASE_REVISION_VERSION)
    #error "AUTOSAR Revision Version Number mismatch between Wdg_PBcfg.c and Wdg.h."
#endif
/* Make sure the software major version number is the same between Wdg_PBcfg.c and Wdg.h */
#if (WDG_PBCFG_SW_MAJOR_VERSION != WDG_H_SW_MAJOR_VERSION)
    #error "Software Major Version Number mismatch between Wdg_PBcfg.c and Wdg.h."
#endif
/* Make sure the software minor version number is the same between Wdg_PBcfg.c and Wdg.h */
#if (WDG_PBCFG_SW_MINOR_VERSION != WDG_H_SW_MINOR_VERSION) 
    #error "Software Minor Version Number mismatch between Wdg_PBcfg.c and Wdg.h."
#endif
/* Make sure the software patch version number is the same between Wdg_PBcfg.c and Wdg.h */
#if (WDG_PBCFG_SW_PATCH_VERSION != WDG_H_SW_PATCH_VERSION)
    #error "Software Patch Version Number mismatch between Wdg_PBcfg.c and Wdg.h."
#endif

/*************************************************************************************************
                                        CONSTANT DEFINITION
*************************************************************************************************/
#define WDG_START_SEC_CONFIG_DATA_UNSPECIFIED
#include "Wdg_MemMap.h"

/** @defgroup WDG_Variable
  @{
*/

/** Hardware dependent settings for the watchdog driver's "fast" mode. */
static CONST(Wdg_ModeParamterType, WDG_CONST) Wdg_WdgSettingsFast_0 =
{
    (boolean)TRUE, //!<Reconfigurate capability
    (boolean)FALSE, //!< Window mode
    (Wdg_DivType)WDG_DIV_16, //!< Watchdog clock prescaler
    (uint32)0x7FF, //!< Timeout Value
    (uint32)0 //!< Window Value
#if (STD_ON == WDG_USE_GPT)
    ,
    (uint32)33 //!< Wdg clock frequency(for process calculation)
#endif
};

/** Hardware dependent settings for the watchdog driver's "slow" mode. */
static CONST(Wdg_ModeParamterType, WDG_CONST) Wdg_WdgSettingsSlow_0 =
{
    (boolean)TRUE, //!<Reconfigurate capability
    (boolean)FALSE, //!< Window mode
    (Wdg_DivType)WDG_DIV_16, //!< Watchdog clock prescaler
    (uint32)0xFFF, //!< Timeout Value
    (uint32)0 //!< Window Value
#if (STD_ON == WDG_USE_GPT)
    ,
    (uint32)33 //!< Wdg clock frequency(for process calculation)
#endif
};

/** Wdg configuration */
CONST(Wdg_ConfigType, WDG_CONST) g_wdgConfig =
{
    WDGIF_SLOW_MODE, //!< WDT hardware module
    Wdg_Instance0, //!< WDT hardware instance id
#if (STD_ON == WDG_USE_GPT)
    (Gpt_ChannelType)Gpt_ConfigRef_GptChannelConfiguration_0, //!< Gpt channel configuration
    (uint32)62, //!< External trigger source clock
#endif
    {
        &Wdg_WdgSettingsSlow_0, //!< slow mode Settings parameter
        &Wdg_WdgSettingsFast_0 //!< fast mode Settings parameter
    }
};

/**@} end of group WDG_Variable */

#define WDG_STOP_SEC_CONFIG_DATA_UNSPECIFIED
#include "Wdg_MemMap.h"

#endif

/**************************************************************************************************
                                        CONSTANT DEFINITION
**************************************************************************************************/
#define WDG_START_SEC_CONST_8
#include "Wdg_MemMap.h"

/** @defgroup WDG_Variable
  @{
*/

/** Wdg instance index information */
CONST(uint8, WDG_CONST) g_wdgIndex[WDG_INSTANCES_SUPPORT_NUMBER] =
{
    WDG_INDEX
};

/**@} end of group WDG_Variable */

#define WDG_STOP_SEC_CONST_8
#include "Wdg_MemMap.h"

#define WDG_START_SEC_CONST_UNSPECIFIED
#include "Wdg_MemMap.h"

/** @defgroup WDG_Variable
  @{
*/

/** Reference to the DemEventParameter which shall be issued when the error 
    "Setting a watchdog mode failed(during initialization or mode switch)" has occurred. */

CONST(Mcal_DemErrorType, WDG_CONST) g_wdgEModeFailed =
{
    (uint32)STD_ON,
    (uint16)DemConfigSet_DemEventParameter_1
};

/** Reference to the DemEventParameter which shall be issued when the error 
    "timeout for reconfigurate" has occurred. */
CONST(Mcal_DemErrorType, WDG_CONST) g_wdgETimeout =
{
    (uint32)STD_ON,
    (uint16)DemConfigSet_DemEventParameter_2
};

/**@} end of group WDG_Variable */

#define WDG_STOP_SEC_CONST_UNSPECIFIED
#include "Wdg_MemMap.h"

#ifdef __cplusplus
}
#endif

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