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 /* new filter structure */ 00035 struct filter_struct { 00036 00037 int icoefs[8]; 00038 int ip; 00039 int ixv[8]; 00040 int iyv[8]; 00041 }; 00042 00043 typedef struct { 00044 int nbit; /*!< Number of Data Bits (5,7,8) */ 00045 int parity; /*!< Parity 0=none 1=even 2=odd */ 00046 int instop; /*!< Number of Stop Bits */ 00047 int hdlc; /*!< Modo Packet */ 00048 int xi0; 00049 int xi1; 00050 int xi2; 00051 00052 int ispb; 00053 int icont; 00054 int bw; /*!< Band Selector*/ 00055 int f_mark_idx; /*!< Mark Frequency Index (f_M-500)/5 */ 00056 int f_space_idx; /*!< Space Frequency Index (f_S-500)/5 */ 00057 int state; 00058 00059 int pllispb; /*!<Pll autosense */ 00060 int pllids; 00061 int pllispb2; 00062 00063 struct filter_struct mark_filter; 00064 struct filter_struct space_filter; 00065 struct filter_struct demod_filter; 00066 00067 } fsk_data; 00068 00069 /* \brief Retrieve a serial byte into outbyte. 00070 Buffer is a pointer into a series of 00071 shorts and len records the number of bytes in the buffer. len will be 00072 overwritten with the number of bytes left that were not consumed. 00073 \return return value is as follows: 00074 \arg 0: Still looking for something... 00075 \arg 1: An output byte was received and stored in outbyte 00076 \arg -1: An error occured in the transmission 00077 This must be called with at least 80 bytes of buffer. */ 00078 int fsk_serial(fsk_data *fskd, short *buffer, int *len, int *outbyte); 00079 int fskmodem_init(fsk_data *fskd); 00080 00081 #endif /* _ASTERISK_FSKMODEM_H */