Index: firmware/App/Controllers/SyringePump.h =================================================================== diff -u -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 -r9fcd1ad071bcce7a592833367c103e235e49654f --- firmware/App/Controllers/SyringePump.h (.../SyringePump.h) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) +++ firmware/App/Controllers/SyringePump.h (.../SyringePump.h) (revision 9fcd1ad071bcce7a592833367c103e235e49654f) @@ -105,7 +105,6 @@ /// Software configuration enums typedef enum software_configurations { - SW_CONFIG_DISABLE_ALARM_AUDIO = 0, /// SW_CONFIG_DISABLE_SYRINGE_PUMP_ALARMS, ///< Software configuration disable syringe pump alarms. SW_CONFIG_DISABLE_SYRINGE_PUMP, ///< Software configuration disable syringe pump. NUM_OF_SW_CONFIGS ///< Number of software configurations. Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 -r9fcd1ad071bcce7a592833367c103e235e49654f --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 9fcd1ad071bcce7a592833367c103e235e49654f) @@ -20,7 +20,7 @@ #include "AlarmLamp.h" //#include "BloodFlow.h" -//#include "Buttons.h" +#include "Buttons.h" #include "Compatible.h" #include "CpldInterface.h" #include "Ejector.h" @@ -197,24 +197,13 @@ postState = handlePOSTStatus( testStatus ); break; - case POST_STATE_PRES_OCCL: -// testStatus = execPresOcclSelfTest(); + case POST_STATE_PRESSURE: +// testStatus = execPressureSelfTest(); postState = handlePOSTStatus( testStatus ); break; case POST_STATE_ALARM_AUDIO: -#ifndef _RELEASE_ -// if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ALARM_AUDIO ) != SW_CONFIG_ENABLE_VALUE ) -#endif -// { -// testStatus = execAlarmAudioSelfTest(); -// } -#ifndef _RELEASE_ -// else - { - testStatus = SELF_TEST_STATUS_PASSED; - } -#endif + testStatus = execAlarmAudioSelfTest(); postState = handlePOSTStatus( testStatus ); break; @@ -237,17 +226,17 @@ break; case POST_STATE_STUCK_BUTTON: -// testStatus = execStuckButtonTest(); + testStatus = execStuckButtonTest(); postState = handlePOSTStatus( testStatus ); break; case POST_STATE_UI_POST: -// testStatus = execUITest(); + testStatus = execUITest(); postState = handlePOSTStatus( testStatus ); break; case POST_STATE_FW_COMPATIBILITY: -// testStatus = execFWCompatibilityTest(); + testStatus = execFWCompatibilityTest(); postState = handlePOSTStatus( testStatus ); break; @@ -258,7 +247,7 @@ // Should be last POST (and last POST test must be a test that completes in a single call) case POST_STATE_FPGA: -// testStatus = execFPGATest(); + testStatus = execFPGATest(); handlePOSTStatus( testStatus ); // Ignoring return value because last test if ( TRUE == tempPOSTPassed ) { @@ -453,7 +442,7 @@ if ( testStatus == SELF_TEST_STATUS_PASSED ) { // Broadcast passed POST result - sendPOSTTestResult( (TD_POST_STATE_T)((int)postState), TRUE ); + sendPOSTTestResult( (TD_POST_STATE_T)( (int)postState ), TRUE ); // Move on to next POST test result = (TD_POST_STATE_T)((int)postState + 1); } @@ -462,7 +451,7 @@ // At least one POST has failed tempPOSTPassed = FALSE; // Broadcast failed POST results - sendPOSTTestResult( (TD_POST_STATE_T)((int)postState), FALSE ); + sendPOSTTestResult( (TD_POST_STATE_T)( (int)postState ), FALSE ); sendPOSTFinalResult( FALSE ); // Test that failed should have triggered a fault which will request fault mode, so should POST state machine should never see FAILED state and will fault if it does result = POST_STATE_FAILED; @@ -495,20 +484,20 @@ setSystemREG1_SYSECR( getSystemREG1_SYSECR() ); // clear reset bit(s) after logging event so subsequent resets can be properly identified as not being power-on resets. setCrcREG_PSA_SIGREGL1( 0 ); // clear preserved power-on reset bit. -// sendUIVersionRequest(); // request UI to send us its version - needed for compatibility check + sendUIVersionRequest(); // request UI to send us its version - needed for compatibility check -// if ( TRUE == isDGCommunicating() ) -// { -// sendRequestForDGResendAlarms(); // request DG to re-send any active alarms that may have been triggered before we came up -// } + if ( TRUE == isDDCommunicating() ) + { + sendRequestForDDResendAlarms(); // request DD to re-send any active alarms that may have been triggered before we came up + } // Send the startup event -// SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_STARTUP, systemREG1->DEV, 0x12345678 ) // log startup event w/ device ID bits -// SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_STARTUP, resetReason, systemREG1->GBLSTAT ) // log startup event w/ reset reason(s) bits + SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_STARTUP, systemREG1->DEV, 0x12345678 ) // log startup event w/ device ID bits + SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_STARTUP, resetReason, systemREG1->GBLSTAT ) // log startup event w/ reset reason(s) bits // Send the first submode change event. It is the mode Init and it does not start from a previous // mode previous and current are both published as Init -// SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_OP_MODE_CHANGE, MODE_INIT, MODE_INIT ) + SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_OP_MODE_CHANGE, MODE_INIT, MODE_INIT ) state = POST_STATE_COMPLETED; //POST_STATE_FW_INTEGRITY; startPOSTDelayCounter = 0; } @@ -527,11 +516,11 @@ { SELF_TEST_STATUS_T result = SELF_TEST_STATUS_PASSED; -// if ( uiVersion.compatibility != SW_COMPATIBILITY_REV ) -// { -// result = SELF_TEST_STATUS_FAILED; -// SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_UI_COMPATIBILITY_ERROR, uiVersion.compatibility, SW_COMPATIBILITY_REV ) -// } + if ( uiVersion.compatibility != SW_COMPATIBILITY_REV ) + { + result = SELF_TEST_STATUS_FAILED; + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_UI_COMPATIBILITY_ERROR, uiVersion.compatibility, SW_COMPATIBILITY_REV ) + } return result; } @@ -548,24 +537,24 @@ SELF_TEST_STATUS_T result = SELF_TEST_STATUS_IN_PROGRESS; // UI should have sent POST results before we start this test -// if ( TRUE == uiPOSTResultReceived ) -// { -// if ( TRUE == uiPOSTPassed ) + if ( TRUE == uiPOSTResultReceived ) + { + if ( TRUE == uiPOSTPassed ) { result = SELF_TEST_STATUS_PASSED; } -// else -// { -// SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_UI_POST_TIMEOUT, 0 ) -// result = SELF_TEST_STATUS_FAILED; -// } -// } -// // If UI had not already sent POST results before we started, allow finite period for UI to send. -// else if ( ++waitForUIPostTimerCtr > POST_UI_MAX_WAIT_TIME ) -// { -// SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_UI_POST_TIMEOUT, 1 ) -// result = SELF_TEST_STATUS_FAILED; -// } + else + { + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_TD_UI_POST_TIMEOUT, 0 ) + result = SELF_TEST_STATUS_FAILED; + } + } + // If UI had not already sent POST results before we started, allow finite period for UI to send. + else if ( ++waitForUIPostTimerCtr > POST_UI_MAX_WAIT_TIME ) + { + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_TD_UI_POST_TIMEOUT, 1 ) + result = SELF_TEST_STATUS_FAILED; + } return result; } Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 -r9fcd1ad071bcce7a592833367c103e235e49654f --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 9fcd1ad071bcce7a592833367c103e235e49654f) @@ -17,6 +17,7 @@ #include "gio.h" +#include "Buttons.h" #include "Messaging.h" #include "ModeFault.h" #include "ModeInitPOST.h" @@ -453,6 +454,34 @@ /*********************************************************************//** * @brief + * The sendConfirmationRequest function sends a confirmation request to UI + * @details /b Inputs: requestID, requestType, rejectReason + * @details /b Outputs: none + * @param requestID ID of confirmation request + * @param requestType Type of confirmation request command + * @param rejectReason Reject reason if applicable + * @return none + *************************************************************************/ +BOOL sendConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, GENERIC_CONFIRM_COMMAND_T requestType, U32 rejectReason ) +{ + GENERIC_CONFIRMATION_REQUEST_T request; + + // Populate request structure + request.requestID = (U32)requestID; + request.requestType = (U32)requestType; + request.rejectReason = rejectReason; + // Optional payload defaults + request.genericPayload1 = 0; + request.genericPayload2 = 0; + request.genericPayload3 = 0; + request.genericPayload4 = 0; + + // Use generic message support helper for transmission. + return sendMessage( MSG_ID_TD_UI_CONFIRMATION_REQUEST, COMM_BUFFER_OUT_CAN_TD_2_UI, (U08 *)&request, (U32)sizeof( GENERIC_CONFIRMATION_REQUEST_T ) ); +} + +/*********************************************************************//** + * @brief * The getConfirmationRequestStatus function returns the status of a confirmation request * @details \b Inputs: confirmRequests[] * @details \b Outputs: confirmRequests[] consumed/cleared if completed. @@ -642,7 +671,67 @@ sendEvent( TD_EVENT_OPERATION_STATUS, dat1, dat2 ); } +/*********************************************************************//** + * @brief + * The handleUIVersionResponse function handles a response to request for + * UI version information. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle. + * @return none + *************************************************************************/ +BOOL handleUIVersionResponse( MESSAGE_T *message ) +{ + BOOL result = TRUE; + // Get UI version data and have it recorded + if ( sizeof(UI_VERSIONS_T) == message->hdr.payloadLen ) + { + UI_VERSIONS_T uiVersion; + memcpy( &uiVersion, &message->payload[0], sizeof(UI_VERSIONS_T) ); + signalUIVersion( uiVersion ); + } + return result; +} + +/*********************************************************************//** + * @brief + * The handleUIConfirmationResponse function handles a UI response for + * confirmation request. + * @details \b Inputs: none + * @details \b Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +BOOL handleUIConfirmationResponse( MESSAGE_T *message ) +{ + BOOL result; + U08* payloadPtr = message->payload; + + if ( message->hdr.payloadLen == 2 * sizeof(U32) ) + { + U32 request_id; + U32 status; + + memcpy( &request_id, payloadPtr, sizeof(U32) ); + payloadPtr += sizeof(U32); + memcpy( &status, payloadPtr, sizeof(U32) ); + if ( CONFIRMATION_REQUEST_STATUS_REJECTED == status ) + { + userConfirmOffButton( OFF_BUTTON_RSP_USER_REJECTS_POWER_OFF ); + } + else if ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == status ) + { + userConfirmOffButton( OFF_BUTTON_RSP_USER_CONFIRMS_POWER_OFF ); + } + setConfirmationRequestStatus( (GENERIC_CONFIRM_ID_T)request_id, (CONFIRMATION_REQUEST_STATUS_T)status ); + } + + result = sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_TD_2_UI, FALSE ); + return result; +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ Index: firmware/App/Modes/OperationModes.h =================================================================== diff -u -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 -r9fcd1ad071bcce7a592833367c103e235e49654f --- firmware/App/Modes/OperationModes.h (.../OperationModes.h) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) +++ firmware/App/Modes/OperationModes.h (.../OperationModes.h) (revision 9fcd1ad071bcce7a592833367c103e235e49654f) @@ -75,6 +75,9 @@ BOOL testSetOperationMode( MESSAGE_T *message ); // Force transition to a given mode (if allowed) BOOL testSetOpModePublishIntervalOverride( MESSAGE_T *message ); // Override op mode data publish interval +BOOL sendConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, GENERIC_CONFIRM_COMMAND_T requestType, U32 rejectReason ); +BOOL handleUIConfirmationResponse( MESSAGE_T *message ); +BOOL handleUIVersionResponse( MESSAGE_T *message ); /**@}*/ Index: firmware/App/Monitors/Buttons.c =================================================================== diff -u -r395522dffef1348e176564925656012f529c1910 -r9fcd1ad071bcce7a592833367c103e235e49654f --- firmware/App/Monitors/Buttons.c (.../Buttons.c) (revision 395522dffef1348e176564925656012f529c1910) +++ firmware/App/Monitors/Buttons.c (.../Buttons.c) (revision 9fcd1ad071bcce7a592833367c103e235e49654f) @@ -47,24 +47,6 @@ NUM_OF_BUTTONS ///< Number of hardware buttons } BUTTON_T; -/// Enumeration of off button commands to UI. -typedef enum OffButtonCmdsToUI -{ - OFF_BUTTON_CMD_PROMPT_USER_TO_CONFIRM = 0, ///< Prompt user to confirm power off command - OFF_BUTTON_CMD_CANCEL_USER_CONFIRM_PROMPT, ///< Cancel user confirm prompt command - OFF_BUTTON_CMD_REJECT_USER_OFF_REQUEST, ///< Reject user off request command - NUM_OF_OFF_BUTTON_CMDS ///< Number of off button commands to UI -} OFF_BUTTON_CMD_T; - -/// Enumeration of off button responses from UI. -typedef enum OffButtonRspsFromUI -{ - OFF_BUTTON_RSP_USER_REQUESTS_POWER_OFF = 0, ///< User requests power off response - OFF_BUTTON_RSP_USER_CONFIRMS_POWER_OFF, ///< User confirms power off response - OFF_BUTTON_RSP_USER_REJECTS_POWER_OFF, ///< User rejects power off response - NUM_OF_OFF_BUTTON_RSPS ///< Number of off button responses from UI -} OFF_BUTTON_RSP_T; - #define OFF_REQUEST_PULSE_COUNT 4 ///< Number of edges for power off sequence on power off output signal. #define OFF_REQUEST_PULSE_INTVL_MS 50 ///< Duration (in ms) of power off sequence steps. #define OFF_REQUEST_DELAY_TIME_MS 2000 ///< Duration (in ms) of delay before power off sequence is initiated to provide sub-systems time to wrap things up. @@ -80,11 +62,11 @@ static OVERRIDE_U32_T dataOffButtonState; ///< Current off button state (overrideable). static BUTTON_STATE_T prevOffButtonState; ///< Previous state of off button. static BOOL offRequestAwaitingUserConfirmation = FALSE; ///< Flag indicates whether a power off request is pending user confirmation. -static U32 offRequestPendingTimer; ///< Timer counter for pending power off request. -static BOOL offButtonPressPending; ///< Flag indicates whether a confirmed power off request is pending execution. -static U32 offRequestPulseCount; ///< Power off sequence step counter. -static U32 offRequestPulseTimer; ///< Power off sequence step timer counter. -static U32 offRequestDelayTimer; ///< Power off sequence delay timer counter. +static volatile U32 offRequestPendingTimer; ///< Timer counter for pending power off request. +static volatile BOOL offButtonPressPending; ///< Flag indicates whether a confirmed power off request is pending execution. +static volatile U32 offRequestPulseCount; ///< Power off sequence step counter. +static volatile U32 offRequestPulseTimer; ///< Power off sequence step timer counter. +static volatile U32 offRequestDelayTimer; ///< Power off sequence delay timer counter. static OVERRIDE_U32_T dataStopButtonState; ///< Current stop button state (overrideable). static BUTTON_STATE_T prevStopButtonState; ///< Previous state of stop button. @@ -299,12 +281,12 @@ offRequestAwaitingUserConfirmation = TRUE; offRequestPendingTimer = 0; #ifndef SIMULATE_UI - sendOffButtonMsgToUI( OFF_BUTTON_CMD_PROMPT_USER_TO_CONFIRM ); + sendOffButtonMsgToUI( GENERIC_CONFIRM_CMD_REQUEST_OPEN ); #endif } else { // Send rejection response to power off request - sendOffButtonMsgToUI( OFF_BUTTON_CMD_REJECT_USER_OFF_REQUEST ); + ;//sendOffButtonMsgToUI( GENERIC_CONFIRM_CMD_REJECT ); } break; @@ -317,8 +299,9 @@ // If we are in a mode that allows power off, initiate power off sequence if ( TRUE == isCurrentOpModeOkToTurnOff() ) { - POWER_OFF_WARNING_DATA_T data; + sendOffButtonMsgToUI( GENERIC_CONFIRM_CMD_ACCEPT_CLOSE ); + POWER_OFF_WARNING_DATA_T data; data.powerOffWarning = 0; broadcastData( MSG_ID_POWER_OFF_WARNING, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08*)&data, sizeof( POWER_OFF_WARNING_DATA_T ) ); @@ -329,12 +312,12 @@ } else { - sendOffButtonMsgToUI( OFF_BUTTON_CMD_REJECT_USER_OFF_REQUEST ); + sendOffButtonMsgToUI( GENERIC_CONFIRM_CMD_REJECT ); } } else { - sendOffButtonMsgToUI( OFF_BUTTON_CMD_REJECT_USER_OFF_REQUEST ); + sendOffButtonMsgToUI( GENERIC_CONFIRM_CMD_REJECT ); } break; @@ -429,7 +412,7 @@ if ( offRequestPendingTimer >= OFF_REQUEST_EXPIRATION_TIME_MS ) { offRequestAwaitingUserConfirmation = FALSE; - sendOffButtonMsgToUI( OFF_BUTTON_CMD_CANCEL_USER_CONFIRM_PROMPT ); + sendOffButtonMsgToUI( GENERIC_CONFIRM_CMD_TIMEOUT_CLOSE ); } } Index: firmware/App/Monitors/Buttons.h =================================================================== diff -u -r395522dffef1348e176564925656012f529c1910 -r9fcd1ad071bcce7a592833367c103e235e49654f --- firmware/App/Monitors/Buttons.h (.../Buttons.h) (revision 395522dffef1348e176564925656012f529c1910) +++ firmware/App/Monitors/Buttons.h (.../Buttons.h) (revision 9fcd1ad071bcce7a592833367c103e235e49654f) @@ -37,6 +37,15 @@ BUTTON_STATE_PRESSED, ///< Button is in the pressed state NUM_OF_BUTTON_STATES ///< Number of button states } BUTTON_STATE_T; + +/// Enumeration of off button responses from UI. +typedef enum OffButtonRspsFromUI +{ + OFF_BUTTON_RSP_USER_REQUESTS_POWER_OFF = 0, ///< User requests power off response + OFF_BUTTON_RSP_USER_CONFIRMS_POWER_OFF, ///< User confirms power off response + OFF_BUTTON_RSP_USER_REJECTS_POWER_OFF, ///< User rejects power off response + NUM_OF_OFF_BUTTON_RSPS ///< Number of off button responses from UI +} OFF_BUTTON_RSP_T; #pragma pack(push,1) /// Payload record structure for an off button confirmation message from the UI. Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 -r9fcd1ad071bcce7a592833367c103e235e49654f --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 9fcd1ad071bcce7a592833367c103e235e49654f) @@ -109,9 +109,9 @@ { MSG_ID_FW_VERSIONS_REQUEST, &handleVersionRequestMessage }, { MSG_ID_UI_CHECK_IN, &handleUICheckIn }, { MSG_ID_DD_OP_MODE_DATA, &setDDOpMode }, + { MSG_ID_UI_VERSION_INFO_RESPONSE, &handleUIVersionResponse }, { MSG_ID_DD_GEN_DIALYSATE_MODE_DATA, &setDialysateData }, { MSG_ID_DD_PRESSURES_DATA, &setDialysatePressure }, - { MSG_ID_OFF_BUTTON_PRESS_REQUEST, &handleOffButtonConfirmMsgFromUI }, { MSG_ID_UI_TREATMENT_PARAMS_TO_VALIDATE, &validateAndSetTreatmentParameters }, { MSG_ID_UI_INITIATE_TREATMENT_WORKFLOW, &signalUserInitiateTreatment }, { MSG_ID_UI_UF_PAUSE_RESUME_REQUEST, &signalPauseResumeUF }, @@ -224,7 +224,6 @@ static MsgFuncPtr getMsgHandler( U16 msgID ); static BOOL sendTestAckResponseMsg( MSG_ID_T msgID, BOOL ack ); -static BOOL sendAckResponseMsg( MSG_ID_T msgID, COMM_BUFFER_T buffer, BOOL ack ); /*********************************************************************//** * @brief @@ -383,7 +382,7 @@ * @param ack TRUE to ACK, FALSE to NAK * @return TRUE if response message successfully queued for transmit, FALSE if not *************************************************************************/ -static BOOL sendAckResponseMsg( MSG_ID_T msgID, COMM_BUFFER_T buffer, BOOL ack ) +BOOL sendAckResponseMsg( MSG_ID_T msgID, COMM_BUFFER_T buffer, BOOL ack ) { BOOL result; MESSAGE_T msg; @@ -510,59 +509,6 @@ return result; } -/*********************************************************************//** - * @brief - * The handleOffButtonConfirmMsgFromUI function handles a response to an - * off button message to the UI. - * @details \b Inputs: none - * @details \b Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -BOOL handleOffButtonConfirmMsgFromUI( MESSAGE_T *message ) -{ - OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T payload; - - if ( message->hdr.payloadLen == sizeof(OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T) ) - { - memcpy( &payload, message->payload, sizeof(OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T) ); - userConfirmOffButton( payload.confirmed ); - } - return TRUE; -} - -/*********************************************************************//** - * @brief - * The handleUIConfirmationResponse function handles a UI response for - * confirmation request. - * @details \b Inputs: none - * @details \b Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -BOOL handleUIConfirmationResponse( MESSAGE_T *message ) -{ - U08* payloadPtr = message->payload; - - if ( message->hdr.payloadLen == 2 * sizeof(U32) ) - { - U32 request_id; - U32 status; - - memcpy( &request_id, payloadPtr, sizeof(U32) ); - payloadPtr += sizeof(U32); - memcpy( &status, payloadPtr, sizeof(U32) ); - - if ( ( CONFIRMATION_REQUEST_STATUS_REJECTED == status ) || ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == status ) ) - { - setConfirmationRequestStatus( (GENERIC_CONFIRM_ID_T)request_id, (CONFIRMATION_REQUEST_STATUS_T)status ); - } - } - - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_TD_2_UI, FALSE ); - return TRUE; -} - // *********************************************************************** // ***************** Message Sending Helper Functions ******************** // *********************************************************************** @@ -615,28 +561,79 @@ * @param prompt 0=prompt user to confirm, 1=cancel prompt, 2=reject user off request * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL sendOffButtonMsgToUI( U08 prompt ) +BOOL sendOffButtonMsgToUI( GENERIC_CONFIRM_COMMAND_T prompt ) { - BOOL result; - MESSAGE_T msg; UI_OFF_BUTTON_RESPONSE_PAYLOAD_T cmd; - + MSG_ID_T msgID = MSG_ID_TD_UI_CONFIRMATION_REQUEST; cmd.userRequest = prompt; + U08 len = 1; + switch ( prompt ) + { + case GENERIC_CONFIRM_CMD_REQUEST_OPEN: + msgID = MSG_ID_TD_POWER_OFF_REQUEST; + break; + case GENERIC_CONFIRM_CMD_TIMEOUT_CLOSE: + case GENERIC_CONFIRM_CMD_REJECT: + case GENERIC_CONFIRM_CMD_ACCEPT_CLOSE: + msgID = MSG_ID_TD_UI_CONFIRMATION_REQUEST; + len = 4; + break; + default: + break; + } + // Use the generic send helper for transmission. + return sendMessage( msgID, COMM_BUFFER_OUT_CAN_TD_2_UI, (U08 *)&cmd, len ); +} +/*********************************************************************//** + * @brief + * The sendUIVersionRequest function constructs a UI version request msg + * to the UI and queues the msg for transmit on the appropriate CAN channel. + * @details /b Inputs: none + * @details /b Outputs: UI version request msg constructed and queued. + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendUIVersionRequest( void ) +{ + BOOL result; + MESSAGE_T msg; + // Create a message record blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_OFF_BUTTON_PRESS_REQUEST; - msg.hdr.payloadLen = sizeof( UI_OFF_BUTTON_RESPONSE_PAYLOAD_T ); + msg.hdr.msgID = MSG_ID_TD_UI_VERSION_INFO_REQUEST; + msg.hdr.payloadLen = 0; - memcpy( &msg.payload, &cmd, sizeof( UI_OFF_BUTTON_RESPONSE_PAYLOAD_T ) ); - // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_TD_2_UI, ACK_REQUIRED ); return result; } +/*********************************************************************//** + * @brief + * The sendRequestForDDResendAlarms function sends out the TD request for + * DG re-send all active alarms. + * @details Inputs: none + * @details Outputs: DD alarms re-send request msg constructed and queued + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendRequestForDDResendAlarms( void ) +{ + BOOL result; + MESSAGE_T msg; + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_TD_DD_ALARMS_REQUEST; + msg.hdr.payloadLen = 0; + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_TD_2_DD, ACK_REQUIRED ); + + return result; +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -786,25 +783,16 @@ *************************************************************************/ BOOL sendPOSTTestResult( TD_POST_STATE_T test, BOOL passed ) { - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; + + U08 payload[ sizeof( BOOL ) + sizeof( U32 ) ]; U32 testID = (U32)test; - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_TD_POST_SINGLE_TEST_RESULT; - msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); + memcpy( payload, &passed, sizeof( BOOL ) ); + memcpy( &payload[ sizeof( BOOL ) ], &testID, sizeof( U32 ) ); - memcpy( payloadPtr, &passed, sizeof( BOOL ) ); - payloadPtr += sizeof( BOOL ); - memcpy( payloadPtr, &testID, sizeof( U32) ); + // Use the generic send helper for transmission. + return sendMessage( MSG_ID_TD_POST_SINGLE_TEST_RESULT, COMM_BUFFER_OUT_CAN_TD_BROADCAST, payload, sizeof( payload ) ); - // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer - result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_TD_BROADCAST, ACK_REQUIRED ); - - return result; - } /*********************************************************************//** @@ -818,21 +806,8 @@ *************************************************************************/ BOOL sendPOSTFinalResult( BOOL passed ) { - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_TD_POST_FINAL_TEST_RESULT; - msg.hdr.payloadLen = sizeof( BOOL ); - - memcpy( payloadPtr, &passed, sizeof( BOOL ) ); - - // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer - result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_TD_BROADCAST, ACK_REQUIRED ); - - return result; + // Use the generic send helper for transmission. + return sendMessage( MSG_ID_TD_POST_FINAL_TEST_RESULT, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08 *)&passed, sizeof( BOOL ) ); } /*********************************************************************//** Index: firmware/App/Services/Messaging.h =================================================================== diff -u -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 -r9fcd1ad071bcce7a592833367c103e235e49654f --- firmware/App/Services/Messaging.h (.../Messaging.h) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) +++ firmware/App/Services/Messaging.h (.../Messaging.h) (revision 9fcd1ad071bcce7a592833367c103e235e49654f) @@ -161,20 +161,21 @@ BOOL handleUICheckIn( MESSAGE_T *message ); BOOL handleTesterLogInRequest( MESSAGE_T *message ); BOOL handleUpdateAvailable( MESSAGE_T *message ); -BOOL handleOffButtonConfirmMsgFromUI( MESSAGE_T *message ); -BOOL handleUIConfirmationResponse( MESSAGE_T *message ); BOOL testTDSoftwareResetRequest( MESSAGE_T *message ); // Test send message helper functions BOOL sendEvent( TD_EVENT_ID_T event, EVENT_DATA_T dat1, EVENT_DATA_T dat2 ); -BOOL sendOffButtonMsgToUI( U08 prompt ); +BOOL sendOffButtonMsgToUI( GENERIC_CONFIRM_COMMAND_T cmd ); BOOL sendPOSTTestResult( TD_POST_STATE_T test, BOOL passed ); BOOL sendPOSTFinalResult( BOOL passed ); +BOOL sendUIVersionRequest( void ); +BOOL sendRequestForDDResendAlarms( void ); BOOL testSetTestConfiguration( MESSAGE_T *message ); BOOL testGetTestConfiguration( MESSAGE_T *message ); BOOL testResetAllTestConfigurations( MESSAGE_T *message ); +BOOL sendAckResponseMsg( MSG_ID_T msgID, COMM_BUFFER_T buffer, BOOL ack ); /**@}*/ Index: firmware/App/Services/SystemCommTD.c =================================================================== diff -u -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 -r9fcd1ad071bcce7a592833367c103e235e49654f --- firmware/App/Services/SystemCommTD.c (.../SystemCommTD.c) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) +++ firmware/App/Services/SystemCommTD.c (.../SystemCommTD.c) (revision 9fcd1ad071bcce7a592833367c103e235e49654f) @@ -24,8 +24,8 @@ #include "Comm.h" #include "Interrupts.h" -#include "Messaging.h" -#include "OperationModes.h" +#include "Messaging.h" +#include "MessageSupport.h" #include "SystemCommTD.h" #include "Timers.h" #include "Utilities.h" @@ -303,42 +303,6 @@ /*********************************************************************//** * @brief - * The sendConfirmationRequest function sends a confirmation request to UI - * @details /b Inputs: requestID, requestType, rejectReason - * @details /b Outputs: none - * @param requestID ID of confirmation request - * @param requestType Type of confirmation request command - * @param rejectReason Reject reason if applicable - * @return none - *************************************************************************/ -void sendConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, GENERIC_CONFIRM_COMMAND_T requestType, U32 rejectReason ) -{ - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - GENERIC_CONFIRMATION_REQUEST_T request; - - // Populate request structure - request.requestID = (U32)requestID; - request.requestType = (U32)requestType; - request.rejectReason = rejectReason; - // Optional payload defaults - request.genericPayload1 = 0; - request.genericPayload2 = 0; - request.genericPayload3 = 0; - request.genericPayload4 = 0; - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_TD_UI_CONFIRMATION_REQUEST; - // Payload size - msg.hdr.payloadLen = sizeof( GENERIC_CONFIRMATION_REQUEST_T ); - // Copy payload - memcpy( payloadPtr,&request, sizeof( GENERIC_CONFIRMATION_REQUEST_T ) ); - // Serialize and send - serializeMessage( msg, COMM_BUFFER_OUT_CAN_TD_2_UI, ACK_REQUIRED ); -} - -/*********************************************************************//** - * @brief * The getInBufferID function gets the incoming communication buffer ID for * a given buffer index. * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if given buffer index is invalid. Index: firmware/App/Services/SystemCommTD.h =================================================================== diff -u -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 -r9fcd1ad071bcce7a592833367c103e235e49654f --- firmware/App/Services/SystemCommTD.h (.../SystemCommTD.h) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) +++ firmware/App/Services/SystemCommTD.h (.../SystemCommTD.h) (revision 9fcd1ad071bcce7a592833367c103e235e49654f) @@ -59,7 +59,6 @@ BOOL isOnlyCANNode( void ); void setOnlyCANNode( BOOL only ); void clearCANXmitBuffers( void ); -void sendConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, GENERIC_CONFIRM_COMMAND_T requestType, U32 rejectReason ); /**@}*/