Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -r120487ddf3e3d69d1de5094d5252c037588e2ed8 -ra8396c9e402372dd7c6ad9df69d5b5fb500a66bf --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 120487ddf3e3d69d1de5094d5252c037588e2ed8) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision a8396c9e402372dd7c6ad9df69d5b5fb500a66bf) @@ -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. @@ -193,7 +208,8 @@ 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. + 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 @@ -1342,17 +1343,43 @@ } /*********************************************************************//** +<<<<<<< HEAD +* 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: command +* @details \b Outputs: fpgaActuatorSetPoints.nibpCtl +* @return none +*************************************************************************/ +void setNIBPCommand( FPGA_NIBP_CMD_T command ) +{ + fpgaActuatorSetPoints.nibpCtl &= ~FPGA_NIBP_CMD_MASK; + fpgaActuatorSetPoints.nibpCtl |= ( (U16)command & FPGA_NIBP_CMD_MASK ); + fpgaActuatorSetPoints.nibpCtl |= FPGA_NIBP_CMD_RDY; +} + +/*********************************************************************//** +* The setNIBPInflatePressure function sets the initial NIBP cuff inflate +* pressure register. +* @details \b Inputs: pressure +* @details \b Outputs: fpgaActuatorSetPoints.nibpInflate +* @return none +*************************************************************************/ +void setNIBPInflatePressure( U16 pressure ) +{ + fpgaActuatorSetPoints.nibpInflate = pressure; +} + +/********************************************************************//** * @brief - * The setFPGASyringePumpControlFlags function sets the syringe pump control - * register per given bit flags. - * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints - * @param bitFlags control bit settings for syringe pump - * @return none - *************************************************************************/ -void setFPGASyringePumpControlFlags( U08 bitFlags ) + * The getNIBPControlStatus function returns the FPGA NIBP control status. + * @details \b Inputs: fpgaSensorReadings.nibpCtlStatus + * @details \b Outputs: none + * @return FPGA NIBP control status register. + ***************************************************************************/ +U08 getNIBPControlStatus( void ) { - fpgaActuatorSetPoints.h10Control = bitFlags; + return fpgaSensorReadings.nibpCtlStatus; } /*********************************************************************//** @@ -1412,6 +1439,63 @@ /*********************************************************************//** * @brief + * The getNIBPStatusResponse function returns the FPGA NIBP response status. + * @details \b Inputs: fpgaSensorReadings.nibpStatusResp + * @details \b Outputs: none + * @return FPGA NIBP response status register. + ***************************************************************************/ +U08 getNIBPStatusResponse( void ) +{ + return fpgaSensorReadings.nibpStatusResp; +} + +/*********************************************************************//** +* The getNIBPCuffPressure function returns the FPGA NIBP cuff pressure. +* @details \b Inputs: fpgaSensorReadings.cuffPressure +* @details \b Outputs: none +* @return NIBP cuff pressure in mmHg. +*************************************************************************/ +S16 getNIBPCuffPressure( void ) +{ + return fpgaSensorReadings.cuffPressure; +} + +/*********************************************************************//** +* The getNIBPSystolicPressure function returns the FPGA systolic blood +* pressure measurement. +* @details \b Inputs: fpgaSensorReadings.bpSystolic +* @details \b Outputs: none +* @return Systolic blood pressure in mmHg. +*************************************************************************/ +U16 getNIBPSystolicPressure( void ) +{ + return fpgaSensorReadings.bpSystolic; +} + +/*********************************************************************//** +* The getNIBPDiastolicPressure function returns the FPGA diastolic blood +* pressure measurement. +* @details \b Inputs: fpgaSensorReadings.bpDiastolic +* @details \b Outputs: none +* @return Diastolic blood pressure in mmHg. +*************************************************************************/ +U16 getNIBPDiastolicPressure( void ) +{ + return fpgaSensorReadings.bpDiastolic; +} + +/*********************************************************************//** +* The getNIBPHeartRate function returns the FPGA heart rate measurement. +* @details \b Inputs: fpgaSensorReadings.bpHr +* @details \b Outputs: none +* @return Heart rate in BPM. +*************************************************************************/ +U16 getNIBPHeartRate( void ) +{ + return fpgaSensorReadings.bpHr; +} + +/*********************************************************************//** * 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