00001 /* 00002 * Asterisk -- An open source telephony toolkit. 00003 * 00004 * Copyright (C) 1999 - 2005, Digium, Inc. 00005 * 00006 * Mark Spencer <markster@digium.com> 00007 * 00008 * See http://www.asterisk.org for more information about 00009 * the Asterisk project. Please do not directly contact 00010 * any of the maintainers of this project for assistance; 00011 * the project provides a web site, mailing lists and IRC 00012 * channels for your use. 00013 * 00014 * This program is free software, distributed under the terms of 00015 * the GNU General Public License Version 2. See the LICENSE file 00016 * at the top of the source tree. 00017 */ 00018 00019 /*! \file 00020 * \brief FSK Modem Support 00021 * \note Includes code and algorithms from the Zapata library. 00022 */ 00023 00024 #ifndef _ASTERISK_FSKMODEM_H 00025 #define _ASTERISK_FSKMODEM_H 00026 00027 #define PARITY_NONE 0 00028 #define PARITY_EVEN 1 00029 #define PARITY_ODD 2 00030 00031 00032 #define NCOLA 0x4000 00033 00034 typedef struct { 00035 float spb; /*!< Samples / Bit */ 00036 int nbit; /*!< Number of Data Bits (5,7,8) */ 00037 float nstop; /*!< Number of Stop Bits 1,1.5,2 */ 00038 int parity; /*!< Parity 0=none 1=even 2=odd */ 00039 int hdlc; /*!< Modo Packet */ 00040 float x0; 00041 float x1; 00042 float x2; 00043 float cont; 00044 int bw; /*!< Bandwidth */ 00045 double fmxv[8],fmyv[8]; /*!< filter stuff for M filter */ 00046 int fmp; /*!< pointer for M filter */ 00047 double fsxv[8],fsyv[8]; /*!< filter stuff for S filter */ 00048 int fsp; /*!< pointer for S filter */ 00049 double flxv[8],flyv[8]; /*!< filter stuff for L filter */ 00050 int flp; /*!< pointer for L filter */ 00051 int f_mark_idx; /*!< Mark frequency index (f_M-500)/5 */ 00052 int f_space_idx; /*!< Space frequency index (f_S-500)/5 */ 00053 int state; 00054 int pcola; /*!< Pointer to data queues */ 00055 float cola_in[NCOLA]; /*!< Queue of input samples */ 00056 float cola_filter[NCOLA]; /*!< Queue of samples after filters */ 00057 float cola_demod[NCOLA]; /*!< Queue of demodulated samples */ 00058 } fsk_data; 00059 00060 /* \brief Retrieve a serial byte into outbyte. 00061 Buffer is a pointer into a series of 00062 shorts and len records the number of bytes in the buffer. len will be 00063 overwritten with the number of bytes left that were not consumed. 00064 \return return value is as follows: 00065 \arg 0: Still looking for something... 00066 \arg 1: An output byte was received and stored in outbyte 00067 \arg -1: An error occured in the transmission 00068 He must be called with at least 80 bytes of buffer. */ 00069 int fsk_serial(fsk_data *fskd, short *buffer, int *len, int *outbyte); 00070 00071 #endif /* _ASTERISK_FSKMODEM_H */