Index: firmware/App/Services/FPGA.c =================================================================== diff -u -rf068446fdb7889d320ddb6ffbd58f347ce0501e7 -r6d2d8f0267c57135554e5a1acaca9aef37f27949 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision f068446fdb7889d320ddb6ffbd58f347ce0501e7) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 6d2d8f0267c57135554e5a1acaca9aef37f27949) @@ -80,6 +80,43 @@ typedef struct // TODO - add all sensor readings to this structure per FPGA register map { + 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 sensor readings to this structure per FPGA register map +{ U08 bloodFlowMeterDataPktCount; U08 bloodFlowMeterSlowPktCounts; U08 bloodFlowMeterDeviceStatus; @@ -141,9 +178,9 @@ static g_dmaCTRL fpgaDMAReadRespControlRecord; // FPGA data -static FPGA_HEADER_T fpgaHeader; -static FPGA_SENSORS_T fpgaSensorReadings; -static FPGA_ACTUATORS_T fpgaActuatorSetPoints; +static FPGA_HEADER_T fpgaHeader; +static DG_FPGA_SENSORS_T fpgaSensorReadings; +static FPGA_ACTUATORS_T fpgaActuatorSetPoints; // ********** private function prototypes ********** @@ -177,7 +214,7 @@ { // initialize fpga data structures memset( &fpgaHeader, 0, sizeof(FPGA_HEADER_T) ); - memset( &fpgaSensorReadings, 0, sizeof(FPGA_SENSORS_T) ); + memset( &fpgaSensorReadings, 0, sizeof(DG_FPGA_SENSORS_T) ); memset( &fpgaActuatorSetPoints, 0, sizeof(FPGA_ACTUATORS_T) ); // initialize fpga comm buffers @@ -556,7 +593,7 @@ fpgaReadCmdBuffer[ 0 ] = FPGA_READ_CMD_CODE; fpgaReadCmdBuffer[ 1 ] = 0x08; // start at FPGA address 0x108 (264) fpgaReadCmdBuffer[ 2 ] = 0x01; - fpgaReadCmdBuffer[ 3 ] = sizeof(FPGA_SENSORS_T); + fpgaReadCmdBuffer[ 3 ] = sizeof(DG_FPGA_SENSORS_T); crc = crc16( fpgaReadCmdBuffer, FPGA_READ_CMD_HDR_LEN ); fpgaReadCmdBuffer[ 4 ] = GET_MSB_OF_WORD( crc ); fpgaReadCmdBuffer[ 5 ] = GET_LSB_OF_WORD( crc ); @@ -565,7 +602,7 @@ setupDMAForWriteResp( FPGA_WRITE_RSP_HDR_LEN + FPGA_CRC_LEN ); // 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( FPGA_SENSORS_T ) + FPGA_CRC_LEN ); + setupDMAForReadResp( FPGA_READ_RSP_HDR_LEN + sizeof( DG_FPGA_SENSORS_T ) + FPGA_CRC_LEN ); // set fpga comm flags for bulk write cmd and follow-up bulk read command fpgaWriteCommandInProgress = TRUE; fpgaBulkWriteAndReadInProgress = TRUE; @@ -602,7 +639,7 @@ // did FPGA Ack the read command? if ( fpgaReadResponseBuffer[ 0 ] == FPGA_READ_CMD_ACK ) { - U32 rspSize = FPGA_READ_RSP_HDR_LEN + sizeof(FPGA_SENSORS_T); + U32 rspSize = FPGA_READ_RSP_HDR_LEN + sizeof(DG_FPGA_SENSORS_T); U32 crcPos = rspSize; U16 crc = MAKE_WORD_OF_BYTES( fpgaReadResponseBuffer[ crcPos ], fpgaReadResponseBuffer[ crcPos + 1 ] ); @@ -611,7 +648,7 @@ { fpgaCommRetryCount = 0; // capture the read values - memcpy( &fpgaSensorReadings, &fpgaReadResponseBuffer[ FPGA_READ_RSP_HDR_LEN ], sizeof( FPGA_SENSORS_T ) ); + memcpy( &fpgaSensorReadings, &fpgaReadResponseBuffer[ FPGA_READ_RSP_HDR_LEN ], sizeof( DG_FPGA_SENSORS_T ) ); result = FPGA_STATE_WRITE_ALL_ACTUATORS; } else // bad CRC @@ -886,6 +923,62 @@ } /************************************************************************* + * @brief getFPGALoadCellA1 + * The getFPGALoadCellA1 function gets the latest load cell A 1 reading. + * @details + * Inputs : fpgaSensorReadings + * Outputs : none + * @param none + * @return last load cell A 1 reading + *************************************************************************/ +F32 getFPGALoadCellA1( void ) +{ + return fpgaSensorReadings.LCA1; +} + +/************************************************************************* + * @brief getFPGALoadCellA2 + * The getFPGALoadCellA2 function gets the latest load cell A 2 reading. + * @details + * Inputs : fpgaSensorReadings + * Outputs : none + * @param none + * @return last load cell A 2 reading + *************************************************************************/ +F32 getFPGALoadCellA2( void ) +{ + return fpgaSensorReadings.LCA2; +} + +/************************************************************************* + * @brief getFPGALoadCellB1 + * The getFPGALoadCellB1 function gets the latest load cell B 1 reading. + * @details + * Inputs : fpgaSensorReadings + * Outputs : none + * @param none + * @return last load cell B 1 reading + *************************************************************************/ +F32 getFPGALoadCellB1( void ) +{ + return fpgaSensorReadings.LCB1; +} + +/************************************************************************* + * @brief getFPGALoadCellB2 + * The getFPGALoadCellB2 function gets the latest load cell B 2 reading. + * @details + * Inputs : fpgaSensorReadings + * Outputs : none + * @param none + * @return last load cell B 2 reading + *************************************************************************/ +F32 getFPGALoadCellB2( void ) +{ + return fpgaSensorReadings.LCB2; +} + +/************************************************************************* * @brief getFPGABloodFlow * The getFPGABloodFlow function gets the latest blood flow reading. * @details