Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -r0ca78c9f9a1abfdbae54d38063898cd5d4ecca81 -r7f22307635cf6c73dca1a2cc86c5f57ae62dde4d --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 0ca78c9f9a1abfdbae54d38063898cd5d4ecca81) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 7f22307635cf6c73dca1a2cc86c5f57ae62dde4d) @@ -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,12 @@ 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. @@ -197,7 +206,7 @@ U08 alarmControl; ///< Reg 32. Alarm audio control register. U08 syrPumpControl; ///< Reg 33. Syringe pump control register. 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 syrPumpDACData; ///< Reg 38. Syringe pump DAC data U16 syrPumpDACControl; ///< Reg 40. Syringe pump ADC and DAC control register. U08 nibpCtl; ///< Reg 41. NIBP control register. U16 nibpInflate; ///< Reg 42. NIBP inflate pressure register. @@ -1360,127 +1369,31 @@ 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 ) +/********************************************************************//** + * @brief + * 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 ) { - return fpgaActuatorSetPoints.nibpCtl; + return fpgaSensorReadings.nibpCtlStatus; } /*********************************************************************//** -* The setNIBPControl function sets the FPGA NIBP control register. -* @details \b Inputs: control -* @details \b Outputs: fpgaActuatorSetPoints.nibpCtl -* @return none -*************************************************************************/ -void setNIBPControl( U08 control ) + * @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 ) { - fpgaActuatorSetPoints.nibpCtl = control; + return fpgaSensorReadings.nibpStatusResp; } /*********************************************************************//** -* 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 ) -{ - BOOL result = FALSE; - result = ( ( fpgaSensorReadings.nibpCtlStatus & FPGA_NIBP_CMD_RDY ) != 0 ) ? TRUE : FALSE; - - return result; -} - -/*********************************************************************//** -* 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 ) -{ - BOOL result = FALSE; - result = ( ( fpgaSensorReadings.nibpStatusResp & FPGA_NIBP_RESP_VALID ) != 0 ) ? TRUE : FALSE; - - return result; -} - -/*********************************************************************//** -* 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 ) -{ - BOOL result = FALSE; - result = ( ( fpgaSensorReadings.nibpStatusResp & FPGA_NIBP_MEASURING ) != 0 ) ? TRUE : FALSE; - - return result; -} - -/*********************************************************************//** -* 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 ) -{ - BOOL result = FALSE; - result = ( ( fpgaSensorReadings.nibpStatusResp & FPGA_NIBP_MODULE_ERROR ) != 0 ) ? TRUE : FALSE; - - return result; -} - -/*********************************************************************//** -* 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 ) -{ - BOOL result = FALSE; - result = ( ( fpgaSensorReadings.nibpStatusResp & FPGA_NIBP_MODULE_BUSY ) != 0 ) ? TRUE : FALSE; - - return result; -} - -/*********************************************************************//** * The getNIBPCuffPressure function returns the FPGA NIBP cuff pressure. * @details \b Inputs: fpgaSensorReadings.cuffPressure * @details \b Outputs: none Index: firmware/App/Services/FpgaTD.h =================================================================== diff -u -r1920626b448b9ee88ae9fcfb5461067fc92da648 -r7f22307635cf6c73dca1a2cc86c5f57ae62dde4d --- firmware/App/Services/FpgaTD.h (.../FpgaTD.h) (revision 1920626b448b9ee88ae9fcfb5461067fc92da648) +++ firmware/App/Services/FpgaTD.h (.../FpgaTD.h) (revision 7f22307635cf6c73dca1a2cc86c5f57ae62dde4d) @@ -52,21 +52,6 @@ #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 { @@ -83,17 +68,17 @@ /// 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_IDLE = 0x00, ///< No command. + FPGA_NIBP_CMD_GET_MODULE_DATA = 0x01, ///< Get NIBP module data. + FPGA_NIBP_CMD_SET_INITIAL_INFLATE = 0x02, ///< Set initial 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 BP measurement. + FPGA_NIBP_CMD_GET_CUFF_PRESSURE = 0x06, ///< Get cuff pressure. + FPGA_NIBP_CMD_GET_BP_DATA = 0x07, ///< Get BP data. + FPGA_NIBP_CMD_SET_SLEEP_MODE = 0x08, ///< Set sleep mode. + FPGA_NIBP_CMD_CONTROL_PNEUMATICS = 0x09, ///< Control pneumatics. + FPGA_NIBP_CMD_RESET = 0x0A ///< Reset NIBP module. } FPGA_NIBP_CMD_T; // ********** public function prototypes ********** @@ -179,28 +164,19 @@ U16 getFPGAInletFan1TogglePeriod( void ); BOOL getH9FrontDoorClosedStatus( void ); -U32 getFPGAEjectorRetractOpticalSensor( void ); -U32 getFPGAEjectorEngageOpticalSensor( void ); +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 ); +U08 getNIBPControlStatus( void ); +U08 getNIBPStatusResponse( void ); S16 getNIBPCuffPressure( void ); U16 getNIBPSystolicPressure( void ); U16 getNIBPDiastolicPressure( void ); U16 getNIBPHeartRate( void ); + /**@}*/ #endif