spandsp  0.0.6
fax_modems.h
Go to the documentation of this file.
1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * fax_modems.h - definitions for the analogue modem set for fax processing
5  *
6  * Written by Steve Underwood <steveu@coppice.org>
7  *
8  * Copyright (C) 2008 Steve Underwood
9  *
10  * All rights reserved.
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 2.1,
14  * as published by the Free Software Foundation.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this program; if not, write to the Free Software
23  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25 
26 /*! \file */
27 
28 #if !defined(_SPANDSP_FAX_MODEMS_H_)
29 #define _SPANDSP_FAX_MODEMS_H_
30 
31 enum
32 {
33  FAX_MODEM_NONE = -1,
34  FAX_MODEM_FLUSH = 0,
35  FAX_MODEM_SILENCE_TX,
36  FAX_MODEM_SILENCE_RX,
37  FAX_MODEM_CED_TONE,
38  FAX_MODEM_CNG_TONE,
39  FAX_MODEM_NOCNG_TONE,
40  FAX_MODEM_V21_TX,
41  FAX_MODEM_V17_TX,
42  FAX_MODEM_V27TER_TX,
43  FAX_MODEM_V29_TX,
44  FAX_MODEM_V21_RX,
45  FAX_MODEM_V17_RX,
46  FAX_MODEM_V27TER_RX,
47  FAX_MODEM_V29_RX
48 };
49 
50 /*!
51  The set of modems needed for FAX, plus the auxilliary stuff, like tone generation.
52 */
54 
55 #if defined(__cplusplus)
56 extern "C"
57 {
58 #endif
59 
60 /*! Convert a FAX modem type to a short text description.
61  \brief Convert a FAX modem type to a short text description.
62  \param modem The modem code.
63  \return A pointer to the description. */
64 SPAN_DECLARE(const char *) fax_modem_to_str(int modem);
65 
66 /* N.B. the following are currently a work in progress */
67 SPAN_DECLARE_NONSTD(int) fax_modems_v17_v21_rx(void *user_data, const int16_t amp[], int len);
68 SPAN_DECLARE_NONSTD(int) fax_modems_v27ter_v21_rx(void *user_data, const int16_t amp[], int len);
69 SPAN_DECLARE_NONSTD(int) fax_modems_v29_v21_rx(void *user_data, const int16_t amp[], int len);
70 SPAN_DECLARE_NONSTD(int) fax_modems_v17_v21_rx_fillin(void *user_data, int len);
71 SPAN_DECLARE_NONSTD(int) fax_modems_v27ter_v21_rx_fillin(void *user_data, int len);
72 SPAN_DECLARE_NONSTD(int) fax_modems_v29_v21_rx_fillin(void *user_data, int len);
73 
74 SPAN_DECLARE_NONSTD(void) fax_modems_hdlc_tx_frame(void *user_data, const uint8_t *msg, int len);
75 
76 SPAN_DECLARE(void) fax_modems_start_rx_modem(fax_modems_state_t *s, int which);
77 
78 SPAN_DECLARE(void) fax_modems_set_tep_mode(fax_modems_state_t *s, int use_tep);
79 
80 SPAN_DECLARE(int) fax_modems_restart(fax_modems_state_t *s);
81 
82 /*! Get a pointer to the logging context associated with a FAX modems context.
83  \brief Get a pointer to the logging context associated with a FAX modems context.
84  \param s The FAX modems context.
85  \return A pointer to the logging context, or NULL.
86 */
88 
89 SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s,
90  int use_tep,
91  hdlc_frame_handler_t hdlc_accept,
92  hdlc_underflow_handler_t hdlc_tx_underflow,
93  put_bit_func_t non_ecm_put_bit,
94  get_bit_func_t non_ecm_get_bit,
95  tone_report_func_t tone_callback,
96  void *user_data);
97 
98 SPAN_DECLARE(int) fax_modems_release(fax_modems_state_t *s);
99 
100 SPAN_DECLARE(int) fax_modems_free(fax_modems_state_t *s);
101 
102 #if defined(__cplusplus)
103 }
104 #endif
105 
106 #endif
107 /*- End of file ------------------------------------------------------------*/
int use_tep
Definition: private/fax_modems.h:37
const char * fax_modem_to_str(int modem)
Convert a FAX modem type to a short text description.
Definition: fax_modems.c:89
SPAN_DECLARE_NONSTD(int) fax_modems_v17_v21_rx(void *user_data
Get the next bit of a transmitted serial bit stream.
logging_state_t * fax_modems_get_logging_state(fax_modems_state_t *s)
Get a pointer to the logging context associated with a FAX modems context.
Definition: fax_modems.c:323
void(* put_bit_func_t)(void *user_data, int bit)
Definition: async.h:105
int(* get_bit_func_t)(void *user_data)
Definition: async.h:108
Definition: private/fax_modems.h:34
Definition: private/logging.h:33