Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r44a100f8e5210a02c23b8fcc4527d8e96d577381 -r8b793075edebe4a88faf7ec197c2ea154ac1e1b0 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 44a100f8e5210a02c23b8fcc4527d8e96d577381) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 8b793075edebe4a88faf7ec197c2ea154ac1e1b0) @@ -50,6 +50,9 @@ // *** This declaration will cause a compiler error if ALARM_TABLE does not have same # of alarms as the Alarm_List enumeration. U08 alarmTableSizeAssertion[ ( ( sizeof( ALARM_TABLE ) / sizeof( ALARM_T ) ) == NUM_OF_ALARM_IDS ? 1 : -1 ) ]; +// *** This declaration will cause a compiler error if ALARM_RANK_TABLE does not have same # of alarms as the Alarm_List enumeration. +U08 alarmRankTableSizeAssertion[ ( ( sizeof( ALARM_RANK_TABLE ) / sizeof( ALARM_RANK_T ) ) == NUM_OF_ALARM_IDS ? 1 : -1 ) ]; + /// A blank alarm data record for alarms that do not include alarm data when triggered. const ALARM_DATA_T BLANK_ALARM_DATA = { ALARM_DATA_TYPE_NONE, 0 }; @@ -632,22 +635,21 @@ BOOL accepted = TRUE; REQUEST_REJECT_REASON_CODE_T rejReason = REQUEST_REJECT_REASON_NONE; U32 activeAlarmList[ MAX_ALARM_LIST_SIZE ]; - U32 i; - ALARM_ID_T alarmID; + U32 index; U32 activeAlarmListIndex = 0; - for ( i = 0; i < MAX_ALARM_LIST_SIZE; i++ ) + for ( index = 0; index < MAX_ALARM_LIST_SIZE; index++ ) { - activeAlarmList[ i ] = ALARM_ID_NO_ALARM; + activeAlarmList[ index ] = ALARM_ID_NO_ALARM; } if ( TRUE == isAnyAlarmActive() ) { - for ( alarmID = ALARM_ID_NO_ALARM; alarmID < NUM_OF_ALARM_IDS; alarmID++ ) + for ( index = 0; index < NUM_OF_ALARM_IDS; index++ ) { - if ( ( TRUE == alarmIsActive[ alarmID ] ) && ( activeAlarmListIndex < MAX_ALARM_LIST_SIZE ) ) + if ( ( TRUE == isAlarmActive( ALARM_RANK_TABLE[ index ].alarmID ) ) && ( activeAlarmListIndex < MAX_ALARM_LIST_SIZE ) ) { - activeAlarmList[ activeAlarmListIndex ] = alarmID; + activeAlarmList[ activeAlarmListIndex ] = ALARM_RANK_TABLE[ index ].alarmID; activeAlarmListIndex++; } } Index: firmware/checkAlarms.sh =================================================================== diff -u -r25698c7b702dbc1ebdd209eebdb908dbeb1594ae -r8b793075edebe4a88faf7ec197c2ea154ac1e1b0 --- firmware/checkAlarms.sh (.../checkAlarms.sh) (revision 25698c7b702dbc1ebdd209eebdb908dbeb1594ae) +++ firmware/checkAlarms.sh (.../checkAlarms.sh) (revision 8b793075edebe4a88faf7ec197c2ea154ac1e1b0) @@ -3,6 +3,9 @@ lineno=$(grep -n "ALARM_ID_NO_ALARM = 0" ../Common/AlarmDefs.h) lineno=${lineno%%:*} +alarmRankLineNo=$(grep -n "ALARM_RANK_TABLE" ../Common/AlarmDefs.h) +alarmRankLineNo=${alarmRankLineNo%%:*} + echo " #include #include @@ -15,6 +18,8 @@ { ALARM_ID_T alarm; U32 lineNumber = $lineno; + U32 alarmRankLineNumber = $alarmRankLineNo; + U32 index; for ( alarm = ALARM_ID_NO_ALARM; alarm < NUM_OF_ALARM_IDS; alarm++ ) { @@ -26,6 +31,27 @@ } } printf(\"Alarm table check completed!\n\"); + + for ( alarm = ALARM_ID_NO_ALARM; alarm < NUM_OF_ALARM_IDS; alarm++ ) + { + if ( ALARM_RANK_TABLE[ alarm ].alarmSubRank != ALARM_TABLE[ ALARM_RANK_TABLE[ alarm ].alarmID ].alarmSubRank ) + { + printf(\"\\\"AlarmDefs.h\\\", line %d: error #9999: Alarm has different rank from alarm property table!\n\", alarmRankLineNumber + alarm + 2 ); + exit(1); + } + } + + for ( index = 1; index < NUM_OF_ALARM_IDS; index++ ) + { + if ( ALARM_RANK_TABLE[ index - 1 ].alarmSubRank > ALARM_RANK_TABLE[ index ].alarmSubRank ) + { + alarmRankLineNumber += index + 1; + printf(\"\\\"AlarmDefs.h\\\", line %d: error #9999: Alarm Rank Index %i has higher rank than Index %i!\n\", alarmRankLineNumber, index, index - 1); + exit(1); + } + } + + printf(\"Alarm rank table check completed!\n\"); }" > alarmCheck.c gcc -o alarmCheck alarmCheck.c -I../App -I../App/Services -I../Common -I../FWCommon -I../include