diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2015-12-24 07:53:33 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2015-12-24 07:53:33 +0000 |
commit | 2296afaa34c8f4c19750a410e336b6f565918bcc (patch) | |
tree | 5867173aa747d12989d551a2eadf7c746c87160d /testhal/STM32/STM32F7xx/USB_CDC/main.c | |
parent | d9973ea126e8eb0a740312e70b8b41efe12f1112 (diff) | |
download | ChibiOS-2296afaa34c8f4c19750a410e336b6f565918bcc.tar.gz ChibiOS-2296afaa34c8f4c19750a410e336b6f565918bcc.tar.bz2 ChibiOS-2296afaa34c8f4c19750a410e336b6f565918bcc.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8637 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32/STM32F7xx/USB_CDC/main.c')
-rw-r--r-- | testhal/STM32/STM32F7xx/USB_CDC/main.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/testhal/STM32/STM32F7xx/USB_CDC/main.c b/testhal/STM32/STM32F7xx/USB_CDC/main.c index a2b393720..f2e56dedc 100644 --- a/testhal/STM32/STM32F7xx/USB_CDC/main.c +++ b/testhal/STM32/STM32F7xx/USB_CDC/main.c @@ -26,9 +26,6 @@ #include "usbcfg.h"
-/* Virtual serial port over USB.*/
-SerialUSBDriver SDU2;
-
/*===========================================================================*/
/* Command line related. */
/*===========================================================================*/
@@ -87,6 +84,7 @@ static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) { chThdWait(tp);
}
+/* Can be measured using dd if=/dev/xxxx of=/dev/null bs=512 count=10000.*/
static void cmd_write(BaseSequentialStream *chp, int argc, char *argv[]) {
static uint8_t buf[] =
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
@@ -113,7 +111,15 @@ static void cmd_write(BaseSequentialStream *chp, int argc, char *argv[]) { }
while (chnGetTimeout((BaseChannel *)chp, TIME_IMMEDIATE) == Q_TIMEOUT) {
- chSequentialStreamWrite(&SDU2, buf, sizeof buf - 1);
+#if 1
+ /* Writing in stream mode.*/
+ streamWrite(&SDU2, buf, sizeof buf - 1);
+#else
+ /* Writing in buffer mode.*/
+ (void) obqGetEmptyBufferTimeout(&SDU2.obqueue, TIME_INFINITE);
+ memcpy(SDU2.obqueue.ptr, buf, SERIAL_USB_BUFFERS_SIZE);
+ obqPostFullBuffer(&SDU2.obqueue, SERIAL_USB_BUFFERS_SIZE);
+#endif
}
chprintf(chp, "\r\n\nstopped\r\n");
}
|