Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r05f42ecd223cf512e9e8f3434dd01bdac3aca86d -r4fa5628781e2b420cad6afc42a4b754dd484b997 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 05f42ecd223cf512e9e8f3434dd01bdac3aca86d) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 4fa5628781e2b420cad6afc42a4b754dd484b997) @@ -40,9 +40,9 @@ } FPGA_STATE_T; #define FPGA_PAGE_SIZE 256 -#define FPGA_EXPECTED_ID 0x59 +#define FPGA_EXPECTED_ID 0x60 -#define FPGA_HEADER_START_ADDR 256 // update these after re-arranging w/ Randy +#define FPGA_HEADER_START_ADDR 256 // TODO - update these after re-arranging w/ Randy #define FPGA_BULK_READ_START_ADDR 262 #define FPGA_BULK_WRITE_START_ADDR 2 @@ -74,44 +74,34 @@ { U08 fpgaId; U08 fpgaRev; - U16 fpgaControl; - U16 fpgaStatus; + U16 fpgaADC1Control; + U08 fpagDiag; + U08 reserved1; + U16 fpagADC2Control; + U16 fpagRTDControl; } FPGA_HEADER_T; // read only on FPGA typedef struct // TODO - add all sensor readings to this structure per FPGA register map { + U08 fpgaId; + U08 fpgaRev; + U16 fpgaADC1Control; + U16 fpgaStatus; + U08 fpgaIOErrorCntProcessor; + U08 fpgaIOErrorCntPC; + U32 reserved1; + U32 reserved2; + U32 reserved3; + U32 reserved4; + U32 reserved5; + U32 reserved6; + U32 reserved7; + U32 reserved8; + U32 reserved9; U32 LCA1; U32 LCA2; U32 LCB1; U32 LCB2; - - //U08 bloodFlowMeterDataPktCount; - //U08 bloodFlowMeterSlowPktCounts; - //U08 bloodFlowMeterDeviceStatus; - //U08 bloodFlowMeterResponse; - //F32 bloodFlowLast; - //U08 dialysateFlowMeterDataPktCount; - //U08 dialysateFlowMeterSlowPckCounts; - //U08 dialysateFlowMeterDeviceStatus; - //U08 dialysateFlowMeterResponse; - //F32 dialysateFlowLast; - - U08 bloodFlowMeterErrorCount; - U08 dialysateFlowMeterErrorCount; - U16 bloodOcclusionData; - U08 bloodOcclusionReadCount; - U08 bloodOcclusionErrorCount; - U16 dialysateInOcclusionData; - U08 dialysateInOcclusionReadCount; - U08 dialysateInOcclusionErrorCount; - U16 dialysateOutOcclusionData; - U08 dialysateOutOcclusionReadCount; - U08 dialysateOutOcclusionErrorCount; - U16 arterialPressureData; - U08 arterialPressureReadCount; - U08 arterialPressureErrorCount; - U16 dialysateTempPrimaryData; - U16 dialysateTempBackupData; } DG_FPGA_SENSORS_T; typedef struct // TODO - add all actuator set points to this structure per FPGA register map @@ -560,7 +550,7 @@ fpgaWriteCmdBuffer[ FPGA_WRITE_CMD_HDR_LEN + sizeof( FPGA_ACTUATORS_T ) + 1 ] = GET_LSB_OF_WORD( crc ); // construct bulk read command to read sensor data registers starting at address 8 fpgaReadCmdBuffer[ 0 ] = FPGA_READ_CMD_CODE; - fpgaReadCmdBuffer[ 1 ] = 0x08; // start at FPGA address 0x108 (264) + fpgaReadCmdBuffer[ 1 ] = 0x00; // start at FPGA address 0x100 (256) fpgaReadCmdBuffer[ 2 ] = 0x01; fpgaReadCmdBuffer[ 3 ] = sizeof(DG_FPGA_SENSORS_T); crc = crc16( fpgaReadCmdBuffer, FPGA_READ_CMD_HDR_LEN ); @@ -874,24 +864,10 @@ *************************************************************************/ U16 getFPGAStatus( void ) { - return fpgaHeader.fpgaStatus; + return fpgaSensorReadings.fpgaStatus; } /************************************************************************* - * @brief getFPGADiag - * The getFPGADiag function sets the diagnostic register of the FPGA. - * @details - * Inputs : fpgaHeader - * Outputs : none - * @param ctrl : value to write to diagnostic register - * @return none - *************************************************************************/ -void setFPGAControl( U16 ctrl ) -{ - fpgaHeader.fpgaControl = ctrl; -} - -/************************************************************************* * @brief getFPGALoadCellA1 * The getFPGALoadCellA1 function gets the latest load cell A 1 reading. * @details @@ -947,92 +923,7 @@ return fpgaSensorReadings.LCB2; } - /************************************************************************* - * @brief getFPGABloodPumpOcclusion - * The getFPGABloodPumpOcclusion function gets the latest blood occlusion reading. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none - * @param none - * @return last blood occlusion reading - *************************************************************************/ -U16 getFPGABloodPumpOcclusion( void ) -{ - return fpgaSensorReadings.bloodOcclusionData; -} - -/************************************************************************* - * @brief getFPGADialInPumpOcclusion - * The getFPGADialInPumpOcclusion function gets the latest dialysate \n - * inlet occlusion reading. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none - * @param none - * @return last dialysate inlet occlusion reading - *************************************************************************/ -U16 getFPGADialInPumpOcclusion( void ) -{ -#ifdef DEBUG_ENABLED -// { -// // TODO - temporary debug code - remove later -// char debugOccStr[ 60 ]; -// S32 dat = fpgaSensorReadings.dialysateInOcclusionData; -// S32 rct = fpgaSensorReadings.dialysateInOcclusionReadCount; -// S32 ect = fpgaSensorReadings.dialysateInOcclusionErrorCount; -// -// sprintf( debugOccStr, "Data %5d Reads %5d Errors %5d\n", dat, rct, ect ); -// sendDebugData( (U08*)debugOccStr, strlen(debugOccStr) ); -// } -#endif - return fpgaSensorReadings.dialysateInOcclusionData; -} - -/************************************************************************* - * @brief getFPGADialOutPumpOcclusion - * The getFPGADialOutPumpOcclusion function gets the latest dialysate \n - * outlet occlusion reading. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none - * @param none - * @return last dialysate outlet occlusion reading - *************************************************************************/ -U16 getFPGADialOutPumpOcclusion( void ) -{ - return fpgaSensorReadings.dialysateOutOcclusionData; -} - -/************************************************************************* - * @brief getFPGAArterialPressure - * The getFPGAArterialPressure function gets the latest arterial pressure reading. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none - * @param none - * @return last arterial pressure reading - *************************************************************************/ -U16 getFPGAArterialPressure( void ) -{ - return fpgaSensorReadings.arterialPressureData; -} - -/************************************************************************* - * @brief getFPGAVenousPressure - * The getFPGAVenousPressure function gets the venous arterial pressure reading. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none - * @param none - * @return last venous pressure reading - *************************************************************************/ -U16 getFPGAVenousPressure( void ) -{ - return 0; // TODO - return reading when available -} - -/************************************************************************* * @brief consumeUnexpectedData * The consumeUnexpectedData function checks to see if a byte is sitting in \n * the SCI2 received data register.