Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -re76c83e425e2cc692f65eb7a5cabc2163c8dfa2f -re39cba3641902ed9c670f1ca7499f0b25b59bef1 --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision e76c83e425e2cc692f65eb7a5cabc2163c8dfa2f) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision e39cba3641902ed9c670f1ca7499f0b25b59bef1) @@ -25,6 +25,7 @@ #include "Comm.h" #include "Compatible.h" #include "FPGA.h" +#include "FpgaDD.h" #include "Messaging.h" #include "OperationModes.h" #include "PersistentAlarm.h" @@ -133,6 +134,9 @@ #define FPGA_D42_BLOOD_LEAK_STATUS_MASK 0x04 ///< Bit mask for blood leak detector. #define FPGA_D42_BLOOD_LEAK_ST_BIT_INDEX 2 ///< Bit index for the blood leak self test status bit. +#define GPIO_AC_SWITCH_MASK 0x10U ///< AC switch status bit mask. +#define FPGA_GPIO_LEAK_SENSOR_MASK 0x02U ///< GPIO_Status Bit 1 per HDD. + #define MAX_PUMP_SPEED 3000.0F ///< Maxon controller pump maximum speed #define PUMP_SPEED_OFFSET 168.7F ///< Speed Scale adjustment intercept factor #define PUMP_SPEED_FULL_SCALE 3187.0F ///< Speed scale adjustment slope factor @@ -147,7 +151,7 @@ U08 fpgaRevLab; ///< Reg 3. FPGA revision (lab) being reported } FPGA_HEADER_T; // read only on FPGA -#if 1 // TODO: Remove when Beta 1.9 is obsolete +// TODO: Remove when Beta 1.9 is obsolete /// FPGA sensor readings struct. typedef struct { @@ -286,9 +290,7 @@ U16 fpgaD74CondTemp; ///< Reg 756. D74 Temperature U08 fpgaD74CondReadCnt; ///< Reg 758. D74 successful read count U08 fpgaD74CondErrorCnt; ///< Reg 759. D74 error read count - } DD_FPGA_SENSORS_BETA_1_9_T; -#endif typedef struct { @@ -453,7 +455,7 @@ U08 fpgaP18CalMemCounter; ///< Reg 820. TBD } DD_FPGA_SENSORS_T; -// Remove when Beta 1.9 is obsolete +// TODO: Remove when Beta 1.9 is obsolete typedef struct { U16 fpgaValveControl; ///< Reg 04. Valve control register @@ -3078,7 +3080,8 @@ *************************************************************************/ U16 getFPGAD63LevelSensor( void ) { - U08 result; + U16 result; + #if 1 // Remove when Beta 1.9 is obsolete if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) == TRUE ) { @@ -3105,7 +3108,8 @@ *************************************************************************/ U16 getFPGAD98LevelSensor( void ) { - U08 result; + U16 result; + #if 1 // Remove when Beta 1.9 is obsolete if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) == TRUE ) { @@ -3132,7 +3136,8 @@ *************************************************************************/ U16 getFPGAD46LevelSensor( void ) { - U08 result; + U16 result; + #if 1 // Remove when Beta 1.9 is obsolete if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) == TRUE ) { @@ -3369,6 +3374,52 @@ /*********************************************************************//** * @brief + * The getGPIOStatusFromFPGA function returns the latest GPIO status register + * value reported by the DD FPGA. + * @details \b Inputs: fpgaSensorReadings.fpgaGPIOStatus (via FpgaDD service) + * @details \b Outputs: none + * @return GPIO status register value (bit-mapped per HDD definition) + *************************************************************************/ +U08 getGPIOStatusFromFPGA( void ) +{ + return getFPGAGPIOStatus(); +} + +/*********************************************************************//** + * @brief + * The getACSwitchStatus function returns the AC switch (concentrate cap + * switch) status from the FPGA GPIO register. + * @details \b Inputs: fpgaSensorReadings.fpgaGPIOStatus (via getGPIOStatusFromFPGA) + * @details \b Outputs: none + * @return TRUE if AC switch is asserted, FALSE otherwise + *************************************************************************/ +BOOL getACSwitchStatus( void ) +{ + U08 gpioStatus = getGPIOStatusFromFPGA(); + BOOL isAsserted = ( ( gpioStatus & GPIO_AC_SWITCH_MASK ) == 0U ) ? TRUE : FALSE; + + return isAsserted; +} + +/*********************************************************************//** + * @brief + * The getFPGALeakSensorStatus function returns the leak sensor status from + * the FPGA GPIO_Status register (Bit 1 per HDD). Application should trigger + * an alarm when LEAK_SENSOR_DETECTED is returned. + * @details \b Inputs: fpgaSensorReadings.fpgaGPIOStatus + * @details \b Outputs: none + * @return FPGA_GPIO_LEAK_SENSOR_NOT_DETECTED or FPGA_GPIO_LEAK_SENSOR_DETECTED + *************************************************************************/ +FPGA_GPIO_LEAK_SENSOR_STATUS_T getFPGALeakSensorStatus( void ) +{ + U08 gpioStatus = getFPGAGPIOStatus(); + FPGA_GPIO_LEAK_SENSOR_STATUS_T status = ( ( gpioStatus & FPGA_GPIO_LEAK_SENSOR_MASK ) != 0U ) ? FPGA_GPIO_LEAK_SENSOR_NOT_DETECTED : FPGA_GPIO_LEAK_SENSOR_DETECTED; + + return status; +} + +/*********************************************************************//** + * @brief * The getFPGATempTax1 function gets the Tax1 temperature sensor reading. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none