Use unlocked fifo calls (we are in a ISR).
authorbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 2 Oct 2009 19:09:36 +0000 (19:09 +0000)
committerbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 2 Oct 2009 19:09:36 +0000 (19:09 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3003 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/net/afsk.c

index 979848bf0a2c9f10d7156998e0f0e04e3647c59d..5792967bfe7ab5279a3148d874c06e9ddcb111d6 100644 (file)
@@ -171,13 +171,14 @@ static void hdlc_parse(bool bit)
        /* HDLC Flag */
        if (demod_bits == HDLC_FLAG)
        {
-               if (!fifo_isfull_locked(&rx_fifo))
+               if (!fifo_isfull(&rx_fifo))
                {
                        fifo_push(&rx_fifo, HDLC_FLAG);
                        hdlc_rxstart = true;
                }
                else
                        hdlc_rxstart = false;
+
                hdlc_currchar = 0;
                hdlc_bit_idx = 0;
                return;
@@ -205,12 +206,12 @@ static void hdlc_parse(bool bit)
                if ((hdlc_currchar == HDLC_FLAG
                        || hdlc_currchar == HDLC_RESET
                        || hdlc_currchar == AX25_ESC)
-                       && !fifo_isfull_locked(&rx_fifo))
+                       && !fifo_isfull(&rx_fifo))
                        fifo_push(&rx_fifo, AX25_ESC);
                else
                        hdlc_rxstart = false;
 
-               if (!fifo_isfull_locked(&rx_fifo))
+               if (!fifo_isfull(&rx_fifo))
                        fifo_push(&rx_fifo, hdlc_currchar);
                else
                        hdlc_rxstart = false;
@@ -430,7 +431,7 @@ static size_t afsk_read(UNUSED_ARG(KFile *, fd), void *_buf, size_t size)
                ticks_t start = timer_clock();
                #endif
 
-               do
+               while (fifo_isempty_locked(&rx_fifo));
                {
                        cpu_relax();
                        #if CONFIG_AFSK_RXTIMEOUT != -1
@@ -438,7 +439,6 @@ static size_t afsk_read(UNUSED_ARG(KFile *, fd), void *_buf, size_t size)
                                return buf - (uint8_t *)_buf;
                        #endif
                }
-               while (fifo_isempty_locked(&rx_fifo));
 
                *buf++ = fifo_pop_locked(&rx_fifo);
        }