Skip to content

Commit

Permalink
Various cleanups. Skeleton for V.80 introduced.
Browse files Browse the repository at this point in the history
  • Loading branch information
coppice-git committed Aug 18, 2023
1 parent 239bf2f commit d8dfbd7
Show file tree
Hide file tree
Showing 12 changed files with 518 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
spandsp 0.0.6 - A DSP library for telephony
spandsp 3.0.0 - A DSP library for telephony
-------------------------------------------

SpanDSP is a library of DSP functions for telephony, in the 8000 sample per
Expand Down
2 changes: 2 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ libspandsp_la_SOURCES = ademco_contactid.c \
v42.c \
v42bis.c \
v8.c \
v80.c \
vector_float.c \
vector_int.c \
$(V32BIS_SOURCES) \
Expand Down Expand Up @@ -271,6 +272,7 @@ nobase_include_HEADERS = spandsp/ademco_contactid.h \
spandsp/v42.h \
spandsp/v42bis.h \
spandsp/v8.h \
spandsp/v80.h \
spandsp/vector_float.h \
spandsp/vector_int.h \
spandsp/version.h \
Expand Down
8 changes: 4 additions & 4 deletions src/at_interpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -4339,12 +4339,12 @@ static const char *at_cmd_plus_IBC(at_state_t *s, const char *t)
2; In-band control service enabled, 7-bit codes allowed, and 8-bit codes available
Circuits 105, 106, 107, 108, 109, 110, 125, 132, 133, 135, 142 in that order. For each one:
0: disabled
1: enabled
0: disabled
1: enabled
DCE line connect status reports:
0: disabled
1: enabled */
0: disabled
1: enabled */
for (i = 0; i < 13; i++)
locations[i] = NULL;
/*endfor*/
Expand Down
1 change: 1 addition & 0 deletions src/spandsp.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
#include <spandsp/modem_connect_tones.h>
#include <spandsp/silence_gen.h>
#include <spandsp/v8.h>
#include <spandsp/v80.h>
#include <spandsp/v29rx.h>
#include <spandsp/v29tx.h>
#include <spandsp/v17rx.h>
Expand Down
1 change: 1 addition & 0 deletions src/spandsp/expose.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#include <spandsp/private/fsk.h>
#include <spandsp/private/modem_connect_tones.h>
#include <spandsp/private/v8.h>
#include <spandsp/private/v80.h>
#include <spandsp/private/v17rx.h>
#include <spandsp/private/v17tx.h>
#include <spandsp/private/v22bis.h>
Expand Down
36 changes: 36 additions & 0 deletions src/spandsp/private/v80.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* private/v80.h - In band DCE control and synchronous data modes for asynchronous DTEs
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2023 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.
*/

#if !defined(_SPANDSP_PRIVATE_V80_H_)
#define _SPANDSP_PRIVATE_V80_H_

struct v80_state_s
{
/*! \brief True if we are the calling party */
bool calling_party;
};

#endif
/*- End of file ------------------------------------------------------------*/
2 changes: 2 additions & 0 deletions src/spandsp/unaligned.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ PACK(struct __dealign_uint64 { uint64_t datum; };)
struct __dealign_uint16 { uint16_t datum; } __attribute__((packed));
struct __dealign_uint32 { uint32_t datum; } __attribute__((packed));
struct __dealign_uint64 { uint64_t datum; } __attribute__((packed));
#endif

