Changes of Revision 273

libosmocore.spec Changed
x
 
1
@@ -14,13 +14,13 @@
2
 
3
 Name:           libosmocore
4
 Requires: osmocom-master
5
-Version: 1.9.0.74.ffb8
6
+Version: 1.9.0.75.6587
7
 Release:        0
8
 Summary:        The Open Source Mobile Communications Core Library
9
 License:        GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later AND AGPL-3.0-or-later
10
 Group:          Productivity/Telephony/Utilities
11
 Url:            https://osmocom.org/projects/libosmocore/wiki/Libosmocore
12
-Source: libosmocore_1.9.0.74.ffb8.tar.xz
13
+Source: libosmocore_1.9.0.75.6587.tar.xz
14
 Source1: rpmlintrc
15
 BuildRequires:  automake >= 1.6
16
 BuildRequires:  libtool >= 2
17
commit_6587dd0abbf9df6a0034de17466d061cc60d63fd.txt Added
commit_ffb8d5e026a8e0a014ef0357fbfb8c03a40f89c2.txt Deleted
libosmocore_1.9.0.74.ffb8.dsc -> libosmocore_1.9.0.75.6587.dsc Changed
22
 
1
@@ -2,7 +2,7 @@
2
 Source: libosmocore
3
 Binary: libosmocore, libosmocodec4, libosmocodec-doc, libosmocoding0, libosmocoding-doc, libosmocore21, libosmocore-doc, libosmogb14, libosmogb-doc, libosmogsm20, libosmogsm-doc, libosmoisdn0, libosmoisdn-doc, libosmovty13, libosmovty-doc, libosmoctrl0, libosmoctrl-doc, libosmosim2, libosmosim-doc, libosmousb0, libosmousb-doc, libosmocore-dev, libosmocore-utils, libosmocore-dbg
4
 Architecture: any all
5
-Version: 1.9.0.74.ffb8
6
+Version: 1.9.0.75.6587
7
 Maintainer: Osmocom team <openbsc@lists.osmocom.org>
8
 Homepage: https://projects.osmocom.org/projects/libosmocore
9
 Standards-Version: 3.9.8
10
@@ -35,8 +35,8 @@
11
  libosmovty-doc deb doc optional arch=all
12
  libosmovty13 deb libs optional arch=any
13
 Checksums-Sha1:
14
- e7a58d138f49ccb663753ecf13358cada0fdb1af 1085552 libosmocore_1.9.0.74.ffb8.tar.xz
15
+ 8e0918e17276544a3345251a0e0504b0486240a4 1086916 libosmocore_1.9.0.75.6587.tar.xz
16
 Checksums-Sha256:
17
- 7872c4c9b135a0bc31b5df70e4062a5d4457373ee7230b745ef50ec2c165a14d 1085552 libosmocore_1.9.0.74.ffb8.tar.xz
18
+ d74304e3aa366f9aa809e41b22c279ab8d5e50c21c37de5fc986ecc4ecec8286 1086916 libosmocore_1.9.0.75.6587.tar.xz
19
 Files:
20
- 7b2001e574d744f4f7421d45d0e78b0e 1085552 libosmocore_1.9.0.74.ffb8.tar.xz
21
+ d42196ae9ffbe5307feba3409aedc29c 1086916 libosmocore_1.9.0.75.6587.tar.xz
22
libosmocore_1.9.0.74.ffb8.tar.xz/.tarball-version -> libosmocore_1.9.0.75.6587.tar.xz/.tarball-version Changed
4
 
1
@@ -1 +1 @@
2
-1.9.0.74-ffb8
3
+1.9.0.75-6587
4
libosmocore_1.9.0.74.ffb8.tar.xz/debian/changelog -> libosmocore_1.9.0.75.6587.tar.xz/debian/changelog Changed
12
 
1
@@ -1,8 +1,8 @@
2
-libosmocore (1.9.0.74.ffb8) unstable; urgency=medium
3
+libosmocore (1.9.0.75.6587) unstable; urgency=medium
4
 
