blob: d3e5e9da0c8206daea1d535871c8d9548b4962e7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* $Id: capilli.h,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $
2 *
3 * Kernel CAPI 2.0 Driver Interface for Linux
4 *
5 * Copyright 1999 by Carsten Paeth <calle@calle.de>
6 *
7 * This software may be used and distributed according to the terms
8 * of the GNU General Public License, incorporated herein by reference.
9 *
10 */
11
12#ifndef __CAPILLI_H__
13#define __CAPILLI_H__
14
15#include <linux/kernel.h>
16#include <linux/list.h>
17#include <linux/capi.h>
18#include <linux/kernelcapi.h>
19
20typedef struct capiloaddatapart {
21 int user; /* data in userspace ? */
22 int len;
23 unsigned char *data;
24} capiloaddatapart;
25
26typedef struct capiloaddata {
27 capiloaddatapart firmware;
28 capiloaddatapart configuration;
29} capiloaddata;
30
31typedef struct capicardparams {
32 unsigned int port;
33 unsigned irq;
34 int cardtype;
35 int cardnr;
36 unsigned int membase;
37} capicardparams;
38
39struct capi_ctr {
40 /* filled in before calling attach_capi_ctr */
41 struct module *owner;
42 void *driverdata; /* driver specific */
43 char name[32]; /* name of controller */
44 char *driver_name; /* name of driver */
45 int (*load_firmware)(struct capi_ctr *, capiloaddata *);
46 void (*reset_ctr)(struct capi_ctr *);
47 void (*register_appl)(struct capi_ctr *, u16 appl,
48 capi_register_params *);
49 void (*release_appl)(struct capi_ctr *, u16 appl);
50 u16 (*send_message)(struct capi_ctr *, struct sk_buff *skb);
51
52 char *(*procinfo)(struct capi_ctr *);
Alexey Dobriyan9a58a802010-01-14 03:10:54 -080053 const struct file_operations *proc_fops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
55 /* filled in before calling ready callback */
56 u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */
57 capi_version version; /* CAPI_GET_VERSION */
58 capi_profile profile; /* CAPI_GET_PROFILE */
59 u8 serial[CAPI_SERIAL_LEN]; /* CAPI_GET_SERIAL */
60
61 /* management information for kcapi */
62
63 unsigned long nrecvctlpkt;
64 unsigned long nrecvdatapkt;
65 unsigned long nsentctlpkt;
66 unsigned long nsentdatapkt;
67
68 int cnr; /* controller number */
69 volatile unsigned short cardstate; /* controller state */
70 volatile int blocked; /* output blocked */
71 int traceflag; /* capi trace */
72
73 struct proc_dir_entry *procent;
74 char procfn[128];
75};
76
77int attach_capi_ctr(struct capi_ctr *);
78int detach_capi_ctr(struct capi_ctr *);
79
80void capi_ctr_ready(struct capi_ctr * card);
Tilman Schmidt4e329972009-06-07 09:09:23 +000081void capi_ctr_down(struct capi_ctr * card);
Linus Torvalds1da177e2005-04-16 15:20:36 -070082void capi_ctr_suspend_output(struct capi_ctr * card);
83void capi_ctr_resume_output(struct capi_ctr * card);
84void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb);
85
86// ---------------------------------------------------------------------------
87// needed for AVM capi drivers
88
89struct capi_driver {
90 char name[32]; /* driver name */
91 char revision[32];
92
93 int (*add_card)(struct capi_driver *driver, capicardparams *data);
94
95 /* management information for kcapi */
96 struct list_head list;
97};
98
99void register_capi_driver(struct capi_driver *driver);
100void unregister_capi_driver(struct capi_driver *driver);
101
102// ---------------------------------------------------------------------------
103// library functions for use by hardware controller drivers
104
105void capilib_new_ncci(struct list_head *head, u16 applid, u32 ncci, u32 winsize);
106void capilib_free_ncci(struct list_head *head, u16 applid, u32 ncci);
107void capilib_release_appl(struct list_head *head, u16 applid);
108void capilib_release(struct list_head *head);
109void capilib_data_b3_conf(struct list_head *head, u16 applid, u32 ncci, u16 msgid);
110u16 capilib_data_b3_req(struct list_head *head, u16 applid, u32 ncci, u16 msgid);
111
112#endif /* __CAPILLI_H__ */