Index: firmware/.launches/HD.launch =================================================================== diff -u -rbda2ec522a874f07b4433a31a6a6607c55dadda5 -r7665e7b142961a50c5e77c44877247366a374526 --- firmware/.launches/HD.launch (.../HD.launch) (revision bda2ec522a874f07b4433a31a6a6607c55dadda5) +++ firmware/.launches/HD.launch (.../HD.launch) (revision 7665e7b142961a50c5e77c44877247366a374526) @@ -1,7 +1,7 @@ - + Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r27f3db92495948d4c1192421c1b0c20338c4a034 -r7665e7b142961a50c5e77c44877247366a374526 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 27f3db92495948d4c1192421c1b0c20338c4a034) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 7665e7b142961a50c5e77c44877247366a374526) @@ -1268,14 +1268,16 @@ *************************************************************************/ SELF_TEST_STATUS_T execBloodFlowTest( void ) { - SELF_TEST_STATUS_T result = SELF_TEST_STATUS_FAILED; - CALIBRATION_DATA_T cal; + SELF_TEST_STATUS_T result = SELF_TEST_STATUS_FAILED; + // Get the flow sensors calibration record + HD_FLOW_SENSORS_CAL_RECORD_T cal = getHDFlowSensorsCalibrationRecord(); + // Retrieve blood flow sensor calibration data and check for sensor connected status if ( ( TRUE == getCalibrationData( &cal ) ) && ( BFM_SENSOR_PARAM_CORRUPT_STATUS != getFPGABloodFlowMeterStatus() ) ) { - bloodFlowCalGain = cal.bloodFlowGain; - bloodFlowCalOffset = cal.bloodFlowOffset_mL_min; + bloodFlowCalGain = cal.hdFlowSensors.gain; + bloodFlowCalOffset = cal.hdFlowSensors.offset; result = SELF_TEST_STATUS_PASSED; } @@ -1286,58 +1288,7 @@ /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ - - -/*********************************************************************//** - * @brief - * The setBloodFlowCalibration function sets the blood flow calibration - * factors and has them stored in non-volatile memory. - * @details Inputs: none - * @details Outputs: bloodFlowCalGain, bloodFlowCalOffset - * @param gain gain calibration factor for blood flow sensor - * @param offset offset calibration factor for blood flow sensor - * @return TRUE if calibration factors successfully set/stored, FALSE if not - *************************************************************************/ -BOOL setBloodFlowCalibration( F32 gain, F32 offset ) -{ - BOOL result = FALSE; - if ( TRUE == isTestingActivated() ) - { - CALIBRATION_DATA_T cal; - - getCalibrationData( &cal ); - // Keep locally and apply immediately - bloodFlowCalGain = gain; - bloodFlowCalOffset = offset; - // Also update calibration record in non-volatile memory - cal.bloodFlowGain = gain; - cal.bloodFlowOffset_mL_min = offset; - if ( TRUE == setCalibrationData( cal ) ) - { - result = TRUE; - } - } - - return result; -} - -/*********************************************************************//** - * @brief - * The getBloodFlowCalibration function retrieves the current blood flow - * calibration factors. - * @details Inputs: bloodFlowCalGain, bloodFlowCalOffset - * @details Outputs: none - * @param gain value to populate with gain calibration factor for blood flow sensor - * @param offset value to populate with offset calibration factor for blood flow sensor - * @return none - *************************************************************************/ -void getBloodFlowCalibration( F32 *gain, F32 *offset ) -{ - *gain = bloodFlowCalGain; - *offset = bloodFlowCalOffset; -} - /*********************************************************************//** * @brief * The testSetBloodFlowDataPublishIntervalOverride function overrides the Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -rffaaf7d1e1eb5715eac3f7c7b424a4648526344d -r7665e7b142961a50c5e77c44877247366a374526 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision ffaaf7d1e1eb5715eac3f7c7b424a4648526344d) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 7665e7b142961a50c5e77c44877247366a374526) @@ -48,8 +48,9 @@ #define MAX_DIAL_IN_PUMP_PWM_STEP_DN_CHANGE 0.02 ///< Max duty cycle change when ramping down ~ 300 mL/min/s. #define MAX_DIAL_IN_PUMP_PWM_DUTY_CYCLE 0.88 ///< Controller will error if PWM duty cycle > 90%, so set max to 88%. #define MIN_DIAL_IN_PUMP_PWM_DUTY_CYCLE 0.12 ///< Controller will error if PWM duty cycle < 10%, so set min to 12%. - -#define DIP_CONTROL_INTERVAL ( 10000 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the dialIn pump is controlled + +/// Interval (ms/task time) at which the dialIn pump is controlled. +static const U32 DIP_CONTROL_INTERVAL = ( 10000 / TASK_GENERAL_INTERVAL ); #define DIP_P_COEFFICIENT 0.00035 ///< P term for dialIn pump control. #define DIP_I_COEFFICIENT 0.00035 ///< I term for dialIn pump control. @@ -64,12 +65,18 @@ #define DIP_MAX_FLOW_VS_SPEED_DIFF_RPM 200.0 ///< Maximum difference between measured motor speed and speed implied by measured flow. #define DIP_MAX_MOTOR_SPEED_WHILE_OFF_RPM 100.0 ///< Maximum motor speed (RPM) while motor is commanded off. #define DIP_MAX_ROTOR_VS_MOTOR_DIFF_RPM 5.0 ///< Maximum difference in speed between motor and rotor (in rotor RPM). -#define DIP_MAX_MOTOR_SPEED_ERROR_RPM 300.0 ///< Maximum difference in speed between measured and commanded RPM. -#define DIP_FLOW_VS_SPEED_PERSIST ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< Persist time (task intervals) for flow vs. motor speed error condition. -#define DIP_OFF_ERROR_PERSIST ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< Persist time (task intervals) for motor off error condition. -#define DIP_MOTOR_SPEED_ERROR_PERSIST ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< Persist time (task intervals) motor speed error condition. -#define DIP_ROTOR_SPEED_ERROR_PERSIST ((12 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< Persist time (task intervals) rotor speed error condition. -#define DIP_DIRECTION_ERROR_PERSIST (250 / TASK_PRIORITY_INTERVAL) ///< Persist time (task intervals) pump direction error condition. +#define DIP_MAX_MOTOR_SPEED_ERROR_RPM 300.0 ///< Maximum difference in speed between measured and commanded RPM. + +/// Persist time (task intervals) for flow vs. motor speed error condition. +static const U32 DIP_FLOW_VS_SPEED_PERSIST = ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL); +/// Persist time (task intervals) for motor off error condition. +static const U32 DIP_OFF_ERROR_PERSIST = ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL); +/// Persist time (task intervals) motor speed error condition. +static const U32 DIP_MOTOR_SPEED_ERROR_PERSIST = ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL); +/// Persist time (task intervals) rotor speed error condition. +static const U32 DIP_ROTOR_SPEED_ERROR_PERSIST = ((12 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL); +/// Persist time (task intervals) pump direction error condition. +static const U32 DIP_DIRECTION_ERROR_PERSIST = (250 / TASK_PRIORITY_INTERVAL); #define DIP_MAX_CURR_WHEN_STOPPED_MA 150.0 ///< Motor controller current should not exceed this when pump should be stopped. @@ -101,6 +108,8 @@ #define FLOW_SIG_STRGTH_ALARM_PERSIST ( 5 * MS_PER_SECOND ) #define MIN_FLOW_SIG_STRENGTH 0.9 ///< Minimum flow sensor signal strength (90%). +#define DFM_SENSOR_PARAM_CORRUPT_STATUS 0x7 ///< Dialysate flow meter NVM parameter corrupt status. + /// Enumeration of dialysate inlet pump states. typedef enum DialInPump_States { @@ -176,9 +185,6 @@ static U32 dipCurrErrorDurationCtr = 0; ///< Used for tracking persistence of dip current errors -static DIAL_IN_FLOW_SELF_TEST_STATE_T dialInPumpSelfTestState = DIAL_IN_FLOW_SELF_TEST_STATE_START; ///< Current dialIn pump self-test state -static U32 dialInPumpSelfTestTimerCount = 0; ///< Timer counter for dialIn pump self-test - // ********** private function prototypes ********** static DIAL_IN_PUMP_STATE_T handleDialInPumpOffState( void ); @@ -1225,24 +1231,12 @@ // Get the flow sensors calibration record HD_FLOW_SENSORS_CAL_RECORD_T cal = getHDFlowSensorsCalibrationRecord(); - switch ( dialInPumpSelfTestState ) + // Retrieve dialysate flow sensor calibration data + if ( ( TRUE == getCalibrationData( &cal ) ) && ( DFM_SENSOR_PARAM_CORRUPT_STATUS != getFPGADialysateFlowMeterStatus() ) ) { - case DIAL_IN_FLOW_SELF_TEST_STATE_START: - dialInFlowCalGain = cal.hdFlowSensors[ CAL_DATA_HD_DIALYZER_FLOW_SENSOR ].gain; - dialInFlowCalOffset = cal.hdFlowSensors[ CAL_DATA_HD_DIALYZER_FLOW_SENSOR ].offset; - dialInPumpSelfTestState = DIAL_IN_FLOW_TEST_STATE_COMPLETE; // TODO - implement rest of self-test(s) - result = SELF_TEST_STATUS_PASSED; - break; - - case DIAL_IN_FLOW_TEST_STATE_IN_PROGRESS: - break; - - case DIAL_IN_FLOW_TEST_STATE_COMPLETE: - break; - - default: - // TODO - s/w fault - break; + dialInFlowCalGain = cal.hdFlowSensors.gain; + dialInFlowCalOffset = cal.hdFlowSensors.offset; + result = SELF_TEST_STATUS_PASSED; } return result; Index: firmware/App/HDCommon.h =================================================================== diff -u -r27f3db92495948d4c1192421c1b0c20338c4a034 -r7665e7b142961a50c5e77c44877247366a374526 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 27f3db92495948d4c1192421c1b0c20338c4a034) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 7665e7b142961a50c5e77c44877247366a374526) @@ -32,6 +32,7 @@ // TODO - remove build switches before release #ifndef _RELEASE_ #ifndef _VECTORCAST_ + #define BOARD_WITH_NO_HARDWARE 1 // #define RUN_WITHOUT_DG 1 // Run HD w/o DG // #define SIMULATE_UI 1 // Build w/o requirement that UI be there // #define TASK_TIMING_OUTPUT_ENABLED 1 // Re-purposes alarm lamp pins for task timing @@ -52,6 +53,7 @@ #define DISABLE_PRESSURE_CHECKS 1 // Do not error on HD pressure checks // #define DISABLE_UF_ALARMS 1 // Do not error on HD ultrafiltration checks #define DISABLE_VALVE_ALARMS 1 // Do not error on HD valve position +// #define DISABLE_CAL_CHECK 1 // #define RUN_PUMPS_OPEN_LOOP 1 // BP and DPi pumps will be run open loop (no flow sensor feedback) // #define RAW_FLOW_SENSOR_DATA 1 // Test build will not filter flow sensor data // #define READ_FPGA_ASYNC_DATA 1 // Test build reads non-priority register page every other time Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r38f6b0b6ff1608eb1fd046e91add7fd2c65de4b1 -r7665e7b142961a50c5e77c44877247366a374526 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 38f6b0b6ff1608eb1fd046e91add7fd2c65de4b1) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 7665e7b142961a50c5e77c44877247366a374526) @@ -103,8 +103,12 @@ case POST_STATE_START: postState = POST_STATE_WATCHDOG; #ifdef SKIP_POST - postState = POST_STATE_VALVES; +#ifndef RM46_EVAL_BOARD_TARGET + postState = POST_STATE_COMPLETED; +#else + postState = POST_STATE_NVDATAMGMT; #endif +#endif break; case POST_STATE_WATCHDOG: Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -re23087e0c17f6ea81d60641fdb52121a8dd5a099 -r7665e7b142961a50c5e77c44877247366a374526 --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision e23087e0c17f6ea81d60641fdb52121a8dd5a099) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 7665e7b142961a50c5e77c44877247366a374526) @@ -1128,6 +1128,7 @@ // Update treatment time stats and broadcast - end treatment if time elapsedTreatmentTimeInSecs = CALC_ELAPSED_TREAT_TIME_IN_SECS(); // Broadcast treatment time data at interval + if ( ++treatmentTimeBroadcastTimerCtr >= TREATMENT_TIME_DATA_PUB_INTERVAL ) { if ( isTreatmentCompleted() != TRUE ) Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -rac2c218b9e310a14d2872c9b4c32a6f69615088e -r7665e7b142961a50c5e77c44877247366a374526 --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision ac2c218b9e310a14d2872c9b4c32a6f69615088e) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 7665e7b142961a50c5e77c44877247366a374526) @@ -81,7 +81,8 @@ BOOL noResume; ///< Treatment may not be resumed at this time BOOL noRinseback; ///< Rinseback may not be initiated at this time BOOL noEndTreatment; ///< Ending the treatment is not an option at this time - BOOL noNewTreatment; ///< No new treatments may be started even if current treatment is ended + BOOL noNewTreatment; ///< No new treatments may be started even if current treatment is ended + BOOL noDialRecirc; ///< No dialysate re-circulation allowed at this time BOOL usrACKRequired; ///< The user must acknowledge top alarm BOOL lampOn; ///< The alarm lamp is on } COMP_ALARM_STATUS_T; @@ -238,8 +239,20 @@ SW_FAULT_ID_MODE_PRE_TREATMENT_PRIME_INVALID_STATE, SW_FAULT_ID_SYSTEM_COMM_INVALID_FRAME_SIZE, SW_FAULT_ID_SYSTEM_CMMM_CAN_TRANSMIT_REJECTED, // 95 + SW_FAULT_ID_BLOOD_PRIME_INVALID_STATE, + SW_FAULT_ID_RINSEBACK_INVALID_STATE, + SW_FAULT_ID_TREATMENT_END_INVALID_STATE, + SW_FAULT_ID_TREATMENT_RECIRC_INVALID_STATE, + SW_FAULT_ID_TREATMENT_STOP_INVALID_STATE, // 100 SW_FAULT_ID_MODE_PRIME_INVALID_ALARM_ACTION, SW_FAULT_ID_INVALID_NVDATAMGMT_EXEC_CAL_STATE, + SW_FAULT_ID_HD_INVALID_NO_CARTRIDGE_SELF_TEST_STATE, + SW_FAULT_ID_HD_INVALID_DRY_SELF_TEST_STATE, + SW_FAULT_ID_HD_INVALID_WET_SELF_TEST_STATE, // 105 + SW_FAULT_ID_HD_INVALID_PRE_TREATMENT_RECIRC_STATE, + SW_FAULT_ID_HD_INVALID_COMMAND_RESPONSE_ID, + SW_FAULT_ID_HD_INVALID_RESERVOIR_ID, + SW_FAULT_ID_HD_INVALID_VALVE_SETTING_ID, NUM_OF_SW_FAULT_IDS } SW_FAULT_ID_T; @@ -254,9 +267,12 @@ void clearAlarm( ALARM_ID_T alarm ); void clearAlarmCondition( ALARM_ID_T alarm ); void setAlarmUserActionEnabled( ALARM_USER_ACTION_T action, BOOL enabled ); -void signalAlarmSilence( U32 cmd ); +void signalAlarmSilence( ALARM_SILENCE_CMD_T cmd ); void signalAlarmUserActionInitiated( ALARM_USER_ACTION_T action ); BOOL isAlarmActive( ALARM_ID_T alarm ); +BOOL isAnyAlarmActive( void ); +BOOL isDialysateRecircBlocked( void ); +BOOL doesAlarmStatusIndicateStop( void ); ALARM_PRIORITY_T getCurrentAlarmStatePriority( void ); BOOL isAlarmRecoverable( ALARM_ID_T alarm ); void setAlarmAudioVolume( U32 volumeLevel ); Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r2cc4f0cfc6512c942864d7d302cef5df375a2081 -r7665e7b142961a50c5e77c44877247366a374526 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 2cc4f0cfc6512c942864d7d302cef5df375a2081) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 7665e7b142961a50c5e77c44877247366a374526) @@ -280,7 +280,7 @@ processReceivedMessages(); // Check for sub-system comm timeouts - checkForCommTimeouts(); + //checkForCommTimeouts(); // Check ACK list for messages that need to be re-sent because they have not been ACK'd checkPendingACKList(); @@ -1215,6 +1215,30 @@ handleTesterLogInRequest( message ); break; + case MSG_ID_HD_SET_CALIBRATION_RECORD: + handleSetHDCalibrationRecord( message ); + break; + + case MSG_ID_HD_GET_CALIBRATION_RECORD: + handleGetHDCalibrationRecord( message ); + break; + + case MSG_ID_HD_SET_SYSTEM_RECORD: + handleSetHDSystemRecord( message ); + break; + + case MSG_ID_HD_GET_SYSTEM_RECORD: + handleGetHDSystemRecord( message ); + break; + + case MSG_ID_HD_GET_SERVICE_RECORD: + handleGetHDServiceRecord( message ); + break; + + case MSG_ID_HD_SET_SERVICE_RECORD: + handleSetHDServiceRecord( message ); + break; + default: // TODO - unrecognized message ID received - ignore break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r2cc4f0cfc6512c942864d7d302cef5df375a2081 -r7665e7b142961a50c5e77c44877247366a374526 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 2cc4f0cfc6512c942864d7d302cef5df375a2081) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 7665e7b142961a50c5e77c44877247366a374526) @@ -1460,6 +1460,124 @@ return result; } +/*********************************************************************//** + * @brief + * The sendHDCalibrationRecord function sends out the HD calibration + * record. + * @details Inputs: none + * @details Outputs: HD calibration record msg constructed and queued + * @param msgCurrNum: current payload number + * @param msgTotalNum: total number of payloads + * @param length: buffer length to be written + * @param calRcrdAddress: start address of the calibration record + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendHDCalibrationRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* calRcrdAddress ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_SEND_CALIBRATION_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, calRcrdAddress, 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 sendHDSystemRecord function sends out the HD system record. + * @details Inputs: none + * @details Outputs: HD 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 sendHDSystemRecord( 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_HD_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 sendHDServiceRecord function sends out the HD service record. + * @details Inputs: none + * @details Outputs: HD 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 sendHDServiceRecord( 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_HD_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; +} + #ifdef EMC_TEST_BUILD BOOL broadcastCANErrorCount( U32 count ) { @@ -4375,4 +4493,181 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** +* @brief +* The handleSetHDCalibrationRecord function handles a request to set the HD +* calibration data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetHDCalibrationRecord( 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 = setCalibrationRecord( currentMessage, totalMessages, payloadLength, payloadPtr ); + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + +/*********************************************************************//** +* @brief +* The handleGetHDCalibrationRecord function handles a request to get the HD +* calibration data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleGetHDCalibrationRecord( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + // Tester must be logged in + if ( TRUE == isTestingActivated() ) + { + result = getCalibrationRecord(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleSetHDSystemRecord function handles a request to set the HD +* system data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetHDSystemRecord( 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 handleGetHDSystemRecord function handles a request to get the HD +* system data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleGetHDSystemRecord( 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 handleGetHDServiceRecord function handles a request to get the HD +* service data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleGetHDServiceRecord( 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 handleSetHDServiceRecord function handles a request to set the HD +* service data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetHDServiceRecord( 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 ); +} + /**@}*/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r2cc4f0cfc6512c942864d7d302cef5df375a2081 -r7665e7b142961a50c5e77c44877247366a374526 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 2cc4f0cfc6512c942864d7d302cef5df375a2081) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 7665e7b142961a50c5e77c44877247366a374526) @@ -283,6 +283,15 @@ // MSG_ID_HD_PRIMING_STATUS_DATA BOOL broadcastPrimeData( PRIMING_DATA_PAYLOAD_T *primeDataPtr ); +// MSG_ID_HD_SEND_CALIBRATION_RECORD +BOOL sendHDCalibrationRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* calRcrdAddress ); + +// MSG_ID_HD_SEND_SYSTEM_RECORD +BOOL sendHDSystemRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* sysRcrdAddress ); + +// MSG_ID_Hd_SEND_SERVICE_RECORD +BOOL sendHDServiceRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* srvcRcrdAddress ); + #ifdef EMC_TEST_BUILD // MSG_ID_CAN_ERROR_COUNT BOOL broadcastCANErrorCount( U32 count ); @@ -478,6 +487,27 @@ // MSG_ID_SUPER_CLEAR_ALARMS_CMD void handleTestSuperClearAlarmsRequest( MESSAGE_T *message ); +// MSG_ID_HD_REQUEST_CALIBRATION_DATA +void handleTestHDCalibrationDataRequest( MESSAGE_T *message ); + +// MSG_ID_HD_SET_CALIBRATION_RECORD +void handleSetHDCalibrationRecord( MESSAGE_T *message ); + +// MSG_ID_HD_GET_CALIBRATION_RECORD +void handleGetHDCalibrationRecord( MESSAGE_T *message ); + +// MSG_ID_HD_SET_SYSTEM_RECORD +void handleSetHDSystemRecord( MESSAGE_T *message ); + +// MSG_ID_HD_GET_SYSTEM_RECORD +void handleGetHDSystemRecord( MESSAGE_T *message ); + +// MSG_ID_HD_GET_SERVICE_RECORD +void handleGetHDServiceRecord( MESSAGE_T *message ); + +// MSG_ID_HD_SET_SERVICE_RECORD +void handleSetHDServiceRecord( MESSAGE_T *message ); + // MSG_ID_HD_SET_OP_MODE_REQUEST void handleTestSetOpModeRequest( MESSAGE_T *message ); Index: firmware/App/Tasks/TaskBG.c =================================================================== diff -u -r911f6526ec3ba03ba0131681c7fb371c0abda6bb -r7665e7b142961a50c5e77c44877247366a374526 --- firmware/App/Tasks/TaskBG.c (.../TaskBG.c) (revision 911f6526ec3ba03ba0131681c7fb371c0abda6bb) +++ firmware/App/Tasks/TaskBG.c (.../TaskBG.c) (revision 7665e7b142961a50c5e77c44877247366a374526) @@ -56,15 +56,17 @@ { // Wait for UI to come up after power up if ( FALSE == uiCommunicated() ) - { + { +#ifndef RM46_EVAL_BOARD_TARGET #ifndef SIMULATE_UI if ( TRUE == didTimeout( startUICommTimeout, MAX_TIME_FOR_UI_TO_COMMUNICATE_MS ) ) { activateAlarmNoData( ALARM_ID_UI_COMM_POST_FAILED ); } +#endif #endif } - + // Manage the watchdog execWatchdogMgmt(); Index: firmware/App/Tasks/TaskGeneral.c =================================================================== diff -u -r766708fceb0bdf1af8c7897df29d4f5036bfd3db -r7665e7b142961a50c5e77c44877247366a374526 --- firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision 766708fceb0bdf1af8c7897df29d4f5036bfd3db) +++ firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision 7665e7b142961a50c5e77c44877247366a374526) @@ -21,7 +21,8 @@ #include "CPLD.h" #include "DGInterface.h" #include "DialInFlow.h" -#include "DialOutFlow.h" +#include "DialOutFlow.h" +#include "NVDataMgmt.h" #include "OperationModes.h" #include "PresOccl.h" #include "SystemComm.h" @@ -63,7 +64,8 @@ #ifndef SIMULATE_UI if ( TRUE == uiCommunicated() ) #endif - { + { +#ifndef RM46_EVAL_BOARD_TARGET // Monitor DG execDGInterfaceMonitor(); @@ -83,13 +85,19 @@ execDialInFlowController(); // Control dialysate outlet pump - execDialOutFlowController(); + execDialOutFlowController(); +#endif // Manage RTC - execRTC(); - + execRTC(); + + // Manage NVDataMgmt process record state machine + execNVDataMgmtProcessRecord(); + +#ifndef RM46_EVAL_BOARD_TARGET // Manage alarm state - execAlarmMgmt(); + execAlarmMgmt(); +#endif // Manage data to be transmitted to other sub-systems execSystemCommTx(); Index: firmware/App/Tasks/TaskPriority.c =================================================================== diff -u -rd2c7420f7420cb79e116f26f187764cd6ce52c68 -r7665e7b142961a50c5e77c44877247366a374526 --- firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision d2c7420f7420cb79e116f26f187764cd6ce52c68) +++ firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision 7665e7b142961a50c5e77c44877247366a374526) @@ -54,7 +54,8 @@ #ifndef SIMULATE_UI if ( TRUE == uiCommunicated() ) #endif - { + { +#ifndef RM46_EVAL_BOARD_TARGET // 1st pass for FPGA execFPGAIn(); @@ -90,7 +91,8 @@ #endif #endif // 2nd pass for FPGA - execFPGAOut(); + execFPGAOut(); +#endif } // Check in with watchdog manager