Index: App/Services/FPGA.c =================================================================== diff -u -r4e49b5f4036964295a7f8341a860023d319569cc -r1bd1ef307be5997209c42219d5be381bbeffabe4 --- App/Services/FPGA.c (.../FPGA.c) (revision 4e49b5f4036964295a7f8341a860023d319569cc) +++ App/Services/FPGA.c (.../FPGA.c) (revision 1bd1ef307be5997209c42219d5be381bbeffabe4) @@ -140,6 +140,8 @@ static void setupDMAForReadResp( U32 bytes2Receive ); static void startDMAReceiptOfReadResp( void ); +static void consumeUnexpectedData( void ); + /************************************************************************* * @brief initFPGA * The initFPGA function initializes the FPGA module. @@ -240,6 +242,9 @@ fpgaDMAReadRespControlRecord.ELSOFFSET = 0; // not used fpgaDMAReadRespControlRecord.FRDOFFSET = 0; // not used fpgaDMAReadRespControlRecord.FRSOFFSET = 0; // not used + + // there shouldn't be any data pending yet + consumeUnexpectedData(); } /************************************************************************* @@ -471,6 +476,9 @@ } + // shouldn't be any data received at this time + consumeUnexpectedData(); + return result; } @@ -562,6 +570,9 @@ // TODO - ??? } + // shouldn't be any data received at this time + consumeUnexpectedData(); + return result; } @@ -790,3 +801,24 @@ fpgaHeader.fpgaControl = ctrl; } +/************************************************************************* + * @brief consumeUnexpectedData + * The consumeUnexpectedData function checks to see if a byte is sitting in \n + * the SCI2 received data register. + * @details + * Inputs : fpgaHeader + * Outputs : none + * @param none + * @return fpgaDiag + *************************************************************************/ +static void consumeUnexpectedData( void ) +{ + // clear any errors + sciRxError( scilinREG ); + // if a byte is pending read, read it + if ( 0 != sciIsRxReady( scilinREG ) ) + { + sciReceiveByte( scilinREG ); + } +} + Index: App/Services/SystemCommMessages.c =================================================================== diff -u -r54ab19a7ac15f6ef2628c96661a7d6cc35ea12d0 -r1bd1ef307be5997209c42219d5be381bbeffabe4 --- App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 54ab19a7ac15f6ef2628c96661a7d6cc35ea12d0) +++ App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 1bd1ef307be5997209c42219d5be381bbeffabe4) @@ -151,6 +151,38 @@ /************************************************************************* + * @brief sendDebugData + * The sendDebugData function sends debug data out to the PC port. + * @details + * Inputs : none + * Outputs : PC serial port + * @param dbgData : Pointer to debug data + * @param len : # of bytes of debug data + * @return TRUE if debug data was successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendDebugData( U08 *dbgData, U32 len ) +{ + BOOL result; + MESSAGE_T msg; + U32 msgSize; + U08 data[sizeof(MESSAGE_WRAPPER_T)+1+CAN_MESSAGE_CARGO_SIZE]; // must hold full (wrapped) message + sync + any CAN padding + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = 2; + msg.hdr.cargoLen = len; + memcpy( msg.cargo, dbgData, len ); + + // serialize the message (w/ sync, CRC, and appropriate CAN padding) + msgSize = serializeMessage( msg, data ); + + // add serialized message data to appropriate comm buffer + result = addToCommBuffer( COMM_BUFFER_OUT_UART_PC, data, msgSize ); + + return result; +} + +/************************************************************************* * @brief isTestingActivated * The isTestingActivated function determines whether a tester has successfully \n * logged in to activate testing functionality. Index: App/Services/SystemCommMessages.h =================================================================== diff -u -rcda7aca3cdae3f3a2c2bcefc009f96a9bf6e4bdd -r1bd1ef307be5997209c42219d5be381bbeffabe4 --- App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision cda7aca3cdae3f3a2c2bcefc009f96a9bf6e4bdd) +++ App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 1bd1ef307be5997209c42219d5be381bbeffabe4) @@ -44,6 +44,9 @@ // *********** public test support message functions ********** +// DEBUG OUTPUT +BOOL sendDebugData( U08 *dbgData, U32 len ); + // MSG_TESTER_LOG_IN void handleTesterLogInRequest( MESSAGE_T *message ); BOOL isTestingActivated( void );