Index: RTC.c =================================================================== diff -u -r476fa5a4aac0ee83508e13573c245b772a391aa0 -r41cb1acb06f79de20f037002a0d0caca638d19b9 --- RTC.c (.../RTC.c) (revision 476fa5a4aac0ee83508e13573c245b772a391aa0) +++ RTC.c (.../RTC.c) (revision 41cb1acb06f79de20f037002a0d0caca638d19b9) @@ -209,6 +209,7 @@ static U16 RAMBuffer[ MIBSPI_MAX_BUFFER_LENGTH ]; ///< Buffer to read RTC RAM data. static U16 previousFPGATimerCount; ///< Previous FPGA timer count; static OVERRIDE_U32_T rtcControlRegister1 = { 0, 0, 0, 0 }; ///< RTC control register 1. +static OVERRIDE_U32_T rtcControlRegister3 = { 0, 0, 0, 0 }; ///< RTC control register 3. #ifdef _DG_ static BOOL syncDG2HDDateTimeFlag; ///< Flag indicating whether DG RTC should be sync'd to HD RTC. #endif @@ -228,6 +229,7 @@ static BOOL setMibSPIBufferLength( U16 length ); static void prepBufferForReadCommand( U08 length ); // Puts the read command static U16 getControlReg1( void ); +static U16 getControlReg3( void ); static RTC_SELF_TEST_STATE_T handleSelfTestStart( void ); static RTC_SELF_TEST_STATE_T handleSelfTestCheckCtrlRegs( void ); @@ -792,11 +794,15 @@ BOOL status = TRUE; U16 controlReg1 = 0; U16 controlReg2 = rxBuffer[ RTC_REG_2_INDEX ]; - U16 controlReg3 = rxBuffer[ RTC_REG_3_INDEX ]; + U16 controlReg3 = 0; - rtcControlRegister1.data = rxBuffer[ RTC_REG_1_INDEX ]; // populate real data before we consider override + // populate real data before we consider override + rtcControlRegister1.data = rxBuffer[ RTC_REG_1_INDEX ]; controlReg1 = getControlReg1(); + rtcControlRegister3.data = rxBuffer[ RTC_REG_3_INDEX ]; + controlReg3 = getControlReg3(); + #ifdef _DG_ reg1Alarm = ALARM_ID_DG_RTC_CONFIG_ERROR; batteryAlarm = ALARM_ID_DG_RTC_BATTERY_LOW; @@ -1579,7 +1585,7 @@ /*********************************************************************//** * @brief - * The getControlReg1 function gets the current RTC control register. + * The getControlReg1 function gets the current RTC control register 1. * @details Inputs: rtcControlRegister1 * @details Outputs: none * @return the current RTC control register word. @@ -1590,6 +1596,20 @@ return getU16OverrideValue(&rtcControlRegister1); } +/*********************************************************************//** + * @brief + * The getControlReg3 function gets the current RTC control register 3. + * @details Inputs: rtcControlRegister3 + * @details Outputs: none + * @return the current RTC control register word. + *************************************************************************/ +static U16 getControlReg3( void ) +{ + + return getU16OverrideValue(&rtcControlRegister3); +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -1637,13 +1657,13 @@ /*********************************************************************//** * @brief - * The testSetRTCstatus function overrides RTC control register 1 + * The testSetRTCCtlReg1Status function overrides RTC control register 1 * @details Inputs: none * @details Outputs: rtcControlRegister1 * @param status override RTC control register 1 with this value * @return TRUE if override successful, FALSE if not *************************************************************************/ -BOOL testSetRTCstatus( U32 status ) +BOOL testSetRTCCtlReg1Status( U32 status ) { BOOL result = FALSE; @@ -1659,13 +1679,13 @@ /*********************************************************************//** * @brief - * The testResetRTCstatus function resets the override + * The testResetRTCCtlReg1Status function resets the override * of RTC control register 1. * @details Inputs: none * @details Outputs: rtcControlRegister1 * @return TRUE if reset successful, FALSE if not *************************************************************************/ -BOOL testResetRTCstatus( void ) +BOOL testResetRTCCtlReg1Status( void ) { BOOL result = FALSE; @@ -1679,5 +1699,48 @@ return result; } +/*********************************************************************//** + * @brief + * The testSetRTCCtlReg3Status function overrides RTC control register 3 + * @details Inputs: none + * @details Outputs: rtcControlRegister1 + * @param status override RTC control register 1 with this value + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetRTCCtlReg3Status( U32 status ) +{ + BOOL result = FALSE; + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + rtcControlRegister3.ovData = status; + rtcControlRegister3.override = OVERRIDE_KEY; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetRTCCtlReg3Status function resets the override + * of RTC control register 3. + * @details Inputs: none + * @details Outputs: rtcControlRegister1 + * @return TRUE if reset successful, FALSE if not + *************************************************************************/ +BOOL testResetRTCCtlReg3Status( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + rtcControlRegister3.override = OVERRIDE_RESET; + rtcControlRegister3.ovData = rtcControlRegister1.ovInitData; + } + + return result; +} + /**@}*/