Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -r87d705fcf977af12b7b034735fa5867f2daea2b9 -r961784c895cb8f551a2623cd02dcbfe42d04b7c2 --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 87d705fcf977af12b7b034735fa5867f2daea2b9) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 961784c895cb8f551a2623cd02dcbfe42d04b7c2) @@ -45,11 +45,11 @@ #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_BP_ENABLE_BIT_MASK 0x01 ///< Bit mask for enabling the blood pump. -#define FPGA_BP_DIRECTION_FWD_BIT_MASK 0x02 ///< Bit mask for setting the blood pump direction. -#define FPGA_BP_HOME_BIT_MASK 0x04 ///< Bit mask for requesting a blood pump home operation. +#define FPGA_H4_ENABLE_BIT_MASK 0x01 ///< Bit mask for enabling the blood pump. +#define FPGA_H4_DIRECTION_REV_BIT_MASK 0x02 ///< Bit mask for setting the blood pump direction. +#define FPGA_H4_HOME_BIT_MASK 0x04 ///< Bit mask for requesting a blood pump home operation. -#define FPGA_VBT_OPEN_BIT_MASK 0x01 ///< Bit mask for setting VBT valve position to open. +#define FPGA_H13_OPEN_BIT_MASK 0x01 ///< Bit mask for setting H13 valve position to open. #define FPGA_INPUT_VOLTAGE_SCALE 3.0F ///< FPGA source and aux voltage. #define FPGA_PVN_VOLTAGE_SCALE 1.0F ///< FPGA pvn voltage. @@ -59,14 +59,14 @@ #define FPGA_BACKUP_ALARM_AUDIO_CONVERT 0.4F ///< Converts backup (piezo) alarm audio ADC volts to amps. -#define FRONT_DOOR_SWITCH_MASK 0x0010 ///< Front door switch bit mask. Bit 4 of the GPIO register. +#define H9_SWITCH_MASK 0x0010 ///< Front door switch bit mask. Bit 4 of the GPIO register. #define PUMP_TRACK_SWITCH_MASK 0x0020 ///< Pump track switch bit mask. Bit 5 of the GPIO register. -#define FPGA_AIRTRAP_LEVEL_LOW_MASK 0x0008 ///< Bit mask for air trap lower level sensor. -#define FPGA_AIRTRAP_LEVEL_HIGH_MASK 0x0004 ///< Bit mask for air trap upper level sensor. +#define FPGA_AIRTRAP_LEVEL_LOW_H17_MASK 0x0008 ///< Bit mask for air trap lower level sensor. +#define FPGA_AIRTRAP_LEVEL_HIGH_H16_MASK 0x0004 ///< Bit mask for air trap upper level sensor. -#define FPGA_ADV_BUBBLE_STATUS_MASK 0x0002 ///< Bit mask for venous air bubble detector input status. -#define FPGA_ADV_BUBBLE_SELF_TEST_CMD 0x08 ///< Bit for venous air bubble detector self-test command. +#define FPGA_H18_BUBBLE_STATUS_MASK 0x0002 ///< Bit mask for venous air bubble detector input status. +#define FPGA_H18_BUBBLE_SELF_TEST_CMD 0x08 ///< Bit for venous air bubble detector self-test command. // FPGA Sensors Record #pragma pack(push,1) @@ -87,86 +87,78 @@ 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. + U08 BPHallStatus; ///< Reg 261. BP hall sensor status. U16 sPumpDACSet; ///< Reg 262. Syringe pump DAC setting. U16 sPumpDACEEProm; ///< Reg 264. Syringe pump DAC EEProm data. - U16 PBoPressure; ///< Reg 266. PBo raw pressure data. - S16 PBoTemperature; ///< Reg 268. PBo raw temperature data. - U08 PBoReadCount; ///< Reg 270. PBo read count. - U08 PBoErrorCount; ///< Reg 271. PBo error count. - U32 reserved3; ///< Reg 272. Reserved and available for future use. - U16 PBAPressure; ///< Reg 276. PBA raw pressure data. - S16 PBATemperature; ///< Reg 278. PBA raw temperature data. - U08 PBAReadCount; ///< Reg 280. PBA read count. - U08 PBAErrorCount; ///< Reg 281. PBA error count. - S16 VBACmdPosition; ///< Reg 282. VBA commanded position (200 steps/rev). - S16 VBAEncPosition; ///< Reg 284. VBA encoder position (1024 counts/rev). - U08 VBAStatus; ///< Reg 286. VBA status. - U08 reserved4; ///< Reg 287. Reserved and available for future use. - 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 (RPM). - S16 BPTorque; ///< Reg 296. BP measured torque. - S16 BPSpeedFromHall; ///< Reg 298. BP measured speed from hall sensor(s). - S16 VBVCmdPosition; ///< Reg 300. VBV commanded position (200 steps/rev). - S16 VBVEncPosition; ///< Reg 302. VBV encoder position (1024 counts/rev). - U08 VBVStatus; ///< Reg 304. VBV status. - U08 BPStatus; ///< Reg 305. BP status. - 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. - U08 VBTStatus; ///< Reg 334. VBT status register. - U08 VBTStatusPWM; ///< Reg 335. VBT PWM status register. - S16 ACPower1Current; ///< Reg 336. AC power current - 1. - S16 ACPower1Voltage; ///< Reg 338. AC power voltage - 1. - S16 ACPower2Current; ///< Reg 340. AC power current - 2. - S16 ACPower2Voltage; ///< Reg 342. AC power voltage - 2. - S16 ACPower3Current; ///< Reg 344. AC power current - 3. - S16 ACPower3Voltage; ///< Reg 346. AC power voltage - 3. + U16 h14Pressure; ///< Reg 266. H14 raw pressure data. + S16 h14Temperature; ///< Reg 268. H14 raw temperature data. + U08 h14ReadCount; ///< Reg 270. H14 read count. + U08 h14ErrorCount; ///< Reg 271. H14 error count. + U16 h2Pressure; ///< Reg 272. H2 raw pressure data. + S16 h2Temperature; ///< Reg 274. H2 raw temperature data. + U08 h2ReadCount; ///< Reg 276. H2 read count. + U08 h2ErrorCount; ///< Reg 277. H2 error count. + S16 H1CmdPosition; ///< Reg 278. H1 commanded position (200 steps/rev). + S16 H1EncPosition; ///< Reg 280. H1 encoder position (1024 counts/rev). + U08 H1Status; ///< Reg 282. H1 status. + U08 reserved4; ///< Reg 283. Reserved and available for future use. + U08 BEMStatus; ///< Reg 284. BEM status. + U08 BEMEncStatus; ///< Reg 285. BEM encoder status. + S32 BEMEncPosition; ///< Reg 286. BEM encoder position. + S16 H4Period; ///< Reg 290. H4 measured period (10 uSec). + S16 H4Torque; ///< Reg 292. H4 measured torque. + S16 H4SpeedFromHall; ///< Reg 294. H4 measured speed from hall sensor(s). + S16 H19CmdPosition; ///< Reg 296. H19 commanded position (200 steps/rev). + S16 H19EncPosition; ///< Reg 298. H19 encoder position (1024 counts/rev). + U08 H19Status; ///< Reg 300. H19 status. + U08 BPStatus; ///< Reg 301. BP status. + U16 GPIOReg; ///< Reg 302. GPIO register. + U08 HEPStatus; ///< Reg 304. HEP status register. + U08 HEPAdcReadCount; ///< Reg 305. HEP ADC read counter. + U08 HEPAdcDacStatus; ///< Reg 306. HEP ADC/DAC status register. + U08 HEPEncStatus; ///< Reg 307. HEP encoder status register. + S32 HEPEncPosition; ///< Reg 308. HEP encoder position. + U16 HEPAdcCh0; ///< Reg 312. HEP ADC channel 0 reading. + U16 HEPAdcCh1; ///< Reg 314. HEP ADC channel 1 reading. + U16 HEPAdcCh2; ///< Reg 316. HEP ADC channel 2 reading. + U16 HEPAdcCh3; ///< Reg 318. HEP ADC channel 3 reading. + U16 fpgaAdcTemperature; ///< Reg 320. FPGA ADC temperature. + U16 fpga1msTimerCounter; ///< Reg 322. FPGA 1 millisecond timer counter. + U16 alarmBuzzerCurrentAdc; ///< Reg 324. Alarm buzzer current ADC reading. + U16 fpgaVccInternalAdc; ///< Reg 326. FPGA Vcc internal voltage ADC reading. + U16 fpgaCompatibilityRev; ///< Reg 328. Compatibility revision. + U08 VBTStatus; ///< Reg 330. VBT status register. + U08 VBTStatusPWM; ///< Reg 331. VBT PWM status register. + S16 ACPower1Current; ///< Reg 332. AC power current - 1. + S16 ACPower1Voltage; ///< Reg 334. AC power voltage - 1. + S16 ACPower2Current; ///< Reg 336. AC power current - 2. + S16 ACPower2Voltage; ///< Reg 338. AC power voltage - 2. + S16 ACPower3Current; ///< Reg 340. AC power current - 3. + S16 ACPower3Voltage; ///< Reg 342. AC power voltage - 3. + S32 ACHeaterTemp; ///< Reg 344. AC heater temperature. + U16 H4RotorHallSpeed; ///< Reg 348. H4 rotor speed from hall sensor. } FPGA_SENSORS_T; /// Record structure for FPGA continuous priority writes. typedef struct { U16 fpgaGenWrRd; ///< Reg 04. FPGA general write/read-back register (mirrored to a general read register in read page at addr 256). - U08 VBTControl; ///< Reg 06. VBT valve control register. - U08 reserved1; ///< Reg 07. Reserved. - U08 VBTPWMEnable; ///< Reg 08. VBT valve PWM enable register. - U08 reserved2; ///< Reg 09. Reserved. - 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 ACHeaterPWM; ///< Reg 16. AC heater PWM duty cycle 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 (RPM). - U08 BPControl; ///< Reg 24. Blood pump control register. - U08 VBVControl; ///< Reg 25. VBV control register. - U16 VBVPosition; ///< Reg 26. VBV position set register (200 steps/rev). - U16 VBAPosition; ///< Reg 28. VBA position set register (200 steps/rev). - U16 VBAControl; ///< Reg 30. VBA control register. - U08 reserved3; ///< Reg 31. Reserved. - U16 reserved4; ///< Reg 32. Reserved. - U08 alarmControl; ///< Reg 34. Alarm audio control register. - U08 reserved5; ///< Reg 35. Reserved. - U32 reserved6; ///< Reg 36. Reserved. - U16 reserved7; ///< Reg 40. Reserved. - U16 reserved8; ///< Reg 42. Reserved. - U08 sensorTest; ///< Reg 44. Sensor self-test control register. + U08 h13Control; ///< Reg 06. H13 valve control register. + U08 h13PWMEnable; ///< Reg 07. H13 valve PWM enable register. + U16 h13PWMLowPeriod; ///< Reg 08. H13 PWM low signal period register. + U16 h13PWMPeriod; ///< Reg 10. H13 PWM period register. + U16 h13PWMPUllInTime; ///< Reg 12. H13 PWM pull in time register. + U08 h12Control; ///< Reg 14. H12 Air pump control register. + U08 h5Control; ///< Reg 15. H5 ejector stepper motor control register. + U16 h5SetSpeed; ///< Reg 16. H5 ejector stepper motor step register. + U16 H4SetSpeed; ///< Reg 18. H4 Blood pump speed set register (RPM). + U08 H4Control; ///< Reg 20. H4 Blood pump control register. + U08 H19Control; ///< Reg 21. H19 control register. + U16 H19Position; ///< Reg 22. H19 position set register (200 steps/rev). + U16 H1Position; ///< Reg 24. H1 position set register (200 steps/rev). + U08 H1Control; ///< Reg 26. H1 control register. + U08 valveEncoderControl; ///< Reg 27. H1/H19 encoder control register. + U08 alarmControl; ///< Reg 28. Alarm audio control register. } FPGA_ACTUATORS_T; #pragma pack(pop) @@ -202,9 +194,9 @@ memset( &fpgaActuatorSetPoints, 0, sizeof(FPGA_ACTUATORS_T) ); fpgaActuatorSetPoints.alarmControl = (U08)MIN_ALARM_VOLUME_ATTENUATION << 2; // Start alarm audio volume at maximum - // Set VBA and VBV to default configuration + disabled so they do not run immediately on power up - fpgaActuatorSetPoints.VBAControl = FPGA_PINCH_VALVES_1_32_STEP | FPGA_PINCH_VALVES_DISABLE | FPGA_PINCH_VALVES_NOT_RESET | FPGA_PINCH_VALVES_NOT_SLEEP; - fpgaActuatorSetPoints.VBVControl = FPGA_PINCH_VALVES_1_32_STEP | FPGA_PINCH_VALVES_DISABLE | FPGA_PINCH_VALVES_NOT_RESET | FPGA_PINCH_VALVES_NOT_SLEEP; + // Set H1 and H19 to default configuration + disabled so they do not run immediately on power up + fpgaActuatorSetPoints.H1Control = FPGA_PINCH_VALVES_1_32_STEP | FPGA_PINCH_VALVES_DISABLE | FPGA_PINCH_VALVES_NOT_RESET | FPGA_PINCH_VALVES_NOT_SLEEP; + fpgaActuatorSetPoints.H19Control = FPGA_PINCH_VALVES_1_32_STEP | FPGA_PINCH_VALVES_DISABLE | FPGA_PINCH_VALVES_NOT_RESET | FPGA_PINCH_VALVES_NOT_SLEEP; // initialize FPGA comm failures windowed timer count initTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_COMM_FAILURES, MAX_FPGA_COMM_FAILURES, MAX_FPGA_COMM_FAILURES_WINDOW_MS); @@ -413,28 +405,28 @@ /*********************************************************************//** * @brief - * The setBPEnabled function enables or disables the blood pump per + * The setH4Enabled function enables or disables the blood pump per * the given flag. * @details \b Inputs: none * @details \b Outputs: Blood pump enabled or disabled (bit 0 of BP control register) * @param enable TRUE if BP enable is requested, FALSE if BP disable is requested * @return none *************************************************************************/ -void setBPEnabled( BOOL enable ) +void setH4Enabled( BOOL enable ) { if ( TRUE == enable ) { - fpgaActuatorSetPoints.BPControl |= FPGA_BP_ENABLE_BIT_MASK; + fpgaActuatorSetPoints.H4Control |= FPGA_H4_ENABLE_BIT_MASK; } else { - fpgaActuatorSetPoints.BPControl &= ~((U08)FPGA_BP_ENABLE_BIT_MASK); + fpgaActuatorSetPoints.H4Control &= ~((U08)FPGA_H4_ENABLE_BIT_MASK); } } /*********************************************************************//** * @brief - * The setBPDirection function sets the direction for the blood pump + * The setH4Direction function sets the direction for the blood pump * motor to the given direction. * @details \b Inputs: none * @details \b Outputs: Blood pump motor direction is set (bit 1 of BP control register). @@ -443,75 +435,90 @@ * @param dir the desired direction for the blood pump motor (fwd or rev) * @return none *************************************************************************/ -void setBPDirection( MOTOR_DIR_T dir ) +void setH4Direction( MOTOR_DIR_T dir ) { if ( MOTOR_DIR_REVERSE == dir ) { - fpgaActuatorSetPoints.BPControl &= ~((U08)FPGA_BP_DIRECTION_FWD_BIT_MASK); + fpgaActuatorSetPoints.H4Control |= FPGA_H4_DIRECTION_REV_BIT_MASK; } else { - fpgaActuatorSetPoints.BPControl |= FPGA_BP_DIRECTION_FWD_BIT_MASK; + fpgaActuatorSetPoints.H4Control &= ~((U08)FPGA_H4_DIRECTION_REV_BIT_MASK); } } /*********************************************************************//** * @brief - * The homeBP function sets the bit requesting that the blood pump + * The homeH4 function sets the bit requesting that the blood pump * be homed. * @details \b Inputs: none - * @details \b Outputs: BP home request is set (bit 2 of BP control register). + * @details \b Outputs: H4 pump home request is set (bit 2 of H4 control register). * @return none *************************************************************************/ -void homeBP( void ) +void homeH4( void ) { - fpgaActuatorSetPoints.BPControl |= FPGA_BP_HOME_BIT_MASK; + fpgaActuatorSetPoints.H4Control |= FPGA_H4_HOME_BIT_MASK; } /*********************************************************************//** * @brief - * The resetBPHomeRequest function resets the fpga blood pump home + * The resetH4HomeRequest function resets the fpga blood pump home * request. * @note This function should be called after request is made and transmission * to FPGA is complete. * @details \b Inputs: none - * @details \b Outputs: BP home request is cleared (bit 2 of BP control register) + * @details \b Outputs: H4 pump home request is cleared (bit 2 of H4 control register) * @return none *************************************************************************/ -void resetBPHomeRequest( void ) +void resetH4HomeRequest( void ) { - fpgaActuatorSetPoints.BPControl &= ~((U08)FPGA_BP_HOME_BIT_MASK); + fpgaActuatorSetPoints.H4Control &= ~((U08)FPGA_H4_HOME_BIT_MASK); } /*********************************************************************//** * @brief - * The setBPSetSpeed function sets the fpga blood pump set speed + * The setH4SetSpeed function sets the fpga blood pump set speed * to the given speed (0..3000 RPM). * @details \b Inputs: none - * @details \b Outputs: BP set speed is set - * @param rpm the set point for the BP speed (in RPM). + * @details \b Outputs: H4 set speed is set + * @param rpm the set point for the H4 pump speed (in RPM). * @return none *************************************************************************/ -void setBPSetSpeed( U16 rpm ) +void setH4SetSpeed( U16 rpm ) { - fpgaActuatorSetPoints.BPSetSpeed = rpm; + fpgaActuatorSetPoints.H4SetSpeed = rpm; } /*********************************************************************//** * @brief - * The getBPSpeed function gets the latest blood pump speed (in RPM) + * The getH4Period function gets the latest blood pump period (in 10uSec) * from the FPGA. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none - * @return Latest blood pump speed. + * @return Latest blood pump period. *************************************************************************/ -U16 getBPSpeed( void ) +U16 getH4Period( void ) { - return fpgaSensorReadings.BPSpeed; + return fpgaSensorReadings.H4Period; } /*********************************************************************//** * @brief + * The getBPStatus function gets the latest blood pump hall sensor status. + * Bit 0: 0=Forward pump direction detected, 1=Reverse pump direction detected + * Bit 1: 0=Correct pump direction detected, 1=Incorrect pump direction detected + * Bit 2..7: Running incorrect pump direction counter (wraps). + * @details \b Inputs: fpgaSensorReadings.BPHallStatus + * @details \b Outputs: none + * @return Latest blood pump hall sensor status bits. + *************************************************************************/ +U08 getBPStatus( void ) +{ + return fpgaSensorReadings.BPHallStatus; +} + +/*********************************************************************//** + * @brief * The getBloodPumpHallSensorCount function gets the latest blood pump * hall sensor count. Count is a 16 bit free running counter. If counter is * counting up, indicates motor is running in forward direction. If counter is @@ -544,110 +551,110 @@ /*********************************************************************//** * @brief - * The getPBAPressure function gets the latest arterial pressure reading. + * The getH2Pressure function gets the latest arterial pressure reading. * The high 2 bits are status bits: 00=ok, 01=cmd mode, 10=stale data, 11=diag * The low 14 bits are data. Zero is at 1638. Values above are positive, * below are negative. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return latest arterial pressure reading *************************************************************************/ -U16 getPBAPressure( void ) +U16 getH2Pressure( void ) { - return fpgaSensorReadings.PBAPressure; + return fpgaSensorReadings.h2Pressure; } /*********************************************************************//** * @brief - * The getPBATemperature function gets the latest arterial pressure + * The getH2Temperature function gets the latest arterial pressure * sensor temperature reading. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return latest arterial pressure sensor temperature reading *************************************************************************/ -S16 getPBATemperature( void ) +S16 getH2Temperature( void ) { - return fpgaSensorReadings.PBATemperature; + return fpgaSensorReadings.h2Temperature; } /*********************************************************************//** * @brief - * The getPBAReadCounter function gets the latest arterial + * The getH2ReadCounter 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 getPBAReadCounter( void ) +U08 getH2ReadCounter( void ) { - return fpgaSensorReadings.PBAReadCount; + return fpgaSensorReadings.h2ReadCount; } /*********************************************************************//** * @brief - * The getPBAErrorCounter function gets the latest arterial + * The getH2ErrorCounter 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 getPBAErrorCounter( void ) +U08 getH2ErrorCounter( void ) { - return fpgaSensorReadings.PBAErrorCount; + return fpgaSensorReadings.h2ErrorCount; } /*********************************************************************//** * @brief - * The getPBOPressure function gets the latest venous pressure reading. + * The getH14Pressure function gets the latest venous pressure reading. * The high 2 bits are status bits: 00=ok, 01=cmd mode, 10=stale data, 11=diag * The low 14 bits are data. Zero is at 1638. Values above are positive, * below are negative. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return latest venous pressure reading *************************************************************************/ -U16 getPBOPressure( void ) +U16 getH14Pressure( void ) { - return fpgaSensorReadings.PBoPressure; + return fpgaSensorReadings.h14Pressure; } /*********************************************************************//** * @brief - * The getPBOTemperature function gets the latest venous pressure + * The getH14Temperature function gets the latest venous pressure * sensor temperature reading. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return latest venous pressure sensor temperature reading *************************************************************************/ -S16 getPBOTemperature( void ) +S16 getH14Temperature( void ) { - return fpgaSensorReadings.PBoTemperature; + return fpgaSensorReadings.h14Temperature; } /*********************************************************************//** * @brief - * The getPBOReadCounter function gets the latest venous pressure + * The getH14ReadCounter function gets the latest venous pressure * sensor read counter. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return latest venous pressure sensor read counter *************************************************************************/ -U08 getPBOReadCounter( void ) +U08 getH14ReadCounter( void ) { - return fpgaSensorReadings.PBoReadCount; + return fpgaSensorReadings.h14ReadCount; } /*********************************************************************//** * @brief - * The getPBOErrorCounter function gets the latest venous pressure + * The getH14ErrorCounter function gets the latest venous pressure * sensor error counter. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return latest venous pressure sensor error counter *************************************************************************/ -U08 getPBOErrorCounter( void ) +U08 getH14ErrorCounter( void ) { - return fpgaSensorReadings.PBoErrorCount; + return fpgaSensorReadings.h14ErrorCount; } /*********************************************************************//** @@ -677,47 +684,47 @@ void getFPGAAirTrapLevels( BOOL *airAtLower, BOOL *airAtUpper ) { U16 fpgaGPIO = fpgaSensorReadings.GPIOReg; - U16 lower = fpgaGPIO & FPGA_AIRTRAP_LEVEL_LOW_MASK; - U16 upper = fpgaGPIO & FPGA_AIRTRAP_LEVEL_HIGH_MASK; + U16 lower = fpgaGPIO & FPGA_AIRTRAP_LEVEL_LOW_H17_MASK; + U16 upper = fpgaGPIO & FPGA_AIRTRAP_LEVEL_HIGH_H16_MASK; *airAtLower = ( 0 == lower ? FALSE : TRUE ); *airAtUpper = ( 0 == upper ? FALSE : TRUE ); } /*********************************************************************//** * @brief - * The setFPGAValvesControlMode function sets the valves control mode. - * @note VBTControl register bit 0 will drive state of VBT valve (0=closed, 1=open). + * The setH13ValveState function sets the command position for H13 valve. + * @note VBTControl register bit 0 will drive state of H13 valve (0=closed, 1=open). * @details \b Inputs: fpgaActuatorSetPoints * @details \b Outputs: fpgaActuatorSetPoints - * @param bits : The bits to enable the PID controller of a valve + * @param state : The valve state to command H13 valve to * @return none *************************************************************************/ -void setVBTValveState( OPN_CLS_STATE_T state ) +void setH13ValveState( OPN_CLS_STATE_T state ) { if ( STATE_OPEN == state ) { - fpgaActuatorSetPoints.VBTControl |= FPGA_VBT_OPEN_BIT_MASK; + fpgaActuatorSetPoints.h13Control |= FPGA_H13_OPEN_BIT_MASK; } else { - fpgaActuatorSetPoints.VBTControl &= ~((U08)FPGA_VBT_OPEN_BIT_MASK); + fpgaActuatorSetPoints.h13Control &= ~((U08)FPGA_H13_OPEN_BIT_MASK); } } /*********************************************************************//** * @brief - * The ADVBubbleDetected function determines whether ADV bubble detector + * The H18BubbleDetected function determines whether H18 bubble detector * sensor is currently detecting a bubble. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none - * @return TRUE if latest ADV reading shows bubble detected, FALSE if not + * @return TRUE if latest H18 reading shows bubble detected, FALSE if not *************************************************************************/ -BOOL ADVBubbleDetected( void ) +BOOL H18BubbleDetected( void ) { U16 noBubbleDetected = 0; - noBubbleDetected = fpgaSensorReadings.GPIOReg & FPGA_ADV_BUBBLE_STATUS_MASK; + noBubbleDetected = fpgaSensorReadings.GPIOReg & FPGA_H18_BUBBLE_STATUS_MASK; return ( 0 == noBubbleDetected ? TRUE : FALSE ); } @@ -732,7 +739,7 @@ *************************************************************************/ void setFPGAVenousBubbleSelfTest( void ) { - fpgaActuatorSetPoints.sensorTest |= FPGA_ADV_BUBBLE_SELF_TEST_CMD; +// fpgaActuatorSetPoints.sensorTest |= FPGA_ADV_BUBBLE_SELF_TEST_CMD; } /*********************************************************************//** @@ -745,12 +752,12 @@ *************************************************************************/ void clearFPGAVenousBubbleSelfTest( void ) { - fpgaActuatorSetPoints.sensorTest &= ~FPGA_ADV_BUBBLE_SELF_TEST_CMD; +// fpgaActuatorSetPoints.sensorTest &= ~FPGA_ADV_BUBBLE_SELF_TEST_CMD; } /*********************************************************************//** * @brief - * The setVBAControl function sets the control bits for the venous pinch valve. + * The setH19Control function sets the control bits for the venous pinch valve. * Microstep setting: bits 0..2: * 0=full step (100% torque) * 1=1/2 step (100% torque) @@ -776,82 +783,82 @@ * @param controlBits The control bits to apply to the venous pinch valve. * @return none *************************************************************************/ -void setVBVControl( U08 controlBits ) +void setH19Control( U08 controlBits ) { - + fpgaActuatorSetPoints.H19Control = controlBits; } /*********************************************************************//** * @brief - * The getVBVControl function gets the current control bits for the VBV. + * The getH19Control function gets the current control bits for the H19 valve. * @details \b Inputs: fpgaActuatorSetPoints * @details \b Outputs: none - * @return fpgaActuatorSetPoints.VBVControl + * @return fpgaActuatorSetPoints.H19Control *************************************************************************/ -U08 getVBVControl( void ) +U08 getH19Control( void ) { - return fpgaActuatorSetPoints.VBVControl; + return fpgaActuatorSetPoints.H19Control; } /*********************************************************************//** * @brief - * The setVBVPosition function sets the travel from current position for the - * VBV in counts (or microcounts if microstepping is set in control register). + * The setH19Position function sets the travel from current position for the + * H19 valve in counts (or microcounts if microstepping is set in control register). * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints - * @param setPoint The target encoder position of the VBV in counts + * @param setPoint The target encoder position of the H19 valve in counts * @return none *************************************************************************/ -void setVBVPosition( U16 setPoint ) +void setH19Position( U16 setPoint ) { - fpgaActuatorSetPoints.VBVPosition = setPoint; + fpgaActuatorSetPoints.H19Position = setPoint; } /*********************************************************************//** * @brief - * The getVBVEncoderPosition function reads the current encoder position of the - * VBV in counts. + * The getH19EncoderPosition function reads the current encoder position of the + * H19 valve in counts. * @note There are 1024 encoder counts per revolution. The encoder position * register provides the number of steps traveled since last command given. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none - * @return The current encoder position of VBV + * @return The current encoder position of H19 valve *************************************************************************/ -S16 getVBVEncoderPosition( void ) +S16 getH19EncoderPosition( void ) { - return fpgaSensorReadings.VBVEncPosition; + return fpgaSensorReadings.H19EncPosition; } /*********************************************************************//** * @brief - * The getVBVCmdPosition function returns the current amount of travel + * The getH19CmdPosition function returns the current amount of travel * from the pre-command position in steps (or microsteps if microstepping is - * set in control register) for VBV. + * set in control register) for H19 valve. * @note There are 200 steps per revolution * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none - * @return The commanded encoder position of VBV + * @return The commanded encoder position of H19 valve *************************************************************************/ -S16 getVBVCmdPosition( void ) +S16 getH19CmdPosition( void ) { - return fpgaSensorReadings.VBVCmdPosition; + return fpgaSensorReadings.H19CmdPosition; } /*********************************************************************//** * @brief - * The getVBVStatus function reads the status of the venous pinch valve. + * The getH19Status 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 ) +U16 getH19Status( void ) { - return fpgaSensorReadings.VBVStatus; + return fpgaSensorReadings.H19Status; } /*********************************************************************//** * @brief - * The setVBAControl function sets the control bits for the arterial pinch valve. + * The setH1Control function sets the control bits for the arterial pinch valve. * Microstep setting: bits 0..2: * 0=full step (100% torque) * 1=1/2 step (100% torque) @@ -877,76 +884,76 @@ * @param controlBits The control bits to apply to the arterial pinch valve. * @return none *************************************************************************/ -void setVBAControl( U08 controlBits ) +void setH1Control( U08 controlBits ) { - fpgaActuatorSetPoints.VBAControl = controlBits; + fpgaActuatorSetPoints.H1Control = controlBits; } /*********************************************************************//** * @brief - * The getVBAControl function gets the current control bits for the VBA. + * The getH1Control function gets the current control bits for the H1 valve. * @details \b Inputs: fpgaActuatorSetPoints * @details \b Outputs: none - * @return fpgaActuatorSetPoints.VBAControl + * @return fpgaActuatorSetPoints.H1Control *************************************************************************/ -U08 getVBAControl( void ) +U08 getH1Control( void ) { - return fpgaActuatorSetPoints.VBAControl; + return fpgaActuatorSetPoints.H1Control; } /*********************************************************************//** * @brief - * The setVBAPosition function sets the travel from current position for the - * VBA in counts (or microcounts if microstepping is set in control register). + * The setH1Position function sets the travel from current position for the + * H1 valve in counts (or microcounts if microstepping is set in control register). * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints - * @param setPoint The target encoder position of the VBA in counts + * @param setPoint The target encoder position of the H1 valve in counts * @return none *************************************************************************/ -void setVBAPosition( U16 setPoint ) +void setH1Position( U16 setPoint ) { - fpgaActuatorSetPoints.VBAPosition = setPoint; + fpgaActuatorSetPoints.H1Position = setPoint; } /*********************************************************************//** * @brief - * The getVBAEncoderPosition function reads the current encoder position of the - * VBA in counts. + * The getH1EncoderPosition function reads the current encoder position of the + * H1 valve in counts. * @note There are 1024 encoder counts per revolution * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none - * @return The latest encoder position of VBA + * @return The latest encoder position of H1 valve *************************************************************************/ -S16 getVBAEncoderPosition( void ) +S16 getH1EncoderPosition( void ) { - return fpgaSensorReadings.VBAEncPosition; + return fpgaSensorReadings.H1EncPosition; } /*********************************************************************//** * @brief - * The getVBACmdPosition function returns returns the current amount of travel + * The getH1CmdPosition function returns returns the current amount of travel * from the pre-command position in steps (or microsteps if microstepping is - * set in control register) for VBA. + * set in control register) for H1 valve. * @note There are 200 steps per revolution * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none - * @return The commanded encoder position of VBA + * @return The commanded encoder position of H1 valve *************************************************************************/ -S16 getVBACmdPosition( void ) +S16 getH1CmdPosition( void ) { - return fpgaSensorReadings.VBACmdPosition; + return fpgaSensorReadings.H1CmdPosition; } /*********************************************************************//** * @brief - * The getVBAStatus function reads the status of the arterial pinch valve. + * The getH1Status function reads the status of the arterial pinch valve. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return Latest status of the arterial pinch valve *************************************************************************/ -U16 getVBAStatus( void ) +U16 getH1Status( void ) { - return fpgaSensorReadings.VBAStatus; + return fpgaSensorReadings.H1Status; } /*********************************************************************//** @@ -972,7 +979,7 @@ { BOOL result = TRUE; - if ( ( fpgaSensorReadings.GPIOReg & FRONT_DOOR_SWITCH_MASK ) != 0 ) + if ( ( fpgaSensorReadings.GPIOReg & H9_SWITCH_MASK ) != 0 ) { result = FALSE; } @@ -989,7 +996,7 @@ *************************************************************************/ U32 getFPGAPBAADCTemperature( void ) { - return fpgaSensorReadings.PBATemperature; + return fpgaSensorReadings.h2Temperature; } /*********************************************************************//**