/*!
* @file     Rtc_PBcfg.c
*
* @version  1.0.0
*
* @brief    This source file includes the configuration parameters of the Ocu module.
*           
* @attention
*
* Project Name      : AUTOSAR MCAL
*
* Platform          : Arm
*
* Autosar Standard  : Classic Platform 4.4.0
*
* Compiled Version  : G32A10xx_MCAL_1_0_0_15-Nov-25
*
* Copyright (C) 2025 Geehy Semiconductor
*
* You may not use this file except in compliance with the
* GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
*
* 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 SOFTWARE PACKAGE LICENSE for the governing permissions
* and limitations under the License.
*/

#ifdef __cplusplus
extern "C" {
#endif  /* ifdef __cplusplus */

#include "CDD_Rtc.h"
#include "Pdl_TmrReg.h"
#include "Rtc_Types.h"
/** @addtogroup G32A10xx_StdPeriphDriver
  @{
*/

/** @defgroup RTC_Driver
  * @brief RTC driver modules
  @{
*/

/** @defgroup RTC_Macros
  @{
*/
/**********************************************************************************************************************
                                    VENDOR ID & AUTOSAR VERSION INFO
***********************************************************************************************************************/
/** Vendor ID (vendorId) of the dedicated implementation of this module according to the AUTOSAR vendor list. */
#define RTC_PBCFG_VENDOR_ID                        0x00C1U
/** Module ID of this module, as defined in the BSW Module List. */
#define RTC_PBCFG_MODULE_ID                        0x007DU
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */
#define RTC_PBCFG_AR_RELEASE_MAJOR_VERSION         0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define RTC_PBCFG_AR_RELEASE_MINOR_VERSION         0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define RTC_PBCFG_AR_RELEASE_REVISION_VERSION      0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define RTC_PBCFG_SW_MAJOR_VERSION                 0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define RTC_PBCFG_SW_MINOR_VERSION                 0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define RTC_PBCFG_SW_PATCH_VERSION                 0x00U

/**********************************************************************************************************************           
                                      VERSION INFOMATION VERIFICATION
***********************************************************************************************************************/
#ifdef ENABLE_INTERMODULE_MCAL_CHECK
    /* Make sure the AUTOSAR major version number is the same between Ocu_PBcfg.c and Tmr_Registers.h */
    #if (RTC_PBCFG_AR_RELEASE_MAJOR_VERSION != TMR_REG_H_AR_RELEASE_MAJOR_VERSION)
    #error "AUTOSAR Major Version Number mismatch between Ocu_PBcfg.c and Tmr_Registers.h"
    #endif
    /* Make sure the AUTOSAR minor version number is the same between Ocu_PBcfg.c and Tmr_Registers.h */
    #if (RTC_PBCFG_AR_RELEASE_MINOR_VERSION != TMR_REG_H_AR_RELEASE_MINOR_VERSION)
    #error "AUTOSAR Minor Version Number mismatch between Ocu_PBcfg.c and Tmr_Registers.h"
    #endif
#endif  /* ifdef ENABLE_INTERMODULE_MCAL_CHECK */

#if (RTC_PBCFG_VENDOR_ID != RTC_H_VENDOR_ID)
    #error "Vendor ids mismatch between Ocu_PBcfg.c and Ocu.h"
#endif  /* {if (RTC_PBCFG_VENDOR_ID != RTC_H_VENDOR_ID)} */

/* Make sure the AUTOSAR major version number is the same between Ocu_PBcfg.c and Ocu.h */
#if (RTC_PBCFG_AR_RELEASE_MAJOR_VERSION != RTC_H_AR_RELEASE_MAJOR_VERSION)
#error "AUTOSAR Major Version Number mismatch between Ocu_PBcfg.c and Ocu.h"
#endif
/* Make sure the AUTOSAR minor version number is the same between Ocu_PBcfg.c and Ocu.h */
#if (RTC_PBCFG_AR_RELEASE_MINOR_VERSION != RTC_H_AR_RELEASE_MINOR_VERSION)
#error "AUTOSAR Minor Version Number mismatch between Ocu_PBcfg.c and Ocu.h"
#endif
/* Make sure the AUTOSAR revision version number is the same between Ocu_PBcfg.c and Ocu.h */
#if (RTC_PBCFG_AR_RELEASE_REVISION_VERSION != RTC_H_AR_RELEASE_REVISION_VERSION)
#error "AUTOSAR Revision Version Number mismatch between Ocu_PBcfg.c and Ocu.h"
#endif

/* Make sure the software major version number is the same between Ocu_PBcfg.c and Ocu.h */
#if (RTC_PBCFG_SW_MAJOR_VERSION != RTC_H_SW_MAJOR_VERSION)
#error "Software Major Version Number mismatch between Ocu_PBcfg.c and Ocu.h"
#endif
/* Make sure the software minor version number is the same between Ocu_PBcfg.c and Ocu.h */
#if (RTC_PBCFG_SW_MINOR_VERSION != RTC_H_SW_MINOR_VERSION)
#error "Software Minor Version Number mismatch between Ocu_PBcfg.c and Ocu.h"
#endif
/* Make sure the software patch version number is the same between Ocu_PBcfg.c and Ocu.h */
#if (RTC_PBCFG_SW_PATCH_VERSION != RTC_H_SW_PATCH_VERSION)
#error "Software Patch Version Number mismatch between Ocu_PBcfg.c and Ocu.h"
#endif

/**********************************************************************************************************************
                                            MACRO DEFINITION
***********************************************************************************************************************/
#define OCU_TMR_CONFIG_MODULES_COUNT         4
#define OCU_TMR_CONFIG_CHANNELS_COUNT        16
#define OCU_CONFIG_CHANNELS_COUNT            16
/**@} end of group RTC_Macros */
/**********************************************************************************************************************
                                             GLOBAL VARIABLE
***********************************************************************************************************************/
/** @defgroup RTC_Variable
  @{
*/
/** Configure the initial RTC settings, time format, and 1Hz clock for timing. 
    Generate a 1Hz clock used for the date function:
    RTCCLK source :Mcu_PBcfg.c->g_mcuClockConfig->set rtcCfg,current is RCM_RTCCLK_HSE_DIV_32(16MHz/32)
    AsynchPrediv is config for RTC_PSC(APSC) ,This value should be as large as possible, with a maximum configurable value of 0x7f.
    SynchPrediv is config for RTC_PSC(SPSC) , Maximum configurable value of 0x7fff.
    16MHz/(APSC+1)/(SPSC+1) = 1Hz */
static VAR(Rtc_TimeInitType, AUTOMATIC) Rtc_TimeInitCfg = 
{
    .format = RTC_HourFormat_24,
    .AsynchPrediv =  0x7d,
    .SynchPrediv = 0xf9f
};

/** Initial the RTC Alarm A Register. */
static VAR(Rtc_TimeType, AUTOMATIC) Rtc_TimeCfg =
{
    .H12 = (uint8_t)RTC_H12_AM,
    .hours = 0,
    .minutes = 0,
    .seconds = 0,
};

/** Configure the RTC Alarm data */
static VAR(Rtc_AlarmType, AUTOMATIC) Rtc_AlarmCfg = 
{
    .time.hours = 0,
    .time.minutes = 0,
    .time.seconds = 5,
    .time.H12 = (uint8_t)RTC_H12_AM,
    .AlarmMask = 0x80808000U,
    .AlarmDateWeekDaySel = RTC_WEEKDAY_SEL_DATE,
    .AlarmDateWeekDay = 1,
};

/** Configure the RTC module , used for module init */
CONST(Rtc_ConfigType, RTC_CONST) g_rtcConfig =
{
    &Rtc_TimeInitCfg,
    &Rtc_TimeCfg,
    &Rtc_AlarmCfg
};
/**@} end of group RTC_Variable */
#ifdef __cplusplus
}
#endif  /* ifdef __cplusplus */

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