5
   * Automatically generated changelog entry for building the Osmocom master feed
6
 
7
- -- Osmocom OBS scripts <info@osmocom.org>  Mon, 04 Dec 2023 08:47:25 +0000
8
+ -- Osmocom OBS scripts <info@osmocom.org>  Mon, 04 Dec 2023 16:22:11 +0000
9
 
10
 libosmocore (1.9.0) unstable; urgency=medium
11
 
12
libosmocore_1.9.0.74.ffb8.tar.xz/include/osmocom/core/soft_uart.h -> libosmocore_1.9.0.75.6587.tar.xz/include/osmocom/core/soft_uart.h Changed
82
 
1
@@ -4,6 +4,7 @@
2
  *  Software UART implementation. */
3
 /*
4
  * (C) 2022 by Harald Welte <laforge@gnumonks.org>
5
+ * (C) 2023 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
6
  *
7
  * All Rights Reserved
8
  *
9
@@ -22,6 +23,8 @@
10
  */
11
 
12
 #include <stdint.h>
13
+#include <stdbool.h>
14
+
15
 #include <osmocom/core/bits.h>
16
 #include <osmocom/core/msgb.h>
17
 
18
@@ -43,12 +46,31 @@
19
    OSMO_SUART_F_BREAK      = (1 << 2), /*!< Break condition (not implemented) */
20
 };
21
 
22
-#if 0
23
+/*! Modem status "line" flags.
24
+ * https://en.wikipedia.org/wiki/RS-232#Data_and_control_signals */
25
 enum osmo_soft_uart_status {
26
-   /* RTS, CTS, ... */
27
-   _fixme,
28
+   OSMO_SUART_STATUS_F_DTR     = (1 << 0), /*!< Data Terminal Ready */
29
+   OSMO_SUART_STATUS_F_DCD     = (1 << 1), /*!< Data Carrier Detect */
30
+   OSMO_SUART_STATUS_F_DSR     = (1 << 2), /*!< Data Set Ready */
31
+   OSMO_SUART_STATUS_F_RI      = (1 << 3), /*!< Ring Indicator */
32
+   OSMO_SUART_STATUS_F_RTS_RTR = (1 << 4), /*!< Request To Send or Ready To Receive */
33
+   OSMO_SUART_STATUS_F_CTS     = (1 << 5), /*!< Clear To Send */
34
+};
35
+
36
+/*! Flow control mode.
37
+ * https://en.wikipedia.org/wiki/Flow_control_(data)#Hardware_flow_control */
38
+enum osmo_soft_uart_flow_ctrl_mode {
39
+   /*! No flow control */
40
+   OSMO_SUART_FLOW_CTRL_NONE,
41
+   /*! DTR/DSR flow control: Tx if DSR is active and drop DTR if cannot Rx anymore. */
42
+   OSMO_SUART_FLOW_CTRL_DTR_DSR,
43
+   /*! RTS/CTS flow control: Tx if CTS is active and drop RTS if cannot Rx anymore.
44
+    * The technically correct name would be RTR/CTS, because the RTS signal actually
45
+    * indicates readiness to *receive* data (Ready To Receive), and not really used
46
+    * to request a transmission (Request To Send) nowadays.  Alternatively, the RTS
47
+    * signal can be interpreted as "Request To Send to me". */
48
+   OSMO_SUART_FLOW_CTRL_RTS_CTS,
49
 };
50
-#endif
51
 
52
 /*! Configuration for a soft-UART. */
53
 struct osmo_soft_uart_cfg {
54
@@ -92,12 +114,12 @@
55
    void (*tx_cb)(void *priv, struct msgb *tx_data);
56
 
57
    /*! Modem status line change call-back.
58
-    *
59
-    * FIXME: flow control is not implemented, so it's never called.
60
-    *
61
     * \paramin priv opaque application-private data.
62
-    * \paramin status bit-mask of osmo_soft_uart_status. */
63
+    * \paramin status updated status; bit-mask of OSMO_SUART_STATUS_F_*. */
64
    void (*status_change_cb)(void *priv, unsigned int status);
65
+
66
+   /*! "Hardware" flow control mode. */
67
+   enum osmo_soft_uart_flow_ctrl_mode flow_ctrl_mode;
68
 };
