Index: firmware/App/Drivers/BubbleDetector.c =================================================================== diff -u --- firmware/App/Drivers/BubbleDetector.c (revision 0) +++ firmware/App/Drivers/BubbleDetector.c (revision f730082d809bc52c15b2d17b8fd0a8d535e5c21a) @@ -0,0 +1,114 @@ +/************************************************************************** +* +* 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 BubbleDetector.c +* +* @author (last) Sean +* @date (last) 22-Aug-2024 +* +* @author (original) Sean +* @date (original) 22-Aug-2024 +* +***************************************************************************/ + +#include "BubbleDetector.h" +#include "FpgaTD.h" + +/** + * @addtogroup BubbleDetector + * @{ + */ + +// ********** private definitions ********** + + +// ********** private data ********** + +/// Current bubble detected states (overrideable). +static OVERRIDE_U32_T currentBubbleState[ NUM_OF_BUBBLE_DETECTORS ]; + +// ********** private function prototypes ********** + +/*********************************************************************//** + * @brief + * The initBubbleDetector function initializes the BubbleDetector unit. + * @details \b Inputs: none + * @details \b Outputs: InternalADC unit is initialized. + * @return none + *************************************************************************/ +void initBubbleDetector( void ) +{ + currentBubbleState[ BUBBLE_DETECTOR_ADV ].data = NO_BUBBLE_DETECTED; + currentBubbleState[ BUBBLE_DETECTOR_ADV ].ovData = NO_BUBBLE_DETECTED; + currentBubbleState[ BUBBLE_DETECTOR_ADV ].ovInitData = NO_BUBBLE_DETECTED; + currentBubbleState[ BUBBLE_DETECTOR_ADV ].override = OVERRIDE_RESET; +} + +/*********************************************************************//** + * @brief + * The readBubbleDetector function gets the current bubble detected state + * for a all bubble detector sensors from the FPGA. + * @note This function should be called periodically to maintain fresh + * sensor readings for all bubble detectors. + * @details \b Inputs: FPGA + * @details \b Outputs: none + * @return The current state of the given bubble detector sensor. + *************************************************************************/ +void readBubbleDetectors( void ) +{ + BOOL bubble; + U32 i; + + for ( i = 0; i < NUM_OF_BUBBLE_DETECTORS; i++ ) + { + if ( BUBBLE_DETECTOR_ADV == (BUBBLE_DETECTOR_T)i ) + { + bubble = ADVBubbleDetected(); // read current sensor state from FPGA + currentBubbleState[ i ].data = (U32)( FALSE == bubble ? NO_BUBBLE_DETECTED : BUBBLE_DETECTED ); + } + // no other sensors. for loop prevents possibility of an "else". + } +} + +/*********************************************************************//** + * @brief + * The getBubbleDetectedState function gets the current bubble detected state + * for a given bubble detector sensor. + * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if given sensor is invalid. + * @details \b Inputs: currentBubbleState + * @details \b Outputs: none + * @param sensor ID of bubble detector sensor to get state for. + * @return The current state of the given bubble detector sensor. + *************************************************************************/ +BUBBLE_STATE_T getBubbleDetectedState( BUBBLE_DETECTOR_T sensor ) +{ + BUBBLE_STATE_T result = NO_BUBBLE_DETECTED; + + if ( sensor < NUM_OF_BUBBLE_DETECTORS ) + { + result = (BUBBLE_STATE_T)currentBubbleState[ sensor ].data; + if ( OVERRIDE_KEY == currentBubbleState[ sensor ].override ) + { + result = (BUBBLE_STATE_T)currentBubbleState[ sensor ].ovData; + } + } + else + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_BUBBLE_DETECTOR_INVALID_SENSOR, sensor ) + } + + return result; +} + + +/************************************************************************* + * TEST SUPPORT FUNCTIONS + *************************************************************************/ + +// TODO - Michael G, please add messaging and handler function for a bubble detector state override + +/**@}*/ Index: firmware/App/Drivers/BubbleDetector.h =================================================================== diff -u --- firmware/App/Drivers/BubbleDetector.h (revision 0) +++ firmware/App/Drivers/BubbleDetector.h (revision f730082d809bc52c15b2d17b8fd0a8d535e5c21a) @@ -0,0 +1,57 @@ +/************************************************************************** +* +* 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 BubbleDetector.h +* +* @author (last) Sean +* @date (last) 22-Aug-2024 +* +* @author (original) Sean +* @date (original) 22-Aug-2024 +* +***************************************************************************/ + +#ifndef __BUBBLE_DETECTOR_H__ +#define __BUBBLE_DETECTOR_H__ + +#include "TDCommon.h" + +/** + * @defgroup BubbleDetector BubbleDetector + * @brief The Bubble Detector unit provides low-level functions for interfacing + * with a bubble detector. + * + * @addtogroup BubbleDetector + * @{ + */ + +// ********** public definitions ********** + +/// Enumeration of bubble detector sensors. +typedef enum Bubble_Detectors +{ + BUBBLE_DETECTOR_ADV = 0, ///< ADV - Venous bubble detector. + NUM_OF_BUBBLE_DETECTORS ///< Number of used internal ADC channels. +} BUBBLE_DETECTOR_T; + +/// Enumeration of bubble detection states. +typedef enum Bubble_States +{ + NO_BUBBLE_DETECTED = 0, ///< No bubble is detected. + BUBBLE_DETECTED, ///< A bubble is detected. + NUM_OF_BUBBLE_DETECTION_STATES ///< Number of bubble detection states. +} BUBBLE_STATE_T; + +// ********** public function prototypes ********** + +void initBubbleDetector( void ); +void readBubbleDetectors( void ); +BUBBLE_STATE_T getBubbleDetectedState( BUBBLE_DETECTOR_T sensor ); + +/**@}*/ + +#endif Index: firmware/App/Drivers/PressureSensor.c =================================================================== diff -u --- firmware/App/Drivers/PressureSensor.c (revision 0) +++ firmware/App/Drivers/PressureSensor.c (revision f730082d809bc52c15b2d17b8fd0a8d535e5c21a) @@ -0,0 +1,36 @@ +/************************************************************************** +* +* 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 PressureSensor.c +* +* @author (last) Sean +* @date (last) 22-Aug-2024 +* +* @author (original) Sean +* @date (original) 22-Aug-2024 +* +***************************************************************************/ + +#include "FpgaTD.h" +#include "PressureSensor.h" + +/** + * @addtogroup PressureSensor + * @{ + */ + +// ********** private definitions ********** + + +// ********** private data ********** + + +// ********** private function prototypes ********** + + + +/**@}*/ Index: firmware/App/Drivers/PressureSensor.h =================================================================== diff -u --- firmware/App/Drivers/PressureSensor.h (revision 0) +++ firmware/App/Drivers/PressureSensor.h (revision f730082d809bc52c15b2d17b8fd0a8d535e5c21a) @@ -0,0 +1,41 @@ +/************************************************************************** +* +* 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 PressureSensor.h +* +* @author (last) Sean +* @date (last) 22-Aug-2024 +* +* @author (original) Sean +* @date (original) 22-Aug-2024 +* +***************************************************************************/ + +#ifndef __INT_ADC_H__ +#define __INT_ADC_H__ + +#include "TDCommon.h" + +/** + * @defgroup PressureSensor PressureSensor + * @brief The Pressure Sensor unit provides low-level functions for interfacing + * with a pressure sensor. + * internal ADC channel data. + * + * @addtogroup PressureSensor + * @{ + */ + +// ********** public definitions ********** + + +// ********** public function prototypes ********** + + +/**@}*/ + +#endif Index: firmware/App/Services/AlarmMgmtSWFaults.h =================================================================== diff -u -r3518e8a088c32e75c0c8960d5e629a7401095feb -rf730082d809bc52c15b2d17b8fd0a8d535e5c21a --- firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 3518e8a088c32e75c0c8960d5e629a7401095feb) +++ firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision f730082d809bc52c15b2d17b8fd0a8d535e5c21a) @@ -103,7 +103,8 @@ SW_FAULT_ID_ALARM_MGMT_INVALID_ALARM_TO_CLEAR_COND = 72, SW_FAULT_ID_INVALID_ALARM_ID_REFERENCED3 = 73, SW_FAULT_ID_SYSTEM_COMM_INVALID_BUFFER_INDEX1 = 74, - SW_FAULT_ID_SYSTEM_COMM_INVALID_BUFFER_INDEX2 = 74, + SW_FAULT_ID_SYSTEM_COMM_INVALID_BUFFER_INDEX2 = 75, + SW_FAULT_ID_BUBBLE_DETECTOR_INVALID_SENSOR = 76, NUM_OF_SW_FAULT_IDS } SW_FAULT_ID_T; Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -r3518e8a088c32e75c0c8960d5e629a7401095feb -rf730082d809bc52c15b2d17b8fd0a8d535e5c21a --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 3518e8a088c32e75c0c8960d5e629a7401095feb) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision f730082d809bc52c15b2d17b8fd0a8d535e5c21a) @@ -47,8 +47,14 @@ #define FPGA_FLUID_LEAK_STATE_MASK 0x0040 ///< Bit mask for fluid leak detector. -#define FPGA_VALVES_MIN_PWM_MODE_COUNT 2500 ///< FPGA valves minimum PWM in PWM mode in counts. +#define FPGA_PINCH_VALVES_STOPPED 0x00 ///< FPGA pinch valve control register setting to stop valve motors. +#define FPGA_VBV_CLOSED_LOOP 0x01 ///< Bit mask for running VBV motor in closed loop mode. +#define FPGA_VBA_CLOSED_LOOP 0x02 ///< Bit mask for running VBA motor in closed loop mode. +#define FPGA_VBV_OPEN_LOOP 0x04 ///< Bit mask for running VBV motor in open loop mode. +#define FPGA_VBA_OPEN_LOOP 0x80 ///< Bit mask for running VBA motor in open loop mode. +//#define FPGA_VALVES_MIN_PWM_MODE_COUNT 2500 ///< FPGA valves minimum PWM in PWM mode in counts. + #define FPGA_INPUT_VOLTAGE_SCALE 3.0F ///< FPGA source and aux voltage. #define FPGA_PVN_VOLTAGE_SCALE 1.0F ///< FPGA pvn voltage. @@ -81,147 +87,75 @@ U08 fpgaRev; ///< 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. - U16 fpgaStatus; ///< Reg 4. FPGA status register. } FPGA_HEADER_T; // Read only on FPGA /// Record structure for FPGA continuous priority reads. typedef struct { - U08 errorCountProcessor; ///< Reg 256. Error count for processor communications - U08 errorCountPC; ///< Reg 257. TBD. - U08 fpgaHWConfigReg; ///< Reg 258. Hardware configuration register (i.e. BETA or DVT) - U08 sPumpDACRdStatus; ///< Reg 259. Syringe pump DAC read status. - U16 sPumpDACSet; ///< Reg 260. Syringe pump DAC setting. - U16 sPumpDACEEProm; ///< Reg 262. Syringe pump DAC EEProm data. - U08 reserved4; ///< Reg 264. Reserved. - U08 reserved5; ///< Reg 265. Reserved. - U08 reserved6; ///< Reg 266. Reserved. - U08 reserved7; ///< Reg 267. Reserved. - F32 reserved8; ///< Reg 268. Reserved. - U08 reserved9; ///< Reg 272. Reserved. - U08 reserved10; ///< Reg 273. Reserved. - U08 reserved11; ///< Reg 274. Reserved. - U08 reserved12; ///< Reg 275. Reserved. - U16 bloodOcclusionData; ///< Reg 276. Blood pump occlusion sensor data. - U08 bloodOcclusionReadCount; ///< Reg 278. Blood pump occlusion sensor read count. - U08 bloodOcclusionErrorCount; ///< Reg 279. Blood pump occlusion sensor error count. - U16 obsolete1; ///< Reg 280. Unused. - U08 obsolete2; ///< Reg 282. Unused. - U08 obsolete3; ///< Reg 283. Unused. - U16 obsolete4; ///< Reg 284. Unused. - U08 obsolete5; ///< Reg 286. Unused. - U08 obsolete6; ///< Reg 287. Unused. - U16 bloodPumpHallSensorCount; ///< Reg 288. Blood pump hall sensor count. - U08 bloodPumpHallSensorStatus; ///< Reg 290. Blood pump hall sensor status. - U08 dialInPumpHallSensorStatus; ///< Reg 291. Dialysate inlet pump hall sensor status. - U32 adc1Channel0; ///< Reg 292. ADC1 channel 0 data. - U32 adc1Channel1; ///< Reg 296. ADC1 channel 1 data. - U32 reserved13; ///< Reg 300. Reserved. - U32 reserved14; ///< Reg 304. Reserved. - F32 reserved15; ///< Reg 308. Reserved. - U08 adc1SequenceCount; ///< Reg 312. ADC1 round robin channel sequence count. - U08 adc1ErrorCount; ///< Reg 313. ADC1 error count. - U16 accelX; ///< Reg 314. Accelerometer X axis data. - U16 accelY; ///< Reg 316. Accelerometer Y axis data. - U16 accelZ; ///< Reg 318. Accelerometer Z axis data. - U16 accelXMax; ///< Reg 320. Accelerometer X axis max data (since last read). - U16 accelYMax; ///< Reg 322. Accelerometer Y axis max data (since last read). - U16 accelZMax; ///< Reg 324. Accelerometer Z axis max data (since last read). - U16 accelFaultRegister; ///< Reg 326. Accelerometer fault register. - U16 accelSampleCounter; ///< Reg 328. Accelerometer sample count. - U16 venousPressure; ///< Reg 330. Venous pressure sensor data. - U16 venousTemperature; ///< Reg 332. Venous pressure sensor temperature. - U08 venousReadCounter; ///< Reg 334. Venous pressure sensor read count. - U08 dialOutPumpSensorStatus; ///< Reg 335. Dialysate outlet pump hall sensor status. - U16 dialInPumpHallSensorCount; ///< Reg 336. Dialysate inlet pump hall sensor count. - U16 dialOutPumpHallSensorCount; ///< Reg 338. Dialysate outlet pump hall sensor count. - U32 reserved16; ///< Reg 340. Reserved. - U32 reserved17; ///< Reg 344. Reserved. - F32 reserved18; ///< Reg 348. Reserved. - U16 fan1PulseTime; ///< Reg 352. Fan 1 pulse time in 2.5 uSec resolution. 0xFFFF if fan RPM < 500 RPM. - U16 fan2PUlseTime; ///< Reg 354. Fan 2 pulse time in 2.5 uSec resolution. 0xFFFF if fan RPM < 500 RPM. - U16 fpgaGPIO; ///< Reg 356. FPGA GPIO register. - S16 VBAPosition; ///< Reg 358. Encoder position from VBA pinch valve. 0 until PID interface is enabled. - S16 VBVPosition; ///< Reg 360. Encoder position from VBV pinch valve. 0 until PID interface is enabled. - S16 VDiPosition; ///< Reg 362. Encoder position from VDi pinch valve. 0 until PID interface is enabled. - S16 VDoPosition; ///< Reg 364. Encoder position from VDo pinch valve. 0 until PID interface is enabled. - S16 fpgaIntVoltage; ///< Reg 366. Internal FPGA Vcc voltage. 3V range over 12 bits (0..4095). - U16 valveStatus; ///< Reg 368. Valve status register. - U16 VBAPWMTarget; ///< Reg 370. PWM target duty cycle for VBA pinch valve. - U16 VBVPWMTarget; ///< Reg 372. PWM target duty cycle for VBV pinch valve. - U16 VDiPWMTarget; ///< Reg 374. PWM target duty cycle for VDi pinch valve. - U16 VDoPWMTarget; ///< Reg 376. PWM target duty cycle for VDo pinch valve. - U16 fpgaAuxVoltage; ///< Reg 378. Internal FPGA Vcc Aux voltage. 3V range over 12 bits (0..4095). - U08 syringePumpStatus; ///< Reg 380. Syringe pump status register. - U08 syringePumpADCReadCounter; ///< Reg 381. Syringe pump ADC read counter. - U08 syringePumpADCandDACStatus; ///< Reg 382. Syringe pump ADC and DAC status register. - U08 syringePumpEncoderStatus; ///< Reg 383. Syringe pump encoder status register. - U32 syringePumpEncPosition; ///< Reg 384. Syringe pump encoder position - U16 syringePumpAdcDataReadCh0; ///< Reg 388. Syringe pump ADC channel 0 register (10 bit). - U16 syringePumpAdcDataReadCh1; ///< Reg 390. Syringe pump ADC channel 1 register (10 bit). - U16 syringePumpAdcDataReadCh2; ///< Reg 392. Syringe pump ADC channel 2 register (10 bit). - U16 syringePumpAdcDataReadCh3; ///< Reg 394. Syringe pump ADC channel 3 register (10 bit). - U16 VBASpeed; ///< Reg 396. VBA pinch valve speed (Register VAUX0) - U16 VBVSpeed; ///< Reg 398. VBV pinch valve speed (Register VAUX1) - U16 VBVCurrent; ///< Reg 400. VBV pinch valve current (Register VAUX2) - U16 VDoCurrent; ///< Reg 402. VDo pinch valve current (Register VAUX3) - U16 VBACurrent; ///< Reg 404. VBA pinch valve current (Register VAUX8) - U16 VDiSpeed; ///< Reg 406. VDi pinch valve current (Register VAUX5) - U16 VDoSpeed; ///< Reg 408. VDo pinch valve speed (Register VAUX10) - U16 VDiCurrent; ///< Reg 410. VDi pinch valve current (Register VAUX13) - U16 fpgaTemperature; ///< Reg 412. FPGA die temperature (deg C = counts x (503.975/4096) - 273.15). - U16 fpgaVpvn; ///< Reg 414. FPGA pvn voltage. 1V range over 12 bits (0..4095). - U16 fpgaTimerCount_ms; ///< Reg 416. Free running 1ms timer counter. Rolls over at 65535.Internal FPGA timer count in ms. - U16 backupAlarmAudioPeakCurrent; ///< Reg 418. Piezo alarm peak ADC current in previous 10ms. 12 bit unsigned. - U08 V1EncError; ///< Reg 420. Pinch valve V1 encoder error counter. - U08 V2EncError; ///< Reg 421. Pinch valve V2 encoder error counter. - U08 V3EncError; ///< Reg 422. Pinch valve V3 encoder error counter. - U08 V4EncError; ///< Reg 423. Pinch valve V4 encoder error counter. - U08 ADACounter; ///< Reg 424. ADA bubble counter. - U08 ADVCounter; ///< Reg 425. ADV bubble counter. - U08 reserved19; ///< Reg 426. Reserved. - U08 reserved20; ///< Reg 427. Reserved. - U08 VenousErrorCounter; ///< Reg 428. Venous error counter. - U08 reserved21; ///< Reg 429. Reserved. - U16 reserved22; ///< Reg 430. Reserved. - U16 reserved23; ///< Reg 432. Reserved. - U16 reserved24; ///< Reg 434. Reserved. - U16 reserved25; ///< Reg 436. Reserved. - U16 reserved26; ///< Reg 438. Reserved. - U16 arterialPressure; ///< Reg 440. Arterial pressure sensor. - U16 arterialPressureTemperature; ///< Reg 442. Arterial pressure sensor temperature. - U08 arterialPressureReadCount; ///< Reg 444. Arterial pressure sensor read count. - U08 arterialPressureErrorCount; ///< Reg 445. Arterial pressure sensor error count. - U08 bloodLeakTxFIFOCount; ///< Reg 446. Blood leak transmit FIFO count. - U08 bloodLeakRxErrorCount; ///< Reg 447. Blood leak receive error count. - U16 bloodLeakRxFIFOCount; ///< Reg 448. Blood leak receive FIFO count. - U08 bloodLeakRxFIFODataOut; ///< Reg 450. Blood leak receive FIFO data out. - U08 dummyByte; ///< Reg 451. Dummy byte to meet the even of the data. - U16 fpgaCompatibilityRev; ///< Reg 452. Compatibility revisions + U16 fpgaGenWrRd; ///< Reg 256. FPGA general read-back register (mirrored from a general write register in write page at addr 4). + U08 errorCountProcessor; ///< Reg 258. Error count for processor communications. + U08 errorCountPC; ///< Reg 259. Error count for TBD. + U08 sPumpDACRdStatus; ///< Reg 260. Syringe pump DAC read status. + U08 reserved1; ///< Reg 261. Reserved and available for future use. + U16 sPumpDACSet; ///< Reg 262. Syringe pump DAC setting. + U16 sPumpDACEEProm; ///< Reg 264. Syringe pump DAC EEProm data. + U32 PBoPressure; ///< Reg 266. PBo raw pressure data. + U32 PBoTemperature; ///< Reg 270. PBo raw temperature data. + U08 PBoReadCount; ///< Reg 274. PBo read count. + U08 PBoErrorCount; ///< Reg 275. PBo error count. + U32 PBAPressure; ///< Reg 276. PBA raw pressure data. + U32 PBATemperature; ///< Reg 280. PBA raw temperature data. + U08 PBAReadCount; ///< Reg 284. PBA read count. + U08 PBAErrorCount; ///< Reg 285. PBA error count. + S16 ATAPSpeed; ///< Reg 286. ATAP speed. + U08 BEMStatus; ///< Reg 288. BEM status. + U08 BEMEncStatus; ///< Reg 289. BEM encoder status. + S32 BEMEncPosition; ///< Reg 290. BEM encoder position. + S16 BPSpeed; ///< Reg 294. BP measured speed. + S16 BPTorque; ///< Reg 296. BP measured torque. + S16 BPSpeedFromHall; ///< Reg 298. BP measured speed from hall sensor(s). + S16 VBVPosition; ///< Reg 300. VBV encoder position. + U08 VBVStatus; ///< Reg 302. VBV status register. + U08 VBAStatus; ///< Reg 303. VBA status register. + S16 VBAPosition; ///< Reg 304. VBA encoder position. + U16 GPIOReg; ///< Reg 306. GPIO register. + U08 HEPStatus; ///< Reg 308. HEP status register. + U08 HEPAdcReadCount; ///< Reg 309. HEP ADC read counter. + U08 HEPAdcDacStatus; ///< Reg 310. HEP ADC/DAC status register. + U08 HEPEncStatus; ///< Reg 311. HEP encoder status register. + S32 HEPEncPosition; ///< Reg 312. HEP encoder position. + U16 HEPAdcCh0; ///< Reg 316. HEP ADC channel 0 reading. + U16 HEPAdcCh1; ///< Reg 318. HEP ADC channel 1 reading. + U16 HEPAdcCh2; ///< Reg 320. HEP ADC channel 2 reading. + U16 HEPAdcCh3; ///< Reg 322. HEP ADC channel 3 reading. + U16 fpgaAdcTemperature; ///< Reg 324. FPGA ADC temperature. + U16 fpga1msTimerCounter; ///< Reg 326. FPGA 1 millisecond timer counter. + U16 alarmBuzzerCurrentAdc; ///< Reg 328. Alarm buzzer current ADC reading. + U16 fpgaVccInternalAdc; ///< Reg 330. FPGA Vcc internal voltage ADC reading. + U16 fpgaCompatibilityRev; ///< Reg 332. Compatibility revision. } FPGA_SENSORS_T; /// Record structure for FPGA continuous priority writes. typedef struct { - U08 fpgaSensorTest; ///< Reg 11. Blood leak and bubble detector sensor test register. - U16 fpgaPIDControl; ///< Reg 12. Valve PID enables. - S16 VBASetPoint; ///< Reg 14. VBA pinch valve is commanded to this set point position. - S16 VBVSetPoint; ///< Reg 16. VBV pinch valve is commanded to this set point position. - S16 VDiSetPoint; ///< Reg 18. VDi pinch valve is commanded to this set point position. - S16 VDoSetPoint; ///< Reg 20. VDo pinch valve is commanded to this set point position. - S16 VSpareSetPoint; ///< Reg 22. VSpare pinch valve is commanded to this set point position. - U16 VBAPWMFixed; ///< Reg 24. VBA PWM set to fixed current by setting fixed PWM duty cycle. Range 750 to 4250. < 2500 is reverse direction. - U16 VBVPWMFixed; ///< Reg 26. VBV PWM set to fixed current by setting fixed PWM duty cycle. Range 750 to 4250. < 2500 is reverse direction. - U16 VDiPWMFixed; ///< Reg 28. VDi PWM set to fixed current by setting fixed PWM duty cycle. Range 750 to 4250. < 2500 is reverse direction. - U16 VDoPWMFixed; ///< Reg 30. VDo PWM set to fixed current by setting fixed PWM duty cycle. Range 750 to 4250. < 2500 is reverse direction. - U16 VSparePWMFixed; ///< Reg 32. Vspare PWM set to fixed current by setting fixed PWM duty cycle. Range 750 to 4250. < 2500 is reverse direction. - U08 alarmControl; ///< Reg 34. Alarm (audio) control register. - U08 syringePumpControl; ///< Reg 35. Syringe pump control register. - U32 syringePumpStepToggleTime; ///< Reg 36. Syringe pump step time toggle register. Sets time between step toggle which dictates stepper motor speed. - U16 syringePumpDACOut; ///< Reg 40. Syringe pump DAC output level (12-bit). - U08 syringePumpADCandDACControl; ///< Reg 42. Syringe pump ADC and DAC control register. - U08 bloodLeakUARTControl; ///< Reg 43. Blood leak UART control. - U08 bloodLeakFIFOTransmit; ///< Reg 44. Character word store in FIFO to be transmitted into blood leak UART interface. + U16 fpgaGenWrRd; ///< Reg 04. FPGA general read-back register (mirrored to a general read register in read page at addr 256). + U08 VBTControl; ///< Reg 06. VBT valve control register. + U08 VBTPWMEnable; ///< Reg 08. VBT valve PWM enable register. + U16 VBTPWMLowPeriod; ///< Reg 10. VBT PWM low signal period register. + U16 VBTPWMPeriod; ///< Reg 12. VBT PWM period register. + U16 VBTPWMPUllInTime; ///< Reg 14. VBT PWM pull in time register. + U16 ATAPSetSpeed; ///< Reg 16. Air pump speed set register. + U08 ATAPControl; ///< Reg 18. Air pump control register. + U08 BEMControl; ///< Reg 19. Blood ejector stepper motor control register. + U16 BEMSetSpeed; ///< Reg 20. Blood ejector stepper motor step register. + U16 BPSetSpeed; ///< Reg 22. Blood pump speed set register. + U08 BPControl; ///< Reg 24. Blood pump control register. + U08 pinchValveControl; ///< Reg 25. Pinch valve control register (VBA and VBV). + S16 VBVPosition; ///< Reg 26. VBV position set register. + S16 VBAPosition; ///< Reg 28. VBA position set register. + U16 VBVStepSpeed; ///< Reg 30. VBV step speed set register. + U16 VBAStepSpeed; ///< Reg 32. VBA step speed set register. + U08 alarmControl; ///< Reg 34. Alarm audio register. } FPGA_ACTUATORS_T; #pragma pack(pop) @@ -256,10 +190,9 @@ memset( &fpgaActuatorSetPoints, 0, sizeof(FPGA_ACTUATORS_T) ); fpgaActuatorSetPoints.alarmControl = (U08)MIN_ALARM_VOLUME_ATTENUATION << 2; // Start alarm audio volume at maximum - // Set the HD valves fixed PWM mode to 2500, so if it was commanded to be in PWM mode rather than PID control + // Set VBA and VBV to be "stopped". // the valves will not move to 0 position - fpgaActuatorSetPoints.VBAPWMFixed = FPGA_VALVES_MIN_PWM_MODE_COUNT; - fpgaActuatorSetPoints.VBVPWMFixed = FPGA_VALVES_MIN_PWM_MODE_COUNT; + fpgaActuatorSetPoints.pinchValveControl = FPGA_PINCH_VALVES_STOPPED; // initialize FPGA comm failures windowed timer count initTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_COMM_FAILURES, MAX_FPGA_COMM_FAILURES, MAX_FPGA_COMM_FAILURES_WINDOW_MS); @@ -309,7 +242,7 @@ *************************************************************************/ U16 getFPGATimerCount( void ) { - return fpgaSensorReadings.fpgaTimerCount_ms; + return fpgaSensorReadings.fpga1msTimerCounter; } /*********************************************************************//** @@ -372,7 +305,7 @@ *************************************************************************/ U16 getFPGATemperature( void ) { - return fpgaSensorReadings.fpgaTemperature; + return fpgaSensorReadings.fpgaAdcTemperature; } /*********************************************************************//** @@ -384,7 +317,7 @@ *************************************************************************/ F32 getFPGAVcc( void ) { - F32 result = (F32)fpgaSensorReadings.fpgaIntVoltage * FPGA_INPUT_VOLTAGE_SCALE / (F32)BITS_12_FULL_SCALE; + F32 result = (F32)fpgaSensorReadings.fpgaVccInternalAdc * FPGA_INPUT_VOLTAGE_SCALE / (F32)BITS_12_FULL_SCALE; return result; } @@ -398,7 +331,7 @@ *************************************************************************/ F32 getFPGAVccAux( void ) { - F32 result = (F32)fpgaSensorReadings.fpgaAuxVoltage * FPGA_INPUT_VOLTAGE_SCALE / (F32)BITS_12_FULL_SCALE; + F32 result = 0.0F;//(F32)fpgaSensorReadings.fpgaAuxVoltage * FPGA_INPUT_VOLTAGE_SCALE / (F32)BITS_12_FULL_SCALE; return result; } @@ -412,7 +345,7 @@ *************************************************************************/ F32 getFPGAVpvn( void ) { - F32 result = (F32)fpgaSensorReadings.fpgaVpvn * FPGA_PVN_VOLTAGE_SCALE / (F32)BITS_12_FULL_SCALE; + F32 result = 0.0F;//(F32)fpgaSensorReadings.fpgaVpvn * FPGA_PVN_VOLTAGE_SCALE / (F32)BITS_12_FULL_SCALE; return result; } @@ -479,7 +412,7 @@ *************************************************************************/ U16 getFPGABloodPumpHallSensorCount( void ) { - return fpgaSensorReadings.bloodPumpHallSensorCount; + return 0;//fpgaSensorReadings.bloodPumpHallSensorCount; } /*********************************************************************//** @@ -495,99 +428,61 @@ *************************************************************************/ U08 getFPGABloodPumpHallSensorStatus( void ) { - return fpgaSensorReadings.bloodPumpHallSensorStatus; + return 0;//fpgaSensorReadings.bloodPumpHallSensorStatus; } /*********************************************************************//** * @brief - * The getFPGAArterialPressure function gets the latest arterial pressure reading. + * The getPBAPressure function gets the latest arterial pressure reading. * High byte indicates alarm status for ADC channel. * @note Low 24-bits are channel reading. Subtract 2^23 from low 24 bits to get * signed channel reading. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return latest arterial pressure reading *************************************************************************/ -U32 getFPGAArterialPressure( void ) +U32 getPBAPressure( void ) { - return fpgaSensorReadings.adc1Channel0; + return fpgaSensorReadings.PBAPressure; } /*********************************************************************//** * @brief - * The getFPGAArterialPressureReadCounter function gets the latest arterial - * pressure sensor read counter. - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return latest arterial pressure sensor read counter - *************************************************************************/ -U08 getFPGAArterialPressureReadCounter( void ) -{ - return fpgaSensorReadings.adc1SequenceCount; -} - -/*********************************************************************//** - * @brief - * The getFPGAArterialPressureErrorCounter function gets the latest arterial - * pressure sensor error counter. - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return latest arterial pressure sensor error counter - *************************************************************************/ -U08 getFPGAArterialPressureErrorCounter( void ) -{ - return fpgaSensorReadings.adc1ErrorCount; -} - -/*********************************************************************//** - * @brief - * The getFPGADVTArterialPressure function gets the latest arterial pressure reading. - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return latest arterial pressure reading - *************************************************************************/ -U16 getFPGADVTArterialPressure( void ) -{ - return fpgaSensorReadings.arterialPressure; -} - -/*********************************************************************//** - * @brief - * The getFPGADVTArterialTemperature function gets the latest arterial pressure + * The getPBATemperature function gets the latest arterial pressure * sensor temperature reading. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return latest arterial pressure sensor temperature reading *************************************************************************/ -U16 getFPGADVTArterialTemperature( void ) +U32 getPBATemperature( void ) { - return fpgaSensorReadings.arterialPressureTemperature; + return fpgaSensorReadings.PBATemperature; } /*********************************************************************//** * @brief - * The getFPGADVTArterialPressureReadCounter function gets the latest arterial + * The getPBAReadCounter function gets the latest arterial * pressure sensor read counter. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return latest arterial pressure sensor read counter *************************************************************************/ -U08 getFPGADVTArterialPressureReadCounter( void ) +U08 getPBAReadCounter( void ) { - return fpgaSensorReadings.arterialPressureReadCount; + return fpgaSensorReadings.PBAReadCount; } /*********************************************************************//** * @brief - * The getFPGATDVTArterialPressureErrorCounter function gets the latest arterial + * The getPBAErrorCounter function gets the latest arterial * pressure sensor error counter. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return latest arterial pressure sensor error counter *************************************************************************/ -U08 getFPGATDVTArterialPressureErrorCounter( void ) +U08 getPBAErrorCounter( void ) { - return fpgaSensorReadings.arterialPressureErrorCount; + return fpgaSensorReadings.PBAErrorCount; } /*********************************************************************//** @@ -600,9 +495,9 @@ * @details \b Outputs: none * @return latest venous pressure reading *************************************************************************/ -U16 getFPGAVenousPressure( void ) +U32 getPBOPressure( void ) { - return fpgaSensorReadings.venousPressure; + return fpgaSensorReadings.PBoPressure; } /*********************************************************************//** @@ -613,9 +508,9 @@ * @details \b Outputs: none * @return latest venous pressure sensor temperature reading *************************************************************************/ -U16 getFPGAVenousPressureTemperature( void ) +U32 getPBOTemperature( void ) { - return fpgaSensorReadings.venousTemperature; + return fpgaSensorReadings.PBoTemperature; } /*********************************************************************//** @@ -626,9 +521,9 @@ * @details \b Outputs: none * @return latest venous pressure sensor read counter *************************************************************************/ -U08 getFPGAVenousPressureReadCounter( void ) +U08 getPBOReadCounter( void ) { - return fpgaSensorReadings.venousReadCounter; + return fpgaSensorReadings.PBoReadCount; } /*********************************************************************//** @@ -639,243 +534,13 @@ * @details \b Outputs: none * @return latest venous pressure sensor error counter *************************************************************************/ -U08 getFPGAVenousPressureErrorCounter( void ) +U08 getPBOErrorCounter( void ) { - return fpgaSensorReadings.VenousErrorCounter; + return fpgaSensorReadings.PBoErrorCount; } /*********************************************************************//** * @brief - * The setFPGASyringePumpControlFlags function sets the syringe pump control - * register per given bit flags. - * 0x40 - Sleep off - * 0x20 - Not reset - * 0x10 - Disable - * 0x08 - Reverse direction - * 0x01/02 - Microstep setting - * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints - * @param bitFlags Desired control bit settings for syringe pump - * @return none - *************************************************************************/ -void setFPGASyringePumpControlFlags( U08 bitFlags ) -{ - fpgaActuatorSetPoints.syringePumpControl = bitFlags; -} - -/*********************************************************************//** - * @brief - * The setFPGASyringePumpADCandDACControlFlags function sets the syringe pump - * ADC/DAC control register per given bit flags. - * 0x04 - Write ADC setup - * 0x02 - Read DAC on ADC - * 0x01 - Enable DAC (not ADC) - * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints - * @param bitFlags ADC/DAC control bit settings for syringe pump - * @return none - *************************************************************************/ -void setFPGASyringePumpADCandDACControlFlags( U08 bitFlags ) -{ - fpgaActuatorSetPoints.syringePumpADCandDACControl = bitFlags; -} - -/*********************************************************************//** - * @brief - * The setFPGASyringePumpDACOutputLevel function sets the syringe pump force - * sensor DAC output level register to a given value. - * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints - * @param counts level to set syringe pump force sensor DAC to - * @return none - *************************************************************************/ -void setFPGASyringePumpDACOutputLevel( U16 counts ) -{ - fpgaActuatorSetPoints.syringePumpDACOut = counts; -} - -/*********************************************************************//** - * @brief - * The setFPGASyringePumpStepToggleTime function sets the syringe pump stepper - * toggle time register to a given period (in uSec). - * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints - * @param microSeconds toggle the stepper motor at this time interval to set pump speed - * @return none - *************************************************************************/ -void setFPGASyringePumpStepToggleTime( U32 microSeconds ) -{ - fpgaActuatorSetPoints.syringePumpStepToggleTime = microSeconds; -} - -/*********************************************************************//** - * @brief - * The getFPGASyringePumpStatus function gets the latest syringe pump status - * register reading. Bit 0 indicates a fault. - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return Latest syringe pump status reading - *************************************************************************/ -U08 getFPGASyringePumpStatus( void ) -{ - return fpgaSensorReadings.syringePumpStatus; -} - -/*********************************************************************//** - * @brief - * The getFPGASyringePumpADCReadCounter function gets the latest syringe pump - * ADC read counter. Counter is 8-bit and rolls over when exceeding 255. - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return Latest syringe pump ADC read counter - *************************************************************************/ -U08 getFPGASyringePumpADCReadCounter( void ) -{ - return fpgaSensorReadings.syringePumpADCReadCounter; -} - -/*********************************************************************//** - * @brief - * The getFPGASyringePumpADCandDACStatus function gets the latest syringe pump - * ADC/DAC status register reading. - * Bit 7 = DAC write and read-back done - * Bit 6 = I2C error on DAC data transfer - * Bit 0..5 = count of I2C errors, rolls over after 63 - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return Latest syringe pump ADC/DAC status reading - *************************************************************************/ -U08 getFPGASyringePumpADCandDACStatus( void ) -{ - return fpgaSensorReadings.syringePumpADCandDACStatus; -} - -/*********************************************************************//** - * @brief - * The getFPGASyringePumpEncoderStatus function gets the latest syringe pump - * encoder status register reading. - * Bit 7 = direction (0=fwd, 1=rev) - * Bit 0..5 = direction error count (# of errors after power up, rolls over after 63) - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return Latest syringe pump encoder status reading - *************************************************************************/ -U08 getFPGASyringePumpEncoderStatus( void ) -{ - return fpgaSensorReadings.syringePumpEncoderStatus; -} - -/*********************************************************************//** - * @brief - * The getFPGASyringePumpEncoderPosition function gets the latest syringe pump - * encoder position reading. - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return Latest syringe pump encoder position reading - *************************************************************************/ -U32 getFPGASyringePumpEncoderPosition( void ) -{ - return fpgaSensorReadings.syringePumpEncPosition; -} - -/*********************************************************************//** - * @brief - * The getFPGASyringePumpADCChannel0 function gets the latest syringe pump ADC - * channel 0 register reading (syringe pump force sensor). - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return Latest syringe pump ADC channel 0 reading - *************************************************************************/ -U16 getFPGASyringePumpADCChannel0( void ) -{ - return fpgaSensorReadings.syringePumpAdcDataReadCh0; -} - -/*********************************************************************//** - * @brief - * The getFPGASyringePumpADCChannel1 function gets the latest syringe pump ADC - * channel 1 register reading (syringe detection switch). - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return Latest syringe pump ADC channel 1 reading - *************************************************************************/ -U16 getFPGASyringePumpADCChannel1( void ) -{ - return fpgaSensorReadings.syringePumpAdcDataReadCh1; -} - -/*********************************************************************//** - * @brief - * The getFPGASyringePumpADCChannel2 function gets the latest syringe pump ADC - * channel 2 register reading (syringe pump home position sensor). - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return Latest syringe pump ADC channel 2 reading - *************************************************************************/ -U16 getFPGASyringePumpADCChannel2( void ) -{ - return fpgaSensorReadings.syringePumpAdcDataReadCh2; -} - -/*********************************************************************//** - * @brief - * The getFPGASyringePumpADCChannel3 function gets the latest syringe pump ADC - * channel 3 register reading. - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return Latest syringe pump ADC channel 3 reading - *************************************************************************/ -U16 getFPGASyringePumpADCChannel3( void ) -{ - return fpgaSensorReadings.syringePumpAdcDataReadCh3; -} - -/*********************************************************************//** - * @brief - * The getFPGASyringePumpDACStatus function gets the latest syringe pump - * DAC status. - * Bit 0: PD0 - * Bit 1: PD1 - * Bit 2: POR - * Bit 3: Ready (not busy) - * Bits 4..7: N/A - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return Latest syringe pump DAC status reading - *************************************************************************/ -U08 getFPGASyringePumpDACStatus( void ) -{ - return fpgaSensorReadings.sPumpDACRdStatus; -} - -/*********************************************************************//** - * @brief - * The getFPGASyringePumpDACSetting function gets the latest syringe pump - * DAC setting. - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return Latest syringe pump DAC setting - *************************************************************************/ -U16 getFPGASyringePumpDACSetting( void ) -{ - return fpgaSensorReadings.sPumpDACSet; -} - -/*********************************************************************//** - * @brief - * The getFPGASyringePumpDACStoredSetting function gets the latest syringe - * pump DAC setting stored in sensor's EEPROM. - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return Latest syringe pump DAC setting stored in EEPROM - *************************************************************************/ -U16 getFPGASyringePumpDACStoredSetting( void ) -{ - return fpgaSensorReadings.sPumpDACEEProm; -} - -/*********************************************************************//** - * @brief * The getFPGABackupAlarmAudioCurrent function gets the latest piezo alarm * audio current reading. * @details \b Inputs: fpgaSensorReadings @@ -884,7 +549,7 @@ *************************************************************************/ F32 getFPGABackupAlarmAudioCurrent( void ) { - U16 adcCnts = fpgaSensorReadings.backupAlarmAudioPeakCurrent; + U16 adcCnts = fpgaSensorReadings.alarmBuzzerCurrentAdc; F32 result = ( ( (F32)adcCnts / (F32)BITS_12_FULL_SCALE ) * FPGA_BACKUP_ALARM_AUDIO_CONVERT ) * (F32)MA_PER_AMP; return result; @@ -900,7 +565,7 @@ *************************************************************************/ void getFPGAAirTrapLevels( BOOL *airAtLower, BOOL *airAtUpper ) { - U16 fpgaGPIO = fpgaSensorReadings.fpgaGPIO; + U16 fpgaGPIO = fpgaSensorReadings.GPIOReg; U16 lower = fpgaGPIO & FPGA_AIRTRAP_LEVEL_LOW_MASK; U16 upper = fpgaGPIO & FPGA_AIRTRAP_LEVEL_HIGH_MASK; @@ -918,23 +583,11 @@ *************************************************************************/ void setFPGAValvesControlMode( U16 bits ) { - fpgaActuatorSetPoints.fpgaPIDControl = bits; + //fpgaActuatorSetPoints.fpgaPIDControl = bits; } /*********************************************************************//** * @brief - * The getValvesStatus function reads the status of the valves. - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return Latest status of the valves - *************************************************************************/ -U16 getFPGAValvesStatus( void ) -{ - return fpgaSensorReadings.valveStatus; -} - -/*********************************************************************//** - * @brief * The noFPGAFluidLeakDetected function returns TRUE if no fluid leak has been * detected (dry) and FALSE if a fluid leak has been detected (wet). * @details \b Inputs: fpgaSensorReadings @@ -943,26 +596,26 @@ *************************************************************************/ BOOL noFPGAFluidLeakDetected( void ) { - U16 noFPGAFluidLeakDetected = fpgaSensorReadings.fpgaGPIO & FPGA_FLUID_LEAK_STATE_MASK; + U16 noFPGAFluidLeakDetected = fpgaSensorReadings.GPIOReg & FPGA_FLUID_LEAK_STATE_MASK; return ( 0 == noFPGAFluidLeakDetected ? FALSE : TRUE ); } /*********************************************************************//** * @brief - * The noFPGAVenousBubbleDetected function returns TRUE if no air bubble has - * been detected and FALSE if an air bubble has been detected. + * The ADVBubbleDetected function determines whether ADV bubble detector + * sensor is currently detecting a bubble. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none - * @return Latest bubble detected status + * @return TRUE if latest ADV reading shows bubble detected, FALSE if not *************************************************************************/ -BOOL noFPGAVenousBubbleDetected( void ) +BOOL ADVBubbleDetected( void ) { - U16 noFPGABubbleDetected = 0; + U16 noBubbleDetected = 0; - noFPGABubbleDetected = fpgaSensorReadings.fpgaGPIO & FPGA_ADV_BUBBLE_STATUS_MASK; + noBubbleDetected = fpgaSensorReadings.GPIOReg & FPGA_ADV_BUBBLE_STATUS_MASK; - return ( 0 != noFPGABubbleDetected ? TRUE : FALSE ); + return ( 0 == noBubbleDetected ? TRUE : FALSE ); } /*********************************************************************//** @@ -975,7 +628,7 @@ *************************************************************************/ void setFPGAVenousBubbleSelfTest( void ) { - fpgaActuatorSetPoints.fpgaSensorTest |= FPGA_ADV_BUBBLE_SELF_TEST_CMD; + //fpgaActuatorSetPoints.fpgaSensorTest |= FPGA_ADV_BUBBLE_SELF_TEST_CMD; } /*********************************************************************//** @@ -988,38 +641,50 @@ *************************************************************************/ void clearFPGAVenousBubbleSelfTest( void ) { - fpgaActuatorSetPoints.fpgaSensorTest &= ~FPGA_ADV_BUBBLE_SELF_TEST_CMD; + //fpgaActuatorSetPoints.fpgaSensorTest &= ~FPGA_ADV_BUBBLE_SELF_TEST_CMD; } /*********************************************************************//** * @brief - * The setValveBloodVenousPosition function sets the position of VBV + * The setVBVPosition function sets the target encoder position of VBV * in counts * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints - * @param setPoint The next encoder position of the valve in counts + * @param setPoint The target encoder position of the VBV in counts * @return none *************************************************************************/ -void setFPGAValveBloodVenousPosition( S16 setPoint ) +void setVBVPosition( S16 setPoint ) { - fpgaActuatorSetPoints.VBVSetPoint = setPoint; + fpgaActuatorSetPoints.VBVPosition = setPoint; } /*********************************************************************//** * @brief - * The getValveBloodVenousPosition function returns the current position - * of VBV in counts + * The getVBVPosition function returns the current encoder position of + * VBV in counts * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return The current encoder position of VBV *************************************************************************/ -S16 getFPGAValveBloodVenousPosition( void ) +S16 getVBVPosition( void ) { return fpgaSensorReadings.VBVPosition; } /*********************************************************************//** * @brief + * The getVBVStatus function reads the status of the venous pinch valve. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest status of the venous pinch valve + *************************************************************************/ +U16 getVBVStatus( void ) +{ + return fpgaSensorReadings.VBVStatus; +} + +/*********************************************************************//** + * @brief * The getFPGAValveBloodVenousCurrentCounts function returns the current * of VBV in counts * @details \b Inputs: fpgaSensorReadings @@ -1028,61 +693,46 @@ *************************************************************************/ U16 getFPGAValveBloodVenousCurrentCounts( void ) { - return fpgaSensorReadings.VBVCurrent; + return 0;//fpgaSensorReadings.VBVCurrent; } -#ifdef DEBUG_ENABLED /*********************************************************************//** * @brief - * The setFPGAValveBloodVenousPWM function sets the PWM of VBV in counts. + * The setVBAPosition function sets the target encoder position of the VBA + * in counts * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints - * @param count PWM counts to set for VBV + * @param setPoint The target encoder position of the VBA in counts * @return none *************************************************************************/ -void setFPGAValveBloodVenousPWM( U16 count ) +void setVBAPosition( S16 setPoint ) { - fpgaActuatorSetPoints.VBVPWMFixed = count; + fpgaActuatorSetPoints.VBAPosition = setPoint; } /*********************************************************************//** * @brief - * The getFPGAValveBloodVenousPWM function returns the PWM of VBV in counts. - * @details \b Inputs: fpgaActuatorSetPoints + * The getVBAPosition function reads the current encoder position of the + * VBA in counts + * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none - * @return The PWM counts for VBV + * @return The latest encoder position of VBA *************************************************************************/ -U16 getFPGAValveBloodVenousPWM( void ) +S16 getVBAPosition( void ) { - return fpgaSensorReadings.VBVPWMTarget; + return fpgaSensorReadings.VBAPosition; } -#endif /*********************************************************************//** * @brief - * The setValveBloodArterialPosition function sets the position of VBA - * in counts - * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints - * @param setPoint The next position of the valve in counts - * @return none - *************************************************************************/ -void setFPGAValveBloodArterialPosition( S16 setPoint ) -{ - fpgaActuatorSetPoints.VBASetPoint = setPoint; -} - -/*********************************************************************//** - * @brief - * The getValveBloodArterialPosition function reads the current position - * of VBA in counts + * The getVBAStatus function reads the status of the arterial pinch valve. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none - * @return The latest encoder position of VBA + * @return Latest status of the arterial pinch valve *************************************************************************/ -S16 getFPGAValveBloodArterialPosition( void ) +U16 getVBAStatus( void ) { - return fpgaSensorReadings.VBAPosition; + return fpgaSensorReadings.VBAStatus; } /*********************************************************************//** @@ -1095,7 +745,7 @@ *************************************************************************/ U16 getFPGAValveBloodArterialCurrentCounts( void ) { - return fpgaSensorReadings.VBACurrent; + return 0;//fpgaSensorReadings.; } /*********************************************************************//** @@ -1107,7 +757,7 @@ *************************************************************************/ U16 getFPGABoardTemperature( void ) { - return fpgaSensorReadings.fpgaTemperature; + return fpgaSensorReadings.fpgaAdcTemperature; } /*********************************************************************//** @@ -1119,7 +769,7 @@ *************************************************************************/ U16 getFPGAFrontDoorStatus( void ) { - return ( fpgaSensorReadings.fpgaGPIO & FRONT_DOOR_SWITCH_MASK ); + return ( fpgaSensorReadings.GPIOReg & FRONT_DOOR_SWITCH_MASK ); } /*********************************************************************//** @@ -1131,7 +781,7 @@ *************************************************************************/ U32 getFPGAPBAADCTemperature( void ) { - return fpgaSensorReadings.adc1Channel1; + return fpgaSensorReadings.PBATemperature; } /*********************************************************************//** @@ -1143,7 +793,7 @@ *************************************************************************/ U16 getFPGAInletFan1TogglePeriod( void ) { - return fpgaSensorReadings.fan1PulseTime; + return 0;//fpgaSensorReadings.fan1PulseTime; } /*********************************************************************//** Index: firmware/App/Services/FpgaTD.h =================================================================== diff -u -r3518e8a088c32e75c0c8960d5e629a7401095feb -rf730082d809bc52c15b2d17b8fd0a8d535e5c21a --- firmware/App/Services/FpgaTD.h (.../FpgaTD.h) (revision 3518e8a088c32e75c0c8960d5e629a7401095feb) +++ firmware/App/Services/FpgaTD.h (.../FpgaTD.h) (revision f730082d809bc52c15b2d17b8fd0a8d535e5c21a) @@ -53,63 +53,43 @@ U16 getFPGABloodPumpHallSensorCount( void ); U08 getFPGABloodPumpHallSensorStatus( void ); -U32 getFPGAArterialPressure( void ); -U08 getFPGAArterialPressureReadCounter( void ); -U08 getFPGAArterialPressureErrorCounter( void ); +U32 getPBAPressure( void ); +U32 getPBATemperature( void ); +U08 getPBAReadCounter( void ); +U08 getPBAErrorCounter( void ); -U16 getFPGADVTArterialPressure( void ); -U16 getFPGADVTArterialTemperature( void ); -U08 getFPGADVTArterialPressureReadCounter( void ); -U08 getFPGATDVTArterialPressureErrorCounter( void ); +U32 getPBOPressure( void ); +U32 getPBOTemperature( void ); +U08 getPBOReadCounter( void ); +U08 getPBOErrorCounter( void ); -U16 getFPGAVenousPressure( void ); -U16 getFPGAVenousPressureTemperature( void ); -U08 getFPGAVenousPressureReadCounter( void ); -U08 getFPGAVenousPressureErrorCounter( void ); - -void setFPGASyringePumpControlFlags( U08 bitFlags ); -void setFPGASyringePumpADCandDACControlFlags( U08 bitFlags ); -void setFPGASyringePumpDACOutputLevel( U16 counts ); -void setFPGASyringePumpStepToggleTime( U32 microSeconds ); -U08 getFPGASyringePumpStatus( void ); -U08 getFPGASyringePumpADCReadCounter( void ); -U08 getFPGASyringePumpADCandDACStatus( void ); -U08 getFPGASyringePumpEncoderStatus( void ); -U32 getFPGASyringePumpEncoderPosition( void ); -U16 getFPGASyringePumpADCChannel0( void ); -U16 getFPGASyringePumpADCChannel1( void ); -U16 getFPGASyringePumpADCChannel2( void ); -U16 getFPGASyringePumpADCChannel3( void ); -U08 getFPGASyringePumpDACStatus( void ); -U16 getFPGASyringePumpDACSetting( void ); -U16 getFPGASyringePumpDACStoredSetting( void ); - F32 getFPGABackupAlarmAudioCurrent( void ); void getFPGAAirTrapLevels( BOOL *airAtLower, BOOL *airAtUpper ); void setFPGAValvesControlMode( U16 bits ); -U16 getFPGAValvesStatus( void ); BOOL noFPGAFluidLeakDetected( void ); -BOOL noFPGAVenousBubbleDetected( void ); +BOOL ADVBubbleDetected( void ); void setFPGAVenousBubbleSelfTest( void ); void clearFPGAVenousBubbleSelfTest( void ); -void setFPGAValveBloodVenousPosition( S16 setPoint ); -S16 getFPGAValveBloodVenousPosition( void ); -U16 getFPGAValveBloodVenousCurrentCounts( void ); +void setVBVPosition( S16 setPoint ); +S16 getVBVPosition( void ); +U16 getVBVStatus( void ); +U16 getFPGAValveBloodVenousCurrentCounts( void ); -void setFPGAValveBloodArterialPosition( S16 setPoint ); -S16 getFPGAValveBloodArterialPosition( void ); -U16 getFPGAValveBloodArterialCurrentCounts( void ); +void setVBAPosition( S16 setPoint ); +S16 getVBAPosition( void ); +U16 getVBAStatus( void ); +U16 getFPGAValveBloodArterialCurrentCounts( void ); -U16 getFPGABoardTemperature( void ); -U32 getFPGAPBAADCTemperature( void ); -U16 getFPGAInletFan1TogglePeriod( void ); +U16 getFPGABoardTemperature( void ); +U32 getFPGAPBAADCTemperature( void ); +U16 getFPGAInletFan1TogglePeriod( void ); -U16 getFPGAFrontDoorStatus( void ); +U16 getFPGAFrontDoorStatus( void ); /**@}*/