This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/19929 ) Change subject: e1-prbs-test: Add support for osmo-e1d ...................................................................... e1-prbs-test: Add support for osmo-e1d This allows e1-prbs-test to not only use DAHDI devices, but also osmo-e1d supported devices Change-Id: I0e88f2b056db931b0e442567efa9a8d270abb9f2 --- M contrib/e1-prbs-test/Makefile M contrib/e1-prbs-test/main.c 2 files changed, 55 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/29/19929/1 diff --git a/contrib/e1-prbs-test/Makefile b/contrib/e1-prbs-test/Makefile index 172847f..598366a 100644 --- a/contrib/e1-prbs-test/Makefile +++ b/contrib/e1-prbs-test/Makefile @@ -1,5 +1,5 @@ -LIBOSMO_CFLAGS:=$(shell pkg-config --cflags libosmocore) -LIBOSMO_LIBS:=$(shell pkg-config --libs libosmocore) +LIBOSMO_CFLAGS:=$(shell pkg-config --cflags libosmocore libosmo-e1d) +LIBOSMO_LIBS:=$(shell pkg-config --libs libosmocore libosmo-e1d) CFLAGS=-O2 -g -Wall -Werror $(LIBOSMO_CFLAGS) LIBS=$(LIBOSMO_LIBS) diff --git a/contrib/e1-prbs-test/main.c b/contrib/e1-prbs-test/main.c index 4fe0e84..a124087 100644 --- a/contrib/e1-prbs-test/main.c +++ b/contrib/e1-prbs-test/main.c @@ -40,6 +40,8 @@ #include <osmocom/core/bits.h> #include <osmocom/core/prbs.h> +#include <osmocom/e1d/proto_clnt.h> + #include "internal.h" static struct test_state g_tst; @@ -69,12 +71,58 @@ return 0; } +static void init_timeslot(struct timeslot_state *ts) +{ + osmo_fd_register(&ts->ofd); + printf("E1TS(%02u) opened\n", ts->ofd.priv_nr); + + ts_init_prbs_tx(ts, g_prbs_offs_tx); + ts_init_prbs_rx(ts, g_prbs_offs_rx); + + /* start to put something into the transmit queue, before we get read-triggered + * later on */ + process_tx(ts, 1024); +} + +static int open_slots_e1d(struct test_state *tst, int intf_nr, int line_nr) +{ + struct osmo_e1dp_client *clnt = osmo_e1dp_client_create(NULL, E1DP_DEFAULT_SOCKET); + int i, rc, num_slots = 0; + + if (!clnt) { + fprintf(stderr, "Unable to connect to osmo-e1d\n"); + return -1; + } + + for (i = 1; i < 32; i++) { + struct timeslot_state *ts; + rc = osmo_e1dp_client_ts_open(clnt, intf_nr, line_nr, i, E1DP_TSMODE_RAW, 1024); + if (rc < 0) { + fprintf(stderr, "Error opening %d: %d (%s)\n", i, rc, strerror(errno)); + return -1; + } + ts = &tst->ts[tst->next_unused_ts++]; + + /* open the respective file descriptor */ + osmo_fd_setup(&ts->ofd, rc, BSC_FD_READ, e1_fd_cb, ts, i); + + init_timeslot(ts); + num_slots++; + } + + return num_slots; +} + static int open_slots(struct test_state *tst, const char *basedir) { - DIR *dir = opendir(basedir); + DIR *dir; struct dirent *ent; int rc, num_slots = 0; + if (!strcmp(basedir, "e1d")) + return open_slots_e1d(tst, 0, 0); + + dir = opendir(basedir); if (!dir) return -ENOENT; @@ -99,15 +147,6 @@ /* open the respective file descriptor */ osmo_fd_setup(&ts->ofd, rc, BSC_FD_READ, e1_fd_cb, ts, atoi(ent->d_name)); - osmo_fd_register(&ts->ofd); - printf("E1TS(%02u) opened\n", ts->ofd.priv_nr); - - ts_init_prbs_tx(ts, g_prbs_offs_tx); - ts_init_prbs_rx(ts, g_prbs_offs_rx); - - /* start to put something into the transmit queue, before we get read-triggered - * later on */ - process_tx(ts, 1024); cfg_dahdi_buffer(ts->ofd.fd); struct dahdi_bufferinfo bi; @@ -115,6 +154,8 @@ OSMO_ASSERT(rc == 0); printf("tx_pol=%d, rx_pol=%d, num=%d, size=%d, nread=%d, nwrite=%d\n", bi.txbufpolicy, bi.rxbufpolicy, bi.numbufs, bi.bufsize, bi.readbufs, bi.writebufs); + + init_timeslot(ts); num_slots++; } closedir(dir); @@ -198,6 +239,8 @@ set_realtime(10); rc = open_slots(&g_tst, basedir); + if (rc < 0) + exit(1); printf("==> opened a total of %d slots\n", rc); signal(SIGINT, sig_handler); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/19929 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I0e88f2b056db931b0e442567efa9a8d270abb9f2 Gerrit-Change-Number: 19929 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200901/36bdd765/attachment.htm>