Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r3b84fc79b2fd6c7a447e54e4fe821447f613af59 -rbe1ff666dbd2ff03342c22c8e50b21d0f9b988a9 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 3b84fc79b2fd6c7a447e54e4fe821447f613af59) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision be1ff666dbd2ff03342c22c8e50b21d0f9b988a9) @@ -125,6 +125,20 @@ { MSG_ID_DD_SOFTWARE_RESET_REQUEST, &handleDDSoftwareResetRequest }, { MSG_ID_TD_OP_MODE_DATA, &handleSetTDOperationMode }, { MSG_ID_FFU_SIGNAL_DD_UPDATE_AVAILABLE, &handleUpdateAvailable }, + { MSG_ID_UI_DD_NVM_GET_RECORD_REQUEST, &handleDDGetNVRecord }, + { MSG_ID_UI_DD_NVM_SET_SYSTEM_RECORD_REQUEST, &handleDDSetNVSystemRecord }, + { MSG_ID_UI_DD_NVM_SET_SERVICE_RECORD_REQUEST, &handleDDSetNVServiceRecord }, + { MSG_ID_UI_DD_NVM_SET_INSTITUTIONAL_RECORD_REQUEST, &handleDDSetNVInstitutionalRecord }, + { MSG_ID_UI_DD_NVM_SET_USAGE_INFO_RECORD_REQUEST, &handleDDSetNVUsageInfoRecord }, + { MSG_ID_UI_DD_NVM_SET_CAL_PRESSURE_SENSOR_REQUEST, &handleDDSetPressureSensorCalRecord }, + { MSG_ID_UI_DD_NVM_SET_CAL_TEMP_SENSOR_REQUEST, &handleDDSetTempSensorCalRecord }, + { MSG_ID_UI_DD_NVM_SET_CAL_CONC_PUMP_REQUEST, &handleDDSetConcPumpCalRecord }, + { MSG_ID_UI_DD_NVM_SET_CAL_D12_PUMP_REQUEST, &handleDDSetD12PumpCalRecord }, + { MSG_ID_UI_DD_NVM_SET_CAL_D48_PUMP_REQUEST, &handleDDSetD48CalRecord }, + { MSG_ID_UI_DD_NVM_SET_CAL_ACID_CONCENTRATE_REQUEST, &handleDDSetAcidConcCalRecord }, + { MSG_ID_UI_DD_NVM_SET_CAL_BICARB_CONCENTRATE_REQUEST, &handleDDSetBicarbConcCalRecord }, + { MSG_ID_UI_DD_NVM_SET_CAL_ACCEL_SENSOR_REQUEST, &handleDDSetAccelSensorCalRecord }, + { MSG_ID_UI_DD_NVM_SET_CAL_BLOOD_LEAK_SENSOR_REQUEST, &handleDDSetBloodLeakSensorCalRecord }, { MSG_ID_DD_VALVE_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testValvesStatesPublishIntervalOverride }, { MSG_ID_DD_VALVE_STATE_OVERRIDE_REQUEST, &testValveStateOverride }, { MSG_ID_DD_VALVE_SENSED_STATE_OVERRIDE_REQUEST, &testValveSensedStateOverride }, @@ -262,21 +276,7 @@ { MSG_ID_DD_BICARB_CHAMBER_FILL_REQUEST_OVERRIDE_REQUEST, &testBiCarbChamberFillRequestOverride }, { MSG_ID_DD_BICART_DRAIN_REQUEST_OVERRIDE_REQUEST, &testDryBiCartDrainRequestOverride }, { MSG_ID_DD_BICART_CARTRIDGE_SELECT_OVERRIDE_REQUEST, &testDryBiCartTypeOverride }, - { MSG_ID_UI_DD_NVM_GET_RECORD_REQUEST, &testDDGetNVRecord }, - { MSG_ID_UI_DD_NVM_SET_SYSTEM_RECORD_REQUEST, &testDDSetNVSystemRecord }, - { MSG_ID_UI_DD_NVM_SET_SERVICE_RECORD_REQUEST, &testDDSetNVServiceRecord }, - { MSG_ID_UI_DD_NVM_SET_INSTITUTIONAL_RECORD_REQUEST, &testDDSetNVInstitutionalRecord }, - { MSG_ID_UI_DD_NVM_SET_USAGE_INFO_RECORD_REQUEST, &testDDSetNVUsageInfoRecord }, - { MSG_ID_UI_DD_NVM_SET_CAL_PRESSURE_SENSOR_REQUEST, &testDDSetPressureSensorCalRecord }, - { MSG_ID_UI_DD_NVM_SET_CAL_TEMP_SENSOR_REQUEST, &testDDSetTempSensorCalRecord }, - { MSG_ID_UI_DD_NVM_SET_CAL_CONC_PUMP_REQUEST, &testDDSetConcPumpCalRecord }, - { MSG_ID_UI_DD_NVM_SET_CAL_D12_PUMP_REQUEST, &testDDSetD12PumpCalRecord }, - { MSG_ID_UI_DD_NVM_SET_CAL_D48_PUMP_REQUEST, &testDDSetD48CalRecord }, - { MSG_ID_UI_DD_NVM_SET_CAL_ACID_CONCENTRATE_REQUEST, &testDDSetAcidConcCalRecord }, - { MSG_ID_UI_DD_NVM_SET_CAL_BICARB_CONCENTRATE_REQUEST, &testDDSetBicarbConcCalRecord }, - { MSG_ID_UI_DD_NVM_SET_CAL_ACCEL_SENSOR_REQUEST, &testDDSetAccelSensorCalRecord }, - { MSG_ID_UI_DD_NVM_SET_CAL_BLOOD_LEAK_SENSOR_REQUEST, &testDDSetBloodLeakSensorCalRecord }, - { MSG_ID_DD_NVM_RECORD_CRC_OVERRIDE_REQUEST, &testDDSetNVUsageInfoRecord }, + { MSG_ID_DD_NVM_RECORD_CRC_OVERRIDE_REQUEST, &testSetNVRecordCRCOverride }, { MSG_ID_FP_RO_REJECTION_RATIO_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testRORejectionRatioDataPublishIntervalOverride }, { MSG_ID_FP_RO_FILTERED_REJECTION_RATIO_OVERRIDE_REQUEST, &testRORejectionRatioFilteredOverride }, { MSG_ID_FP_SET_TEST_CONFIGURATION, &testSetTestConfiguration }, Index: firmware/App/Services/NVMessagingDD.c =================================================================== diff -u -r85a1a996c5aa992bcea51577bde28b1f54ccc476 -rbe1ff666dbd2ff03342c22c8e50b21d0f9b988a9 --- firmware/App/Services/NVMessagingDD.c (.../NVMessagingDD.c) (revision 85a1a996c5aa992bcea51577bde28b1f54ccc476) +++ firmware/App/Services/NVMessagingDD.c (.../NVMessagingDD.c) (revision be1ff666dbd2ff03342c22c8e50b21d0f9b988a9) @@ -53,12 +53,20 @@ NUM_OF_NVM_RECEIVE_RECORD_STATES ///< Number of NVM receive record. } RECEIVE_RECORD_STATE_T; +#pragma pack(push, 1) + +/// DD NVM Get Record Request Payload +typedef struct +{ + U08 recType; ///< Enum of type of record requested +} DD_GET_NVM_RECORD_PAYLOAD_T; + /// DD NVM Record Payload typedef struct { U08 idx; ///< Index of sensor / pump / concentrates U08 data[ NUM_OF_BYTES_PER_RECORD_PAYLOAD ]; ///< Data to be sent -} DD_NVM_SEND_RECORD_PAYLOAD_T; +} DD_NVM_RECORD_PAYLOAD_T; /// DD NVM Record Payload for Institutional data of type U32 typedef struct @@ -95,6 +103,8 @@ DD_BICARB_CONCENTRATE_T data; ///< Data to be sent } DD_NVM_BICARB_CONC_CAL_REC_PAYLOAD_T; +#pragma pack(pop) + // ********** private data ********** static SEND_RECORD_STATE_T nvMExecSendRecordState; ///< NVM exec process record state. @@ -326,38 +336,38 @@ { SEND_RECORD_STATE_T state = NVM_SEND_RECORD_STATE_SEND; - // If it is time to send data - if ( ++recordSendDataIntervalCounter >= RECORD_DATA_SEND_INTERVAL_COUNT ) + // If it is time to send data + if ( ++recordSendDataIntervalCounter >= RECORD_DATA_SEND_INTERVAL_COUNT ) + { + switch(recordToPublish) { - switch(recordToPublish) - { - case NVM_SYSTEM_RECORD: - state = handleSendDDSystemRecord(); - break; + case NVM_SYSTEM_RECORD: + state = handleSendDDSystemRecord(); + break; - case NVM_SERVICE_RECORD: - state = handleSendDDServiceRecord(); - break; + case NVM_SERVICE_RECORD: + state = handleSendDDServiceRecord(); + break; - case NVM_CALIBRATION_RECORD: - state = handleSendDDCalibrationRecord(); - break; + case NVM_CALIBRATION_RECORD: + state = handleSendDDCalibrationRecord(); + break; - case NVM_INSTITUTIONAL_RECORD: - state = handleSendDDInstitutionalRecord(); - break; + case NVM_INSTITUTIONAL_RECORD: + state = handleSendDDInstitutionalRecord(); + break; - case NVM_USAGE_INFO_RECORD: - state = handleSendDDUsageInfoRecord(); - break; + case NVM_USAGE_INFO_RECORD: + state = handleSendDDUsageInfoRecord(); + break; - default: - break; - } - - recordSendDataIntervalCounter = 0; + default: + break; } + recordSendDataIntervalCounter = 0; + } + return state; } @@ -373,8 +383,7 @@ static SEND_RECORD_STATE_T handleSendDDSystemRecord( void ) { SEND_RECORD_STATE_T state = NVM_SEND_RECORD_STATE_SEND; - BOOL sysStatus = FALSE; - + BOOL sysStatus = FALSE; DD_SYSTEM_RECORD_T systemRecord; // Get the record @@ -436,7 +445,7 @@ static SEND_RECORD_STATE_T handleSendDDServiceRecord( void ) { SEND_RECORD_STATE_T state = NVM_SEND_RECORD_STATE_SEND; - BOOL serStatus = FALSE; + BOOL serStatus = FALSE; DD_SERVICE_RECORD_T serviceRecord; // Get the record @@ -483,7 +492,7 @@ state = NVM_SEND_RECORD_STATE_IDLE; } - return state; + return state; } /*********************************************************************//** @@ -501,7 +510,7 @@ BOOL sendStatus = FALSE; U32 valueU32 = 0; F32 valueF32 = 0.0; - DD_NVM_SEND_RECORD_PAYLOAD_T payload; + DD_NVM_RECORD_PAYLOAD_T payload; CRITICAL_DATA_TYPES_T dataType; // Get the data type of the institutional record @@ -530,7 +539,7 @@ sendStatus = sendMessage( MSG_ID_DD_NVM_INSTITUTIONAL_RECORD_RESPONSE, COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&payload, - sizeof( DD_NVM_SEND_RECORD_PAYLOAD_T ) ); + sizeof( DD_NVM_RECORD_PAYLOAD_T ) ); // Check if record was sent successfully if ( TRUE == sendStatus ) @@ -581,7 +590,7 @@ static SEND_RECORD_STATE_T handleSendDDUsageInfoRecord( void ) { SEND_RECORD_STATE_T state = NVM_SEND_RECORD_STATE_SEND; - BOOL usageStatus = FALSE; + BOOL usageStatus = FALSE; DD_USAGE_INFO_RECORD_T usageInfoRecord; // Get the record @@ -749,16 +758,17 @@ { BOOL sendStatus = FALSE; DD_NVM_POLYNOMIAL_CAL_REC_PAYLOAD_T payload; - maxSensorIdx = NUM_OF_PRESSURE_SENSORS; - payload.idx = sendSensorIdx; + maxSensorIdx = NUM_OF_PRESSURE_SENSORS; + payload.idx = sendSensorIdx; payload.data = getPressureSensorCalRecord( sendSensorIdx ); // Send the record sendStatus = sendMessage( MSG_ID_DD_NVM_CAL_PRESSURE_SENSOR_RESPONSE, COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&payload, sizeof( DD_NVM_POLYNOMIAL_CAL_REC_PAYLOAD_T ) ); + return sendStatus; } @@ -774,16 +784,17 @@ { BOOL sendStatus = FALSE; DD_NVM_POLYNOMIAL_CAL_REC_PAYLOAD_T payload; - maxSensorIdx = NUM_OF_TEMPERATURE_SENSORS; - payload.idx = sendSensorIdx; + maxSensorIdx = NUM_OF_TEMPERATURE_SENSORS; + payload.idx = sendSensorIdx; payload.data = getTemperatureSensorCalRecord( sendSensorIdx ); // Send the record sendStatus = sendMessage( MSG_ID_DD_NVM_CAL_TEMP_SENSOR_RESPONSE, COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&payload, sizeof( DD_NVM_POLYNOMIAL_CAL_REC_PAYLOAD_T ) ); + return sendStatus; } @@ -799,16 +810,17 @@ { BOOL sendStatus = FALSE; DD_NVM_POLYNOMIAL_CAL_REC_PAYLOAD_T payload; - maxSensorIdx = NUM_OF_CONCENTRATE_PUMPS; - payload.idx = sendSensorIdx; + maxSensorIdx = NUM_OF_CONCENTRATE_PUMPS; + payload.idx = sendSensorIdx; payload.data = getConcPumpCalRecord( sendSensorIdx ); // Send the record sendStatus = sendMessage( MSG_ID_DD_NVM_CAL_CONC_PUMP_RESPONSE, COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&payload, sizeof( DD_NVM_POLYNOMIAL_CAL_REC_PAYLOAD_T ) ); + return sendStatus; } @@ -822,16 +834,18 @@ *************************************************************************/ static BOOL sendD12PumpCalRecord( void ) { - BOOL sendStatus = FALSE; + BOOL sendStatus = FALSE; DD_D12_DIALYSATE_PUMP_RECORD_T payload = getD12PumpCalRecord( ); + sendSensorIdx = 0; - maxSensorIdx = 0; + maxSensorIdx = 0; // Send the record sendStatus = sendMessage( MSG_ID_DD_NVM_CAL_D12_PUMP_RESPONSE, COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&payload, sizeof( DD_D12_DIALYSATE_PUMP_RECORD_T ) ); + return sendStatus; } @@ -847,14 +861,16 @@ { BOOL sendStatus = FALSE; DD_D48_DIALYSATE_PUMP_RECORD_T payload = getD48PumpCalRecord( ); + sendSensorIdx = 0; - maxSensorIdx = 0; + maxSensorIdx = 0; // Send the record sendStatus = sendMessage( MSG_ID_DD_NVM_CAL_D48_PUMP_RESPONSE, COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&payload, sizeof( DD_D48_DIALYSATE_PUMP_RECORD_T ) ); + return sendStatus; } @@ -870,8 +886,8 @@ { BOOL sendStatus = FALSE; DD_NVM_ACID_CONC_CAL_REC_PAYLOAD_T payload; - maxSensorIdx = NUM_OF_ACID_TYPE; + maxSensorIdx = NUM_OF_ACID_TYPE; payload.idx = sendSensorIdx; payload.data = getAcidConcentrateCalRecord( sendSensorIdx ); @@ -880,6 +896,7 @@ COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&payload, sizeof( DD_NVM_ACID_CONC_CAL_REC_PAYLOAD_T ) ); + return sendStatus; } @@ -895,8 +912,8 @@ { BOOL sendStatus = FALSE; DD_NVM_BICARB_CONC_CAL_REC_PAYLOAD_T payload; - maxSensorIdx = NUM_OF_BICARB_TYPE; + maxSensorIdx = NUM_OF_BICARB_TYPE; payload.idx = sendSensorIdx; payload.data = getBicarbConcentrateCalRecord( sendSensorIdx ); @@ -905,6 +922,7 @@ COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&payload, sizeof( DD_NVM_BICARB_CONC_CAL_REC_PAYLOAD_T ) ); + return sendStatus; } @@ -918,16 +936,18 @@ *************************************************************************/ static BOOL sendAccelSensorCalRecord( void ) { - BOOL sendStatus = FALSE; + BOOL sendStatus = FALSE; DD_ACCEL_SENSOR_CAL_RECORD_T payload = getAccelSensorCalRecord( ); + sendSensorIdx = 0; - maxSensorIdx = 0; + maxSensorIdx = 0; // Send the record sendStatus = sendMessage( MSG_ID_DD_NVM_CAL_ACCEL_SENSOR_RESPONSE, COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&payload, sizeof( DD_ACCEL_SENSOR_CAL_RECORD_T ) ); + return sendStatus; } @@ -943,6 +963,7 @@ { BOOL sendStatus = FALSE; DD_BLOOD_LEAK_SENSOR_CAL_RECORD_T payload = getBloodLeakSensorCalRecord( ); + sendSensorIdx = 0; maxSensorIdx = 0; @@ -951,6 +972,7 @@ COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&payload, sizeof( DD_BLOOD_LEAK_SENSOR_CAL_RECORD_T ) ); + return sendStatus; } @@ -983,7 +1005,7 @@ expectedPayloadLen = ( sizeof(U08) + recordSize ); } - DD_NVM_SEND_RECORD_PAYLOAD_T recvdPayload; + DD_NVM_RECORD_PAYLOAD_T recvdPayload; if ( DD_MODE_SERV == getCurrentOperationMode() ) { @@ -992,7 +1014,7 @@ // Get the index of the received calibration record if required if ( TRUE == isIndexed ) { - memcpy( &recvdPayload.idx, payloadPtr, sizeof(U32)); + memcpy( &recvdPayload.idx, payloadPtr, sizeof(U08)); payloadPtr += sizeof(U08); } @@ -1132,7 +1154,7 @@ /*********************************************************************//** * @brief - * The testDDGetNVRecord function processes a request to publish an NV + * The handleDDGetNVRecord function processes a request to publish an NV * record. It validates the payload and sets the publish request flag * for the selected record. * @details \b Inputs: nvMExecSendRecordState @@ -1141,14 +1163,14 @@ * @param message Pointer to the received message * @return TRUE if the request is accepted otherwise FALSE *************************************************************************/ -BOOL testDDGetNVRecord( MESSAGE_T *message ) +BOOL handleDDGetNVRecord( MESSAGE_T *message ) { BOOL result = FALSE; NVM_RECORD_TYPE_T job; UI_RESPONSE_PAYLOAD_T response; // verify payload length - if ( 1 == message->hdr.payloadLen ) + if ( sizeof( DD_GET_NVM_RECORD_PAYLOAD_T ) == message->hdr.payloadLen ) { job = ( NVM_RECORD_TYPE_T )message->payload[ 0 ]; @@ -1183,15 +1205,15 @@ /*********************************************************************//** * @brief - * The testDDSetNVSystemRecord function processes a request to update + * The handleDDSetNVSystemRecord function processes a request to update * the system record. It allows updates only when the system is in * service mode. * @details \b Inputs: none * @details \b Outputs: none * @param message Pointer to the received message * @return TRUE if the record is successfully processed otherwise FALSE *************************************************************************/ -BOOL testDDSetNVSystemRecord( MESSAGE_T *message ) +BOOL handleDDSetNVSystemRecord( MESSAGE_T *message ) { BOOL result = FALSE; U08 tempBuffer[ sizeof( DD_SYSTEM_RECORD_T ) ]; @@ -1247,15 +1269,15 @@ /*********************************************************************//** * @brief - * The testDDSetNVServiceRecord function processes a request to update + * The handleDDSetNVServiceRecord function processes a request to update * the service record. It allows updates only when the system is in * service mode. * @details \b Inputs: none * @details \b Outputs: none * @param message Pointer to the received message * @return TRUE if the record is successfully processed otherwise FALSE *************************************************************************/ -BOOL testDDSetNVServiceRecord( MESSAGE_T *message ) +BOOL handleDDSetNVServiceRecord( MESSAGE_T *message ) { BOOL result = FALSE; U08 tempBuffer[ sizeof( DD_SERVICE_RECORD_T ) ]; @@ -1311,14 +1333,14 @@ /*********************************************************************//** * @brief - * The testDDSetNVUsageInfoRecord function processes a request to + * The handleDDSetNVUsageInfoRecord function processes a request to * update the usage information record. * @details \b Inputs: none * @details \b Outputs: none * @param message Pointer to the received message * @return TRUE if the record is successfully processed otherwise FALSE *************************************************************************/ -BOOL testDDSetNVUsageInfoRecord( MESSAGE_T *message ) +BOOL handleDDSetNVUsageInfoRecord( MESSAGE_T *message ) { BOOL result = FALSE; U08 tempBuffer[ sizeof( DD_USAGE_INFO_RECORD_T ) ]; @@ -1365,27 +1387,27 @@ /*********************************************************************//** * @brief - * The testDDSetNVInstitutionalRecord function processes a request to + * The handleDDSetNVInstitutionalRecord function processes a request to * update the institutional record. * @details \b Inputs: none * @details \b Outputs: none * @param message Pointer to the received message * @return TRUE if the record is successfully processed otherwise FALSE *************************************************************************/ -BOOL testDDSetNVInstitutionalRecord( MESSAGE_T *message ) +BOOL handleDDSetNVInstitutionalRecord( MESSAGE_T *message ) { BOOL result = FALSE; U08 idx = 0; U08* payloadPtr = message->payload; - U08 expectedPayloadLen = sizeof(U08); + U08 expectedPayloadLen = sizeof( U08 ); UI_RESPONSE_PAYLOAD_T response; if ( message->hdr.payloadLen >= expectedPayloadLen ) { nvmExecreceiveRecordState = NVM_RECEIVE_RECORD_STATE_RECEIVE; - memcpy( &idx, payloadPtr, sizeof(U32) ); - payloadPtr += sizeof(U08); + memcpy( &idx, payloadPtr, sizeof( U08 ) ); + payloadPtr += sizeof( U08 ); result = setNVMInstitRecord( (DD_INSTIT_REC_TYPE)idx, payloadPtr ); @@ -1414,15 +1436,15 @@ /*********************************************************************//** * @brief - * The testDDSetPressureSensorCalRecord function processes a request + * The handleDDSetPressureSensorCalRecord function processes a request * to update a pressure sensor calibration record. * @details \b Inputs: none * @details \b Outputs: none * @param message Pointer to the received message * @return TRUE if the calibration record was accepted and processed * successfully otherwise FALSE *************************************************************************/ -BOOL testDDSetPressureSensorCalRecord( MESSAGE_T *message ) +BOOL handleDDSetPressureSensorCalRecord( MESSAGE_T *message ) { BOOL result = FALSE; @@ -1434,15 +1456,15 @@ /*********************************************************************//** * @brief - * The testDDSetTempSensorCalRecord function processes a request to + * The handleDDSetTempSensorCalRecord function processes a request to * update a temperature sensor calibration record. * @details \b Inputs: none * @details \b Outputs: none * @param message Pointer to the received message * @return TRUE if the calibration record was accepted and processed * successfully otherwise FALSE *************************************************************************/ -BOOL testDDSetTempSensorCalRecord( MESSAGE_T *message ) +BOOL handleDDSetTempSensorCalRecord( MESSAGE_T *message ) { BOOL result = FALSE; @@ -1454,15 +1476,15 @@ /*********************************************************************//** * @brief - * The testDDSetConcPumpCalRecord function processes a request to + * The handleDDSetConcPumpCalRecord function processes a request to * update a concentrate pump calibration record. * @details \b Inputs: none * @details \b Outputs: none * @param message Pointer to the received message * @return TRUE if the calibration record was accepted and processed * successfully otherwise FALSE *************************************************************************/ -BOOL testDDSetConcPumpCalRecord( MESSAGE_T *message ) +BOOL handleDDSetConcPumpCalRecord( MESSAGE_T *message ) { BOOL result = FALSE; @@ -1474,15 +1496,15 @@ /*********************************************************************//** * @brief - * The testDDSetD12PumpCalRecord function processes a request to + * The handleDDSetD12PumpCalRecord function processes a request to * update the D12 dialysate pump calibration record. * @details \b Inputs: none * @details \b Outputs: none * @param message Pointer to the received message * @return TRUE if the calibration record was accepted and processed * successfully otherwise FALSE *************************************************************************/ -BOOL testDDSetD12PumpCalRecord( MESSAGE_T *message ) +BOOL handleDDSetD12PumpCalRecord( MESSAGE_T *message ) { BOOL result = FALSE; @@ -1494,15 +1516,15 @@ /*********************************************************************//** * @brief - * The testDDSetD48PumpCalRecord function processes a request to + * The handleDDSetD48PumpCalRecord function processes a request to * update the D48 dialysate pump calibration record. * @details \b Inputs: none * @details \b Outputs: none * @param message Pointer to the received message * @return TRUE if the calibration record was accepted and processed * successfully otherwise FALSE *************************************************************************/ -BOOL testDDSetD48CalRecord( MESSAGE_T *message ) +BOOL handleDDSetD48CalRecord( MESSAGE_T *message ) { BOOL result = FALSE; @@ -1514,15 +1536,15 @@ /*********************************************************************//** * @brief - * The testDDSetAcidConcCalRecord function processes a request to + * The handleDDSetAcidConcCalRecord function processes a request to * update an acid concentrate calibration record. * @details \b Inputs: none * @details \b Outputs: none * @param message Pointer to the received message * @return TRUE if the calibration record was accepted and processed * successfully otherwise FALSE *************************************************************************/ -BOOL testDDSetAcidConcCalRecord( MESSAGE_T *message ) +BOOL handleDDSetAcidConcCalRecord( MESSAGE_T *message ) { BOOL result = FALSE; @@ -1534,16 +1556,15 @@ /*********************************************************************//** * @brief - * The testDDSetBicarbConcCalRecord function processes a request to + * The handleDDSetBicarbConcCalRecord function processes a request to * update a bicarb concentrate calibration record. * @details \b Inputs: none * @details \b Outputs: none * @param message Pointer to the received message * @return TRUE if the calibration record was accepted and processed * successfully otherwise FALSE *************************************************************************/ - -BOOL testDDSetBicarbConcCalRecord( MESSAGE_T *message ) +BOOL handleDDSetBicarbConcCalRecord( MESSAGE_T *message ) { BOOL result = FALSE; @@ -1555,15 +1576,15 @@ /*********************************************************************//** * @brief - * The testDDSetAccelSensorCalRecord function processes a request to + * The handleDDSetAccelSensorCalRecord function processes a request to * update the accelerometer sensor calibration record. * @details \b Inputs: none * @details \b Outputs: none * @param message Pointer to the received message * @return TRUE if the calibration record was accepted and processed * successfully otherwise FALSE *************************************************************************/ -BOOL testDDSetAccelSensorCalRecord( MESSAGE_T *message ) +BOOL handleDDSetAccelSensorCalRecord( MESSAGE_T *message ) { BOOL result = FALSE; @@ -1575,15 +1596,15 @@ /*********************************************************************//** * @brief - * The testDDSetBloodLeakSensorCalRecord function processes a request + * The handleDDSetBloodLeakSensorCalRecord function processes a request * to update the blood leak sensor calibration record. * @details \b Inputs: none * @details \b Outputs: none * @param message Pointer to the received message * @return TRUE if the calibration record was accepted and processed * successfully otherwise FALSE *************************************************************************/ -BOOL testDDSetBloodLeakSensorCalRecord( MESSAGE_T *message ) +BOOL handleDDSetBloodLeakSensorCalRecord( MESSAGE_T *message ) { BOOL result = FALSE; @@ -1603,10 +1624,22 @@ * @param crc The CRC value to be set * @return TRUE if the job was scheduled successfully otherwise FALSE *************************************************************************/ -BOOL testSetNVRecordCRCOverride( U32 job, U16 crc ) +BOOL testSetNVRecordCRCOverride( MESSAGE_T *message ) { - BOOL result = FALSE; - result = updateNVRecordCRC( job, crc ); + BOOL result = FALSE; + U32 job = 0; + U16 crc = 0; + U08* payloadPtr = message->payload; + U08 expectedPayloadLen = sizeof( U32 ) + sizeof( U16 ); + + if ( message->hdr.payloadLen >= expectedPayloadLen ) + { + memcpy( &job, payloadPtr, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( &crc, payloadPtr, sizeof( U16 ) ); + result = updateNVRecordCRC( job, crc ); + } + return result; } Index: firmware/App/Services/NVMessagingDD.h =================================================================== diff -u -r0599bd5494eb64416999de0487a9882c557b6044 -rbe1ff666dbd2ff03342c22c8e50b21d0f9b988a9 --- firmware/App/Services/NVMessagingDD.h (.../NVMessagingDD.h) (revision 0599bd5494eb64416999de0487a9882c557b6044) +++ firmware/App/Services/NVMessagingDD.h (.../NVMessagingDD.h) (revision be1ff666dbd2ff03342c22c8e50b21d0f9b988a9) @@ -39,24 +39,22 @@ BOOL getNewCalRecordAvalability( void ); void startNewCalRecordAvailableTimer( void ); -BOOL testDDGetNVRecord( MESSAGE_T *message ); -BOOL testDDSetNVSystemRecord( MESSAGE_T *message ); -BOOL testDDSetNVServiceRecord( MESSAGE_T *message ); -BOOL testDDSetNVUsageInfoRecord( MESSAGE_T *message ); -BOOL testDDSetNVInstitutionalRecord( MESSAGE_T *message ); -BOOL testDDSetPressureSensorCalRecord( MESSAGE_T *message ); -BOOL testDDSetTempSensorCalRecord( MESSAGE_T *message ); -BOOL testDDSetConcPumpCalRecord( MESSAGE_T *message ); -BOOL testDDSetD12PumpCalRecord( MESSAGE_T *message ); -BOOL testDDSetD48CalRecord( MESSAGE_T *message ); -BOOL testDDSetAcidConcCalRecord( MESSAGE_T *message ); -BOOL testDDSetBicarbConcCalRecord( MESSAGE_T *message ); -BOOL testDDSetAccelSensorCalRecord( MESSAGE_T *message ); -BOOL testDDSetBloodLeakSensorCalRecord( MESSAGE_T *message ); -BOOL testSetNVRecordCRCOverride( U32 job, U16 crc ); +BOOL handleDDGetNVRecord( MESSAGE_T *message ); +BOOL handleDDSetNVSystemRecord( MESSAGE_T *message ); +BOOL handleDDSetNVServiceRecord( MESSAGE_T *message ); +BOOL handleDDSetNVUsageInfoRecord( MESSAGE_T *message ); +BOOL handleDDSetNVInstitutionalRecord( MESSAGE_T *message ); +BOOL handleDDSetPressureSensorCalRecord( MESSAGE_T *message ); +BOOL handleDDSetTempSensorCalRecord( MESSAGE_T *message ); +BOOL handleDDSetConcPumpCalRecord( MESSAGE_T *message ); +BOOL handleDDSetD12PumpCalRecord( MESSAGE_T *message ); +BOOL handleDDSetD48CalRecord( MESSAGE_T *message ); +BOOL handleDDSetAcidConcCalRecord( MESSAGE_T *message ); +BOOL handleDDSetBicarbConcCalRecord( MESSAGE_T *message ); +BOOL handleDDSetAccelSensorCalRecord( MESSAGE_T *message ); +BOOL handleDDSetBloodLeakSensorCalRecord( MESSAGE_T *message ); +BOOL testSetNVRecordCRCOverride( MESSAGE_T *message ); - - /**@}*/ #endif /* _NV_MESSAGING_H_ */ Index: firmware/App/Services/NVRecordsDD.c =================================================================== diff -u -r3b84fc79b2fd6c7a447e54e4fe821447f613af59 -rbe1ff666dbd2ff03342c22c8e50b21d0f9b988a9 --- firmware/App/Services/NVRecordsDD.c (.../NVRecordsDD.c) (revision 3b84fc79b2fd6c7a447e54e4fe821447f613af59) +++ firmware/App/Services/NVRecordsDD.c (.../NVRecordsDD.c) (revision be1ff666dbd2ff03342c22c8e50b21d0f9b988a9) @@ -27,6 +27,7 @@ */ // ********** private definitions ********** + #define NV_RECORD_SLOT_SIZE 4096 ///< Size of each NV record slot (4KB) #define SYSTEM_RECORD_OFFSET (0U * NV_RECORD_SLOT_SIZE) ///< Offset of system record within sector @@ -300,7 +301,6 @@ nvmSelfTestState = NVM_SELF_TEST_STATE_COMPLETE; nvmSelfTestResult = SELF_TEST_STATUS_FAILED; break; - } return nvmSelfTestResult; @@ -315,7 +315,6 @@ * @param job Record job identifier used to select the process record * @return RECORDS_SPECS[job] corresponding process record specification *************************************************************************/ - PROCESS_RECORD_SPECS_T getProcessRecord( NVM_RECORD_TYPE_T job ) { return RECORDS_SPECS[ job ]; Index: firmware/App/Services/NVRecordsDD.h =================================================================== diff -u -r85a1a996c5aa992bcea51577bde28b1f54ccc476 -rbe1ff666dbd2ff03342c22c8e50b21d0f9b988a9 --- firmware/App/Services/NVRecordsDD.h (.../NVRecordsDD.h) (revision 85a1a996c5aa992bcea51577bde28b1f54ccc476) +++ firmware/App/Services/NVRecordsDD.h (.../NVRecordsDD.h) (revision be1ff666dbd2ff03342c22c8e50b21d0f9b988a9) @@ -186,7 +186,7 @@ /// DD D12 dialysate pump calibration structure typedef struct { - F32 targetPumpSpeed; ///< Target Pump Speed + F32 targetPumpSpeed; ///< Target Pump Speed U32 calibrationTime; ///< Calibration time. U16 crc; ///< CRC for the polynomial calibration payload. } DD_D12_DIALYSATE_PUMP_RECORD_T;