Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -rd5b87d7dab8613f3963fb66f8833d210f127fa1f -rf49295a21525d5d1b88ec52eb4fcac72e7a526b7 --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision d5b87d7dab8613f3963fb66f8833d210f127fa1f) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision f49295a21525d5d1b88ec52eb4fcac72e7a526b7) @@ -78,10 +78,10 @@ #define CONCENTRATE_CAP_SWITCH_MASK 0x10 ///< Concentrate cap switch bit mask. #define FPGA_CONC_PUMP_FAULT_BITS 0x03 ///< Concentrate pump fault bits mask. -#define FPGA_CPA_PARKED_BIT 0x04 ///< Concentrate pump 1 parked status bit mask. -#define FPGA_CPB_PARKED_BIT 0x10 ///< Concentrate pump 2 parked status bit mask. -#define FPGA_CPA_PARK_FAULT_BIT 0x08 ///< Concentrate pump 1 park fault status bit mask. -#define FPGA_CPB_PARK_FAULT_BIT 0x20 ///< Concentrate pump 2 park fault status bit mask. +#define FPGA_D11_PUMP_PARKED_BIT 0x04 ///< Acid Concentrate pump parked status bit mask. +#define FPGA_D10_PUMP_PARKED_BIT 0x10 ///< Bicarb Concentrate pump parked status bit mask. +#define FPGA_D11_PUMP_PARK_FAULT_BIT 0x08 ///< Acid Concentrate pump park fault status bit mask. +#define FPGA_D10_PUMP_PARK_FAULT_BIT 0x20 ///< Bicarb Concentrate pump park fault status bit mask. #define FPGA_CONC_PUMP_PARK_COMMAND 0x80 ///< Park command bit for the concentrate pumps. #define FPGA_THD_CONTROL_COMMAND 0X01 ///< FPGA THd control command. #define FPGA_POWER_OUT_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< FPGA power out timeout in milliseconds. @@ -201,10 +201,10 @@ U08 fpgaValveBCPWMStates; ///< Reg 363. Balancing Chamber Valve PWM states U08 fpgaValveUFStates; ///< Reg 364. Ultrafiltration Valves states U08 fpgaValveUFPWMStates; ///< Reg 365. Ultrafiltration Valves PWM states - U08 fpgaCPACPBFault; ///< Reg 366. Concentrate pump fault register for CPA and CPB + U08 fpgaD11_D10_PumpFault; ///< Reg 366. Concentrate pump fault register for D11_Pump and D10_Pump U08 fpgaRTDCountErrorCycles; ///< Reg 367. Count of each incomplete seq of reads from RTD ADC. - U16 fpgaCPAHallSense; ///< Reg 368. Concentrate pump CPA hall sensor pulse width - U16 fpgaCPBHallSense; ///< Reg 370. Concentrate pump CPB hall sensor pulse width + U16 fpgaD11_PumpHallSense; ///< Reg 368. Concentrate pump D11_Pump hall sensor pulse width + U16 fpgaD10_PumpHallSense; ///< Reg 370. Concentrate pump D10_Pump hall sensor pulse width U32 fpgaTax1Temp; ///< Reg 372. Inlet heat exchanger temperature U32 fpgaTH2Temp; ///< Reg 376. Inlet heat exchanger temperature @@ -234,8 +234,8 @@ U08 fpgaSDPHallStatus; ///< Reg 425. Spent dialysate pump hall sensor direction status U08 fpgaFloater1Status; ///< Reg 426. Floater 1 level sensor status U08 fpgaFloater2Status; ///< Reg 427. Floater 2 level sensor status - U16 fpgaCPAStepCountStatus; ///< Reg 428. Acid concentrate pump revolution down count status - U16 fpgaCPBStepCountStatus; ///< Reg 430. Bicarb concentrate pump revolution down count status + U16 fpgaD11_PumpStepCountStatus; ///< Reg 428. Acid concentrate pump revolution down count status + U16 fpgaD10_PumpStepCountStatus; ///< Reg 430. Bicarb concentrate pump revolution down count status } DD_FPGA_SENSORS_T; typedef struct @@ -306,10 +306,10 @@ U08 fpgaDGPControl; ///< Reg 114. DGP Control U08 fpgaSDPControl; ///< Reg 115. SDP Control U16 fpgaSDPSpeed; ///< Reg 116. SDP Speed/RPM Control - U16 fpgaCPASpeed; ///< Reg 118. Acid Concentrate Pump Speed/RPM Control - U08 fpgaCPAControl; ///< Reg 120. Acid Concentrate Pump Control - U08 fpgaCPBControl; ///< Reg 121. BiCarb Concentrate Pump Control - U16 fpgaCPBSpeed; ///< Reg 122. BiCarb Concentrate Pump Speed/RPM Control + U16 fpgaD11_PumpSpeed; ///< Reg 118. Acid Concentrate Pump Speed/RPM Control + U08 fpgaD11_PumpControl; ///< Reg 120. Acid Concentrate Pump Control + U08 fpgaD10_PumpControl; ///< Reg 121. BiCarb Concentrate Pump Control + U16 fpgaD10_PumpSpeed; ///< Reg 122. BiCarb Concentrate Pump Speed/RPM Control U08 fpgaBloodLeakSensorTest; ///< Reg 124. Blood leak sensor test U08 fpgaBloodLeakUARTControl; ///< Reg 125. Blood leak sensor UART control @@ -324,8 +324,8 @@ U16 fpgaVUFPWMLow; ///< Reg 136. VUF PWM low ( Ultra filteration valves ) U16 fpgaVUFPWMPeriod; ///< Reg 138. VUF PWM period U16 fpgaVUFPWMPullin; ///< Reg 140. VUF PWM pull in - U16 fpgaCPARevCount; ///< Reg 142. Acid Concentrate pump revolution count - U16 fpgaCPBRevCount; ///< Reg 144. Bicarb Concentrate pump revolution count + U16 fpgaD11_PumpRevCount; ///< Reg 142. Acid Concentrate pump revolution count + U16 fpgaD10_PumpRevCount; ///< Reg 144. Bicarb Concentrate pump revolution count U08 fpgaADCControl; ///< Reg 146. FPGA internal ADC Control register for debugging U08 fpgaGPIOControl; ///< Reg 147. FPGA GPIO control interface } FPGA_ACTUATORS_T; @@ -594,35 +594,35 @@ /*********************************************************************//** * @brief - * The setFPGAAcidPumpSetStepSpeed function sets the step speed period for - * concentrate pump CPA. + * The setFPGAD11PumpSetStepSpeed function sets the step speed period for + * concentrate pump D11_Pump. * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPASpeed + * @details \b Outputs: fpgaActuatorSetPoints.fpgaD11_PumpSpeed * @param stepSpeed The concentrate pump step speed period * @return none *************************************************************************/ -void setFPGAAcidPumpSetStepSpeed( U16 stepSpeed ) +void setFPGAD11PumpSetStepSpeed( U16 stepSpeed ) { - fpgaActuatorSetPoints.fpgaCPASpeed = stepSpeed; + fpgaActuatorSetPoints.fpgaD11_PumpSpeed = stepSpeed; } /*********************************************************************//** * @brief - * The setFPGABicarbSetStepSpeed function sets the step speed period for - * concentrate pump CPB. + * The setFPGAD10PumpSetStepSpeed function sets the step speed period for + * concentrate pump D10_Pump. * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPBSpeed + * @details \b Outputs: fpgaActuatorSetPoints.fpgaD10_PumpSpeed * @param stepSpeed The concentrate pump step speed period * @return none *************************************************************************/ -void setFPGABicarbSetStepSpeed( U16 stepSpeed ) +void setFPGAD10PumpSetStepSpeed( U16 stepSpeed ) { - fpgaActuatorSetPoints.fpgaCPBSpeed = stepSpeed; + fpgaActuatorSetPoints.fpgaD10_PumpSpeed = stepSpeed; } /*********************************************************************//** * @brief - * The setFPGAAcidPumpControl function sets the DVT concentrate pump 1 + * The setFPGAD11PumpControl function sets the DVT concentrate pump 1 * (acid pump) control mode. * bit 7: Park (set in different function) * bit 6: nSleep @@ -631,19 +631,19 @@ * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPAControl + * @details \b Outputs: fpgaActuatorSetPoints.fpgaD11_PumpControl * @param control Concentrate pump control set * @return none *************************************************************************/ -void setFPGAAcidPumpControl( U08 control ) +void setFPGAD11PumpControl( U08 control ) { - fpgaActuatorSetPoints.fpgaCPAControl &= FPGA_CONC_PUMP_PARK_COMMAND; // preserve msb (park command bit) - fpgaActuatorSetPoints.fpgaCPAControl |= control; + fpgaActuatorSetPoints.fpgaD11_PumpControl &= FPGA_CONC_PUMP_PARK_COMMAND; // preserve msb (park command bit) + fpgaActuatorSetPoints.fpgaD11_PumpControl |= control; } /*********************************************************************//** * @brief - * The setFPGABicarbPumpControl function sets the DVT concentrate pump 2 + * The setFPGAD10PumpControl function sets the DVT concentrate pump 2 * (bicarb pump) control mode. * bit 7: Park (set in different function) * bit 6: nSleep @@ -652,46 +652,46 @@ * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPBControl + * @details \b Outputs: fpgaActuatorSetPoints.fpgaD10_PumpControl * @param control Concentrate pump control set * @return none *************************************************************************/ -void setFPGABicarbPumpControl( U08 control ) +void setFPGAD10PumpControl( U08 control ) { - fpgaActuatorSetPoints.fpgaCPBControl &= FPGA_CONC_PUMP_PARK_COMMAND; // preserve msb (park command bit) - fpgaActuatorSetPoints.fpgaCPBControl |= control; + fpgaActuatorSetPoints.fpgaD10_PumpControl &= FPGA_CONC_PUMP_PARK_COMMAND; // preserve msb (park command bit) + fpgaActuatorSetPoints.fpgaD10_PumpControl |= control; } /*********************************************************************//** * @brief - * The setFPGAAcidPumpParkCmd function sets the DVT concentrate pump 1 + * The setFPGAD11PumpParkCmd function sets the DVT concentrate pump 1 * (acid pump) park command bit. * bit 7: Park command bit * bit 0-6: Other pump control bits (set in different function) * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPAControl + * @details \b Outputs: fpgaActuatorSetPoints.fpgaD11_PumpControl * @param Park command bit set * @return none *************************************************************************/ -void setFPGAAcidPumpParkCmd( void ) +void setFPGAD11PumpParkCmd( void ) { - fpgaActuatorSetPoints.fpgaCPAControl |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands + fpgaActuatorSetPoints.fpgaD11_PumpControl |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands } /*********************************************************************//** * @brief - * The setFPGABicarbPumpParkCmd function sets the DVT concentrate pump 2 + * The setFPGAD10PumpParkCmd function sets the DVT concentrate pump 2 * (bicarb pump) park command bit. * bit 7: Park command bit * bit 0-6: Other pump control bits (set in different function) * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPBControl + * @details \b Outputs: fpgaActuatorSetPoints.fpgaD10_PumpControl * @param Park command bit set * @return none *************************************************************************/ -void setFPGABicarbPumpParkCmd( void ) +void setFPGAD10PumpParkCmd( void ) { - fpgaActuatorSetPoints.fpgaCPBControl |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands + fpgaActuatorSetPoints.fpgaD10_PumpControl |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands } /*********************************************************************//** @@ -1296,30 +1296,30 @@ /*********************************************************************//** * @brief - * The setFPGACPARevolutionCount function sets the Acid concentrate + * The setFPGAD11PumpRevolutionCount function sets the Acid concentrate * pump revolution count. * @details \b Inputs: none - * @details \b Outputs: fpgaCPARevCount + * @details \b Outputs: fpgaD11_PumpRevCount * @param count the number of revolution to be rotated for the pump. * @return none *************************************************************************/ -void setFPGACPARevolutionCount( U16 count ) +void setFPGAD11PumpRevolutionCount( U16 count ) { - fpgaActuatorSetPoints.fpgaCPARevCount = count; + fpgaActuatorSetPoints.fpgaD11_PumpRevCount = count; } /*********************************************************************//** * @brief - * The setFPGACPBRevolutionCount function sets the Bicarb concentrate + * The setFPGAD10PumpRevolutionCount function sets the Bicarb concentrate * pump revolution count. * @details \b Inputs: none - * @details \b Outputs: fpgaCPBRevCount + * @details \b Outputs: fpgaD10_PumpRevCount * @param count the number of revolution to be rotated for the pump. * @return none *************************************************************************/ -void setFPGACPBRevolutionCount( U16 count ) +void setFPGAD10PumpRevolutionCount( U16 count ) { - fpgaActuatorSetPoints.fpgaCPBRevCount = count; + fpgaActuatorSetPoints.fpgaD10_PumpRevCount = count; } /*********************************************************************//** @@ -1516,7 +1516,7 @@ /*********************************************************************//** * @brief - * The getFPGAAcidPumpControlStatus function gets the status of the + * The getFPGAD11PumpControlStatus function gets the status of the * acid pump control status bits. * bit 7: Park (set in different function) * bit 6: nSleep @@ -1525,17 +1525,17 @@ * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPAControl + * @details \b Outputs: fpgaActuatorSetPoints.fpgaD11_PumpControl * @return Acid pump control status bit *************************************************************************/ -U08 getFPGAAcidPumpControlStatus( void ) +U08 getFPGAD11PumpControlStatus( void ) { - return fpgaActuatorSetPoints.fpgaCPAControl; + return fpgaActuatorSetPoints.fpgaD11_PumpControl; } /*********************************************************************//** * @brief - * The getFPGABicarbPumpControlStatus function gets the DVT concentrate pump 2 + * The getFPGAD10PumpControlStatus function gets the DVT concentrate pump 2 * (bicarb pump) control mode. * bit 7: Park (set in different function) * bit 6: nSleep @@ -1544,115 +1544,115 @@ * bit 3: Direction (1=Fwd, 0=Rev) * bit 0-2: Microstepping resolution * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPBControl + * @details \b Outputs: fpgaActuatorSetPoints.fpgaD10_PumpControl * @return Bicarb pump control status bit *************************************************************************/ -U08 getFPGABicarbPumpControlStatus( void ) +U08 getFPGAD10PumpControlStatus( void ) { - return fpgaActuatorSetPoints.fpgaCPBControl; + return fpgaActuatorSetPoints.fpgaD10_PumpControl; } /*********************************************************************//** * @brief * The getFPGAConcentratePumpsFault function gets concentrate pumps fault * reported by FGPA. - * @details \b Inputs: fpgaSensorReadings.fpgaCPACPBFault + * @details \b Inputs: fpgaSensorReadings.fpgaD11_D10_PumpFault * @details \b Outputs: none * @return Latest concentrate pumps fault value *************************************************************************/ U08 getFPGAConcentratePumpsFault( void ) { - return fpgaSensorReadings.fpgaCPACPBFault & FPGA_CONC_PUMP_FAULT_BITS; + return fpgaSensorReadings.fpgaD11_D10_PumpFault & FPGA_CONC_PUMP_FAULT_BITS; } /*********************************************************************//** * @brief - * The getFPGAAcidPumpIsParked function gets whether the acid pump is currently + * The getFPGAD11PumpIsParked function gets whether the acid pump is currently * parked. - * @details \b Inputs: fpgaSensorReadings.fpgaCPACPBFault + * @details \b Inputs: fpgaSensorReadings.fpgaD11_D10_PumpFault * @details \b Outputs: none * @return TRUE if acid pump is parked, FALSE if not *************************************************************************/ -BOOL getFPGAAcidPumpIsParked( void ) +BOOL getFPGAD11PumpIsParked( void ) { - U08 mask = fpgaSensorReadings.fpgaCPACPBFault & FPGA_CPA_PARKED_BIT; + U08 mask = fpgaSensorReadings.fpgaD11_D10_PumpFault & FPGA_D11_PUMP_PARKED_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief - * The getFPGABicarbPumpIsParked function gets whether the bicarb pump is currently + * The getFPGAD10PumpIsParked function gets whether the bicarb pump is currently * parked. - * @details \b Inputs: fpgaSensorReadings.fpgaCPACPBFault + * @details \b Inputs: fpgaSensorReadings.fpgaD11_D10_PumpFault * @details \b Outputs: none * @return TRUE if bicarb pump is parked, FALSE if not *************************************************************************/ -BOOL getFPGABicarbPumpIsParked( void ) +BOOL getFPGAD10PumpIsParked( void ) { - U08 mask = fpgaSensorReadings.fpgaCPACPBFault & FPGA_CPB_PARKED_BIT; + U08 mask = fpgaSensorReadings.fpgaD11_D10_PumpFault & FPGA_D10_PUMP_PARKED_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief - * The getFPGAAcidPumpParkFault function gets whether the acid pump park command + * The getFPGAD11PumpParkFault function gets whether the acid pump park command * has faulted. - * @details \b Inputs: fpgaSensorReadings.fpgaCPACPBFault + * @details \b Inputs: fpgaSensorReadings.fpgaD11_D10_PumpFault * @details \b Outputs: none * @return TRUE if acid pump park command faulted, FALSE if not *************************************************************************/ -BOOL getFPGAAcidPumpParkFault( void ) +BOOL getFPGAD11PumpParkFault( void ) { - U08 mask = fpgaSensorReadings.fpgaCPACPBFault & FPGA_CPA_PARK_FAULT_BIT; + U08 mask = fpgaSensorReadings.fpgaD11_D10_PumpFault & FPGA_D11_PUMP_PARK_FAULT_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief - * The getFPGABicarbPumpParkFault function gets whether the bicarb pump park command + * The getFPGAD10PumpParkFault function gets whether the bicarb pump park command * has faulted. - * @details \b Inputs: fpgaSensorReadings.fpgaCPACPBFault + * @details \b Inputs: fpgaSensorReadings.fpgaD11_D10_PumpFault * @details \b Outputs: none * @return TRUE if bicarb pump park command faulted, FALSE if not *************************************************************************/ -BOOL getFPGABicarbPumpParkFault( void ) +BOOL getFPGAD10PumpParkFault( void ) { - U08 mask = fpgaSensorReadings.fpgaCPACPBFault & FPGA_CPB_PARK_FAULT_BIT; + U08 mask = fpgaSensorReadings.fpgaD11_D10_PumpFault & FPGA_D10_PUMP_PARK_FAULT_BIT; BOOL result = ( mask > 0 ? TRUE : FALSE ); return result; } /*********************************************************************//** * @brief - * The getFPGACPAHallSensePulseWidth function gets concentrate pump CPA + * The getFPGAD11PumpHallSensePulseWidth function gets concentrate pump D11_Pump * hall sense pulse width. - * @details \b Inputs: fpgaSensorReadings.fpgaCPAHallSense + * @details \b Inputs: fpgaSensorReadings.fpgaD11_PumpHallSense * @details \b Outputs: none - * @return concentrate pump CPA hall sense pulse width + * @return concentrate pump D11_Pump hall sense pulse width *************************************************************************/ -U16 getFPGACPAHallSensePulseWidth( void ) +U16 getFPGAD11PumpHallSensePulseWidth( void ) { - return fpgaSensorReadings.fpgaCPAHallSense; + return fpgaSensorReadings.fpgaD11_PumpHallSense; } /*********************************************************************//** * @brief - * The getFPGACPBHallSensePulseWidth function gets concentrate pump CPB + * The getFPGAD10PumpHallSensePulseWidth function gets concentrate pump D10_Pump * hall sense pulse width. - * @details \b Inputs: fpgaSensorReadings.fpgaCPBHallSense + * @details \b Inputs: fpgaSensorReadings.fpgaD10_PumpHallSense * @details \b Outputs: none - * @return concentrate pump CPB hall sense pulse width + * @return concentrate pump D10_Pump hall sense pulse width *************************************************************************/ -U16 getFPGACPBHallSensePulseWidth( void ) +U16 getFPGAD10PumpHallSensePulseWidth( void ) { - return fpgaSensorReadings.fpgaCPBHallSense; + return fpgaSensorReadings.fpgaD10_PumpHallSense; } /*********************************************************************//** @@ -2612,28 +2612,28 @@ /*********************************************************************//** * @brief - * The getFPGACPARevolutionCountStatus function gets the current revolution of + * The getFPGAD11PumpRevolutionCountStatus function gets the current revolution of * acid concentrate pump (down counter). - * @details \b Inputs: fpgaCPAStepCountStatus + * @details \b Inputs: fpgaD11_PumpStepCountStatus * @details \b Outputs: none * @return the current revolution of the acid concentrate pump *************************************************************************/ -U16 getFPGACPARevolutionCountStatus( void ) +U16 getFPGAD11PumpRevolutionCountStatus( void ) { - return fpgaSensorReadings.fpgaCPAStepCountStatus; + return fpgaSensorReadings.fpgaD11_PumpStepCountStatus; } /*********************************************************************//** * @brief - * The getFPGACPBRevolutionCountStatus function gets the current revolution of + * The getFPGAD10PumpRevolutionCountStatus function gets the current revolution of * bicarb concentrate pump (down counter). - * @details \b Inputs: fpgaCPBStepCountStatus + * @details \b Inputs: fpgaD10_PumpStepCountStatus * @details \b Outputs: none * @return the current revolution of the bicarb concentrate pump *************************************************************************/ -U16 getFPGACPBRevolutionCountStatus( void ) +U16 getFPGAD10PumpRevolutionCountStatus( void ) { - return fpgaSensorReadings.fpgaCPBStepCountStatus; + return fpgaSensorReadings.fpgaD10_PumpStepCountStatus; } /*********************************************************************//**