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/config.h>
14 #include <linux/module.h>
15 #include <linux/init.h>
16 #include <asm/uaccess.h>
17 #include <linux/smp_lock.h>
18 #include <linux/skbuff.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
)
46 if ((p
= strchr(revision
, ':'))) {
57 * alloc a message buffer
59 diva_os_message_buffer_s
*diva_os_alloc_message_buffer(unsigned long size
,
62 diva_os_message_buffer_s
*dmb
= alloc_skb(size
, GFP_ATOMIC
);
64 *data_buf
= skb_put(dmb
, size
);
70 * free a message buffer
72 void diva_os_free_message_buffer(diva_os_message_buffer_s
* dmb
)
78 * proc function for controller info
80 static int diva_ctl_read_proc(char *page
, char **start
, off_t off
,
81 int count
, int *eof
, struct capi_ctr
*ctrl
)
83 diva_card
*card
= (diva_card
*) ctrl
->driverdata
;
86 len
+= sprintf(page
+ len
, "%s\n", ctrl
->name
);
87 len
+= sprintf(page
+ len
, "Serial No. : %s\n", ctrl
->serial
);
88 len
+= sprintf(page
+ len
, "Id : %d\n", card
->Id
);
89 len
+= sprintf(page
+ len
, "Channels : %d\n", card
->d
.channels
);
91 if (off
+ count
>= len
)
96 return ((count
< len
- off
) ? count
: len
- off
);
100 * set additional os settings in capi_ctr struct
102 void diva_os_set_controller_struct(struct capi_ctr
*ctrl
)
104 ctrl
->driver_name
= DRIVERLNAME
;
105 ctrl
->load_firmware
= NULL
;
106 ctrl
->reset_ctr
= NULL
;
107 ctrl
->ctr_read_proc
= diva_ctl_read_proc
;
108 ctrl
->owner
= THIS_MODULE
;
114 static int DIVA_INIT_FUNCTION
divacapi_init(void)
119 sprintf(DRIVERRELEASE_CAPI
, "%d.%d%s", DRRELMAJOR
, DRRELMINOR
,
122 printk(KERN_INFO
"%s\n", DRIVERNAME
);
123 printk(KERN_INFO
"%s: Rel:%s Rev:", DRIVERLNAME
, DRIVERRELEASE_CAPI
);
124 strcpy(tmprev
, main_revision
);
125 printk("%s Build: %s(%s)\n", getrev(tmprev
),
126 diva_capi_common_code_build
, DIVA_BUILD
);
128 if (!(init_capifunc())) {
129 printk(KERN_ERR
"%s: failed init capi_driver.\n",
140 static void DIVA_EXIT_FUNCTION
divacapi_exit(void)
143 printk(KERN_INFO
"%s: module unloaded.\n", DRIVERLNAME
);
146 module_init(divacapi_init
);
147 module_exit(divacapi_exit
);