Platform/ECM3532/M3/hw/csp/ecm3532/m3/csp/src/eta_csp_rtc.c
/***************************************************************************/
/**
 *
 *  EtaCspRtcAlarmSetDec - Set the time of day in decimal.
 *
 *  @param iAlarmNumber enumeration for alarma A or B.
 *  @param psTimeOfDay  pointer to a time of day structure.
 *  @param iEnables     alarm match enable enums.
 *
 *  @return general status: success or !success
 *
 *  @Note: ALARM interrupt should not be enabled when RTC_ALARMA/B is written.
 *         The ALARM interrupt should be cleared after RTC_ALARMA/B is written.
 ******************************************************************************/
Set the time of day in decimal.
@param iAlarmNumber enumeration for alarma A or B.
@param psTimeOfDay  pointer to a time of day structure.
@param iEnables     alarm match enable enums.

@return general status: success or !success

@Note: ALARM interrupt should not be enabled when RTC_ALARMA/B is written.
The ALARM interrupt should be cleared after RTC_ALARMA/B is written.
Set the time of day in decimal . @param iAlarmNumber enumeration for alarma A or B . @param psTimeOfDay pointer to a time of day structure . @param iEnables alarm match enable enums . @return general status : success or !success @Note : ALARM interrupt should not be enabled when RTC_ALARMA / B is written . The ALARM interrupt should be cleared after RTC_ALARMA / B is written .
tEtaStatus
EtaCspRtcAlarmSetDec(tRtcAlarmNum iAlarmNumber, tTimeOfDay *psTimeOfDay,
                     tRtcAlarmEnable iEnables)
{
    switch(iAlarmNumber)
    {
        case eAlarmA:
        {
            REG_RTC_CSRA.V = 0;
             Collect the arguments
            reg_rtc_alarma_t uTimeOfDayA =
            {
                .BF.SECONDS = DEC_TO_BCD(psTimeOfDay->ui8Second),
                .BF.MINUTES = DEC_TO_BCD(psTimeOfDay->ui8Minute),
                .BF.HOURS = DEC_TO_BCD(psTimeOfDay->ui8Hour)
                          | ((psTimeOfDay->bTwelve & !psTimeOfDay->bAm) << 5),
                .BF.DAY = psTimeOfDay->bMatchDayOfWeek,
                .BF.DATE = (psTimeOfDay->bMatchDayOfWeek ? DEC_TO_BCD(psTimeOfDay->ui8DayOfWeek)
                                                         : DEC_TO_BCD(psTimeOfDay->ui8Day)),
                .BF.MONTH = DEC_TO_BCD(psTimeOfDay->ui8Month),
            };
             Now write to the RTC hardware.
            REG_RTC_ALARMA = uTimeOfDayA;
            REG_W7(RTC_CSRA,
                   INT_STAT, 1,
                   MATCH_MONTHS, (iEnables & eAlarmMonths) ? 1 : 0,
                   MATCH_DAY_DATE, (iEnables & eAlarmDayDate) ? 1 : 0,
                   MATCH_HOURS, (iEnables & eAlarmHours) ? 1 : 0,
                   MATCH_MINUTES, (iEnables & eAlarmMinutes) ? 1 : 0,
                   MATCH_SECONDS, (iEnables & eAlarmSeconds) ? 1 : 0,
                   INT_ENABLE, 1);
            break;
        }
        case eAlarmB:
        {
            REG_RTC_CSRB.V = 0;
             Collect the arguments
            reg_rtc_alarmb_t uTimeOfDayB =
            {
                .BF.SECONDS = DEC_TO_BCD(psTimeOfDay->ui8Second),
                .BF.MINUTES = DEC_TO_BCD(psTimeOfDay->ui8Minute),
                .BF.HOURS = DEC_TO_BCD(psTimeOfDay->ui8Hour)
                          | ((psTimeOfDay->bTwelve & !psTimeOfDay->bAm) << 5),
                .BF.DAY = psTimeOfDay->bMatchDayOfWeek,
                .BF.DATE = (psTimeOfDay->bMatchDayOfWeek ? DEC_TO_BCD(psTimeOfDay->ui8DayOfWeek)
                                                         : DEC_TO_BCD(psTimeOfDay->ui8Day)),
                .BF.MONTH = DEC_TO_BCD(psTimeOfDay->ui8Month),
            };
             Now write to the RTC hardware.
            REG_RTC_ALARMB = uTimeOfDayB;
            REG_W7(RTC_CSRB,
                   INT_STAT, 1,
                   MATCH_MONTHS, (iEnables & eAlarmMonths) ? 1 : 0,
                   MATCH_DAY_DATE, (iEnables & eAlarmDayDate) ? 1 : 0,
                   MATCH_HOURS, (iEnables & eAlarmHours) ? 1 : 0,
                   MATCH_MINUTES, (iEnables & eAlarmMinutes) ? 1 : 0,
                   MATCH_SECONDS, (iEnables & eAlarmSeconds) ? 1 : 0,
                   INT_ENABLE, 1);
            break;
        }
        default:
        {
            return(eEtaFailure);
        }
    }
    return(eEtaSuccess);
}
tEtaStatus EtaCspRtcAlarmSetDec ( tRtcAlarmNum iAlarmNumber , tTimeOfDay * psTimeOfDay , tRtcAlarmEnable iEnables ) { switch ( iAlarmNumber ) { case eAlarmA : { REG_RTC_CSRA . V = 0 ; reg_rtc_alarma_t uTimeOfDayA = { . BF . SECONDS = DEC_TO_BCD ( psTimeOfDay -> ui8Second ) , . BF . MINUTES = DEC_TO_BCD ( psTimeOfDay -> ui8Minute ) , . BF . HOURS = DEC_TO_BCD ( psTimeOfDay -> ui8Hour ) | ( ( psTimeOfDay -> bTwelve & ! psTimeOfDay -> bAm ) << 5 ) , . BF . DAY = psTimeOfDay -> bMatchDayOfWeek , . BF . DATE = ( psTimeOfDay -> bMatchDayOfWeek ? DEC_TO_BCD ( psTimeOfDay -> ui8DayOfWeek ) : DEC_TO_BCD ( psTimeOfDay -> ui8Day ) ) , . BF . MONTH = DEC_TO_BCD ( psTimeOfDay -> ui8Month ) , } ; REG_RTC_ALARMA = uTimeOfDayA ; REG_W7 ( RTC_CSRA , INT_STAT , 1 , MATCH_MONTHS , ( iEnables & eAlarmMonths ) ? 1 : 0 , MATCH_DAY_DATE , ( iEnables & eAlarmDayDate ) ? 1 : 0 , MATCH_HOURS , ( iEnables & eAlarmHours ) ? 1 : 0 , MATCH_MINUTES , ( iEnables & eAlarmMinutes ) ? 1 : 0 , MATCH_SECONDS , ( iEnables & eAlarmSeconds ) ? 1 : 0 , INT_ENABLE , 1 ) ; break ; } case eAlarmB : { REG_RTC_CSRB . V = 0 ; reg_rtc_alarmb_t uTimeOfDayB = { . BF . SECONDS = DEC_TO_BCD ( psTimeOfDay -> ui8Second ) , . BF . MINUTES = DEC_TO_BCD ( psTimeOfDay -> ui8Minute ) , . BF . HOURS = DEC_TO_BCD ( psTimeOfDay -> ui8Hour ) | ( ( psTimeOfDay -> bTwelve & ! psTimeOfDay -> bAm ) << 5 ) , . BF . DAY = psTimeOfDay -> bMatchDayOfWeek , . BF . DATE = ( psTimeOfDay -> bMatchDayOfWeek ? DEC_TO_BCD ( psTimeOfDay -> ui8DayOfWeek ) : DEC_TO_BCD ( psTimeOfDay -> ui8Day ) ) , . BF . MONTH = DEC_TO_BCD ( psTimeOfDay -> ui8Month ) , } ; REG_RTC_ALARMB = uTimeOfDayB ; REG_W7 ( RTC_CSRB , INT_STAT , 1 , MATCH_MONTHS , ( iEnables & eAlarmMonths ) ? 1 : 0 , MATCH_DAY_DATE , ( iEnables & eAlarmDayDate ) ? 1 : 0 , MATCH_HOURS , ( iEnables & eAlarmHours ) ? 1 : 0 , MATCH_MINUTES , ( iEnables & eAlarmMinutes ) ? 1 : 0 , MATCH_SECONDS , ( iEnables & eAlarmSeconds ) ? 1 : 0 , INT_ENABLE , 1 ) ; break ; } default : { return ( eEtaFailure ) ; } } return ( eEtaSuccess ) ; }
EtaCspRtcAlarmSetDec - Set the time of day in decimal.
EtaCspRtcAlarmSetDec - Set the time of day in decimal .
// // Collect the arguments // // // Now write to the RTC hardware. // // // Collect the arguments // // // Now write to the RTC hardware. //