1 /* $Id: capimain.c,v 1.24 2003/09/09 06:51:05 schindler Exp $
3 * ISDN interface module for Eicon active cards DIVA.
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/init.h>
15 #include <asm/uaccess.h>
16 #include <linux/smp_lock.h>
17 #include <linux/skbuff.h>
28 static char *main_revision = "$Revision: 1.24 $";
29 static char *DRIVERNAME =
30 "Eicon DIVA - CAPI Interface driver (http://www.melware.net)";
31 static char *DRIVERLNAME = "divacapi";
33 MODULE_DESCRIPTION("CAPI driver for Eicon DIVA cards");
34 MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
35 MODULE_SUPPORTED_DEVICE("CAPI and DIVA card drivers");
36 MODULE_LICENSE("GPL");
39 * get revision number from revision string
41 static char *getrev(const char *revision)
45 if ((p = strchr(revision, ':'))) {
56 * alloc a message buffer
58 diva_os_message_buffer_s *diva_os_alloc_message_buffer(unsigned long size,
61 diva_os_message_buffer_s *dmb = alloc_skb(size, GFP_ATOMIC);
63 *data_buf = skb_put(dmb, size);
69 * free a message buffer
71 void diva_os_free_message_buffer(diva_os_message_buffer_s * dmb)
77 * proc function for controller info
79 static int diva_ctl_read_proc(char *page, char **start, off_t off,
80 int count, int *eof, struct capi_ctr *ctrl)
82 diva_card *card = (diva_card *) ctrl->driverdata;
85 len += sprintf(page + len, "%s\n", ctrl->name);
86 len += sprintf(page + len, "Serial No. : %s\n", ctrl->serial);
87 len += sprintf(page + len, "Id : %d\n", card->Id);
88 len += sprintf(page + len, "Channels : %d\n", card->d.channels);
90 if (off + count >= len)
95 return ((count < len - off) ? count : len - off);
99 * set additional os settings in capi_ctr struct
101 void diva_os_set_controller_struct(struct capi_ctr *ctrl)
103 ctrl->driver_name = DRIVERLNAME;
104 ctrl->load_firmware = NULL;
105 ctrl->reset_ctr = NULL;
106 ctrl->ctr_read_proc = diva_ctl_read_proc;
107 ctrl->owner = THIS_MODULE;
113 static int DIVA_INIT_FUNCTION divacapi_init(void)
118 sprintf(DRIVERRELEASE_CAPI, "%d.%d%s", DRRELMAJOR, DRRELMINOR,
121 printk(KERN_INFO "%s\n", DRIVERNAME);
122 printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_CAPI);
123 strcpy(tmprev, main_revision);
124 printk("%s Build: %s(%s)\n", getrev(tmprev),
125 diva_capi_common_code_build, DIVA_BUILD);
127 if (!(init_capifunc())) {
128 printk(KERN_ERR "%s: failed init capi_driver.\n",
139 static void DIVA_EXIT_FUNCTION divacapi_exit(void)
142 printk(KERN_INFO "%s: module unloaded.\n", DRIVERLNAME);
145 module_init(divacapi_init);
146 module_exit(divacapi_exit);