Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rdcd360fb4dc37db2dcbeb7fb14fb327fe68235f4 -r604d8aaceeb8e0b650ac2054644333fc7717bb51 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision dcd360fb4dc37db2dcbeb7fb14fb327fe68235f4) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 604d8aaceeb8e0b650ac2054644333fc7717bb51) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2022 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file SystemCommMessages.c * * @author (last) Dara Navaei -* @date (last) 11-Nov-2021 +* @date (last) 31-Mar-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -20,11 +20,13 @@ #include "reg_system.h" #include "Accel.h" +#include "Compatible.h" #include "ConcentratePumps.h" #include "ConductivitySensors.h" #include "Fans.h" #include "FPGA.h" #include "Heaters.h" +#include "ModeFill.h" #include "ModeFlush.h" #include "ModeGenIdle.h" #include "ModeInitPOST.h" @@ -54,10 +56,6 @@ // ********** private definitions ********** -#ifdef DEBUG_ENABLED - #define DEBUG_EVENT_MAX_TEXT_LEN 40 -#endif - #define MAX_MSGS_BLOCKED_FOR_XMIT 8 ///< Maximum number of messages to block transmission for. #pragma pack(push,1) @@ -108,7 +106,7 @@ data[ msgSize++ ] = MESSAGE_SYNC_BYTE; // set sequence # and ACK bit (unless this is an ACK to a received message) - if ( msg.hdr.msgID != MSG_ID_ACK ) + if ( msg.hdr.msgID != MSG_ID_ACK_MESSAGE_THAT_REQUIRES_ACK ) { // thread protect next sequence # access & increment _disable_IRQ(); @@ -181,7 +179,7 @@ // send ACK back with same seq. #, but w/o ACK bit msg.hdr.seqNo = message->hdr.seqNo * -1; // ACK messages always have this ID - msg.hdr.msgID = MSG_ID_ACK; + msg.hdr.msgID = MSG_ID_ACK_MESSAGE_THAT_REQUIRES_ACK; // ACK messages always have no payload msg.hdr.payloadLen = 0; @@ -283,17 +281,26 @@ BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; + U32 data; // create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_ALARM_TRIGGERED; - msg.hdr.payloadLen = sizeof( U32 ) + sizeof( ALARM_DATA_T ) + sizeof( ALARM_DATA_T ); + msg.hdr.payloadLen = sizeof( U32 ) * 5; memcpy( payloadPtr, &alarm, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &almData1, sizeof( ALARM_DATA_T ) ); - payloadPtr += sizeof( ALARM_DATA_T ); - memcpy( payloadPtr, &almData2, sizeof( ALARM_DATA_T ) ); + data = (U32)almData1.dataType; + memcpy( payloadPtr, &data, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + data = almData1.data.uInt.data; + memcpy( payloadPtr, &data, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + data = (U32)almData2.dataType; + memcpy( payloadPtr, &data, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + data = almData2.data.uInt.data; + memcpy( payloadPtr, &data, sizeof( U32 ) ); // 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_DG_ALARM, ACK_REQUIRED ); @@ -417,15 +424,15 @@ { BOOL result = FALSE; - if ( message->hdr.payloadLen == sizeof( TARGET_TEMPS_PAYLOAD_T ) ) + if ( message->hdr.payloadLen == sizeof( DG_CMD_DIALYSATE_HEATING_PARAMS_T ) ) { - TARGET_TEMPS_PAYLOAD_T payload; + DG_CMD_DIALYSATE_HEATING_PARAMS_T payload; result = TRUE; - memcpy( &payload, message->payload, sizeof( TARGET_TEMPS_PAYLOAD_T ) ); - setHeaterTargetTemperature( DG_PRIMARY_HEATER, payload.targetPrimaryHeaterTemp ); - setHeaterTargetTemperature( DG_TRIMMER_HEATER, payload.targetTrimmerHeaterTemp ); + memcpy( &payload, message->payload, sizeof( DG_CMD_DIALYSATE_HEATING_PARAMS_T ) ); + setDialysateHeatingParameters( payload ); } + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } @@ -448,6 +455,7 @@ payload.minor = (U08)DG_VERSION_MINOR; payload.micro = (U08)DG_VERSION_MICRO; payload.build = (U16)DG_VERSION_BUILD; + payload.compatibilityRev = (U32)SW_COMPATIBILITY_REV; getFPGAVersions( &payload.fpgaId, &payload.fpgaMajor, &payload.fpgaMinor, &payload.fpgaLab ); // create a message record @@ -473,7 +481,12 @@ void handleDGSerialNumberRequest( void ) { MESSAGE_T msg; - DG_SYSTEM_RECORD_T system = getDGSystemRecord(); + DG_SYSTEM_RECORD_T system; + + // Get the system's record. There are no arrays of system to check and also, raise no alarm since the system record + // has been already checked in POST + getNVRecord2Driver( GET_SYS_RECORD, (U08*)&system, sizeof( DG_SYSTEM_RECORD_T ), 0, ALARM_ID_NO_ALARM ); + U08 *payloadPtr = msg.payload; // Create a message record @@ -504,25 +517,67 @@ void handleDGServiceScheduleRequest( MESSAGE_T *message ) { MESSAGE_T msg; - DG_SERVICE_RECORD_T payload = getDGServiceRecord(); + DG_SERVICE_RECORD_T service; + + // Get the service record. There are no arrays of service to check and also, raise no alarm since the service record + // has been already checked in POST + getNVRecord2Driver( GET_SRV_RECORD, (U08*)&service, sizeof( DG_SERVICE_RECORD_T ), 0, ALARM_ID_NO_ALARM ); + U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_SERVICE_SCHEDULE_DATA; + msg.hdr.msgID = MSG_ID_DG_SERVICE_SCHEDULE_DATA; msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); // Fill message payload - memcpy( payloadPtr, &payload.lastServiceEpochDate, sizeof( U32 ) ); + memcpy( payloadPtr, &service.lastServiceEpochDate, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &payload.serviceIntervalSeconds, sizeof( U32 ) ); + memcpy( payloadPtr, &service.serviceIntervalSeconds, sizeof( U32 ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_2_UI, ACK_REQUIRED ); } /*********************************************************************//** * @brief + * The handleDGSendConcentrateMixingRatios function handles a request for DG + * mixing ratios. + * @details Inputs: none + * @details Outputs: message handled, response constructed and queued for + * transmit. + * @return none + *************************************************************************/ +void handleDGSendConcentrateMixingRatios( MESSAGE_T *message ) +{ + MESSAGE_T msg; + + DG_ACID_CONCENTRATES_RECORD_T acid = getAcidConcentrateCalRecord(); + DG_BICARB_CONCENTRATES_RECORD_T bicarb = getBicarbConcentrateCalRecord(); + // By the time these are requested, the prepare time is no longer needed since the concentrate lines are + // primed before the actual treatment starts + U32 fillPrepTimeMS = 0; + + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_CONCENTRATE_MIXING_RATIOS_DATA; + msg.hdr.payloadLen = sizeof( F32 ) + sizeof( F32 ) + sizeof( U32 ); + + // Fill message payload + memcpy( payloadPtr, &acid.acidConcentrate[ CAL_DATA_ACID_CONCENTRATE_1 ].acidConcMixRatio, sizeof( F32 ) ); + payloadPtr += sizeof( F32 ); + memcpy( payloadPtr, &bicarb.bicarbConcentrate[ CAL_DATA_BICARB_CONCENTRATE_1 ].bicarbConcMixRatio, sizeof( F32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &fillPrepTimeMS, sizeof( U32 ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_2_HD, ACK_REQUIRED ); +} + +/*********************************************************************//** + * @brief * The sendDGCalibrationRecord function sends out the DG calibration * record. * @details Inputs: none @@ -561,7 +616,6 @@ return result; } - /*********************************************************************//** * @brief * The sendDGSystemRecord function sends out the DG system record. @@ -742,6 +796,76 @@ /*********************************************************************//** * @brief + * The sendDGSWConfigRecord function sends out the DG software configuration record. + * @details Inputs: none + * @details Outputs: DG software configuration record msg constructed and queued + * @param msgCurrNum: current payload number + * @param msgTotalNum: total number of payloads + * @param length: buffer length to be written + * @param swRcrdAddress: start address of the software configuration record + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendDGSWConfigRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* swRcrdAddress ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_SEND_SW_CONFIG_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, swRcrdAddress, 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 handleDGScheduledRunsRequest function handles a request for DG + * scheduled runs information. + * @details Inputs: none + * @details Outputs: message handled, response constructed and queued for + * transmit. + * @return none + *************************************************************************/ +void handleDGScheduledRunsRequest( MESSAGE_T *message ) +{ + MESSAGE_T msg; + DG_SCHEDULED_RUN_RECORD_T scheduledService; + + // Get the service record. There are no arrays of service to check and also, raise no alarm since the service record + // has been already checked in POST + getNVRecord2Driver( GET_SRR_RECORD, (U08*)&scheduledService, sizeof( DG_SCHEDULED_RUN_RECORD_T ), 0, ALARM_ID_NO_ALARM ); + + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_SCHEDULED_RUNS_DATA; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); + + // TODO this message is for Phase 1B. + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_2_UI, ACK_REQUIRED ); +} + +/*********************************************************************//** + * @brief * The sendCommandResponseMsg function constructs a command response to HD * and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none @@ -841,7 +965,7 @@ if ( DG_CMD_START == fillCmd.cmd ) { - startFillCmd( fillCmd.fillToVolumeMl ); + startFillCmd( fillCmd.fillToVolumeMl, fillCmd.targetFlowLPM ); } else { @@ -1032,56 +1156,6 @@ * TEST SUPPORT FUNCTIONS *************************************************************************/ -#ifdef DEBUG_ENABLED - /*********************************************************************//** - * @brief - * The sendDebugData function sends debug data out to the PC port. - * @details - * @details Inputs: none - * @details Outputs: PC serial port - * @param dbgData Pointer to debug data - * @param len number of bytes of debug data - * @return TRUE if debug data was successfully queued for transmit, FALSE if not - *************************************************************************/ - BOOL sendDebugData( U08 *dbgData, U32 len ) - { - BOOL result; - - // add serialized message data to appropriate comm buffer - result = addToCommBuffer( COMM_BUFFER_OUT_UART_PC, dbgData, len ); - - return result; - } - - /*********************************************************************//** - * @brief - * The sendDebugDataToUI function sends debug string to the UI for logging. - * @details - * @details Inputs: none - * @details Outputs: Message constructed and queued for transmit - * @param str Pointer to debug string - * @return none - *************************************************************************/ - void sendDebugDataToUI( U08 *str ) - { - MESSAGE_T msg; - U32 txtLen = strlen( (char*)str ); - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_DEBUG_EVENT; - msg.hdr.payloadLen = DEBUG_EVENT_MAX_TEXT_LEN + 1; // add 1 byte for null terminator - if ( txtLen <= DEBUG_EVENT_MAX_TEXT_LEN ) - { - memcpy( payloadPtr, str, txtLen + 1 ); - - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer - serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_2_UI, ACK_NOT_REQUIRED ); - } - } -#endif - /*********************************************************************//** * @brief * The isTestingActivated function determines whether a tester has successfully @@ -1702,12 +1776,14 @@ BOOL result = FALSE; // verify payload length - if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) + if ( 0 == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); if ( FALSE == payload.reset ) { - result = testSetSafetyShutdownOverride( payload.state.u32 ); + U32 command = 1; + + result = testSetSafetyShutdownOverride( command ); } else { @@ -2696,7 +2772,7 @@ memcpy(&payloadLength, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); - status = setCalibrationRecord( currentMessage, totalMessages, payloadLength, payloadPtr ); + status = receiveRecordFromDialin( NVDATAMGMT_CALIBRATION_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); @@ -2756,7 +2832,7 @@ // Tester must be logged in if ( TRUE == isTestingActivated() ) { - result = getCalibrationRecord(); + result = sendRecordToDialin( NVDATAMGMT_CALIBRATION_RECORD ); } } @@ -2790,7 +2866,7 @@ memcpy(&payloadLength, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); - status = setSystemRecord( currentMessage, totalMessages, payloadLength, payloadPtr ); + status = receiveRecordFromDialin( NVDATAMGMT_SYSTEM_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); @@ -2815,7 +2891,7 @@ // Tester must be logged in if ( TRUE == isTestingActivated() ) { - result = getSystemRecord(); + result = sendRecordToDialin( NVDATAMGMT_SYSTEM_RECORD ); } } @@ -2842,7 +2918,7 @@ // Tester must be logged in if ( TRUE == isTestingActivated() ) { - result = getServiceRecord(); + result = sendRecordToDialin( NVDATAMGMT_SERVICE_RECORD ); } } @@ -2876,7 +2952,7 @@ memcpy(&payloadLength, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); - status = setServiceRecord( currentMessage, totalMessages, payloadLength, payloadPtr ); + status = receiveRecordFromDialin( NVDATAMGMT_SERVICE_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); @@ -2901,7 +2977,7 @@ // Tester must be logged in if ( TRUE == isTestingActivated() ) { - result = getScheduledRunsRecord(); + result = sendRecordToDialin( NVDATAMGMT_SCHEDULED_RUNS_RECORD ); } } @@ -2935,7 +3011,7 @@ memcpy(&payloadLength, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); - status = setScheduledRunsRecord( currentMessage, totalMessages, payloadLength, payloadPtr ); + status = receiveRecordFromDialin( NVDATAMGMT_SCHEDULED_RUNS_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); @@ -3176,4 +3252,227 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** + * @brief + * The handleTestFansRPMAlarmStartTimeOverrideRequest function handles a + * request to override the fan RPM alarm start time. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestFansRPMAlarmStartTimeOffsetOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + + if ( FALSE == payload.reset ) + { + result = testSetFanRPMAlarmStartTimeOffsetOverride( payload.state.u32 ); + } + else + { + result = testResetFanRPMAlarmStartTimeOffsetOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestUsedAcidVolumeMLOverrideRequest function handles a + * request to override the acid volume. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestUsedAcidVolumeMLOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetUsedAcidVolumeMLOverride( payload.state.f32 ); + } + else + { + result = testResetUsedAcidVolumeMLOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} +/*********************************************************************//** +* The handleSetFansDutyCycleOverrideRequest function handles a +* request to override the fans duty cycle. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetFansDutyCycleOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + + if ( FALSE == payload.reset ) + { + result = testSetFansDutyCycleOverride( payload.state.f32 ); + } + else + { + result = testResetFansDutyCycleOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestUsedBicarbVolumeMLOverrideRequest function handles a + * request to override the used bicarb volume. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestUsedBicarbVolumeMLOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetUsedBicarbVolumeMLOverride( payload.state.f32 ); + } + else + { + result = testResetUsedBicarbVolumeMLOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleGetDGSoftwareConfigRecord function handles a request to get the DG +* software configuration record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleGetDGSoftwareConfigRecord( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + // Tester must be logged in + if ( TRUE == isTestingActivated() ) + { + result = sendRecordToDialin( NVDATAMGMT_SW_CONFIG_RECORD ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleSetDGSoftwareConfigRecord function handles a request to set the DG +* software configuration record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetDGSoftwareConfigRecord( MESSAGE_T *message ) +{ + U32 currentMessage; + U32 totalMessages; + U32 payloadLength; + + BOOL status = FALSE; + U08* payloadPtr = message->payload; + + if ( message->hdr.payloadLen >= ( sizeof(currentMessage) + sizeof(totalMessages) + sizeof(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 = receiveRecordFromDialin( NVDATAMGMT_SW_CONFIG_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + +/*********************************************************************//** + * @brief + * The handleTestHDCommunicationStatusOverrideRequest function handles a request + * request to override the HD Communication Status. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestHDCommunicationStatusOverrideRequest(MESSAGE_T *message) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) + { + result = testSetHDCommunicationStatus(payload.state.u32); + } + else + { + result = testResetHDCommuncationStatus(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/