Index: firmware/App/Drivers/PinchValve.c =================================================================== diff -u -r6d2e13dfca9285909eddd958ca82bf3da1157412 -r2c9f7442169ce34dd4a2fffe91e293efab255826 --- firmware/App/Drivers/PinchValve.c (.../PinchValve.c) (revision 6d2e13dfca9285909eddd958ca82bf3da1157412) +++ firmware/App/Drivers/PinchValve.c (.../PinchValve.c) (revision 2c9f7442169ce34dd4a2fffe91e293efab255826) @@ -249,7 +249,7 @@ // ********** private function prototypes ********** // Low level command state machine handlers -static PINCH_VALVE_CMD_STATE_T handlePinchValveCmdIdleState( VALVE_T valve ); +static PINCH_VALVE_CMD_STATE_T handlePinchValveCmdIdleState( void ); static PINCH_VALVE_CMD_STATE_T handlePinchValveCmdSetCmdState( VALVE_T valve ); static PINCH_VALVE_CMD_STATE_T handlePinchValveCmdXmitCmdState( VALVE_T valve ); static PINCH_VALVE_CMD_STATE_T handlePinchValveCmdWaitDoneState( VALVE_T valve ); @@ -368,7 +368,7 @@ * The execPinchValveCommand function executes the low level FPGA command * state machine. * @details \b Inputs: commandState[] -* @details \b Outputs: commandState[] +* @details \b Outputs: commandFailed [] * @return current state (sub-mode) *************************************************************************/ void execPinchValveCommand( void ) @@ -380,7 +380,7 @@ switch ( commandState[ valve ] ) { case PINCH_VALVE_CMD_IDLE_STATE: - commandState[ valve ] = handlePinchValveCmdIdleState( valve ); + commandState[ valve ] = handlePinchValveCmdIdleState(); break; case PINCH_VALVE_CMD_SET_CMD_STATE: @@ -419,7 +419,7 @@ * The execPinchValveFunction function executes the pinch valve * homing and position command sequence state machine. * @details \b Inputs: functionState[] -* @details \b Outputs: functionState[] +* @details \b Outputs: commandFailed[] * @return current state (sub-mode) *************************************************************************/ void execPinchValveFunction( void ) @@ -459,10 +459,8 @@ * @param valve H1_VALV or H19_VALV. * @return next Pinch Valve command state machine. *************************************************************************/ -static PINCH_VALVE_CMD_STATE_T handlePinchValveCmdIdleState( VALVE_T valve ) +static PINCH_VALVE_CMD_STATE_T handlePinchValveCmdIdleState( void ) { - ( void )valve; - return PINCH_VALVE_CMD_IDLE_STATE; } @@ -567,7 +565,7 @@ *************************************************************************/ static PINCH_VALVE_CMD_STATE_T handlePinchValveCmdReadWordsState( VALVE_T valve ) { - PINCH_VALVE_CMD_STATE_T nextState; + PINCH_VALVE_CMD_STATE_T nextState = PINCH_VALVE_CMD_READ_WORDS_STATE; if ( ( TRUE == didPinchValveErrorCountChange( valve ) ) || ( TRUE == isPinchValveControllerFaultActive( valve ) ) || @@ -632,7 +630,7 @@ * h19HomingCommands[], positionCommands[] * @details \b Outputs: pendingValvePositionRequest[], homingInProgress[], positionInProgress[], * activeCommandArray[], activeCommandCount[], activeCommandIndex[], -* commandFailed[], positionCommands[] +* commandFailed[], positionCommands[], pendingValveHomeRequest[] * @param valve H1_VALV or H19_VALV. * @return next Pinch Valve function state machine *************************************************************************/ @@ -692,7 +690,7 @@ * in the active homing or position sequence. * @details \b Inputs: valve, activeCommandArray[], activeCommandCount[], * activeCommandIndex[], commandState[] -* @details \b Outputs: commandFailed[], activeCommand[], commandState[] +* @details \b Outputs: commandFailed[], activeCommand[] * @param valve H1_VALV or H19_VALV. * @return next Pinch Valve function state machine. *************************************************************************/ @@ -770,9 +768,9 @@ * @brief * The homePinchValve function requests the homing command sequence for the * selected pinch valve. -* @details \b Inputs: valve, pendingValveHomeRequest[], +* @details \b Inputs: none +* @details \b Outputs: commandFailed[], pendingValveHomeRequest[], * pendingValvePositionRequest[] -* @details \b Outputs: commandFailed[], enableResetValue[] * @param valve H1_VALV or H19_VALV. * @return TRUE if the homing request is accepted, FALSE otherwise. *************************************************************************/ @@ -796,8 +794,7 @@ * @brief * The setPinchValvePosition function requests movement to the selected * stored pinch valve position. -* @details \b Inputs: valve, position, pendingValveHomeRequest[], -* pendingValvePositionRequest[], valvePositions[] +* @details \b Inputs: none * @details \b Outputs: pendingValvePosition[], * pendingValvePositionRequest[], pendingValveHomeRequest[], * commandFailed[] @@ -846,8 +843,8 @@ * @brief * The setPinchValveEnableReset function sets the enable and reset * register for the selected valve. -* @details \b Inputs: valve, enable, reset -* @details \b Outputs: enableResetValue[] +* @details \b Inputs: none +* @details \b Outputs: none * @param valve H1_VALV or H19_VALV. * @param enable TRUE to enable the pinch valve controller. * @param reset TRUE to assert the pinch valve controller reset. @@ -918,7 +915,7 @@ * @brief * The isPinchValveHomed function checks whether homed valve positions have * been stored for the selected pinch valve. -* @details \b Inputs: valve, valvePositions[] +* @details \b Inputs: valvePositions[] * @details \b Outputs: none * @param valve H1_VALV or H19_VALV. * @return TRUE if the selected valve has a stored Position A, FALSE otherwise. @@ -939,7 +936,7 @@ * @brief * The getPinchValveStoredPosition function returns the stored encoder count * for the selected pinch valve position. -* @details \b Inputs: valve, position, valvePositions[] +* @details \b Inputs: position, valvePositions[] * @details \b Outputs: none * @param valve H1_VALV or H19_VALV. * @param position Stored valve position to read. @@ -987,7 +984,7 @@ * @details \b Outputs: activeCommand[], commandOutputWord1[], * commandOutputWord2[], commandOutputWord3[], commandSpiStatus[], * commandErrorCount[], commandFailed[], commandState[] -* @param valve H1_VALV or H19_VALV.. +* @param valve H1_VALV or H19_VALV. * @param command Pinch valve command to execute * @return TRUE if the command is accepted, FALSE otherwise.. *************************************************************************/ @@ -1021,8 +1018,9 @@ * @brief * The writePinchValveCommandRegisters function writes the active command * header, input words and FPGA command byte. -* @details \b Inputs: valve, activeCommand[] -* @details \b Outputs: fpgaCommandValue[] +* @details \b Inputs: fpgaCommandValue[] +* @details \b Outputs: none +* @param valve H1_VALV or H19_VALV. * @return TRUE if the command registers are written, FALSE otherwise. *************************************************************************/ static BOOL writePinchValveCommandRegisters( VALVE_T valve ) @@ -1299,13 +1297,14 @@ * The isPinchValveCommandDone function checks the SPI command done bit. * @details \b Inputs: commandSpiStatus[] * @details \b Outputs: none +* @param valve H1_VALV or H19_VALV. * @return TRUE if the command done bit is set, FALSE otherwise. *************************************************************************/ static BOOL isPinchValveCommandDone( VALVE_T valve ) { BOOL result; - result = ( ( commandSpiStatus[ valve ] & PINCH_VALVE_SPI_DONE_BIT_MASK ) != 0 ); + result = ( 0 != ( commandSpiStatus[ valve ] & PINCH_VALVE_SPI_DONE_BIT_MASK ) ) ? TRUE : FALSE; return result; } @@ -1316,13 +1315,15 @@ * status bit. * @details \b Inputs: commandSpiStatus[] * @details \b Outputs: none +* @param valve H1_VALV or H19_VALV. * @return TRUE if the controller fault bit is set, FALSE otherwise *************************************************************************/ static BOOL isPinchValveControllerFaultActive( VALVE_T valve ) { BOOL result; - result = ( ( commandSpiStatus[ valve ] & PINCH_VALVE_SPI_CONTROLLER_FAULT_BIT_MASK ) != 0 ); + result = ( ( commandSpiStatus[ valve ] & PINCH_VALVE_SPI_CONTROLLER_FAULT_BIT_MASK ) != 0 ) + ? TRUE : FALSE; return result; } @@ -1333,13 +1334,14 @@ * error count changed during the active transaction. * @details \b Inputs: commandErrorCount[] * @details \b Outputs: none +* @param valve H1_VALV or H19_VALV. * @return TRUE if the error count changed, FALSE otherwise. *************************************************************************/ static BOOL didPinchValveErrorCountChange( VALVE_T valve ) { BOOL result; - result = ( commandErrorCount[ valve ] != errorCountAtCommandStart[ valve ] ); + result = ( commandErrorCount[ valve ] != errorCountAtCommandStart[ valve ] ) ? TRUE : FALSE; return result; } @@ -1430,7 +1432,9 @@ } else { - receivedCount = (U08)( ( commandSpiStatus[ valve ] & PINCH_VALVE_SPI_RX_COUNT_MASK ) >> PINCH_VALVE_SPI_RX_COUNT_SHIFT ); + receivedCount = (U08)( ( commandSpiStatus[ valve ] & + PINCH_VALVE_SPI_RX_COUNT_MASK ) >> + PINCH_VALVE_SPI_RX_COUNT_SHIFT ); if ( receivedCount == activeCommand[ valve ].outputWordCount ) { @@ -1459,7 +1463,7 @@ { BOOL result; - result = ( ( H1_VALV == valve ) || ( H19_VALV == valve ) ); + result = ( ( H1_VALV == valve ) || ( H19_VALV == valve ) ) ? TRUE : FALSE; return result; } @@ -1545,7 +1549,7 @@ * words into a signed 32 bit value. * @details \b Inputs: valve, commandOutputWord1[], commandOutputWord2[] * @details \b Outputs: none -* * @param valve H1_VALV or H19_VALV. +* @param valve H1_VALV or H19_VALV. * @return Signed 32 bit command output value. *************************************************************************/ static S32 getSigned32OutputValue( VALVE_T valve ) @@ -1650,7 +1654,7 @@ { BOOL result; - result = ( 0 != ( status & PINCH_VALVE_EVENT_MOTION_COMPLETE_MASK ) ); + result = ( 0 != ( status & PINCH_VALVE_EVENT_MOTION_COMPLETE_MASK ) ) ? TRUE : FALSE; return result; } @@ -1668,7 +1672,7 @@ { BOOL result; - result = ( 0 != ( status & PINCH_VALVE_EVENT_MOTION_ERROR_MASK ) ); + result = ( 0 != ( status & PINCH_VALVE_EVENT_MOTION_ERROR_MASK ) ) ? TRUE : FALSE; return result; }