aboutsummaryrefslogtreecommitdiffstats
path: root/tests/v110
diff options
context:
space:
mode:
Diffstat (limited to 'tests/v110')
-rw-r--r--tests/v110/frame_test.c54
-rw-r--r--tests/v110/frame_test.ok20
-rw-r--r--tests/v110/ra1_test.c74
-rw-r--r--tests/v110/ra1_test.ok216
-rw-r--r--tests/v110/ta_test.c459
-rw-r--r--tests/v110/ta_test.err270
6 files changed, 1093 insertions, 0 deletions
diff --git a/tests/v110/frame_test.c b/tests/v110/frame_test.c
new file mode 100644
index 00000000..ebc617c0
--- /dev/null
+++ b/tests/v110/frame_test.c
@@ -0,0 +1,54 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <unistd.h>
+
+#include <osmocom/core/bits.h>
+#include <osmocom/isdn/v110.h>
+
+
+static void test_frame_enc(void)
+{
+ struct osmo_v110_decoded_frame fr;
+ ubit_t bits[80];
+ unsigned int i;
+
+ memset(&fr, 0, sizeof(fr));
+
+ /* we abuse the fact that ubit_t is 8bit so we can actually
+ * store integer values to clearly identify which bit ends up where */
+
+ /* D1..D48: 101..148 */
+ for (i = 0; i < ARRAY_SIZE(fr.d_bits); i++)
+ fr.d_bits[i] = 101 + i;
+ /* E1..E7: 201..207 */
+ for (i = 0; i < ARRAY_SIZE(fr.e_bits); i++)
+ fr.e_bits[i] = 201 + i;
+ /* S1..S9: 211..219 */
+ for (i = 0; i < ARRAY_SIZE(fr.s_bits); i++)
+ fr.s_bits[i] = 211 + i;
+ /* X1..X2: 221..222 */
+ for (i = 0; i < ARRAY_SIZE(fr.x_bits); i++)
+ fr.x_bits[i] = 221 + i;
+
+ /* run encoder and dump to stdout */
+ memset(bits, 0xff, sizeof(bits));
+ osmo_v110_encode_frame(bits, sizeof(bits), &fr);
+ osmo_v110_ubit_dump(stdout, bits, sizeof(bits));
+
+ /* run decoder on what we just encoded */
+ memset(&fr, 0, sizeof(fr));
+ osmo_v110_decode_frame(&fr, bits, sizeof(bits));
+
+ /* re-encode and dump again 'expout' will match it. */
+ memset(bits, 0xff, sizeof(bits));
+ osmo_v110_encode_frame(bits, sizeof(bits), &fr);
+ osmo_v110_ubit_dump(stdout, bits, sizeof(bits));
+}
+
+
+int main(int argc, char **argv)
+{
+ test_frame_enc();
+}
+
diff --git a/tests/v110/frame_test.ok b/tests/v110/frame_test.ok
new file mode 100644
index 00000000..ecefaa87
--- /dev/null
+++ b/tests/v110/frame_test.ok
@@ -0,0 +1,20 @@
+0 0 0 0 0 0 0 0
+1 101 102 103 104 105 106 211
+1 107 108 109 110 111 112 221
+1 113 114 115 116 117 118 213
+1 119 120 121 122 123 124 214
+1 201 202 203 204 205 206 207
+1 125 126 127 128 129 130 216
+1 131 132 133 134 135 136 222
+1 137 138 139 140 141 142 218
+1 143 144 145 146 147 148 219
+0 0 0 0 0 0 0 0
+1 101 102 103 104 105 106 211
+1 107 108 109 110 111 112 221
+1 113 114 115 116 117 118 213
+1 119 120 121 122 123 124 214
+1 201 202 203 204 205 206 207
+1 125 126 127 128 129 130 216
+1 131 132 133 134 135 136 222
+1 137 138 139 140 141 142 218
+1 143 144 145 146 147 148 219
diff --git a/tests/v110/ra1_test.c b/tests/v110/ra1_test.c
new file mode 100644
index 00000000..48db553d
--- /dev/null
+++ b/tests/v110/ra1_test.c
@@ -0,0 +1,74 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <unistd.h>
+
+#include <osmocom/core/bits.h>
+#include <osmocom/isdn/v110.h>
+
+
+static void test_ra1(enum osmo_v100_sync_ra1_rate rate)
+{
+ int user_rate = osmo_v110_sync_ra1_get_user_data_rate(rate);
+ int user_data_chunk_bits;
+ struct osmo_v110_decoded_frame fr;
+ ubit_t user_bits[48];
+ ubit_t bits[80];
+ unsigned int i;
+ int rc;
+
+ printf("\n======= User data rate %u\n", user_rate);
+
+ user_data_chunk_bits = osmo_v110_sync_ra1_get_user_data_chunk_bitlen(rate);
+ OSMO_ASSERT(user_data_chunk_bits >= 0);
+
+ /* we abuse the fact that ubit_t is 8bit so we can actually
+ * store integer values to clearly identify which bit ends up where */
+ memset(user_bits, 0xFE, sizeof(user_bits));
+ for (i = 0; i < user_data_chunk_bits; i++)
+ user_bits[i] = 101 + i;
+
+ printf("user_bits: ");
+ for (i = 0; i < user_data_chunk_bits; i++)
+ printf("%03d ", user_bits[i]);
+ printf("\n");
+
+ /* generate the decoded v.110 frame */
+ memset(&fr, 0, sizeof(fr));
+ rc = osmo_v110_sync_ra1_user_to_ir(rate, &fr, user_bits, user_data_chunk_bits);
+ OSMO_ASSERT(rc == 0);
+
+ /* run encoder and dump to stdout */
+ memset(bits, 0xff, sizeof(bits));
+ osmo_v110_encode_frame(bits, sizeof(bits), &fr);
+ printf("dumping %u encoded bits in V.110 frame:\n", user_data_chunk_bits);
+ osmo_v110_ubit_dump(stdout, bits, sizeof(bits));
+
+ /* run decoder on what we just encoded */
+ memset(&fr, 0, sizeof(fr));
+ osmo_v110_decode_frame(&fr, bits, sizeof(bits));
+ printf("dumping re-decoded V.110 frame:\n");
+ printf("E-bits: %s\n", osmo_hexdump(fr.e_bits, sizeof(fr.e_bits)));
+ printf("S-bits: %s\n", osmo_hexdump(fr.s_bits, sizeof(fr.s_bits)));
+
+ /* re-encode and dump again 'expout' will match it. */
+ memset(user_bits, 0xff, sizeof(user_bits));
+ rc = osmo_v110_sync_ra1_ir_to_user(rate, user_bits, sizeof(user_bits), &fr);
+ if (rc != user_data_chunk_bits) {
+ fprintf(stderr, "ERROR: adapt_ir_to_user() returned %d, expected %u\n", rc,
+ user_data_chunk_bits);
+ exit(23);
+ }
+ fprintf(stdout, "re-decoded user bits: ");
+ for (i = 0; i < user_data_chunk_bits; i++)
+ printf("%03d ", user_bits[i]);
+ printf("\n");
+}
+
+
+int main(int argc, char **argv)
+{
+ for (int i = 0; i < _NUM_OSMO_V110_SYNC_RA1; i++)
+ test_ra1(i);
+}
+
diff --git a/tests/v110/ra1_test.ok b/tests/v110/ra1_test.ok
new file mode 100644
index 00000000..8a61fc3f
--- /dev/null
+++ b/tests/v110/ra1_test.ok
@@ -0,0 +1,216 @@
+
+======= User data rate 600
+user_bits: 101 102 103 104 105 106
+dumping 6 encoded bits in V.110 frame:
+0 0 0 0 0 0 0 0
+1 101 101 101 101 101 101 0
+1 101 101 102 102 102 102 0
+1 102 102 102 102 103 103 0
+1 103 103 103 103 103 103 0
+1 1 0 0 0 0 0 0
+1 104 104 104 104 104 104 0
+1 104 104 105 105 105 105 0
+1 105 105 105 105 106 106 0
+1 106 106 106 106 106 106 0
+dumping re-decoded V.110 frame:
+E-bits: 01 00 00 00 00 00 00
+S-bits: 00 00 00 00 00 00 00 00 00
+re-decoded user bits: 101 102 103 104 105 106
+
+======= User data rate 1200
+user_bits: 101 102 103 104 105 106 107 108 109 110 111 112
+dumping 12 encoded bits in V.110 frame:
+0 0 0 0 0 0 0 0
+1 101 101 101 101 102 102 0
+1 102 102 103 103 103 103 0
+1 104 104 104 104 105 105 0
+1 105 105 106 106 106 106 0
+1 0 1 0 0 0 0 0
+1 107 107 107 107 108 108 0
+1 108 108 109 109 109 109 0
+1 110 110 110 110 111 111 0
+1 111 111 112 112 112 112 0
+dumping re-decoded V.110 frame:
+E-bits: 00 01 00 00 00 00 00
+S-bits: 00 00 00 00 00 00 00 00 00
+re-decoded user bits: 101 102 103 104 105 106 107 108 109 110 111 112
+
+======= User data rate 2400
+user_bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
+dumping 24 encoded bits in V.110 frame:
+0 0 0 0 0 0 0 0
+1 101 101 102 102 103 103 0
+1 104 104 105 105 106 106 0
+1 107 107 108 108 109 109 0
+1 110 110 111 111 112 112 0
+1 1 1 0 0 0 0 0
+1 113 113 114 114 115 115 0
+1 116 116 117 117 118 118 0
+1 119 119 120 120 121 121 0
+1 122 122 123 123 124 124 0
+dumping re-decoded V.110 frame:
+E-bits: 01 01 00 00 00 00 00
+S-bits: 00 00 00 00 00 00 00 00 00
+re-decoded user bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
+
+======= User data rate 4800
+user_bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
+dumping 48 encoded bits in V.110 frame:
+0 0 0 0 0 0 0 0
+1 101 102 103 104 105 106 0
+1 107 108 109 110 111 112 0
+1 113 114 115 116 117 118 0
+1 119 120 121 122 123 124 0
+1 0 1 1 0 0 0 0
+1 125 126 127 128 129 130 0
+1 131 132 133 134 135 136 0
+1 137 138 139 140 141 142 0
+1 143 144 145 146 147 148 0
+dumping re-decoded V.110 frame:
+E-bits: 00 01 01 00 00 00 00
+S-bits: 00 00 00 00 00 00 00 00 00
+re-decoded user bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
+
+======= User data rate 7200
+user_bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
+dumping 36 encoded bits in V.110 frame:
+0 0 0 0 0 0 0 0
+1 101 102 103 104 105 106 0
+1 107 108 109 110 1 1 0
+1 111 112 1 1 113 114 0
+1 1 1 115 116 117 118 0
+1 1 0 1 0 0 0 0
+1 119 120 121 122 123 124 0
+1 125 126 127 128 1 1 0
+1 129 130 1 1 131 132 0
+1 1 1 133 134 135 136 0
+dumping re-decoded V.110 frame:
+E-bits: 01 00 01 00 00 00 00
+S-bits: 00 00 00 00 00 00 00 00 00
+re-decoded user bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
+
+======= User data rate 9600
+user_bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
+dumping 48 encoded bits in V.110 frame:
+0 0 0 0 0 0 0 0
+1 101 102 103 104 105 106 0
+1 107 108 109 110 111 112 0
+1 113 114 115 116 117 118 0
+1 119 120 121 122 123 124 0
+1 0 1 1 0 0 0 0
+1 125 126 127 128 129 130 0
+1 131 132 133 134 135 136 0
+1 137 138 139 140 141 142 0
+1 143 144 145 146 147 148 0
+dumping re-decoded V.110 frame:
+E-bits: 00 01 01 00 00 00 00
+S-bits: 00 00 00 00 00 00 00 00 00
+re-decoded user bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
+
+======= User data rate 12000
+user_bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
+dumping 30 encoded bits in V.110 frame:
+0 0 0 0 0 0 0 0
+1 101 102 103 104 105 106 0
+1 107 108 109 110 1 1 0
+1 111 112 1 1 113 114 0
+1 1 1 115 1 1 1 0
+1 0 0 1 0 0 0 0
+1 116 117 118 119 120 121 0
+1 122 123 124 125 1 1 0
+1 126 127 1 1 128 129 0
+1 1 1 130 1 1 1 0
+dumping re-decoded V.110 frame:
+E-bits: 00 00 01 00 00 00 00
+S-bits: 00 00 00 00 00 00 00 00 00
+re-decoded user bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
+
+======= User data rate 14400
+user_bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
+dumping 36 encoded bits in V.110 frame:
+0 0 0 0 0 0 0 0
+1 101 102 103 104 105 106 0
+1 107 108 109 110 1 1 0
+1 111 112 1 1 113 114 0
+1 1 1 115 116 117 118 0
+1 1 0 1 0 0 0 0
+1 119 120 121 122 123 124 0
+1 125 126 127 128 1 1 0
+1 129 130 1 1 131 132 0
+1 1 1 133 134 135 136 0
+dumping re-decoded V.110 frame:
+E-bits: 01 00 01 00 00 00 00
+S-bits: 00 00 00 00 00 00 00 00 00
+re-decoded user bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
+
+======= User data rate 19200
+user_bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
+dumping 48 encoded bits in V.110 frame:
+0 0 0 0 0 0 0 0
+1 101 102 103 104 105 106 0
+1 107 108 109 110 111 112 0
+1 113 114 115 116 117 118 0
+1 119 120 121 122 123 124 0
+1 0 1 1 0 0 0 0
+1 125 126 127 128 129 130 0
+1 131 132 133 134 135 136 0
+1 137 138 139 140 141 142 0
+1 143 144 145 146 147 148 0
+dumping re-decoded V.110 frame:
+E-bits: 00 01 01 00 00 00 00
+S-bits: 00 00 00 00 00 00 00 00 00
+re-decoded user bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
+
+======= User data rate 24000
+user_bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
+dumping 30 encoded bits in V.110 frame:
+0 0 0 0 0 0 0 0
+1 101 102 103 104 105 106 0
+1 107 108 109 110 1 1 0
+1 111 112 1 1 113 114 0
+1 1 1 115 1 1 1 0
+1 0 0 1 0 0 0 0
+1 116 117 118 119 120 121 0
+1 122 123 124 125 1 1 0
+1 126 127 1 1 128 129 0
+1 1 1 130 1 1 1 0
+dumping re-decoded V.110 frame:
+E-bits: 00 00 01 00 00 00 00
+S-bits: 00 00 00 00 00 00 00 00 00
+re-decoded user bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
+
+======= User data rate 28800
+user_bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
+dumping 36 encoded bits in V.110 frame:
+0 0 0 0 0 0 0 0
+1 101 102 103 104 105 106 0
+1 107 108 109 110 1 1 0
+1 111 112 1 1 113 114 0
+1 1 1 115 116 117 118 0
+1 1 0 1 0 0 0 0
+1 119 120 121 122 123 124 0
+1 125 126 127 128 1 1 0
+1 129 130 1 1 131 132 0
+1 1 1 133 134 135 136 0
+dumping re-decoded V.110 frame:
+E-bits: 01 00 01 00 00 00 00
+S-bits: 00 00 00 00 00 00 00 00 00
+re-decoded user bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
+
+======= User data rate 38400
+user_bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
+dumping 48 encoded bits in V.110 frame:
+0 0 0 0 0 0 0 0
+1 101 102 103 104 105 106 0
+1 107 108 109 110 111 112 0
+1 113 114 115 116 117 118 0
+1 119 120 121 122 123 124 0
+1 0 1 1 0 0 0 0
+1 125 126 127 128 129 130 0
+1 131 132 133 134 135 136 0
+1 137 138 139 140 141 142 0
+1 143 144 145 146 147 148 0
+dumping re-decoded V.110 frame:
+E-bits: 00 01 01 00 00 00 00
+S-bits: 00 00 00 00 00 00 00 00 00
+re-decoded user bits: 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
diff --git a/tests/v110/ta_test.c b/tests/v110/ta_test.c
new file mode 100644
index 00000000..833830ef
--- /dev/null
+++ b/tests/v110/ta_test.c
@@ -0,0 +1,459 @@
+/*
+ * (C) 2023 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
+ * Author: Vadim Yanitskiy <vyanitskiy@sysmocom.de>
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 General Public License for more details.
+ *
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <osmocom/core/fsm.h>
+#include <osmocom/core/bits.h>
+#include <osmocom/core/logging.h>
+#include <osmocom/core/application.h>
+
+#include <osmocom/isdn/v110.h>
+#include <osmocom/isdn/v110_ta.h>
+
+static void *test_ctx = NULL;
+
+/* inverse logic: ON = binary 0; OFF = binary 1 */
+#define V110_SX_BIT_ON 0
+#define V110_SX_BIT_OFF 1
+
+/*********************************************************************************
+ * V.110 TA configuration and callbacks
+ *********************************************************************************/
+
+static void v110_ta_test_rx_cb(void *priv, const ubit_t *buf, size_t buf_size)
+{
+ fprintf(stderr, "%s(buf_size=%zu): %s\n",
+ __func__, buf_size, osmo_ubit_dump(buf, buf_size));
+}
+
+static void v110_ta_test_tx_cb(void *priv, ubit_t *buf, size_t buf_size)
+{
+ for (size_t i = 0; i < buf_size; i++)
+ buf[i] = (i & 1);
+ fprintf(stderr, "%s(buf_size=%zu): %s\n",
+ __func__, buf_size, osmo_ubit_dump(buf, buf_size));
+}
+
+static void v110_ta_test_status_update_cb(void *priv, unsigned int status)
+{
+ fprintf(stderr, "%s(status=0x%08x)\n", __func__, status);
+}
+
+static const struct osmo_v110_ta_cfg v110_ta_test_cfg = {
+ .rate = OSMO_V110_SYNC_RA1_9600,
+ .rx_cb = &v110_ta_test_rx_cb,
+ .tx_cb = &v110_ta_test_tx_cb,
+ .status_update_cb = &v110_ta_test_status_update_cb,
+};
+
+/*********************************************************************************
+ * various helper functions
+ *********************************************************************************/
+
+static void v110_ta_test_init_df(struct osmo_v110_decoded_frame *df)
+{
+ /* quickly set all the bits to binary '1' */
+ memset(df, 1, sizeof(*df));
+ /* D-bits: 0101... pattern */
+ for (unsigned int i = 0; i < MAX_D_BITS; i += 2)
+ df->d_bits[i] = 0;
+ /* E-bits: E1/E2/E3 indicate 9600 bps */
+ df->e_bits[0] = 0;
+}
+
+static void v110_ta_test_dump_df(const struct osmo_v110_decoded_frame *df)
+{
+ fprintf(stderr, " D-bits: %s\n", osmo_ubit_dump(&df->d_bits[0], MAX_D_BITS));
+ fprintf(stderr, " E-bits: %s\n", osmo_ubit_dump(&df->e_bits[0], MAX_E_BITS));
+ fprintf(stderr, " S-bits: %s\n", osmo_ubit_dump(&df->s_bits[0], MAX_S_BITS));
+ fprintf(stderr, " X-bits: %s\n", osmo_ubit_dump(&df->x_bits[0], MAX_X_BITS));
+}
+
+static void v110_ta_test_dump_circuit(const struct osmo_v110_ta *ta,
+ enum osmo_v110_ta_circuit circuit,
+ bool exp_state)
+{
+ bool state = osmo_v110_ta_get_circuit(ta, circuit);
+
+ fprintf(stderr, "circuit %s (%s) is %s (expected to be %s)\n",
+ osmo_v110_ta_circuit_name(circuit),
+ osmo_v110_ta_circuit_desc(circuit),
+ state ? "ON" : "OFF",
+ exp_state ? "ON" : "OFF");
+}
+
+static void v110_ta_test_set_circuit(struct osmo_v110_ta *ta,
+ enum osmo_v110_ta_circuit circuit,
+ bool active)
+{
+ int rc;
+
+ fprintf(stderr, "setting circuit %s (%s) %s\n",
+ osmo_v110_ta_circuit_name(circuit),
+ osmo_v110_ta_circuit_desc(circuit),
+ active ? "ON" : "OFF");
+
+ rc = osmo_v110_ta_set_circuit(ta, circuit, active);
+ fprintf(stderr, "osmo_v110_ta_set_circuit() returns %d\n", rc);
+}
+
+/*********************************************************************************
+ * the actual tests
+ *********************************************************************************/
+
+static void test_idle_ready(void)
+{
+ struct osmo_v110_decoded_frame df = { 0 };
+ struct osmo_v110_ta *ta;
+ int rc;
+
+ fprintf(stderr, "\n==== Running %s()\n", __func__);
+
+ ta = osmo_v110_ta_alloc(test_ctx, __func__, &v110_ta_test_cfg);
+ OSMO_ASSERT(ta != NULL);
+
+ /* we expect the TA FSM to be in V110_TA_ST_IDLE_READY */
+
+ fprintf(stderr, "Initial status: 0x%08x\n", osmo_v110_ta_get_status(ta));
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_106, false);
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_107, false);
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_109, false);
+
+ fprintf(stderr, "osmo_v110_ta_frame_in(): all bits set to binary '1'\n");
+ memset(&df, 1, sizeof(df));
+ v110_ta_test_dump_df(&df);
+ rc = osmo_v110_ta_frame_in(ta, &df);
+ fprintf(stderr, "osmo_v110_ta_frame_in() returns %d\n", rc);
+
+ fprintf(stderr, "osmo_v110_ta_frame_out(): expecting all bits set to binary '1'\n");
+ rc = osmo_v110_ta_frame_out(ta, &df);
+ fprintf(stderr, "osmo_v110_ta_frame_out() returns %d\n", rc);
+ if (rc == 0)
+ v110_ta_test_dump_df(&df);
+
+ v110_ta_test_set_circuit(ta, OSMO_V110_TA_C_108, true);
+ v110_ta_test_set_circuit(ta, OSMO_V110_TA_C_108, false);
+ v110_ta_test_set_circuit(ta, OSMO_V110_TA_C_108, true);
+
+ osmo_v110_ta_free(ta);
+}
+
+static void test_conn_ta_line(void)
+{
+ struct osmo_v110_decoded_frame df = { 0 };
+ struct osmo_v110_ta *ta;
+ int rc;
+
+ fprintf(stderr, "\n==== Running %s()\n", __func__);
+
+ ta = osmo_v110_ta_alloc(test_ctx, __func__, &v110_ta_test_cfg);
+ OSMO_ASSERT(ta != NULL);
+
+ /* we expect the TA FSM to be in V110_TA_ST_IDLE_READY */
+
+ v110_ta_test_set_circuit(ta, OSMO_V110_TA_C_108, true);
+
+ /* we expect the TA FSM to be in V110_TA_ST_CON_TA_TO_LINE */
+
+ fprintf(stderr, "osmo_v110_ta_frame_out(): S-/X-bits are expected to be 1 (OFF)\n");
+ fprintf(stderr, "osmo_v110_ta_frame_out(): D-/E-bits are all expected to be 1\n");
+ rc = osmo_v110_ta_frame_out(ta, &df);
+ fprintf(stderr, "osmo_v110_ta_frame_out() returns %d\n", rc);
+ if (rc == 0)
+ v110_ta_test_dump_df(&df);
+
+ /* TODO: test implicit sync by sending V110_TA_EV_RX_FRAME_IND */
+
+ fprintf(stderr, "osmo_v110_ta_sync_ind(): the lower layer indicates sync event\n");
+ osmo_v110_ta_sync_ind(ta);
+
+ fprintf(stderr, "osmo_v110_ta_frame_out(): S-/X-bits are expected to be 0 (ON)\n");
+ fprintf(stderr, "osmo_v110_ta_frame_out(): D-/E-bits are all expected to be 1\n");
+ rc = osmo_v110_ta_frame_out(ta, &df);
+ fprintf(stderr, "osmo_v110_ta_frame_out() returns %d\n", rc);
+ if (rc == 0)
+ v110_ta_test_dump_df(&df);
+
+ fprintf(stderr, "osmo_v110_ta_frame_in(): S-/X-bits are OFF, expect no state change\n");
+ v110_ta_test_init_df(&df);
+ v110_ta_test_dump_df(&df);
+ rc = osmo_v110_ta_frame_in(ta, &df);
+ fprintf(stderr, "osmo_v110_ta_frame_in() returns %d\n", rc);
+
+ fprintf(stderr, "osmo_v110_ta_frame_in(): S-/X-bits are ON, expect state change\n");
+ memset(&df.s_bits[0], V110_SX_BIT_ON, sizeof(df.s_bits));
+ memset(&df.x_bits[0], V110_SX_BIT_ON, sizeof(df.x_bits));
+ v110_ta_test_dump_df(&df);
+ rc = osmo_v110_ta_frame_in(ta, &df);
+ fprintf(stderr, "osmo_v110_ta_frame_in() returns %d\n", rc);
+
+ /* we expect the TA FSM to be in V110_TA_ST_DATA_TRANSFER */
+
+ osmo_v110_ta_free(ta);
+}
+
+static void _test_data_transfer_enter(struct osmo_v110_ta *ta)
+{
+ struct osmo_v110_decoded_frame df;
+ int rc;
+
+ OSMO_ASSERT(osmo_v110_ta_get_circuit(ta, OSMO_V110_TA_C_108) == false);
+
+ /* we expect the TA FSM to be in V110_TA_ST_IDLE_READY */
+
+ v110_ta_test_set_circuit(ta, OSMO_V110_TA_C_108, true);
+
+ /* we expect the TA FSM to be in V110_TA_ST_CON_TA_TO_LINE */
+
+ fprintf(stderr, "osmo_v110_ta_sync_ind(): the lower layer indicates sync event\n");
+ osmo_v110_ta_sync_ind(ta);
+
+ fprintf(stderr, "osmo_v110_ta_frame_in(): S-/X-bits are ON, expect state change\n");
+ v110_ta_test_init_df(&df);
+ memset(&df.s_bits[0], V110_SX_BIT_ON, sizeof(df.s_bits));
+ memset(&df.x_bits[0], V110_SX_BIT_ON, sizeof(df.x_bits));
+ v110_ta_test_dump_df(&df);
+ rc = osmo_v110_ta_frame_in(ta, &df);
+ fprintf(stderr, "osmo_v110_ta_frame_in() returns %d\n", rc);
+
+ /* we expect the TA FSM to be in V110_TA_ST_DATA_TRANSFER */
+}
+
+static void test_data_transfer(void)
+{
+ struct osmo_v110_decoded_frame df = { 0 };
+ struct osmo_v110_ta *ta;
+ int rc;
+
+ fprintf(stderr, "\n==== Running %s()\n", __func__);
+
+ ta = osmo_v110_ta_alloc(test_ctx, __func__, &v110_ta_test_cfg);
+ OSMO_ASSERT(ta != NULL);
+
+ /* we expect the TA FSM to be in V110_TA_ST_IDLE_READY */
+
+ _test_data_transfer_enter(ta);
+
+ /* we expect the TA FSM to be in V110_TA_ST_DATA_TRANSFER */
+
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_106, true);
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_107, true);
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_109, true);
+
+ fprintf(stderr, "osmo_v110_ta_frame_out(): S-/X-bits are expected to be 0 (ON)\n");
+ fprintf(stderr, "osmo_v110_ta_frame_out(): E1..E3-bits are expected to be 011 (9600)\n");
+ fprintf(stderr, "osmo_v110_ta_frame_out(): we also expect the .tx_cb() to be called\n");
+ rc = osmo_v110_ta_frame_out(ta, &df);
+ fprintf(stderr, "osmo_v110_ta_frame_out() returns %d\n", rc);
+ if (rc == 0)
+ v110_ta_test_dump_df(&df);
+
+ fprintf(stderr, "osmo_v110_ta_frame_in(): feed that frame that we pulled out back into the TA\n");
+ rc = osmo_v110_ta_frame_in(ta, &df);
+ fprintf(stderr, "osmo_v110_ta_frame_in() returns %d\n", rc);
+
+ osmo_v110_ta_free(ta);
+}
+
+static void test_data_transfer_disc_local(void)
+{
+ struct osmo_v110_decoded_frame df = { 0 };
+ struct osmo_v110_ta *ta;
+ int rc;
+
+ fprintf(stderr, "\n==== Running %s()\n", __func__);
+
+ ta = osmo_v110_ta_alloc(test_ctx, __func__, &v110_ta_test_cfg);
+ OSMO_ASSERT(ta != NULL);
+
+ /* we expect the TA FSM to be in V110_TA_ST_IDLE_READY */
+
+ _test_data_transfer_enter(ta);
+
+ /* we expect the TA FSM to be in V110_TA_ST_DATA_TRANSFER */
+
+ fprintf(stderr, "local TE initiates disconnection\n");
+ v110_ta_test_set_circuit(ta, OSMO_V110_TA_C_108, false);
+
+ /* we expect the TA FSM to be in V110_TA_ST_DISCONNECTING */
+
+ fprintf(stderr, "osmo_v110_ta_frame_out(): S-bits are expected to be 1 (OFF)\n");
+ fprintf(stderr, "osmo_v110_ta_frame_out(): X-bits are expected to be 0 (ON)\n");
+ fprintf(stderr, "osmo_v110_ta_frame_out(): D-bits are all expected to be 0\n");
+ rc = osmo_v110_ta_frame_out(ta, &df); /* TODO: what E-bits do we expect? */
+ fprintf(stderr, "osmo_v110_ta_frame_out() returns %d\n", rc);
+ if (rc == 0)
+ v110_ta_test_dump_df(&df);
+
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_106, false);
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_107, true);
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_109, true);
+
+ fprintf(stderr, "osmo_v110_ta_frame_in(): S-/X-bits are ON, expect no state change\n");
+ v110_ta_test_init_df(&df);
+ memset(&df.s_bits[0], V110_SX_BIT_ON, sizeof(df.s_bits));
+ memset(&df.x_bits[0], V110_SX_BIT_ON, sizeof(df.x_bits));
+ v110_ta_test_dump_df(&df);
+ rc = osmo_v110_ta_frame_in(ta, &df);
+ fprintf(stderr, "osmo_v110_ta_frame_in() returns %d\n", rc);
+
+ fprintf(stderr, "osmo_v110_ta_frame_in(): S-bits are OFF, expect state change\n");
+ v110_ta_test_init_df(&df);
+ memset(&df.s_bits[0], V110_SX_BIT_OFF, sizeof(df.s_bits));
+ memset(&df.x_bits[0], V110_SX_BIT_ON, sizeof(df.x_bits));
+ v110_ta_test_dump_df(&df);
+ rc = osmo_v110_ta_frame_in(ta, &df);
+ fprintf(stderr, "osmo_v110_ta_frame_in() returns %d\n", rc);
+
+ /* we expect the TA FSM to be in V110_TA_ST_IDLE_READY */
+
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_106, false);
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_107, false);
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_109, false);
+
+ osmo_v110_ta_free(ta);
+}
+
+static void test_data_transfer_disc_remote(void)
+{
+ struct osmo_v110_decoded_frame df = { 0 };
+ struct osmo_v110_ta *ta;
+ int rc;
+
+ fprintf(stderr, "\n==== Running %s()\n", __func__);
+
+ ta = osmo_v110_ta_alloc(test_ctx, __func__, &v110_ta_test_cfg);
+ OSMO_ASSERT(ta != NULL);
+
+ /* we expect the TA FSM to be in V110_TA_ST_IDLE_READY */
+
+ _test_data_transfer_enter(ta);
+
+ /* we expect the TA FSM to be in V110_TA_ST_DATA_TRANSFER */
+
+ fprintf(stderr, "remote TE initiates disconnection\n");
+ fprintf(stderr, "osmo_v110_ta_frame_in(): S-bits are OFF, X-bits are ON\n");
+ fprintf(stderr, "osmo_v110_ta_frame_in(): D-bits are all set to 0\n");
+ v110_ta_test_init_df(&df);
+ memset(&df.s_bits[0], V110_SX_BIT_OFF, sizeof(df.s_bits));
+ memset(&df.x_bits[0], V110_SX_BIT_ON, sizeof(df.x_bits));
+ memset(&df.d_bits[0], 0, sizeof(df.d_bits));
+ v110_ta_test_dump_df(&df);
+ rc = osmo_v110_ta_frame_in(ta, &df);
+ fprintf(stderr, "osmo_v110_ta_frame_in() returns %d\n", rc);
+
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_107, false);
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_109, false);
+
+ fprintf(stderr, "local TE confirms disconnection\n");
+ v110_ta_test_set_circuit(ta, OSMO_V110_TA_C_108, false);
+
+ /* we expect the TA FSM to be in V110_TA_ST_DISCONNECTING */
+
+ osmo_v110_ta_desync_ind(ta);
+
+ /* we expect the TA FSM to be in V110_TA_ST_IDLE_READY */
+
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_106, false);
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_107, false);
+ v110_ta_test_dump_circuit(ta, OSMO_V110_TA_C_109, false);
+
+ osmo_v110_ta_free(ta);
+}
+
+static void test_syncing(void)
+{
+ struct osmo_v110_decoded_frame df = { 0 };
+ struct osmo_v110_ta *ta;
+ int rc;
+
+ fprintf(stderr, "\n==== Running %s()\n", __func__);
+
+ ta = osmo_v110_ta_alloc(test_ctx, __func__, &v110_ta_test_cfg);
+ OSMO_ASSERT(ta != NULL);
+
+ /* we expect the TA FSM to be in V110_TA_ST_IDLE_READY */
+
+ _test_data_transfer_enter(ta);
+
+ /* we expect the TA FSM to be in V110_TA_ST_DATA_TRANSFER */
+
+ fprintf(stderr, "osmo_v110_ta_sync_ind(): the lower layer indicates out-of-sync event\n");
+ osmo_v110_ta_desync_ind(ta);
+
+ /* we expect the TA FSM to be in V110_TA_ST_RESYNCING */
+
+ fprintf(stderr, "osmo_v110_ta_frame_out(): S-bits are expected to be 0 (ON)\n");
+ fprintf(stderr, "osmo_v110_ta_frame_out(): X-bits are expected to be 1 (OFF)\n");
+ fprintf(stderr, "osmo_v110_ta_frame_out(): D-bits are to be set by .tx_cb()\n");
+ rc = osmo_v110_ta_frame_out(ta, &df);
+ fprintf(stderr, "osmo_v110_ta_frame_out() returns %d\n", rc);
+ if (rc == 0)
+ v110_ta_test_dump_df(&df);
+
+ fprintf(stderr, "osmo_v110_ta_sync_ind(): the lower layer indicates sync event\n");
+ osmo_v110_ta_sync_ind(ta);
+
+ /* we expect the TA FSM to be in V110_TA_ST_DATA_TRANSFER */
+
+ fprintf(stderr, "osmo_v110_ta_frame_out(): S-bits are expected to be 0 (ON)\n");
+ fprintf(stderr, "osmo_v110_ta_frame_out(): X-bits are expected to be 0 (ON)\n");
+ fprintf(stderr, "osmo_v110_ta_frame_out(): D-bits are to be set by .tx_cb()\n");
+ rc = osmo_v110_ta_frame_out(ta, &df);
+ fprintf(stderr, "osmo_v110_ta_frame_out() returns %d\n", rc);
+ if (rc == 0)
+ v110_ta_test_dump_df(&df);
+
+ osmo_v110_ta_free(ta);
+}
+
+int main(int argc, char **argv)
+{
+ test_ctx = talloc_named_const(NULL, 0, __FILE__);
+
+ osmo_init_logging2(test_ctx, NULL);
+ log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
+ log_set_print_level(osmo_stderr_target, 1);
+ log_set_print_category(osmo_stderr_target, 1);
+ log_set_print_category_hex(osmo_stderr_target, 0);
+ log_set_use_color(osmo_stderr_target, 0);
+
+ osmo_fsm_log_addr(false);
+ osmo_fsm_log_timeouts(true);
+
+ log_set_category_filter(osmo_stderr_target, DLGLOBAL, 1, LOGL_DEBUG);
+
+ test_idle_ready();
+ test_conn_ta_line();
+ /* TODO: test_conn_ta_line_timeout() */
+ test_data_transfer();
+ test_data_transfer_disc_local();
+ test_data_transfer_disc_remote();
+ /* TODO: test_disc_timeout() */
+ test_syncing();
+ /* TODO: test_syncing_timeout() */
+
+ log_fini();
+ OSMO_ASSERT(talloc_total_blocks(test_ctx) == 1);
+ talloc_free(test_ctx);
+
+ return 0;
+}
diff --git a/tests/v110/ta_test.err b/tests/v110/ta_test.err
new file mode 100644
index 00000000..e8f80e62
--- /dev/null
+++ b/tests/v110/ta_test.err
@@ -0,0 +1,270 @@
+
+==== Running test_idle_ready()
+DLGLOBAL DEBUG V110-TA(test_idle_ready){IDLE_READY}: Allocated
+DLGLOBAL DEBUG V110-TA(test_idle_ready){IDLE_READY}: State change to IDLE_READY (no timeout)
+Initial status: 0x00000000
+circuit 106/CTS (Clear to Send) is OFF (expected to be OFF)
+circuit 107/DSR (Data Set Ready) is OFF (expected to be OFF)
+circuit 109/DCD (Data Carrier Detect) is OFF (expected to be OFF)
+osmo_v110_ta_frame_in(): all bits set to binary '1'
+ D-bits: 111111111111111111111111111111111111111111111111
+ E-bits: 1111111
+ S-bits: 111111111
+ X-bits: 11
+DLGLOBAL DEBUG V110-TA(test_idle_ready){IDLE_READY}: Received Event RX_FRAME_IND
+v110_ta_test_rx_cb(buf_size=48): 111111111111111111111111111111111111111111111111
+osmo_v110_ta_frame_in() returns 0
+osmo_v110_ta_frame_out(): expecting all bits set to binary '1'
+DLGLOBAL DEBUG V110-TA(test_idle_ready){IDLE_READY}: Received Event TX_FRAME_RTS
+osmo_v110_ta_frame_out() returns 0
+ D-bits: 111111111111111111111111111111111111111111111111
+ E-bits: 1111111
+ S-bits: 111111111
+ X-bits: 11
+setting circuit 108/DTR (Data Terminal Ready) ON
+DLGLOBAL DEBUG V110-TA(test_idle_ready){IDLE_READY}: Received Event V24_STATUS_CHG
+DLGLOBAL DEBUG V110-TA(test_idle_ready){IDLE_READY}: State change to CONNECT_TA_TO_LINE (T1, 10s)
+osmo_v110_ta_set_circuit() returns 0
+setting circuit 108/DTR (Data Terminal Ready) OFF
+DLGLOBAL DEBUG V110-TA(test_idle_ready){CONNECT_TA_TO_LINE}: Received Event V24_STATUS_CHG
+DLGLOBAL DEBUG V110-TA(test_idle_ready){CONNECT_TA_TO_LINE}: State change to IDLE_READY (no timeout)
+osmo_v110_ta_set_circuit() returns 0
+setting circuit 108/DTR (Data Terminal Ready) ON
+DLGLOBAL DEBUG V110-TA(test_idle_ready){IDLE_READY}: Received Event V24_STATUS_CHG
+DLGLOBAL DEBUG V110-TA(test_idle_ready){IDLE_READY}: State change to CONNECT_TA_TO_LINE (T1, 10s)
+osmo_v110_ta_set_circuit() returns 0
+DLGLOBAL DEBUG V110-TA(test_idle_ready){CONNECT_TA_TO_LINE}: Deallocated
+
+==== Running test_conn_ta_line()
+DLGLOBAL DEBUG V110-TA(test_conn_ta_line){IDLE_READY}: Allocated
+DLGLOBAL DEBUG V110-TA(test_conn_ta_line){IDLE_READY}: State change to IDLE_READY (no timeout)
+setting circuit 108/DTR (Data Terminal Ready) ON
+DLGLOBAL DEBUG V110-TA(test_conn_ta_line){IDLE_READY}: Received Event V24_STATUS_CHG
+DLGLOBAL DEBUG V110-TA(test_conn_ta_line){IDLE_READY}: State change to CONNECT_TA_TO_LINE (T1, 10s)
+osmo_v110_ta_set_circuit() returns 0
+osmo_v110_ta_frame_out(): S-/X-bits are expected to be 1 (OFF)
+osmo_v110_ta_frame_out(): D-/E-bits are all expected to be 1
+DLGLOBAL DEBUG V110-TA(test_conn_ta_line){CONNECT_TA_TO_LINE}: Received Event TX_FRAME_RTS
+osmo_v110_ta_frame_out() returns 0
+ D-bits: 111111111111111111111111111111111111111111111111
+ E-bits: 1111111
+ S-bits: 111111111
+ X-bits: 11
+osmo_v110_ta_sync_ind(): the lower layer indicates sync event
+DLGLOBAL DEBUG V110-TA(test_conn_ta_line){CONNECT_TA_TO_LINE}: Received Event SYNC_IND
+osmo_v110_ta_frame_out(): S-/X-bits are expected to be 0 (ON)
+osmo_v110_ta_frame_out(): D-/E-bits are all expected to be 1
+DLGLOBAL DEBUG V110-TA(test_conn_ta_line){CONNECT_TA_TO_LINE}: Received Event TX_FRAME_RTS
+osmo_v110_ta_frame_out() returns 0
+ D-bits: 111111111111111111111111111111111111111111111111
+ E-bits: 1111111
+ S-bits: 000000000
+ X-bits: 00
+osmo_v110_ta_frame_in(): S-/X-bits are OFF, expect no state change
+ D-bits: 010101010101010101010101010101010101010101010101
+ E-bits: 0111111
+ S-bits: 111111111
+ X-bits: 11
+DLGLOBAL DEBUG V110-TA(test_conn_ta_line){CONNECT_TA_TO_LINE}: Received Event RX_FRAME_IND
+v110_ta_test_rx_cb(buf_size=48): 111111111111111111111111111111111111111111111111
+osmo_v110_ta_frame_in() returns 0
+osmo_v110_ta_frame_in(): S-/X-bits are ON, expect state change
+ D-bits: 010101010101010101010101010101010101010101010101
+ E-bits: 0111111
+ S-bits: 000000000
+ X-bits: 00
+DLGLOBAL DEBUG V110-TA(test_conn_ta_line){CONNECT_TA_TO_LINE}: Received Event RX_FRAME_IND
+v110_ta_test_status_update_cb(status=0x0000001e)
+DLGLOBAL DEBUG V110-TA(test_conn_ta_line){CONNECT_TA_TO_LINE}: State change to DATA_TRANSFER (no timeout)
+v110_ta_test_rx_cb(buf_size=48): 010101010101010101010101010101010101010101010101
+osmo_v110_ta_frame_in() returns 0
+DLGLOBAL DEBUG V110-TA(test_conn_ta_line){DATA_TRANSFER}: Deallocated
+
+==== Running test_data_transfer()
+DLGLOBAL DEBUG V110-TA(test_data_transfer){IDLE_READY}: Allocated
+DLGLOBAL DEBUG V110-TA(test_data_transfer){IDLE_READY}: State change to IDLE_READY (no timeout)
+setting circuit 108/DTR (Data Terminal Ready) ON
+DLGLOBAL DEBUG V110-TA(test_data_transfer){IDLE_READY}: Received Event V24_STATUS_CHG
+DLGLOBAL DEBUG V110-TA(test_data_transfer){IDLE_READY}: State change to CONNECT_TA_TO_LINE (T1, 10s)
+osmo_v110_ta_set_circuit() returns 0
+osmo_v110_ta_sync_ind(): the lower layer indicates sync event
+DLGLOBAL DEBUG V110-TA(test_data_transfer){CONNECT_TA_TO_LINE}: Received Event SYNC_IND
+osmo_v110_ta_frame_in(): S-/X-bits are ON, expect state change
+ D-bits: 010101010101010101010101010101010101010101010101
+ E-bits: 0111111
+ S-bits: 000000000
+ X-bits: 00
+DLGLOBAL DEBUG V110-TA(test_data_transfer){CONNECT_TA_TO_LINE}: Received Event RX_FRAME_IND
+v110_ta_test_status_update_cb(status=0x0000001e)
+DLGLOBAL DEBUG V110-TA(test_data_transfer){CONNECT_TA_TO_LINE}: State change to DATA_TRANSFER (no timeout)
+v110_ta_test_rx_cb(buf_size=48): 010101010101010101010101010101010101010101010101
+osmo_v110_ta_frame_in() returns 0
+circuit 106/CTS (Clear to Send) is ON (expected to be ON)
+circuit 107/DSR (Data Set Ready) is ON (expected to be ON)
+circuit 109/DCD (Data Carrier Detect) is ON (expected to be ON)
+osmo_v110_ta_frame_out(): S-/X-bits are expected to be 0 (ON)
+osmo_v110_ta_frame_out(): E1..E3-bits are expected to be 011 (9600)
+osmo_v110_ta_frame_out(): we also expect the .tx_cb() to be called
+DLGLOBAL DEBUG V110-TA(test_data_transfer){DATA_TRANSFER}: Received Event TX_FRAME_RTS
+v110_ta_test_tx_cb(buf_size=48): 010101010101010101010101010101010101010101010101
+osmo_v110_ta_frame_out() returns 0
+ D-bits: 010101010101010101010101010101010101010101010101
+ E-bits: 0111111
+ S-bits: 000000000
+ X-bits: 00
+osmo_v110_ta_frame_in(): feed that frame that we pulled out back into the TA
+DLGLOBAL DEBUG V110-TA(test_data_transfer){DATA_TRANSFER}: Received Event RX_FRAME_IND
+v110_ta_test_rx_cb(buf_size=48): 010101010101010101010101010101010101010101010101
+osmo_v110_ta_frame_in() returns 0
+DLGLOBAL DEBUG V110-TA(test_data_transfer){DATA_TRANSFER}: Deallocated
+
+==== Running test_data_transfer_disc_local()
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_local){IDLE_READY}: Allocated
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_local){IDLE_READY}: State change to IDLE_READY (no timeout)
+setting circuit 108/DTR (Data Terminal Ready) ON
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_local){IDLE_READY}: Received Event V24_STATUS_CHG
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_local){IDLE_READY}: State change to CONNECT_TA_TO_LINE (T1, 10s)
+osmo_v110_ta_set_circuit() returns 0
+osmo_v110_ta_sync_ind(): the lower layer indicates sync event
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_local){CONNECT_TA_TO_LINE}: Received Event SYNC_IND
+osmo_v110_ta_frame_in(): S-/X-bits are ON, expect state change
+ D-bits: 010101010101010101010101010101010101010101010101
+ E-bits: 0111111
+ S-bits: 000000000
+ X-bits: 00
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_local){CONNECT_TA_TO_LINE}: Received Event RX_FRAME_IND
+v110_ta_test_status_update_cb(status=0x0000001e)
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_local){CONNECT_TA_TO_LINE}: State change to DATA_TRANSFER (no timeout)
+v110_ta_test_rx_cb(buf_size=48): 010101010101010101010101010101010101010101010101
+osmo_v110_ta_frame_in() returns 0
+local TE initiates disconnection
+setting circuit 108/DTR (Data Terminal Ready) OFF
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_local){DATA_TRANSFER}: Received Event V24_STATUS_CHG
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_local){DATA_TRANSFER}: State change to DISCONNECTING (T2, 5s)
+v110_ta_test_status_update_cb(status=0x00000014)
+osmo_v110_ta_set_circuit() returns 0
+osmo_v110_ta_frame_out(): S-bits are expected to be 1 (OFF)
+osmo_v110_ta_frame_out(): X-bits are expected to be 0 (ON)
+osmo_v110_ta_frame_out(): D-bits are all expected to be 0
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_local){DISCONNECTING}: Received Event TX_FRAME_RTS
+osmo_v110_ta_frame_out() returns 0
+ D-bits: 000000000000000000000000000000000000000000000000
+ E-bits: 1111111
+ S-bits: 111111111
+ X-bits: 00
+circuit 106/CTS (Clear to Send) is OFF (expected to be OFF)
+circuit 107/DSR (Data Set Ready) is ON (expected to be ON)
+circuit 109/DCD (Data Carrier Detect) is ON (expected to be ON)
+osmo_v110_ta_frame_in(): S-/X-bits are ON, expect no state change
+ D-bits: 010101010101010101010101010101010101010101010101
+ E-bits: 0111111
+ S-bits: 000000000
+ X-bits: 00
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_local){DISCONNECTING}: Received Event RX_FRAME_IND
+v110_ta_test_rx_cb(buf_size=48): 010101010101010101010101010101010101010101010101
+osmo_v110_ta_frame_in() returns 0
+osmo_v110_ta_frame_in(): S-bits are OFF, expect state change
+ D-bits: 010101010101010101010101010101010101010101010101
+ E-bits: 0111111
+ S-bits: 111111111
+ X-bits: 00
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_local){DISCONNECTING}: Received Event RX_FRAME_IND
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_local){DISCONNECTING}: State change to IDLE_READY (no timeout)
+v110_ta_test_status_update_cb(status=0x00000000)
+v110_ta_test_rx_cb(buf_size=48): 111111111111111111111111111111111111111111111111
+osmo_v110_ta_frame_in() returns 0
+circuit 106/CTS (Clear to Send) is OFF (expected to be OFF)
+circuit 107/DSR (Data Set Ready) is OFF (expected to be OFF)
+circuit 109/DCD (Data Carrier Detect) is OFF (expected to be OFF)
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_local){IDLE_READY}: Deallocated
+
+==== Running test_data_transfer_disc_remote()
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_remote){IDLE_READY}: Allocated
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_remote){IDLE_READY}: State change to IDLE_READY (no timeout)
+setting circuit 108/DTR (Data Terminal Ready) ON
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_remote){IDLE_READY}: Received Event V24_STATUS_CHG
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_remote){IDLE_READY}: State change to CONNECT_TA_TO_LINE (T1, 10s)
+osmo_v110_ta_set_circuit() returns 0
+osmo_v110_ta_sync_ind(): the lower layer indicates sync event
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_remote){CONNECT_TA_TO_LINE}: Received Event SYNC_IND
+osmo_v110_ta_frame_in(): S-/X-bits are ON, expect state change
+ D-bits: 010101010101010101010101010101010101010101010101
+ E-bits: 0111111
+ S-bits: 000000000
+ X-bits: 00
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_remote){CONNECT_TA_TO_LINE}: Received Event RX_FRAME_IND
+v110_ta_test_status_update_cb(status=0x0000001e)
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_remote){CONNECT_TA_TO_LINE}: State change to DATA_TRANSFER (no timeout)
+v110_ta_test_rx_cb(buf_size=48): 010101010101010101010101010101010101010101010101
+osmo_v110_ta_frame_in() returns 0
+remote TE initiates disconnection
+osmo_v110_ta_frame_in(): S-bits are OFF, X-bits are ON
+osmo_v110_ta_frame_in(): D-bits are all set to 0
+ D-bits: 000000000000000000000000000000000000000000000000
+ E-bits: 0111111
+ S-bits: 111111111
+ X-bits: 00
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_remote){DATA_TRANSFER}: Received Event RX_FRAME_IND
+v110_ta_test_status_update_cb(status=0x0000000a)
+osmo_v110_ta_frame_in() returns 0
+circuit 107/DSR (Data Set Ready) is OFF (expected to be OFF)
+circuit 109/DCD (Data Carrier Detect) is OFF (expected to be OFF)
+local TE confirms disconnection
+setting circuit 108/DTR (Data Terminal Ready) OFF
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_remote){DATA_TRANSFER}: Received Event V24_STATUS_CHG
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_remote){DATA_TRANSFER}: State change to DISCONNECTING (T2, 5s)
+v110_ta_test_status_update_cb(status=0x00000000)
+osmo_v110_ta_set_circuit() returns 0
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_remote){DISCONNECTING}: Received Event DESYNC_IND
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_remote){DISCONNECTING}: State change to IDLE_READY (no timeout)
+circuit 106/CTS (Clear to Send) is OFF (expected to be OFF)
+circuit 107/DSR (Data Set Ready) is OFF (expected to be OFF)
+circuit 109/DCD (Data Carrier Detect) is OFF (expected to be OFF)
+DLGLOBAL DEBUG V110-TA(test_data_transfer_disc_remote){IDLE_READY}: Deallocated
+
+==== Running test_syncing()
+DLGLOBAL DEBUG V110-TA(test_syncing){IDLE_READY}: Allocated
+DLGLOBAL DEBUG V110-TA(test_syncing){IDLE_READY}: State change to IDLE_READY (no timeout)
+setting circuit 108/DTR (Data Terminal Ready) ON
+DLGLOBAL DEBUG V110-TA(test_syncing){IDLE_READY}: Received Event V24_STATUS_CHG
+DLGLOBAL DEBUG V110-TA(test_syncing){IDLE_READY}: State change to CONNECT_TA_TO_LINE (T1, 10s)
+osmo_v110_ta_set_circuit() returns 0
+osmo_v110_ta_sync_ind(): the lower layer indicates sync event
+DLGLOBAL DEBUG V110-TA(test_syncing){CONNECT_TA_TO_LINE}: Received Event SYNC_IND
+osmo_v110_ta_frame_in(): S-/X-bits are ON, expect state change
+ D-bits: 010101010101010101010101010101010101010101010101
+ E-bits: 0111111
+ S-bits: 000000000
+ X-bits: 00
+DLGLOBAL DEBUG V110-TA(test_syncing){CONNECT_TA_TO_LINE}: Received Event RX_FRAME_IND
+v110_ta_test_status_update_cb(status=0x0000001e)
+DLGLOBAL DEBUG V110-TA(test_syncing){CONNECT_TA_TO_LINE}: State change to DATA_TRANSFER (no timeout)
+v110_ta_test_rx_cb(buf_size=48): 010101010101010101010101010101010101010101010101
+osmo_v110_ta_frame_in() returns 0
+osmo_v110_ta_sync_ind(): the lower layer indicates out-of-sync event
+DLGLOBAL DEBUG V110-TA(test_syncing){DATA_TRANSFER}: Received Event DESYNC_IND
+DLGLOBAL DEBUG V110-TA(test_syncing){DATA_TRANSFER}: State change to RESYNCING (X1, 3s)
+osmo_v110_ta_frame_out(): S-bits are expected to be 0 (ON)
+osmo_v110_ta_frame_out(): X-bits are expected to be 1 (OFF)
+osmo_v110_ta_frame_out(): D-bits are to be set by .tx_cb()
+DLGLOBAL DEBUG V110-TA(test_syncing){RESYNCING}: Received Event TX_FRAME_RTS
+v110_ta_test_tx_cb(buf_size=48): 010101010101010101010101010101010101010101010101
+osmo_v110_ta_frame_out() returns 0
+ D-bits: 010101010101010101010101010101010101010101010101
+ E-bits: 0111111
+ S-bits: 000000000
+ X-bits: 11
+osmo_v110_ta_sync_ind(): the lower layer indicates sync event
+DLGLOBAL DEBUG V110-TA(test_syncing){RESYNCING}: Received Event SYNC_IND
+DLGLOBAL DEBUG V110-TA(test_syncing){RESYNCING}: State change to DATA_TRANSFER (no timeout)
+osmo_v110_ta_frame_out(): S-bits are expected to be 0 (ON)
+osmo_v110_ta_frame_out(): X-bits are expected to be 0 (ON)
+osmo_v110_ta_frame_out(): D-bits are to be set by .tx_cb()
+DLGLOBAL DEBUG V110-TA(test_syncing){DATA_TRANSFER}: Received Event TX_FRAME_RTS
+v110_ta_test_tx_cb(buf_size=48): 010101010101010101010101010101010101010101010101
+osmo_v110_ta_frame_out() returns 0
+ D-bits: 010101010101010101010101010101010101010101010101
+ E-bits: 0111111
+ S-bits: 000000000
+ X-bits: 00
+DLGLOBAL DEBUG V110-TA(test_syncing){DATA_TRANSFER}: Deallocated