Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -r9ea1971251bb0064e626c21e7d94215114254a98 -r3321a6fc6f08b731cfe3dafaa618f93b32acaf45 --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 9ea1971251bb0064e626c21e7d94215114254a98) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 3321a6fc6f08b731cfe3dafaa618f93b32acaf45) @@ -318,7 +318,6 @@ currentFPGATimerCount_ms = newFPGATimerCount_ms; currentTimerCount_ms = newTimerCount_ms; - } /*********************************************************************//** Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r9ea1971251bb0064e626c21e7d94215114254a98 -r3321a6fc6f08b731cfe3dafaa618f93b32acaf45 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 9ea1971251bb0064e626c21e7d94215114254a98) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 3321a6fc6f08b731cfe3dafaa618f93b32acaf45) @@ -65,15 +65,15 @@ typedef BOOL (*MsgFuncPtr)( MESSAGE_T* ); /// Message handling function lookup table -static const U16 MSG_FUNCTION_HANDLER_LOOKUP[][2] = { - { MSG_ID_TD_SOFTWARE_RESET_REQUEST, 0 }, - { MSG_ID_TESTER_LOGIN_REQUEST, 1 } +static const U16 MSG_FUNCTION_HANDLER_LOOKUP[] = { + MSG_ID_TESTER_LOGIN_REQUEST, + MSG_ID_TD_SOFTWARE_RESET_REQUEST }; /// Message handling function table static const MsgFuncPtr MSG_FUNCTION_HANDLERS[] = { - &handleTDSoftwareResetRequest, - &handleTesterLogInRequest + &handleTesterLogInRequest, + &handleTDSoftwareResetRequest }; #define NUM_OF_FUNCTION_HANDLERS (sizeof(MSG_FUNCTION_HANDLERS) / sizeof(MsgFuncPtr)) @@ -91,7 +91,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 ); -static BOOL sendUIResponseMsg( MSG_ID_T msgID, BOOL accepted, U32 reason ); /*********************************************************************//** * @brief @@ -271,13 +270,12 @@ static MsgFuncPtr getMsgHandler( U16 msgID ) { U32 i; -// U32 numOfHandlers = sizeof(MSG_FUNCTION_HANDLERS) / sizeof(MsgFuncPtr); - MsgFuncPtr func = 0; + MsgFuncPtr func = 0; // Search for the index associated with the given override command message ID and then use index to get the handling function for ( i = 0; i < NUM_OF_FUNCTION_HANDLERS; i++ ) { - if ( MSG_FUNCTION_HANDLER_LOOKUP[i][0] == msgID ) + if ( MSG_FUNCTION_HANDLER_LOOKUP[i] == msgID ) { func = MSG_FUNCTION_HANDLERS[i]; break; @@ -297,7 +295,7 @@ *************************************************************************/ void handleIncomingMessage( MESSAGE_T *message ) { - BOOL result = FALSE; // assume we will NAK until we have successful handling of message + BOOL ack = FALSE; // assume we will NAK until we have successful handling of message COMM_BUFFER_T respBuffer = tdResponseBuffers[ message->in_buffer ]; // if Dialin message, ensure Dialin is logged in before processing it @@ -310,54 +308,28 @@ msgFuncPtr = getMsgHandler( message->hdr.msgID ); // Ensure a handler is found before calling it if ( msgFuncPtr != 0 ) - { // Call the appropriate override command handling function with the given override parameters - result = (*msgFuncPtr)( message ); + { // Call the appropriate message handling function + ack = (*msgFuncPtr)( message ); } } // ACK/NAK request if ( message->hdr.msgID < MSG_ID_FIRST_TD_TESTER_MESSAGE ) { - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, respBuffer, result ); + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, respBuffer, ack ); } else { - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, ack ); } } -/*********************************************************************//** - * @brief - * The sendUIResponseMsg function constructs an UI response message for a - * handled UI message and queues it for transmit on the appropriate CAN channel. - * @details Inputs: none - * @details Outputs: response message constructed and queued for transmit. - * @param msgID ID of handled message that we are responding to - * @param accepted T/F - request accepted? - * @param reason reason code if rejected - * @return TRUE if response message successfully queued for transmit, FALSE if not - *************************************************************************/ -static BOOL sendUIResponseMsg( MSG_ID_T msgID, BOOL accepted, U32 reason ) -{ - BOOL result; - MESSAGE_T msg; - UI_RESPONSE_PAYLOAD_T cmd; - cmd.accepted = accepted; - cmd.rejectionReason = reason; +// *********************************************************************** +// ***************** Message Handling Helper Functions ******************** +// *********************************************************************** - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = msgID; - msg.hdr.payloadLen = sizeof( UI_RESPONSE_PAYLOAD_T ); - memcpy( &msg.payload, &cmd, sizeof( UI_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; -} - - // *********************************************************************** // ***************** Message Sending Helper Functions ******************** // *********************************************************************** @@ -400,32 +372,7 @@ return result; } -/*********************************************************************//** - * @brief - * The handleTDSoftwareResetRequest function handles a request to reset the - * TD firmware processor. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return FALSE if reset command rejected (won't return if reset successful) - *************************************************************************/ -BOOL handleTDSoftwareResetRequest( MESSAGE_T *message ) -{ - BOOL result = FALSE; - // Verify payload length - if ( 0 == message->hdr.payloadLen ) - { // S/w reset of processor - result = TRUE; // Reset will prevent this from getting transmitted though -#ifndef _VECTORCAST_ - systemREG1->SYSECR = (0x2) << 14; // Reset processor -#endif - } - - return result; -} - - /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -509,10 +456,37 @@ { testerLoggedIn = FALSE; } - // Respond to would be tester + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, testerLoggedIn ); return testerLoggedIn; } +/*********************************************************************//** + * @brief + * The handleTDSoftwareResetRequest function handles a request to reset the + * TD firmware processor. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return FALSE if reset command rejected (won't return if reset successful) + *************************************************************************/ +BOOL handleTDSoftwareResetRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // Verify payload length + if ( 0 == message->hdr.payloadLen ) + { // S/w reset of processor + result = TRUE; // Reset will prevent this from getting transmitted though +#ifndef _VECTORCAST_ + systemREG1->SYSECR = (0x2) << 14; // Reset processor +#endif + } + + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); + + return result; +} + /**@}*/ Index: firmware/App/Tasks/TaskGeneral.c =================================================================== diff -u -rf688e0f8bded1f0a687437e3136cfba8b14f87b6 -r3321a6fc6f08b731cfe3dafaa618f93b32acaf45 --- firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision f688e0f8bded1f0a687437e3136cfba8b14f87b6) +++ firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision 3321a6fc6f08b731cfe3dafaa618f93b32acaf45) @@ -59,11 +59,11 @@ // // Monitor voltages // execVoltagesMonitor(); // -// // Monitor DG -// execDGInterfaceMonitor(); +// // Monitor DD +// execDDInterfaceMonitor(); // -// // Monitor pressure/occlusion sensors -// execPresOccl(); +// // Monitor pressure sensors +// execPressures(); // // // Monitor switches // execSwitches(); @@ -83,17 +83,11 @@ // // Control blood pump // execBloodFlowController(); // -// // Control dialysate inlet pump -// execDialInFlowController(); -// -// // Control dialysate outlet pump (keep after call to BP and DPi controllers) -// execDialOutFlowController(); -// // // Control Air Pump // execAirPumpController(); // -// // Monitor/Control fans -// execFans(); +// // Monitor/Control fan +// execFan(); // // // Manage NVDataMgmt process record state machine // execNVDataMgmtProcessRecord(); Index: firmware/App/Tasks/TaskPriority.c =================================================================== diff -u -r73d8423edc56daed591bc0b3f7baee5540aea423 -r3321a6fc6f08b731cfe3dafaa618f93b32acaf45 --- firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision 73d8423edc56daed591bc0b3f7baee5540aea423) +++ firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision 3321a6fc6f08b731cfe3dafaa618f93b32acaf45) @@ -15,7 +15,7 @@ * ***************************************************************************/ -//#include "FPGA.h" +#include "FPGA.h" #include "SystemCommTD.h" #include "TaskPriority.h" #include "WatchdogMgmt.h" @@ -44,7 +44,7 @@ if ( TRUE == uiCommunicated() ) { // 1st pass for FPGA -// execFPGAIn(); + execFPGAIn(); // Verify processor clock speed against FPGA clock // execFPGAClockSpeedTest(); @@ -72,11 +72,11 @@ // Monitor fluid leak detector // execFluidLeak(); - // Monitor air bubble detectors -// execBubbles(); + // Monitor air bubble detector +// execBubble(); // 2nd pass for FPGA -// execFPGAOut(); + execFPGAOut(); } // Check in with watchdog manager