Index: RTC.c =================================================================== diff -u -r99f91b0f1bed7da40da75e97d3bb7a3b00e9508d -rd6afafc35efa5dcfd151a871843070e249c1c09f --- RTC.c (.../RTC.c) (revision 99f91b0f1bed7da40da75e97d3bb7a3b00e9508d) +++ RTC.c (.../RTC.c) (revision d6afafc35efa5dcfd151a871843070e249c1c09f) @@ -207,6 +207,7 @@ static U16 prepRAMBuffer[ RTC_RAM_PREP_BUFFER_LENGTH ]; ///< Buffer to send prep read/write commands to RTC RAM. 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 }; #ifdef _DG_ static BOOL syncDG2HDDateTimeFlag; ///< Flag indicating whether DG RTC should be sync'd to HD RTC. #endif @@ -225,6 +226,7 @@ static void updateReadTimestampStruct( void ); static BOOL setMibSPIBufferLength( U16 length ); static void prepBufferForReadCommand( U08 length ); // Puts the read command +static U16 getControlReg1( void ); static RTC_SELF_TEST_STATE_T handleSelfTestStart( void ); static RTC_SELF_TEST_STATE_T handleSelfTestCheckCtrlRegs( void ); @@ -787,10 +789,13 @@ BOOL hasReg1Failed = FALSE; BOOL isBatteryLow = FALSE; BOOL status = TRUE; - U16 controlReg1 = rxBuffer[ RTC_REG_1_INDEX ]; + U16 controlReg1 = 0; U16 controlReg2 = rxBuffer[ RTC_REG_2_INDEX ]; U16 controlReg3 = rxBuffer[ RTC_REG_3_INDEX ]; + rtcControlRegister1.data = rxBuffer[ RTC_REG_1_INDEX ]; // populate real data before we consider override + controlReg1 = getControlReg1(); + #ifdef _DG_ reg1Alarm = ALARM_ID_DG_RTC_CONFIG_ERROR; batteryAlarm = ALARM_ID_DG_RTC_BATTERY_LOW; @@ -1571,7 +1576,12 @@ return state; } +static U16 getControlReg1( void ) +{ + return getU16OverrideValue(&rtcControlRegister1); +} + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -1617,4 +1627,33 @@ return result; } +BOOL testSetRTCstatus( U32 status) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + rtcControlRegister1.ovData = status; + rtcControlRegister1.override = OVERRIDE_KEY; + } + + return result; +} + +BOOL testResetRTCstatus( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + rtcControlRegister1.override = OVERRIDE_RESET; + rtcControlRegister1.ovData = rtcControlRegister1.ovInitData; + } + + return result; +} + + /**@}*/ Index: TestSupport.c =================================================================== diff -u -r2c508d911fedf7fea1a081f449070aeed248b85c -rd6afafc35efa5dcfd151a871843070e249c1c09f --- TestSupport.c (.../TestSupport.c) (revision 2c508d911fedf7fea1a081f449070aeed248b85c) +++ TestSupport.c (.../TestSupport.c) (revision d6afafc35efa5dcfd151a871843070e249c1c09f) @@ -52,6 +52,19 @@ return result; } + +U16 getU16OverrideValue( OVERRIDE_U32_T *ovU32 ) +{ + U16 result = (U16)( ovU32->data & MASK_OFF_MSW ); + + if ( OVERRIDE_KEY == ovU32->override ) + { + result = (U16)( ovU32->ovData & MASK_OFF_MSW ); + } + + return result; +} + /*********************************************************************//** * @brief * The getS32OverrideValue function extracts the appropriate signed integer Index: TestSupport.h =================================================================== diff -u -r2c508d911fedf7fea1a081f449070aeed248b85c -rd6afafc35efa5dcfd151a871843070e249c1c09f --- TestSupport.h (.../TestSupport.h) (revision 2c508d911fedf7fea1a081f449070aeed248b85c) +++ TestSupport.h (.../TestSupport.h) (revision d6afafc35efa5dcfd151a871843070e249c1c09f) @@ -87,6 +87,7 @@ // ********** public function prototypes ********** U08 getU08OverrideValue( OVERRIDE_U32_T *ovU32 ); +U16 getU16OverrideValue( OVERRIDE_U32_T *ovU32 ); U32 getU32OverrideValue( OVERRIDE_U32_T *ovU32 ); S32 getS32OverrideValue( OVERRIDE_S32_T *ovS32 ); F32 getF32OverrideValue( OVERRIDE_F32_T *ovF32 );