#if defined(__GNUC__) || defined(_MSC_VER)
/* If we just tell GCC what's going on, we can trust it to behave optimally */
static __inline__ uint64_t get_unaligned_uint64(const void *p)
{
Expand Down
206 changes: 206 additions & 0 deletions src/spandsp/v80.h

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/v42.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ static void transmit_xid(v42_state_t *ss, uint8_t addr)
uint8_t *buf;
int len;
int group_len;
uint32_t param_val;
v42_frame_t *f;

s = &ss->lapm;
Expand Down
259 changes: 259 additions & 0 deletions src/v80.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* v80.c - In band DCE control and synchronous data modes for asynchronous DTE
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2023 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.
*/

/*! \file */

#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif

#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"

#include "spandsp/telephony.h"
#include "spandsp/logging.h"
#include "spandsp/v80.h"

#include "spandsp/private/logging.h"
//#include "spandsp/private/v80.h"

SPAN_DECLARE(const char *) v80_escape_to_str(int esc)
{
static const char *escapes[] =
{
"MFGExtend",
"Mfg1",
"Mfg2",
"Mfg3",
"Mfg4",
"Mfg5",
"Mfg6",
"Mfg7",
"Mfg8",
"Mfg9",
"Mfg10",
"Mfg11",
"Mfg12",
"Mfg13",
"Mfg14",
"Mfg15",
"ExtendMfg",
"Mfg1",
"Mfg2",
"Mfg3",
"Mfg4",
"Mfg5",
"Mfg6",
"Mfg7",
"Mfg8",
"Mfg9",
"Mfg10",
"Mfg11",
"Mfg12",
"Mfg13",
"Mfg14",
"Mfg15",
"Extend0",
"Extend1",
"Circuit 105 OFF",
"Circuit 105 ON",
"Circuit 108 OFF",
"Circuit 108 ON",
"Circuit 133 OFF",
"Circuit 133 ON",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"Single EM P",
"Dingle EM P",
"Flow OFF",
"Flow ON",
"Single EM",
"Double EM",
"Poll",
"???",
"Extend0",
"Extend1",
"Circuit 106 OFF",
"Circuit 106 ON",
"Circuit 107 OFF",
"Circuit 107 ON",
"Circuit 109 OFF",
"Circuit 109 ON",
"Circuit 110 OFF",
"Circuit 110 ON",
"Circuit 125 OFF",
"Circuit 125 ON",
"Circuit 132 OFF",
"Circuit 132 ON",
"Circuit 142 OFF",
"Circuit 142 ON",
"???",
"???",
"???",
"???",
"???",
"???",
"Single EM P",
"Double EM P",
"OFF line",
"ON line",
"Flow OFF",
"Flow ON",
"Single EM",
"Double EM",
"Poll",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"???",
"T3",
"T4",
"T7",
"T8",
"T9",
"T10",
"T11",
"T12",
"T13",
"T14",
"T15",
"T16",
"T17",
"T18",
"T19",
"T20",
"Mark",
"Flag",
"Err",
"Hunt",
"Under",
"TOver",
"ROver",
"Resume",
"BNum",
"UNum",
"EOTH",
"ECS",
"RRNH",
"RTNH",
"RateH",
"CTL",
"RTNC"
};

if (esc >= 0x20 && esc <= 0xC0)
return escapes[esc - 0x20];
/*endif*/
return "???";
}
/*- End of function --------------------------------------------------------*/

SPAN_DECLARE(int) v80_bit_rate_code_to_bit_rate(int rate_code)
{
static const int rates[] =
{
1200,
2400,
4800,
7200,
9600,
12000,
16800,
19200,
21600,
24000,
26400,
28800,
31200,
33600,
32000,
56000,
64000
};

if (rate_code >= V80_BIT_RATE_1200 && rate_code <= V80_BIT_RATE_64000)
return rates[rate_code - V80_BIT_RATE_1200];
/*endif*/
return -1;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
4 changes: 4 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ noinst_PROGRAMS = ademco_contactid_tests \
v42_tests \
v42bis_tests \
v8_tests \
v80_tests \
vector_float_tests \
vector_int_tests \
$(V32BIS_PROGS) \
Expand Down Expand Up @@ -434,6 +435,9 @@ v42bis_tests_LDADD = $(LIBDIR) -lspandsp
v8_tests_SOURCES = v8_tests.c
v8_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp

v80_tests_SOURCES = v80_tests.c
v80_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp

vector_float_tests_SOURCES = vector_float_tests.c
vector_float_tests_LDADD = $(LIBDIR) -lspandsp

Expand Down
Loading

0 comments on commit d8dfbd7

Please sign in to comment.