Linux 4.18.10
[linux/fpc-iii.git] / drivers / isdn / hardware / eicon / capimain.c
blobf9244dc1c3c97c5745ffdfa5322a52eb78b06990
1 /* $Id: capimain.c,v 1.24 2003/09/09 06:51:05 schindler Exp $
3 * ISDN interface module for Eicon active cards DIVA.
4 * CAPI Interface
6 * Copyright 2000-2003 by Armin Schindler (mac@melware.de)
7 * Copyright 2000-2003 Cytronics & Melware (info@melware.de)
9 * This software may be used and distributed according to the terms
10 * of the GNU General Public License, incorporated herein by reference.
13 #include <linux/module.h>
14 #include <linux/slab.h>
15 #include <linux/init.h>
16 #include <linux/uaccess.h>
17 #include <linux/seq_file.h>
18 #include <linux/skbuff.h>
20 #include "os_capi.h"
22 #include "platform.h"
23 #include "di_defs.h"
24 #include "capi20.h"
25 #include "divacapi.h"
26 #include "cp_vers.h"
27 #include "capifunc.h"
29 static char *main_revision = "$Revision: 1.24 $";
30 static char *DRIVERNAME =
31 "Eicon DIVA - CAPI Interface driver (http://www.melware.net)";
32 static char *DRIVERLNAME = "divacapi";
34 MODULE_DESCRIPTION("CAPI driver for Eicon DIVA cards");
35 MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
36 MODULE_SUPPORTED_DEVICE("CAPI and DIVA card drivers");
37 MODULE_LICENSE("GPL");
40 * get revision number from revision string
42 static char *getrev(const char *revision)
44 char *rev;
45 char *p;
46 if ((p = strchr(revision, ':'))) {
47 rev = p + 2;
48 p = strchr(rev, '$');
49 *--p = 0;
50 } else
51 rev = "1.0";
52 return rev;
57 * alloc a message buffer
59 diva_os_message_buffer_s *diva_os_alloc_message_buffer(unsigned long size,
60 void **data_buf)
62 diva_os_message_buffer_s *dmb = alloc_skb(size, GFP_ATOMIC);
63 if (dmb) {
64 *data_buf = skb_put(dmb, size);
66 return (dmb);
70 * free a message buffer
72 void diva_os_free_message_buffer(diva_os_message_buffer_s *dmb)
74 kfree_skb(dmb);
78 * proc function for controller info
80 static int diva_ctl_proc_show(struct seq_file *m, void *v)
82 struct capi_ctr *ctrl = m->private;
83 diva_card *card = (diva_card *) ctrl->driverdata;
85 seq_printf(m, "%s\n", ctrl->name);
86 seq_printf(m, "Serial No. : %s\n", ctrl->serial);
87 seq_printf(m, "Id : %d\n", card->Id);
88 seq_printf(m, "Channels : %d\n", card->d.channels);
90 return 0;
94 * set additional os settings in capi_ctr struct
96 void diva_os_set_controller_struct(struct capi_ctr *ctrl)
98 ctrl->driver_name = DRIVERLNAME;
99 ctrl->load_firmware = NULL;
100 ctrl->reset_ctr = NULL;
101 ctrl->proc_show = diva_ctl_proc_show;
102 ctrl->owner = THIS_MODULE;
106 * module init
108 static int __init divacapi_init(void)
110 char tmprev[32];
111 int ret = 0;
113 sprintf(DRIVERRELEASE_CAPI, "%d.%d%s", DRRELMAJOR, DRRELMINOR,
114 DRRELEXTRA);
116 printk(KERN_INFO "%s\n", DRIVERNAME);
117 printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_CAPI);
118 strcpy(tmprev, main_revision);
119 printk("%s Build: %s(%s)\n", getrev(tmprev),
120 diva_capi_common_code_build, DIVA_BUILD);
122 if (!(init_capifunc())) {
123 printk(KERN_ERR "%s: failed init capi_driver.\n",
124 DRIVERLNAME);
125 ret = -EIO;
128 return ret;
132 * module exit
134 static void __exit divacapi_exit(void)
136 finit_capifunc();
137 printk(KERN_INFO "%s: module unloaded.\n", DRIVERLNAME);
140 module_init(divacapi_init);
141 module_exit(divacapi_exit);