Commit a12b5a72 authored by Armin Schindler's avatar Armin Schindler Committed by Linus Torvalds

[PATCH] eicon ISDN driver: update

Use different var-names if they are non-static,
configure 4BRI like BRI cards, fixed new /proc entries,
inline declarations for common helper functions.
parent da200761
/* $Id: diddfunc.c,v 1.1.2.2 2002/10/02 14:38:37 armin Exp $
/* $Id: diddfunc.c,v 1.14 2003/08/25 10:06:37 schindler Exp $
*
* DIDD Interface module for Eicon active cards.
*
* Functions are in dadapter.c
*
* Copyright 2002 by Armin Schindler (mac@melware.de)
* Copyright 2002 Cytronics & Melware (info@melware.de)
* Copyright 2002-2003 by Armin Schindler (mac@melware.de)
* Copyright 2002-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
......@@ -23,7 +23,7 @@
extern void DIVA_DIDD_Read(void *, int);
extern char *DRIVERRELEASE;
extern char *DRIVERRELEASE_DIDD;
static dword notify_handle;
static DESCRIPTOR _DAdapter;
......@@ -40,7 +40,7 @@ static void *didd_callback(void *context, DESCRIPTOR * adapter,
if (removal) {
DbgDeregister();
} else {
DbgRegister("DIDD", DRIVERRELEASE, DBG_DEFAULT);
DbgRegister("DIDD", DRIVERRELEASE_DIDD, DBG_DEFAULT);
}
}
return (NULL);
......@@ -65,14 +65,14 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = didd_callback;
req.didd_notify.info.callback = (void *)didd_callback;
req.didd_notify.info.context = 0;
_DAdapter.request((ENTITY *) & req);
if (req.didd_notify.e.Rc != 0xff)
return (0);
notify_handle = req.didd_notify.info.handle;
} else if (DIDD_Table[x].type == IDI_DIMAINT) { /* MAINT found */
DbgRegister("DIDD", DRIVERRELEASE, DBG_DEFAULT);
DbgRegister("DIDD", DRIVERRELEASE_DIDD, DBG_DEFAULT);
}
}
return (dadapter);
......
/* $Id: diva.c,v 1.1.2.5 2001/02/14 21:10:19 armin Exp $ */
/* $Id: diva.c,v 1.17 2003/09/09 06:52:01 schindler Exp $ */
#define CARDTYPE_H_WANT_DATA 1
#define CARDTYPE_H_WANT_IDI_DATA 0
......@@ -7,7 +7,6 @@
#include "platform.h"
#include "debuglib.h"
#include "diva_pci.h"
#include "cardtype.h"
#include "dlist.h"
#include "pc.h"
......@@ -15,19 +14,17 @@
#include "di.h"
#include "io.h"
#include "pc_maint.h"
#include "xdi_msg.h"
#include "xdi_adapter.h"
#include "diva_pci.h"
#include "diva.h"
#ifdef CONFIG_ISDN_DIVAS_PRIPCI
#include "os_pri.h"
#endif
#ifdef CONFIG_ISDN_DIVAS_4BRIPCI
#include "os_4bri.h"
#endif
#ifdef CONFIG_ISDN_DIVAS_BRIPCI
#include "os_bri.h"
#include "os_4bri.h"
#endif
PISDN_ADAPTER IoAdapters[MAX_ADAPTER];
......@@ -77,6 +74,11 @@ DivaIdiReqFunc(31)
struct pt_regs;
/*
* include queue functions
*/
#include "dlist.c"
/*
** LOCALS
*/
......@@ -109,7 +111,7 @@ static diva_supported_cards_info_t divas_supported_cards[] = {
*/
{CARDTYPE_DIVASRV_VOICE_P_30M_V2_PCI, diva_pri_init_card},
#endif
#ifdef CONFIG_ISDN_DIVAS_4BRIPCI
#ifdef CONFIG_ISDN_DIVAS_BRIPCI
/*
4BRI Rev 1 Cards
*/
......@@ -126,8 +128,6 @@ static diva_supported_cards_info_t divas_supported_cards[] = {
{CARDTYPE_DIVASRV_B_2M_V2_PCI, diva_4bri_init_card},
{CARDTYPE_DIVASRV_B_2F_PCI, diva_4bri_init_card},
{CARDTYPE_DIVASRV_VOICE_B_2M_V2_PCI, diva_4bri_init_card},
#endif
#ifdef CONFIG_ISDN_DIVAS_BRIPCI
/*
BRI
*/
......@@ -193,6 +193,7 @@ void *diva_driver_add_card(void *pdev, unsigned long CardOrdinal)
pdiva->controller = i + 1;
pdiva->xdi_adapter.ANum = pdiva->controller;
IoAdapters[i] = &pdiva->xdi_adapter;
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "add card");
create_adapter_proc(pdiva); /* add adapter to proc file system */
DBG_LOG(("add %s:%d",
......@@ -200,6 +201,7 @@ void *diva_driver_add_card(void *pdev, unsigned long CardOrdinal)
[CardOrdinal].Name,
pdiva->controller))
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "add card");
pa = pdiva;
for (j = 1; j < nr; j++) { /* slave adapters, if any */
pa = (diva_os_xdi_adapter_t *) diva_q_get_next(&pa->link);
......@@ -207,8 +209,11 @@ void *diva_driver_add_card(void *pdev, unsigned long CardOrdinal)
pa->controller = i + 1 + j;
pa->xdi_adapter.ANum = pa->controller;
IoAdapters[i + j] = &pa->xdi_adapter;
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "add card");
DBG_LOG(("add slave adapter (%d)",
pa->controller)) create_adapter_proc(pa); /* add adapter to proc file system */
pa->controller))
create_adapter_proc(pa); /* add adapter to proc file system */
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "add card");
} else {
DBG_ERR(("slave adapter problem"))
break;
......@@ -463,7 +468,8 @@ diva_xdi_write(void *adapter, void *os_handle, const void *src,
}
} else {
DBG_ERR(("A: A(%d) write error (%d)", a->controller,
length))}
length))
}
diva_os_free(0, data);
......@@ -564,7 +570,6 @@ static void diva_init_request_array(void)
Requests[31] = DivaIdiRequest31;
}
/* card: 1-based card number */
void diva_xdi_display_adapter_features(int card)
{
dword features;
......
/* $Id: diva_didd.c,v 1.1.2.6 2001/05/01 15:48:05 armin Exp $
/* $Id: diva_didd.c,v 1.13 2003/08/27 10:11:21 schindler Exp $
*
* DIDD Interface module for Eicon active cards.
*
* Functions are in dadapter.c
*
* Copyright 2002 by Armin Schindler (mac@melware.de)
* Copyright 2002 Cytronics & Melware (info@melware.de)
* Copyright 2002-2003 by Armin Schindler (mac@melware.de)
* Copyright 2002-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
......@@ -23,14 +23,13 @@
#include "divasync.h"
#include "did_vers.h"
static char *main_revision = "$Revision: 1.1.2.6 $";
static char *main_revision = "$Revision: 1.13 $";
static char *DRIVERNAME =
"Eicon DIVA - DIDD table (http://www.melware.net)";
static char *DRIVERLNAME = "divadidd";
char *DRIVERRELEASE = "2.0";
char *DRIVERRELEASE_DIDD = "2.0";
static char *dir_in_proc_net = "isdn";
static char *main_proc_dir = "eicon";
MODULE_DESCRIPTION("DIDD table driver for diva drivers");
......@@ -48,12 +47,11 @@ extern void diddfunc_finit(void);
extern void DIVA_DIDD_Read(void *, int);
static struct proc_dir_entry *proc_net_isdn;
static struct proc_dir_entry *proc_didd;
struct proc_dir_entry *proc_net_isdn_eicon = NULL;
struct proc_dir_entry *proc_net_eicon = NULL;
EXPORT_SYMBOL_NOVERS(DIVA_DIDD_Read);
EXPORT_SYMBOL_NOVERS(proc_net_isdn_eicon);
EXPORT_SYMBOL_NOVERS(proc_net_eicon);
static char *getrev(const char *revision)
{
......@@ -78,7 +76,7 @@ proc_read(char *page, char **start, off_t off, int count, int *eof,
strcpy(tmprev, main_revision);
len += sprintf(page + len, "%s\n", DRIVERNAME);
len += sprintf(page + len, "name : %s\n", DRIVERLNAME);
len += sprintf(page + len, "release : %s\n", DRIVERRELEASE);
len += sprintf(page + len, "release : %s\n", DRIVERRELEASE_DIDD);
len += sprintf(page + len, "build : %s(%s)\n",
diva_didd_common_code_build, DIVA_BUILD);
len += sprintf(page + len, "revision : %s\n", getrev(tmprev));
......@@ -93,26 +91,12 @@ proc_read(char *page, char **start, off_t off, int count, int *eof,
static int DIVA_INIT_FUNCTION create_proc(void)
{
struct proc_dir_entry *pe;
proc_net_eicon = create_proc_entry(main_proc_dir, S_IFDIR, proc_net);
for (pe = proc_net->subdir; pe; pe = pe->next) {
if (!memcmp(dir_in_proc_net, pe->name, pe->namelen)) {
proc_net_isdn = pe;
break;
}
}
if (!proc_net_isdn) {
proc_net_isdn =
create_proc_entry(dir_in_proc_net, S_IFDIR, proc_net);
}
proc_net_isdn_eicon =
create_proc_entry(main_proc_dir, S_IFDIR, proc_net_isdn);
if (proc_net_isdn_eicon) {
if (
(proc_didd =
if (proc_net_eicon) {
if ((proc_didd =
create_proc_entry(DRIVERLNAME, S_IFREG | S_IRUGO,
proc_net_isdn_eicon))) {
proc_net_eicon))) {
proc_didd->read_proc = proc_read;
}
return (1);
......@@ -120,14 +104,10 @@ static int DIVA_INIT_FUNCTION create_proc(void)
return (0);
}
static void remove_proc(void)
static void DIVA_EXIT_FUNCTION remove_proc(void)
{
remove_proc_entry(DRIVERLNAME, proc_net_isdn_eicon);
remove_proc_entry(main_proc_dir, proc_net_isdn);
if ((proc_net_isdn) && (!proc_net_isdn->subdir)) {
remove_proc_entry(dir_in_proc_net, proc_net);
}
remove_proc_entry(DRIVERLNAME, proc_net_eicon);
remove_proc_entry(main_proc_dir, proc_net);
}
static int DIVA_INIT_FUNCTION divadidd_init(void)
......@@ -136,7 +116,7 @@ static int DIVA_INIT_FUNCTION divadidd_init(void)
int ret = 0;
printk(KERN_INFO "%s\n", DRIVERNAME);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_DIDD);
strcpy(tmprev, main_revision);
printk("%s Build:%s(%s)\n", getrev(tmprev),
diva_didd_common_code_build, DIVA_BUILD);
......@@ -151,7 +131,9 @@ static int DIVA_INIT_FUNCTION divadidd_init(void)
if (!diddfunc_init()) {
printk(KERN_ERR "%s: failed to connect to DIDD.\n",
DRIVERLNAME);
#ifdef MODULE
remove_proc();
#endif
ret = -EIO;
goto out;
}
......
/* $Id: diva_pci.h,v 1.1.2.2 2001/02/12 20:23:46 armin Exp $ */
/* $Id: diva_pci.h,v 1.6 2003/01/04 15:29:45 schindler Exp $ */
#ifndef __DIVA_PCI_INTERFACE_H__
#define __DIVA_PCI_INTERFACE_H__
void *divasa_remap_pci_bar(unsigned long bar, unsigned long area_length);
void *divasa_remap_pci_bar(diva_os_xdi_adapter_t *a,
int id,
unsigned long bar,
unsigned long area_length);
void divasa_unmap_pci_bar(void *bar);
unsigned long divasa_get_pci_irq(unsigned char bus,
unsigned char func, void *pci_dev_handle);
......
/* $Id: divamnt.c,v 1.1.2.4 2001/05/01 15:48:05 armin Exp $
/* $Id: divamnt.c,v 1.27 2003/09/09 06:46:29 schindler Exp $
*
* Driver for Eicon DIVA Server ISDN cards.
* Maint module
*
* Copyright 2000-2002 by Armin Schindler (mac@melware.de)
* Copyright 2000-2002 Cytronics & Melware (info@melware.de)
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
......@@ -19,7 +19,6 @@
#include <linux/poll.h>
#include <linux/proc_fs.h>
#include <linux/skbuff.h>
#include <linux/vmalloc.h>
#include <linux/devfs_fs_kernel.h>
#include "platform.h"
......@@ -28,16 +27,14 @@
#include "di_defs.h"
#include "debug_if.h"
static char *main_revision = "$Revision: 1.1.2.4 $";
static char *main_revision = "$Revision: 1.27 $";
static int major = 241;
static int major;
MODULE_DESCRIPTION("Maint driver for Eicon DIVA Server cards");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_SUPPORTED_DEVICE("DIVA card driver");
MODULE_LICENSE("GPL");
MODULE_PARM(major, "i");
MODULE_PARM_DESC(major, "Major number for /dev/DivasMAINT");
int buffer_length = 128;
MODULE_PARM(buffer_length, "i");
......@@ -47,7 +44,8 @@ MODULE_PARM(diva_dbg_mem, "l");
static char *DRIVERNAME =
"Eicon DIVA - MAINT module (http://www.melware.net)";
static char *DRIVERLNAME = "diva_mnt";
char *DRIVERRELEASE = "2.0";
static char *DEVNAME = "DivasMAINT";
char *DRIVERRELEASE_MNT = "2.0";
static wait_queue_head_t msgwaitq;
static DECLARE_MUTEX(opened_sem);
......@@ -77,18 +75,8 @@ static char *getrev(const char *revision)
}
/*
* memory alloc
* buffer alloc
*/
void *diva_os_malloc(unsigned long flags, unsigned long size)
{
return (vmalloc(size));
}
void diva_os_free(unsigned long flags, void *ptr)
{
if (ptr) {
vfree(ptr);
}
}
void *diva_os_malloc_tbuffer(unsigned long flags, unsigned long size)
{
return (kmalloc(size, GFP_KERNEL));
......@@ -100,17 +88,6 @@ void diva_os_free_tbuffer(unsigned long flags, void *ptr)
}
}
/*
* sleep msec
*/
void diva_os_sleep(dword mSec)
{
unsigned long timeout = HZ * mSec / 1000 + 1;
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(timeout);
}
/*
* kernel/user space copy functions
*/
......@@ -158,7 +135,7 @@ void diva_os_get_time(dword * sec, dword * usec)
* /proc entries
*/
extern struct proc_dir_entry *proc_net_isdn_eicon;
extern struct proc_dir_entry *proc_net_eicon;
static struct proc_dir_entry *maint_proc_entry = NULL;
/*
......@@ -363,7 +340,7 @@ static int DIVA_INIT_FUNCTION create_maint_proc(void)
{
maint_proc_entry =
create_proc_entry("maint", S_IFREG | S_IRUGO | S_IWUSR,
proc_net_isdn_eicon);
proc_net_eicon);
if (!maint_proc_entry)
return (0);
......@@ -376,7 +353,7 @@ static int DIVA_INIT_FUNCTION create_maint_proc(void)
static void remove_maint_proc(void)
{
if (maint_proc_entry) {
remove_proc_entry("maint", proc_net_isdn_eicon);
remove_proc_entry("maint", proc_net_eicon);
maint_proc_entry = NULL;
}
}
......@@ -408,20 +385,20 @@ static struct file_operations divas_maint_fops = {
static void divas_maint_unregister_chrdev(void)
{
devfs_remove("DivasMAINT");
unregister_chrdev(major, "DivasMAINT");
devfs_remove(DEVNAME);
unregister_chrdev(major, DEVNAME);
}
static int DIVA_INIT_FUNCTION divas_maint_register_chrdev(void)
{
if (register_chrdev(major, "DivasMAINT", &divas_maint_fops))
if ((major = register_chrdev(0, DEVNAME, &divas_maint_fops)) < 0)
{
printk(KERN_ERR "%s: failed to create /dev entry.\n",
DRIVERLNAME);
return (0);
}
devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, DEVNAME);
devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, "DivasMAINT");
return (1);
}
......@@ -446,10 +423,9 @@ static int DIVA_INIT_FUNCTION maint_init(void)
init_waitqueue_head(&msgwaitq);
printk(KERN_INFO "%s\n", DRIVERNAME);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_MNT);
strcpy(tmprev, main_revision);
printk("%s Build: %s Major: %d\n", getrev(tmprev), DIVA_BUILD,
major);
printk("%s Build: %s \n", getrev(tmprev), DIVA_BUILD);
if (!divas_maint_register_chrdev()) {
ret = -EIO;
......@@ -472,9 +448,9 @@ static int DIVA_INIT_FUNCTION maint_init(void)
goto out;
}
printk(KERN_INFO "%s: trace buffer = %p - %d kBytes, %s \n",
DRIVERLNAME, buffer, buffer_length,
(diva_dbg_mem == 0) ? "internal" : "external");
printk(KERN_INFO "%s: trace buffer = %p - %d kBytes, %s (Major: %d)\n",
DRIVERLNAME, buffer, (buffer_length / 1024),
(diva_dbg_mem == 0) ? "internal" : "external", major);
out:
return (ret);
......
/* $Id: divasfunc.c,v 1.1.2.2 2002/10/02 14:38:37 armin Exp $
/* $Id: divasfunc.c,v 1.22 2003/09/09 06:46:29 schindler Exp $
*
* Low level driver for Eicon DIVA Server ISDN cards.
*
* Copyright 2000-2002 by Armin Schindler (mac@melware.de)
* Copyright 2000-2002 Cytronics & Melware (info@melware.de)
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
......@@ -21,6 +21,8 @@
#define DBG_MINIMUM (DL_LOG + DL_FTL + DL_ERR)
#define DBG_DEFAULT (DBG_MINIMUM + DL_XLOG + DL_REG)
static int debugmask;
extern void DIVA_DIDD_Read(void *, int);
extern PISDN_ADAPTER IoAdapters[MAX_ADAPTER];
......@@ -28,7 +30,7 @@ extern PISDN_ADAPTER IoAdapters[MAX_ADAPTER];
#define MAX_DESCRIPTORS 32
extern void diva_run_trap_script(PISDN_ADAPTER IoAdapter, dword ANum);
extern char *DRIVERRELEASE;
extern char *DRIVERRELEASE_DIVAS;
static dword notify_handle;
static DESCRIPTOR DAdapter;
......@@ -42,8 +44,6 @@ static void no_printf(unsigned char *x, ...)
/* dummy debug function */
}
DIVA_DI_PRINTF dprintf = no_printf;
#include "debuglib.c"
/*
......@@ -117,10 +117,11 @@ void diva_xdi_didd_remove_adapter(int card)
*/
static void start_dbg(void)
{
DbgRegister("DIVAS", DRIVERRELEASE, DBG_DEFAULT);
DbgRegister("DIVAS", DRIVERRELEASE_DIVAS, (debugmask) ? debugmask : DBG_DEFAULT);
DBG_LOG(("DIVA ISDNXDI BUILD (%s[%s]-%s-%s)",
DIVA_BUILD, diva_xdi_common_code_build, __DATE__,
__TIME__))}
__TIME__))
}
/*
* stop debug
......@@ -174,7 +175,7 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = didd_callback;
req.didd_notify.info.callback = (void *)didd_callback;
req.didd_notify.info.context = 0;
DAdapter.request((ENTITY *) & req);
if (req.didd_notify.e.Rc != 0xff) {
......@@ -214,13 +215,19 @@ static void DIVA_EXIT_FUNCTION disconnect_didd(void)
/*
* init
*/
int DIVA_INIT_FUNCTION divasfunc_init(void)
int DIVA_INIT_FUNCTION divasfunc_init(int dbgmask)
{
char *version;
debugmask = dbgmask;
if (!connect_didd()) {
DBG_ERR(("divasfunc: failed to connect to DIDD."))
return (0);
}
version = diva_xdi_common_code_build;
divasa_xdi_driver_entry();
return (1);
......
/* $Id: divasi.c,v 1.1.2.7 2001/05/01 15:48:05 armin Exp $
/* $Id: divasi.c,v 1.25 2003/09/09 06:46:29 schindler Exp $
*
* Driver for Eicon DIVA Server ISDN cards.
* User Mode IDI Interface
*
* Copyright 2000-2002 by Armin Schindler (mac@melware.de)
* Copyright 2000-2002 Cytronics & Melware (info@melware.de)
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
......@@ -19,7 +19,6 @@
#include <linux/poll.h>
#include <linux/proc_fs.h>
#include <linux/skbuff.h>
#include <linux/vmalloc.h>
#include <linux/devfs_fs_kernel.h>
#include "platform.h"
......@@ -28,27 +27,27 @@
#include "um_xdi.h"
#include "um_idi.h"
static char *main_revision = "$Revision: 1.1.2.7 $";
static char *main_revision = "$Revision: 1.25 $";
static int major = 242;
static int major;
MODULE_DESCRIPTION("User IDI Interface for Eicon ISDN cards");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_SUPPORTED_DEVICE("DIVA card driver");
MODULE_LICENSE("GPL");
MODULE_PARM(major, "i");
MODULE_PARM_DESC(major, "Major number for /dev/DivasIDI");
typedef struct _diva_um_idi_os_context {
wait_queue_head_t read_wait;
wait_queue_head_t close_wait;
struct timer_list diva_timer_id;
int aborted;
int adapter_nr;
} diva_um_idi_os_context_t;
static char *DRIVERNAME = "Eicon DIVA - User IDI (http://www.melware.net)";
static char *DRIVERLNAME = "diva_idi";
char *DRIVERRELEASE = "2.0";
static char *DEVNAME = "DivasIDI";
char *DRIVERRELEASE_IDI = "2.0";
extern int idifunc_init(void);
extern void idifunc_finit(void);
......@@ -82,33 +81,10 @@ static int um_idi_release(struct inode *inode, struct file *file);
static int remove_entity(void *entity);
static void diva_um_timer_function(unsigned long data);
/*
* malloc
*/
void *diva_os_malloc(unsigned long flags, unsigned long size)
{
void *ret = NULL;
if (size) {
ret = (void *) vmalloc((unsigned int) size);
}
return (ret);
}
/*
* free
*/
void diva_os_free(unsigned long unused, void *ptr)
{
if (ptr) {
vfree(ptr);
}
}
/*
* proc entry
*/
extern struct proc_dir_entry *proc_net_isdn_eicon;
extern struct proc_dir_entry *proc_net_eicon;
static struct proc_dir_entry *um_idi_proc_entry = NULL;
static int
......@@ -120,10 +96,11 @@ um_idi_proc_read(char *page, char **start, off_t off, int count, int *eof,
len += sprintf(page + len, "%s\n", DRIVERNAME);
len += sprintf(page + len, "name : %s\n", DRIVERLNAME);
len += sprintf(page + len, "release : %s\n", DRIVERRELEASE);
len += sprintf(page + len, "release : %s\n", DRIVERRELEASE_IDI);
strcpy(tmprev, main_revision);
len += sprintf(page + len, "revision : %s\n", getrev(tmprev));
len += sprintf(page + len, "build : %s\n", DIVA_BUILD);
len += sprintf(page + len, "major : %d\n", major);
if (off + count >= len)
*eof = 1;
......@@ -137,7 +114,7 @@ static int DIVA_INIT_FUNCTION create_um_idi_proc(void)
{
um_idi_proc_entry = create_proc_entry(DRIVERLNAME,
S_IFREG | S_IRUGO | S_IWUSR,
proc_net_isdn_eicon);
proc_net_eicon);
if (!um_idi_proc_entry)
return (0);
......@@ -150,7 +127,7 @@ static int DIVA_INIT_FUNCTION create_um_idi_proc(void)
static void remove_um_idi_proc(void)
{
if (um_idi_proc_entry) {
remove_proc_entry(DRIVERLNAME, proc_net_isdn_eicon);
remove_proc_entry(DRIVERLNAME, proc_net_eicon);
um_idi_proc_entry = NULL;
}
}
......@@ -167,20 +144,20 @@ static struct file_operations divas_idi_fops = {
static void divas_idi_unregister_chrdev(void)
{
devfs_remove("DivasIDI");
unregister_chrdev(major, "DivasIDI");
devfs_remove(DEVNAME);
unregister_chrdev(major, DEVNAME);
}
static int DIVA_INIT_FUNCTION divas_idi_register_chrdev(void)
{
if (register_chrdev(major, "DivasIDI", &divas_idi_fops))
if ((major = register_chrdev(0, DEVNAME, &divas_idi_fops)) < 0)
{
printk(KERN_ERR "%s: failed to create /dev entry.\n",
DRIVERLNAME);
return (0);
}
devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, DEVNAME);
devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, "DivasIDI");
return (1);
}
......@@ -193,10 +170,9 @@ static int DIVA_INIT_FUNCTION divasi_init(void)
int ret = 0;
printk(KERN_INFO "%s\n", DRIVERNAME);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_IDI);
strcpy(tmprev, main_revision);
printk("%s Build: %s Major: %d\n", getrev(tmprev), DIVA_BUILD,
major);
printk("%s Build: %s\n", getrev(tmprev), DIVA_BUILD);
if (!divas_idi_register_chrdev()) {
ret = -EIO;
......@@ -219,6 +195,7 @@ static int DIVA_INIT_FUNCTION divasi_init(void)
ret = -EIO;
goto out;
}
printk(KERN_INFO "%s: started with major %d\n", DRIVERLNAME, major);
out:
return (ret);
......@@ -330,6 +307,7 @@ static int um_idi_open_adapter(struct file *file, int adapter_nr)
p_os->diva_timer_id.function = (void *) diva_um_timer_function;
p_os->diva_timer_id.data = (unsigned long) p_os;
p_os->aborted = 0;
p_os->adapter_nr = adapter_nr;
return (1);
}
......@@ -432,7 +410,8 @@ static int um_idi_open(struct inode *inode, struct file *file)
static int um_idi_release(struct inode *inode, struct file *file)
{
unsigned int adapter_nr = iminor(inode);
diva_um_idi_os_context_t *p_os;
unsigned int adapter_nr;
int ret = 0;
if (!(file->private_data)) {
......@@ -440,6 +419,14 @@ static int um_idi_release(struct inode *inode, struct file *file)
goto out;
}
if (!(p_os =
(diva_um_idi_os_context_t *) diva_um_id_get_os_context(file->private_data))) {
ret = -ENODEV;
goto out;
}
adapter_nr = p_os->adapter_nr;
if ((ret = remove_entity(file->private_data))) {
goto out;
}
......
/* $Id: divasmain.c,v 1.1.2.8 2001/05/01 15:48:05 armin Exp $
/* $Id: divasmain.c,v 1.39 2003/09/09 07:42:05 schindler Exp $
*
* Low level driver for Eicon DIVA Server ISDN cards.
*
* Copyright 2000-2002 by Armin Schindler (mac@melware.de)
* Copyright 2000-2002 Cytronics & Melware (info@melware.de)
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
......@@ -16,14 +16,12 @@
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/unistd.h>
#include <linux/vmalloc.h>
#include <linux/devfs_fs_kernel.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <linux/ioport.h>
#include <linux/workqueue.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/smp_lock.h>
#include <linux/interrupt.h>
#include <linux/poll.h>
......@@ -37,38 +35,44 @@
#include "di_defs.h"
#include "divasync.h"
#include "diva.h"
#include "diva_pci.h"
#include "di.h"
#include "io.h"
#include "xdi_msg.h"
#include "xdi_adapter.h"
#include "xdi_vers.h"
#include "diva_dma.h"
#include "diva_pci.h"
static char *main_revision = "$Revision: 1.1.2.8 $";
static char *main_revision = "$Revision: 1.39 $";
int errno = 0;
static int major = 240;
static int major;
static int dbgmask;
MODULE_DESCRIPTION("Kernel driver for Eicon DIVA Server cards");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_LICENSE("GPL");
MODULE_PARM(major, "i");
MODULE_PARM_DESC(major, "Major number for /dev/Divas");
MODULE_PARM(dbgmask, "i");
MODULE_PARM_DESC(dbgmask, "initial debug mask");
static char *DRIVERNAME =
"Eicon DIVA Server driver (http://www.melware.net)";
static char *DRIVERLNAME = "divas";
char *DRIVERRELEASE = "2.0";
static char *DEVNAME = "Divas";
char *DRIVERRELEASE_DIVAS = "2.0";
extern irqreturn_t diva_os_irq_wrapper(int irq, void *context,
struct pt_regs *regs);
extern int create_divas_proc(void);
extern void remove_divas_proc(void);
extern void diva_get_vserial_number(PISDN_ADAPTER IoAdapter, char *buf);
extern int divasfunc_init(void);
extern int divasfunc_init(int dbgmask);
extern void divasfunc_exit(void);
static devfs_handle_t devfs_handle;
typedef struct _diva_os_thread_dpc {
struct tasklet_struct divas_task;
struct work_struct trap_script_task;
......@@ -119,7 +123,7 @@ typedef struct _diva_os_thread_dpc {
/*
This table should be sorted by PCI device ID
*/
static struct pci_device_id divas_pci_tbl[] = {
static struct pci_device_id divas_pci_tbl[] __devinitdata = {
/* Diva Server BRI-2M PCI 0xE010 */
{PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_MAESTRA,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, CARDTYPE_MAESTRA_PCI},
......@@ -185,19 +189,6 @@ static char *getrev(const char *revision)
return rev;
}
void diva_os_sleep(dword mSec)
{
unsigned long timeout = HZ * mSec / 1000 + 1;
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(timeout);
}
void diva_os_wait(dword mSec)
{
mdelay(mSec);
}
void diva_log_info(unsigned char *format, ...)
{
va_list args;
......@@ -215,29 +206,8 @@ void divas_get_version(char *p)
char tmprev[32];
strcpy(tmprev, main_revision);
sprintf(p, "%s: %s(%s) %s(%s)\n", DRIVERLNAME, DRIVERRELEASE,
getrev(tmprev), diva_xdi_common_code_build, DIVA_BUILD);
}
/*********************************************************
** malloc / free
*********************************************************/
void *diva_os_malloc(unsigned long flags, unsigned long size)
{
void *ret = NULL;
if (size) {
ret = (void *) vmalloc((unsigned int) size);
}
return (ret);
}
void diva_os_free(unsigned long unused, void *ptr)
{
if (ptr) {
vfree(ptr);
}
sprintf(p, "%s: %s(%s) %s(%s) major=%d\n", DRIVERLNAME, DRIVERRELEASE_DIVAS,
getrev(tmprev), diva_xdi_common_code_build, DIVA_BUILD, major);
}
/* --------------------------------------------------------------------------
......@@ -282,6 +252,7 @@ void diva_run_trap_script(PISDN_ADAPTER IoAdapter, dword ANum)
(diva_os_thread_dpc_t *) psoft_isr->object;
if (context && !context->card_failed) {
printk(KERN_ERR "%s: adapter %d trapped !\n", DRIVERLNAME, ANum + 1);
context->card_failed = ANum + 1;
schedule_work(&context->trap_script_task);
}
......@@ -505,8 +476,8 @@ void diva_free_dma_map(void *hdev, struct _diva_dma_map_entry *pmap)
*********************************************************/
int
diva_os_register_io_port(int on, unsigned long port, unsigned long length,
const char *name)
diva_os_register_io_port(void *adapter, int on, unsigned long port,
unsigned long length, const char *name, int id)
{
if (on) {
if (!request_region(port, length, name)) {
......@@ -519,7 +490,7 @@ diva_os_register_io_port(int on, unsigned long port, unsigned long length,
return (0);
}
void *divasa_remap_pci_bar(unsigned long bar, unsigned long area_length)
void *divasa_remap_pci_bar(diva_os_xdi_adapter_t *a, int id, unsigned long bar, unsigned long area_length)
{
void *ret;
......@@ -772,20 +743,20 @@ static struct file_operations divas_fops = {
static void divas_unregister_chrdev(void)
{
devfs_remove("Divas");
unregister_chrdev(major, "Divas");
devfs_remove(DEVNAME);
unregister_chrdev(major, DEVNAME);
}
static int DIVA_INIT_FUNCTION divas_register_chrdev(void)
{
if (register_chrdev(major, "Divas", &divas_fops))
if ((major = register_chrdev(0, DEVNAME, &divas_fops)) < 0)
{
printk(KERN_ERR "%s: failed to create /dev entry.\n",
DRIVERLNAME);
return (0);
}
devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, DEVNAME);
devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, "Divas");
return (1);
}
......@@ -877,23 +848,20 @@ static int DIVA_INIT_FUNCTION divas_init(void)
int ret = 0;
printk(KERN_INFO "%s\n", DRIVERNAME);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_DIVAS);
strcpy(tmprev, main_revision);
printk("%s Build: %s(%s) Major: %d\n", getrev(tmprev),
diva_xdi_common_code_build, DIVA_BUILD, major);
printk("%s Build: %s(%s)\n", getrev(tmprev),
diva_xdi_common_code_build, DIVA_BUILD);
printk(KERN_INFO "%s: support for: ", DRIVERLNAME);
#ifdef CONFIG_ISDN_DIVAS_BRIPCI
printk("BRI/PCI ");
#endif
#ifdef CONFIG_ISDN_DIVAS_4BRIPCI
printk("4BRI/PCI ");
#endif
#ifdef CONFIG_ISDN_DIVAS_PRIPCI
printk("PRI/PCI ");
#endif
printk("\n");
printk("adapters\n");
if (!divasfunc_init()) {
if (!divasfunc_init(dbgmask)) {
printk(KERN_ERR "%s: failed to connect to DIDD.\n",
DRIVERLNAME);
ret = -EIO;
......@@ -901,15 +869,19 @@ static int DIVA_INIT_FUNCTION divas_init(void)
}
if (!divas_register_chrdev()) {
#ifdef MODULE
divasfunc_exit();
#endif
ret = -EIO;
goto out;
}
if (!create_divas_proc()) {
#ifdef MODULE
remove_divas_proc();
divas_unregister_chrdev();
divasfunc_exit();
#endif
printk(KERN_ERR "%s: failed to create proc entry.\n",
DRIVERLNAME);
ret = -EIO;
......@@ -917,13 +889,16 @@ static int DIVA_INIT_FUNCTION divas_init(void)
}
if ((ret = pci_module_init(&diva_pci_driver))) {
#ifdef MODULE
remove_divas_proc();
divas_unregister_chrdev();
divasfunc_exit();
#endif
printk(KERN_ERR "%s: failed to init pci driver.\n",
DRIVERLNAME);
goto out;
}
printk(KERN_INFO "%s: started with major %d\n", DRIVERLNAME, major);
out:
return (ret);
......
/* $Id: divasproc.c,v 1.1.2.4 2001/02/16 08:40:36 armin Exp $
/* $Id: divasproc.c,v 1.18 2003/09/09 06:46:29 schindler Exp $
*
* Low level driver for Eicon DIVA Server ISDN cards.
* /proc functions
*
* Copyright 2000-2002 by Armin Schindler (mac@melware.de)
* Copyright 2000-2002 Cytronics & Melware (info@melware.de)
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
......@@ -15,7 +15,6 @@
#include <linux/kernel.h>
#include <linux/poll.h>
#include <linux/proc_fs.h>
#include <linux/interrupt.h>
#include "platform.h"
#include "debuglib.h"
......@@ -23,7 +22,6 @@
#undef ID_MASK
#undef N_DATA
#include "pc.h"
#include "diva_pci.h"
#include "di_defs.h"
#include "divasync.h"
#include "di.h"
......@@ -31,6 +29,7 @@
#include "xdi_msg.h"
#include "xdi_adapter.h"
#include "diva.h"
#include "diva_pci.h"
extern PISDN_ADAPTER IoAdapters[MAX_ADAPTER];
......@@ -52,7 +51,7 @@ static char *d_l1_down_proc_name = "dynamic_l1_down";
** "divas" entry
*/
extern struct proc_dir_entry *proc_net_isdn_eicon;
extern struct proc_dir_entry *proc_net_eicon;
static struct proc_dir_entry *divas_proc_entry = NULL;
static ssize_t
......@@ -131,7 +130,7 @@ int create_divas_proc(void)
{
divas_proc_entry = create_proc_entry(divas_proc_name,
S_IFREG | S_IRUGO,
proc_net_isdn_eicon);
proc_net_eicon);
if (!divas_proc_entry)
return (0);
......@@ -144,7 +143,7 @@ int create_divas_proc(void)
void remove_divas_proc(void)
{
if (divas_proc_entry) {
remove_proc_entry(divas_proc_name, proc_net_isdn_eicon);
remove_proc_entry(divas_proc_name, proc_net_eicon);
divas_proc_entry = NULL;
}
}
......@@ -333,7 +332,8 @@ info_read(char *page, char **start, off_t off, int count, int *eof,
}
}
if ((!a->xdi_adapter.port) &&
((!a->xdi_adapter.ram) || (!a->xdi_adapter.reset)
((!a->xdi_adapter.ram) ||
(!a->xdi_adapter.reset)
|| (!a->xdi_adapter.cfg))) {
if (!IoAdapter->irq_info.irq_nr) {
p = "slave";
......@@ -369,20 +369,14 @@ int create_adapter_proc(diva_os_xdi_adapter_t * a)
struct proc_dir_entry *de, *pe;
char tmp[16];
if (in_interrupt()) {
printk(KERN_ERR
"divasproc: create_proc in_interrupt, not creating\n");
return (1);
}
sprintf(tmp, "%s%d", adapter_dir_name, a->controller);
if (!(de = create_proc_entry(tmp, S_IFDIR, proc_net_isdn_eicon)))
if (!(de = create_proc_entry(tmp, S_IFDIR, proc_net_eicon)))
return (0);
a->proc_adapter_dir = (void *) de;
if (!(pe =
create_proc_entry(info_proc_name, S_IFREG | S_IRUGO | S_IWUSR,
de))) return (0);
create_proc_entry(info_proc_name, S_IFREG | S_IRUGO | S_IWUSR, de)))
return (0);
a->proc_info = (void *) pe;
pe->write_proc = info_write;
pe->read_proc = info_read;
......@@ -429,7 +423,7 @@ void remove_adapter_proc(diva_os_xdi_adapter_t * a)
(struct proc_dir_entry *) a->proc_adapter_dir);
}
sprintf(tmp, "%s%d", adapter_dir_name, a->controller);
remove_proc_entry(tmp, proc_net_isdn_eicon);
remove_proc_entry(tmp, proc_net_eicon);
DBG_TRC(("proc entry %s%d removed", adapter_dir_name,
a->controller));
}
......
/* $Id: idifunc.c,v 1.1.2.2 2002/10/02 14:38:37 armin Exp $
/* $Id: idifunc.c,v 1.13 2003/08/25 14:49:53 schindler Exp $
*
* Driver for Eicon DIVA Server ISDN cards.
* User Mode IDI Interface
*
* Copyright 2000-2002 by Armin Schindler (mac@melware.de)
* Copyright 2000-2002 Cytronics & Melware (info@melware.de)
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
......@@ -19,7 +19,7 @@
#define DBG_MINIMUM (DL_LOG + DL_FTL + DL_ERR)
#define DBG_DEFAULT (DBG_MINIMUM + DL_XLOG + DL_REG)
extern char *DRIVERRELEASE;
extern char *DRIVERRELEASE_IDI;
extern void DIVA_DIDD_Read(void *, int);
extern int diva_user_mode_idi_create_adapter(const DESCRIPTOR *, int);
......@@ -36,8 +36,6 @@ static void no_printf(unsigned char *x, ...)
/* dummy debug function */
}
DIVA_DI_PRINTF dprintf = no_printf;
#include "debuglib.c"
/*
......@@ -202,7 +200,7 @@ static void *didd_callback(void *context, DESCRIPTOR * adapter,
} else {
memcpy(&MAdapter, adapter, sizeof(MAdapter));
dprintf = (DIVA_DI_PRINTF) MAdapter.request;
DbgRegister("User IDI", DRIVERRELEASE, DBG_DEFAULT);
DbgRegister("User IDI", DRIVERRELEASE_IDI, DBG_DEFAULT);
}
} else if ((adapter->type > 0) && (adapter->type < 16)) { /* IDI Adapter */
if (removal) {
......@@ -233,7 +231,7 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = didd_callback;
req.didd_notify.info.callback = (void *)didd_callback;
req.didd_notify.info.context = 0;
DAdapter.request((ENTITY *) & req);
if (req.didd_notify.e.Rc != 0xff) {
......@@ -244,7 +242,7 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
} else if (DIDD_Table[x].type == IDI_DIMAINT) { /* MAINT found */
memcpy(&MAdapter, &DIDD_Table[x], sizeof(DAdapter));
dprintf = (DIVA_DI_PRINTF) MAdapter.request;
DbgRegister("User IDI", DRIVERRELEASE, DBG_DEFAULT);
DbgRegister("User IDI", DRIVERRELEASE_IDI, DBG_DEFAULT);
} else if ((DIDD_Table[x].type > 0)
&& (DIDD_Table[x].type < 16)) { /* IDI Adapter found */
um_new_card(&DIDD_Table[x]);
......
/* $Id: mntfunc.c,v 1.1.2.2 2002/10/02 14:38:37 armin Exp $
/* $Id: mntfunc.c,v 1.15 2003/08/25 14:49:53 schindler Exp $
*
* Driver for Eicon DIVA Server ISDN cards.
* Maint module
*
* Copyright 2000,2001 by Armin Schindler (mac@melware.de)
* Copyright 2000,2001 Cytronics & Melware (info@melware.de)
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
......@@ -17,7 +17,7 @@
#include "di_defs.h"
#include "debug_if.h"
extern char *DRIVERRELEASE;
extern char *DRIVERRELEASE_MNT;
#define DBG_MINIMUM (DL_LOG + DL_FTL + DL_ERR)
#define DBG_DEFAULT (DBG_MINIMUM + DL_XLOG + DL_REG)
......@@ -45,8 +45,6 @@ static void no_printf(unsigned char *x, ...)
/* dummy debug function */
}
DIVA_DI_PRINTF dprintf = no_printf;
#include "debuglib.c"
/*
......@@ -73,7 +71,7 @@ static void *didd_callback(void *context, DESCRIPTOR * adapter,
} else {
memcpy(&MAdapter, adapter, sizeof(MAdapter));
dprintf = (DIVA_DI_PRINTF) MAdapter.request;
DbgRegister("MAINT", DRIVERRELEASE, DBG_DEFAULT);
DbgRegister("MAINT", DRIVERRELEASE_MNT, DBG_DEFAULT);
}
} else if ((adapter->type > 0) && (adapter->type < 16)) {
if (removal) {
......@@ -104,7 +102,7 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = didd_callback;
req.didd_notify.info.callback = (void *)didd_callback;
req.didd_notify.info.context = 0;
DAdapter.request((ENTITY *) & req);
if (req.didd_notify.e.Rc != 0xff)
......
/* $Id: platform.h,v 1.1.2.6 2001/05/01 15:48:05 armin Exp $
/* $Id: platform.h,v 1.31 2003/09/08 15:15:22 schindler Exp $
*
* platform.h
*
*
* Copyright 2000-2002 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000 Eicon Networks
*
* This software may be used and distributed according to the terms
......@@ -23,20 +23,27 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/skbuff.h>
#include <linux/vmalloc.h>
#include <linux/proc_fs.h>
#include <linux/interrupt.h>
#include <linux/smp_lock.h>
#include <linux/delay.h>
#include <asm/types.h>
#include <asm/io.h>
#include "cardtype.h"
/* activate debuglib for modules only */
#ifndef MODULE
#define DIVA_NO_DEBUGLIB
#endif
#define DIVA_INIT_FUNCTION __init
#define DIVA_EXIT_FUNCTION __exit
#define DIVA_USER_MODE_CARD_CONFIG 1
#define XDI_USE_XLOG 1
#define USE_EXTENDED_DEBUGS 1
#define MAX_ADAPTER 32
......@@ -46,11 +53,6 @@
#define MEMORY_SPACE_TYPE 0
#define PORT_SPACE_TYPE 1
#include "debuglib.h"
#define dtrc(p) DBG_PRV0(p)
#define dbug(a,p) DBG_PRV1(p)
#include <linux/string.h>
......@@ -154,7 +156,11 @@ typedef struct _ISDN_ADAPTER ISDN_ADAPTER;
typedef struct _ISDN_ADAPTER* PISDN_ADAPTER;
typedef void (* DIVA_DI_PRINTF) (unsigned char *, ...);
extern DIVA_DI_PRINTF dprintf;
#include "debuglib.h"
#define dtrc(p) DBG_PRV0(p)
#define dbug(a,p) DBG_PRV1(p)
typedef struct e_info_s E_INFO ;
......@@ -176,8 +182,21 @@ void diva_xdi_didd_remove_adapter (int card);
/*
** memory allocation
*/
void* diva_os_malloc (unsigned long flags, unsigned long size);
void diva_os_free (unsigned long flags, void* ptr);
static __inline__ void* diva_os_malloc (unsigned long flags, unsigned long size)
{
void *ret = NULL;
if (size) {
ret = (void *) vmalloc((unsigned int) size);
}
return (ret);
}
static __inline__ void diva_os_free (unsigned long flags, void* ptr)
{
if (ptr) {
vfree(ptr);
}
}
/*
** use skbuffs for message buffer
......@@ -191,8 +210,17 @@ void diva_os_free_message_buffer(diva_os_message_buffer_s *dmb);
/*
** mSeconds waiting
*/
void diva_os_sleep(dword mSec);
void diva_os_wait(dword mSec);
static __inline__ void diva_os_sleep(dword mSec)
{
unsigned long timeout = HZ * mSec / 1000 + 1;
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(timeout);
}
static __inline__ void diva_os_wait(dword mSec)
{
mdelay(mSec);
}
/*
** PCI Configuration space access
......@@ -203,8 +231,8 @@ void PCIread (byte bus, byte func, int offset, void* data, int length, void* pci
/*
** I/O Port utilities
*/
int diva_os_register_io_port (int register, unsigned long port, unsigned long length, const char* name);
int diva_os_register_io_port (void *adapter, int register, unsigned long port,
unsigned long length, const char* name, int id);
/*
** I/O port access abstraction
*/
......@@ -228,14 +256,6 @@ void diva_os_remove_irq (void* context, byte irq);
#define diva_os_in_irq() in_irq()
/*
** module locking
*/
/*
#define DIVA_LOCK_MODULE MOD_INC_USE_COUNT
#define DIVA_UNLOCK_MODULE MOD_DEC_USE_COUNT
*/
/*
** Spin Lock framework
*/
......
/* $Id: xdi_adapter.h,v 1.1.2.3 2001/02/16 08:40:36 armin Exp $ */
/* $Id: xdi_adapter.h,v 1.5 2003/06/21 17:06:08 schindler Exp $ */
#ifndef __DIVA_OS_XDI_ADAPTER_H__
#define __DIVA_OS_XDI_ADAPTER_H__
......@@ -14,7 +14,8 @@ typedef struct _divas_pci_card_resources {
dword bar[8]; /* contains context of appropriate BAR Register */
void *addr[8]; /* same bar, but mapped into memory */
dword length[8]; /* bar length */
int mem_type_id[10];
unsigned int qoffset;
byte irq;
} divas_pci_card_resources_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment