patch-1.3.69 linux/drivers/isdn/teles/mod.c

Next file: linux/drivers/isdn/teles/q931.c
Previous file: linux/drivers/isdn/teles/llglue.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.68/linux/drivers/isdn/teles/mod.c linux/drivers/isdn/teles/mod.c
@@ -0,0 +1,137 @@
+#include "teles.h"
+
+
+
+extern struct IsdnCard cards[];
+extern char   *teles_id;
+
+int             nrcards;
+
+typedef struct {
+	byte           *membase;
+	int             interrupt;
+	unsigned int    iobase;
+	unsigned int    protocol;
+} io_type;
+
+io_type         io[] =
+{
+	{0, 0, 0, 0},
+	{0, 0, 0, 0},
+	{0, 0, 0, 0},
+	{0, 0, 0, 0},
+	{0, 0, 0, 0},
+	{0, 0, 0, 0},
+	{0, 0, 0, 0},
+	{0, 0, 0, 0},
+	{0, 0, 0, 0},
+	{0, 0, 0, 0},
+	{0, 0, 0, 0},
+	{0, 0, 0, 0},
+	{0, 0, 0, 0},
+	{0, 0, 0, 0},
+	{0, 0, 0, 0},
+	{0, 0, 0, 0},
+};
+
+void
+teles_mod_dec_use_count(void)
+{
+	MOD_DEC_USE_COUNT;
+}
+
+void
+teles_mod_inc_use_count(void)
+{
+	MOD_INC_USE_COUNT;
+}
+
+#ifdef MODULE
+#define teles_init init_module
+#else
+void teles_setup(char *str, int *ints)
+{
+        int  i, j, argc;
+	static char sid[20];
+
+        argc = ints[0];
+        i = 0;
+        j = 1;
+        while (argc && (i<16)) {
+                if (argc) {
+                        io[i].iobase    = ints[j];
+                        j++; argc--;
+                }
+                if (argc) {
+                        io[i].interrupt = ints[j];
+                        j++; argc--;
+                }
+                if (argc) {
+                        io[i].membase   = (byte *)ints[j];
+                        j++; argc--;
+                }
+                if (argc) {
+                        io[i].protocol  = ints[j];
+                        j++; argc--;
+                }
+                i++;
+        }
+	if (strlen(str)) {
+		strcpy(sid,str);
+		teles_id = sid;
+	}
+}
+#endif
+
+int
+teles_init(void)
+{
+	int             i;
+
+	nrcards = 0;
+	for (i = 0; i < 16; i++) {
+		if (io[i].protocol) {
+			cards[i].membase   = io[i].membase;
+			cards[i].interrupt = io[i].interrupt;
+			cards[i].iobase    = io[i].iobase;
+			cards[i].protocol  = io[i].protocol;
+		}
+	}
+	for (i = 0; i < 16; i++)
+                if (cards[i].protocol)
+                        nrcards++;
+	printk(KERN_DEBUG "teles: Total %d card%s defined\n",
+               nrcards, (nrcards > 1) ? "s" : "");
+	if (teles_inithardware()) {
+                /* Install only, if at least one card found */
+                Isdnl2New();
+                TeiNew();
+                CallcNew();
+                ll_init();
+
+		/* No symbols to export, hide all symbols */
+		register_symtab(NULL);
+
+#ifdef MODULE
+                printk(KERN_NOTICE "Teles module installed\n");
+#endif
+                return (0);
+        } else
+                return -EIO;
+}
+
+#ifdef MODULE
+void
+cleanup_module(void)
+{
+
+	ll_stop();
+	TeiFree();
+	Isdnl2Free();
+	CallcFree();
+	teles_closehardware();
+	ll_unload();
+	printk(KERN_NOTICE "Teles module removed\n");
+
+}
+#endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this