00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * private/fax_modems.h - definitions for the analogue modem set for fax processing 00005 * 00006 * Written by Steve Underwood <steveu@coppice.org> 00007 * 00008 * Copyright (C) 2008 Steve Underwood 00009 * 00010 * All rights reserved. 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 2.1, 00014 * as published by the Free Software Foundation. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00024 */ 00025 00026 /*! \file */ 00027 00028 #if !defined(_SPANDSP_PRIVATE_FAX_MODEMS_H_) 00029 #define _SPANDSP_PRIVATE_FAX_MODEMS_H_ 00030 00031 /*! 00032 The set of modems needed for FAX, plus the auxilliary stuff, like tone generation. 00033 */ 00034 struct fax_modems_state_s 00035 { 00036 /*! TRUE is talker echo protection should be sent for the image modems */ 00037 int use_tep; 00038 00039 /*! If TRUE, transmit silence when there is nothing else to transmit. If FALSE return only 00040 the actual generated audio. Note that this only affects untimed silences. Timed silences 00041 (e.g. the 75ms silence between V.21 and a high speed modem) will alway be transmitted as 00042 silent audio. */ 00043 int transmit_on_idle; 00044 00045 /*! \brief An HDLC context used when transmitting HDLC messages. */ 00046 hdlc_tx_state_t hdlc_tx; 00047 /*! \brief An HDLC context used when receiving HDLC messages. */ 00048 hdlc_rx_state_t hdlc_rx; 00049 /*! \brief A V.21 FSK modem context used when transmitting HDLC over V.21 00050 messages. */ 00051 fsk_tx_state_t v21_tx; 00052 /*! \brief A V.21 FSK modem context used when receiving HDLC over V.21 00053 messages. */ 00054 fsk_rx_state_t v21_rx; 00055 union 00056 { 00057 /*! \brief A V.17 modem context used when sending FAXes at 7200bps, 9600bps 00058 12000bps or 14400bps */ 00059 v17_tx_state_t v17_tx; 00060 /*! \brief A V.29 modem context used when receiving FAXes at 7200bps, 9600bps 00061 12000bps or 14400bps */ 00062 v17_rx_state_t v17_rx; 00063 /*! \brief A V.29 modem context used when sending FAXes at 7200bps or 00064 9600bps */ 00065 v29_tx_state_t v29_tx; 00066 /*! \brief A V.29 modem context used when receiving FAXes at 7200bps or 00067 9600bps */ 00068 v29_rx_state_t v29_rx; 00069 /*! \brief A V.27ter modem context used when sending FAXes at 2400bps or 00070 4800bps */ 00071 v27ter_tx_state_t v27ter_tx; 00072 /*! \brief A V.27ter modem context used when receiving FAXes at 2400bps or 00073 4800bps */ 00074 v27ter_rx_state_t v27ter_rx; 00075 } fast_modems; 00076 /*! \brief Used to insert timed silences. */ 00077 silence_gen_state_t silence_gen; 00078 /*! \brief CED or CNG generator */ 00079 modem_connect_tones_tx_state_t connect_tx; 00080 /*! \brief CED or CNG detector */ 00081 modem_connect_tones_rx_state_t connect_rx; 00082 /*! \brief */ 00083 dc_restore_state_t dc_restore; 00084 00085 /*! \brief The fast modem type currently in use */ 00086 int fast_modem; 00087 00088 /*! \brief The currently selected receiver type */ 00089 int current_rx_type; 00090 /*! \brief The currently selected transmitter type */ 00091 int current_tx_type; 00092 00093 int bit_rate; 00094 int short_train; 00095 00096 /*! \brief The callback function used to put each bit received. */ 00097 put_bit_func_t put_bit; 00098 /*! \brief A user specified opaque pointer passed to the put_bit routine. */ 00099 void *put_bit_user_data; 00100 00101 /*! \brief The callback function used to get the next bit to be transmitted. */ 00102 get_bit_func_t get_bit; 00103 /*! \brief A user specified opaque pointer passed to the get_bit function. */ 00104 void *get_bit_user_data; 00105 00106 hdlc_frame_handler_t hdlc_accept; 00107 void *hdlc_accept_user_data; 00108 00109 /*! \brief TRUE if a carrier is present. Otherwise FALSE. */ 00110 int rx_signal_present; 00111 /*! \brief TRUE if a modem has trained correctly. */ 00112 int rx_trained; 00113 /*! \brief TRUE if an HDLC frame has been received correctly. */ 00114 int rx_frame_received; 00115 00116 int deferred_rx_handler_updates; 00117 /*! \brief The current receive signal handler */ 00118 span_rx_handler_t rx_handler; 00119 /*! \brief The current receive signal handler. Actual receiving hops between this 00120 and a dummy receive routine. */ 00121 span_rx_handler_t base_rx_handler; 00122 void *rx_user_data; 00123 /*! \brief The current receive missing signal fill-in handler */ 00124 span_rx_fillin_handler_t rx_fillin_handler; 00125 /*! \brief The current receive signal fillin handler. Actual receiving hops between this 00126 and a dummy receive routine. */ 00127 span_rx_fillin_handler_t base_rx_fillin_handler; 00128 void *rx_fillin_user_data; 00129 00130 /*! \brief The current transmit signal handler */ 00131 span_tx_handler_t tx_handler; 00132 void *tx_user_data; 00133 00134 /*! The next transmit signal handler, for two stage transmit operations. 00135 E.g. a short silence followed by a modem signal. */ 00136 span_tx_handler_t next_tx_handler; 00137 void *next_tx_user_data; 00138 00139 /*! \brief The current bit rate of the transmitter. */ 00140 int tx_bit_rate; 00141 /*! \brief The current bit rate of the receiver. */ 00142 int rx_bit_rate; 00143 00144 /*! \brief If TRUE, transmission is in progress */ 00145 int transmit; 00146 /*! \brief Audio logging file handle for received audio. */ 00147 int audio_rx_log; 00148 /*! \brief Audio logging file handle for transmitted audio. */ 00149 int audio_tx_log; 00150 /*! \brief Error and flow logging control */ 00151 logging_state_t logging; 00152 }; 00153 00154 #endif 00155 /*- End of file ------------------------------------------------------------*/
1.6.1