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
master
gdisirio 2012-08-13 12:16:57 +00:00
parent b6b473a6a1
commit dfe8c5f59d
1 changed files with 25 additions and 1 deletions

View File

@ -242,7 +242,7 @@ static const USBEndpointConfig ep1config = {
0x0000, 0x0000,
&ep1instate, &ep1instate,
NULL, NULL,
2, 4,
NULL NULL
}; };
@ -394,10 +394,34 @@ static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) {
chThdWait(tp); 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[] = { static const ShellCommand commands[] = {
{"mem", cmd_mem}, {"mem", cmd_mem},
{"threads", cmd_threads}, {"threads", cmd_threads},
{"test", cmd_test}, {"test", cmd_test},
{"usbblast", cmd_usbblast},
{NULL, NULL} {NULL, NULL}
}; };