From c7530be768594bf30a93018caf178cef007aa14b Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Wed, 23 Dec 2015 11:16:20 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8634 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/STM32F4xx/USB_CDC/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'testhal/STM32/STM32F4xx/USB_CDC/main.c') diff --git a/testhal/STM32/STM32F4xx/USB_CDC/main.c b/testhal/STM32/STM32F4xx/USB_CDC/main.c index 37c0cfdc1..49c5a1b98 100644 --- a/testhal/STM32/STM32F4xx/USB_CDC/main.c +++ b/testhal/STM32/STM32F4xx/USB_CDC/main.c @@ -110,7 +110,15 @@ static void cmd_write(BaseSequentialStream *chp, int argc, char *argv[]) { } while (chnGetTimeout((BaseChannel *)chp, TIME_IMMEDIATE) == Q_TIMEOUT) { +#if 1 + /* Writing in stream mode.*/ chSequentialStreamWrite(&SDU1, buf, sizeof buf - 1); +#else + /* Writing in buffer mode.*/ + (void) obqGetEmptyBufferTimeout(&SDU1.obqueue, TIME_INFINITE); + memcpy(SDU1.obqueue.ptr, buf, 256); + obqPostFullBuffer(&SDU1.obqueue, 256); +#endif } chprintf(chp, "\r\n\nstopped\r\n"); } -- cgit v1.2.3