ok, next time i will split the patches for easier understanding. if you require splitting of my first patch, let me know.
for better understanding and review, i will explain the usleep replacement patch again. only commit it, if you fully understand the changes. the usleep is replaced by a timer, one for each time slot (signalling only ts).
1. whenever data is queued into the tx-queue, a tx-delay timer is checked:
- the timer is not running: mISDN write event is triggered with BSC_FD_WRITE flag on file descriptor.
- the timer is running: nothing is triggered, because we still have to wait until the tx-timer timed out
2. whenever a time out occurrs:
- the BSC_FD_WRITE flag is set to trigger write event, even if tx-queue is empty.
3. whenever a write event is triggered: if it is ok to write (select() indicated that writing is possible), the tx-queue is checked:
- if queue is empty: nothing is done, delay timer remains disabled, no BSC_FD_WRITE flag is set.
- if queue is not empty: the first message is dequeued and sent to mISDN. the tx-delay timer is started and set for next write event.
special cases:
- if tx-queue is not empty, delay timer is not running and BSC_FD_WRITE flag is set (e.g. right after timeout event), subsequent data is queued and BSC_FD_WRITE flag remains set.
- if tx-timer times out, but there is no data in the tx-queue, the BSC_FD_WRITE flag will be set. the write event handler always checks for data in the tx-queue. if it is empty, the delay timer will not be started and the BSC_FD_WRITE flag will be cleared.
- the timers is not cleared on release of libbsc data structures. i expect all times to be removed on release of libbsc also.
-----Ursprüngliche Nachricht-----
Von: openbsc-bounces(a)lists.gnumonks.org [mailto:openbsc-bounces@lists.gnumonks.org] Im Auftrag von Holger Freyther
Gesendet: Donnerstag, 23. April 2009 00:11
An: openbsc(a)lists.gnumonks.org
Betreff: Re: AW: first patch: mISDN handling
On Wednesday 22 April 2009 15:44:44 Holger Freyther wrote:
> On Wednesday 22 April 2009 15:25:59 Andreas.Eversberg wrote:
> > i just want to know, if my recent patch arrived on this list (my last
> > mail), because my first mail formatting was detected as spam. i see no
> > reaction to my last mail.
>
> Yes, I waited for Harald to respond as he is the boss. My taste regarding
> patches is very special and I prefer the smaller patches... e.g. I would
> like to have separate patches for things like LAC, auto release of layer2,
> and it is hard for me to judge the actual mISDN changes as you are the
> expert there. One thing that is clearly missing is an updated configure.in
> to check for the mISDNuser header files and fail when they are not there
> and is it really necessary to invoke init_af_isdn()? Where is this coming
> from?
>
>
> I will probably/hopefully merge your:
> - LAC
> - Card NR
> - autorelease
Okay, I managed to do this today. It would be cool if you could split out your
improved log messages (__func__) and extended error checking (making sure we
have 30 bchan's) into a separate patch and I would be happy to merge this
then, afterwards the killing of the usleep should be done.
z.
Hallo Bjoern,
> What do I have to do to use the second TRX instead?
> Plug in the other Twinax connectors?
> Do I need to setup the second TRX separately on LMT?
The PC software (OpenBSC or my Windows software) has to
be adjusted to use TRX1 instead of TRX0. Its basically
"only" changing a parameter at several places, but as
far as I am aware noone tried it yet so some debugging
might be necessary.
Best regards,
Dieter
--
Dieter Spaar, Germany spaar(a)mirider.augusta.de
Hello Bjoern,
> I finally got time to try out my BTS.
> When I looked at the LMT I was confused about the
> "MBCCU0: No Load" which seems to be the TRX0 ?
Probably this is a similar problem I have with my BS-11, when
turning on the cold BS-11 the first time, frequently the firmware
load for TRX0 fails. Most certainly this comes from a hardware
problem (maybe aged capacitors ?).
I have to restart (turn off and on) the BS-11 a few times till it
works. If the unit has warmed up, I never saw this problem till now.
I also made the experience that it could help if no LMT cable (serial
cable) is attached so I usually try it this way: Turn the BS-11 on
without the LMT cable plugged in (at the BS-11 side) and after a
while (around 5 to 10 minutes) check if the firmware for TRX0 is
loading or is already loaded. If it fails, unplug the LMT cable,
turn the BS-11 off and try again. I am not really sure about the
effect of the LMT cable, but maybe the cable receives noise.
Best regards,
Dieter
--
Dieter Spaar, Germany spaar(a)mirider.augusta.de
Hey,
I had some time during a train ride to do some updates to the existing patch
set. I have merged the hopefully non controversial parts already and would
like to share the current set with you.
What is missing:
- There are still plenty of FIXMEs and the channel allocation is pretty
stupid. One request after another, no attempt to do GSM submit and call
handling at the same time... we just release the channel and start paging
again.
- VLR handling in db.c (remember where the subscriber was and load it....)
- Testing, I have not seen a powered up Siemens BS11 lately and need to test
What is there:
- Having two requests (SMS submit and Phone) should work in a way... and the
API should be "finished".
feedback is welcomed
z.
hi,
finally i finished my patch about mISDN handling, reversed time slots
and other things.
i sent this mail again, because my last formatting might be detected as
spam by "spam assassin" filters.
you will find documentation text between this patch, so scroll and look.
here is what i did:
the first part will allow new options for bsc_hack:
- alter LAC (location-area-code)
- select mISDN card number other than 0
- release layer 2 after closing
diff -Nur -x '*.Po' -x 'Makefile*' -x '*~' -x '*rej' -x '*.o'
openbsc.orig/src/bsc_hack.c openbsc/src/bsc_hack.c
--- openbsc.orig/src/bsc_hack.c 2009-03-28 11:36:37.000000000 +0100
+++ openbsc/src/bsc_hack.c 2009-04-18 06:58:34.000000000 +0200
@@ -53,8 +53,11 @@
/* MCC and MNC for the Location Area Identifier */ static int MCC = 1;
static int MNC = 1;
+static int LAC = 1;
static int ARFCN = HARDCODED_ARFCN;
static enum gsm_bts_type BTS_TYPE = GSM_BTS_TYPE_BS11;
+static int cardnr = 0;
+static int release_l2 = 0;
static const char *database_name = "hlr.sqlite3";
/* The following definitions are for OM and NM packets that we cannot
yet @@ -901,7 +904,7 @@
gsmnet->name_long = "OpenBSC";
gsmnet->name_short = "OpenBSC";
bts = &gsmnet->bts[0];
- bts->location_area_code = 1;
+ bts->location_area_code = LAC;
bts->trx[0].arfcn = ARFCN;
/* Control Channel Description */
@@ -920,7 +923,7 @@
/* E1 mISDN input setup */
if (BTS_TYPE == GSM_BTS_TYPE_BS11)
- return e1_config(bts);
+ return e1_config(bts, cardnr, release_l2);
else
return ia_config(bts);
}
@@ -952,14 +955,17 @@
printf(" Some useful help...\n");
printf(" -d option --debug=DRLL:DCC:DMM:DRR:DRSL:DNM enable
debugging\n");
printf(" -s --disable-color\n");
- printf(" -n --network-code number(MNC) \n");
+ printf(" -n --network-code number (MNC) \n");
printf(" -c --country-code number (MCC) \n");
+ printf(" -L --location-area-code number (LAC) \n");
printf(" -f --arfcn number The frequency ARFCN\n");
printf(" -l --database db-name The database to use\n");
printf(" -a --authorize-everyone Allow everyone into the
network.\n");
printf(" -r --reject-cause number The reject cause for LOCATION
UPDATING REJECT.\n");
printf(" -p --pcap file The filename of the pcap file\n");
printf(" -t --bts-type type The BTS type (bs11, nanobts900,
nanobts1800)\n");
+ printf(" -C --cardnr number For bs11 select E1 card number
other than 0\n");
+ printf(" -R --release-l2 Releases mISDN layer 2 after exit, to
unload
+driver.\n");
printf(" -h --help this text\n");
}
@@ -973,16 +979,19 @@
{"disable-color", 0, 0, 's'},
{"network-code", 1, 0, 'n'},
{"country-code", 1, 0, 'c'},
+ {"location-area-code", 1, 0, 'L'},
{"database", 1, 0, 'l'},
{"authorize-everyone", 0, 0, 'a'},
{"reject-cause", 1, 0, 'r'},
{"pcap", 1, 0, 'p'},
{"arfcn", 1, 0, 'f'},
{"bts-type", 1, 0, 't'},
+ {"cardnr", 1, 0, 'C'},
+ {"release-l2", 0, 0, 'R'},
{0, 0, 0, 0}
};
- c = getopt_long(argc, argv, "hc:n:d:sar:p:f:t:",
+ c = getopt_long(argc, argv, "hc:n:d:sar:p:f:t:C:RL:",
long_options, &option_index);
if (c == -1)
break;
@@ -1004,6 +1013,9 @@
case 'c':
MCC = atoi(optarg);
break;
+ case 'L':
+ LAC = atoi(optarg);
+ break;
case 'f':
ARFCN = atoi(optarg);
break;
@@ -1022,6 +1034,12 @@
case 't':
BTS_TYPE = parse_btstype(optarg);
break;
+ case 'C':
+ cardnr = atoi(optarg);
+ break;
+ case 'R':
+ release_l2 = 1;
+ break;
default:
/* ignore */
break;
the next part will create both e1 time slots for audio traffic. this is
required, because uninitialized slots cause segementation faults due to
invalid structure pointers.
i tested it, by using making calls on four phones.
diff -Nur -x '*.Po' -x 'Makefile*' -x '*~' -x '*rej' -x '*.o'
openbsc.orig/src/e1_config.c openbsc/src/e1_config.c
--- openbsc.orig/src/e1_config.c 2009-03-28 11:36:37.000000000
+0100
+++ openbsc/src/e1_config.c 2009-04-19 13:24:20.000000000 +0200
@@ -15,7 +15,7 @@
#define TEI_RSL 1
/* do some compiled-in configuration for our BTS/E1 setup */ -int
e1_config(struct gsm_bts *bts)
+int e1_config(struct gsm_bts *bts, int cardnr, int l2_release)
{
struct e1inp_line *line;
struct e1inp_ts *sign_ts;
@@ -29,7 +29,7 @@
/* create E1 timeslots for signalling and TRAU frames */
e1inp_ts_config(&line->ts[1-1], line, E1INP_TS_TYPE_SIGN);
e1inp_ts_config(&line->ts[2-1], line, E1INP_TS_TYPE_TRAU);
- //e1inp_ts_config(&line->ts[3-1], line, E1INP_TS_TYPE_TRAU);
+ e1inp_ts_config(&line->ts[3-1], line, E1INP_TS_TYPE_TRAU);
/* create signalling links for TS1 */
sign_ts = &line->ts[1-1];
@@ -47,13 +47,11 @@
subch_demux_activate(&line->ts[2-1].trau.demux, 2);
subch_demux_activate(&line->ts[2-1].trau.demux, 3);
-#if 0
/* enable subchannel demuxer on TS3 */
subch_demux_activate(&line->ts[3-1].trau.demux, 0);
subch_demux_activate(&line->ts[3-1].trau.demux, 1);
subch_demux_activate(&line->ts[3-1].trau.demux, 2);
subch_demux_activate(&line->ts[3-1].trau.demux, 3); -#endif
#ifdef HAVE_TRX1
/* create E1 timeslots for TRAU frames of TRX1 */ @@ -68,7 +66,7
@@
bts->trx[1].rsl_link = rsl_link;
#endif
- return mi_setup(0, line);
+ return mi_setup(cardnr, line, l2_release);
}
/* do some compiled-in configuration for our BTS/E1 setup */
then i changed the inclusion of mISDN headers. the mISDNif.h from
/usr/include/mISDNuser must be used.
in e1_input.c is no mISDN header required, so i commented them out.
in misdn.c i changed the definition of AF_ISDN and PF_ISDN.
compat_af_isdn.h will provide correct protocol family. in order to
resolve correct protocol family, init_af_isdn() must be called. this
will then work with kernel release and with GIT release. (remember that
the current kernel does not have the sapi extension in it, so use GIT.)
in order to solve the transmission delay problem (usleep(100000)) on the
timeslot 1, i added a timer to the timeslot. this timer will be started
after a tx-frame is dequeued. the BSC_FD_WRITE flag will be cleared,
because we do not require to write until the timer expires. after
timeout event, the BSC_FD_WRITE is set, even if no frame is in the
queue. the subsequent write event will dequeue the frame and restart the
timer again (if a frame is in the tx-queue).
the DL_ESTABLISH_IND will tell use when we can use the layer 2 link. i
replaced MPH_ACTIVATE_IND.
diff -Nur -x '*.Po' -x 'Makefile*' -x '*~' -x '*rej' -x '*.o'
openbsc.orig/src/e1_input.c openbsc/src/e1_input.c
--- openbsc.orig/src/e1_input.c 2009-03-28 11:36:37.000000000 +0100
+++ openbsc/src/e1_input.c 2009-04-19 13:20:00.000000000 +0200
@@ -31,12 +31,10 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <arpa/inet.h>
-#include <mISDNif.h>
+//#include <mISDNuser/mISDNif.h>
-//#define AF_COMPATIBILITY_FUNC
-//#include <compat_af_isdn.h>
-#define AF_ISDN 34
-#define PF_ISDN AF_ISDN
+//#define MISDN_OLD_AF_COMPATIBILITY
+//#include <mISDNuser/compat_af_isdn.h>
#include <openbsc/select.h>
#include <openbsc/msgb.h>
@@ -223,6 +221,7 @@
{
struct e1inp_sign_link *sign_link;
struct e1inp_driver *e1inp_driver;
+ struct e1inp_ts *e1i_ts;
msg->l2h = msg->data;
@@ -232,11 +231,16 @@
}
sign_link = msg->trx->rsl_link;
+ e1i_ts = sign_link->ts;
+
+ if (!timer_pending(&e1i_ts->sign.tx_timer)) {
+ /* notify the driver we have something to write */
+ e1inp_driver = sign_link->ts->line->driver;
+ e1inp_driver->want_write(e1i_ts);
+ }
+
msgb_enqueue(&sign_link->tx_list, msg);
- /* notify the driver we have something to write */
- e1inp_driver = sign_link->ts->line->driver;
- e1inp_driver->want_write(sign_link->ts);
return 0;
}
@@ -245,6 +249,7 @@
{
struct e1inp_sign_link *sign_link;
struct e1inp_driver *e1inp_driver;
+ struct e1inp_ts *e1i_ts;
msg->l2h = msg->data;
@@ -254,11 +259,15 @@
}
sign_link = msg->trx->bts->oml_link;
- msgb_enqueue(&sign_link->tx_list, msg);
+ e1i_ts = sign_link->ts;
- /* notify the driver we have something to write */
- e1inp_driver = sign_link->ts->line->driver;
- e1inp_driver->want_write(sign_link->ts);
+ if (!timer_pending(&e1i_ts->sign.tx_timer)) {
+ /* notify the driver we have something to write */
+ e1inp_driver = sign_link->ts->line->driver;
+ e1inp_driver->want_write(e1i_ts);
+ }
+
+ msgb_enqueue(&sign_link->tx_list, msg);
return 0;
}
diff -Nur -x '*.Po' -x 'Makefile*' -x '*~' -x '*rej' -x '*.o'
openbsc.orig/src/input/misdn.c openbsc/src/input/misdn.c
--- openbsc.orig/src/input/misdn.c 2009-03-28 11:36:36.000000000
+0100
+++ openbsc/src/input/misdn.c 2009-04-19 13:20:20.000000000 +0200
@@ -32,12 +32,11 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <arpa/inet.h>
-#include <mISDNif.h>
+#include <mISDNuser/mISDNif.h>
-//#define AF_COMPATIBILITY_FUNC
-//#include <compat_af_isdn.h>
-#define AF_ISDN 34
-#define PF_ISDN AF_ISDN
+#define MISDN_OLD_AF_COMPATIBILITY
+#define AF_COMPATIBILITY_FUNC
+#include <mISDNuser/compat_af_isdn.h>
#include <openbsc/select.h>
#include <openbsc/msgb.h>
@@ -114,8 +113,10 @@
return ret;
}
- if (alen != sizeof(l2addr))
+ if (alen != sizeof(l2addr)) {
+ fprintf(stderr, "error len\n");
return -EINVAL;
+ }
msgb_put(msg, ret);
@@ -129,7 +130,7 @@
case DL_INFORMATION_IND:
/* mISDN tells us which channel number is allocated for
this
* tuple of (SAPI, TEI). */
- DEBUGP(DMI, "use channel(%d) sapi(%d) tei(%d) for
now\n",
+ DEBUGP(DMI, "DL_INFORMATION_IND: channel(%d) sapi(%d)
tei(%d)\n",
l2addr.channel, l2addr.sapi, l2addr.tei);
link = e1inp_lookup_sign_link(e1i_ts, l2addr.tei,
l2addr.sapi);
if (!link) {
@@ -140,10 +141,16 @@
/* save the channel number in the driver private struct
*/
link->driver.misdn.channel = l2addr.channel;
break;
- case MPH_ACTIVATE_IND:
+// case MPH_ACTIVATE_IND:
+ case DL_ESTABLISH_IND:
+ DEBUGP(DMI, "DL_ESTABLISH_IND: channel(%d) sapi(%d)
tei(%d)\n",
+ l2addr.channel, l2addr.sapi, l2addr.tei);
ret = e1inp_event(e1i_ts, EVT_E1_TEI_UP, l2addr.tei,
l2addr.sapi);
break;
- case MPH_DEACTIVATE_IND:
+// case MPH_DEACTIVATE_IND:
+ case DL_RELEASE_IND:
+ DEBUGP(DMI, "DL_RELEASE_IND: channel(%d) sapi(%d)
tei(%d)\n",
+ l2addr.channel, l2addr.sapi, l2addr.tei);
ret = e1inp_event(e1i_ts, EVT_E1_TEI_DN, l2addr.tei,
l2addr.sapi);
break;
case DL_DATA_IND:
@@ -157,6 +164,27 @@
return ret;
}
+static int ts_want_write(struct e1inp_ts *e1i_ts) {
+ /* We never include the mISDN B-Channel FD into the
+ * writeset, since it doesn't support poll() based
+ * write flow control */
+ if (e1i_ts->type == E1INP_TS_TYPE_TRAU)
+ return 0;
+
+ e1i_ts->driver.misdn.fd.when |= BSC_FD_WRITE;
+
+ return 0;
+}
+
+static void timeout_ts1_write(void *data) {
+ struct e1inp_ts *e1i_ts = (struct e1inp_ts *)data;
+
+ /* trigger write of ts1, due to tx delay timer */
+ ts_want_write(e1i_ts);
+}
+
static int handle_ts1_write(struct bsc_fd *bfd) {
struct e1inp_line *line = bfd->data;
@@ -169,10 +197,12 @@
u_int8_t *l2_data;
int ret;
+ bfd->when &= ~BSC_FD_WRITE;
+
/* get the next msg for this timeslot */
msg = e1inp_tx_ts(e1i_ts, &sign_link);
if (!msg) {
- bfd->when &= ~BSC_FD_WRITE;
+ /* no message after tx delay timer */
return 0;
}
@@ -182,8 +212,8 @@
hh = (struct mISDNhead *) msgb_push(msg, sizeof(*hh));
hh->prim = DL_DATA_REQ;
- DEBUGP(DMI, "TX TEI(%d): %s\n", sign_link->tei,
- hexdump(l2_data, msg->len - MISDN_HEADER_LEN));
+ DEBUGP(DMI, "TX TEI(%d) SAPI(%d): %s\n", sign_link->tei,
+ sign_link->sapi, hexdump(l2_data, msg->len -
MISDN_HEADER_LEN));
/* construct the sockaddr */
sa.family = AF_ISDN;
@@ -193,10 +223,14 @@
ret = sendto(bfd->fd, msg->data, msg->len, 0,
(struct sockaddr *)&sa, sizeof(sa));
+ if (ret < 0)
+ fprintf(stderr, "sendto failed %d\n", ret);
msgb_free(msg);
- /* FIXME: this has to go */
- usleep(100000);
+ /* set tx delay timer for next event */
+ e1i_ts->sign.tx_timer.cb = timeout_ts1_write;
+ e1i_ts->sign.tx_timer.data = e1i_ts;
+ schedule_timer(&e1i_ts->sign.tx_timer, 0, 50000);
return ret;
}
@@ -253,8 +287,9 @@
msgb_put(msg, ret);
- DEBUGP(DMIB, "<= BCHAN len = %d, prim(0x%x) id(0x%x): %s\n",
- ret, hh->prim, hh->id, get_prim_name(hh->prim));
+ if (hh->prim != PH_CONTROL_IND)
+ DEBUGP(DMIB, "<= BCHAN len = %d, prim(0x%x) id(0x%x):
%s\n",
+ ret, hh->prim, hh->id, get_prim_name(hh->prim));
switch (hh->prim) {
case PH_DATA_IND:
@@ -332,28 +367,16 @@
return ret;
}
-static int ts_want_write(struct e1inp_ts *e1i_ts) -{
- /* We never include the mISDN B-Channel FD into the
- * writeset, since it doesn't support poll() based
- * write flow control */
- if (e1i_ts->type == E1INP_TS_TYPE_TRAU)
- return 0;
-
- e1i_ts->driver.misdn.fd.when |= BSC_FD_WRITE;
-
- return 0;
-}
-
struct e1inp_driver misdn_driver = {
.name = "mISDNuser",
.want_write = ts_want_write,
};
-static int mi_e1_setup(struct e1inp_line *line)
+static int mi_e1_setup(struct e1inp_line *line, int release_l2)
{
struct mi_e1_handle *e1h = line->driver_data;
int ts, ret;
+ int clean = 1;
/* TS0 is CRC4, don't need any fd for it */
for (ts = 1; ts < NUM_E1_TS; ts++) {
@@ -384,8 +407,8 @@
}
if (bfd->fd < 0) {
- fprintf(stderr, "could not open socket %s\n",
- strerror(errno));
+ fprintf(stderr, "%s could not open socket %s\n",
+ __func__, strerror(errno));
return bfd->fd;
}
@@ -395,8 +418,6 @@
switch (e1i_ts->type) {
case E1INP_TS_TYPE_SIGN:
addr.channel = 0;
- /* SAPI not supported yet in kernel */
- //addr.sapi = e1inp_ts->sign.sapi;
addr.sapi = 0;
addr.tei = GROUP_TEI;
break;
@@ -415,6 +436,13 @@
strerror(errno));
return -EIO;
}
+ if (e1i_ts->type == E1INP_TS_TYPE_SIGN && release_l2) {
+ ret = ioctl(bfd->fd, IMCLEAR_L2, &clean);
+ if (ret < 0) {
+ fprintf(stderr, "could not send IOCTL
IMCLEAN_L2 %s\n", strerror(errno));
+ return -EIO;
+ }
+ }
/* FIXME: only activate B-Channels once we start to
* use them to conserve CPU power */
@@ -432,12 +460,14 @@
return 0;
}
-int mi_setup(int cardnr, struct e1inp_line *line)
+int mi_setup(int cardnr, struct e1inp_line *line, int release_l2)
{
struct mi_e1_handle *e1h;
int sk, ret, cnt;
struct mISDN_devinfo devinfo;
+ init_af_isdn();
+
/* register the driver with the core */
/* FIXME: do this in the plugin initializer function */
ret = e1inp_driver_register(&misdn_driver);
@@ -457,7 +487,7 @@
/* open the ISDN card device */
sk = socket(PF_ISDN, SOCK_RAW, ISDN_P_BASE);
if (sk < 0) {
- fprintf(stderr, "could not open socket %s\n",
strerror(errno));
+ fprintf(stderr, "%s could not open socket %s\n",
__func__,
+strerror(errno));
return sk;
}
@@ -484,9 +514,20 @@
fprintf(stdout, " protocol: %d\n",
devinfo.protocol);
fprintf(stdout, " nrbchan: %d\n",
devinfo.nrbchan);
fprintf(stdout, " name: %s\n", devinfo.name);
+#else
+ printf("using device %d\n", e1h->cardnr);
#endif
- ret = mi_e1_setup(line);
+ if (!(devinfo.Dprotocols & (1 << ISDN_P_NT_E1))) {
+ fprintf(stderr, "error: card is not of type E1
(NT-mode)\n");
+ return -EINVAL;
+ }
+ if (devinfo.nrbchan != 30) {
+ fprintf(stderr, "error: E1 card has no 30
B-channels\n");
+ return -EINVAL;
+ }
+
+ ret = mi_e1_setup(line, release_l2);
if (ret)
return ret;
the subchanneling is reversed in my case. maybe we can use "#ifdef"
until we know why this works for me and not in the reverse case: bit
order "87654321" work, but "21436587" does not.
here is my theory why this works for others: first i enabled second
b-channel, so i expect that others have it disabled.
because we use timeslot 1 of TRX for signalling, others can use just 3
timeslots on TRX for audio, and can make no more than one call at a
time, because two slots are required for a call. in my case, i have the
first call on time slot 3 and 4 (channel 2 and 3 on TRX). i did not
debug why channel 1 is not selected for first call. if others use time
slot 2 and 3 (channel 1 and 2 on TRX), it does not matter if the channel
order is swapped, because slot 2 is swapped with slot 3, and both will
not change their position. you will not notice the difference, until
slots on different positions are used.
diff -Nur -x '*.Po' -x 'Makefile*' -x '*~' -x '*rej' -x '*.o'
openbsc.orig/src/subchan_demux.c openbsc/src/subchan_demux.c
--- openbsc.orig/src/subchan_demux.c 2009-02-23 17:58:34.000000000
+0100
+++ openbsc/src/subchan_demux.c 2009-04-19 13:30:08.000000000 +0200
@@ -100,7 +100,7 @@
if (!(dmx->chan_activ & (1 << c)))
continue;
- inbits = inbyte >> ((3-c)*2);
+ inbits = inbyte >> (c << 1);
/* two bits for each subchannel */
if (inbits & 0x01)
@@ -230,10 +230,10 @@
int rc;
/* combine two bits of every subchan */
- rc = get_subch_bits(mx, 3, &bits[0], 2);
- rc = get_subch_bits(mx, 2, &bits[2], 2);
- rc = get_subch_bits(mx, 1, &bits[4], 2);
- rc = get_subch_bits(mx, 0, &bits[6], 2);
+ rc = get_subch_bits(mx, 0, &bits[0], 2);
+ rc = get_subch_bits(mx, 1, &bits[2], 2);
+ rc = get_subch_bits(mx, 2, &bits[4], 2);
+ rc = get_subch_bits(mx, 3, &bits[6], 2);
*byte = compact_bits(bits);
finally the includes:
diff -Nur -x '*.Po' -x 'Makefile*' -x '*~' -x '*rej' -x '*.o'
openbsc.orig/include/openbsc/e1_input.h
openbsc/include/openbsc/e1_input.h
--- openbsc.orig/include/openbsc/e1_input.h 2009-03-28
11:36:36.000000000 +0100
+++ openbsc/include/openbsc/e1_input.h 2009-04-19 12:46:37.000000000
+0200
@@ -63,7 +63,10 @@
union {
struct {
+ /* list of all signalling links on this TS */
struct llist_head sign_links;
+ /* timer when to dequeue next frame */
+ struct timer_list tx_timer;
} sign;
struct {
/* subchannel demuxer for frames from E1 */ @@
-142,7 +145,7 @@ struct subch_mux *e1inp_get_mux(u_int8_t e1_nr,
u_int8_t ts_nr);
/* e1_config.c */
-int e1_config(struct gsm_bts *bts);
+int e1_config(struct gsm_bts *bts, int card, int l2_release);
int ia_config(struct gsm_bts *bts);
int ipaccess_setup(struct e1inp_line *line);
diff -Nur -x '*.Po' -x 'Makefile*' -x '*~' -x '*rej' -x '*.o'
openbsc.orig/include/openbsc/misdn.h openbsc/include/openbsc/misdn.h
--- openbsc.orig/include/openbsc/misdn.h 2009-03-28
11:36:36.000000000 +0100
+++ openbsc/include/openbsc/misdn.h 2009-04-19 12:48:28.000000000
+0200
@@ -22,7 +22,7 @@
#include "e1_input.h"
-int mi_setup(int cardnr, struct e1inp_line *line);
+int mi_setup(int cardnr, struct e1inp_line *line, int l2_release);
void mi_set_pcap_fd(int fd);
int _abis_nm_sendmsg(struct msgb *msg);
Hello Matthias,
On Fri, 17 Apr 2009 11:44:06 +0200, "Matthias Wenzel" <bs11(a)mazzoo.de> wrote:
>
> can someone post the pinout of the rs232 LMT cable - db9 on one end, and
> the 8pin header on the bs11 on the other side.
If you look at the BS-11 interface (Antenne connectors top), its the
upper 8-pin connector:
The four E1 BNC connectors are above here.
(Rx) x x x x (right pin: Gnd)
(Tx) x x x x (right pin: +5V)
|
+ LMT
You just need a three wire connection (Gnd, Rx, Tx). Tx/Rx is from
the BS-11 side, so Tx (the lower pin) has to be connected to Rx of
the PC. The levels are standard RS-232 level, to be sure just measure
the Tx pin, it has a high voltage (ca. +/- 9 Volt).
And if someone want to play with the other ports, here is how
they are connected:
The four E1 BNC connectors are above here.
(Rx) x x x x (right pin: Gnd)
(Tx) x x x x (right pin: +5V)
1 2 3
1: ?
2: LMT
3: (no COM Port, dont't connect to RS232)
(Rx) x x x x (right pin: Gnd)
(Tx) x x x x (right pin: +5V)
1 2 3
1: TRX0 L1LAPDmProc
2: TRX0 L3Proc (pwd: L3Proc)
3: TRX0 OEM_Proc (pwd: LAPDOM)
(Rx) x x x x (right pin: Gnd)
(Tx) x x x x (right pin: +5V)
1 2 3
1: TRX1 L1LAPDmProc
2: TRX1 L3Proc (pwd: L3Proc)
3: TRX1 OEM_Proc (pwd: LAPDOM)
When you boot, and the firmware is not yet loaded, you get
a prompt and can see a menu. There is a password protected
menu, the password is above ("pwd:"). The baud rate is 9600 8n1
(except LMT: 19200 8n1).
When the firmware is loaded those menus are no longer there
(they are commands in the boot ROM), however if you type
"qwertyuiop" (without the quotes, there is no echo) you can
enter debug commands in the firmware. Some menus ask for a
password, however its empty (just hit return).
I have not found really usefull things, but if someone wants
to play, feel free to do so and of course post the results if
you find something usefull.
Disclaimer: Nothing of the above comes from the NDA documentation,
its not even mentioned there. All of the above was discovered by
having a close look.
Best regards,
Dieter
--
Dieter Spaar, Germany spaar(a)mirider.augusta.de
Hello Andreas,
On Fri, 17 Apr 2009 12:45:50 +0200, "Andreas.Eversberg" <Andreas.Eversberg(a)versatel.de> wrote:
> if you need clock signals, you can use the C4IO clock line of the ISDN
> cards. they clock 4096khz. you can use them to transfer clock from one
> card to another or to mesure the clock. the E1 card has this clock on
> one pin of the PCM connector. (see data sheet) the C4IO is also
> available on the HFC-PCI single port card. with an oscilloscope you can
> compare.
>
> in order to retieve the clock from E1 interface in NT-mode, you need to:
>
> modprobe hfcmulti port=0x200 debug=0x40000
>
> watch the dmesg about init process of controller. this will override the
> default behavior: provide clock to the NT interface.
>
> i would suggest to use a resistor of 1K to protect the e1 card. the
> signal must not look good, we just need the shift of both signals.
Thanks for this tip. I already though about the E1 clock, but its
below the 10 MHz limit of the HP8922. I think I have to build a
simple frequency counter (I don't have one) and use the reference
clock of the HP8922. BTW, there is also a GSM frame pulse available
at one of the connectors (one of the J01 pins, I have to look
it up).
OK, maybe a simple frequency counter is a good reason to finally do
something usefull with my FPGA boards ;-)
Best regards,
Dieter
--
Dieter Spaar, Germany spaar(a)mirider.augusta.de
Hello Andreas,
On Fri, 17 Apr 2009 12:05:16 +0200, "Andreas.Eversberg" <Andreas.Eversberg(a)versatel.de> wrote:
> i tested external clock from isdn line yesterday. modern phones, like
> the i-phone will not register to the base station. (tested it yesterday
> together with other phones). no packet is received by openbsc. so i set
> the clock to "locked" and retrieved the clock from my isdn line (layer 1
> up). it did not help at all. the phone found the base station id while
> scanning for networks, but the registration did not work.
>
> is it possible that the provisioning (during startup) is faulty?
If I remeber, several iPhones registered to the BS-11 during
25C3. So it should work (however I cannot test it here, but
feel free to send my an iPhone for playing ;-)
Do you see the test network with the iPhone or does the
registration not work ?
Have you tried to use the SIM card from a phone which has
already registered to the test network ? This way the iPhone
would look at the BS-11 first before trying to search for other
netwoks.
Best regards,
Dieter
--
Dieter Spaar, Germany spaar(a)mirider.augusta.de
just find pin 118 of the E1 controller on the pcm bus (connector) and compare the clock (4096khz) with pin 54 on the HFC-S PCI ISDN controller. use an oscilloscope and sync it to ISDN interface. one pin higher (on both controllers) you will find 8khz frame clock signal.
if the clock differs by 1ppm, the phase of both signals cycles about four times a second. for rough calibration, i would suggest the 8khz signal. it will take 125 seconds for a full phase shift at 1ppm clock skew.
-----Ursprüngliche Nachricht-----
Von: Dieter Spaar [mailto:spaar@mirider.augusta.de]
Gesendet: Freitag, 17. April 2009 15:03
An: Andreas.Eversberg
Cc: openbsc(a)lists.gnumonks.org
Betreff: Re: AW: BS-11 PLL clock source / calibration
Hello Andreas,
On Fri, 17 Apr 2009 12:45:50 +0200, "Andreas.Eversberg" <Andreas.Eversberg(a)versatel.de> wrote:
> if you need clock signals, you can use the C4IO clock line of the ISDN
> cards. they clock 4096khz. you can use them to transfer clock from one
> card to another or to mesure the clock. the E1 card has this clock on
> one pin of the PCM connector. (see data sheet) the C4IO is also
> available on the HFC-PCI single port card. with an oscilloscope you can
> compare.
>
> in order to retieve the clock from E1 interface in NT-mode, you need to:
>
> modprobe hfcmulti port=0x200 debug=0x40000
>
> watch the dmesg about init process of controller. this will override the
> default behavior: provide clock to the NT interface.
>
> i would suggest to use a resistor of 1K to protect the e1 card. the
> signal must not look good, we just need the shift of both signals.
Thanks for this tip. I already though about the E1 clock, but its
below the 10 MHz limit of the HP8922. I think I have to build a
simple frequency counter (I don't have one) and use the reference
clock of the HP8922. BTW, there is also a GSM frame pulse available
at one of the connectors (one of the J01 pins, I have to look
it up).
OK, maybe a simple frequency counter is a good reason to finally do
something usefull with my FPGA boards ;-)
Best regards,
Dieter
--
Dieter Spaar, Germany spaar(a)mirider.augusta.de