diff options
Diffstat (limited to 'openpicc/os/usb')
-rw-r--r-- | openpicc/os/usb/USB-CDC.c | 13 | ||||
-rw-r--r-- | openpicc/os/usb/USB-CDC.h | 1 |
2 files changed, 11 insertions, 3 deletions
diff --git a/openpicc/os/usb/USB-CDC.c b/openpicc/os/usb/USB-CDC.c index 1b840c9..c005597 100644 --- a/openpicc/os/usb/USB-CDC.c +++ b/openpicc/os/usb/USB-CDC.c @@ -123,7 +123,7 @@ transmitted. Rx queue must be larger than FIFO size. */ static xQueueHandle xRxCDC; static xQueueHandle xTxCDC; -#define CHUNK_SIZE 8 +#define CHUNK_SIZE 9 /* Line coding - 115,200 baud, N-8-1 */ static const unsigned portCHAR pxLineCoding[] = @@ -277,7 +277,7 @@ vUSBSendByte_blocking (portCHAR cByte, portTickType xTicksToWait) #define MIN(a,b) ((a)>(b)?(b):(a)) void -vUSBSendBuffer (unsigned char *buffer, portBASE_TYPE offset, portBASE_TYPE length) +vUSBSendBuffer_blocking (unsigned char *buffer, portBASE_TYPE offset, portBASE_TYPE length, portTickType xTicksToWait) { unsigned char chunk[CHUNK_SIZE]; while(length > 0) { @@ -285,12 +285,19 @@ vUSBSendBuffer (unsigned char *buffer, portBASE_TYPE offset, portBASE_TYPE lengt chunk[0] = next_size; memcpy(chunk+1, buffer+offset, next_size); /* Queue the bytes to be sent. The USB task will send it. */ - xQueueSend (xTxCDC, &chunk, usbNO_BLOCK); + xQueueSend (xTxCDC, &chunk, xTicksToWait); length -= next_size; offset += next_size; } } +void +vUSBSendBuffer (unsigned char *buffer, portBASE_TYPE offset, portBASE_TYPE length) +{ + vUSBSendBuffer_blocking(buffer, offset, length, usbNO_BLOCK); +} + + /*------------------------------------------------------------*/ portLONG diff --git a/openpicc/os/usb/USB-CDC.h b/openpicc/os/usb/USB-CDC.h index 6074956..6c0a779 100644 --- a/openpicc/os/usb/USB-CDC.h +++ b/openpicc/os/usb/USB-CDC.h @@ -84,6 +84,7 @@ sent unless the port is connected. */ void vUSBSendByte (portCHAR cByte); void vUSBSendByte_blocking (portCHAR cByte, portTickType xTicksToWait); void vUSBSendBuffer (unsigned char *buffer, portBASE_TYPE offset, portBASE_TYPE length); +void vUSBSendBuffer_blocking (unsigned char *buffer, portBASE_TYPE offset, portBASE_TYPE length, portTickType xTicksToWait); portLONG vUSBRecvByte (portCHAR *cByte,portLONG size, portTickType xTicksToWait); #endif |