Index: firmware/App/Services/AlarmMgmtSWFaults.h =================================================================== diff -u -r977f03e20990ed5579160b9b927df1c0f2428101 -r5b7121b237be1970c0a040809503ff5786e6da0d --- firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 977f03e20990ed5579160b9b927df1c0f2428101) +++ firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 5b7121b237be1970c0a040809503ff5786e6da0d) @@ -139,6 +139,10 @@ SW_FAULT_ID_PRE_GEND_WET_SELF_TEST_INVALID_EXEC_STATE1 = 108, SW_FAULT_ID_UF_INVALID_EXEC_STATE = 109, SW_FAULT_ID_SPENT_CHAMBER_FILL_INVALID_EXEC_STATE = 110, + SW_FAULT_ID_TD_INVALID_BLOOD_LEAK_STATE = 111, + SW_FAULT_ID_BLOOD_LEAK_EMBEDDED_MODE_INVALID_STATE = 112, + SW_FAULT_ID_BLOOD_LEAK_ENQUEUE_FAILURE = 113, + SW_FAULT_ID_BLOOD_LEAK_INVALID_EMB_MODE_CMD_SELECTED = 114, #ifdef __PUMPTEST__ // Assigning high value to separate from actual fault id from test fault ids. SW_FAULT_ID_PISTON_PUMP_EXEC_INVALID_STATE = 9000, Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -re3ea1f5251b7a7af6e47b9e013c3cfc11466e255 -r5b7121b237be1970c0a040809503ff5786e6da0d --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision e3ea1f5251b7a7af6e47b9e013c3cfc11466e255) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision 5b7121b237be1970c0a040809503ff5786e6da0d) @@ -3130,4 +3130,98 @@ return status; } +// Blood leak functions +/*********************************************************************//** + * @brief + * The getFPGABloodLeakStatus function returns the blood leak sensor's + * blood detection status bit. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return blood leak sensor self test status bit + *************************************************************************/ +U08 getFPGABloodLeakStatus( void ) +{ + U08 selfTestStatus = fpgaSensorReadings.fpgaD42PulseStatus; + + return selfTestStatus; +} + +/*********************************************************************//** + * @brief + * The setFPGABloodLeakUARTControl function sets the blood leak sensor UART + * control value. + * @details Inputs: none + * @details Outputs: fpgaActuatorSetPoints + * @return none + *************************************************************************/ +void setFPGABloodLeakUARTControl( U08 value ) +{ + fpgaActuatorSetPoints.fpgaD42UARTControl = value; +} + +/*********************************************************************//** + * @brief + * The setFPGABloodLeakUARTTransmit function sets the blood leak sensor UART + * transmit value. + * @details Inputs: none + * @details Outputs: fpgaActuatorSetPoints + * @return none + *************************************************************************/ +void setFPGABloodLeakUARTTransmit( U08 value ) +{ + fpgaActuatorSetPoints.fpgaD42FIFOTx = value; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakTxFIFOCount function returns the blood leak transmit + * FIFO count. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return fpgaSensorReadings.fpgaD42TxFIFOCnt + *************************************************************************/ +U08 getFPGABloodLeakTxFIFOCount( void ) +{ + return fpgaSensorReadings.fpgaD42TxFIFOCnt; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakRxFIFOCount function returns the blood leak receive + * FIFO count. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return fpgaSensorReadings.fpgaD42RxFIFOCnt + *************************************************************************/ +U16 getFPGABloodLeakRxFIFOCount( void ) +{ + return fpgaSensorReadings.fpgaD42RxFIFOCnt; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakRxErrorCount function returns the blood leak receive + * error count. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return fpgaSensorReadings.fpgaD42RxErrorCnt + *************************************************************************/ +U08 getFPGABloodLeakRxErrorCount( void ) +{ + return fpgaSensorReadings.fpgaD42RxErrorCnt; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakRxFIFODataOut function returns the blood leak receive + * FIFO data out. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return fpgaSensorReadings.fpgaD42RxFIFODataOut + *************************************************************************/ +U08 getFPGABloodLeakRxFIFODataOut( void ) +{ + return fpgaSensorReadings.fpgaD42RxFIFODataOut; +} + /**@}*/ Index: firmware/App/Services/FpgaDD.h =================================================================== diff -u -re3ea1f5251b7a7af6e47b9e013c3cfc11466e255 -r5b7121b237be1970c0a040809503ff5786e6da0d --- firmware/App/Services/FpgaDD.h (.../FpgaDD.h) (revision e3ea1f5251b7a7af6e47b9e013c3cfc11466e255) +++ firmware/App/Services/FpgaDD.h (.../FpgaDD.h) (revision 5b7121b237be1970c0a040809503ff5786e6da0d) @@ -257,6 +257,15 @@ void setFPGAD5HeaterPWMLowState( U16 count ); void setFPGAD5HeaterPWMPeriod( U16 period ); +//Blood leak detector +U08 getFPGABloodLeakStatus( void ); +void setFPGABloodLeakUARTControl( U08 value ); +void setFPGABloodLeakUARTTransmit( U08 value ); +U08 getFPGABloodLeakTxFIFOCount( void ); +U16 getFPGABloodLeakRxFIFOCount( void ); +U08 getFPGABloodLeakRxErrorCount( void ); +U08 getFPGABloodLeakRxFIFODataOut( void ); + /**@}*/ #endif Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r2fbc96d39b371df18e2b1b641fcd4917806c0767 -r5b7121b237be1970c0a040809503ff5786e6da0d --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 2fbc96d39b371df18e2b1b641fcd4917806c0767) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 5b7121b237be1970c0a040809503ff5786e6da0d) @@ -35,13 +35,12 @@ #include "ModeStandby.h" #include "OperationModes.h" #include "PAL.h" -#ifdef __PUMPTEST__ -#include "PistonPumpControl.h" -#endif #include "Pressure.h" #include "SafetyShutdown.h" +#include "SpentChamberFill.h" #include "SystemCommDD.h" #include "Temperature.h" +#include "TestSupport.h" #include "TDInterface.h" #include "Utilities.h" #include "Ultrafiltration.h" @@ -145,7 +144,7 @@ { MSG_ID_DD_HEATERS_START_STOP_OVERRIDE_REQUEST, &testHeaterStartStopOverride }, { MSG_ID_DD_VALVES_OPEN_CLOSE_STATE_OVERRIDE_REQUEST, &testValveOpenCloseStateOverride }, { MSG_ID_DD_GEN_DIALYSATE_REQUEST_DATA, &handleDialysateDeliveryRequestMsg }, - { MSD_ID_DD_FP_COMMUNICATION_STATUS_OVERRIDE_REQUEST, &testROCommunicationStatusOverride }, + { MSD_ID_DD_FP_COMMUNICATION_STATUS_OVERRIDE_REQUEST, &testFPCommunicationStatusOverride }, { MSG_ID_DD_BAL_CHAMBER_DATA_PUBLISH_OVERRIDE_REQUEST, &testDDBalChamberDataPublishIntervalOverride }, { MSG_ID_DD_BAL_CHAMBER_SWITCH_FREQ_OVERRIDE_REQUEST, &testBalChamberSwFreqOverride }, { MSG_ID_DD_DIAL_DELIVERY_IN_PROGRESS_OVERRIDE_REQUEST, &testDialDeliveryInProgressOverride }, @@ -164,6 +163,7 @@ { MSG_ID_FW_VERSIONS_REQUEST, &handleVersionRequestMessage }, { MSG_ID_DD_SAFETY_SHUTDOWN_OVERRIDE_REQUEST, &testSetResetSafetyShutdownOverride }, { MSG_ID_DD_UF_DATA_PUBLISH_OVERRIDE_REQUEST, &testDDUFDataPublishIntervalOverride }, + { MSG_ID_DD_SPENT_CHAMB_FILL_DATA_PUBLISH_OVERRIDE_REQUEST, &testDDSpentChamberFillDataPublishIntervalOverride }, { MSG_ID_DD_BLOOD_LEAK_DATA_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testBloodLeakDataPublishIntervalOverride }, { MSG_ID_DD_BLOOD_LEAK_STATUS_OVERRIDE_REQUEST, &testBloodLeakStatusOverride }, { MSG_ID_DD_BLOOD_LEAK_SET_TO_EMBEDDED_MODE_REQUEST, &testSetBloodLeak2EmbeddedMode }, @@ -177,6 +177,9 @@ { MSG_ID_DD_PISTON_PUMP_START_STOP_OVERRIDE_REQUEST, &testDDPistonPumpStartStopOverride }, { MSG_ID_DD_PISTON_PUMP_FILL_AFTER_DISPENSE_OVERRIDE_REQUEST, &testDDPistonPumpFillAfterDispenseOverride }, #endif + { MSG_ID_DD_SET_TEST_CONFIGURATION, &testSetTestConfiguration }, + { MSG_ID_DD_GET_TEST_CONFIGURATION, &testGetTestConfiguration }, + { MSG_ID_DD_RESET_ALL_TEST_CONFIGURATIONS, &testResetAllTestConfigurations }, }; #define NUM_OF_FUNCTION_HANDLERS (sizeof(MSG_FUNCTION_HANDLER_LOOKUP) / sizeof(MSG_HANDLER_LOOKUP_T)) @@ -725,9 +728,90 @@ setSystemREG1_SYSECR( (0x2) << 14 ); // Reset processor } - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); + return result; +} +/*********************************************************************//** + * @brief + * The testSetTestConfiguration function handles a request to set a + * test configuration. + * @details \b Inputs: none + * @details \b Outputs: message handled + * @param message a pointer to the message to handle + * @return TRUE if command accepted, FALSE if rejected + *************************************************************************/ +BOOL testSetTestConfiguration( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // Verify payload length + if ( sizeof( TEST_CONFIG_PAYLOAD_T ) == message->hdr.payloadLen ) + { + TEST_CONFIG_PAYLOAD_T payload; + + // copy message payload to local variable + memcpy( (U08*)&payload, &message->payload[0], sizeof( TEST_CONFIG_PAYLOAD_T ) ); + + // Verify given test configuration is valid + if ( payload.config < NUM_OF_TEST_CONFIGS ) + { + result = TRUE; + if ( FALSE == payload.reset ) + { + setTestConfig( (TEST_CONFIG_T)payload.config ); + } + else + { + resetTestConfig( (TEST_CONFIG_T)payload.config ); + } + } + } + return result; } +/*********************************************************************//** + * @brief + * The testGetTestConfiguration function handles a request to get a + * test configuration. + * @details \b Inputs: none + * @details \b Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +BOOL testGetTestConfiguration( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + result = sendTestConfigStatusToDialin(); + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetTestConfiguration function handles a request to reset all + * test configurations. + * @details \b Inputs: none + * @details \b Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +BOOL testResetAllTestConfigurations( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + result = resetAllTestConfigs(); + } + + return result; +} + /**@}*/ Index: firmware/source/sys_main.c =================================================================== diff -u -rcaa15db89a49c98671f0a87dc2242d0fc7f683b7 -r5b7121b237be1970c0a040809503ff5786e6da0d --- firmware/source/sys_main.c (.../sys_main.c) (revision caa15db89a49c98671f0a87dc2242d0fc7f683b7) +++ firmware/source/sys_main.c (.../sys_main.c) (revision 5b7121b237be1970c0a040809503ff5786e6da0d) @@ -62,6 +62,7 @@ #include "sys_dma.h" #include "AlarmMgmtDD.h" +#include "BloodLeak.h" #include "CommBuffers.h" #include "Conductivity.h" #include "ConcentratePumps.h" @@ -182,6 +183,7 @@ initTDInterface(); initFPInterface(); initUltrafiltration(); + initBloodLeak(); } /*************************************************************************