diff options
Diffstat (limited to 'include/linux/isdn')
-rw-r--r-- | include/linux/isdn/capilli.h | 95 | ||||
-rw-r--r-- | include/linux/isdn/capiutil.h | 60 |
2 files changed, 155 insertions, 0 deletions
diff --git a/include/linux/isdn/capilli.h b/include/linux/isdn/capilli.h new file mode 100644 index 000000000..12be09b68 --- /dev/null +++ b/include/linux/isdn/capilli.h @@ -0,0 +1,95 @@ +/* $Id: capilli.h,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $ + * + * Kernel CAPI 2.0 Driver Interface for Linux + * + * Copyright 1999 by Carsten Paeth <calle@calle.de> + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + * + */ + +#ifndef __CAPILLI_H__ +#define __CAPILLI_H__ + +#include <linux/kernel.h> +#include <linux/list.h> +#include <linux/capi.h> +#include <linux/kernelcapi.h> + +typedef struct capiloaddatapart { + int user; /* data in userspace ? */ + int len; + unsigned char *data; +} capiloaddatapart; + +typedef struct capiloaddata { + capiloaddatapart firmware; + capiloaddatapart configuration; +} capiloaddata; + +typedef struct capicardparams { + unsigned int port; + unsigned irq; + int cardtype; + int cardnr; + unsigned int membase; +} capicardparams; + +struct capi_ctr { + /* filled in before calling attach_capi_ctr */ + struct module *owner; + 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 (*proc_show)(struct seq_file *, void *); + + /* filled in before calling ready callback */ + u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */ + capi_version version; /* CAPI_GET_VERSION */ + capi_profile profile; /* CAPI_GET_PROFILE */ + u8 serial[CAPI_SERIAL_LEN]; /* CAPI_GET_SERIAL */ + + /* management information for kcapi */ + + unsigned long nrecvctlpkt; + unsigned long nrecvdatapkt; + unsigned long nsentctlpkt; + unsigned long nsentdatapkt; + + int cnr; /* controller number */ + unsigned short state; /* controller state */ + int blocked; /* output blocked */ + int traceflag; /* capi trace */ + + struct proc_dir_entry *procent; + char procfn[128]; +}; + +int attach_capi_ctr(struct capi_ctr *); +int detach_capi_ctr(struct capi_ctr *); + +void capi_ctr_ready(struct capi_ctr * card); +void capi_ctr_down(struct capi_ctr * card); +void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb); + +// --------------------------------------------------------------------------- +// needed for AVM capi drivers + +struct capi_driver { + char name[32]; /* driver name */ + char revision[32]; + + /* management information for kcapi */ + struct list_head list; +}; + +#endif /* __CAPILLI_H__ */ diff --git a/include/linux/isdn/capiutil.h b/include/linux/isdn/capiutil.h new file mode 100644 index 000000000..953fd500d --- /dev/null +++ b/include/linux/isdn/capiutil.h @@ -0,0 +1,60 @@ +/* $Id: capiutil.h,v 1.5.6.2 2001/09/23 22:24:33 kai Exp $ + * + * CAPI 2.0 defines & types + * + * From CAPI 2.0 Development Kit AVM 1995 (msg.c) + * Rewritten for Linux 1996 by Carsten Paeth <calle@calle.de> + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + * + */ + +#ifndef __CAPIUTIL_H__ +#define __CAPIUTIL_H__ + +#include <asm/types.h> + +#define CAPIMSG_BASELEN 8 +#define CAPIMSG_U8(m, off) (m[off]) +#define CAPIMSG_U16(m, off) (m[off]|(m[(off)+1]<<8)) +#define CAPIMSG_U32(m, off) (m[off]|(m[(off)+1]<<8)|(m[(off)+2]<<16)|(m[(off)+3]<<24)) +#define CAPIMSG_LEN(m) CAPIMSG_U16(m,0) +#define CAPIMSG_APPID(m) CAPIMSG_U16(m,2) +#define CAPIMSG_COMMAND(m) CAPIMSG_U8(m,4) +#define CAPIMSG_SUBCOMMAND(m) CAPIMSG_U8(m,5) +#define CAPIMSG_CMD(m) (((m[4])<<8)|(m[5])) +#define CAPIMSG_MSGID(m) CAPIMSG_U16(m,6) +#define CAPIMSG_CONTROLLER(m) (m[8] & 0x7f) +#define CAPIMSG_CONTROL(m) CAPIMSG_U32(m, 8) +#define CAPIMSG_NCCI(m) CAPIMSG_CONTROL(m) +#define CAPIMSG_DATALEN(m) CAPIMSG_U16(m,16) /* DATA_B3_REQ */ + +static inline void capimsg_setu8(void *m, int off, __u8 val) +{ + ((__u8 *)m)[off] = val; +} + +static inline void capimsg_setu16(void *m, int off, __u16 val) +{ + ((__u8 *)m)[off] = val & 0xff; + ((__u8 *)m)[off+1] = (val >> 8) & 0xff; +} + +static inline void capimsg_setu32(void *m, int off, __u32 val) +{ + ((__u8 *)m)[off] = val & 0xff; + ((__u8 *)m)[off+1] = (val >> 8) & 0xff; + ((__u8 *)m)[off+2] = (val >> 16) & 0xff; + ((__u8 *)m)[off+3] = (val >> 24) & 0xff; +} + +#define CAPIMSG_SETLEN(m, len) capimsg_setu16(m, 0, len) +#define CAPIMSG_SETAPPID(m, applid) capimsg_setu16(m, 2, applid) +#define CAPIMSG_SETCOMMAND(m,cmd) capimsg_setu8(m, 4, cmd) +#define CAPIMSG_SETSUBCOMMAND(m, cmd) capimsg_setu8(m, 5, cmd) +#define CAPIMSG_SETMSGID(m, msgid) capimsg_setu16(m, 6, msgid) +#define CAPIMSG_SETCONTROL(m, contr) capimsg_setu32(m, 8, contr) +#define CAPIMSG_SETDATALEN(m, len) capimsg_setu16(m, 16, len) + +#endif /* __CAPIUTIL_H__ */ |