Platform/ECM3532/M3/hw/csp/ecm3532/m3/csp/src/eta_csp_rtc.c
/***************************************************************************/
/**
 *
 *  EtaCspRtcTodGetDec - Get the time of day in decimal.
 *
 *  @param psTimeOfDay pointer to a time of day structure to be filled in.
 *
 ******************************************************************************/
Get the time of day in decimal.
@param psTimeOfDay pointer to a time of day structure to be filled in.
Get the time of day in decimal . @param psTimeOfDay pointer to a time of day structure to be filled in .
void
EtaCspRtcTodGetDec(tTimeOfDay *psTimeOfDay)
{
    reg_rtc_toda_t uTimeOfDayA = REG_RTC_TODA;
    reg_rtc_todb_t uTimeOfDayB = REG_RTC_TODB;
    psTimeOfDay->bTwelve = uTimeOfDayB.BF.TWELVE_HOUR;
    psTimeOfDay->ui8Second = BCD_TO_DEC(uTimeOfDayA.BF.SECONDS);
    psTimeOfDay->ui8Minute = BCD_TO_DEC(uTimeOfDayA.BF.MINUTES);
    psTimeOfDay->ui8Hour = psTimeOfDay->bTwelve ? BCD_TO_DEC((uTimeOfDayA.BF.HOURS & 0x1F))
                                                : BCD_TO_DEC(uTimeOfDayA.BF.HOURS);
    psTimeOfDay->bAm = !((uTimeOfDayA.BF.HOURS >> 5) & 0x1);
    psTimeOfDay->ui8Day = BCD_TO_DEC(uTimeOfDayA.BF.DATE);
    psTimeOfDay->ui8DayOfWeek = BCD_TO_DEC(uTimeOfDayB.BF.DAY);
    psTimeOfDay->ui8Month = BCD_TO_DEC(uTimeOfDayA.BF.MONTH);
    psTimeOfDay->ui16Year = BCD_TO_DEC(uTimeOfDayB.BF.YEAR) + 2000;
    psTimeOfDay->ui8Century = BCD_TO_DEC(uTimeOfDayB.BF.CENTURY);
}
void EtaCspRtcTodGetDec ( tTimeOfDay * psTimeOfDay ) { reg_rtc_toda_t uTimeOfDayA = REG_RTC_TODA ; reg_rtc_todb_t uTimeOfDayB = REG_RTC_TODB ; psTimeOfDay -> bTwelve = uTimeOfDayB . BF . TWELVE_HOUR ; psTimeOfDay -> ui8Second = BCD_TO_DEC ( uTimeOfDayA . BF . SECONDS ) ; psTimeOfDay -> ui8Minute = BCD_TO_DEC ( uTimeOfDayA . BF . MINUTES ) ; psTimeOfDay -> ui8Hour = psTimeOfDay -> bTwelve ? BCD_TO_DEC ( ( uTimeOfDayA . BF . HOURS & 0x1F ) ) : BCD_TO_DEC ( uTimeOfDayA . BF . HOURS ) ; psTimeOfDay -> bAm = ! ( ( uTimeOfDayA . BF . HOURS >> 5 ) & 0x1 ) ; psTimeOfDay -> ui8Day = BCD_TO_DEC ( uTimeOfDayA . BF . DATE ) ; psTimeOfDay -> ui8DayOfWeek = BCD_TO_DEC ( uTimeOfDayB . BF . DAY ) ; psTimeOfDay -> ui8Month = BCD_TO_DEC ( uTimeOfDayA . BF . MONTH ) ; psTimeOfDay -> ui16Year = BCD_TO_DEC ( uTimeOfDayB . BF . YEAR ) + 2000 ; psTimeOfDay -> ui8Century = BCD_TO_DEC ( uTimeOfDayB . BF . CENTURY ) ; }
EtaCspRtcTodGetDec - Get the time of day in decimal.
EtaCspRtcTodGetDec - Get the time of day in decimal .