Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r22176ce95e49213c48454f34ddf5d29b8109f2cb -ra89d6b091874136d75a9bfbdbbc1ff00f42467b3 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 22176ce95e49213c48454f34ddf5d29b8109f2cb) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision a89d6b091874136d75a9bfbdbbc1ff00f42467b3) @@ -9,7 +9,7 @@ * @file FPGA.c * * @author (last) Dara Navaei -* @date (last) 24-May-2022 +* @date (last) 04-Aug-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -25,6 +25,8 @@ #include "Comm.h" #include "Compatible.h" #include "FPGA.h" +#include "NVDataMgmt.h" +#include "OperationModes.h" #include "PersistentAlarm.h" #include "SystemCommMessages.h" #include "Utilities.h" @@ -84,7 +86,11 @@ #define CONCENTRATE_CAP_SWITCH_MASK 0x10 ///< Concentrate cap switch bit mask #define DIALYSATE_CAP_SWITCH_MASK 0x20 ///< Dialysate cap switch bit mask.. #define FPGA_POWER_OUT_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< FPGA power out timeout in milliseconds. -#define FPGA_GPIO_POWER_STATUS_PIN 7 ///< FPGA GPIO power status pin +#define FPGA_GPIO_POWER_STATUS_PIN 7 ///< FPGA GPIO power status pin. +#define FPGA_READ_V3_START_BYTE_NUM 256 ///< FPGA V3 read sensors start byte number. +#define FPGA_READ_V3_END_BYTE_NUM 412 ///< FPGA V3 read sensors end byte number. +/// FPGA size of V3 read bytes. +#define FPGA_SIZE_OF_V3_READ_BYTES ( FPGA_READ_V3_END_BYTE_NUM - FPGA_READ_V3_START_BYTE_NUM ) // FPGA header struct. #pragma pack(push,1) @@ -97,7 +103,7 @@ } FPGA_HEADER_T; // read only on FPGA /// FPGA sensors' readings struct. -typedef struct // TODO - add all sensor readings to this structure per FPGA register map +typedef struct { U32 fpgaLCA1; ///< Reg 256. ADC1 channel 0 - load cell A1 U32 fpgaLCB1; ///< Reg 260. ADC1 channel 1 - load cell B1 @@ -156,6 +162,7 @@ U08 fpgaPrimaryHeaterReadCnt; ///< Reg 365. Primary heater read count U08 fpgaTrimmerHeaterFlags; ///< Reg 366. Trimmer heater flags U08 fpgaTrimmerHeaterReadCnt; ///< Reg 367. Trimmer heater read count + U08 fpgaCPoFault; ///< Reg 368. CPo conductivity sensor fault U08 fpgaCPoReadCnt; ///< Reg 369. CPo conductivity sensor read count U08 fpgaCPoErrorCnt; ///< Reg 370. CPo conductivity sensor error count @@ -169,12 +176,12 @@ U16 fpgaFanIn1Pulse; ///< Reg 378. Fan inlet 1 pulse time in 2.5 us resolution U16 fpgaFanOut1Pulse; ///< Reg 380. Fan outlet 1 pulse time in 2.5 us resolution - U08 fpgaEmstatOutByte; ///< Reg 382. Emstat output FIFO - data from the Emstat device - U08 fpgaEmstatRxErrorCount; ///< Reg 383. Number of receive errors since power-up - U16 fpgaEmstatTxFifoCount; ///< Reg 384. Number of bytes in the Emstat Tx FIFO buffer - U16 fpgaEmstatRxFifoCount; ///< Reg 386. Number of bytes in the Emstat Rx FIFO buffer - U16 fpgaCP1HallSense; ///< Reg 388. Concentrate pump CP1 hall sensor pulse width. - U16 fpgaCP2HallSense; ///< Reg 390. Concentrate pump CP2 hall sensor pulse width. + U08 fpgaCD1CD2EmstatOutByte; ///< Reg 382. Emstat output FIFO - data from the Emstat device + U08 fpgaCD1CD2EmstatRxErrorCount; ///< Reg 383. Number of receive errors since power-up + U16 fpgaCD1CD2EmstatTxFifoCount; ///< Reg 384. Number of bytes in the Emstat Tx FIFO buffer + U16 fpgaCD1CD2EmstatRxFifoCount; ///< Reg 386. Number of bytes in the Emstat Rx FIFO buffer + U16 fpgaCP1HallSense; ///< Reg 388. Concentrate pump CP1 hall sensor pulse width + U16 fpgaCP2HallSense; ///< Reg 390. Concentrate pump CP2 hall sensor pulse width U08 fpgaGPIO; ///< Reg 392. FGPA GPIO register U08 fpgaDummyByte2Addr; ///< Reg 393. Dummy byte address to maintain an even addressing scheme @@ -184,14 +191,41 @@ U16 fpgaFanOut2Pulse; ///< Reg 398. Fan outlet 2 pulse time in 2.5 resolution U16 fpgaFanIn3Pulse; ///< Reg 400. Fan inlet 3 pulse time in 2.5 resolution U16 fpgaFanOut3Pulse; ///< Reg 402. Fan outlet 3 pulse time in 2.5 resolution - U16 fpgaTimerCount_ms; ///< Reg 404. Internal FPGA timer count in ms. + U16 fpgaTimerCountMS; ///< Reg 404. Internal FPGA timer count in milliseconds U16 fpgaADCVccInt; ///< Reg 406. Internal FPGA Vcc Voltage. - U16 fpgaADCVccAux; ///< Reg 408. Internal FPGA Vcc auxiliary voltage. - U16 fpgaADCVPVN; ///< Reg 410. Internal FPGA VPVN voltage. - U16 fpgaOpenRegister; ///< Reg 412. Open register. - U16 fpgaDrainPumpSpeedFeedback; ///< Reg 414. Drain pump speed feedback. - U16 fpgaDrainPumpCurrentFeedback; ///< Reg 416. Drain pump current feedback. + U16 fpgaADCVccAux; ///< Reg 408. Internal FPGA Vcc auxiliary voltage + U16 fpgaADCVPVN; ///< Reg 410. Internal FPGA VPVN voltage + + // DVT changes + U08 fpgaBaroReadCount; ///< Reg 412. Barometric sensor read count + U08 fpgaBaroErroCount; ///< Reg 413. Barometric sensor error count + U16 fpgaDrainPumpSpeedFeedback; ///< Reg 414. Drain pump speed feedback + U16 fpgaDrainPumpCurrentFeedback; ///< Reg 416. Drain pump current feedback U16 fpgaDialysateFlowRate; ///< Req 418. Dialysate flow rate measurement + U16 fpgaHeaterGateADC; ///< Reg 420. Heater gate ADC + U16 fpgaHeaterGNDADC; ///< Reg 422. Heater ground ADC + U08 fpgaHeater1ADCReadCount; ///< Reg 424. Heater 1 ADC read count + U08 fpgaHeater1ADCErrorCount; ///< Reg 425. Heater 1 ADC error count + U16 fpgaBaroManufacInfo; ///< Reg 426. Barometric sensor manufacturing information + U16 fpgaBaroPROMCoeff1; ///< Reg 428. Barometric sensor PROM coefficient 1 + U16 fpgaBaroPROMCoeff2; ///< Reg 430. Barometric sensor PROM coefficient 2 + U16 fpgaBaroPROMCoeff3; ///< Reg 432. Barometric sensor PROM coefficient 3 + U16 fpgaBaroPROMCoeff4; ///< Reg 434. Barometric sensor PROM coefficient 4 + U16 fpgaBaroPROMCoeff5; ///< Reg 436. Barometric sensor PROM coefficient 5 + U16 fpgaBaroPROMCoeff6; ///< Reg 438. Barometric sensor PROM coefficient 6 + U16 fpgaBaroPROMCRC; ///< Reg 440. Barometric sensor PROM CRC + U32 fpgaBaroPressure; ///< Reg 442. Barometric sensor pressure value + U32 fpgaBaroTemperature; ///< Reg 446. Barometric sensor temperature sensor + U08 fpgaTHdRTDReadCount; ///< Reg 450. THD RTD read count + U08 fpgaTHdRTDErrorCount; ///< Reg 451. THD RTD error count + U32 fpgaTHdTemp; ///< Reg 452. THD channel 0 read data - temperature sensor + U32 fpgaTHdInternalTemp; ///< Reg 456. THD channel 1 read data - ADC internal temperature sensor + U08 fpgaCPiCPoEmstatOutByte; ///< Reg 460. CPi/CPo Emstat out byte + U08 fpgaCPiCPoEmstatRxErrCount; ///< Reg 461. CPi/CPo Emstat Rx error count + U16 fpgaCPiCPoEmstatTxFIFOCount; ///< Reg 462. CPi/CPo Emstat Tx FIFO count + U16 fpgaCPiCPoEmstatRxFIFOCount; ///< Reg 464. CPi/CPo Emstat Rx FIFO count + U16 fpgaPowerSupply2; ///< Reg 466. power supply 2 count + U16 fpgaOnBoardThermistor; ///< Reg 468. onboard thermistor } DG_FPGA_SENSORS_T; typedef struct @@ -208,13 +242,68 @@ U16 fpgaCP2StepSpeed; ///< Reg 26. Concentrate pump CP2 step speed register U08 fpgaCP2Control; ///< Reg 28. Concentrate pump CP2 control register U08 fpgaEmstatControl; ///< Reg 29. Emstat conductivity sensor control register + U16 fpgaVRfPWMLow; ///< Reg 30. VRf PWM low + U16 fpgaVRfPWMPeriod; ///< Reg 32. VRf PWM period + U16 fpgaVRiPWMLow; ///< Reg 34. VRi PWM low + U16 fpgaVRiPWMPeriod; ///< Reg 36. VRi PWM period + U16 fpgaVRdPWMLow; ///< Reg 38. VRd PWM low + U16 fpgaVRdPWMPeriod; ///< Reg 40. VRD PWM period + U16 fpgaVRoPWMLow; ///< Reg 42. VRo PWM low + U16 fpgaVRoPWMPeriod; ///< Reg 44. VRo PWM period + U16 fpgaVPoPWMLow; ///< Reg 46. VPo PWM low + U16 fpgaVPoPWMPeriod; ///< Reg 48. VPo PWM period + U16 fpgaVBfPWMLow; ///< Reg 50. VBf PWM low + U16 fpgaVBFPWMPeriod; ///< Reg 52. VBf PWM period + U16 fpgaVRcPWMLow; ///< Reg 54. VRc PWM low + U16 fpgaVRcPWMPeriod; ///< Reg 56. VRc PWM period + U16 fpgaVDrPWMLow; ///< Reg 58. VDr PWM Low + U16 fpgaVDrPWMPeriod; ///< Reg 60. VDr PWM period + U16 fpgaVPiPWMLow; ///< Reg 62. VPi PWM low + U16 fpgaVPiPWMPeriod; ///< Reg 64. VPi PWM period + U16 fpgaVSPPWMLow; ///< Reg 66. VSP PWM low + U16 fpgaVSPPWMPeriod; ///< Reg 68. VSP PWM period + U16 fpgaVRd1PWMLow; ///< Reg 70. VRd1 PWM low + U16 fpgaVRd1PWMPeriod; ///< Reg 72. VRd1 PWM period + U16 fpgaVRd2PWMLow; ///< Reg 74. VRd2 PWM low + U16 fpgaVRd2PWMPeriod; ///< Reg 76. VRd2 PWM period + U16 fpgaVPdPWMLow; ///< Reg 78. VPd PWM low + U16 fpgaVPdPWMPeriod; ///< Reg 80. VPd PWM period + U16 fpgaVSOLPWMLow; ///< Reg 82. VSOL PWM low + U16 fpgaVSOLPWMPeriod; ///< Reg 84. VSOL PWM period + U16 fpgaVRfPWMPullin; ///< Reg 86. VRf PWM pull in + U16 fpgaVRiPWMPullin; ///< Reg 88. VRi PWM pull in + U16 fpgaVRdPWMPullin; ///< Reg 90. VRd PWM pull in + U16 fpgaVRoPWMPullin; ///< Reg 92. VRo PWM pull in + U16 fpgaVPoPWMPullin; ///< Reg 94. VPo PWM pull in + U16 fpgaVBfPWMPullin; ///< Reg 96. VBf PWM pull in + U16 fpgaVRcPWMPullin; ///< Reg 98. VRc PWM pull in + U16 fpgaVDrPWMPullin; ///< Reg 100. VDr PWM pull in + U16 fpgaVPiPWMPullin; ///< Reg 102. VPi PWM pull in + U16 fpgaVSPPWMPullin; ///< Reg 104. VSP PWM pull in + U16 fpgaVRd1PWMPullin; ///< Reg 106. VRd1 PWM pull in + U16 fpgaVRd2PWMPullin; ///< Reg 108. VRd2 PWM pull in + U16 fpgaVPdPWMPullin; ///< Reg 110. VPd PWM pull in + U16 fpgaVSPR2PWMPullin; ///< Reg 112. VSPR2 PWM pull in + U16 fpgaValvePWMEnable; ///< Reg 114. valve PWM enable + + // DVT Registers + U08 fpgaTHdControlReg; ///< Reg 116. THd control register + U08 fpgaCPiCPoEmstatControl; ///< Reg 117. CPi/CPo Emstat control + U16 fpgaDACRegBIn; ///< Reg 118. Debug DAC channel B output + U16 fpgaDACRegCIn; ///< Reg 120. Debug DAC channel C output + U16 fpgaDACRegDIn; ///< Reg 122. Debug DAC channel D output + U16 fpgaDACRegEIn; ///< Reg 124. Debug DAC channel E output + U16 fpgaDACRegFIn; ///< Reg 126. Debug DAC channel F output + U16 fpgaDACRegGIn; ///< Reg 128. Debug DAC channel G output + U16 fpgaDACRegHIn; ///< Reg 130. Debug DAC channel H output + U08 fgpaNewCP2Control; ///< Reg 132. Concentrate pump 2 control + U08 fpgaNewCP1Control; ///< Reg 133. Concentrate pump 1 control } FPGA_ACTUATORS_T; #pragma pack(pop) // ********** private data ********** static FPGA_STATE_T fpgaState = FPGA_STATE_START; ///< FPGA current state. - static U32 fpgaCommRetryCount = 0; ///< FPGA communication retry count. static U32 fpgaReceiptCounter = 0; ///< FPGA receipt completed counter. static U32 fpgaTransmitCounter = 0; ///< FPGA transmit completed counter. @@ -240,6 +329,7 @@ static FPGA_HEADER_T fpgaHeader; ///< FPGA header structure. static DG_FPGA_SENSORS_T fpgaSensorReadings; ///< DG FPGA sensors structure. static FPGA_ACTUATORS_T fpgaActuatorSetPoints; ///< FPGA actuator set points structure. +static U08 fpgaReadByteSize; ///< FPGA read byte size. // ********** private function prototypes ********** @@ -452,6 +542,15 @@ *************************************************************************/ void execFPGAIn( void ) { + fpgaReadByteSize = sizeof( DG_FPGA_SENSORS_T ); + +#ifndef _RELEASE_ + if( ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_V3_SYSTEM ) ) || ( DG_MODE_INIT == getCurrentOperationMode() ) ) + { + fpgaReadByteSize = FPGA_SIZE_OF_V3_READ_BYTES; + } +#endif + // FPGA incoming state machine switch ( fpgaState ) { @@ -512,6 +611,15 @@ *************************************************************************/ void execFPGAOut( void ) { + fpgaReadByteSize = FPGA_SIZE_OF_V3_READ_BYTES; + +#ifndef _RELEASE_ + if( ( SW_CONFIG_ENABLE_VALUE != getSoftwareConfigStatus( SW_CONFIG_ENABLE_V3_SYSTEM ) ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) + { + fpgaReadByteSize = sizeof( DG_FPGA_SENSORS_T ); + } +#endif + // FPGA outgoing state machine switch ( fpgaState ) { @@ -591,7 +699,7 @@ // did FPGA Ack the read command? if ( fpgaReadResponseBuffer[ 0 ] == FPGA_READ_CMD_ACK ) { - U32 rspSize = FPGA_READ_RSP_HDR_LEN + sizeof(FPGA_HEADER_T); + U32 rspSize = FPGA_READ_RSP_HDR_LEN + sizeof( FPGA_HEADER_T ); U32 crcPos = rspSize; U16 crc = MAKE_WORD_OF_BYTES( fpgaReadResponseBuffer[ crcPos ], fpgaReadResponseBuffer[ crcPos + 1 ] ); @@ -641,7 +749,7 @@ fpgaWriteCmdBuffer[ 0 ] = FPGA_WRITE_CMD_CODE; fpgaWriteCmdBuffer[ 1 ] = GET_LSB_OF_WORD( FPGA_BULK_WRITE_START_ADDR ); fpgaWriteCmdBuffer[ 2 ] = GET_MSB_OF_WORD( FPGA_BULK_WRITE_START_ADDR ); - fpgaWriteCmdBuffer[ 3 ] = sizeof(FPGA_ACTUATORS_T); + fpgaWriteCmdBuffer[ 3 ] = sizeof( FPGA_ACTUATORS_T ); memcpy( &( fpgaWriteCmdBuffer[ FPGA_WRITE_CMD_HDR_LEN ] ), &fpgaActuatorSetPoints, sizeof( FPGA_ACTUATORS_T ) ); crc = crc16( fpgaWriteCmdBuffer, FPGA_WRITE_CMD_HDR_LEN + sizeof( FPGA_ACTUATORS_T ) ); fpgaWriteCmdBuffer[ FPGA_WRITE_CMD_HDR_LEN + sizeof( FPGA_ACTUATORS_T ) ] = GET_MSB_OF_WORD( crc ); @@ -651,7 +759,7 @@ fpgaReadCmdBuffer[ 0 ] = FPGA_READ_CMD_CODE; fpgaReadCmdBuffer[ 1 ] = GET_LSB_OF_WORD( FPGA_BULK_READ_START_ADDR ); fpgaReadCmdBuffer[ 2 ] = GET_MSB_OF_WORD( FPGA_BULK_READ_START_ADDR ); - fpgaReadCmdBuffer[ 3 ] = sizeof(DG_FPGA_SENSORS_T); + fpgaReadCmdBuffer[ 3 ] = fpgaReadByteSize; crc = crc16( fpgaReadCmdBuffer, FPGA_READ_CMD_HDR_LEN ); fpgaReadCmdBuffer[ 4 ] = GET_MSB_OF_WORD( crc ); fpgaReadCmdBuffer[ 5 ] = GET_LSB_OF_WORD( crc ); @@ -662,7 +770,7 @@ // prep DMA for sending the bulk read cmd and receiving its response setupDMAForReadCmd( FPGA_READ_CMD_HDR_LEN + FPGA_CRC_LEN ); - setupDMAForReadResp( FPGA_READ_RSP_HDR_LEN + sizeof( DG_FPGA_SENSORS_T ) + FPGA_CRC_LEN ); + setupDMAForReadResp( FPGA_READ_RSP_HDR_LEN + fpgaReadByteSize + FPGA_CRC_LEN ); // set fpga comm flags for bulk write cmd and follow-up bulk read command fpgaWriteCommandInProgress = TRUE; @@ -698,7 +806,7 @@ // did FPGA Ack the read command? if ( fpgaReadResponseBuffer[ 0 ] == FPGA_READ_CMD_ACK ) { - U32 rspSize = FPGA_READ_RSP_HDR_LEN + sizeof(DG_FPGA_SENSORS_T); + U32 rspSize = FPGA_READ_RSP_HDR_LEN + fpgaReadByteSize; U32 crcPos = rspSize; U16 crc = MAKE_WORD_OF_BYTES( fpgaReadResponseBuffer[ crcPos ], fpgaReadResponseBuffer[ crcPos + 1 ] ); @@ -707,7 +815,7 @@ { fpgaCommRetryCount = 0; // capture the read values - memcpy( &fpgaSensorReadings, &fpgaReadResponseBuffer[ FPGA_READ_RSP_HDR_LEN ], sizeof( DG_FPGA_SENSORS_T ) ); + memcpy( &fpgaSensorReadings, &fpgaReadResponseBuffer[ FPGA_READ_RSP_HDR_LEN ], fpgaReadByteSize ); result = FPGA_STATE_WRITE_ALL_ACTUATORS; } else // bad CRC @@ -742,32 +850,25 @@ { SELF_TEST_STATUS_T result; - // check FPGA reported correct ID - if ( FPGA_EXPECTED_ID == fpgaHeader.fpgaId ) + // TODO the FPGA self test has been implemented in DEN-13460. + /*if ( FPGA_EXPECTED_ID == fpgaHeader.fpgaId ) { // Check FPGA compatibility w/ firmware - if ( fpgaHeader.fpgaRevMajor > MIN_DG_FPGA_MAJOR ) + if ( DG_FPGA_COMPATIBILITY_REV == fpgaSensorReadings.fpgaCompatibilityRev ) { result = SELF_TEST_STATUS_PASSED; } else { - if ( ( MIN_DG_FPGA_MAJOR == fpgaHeader.fpgaRevMajor ) && ( fpgaHeader.fpgaRevMinor >= MIN_DG_FPGA_MINOR ) ) - { - result = SELF_TEST_STATUS_PASSED; - } - else - { - result = SELF_TEST_STATUS_FAILED; - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_FPGA_POST_TEST_FAILED, (U32)fpgaHeader.fpgaRevMajor, (U32)fpgaHeader.fpgaRevMinor ) - } + result = SELF_TEST_STATUS_FAILED; + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_FPGA_POST_TEST_FAILED, (U32)DG_FPGA_COMPATIBILITY_REV, (U32)fpgaSensorReadings.fpgaCompatibilityRev ) } } else { result = SELF_TEST_STATUS_FAILED; SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_FPGA_POST_TEST_FAILED, (U32)fpgaHeader.fpgaId ) - } + }*/ return result; } @@ -1032,60 +1133,90 @@ /*********************************************************************//** * @brief - * The setFPGACP1Control function sets the control configuration for + * The setFPGAcidPumpControl function sets the control configuration for * concentrate pump CP1. * @details Inputs: none * @details Outputs: fpgaActuatorSetPoints.fpgaCP1Control * @param pumpControl The concentrate pump control configuration * @return none *************************************************************************/ -void setFPGACP1Control( U08 pumpControl ) +void setFPGAV3AcidPumpControl( U08 pumpControl ) { fpgaActuatorSetPoints.fpgaCP1Control = pumpControl; } /*********************************************************************//** * @brief - * The setFPGACP2Control function sets the control configuration for + * The setFPGABicarbPumpControl function sets the control configuration for * concentrate pump CP2. * @details Inputs: none * @details Outputs: fpgaActuatorSetPoints.fpgaCP2Control * @param pumpControl The concentrate pump control configuration * @return none *************************************************************************/ -void setFPGACP2Control( U08 pumpControl ) +void setFPGAV3BicarbPumpControl( U08 pumpControl ) { fpgaActuatorSetPoints.fpgaCP2Control = pumpControl; } /*********************************************************************//** * @brief - * The setFPGACP1SetStepSpeed function sets the step speed period for concentrate pump CP1. + * The setFPGAAcidPumpSetStepSpeed function sets the step speed period for + * concentrate pump CP1. * @details Inputs: none * @details Outputs: fpgaActuatorSetPoints.fpgaCP1StepSpeed * @param stepSpeed The concentrate pump step speed period * @return none *************************************************************************/ -void setFPGACP1SetStepSpeed( U16 stepSpeed ) +void setFPGAAcidPumpSetStepSpeed( U16 stepSpeed ) { fpgaActuatorSetPoints.fpgaCP1StepSpeed = stepSpeed; } /*********************************************************************//** * @brief - * The setFPGACP2SetStepSpeed function sets the step speed period for concentrate pump CP2. + * The setFPGABicarbSetStepSpeed function sets the step speed period for + * concentrate pump CP2. * @details Inputs: none * @details Outputs: fpgaActuatorSetPoints.fpgaCP2StepSpeed * @param stepSpeed The concentrate pump step speed period * @return none *************************************************************************/ -void setFPGACP2SetStepSpeed( U16 stepSpeed ) +void setFPGABicarbSetStepSpeed( U16 stepSpeed ) { fpgaActuatorSetPoints.fpgaCP2StepSpeed = stepSpeed; } /*********************************************************************//** * @brief + * The setFPGAAcidPumpControl function sets the DVT concentrate pump 1 + * (acid pump) control mode. + * @details Inputs: none + * @details Outputs: fpgaActuatorSetPoints.fpgaNewCP1Control + * @param control Concentrate pump control set + * @return none + *************************************************************************/ +void setFPGAAcidPumpControl( U08 control ) +{ + fpgaActuatorSetPoints.fpgaNewCP1Control = control; +} + +/*********************************************************************//** + * @brief + * The setFPGABicarbPumpControl function sets the DVT concentrate pump 2 + * (bicarb pump) control mode. + * @details Inputs: none + * @details Outputs: fpgaActuatorSetPoints.fgpaNewCP2Control + * @param control Concentrate pump control set + * @return none + *************************************************************************/ +void setFPGABicarbPumpControl( U08 control ) +{ + fpgaActuatorSetPoints.fgpaNewCP2Control = control; +} + +/*********************************************************************//** + * @brief * The getFPGAVersions function gets the FPGA version numbers. * @details Inputs: fpgaHeader * @details Outputs: none @@ -1625,34 +1756,35 @@ * @details Outputs: none * @return Emstat conductivity sensor output byte *************************************************************************/ -U08 getFPGAEmstatOutByte( void ) +U08 getFPGAEmstatCD1CD2OutByte( void ) { - return fpgaSensorReadings.fpgaEmstatOutByte; + return fpgaSensorReadings.fpgaCD1CD2EmstatOutByte; } /*********************************************************************//** * @brief - * The getFPGAEmstatRxErrCount function gets Emstat conductivity sensor error count. + * The getFPGAEmstatCD1CD2RxErrCount function gets Emstat conductivity sensor + * error count. * @details Inputs: fpgaSensorReadings.fpgaEmstatRxErrorCount * @details Outputs: none * @return Emstat conductivity sensor receive error count *************************************************************************/ -U08 getFPGAEmstatRxErrCount( void ) +U08 getFPGAEmstatCD1CD2RxErrCount( void ) { - return fpgaSensorReadings.fpgaEmstatRxErrorCount; + return fpgaSensorReadings.fpgaCD1CD2EmstatRxErrorCount; } /*********************************************************************//** * @brief - * The getFPGAEmstatRxFifoCount function gets Emstat conductivity sensor receive - * fifo buffer count. + * The getFPGAEmstatCD1CD2RxFifoCount function gets Emstat conductivity + * sensor receive fifo buffer count. * @details Inputs: fpgaSensorReadings.fpgaEmstatTxFifoCount * @details Outputs: none * @return Emstat conductivity sensor receive fifo buffer count *************************************************************************/ -U16 getFPGAEmstatRxFifoCount( void ) +U16 getFPGAEmstatCD1CD2RxFifoCount( void ) { - return fpgaSensorReadings.fpgaEmstatRxFifoCount; + return fpgaSensorReadings.fpgaCD1CD2EmstatRxFifoCount; } /*********************************************************************//** @@ -1883,7 +2015,7 @@ *************************************************************************/ U16 getFPGATimerCount( void ) { - return fpgaSensorReadings.fpgaTimerCount_ms; + return fpgaSensorReadings.fpgaTimerCountMS; } /*********************************************************************//** @@ -1927,4 +2059,221 @@ return ( fpgaSensorReadings.fpgaGPIO & CONCENTRATE_CAP_SWITCH_MASK ); } +/*********************************************************************//** + * @brief + * The getFPGABaroReadCount function gets the FPGA barometric sensor read count. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return barometric pressure sensor read count + *************************************************************************/ +U08 getFPGABaroReadCount( void ) +{ + return fpgaSensorReadings.fpgaBaroReadCount; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroErrorCount function gets the FPGA barometric sensor error count. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return barometric pressure sensor error count + *************************************************************************/ +U08 getFPGABaroErrorCount( void ) +{ + return fpgaSensorReadings.fpgaBaroErroCount; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroPressureSensitivity function gets the FPGA barometric pressure + * sensor sensitivity. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return barometric pressure sensor sensitivity + *************************************************************************/ +U16 getFPGABaroPressureSensitivity( void ) +{ + return fpgaSensorReadings.fpgaBaroPROMCoeff1; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroPressureOffset function gets the FPGA barometric pressure + * sensor offset. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return barometric pressure sensor offset + *************************************************************************/ +U16 getFPGABaroPressureOffset( void ) +{ + return fpgaSensorReadings.fpgaBaroPROMCoeff2; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroTempCoeffOfPressSensitvity function gets the FPGA barometric + * pressure sensor temperature coefficient of pressure sensitivity. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return barometric pressure sensor temperature coefficient of pressure sensitivity + *************************************************************************/ +U16 getFPGABaroTempCoeffOfPressSensitvity( void ) +{ + return fpgaSensorReadings.fpgaBaroPROMCoeff3; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroTempCoeffOfPressOffset function gets the FPGA barometric + * pressure sensor temperature coefficient of pressure offset. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return barometric pressure sensor temperature coefficient of pressure offset + *************************************************************************/ +U16 getFPGABaroTempCoeffOfPressOffset( void ) +{ + return fpgaSensorReadings.fpgaBaroPROMCoeff4; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroReferenceTemp function gets the FPGA barometric pressure + * sensor reference temperature. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return barometric pressure sensor reference temperature + *************************************************************************/ +U16 getFPGABaroReferenceTemp( void ) +{ + return fpgaSensorReadings.fpgaBaroPROMCoeff5; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroTempCoeffOfTemperature function gets the FPGA barometric pressure + * sensor temperature coefficient of temperature. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return barometric pressure sensor temperature coefficient of temperature + *************************************************************************/ +U16 getFPGABaroTempCoeffOfTemperature( void ) +{ + return fpgaSensorReadings.fpgaBaroPROMCoeff6; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroPressure function gets the FPGA barometric pressure sensor + * pressure. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return barometric pressure sensor pressure + *************************************************************************/ +U32 getFPGABaroPressure( void ) +{ + return ( fpgaSensorReadings.fpgaBaroPressure & MASK_OFF_U32_MSB ); +} + +/*********************************************************************//** + * @brief + * The getFPGABaroTemperature function gets the FPGA barometric pressure sensor + * temperature. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return barometric pressure sensor temperature + *************************************************************************/ +U32 getFPGABaroTemperature( void ) +{ + return ( fpgaSensorReadings.fpgaBaroTemperature & MASK_OFF_U32_MSB ); +} + +/*********************************************************************//** + * @brief + * The getFPGAEmstatCPiCPoByteOut function gets the FPGA Emstat CPi/CPo + * byte out data. + * @details Inputs: fpgaSensorReadings.fpgaCPiCPoEmstatOutByte + * @details Outputs: none + * @return CPi/CPo Emstat byte out + *************************************************************************/ +U08 getFPGAEmstatCPiCPoByteOut( void ) +{ + return fpgaSensorReadings.fpgaCPiCPoEmstatOutByte; +} + +/*********************************************************************//** + * @brief + * The getFPGAEmstatCPiCPoRxFifoCount function gets the FPGA Emstat CPi/CPo + * receive FIFO count. + * @details Inputs: fpgaSensorReadings.fpgaCD1CD2EmstatRxFifoCount + * @details Outputs: none + * @return CPi/CPo Rx FIFO count + *************************************************************************/ +U16 getFPGAEmstatCPiCPoRxFifoCount( void ) +{ + return fpgaSensorReadings.fpgaCPiCPoEmstatRxFIFOCount; +} + +/*********************************************************************//** + * @brief + * The getFPGAEmstatCPiCPoRxErrCount function gets the FPGA Emstat CPi/CPo + * receive FIFO error count. + * @details Inputs: fpgaSensorReadings.fpgaCD1CD2EmstatRxErrorCount + * @details Outputs: none + * @return CPi/CPo Rx FIFO error count + *************************************************************************/ +U08 getFPGAEmstatCPiCPoRxErrCount( void ) +{ + return fpgaSensorReadings.fpgaCPiCPoEmstatRxErrCount; +} + +/*********************************************************************//** + * @brief + * The getFPGATHdTemp function gets the FPGA THd temperature sensor. + * @details Inputs: fpgaSensorReadings.fpgaTHdTemp + * @details Outputs: none + * @return THd temperature sensor + *************************************************************************/ +U32 getFPGATHdTemp( void ) +{ + return fpgaSensorReadings.fpgaTHdTemp; +} + +/*********************************************************************//** + * @brief + * The getFPGATHdInternalTemp function gets the FPGA THd internal ADC temperature sensor. + * @details Inputs: fpgaSensorReadings.fpgaTHdInternalTemp + * @details Outputs: none + * @return THd internal ADC temperature sensor + *************************************************************************/ +U32 getFPGATHdInternalTemp( void ) +{ + return fpgaSensorReadings.fpgaTHdInternalTemp; +} + +/*********************************************************************//** + * @brief + * The getFPGATHdReadCount function gets the FPGA THd temperature sensor read + * count. + * @details Inputs: fpgaSensorReadings.fpgaTHdRTDReadCount + * @details Outputs: none + * @return THd FPGA read count + *************************************************************************/ +U08 getFPGATHdReadCount( void ) +{ + return fpgaSensorReadings.fpgaTHdRTDReadCount; +} + +/*********************************************************************//** + * @brief + * The getFPGATHdErrorCount function gets the FPGA THd temperature sensor error + * count. + * @details Inputs: fpgaSensorReadings.fpgaTHdRTDErrorCount + * @details Outputs: none + * @return THd FPGA error count + *************************************************************************/ +U08 getFPGATHdErrorCount( void ) +{ + return fpgaSensorReadings.fpgaTHdRTDErrorCount; +} + /**@}*/