Platform/ECM3532/M3/hw/csp/ecm3532/m3/csp/src/eta_csp_rtc.c
/***************************************************************************/
/**
 *
 *  EtaCspRtcAlarmGetDec - Get the alarm settings in decimal.
 *
 *  @param iAlarmNumber enumeration for alarma A or B.
 *  @param psTimeOfDay pointer to a time of day structure to be filled in.
 *  @param piEnables   pointer to an enum to be filled in.
 *
 *  @return general status: success or !success
 *
 ******************************************************************************/
Get the alarm settings in decimal.
@param iAlarmNumber enumeration for alarma A or B.
@param psTimeOfDay pointer to a time of day structure to be filled in.
@param piEnables   pointer to an enum to be filled in.

@return general status: success or !success
Get the alarm settings in decimal . @param iAlarmNumber enumeration for alarma A or B . @param psTimeOfDay pointer to a time of day structure to be filled in . @param piEnables pointer to an enum to be filled in . @return general status : success or !success
tEtaStatus
EtaCspRtcAlarmGetDec(tRtcAlarmNum iAlarmNumber, tTimeOfDay *psTimeOfDay,
                     tRtcAlarmEnable *piEnables)
{
    switch(iAlarmNumber)
    {
        case eAlarmA:
        {
            psTimeOfDay->bTwelve = REG_RTC_TODB.BF.TWELVE_HOUR;
            reg_rtc_alarma_t uTimeOfDayA = REG_RTC_ALARMA;
            psTimeOfDay->ui8Second = BCD_TO_DEC(uTimeOfDayA.BF.SECONDS);
            psTimeOfDay->ui8Minute = BCD_TO_DEC(uTimeOfDayA.BF.MINUTES);
            psTimeOfDay->bAm = !((uTimeOfDayA.BF.HOURS >> 5) & 0x1);
            psTimeOfDay->ui8Hour = psTimeOfDay->bTwelve ? BCD_TO_DEC((uTimeOfDayA.BF.HOURS & 0x1F))
                                                        : BCD_TO_DEC(uTimeOfDayA.BF.HOURS);
            psTimeOfDay->bMatchDayOfWeek = uTimeOfDayA.BF.DAY;
            if(psTimeOfDay->bMatchDayOfWeek)
            {
               psTimeOfDay->ui8DayOfWeek = BCD_TO_DEC(uTimeOfDayA.BF.DATE);
               psTimeOfDay->ui8Day = 0x0; 
	    }
            else
            {
               psTimeOfDay->ui8Day = BCD_TO_DEC(uTimeOfDayA.BF.DATE);
               psTimeOfDay->ui8DayOfWeek = 0x0; 
	    }
            psTimeOfDay->ui8Month = BCD_TO_DEC(uTimeOfDayA.BF.MONTH);
            psTimeOfDay->ui16Year = 0;
            *piEnables = (REG_RTC_CSRA.V >> 8) & 0x0000001F;
            break;
        }
        case eAlarmB:
        {
            psTimeOfDay->bTwelve = REG_RTC_TODB.BF.TWELVE_HOUR;
            reg_rtc_alarmb_t uTimeOfDayB = REG_RTC_ALARMB;
            psTimeOfDay->bAm = !((uTimeOfDayB.BF.HOURS >> 5) & 0x1);
            psTimeOfDay->ui8Second = BCD_TO_DEC(uTimeOfDayB.BF.SECONDS);
            psTimeOfDay->ui8Minute = BCD_TO_DEC(uTimeOfDayB.BF.MINUTES);
            psTimeOfDay->ui8Hour = psTimeOfDay->bTwelve ? BCD_TO_DEC((uTimeOfDayB.BF.HOURS & 0x1F))
                                                        : BCD_TO_DEC(uTimeOfDayB.BF.HOURS);
            psTimeOfDay->bMatchDayOfWeek = uTimeOfDayB.BF.DAY;
            if(psTimeOfDay->bMatchDayOfWeek)
            {
               psTimeOfDay->ui8DayOfWeek = BCD_TO_DEC(uTimeOfDayB.BF.DATE);
               psTimeOfDay->ui8Day = 0x0; 
	    }
            else
            {
               psTimeOfDay->ui8Day = BCD_TO_DEC(uTimeOfDayB.BF.DATE);
               psTimeOfDay->ui8DayOfWeek = 0x0; 
	    }
            psTimeOfDay->ui8Month = BCD_TO_DEC(uTimeOfDayB.BF.MONTH);
            psTimeOfDay->ui16Year = 0;
            *piEnables = (REG_RTC_CSRB.V >> 8) & 0x0000001F;
            break;
        }
        default:
        {
            return(eEtaFailure);
        }
    }
    return(eEtaSuccess);
}
tEtaStatus EtaCspRtcAlarmGetDec ( tRtcAlarmNum iAlarmNumber , tTimeOfDay * psTimeOfDay , tRtcAlarmEnable * piEnables ) { switch ( iAlarmNumber ) { case eAlarmA : { psTimeOfDay -> bTwelve = REG_RTC_TODB . BF . TWELVE_HOUR ; reg_rtc_alarma_t uTimeOfDayA = REG_RTC_ALARMA ; psTimeOfDay -> ui8Second = BCD_TO_DEC ( uTimeOfDayA . BF . SECONDS ) ; psTimeOfDay -> ui8Minute = BCD_TO_DEC ( uTimeOfDayA . BF . MINUTES ) ; psTimeOfDay -> bAm = ! ( ( uTimeOfDayA . BF . HOURS >> 5 ) & 0x1 ) ; psTimeOfDay -> ui8Hour = psTimeOfDay -> bTwelve ? BCD_TO_DEC ( ( uTimeOfDayA . BF . HOURS & 0x1F ) ) : BCD_TO_DEC ( uTimeOfDayA . BF . HOURS ) ; psTimeOfDay -> bMatchDayOfWeek = uTimeOfDayA . BF . DAY ; if ( psTimeOfDay -> bMatchDayOfWeek ) { psTimeOfDay -> ui8DayOfWeek = BCD_TO_DEC ( uTimeOfDayA . BF . DATE ) ; psTimeOfDay -> ui8Day = 0x0 ; } else { psTimeOfDay -> ui8Day = BCD_TO_DEC ( uTimeOfDayA . BF . DATE ) ; psTimeOfDay -> ui8DayOfWeek = 0x0 ; } psTimeOfDay -> ui8Month = BCD_TO_DEC ( uTimeOfDayA . BF . MONTH ) ; psTimeOfDay -> ui16Year = 0 ; * piEnables = ( REG_RTC_CSRA . V >> 8 ) & 0x0000001F ; break ; } case eAlarmB : { psTimeOfDay -> bTwelve = REG_RTC_TODB . BF . TWELVE_HOUR ; reg_rtc_alarmb_t uTimeOfDayB = REG_RTC_ALARMB ; psTimeOfDay -> bAm = ! ( ( uTimeOfDayB . BF . HOURS >> 5 ) & 0x1 ) ; psTimeOfDay -> ui8Second = BCD_TO_DEC ( uTimeOfDayB . BF . SECONDS ) ; psTimeOfDay -> ui8Minute = BCD_TO_DEC ( uTimeOfDayB . BF . MINUTES ) ; psTimeOfDay -> ui8Hour = psTimeOfDay -> bTwelve ? BCD_TO_DEC ( ( uTimeOfDayB . BF . HOURS & 0x1F ) ) : BCD_TO_DEC ( uTimeOfDayB . BF . HOURS ) ; psTimeOfDay -> bMatchDayOfWeek = uTimeOfDayB . BF . DAY ; if ( psTimeOfDay -> bMatchDayOfWeek ) { psTimeOfDay -> ui8DayOfWeek = BCD_TO_DEC ( uTimeOfDayB . BF . DATE ) ; psTimeOfDay -> ui8Day = 0x0 ; } else { psTimeOfDay -> ui8Day = BCD_TO_DEC ( uTimeOfDayB . BF . DATE ) ; psTimeOfDay -> ui8DayOfWeek = 0x0 ; } psTimeOfDay -> ui8Month = BCD_TO_DEC ( uTimeOfDayB . BF . MONTH ) ; psTimeOfDay -> ui16Year = 0 ; * piEnables = ( REG_RTC_CSRB . V >> 8 ) & 0x0000001F ; break ; } default : { return ( eEtaFailure ) ; } } return ( eEtaSuccess ) ; }
EtaCspRtcAlarmGetDec - Get the alarm settings in decimal.
EtaCspRtcAlarmGetDec - Get the alarm settings in decimal .
// unknown from alarm clock register setting // unknown from alarm clock register setting // unknown from alarm clock register setting // unknown from alarm clock register setting