diff options
author | Bdale Garbee <bdale@gag.com> | 2013-05-16 00:36:23 -0600 |
---|---|---|
committer | Bdale Garbee <bdale@gag.com> | 2013-05-16 00:36:23 -0600 |
commit | 02d111b1b53ef01fc6e9ab6c4bc60b8af1be0067 (patch) | |
tree | 8356f4a019969ee99a45e264c87d38555cf316cc /src/cc1111/ao_usb.c | |
parent | 7a2e1f05adad990a6b161865267abf07ffec7a7e (diff) | |
parent | 7699a55aed3a9a7daeb4c6a5a9a280f43edf455f (diff) |
Merge branch 'branch-1.2' into debian
Diffstat (limited to 'src/cc1111/ao_usb.c')
-rw-r--r-- | src/cc1111/ao_usb.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/cc1111/ao_usb.c b/src/cc1111/ao_usb.c index ce26e808..8bd2efdf 100644 --- a/src/cc1111/ao_usb.c +++ b/src/cc1111/ao_usb.c @@ -382,10 +382,10 @@ ao_usb_putchar(char c) __critical __reentrant ao_usb_in_send(); } -char -ao_usb_pollchar(void) __critical +int +_ao_usb_pollchar(void) { - char c; + uint8_t c; if (ao_usb_out_bytes == 0) { USBINDEX = AO_USB_OUT_EP; if ((USBCSOL & USBCSOL_OUTPKT_RDY) == 0) @@ -407,12 +407,14 @@ ao_usb_pollchar(void) __critical } char -ao_usb_getchar(void) __critical +ao_usb_getchar(void) { - char c; + int c; - while ((c = ao_usb_pollchar()) == AO_READ_AGAIN) + ao_arch_block_interrupts(); + while ((c = _ao_usb_pollchar()) == AO_READ_AGAIN) ao_sleep(&ao_stdin_ready); + ao_arch_release_interrupts(); return c; } @@ -459,5 +461,5 @@ ao_usb_init(void) ao_usb_enable(); ao_add_task(&ao_usb_task, ao_usb_ep0, "usb"); - ao_add_stdio(ao_usb_pollchar, ao_usb_putchar, ao_usb_flush); + ao_add_stdio(_ao_usb_pollchar, ao_usb_putchar, ao_usb_flush); } |