From dfe8c5f59d5ebe47496a99396127867a2455a31a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 13 Aug 2012 12:16:57 +0000 Subject: [PATCH] Added an "usbblast" command to the demo, any key stops it. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4563 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32F4xx/USB_CDC/main.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/testhal/STM32F4xx/USB_CDC/main.c b/testhal/STM32F4xx/USB_CDC/main.c index 02f7b4829..7c033e7eb 100644 --- a/testhal/STM32F4xx/USB_CDC/main.c +++ b/testhal/STM32F4xx/USB_CDC/main.c @@ -242,7 +242,7 @@ static const USBEndpointConfig ep1config = { 0x0000, &ep1instate, NULL, - 2, + 4, NULL }; @@ -394,10 +394,34 @@ static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) { chThdWait(tp); } +static void cmd_usbblast(BaseSequentialStream *chp, int argc, char *argv[]) { + static uint8_t buf[512] = + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"; + + (void)argv; + if (argc > 0) { + chprintf(chp, "Usage: test\r\n"); + return; + } + + while (chnGetTimeout((BaseChannel *)chp, TIME_IMMEDIATE) == Q_TIMEOUT) { + chSequentialStreamWrite(&SDU1, buf, sizeof buf); + } + chprintf(chp, "\r\n\nstopped\r\n"); +} + static const ShellCommand commands[] = { {"mem", cmd_mem}, {"threads", cmd_threads}, {"test", cmd_test}, + {"usbblast", cmd_usbblast}, {NULL, NULL} };