From e0e183fc664ddfe6327c6c4c72bd81cde7572d71 Mon Sep 17 00:00:00 2001 From: batt Date: Thu, 1 Oct 2009 13:20:08 +0000 Subject: [PATCH] Remove HDLC constants; add irq end handling; Add strobe init. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2997 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/net/afsk.c | 14 +++++++++++--- bertos/net/afsk.h | 6 +----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/bertos/net/afsk.c b/bertos/net/afsk.c index c73cf858..979848bf 100644 --- a/bertos/net/afsk.c +++ b/bertos/net/afsk.c @@ -37,6 +37,8 @@ */ #include "afsk.h" +#include + #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)); diff --git a/bertos/net/afsk.h b/bertos/net/afsk.h index 49d5ce7b..a0ce18bb 100644 --- a/bertos/net/afsk.h +++ b/bertos/net/afsk.h @@ -34,7 +34,7 @@ * * \version $Id$ * \author Francesco Sacchi - * + * * $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 -- 2.25.1