diff options
Diffstat (limited to 'example-fs-bb48/usb-cdc.c')
-rw-r--r-- | example-fs-bb48/usb-cdc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/example-fs-bb48/usb-cdc.c b/example-fs-bb48/usb-cdc.c index afbaff3..c950362 100644 --- a/example-fs-bb48/usb-cdc.c +++ b/example-fs-bb48/usb-cdc.c @@ -735,10 +735,10 @@ check_tx (struct tty *t) } int -tty_send (struct tty *t, uint8_t *buf, int len) +tty_send (struct tty *t, const uint8_t *buf, int len) { int r; - uint8_t *p; + const uint8_t *p; int count; p = buf; @@ -767,6 +767,11 @@ tty_send (struct tty *t, uint8_t *buf, int len) count = len >= 64 ? 64 : len; } + /* Wait until all sent. */ + chopstx_mutex_lock (&t->mtx); + while ((r = check_tx (t)) == 0) + chopstx_cond_wait (&t->cnd, &t->mtx); + chopstx_mutex_unlock (&t->mtx); return r; } |