Commit dd7728a8 authored by Kai Germaschewski's avatar Kai Germaschewski

Merge tp1.ruhr-uni-bochum.de:/home/kai/kernel/v2.5/linux-2.5

into tp1.ruhr-uni-bochum.de:/home/kai/kernel/v2.5/linux-2.5.isdn
parents fa82a1da 97b75e58
......@@ -84,7 +84,7 @@ struct capiminor {
struct capincci *nccip;
unsigned int minor;
u16 applid;
struct capi20_appl *ap;
u32 ncci;
u16 datahandle;
u16 msgid;
......@@ -121,26 +121,18 @@ struct capincci {
struct capidev {
struct list_head list;
u16 applid;
struct capi20_appl ap;
u16 errcode;
unsigned userflags;
struct sk_buff_head recvqueue;
wait_queue_head_t recvwait;
/* Statistic */
unsigned long nrecvctlpkt;
unsigned long nrecvdatapkt;
unsigned long nsentctlpkt;
unsigned long nsentdatapkt;
struct capincci *nccis;
};
/* -------- global variables ---------------------------------------- */
static struct capi_interface *capifuncs;
static rwlock_t capidev_list_lock = RW_LOCK_UNLOCKED;
static LIST_HEAD(capidev_list);
......@@ -209,7 +201,7 @@ static void capiminor_del_all_ack(struct capiminor *mp)
/* -------- struct capiminor ---------------------------------------- */
static struct capiminor *capiminor_alloc(u16 applid, u32 ncci)
static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci)
{
struct capiminor *mp, *p;
struct list_head *l;
......@@ -227,7 +219,7 @@ static struct capiminor *capiminor_alloc(u16 applid, u32 ncci)
printk(KERN_DEBUG "capiminor_alloc %d\n", GET_USE_COUNT(THIS_MODULE));
#endif
memset(mp, 0, sizeof(struct capiminor));
mp->applid = applid;
mp->ap = ap;
mp->ncci = ncci;
mp->msgid = 0;
atomic_set(&mp->ttyopencount,0);
......@@ -311,7 +303,7 @@ static struct capincci *capincci_alloc(struct capidev *cdev, u32 ncci)
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
mp = 0;
if (cdev->userflags & CAPIFLAG_HIGHJACKING)
mp = np->minorp = capiminor_alloc(cdev->applid, ncci);
mp = np->minorp = capiminor_alloc(&cdev->ap, ncci);
if (mp) {
mp->nccip = np;
#ifdef _DEBUG_REFCOUNT
......@@ -401,10 +393,10 @@ static void capidev_free(struct capidev *cdev)
{
unsigned long flags;
if (cdev->applid)
(*capifuncs->capi_release) (cdev->applid);
cdev->applid = 0;
if (cdev->ap.applid) {
capi20_release(&cdev->ap);
cdev->ap.applid = 0;
}
skb_queue_purge(&cdev->recvqueue);
write_lock_irqsave(&capidev_list_lock, flags);
......@@ -425,7 +417,7 @@ gen_data_b3_resp_for(struct capiminor *mp, struct sk_buff *skb)
u16 datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4+4+2);
unsigned char *s = skb_put(nskb, CAPI_DATA_B3_RESP_LEN);
capimsg_setu16(s, 0, CAPI_DATA_B3_RESP_LEN);
capimsg_setu16(s, 2, mp->applid);
capimsg_setu16(s, 2, mp->ap->applid);
capimsg_setu8 (s, 4, CAPI_DATA_B3);
capimsg_setu8 (s, 5, CAPI_RESP);
capimsg_setu16(s, 6, mp->msgid++);
......@@ -465,7 +457,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
return -1;
}
datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4);
errcode = (*capifuncs->capi_put_message)(mp->applid, nskb);
errcode = capi20_put_message(mp->ap, nskb);
if (errcode != CAPI_NOERROR) {
printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n",
errcode);
......@@ -523,7 +515,7 @@ static int handle_minor_send(struct capiminor *mp)
skb_push(skb, CAPI_DATA_B3_REQ_LEN);
memset(skb->data, 0, CAPI_DATA_B3_REQ_LEN);
capimsg_setu16(skb->data, 0, CAPI_DATA_B3_REQ_LEN);
capimsg_setu16(skb->data, 2, mp->applid);
capimsg_setu16(skb->data, 2, mp->ap->applid);
capimsg_setu8 (skb->data, 4, CAPI_DATA_B3);
capimsg_setu8 (skb->data, 5, CAPI_REQ);
capimsg_setu16(skb->data, 6, mp->msgid++);
......@@ -538,7 +530,7 @@ static int handle_minor_send(struct capiminor *mp)
skb_queue_head(&mp->outqueue, skb);
return count;
}
errcode = (*capifuncs->capi_put_message) (mp->applid, skb);
errcode = capi20_put_message(mp->ap, skb);
if (errcode == CAPI_NOERROR) {
mp->datahandle++;
count++;
......@@ -568,25 +560,16 @@ static int handle_minor_send(struct capiminor *mp)
#endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
/* -------- function called by lower level -------------------------- */
static void capi_signal(u16 applid, void *param)
static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
{
struct capidev *cdev = (struct capidev *)param;
struct capidev *cdev = ap->private;
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
struct capiminor *mp;
u16 datahandle;
#endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
struct capincci *np;
struct sk_buff *skb = 0;
u32 ncci;
(void) (*capifuncs->capi_get_message) (applid, &skb);
if (!skb) {
printk(KERN_ERR "BUG: capi_signal: no skb\n");
return;
}
BUG_ON(cdev->applid != applid);
if (CAPIMSG_COMMAND(skb->data) == CAPI_CONNECT_B3_CONF) {
u16 info = CAPIMSG_U16(skb->data, 12); // Info field
if (info == 0)
......@@ -668,7 +651,7 @@ capi_read(struct file *file, char *buf, size_t count, loff_t *ppos)
if (ppos != &file->f_pos)
return -ESPIPE;
if (!cdev->applid)
if (!cdev->ap.applid)
return -ENODEV;
if ((skb = skb_dequeue(&cdev->recvqueue)) == 0) {
......@@ -697,12 +680,6 @@ capi_read(struct file *file, char *buf, size_t count, loff_t *ppos)
}
copied = skb->len;
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_IND) {
cdev->nrecvdatapkt++;
} else {
cdev->nrecvctlpkt++;
}
kfree_skb(skb);
return copied;
......@@ -719,7 +696,7 @@ capi_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
if (ppos != &file->f_pos)
return -ESPIPE;
if (!cdev->applid)
if (!cdev->ap.applid)
return -ENODEV;
skb = alloc_skb(count, GFP_USER);
......@@ -742,24 +719,19 @@ capi_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
return -EINVAL;
}
}
CAPIMSG_SETAPPID(skb->data, cdev->applid);
CAPIMSG_SETAPPID(skb->data, cdev->ap.applid);
if (CAPIMSG_COMMAND(skb->data) == CAPI_DISCONNECT_B3_RESP) {
capincci_free(cdev, CAPIMSG_NCCI(skb->data));
}
cdev->errcode = (*capifuncs->capi_put_message) (cdev->applid, skb);
cdev->errcode = capi20_put_message(&cdev->ap, skb);
if (cdev->errcode) {
kfree_skb(skb);
return -EIO;
}
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) {
cdev->nsentdatapkt++;
} else {
cdev->nsentctlpkt++;
}
return count;
}
......@@ -769,7 +741,7 @@ capi_poll(struct file *file, poll_table * wait)
struct capidev *cdev = (struct capidev *)file->private_data;
unsigned int mask = 0;
if (!cdev->applid)
if (!cdev->ap.applid)
return POLLERR;
poll_wait(file, &(cdev->recvwait), wait);
......@@ -781,30 +753,32 @@ capi_poll(struct file *file, poll_table * wait)
static int
capi_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{
struct capidev *cdev = (struct capidev *)file->private_data;
struct capidev *cdev = file->private_data;
struct capi20_appl *ap = &cdev->ap;
capi_ioctl_struct data;
int retval = -EINVAL;
switch (cmd) {
case CAPI_REGISTER:
{
retval = copy_from_user((void *) &data.rparams,
(void *) arg, sizeof(struct capi_register_params));
if (retval)
return -EFAULT;
if (cdev->applid)
if (ap->applid)
return -EEXIST;
cdev->errcode = (*capifuncs->capi_register) (&data.rparams,
&cdev->applid);
if (copy_from_user(&cdev->ap.rparam, (void *) arg,
sizeof(struct capi_register_params)))
return -EFAULT;
cdev->ap.private = cdev;
cdev->ap.recv_message = capi_recv_message;
cdev->errcode = capi20_register(ap);
if (cdev->errcode) {
cdev->applid = 0;
ap->applid = 0;
return -EIO;
}
(void) (*capifuncs->capi_set_signal) (cdev->applid, capi_signal, cdev);
}
return (int)cdev->applid;
return (int)ap->applid;
case CAPI_GET_VERSION:
{
......@@ -813,7 +787,7 @@ capi_ioctl(struct inode *inode, struct file *file,
sizeof(data.contr));
if (retval)
return -EFAULT;
cdev->errcode = (*capifuncs->capi_get_version) (data.contr, &data.version);
cdev->errcode = capi20_get_version(data.contr, &data.version);
if (cdev->errcode)
return -EIO;
retval = copy_to_user((void *) arg,
......@@ -831,7 +805,7 @@ capi_ioctl(struct inode *inode, struct file *file,
sizeof(data.contr));
if (retval)
return -EFAULT;
cdev->errcode = (*capifuncs->capi_get_serial) (data.contr, data.serial);
cdev->errcode = capi20_get_serial (data.contr, data.serial);
if (cdev->errcode)
return -EIO;
retval = copy_to_user((void *) arg,
......@@ -850,7 +824,7 @@ capi_ioctl(struct inode *inode, struct file *file,
return -EFAULT;
if (data.contr == 0) {
cdev->errcode = (*capifuncs->capi_get_profile) (data.contr, &data.profile);
cdev->errcode = capi20_get_profile(data.contr, &data.profile);
if (cdev->errcode)
return -EIO;
......@@ -859,7 +833,7 @@ capi_ioctl(struct inode *inode, struct file *file,
sizeof(data.profile.ncontroller));
} else {
cdev->errcode = (*capifuncs->capi_get_profile) (data.contr, &data.profile);
cdev->errcode = capi20_get_profile(data.contr, &data.profile);
if (cdev->errcode)
return -EIO;
......@@ -879,7 +853,7 @@ capi_ioctl(struct inode *inode, struct file *file,
sizeof(data.contr));
if (retval)
return -EFAULT;
cdev->errcode = (*capifuncs->capi_get_manufacturer) (data.contr, data.manufacturer);
cdev->errcode = capi20_get_manufacturer(data.contr, data.manufacturer);
if (cdev->errcode)
return -EIO;
......@@ -903,7 +877,7 @@ capi_ioctl(struct inode *inode, struct file *file,
return data.errcode;
case CAPI_INSTALLED:
if ((*capifuncs->capi_isinstalled)() == CAPI_NOERROR)
if (capi20_isinstalled() == CAPI_NOERROR)
return 0;
return -ENXIO;
......@@ -916,7 +890,7 @@ capi_ioctl(struct inode *inode, struct file *file,
sizeof(mcmd));
if (retval)
return -EFAULT;
return (*capifuncs->capi_manufacturer) (mcmd.cmd, mcmd.data);
return capi20_manufacturer(mcmd.cmd, mcmd.data);
}
return 0;
......@@ -1428,11 +1402,11 @@ static int proc_capidev_read_proc(char *page, char **start, off_t off,
list_for_each(l, &capidev_list) {
cdev = list_entry(l, struct capidev, list);
len += sprintf(page+len, "0 %d %lu %lu %lu %lu\n",
cdev->applid,
cdev->nrecvctlpkt,
cdev->nrecvdatapkt,
cdev->nsentctlpkt,
cdev->nsentdatapkt);
cdev->ap.applid,
cdev->ap.nrecvctlpkt,
cdev->ap.nrecvdatapkt,
cdev->ap.nsentctlpkt,
cdev->ap.nsentdatapkt);
if (len <= off) {
off -= len;
len = 0;
......@@ -1468,7 +1442,7 @@ static int proc_capincci_read_proc(char *page, char **start, off_t off,
cdev = list_entry(l, struct capidev, list);
for (np=cdev->nccis; np; np = np->next) {
len += sprintf(page+len, "%d 0x%x\n",
cdev->applid,
cdev->ap.applid,
np->ncci);
if (len <= off) {
off -= len;
......@@ -1596,10 +1570,6 @@ static int __init alloc_init(void)
return 0;
}
static struct capi_interface_user cuser = {
name: "capi20",
};
static char rev[32];
static int __init capi_init(void)
......@@ -1628,19 +1598,8 @@ static int __init capi_init(void)
&capi_fops, NULL);
printk(KERN_NOTICE "capi20: started up with major %d\n", capi_major);
if ((capifuncs = attach_capi_interface(&cuser)) == 0) {
MOD_DEC_USE_COUNT;
devfs_unregister_chrdev(capi_major, "capi20");
devfs_unregister(devfs_find_handle(NULL, "capi20",
capi_major, 0,
DEVFS_SPECIAL_CHR, 0));
return -EIO;
}
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
if (capinc_tty_init() < 0) {
(void) detach_capi_interface(&cuser);
devfs_unregister_chrdev(capi_major, "capi20");
MOD_DEC_USE_COUNT;
return -ENOMEM;
......@@ -1651,7 +1610,6 @@ static int __init capi_init(void)
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
capinc_tty_exit();
#endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
(void) detach_capi_interface(&cuser);
devfs_unregister_chrdev(capi_major, "capi20");
devfs_unregister(devfs_find_handle(NULL, "capi20",
capi_major, 0,
......@@ -1689,7 +1647,6 @@ static void __exit capi_exit(void)
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
capinc_tty_exit();
#endif
(void) detach_capi_interface(&cuser);
printk(KERN_NOTICE "capi: Rev %s: unloaded\n", rev);
}
......
......@@ -125,15 +125,9 @@ struct capidrv_contr {
struct capidrv_data {
u16 appid;
struct capi20_appl ap;
int ncontr;
struct capidrv_contr *contr_list;
/* statistic */
unsigned long nrecvctlpkt;
unsigned long nrecvdatapkt;
unsigned long nsentctlpkt;
unsigned long nsentdatapkt;
};
typedef struct capidrv_plci capidrv_plci;
......@@ -146,7 +140,6 @@ typedef struct capidrv_bchan capidrv_bchan;
static capidrv_data global;
static spinlock_t global_lock = SPIN_LOCK_UNLOCKED;
static struct capi_interface *capifuncs;
static void handle_dtrace_data(capidrv_contr *card,
int send, int level2, u8 *data, u16 len);
......@@ -519,8 +512,7 @@ static void send_message(capidrv_contr * card, _cmsg * cmsg)
len = CAPIMSG_LEN(cmsg->buf);
skb = alloc_skb(len, GFP_ATOMIC);
memcpy(skb_put(skb, len), cmsg->buf, len);
(*capifuncs->capi_put_message) (global.appid, skb);
global.nsentctlpkt++;
capi20_put_message(&global.ap, skb);
}
/* -------- state machine -------------------------------------------- */
......@@ -667,7 +659,7 @@ static void n0(capidrv_contr * card, capidrv_ncci * ncci)
isdn_ctrl cmd;
capi_fill_DISCONNECT_REQ(&cmsg,
global.appid,
global.ap.applid,
card->msgid++,
ncci->plcip->plci,
0, /* BChannelinformation */
......@@ -955,7 +947,7 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg)
cmd.parm.setup.si2,
cmd.parm.setup.eazmsn);
capi_fill_ALERT_REQ(cmsg,
global.appid,
global.ap.applid,
card->msgid++,
plcip->plci, /* adr */
0, /* BChannelinformation */
......@@ -1095,7 +1087,7 @@ static void handle_plci(_cmsg * cmsg)
break; /* $$$$ */
}
capi_fill_CONNECT_B3_REQ(cmsg,
global.appid,
global.ap.applid,
card->msgid++,
plcip->plci, /* adr */
0 /* NCPI */
......@@ -1212,7 +1204,7 @@ static void handle_ncci(_cmsg * cmsg)
if (nccip) {
ncci_change_state(card, nccip, EV_NCCI_CONNECT_B3_IND);
capi_fill_CONNECT_B3_RESP(cmsg,
global.appid,
global.ap.applid,
card->msgid++,
nccip->ncci, /* adr */
0, /* Reject */
......@@ -1230,7 +1222,7 @@ static void handle_ncci(_cmsg * cmsg)
cmsg->adr.adrNCCI);
}
capi_fill_CONNECT_B3_RESP(cmsg,
global.appid,
global.ap.applid,
card->msgid++,
cmsg->adr.adrNCCI,
2, /* Reject */
......@@ -1373,36 +1365,30 @@ static void handle_data(_cmsg * cmsg, struct sk_buff *skb)
static _cmsg s_cmsg;
static void capidrv_signal(u16 applid, void *dummy)
static void capidrv_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
{
struct sk_buff *skb = 0;
while ((*capifuncs->capi_get_message) (global.appid, &skb) == CAPI_NOERROR) {
capi_message2cmsg(&s_cmsg, skb->data);
if (debugmode > 2)
printk(KERN_DEBUG "capidrv_signal: applid=%d %s\n",
applid, capi_cmsg2str(&s_cmsg));
if (s_cmsg.Command == CAPI_DATA_B3
&& s_cmsg.Subcommand == CAPI_IND) {
handle_data(&s_cmsg, skb);
global.nrecvdatapkt++;
continue;
}
if ((s_cmsg.adr.adrController & 0xffffff00) == 0)
handle_controller(&s_cmsg);
else if ((s_cmsg.adr.adrPLCI & 0xffff0000) == 0)
handle_plci(&s_cmsg);
else
handle_ncci(&s_cmsg);
/*
* data of skb used in s_cmsg,
* free data when s_cmsg is not used again
* thanks to Lars Heete <hel@admin.de>
*/
kfree_skb(skb);
global.nrecvctlpkt++;
capi_message2cmsg(&s_cmsg, skb->data);
if (debugmode > 2)
printk(KERN_DEBUG "capidrv_signal: applid=%d %s\n",
ap->applid, capi_cmsg2str(&s_cmsg));
if (s_cmsg.Command == CAPI_DATA_B3
&& s_cmsg.Subcommand == CAPI_IND) {
handle_data(&s_cmsg, skb);
return;
}
if ((s_cmsg.adr.adrController & 0xffffff00) == 0)
handle_controller(&s_cmsg);
else if ((s_cmsg.adr.adrPLCI & 0xffff0000) == 0)
handle_plci(&s_cmsg);
else
handle_ncci(&s_cmsg);
/*
* data of skb used in s_cmsg,
* free data when s_cmsg is not used again
* thanks to Lars Heete <hel@admin.de>
*/
kfree_skb(skb);
}
/* ------------------------------------------------------------------- */
......@@ -1628,7 +1614,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
}
capi_fill_CONNECT_REQ(&cmdcmsg,
global.appid,
global.ap.applid,
card->msgid++,
card->contrnr, /* adr */
si2cip(bchan->si1, bchan->si2), /* cipvalue */
......@@ -1674,7 +1660,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
c->arg, bchan->l2, bchan->l3);
capi_fill_CONNECT_RESP(&cmdcmsg,
global.appid,
global.ap.applid,
card->msgid++,
bchan->plcip->plci, /* adr */
0, /* Reject */
......@@ -1721,7 +1707,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
if (bchan->nccip) {
bchan->disconnecting = 1;
capi_fill_DISCONNECT_B3_REQ(&cmdcmsg,
global.appid,
global.ap.applid,
card->msgid++,
bchan->nccip->ncci,
0 /* NCPI */
......@@ -1742,7 +1728,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
} else if (bchan->plcip->plci) {
bchan->disconnecting = 1;
capi_fill_DISCONNECT_REQ(&cmdcmsg,
global.appid,
global.ap.applid,
card->msgid++,
bchan->plcip->plci,
0, /* BChannelinformation */
......@@ -1889,7 +1875,7 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
return 0;
}
datahandle = nccip->datahandle;
capi_fill_DATA_B3_REQ(&sendcmsg, global.appid, card->msgid++,
capi_fill_DATA_B3_REQ(&sendcmsg, global.ap.applid, card->msgid++,
nccip->ncci, /* adr */
(u32) skb->data, /* Data */
skb->len, /* DataLength */
......@@ -1913,11 +1899,10 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
printk(KERN_DEBUG "capidrv-%d: only %d bytes headroom, need %d\n",
card->contrnr, skb_headroom(skb), msglen);
memcpy(skb_push(nskb, msglen), sendcmsg.buf, msglen);
errcode = (*capifuncs->capi_put_message) (global.appid, nskb);
errcode = capi20_put_message(&global.ap, nskb);
if (errcode == CAPI_NOERROR) {
dev_kfree_skb(skb);
nccip->datahandle++;
global.nsentdatapkt++;
return len;
}
(void)capidrv_del_ack(nccip, datahandle);
......@@ -1925,10 +1910,9 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
return errcode == CAPI_SENDQUEUEFULL ? 0 : -1;
} else {
memcpy(skb_push(skb, msglen), sendcmsg.buf, msglen);
errcode = (*capifuncs->capi_put_message) (global.appid, skb);
errcode = capi20_put_message(&global.ap, skb);
if (errcode == CAPI_NOERROR) {
nccip->datahandle++;
global.nsentdatapkt++;
return len;
}
skb_pull(skb, msglen);
......@@ -1969,7 +1953,7 @@ static void enable_dchannel_trace(capidrv_contr *card)
u16 errcode;
u16 avmversion[3];
errcode = (*capifuncs->capi_get_manufacturer)(contr, manufacturer);
errcode = capi20_get_manufacturer(contr, manufacturer);
if (errcode != CAPI_NOERROR) {
printk(KERN_ERR "%s: can't get manufacturer (0x%x)\n",
card->name, errcode);
......@@ -1980,7 +1964,7 @@ static void enable_dchannel_trace(capidrv_contr *card)
card->name, manufacturer);
return;
}
errcode = (*capifuncs->capi_get_version)(contr, &version);
errcode = capi20_get_version(contr, &version);
if (errcode != CAPI_NOERROR) {
printk(KERN_ERR "%s: can't get version (0x%x)\n",
card->name, errcode);
......@@ -1993,7 +1977,7 @@ static void enable_dchannel_trace(capidrv_contr *card)
if (avmversion[0] > 3 || (avmversion[0] == 3 && avmversion[1] > 5)) {
printk(KERN_INFO "%s: D2 trace enabled\n", card->name);
capi_fill_MANUFACTURER_REQ(&cmdcmsg, global.appid,
capi_fill_MANUFACTURER_REQ(&cmdcmsg, global.ap.applid,
card->msgid++,
contr,
0x214D5641, /* ManuID */
......@@ -2002,7 +1986,7 @@ static void enable_dchannel_trace(capidrv_contr *card)
(_cstruct)"\004\200\014\000\000");
} else {
printk(KERN_INFO "%s: D3 trace enabled\n", card->name);
capi_fill_MANUFACTURER_REQ(&cmdcmsg, global.appid,
capi_fill_MANUFACTURER_REQ(&cmdcmsg, global.ap.applid,
card->msgid++,
contr,
0x214D5641, /* ManuID */
......@@ -2016,7 +2000,7 @@ static void enable_dchannel_trace(capidrv_contr *card)
static void send_listen(capidrv_contr *card)
{
capi_fill_LISTEN_REQ(&cmdcmsg, global.appid,
capi_fill_LISTEN_REQ(&cmdcmsg, global.ap.applid,
card->msgid++,
card->contrnr, /* controller */
1 << 6, /* Infomask */
......@@ -2243,10 +2227,10 @@ static int proc_capidrv_read_proc(char *page, char **start, off_t off,
int len = 0;
len += sprintf(page+len, "%lu %lu %lu %lu\n",
global.nrecvctlpkt,
global.nrecvdatapkt,
global.nsentctlpkt,
global.nsentdatapkt);
global.ap.nrecvctlpkt,
global.ap.nrecvdatapkt,
global.ap.nsentctlpkt,
global.ap.nsentdatapkt);
if (off+count >= len)
*eof = 1;
if (len < off)
......@@ -2292,14 +2276,8 @@ static void __exit proc_exit(void)
}
}
static struct capi_interface_user cuser = {
name: "capidrv",
callback: lower_callback
};
static int __init capidrv_init(void)
{
struct capi_register_params rparam;
capi_profile profile;
char rev[32];
char *p;
......@@ -2308,13 +2286,6 @@ static int __init capidrv_init(void)
MOD_INC_USE_COUNT;
capifuncs = attach_capi_interface(&cuser);
if (!capifuncs) {
MOD_DEC_USE_COUNT;
return -EIO;
}
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strncpy(rev, p + 2, sizeof(rev));
rev[sizeof(rev)-1] = 0;
......@@ -2323,29 +2294,29 @@ static int __init capidrv_init(void)
} else
strcpy(rev, "1.0");
rparam.level3cnt = -2; /* number of bchannels twice */
rparam.datablkcnt = 16;
rparam.datablklen = 2048;
errcode = (*capifuncs->capi_register) (&rparam, &global.appid);
global.ap.rparam.level3cnt = -2; /* number of bchannels twice */
global.ap.rparam.datablkcnt = 16;
global.ap.rparam.datablklen = 2048;
global.ap.recv_message = capidrv_recv_message;
errcode = capi20_register(&global.ap);
if (errcode) {
detach_capi_interface(&cuser);
MOD_DEC_USE_COUNT;
return -EIO;
}
errcode = (*capifuncs->capi_get_profile) (0, &profile);
capi20_set_callback(&global.ap, lower_callback);
errcode = capi20_get_profile(0, &profile);
if (errcode != CAPI_NOERROR) {
(void) (*capifuncs->capi_release) (global.appid);
detach_capi_interface(&cuser);
capi20_release(&global.ap);
MOD_DEC_USE_COUNT;
return -EIO;
}
(void) (*capifuncs->capi_set_signal) (global.appid, capidrv_signal, 0);
ncontr = profile.ncontroller;
for (contr = 1; contr <= ncontr; contr++) {
errcode = (*capifuncs->capi_get_profile) (contr, &profile);
errcode = capi20_get_profile(contr, &profile);
if (errcode != CAPI_NOERROR)
continue;
(void) capidrv_addcontr(contr, &profile);
......@@ -2371,9 +2342,7 @@ static void __exit capidrv_exit(void)
strcpy(rev, " ??? ");
}
(void) (*capifuncs->capi_release) (global.appid);
detach_capi_interface(&cuser);
capi20_release(&global.ap);
proc_exit();
......
......@@ -55,21 +55,6 @@ MODULE_PARM(showcapimsgs, "i");
/* ------------------------------------------------------------- */
struct capi_appl {
u16 applid;
capi_register_params rparam;
void *param;
void (*signal) (u16 applid, void *param);
struct sk_buff_head recv_queue;
int nncci;
struct capi_ncci *nccilist;
unsigned long nrecvctlpkt;
unsigned long nrecvdatapkt;
unsigned long nsentctlpkt;
unsigned long nsentdatapkt;
};
struct capi_notifier {
struct capi_notifier *next;
unsigned int cmd;
......@@ -86,14 +71,11 @@ static char capi_manufakturer[64] = "AVM Berlin";
#define NCCI2CTRL(ncci) (((ncci) >> 24) & 0x7f)
static struct capi_appl *applications[CAPI_MAXAPPL];
static struct capi20_appl *applications[CAPI_MAXAPPL];
static struct capi_ctr *cards[CAPI_MAXCONTR];
static int ncards;
static struct sk_buff_head recv_queue;
static LIST_HEAD(users);
static spinlock_t users_lock = SPIN_LOCK_UNLOCKED;
static LIST_HEAD(drivers);
static spinlock_t drivers_lock = SPIN_LOCK_UNLOCKED;
......@@ -134,7 +116,7 @@ static inline struct capi_ctr *get_capi_ctr_by_nr(u16 contr)
return cards[contr - 1];
}
static inline struct capi_appl *get_capi_appl_by_nr(u16 applid)
static inline struct capi20_appl *get_capi_appl_by_nr(u16 applid)
{
if (applid - 1 >= CAPI_MAXAPPL)
return NULL;
......@@ -197,20 +179,18 @@ static inline int capi_subcmd_valid(u8 subcmd)
static int proc_applications_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
struct capi_appl *ap;
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 %d %d\n",
ap->applid,
ap->rparam.level3cnt,
ap->rparam.datablkcnt,
ap->rparam.datablklen,
ap->nncci,
skb_queue_len(&ap->recv_queue));
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;
......@@ -265,39 +245,6 @@ static int proc_driver_read_proc(char *page, char **start, off_t off,
return len;
}
/*
* /proc/capi/users:
* name
*/
static int proc_users_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
struct list_head *l;
struct capi_interface_user *cp;
int len = 0;
spin_lock(&users_lock);
list_for_each(l, &users) {
cp = list_entry(l, struct capi_interface_user, user_list);
len += sprintf(page+len, "%s\n", cp->name);
if (len <= off) {
off -= len;
len = 0;
} else {
if (len-off > count)
goto endloop;
}
}
endloop:
spin_unlock(&users_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
......@@ -344,7 +291,7 @@ static int proc_controller_read_proc(char *page, char **start, off_t off,
static int proc_applstats_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
struct capi_appl *ap;
struct capi20_appl *ap;
int i;
int len = 0;
......@@ -422,7 +369,6 @@ static struct procfsentries {
{ "capi", S_IFDIR, 0 },
{ "capi/applications", 0 , proc_applications_read_proc },
{ "capi/driver", 0 , proc_driver_read_proc },
{ "capi/users", 0 , proc_users_read_proc },
{ "capi/controller", 0 , proc_controller_read_proc },
{ "capi/applstats", 0 , proc_applstats_read_proc },
{ "capi/contrstats", 0 , proc_contrstats_read_proc },
......@@ -548,35 +494,33 @@ static int notify_push(unsigned int cmd, u32 controller,
static void notify_up(u32 contr)
{
struct list_head *l;
struct capi_interface_user *p;
struct capi_ctr *card = get_capi_ctr_by_nr(contr);
struct capi20_appl *ap;
u16 applid;
printk(KERN_DEBUG "kcapi: notify up contr %d\n", contr);
printk(KERN_NOTICE "kcapi: notify up contr %d\n", contr);
spin_lock(&users_lock);
list_for_each(l, &users) {
p = list_entry(l, struct capi_interface_user, user_list);
if (!p->callback) continue;
(*p->callback) (KCI_CONTRUP, contr, &card->profile);
for (applid = 1; applid <= CAPI_MAXAPPL; applid++) {
ap = get_capi_appl_by_nr(applid);
if (ap && ap->callback)
ap->callback(KCI_CONTRUP, contr, &card->profile);
}
spin_unlock(&users_lock);
}
/* -------- KCI_CONTRDOWN ------------------------------------- */
static void notify_down(u32 contr)
{
struct list_head *l;
struct capi_interface_user *p;
printk(KERN_NOTICE "kcapi: notify down contr %d\n", contr);
spin_lock(&users_lock);
list_for_each(l, &users) {
p = list_entry(l, struct capi_interface_user, user_list);
if (!p->callback) continue;
(*p->callback) (KCI_CONTRDOWN, contr, 0);
struct capi20_appl *ap;
u16 applid;
printk(KERN_DEBUG "kcapi: notify down contr %d\n", contr);
for (applid = 1; applid <= CAPI_MAXAPPL; applid++) {
ap = get_capi_appl_by_nr(applid);
if (ap && ap->callback)
ap->callback(KCI_CONTRDOWN, contr, 0);
}
spin_unlock(&users_lock);
}
/* ------------------------------------------------------------ */
......@@ -610,7 +554,7 @@ static void notify_handler(void *dummy)
static void recv_handler(void *dummy)
{
struct sk_buff *skb;
struct capi_appl *ap;
struct capi20_appl *ap;
while ((skb = skb_dequeue(&recv_queue)) != 0) {
ap = get_capi_appl_by_nr(CAPIMSG_APPID(skb->data));
......@@ -620,20 +564,14 @@ static void recv_handler(void *dummy)
kfree_skb(skb);
continue;
}
if (ap->signal == 0) {
printk(KERN_ERR "kcapi: recv_handler: applid %d has no signal function\n",
ap->applid);
kfree_skb(skb);
continue;
}
if ( CAPIMSG_COMMAND(skb->data) == CAPI_DATA_B3
&& CAPIMSG_SUBCOMMAND(skb->data) == CAPI_IND) {
ap->nrecvdatapkt++;
} else {
ap->nrecvctlpkt++;
}
skb_queue_tail(&ap->recv_queue, skb);
(ap->signal) (ap->applid, ap->param);
ap->recv_message(ap, skb);
}
}
......@@ -684,7 +622,7 @@ static void controllercb_handle_capimsg(struct capi_ctr * card,
static void controllercb_ready(struct capi_ctr * card)
{
u16 appl;
struct capi_appl *ap;
struct capi20_appl *ap;
card->cardstate = CARD_RUNNING;
......@@ -717,7 +655,7 @@ static void controllercb_reseted(struct capi_ctr * card)
memset(card->serial, 0, sizeof(card->serial));
for (appl = 1; appl <= CAPI_MAXAPPL; appl++) {
struct capi_appl *ap = get_capi_appl_by_nr(appl);
struct capi20_appl *ap = get_capi_appl_by_nr(appl);
if (!ap)
continue;
......@@ -892,7 +830,7 @@ EXPORT_SYMBOL(detach_capi_driver);
/* -------- CAPI2.0 Interface ---------------------------------- */
/* ------------------------------------------------------------- */
static u16 capi_isinstalled(void)
u16 capi20_isinstalled(void)
{
int i;
for (i = 0; i < CAPI_MAXCONTR; i++) {
......@@ -902,84 +840,76 @@ static u16 capi_isinstalled(void)
return CAPI_REGNOTINSTALLED;
}
static u16 capi_register(capi_register_params * rparam, u16 * applidp)
EXPORT_SYMBOL(capi20_isinstalled);
u16 capi20_register(struct capi20_appl *ap)
{
struct capi_appl *ap;
int appl;
int i;
u16 applid;
DBG("");
if (rparam->datablklen < 128)
if (ap->rparam.datablklen < 128)
return CAPI_LOGBLKSIZETOSMALL;
for (appl = 1; appl <= CAPI_MAXAPPL; appl++) {
if (applications[appl - 1] == NULL)
for (applid = 1; applid <= CAPI_MAXAPPL; applid++) {
if (applications[applid - 1] == NULL)
break;
}
if (appl > CAPI_MAXAPPL)
if (applid > CAPI_MAXAPPL)
return CAPI_TOOMANYAPPLS;
ap = kmalloc(sizeof(*ap), GFP_KERNEL);
if (!ap)
return CAPI_REGOSRESOURCEERR;
ap->applid = applid;
applications[applid - 1] = ap;
memset(ap, 0, sizeof(*ap));
ap->applid = appl;
applications[appl - 1] = ap;
ap->nrecvctlpkt = 0;
ap->nrecvdatapkt = 0;
ap->nsentctlpkt = 0;
ap->nsentdatapkt = 0;
ap->callback = 0;
skb_queue_head_init(&ap->recv_queue);
ap->nncci = 0;
memcpy(&ap->rparam, rparam, sizeof(capi_register_params));
for (i = 0; i < CAPI_MAXCONTR; i++) {
if (!cards[i] || cards[i]->cardstate != CARD_RUNNING)
continue;
register_appl(cards[i], appl, &ap->rparam);
register_appl(cards[i], applid, &ap->rparam);
}
*applidp = appl;
printk(KERN_INFO "kcapi: appl %d up\n", appl);
printk(KERN_DEBUG "kcapi: appl %d up\n", applid);
return CAPI_NOERROR;
}
static u16 capi_release(u16 applid)
EXPORT_SYMBOL(capi20_register);
u16 capi20_release(struct capi20_appl *ap)
{
struct capi_appl *ap = get_capi_appl_by_nr(applid);
int i;
DBG("applid %#x", applid);
DBG("applid %#x", ap->applid);
if (!ap)
return CAPI_ILLAPPNR;
skb_queue_purge(&ap->recv_queue);
for (i = 0; i < CAPI_MAXCONTR; i++) {
if (!cards[i] || cards[i]->cardstate != CARD_RUNNING)
continue;
release_appl(cards[i], applid);
release_appl(cards[i], ap->applid);
}
applications[applid - 1] = NULL;
kfree(ap);
printk(KERN_INFO "kcapi: appl %d down\n", applid);
applications[ap->applid - 1] = NULL;
printk(KERN_DEBUG "kcapi: appl %d down\n", ap->applid);
return CAPI_NOERROR;
}
static u16 capi_put_message(u16 applid, struct sk_buff *skb)
EXPORT_SYMBOL(capi20_release);
u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb)
{
struct capi_ctr *card;
struct capi_appl *ap;
int showctl = 0;
u8 cmd, subcmd;
DBG("applid %#x", applid);
DBG("applid %#x", ap->applid);
if (ncards == 0)
return CAPI_REGNOTINSTALLED;
ap = get_capi_appl_by_nr(applid);
if (!ap)
if (ap->applid == 0)
return CAPI_ILLAPPNR;
if (skb->len < 12
|| !capi_cmd_valid(CAPIMSG_COMMAND(skb->data))
......@@ -1024,33 +954,9 @@ static u16 capi_put_message(u16 applid, struct sk_buff *skb)
return card->driver->send_message(card, skb);
}
static u16 capi_get_message(u16 applid, struct sk_buff **msgp)
{
struct capi_appl *ap = get_capi_appl_by_nr(applid);
struct sk_buff *skb;
if (!ap)
return CAPI_ILLAPPNR;
if ((skb = skb_dequeue(&ap->recv_queue)) == 0)
return CAPI_RECEIVEQUEUEEMPTY;
*msgp = skb;
return CAPI_NOERROR;
}
EXPORT_SYMBOL(capi20_put_message);
static u16 capi_set_signal(u16 applid,
void (*signal) (u16 applid, void *param),
void *param)
{
struct capi_appl *ap = get_capi_appl_by_nr(applid);
if (!ap)
return CAPI_ILLAPPNR;
ap->signal = signal;
ap->param = param;
return CAPI_NOERROR;
}
static u16 capi_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN])
u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN])
{
struct capi_ctr *card;
......@@ -1066,7 +972,9 @@ static u16 capi_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN])
return CAPI_NOERROR;
}
static u16 capi_get_version(u32 contr, struct capi_version *verp)
EXPORT_SYMBOL(capi20_get_manufacturer);
u16 capi20_get_version(u32 contr, struct capi_version *verp)
{
struct capi_ctr *card;
......@@ -1082,7 +990,9 @@ static u16 capi_get_version(u32 contr, struct capi_version *verp)
return CAPI_NOERROR;
}
static u16 capi_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN])
EXPORT_SYMBOL(capi20_get_version);
u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN])
{
struct capi_ctr *card;
......@@ -1098,7 +1008,9 @@ static u16 capi_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN])
return CAPI_NOERROR;
}
static u16 capi_get_profile(u32 contr, struct capi_profile *profp)
EXPORT_SYMBOL(capi20_get_serial);
u16 capi20_get_profile(u32 contr, struct capi_profile *profp)
{
struct capi_ctr *card;
......@@ -1115,6 +1027,8 @@ static u16 capi_get_profile(u32 contr, struct capi_profile *profp)
return CAPI_NOERROR;
}
EXPORT_SYMBOL(capi20_get_profile);
static struct capi_driver *find_driver(char *name)
{
struct list_head *l;
......@@ -1255,7 +1169,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
}
#endif
static int capi_manufacturer(unsigned int cmd, void *data)
int capi20_manufacturer(unsigned int cmd, void *data)
{
struct capi_ctr *card;
int retval;
......@@ -1296,47 +1210,16 @@ static int capi_manufacturer(unsigned int cmd, void *data)
return -EINVAL;
}
struct capi_interface avmb1_interface =
{
capi_isinstalled,
capi_register,
capi_release,
capi_put_message,
capi_get_message,
capi_set_signal,
capi_get_manufacturer,
capi_get_version,
capi_get_serial,
capi_get_profile,
capi_manufacturer
};
EXPORT_SYMBOL(capi20_manufacturer);
/* ------------------------------------------------------------- */
/* -------- Exported Functions --------------------------------- */
/* ------------------------------------------------------------- */
struct capi_interface *attach_capi_interface(struct capi_interface_user *userp)
/* temporary hack */
void capi20_set_callback(struct capi20_appl *ap,
void (*callback) (unsigned int cmd, __u32 contr, void *data))
{
spin_lock(&users_lock);
list_add_tail(&userp->user_list, &users);
spin_unlock(&users_lock);
printk(KERN_NOTICE "kcapi: %s attached\n", userp->name);
return &avmb1_interface;
}
EXPORT_SYMBOL(attach_capi_interface);
int detach_capi_interface(struct capi_interface_user *userp)
{
spin_lock(&users_lock);
list_del(&userp->user_list);
printk(KERN_NOTICE "kcapi: %s detached\n", userp->name);
return 0;
ap->callback = callback;
}
EXPORT_SYMBOL(detach_capi_interface);
EXPORT_SYMBOL(capi20_set_callback);
/* ------------------------------------------------------------- */
/* -------- Init & Cleanup ------------------------------------- */
......
......@@ -178,8 +178,6 @@ static int __init b1isa_init(void)
int i, retval;
int found = 0;
MOD_INC_USE_COUNT;
b1_set_revision(&b1isa_driver, revision);
attach_capi_driver(&b1isa_driver);
......@@ -203,7 +201,6 @@ static int __init b1isa_init(void)
err:
detach_capi_driver(&b1isa_driver);
out:
MOD_DEC_USE_COUNT;
return retval;
}
......
......@@ -397,8 +397,6 @@ static int __init b1pci_init(void)
{
int retval;
MOD_INC_USE_COUNT;
b1_set_revision(&b1pci_driver, revision);
attach_capi_driver(&b1pci_driver);
......@@ -422,7 +420,6 @@ static int __init b1pci_init(void)
detach_capi_driver(&b1pciv4_driver);
#endif
out:
MOD_DEC_USE_COUNT;
return retval;
}
......
......@@ -200,12 +200,9 @@ EXPORT_SYMBOL(b1pcmcia_delcard);
static int __init b1pcmcia_init(void)
{
MOD_INC_USE_COUNT;
b1_set_revision(&b1pcmcia_driver, revision);
attach_capi_driver(&b1pcmcia_driver);
MOD_DEC_USE_COUNT;
return 0;
}
......
......@@ -1282,8 +1282,6 @@ static int __init c4_init(void)
{
int retval;
MOD_INC_USE_COUNT;
b1_set_revision(&c2_driver, revision);
attach_capi_driver(&c2_driver);
......@@ -1304,7 +1302,6 @@ static int __init c4_init(void)
detach_capi_driver(&c2_driver);
detach_capi_driver(&c4_driver);
out:
MOD_DEC_USE_COUNT;
return retval;
}
......
......@@ -345,12 +345,11 @@ static void t1isa_remove(struct pci_dev *pdev)
/* ------------------------------------------------------------- */
static int __init t1isa_probe(struct pci_dev *pdev)
static int __init t1isa_probe(struct pci_dev *pdev, int cardnr)
{
avmctrl_info *cinfo;
avmcard *card;
int retval;
static int cardnr = 1;
card = b1_alloc_card(1);
if (!card) {
......@@ -363,7 +362,7 @@ static int __init t1isa_probe(struct pci_dev *pdev)
card->port = pci_resource_start(pdev, 0);
card->irq = pdev->irq;
card->cardtype = avm_t1isa;
card->cardnr = cardnr++;
card->cardnr = cardnr;
sprintf(card->name, "t1isa-%x", card->port);
if (!(((card->port & 0x7) == 0) && ((card->port & 0x30) != 0x30))) {
......@@ -505,19 +504,20 @@ static struct capi_driver t1isa_driver = {
static struct pci_dev isa_dev[MAX_CARDS];
static int io[MAX_CARDS];
static int irq[MAX_CARDS];
static int cardnr[MAX_CARDS];
MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i");
MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i");
MODULE_PARM(cardnr, "1-" __MODULE_STRING(MAX_CARDS) "i");
MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
MODULE_PARM_DESC(cardnr, "Card number(s) (as jumpered)");
static int __init t1isa_init(void)
{
int i, retval;
int found = 0;
MOD_INC_USE_COUNT;
b1_set_revision(&t1isa_driver, revision);
attach_capi_driver(&t1isa_driver);
......@@ -528,7 +528,7 @@ static int __init t1isa_init(void)
isa_dev[i].resource[0].start = io[i];
isa_dev[i].irq_resource[0].start = irq[i];
if (t1isa_probe(&isa_dev[i]) == 0)
if (t1isa_probe(&isa_dev[i], cardnr[i]) == 0)
found++;
}
if (found == 0) {
......@@ -541,7 +541,6 @@ static int __init t1isa_init(void)
err:
detach_capi_driver(&t1isa_driver);
out:
MOD_DEC_USE_COUNT;
return retval;
}
......
......@@ -239,8 +239,6 @@ static int __init t1pci_init(void)
{
int retval;
MOD_INC_USE_COUNT;
b1_set_revision(&t1pci_driver, revision);
attach_capi_driver(&t1pci_driver);
......@@ -256,7 +254,6 @@ static int __init t1pci_init(void)
err:
detach_capi_driver(&t1pci_driver);
out:
MOD_DEC_USE_COUNT;
return retval;
}
......
......@@ -49,40 +49,41 @@ typedef struct kcapi_carddef {
#include <linux/skbuff.h>
struct capi_interface {
__u16 (*capi_isinstalled) (void);
__u16 (*capi_register) (capi_register_params * rparam, __u16 * applidp);
__u16 (*capi_release) (__u16 applid);
__u16 (*capi_put_message) (__u16 applid, struct sk_buff * msg);
__u16 (*capi_get_message) (__u16 applid, struct sk_buff ** msgp);
__u16 (*capi_set_signal) (__u16 applid,
void (*signal) (__u16 applid, void *param),
void *param);
__u16 (*capi_get_manufacturer) (__u32 contr, __u8 buf[CAPI_MANUFACTURER_LEN]);
__u16 (*capi_get_version) (__u32 contr, struct capi_version * verp);
__u16(*capi_get_serial) (__u32 contr, __u8 serial[CAPI_SERIAL_LEN]);
__u16(*capi_get_profile) (__u32 contr, struct capi_profile * profp);
/*
* to init controllers, data is always in user memory
#define KCI_CONTRUP 0 /* arg: struct capi_profile */
#define KCI_CONTRDOWN 1 /* arg: NULL */
struct capi20_appl {
u16 applid;
capi_register_params rparam;
void (*recv_message)(struct capi20_appl *ap, struct sk_buff *skb);
void *private;
/* internal to kernelcapi.o */
unsigned long nrecvctlpkt;
unsigned long nrecvdatapkt;
unsigned long nsentctlpkt;
unsigned long nsentdatapkt;
/* ugly hack to allow for notification of added/removed
* controllers. The Right Way (tm) is known. XXX
*/
int (*capi_manufacturer) (unsigned int cmd, void *data);
void (*callback) (unsigned int cmd, __u32 contr, void *data);
};
#define KCI_CONTRUP 0 /* struct capi_profile */
#define KCI_CONTRDOWN 1 /* NULL */
u16 capi20_isinstalled(void);
u16 capi20_register(struct capi20_appl *ap);
u16 capi20_release(struct capi20_appl *ap);
u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb);
u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]);
u16 capi20_get_version(u32 contr, struct capi_version *verp);
u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]);
u16 capi20_get_profile(u32 contr, struct capi_profile *profp);
int capi20_manufacturer(unsigned int cmd, void *data);
struct capi_interface_user {
char name[20];
void (*callback) (unsigned int cmd, __u32 contr, void *data);
/* internal */
struct list_head user_list;
};
/* temporary hack XXX */
void capi20_set_callback(struct capi20_appl *ap,
void (*callback) (unsigned int cmd, __u32 contr, void *data));
struct capi_interface *attach_capi_interface(struct capi_interface_user *);
int detach_capi_interface(struct capi_interface_user *);
#define CAPI_NOERROR 0x0000
......
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