Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -r036a75d76ab01912646a480b935d97187a231a19 -r52e1d4487a69a1ef0475321084527c0ba86c0892 --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 036a75d76ab01912646a480b935d97187a231a19) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 52e1d4487a69a1ef0475321084527c0ba86c0892) @@ -47,7 +47,6 @@ #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_H13_OPEN_BIT_MASK 0x01 ///< Bit mask for setting H13 valve position to open. #define FPGA_H20_OPEN_BIT_MASK 0x02 ///< Bit mask for setting H20 valve position to open. @@ -88,7 +87,7 @@ 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 BPHallStatus; ///< Reg 261. BP hall sensor status. + U08 h6HallStatus; ///< Reg 261. H6 hall sensor status. U16 sPumpDACSet; ///< Reg 262. Syringe pump DAC setting. U16 sPumpDACEEProm; ///< Reg 264. Syringe pump DAC EEProm data. U16 h14Pressure; ///< Reg 266. H14 raw pressure data. @@ -103,16 +102,16 @@ S16 H1EncPosition; ///< Reg 280. H1 encoder position (1024 counts/rev). U08 H1Status; ///< Reg 282. H1 status. U08 reserved1; ///< 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. + U08 H5Status; ///< Reg 284. H5 motor status. + U08 H5EncStatus; ///< Reg 285. H5 encoder status. + S32 H5EncPosition; ///< Reg 286. H5 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. + U08 H4Status; ///< Reg 301. H4 status. U16 GPIOReg; ///< Reg 302. GPIO register. U08 HEPStatus; ///< Reg 304. HEP status register. U08 HEPAdcReadCount; ///< Reg 305. HEP ADC read counter. @@ -136,8 +135,8 @@ 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. + S16 H4RotorHallCount; ///< Reg 344. H4 rotor count from hall sensor. + U08 H6RotorStatus; ///< Reg 346. H6 rotor status. } FPGA_SENSORS_T; /// Record structure for FPGA continuous priority writes. @@ -475,34 +474,6 @@ /*********************************************************************//** * @brief - * The homeH4 function sets the bit requesting that the blood pump - * be homed. - * @details \b Inputs: none - * @details \b Outputs: H4 pump home request is set (bit 2 of H4 control register). - * @return none - *************************************************************************/ -void homeH4( void ) -{ - fpgaActuatorSetPoints.H4Control |= FPGA_H4_HOME_BIT_MASK; -} - -/*********************************************************************//** - * @brief - * 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: H4 pump home request is cleared (bit 2 of H4 control register) - * @return none - *************************************************************************/ -void resetH4HomeRequest( void ) -{ - fpgaActuatorSetPoints.H4Control &= ~((U08)FPGA_H4_HOME_BIT_MASK); -} - -/*********************************************************************//** - * @brief * The setH4SetSpeed function sets the fpga blood pump set speed * to the given speed (0..3000 RPM). * @details \b Inputs: none @@ -530,53 +501,36 @@ /*********************************************************************//** * @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 + * The getH6Status function gets the latest blood pump hall sensor status. + * Bit 0: 1=Magnet is detected (used for homing in forward direction) + * Bit 1: 0=Reverse pump direction detected, 1=Forward pump direction detected + * Bit 2..7: Not used. + * @details \b Inputs: fpgaSensorReadings.h6HallStatus * @details \b Outputs: none * @return Latest blood pump hall sensor status bits. *************************************************************************/ -U08 getBPStatus( void ) +U08 getH6Status( void ) { - return fpgaSensorReadings.BPHallStatus; + return fpgaSensorReadings.h6HallStatus; } /*********************************************************************//** * @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 - * counting down, indicates motor is running in reverse direction. Counter will - * wrap at 0/65535. - * @details \b Inputs: fpgaSensorReadings + * The getH4RotorCount function gets the latest blood pump + * hall sensor count. Count is number of ms between rotor revolutions. + * If direction is forward, the count will be positive. If direction is + * reverse, the count will be negative. + * @details \b Inputs: fpgaSensorReadings.H4RotorHallCount * @details \b Outputs: none * @return Latest blood pump hall sensor count reading. *************************************************************************/ -U16 getBloodPumpHallSensorCount( void ) +S16 getH4RotorCount( void ) { - return 0;//fpgaSensorReadings.bloodPumpHallSensorCount; + return fpgaSensorReadings.H4RotorHallCount; } /*********************************************************************//** * @brief - * The getBloodPumpHallSensorStatus function gets the latest blood pump - * hall sensor status. - * Bit 7 - Derived direction of the blood pump motor (0=Fwd, 1=Rev) - * Bit 6 - Unused - * Bit 5-0 - Direction error count since power-up (rolls over) - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return latest blood pump hall sensor status reading. - *************************************************************************/ -U08 getBloodPumpHallSensorStatus( void ) -{ - return 0;//fpgaSensorReadings.bloodPumpHallSensorStatus; -} - -/*********************************************************************//** - * @brief * 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,