Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -r498757853c009a4e25dec98461be91fcadd8057d -r66b5d24b111859a597259a2118f59a90da76e7f1 --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision 498757853c009a4e25dec98461be91fcadd8057d) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision 66b5d24b111859a597259a2118f59a90da76e7f1) @@ -38,14 +38,13 @@ // ********** private definitions ********** -#define FPGA_EXPECTED_ID 0x02 ///< FPGA expected ID. +#define FPGA_EXPECTED_ID 0x04 ///< 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_ENABLE_SPARE_VALVES_CNTRL 0x00 ///< FPGA enable spared valves control. #define FPGA_D17_RESET_BIT 0x01 ///< Conductivity Sensor D17 reset bit mask. #define FPGA_D17_INIT_ENABLE_BIT 0x02 ///< Conductivity Sensor D17 Initialization enable bit mask. @@ -88,277 +87,250 @@ #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 +#define FPGA_CONDUCTIVITY_RESET_BIT 0x01 ///< Conductivity Sensor reset bit mask. +#define FPGA_CONDUCTIVITY_INIT_ENABLE_BIT 0x02 ///< Conductivity Sensor initialization enable bit mask. +#define FPGA_CONDUCTIVITY_WR_ENABLE_BIT 0x04 ///< Conductivity Sensor write enable bit mask. +#define FPGA_CONDUCTIVITY_RD_ENABLE_BIT 0x08 ///< Conductivity Sensor read enable bit mask. + #pragma pack(push,1) /// FPGA header struct. typedef struct { - U08 fpgaId; ///< Reg 0. FPGA ID code. Checked against expected value at power up to verify basic FPGA communication and operation - U08 fpgaRevMinor; ///< Reg 1. FPGA revision (minor) being reported - U08 fpgaRevMajor; ///< Reg 2. FPGA revision (major) being reported - U08 fpgaRevLab; ///< Reg 3. FPGA revision (lab) being reported + 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) + U16 fpgaCompatibilityRev; ///< Reg 512. Compatibility revision + U16 fpgaTimerCountMS; ///< Reg 514. Internal FPGA timer count in milliseconds + U16 fpgaRemoteUpdateRead; ///< Reg 516. FPGA Remote Update Read ( copy contents from remote update write) + U08 fpgaIOErrorCntProcessor; ///< Reg 518. Number of errors in Microprocessor UART interface + U08 fpgaIOErrorCntPC; ///< Reg 519. Number of errors in PC UART interface + U16 fpgaD9PresPressure; ///< Reg 520. D9 MPM pressure sensor RAW pressure data + U16 fpgaD9PresTemp; ///< Reg 522. D9 MPM pressure sensor RAW temperature data + U16 fpgaD66PresPressure; ///< Reg 524. D66 MPM pressure sensor RAW pressure data + U16 fpgaD66PresTemp; ///< Reg 526. D66 MPM pressure sensor RAW temperature data + U16 fpgaD51PresPressure; ///< Reg 528. D51 MPM pressure sensor RAW pressure data + U16 fpgaD51PresTemp; ///< Reg 530. D51 MPM pressure sensor RAW temperature data + U16 fpgaD18PresPressure; ///< Reg 532. D18 MPM pressure sensor RAW pressure data + U16 fpgaD18PresTemp; ///< Reg 534. D18 MPM pressure sensor RAW temperature data + U16 fpgaD41PresPressure; ///< Reg 536. D41 MPM pressure sensor RAW pressure data + U16 fpgaD41PresTemp; ///< Reg 538. D41 MPM pressure sensor RAW temperature data + U32 fpgaD17CondDataOut; ///< Reg 540. Data read from Conductivity Sensor 1 register + U16 fpgaD17CondCond; ///< Reg 544. D17 conductivity + U16 fpgaD17CondTemp; ///< Reg 546. D17 Temperature + U08 fpgaD17CondReadCnt; ///< Reg 548. D17 successful read count + U08 fpgaD17CondErrorCnt; ///< Reg 549. D17 error read count + U32 fpgaD27CondDataOut; ///< Reg 550. Data read from Conductivity Sensor 2 register + U16 fpgaD27CondCond; ///< Reg 554. D27 conductivity + U16 fpgaD27CondTemp; ///< Reg 556. D27 Temperature + U08 fpgaD27CondReadCnt; ///< Reg 558. D27 successful read count + U08 fpgaD27CondErrorCnt; ///< Reg 559. D27 error read count + U32 fpgaD29CondDataOut; ///< Reg 560. Data read from Conductivity Sensor 3 register + U16 fpgaD29CondCond; ///< Reg 564. D29 conductivity + U16 fpgaD29CondTemp; ///< Reg 566. D29 Temperature + U08 fpgaD29CondReadCnt; ///< Reg 568. D29 successful read count + U08 fpgaD29CondErrorCnt; ///< Reg 569. D29 error read count + U32 fpgaD43CondDataOut; ///< Reg 570. Data read from Conductivity Sensor 4 register + U16 fpgaD43CondCond; ///< Reg 574. D43 conductivity + U16 fpgaD43CondTemp; ///< Reg 576. D43 Temperature + U08 fpgaD43CondReadCnt; ///< Reg 578. D43 successful read count + U08 fpgaD43CondErrorCnt; ///< Reg 579. D43 error read count + U16 fpgaD63LevelSensor; ///< Reg 580. Level Sensor 1 + U16 fpgaD46LevelSensor; ///< Reg 582. Level Sensor 2 + U08 fpgaHallSensInputs; ///< Reg 584. Hall sensor Inputs + U08 fpgaD42TxFIFOCnt; ///< Reg 585. Blood leak sensor transmit FIFO count + U16 fpgaD42RxErrorCnt; ///< Reg 586. Blood leak sensor Receive error count + U16 fpgaD42RxFIFOCnt; ///< Reg 588. Blood leak sensor Receive FIFO count + U08 fpgaD42RxFIFODataOut; ///< Reg 590. Blood leak sensor Receive data + U08 fpgaD42PulseStatus; ///< Reg 591. Blood leak sensor status + U16 fpgaValveStates; ///< Reg 592. Valve status read + U16 fpgaValvePWMEnableStates; ///< Reg 594. Valve PWM Enable status read + U08 fpgaValveBCStates; ///< Reg 596. Balancing chamber Valves states + U08 fpgaValveBCPWMStates; ///< Reg 597. Balancing Chamber Valve PWM states + U08 fpgaValveSpStates; ///< Reg 598. DD Spare Valves states + U08 fpgaValveSpPWMStates; ///< Reg 599. Spare Valves PWM states + U08 fpgaD11_D10_PumpFault; ///< Reg 600. Concentrate pump fault register for D11_Pump and D10_Pump + U08 fpgaRTDCountErrorCycles; ///< Reg 601. Count of each incomplete seq of reads from RTD ADC. + U16 fpgaD11PumpHallSense; ///< Reg 602. Concentrate pump D11_Pump hall sensor pulse width + U16 fpgaD10PumpHallSense; ///< Reg 604. Concentrate pump D10_Pump hall sensor pulse width + U32 fpgaX6Temp; ///< Reg 606. Outlet heat exchanger temperature + U32 fpgaD1Temp; ///< Reg 610. Inlet heat exchanger temperature + U32 fpgaD4Temp; ///< Reg 614. Hydraulics primary heater temperature + U32 fpgaD50Temp; ///< Reg 618. Trimmer heater temperature + U08 fpga_UnUsed_1; ///< Reg 622. Not used + U08 fpgaRTDReadCnt; ///< Reg 623. Read count for all RTD sensors + U16 fpgaD12MeasuredSpeed; ///< Reg 624. Fresh dialysate pump measured speed + U16 fpgaD48MeasuredSpeed; ///< Reg 626. Spent dialysate pump measured speed + U08 fpga_UnUsed_2; ///< Reg 628. Not used + U08 fpgaD12D48PumpStatus; ///< Reg 629. Dialysate pumps Error status + U16 fpgaD12CurrentFeedback; ///< Reg 630. Fresh dialysate pump current feedback + U16 fpgaD48CurrentFeedback; ///< Reg 632. Spent dialysate pump current feedback + U08 fpgaD12HallStatus; ///< Reg 634. Fresh dialysate pump hall sensor direction status + U08 fpgaD48HallStatus; ///< Reg 635. Spent dialysate pump hall sensor direction status + U08 fpgaD6FloaterStatus; ///< Reg 636. Floater 1 level sensor status + U08 fpgaFloater2Status; ///< Reg 637. Floater 2 level sensor status + U16 fpgaD11PumpStepCountStatus; ///< Reg 638. Acid concentrate pump revolution down count status + U16 fpgaD10PumpStepCountStatus; ///< Reg 640. Bicarb concentrate pump revolution down count status + U16 fpgaAdcTemp; ///< Reg 642. TBD + U16 fpgaAdcVccInt; ///< Reg 644. TBD + U16 fpgaAdcVccAux; ///< Reg 646. TBD + U16 fpgaAdcVpVn; ///< Reg 648. TBD + U16 fpgaD12PumpSpeedFeedback; ///< Reg 650. D12 Pump speed feedback + U16 fpgaD48PumpSpeedFeedback; ///< Reg 652. D48 Pump Speed feedback + U16 fpgaD76PumpHallSense; ///< Reg 654. UF D76_Pump hall sensor pulse width + U16 fpgaD76PumpStepCountStatus; ///< Reg 656. UF pump revolution down count status + U08 fpgaD76PumpFault; ///< Reg 658: UF pump fault + U08 fpga_UnUsed_3; ///< reg 659: Not used - U08 fpgaIOErrorCntProcessor; ///< Reg 262. Number of errors in Microprocessor UART interface - U08 fpgaIOErrorCntPC; ///< Reg 263. Number of errors in PC UART interface + S16 pressureM1; ///< Reg 660. M1 pressure data. + U16 temperatureM1; ///< Reg 662. M1 temperature data. + S16 pressureM3; ///< Reg 664. M3 pressure data. + U16 temperatureM3; ///< Reg 666. M3 temperature data. + S16 pressureP8; ///< Reg 668. P8 pressure data. + U16 temperatureP8; ///< Reg 670. P8 temperature data. + S16 pressureP13; ///< Reg 672. P13 pressure data. + U16 temperatureP13; ///< Reg 674. P13 temperature data. + S16 pressureP17; ///< Reg 676. P17 pressure data. + U16 temperatureP17; ///< Reg 678. P17 temperature data. + U16 p40PumpTachCount; ///< Reg 680. P40 pump tachometer counter. + U08 p25LevelSwitch; ///< Reg 682. P25 level switch. + U08 reserved4; ///< Reg 683. Reserved. + U32 conductivityP9Data; ///< Reg 684. P9 conductivity sensor data. + U16 conductivityP9Cond; ///< Reg 688. P9 conductivity sensor conductivity. + U16 conductivityP9Temp; ///< Reg 690. P9 conductivity sensor temperature. + U08 conductivityP9ReadCount; ///< Reg 692. P9 conductivity sensor read counter. + U08 conductivityP9ErrorCount; ///< Reg 693. P9 conductivity sensor error counter. + U32 conductivityP18Data; ///< Reg 694. P18 conductivity sensor data. + U16 conductivityP18Cond; ///< Reg 698. P18 conductivity sensor conductivity. + U16 conductivityP18Temp; ///< Reg 700. P18 conductivity sensor temperature. + U08 conductivityP18ReadCount; ///< Reg 702. P18 conductivity sensor read counter. + U08 conductivityP18ErrorCount; ///< Reg 703. P18 conductivity sensor error counter. + U16 flowRateP7; ///< Reg 704. P7 flow sensor rate. + U16 flowTempP7; ///< Reg 706. P7 flow sensor temperature. + U16 p12PumpTachCount; ///< Reg 708. P12 pump tachometer counter. + U16 dsPumpTachCount; ///< Reg 710. DSP tachometer counter. + U16 flowIntTempP7; ///< Reg 712. P7 flow sensor internal temperature. + U08 valveControlReadback; ///< Reg 714. Valve control bits read back. + U08 valvePWMEnableReadback; ///< Reg 715. Valve PWM enable read back. + U16 p12PumpPWMReadback; ///< Reg 716. P12 pump PWM read back. + U16 p40PumpPWMReadback; ///< Reg 718. P40 pump PWM read back. + U08 p7flowReadCount; ///< Reg 720. P7 Flow sensor read counter. + U08 p7flowErrorCount; ///< Reg 721. P7 Flow sensor error counter. + U32 tempP23; ///< Reg 722. P23 temperature sensor reading. + U32 tempP22; ///< Reg 726. P22 ( TRO2 ) temperature sensor reading. + U32 tempTax1; ///< Reg 730. ( Tax1 ) temperature sensor reading. + U32 tempRTD; ///< Reg 734. spare temperature sensor reading. + U08 ad7124errcnt; ///< Reg 738. Counter which increments when an invalid transaction happen between FPGA and AD7124. + U08 ad7124readcnt; ///< Reg 739. Counter which increments when a valid transaction happens between FPGA and AD7124. + U16 flowRateP16; ///< Reg 740. P16 flow sensor rate. + U16 flowTempP16; ///< Reg 742. P16 flow sensor temperature. + U16 flowIntTempP16; ///< Reg 744. P16 flow sensor internal temperature. + U08 p16flowReadCount; ///< Reg 746. P16 Flow sensor read counter. + U08 p16flowErrorCount; ///< Reg 747. P16 Flow sensor error counter. - 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 - U08 fpgaD76PumpFault; ///< Reg 448: UF pump fault - - U32 fpgaD74CondDataOut; ///< Reg 449. Data read from Conductivity Sensor D74 register - U16 fpgaD74CondCond; ///< Reg 453. D74 conductivity - U16 fpgaD74CondTemp; ///< Reg 455. D74 Temperature - U08 fpgaD74CondReadCnt; ///< Reg 457. D74 successful read count - U08 fpgaD74CondErrorCnt; ///< Reg 458. D74 error read count + U32 fpgaD74CondDataOut; ///< Reg 748. Data read from Conductivity Sensor D74 register + U16 fpgaD74CondCond; ///< Reg 752. D74 conductivity + U16 fpgaD74CondTemp; ///< Reg 754. D74 Temperature + U08 fpgaD74CondReadCnt; ///< Reg 756. D74 successful read count + U08 fpgaD74CondErrorCnt; ///< Reg 757. 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 fpgaValveControl; ///< Reg 04. Valve control register + U16 fpgaValvePWMEnable; ///< Reg 06. Valve PWM enable + U16 fpgaDDValvePWMLow; ///< Reg 08. DD valves PWM low. (VDR) + U16 fpgaDDValvePWMPeriod; ///< Reg 10. DD valves PWM period (VDR) + U16 fpgaDDValvePWMPullin; ///< Reg 12. DD valves pull in (VDR) + U08 fpgaBCValveControl; ///< Reg 14. Balancing Chamber Valves Control Registers + U08 fpgaBCValvePWMControl; ///< Reg 15. Balancing Chamber Valves PWM control + U08 fpgaDDSpareValveControl; ///< Reg 16. Spare Valves Control Registers + U08 fpgaDDSpareValvePWMControl; ///< Reg 17. Ultra filtration Valves PWM control + U08 fpgaConSensTD12Control; ///< Reg 18. Conductivity/Temperature Sensors D17 & D27 Control registers + U08 fpgaConSensTD34Control; ///< Reg 19. Conductivity/Temperature Sensors D29 & D43 Control registers + U16 fpgaConSensTD12_Addrs; ///< Reg 20. D16,D17 Initialization Address register + U32 fpgaConSensTD12_Data_In; ///< Reg 22. D16,D17 Initialization data register + U16 fpgaConSensTD34_Addrs; ///< Reg 26. D27,D28 Initialization Address register + U32 fpgaConSensTD34_Data_In; ///< Reg 28. D27,D28 Initialization data register + U16 fpgaRemoteUpdate_Write; ///< Reg 32.Register for Remote update used by SW. + U16 fpgaD12PumpSpeed; ///< Reg 34. D48 Speed/RPM Control + U08 fpgaD12PumpControl; ///< Reg 36. DGP Control + U08 fpgaD48PumpControl; ///< Reg 37. SDP Control + U16 fpgaD48PumpSpeed; ///< Reg 38. SDP Speed/RPM Control + U16 fpgaD11PumpSpeed; ///< Reg 40. Acid Concentrate Pump Speed/RPM Control + U08 fpgaD11PumpControl; ///< Reg 42. Acid Concentrate Pump Control + U08 fpgaD10PumpControl; ///< Reg 43. BiCarb Concentrate Pump Control + U16 fpgaD10PumpSpeed; ///< Reg 44. BiCarb Concentrate Pump Speed/RPM Control + U08 fpgaD42SensorTest; ///< Reg 46. Blood leak sensor test + U08 fpgaD42UARTControl; ///< Reg 47. Blood leak sensor UART control + U08 fpgaD42FIFOTx; ///< Reg 48. Blood leak sensor FIFO transmit control + U08 fpgaD5HeaterPWMControl; ///< Reg 49. Primary heater PWM control + U08 fpgaD45HeaterPWMControl; ///< Reg 50. Trimmer heater PWM control + U08 fpgaNotUsed; ///< Reg 51. Not used + U16 fpgaVBCPWMLow; ///< Reg 52. VBC PWM low ( Balancing chamber valves) + U16 fpgaVBCPWMPeriod; ///< Reg 54. VBC PWM period + U16 fpgaVBCPWMPullin; ///< Reg 56. VBC PWM pull in + U16 fpgaVSPPWMLow; ///< Reg 58. VSP PWM low ( Spare valves ) + U16 fpgaVSPPWMPeriod; ///< Reg 60. VSP PWM period + U16 fpgaVSPPWMPullin; ///< Reg 62. VSP PWM pull in + U16 fpgaD11PumpRevCount; ///< Reg 64. Acid Concentrate pump revolution count + U16 fpgaD10PumpRevCount; ///< Reg 66. Bicarb Concentrate pump revolution count + U08 fpgaADCControl; ///< Reg 68. FPGA internal ADC Control register for debugging + U08 fpgaGPIOControl; ///< Reg 69. FPGA GPIO control interface + U16 fpgaACRelayPWMLow; ///< Reg 70. Length of time in 10us resoultion that PWM output stays low. + U16 fpgaACRelayPWMPeriod; ///< Reg 72. PWM period for AC relay/heater. + U16 fpgaD76PumpSpeed; ///< Reg 74. UF Pump Speed/RPM Control + U16 fpgaD76PumpRevCount; ///< Reg 76. UF pump revolution count + U08 fpgaD76PumpControl; ///< Reg 78. UF Pump Control - 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) + U08 valveControl; ///< Reg 79. Valve control register. + U08 conductivityP9Control; ///< Reg 80. P9 conductivity control register. + U08 conductivityP18Control; ///< Reg 81. P18 conductivity control register. + U16 conductivityP9Address; ///< Reg 82. P9 conductivity address register. + U32 conductivityP9Data; ///< Reg 84. P9 conductivity data in register. + U16 conductivityP18Address; ///< Reg 88. P18 conductivity address register. + U32 conductivityP18Data; ///< Reg 90. P18 conductivity data in register. + U16 fpgaGenWrRd; ///< Reg 94. FPGA general write/read-back register (mirrored to a general read register in read page at addr 256). + U16 descalePumpSpeed; ///< Reg 96. Descaler pump speed register. + U08 descalePumpControl; ///< Reg 98. Descaler pump control register. + U08 p12PumpControl; ///< Reg 99. P12 pump control register. + U16 valveVwiPWMLow; ///< Reg 100. Valve VWi PWM low pulse period in 0.1 uSec. + U16 valveVwiPWMPeriod; ///< Reg 102. Valve VWi PWM full period in 0.1 uSec. + U16 valvePWMPullIn; ///< Reg 104. Valve PWM high pulse period when valve is on in 0.1 uSec. + U16 p12PumpPWMDutyCyclePct; ///< Reg 106. P12 pump PWM duty cycle in percentage. + U16 p40PumpPWMDutyCyclePct; ///< Reg 108. P40 pump PWM duty cycle in percentage. + U08 p40PumpControl; ///< Reg 110. P40 pump control register. + U08 reserved1; ///< Reg 111. Reserved. + U08 flowControlp7; ///< Reg 112. P7 AVS Romer flow sensor control register. + U08 flowAddressp7; ///< Reg 113. P7 AVS Romer flow sensor I2C slave address register. + U08 valvePWMEnable; ///< Reg 114. Valve PWM enable register. + U08 flowControlp16; ///< Reg 115. P16 AVS Romer flow sensor control register. + U08 flowAddressp16; ///< Reg 116. P16 AVS Romer flow sensor I2C slave address register. - 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 + U08 fpgaConSensD74Control; ///< Reg 117. Conductivity/Temperature Sensors D74 Control registers + U16 fpgaConSensD74_Addrs; ///< Reg 118. D74 Initialization Address register + U32 fpgaConSensD74_Data_In; ///< Reg 120. D74 Initialization data register - 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) @@ -390,17 +362,14 @@ 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; + fpgaActuatorSetPoints.fpgaValveControl = FPGA_ENABLE_VALVES_CONTROL; + fpgaActuatorSetPoints.fpgaValvePWMEnable = FPGA_ENABLE_VALVES_PWM; + fpgaActuatorSetPoints.fpgaBCValveControl = FPGA_ENABLE_BC_VALVES_CONTROL; + fpgaActuatorSetPoints.fpgaBCValvePWMControl = FPGA_ENABLE_BC_VALVES_PWM; + fpgaActuatorSetPoints.fpgaDDSpareValveControl = FPGA_ENABLE_SPARE_VALVES_CNTRL; + fpgaActuatorSetPoints.fpgaDDSpareValvePWMControl = FPGA_ENABLE_UF_VALVES_PWM; + fpgaActuatorSetPoints.fpgaADCControl = FPGA_ADC_AUTO_READ_ENABLE; // initialize FPGA clock speed error time windowed count initTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_COMM_FAILURES, MAX_FPGA_COMM_FAILURES, MAX_FPGA_COMM_FAILURES_WINDOW_MS); @@ -482,7 +451,7 @@ /*********************************************************************//** * @brief - * The setFPGAValveStates function sets the DD valve states with a 16-bit + * The setFPGADDValveStates function sets the DD valve states with a 16-bit * set of states - one bit per valve, with a 1 meaning "energized" and a 0 * meaning "de-energized". The bit positions for these bit states are as follows: * 0 - D53Valve.\n @@ -505,7 +474,7 @@ * @param valveStates bit mask for the various valve states * @return none *************************************************************************/ -void setFPGAValveStates( U16 valveStates ) +void setFPGADDValveStates( U16 valveStates ) { fpgaActuatorSetPoints.fpgaValveControl = valveStates; } @@ -535,22 +504,22 @@ /*********************************************************************//** * @brief - * The setFPGAUFValveStates function sets the DD ultrafiltration valve states with a + * The setFPGAUFValveStates function sets the DD spare valve states with a * 8-bit set of states - one bit per valve, with a 1 meaning "energized" and a 0 * meaning "de-energized". The bit positions for these bit states are as follows: - * 0 - UFi1.\n - * 1 - UFi2.\n - * 2 - UFo1.\n - * 3 - UFo2.\n + * 0 - Not used.\n + * 1 - Not used.\n + * 2 - Not used.\n + * 3 - Not used.\n * 4..7 - Unused or reserved.\n * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaUFValveControl - * @param valveStates bit mask for the balancing chamber valve states + * @details \b Outputs: fpgaActuatorSetPoints.fpgaDDSpareValveControl + * @param valveStates bit mask for the spare valve states * @return none *************************************************************************/ void setFPGAUFValveStates( U08 valveStates ) { - fpgaActuatorSetPoints.fpgaUFValveControl = valveStates; + fpgaActuatorSetPoints.fpgaDDSpareValveControl = valveStates; } /*********************************************************************//** @@ -2045,13 +2014,13 @@ /*********************************************************************//** * @brief - * The getFPGAValveStates function gets the latest sensed valve states. - * See setFPGAValveStates for valve state bit positions. + * The getFPGADDValveStates function gets the latest sensed valve states. + * See setFPGADDValveStates for valve state bit positions. * @details \b Inputs: fpgaSensorReadings.fpgaValveStates * @details \b Outputs: none * @return last valve states reading *************************************************************************/ -U16 getFPGAValveStates( void ) +U16 getFPGADDValveStates( void ) { return fpgaSensorReadings.fpgaValveStates; } @@ -2072,45 +2041,20 @@ /*********************************************************************//** * @brief - * The getFPGAValveUFStates function gets the latest sensed ultrafiltration + * The getFPGAValveSpStates function gets the latest sensed spare * valve states. - * See setFPGAUFValveStates for UF valve state bit positions. - * @details \b Inputs: fpgaSensorReadings.fpgaValveUFStates + * See setFPGAUFValveStates for Spare valve state bit positions. + * @details \b Inputs: fpgaSensorReadings.fpgaValveSpStates * @details \b Outputs: none - * @return last ultrafiltration valve states reading + * @return last spare valve states reading *************************************************************************/ -U08 getFPGAValveUFStates( void ) +U08 getFPGAValveSpStates( void ) { - return fpgaSensorReadings.fpgaValveUFStates; + return fpgaSensorReadings.fpgaValveSpStates; } /*********************************************************************//** * @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 @@ -2137,31 +2081,6 @@ /*********************************************************************//** * @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 @@ -2188,31 +2107,6 @@ /*********************************************************************//** * @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 @@ -2239,31 +2133,6 @@ /*********************************************************************//** * @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 @@ -2290,31 +2159,6 @@ /*********************************************************************//** * @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 @@ -2341,110 +2185,6 @@ /*********************************************************************//** * @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 @@ -2885,160 +2625,6 @@ /*********************************************************************//** * @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. @@ -3224,4 +2810,808 @@ return fpgaSensorReadings.fpgaD42RxFIFODataOut; } +/*********************************************************************//** + * @brief + * The setFPGAIOFPValveStates function sets the RO valve states with an 8-bit + * mask of states - one bit per valve, with a 1 meaning "energized" and a 0 + * meaning "de-energized". The bit positions for these bit states are as follows: + * 0 - VWi.\n + * 1 - VFb.\n + * 2 - VFf.\n + * 3 - VPi.\n + * 4 - VCr.\n + * 5 - VCb.\n + * 6 - VCd.\n + * 7 - VROd.\n + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.valveControl + * @param valveStates bit mask for requested valve states + * @return none + *************************************************************************/ +void setFPGAIOFPValveStates( U08 valveStates ) +{ + fpgaActuatorSetPoints.valveControl = valveStates; +} + +/*********************************************************************//** + * @brief + * The getFPGAValveStates function gets the RO valve commanded states with + * an 8-bit mask representing the set of states with a 1 meaning "energized" + * and a 0 meaning "de-energized". + * @details \b Inputs: none + * @details \b Outputs: fpgaSensorReadings.valveControlReadback + * @return none + *************************************************************************/ +U08 getFPGAValveStates( void ) +{ + return fpgaSensorReadings.valveControlReadback; +} + +/*********************************************************************//** + * @brief + * The setFPGAP12PumpEnable function enables or disables the P12 pump. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.p12PumpControl + * @param enable flag indicating whether to enable or disable the P12 pump. + * @return none + *************************************************************************/ +void setFPGAP12PumpEnable( BOOL enable ) +{ + fpgaActuatorSetPoints.p12PumpControl = ( TRUE == enable ? 0x1 : 0x0 ); +} + +/*********************************************************************//** + * @brief + * The setFPGAP12PumpPWM function sets the P12 pump PWM duty cycle. + * The higher the PWM duty cycle (0..500), the faster the pump will go. + * @note PWM values < 5% or > 95% will cause pump to stop so effective + * range is actually 25..475. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.p12PumpPWMDutyCyclePct + * @param pwm PWM duty cycle magnitude + * @return none + *************************************************************************/ +void setFPGAP12PumpPWM( U16 pwm ) +{ + fpgaActuatorSetPoints.p12PumpPWMDutyCyclePct = pwm; +} + +/*********************************************************************//** + * @brief + * The getFPGAP12PumpPWM function gets a read back from FPGA of RO pump PWM + * duty cycle. + * @details \b Inputs: fpgaSensorReadings.roPumpPWMReadback + * @details \b Outputs: none + * @return measured speed (RPM) of the RO pump + *************************************************************************/ +U16 getFPGAP12PumpPWM( void ) +{ + return fpgaSensorReadings.p12PumpPWMReadback; +} + +/*********************************************************************//** + * @brief + * The getFPGAP12PumpTachCount function gets the running 16-bit tachometer count + * from the P12 pump hall sensor. + * @details \b Inputs: fpgaSensorReadings.p12PumpTachCount + * @details \b Outputs: none + * @return P12 pump tachometer count + *************************************************************************/ +U16 getFPGAP12PumpTachCount( void ) +{ + return fpgaSensorReadings.p12PumpTachCount; +} + +/*********************************************************************//** + * @brief + * The setFPGAP24Enabled function sets the heater enable on or off. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.p24Control + * @param enable Flag indicating whether to enable or disable the P24 heater. + * @return none + *************************************************************************/ +void setFPGAP24Enabled( BOOL enable ) +{ + return; +} + +/*********************************************************************//** + * @brief + * The setFPGAP24PWM function sets the P24 heater PWM duty cycle. + * The higher the PWM duty cycle (0..500), the faster the pump will go. + * @note PWM values < 5% or > 95% will cause heater to go off so effective + * range is actually 25..475. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.p24PWMDutyCyclePct + * @param pwm PWM duty cycle magnitude + * @return none + *************************************************************************/ +void setFPGAP24PWM( U16 pwm ) +{ + return; +} + +/*********************************************************************//** + * @brief + * The getFPGAM1RawPressure function gets the M1 pressure reading. + * @details \b Inputs: fpgaSensorReadings.pressureM1 + * @details \b Outputs: none + * @return M1 pressure + *************************************************************************/ +S16 getFPGAM1RawPressure( void ) +{ + return fpgaSensorReadings.pressureM1; +} + +/*********************************************************************//** + * @brief + * The getFPGAM1RawTemperature function gets the M1 sensor temperature reading. + * @details \b Inputs: fpgaSensorReadings.temperatureM1 + * @details \b Outputs: none + * @return M1 sensor temperature + *************************************************************************/ +S16 getFPGAM1RawTemperature( void ) +{ + return fpgaSensorReadings.temperatureM1; +} + +/*********************************************************************//** + * @brief + * The getFPGAM3RawPressure function gets the M3 pressure reading. + * @details \b Inputs: fpgaSensorReadings.pressureM3 + * @details \b Outputs: none + * @return M3 pressure + *************************************************************************/ +S16 getFPGAM3RawPressure( void ) +{ + return fpgaSensorReadings.pressureM3; +} + +/*********************************************************************//** + * @brief + * The getFPGAM3RawTemperature function gets the M3 sensor temperature. + * @details \b Inputs: fpgaSensorReadings.temperatureM3 + * @details \b Outputs: none + * @return M3 sensor temperature + *************************************************************************/ +S16 getFPGAM3RawTemperature( void ) +{ + return fpgaSensorReadings.temperatureM3; +} + +/*********************************************************************//** + * @brief + * The getFPGAP8RawPressure function gets the P8 pressure reading. + * @details \b Inputs: fpgaSensorReadings.pressureP8 + * @details \b Outputs: none + * @return P8 pressure + *************************************************************************/ +S16 getFPGAP8RawPressure( void ) +{ + return fpgaSensorReadings.pressureP8; +} + +/*********************************************************************//** + * @brief + * The getFPGAP8RawTemperature function gets the P8 sensor temperature. + * @details \b Inputs: fpgaSensorReadings.temperatureP8 + * @details \b Outputs: none + * @return P8 sensor temperature + *************************************************************************/ +S16 getFPGAP8RawTemperature( void ) +{ + return fpgaSensorReadings.temperatureP8; +} + +/*********************************************************************//** + * @brief + * The getFPGAP13RawPressure function gets the P13 pressure reading. + * @details \b Inputs: fpgaSensorReadings.pressureP13 + * @details \b Outputs: none + * @return P13 pressure + *************************************************************************/ +S16 getFPGAP13RawPressure( void ) +{ + return fpgaSensorReadings.pressureP13; +} + +/*********************************************************************//** + * @brief + * The getFPGAP13RawTemperature function gets the P13 sensor temperature. + * @details \b Inputs: fpgaSensorReadings.temperatureP13 + * @details \b Outputs: none + * @return P13 sensor temperature + *************************************************************************/ +S16 getFPGAP13RawTemperature( void ) +{ + return fpgaSensorReadings.temperatureP13; +} + +/*********************************************************************//** + * @brief + * The getFPGAP17RawPressure function gets the P17 pressure reading. + * @details \b Inputs: fpgaSensorReadings.pressureP17 + * @details \b Outputs: none + * @return P17 pressure + *************************************************************************/ +S16 getFPGAP17RawPressure( void ) +{ + return fpgaSensorReadings.pressureP17; +} + +/*********************************************************************//** + * @brief + * The getFPGAP17RawTemperature function gets the P17 sensor temperature. + * @details \b Inputs: fpgaSensorReadings.temperatureP17 + * @details \b Outputs: none + * @return P17 sensor temperature + *************************************************************************/ +S16 getFPGAP17RawTemperature( void ) +{ + return fpgaSensorReadings.temperatureP17; +} + +/*********************************************************************//** + * @brief + * The getFPGAP23Temperature function gets the P23 temperature sensor reading. + * @details \b Inputs: fpgaSensorReadings.tempP23 + * @details \b Outputs: none + * @return P23 temperature sensor reading + *************************************************************************/ +U32 getFPGAP23Temperature( void ) +{ + return fpgaSensorReadings.tempP23; +} + +/*********************************************************************//** + * @brief + * The getFPGAP22Temperature function gets the P22 temperature sensor reading. + * @details \b Inputs: fpgaSensorReadings.tempP22 + * @details \b Outputs: none + * @return P22 temperature sensor reading + *************************************************************************/ +U32 getFPGAP22Temperature( void ) +{ + return fpgaSensorReadings.tempP22; +} + +/*********************************************************************//** + * @brief + * The getFPGAP25FloaterState function gets the P25 floater level state. + * @details \b Inputs: fpgaSensorReadings.levelSwitch + * @details \b Outputs: none + * @return P25 floater level state + *************************************************************************/ +U08 getFPGAP25FloaterState( void ) +{ + return fpgaSensorReadings.p25LevelSwitch; +} + +/*********************************************************************//** + * @brief + * The getFPGAFlowFMP function gets the P16 flow rate (in mL/min). + * @details \b Inputs: fpgaSensorReadings.flowRateP16 + * @details \b Outputs: none + * @return P16 flow rate (in mL/min) + *************************************************************************/ +U16 getFPGAFlowP16( void ) +{ + return fpgaSensorReadings.flowRateP16; +} + +/*********************************************************************//** + * @brief + * The getFPGAFlowP16Temp function gets the P16 flow sensor temperature, the + * temperature of the fluid flowing through the sensor. + * @details \b Inputs: fpgaSensorReadings.flowTempP16 + * @details \b Outputs: none + * @return P16 fluid temperature + *************************************************************************/ +U16 getFPGAFlowP16Temp( void ) +{ + return fpgaSensorReadings.flowTempP16; +} + +/*********************************************************************//** + * @brief + * The getFPGAFlowP7 function gets the P7 flow rate (in mL/min). + * @details \b Inputs: fpgaSensorReadings.flowRateP7 + * @details \b Outputs: none + * @return P7 flow rate (in mL/min) + *************************************************************************/ +U16 getFPGAFlowP7( void ) +{ + return fpgaSensorReadings.flowRateP7; +} + +/*********************************************************************//** + * @brief + * The getFPGAFlowP7Temp function gets the P7 flow sensor temperature, the + * temperature of the fluid flowing through the sensor. + * @details \b Inputs: fpgaSensorReadings.flowTempP7 + * @details \b Outputs: none + * @return P7 fluid temperature + *************************************************************************/ +U16 getFPGAFlowP7Temp( void ) +{ + return fpgaSensorReadings.flowTempP7; +} + +/*********************************************************************//** + * @brief + * The setFPGAP9Control function sets the FPGA P9 sensor control register + * to perform a given action. + * bit 4..7: unused + * bit 3: Enable P9 read transaction; address needed + * bit 2: Enable P9 write transaction; address and data needs to be set + * bit 1: Enable P9 initialization procedure + * bit 0: reset P9 sensor + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control + * @param control bits indicating control action to take + * @return none + *************************************************************************/ +void setFPGAP9Control( U08 control ) +{ + fpgaActuatorSetPoints.conductivityP9Control = control; +} + +/*********************************************************************//** + * @brief + * The setFPGAP9Address function sets the read/write address for a read/write + * action on the P9 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Address + * @param address The P9 sensor address to read from or write to + * @return none + *************************************************************************/ +void setFPGAP9Address( U16 address ) +{ + fpgaActuatorSetPoints.conductivityP9Address = address; +} + +/*********************************************************************//** + * @brief + * The setFPGAP9Data function sets the write data for a write action on + * the P9 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Data + * @param data The 32-bit data to write to the P9 sensor + * @return none + *************************************************************************/ +void setFPGAP9Data( U32 data ) +{ + fpgaActuatorSetPoints.conductivityP9Data = data; +} + +/*********************************************************************//** + * @brief + * The setFPGAP18Control function sets the FPGA P18 sensor control register + * to perform a given action. + * bit 4..7: unused + * bit 3: Enable P18 read transaction; address needed + * bit 2: Enable P18 write transaction; address and data needs to be set + * bit 1: Enable P18 initialization procedure + * bit 0: reset P18 sensor + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control + * @param control bits indicating control action to take + * @return none + *************************************************************************/ +void setFPGAP18Control( U08 control ) +{ + fpgaActuatorSetPoints.conductivityP18Control = control; +} + +/*********************************************************************//** + * @brief + * The setFPGAP18Address function sets the read/write address for a read/write + * action on the P18 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Address + * @param address The P18 sensor address to read from or write to + * @return none + *************************************************************************/ +void setFPGAP18Address( U16 address ) +{ + fpgaActuatorSetPoints.conductivityP18Address = address; +} + +/*********************************************************************//** + * @brief + * The setFPGAP18Data function sets the write data for a write action on + * the P18 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Data + * @param data The 32-bit data to write to the P18 sensor + * @return none + *************************************************************************/ +void setFPGAP18Data( U32 data ) +{ + fpgaActuatorSetPoints.conductivityP18Data = data; +} + +/*********************************************************************//** + * @brief + * The setFPGAP9Reset function sets the reset command bit for P9 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control + * @return none + *************************************************************************/ +void setFPGAP9Reset( void ) +{ + fpgaActuatorSetPoints.conductivityP9Control |= FPGA_CONDUCTIVITY_RESET_BIT; +} + +/*********************************************************************//** + * @brief + * The clearFPGAP9Reset function clears the reset command bit for P9 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control + * @return none + *************************************************************************/ +void clearFPGAP9Reset( void ) +{ + fpgaActuatorSetPoints.conductivityP9Control &= ~FPGA_CONDUCTIVITY_RESET_BIT; +} + +/*********************************************************************//** + * @brief + * The setFPGAP9InitEnable function sets the initialize command bit for + * P9 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control + * @return none + *************************************************************************/ +void setFPGAP9InitEnable( void ) +{ + fpgaActuatorSetPoints.conductivityP9Control |= FPGA_CONDUCTIVITY_INIT_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The clearFPGAP9InitEnable function clears the initialize command bit for + * P9 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control + * @return none + *************************************************************************/ +void clearFPGAP9InitEnable( void ) +{ + fpgaActuatorSetPoints.conductivityP9Control &= ~FPGA_CONDUCTIVITY_INIT_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The setFPGAP9WriteEnable function sets the write enable command bit for + * P9 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control + * @return none + *************************************************************************/ +void setFPGAP9WriteEnable( void ) +{ + fpgaActuatorSetPoints.conductivityP9Control |= FPGA_CONDUCTIVITY_WR_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The clearFPGAP9WriteEnable function clears the write enable command bit + * for P9 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control + * @return none + *************************************************************************/ +void clearFPGAP9WriteEnable( void ) +{ + fpgaActuatorSetPoints.conductivityP9Control &= ~FPGA_CONDUCTIVITY_WR_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The setFPGAP9ReadEnable function sets the read enable command bit for + * P9 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control + * @return none + *************************************************************************/ +void setFPGAP9ReadEnable( void ) +{ + fpgaActuatorSetPoints.conductivityP9Control |= FPGA_CONDUCTIVITY_RD_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The clearFPGAP9ReadEnable function clears the read enable command bit + * for P9 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP9Control + * @return none + *************************************************************************/ +void clearFPGAP9ReadEnable( void ) +{ + fpgaActuatorSetPoints.conductivityP9Control &= ~FPGA_CONDUCTIVITY_RD_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The setFPGAP18Reset function sets the reset command bit for P18 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control + * @return none + *************************************************************************/ +void setFPGAP18Reset( void ) +{ + fpgaActuatorSetPoints.conductivityP18Control |= FPGA_CONDUCTIVITY_RESET_BIT; +} + +/*********************************************************************//** + * @brief + * The clearFPGAP18Reset function clears the reset command bit for P18 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control + * @return none + *************************************************************************/ +void clearFPGAP18Reset( void ) +{ + fpgaActuatorSetPoints.conductivityP18Control &= ~FPGA_CONDUCTIVITY_RESET_BIT; +} + +/*********************************************************************//** + * @brief + * The setFPGAP18InitEnable function sets the initialize command bit for + * P18 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control + * @return none + *************************************************************************/ +void setFPGAP18InitEnable( void ) +{ + fpgaActuatorSetPoints.conductivityP18Control |= FPGA_CONDUCTIVITY_INIT_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The clearFPGAP18InitEnable function clears the initialize command bit for + * P18 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control + * @return none + *************************************************************************/ +void clearFPGAP18InitEnable( void ) +{ + fpgaActuatorSetPoints.conductivityP18Control &= ~FPGA_CONDUCTIVITY_INIT_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The setFPGAP18WriteEnable function sets the write enable command bit for + * P18 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control + * @return none + *************************************************************************/ +void setFPGAP18WriteEnable( void ) +{ + fpgaActuatorSetPoints.conductivityP18Control |= FPGA_CONDUCTIVITY_WR_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The clearFPGAP18WriteEnable function clears the write enable command bit + * for P18 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control + * @return none + *************************************************************************/ +void clearFPGAP18WriteEnable( void ) +{ + fpgaActuatorSetPoints.conductivityP18Control &= ~FPGA_CONDUCTIVITY_WR_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The setFPGAP18ReadEnable function sets the read enable command bit for + * P18 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control + * @return none + *************************************************************************/ +void setFPGAP18ReadEnable( void ) +{ + fpgaActuatorSetPoints.conductivityP18Control |= FPGA_CONDUCTIVITY_RD_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The clearFPGAP18ReadEnable function clears the read enable command bit + * for P18 sensor. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.conductivityP18Control + * @return none + *************************************************************************/ +void clearFPGAP18ReadEnable( void ) +{ + fpgaActuatorSetPoints.conductivityP18Control &= ~FPGA_CONDUCTIVITY_RD_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The getFPGAP9ReadCount function gets the latest P9 sensor read count. + * @details \b Inputs: fpgaSensorReadings.conductivityP9ReadCount + * @details \b Outputs: none + * @return Current read count for P9 sensor. + *************************************************************************/ +U08 getFPGAP9ReadCount( void ) +{ + return fpgaSensorReadings.conductivityP9ReadCount; +} + +/*********************************************************************//** + * @brief + * The getFPGAP9ErrorCount function gets the latest P9 sensor error count. + * @details \b Inputs: fpgaSensorReadings.conductivityP9ErrorCount + * @details \b Outputs: none + * @return Current error count for P9 sensor. + *************************************************************************/ +U08 getFPGAP9ErrorCount( void ) +{ + return fpgaSensorReadings.conductivityP9ErrorCount; +} + +/*********************************************************************//** + * @brief + * The getFPGAP9Conductivity function gets the latest P9 sensor conductivity + * reading. + * @details \b Inputs: fpgaSensorReadings.conductivityP9Cond + * @details \b Outputs: none + * @return Current conductivity reading from P9 sensor. + *************************************************************************/ +U16 getFPGAP9Conductivity( void ) +{ + return fpgaSensorReadings.conductivityP9Cond; +} + +/*********************************************************************//** + * @brief + * The getFPGAP9Temperature function gets the latest P9 sensor temperature. + * @details \b Inputs: fpgaSensorReadings.conductivityP9Temp + * @details \b Outputs: none + * @return Current temperature from P9 sensor. + *************************************************************************/ +U16 getFPGAP9Temperature( void ) +{ + return fpgaSensorReadings.conductivityP9Temp; +} + +/*********************************************************************//** + * @brief + * The getFPGAP9Data function gets the latest P9 sensor data from a read + * action. + * @details \b Inputs: fpgaSensorReadings.conductivityP9Data + * @details \b Outputs: none + * @return Latest data read from P9 sensor. + *************************************************************************/ +U32 getFPGAP9Data( void ) +{ + return fpgaSensorReadings.conductivityP9Data; +} + +/*********************************************************************//** + * @brief + * The getFPGAP18ReadCount function gets the latest P18 sensor read count. + * @details \b Inputs: fpgaSensorReadings.conductivityP18ReadCount + * @details \b Outputs: none + * @return Current read count for P18 sensor. + *************************************************************************/ +U08 getFPGAP18ReadCount( void ) +{ + return fpgaSensorReadings.conductivityP18ReadCount; +} + +/*********************************************************************//** + * @brief + * The getFPGAP18ErrorCount function gets the latest P18 sensor error count. + * @details \b Inputs: fpgaSensorReadings.conductivityP18ErrorCount + * @details \b Outputs: none + * @return Current error count for P18 sensor. + *************************************************************************/ +U08 getFPGAP18ErrorCount( void ) +{ + return fpgaSensorReadings.conductivityP18ErrorCount; +} + +/*********************************************************************//** + * @brief + * The getFPGAP18Conductivity function gets the latest P18 sensor conductivity + * reading. + * @details \b Inputs: fpgaSensorReadings.conductivityP18Cond + * @details \b Outputs: none + * @return Current conductivity reading from P18 sensor. + *************************************************************************/ +U16 getFPGAP18Conductivity( void ) +{ + return fpgaSensorReadings.conductivityP18Cond; +} + +/*********************************************************************//** + * @brief + * The getFPGAP18Temperature function gets the latest P18 sensor temperature. + * @details \b Inputs: fpgaSensorReadings.conductivityP18Temp + * @details \b Outputs: none + * @return Current temperature from P18 sensor. + *************************************************************************/ +U16 getFPGAP18Temperature( void ) +{ + return fpgaSensorReadings.conductivityP18Temp; +} + +/*********************************************************************//** + * @brief + * The getFPGAP18Data function gets the latest P18 sensor data from a read + * action. + * @details \b Inputs: fpgaSensorReadings.conductivityP18Data + * @details \b Outputs: none + * @return Latest data read from P18 sensor. + *************************************************************************/ +U32 getFPGAP18Data( void ) +{ + return fpgaSensorReadings.conductivityP18Data; +} + +/*********************************************************************//** + * @brief + * The setFPGAP40PumpEnable function enables or disables the P40 pump. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.p40PumpControl + * @param enable flag indicating whether to enable or disable the P40 pump. + * @return none + *************************************************************************/ +void setFPGAP40PumpEnable( BOOL enable ) +{ + fpgaActuatorSetPoints.p40PumpControl = ( TRUE == enable ? 0x1 : 0x0 ); +} + +/*********************************************************************//** + * @brief + * The setFPGAP40PumpPWM function sets the P40 pump PWM duty cycle. + * The higher the PWM duty cycle (0..500), the faster the pump will go. + * @note PWM values < 5% or > 95% will cause pump to stop so effective + * range is actually 25..475. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.p40PumpPWMDutyCyclePct + * @param pwm PWM duty cycle magnitude + * @return none + *************************************************************************/ +void setFPGAP40PumpPWM( U16 pwm ) +{ + fpgaActuatorSetPoints.p40PumpPWMDutyCyclePct = pwm; +} + +/*********************************************************************//** + * @brief + * The getFPGAP12PumpPWM function gets a read back from FPGA of RO pump PWM + * duty cycle. + * @details \b Inputs: fpgaSensorReadings.p40PumpPWMReadback + * @details \b Outputs: none + * @return measured speed (RPM) of the P40 pump + *************************************************************************/ +U16 getFPGAP40PumpPWM( void ) +{ + return fpgaSensorReadings.p40PumpPWMReadback; +} + +/*********************************************************************//** + * @brief + * The getFPGAP12PumpTachCount function gets the running 16-bit tachometer count + * from the P40 pump hall sensor. + * @details \b Inputs: fpgaSensorReadings.p40PumpTachCount + * @details \b Outputs: none + * @return P40 pump tachometer count + *************************************************************************/ +U16 getFPGAP40PumpTachCount( void ) +{ + return fpgaSensorReadings.p40PumpTachCount; +} + /**@}*/