Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -r7d963ca43801628920617ce0b904a62effcd2722 -r3678601eac45b69684724bb46fe913049985c410 --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision 7d963ca43801628920617ce0b904a62effcd2722) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision 3678601eac45b69684724bb46fe913049985c410) @@ -1,15 +1,15 @@ /************************************************************************** * -* Copyright (c) 2024-2025 Diality Inc. - All Rights Reserved. +* Copyright (c) 2024-2026 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 FpgaDD.c * -* @author (last) Michael Garthwaite -* @date (last) 08-Dec-2025 +* @author (last) “rkallala” +* @date (last) 19-Jan-2026 * * @author (original) Vinayakam Mani * @date (original) 26-Aug-2024 @@ -162,7 +162,7 @@ U16 fpgaD43CondTemp; ///< Reg 576. D43 Temperature U08 fpgaD43CondReadCnt; ///< Reg 578. D43 successful read count U08 fpgaD43CondErrorCnt; ///< Reg 579. D43 error read count - U16 fpgaD63LevelSensor; ///< Reg 580. Level Sensor 1 + U16 fpgaD63LevelSensor; ///< Reg 580. Upper level Sensor U16 fpgaD46LevelSensor; ///< Reg 582. Level Sensor 2 U08 fpgaHallSensInputs; ///< Reg 584. Hall sensor Inputs U08 fpgaD42TxFIFOCnt; ///< Reg 585. Blood leak sensor transmit FIFO count @@ -184,11 +184,10 @@ U32 fpgaD1Temp; ///< Reg 610. Inlet heat exchanger temperature U32 fpgaD4Temp; ///< Reg 614. Hydraulics primary heater temperature U32 fpgaD50Temp; ///< Reg 618. Trimmer heater temperature - U08 fpga_UnUsed_1; ///< Reg 622. Not used - U08 fpgaRTDReadCnt; ///< Reg 623. Read count for all RTD sensors + U16 fpgaD98LevelSensor; ///< Reg 622. Lower level Sensor U16 fpgaD12MeasuredSpeed; ///< Reg 624. Fresh dialysate pump measured speed U16 fpgaD48MeasuredSpeed; ///< Reg 626. Spent dialysate pump measured speed - U08 fpga_UnUsed_2; ///< Reg 628. Not used + U08 fpgaRTDReadCnt; ///< Reg 628. Read count for all RTD sensors U08 fpgaD12D48PumpStatus; ///< Reg 629. Dialysate pumps Error status U16 fpgaD12CurrentFeedback; ///< Reg 630. Fresh dialysate pump current feedback U16 fpgaD48CurrentFeedback; ///< Reg 632. Spent dialysate pump current feedback @@ -235,7 +234,7 @@ U16 flowRateP7; ///< Reg 704. P7 flow sensor rate. U16 flowTempP7; ///< Reg 706. P7 flow sensor temperature. U16 p12PumpTachCount; ///< Reg 708. P12 pump tachometer counter. - U16 dsPumpTachCount; ///< Reg 710. DSP tachometer counter. + U16 d79SpeedPulseWidth; ///< Reg 710. D79 pusle width feedback. U16 flowIntTempP7; ///< Reg 712. P7 flow sensor internal temperature. U08 valveIOControlReadback; ///< Reg 714. IO Valve control bits read back. U08 valveFPControlReadback; ///< Reg 715. FP Valve control enable read back. @@ -245,8 +244,9 @@ U16 p40PumpPWMReadback; ///< Reg 720. P40 pump PWM read back. U08 p7flowReadCount; ///< Reg 722. P7 Flow sensor read counter. U08 p7flowErrorCount; ///< Reg 723. P7 Flow sensor error counter. - U32 tempP23; ///< Reg 724. P23 temperature sensor reading. - U32 tempP22; ///< Reg 728. P22 ( TRO2 ) temperature sensor reading. + U16 fpgaD87PresPressure; ///< Reg 724. D87 MPM pressure sensor RAW pressure data + U16 fpgaD87PresTemp; ///< Reg 726. D87 MPM pressure sensor RAW temperature data + U32 fpgaD99Temp; ///< Reg 728. D99 temperature sensor U32 tempTax1; ///< Reg 732. ( Tax1 ) temperature sensor reading. U32 tempRTD; ///< Reg 736. spare temperature sensor reading. U08 ad7124errcnt; ///< Reg 740. Counter which increments when an invalid transaction happen between FPGA and AD7124. @@ -295,7 +295,7 @@ U08 fpgaD42FIFOTx; ///< Reg 48. Blood leak sensor FIFO transmit control U08 fpgaD5HeaterPWMControl; ///< Reg 49. Primary heater PWM control U08 fpgaD45HeaterPWMControl; ///< Reg 50. Trimmer heater PWM control - U08 fpgaNotUsed; ///< Reg 51. Not used + U08 fpgaD79PWMPumpCtl; ///< Reg 51. Rinse pump PWM control U16 fpgaVBCPWMLow; ///< Reg 52. VBC PWM low ( Balancing chamber valves) U16 fpgaVBCPWMPeriod; ///< Reg 54. VBC PWM period U16 fpgaVBCPWMPullIn; ///< Reg 56. VBC PWM pull in @@ -2427,6 +2427,32 @@ /*********************************************************************//** * @brief + * The getFPGAD87PresRawPressure function gets fresh dialysate post ultrafilter + * pressure sensor raw pressure value. + * @details \b Inputs: fpgaSensorReadings.fpgaD87PresPressure + * @details \b Outputs: none + * @return Fresh dialysate post ultrafilter pressure sensor raw pressure data + *************************************************************************/ +U16 getFPGAD87PresRawPressure( void ) +{ + return fpgaSensorReadings.fpgaD87PresPressure; +} + +/*********************************************************************//** + * @brief + * The getFPGAD87PresRawTemperature function gets fresh dialysate post ultrafilter + * pressure sensor raw temperature value. + * @details \b Inputs: fpgaSensorReadings.fpgaD87PresTemp + * @details \b Outputs: none + * @return Fresh dialysate post ultrafilter pressure sensor raw temperature data + *************************************************************************/ +U16 getFPGAD87PresRawTemperature( void ) +{ + return fpgaSensorReadings.fpgaD87PresTemp; +} + +/*********************************************************************//** + * @brief * The getFPGACD1ReadCount function gets D17 conductivity sensor read count. * @details \b Inputs: fpgaSensorReadings.fpgaD17CondReadCnt * @details \b Outputs: none @@ -2727,11 +2753,11 @@ /*********************************************************************//** * @brief - * The getFPGAD63LevelSensor function gets the latest FPGA D63 level sensor - * reading. + * The getFPGAD63LevelSensor function gets the latest FPGA D63 upper level + * sensor reading. * @details \b Inputs: fpgaSensorReadings.fpgaD63LevelSensor * @details \b Outputs: none - * @return last FPGA D63 level sensor reading + * @return last FPGA D63 upper level sensor reading *************************************************************************/ U16 getFPGAD63LevelSensor( void ) { @@ -2740,6 +2766,19 @@ /*********************************************************************//** * @brief + * The getFPGAD98LevelSensor function gets the latest FPGA D98 lower level + * sensor reading. + * @details \b Inputs: fpgaSensorReadings.fpgaD98LevelSensor + * @details \b Outputs: none + * @return last FPGA D98 lower level sensor reading + *************************************************************************/ +U16 getFPGAD98LevelSensor( void ) +{ + return fpgaSensorReadings.fpgaD98LevelSensor; +} + +/*********************************************************************//** + * @brief * The getFPGAD46LevelSensor function gets the latest FPGA level sensor 2 * reading. * @details \b Inputs: fpgaSensorReadings.fpgaD46LevelSensor @@ -2842,6 +2881,18 @@ /*********************************************************************//** * @brief + * The getFPGAD99Temp function gets the fresh dialysate temperature. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Fresh dialysate temperature + *************************************************************************/ +U32 getFPGAD99Temp( void ) +{ + return fpgaSensorReadings.fpgaD99Temp; +} + +/*********************************************************************//** + * @brief * The getFPGARTDReadCount function gets the RTD sensors group read count. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none @@ -3054,6 +3105,45 @@ /*********************************************************************//** * @brief + * The setFPGAD79RinsePumpControl function sets the control bit of the rinse + * pump to turn it on or off. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaDDSpareValveControl + * @return none + *************************************************************************/ +void setFPGAD79RinsePumpControl( U08 value ) +{ + fpgaActuatorSetPoints.fpgaDDSpareValveControl &= value; +} + +/*********************************************************************//** + * @brief + * The setFPGAD79RinsePumpPWMControl function sets the PWM value of the rinse + * pump to turn it on or off. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaD79PWMPumpCtl + * @return none + *************************************************************************/ +void setFPGAD79RinsePumpPWMControl( U08 value ) +{ + fpgaActuatorSetPoints.fpgaD79PWMPumpCtl = value; +} + +/*********************************************************************//** + * @brief + * The getFPGAD79RinsePumpPulseWidth function returns the 4-wire rinse pump + * pulse width. + * @details \b Inputs: d79SpeedPulseWidth + * @details \b Outputs: none + * @return fpgaSensorReadings.d79SpeedPulseWidth + *************************************************************************/ +U16 getFPGAD79RinsePumpPulseWidth( void ) +{ + return fpgaSensorReadings.d79SpeedPulseWidth; +} + +/*********************************************************************//** + * @brief * The setFPGAFPValveStates function sets the FP valve states with an 8-bit * mask of states - one bit per valve, with a 1 meaning "energized" and a 0 * meaning "de-energized". The bit positions for these bit states are as follows: @@ -3426,30 +3516,6 @@ /*********************************************************************//** * @brief - * The getFPGAP23Temperature function gets the P23 temperature sensor reading. - * @details \b Inputs: fpgaSensorReadings.tempP23 - * @details \b Outputs: none - * @return P23 temperature sensor reading - *************************************************************************/ -U32 getFPGAP23Temperature( void ) -{ - return fpgaSensorReadings.tempP23; -} - -/*********************************************************************//** - * @brief - * The getFPGAP22Temperature function gets the P22 temperature sensor reading. - * @details \b Inputs: fpgaSensorReadings.tempP22 - * @details \b Outputs: none - * @return P22 temperature sensor reading - *************************************************************************/ -U32 getFPGAP22Temperature( void ) -{ - return fpgaSensorReadings.tempP22; -} - -/*********************************************************************//** - * @brief * The getFPGAP25FloaterState function gets the P25 floater level state. * @details \b Inputs: fpgaSensorReadings.levelSwitch * @details \b Outputs: none @@ -3487,6 +3553,19 @@ /*********************************************************************//** * @brief + * The getFPGAFlowP16InternalTemp function gets the P16 flow sensor + * internal temperature. + * @details \b Inputs: fpgaSensorReadings.flowIntTempP16 + * @details \b Outputs: none + * @return P16 internal temperature + *************************************************************************/ +U16 getFPGAFlowP16InternalTemp( void ) +{ + return fpgaSensorReadings.flowIntTempP16; +} + +/*********************************************************************//** + * @brief * The getFPGAFlowP7 function gets the P7 flow rate (in mL/min). * @details \b Inputs: fpgaSensorReadings.flowRateP7 * @details \b Outputs: none @@ -3512,6 +3591,19 @@ /*********************************************************************//** * @brief + * The getFPGAFlowP7InternalTemp function gets the P7 flow sensor + * internal temperature. + * @details \b Inputs: fpgaSensorReadings.flowIntTempP7 + * @details \b Outputs: none + * @return P7 internal temperature + *************************************************************************/ +U16 getFPGAFlowP7InternalTemp( void ) +{ + return fpgaSensorReadings.flowIntTempP7; +} + +/*********************************************************************//** + * @brief * The setFPGAP9Control function sets the FPGA P9 sensor control register * to perform a given action. * bit 4..7: unused