Index: AlarmMgmt.c =================================================================== diff -u -r70a7331db2fcde56b3e47816fa57f5209c66c5f8 -r15a8d5ff98b2d88bd0f32a37b41f4eec0f7a7088 --- AlarmMgmt.c (.../AlarmMgmt.c) (revision 70a7331db2fcde56b3e47816fa57f5209c66c5f8) +++ AlarmMgmt.c (.../AlarmMgmt.c) (revision 15a8d5ff98b2d88bd0f32a37b41f4eec0f7a7088) @@ -419,23 +419,28 @@ /*********************************************************************//** * @brief - * The testSetAlarmStateOverride function overrides the state of the + * The testAlarmStateOverride function overrides the state of the * alarm active state for a given alarm with the alarm management with * a given active state. * @details \b Inputs: none * @details \b Outputs: alarm activated or cleared - * @param alarmID ID of alarm to activate or clear - * @param value override state for the given alarm ID (1=activate, 0=clear) + * @param message Override message from Dialin which includes an ID of + * the alarm to override and the state to override the alarm to. * @return TRUE if override successful, FALSE if not *************************************************************************/ -BOOL testSetAlarmStateOverride( U32 alarmID, U32 state ) +BOOL testAlarmStateOverride( MESSAGE_T *message ) { - BOOL result = FALSE; + BOOL result = FALSE; + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + OVERRIDE_TYPE_T ovType = getOverrideArrayPayloadFromMessage( message, &payload ); + + // Verify tester has logged in with f/w and override type is valid + if ( ( TRUE == isTestingActivated() ) && ( ovType != OVERRIDE_INVALID ) && ( ovType < NUM_OF_OVERRIDE_TYPES ) ) + { + U32 alarmID = payload.index; + BOOL state = (BOOL)payload.state.u32; - if ( alarmID < NUM_OF_ALARM_IDS ) - { - // Verify tester has logged in with HD - if ( TRUE == isTestingActivated() ) + if ( alarmID < NUM_OF_ALARM_IDS ) { if ( TRUE == state ) { @@ -454,44 +459,10 @@ #endif } result = TRUE; - } + } } return result; } -/*********************************************************************//** - * @brief - * The testResetAlarmStateOverride function resets the override of the - * state of the active state for a given alarm with the alarm management. - * @details \b Inputs: none - * @details \b Outputs: alarm cleared - * @param alarmID ID of alarm to clear - * @return TRUE if alarm clear successful, FALSE if not - *************************************************************************/ -BOOL testResetAlarmStateOverride( U32 alarmID ) -{ - BOOL result = FALSE; - - if ( alarmID < NUM_OF_ALARM_IDS ) - { - // Verify tester has logged in with HD - if ( TRUE == isTestingActivated() ) - { - result = TRUE; -#ifdef _TD_ - clearAlarmTD( (ALARM_ID_T)alarmID ); -#endif -#ifdef _DD_ - clearAlarmDD( (ALARM_ID_T)alarmID ); -#endif -#ifdef _RO_ - clearAlarmRO( (ALARM_ID_T)alarmID ); -#endif - } - } - - return result; -} - /**@}*/ Index: AlarmMgmt.h =================================================================== diff -u -r2801d97e877dd78189aa891e80a2f7cf60a6a2b7 -r15a8d5ff98b2d88bd0f32a37b41f4eec0f7a7088 --- AlarmMgmt.h (.../AlarmMgmt.h) (revision 2801d97e877dd78189aa891e80a2f7cf60a6a2b7) +++ AlarmMgmt.h (.../AlarmMgmt.h) (revision 15a8d5ff98b2d88bd0f32a37b41f4eec0f7a7088) @@ -29,6 +29,7 @@ #endif #include "AlarmDefs.h" #include "AlarmMgmtSWFaults.h" +#include "MessageSupport.h" /** * @defgroup AlarmManagement AlarmManagement @@ -120,8 +121,7 @@ BOOL isAlarmConditionDetected( ALARM_ID_T alarm ); BOOL isAlarmRecoverable( ALARM_ID_T alarm ); -BOOL testSetAlarmStateOverride( U32 alarmID, BOOL value ); -BOOL testResetAlarmStateOverride( U32 alarmID ); +BOOL testAlarmStateOverride( MESSAGE_T *message ); /**@}*/ Index: Utilities.c =================================================================== diff -u -rdbe0d08fe950a54ae97d311f92acdd5ad8090da4 -r15a8d5ff98b2d88bd0f32a37b41f4eec0f7a7088 --- Utilities.c (.../Utilities.c) (revision dbe0d08fe950a54ae97d311f92acdd5ad8090da4) +++ Utilities.c (.../Utilities.c) (revision 15a8d5ff98b2d88bd0f32a37b41f4eec0f7a7088) @@ -268,6 +268,33 @@ return ( nRem ^ 0x00 ); } +S16 signExtend16( U16 value, U32 signBit ) +{ + U16 signBitMask = 1; + U16 extend = 1; + S32 i; + + for ( i = 1; i < 15U - signBit; i++ ) + { + extend <<= 1; + extend |= 1; + } + extend <<= signBit; + + for ( i = 0; i < signBit; i++ ) + { + signBitMask <<= 1; + } + + // if given value is negative, sign extend value + if ( ( value & signBitMask ) != 0 ) + { + value |= extend; + } + + return (S16)value; +} + /*********************************************************************//** * @brief * The u32DiffWithWrap function calculates the difference between two given Index: Utilities.h =================================================================== diff -u -r2801d97e877dd78189aa891e80a2f7cf60a6a2b7 -r15a8d5ff98b2d88bd0f32a37b41f4eec0f7a7088 --- Utilities.h (.../Utilities.h) (revision 2801d97e877dd78189aa891e80a2f7cf60a6a2b7) +++ Utilities.h (.../Utilities.h) (revision 15a8d5ff98b2d88bd0f32a37b41f4eec0f7a7088) @@ -109,6 +109,8 @@ U08 crc8( const U08 *address, U32 len ); U08 crc4( U16* buffer, U32 byteCount ); +S16 signExtend16( U16 value, U32 signBit ); + U32 u32DiffWithWrap( U32 start, U32 end ); S32 u32BiDiffWithWrap( U32 start, U32 end ); U16 u16DiffWithWrap( U16 start, U16 end ); Index: WatchdogMgmt.c =================================================================== diff -u -r3ca022103ce50b39e5d805b7577c7f360730412d -r15a8d5ff98b2d88bd0f32a37b41f4eec0f7a7088 --- WatchdogMgmt.c (.../WatchdogMgmt.c) (revision 3ca022103ce50b39e5d805b7577c7f360730412d) +++ WatchdogMgmt.c (.../WatchdogMgmt.c) (revision 15a8d5ff98b2d88bd0f32a37b41f4eec0f7a7088) @@ -442,63 +442,21 @@ /*********************************************************************//** * @brief - * The testSetWatchdogTaskCheckInOverride function overrides the state of the + * The testWatchdogTaskCheckInOverride function overrides the state of the * check-in for a given task with a given check-in state. * @warning Dialin must be logged into related firmware stack to perform * an override successfully. * @details \b Inputs: none * @details \b Outputs: watchdogTaskCheckedIn[] - * @param task ID of task to override check-in state for - * @param value override state for the given task ID + * @param message Override message from Dialin which includes an ID of + * the task to override and the check-in status to override the task to. * @return TRUE if override successful, FALSE if not *************************************************************************/ -BOOL testSetWatchdogTaskCheckInOverride( U32 task, BOOL value ) +BOOL testWatchdogTaskCheckInOverride( MESSAGE_T *message ) { - BOOL result = FALSE; + BOOL result = u32ArrayOverride( message, &watchdogTaskCheckedIn[0], NUM_OF_TASKS - 1, FALSE, TRUE ); - // validate given task - if ( task < NUM_OF_TASKS ) - { - // Dialin must be logged in to perform an override - if ( TRUE == isTestingActivated() ) - { - result = TRUE; - watchdogTaskCheckedIn[ task ].ovData = value; - watchdogTaskCheckedIn[ task ].override = OVERRIDE_KEY; - } - } - return result; } -/*********************************************************************//** - * @brief - * The testResetWatchdogTaskCheckInOverride function resets the override of the - * state of the check-in for a given task. - * @warning Dialin must be logged into related firmware stack to perform - * an override successfully. - * @details \b Inputs: none - * @details \b Outputs: watchdogTaskCheckedIn[] - * @param task ID of task to override check-in state for - * @return TRUE if override reset successful, FALSE if not - *************************************************************************/ -BOOL testResetWatchdogTaskCheckInOverride( U32 task ) -{ - BOOL result = FALSE; - - // validate given task - if ( task < NUM_OF_TASKS ) - { - // Dialin must be logged in to perform an override - if ( TRUE == isTestingActivated() ) - { - result = TRUE; - watchdogTaskCheckedIn[ task ].override = OVERRIDE_RESET; - watchdogTaskCheckedIn[ task ].ovData = watchdogTaskCheckedIn[ task ].ovInitData; - } - } - - return result; -} - /**@}*/ Index: WatchdogMgmt.h =================================================================== diff -u -r2801d97e877dd78189aa891e80a2f7cf60a6a2b7 -r15a8d5ff98b2d88bd0f32a37b41f4eec0f7a7088 --- WatchdogMgmt.h (.../WatchdogMgmt.h) (revision 2801d97e877dd78189aa891e80a2f7cf60a6a2b7) +++ WatchdogMgmt.h (.../WatchdogMgmt.h) (revision 15a8d5ff98b2d88bd0f32a37b41f4eec0f7a7088) @@ -27,6 +27,7 @@ #ifdef _RO_ #include "ROCommon.h" #endif +#include "MessageSupport.h" /** * @defgroup WatchdogMgmt WatchdogMgmt @@ -58,8 +59,7 @@ SELF_TEST_STATUS_T execWatchdogTest( void ); void resetWatchdogPOSTState( void ); -BOOL testSetWatchdogTaskCheckInOverride( U32 task, BOOL value ); -BOOL testResetWatchdogTaskCheckInOverride( U32 task ); +BOOL testWatchdogTaskCheckInOverride( MESSAGE_T *message ); /**@}*/