Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -rf05acb2d013aa3dec1b59d793b8876aed928b5aa -r87d705fcf977af12b7b034735fa5867f2daea2b9 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision f05acb2d013aa3dec1b59d793b8876aed928b5aa) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 87d705fcf977af12b7b034735fa5867f2daea2b9) @@ -609,12 +609,16 @@ // Verify tester has logged in with TD if ( TRUE == isTestingActivated() ) { - VALVE_PINCH_SET_CMD_PAYLOAD_T payload; - - memcpy( &payload, message->payload, sizeof(VALVE_PINCH_SET_CMD_PAYLOAD_T) ); - if ( ( (VALVE_T)payload.valve < NUM_OF_VALVES ) && ( (VALVE_POSITION_T)payload.pos < NUM_OF_VALVE_POSITIONS ) ) + // Verify payload length is valid + if ( sizeof( VALVE_PINCH_SET_CMD_PAYLOAD_T ) == message->hdr.payloadLen ) { - result = setValvePosition( (VALVE_T)payload.valve, (VALVE_POSITION_T)payload.pos ); + VALVE_PINCH_SET_CMD_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof(VALVE_PINCH_SET_CMD_PAYLOAD_T) ); + if ( ( (VALVE_T)payload.valve < NUM_OF_VALVES ) && ( (VALVE_POSITION_T)payload.pos < NUM_OF_VALVE_POSITIONS ) ) + { + result = setValvePosition( (VALVE_T)payload.valve, (VALVE_POSITION_T)payload.pos ); + } } } @@ -637,12 +641,16 @@ // Verify tester has logged in with TD if ( TRUE == isTestingActivated() ) { - VALVE_PINCH_HOME_CMD_PAYLOAD_T payload; - - memcpy( &payload, message->payload, sizeof(VALVE_PINCH_HOME_CMD_PAYLOAD_T) ); - if ( (VALVE_T)payload.valve < NUM_OF_VALVES ) + // Verify payload length is valid + if ( sizeof( VALVE_PINCH_HOME_CMD_PAYLOAD_T ) == message->hdr.payloadLen ) { - result = homeValve( (VALVE_T)payload.valve, payload.force, payload.tubing ); + VALVE_PINCH_HOME_CMD_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof(VALVE_PINCH_HOME_CMD_PAYLOAD_T) ); + if ( (VALVE_T)payload.valve < NUM_OF_VALVES ) + { + result = homeValve( (VALVE_T)payload.valve, payload.force, payload.tubing ); + } } } Index: firmware/App/Drivers/GLXferPump.c =================================================================== diff -u -rd9b5f588d81e15ed3849222bed3362e15dbf4b0a -r87d705fcf977af12b7b034735fa5867f2daea2b9 --- firmware/App/Drivers/GLXferPump.c (.../GLXferPump.c) (revision d9b5f588d81e15ed3849222bed3362e15dbf4b0a) +++ firmware/App/Drivers/GLXferPump.c (.../GLXferPump.c) (revision 87d705fcf977af12b7b034735fa5867f2daea2b9) @@ -109,13 +109,17 @@ // Verify tester has logged in with TD and override type is valid if ( TRUE == isTestingActivated() ) { - U32 state; - - memcpy( &state, message->payload, sizeof(U32) ); - if ( state < NUM_OF_AIR_PUMP_MOTOR_STATES ) + // Verify payload length is valid + if ( sizeof( U32 ) == message->hdr.payloadLen ) { - setAirPumpMotorState( (AIR_PUMP_MOTOR_STATE_T)state ); - result = TRUE; + U32 state; + + memcpy( &state, message->payload, sizeof(U32) ); + if ( state < NUM_OF_AIR_PUMP_MOTOR_STATES ) + { + setAirPumpMotorState( (AIR_PUMP_MOTOR_STATE_T)state ); + result = TRUE; + } } } Index: firmware/App/Drivers/PeristalticPump.c =================================================================== diff -u -rd9b5f588d81e15ed3849222bed3362e15dbf4b0a -r87d705fcf977af12b7b034735fa5867f2daea2b9 --- firmware/App/Drivers/PeristalticPump.c (.../PeristalticPump.c) (revision d9b5f588d81e15ed3849222bed3362e15dbf4b0a) +++ firmware/App/Drivers/PeristalticPump.c (.../PeristalticPump.c) (revision 87d705fcf977af12b7b034735fa5867f2daea2b9) @@ -42,7 +42,7 @@ * The initPeristalticPumpDriver function initializes the peristaltic pump * driver unit. * @details \b Inputs: none - * @details \b Outputs: currentAirPumpMotorState + * @details \b Outputs: Peristaltic pump driver unit initialized. * @return none *************************************************************************/ void initPeristalticPumpDriver(void) @@ -54,10 +54,10 @@ pumpMeasSpeedRPM.ovInitData = 0; pumpMeasSpeedRPM.override = OVERRIDE_RESET; - setBloodPumpDirection( MOTOR_DIR_FORWARD ); - resetBloodPumpHomeRequest(); - setBloodPumpSetSpeed( 0 ); - setBloodPumpEnabled( TRUE ); + setBPDirection( MOTOR_DIR_FORWARD ); + resetBPHomeRequest(); + setBPSetSpeed( 0 ); + setBPEnabled( TRUE ); } /*********************************************************************//** @@ -75,18 +75,18 @@ // update measured pump speed if ( pumpSetSpeedRPM < 0 ) { - pumpMeasSpeedRPM.data = (S32)( (S16)getBloodPumpSpeed() * -1 ); + pumpMeasSpeedRPM.data = (S32)( (S16)getBPSpeed() * -1 ); } else { - pumpMeasSpeedRPM.data = (S32)( (S16)getBloodPumpSpeed() ); + pumpMeasSpeedRPM.data = (S32)( (S16)getBPSpeed() ); } // clear home command if previously requested if ( TRUE == pumpHomeRequested ) { pumpHomeRequested = FALSE; - resetBloodPumpHomeRequest(); + resetBPHomeRequest(); } } @@ -100,7 +100,7 @@ void cmdPeristalticPumpHome( void ) { pumpHomeRequested = TRUE; - homeBloodPump(); + homeBP(); } /*********************************************************************//** @@ -128,8 +128,8 @@ dir = MOTOR_DIR_REVERSE; } pumpSetSpeedRPM = rpm; - setBloodPumpDirection( dir ); - setBloodPumpSetSpeed( setRpm ); + setBPDirection( dir ); + setBPSetSpeed( setRpm ); result = TRUE; } else @@ -198,10 +198,14 @@ // Verify tester has logged in with TD and override type is valid if ( TRUE == isTestingActivated() ) { - S32 speed; + // Verify payload length is valid + if ( sizeof( S32 ) == message->hdr.payloadLen ) + { + S32 speed; - memcpy( &speed, message->payload, sizeof(S32) ); - result = setPeristalticPumpSetSpeed( (S16)speed ); + memcpy( &speed, message->payload, sizeof(S32) ); + result = setPeristalticPumpSetSpeed( (S16)speed ); + } } return result; Index: firmware/App/Drivers/RotaryValve.c =================================================================== diff -u -rd9b5f588d81e15ed3849222bed3362e15dbf4b0a -r87d705fcf977af12b7b034735fa5867f2daea2b9 --- firmware/App/Drivers/RotaryValve.c (.../RotaryValve.c) (revision d9b5f588d81e15ed3849222bed3362e15dbf4b0a) +++ firmware/App/Drivers/RotaryValve.c (.../RotaryValve.c) (revision 87d705fcf977af12b7b034735fa5867f2daea2b9) @@ -341,21 +341,25 @@ // Verify tester has logged in with TD if ( TRUE == isTestingActivated() ) { - VALVE_ROTARY_SET_CMD_PAYLOAD_T payload; - - memcpy( &payload, message->payload, sizeof(VALVE_ROTARY_SET_CMD_PAYLOAD_T) ); - if ( payload.valve < NUM_OF_VALVES ) + // Verify payload length is valid + if ( sizeof( VALVE_ROTARY_SET_CMD_PAYLOAD_T ) == message->hdr.payloadLen ) { - MOTOR_DIR_T dir = MOTOR_DIR_FORWARD; - U16 mag; + VALVE_ROTARY_SET_CMD_PAYLOAD_T payload; - if ( payload.stepChange < 0 ) + memcpy( &payload, message->payload, sizeof(VALVE_ROTARY_SET_CMD_PAYLOAD_T) ); + if ( payload.valve < NUM_OF_VALVES ) { - dir = MOTOR_DIR_REVERSE; + MOTOR_DIR_T dir = MOTOR_DIR_FORWARD; + U16 mag; + + if ( payload.stepChange < 0 ) + { + dir = MOTOR_DIR_REVERSE; + } + mag = (U16)( abs( payload.stepChange ) ); + setValveCmdChangePosition( (VALVE_T)payload.valve, mag, dir ); + result = TRUE; } - mag = (U16)( abs( payload.stepChange ) ); - setValveCmdChangePosition( (VALVE_T)payload.valve, mag, dir ); - result = TRUE; } } Index: firmware/App/Drivers/Valve2Way.c =================================================================== diff -u -rd9b5f588d81e15ed3849222bed3362e15dbf4b0a -r87d705fcf977af12b7b034735fa5867f2daea2b9 --- firmware/App/Drivers/Valve2Way.c (.../Valve2Way.c) (revision d9b5f588d81e15ed3849222bed3362e15dbf4b0a) +++ firmware/App/Drivers/Valve2Way.c (.../Valve2Way.c) (revision 87d705fcf977af12b7b034735fa5867f2daea2b9) @@ -134,13 +134,17 @@ // Verify tester has logged in with TD if ( TRUE == isTestingActivated() ) { - VALVE_2_WAY_SET_CMD_PAYLOAD_T payload; - - memcpy( &payload, message->payload, sizeof(VALVE_2_WAY_SET_CMD_PAYLOAD_T) ); - if ( ( (VALVE_2_WAY_T)payload.valve < NUM_OF_2_WAY_VALVES ) && ( (OPN_CLS_STATE_T)payload.state < NUM_OF_OPN_CLS_STATES ) ) + // Verify payload length is valid + if ( sizeof( VALVE_2_WAY_SET_CMD_PAYLOAD_T ) == message->hdr.payloadLen ) { - set2WayValveState( (VALVE_2_WAY_T)payload.valve, (OPN_CLS_STATE_T)payload.state ); - result = TRUE; + VALVE_2_WAY_SET_CMD_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof(VALVE_2_WAY_SET_CMD_PAYLOAD_T) ); + if ( ( (VALVE_2_WAY_T)payload.valve < NUM_OF_2_WAY_VALVES ) && ( (OPN_CLS_STATE_T)payload.state < NUM_OF_OPN_CLS_STATES ) ) + { + set2WayValveState( (VALVE_2_WAY_T)payload.valve, (OPN_CLS_STATE_T)payload.state ); + result = TRUE; + } } } Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -rd9b5f588d81e15ed3849222bed3362e15dbf4b0a -r87d705fcf977af12b7b034735fa5867f2daea2b9 --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision d9b5f588d81e15ed3849222bed3362e15dbf4b0a) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 87d705fcf977af12b7b034735fa5867f2daea2b9) @@ -413,14 +413,14 @@ /*********************************************************************//** * @brief - * The setBloodPumpEnabled function enables or disables the blood pump per + * The setBPEnabled function enables or disables the blood pump per * the given flag. * @details \b Inputs: none * @details \b Outputs: Blood pump enabled or disabled (bit 0 of BP control register) * @param enable TRUE if BP enable is requested, FALSE if BP disable is requested * @return none *************************************************************************/ -void setBloodPumpEnabled( BOOL enable ) +void setBPEnabled( BOOL enable ) { if ( TRUE == enable ) { @@ -434,7 +434,7 @@ /*********************************************************************//** * @brief - * The setBloodPumpDirection function sets the direction for the blood pump + * The setBPDirection function sets the direction for the blood pump * motor to the given direction. * @details \b Inputs: none * @details \b Outputs: Blood pump motor direction is set (bit 1 of BP control register). @@ -443,7 +443,7 @@ * @param dir the desired direction for the blood pump motor (fwd or rev) * @return none *************************************************************************/ -void setBloodPumpDirection( MOTOR_DIR_T dir ) +void setBPDirection( MOTOR_DIR_T dir ) { if ( MOTOR_DIR_REVERSE == dir ) { @@ -457,55 +457,55 @@ /*********************************************************************//** * @brief - * The homeBloodPump function sets the bit requesting that the blood pump + * The homeBP function sets the bit requesting that the blood pump * be homed. * @details \b Inputs: none * @details \b Outputs: BP home request is set (bit 2 of BP control register). * @return none *************************************************************************/ -void homeBloodPump( void ) +void homeBP( void ) { fpgaActuatorSetPoints.BPControl |= FPGA_BP_HOME_BIT_MASK; } /*********************************************************************//** * @brief - * The resetBloodPumpHomeRequest function resets the fpga blood pump home + * The resetBPHomeRequest function resets the fpga blood pump home * request. * @note This function should be called after request is made and transmission * to FPGA is complete. * @details \b Inputs: none * @details \b Outputs: BP home request is cleared (bit 2 of BP control register) * @return none *************************************************************************/ -void resetBloodPumpHomeRequest( void ) +void resetBPHomeRequest( void ) { fpgaActuatorSetPoints.BPControl &= ~((U08)FPGA_BP_HOME_BIT_MASK); } /*********************************************************************//** * @brief - * The setBloodPumpSetSpeed function sets the fpga blood pump set speed + * The setBPSetSpeed function sets the fpga blood pump set speed * to the given speed (0..3000 RPM). * @details \b Inputs: none * @details \b Outputs: BP set speed is set * @param rpm the set point for the BP speed (in RPM). * @return none *************************************************************************/ -void setBloodPumpSetSpeed( U16 rpm ) +void setBPSetSpeed( U16 rpm ) { fpgaActuatorSetPoints.BPSetSpeed = rpm; } /*********************************************************************//** * @brief - * The getBloodPumpSpeed function gets the latest blood pump speed (in RPM) + * The getBPSpeed function gets the latest blood pump speed (in RPM) * from the FPGA. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none * @return Latest blood pump speed. *************************************************************************/ -U16 getBloodPumpSpeed( void ) +U16 getBPSpeed( void ) { return fpgaSensorReadings.BPSpeed; } Index: firmware/App/Services/FpgaTD.h =================================================================== diff -u -rd9b5f588d81e15ed3849222bed3362e15dbf4b0a -r87d705fcf977af12b7b034735fa5867f2daea2b9 --- firmware/App/Services/FpgaTD.h (.../FpgaTD.h) (revision d9b5f588d81e15ed3849222bed3362e15dbf4b0a) +++ firmware/App/Services/FpgaTD.h (.../FpgaTD.h) (revision 87d705fcf977af12b7b034735fa5867f2daea2b9) @@ -54,12 +54,12 @@ void setAlarmAudioState( U32 state, U32 volumeLevel, U32 volumeDivider ); -void setBloodPumpEnabled( BOOL enable ); -void setBloodPumpDirection( MOTOR_DIR_T dir ); -void homeBloodPump( void ); -void resetBloodPumpHomeRequest( void ); -void setBloodPumpSetSpeed( U16 rpm ); -U16 getBloodPumpSpeed( void ); +void setBPEnabled( BOOL enable ); +void setBPDirection( MOTOR_DIR_T dir ); +void homeBP( void ); +void resetBPHomeRequest( void ); +void setBPSetSpeed( U16 rpm ); +U16 getBPSpeed( void ); U16 getBloodPumpHallSensorCount( void ); U08 getBloodPumpHallSensorStatus( void );