Asterisk - The Open Source Telephony Project  18.5.0
fskmodem_float.h
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 1999 - 2005, Digium, Inc.
5  *
6  * Mark Spencer <[email protected]>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18 
19 /*! \file
20  * \brief FSK Modem Support
21  * \note Includes code and algorithms from the Zapata library.
22  */
23 
24 #ifndef _ASTERISK_FSKMODEM_H
25 #define _ASTERISK_FSKMODEM_H
26 
27 #define PARITY_NONE 0
28 #define PARITY_EVEN 1
29 #define PARITY_ODD 2
30 
31 
32 #define NCOLA 0x4000
33 
34 typedef struct {
35  float spb; /*!< Samples / Bit */
36  int nbit; /*!< Number of Data Bits (5,7,8) */
37  float nstop; /*!< Number of Stop Bits 1,1.5,2 */
38  int parity; /*!< Parity 0=none 1=even 2=odd */
39  int hdlc; /*!< Modo Packet */
40  float x0;
41  float x1;
42  float x2;
43  float cont;
44  int bw; /*!< Bandwidth */
45  double fmxv[8],fmyv[8]; /*!< filter stuff for M filter */
46  int fmp; /*!< pointer for M filter */
47  double fsxv[8],fsyv[8]; /*!< filter stuff for S filter */
48  int fsp; /*!< pointer for S filter */
49  double flxv[8],flyv[8]; /*!< filter stuff for L filter */
50  int flp; /*!< pointer for L filter */
51  int f_mark_idx; /*!< Mark frequency index (f_M-500)/5 */
52  int f_space_idx; /*!< Space frequency index (f_S-500)/5 */
53  int state;
54  int pcola; /*!< Pointer to data queues */
55  float cola_in[NCOLA]; /*!< Queue of input samples */
56  float cola_filter[NCOLA]; /*!< Queue of samples after filters */
57  float cola_demod[NCOLA]; /*!< Queue of demodulated samples */
58 } fsk_data;
59 
60 /* \brief Retrieve a serial byte into outbyte.
61  Buffer is a pointer into a series of
62  shorts and len records the number of bytes in the buffer. len will be
63  overwritten with the number of bytes left that were not consumed.
64  \return return value is as follows:
65  \arg 0: Still looking for something...
66  \arg 1: An output byte was received and stored in outbyte
67  \arg -1: An error occured in the transmission
68  He must be called with at least 80 bytes of buffer. */
69 int fsk_serial(fsk_data *fskd, short *buffer, int *len, int *outbyte);
70 
71 #endif /* _ASTERISK_FSKMODEM_H */
#define NCOLA
float cont
float nstop
int f_space_idx
int f_mark_idx
int fsk_serial(fsk_data *fskd, short *buffer, int *len, int *outbyte)