From 478c2332b74c3ee7dfd8d70873419cf0ef19619e Mon Sep 17 00:00:00 2001 From: Min Xu Date: Sat, 25 Oct 2014 22:04:30 +0200 Subject: Allow some USB interrupts to be handled during dbgu_append --- firmware/src/os/dbgu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/firmware/src/os/dbgu.c b/firmware/src/os/dbgu.c index d8bf8d1..72eaa88 100644 --- a/firmware/src/os/dbgu.c +++ b/firmware/src/os/dbgu.c @@ -55,7 +55,6 @@ #define DEBUG_BUFFER_SIZE (1 << 10) #define DEBUG_BUFFER_MASK (DEBUG_BUFFER_SIZE - 1) -#define USART_SYS_LEVEL 4 /*---------------------------- Global Variable ------------------------------*/ //*---------------------------------------------------------------------------- @@ -370,6 +369,9 @@ void dbgu_rb_append(char *data, int len) avail = (dbgu.out_head - 1 - dbgu.in_tail) & DEBUG_BUFFER_MASK; local_head = (unsigned)len; if (local_head > avail) { + local_irq_restore(intcFlags); + while ((AT91C_BASE_DBGU->DBGU_CSR & AT91C_US_TXBUFE) == 0); + local_irq_save(intcFlags); while ((AT91C_BASE_DBGU->DBGU_CSR & AT91C_US_TXBUFE) == 0); dbgu.out_head = dbgu.out_tail; avail = (dbgu.out_head - 1 - dbgu.in_tail) & DEBUG_BUFFER_MASK; -- cgit v1.2.3