Index: firmware/App/Services/FPGADD.c =================================================================== diff -u -r090cfb22a7c0b4738299c3fb411ca77aaba8d968 -r08bb699be47b9b04c9d4885b7f1b9349b5a4b1e9 --- firmware/App/Services/FPGADD.c (.../FPGADD.c) (revision 090cfb22a7c0b4738299c3fb411ca77aaba8d968) +++ firmware/App/Services/FPGADD.c (.../FPGADD.c) (revision 08bb699be47b9b04c9d4885b7f1b9349b5a4b1e9) @@ -29,7 +29,7 @@ //#include "NVDataMgmt.h" #include "OperationModes.h" #include "PersistentAlarm.h" -//#include "SystemCommMessages.h" +#include "Messaging.h" #include "Timers.h" #include "Utilities.h" @@ -40,18 +40,20 @@ // ********** private definitions ********** -#define FPGA_EXPECTED_ID 0x61 ///< FPGA expected ID. +#define FPGA_EXPECTED_ID 0x02 ///< FPGA expected ID. #define MAX_COMM_ERROR_RETRIES 5 ///< Maximum number of communication error retries #define DRAIN_PUMP_DAC_SHIFT_BITS 4 ///< Drain pump DAC shift bits. #define FPGA_FLUIDLEAK_STATE_MASK 0x0004 ///< Bit mask for fluid leak detector. +//ToDo : Define the default values for the Valves on power up. #define FPGA_ENABLE_VALVES_CONTROL 0x015F ///< FPGA enable valves control. #define FPGA_VBF_PWM_PULL_IN_MS ( 3 * MS_PER_SECOND ) ///< FPGA VBf PWM pull in in milliseconds. #define FPGA_VBF_PWM_LOW 9999 ///< FPGA VBf PWM low. #define FPGA_VBF_PWM_PERIOD 16666 ///< FPGA VBf PWM period. -#define FPGA_ENABLE_VALVES_PWM 0x0020 ///< FPGA enable valves PWM. +// Assuming all valves are ON/OFF based control ( No PWM control used) +#define FPGA_ENABLE_VALVES_PWM 0x0000 ///< FPGA enable valves PWM. #define CONCENTRATE_CAP_SWITCH_MASK 0x10 ///< Concentrate cap switch bit mask. #define FPGA_CONC_PUMP_FAULT_BITS 0x03 ///< Concentrate pump fault bits mask. #define FPGA_CP1_PARKED_BIT 0x04 ///< Concentrate pump 1 parked status bit mask. @@ -88,17 +90,77 @@ /// FPGA sensors' readings struct. typedef struct { - U32 fpgaLCA1; ///< Reg 256. ADC1 channel 0 - load cell A1 - U32 fpgaLCB1; ///< Reg 260. ADC1 channel 1 - load cell B1 - U32 fpgaADC1Temp; ///< Reg 264. ADC1 channel 2 - internal temperature + U16 fpgaRemoteUpdateRead; ///< Reg 260. FPGA Remote Update Read ( copy contents from remote update write) - U32 fpgaLCA2; ///< Reg 268. ADC2 channel 0 - load cell A2 - U32 fpgaLCB2; ///< Reg 272. ADC2 channel 1 - load cell B2 - U32 fpgaADC2Temp; ///< Reg 276. ADC2 channel 2 - internal temperature + U08 fpgaIOErrorCntProcessor; ///< Reg 262. Number of errors in Microprocessor UART interface + U08 fpgaIOErrorCntPC; ///< Reg 263. Number of errors in PC UART interface - U32 fpgaCD1Temp; ///< Reg 280. ADC RTD channel 0 - conductivity sensor 1 temperature - U32 fpgaCD2Temp; ///< Reg 284. ADC RTD channel 1 - conductivity sensor 2 temperature + U32 fpgaPnPressure; ///< Reg 264. Pn/PHo MPM pressure sensor RAW pressure data + U32 fpgaPnTemp; ///< Reg 268. Pn/PHo MPM pressure sensor RAW temperature data + U08 fpgaPnReadCnt; ///< Reg 272. Pn/PHo Counter for good I2C transmission b/w FPGA and sensor + U08 fpgaPnErrorCnt; ///< Reg 273. Pn/PHo Counter for bad I2C transmission b/w FPGA and sensor + U32 fpgaPCbPressure; ///< Reg 274. PCb/PDB MPM pressure sensor RAW pressure data + U32 fpgaPCbTemp; ///< Reg 278. PCb/PDB MPM pressure sensor RAW temperature data + U08 fpgaPCbReadCnt; ///< Reg 282. PCb/PDB Counter for good I2C transmission b/w FPGA and sensor + U08 fpgaPCbErrorCnt; ///< Reg 283. PCb/PDB Counter for bad I2C transmission b/w FPGA and sensor + + U32 fpgaPDsPressure; ///< Reg 284. PDs MPM pressure sensor RAW pressure data + U32 fpgaPDsTemp; ///< Reg 288. PDs MPM pressure sensor RAW temperature data + U08 fpgaPDsReadCnt; ///< Reg 292. PDs Counter for good I2C transmission b/w FPGA and sensor + U08 fpgaPDsErrorCnt; ///< Reg 293. PDs Counter for bad I2C transmission b/w FPGA and sensor + + U32 fpgaPDfPressure; ///< Reg 294. PDf MPM pressure sensor RAW pressure data + U32 fpgaPDfTemp; ///< Reg 298. PDf MPM pressure sensor RAW temperature data + U08 fpgaPDfReadCnt; ///< Reg 302. PDf Counter for good I2C transmission b/w FPGA and sensor + U08 fpgaPDfErrorCnt; ///< Reg 303. PDf Counter for bad I2C transmission b/w FPGA and sensor + + U32 fpgaPtmPressure; ///< Reg 304. Ptm MPM pressure sensor RAW pressure data + U32 fpgaPtmTemp; ///< Reg 308. Ptm MPM pressure sensor RAW temperature data + U08 fpgaPtmReadCnt; ///< Reg 312. Ptm Counter for good I2C transmission b/w FPGA and sensor + U08 fpgaPtmErrorCnt; ///< Reg 313. Ptm Counter for bad I2C transmission b/w FPGA and sensor + + U16 fpgaCD1DataOut; ///< Reg 314. Data read from Conductivity Sensor 1 register + U16 fpgaCD1Cond; ///< Reg 316. CD1 conductivity + U16 fpgaCD1Temp; ///< Reg 318. CD1 Temperature + U08 fpgaCD1ReadCnt; ///< Reg 320. CD1 successful read count + U08 fpgaCD1ErrorCnt; ///< Reg 321. CD1 error read count + + U16 fpgaCD2DataOut; ///< Reg 322. Data read from Conductivity Sensor 2 register + U16 fpgaCD2Cond; ///< Reg 324. CD2 conductivity + U16 fpgaCD2Temp; ///< Reg 326. CD2 Temperature + U08 fpgaCD2ReadCnt; ///< Reg 328. CD2 successful read count + U08 fpgaCD2ErrorCnt; ///< Reg 329. CD2 error read count + + U16 fpgaCD3DataOut; ///< Reg 330. Data read from Conductivity Sensor 3 register + U16 fpgaCD3Cond; ///< Reg 332. CD3 conductivity + U16 fpgaCD3Temp; ///< Reg 334. CD3 Temperature + U08 fpgaCD3ReadCnt; ///< Reg 336. CD3 successful read count + U08 fpgaCD3ErrorCnt; ///< Reg 337. CD3 error read count + + U16 fpgaCD4DataOut; ///< Reg 338. Data read from Conductivity Sensor 4 register + U16 fpgaCD4Cond; ///< Reg 340. CD4 conductivity + U16 fpgaCD4Temp; ///< Reg 342. CD4 Temperature + U08 fpgaCD4ReadCnt; ///< Reg 344. CD4 successful read count + U08 fpgaCD4ErrorCnt; ///< Reg 345. CD4 error read count + + U16 fpgaLevelSensor1; ///< Reg 346. Level Sensor 1 + U16 fpgaLevelSensor2; ///< Reg 348. Level Sensor 2 + + U08 fpgaHallSensInputs; ///< Reg 350. Hall sensor Inputs + + U08 fpgaBldTxFIFOCnt; ///< Reg 351. Blood leak sensor transmit FIFO count + U16 fpgaBldRxErrorCnt; ///< Reg 352. Blood leak sensor Receive error count + U16 fpgaBldRxFIFOCnt; ///< Reg 354. Blood leak sensor Receive FIFO count + U08 fpgaBldRxFIFODataOut; ///< Reg 356. Blood leak sensor Receive data + U08 fpgaBldPulseStatus; ///< Reg 357. Blood leak sensor status + + // ToDo : following register listed missing in HDD, may need to add/revise. + U16 fpgaCompatibilityRev; ///< Reg 418. Compatibility revision + U16 fpgaValveStates; ///< Reg 376. Valves states + U16 fpgaTimerCountMS; ///< Reg 404. Internal FPGA timer count in milliseconds + +#if 0 U32 fpgaTPoTemp; ///< Reg 288. ADC RTD channel 2 - conductivity sensor CPo temperature U32 fpgaTPiTemp; ///< Reg 292. ADC RTD channel 3 - conductivity sensor CPi temperature U32 fpgaRTDTemp; ///< Reg 296. ADC RTD channel 4 - internal temperature @@ -218,86 +280,91 @@ U16 fpgaPowerSupply2; ///< Reg 482. Power supply 2 count U16 fpgaOnBoardThermistor; ///< Reg 484. Onboard thermistor U08 fpgaDrainPumpDirection; ///< Reg 486. Drain pump direction -} DG_FPGA_SENSORS_T; +#endif +} DD_FPGA_SENSORS_T; typedef struct { - U08 fpgaCPoControlReg; ///< Reg 12. CPo control register - U08 fpgaCPiControlReg; ///< Reg 13. CPi control register - U16 fpgaCPoProbeType; ///< Reg 14. CPo probe type - U16 fpgaCPiProbeType; ///< Reg 16. CPi probe type - U16 fpgaDrainPumpSetSpeed; ///< Reg 18. Drain pump control register - U16 fpgaValveStates; ///< Reg 20. Valve control register - U08 fpgaAcclCmd; ///< Reg 22. Accelerometer interface command register - U08 fpgaCP1Control; ///< Reg 23. Concentrate pump CP1 control register - U16 fpgaCP1StepSpeed; ///< Reg 24. Concentrate pump CP1 step speed register - U16 fpgaCP2StepSpeed; ///< Reg 26. Concentrate pump CP2 step speed register - U08 fpgaCP2Control; ///< Reg 28. Concentrate pump CP2 control register - U08 fpgaEmstatControl; ///< Reg 29. Emstat conductivity sensor control register - U16 fpgaVRfPWMLow; ///< Reg 30. VRf PWM low - U16 fpgaVRfPWMPeriod; ///< Reg 32. VRf PWM period - U16 fpgaVRiPWMLow; ///< Reg 34. VRi PWM low - U16 fpgaVRiPWMPeriod; ///< Reg 36. VRi PWM period - U16 fpgaVRdPWMLow; ///< Reg 38. VRd PWM low - U16 fpgaVRdPWMPeriod; ///< Reg 40. VRD PWM period - U16 fpgaVRoPWMLow; ///< Reg 42. VRo PWM low - U16 fpgaVRoPWMPeriod; ///< Reg 44. VRo PWM period - U16 fpgaVPoPWMLow; ///< Reg 46. VPo PWM low - U16 fpgaVPoPWMPeriod; ///< Reg 48. VPo PWM period - U16 fpgaVBfPWMLow; ///< Reg 50. VBf PWM low - U16 fpgaVBFPWMPeriod; ///< Reg 52. VBf PWM period - U16 fpgaVRcPWMLow; ///< Reg 54. VRc PWM low - U16 fpgaVRcPWMPeriod; ///< Reg 56. VRc PWM period - U16 fpgaVDrPWMLow; ///< Reg 58. VDr PWM Low - U16 fpgaVDrPWMPeriod; ///< Reg 60. VDr PWM period - U16 fpgaVPiPWMLow; ///< Reg 62. VPi PWM low - U16 fpgaVPiPWMPeriod; ///< Reg 64. VPi PWM period - U16 fpgaVSPPWMLow; ///< Reg 66. VSP PWM low - U16 fpgaVSPPWMPeriod; ///< Reg 68. VSP PWM period - U16 fpgaVRd1PWMLow; ///< Reg 70. VRd1 PWM low - U16 fpgaVRd1PWMPeriod; ///< Reg 72. VRd1 PWM period - U16 fpgaVRd2PWMLow; ///< Reg 74. VRd2 PWM low - U16 fpgaVRd2PWMPeriod; ///< Reg 76. VRd2 PWM period - U16 fpgaVPdPWMLow; ///< Reg 78. VPd PWM low - U16 fpgaVPdPWMPeriod; ///< Reg 80. VPd PWM period - U16 fpgaVSOLPWMLow; ///< Reg 82. VSOL PWM low - U16 fpgaVSOLPWMPeriod; ///< Reg 84. VSOL PWM period - U16 fpgaVRfPWMPullin; ///< Reg 86. VRf PWM pull in - U16 fpgaVRiPWMPullin; ///< Reg 88. VRi PWM pull in - U16 fpgaVRdPWMPullin; ///< Reg 90. VRd PWM pull in - U16 fpgaVRoPWMPullin; ///< Reg 92. VRo PWM pull in - U16 fpgaVPoPWMPullin; ///< Reg 94. VPo PWM pull in - U16 fpgaVBfPWMPullin; ///< Reg 96. VBf PWM pull in - U16 fpgaVRcPWMPullin; ///< Reg 98. VRc PWM pull in - U16 fpgaVDrPWMPullin; ///< Reg 100. VDr PWM pull in - U16 fpgaVPiPWMPullin; ///< Reg 102. VPi PWM pull in - U16 fpgaVSPPWMPullin; ///< Reg 104. VSP PWM pull in - U16 fpgaVRd1PWMPullin; ///< Reg 106. VRd1 PWM pull in - U16 fpgaVRd2PWMPullin; ///< Reg 108. VRd2 PWM pull in - U16 fpgaVPdPWMPullin; ///< Reg 110. VPd PWM pull in - U16 fpgaVSPR2PWMPullin; ///< Reg 112. VSPR2 PWM pull in - U16 fpgaValvePWMEnable; ///< Reg 114. valve PWM enable + U16 fpgaValveControl; ///< Reg 04. Valve control register + U16 fpgaValvePWMEnable; ///< Reg 06. Valve PWM enable - // DVT Registers - U08 fpgaTHdControlReg; ///< Reg 116. THd control register - U08 fpgaCPiCPoEmstatControl; ///< Reg 117. CPi/CPo Emstat control - U16 fpgaDACRegBIn; ///< Reg 118. Debug DAC channel B output - U16 fpgaDACRegCIn; ///< Reg 120. Debug DAC channel C output - U16 fpgaDACRegDIn; ///< Reg 122. Debug DAC channel D output - U16 fpgaDACRegEIn; ///< Reg 124. Debug DAC channel E output - U16 fpgaDACRegFIn; ///< Reg 126. Debug DAC channel F output - U16 fpgaDACRegGIn; ///< Reg 128. Debug DAC channel G output - U16 fpgaDACRegHIn; ///< Reg 130. Debug DAC channel H output - U08 fpgaNewCP2Control; ///< Reg 132. Concentrate pump 2 control - U08 fpgaNewCP1Control; ///< Reg 133. Concentrate pump 1 control + U16 fpgaVDrPWMLow; ///< Reg 08. VDr PWM low. VDo-> VDr. + U16 fpgaVDrPWMPeriod; ///< Reg 10. VDr PWM period + U16 fpgaVDrPWMPullin; ///< Reg 12. VDr PWM pull in + U16 fpgaVTDWMLow; ///< Reg 14. VTD PWM low + U16 fpgaVTDPWMPeriod; ///< Reg 16. VTD PWM period + U16 fpgaVTDPWMPullin; ///< Reg 18. VTD PWM pull in + U16 fpgaVHBPWMLow; ///< Reg 20. VHB PWM low + U16 fpgaVHBPWMPeriod; ///< Reg 22. VHB PWM period + U16 fpgaVHBPWMPullin; ///< Reg 24. VHB PWM pull in + U16 fpgaVrpPWMLow; ///< Reg 26. Vrp PWM low + U16 fpgaVrpPWMPeriod; ///< Reg 28. Vrp PWM period + U16 fpgaVrpPWMPullin; ///< Reg 30. Vrp PWM pull in + + U16 fpgaVHoPWMLow; ///< Reg 32. VHo PWM low + U16 fpgaVHoPWMPeriod; ///< Reg 34. VHo PWM period + U16 fpgaVHoPWMPullin; ///< Reg 36. VHo PWM pull in + U16 fpgaVDB1PWMLow; ///< Reg 38. VDB1 PWM low + U16 fpgaVDB1PWMPeriod; ///< Reg 40. VDB1 PWM period + U16 fpgaVDB1PWMPullin; ///< Reg 42. VDB1 PWM pull in + U16 fpgaVP1PWMLow; ///< Reg 44. VP1 PWM low + U16 fpgaVP1PWMPeriod; ///< Reg 46. VP1 PWM period + U16 fpgaVP1PWMPullin; ///< Reg 48. VP1 PWM pull in + U16 fpgaVPTPWMLow; ///< Reg 50. VPT PWM Low + U16 fpgaVPTPWMPeriod; ///< Reg 52. VPT PWM period + U16 fpgaVPTPWMPullin; ///< Reg 54. VPT PWM pull in + + U16 fpgaVDB2PWMLow; ///< Reg 56. VDB2 PWM low + U16 fpgaVDB2PWMPeriod; ///< Reg 58. VDB2 PWM period + U16 fpgaVDB2PWMPullin; ///< Reg 60. VDB2 PWM pull in + U16 fpgaVDiPWMLow; ///< Reg 62. VDi PWM low + U16 fpgaVDiPWMPeriod; ///< Reg 64. VDi PWM period + U16 fpgaVDiPWMPullin; ///< Reg 66. VDi PWM pull in + U16 fpgaVDoPWMLow; ///< Reg 68. VDo PWM low + U16 fpgaVDoPWMPeriod; ///< Reg 70. VDo PWM period + U16 fpgaVDoPWMPullin; ///< Reg 72. VDo PWM pull in + U16 fpgaVP2PWMLow; ///< Reg 74. VP2 PWM low + U16 fpgaVP2PWMPeriod; ///< Reg 76. VP2 PWM period + U16 fpgaVP2PWMPullin; ///< Reg 78. VP2 PWM pull in + U16 fpgaVHiPWMLow; ///< Reg 80. VHi PWM low + U16 fpgaVHiPWMPeriod; ///< Reg 82. VHi PWM period + U16 fpgaVHiPWMPullin; ///< Reg 84. VHi PWM pull in + + U08 fpgaBCValveControl; ///< Reg 86. Balancing Chamber Valves Control Registers + U08 fpgaBCValvePWMControl; ///< Reg 87. Balancing Chamber Valves PWM control + U08 fpgaUFValveControl; ///< Reg 88. Ultra filtration Valves Control Registers + U08 fpgaUFValvePWMControl; ///< Reg 89. Ultra filtration Valves PWM control + + U08 fpgaConSensTD12Control; ///< Reg 90. Conductivity/Temperature Sensors 1 & 2 Control registers + U08 fpgaConSensTD34Control; ///< Reg 91. Conductivity/Temperature Sensors 3 & 4 Control registers + U16 fpgaConSensTD12_Addrs; ///< Reg 92. CDTD 1&2 Initialization Address register + U16 fpgaConSensTD12_Data_In; ///< Reg 94. CDTD 1&2 Initialization data register + U16 fpgaConSensTD34_Addrs; ///< Reg 96. CDTD 3&4 Initialization Address register + U16 fpgaConSensTD34_Data_In; ///< Reg 98. CDTD 3&4 Initialization data register + + U16 fpgaRemoteUpdate_Write; ///< Reg 100.Register for Remote update used by SW. + + U16 fpgaDGPSpeed; ///< Reg 102. DGP Speed/RPM Control + U08 fpgaDGPControl; ///< Reg 104. DGP Control + U08 fpgaSDPControl; ///< Reg 105. SDP Control + U16 fpgaSDPSpeed; ///< Reg 106. SDP Speed/RPM Control + U16 fpgaCPASpeed; ///< Reg 108. Acid Concentrate Pump Speed/RPM Control + U08 fpgaCPAControl; ///< Reg 110. Acid Concentrate Pump Control + U08 fpgaCPBControl; ///< Reg 111. BiCarb Concentrate Pump Control + U16 fpgaCPBSpeed; ///< Reg 112. BiCarb Concentrate Pump Speed/RPM Control + + U08 fpgaBloodLeakSensorTest; ///< Reg 114. Blood leak sensor test + U08 fpgaBloodLeakUARTControl; ///< Reg 115. Blood leak sensor UART control + U08 fpgaBloodLeakFIFOTx; ///< Reg 116. Blood leak sensor FIFO transmit control + } FPGA_ACTUATORS_T; #pragma pack(pop) // ********** private data ********** // FPGA data static FPGA_HEADER_T fpgaHeader; ///< FPGA header structure. -static DG_FPGA_SENSORS_T fpgaSensorReadings; ///< DG FPGA sensors structure. +static DD_FPGA_SENSORS_T fpgaSensorReadings; ///< DD FPGA sensors structure. static FPGA_ACTUATORS_T fpgaActuatorSetPoints; ///< FPGA actuator set points structure. // ********** private function prototypes ********** @@ -313,20 +380,17 @@ { // Initialize fpga driver initFPGA( (U08*)&fpgaHeader, (U08*)&fpgaSensorReadings, (U08*)&fpgaActuatorSetPoints, - sizeof(FPGA_HEADER_T), sizeof(DG_FPGA_SENSORS_T), sizeof(FPGA_ACTUATORS_T) ); + 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( DG_FPGA_SENSORS_T ) ); + memset( &fpgaSensorReadings, 0, sizeof( DD_FPGA_SENSORS_T ) ); memset( &fpgaActuatorSetPoints, 0, sizeof( FPGA_ACTUATORS_T ) ); // Set the THd control register to 0x1 to make sure its ADC is running - fpgaActuatorSetPoints.fpgaTHdControlReg = FPGA_THD_CONTROL_COMMAND; - fpgaActuatorSetPoints.fpgaValveStates = FPGA_ENABLE_VALVES_CONTROL; + //fpgaActuatorSetPoints.fpgaTHdControlReg = FPGA_THD_CONTROL_COMMAND; + fpgaActuatorSetPoints.fpgaValveControl = FPGA_ENABLE_VALVES_CONTROL; fpgaActuatorSetPoints.fpgaValvePWMEnable = FPGA_ENABLE_VALVES_PWM; - fpgaActuatorSetPoints.fpgaVBfPWMPullin = FPGA_VBF_PWM_PULL_IN_MS; - fpgaActuatorSetPoints.fpgaVBfPWMLow = FPGA_VBF_PWM_LOW; - fpgaActuatorSetPoints.fpgaVBFPWMPeriod = FPGA_VBF_PWM_PERIOD; // 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); @@ -413,161 +477,158 @@ /*********************************************************************//** * @brief - * The setFPGAValveStates function sets the DG valve states with a 16-bit + * The setFPGAValveStates 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 - VRf.\n - * 1 - VRi.\n - * 2 - VRd.\n - * 3 - VRo.\n - * 4 - VPo.\n - * 5 - VBf.\n - * 6 - VRc.\n - * 7 - VDr.\n - * 8 - VPi.\n - * 9 - VSP.\n - * 10..11 - reserved (spare).\n - * 12- VPd.\n + * 0 - VDr/VDo.\n + * 1 - VTD.\n + * 2 - VHB.\n + * 3 - Vrp.\n + * 4 - VHo.\n + * 5 - VDB1.\n + * 6 - VP1.\n + * 7 - VPT.\n + * 8 - VDB2.\n + * 9 - VDi.\n + * 10 - VDo.\n + * 11 - VP2.\n + * 12 - VHi.\n * 13..15 - reserved or unused. * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaValveStates + * @details \b Outputs: fpgaActuatorSetPoints.fpgaValveControl * @param valveStates bit mask for the various valve states * @return none *************************************************************************/ void setFPGAValveStates( U16 valveStates ) { - fpgaActuatorSetPoints.fpgaValveStates = valveStates; + fpgaActuatorSetPoints.fpgaValveControl = valveStates; } /*********************************************************************//** * @brief - * The setFPGADrainPumpSpeed function sets the drain pump target speed. - * The drain pump DAC value should be set to 1 count for each 12.94 RPM desired. + * 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 - V1.\n + * 1 - V2.\n + * 2 - V3.\n + * 3 - V4.\n + * 4 - V5.\n + * 5 - V6.\n + * 6 - V7.\n + * 7 - V8.\n * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaDrainPumpSetSpeed - * @param drainPumpDAC DAC value to command for the drain pump + * @details \b Outputs: fpgaActuatorSetPoints.fpgaBCValveControl + * @param valveStates bit mask for the balancing chamber valve states * @return none *************************************************************************/ -void setFPGADrainPumpSpeed( U08 drainPumpDAC ) +void setFPGABCValveStates( U08 valveStates ) { - U16 dac = (U16)drainPumpDAC & MASK_OFF_MSB; - - dac = dac << DRAIN_PUMP_DAC_SHIFT_BITS; - fpgaActuatorSetPoints.fpgaDrainPumpSetSpeed = dac; + fpgaActuatorSetPoints.fpgaBCValveControl = valveStates; } /*********************************************************************//** * @brief - * The setFPGACPoProbeType function sets the CPo sensor probe type and - * sets the control register to write probe type to the device. + * The setFPGAUFValveStates function sets the DD ultrafiltration 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 - UFi1.\n + * 1 - UFo1.\n + * 2 - UFi2.\n + * 3 - UFo2.\n + * 4..7 - Unused or reserved.\n * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPoProbeType, fpgaActuatorSetPoints.fpgaCPoControlReg - * @param probeType The probe cell constant value to set to + * @details \b Outputs: fpgaActuatorSetPoints.fpgaUFValveControl + * @param valveStates bit mask for the balancing chamber valve states * @return none *************************************************************************/ -void setFPGACPoProbeType( U16 probeType ) +void setFPGAUFValveStates( U08 valveStates ) { - fpgaActuatorSetPoints.fpgaCPoProbeType = probeType; - fpgaActuatorSetPoints.fpgaCPoControlReg = 0x1; + fpgaActuatorSetPoints.fpgaUFValveControl = valveStates; } /*********************************************************************//** * @brief - * The setFPGACPiProbeType function sets the CPi sensor probe type and - * sets the control register to write probe type to the device. + * The setFPGADialysateOutPumpSpeed function sets the speed period for + * dialysate out pump (SDP). * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPiProbeType, fpgaActuatorSetPoints.fpgaCPiControlReg - * @param probeType The probe cell constant value to set to + * @details \b Outputs: fpgaActuatorSetPoints.fpgaSDPSpeed + * @param speed The dialysate out pump speed period * @return none *************************************************************************/ -void setFPGACPiProbeType( U16 probeType ) +void setFPGADialysateOutPumpSpeed( U16 speed ) { - fpgaActuatorSetPoints.fpgaCPiProbeType = probeType; - fpgaActuatorSetPoints.fpgaCPiControlReg = 0x1; + fpgaActuatorSetPoints.fpgaSDPSpeed = speed; } /*********************************************************************//** * @brief - * The setFPGAcidPumpControl function sets the control configuration for - * concentrate pump CP1. + * The setFPGADialysateInPumpSpeed function sets the speed period for + * dialysate In pump (DGP). * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaCP1Control - * @param pumpControl The concentrate pump control configuration + * @details \b Outputs: fpgaActuatorSetPoints.fpgaDGPSpeed + * @param speed The dialysate In pump speed period * @return none *************************************************************************/ -void setFPGAV3AcidPumpControl( U08 pumpControl ) +void setFPGADialysateInPumpSpeed( U16 speed ) { - fpgaActuatorSetPoints.fpgaCP1Control &= FPGA_CONC_PUMP_PARK_COMMAND; - fpgaActuatorSetPoints.fpgaCP1Control |= pumpControl; + fpgaActuatorSetPoints.fpgaDGPSpeed = speed; } /*********************************************************************//** * @brief - * The setFPGABicarbPumpControl function sets the control configuration for - * concentrate pump CP2. + * The setFPGADialysateOutPumpControl function sets the controls for + * dialysate out pump (SDP). bit definitions To be defined(TBD) * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaCP2Control - * @param pumpControl The concentrate pump control configuration + * @details \b Outputs: fpgaActuatorSetPoints.fpgaSDPControl + * @param control The dialysate out pump controls * @return none *************************************************************************/ -void setFPGAV3BicarbPumpControl( U08 pumpControl ) +void setFPGADialysateOutPumpControl( U08 control ) { - fpgaActuatorSetPoints.fpgaCP2Control &= FPGA_CONC_PUMP_PARK_COMMAND; - fpgaActuatorSetPoints.fpgaCP2Control |= pumpControl; + fpgaActuatorSetPoints.fpgaSDPControl = control; } /*********************************************************************//** * @brief - * The setFPGABicarbPumpControl function sets the park command bit for the - * concentrate pump CP1. + * The setFPGADialysateInPumpControl function sets the controls for + * dialysate In pump (DGP). bit definitions To be defined(TBD) * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaCP1Control + * @details \b Outputs: fpgaActuatorSetPoints.fpgaDGPControl + * @param control The dialysate In pump controls * @return none *************************************************************************/ -void setFPGAV3AcidPumpParkCmd( void ) +void setFPGADialysateInPumpControl( U08 control ) { - fpgaActuatorSetPoints.fpgaCP1Control |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands + fpgaActuatorSetPoints.fpgaDGPControl = control; } /*********************************************************************//** * @brief - * The setFPGAV3BicarbPumpParkCmd function sets the park command bit for the - * concentrate pump CP2. - * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaCP2Control - * @return none - *************************************************************************/ -void setFPGAV3BicarbPumpParkCmd( void ) -{ - fpgaActuatorSetPoints.fpgaCP2Control |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands -} - -/*********************************************************************//** - * @brief * The setFPGAAcidPumpSetStepSpeed function sets the step speed period for - * concentrate pump CP1. + * concentrate pump CPA. * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaCP1StepSpeed + * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPASpeed * @param stepSpeed The concentrate pump step speed period * @return none *************************************************************************/ void setFPGAAcidPumpSetStepSpeed( U16 stepSpeed ) { - fpgaActuatorSetPoints.fpgaCP1StepSpeed = stepSpeed; + fpgaActuatorSetPoints.fpgaCPASpeed = stepSpeed; } /*********************************************************************//** * @brief * The setFPGABicarbSetStepSpeed function sets the step speed period for * concentrate pump CP2. * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaCP2StepSpeed + * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPBSpeed * @param stepSpeed The concentrate pump step speed period * @return none *************************************************************************/ void setFPGABicarbSetStepSpeed( U16 stepSpeed ) { - fpgaActuatorSetPoints.fpgaCP2StepSpeed = stepSpeed; + fpgaActuatorSetPoints.fpgaCPBSpeed = stepSpeed; } /*********************************************************************//** @@ -581,37 +642,18 @@ * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaNewCP1Control + * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPAControl * @param control Concentrate pump control set * @return none *************************************************************************/ void setFPGAAcidPumpControl( U08 control ) { - fpgaActuatorSetPoints.fpgaNewCP1Control &= FPGA_CONC_PUMP_PARK_COMMAND; // preserve msb (park command bit) - fpgaActuatorSetPoints.fpgaNewCP1Control |= control; + fpgaActuatorSetPoints.fpgaCPAControl &= FPGA_CONC_PUMP_PARK_COMMAND; // preserve msb (park command bit) + fpgaActuatorSetPoints.fpgaCPAControl |= control; } /*********************************************************************//** * @brief - * The getFPGAAcidPumpControlStatus 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.fpgaNewCP1Control - * @return Acid pump control status bit - *************************************************************************/ -U08 getFPGAAcidPumpControlStatus( void ) -{ - return fpgaActuatorSetPoints.fpgaNewCP1Control; -} - -/*********************************************************************//** - * @brief * The setFPGABicarbPumpControl function sets the DVT concentrate pump 2 * (bicarb pump) control mode. * bit 7: Park (set in different function) @@ -621,49 +663,30 @@ * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaNewCP2Control + * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPBControl * @param control Concentrate pump control set * @return none *************************************************************************/ void setFPGABicarbPumpControl( U08 control ) { - fpgaActuatorSetPoints.fpgaNewCP2Control &= FPGA_CONC_PUMP_PARK_COMMAND; // preserve msb (park command bit) - fpgaActuatorSetPoints.fpgaNewCP2Control |= control; + fpgaActuatorSetPoints.fpgaCPBControl &= FPGA_CONC_PUMP_PARK_COMMAND; // preserve msb (park command bit) + fpgaActuatorSetPoints.fpgaCPBControl |= control; } /*********************************************************************//** * @brief - * The getFPGABicarbPumpControlStatus 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.fpgaNewCP2Control - * @return Bicarb pump control status bit - *************************************************************************/ -U08 getFPGABicarbPumpControlStatus( void ) -{ - return fpgaActuatorSetPoints.fpgaNewCP2Control; -} - -/*********************************************************************//** - * @brief * The setFPGAAcidPumpParkCmd 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.fpgaNewCP1Control + * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPAControl * @param Park command bit set * @return none *************************************************************************/ void setFPGAAcidPumpParkCmd( void ) { - fpgaActuatorSetPoints.fpgaNewCP1Control |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands + fpgaActuatorSetPoints.fpgaCPAControl |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands } /*********************************************************************//** @@ -673,17 +696,117 @@ * bit 7: Park command bit * bit 0-6: Other pump control bits (set in different function) * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaNewCP2Control + * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPBControl * @param Park command bit set * @return none *************************************************************************/ void setFPGABicarbPumpParkCmd( void ) { - fpgaActuatorSetPoints.fpgaNewCP2Control |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands + fpgaActuatorSetPoints.fpgaCPBControl |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands } /*********************************************************************//** * @brief + * The setFpgaCD12Control function sets the FPGA Conductivity + * Sensor control register for CD1&2. + * bit 7: Enables TD2 read transaction (1), address needed + * bit 6: Enables TD2 write transaction (1), address and data needs to be set + * bit 5: Enable TD2 Init procedure (1) + * bit 4: reset TD2 Conduct sensor (1) + * bit 3: Enables TD1 read transaction (1), address needed + * bit 2: Enables TD1 write transaction (1), address and data needs to be set + * bit 1: Enable TD1 Init procedure (1) + * bit 0: reset TD1 Conduct sensor (1) + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control + * @param control Conductivity Sensor control set + * @return none + *************************************************************************/ +void setFPGACD12Control( U08 control ) +{ + fpgaActuatorSetPoints.fpgaConSensTD12Control = control; +} + +/*********************************************************************//** + * @brief + * The setFpgaCD34Control function sets the FPGA Conductivity + * Sensor control register for CD3&4. + * bit 7: Enables TD4 read transaction (1), address needed + * bit 6: Enables TD4 write transaction (1), address and data needs to be set + * bit 5: Enable TD4 Init procedure (1) + * bit 4: reset TD4 Conduct sensor (1) + * bit 3: Enables TD3 read transaction (1), address needed + * bit 2: Enables TD3 write transaction (1), address and data needs to be set + * bit 1: Enable TD3 Init procedure (1) + * bit 0: reset TD3 Conduct sensor (1) + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control + * @param control Conductivity sensor control set + * @return none + *************************************************************************/ +void setFPGACD34Control( U08 control ) +{ + fpgaActuatorSetPoints.fpgaConSensTD34Control = control; +} + +/*********************************************************************//** + * @brief + * The setFPGACD12Address function sets the conductivity sensor + * CD12 address register to perform read and write operations. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12_Addrs + * @param address The conductivity sensor CD12 address + * @return none + *************************************************************************/ +void setFPGACD12Address( U16 address ) +{ + fpgaActuatorSetPoints.fpgaConSensTD12_Addrs = address; +} + +/*********************************************************************//** + * @brief + * The setFPGACD34Address function sets the conductivity sensor + * CD34 address register to perform read and write operations. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34_Addrs + * @param address The conductivity sensor CD34 address + * @return none + *************************************************************************/ +void setFPGACD34Address( U16 address ) +{ + fpgaActuatorSetPoints.fpgaConSensTD34_Addrs = address; +} + +/*********************************************************************//** + * @brief + * The setFPGACD12Data function sets the conductivity sensor + * CD12 data input for write operations. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12_Data_In + * @param data The conductivity sensor CD12 Data + * @return none + *************************************************************************/ +void setFPGACD12Data( U16 data ) +{ + fpgaActuatorSetPoints.fpgaConSensTD12_Data_In = data; +} + +/*********************************************************************//** + * @brief + * The setFPGACD34Data function sets the conductivity sensor + * CD34 data input for write operations. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34_Data_In + * @param data The conductivity sensor CD34 Data + * @return none + *************************************************************************/ +void setFPGACD34Data( U16 data ) +{ + fpgaActuatorSetPoints.fpgaConSensTD34_Data_In = data; +} + +/*********************************************************************//** + * @brief * The getFPGAVersions function gets the FPGA version numbers. * @details \b Inputs: fpgaHeader * @details \b Outputs: none @@ -699,58 +822,78 @@ /*********************************************************************//** * @brief - * The getFPGALoadCellA1 function gets the latest load cell A 1 reading. - * Least significant 24 bits are the reading. Most significant bit indicates - * CRC or status error. - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return last load cell A 1 reading + * The getFPGADialysateOutPumpControl 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 0-2: TBD + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaSDPControl + * @return Dialysate Out pump control status bit *************************************************************************/ -U32 getFPGALoadCellA1( void ) +U08 getFPGADialysateOutPumpControl( void ) { - return fpgaSensorReadings.fpgaLCA1; + return fpgaActuatorSetPoints.fpgaSDPControl; } /*********************************************************************//** * @brief - * The getFPGALoadCellA2 function gets the latest load cell A 2 reading. - * Least significant 24 bits are the reading. Most significant bit indicates - * CRC or status error. - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return last load cell A 2 reading + * The getFPGADialysateInPumpControl 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 0-2: TBD + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaDGPControl + * @return Dialysate Inlet pump control status bit *************************************************************************/ -U32 getFPGALoadCellA2( void ) +U08 getFPGADialysateInPumpControl( void ) { - return fpgaSensorReadings.fpgaLCA2; + return fpgaActuatorSetPoints.fpgaDGPControl; } /*********************************************************************//** * @brief - * The getFPGALoadCellB1 function gets the latest load cell B 1 reading. - * Least significant 24 bits are the reading. Most significant bit indicates - * CRC or status error. - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return last load cell B 1 reading + * The getFPGAAcidPumpControlStatus 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.fpgaCPAControl + * @return Acid pump control status bit *************************************************************************/ -U32 getFPGALoadCellB1( void ) +U08 getFPGAAcidPumpControlStatus( void ) { - return fpgaSensorReadings.fpgaLCB1; + return fpgaActuatorSetPoints.fpgaCPAControl; } /*********************************************************************//** * @brief - * The getFPGALoadCellB2 function gets the latest load cell B 2 reading. - * Least significant 24 bits are the reading. Most significant bit indicates - * CRC or status error. - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return last load cell B 2 reading + * The getFPGABicarbPumpControlStatus 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.fpgaCPBControl + * @return Bicarb pump control status bit *************************************************************************/ -U32 getFPGALoadCellB2( void ) +U08 getFPGABicarbPumpControlStatus( void ) { - return fpgaSensorReadings.fpgaLCB2; + return fpgaActuatorSetPoints.fpgaCPBControl; } /*********************************************************************//** @@ -768,688 +911,912 @@ /*********************************************************************//** * @brief - * The getFPGAROPumpFlowRate function gets the latest RO flow rate. - * @details \b Inputs: fpgaSensorReadings.fpgaROFlowRate + * The getFPGAPnReadCount function gets Pn/PHo pressure sensor counter of + * good I2C transmissions between FPGA and Sensor. + * @details \b Inputs: fpgaSensorReadings.fpgaPnReadCnt * @details \b Outputs: none - * @return last RO flow rate reading + * @return Latest Pn/PHo Pressure sensor read count *************************************************************************/ -U16 getFPGAROPumpFlowRate( void ) +U08 getFPGAPnReadCount( void ) { - return fpgaSensorReadings.fpgaROFlowRate; + return fpgaSensorReadings.fpgaPnReadCnt; } /*********************************************************************//** * @brief - * The getFPGADialysateFlowRate function gets the latest dialysate flow rate. - * @details \b Inputs: fpgaSensorReadings.fpgaDialysateFlowRate + * The getFPGAPnErrorCount function gets Pn/PHo pressure sensor error count. + * @details \b Inputs: fpgaSensorReadings.fpgaPnErrorCnt * @details \b Outputs: none - * @return last dialysate flow rate reading + * @return Latest Pn/PHo pressure sensor read error count *************************************************************************/ -U16 getFPGADialysateFlowRate( void ) +U08 getFPGAPnErrorCount( void ) { - return fpgaSensorReadings.fpgaDialysateFlowRate; + return fpgaSensorReadings.fpgaPnErrorCnt; } /*********************************************************************//** * @brief - * The getFPGADrainPumpSpeed function gets the latest sensed drain pump speed. - * @details \b Inputs: fpgaSensorReadings.fpgaDrainPumpSpeed + * The getFPGAPnRawPressure function gets Pn/PHo pressure sensor raw + * pressure value. + * @details \b Inputs: fpgaSensorReadings.fpgaPnPressure * @details \b Outputs: none - * @return last drain pump speed reading + * @return Latest Pn/PHo pressure sensor raw pressure data *************************************************************************/ -U16 getFPGADrainPumpSpeed( void ) +U32 getFPGAPnRawPressure( void ) { - return fpgaSensorReadings.fpgaDrainPumpSpeed; + return fpgaSensorReadings.fpgaPnPressure; } /*********************************************************************//** * @brief - * The getFPGATPiTemp function gets the latest primary heater inlet temperature reading. - * @details \b Inputs: fpgaSensorReadings.fpgaTPiTemp + * The getFPGAPnRawTemperature function gets Pn/PHo pressure sensor raw + * temperature value. + * @details \b Inputs: fpgaSensorReadings.fpgaPnTemp * @details \b Outputs: none - * @return last primary heater inlet temperature reading + * @return Latest Pn/PHo pressure sensor raw temperature data *************************************************************************/ -U32 getFPGATPiTemp( void ) +U32 getFPGAPnRawTemperature( void ) { - return fpgaSensorReadings.fpgaTPiTemp; + return fpgaSensorReadings.fpgaPnTemp; } /*********************************************************************//** * @brief - * The getFPGATPoTemp function gets the latest primary heater outlet temperature reading. - * @details \b Inputs: fpgaSensorReadings.fpgaTPoTemp + * The getFPGAPCbReadCount function gets PCb/PDB pressure sensor counter of + * good I2C transmissions between FPGA and Sensor. + * @details \b Inputs: fpgaSensorReadings.fpgaPCbReadCnt * @details \b Outputs: none - * @return last primary heater outlet temperature reading + * @return Latest PCb/PDB Pressure sensor read count *************************************************************************/ -U32 getFPGATPoTemp( void ) +U08 getFPGAPCbReadCount( void ) { - return fpgaSensorReadings.fpgaTPoTemp; + return fpgaSensorReadings.fpgaPCbReadCnt; } /*********************************************************************//** * @brief - * The getFPGATD1Temp function gets the latest conductivity sensor 1 - * temperature reading in ADC. - * @details \b Inputs: fpgaSensorReadings.fpgaCD1Temp + * The getFPGAPCbErrorCount function gets PCb/PDB pressure sensor error count. + * @details \b Inputs: fpgaSensorReadings.fpgaPCbErrorCnt * @details \b Outputs: none - * @return last conductivity sensor 1 outlet temperature reading + * @return Latest PCb/PDB pressure sensor read error count *************************************************************************/ -U32 getFPGACD1Temp( void ) +U08 getFPGAPCbErrorCount( void ) { - return fpgaSensorReadings.fpgaCD1Temp; + return fpgaSensorReadings.fpgaPCbErrorCnt; } /*********************************************************************//** * @brief - * The getFPGATD2Temp function gets the latest conductivity sensor 2 - * temperature reading in ADC. - * @details \b Inputs: fpgaSensorReadings.fpgaCD2Temp + * The getFPGAPCbRawPressure function gets PCb/PDB pressure sensor raw + * pressure value. + * @details \b Inputs: fpgaSensorReadings.fpgaPCbPressure * @details \b Outputs: none - * @return last conductivity sensor 2 outlet temperature reading + * @return Latest PCb/PDB pressure sensor raw pressure data *************************************************************************/ -U32 getFPGACD2Temp( void ) +U32 getFPGAPCbRawPressure( void ) { - return fpgaSensorReadings.fpgaCD2Temp; + return fpgaSensorReadings.fpgaPCbPressure; } /*********************************************************************//** * @brief - * The getFPGARTDErrorCount function gets error count of the RTD. It covers - * all the four temperature sensors associates with conductivity sensors. - * @details \b Inputs: fpgaSensorReadings.fpgaRTDErrorCnt + * The getFPGAPCbRawTemperature function gets PCb/PDB pressure sensor raw + * temperature value. + * @details \b Inputs: fpgaSensorReadings.fpgaPCbTemp * @details \b Outputs: none - * @return Last error count of the RTD temperature sensors + * @return Latest PCb/PDB pressure sensor raw temperature data *************************************************************************/ -U08 getFPGARTDErrorCount( void ) +U32 getFPGAPCbRawTemperature( void ) { - return fpgaSensorReadings.fpgaRTDErrorCnt; + return fpgaSensorReadings.fpgaPCbTemp; } /*********************************************************************//** * @brief - * The getFPGARTDReadCount function gets the read count of the RTD - * temperature sensors. It covers all the four temperature sensors associates - * with conductivity sensors. - * @details \b Inputs: fpgaSensorReadings.fpgaRTDReadCnt + * The getFPGAPDsReadCount function gets PDs pressure sensor counter of + * good I2C transmissions between FPGA and Sensor. + * @details \b Inputs: fpgaSensorReadings.fpgaPDsReadCnt * @details \b Outputs: none - * @return Last read count of the RTC temperature sensors + * @return Latest PDs Pressure sensor read count *************************************************************************/ -U08 getFPGARTDReadCount( void ) +U08 getFPGAPDsReadCount( void ) { - return fpgaSensorReadings.fpgaRTDReadCnt; + return fpgaSensorReadings.fpgaPDsReadCnt; } /*********************************************************************//** * @brief - * The getFPGATRoTemp function gets the latest redundant sensor outlet - * temperature reading in ADC. - * @details \b Inputs: fpgaSensorReadings.fpgaTRo + * The getFPGAPDsErrorCount function gets PDs pressure sensor error count. + * @details \b Inputs: fpgaSensorReadings.fpgaPDsErrorCnt * @details \b Outputs: none - * @return Last redundant sensor outlet temperature reading + * @return Latest PDs pressure sensor read error count *************************************************************************/ -U32 getFPGATRoTemp( void ) +U08 getFPGAPDsErrorCount( void ) { - return fpgaSensorReadings.fpgaTRo; + return fpgaSensorReadings.fpgaPDsErrorCnt; } /*********************************************************************//** * @brief - * The getFPGATRoErrorCount gets the error count of the THDo (redundant) temperature sensor. - * @details \b Inputs: fpgaSensorReadings.fpgaTRoErrorCnt + * The getFPGAPDsRawPressure function gets PDs pressure sensor raw + * pressure value. + * @details \b Inputs: fpgaSensorReadings.fpgaPDsPressure * @details \b Outputs: none - * @return Last redundant sensor outlet temperature error count + * @return Latest PDs pressure sensor raw pressure data *************************************************************************/ -U08 getFPGATRoErrorCount( void ) +U32 getFPGAPDsRawPressure( void ) { - return fpgaSensorReadings.fpgaTRoErrorCnt; + return fpgaSensorReadings.fpgaPDsPressure; } /*********************************************************************//** * @brief - * The getFPGATRoReadCount gets the read count of the THDo (redundant) temperature sensor. - * @details \b Inputs: fpgaSensorReadings.fpgaTRoReadCnt + * The getFPGAPDsRawTemperature function gets PDs pressure sensor raw + * temperature value. + * @details \b Inputs: fpgaSensorReadings.fpgaPDsTemp * @details \b Outputs: none - * @return Last redundant sensor outlet temperature error count reading + * @return Latest PDs pressure sensor raw temperature data *************************************************************************/ -U08 getFPGATRoReadCount( void ) +U32 getFPGAPDsRawTemperature( void ) { - return fpgaSensorReadings.fpgaTRoReadCnt; + return fpgaSensorReadings.fpgaPDsTemp; } /*********************************************************************//** * @brief - * The getFPGATDiTemp function gets the latest dialysate inlet temperature reading in ADC. - * @details \b Inputs: fpgaSensorReadings.fpgaTDiTemp + * The getFPGAPDfReadCount function gets PDf pressure sensor counter of + * good I2C transmissions between FPGA and Sensor. + * @details \b Inputs: fpgaSensorReadings.fpgaPDfReadCnt * @details \b Outputs: none - * @return last primary heater outlet temperature reading + * @return Latest PDf Pressure sensor read count *************************************************************************/ -U32 getFPGATDiTemp( void ) +U08 getFPGAPDfReadCount( void ) { - return fpgaSensorReadings.fpgaTDi; + return fpgaSensorReadings.fpgaPDfReadCnt; } /*********************************************************************//** * @brief - * The getFPGATDiErrorCount function gets the latest dialysate inlet temperature error count. - * @details \b Inputs: fpgaSensorReadings.fpgaTDiErrorCnt + * The getFPGAPDfErrorCount function gets PDf pressure sensor error count. + * @details \b Inputs: fpgaSensorReadings.fpgaPDfErrorCnt * @details \b Outputs: none - * @return Last dialysate inlet error count + * @return Latest PDf pressure sensor read error count *************************************************************************/ -U08 getFPGATDiErrorCount( void ) +U08 getFPGAPDfErrorCount( void ) { - return fpgaSensorReadings.fpgaTDiErrorCnt; + return fpgaSensorReadings.fpgaPDfErrorCnt; } /*********************************************************************//** * @brief - * The getFPGATDiReadCount function gets the latest dialysate inlet temperature read count. - * @details \b Inputs: fpgaSensorReadings.fpgaTDiReadCnt + * The getFPGAPDfRawPressure function gets PDf pressure sensor raw + * pressure value. + * @details \b Inputs: fpgaSensorReadings.fpgaPDfPressure * @details \b Outputs: none - * @return Last dialysate inlet read count + * @return Latest PDf pressure sensor raw pressure data *************************************************************************/ -U08 getFPGATDiReadCount( void ) +U32 getFPGAPDfRawPressure( void ) { - return fpgaSensorReadings.fpgaTDiReadCnt; + return fpgaSensorReadings.fpgaPDfPressure; } /*********************************************************************//** * @brief - * The getFPGAPrimaryHeaterTemp function gets the latest primary heater - * internal temperature reading. - * @details \b Inputs: fpgaSensorReadings.fpgaPrimaryHeaterIntTemp + * The getFPGAPDfRawTemperature function gets PDf pressure sensor raw + * temperature value. + * @details \b Inputs: fpgaSensorReadings.fpgaPDfTemp * @details \b Outputs: none - * @return last primary heater temperature reading + * @return Latest PDf pressure sensor raw temperature data *************************************************************************/ -U16 getFPGAPrimaryHeaterTemp( void ) +U32 getFPGAPDfRawTemperature( void ) { - return fpgaSensorReadings.fpgaPrimaryHeaterIntTemp; + return fpgaSensorReadings.fpgaPDfTemp; } /*********************************************************************//** * @brief - * The getFPGAPrimaryHeaterFlags function gets the latest primary heater - * internal temperature sensor flags read. - * @details \b Inputs: fpgaSensorReadings.fpgaPrimaryHeaterFlags + * The getFPGAPtmReadCount function gets Ptm pressure sensor counter of + * good I2C transmissions between FPGA and Sensor. + * @details \b Inputs: fpgaSensorReadings.fpgaPtmReadCnt * @details \b Outputs: none - * @return Last primary heater internal temperature sensor flag read + * @return Latest Ptm Pressure sensor read count *************************************************************************/ -U08 getFPGAPrimaryHeaterFlags( void ) +U08 getFPGAPtmReadCount( void ) { - return fpgaSensorReadings.fpgaPrimaryHeaterFlags; + return fpgaSensorReadings.fpgaPtmReadCnt; } /*********************************************************************//** * @brief - * The geetFPGAPrimaryHeaterReadCount function gets the latest primary heater - * internal temperature sensor read count. - * @details \b Inputs: fpgaSensorReadings.fpgaPrimaryHeaterReadCnt + * The getFPGAPtmErrorCount function gets Ptm pressure sensor error count. + * @details \b Inputs: fpgaSensorReadings.fpgaPtmErrorCnt * @details \b Outputs: none - * @return Last primary heater internal temperature sensor read count + * @return Latest Ptm pressure sensor read error count *************************************************************************/ -U08 getFPGAPrimaryHeaterReadCount( void ) +U08 getFPGAPtmErrorCount( void ) { - return fpgaSensorReadings.fpgaPrimaryHeaterReadCnt; + return fpgaSensorReadings.fpgaPtmErrorCnt; } /*********************************************************************//** * @brief - * The getFPGATrimmerHeaterTemp function gets the latest trimmer heater - * internal temperature sensor reading. - * @details \b Inputs: fpgaSensorReadings.fpgaTrimmerHeaterIntTemp + * The getFPGAPtmRawPressure function gets Ptm pressure sensor raw + * pressure value. + * @details \b Inputs: fpgaSensorReadings.fpgaPtmPressure * @details \b Outputs: none - * @return last trimmer heater temperature reading + * @return Latest Ptm pressure sensor raw pressure data *************************************************************************/ -U16 getFPGATrimmerHeaterTemp( void ) +U32 getFPGAPtmRawPressure( void ) { - return fpgaSensorReadings.fpgaTrimmerHeaterIntTemp; + return fpgaSensorReadings.fpgaPtmPressure; } /*********************************************************************//** * @brief - * The getFPGATrimmerHeaterFlags function gets the latest trimmer heater - * internal temperature flags read. - * @details \b Inputs: fpgaSensorReadings.fpgaTrimmerHeaterFlags + * The getFPGAPtmRawTemperature function gets Ptm pressure sensor raw + * temperature value. + * @details \b Inputs: fpgaSensorReadings.fpgaPtmTemp * @details \b Outputs: none - * @return Last trimmer heater internal temperature flags read + * @return Latest Ptm pressure sensor raw temperature data *************************************************************************/ -U08 getFPGATrimmerHeaterFlags( void ) +U32 getFPGAPtmRawTemperature( void ) { - return fpgaSensorReadings.fpgaTrimmerHeaterFlags; + return fpgaSensorReadings.fpgaPtmTemp; } /*********************************************************************//** * @brief - * The getFPGATrimmerHeaterReadCount function gets the latest trimmer heater - * internal temperature read count. - * @details \b Inputs: fpgaSensorReadings.fpgaTrimmerHeaterReadCnt + * The getFPGACD1ReadCount function gets CD1 conductivity sensor read count. + * @details \b Inputs: fpgaSensorReadings.fpgaCD1ReadCnt * @details \b Outputs: none - * @return Last trimmer heater internal temperature read count + * @return Latest CD1 conductivity sensor read count *************************************************************************/ -U08 getFPGATrimmerHeaterReadCount( void ) +U08 getFPGACD1ReadCount( void ) { - return fpgaSensorReadings.fpgaTrimmerHeaterReadCnt; + return fpgaSensorReadings.fpgaCD1ReadCnt; } /*********************************************************************//** * @brief - * The getFPGAPrimaryColdJunctionTemp function gets primary cold junction temperature. - * @details \b Inputs: fpgaSensorReadings.fpgaPrimaryHeaterIntJunctionTemp + * The getFPGACD1ErrorCount function gets CD1 conductivity sensor error count. + * @details \b Inputs: fpgaSensorReadings.fpgaCD1ErrorCnt * @details \b Outputs: none - * @return Last primary cold junction temperature + * @return Latest CD1 conductivity sensor read error count *************************************************************************/ -U16 getFPGAPrimaryColdJunctionTemp( void ) +U08 getFPGACD1ErrorCount( void ) { - return fpgaSensorReadings.fpgaPrimaryHeaterIntJunctionTemp; + return fpgaSensorReadings.fpgaCD1ErrorCnt; } /*********************************************************************//** * @brief - * The getFPGATrimmerColdJunctionTemp function gets trimmer cold junction temperature. - * @details \b Inputs: fpgaSensorReadings.fpgaTrimmerHeaterIntJunctionTemp + * The getFPGACD1 function gets CD1 conductivity sensor value. + * @details \b Inputs: fpgaSensorReadings.fpgaCD1 * @details \b Outputs: none - * @return Last trimmer cold junction temperature + * @return Latest CD1 conductivity sensor value *************************************************************************/ -U16 getFPGATrimmerColdJunctionTemp( void ) +U16 getFPGACD1( void ) { - return fpgaSensorReadings.fpgaTrimmerHeaterIntJunctionTemp; + return fpgaSensorReadings.fpgaCD1Cond; } /*********************************************************************//** * @brief - * The getFPGAAccelAxes function gets the accelerometer axis readings. - * Axis readings are in ADC counts. 0.004 g per LSB. - * @details \b Inputs: fpgaSensorReadings + * The getFPGACD1Temp function gets CD1 conductivity sensor temperature value. + * @details \b Inputs: fpgaSensorReadings.fpgaCD1Temp * @details \b Outputs: none - * @param x Populate this param with X axis reading - * @param y Populate this param with Y axis reading - * @param z Populate this param with Z axis reading - * @return none + * @return Latest CD1 conductivity sensor temperature value *************************************************************************/ -void getFPGAAccelAxes( S16 *x, S16 *y, S16 *z ) +U16 getFPGACD1Temp( void ) { - *x = (S16)fpgaSensorReadings.accelX; - *y = (S16)fpgaSensorReadings.accelY; - *z = (S16)fpgaSensorReadings.accelZ; + return fpgaSensorReadings.fpgaCD1Temp; } /*********************************************************************//** * @brief - * The getFPGAAccelMaxes function gets the maximum accelerometer axis readings from - * last FPGA read (every 10 ms). Axis readings are in ADC counts. 0.004 g per LSB. - * @details \b Inputs: fpgaSensorReadings + * The getFPGACD1Data function gets CD1 conductivity sensor register value. + * @details \b Inputs: fpgaSensorReadings.fpgaCD1DataOut * @details \b Outputs: none - * @param x Populate this param with maximum X axis reading - * @param y Populate this param with maximum Y axis reading - * @param z Populate this param with maximum Z axis reading - * @return none + * @return Latest CD1 conductivity sensor register data value *************************************************************************/ -void getFPGAAccelMaxes( S16 *xmax, S16*ymax, S16*zmax ) +U16 getFPGACD1Data( void ) { - *xmax = (S16)fpgaSensorReadings.accelXMax; - *ymax = (S16)fpgaSensorReadings.accelYMax; - *zmax = (S16)fpgaSensorReadings.accelZMax; + return fpgaSensorReadings.fpgaCD1DataOut; } /*********************************************************************//** * @brief - * The getFPGAAccelStatus function gets the accelerometer reading count - * and error register values. - * @details \b Inputs: fpgaSensorReadings + * The getFPGACD2ReadCount function gets CD2 conductivity sensor read count. + * @details \b Inputs: fpgaSensorReadings.fpgaCD2ReadCnt * @details \b Outputs: none - * @param cnt Populate this param with latest sample counter value - * @param err Populate this param with latest error - * @return none + * @return Latest CD2 conductivity sensor read count *************************************************************************/ -void getFPGAAccelStatus( U16 *cnt, U16 *err ) +U08 getFPGACD2ReadCount( void ) { - *cnt = fpgaSensorReadings.accelSampleCounter; - *err = fpgaSensorReadings.accelFaultRegister; + return fpgaSensorReadings.fpgaCD2ReadCnt; } /*********************************************************************//** * @brief - * The getFPGACPiFault function gets CPi conductivity sensor fault. - * @details \b Inputs: fpgaSensorReadings.fpgaCPiFault + * The getFPGACD2ErrorCount function gets CD2 conductivity sensor error count. + * @details \b Inputs: fpgaSensorReadings.fpgaCD2ErrorCnt * @details \b Outputs: none - * @return Latest CPi conductivity sensor fault + * @return Latest CD2 conductivity sensor read error count *************************************************************************/ -U08 getFPGACPiFault( void ) +U08 getFPGACD2ErrorCount( void ) { - return fpgaSensorReadings.fpgaCPiFault; + return fpgaSensorReadings.fpgaCD2ErrorCnt; } /*********************************************************************//** * @brief - * The getFPGACPiReadCount function gets CPi conductivity sensor read count. - * @details \b Inputs: fpgaSensorReadings.fpgaCPiReadCnt + * The getFPGACD2 function gets CD2 conductivity sensor value. + * @details \b Inputs: fpgaSensorReadings.fpgaCD2 * @details \b Outputs: none - * @return Latest CPi conductivity sensor read count + * @return Latest CD2 conductivity sensor value *************************************************************************/ -U08 getFPGACPiReadCount( void ) +U16 getFPGACD2( void ) { - return fpgaSensorReadings.fpgaCPiReadCnt; + return fpgaSensorReadings.fpgaCD2Cond; } /*********************************************************************//** * @brief - * The getFPGACPiErrorCount function gets CPi conductivity sensor error count. - * @details \b Inputs: fpgaSensorReadings.fpgaCPiErrorCnt + * The getFPGACD2Temp function gets CD2 conductivity sensor temperature value. + * @details \b Inputs: fpgaSensorReadings.fpgaCD2Temp * @details \b Outputs: none - * @return Latest CPi conductivity sensor read error count + * @return Latest CD2 conductivity sensor temperature value *************************************************************************/ -U08 getFPGACPiErrorCount( void ) +U16 getFPGACD2Temp( void ) { - return fpgaSensorReadings.fpgaCPiErrorCnt; + return fpgaSensorReadings.fpgaCD2Temp; } /*********************************************************************//** * @brief - * The getFPGACPi function gets CPi conductivity sensor value. - * @details \b Inputs: fpgaSensorReadings.fpgaCPi + * The getFPGACD2Data function gets CD2 conductivity sensor register value. + * @details \b Inputs: fpgaSensorReadings.fpgaCD2DataOut * @details \b Outputs: none - * @return Latest CPi conductivity sensor value + * @return Latest CD2 conductivity sensor register data value *************************************************************************/ -U32 getFPGACPi( void ) +U16 getFPGACD2Data( void ) { - return fpgaSensorReadings.fpgaCPi; + return fpgaSensorReadings.fpgaCD2DataOut; } /*********************************************************************//** * @brief - * The getFPGACPoFault function gets CPo conductivity sensor fault. - * @details \b Inputs: fpgaSensorReadings.fpgaCPoFault + * The getFPGACD3ReadCount function gets CD3 conductivity sensor read count. + * @details \b Inputs: fpgaSensorReadings.fpgaCD3ReadCnt * @details \b Outputs: none - * @return Latest CPo sensor fault + * @return Latest CD3 conductivity sensor read count *************************************************************************/ -U08 getFPGACPoFault( void ) +U08 getFPGACD3ReadCount( void ) { - return fpgaSensorReadings.fpgaCPoFault; + return fpgaSensorReadings.fpgaCD3ReadCnt; } /*********************************************************************//** * @brief - * The getFPGACPoReadCount function gets CPo conductivity sensor read count. - * @details \b Inputs: fpgaSensorReadings.fpgaCPoReadCnt + * The getFPGACD3ErrorCount function gets CD3 conductivity sensor error count. + * @details \b Inputs: fpgaSensorReadings.fpgaCD3ErrorCnt * @details \b Outputs: none - * @return Latest CPo conductivity sensor read count + * @return Latest CD3 conductivity sensor read error count *************************************************************************/ -U08 getFPGACPoReadCount( void ) +U08 getFPGACD3ErrorCount( void ) { - return fpgaSensorReadings.fpgaCPoReadCnt; + return fpgaSensorReadings.fpgaCD3ErrorCnt; } /*********************************************************************//** * @brief - * The getFPGACPoErrorCount function gets CPo conductivity sensor error count. - * error count - * @details \b Inputs: fpgaSensorReadings.fpgaCPoErrorCnt + * The getFPGACD3 function gets CD3 conductivity sensor value. + * @details \b Inputs: fpgaSensorReadings.fpgaCD3 * @details \b Outputs: none - * @return Latest CPo conductivity sensor read error count + * @return Latest CD3 conductivity sensor value *************************************************************************/ -U08 getFPGACPoErrorCount( void ) +U16 getFPGACD3( void ) { - return fpgaSensorReadings.fpgaCPoErrorCnt; + return fpgaSensorReadings.fpgaCD3Cond; } /*********************************************************************//** * @brief - * The getFPGACPo function gets CPo conductivity sensor value. - * @details \b Inputs: fpgaSensorReadings.fpgaCPo + * The getFPGACD3Temp function gets CD3 conductivity sensor temperature value. + * @details \b Inputs: fpgaSensorReadings.fpgaCD3Temp * @details \b Outputs: none - * @return Latest CPo conductivity sensor value + * @return Latest CD3 conductivity sensor temperature value *************************************************************************/ -U32 getFPGACPo( void ) +U16 getFPGACD3Temp( void ) { - return fpgaSensorReadings.fpgaCPo; + return fpgaSensorReadings.fpgaCD3Temp; } /*********************************************************************//** * @brief - * The getFPGAConcentratePumpsFault function gets concentrate pumps fault - * reported by FGPA. - * @details \b Inputs: fpgaSensorReadings.fpgaCP1CP2Fault + * The getFPGACD3Data function gets CD3 conductivity sensor register value. + * @details \b Inputs: fpgaSensorReadings.fpgaCD3DataOut * @details \b Outputs: none - * @return Latest concentrate pumps fault value + * @return Latest CD3 conductivity sensor register data value *************************************************************************/ -U08 getFPGAConcentratePumpsFault( void ) +U16 getFPGACD3Data( void ) { - return fpgaSensorReadings.fpgaCP1CP2Fault & FPGA_CONC_PUMP_FAULT_BITS; + return fpgaSensorReadings.fpgaCD3DataOut; } /*********************************************************************//** * @brief - * The getFPGAAcidPumpIsParked function gets whether the acid pump is currently - * parked. - * @details \b Inputs: fpgaSensorReadings.fpgaCP1CP2Fault + * The getFPGACD4ReadCount function gets CD4 conductivity sensor read count. + * @details \b Inputs: fpgaSensorReadings.fpgaCD4ReadCnt * @details \b Outputs: none - * @return TRUE if acid pump is parked, FALSE if not + * @return Latest CD4 conductivity sensor read count *************************************************************************/ -BOOL getFPGAAcidPumpIsParked( void ) +U08 getFPGACD4ReadCount( void ) { - U08 mask = fpgaSensorReadings.fpgaCP1CP2Fault & FPGA_CP1_PARKED_BIT; - BOOL result = ( mask > 0 ? TRUE : FALSE ); + return fpgaSensorReadings.fpgaCD4ReadCnt; +} - return result; +/*********************************************************************//** + * @brief + * The getFPGACD4ErrorCount function gets CD4 conductivity sensor error count. + * @details \b Inputs: fpgaSensorReadings.fpgaCD4ErrorCnt + * @details \b Outputs: none + * @return Latest CD4 conductivity sensor read error count + *************************************************************************/ +U08 getFPGACD4ErrorCount( void ) +{ + return fpgaSensorReadings.fpgaCD4ErrorCnt; } /*********************************************************************//** * @brief - * The getFPGABicarbPumpIsParked function gets whether the bicarb pump is currently - * parked. - * @details \b Inputs: fpgaSensorReadings.fpgaCP1CP2Fault + * The getFPGACD4 function gets CD4 conductivity sensor value. + * @details \b Inputs: fpgaSensorReadings.fpgaCD4 * @details \b Outputs: none - * @return TRUE if bicarb pump is parked, FALSE if not + * @return Latest CD4 conductivity sensor value *************************************************************************/ -BOOL getFPGABicarbPumpIsParked( void ) +U16 getFPGACD4( void ) { - U08 mask = fpgaSensorReadings.fpgaCP1CP2Fault & FPGA_CP2_PARKED_BIT; - BOOL result = ( mask > 0 ? TRUE : FALSE ); + return fpgaSensorReadings.fpgaCD4Cond; +} - return result; +/*********************************************************************//** + * @brief + * The getFPGACD4Temp function gets CD4 conductivity sensor temperature value. + * @details \b Inputs: fpgaSensorReadings.fpgaCD4Temp + * @details \b Outputs: none + * @return Latest CD4 conductivity sensor temperature value + *************************************************************************/ +U16 getFPGACD4Temp( void ) +{ + return fpgaSensorReadings.fpgaCD4Temp; } /*********************************************************************//** * @brief - * The getFPGAAcidPumpParkFault function gets whether the acid pump park command - * has faulted. - * @details \b Inputs: fpgaSensorReadings.fpgaCP1CP2Fault + * The getFPGACD4Data function gets CD4 conductivity sensor register value. + * @details \b Inputs: fpgaSensorReadings.fpgaCD4DataOut * @details \b Outputs: none - * @return TRUE if acid pump park command faulted, FALSE if not + * @return Latest CD4 conductivity sensor register data value *************************************************************************/ -BOOL getFPGAAcidPumpParkFault( void ) +U16 getFPGACD4Data( void ) { - U08 mask = fpgaSensorReadings.fpgaCP1CP2Fault & FPGA_CP1_PARK_FAULT_BIT; - BOOL result = ( mask > 0 ? TRUE : FALSE ); + return fpgaSensorReadings.fpgaCD4DataOut; +} - return result; +/*********************************************************************//** + * @brief + * The getFPGALevelSensor1 function gets the latest FPGA level sensor 1 + * reading. + * @details \b Inputs: fpgaSensorReadings.fpgaLevelSensor1 + * @details \b Outputs: none + * @return last FPGA level sensor1 reading + *************************************************************************/ +U16 getFPGALevelSensor1( void ) +{ + return fpgaSensorReadings.fpgaLevelSensor1; } /*********************************************************************//** * @brief - * The getFPGABicarbPumpParkFault function gets whether the bicarb pump park command - * has faulted. - * @details \b Inputs: fpgaSensorReadings.fpgaCP1CP2Fault + * The getFPGALevelSensor2 function gets the latest FPGA level sensor 2 + * reading. + * @details \b Inputs: fpgaSensorReadings.fpgaLevelSensor2 * @details \b Outputs: none - * @return TRUE if bicarb pump park command faulted, FALSE if not + * @return last FPGA level sensor2 reading *************************************************************************/ -BOOL getFPGABicarbPumpParkFault( void ) +U16 getFPGALevelSensor2( void ) { - U08 mask = fpgaSensorReadings.fpgaCP1CP2Fault & FPGA_CP2_PARK_FAULT_BIT; - BOOL result = ( mask > 0 ? TRUE : FALSE ); + return fpgaSensorReadings.fpgaLevelSensor2; +} - return result; +/*********************************************************************//** + * @brief + * The getFPGATimerCount function gets the latest FPGA timer millisecond count. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return last FPGA timer count + *************************************************************************/ +U16 getFPGATimerCount( void ) +{ + return fpgaSensorReadings.fpgaTimerCountMS; } +#if 0 + /*********************************************************************//** * @brief - * The getFPGAEmstatOutByte function gets Emstat conductivity sensor output byte. - * @details \b Inputs: fpgaSensorReadings.fpgaEmstatOutByte + * The setFPGACPiProbeType function sets the CPi sensor probe type and + * sets the control register to write probe type to the device. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPiProbeType, fpgaActuatorSetPoints.fpgaCPiControlReg + * @param probeType The probe cell constant value to set to + * @return none + *************************************************************************/ +void setFPGACPiProbeType( U16 probeType ) +{ + //fpgaActuatorSetPoints.fpgaCPiProbeType = probeType; + //fpgaActuatorSetPoints.fpgaCPiControlReg = 0x1; +} +/*********************************************************************//** + * @brief + * The setFPGADrainPumpSpeed function sets the drain pump target speed. + * The drain pump DAC value should be set to 1 count for each 12.94 RPM desired. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaDrainPumpSetSpeed + * @param drainPumpDAC DAC value to command for the drain pump + * @return none + *************************************************************************/ +void setFPGADrainPumpSpeed( U08 drainPumpDAC ) +{ + U16 dac = (U16)drainPumpDAC & MASK_OFF_MSB; + + dac = dac << DRAIN_PUMP_DAC_SHIFT_BITS; + //fpgaActuatorSetPoints.fpgaDrainPumpSetSpeed = dac; +} + +/*********************************************************************//** + * @brief + * The setFPGACPoProbeType function sets the CPo sensor probe type and + * sets the control register to write probe type to the device. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPoProbeType, fpgaActuatorSetPoints.fpgaCPoControlReg + * @param probeType The probe cell constant value to set to + * @return none + *************************************************************************/ +void setFPGACPoProbeType( U16 probeType ) +{ + //fpgaActuatorSetPoints.fpgaCPoProbeType = probeType; + //fpgaActuatorSetPoints.fpgaCPoControlReg = 0x1; +} + +/*********************************************************************//** + * @brief + * The getFPGADrainPumpSpeed function gets the latest sensed drain pump speed. + * @details \b Inputs: fpgaSensorReadings.fpgaDrainPumpSpeed * @details \b Outputs: none - * @return Emstat conductivity sensor output byte + * @return last drain pump speed reading *************************************************************************/ -U08 getFPGAEmstatCD1CD2OutByte( void ) +U16 getFPGADrainPumpSpeed( void ) { - return fpgaSensorReadings.fpgaCD1CD2EmstatOutByte; + //return fpgaSensorReadings.fpgaDrainPumpSpeed; } /*********************************************************************//** * @brief - * The getFPGAEmstatCD1CD2RxErrCount function gets Emstat conductivity sensor - * error count. - * @details \b Inputs: fpgaSensorReadings.fpgaEmstatRxErrorCount + * The getFPGARTDErrorCount function gets error count of the RTD. It covers + * all the four temperature sensors associates with conductivity sensors. + * @details \b Inputs: fpgaSensorReadings.fpgaRTDErrorCnt * @details \b Outputs: none - * @return Emstat conductivity sensor receive error count + * @return Last error count of the RTD temperature sensors *************************************************************************/ -U08 getFPGAEmstatCD1CD2RxErrCount( void ) +U08 getFPGARTDErrorCount( void ) { - return fpgaSensorReadings.fpgaCD1CD2EmstatRxErrorCount; + //return fpgaSensorReadings.fpgaRTDErrorCnt; } /*********************************************************************//** * @brief - * The getFPGAEmstatCD1CD2RxFifoCount function gets Emstat conductivity - * sensor receive fifo buffer count. - * @details \b Inputs: fpgaSensorReadings.fpgaEmstatTxFifoCount + * The getFPGARTDReadCount function gets the read count of the RTD + * temperature sensors. It covers all the four temperature sensors associates + * with conductivity sensors. + * @details \b Inputs: fpgaSensorReadings.fpgaRTDReadCnt * @details \b Outputs: none - * @return Emstat conductivity sensor receive fifo buffer count + * @return Last read count of the RTC temperature sensors *************************************************************************/ -U16 getFPGAEmstatCD1CD2RxFifoCount( void ) +U08 getFPGARTDReadCount( void ) { - return fpgaSensorReadings.fpgaCD1CD2EmstatRxFifoCount; + //return fpgaSensorReadings.fpgaRTDReadCnt; } /*********************************************************************//** * @brief - * The getFPGACP1HallSensePulseWidth function gets concentrate pump CP1 - * hall sense pulse width. - * @details \b Inputs: fpgaSensorReadings.fpgaCP1HallSense + * The getFPGATRoTemp function gets the latest redundant sensor outlet + * temperature reading in ADC. + * @details \b Inputs: fpgaSensorReadings.fpgaTRo * @details \b Outputs: none - * @return concentrate pump CP1 hall sense pulse width + * @return Last redundant sensor outlet temperature reading *************************************************************************/ -U16 getFPGACP1HallSensePulseWidth( void ) +U32 getFPGATRoTemp( void ) { - return fpgaSensorReadings.fpgaCP1HallSense; + //return fpgaSensorReadings.fpgaTRo; } /*********************************************************************//** * @brief - * The getFPGACP1HallSensePulseWidth function gets concentrate pump CP2 - * hall sense pulse width. - * @details \b Inputs: fpgaSensorReadings.fpgaCP2HallSense + * The getFPGATRoErrorCount gets the error count of the THDo (redundant) temperature sensor. + * @details \b Inputs: fpgaSensorReadings.fpgaTRoErrorCnt * @details \b Outputs: none - * @return concentrate pump CP2 hall sense pulse width + * @return Last redundant sensor outlet temperature error count *************************************************************************/ -U16 getFPGACP2HallSensePulseWidth( void ) +U08 getFPGATRoErrorCount( void ) { - return fpgaSensorReadings.fpgaCP2HallSense; + //return fpgaSensorReadings.fpgaTRoErrorCnt; } /*********************************************************************//** * @brief - * The getFPGAFan1Pulse function gets inlet fan 1 pulse value. - * @details \b Inputs: fpgaSensorReadings + * The getFPGATRoReadCount gets the read count of the THDo (redundant) temperature sensor. + * @details \b Inputs: fpgaSensorReadings.fpgaTRoReadCnt * @details \b Outputs: none - * @return inlet fan 1 pulse value + * @return Last redundant sensor outlet temperature error count reading *************************************************************************/ -U16 getFPGAInletFan1TogglePeriod( void ) +U08 getFPGATRoReadCount( void ) { - return fpgaSensorReadings.fpgaFanIn1Pulse; + //return fpgaSensorReadings.fpgaTRoReadCnt; } /*********************************************************************//** * @brief - * The getFPGAFan2Pulse function gets inlet fan 2 pulse value. - * @details \b Inputs: fpgaSensorReadings + * The getFPGATDiTemp function gets the latest dialysate inlet temperature reading in ADC. + * @details \b Inputs: fpgaSensorReadings.fpgaTDiTemp * @details \b Outputs: none - * @return inlet fan 2 pulse value + * @return last primary heater outlet temperature reading *************************************************************************/ -U16 getFPGAInletFan2TogglePeriod( void ) +U32 getFPGATDiTemp( void ) { - return fpgaSensorReadings.fpgaFanIn2Pulse; + //return fpgaSensorReadings.fpgaTDi; } /*********************************************************************//** * @brief - * The getFPGAInletFan3Pulse function gets inlet fan 3 pulse value. - * @details \b Inputs: fpgaSensorReadings + * The getFPGATDiErrorCount function gets the latest dialysate inlet temperature error count. + * @details \b Inputs: fpgaSensorReadings.fpgaTDiErrorCnt * @details \b Outputs: none - * @return inlet fan 3 pulse value + * @return Last dialysate inlet error count *************************************************************************/ -U16 getFPGAInletFan3TogglePeriod( void ) +U08 getFPGATDiErrorCount( void ) { - return fpgaSensorReadings.fpgaFanIn3Pulse; + //return fpgaSensorReadings.fpgaTDiErrorCnt; } /*********************************************************************//** * @brief - * The getFPGAOutletFan1Pulse function gets outlet fan 1 pulse value. - * @details \b Inputs: fpgaSensorReadings + * The getFPGATDiReadCount function gets the latest dialysate inlet temperature read count. + * @details \b Inputs: fpgaSensorReadings.fpgaTDiReadCnt * @details \b Outputs: none - * @return outlet fan 1 pulse value + * @return Last dialysate inlet read count *************************************************************************/ -U16 getFPGAOutletFan1TogglePeriod( void ) +U08 getFPGATDiReadCount( void ) { - return fpgaSensorReadings.fpgaFanOut1Pulse; + //return fpgaSensorReadings.fpgaTDiReadCnt; } /*********************************************************************//** * @brief - * The getFPGAOutletFan2Pulse function gets outlet fan 2 pulse value. - * @details \b Inputs: fpgaSensorReadings + * The getFPGAPrimaryHeaterTemp function gets the latest primary heater + * internal temperature reading. + * @details \b Inputs: fpgaSensorReadings.fpgaPrimaryHeaterIntTemp * @details \b Outputs: none - * @return outlet fan 2 pulse value + * @return last primary heater temperature reading *************************************************************************/ -U16 getFPGAOutletFan2TogglePeriod( void ) +U16 getFPGAPrimaryHeaterTemp( void ) { - return fpgaSensorReadings.fpgaFanOut2Pulse; + //return fpgaSensorReadings.fpgaPrimaryHeaterIntTemp; } /*********************************************************************//** * @brief - * The getFPGAOutletFan3Pulse function gets outlet fan 3 pulse value. - * @details \b Inputs: fpgaSensorReadings + * The getFPGAPrimaryHeaterFlags function gets the latest primary heater + * internal temperature sensor flags read. + * @details \b Inputs: fpgaSensorReadings.fpgaPrimaryHeaterFlags * @details \b Outputs: none - * @return outlet fan 3 pulse value + * @return Last primary heater internal temperature sensor flag read *************************************************************************/ -U16 getFPGAOutletFan3TogglePeriod( void ) +U08 getFPGAPrimaryHeaterFlags( void ) { - return fpgaSensorReadings.fpgaFanOut3Pulse; + //return fpgaSensorReadings.fpgaPrimaryHeaterFlags; } /*********************************************************************//** * @brief - * The getFPGABoardTemp function gets FPGA board temperature reading. - * @details \b Inputs: fpgaSensorReadings + * The geetFPGAPrimaryHeaterReadCount function gets the latest primary heater + * internal temperature sensor read count. + * @details \b Inputs: fpgaSensorReadings.fpgaPrimaryHeaterReadCnt * @details \b Outputs: none - * @return FPGA board temperature reading in ADC counts + * @return Last primary heater internal temperature sensor read count *************************************************************************/ -U16 getFPGABoardTemp( void ) +U08 getFPGAPrimaryHeaterReadCount( void ) { - return fpgaSensorReadings.fpgaADCTemp; + //return fpgaSensorReadings.fpgaPrimaryHeaterReadCnt; } /*********************************************************************//** * @brief - * The getFPGAA1B1Temp function gets load cells A1/B1 temperature reading. - * @details \b Inputs: fpgaSensorReadings + * The getFPGATrimmerHeaterTemp function gets the latest trimmer heater + * internal temperature sensor reading. + * @details \b Inputs: fpgaSensorReadings.fpgaTrimmerHeaterIntTemp * @details \b Outputs: none - * @return load cells A1/B1 temperature reading in ADC counts + * @return last trimmer heater temperature reading *************************************************************************/ -U32 getFPGALoadCellsA1B1Temp( void ) +U16 getFPGATrimmerHeaterTemp( void ) { - return fpgaSensorReadings.fpgaADC1Temp; + //return fpgaSensorReadings.fpgaTrimmerHeaterIntTemp; } /*********************************************************************//** * @brief - * The getFPGAA1B1Temp function gets load cells A2/B2 temperature reading. + * The getFPGATrimmerHeaterFlags function gets the latest trimmer heater + * internal temperature flags read. + * @details \b Inputs: fpgaSensorReadings.fpgaTrimmerHeaterFlags + * @details \b Outputs: none + * @return Last trimmer heater internal temperature flags read + *************************************************************************/ +U08 getFPGATrimmerHeaterFlags( void ) +{ + // return fpgaSensorReadings.fpgaTrimmerHeaterFlags; +} + +/*********************************************************************//** + * @brief + * The getFPGATrimmerHeaterReadCount function gets the latest trimmer heater + * internal temperature read count. + * @details \b Inputs: fpgaSensorReadings.fpgaTrimmerHeaterReadCnt + * @details \b Outputs: none + * @return Last trimmer heater internal temperature read count + *************************************************************************/ +U08 getFPGATrimmerHeaterReadCount( void ) +{ + // return fpgaSensorReadings.fpgaTrimmerHeaterReadCnt; +} + +/*********************************************************************//** + * @brief + * The getFPGAPrimaryColdJunctionTemp function gets primary cold junction temperature. + * @details \b Inputs: fpgaSensorReadings.fpgaPrimaryHeaterIntJunctionTemp + * @details \b Outputs: none + * @return Last primary cold junction temperature + *************************************************************************/ +U16 getFPGAPrimaryColdJunctionTemp( void ) +{ + // return fpgaSensorReadings.fpgaPrimaryHeaterIntJunctionTemp; +} + +/*********************************************************************//** + * @brief + * The getFPGATrimmerColdJunctionTemp function gets trimmer cold junction temperature. + * @details \b Inputs: fpgaSensorReadings.fpgaTrimmerHeaterIntJunctionTemp + * @details \b Outputs: none + * @return Last trimmer cold junction temperature + *************************************************************************/ +U16 getFPGATrimmerColdJunctionTemp( void ) +{ + // return fpgaSensorReadings.fpgaTrimmerHeaterIntJunctionTemp; +} + +/*********************************************************************//** + * @brief + * The getFPGAConcentratePumpsFault function gets concentrate pumps fault + * reported by FGPA. + * @details \b Inputs: fpgaSensorReadings.fpgaCP1CP2Fault + * @details \b Outputs: none + * @return Latest concentrate pumps fault value + *************************************************************************/ +U08 getFPGAConcentratePumpsFault( void ) +{ + //return fpgaSensorReadings.fpgaCP1CP2Fault & FPGA_CONC_PUMP_FAULT_BITS; +} + +/*********************************************************************//** + * @brief + * The getFPGAAcidPumpIsParked function gets whether the acid pump is currently + * parked. + * @details \b Inputs: fpgaSensorReadings.fpgaCP1CP2Fault + * @details \b Outputs: none + * @return TRUE if acid pump is parked, FALSE if not + *************************************************************************/ +//BOOL getFPGAAcidPumpIsParked( void ) +//{ +// U08 mask = fpgaSensorReadings.fpgaCP1CP2Fault & FPGA_CP1_PARKED_BIT; +// BOOL result = ( mask > 0 ? TRUE : FALSE ); +// +// return result ; +//} + +/*********************************************************************//** + * @brief + * The getFPGABicarbPumpIsParked function gets whether the bicarb pump is currently + * parked. + * @details \b Inputs: fpgaSensorReadings.fpgaCP1CP2Fault + * @details \b Outputs: none + * @return TRUE if bicarb pump is parked, FALSE if not + *************************************************************************/ +//BOOL getFPGABicarbPumpIsParked( void ) +//{ +// U08 mask = fpgaSensorReadings.fpgaCP1CP2Fault & FPGA_CP2_PARKED_BIT; +// BOOL result = ( mask > 0 ? TRUE : FALSE ); +// +// return result ; +//} + +/*********************************************************************//** + * @brief + * The getFPGAAcidPumpParkFault function gets whether the acid pump park command + * has faulted. + * @details \b Inputs: fpgaSensorReadings.fpgaCP1CP2Fault + * @details \b Outputs: none + * @return TRUE if acid pump park command faulted, FALSE if not + *************************************************************************/ +//BOOL getFPGAAcidPumpParkFault( void ) +//{ +// U08 mask = fpgaSensorReadings.fpgaCP1CP2Fault & FPGA_CP1_PARK_FAULT_BIT; +// BOOL result = ( mask > 0 ? TRUE : FALSE ); +// +// return result ; +//} + +/*********************************************************************//** + * @brief + * The getFPGABicarbPumpParkFault function gets whether the bicarb pump park command + * has faulted. + * @details \b Inputs: fpgaSensorReadings.fpgaCP1CP2Fault + * @details \b Outputs: none + * @return TRUE if bicarb pump park command faulted, FALSE if not + *************************************************************************/ +//BOOL getFPGABicarbPumpParkFault( void ) +//{ +// U08 mask = fpgaSensorReadings.fpgaCP1CP2Fault & FPGA_CP2_PARK_FAULT_BIT; +// BOOL result = ( mask > 0 ? TRUE : FALSE ); +// +// return result ; +//} + +/*********************************************************************//** + * @brief + * The getFPGACP1HallSensePulseWidth function gets concentrate pump CP1 + * hall sense pulse width. + * @details \b Inputs: fpgaSensorReadings.fpgaCP1HallSense + * @details \b Outputs: none + * @return concentrate pump CP1 hall sense pulse width + *************************************************************************/ +U16 getFPGACP1HallSensePulseWidth( void ) +{ + //return fpgaSensorReadings.fpgaCP1HallSense; +} + +/*********************************************************************//** + * @brief + * The getFPGACP1HallSensePulseWidth function gets concentrate pump CP2 + * hall sense pulse width. + * @details \b Inputs: fpgaSensorReadings.fpgaCP2HallSense + * @details \b Outputs: none + * @return concentrate pump CP2 hall sense pulse width + *************************************************************************/ +U16 getFPGACP2HallSensePulseWidth( void ) +{ + //return fpgaSensorReadings.fpgaCP2HallSense; +} + +/*********************************************************************//** + * @brief + * The getFPGABoardTemp function gets FPGA board temperature reading. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none - * @return load cells A2/B2 temperature reading in ADC counts + * @return FPGA board temperature reading in ADC counts *************************************************************************/ -U32 getFPGALoadCellsA2B2Temp( void ) +U16 getFPGABoardTemp( void ) { - return fpgaSensorReadings.fpgaADC2Temp; + //return fpgaSensorReadings.fpgaADCTemp; } /*********************************************************************//** @@ -1461,7 +1828,7 @@ *************************************************************************/ U32 getFPGATRoInternalTemp( void ) { - return fpgaSensorReadings.fpgaTRoTemp; + //return fpgaSensorReadings.fpgaTRoTemp; } /*********************************************************************//** @@ -1473,7 +1840,7 @@ *************************************************************************/ U32 getFPGATDiInternalTemp( void ) { - return fpgaSensorReadings.fpgaTDiTemp; + //return fpgaSensorReadings.fpgaTDiTemp; } /*********************************************************************//** @@ -1486,7 +1853,7 @@ *************************************************************************/ U32 getFPGACondSnsrInternalTemp( void ) { - return fpgaSensorReadings.fpgaRTDTemp; + //return fpgaSensorReadings.fpgaRTDTemp; } /*********************************************************************//** @@ -1498,7 +1865,7 @@ *************************************************************************/ U08 getFPGAADC1ReadCount( void ) { - return fpgaSensorReadings.fpgaADC1ReadCnt; + //return fpgaSensorReadings.fpgaADC1ReadCnt; } /*********************************************************************//** @@ -1510,7 +1877,7 @@ *************************************************************************/ U08 getFPGAADC1ErrorCount( void ) { - return fpgaSensorReadings.fpgaADC1ErrorCnt; + //return fpgaSensorReadings.fpgaADC1ErrorCnt; } /*********************************************************************//** @@ -1522,7 +1889,7 @@ *************************************************************************/ U08 getFPGAADC2ReadCount( void ) { - return fpgaSensorReadings.fpgaADC2ReadCnt; + //return fpgaSensorReadings.fpgaADC2ReadCnt; } /*********************************************************************//** @@ -1534,23 +1901,11 @@ *************************************************************************/ U08 getFPGAADC2ErrorCount( void ) { - return fpgaSensorReadings.fpgaADC2ErrorCnt; + //return fpgaSensorReadings.fpgaADC2ErrorCnt; } /*********************************************************************//** * @brief - * The getFPGATimerCount function gets the latest FPGA timer millisecond count. - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return last FPGA timer count - *************************************************************************/ -U16 getFPGATimerCount( void ) -{ - return fpgaSensorReadings.fpgaTimerCountMS; -} - -/*********************************************************************//** - * @brief * The noFluidLeakDetected function returns TRUE if no fluid leak has been * detected (dry) and FALSE if a fluid leak has been detected (wet). * @details \b Inputs: fpgaSensorReadings @@ -1559,9 +1914,10 @@ *************************************************************************/ BOOL noFPGAFluidLeakDetected( void ) { - U16 noFluidLeakDetected = fpgaSensorReadings.fpgaGPIO & FPGA_FLUIDLEAK_STATE_MASK; + //U16 noFluidLeakDetected = fpgaSensorReadings.fpgaGPIO & FPGA_FLUIDLEAK_STATE_MASK; - return ( 0 == noFluidLeakDetected ? FALSE : TRUE ); + //return ( 0 == noFluidLeakDetected ? FALSE : TRUE ); + return 0; } /*********************************************************************//** @@ -1574,7 +1930,7 @@ *************************************************************************/ U08 getFPGADialysateCapStatus( void ) { - return ( fpgaSensorReadings.fpgaGPIO & DIALYSATE_CAP_SWITCH_MASK ); + //return ( fpgaSensorReadings.fpgaGPIO & DIALYSATE_CAP_SWITCH_MASK ); } /*********************************************************************//** @@ -1587,7 +1943,7 @@ *************************************************************************/ U08 getFPGAConcentrateCapStatus( void ) { - return ( fpgaSensorReadings.fpgaGPIO & CONCENTRATE_CAP_SWITCH_MASK ); + //return ( fpgaSensorReadings.fpgaGPIO & CONCENTRATE_CAP_SWITCH_MASK ); } /*********************************************************************//** @@ -1599,7 +1955,7 @@ *************************************************************************/ U16 getFPGAInternalVccVoltage( void ) { - return fpgaSensorReadings.fpgaADCVccInt; + //return fpgaSensorReadings.fpgaADCVccInt; } /*********************************************************************//** @@ -1612,7 +1968,7 @@ *************************************************************************/ U16 getFPGAInternalVccAuxiliaryVoltage( void ) { - return fpgaSensorReadings.fpgaADCVccAux; + //return fpgaSensorReadings.fpgaADCVccAux; } /*********************************************************************//** @@ -1624,7 +1980,7 @@ *************************************************************************/ U16 getFPGAVPVNVoltage( void ) { - return fpgaSensorReadings.fpgaADCVPVN; + //return fpgaSensorReadings.fpgaADCVPVN; } #ifndef _RELEASE_ @@ -1653,7 +2009,7 @@ *************************************************************************/ U08 getFPGABaroReadCount( void ) { - return fpgaSensorReadings.fpgaBaroReadCount; + //return fpgaSensorReadings.fpgaBaroReadCount; } /*********************************************************************//** @@ -1665,7 +2021,7 @@ *************************************************************************/ U08 getFPGABaroErrorCount( void ) { - return fpgaSensorReadings.fpgaBaroErrorCount; + //return fpgaSensorReadings.fpgaBaroErrorCount; } /*********************************************************************//** @@ -1678,7 +2034,7 @@ *************************************************************************/ U16 getFPGABaroMfgInfo( void ) { - return fpgaSensorReadings.fpgaBaroManufacInfo; + //return fpgaSensorReadings.fpgaBaroManufacInfo; } /*********************************************************************//** @@ -1691,7 +2047,7 @@ *************************************************************************/ U16 getFPGABaroPressureSensitivity( void ) { - return fpgaSensorReadings.fpgaBaroPROMCoeff1; + //return fpgaSensorReadings.fpgaBaroPROMCoeff1; } /*********************************************************************//** @@ -1704,7 +2060,7 @@ *************************************************************************/ U16 getFPGABaroPressureOffset( void ) { - return fpgaSensorReadings.fpgaBaroPROMCoeff2; + //return fpgaSensorReadings.fpgaBaroPROMCoeff2; } /*********************************************************************//** @@ -1717,7 +2073,7 @@ *************************************************************************/ U16 getFPGABaroTempCoeffOfPressSensitvity( void ) { - return fpgaSensorReadings.fpgaBaroPROMCoeff3; + //return fpgaSensorReadings.fpgaBaroPROMCoeff3; } /*********************************************************************//** @@ -1730,7 +2086,7 @@ *************************************************************************/ U16 getFPGABaroTempCoeffOfPressOffset( void ) { - return fpgaSensorReadings.fpgaBaroPROMCoeff4; + //return fpgaSensorReadings.fpgaBaroPROMCoeff4; } /*********************************************************************//** @@ -1743,7 +2099,7 @@ *************************************************************************/ U16 getFPGABaroReferenceTemperature( void ) { - return fpgaSensorReadings.fpgaBaroPROMCoeff5; + //return fpgaSensorReadings.fpgaBaroPROMCoeff5; } /*********************************************************************//** @@ -1756,7 +2112,7 @@ *************************************************************************/ U16 getFPGABaroTempCoeffOfTemperature( void ) { - return fpgaSensorReadings.fpgaBaroPROMCoeff6; + //return fpgaSensorReadings.fpgaBaroPROMCoeff6; } /*********************************************************************//** @@ -1769,7 +2125,7 @@ *************************************************************************/ U16 getFPGABaroCoeffsCRC( void ) { - return fpgaSensorReadings.fpgaBaroPROMCRC; + //return fpgaSensorReadings.fpgaBaroPROMCRC; } /*********************************************************************//** @@ -1782,7 +2138,7 @@ *************************************************************************/ U32 getFPGABaroPressure( void ) { - return ( fpgaSensorReadings.fpgaBaroPressure & MASK_OFF_U32_MSB ); + //return ( fpgaSensorReadings.fpgaBaroPressure & MASK_OFF_U32_MSB ); } /*********************************************************************//** @@ -1795,58 +2151,19 @@ *************************************************************************/ U32 getFPGABaroTemperature( void ) { - return ( fpgaSensorReadings.fpgaBaroTemperature & MASK_OFF_U32_MSB ); + //return ( fpgaSensorReadings.fpgaBaroTemperature & MASK_OFF_U32_MSB ); } /*********************************************************************//** * @brief - * The getFPGAEmstatCPiCPoByteOut function gets the FPGA Emstat CPi/CPo - * byte out data. - * @details \b Inputs: fpgaSensorReadings.fpgaCPiCPoEmstatOutByte - * @details \b Outputs: none - * @return CPi/CPo Emstat byte out - *************************************************************************/ -U08 getFPGAEmstatCPiCPoByteOut( void ) -{ - return fpgaSensorReadings.fpgaCPiCPoEmstatOutByte; -} - -/*********************************************************************//** - * @brief - * The getFPGAEmstatCPiCPoRxFifoCount function gets the FPGA Emstat CPi/CPo - * receive FIFO count. - * @details \b Inputs: fpgaSensorReadings.fpgaCD1CD2EmstatRxFifoCount - * @details \b Outputs: none - * @return CPi/CPo Rx FIFO count - *************************************************************************/ -U16 getFPGAEmstatCPiCPoRxFifoCount( void ) -{ - return fpgaSensorReadings.fpgaCPiCPoEmstatRxFIFOCount; -} - -/*********************************************************************//** - * @brief - * The getFPGAEmstatCPiCPoRxErrCount function gets the FPGA Emstat CPi/CPo - * receive FIFO error count. - * @details \b Inputs: fpgaSensorReadings.fpgaCD1CD2EmstatRxErrorCount - * @details \b Outputs: none - * @return CPi/CPo Rx FIFO error count - *************************************************************************/ -U08 getFPGAEmstatCPiCPoRxErrCount( void ) -{ - return fpgaSensorReadings.fpgaCPiCPoEmstatRxErrCount; -} - -/*********************************************************************//** - * @brief * The getFPGATHdTemp function gets the FPGA THd temperature sensor. * @details \b Inputs: fpgaSensorReadings.fpgaTHdTemp * @details \b Outputs: none * @return THd temperature sensor *************************************************************************/ U32 getFPGATHdTemp( void ) { - return fpgaSensorReadings.fpgaTHdTemp; + //return fpgaSensorReadings.fpgaTHdTemp; } /*********************************************************************//** @@ -1858,7 +2175,7 @@ *************************************************************************/ U32 getFPGATHdInternalTemp( void ) { - return fpgaSensorReadings.fpgaTHdInternalTemp; + //return fpgaSensorReadings.fpgaTHdInternalTemp; } /*********************************************************************//** @@ -1871,7 +2188,7 @@ *************************************************************************/ U08 getFPGATHdReadCount( void ) { - return fpgaSensorReadings.fpgaTHdRTDReadCount; + //return fpgaSensorReadings.fpgaTHdRTDReadCount; } /*********************************************************************//** @@ -1884,45 +2201,19 @@ *************************************************************************/ U08 getFPGATHdErrorCount( void ) { - return fpgaSensorReadings.fpgaTHdRTDErrorCount; + //return fpgaSensorReadings.fpgaTHdRTDErrorCount; } /*********************************************************************//** * @brief - * The getFPGAROFlowSensorEdgeCount function gets the FPGA RO flow sensor - * edge count. - * @details \b Inputs: fpgaSensorReadings.fpgaROFlowSensorEdgeCount - * @details \b Outputs: none - * @return RO flow sensor edge count - *************************************************************************/ -U16 getFPGAROFlowSensorEdgeCount( void ) -{ - return fpgaSensorReadings.fpgaROFlowSensorEdgeCount; -} - -/*********************************************************************//** - * @brief - * The getFPGADialysateFlowSensorEdgeCount function gets the FPGA dialysate - * flow sensor edge count - * @details \b Inputs: fpgaSensorReadings.fpgaDialysateFlowSensorEdgeCount - * @details \b Outputs: none - * @return Dialysate flow sensor edge count - *************************************************************************/ -U16 getFPGADialysateFlowSensorEdgeCount( void ) -{ - return fpgaSensorReadings.fpgaDialysateFlowSensorEdgeCount; -} - -/*********************************************************************//** - * @brief * The getFPGAHeaterGateADC function gets Heater Gate ADC value. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return heater gate adc value *************************************************************************/ U16 getFPGAHeaterGateADC( void ) { - return fpgaSensorReadings.fpgaHeaterGateADC; + //return fpgaSensorReadings.fpgaHeaterGateADC; } /*********************************************************************//** @@ -1934,7 +2225,7 @@ *************************************************************************/ U16 getFPGAHeaterGndADC( void ) { - return fpgaSensorReadings.fpgaHeaterGNDADC; + //return fpgaSensorReadings.fpgaHeaterGNDADC; } /*********************************************************************//** @@ -1947,7 +2238,7 @@ *************************************************************************/ U08 getFPGAHeaterGateADCReadCount( void ) { - return fpgaSensorReadings.fpgaHeater1ADCReadCount; + //return fpgaSensorReadings.fpgaHeater1ADCReadCount; } /*********************************************************************//** @@ -1960,7 +2251,7 @@ *************************************************************************/ U08 getFPGAHeaterGateADCErrorCount( void ) { - return fpgaSensorReadings.fpgaHeater1ADCErrorCount; + //return fpgaSensorReadings.fpgaHeater1ADCErrorCount; } /*********************************************************************//** @@ -1973,7 +2264,7 @@ *************************************************************************/ U16 getFPGADrainPumpCurrentFeedback( void ) { - return fpgaSensorReadings.fpgaDrainPumpCurrentFeedback; + //return fpgaSensorReadings.fpgaDrainPumpCurrentFeedback; } /*********************************************************************//** @@ -1986,7 +2277,7 @@ *************************************************************************/ U16 getFPGADrainPumpSpeedFeedback( void ) { - return fpgaSensorReadings.fpgaDrainPumpSpeedFeedback; + //return fpgaSensorReadings.fpgaDrainPumpSpeedFeedback; } /*********************************************************************//** @@ -1998,7 +2289,7 @@ *************************************************************************/ U08 getFPGADrainPumpDirection( void ) { - return fpgaSensorReadings.fpgaDrainPumpDirection; + //return fpgaSensorReadings.fpgaDrainPumpDirection; } /*********************************************************************//** @@ -2011,7 +2302,7 @@ *************************************************************************/ U16 getFPGAOnBoardThermistorCount( void ) { - return fpgaSensorReadings.fpgaOnBoardThermistor; + //return fpgaSensorReadings.fpgaOnBoardThermistor; } /*********************************************************************//** @@ -2025,8 +2316,9 @@ *************************************************************************/ U16 getFPGAPowerSupply2ThermistorCount( void ) { - return fpgaSensorReadings.fpgaPowerSupply2; + //return fpgaSensorReadings.fpgaPowerSupply2; } +#endif /*********************************************************************//** * @brief Index: firmware/App/Services/FPGADD.h =================================================================== diff -u -rcd3af1ebb7396ba3b2bec1d779510d29c30014f4 -r08bb699be47b9b04c9d4885b7f1b9349b5a4b1e9 --- firmware/App/Services/FPGADD.h (.../FPGADD.h) (revision cd3af1ebb7396ba3b2bec1d779510d29c30014f4) +++ firmware/App/Services/FPGADD.h (.../FPGADD.h) (revision 08bb699be47b9b04c9d4885b7f1b9349b5a4b1e9) @@ -41,33 +41,103 @@ void checkFPGACommFailure( void ); BOOL checkFPGAFEOEFailure( void ); +//Set FPGA functions void setFPGAValveStates( U16 valveStates ); -void setFPGADrainPumpSpeed( U08 drainPumpDAC ); -void setFPGACPoProbeType( U16 probeType ); -void setFPGACPiProbeType( U16 probeType ); -void setFPGAV3AcidPumpControl( U08 pumpControl ); -void setFPGAV3BicarbPumpControl( U08 pumpControl ); -void setFPGAV3AcidPumpParkCmd( void ); -void setFPGAV3BicarbPumpParkCmd( void ); +void setFPGABCValveStates( U08 valveStates ); +void setFPGAUFValveStates( U08 valveStates ); + +void setFPGACD12Control( U08 control ); +void setFPGACD34Control( U08 control ); +void setFPGACD12Address( U16 address ); +void setFPGACD34Address( U16 address ); +void setFPGACD12Data( U16 data ); +void setFPGACD34Data( U16 data ); + void setFPGAAcidPumpSetStepSpeed( U16 stepSpeed ); void setFPGABicarbSetStepSpeed( U16 stepSpeed ); +void setFPGADialysateOutPumpSpeed( U16 speed ); +void setFPGADialysateOutPumpControl( U08 control ); +void setFPGADialysateInPumpControl( U08 control ); +void setFPGAAcidPumpControl( U08 control ); +void setFPGABicarbPumpControl( U08 control ); + +// Get FPGA functions void getFPGAVersions( U08 *Id, U08 *Maj, U08 *Min, U08 *Lab ); U16 getFPGAValveStates( void ); -U16 getFPGAROPumpFlowRate( void ); -U16 getFPGADialysateFlowRate( void ); -U16 getFPGADrainPumpSpeed( void ); -U32 getFPGALoadCellA1( void ); -U32 getFPGALoadCellA2( void ); -U32 getFPGALoadCellB1( void ); -U32 getFPGALoadCellB2( void ); -U32 getFPGATPiTemp( void ); -U32 getFPGATPoTemp( void ); +U16 getFPGALevelSensor1( void ); +U16 getFPGALevelSensor2( void ); -U32 getFPGACD1Temp( void ); -U32 getFPGACD2Temp( void ); +U08 getFPGACD1ReadCount( void ); +U08 getFPGACD1ErrorCount( void ); +U16 getFPGACD1( void ); +U16 getFPGACD1Temp( void ); +U16 getFPGACD1Data( void ); +U08 getFPGACD2ReadCount( void ); +U08 getFPGACD2ErrorCount( void ); +U16 getFPGACD2( void ); +U16 getFPGACD2Temp( void ); +U16 getFPGACD2Data( void ); + +U08 getFPGACD3ReadCount( void ); +U08 getFPGACD3ErrorCount( void ); +U16 getFPGACD3( void ); +U16 getFPGACD3Temp( void ); +U16 getFPGACD3Data( void ); + +U08 getFPGACD4ReadCount( void ); +U08 getFPGACD4ErrorCount( void ); +U16 getFPGACD4( void ); +U16 getFPGACD4Temp( void ); +U16 getFPGACD4Data( void ); + +U08 getFPGAPnReadCount( void ); +U08 getFPGAPnErrorCount( void ); +U32 getFPGAPnRawPressure( void ); +U32 getFPGAPnRawTemperature( void ); + +U08 getFPGAPCbReadCount( void ); +U08 getFPGAPCbErrorCount( void ); +U32 getFPGAPCbRawPressure( void ); +U32 getFPGAPCbRawTemperature( void ); + +U08 getFPGAPDsReadCount( void ); +U08 getFPGAPDsErrorCount( void ); +U32 getFPGAPDsRawPressure( void ); +U32 getFPGAPDsRawTemperature( void ); + +U08 getFPGAPDfReadCount( void ); +U08 getFPGAPDfErrorCount( void ); +U32 getFPGAPDfRawPressure( void ); +U32 getFPGAPDfRawTemperature( void ); + +U08 getFPGADialysateOutPumpControl( void ); +U08 getFPGADialysateInPumpControl( void ); + +U08 getFPGAPtmReadCount( void ); +U08 getFPGAPtmErrorCount( void ); +U32 getFPGAPtmRawPressure( void ); +U32 getFPGAPtmRawTemperature( void ); + +U16 getFPGATimerCount( void ); + +//===================================================== +// ToDo : clean up required on following set functions +//===================================================== +void setFPGADrainPumpSpeed( U08 drainPumpDAC ); +void setFPGACPoProbeType( U16 probeType ); +void setFPGACPiProbeType( U16 probeType ); +void setFPGAAcidPumpParkCmd( void ); +void setFPGABicarbPumpParkCmd( void ); +//====================================================== + +//==================================================== +//Todo : Following get functions need clean up +//==================================================== +U16 getFPGADrainPumpSpeed( void ); + U08 getFPGARTDErrorCount( void ); U08 getFPGARTDReadCount( void ); @@ -90,43 +160,16 @@ U16 getFPGAPrimaryColdJunctionTemp( void ); U16 getFPGATrimmerColdJunctionTemp( void ); -U08 getFPGACPiFault( void ); -U08 getFPGACPiReadCount( void ); -U08 getFPGACPiErrorCount( void ); -U32 getFPGACPi( void ); - -U08 getFPGACPoFault( void ); -U08 getFPGACPoReadCount( void ); -U08 getFPGACPoErrorCount( void ); -U32 getFPGACPo( void ); - U08 getFPGAConcentratePumpsFault( void ); BOOL getFPGAAcidPumpIsParked( void ); BOOL getFPGABicarbPumpIsParked( void ); BOOL getFPGAAcidPumpParkFault( void ); BOOL getFPGABicarbPumpParkFault( void ); -U08 getFPGAEmstatCD1CD2OutByte( void ); -U08 getFPGAEmstatCD1CD2RxErrCount( void ); -U16 getFPGAEmstatCD1CD2RxFifoCount( void ); - U16 getFPGACP1HallSensePulseWidth( void ); U16 getFPGACP2HallSensePulseWidth( void ); -void getFPGAAccelAxes( S16 *x, S16 *y, S16 *z ); -void getFPGAAccelMaxes( S16 *xm, S16*ym, S16*zm ); -void getFPGAAccelStatus( U16 *cnt, U16 *accelFPGAFaultReg ); - -U16 getFPGAInletFan1TogglePeriod( void ); -U16 getFPGAInletFan2TogglePeriod( void ); -U16 getFPGAInletFan3TogglePeriod( void ); -U16 getFPGAOutletFan1TogglePeriod( void ); -U16 getFPGAOutletFan2TogglePeriod( void ); -U16 getFPGAOutletFan3TogglePeriod( void ); - U16 getFPGABoardTemp( void ); -U32 getFPGALoadCellsA1B1Temp( void ); -U32 getFPGALoadCellsA2B2Temp( void ); U32 getFPGATRoInternalTemp( void ); U32 getFPGATDiInternalTemp( void ); U32 getFPGACondSnsrInternalTemp( void ); @@ -139,28 +182,13 @@ BOOL noFPGAFluidLeakDetected( void ); -U16 getFPGATimerCount( void ); - U08 getFPGADialysateCapStatus( void ); U08 getFPGAConcentrateCapStatus( void ); U16 getFPGAInternalVccVoltage( void ); U16 getFPGAInternalVccAuxiliaryVoltage( void ); U16 getFPGAVPVNVoltage( void ); -//#ifndef _RELEASE_ -//HARDWARE_CONFIG_T getHardwareConfigStatus( void ); -//#endif - -//***************** DVT Functions ***************************/ - -void setFPGAAcidPumpControl( U08 control ); -U08 getFPGAAcidPumpControlStatus( void ); -void setFPGABicarbPumpControl( U08 control ); -U08 getFPGABicarbPumpControlStatus( void ); -void setFPGAAcidPumpParkCmd( void ); -void setFPGABicarbPumpParkCmd( void ); - U08 getFPGABaroReadCount( void ); U08 getFPGABaroErrorCount( void ); U16 getFPGABaroMfgInfo( void ); @@ -174,18 +202,11 @@ U32 getFPGABaroPressure( void ); U32 getFPGABaroTemperature( void ); -U08 getFPGAEmstatCPiCPoByteOut( void ); -U16 getFPGAEmstatCPiCPoRxFifoCount( void ); -U08 getFPGAEmstatCPiCPoRxErrCount( void ); - U32 getFPGATHdTemp( void ); U32 getFPGATHdInternalTemp( void ); U08 getFPGATHdReadCount( void ); U08 getFPGATHdErrorCount( void ); -U16 getFPGAROFlowSensorEdgeCount( void ); -U16 getFPGADialysateFlowSensorEdgeCount( void ); - U16 getFPGAHeaterGateADC( void ); U16 getFPGAHeaterGndADC( void ); U08 getFPGAHeaterGateADCReadCount( void ); @@ -197,7 +218,9 @@ U16 getFPGAOnBoardThermistorCount( void ); U16 getFPGAPowerSupply2ThermistorCount( void ); +//==================================================== + /**@}*/ #endif