Index: firmware/App/Services/FPGA.h =================================================================== diff -u -rc672f41061bcd500d6593655641cb27ce3ae58fc -r69b93e39861c5493d273f25d9e43cacd0b5819e2 --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision c672f41061bcd500d6593655641cb27ce3ae58fc) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision 69b93e39861c5493d273f25d9e43cacd0b5819e2) @@ -21,11 +21,18 @@ #include "HDCommon.h" #include "Interrupts.h" + /** * @defgroup FPGA FPGA * @brief FPGA service module. - * Maintains latest sensor readings at priority task interval. Updates actuator - * states at priority task interval. + * The FPGA module manages communication between the HD and the FPGA via UART. + * This module is driven by the Priority Task via calls to two FPGA executive functions: + * 1) an incoming executive manages the states of the state machine that deal with responses and data received from the FPGA + * 2) an outgoing executive manages transmission of write and read commands to the FPGA. + * This module first reads the header record that includes the FPGA ID and revision and + * verifies the FPGA ID to check FPGA communication. It then initializes and configures the ADCs and + * various other sensors that are interfaced via the FPGA. Then, it essentially enters an infinite loop + * where a bulk write command updates actuator set points and a bulk read command retrieves the latest sensor readings. * * @addtogroup FPGA * @{ @@ -45,13 +52,24 @@ void getFPGAVersions( U08 *Id, U08 *Maj, U08 *Min, U08 *Lab ); -void setAlarmAudioState( ALARM_PRIORITY_T state, U32 volumeLevel ); +void setAlarmAudioState( U32 state, U32 volumeLevel ); F32 getFPGABloodFlowSignalStrength( void ); F32 getFPGADialysateFlowSignalStrength( void ); F32 getFPGABloodFlow( void ); +U08 getFPGABloodFlowMeterStatus( void ); +U08 getFPGABloodFlowFastPacketReadCounter( void ); +U08 getFPGABloodFlowSlowPacketReadCounter( void ); +U08 getFPGABloodFlowStatusPacketReadCounter( void ); +U08 getFPGABloodFlowErrorCounter( void ); + F32 getFPGADialysateFlow( void ); +U08 getFPGADialysateFlowMeterStatus( void ); +U08 getFPGADialysateFlowFastPacketReadCounter( void ); +U08 getFPGADialysateFlowSlowPacketReadCounter( void ); +U08 getFPGADialysateFlowStatusPacketReadCounter( void ); +U08 getFPGADialysateFlowErrorCounter( void ); U16 getFPGABloodPumpHallSensorCount( void ); U08 getFPGABloodPumpHallSensorStatus( void ); @@ -62,19 +80,60 @@ U32 getFPGAArterialPressure( void ); U16 getFPGAVenousPressure( void ); +F32 getFPGAVenousPressureTemperature( void ); +U08 getFPGAVenousPressureReadCounter( void ); U16 getFPGABloodPumpOcclusion( void ); U16 getFPGADialInPumpOcclusion( void ); U16 getFPGADialOutPumpOcclusion( void ); +U08 getFPGABloodPumpOcclusionReadCounter( void ); +U08 getFPGADialInPumpOcclusionReadCounter( void ); +U08 getFPGADialOutPumpOcclusionReadCounter( void ); +U08 getFPGABloodPumpOcclusionErrorCounter( void ); +U08 getFPGADialInPumpOcclusionErrorCounter( void ); +U08 getFPGADialOutPumpOcclusionErrorCounter( void ); +void setFPGASyringePumpControlFlags( U08 bitFlags ); +void setFPGASyringePumpADCandDACControlFlags( U08 bitFlags ); +void setFPGASyringePumpDACOutputLevel( U16 counts ); +void setFPGASyringePumpStepToggleTime( U32 microSeconds ); +U08 getFPGASyringePumpStatus( void ); +U08 getFPGASyringePumpADCReadCounter( void ); +U08 getFPGASyringePumpADCandDACStatus( void ); +U08 getFPGASyringePumpEncoderStatus( void ); +U32 getFPGASyringePumpEncoderPosition( void ); +U16 getFPGASyringePumpADCChannel0( void ); +U16 getFPGASyringePumpADCChannel1( void ); +U16 getFPGASyringePumpADCChannel2( void ); +U16 getFPGASyringePumpADCChannel3( void ); + +U16 getFPGATimerCount( void ); + void getFPGAAccelAxes( S16 *x, S16 *y, S16 *z ); void getFPGAAccelMaxes( S16 *xm, S16*ym, S16*zm ); void getFPGAAccelStatus( U16 *cnt, U16 *accelFPGAFaultReg ); void getFPGAAirTrapLevels( BOOL *airAtLower, BOOL *airAtUpper ); +void setFPGASensorTest( U08 sensorTest ); + +OPN_CLS_STATE_T getFPGADoorState( void ); + void setFPGAValvesControlMode( U16 bits ); U16 getFPGAValvesStatus( void ); +BOOL noFPGAFluidLeakDetected( void ); + +BOOL noFPGABloodLeakDetected( void ); +BOOL FPGABloodLeakZeroDetected( void ); +void setFPGABloodLeakZero( void ); +void clearFPGABloodLeakZero( void ); +void setFPGABloodLeakSelfTest( void ); +void clearFPGABloodLeakSelfTest( void ); + +BOOL noFPGABubbleDetected( U32 bubble ); +void setFPGABubbleSelfTest( U32 bubble ); +void clearFPGABubbleSelfTest( U32 bubble ); + void setFPGAValveDialyzerInletPosition( S16 setPoint ); S16 getFPGAValveDialyzerInletPosition( void ); U16 getFPGAValveDialyzerInletCurrentCounts( void ); @@ -91,6 +150,9 @@ S16 getFPGAValveBloodArterialPosition( void ); U16 getFPGAValveBloodArterialCurrentCounts( void ); +U16 getFPGAFrontDoorStatus( void ); +U16 getFPGAPumpTrackSwitchStatus( void ); + // The PWM functions are only used during debugging #ifdef DEBUG_ENABLED void setFPGAValveDialyzerInletPWM( U16 count );