aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKarsten Keil <keil@b1-systems.de>2009-07-08 08:21:12 -0400
committerKarsten Keil <keil@b1-systems.de>2009-07-25 14:15:21 -0400
commitcb3824bade2549d7ad059d5802da43312540fdee (patch)
tree0ffcce666a8d3534f48ffa162defecf7e781c8ba /drivers
parent74d154189d597b91da4322996dbf4f5c3d1544ab (diff)
ISDN: Make isdnhdlc usable for other ISDN drivers
isdnhdlc is useful for other ISDN drivers as well. Move the include file to a central location and the source to the central isdn location. Signed-off-by: Karsten Keil <keil@b1-systems.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/isdn/Kconfig6
-rw-r--r--drivers/isdn/hisax/Kconfig6
-rw-r--r--drivers/isdn/hisax/Makefile4
-rw-r--r--drivers/isdn/hisax/isdnhdlc.h70
-rw-r--r--drivers/isdn/hisax/st5481.h2
-rw-r--r--drivers/isdn/i4l/Kconfig11
-rw-r--r--drivers/isdn/i4l/Makefile1
-rw-r--r--drivers/isdn/i4l/isdnhdlc.c (renamed from drivers/isdn/hisax/isdnhdlc.c)2
8 files changed, 17 insertions, 85 deletions
diff --git a/drivers/isdn/Kconfig b/drivers/isdn/Kconfig
index 02bdca6f95c3..022a19452953 100644
--- a/drivers/isdn/Kconfig
+++ b/drivers/isdn/Kconfig
@@ -21,8 +21,6 @@ menuconfig ISDN
21 21
22if ISDN 22if ISDN
23 23
24source "drivers/isdn/mISDN/Kconfig"
25
26menuconfig ISDN_I4L 24menuconfig ISDN_I4L
27 tristate "Old ISDN4Linux (deprecated)" 25 tristate "Old ISDN4Linux (deprecated)"
28 ---help--- 26 ---help---
@@ -41,9 +39,9 @@ menuconfig ISDN_I4L
41 It is still available, though, for use with adapters that are not 39 It is still available, though, for use with adapters that are not
42 supported by the new CAPI subsystem yet. 40 supported by the new CAPI subsystem yet.
43 41
44if ISDN_I4L 42source "drivers/isdn/mISDN/Kconfig"
43
45source "drivers/isdn/i4l/Kconfig" 44source "drivers/isdn/i4l/Kconfig"
46endif
47 45
48menuconfig ISDN_CAPI 46menuconfig ISDN_CAPI
49 tristate "CAPI 2.0 subsystem" 47 tristate "CAPI 2.0 subsystem"
diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index 7832d8ba8e44..3464ebc4cdbc 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -391,6 +391,7 @@ comment "HiSax sub driver modules"
391config HISAX_ST5481 391config HISAX_ST5481
392 tristate "ST5481 USB ISDN modem (EXPERIMENTAL)" 392 tristate "ST5481 USB ISDN modem (EXPERIMENTAL)"
393 depends on USB && EXPERIMENTAL 393 depends on USB && EXPERIMENTAL
394 select ISDN_HDLC
394 select CRC_CCITT 395 select CRC_CCITT
395 select BITREVERSE 396 select BITREVERSE
396 help 397 help
@@ -418,11 +419,6 @@ config HISAX_FRITZ_PCIPNP
418 (the latter also needs you to select "ISA Plug and Play support" 419 (the latter also needs you to select "ISA Plug and Play support"
419 from the menu "Plug and Play configuration") 420 from the menu "Plug and Play configuration")
420 421
421config HISAX_HDLC
422 bool
423 depends on HISAX_ST5481
424 default y
425
426config HISAX_AVM_A1_PCMCIA 422config HISAX_AVM_A1_PCMCIA
427 bool 423 bool
428 depends on HISAX_AVM_A1_CS 424 depends on HISAX_AVM_A1_CS
diff --git a/drivers/isdn/hisax/Makefile b/drivers/isdn/hisax/Makefile
index c7a3794bdae4..ab638b083df9 100644
--- a/drivers/isdn/hisax/Makefile
+++ b/drivers/isdn/hisax/Makefile
@@ -16,10 +16,6 @@ obj-$(CONFIG_HISAX_HFCUSB) += hfc_usb.o
16obj-$(CONFIG_HISAX_HFC4S8S) += hfc4s8s_l1.o 16obj-$(CONFIG_HISAX_HFC4S8S) += hfc4s8s_l1.o
17obj-$(CONFIG_HISAX_FRITZ_PCIPNP) += hisax_isac.o hisax_fcpcipnp.o 17obj-$(CONFIG_HISAX_FRITZ_PCIPNP) += hisax_isac.o hisax_fcpcipnp.o
18 18
19ifdef CONFIG_HISAX_HDLC
20obj-$(CONFIG_ISDN_DRV_HISAX) += isdnhdlc.o
21endif
22
23# Multipart objects. 19# Multipart objects.
24 20
25hisax_st5481-y := st5481_init.o st5481_usb.o st5481_d.o \ 21hisax_st5481-y := st5481_init.o st5481_usb.o st5481_d.o \
diff --git a/drivers/isdn/hisax/isdnhdlc.h b/drivers/isdn/hisax/isdnhdlc.h
deleted file mode 100644
index cf0a95a24015..000000000000
--- a/drivers/isdn/hisax/isdnhdlc.h
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * isdnhdlc.h -- General purpose ISDN HDLC decoder.
3 *
4 * Implementation of a HDLC decoder/encoder in software.
5 * Neccessary because some ISDN devices don't have HDLC
6 * controllers. Also included: a bit reversal table.
7 *
8 *Copyright (C) 2002 Wolfgang Mües <wolfgang@iksw-muees.de>
9 * 2001 Frode Isaksen <fisaksen@bewan.com>
10 * 2001 Kai Germaschewski <kai.germaschewski@gmx.de>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#ifndef __ISDNHDLC_H__
28#define __ISDNHDLC_H__
29
30struct isdnhdlc_vars {
31 int bit_shift;
32 int hdlc_bits1;
33 int data_bits;
34 int ffbit_shift; // encoding only
35 int state;
36 int dstpos;
37
38 unsigned short crc;
39
40 unsigned char cbin;
41 unsigned char shift_reg;
42 unsigned char ffvalue;
43
44 unsigned int data_received:1; // set if transferring data
45 unsigned int dchannel:1; // set if D channel (send idle instead of flags)
46 unsigned int do_adapt56:1; // set if 56K adaptation
47 unsigned int do_closing:1; // set if in closing phase (need to send CRC + flag
48};
49
50
51/*
52 The return value from isdnhdlc_decode is
53 the frame length, 0 if no complete frame was decoded,
54 or a negative error number
55*/
56#define HDLC_FRAMING_ERROR 1
57#define HDLC_CRC_ERROR 2
58#define HDLC_LENGTH_ERROR 3
59
60extern void isdnhdlc_rcv_init (struct isdnhdlc_vars *hdlc, int do_adapt56);
61
62extern int isdnhdlc_decode (struct isdnhdlc_vars *hdlc, const unsigned char *src, int slen,int *count,
63 unsigned char *dst, int dsize);
64
65extern void isdnhdlc_out_init (struct isdnhdlc_vars *hdlc,int is_d_channel,int do_adapt56);
66
67extern int isdnhdlc_encode (struct isdnhdlc_vars *hdlc,const unsigned char *src,unsigned short slen,int *count,
68 unsigned char *dst,int dsize);
69
70#endif /* __ISDNHDLC_H__ */
diff --git a/drivers/isdn/hisax/st5481.h b/drivers/isdn/hisax/st5481.h
index cff7a6354334..64f78a8c28c5 100644
--- a/drivers/isdn/hisax/st5481.h
+++ b/drivers/isdn/hisax/st5481.h
@@ -226,7 +226,7 @@ printk(KERN_WARNING "%s:%s: " format "\n" , __FILE__, __func__ , ## arg)
226#define INFO(format, arg...) \ 226#define INFO(format, arg...) \
227printk(KERN_INFO "%s:%s: " format "\n" , __FILE__, __func__ , ## arg) 227printk(KERN_INFO "%s:%s: " format "\n" , __FILE__, __func__ , ## arg)
228 228
229#include "isdnhdlc.h" 229#include <linux/isdn/hdlc.h>
230#include "fsm.h" 230#include "fsm.h"
231#include "hisax_if.h" 231#include "hisax_if.h"
232#include <linux/skbuff.h> 232#include <linux/skbuff.h>
diff --git a/drivers/isdn/i4l/Kconfig b/drivers/isdn/i4l/Kconfig
index ed3510f273d8..dd744ffd240b 100644
--- a/drivers/isdn/i4l/Kconfig
+++ b/drivers/isdn/i4l/Kconfig
@@ -2,6 +2,8 @@
2# Old ISDN4Linux config 2# Old ISDN4Linux config
3# 3#
4 4
5if ISDN_I4L
6
5config ISDN_PPP 7config ISDN_PPP
6 bool "Support synchronous PPP" 8 bool "Support synchronous PPP"
7 depends on INET 9 depends on INET
@@ -135,3 +137,12 @@ source "drivers/isdn/act2000/Kconfig"
135source "drivers/isdn/hysdn/Kconfig" 137source "drivers/isdn/hysdn/Kconfig"
136 138
137endmenu 139endmenu
140# end ISDN_I4L
141endif
142
143config ISDN_HDLC
144 tristate
145 depends on HISAX_ST5481
146 select CRC_CCITT
147 select BITREVERSE
148
diff --git a/drivers/isdn/i4l/Makefile b/drivers/isdn/i4l/Makefile
index 49a06c0005dd..cb9d3bb9fae0 100644
--- a/drivers/isdn/i4l/Makefile
+++ b/drivers/isdn/i4l/Makefile
@@ -4,6 +4,7 @@
4 4
5obj-$(CONFIG_ISDN_I4L) += isdn.o 5obj-$(CONFIG_ISDN_I4L) += isdn.o
6obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o 6obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o
7obj-$(CONFIG_ISDN_HDLC) += isdnhdlc.o
7 8
8# Multipart objects. 9# Multipart objects.
9 10
diff --git a/drivers/isdn/hisax/isdnhdlc.c b/drivers/isdn/i4l/isdnhdlc.c
index c69a77a80062..44ec7418496b 100644
--- a/drivers/isdn/hisax/isdnhdlc.c
+++ b/drivers/isdn/i4l/isdnhdlc.c
@@ -23,7 +23,7 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/crc-ccitt.h> 25#include <linux/crc-ccitt.h>
26#include "isdnhdlc.h" 26#include <linux/isdn/hdlc.h>
27 27
28/*-------------------------------------------------------------------*/ 28/*-------------------------------------------------------------------*/
29 29