x86/amd-iommu: Add function to complete a tlb flush
[linux/fpc-iii.git] / drivers / isdn / hardware / eicon / capimain.c
blob98fcdfc7ca555ca7440923e268b4f3cf24af0862
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
5 *
6 * Copyright 2000-2003 by Armin Schindler (mac@melware.de)
7 * Copyright 2000-2003 Cytronics & Melware (info@melware.de)
8 *
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>
18 #include "os_capi.h"
20 #include "platform.h"
21 #include "di_defs.h"
22 #include "capi20.h"
23 #include "divacapi.h"
24 #include "cp_vers.h"
25 #include "capifunc.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)
42 char *rev;
43 char *p;
44 if ((p = strchr(revision, ':'))) {
45 rev = p + 2;
46 p = strchr(rev, '$');
47 *--p = 0;
48 } else
49 rev = "1.0";
50 return rev;
55 * alloc a message buffer
57 diva_os_message_buffer_s *diva_os_alloc_message_buffer(unsigned long size,
58 void **data_buf)
60 diva_os_message_buffer_s *dmb = alloc_skb(size, GFP_ATOMIC);
61 if (dmb) {
62 *data_buf = skb_put(dmb, size);
64 return (dmb);
68 * free a message buffer
70 void diva_os_free_message_buffer(diva_os_message_buffer_s * dmb)
72 kfree_skb(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;
82 int len = 0;
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)
90 *eof = 1;
91 if (len < off)
92 return 0;
93 *start = page + off;
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;
110 * module init
112 static int DIVA_INIT_FUNCTION divacapi_init(void)
114 char tmprev[32];
115 int ret = 0;
117 sprintf(DRIVERRELEASE_CAPI, "%d.%d%s", DRRELMAJOR, DRRELMINOR,
118 DRRELEXTRA);
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",
128 DRIVERLNAME);
129 ret = -EIO;
132 return ret;
136 * module exit
138 static void DIVA_EXIT_FUNCTION divacapi_exit(void)
140 finit_capifunc();
141 printk(KERN_INFO "%s: module unloaded.\n", DRIVERLNAME);
144 module_init(divacapi_init);
145 module_exit(divacapi_exit);