Remove HDLC constants; add irq end handling; Add strobe init.
authorbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 1 Oct 2009 13:20:08 +0000 (13:20 +0000)
committerbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 1 Oct 2009 13:20:08 +0000 (13:20 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2997 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/net/afsk.c
bertos/net/afsk.h

index c73cf8585a47aa0e218605c33a2112268f57a5b6..979848bf0a2c9f10d7156998e0f0e04e3647c59d 100644 (file)
@@ -37,6 +37,8 @@
  */
 
 #include "afsk.h"
+#include <net/ax25.h>
+
 #include "cfg/cfg_afsk.h"
 #include "hw/hw_afsk.h"
 
@@ -202,9 +204,9 @@ static void hdlc_parse(bool bit)
        {
                if ((hdlc_currchar == HDLC_FLAG
                        || hdlc_currchar == HDLC_RESET
-                       || hdlc_currchar == AFSK_ESC)
+                       || hdlc_currchar == AX25_ESC)
                        && !fifo_isfull_locked(&rx_fifo))
-                       fifo_push(&rx_fifo, AFSK_ESC);
+                       fifo_push(&rx_fifo, AX25_ESC);
                else
                        hdlc_rxstart = false;
 
@@ -292,7 +294,9 @@ DEFINE_AFSK_ADC_ISR()
                hdlc_parse(!EDGE_FOUND(found_bits));
        }
 
+
        AFSK_STROBE_OFF();
+       AFSK_ADC_IRQ_END();
 }
 
 /* True while modem sends data */
@@ -326,6 +330,7 @@ DEFINE_AFSK_DAC_ISR()
                        {
                                AFSK_DAC_IRQ_STOP();
                                sending = false;
+                               AFSK_DAC_IRQ_END();
                                return;
                        }
                        else
@@ -341,12 +346,13 @@ DEFINE_AFSK_DAC_ISR()
                                curr_out = fifo_pop(&tx_fifo);
 
                                /* Handle char escape */
-                               if (curr_out == AFSK_ESC)
+                               if (curr_out == AX25_ESC)
                                {
                                        if (fifo_isempty(&tx_fifo))
                                        {
                                                AFSK_DAC_IRQ_STOP();
                                                sending = false;
+                                               AFSK_DAC_IRQ_END();
                                                return;
                                        }
                                        else
@@ -406,6 +412,7 @@ DEFINE_AFSK_DAC_ISR()
 
        AFSK_SET_DAC(sin_sample(phase_acc));
        sample_count--;
+       AFSK_DAC_IRQ_END();
 }
 
 
@@ -479,6 +486,7 @@ void afsk_init(Afsk *af)
        fifo_init(&tx_fifo, tx_buf, sizeof(tx_buf));
 
        AFSK_ADC_INIT();
+       AFSK_STROBE_INIT();
        kprintf("MARK_INC %d, SPACE_INC %d\n", MARK_INC, SPACE_INC);
 
        memset(af, 0, sizeof(*af));
index 49d5ce7ba1261fd956511b5fbdada5c6c6aa38d0..a0ce18bb762a71bca5faada4e69b3df88558754b 100644 (file)
@@ -34,7 +34,7 @@
  *
  * \version $Id$
  * \author Francesco Sacchi <asterix@develer.com>
- * 
+ *
  * $WIZ$ module_name = "afsk"
  * $WIZ$ module_configuration = "bertos/cfg/cfg_afsk.h"
  * $WIZ$ module_depends = "timer", "kfile"
@@ -62,8 +62,4 @@ INLINE Afsk *AFSK_CAST(KFile *fd)
 
 void afsk_init(Afsk *af);
 
-#define HDLC_FLAG  0x7E
-#define HDLC_RESET 0x7F
-#define AFSK_ESC   0x1B
-
 #endif