Changes for proposed standard for CAPI2.0:

- AK148 "Linux Exention"
This commit is contained in:
Carsten Paeth 1999-09-10 17:24:19 +00:00
parent 0bad3ca5bc
commit bbf43cb86f
3 changed files with 65 additions and 29 deletions

View File

@ -6,6 +6,11 @@
* Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
*
* $Log$
* Revision 1.20 1999/09/07 09:02:53 calle
* SETDATA removed. Now inside the kernel the datapart of DATA_B3_REQ and
* DATA_B3_IND is always directly after the CAPI message. The "Data" member
* ist never used inside the kernel.
*
* Revision 1.19 1999/07/09 15:05:42 keil
* compat.h is now isdn_compat.h
*
@ -426,7 +431,7 @@ static int capi_ioctl(struct inode *inode, struct file *file,
return data.errcode;
case CAPI_INSTALLED:
if ((*capifuncs->capi_installed) ())
if ((*capifuncs->capi_isinstalled)() == CAPI_NOERROR)
return 0;
return -ENXIO;

View File

@ -6,6 +6,9 @@
* (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
*
* $Log$
* Revision 1.7 1999/09/04 06:20:05 keil
* Changes from kernel set_current_state()
*
* Revision 1.6 1999/07/20 06:41:49 calle
* Bugfix: After the redesign of the AVM B1 driver, the driver didn't even
* compile, if not selected as modules.
@ -119,7 +122,7 @@ struct capi_appl {
/* ------------------------------------------------------------- */
static struct capi_version driver_version = {2, 0, 1, 1<<4};
static char driver_serial[CAPI_SERIAL_LEN] = "4711";
static char driver_serial[CAPI_SERIAL_LEN] = "0004711";
static char capi_manufakturer[64] = "AVM Berlin";
#define APPL(a) (&applications[(a)-1])
@ -719,7 +722,7 @@ error:
/* -------- Notifier ------------------------------------------ */
static void notify_up(__u16 contr)
static void notify_up(__u32 contr)
{
struct capi_interface_user *p;
@ -730,7 +733,7 @@ static void notify_up(__u16 contr)
}
}
static void notify_down(__u16 contr)
static void notify_down(__u32 contr)
{
struct capi_interface_user *p;
printk(KERN_NOTICE "kcapi: notify down contr %d\n", contr);
@ -742,7 +745,7 @@ static void notify_down(__u16 contr)
static void notify_handler(void *dummy)
{
__u16 contr;
__u32 contr;
for (contr=1; VALID_CARD(contr); contr++)
if (test_and_clear_bit(contr, &notify_up_set))
@ -984,14 +987,14 @@ void detach_capi_driver(struct capi_driver *driver)
/* -------- CAPI2.0 Interface ---------------------------------- */
/* ------------------------------------------------------------- */
static int capi_installed(void)
static __u16 capi_isinstalled(void)
{
int i;
for (i = 0; i < CAPI_MAXCONTR; i++) {
if (cards[i].cardstate == CARD_RUNNING)
return 1;
return CAPI_NOERROR;
}
return 0;
return CAPI_REGNOTINSTALLED;
}
static __u16 capi_register(capi_register_params * rparam, __u16 * applidp)
@ -1053,7 +1056,7 @@ static __u16 capi_release(__u16 applid)
static __u16 capi_put_message(__u16 applid, struct sk_buff *skb)
{
struct capi_ncci *np;
int contr;
__u32 contr;
int showctl = 0;
__u8 cmd, subcmd;
@ -1131,53 +1134,53 @@ static __u16 capi_set_signal(__u16 applid,
return CAPI_NOERROR;
}
static __u16 capi_get_manufacturer(__u16 contr, __u8 buf[CAPI_MANUFACTURER_LEN])
static __u16 capi_get_manufacturer(__u32 contr, __u8 buf[CAPI_MANUFACTURER_LEN])
{
if (contr == 0) {
strncpy(buf, capi_manufakturer, CAPI_MANUFACTURER_LEN);
return CAPI_NOERROR;
}
if (!VALID_CARD(contr) || CARD(contr)->cardstate != CARD_RUNNING)
return 0x2002;
return CAPI_REGNOTINSTALLED;
strncpy(buf, CARD(contr)->manu, CAPI_MANUFACTURER_LEN);
return CAPI_NOERROR;
}
static __u16 capi_get_version(__u16 contr, struct capi_version *verp)
static __u16 capi_get_version(__u32 contr, struct capi_version *verp)
{
if (contr == 0) {
*verp = driver_version;
return CAPI_NOERROR;
}
if (!VALID_CARD(contr) || CARD(contr)->cardstate != CARD_RUNNING)
return 0x2002;
return CAPI_REGNOTINSTALLED;
memcpy((void *) verp, &CARD(contr)->version, sizeof(capi_version));
return CAPI_NOERROR;
}
static __u16 capi_get_serial(__u16 contr, __u8 serial[CAPI_SERIAL_LEN])
static __u16 capi_get_serial(__u32 contr, __u8 serial[CAPI_SERIAL_LEN])
{
if (contr == 0) {
strncpy(serial, driver_serial, CAPI_SERIAL_LEN);
return CAPI_NOERROR;
}
if (!VALID_CARD(contr) || CARD(contr)->cardstate != CARD_RUNNING)
return 0x2002;
return CAPI_REGNOTINSTALLED;
strncpy((void *) serial, CARD(contr)->serial, CAPI_SERIAL_LEN);
return CAPI_NOERROR;
}
static __u16 capi_get_profile(__u16 contr, struct capi_profile *profp)
static __u16 capi_get_profile(__u32 contr, struct capi_profile *profp)
{
if (contr == 0) {
profp->ncontroller = ncards;
return CAPI_NOERROR;
}
if (!VALID_CARD(contr) || CARD(contr)->cardstate != CARD_RUNNING)
return 0x2002;
return CAPI_REGNOTINSTALLED;
memcpy((void *) profp, &CARD(contr)->profile,
sizeof(struct capi_profile));
@ -1404,7 +1407,7 @@ static int capi_manufacturer(unsigned int cmd, void *data)
struct capi_interface avmb1_interface =
{
capi_installed,
capi_isinstalled,
capi_register,
capi_release,
capi_put_message,
@ -1479,6 +1482,12 @@ extern int t1isa_init(void);
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCMCIA
extern int b1pcmcia_init(void);
#endif
#ifdef CONFIG_ISDN_DRV_AVMB1_T1PCI
extern int t1pci_init(void);
#endif
#ifdef CONFIG_ISDN_DRV_AVMB1_C4
extern int c4_init(void);
#endif
#endif
/*
@ -1528,6 +1537,12 @@ int kcapi_init(void)
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCMCIA
(void)b1pcmcia_init();
#endif
#ifdef CONFIG_ISDN_DRV_AVMB1_T1PCI
(void)t1pci_init();
#endif
#ifdef CONFIG_ISDN_DRV_AVMB1_C4
(void)c4_init();
#endif
#endif
return 0;
}

View File

@ -6,6 +6,22 @@
* (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
*
* $Log$
* Revision 1.3 1999/07/01 15:26:56 calle
* complete new version (I love it):
* + new hardware independed "capi_driver" interface that will make it easy to:
* - support other controllers with CAPI-2.0 (i.e. USB Controller)
* - write a CAPI-2.0 for the passive cards
* - support serial link CAPI-2.0 boxes.
* + wrote "capi_driver" for all supported cards.
* + "capi_driver" (supported cards) now have to be configured with
* make menuconfig, in the past all supported cards where included
* at once.
* + new and better informations in /proc/capi/
* + new ioctl to switch trace of capi messages per controller
* using "avmcapictrl trace [contr] on|off|...."
* + complete testcircle with all supported cards and also the
* PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
*
* Revision 1.2 1999/06/21 15:24:26 calle
* extend information in /proc.
*
@ -54,19 +70,19 @@ typedef struct kcapi_flagdef {
#ifdef __KERNEL__
struct capi_interface {
int (*capi_installed) (void);
__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,
__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, __u32 param),
__u32 param);
__u16(*capi_get_manufacturer) (__u16 contr, __u8 buf[CAPI_MANUFACTURER_LEN]);
__u16(*capi_get_version) (__u16 contr, struct capi_version * verp);
__u16(*capi_get_serial) (__u16 contr, __u8 serial[CAPI_SERIAL_LEN]);
__u16(*capi_get_profile) (__u16 contr, struct capi_profile * profp);
__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
@ -80,7 +96,7 @@ struct capi_interface {
struct capi_interface_user {
char name[20];
void (*callback) (unsigned int cmd, __u16 contr, void *data);
void (*callback) (unsigned int cmd, __u32 contr, void *data);
/* internal */
struct capi_interface_user *next;
};