/************************************************************************** * * Copyright (c) 2024-2024 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) Vinayakam Mani * @date (last) 05-Aug-2024 * * @author (original) Vinayakam Mani * @date (original) 05-Aug-2024 * ***************************************************************************/ #include "string.h" // for memset(), memcpy() #include "gio.h" // hal headers #include "sci.h" #include "sys_dma.h" #include "Comm.h" #include "Compatible.h" #include "FPGA.h" #include "Messaging.h" #include "OperationModes.h" #include "PersistentAlarm.h" #include "Timers.h" #include "Utilities.h" /** * @addtogroup FpgaDD * @{ */ // ********** private definitions ********** #define FPGA_EXPECTED_ID 0x04 ///< FPGA expected ID. #define MAX_COMM_ERROR_RETRIES 5 ///< Maximum number of communication error retries #define FPGA_ENABLE_VALVES_CONTROL 0x0000 ///< FPGA enable valves control. #define FPGA_ENABLE_BC_VALVES_CONTROL 0x00 ///< FPGA enable Balancing chamber valves control. #define FPGA_ENABLE_SPARE_VALVES_CNTRL 0x00 ///< FPGA enable spared valves control. #define FPGA_D17_RESET_BIT 0x01 ///< Conductivity Sensor D17 reset bit mask. #define FPGA_D17_INIT_ENABLE_BIT 0x02 ///< Conductivity Sensor D17 Initialization enable bit mask. #define FPGA_D17_WR_ENABLE_BIT 0x04 ///< Conductivity Sensor D17 write enable bit mask. #define FPGA_D17_RD_ENABLE_BIT 0x08 ///< Conductivity Sensor D17 read enable bit mask. #define FPGA_D74_RESET_BIT 0x10 ///< Conductivity Sensor D74 reset bit mask. #define FPGA_D74_INIT_ENABLE_BIT 0x20 ///< Conductivity Sensor D74 Initialization enable bit mask. #define FPGA_D74_WR_ENABLE_BIT 0x40 ///< Conductivity Sensor D74 write enable bit mask. #define FPGA_D74_RD_ENABLE_BIT 0x80 ///< Conductivity Sensor D74 read enable bit mask. #define FPGA_D27_RESET_BIT 0x01 ///< Conductivity Sensor D27 reset bit mask. #define FPGA_D27_INIT_ENABLE_BIT 0x02 ///< Conductivity Sensor D27 Initialization enable bit mask. #define FPGA_D27_WR_ENABLE_BIT 0x04 ///< Conductivity Sensor D27 write enable bit mask. #define FPGA_D27_RD_ENABLE_BIT 0x08 ///< Conductivity Sensor D27 read enable bit mask. #define FPGA_D29_RESET_BIT 0x10 ///< Conductivity Sensor D29 reset bit mask. #define FPGA_D29_INIT_ENABLE_BIT 0x20 ///< Conductivity Sensor D29 Initialization enable bit mask. #define FPGA_D29_WR_ENABLE_BIT 0x40 ///< Conductivity Sensor D29 write enable bit mask. #define FPGA_D29_RD_ENABLE_BIT 0x80 ///< Conductivity Sensor D29 read enable bit mask. #define FPGA_D43_RESET_BIT 0x01 ///< Conductivity Sensor D43 reset bit mask. #define FPGA_D43_INIT_ENABLE_BIT 0x02 ///< Conductivity Sensor D43 Initialization enable bit mask. #define FPGA_D43_WR_ENABLE_BIT 0x04 ///< Conductivity Sensor D43 write enable bit mask. #define FPGA_D43_RD_ENABLE_BIT 0x08 ///< Conductivity Sensor D43 read enable bit mask. // Assuming all valves are ON/OFF based control ( No PWM control used) #define FPGA_ENABLE_VALVES_PWM 0x0000 ///< FPGA enable valves PWM. #define FPGA_ENABLE_BC_VALVES_PWM 0x00 ///< FPGA enable Balancing chamber valves PWM. #define FPGA_ENABLE_UF_VALVES_PWM 0x00 ///< FPGA enable Ultrafiltration valves PWM. #define FPGA_ADC_AUTO_READ_ENABLE 0x11 ///< FPGA internal ADC auto read enable. #define CONCENTRATE_CAP_SWITCH_MASK 0x10 ///< Concentrate cap switch bit mask. #define FPGA_CONC_PUMP_FAULT_BITS 0x03 ///< Concentrate pump fault bits mask. #define UF_PUMP_FAULT_SHIFT 0x02 ///< Shift UF pump fault while reading, to account other dosing pumps fault. #define FPGA_UF_PUMP_FAULT_BIT 0x00 ///< UF pump fault bit mask. #define FPGA_UF_PUMP_PARKED_BIT 0x01 ///< UF pump parked status bit mask. #define FPGA_UF_PUMP_PARK_FAULT_BIT 0x02 ///< UF pump park fault status bit mask. #define FPGA_D11_PUMP_PARKED_BIT 0x04 ///< Acid Concentrate pump parked status bit mask. #define FPGA_D10_PUMP_PARKED_BIT 0x10 ///< Bicarb Concentrate pump parked status bit mask. #define FPGA_D11_PUMP_PARK_FAULT_BIT 0x08 ///< Acid Concentrate pump park fault status bit mask. #define FPGA_D10_PUMP_PARK_FAULT_BIT 0x20 ///< Bicarb Concentrate pump park fault status bit mask. #define FPGA_CONC_PUMP_PARK_COMMAND 0x80 ///< Park command bit for the concentrate pumps. #define FPGA_POWER_OUT_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< FPGA power out timeout in milliseconds. #define FPGA_D12_PUMP_ERROR_BIT 0x01 ///< Fresh dialysate pump error bit mask. #define FPGA_D48_PUMP_ERROR_BIT 0x02 ///< Spent dialysate pump error bit mask. #define FPGA_D6_FLOATER_LEVEL_BIT 0x03 ///< Floater level bit mask. #define FPGA_D5_HEATER_CNTRL_BIT 0x01 ///< FPGA GIO D5 heater control bit mask #define FPGA_D5_HEATER_PWM_ENABLE_BIT 0x02 ///< FPGA D5 PWM based heater control bit mask #define PROCESSOR_FPGA_CLOCK_DIFF_TOLERANCE 1 ///< Tolerance for processor clock speed check against FPGA clock. #define MAX_FPGA_COMM_FAILURES_WINDOW_MS ( 1 * SEC_PER_MIN * MS_PER_SECOND ) ///< FPGA comm failures window #define MAX_FPGA_COMM_FAILURES 3 ///< FPGA maximum comm failures per MAX_FPGA_COMM_FAILURES_WINDOW_MS #define MIN_POWER_ON_TIME_FOR_COMM_FAILS ( 1 * MS_PER_SECOND ) ///< Allow FPGA comm errors for first second after power-up #define FPGA_CONDUCTIVITY_RESET_BIT 0x01 ///< Conductivity Sensor reset bit mask. #define FPGA_CONDUCTIVITY_INIT_ENABLE_BIT 0x02 ///< Conductivity Sensor initialization enable bit mask. #define FPGA_CONDUCTIVITY_WR_ENABLE_BIT 0x04 ///< Conductivity Sensor write enable bit mask. #define FPGA_CONDUCTIVITY_RD_ENABLE_BIT 0x08 ///< Conductivity Sensor read enable bit mask. #pragma pack(push,1) /// FPGA header struct. typedef struct { U08 fpgaId; ///< Reg 0. FPGA ID code. Checked against expected value at power up to verify basic FPGA communication and operation U08 fpgaRevMinor; ///< Reg 1. FPGA revision (minor) being reported U08 fpgaRevMajor; ///< Reg 2. FPGA revision (major) being reported U08 fpgaRevLab; ///< Reg 3. FPGA revision (lab) being reported } FPGA_HEADER_T; // read only on FPGA /// FPGA sensor readings struct. typedef struct { U16 fpgaCompatibilityRev; ///< Reg 512. Compatibility revision U16 fpgaTimerCountMS; ///< Reg 514. Internal FPGA timer count in milliseconds U16 fpgaRemoteUpdateRead; ///< Reg 516. FPGA Remote Update Read ( copy contents from remote update write) U08 fpgaIOErrorCntProcessor; ///< Reg 518. Number of errors in Microprocessor UART interface U08 fpgaIOErrorCntPC; ///< Reg 519. Number of errors in PC UART interface U16 fpgaD9PresPressure; ///< Reg 520. D9 MPM pressure sensor RAW pressure data U16 fpgaD9PresTemp; ///< Reg 522. D9 MPM pressure sensor RAW temperature data U16 fpgaD66PresPressure; ///< Reg 524. D66 MPM pressure sensor RAW pressure data U16 fpgaD66PresTemp; ///< Reg 526. D66 MPM pressure sensor RAW temperature data U16 fpgaD51PresPressure; ///< Reg 528. D51 MPM pressure sensor RAW pressure data U16 fpgaD51PresTemp; ///< Reg 530. D51 MPM pressure sensor RAW temperature data U16 fpgaD18PresPressure; ///< Reg 532. D18 MPM pressure sensor RAW pressure data U16 fpgaD18PresTemp; ///< Reg 534. D18 MPM pressure sensor RAW temperature data U16 fpgaD41PresPressure; ///< Reg 536. D41 MPM pressure sensor RAW pressure data U16 fpgaD41PresTemp; ///< Reg 538. D41 MPM pressure sensor RAW temperature data U32 fpgaD17CondDataOut; ///< Reg 540. Data read from Conductivity Sensor D17 register U16 fpgaD17CondCond; ///< Reg 544. D17 conductivity U16 fpgaD17CondTemp; ///< Reg 546. D17 Temperature U08 fpgaD17CondReadCnt; ///< Reg 548. D17 successful read count U08 fpgaD17CondErrorCnt; ///< Reg 549. D17 error read count U32 fpgaD27CondDataOut; ///< Reg 550. Data read from Conductivity Sensor D27 register U16 fpgaD27CondCond; ///< Reg 554. D27 conductivity U16 fpgaD27CondTemp; ///< Reg 556. D27 Temperature U08 fpgaD27CondReadCnt; ///< Reg 558. D27 successful read count U08 fpgaD27CondErrorCnt; ///< Reg 559. D27 error read count U32 fpgaD29CondDataOut; ///< Reg 560. Data read from Conductivity Sensor D29 register U16 fpgaD29CondCond; ///< Reg 564. D29 conductivity U16 fpgaD29CondTemp; ///< Reg 566. D29 Temperature U08 fpgaD29CondReadCnt; ///< Reg 568. D29 successful read count U08 fpgaD29CondErrorCnt; ///< Reg 569. D29 error read count U32 fpgaD43CondDataOut; ///< Reg 570. Data read from Conductivity Sensor D43 register U16 fpgaD43CondCond; ///< Reg 574. D43 conductivity 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 fpgaD46LevelSensor; ///< Reg 582. Level Sensor 2 U08 fpgaHallSensInputs; ///< Reg 584. Hall sensor Inputs U08 fpgaD42TxFIFOCnt; ///< Reg 585. Blood leak sensor transmit FIFO count U16 fpgaD42RxErrorCnt; ///< Reg 586. Blood leak sensor Receive error count U16 fpgaD42RxFIFOCnt; ///< Reg 588. Blood leak sensor Receive FIFO count U08 fpgaD42RxFIFODataOut; ///< Reg 590. Blood leak sensor Receive data U08 fpgaD42PulseStatus; ///< Reg 591. Blood leak sensor status U16 fpgaValveStates; ///< Reg 592. Valve status read U16 fpgaValvePWMEnableStates; ///< Reg 594. Valve PWM Enable status read U08 fpgaValveBCStates; ///< Reg 596. Balancing chamber Valves states U08 fpgaValveBCPWMStates; ///< Reg 597. Balancing Chamber Valve PWM states U08 fpgaValveSpStates; ///< Reg 598. DD Spare Valves states U08 fpgaValveSpPWMStates; ///< Reg 599. Spare Valves PWM states U08 fpgaD11_D10_PumpFault; ///< Reg 600. Concentrate pump fault register for D11_Pump and D10_Pump U08 fpgaRTDCountErrorCycles; ///< Reg 601. Count of each incomplete seq of reads from RTD ADC. U16 fpgaD11PumpHallSense; ///< Reg 602. Concentrate pump D11_Pump hall sensor pulse width U16 fpgaD10PumpHallSense; ///< Reg 604. Concentrate pump D10_Pump hall sensor pulse width U32 fpgaD78Temp; ///< Reg 606. Outlet heat exchanger temperature 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 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 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 U08 fpgaD12HallStatus; ///< Reg 634. Fresh dialysate pump hall sensor direction status U08 fpgaD48HallStatus; ///< Reg 635. Spent dialysate pump hall sensor direction status U08 fpgaD6FloaterStatus; ///< Reg 636. Floater 1 level sensor status U08 fpgaFloater2Status; ///< Reg 637. Floater 2 level sensor status U16 fpgaD11PumpStepCountStatus; ///< Reg 638. Acid concentrate pump revolution down count status U16 fpgaD10PumpStepCountStatus; ///< Reg 640. Bicarb concentrate pump revolution down count status U16 fpgaAdcTemp; ///< Reg 642. TBD U16 fpgaAdcVccInt; ///< Reg 644. TBD U16 fpgaAdcVccAux; ///< Reg 646. TBD U16 fpgaAdcVpVn; ///< Reg 648. TBD U16 fpgaD12PumpSpeedFeedback; ///< Reg 650. D12 Pump speed feedback U16 fpgaD48PumpSpeedFeedback; ///< Reg 652. D48 Pump Speed feedback U16 fpgaD76PumpHallSense; ///< Reg 654. UF D76_Pump hall sensor pulse width U16 fpgaD76PumpStepCountStatus; ///< Reg 656. UF pump revolution down count status U08 fpgaD76PumpFault; ///< Reg 658: UF pump fault U08 fpga_UnUsed_3; ///< reg 659: Not used S16 pressureM1; ///< Reg 660. M1 pressure data. U16 temperatureM1; ///< Reg 662. M1 temperature data. S16 pressureM3; ///< Reg 664. M3 pressure data. U16 temperatureM3; ///< Reg 666. M3 temperature data. S16 pressureP8; ///< Reg 668. P8 pressure data. U16 temperatureP8; ///< Reg 670. P8 temperature data. S16 pressureP13; ///< Reg 672. P13 pressure data. U16 temperatureP13; ///< Reg 674. P13 temperature data. S16 pressureP17; ///< Reg 676. P17 pressure data. U16 temperatureP17; ///< Reg 678. P17 temperature data. U16 p40PumpTachCount; ///< Reg 680. P40 pump tachometer counter. U08 p25LevelSwitch; ///< Reg 682. P25 level switch. U08 reserved4; ///< Reg 683. Reserved. U32 conductivityP9Data; ///< Reg 684. P9 conductivity sensor data. U16 conductivityP9Cond; ///< Reg 688. P9 conductivity sensor conductivity. U16 conductivityP9Temp; ///< Reg 690. P9 conductivity sensor temperature. U08 conductivityP9ReadCount; ///< Reg 692. P9 conductivity sensor read counter. U08 conductivityP9ErrorCount; ///< Reg 693. P9 conductivity sensor error counter. U32 conductivityP18Data; ///< Reg 694. P18 conductivity sensor data. U16 conductivityP18Cond; ///< Reg 698. P18 conductivity sensor conductivity. U16 conductivityP18Temp; ///< Reg 700. P18 conductivity sensor temperature. U08 conductivityP18ReadCount; ///< Reg 702. P18 conductivity sensor read counter. U08 conductivityP18ErrorCount; ///< Reg 703. P18 conductivity sensor error counter. 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 flowIntTempP7; ///< Reg 712. P7 flow sensor internal temperature. U16 valveControlReadback; ///< Reg 714. Valve control bits read back. U16 valvePWMEnableReadback; ///< Reg 716. Valve PWM enable read back. U16 p12PumpPWMReadback; ///< Reg 718. P12 pump PWM read back. 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. 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. U08 ad7124readcnt; ///< Reg 741. Counter which increments when a valid transaction happens between FPGA and AD7124. U16 flowRateP16; ///< Reg 742. P16 flow sensor rate. U16 flowTempP16; ///< Reg 744. P16 flow sensor temperature. U16 flowIntTempP16; ///< Reg 746. P16 flow sensor internal temperature. U08 p16flowReadCount; ///< Reg 748. P16 Flow sensor read counter. U08 p16flowErrorCount; ///< Reg 749. P16 Flow sensor error counter. U32 fpgaD74CondDataOut; ///< Reg 750. Data read from Conductivity Sensor D74 register U16 fpgaD74CondCond; ///< Reg 754. D74 conductivity U16 fpgaD74CondTemp; ///< Reg 756. D74 Temperature U08 fpgaD74CondReadCnt; ///< Reg 758. D74 successful read count U08 fpgaD74CondErrorCnt; ///< Reg 759. D74 error read count } DD_FPGA_SENSORS_T; typedef struct { U16 fpgaValveControl; ///< Reg 04. Valve control register U16 fpgaValvePWMEnable; ///< Reg 06. Valve PWM enable U16 fpgaDDValvePWMLow; ///< Reg 08. DD valves PWM low. (VDR) U16 fpgaDDValvePWMPeriod; ///< Reg 10. DD valves PWM period (VDR) U16 fpgaDDValvePWMPullin; ///< Reg 12. DD valves pull in (VDR) U08 fpgaBCValveControl; ///< Reg 14. Balancing Chamber Valves Control Registers U08 fpgaBCValvePWMControl; ///< Reg 15. Balancing Chamber Valves PWM control U08 fpgaDDSpareValveControl; ///< Reg 16. Spare Valves Control Registers U08 fpgaDDSpareValvePWMControl; ///< Reg 17. Spare Valves PWM control U08 fpgaConSensD17D74Control; ///< Reg 18. Conductivity/Temperature Sensors D17 & D74 Control registers U08 fpgaConSensD27D29Control; ///< Reg 19. Conductivity/Temperature Sensors D27 & D29 Control registers U16 fpgaConSensD17D74_Addrs; ///< Reg 20. D17,D74 Initialization Address register U32 fpgaConSensD17D74_Data_In; ///< Reg 22. D17,D74 Initialization data register U16 fpgaConSensD27D29_Addrs; ///< Reg 26. D27,D29 Initialization Address register U32 fpgaConSensD27D29_Data_In; ///< Reg 28. D27,D29 Initialization data register U16 fpgaRemoteUpdate_Write; ///< Reg 32.Register for Remote update used by SW. U16 fpgaD12PumpSpeed; ///< Reg 34. D48 Speed/RPM Control U08 fpgaD12PumpControl; ///< Reg 36. DGP Control U08 fpgaD48PumpControl; ///< Reg 37. SDP Control U16 fpgaD48PumpSpeed; ///< Reg 38. SDP Speed/RPM Control U16 fpgaD11PumpSpeed; ///< Reg 40. Acid Concentrate Pump Speed/RPM Control U08 fpgaD11PumpControl; ///< Reg 42. Acid Concentrate Pump Control U08 fpgaD10PumpControl; ///< Reg 43. BiCarb Concentrate Pump Control U16 fpgaD10PumpSpeed; ///< Reg 44. BiCarb Concentrate Pump Speed/RPM Control U08 fpgaD42SensorTest; ///< Reg 46. Blood leak sensor test U08 fpgaD42UARTControl; ///< Reg 47. Blood leak sensor UART control 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 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 U16 fpgaVSPPWMLow; ///< Reg 58. VSP PWM low ( Spare valves ) U16 fpgaVSPPWMPeriod; ///< Reg 60. VSP PWM period U16 fpgaVSPPWMPullin; ///< Reg 62. VSP PWM pull in U16 fpgaD11PumpRevCount; ///< Reg 64. Acid Concentrate pump revolution count U16 fpgaD10PumpRevCount; ///< Reg 66. Bicarb Concentrate pump revolution count U08 fpgaADCControl; ///< Reg 68. FPGA internal ADC Control register for debugging U08 fpgaGPIOControl; ///< Reg 69. FPGA GPIO control interface U16 fpgaACRelayPWMLow; ///< Reg 70. Length of time in 10us resoultion that PWM output stays low. U16 fpgaACRelayPWMPeriod; ///< Reg 72. PWM period for AC relay/heater. U16 fpgaD76PumpSpeed; ///< Reg 74. UF Pump Speed/RPM Control U16 fpgaD76PumpRevCount; ///< Reg 76. UF pump revolution count U08 fpgaD76PumpControl; ///< Reg 78. UF Pump Control U08 notused; ///< Reg 79. Not used U16 valveControl; ///< Reg 80. Valve control register. U08 conductivityP9Control; ///< Reg 82. P9 conductivity control register. U08 conductivityP18Control; ///< Reg 83. P18 conductivity control register. U16 conductivityP9Address; ///< Reg 84. P9 conductivity address register. U32 conductivityP9Data; ///< Reg 86. P9 conductivity data in register. U16 conductivityP18Address; ///< Reg 90. P18 conductivity address register. U32 conductivityP18Data; ///< Reg 92. P18 conductivity data in register. U16 descalePumpSpeed; ///< Reg 96. Descaler pump speed register. U08 descalePumpControl; ///< Reg 98. Descaler pump control register. U08 p12PumpControl; ///< Reg 99. P12 pump control register. U16 valveVwiPWMLow; ///< Reg 100. Valve VWi PWM low pulse period in 0.1 uSec. U16 valveVwiPWMPeriod; ///< Reg 102. Valve VWi PWM full period in 0.1 uSec. U16 valvePWMPullIn; ///< Reg 104. Valve PWM high pulse period when valve is on in 0.1 uSec. U16 p12PumpPWMDutyCyclePct; ///< Reg 106. P12 pump PWM duty cycle in percentage. U16 p40PumpPWMDutyCyclePct; ///< Reg 108. P40 pump PWM duty cycle in percentage. U08 p40PumpControl; ///< Reg 110. P40 pump control register. U08 reserved1; ///< Reg 111. Reserved. U08 flowControlp7; ///< Reg 112. P7 AVS Romer flow sensor control register. U08 flowAddressp7; ///< Reg 113. P7 AVS Romer flow sensor I2C slave address register. U16 valvePWMEnable; ///< Reg 114. Valve PWM enable register. U08 flowControlp16; ///< Reg 116. P16 AVS Romer flow sensor control register. U08 flowAddressp16; ///< Reg 117. P16 AVS Romer flow sensor I2C slave address register. U08 fpgaConSensD43Control; ///< Reg 118. Conductivity/Temperature Sensors D43 Control registers U16 fpgaConSensD43_Addrs; ///< Reg 119. D43 Initialization Address register U32 fpgaConSensD43_Data_In; ///< Reg 121. D43 Initialization data register } FPGA_ACTUATORS_T; #pragma pack(pop) // ********** private data ********** static FPGA_HEADER_T fpgaHeader; ///< FPGA header structure. static DD_FPGA_SENSORS_T fpgaSensorReadings; ///< DD FPGA sensors structure. static FPGA_ACTUATORS_T fpgaActuatorSetPoints; ///< FPGA actuator set points structure. // ********** private function prototypes ********** static U16 getFPGATimerCount( void ); /*********************************************************************//** * @brief * The initFPGADD function initializes the DD FPGA unit. * @details \b Inputs: none * @details \b Outputs: FPGA unit initialized. * @return none *************************************************************************/ void initFPGADD( void ) { // Initialize fpga driver initFPGA( (U08*)&fpgaHeader, (U08*)&fpgaSensorReadings, (U08*)&fpgaActuatorSetPoints, sizeof(FPGA_HEADER_T), sizeof(DD_FPGA_SENSORS_T), sizeof(FPGA_ACTUATORS_T) ); // initialize fpga data structures memset( &fpgaHeader, 0, sizeof( FPGA_HEADER_T ) ); memset( &fpgaSensorReadings, 0, sizeof( DD_FPGA_SENSORS_T ) ); memset( &fpgaActuatorSetPoints, 0, sizeof( FPGA_ACTUATORS_T ) ); // Set the valve control mode and default state of valve fpgaActuatorSetPoints.fpgaValveControl = FPGA_ENABLE_VALVES_CONTROL; fpgaActuatorSetPoints.fpgaValvePWMEnable = FPGA_ENABLE_VALVES_PWM; fpgaActuatorSetPoints.fpgaBCValveControl = FPGA_ENABLE_BC_VALVES_CONTROL; fpgaActuatorSetPoints.fpgaBCValvePWMControl = FPGA_ENABLE_BC_VALVES_PWM; fpgaActuatorSetPoints.fpgaDDSpareValveControl = FPGA_ENABLE_SPARE_VALVES_CNTRL; fpgaActuatorSetPoints.fpgaDDSpareValvePWMControl = FPGA_ENABLE_UF_VALVES_PWM; fpgaActuatorSetPoints.fpgaADCControl = FPGA_ADC_AUTO_READ_ENABLE; // initialize FPGA clock speed error time windowed count initTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_COMM_FAILURES, MAX_FPGA_COMM_FAILURES, MAX_FPGA_COMM_FAILURES_WINDOW_MS); } /*********************************************************************//** * @brief * The execFPGATest function executes the FPGA self-test. * @details \b Inputs: fpgaHeader * @details \b Outputs: none * @details \b Alarm: ALARM_ID_DD_FPGA_POST_TEST_FAILED when FPGA compatibility failed and/or * wrong FPGA header seen. * @return passed, or failed *************************************************************************/ SELF_TEST_STATUS_T execFPGATest( void ) { SELF_TEST_STATUS_T result; // check FPGA reported correct ID if ( FPGA_EXPECTED_ID == fpgaHeader.fpgaId ) { // Check FPGA compatibility w/ firmware if ( DD_FPGA_COMPATIBILITY_REV == fpgaSensorReadings.fpgaCompatibilityRev ) { result = SELF_TEST_STATUS_PASSED; } else { result = SELF_TEST_STATUS_FAILED; SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_FPGA_POST_TEST_FAILED, (U32)DD_FPGA_COMPATIBILITY_REV, (U32)fpgaSensorReadings.fpgaCompatibilityRev ) } } else { result = SELF_TEST_STATUS_FAILED; SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DD_FPGA_POST_TEST_FAILED, (U32)fpgaHeader.fpgaId ) } return result; } /*********************************************************************//** * @brief * The execFPGAClockSpeedTest function verifies the processor clock speed * against the FPGA clock. * @details \b Inputs: time windowed error count for FPGA clock speed alarm * @details \b Outputs: none * @details \b Alarm: ALARM_ID_DD_FPGA_CLOCK_SPEED_CHECK_FAILURE when clock speed * mismatch seen. * @warning: It may be necessary to comment out the following code to prevent * the alarm from occurring while debugging. * @return: none *************************************************************************/ void execFPGAClockSpeedTest( void ) { static U16 currentFPGATimerCount_ms = 0; static U32 currentTimerCount_ms = 0; U16 const newFPGATimerCount_ms = getFPGATimerCount(); U32 const newTimerCount_ms = getMSTimerCount(); U32 const diffFPGATimerCount = (U32)u16DiffWithWrap( currentFPGATimerCount_ms, newFPGATimerCount_ms ); U32 const diffTimerCount = u32DiffWithWrap( currentTimerCount_ms, newTimerCount_ms ); if ( getCurrentOperationMode() != DD_MODE_INIT ) { if ( abs( diffFPGATimerCount - diffTimerCount ) > PROCESSOR_FPGA_CLOCK_DIFF_TOLERANCE ) { if ( TRUE == incTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_CLOCK_SPEED_ERROR ) ) { //TODO : Enable alarm later //SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_FPGA_CLOCK_SPEED_CHECK_FAILURE, diffFPGATimerCount, diffTimerCount ); } } } currentFPGATimerCount_ms = newFPGATimerCount_ms; currentTimerCount_ms = newTimerCount_ms; } /*********************************************************************//** * @brief * The setFPGADDValveStates function sets the DD valve states with a 16-bit * set 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: * 0 - D53Valve.\n * 1 - D52Valve.\n * 2 - D8Valve.\n * 3 - D54Valve.\n * 4 - D14Valve.\n * 5 - D65Valve.\n * 6 - D64Valve.\n * 7 - D31Valve.\n * 8 - D34Valve.\n * 9 - D35Valve.\n * 10 - D40Valve.\n * 11 - D47Valve.\n * 12 - D3Valve.\n * 13 - M4Valve.\n * 14..15 - reserved or unused. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaValveControl * @param valveStates bit mask for the various valve states * @return none *************************************************************************/ void setFPGADDValveStates( U16 valveStates ) { fpgaActuatorSetPoints.fpgaValveControl = valveStates; } /*********************************************************************//** * @brief * The setFPGABCValveStates function sets the DD balancing chamber valve states with a * 8-bit set 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: * 0 - D23.\n * 1 - D19.\n * 2 - D25.\n * 3 - D21.\n * 4 - D24.\n * 5 - D20.\n * 6 - D26.\n * 7 - D22.\n * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaBCValveControl * @param valveStates bit mask for the balancing chamber valve states * @return none *************************************************************************/ void setFPGABCValveStates( U08 valveStates ) { fpgaActuatorSetPoints.fpgaBCValveControl = valveStates; } /*********************************************************************//** * @brief * The setFPGASpareValveStates function sets the DD spare valve states with a * 8-bit set 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: * 0 - Not used.\n * 1 - Not used.\n * 2 - Not used.\n * 3 - Not used.\n * 4..7 - Unused or reserved.\n * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaDDSpareValveControl * @param valveStates bit mask for the spare valve states * @return none *************************************************************************/ void setFPGASpareValveStates( U08 valveStates ) { fpgaActuatorSetPoints.fpgaDDSpareValveControl = valveStates; } /*********************************************************************//** * @brief * The setFPGAD48PumpSpeed function sets the speed for the * spent dialysate pump (SDP). * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD48PumpSpeed * @param speed The spent dialysate pump speed * @return none *************************************************************************/ void setFPGAD48PumpSpeed( U16 speed ) { fpgaActuatorSetPoints.fpgaD48PumpSpeed = speed; } /*********************************************************************//** * @brief * The setFPGAD12PumpSpeed function sets the speed for the * fresh dialysate pump (DGP). * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD12PumpSpeed * @param speed The fresh dialysate pump speed * @return none *************************************************************************/ void setFPGAD12PumpSpeed( U16 speed ) { fpgaActuatorSetPoints.fpgaD12PumpSpeed = speed; } /*********************************************************************//** * @brief * The setFPGAD48PumpControl function sets the controls for * dialysate out pump (D48). * bit 7: Reserved * bit 6: Reserved * bit 5: Reserved * bit 4: Reserved * bit 3: Reserved * bit 1-2: Reserved * bit 0: Run (1), stop (0) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD48PumpControl * @param control The dialysate out pump controls * @return none *************************************************************************/ void setFPGAD48PumpControl( U08 control ) { fpgaActuatorSetPoints.fpgaD48PumpControl = control; } /*********************************************************************//** * @brief * The setFPGAD12PumpControl function sets the controls for * De gassing pump (D12). * bit 7: Reserved * bit 6: Reserved * bit 5: Reserved * bit 4: Reserved * bit 3: Reserved * bit 1-2: Reserved * bit 0: Run (1), stop (0) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD12PumpControl * @param control The dialysate In pump controls * @return none *************************************************************************/ void setFPGAD12PumpControl( U08 control ) { fpgaActuatorSetPoints.fpgaD12PumpControl = control; } /*********************************************************************//** * @brief * The setFPGAD11PumpSetStepSpeed function sets the step speed period for * concentrate pump D11_Pump. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD11PumpSpeed * @param stepSpeed The concentrate pump step speed period * @return none *************************************************************************/ void setFPGAD11PumpSetStepSpeed( U16 stepSpeed ) { fpgaActuatorSetPoints.fpgaD11PumpSpeed = stepSpeed; } /*********************************************************************//** * @brief * The setFPGAD10PumpSetStepSpeed function sets the step speed period for * concentrate pump D10_Pump. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD10PumpSpeed * @param stepSpeed The concentrate pump step speed period * @return none *************************************************************************/ void setFPGAD10PumpSetStepSpeed( U16 stepSpeed ) { fpgaActuatorSetPoints.fpgaD10PumpSpeed = stepSpeed; } /*********************************************************************//** * @brief * The setFPGAD76PumpSetStepSpeed function sets the step speed period for * UF D76_Pump. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD76PumpSpeed * @param stepSpeed The concentrate pump step speed period * @return none *************************************************************************/ void setFPGAD76PumpSetStepSpeed( U16 stepSpeed ) { fpgaActuatorSetPoints.fpgaD76PumpSpeed = stepSpeed; } /*********************************************************************//** * @brief * The setFPGAD11PumpControl function sets the DVT concentrate pump 1 * (acid pump) control mode. * bit 7: Park (set in different function) * bit 6: nSleep * bit 5: nReset * bit 4: nEnable * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD11PumpControl * @param control Concentrate pump control set * @return none *************************************************************************/ void setFPGAD11PumpControl( U08 control ) { fpgaActuatorSetPoints.fpgaD11PumpControl &= FPGA_CONC_PUMP_PARK_COMMAND; // preserve msb (park command bit) fpgaActuatorSetPoints.fpgaD11PumpControl |= control; } /*********************************************************************//** * @brief * The setFPGAD10PumpControl function sets the DVT concentrate pump 2 * (bicarb pump) control mode. * bit 7: Park (set in different function) * bit 6: nSleep * bit 5: nReset * bit 4: nEnable * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD10PumpControl * @param control Concentrate pump control set * @return none *************************************************************************/ void setFPGAD10PumpControl( U08 control ) { fpgaActuatorSetPoints.fpgaD10PumpControl &= FPGA_CONC_PUMP_PARK_COMMAND; // preserve msb (park command bit) fpgaActuatorSetPoints.fpgaD10PumpControl |= control; } /*********************************************************************//** * @brief * The setFPGAD76PumpControl function sets the UF pump * (D76 pump) control mode. * bit 7: Park (set in different function) * bit 6: nSleep * bit 5: nReset * bit 4: nEnable * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD76PumpControl * @param control UF pump control set * @return none *************************************************************************/ void setFPGAD76PumpControl( U08 control ) { fpgaActuatorSetPoints.fpgaD76PumpControl &= FPGA_CONC_PUMP_PARK_COMMAND; // preserve msb (park command bit) fpgaActuatorSetPoints.fpgaD76PumpControl |= control; } /*********************************************************************//** * @brief * The setFPGAD11PumpParkCmd function sets the DVT concentrate pump 1 * (acid pump) park command bit. * bit 7: Park command bit * bit 0-6: Other pump control bits (set in different function) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD11PumpControl * @param Park command bit set * @return none *************************************************************************/ void setFPGAD11PumpParkCmd( void ) { fpgaActuatorSetPoints.fpgaD11PumpControl |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands } /*********************************************************************//** * @brief * The setFPGAD10PumpParkCmd function sets the DVT concentrate pump 2 * (bicarb pump) park command bit. * bit 7: Park command bit * bit 0-6: Other pump control bits (set in different function) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD10PumpControl * @param Park command bit set * @return none *************************************************************************/ void setFPGAD10PumpParkCmd( void ) { fpgaActuatorSetPoints.fpgaD10PumpControl |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands } /*********************************************************************//** * @brief * The setFPGAD76PumpParkCmd function sets the Ultrafiltration pump * (D76 pump) park command bit. * bit 7: Park command bit * bit 0-6: Other pump control bits (set in different function) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD76PumpControl * @param Park command bit set * @return none *************************************************************************/ void setFPGAD76PumpParkCmd( void ) { fpgaActuatorSetPoints.fpgaD76PumpControl |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands } /*********************************************************************//** * @brief * The setFPGAD17CondReset function resets the FPGA Conductivity * Sensor D17. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param none * @return none *************************************************************************/ void setFPGAD17CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control |= FPGA_D17_RESET_BIT; } /*********************************************************************//** * @brief * The clearFPGAD17CondReset function clears the reset of FPGA Conductivity * Sensor D17. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param none * @return none *************************************************************************/ void clearFPGAD17CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control &= ~FPGA_D17_RESET_BIT; } /*********************************************************************//** * @brief * The setFPGAD17CondInitEnable function enables the FPGA Conductivity * Sensor D17 initialzation procedure. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param none * @return none *************************************************************************/ void setFPGAD17CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control |= FPGA_D17_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD17CondInitEnable function clears the init process of FPGA Conductivity * Sensor D17. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param none * @return none *************************************************************************/ void clearFPGAD17CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control &= ~FPGA_D17_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD17CondWriteEnable function enables the FPGA Conductivity * Sensor D17 write transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param none * @warning: The address (setFPGAD17D74Address) and data (setFPGACD12Data) register * must be populated before invoking this write enable function to initiate * write transaction with the sensor. * @return none *************************************************************************/ void setFPGAD17CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control |= FPGA_D17_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD17CondWriteEnable function clears the write enable of FPGA Conductivity * Sensor D17. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param none * @return none *************************************************************************/ void clearFPGAD17CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control &= ~FPGA_D17_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD17CondReadEnable function enables the FPGA Conductivity * Sensor D17 read transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param none * @warning: The address (setFPGAD17D74Address) register must be populated * before invoking this read enable function to initiate read transaction * with the sensor. * @return none *************************************************************************/ void setFPGAD17CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control |= FPGA_D17_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD17CondReadEnable function clears the read enable of FPGA Conductivity * Sensor D17. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param none * @return none *************************************************************************/ void clearFPGAD17CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control &= ~FPGA_D17_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD27CondReset function resets the FPGA Conductivity * Sensor D27. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29Control * @param none * @return none *************************************************************************/ void setFPGAD27CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control |= FPGA_D27_RESET_BIT; } /*********************************************************************//** * @brief * The clearFPGAD27CondReset function clears the reset of FPGA Conductivity * Sensor D27. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29Control * @param none * @return none *************************************************************************/ void clearFPGAD27CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control &= ~FPGA_D27_RESET_BIT; } /*********************************************************************//** * @brief * The setFPGAD27CondInitEnable function enables the FPGA Conductivity * Sensor D27 initialzation procedure. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29Control * @param none * @return none *************************************************************************/ void setFPGAD27CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control |= FPGA_D27_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD27CondInitEnable function clears the init process of FPGA Conductivity * Sensor D27. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29Control * @param none * @return none *************************************************************************/ void clearFPGAD27CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control &= ~FPGA_D27_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD27CondWriteEnable function enables the FPGA Conductivity * Sensor D27 write transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29Control * @param none * @warning: The address (setFPGACD12Address) and data (setFPGACD12Data) register * must be populated before invoking this write enable function to initiate * write transaction with the sensor. * @return none *************************************************************************/ void setFPGAD27CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control |= FPGA_D27_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD27CondWriteEnable function clears the write enable of FPGA Conductivity * Sensor D27. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29Control * @param none * @return none *************************************************************************/ void clearFPGAD27CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control &= ~FPGA_D27_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD27CondReadEnable function enables the FPGA Conductivity * Sensor D27 read transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29Control * @param none * @warning: The address (setFPGACD12Address) register must be populated * before invoking this read enable function to initiate read transaction * with the sensor. * @return none *************************************************************************/ void setFPGAD27CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control |= FPGA_D27_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD27CondReadEnable function clears the read enable of FPGA Conductivity * Sensor D27. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29Control * @param none * @return none *************************************************************************/ void clearFPGAD27CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control &= ~FPGA_D27_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGD29CondReset function resets the FPGA Conductivity * Sensor D29. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29Control * @param none * @return none *************************************************************************/ void setFPGAD29CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control |= FPGA_D29_RESET_BIT; } /*********************************************************************//** * @brief * The clearFPGAD29CondReset function clears the reset of FPGA Conductivity * Sensor D29. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29Control * @param none * @return none *************************************************************************/ void clearFPGAD29CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control &= ~FPGA_D29_RESET_BIT; } /*********************************************************************//** * @brief * The setFPGAD29CondInitEnable function enables the FPGA Conductivity * Sensor D29 initialzation procedure. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29Control * @param none * @return none *************************************************************************/ void setFPGAD29CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control |= FPGA_D29_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD29CondInitEnable function clears the init process of FPGA Conductivity * Sensor D29. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29Control * @param none * @return none *************************************************************************/ void clearFPGAD29CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control &= ~FPGA_D29_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD29CondWriteEnable function enables the FPGA Conductivity * Sensor D29 write transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29Control * @param none * @warning: The address (setFPGACD12Address) and data (setFPGACD12Data) register * must be populated before invoking this write enable function to initiate * write transaction with the sensor. * @return none *************************************************************************/ void setFPGAD29CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control |= FPGA_D29_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD29CondWriteEnable function clears the write enable of FPGA Conductivity * Sensor D29. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29Control * @param none * @return none *************************************************************************/ void clearFPGAD29CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control &= ~FPGA_D29_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD29CondReadEnable function enables the FPGA Conductivity * Sensor D29 read transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29Control * @param none * @warning: The address (setFPGACD12Address) register must be populated * before invoking this read enable function to initiate read transaction * with the sensor. * @return none *************************************************************************/ void setFPGAD29CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control |= FPGA_D29_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD29CondReadEnable function clears the read enable of FPGA Conductivity * Sensor D29. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29Control * @param none * @return none *************************************************************************/ void clearFPGAD29CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control &= ~FPGA_D29_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD43CondReset function resets the FPGA Conductivity * Sensor D43. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD43Control * @param none * @return none *************************************************************************/ void setFPGAD43CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensD43Control |= FPGA_D43_RESET_BIT; } /*********************************************************************//** * @brief * The clearFPGAD43CondReset function clears the reset of FPGA Conductivity * Sensor D43. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD43Control * @param none * @return none *************************************************************************/ void clearFPGAD43CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensD43Control &= ~FPGA_D43_RESET_BIT; } /*********************************************************************//** * @brief * The setFPGAD43CondInitEnable function enables the FPGA Conductivity * Sensor D43 initialzation procedure. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD43Control * @param none * @return none *************************************************************************/ void setFPGAD43CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD43Control |= FPGA_D43_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD43CondInitEnable function clears the init process of FPGA Conductivity * Sensor D43. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD43Control * @param none * @return none *************************************************************************/ void clearFPGAD43CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD43Control &= ~FPGA_D43_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD43CondWriteEnable function enables the FPGA Conductivity * Sensor D43 write transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD43Control * @param none * @warning: The address (setFPGACD12Address) and data (setFPGACD12Data) register * must be populated before invoking this write enable function to initiate * write transaction with the sensor. * @return none *************************************************************************/ void setFPGAD43CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD43Control |= FPGA_D43_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD43CondWriteEnable function clears the write enable of FPGA Conductivity * Sensor D43. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD43Control * @param none * @return none *************************************************************************/ void clearFPGAD43CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD43Control &= ~FPGA_D43_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD43CondReadEnable function enables the FPGA Conductivity * Sensor D43 read transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD43Control * @param none * @warning: The address (setFPGACD12Address) register must be populated * before invoking this read enable function to initiate read transaction * with the sensor. * @return none *************************************************************************/ void setFPGAD43CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD43Control |= FPGA_D43_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD43CondReadEnable function clears the read enable of FPGA Conductivity * Sensor D43. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD43Control * @param none * @return none *************************************************************************/ void clearFPGAD43CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD43Control &= ~FPGA_D43_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD74CondReset function resets the FPGA Conductivity * Sensor D74. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param none * @return none *************************************************************************/ void setFPGAD74CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control |= FPGA_D74_RESET_BIT; } /*********************************************************************//** * @brief * The clearFPGAD74CondReset function clears the reset of FPGA Conductivity * Sensor D74. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param none * @return none *************************************************************************/ void clearFPGAD74CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control &= ~FPGA_D74_RESET_BIT; } /*********************************************************************//** * @brief * The setFPGAD74CondInitEnable function enables the FPGA Conductivity * Sensor D74 initialzation procedure. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param none * @return none *************************************************************************/ void setFPGAD74CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control |= FPGA_D74_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD74CondInitEnable function clears the init process of FPGA Conductivity * Sensor D74. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param none * @return none *************************************************************************/ void clearFPGAD74CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control &= ~FPGA_D74_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD74CondWriteEnable function enables the FPGA Conductivity * Sensor D74 write transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param none * @warning: The address (setFPGACD74Address) and data (setFPGACD74Data) register * must be populated before invoking this write enable function to initiate * write transaction with the sensor. * @return none *************************************************************************/ void setFPGAD74CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control |= FPGA_D74_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD74CondWriteEnable function clears the write enable of FPGA Conductivity * Sensor D74. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param none * @return none *************************************************************************/ void clearFPGAD74CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control &= ~FPGA_D74_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD74CondReadEnable function enables the FPGA Conductivity * Sensor D74 read transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param none * @warning: The address (setFPGACD74Address) register must be populated * before invoking this read enable function to initiate read transaction * with the sensor. * @return none *************************************************************************/ void setFPGAD74CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control |= FPGA_D74_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD74CondReadEnable function clears the read enable of FPGA Conductivity * Sensor D74. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param none * @return none *************************************************************************/ void clearFPGAD74CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control &= ~FPGA_D74_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD17D74Control function sets the FPGA Conductivity * Sensor control register for D17 and D74. * bit 7: Enables D74 read transaction (1), address needed * bit 6: Enables D74 write transaction (1), address and data needs to be set * bit 5: Enable D74 Init procedure (1) * bit 4: reset D74 Conduct sensor (1) * bit 3: Enables D17 read transaction (1), address needed * bit 2: Enables D17 write transaction (1), address and data needs to be set * bit 1: Enable D17 Init procedure (1) * bit 0: reset D17 Conduct sensor (1) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74Control * @param control Conductivity Sensor control set * @return none *************************************************************************/ void setFPGAD17D74Control( U08 control ) { fpgaActuatorSetPoints.fpgaConSensD17D74Control = control; } /*********************************************************************//** * @brief * The setFpgaCD34Control function sets the FPGA Conductivity * Sensor control register for D27 and D29. * bit 7: Enables D29 read transaction (1), address needed * bit 6: Enables D29 write transaction (1), address and data needs to be set * bit 5: Enable D29 Init procedure (1) * bit 4: reset D29 Conduct sensor (1) * bit 3: Enables D27 read transaction (1), address needed * bit 2: Enables D27 write transaction (1), address and data needs to be set * bit 1: Enable D27 Init procedure (1) * bit 0: reset D27 Conduct sensor (1) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param control Conductivity sensor control set * @return none *************************************************************************/ void setFPGAD27D29Control( U08 control ) { fpgaActuatorSetPoints.fpgaConSensD27D29Control = control; } /*********************************************************************//** * @brief * The setFpgaCD5Control function sets the FPGA Conductivity * Sensor control register for D43. * bit 4- 7: Reserved. * bit 3: Enables D43 read transaction (1), address needed * bit 2: Enables D43 write transaction (1), address and data needs to be set * bit 1: Enable D43 Init procedure (1) * bit 0: reset D43 Conduct sensor (1) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control * @param control Conductivity sensor control set * @return none *************************************************************************/ void setFPGAD43Control( U08 control ) { fpgaActuatorSetPoints.fpgaConSensD43Control = control; } /*********************************************************************//** * @brief * The setFPGAD17D74Address function sets the conductivity sensor * CD12 address register to perform read and write operations. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74_Addrs * @param address The conductivity sensor D17 and D74 address * @return none *************************************************************************/ void setFPGAD17D74Address( U16 address ) { fpgaActuatorSetPoints.fpgaConSensD17D74_Addrs = address; } /*********************************************************************//** * @brief * The setFPGAD27D29Address function sets the conductivity sensor * CD34 address register to perform read and write operations. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29_Addrs * @param address The conductivity sensor CD34 address * @return none *************************************************************************/ void setFPGAD27D29Address( U16 address ) { fpgaActuatorSetPoints.fpgaConSensD27D29_Addrs = address; } /*********************************************************************//** * @brief * The setFPGAD43Address function sets the conductivity sensor * D74 address register to perform read and write operations. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD43_Addrs * @param address The conductivity sensor D43 address * @return none *************************************************************************/ void setFPGAD43Address( U16 address ) { fpgaActuatorSetPoints.fpgaConSensD43_Addrs = address; } /*********************************************************************//** * @brief * The setFPGAD17D74Data function sets the conductivity sensor * CD12 data outputfor write operations. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD17D74_Data_In * @param data The conductivity sensor D17 and D74 Data * @return none *************************************************************************/ void setFPGAD17D74Data( U32 data ) { fpgaActuatorSetPoints.fpgaConSensD17D74_Data_In = data; } /*********************************************************************//** * @brief * The setFPGAD27D29Data function sets the conductivity sensor * CD34 data outputfor write operations. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD27D29_Data_In * @param data The conductivity sensor D27 and D29 Data * @return none *************************************************************************/ void setFPGAD27D29Data( U32 data ) { fpgaActuatorSetPoints.fpgaConSensD27D29_Data_In = data; } /*********************************************************************//** * @brief * The setFPGAD43Data function sets the conductivity sensor * D43 data output for write operations. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD43_Data_In * @param data The conductivity sensor D43 Data * @return none *************************************************************************/ void setFPGAD43Data( U32 data ) { fpgaActuatorSetPoints.fpgaConSensD43_Data_In = data; } /*********************************************************************//** * @brief * The setFPGAD5HeaterPWMControl function sets the primary heater * PWM input. * @details \b Inputs: none * @details \b Outputs: fpgaD5HeaterPWMControl * @param control the PWM dutycycle to control the heater * @return none *************************************************************************/ void setFPGAD5HeaterPWMControl( U08 control ) { fpgaActuatorSetPoints.fpgaD5HeaterPWMControl = control; } /*********************************************************************//** * @brief * The setFPGAD45HeaterPWMControl function sets the trimmer heater * PWM input. * @details \b Inputs: none * @details \b Outputs: fpgaD45HeaterPWMControl * @param control the PWM dutycycle to control the heater * @return none *************************************************************************/ void setFPGAD45HeaterPWMControl( U08 control ) { fpgaActuatorSetPoints.fpgaD45HeaterPWMControl = control; } /*********************************************************************//** * @brief * The setFPGAD11PumpRevolutionCount function sets the Acid concentrate * pump revolution count. * @details \b Inputs: none * @details \b Outputs: fpgaD11PumpRevCount * @param count the number of revolution to be rotated for the pump. * @return none *************************************************************************/ void setFPGAD11PumpRevolutionCount( U16 count ) { fpgaActuatorSetPoints.fpgaD11PumpRevCount = count; } /*********************************************************************//** * @brief * The setFPGAD10PumpRevolutionCount function sets the Bicarb concentrate * pump revolution count. * @details \b Inputs: none * @details \b Outputs: fpgaD10PumpRevCount * @param count the number of revolution to be rotated for the pump. * @return none *************************************************************************/ void setFPGAD10PumpRevolutionCount( U16 count ) { fpgaActuatorSetPoints.fpgaD10PumpRevCount = count; } /*********************************************************************//** * @brief * The setFPGAD76PumpRevolutionCount function sets the UltraFilteration * pump revolution count. * @details \b Inputs: none * @details \b Outputs: fpgaD76PumpRevCount * @param count the number of revolution to be rotated for the pump. * @return none *************************************************************************/ void setFPGAD76PumpRevolutionCount( U16 count ) { fpgaActuatorSetPoints.fpgaD76PumpRevCount = count; } /*********************************************************************//** * @brief * The setFPGAD5HeaterOnOffControl function sets the primary heater * On/Off control. * @details \b Inputs: none * @details \b Outputs: fpgaGPIOControl * @param flag Turn heater ON when true, otherwise not. * @return none *************************************************************************/ void setFPGAD5HeaterOnOffControl( BOOL flag ) { if ( TRUE == flag) { fpgaActuatorSetPoints.fpgaGPIOControl |= FPGA_D5_HEATER_CNTRL_BIT; } else { fpgaActuatorSetPoints.fpgaGPIOControl &= ~FPGA_D5_HEATER_CNTRL_BIT; } } /*********************************************************************//** * @brief * The setFPGAD5HeaterPWMEnableControl function sets whether the primary heater * control based out of On/OFF (0) or PWM based control (1). * @details \b Inputs: none * @details \b Outputs: fpgaGPIOControl * @param enable PWM based heater control when true, otherwise On/Off Control. * @return none *************************************************************************/ void setFPGAD5HeaterPWMEnableControl( BOOL enable ) { if ( TRUE == enable) { fpgaActuatorSetPoints.fpgaGPIOControl |= FPGA_D5_HEATER_PWM_ENABLE_BIT; } else { fpgaActuatorSetPoints.fpgaGPIOControl &= ~FPGA_D5_HEATER_PWM_ENABLE_BIT; } } /*********************************************************************//** * @brief * The setFPGAD5HeaterPWMLowState function sets the PWM low period( Off time) * for AC heater. * @details \b Inputs: none * @details \b Outputs: fpgaACRelayPWMLow * @param count the number of count that PWM stays low for the AC relay/heater. * @return none *************************************************************************/ void setFPGAD5HeaterPWMLowState( U16 count ) { fpgaActuatorSetPoints.fpgaACRelayPWMLow = count; } /*********************************************************************//** * @brief * The setFPGAD5HeaterPWMPeriod function sets the PWM period( On and Off time) * for AC heater. * @details \b Inputs: none * @details \b Outputs: fpgaACRelayPWMPeriod * @param period the total period of PWM cycle ( On and Off time). * @return none *************************************************************************/ void setFPGAD5HeaterPWMPeriod( U16 period ) { fpgaActuatorSetPoints.fpgaACRelayPWMPeriod = period; } /*********************************************************************//** * @brief * The getFPGAVersions function gets the FPGA version numbers. * @details \b Inputs: fpgaHeader * @details \b Outputs: none * @return none *************************************************************************/ void getFPGAVersions( U08 *Id, U08 *Maj, U08 *Min, U08 *Lab ) { *Id = fpgaHeader.fpgaId; *Maj = fpgaHeader.fpgaRevMajor; *Min = fpgaHeader.fpgaRevMinor; *Lab = fpgaHeader.fpgaRevLab; } /*********************************************************************//** * @brief * The getFPGAD48PumpControl function gets the status of the * dialysate out pump control status bits. * bit 7: TBD * bit 6: TBD * bit 5: TBD * bit 4: TBD * bit 3: TBD * bit 1-2: TBD * bit 0: Run (1), stop (0) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD48PumpControl * @return Dialysate Out pump control status bit *************************************************************************/ U08 getFPGAD48PumpControl( void ) { return fpgaActuatorSetPoints.fpgaD48PumpControl; } /*********************************************************************//** * @brief * The getFPGAD12PumpControl function gets the status of the * dialysate Inlet pump control status bits. * bit 7: TBD * bit 6: TBD * bit 5: TBD * bit 4: TBD * bit 3: TBD * bit 1-2: TBD * bit 0: Run (1), stop (0) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD12PumpControl * @return Dialysate Inlet pump control status bit *************************************************************************/ U08 getFPGAD12PumpControl( void ) { return fpgaActuatorSetPoints.fpgaD12PumpControl; } /*********************************************************************//** * @brief * The getFPGAD48PumpSpeed function gets the spent dialysate * pump speed. * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.fpgaD48MeasuredSpeed * @return Spent dialysate pump measured speed. *************************************************************************/ U16 getFPGAD48PumpSpeed( void ) { return fpgaSensorReadings.fpgaD48MeasuredSpeed; } /*********************************************************************//** * @brief * The getFPGAD12PumpSpeed function gets the fresh dialysate * pump speed. * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.fpgaD12MeasuredSpeed * @return fresh dialysate pump measured speed. *************************************************************************/ U16 getFPGAD12PumpSpeed( void ) { return fpgaSensorReadings.fpgaD12MeasuredSpeed; } /*********************************************************************//** * @brief * The getFPGAD12PumpErrorStatus function gets the fresh dialysate * pump error status. * bit 7-2: TBD * bit 1 : spent dialysate pump error (1), no error(0) * bit 0 : fresh dialysate pump error (1), no error(0) * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.fpgaD12D48PumpStatus * @return fresh dialysate pump error status. *************************************************************************/ BOOL getFPGAD12PumpErrorStatus( void ) { U08 mask = fpgaSensorReadings.fpgaD12D48PumpStatus & FPGA_D12_PUMP_ERROR_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief * The getFPGAD48PumpErrorStatus function gets the spent dialysate * pump error status. * bit 7-2: TBD * bit 1 : spent dialysate pump error (1), no error(0) * bit 0 : fresh dialysate pump error (1), no error(0) * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.fpgaD12D48PumpStatus * @return spent dialysate pump error status. *************************************************************************/ BOOL getFPGAD48PumpErrorStatus( void ) { U08 mask = fpgaSensorReadings.fpgaD12D48PumpStatus & FPGA_D48_PUMP_ERROR_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief * The getFPGAD12PumpCurrentFeedback function gets the fresh dialysate * pump current consumption. * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.fpgaD12CurrentFeedback * @return fresh dialysate pump measured current. *************************************************************************/ U16 getFPGAD12PumpCurrentFeedback( void ) { return fpgaSensorReadings.fpgaD12CurrentFeedback; } /*********************************************************************//** * @brief * The getFPGAD48PumpCurrentFeedback function gets the spent dialysate * pump current consumption. * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.fpgaD48CurrentFeedback * @return spent dialysate pump measured current. *************************************************************************/ U16 getFPGAD48PumpCurrentFeedback( void ) { return fpgaSensorReadings.fpgaD48CurrentFeedback; } /*********************************************************************//** * @brief * The getFPGAD12PumpHallDirectionStatus function gets the fresh dialysate * pump hall sensor based direction error status. * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.fpgaD12HallStatus * @return fresh dialysate pump hall sensor based direction status. *************************************************************************/ U08 getFPGAD12PumpHallDirectionStatus( void ) { return fpgaSensorReadings.fpgaD12HallStatus; } /*********************************************************************//** * @brief * The getFPGAD48PumpHallDirectionStatus function gets the spent dialysate * pump hall sensor based direction error status. * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.fpgaD48HallStatus * @return spent dialysate pump hall sensor based direction status. *************************************************************************/ U08 getFPGAD48PumpHallDirectionStatus( void ) { return fpgaSensorReadings.fpgaD48HallStatus; } /*********************************************************************//** * @brief * The getFPGAD11PumpControlStatus function gets the status of the * acid pump control status bits. * bit 7: Park (set in different function) * bit 6: nSleep * bit 5: nReset * bit 4: nEnable * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD11PumpControl * @return Acid pump control status bit *************************************************************************/ U08 getFPGAD11PumpControlStatus( void ) { return fpgaActuatorSetPoints.fpgaD11PumpControl; } /*********************************************************************//** * @brief * The getFPGAD10PumpControlStatus function gets the DVT concentrate pump 2 * (bicarb pump) control mode. * bit 7: Park (set in different function) * bit 6: nSleep * bit 5: nReset * bit 4: nEnable * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD10PumpControl * @return Bicarb pump control status bit *************************************************************************/ U08 getFPGAD10PumpControlStatus( void ) { return fpgaActuatorSetPoints.fpgaD10PumpControl; } /*********************************************************************//** * @brief * The getFPGAD76PumpControlStatus function gets the Ultrafilteration pump * (D76 pump) control mode. * bit 7: Park (set in different function) * bit 6: nSleep * bit 5: nReset * bit 4: nEnable * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD76PumpControl * @return UF pump control status bit *************************************************************************/ U08 getFPGAD76PumpControlStatus( void ) { return fpgaActuatorSetPoints.fpgaD76PumpControl; } /*********************************************************************//** * @brief * The getFPGAUFPumpFault function gets UF pumps fault * reported by FGPA. * @details \b Inputs: fpgaSensorReadings.fpgaD76PumpFault * @details \b Outputs: none * @return Latest UF pumps fault value *************************************************************************/ U08 getFPGAUFPumpFault( void ) { return ( ( fpgaSensorReadings.fpgaD76PumpFault & FPGA_UF_PUMP_FAULT_BIT ) << UF_PUMP_FAULT_SHIFT ); } /*********************************************************************//** * @brief * The getFPGAD76PumpIsParked function gets whether the UF pump is currently * parked. * @details \b Inputs: fpgaSensorReadings.fpgaD76PumpFault * @details \b Outputs: none * @return TRUE if UF pump is parked, FALSE if not *************************************************************************/ BOOL getFPGAD76PumpIsParked( void ) { U08 mask = fpgaSensorReadings.fpgaD76PumpFault & FPGA_UF_PUMP_PARKED_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief * The getFPGAD76PumpParkFault function gets whether the UF pump park command * has faulted. * @details \b Inputs: fpgaSensorReadings.fpgaD76PumpFault * @details \b Outputs: none * @return TRUE if UF pump park command faulted, FALSE if not *************************************************************************/ BOOL getFPGAD76PumpParkFault( void ) { U08 mask = fpgaSensorReadings.fpgaD76PumpFault & FPGA_UF_PUMP_PARK_FAULT_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief * The getFPGAConcentratePumpsFault function gets concentrate pumps fault * reported by FGPA. * @details \b Inputs: fpgaSensorReadings.fpgaD11_D10_PumpFault * @details \b Outputs: none * @return Latest concentrate pumps fault value *************************************************************************/ U08 getFPGAConcentratePumpsFault( void ) { return fpgaSensorReadings.fpgaD11_D10_PumpFault & FPGA_CONC_PUMP_FAULT_BITS; } /*********************************************************************//** * @brief * The getFPGAD11PumpIsParked function gets whether the acid pump is currently * parked. * @details \b Inputs: fpgaSensorReadings.fpgaD11_D10_PumpFault * @details \b Outputs: none * @return TRUE if acid pump is parked, FALSE if not *************************************************************************/ BOOL getFPGAD11PumpIsParked( void ) { U08 mask = fpgaSensorReadings.fpgaD11_D10_PumpFault & FPGA_D11_PUMP_PARKED_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief * The getFPGAD10PumpIsParked function gets whether the bicarb pump is currently * parked. * @details \b Inputs: fpgaSensorReadings.fpgaD11_D10_PumpFault * @details \b Outputs: none * @return TRUE if bicarb pump is parked, FALSE if not *************************************************************************/ BOOL getFPGAD10PumpIsParked( void ) { U08 mask = fpgaSensorReadings.fpgaD11_D10_PumpFault & FPGA_D10_PUMP_PARKED_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief * The getFPGAD11PumpParkFault function gets whether the acid pump park command * has faulted. * @details \b Inputs: fpgaSensorReadings.fpgaD11_D10_PumpFault * @details \b Outputs: none * @return TRUE if acid pump park command faulted, FALSE if not *************************************************************************/ BOOL getFPGAD11PumpParkFault( void ) { U08 mask = fpgaSensorReadings.fpgaD11_D10_PumpFault & FPGA_D11_PUMP_PARK_FAULT_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief * The getFPGAD10PumpParkFault function gets whether the bicarb pump park command * has faulted. * @details \b Inputs: fpgaSensorReadings.fpgaD11_D10_PumpFault * @details \b Outputs: none * @return TRUE if bicarb pump park command faulted, FALSE if not *************************************************************************/ BOOL getFPGAD10PumpParkFault( void ) { U08 mask = fpgaSensorReadings.fpgaD11_D10_PumpFault & FPGA_D10_PUMP_PARK_FAULT_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief * The getFPGAD11PumpHallSensePulseWidth function gets concentrate pump D11_Pump * hall sense pulse width. * @details \b Inputs: fpgaSensorReadings.fpgaD11PumpHallSense * @details \b Outputs: none * @return concentrate pump D11_Pump hall sense pulse width *************************************************************************/ U16 getFPGAD11PumpHallSensePulseWidth( void ) { return fpgaSensorReadings.fpgaD11PumpHallSense; } /*********************************************************************//** * @brief * The getFPGAD10PumpHallSensePulseWidth function gets concentrate pump D10_Pump * hall sense pulse width. * @details \b Inputs: fpgaSensorReadings.fpgaD10PumpHallSense * @details \b Outputs: none * @return concentrate pump D10_Pump hall sense pulse width *************************************************************************/ U16 getFPGAD10PumpHallSensePulseWidth( void ) { return fpgaSensorReadings.fpgaD10PumpHallSense; } /*********************************************************************//** * @brief * The getFPGAD76PumpHallSensePulseWidth function gets UF pump D76_Pump * hall sense pulse width. * @details \b Inputs: fpgaSensorReadings.fpgaD76PumpHallSense * @details \b Outputs: none * @return ultrafiltration pump D76_Pump hall sense pulse width *************************************************************************/ U16 getFPGAD76PumpHallSensePulseWidth( void ) { return fpgaSensorReadings.fpgaD76PumpHallSense; } /*********************************************************************//** * @brief * The getFPGADDValveStates function gets the latest sensed valve states. * See setFPGADDValveStates for valve state bit positions. * @details \b Inputs: fpgaSensorReadings.fpgaValveStates * @details \b Outputs: none * @return last valve states reading *************************************************************************/ U16 getFPGADDValveStates( void ) { return fpgaSensorReadings.fpgaValveStates; } /*********************************************************************//** * @brief * The getFPGAValveBCStates function gets the latest sensed balancing * chamber valve states. * See setFPGABCValveStates for BC valve state bit positions. * @details \b Inputs: fpgaSensorReadings.fpgaValveBCStates * @details \b Outputs: none * @return last balancing chamber valve states reading *************************************************************************/ U08 getFPGAValveBCStates( void ) { return fpgaSensorReadings.fpgaValveBCStates; } /*********************************************************************//** * @brief * The getFPGAValveSpStates function gets the latest sensed spare * valve states. * See setFPGAUFValveStates for Spare valve state bit positions. * @details \b Inputs: fpgaSensorReadings.fpgaValveSpStates * @details \b Outputs: none * @return last spare valve states reading *************************************************************************/ U08 getFPGAValveSpStates( void ) { return fpgaSensorReadings.fpgaValveSpStates; } /*********************************************************************//** * @brief * The getFPGAD9PresRawPressure function gets hydraulics outlet pressure sensor raw * pressure value. * @details \b Inputs: fpgaSensorReadings.fpgaD9PresPressure * @details \b Outputs: none * @return Latest hydraulics outlet pressure sensor raw pressure data *************************************************************************/ U16 getFPGAD9PresRawPressure( void ) { return fpgaSensorReadings.fpgaD9PresPressure; } /*********************************************************************//** * @brief * The getFPGAD9PresRawTemperature function gets hydraulics outlet pressure sensor raw * temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD9PresTemp * @details \b Outputs: none * @return Latest hydraulics outlet pressure sensor raw temperature data *************************************************************************/ U16 getFPGAD9PresRawTemperature( void ) { return fpgaSensorReadings.fpgaD9PresTemp; } /*********************************************************************//** * @brief * The getFPGAD66PresRawPressure function gets Bibag pressure sensor raw * pressure value. * @details \b Inputs: fpgaSensorReadings.fpgaD66PresPressure * @details \b Outputs: none * @return Latest Bibag pressure sensor raw pressure data *************************************************************************/ U16 getFPGAD66PresRawPressure( void ) { return fpgaSensorReadings.fpgaD66PresPressure; } /*********************************************************************//** * @brief * The getFPGAD66PresRawTemperature function gets Bibag pressure sensor raw * temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD66PresTemp * @details \b Outputs: none * @return Latest Bibag pressure sensor raw temperature data *************************************************************************/ U16 getFPGAD66PresRawTemperature( void ) { return fpgaSensorReadings.fpgaD66PresTemp; } /*********************************************************************//** * @brief * The getFPGAD51PresRawPressure function gets spent dialysate pressure sensor raw * pressure value. * @details \b Inputs: fpgaSensorReadings.fpgaD51PresPressure * @details \b Outputs: none * @return Latest spent dialysate pressure sensor raw pressure data *************************************************************************/ U16 getFPGAD51PresRawPressure( void ) { return fpgaSensorReadings.fpgaD51PresPressure; } /*********************************************************************//** * @brief * The getFPGAD51PresRawTemperature function gets spent dialysate pressure sensor raw * temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD51PresTemp * @details \b Outputs: none * @return Latest spent dialysate pressure sensor raw temperature data *************************************************************************/ U16 getFPGAD51PresRawTemperature( void ) { return fpgaSensorReadings.fpgaD51PresTemp; } /*********************************************************************//** * @brief * The getFPGAD18PresRawPressure function gets fresh dialysate pressure sensor raw * pressure value. * @details \b Inputs: fpgaSensorReadings.fpgaD18PresPressure * @details \b Outputs: none * @return Latest fresh dialysate pressure sensor raw pressure data *************************************************************************/ U16 getFPGAD18PresRawPressure( void ) { return fpgaSensorReadings.fpgaD18PresPressure; } /*********************************************************************//** * @brief * The getFPGAD18PresRawTemperature function gets fresh dialysate pressure sensor raw * temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD18PresTemp * @details \b Outputs: none * @return Latest fresh dialysate pressure sensor raw temperature data *************************************************************************/ U16 getFPGAD18PresRawTemperature( void ) { return fpgaSensorReadings.fpgaD18PresTemp; } /*********************************************************************//** * @brief * The getFPGAD41PresRawPressure function gets transmembrane pressure sensor raw * pressure value. * @details \b Inputs: fpgaSensorReadings.fpgaD41PresPressure * @details \b Outputs: none * @return Latest transmembrane pressure sensor raw pressure data *************************************************************************/ U16 getFPGAD41PresRawPressure( void ) { return fpgaSensorReadings.fpgaD41PresPressure; } /*********************************************************************//** * @brief * The getFPGAD41PresRawTemperature function gets transmembrane pressure sensor raw * temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD41PresTemp * @details \b Outputs: none * @return Latest transmembrane pressure sensor raw temperature data *************************************************************************/ U16 getFPGAD41PresRawTemperature( void ) { return fpgaSensorReadings.fpgaD41PresTemp; } /*********************************************************************//** * @brief * The getFPGACD1ReadCount function gets D17 conductivity sensor read count. * @details \b Inputs: fpgaSensorReadings.fpgaD17CondReadCnt * @details \b Outputs: none * @return Latest D17 conductivity sensor read count *************************************************************************/ U08 getFPGAD17CondReadCount( void ) { return fpgaSensorReadings.fpgaD17CondReadCnt; } /*********************************************************************//** * @brief * The getFPGAD17CondErrorCount function gets D17 conductivity sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaD17CondErrorCnt * @details \b Outputs: none * @return Latest D17 conductivity sensor read error count *************************************************************************/ U08 getFPGAD17CondErrorCount( void ) { return fpgaSensorReadings.fpgaD17CondErrorCnt; } /*********************************************************************//** * @brief * The getFPGAD17Cond function gets D17 conductivity sensor value. * @details \b Inputs: fpgaSensorReadings.fpgaCD1 * @details \b Outputs: none * @return Latest D17 conductivity sensor value *************************************************************************/ U16 getFPGAD17Cond( void ) { return fpgaSensorReadings.fpgaD17CondCond; } /*********************************************************************//** * @brief * The getFPGAD17CondTemp function gets D17 conductivity sensor temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaCD1Temp * @details \b Outputs: none * @return Latest D17 conductivity sensor temperature value *************************************************************************/ U16 getFPGAD17CondTemp( void ) { return fpgaSensorReadings.fpgaD17CondTemp; } /*********************************************************************//** * @brief * The getFPGAD17CondData function gets D17 conductivity sensor register value. * @details \b Inputs: fpgaSensorReadings.fpgaD17CondDataOut * @details \b Outputs: none * @return Latest D17 conductivity sensor register data value *************************************************************************/ U32 getFPGAD17CondData( void ) { return fpgaSensorReadings.fpgaD17CondDataOut; } /*********************************************************************//** * @brief * The getFPGAD27CondReadCount function gets D27 conductivity sensor read count. * @details \b Inputs: fpgaSensorReadings.fpgaD27CondReadCnt * @details \b Outputs: none * @return Latest D27 conductivity sensor read count *************************************************************************/ U08 getFPGAD27CondReadCount( void ) { return fpgaSensorReadings.fpgaD27CondReadCnt; } /*********************************************************************//** * @brief * The getFPGAD27CondErrorCount function gets D27 conductivity sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaD27CondErrorCnt * @details \b Outputs: none * @return Latest D27 conductivity sensor read error count *************************************************************************/ U08 getFPGAD27CondErrorCount( void ) { return fpgaSensorReadings.fpgaD27CondErrorCnt; } /*********************************************************************//** * @brief * The getFPGAD27Cond function gets D27 conductivity sensor value. * @details \b Inputs: fpgaSensorReadings.fpgaD27Cond * @details \b Outputs: none * @return Latest D27 conductivity sensor value *************************************************************************/ U16 getFPGAD27Cond( void ) { return fpgaSensorReadings.fpgaD27CondCond; } /*********************************************************************//** * @brief * The getFPGAD27CondTemp function gets D27 conductivity sensor temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD27CondTemp * @details \b Outputs: none * @return Latest D27 conductivity sensor temperature value *************************************************************************/ U16 getFPGAD27CondTemp( void ) { return fpgaSensorReadings.fpgaD27CondTemp; } /*********************************************************************//** * @brief * The getFPGAD27CondData function gets D27 conductivity sensor register value. * @details \b Inputs: fpgaSensorReadings.fpgaD27CondDataOut * @details \b Outputs: none * @return Latest D27 conductivity sensor register data value *************************************************************************/ U32 getFPGAD27CondData( void ) { return fpgaSensorReadings.fpgaD27CondDataOut; } /*********************************************************************//** * @brief * The getFPGAD29CondReadCount function gets D29 conductivity sensor read count. * @details \b Inputs: fpgaSensorReadings.fpgaD29CondReadCnt * @details \b Outputs: none * @return Latest D29 conductivity sensor read count *************************************************************************/ U08 getFPGAD29CondReadCount( void ) { return fpgaSensorReadings.fpgaD29CondReadCnt; } /*********************************************************************//** * @brief * The getFPGAD29CondErrorCount function gets D29 conductivity sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaD29CondErrorCnt * @details \b Outputs: none * @return Latest D29 conductivity sensor read error count *************************************************************************/ U08 getFPGAD29CondErrorCount( void ) { return fpgaSensorReadings.fpgaD29CondErrorCnt; } /*********************************************************************//** * @brief * The getFPGAD29Cond function gets D29 conductivity sensor value. * @details \b Inputs: fpgaSensorReadings.fpgaD29Cond * @details \b Outputs: none * @return Latest D29 conductivity sensor value *************************************************************************/ U16 getFPGAD29Cond( void ) { return fpgaSensorReadings.fpgaD29CondCond; } /*********************************************************************//** * @brief * The getFPGAD29CondTemp function gets D29 conductivity sensor temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD29CondTemp * @details \b Outputs: none * @return Latest D29 conductivity sensor temperature value *************************************************************************/ U16 getFPGAD29CondTemp( void ) { return fpgaSensorReadings.fpgaD29CondTemp; } /*********************************************************************//** * @brief * The getFPGAD29CondData function gets D29 conductivity sensor register value. * @details \b Inputs: fpgaSensorReadings.fpgaD29CondDataOut * @details \b Outputs: none * @return Latest D29 conductivity sensor register data value *************************************************************************/ U32 getFPGAD29CondData( void ) { return fpgaSensorReadings.fpgaD29CondDataOut; } /*********************************************************************//** * @brief * The getFPGAD43CondReadCount function gets D43 conductivity sensor read count. * @details \b Inputs: fpgaSensorReadings.fpgaD43CondReadCnt * @details \b Outputs: none * @return Latest D43 conductivity sensor read count *************************************************************************/ U08 getFPGAD43CondReadCount( void ) { return fpgaSensorReadings.fpgaD43CondReadCnt; } /*********************************************************************//** * @brief * The getFPGAD43CondErrorCount function gets D43 conductivity sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaD43CondErrorCnt * @details \b Outputs: none * @return Latest D43 conductivity sensor read error count *************************************************************************/ U08 getFPGAD43CondErrorCount( void ) { return fpgaSensorReadings.fpgaD43CondErrorCnt; } /*********************************************************************//** * @brief * The getFPGAD43Cond function gets D43 conductivity sensor value. * @details \b Inputs: fpgaSensorReadings.fpgaD43Cond * @details \b Outputs: none * @return Latest D43 conductivity sensor value *************************************************************************/ U16 getFPGAD43Cond( void ) { return fpgaSensorReadings.fpgaD43CondCond; } /*********************************************************************//** * @brief * The getFPGAD43CondTemp function gets D43 conductivity sensor temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD43CondTemp * @details \b Outputs: none * @return Latest D43 conductivity sensor temperature value *************************************************************************/ U16 getFPGAD43CondTemp( void ) { return fpgaSensorReadings.fpgaD43CondTemp; } /*********************************************************************//** * @brief * The getFPGAD43CondData function gets D43 conductivity sensor register value. * @details \b Inputs: fpgaSensorReadings.fpgaD43CondDataOut * @details \b Outputs: none * @return Latest D43 conductivity sensor register data value *************************************************************************/ U32 getFPGAD43CondData( void ) { return fpgaSensorReadings.fpgaD43CondDataOut; } /*********************************************************************//** * @brief * The getFPGAD74CondReadCount function gets D74 conductivity sensor read count. * @details \b Inputs: fpgaSensorReadings.fpgaD74CondReadCnt * @details \b Outputs: none * @return Latest D74 conductivity sensor read count *************************************************************************/ U08 getFPGAD74CondReadCount( void ) { return fpgaSensorReadings.fpgaD74CondReadCnt; } /*********************************************************************//** * @brief * The getFPGAD74CondErrorCount function gets D74 conductivity sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaD74CondErrorCnt * @details \b Outputs: none * @return Latest D74 conductivity sensor read error count *************************************************************************/ U08 getFPGAD74CondErrorCount( void ) { return fpgaSensorReadings.fpgaD74CondErrorCnt; } /*********************************************************************//** * @brief * The getFPGAD74Cond function gets D74 conductivity sensor value. * @details \b Inputs: fpgaSensorReadings.fpgaD74Cond * @details \b Outputs: none * @return Latest D74 conductivity sensor value *************************************************************************/ U16 getFPGAD74Cond( void ) { return fpgaSensorReadings.fpgaD74CondCond; } /*********************************************************************//** * @brief * The getFPGAD74CondTemp function gets D74 conductivity sensor temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD74CondTemp * @details \b Outputs: none * @return Latest D74 conductivity sensor temperature value *************************************************************************/ U16 getFPGAD74CondTemp( void ) { return fpgaSensorReadings.fpgaD74CondTemp; } /*********************************************************************//** * @brief * The getFPGAD74CondData function gets D74 conductivity sensor register value. * @details \b Inputs: fpgaSensorReadings.fpgaD74CondDataOut * @details \b Outputs: none * @return Latest D74 conductivity sensor register data value *************************************************************************/ U32 getFPGAD74CondData( void ) { return fpgaSensorReadings.fpgaD74CondDataOut; } /*********************************************************************//** * @brief * The getFPGAD63LevelSensor function gets the latest FPGA D63 level sensor * reading. * @details \b Inputs: fpgaSensorReadings.fpgaD63LevelSensor * @details \b Outputs: none * @return last FPGA D63 level sensor reading *************************************************************************/ U16 getFPGAD63LevelSensor( void ) { return fpgaSensorReadings.fpgaD63LevelSensor; } /*********************************************************************//** * @brief * The getFPGAD46LevelSensor function gets the latest FPGA level sensor 2 * reading. * @details \b Inputs: fpgaSensorReadings.fpgaD46LevelSensor * @details \b Outputs: none * @return last FPGA level sensor2 reading *************************************************************************/ U16 getFPGAD46LevelSensor( void ) { return fpgaSensorReadings.fpgaD46LevelSensor; } /*********************************************************************//** * @brief * The getFPGAD6LevelStatus function gets the latest FPGA floater D6 level * reading. * @details \b Inputs: fpgaSensorReadings.fpgaD6FloaterStatus * @details \b Outputs: none * @return last FPGA floater D6 level reading *************************************************************************/ U08 getFPGAD6LevelStatus( void ) { return ( fpgaSensorReadings.fpgaD6FloaterStatus & FPGA_D6_FLOATER_LEVEL_BIT ); } /*********************************************************************//** * @brief * The getFPGAFloater2Status function gets the latest FPGA floater 2 level * reading. * @details \b Inputs: fpgaSensorReadings.fpgaFloater2Status * @details \b Outputs: none * @return last FPGA floater 2 level reading *************************************************************************/ U08 getFPGAFloater2Status( void ) { return fpgaSensorReadings.fpgaFloater2Status; } /*********************************************************************//** * @brief * The getFPGATimerCount function gets the latest FPGA timer millisecond count. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return last FPGA timer count *************************************************************************/ static U16 getFPGATimerCount( void ) { return fpgaSensorReadings.fpgaTimerCountMS; } /*********************************************************************//** * @brief * The getFPGAD1Temp function gets the inlet heat exchanger * temperature. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return inlet heat exchanger temperature *************************************************************************/ U32 getFPGAD1Temp( void ) { return fpgaSensorReadings.fpgaD1Temp; } /*********************************************************************//** * @brief * The getFPGAD78Temp function gets the outlet heat exchanger * temperature. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return outlet heat exchanger temperature *************************************************************************/ U32 getFPGAD78Temp( void ) { return fpgaSensorReadings.fpgaD78Temp; } /*********************************************************************//** * @brief * The getFPGAD4Temp function gets the hydraulics primary * heater temperature. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return hydraulics primary heater temperature *************************************************************************/ U32 getFPGAD4Temp( void ) { return fpgaSensorReadings.fpgaD4Temp; } /*********************************************************************//** * @brief * The getFPGAD50Temp function gets the trimmer heater temperature. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return trimmer heater temperature *************************************************************************/ U32 getFPGAD50Temp( void ) { return fpgaSensorReadings.fpgaD50Temp; } /*********************************************************************//** * @brief * The getFPGARTDReadCount function gets the RTD sensors group read count. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return RTD read count *************************************************************************/ U08 getFPGARTDReadCount( void ) { return fpgaSensorReadings.fpgaRTDReadCnt; } /*********************************************************************//** * @brief * The getFPGARTDCountErrorCycles function gets the FPGA incomplete sequences * of reads from RTD ADC. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return count of in-complete sequences of reads from RTD ADC. *************************************************************************/ U08 getFPGARTDCountErrorCycles( void ) { return fpgaSensorReadings.fpgaRTDCountErrorCycles; } /*********************************************************************//** * @brief * The checkFPGACommFailure function increments the FPGA comm failure * windowed timer and returns whether or not the number of failures in * the window have been reached. * @details \b Inputs: none * @details \b Outputs: none * @return TRUE if windowed count exceeded, else false. *************************************************************************/ void checkFPGACommFailure( void ) { if ( getMSTimerCount() > MIN_POWER_ON_TIME_FOR_COMM_FAILS ) { if ( TRUE == incTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_COMM_FAILURES ) ) { //TODO : Enable alarm later //SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_FPGA_COMM_TIMEOUT, MAX_FPGA_COMM_FAILURES, (U32)fpgaSensorReadings.fpgaIOErrorCntProcessor ) } } } /*********************************************************************//** * @brief * The getFPGAD11PumpRevolutionCountStatus function gets the current revolution of * acid concentrate pump (down counter). * @details \b Inputs: fpgaD11PumpStepCountStatus * @details \b Outputs: none * @return the current revolution of the acid concentrate pump *************************************************************************/ U16 getFPGAD11PumpRevolutionCountStatus( void ) { return fpgaSensorReadings.fpgaD11PumpStepCountStatus; } /*********************************************************************//** * @brief * The getFPGAD10PumpRevolutionCountStatus function gets the current revolution of * bicarb concentrate pump (down counter). * @details \b Inputs: fpgaD10PumpStepCountStatus * @details \b Outputs: none * @return the current revolution of the bicarb concentrate pump *************************************************************************/ U16 getFPGAD10PumpRevolutionCountStatus( void ) { return fpgaSensorReadings.fpgaD10PumpStepCountStatus; } /*********************************************************************//** * @brief * The getFPGAD76PumpRevolutionCountStatus function gets the current revolution of * UF pump (down counter) status. * @details \b Inputs: fpgaD76PumpStepCountStatus * @details \b Outputs: none * @return the current revolution of the UF pump *************************************************************************/ U16 getFPGAD76PumpRevolutionCountStatus( void ) { return fpgaSensorReadings.fpgaD76PumpStepCountStatus; } /*********************************************************************//** * @brief * The checkFPGAAFEOEFailure function increments the FPGA comm failure * windowed timer if an FE or OE error has occurred and returns whether * or not the number of failures in * the window have been reached. * @details \b Inputs: none * @details \b Outputs: none * @details \b Alarm: ALARM_ID_DD_FPGA_COMM_TIMEOUT when FPGA communication is * lost with the processor. * @return TRUE if windowed count exceeded, else false. *************************************************************************/ BOOL checkFPGAFEOEFailure( void ) { BOOL status = FALSE; BOOL FPGAFEOEError = getSci2FEOEError(); if ( TRUE == FPGAFEOEError) { if ( getMSTimerCount() > MIN_POWER_ON_TIME_FOR_COMM_FAILS ) { if ( TRUE == incTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_COMM_FAILURES ) ) { //TODO : Enable alarm later //SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_FPGA_COMM_TIMEOUT, MAX_FPGA_COMM_FAILURES, (U32)fpgaSensorReadings.fpgaIOErrorCntProcessor ) status = TRUE; } } } return status; } // Blood leak functions /*********************************************************************//** * @brief * The getFPGABloodLeakStatus function returns the blood leak sensor's * blood detection status bit. * @details \b Inputs: fpgaSensorReadings * @details \b 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 \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints * @return none *************************************************************************/ void setFPGABloodLeakUARTControl( U08 value ) { fpgaActuatorSetPoints.fpgaD42UARTControl = value; } /*********************************************************************//** * @brief * The setFPGABloodLeakUARTTransmit function sets the blood leak sensor UART * transmit value. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints * @return none *************************************************************************/ void setFPGABloodLeakUARTTransmit( U08 value ) { fpgaActuatorSetPoints.fpgaD42FIFOTx = value; } /*********************************************************************//** * @brief * The getFPGABloodLeakTxFIFOCount function returns the blood leak transmit * FIFO count. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return fpgaSensorReadings.fpgaD42TxFIFOCnt *************************************************************************/ U08 getFPGABloodLeakTxFIFOCount( void ) { return fpgaSensorReadings.fpgaD42TxFIFOCnt; } /*********************************************************************//** * @brief * The getFPGABloodLeakRxFIFOCount function returns the blood leak receive * FIFO count. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return fpgaSensorReadings.fpgaD42RxFIFOCnt *************************************************************************/ U16 getFPGABloodLeakRxFIFOCount( void ) { return fpgaSensorReadings.fpgaD42RxFIFOCnt; } /*********************************************************************//** * @brief * The getFPGABloodLeakRxErrorCount function returns the blood leak receive * error count. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return fpgaSensorReadings.fpgaD42RxErrorCnt *************************************************************************/ U08 getFPGABloodLeakRxErrorCount( void ) { return fpgaSensorReadings.fpgaD42RxErrorCnt; } /*********************************************************************//** * @brief * The getFPGABloodLeakRxFIFODataOut function returns the blood leak receive * FIFO data out. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return fpgaSensorReadings.fpgaD42RxFIFODataOut *************************************************************************/ U08 getFPGABloodLeakRxFIFODataOut( void ) { return fpgaSensorReadings.fpgaD42RxFIFODataOut; } /*********************************************************************//** * @brief * The setFPGAIOFPValveStates function sets the RO 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: * 0 - M4.\n * 1 - P11.\n * 2 - P33.\n * 3 - P34.\n * 4 - P37.\n * 5 - P39.\n * 6 - P43.\n * 7 - P6.\n * 15:8 - Not used. \n * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.valveControl * @param valveStates bit mask for requested valve states * @return none *************************************************************************/ void setFPGAIOFPValveStates( U16 valveStates ) { fpgaActuatorSetPoints.valveControl = valveStates; } /*********************************************************************//** * @brief * The getFPGAValveStates function gets the RO valve commanded states with * an 8-bit mask representing the set of states with a 1 meaning "energized" * and a 0 meaning "de-energized". * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.valveControlReadback * @return none *************************************************************************/ U16 getFPGAIOFPValveStates( void ) { return fpgaSensorReadings.valveControlReadback; } /*********************************************************************//** * @brief * The setFPGAP12PumpEnable function enables or disables the P12 pump. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.p12PumpControl * @param enable flag indicating whether to enable or disable the P12 pump. * @return none *************************************************************************/ void setFPGAP12PumpEnable( BOOL enable ) { fpgaActuatorSetPoints.p12PumpControl = ( TRUE == enable ? 0x1 : 0x0 ); } /*********************************************************************//** * @brief * The setFPGAP12PumpPWM function sets the P12 pump PWM duty cycle. * The higher the PWM duty cycle (0..500), the faster the pump will go. * @note PWM values < 5% or > 95% will cause pump to stop so effective * range is actually 25..475. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.p12PumpPWMDutyCyclePct * @param pwm PWM duty cycle magnitude * @return none *************************************************************************/ void setFPGAP12PumpPWM( U16 pwm ) { fpgaActuatorSetPoints.p12PumpPWMDutyCyclePct = pwm; } /*********************************************************************//** * @brief * The getFPGAP12PumpPWM function gets a read back from FPGA of RO pump PWM * duty cycle. * @details \b Inputs: fpgaSensorReadings.roPumpPWMReadback * @details \b Outputs: none * @return measured speed (RPM) of the RO pump *************************************************************************/ U16 getFPGAP12PumpPWM( void ) { return fpgaSensorReadings.p12PumpPWMReadback; } /*********************************************************************//** * @brief * The getFPGAP12PumpTachCount function gets the running 16-bit tachometer count * from the P12 pump hall sensor. * @details \b Inputs: fpgaSensorReadings.p12PumpTachCount * @details \b Outputs: none * @return P12 pump tachometer count *************************************************************************/ U16 getFPGAP12PumpTachCount( void ) { return fpgaSensorReadings.p12PumpTachCount; } /*********************************************************************//** * @brief * The setFPGAP24Enabled function sets the heater enable on or off. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.p24Control * @param enable Flag indicating whether to enable or disable the P24 heater. * @return none *************************************************************************/ void setFPGAP24Enabled( BOOL enable ) { return; } /*********************************************************************//** * @brief * The setFPGAP24PWM function sets the P24 heater PWM duty cycle. * The higher the PWM duty cycle (0..500), the faster the pump will go. * @note PWM values < 5% or > 95% will cause heater to go off so effective * range is actually 25..475. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.p24PWMDutyCyclePct * @param pwm PWM duty cycle magnitude * @return none *************************************************************************/ void setFPGAP24PWM( U16 pwm ) { return; } /*********************************************************************//** * @brief * The getFPGAM1RawPressure function gets the M1 pressure reading. * @details \b Inputs: fpgaSensorReadings.pressureM1 * @details \b Outputs: none * @return M1 pressure *************************************************************************/ S16 getFPGAM1RawPressure( void ) { return fpgaSensorReadings.pressureM1; } /*********************************************************************//** * @brief * The getFPGAM1RawTemperature function gets the M1 sensor temperature reading. * @details \b Inputs: fpgaSensorReadings.temperatureM1 * @details \b Outputs: none * @return M1 sensor temperature *************************************************************************/ S16 getFPGAM1RawTemperature( void ) { return fpgaSensorReadings.temperatureM1; } /*********************************************************************//** * @brief * The getFPGAM3RawPressure function gets the M3 pressure reading. * @details \b Inputs: fpgaSensorReadings.pressureM3 * @details \b Outputs: none * @return M3 pressure *************************************************************************/ S16 getFPGAM3RawPressure( void ) { return fpgaSensorReadings.pressureM3; } /*********************************************************************//** * @brief * The getFPGAM3RawTemperature function gets the M3 sensor temperature. * @details \b Inputs: fpgaSensorReadings.temperatureM3 * @details \b Outputs: none * @return M3 sensor temperature *************************************************************************/ S16 getFPGAM3RawTemperature( void ) { return fpgaSensorReadings.temperatureM3; } /*********************************************************************//** * @brief * The getFPGAP8RawPressure function gets the P8 pressure reading. * @details \b Inputs: fpgaSensorReadings.pressureP8 * @details \b Outputs: none * @return P8 pressure *************************************************************************/ S16 getFPGAP8RawPressure( void ) { return fpgaSensorReadings.pressureP8; } /*********************************************************************//** * @brief * The getFPGAP8RawTemperature function gets the P8 sensor temperature. * @details \b Inputs: fpgaSensorReadings.temperatureP8 * @details \b Outputs: none * @return P8 sensor temperature *************************************************************************/ S16 getFPGAP8RawTemperature( void ) { return fpgaSensorReadings.temperatureP8; } /*********************************************************************//** * @brief * The getFPGAP13RawPressure function gets the P13 pressure reading. * @details \b Inputs: fpgaSensorReadings.pressureP13 * @details \b Outputs: none * @return P13 pressure *************************************************************************/ S16 getFPGAP13RawPressure( void ) { return fpgaSensorReadings.pressureP13; } /*********************************************************************//** * @brief * The getFPGAP13RawTemperature function gets the P13 sensor temperature. * @details \b Inputs: fpgaSensorReadings.temperatureP13 * @details \b Outputs: none * @return P13 sensor temperature *************************************************************************/ S16 getFPGAP13RawTemperature( void ) { return fpgaSensorReadings.temperatureP13; } /*********************************************************************//** * @brief * The getFPGAP17RawPressure function gets the P17 pressure reading. * @details \b Inputs: fpgaSensorReadings.pressureP17 * @details \b Outputs: none * @return P17 pressure *************************************************************************/ S16 getFPGAP17RawPressure( void ) { return fpgaSensorReadings.pressureP17; } /*********************************************************************//** * @brief * The getFPGAP17RawTemperature function gets the P17 sensor temperature. * @details \b Inputs: fpgaSensorReadings.temperatureP17 * @details \b Outputs: none * @return P17 sensor temperature *************************************************************************/ S16 getFPGAP17RawTemperature( void ) { return fpgaSensorReadings.temperatureP17; } /*********************************************************************//** * @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 * @return P25 floater level state *************************************************************************/ U08 getFPGAP25FloaterState( void ) { return fpgaSensorReadings.p25LevelSwitch; } /*********************************************************************//** * @brief * The getFPGAFlowFMP function gets the P16 flow rate (in mL/min). * @details \b Inputs: fpgaSensorReadings.flowRateP16 * @details \b Outputs: none * @return P16 flow rate (in mL/min) *************************************************************************/ U16 getFPGAFlowP16( void ) { return fpgaSensorReadings.flowRateP16; } /*********************************************************************//** * @brief * The getFPGAFlowP16Temp function gets the P16 flow sensor temperature, the * temperature of the fluid flowing through the sensor. * @details \b Inputs: fpgaSensorReadings.flowTempP16 * @details \b Outputs: none * @return P16 fluid temperature *************************************************************************/ U16 getFPGAFlowP16Temp( void ) { return fpgaSensorReadings.flowTempP16; } /*********************************************************************//** * @brief * The getFPGAFlowP7 function gets the P7 flow rate (in mL/min). * @details \b Inputs: fpgaSensorReadings.flowRateP7 * @details \b Outputs: none * @return P7 flow rate (in mL/min) *************************************************************************/ U16 getFPGAFlowP7( void ) { return fpgaSensorReadings.flowRateP7; } /*********************************************************************//** * @brief * The getFPGAFlowP7Temp function gets the P7 flow sensor temperature, the * temperature of the fluid flowing through the sensor. * @details \b Inputs: fpgaSensorReadings.flowTempP7 * @details \b Outputs: none * @return P7 fluid temperature *************************************************************************/ U16 getFPGAFlowP7Temp( void ) { return fpgaSensorReadings.flowTempP7; } /*********************************************************************//** * @brief * The setFPGAP9Control function sets the FPGA P9 sensor control register * to perform a given action. * bit 4..7: unused * bit 3: Enable P9 read transaction; address needed * bit 2: Enable P9 write transaction; address and data needs to be set * bit 1: Enable P9 initialization procedure * bit 0: reset P9 sensor * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control * @param control bits indicating control action to take * @return none *************************************************************************/ void setFPGAP9Control( U08 control ) { fpgaActuatorSetPoints.conductivityP9Control = control; } /*********************************************************************//** * @brief * The setFPGAP9Address function sets the read/write address for a read/write * action on the P9 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Address * @param address The P9 sensor address to read from or write to * @return none *************************************************************************/ void setFPGAP9Address( U16 address ) { fpgaActuatorSetPoints.conductivityP9Address = address; } /*********************************************************************//** * @brief * The setFPGAP9Data function sets the write data for a write action on * the P9 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Data * @param data The 32-bit data to write to the P9 sensor * @return none *************************************************************************/ void setFPGAP9Data( U32 data ) { fpgaActuatorSetPoints.conductivityP9Data = data; } /*********************************************************************//** * @brief * The setFPGAP18Control function sets the FPGA P18 sensor control register * to perform a given action. * bit 4..7: unused * bit 3: Enable P18 read transaction; address needed * bit 2: Enable P18 write transaction; address and data needs to be set * bit 1: Enable P18 initialization procedure * bit 0: reset P18 sensor * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control * @param control bits indicating control action to take * @return none *************************************************************************/ void setFPGAP18Control( U08 control ) { fpgaActuatorSetPoints.conductivityP18Control = control; } /*********************************************************************//** * @brief * The setFPGAP18Address function sets the read/write address for a read/write * action on the P18 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Address * @param address The P18 sensor address to read from or write to * @return none *************************************************************************/ void setFPGAP18Address( U16 address ) { fpgaActuatorSetPoints.conductivityP18Address = address; } /*********************************************************************//** * @brief * The setFPGAP18Data function sets the write data for a write action on * the P18 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Data * @param data The 32-bit data to write to the P18 sensor * @return none *************************************************************************/ void setFPGAP18Data( U32 data ) { fpgaActuatorSetPoints.conductivityP18Data = data; } /*********************************************************************//** * @brief * The setFPGAP9Reset function sets the reset command bit for P9 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control * @return none *************************************************************************/ void setFPGAP9Reset( void ) { fpgaActuatorSetPoints.conductivityP9Control |= FPGA_CONDUCTIVITY_RESET_BIT; } /*********************************************************************//** * @brief * The clearFPGAP9Reset function clears the reset command bit for P9 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control * @return none *************************************************************************/ void clearFPGAP9Reset( void ) { fpgaActuatorSetPoints.conductivityP9Control &= ~FPGA_CONDUCTIVITY_RESET_BIT; } /*********************************************************************//** * @brief * The setFPGAP9InitEnable function sets the initialize command bit for * P9 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control * @return none *************************************************************************/ void setFPGAP9InitEnable( void ) { fpgaActuatorSetPoints.conductivityP9Control |= FPGA_CONDUCTIVITY_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAP9InitEnable function clears the initialize command bit for * P9 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control * @return none *************************************************************************/ void clearFPGAP9InitEnable( void ) { fpgaActuatorSetPoints.conductivityP9Control &= ~FPGA_CONDUCTIVITY_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAP9WriteEnable function sets the write enable command bit for * P9 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control * @return none *************************************************************************/ void setFPGAP9WriteEnable( void ) { fpgaActuatorSetPoints.conductivityP9Control |= FPGA_CONDUCTIVITY_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAP9WriteEnable function clears the write enable command bit * for P9 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control * @return none *************************************************************************/ void clearFPGAP9WriteEnable( void ) { fpgaActuatorSetPoints.conductivityP9Control &= ~FPGA_CONDUCTIVITY_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAP9ReadEnable function sets the read enable command bit for * P9 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control * @return none *************************************************************************/ void setFPGAP9ReadEnable( void ) { fpgaActuatorSetPoints.conductivityP9Control |= FPGA_CONDUCTIVITY_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAP9ReadEnable function clears the read enable command bit * for P9 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control * @return none *************************************************************************/ void clearFPGAP9ReadEnable( void ) { fpgaActuatorSetPoints.conductivityP9Control &= ~FPGA_CONDUCTIVITY_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAP18Reset function sets the reset command bit for P18 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control * @return none *************************************************************************/ void setFPGAP18Reset( void ) { fpgaActuatorSetPoints.conductivityP18Control |= FPGA_CONDUCTIVITY_RESET_BIT; } /*********************************************************************//** * @brief * The clearFPGAP18Reset function clears the reset command bit for P18 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control * @return none *************************************************************************/ void clearFPGAP18Reset( void ) { fpgaActuatorSetPoints.conductivityP18Control &= ~FPGA_CONDUCTIVITY_RESET_BIT; } /*********************************************************************//** * @brief * The setFPGAP18InitEnable function sets the initialize command bit for * P18 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control * @return none *************************************************************************/ void setFPGAP18InitEnable( void ) { fpgaActuatorSetPoints.conductivityP18Control |= FPGA_CONDUCTIVITY_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAP18InitEnable function clears the initialize command bit for * P18 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control * @return none *************************************************************************/ void clearFPGAP18InitEnable( void ) { fpgaActuatorSetPoints.conductivityP18Control &= ~FPGA_CONDUCTIVITY_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAP18WriteEnable function sets the write enable command bit for * P18 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control * @return none *************************************************************************/ void setFPGAP18WriteEnable( void ) { fpgaActuatorSetPoints.conductivityP18Control |= FPGA_CONDUCTIVITY_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAP18WriteEnable function clears the write enable command bit * for P18 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control * @return none *************************************************************************/ void clearFPGAP18WriteEnable( void ) { fpgaActuatorSetPoints.conductivityP18Control &= ~FPGA_CONDUCTIVITY_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAP18ReadEnable function sets the read enable command bit for * P18 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control * @return none *************************************************************************/ void setFPGAP18ReadEnable( void ) { fpgaActuatorSetPoints.conductivityP18Control |= FPGA_CONDUCTIVITY_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAP18ReadEnable function clears the read enable command bit * for P18 sensor. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control * @return none *************************************************************************/ void clearFPGAP18ReadEnable( void ) { fpgaActuatorSetPoints.conductivityP18Control &= ~FPGA_CONDUCTIVITY_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The getFPGAP9ReadCount function gets the latest P9 sensor read count. * @details \b Inputs: fpgaSensorReadings.conductivityP9ReadCount * @details \b Outputs: none * @return Current read count for P9 sensor. *************************************************************************/ U08 getFPGAP9ReadCount( void ) { return fpgaSensorReadings.conductivityP9ReadCount; } /*********************************************************************//** * @brief * The getFPGAP9ErrorCount function gets the latest P9 sensor error count. * @details \b Inputs: fpgaSensorReadings.conductivityP9ErrorCount * @details \b Outputs: none * @return Current error count for P9 sensor. *************************************************************************/ U08 getFPGAP9ErrorCount( void ) { return fpgaSensorReadings.conductivityP9ErrorCount; } /*********************************************************************//** * @brief * The getFPGAP9Conductivity function gets the latest P9 sensor conductivity * reading. * @details \b Inputs: fpgaSensorReadings.conductivityP9Cond * @details \b Outputs: none * @return Current conductivity reading from P9 sensor. *************************************************************************/ U16 getFPGAP9Conductivity( void ) { return fpgaSensorReadings.conductivityP9Cond; } /*********************************************************************//** * @brief * The getFPGAP9Temperature function gets the latest P9 sensor temperature. * @details \b Inputs: fpgaSensorReadings.conductivityP9Temp * @details \b Outputs: none * @return Current temperature from P9 sensor. *************************************************************************/ U16 getFPGAP9Temperature( void ) { return fpgaSensorReadings.conductivityP9Temp; } /*********************************************************************//** * @brief * The getFPGAP9Data function gets the latest P9 sensor data from a read * action. * @details \b Inputs: fpgaSensorReadings.conductivityP9Data * @details \b Outputs: none * @return Latest data read from P9 sensor. *************************************************************************/ U32 getFPGAP9Data( void ) { return fpgaSensorReadings.conductivityP9Data; } /*********************************************************************//** * @brief * The getFPGAP18ReadCount function gets the latest P18 sensor read count. * @details \b Inputs: fpgaSensorReadings.conductivityP18ReadCount * @details \b Outputs: none * @return Current read count for P18 sensor. *************************************************************************/ U08 getFPGAP18ReadCount( void ) { return fpgaSensorReadings.conductivityP18ReadCount; } /*********************************************************************//** * @brief * The getFPGAP18ErrorCount function gets the latest P18 sensor error count. * @details \b Inputs: fpgaSensorReadings.conductivityP18ErrorCount * @details \b Outputs: none * @return Current error count for P18 sensor. *************************************************************************/ U08 getFPGAP18ErrorCount( void ) { return fpgaSensorReadings.conductivityP18ErrorCount; } /*********************************************************************//** * @brief * The getFPGAP18Conductivity function gets the latest P18 sensor conductivity * reading. * @details \b Inputs: fpgaSensorReadings.conductivityP18Cond * @details \b Outputs: none * @return Current conductivity reading from P18 sensor. *************************************************************************/ U16 getFPGAP18Conductivity( void ) { return fpgaSensorReadings.conductivityP18Cond; } /*********************************************************************//** * @brief * The getFPGAP18Temperature function gets the latest P18 sensor temperature. * @details \b Inputs: fpgaSensorReadings.conductivityP18Temp * @details \b Outputs: none * @return Current temperature from P18 sensor. *************************************************************************/ U16 getFPGAP18Temperature( void ) { return fpgaSensorReadings.conductivityP18Temp; } /*********************************************************************//** * @brief * The getFPGAP18Data function gets the latest P18 sensor data from a read * action. * @details \b Inputs: fpgaSensorReadings.conductivityP18Data * @details \b Outputs: none * @return Latest data read from P18 sensor. *************************************************************************/ U32 getFPGAP18Data( void ) { return fpgaSensorReadings.conductivityP18Data; } /*********************************************************************//** * @brief * The setFPGAP40PumpEnable function enables or disables the P40 pump. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.p40PumpControl * @param enable flag indicating whether to enable or disable the P40 pump. * @return none *************************************************************************/ void setFPGAP40PumpEnable( BOOL enable ) { fpgaActuatorSetPoints.p40PumpControl = ( TRUE == enable ? 0x1 : 0x0 ); } /*********************************************************************//** * @brief * The setFPGAP40PumpPWM function sets the P40 pump PWM duty cycle. * The higher the PWM duty cycle (0..500), the faster the pump will go. * @note PWM values < 5% or > 95% will cause pump to stop so effective * range is actually 25..475. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.p40PumpPWMDutyCyclePct * @param pwm PWM duty cycle magnitude * @return none *************************************************************************/ void setFPGAP40PumpPWM( U16 pwm ) { fpgaActuatorSetPoints.p40PumpPWMDutyCyclePct = pwm; } /*********************************************************************//** * @brief * The getFPGAP12PumpPWM function gets a read back from FPGA of RO pump PWM * duty cycle. * @details \b Inputs: fpgaSensorReadings.p40PumpPWMReadback * @details \b Outputs: none * @return measured speed (RPM) of the P40 pump *************************************************************************/ U16 getFPGAP40PumpPWM( void ) { return fpgaSensorReadings.p40PumpPWMReadback; } /*********************************************************************//** * @brief * The getFPGAP12PumpTachCount function gets the running 16-bit tachometer count * from the P40 pump hall sensor. * @details \b Inputs: fpgaSensorReadings.p40PumpTachCount * @details \b Outputs: none * @return P40 pump tachometer count *************************************************************************/ U16 getFPGAP40PumpTachCount( void ) { return fpgaSensorReadings.p40PumpTachCount; } /**@}*/