aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-02-05 13:58:46 +0100
committerHarald Welte <laforge@gnumonks.org>2011-02-05 20:26:26 +0100
commit1dd68c3d0ffa47cf64239422b0f5bffb93d46cd1 (patch)
treed90207b726d6d9f440a012bd263172987a5bd53a /openbsc/src
parentba0db5b7f391fbefd4f87cd6fe870f5e6e44583a (diff)
[DAHDI] integrate DAHDI driver into E1 Input layer
Diffstat (limited to 'openbsc/src')
-rw-r--r--openbsc/src/Makefile.am4
-rw-r--r--openbsc/src/e1_input.c2
-rw-r--r--openbsc/src/e1_input_vty.c5
-rw-r--r--openbsc/src/input/dahdi.c17
4 files changed, 17 insertions, 11 deletions
diff --git a/openbsc/src/Makefile.am b/openbsc/src/Makefile.am
index 351b2699b..3f2140669 100644
--- a/openbsc/src/Makefile.am
+++ b/openbsc/src/Makefile.am
@@ -21,8 +21,8 @@ libbsc_a_SOURCES = abis_rsl.c abis_nm.c gsm_data.c gsm_04_08_utils.c \
gsm_subscriber_base.c subchan_demux.c bsc_rll.c transaction.c \
trau_frame.c trau_mux.c paging.c \
e1_config.c e1_input.c e1_input_vty.c \
- input/misdn.c input/ipaccess.c handover_logic.c \
- talloc_ctx.c system_information.c rest_octets.c \
+ input/misdn.c input/ipaccess.c input/dahdi.c input/lapd.c \
+ handover_logic.c talloc_ctx.c system_information.c rest_octets.c \
bts_siemens_bs11.c bts_ipaccess_nanobts.c mncc_upqueue.c \
bts_unknown.c bsc_version.c bsc_api.c bsc_vty.c meas_rep.c gsm_04_80.c
diff --git a/openbsc/src/e1_input.c b/openbsc/src/e1_input.c
index d98dbe36e..823387831 100644
--- a/openbsc/src/e1_input.c
+++ b/openbsc/src/e1_input.c
@@ -613,6 +613,7 @@ static int e1i_sig_cb(unsigned int subsys, unsigned int signal,
}
void e1inp_misdn_init(void);
+void e1inp_dahdi_init(void);
void e1inp_init(void)
{
@@ -621,4 +622,5 @@ void e1inp_init(void)
register_signal_handler(SS_GLOBAL, e1i_sig_cb, NULL);
e1inp_misdn_init();
+ e1inp_dahdi_init();
}
diff --git a/openbsc/src/e1_input_vty.c b/openbsc/src/e1_input_vty.c
index b8050a87f..3909f652f 100644
--- a/openbsc/src/e1_input_vty.c
+++ b/openbsc/src/e1_input_vty.c
@@ -38,8 +38,9 @@
#include "../bscconfig.h"
-#define E1_DRIVER_NAMES "(misdn|misdn)"
-#define E1_DRIVER_HELP "mISDN supported E1 Card\n"
+#define E1_DRIVER_NAMES "(misdn|dahdi)"
+#define E1_DRIVER_HELP "mISDN supported E1 Card\n" \
+ "DAHDI supported E1/T1/J1 Card\n"
DEFUN(cfg_e1line_driver, cfg_e1_line_driver_cmd,
"e1_line <0-255> driver " E1_DRIVER_NAMES,
diff --git a/openbsc/src/input/dahdi.c b/openbsc/src/input/dahdi.c
index 5b4571561..8f6bddae3 100644
--- a/openbsc/src/input/dahdi.c
+++ b/openbsc/src/input/dahdi.c
@@ -35,15 +35,15 @@
#include <arpa/inet.h>
#include <dahdi/user.h>
-#include <openbsc/select.h>
-#include <openbsc/msgb.h>
+#include <osmocore/select.h>
+#include <osmocore/msgb.h>
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
#include <openbsc/abis_nm.h>
#include <openbsc/abis_rsl.h>
#include <openbsc/subchan_demux.h>
#include <openbsc/e1_input.h>
-#include <openbsc/talloc.h>
+#include <osmocore/talloc.h>
#include "lapd.h"
@@ -96,7 +96,7 @@ static int handle_ts1_read(struct bsc_fd *bfd)
break;
case LAPD_DL_DATA_IND:
case LAPD_DL_UNITDATA_IND:
- if (prim == DL_DATA_IND)
+ if (prim == LAPD_DL_DATA_IND)
msg->l2h = msg->data + 2;
else
msg->l2h = msg->data + 1;
@@ -232,7 +232,7 @@ static int handle_tsX_write(struct bsc_fd *bfd)
ret = write(bfd->fd, tx_buf, ret);
if (ret < D_BCHAN_TX_GRAN)
- fprintf(stderr, "send returns %d instead of %lu\n", ret,
+ fprintf(stderr, "send returns %d instead of %d\n", ret,
D_BCHAN_TX_GRAN);
return ret;
@@ -308,9 +308,12 @@ static int dahdi_fd_cb(struct bsc_fd *bfd, unsigned int what)
return rc;
}
+static int dahdi_e1_line_update(struct e1inp_line *line);
+
struct e1inp_driver dahdi_driver = {
.name = "DAHDI",
.want_write = ts_want_write,
+ .line_update = &dahdi_e1_line_update,
};
void dahdi_set_bufinfo(int fd, int as_sigchan)
@@ -408,7 +411,7 @@ static int mi_e1_setup(struct e1inp_line *line, int release_l2)
return 0;
}
-int mi_e1_line_update(struct e1inp_line *line)
+static int dahdi_e1_line_update(struct e1inp_line *line)
{
int ret;
@@ -436,7 +439,7 @@ int mi_e1_line_update(struct e1inp_line *line)
return 0;
}
-static __attribute__((constructor)) void on_dso_load_sms(void)
+int e1inp_dahdi_init(void)
{
/* register the driver with the core */
e1inp_driver_register(&dahdi_driver);