69
 
70
 extern const struct osmo_soft_uart_cfg osmo_soft_uart_default_cfg;
71
@@ -118,5 +140,10 @@
72
 int osmo_soft_uart_rx_ubits(struct osmo_soft_uart *suart, const ubit_t *ubits, size_t n_ubits);
73
 int osmo_soft_uart_tx_ubits(struct osmo_soft_uart *suart, ubit_t *ubits, size_t n_ubits);
74
 
75
+unsigned int osmo_soft_uart_get_status(const struct osmo_soft_uart *suart);
76
 int osmo_soft_uart_set_status(struct osmo_soft_uart *suart, unsigned int status);
77
+void osmo_soft_uart_set_status_line(struct osmo_soft_uart *suart,
78
+                   enum osmo_soft_uart_status line,
79
+                   bool active);
80
+
81
 void osmo_soft_uart_flush_rx(struct osmo_soft_uart *suart);
82
libosmocore_1.9.0.74.ffb8.tar.xz/src/core/libosmocore.map -> libosmocore_1.9.0.75.6587.tar.xz/src/core/libosmocore.map Changed
11
 
1
@@ -450,7 +450,9 @@
2
 osmo_soft_uart_set_tx;
3
 osmo_soft_uart_rx_ubits;
4
 osmo_soft_uart_tx_ubits;
5
+osmo_soft_uart_get_status;
6
 osmo_soft_uart_set_status;
7
+osmo_soft_uart_set_status_line;
8
 osmo_soft_uart_flush_rx;
9
 osmo_stat_item_dec;
10
 osmo_stat_item_flush;
11
libosmocore_1.9.0.74.ffb8.tar.xz/src/core/soft_uart.c -> libosmocore_1.9.0.75.6587.tar.xz/src/core/soft_uart.c Changed
132
 
1
@@ -40,6 +40,8 @@
2
 struct osmo_soft_uart {
3
    struct osmo_soft_uart_cfg cfg;
4
    const char *name;
5
+   /* modem status (bitmask of OSMO_SUART_STATUS_F_*) */
6
+   unsigned int status;
7
    struct {
8
        bool running;
9
        uint8_t bit_count;
10
@@ -47,7 +49,6 @@
11
        struct msgb *msg;
12
        ubit_t parity_bit; /* 0 (even) / 1 (odd) */
13
        unsigned int flags;
14
-       unsigned int status;
15
        struct osmo_timer_list timer;
16
        enum suart_flow_state flow_state;
17
    } rx;
18
@@ -67,6 +68,7 @@
19
    .parity_mode = OSMO_SUART_PARITY_NONE,
20
    .rx_buf_size = 1024,
21
    .rx_timeout_ms = 100,
22
+   .flow_ctrl_mode = OSMO_SUART_FLOW_CTRL_NONE,
23
 };
24
 
25
 /*************************************************************************
26
@@ -273,11 +275,25 @@
27
    return tx_bit;
28
 }
29
 
30
+/* pull pending bits out of the UART */
31
+static size_t suart_tx_pending(struct osmo_soft_uart *suart, ubit_t *ubits, size_t n_ubits)
32
+{
33
+   size_t i;
34
+
35
+   for (i = 0; i < n_ubits; i++) {
36
+       if (suart->tx.flow_state == SUART_FLOW_ST_IDLE)
37
+           break;
38
+       ubitsi = suart_tx_bit(suart, NULL);
39
+   }
40
+
41
+   return i;
42
+}
43
+
44
 /*! Pull a number of unpacked bits out of the soft-UART transmitter.
45
  * \paramin suart soft-UART instance to pull the bits from.
46
  * \paramout ubits pointer to a buffer where to store pulled bits.
47
  * \paramin n_ubits number of unpacked bits to be pulled.
48
- * \returns number of bits pulled; negative on error.
49
+ * \returns number of bits pulled (may be less than n_ubits); negative on error.
50
  *          -EAGAIN indicates that the transmitter is disabled. */
