/************************************************************************** * * Copyright (c) 2024-2024 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file FpgaDD.c * * @author (last) Vinayakam Mani * @date (last) 05-Aug-2024 * * @author (original) Vinayakam Mani * @date (original) 05-Aug-2024 * ***************************************************************************/ #include "string.h" // for memset(), memcpy() #include "gio.h" // hal headers #include "sci.h" #include "sys_dma.h" #include "Comm.h" #include "Compatible.h" #include "FPGA.h" #include "Messaging.h" #include "OperationModes.h" #include "PersistentAlarm.h" #include "Timers.h" #include "Utilities.h" /** * @addtogroup FpgaDD * @{ */ // ********** private definitions ********** #define FPGA_EXPECTED_ID 0x02 ///< FPGA expected ID. #define MAX_COMM_ERROR_RETRIES 5 ///< Maximum number of communication error retries //TODO : Define the default values for the Valves ( 0: Deenergized, 1 : Energized) on power up. #define FPGA_ENABLE_VALVES_CONTROL 0x0000 ///< FPGA enable valves control. #define FPGA_ENABLE_BC_VALVES_CONTROL 0x00 ///< FPGA enable Balancing chamber valves control. #define FPGA_ENABLE_UF_VALVES_CONTROL 0x00 ///< FPGA enable Balancing Chamber valves control. #define FPGA_D17_RESET_BIT 0x01 ///< Conductivity Sensor D17 reset bit mask. #define FPGA_D17_INIT_ENABLE_BIT 0x02 ///< Conductivity Sensor D17 Initialization enable bit mask. #define FPGA_D17_WR_ENABLE_BIT 0x04 ///< Conductivity Sensor D17 write enable bit mask. #define FPGA_D17_RD_ENABLE_BIT 0x08 ///< Conductivity Sensor D17 read enable bit mask. #define FPGA_D27_RESET_BIT 0x10 ///< Conductivity Sensor D27 reset bit mask. #define FPGA_D27_INIT_ENABLE_BIT 0x20 ///< Conductivity Sensor D27 Initialization enable bit mask. #define FPGA_D27_WR_ENABLE_BIT 0x40 ///< Conductivity Sensor D27 write enable bit mask. #define FPGA_D27_RD_ENABLE_BIT 0x80 ///< Conductivity Sensor D27 read enable bit mask. #define FPGA_D29_RESET_BIT 0x01 ///< Conductivity Sensor D29 reset bit mask. #define FPGA_D29_INIT_ENABLE_BIT 0x02 ///< Conductivity Sensor D29 Initialization enable bit mask. #define FPGA_D29_WR_ENABLE_BIT 0x04 ///< Conductivity Sensor D29 write enable bit mask. #define FPGA_D29_RD_ENABLE_BIT 0x08 ///< Conductivity Sensor D29 read enable bit mask. #define FPGA_D43_RESET_BIT 0x10 ///< Conductivity Sensor D43 reset bit mask. #define FPGA_D43_INIT_ENABLE_BIT 0x20 ///< Conductivity Sensor D43 Initialization enable bit mask. #define FPGA_D43_WR_ENABLE_BIT 0x40 ///< Conductivity Sensor D43 write enable bit mask. #define FPGA_D43_RD_ENABLE_BIT 0x80 ///< Conductivity Sensor D43 read enable bit mask. #define FPGA_D74_RESET_BIT 0x01 ///< Conductivity Sensor D74 reset bit mask. #define FPGA_D74_INIT_ENABLE_BIT 0x02 ///< Conductivity Sensor D74 Initialization enable bit mask. #define FPGA_D74_WR_ENABLE_BIT 0x04 ///< Conductivity Sensor D74 write enable bit mask. #define FPGA_D74_RD_ENABLE_BIT 0x08 ///< Conductivity Sensor D74 read enable bit mask. // Assuming all valves are ON/OFF based control ( No PWM control used) #define FPGA_ENABLE_VALVES_PWM 0x0000 ///< FPGA enable valves PWM. #define FPGA_ENABLE_BC_VALVES_PWM 0x00 ///< FPGA enable Balancing chamber valves PWM. #define FPGA_ENABLE_UF_VALVES_PWM 0x00 ///< FPGA enable Ultrafiltration valves PWM. #define FPGA_ADC_AUTO_READ_ENABLE 0x11 ///< FPGA internal ADC auto read enable. #define CONCENTRATE_CAP_SWITCH_MASK 0x10 ///< Concentrate cap switch bit mask. #define FPGA_CONC_PUMP_FAULT_BITS 0x03 ///< Concentrate pump fault bits mask. #define FPGA_D11_PUMP_PARKED_BIT 0x04 ///< Acid Concentrate pump parked status bit mask. #define FPGA_D10_PUMP_PARKED_BIT 0x10 ///< Bicarb Concentrate pump parked status bit mask. #define FPGA_D11_PUMP_PARK_FAULT_BIT 0x08 ///< Acid Concentrate pump park fault status bit mask. #define FPGA_D10_PUMP_PARK_FAULT_BIT 0x20 ///< Bicarb Concentrate pump park fault status bit mask. #define FPGA_CONC_PUMP_PARK_COMMAND 0x80 ///< Park command bit for the concentrate pumps. #define FPGA_THD_CONTROL_COMMAND 0X01 ///< FPGA THd control command. #define FPGA_POWER_OUT_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< FPGA power out timeout in milliseconds. #define FPGA_GPIO_POWER_STATUS_PIN 7 ///< FPGA GPIO power status pin. #define FPGA_READ_V3_START_BYTE_NUM 256 ///< FPGA V3 read sensors start byte number. #define FPGA_READ_V3_END_BYTE_NUM 430 ///< FPGA V3 read sensors end byte number. #define FPGA_D12_PUMP_ERROR_BIT 0x01 ///< Fresh dialysate pump error bit mask. #define FPGA_D48_PUMP_ERROR_BIT 0x02 ///< Spent dialysate pump error bit mask. #define FPGA_D6_FLOATER_LEVEL_BIT 0x03 ///< Floater level bit mask. #define FPGA_D5_HEATER_CNTRL_BIT 0x01 ///< FPGA GIO D5 heater control bit mask #define FPGA_D5_HEATER_PWM_ENABLE_BIT 0x02 ///< FPGA D5 PWM based heater control bit mask /// FPGA size of V3 read bytes. #define FPGA_SIZE_OF_V3_READ_BYTES ( FPGA_READ_V3_END_BYTE_NUM - FPGA_READ_V3_START_BYTE_NUM ) #define PROCESSOR_FPGA_CLOCK_DIFF_TOLERANCE 1 ///< Tolerance for processor clock speed check against FPGA clock. #define MAX_FPGA_COMM_FAILURES_WINDOW_MS ( 1 * SEC_PER_MIN * MS_PER_SECOND ) ///< FPGA comm failures window #define MAX_FPGA_COMM_FAILURES 3 ///< FPGA maximum comm failures per MAX_FPGA_COMM_FAILURES_WINDOW_MS #define MIN_POWER_ON_TIME_FOR_COMM_FAILS ( 1 * MS_PER_SECOND ) ///< Allow FPGA comm errors for first second after power-up #pragma pack(push,1) /// FPGA header struct. typedef struct { U08 fpgaId; ///< Reg 0. FPGA ID code. Checked against expected value at power up to verify basic FPGA communication and operation U08 fpgaRevMinor; ///< Reg 1. FPGA revision (minor) being reported U08 fpgaRevMajor; ///< Reg 2. FPGA revision (major) being reported U08 fpgaRevLab; ///< Reg 3. FPGA revision (lab) being reported } FPGA_HEADER_T; // read only on FPGA /// FPGA sensor readings struct. typedef struct { U16 fpgaCompatibilityRev; ///< Reg 256. Compatibility revision U16 fpgaTimerCountMS; ///< Reg 258. Internal FPGA timer count in milliseconds U16 fpgaRemoteUpdateRead; ///< Reg 260. FPGA Remote Update Read ( copy contents from remote update write) U08 fpgaIOErrorCntProcessor; ///< Reg 262. Number of errors in Microprocessor UART interface U08 fpgaIOErrorCntPC; ///< Reg 263. Number of errors in PC UART interface U16 fpgaD9PresPressure; ///< Reg 264. D9 MPM pressure sensor RAW pressure data U16 fpgaD9PresTemp; ///< Reg 266. D9 MPM pressure sensor RAW temperature data U08 fpgaD9PresReadCnt; ///< Reg 268. D9 Counter for good SPI transmission b/w FPGA and sensor U08 fpgaD9PresErrorCnt; ///< Reg 269. D9 Counter for bad SPI transmission b/w FPGA and sensor U16 fpgaD66PresPressure; ///< Reg 270. D66 MPM pressure sensor RAW pressure data U16 fpgaD66PresTemp; ///< Reg 272. D66 MPM pressure sensor RAW temperature data U08 fpgaD66PresReadCnt; ///< Reg 274. D66 Counter for good SPI transmission b/w FPGA and sensor U08 fpgaD66PresErrorCnt; ///< Reg 275. D66 Counter for bad SPI transmission b/w FPGA and sensor U16 fpgaD51PresPressure; ///< Reg 276. D51 MPM pressure sensor RAW pressure data U16 fpgaD51PresTemp; ///< Reg 278. D51 MPM pressure sensor RAW temperature data U08 fpgaD51PresReadCnt; ///< Reg 280. D51 Counter for good SPI transmission b/w FPGA and sensor U08 fpgaD51PresErrorCnt; ///< Reg 281. D51 Counter for bad SPI transmission b/w FPGA and sensor U16 fpgaD18PresPressure; ///< Reg 282. D18 MPM pressure sensor RAW pressure data U16 fpgaD18PresTemp; ///< Reg 284. D18 MPM pressure sensor RAW temperature data U08 fpgaD18PresReadCnt; ///< Reg 286. D18 Counter for good SPI transmission b/w FPGA and sensor U08 fpgaD18PresErrorCnt; ///< Reg 287. D18 Counter for bad SPI transmission b/w FPGA and sensor U16 fpgaD41PresPressure; ///< Reg 288. D41 MPM pressure sensor RAW pressure data U16 fpgaD41PresTemp; ///< Reg 290. D41 MPM pressure sensor RAW temperature data U08 fpgaD41PresReadCnt; ///< Reg 292. D41 Counter for good SPI transmission b/w FPGA and sensor U08 fpgaD41PresErrorCnt; ///< Reg 293. D41 Counter for bad SPI transmission b/w FPGA and sensor U16 fpgaM1PresPressure; ///< Reg 294. M1 MPM pressure sensor RAW pressure data U16 fpgaM1PresTemp; ///< Reg 296. M1 MPM pressure sensor RAW temperature data U08 fpgaM1PresReadCnt; ///< Reg 298. M1 Counter for good SPI transmission b/w FPGA and sensor U08 fpgaM1PresErrorCnt; ///< Reg 299. M1 Counter for bad SPI transmission b/w FPGA and sensor U16 fpgaM3PresPressure; ///< Reg 300. M3 MPM pressure sensor RAW pressure data U16 fpgaM3PresTemp; ///< Reg 302. M3 MPM pressure sensor RAW temperature data U08 fpgaM3PresReadCnt; ///< Reg 304. M3 Counter for good SPI transmission b/w FPGA and sensor U08 fpgaM3PresErrorCnt; ///< Reg 305. M3 Counter for bad SPI transmission b/w FPGA and sensor U32 fpgaD17CondDataOut; ///< Reg 306. Data read from Conductivity Sensor 1 register U16 fpgaD17CondCond; ///< Reg 310. D17 conductivity U16 fpgaD17CondTemp; ///< Reg 312. D17 Temperature U08 fpgaD17CondReadCnt; ///< Reg 314. D17 successful read count U08 fpgaD17CondErrorCnt; ///< Reg 315. D17 error read count U32 fpgaD27CondDataOut; ///< Reg 316. Data read from Conductivity Sensor 2 register U16 fpgaD27CondCond; ///< Reg 320. D27 conductivity U16 fpgaD27CondTemp; ///< Reg 322. D27 Temperature U08 fpgaD27CondReadCnt; ///< Reg 324. D27 successful read count U08 fpgaD27CondErrorCnt; ///< Reg 325. D27 error read count U32 fpgaD29CondDataOut; ///< Reg 326. Data read from Conductivity Sensor 3 register U16 fpgaD29CondCond; ///< Reg 330. D29 conductivity U16 fpgaD29CondTemp; ///< Reg 332. D29 Temperature U08 fpgaD29CondReadCnt; ///< Reg 334. D29 successful read count U08 fpgaD29CondErrorCnt; ///< Reg 335. D29 error read count U32 fpgaD43CondDataOut; ///< Reg 336. Data read from Conductivity Sensor 4 register U16 fpgaD43CondCond; ///< Reg 340. D43 conductivity U16 fpgaD43CondTemp; ///< Reg 342. D43 Temperature U08 fpgaD43CondReadCnt; ///< Reg 344. D43 successful read count U08 fpgaD43CondErrorCnt; ///< Reg 345. D43 error read count U16 fpgaD63LevelSensor; ///< Reg 346. Level Sensor 1 U16 fpgaD46LevelSensor; ///< Reg 348. Level Sensor 2 U08 fpgaHallSensInputs; ///< Reg 350. Hall sensor Inputs U08 fpgaD42TxFIFOCnt; ///< Reg 351. Blood leak sensor transmit FIFO count U16 fpgaD42RxErrorCnt; ///< Reg 352. Blood leak sensor Receive error count U16 fpgaD42RxFIFOCnt; ///< Reg 354. Blood leak sensor Receive FIFO count U08 fpgaD42RxFIFODataOut; ///< Reg 356. Blood leak sensor Receive data U08 fpgaD42PulseStatus; ///< Reg 357. Blood leak sensor status U16 fpgaValveStates; ///< Reg 358. Valve status read U16 fpgaValvePWMEnableStates; ///< Reg 360. Valve PWM Enable status read U08 fpgaValveBCStates; ///< Reg 362. Balancing chamber Valves states U08 fpgaValveBCPWMStates; ///< Reg 363. Balancing Chamber Valve PWM states U08 fpgaValveUFStates; ///< Reg 364. Ultrafiltration Valves states U08 fpgaValveUFPWMStates; ///< Reg 365. Ultrafiltration Valves PWM states U08 fpgaD11_D10_PumpFault; ///< Reg 366. Concentrate pump fault register for D11_Pump and D10_Pump U08 fpgaRTDCountErrorCycles; ///< Reg 367. Count of each incomplete seq of reads from RTD ADC. U16 fpgaD11PumpHallSense; ///< Reg 368. Concentrate pump D11_Pump hall sensor pulse width U16 fpgaD10PumpHallSense; ///< Reg 370. Concentrate pump D10_Pump hall sensor pulse width U32 fpgaD1Temp; ///< Reg 372. Inlet heat exchanger temperature U32 fpgaX6Temp; ///< Reg 376. Outlet heat exchanger temperature U32 fpgaD4Temp; ///< Reg 380. Hydraulics primary heater temperature U32 fpgaD50Temp; ///< Reg 384. Trimmer heater temperature U08 fpgaRTDReadCnt; ///< Reg 388. Read count for all RTD sensors U08 fpgaBaroReadCount; ///< Reg 389. Barometric sensor read count U16 fpgaBaroManufacInfo; ///< Reg 390. Barometric sensor manufacturing information U16 fpgaBaroPROMCoeff1; ///< Reg 392. Barometric sensor PROM coefficient 1 U16 fpgaBaroPROMCoeff2; ///< Reg 394. Barometric sensor PROM coefficient 2 U16 fpgaBaroPROMCoeff3; ///< Reg 396. Barometric sensor PROM coefficient 3 U16 fpgaBaroPROMCoeff4; ///< Reg 398. Barometric sensor PROM coefficient 4 U16 fpgaBaroPROMCoeff5; ///< Reg 400. Barometric sensor PROM coefficient 5 U16 fpgaBaroPROMCoeff6; ///< Reg 402. Barometric sensor PROM coefficient 6 U16 fpgaBaroPROMCRC; ///< Reg 404. Barometric sensor PROM CRC U32 fpgaBaroPressure; ///< Reg 406. Barometric sensor pressure value U32 fpgaBaroTemperature; ///< Reg 410. Barometric sensor temperature sensor U16 fpgaD12MeasuredSpeed; ///< Reg 414. Fresh dialysate pump measured speed U16 fpgaD48MeasuredSpeed; ///< Reg 416. Spent dialysate pump measured speed U08 fpgaBaroErrorCount; ///< Reg 418. Barometric sensor Error count U08 fpgaD12D48PumpStatus; ///< Reg 419. Dialysate pumps Error status U16 fpgaD12CurrentFeedback; ///< Reg 420. Fresh dialysate pump current feedback U16 fpgaD48CurrentFeedback; ///< Reg 422. Spent dialysate pump current feedback U08 fpgaD12HallStatus; ///< Reg 424. Fresh dialysate pump hall sensor direction status U08 fpgaD48HallStatus; ///< Reg 425. Spent dialysate pump hall sensor direction status U08 fpgaD6FloaterStatus; ///< Reg 426. Floater 1 level sensor status U08 fpgaFloater2Status; ///< Reg 427. Floater 2 level sensor status U16 fpgaD11PumpStepCountStatus; ///< Reg 428. Acid concentrate pump revolution down count status U16 fpgaD10PumpStepCountStatus; ///< Reg 430. Bicarb concentrate pump revolution down count status U16 fpgaAdcTemp; ///< Reg 432. TBD U16 fpgaAdcVccInt; ///< Reg 434. TBD U16 fpgaAdcVccAux; ///< Reg 436. TBD U16 fpgaAdcVpVn; ///< Reg 438. TBD U16 fpgaD12PumpSpeedFeedback; ///< Reg 440. D12 Pump speed feedback U16 fpgaD48PumpSpeedFeedback; ///< Reg 442. D48 Pump Speed feedback U16 fpgaD76PumpHallSense; ///< Reg 444. UF D76_Pump hall sensor pulse width U16 fpgaD76PumpStepCountStatus; ///< Reg 446. UF pump revolution down count status U32 fpgaD74CondDataOut; ///< Reg 448. Data read from Conductivity Sensor D74 register U16 fpgaD74CondCond; ///< Reg 452. D74 conductivity U16 fpgaD74CondTemp; ///< Reg 454. D74 Temperature U08 fpgaD74CondReadCnt; ///< Reg 456. D74 successful read count U08 fpgaD74CondErrorCnt; ///< Reg 457. D74 error read count } DD_FPGA_SENSORS_T; typedef struct { U16 fpgaValveControl; ///< Reg 04. Valve control register U16 fpgaValvePWMEnable; ///< Reg 06. Valve PWM enable U16 fpgaD53ValvePWMLow; ///< Reg 08. D53 PWM low. (VDR) U16 fpgaD53ValvePWMPeriod; ///< Reg 10. D53 PWM period (VDR) U16 fpgaD53ValvePWMPullin; ///< Reg 12. D53 PWM pull in (VDR) U16 fpgaD52ValvePWMLow; ///< Reg 14. D52 PWM low (VTD) U16 fpgaD52ValvePWMPeriod; ///< Reg 16. D52 PWM period (VTD) U16 fpgaD52ValvePWMPullin; ///< Reg 18. D52 PWM pull in (VTD) U16 fpgaD8ValvePWMLow; ///< Reg 20. D8 PWM low (VHB) U16 fpgaD8ValvePWMPeriod; ///< Reg 22. D8 PWM period (VHB) U16 fpgaD8ValvePWMPullin; ///< Reg 24. D8 PWM pull in (VHB) U16 fpgaD54ValvePWMLow; ///< Reg 26. D54 PWM low (VRP) U16 fpgaD54ValvePWMPeriod; ///< Reg 28. D54 PWM period (VRP) U16 fpgaD54ValvePWMPullin; ///< Reg 30. D54 PWM pull in (VRP) U16 fpgaD14ValvePWMLow; ///< Reg 32. D14 PWM low (VHo) U16 fpgaD14ValvePWMPeriod; ///< Reg 34. D14 PWM period (VHo) U16 fpgaD14ValvePWMPullin; ///< Reg 36. D14 PWM pull in (VHo) U16 fpgaD65ValvePWMLow; ///< Reg 38. D65 PWM low U16 fpgaD65ValvePWMPeriod; ///< Reg 40. D65 PWM period U16 fpgaD65ValvePWMPullin; ///< Reg 42. D65 PWM pull in U16 fpgaD64ValvePWMLow; ///< Reg 44. D64 PWM low ( VP1 : Bicarb purge) U16 fpgaD64ValvePWMPeriod; ///< Reg 46. D64 PWM period U16 fpgaD64ValvePWMPullin; ///< Reg 48. D64 PWM pull in U16 fpgaD31ValvePWMLow; ///< Reg 50. D31 PWM Low (Pressure test) U16 fpgaD31ValvePWMPeriod; ///< Reg 52. D31 PWM period U16 fpgaD31ValvePWMPullin; ///< Reg 54. D31 PWM pull in U16 fpgaD34ValvePWMLow; ///< Reg 56. D34 PWM low U16 fpgaD34ValvePWMPeriod; ///< Reg 58. D34 PWM period U16 fpgaD34ValvePWMPullin; ///< Reg 60. D34 PWM pull in U16 fpgaD35ValvePWMLow; ///< Reg 62. D35 PWM low U16 fpgaD35ValvePWMPeriod; ///< Reg 64. D35 PWM period U16 fpgaD35ValvePWMPullin; ///< Reg 66. D35 PWM pull in U16 fpgaD40ValvePWMLow; ///< Reg 68. D40 PWM low U16 fpgaD40ValvePWMPeriod; ///< Reg 70. D40 PWM period U16 fpgaD40ValvePWMPullin; ///< Reg 72. D40 PWM pull in U16 fpgaD47ValvePWMLow; ///< Reg 74. D47 PWM low U16 fpgaD47ValvePWMPeriod; ///< Reg 76. D47 PWM period U16 fpgaD47ValvePWMPullin; ///< Reg 78. D47 PWM pull in U16 fpgaD3ValvePWMLow; ///< Reg 80. D3 PWM low U16 fpgaD3ValvePWMPeriod; ///< Reg 82. D3 PWM period U16 fpgaD3ValvePWMPullin; ///< Reg 84. D3 PWM pull in U16 fpgaM4ValvePWMLow; ///< Reg 86. M4 PWM low U16 fpgaM4ValvePWMPeriod; ///< Reg 88. M4 PWM period U16 fpgaM4ValvePWMPullin; ///< Reg 90. M4 PWM pull in U08 fpgaBCValveControl; ///< Reg 92. Balancing Chamber Valves Control Registers U08 fpgaBCValvePWMControl; ///< Reg 93. Balancing Chamber Valves PWM control U08 fpgaUFValveControl; ///< Reg 94. Ultra filtration Valves Control Registers U08 fpgaUFValvePWMControl; ///< Reg 95. Ultra filtration Valves PWM control U08 fpgaConSensTD12Control; ///< Reg 96. Conductivity/Temperature Sensors 1 & 2 Control registers U08 fpgaConSensTD34Control; ///< Reg 97. Conductivity/Temperature Sensors 3 & 4 Control registers U16 fpgaConSensTD12_Addrs; ///< Reg 98. CDTD 1&2 Initialization Address register U32 fpgaConSensTD12_Data_In; ///< Reg 100. CDTD 1&2 Initialization data register U16 fpgaConSensTD34_Addrs; ///< Reg 104. CDTD 3&4 Initialization Address register U32 fpgaConSensTD34_Data_In; ///< Reg 106. CDTD 3&4 Initialization data register U16 fpgaRemoteUpdate_Write; ///< Reg 110.Register for Remote update used by SW. U16 fpgaD12PumpSpeed; ///< Reg 112. D48 Speed/RPM Control U08 fpgaD12PumpControl; ///< Reg 114. DGP Control U08 fpgaD48PumpControl; ///< Reg 115. SDP Control U16 fpgaD48PumpSpeed; ///< Reg 116. SDP Speed/RPM Control U16 fpgaD11PumpSpeed; ///< Reg 118. Acid Concentrate Pump Speed/RPM Control U08 fpgaD11PumpControl; ///< Reg 120. Acid Concentrate Pump Control U08 fpgaD10PumpControl; ///< Reg 121. BiCarb Concentrate Pump Control U16 fpgaD10PumpSpeed; ///< Reg 122. BiCarb Concentrate Pump Speed/RPM Control U08 fpgaD42SensorTest; ///< Reg 124. Blood leak sensor test U08 fpgaD42UARTControl; ///< Reg 125. Blood leak sensor UART control U08 fpgaD42FIFOTx; ///< Reg 126. Blood leak sensor FIFO transmit control U08 fpgaD5HeaterPWMControl; ///< Reg 127. Primary heater PWM control U08 fpgaD45HeaterPWMControl; ///< Reg 128. Trimmer heater PWM control U08 fpgaNotUsed; ///< Reg 129. Not used U16 fpgaVBCPWMLow; ///< Reg 130. VBC PWM low ( Balancing chamber valves) U16 fpgaVBCPWMPeriod; ///< Reg 132. VBC PWM period U16 fpgaVBCPWMPullin; ///< Reg 134. VBC PWM pull in U16 fpgaVUFPWMLow; ///< Reg 136. VUF PWM low ( Ultra filteration valves ) U16 fpgaVUFPWMPeriod; ///< Reg 138. VUF PWM period U16 fpgaVUFPWMPullin; ///< Reg 140. VUF PWM pull in U16 fpgaD11PumpRevCount; ///< Reg 142. Acid Concentrate pump revolution count U16 fpgaD10PumpRevCount; ///< Reg 144. Bicarb Concentrate pump revolution count U08 fpgaADCControl; ///< Reg 146. FPGA internal ADC Control register for debugging U08 fpgaGPIOControl; ///< Reg 147. FPGA GPIO control interface U16 fpgaACRelayPWMLow; ///< Reg 148. Length of time in 10us resoultion that PWM output stays low. U16 fpgaACRelayPWMPeriod; ///< Reg 150. PWM period for AC relay/heater. U16 fpgaD76PumpSpeed; ///< Reg 152. UF Pump Speed/RPM Control U16 fpgaD76PumpRevCount; ///< Reg 154. UF pump revolution count U08 fpgaD76PumpControl; ///< Reg 156. UF Pump Control U08 fpgaConSensD74Control; ///< Reg 157. Conductivity/Temperature Sensors D74 Control registers U16 fpgaConSensD74_Addrs; ///< Reg 158. D74 Initialization Address register U32 fpgaConSensD74_Data_In; ///< Reg 160. D74 Initialization data register } FPGA_ACTUATORS_T; #pragma pack(pop) // ********** private data ********** static FPGA_HEADER_T fpgaHeader; ///< FPGA header structure. static DD_FPGA_SENSORS_T fpgaSensorReadings; ///< DD FPGA sensors structure. static FPGA_ACTUATORS_T fpgaActuatorSetPoints; ///< FPGA actuator set points structure. // ********** private function prototypes ********** static U16 getFPGATimerCount( void ); /*********************************************************************//** * @brief * The initFPGADD function initializes the DD FPGA unit. * @details \b Inputs: none * @details \b Outputs: FPGA unit initialized. * @return none *************************************************************************/ void initFPGADD( void ) { // Initialize fpga driver initFPGA( (U08*)&fpgaHeader, (U08*)&fpgaSensorReadings, (U08*)&fpgaActuatorSetPoints, sizeof(FPGA_HEADER_T), sizeof(DD_FPGA_SENSORS_T), sizeof(FPGA_ACTUATORS_T) ); // initialize fpga data structures memset( &fpgaHeader, 0, sizeof( FPGA_HEADER_T ) ); memset( &fpgaSensorReadings, 0, sizeof( DD_FPGA_SENSORS_T ) ); memset( &fpgaActuatorSetPoints, 0, sizeof( FPGA_ACTUATORS_T ) ); // Set the THd control register to 0x1 to make sure its ADC is running //fpgaActuatorSetPoints.fpgaTHdControlReg = FPGA_THD_CONTROL_COMMAND; // Set the valve control mode and default state of valve fpgaActuatorSetPoints.fpgaValveControl = FPGA_ENABLE_VALVES_CONTROL; fpgaActuatorSetPoints.fpgaValvePWMEnable = FPGA_ENABLE_VALVES_PWM; fpgaActuatorSetPoints.fpgaBCValveControl = FPGA_ENABLE_BC_VALVES_CONTROL; fpgaActuatorSetPoints.fpgaBCValvePWMControl = FPGA_ENABLE_BC_VALVES_PWM; fpgaActuatorSetPoints.fpgaUFValveControl = FPGA_ENABLE_UF_VALVES_CONTROL; fpgaActuatorSetPoints.fpgaUFValvePWMControl = FPGA_ENABLE_UF_VALVES_PWM; fpgaActuatorSetPoints.fpgaADCControl = FPGA_ADC_AUTO_READ_ENABLE; // initialize FPGA clock speed error time windowed count initTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_COMM_FAILURES, MAX_FPGA_COMM_FAILURES, MAX_FPGA_COMM_FAILURES_WINDOW_MS); } /*********************************************************************//** * @brief * The execFPGATest function executes the FPGA self-test. * @details \b Inputs: fpgaHeader * @details \b Outputs: none * @details \b Alarm: ALARM_ID_DD_FPGA_POST_TEST_FAILED when FPGA compatibility failed and/or * wrong FPGA header seen. * @return passed, or failed *************************************************************************/ SELF_TEST_STATUS_T execFPGATest( void ) { SELF_TEST_STATUS_T result; // check FPGA reported correct ID if ( FPGA_EXPECTED_ID == fpgaHeader.fpgaId ) { // Check FPGA compatibility w/ firmware if ( DD_FPGA_COMPATIBILITY_REV == fpgaSensorReadings.fpgaCompatibilityRev ) { result = SELF_TEST_STATUS_PASSED; } else { result = SELF_TEST_STATUS_FAILED; SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_FPGA_POST_TEST_FAILED, (U32)DD_FPGA_COMPATIBILITY_REV, (U32)fpgaSensorReadings.fpgaCompatibilityRev ) } } else { result = SELF_TEST_STATUS_FAILED; SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DD_FPGA_POST_TEST_FAILED, (U32)fpgaHeader.fpgaId ) } return result; } /*********************************************************************//** * @brief * The execFPGAClockSpeedTest function verifies the processor clock speed * against the FPGA clock. * @details \b Inputs: time windowed error count for FPGA clock speed alarm * @details \b Outputs: none * @details \b Alarm: ALARM_ID_DD_FPGA_CLOCK_SPEED_CHECK_FAILURE when clock speed * mismatch seen. * @warning: It may be necessary to comment out the following code to prevent * the alarm from occurring while debugging. * @return: none *************************************************************************/ void execFPGAClockSpeedTest( void ) { static U16 currentFPGATimerCount_ms = 0; static U32 currentTimerCount_ms = 0; U16 const newFPGATimerCount_ms = getFPGATimerCount(); U32 const newTimerCount_ms = getMSTimerCount(); U32 const diffFPGATimerCount = (U32)u16DiffWithWrap( currentFPGATimerCount_ms, newFPGATimerCount_ms ); U32 const diffTimerCount = u32DiffWithWrap( currentTimerCount_ms, newTimerCount_ms ); if ( getCurrentOperationMode() != DD_MODE_INIT ) { if ( abs( diffFPGATimerCount - diffTimerCount ) > PROCESSOR_FPGA_CLOCK_DIFF_TOLERANCE ) { if ( TRUE == incTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_CLOCK_SPEED_ERROR ) ) { //TODO : Enable alarm later //SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_FPGA_CLOCK_SPEED_CHECK_FAILURE, diffFPGATimerCount, diffTimerCount ); } } } currentFPGATimerCount_ms = newFPGATimerCount_ms; currentTimerCount_ms = newTimerCount_ms; } /*********************************************************************//** * @brief * The 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 - D53Valve.\n * 1 - D52Valve.\n * 2 - D8Valve.\n * 3 - D54Valve.\n * 4 - D14Valve.\n * 5 - D65Valve.\n * 6 - D64Valve.\n * 7 - D31Valve.\n * 8 - D34Valve.\n * 9 - D35Valve.\n * 10 - D40Valve.\n * 11 - D47Valve.\n * 12 - D3Valve.\n * 13 - M4Valve.\n * 14..15 - reserved or unused. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaValveControl * @param valveStates bit mask for the various valve states * @return none *************************************************************************/ void setFPGAValveStates( U16 valveStates ) { fpgaActuatorSetPoints.fpgaValveControl = valveStates; } /*********************************************************************//** * @brief * The setFPGABCValveStates function sets the DD balancing chamber valve states with a * 8-bit set of states - one bit per valve, with a 1 meaning "energized" and a 0 * meaning "de-energized". The bit positions for these bit states are as follows: * 0 - D23.\n * 1 - D19.\n * 2 - D25.\n * 3 - D21.\n * 4 - D24.\n * 5 - D20.\n * 6 - D26.\n * 7 - D22.\n * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaBCValveControl * @param valveStates bit mask for the balancing chamber valve states * @return none *************************************************************************/ void setFPGABCValveStates( U08 valveStates ) { fpgaActuatorSetPoints.fpgaBCValveControl = valveStates; } /*********************************************************************//** * @brief * The 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 - UFi2.\n * 2 - UFo1.\n * 3 - UFo2.\n * 4..7 - Unused or reserved.\n * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaUFValveControl * @param valveStates bit mask for the balancing chamber valve states * @return none *************************************************************************/ void setFPGAUFValveStates( U08 valveStates ) { fpgaActuatorSetPoints.fpgaUFValveControl = valveStates; } /*********************************************************************//** * @brief * The setFPGAD48PumpSpeed function sets the speed for the * spent dialysate pump (SDP). * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD48PumpSpeed * @param speed The spent dialysate pump speed * @return none *************************************************************************/ void setFPGAD48PumpSpeed( U16 speed ) { fpgaActuatorSetPoints.fpgaD48PumpSpeed = speed; } /*********************************************************************//** * @brief * The setFPGAD12PumpSpeed function sets the speed for the * fresh dialysate pump (DGP). * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD12PumpSpeed * @param speed The fresh dialysate pump speed * @return none *************************************************************************/ void setFPGAD12PumpSpeed( U16 speed ) { fpgaActuatorSetPoints.fpgaD12PumpSpeed = speed; } /*********************************************************************//** * @brief * The setFPGAD48PumpControl function sets the controls for * dialysate out pump (D48). * bit 7: Reserved * bit 6: Reserved * bit 5: Reserved * bit 4: Reserved * bit 3: Reserved * bit 1-2: Reserved * bit 0: Run (1), stop (0) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD48PumpControl * @param control The dialysate out pump controls * @return none *************************************************************************/ void setFPGAD48PumpControl( U08 control ) { fpgaActuatorSetPoints.fpgaD48PumpControl = control; } /*********************************************************************//** * @brief * The setFPGAD12PumpControl function sets the controls for * De gassing pump (D12). * bit 7: Reserved * bit 6: Reserved * bit 5: Reserved * bit 4: Reserved * bit 3: Reserved * bit 1-2: Reserved * bit 0: Run (1), stop (0) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD12PumpControl * @param control The dialysate In pump controls * @return none *************************************************************************/ void setFPGAD12PumpControl( U08 control ) { fpgaActuatorSetPoints.fpgaD12PumpControl = control; } /*********************************************************************//** * @brief * The setFPGAD11PumpSetStepSpeed function sets the step speed period for * concentrate pump D11_Pump. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD11PumpSpeed * @param stepSpeed The concentrate pump step speed period * @return none *************************************************************************/ void setFPGAD11PumpSetStepSpeed( U16 stepSpeed ) { fpgaActuatorSetPoints.fpgaD11PumpSpeed = stepSpeed; } /*********************************************************************//** * @brief * The setFPGAD10PumpSetStepSpeed function sets the step speed period for * concentrate pump D10_Pump. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD10PumpSpeed * @param stepSpeed The concentrate pump step speed period * @return none *************************************************************************/ void setFPGAD10PumpSetStepSpeed( U16 stepSpeed ) { fpgaActuatorSetPoints.fpgaD10PumpSpeed = stepSpeed; } /*********************************************************************//** * @brief * The setFPGAD76PumpSetStepSpeed function sets the step speed period for * UF D76_Pump. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD76PumpSpeed * @param stepSpeed The concentrate pump step speed period * @return none *************************************************************************/ void setFPGAD76PumpSetStepSpeed( U16 stepSpeed ) { fpgaActuatorSetPoints.fpgaD76PumpSpeed = stepSpeed; } /*********************************************************************//** * @brief * The setFPGAD11PumpControl function sets the DVT concentrate pump 1 * (acid pump) control mode. * bit 7: Park (set in different function) * bit 6: nSleep * bit 5: nReset * bit 4: nEnable * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD11PumpControl * @param control Concentrate pump control set * @return none *************************************************************************/ void setFPGAD11PumpControl( U08 control ) { fpgaActuatorSetPoints.fpgaD11PumpControl &= FPGA_CONC_PUMP_PARK_COMMAND; // preserve msb (park command bit) fpgaActuatorSetPoints.fpgaD11PumpControl |= control; } /*********************************************************************//** * @brief * The setFPGAD10PumpControl function sets the DVT concentrate pump 2 * (bicarb pump) control mode. * bit 7: Park (set in different function) * bit 6: nSleep * bit 5: nReset * bit 4: nEnable * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD10PumpControl * @param control Concentrate pump control set * @return none *************************************************************************/ void setFPGAD10PumpControl( U08 control ) { fpgaActuatorSetPoints.fpgaD10PumpControl &= FPGA_CONC_PUMP_PARK_COMMAND; // preserve msb (park command bit) fpgaActuatorSetPoints.fpgaD10PumpControl |= control; } /*********************************************************************//** * @brief * The setFPGAD76PumpControl function sets the UF pump * (D76 pump) control mode. * bit 7: Park (set in different function) * bit 6: nSleep * bit 5: nReset * bit 4: nEnable * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD76PumpControl * @param control UF pump control set * @return none *************************************************************************/ void setFPGAD76PumpControl( U08 control ) { fpgaActuatorSetPoints.fpgaD76PumpControl &= FPGA_CONC_PUMP_PARK_COMMAND; // preserve msb (park command bit) fpgaActuatorSetPoints.fpgaD76PumpControl |= control; } /*********************************************************************//** * @brief * The setFPGAD11PumpParkCmd function sets the DVT concentrate pump 1 * (acid pump) park command bit. * bit 7: Park command bit * bit 0-6: Other pump control bits (set in different function) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD11PumpControl * @param Park command bit set * @return none *************************************************************************/ void setFPGAD11PumpParkCmd( void ) { fpgaActuatorSetPoints.fpgaD11PumpControl |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands } /*********************************************************************//** * @brief * The setFPGAD10PumpParkCmd function sets the DVT concentrate pump 2 * (bicarb pump) park command bit. * bit 7: Park command bit * bit 0-6: Other pump control bits (set in different function) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD10PumpControl * @param Park command bit set * @return none *************************************************************************/ void setFPGAD10PumpParkCmd( void ) { fpgaActuatorSetPoints.fpgaD10PumpControl |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands } /*********************************************************************//** * @brief * The setFPGAD76PumpParkCmd function sets the Ultrafiltration pump * (D76 pump) park command bit. * bit 7: Park command bit * bit 0-6: Other pump control bits (set in different function) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD76PumpControl * @param Park command bit set * @return none *************************************************************************/ void setFPGAD76PumpParkCmd( void ) { fpgaActuatorSetPoints.fpgaD76PumpControl |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands } /*********************************************************************//** * @brief * The setFPGAD17CondReset function resets the FPGA Conductivity * Sensor D17. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control * @param none * @return none *************************************************************************/ void setFPGAD17CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensTD12Control |= FPGA_D17_RESET_BIT; } /*********************************************************************//** * @brief * The clearFPGAD17CondReset function clears the reset of FPGA Conductivity * Sensor D17. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control * @param none * @return none *************************************************************************/ void clearFPGAD17CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensTD12Control &= ~FPGA_D17_RESET_BIT; } /*********************************************************************//** * @brief * The setFPGAD17CondInitEnable function enables the FPGA Conductivity * Sensor D17 initialzation procedure. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control * @param none * @return none *************************************************************************/ void setFPGAD17CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD12Control |= FPGA_D17_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD17CondInitEnable function clears the init process of FPGA Conductivity * Sensor D17. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control * @param none * @return none *************************************************************************/ void clearFPGAD17CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD12Control &= ~FPGA_D17_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD17CondWriteEnable function enables the FPGA Conductivity * Sensor D17 write transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control * @param none * @warning: The address (setFPGACD12Address) and data (setFPGACD12Data) register * must be populated before invoking this write enable function to initiate * write transaction with the sensor. * @return none *************************************************************************/ void setFPGAD17CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD12Control |= FPGA_D17_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD17CondWriteEnable function clears the write enable of FPGA Conductivity * Sensor D17. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control * @param none * @return none *************************************************************************/ void clearFPGAD17CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD12Control &= ~FPGA_D17_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD17CondReadEnable function enables the FPGA Conductivity * Sensor D17 read transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control * @param none * @warning: The address (setFPGACD12Address) register must be populated * before invoking this read enable function to initiate read transaction * with the sensor. * @return none *************************************************************************/ void setFPGAD17CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD12Control |= FPGA_D17_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD17CondReadEnable function clears the read enable of FPGA Conductivity * Sensor D17. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control * @param none * @return none *************************************************************************/ void clearFPGAD17CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD12Control &= ~FPGA_D17_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD27CondReset function resets the FPGA Conductivity * Sensor D27. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control * @param none * @return none *************************************************************************/ void setFPGAD27CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensTD12Control |= FPGA_D27_RESET_BIT; } /*********************************************************************//** * @brief * The clearFPGAD27CondReset function clears the reset of FPGA Conductivity * Sensor D27. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control * @param none * @return none *************************************************************************/ void clearFPGAD27CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensTD12Control &= ~FPGA_D27_RESET_BIT; } /*********************************************************************//** * @brief * The setFPGAD27CondInitEnable function enables the FPGA Conductivity * Sensor D27 initialzation procedure. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control * @param none * @return none *************************************************************************/ void setFPGAD27CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD12Control |= FPGA_D27_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD27CondInitEnable function clears the init process of FPGA Conductivity * Sensor D27. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control * @param none * @return none *************************************************************************/ void clearFPGAD27CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD12Control &= ~FPGA_D27_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD27CondWriteEnable function enables the FPGA Conductivity * Sensor D27 write transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control * @param none * @warning: The address (setFPGACD12Address) and data (setFPGACD12Data) register * must be populated before invoking this write enable function to initiate * write transaction with the sensor. * @return none *************************************************************************/ void setFPGAD27CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD12Control |= FPGA_D27_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD27CondWriteEnable function clears the write enable of FPGA Conductivity * Sensor D27. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control * @param none * @return none *************************************************************************/ void clearFPGAD27CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD12Control &= ~FPGA_D27_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD27CondReadEnable function enables the FPGA Conductivity * Sensor D27 read transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control * @param none * @warning: The address (setFPGACD12Address) register must be populated * before invoking this read enable function to initiate read transaction * with the sensor. * @return none *************************************************************************/ void setFPGAD27CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD12Control |= FPGA_D27_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD27CondReadEnable function clears the read enable of FPGA Conductivity * Sensor D27. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12Control * @param none * @return none *************************************************************************/ void clearFPGAD27CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD12Control &= ~FPGA_D27_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGD29CondReset function resets the FPGA Conductivity * Sensor D29. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param none * @return none *************************************************************************/ void setFPGAD29CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensTD34Control |= FPGA_D29_RESET_BIT; } /*********************************************************************//** * @brief * The clearFPGAD29CondReset function clears the reset of FPGA Conductivity * Sensor D29. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param none * @return none *************************************************************************/ void clearFPGAD29CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensTD34Control &= ~FPGA_D29_RESET_BIT; } /*********************************************************************//** * @brief * The setFPGAD29CondInitEnable function enables the FPGA Conductivity * Sensor D29 initialzation procedure. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param none * @return none *************************************************************************/ void setFPGAD29CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD34Control |= FPGA_D29_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD29CondInitEnable function clears the init process of FPGA Conductivity * Sensor D29. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param none * @return none *************************************************************************/ void clearFPGAD29CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD34Control &= ~FPGA_D29_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD29CondWriteEnable function enables the FPGA Conductivity * Sensor D29 write transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param none * @warning: The address (setFPGACD12Address) and data (setFPGACD12Data) register * must be populated before invoking this write enable function to initiate * write transaction with the sensor. * @return none *************************************************************************/ void setFPGAD29CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD34Control |= FPGA_D29_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD29CondWriteEnable function clears the write enable of FPGA Conductivity * Sensor D29. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param none * @return none *************************************************************************/ void clearFPGAD29CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD34Control &= ~FPGA_D29_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD29CondReadEnable function enables the FPGA Conductivity * Sensor D29 read transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param none * @warning: The address (setFPGACD12Address) register must be populated * before invoking this read enable function to initiate read transaction * with the sensor. * @return none *************************************************************************/ void setFPGAD29CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD34Control |= FPGA_D29_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD29CondReadEnable function clears the read enable of FPGA Conductivity * Sensor D29. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param none * @return none *************************************************************************/ void clearFPGAD29CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD34Control &= ~FPGA_D29_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD43CondReset function resets the FPGA Conductivity * Sensor D43. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param none * @return none *************************************************************************/ void setFPGAD43CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensTD34Control |= FPGA_D43_RESET_BIT; } /*********************************************************************//** * @brief * The clearFPGAD43CondReset function clears the reset of FPGA Conductivity * Sensor D43. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param none * @return none *************************************************************************/ void clearFPGAD43CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensTD34Control &= ~FPGA_D43_RESET_BIT; } /*********************************************************************//** * @brief * The setFPGAD43CondInitEnable function enables the FPGA Conductivity * Sensor D43 initialzation procedure. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param none * @return none *************************************************************************/ void setFPGAD43CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD34Control |= FPGA_D43_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD43CondInitEnable function clears the init process of FPGA Conductivity * Sensor D43. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param none * @return none *************************************************************************/ void clearFPGAD43CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD34Control &= ~FPGA_D43_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD43CondWriteEnable function enables the FPGA Conductivity * Sensor D43 write transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param none * @warning: The address (setFPGACD12Address) and data (setFPGACD12Data) register * must be populated before invoking this write enable function to initiate * write transaction with the sensor. * @return none *************************************************************************/ void setFPGAD43CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD34Control |= FPGA_D43_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD43CondWriteEnable function clears the write enable of FPGA Conductivity * Sensor D43. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param none * @return none *************************************************************************/ void clearFPGAD43CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD34Control &= ~FPGA_D43_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD43CondReadEnable function enables the FPGA Conductivity * Sensor D43 read transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param none * @warning: The address (setFPGACD12Address) register must be populated * before invoking this read enable function to initiate read transaction * with the sensor. * @return none *************************************************************************/ void setFPGAD43CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD34Control |= FPGA_D43_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD43CondReadEnable function clears the read enable of FPGA Conductivity * Sensor D43. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34Control * @param none * @return none *************************************************************************/ void clearFPGAD43CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensTD34Control &= ~FPGA_D43_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD74CondReset function resets the FPGA Conductivity * Sensor D74. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control * @param none * @return none *************************************************************************/ void setFPGAD74CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensD74Control |= FPGA_D74_RESET_BIT; } /*********************************************************************//** * @brief * The clearFPGAD74CondReset function clears the reset of FPGA Conductivity * Sensor D74. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control * @param none * @return none *************************************************************************/ void clearFPGAD74CondReset( void ) { fpgaActuatorSetPoints.fpgaConSensD74Control &= ~FPGA_D74_RESET_BIT; } /*********************************************************************//** * @brief * The setFPGAD74CondInitEnable function enables the FPGA Conductivity * Sensor D74 initialzation procedure. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control * @param none * @return none *************************************************************************/ void setFPGAD74CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD74Control |= FPGA_D74_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD74CondInitEnable function clears the init process of FPGA Conductivity * Sensor D74. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control * @param none * @return none *************************************************************************/ void clearFPGAD74CondInitEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD74Control &= ~FPGA_D74_INIT_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD74CondWriteEnable function enables the FPGA Conductivity * Sensor D74 write transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control * @param none * @warning: The address (setFPGACD74Address) and data (setFPGACD74Data) register * must be populated before invoking this write enable function to initiate * write transaction with the sensor. * @return none *************************************************************************/ void setFPGAD74CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD74Control |= FPGA_D74_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD74CondWriteEnable function clears the write enable of FPGA Conductivity * Sensor D74. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control * @param none * @return none *************************************************************************/ void clearFPGAD74CondWriteEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD74Control &= ~FPGA_D74_WR_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFPGAD74CondReadEnable function enables the FPGA Conductivity * Sensor D74 read transaction. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control * @param none * @warning: The address (setFPGACD74Address) register must be populated * before invoking this read enable function to initiate read transaction * with the sensor. * @return none *************************************************************************/ void setFPGAD74CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD74Control |= FPGA_D74_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The clearFPGAD74CondReadEnable function clears the read enable of FPGA Conductivity * Sensor D74. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control * @param none * @return none *************************************************************************/ void clearFPGAD74CondReadEnable( void ) { fpgaActuatorSetPoints.fpgaConSensD74Control &= ~FPGA_D74_RD_ENABLE_BIT; } /*********************************************************************//** * @brief * The setFpgaCD12Control function sets the FPGA Conductivity * Sensor control register for CD1&2. * bit 7: Enables D27 read transaction (1), address needed * bit 6: Enables D27 write transaction (1), address and data needs to be set * bit 5: Enable D27 Init procedure (1) * bit 4: reset D27 Conduct sensor (1) * bit 3: Enables D17 read transaction (1), address needed * bit 2: Enables D17 write transaction (1), address and data needs to be set * bit 1: Enable D17 Init procedure (1) * bit 0: reset D17 Conduct sensor (1) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.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 D43 read transaction (1), address needed * bit 6: Enables D43 write transaction (1), address and data needs to be set * bit 5: Enable D43 Init procedure (1) * bit 4: reset D43 Conduct sensor (1) * bit 3: Enables D29 read transaction (1), address needed * bit 2: Enables D29 write transaction (1), address and data needs to be set * bit 1: Enable D29 Init procedure (1) * bit 0: reset D29 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 setFpgaCD5Control function sets the FPGA Conductivity * Sensor control register for CD5. * bit 4- 7: Reserved. * bit 3: Enables D74 read transaction (1), address needed * bit 2: Enables D74 write transaction (1), address and data needs to be set * bit 1: Enable D74 Init procedure (1) * bit 0: reset D74 Conduct sensor (1) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control * @param control Conductivity sensor control set * @return none *************************************************************************/ void setFPGACD5Control( U08 control ) { fpgaActuatorSetPoints.fpgaConSensD74Control = 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 setFPGACD5Address function sets the conductivity sensor * D74 address register to perform read and write operations. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74_Addrs * @param address The conductivity sensor CD74 address * @return none *************************************************************************/ void setFPGACD5Address( U16 address ) { fpgaActuatorSetPoints.fpgaConSensD74_Addrs = address; } /*********************************************************************//** * @brief * The setFPGACD12Data function sets the conductivity sensor * CD12 data outputfor write operations. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD12_Data_In * @param data The conductivity sensor CD12 Data * @return none *************************************************************************/ void setFPGACD12Data( U32 data ) { fpgaActuatorSetPoints.fpgaConSensTD12_Data_In = data; } /*********************************************************************//** * @brief * The setFPGACD34Data function sets the conductivity sensor * CD34 data outputfor write operations. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensTD34_Data_In * @param data The conductivity sensor CD34 Data * @return none *************************************************************************/ void setFPGACD34Data( U32 data ) { fpgaActuatorSetPoints.fpgaConSensTD34_Data_In = data; } /*********************************************************************//** * @brief * The setFPGACD5Data function sets the conductivity sensor * CD5 data outputfor write operations. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74_Data_In * @param data The conductivity sensor CD74 Data * @return none *************************************************************************/ void setFPGACD5Data( U32 data ) { fpgaActuatorSetPoints.fpgaConSensD74_Data_In = data; } /*********************************************************************//** * @brief * The setFPGAD5HeaterPWMControl function sets the primary heater * PWM input. * @details \b Inputs: none * @details \b Outputs: fpgaD5HeaterPWMControl * @param control the PWM dutycycle to control the heater * @return none *************************************************************************/ void setFPGAD5HeaterPWMControl( U08 control ) { fpgaActuatorSetPoints.fpgaD5HeaterPWMControl = control; } /*********************************************************************//** * @brief * The setFPGAD45HeaterPWMControl function sets the trimmer heater * PWM input. * @details \b Inputs: none * @details \b Outputs: fpgaD45HeaterPWMControl * @param control the PWM dutycycle to control the heater * @return none *************************************************************************/ void setFPGAD45HeaterPWMControl( U08 control ) { fpgaActuatorSetPoints.fpgaD45HeaterPWMControl = control; } /*********************************************************************//** * @brief * The setFPGAD11PumpRevolutionCount function sets the Acid concentrate * pump revolution count. * @details \b Inputs: none * @details \b Outputs: fpgaD11PumpRevCount * @param count the number of revolution to be rotated for the pump. * @return none *************************************************************************/ void setFPGAD11PumpRevolutionCount( U16 count ) { fpgaActuatorSetPoints.fpgaD11PumpRevCount = count; } /*********************************************************************//** * @brief * The setFPGAD10PumpRevolutionCount function sets the Bicarb concentrate * pump revolution count. * @details \b Inputs: none * @details \b Outputs: fpgaD10PumpRevCount * @param count the number of revolution to be rotated for the pump. * @return none *************************************************************************/ void setFPGAD10PumpRevolutionCount( U16 count ) { fpgaActuatorSetPoints.fpgaD10PumpRevCount = count; } /*********************************************************************//** * @brief * The setFPGAD76PumpRevolutionCount function sets the UltraFilteration * pump revolution count. * @details \b Inputs: none * @details \b Outputs: fpgaD76PumpRevCount * @param count the number of revolution to be rotated for the pump. * @return none *************************************************************************/ void setFPGAD76PumpRevolutionCount( U16 count ) { fpgaActuatorSetPoints.fpgaD76PumpRevCount = count; } /*********************************************************************//** * @brief * The setFPGAD5HeaterOnOffControl function sets the primary heater * On/Off control. * @details \b Inputs: none * @details \b Outputs: fpgaGPIOControl * @param flag Turn heater ON when true, otherwise not. * @return none *************************************************************************/ void setFPGAD5HeaterOnOffControl( BOOL flag ) { if ( TRUE == flag) { fpgaActuatorSetPoints.fpgaGPIOControl |= FPGA_D5_HEATER_CNTRL_BIT; } else { fpgaActuatorSetPoints.fpgaGPIOControl &= ~FPGA_D5_HEATER_CNTRL_BIT; } } /*********************************************************************//** * @brief * The setFPGAD5HeaterPWMEnableControl function sets whether the primary heater * control based out of On/OFF (0) or PWM based control (1). * @details \b Inputs: none * @details \b Outputs: fpgaGPIOControl * @param enable PWM based heater control when true, otherwise On/Off Control. * @return none *************************************************************************/ void setFPGAD5HeaterPWMEnableControl( BOOL enable ) { if ( TRUE == enable) { fpgaActuatorSetPoints.fpgaGPIOControl |= FPGA_D5_HEATER_PWM_ENABLE_BIT; } else { fpgaActuatorSetPoints.fpgaGPIOControl &= ~FPGA_D5_HEATER_PWM_ENABLE_BIT; } } /*********************************************************************//** * @brief * The setFPGAD5HeaterPWMLowState function sets the PWM low period( Off time) * for AC heater. * @details \b Inputs: none * @details \b Outputs: fpgaACRelayPWMLow * @param count the number of count that PWM stays low for the AC relay/heater. * @return none *************************************************************************/ void setFPGAD5HeaterPWMLowState( U16 count ) { fpgaActuatorSetPoints.fpgaACRelayPWMLow = count; } /*********************************************************************//** * @brief * The setFPGAD5HeaterPWMPeriod function sets the PWM period( On and Off time) * for AC heater. * @details \b Inputs: none * @details \b Outputs: fpgaACRelayPWMPeriod * @param period the total period of PWM cycle ( On and Off time). * @return none *************************************************************************/ void setFPGAD5HeaterPWMPeriod( U16 period ) { fpgaActuatorSetPoints.fpgaACRelayPWMPeriod = period; } /*********************************************************************//** * @brief * The getFPGAVersions function gets the FPGA version numbers. * @details \b Inputs: fpgaHeader * @details \b Outputs: none * @return none *************************************************************************/ void getFPGAVersions( U08 *Id, U08 *Maj, U08 *Min, U08 *Lab ) { *Id = fpgaHeader.fpgaId; *Maj = fpgaHeader.fpgaRevMajor; *Min = fpgaHeader.fpgaRevMinor; *Lab = fpgaHeader.fpgaRevLab; } /*********************************************************************//** * @brief * The getFPGAD48PumpControl function gets the status of the * dialysate out pump control status bits. * bit 7: TBD * bit 6: TBD * bit 5: TBD * bit 4: TBD * bit 3: TBD * bit 1-2: TBD * bit 0: Run (1), stop (0) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD48PumpControl * @return Dialysate Out pump control status bit *************************************************************************/ U08 getFPGAD48PumpControl( void ) { return fpgaActuatorSetPoints.fpgaD48PumpControl; } /*********************************************************************//** * @brief * The getFPGAD12PumpControl function gets the status of the * dialysate Inlet pump control status bits. * bit 7: TBD * bit 6: TBD * bit 5: TBD * bit 4: TBD * bit 3: TBD * bit 1-2: TBD * bit 0: Run (1), stop (0) * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD12PumpControl * @return Dialysate Inlet pump control status bit *************************************************************************/ U08 getFPGAD12PumpControl( void ) { return fpgaActuatorSetPoints.fpgaD12PumpControl; } /*********************************************************************//** * @brief * The getFPGAD48PumpSpeed function gets the spent dialysate * pump speed. * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.fpgaD48MeasuredSpeed * @return Spent dialysate pump measured speed. *************************************************************************/ U16 getFPGAD48PumpSpeed( void ) { return fpgaSensorReadings.fpgaD48MeasuredSpeed; } /*********************************************************************//** * @brief * The getFPGAD12PumpSpeed function gets the fresh dialysate * pump speed. * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.fpgaD12MeasuredSpeed * @return fresh dialysate pump measured speed. *************************************************************************/ U16 getFPGAD12PumpSpeed( void ) { return fpgaSensorReadings.fpgaD12MeasuredSpeed; } /*********************************************************************//** * @brief * The getFPGAD12PumpErrorStatus function gets the fresh dialysate * pump error status. * bit 7-2: TBD * bit 1 : spent dialysate pump error (1), no error(0) * bit 0 : fresh dialysate pump error (1), no error(0) * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.fpgaD12D48PumpStatus * @return fresh dialysate pump error status. *************************************************************************/ BOOL getFPGAD12PumpErrorStatus( void ) { U08 mask = fpgaSensorReadings.fpgaD12D48PumpStatus & FPGA_D12_PUMP_ERROR_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief * The getFPGAD48PumpErrorStatus function gets the spent dialysate * pump error status. * bit 7-2: TBD * bit 1 : spent dialysate pump error (1), no error(0) * bit 0 : fresh dialysate pump error (1), no error(0) * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.fpgaD12D48PumpStatus * @return spent dialysate pump error status. *************************************************************************/ BOOL getFPGAD48PumpErrorStatus( void ) { U08 mask = fpgaSensorReadings.fpgaD12D48PumpStatus & FPGA_D48_PUMP_ERROR_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief * The getFPGAD12PumpCurrentFeedback function gets the fresh dialysate * pump current consumption. * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.fpgaD12CurrentFeedback * @return fresh dialysate pump measured current. *************************************************************************/ U16 getFPGAD12PumpCurrentFeedback( void ) { return fpgaSensorReadings.fpgaD12CurrentFeedback; } /*********************************************************************//** * @brief * The getFPGAD48PumpCurrentFeedback function gets the spent dialysate * pump current consumption. * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.fpgaD48CurrentFeedback * @return spent dialysate pump measured current. *************************************************************************/ U16 getFPGAD48PumpCurrentFeedback( void ) { return fpgaSensorReadings.fpgaD48CurrentFeedback; } /*********************************************************************//** * @brief * The getFPGAD12PumpHallDirectionStatus function gets the fresh dialysate * pump hall sensor based direction error status. * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.fpgaD12HallStatus * @return fresh dialysate pump hall sensor based direction status. *************************************************************************/ U08 getFPGAD12PumpHallDirectionStatus( void ) { return fpgaSensorReadings.fpgaD12HallStatus; } /*********************************************************************//** * @brief * The getFPGAD48PumpHallDirectionStatus function gets the spent dialysate * pump hall sensor based direction error status. * @details \b Inputs: none * @details \b Outputs: fpgaSensorReadings.fpgaD48HallStatus * @return spent dialysate pump hall sensor based direction status. *************************************************************************/ U08 getFPGAD48PumpHallDirectionStatus( void ) { return fpgaSensorReadings.fpgaD48HallStatus; } /*********************************************************************//** * @brief * The getFPGAD11PumpControlStatus function gets the status of the * acid pump control status bits. * bit 7: Park (set in different function) * bit 6: nSleep * bit 5: nReset * bit 4: nEnable * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD11PumpControl * @return Acid pump control status bit *************************************************************************/ U08 getFPGAD11PumpControlStatus( void ) { return fpgaActuatorSetPoints.fpgaD11PumpControl; } /*********************************************************************//** * @brief * The getFPGAD10PumpControlStatus function gets the DVT concentrate pump 2 * (bicarb pump) control mode. * bit 7: Park (set in different function) * bit 6: nSleep * bit 5: nReset * bit 4: nEnable * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD10PumpControl * @return Bicarb pump control status bit *************************************************************************/ U08 getFPGAD10PumpControlStatus( void ) { return fpgaActuatorSetPoints.fpgaD10PumpControl; } /*********************************************************************//** * @brief * The getFPGAD76PumpControlStatus function gets the Ultrafilteration pump * (D76 pump) control mode. * bit 7: Park (set in different function) * bit 6: nSleep * bit 5: nReset * bit 4: nEnable * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaD76PumpControl * @return UF pump control status bit *************************************************************************/ U08 getFPGAD76PumpControlStatus( void ) { return fpgaActuatorSetPoints.fpgaD76PumpControl; } /*********************************************************************//** * @brief * The getFPGAConcentratePumpsFault function gets concentrate pumps fault * reported by FGPA. * @details \b Inputs: fpgaSensorReadings.fpgaD11_D10_PumpFault * @details \b Outputs: none * @return Latest concentrate pumps fault value *************************************************************************/ U08 getFPGAConcentratePumpsFault( void ) { return fpgaSensorReadings.fpgaD11_D10_PumpFault & FPGA_CONC_PUMP_FAULT_BITS; } /*********************************************************************//** * @brief * The getFPGAD11PumpIsParked function gets whether the acid pump is currently * parked. * @details \b Inputs: fpgaSensorReadings.fpgaD11_D10_PumpFault * @details \b Outputs: none * @return TRUE if acid pump is parked, FALSE if not *************************************************************************/ BOOL getFPGAD11PumpIsParked( void ) { U08 mask = fpgaSensorReadings.fpgaD11_D10_PumpFault & FPGA_D11_PUMP_PARKED_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief * The getFPGAD10PumpIsParked function gets whether the bicarb pump is currently * parked. * @details \b Inputs: fpgaSensorReadings.fpgaD11_D10_PumpFault * @details \b Outputs: none * @return TRUE if bicarb pump is parked, FALSE if not *************************************************************************/ BOOL getFPGAD10PumpIsParked( void ) { U08 mask = fpgaSensorReadings.fpgaD11_D10_PumpFault & FPGA_D10_PUMP_PARKED_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief * The getFPGAD11PumpParkFault function gets whether the acid pump park command * has faulted. * @details \b Inputs: fpgaSensorReadings.fpgaD11_D10_PumpFault * @details \b Outputs: none * @return TRUE if acid pump park command faulted, FALSE if not *************************************************************************/ BOOL getFPGAD11PumpParkFault( void ) { U08 mask = fpgaSensorReadings.fpgaD11_D10_PumpFault & FPGA_D11_PUMP_PARK_FAULT_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief * The getFPGAD10PumpParkFault function gets whether the bicarb pump park command * has faulted. * @details \b Inputs: fpgaSensorReadings.fpgaD11_D10_PumpFault * @details \b Outputs: none * @return TRUE if bicarb pump park command faulted, FALSE if not *************************************************************************/ BOOL getFPGAD10PumpParkFault( void ) { U08 mask = fpgaSensorReadings.fpgaD11_D10_PumpFault & FPGA_D10_PUMP_PARK_FAULT_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief * The getFPGAD11PumpHallSensePulseWidth function gets concentrate pump D11_Pump * hall sense pulse width. * @details \b Inputs: fpgaSensorReadings.fpgaD11PumpHallSense * @details \b Outputs: none * @return concentrate pump D11_Pump hall sense pulse width *************************************************************************/ U16 getFPGAD11PumpHallSensePulseWidth( void ) { return fpgaSensorReadings.fpgaD11PumpHallSense; } /*********************************************************************//** * @brief * The getFPGAD10PumpHallSensePulseWidth function gets concentrate pump D10_Pump * hall sense pulse width. * @details \b Inputs: fpgaSensorReadings.fpgaD10PumpHallSense * @details \b Outputs: none * @return concentrate pump D10_Pump hall sense pulse width *************************************************************************/ U16 getFPGAD10PumpHallSensePulseWidth( void ) { return fpgaSensorReadings.fpgaD10PumpHallSense; } /*********************************************************************//** * @brief * The getFPGAD76PumpHallSensePulseWidth function gets UF pump D76_Pump * hall sense pulse width. * @details \b Inputs: fpgaSensorReadings.fpgaD76PumpHallSense * @details \b Outputs: none * @return ultrafilteration pump D76_Pump hall sense pulse width *************************************************************************/ U16 getFPGAD76PumpHallSensePulseWidth( void ) { return fpgaSensorReadings.fpgaD76PumpHallSense; } /*********************************************************************//** * @brief * The getFPGAValveStates function gets the latest sensed valve states. * See setFPGAValveStates for valve state bit positions. * @details \b Inputs: fpgaSensorReadings.fpgaValveStates * @details \b Outputs: none * @return last valve states reading *************************************************************************/ U16 getFPGAValveStates( void ) { return fpgaSensorReadings.fpgaValveStates; } /*********************************************************************//** * @brief * The getFPGAValveBCStates function gets the latest sensed balancing * chamber valve states. * See setFPGABCValveStates for BC valve state bit positions. * @details \b Inputs: fpgaSensorReadings.fpgaValveBCStates * @details \b Outputs: none * @return last balancing chamber valve states reading *************************************************************************/ U08 getFPGAValveBCStates( void ) { return fpgaSensorReadings.fpgaValveBCStates; } /*********************************************************************//** * @brief * The getFPGAValveUFStates function gets the latest sensed ultrafiltration * valve states. * See setFPGAUFValveStates for UF valve state bit positions. * @details \b Inputs: fpgaSensorReadings.fpgaValveUFStates * @details \b Outputs: none * @return last ultrafiltration valve states reading *************************************************************************/ U08 getFPGAValveUFStates( void ) { return fpgaSensorReadings.fpgaValveUFStates; } /*********************************************************************//** * @brief * The getFPGAD9PresReadCount function gets hydraulics outlet pressure sensor counter of * good SPI transmissions between FPGA and Sensor. * @details \b Inputs: fpgaSensorReadings.fpgaD9PresReadCnt * @details \b Outputs: none * @return Latest hydraulics outlet Pressure sensor read count *************************************************************************/ U08 getFPGAD9PresReadCount( void ) { return fpgaSensorReadings.fpgaD9PresReadCnt; } /*********************************************************************//** * @brief * The getFPGAD9PresErrorCount function gets hydraulics outlet pressure sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaD9PresErrorCnt * @details \b Outputs: none * @return Latest hydraulics outlet pressure sensor read error count *************************************************************************/ U08 getFPGAD9PresErrorCount( void ) { return fpgaSensorReadings.fpgaD9PresErrorCnt; } /*********************************************************************//** * @brief * The getFPGAD9PresRawPressure function gets hydraulics outlet pressure sensor raw * pressure value. * @details \b Inputs: fpgaSensorReadings.fpgaD9PresPressure * @details \b Outputs: none * @return Latest hydraulics outlet pressure sensor raw pressure data *************************************************************************/ U16 getFPGAD9PresRawPressure( void ) { return fpgaSensorReadings.fpgaD9PresPressure; } /*********************************************************************//** * @brief * The getFPGAD9PresRawTemperature function gets hydraulics outlet pressure sensor raw * temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD9PresTemp * @details \b Outputs: none * @return Latest hydraulics outlet pressure sensor raw temperature data *************************************************************************/ U16 getFPGAD9PresRawTemperature( void ) { return fpgaSensorReadings.fpgaD9PresTemp; } /*********************************************************************//** * @brief * The getFPGAD66PresReadCount function gets Bibag pressure sensor counter of * good SPI transmissions between FPGA and Sensor. * @details \b Inputs: fpgaSensorReadings.fpgaD66PresReadCnt * @details \b Outputs: none * @return Latest Bibag Pressure sensor read count *************************************************************************/ U08 getFPGAD66PresReadCount( void ) { return fpgaSensorReadings.fpgaD66PresReadCnt; } /*********************************************************************//** * @brief * The getFPGAD66PresErrorCount function gets Bibag pressure sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaD66PresErrorCnt * @details \b Outputs: none * @return Latest Bibag pressure sensor read error count *************************************************************************/ U08 getFPGAD66PresErrorCount( void ) { return fpgaSensorReadings.fpgaD66PresErrorCnt; } /*********************************************************************//** * @brief * The getFPGAD66PresRawPressure function gets Bibag pressure sensor raw * pressure value. * @details \b Inputs: fpgaSensorReadings.fpgaD66PresPressure * @details \b Outputs: none * @return Latest Bibag pressure sensor raw pressure data *************************************************************************/ U16 getFPGAD66PresRawPressure( void ) { return fpgaSensorReadings.fpgaD66PresPressure; } /*********************************************************************//** * @brief * The getFPGAD66PresRawTemperature function gets Bibag pressure sensor raw * temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD66PresTemp * @details \b Outputs: none * @return Latest Bibag pressure sensor raw temperature data *************************************************************************/ U16 getFPGAD66PresRawTemperature( void ) { return fpgaSensorReadings.fpgaD66PresTemp; } /*********************************************************************//** * @brief * The getFPGAD51PresReadCount function gets spent dialysate pressure sensor counter of * good SPI transmissions between FPGA and Sensor. * @details \b Inputs: fpgaSensorReadings.fpgaD51PresReadCnt * @details \b Outputs: none * @return Latest spent dialysate Pressure sensor read count *************************************************************************/ U08 getFPGAD51PresReadCount( void ) { return fpgaSensorReadings.fpgaD51PresReadCnt; } /*********************************************************************//** * @brief * The getFPGAD51PresErrorCount function gets spent dialysate pressure sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaD51PresErrorCnt * @details \b Outputs: none * @return Latest spent dialysate pressure sensor read error count *************************************************************************/ U08 getFPGAD51PresErrorCount( void ) { return fpgaSensorReadings.fpgaD51PresErrorCnt; } /*********************************************************************//** * @brief * The getFPGAD51PresRawPressure function gets spent dialysate pressure sensor raw * pressure value. * @details \b Inputs: fpgaSensorReadings.fpgaD51PresPressure * @details \b Outputs: none * @return Latest spent dialysate pressure sensor raw pressure data *************************************************************************/ U16 getFPGAD51PresRawPressure( void ) { return fpgaSensorReadings.fpgaD51PresPressure; } /*********************************************************************//** * @brief * The getFPGAD51PresRawTemperature function gets spent dialysate pressure sensor raw * temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD51PresTemp * @details \b Outputs: none * @return Latest spent dialysate pressure sensor raw temperature data *************************************************************************/ U16 getFPGAD51PresRawTemperature( void ) { return fpgaSensorReadings.fpgaD51PresTemp; } /*********************************************************************//** * @brief * The getFPGAD18PresReadCount function gets fresh dialysate pressure sensor counter of * good SPI transmissions between FPGA and Sensor. * @details \b Inputs: fpgaSensorReadings.fpgaD18PresReadCnt * @details \b Outputs: none * @return Latest fresh dialysate Pressure sensor read count *************************************************************************/ U08 getFPGAD18PresReadCount( void ) { return fpgaSensorReadings.fpgaD18PresReadCnt; } /*********************************************************************//** * @brief * The getFPGAD18PresErrorCount function gets fresh dialysate pressure sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaD18PresErrorCnt * @details \b Outputs: none * @return Latest fresh dialysate pressure sensor read error count *************************************************************************/ U08 getFPGAD18PresErrorCount( void ) { return fpgaSensorReadings.fpgaD18PresErrorCnt; } /*********************************************************************//** * @brief * The getFPGAD18PresRawPressure function gets fresh dialysate pressure sensor raw * pressure value. * @details \b Inputs: fpgaSensorReadings.fpgaD18PresPressure * @details \b Outputs: none * @return Latest fresh dialysate pressure sensor raw pressure data *************************************************************************/ U16 getFPGAD18PresRawPressure( void ) { return fpgaSensorReadings.fpgaD18PresPressure; } /*********************************************************************//** * @brief * The getFPGAD18PresRawTemperature function gets fresh dialysate pressure sensor raw * temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD18PresTemp * @details \b Outputs: none * @return Latest fresh dialysate pressure sensor raw temperature data *************************************************************************/ U16 getFPGAD18PresRawTemperature( void ) { return fpgaSensorReadings.fpgaD18PresTemp; } /*********************************************************************//** * @brief * The getFPGAD41PresReadCount function gets transmembrane pressure sensor counter of * good SPI transmissions between FPGA and Sensor. * @details \b Inputs: fpgaSensorReadings.fpgaD41PresReadCnt * @details \b Outputs: none * @return Latest transmembrane Pressure sensor read count *************************************************************************/ U08 getFPGAD41PresReadCount( void ) { return fpgaSensorReadings.fpgaD41PresReadCnt; } /*********************************************************************//** * @brief * The getFPGAD41PresErrorCount function gets transmembrane pressure sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaD41PresErrorCnt * @details \b Outputs: none * @return Latest transmembrane pressure sensor read error count *************************************************************************/ U08 getFPGAD41PresErrorCount( void ) { return fpgaSensorReadings.fpgaD41PresErrorCnt; } /*********************************************************************//** * @brief * The getFPGAD41PresRawPressure function gets transmembrane pressure sensor raw * pressure value. * @details \b Inputs: fpgaSensorReadings.fpgaD41PresPressure * @details \b Outputs: none * @return Latest transmembrane pressure sensor raw pressure data *************************************************************************/ U16 getFPGAD41PresRawPressure( void ) { return fpgaSensorReadings.fpgaD41PresPressure; } /*********************************************************************//** * @brief * The getFPGAD41PresRawTemperature function gets transmembrane pressure sensor raw * temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD41PresTemp * @details \b Outputs: none * @return Latest transmembrane pressure sensor raw temperature data *************************************************************************/ U16 getFPGAD41PresRawTemperature( void ) { return fpgaSensorReadings.fpgaD41PresTemp; } /*********************************************************************//** * @brief * The getFPGAM1PresRawPressure function gets water inlet input pressure sensor * raw pressure value. * @details \b Inputs: fpgaSensorReadings.fpgaM1PresPressure * @details \b Outputs: none * @return Latest water inlet input pressure sensor raw pressure data *************************************************************************/ U16 getFPGAM1PresRawPressure( void ) { return fpgaSensorReadings.fpgaM1PresPressure; } /*********************************************************************//** * @brief * The getFPGAM1RawTemperature function gets water inlet input pressure sensor * raw temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaM1PresTemp * @details \b Outputs: none * @return Latest water inlet input pressure sensor raw temperature data *************************************************************************/ U16 getFPGAM1PresRawTemperature( void ) { return fpgaSensorReadings.fpgaM1PresTemp; } /*********************************************************************//** * @brief * The getFPGAM1PresReadCount function gets water inlet input pressure sensor * counter of good SPI transmissions between FPGA and Sensor. * @details \b Inputs: fpgaSensorReadings.fpgaM1PresReadCnt * @details \b Outputs: none * @return Latest water inlet input pressure sensor read count *************************************************************************/ U08 getFPGAM1PresReadCount( void ) { return fpgaSensorReadings.fpgaM1PresReadCnt; } /*********************************************************************//** * @brief * The getFPGAM1PresErrorCount function gets water inlet input pressure * sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaM1PresErrorCnt * @details \b Outputs: none * @return Latest water inlet input pressure sensor read error count *************************************************************************/ U08 getFPGAM1PresErrorCount( void ) { return fpgaSensorReadings.fpgaM1PresErrorCnt; } /*********************************************************************//** * @brief * The getFPGAM3PresRawPressure function gets water inlet output pressure sensor * raw pressure value. * @details \b Inputs: fpgaSensorReadings.fpgaM3PresPressure * @details \b Outputs: none * @return Latest water inlet output pressure sensor raw pressure data *************************************************************************/ U16 getFPGAM3PresRawPressure( void ) { return fpgaSensorReadings.fpgaM3PresPressure; } /*********************************************************************//** * @brief * The getFPGAM3PresRawTemperature function gets water inlet output pressure sensor * raw temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaM3PresTemp * @details \b Outputs: none * @return Latest water inlet output pressure sensor raw temperature data *************************************************************************/ U16 getFPGAM3PresRawTemperature( void ) { return fpgaSensorReadings.fpgaM3PresTemp; } /*********************************************************************//** * @brief * The getFPGAM3PresReadCount function gets water inlet output pressure sensor * counter of good SPI transmissions between FPGA and Sensor. * @details \b Inputs: fpgaSensorReadings.fpgaM3PresReadCnt * @details \b Outputs: none * @return Latest water inlet output pressure sensor read count *************************************************************************/ U08 getFPGAM3PresReadCount( void ) { return fpgaSensorReadings.fpgaM3PresReadCnt; } /*********************************************************************//** * @brief * The getFPGAM3PresErrorCount function gets water inlet output pressure * sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaM3PresErrorCnt * @details \b Outputs: none * @return Latest water inlet output pressure sensor read error count *************************************************************************/ U08 getFPGAM3PresErrorCount( void ) { return fpgaSensorReadings.fpgaM3PresErrorCnt; } /*********************************************************************//** * @brief * The getFPGACD1ReadCount function gets D17 conductivity sensor read count. * @details \b Inputs: fpgaSensorReadings.fpgaD17CondReadCnt * @details \b Outputs: none * @return Latest D17 conductivity sensor read count *************************************************************************/ U08 getFPGAD17CondReadCount( void ) { return fpgaSensorReadings.fpgaD17CondReadCnt; } /*********************************************************************//** * @brief * The getFPGAD17CondErrorCount function gets D17 conductivity sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaD17CondErrorCnt * @details \b Outputs: none * @return Latest D17 conductivity sensor read error count *************************************************************************/ U08 getFPGAD17CondErrorCount( void ) { return fpgaSensorReadings.fpgaD17CondErrorCnt; } /*********************************************************************//** * @brief * The getFPGAD17Cond function gets D17 conductivity sensor value. * @details \b Inputs: fpgaSensorReadings.fpgaCD1 * @details \b Outputs: none * @return Latest D17 conductivity sensor value *************************************************************************/ U16 getFPGAD17Cond( void ) { return fpgaSensorReadings.fpgaD17CondCond; } /*********************************************************************//** * @brief * The getFPGAD17CondTemp function gets D17 conductivity sensor temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaCD1Temp * @details \b Outputs: none * @return Latest D17 conductivity sensor temperature value *************************************************************************/ U16 getFPGAD17CondTemp( void ) { return fpgaSensorReadings.fpgaD17CondTemp; } /*********************************************************************//** * @brief * The getFPGAD17CondData function gets D17 conductivity sensor register value. * @details \b Inputs: fpgaSensorReadings.fpgaD17CondDataOut * @details \b Outputs: none * @return Latest D17 conductivity sensor register data value *************************************************************************/ U32 getFPGAD17CondData( void ) { return fpgaSensorReadings.fpgaD17CondDataOut; } /*********************************************************************//** * @brief * The getFPGAD27CondReadCount function gets D27 conductivity sensor read count. * @details \b Inputs: fpgaSensorReadings.fpgaD27CondReadCnt * @details \b Outputs: none * @return Latest D27 conductivity sensor read count *************************************************************************/ U08 getFPGAD27CondReadCount( void ) { return fpgaSensorReadings.fpgaD27CondReadCnt; } /*********************************************************************//** * @brief * The getFPGAD27CondErrorCount function gets D27 conductivity sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaD27CondErrorCnt * @details \b Outputs: none * @return Latest D27 conductivity sensor read error count *************************************************************************/ U08 getFPGAD27CondErrorCount( void ) { return fpgaSensorReadings.fpgaD27CondErrorCnt; } /*********************************************************************//** * @brief * The getFPGAD27Cond function gets D27 conductivity sensor value. * @details \b Inputs: fpgaSensorReadings.fpgaD27Cond * @details \b Outputs: none * @return Latest D27 conductivity sensor value *************************************************************************/ U16 getFPGAD27Cond( void ) { return fpgaSensorReadings.fpgaD27CondCond; } /*********************************************************************//** * @brief * The getFPGAD27CondTemp function gets D27 conductivity sensor temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD27CondTemp * @details \b Outputs: none * @return Latest D27 conductivity sensor temperature value *************************************************************************/ U16 getFPGAD27CondTemp( void ) { return fpgaSensorReadings.fpgaD27CondTemp; } /*********************************************************************//** * @brief * The getFPGAD27CondData function gets D27 conductivity sensor register value. * @details \b Inputs: fpgaSensorReadings.fpgaD27CondDataOut * @details \b Outputs: none * @return Latest D27 conductivity sensor register data value *************************************************************************/ U32 getFPGAD27CondData( void ) { return fpgaSensorReadings.fpgaD27CondDataOut; } /*********************************************************************//** * @brief * The getFPGAD29CondReadCount function gets D29 conductivity sensor read count. * @details \b Inputs: fpgaSensorReadings.fpgaD29CondReadCnt * @details \b Outputs: none * @return Latest D29 conductivity sensor read count *************************************************************************/ U08 getFPGAD29CondReadCount( void ) { return fpgaSensorReadings.fpgaD29CondReadCnt; } /*********************************************************************//** * @brief * The getFPGAD29CondErrorCount function gets D29 conductivity sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaD29CondErrorCnt * @details \b Outputs: none * @return Latest D29 conductivity sensor read error count *************************************************************************/ U08 getFPGAD29CondErrorCount( void ) { return fpgaSensorReadings.fpgaD29CondErrorCnt; } /*********************************************************************//** * @brief * The getFPGAD29Cond function gets D29 conductivity sensor value. * @details \b Inputs: fpgaSensorReadings.fpgaD29Cond * @details \b Outputs: none * @return Latest D29 conductivity sensor value *************************************************************************/ U16 getFPGAD29Cond( void ) { return fpgaSensorReadings.fpgaD29CondCond; } /*********************************************************************//** * @brief * The getFPGAD29CondTemp function gets D29 conductivity sensor temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD29CondTemp * @details \b Outputs: none * @return Latest D29 conductivity sensor temperature value *************************************************************************/ U16 getFPGAD29CondTemp( void ) { return fpgaSensorReadings.fpgaD29CondTemp; } /*********************************************************************//** * @brief * The getFPGAD29CondData function gets D29 conductivity sensor register value. * @details \b Inputs: fpgaSensorReadings.fpgaD29CondDataOut * @details \b Outputs: none * @return Latest D29 conductivity sensor register data value *************************************************************************/ U32 getFPGAD29CondData( void ) { return fpgaSensorReadings.fpgaD29CondDataOut; } /*********************************************************************//** * @brief * The getFPGAD43CondReadCount function gets D43 conductivity sensor read count. * @details \b Inputs: fpgaSensorReadings.fpgaD43CondReadCnt * @details \b Outputs: none * @return Latest D43 conductivity sensor read count *************************************************************************/ U08 getFPGAD43CondReadCount( void ) { return fpgaSensorReadings.fpgaD43CondReadCnt; } /*********************************************************************//** * @brief * The getFPGAD43CondErrorCount function gets D43 conductivity sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaD43CondErrorCnt * @details \b Outputs: none * @return Latest D43 conductivity sensor read error count *************************************************************************/ U08 getFPGAD43CondErrorCount( void ) { return fpgaSensorReadings.fpgaD43CondErrorCnt; } /*********************************************************************//** * @brief * The getFPGAD43Cond function gets D43 conductivity sensor value. * @details \b Inputs: fpgaSensorReadings.fpgaD43Cond * @details \b Outputs: none * @return Latest D43 conductivity sensor value *************************************************************************/ U16 getFPGAD43Cond( void ) { return fpgaSensorReadings.fpgaD43CondCond; } /*********************************************************************//** * @brief * The getFPGAD43CondTemp function gets D43 conductivity sensor temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD43CondTemp * @details \b Outputs: none * @return Latest D43 conductivity sensor temperature value *************************************************************************/ U16 getFPGAD43CondTemp( void ) { return fpgaSensorReadings.fpgaD43CondTemp; } /*********************************************************************//** * @brief * The getFPGAD43CondData function gets D43 conductivity sensor register value. * @details \b Inputs: fpgaSensorReadings.fpgaD43CondDataOut * @details \b Outputs: none * @return Latest D43 conductivity sensor register data value *************************************************************************/ U32 getFPGAD43CondData( void ) { return fpgaSensorReadings.fpgaD43CondDataOut; } /*********************************************************************//** * @brief * The getFPGAD74CondReadCount function gets D74 conductivity sensor read count. * @details \b Inputs: fpgaSensorReadings.fpgaD74CondReadCnt * @details \b Outputs: none * @return Latest D74 conductivity sensor read count *************************************************************************/ U08 getFPGAD74CondReadCount( void ) { return fpgaSensorReadings.fpgaD74CondReadCnt; } /*********************************************************************//** * @brief * The getFPGAD74CondErrorCount function gets D74 conductivity sensor error count. * @details \b Inputs: fpgaSensorReadings.fpgaD74CondErrorCnt * @details \b Outputs: none * @return Latest D74 conductivity sensor read error count *************************************************************************/ U08 getFPGAD74CondErrorCount( void ) { return fpgaSensorReadings.fpgaD74CondErrorCnt; } /*********************************************************************//** * @brief * The getFPGAD74Cond function gets D74 conductivity sensor value. * @details \b Inputs: fpgaSensorReadings.fpgaD74Cond * @details \b Outputs: none * @return Latest D74 conductivity sensor value *************************************************************************/ U16 getFPGAD74Cond( void ) { return fpgaSensorReadings.fpgaD74CondCond; } /*********************************************************************//** * @brief * The getFPGAD74CondTemp function gets D74 conductivity sensor temperature value. * @details \b Inputs: fpgaSensorReadings.fpgaD74CondTemp * @details \b Outputs: none * @return Latest D74 conductivity sensor temperature value *************************************************************************/ U16 getFPGAD74CondTemp( void ) { return fpgaSensorReadings.fpgaD74CondTemp; } /*********************************************************************//** * @brief * The getFPGAD74CondData function gets D74 conductivity sensor register value. * @details \b Inputs: fpgaSensorReadings.fpgaD74CondDataOut * @details \b Outputs: none * @return Latest D74 conductivity sensor register data value *************************************************************************/ U32 getFPGAD74CondData( void ) { return fpgaSensorReadings.fpgaD74CondDataOut; } /*********************************************************************//** * @brief * The getFPGAD63LevelSensor function gets the latest FPGA D63 level sensor * reading. * @details \b Inputs: fpgaSensorReadings.fpgaD63LevelSensor * @details \b Outputs: none * @return last FPGA D63 level sensor reading *************************************************************************/ U16 getFPGAD63LevelSensor( void ) { return fpgaSensorReadings.fpgaD63LevelSensor; } /*********************************************************************//** * @brief * The getFPGAD46LevelSensor function gets the latest FPGA level sensor 2 * reading. * @details \b Inputs: fpgaSensorReadings.fpgaD46LevelSensor * @details \b Outputs: none * @return last FPGA level sensor2 reading *************************************************************************/ U16 getFPGAD46LevelSensor( void ) { return fpgaSensorReadings.fpgaD46LevelSensor; } /*********************************************************************//** * @brief * The getFPGAD6LevelStatus function gets the latest FPGA floater D6 level * reading. * @details \b Inputs: fpgaSensorReadings.fpgaD6FloaterStatus * @details \b Outputs: none * @return last FPGA floater D6 level reading *************************************************************************/ U08 getFPGAD6LevelStatus( void ) { return ( fpgaSensorReadings.fpgaD6FloaterStatus & FPGA_D6_FLOATER_LEVEL_BIT ); } /*********************************************************************//** * @brief * The getFPGAFloater2Status function gets the latest FPGA floater 2 level * reading. * @details \b Inputs: fpgaSensorReadings.fpgaFloater2Status * @details \b Outputs: none * @return last FPGA floater 2 level reading *************************************************************************/ U08 getFPGAFloater2Status( void ) { return fpgaSensorReadings.fpgaFloater2Status; } /*********************************************************************//** * @brief * The getFPGATimerCount function gets the latest FPGA timer millisecond count. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return last FPGA timer count *************************************************************************/ static U16 getFPGATimerCount( void ) { return fpgaSensorReadings.fpgaTimerCountMS; } /*********************************************************************//** * @brief * The getFPGAD1Temp function gets the inlet heat exchanger * temperature. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return inlet heat exchanger temperature *************************************************************************/ U32 getFPGAD1Temp( void ) { return fpgaSensorReadings.fpgaD1Temp; } /*********************************************************************//** * @brief * The getFPGAX6Temp function gets the outlet heat exchanger * temperature. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return outlet heat exchanger temperature *************************************************************************/ U32 getFPGAX6Temp( void ) { return fpgaSensorReadings.fpgaX6Temp; } /*********************************************************************//** * @brief * The getFPGAD4Temp function gets the hydraulics primary * heater temperature. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return hydraulics primary heater temperature *************************************************************************/ U32 getFPGAD4Temp( void ) { return fpgaSensorReadings.fpgaD4Temp; } /*********************************************************************//** * @brief * The getFPGAD50Temp function gets the trimmer heater temperature. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return trimmer heater temperature *************************************************************************/ U32 getFPGAD50Temp( void ) { return fpgaSensorReadings.fpgaD50Temp; } /*********************************************************************//** * @brief * The getFPGARTDReadCount function gets the RTD sensors group read count. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return RTD read count *************************************************************************/ U08 getFPGARTDReadCount( void ) { return fpgaSensorReadings.fpgaRTDReadCnt; } /*********************************************************************//** * @brief * The getFPGARTDCountErrorCycles function gets the FPGA incomplete sequences * of reads from RTD ADC. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return count of in-complete sequences of reads from RTD ADC. *************************************************************************/ U08 getFPGARTDCountErrorCycles( void ) { return fpgaSensorReadings.fpgaRTDCountErrorCycles; } /*********************************************************************//** * @brief * The getFPGABaroReadCount function gets the FPGA barometric sensor read count. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return barometric pressure sensor read count *************************************************************************/ U08 getFPGABaroReadCount( void ) { return fpgaSensorReadings.fpgaBaroReadCount; } /*********************************************************************//** * @brief * The getFPGABaroErrorCount function gets the FPGA barometric sensor error count. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return barometric pressure sensor error count *************************************************************************/ U08 getFPGABaroErrorCount( void ) { return fpgaSensorReadings.fpgaBaroErrorCount; } /*********************************************************************//** * @brief * The getFPGABaroMfgInfo function gets the FPGA barometric pressure * sensor manufacturing information. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return barometric pressure sensor manufacturing information *************************************************************************/ U16 getFPGABaroMfgInfo( void ) { return fpgaSensorReadings.fpgaBaroManufacInfo; } /*********************************************************************//** * @brief * The getFPGABaroPressureSensitivity function gets the FPGA barometric pressure * sensor sensitivity. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return barometric pressure sensor sensitivity *************************************************************************/ U16 getFPGABaroPressureSensitivity( void ) { return fpgaSensorReadings.fpgaBaroPROMCoeff1; } /*********************************************************************//** * @brief * The getFPGABaroPressureOffset function gets the FPGA barometric pressure * sensor offset. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return barometric pressure sensor offset *************************************************************************/ U16 getFPGABaroPressureOffset( void ) { return fpgaSensorReadings.fpgaBaroPROMCoeff2; } /*********************************************************************//** * @brief * The getFPGABaroTempCoeffOfPressSensitvity function gets the FPGA barometric * pressure sensor temperature coefficient of pressure sensitivity. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return barometric pressure sensor temperature coefficient of pressure sensitivity *************************************************************************/ U16 getFPGABaroTempCoeffOfPressSensitvity( void ) { return fpgaSensorReadings.fpgaBaroPROMCoeff3; } /*********************************************************************//** * @brief * The getFPGABaroTempCoeffOfPressOffset function gets the FPGA barometric * pressure sensor temperature coefficient of pressure offset. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return barometric pressure sensor temperature coefficient of pressure offset *************************************************************************/ U16 getFPGABaroTempCoeffOfPressOffset( void ) { return fpgaSensorReadings.fpgaBaroPROMCoeff4; } /*********************************************************************//** * @brief * The getFPGABaroReferenceTemperature function gets the FPGA barometric pressure * sensor reference temperature. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return barometric pressure sensor reference temperature *************************************************************************/ U16 getFPGABaroReferenceTemperature( void ) { return fpgaSensorReadings.fpgaBaroPROMCoeff5; } /*********************************************************************//** * @brief * The getFPGABaroTempCoeffOfTemperature function gets the FPGA barometric pressure * sensor temperature coefficient of temperature. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return barometric pressure sensor temperature coefficient of temperature *************************************************************************/ U16 getFPGABaroTempCoeffOfTemperature( void ) { return fpgaSensorReadings.fpgaBaroPROMCoeff6; } /*********************************************************************//** * @brief * The getFPGABaroCoeffsCRC function gets the FPGA barometric pressure * sensor temperature coefficients' CRC. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return barometric pressure sensor temperature coefficients' CRC *************************************************************************/ U16 getFPGABaroCoeffsCRC( void ) { return fpgaSensorReadings.fpgaBaroPROMCRC; } /*********************************************************************//** * @brief * The getFPGABaroPressure function gets the FPGA barometric pressure sensor * pressure. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return barometric pressure sensor pressure *************************************************************************/ U32 getFPGABaroPressure( void ) { return ( fpgaSensorReadings.fpgaBaroPressure & MASK_OFF_U32_MSB ); } /*********************************************************************//** * @brief * The getFPGABaroTemperature function gets the FPGA barometric pressure sensor * temperature. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return barometric pressure sensor temperature *************************************************************************/ U32 getFPGABaroTemperature( void ) { return ( fpgaSensorReadings.fpgaBaroTemperature & MASK_OFF_U32_MSB ); } /*********************************************************************//** * @brief * The checkFPGACommFailure function increments the FPGA comm failure * windowed timer and returns whether or not the number of failures in * the window have been reached. * @details \b Inputs: none * @details \b Outputs: none * @return TRUE if windowed count exceeded, else false. *************************************************************************/ void checkFPGACommFailure( void ) { if ( getMSTimerCount() > MIN_POWER_ON_TIME_FOR_COMM_FAILS ) { if ( TRUE == incTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_COMM_FAILURES ) ) { //TODO : Enable alarm later //SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_FPGA_COMM_TIMEOUT, MAX_FPGA_COMM_FAILURES, (U32)fpgaSensorReadings.fpgaIOErrorCntProcessor ) } } } /*********************************************************************//** * @brief * The getFPGAD11PumpRevolutionCountStatus function gets the current revolution of * acid concentrate pump (down counter). * @details \b Inputs: fpgaD11PumpStepCountStatus * @details \b Outputs: none * @return the current revolution of the acid concentrate pump *************************************************************************/ U16 getFPGAD11PumpRevolutionCountStatus( void ) { return fpgaSensorReadings.fpgaD11PumpStepCountStatus; } /*********************************************************************//** * @brief * The getFPGAD10PumpRevolutionCountStatus function gets the current revolution of * bicarb concentrate pump (down counter). * @details \b Inputs: fpgaD10PumpStepCountStatus * @details \b Outputs: none * @return the current revolution of the bicarb concentrate pump *************************************************************************/ U16 getFPGAD10PumpRevolutionCountStatus( void ) { return fpgaSensorReadings.fpgaD10PumpStepCountStatus; } /*********************************************************************//** * @brief * The getFPGAD76PumpRevolutionCountStatus function gets the current revolution of * UF pump (down counter) status. * @details \b Inputs: fpgaD76PumpStepCountStatus * @details \b Outputs: none * @return the current revolution of the UF pump *************************************************************************/ U16 getFPGAD76PumpRevolutionCountStatus( void ) { return fpgaSensorReadings.fpgaD76PumpStepCountStatus; } /*********************************************************************//** * @brief * The checkFPGAAFEOEFailure function increments the FPGA comm failure * windowed timer if an FE or OE error has occurred and returns whether * or not the number of failures in * the window have been reached. * @details \b Inputs: none * @details \b Outputs: none * @details \b Alarm: ALARM_ID_DD_FPGA_COMM_TIMEOUT when FPGA communication is * lost with the processor. * @return TRUE if windowed count exceeded, else false. *************************************************************************/ BOOL checkFPGAFEOEFailure( void ) { BOOL status = FALSE; BOOL FPGAFEOEError = getSci2FEOEError(); if ( TRUE == FPGAFEOEError) { if ( getMSTimerCount() > MIN_POWER_ON_TIME_FOR_COMM_FAILS ) { if ( TRUE == incTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_COMM_FAILURES ) ) { //TODO : Enable alarm later //SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_FPGA_COMM_TIMEOUT, MAX_FPGA_COMM_FAILURES, (U32)fpgaSensorReadings.fpgaIOErrorCntProcessor ) status = TRUE; } } } return status; } /**@}*/