Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -r1b83a4555c4040a45cecfbea45b6570812ab281e -r80a7440462a8f87ee11ed62371baba2d87bb6d89 --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 1b83a4555c4040a45cecfbea45b6570812ab281e) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 80a7440462a8f87ee11ed62371baba2d87bb6d89) @@ -71,6 +71,9 @@ #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. +#define FPGA_NIBP_CMD_MASK 0x0F ///< Bit mask for NIBP command bits +#define FPGA_NIBP_CMD_RDY 0x10 ///< NIBP command ready pulse bit + /// Control bits to run syringe pump in reverse direction // TODO - move to syringe pump controller unit when implemented. static const U08 SYRINGE_PUMP_CONTROL_RUN_REVERSE = SYRINGE_PUMP_CONTROL_SLEEP_OFF | SYRINGE_PUMP_CONTROL_NOT_RESET | @@ -165,6 +168,18 @@ U32 baroTemperature; ///< Reg 372. Baro temperature value in counts. U08 baroReadCount; ///< Reg 376. Baro read count. U08 baroErrorCount; ///< Reg 377. Baro error count. + U08 notUsed; ///< Reg 378. + U08 sPumpDacRdByte2; ///< Reg 379. + U08 sPumpDacRdByte3; ///< Reg 380. + U08 sPumpDacRdByte4; ///< Reg 381. + U08 sPumpDacRdByte5; ///< Reg 382. + U08 sPumpDacRdByte6; ///< Reg 383. + U08 nibpCtlStatus; ///< Reg 384. NIBP control status register. + U08 nibpStatusResp; ///< Reg 385. NIBP response status register. + S16 cuffPressure; ///< Reg 386. NIBP cuff pressure in mmHg. + U16 bpSystolic; ///< Reg 388. Systolic BP in mmHg. + U16 bpDiastolic; ///< Reg 390. Diastolic BP in mmHg. + U16 bpHr; ///< Reg 392. Heart rate in BPM. } FPGA_SENSORS_T; /// Record structure for FPGA continuous priority writes. @@ -192,8 +207,9 @@ U08 h10Control; ///< Reg 33. H10 Syringe pump control register. U32 h10Speed; ///< Reg 34. H10 Syringe pump time between step toggle (1/2 step period). U16 h10DACData; ///< Reg 38. H10 Syringe pump DAC data (12 bits). - U16 h10DACControl; ///< Reg 40. H10 Syringe pump ADC and DAC control register. - U16 h12Period; ///< Reg 42. H12 Air pump time period for each count in PWM register. + U08 h10DACControl; ///< Reg 40. H10 Syringe pump ADC and DAC control register. + U16 nibpCtl; ///< Reg 41. NIBP control register. + U16 nibpInflate; ///< Reg 42. NIBP inflate pressure register. U32 h5SetSpeed; ///< Reg 44. H5 ejector motor set speed. } FPGA_ACTUATORS_T; @@ -950,21 +966,6 @@ /*********************************************************************//** * @brief - * The setH12AirPumpMotorPWMCntTime function sets the air pump motor PWM count - * time in increments of 10 nS. The PWM period will then be 255 x given - * value x 10 nS. - * @details \b Inputs: fpgaActuatorSetPoints.h12Period - * @details \b Outputs: fpgaActuatorSetPoints.h12Period - * @param tenNS The time associated with each PWM count in power level setting. - * @return none - *************************************************************************/ -void setH12AirPumpMotorPWMCntTime( U16 tenNS ) -{ - fpgaActuatorSetPoints.h12Period = tenNS; -} - -/*********************************************************************//** - * @brief * The H18BubbleDetected function determines whether H18 bubble detector * sensor is currently detecting a bubble. * @details \b Inputs: fpgaSensorReadings @@ -1352,9 +1353,8 @@ *************************************************************************/ void setFPGASyringePumpControlFlags( U08 bitFlags ) { - fpgaActuatorSetPoints.h10Control = bitFlags; + return fpgaActuatorSetPoints.h10Control = bitFlags; } - /*********************************************************************//** * @brief * The setFPGASyringePumpADCandDACControlFlags function sets the syringe pump @@ -1563,4 +1563,116 @@ return fpgaSensorReadings.h10DACEEProm; } +/*********************************************************************//** +* @brief +* The setNIBPCommand function sets the FPGA NIBP command bits and pulses +* the command ready bit to notify the FPGA that a new NIBP command is +* available. +* @details \b Inputs: none +* @details \b Outputs: fpgaActuatorSetPoints +* @param command Blood pressure command to send to the FPGA. +* @return none +*************************************************************************/ +void setNIBPCommand( U08 command ) +{ + fpgaActuatorSetPoints.nibpCtl &= ~FPGA_NIBP_CMD_MASK; + fpgaActuatorSetPoints.nibpCtl |= ( (U16)command & FPGA_NIBP_CMD_MASK ); + if ( 0 == command ) + { + fpgaActuatorSetPoints.nibpCtl &= ~FPGA_NIBP_CMD_RDY; + } + else + { + fpgaActuatorSetPoints.nibpCtl |= FPGA_NIBP_CMD_RDY; + } +} + +/*********************************************************************//** +* @brief +* The setNIBPInflatePressure function sets the initial NIBP cuff inflate +* pressure register. +* @details \b Inputs: fpgaActuatorSetPoints +* @details \b Outputs: none +* @param pressure Initial cuff inflation pressure in mmHg. +* @return none +*************************************************************************/ +void setNIBPInflatePressure( U16 pressure ) +{ + fpgaActuatorSetPoints.nibpInflate = pressure; +} + +/********************************************************************//** + * @brief + * The getNIBPControlStatus function returns the FPGA NIBP control status. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return FPGA NIBP control status register. + ***************************************************************************/ +U08 getNIBPControlStatus( void ) +{ + return fpgaSensorReadings.nibpCtlStatus; +} + +/*********************************************************************//** + * @brief + * The getNIBPStatusResponse function returns the FPGA NIBP response status. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return FPGA NIBP response status register. + ***************************************************************************/ +U08 getNIBPStatusResponse( void ) +{ + return fpgaSensorReadings.nibpStatusResp; +} + +/*********************************************************************//** +* @brief +* The getNIBPCuffPressure function returns the FPGA NIBP cuff pressure. +* @details \b Inputs: fpgaSensorReadings +* @details \b Outputs: none +* @return NIBP cuff pressure in mmHg. +*************************************************************************/ +S16 getNIBPCuffPressure( void ) +{ + return fpgaSensorReadings.cuffPressure; +} + +/*********************************************************************//** +* @brief +* The getNIBPSystolicPressure function returns the FPGA systolic blood +* pressure measurement. +* @details \b Inputs: fpgaSensorReadings +* @details \b Outputs: none +* @return Systolic blood pressure in mmHg. +*************************************************************************/ +U16 getNIBPSystolicPressure( void ) +{ + return fpgaSensorReadings.bpSystolic; +} + +/*********************************************************************//** +* @brief +* The getNIBPDiastolicPressure function returns the FPGA diastolic blood +* pressure measurement. +* @details \b Inputs: fpgaSensorReadings +* @details \b Outputs: none +* @return Diastolic blood pressure in mmHg. +*************************************************************************/ +U16 getNIBPDiastolicPressure( void ) +{ + return fpgaSensorReadings.bpDiastolic; +} + +/*********************************************************************//** +* @brief +* The getNIBPHeartRate function returns the FPGA heart rate measurement. +* @details \b Inputs: fpgaSensorReadings +* @details \b Outputs: none +* @return Heart rate in BPM. +*************************************************************************/ +U16 getNIBPHeartRate( void ) +{ + return fpgaSensorReadings.bpHr; +} + /**@}*/