Index: firmware/.launches/DG.launch =================================================================== diff -u -r79ad3aec7dd37a8acc7ab2391dc9dd806cb9e5cd -rcb586152197059cb52c33474f5b9be0855bbad51 --- firmware/.launches/DG.launch (.../DG.launch) (revision 79ad3aec7dd37a8acc7ab2391dc9dd806cb9e5cd) +++ firmware/.launches/DG.launch (.../DG.launch) (revision cb586152197059cb52c33474f5b9be0855bbad51) @@ -1,5 +1,13 @@ + + + + + + + + @@ -17,4 +25,5 @@ + Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r00b32a5dad2e136d31cfaf0de16f7767b9920fec -rcb586152197059cb52c33474f5b9be0855bbad51 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 00b32a5dad2e136d31cfaf0de16f7767b9920fec) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision cb586152197059cb52c33474f5b9be0855bbad51) @@ -22,6 +22,7 @@ #include "FPGA.h" #include "Heaters.h" #include "ModeInitPOST.h" +#include "NVDataMgmt.h" #include "OperationModes.h" #include "Pressures.h" #include "RTC.h" @@ -153,6 +154,11 @@ break; #endif + case DG_POST_STATE_NVDATAMGMT: + testStatus = execNVDataMgmtSelfTest(); + postState = handlePOSTStatus( testStatus ); + break; + case DG_POST_STATE_WATCHDOG: testStatus = execWatchdogTest(); handlePOSTStatus( testStatus ); // ignoring return value because last test Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -ra6684f5a4c807bf27996b9521c6d0f9f7c85d9f5 -rcb586152197059cb52c33474f5b9be0855bbad51 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision a6684f5a4c807bf27996b9521c6d0f9f7c85d9f5) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision cb586152197059cb52c33474f5b9be0855bbad51) @@ -1204,14 +1204,38 @@ handleTestUVReactorsHealthOverride( message ); break; - case MSG_ID_DG_SET_CALIBRATION_DATA: - handleSetDGCalibration( message ); + case MSG_ID_DG_SET_CALIBRATION_RECORD: + handleSetDGCalibrationRecord( message ); break; - case MSG_ID_DG_GET_CALIBRATION_DATA: - handleGetDGCalibration( message ); + case MSG_ID_DG_GET_CALIBRATION_RECORD: + handleGetDGCalibrationRecord( message ); break; + case MSG_ID_DG_SET_SYSTEM_RECORD: + handleSetDGSystemRecord( message ); + break; + + case MSG_ID_DG_GET_SYSTEM_RECORD: + handleGetDGSystemRecord( message ); + break; + + case MSG_ID_DG_GET_SERVICE_RECORD: + handleGetDGServiceRecord( message ); + break; + + case MSG_ID_DG_SET_SERVICE_RECORD: + handleSetDGServiceRecord( message ); + break; + + case MSG_ID_DG_GET_SCHEDULED_RUNS_RECORD: + handleGetDGScheduledRunsRecord( message ); + break; + + case MSG_ID_DG_SET_SCHEDULED_RUNS_RECORD: + handleSetDGScheduledRunsRecord( message ); + break; + default: // TODO - unrecognized message ID received - ignore break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -ra6684f5a4c807bf27996b9521c6d0f9f7c85d9f5 -rcb586152197059cb52c33474f5b9be0855bbad51 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision a6684f5a4c807bf27996b9521c6d0f9f7c85d9f5) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision cb586152197059cb52c33474f5b9be0855bbad51) @@ -873,17 +873,17 @@ // Create a message record blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_SEND_CALIBRATION_DATA; - msg.hdr.payloadLen = sizeof( payloadCurrNum ) + sizeof( payloadTotalNum ) + sizeof( length ) + length; + msg.hdr.msgID = MSG_ID_DG_SEND_CALIBRATION_RECORD; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; - memcpy( payloadPtr, &payloadCurrNum, sizeof( payloadCurrNum ) ); - payloadPtr += sizeof( payloadCurrNum ); + memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &payloadTotalNum, sizeof( payloadTotalNum ) ); - payloadPtr += sizeof( payloadTotalNum ); + memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &length, sizeof( length ) ); - payloadPtr += sizeof( length ); + memcpy( payloadPtr, &length, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); memcpy( payloadPtr, calRcrdAddress, length ); @@ -893,6 +893,123 @@ return result; } +/*********************************************************************//** + * @brief + * The sendDGSystemRecord function sends out the DG system record. + * @details Inputs: none + * @details Outputs: DG system record msg constructed and queued + * @param msgCurrNum: current payload number + * @param msgTotalNum: total number of payloads + * @param length: buffer length to be written + * @param sysRcrdAddress: start address of the system record + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendDGSystemRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* sysRcrdAddress ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_SEND_SYSTEM_RECORD; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; + + memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &length, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, sysRcrdAddress, length ); + + // 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_PC, ACK_NOT_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The sendDGServiceRecord function sends out the DG service record. + * @details Inputs: none + * @details Outputs: DG system record msg constructed and queued + * @param msgCurrNum: current payload number + * @param msgTotalNum: total number of payloads + * @param length: buffer length to be written + * @param srvcRcrdAddress: start address of the service record + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendDGServiceRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* srvcRcrdAddress ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_SEND_SERVICE_RECORD; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; + + memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &length, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, srvcRcrdAddress, length ); + + // 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_PC, ACK_NOT_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The sendDGServiceRecord function sends out the DG service record. + * @details Inputs: none + * @details Outputs: DG system record msg constructed and queued + * @param msgCurrNum: current payload number + * @param msgTotalNum: total number of payloads + * @param length: buffer length to be written + * @param scheduledRcrdAddress: start address of the scheduled runs record + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendDGScheduledRunsRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* scheduledRcrdAddress ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_SEND_SCHEDULED_RUNS_RECORD; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; + + memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &length, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, scheduledRcrdAddress, length ); + + // 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_PC, ACK_NOT_REQUIRED ); + + return result; +} + // *********************************************************************** // **************** Message Handling Helper Functions ******************** // *********************************************************************** @@ -2415,46 +2532,46 @@ /*********************************************************************//** * @brief -* The handleSetDGCalibration function handles a request to set the DG +* The handleSetDGCalibrationRecord function handles a request to set the DG * calibration data record. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -void handleSetDGCalibration( MESSAGE_T *message ) +void handleSetDGCalibrationRecord( MESSAGE_T *message ) { BOOL status = FALSE; U08* payloadPtr = message->payload; U32 currentMessage; U32 totalMessages; U32 payloadLength; - memcpy(¤tMessage, payloadPtr, sizeof(currentMessage)); - payloadPtr += sizeof(currentMessage); + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - memcpy(&totalMessages, payloadPtr, sizeof(totalMessages)); - payloadPtr += sizeof(totalMessages); + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - memcpy(&payloadLength, payloadPtr, sizeof(payloadLength)); - payloadPtr += sizeof(payloadLength); + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - status = setDGCalibrationRecord( currentMessage, totalMessages, payloadLength, payloadPtr ); + status = setCalibrationRecord( currentMessage, totalMessages, payloadLength, payloadPtr ); - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } /*********************************************************************//** * @brief -* The handleGetDGCalibration function handles a request to get the DG +* The handleGetDGCalibrationRecord function handles a request to get the DG * calibration data record. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -void handleGetDGCalibration( MESSAGE_T *message ) +void handleGetDGCalibrationRecord( MESSAGE_T *message ) { BOOL result = FALSE; @@ -2464,12 +2581,189 @@ // Tester must be logged in if ( TRUE == isTestingActivated() ) { - getDGCalibrationRecord(); + result = getCalibrationRecord(); } } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** +* @brief +* The handleSetDGSystemRecord function handles a request to set the DG +* system data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetDGSystemRecord( MESSAGE_T *message ) +{ + BOOL status = FALSE; + U08* payloadPtr = message->payload; + U32 currentMessage; + U32 totalMessages; + U32 payloadLength; + + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + status = setSystemRecord( currentMessage, totalMessages, payloadLength, payloadPtr ); + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + +/*********************************************************************//** +* @brief +* The handleGetDGSystemRecord function handles a request to get the DG +* system data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleGetDGSystemRecord( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + // Tester must be logged in + if ( TRUE == isTestingActivated() ) + { + result = getSystemRecord(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleGetDGServiceRecord function handles a request to get the DG +* last service data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleGetDGServiceRecord( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + // Tester must be logged in + if ( TRUE == isTestingActivated() ) + { + result = getServiceRecord(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleSetDGServiceRecord function handles a request to set the DG +* service data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetDGServiceRecord( MESSAGE_T *message ) +{ + BOOL status = FALSE; + U08* payloadPtr = message->payload; + U32 currentMessage; + U32 totalMessages; + U32 payloadLength; + + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + status = setServiceRecord( currentMessage, totalMessages, payloadLength, payloadPtr ); + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + +/*********************************************************************//** +* @brief +* The handleGetDGServiceRecord function handles a request to get the DG +* scheduled runs data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleGetDGScheduledRunsRecord( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + // Tester must be logged in + if ( TRUE == isTestingActivated() ) + { + result = getScheduledRunsRecord(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleSetDGScheduledRunsRecord function handles a request to set the DG +* scheduled runs data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetDGScheduledRunsRecord( MESSAGE_T *message ) +{ + BOOL status = FALSE; + U08* payloadPtr = message->payload; + U32 currentMessage; + U32 totalMessages; + U32 payloadLength; + + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + status = setScheduledRunsRecord( currentMessage, totalMessages, payloadLength, payloadPtr ); + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + /**@}*/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -ra6684f5a4c807bf27996b9521c6d0f9f7c85d9f5 -rcb586152197059cb52c33474f5b9be0855bbad51 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision a6684f5a4c807bf27996b9521c6d0f9f7c85d9f5) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision cb586152197059cb52c33474f5b9be0855bbad51) @@ -129,6 +129,15 @@ // MSG_ID_DG_SEND_CALIBRATION_DATA BOOL sendDGCalibrationRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* calRcrdAddress ); +// MSG_ID_DG_SEND_SYSTEM_RECORD +BOOL sendDGSystemRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* sysRcrdAddress ); + +// MSG_ID_DG_SEND_SERVICE_RECORD +BOOL sendDGServiceRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* srvcRcrdAddress ); + +// MSG_ID_DG_SEND_SCHEDULED_RUNS_RECORD +BOOL sendDGScheduledRunsRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* scheduledRcrdAddress ); + // *********** public test support message functions ********** #ifdef DEBUG_ENABLED @@ -261,11 +270,29 @@ void handleROPumpTargetPressureOverride( MESSAGE_T *message ); // MSG_ID_DG_SET_CALIBRATION_DATA -void handleSetDGCalibration( MESSAGE_T *message ); +void handleSetDGCalibrationRecord( MESSAGE_T *message ); // MSG_ID_DG_GET_CALIBRATION_DATA -void handleGetDGCalibration( MESSAGE_T *message ); +void handleGetDGCalibrationRecord( MESSAGE_T *message ); +// MSG_ID_DG_SET_SYSTEM_DATA +void handleSetDGSystemRecord( MESSAGE_T *message ); + +// MSG_ID_DG_GET_SYSTEM_DATA +void handleGetDGSystemRecord( MESSAGE_T *message ); + +// MSG_ID_DG_GET_SERVICE_RECORD +void handleGetDGServiceRecord( MESSAGE_T *message ); + +// MSG_ID_DG_SET_SERVICE_RECORD +void handleSetDGServiceRecord( MESSAGE_T *message ); + +// MSG_ID_DG_GET_SCHEDULED_RUNS_RECORD +void handleGetDGScheduledRunsRecord( MESSAGE_T *message ); + +// MSG_ID_DG_SET_SCHEDULED_RUNS_RECORD +void handleSetDGScheduledRunsRecord( MESSAGE_T *message ); + /**@}*/ #endif Index: firmware/App/Tasks/TaskGeneral.c =================================================================== diff -u -ra6684f5a4c807bf27996b9521c6d0f9f7c85d9f5 -rcb586152197059cb52c33474f5b9be0855bbad51 --- firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision a6684f5a4c807bf27996b9521c6d0f9f7c85d9f5) +++ firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision cb586152197059cb52c33474f5b9be0855bbad51) @@ -25,7 +25,8 @@ #include "NVDataMgmt.h" #include "OperationModes.h" #include "Reservoirs.h" -#include "ROPump.h" +#include "ROPump.h" +#include "RTC.h" #include "SystemComm.h" #include "SystemCommMessages.h" #include "TaskGeneral.h" @@ -72,8 +73,11 @@ checkInWithWatchdogMgmt( TASK_GENERAL ); // do this first to keep timing consistent with watchdog management // manage data received from other sub-systems - execSystemCommRx(); + execSystemCommRx(); + // Control and monitor RTC + execRTC(); + // monitor concentrate pumps //execConcentratePumpMonitor(); @@ -109,7 +113,7 @@ execOperationModes(); // Run non-volatile data management calibration state machine - execNVDataMgmtCalibration(); + execNVDataMgmtProcessRecord(); // manage data to be transmitted to other sub-systems execSystemCommTx(); Index: firmware/App/Tasks/TaskPriority.c =================================================================== diff -u -ra6684f5a4c807bf27996b9521c6d0f9f7c85d9f5 -rcb586152197059cb52c33474f5b9be0855bbad51 --- firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision a6684f5a4c807bf27996b9521c6d0f9f7c85d9f5) +++ firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision cb586152197059cb52c33474f5b9be0855bbad51) @@ -25,7 +25,7 @@ #include "InternalADC.h" #include "LoadCell.h" #include "Pressures.h" -#include "ROPump.h" +#include "ROPump.h" #include "TaskPriority.h" #include "TemperatureSensors.h" #include "Valves.h"