Commit 711f6f98 authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linux-isdn.bkbits.net/linux-2.5.isdn

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 3a8d92d1 b5919c97
...@@ -15,7 +15,9 @@ obj-$(CONFIG_ISDN_CAPI_CAPIFS) += capifs.o ...@@ -15,7 +15,9 @@ obj-$(CONFIG_ISDN_CAPI_CAPIFS) += capifs.o
# Multipart objects. # Multipart objects.
kernelcapi-objs := kcapi.o capiutil.o capilib.o kernelcapi-y := kcapi.o capiutil.o capilib.o
kernelcapi-$(CONFIG_PROC_FS) += kcapi_proc.o
kernelcapi-objs := $(kernelcapi-y)
# The global Rules.make. # The global Rules.make.
......
...@@ -3,25 +3,22 @@ ...@@ -3,25 +3,22 @@
* Kernel CAPI 2.0 Module * Kernel CAPI 2.0 Module
* *
* Copyright 1999 by Carsten Paeth <calle@calle.de> * Copyright 1999 by Carsten Paeth <calle@calle.de>
* Copyright 2002 by Kai Germaschewski <kai@germaschewski.name>
* *
* This software may be used and distributed according to the terms * This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference. * of the GNU General Public License, incorporated herein by reference.
* *
*/ */
#define DBG(format, arg...) do { \
printk(KERN_DEBUG __FUNCTION__ ": " format "\n" , ## arg); \
} while (0)
#define CONFIG_AVMB1_COMPAT #define CONFIG_AVMB1_COMPAT
#include <linux/config.h> #include "kcapi.h"
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/tqueue.h> #include <linux/tqueue.h>
#include <linux/capi.h> #include <linux/capi.h>
...@@ -30,7 +27,6 @@ printk(KERN_DEBUG __FUNCTION__ ": " format "\n" , ## arg); \ ...@@ -30,7 +27,6 @@ printk(KERN_DEBUG __FUNCTION__ ": " format "\n" , ## arg); \
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/isdn/capicmd.h> #include <linux/isdn/capicmd.h>
#include <linux/isdn/capiutil.h> #include <linux/isdn/capiutil.h>
#include <linux/isdn/capilli.h>
#ifdef CONFIG_AVMB1_COMPAT #ifdef CONFIG_AVMB1_COMPAT
#include <linux/b1lli.h> #include <linux/b1lli.h>
#endif #endif
...@@ -39,12 +35,6 @@ static char *revision = "$Revision: 1.21.6.8 $"; ...@@ -39,12 +35,6 @@ static char *revision = "$Revision: 1.21.6.8 $";
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
#define CARD_DETECTED 1
#define CARD_LOADING 2
#define CARD_RUNNING 3
/* ------------------------------------------------------------- */
static int showcapimsgs = 0; static int showcapimsgs = 0;
MODULE_DESCRIPTION("CAPI4Linux: kernel CAPI layer"); MODULE_DESCRIPTION("CAPI4Linux: kernel CAPI layer");
...@@ -70,14 +60,15 @@ static char capi_manufakturer[64] = "AVM Berlin"; ...@@ -70,14 +60,15 @@ static char capi_manufakturer[64] = "AVM Berlin";
#define NCCI2CTRL(ncci) (((ncci) >> 24) & 0x7f) #define NCCI2CTRL(ncci) (((ncci) >> 24) & 0x7f)
static struct capi20_appl *applications[CAPI_MAXAPPL]; LIST_HEAD(capi_drivers);
static struct capi_ctr *cards[CAPI_MAXCONTR]; spinlock_t capi_drivers_lock = SPIN_LOCK_UNLOCKED;
struct capi20_appl *capi_applications[CAPI_MAXAPPL];
struct capi_ctr *capi_cards[CAPI_MAXCONTR];
static int ncards; static int ncards;
static struct sk_buff_head recv_queue; static struct sk_buff_head recv_queue;
static LIST_HEAD(drivers);
static spinlock_t drivers_lock = SPIN_LOCK_UNLOCKED;
static struct tq_struct tq_state_notify; static struct tq_struct tq_state_notify;
static struct tq_struct tq_recv_notify; static struct tq_struct tq_recv_notify;
...@@ -86,8 +77,8 @@ static struct tq_struct tq_recv_notify; ...@@ -86,8 +77,8 @@ static struct tq_struct tq_recv_notify;
static inline struct capi_ctr * static inline struct capi_ctr *
capi_ctr_get(struct capi_ctr *card) capi_ctr_get(struct capi_ctr *card)
{ {
if (card->driver->owner) { if (card->owner) {
if (try_inc_mod_count(card->driver->owner)) { if (try_inc_mod_count(card->owner)) {
DBG("MOD_COUNT INC"); DBG("MOD_COUNT INC");
return card; return card;
} else } else
...@@ -100,8 +91,8 @@ capi_ctr_get(struct capi_ctr *card) ...@@ -100,8 +91,8 @@ capi_ctr_get(struct capi_ctr *card)
static inline void static inline void
capi_ctr_put(struct capi_ctr *card) capi_ctr_put(struct capi_ctr *card)
{ {
if (card->driver->owner) if (card->owner)
__MOD_DEC_USE_COUNT(card->driver->owner); __MOD_DEC_USE_COUNT(card->owner);
DBG("MOD_COUNT DEC"); DBG("MOD_COUNT DEC");
} }
...@@ -112,7 +103,7 @@ static inline struct capi_ctr *get_capi_ctr_by_nr(u16 contr) ...@@ -112,7 +103,7 @@ static inline struct capi_ctr *get_capi_ctr_by_nr(u16 contr)
if (contr - 1 >= CAPI_MAXCONTR) if (contr - 1 >= CAPI_MAXCONTR)
return NULL; return NULL;
return cards[contr - 1]; return capi_cards[contr - 1];
} }
static inline struct capi20_appl *get_capi_appl_by_nr(u16 applid) static inline struct capi20_appl *get_capi_appl_by_nr(u16 applid)
...@@ -120,21 +111,11 @@ static inline struct capi20_appl *get_capi_appl_by_nr(u16 applid) ...@@ -120,21 +111,11 @@ static inline struct capi20_appl *get_capi_appl_by_nr(u16 applid)
if (applid - 1 >= CAPI_MAXAPPL) if (applid - 1 >= CAPI_MAXAPPL)
return NULL; return NULL;
return applications[applid - 1]; return capi_applications[applid - 1];
} }
/* -------- util functions ------------------------------------ */ /* -------- util functions ------------------------------------ */
static char *cardstate2str(unsigned short cardstate)
{
switch (cardstate) {
case CARD_DETECTED: return "detected";
case CARD_LOADING: return "loading";
case CARD_RUNNING: return "running";
default: return "???";
}
}
static inline int capi_cmd_valid(u8 cmd) static inline int capi_cmd_valid(u8 cmd)
{ {
switch (cmd) { switch (cmd) {
...@@ -170,244 +151,13 @@ static inline int capi_subcmd_valid(u8 subcmd) ...@@ -170,244 +151,13 @@ static inline int capi_subcmd_valid(u8 subcmd)
return 0; return 0;
} }
/* -------- /proc functions ----------------------------------- */
/*
* /proc/capi/applications:
* applid l3cnt dblkcnt dblklen #ncci recvqueuelen
*/
static int proc_applications_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
struct capi20_appl *ap;
int i;
int len = 0;
for (i=1; i <= CAPI_MAXAPPL; i++) {
ap = get_capi_appl_by_nr(i);
if (!ap) continue;
len += sprintf(page+len, "%u %d %d %d\n",
ap->applid,
ap->rparam.level3cnt,
ap->rparam.datablkcnt,
ap->rparam.datablklen);
if (len <= off) {
off -= len;
len = 0;
} else {
if (len-off > count)
goto endloop;
}
}
endloop:
*start = page+off;
if (len < count)
*eof = 1;
if (len>count) len = count;
if (len<0) len = 0;
return len;
}
/*
* /proc/capi/driver:
* driver ncontroller
*/
static int proc_driver_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
struct list_head *l;
struct capi_driver *driver;
int len = 0;
spin_lock(&drivers_lock);
list_for_each(l, &drivers) {
driver = list_entry(l, struct capi_driver, driver_list);
len += sprintf(page+len, "%-32s %d %s\n",
driver->name,
driver->ncontroller,
driver->revision);
if (len <= off) {
off -= len;
len = 0;
} else {
if (len-off > count)
goto endloop;
}
}
endloop:
spin_unlock(&drivers_lock);
*start = page+off;
if (len < count)
*eof = 1;
if (len>count) len = count;
if (len<0) len = 0;
return len;
}
/*
* /proc/capi/controller:
* cnr driver cardstate name driverinfo
*/
static int proc_controller_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
struct capi_ctr *cp;
int i;
int len = 0;
for (i=0; i < CAPI_MAXCONTR; i++) {
cp = cards[i];
if (!cp)
continue;
len += sprintf(page+len, "%d %-10s %-8s %-16s %s\n",
cp->cnr, cp->driver->name,
cardstate2str(cp->cardstate),
cp->name,
cp->driver->procinfo ? cp->driver->procinfo(cp) : ""
);
if (len <= off) {
off -= len;
len = 0;
} else {
if (len-off > count)
goto endloop;
}
}
endloop:
*start = page+off;
if (len < count)
*eof = 1;
if (len>count) len = count;
if (len<0) len = 0;
return len;
}
/*
* /proc/capi/applstats:
* applid nrecvctlpkt nrecvdatapkt nsentctlpkt nsentdatapkt
*/
static int proc_applstats_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
struct capi20_appl *ap;
int i;
int len = 0;
for (i=1; i <= CAPI_MAXAPPL; i++) {
ap = get_capi_appl_by_nr(i);
if (!ap) continue;
len += sprintf(page+len, "%u %lu %lu %lu %lu\n",
ap->applid,
ap->nrecvctlpkt,
ap->nrecvdatapkt,
ap->nsentctlpkt,
ap->nsentdatapkt);
if (len <= off) {
off -= len;
len = 0;
} else {
if (len-off > count)
goto endloop;
}
}
endloop:
*start = page+off;
if (len < count)
*eof = 1;
if (len>count) len = count;
if (len<0) len = 0;
return len;
}
/*
* /proc/capi/contrstats:
* cnr nrecvctlpkt nrecvdatapkt nsentctlpkt nsentdatapkt
*/
static int proc_contrstats_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
struct capi_ctr *cp;
int i;
int len = 0;
for (i=0; i < CAPI_MAXCONTR; i++) {
cp = cards[i];
if (!cp)
continue;
len += sprintf(page+len, "%d %lu %lu %lu %lu\n",
cp->cnr,
cp->nrecvctlpkt,
cp->nrecvdatapkt,
cp->nsentctlpkt,
cp->nsentdatapkt);
if (len <= off) {
off -= len;
len = 0;
} else {
if (len-off > count)
goto endloop;
}
}
endloop:
*start = page+off;
if (len < count)
*eof = 1;
if (len>count) len = count;
if (len<0) len = 0;
return len;
}
static struct procfsentries {
char *name;
mode_t mode;
int (*read_proc)(char *page, char **start, off_t off,
int count, int *eof, void *data);
struct proc_dir_entry *procent;
} procfsentries[] = {
{ "capi", S_IFDIR, 0 },
{ "capi/applications", 0 , proc_applications_read_proc },
{ "capi/driver", 0 , proc_driver_read_proc },
{ "capi/controller", 0 , proc_controller_read_proc },
{ "capi/applstats", 0 , proc_applstats_read_proc },
{ "capi/contrstats", 0 , proc_contrstats_read_proc },
{ "capi/drivers", S_IFDIR, 0 },
{ "capi/controllers", S_IFDIR, 0 },
};
static void proc_capi_init(void)
{
int nelem = sizeof(procfsentries)/sizeof(procfsentries[0]);
int i;
for (i=0; i < nelem; i++) {
struct procfsentries *p = procfsentries + i;
p->procent = create_proc_entry(p->name, p->mode, 0);
if (p->procent) p->procent->read_proc = p->read_proc;
}
}
static void proc_capi_exit(void)
{
int nelem = sizeof(procfsentries)/sizeof(procfsentries[0]);
int i;
for (i=nelem-1; i >= 0; i--) {
struct procfsentries *p = procfsentries + i;
if (p->procent) {
remove_proc_entry(p->name, 0);
p->procent = 0;
}
}
}
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
static void register_appl(struct capi_ctr *card, u16 applid, capi_register_params *rparam) static void register_appl(struct capi_ctr *card, u16 applid, capi_register_params *rparam)
{ {
card = capi_ctr_get(card); card = capi_ctr_get(card);
card->driver->register_appl(card, applid, rparam); card->register_appl(card, applid, rparam);
} }
...@@ -415,7 +165,7 @@ static void release_appl(struct capi_ctr *card, u16 applid) ...@@ -415,7 +165,7 @@ static void release_appl(struct capi_ctr *card, u16 applid)
{ {
DBG("applid %#x", applid); DBG("applid %#x", applid);
card->driver->release_appl(card, applid); card->release_appl(card, applid);
capi_ctr_put(card); capi_ctr_put(card);
} }
...@@ -574,8 +324,7 @@ static void recv_handler(void *dummy) ...@@ -574,8 +324,7 @@ static void recv_handler(void *dummy)
} }
} }
static void controllercb_handle_capimsg(struct capi_ctr * card, void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb)
u16 appl, struct sk_buff *skb)
{ {
int showctl = 0; int showctl = 0;
u8 cmd, subcmd; u8 cmd, subcmd;
...@@ -618,7 +367,9 @@ static void controllercb_handle_capimsg(struct capi_ctr * card, ...@@ -618,7 +367,9 @@ static void controllercb_handle_capimsg(struct capi_ctr * card,
kfree_skb(skb); kfree_skb(skb);
} }
static void controllercb_ready(struct capi_ctr * card) EXPORT_SYMBOL(capi_ctr_handle_message);
void capi_ctr_ready(struct capi_ctr * card)
{ {
u16 appl; u16 appl;
struct capi20_appl *ap; struct capi20_appl *ap;
...@@ -637,7 +388,9 @@ static void controllercb_ready(struct capi_ctr * card) ...@@ -637,7 +388,9 @@ static void controllercb_ready(struct capi_ctr * card)
notify_push(KCI_CONTRUP, card->cnr, 0, 0); notify_push(KCI_CONTRUP, card->cnr, 0, 0);
} }
static void controllercb_reseted(struct capi_ctr * card) EXPORT_SYMBOL(capi_ctr_ready);
void capi_ctr_reseted(struct capi_ctr * card)
{ {
u16 appl; u16 appl;
...@@ -666,7 +419,9 @@ static void controllercb_reseted(struct capi_ctr * card) ...@@ -666,7 +419,9 @@ static void controllercb_reseted(struct capi_ctr * card)
notify_push(KCI_CONTRDOWN, card->cnr, 0, 0); notify_push(KCI_CONTRDOWN, card->cnr, 0, 0);
} }
static void controllercb_suspend_output(struct capi_ctr *card) EXPORT_SYMBOL(capi_ctr_reseted);
void capi_ctr_suspend_output(struct capi_ctr *card)
{ {
if (!card->blocked) { if (!card->blocked) {
printk(KERN_DEBUG "kcapi: card %d suspend\n", card->cnr); printk(KERN_DEBUG "kcapi: card %d suspend\n", card->cnr);
...@@ -674,7 +429,9 @@ static void controllercb_suspend_output(struct capi_ctr *card) ...@@ -674,7 +429,9 @@ static void controllercb_suspend_output(struct capi_ctr *card)
} }
} }
static void controllercb_resume_output(struct capi_ctr *card) EXPORT_SYMBOL(capi_ctr_suspend_output);
void capi_ctr_resume_output(struct capi_ctr *card)
{ {
if (card->blocked) { if (card->blocked) {
printk(KERN_DEBUG "kcapi: card %d resume\n", card->cnr); printk(KERN_DEBUG "kcapi: card %d resume\n", card->cnr);
...@@ -682,149 +439,71 @@ static void controllercb_resume_output(struct capi_ctr *card) ...@@ -682,149 +439,71 @@ static void controllercb_resume_output(struct capi_ctr *card)
} }
} }
/* ------------------------------------------------------------- */ EXPORT_SYMBOL(capi_ctr_resume_output);
/* ------------------------------------------------------------- */
struct capi_ctr * int
attach_capi_ctr(struct capi_driver *driver, char *name, void *driverdata) attach_capi_ctr(struct capi_ctr *card)
{ {
struct capi_ctr *card;
int i; int i;
for (i=0; i < CAPI_MAXCONTR; i++) { for (i = 0; i < CAPI_MAXCONTR; i++) {
if (cards[i] == NULL) if (capi_cards[i] == NULL)
break; break;
} }
if (i == CAPI_MAXCONTR) { if (i == CAPI_MAXCONTR) {
printk(KERN_ERR "kcapi: out of controller slots\n"); printk(KERN_ERR "kcapi: out of controller slots\n");
return NULL; return -EBUSY;
} }
card = kmalloc(sizeof(*card), GFP_KERNEL); capi_cards[i] = card;
if (!card)
return NULL;
cards[i] = card; card->nrecvctlpkt = 0;
memset(card, 0, sizeof(struct capi_ctr)); card->nrecvdatapkt = 0;
card->driver = driver; card->nsentctlpkt = 0;
card->nsentdatapkt = 0;
card->cnr = i + 1; card->cnr = i + 1;
strncpy(card->name, name, sizeof(card->name));
card->cardstate = CARD_DETECTED; card->cardstate = CARD_DETECTED;
card->blocked = 0; card->blocked = 0;
card->driverdata = driverdata;
card->traceflag = showcapimsgs; card->traceflag = showcapimsgs;
card->ready = controllercb_ready;
card->reseted = controllercb_reseted;
card->suspend_output = controllercb_suspend_output;
card->resume_output = controllercb_resume_output;
card->handle_capimsg = controllercb_handle_capimsg;
list_add_tail(&card->driver_list, &driver->contr_head);
driver->ncontroller++;
sprintf(card->procfn, "capi/controllers/%d", card->cnr); sprintf(card->procfn, "capi/controllers/%d", card->cnr);
card->procent = create_proc_entry(card->procfn, 0, 0); card->procent = create_proc_entry(card->procfn, 0, 0);
if (card->procent) { if (card->procent) {
card->procent->read_proc = card->procent->read_proc =
(int (*)(char *,char **,off_t,int,int *,void *)) (int (*)(char *,char **,off_t,int,int *,void *))
driver->ctr_read_proc; card->ctr_read_proc;
card->procent->data = card; card->procent->data = card;
} }
ncards++; ncards++;
printk(KERN_NOTICE "kcapi: Controller %d: %s attached\n", printk(KERN_NOTICE "kcapi: Controller %d: %s attached\n",
card->cnr, card->name); card->cnr, card->name);
return card; return 0;
} }
EXPORT_SYMBOL(attach_capi_ctr); EXPORT_SYMBOL(attach_capi_ctr);
int detach_capi_ctr(struct capi_ctr *card) int detach_capi_ctr(struct capi_ctr *card)
{ {
struct capi_driver *driver = card->driver;
if (card->cardstate != CARD_DETECTED) if (card->cardstate != CARD_DETECTED)
controllercb_reseted(card); capi_ctr_reseted(card);
list_del(&card->driver_list);
driver->ncontroller--;
ncards--; ncards--;
if (card->procent) { if (card->procent) {
remove_proc_entry(card->procfn, 0); remove_proc_entry(card->procfn, 0);
card->procent = 0; card->procent = 0;
} }
cards[card->cnr - 1] = NULL; capi_cards[card->cnr - 1] = NULL;
printk(KERN_NOTICE "kcapi: Controller %d: %s unregistered\n", printk(KERN_NOTICE "kcapi: Controller %d: %s unregistered\n",
card->cnr, card->name); card->cnr, card->name);
kfree(card);
return 0; return 0;
} }
EXPORT_SYMBOL(detach_capi_ctr); EXPORT_SYMBOL(detach_capi_ctr);
/* ------------------------------------------------------------- */
/* fallback if no driver read_proc function defined by driver */
static int driver_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
struct capi_driver *driver = (struct capi_driver *)data;
int len = 0;
len += sprintf(page+len, "%-16s %s\n", "name", driver->name);
len += sprintf(page+len, "%-16s %s\n", "revision", driver->revision);
if (len < off)
return 0;
*eof = 1;
*start = page + off;
return ((count < len-off) ? count : len-off);
}
/* ------------------------------------------------------------- */
void attach_capi_driver(struct capi_driver *driver)
{
INIT_LIST_HEAD(&driver->contr_head);
spin_lock(&drivers_lock);
list_add_tail(&driver->driver_list, &drivers);
spin_unlock(&drivers_lock);
printk(KERN_NOTICE "kcapi: driver %s attached\n", driver->name);
sprintf(driver->procfn, "capi/drivers/%s", driver->name);
driver->procent = create_proc_entry(driver->procfn, 0, 0);
if (driver->procent) {
if (driver->driver_read_proc) {
driver->procent->read_proc =
(int (*)(char *,char **,off_t,int,int *,void *))
driver->driver_read_proc;
} else {
driver->procent->read_proc = driver_read_proc;
}
driver->procent->data = driver;
}
}
EXPORT_SYMBOL(attach_capi_driver);
void detach_capi_driver(struct capi_driver *driver)
{
spin_lock(&drivers_lock);
list_del(&driver->driver_list);
spin_unlock(&drivers_lock);
printk(KERN_NOTICE "kcapi: driver %s detached\n", driver->name);
if (driver->procent) {
remove_proc_entry(driver->procfn, 0);
driver->procent = 0;
}
}
EXPORT_SYMBOL(detach_capi_driver);
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* -------- CAPI2.0 Interface ---------------------------------- */ /* -------- CAPI2.0 Interface ---------------------------------- */
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
...@@ -833,7 +512,7 @@ u16 capi20_isinstalled(void) ...@@ -833,7 +512,7 @@ u16 capi20_isinstalled(void)
{ {
int i; int i;
for (i = 0; i < CAPI_MAXCONTR; i++) { for (i = 0; i < CAPI_MAXCONTR; i++) {
if (cards[i] && cards[i]->cardstate == CARD_RUNNING) if (capi_cards[i] && capi_cards[i]->cardstate == CARD_RUNNING)
return CAPI_NOERROR; return CAPI_NOERROR;
} }
return CAPI_REGNOTINSTALLED; return CAPI_REGNOTINSTALLED;
...@@ -852,14 +531,14 @@ u16 capi20_register(struct capi20_appl *ap) ...@@ -852,14 +531,14 @@ u16 capi20_register(struct capi20_appl *ap)
return CAPI_LOGBLKSIZETOSMALL; return CAPI_LOGBLKSIZETOSMALL;
for (applid = 1; applid <= CAPI_MAXAPPL; applid++) { for (applid = 1; applid <= CAPI_MAXAPPL; applid++) {
if (applications[applid - 1] == NULL) if (capi_applications[applid - 1] == NULL)
break; break;
} }
if (applid > CAPI_MAXAPPL) if (applid > CAPI_MAXAPPL)
return CAPI_TOOMANYAPPLS; return CAPI_TOOMANYAPPLS;
ap->applid = applid; ap->applid = applid;
applications[applid - 1] = ap; capi_applications[applid - 1] = ap;
ap->nrecvctlpkt = 0; ap->nrecvctlpkt = 0;
ap->nrecvdatapkt = 0; ap->nrecvdatapkt = 0;
...@@ -868,9 +547,9 @@ u16 capi20_register(struct capi20_appl *ap) ...@@ -868,9 +547,9 @@ u16 capi20_register(struct capi20_appl *ap)
ap->callback = 0; ap->callback = 0;
for (i = 0; i < CAPI_MAXCONTR; i++) { for (i = 0; i < CAPI_MAXCONTR; i++) {
if (!cards[i] || cards[i]->cardstate != CARD_RUNNING) if (!capi_cards[i] || capi_cards[i]->cardstate != CARD_RUNNING)
continue; continue;
register_appl(cards[i], applid, &ap->rparam); register_appl(capi_cards[i], applid, &ap->rparam);
} }
printk(KERN_DEBUG "kcapi: appl %d up\n", applid); printk(KERN_DEBUG "kcapi: appl %d up\n", applid);
...@@ -886,11 +565,11 @@ u16 capi20_release(struct capi20_appl *ap) ...@@ -886,11 +565,11 @@ u16 capi20_release(struct capi20_appl *ap)
DBG("applid %#x", ap->applid); DBG("applid %#x", ap->applid);
for (i = 0; i < CAPI_MAXCONTR; i++) { for (i = 0; i < CAPI_MAXCONTR; i++) {
if (!cards[i] || cards[i]->cardstate != CARD_RUNNING) if (!capi_cards[i] || capi_cards[i]->cardstate != CARD_RUNNING)
continue; continue;
release_appl(cards[i], ap->applid); release_appl(capi_cards[i], ap->applid);
} }
applications[ap->applid - 1] = NULL; capi_applications[ap->applid - 1] = NULL;
printk(KERN_DEBUG "kcapi: appl %d down\n", ap->applid); printk(KERN_DEBUG "kcapi: appl %d down\n", ap->applid);
return CAPI_NOERROR; return CAPI_NOERROR;
...@@ -950,7 +629,7 @@ u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb) ...@@ -950,7 +629,7 @@ u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb)
} }
} }
return card->driver->send_message(card, skb); return card->send_message(card, skb);
} }
EXPORT_SYMBOL(capi20_put_message); EXPORT_SYMBOL(capi20_put_message);
...@@ -1028,28 +707,11 @@ u16 capi20_get_profile(u32 contr, struct capi_profile *profp) ...@@ -1028,28 +707,11 @@ u16 capi20_get_profile(u32 contr, struct capi_profile *profp)
EXPORT_SYMBOL(capi20_get_profile); EXPORT_SYMBOL(capi20_get_profile);
static struct capi_driver *find_driver(char *name)
{
struct list_head *l;
struct capi_driver *dp;
spin_lock(&drivers_lock);
list_for_each(l, &drivers) {
dp = list_entry(l, struct capi_driver, driver_list);
if (strcmp(dp->name, name) == 0)
goto found;
}
dp = NULL;
found:
spin_unlock(&drivers_lock);
return dp;
}
#ifdef CONFIG_AVMB1_COMPAT #ifdef CONFIG_AVMB1_COMPAT
static int old_capi_manufacturer(unsigned int cmd, void *data) static int old_capi_manufacturer(unsigned int cmd, void *data)
{ {
avmb1_loadandconfigdef ldef; avmb1_loadandconfigdef ldef;
avmb1_resetdef rdef; avmb1_resetdef rdef;
avmb1_getdef gdef;
struct capi_ctr *card; struct capi_ctr *card;
capiloaddata ldata; capiloaddata ldata;
int retval; int retval;
...@@ -1073,8 +735,8 @@ static int old_capi_manufacturer(unsigned int cmd, void *data) ...@@ -1073,8 +735,8 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
card = capi_ctr_get(card); card = capi_ctr_get(card);
if (!card) if (!card)
return -ESRCH; return -ESRCH;
if (card->driver->load_firmware == 0) { if (card->load_firmware == 0) {
printk(KERN_DEBUG "kcapi: load: driver \%s\" has no load function\n", card->driver->name); printk(KERN_DEBUG "kcapi: load: no load function\n");
return -ESRCH; return -ESRCH;
} }
...@@ -1100,7 +762,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data) ...@@ -1100,7 +762,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
} }
card->cardstate = CARD_LOADING; card->cardstate = CARD_LOADING;
retval = card->driver->load_firmware(card, &ldata); retval = card->load_firmware(card, &ldata);
if (retval) { if (retval) {
card->cardstate = CARD_DETECTED; card->cardstate = CARD_DETECTED;
...@@ -1131,7 +793,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data) ...@@ -1131,7 +793,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
if (card->cardstate == CARD_DETECTED) if (card->cardstate == CARD_DETECTED)
return 0; return 0;
card->driver->reset_ctr(card); card->reset_ctr(card);
while (card->cardstate > CARD_DETECTED) { while (card->cardstate > CARD_DETECTED) {
...@@ -1143,23 +805,6 @@ static int old_capi_manufacturer(unsigned int cmd, void *data) ...@@ -1143,23 +805,6 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
} }
return 0; return 0;
case AVMB1_GET_CARDINFO:
if (copy_from_user((void *)&gdef, data, sizeof(avmb1_getdef)))
return -EFAULT;
card = get_capi_ctr_by_nr(gdef.contr);
if (!card)
return -ESRCH;
gdef.cardstate = card->cardstate;
if (card->driver == find_driver("t1isa"))
gdef.cardtype = AVM_CARDTYPE_T1;
else gdef.cardtype = AVM_CARDTYPE_B1;
if (copy_to_user(data, (void *)&gdef, sizeof(avmb1_getdef)))
return -EFAULT;
return 0;
} }
return -EINVAL; return -EINVAL;
} }
...@@ -1228,8 +873,6 @@ static int __init kcapi_init(void) ...@@ -1228,8 +873,6 @@ static int __init kcapi_init(void)
char *p; char *p;
char rev[32]; char rev[32];
MOD_INC_USE_COUNT;
skb_queue_head_init(&recv_queue); skb_queue_head_init(&recv_queue);
tq_state_notify.routine = notify_handler; tq_state_notify.routine = notify_handler;
...@@ -1238,7 +881,7 @@ static int __init kcapi_init(void) ...@@ -1238,7 +881,7 @@ static int __init kcapi_init(void)
tq_recv_notify.routine = recv_handler; tq_recv_notify.routine = recv_handler;
tq_recv_notify.data = 0; tq_recv_notify.data = 0;
proc_capi_init(); kcapi_proc_init();
if ((p = strchr(revision, ':')) != 0 && p[1]) { if ((p = strchr(revision, ':')) != 0 && p[1]) {
strncpy(rev, p + 2, sizeof(rev)); strncpy(rev, p + 2, sizeof(rev));
...@@ -1248,30 +891,14 @@ static int __init kcapi_init(void) ...@@ -1248,30 +891,14 @@ static int __init kcapi_init(void)
} else } else
strcpy(rev, "1.0"); strcpy(rev, "1.0");
#ifdef MODULE printk(KERN_NOTICE "CAPI Subsystem Rev %s\n", rev);
printk(KERN_NOTICE "CAPI-driver Rev %s: loaded\n", rev);
#else
printk(KERN_NOTICE "CAPI-driver Rev %s: started\n", rev);
#endif
MOD_DEC_USE_COUNT;
return 0; return 0;
} }
static void __exit kcapi_exit(void) static void __exit kcapi_exit(void)
{ {
char rev[10]; kcapi_proc_exit();
char *p;
if ((p = strchr(revision, ':'))) {
strcpy(rev, p + 1);
p = strchr(rev, '$');
*p = 0;
} else {
strcpy(rev, "1.0");
}
proc_capi_exit();
printk(KERN_NOTICE "CAPI-driver Rev%s: unloaded\n", rev);
} }
module_init(kcapi_init); module_init(kcapi_init);
......
/*
* Kernel CAPI 2.0 Module
*
* Copyright 1999 by Carsten Paeth <calle@calle.de>
* Copyright 2002 by Kai Germaschewski <kai@germaschewski.name>
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#include <linux/kernel.h>
#include <linux/spinlock.h>
#include <linux/list.h>
#include <linux/isdn/capilli.h>
#define DBG(format, arg...) do { \
printk(KERN_INFO __FUNCTION__ ": " format "\n" , ## arg); \
} while (0)
enum {
CARD_DETECTED = 1,
CARD_LOADING = 2,
CARD_RUNNING = 3,
};
extern struct list_head capi_drivers;
extern spinlock_t capi_drivers_lock;
extern struct capi20_appl *capi_applications[CAPI_MAXAPPL];
extern struct capi_ctr *capi_cards[CAPI_MAXCONTR];
#ifdef CONFIG_PROC_FS
void kcapi_proc_init(void);
void kcapi_proc_exit(void);
#else
static inline void kcapi_proc_init(void) { };
static inline void kcapi_proc_exit(void) { };
#endif
/*
* Kernel CAPI 2.0 Module - /proc/capi handling
*
* Copyright 1999 by Carsten Paeth <calle@calle.de>
* Copyright 2002 by Kai Germaschewski <kai@germaschewski.name>
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#include "kcapi.h"
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
static char *
cardstate2str(unsigned short cardstate)
{
switch (cardstate) {
case CARD_DETECTED: return "detected";
case CARD_LOADING: return "loading";
case CARD_RUNNING: return "running";
default: return "???";
}
}
// /proc/capi
// ===========================================================================
// /proc/capi/controller:
// cnr driver cardstate name driverinfo
// /proc/capi/contrstats:
// cnr nrecvctlpkt nrecvdatapkt nsentctlpkt nsentdatapkt
// ---------------------------------------------------------------------------
static void *controller_start(struct seq_file *seq, loff_t *pos)
{
if (*pos < CAPI_MAXCONTR)
return &capi_cards[*pos];
return NULL;
}
static void *controller_next(struct seq_file *seq, void *v, loff_t *pos)
{
++*pos;
if (*pos < CAPI_MAXCONTR)
return &capi_cards[*pos];
return NULL;
}
static void controller_stop(struct seq_file *seq, void *v)
{
}
static int controller_show(struct seq_file *seq, void *v)
{
struct capi_ctr *ctr = *(struct capi_ctr **) v;
if (!ctr)
return 0;
seq_printf(seq, "%d %-10s %-8s %-16s %s\n",
ctr->cnr, ctr->driver_name,
cardstate2str(ctr->cardstate),
ctr->name,
ctr->procinfo ? ctr->procinfo(ctr) : "");
return 0;
}
static int contrstats_show(struct seq_file *seq, void *v)
{
struct capi_ctr *ctr = *(struct capi_ctr **) v;
if (!ctr)
return 0;
seq_printf(seq, "%d %lu %lu %lu %lu\n",
ctr->cnr,
ctr->nrecvctlpkt,
ctr->nrecvdatapkt,
ctr->nsentctlpkt,
ctr->nsentdatapkt);
return 0;
}
struct seq_operations seq_controller_ops = {
start: controller_start,
next: controller_next,
stop: controller_stop,
show: controller_show,
};
struct seq_operations seq_contrstats_ops = {
start: controller_start,
next: controller_next,
stop: controller_stop,
show: contrstats_show,
};
static int seq_controller_open(struct inode *inode, struct file *file)
{
return seq_open(file, &seq_controller_ops);
}
static int seq_contrstats_open(struct inode *inode, struct file *file)
{
return seq_open(file, &seq_contrstats_ops);
}
static struct file_operations proc_controller_ops = {
open: seq_controller_open,
read: seq_read,
llseek: seq_lseek,
release: seq_release,
};
static struct file_operations proc_contrstats_ops = {
open: seq_contrstats_open,
read: seq_read,
llseek: seq_lseek,
release: seq_release,
};
// /proc/capi/applications:
// applid l3cnt dblkcnt dblklen #ncci recvqueuelen
// /proc/capi/applstats:
// applid nrecvctlpkt nrecvdatapkt nsentctlpkt nsentdatapkt
// ---------------------------------------------------------------------------
static void *
applications_start(struct seq_file *seq, loff_t *pos)
{
if (*pos < CAPI_MAXAPPL)
return &capi_applications[*pos];
return NULL;
}
static void *
applications_next(struct seq_file *seq, void *v, loff_t *pos)
{
++*pos;
if (*pos < CAPI_MAXAPPL)
return &capi_applications[*pos];
return NULL;
}
static void
applications_stop(struct seq_file *seq, void *v)
{
}
static int
applications_show(struct seq_file *seq, void *v)
{
struct capi20_appl *ap = *(struct capi20_appl **) v;
if (!ap)
return 0;
seq_printf(seq, "%u %d %d %d\n",
ap->applid,
ap->rparam.level3cnt,
ap->rparam.datablkcnt,
ap->rparam.datablklen);
return 0;
}
static int
applstats_show(struct seq_file *seq, void *v)
{
struct capi20_appl *ap = *(struct capi20_appl **) v;
if (!ap)
return 0;
seq_printf(seq, "%u %lu %lu %lu %lu\n",
ap->applid,
ap->nrecvctlpkt,
ap->nrecvdatapkt,
ap->nsentctlpkt,
ap->nsentdatapkt);
return 0;
}
struct seq_operations seq_applications_ops = {
start: applications_start,
next: applications_next,
stop: applications_stop,
show: applications_show,
};
struct seq_operations seq_applstats_ops = {
start: applications_start,
next: applications_next,
stop: applications_stop,
show: applstats_show,
};
static int
seq_applications_open(struct inode *inode, struct file *file)
{
return seq_open(file, &seq_applications_ops);
}
static int
seq_applstats_open(struct inode *inode, struct file *file)
{
return seq_open(file, &seq_applstats_ops);
}
static struct file_operations proc_applications_ops = {
open: seq_applications_open,
read: seq_read,
llseek: seq_lseek,
release: seq_release,
};
static struct file_operations proc_applstats_ops = {
open: seq_applstats_open,
read: seq_read,
llseek: seq_lseek,
release: seq_release,
};
static void
create_seq_entry(char *name, mode_t mode, struct file_operations *f)
{
struct proc_dir_entry *entry;
entry = create_proc_entry(name, mode, NULL);
if (entry)
entry->proc_fops = f;
}
// ---------------------------------------------------------------------------
void __init
kcapi_proc_init(void)
{
proc_mkdir("capi", NULL);
proc_mkdir("capi/controllers", NULL);
proc_mkdir("capi/drivers", NULL);
create_seq_entry("capi/controller", 0, &proc_controller_ops);
create_seq_entry("capi/contrstats", 0, &proc_contrstats_ops);
create_seq_entry("capi/applications", 0, &proc_applications_ops);
create_seq_entry("capi/applstats", 0, &proc_applstats_ops);
}
void __exit
kcapi_proc_exit(void)
{
remove_proc_entry("capi/driver", NULL);
remove_proc_entry("capi/controller", NULL);
remove_proc_entry("capi/contrstats", NULL);
remove_proc_entry("capi/applications", NULL);
remove_proc_entry("capi/applstats", NULL);
remove_proc_entry("capi/drivers", NULL);
remove_proc_entry("capi/controllers", NULL);
remove_proc_entry("capi", NULL);
}
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#define _AVMCARD_H_ #define _AVMCARD_H_
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/list.h>
#define AVMB1_PORTLEN 0x1f #define AVMB1_PORTLEN 0x1f
#define AVM_MAXVERSION 8 #define AVM_MAXVERSION 8
...@@ -67,7 +68,7 @@ typedef struct avmctrl_info { ...@@ -67,7 +68,7 @@ typedef struct avmctrl_info {
char infobuf[128]; /* for function procinfo */ char infobuf[128]; /* for function procinfo */
struct avmcard *card; struct avmcard *card;
struct capi_ctr *capi_ctrl; struct capi_ctr capi_ctrl;
struct list_head ncci_head; struct list_head ncci_head;
} avmctrl_info; } avmctrl_info;
...@@ -93,7 +94,9 @@ typedef struct avmcard { ...@@ -93,7 +94,9 @@ typedef struct avmcard {
struct avmctrl_info *ctrlinfo; struct avmctrl_info *ctrlinfo;
int nr_controllers;
int nlogcontr; int nlogcontr;
struct list_head list;
} avmcard; } avmcard;
extern int b1_irq_table[16]; extern int b1_irq_table[16];
...@@ -537,7 +540,6 @@ static inline void b1_setinterrupt(unsigned int base, unsigned irq, ...@@ -537,7 +540,6 @@ static inline void b1_setinterrupt(unsigned int base, unsigned irq,
} }
/* b1.c */ /* b1.c */
void b1_set_revision(struct capi_driver *driver, char *rev);
avmcard *b1_alloc_card(int nr_controllers); avmcard *b1_alloc_card(int nr_controllers);
void b1_free_card(avmcard *card); void b1_free_card(avmcard *card);
int b1_detect(unsigned int base, enum avmcardtype cardtype); int b1_detect(unsigned int base, enum avmcardtype cardtype);
......
...@@ -59,21 +59,6 @@ int b1_irq_table[16] = ...@@ -59,21 +59,6 @@ int b1_irq_table[16] =
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
void b1_set_revision(struct capi_driver *driver, char *rev)
{
char *p;
if ((p = strchr(rev, ':')) != 0 && p[1]) {
strncpy(driver->revision, p + 2, sizeof(driver->revision));
driver->revision[sizeof(driver->revision)-1] = 0;
if ((p = strchr(driver->revision, '$')) != 0 && p > driver->revision)
*(p-1) = 0;
}
printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
}
/* ------------------------------------------------------------- */
avmcard *b1_alloc_card(int nr_controllers) avmcard *b1_alloc_card(int nr_controllers)
{ {
avmcard *card; avmcard *card;
...@@ -99,6 +84,7 @@ avmcard *b1_alloc_card(int nr_controllers) ...@@ -99,6 +84,7 @@ avmcard *b1_alloc_card(int nr_controllers)
cinfo[i].card = card; cinfo[i].card = card;
} }
spin_lock_init(&card->lock); spin_lock_init(&card->lock);
card->nr_controllers = nr_controllers;
return card; return card;
} }
...@@ -344,7 +330,7 @@ void b1_reset_ctr(struct capi_ctr *ctrl) ...@@ -344,7 +330,7 @@ void b1_reset_ctr(struct capi_ctr *ctrl)
memset(cinfo->version, 0, sizeof(cinfo->version)); memset(cinfo->version, 0, sizeof(cinfo->version));
capilib_release(&cinfo->ncci_head); capilib_release(&cinfo->ncci_head);
ctrl->reseted(ctrl); capi_ctr_reseted(ctrl);
} }
void b1_register_appl(struct capi_ctr *ctrl, void b1_register_appl(struct capi_ctr *ctrl,
...@@ -433,7 +419,7 @@ u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) ...@@ -433,7 +419,7 @@ u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
void b1_parse_version(avmctrl_info *cinfo) void b1_parse_version(avmctrl_info *cinfo)
{ {
struct capi_ctr *ctrl = cinfo->capi_ctrl; struct capi_ctr *ctrl = &cinfo->capi_ctrl;
avmcard *card = cinfo->card; avmcard *card = cinfo->card;
capi_profile *profp; capi_profile *profp;
u8 *dversion; u8 *dversion;
...@@ -509,7 +495,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -509,7 +495,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
{ {
avmcard *card = devptr; avmcard *card = devptr;
avmctrl_info *cinfo = &card->ctrlinfo[0]; avmctrl_info *cinfo = &card->ctrlinfo[0];
struct capi_ctr *ctrl = cinfo->capi_ctrl; struct capi_ctr *ctrl = &cinfo->capi_ctrl;
unsigned char b1cmd; unsigned char b1cmd;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -543,7 +529,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -543,7 +529,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
} else { } else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len);
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
break; break;
...@@ -561,7 +547,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -561,7 +547,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
CAPIMSG_NCCI(skb->data), CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data)); CAPIMSG_MSGID(skb->data));
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
break; break;
...@@ -587,11 +573,11 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -587,11 +573,11 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
case RECEIVE_START: case RECEIVE_START:
/* b1_put_byte(card->port, SEND_POLLACK); */ /* b1_put_byte(card->port, SEND_POLLACK); */
ctrl->resume_output(ctrl); capi_ctr_resume_output(ctrl);
break; break;
case RECEIVE_STOP: case RECEIVE_STOP:
ctrl->suspend_output(ctrl); capi_ctr_suspend_output(ctrl);
break; break;
case RECEIVE_INIT: case RECEIVE_INIT:
...@@ -602,7 +588,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -602,7 +588,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
card->name, card->name,
cinfo->version[VER_CARDTYPE], cinfo->version[VER_CARDTYPE],
cinfo->version[VER_DRIVER]); cinfo->version[VER_DRIVER]);
ctrl->ready(ctrl); capi_ctr_ready(ctrl);
break; break;
case RECEIVE_TASK_READY: case RECEIVE_TASK_READY:
...@@ -774,7 +760,6 @@ EXPORT_SYMBOL(avmcard_dma_free); ...@@ -774,7 +760,6 @@ EXPORT_SYMBOL(avmcard_dma_free);
EXPORT_SYMBOL(b1_irq_table); EXPORT_SYMBOL(b1_irq_table);
EXPORT_SYMBOL(b1_set_revision);
EXPORT_SYMBOL(b1_alloc_card); EXPORT_SYMBOL(b1_alloc_card);
EXPORT_SYMBOL(b1_free_card); EXPORT_SYMBOL(b1_free_card);
EXPORT_SYMBOL(b1_detect); EXPORT_SYMBOL(b1_detect);
......
...@@ -447,7 +447,7 @@ static void b1dma_handle_rx(avmcard *card) ...@@ -447,7 +447,7 @@ static void b1dma_handle_rx(avmcard *card)
{ {
avmctrl_info *cinfo = &card->ctrlinfo[0]; avmctrl_info *cinfo = &card->ctrlinfo[0];
avmcard_dmainfo *dma = card->dma; avmcard_dmainfo *dma = card->dma;
struct capi_ctr *ctrl = cinfo->capi_ctrl; struct capi_ctr *ctrl = &cinfo->capi_ctrl;
struct sk_buff *skb; struct sk_buff *skb;
void *p = dma->recvbuf.dmabuf+4; void *p = dma->recvbuf.dmabuf+4;
u32 ApplId, MsgLen, DataB3Len, NCCI, WindowSize; u32 ApplId, MsgLen, DataB3Len, NCCI, WindowSize;
...@@ -475,7 +475,7 @@ static void b1dma_handle_rx(avmcard *card) ...@@ -475,7 +475,7 @@ static void b1dma_handle_rx(avmcard *card)
} else { } else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len);
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
break; break;
...@@ -493,7 +493,7 @@ static void b1dma_handle_rx(avmcard *card) ...@@ -493,7 +493,7 @@ static void b1dma_handle_rx(avmcard *card)
CAPIMSG_NCCI(skb->data), CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data)); CAPIMSG_MSGID(skb->data));
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
break; break;
...@@ -523,11 +523,11 @@ static void b1dma_handle_rx(avmcard *card) ...@@ -523,11 +523,11 @@ static void b1dma_handle_rx(avmcard *card)
#endif #endif
if (!suppress_pollack) if (!suppress_pollack)
queue_pollack(card); queue_pollack(card);
ctrl->resume_output(ctrl); capi_ctr_resume_output(ctrl);
break; break;
case RECEIVE_STOP: case RECEIVE_STOP:
ctrl->suspend_output(ctrl); capi_ctr_suspend_output(ctrl);
break; break;
case RECEIVE_INIT: case RECEIVE_INIT:
...@@ -538,7 +538,7 @@ static void b1dma_handle_rx(avmcard *card) ...@@ -538,7 +538,7 @@ static void b1dma_handle_rx(avmcard *card)
card->name, card->name,
cinfo->version[VER_CARDTYPE], cinfo->version[VER_CARDTYPE],
cinfo->version[VER_DRIVER]); cinfo->version[VER_DRIVER]);
ctrl->ready(ctrl); capi_ctr_ready(ctrl);
break; break;
case RECEIVE_TASK_READY: case RECEIVE_TASK_READY:
...@@ -740,7 +740,7 @@ void b1dma_reset_ctr(struct capi_ctr *ctrl) ...@@ -740,7 +740,7 @@ void b1dma_reset_ctr(struct capi_ctr *ctrl)
memset(cinfo->version, 0, sizeof(cinfo->version)); memset(cinfo->version, 0, sizeof(cinfo->version));
capilib_release(&cinfo->ncci_head); capilib_release(&cinfo->ncci_head);
ctrl->reseted(ctrl); capi_ctr_reseted(ctrl);
} }
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include <linux/isdn/capilli.h> #include <linux/isdn/capilli.h>
#include "avmcard.h" #include "avmcard.h"
static char *revision = "$Revision: 1.10.6.6 $";
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM B1 ISA card"); MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM B1 ISA card");
...@@ -35,18 +33,20 @@ MODULE_LICENSE("GPL"); ...@@ -35,18 +33,20 @@ MODULE_LICENSE("GPL");
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver b1isa_driver;
static void b1isa_remove(struct pci_dev *pdev) static void b1isa_remove(struct pci_dev *pdev)
{ {
avmctrl_info *cinfo = pci_get_drvdata(pdev); avmctrl_info *cinfo = pci_get_drvdata(pdev);
avmcard *card = cinfo->card; avmcard *card;
unsigned int port = cinfo->card->port;
if (!cinfo)
return;
b1_reset(port); card = cinfo->card;
b1_reset(port);
detach_capi_ctr(cinfo->capi_ctrl); b1_reset(card->port);
b1_reset(card->port);
detach_capi_ctr(&cinfo->capi_ctrl);
free_irq(card->irq, card); free_irq(card->irq, card);
release_region(card->port, AVMB1_PORTLEN); release_region(card->port, AVMB1_PORTLEN);
b1_free_card(card); b1_free_card(card);
...@@ -54,6 +54,8 @@ static void b1isa_remove(struct pci_dev *pdev) ...@@ -54,6 +54,8 @@ static void b1isa_remove(struct pci_dev *pdev)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static char *b1isa_procinfo(struct capi_ctr *ctrl);
static int __init b1isa_probe(struct pci_dev *pdev) static int __init b1isa_probe(struct pci_dev *pdev)
{ {
avmctrl_info *cinfo; avmctrl_info *cinfo;
...@@ -106,16 +108,26 @@ static int __init b1isa_probe(struct pci_dev *pdev) ...@@ -106,16 +108,26 @@ static int __init b1isa_probe(struct pci_dev *pdev)
b1_reset(card->port); b1_reset(card->port);
b1_getrevision(card); b1_getrevision(card);
cinfo->capi_ctrl = attach_capi_ctr(&b1isa_driver, card->name, cinfo); cinfo->capi_ctrl.driver_name = "b1isa";
if (!cinfo->capi_ctrl) { cinfo->capi_ctrl.driverdata = cinfo;
cinfo->capi_ctrl.register_appl = b1_register_appl;
cinfo->capi_ctrl.release_appl = b1_release_appl;
cinfo->capi_ctrl.send_message = b1_send_message;
cinfo->capi_ctrl.load_firmware = b1_load_firmware;
cinfo->capi_ctrl.reset_ctr = b1_reset_ctr;
cinfo->capi_ctrl.procinfo = b1isa_procinfo;
cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name);
SET_MODULE_OWNER(&cinfo->capi_ctrl);
retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) {
printk(KERN_ERR "b1isa: attach controller failed.\n"); printk(KERN_ERR "b1isa: attach controller failed.\n");
retval = -EBUSY;
goto err_free_irq; goto err_free_irq;
} }
printk(KERN_INFO printk(KERN_INFO "b1isa: AVM B1 ISA at i/o %#x, irq %d, revision %d\n",
"%s: AVM B1 ISA at i/o %#x, irq %d, revision %d\n", card->port, card->irq, card->revision);
b1isa_driver.name, card->port, card->irq, card->revision);
pci_set_drvdata(pdev, cinfo); pci_set_drvdata(pdev, cinfo);
return 0; return 0;
...@@ -148,21 +160,6 @@ static char *b1isa_procinfo(struct capi_ctr *ctrl) ...@@ -148,21 +160,6 @@ static char *b1isa_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver b1isa_driver = {
owner: THIS_MODULE,
name: "b1isa",
revision: "0.0",
load_firmware: b1_load_firmware,
reset_ctr: b1_reset_ctr,
register_appl: b1_register_appl,
release_appl: b1_release_appl,
send_message: b1_send_message,
procinfo: b1isa_procinfo,
ctr_read_proc: b1ctl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
};
#define MAX_CARDS 4 #define MAX_CARDS 4
static struct pci_dev isa_dev[MAX_CARDS]; static struct pci_dev isa_dev[MAX_CARDS];
static int io[MAX_CARDS]; static int io[MAX_CARDS];
...@@ -175,12 +172,9 @@ MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); ...@@ -175,12 +172,9 @@ MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
static int __init b1isa_init(void) static int __init b1isa_init(void)
{ {
int i, retval; int i;
int found = 0; int found = 0;
b1_set_revision(&b1isa_driver, revision);
attach_capi_driver(&b1isa_driver);
for (i = 0; i < MAX_CARDS; i++) { for (i = 0; i < MAX_CARDS; i++) {
if (!io[i]) if (!io[i])
break; break;
...@@ -191,17 +185,10 @@ static int __init b1isa_init(void) ...@@ -191,17 +185,10 @@ static int __init b1isa_init(void)
if (b1isa_probe(&isa_dev[i]) == 0) if (b1isa_probe(&isa_dev[i]) == 0)
found++; found++;
} }
if (found == 0) { if (found == 0)
retval = -ENODEV; return -ENODEV;
goto err;
}
retval = 0;
goto out;
err: return 0;
detach_capi_driver(&b1isa_driver);
out:
return retval;
} }
static void __exit b1isa_exit(void) static void __exit b1isa_exit(void)
...@@ -214,7 +201,6 @@ static void __exit b1isa_exit(void) ...@@ -214,7 +201,6 @@ static void __exit b1isa_exit(void)
b1isa_remove(&isa_dev[i]); b1isa_remove(&isa_dev[i]);
} }
detach_capi_driver(&b1isa_driver);
} }
module_init(b1isa_init); module_init(b1isa_init);
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <linux/isdn/capilli.h> #include <linux/isdn/capilli.h>
#include "avmcard.h" #include "avmcard.h"
static char *revision = "$Revision: 1.1.4.1.2.1 $";
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct pci_device_id b1pci_pci_tbl[] __devinitdata = { static struct pci_device_id b1pci_pci_tbl[] __devinitdata = {
...@@ -60,9 +58,7 @@ static char *b1pci_procinfo(struct capi_ctr *ctrl) ...@@ -60,9 +58,7 @@ static char *b1pci_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static int b1pci_probe(struct capi_driver *driver, static int b1pci_probe(struct capicardparams *p, struct pci_dev *pdev)
struct capicardparams *p,
struct pci_dev *pdev)
{ {
avmcard *card; avmcard *card;
avmctrl_info *cinfo; avmctrl_info *cinfo;
...@@ -70,7 +66,7 @@ static int b1pci_probe(struct capi_driver *driver, ...@@ -70,7 +66,7 @@ static int b1pci_probe(struct capi_driver *driver,
card = b1_alloc_card(1); card = b1_alloc_card(1);
if (!card) { if (!card) {
printk(KERN_WARNING "%s: no memory.\n", driver->name); printk(KERN_WARNING "b1pci: no memory.\n");
retval = -ENOMEM; retval = -ENOMEM;
goto err; goto err;
} }
...@@ -82,17 +78,16 @@ static int b1pci_probe(struct capi_driver *driver, ...@@ -82,17 +78,16 @@ static int b1pci_probe(struct capi_driver *driver,
card->cardtype = avm_b1pci; card->cardtype = avm_b1pci;
if (!request_region(card->port, AVMB1_PORTLEN, card->name)) { if (!request_region(card->port, AVMB1_PORTLEN, card->name)) {
printk(KERN_WARNING printk(KERN_WARNING "b1pci: ports 0x%03x-0x%03x in use.\n",
"%s: ports 0x%03x-0x%03x in use.\n", card->port, card->port + AVMB1_PORTLEN);
driver->name, card->port, card->port + AVMB1_PORTLEN);
retval = -EBUSY; retval = -EBUSY;
goto err_free; goto err_free;
} }
b1_reset(card->port); b1_reset(card->port);
retval = b1_detect(card->port, card->cardtype); retval = b1_detect(card->port, card->cardtype);
if (retval) { if (retval) {
printk(KERN_NOTICE "%s: NO card at 0x%x (%d)\n", printk(KERN_NOTICE "b1pci: NO card at 0x%x (%d)\n",
driver->name, card->port, retval); card->port, retval);
retval = -ENODEV; retval = -ENODEV;
goto err_release_region; goto err_release_region;
} }
...@@ -101,28 +96,35 @@ static int b1pci_probe(struct capi_driver *driver, ...@@ -101,28 +96,35 @@ static int b1pci_probe(struct capi_driver *driver,
retval = request_irq(card->irq, b1_interrupt, SA_SHIRQ, card->name, card); retval = request_irq(card->irq, b1_interrupt, SA_SHIRQ, card->name, card);
if (retval) { if (retval) {
printk(KERN_ERR "%s: unable to get IRQ %d.\n", printk(KERN_ERR "b1pci: unable to get IRQ %d.\n", card->irq);
driver->name, card->irq);
retval = -EBUSY; retval = -EBUSY;
goto err_release_region; goto err_release_region;
} }
cinfo->capi_ctrl = attach_capi_ctr(driver, card->name, cinfo); cinfo->capi_ctrl.driver_name = "b1pci";
if (!cinfo->capi_ctrl) { cinfo->capi_ctrl.driverdata = cinfo;
printk(KERN_ERR "%s: attach controller failed.\n", cinfo->capi_ctrl.register_appl = b1_register_appl;
driver->name); cinfo->capi_ctrl.release_appl = b1_release_appl;
retval = -EBUSY; cinfo->capi_ctrl.send_message = b1_send_message;
cinfo->capi_ctrl.load_firmware = b1_load_firmware;
cinfo->capi_ctrl.reset_ctr = b1_reset_ctr;
cinfo->capi_ctrl.procinfo = b1pci_procinfo;
cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name);
SET_MODULE_OWNER(&cinfo->capi_ctrl);
retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) {
printk(KERN_ERR "b1pci: attach controller failed.\n");
goto err_free_irq; goto err_free_irq;
} }
if (card->revision >= 4) { if (card->revision >= 4) {
printk(KERN_INFO printk(KERN_INFO "b1pci: AVM B1 PCI V4 at i/o %#x, irq %d, revision %d (no dma)\n",
"%s: AVM B1 PCI V4 at i/o %#x, irq %d, revision %d (no dma)\n", card->port, card->irq, card->revision);
driver->name, card->port, card->irq, card->revision);
} else { } else {
printk(KERN_INFO printk(KERN_INFO "b1pci: AVM B1 PCI at i/o %#x, irq %d, revision %d\n",
"%s: AVM B1 PCI at i/o %#x, irq %d, revision %d\n", card->port, card->irq, card->revision);
driver->name, card->port, card->irq, card->revision);
} }
pci_set_drvdata(pdev, card); pci_set_drvdata(pdev, card);
...@@ -147,29 +149,12 @@ static void b1pci_remove(struct pci_dev *pdev) ...@@ -147,29 +149,12 @@ static void b1pci_remove(struct pci_dev *pdev)
b1_reset(port); b1_reset(port);
b1_reset(port); b1_reset(port);
detach_capi_ctr(cinfo->capi_ctrl); detach_capi_ctr(&cinfo->capi_ctrl);
free_irq(card->irq, card); free_irq(card->irq, card);
release_region(card->port, AVMB1_PORTLEN); release_region(card->port, AVMB1_PORTLEN);
b1_free_card(card); b1_free_card(card);
} }
/* ------------------------------------------------------------- */
static struct capi_driver b1pci_driver = {
owner: THIS_MODULE,
name: "b1pci",
revision: "0.0",
load_firmware: b1_load_firmware,
reset_ctr: b1_reset_ctr,
register_appl: b1_register_appl,
release_appl: b1_release_appl,
send_message: b1_send_message,
procinfo: b1pci_procinfo,
ctr_read_proc: b1ctl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
};
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4 #ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
...@@ -192,9 +177,7 @@ static char *b1pciv4_procinfo(struct capi_ctr *ctrl) ...@@ -192,9 +177,7 @@ static char *b1pciv4_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static int b1pciv4_probe(struct capi_driver *driver, static int b1pciv4_probe(struct capicardparams *p, struct pci_dev *pdev)
struct capicardparams *p,
struct pci_dev *pdev)
{ {
avmcard *card; avmcard *card;
avmctrl_info *cinfo; avmctrl_info *cinfo;
...@@ -202,14 +185,14 @@ static int b1pciv4_probe(struct capi_driver *driver, ...@@ -202,14 +185,14 @@ static int b1pciv4_probe(struct capi_driver *driver,
card = b1_alloc_card(1); card = b1_alloc_card(1);
if (!card) { if (!card) {
printk(KERN_WARNING "%s: no memory.\n", driver->name); printk(KERN_WARNING "b1pci: no memory.\n");
retval = -ENOMEM; retval = -ENOMEM;
goto err; goto err;
} }
card->dma = avmcard_dma_alloc(driver->name, pdev, 2048+128, 2048+128); card->dma = avmcard_dma_alloc("b1pci", pdev, 2048+128, 2048+128);
if (!card->dma) { if (!card->dma) {
printk(KERN_WARNING "%s: dma alloc.\n", driver->name); printk(KERN_WARNING "b1pci: dma alloc.\n");
retval = -ENOMEM; retval = -ENOMEM;
goto err_free; goto err_free;
} }
...@@ -222,17 +205,16 @@ static int b1pciv4_probe(struct capi_driver *driver, ...@@ -222,17 +205,16 @@ static int b1pciv4_probe(struct capi_driver *driver,
card->cardtype = avm_b1pci; card->cardtype = avm_b1pci;
if (!request_region(card->port, AVMB1_PORTLEN, card->name)) { if (!request_region(card->port, AVMB1_PORTLEN, card->name)) {
printk(KERN_WARNING printk(KERN_WARNING "b1pci: ports 0x%03x-0x%03x in use.\n",
"%s: ports 0x%03x-0x%03x in use.\n", card->port, card->port + AVMB1_PORTLEN);
driver->name, card->port, card->port + AVMB1_PORTLEN);
retval = -EBUSY; retval = -EBUSY;
goto err_free_dma; goto err_free_dma;
} }
card->mbase = ioremap_nocache(card->membase, 64); card->mbase = ioremap_nocache(card->membase, 64);
if (!card->mbase) { if (!card->mbase) {
printk(KERN_NOTICE "%s: can't remap memory at 0x%lx\n", printk(KERN_NOTICE "b1pci: can't remap memory at 0x%lx\n",
driver->name, card->membase); card->membase);
retval = -ENOMEM; retval = -ENOMEM;
goto err_release_region; goto err_release_region;
} }
...@@ -241,8 +223,8 @@ static int b1pciv4_probe(struct capi_driver *driver, ...@@ -241,8 +223,8 @@ static int b1pciv4_probe(struct capi_driver *driver,
retval = b1pciv4_detect(card); retval = b1pciv4_detect(card);
if (retval) { if (retval) {
printk(KERN_NOTICE "%s: NO card at 0x%x (%d)\n", printk(KERN_NOTICE "b1pci: NO card at 0x%x (%d)\n",
driver->name, card->port, retval); card->port, retval);
retval = -ENODEV; retval = -ENODEV;
goto err_unmap; goto err_unmap;
} }
...@@ -251,24 +233,33 @@ static int b1pciv4_probe(struct capi_driver *driver, ...@@ -251,24 +233,33 @@ static int b1pciv4_probe(struct capi_driver *driver,
retval = request_irq(card->irq, b1dma_interrupt, SA_SHIRQ, card->name, card); retval = request_irq(card->irq, b1dma_interrupt, SA_SHIRQ, card->name, card);
if (retval) { if (retval) {
printk(KERN_ERR "%s: unable to get IRQ %d.\n", printk(KERN_ERR "b1pci: unable to get IRQ %d.\n",
driver->name, card->irq); card->irq);
retval = -EBUSY; retval = -EBUSY;
goto err_unmap; goto err_unmap;
} }
cinfo->capi_ctrl = attach_capi_ctr(driver, card->name, cinfo); cinfo->capi_ctrl.driver_name = "b1pciv4";
if (!cinfo->capi_ctrl) { cinfo->capi_ctrl.driverdata = cinfo;
printk(KERN_ERR "%s: attach controller failed.\n", driver->name); cinfo->capi_ctrl.register_appl = b1dma_register_appl;
retval = -EBUSY; cinfo->capi_ctrl.release_appl = b1dma_release_appl;
cinfo->capi_ctrl.send_message = b1dma_send_message;
cinfo->capi_ctrl.load_firmware = b1dma_load_firmware;
cinfo->capi_ctrl.reset_ctr = b1dma_reset_ctr;
cinfo->capi_ctrl.procinfo = b1pciv4_procinfo;
cinfo->capi_ctrl.ctr_read_proc = b1dmactl_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name);
SET_MODULE_OWNER(&cinfo->capi_ctrl);
retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) {
printk(KERN_ERR "b1pci: attach controller failed.\n");
goto err_free_irq; goto err_free_irq;
} }
card->cardnr = cinfo->capi_ctrl->cnr; card->cardnr = cinfo->capi_ctrl.cnr;
printk(KERN_INFO printk(KERN_INFO "b1pci: AVM B1 PCI V4 at i/o %#x, irq %d, mem %#lx, revision %d (dma)\n",
"%s: AVM B1 PCI V4 at i/o %#x, irq %d, mem %#lx, revision %d (dma)\n", card->port, card->irq, card->membase, card->revision);
driver->name, card->port, card->irq,
card->membase, card->revision);
pci_set_drvdata(pdev, card); pci_set_drvdata(pdev, card);
return 0; return 0;
...@@ -295,7 +286,7 @@ static void b1pciv4_remove(struct pci_dev *pdev) ...@@ -295,7 +286,7 @@ static void b1pciv4_remove(struct pci_dev *pdev)
b1dma_reset(card); b1dma_reset(card);
detach_capi_ctr(cinfo->capi_ctrl); detach_capi_ctr(&cinfo->capi_ctrl);
free_irq(card->irq, card); free_irq(card->irq, card);
iounmap(card->mbase); iounmap(card->mbase);
release_region(card->port, AVMB1_PORTLEN); release_region(card->port, AVMB1_PORTLEN);
...@@ -303,74 +294,48 @@ static void b1pciv4_remove(struct pci_dev *pdev) ...@@ -303,74 +294,48 @@ static void b1pciv4_remove(struct pci_dev *pdev)
b1_free_card(card); b1_free_card(card);
} }
/* ------------------------------------------------------------- */
static struct capi_driver b1pciv4_driver = {
owner: THIS_MODULE,
name: "b1pciv4",
revision: "0.0",
load_firmware: b1dma_load_firmware,
reset_ctr: b1dma_reset_ctr,
register_appl: b1dma_register_appl,
release_appl: b1dma_release_appl,
send_message: b1dma_send_message,
procinfo: b1pciv4_procinfo,
ctr_read_proc: b1dmactl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
};
#endif /* CONFIG_ISDN_DRV_AVMB1_B1PCIV4 */ #endif /* CONFIG_ISDN_DRV_AVMB1_B1PCIV4 */
static int __devinit b1pci_pci_probe(struct pci_dev *pdev, static int __devinit b1pci_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
struct capi_driver *driver = &b1pci_driver;
struct capicardparams param; struct capicardparams param;
int retval; int retval;
if (pci_enable_device(pdev) < 0) { if (pci_enable_device(pdev) < 0) {
printk(KERN_ERR "%s: failed to enable AVM-B1\n", printk(KERN_ERR "b1pci: failed to enable AVM-B1\n");
driver->name);
return -ENODEV; return -ENODEV;
} }
param.irq = pdev->irq; param.irq = pdev->irq;
if (pci_resource_start(pdev, 2)) { /* B1 PCI V4 */ if (pci_resource_start(pdev, 2)) { /* B1 PCI V4 */
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4 #ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
driver = &b1pciv4_driver;
pci_set_master(pdev); pci_set_master(pdev);
#endif #endif
param.membase = pci_resource_start(pdev, 0); param.membase = pci_resource_start(pdev, 0);
param.port = pci_resource_start(pdev, 2); param.port = pci_resource_start(pdev, 2);
printk(KERN_INFO printk(KERN_INFO "b1pci: PCI BIOS reports AVM-B1 V4 at i/o %#x, irq %d, mem %#x\n",
"%s: PCI BIOS reports AVM-B1 V4 at i/o %#x, irq %d, mem %#x\n", param.port, param.irq, param.membase);
driver->name, param.port, param.irq, param.membase);
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4 #ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
retval = b1pciv4_probe(driver, &param, pdev); retval = b1pciv4_probe(&param, pdev);
#else #else
retval = b1pci_probe(driver, &param, pdev); retval = b1pci_probe(&param, pdev);
#endif #endif
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR printk(KERN_ERR "b1pci: no AVM-B1 V4 at i/o %#x, irq %d, mem %#x detected\n",
"%s: no AVM-B1 V4 at i/o %#x, irq %d, mem %#x detected\n", param.port, param.irq, param.membase);
driver->name, param.port, param.irq, param.membase);
} }
} else { } else {
param.membase = 0; param.membase = 0;
param.port = pci_resource_start(pdev, 1); param.port = pci_resource_start(pdev, 1);
printk(KERN_INFO printk(KERN_INFO "b1pci: PCI BIOS reports AVM-B1 at i/o %#x, irq %d\n",
"%s: PCI BIOS reports AVM-B1 at i/o %#x, irq %d\n", param.port, param.irq);
driver->name, param.port, param.irq); retval = b1pci_probe(&param, pdev);
retval = b1pci_probe(driver, &param, pdev);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR printk(KERN_ERR "b1pci: no AVM-B1 at i/o %#x, irq %d detected\n",
"%s: no AVM-B1 at i/o %#x, irq %d detected\n", param.port, param.irq);
driver->name, param.port, param.irq);
} }
} }
return retval; return retval;
...@@ -395,42 +360,12 @@ static struct pci_driver b1pci_pci_driver = { ...@@ -395,42 +360,12 @@ static struct pci_driver b1pci_pci_driver = {
static int __init b1pci_init(void) static int __init b1pci_init(void)
{ {
int retval; return pci_module_init(&b1pci_pci_driver);
b1_set_revision(&b1pci_driver, revision);
attach_capi_driver(&b1pci_driver);
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
b1_set_revision(&b1pciv4_driver, revision);
attach_capi_driver(&b1pciv4_driver);
#endif
retval = pci_module_init(&b1pci_pci_driver);
if (retval < 0)
goto err;
printk(KERN_INFO "%s: %d B1-PCI card(s) detected\n",
b1pci_driver.name, retval);
retval = 0;
goto out;
err:
detach_capi_driver(&b1pci_driver);
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
detach_capi_driver(&b1pciv4_driver);
#endif
out:
return retval;
} }
static void __exit b1pci_exit(void) static void __exit b1pci_exit(void)
{ {
pci_unregister_driver(&b1pci_pci_driver); pci_unregister_driver(&b1pci_pci_driver);
detach_capi_driver(&b1pci_driver);
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
detach_capi_driver(&b1pciv4_driver);
#endif
} }
module_init(b1pci_init); module_init(b1pci_init);
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include <linux/isdn/capilli.h> #include <linux/isdn/capilli.h>
#include "avmcard.h" #include "avmcard.h"
static char *revision = "$Revision: 1.12.6.5 $";
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM PCMCIA cards"); MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM PCMCIA cards");
...@@ -51,10 +49,12 @@ static void b1pcmcia_remove_ctr(struct capi_ctr *ctrl) ...@@ -51,10 +49,12 @@ static void b1pcmcia_remove_ctr(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static int b1pcmcia_add_card(struct capi_driver *driver, static LIST_HEAD(cards);
unsigned int port,
unsigned irq, static char *b1pcmcia_procinfo(struct capi_ctr *ctrl);
enum avmcardtype cardtype)
static int b1pcmcia_add_card(unsigned int port, unsigned irq,
enum avmcardtype cardtype)
{ {
avmctrl_info *cinfo; avmctrl_info *cinfo;
avmcard *card; avmcard *card;
...@@ -63,7 +63,7 @@ static int b1pcmcia_add_card(struct capi_driver *driver, ...@@ -63,7 +63,7 @@ static int b1pcmcia_add_card(struct capi_driver *driver,
card = b1_alloc_card(1); card = b1_alloc_card(1);
if (!card) { if (!card) {
printk(KERN_WARNING "%s: no memory.\n", driver->name); printk(KERN_WARNING "b1pcmcia: no memory.\n");
retval = -ENOMEM; retval = -ENOMEM;
goto err; goto err;
} }
...@@ -80,26 +80,36 @@ static int b1pcmcia_add_card(struct capi_driver *driver, ...@@ -80,26 +80,36 @@ static int b1pcmcia_add_card(struct capi_driver *driver,
retval = request_irq(card->irq, b1_interrupt, 0, card->name, card); retval = request_irq(card->irq, b1_interrupt, 0, card->name, card);
if (retval) { if (retval) {
printk(KERN_ERR "%s: unable to get IRQ %d.\n", printk(KERN_ERR "b1pcmcia: unable to get IRQ %d.\n",
driver->name, card->irq); card->irq);
retval = -EBUSY; retval = -EBUSY;
goto err_free; goto err_free;
} }
b1_reset(card->port); b1_reset(card->port);
if ((retval = b1_detect(card->port, card->cardtype)) != 0) { if ((retval = b1_detect(card->port, card->cardtype)) != 0) {
printk(KERN_NOTICE "%s: NO card at 0x%x (%d)\n", printk(KERN_NOTICE "b1pcmcia: NO card at 0x%x (%d)\n",
driver->name, card->port, retval); card->port, retval);
retval = -ENODEV; retval = -ENODEV;
goto err_free_irq; goto err_free_irq;
} }
b1_reset(card->port); b1_reset(card->port);
b1_getrevision(card); b1_getrevision(card);
cinfo->capi_ctrl = attach_capi_ctr(driver, card->name, cinfo); cinfo->capi_ctrl.driver_name = "b1pcmcia";
if (!cinfo->capi_ctrl) { cinfo->capi_ctrl.driverdata = cinfo;
printk(KERN_ERR "%s: attach controller failed.\n", cinfo->capi_ctrl.register_appl = b1_register_appl;
driver->name); cinfo->capi_ctrl.release_appl = b1_release_appl;
retval = -EBUSY; cinfo->capi_ctrl.send_message = b1_send_message;
cinfo->capi_ctrl.load_firmware = b1_load_firmware;
cinfo->capi_ctrl.reset_ctr = b1_reset_ctr;
cinfo->capi_ctrl.procinfo = b1pcmcia_procinfo;
cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name);
SET_MODULE_OWNER(&cinfo->capi_ctrl);
retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) {
printk(KERN_ERR "b1pcmcia: attach controller failed.\n");
goto err_free_irq; goto err_free_irq;
} }
switch (cardtype) { switch (cardtype) {
...@@ -108,11 +118,11 @@ static int b1pcmcia_add_card(struct capi_driver *driver, ...@@ -108,11 +118,11 @@ static int b1pcmcia_add_card(struct capi_driver *driver,
default : cardname = "B1 PCMCIA"; break; default : cardname = "B1 PCMCIA"; break;
} }
printk(KERN_INFO printk(KERN_INFO "b1pcmcia: AVM %s at i/o %#x, irq %d, revision %d\n",
"%s: AVM %s at i/o %#x, irq %d, revision %d\n", cardname, card->port, card->irq, card->revision);
driver->name, cardname, card->port, card->irq, card->revision);
return cinfo->capi_ctrl->cnr; list_add(&card->list, &cards);
return cinfo->capi_ctrl.cnr;
err_free_irq: err_free_irq:
free_irq(card->irq, card); free_irq(card->irq, card);
...@@ -142,49 +152,30 @@ static char *b1pcmcia_procinfo(struct capi_ctr *ctrl) ...@@ -142,49 +152,30 @@ static char *b1pcmcia_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver b1pcmcia_driver = {
owner: THIS_MODULE,
name: "b1pcmcia",
revision: "0.0",
load_firmware: b1_load_firmware,
reset_ctr: b1_reset_ctr,
register_appl: b1_register_appl,
release_appl: b1_release_appl,
send_message: b1_send_message,
procinfo: b1pcmcia_procinfo,
ctr_read_proc: b1ctl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
};
/* ------------------------------------------------------------- */
int b1pcmcia_addcard_b1(unsigned int port, unsigned irq) int b1pcmcia_addcard_b1(unsigned int port, unsigned irq)
{ {
return b1pcmcia_add_card(&b1pcmcia_driver, port, irq, avm_b1pcmcia); return b1pcmcia_add_card(port, irq, avm_b1pcmcia);
} }
int b1pcmcia_addcard_m1(unsigned int port, unsigned irq) int b1pcmcia_addcard_m1(unsigned int port, unsigned irq)
{ {
return b1pcmcia_add_card(&b1pcmcia_driver, port, irq, avm_m1); return b1pcmcia_add_card(port, irq, avm_m1);
} }
int b1pcmcia_addcard_m2(unsigned int port, unsigned irq) int b1pcmcia_addcard_m2(unsigned int port, unsigned irq)
{ {
return b1pcmcia_add_card(&b1pcmcia_driver, port, irq, avm_m2); return b1pcmcia_add_card(port, irq, avm_m2);
} }
int b1pcmcia_delcard(unsigned int port, unsigned irq) int b1pcmcia_delcard(unsigned int port, unsigned irq)
{ {
struct list_head *l; struct list_head *l;
struct capi_ctr *ctrl;
avmcard *card; avmcard *card;
list_for_each(l, &b1pcmcia_driver.contr_head) { list_for_each(l, &cards) {
ctrl = list_entry(l, struct capi_ctr, driver_list); card = list_entry(l, avmcard, list);
card = ((avmctrl_info *)(ctrl->driverdata))->card;
if (card->port == port && card->irq == irq) { if (card->port == port && card->irq == irq) {
b1pcmcia_remove_ctr(ctrl); b1pcmcia_remove_ctr(&card->ctrlinfo[0].capi_ctrl);
return 0; return 0;
} }
} }
...@@ -195,21 +186,3 @@ EXPORT_SYMBOL(b1pcmcia_addcard_b1); ...@@ -195,21 +186,3 @@ EXPORT_SYMBOL(b1pcmcia_addcard_b1);
EXPORT_SYMBOL(b1pcmcia_addcard_m1); EXPORT_SYMBOL(b1pcmcia_addcard_m1);
EXPORT_SYMBOL(b1pcmcia_addcard_m2); EXPORT_SYMBOL(b1pcmcia_addcard_m2);
EXPORT_SYMBOL(b1pcmcia_delcard); EXPORT_SYMBOL(b1pcmcia_delcard);
/* ------------------------------------------------------------- */
static int __init b1pcmcia_init(void)
{
b1_set_revision(&b1pcmcia_driver, revision);
attach_capi_driver(&b1pcmcia_driver);
return 0;
}
static void __exit b1pcmcia_exit(void)
{
detach_capi_driver(&b1pcmcia_driver);
}
module_init(b1pcmcia_init);
module_exit(b1pcmcia_exit);
...@@ -29,8 +29,6 @@ ...@@ -29,8 +29,6 @@
#include <linux/isdn/capilli.h> #include <linux/isdn/capilli.h>
#include "avmcard.h" #include "avmcard.h"
static char *revision = "$Revision: 1.1.4.1.2.1 $";
#undef CONFIG_C4_DEBUG #undef CONFIG_C4_DEBUG
#undef CONFIG_C4_POLLDEBUG #undef CONFIG_C4_POLLDEBUG
...@@ -523,7 +521,7 @@ static void c4_handle_rx(avmcard *card) ...@@ -523,7 +521,7 @@ static void c4_handle_rx(avmcard *card)
DataB3Len = _get_slice(&p, card->databuf); DataB3Len = _get_slice(&p, card->databuf);
cidx = CAPIMSG_CONTROLLER(card->msgbuf)-card->cardnr; cidx = CAPIMSG_CONTROLLER(card->msgbuf)-card->cardnr;
if (cidx >= card->nlogcontr) cidx = 0; if (cidx >= card->nlogcontr) cidx = 0;
ctrl = card->ctrlinfo[cidx].capi_ctrl; ctrl = &card->ctrlinfo[cidx].capi_ctrl;
if (MsgLen < 30) { /* not CAPI 64Bit */ if (MsgLen < 30) { /* not CAPI 64Bit */
memset(card->msgbuf+MsgLen, 0, 30-MsgLen); memset(card->msgbuf+MsgLen, 0, 30-MsgLen);
...@@ -536,7 +534,7 @@ static void c4_handle_rx(avmcard *card) ...@@ -536,7 +534,7 @@ static void c4_handle_rx(avmcard *card)
} else { } else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len);
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
break; break;
...@@ -547,7 +545,7 @@ static void c4_handle_rx(avmcard *card) ...@@ -547,7 +545,7 @@ static void c4_handle_rx(avmcard *card)
cidx = CAPIMSG_CONTROLLER(card->msgbuf)-card->cardnr; cidx = CAPIMSG_CONTROLLER(card->msgbuf)-card->cardnr;
if (cidx >= card->nlogcontr) cidx = 0; if (cidx >= card->nlogcontr) cidx = 0;
cinfo = &card->ctrlinfo[cidx]; cinfo = &card->ctrlinfo[cidx];
ctrl = card->ctrlinfo[cidx].capi_ctrl; ctrl = &card->ctrlinfo[cidx].capi_ctrl;
if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) {
printk(KERN_ERR "%s: incoming packet dropped\n", printk(KERN_ERR "%s: incoming packet dropped\n",
...@@ -559,7 +557,7 @@ static void c4_handle_rx(avmcard *card) ...@@ -559,7 +557,7 @@ static void c4_handle_rx(avmcard *card)
CAPIMSG_NCCI(skb->data), CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data)); CAPIMSG_MSGID(skb->data));
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
break; break;
...@@ -593,39 +591,37 @@ static void c4_handle_rx(avmcard *card) ...@@ -593,39 +591,37 @@ static void c4_handle_rx(avmcard *card)
#endif #endif
if (!suppress_pollack) if (!suppress_pollack)
queue_pollack(card); queue_pollack(card);
for (cidx=0; cidx < 4; cidx++) { for (cidx=0; cidx < card->nr_controllers; cidx++) {
ctrl = card->ctrlinfo[cidx].capi_ctrl; ctrl = &card->ctrlinfo[cidx].capi_ctrl;
if (ctrl) capi_ctr_resume_output(ctrl);
ctrl->resume_output(ctrl);
} }
break; break;
case RECEIVE_STOP: case RECEIVE_STOP:
for (cidx=0; cidx < 4; cidx++) { for (cidx=0; cidx < card->nr_controllers; cidx++) {
ctrl = card->ctrlinfo[cidx].capi_ctrl; ctrl = &card->ctrlinfo[cidx].capi_ctrl;
if (ctrl) capi_ctr_suspend_output(ctrl);
ctrl->suspend_output(ctrl);
} }
break; break;
case RECEIVE_INIT: case RECEIVE_INIT:
cidx = card->nlogcontr; cidx = card->nlogcontr;
if (cidx >= 4 || !card->ctrlinfo[cidx].capi_ctrl) { if (cidx >= card->nr_controllers) {
printk(KERN_ERR "%s: card with %d controllers ??\n", printk(KERN_ERR "%s: card with %d controllers ??\n",
card->name, cidx+1); card->name, cidx+1);
break; break;
} }
card->nlogcontr++; card->nlogcontr++;
cinfo = &card->ctrlinfo[cidx]; cinfo = &card->ctrlinfo[cidx];
ctrl = cinfo->capi_ctrl; ctrl = &cinfo->capi_ctrl;
cinfo->versionlen = _get_slice(&p, cinfo->versionbuf); cinfo->versionlen = _get_slice(&p, cinfo->versionbuf);
b1_parse_version(cinfo); b1_parse_version(cinfo);
printk(KERN_INFO "%s: %s-card (%s) now active\n", printk(KERN_INFO "%s: %s-card (%s) now active\n",
card->name, card->name,
cinfo->version[VER_CARDTYPE], cinfo->version[VER_CARDTYPE],
cinfo->version[VER_DRIVER]); cinfo->version[VER_DRIVER]);
ctrl->ready(cinfo->capi_ctrl); capi_ctr_ready(&cinfo->capi_ctrl);
break; break;
case RECEIVE_TASK_READY: case RECEIVE_TASK_READY:
...@@ -673,12 +669,11 @@ static void c4_handle_interrupt(avmcard *card) ...@@ -673,12 +669,11 @@ static void c4_handle_interrupt(avmcard *card)
if (card->nlogcontr == 0) if (card->nlogcontr == 0)
return; return;
printk(KERN_ERR "%s: unexpected reset\n", card->name); printk(KERN_ERR "%s: unexpected reset\n", card->name);
for (i=0; i < 4; i++) { for (i=0; i < card->nr_controllers; i++) {
avmctrl_info *cinfo = &card->ctrlinfo[i]; avmctrl_info *cinfo = &card->ctrlinfo[i];
memset(cinfo->version, 0, sizeof(cinfo->version)); memset(cinfo->version, 0, sizeof(cinfo->version));
capilib_release(&cinfo->ncci_head); capilib_release(&cinfo->ncci_head);
if (cinfo->capi_ctrl) capi_ctr_reseted(&cinfo->capi_ctrl);
cinfo->capi_ctrl->reseted(cinfo->capi_ctrl);
} }
card->nlogcontr = 0; card->nlogcontr = 0;
return; return;
...@@ -888,11 +883,10 @@ void c4_reset_ctr(struct capi_ctr *ctrl) ...@@ -888,11 +883,10 @@ void c4_reset_ctr(struct capi_ctr *ctrl)
c4_reset(card); c4_reset(card);
for (i=0; i < 4; i++) { for (i=0; i < card->nr_controllers; i++) {
cinfo = &card->ctrlinfo[i]; cinfo = &card->ctrlinfo[i];
memset(cinfo->version, 0, sizeof(cinfo->version)); memset(cinfo->version, 0, sizeof(cinfo->version));
if (cinfo->capi_ctrl) capi_ctr_reseted(&cinfo->capi_ctrl);
cinfo->capi_ctrl->reseted(cinfo->capi_ctrl);
} }
card->nlogcontr = 0; card->nlogcontr = 0;
} }
...@@ -905,12 +899,9 @@ static void c4_remove(struct pci_dev *pdev) ...@@ -905,12 +899,9 @@ static void c4_remove(struct pci_dev *pdev)
c4_reset(card); c4_reset(card);
for (i=0; i < 4; i++) { for (i=0; i < card->nr_controllers; i++) {
cinfo = &card->ctrlinfo[i]; cinfo = &card->ctrlinfo[i];
if (cinfo->capi_ctrl) { detach_capi_ctr(&cinfo->capi_ctrl);
detach_capi_ctr(cinfo->capi_ctrl);
cinfo->capi_ctrl = NULL;
}
} }
free_irq(card->irq, card); free_irq(card->irq, card);
...@@ -1104,9 +1095,7 @@ static int c4_read_proc(char *page, char **start, off_t off, ...@@ -1104,9 +1095,7 @@ static int c4_read_proc(char *page, char **start, off_t off,
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static int c4_add_card(struct capi_driver *driver, static int c4_add_card(struct capicardparams *p, struct pci_dev *dev,
struct capicardparams *p,
struct pci_dev *dev,
int nr_controllers) int nr_controllers)
{ {
avmcard *card; avmcard *card;
...@@ -1116,43 +1105,42 @@ static int c4_add_card(struct capi_driver *driver, ...@@ -1116,43 +1105,42 @@ static int c4_add_card(struct capi_driver *driver,
card = b1_alloc_card(nr_controllers); card = b1_alloc_card(nr_controllers);
if (!card) { if (!card) {
printk(KERN_WARNING "%s: no memory.\n", driver->name); printk(KERN_WARNING "c4: no memory.\n");
retval = -ENOMEM; retval = -ENOMEM;
goto err; goto err;
} }
card->dma = avmcard_dma_alloc(driver->name, dev, 2048+128, 2048+128); card->dma = avmcard_dma_alloc("c4", dev, 2048+128, 2048+128);
if (!card->dma) { if (!card->dma) {
printk(KERN_WARNING "%s: no memory.\n", driver->name); printk(KERN_WARNING "c4: no memory.\n");
retval = -ENOMEM; retval = -ENOMEM;
goto err_free; goto err_free;
} }
sprintf(card->name, "%s-%x", driver->name, p->port); sprintf(card->name, "c%d-%x", nr_controllers, p->port);
card->port = p->port; card->port = p->port;
card->irq = p->irq; card->irq = p->irq;
card->membase = p->membase; card->membase = p->membase;
card->cardtype = (nr_controllers == 4) ? avm_c4 : avm_c2; card->cardtype = (nr_controllers == 4) ? avm_c4 : avm_c2;
if (!request_region(card->port, AVMB1_PORTLEN, card->name)) { if (!request_region(card->port, AVMB1_PORTLEN, card->name)) {
printk(KERN_WARNING printk(KERN_WARNING "c4: ports 0x%03x-0x%03x in use.\n",
"%s: ports 0x%03x-0x%03x in use.\n", card->port, card->port + AVMB1_PORTLEN);
driver->name, card->port, card->port + AVMB1_PORTLEN);
retval = -EBUSY; retval = -EBUSY;
goto err_free_dma; goto err_free_dma;
} }
card->mbase = ioremap_nocache(card->membase, 128); card->mbase = ioremap_nocache(card->membase, 128);
if (card->mbase == 0) { if (card->mbase == 0) {
printk(KERN_NOTICE "%s: can't remap memory at 0x%lx\n", printk(KERN_NOTICE "c4: can't remap memory at 0x%lx\n",
driver->name, card->membase); card->membase);
retval = -EIO; retval = -EIO;
goto err_release_region; goto err_release_region;
} }
retval = c4_detect(card); retval = c4_detect(card);
if (retval != 0) { if (retval != 0) {
printk(KERN_NOTICE "%s: NO card at 0x%x (%d)\n", printk(KERN_NOTICE "c4: NO card at 0x%x (%d)\n",
driver->name, card->port, retval); card->port, retval);
retval = -EIO; retval = -EIO;
goto err_unmap; goto err_unmap;
} }
...@@ -1160,30 +1148,40 @@ static int c4_add_card(struct capi_driver *driver, ...@@ -1160,30 +1148,40 @@ static int c4_add_card(struct capi_driver *driver,
retval = request_irq(card->irq, c4_interrupt, SA_SHIRQ, card->name, card); retval = request_irq(card->irq, c4_interrupt, SA_SHIRQ, card->name, card);
if (retval) { if (retval) {
printk(KERN_ERR "%s: unable to get IRQ %d.\n", printk(KERN_ERR "c4: unable to get IRQ %d.\n",card->irq);
driver->name, card->irq);
retval = -EBUSY; retval = -EBUSY;
goto err_unmap; goto err_unmap;
} }
for (i=0; i < nr_controllers ; i++) { for (i=0; i < nr_controllers ; i++) {
cinfo = &card->ctrlinfo[i]; cinfo = &card->ctrlinfo[i];
cinfo->capi_ctrl = attach_capi_ctr(driver, card->name, cinfo); cinfo->capi_ctrl.driver_name = "c4";
if (!cinfo->capi_ctrl) { cinfo->capi_ctrl.driverdata = cinfo;
printk(KERN_ERR "%s: attach controller failed (%d).\n", cinfo->capi_ctrl.register_appl = c4_register_appl;
driver->name, i); cinfo->capi_ctrl.release_appl = c4_release_appl;
cinfo->capi_ctrl.send_message = c4_send_message;
cinfo->capi_ctrl.load_firmware = c4_load_firmware;
cinfo->capi_ctrl.reset_ctr = c4_reset_ctr;
cinfo->capi_ctrl.procinfo = c4_procinfo;
cinfo->capi_ctrl.ctr_read_proc = c4_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name);
SET_MODULE_OWNER(&cinfo->capi_ctrl);
retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) {
printk(KERN_ERR "c4: attach controller failed (%d).\n", i);
for (i--; i >= 0; i--) { for (i--; i >= 0; i--) {
cinfo = &card->ctrlinfo[i]; cinfo = &card->ctrlinfo[i];
detach_capi_ctr(cinfo->capi_ctrl); detach_capi_ctr(&cinfo->capi_ctrl);
} }
goto err_free_irq; goto err_free_irq;
} }
if (i == 0) if (i == 0)
card->cardnr = cinfo->capi_ctrl->cnr; card->cardnr = cinfo->capi_ctrl.cnr;
} }
printk(KERN_INFO "%s: AVM C%d at i/o %#x, irq %d, mem %#lx\n", printk(KERN_INFO "c4: AVM C%d at i/o %#x, irq %d, mem %#lx\n",
driver->name, nr_controllers, card->port, card->irq, nr_controllers, card->port, card->irq,
card->membase); card->membase);
return 0; return 0;
...@@ -1204,47 +1202,15 @@ static int c4_add_card(struct capi_driver *driver, ...@@ -1204,47 +1202,15 @@ static int c4_add_card(struct capi_driver *driver,
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver c2_driver = {
owner: THIS_MODULE,
name: "c2",
revision: "0.0",
load_firmware: c4_load_firmware,
reset_ctr: c4_reset_ctr,
register_appl: c4_register_appl,
release_appl: c4_release_appl,
send_message: c4_send_message,
procinfo: c4_procinfo,
ctr_read_proc: c4_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
};
static struct capi_driver c4_driver = {
owner: THIS_MODULE,
name: "c4",
revision: "0.0",
load_firmware: c4_load_firmware,
reset_ctr: c4_reset_ctr,
register_appl: c4_register_appl,
release_appl: c4_release_appl,
send_message: c4_send_message,
procinfo: c4_procinfo,
ctr_read_proc: c4_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
};
static int __devinit c4_probe(struct pci_dev *dev, static int __devinit c4_probe(struct pci_dev *dev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
int nr = ent->driver_data; int nr = ent->driver_data;
struct capi_driver *driver = (nr == 2) ? &c2_driver : &c4_driver;
int retval = 0; int retval = 0;
struct capicardparams param; struct capicardparams param;
if (pci_enable_device(dev) < 0) { if (pci_enable_device(dev) < 0) {
printk(KERN_ERR "%s: failed to enable AVM-C%d\n", printk(KERN_ERR "c4: failed to enable AVM-C%d\n", nr);
driver->name, nr);
return -ENODEV; return -ENODEV;
} }
pci_set_master(dev); pci_set_master(dev);
...@@ -1253,15 +1219,13 @@ static int __devinit c4_probe(struct pci_dev *dev, ...@@ -1253,15 +1219,13 @@ static int __devinit c4_probe(struct pci_dev *dev,
param.irq = dev->irq; param.irq = dev->irq;
param.membase = pci_resource_start(dev, 0); param.membase = pci_resource_start(dev, 0);
printk(KERN_INFO printk(KERN_INFO "c4: PCI BIOS reports AVM-C%d at i/o %#x, irq %d, mem %#x\n",
"%s: PCI BIOS reports AVM-C%d at i/o %#x, irq %d, mem %#x\n", nr, param.port, param.irq, param.membase);
driver->name, nr, param.port, param.irq, param.membase);
retval = c4_add_card(driver, &param, dev, nr); retval = c4_add_card(&param, dev, nr);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR printk(KERN_ERR "c4: no AVM-C%d at i/o %#x, irq %d detected, mem %#x\n",
"%s: no AVM-C%d at i/o %#x, irq %d detected, mem %#x\n", nr, param.port, param.irq, param.membase);
driver->name, nr, param.port, param.irq, param.membase);
return -ENODEV; return -ENODEV;
} }
return 0; return 0;
...@@ -1276,36 +1240,12 @@ static struct pci_driver c4_pci_driver = { ...@@ -1276,36 +1240,12 @@ static struct pci_driver c4_pci_driver = {
static int __init c4_init(void) static int __init c4_init(void)
{ {
int retval; return pci_module_init(&c4_pci_driver);
b1_set_revision(&c2_driver, revision);
attach_capi_driver(&c2_driver);
b1_set_revision(&c4_driver, revision);
attach_capi_driver(&c4_driver);
retval = pci_module_init(&c4_pci_driver);
if (retval < 0)
goto err;
printk(KERN_INFO "%s: %d C4/C2 card(s) detected\n",
c4_driver.name, retval);
retval = 0;
goto out;
err:
detach_capi_driver(&c2_driver);
detach_capi_driver(&c4_driver);
out:
return retval;
} }
static void __exit c4_exit(void) static void __exit c4_exit(void)
{ {
pci_unregister_driver(&c4_pci_driver); pci_unregister_driver(&c4_pci_driver);
detach_capi_driver(&c2_driver);
detach_capi_driver(&c4_driver);
} }
module_init(c4_init); module_init(c4_init);
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include <linux/isdn/capilli.h> #include <linux/isdn/capilli.h>
#include "avmcard.h" #include "avmcard.h"
static char *revision = "$Revision: 1.16.6.7 $";
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM T1 HEMA ISA card"); MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM T1 HEMA ISA card");
...@@ -37,8 +35,6 @@ MODULE_LICENSE("GPL"); ...@@ -37,8 +35,6 @@ MODULE_LICENSE("GPL");
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver t1isa_driver;
static int hema_irq_table[16] = static int hema_irq_table[16] =
{0, {0,
0, 0,
...@@ -132,7 +128,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -132,7 +128,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
{ {
avmcard *card = devptr; avmcard *card = devptr;
avmctrl_info *cinfo = &card->ctrlinfo[0]; avmctrl_info *cinfo = &card->ctrlinfo[0];
struct capi_ctr *ctrl = cinfo->capi_ctrl; struct capi_ctr *ctrl = &cinfo->capi_ctrl;
unsigned char b1cmd; unsigned char b1cmd;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -165,7 +161,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -165,7 +161,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
} else { } else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len);
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
break; break;
...@@ -183,7 +179,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -183,7 +179,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
CAPIMSG_NCCI(skb->data), CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data)); CAPIMSG_MSGID(skb->data));
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
break; break;
...@@ -209,11 +205,11 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -209,11 +205,11 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
case RECEIVE_START: case RECEIVE_START:
b1_put_byte(card->port, SEND_POLLACK); b1_put_byte(card->port, SEND_POLLACK);
ctrl->resume_output(ctrl); capi_ctr_resume_output(ctrl);
break; break;
case RECEIVE_STOP: case RECEIVE_STOP:
ctrl->suspend_output(ctrl); capi_ctr_suspend_output(ctrl);
break; break;
case RECEIVE_INIT: case RECEIVE_INIT:
...@@ -224,7 +220,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -224,7 +220,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
card->name, card->name,
cinfo->version[VER_CARDTYPE], cinfo->version[VER_CARDTYPE],
cinfo->version[VER_DRIVER]); cinfo->version[VER_DRIVER]);
ctrl->ready(ctrl); capi_ctr_ready(ctrl);
break; break;
case RECEIVE_TASK_READY: case RECEIVE_TASK_READY:
...@@ -323,21 +319,25 @@ void t1isa_reset_ctr(struct capi_ctr *ctrl) ...@@ -323,21 +319,25 @@ void t1isa_reset_ctr(struct capi_ctr *ctrl)
memset(cinfo->version, 0, sizeof(cinfo->version)); memset(cinfo->version, 0, sizeof(cinfo->version));
capilib_release(&cinfo->ncci_head); capilib_release(&cinfo->ncci_head);
ctrl->reseted(ctrl); capi_ctr_reseted(ctrl);
} }
static void t1isa_remove(struct pci_dev *pdev) static void t1isa_remove(struct pci_dev *pdev)
{ {
avmctrl_info *cinfo = pci_get_drvdata(pdev); avmctrl_info *cinfo = pci_get_drvdata(pdev);
avmcard *card = cinfo->card; avmcard *card;
unsigned int port = card->port;
if (!cinfo)
return;
t1_disable_irq(port); card = cinfo->card;
b1_reset(port);
b1_reset(port);
t1_reset(port);
detach_capi_ctr(cinfo->capi_ctrl); t1_disable_irq(card->port);
b1_reset(card->port);
b1_reset(card->port);
t1_reset(card->port);
detach_capi_ctr(&cinfo->capi_ctrl);
free_irq(card->irq, card); free_irq(card->irq, card);
release_region(card->port, AVMB1_PORTLEN); release_region(card->port, AVMB1_PORTLEN);
b1_free_card(card); b1_free_card(card);
...@@ -345,6 +345,9 @@ static void t1isa_remove(struct pci_dev *pdev) ...@@ -345,6 +345,9 @@ static void t1isa_remove(struct pci_dev *pdev)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static u16 t1isa_send_message(struct capi_ctr *ctrl, struct sk_buff *skb);
static char *t1isa_procinfo(struct capi_ctr *ctrl);
static int __init t1isa_probe(struct pci_dev *pdev, int cardnr) static int __init t1isa_probe(struct pci_dev *pdev, int cardnr)
{ {
avmctrl_info *cinfo; avmctrl_info *cinfo;
...@@ -353,7 +356,7 @@ static int __init t1isa_probe(struct pci_dev *pdev, int cardnr) ...@@ -353,7 +356,7 @@ static int __init t1isa_probe(struct pci_dev *pdev, int cardnr)
card = b1_alloc_card(1); card = b1_alloc_card(1);
if (!card) { if (!card) {
printk(KERN_WARNING "%s: no memory.\n", t1isa_driver.name); printk(KERN_WARNING "t1isa: no memory.\n");
retval = -ENOMEM; retval = -ENOMEM;
goto err; goto err;
} }
...@@ -366,50 +369,57 @@ static int __init t1isa_probe(struct pci_dev *pdev, int cardnr) ...@@ -366,50 +369,57 @@ static int __init t1isa_probe(struct pci_dev *pdev, int cardnr)
sprintf(card->name, "t1isa-%x", card->port); sprintf(card->name, "t1isa-%x", card->port);
if (!(((card->port & 0x7) == 0) && ((card->port & 0x30) != 0x30))) { if (!(((card->port & 0x7) == 0) && ((card->port & 0x30) != 0x30))) {
printk(KERN_WARNING "%s: illegal port 0x%x.\n", printk(KERN_WARNING "t1isa: illegal port 0x%x.\n", card->port);
t1isa_driver.name, card->port);
retval = -EINVAL; retval = -EINVAL;
goto err_free; goto err_free;
} }
if (hema_irq_table[card->irq & 0xf] == 0) { if (hema_irq_table[card->irq & 0xf] == 0) {
printk(KERN_WARNING "%s: irq %d not valid.\n", printk(KERN_WARNING "t1isa: irq %d not valid.\n", card->irq);
t1isa_driver.name, card->irq);
retval = -EINVAL; retval = -EINVAL;
goto err_free; goto err_free;
} }
if (!request_region(card->port, AVMB1_PORTLEN, card->name)) { if (!request_region(card->port, AVMB1_PORTLEN, card->name)) {
printk(KERN_INFO "%s: ports 0x%03x-0x%03x in use.\n", printk(KERN_INFO "t1isa: ports 0x%03x-0x%03x in use.\n",
t1isa_driver.name, card->port, card->port + AVMB1_PORTLEN); card->port, card->port + AVMB1_PORTLEN);
retval = -EBUSY; retval = -EBUSY;
goto err_free; goto err_free;
} }
retval = request_irq(card->irq, t1isa_interrupt, 0, card->name, card); retval = request_irq(card->irq, t1isa_interrupt, 0, card->name, card);
if (retval) { if (retval) {
printk(KERN_INFO "%s: unable to get IRQ %d.\n", printk(KERN_INFO "t1isa: unable to get IRQ %d.\n", card->irq);
t1isa_driver.name, card->irq);
retval = -EBUSY; retval = -EBUSY;
goto err_release_region; goto err_release_region;
} }
if ((retval = t1_detectandinit(card->port, card->irq, card->cardnr)) != 0) { if ((retval = t1_detectandinit(card->port, card->irq, card->cardnr)) != 0) {
printk(KERN_INFO "%s: NO card at 0x%x (%d)\n", printk(KERN_INFO "t1isa: NO card at 0x%x (%d)\n",
t1isa_driver.name, card->port, retval); card->port, retval);
retval = -ENODEV; retval = -ENODEV;
goto err_free_irq; goto err_free_irq;
} }
t1_disable_irq(card->port); t1_disable_irq(card->port);
b1_reset(card->port); b1_reset(card->port);
cinfo->capi_ctrl = attach_capi_ctr(&t1isa_driver, card->name, cinfo); cinfo->capi_ctrl.driver_name = "t1isa";
if (!cinfo->capi_ctrl) { cinfo->capi_ctrl.driverdata = cinfo;
printk(KERN_INFO "%s: attach controller failed.\n", cinfo->capi_ctrl.register_appl = b1_register_appl;
t1isa_driver.name); cinfo->capi_ctrl.release_appl = b1_release_appl;
retval = -EBUSY; cinfo->capi_ctrl.send_message = t1isa_send_message;
cinfo->capi_ctrl.load_firmware = t1isa_load_firmware;
cinfo->capi_ctrl.reset_ctr = t1isa_reset_ctr;
cinfo->capi_ctrl.procinfo = t1isa_procinfo;
cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name);
SET_MODULE_OWNER(&cinfo->capi_ctrl);
retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) {
printk(KERN_INFO "t1isa: attach controller failed.\n");
goto err_free_irq; goto err_free_irq;
} }
printk(KERN_INFO "%s: AVM T1 ISA at i/o %#x, irq %d, card %d\n", printk(KERN_INFO "t1isa: AVM T1 ISA at i/o %#x, irq %d, card %d\n",
t1isa_driver.name, card->port, card->irq, card->cardnr); card->port, card->irq, card->cardnr);
pci_set_drvdata(pdev, cinfo); pci_set_drvdata(pdev, cinfo);
return 0; return 0;
...@@ -485,21 +495,6 @@ static char *t1isa_procinfo(struct capi_ctr *ctrl) ...@@ -485,21 +495,6 @@ static char *t1isa_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver t1isa_driver = {
owner: THIS_MODULE,
name: "t1isa",
revision: "0.0",
load_firmware: t1isa_load_firmware,
reset_ctr: t1isa_reset_ctr,
register_appl: b1_register_appl,
release_appl: b1_release_appl,
send_message: t1isa_send_message,
procinfo: t1isa_procinfo,
ctr_read_proc: b1ctl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
};
#define MAX_CARDS 4 #define MAX_CARDS 4
static struct pci_dev isa_dev[MAX_CARDS]; static struct pci_dev isa_dev[MAX_CARDS];
static int io[MAX_CARDS]; static int io[MAX_CARDS];
...@@ -515,12 +510,9 @@ MODULE_PARM_DESC(cardnr, "Card number(s) (as jumpered)"); ...@@ -515,12 +510,9 @@ MODULE_PARM_DESC(cardnr, "Card number(s) (as jumpered)");
static int __init t1isa_init(void) static int __init t1isa_init(void)
{ {
int i, retval; int i;
int found = 0; int found = 0;
b1_set_revision(&t1isa_driver, revision);
attach_capi_driver(&t1isa_driver);
for (i = 0; i < MAX_CARDS; i++) { for (i = 0; i < MAX_CARDS; i++) {
if (!io[i]) if (!io[i])
break; break;
...@@ -531,17 +523,10 @@ static int __init t1isa_init(void) ...@@ -531,17 +523,10 @@ static int __init t1isa_init(void)
if (t1isa_probe(&isa_dev[i], cardnr[i]) == 0) if (t1isa_probe(&isa_dev[i], cardnr[i]) == 0)
found++; found++;
} }
if (found == 0) { if (found == 0)
retval = -ENODEV; return -ENODEV;
goto err;
}
retval = 0;
goto out;
err: return 0;
detach_capi_driver(&t1isa_driver);
out:
return retval;
} }
static void __exit t1isa_exit(void) static void __exit t1isa_exit(void)
...@@ -554,7 +539,6 @@ static void __exit t1isa_exit(void) ...@@ -554,7 +539,6 @@ static void __exit t1isa_exit(void)
t1isa_remove(&isa_dev[i]); t1isa_remove(&isa_dev[i]);
} }
detach_capi_driver(&t1isa_driver);
} }
module_init(t1isa_init); module_init(t1isa_init);
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <linux/isdn/capilli.h> #include <linux/isdn/capilli.h>
#include "avmcard.h" #include "avmcard.h"
static char *revision = "$Revision: 1.1.4.1.2.1 $";
#undef CONFIG_T1PCI_DEBUG #undef CONFIG_T1PCI_DEBUG
#undef CONFIG_T1PCI_POLLDEBUG #undef CONFIG_T1PCI_POLLDEBUG
...@@ -45,9 +43,9 @@ MODULE_LICENSE("GPL"); ...@@ -45,9 +43,9 @@ MODULE_LICENSE("GPL");
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static int t1pci_add_card(struct capi_driver *driver, static char *t1pci_procinfo(struct capi_ctr *ctrl);
struct capicardparams *p,
struct pci_dev *pdev) static int t1pci_add_card(struct capicardparams *p, struct pci_dev *pdev)
{ {
avmcard *card; avmcard *card;
avmctrl_info *cinfo; avmctrl_info *cinfo;
...@@ -55,14 +53,14 @@ static int t1pci_add_card(struct capi_driver *driver, ...@@ -55,14 +53,14 @@ static int t1pci_add_card(struct capi_driver *driver,
card = b1_alloc_card(1); card = b1_alloc_card(1);
if (!card) { if (!card) {
printk(KERN_WARNING "%s: no memory.\n", driver->name); printk(KERN_WARNING "t1pci: no memory.\n");
retval = -ENOMEM; retval = -ENOMEM;
goto err; goto err;
} }
card->dma = avmcard_dma_alloc(driver->name, pdev, 2048+128, 2048+128); card->dma = avmcard_dma_alloc("t1pci", pdev, 2048+128, 2048+128);
if (!card->dma) { if (!card->dma) {
printk(KERN_WARNING "%s: no memory.\n", driver->name); printk(KERN_WARNING "t1pci: no memory.\n");
retval = -ENOMEM; retval = -ENOMEM;
goto err_free; goto err_free;
} }
...@@ -75,17 +73,16 @@ static int t1pci_add_card(struct capi_driver *driver, ...@@ -75,17 +73,16 @@ static int t1pci_add_card(struct capi_driver *driver,
card->cardtype = avm_t1pci; card->cardtype = avm_t1pci;
if (!request_region(card->port, AVMB1_PORTLEN, card->name)) { if (!request_region(card->port, AVMB1_PORTLEN, card->name)) {
printk(KERN_WARNING printk(KERN_WARNING "t1pci: ports 0x%03x-0x%03x in use.\n",
"%s: ports 0x%03x-0x%03x in use.\n", card->port, card->port + AVMB1_PORTLEN);
driver->name, card->port, card->port + AVMB1_PORTLEN);
retval = -EBUSY; retval = -EBUSY;
goto err_free_dma; goto err_free_dma;
} }
card->mbase = ioremap_nocache(card->membase, 64); card->mbase = ioremap_nocache(card->membase, 64);
if (!card->mbase) { if (!card->mbase) {
printk(KERN_NOTICE "%s: can't remap memory at 0x%lx\n", printk(KERN_NOTICE "t1pci: can't remap memory at 0x%lx\n",
driver->name, card->membase); card->membase);
retval = -EIO; retval = -EIO;
goto err_release_region; goto err_release_region;
} }
...@@ -95,11 +92,11 @@ static int t1pci_add_card(struct capi_driver *driver, ...@@ -95,11 +92,11 @@ static int t1pci_add_card(struct capi_driver *driver,
retval = t1pci_detect(card); retval = t1pci_detect(card);
if (retval != 0) { if (retval != 0) {
if (retval < 6) if (retval < 6)
printk(KERN_NOTICE "%s: NO card at 0x%x (%d)\n", printk(KERN_NOTICE "t1pci: NO card at 0x%x (%d)\n",
driver->name, card->port, retval); card->port, retval);
else else
printk(KERN_NOTICE "%s: card at 0x%x, but cabel not connected or T1 has no power (%d)\n", printk(KERN_NOTICE "t1pci: card at 0x%x, but cable not connected or T1 has no power (%d)\n",
driver->name, card->port, retval); card->port, retval);
retval = -EIO; retval = -EIO;
goto err_unmap; goto err_unmap;
} }
...@@ -107,23 +104,33 @@ static int t1pci_add_card(struct capi_driver *driver, ...@@ -107,23 +104,33 @@ static int t1pci_add_card(struct capi_driver *driver,
retval = request_irq(card->irq, b1dma_interrupt, SA_SHIRQ, card->name, card); retval = request_irq(card->irq, b1dma_interrupt, SA_SHIRQ, card->name, card);
if (retval) { if (retval) {
printk(KERN_ERR "%s: unable to get IRQ %d.\n", printk(KERN_ERR "t1pci: unable to get IRQ %d.\n", card->irq);
driver->name, card->irq);
retval = -EBUSY; retval = -EBUSY;
goto err_unmap; goto err_unmap;
} }
cinfo->capi_ctrl = attach_capi_ctr(driver, card->name, cinfo); cinfo->capi_ctrl.driver_name = "t1pci";
if (!cinfo->capi_ctrl) { cinfo->capi_ctrl.driverdata = cinfo;
printk(KERN_ERR "%s: attach controller failed.\n", driver->name); cinfo->capi_ctrl.register_appl = b1dma_register_appl;
cinfo->capi_ctrl.release_appl = b1dma_release_appl;
cinfo->capi_ctrl.send_message = b1dma_send_message;
cinfo->capi_ctrl.load_firmware = b1dma_load_firmware;
cinfo->capi_ctrl.reset_ctr = b1dma_reset_ctr;
cinfo->capi_ctrl.procinfo = t1pci_procinfo;
cinfo->capi_ctrl.ctr_read_proc = b1dmactl_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name);
SET_MODULE_OWNER(&cinfo->capi_ctrl);
retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) {
printk(KERN_ERR "t1pci: attach controller failed.\n");
retval = -EBUSY; retval = -EBUSY;
goto err_free_irq; goto err_free_irq;
} }
card->cardnr = cinfo->capi_ctrl->cnr; card->cardnr = cinfo->capi_ctrl.cnr;
printk(KERN_INFO printk(KERN_INFO "t1pci: AVM T1 PCI at i/o %#x, irq %d, mem %#lx\n",
"%s: AVM T1 PCI at i/o %#x, irq %d, mem %#lx\n", card->port, card->irq, card->membase);
driver->name, card->port, card->irq, card->membase);
pci_set_drvdata(pdev, card); pci_set_drvdata(pdev, card);
return 0; return 0;
...@@ -151,7 +158,7 @@ static void t1pci_remove(struct pci_dev *pdev) ...@@ -151,7 +158,7 @@ static void t1pci_remove(struct pci_dev *pdev)
b1dma_reset(card); b1dma_reset(card);
detach_capi_ctr(cinfo->capi_ctrl); detach_capi_ctr(&cinfo->capi_ctrl);
free_irq(card->irq, card); free_irq(card->irq, card);
iounmap(card->mbase); iounmap(card->mbase);
release_region(card->port, AVMB1_PORTLEN); release_region(card->port, AVMB1_PORTLEN);
...@@ -179,33 +186,14 @@ static char *t1pci_procinfo(struct capi_ctr *ctrl) ...@@ -179,33 +186,14 @@ static char *t1pci_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver t1pci_driver = {
owner: THIS_MODULE,
name: "t1pci",
revision: "0.0",
load_firmware: b1dma_load_firmware,
reset_ctr: b1dma_reset_ctr,
register_appl: b1dma_register_appl,
release_appl: b1dma_release_appl,
send_message: b1dma_send_message,
procinfo: t1pci_procinfo,
ctr_read_proc: b1dmactl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
};
/* ------------------------------------------------------------- */
static int __devinit t1pci_probe(struct pci_dev *dev, static int __devinit t1pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
struct capi_driver *driver = &t1pci_driver;
struct capicardparams param; struct capicardparams param;
int retval; int retval;
if (pci_enable_device(dev) < 0) { if (pci_enable_device(dev) < 0) {
printk(KERN_ERR "%s: failed to enable AVM-T1-PCI\n", printk(KERN_ERR "t1pci: failed to enable AVM-T1-PCI\n");
driver->name);
return -ENODEV; return -ENODEV;
} }
pci_set_master(dev); pci_set_master(dev);
...@@ -214,15 +202,13 @@ static int __devinit t1pci_probe(struct pci_dev *dev, ...@@ -214,15 +202,13 @@ static int __devinit t1pci_probe(struct pci_dev *dev,
param.irq = dev->irq; param.irq = dev->irq;
param.membase = pci_resource_start(dev, 0); param.membase = pci_resource_start(dev, 0);
printk(KERN_INFO printk(KERN_INFO "t1pci: PCI BIOS reports AVM-T1-PCI at i/o %#x, irq %d, mem %#x\n",
"%s: PCI BIOS reports AVM-T1-PCI at i/o %#x, irq %d, mem %#x\n", param.port, param.irq, param.membase);
driver->name, param.port, param.irq, param.membase);
retval = t1pci_add_card(driver, &param, dev); retval = t1pci_add_card(&param, dev);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR printk(KERN_ERR "t1pci: no AVM-T1-PCI at i/o %#x, irq %d detected, mem %#x\n",
"%s: no AVM-T1-PCI at i/o %#x, irq %d detected, mem %#x\n", param.port, param.irq, param.membase);
driver->name, param.port, param.irq, param.membase);
return -ENODEV; return -ENODEV;
} }
return 0; return 0;
...@@ -237,30 +223,12 @@ static struct pci_driver t1pci_pci_driver = { ...@@ -237,30 +223,12 @@ static struct pci_driver t1pci_pci_driver = {
static int __init t1pci_init(void) static int __init t1pci_init(void)
{ {
int retval; return pci_module_init(&t1pci_pci_driver);
b1_set_revision(&t1pci_driver, revision);
attach_capi_driver(&t1pci_driver);
retval = pci_register_driver(&t1pci_pci_driver);
if (retval < 0)
goto err;
printk(KERN_INFO "%s: %d T1-PCI card(s) detected\n",
t1pci_driver.name, retval);
retval = 0;
goto out;
err:
detach_capi_driver(&t1pci_driver);
out:
return retval;
} }
static void __exit t1pci_exit(void) static void __exit t1pci_exit(void)
{ {
pci_unregister_driver(&t1pci_pci_driver); pci_unregister_driver(&t1pci_pci_driver);
detach_capi_driver(&t1pci_driver);
} }
module_init(t1pci_init); module_init(t1pci_init);
......
...@@ -53,8 +53,6 @@ static inline int _hycapi_appCheck(int app_id, int ctrl_no) ...@@ -53,8 +53,6 @@ static inline int _hycapi_appCheck(int app_id, int ctrl_no)
return ((hycapi_applications[app_id-1].ctrl_mask & (1 << (ctrl_no-1))) != 0); return ((hycapi_applications[app_id-1].ctrl_mask & (1 << (ctrl_no-1))) != 0);
} }
struct capi_driver_interface *hy_di = NULL;
/****************************** /******************************
Kernel-Capi callback reset_ctr Kernel-Capi callback reset_ctr
******************************/ ******************************/
...@@ -68,7 +66,7 @@ hycapi_reset_ctr(struct capi_ctr *ctrl) ...@@ -68,7 +66,7 @@ hycapi_reset_ctr(struct capi_ctr *ctrl)
printk(KERN_NOTICE "HYCAPI hycapi_reset_ctr\n"); printk(KERN_NOTICE "HYCAPI hycapi_reset_ctr\n");
#endif #endif
capilib_release(&cinfo->ncci_head); capilib_release(&cinfo->ncci_head);
ctrl->reseted(ctrl); capi_ctr_reseted(ctrl);
} }
/****************************** /******************************
...@@ -94,7 +92,7 @@ hycapi_remove_ctr(struct capi_ctr *ctrl) ...@@ -94,7 +92,7 @@ hycapi_remove_ctr(struct capi_ctr *ctrl)
return; return;
} }
card = cinfo->card; card = cinfo->card;
ctrl->suspend_output(ctrl); capi_ctr_suspend_output(ctrl);
for(i=0; i<CAPI_MAXAPPL;i++) { for(i=0; i<CAPI_MAXAPPL;i++) {
if(hycapi_applications[i].listen_req[ctrl->cnr-1]) { if(hycapi_applications[i].listen_req[ctrl->cnr-1]) {
kfree_skb(hycapi_applications[i].listen_req[ctrl->cnr-1]); kfree_skb(hycapi_applications[i].listen_req[ctrl->cnr-1]);
...@@ -133,7 +131,7 @@ hycapi_sendmsg_internal(struct capi_ctr *ctrl, struct sk_buff *skb) ...@@ -133,7 +131,7 @@ hycapi_sendmsg_internal(struct capi_ctr *ctrl, struct sk_buff *skb)
/* inform upper layers we're full */ /* inform upper layers we're full */
printk(KERN_ERR "HYSDN Card%d: CAPI-buffer overrun!\n", printk(KERN_ERR "HYSDN Card%d: CAPI-buffer overrun!\n",
card->myid); card->myid);
ctrl->suspend_output(ctrl); capi_ctr_suspend_output(ctrl);
} }
cinfo->tx_skb = skb; cinfo->tx_skb = skb;
spin_unlock_irq(&cinfo->lock); spin_unlock_irq(&cinfo->lock);
...@@ -334,7 +332,7 @@ int hycapi_capi_release(hysdn_card *card) ...@@ -334,7 +332,7 @@ int hycapi_capi_release(hysdn_card *card)
printk(KERN_NOTICE "hycapi_capi_release\n"); printk(KERN_NOTICE "hycapi_capi_release\n");
#endif #endif
if(cinfo) { if(cinfo) {
ctrl = cinfo->capi_ctrl; ctrl = &cinfo->capi_ctrl;
hycapi_remove_ctr(ctrl); hycapi_remove_ctr(ctrl);
} }
return 0; return 0;
...@@ -354,14 +352,9 @@ int hycapi_capi_stop(hysdn_card *card) ...@@ -354,14 +352,9 @@ int hycapi_capi_stop(hysdn_card *card)
printk(KERN_NOTICE "hycapi_capi_stop\n"); printk(KERN_NOTICE "hycapi_capi_stop\n");
#endif #endif
if(cinfo) { if(cinfo) {
if(cinfo->capi_ctrl) { ctrl = &cinfo->capi_ctrl;
ctrl = cinfo->capi_ctrl; /* ctrl->suspend_output(ctrl); */
/* ctrl->suspend_output(ctrl); */ capi_ctr_reseted(ctrl);
ctrl->reseted(ctrl);
} else {
printk(KERN_NOTICE "hycapi_capi_stop: cinfo but no capi_ctrl\n");
}
} }
return 0; return 0;
} }
...@@ -552,11 +545,7 @@ hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len) ...@@ -552,11 +545,7 @@ hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len)
if(!cinfo) { if(!cinfo) {
return; return;
} }
ctrl = cinfo->capi_ctrl; ctrl = &cinfo->capi_ctrl;
if(!ctrl)
{
return;
}
if(len < CAPI_MSG_BASELEN) { if(len < CAPI_MSG_BASELEN) {
printk(KERN_ERR "HYSDN Card%d: invalid CAPI-message, lenght %d!\n", printk(KERN_ERR "HYSDN Card%d: invalid CAPI-message, lenght %d!\n",
card->myid, len); card->myid, len);
...@@ -635,7 +624,7 @@ hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len) ...@@ -635,7 +624,7 @@ hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len)
default: default:
break; break;
} }
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
/****************************************************************** /******************************************************************
...@@ -662,7 +651,7 @@ void hycapi_tx_capiack(hysdn_card * card) ...@@ -662,7 +651,7 @@ void hycapi_tx_capiack(hysdn_card * card)
cinfo->out_idx = 0; /* wrap around */ cinfo->out_idx = 0; /* wrap around */
if (cinfo->sk_count-- == HYSDN_MAX_CAPI_SKB) /* dec usage count */ if (cinfo->sk_count-- == HYSDN_MAX_CAPI_SKB) /* dec usage count */
cinfo->capi_ctrl->resume_output(cinfo->capi_ctrl); capi_ctr_resume_output(&cinfo->capi_ctrl);
spin_unlock_irq(&cinfo->lock); spin_unlock_irq(&cinfo->lock);
} }
...@@ -687,22 +676,6 @@ hycapi_tx_capiget(hysdn_card *card) ...@@ -687,22 +676,6 @@ hycapi_tx_capiget(hysdn_card *card)
} }
static struct capi_driver hycapi_driver = {
owner: THIS_MODULE,
name: "hysdn",
revision: "0.0",
load_firmware: hycapi_load_firmware,
reset_ctr: hycapi_reset_ctr,
register_appl: hycapi_register_appl,
release_appl: hycapi_release_appl,
send_message: hycapi_send_message,
procinfo: hycapi_procinfo,
ctr_read_proc: hycapi_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
};
/********************************************************** /**********************************************************
int hycapi_init() int hycapi_init()
...@@ -712,16 +685,11 @@ attach the capi-driver to the kernel-capi. ...@@ -712,16 +685,11 @@ attach the capi-driver to the kernel-capi.
int hycapi_init() int hycapi_init()
{ {
struct capi_driver *driver;
int i; int i;
if(hy_di) { if(hy_di) {
printk(KERN_NOTICE "HyDI allready set\n"); printk(KERN_NOTICE "HyDI allready set\n");
return 0; return 0;
} }
driver = &hycapi_driver;
printk(KERN_NOTICE "HYSDN: Attaching capi-driver\n");
attach_capi_driver(driver);
for(i=0;i<CAPI_MAXAPPL;i++) { for(i=0;i<CAPI_MAXAPPL;i++) {
memset(&(hycapi_applications[i]), 0, sizeof(hycapi_appl)); memset(&(hycapi_applications[i]), 0, sizeof(hycapi_appl));
} }
...@@ -738,16 +706,6 @@ free some more ressources. Do that later. ...@@ -738,16 +706,6 @@ free some more ressources. Do that later.
void void
hycapi_cleanup(void) hycapi_cleanup(void)
{ {
struct capi_driver *driver;
driver = &hycapi_driver;
if (!hy_di) {
printk(KERN_ERR "HYSDN: no capi-driver to detach (?)\n");
return;
}
printk(KERN_NOTICE "HYSDN: Detaching capi-driver\n");
detach_capi_driver(driver);
hy_di = 0;
return;
} }
/******************************************************************** /********************************************************************
...@@ -762,8 +720,7 @@ static void hycapi_fill_profile(hysdn_card *card) ...@@ -762,8 +720,7 @@ static void hycapi_fill_profile(hysdn_card *card)
struct capi_ctr *ctrl = NULL; struct capi_ctr *ctrl = NULL;
cinfo = card->hyctrlinfo; cinfo = card->hyctrlinfo;
if(!cinfo) return; if(!cinfo) return;
ctrl = cinfo->capi_ctrl; ctrl = &cinfo->capi_ctrl;
if(!ctrl) return;
strcpy(ctrl->manu, "Hypercope"); strcpy(ctrl->manu, "Hypercope");
ctrl->version.majorversion = 2; ctrl->version.majorversion = 2;
ctrl->version.minorversion = 0; ctrl->version.minorversion = 0;
...@@ -791,6 +748,7 @@ hycapi_capi_create(hysdn_card *card) ...@@ -791,6 +748,7 @@ hycapi_capi_create(hysdn_card *card)
{ {
hycapictrl_info *cinfo = NULL; hycapictrl_info *cinfo = NULL;
struct capi_ctr *ctrl = NULL; struct capi_ctr *ctrl = NULL;
int retval;
#ifdef HYCAPI_PRINTFNAMES #ifdef HYCAPI_PRINTFNAMES
printk(KERN_NOTICE "hycapi_capi_create\n"); printk(KERN_NOTICE "hycapi_capi_create\n");
#endif #endif
...@@ -818,28 +776,34 @@ hycapi_capi_create(hysdn_card *card) ...@@ -818,28 +776,34 @@ hycapi_capi_create(hysdn_card *card)
default: strcpy(cinfo->cardname,"HYSDN ???"); break; default: strcpy(cinfo->cardname,"HYSDN ???"); break;
} }
cinfo->capi_ctrl = attach_capi_ctr(&hycapi_driver, ctrl = &cinfo->capi_ctrl;
cinfo->cardname, cinfo); ctrl->driver_name = "hycapi";
ctrl = cinfo->capi_ctrl; ctrl->driverdata = cinfo;
if (!ctrl) { ctrl->register_appl = hycapi_register_appl;
printk(KERN_ERR "%s: attach controller failed.\n", ctrl->release_appl = hycapi_release_appl;
hycapi_driver.name); ctrl->send_message = hycapi_send_message;
ctrl->load_firmware = hycapi_load_firmware;
ctrl->reset_ctr = hycapi_reset_ctr;
ctrl->procinfo = hycapi_procinfo;
ctrl->ctr_read_proc = hycapi_read_proc;
strcpy(ctrl->name, cinfo->cardname);
SET_MODULE_OWNER(ctrl);
retval = attach_capi_ctr(ctrl);
if (retval) {
printk(KERN_ERR "hycapi: attach controller failed.\n");
return -EBUSY; return -EBUSY;
} }
/* fill in the blanks: */ /* fill in the blanks: */
hycapi_fill_profile(card); hycapi_fill_profile(card);
ctrl->ready(ctrl); capi_ctr_ready(ctrl);
} else { } else {
/* resume output on stopped ctrl */ /* resume output on stopped ctrl */
ctrl = card->hyctrlinfo->capi_ctrl; ctrl = &card->hyctrlinfo->capi_ctrl;
if(ctrl) { hycapi_fill_profile(card);
hycapi_fill_profile(card); capi_ctr_ready(ctrl);
ctrl->ready(ctrl); hycapi_restart_internal(ctrl);
hycapi_restart_internal(ctrl); /* ctrl->resume_output(ctrl); */
/* ctrl->resume_output(ctrl); */
} else {
printk(KERN_WARNING "HYSDN: No ctrl???? How come?\n");
}
} }
return 0; return 0;
} }
...@@ -208,7 +208,7 @@ typedef struct HYSDN_CARD { ...@@ -208,7 +208,7 @@ typedef struct HYSDN_CARD {
char infobuf[128]; /* for function procinfo */ char infobuf[128]; /* for function procinfo */
struct HYSDN_CARD *card; struct HYSDN_CARD *card;
struct capi_ctr *capi_ctrl; struct capi_ctr capi_ctrl;
struct sk_buff *skbs[HYSDN_MAX_CAPI_SKB]; struct sk_buff *skbs[HYSDN_MAX_CAPI_SKB];
int in_idx, out_idx; /* indexes to buffer ring */ int in_idx, out_idx; /* indexes to buffer ring */
int sk_count; /* number of buffers currently in ring */ int sk_count; /* number of buffers currently in ring */
......
...@@ -36,32 +36,28 @@ typedef struct capicardparams { ...@@ -36,32 +36,28 @@ typedef struct capicardparams {
unsigned int membase; unsigned int membase;
} capicardparams; } capicardparams;
struct capi_driver;
struct capi_ctr { struct capi_ctr {
struct list_head driver_list; /* contrs by driver */ /* filled in before calling attach_capi_ctr */
struct capi_driver *driver; struct module *owner;
int cnr; /* controller number */
char name[32]; /* name of controller */
volatile unsigned short cardstate; /* controller state */
volatile int blocked; /* output blocked */
int traceflag; /* capi trace */
void *driverdata; /* driver specific */ void *driverdata; /* driver specific */
char name[32]; /* name of controller */
char *driver_name; /* name of driver */
int (*load_firmware)(struct capi_ctr *, capiloaddata *);
void (*reset_ctr)(struct capi_ctr *);
void (*register_appl)(struct capi_ctr *, u16 appl,
capi_register_params *);
void (*release_appl)(struct capi_ctr *, u16 appl);
u16 (*send_message)(struct capi_ctr *, struct sk_buff *skb);
char *(*procinfo)(struct capi_ctr *);
int (*ctr_read_proc)(char *page, char **start, off_t off,
int count, int *eof, struct capi_ctr *card);
/* filled before calling ready callback */ /* filled in before calling ready callback */
__u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */ u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */
capi_version version; /* CAPI_GET_VERSION */ capi_version version; /* CAPI_GET_VERSION */
capi_profile profile; /* CAPI_GET_PROFILE */ capi_profile profile; /* CAPI_GET_PROFILE */
__u8 serial[CAPI_SERIAL_LEN]; /* CAPI_GET_SERIAL */ u8 serial[CAPI_SERIAL_LEN]; /* CAPI_GET_SERIAL */
/* functions */
void (*ready)(struct capi_ctr * card);
void (*reseted)(struct capi_ctr * card);
void (*suspend_output)(struct capi_ctr * card);
void (*resume_output)(struct capi_ctr * card);
void (*handle_capimsg)(struct capi_ctr * card,
__u16 appl, struct sk_buff *skb);
/* management information for kcapi */ /* management information for kcapi */
...@@ -70,42 +66,23 @@ struct capi_ctr { ...@@ -70,42 +66,23 @@ struct capi_ctr {
unsigned long nsentctlpkt; unsigned long nsentctlpkt;
unsigned long nsentdatapkt; unsigned long nsentdatapkt;
struct proc_dir_entry *procent; int cnr; /* controller number */
char procfn[128]; volatile unsigned short cardstate; /* controller state */
}; volatile int blocked; /* output blocked */
int traceflag; /* capi trace */
struct capi_driver {
struct module *owner;
char name[32]; /* driver name */
char revision[32];
int (*load_firmware)(struct capi_ctr *, capiloaddata *);
void (*reset_ctr)(struct capi_ctr *);
void (*register_appl)(struct capi_ctr *, __u16 appl,
capi_register_params *);
void (*release_appl)(struct capi_ctr *, __u16 appl);
u16 (*send_message)(struct capi_ctr *, struct sk_buff *skb);
char *(*procinfo)(struct capi_ctr *);
int (*ctr_read_proc)(char *page, char **start, off_t off,
int count, int *eof, struct capi_ctr *card);
int (*driver_read_proc)(char *page, char **start, off_t off,
int count, int *eof, struct capi_driver *driver);
/* intitialized by kcapi */
struct list_head contr_head; /* list of controllers */
struct list_head driver_list;
int ncontroller;
struct proc_dir_entry *procent; struct proc_dir_entry *procent;
char procfn[128]; char procfn[128];
}; };
void attach_capi_driver(struct capi_driver *driver); int attach_capi_ctr(struct capi_ctr *);
void detach_capi_driver(struct capi_driver *driver);
struct capi_ctr *attach_capi_ctr(struct capi_driver *driver, char *name, void *data);
int detach_capi_ctr(struct capi_ctr *); int detach_capi_ctr(struct capi_ctr *);
void capi_ctr_ready(struct capi_ctr * card);
void capi_ctr_reseted(struct capi_ctr * card);
void capi_ctr_suspend_output(struct capi_ctr * card);
void capi_ctr_resume_output(struct capi_ctr * card);
void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// library functions for use by hardware controller drivers // library functions for use by hardware controller drivers
......
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