51
 int osmo_soft_uart_tx_ubits(struct osmo_soft_uart *suart, ubit_t *ubits, size_t n_ubits)
52
 {
53
@@ -291,6 +307,24 @@
54
    if (!suart->tx.running)
55
        return -EAGAIN;
56
 
57
+   switch (suart->cfg.flow_ctrl_mode) {
58
+   case OSMO_SUART_FLOW_CTRL_DTR_DSR:
59
+       /* if DSR is de-asserted, Tx pending bits and suspend */
60
+       if (~suart->status & OSMO_SUART_STATUS_F_DSR)
61
+           return suart_tx_pending(suart, ubits, n_ubits);
62
+       /* else: keep transmitting as usual */
63
+       break;
64
+   case OSMO_SUART_FLOW_CTRL_RTS_CTS:
65
+       /* if CTS is de-asserted, Tx pending bits and suspend */
66
+       if (~suart->status & OSMO_SUART_STATUS_F_CTS)
67
+           return suart_tx_pending(suart, ubits, n_ubits);
68
+       /* else: keep transmitting as usual */
69
+       break;
70
+   case OSMO_SUART_FLOW_CTRL_NONE:
71
+   default:
72
+       break;
73
+   }
74
+
75
    /* calculate UART frame size for the effective config */
76
    n_frame_bits = 1 + cfg->num_data_bits + cfg->num_stop_bits;
77
    if (cfg->parity_mode != OSMO_SUART_PARITY_NONE)
78
@@ -321,16 +355,49 @@
79
    return n_ubits;
80
 }
81
 
82
-/*! Set the modem status lines of the given soft-UART.
83
- * \paramin suart soft-UART instance to update the modem status.
84
- * \paramin status mask of osmo_soft_uart_status.
85
+/*! Get the modem status bitmask of the given soft-UART.
86
+ * \paramin suart soft-UART instance to get the modem status.
87
+ * \returns bitmask of OSMO_SUART_STATUS_F_*. */
88
+unsigned int osmo_soft_uart_get_status(const struct osmo_soft_uart *suart)
89
+{
90
+   return suart->status;
91
+}
92
+
93
+/*! Set the modem status bitmask of the given soft-UART.
94
+ * \paramin suart soft-UART instance to set the modem status.
95
+ * \paramin status bitmask of OSMO_SUART_STATUS_F_*.
96
  * \returns 0 on success; negative on error. */
97
 int osmo_soft_uart_set_status(struct osmo_soft_uart *suart, unsigned int status)
98
 {
99
-   /* FIXME: Tx */
100
+   const struct osmo_soft_uart_cfg *cfg = &suart->cfg;
101
+
102
+   if (cfg->status_change_cb != NULL) {
103
+       if (suart->status != status)
104
+           cfg->status_change_cb(cfg->priv, status);
105
+   }
106
+
107
+   suart->status = status;
108
    return 0;
109
 }
110
 
111
+/*! Activate/deactivate a modem status line of the given soft-UART.
112
+ * \paramin suart soft-UART instance to update the modem status.
113
+ * \paramin line a modem status line, one of OSMO_SUART_STATUS_F_*.
114
+ * \paramin active activate (true) or deactivate (false) the line. */
115
+void osmo_soft_uart_set_status_line(struct osmo_soft_uart *suart,
116
+                   enum osmo_soft_uart_status line,
117
+                   bool active)
118
+{
119
+   unsigned int status = suart->status;
120
+
121
+   if (active) /* assert the given line */
122
+       status |= line;
123
+   else /* de-assert the given line */
124
+       status &= ~line;
125
+
126
+   osmo_soft_uart_set_status(suart, status);
127
+}
128
+
129
 
