Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r09e6cf9de34acf18f6e1138bf56ac0edb4821186 -r68aefeff8890cdfa956c7bfdf0d4505b4ac25cb7 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 09e6cf9de34acf18f6e1138bf56ac0edb4821186) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 68aefeff8890cdfa956c7bfdf0d4505b4ac25cb7) @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2022 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. @@ -219,6 +219,21 @@ U16 fpgaVpvn; ///< Reg 414. FPGA pvn voltage. 1V range over 12 bits (0..4095). U16 fpgaTimerCount_ms; ///< Reg 416. Free running 1ms timer counter. Rolls over at 65535.Internal FPGA timer count in ms. U16 backupAlarmAudioPeakCurrent; ///< Reg 418. Piezo alarm peak ADC current in previous 10ms. 12 bit unsigned. + U08 V1EncError; ///< Reg 420. Pinch valve V1 encoder error counter. + U08 V2EncError; ///< Reg 421. Pinch valve V2 encoder error counter. + U08 V3EncError; ///< Reg 422. Pinch valve V3 encoder error counter. + U08 V4EncError; ///< Reg 423. Pinch valve V4 encoder error counter. + U08 ADACounter; ///< Reg 424. ADA bubble counter. + U08 ADVCounter; ///< Reg 425. ADV bubble counter. + U08 ZLeakCounter; ///< Reg 426. Blood leak zero status counter. + U08 BLeakCounter; ///< Reg 427. Blood leak counter. + U08 PBoErrorCount; ///< Reg 428. PBo error count. + U08 bloodLeakZeroedStatus; ///< Reg 429. Blood leak and sensor zeored status. + U16 bloodDetectSetPoint; ///< Reg 430. Blood leak stored set point value. + U16 bloodDetectLevel; ///< Reg 432. Blood leak detection stored level value. + U16 bloodStCount; ///< Reg 434. Blood leak St Count. + U16 bloodLEDIntensity; ///< Reg 436. Blood leak LED intensity. + U16 bloodRdCounter; ///< Reg 438. Blood leak register counter. } FPGA_SENSORS_T; /// Record structure for FPGA continuous priority writes. @@ -241,6 +256,8 @@ U32 syringePumpStepToggleTime; ///< Reg 36. Syringe pump step time toggle register. Sets time between step toggle which dictates stepper motor speed. U16 syringePumpDACOut; ///< Reg 40. Syringe pump DAC output level (12-bit). U08 syringePumpADCandDACControl; ///< Reg 42. Syringe pump ADC and DAC control register. + U08 bloodLeakUARTControl; ///< Reg 43. Blood leak UART control. + U08 bloodLeakFIFOTransmit; ///< Reg 44. Character word store in FIFO to be transmitted into blood leak UART interface. } FPGA_ACTUATORS_T; // TODO clean up the struct @@ -303,8 +320,10 @@ static FPGA_SENSORS_ASYNC_T fpgaSensorReadingsAsync; ///< Record of last received async (as needed) FPGA sensor data. #endif +#ifndef DEBUG_ENABLED static U16 currentFPGATimerCount_ms; ///< Current FPGA timer count in ms. static U32 currentTimerCount_ms; ///< Current processor timer count in ms. +#endif // ********** private function prototypes ********** @@ -939,6 +958,7 @@ *************************************************************************/ void execFPGAClockSpeedTest( void ) { +#ifndef DEBUG_ENABLED U16 const newFPGATimerCount_ms = getFPGATimerCount(); U32 const newTimerCount_ms = getMSTimerCount(); U32 const diffFPGATimerCount = (U32)u16DiffWithWrap( currentFPGATimerCount_ms, newFPGATimerCount_ms ); @@ -954,6 +974,7 @@ currentFPGATimerCount_ms = newFPGATimerCount_ms; currentTimerCount_ms = newTimerCount_ms; +#endif } /*********************************************************************//** @@ -1986,6 +2007,131 @@ /*********************************************************************//** * @brief + * The setFPGABloodLeakUARTControl function sets the blood leak sensor UART + * control value. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return none + *************************************************************************/ +void setFPGABloodLeakUARTControl( U08 value ) +{ + fpgaActuatorSetPoints.bloodLeakUARTControl = value; +} + +/*********************************************************************//** + * @brief + * The setFPGABloodLeakUARTTransmit function sets the blood leak sensor UART + * transmit value. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return none + *************************************************************************/ +void setFPGABloodLeakUARTTransmit( U08 value ) +{ + fpgaActuatorSetPoints.bloodLeakFIFOTransmit = value; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakZeroStatusCounter function returns the blood leak + * zero status counter + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.ZLeakCounter + *************************************************************************/ +U08 getFPGABloodLeakZeroStatusCounter( void ) +{ + return fpgaSensorReadings.ZLeakCounter; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakCounter function returns the blood leak counter. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.BLeakCounter + *************************************************************************/ +U08 getFPGABloodLeakCounter( void ) +{ + return fpgaSensorReadings.BLeakCounter; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakZeroedStatus function returns the blood leak zeroed status. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.bloodLeakZeroedStatus + *************************************************************************/ +U08 getFPGABloodLeakZeroedStatus( void ) +{ + return fpgaSensorReadings.bloodLeakZeroedStatus; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakDetectSetPoint function returns the blood leak detect + * set point. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.bloodDetectSetPoint + *************************************************************************/ +U16 getFPGABloodLeakDetectSetPoint( void ) +{ + return fpgaSensorReadings.bloodDetectSetPoint; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakDetectLevel function returns the blood leak detect level. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.bloodDetectLevel + *************************************************************************/ +U16 getFPGABloodLeakDetectLevel( void ) +{ + return fpgaSensorReadings.bloodDetectLevel; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakStCount function returns the blood leak st count. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.bloodStCount + *************************************************************************/ +U16 getFPGABloodLeakStCount( void ) +{ + return fpgaSensorReadings.bloodStCount; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakLEDIntensity function returns the blood leak LED intensity. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.bloodLEDIntensity + *************************************************************************/ +U16 getFPGABloodLeakLEDIntensity( void ) +{ + return fpgaSensorReadings.bloodLEDIntensity; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakRegisterCounter function returns the blood leak register + * counter. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.bloodRdCounter + *************************************************************************/ +U16 getFPGABloodLeakRegisterCounter( void ) +{ + return fpgaSensorReadings.bloodRdCounter; +} + +/*********************************************************************//** + * @brief * The noFPGABubbleDetected function returns TRUE if no air bubble has been * detected and FALSE if an air bubble has been detected. * @details Inputs: fpgaSensorReadings @@ -1996,12 +2142,8 @@ { U16 noFPGABubbleDetected = 0; - if ( bubble == ADA ) + if ( bubble == ADV ) { - noFPGABubbleDetected = fpgaSensorReadings.fpgaGPIO & FPGA_ADA_BUBBLE_STATUS_MASK; - } - else if ( bubble == ADV ) - { noFPGABubbleDetected = fpgaSensorReadings.fpgaGPIO & FPGA_ADV_BUBBLE_STATUS_MASK; } else @@ -2022,12 +2164,8 @@ *************************************************************************/ void setFPGABubbleSelfTest( U32 bubble ) { - if ( bubble == ADA ) + if ( bubble == ADV ) { - fpgaActuatorSetPoints.fpgaSensorTest |= FPGA_ADA_BUBBLE_SELF_TEST_CMD; - } - else if ( bubble == ADV ) - { fpgaActuatorSetPoints.fpgaSensorTest |= FPGA_ADV_BUBBLE_SELF_TEST_CMD; } } @@ -2042,12 +2180,8 @@ *************************************************************************/ void clearFPGABubbleSelfTest( U32 bubble ) { - if ( bubble == ADA ) + if ( bubble == ADV ) { - fpgaActuatorSetPoints.fpgaSensorTest &= ~FPGA_ADA_BUBBLE_SELF_TEST_CMD; - } - else if ( bubble == ADV ) - { fpgaActuatorSetPoints.fpgaSensorTest &= ~FPGA_ADV_BUBBLE_SELF_TEST_CMD; } else