blob: 934761fbe64963167837e5e0f0798b77d54d4deb [file] [log] [blame]
Matthew Fredricksond105e202010-02-16 22:07:04 +01001/* OpenBSC Abis input driver for DAHDI */
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +01002
Harald Welteba0db5b2011-02-04 21:33:14 +01003/* (C) 2008-2011 by Harald Welte <laforge@gnumonks.org>
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +01004 * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
Matthew Fredricksond105e202010-02-16 22:07:04 +01005 * (C) 2010 by Digium and Matthew Fredrickson <creslin@digium.com>
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +01006 *
7 * All Rights Reserved
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 *
23 */
24
Harald Welteca17ef82011-02-05 15:13:27 +010025#include "../../bscconfig.h"
26
27#ifdef HAVE_DAHDI_USER_H
28
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010029#include <stdio.h>
30#include <unistd.h>
31#include <stdlib.h>
32#include <errno.h>
33#include <string.h>
34#include <time.h>
35#include <sys/fcntl.h>
36#include <sys/types.h>
37#include <sys/socket.h>
38#include <sys/ioctl.h>
39#include <arpa/inet.h>
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -050040#include <dahdi/user.h>
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010041
Harald Welte1dd68c32011-02-05 13:58:46 +010042#include <osmocore/select.h>
43#include <osmocore/msgb.h>
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010044#include <openbsc/debug.h>
45#include <openbsc/gsm_data.h>
46#include <openbsc/abis_nm.h>
47#include <openbsc/abis_rsl.h>
48#include <openbsc/subchan_demux.h>
49#include <openbsc/e1_input.h>
Harald Weltef338a032011-01-14 15:55:42 +010050#include <openbsc/signal.h>
Harald Welte1dd68c32011-02-05 13:58:46 +010051#include <osmocore/talloc.h>
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010052
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010053#include "lapd.h"
54
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010055#define TS1_ALLOC_SIZE 300
56
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010057static int handle_ts1_read(struct bsc_fd *bfd)
58{
59 struct e1inp_line *line = bfd->data;
60 unsigned int ts_nr = bfd->priv_nr;
61 struct e1inp_ts *e1i_ts = &line->ts[ts_nr-1];
Matthew Fredricksonbc6649e2010-02-16 22:01:36 +010062 struct msgb *msg = msgb_alloc(TS1_ALLOC_SIZE, "DAHDI TS1");
Harald Welteba0db5b2011-02-04 21:33:14 +010063 lapd_mph_type prim;
64 unsigned int sapi, tei;
65 int ilen, ret;
Harald Welted38f1052011-02-05 19:13:00 +010066 uint8_t *idata;
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010067
68 if (!msg)
69 return -ENOMEM;
70
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -050071 ret = read(bfd->fd, msg->data, TS1_ALLOC_SIZE - 16);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010072 if (ret < 0) {
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010073 perror("read ");
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010074 }
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -050075 msgb_put(msg, ret - 2);
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010076 if (ret <= 3) {
77 perror("read ");
78 }
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010079
Harald Welteba0db5b2011-02-04 21:33:14 +010080 sapi = msg->data[0] >> 2;
81 tei = msg->data[1] >> 1;
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -050082
Harald Welteba0db5b2011-02-04 21:33:14 +010083 DEBUGP(DMI, "<= len = %d, sapi(%d) tei(%d)", ret, sapi, tei);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010084
Harald Welted38f1052011-02-05 19:13:00 +010085 idata = lapd_receive(e1i_ts->driver.dahdi.lapd, msg->data, msg->len, &ilen, &prim);
Harald Welte1458ec62011-02-05 19:50:44 +010086 if (!idata && prim == 0)
Harald Welted38f1052011-02-05 19:13:00 +010087 return -EIO;
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010088
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010089 msgb_pull(msg, 2);
90
Harald Welteba0db5b2011-02-04 21:33:14 +010091 DEBUGP(DMI, "prim %08x\n", prim);
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010092
Harald Welteba0db5b2011-02-04 21:33:14 +010093 switch (prim) {
94 case 0:
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010095 break;
Harald Welteba0db5b2011-02-04 21:33:14 +010096 case LAPD_MPH_ACTIVATE_IND:
97 DEBUGP(DMI, "MPH_ACTIVATE_IND: sapi(%d) tei(%d)\n", sapi, tei);
Harald Weltef338a032011-01-14 15:55:42 +010098 ret = e1inp_event(e1i_ts, S_INP_TEI_UP, tei, sapi);
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010099 break;
Harald Welteba0db5b2011-02-04 21:33:14 +0100100 case LAPD_MPH_DEACTIVATE_IND:
101 DEBUGP(DMI, "MPH_DEACTIVATE_IND: sapi(%d) tei(%d)\n", sapi, tei);
Harald Weltef338a032011-01-14 15:55:42 +0100102 ret = e1inp_event(e1i_ts, S_INP_TEI_DN, tei, sapi);
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +0100103 break;
Harald Welteba0db5b2011-02-04 21:33:14 +0100104 case LAPD_DL_DATA_IND:
105 case LAPD_DL_UNITDATA_IND:
Harald Welte1dd68c32011-02-05 13:58:46 +0100106 if (prim == LAPD_DL_DATA_IND)
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500107 msg->l2h = msg->data + 2;
108 else
109 msg->l2h = msg->data + 1;
110 DEBUGP(DMI, "RX: %s\n", hexdump(msgb_l2(msg), ret));
Harald Welteba0db5b2011-02-04 21:33:14 +0100111 ret = e1inp_rx_ts(e1i_ts, msg, tei, sapi);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100112 break;
113 default:
Harald Welteba0db5b2011-02-04 21:33:14 +0100114 printf("ERROR: unknown prim\n");
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100115 break;
116 }
Harald Welteba0db5b2011-02-04 21:33:14 +0100117
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500118 DEBUGP(DMI, "Returned ok\n");
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100119 return ret;
120}
121
122static int ts_want_write(struct e1inp_ts *e1i_ts)
123{
Harald Welteba0db5b2011-02-04 21:33:14 +0100124 /* We never include the DAHDI B-Channel FD into the
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100125 * writeset, since it doesn't support poll() based
Harald Welte62d46032011-02-05 20:25:22 +0100126 * write flow control */
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500127 if (e1i_ts->type == E1INP_TS_TYPE_TRAU) {
128 fprintf(stderr, "Trying to write TRAU ts\n");
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100129 return 0;
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500130 }
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100131
Harald Welted38f1052011-02-05 19:13:00 +0100132 e1i_ts->driver.dahdi.fd.when |= BSC_FD_WRITE;
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100133
134 return 0;
135}
136
137static void timeout_ts1_write(void *data)
138{
139 struct e1inp_ts *e1i_ts = (struct e1inp_ts *)data;
140
141 /* trigger write of ts1, due to tx delay timer */
142 ts_want_write(e1i_ts);
143}
144
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500145static void dahdi_write_msg(uint8_t *data, int len, void *cbdata)
146{
147 struct bsc_fd *bfd = cbdata;
148 int ret;
149
150 ret = write(bfd->fd, data, len + 2);
151
152 if (ret < 0)
153 fprintf(stderr, "%s write failed %d\n", __func__, ret);
154}
155
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100156static int handle_ts1_write(struct bsc_fd *bfd)
157{
158 struct e1inp_line *line = bfd->data;
159 unsigned int ts_nr = bfd->priv_nr;
160 struct e1inp_ts *e1i_ts = &line->ts[ts_nr-1];
161 struct e1inp_sign_link *sign_link;
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100162 struct msgb *msg;
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100163
164 bfd->when &= ~BSC_FD_WRITE;
165
166 /* get the next msg for this timeslot */
167 msg = e1inp_tx_ts(e1i_ts, &sign_link);
168 if (!msg) {
169 /* no message after tx delay timer */
170 return 0;
171 }
172
Harald Welte4ee2eaf2011-02-05 20:20:50 +0100173 lapd_transmit(e1i_ts->driver.dahdi.lapd, sign_link->tei,
174 sign_link->sapi, msg->data, msg->len);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100175 msgb_free(msg);
176
177 /* set tx delay timer for next event */
178 e1i_ts->sign.tx_timer.cb = timeout_ts1_write;
179 e1i_ts->sign.tx_timer.data = e1i_ts;
180 bsc_schedule_timer(&e1i_ts->sign.tx_timer, 0, 50000);
181
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500182 return 0;
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100183}
184
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500185
186static int invertbits = 1;
187
188static u_int8_t flip_table[256];
189
190static void init_flip_bits(void)
191{
192 int i,k;
193
194 for (i = 0 ; i < 256 ; i++) {
195 u_int8_t sample = 0 ;
196 for (k = 0; k<8; k++) {
197 if ( i & 1 << k ) sample |= 0x80 >> k;
198 }
199 flip_table[i] = sample;
200 }
201}
202
203static u_int8_t * flip_buf_bits ( u_int8_t * buf , int len)
204{
205 int i;
creslin287cd8b86f2010-03-26 12:57:31 -0500206 u_int8_t * start = buf;
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500207
208 for (i = 0 ; i < len; i++) {
209 buf[i] = flip_table[(u_int8_t)buf[i]];
210 }
211
212 return start;
213}
214
creslin287cd8b86f2010-03-26 12:57:31 -0500215#define D_BCHAN_TX_GRAN 160
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100216/* write to a B channel TS */
217static int handle_tsX_write(struct bsc_fd *bfd)
218{
219 struct e1inp_line *line = bfd->data;
220 unsigned int ts_nr = bfd->priv_nr;
221 struct e1inp_ts *e1i_ts = &line->ts[ts_nr-1];
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500222 u_int8_t tx_buf[D_BCHAN_TX_GRAN];
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100223 struct subch_mux *mx = &e1i_ts->trau.mux;
224 int ret;
225
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500226 ret = subchan_mux_out(mx, tx_buf, D_BCHAN_TX_GRAN);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100227
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500228 if (ret != D_BCHAN_TX_GRAN) {
229 fprintf(stderr, "Huh, got ret of %d\n", ret);
230 if (ret < 0)
231 return ret;
232 }
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100233
234 DEBUGP(DMIB, "BCHAN TX: %s\n",
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500235 hexdump(tx_buf, D_BCHAN_TX_GRAN));
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100236
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500237 if (invertbits) {
238 flip_buf_bits(tx_buf, ret);
239 }
240
241 ret = write(bfd->fd, tx_buf, ret);
242 if (ret < D_BCHAN_TX_GRAN)
Harald Welte1dd68c32011-02-05 13:58:46 +0100243 fprintf(stderr, "send returns %d instead of %d\n", ret,
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500244 D_BCHAN_TX_GRAN);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100245
246 return ret;
247}
248
creslin287cd8b86f2010-03-26 12:57:31 -0500249#define D_TSX_ALLOC_SIZE (D_BCHAN_TX_GRAN)
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100250/* FIXME: read from a B channel TS */
251static int handle_tsX_read(struct bsc_fd *bfd)
252{
253 struct e1inp_line *line = bfd->data;
254 unsigned int ts_nr = bfd->priv_nr;
255 struct e1inp_ts *e1i_ts = &line->ts[ts_nr-1];
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500256 struct msgb *msg = msgb_alloc(D_TSX_ALLOC_SIZE, "DAHDI TSx");
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100257 int ret;
258
259 if (!msg)
260 return -ENOMEM;
261
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500262 ret = read(bfd->fd, msg->data, D_TSX_ALLOC_SIZE);
263 if (ret < 0 || ret != D_TSX_ALLOC_SIZE) {
264 fprintf(stderr, "read error %d %s\n", ret, strerror(errno));
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100265 return ret;
266 }
267
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500268 if (invertbits) {
269 flip_buf_bits(msg->data, ret);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100270 }
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500271
272 msgb_put(msg, ret);
273
274 msg->l2h = msg->data;
275 DEBUGP(DMIB, "BCHAN RX: %s\n",
276 hexdump(msgb_l2(msg), ret));
277 ret = e1inp_rx_ts(e1i_ts, msg, 0, 0);
278 /* physical layer indicates that data has been sent,
279 * we thus can send some more data */
creslin287cd8b86f2010-03-26 12:57:31 -0500280 ret = handle_tsX_write(bfd);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100281 msgb_free(msg);
282
283 return ret;
284}
285
286/* callback from select.c in case one of the fd's can be read/written */
287static int dahdi_fd_cb(struct bsc_fd *bfd, unsigned int what)
288{
289 struct e1inp_line *line = bfd->data;
290 unsigned int ts_nr = bfd->priv_nr;
291 unsigned int idx = ts_nr-1;
292 struct e1inp_ts *e1i_ts = &line->ts[idx];
293 int rc = 0;
294
295 switch (e1i_ts->type) {
296 case E1INP_TS_TYPE_SIGN:
297 if (what & BSC_FD_READ)
298 rc = handle_ts1_read(bfd);
299 if (what & BSC_FD_WRITE)
300 rc = handle_ts1_write(bfd);
301 break;
302 case E1INP_TS_TYPE_TRAU:
303 if (what & BSC_FD_READ)
304 rc = handle_tsX_read(bfd);
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500305 if (what & BSC_FD_WRITE)
306 rc = handle_tsX_write(bfd);
Harald Welteba0db5b2011-02-04 21:33:14 +0100307 /* We never include the DAHDI B-Channel FD into the
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100308 * writeset, since it doesn't support poll() based
Harald Welte62d46032011-02-05 20:25:22 +0100309 * write flow control */
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100310 break;
311 default:
312 fprintf(stderr, "unknown E1 TS type %u\n", e1i_ts->type);
313 break;
314 }
315
316 return rc;
317}
318
Harald Welte1dd68c32011-02-05 13:58:46 +0100319static int dahdi_e1_line_update(struct e1inp_line *line);
320
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100321struct e1inp_driver dahdi_driver = {
322 .name = "DAHDI",
323 .want_write = ts_want_write,
Harald Welte1dd68c32011-02-05 13:58:46 +0100324 .line_update = &dahdi_e1_line_update,
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100325};
326
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500327void dahdi_set_bufinfo(int fd, int as_sigchan)
328{
329 struct dahdi_bufferinfo bi;
330 int x = 0;
331
332 if (ioctl(fd, DAHDI_GET_BUFINFO, &bi)) {
333 fprintf(stderr, "Error getting bufinfo\n");
334 exit(-1);
335 }
336
337 if (as_sigchan) {
338 bi.numbufs = 4;
339 bi.bufsize = 512;
340 } else {
creslin287cd8b86f2010-03-26 12:57:31 -0500341 bi.numbufs = 8;
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500342 bi.bufsize = D_BCHAN_TX_GRAN;
creslin287cd8b86f2010-03-26 12:57:31 -0500343 bi.txbufpolicy = DAHDI_POLICY_WHEN_FULL;
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500344 }
345
346 if (ioctl(fd, DAHDI_SET_BUFINFO, &bi)) {
347 fprintf(stderr, "Error setting bufinfo\n");
348 exit(-1);
349 }
350
351 if (!as_sigchan) {
352 if (ioctl(fd, DAHDI_AUDIOMODE, &x)) {
353 fprintf(stderr, "Error setting bufinfo\n");
354 exit(-1);
355 }
356 }
357
358}
359
Harald Welted38f1052011-02-05 19:13:00 +0100360static int dahdi_e1_setup(struct e1inp_line *line)
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100361{
362 int ts, ret;
363
364 /* TS0 is CRC4, don't need any fd for it */
365 for (ts = 1; ts < NUM_E1_TS; ts++) {
366 unsigned int idx = ts-1;
367 char openstr[128];
368 struct e1inp_ts *e1i_ts = &line->ts[idx];
Harald Welted38f1052011-02-05 19:13:00 +0100369 struct bsc_fd *bfd = &e1i_ts->driver.dahdi.fd;
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100370
371 bfd->data = line;
372 bfd->priv_nr = ts;
373 bfd->cb = dahdi_fd_cb;
374 snprintf(openstr, sizeof(openstr), "/dev/dahdi/%d", ts);
375
376 switch (e1i_ts->type) {
377 case E1INP_TS_TYPE_NONE:
378 continue;
379 break;
380 case E1INP_TS_TYPE_SIGN:
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500381 bfd->fd = open(openstr, O_RDWR | O_NONBLOCK);
382 if (bfd->fd == -1) {
383 fprintf(stderr, "%s could not open %s %s\n",
384 __func__, openstr, strerror(errno));
385 exit(-1);
386 }
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100387 bfd->when = BSC_FD_READ;
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500388 dahdi_set_bufinfo(bfd->fd, 1);
Harald Welted38f1052011-02-05 19:13:00 +0100389 e1i_ts->driver.dahdi.lapd = lapd_instance_alloc(dahdi_write_msg, bfd);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100390 break;
391 case E1INP_TS_TYPE_TRAU:
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500392 bfd->fd = open(openstr, O_RDWR | O_NONBLOCK);
393 if (bfd->fd == -1) {
394 fprintf(stderr, "%s could not open %s %s\n",
395 __func__, openstr, strerror(errno));
396 exit(-1);
397 }
398 dahdi_set_bufinfo(bfd->fd, 0);
Harald Welteba0db5b2011-02-04 21:33:14 +0100399 /* We never include the DAHDI B-Channel FD into the
Harald Welte62d46032011-02-05 20:25:22 +0100400 * writeset, since it doesn't support poll() based
401 * write flow control */
creslin287cd8b86f2010-03-26 12:57:31 -0500402 bfd->when = BSC_FD_READ;// | BSC_FD_WRITE;
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100403 break;
404 }
405
406 if (bfd->fd < 0) {
407 fprintf(stderr, "%s could not open %s %s\n",
408 __func__, openstr, strerror(errno));
409 return bfd->fd;
410 }
411
412 ret = bsc_register_fd(bfd);
413 if (ret < 0) {
414 fprintf(stderr, "could not register FD: %s\n",
415 strerror(ret));
416 return ret;
417 }
418 }
419
420 return 0;
421}
422
Harald Welte1dd68c32011-02-05 13:58:46 +0100423static int dahdi_e1_line_update(struct e1inp_line *line)
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100424{
Matthew Fredricksonbc6649e2010-02-16 22:01:36 +0100425 if (line->driver != &dahdi_driver)
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100426 return -EINVAL;
427
Harald Welted38f1052011-02-05 19:13:00 +0100428 return dahdi_e1_setup(line);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100429}
430
Harald Welte1dd68c32011-02-05 13:58:46 +0100431int e1inp_dahdi_init(void)
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100432{
Harald Welted38f1052011-02-05 19:13:00 +0100433 init_flip_bits();
434
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100435 /* register the driver with the core */
Harald Welte50d369e2011-02-05 15:30:48 +0100436 return e1inp_driver_register(&dahdi_driver);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100437}
Harald Welteca17ef82011-02-05 15:13:27 +0100438
439#endif /* HAVE_DAHDI_USER_H */