Index: firmware/App/Drivers/GLXferPump.c =================================================================== diff -u -rc049177f4d18a4740a357941b48a833d7115b581 -r539d38e6125069ea8aa908631e62fd8adf05459c --- firmware/App/Drivers/GLXferPump.c (.../GLXferPump.c) (revision c049177f4d18a4740a357941b48a833d7115b581) +++ firmware/App/Drivers/GLXferPump.c (.../GLXferPump.c) (revision 539d38e6125069ea8aa908631e62fd8adf05459c) @@ -57,7 +57,6 @@ { currentAirPumpMotorPowerLevel = AIR_PUMP_MOTOR_OFF; setH12AirPumpMotorPowerLevel( currentAirPumpMotorPowerLevel ); - setH12AirPumpMotorPWMCntTime( AIR_PUMP_PWM_TIME ); } /*********************************************************************//** 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; +} + /**@}*/ Index: firmware/App/Services/FpgaTD.h =================================================================== diff -u -r291d652fcd09b461728962a547d3b08163737d76 -r539d38e6125069ea8aa908631e62fd8adf05459c --- firmware/App/Services/FpgaTD.h (.../FpgaTD.h) (revision 291d652fcd09b461728962a547d3b08163737d76) +++ firmware/App/Services/FpgaTD.h (.../FpgaTD.h) (revision 539d38e6125069ea8aa908631e62fd8adf05459c) @@ -52,6 +52,21 @@ #define SYRINGE_PUMP_CONTROL_FORWARD_DIR 0x00 ///< Syringe pump control register bit mask for forward direction. #define SYRINGE_PUMP_CONTROL_32TH_STEP 0x03 ///< Syringe pump control register bits for 1/32 micro-stepping mode. +// Bit definitions for NIBP control register +#define FPGA_NIBP_CMD_MASK 0x0F ///< Bit mask for NIBP command bits [3:0]. +#define FPGA_NIBP_CMD_RDY 0x10 ///< NIBP command ready pulse bit. +#define FPGA_NIBP_PUMP_ON 0x20 ///< NIBP pump manual control enable bit. +#define FPGA_NIBP_CTRL_VALVE_CLOSE 0x40 ///< NIBP control valve close bit. +#define FPGA_NIBP_DUMP_VALVE_CLOSE 0x80 ///< NIBP dump valve close bit. + +// Bit definitions for NIBP response register +#define FPGA_NIBP_RESP_VALID 0x01 ///< Indicates valid NIBP response available. +#define FPGA_NIBP_MEASURING 0x02 ///< Indicates NIBP measurement in progress. +#define FPGA_NIBP_RESP_CODE_MASK 0x3C ///< Bit mask for NIBP response code bits [5:2]. +#define FPGA_NIBP_RESP_CODE_SHIFT 2 ///< Shift for NIBP response code bits. +#define FPGA_NIBP_MODULE_ERROR 0x40 ///< Indicates NIBP module command processing error. +#define FPGA_NIBP_MODULE_BUSY 0x80 ///< Indicates NIBP module busy processing command. + /// Baro sensor manufacturing coefficients typedef struct { @@ -65,6 +80,22 @@ U16 baroPromCRC; ///< Reg 366. Baro prom CRC. } BARO_PRES_SENSOR_MFG_T; +/// FPGA NIBP command definitions +typedef enum +{ + FPGA_NIBP_CMD_IDLE = 0x00, ///< No command. + FPGA_NIBP_CMD_GET_MODULE_DATA = 0x01, ///< Get NIBP module information. + FPGA_NIBP_CMD_SET_INITIAL_INFLATE = 0x02, ///< Set initial cuff inflate pressure. + FPGA_NIBP_CMD_START_BP = 0x03, ///< Start adult BP measurement. + FPGA_NIBP_CMD_START_PEDS_BP = 0x04, ///< Start pediatric BP measurement. + FPGA_NIBP_CMD_ABORT_BP = 0x05, ///< Abort active BP measurement. + FPGA_NIBP_CMD_GET_CUFF_PRESSURE = 0x06, ///< Read cuff pressure. + FPGA_NIBP_CMD_GET_BP_DATA = 0x07, ///< Read BP measurement data. + FPGA_NIBP_CMD_SET_SLEEP_MODE = 0x08, ///< Set NIBP module sleep mode. + FPGA_NIBP_CMD_CONTROL_PNEUMATICS = 0x09, ///< Control pneumatic outputs. + FPGA_NIBP_CMD_RESET = 0x0A ///< Reset NIBP module. +} FPGA_NIBP_CMD_T; + // ********** public function prototypes ********** void initFpgaTD( void ); @@ -128,7 +159,6 @@ U16 getH12AirPumpMotorRPM( void ); void setH12AirPumpMotorPowerLevel( U08 power ); -void setH12AirPumpMotorPWMCntTime( U16 tenNS ); void setH19Control( U08 controlBits ); U08 getH19Control( void ); @@ -152,6 +182,28 @@ U32 getFPGAEjectorRetractOpticalSensor( void ); U32 getFPGAEjectorEngageOpticalSensor( void ); +void setNIBPCommand( FPGA_NIBP_CMD_T command ); +void setNIBPInflatePressure( U16 pressure ); +U08 getNIBPControl( void ); +void setNIBPControl( U08 control ); + +FPGA_NIBP_CMD_T getNIBPLastCommand( void ); + +BOOL isNIBPCommandReady( void ); +BOOL isNIBPResponseValid( void ); +BOOL isNIBPMeasuring( void ); +BOOL isNIBPModuleError( void ); +BOOL isNIBPModuleBusy( void ); + +U08 getNIBPResponseCode( void ); +S16 getNIBPCuffPressure( void ); +U16 getNIBPSystolicPressure( void ); +U16 getNIBPDiastolicPressure( void ); +U16 getNIBPHeartRate( void ); +U16 getNIBPMAP( void ); +U08 getNIBPStatus( void ); +U08 getNIBPErrorCode( void ); + /**@}*/ #endif