Index: firmware/App/Services/FPGA.h =================================================================== diff -u -reb877ae36c28eb83553ee11ccccf42e2c4a5b4d2 -rad3acf79a6b0fa54234cc3b70b26600790d61500 --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision eb877ae36c28eb83553ee11ccccf42e2c4a5b4d2) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision ad3acf79a6b0fa54234cc3b70b26600790d61500) @@ -1,38 +1,110 @@ -/************************************************************************** - * - * Copyright (c) 2019-2019 Diality Inc. - All Rights Reserved. - * - * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN - * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. - * - * @file FPGA.h - * - * @date 21-Oct-2019 - * @author S. Nash - * - * @brief header file for FPGA Interface service. - * - **************************************************************************/ +/************************************************************************** +* +* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* +* THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +* WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +* +* @file FPGA.h +* +* @author (last) Sean Nash +* @date (last) 14-Oct-2020 +* +* @author (original) Dara Navaei +* @date (original) 05-Nov-2019 +* +***************************************************************************/ + +#ifndef __FPGA_H__ +#define __FPGA_H__ + +#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. + * + * @addtogroup FPGA + * @{ + */ + +// ********** public definitions ********** + +// ********** public function prototypes ********** + +void initFPGA( void ); +void execFPGAIn( void ); +void execFPGAOut( void ); +SELF_TEST_STATUS_T execFPGATest( void ); + +void signalFPGAReceiptCompleted( void ); +void signalFPGATransmitCompleted( void ); + +void getFPGAVersions( U08 *Id, U08 *Maj, U08 *Min, U08 *Lab ); + +void setAlarmAudioState( ALARM_PRIORITY_T state, U32 volumeLevel ); + +F32 getFPGABloodFlowSignalStrength( void ); +F32 getFPGADialysateFlowSignalStrength( void ); + +F32 getFPGABloodFlow( void ); +F32 getFPGADialysateFlow( void ); + +U16 getFPGABloodPumpHallSensorCount( void ); +U08 getFPGABloodPumpHallSensorStatus( void ); +U16 getFPGADialInPumpHallSensorCount( void ); +U08 getFPGADialInPumpHallSensorStatus( void ); +U16 getFPGADialOutPumpHallSensorCount( void ); +U08 getFPGADialOutPumpHallSensorStatus( void ); + +U32 getFPGAArterialPressure( void ); +U16 getFPGAVenousPressure( void ); +U16 getFPGABloodPumpOcclusion( void ); +U16 getFPGADialInPumpOcclusion( void ); +U16 getFPGADialOutPumpOcclusion( 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 setFPGAValvesControlMode( U16 bits ); +U16 getFPGAValvesStatus( void ); + +BOOL getFPGAFluidLeakState( void ); + +void setFPGAValveDialyzerInletPosition( S16 setPoint ); +S16 getFPGAValveDialyzerInletPosition( void ); +U16 getFPGAValveDialyzerInletCurrentCounts( void ); + +void setFPGAValveDialyzerOutletPosition( S16 setPoint ); +S16 getFPGAValveDialyzerOutletPosition( void ); +U16 getFPGAValveDialyzerOutletCurrentCounts( void ); + +void setFPGAValveBloodVenousPosition( S16 setPoint ); +S16 getFPGAValveBloodVenousPosition( void ); +U16 getFPGAValveBloodVenousCurrentCounts( void ); + +void setFPGAValveBloodArterialPosition( S16 setPoint ); +S16 getFPGAValveBloodArterialPosition( void ); +U16 getFPGAValveBloodArterialCurrentCounts( void ); + +// The PWM functions are only used during debugging +#ifdef DEBUG_ENABLED + void setFPGAValveDialyzerInletPWM( U16 count ); + U16 getFPGAValveDialyzerInletPWM( void ); + void setFPGAValveDialyzerOutletPWM( U16 count ); + U16 getFPGAValveDialyzerOutletPWM( void ); + void setFPGAValveBloodVenousPWM( U16 count ); + U16 getFPGAValveBloodVenousPWM( void ); + void setFPGAValveBloodArterialPWM( U16 count ); + U16 getFPGAValveBloodArterialPWM( void ); +#endif + +/**@}*/ -#ifndef __FPGA_H__ -#define __FPGA_H__ - -#include "Common.h" -#include "Interrupts.h" - -// ********** public definitions ********** - -// ********** public function prototypes ********** - -void initFPGA( void ); -void execFPGAIn( void ); -void execFPGAOut( void ); -SELF_TEST_STATUS_T execFPGATest( void ); - -void signalFPGAReceiptCompleted( void ); -void signalFPGATransmitCompleted( void ); - -U16 getFPGAStatus( void ); -void setFPGAControl( U16 ctrl ); - #endif