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 * \todo Translate Emiliano Zapata's spanish comments to english, please. 00023 */ 00024 00025 #ifndef _ASTERISK_FSKMODEM_H 00026 #define _ASTERISK_FSKMODEM_H 00027 00028 #define PARITY_NONE 0 00029 #define PARITY_EVEN 1 00030 #define PARITY_ODD 2 00031 00032 00033 #define NCOLA 0x4000 00034 00035 typedef struct { 00036 float spb; /*!< Samples / Bit */ 00037 int nbit; /*!< Number of Data Bits (5,7,8) */ 00038 float nstop; /*!< Number of Stop Bits 1,1.5,2 */ 00039 int paridad; /*!< Parity 0=none 1=even 2=odd */ 00040 int hdlc; /*!< Modo Packet */ 00041 float x0; 00042 float x1; 00043 float x2; 00044 float cont; 00045 int bw; /*!< Ancho de Banda */ 00046 double fmxv[8],fmyv[8]; /*!< filter stuff for M filter */ 00047 int fmp; /*!< pointer for M filter */ 00048 double fsxv[8],fsyv[8]; /*!< filter stuff for S filter */ 00049 int fsp; /*!< pointer for S filter */ 00050 double flxv[8],flyv[8]; /*!< filter stuff for L filter */ 00051 int flp; /*!< pointer for L filter */ 00052 int f_mark_idx; /*!< Indice de frecuencia de marca (f_M-500)/5 */ 00053 int f_space_idx; /*!< Indice de frecuencia de espacio (f_S-500)/5 */ 00054 int state; 00055 int pcola; /*!< Puntero de las colas de datos */ 00056 float cola_in[NCOLA]; /*!< Cola de muestras de entrada */ 00057 float cola_filtro[NCOLA]; /*!< Cola de muestras tras filtros */ 00058 float cola_demod[NCOLA]; /*!< Cola de muestras demoduladas */ 00059 } fsk_data; 00060 00061 /* \brief Retrieve a serial byte into outbyte. 00062 Buffer is a pointer into a series of 00063 shorts and len records the number of bytes in the buffer. len will be 00064 overwritten with the number of bytes left that were not consumed. 00065 \return return value is as follows: 00066 \arg 0: Still looking for something... 00067 \arg 1: An output byte was received and stored in outbyte 00068 \arg -1: An error occured in the transmission 00069 He must be called with at least 80 bytes of buffer. */ 00070 int fsk_serie(fsk_data *fskd, short *buffer, int *len, int *outbyte); 00071 00072 #endif /* _ASTERISK_FSKMODEM_H */