Updated SpanDSP to snapshot on 2009-06-03 with some additions:

Fixed VS2005 version of make_modem_filter

  Fixed a couple of places where declaration and definition of functions do not have the same calling conventions. Only relevant for Win32 compiles.


git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13831 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Robert Joly committed 2009-06-18 06:13:59 +00:00
1 parent 832bab2a4a
commit e791f33545
131 files changed
+8988 -2017

No files matched your search

+27 -27
View File
@@ -16,7 +16,7 @@
## License along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Id: Makefile.am,v 1.130 2009/04/16 13:09:40 steveu Exp $
## $Id: Makefile.am,v 1.134 2009/06/02 11:51:57 steveu Exp $
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
@@ -24,7 +24,6 @@ AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = floating_fudge.h \
spandsp/version.h.in \
libspandsp.dsp \
libspandsp.2005.sln \
libspandsp.2008.sln \
@@ -42,19 +41,20 @@ EXTRA_DIST = floating_fudge.h \
msvc/make_at_dictionary.2008.vcproj \
msvc/make_modem_filter.2005.vcproj \
msvc/make_modem_filter.2008.vcproj \
msvc/spandsp.h \
msvc/unistd.h \
msvc/tgmath.h \
msvc/msvcproj.head \
msvc/msvcproj.foot \
msvc/util.vbs \
msvc/vc8proj.head \
msvc/vc8proj.foot \
msvc/vc9proj.head \
msvc/vc9proj.foot \
msvc/sys/time.h \
msvc/spandsp.h \
msvc/tgmath.h \
msvc/tiff/cleancount \
spandsp/private/README
msvc/unistd.h \
msvc/util.vbs \
msvc/vc8proj.foot \
msvc/vc8proj.head \
msvc/vc9proj.foot \
msvc/vc9proj.head \
msvc/sys/time.h \
spandsp/private/README \
spandsp/version.h.in
INCLUDES = -I$(top_builddir)
@@ -139,7 +139,7 @@ libspandsp_la_SOURCES = adsi.c \
vector_float.c \
vector_int.c
libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_FLAGS)
libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS)
nobase_include_HEADERS = spandsp/adsi.h \
spandsp/async.h \
@@ -277,8 +277,8 @@ noinst_HEADERS = faxfont.h \
lpc10_encdecs.h \
t30_local.h \
t4_states.h \
v17rx_constellation_maps.h \
v17tx_constellation_maps.h \
v17_v32bis_rx_constellation_maps.h \
v17_v32bis_tx_constellation_maps.h \
v29tx_constellation_maps.h
noinst_PROGRAMS = make_at_dictionary \
@@ -301,25 +301,25 @@ t4.$(OBJEXT): spandsp/version.h
t4.lo: spandsp/version.h
v17rx.$(OBJEXT): v17rx_fixed_rrc.h v17rx_floating_rrc.h
v17rx.$(OBJEXT): v17_v32bis_rx_fixed_rrc.h v17_v32bis_rx_floating_rrc.h
v17rx.lo: v17rx_fixed_rrc.h v17rx_floating_rrc.h
v17rx.lo: v17_v32bis_rx_fixed_rrc.h v17_v32bis_rx_floating_rrc.h
v17rx_fixed_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.17 -i -r >v17rx_fixed_rrc.h
v17_v32bis_rx_fixed_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.17 -i -r >v17_v32bis_rx_fixed_rrc.h
v17rx_floating_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.17 -r >v17rx_floating_rrc.h
v17_v32bis_rx_floating_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.17 -r >v17_v32bis_rx_floating_rrc.h
v17tx.$(OBJEXT): v17tx_fixed_rrc.h v17tx_floating_rrc.h
v17tx.$(OBJEXT): v17_v32bis_tx_fixed_rrc.h v17_v32bis_tx_floating_rrc.h
v17tx.lo: v17tx_fixed_rrc.h v17tx_floating_rrc.h
v17tx.lo: v17_v32bis_tx_fixed_rrc.h v17_v32bis_tx_floating_rrc.h
v17tx_fixed_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.17 -i -t >v17tx_fixed_rrc.h
v17_v32bis_tx_fixed_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.17 -i -t >v17_v32bis_tx_fixed_rrc.h
v17tx_floating_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.17 -t >v17tx_floating_rrc.h
v17_v32bis_tx_floating_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.17 -t >v17_v32bis_tx_floating_rrc.h
v22bis_rx.$(OBJEXT): v22bis_rx_1200_fixed_rrc.h \
v22bis_rx_2400_fixed_rrc.h \
+3 -3
View File
@@ -23,7 +23,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: fax.c,v 1.92 2009/04/23 15:48:21 steveu Exp $
* $Id: fax.c,v 1.93 2009/05/24 07:18:36 steveu Exp $
*/
/*! \file */
@@ -98,7 +98,7 @@
#include "spandsp/private/t30.h"
#include "spandsp/private/fax.h"
#define HDLC_FRAMING_OK_THRESHOLD 5
#define HDLC_FRAMING_OK_THRESHOLD 8
static void fax_send_hdlc(void *user_data, const uint8_t *msg, int len)
{
@@ -387,7 +387,7 @@ static void fax_set_rx_type(void *user_data, int type, int bit_rate, int short_t
{
put_bit_func = (put_bit_func_t) hdlc_rx_put_bit;
put_bit_user_data = (void *) &t->hdlc_rx;
hdlc_rx_init(&t->hdlc_rx, FALSE, FALSE, HDLC_FRAMING_OK_THRESHOLD, t30_hdlc_accept, &s->t30);
hdlc_rx_init(&t->hdlc_rx, FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, t30_hdlc_accept, &s->t30);
}
else
{
+1 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: fsk.c,v 1.58 2009/04/01 13:22:40 steveu Exp $
* $Id: fsk.c,v 1.59 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
+5 -5
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: hdlc.c,v 1.71 2009/02/12 12:38:39 steveu Exp $
* $Id: hdlc.c,v 1.72 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
@@ -264,7 +264,7 @@ SPAN_DECLARE_NONSTD(void) hdlc_rx_put_bit(hdlc_rx_state_t *s, int new_bit)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) hdlc_rx_put_byte(hdlc_rx_state_t *s, int new_byte)
SPAN_DECLARE_NONSTD(void) hdlc_rx_put_byte(hdlc_rx_state_t *s, int new_byte)
{
int i;
@@ -282,7 +282,7 @@ SPAN_DECLARE(void) hdlc_rx_put_byte(hdlc_rx_state_t *s, int new_byte)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], int len)
SPAN_DECLARE_NONSTD(void) hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], int len)
{
int i;
@@ -440,7 +440,7 @@ SPAN_DECLARE(int) hdlc_tx_corrupt_frame(hdlc_tx_state_t *s)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
{
int i;
int byte_in_progress;
@@ -561,7 +561,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_bit(hdlc_tx_state_t *s)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) hdlc_tx_get(hdlc_tx_state_t *s, uint8_t buf[], size_t max_len)
SPAN_DECLARE_NONSTD(int) hdlc_tx_get(hdlc_tx_state_t *s, uint8_t buf[], size_t max_len)
{
size_t i;
int x;
+7
View File
@@ -12,6 +12,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libspandsp.20
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp_sim", "..\spandsp-sim\libspandsp_sim.2005.vcproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
ProjectSection(ProjectDependencies) = postProject
{329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838}
{DEE932AB-5911-4700-9EEB-8C7090A0A330} = {DEE932AB-5911-4700-9EEB-8C7090A0A330}
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libtiff.2005.vcproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}"
ProjectSection(ProjectDependencies) = postProject
{2B8A45C9-FEB4-4734-AB37-8DB9DB899917} = {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}
+28
View File
@@ -12,6 +12,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libspandsp.20
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_line_models", "..\spandsp-sim\msvc\make_line_models.2008.vcproj", "{F290BADE-82DE-4037-B49D-D563E43169DA}"
ProjectSection(ProjectDependencies) = postProject
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp_sim", "..\spandsp-sim\libspandsp_sim.2008.vcproj", "{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}"
ProjectSection(ProjectDependencies) = postProject
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libtiff.2008.vcproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}"
ProjectSection(ProjectDependencies) = postProject
{2B8A45C9-FEB4-4734-AB37-8DB9DB899917} = {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}
@@ -91,6 +101,15 @@ Global
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.Build.0 = Release|Win32
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.ActiveCfg = Release|x64
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.Build.0 = Release|x64
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|Win32.ActiveCfg = Release|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|Win32.Build.0 = Release|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|x64.ActiveCfg = Release|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|Win32.ActiveCfg = Debug|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|Win32.Build.0 = Debug|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|x64.ActiveCfg = Debug|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|Win32.ActiveCfg = Release|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|Win32.Build.0 = Release|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|x64.ActiveCfg = Release|Win32
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.ActiveCfg = Release|x64
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.ActiveCfg = Release|x64
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.Build.0 = Release|x64
@@ -174,6 +193,15 @@ Global
{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|Win32.ActiveCfg = Release|Win32
{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|Win32.Build.0 = Release|Win32
{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|x64.ActiveCfg = Release|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.All|Win32.ActiveCfg = All|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.All|Win32.Build.0 = All|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.All|x64.ActiveCfg = All|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|Win32.ActiveCfg = All|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|Win32.Build.0 = All|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|x64.ActiveCfg = All|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.Release|Win32.ActiveCfg = All|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.Release|Win32.Build.0 = All|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.Release|x64.ActiveCfg = All|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+1 -1
View File
@@ -30,7 +30,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
MinimalRebuild="true"
BasicRuntimeChecks="3"
+2 -1
View File
@@ -23,7 +23,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: make_modem_filter.c,v 1.14 2009/02/10 17:16:57 steveu Exp $
* $Id: make_modem_filter.c,v 1.15 2009/06/02 11:51:57 steveu Exp $
*/
#if defined(HAVE_CONFIG_H)
@@ -355,6 +355,7 @@ int main(int argc, char **argv)
}
if (strcmp(modem, "V.17") == 0)
{
/* This applies to V.32bis as well as V.17 */
rx_coeff_sets = 192;
rx_coeffs_per_filter = 27;
rx_excess_bandwidth = 0.5;
+11 -4
View File
@@ -23,7 +23,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: modem_connect_tones.c,v 1.35 2009/02/16 09:57:22 steveu Exp $
* $Id: modem_connect_tones.c,v 1.37 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
@@ -88,8 +88,8 @@ SPAN_DECLARE(const char *) modem_connect_tone_to_str(int tone)
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE_NONSTD(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *s,
int16_t amp[],
int len)
int16_t amp[],
int len)
{
int16_t mod;
int i;
@@ -354,7 +354,9 @@ static void v21_put_bit(void *user_data, int bit)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s, const int16_t amp[], int len)
SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s,
const int16_t amp[],
int len)
{
int i;
int16_t notched;
@@ -399,6 +401,10 @@ SPAN_DECLARE(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s, cons
}
}
break;
case MODEM_CONNECT_TONES_FAX_PREAMBLE:
/* Ignore any CED tone, and just look for V.21 preamble. */
fsk_rx(&(s->v21rx), amp, len);
break;
case MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE:
/* Also look for V.21 preamble. A lot of machines don't send the 2100Hz burst. It
might also not be seen all the way through the channel, due to switching delays. */
@@ -520,6 +526,7 @@ SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem
s->tone_type = tone_type;
switch (s->tone_type)
{
case MODEM_CONNECT_TONES_FAX_PREAMBLE:
case MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE:
fsk_rx_init(&(s->v21rx), &preset_fsk_specs[FSK_V21CH2], TRUE, v21_put_bit, s);
fsk_rx_signal_cutoff(&(s->v21rx), -45.5f);
+7 -2
View File
@@ -19,6 +19,11 @@
extern "C" {
#endif
typedef __int8 __int8_t;
typedef __int16 __int16_t;
typedef __int32 __int32_t;
typedef __int64 __int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
@@ -28,11 +33,11 @@ typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
#define INT16_MAX 0x7fff
#define INT16_MAX 0x7FFF
#define INT16_MIN (-INT16_MAX - 1)
#if !defined(INFINITY)
#define INFINITY 0x7fffffff
#define INFINITY 0x7FFFFFFF
#endif
#define INT32_MAX (2147483647)
@@ -90,7 +90,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="&quot;$(TargetPath)&quot; -m V.17 -i -r &gt;&quot;$(ProjectDir)..\v17rx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -r &gt;&quot;$(ProjectDir)..\v17rx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -i -t &gt;&quot;$(ProjectDir)..\v17tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -t &gt;&quot;$(ProjectDir)..\v17tx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis1200 -i -r &gt;&quot;$(ProjectDir)..\v22bis_rx_1200_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis2400 -i -r &gt;&quot;$(ProjectDir)..\v22bis_rx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis1200 -r &gt;&quot;$(ProjectDir)..\v22bis_rx_1200_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis2400 -r &gt;&quot;$(ProjectDir)..\v22bis_rx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis -i -t &gt;&quot;$(ProjectDir)..\v22bis_tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis -t &gt;&quot;$(ProjectDir)..\v22bis_tx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -i -r &gt;&quot;$(ProjectDir)..\v27ter_rx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -i -r &gt;&quot;$(ProjectDir)..\v27ter_rx_4800_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -r &gt;&quot;$(ProjectDir)..\v27ter_rx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -r &gt;&quot;$(ProjectDir)..\v27ter_rx_4800_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -i -t &gt;&quot;$(ProjectDir)..\v27ter_tx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -i -t &gt;&quot;$(ProjectDir)..\v27ter_tx_4800_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -t &gt;&quot;$(ProjectDir)..\v27ter_tx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -t &gt;&quot;$(ProjectDir)..\v27ter_tx_4800_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -i -r &gt;&quot;$(ProjectDir)..\v29rx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -r &gt;&quot;$(ProjectDir)..\v29rx_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -i -t &gt;&quot;$(ProjectDir)..\v29tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -t &gt;&quot;$(ProjectDir)..\v29tx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;"
CommandLine="&quot;$(TargetPath)&quot; -m V.17 -i -r &gt;&quot;$(ProjectDir)..\v17_v32bis_rx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -r &gt;&quot;$(ProjectDir)..\v17_v32bis_rx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -i -t &gt;&quot;$(ProjectDir)..\v17_v32bis_tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -t &gt;&quot;$(ProjectDir)..\v17_v32bis_tx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis1200 -i -r &gt;&quot;$(ProjectDir)..\v22bis_rx_1200_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis2400 -i -r &gt;&quot;$(ProjectDir)..\v22bis_rx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis1200 -r &gt;&quot;$(ProjectDir)..\v22bis_rx_1200_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis2400 -r &gt;&quot;$(ProjectDir)..\v22bis_rx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis -i -t &gt;&quot;$(ProjectDir)..\v22bis_tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis -t &gt;&quot;$(ProjectDir)..\v22bis_tx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -i -r &gt;&quot;$(ProjectDir)..\v27ter_rx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -i -r &gt;&quot;$(ProjectDir)..\v27ter_rx_4800_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -r &gt;&quot;$(ProjectDir)..\v27ter_rx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -r &gt;&quot;$(ProjectDir)..\v27ter_rx_4800_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -i -t &gt;&quot;$(ProjectDir)..\v27ter_tx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -i -t &gt;&quot;$(ProjectDir)..\v27ter_tx_4800_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -t &gt;&quot;$(ProjectDir)..\v27ter_tx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -t &gt;&quot;$(ProjectDir)..\v27ter_tx_4800_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -i -r &gt;&quot;$(ProjectDir)..\v29rx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -r &gt;&quot;$(ProjectDir)..\v29rx_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -i -t &gt;&quot;$(ProjectDir)..\v29tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -t &gt;&quot;$(ProjectDir)..\v29tx_floating_rrc.h&quot;&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
@@ -88,7 +88,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="&quot;$(TargetPath)&quot; -m V.17 -i -r &gt;&quot;$(ProjectDir)..\v17rx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -r &gt;&quot;$(ProjectDir)..\v17rx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -i -t &gt;&quot;$(ProjectDir)..\v17tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -t &gt;&quot;$(ProjectDir)..\v17tx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis1200 -i -r &gt;&quot;$(ProjectDir)..\v22bis_rx_1200_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis2400 -i -r &gt;&quot;$(ProjectDir)..\v22bis_rx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis1200 -r &gt;&quot;$(ProjectDir)..\v22bis_rx_1200_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis2400 -r &gt;&quot;$(ProjectDir)..\v22bis_rx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis -i -t &gt;&quot;$(ProjectDir)..\v22bis_tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis -t &gt;&quot;$(ProjectDir)..\v22bis_tx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -i -r &gt;&quot;$(ProjectDir)..\v27ter_rx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -i -r &gt;&quot;$(ProjectDir)..\v27ter_rx_4800_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -r &gt;&quot;$(ProjectDir)..\v27ter_rx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -r &gt;&quot;$(ProjectDir)..\v27ter_rx_4800_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -i -t &gt;&quot;$(ProjectDir)..\v27ter_tx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -i -t &gt;&quot;$(ProjectDir)..\v27ter_tx_4800_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -t &gt;&quot;$(ProjectDir)..\v27ter_tx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -t &gt;&quot;$(ProjectDir)..\v27ter_tx_4800_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -i -r &gt;&quot;$(ProjectDir)..\v29rx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -r &gt;&quot;$(ProjectDir)..\v29rx_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -i -t &gt;&quot;$(ProjectDir)..\v29tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -t &gt;&quot;$(ProjectDir)..\v29tx_floating_rrc.h&quot;&#x0D;&#x0A;"
CommandLine="&quot;$(TargetPath)&quot; -m V.17 -i -r &gt;&quot;$(ProjectDir)..\v17_v32bis_rx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -r &gt;&quot;$(ProjectDir)..\v17_v32bis_rx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -i -t &gt;&quot;$(ProjectDir)..\v17_v32bis_tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.17 -t &gt;&quot;$(ProjectDir)..\v17_v32bis_tx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis1200 -i -r &gt;&quot;$(ProjectDir)..\v22bis_rx_1200_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis2400 -i -r &gt;&quot;$(ProjectDir)..\v22bis_rx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis1200 -r &gt;&quot;$(ProjectDir)..\v22bis_rx_1200_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis2400 -r &gt;&quot;$(ProjectDir)..\v22bis_rx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis -i -t &gt;&quot;$(ProjectDir)..\v22bis_tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.22bis -t &gt;&quot;$(ProjectDir)..\v22bis_tx_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -i -r &gt;&quot;$(ProjectDir)..\v27ter_rx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -i -r &gt;&quot;$(ProjectDir)..\v27ter_rx_4800_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -r &gt;&quot;$(ProjectDir)..\v27ter_rx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -r &gt;&quot;$(ProjectDir)..\v27ter_rx_4800_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -i -t &gt;&quot;$(ProjectDir)..\v27ter_tx_2400_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -i -t &gt;&quot;$(ProjectDir)..\v27ter_tx_4800_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter2400 -t &gt;&quot;$(ProjectDir)..\v27ter_tx_2400_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.27ter4800 -t &gt;&quot;$(ProjectDir)..\v27ter_tx_4800_floating_rrc.h&quot;&#x0D;&#x0A;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -i -r &gt;&quot;$(ProjectDir)..\v29rx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -r &gt;&quot;$(ProjectDir)..\v29rx_floating_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -i -t &gt;&quot;$(ProjectDir)..\v29tx_fixed_rrc.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; -m V.29 -t &gt;&quot;$(ProjectDir)..\v29tx_floating_rrc.h&quot;&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
+1 -1
View File
@@ -30,7 +30,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
MinimalRebuild="true"
BasicRuntimeChecks="3"
+79 -3
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: power_meter.c,v 1.28 2009/02/10 13:06:46 steveu Exp $
* $Id: power_meter.c,v 1.31 2009/05/30 17:29:23 steveu Exp $
*/
/*! \file */
@@ -122,7 +122,7 @@ SPAN_DECLARE(int32_t) power_meter_current(power_meter_t *s)
SPAN_DECLARE(float) power_meter_current_dbm0(power_meter_t *s)
{
if (s->reading <= 0)
return FLT_MIN;
return -96.329f + DBM0_MAX_POWER;
/* This is based on A-law, but u-law is only 0.03dB different, so don't worry. */
return log10f((float) s->reading/(32767.0f*32767.0f))*10.0f + DBM0_MAX_POWER;
}
@@ -131,8 +131,84 @@ SPAN_DECLARE(float) power_meter_current_dbm0(power_meter_t *s)
SPAN_DECLARE(float) power_meter_current_dbov(power_meter_t *s)
{
if (s->reading <= 0)
return FLT_MIN;
return -96.329f;
return log10f((float) s->reading/(32767.0f*32767.0f))*10.0f;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int32_t) power_surge_detector(power_surge_detector_state_t *s, int16_t amp)
{
int32_t pow_short;
int32_t pow_medium;
pow_short = power_meter_update(&s->short_term, amp);
pow_medium = power_meter_update(&s->medium_term, amp);
if (pow_medium < s->min)
return 0;
if (!s->signal_present)
{
if (pow_short <= s->surge*(pow_medium >> 10))
return 0;
s->signal_present = TRUE;
s->medium_term.reading = s->short_term.reading;
}
else
{
if (pow_short < s->sag*(pow_medium >> 10))
{
s->signal_present = FALSE;
s->medium_term.reading = s->short_term.reading;
return 0;
}
}
return pow_short;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(float) power_surge_detector_current_dbm0(power_surge_detector_state_t *s)
{
return power_meter_current_dbm0(&s->short_term);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(float) power_surge_detector_current_dbov(power_surge_detector_state_t *s)
{
return power_meter_current_dbov(&s->short_term);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(power_surge_detector_state_t *) power_surge_detector_init(power_surge_detector_state_t *s, float min, float surge)
{
float ratio;
if (s == NULL)
{
if ((s = (power_surge_detector_state_t *) malloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
power_meter_init(&s->short_term, 4);
power_meter_init(&s->medium_term, 7);
ratio = powf(10.0f, surge/10.0f);
s->surge = 1024.0f*ratio;
s->sag = 1024.0f/ratio;
s->min = power_meter_level_dbm0(min);
s->medium_term.reading = s->min + 1;
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) power_surge_detector_release(power_surge_detector_state_t *s)
{
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) power_surge_detector_free(power_surge_detector_state_t *s)
{
if (s)
free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
+1 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: silence_gen.c,v 1.21 2009/04/12 03:29:58 steveu Exp $
* $Id: silence_gen.c,v 1.22 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
+3 -2
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: adsi.h,v 1.39 2009/04/11 18:11:19 steveu Exp $
* $Id: adsi.h,v 1.40 2009/05/22 16:39:01 steveu Exp $
*/
/*! \file */
@@ -476,7 +476,8 @@ SPAN_DECLARE(void) adsi_tx_send_alert_tone(adsi_tx_state_t *s);
\param len The length of the message.
\return The length actually added. If a message is already in progress
in the transmitter, this function will return zero, as it will
not successfully add the message to the buffer.
not successfully add the message to the buffer. If the message is
invalid (e.g. it is too long), this function will return -1.
*/
SPAN_DECLARE(int) adsi_tx_put_message(adsi_tx_state_t *s, const uint8_t *msg, int len);
+2 -1
View File
@@ -23,7 +23,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: expose.h,v 1.12 2009/04/12 03:29:58 steveu Exp $
* $Id: expose.h,v 1.13 2009/05/16 03:34:45 steveu Exp $
*/
/*! \file */
@@ -77,6 +77,7 @@
#include <spandsp/private/t38_terminal.h>
#include <spandsp/private/t31.h>
#include <spandsp/private/v8.h>
#include <spandsp/private/v18.h>
#include <spandsp/private/v42.h>
#include <spandsp/private/v42bis.h>
#include <spandsp/private/adsi.h>
+1 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: fsk.h,v 1.39 2009/04/01 13:22:40 steveu Exp $
* $Id: fsk.h,v 1.40 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
+5 -5
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: hdlc.h,v 1.44 2009/02/12 12:38:39 steveu Exp $
* $Id: hdlc.h,v 1.45 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
@@ -160,14 +160,14 @@ SPAN_DECLARE_NONSTD(void) hdlc_rx_put_bit(hdlc_rx_state_t *s, int new_bit);
\param s A pointer to an HDLC receiver context.
\param new_byte The byte of data.
*/
SPAN_DECLARE(void) hdlc_rx_put_byte(hdlc_rx_state_t *s, int new_byte);
SPAN_DECLARE_NONSTD(void) hdlc_rx_put_byte(hdlc_rx_state_t *s, int new_byte);
/*! \brief Put a series of bytes of data to an HDLC receiver.
\param s A pointer to an HDLC receiver context.
\param buf The buffer of data.
\param len The length of the data in the buffer.
*/
SPAN_DECLARE(void) hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], int len);
SPAN_DECLARE_NONSTD(void) hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], int len);
/*! \brief Initialise an HDLC transmitter context.
\param s A pointer to an HDLC transmitter context.
@@ -234,7 +234,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_bit(hdlc_tx_state_t *s);
\param s A pointer to an HDLC transmitter context.
\return The next byte for transmission.
*/
SPAN_DECLARE(int) hdlc_tx_get_byte(hdlc_tx_state_t *s);
SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s);
/*! \brief Get the next sequence of bytes for transmission.
\param s A pointer to an HDLC transmitter context.
@@ -242,7 +242,7 @@ SPAN_DECLARE(int) hdlc_tx_get_byte(hdlc_tx_state_t *s);
\param max_len The number of bytes to get.
\return The number of bytes actually got.
*/
SPAN_DECLARE(int) hdlc_tx_get(hdlc_tx_state_t *s, uint8_t buf[], size_t max_len);
SPAN_DECLARE_NONSTD(int) hdlc_tx_get(hdlc_tx_state_t *s, uint8_t buf[], size_t max_len);
#if defined(__cplusplus)
}
@@ -24,7 +24,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: modem_connect_tones.h,v 1.22 2009/02/10 13:06:47 steveu Exp $
* $Id: modem_connect_tones.h,v 1.24 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
@@ -72,8 +72,7 @@ enum
/*! \brief The ANSam with phase reversals tone is a version of ANS_PR with 20% of 15Hz+-0.1Hz AM
modulation, as per V.8 */
MODEM_CONNECT_TONES_ANSAM_PR = 5,
/*! \brief FAX preamble in a string of V.21 HDLC flag octets. This is only valid as a result of tone
detection. It should not be specified as a tone type to transmit or receive. */
/*! \brief FAX preamble in a string of V.21 HDLC flag octets. */
MODEM_CONNECT_TONES_FAX_PREAMBLE = 6,
/*! \brief CED tone is the same as ANS tone. FAX preamble in a string of V.21 HDLC flag octets.
This is only valid as a tone type to receive. It is never reported as a detected tone
@@ -126,8 +125,8 @@ SPAN_DECLARE(int) modem_connect_tones_tx_free(modem_connect_tones_tx_state_t *s)
\return The number of samples generated.
*/
SPAN_DECLARE_NONSTD(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *s,
int16_t amp[],
int len);
int16_t amp[],
int len);
/*! \brief Process a block of samples through an instance of the modem connect
tones detector.
@@ -136,9 +135,9 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *
\param len The number of samples in the array.
\return The number of unprocessed samples.
*/
SPAN_DECLARE(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s,
const int16_t amp[],
int len);
SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s,
const int16_t amp[],
int len);
/*! \brief Test if a modem_connect tone has been detected.
\param s The context.
+31 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: power_meter.h,v 1.18 2009/02/10 13:06:47 steveu Exp $
* $Id: power_meter.h,v 1.19 2009/05/19 14:15:09 steveu Exp $
*/
#if !defined(_POWER_METER_H_)
@@ -56,6 +56,16 @@ typedef struct
int32_t reading;
} power_meter_t;
typedef struct
{
power_meter_t short_term;
power_meter_t medium_term;
int signal_present;
int32_t surge;
int32_t sag;
int32_t min;
} power_surge_detector_state_t;
#if defined(__cplusplus)
extern "C"
{
@@ -116,6 +126,26 @@ SPAN_DECLARE(int32_t) power_meter_level_dbm0(float level);
\return The equivalent power meter reading. */
SPAN_DECLARE(int32_t) power_meter_level_dbov(float level);
SPAN_DECLARE(int32_t) power_surge_detector(power_surge_detector_state_t *s, int16_t amp);
/*! Get the current surge detector short term meter reading, in dBm0.
\brief Get the current surge detector meter reading, in dBm0.
\param s The power surge detector context.
\return The current power surge detector power reading, in dBm0. */
SPAN_DECLARE(float) power_surge_detector_current_dbm0(power_surge_detector_state_t *s);
/*! Get the current surge detector short term meter reading, in dBOv.
\brief Get the current surge detector meter reading, in dBOv.
\param s The power surge detector context.
\return The current power surge detector power reading, in dBOv. */
SPAN_DECLARE(float) power_surge_detector_current_dbov(power_surge_detector_state_t *s);
SPAN_DECLARE(power_surge_detector_state_t *) power_surge_detector_init(power_surge_detector_state_t *s, float min, float surge);
SPAN_DECLARE(int) power_surge_detector_release(power_surge_detector_state_t *s);
SPAN_DECLARE(int) power_surge_detector_free(power_surge_detector_state_t *s);
#if defined(__cplusplus)
}
#endif
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: t38_gateway.h,v 1.3 2009/04/12 14:18:02 steveu Exp $
* $Id: t38_gateway.h,v 1.4 2009/05/16 03:34:45 steveu Exp $
*/
/*! \file */
@@ -168,11 +168,8 @@ typedef struct
/*! \brief The type of fast receive modem currently active, which may be T38_NONE */
int fast_rx_active;
/*! \brief TRUE if between DCS and TCF, and we want the fast image modem to
start in the T.38 data at a predictable time from the end of the
V.21 signal. */
int tcf_mode_predictable_modem_start;
/*! \brief The current timed operation. */
int timed_mode;
/*! \brief The number of samples until the next timeout event */
int samples_to_timeout;
+1 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: silence_gen.h,v 1.17 2009/04/12 03:29:58 steveu Exp $
* $Id: silence_gen.h,v 1.18 2009/06/02 16:03:56 steveu Exp $
*/
#if !defined(_SPANDSP_SILENCE_GEN_H_)
+1 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: tone_generate.h,v 1.38 2009/02/10 13:06:47 steveu Exp $
* $Id: tone_generate.h,v 1.39 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
+1 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v17rx.h,v 1.63 2009/04/12 04:20:01 steveu Exp $
* $Id: v17rx.h,v 1.64 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
+1 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v17tx.h,v 1.41 2009/04/12 09:12:11 steveu Exp $
* $Id: v17tx.h,v 1.42 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
+5 -4
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v18.h,v 1.3 2009/04/12 09:12:11 steveu Exp $
* $Id: v18.h,v 1.5 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
@@ -100,7 +100,7 @@ SPAN_DECLARE(int) v18_free(v18_state_t *s);
\param max_len The number of samples to be generated.
\return The number of samples actually generated.
*/
SPAN_DECLARE(int) v18_tx(v18_state_t *s, int16_t amp[], int max_len);
SPAN_DECLARE_NONSTD(int) v18_tx(v18_state_t *s, int16_t amp[], int max_len);
/*! Process a block of received V.18 audio samples.
\brief Process a block of received V.18 audio samples.
@@ -108,7 +108,7 @@ SPAN_DECLARE(int) v18_tx(v18_state_t *s, int16_t amp[], int max_len);
\param amp The audio sample buffer.
\param len The number of samples in the buffer.
*/
SPAN_DECLARE(int) v18_rx(v18_state_t *s, const int16_t amp[], int len);
SPAN_DECLARE_NONSTD(int) v18_rx(v18_state_t *s, const int16_t amp[], int len);
/*! \brief Put a string to a V.18 context's input buffer.
\param s The V.18 context.
@@ -116,7 +116,8 @@ SPAN_DECLARE(int) v18_rx(v18_state_t *s, const int16_t amp[], int len);
\param len The length of the string. If negative, the string is
assumed to be a NULL terminated string.
\return The number of characters actually added. This may be less than the
length of the digit string, if the buffer fills up. */
length of the digit string, if the buffer fills up. If the string is
invalid, this function will return -1. */
SPAN_DECLARE(int) v18_put(v18_state_t *s, const char msg[], int len);
/*! Convert a text string to a V.18 DTMF string.
+3 -3
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v22bis.h,v 1.42 2009/04/29 12:37:45 steveu Exp $
* $Id: v22bis.h,v 1.43 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
@@ -87,7 +87,7 @@ extern "C"
\param amp The audio sample buffer.
\param len The number of samples in the buffer.
\return The number of samples unprocessed. */
SPAN_DECLARE(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int len);
SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int len);
/*! Fake processing of a missing block of received V.22bis modem audio samples.
(e.g due to packet loss).
@@ -135,7 +135,7 @@ SPAN_DECLARE(void) v22bis_rx_set_qam_report_handler(v22bis_state_t *s, qam_repor
\param amp The audio sample buffer.
\param len The number of samples to be generated.
\return The number of samples actually generated. */
SPAN_DECLARE(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len);
SPAN_DECLARE_NONSTD(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len);
/*! Adjust a V.22bis modem transmit context's power output.
\brief Adjust a V.22bis modem transmit context's output power.
+1 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v27ter_rx.h,v 1.59 2009/04/12 09:12:11 steveu Exp $
* $Id: v27ter_rx.h,v 1.60 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
+1 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v27ter_tx.h,v 1.41 2009/04/12 09:12:11 steveu Exp $
* $Id: v27ter_tx.h,v 1.42 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
+1 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v29rx.h,v 1.70 2009/04/12 09:12:11 steveu Exp $
* $Id: v29rx.h,v 1.71 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
+1 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v29tx.h,v 1.39 2009/04/12 09:12:11 steveu Exp $
* $Id: v29tx.h,v 1.40 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
+3 -3
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v8.h,v 1.27 2009/02/03 16:28:41 steveu Exp $
* $Id: v8.h,v 1.28 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
@@ -155,7 +155,7 @@ SPAN_DECLARE(logging_state_t *) v8_get_logging_state(v8_state_t *s);
\param max_len The number of samples to be generated.
\return The number of samples actually generated.
*/
SPAN_DECLARE(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len);
SPAN_DECLARE_NONSTD(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len);
/*! Process a block of received V.8 audio samples.
\brief Process a block of received V.8 audio samples.
@@ -163,7 +163,7 @@ SPAN_DECLARE(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len);
\param amp The audio sample buffer.
\param len The number of samples in the buffer.
*/
SPAN_DECLARE(int) v8_rx(v8_state_t *s, const int16_t *amp, int len);
SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len);
/*! Log the list of supported modulations.
\brief Log the list of supported modulations.
+3 -3
View File
@@ -30,9 +30,9 @@
/* The date and time of the version are in UTC form. */
#define SPANDSP_RELEASE_DATE 20090502
#define SPANDSP_RELEASE_TIME 044449
#define SPANDSP_RELEASE_DATETIME_STRING "20090502 044449"
#define SPANDSP_RELEASE_DATE 20090602
#define SPANDSP_RELEASE_TIME 160509
#define SPANDSP_RELEASE_DATETIME_STRING "20090602 160509"
#endif
/*- End of file ------------------------------------------------------------*/
+52 -27
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: t30.c,v 1.298 2009/04/30 18:46:14 steveu Exp $
* $Id: t30.c,v 1.301 2009/05/25 12:37:38 steveu Exp $
*/
/*! \file */
@@ -319,6 +319,11 @@ received. If the timer T8 expires, a DCN command is transmitted for call release
variable. */
#define PPR_LIMIT_BEFORE_CTC_OR_EOR 4
/* HDLC message header byte values */
#define ADDRESS_FIELD 0xFF
#define CONTROL_FIELD_NON_FINAL_FRAME 0x03
#define CONTROL_FIELD_FINAL_FRAME 0x13
enum
{
TIMER_IS_IDLE = 0,
@@ -660,8 +665,8 @@ static int get_partial_ecm_page(t30_state_t *s)
for (i = 0; i < 256; i++)
{
s->ecm_len[i] = -1;
s->ecm_data[i][0] = 0xFF;
s->ecm_data[i][1] = 0x03;
s->ecm_data[i][0] = ADDRESS_FIELD;
s->ecm_data[i][1] = CONTROL_FIELD_NON_FINAL_FRAME;
s->ecm_data[i][2] = T4_FCD;
/* These frames contain a frame sequence number within the partial page (one octet) followed
by some image data. */
@@ -749,8 +754,8 @@ static int send_next_ecm_frame(t30_state_t *s)
/* The RCP frame is an odd man out, as its a simple 1 byte control
frame, but is specified to not have the final bit set. It doesn't
seem to have the DIS received bit set, either. */
frame[0] = 0xFF;
frame[1] = 0x03;
frame[0] = ADDRESS_FIELD;
frame[1] = CONTROL_FIELD_NON_FINAL_FRAME;
frame[2] = T4_RCP;
send_frame(s, frame, 3);
/* In case we are just after a CTC/CTR exchange, which kicked us back to long training */
@@ -806,8 +811,8 @@ static void send_simple_frame(t30_state_t *s, int type)
uint8_t frame[3];
/* The simple command/response frames are always final frames */
frame[0] = 0xFF;
frame[1] = 0x13;
frame[0] = ADDRESS_FIELD;
frame[1] = CONTROL_FIELD_FINAL_FRAME;
frame[2] = (uint8_t) (type | s->dis_received);
send_frame(s, frame, 3);
}
@@ -821,8 +826,8 @@ static void send_20digit_msg_frame(t30_state_t *s, int cmd, char *msg)
len = strlen(msg);
p = 0;
frame[p++] = 0xFF;
frame[p++] = 0x03;
frame[p++] = ADDRESS_FIELD;
frame[p++] = CONTROL_FIELD_NON_FINAL_FRAME;
frame[p++] = (uint8_t) (cmd | s->dis_received);
while (len > 0)
frame[p++] = msg[--len];
@@ -838,8 +843,8 @@ static int send_nsf_frame(t30_state_t *s)
if (s->tx_info.nsf && s->tx_info.nsf_len)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Sending user supplied NSF - %d octets\n", s->tx_info.nsf_len);
s->tx_info.nsf[0] = 0xFF;
s->tx_info.nsf[1] = 0x03;
s->tx_info.nsf[0] = ADDRESS_FIELD;
s->tx_info.nsf[1] = CONTROL_FIELD_NON_FINAL_FRAME;
s->tx_info.nsf[2] = (uint8_t) (T30_NSF | s->dis_received);
send_frame(s, s->tx_info.nsf, s->tx_info.nsf_len + 3);
return TRUE;
@@ -854,8 +859,8 @@ static int send_nss_frame(t30_state_t *s)
if (s->tx_info.nss && s->tx_info.nss_len)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Sending user supplied NSS - %d octets\n", s->tx_info.nss_len);
s->tx_info.nss[0] = 0xFF;
s->tx_info.nss[1] = 0x03;
s->tx_info.nss[0] = ADDRESS_FIELD;
s->tx_info.nss[1] = CONTROL_FIELD_NON_FINAL_FRAME;
s->tx_info.nss[2] = (uint8_t) (T30_NSS | s->dis_received);
send_frame(s, s->tx_info.nss, s->tx_info.nss_len + 3);
return TRUE;
@@ -870,8 +875,8 @@ static int send_nsc_frame(t30_state_t *s)
if (s->tx_info.nsc && s->tx_info.nsc_len)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Sending user supplied NSC - %d octets\n", s->tx_info.nsc_len);
s->tx_info.nsc[0] = 0xFF;
s->tx_info.nsc[1] = 0x03;
s->tx_info.nsc[0] = ADDRESS_FIELD;
s->tx_info.nsc[1] = CONTROL_FIELD_NON_FINAL_FRAME;
s->tx_info.nsc[2] = (uint8_t) (T30_NSC | s->dis_received);
send_frame(s, s->tx_info.nsc, s->tx_info.nsc_len + 3);
return TRUE;
@@ -1033,8 +1038,8 @@ static int send_pps_frame(t30_state_t *s)
{
uint8_t frame[7];
frame[0] = 0xFF;
frame[1] = 0x13;
frame[0] = ADDRESS_FIELD;
frame[1] = CONTROL_FIELD_FINAL_FRAME;
frame[2] = (uint8_t) (T30_PPS | s->dis_received);
frame[3] = (s->ecm_at_page_end) ? ((uint8_t) (s->next_tx_step | s->dis_received)) : T30_NULL;
frame[4] = (uint8_t) (s->ecm_tx_page & 0xFF);
@@ -1074,8 +1079,8 @@ int t30_build_dis_or_dtc(t30_state_t *s)
it is sent. It might also be edited if the application changes our
capabilities (e.g. disabling fine mode). Right now we set up all the
unchanging stuff about what we are capable of doing. */
s->local_dis_dtc_frame[0] = 0xFF;
s->local_dis_dtc_frame[1] = 0x13;
s->local_dis_dtc_frame[0] = ADDRESS_FIELD;
s->local_dis_dtc_frame[1] = CONTROL_FIELD_FINAL_FRAME;
s->local_dis_dtc_frame[2] = (uint8_t) (T30_DIS | s->dis_received);
for (i = 3; i < 19; i++)
s->local_dis_dtc_frame[i] = 0x00;
@@ -1258,8 +1263,8 @@ static int build_dcs(t30_state_t *s)
/* Make a DCS frame based on local issues and the latest received DIS/DTC frame. Negotiate
the result based on what both parties can do. */
s->dcs_frame[0] = 0xFF;
s->dcs_frame[1] = 0x13;
s->dcs_frame[0] = ADDRESS_FIELD;
s->dcs_frame[1] = CONTROL_FIELD_FINAL_FRAME;
s->dcs_frame[2] = (uint8_t) (T30_DCS | s->dis_received);
for (i = 3; i < 19; i++)
s->dcs_frame[i] = 0x00;
@@ -1608,6 +1613,7 @@ static void send_dcn(t30_state_t *s)
static void return_to_phase_b(t30_state_t *s, int with_fallback)
{
/* This is what we do after things like T30_EOM is exchanged. */
#if 0
if (step_fallback_entry(s) < 0)
{
/* We have fallen back as far as we can go. Give up. */
@@ -1622,6 +1628,12 @@ static void return_to_phase_b(t30_state_t *s, int with_fallback)
else
set_state(s, T30_STATE_R);
}
#else
if (s->calling_party)
set_state(s, T30_STATE_T);
else
set_state(s, T30_STATE_R);
#endif
}
/*- End of function --------------------------------------------------------*/
@@ -2309,8 +2321,8 @@ static int send_deferred_pps_response(t30_state_t *s)
{
/* We need to send the PPR frame we have created, to try to fill in the missing/bad data. */
set_state(s, T30_STATE_F_POST_RCP_PPR);
s->ecm_frame_map[0] = 0xFF;
s->ecm_frame_map[1] = 0x13;
s->ecm_frame_map[0] = ADDRESS_FIELD;
s->ecm_frame_map[1] = CONTROL_FIELD_FINAL_FRAME;
s->ecm_frame_map[2] = (uint8_t) (T30_PPR | s->dis_received);
send_frame(s, s->ecm_frame_map, 3 + 32);
}
@@ -2474,8 +2486,8 @@ static void process_rx_ppr(t30_state_t *s, const uint8_t *msg, int len)
{
set_state(s, T30_STATE_IV_EOR);
queue_phase(s, T30_PHASE_D_TX);
frame[0] = 0xFF;
frame[1] = 0x13;
frame[0] = ADDRESS_FIELD;
frame[1] = CONTROL_FIELD_FINAL_FRAME;
frame[2] = (uint8_t) (T30_EOR | s->dis_received);
frame[3] = (s->ecm_at_page_end) ? ((uint8_t) (s->next_tx_step | s->dis_received)) : T30_NULL;
span_log(&s->logging, SPAN_LOG_FLOW, "Sending EOR + %s\n", t30_frametype(frame[3]));
@@ -5489,7 +5501,7 @@ SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t *msg, i
*/
if (!ok)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Bad CRC received\n");
span_log(&s->logging, SPAN_LOG_FLOW, "Bad HDLC CRC received\n");
if (s->phase != T30_PHASE_C_ECM_RX)
{
/* We either force a resend, or we wait until a resend occurs through a timeout. */
@@ -5502,6 +5514,13 @@ SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t *msg, i
queue_phase(s, T30_PHASE_D_TX);
send_simple_frame(s, T30_CRP);
}
else
{
/* Cancel the command or response timer (if one is running) */
span_log(&s->logging, SPAN_LOG_FLOW, "Bad CRC and timer is %d\n", s->timer_t2_t4_is);
if (s->timer_t2_t4_is == TIMER_IS_T2A)
timer_t2_t4_stop(s);
}
}
return;
}
@@ -5509,11 +5528,17 @@ SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t *msg, i
if (len < 3)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Bad HDLC frame length - %d\n", len);
/* Cancel the command or response timer (if one is running) */
timer_t2_t4_stop(s);
return;
}
if (msg[0] != 0xFF || !(msg[1] == 0x03 || msg[1] == 0x13))
if (msg[0] != ADDRESS_FIELD
||
!(msg[1] == CONTROL_FIELD_NON_FINAL_FRAME || msg[1] == CONTROL_FIELD_FINAL_FRAME))
{
span_log(&s->logging, SPAN_LOG_FLOW, "Bad HDLC frame header - %02x %02x\n", msg[0], msg[1]);
/* Cancel the command or response timer (if one is running) */
timer_t2_t4_stop(s);
return;
}
s->rx_frame_received = TRUE;
+2 -2
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: t35.c,v 1.30 2009/04/12 09:12:10 steveu Exp $
* $Id: t35.c,v 1.31 2009/05/16 03:34:45 steveu Exp $
*/
/*
@@ -525,7 +525,7 @@ static const model_data_t Muratec48[] =
static const nsf_data_t known_nsf[] =
{
/* Japan */
{"\x00\x00\x00", 3, "unknown - indeterminate", TRUE, NULL},
{"\x00\x00\x00", 3, "Unknown - indeterminate", TRUE, NULL},
{"\x00\x00\x01", 3, "Anjitsu", FALSE, NULL},
{"\x00\x00\x02", 3, "Nippon Telephone", FALSE, NULL},
{"\x00\x00\x05", 3, "Mitsuba Electric", FALSE, NULL},
+35 -25
View File
@@ -23,7 +23,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: t38_gateway.c,v 1.162 2009/04/12 14:18:02 steveu Exp $
* $Id: t38_gateway.c,v 1.163 2009/05/16 03:34:45 steveu Exp $
*/
/*! \file */
@@ -152,11 +152,12 @@ enum
enum
{
TCF_MODE_PREDICTABLE_MODEM_START_OFF = 0,
TCF_MODE_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED,
TCF_MODE_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN,
TCF_MODE_PREDICTABLE_MODEM_START_PAST_V21_MODEM,
TCF_MODE_PREDICTABLE_MODEM_START_BEGIN
TIMED_MODE_STARTUP = 0,
TIMED_MODE_IDLE,
TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED,
TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN,
TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM,
TIMED_MODE_TCF_PREDICTABLE_MODEM_START_BEGIN,
};
/*! The maximum number of bytes to be zapped, in order to corrupt NSF,
@@ -765,7 +766,7 @@ static void monitor_control_messages(t38_gateway_state_t *s,
if (len < 3)
return;
/*endif*/
s->core.tcf_mode_predictable_modem_start = TCF_MODE_PREDICTABLE_MODEM_START_OFF;
s->core.timed_mode = TIMED_MODE_IDLE;
switch (buf[2])
{
case T30_CFR:
@@ -822,7 +823,7 @@ static void monitor_control_messages(t38_gateway_state_t *s,
s->core.image_data_mode = FALSE;
s->core.short_train = FALSE;
if (from_modem)
s->core.tcf_mode_predictable_modem_start = TCF_MODE_PREDICTABLE_MODEM_START_BEGIN;
s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_BEGIN;
/*endif*/
break;
case T30_PPS:
@@ -1510,14 +1511,14 @@ static void non_ecm_rx_status(void *user_data, int status)
switch (status)
{
case SIG_STATUS_TRAINING_IN_PROGRESS:
if (s->core.tcf_mode_predictable_modem_start == TCF_MODE_PREDICTABLE_MODEM_START_OFF)
if (s->core.timed_mode == TIMED_MODE_IDLE)
{
announce_training(s);
}
else
{
if (s->core.tcf_mode_predictable_modem_start == TCF_MODE_PREDICTABLE_MODEM_START_PAST_V21_MODEM)
s->core.tcf_mode_predictable_modem_start = TCF_MODE_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN;
if (s->core.timed_mode == TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM)
s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN;
else
s->core.samples_to_timeout = ms_to_samples(500);
set_fast_packetisation(s);
@@ -1529,7 +1530,7 @@ static void non_ecm_rx_status(void *user_data, int status)
/* The modem is now trained */
s->audio.modems.rx_signal_present = TRUE;
s->audio.modems.rx_trained = TRUE;
s->core.tcf_mode_predictable_modem_start = TCF_MODE_PREDICTABLE_MODEM_START_OFF;
s->core.timed_mode = TIMED_MODE_IDLE;
s->core.samples_to_timeout = 0;
to_t38_buffer_init(&s->core.to_t38);
break;
@@ -1546,7 +1547,7 @@ static void non_ecm_rx_status(void *user_data, int status)
case T38_DATA_V27TER_4800:
case T38_DATA_V29_7200:
case T38_DATA_V29_9600:
if (s->core.tcf_mode_predictable_modem_start != TCF_MODE_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED)
if (s->core.timed_mode != TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED)
{
/* TODO: If the carrier really did fall for good during the 500ms TEP blocking timeout, we
won't declare the no-signal condition. */
@@ -1716,7 +1717,7 @@ static void hdlc_rx_status(hdlc_rx_state_t *t, int status)
t->framing_ok_announced = FALSE;
}
restart_rx_modem(s);
if (s->core.tcf_mode_predictable_modem_start == TCF_MODE_PREDICTABLE_MODEM_START_BEGIN)
if (s->core.timed_mode == TIMED_MODE_TCF_PREDICTABLE_MODEM_START_BEGIN)
{
/* If we are doing TCF, we need to announce the fast carrier training very
quickly, to ensure it starts 75+-20ms after the HDLC carrier ends. Waiting until
@@ -1724,7 +1725,7 @@ static void hdlc_rx_status(hdlc_rx_state_t *t, int status)
the end of the V.21 carrier, in anticipation of its arrival. If we announce it,
and it doesn't arrive, we will worry about that later. */
s->core.samples_to_timeout = ms_to_samples(75);
s->core.tcf_mode_predictable_modem_start = TCF_MODE_PREDICTABLE_MODEM_START_PAST_V21_MODEM;
s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM;
}
break;
default:
@@ -2001,28 +2002,35 @@ SPAN_DECLARE(int) t38_gateway_rx(t38_gateway_state_t *s, int16_t amp[], int len)
#if defined(LOG_FAX_AUDIO)
if (s->audio.modems.audio_rx_log >= 0)
write(s->audio.modems.audio_rx_log, amp, len*sizeof(int16_t));
/*endif*/
#endif
if (s->core.samples_to_timeout > 0)
{
if ((s->core.samples_to_timeout -= len) <= 0)
{
switch (s->core.tcf_mode_predictable_modem_start)
switch (s->core.timed_mode)
{
case TCF_MODE_PREDICTABLE_MODEM_START_PAST_V21_MODEM:
case TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM:
/* Timed announcement of training, 75ms after the DCS carrier fell. */
s->core.tcf_mode_predictable_modem_start = TCF_MODE_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED;
s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED;
announce_training(s);
break;
case TCF_MODE_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN:
case TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN:
/* Timed announcement of training, 75ms after the DCS carrier fell. */
/* Use a timeout to ride over TEP, if it is present */
s->core.samples_to_timeout = ms_to_samples(500);
s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED;
announce_training(s);
break;
case TCF_MODE_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED:
s->core.tcf_mode_predictable_modem_start = TCF_MODE_PREDICTABLE_MODEM_START_OFF;
case TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED:
s->core.timed_mode = TIMED_MODE_IDLE;
span_log(&s->logging, SPAN_LOG_FLOW, "TEP jamming expired\n");
break;
case TIMED_MODE_STARTUP:
/* Ensure a no-signal condition goes out the moment the received audio starts */
t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL, s->t38x.t38.indicator_tx_count);
s->core.timed_mode = TIMED_MODE_IDLE;
break;
}
/*endswitch*/
}
@@ -2129,10 +2137,10 @@ SPAN_DECLARE(void) t38_gateway_set_supported_modems(t38_gateway_state_t *s, int
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) t38_gateway_set_nsx_suppression(t38_gateway_state_t *s,
const uint8_t *from_t38,
int from_t38_len,
const uint8_t *from_modem,
int from_modem_len)
const uint8_t *from_t38,
int from_t38_len,
const uint8_t *from_modem,
int from_modem_len)
{
s->t38x.suppress_nsx_len[0] = (from_t38_len < 0 || from_t38_len < MAX_NSX_SUPPRESSION) ? (from_t38_len + 3) : 0;
s->t38x.suppress_nsx_len[1] = (from_modem_len < 0 || from_modem_len < MAX_NSX_SUPPRESSION) ? (from_modem_len + 3) : 0;
@@ -2232,6 +2240,8 @@ SPAN_DECLARE(t38_gateway_state_t *) t38_gateway_init(t38_gateway_state_t *s,
s->core.ecm_allowed = FALSE;
t38_non_ecm_buffer_init(&s->core.non_ecm_to_modem, FALSE, 0);
restart_rx_modem(s);
s->core.timed_mode = TIMED_MODE_STARTUP;
s->core.samples_to_timeout = 1;
#if defined(LOG_FAX_AUDIO)
{
char buf[100 + 1];
+1 -1
View File
@@ -24,7 +24,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: t4.c,v 1.130 2009/04/12 09:12:10 steveu Exp $
* $Id: t4.c,v 1.131 2009/05/16 03:34:45 steveu Exp $
*/
/*
+1 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: tone_generate.c,v 1.52 2009/04/12 09:12:10 steveu Exp $
* $Id: tone_generate.c,v 1.53 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,314 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* v17_v32bis_tx_constellation_maps.h - ITU V.17 and V.32bis modems
* transmit part.
* Constellation mapping.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2004 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v17_v32bis_tx_constellation_maps.h,v 1.1 2009/06/02 11:51:57 steveu Exp $
*/
#if defined(SPANDSP_USE_FIXED_POINTx)
static const complexi16_t v17_v32bis_14400_constellation[128] =
#else
static const complexf_t v17_v32bis_14400_constellation[128] =
#endif
{
{-8, -3}, /* 0x00 */
{ 9, 2}, /* 0x01 */
{ 2, -9}, /* 0x02 */
{-3, 8}, /* 0x03 */
{ 8, 3}, /* 0x04 */
{-9, -2}, /* 0x05 */
{-2, 9}, /* 0x06 */
{ 3, -8}, /* 0x07 */
{-8, 1}, /* 0x08 */
{ 9, -2}, /* 0x09 */
{-2, -9}, /* 0x0A */
{ 1, 8}, /* 0x0B */
{ 8, -1}, /* 0x0C */
{-9, 2}, /* 0x0D */
{ 2, 9}, /* 0x0E */
{-1, -8}, /* 0x0F */
{-4, -3}, /* 0x10 */
{ 5, 2}, /* 0x11 */
{ 2, -5}, /* 0x12 */
{-3, 4}, /* 0x13 */
{ 4, 3}, /* 0x14 */
{-5, -2}, /* 0x15 */
{-2, 5}, /* 0x16 */
{ 3, -4}, /* 0x17 */
{-4, 1}, /* 0x18 */
{ 5, -2}, /* 0x19 */
{-2, -5}, /* 0x1A */
{ 1, 4}, /* 0x1B */
{ 4, -1}, /* 0x1C */
{-5, 2}, /* 0x1D */
{ 2, 5}, /* 0x1E */
{-1, -4}, /* 0x1F */
{ 4, -3}, /* 0x20 */
{-3, 2}, /* 0x21 */
{ 2, 3}, /* 0x22 */
{-3, -4}, /* 0x23 */
{-4, 3}, /* 0x24 */
{ 3, -2}, /* 0x25 */
{-2, -3}, /* 0x26 */
{ 3, 4}, /* 0x27 */
{ 4, 1}, /* 0x28 */
{-3, -2}, /* 0x29 */
{-2, 3}, /* 0x2A */
{ 1, -4}, /* 0x2B */
{-4, -1}, /* 0x2C */
{ 3, 2}, /* 0x2D */
{ 2, -3}, /* 0x2E */
{-1, 4}, /* 0x2F */
{ 0, -3}, /* 0x30 */
{ 1, 2}, /* 0x31 */
{ 2, -1}, /* 0x32 */
{-3, 0}, /* 0x33 */
{ 0, 3}, /* 0x34 */
{-1, -2}, /* 0x35 */
{-2, 1}, /* 0x36 */
{ 3, 0}, /* 0x37 */
{ 0, 1}, /* 0x38 */
{ 1, -2}, /* 0x39 */
{-2, -1}, /* 0x3A */
{ 1, 0}, /* 0x3B */
{ 0, -1}, /* 0x3C */
{-1, 2}, /* 0x3D */
{ 2, 1}, /* 0x3E */
{-1, 0}, /* 0x3F */
{ 8, -3}, /* 0x40 */
{-7, 2}, /* 0x41 */
{ 2, 7}, /* 0x42 */
{-3, -8}, /* 0x43 */
{-8, 3}, /* 0x44 */
{ 7, -2}, /* 0x45 */
{-2, -7}, /* 0x46 */
{ 3, 8}, /* 0x47 */
{ 8, 1}, /* 0x48 */
{-7, -2}, /* 0x49 */
{-2, 7}, /* 0x4A */
{ 1, -8}, /* 0x4B */
{-8, -1}, /* 0x4C */
{ 7, 2}, /* 0x4D */
{ 2, -7}, /* 0x4E */
{-1, 8}, /* 0x4F */
{-4, -7}, /* 0x50 */
{ 5, 6}, /* 0x51 */
{ 6, -5}, /* 0x52 */
{-7, 4}, /* 0x53 */
{ 4, 7}, /* 0x54 */
{-5, -6}, /* 0x55 */
{-6, 5}, /* 0x56 */
{ 7, -4}, /* 0x57 */
{-4, 5}, /* 0x58 */
{ 5, -6}, /* 0x59 */
{-6, -5}, /* 0x5A */
{ 5, 4}, /* 0x5B */
{ 4, -5}, /* 0x5C */
{-5, 6}, /* 0x5D */
{ 6, 5}, /* 0x5E */
{-5, -4}, /* 0x5F */
{ 4, -7}, /* 0x60 */
{-3, 6}, /* 0x61 */
{ 6, 3}, /* 0x62 */
{-7, -4}, /* 0x63 */
{-4, 7}, /* 0x64 */
{ 3, -6}, /* 0x65 */
{-6, -3}, /* 0x66 */
{ 7, 4}, /* 0x67 */
{ 4, 5}, /* 0x68 */
{-3, -6}, /* 0x69 */
{-6, 3}, /* 0x6A */
{ 5, -4}, /* 0x6B */
{-4, -5}, /* 0x6C */
{ 3, 6}, /* 0x6D */
{ 6, -3}, /* 0x6E */
{-5, 4}, /* 0x6F */
{ 0, -7}, /* 0x70 */
{ 1, 6}, /* 0x71 */
{ 6, -1}, /* 0x72 */
{-7, 0}, /* 0x73 */
{ 0, 7}, /* 0x74 */
{-1, -6}, /* 0x75 */
{-6, 1}, /* 0x76 */
{ 7, 0}, /* 0x77 */
{ 0, 5}, /* 0x78 */
{ 1, -6}, /* 0x79 */
{-6, -1}, /* 0x7A */
{ 5, 0}, /* 0x7B */
{ 0, -5}, /* 0x7C */
{-1, 6}, /* 0x7D */
{ 6, 1}, /* 0x7E */
{-5, 0} /* 0x7F */
};
#if defined(SPANDSP_USE_FIXED_POINTx)
static const complexi16_t v17_v32bis_12000_constellation[64] =
#else
static const complexf_t v17_v32bis_12000_constellation[64] =
#endif
{
{ 7, 1}, /* 0x00 */
{-5, -1}, /* 0x01 */
{-1, 5}, /* 0x02 */
{ 1, -7}, /* 0x03 */
{-7, -1}, /* 0x04 */
{ 5, 1}, /* 0x05 */
{ 1, -5}, /* 0x06 */
{-1, 7}, /* 0x07 */
{ 3, -3}, /* 0x08 */
{-1, 3}, /* 0x09 */
{ 3, 1}, /* 0x0A */
{-3, -3}, /* 0x0B */
{-3, 3}, /* 0x0C */
{ 1, -3}, /* 0x0D */
{-3, -1}, /* 0x0E */
{ 3, 3}, /* 0x0F */
{ 7, -7}, /* 0x10 */
{-5, 7}, /* 0x11 */
{ 7, 5}, /* 0x12 */
{-7, -7}, /* 0x13 */
{-7, 7}, /* 0x14 */
{ 5, -7}, /* 0x15 */
{-7, -5}, /* 0x16 */
{ 7, 7}, /* 0x17 */
{-1, -7}, /* 0x18 */
{ 3, 7}, /* 0x19 */
{ 7, -3}, /* 0x1A */
{-7, 1}, /* 0x1B */
{ 1, 7}, /* 0x1C */
{-3, -7}, /* 0x1D */
{-7, 3}, /* 0x1E */
{ 7, -1}, /* 0x1F */
{ 3, 5}, /* 0x20 */
{-1, -5}, /* 0x21 */
{-5, 1}, /* 0x22 */
{ 5, -3}, /* 0x23 */
{-3, -5}, /* 0x24 */
{ 1, 5}, /* 0x25 */
{ 5, -1}, /* 0x26 */
{-5, 3}, /* 0x27 */
{-1, 1}, /* 0x28 */
{ 3, -1}, /* 0x29 */
{-1, -3}, /* 0x2A */
{ 1, 1}, /* 0x2B */
{ 1, -1}, /* 0x2C */
{-3, 1}, /* 0x2D */
{ 1, 3}, /* 0x2E */
{-1, -1}, /* 0x2F */
{-5, 5}, /* 0x30 */
{ 7, -5}, /* 0x31 */
{-5, -7}, /* 0x32 */
{ 5, 5}, /* 0x33 */
{ 5, -5}, /* 0x34 */
{-7, 5}, /* 0x35 */
{ 5, 7}, /* 0x36 */
{-5, -5}, /* 0x37 */
{-5, -3}, /* 0x38 */
{ 7, 3}, /* 0x39 */
{ 3, -7}, /* 0x3A */
{-3, 5}, /* 0x3B */
{ 5, 3}, /* 0x3C */
{-7, -3}, /* 0x3D */
{-3, 7}, /* 0x3E */
{ 3, -5} /* 0x3F */
};
#if defined(SPANDSP_USE_FIXED_POINTx)
static const complexi16_t v17_v32bis_9600_constellation[32] =
#else
static const complexf_t v17_v32bis_9600_constellation[32] =
#endif
{
{-8, 2}, /* 0x00 */
{-6, -4}, /* 0x01 */
{-4, 6}, /* 0x02 */
{ 2, 8}, /* 0x03 */
{ 8, -2}, /* 0x04 */
{ 6, 4}, /* 0x05 */
{ 4, -6}, /* 0x06 */
{-2, -8}, /* 0x07 */
{ 0, 2}, /* 0x08 */
{-6, 4}, /* 0x09 */
{ 4, 6}, /* 0x0A */
{ 2, 0}, /* 0x0B */
{ 0, -2}, /* 0x0C */
{ 6, -4}, /* 0x0D */
{-4, -6}, /* 0x0E */
{-2, 0}, /* 0x0F */
{ 0, -6}, /* 0x10 */
{ 2, -4}, /* 0x11 */
{-4, -2}, /* 0x12 */
{-6, 0}, /* 0x13 */
{ 0, 6}, /* 0x14 */
{-2, 4}, /* 0x15 */
{ 4, 2}, /* 0x16 */
{ 6, 0}, /* 0x17 */
{ 8, 2}, /* 0x18 */
{ 2, 4}, /* 0x19 */
{ 4, -2}, /* 0x1A */
{ 2, -8}, /* 0x1B */
{-8, -2}, /* 0x1C */
{-2, -4}, /* 0x1D */
{-4, 2}, /* 0x1E */
{-2, 8} /* 0x1F */
};
#if defined(SPANDSP_USE_FIXED_POINTx)
static const complexi16_t v17_v32bis_7200_constellation[16] =
#else
static const complexf_t v17_v32bis_7200_constellation[16] =
#endif
{
{ 6, -6}, /* 0x00 */
{-2, 6}, /* 0x01 */
{ 6, 2}, /* 0x02 */
{-6, -6}, /* 0x03 */
{-6, 6}, /* 0x04 */
{ 2, -6}, /* 0x05 */
{-6, -2}, /* 0x06 */
{ 6, 6}, /* 0x07 */
{-2, 2}, /* 0x08 */
{ 6, -2}, /* 0x09 */
{-2, -6}, /* 0x0A */
{ 2, 2}, /* 0x0B */
{ 2, -2}, /* 0x0C */
{-6, 2}, /* 0x0D */
{ 2, 6}, /* 0x0E */
{-2, -2} /* 0x0F */
};
#if defined(SPANDSP_USE_FIXED_POINTx)
static const complexi16_t v17_v32bis_4800_constellation[4] =
#else
static const complexf_t v17_v32bis_4800_constellation[4] =
#endif
{
{-6, -2},
{ 2, -6},
{ 6, 2},
{-2, 6}
};
/*- End of file ------------------------------------------------------------*/
+83 -86
View File
@@ -23,7 +23,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v17rx.c,v 1.146 2009/04/21 13:59:07 steveu Exp $
* $Id: v17rx.c,v 1.149 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
@@ -64,12 +64,12 @@
#include "spandsp/private/logging.h"
#include "spandsp/private/v17rx.h"
#include "v17tx_constellation_maps.h"
#include "v17rx_constellation_maps.h"
#include "v17_v32bis_tx_constellation_maps.h"
#include "v17_v32bis_rx_constellation_maps.h"
#if defined(SPANDSP_USE_FIXED_POINT)
#include "v17rx_fixed_rrc.h"
#include "v17_v32bis_rx_fixed_rrc.h"
#else
#include "v17rx_floating_rrc.h"
#include "v17_v32bis_rx_floating_rrc.h"
#endif
/*! The nominal frequency of the carrier, in Hertz */
@@ -295,18 +295,6 @@ static int descramble(v17_rx_state_t *s, int in_bit)
}
/*- End of function --------------------------------------------------------*/
static __inline__ int find_quadrant(complexf_t *z)
{
int b1;
int b2;
/* Split the space along the two diagonals. */
b1 = (z->im > z->re);
b2 = (z->im < -z->re);
return (b2 << 1) | (b1 ^ b2);
}
/*- End of function --------------------------------------------------------*/
static void track_carrier(v17_rx_state_t *s, const complexf_t *z, const complexf_t *target)
{
float error;
@@ -1008,12 +996,81 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample)
}
/*- End of function --------------------------------------------------------*/
static __inline__ int signal_detect(v17_rx_state_t *s, int16_t amp)
{
int16_t diff;
int16_t x;
int32_t power;
/* There should be no DC in the signal, but sometimes there is.
We need to measure the power with the DC blocked, but not using
a slow to respond DC blocker. Use the most elementary HPF. */
x = amp >> 1;
/* There could be overflow here, but it isn't a problem in practice */
diff = x - s->last_sample;
s->last_sample = x;
power = power_meter_update(&(s->power), diff);
#if defined(IAXMODEM_STUFF)
/* Quick power drop fudge */
diff = abs(diff);
if (10*diff < s->high_sample)
{
if (++s->low_samples > 120)
{
power_meter_init(&(s->power), 4);
s->high_sample = 0;
s->low_samples = 0;
}
}
else
{
s->low_samples = 0;
if (diff > s->high_sample)
s->high_sample = diff;
}
#endif
if (s->signal_present > 0)
{
/* Look for power below turn-off threshold to turn the carrier off */
#if defined(IAXMODEM_STUFF)
if (s->carrier_drop_pending || power < s->carrier_off_power)
#else
if (power < s->carrier_off_power)
#endif
{
if (--s->signal_present <= 0)
{
/* Count down a short delay, to ensure we push the last
few bits through the filters before stopping. */
v17_rx_restart(s, s->bit_rate, s->short_train);
report_status_change(s, SIG_STATUS_CARRIER_DOWN);
return 0;
}
#if defined(IAXMODEM_STUFF)
/* Carrier has dropped, but the put_bit is pending the signal_present delay. */
s->carrier_drop_pending = TRUE;
#endif
}
}
else
{
/* Look for power exceeding turn-on threshold to turn the carrier on */
if (power < s->carrier_on_power)
return 0;
s->signal_present = 1;
#if defined(IAXMODEM_STUFF)
s->carrier_drop_pending = FALSE;
#endif
report_status_change(s, SIG_STATUS_CARRIER_UP);
}
return power;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE_NONSTD(int) v17_rx(v17_rx_state_t *s, const int16_t amp[], int len)
{
int i;
int step;
int16_t x;
int16_t diff;
complexf_t z;
complexf_t zz;
complexf_t sample;
@@ -1033,68 +1090,8 @@ SPAN_DECLARE_NONSTD(int) v17_rx(v17_rx_state_t *s, const int16_t amp[], int len)
if (++s->rrc_filter_step >= V17_RX_FILTER_STEPS)
s->rrc_filter_step = 0;
/* There should be no DC in the signal, but sometimes there is.
We need to measure the power with the DC blocked, but not using
a slow to respond DC blocker. Use the most elementary HPF. */
x = amp[i] >> 1;
/* There could be overflow here, but it isn't a problem in practice */
diff = x - s->last_sample;
power = power_meter_update(&(s->power), diff);
#if defined(IAXMODEM_STUFF)
/* Quick power drop fudge */
diff = abs(diff);
if (10*diff < s->high_sample)
{
if (++s->low_samples > 120)
{
power_meter_init(&(s->power), 4);
s->high_sample = 0;
s->low_samples = 0;
}
}
else
{
s->low_samples = 0;
if (diff > s->high_sample)
s->high_sample = diff;
}
#endif
s->last_sample = x;
if (s->signal_present)
{
/* Look for power below turnoff threshold to turn the carrier off */
#if defined(IAXMODEM_STUFF)
if (s->carrier_drop_pending || power < s->carrier_off_power)
#else
if (power < s->carrier_off_power)
#endif
{
if (--s->signal_present <= 0)
{
/* Count down a short delay, to ensure we push the last
few bits through the filters before stopping. */
v17_rx_restart(s, s->bit_rate, s->short_train);
report_status_change(s, SIG_STATUS_CARRIER_DOWN);
continue;
}
#if defined(IAXMODEM_STUFF)
/* Carrier has dropped, but the put_bit is
pending the signal_present delay. */
s->carrier_drop_pending = TRUE;
#endif
}
}
else
{
/* Look for power exceeding turnon threshold to turn the carrier on */
if (power < s->carrier_on_power)
continue;
s->signal_present = 1;
#if defined(IAXMODEM_STUFF)
s->carrier_drop_pending = FALSE;
#endif
report_status_change(s, SIG_STATUS_CARRIER_UP);
}
if ((power = signal_detect(s, amp[i])) == 0)
continue;
if (s->training_stage == TRAINING_STAGE_PARKED)
continue;
/* Only spend effort processing this data if the modem is not
@@ -1171,7 +1168,7 @@ SPAN_DECLARE(int) v17_rx_fillin(v17_rx_state_t *s, int len)
/* We want to sustain the current state (i.e carrier on<->carrier off), and
try to sustain the carrier phase. We should probably push the filters, as well */
span_log(&s->logging, SPAN_LOG_FLOW, "Fill-in %d samples\n", len);
if (!s->signal_present)
if (s->signal_present <= 0)
return 0;
if (s->training_stage == TRAINING_STAGE_PARKED)
return 0;
@@ -1220,22 +1217,22 @@ SPAN_DECLARE(int) v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_trai
switch (bit_rate)
{
case 14400:
s->constellation = v17_14400_constellation;
s->constellation = v17_v32bis_14400_constellation;
s->space_map = 0;
s->bits_per_symbol = 6;
break;
case 12000:
s->constellation = v17_12000_constellation;
s->constellation = v17_v32bis_12000_constellation;
s->space_map = 1;
s->bits_per_symbol = 5;
break;
case 9600:
s->constellation = v17_9600_constellation;
s->constellation = v17_v32bis_9600_constellation;
s->space_map = 2;
s->bits_per_symbol = 4;
break;
case 7200:
s->constellation = v17_7200_constellation;
s->constellation = v17_v32bis_7200_constellation;
s->space_map = 3;
s->bits_per_symbol = 3;
break;
+12 -12
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v17tx.c,v 1.73 2009/04/21 13:59:07 steveu Exp $
* $Id: v17tx.c,v 1.75 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
@@ -62,11 +62,11 @@
#define SPANDSP_USE_FIXED_POINTx
#endif
#include "v17tx_constellation_maps.h"
#include "v17_v32bis_tx_constellation_maps.h"
#if defined(SPANDSP_USE_FIXED_POINT)
#include "v17tx_fixed_rrc.h"
#include "v17_v32bis_tx_fixed_rrc.h"
#else
#include "v17tx_floating_rrc.h"
#include "v17_v32bis_tx_floating_rrc.h"
#endif
/*! The nominal frequency of the carrier, in Hertz */
@@ -135,7 +135,7 @@ static __inline__ complexf_t training_get(v17_tx_state_t *s)
if (s->training_step <= V17_TRAINING_SEG_TEP_B)
{
/* Optional segment: Unmodulated carrier (talker echo protection) */
return v17_abcd_constellation[0];
return v17_v32bis_4800_constellation[0];
}
if (s->training_step <= V17_TRAINING_SEG_1)
{
@@ -143,7 +143,7 @@ static __inline__ complexf_t training_get(v17_tx_state_t *s)
return zero;
}
/* Segment 1: ABAB... */
return v17_abcd_constellation[(s->training_step & 1) ^ 1];
return v17_v32bis_4800_constellation[(s->training_step & 1) ^ 1];
}
/* Segment 2: CDBA... */
/* Apply the scrambler */
@@ -155,7 +155,7 @@ static __inline__ complexf_t training_get(v17_tx_state_t *s)
/* Go straight to the ones test. */
s->training_step = V17_TRAINING_SEG_4;
}
return v17_abcd_constellation[s->constellation_state];
return v17_v32bis_4800_constellation[s->constellation_state];
}
/* Segment 3: Bridge... */
shift = ((s->training_step - V17_TRAINING_SEG_3 - 1) & 0x7) << 1;
@@ -163,7 +163,7 @@ static __inline__ complexf_t training_get(v17_tx_state_t *s)
bits = scramble(s, V17_BRIDGE_WORD >> shift);
bits = (bits << 1) | scramble(s, V17_BRIDGE_WORD >> (shift + 1));
s->constellation_state = (s->constellation_state + dibit_to_step[bits]) & 3;
return v17_abcd_constellation[s->constellation_state];
return v17_v32bis_4800_constellation[s->constellation_state];
}
/*- End of function --------------------------------------------------------*/
@@ -359,19 +359,19 @@ SPAN_DECLARE(int) v17_tx_restart(v17_tx_state_t *s, int bit_rate, int tep, int s
{
case 14400:
s->bits_per_symbol = 6;
s->constellation = v17_14400_constellation;
s->constellation = v17_v32bis_14400_constellation;
break;
case 12000:
s->bits_per_symbol = 5;
s->constellation = v17_12000_constellation;
s->constellation = v17_v32bis_12000_constellation;
break;
case 9600:
s->bits_per_symbol = 4;
s->constellation = v17_9600_constellation;
s->constellation = v17_v32bis_9600_constellation;
break;
case 7200:
s->bits_per_symbol = 3;
s->constellation = v17_7200_constellation;
s->constellation = v17_v32bis_7200_constellation;
break;
default:
return -1;
+72 -62
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v18.c,v 1.7 2009/04/26 07:00:38 steveu Exp $
* $Id: v18.c,v 1.10 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
@@ -379,50 +379,50 @@ SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch)
{
static const uint8_t conv[128] =
{
0x00, /* NUL */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* NUL */
0xFF, /* SOH */
0xFF, /* STX */
0xFF, /* ETX */
0xFF, /* EOT */
0xFF, /* ENQ */
0xFF, /* ACK */
0xFF, /* BEL */
0x00, /* BS */
0x44, /* HT >> SPACE */
0x42, /* LF */
0xFF, /* */
0xFF, /* */
0x42, /* VT >> LF */
0x42, /* FF >> LF */
0x48, /* CR */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* */
0xFF, /* SO */
0xFF, /* SI */
0xFF, /* DLE */
0xFF, /* DC1 */
0xFF, /* DC2 */
0xFF, /* DC3 */
0xFF, /* DC4 */
0xFF, /* NAK */
0xFF, /* SYN */
0xFF, /* ETB */
0xFF, /* CAN */
0xFF, /* EM */
0x99, /* SUB >> ? */
0xFF, /* ESC */
0x42, /* IS4 >> LF */
0x42, /* IS3 >> LF */
0x42, /* IS2 >> LF */
0x44, /* IS1 >> SPACE */
0x44, /* */
0xFF, /* ! */
0xFF, /* " */
0x94, /* # */
0x8D, /* ! */
0x91, /* " */
0x89, /* # >> $ */
0x89, /* $ */
0xFF, /* % */
0xFF, /* & */
0x85, /* ' */
0x9D, /* % >> / */
0x9A, /* & >> + */
0x8B, /* ' */
0x8F, /* ( */
0x92, /* ) */
0x8B, /* * */
0x91, /* + */
0x9C, /* * >> . */
0x9A, /* + */
0x8C, /* , */
0x83, /* - */
0x9C, /* . */
@@ -438,12 +438,12 @@ SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch)
0x86, /* 8 */
0x98, /* 9 */
0x8E, /* : */
0xFF, /* ; */
0xFF, /* < */
0x9E, /* = */
0xFF, /* > */
0x9E, /* ; */
0x8F, /* < >> )*/
0x94, /* = */
0x92, /* > >> ( */
0x99, /* ? */
0xFF, /* @ */
0x1D, /* @ >> X */
0x03, /* A */
0x19, /* B */
0x0E, /* C */
@@ -470,12 +470,12 @@ SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch)
0x1D, /* X */
0x15, /* Y */
0x11, /* Z */
0xFF, /* [ */
0xFF, /* \ */
0xFF, /* ] */
0x9B, /* ^ */
0xFF, /* _ */
0xFF, /* ` */
0x8F, /* [ >> (*/
0x9D, /* \ >> / */
0x92, /* ] >> ) */
0x8B, /* ^ >> ' */
0x44, /* _ >> Space */
0x8B, /* ` >> ' */
0x03, /* a */
0x19, /* b */
0x0E, /* c */
@@ -502,19 +502,29 @@ SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch)
0x1D, /* x */
0x15, /* y */
0x11, /* z */
0xFF, /* { */
0xFF, /* | */
0xFF, /* } */
0xFF, /* ~ */
0x8F, /* { >> ( */
0x8D, /* | >> ! */
0x92, /* } >> ) */
0x44, /* ~ >> Space */
0xFF, /* DEL */
};
uint16_t shift;
if (ch == 0x7F)
{
/* DLE is a special character meaning "force a
change to the letter character set */
shift = BAUDOT_LETTER_SHIFT;
return 0;
}
ch = conv[ch];
/* Is it a non-existant code? */
if (ch == 0xFF)
return 0;
/* Is it a code present in both character sets? */
if ((ch & 0x40))
return ch & 0x1F;
return 0x8000 | (ch & 0x1F);
/* Need to allow for a possible character set change. */
if ((ch & 0x80))
{
if (s->baudot_tx_shift == 1)
@@ -529,7 +539,7 @@ SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch)
s->baudot_tx_shift = 0;
shift = BAUDOT_LETTER_SHIFT;
}
return (shift << 5) | (ch & 0x1F);
return 0x8000 | (shift << 5) | (ch & 0x1F);
}
/*- End of function --------------------------------------------------------*/
@@ -537,8 +547,8 @@ SPAN_DECLARE(uint8_t) v18_decode_baudot(v18_state_t *s, uint8_t ch)
{
static const uint8_t conv[2][32] =
{
{"\000E\nA SIU\rDRJNFCKTZLWHYPQOBG^MXV^"},
{"\0003\n- '87\r$4*,*:(5+)2#6019?*^./=^"}
{"\bE\nA SIU\rDRJNFCKTZLWHYPQOBG^MXV^"},
{"\b3\n- -87\r$4',!:(5\")2=6019?+^./;^"}
};
switch (ch)
@@ -633,7 +643,7 @@ static void v18_tdd_put_async_byte(void *user_data, int byte)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) v18_tx(v18_state_t *s, int16_t *amp, int max_len)
SPAN_DECLARE_NONSTD(int) v18_tx(v18_state_t *s, int16_t *amp, int max_len)
{
int len;
int lenx;
@@ -661,7 +671,7 @@ SPAN_DECLARE(int) v18_tx(v18_state_t *s, int16_t *amp, int max_len)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) v18_rx(v18_state_t *s, const int16_t amp[], int len)
SPAN_DECLARE_NONSTD(int) v18_rx(v18_state_t *s, const int16_t amp[], int len)
{
switch (s->mode)
{
@@ -709,11 +719,11 @@ SPAN_DECLARE(int) v18_put(v18_state_t *s, const char msg[], int len)
buf[n++] = (uint8_t) (x & 0x1F);
/* TODO: Deal with out of space condition */
if (queue_write(&s->queue.queue, (const uint8_t *) buf, n) < 0)
return 0;
return i;
s->tx_signal_on = TRUE;
}
}
break;
return len;
case V18_MODE_DTMF:
break;
}
+2 -2
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v22bis_rx.c,v 1.67 2009/04/29 12:37:45 steveu Exp $
* $Id: v22bis_rx.c,v 1.68 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
@@ -691,7 +691,7 @@ static void process_half_baud(v22bis_state_t *s, const complexf_t *sample)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int len)
SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int len)
{
int i;
int j;
+2 -2
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v22bis_tx.c,v 1.62 2009/04/29 12:37:45 steveu Exp $
* $Id: v22bis_tx.c,v 1.63 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
@@ -448,7 +448,7 @@ static complexf_t getbaud(v22bis_state_t *s)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len)
SPAN_DECLARE_NONSTD(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len)
{
complexf_t x;
complexf_t z;
+119 -158
View File
@@ -23,7 +23,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v27ter_rx.c,v 1.126 2009/04/21 13:59:07 steveu Exp $
* $Id: v27ter_rx.c,v 1.130 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
@@ -522,13 +522,23 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t
{
0, 4
};
complexf_t z;
complexf_t zz;
#if defined(SPANDSP_USE_FIXED_POINTx)
complexf_t z1;
complexi16_t z;
const complexi16_t *target;
static const complexi16_t zero = {0, 0};
#else
complexf_t z;
const complexf_t *target;
static const complexf_t zero = {0.0f, 0.0f};
#endif
float p;
int i;
int j;
int32_t angle;
int32_t ang;
int constellation_state;
/* Add a sample to the equalizer's circular buffer, but don't calculate anything
at this time. */
@@ -550,16 +560,20 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t
z = equalizer_get(s);
//span_log(&s->logging, SPAN_LOG_FLOW, "Equalized symbol - %15.5f %15.5f\n", z.re, z.im);
constellation_state = s->constellation_state;
switch (s->training_stage)
{
case TRAINING_STAGE_NORMAL_OPERATION:
decode_baud(s, &z);
constellation_state = (s->bit_rate == 4800) ? s->constellation_state : (s->constellation_state << 1);
target = &v27ter_constellation[constellation_state];
break;
case TRAINING_STAGE_SYMBOL_ACQUISITION:
/* Allow time for the Gardner algorithm to settle the baud timing */
/* Don't start narrowing the bandwidth of the Gardner algorithm too early.
Some modems are a bit wobbly when they start sending the signal. Also, we start
this analysis before our filter buffers have completely filled. */
target = &zero;
if (++s->training_count >= 30)
{
s->gardner_step = 32;
@@ -570,6 +584,7 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t
break;
case TRAINING_STAGE_LOG_PHASE:
/* Record the current alternate phase angle */
target = &zero;
angle = arctan2(z.im, z.re);
s->angles[1] =
s->start_angles[1] = angle;
@@ -577,6 +592,7 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t
s->training_stage = TRAINING_STAGE_WAIT_FOR_HOP;
break;
case TRAINING_STAGE_WAIT_FOR_HOP:
target = &zero;
angle = arctan2(z.im, z.re);
/* Look for the initial ABAB sequence to display a phase reversal, which will
signal the start of the scrambled ABAB segment */
@@ -634,14 +650,15 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t
s->eq_buf[i] = complex_mulf(&s->eq_buf[i], &zz);
#endif
s->carrier_phase += angle;
s->gardner_step = 2;
/* We have just seen the first element of the scrambled sequence so skip it. */
s->training_bc = 1;
s->training_bc ^= descramble(s, 1);
descramble(s, 1);
descramble(s, 1);
constellation_state =
s->constellation_state = abab_pos[s->training_bc];
target = &v27ter_constellation[constellation_state];
s->training_count = 1;
s->training_stage = TRAINING_STAGE_TRAIN_ON_ABAB;
report_status_change(s, SIG_STATUS_TRAINING_IN_PROGRESS);
@@ -661,41 +678,40 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t
s->training_bc ^= descramble(s, 1);
descramble(s, 1);
descramble(s, 1);
constellation_state =
s->constellation_state = abab_pos[s->training_bc];
track_carrier(s, &z, &v27ter_constellation[s->constellation_state]);
tune_equalizer(s, &z, &v27ter_constellation[s->constellation_state]);
target = &v27ter_constellation[constellation_state];
track_carrier(s, &z, target);
tune_equalizer(s, &z, target);
#if defined(SPANDSP_USE_FIXED_POINTx)
s->carrier_track_i = 400 + (200000 - 400)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN;
s->carrier_track_p = 1000000 + (10000000 - 1000000)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN;
#else
s->carrier_track_i = 400.0f + (200000.0f - 400.0f)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN;
s->carrier_track_p = 1000000.0f + (10000000.0f - 1000000.0f)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN;
#endif
if (++s->training_count >= V27TER_TRAINING_SEG_5_LEN)
{
constellation_state = 4;
s->constellation_state = (s->bit_rate == 4800) ? 4 : 2;
s->training_count = 0;
s->training_stage = TRAINING_STAGE_TEST_ONES;
#if defined(SPANDSP_USE_FIXED_POINTx)
s->carrier_track_i = 400;
s->carrier_track_p = 1000000;
#else
s->carrier_track_i = 400.0f;
s->carrier_track_p = 1000000.0f;
#endif
}
break;
case TRAINING_STAGE_TEST_ONES:
decode_baud(s, &z);
constellation_state = (s->bit_rate == 4800) ? s->constellation_state : (s->constellation_state << 1);
target = &v27ter_constellation[constellation_state];
/* Measure the training error */
#if defined(SPANDSP_USE_FIXED_POINTx)
z1.re = z.re/(float) FP_FACTOR;
z1.im = z.im/(float) FP_FACTOR;
if (s->bit_rate == 4800)
zz = complex_subf(&z, &v27ter_constellation[s->constellation_state]);
else
zz = complex_subf(&z, &v27ter_constellation[s->constellation_state << 1]);
zz = complex_subf(&z, target);
zz = complex_subf(&z1, &zz);
s->training_error += powerf(&zz);
#else
if (s->bit_rate == 4800)
zz = complex_subf(&z, &v27ter_constellation[s->constellation_state]);
else
zz = complex_subf(&z, &v27ter_constellation[s->constellation_state << 1]);
zz = complex_subf(&z, target);
s->training_error += powerf(&zz);
#endif
if (++s->training_count >= V27TER_TRAINING_SEG_6_LEN)
@@ -728,8 +744,10 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t
}
break;
case TRAINING_STAGE_PARKED:
default:
/* We failed to train! */
/* Park here until the carrier drops. */
target = &zero;
break;
}
if (s->qam_report)
@@ -737,28 +755,92 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t
#if defined(SPANDSP_USE_FIXED_POINTx)
z1.re = z.re/(float) FP_FACTOR;
z1.im = z.im/(float) FP_FACTOR;
zz.re = v27ter_constellation[s->constellation_state].re;
zz.im = v27ter_constellation[s->constellation_state].im;
s->qam_report(s->qam_user_data,
&z1,
&zz,
s->constellation_state);
zz.re = target->re;
zz.im = target->im;
s->qam_report(s->qam_user_data, &z1, &zz, s->constellation_state);
#else
s->qam_report(s->qam_user_data,
&z,
&v27ter_constellation[s->constellation_state],
s->constellation_state);
s->qam_report(s->qam_user_data, &z, target, s->constellation_state);
#endif
}
}
/*- End of function --------------------------------------------------------*/
static __inline__ int signal_detect(v27ter_rx_state_t *s, int16_t amp)
{
int16_t diff;
int16_t x;
int32_t power;
/* There should be no DC in the signal, but sometimes there is.
We need to measure the power with the DC blocked, but not using
a slow to respond DC blocker. Use the most elementary HPF. */
x = amp >> 1;
/* There could be overflow here, but it isn't a problem in practice */
diff = x - s->last_sample;
s->last_sample = x;
power = power_meter_update(&(s->power), diff);
#if defined(IAXMODEM_STUFF)
/* Quick power drop fudge */
diff = abs(diff);
if (10*diff < s->high_sample)
{
if (++s->low_samples > 120)
{
power_meter_init(&(s->power), 4);
s->high_sample = 0;
s->low_samples = 0;
}
}
else
{
s->low_samples = 0;
if (diff > s->high_sample)
s->high_sample = diff;
}
#endif
//span_log(&s->logging, SPAN_LOG_FLOW, "Power = %f\n", power_meter_current_dbm0(&(s->power)));
if (s->signal_present > 0)
{
/* Look for power below turn-off threshold to turn the carrier off */
#if defined(IAXMODEM_STUFF)
if (s->carrier_drop_pending || power < s->carrier_off_power)
#else
if (power < s->carrier_off_power)
#endif
{
if (--s->signal_present <= 0)
{
/* Count down a short delay, to ensure we push the last
few bits through the filters before stopping. */
v27ter_rx_restart(s, s->bit_rate, FALSE);
report_status_change(s, SIG_STATUS_CARRIER_DOWN);
return 0;
}
#if defined(IAXMODEM_STUFF)
/* Carrier has dropped, but the put_bit is pending the signal_present delay. */
s->carrier_drop_pending = TRUE;
#endif
}
}
else
{
/* Look for power exceeding turn-on threshold to turn the carrier on */
if (power < s->carrier_on_power)
return 0;
s->signal_present = 1;
#if defined(IAXMODEM_STUFF)
s->carrier_drop_pending = FALSE;
#endif
report_status_change(s, SIG_STATUS_CARRIER_UP);
}
return power;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], int len)
{
int i;
int step;
int16_t x;
int16_t diff;
#if defined(SPANDSP_USE_FIXED_POINT)
complexi16_t z;
complexi16_t zz;
@@ -780,68 +862,8 @@ SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], in
if (++s->rrc_filter_step >= V27TER_RX_4800_FILTER_STEPS)
s->rrc_filter_step = 0;
/* There should be no DC in the signal, but sometimes there is.
We need to measure the power with the DC blocked, but not using
a slow to respond DC blocker. Use the most elementary HPF. */
x = amp[i] >> 1;
/* There could be overflow here, but it isn't a problem in practice */
diff = x - s->last_sample;
power = power_meter_update(&(s->power), diff);
#if defined(IAXMODEM_STUFF)
/* Quick power drop fudge */
diff = abs(diff);
if (10*diff < s->high_sample)
{
if (++s->low_samples > 120)
{
power_meter_init(&(s->power), 4);
s->high_sample = 0;
s->low_samples = 0;
}
}
else
{
s->low_samples = 0;
if (diff > s->high_sample)
s->high_sample = diff;
}
#endif
s->last_sample = x;
//span_log(&s->logging, SPAN_LOG_FLOW, "Power = %f\n", power_meter_current_dbm0(&(s->power)));
if (s->signal_present)
{
/* Look for power below turnoff threshold to turn the carrier off */
#if defined(IAXMODEM_STUFF)
if (s->carrier_drop_pending || power < s->carrier_off_power)
#else
if (power < s->carrier_off_power)
#endif
{
if (--s->signal_present <= 0)
{
/* Count down a short delay, to ensure we push the last
few bits through the filters before stopping. */
v27ter_rx_restart(s, s->bit_rate, FALSE);
report_status_change(s, SIG_STATUS_CARRIER_DOWN);
continue;
}
#if defined(IAXMODEM_STUFF)
/* Carrier has dropped, but the put_bit is pending the signal_present delay. */
s->carrier_drop_pending = TRUE;
#endif
}
}
else
{
/* Look for power exceeding turnon threshold to turn the carrier on */
if (power < s->carrier_on_power)
continue;
s->signal_present = 1;
#if defined(IAXMODEM_STUFF)
s->carrier_drop_pending = FALSE;
#endif
report_status_change(s, SIG_STATUS_CARRIER_UP);
}
if ((power = signal_detect(s, amp[i])) == 0)
continue;
/* Only spend effort processing this data if the modem is not
parked, after training failure. */
if (s->training_stage == TRAINING_STAGE_PARKED)
@@ -902,69 +924,8 @@ SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], in
if (++s->rrc_filter_step >= V27TER_RX_2400_FILTER_STEPS)
s->rrc_filter_step = 0;
/* There should be no DC in the signal, but sometimes there is.
We need to measure the power with the DC blocked, but not using
a slow to respond DC blocker. Use the most elementary HPF. */
x = amp[i] >> 1;
/* There could be overflow here, but it isn't a problem in practice */
diff = x - s->last_sample;
power = power_meter_update(&(s->power), diff);
#if defined(IAXMODEM_STUFF)
/* Quick power drop fudge */
diff = abs(diff);
if (10*diff < s->high_sample)
{
if (++s->low_samples > 120)
{
power_meter_init(&(s->power), 4);
s->high_sample = 0;
s->low_samples = 0;
}
}
else
{
s->low_samples = 0;
if (diff > s->high_sample)
s->high_sample = diff;
}
#endif
s->last_sample = x;
//span_log(&s->logging, SPAN_LOG_FLOW, "Power = %f\n", power_meter_current_dbm0(&(s->power)));
if (s->signal_present)
{
/* Look for power below turnoff threshold to turn the carrier off */
#if defined(IAXMODEM_STUFF)
if (s->carrier_drop_pending || power < s->carrier_off_power)
#else
if (power < s->carrier_off_power)
#endif
{
if (--s->signal_present <= 0)
{
/* Count down a short delay, to ensure we push the last
few bits through the filters before stopping. */
v27ter_rx_restart(s, s->bit_rate, FALSE);
report_status_change(s, SIG_STATUS_CARRIER_DOWN);
continue;
}
#if defined(IAXMODEM_STUFF)
/* Carrier has dropped, but the put_bit is
pending the signal_present delay. */
s->carrier_drop_pending = TRUE;
#endif
}
}
else
{
/* Look for power exceeding turnon threshold to turn the carrier on */
if (power < s->carrier_on_power)
continue;
s->signal_present = 1;
#if defined(IAXMODEM_STUFF)
s->carrier_drop_pending = FALSE;
#endif
report_status_change(s, SIG_STATUS_CARRIER_UP);
}
if ((power = signal_detect(s, amp[i])) == 0)
continue;
/* Only spend effort processing this data if the modem is not
parked, after training failure. */
if (s->training_stage == TRAINING_STAGE_PARKED)
@@ -1028,7 +989,7 @@ SPAN_DECLARE(int) v27ter_rx_fillin(v27ter_rx_state_t *s, int len)
/* We want to sustain the current state (i.e carrier on<->carrier off), and
try to sustain the carrier phase. We should probably push the filters, as well */
span_log(&s->logging, SPAN_LOG_FLOW, "Fill-in %d samples\n", len);
if (!s->signal_present)
if (s->signal_present <= 0)
return 0;
if (s->training_stage == TRAINING_STAGE_PARKED)
return 0;
+1 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v27ter_tx.c,v 1.75 2009/04/21 13:59:07 steveu Exp $
* $Id: v27ter_tx.c,v 1.76 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
+76 -66
View File
@@ -23,7 +23,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v29rx.c,v 1.164 2009/04/21 13:59:07 steveu Exp $
* $Id: v29rx.c,v 1.166 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
@@ -841,12 +841,82 @@ static void process_half_baud(v29_rx_state_t *s, complexf_t *sample)
}
/*- End of function --------------------------------------------------------*/
static __inline__ int signal_detect(v29_rx_state_t *s, int16_t amp)
{
int16_t diff;
int16_t x;
int32_t power;
/* There should be no DC in the signal, but sometimes there is.
We need to measure the power with the DC blocked, but not using
a slow to respond DC blocker. Use the most elementary HPF. */
x = amp >> 1;
/* There could be overflow here, but it isn't a problem in practice */
diff = x - s->last_sample;
s->last_sample = x;
power = power_meter_update(&(s->power), diff);
#if defined(IAXMODEM_STUFF)
/* Quick power drop fudge */
diff = abs(diff);
if (10*diff < s->high_sample)
{
if (++s->low_samples > 120)
{
power_meter_init(&(s->power), 4);
s->high_sample = 0;
s->low_samples = 0;
}
}
else
{
s->low_samples = 0;
if (diff > s->high_sample)
s->high_sample = diff;
}
#endif
if (s->signal_present > 0)
{
/* Look for power below turn-off threshold to turn the carrier off */
#if defined(IAXMODEM_STUFF)
if (s->carrier_drop_pending || power < s->carrier_off_power)
#else
if (power < s->carrier_off_power)
#endif
{
if (--s->signal_present <= 0)
{
/* Count down a short delay, to ensure we push the last
few bits through the filters before stopping. */
v29_rx_restart(s, s->bit_rate, FALSE);
report_status_change(s, SIG_STATUS_CARRIER_DOWN);
return 0;
}
#if defined(IAXMODEM_STUFF)
/* Carrier has dropped, but the put_bit is
pending the signal_present delay. */
s->carrier_drop_pending = TRUE;
#endif
}
}
else
{
/* Look for power exceeding turn-on threshold to turn the carrier on */
if (power < s->carrier_on_power)
return 0;
s->signal_present = 1;
#if defined(IAXMODEM_STUFF)
s->carrier_drop_pending = FALSE;
#endif
report_status_change(s, SIG_STATUS_CARRIER_UP);
}
return power;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE_NONSTD(int) v29_rx(v29_rx_state_t *s, const int16_t amp[], int len)
{
int i;
int step;
int16_t x;
int16_t diff;
#if defined(SPANDSP_USE_FIXED_POINT)
complexi16_t z;
complexi16_t zz;
@@ -866,68 +936,8 @@ SPAN_DECLARE_NONSTD(int) v29_rx(v29_rx_state_t *s, const int16_t amp[], int len)
if (++s->rrc_filter_step >= V29_RX_FILTER_STEPS)
s->rrc_filter_step = 0;
/* There should be no DC in the signal, but sometimes there is.
We need to measure the power with the DC blocked, but not using
a slow to respond DC blocker. Use the most elementary HPF. */
x = amp[i] >> 1;
/* There could be overflow here, but it isn't a problem in practice */
diff = x - s->last_sample;
power = power_meter_update(&(s->power), diff);
#if defined(IAXMODEM_STUFF)
/* Quick power drop fudge */
diff = abs(diff);
if (10*diff < s->high_sample)
{
if (++s->low_samples > 120)
{
power_meter_init(&(s->power), 4);
s->high_sample = 0;
s->low_samples = 0;
}
}
else
{
s->low_samples = 0;
if (diff > s->high_sample)
s->high_sample = diff;
}
#endif
s->last_sample = x;
if (s->signal_present)
{
/* Look for power below turn-off threshold to turn the carrier off */
#if defined(IAXMODEM_STUFF)
if (s->carrier_drop_pending || power < s->carrier_off_power)
#else
if (power < s->carrier_off_power)
#endif
{
if (--s->signal_present <= 0)
{
/* Count down a short delay, to ensure we push the last
few bits through the filters before stopping. */
v29_rx_restart(s, s->bit_rate, FALSE);
report_status_change(s, SIG_STATUS_CARRIER_DOWN);
continue;
}
#if defined(IAXMODEM_STUFF)
/* Carrier has dropped, but the put_bit is
pending the signal_present delay. */
s->carrier_drop_pending = TRUE;
#endif
}
}
else
{
/* Look for power exceeding turn-on threshold to turn the carrier on */
if (power < s->carrier_on_power)
continue;
s->signal_present = 1;
#if defined(IAXMODEM_STUFF)
s->carrier_drop_pending = FALSE;
#endif
report_status_change(s, SIG_STATUS_CARRIER_UP);
}
if ((power = signal_detect(s, amp[i])) == 0)
continue;
if (s->training_stage == TRAINING_STAGE_PARKED)
continue;
/* Only spend effort processing this data if the modem is not
@@ -1018,7 +1028,7 @@ SPAN_DECLARE(int) v29_rx_fillin(v29_rx_state_t *s, int len)
/* We want to sustain the current state (i.e carrier on<->carrier off), and
try to sustain the carrier phase. We should probably push the filters, as well */
span_log(&s->logging, SPAN_LOG_FLOW, "Fill-in %d samples\n", len);
if (!s->signal_present)
if (s->signal_present <= 0)
return 0;
if (s->training_stage == TRAINING_STAGE_PARKED)
return 0;
+1 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: v29tx.c,v 1.88 2009/04/21 13:59:07 steveu Exp $
* $Id: v29tx.c,v 1.89 2009/06/02 16:03:56 steveu Exp $
*/
/*! \file */
+2 -2
View File
@@ -609,7 +609,7 @@ static int select_modulation(int mask)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len)
SPAN_DECLARE_NONSTD(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len)
{
int len;
@@ -632,7 +632,7 @@ SPAN_DECLARE(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) v8_rx(v8_state_t *s, const int16_t *amp, int len)
SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len)
{
int i;
int residual_samples;