/*!
* @file     Rtc_Types.h
*
* @version  1.0.0
*
* @brief    This file contains all the functions prototypes for the RTC firmware library.
*            
* @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) 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 RTC_TYPES_H
#define RTC_TYPES_H

#ifdef __cplusplus
extern "C" {
#endif

#include "Mcal.h"
#include "StdRegMacros.h"
/** @addtogroup G32A10xx_StdPeriphDriver
  @{
*/

/** @defgroup RTC_Driver
  * @brief RTC driver modules
  @{
*/
/**************************************************************************
                      ENUMERATION  DEFINITION
**************************************************************************/
/** @defgroup RTC_Enumerations
  @{
*/
typedef enum
{
    RTC_FORMAT_BIN,  //!< Format in BIN */
    RTC_FORMAT_BCD   //!< Format in BCD */
} Rtc_FormatType;

/**
 * @brief RTC_AM_PM
 */
typedef enum
{
    RTC_H12_AM,  //!< Set RTC time to AM */
    RTC_H12_PM   //!< Set RTC time to PM */
} Rtc_H12Type;

/**
 * @brief RTC DayLightSaving
 */
typedef enum
{
    RTC_DLS_SUB1H,  //!< Winter time change */
    RTC_DLS_ADD1H   //!< Summer time change */
} Rtc_DayLightSavingType;

/**
 * @brief RTC DayLightSaving
 */
typedef enum
{
    RTC_SO_RESET = FALSE,   //!< Reset backup value */
    RTC_SO_SET   = TRUE     //!< Set backup value */
} Rtc_StoreOperationType;

/**
 * @brief RTC Output selection
 */
typedef enum
{
    RTC_OPSEL_DISABLE = 0x00,  //!< output disable */
    RTC_OPSEL_ALARMA  = 0x01,  //!< alarma output enable */
    RTC_OPSEL_WAKEUP  = 0x03   //!< wake up enable */
} Rtc_OpselType;

/**
 * @brief RTC Output Polarity
 */
typedef enum
{
    RTC_OPP_HIGH,  //!< output polarity is high */
    RTC_OPP_LOW    //!< output polarity is low */
} Rtc_OppType;

/**
 * @brief RTC Calib Output selection
 */
typedef enum
{
    RTC_CALIBOUTPUT_512Hz,  //!< calib output is 512Hz */
    RTC_CALIBOUTPUT_1Hz     //!< calib output is 1Hz */
} Rtc_CalibOutputType;

/**
 * @brief RTC Smooth calib period
 */
typedef enum
{
    RTC_SCP_16SEC,   //!<The smooth calibration periode is 16 */
    RTC_SCP_8SEC     //!<The smooth calibration periode is 8 */
} Rtc_ScpType;

/**
 * @brief RTC Smooth calib period
 */
typedef enum
{
    RTC_SCPP_RESET,  //!< No RTCCLK pulses are added */
    RTC_SCPP_SET     //!< Add one RTCCLK puls every 211 pulses */
} Rtc_ScppType;

/**
 * @brief RTC Add 1 Second Parameter
 */
typedef enum
{
    RTC_SHIFTADD1S_RESET,  //!< No effect */
    RTC_SHIFTADD1S_SET     //!< Add one second to the clock calendar */
} Rtc_ShiftAdd1sType;

/**
 * @brief RTC AlarmDateWeekDay
 */
typedef enum
{
    RTC_WEEKDAY_SEL_DATE,    //!< Select DAYU to represent the date */
    RTC_WEEKDAY_SEL_WEEKDAY  //!< Select DAYU to represent the weekday */
} Rtc_WeekDaySelType;

/**
  * @brief  RTC Interrupts  Soure
  */
typedef enum
{
    RTC_INT_ALR         = 0x00001000,  //!< ALRMA A interrupt mask */
    RTC_INT_WT          = 0x00004000   //!< WakeUp Timer interrupt mask */
} Rtc_IntType;

/**
  * @brief  RTC Interrupts  Flag
  */
typedef enum
{
    RTC_INT_FLAG_ALR    = 0x00001000,  //!< ALRMA interrupt */
    RTC_INT_FLAG_WT     = 0x00004000   //!< WakeUp Timer */
} Rtc_IntFlagType;

/**
  * @brief  RTC flag
  */
typedef enum
{
    RTC_FLAG_AWF        = BIT0,  //!< Alarm Write Flag */
    RTC_FLAG_SOPF       = BIT3,  //!< Shift Operation Pending Flag */
    RTC_FLAG_ISF        = BIT4,  //!< Initialization State Flag */
    RTC_FLAG_RSF        = BIT5,  //!< Registers Synchronization Flag */
    RTC_FLAG_INTF       = BIT6,  //!< Register Initialization Flag */
    RTC_FLAG_ALRF       = BIT8,  //!< Alarm Match Flag */
    RTC_FLAG_RPF        = BIT16  //!< Recalibration Pending Flag */
} Rtc_FlagType;

/**
 * @brief RTC Hour Formats
 */
typedef enum
{
    RTC_HourFormat_24,   //!< 24 hour/day format */
    RTC_HourFormat_12    //!< AM/PM hour format */
} Rtc_HourFormatType;

/**@} end of group RTC_Enumerations */
/** @defgroup RTC_Structure
  @{
*/

/**
 * @brief  RTC Time structure definition
 */
typedef struct
{
    uint8_t hours;      //!< Set hours of RTC time */
    uint8_t minutes;    //!< Set minutes of RTC time */
    uint8_t seconds;    //!< Set seconds of RTC time */
    uint8_t H12;        //!< Set RTC time to AM or PM */
} Rtc_TimeType;

/**
 * @brief  RTC Date structure definition
 */
typedef struct
{
    uint8_t weekday;  //!< Set weekday of RTC date */
    uint8_t month;    //!< Set month of RTC date */
    uint8_t date;     //!< Set data of RTC date */
    uint8_t year;     //!< Set year of RTC date */
} Rtc_DateType;

/**
 * @brief  RTC ALRMA structure definition
 */
typedef struct
{
    Rtc_TimeType time;                        //!< Set RTC time */
    uint32_t AlarmMask;                       //!< Set alarm mask */
    Rtc_WeekDaySelType AlarmDateWeekDaySel;   //!< Set weekday's DAYU of alarm date */
    uint8_t AlarmDateWeekDay;                 //!< Set weekday of alarm date */
} Rtc_AlarmType;

/**
 * @brief  RTC Init structures definition
 */
typedef struct
{
    Rtc_HourFormatType format;   //!< RTC hour formats selection */
    uint32 AsynchPrediv;         //!< Asynchronous prescaler coefficient setting */
    uint32 SynchPrediv;          //!< Synchronous prescaler coefficient setting */
} Rtc_TimeInitType;

/**
 * @brief  RTC Init structures definition
 */
typedef struct
{
    Rtc_TimeInitType* Rtc_TimeInit;  
    Rtc_TimeType* TimeStruct;
    Rtc_AlarmType* AlarmStruct;
    
} Rtc_ConfigType;

/**@} end of group RTC_Structure */
#ifdef __cplusplus
}
#endif

#endif /* RTC_TYPES_H */
/**@} end of group RTC_Driver */
/**@} end of group G32A10xx_StdPeriphDriver */
