File: /usr/src/linux/drivers/isdn/avmb1/capilli.h

1     /*
2      * $Id: capilli.h,v 1.4 1999/07/23 08:51:05 calle Exp $
3      * 
4      * Kernel CAPI 2.0 Driver Interface for Linux
5      * 
6      * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
7      * 
8      */
9     #ifndef __CAPILLI_H__
10     #define __CAPILLI_H__
11     
12     typedef struct capiloaddatapart {
13     	int user;		/* data in userspace ? */
14     	int len;
15     	unsigned char *data;
16     } capiloaddatapart;
17     
18     typedef struct capiloaddata {
19     	capiloaddatapart firmware;
20     	capiloaddatapart configuration;
21     } capiloaddata;
22     
23     typedef struct capicardparams {
24     	unsigned int port;
25     	unsigned irq;
26     	int cardtype;
27     	int cardnr;
28     	unsigned int membase;
29     } capicardparams;
30     
31     struct capi_driver;
32     
33     struct capi_ctr {
34             struct capi_ctr *next;			/* next ctr of same driver */
35             struct capi_driver *driver;
36     	int cnr;				/* controller number */
37     	char name[32];				/* name of controller */
38     	volatile unsigned short cardstate;	/* controller state */
39     	volatile int blocked;			/* output blocked */
40     	int traceflag;				/* capi trace */
41     
42     	void *driverdata;			/* driver specific */
43     
44     	/* filled before calling ready callback */
45     	__u8 manu[CAPI_MANUFACTURER_LEN];	/* CAPI_GET_MANUFACTURER */
46     	capi_version version;			/* CAPI_GET_VERSION */
47     	capi_profile profile;			/* CAPI_GET_PROFILE */
48     	__u8 serial[CAPI_SERIAL_LEN];		/* CAPI_GET_SERIAL */
49     
50     	/* functions */
51             void (*ready)(struct capi_ctr * card);
52             void (*reseted)(struct capi_ctr * card);
53             void (*suspend_output)(struct capi_ctr * card);
54             void (*resume_output)(struct capi_ctr * card);
55             void (*handle_capimsg)(struct capi_ctr * card,
56     			   	__u16 appl, struct sk_buff *skb);
57     	void (*appl_registered)(struct capi_ctr * card, __u16 appl);
58     	void (*appl_released)(struct capi_ctr * card, __u16 appl);
59     
60             void (*new_ncci)(struct capi_ctr * card,
61     			   	__u16 appl, __u32 ncci, __u32 winsize);
62             void (*free_ncci)(struct capi_ctr * card, __u16 appl, __u32 ncci);
63     
64     	/* management information for kcapi */
65     
66     	unsigned long nrecvctlpkt;
67     	unsigned long nrecvdatapkt;
68     	unsigned long nsentctlpkt;
69     	unsigned long nsentdatapkt;
70     
71     	struct proc_dir_entry *procent;
72             char procfn[128];
73     };
74     
75     struct capi_driver_interface {
76         struct capi_ctr *(*attach_ctr)(struct capi_driver *driver, char *name, void *data);
77         int (*detach_ctr)(struct capi_ctr *);
78     };
79     
80     struct capi_driver {
81          char name[32];				/* driver name */
82          char revision[32];
83          int (*load_firmware)(struct capi_ctr *, capiloaddata *);
84          void (*reset_ctr)(struct capi_ctr *);
85          void (*remove_ctr)(struct capi_ctr *);
86          void (*register_appl)(struct capi_ctr *, __u16 appl,
87     						capi_register_params *);
88          void (*release_appl)(struct capi_ctr *, __u16 appl);
89          void (*send_message)(struct capi_ctr *, struct sk_buff *skb);
90     
91          char *(*procinfo)(struct capi_ctr *);
92          int (*ctr_read_proc)(char *page, char **start, off_t off,
93     			       int count, int *eof, struct capi_ctr *card);
94          int (*driver_read_proc)(char *page, char **start, off_t off,
95     		               int count, int *eof, struct capi_driver *driver);
96     
97          int (*add_card)(struct capi_driver *driver, capicardparams *data);
98     
99          /* intitialized by kcapi */
100          struct capi_ctr	*controller;		/* list of controllers */
101          struct capi_driver *next;
102          int ncontroller;
103          struct proc_dir_entry *procent;
104          char procfn[128];
105     };
106     
107     struct capi_driver_interface *attach_capi_driver(struct capi_driver *driver);
108     void detach_capi_driver(struct capi_driver *driver);
109     
110     #endif				/* __CAPILLI_H__ */
111