130
 /*************************************************************************
131
  * Management / Initialization
132
libosmocore_1.9.0.74.ffb8.tar.xz/tests/soft_uart/soft_uart_test.c -> libosmocore_1.9.0.75.6587.tar.xz/tests/soft_uart/soft_uart_test.c Changed
201
 
1
@@ -48,6 +48,11 @@
2
        __func__, msg->len, msg->data_len, msgb_hexdump(msg));
3
 }
4
 
5
+static void suart_status_change_cb(void *priv, unsigned int status)
6
+{
7
+   fprintf(stdout, "%s(status=0x%08x)\n", __func__, status);
8
+}
9
+
10
 static const struct osmo_soft_uart_cfg suart_test_default_cfg = {
11
    .num_data_bits = 8,
12
    .num_stop_bits = 1,
13
@@ -55,6 +60,7 @@
14
    .rx_buf_size = 128,
15
    .rx_cb = &suart_rx_cb,
16
    .tx_cb = &suart_tx_cb,
17
+   .status_change_cb = &suart_status_change_cb,
18
 };
19
 
20
 static void test_rx_exec(struct osmo_soft_uart *suart,
21
@@ -344,6 +350,203 @@
22
    osmo_soft_uart_free(suart);
23
 }
24
 
25
+static void test_modem_status(void)
26
+{
27
+   struct osmo_soft_uart *suart;
28
+   unsigned int status;
29
+
30
+   suart = osmo_soft_uart_alloc(NULL, __func__, &suart_test_default_cfg);
31
+   OSMO_ASSERT(suart != NULL);
32
+
33
+   printf("======== %s(): initial status=0x%08x\n",
34
+          __func__, osmo_soft_uart_get_status(suart));
35
+
36
+   printf("de-asserting DCD, which was not asserted\n");
37
+   osmo_soft_uart_set_status_line(suart, OSMO_SUART_STATUS_F_DCD, false);
38
+   OSMO_ASSERT(osmo_soft_uart_get_status(suart) == 0x00); /* no change */
39
+
40
+   printf("asserting both RI and DCD, expecting the callback to be called twice\n");
41
+   osmo_soft_uart_set_status_line(suart, OSMO_SUART_STATUS_F_RI, true);
42
+   osmo_soft_uart_set_status_line(suart, OSMO_SUART_STATUS_F_DCD, true);
43
+   status = osmo_soft_uart_get_status(suart);
44
+   OSMO_ASSERT(status == (OSMO_SUART_STATUS_F_RI | OSMO_SUART_STATUS_F_DCD));
45
+
46
+   printf("de-asserting RI, expecting the callback to be called\n");
47
+   osmo_soft_uart_set_status_line(suart, OSMO_SUART_STATUS_F_RI, false);
48
+   status = osmo_soft_uart_get_status(suart);
49
+   OSMO_ASSERT(status == (OSMO_SUART_STATUS_F_DCD));
50
+
51
+   printf("resetting to 0x00, expecting the callback to be called\n");
52
+   osmo_soft_uart_set_status(suart, 0x00);
53
+   OSMO_ASSERT(osmo_soft_uart_get_status(suart) == 0x00);
54
+
55
+   osmo_soft_uart_free(suart);
56
+}
57
+
58
+static void test_flow_control_dtr_dsr(void)
59
+{
60
+   struct osmo_soft_uart_cfg cfg;
61
+   struct osmo_soft_uart *suart;
62
+   ubit_t tx_buf40;
63
+   int rc;
64
+
65
+   g_tx_cb_cfg.data = (void *)"\x42\x42\x42\x42";
66
+   g_tx_cb_cfg.data_len = 4;
67
+
68
+   cfg = suart_test_default_cfg;
69
+   cfg.flow_ctrl_mode = OSMO_SUART_FLOW_CTRL_DTR_DSR;
70
+
71
+   suart = osmo_soft_uart_alloc(NULL, __func__, &cfg);
72
+   OSMO_ASSERT(suart != NULL);
73
+
74
+   osmo_soft_uart_set_tx(suart, true);
75
+   osmo_soft_uart_set_rx(suart, true);
76
+
77
+   /* expect the initial status to be 0 (all lines de-asserted) */
78
+   printf("======== %s(): initial status=0x%08x\n",
79
+          __func__, osmo_soft_uart_get_status(suart));
80
+
81
+   memset(&tx_buf0, 1, sizeof(tx_buf)); /* pre-initialize */
82
+
83
+   printf("expecting osmo_soft_uart_tx_ubits() to yield nothing\n");
84
+   rc = osmo_soft_uart_tx_ubits(suart, &tx_buf0, sizeof(tx_buf));
85
+   OSMO_ASSERT(rc == 0);
86
+
87
+   printf("expecting osmo_soft_uart_rx_ubits() to yield nothing\n");
88
+   rc = osmo_soft_uart_rx_ubits(suart, &tx_buf0, sizeof(tx_buf));
89
+   OSMO_ASSERT(rc == 0);
90
+   osmo_soft_uart_flush_rx(suart);
91
+
92
+   /* both DTR and DSR are asserted, expect both Rx and Tx to work */
93
+   printf("======== %s(): asserting both DTR and DSR\n", __func__);
94
+   osmo_soft_uart_set_status_line(suart, OSMO_SUART_STATUS_F_DTR, true);
95
+   osmo_soft_uart_set_status_line(suart, OSMO_SUART_STATUS_F_DSR, true);
96
+
97
+   memset(&tx_buf0, 1, sizeof(tx_buf)); /* pre-initialize */
98
+
99
+   printf("expecting osmo_soft_uart_tx_ubits() to "
100
+          "yield %zu bits (requesting %zu bits)\n",
101
+          sizeof(tx_buf), sizeof(tx_buf));
102
+   rc = osmo_soft_uart_tx_ubits(suart, &tx_buf0, sizeof(tx_buf));
103
+   OSMO_ASSERT(rc == sizeof(tx_buf));
104
+   printf("%s\n", osmo_ubit_dump(&tx_buf0, sizeof(tx_buf)));
105
+
106
+   printf("expecting osmo_soft_uart_rx_ubits() to "
107
+          "consume %zu bits and yield %zu chars\n",
108
+          sizeof(tx_buf), sizeof(tx_buf) / 10);
109
+   rc = osmo_soft_uart_rx_ubits(suart, &tx_buf0, sizeof(tx_buf));
110
+   OSMO_ASSERT(rc == 0);
111
+   osmo_soft_uart_flush_rx(suart);
112
+
113
+   memset(&tx_buf0, 1, sizeof(tx_buf)); /* pre-initialize */
114
+
115
+   /* make the transmitter consume one char, but pull only 2 bits */
116
+   printf("expecting osmo_soft_uart_tx_ubits() to "
117
+          "yield 2 bits (requesting 2 bits)\n");
118
+   rc = osmo_soft_uart_tx_ubits(suart, &tx_buf0, 2);
119
+   OSMO_ASSERT(rc == 2);
120
+
121
+   /* CTS gets de-asserted, the transmitter is shutting down */
122
+   printf("======== %s(): de-asserting DSR\n", __func__);
123
+   osmo_soft_uart_set_status_line(suart, OSMO_SUART_STATUS_F_DSR, false);
124
+
125
+   /* expect only the remaining 8 bits to be pulled out */
126
+   printf("expecting osmo_soft_uart_tx_ubits() to "
127
+          "yield 8 bits (requesting %zu bits)\n", sizeof(tx_buf));
128
+   rc = osmo_soft_uart_tx_ubits(suart, &tx_buf2, sizeof(tx_buf) - 2);
129
+   OSMO_ASSERT(rc == 8);
130
+
131
+   printf("expecting osmo_soft_uart_rx_ubits() to "
132
+          "consume %zu bits and yield a pending char\n", sizeof(tx_buf));
133
+   rc = osmo_soft_uart_rx_ubits(suart, &tx_buf0, sizeof(tx_buf));
134
+   OSMO_ASSERT(rc == 0);
135
+   osmo_soft_uart_flush_rx(suart);
136
+
137
+   osmo_soft_uart_free(suart);
138
+}
139
+
140
+static void test_flow_control_rts_cts(void)
141
+{
142
+   struct osmo_soft_uart_cfg cfg;
143
+   struct osmo_soft_uart *suart;
144
+   ubit_t tx_buf40;
145
+   int rc;
146
+
147
+   g_tx_cb_cfg.data = (void *)"\x42\x42\x42\x42";
148
+   g_tx_cb_cfg.data_len = 4;
149
+
150
+   cfg = suart_test_default_cfg;
151
+   cfg.flow_ctrl_mode = OSMO_SUART_FLOW_CTRL_RTS_CTS;
152
+
153
+   suart = osmo_soft_uart_alloc(NULL, __func__, &cfg);
154
+   OSMO_ASSERT(suart != NULL);
155
+
156
+   osmo_soft_uart_set_tx(suart, true);
157
+   osmo_soft_uart_set_rx(suart, true);
158
+
159
+   /* expect the initial status to be 0 (all lines de-asserted) */
160
+   printf("======== %s(): initial status=0x%08x\n",
161
+          __func__, osmo_soft_uart_get_status(suart));
162
+
163
+   memset(&tx_buf0, 1, sizeof(tx_buf)); /* pre-initialize */
164
+
165
+   printf("expecting osmo_soft_uart_tx_ubits() to yield nothing\n");
166
+   rc = osmo_soft_uart_tx_ubits(suart, &tx_buf0, sizeof(tx_buf));
167
+   OSMO_ASSERT(rc == 0);
168
+
169
+   printf("expecting osmo_soft_uart_rx_ubits() to yield nothing\n");
170
+   rc = osmo_soft_uart_rx_ubits(suart, &tx_buf0, sizeof(tx_buf));
171
+   OSMO_ASSERT(rc == 0);
172
+   osmo_soft_uart_flush_rx(suart);
173
+
174
+   /* both RTS/RTR and CTS are asserted, expect both Rx and Tx to work */
175
+   printf("======== %s(): asserting both CTS and RTS/RTR\n", __func__);
176
+   osmo_soft_uart_set_status_line(suart, OSMO_SUART_STATUS_F_CTS, true);
177
+   osmo_soft_uart_set_status_line(suart, OSMO_SUART_STATUS_F_RTS_RTR, true);
178
+
179
+   memset(&tx_buf0, 1, sizeof(tx_buf)); /* pre-initialize */
180
+
181
+   printf("expecting osmo_soft_uart_tx_ubits() to "
182
+          "yield %zu bits (requesting %zu bits)\n",
183
+          sizeof(tx_buf), sizeof(tx_buf));
184
+   rc = osmo_soft_uart_tx_ubits(suart, &tx_buf0, sizeof(tx_buf));
185
+   OSMO_ASSERT(rc == sizeof(tx_buf));
186
+   printf("%s\n", osmo_ubit_dump(&tx_buf0, sizeof(tx_buf)));
187
+
188
+   printf("expecting osmo_soft_uart_rx_ubits() to "
189
+          "consume %zu bits and yield %zu chars\n",
190
+          sizeof(tx_buf), sizeof(tx_buf) / 10);
191
+   rc = osmo_soft_uart_rx_ubits(suart, &tx_buf0, sizeof(tx_buf));
192
+   OSMO_ASSERT(rc == 0);
193
+   osmo_soft_uart_flush_rx(suart);
194
+
195
+   memset(&tx_buf0, 1, sizeof(tx_buf)); /* pre-initialize */
196
+
197
+   /* make the transmitter consume one char, but pull only 2 bits */
198
+   printf("expecting osmo_soft_uart_tx_ubits() to "
199
+          "yield 2 bits (requesting 2 bits)\n");
200
+   rc = osmo_soft_uart_tx_ubits(suart, &tx_buf0, 2);
201
libosmocore_1.9.0.74.ffb8.tar.xz/tests/soft_uart/soft_uart_test.ok -> libosmocore_1.9.0.75.6587.tar.xz/tests/soft_uart/soft_uart_test.ok Changed
50
 
1
@@ -200,3 +200,48 @@
2
 01010101011111110101010101111111
3
 ======== test_tx_rx_pull_n(): feeding 32 bits into the receiver
4
 suart_rx_cb(flags=00): 55 55 
5
+======== test_modem_status(): initial status=0x00000000
6
+de-asserting DCD, which was not asserted
7
+asserting both RI and DCD, expecting the callback to be called twice
8
+suart_status_change_cb(status=0x00000008)
9
+suart_status_change_cb(status=0x0000000a)
10
+de-asserting RI, expecting the callback to be called
11
+suart_status_change_cb(status=0x00000002)
12
+resetting to 0x00, expecting the callback to be called
13
+suart_status_change_cb(status=0x00000000)
14
+======== test_flow_control_dtr_dsr(): initial status=0x00000000
15
+expecting osmo_soft_uart_tx_ubits() to yield nothing
16
+expecting osmo_soft_uart_rx_ubits() to yield nothing
17
+======== test_flow_control_dtr_dsr(): asserting both DTR and DSR
18
+suart_status_change_cb(status=0x00000001)
19
+suart_status_change_cb(status=0x00000005)
20
+expecting osmo_soft_uart_tx_ubits() to yield 40 bits (requesting 40 bits)
21
+suart_tx_cb(len=4/4): 42 42 42 42 
22
+0010000101001000010100100001010010000101
23
+expecting osmo_soft_uart_rx_ubits() to consume 40 bits and yield 4 chars
24
+suart_rx_cb(flags=00): 42 42 42 42 
25
+expecting osmo_soft_uart_tx_ubits() to yield 2 bits (requesting 2 bits)
26
+suart_tx_cb(len=1/1): 42 
27
+======== test_flow_control_dtr_dsr(): de-asserting DSR
28
+suart_status_change_cb(status=0x00000001)
29
+expecting osmo_soft_uart_tx_ubits() to yield 8 bits (requesting 40 bits)
30
+expecting osmo_soft_uart_rx_ubits() to consume 40 bits and yield a pending char
31
+suart_rx_cb(flags=00): 42 
32
+======== test_flow_control_rts_cts(): initial status=0x00000000
33
+expecting osmo_soft_uart_tx_ubits() to yield nothing
34
+expecting osmo_soft_uart_rx_ubits() to yield nothing
35
+======== test_flow_control_rts_cts(): asserting both CTS and RTS/RTR
36
+suart_status_change_cb(status=0x00000020)
37
+suart_status_change_cb(status=0x00000030)
38
+expecting osmo_soft_uart_tx_ubits() to yield 40 bits (requesting 40 bits)
39
+suart_tx_cb(len=4/4): 42 42 42 42 
40
+0010000101001000010100100001010010000101
41
+expecting osmo_soft_uart_rx_ubits() to consume 40 bits and yield 4 chars
42
+suart_rx_cb(flags=00): 42 42 42 42 
43
+expecting osmo_soft_uart_tx_ubits() to yield 2 bits (requesting 2 bits)
44
+suart_tx_cb(len=1/1): 42 
45
+======== test_flow_control_rts_cts(): de-asserting CTS
46
+suart_status_change_cb(status=0x00000010)
47
+expecting osmo_soft_uart_tx_ubits() to yield 8 bits (requesting 40 bits)
48
+expecting osmo_soft_uart_rx_ubits() to consume 40 bits and yield a pending char
49
+suart_rx_cb(flags=00): 42 
50