FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/STM32_USB_CDC/trcStreamingPort.c
/* The WRITE function, used in trcStreamingPort.h */
The WRITE function, used in trcStreamingPort.h
The WRITE function used in trcStreamingPort . h
int32_t trcCDCTransmit(void* data, uint32_t size, int32_t * noOfBytesSent )
{
	static int fail_counter = 0;
	int32_t result;
	*noOfBytesSent = 0;
	result=CDC_Transmit_FS(data, size);
	if (result == USBD_OK)
	{
		fail_counter = 0;
		*noOfBytesSent = size;
		return 0;
	}
	else
	{
		fail_counter++;
		TRC_OS_DELAY( TRC_CFG_DELAY_ON_BUSY );
		if (fail_counter == 100)
		{
			return -1;
		}
	}
	return 0;
}
int32_t trcCDCTransmit ( void * data , uint32_t size , int32_t * noOfBytesSent ) { static int fail_counter = 0 ; int32_t result ; * noOfBytesSent = 0 ; result = CDC_Transmit_FS ( data , size ) ; if ( result == USBD_OK ) { fail_counter = 0 ; * noOfBytesSent = size ; return 0 ; } else { fail_counter ++ ; TRC_OS_DELAY ( TRC_CFG_DELAY_ON_BUSY ) ; if ( fail_counter == 100 ) { return -1 ; } } return 0 ; }
The WRITE function, used in trcStreamingPort.h
The WRITE function used in trcStreamingPort . h
/* We keep trying to send more data. If busy, we delay for a while. This function will be called again afterwards. */ /* If many unsuccessful attempts in a row, something is very wrong. Returning -1 will stop the recorder. */