*
* \brief AFSK1200 modem.
*
- * \version $Id$
- * \author Francesco Sacchi <asterix@develer.com>
+ * \author Francesco Sacchi <batt@develer.com>
*
* $WIZ$ module_name = "afsk"
* $WIZ$ module_configuration = "bertos/cfg/cfg_afsk.h"
* $WIZ$ module_hw = "bertos/hw/hw_afsk.h"
*/
-#ifndef DRV_AFSK_H
-#define DRV_AFSK_H
+#ifndef NET_AFSK_H
+#define NET_AFSK_H
#include "cfg/cfg_afsk.h"
#include "hw/hw_afsk.h"
-#include <kern/kfile.h>
#include <cfg/compiler.h>
+
+#include <io/kfile.h>
+
#include <struct/fifobuf.h>
-// Demodulator constants
+
+/**
+ * ADC sample rate.
+ * The demodulator filters are designed to work at this frequency.
+ * If you need to change this remember to update afsk_adc_isr().
+ */
#define SAMPLERATE 9600
+
+/**
+ * Bitrate of the received/transmitted data.
+ * The demodulator filters and decoderes are designed to work at this frequency.
+ * If you need to change this remember to update afsk_adc_isr().
+ */
#define BITRATE 1200
#define SAMPLEPERBIT (SAMPLERATE / BITRATE)
bool rxstart; ///< True if an HDLC_FLAG char has been found in the bitstream.
} Hdlc;
+/**
+ * RX FIFO buffer full error.
+ */
+#define AFSK_RXFIFO_OVERRUN BV(0)
/**
* AFSK1200 modem context.
/** True while modem sends data */
volatile bool sending;
+ /**
+ * AFSK modem status.
+ * If 0 all is ok, otherwise errors are present.
+ */
+ volatile int status;
+
/** Hdlc context */
Hdlc hdlc;
uint16_t preamble_len;
/**
- * Preamble length.
+ * Trailer length.
* After sending the actual data, the AFSK shifts out
* trailer_len HDLC_FLAG characters.
* This helps to synchronize the demodulator filters on the receiver side.
return (Afsk *)fd;
}
-void afsk_adc_isr(Afsk *af, int8_t curr_sample);
-void afsk_dac_isr(Afsk *af);
+
+void afsk_adc_isr(Afsk *af, int8_t sample);
+uint8_t afsk_dac_isr(Afsk *af);
void afsk_init(Afsk *af, int adc_ch, int dac_ch);
/**
- * \name afsk filter type
+ * \name Afsk filter types.
* $WIZ$ afsk_filter_list = "AFSK_BUTTERWORTH", "AFSK_CHEBYSHEV"
* \{
*/
int afsk_testRun(void);
int afsk_testTearDown(void);
-#endif
+#endif /* NET_AFSK_H */