Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -r291d652fcd09b461728962a547d3b08163737d76 -r539d38e6125069ea8aa908631e62fd8adf05459c --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 291d652fcd09b461728962a547d3b08163737d76) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 539d38e6125069ea8aa908631e62fd8adf05459c) @@ -165,6 +165,15 @@ U32 baroTemperature; ///< Reg 372. Baro temperature value in counts. U08 baroReadCount; ///< Reg 376. Baro read count. U08 baroErrorCount; ///< Reg 377. Baro error count. + 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. + U16 bpMap; ///< Reg 394. Mean arterial pressure in mmHg. + U08 bpStatus; ///< Reg 396. BP status register. + U08 bpErrorCode; ///< Reg 397. BP error code register. } FPGA_SENSORS_T; /// Record structure for FPGA continuous priority writes. @@ -193,7 +202,8 @@ U32 syrPumpSpeed; ///< Reg 34. Syringe pump time between step toggle (1/2 step period). U16 syrPumpDACData; ///< Reg 38. Syringe pump DAC data (12 bits). U16 syrPumpDACControl; ///< Reg 40. Syringe pump ADC and DAC control register. - U16 h12Period; ///< Reg 42. H12 Air pump time period for each count in PWM register. + U08 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 +960,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 @@ -1341,4 +1336,216 @@ } } +/*********************************************************************//** +* 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 |= ( (U08)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; +} + +/*********************************************************************//** +* The getNIBPControl function returns the FPGA NIBP control register. +* @details \b Inputs: fpgaActuatorSetPoints.nibpCtl +* @details \b Outputs: none +* @return FPGA NIBP control register value. +*************************************************************************/ +U08 getNIBPControl( void ) +{ + return fpgaActuatorSetPoints.nibpCtl; +} + +/*********************************************************************//** +* The setNIBPControl function sets the FPGA NIBP control register. +* @details \b Inputs: control +* @details \b Outputs: fpgaActuatorSetPoints.nibpCtl +* @return none +*************************************************************************/ +void setNIBPControl( U08 control ) +{ + fpgaActuatorSetPoints.nibpCtl = control; +} + +/*********************************************************************//** +* The getNIBPLastCommand function returns the last FPGA processed NIBP +* command. +* @details \b Inputs: fpgaSensorReadings.nibpCtlStatus +* @details \b Outputs: none +* @return FPGA NIBP command. +*************************************************************************/ +FPGA_NIBP_CMD_T getNIBPLastCommand( void ) +{ + return ( FPGA_NIBP_CMD_T )( fpgaSensorReadings.nibpCtlStatus & FPGA_NIBP_CMD_MASK ); +} + +/*********************************************************************//** +* The isNIBPCommandReady function returns the FPGA NIBP command ready +* status. +* @details \b Inputs: fpgaSensorReadings.nibpCtlStatus +* @details \b Outputs: none +* @return TRUE if command ready is set, FALSE otherwise. +*************************************************************************/ +BOOL isNIBPCommandReady( void ) +{ + return( ( fpgaSensorReadings.nibpCtlStatus & FPGA_NIBP_CMD_RDY ) != 0 ); +} + +/*********************************************************************//** +* The isNIBPResponseValid function returns the FPGA NIBP response valid +* status bit. +* @details \b Inputs: fpgaSensorReadings.nibpStatusResp +* @details \b Outputs: none +* @return TRUE if NIBP response is valid, FALSE otherwise. +*************************************************************************/ +BOOL isNIBPResponseValid( void ) +{ + return( ( fpgaSensorReadings.nibpStatusResp & FPGA_NIBP_RESP_VALID ) != 0 ); +} + +/*********************************************************************//** +* The isNIBPMeasuring function returns the FPGA NIBP measurement active +* status bit. +* @details \b Inputs: fpgaSensorReadings.nibpStatusResp +* @details \b Outputs: none +* @return TRUE if NIBP measurement is active, FALSE otherwise. +*************************************************************************/ +BOOL isNIBPMeasuring( void ) +{ + return( ( fpgaSensorReadings.nibpStatusResp & FPGA_NIBP_MEASURING ) != 0 ); +} + +/*********************************************************************//** +* The getNIBPResponseCode function returns the FPGA NIBP response code. +* @details \b Inputs: fpgaSensorReadings.nibpStatusResp +* @details \b Outputs: none +* @return FPGA NIBP response code. +*************************************************************************/ +U08 getNIBPResponseCode( void ) +{ + return( ( fpgaSensorReadings.nibpStatusResp & FPGA_NIBP_RESP_CODE_MASK ) >> FPGA_NIBP_RESP_CODE_SHIFT ); +} + +/*********************************************************************//** +* The isNIBPModuleError function returns the FPGA NIBP module error +* status bit. +* @details \b Inputs: fpgaSensorReadings.nibpStatusResp +* @details \b Outputs: none +* @return TRUE if module error exists, FALSE otherwise. +*************************************************************************/ +BOOL isNIBPModuleError( void ) +{ + return( ( fpgaSensorReadings.nibpStatusResp & FPGA_NIBP_MODULE_ERROR ) != 0 ); +} + +/*********************************************************************//** +* The isNIBPModuleBusy function returns the FPGA NIBP module busy +* status bit. +* @details \b Inputs: fpgaSensorReadings.nibpStatusResp +* @details \b Outputs: none +* @return TRUE if module busy exists, FALSE otherwise. +*************************************************************************/ +BOOL isNIBPModuleBusy( void ) +{ + return( ( fpgaSensorReadings.nibpStatusResp & FPGA_NIBP_MODULE_BUSY ) != 0 ); +} + +/*********************************************************************//** +* 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 getNIBPMAP function returns the FPGA mean arterial pressure +* measurement. +* @details \b Inputs: fpgaSensorReadings.bpMap +* @details \b Outputs: none +* @return Mean arterial pressure in mmHg. +*************************************************************************/ +U16 getNIBPMAP( void ) +{ + return fpgaSensorReadings.bpMap; +} + +/*********************************************************************//** +* The getNIBPStatus function returns the FPGA NIBP status register. +* @details \b Inputs: fpgaSensorReadings.bpStatus +* @details \b Outputs: none +* @return FPGA NIBP status register value. +*************************************************************************/ +U08 getNIBPStatus( void ) +{ + return fpgaSensorReadings.bpStatus; +} + +/*********************************************************************//** +* The getNIBPErrorCode function returns the FPGA NIBP error code. +* @details \b Inputs: fpgaSensorReadings.bpErrorCode +* @details \b Outputs: none +* @return FPGA NIBP error code. +*************************************************************************/ +U08 getNIBPErrorCode( void ) +{ + return fpgaSensorReadings.bpErrorCode; +} + /**@}*/