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/skbuff.h>
27 static char *main_revision = "$Revision: 1.24 $";
28 static char *DRIVERNAME =
29 "Eicon DIVA - CAPI Interface driver (http://www.melware.net)";
30 static char *DRIVERLNAME = "divacapi";
32 MODULE_DESCRIPTION("CAPI driver for Eicon DIVA cards");
33 MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
34 MODULE_SUPPORTED_DEVICE("CAPI and DIVA card drivers");
35 MODULE_LICENSE("GPL");
38 * get revision number from revision string
40 static char *getrev(const char *revision)
44 if ((p = strchr(revision, ':'))) {
55 * alloc a message buffer
57 diva_os_message_buffer_s *diva_os_alloc_message_buffer(unsigned long size,
60 diva_os_message_buffer_s *dmb = alloc_skb(size, GFP_ATOMIC);
62 *data_buf = skb_put(dmb, size);
68 * free a message buffer
70 void diva_os_free_message_buffer(diva_os_message_buffer_s * dmb)
76 * proc function for controller info
78 static int diva_ctl_read_proc(char *page, char **start, off_t off,
79 int count, int *eof, struct capi_ctr *ctrl)
81 diva_card *card = (diva_card *) ctrl->driverdata;
84 len += sprintf(page + len, "%s\n", ctrl->name);
85 len += sprintf(page + len, "Serial No. : %s\n", ctrl->serial);
86 len += sprintf(page + len, "Id : %d\n", card->Id);
87 len += sprintf(page + len, "Channels : %d\n", card->d.channels);
89 if (off + count >= len)
94 return ((count < len - off) ? count : len - off);
98 * set additional os settings in capi_ctr struct
100 void diva_os_set_controller_struct(struct capi_ctr *ctrl)
102 ctrl->driver_name = DRIVERLNAME;
103 ctrl->load_firmware = NULL;
104 ctrl->reset_ctr = NULL;
105 ctrl->ctr_read_proc = diva_ctl_read_proc;
106 ctrl->owner = THIS_MODULE;
112 static int DIVA_INIT_FUNCTION divacapi_init(void)
117 sprintf(DRIVERRELEASE_CAPI, "%d.%d%s", DRRELMAJOR, DRRELMINOR,
120 printk(KERN_INFO "%s\n", DRIVERNAME);
121 printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_CAPI);
122 strcpy(tmprev, main_revision);
123 printk("%s Build: %s(%s)\n", getrev(tmprev),
124 diva_capi_common_code_build, DIVA_BUILD);
126 if (!(init_capifunc())) {
127 printk(KERN_ERR "%s: failed init capi_driver.\n",
138 static void DIVA_EXIT_FUNCTION divacapi_exit(void)
141 printk(KERN_INFO "%s: module unloaded.\n", DRIVERLNAME);
144 module_init(divacapi_init);
145 module_exit(divacapi_exit);