summaryrefslogtreecommitdiff
path: root/ao_test.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2009-04-13 21:51:59 -0700
committerKeith Packard <keithp@keithp.com>2009-04-13 21:51:59 -0700
commitb56a44e48552bc32dbba9ff21770c370219a684a (patch)
tree00c759a9aea00333525312c76efe6ee9dc172945 /ao_test.c
parentcdaf3fc5802acf2ddc7972a15649ab0e1b31b873 (diff)
Fix USB input/output by reloading packet limits.
The USB controller is reset during the connection process, which clears the packet limits set in the controller at initialization time. Reload those values when the configuration is set. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao_test.c')
-rw-r--r--ao_test.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ao_test.c b/ao_test.c
index 9a8adc3d..5d50ab83 100644
--- a/ao_test.c
+++ b/ao_test.c
@@ -21,6 +21,7 @@ struct ao_task __xdata blink_0_task;
struct ao_task __xdata blink_1_task;
struct ao_task __xdata wakeup_task;
struct ao_task __xdata beep_task;
+struct ao_task __xdata echo_task;
void delay(int n) __reentrant
{
@@ -84,6 +85,19 @@ beep(void)
}
void
+echo(void)
+{
+ uint8_t c;
+ for (;;) {
+ c = ao_usb_getchar();
+ ao_usb_putchar(c);
+ if (c == '\r')
+ ao_usb_putchar('\n');
+ ao_usb_flush();
+ }
+}
+
+void
main(void)
{
CLKCON = 0;
@@ -94,5 +108,6 @@ main(void)
ao_add_task(&blink_1_task, blink_1);
ao_add_task(&wakeup_task, wakeup);
ao_add_task(&beep_task, beep);
+ ao_add_task(&echo_task, echo);
ao_start_scheduler();
}