Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -r01892698468068bb97a80a84c96a6d7c5d6fde9b -r3518e8a088c32e75c0c8960d5e629a7401095feb --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 01892698468068bb97a80a84c96a6d7c5d6fde9b) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 3518e8a088c32e75c0c8960d5e629a7401095feb) @@ -37,14 +37,41 @@ // ********** private definitions ********** -#define FPGA_EXPECTED_ID 0x5A ///< Expected ID for HD FPGA. +#define FPGA_EXPECTED_ID 0x5A ///< Expected ID for HD FPGA. -#define PROCESSOR_FPGA_CLOCK_DIFF_TOLERANCE 1 ///< Tolerance for processor clock speed check against FPGA clock. +#define PROCESSOR_FPGA_CLOCK_DIFF_TOLERANCE 1 ///< Tolerance for processor clock speed check against FPGA clock. -#define MAX_FPGA_COMM_FAILURES_WINDOW_MS ( 1 * SEC_PER_MIN * MS_PER_SECOND ) ///< FPGA comm failures window -#define MAX_FPGA_COMM_FAILURES 3 ///< FPGA maximum comm failures per MAX_FPGA_COMM_FAILURES_WINDOW_MS -#define MIN_POWER_ON_TIME_FOR_COMM_FAILS ( 1 * MS_PER_SECOND ) ///< Allow FPGA comm errors for first second after power-up +#define MAX_FPGA_COMM_FAILURES_WINDOW_MS ( 1 * SEC_PER_MIN * MS_PER_SECOND ) ///< FPGA comm failures window +#define MAX_FPGA_COMM_FAILURES 3 ///< FPGA maximum comm failures per MAX_FPGA_COMM_FAILURES_WINDOW_MS +#define MIN_POWER_ON_TIME_FOR_COMM_FAILS ( 1 * MS_PER_SECOND ) ///< Allow FPGA comm errors for first second after power-up +#define FPGA_FLUID_LEAK_STATE_MASK 0x0040 ///< Bit mask for fluid leak detector. + +#define FPGA_VALVES_MIN_PWM_MODE_COUNT 2500 ///< FPGA valves minimum PWM in PWM mode in counts. + +#define FPGA_INPUT_VOLTAGE_SCALE 3.0F ///< FPGA source and aux voltage. +#define FPGA_PVN_VOLTAGE_SCALE 1.0F ///< FPGA pvn voltage. + +#define FPGA_ALARM_AUDIO_VOLUME_SHIFT 3 ///< Shift alarm audio volume 3 bits to left before writing to register. +#define FPGA_ALARM_AUDIO_DIVIDE_SHIFT 6 ///< Shift alarm audio volume divider 6 bits to left before writing to register. + +#define FPGA_BACKUP_ALARM_AUDIO_CONVERT 0.4F ///< Converts backup (piezo) alarm audio ADC volts to amps. + +#define FRONT_DOOR_SWITCH_MASK 0x0010 ///< Front door switch bit mask. Bit 4 of the GPIO register. +#define PUMP_TRACK_SWITCH_MASK 0x0020 ///< Pump track switch bit mask. Bit 5 of the GPIO register. + +#define FPGA_AIRTRAP_LEVEL_LOW_MASK 0x0008 ///< Bit mask for air trap lower level sensor. +#define FPGA_AIRTRAP_LEVEL_HIGH_MASK 0x0004 ///< Bit mask for air trap upper level sensor. + +#define FPGA_ADA_BUBBLE_STATUS_MASK 0x0001 ///< Bit mask for arterial air bubble detector input status. +#define FPGA_ADV_BUBBLE_STATUS_MASK 0x0002 ///< Bit mask for venous air bubble detector input status. +#define FPGA_ADA_BUBBLE_SELF_TEST_CMD 0x04 ///< Bit for arterial air bubble detector self-test command. +#define FPGA_ADV_BUBBLE_SELF_TEST_CMD 0x08 ///< Bit for venous air bubble detector self-test command. + +#define FPGA_PBO_TEMP_DIVISOR 2047.0F ///< Used in conversion of PBo temperature reading to deg C. +#define FPGA_PBO_TEMP_GAIN 200.0F ///< Used in conversion of PBo temperature reading to deg C. +#define FPGA_PBO_TEMP_OFFSET 50.0F ///< Used in conversion of PBo temperature reading to deg C. + // FPGA Sensors Record #pragma pack(push,1) /// Record structure for FPGA header read. @@ -213,9 +240,9 @@ /*********************************************************************//** * @brief - * The initFpgaTD function initializes the TD FPGA module. - * @details Inputs: none - * @details Outputs: TD FPGA module initialized. + * The initFpgaTD function initializes the TD FPGA unit. + * @details \b Inputs: none + * @details \b Outputs: TD FPGA unit initialized. * @return none *************************************************************************/ void initFpgaTD( void ) @@ -231,10 +258,8 @@ // Set the HD valves fixed PWM mode to 2500, so if it was commanded to be in PWM mode rather than PID control // the valves will not move to 0 position -// fpgaActuatorSetPoints.VDiPWMFixed = FPGA_VALVES_MIN_PWM_MODE_COUNT; -// fpgaActuatorSetPoints.VDoPWMFixed = FPGA_VALVES_MIN_PWM_MODE_COUNT; -// fpgaActuatorSetPoints.VBAPWMFixed = FPGA_VALVES_MIN_PWM_MODE_COUNT; -// fpgaActuatorSetPoints.VBVPWMFixed = FPGA_VALVES_MIN_PWM_MODE_COUNT; + fpgaActuatorSetPoints.VBAPWMFixed = FPGA_VALVES_MIN_PWM_MODE_COUNT; + fpgaActuatorSetPoints.VBVPWMFixed = FPGA_VALVES_MIN_PWM_MODE_COUNT; // initialize FPGA comm failures windowed timer count initTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_COMM_FAILURES, MAX_FPGA_COMM_FAILURES, MAX_FPGA_COMM_FAILURES_WINDOW_MS); @@ -243,9 +268,10 @@ /*********************************************************************//** * @brief * The execFPGATest function executes the FPGA self-test. - * @details Inputs: fpgaHeader - * @details Outputs: none - * @return passed, or failed + * @details \b Alarm: ALARM_ID_TD_FPGA_POST_TEST_FAILED if self-test fails. + * @details \b Inputs: fpgaHeader + * @details \b Outputs: none + * @return passed or failed *************************************************************************/ SELF_TEST_STATUS_T execFPGATest( void ) { @@ -277,9 +303,9 @@ /*********************************************************************//** * @brief * The getFPGATimerCount function gets the latest FPGA timer millisecond count. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last FPGA timer count + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return last FPGA millisecond timer count *************************************************************************/ U16 getFPGATimerCount( void ) { @@ -290,9 +316,11 @@ * @brief * The execFPGAClockSpeedTest function verifies the processor clock speed * against the FPGA clock. - * @details Inputs: fpgaHeader - * @details Outputs: none - * @return passed, or failed + * @details \b Alarm: ALARM_ID_TD_FPGA_CLOCK_SPEED_CHECK_FAILURE if test fails. + * @details \b Inputs: fpgaSensorReadings.fpgaTimerCount_ms, msTimerCount, + * currentFPGATimerCount_ms, currentTimerCount_ms + * @details \b Outputs: currentFPGATimerCount_ms, currentTimerCount_ms + * @return none *************************************************************************/ void execFPGAClockSpeedTest( void ) { @@ -323,8 +351,8 @@ /*********************************************************************//** * @brief * The getFPGAVersions function gets the fpga version numbers. - * @details Inputs: fpgaHeader - * @details Outputs: none + * @details \b Inputs: fpgaHeader + * @details \b Outputs: Given version reference variables are populated. * @return none *************************************************************************/ void getFPGAVersions( U08 *Id, U08 *Maj, U08 *Min, U08 *Lab ) @@ -338,8 +366,8 @@ /*********************************************************************//** * @brief * The getFPGATemperature function gets the fpga internal die temperature. - * @details Inputs: fpgaHeader - * @details Outputs: none + * @details \b Inputs: fpgaHeader + * @details \b Outputs: none * @return current internal FPGA die temperature (in counts) *************************************************************************/ U16 getFPGATemperature( void ) @@ -350,41 +378,41 @@ /*********************************************************************//** * @brief * The getFPGAVcc function gets the fpga input voltage. - * @details Inputs: fpgaHeader - * @details Outputs: none + * @details \b Inputs: fpgaHeader + * @details \b Outputs: none * @return current FPGA input voltage (in volts) *************************************************************************/ F32 getFPGAVcc( void ) { - F32 result = 0.0;//(F32)fpgaSensorReadings.fpgaIntVoltage * FPGA_INPUT_VOLTAGE_SCALE / (F32)BITS_12_FULL_SCALE; + F32 result = (F32)fpgaSensorReadings.fpgaIntVoltage * FPGA_INPUT_VOLTAGE_SCALE / (F32)BITS_12_FULL_SCALE; return result; } /*********************************************************************//** * @brief * The getFPGAVccAux function gets the fpga aux. voltage. - * @details Inputs: fpgaHeader - * @details Outputs: none + * @details \b Inputs: fpgaHeader + * @details \b Outputs: none * @return current FPGA aux. voltage (in volts) *************************************************************************/ F32 getFPGAVccAux( void ) { - F32 result = 0.0;//(F32)fpgaSensorReadings.fpgaAuxVoltage * FPGA_INPUT_VOLTAGE_SCALE / (F32)BITS_12_FULL_SCALE; + F32 result = (F32)fpgaSensorReadings.fpgaAuxVoltage * FPGA_INPUT_VOLTAGE_SCALE / (F32)BITS_12_FULL_SCALE; return result; } /*********************************************************************//** * @brief * The getFPGAVpvn function gets the fpga pvn voltage. - * @details Inputs: fpgaHeader - * @details Outputs: none + * @details \b Inputs: fpgaHeader + * @details \b Outputs: none * @return current FPGA pvn voltage (in volts) *************************************************************************/ F32 getFPGAVpvn( void ) { - F32 result = 0.0;//(F32)fpgaSensorReadings.fpgaVpvn * FPGA_PVN_VOLTAGE_SCALE / (F32)BITS_12_FULL_SCALE; + F32 result = (F32)fpgaSensorReadings.fpgaVpvn * FPGA_PVN_VOLTAGE_SCALE / (F32)BITS_12_FULL_SCALE; return result; } @@ -393,8 +421,10 @@ * @brief * The setAlarmAudioState function sets the fpga audio control to the given * state and volume. - * @details Inputs: none - * @details Outputs: alarm audio state and attenuation set + * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if given state or volume + * level is invalid. + * @details \b Inputs: none + * @details \b Outputs: alarm audio state and attenuation set * @param state the state of alarm audio to command (3..5): * 0 - No alarm tone * 1 - Low priority alarm tone (c e) @@ -416,24 +446,24 @@ *************************************************************************/ void setAlarmAudioState( U32 state, U32 volumeLevel, U32 volumeDivider ) { -// U08 audioCmd = (U08)state; -// -// audioCmd |= ( (U08)volumeLevel << FPGA_ALARM_AUDIO_VOLUME_SHIFT ); -// audioCmd |= ( (U08)volumeDivider << FPGA_ALARM_AUDIO_DIVIDE_SHIFT ); -// -// if ( ( state <= NUM_OF_ALARM_PRIORITIES ) && ( volumeLevel <= MAX_ALARM_VOLUME_ATTENUATION ) ) -// { -// fpgaActuatorSetPoints.alarmControl = audioCmd; -// } -// else -// { -// // S/w fault to indicate issue w/ s/w -// SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_FPGA_INVALID_ALARM_AUDIO_PARAM, (U32)audioCmd ) -// // Set alarm audio to high priority, max volume for safety since s/w seems to be having trouble setting audio correctly -// audioCmd = (U08)ALARM_PRIORITY_HIGH; -// audioCmd |= ( (U08)MIN_ALARM_VOLUME_ATTENUATION << FPGA_ALARM_AUDIO_VOLUME_SHIFT ); -// fpgaActuatorSetPoints.alarmControl = audioCmd; -// } + U08 audioCmd = (U08)state; + + audioCmd |= ( (U08)volumeLevel << FPGA_ALARM_AUDIO_VOLUME_SHIFT ); + audioCmd |= ( (U08)volumeDivider << FPGA_ALARM_AUDIO_DIVIDE_SHIFT ); + + if ( ( state <= NUM_OF_ALARM_PRIORITIES ) && ( volumeLevel <= MAX_ALARM_VOLUME_ATTENUATION ) ) + { + fpgaActuatorSetPoints.alarmControl = audioCmd; + } + else + { + // S/w fault to indicate issue w/ s/w + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_FPGA_INVALID_ALARM_AUDIO_PARAM, (U32)audioCmd ) + // Set alarm audio to high priority, max volume for safety since s/w seems to be having trouble setting audio correctly + audioCmd = (U08)ALARM_PRIORITY_HIGH; + audioCmd |= ( (U08)MIN_ALARM_VOLUME_ATTENUATION << FPGA_ALARM_AUDIO_VOLUME_SHIFT ); + fpgaActuatorSetPoints.alarmControl = audioCmd; + } } /*********************************************************************//** @@ -443,9 +473,9 @@ * counting up, indicates motor is running in forward direction. If counter is * counting down, indicates motor is running in reverse direction. Counter will * wrap at 0/65535. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last blood pump hall sensor count reading. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest blood pump hall sensor count reading. *************************************************************************/ U16 getFPGABloodPumpHallSensorCount( void ) { @@ -459,9 +489,9 @@ * Bit 7 - Derived direction of the blood pump motor (0=Fwd, 1=Rev) * Bit 6 - Unused * Bit 5-0 - Direction error count since power-up (rolls over) - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last blood pump hall sensor status reading. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return latest blood pump hall sensor status reading. *************************************************************************/ U08 getFPGABloodPumpHallSensorStatus( void ) { @@ -470,115 +500,13 @@ /*********************************************************************//** * @brief - * The getFPGADialInPumpHallSensorCount function gets the latest dialysate inlet pump - * hall sensor count. Count is a 16 bit free running counter. If counter is - * counting up, indicates motor is running in forward direction. If counter is - * counting down, indicates motor is running in reverse direction. Counter will - * wrap at 0/65535. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last dialysate inlet pump hall sensor count reading. - *************************************************************************/ -U16 getFPGADialInPumpHallSensorCount( void ) -{ - return fpgaSensorReadings.dialInPumpHallSensorCount; -} - -/*********************************************************************//** - * @brief - * The getFPGADialInPumpHallSensorStatus function gets the latest dialysate inlet pump - * hall sensor status. - * Bit 7 - Derived direction of the dialysate inlet pump motor (0=Fwd, 1=Rev) - * Bit 6 - Unused - * Bit 5-0 - Direction error count since power-up (rolls over) - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last dialysate inlet pump hall sensor status reading. - *************************************************************************/ -U08 getFPGADialInPumpHallSensorStatus( void ) -{ - return fpgaSensorReadings.dialInPumpHallSensorStatus; -} - -/*********************************************************************//** - * @brief - * The getFPGADialOutPumpHallSensorCount function gets the latest dialysate outlet pump - * hall sensor count. Count is a 16-bit free running counter. If counter is - * counting up, indicates motor is running in forward direction. If counter is - * counting down, indicates motor is running in reverse direction. Counter will - * wrap at 0/65535. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last dialysate outlet pump hall sensor count reading. - *************************************************************************/ -U16 getFPGADialOutPumpHallSensorCount( void ) -{ - return fpgaSensorReadings.dialOutPumpHallSensorCount; -} - -/*********************************************************************//** - * @brief - * The getFPGADialOutPumpHallSensorStatus function gets the latest dialysate outlet pump - * hall sensor status. - * Bit 7 - Derived direction of the dialysate outlet pump motor (0=Fwd, 1=Rev) - * Bit 6 - Unused - * Bit 5-0 - Direction error count since power-up (rolls over) - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last dialysate outlet pump hall sensor status reading. - *************************************************************************/ -U08 getFPGADialOutPumpHallSensorStatus( void ) -{ - return fpgaSensorReadings.dialOutPumpSensorStatus; -} - -/*********************************************************************//** - * @brief - * The getFPGABloodPumpOcclusion function gets the latest blood occlusion reading. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last blood occlusion reading - *************************************************************************/ -U16 getFPGABloodPumpOcclusion( void ) -{ - return fpgaSensorReadings.bloodOcclusionData; -} - -/*********************************************************************//** - * @brief - * The getFPGABloodPumpOcclusionReadCounter function gets the latest blood - * pump occlusion read counter. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last blood pump occlusion read counter - *************************************************************************/ -U08 getFPGABloodPumpOcclusionReadCounter( void ) -{ - return fpgaSensorReadings.bloodOcclusionReadCount; -} - -/*********************************************************************//** - * @brief - * The getFPGABloodPumpOcclusionErrorCounter function gets the latest blood - * pump occlusion error counter. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last blood pump occlusion error counter - *************************************************************************/ -U08 getFPGABloodPumpOcclusionErrorCounter( void ) -{ - return fpgaSensorReadings.bloodOcclusionErrorCount; -} - -/*********************************************************************//** - * @brief * The getFPGAArterialPressure function gets the latest arterial pressure reading. * High byte indicates alarm status for ADC channel. - * Low 24-bits are channel reading. Subtract 2^23 from low 24 bits to get + * @note Low 24-bits are channel reading. Subtract 2^23 from low 24 bits to get * signed channel reading. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last arterial pressure reading + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return latest arterial pressure reading *************************************************************************/ U32 getFPGAArterialPressure( void ) { @@ -589,9 +517,9 @@ * @brief * The getFPGAArterialPressureReadCounter function gets the latest arterial * pressure sensor read counter. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last arterial pressure sensor read counter + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return latest arterial pressure sensor read counter *************************************************************************/ U08 getFPGAArterialPressureReadCounter( void ) { @@ -602,9 +530,9 @@ * @brief * The getFPGAArterialPressureErrorCounter function gets the latest arterial * pressure sensor error counter. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last arterial pressure sensor error counter + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return latest arterial pressure sensor error counter *************************************************************************/ U08 getFPGAArterialPressureErrorCounter( void ) { @@ -614,9 +542,9 @@ /*********************************************************************//** * @brief * The getFPGADVTArterialPressure function gets the latest arterial pressure reading. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last arterial pressure reading + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return latest arterial pressure reading *************************************************************************/ U16 getFPGADVTArterialPressure( void ) { @@ -627,9 +555,9 @@ * @brief * The getFPGADVTArterialTemperature function gets the latest arterial pressure * sensor temperature reading. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last arterial pressure sensor temperature reading + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return latest arterial pressure sensor temperature reading *************************************************************************/ U16 getFPGADVTArterialTemperature( void ) { @@ -640,9 +568,9 @@ * @brief * The getFPGADVTArterialPressureReadCounter function gets the latest arterial * pressure sensor read counter. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last arterial pressure sensor read counter + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return latest arterial pressure sensor read counter *************************************************************************/ U08 getFPGADVTArterialPressureReadCounter( void ) { @@ -653,9 +581,9 @@ * @brief * The getFPGATDVTArterialPressureErrorCounter function gets the latest arterial * pressure sensor error counter. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last arterial pressure sensor error counter + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return latest arterial pressure sensor error counter *************************************************************************/ U08 getFPGATDVTArterialPressureErrorCounter( void ) { @@ -668,9 +596,9 @@ * The high 2 bits are status bits: 00=ok, 01=cmd mode, 10=stale data, 11=diag * The low 14 bits are data. Zero is at 1638. Values above are positive, * below are negative. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last venous pressure reading + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return latest venous pressure reading *************************************************************************/ U16 getFPGAVenousPressure( void ) { @@ -681,9 +609,9 @@ * @brief * The getFPGAVenousPressureTemperature function gets the latest venous pressure * sensor temperature reading. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last venous pressure sensor temperature reading + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return latest venous pressure sensor temperature reading *************************************************************************/ U16 getFPGAVenousPressureTemperature( void ) { @@ -694,9 +622,9 @@ * @brief * The getFPGAVenousPressureReadCounter function gets the latest venous pressure * sensor read counter. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last venous pressure sensor read counter + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return latest venous pressure sensor read counter *************************************************************************/ U08 getFPGAVenousPressureReadCounter( void ) { @@ -707,9 +635,9 @@ * @brief * The getFPGAVenousPressureErrorCounter function gets the latest venous pressure * sensor error counter. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last venous pressure sensor error counter + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return latest venous pressure sensor error counter *************************************************************************/ U08 getFPGAVenousPressureErrorCounter( void ) { @@ -720,9 +648,14 @@ * @brief * The setFPGASyringePumpControlFlags function sets the syringe pump control * register per given bit flags. - * @details Inputs: none - * @details Outputs: fpgaActuatorSetPoints - * @param bitFlags control bit settings for syringe pump + * 0x40 - Sleep off + * 0x20 - Not reset + * 0x10 - Disable + * 0x08 - Reverse direction + * 0x01/02 - Microstep setting + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints + * @param bitFlags Desired control bit settings for syringe pump * @return none *************************************************************************/ void setFPGASyringePumpControlFlags( U08 bitFlags ) @@ -734,8 +667,11 @@ * @brief * The setFPGASyringePumpADCandDACControlFlags function sets the syringe pump * ADC/DAC control register per given bit flags. - * @details Inputs: none - * @details Outputs: fpgaActuatorSetPoints + * 0x04 - Write ADC setup + * 0x02 - Read DAC on ADC + * 0x01 - Enable DAC (not ADC) + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints * @param bitFlags ADC/DAC control bit settings for syringe pump * @return none *************************************************************************/ @@ -748,8 +684,8 @@ * @brief * The setFPGASyringePumpDACOutputLevel function sets the syringe pump force * sensor DAC output level register to a given value. - * @details Inputs: none - * @details Outputs: fpgaActuatorSetPoints + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints * @param counts level to set syringe pump force sensor DAC to * @return none *************************************************************************/ @@ -762,8 +698,8 @@ * @brief * The setFPGASyringePumpStepToggleTime function sets the syringe pump stepper * toggle time register to a given period (in uSec). - * @details Inputs: none - * @details Outputs: fpgaActuatorSetPoints + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints * @param microSeconds toggle the stepper motor at this time interval to set pump speed * @return none *************************************************************************/ @@ -776,9 +712,9 @@ * @brief * The getFPGASyringePumpStatus function gets the latest syringe pump status * register reading. Bit 0 indicates a fault. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last syringe pump status reading + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest syringe pump status reading *************************************************************************/ U08 getFPGASyringePumpStatus( void ) { @@ -789,9 +725,9 @@ * @brief * The getFPGASyringePumpADCReadCounter function gets the latest syringe pump * ADC read counter. Counter is 8-bit and rolls over when exceeding 255. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last syringe pump ADC read counter + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest syringe pump ADC read counter *************************************************************************/ U08 getFPGASyringePumpADCReadCounter( void ) { @@ -805,9 +741,9 @@ * Bit 7 = DAC write and read-back done * Bit 6 = I2C error on DAC data transfer * Bit 0..5 = count of I2C errors, rolls over after 63 - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last syringe pump ADC/DAC status reading + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest syringe pump ADC/DAC status reading *************************************************************************/ U08 getFPGASyringePumpADCandDACStatus( void ) { @@ -820,9 +756,9 @@ * encoder status register reading. * Bit 7 = direction (0=fwd, 1=rev) * Bit 0..5 = direction error count (# of errors after power up, rolls over after 63) - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last syringe pump encoder status reading + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest syringe pump encoder status reading *************************************************************************/ U08 getFPGASyringePumpEncoderStatus( void ) { @@ -833,9 +769,9 @@ * @brief * The getFPGASyringePumpEncoderPosition function gets the latest syringe pump * encoder position reading. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last syringe pump encoder position reading + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest syringe pump encoder position reading *************************************************************************/ U32 getFPGASyringePumpEncoderPosition( void ) { @@ -846,9 +782,9 @@ * @brief * The getFPGASyringePumpADCChannel0 function gets the latest syringe pump ADC * channel 0 register reading (syringe pump force sensor). - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last syringe pump ADC channel 0 reading + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest syringe pump ADC channel 0 reading *************************************************************************/ U16 getFPGASyringePumpADCChannel0( void ) { @@ -859,9 +795,9 @@ * @brief * The getFPGASyringePumpADCChannel1 function gets the latest syringe pump ADC * channel 1 register reading (syringe detection switch). - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last syringe pump ADC channel 1 reading + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest syringe pump ADC channel 1 reading *************************************************************************/ U16 getFPGASyringePumpADCChannel1( void ) { @@ -872,9 +808,9 @@ * @brief * The getFPGASyringePumpADCChannel2 function gets the latest syringe pump ADC * channel 2 register reading (syringe pump home position sensor). - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last syringe pump ADC channel 2 reading + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest syringe pump ADC channel 2 reading *************************************************************************/ U16 getFPGASyringePumpADCChannel2( void ) { @@ -885,9 +821,9 @@ * @brief * The getFPGASyringePumpADCChannel3 function gets the latest syringe pump ADC * channel 3 register reading. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last syringe pump ADC channel 3 reading + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest syringe pump ADC channel 3 reading *************************************************************************/ U16 getFPGASyringePumpADCChannel3( void ) { @@ -903,9 +839,9 @@ * Bit 2: POR * Bit 3: Ready (not busy) * Bits 4..7: N/A - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last syringe pump DAC status reading + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest syringe pump DAC status reading *************************************************************************/ U08 getFPGASyringePumpDACStatus( void ) { @@ -916,9 +852,9 @@ * @brief * The getFPGASyringePumpDACSetting function gets the latest syringe pump * DAC setting. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last syringe pump DAC setting + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest syringe pump DAC setting *************************************************************************/ U16 getFPGASyringePumpDACSetting( void ) { @@ -929,9 +865,9 @@ * @brief * The getFPGASyringePumpDACStoredSetting function gets the latest syringe * pump DAC setting stored in sensor's EEPROM. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return last syringe pump DAC setting stored in EEPROM + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest syringe pump DAC setting stored in EEPROM *************************************************************************/ U16 getFPGASyringePumpDACStoredSetting( void ) { @@ -940,69 +876,16 @@ /*********************************************************************//** * @brief - * The getFPGAAccelAxes function gets the accelerometer axis readings. - * Axis readings are in ADC counts. 0.004 g per LSB. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @param x Populate this param with X axis reading - * @param y Populate this param with Y axis reading - * @param z Populate this param with Z axis reading - * @return none - *************************************************************************/ -void getFPGAAccelAxes( S16 *x, S16 *y, S16 *z ) -{ - *x = (S16)fpgaSensorReadings.accelX; - *y = (S16)fpgaSensorReadings.accelY; - *z = (S16)fpgaSensorReadings.accelZ; -} - -/*********************************************************************//** - * @brief - * The getFPGAAccelMaxes function gets the maximum accelerometer axis readings. - * from last FPGA read (every 10ms). - * Axis readings are in ADC counts. 0.004 g per LSB. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @param x Populate this param with maximum X axis reading - * @param y Populate this param with maximum Y axis reading - * @param z Populate this param with maximum Z axis reading - * @return none - *************************************************************************/ -void getFPGAAccelMaxes( S16 *xmax, S16*ymax, S16*zmax ) -{ - *xmax = (S16)fpgaSensorReadings.accelXMax; - *ymax = (S16)fpgaSensorReadings.accelYMax; - *zmax = (S16)fpgaSensorReadings.accelZMax; -} - -/*********************************************************************//** - * @brief - * The getFPGAAccelStatus function gets the accelerometer reading count - * and error register values. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @param cnt Populate this param with latest sample counter value - * @param err Populate this param with latest error - * @return none - *************************************************************************/ -void getFPGAAccelStatus( U16 *cnt, U16 *err ) -{ - *cnt = fpgaSensorReadings.accelSampleCounter; - *err = fpgaSensorReadings.accelFaultRegister; -} - -/*********************************************************************//** - * @brief * The getFPGABackupAlarmAudioCurrent function gets the latest piezo alarm * audio current reading. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none * @return Latest piezo alarm audio current reading *************************************************************************/ F32 getFPGABackupAlarmAudioCurrent( void ) { -// U16 adcCnts = fpgaSensorReadings.backupAlarmAudioPeakCurrent; - F32 result = 0.0;//( ( (F32)adcCnts / (F32)BITS_12_FULL_SCALE ) * FPGA_BACKUP_ALARM_AUDIO_CONVERT ) * (F32)MA_PER_AMP; + U16 adcCnts = fpgaSensorReadings.backupAlarmAudioPeakCurrent; + F32 result = ( ( (F32)adcCnts / (F32)BITS_12_FULL_SCALE ) * FPGA_BACKUP_ALARM_AUDIO_CONVERT ) * (F32)MA_PER_AMP; return result; } @@ -1011,15 +894,15 @@ * @brief * The getFPGAAirTrapLevels function gets the latest air trap level sensor * readings. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none * @return none *************************************************************************/ void getFPGAAirTrapLevels( BOOL *airAtLower, BOOL *airAtUpper ) { -// U16 fpgaGPIO = fpgaSensorReadings.fpgaGPIO; - U16 lower = 0;//fpgaGPIO & FPGA_AIRTRAP_LEVEL_LOW_MASK; - U16 upper = 0;//fpgaGPIO & FPGA_AIRTRAP_LEVEL_HIGH_MASK; + U16 fpgaGPIO = fpgaSensorReadings.fpgaGPIO; + U16 lower = fpgaGPIO & FPGA_AIRTRAP_LEVEL_LOW_MASK; + U16 upper = fpgaGPIO & FPGA_AIRTRAP_LEVEL_HIGH_MASK; *airAtLower = ( 0 == lower ? FALSE : TRUE ); *airAtUpper = ( 0 == upper ? FALSE : TRUE ); @@ -1028,8 +911,8 @@ /*********************************************************************//** * @brief * The setFPGAValvesControlMode function sets the valves control mode. - * @details Inputs: fpgaActuatorSetPoints - * @details Outputs: fpgaActuatorSetPoints + * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Outputs: fpgaActuatorSetPoints * @param bits : The bits to enable the PID controller of a valve * @return none *************************************************************************/ @@ -1040,10 +923,10 @@ /*********************************************************************//** * @brief - * The getValvesStatus function reads the status of the valves - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return The status of the valves + * The getValvesStatus function reads the status of the valves. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest status of the valves *************************************************************************/ U16 getFPGAValvesStatus( void ) { @@ -1054,313 +937,67 @@ * @brief * The noFPGAFluidLeakDetected function returns TRUE if no fluid leak has been * detected (dry) and FALSE if a fluid leak has been detected (wet). - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return noFPGAFluidLeakDetected + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest fluid leak detected status *************************************************************************/ BOOL noFPGAFluidLeakDetected( void ) { - U16 noFPGAFluidLeakDetected = 0;//fpgaSensorReadings.fpgaGPIO & FPGA_FLUID_LEAK_STATE_MASK; + U16 noFPGAFluidLeakDetected = fpgaSensorReadings.fpgaGPIO & FPGA_FLUID_LEAK_STATE_MASK; return ( 0 == noFPGAFluidLeakDetected ? FALSE : TRUE ); } /*********************************************************************//** * @brief - * The getFPGABloodLeakStatus function returns the blood leak sensor's - * blood detection status bit. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return blood leak sensor self test status bit + * The noFPGAVenousBubbleDetected function returns TRUE if no air bubble has + * been detected and FALSE if an air bubble has been detected. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Latest bubble detected status *************************************************************************/ -U08 getFPGABloodLeakStatus( void ) +BOOL noFPGAVenousBubbleDetected( void ) { - U08 selfTestStatus = 0;//(U08)( ( fpgaSensorReadings.fpgaGPIO & FPGA_BLOOD_LEAK_STATUS_MASK ) >> FPGA_BLOOD_LEAK_ST_BIT_INDEX ); - - return selfTestStatus; -} - -/*********************************************************************//** - * @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 getFPGABloodLeakTxFIFOCount function returns the blood leak transmit - * FIFO count. - * @details Inputs: none - * @details Outputs: none - * @return fpgaSensorReadings.bloodLeakTxFIFOCount - *************************************************************************/ -U08 getFPGABloodLeakTxFIFOCount( void ) -{ - return fpgaSensorReadings.bloodLeakTxFIFOCount; -} - -/*********************************************************************//** - * @brief - * The getFPGABloodLeakRxFIFOCount function returns the blood leak receive - * FIFO count. - * @details Inputs: none - * @details Outputs: none - * @return fpgaSensorReadings.bloodLeakRxFIFOCount - *************************************************************************/ -U16 getFPGABloodLeakRxFIFOCount( void ) -{ - return fpgaSensorReadings.bloodLeakRxFIFOCount; -} - -/*********************************************************************//** - * @brief - * The getFPGABloodLeakRxErrorCount function returns the blood leak receive - * error count. - * @details Inputs: none - * @details Outputs: none - * @return fpgaSensorReadings.bloodLeakRxErrorCount - *************************************************************************/ -U08 getFPGABloodLeakRxErrorCount( void ) -{ - return fpgaSensorReadings.bloodLeakRxErrorCount; -} - -/*********************************************************************//** - * @brief - * The getFPGABloodLeakRxFIFODataOut function returns the blood leak receive - * FIFO data out. - * @details Inputs: none - * @details Outputs: none - * @return fpgaSensorReadings.bloodLeakRxFIFODataOut - *************************************************************************/ -U08 getFPGABloodLeakRxFIFODataOut( void ) -{ - return fpgaSensorReadings.bloodLeakRxFIFODataOut; -} - -/*********************************************************************//** - * @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 - * @details Outputs: none - * @return noFPGABubbleDetected - *************************************************************************/ -BOOL noFPGABubbleDetected( U32 bubble ) -{ U16 noFPGABubbleDetected = 0; -// if ( bubble == ADV ) -// { -// noFPGABubbleDetected = fpgaSensorReadings.fpgaGPIO & FPGA_ADV_BUBBLE_STATUS_MASK; -// } -// else -// { -// SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_HD_INVALID_BUBBLE_ID, bubble ) -// } + noFPGABubbleDetected = fpgaSensorReadings.fpgaGPIO & FPGA_ADV_BUBBLE_STATUS_MASK; return ( 0 != noFPGABubbleDetected ? TRUE : FALSE ); } /*********************************************************************//** * @brief - * The setFPGABubbleSelfTest function sets the given air bubble detector into + * The setFPGAVenousBubbleSelfTest function sets the given air bubble detector into * self-test mode via the FPGA. - * @details Inputs: none - * @details Outputs: fpgaActuatorSetPoints + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints * @return: none *************************************************************************/ -void setFPGABubbleSelfTest( U32 bubble ) +void setFPGAVenousBubbleSelfTest( void ) { -// if ( bubble == ADV ) -// { -// fpgaActuatorSetPoints.fpgaSensorTest |= FPGA_ADV_BUBBLE_SELF_TEST_CMD; -// } + fpgaActuatorSetPoints.fpgaSensorTest |= FPGA_ADV_BUBBLE_SELF_TEST_CMD; } /*********************************************************************//** * @brief - * The clearFPGABubbleSelfTest function clears the given air bubble detector + * The clearFPGAVenousBubbleSelfTest function clears the given air bubble detector * from self-test mode via the FPGA. - * @details Inputs: none - * @details Outputs: fpgaActuatorSetPoints + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints * @return: none *************************************************************************/ -void clearFPGABubbleSelfTest( U32 bubble ) +void clearFPGAVenousBubbleSelfTest( void ) { -// if ( bubble == ADV ) -// { -// fpgaActuatorSetPoints.fpgaSensorTest &= ~FPGA_ADV_BUBBLE_SELF_TEST_CMD; -// } -// else -// { -// SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_HD_INVALID_BUBBLE_ID, bubble ) -// } + fpgaActuatorSetPoints.fpgaSensorTest &= ~FPGA_ADV_BUBBLE_SELF_TEST_CMD; } /*********************************************************************//** * @brief - * The setValveDialyzerInletPosition function sets the position of VDi - * in counts - * @details Inputs: fpgaActuatorSetPoints - * @details Outputs: fpgaActuatorSetPoints - * @param setPoint : Next position of the valve in counts - * @return none - *************************************************************************/ -void setFPGAValveDialyzerInletPosition( S16 setPoint ) -{ - fpgaActuatorSetPoints.VDiSetPoint = setPoint; -} - -/*********************************************************************//** - * @brief - * The getValveDialyzerInletPosition function reads the current position - * of VDi in counts - * @details Inputs: none - * @details Outputs: fpgaSensorReadings - * @return The current position of VDi - *************************************************************************/ -S16 getFPGAValveDialyzerInletPosition( void ) -{ - return fpgaSensorReadings.VDiPosition; -} - -/*********************************************************************//** - * @brief - * The getFPGAValveDialyzerInletCurrentCounts function reads the current \n - * of VDi in counts - * @details Inputs: none - * @details Outputs: fpgaSensorReadings - * @return The current of VDi - *************************************************************************/ -U16 getFPGAValveDialyzerInletCurrentCounts( void ) -{ - return fpgaSensorReadings.VDiCurrent; -} - -#ifdef DEBUG_ENABLED -/*********************************************************************//** - * @brief - * The setFPGAValveDialyzerInletPWM function sets the PWM of VDI in counts. - * @details Inputs: fpgaActuatorSetPoints - * @details Outputs: fpgaActuatorSetPoints - * @param count which is the PWM of VDI in counts - * @return none - *************************************************************************/ -void setFPGAValveDialyzerInletPWM( U16 count ) -{ - fpgaActuatorSetPoints.VDiPWMFixed = count; -} - -/*********************************************************************//** - * @brief - * The getFPGAValveDialyzerInletPWM function reads the current PWM target - * of VDI. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return current PWM of VDI - *************************************************************************/ -U16 getFPGAValveDialyzerInletPWM( void ) -{ - return fpgaSensorReadings.VDiPWMTarget; -} -#endif - -/*********************************************************************//** - * @brief - * The setFPGAValveDialyzerOutletPosition function sets the position of VDo - * in counts - * @details Inputs: fpgaActuatorSetPoints - * @details Outputs: fpgaActuatorSetPoints - * @param setPoint : Next position of the valve in counts - * @return none - *************************************************************************/ -void setFPGAValveDialyzerOutletPosition( S16 setPoint ) -{ - fpgaActuatorSetPoints.VDoSetPoint = setPoint; -} - -/*********************************************************************//** - * @brief - * The getFPGAValveDialyzerOutletPosition function reads the current position - * of VDo in counts - * @details Inputs: none - * @details Outputs: fpgaSensorReadings - * @return The current position of VDo - *************************************************************************/ -S16 getFPGAValveDialyzerOutletPosition( void ) -{ - return fpgaSensorReadings.VDoPosition; -} - -/*********************************************************************//** - * @brief - * The getFPGAValveDialyzerOutletCurrentCounts function reads the current - * of VDo in counts - * @details Inputs: none - * @details Outputs: fpgaSensorReadings - * @return The current of VDo - *************************************************************************/ -U16 getFPGAValveDialyzerOutletCurrentCounts( void ) -{ - return fpgaSensorReadings.VDoCurrent; -} - -#ifdef DEBUG_ENABLED -/*********************************************************************//** - * @brief - * The setFPGAValveDialyzerOutletPWM function sets the PWM of VDO in counts. - * @details Inputs: fpgaActuatorSetPoints - * @details Outputs: fpgaActuatorSetPoints - * @param count which is the PWM of VDO in counts - * @return none - *************************************************************************/ -void setFPGAValveDialyzerOutletPWM( U16 count ) -{ - fpgaActuatorSetPoints.VDoPWMFixed = count; -} - -/*********************************************************************//** - * @brief - * The getFPGAValveDialyzerOutletPWM function reads the current PWM target - * of VDO. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return current PWM of VDO - *************************************************************************/ -U16 getFPGAValveDialyzerOutletPWM( void ) -{ - return fpgaSensorReadings.VDoPWMTarget; -} -#endif - -/*********************************************************************//** - * @brief * The setValveBloodVenousPosition function sets the position of VBV * in counts - * @details Inputs: fpgaActuatorSetPoints - * @details Outputs: fpgaActuatorSetPoints - * @param setPoint : Next position of the valve in counts + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints + * @param setPoint The next encoder position of the valve in counts * @return none *************************************************************************/ void setFPGAValveBloodVenousPosition( S16 setPoint ) @@ -1370,11 +1007,11 @@ /*********************************************************************//** * @brief - * The getValveBloodVenousPosition function reads the current position + * The getValveBloodVenousPosition function returns the current position * of VBV in counts - * @details Inputs: none - * @details Outputs: fpgaSensorReadings - * @return The current position of VBV + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return The current encoder position of VBV *************************************************************************/ S16 getFPGAValveBloodVenousPosition( void ) { @@ -1383,11 +1020,11 @@ /*********************************************************************//** * @brief - * The getFPGAValveBloodVenousCurrentCounts function reads the current + * The getFPGAValveBloodVenousCurrentCounts function returns the current * of VBV in counts - * @details Inputs: none - * @details Outputs: fpgaSensorReadings - * @return The current of VBV + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return The latest current of VBV *************************************************************************/ U16 getFPGAValveBloodVenousCurrentCounts( void ) { @@ -1398,9 +1035,9 @@ /*********************************************************************//** * @brief * The setFPGAValveBloodVenousPWM function sets the PWM of VBV in counts. - * @details Inputs: fpgaActuatorSetPoints - * @details Outputs: fpgaActuatorSetPoints - * @param count which is the PWM of VBV in counts + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints + * @param count PWM counts to set for VBV * @return none *************************************************************************/ void setFPGAValveBloodVenousPWM( U16 count ) @@ -1411,9 +1048,9 @@ /*********************************************************************//** * @brief * The getFPGAValveBloodVenousPWM function returns the PWM of VBV in counts. - * @details Inputs: fpgaActuatorSetPoints - * @details Outputs: none - * @return returns the PWM of VBV in counts + * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Outputs: none + * @return The PWM counts for VBV *************************************************************************/ U16 getFPGAValveBloodVenousPWM( void ) { @@ -1425,9 +1062,9 @@ * @brief * The setValveBloodArterialPosition function sets the position of VBA * in counts - * @details Inputs: fpgaActuatorSetPoints - * @details Outputs: fpgaActuatorSetPoints - * @param setPoint : Next position of the valve in counts + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints + * @param setPoint The next position of the valve in counts * @return none *************************************************************************/ void setFPGAValveBloodArterialPosition( S16 setPoint ) @@ -1439,9 +1076,9 @@ * @brief * The getValveBloodArterialPosition function reads the current position * of VBA in counts - * @details Inputs: none - * @details Outputs: fpgaSensorReadings - * @return The current position of VBA + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return The latest encoder position of VBA *************************************************************************/ S16 getFPGAValveBloodArterialPosition( void ) { @@ -1452,9 +1089,9 @@ * @brief * The getFPGAValveBloodArterialCurrentCounts function reads the current * of VBA in counts - * @details Inputs: none - * @details Outputs: fpgaSensorReadings - * @return The current of VBA + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return The latest current of VBA *************************************************************************/ U16 getFPGAValveBloodArterialCurrentCounts( void ) { @@ -1464,9 +1101,9 @@ /*********************************************************************//** * @brief * The getFPGABoardTemperature function reads the FPGA board temperature. - * @details Inputs: none - * @details Outputs: fpgaSensorReadings - * @return Current FPGA board temperature + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return The latest FPGA board temperature in ADC counts *************************************************************************/ U16 getFPGABoardTemperature( void ) { @@ -1475,22 +1112,22 @@ /*********************************************************************//** * The getFPGAFrontDoorStatus function returns the FPGA front door status - * bit. - * @details Inputs: none - * @details Outputs: fpgaSensorReadings - * @return front door FPGA status bit + * bit (0x10). + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return front door FPGA status bit (0x10 = Open, 0x00 = Closed) *************************************************************************/ U16 getFPGAFrontDoorStatus( void ) { - return 0;//( fpgaSensorReadings.fpgaGPIO & FRONT_DOOR_SWITCH_MASK ); + return ( fpgaSensorReadings.fpgaGPIO & FRONT_DOOR_SWITCH_MASK ); } /*********************************************************************//** * @brief - * The getFPGAPBAADCTemperature function reads the PBA ADC temperature. - * @details Inputs: none - * @details Outputs: fpgaSensorReadings - * @return PBA ADC temperature + * The getFPGAPBAADCTemperature function returns the PBA ADC temperature. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return The latest PBA temperature in ADC counts *************************************************************************/ U32 getFPGAPBAADCTemperature( void ) { @@ -1499,35 +1136,24 @@ /*********************************************************************//** * @brief - * The getFPGAInletFan1TogglePeriod function reads the inlet fan 1 pulse time. - * @details Inputs: none - * @details Outputs: fpgaSensorReadings - * @return Inlet fan 1 pulse time + * The getFPGAInletFan1TogglePeriod function returns the inlet fan 1 pulse time. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return The latest inlet fan 1 pulse time (in 2.5 uSec) *************************************************************************/ U16 getFPGAInletFan1TogglePeriod( void ) { return fpgaSensorReadings.fan1PulseTime; } /*********************************************************************//** - * The getFPGAPumpTrackSwitchStatus function returns the FPGA pump track - * switch status bit. - * @details Inputs: none - * @details Outputs: fpgaSensorReadings - * @return pump track switch FPGA status bit - *************************************************************************/ -U16 getFPGAPumpTrackSwitchStatus( void ) -{ - return 0;//( fpgaSensorReadings.fpgaGPIO & PUMP_TRACK_SWITCH_MASK ); -} - -/*********************************************************************//** * @brief * The checkFPGACommFailure function increments the FPGA comm failure * windowed timer and returns whether or not the number of failures in * the window have been reached. - * @details Inputs: ms counter - * @details Outputs: none + * @details \b Alarm: ALARM_ID_TD_FPGA_COMM_TIMEOUT if 3 comm failures in last 1 minute. + * @details \b Inputs: Millisecond counter + * @details \b Outputs: none * @return none *************************************************************************/ void checkFPGACommFailure( void ) @@ -1547,13 +1173,13 @@ * windowed timer if an FE or OE error has occurred and returns whether * or not the number of failures in * the window have been reached. - * @details Inputs: none - * @details Outputs: none - * @return TRUE if windowed count exceeded, else false. + * @details \b Alarm: ALARM_ID_TD_FPGA_COMM_TIMEOUT if 3 comm failures in last 1 minute. + * @details \b Inputs: Millisecond timer + * @details \b Outputs: none + * @return none *************************************************************************/ -BOOL checkFPGAFEOEFailure( void ) +void checkFPGAFEOEFailure( void ) { - BOOL status = false; BOOL FPGAFEOEError = getSci2FEOEError(); if ( TRUE == FPGAFEOEError) @@ -1563,12 +1189,9 @@ if ( TRUE == incTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_COMM_FAILURES ) ) { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_FPGA_COMM_TIMEOUT, MAX_FPGA_COMM_FAILURES, (U32)fpgaSensorReadings.errorCountProcessor ) - status = TRUE; } } } - - return status; } /**@}*/