added a lot of printk output to ease writing of emulator
[linux-2.4.21-pre4.git] / include / linux / kernelcapi.h
1 /* $Id: kernelcapi.h,v 1.1.1.1 2005/04/11 02:51:02 jack Exp $
2  * 
3  * Kernel CAPI 2.0 Interface for Linux
4  * 
5  * (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.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 __KERNELCAPI_H__
13 #define __KERNELCAPI_H__
14
15 #define CAPI_MAXAPPL    128     /* maximum number of applications  */
16 #define CAPI_MAXCONTR   16      /* maximum number of controller    */
17 #define CAPI_MAXDATAWINDOW      8
18
19
20 typedef struct kcapi_flagdef {
21         int contr;
22         int flag;
23 } kcapi_flagdef;
24
25 typedef struct kcapi_carddef {
26         char            driver[32];
27         unsigned int    port;
28         unsigned        irq;
29         unsigned int    membase;
30         int             cardnr;
31 } kcapi_carddef;
32
33 /* new ioctls >= 10 */
34 #define KCAPI_CMD_TRACE         10
35 #define KCAPI_CMD_ADDCARD       11      /* add card to named driver */
36
37 /* 
38  * flag > 2 => trace also data
39  * flag & 1 => show trace
40  */
41 #define KCAPI_TRACE_OFF                 0
42 #define KCAPI_TRACE_SHORT_NO_DATA       1
43 #define KCAPI_TRACE_FULL_NO_DATA        2
44 #define KCAPI_TRACE_SHORT               3
45 #define KCAPI_TRACE_FULL                4
46
47
48 #ifdef __KERNEL__
49
50 struct capi_interface {
51         __u16 (*capi_isinstalled) (void);
52
53         __u16 (*capi_register) (capi_register_params * rparam, __u16 * applidp);
54         __u16 (*capi_release) (__u16 applid);
55         __u16 (*capi_put_message) (__u16 applid, struct sk_buff * msg);
56         __u16 (*capi_get_message) (__u16 applid, struct sk_buff ** msgp);
57         __u16 (*capi_set_signal) (__u16 applid,
58                               void (*signal) (__u16 applid, void *param),
59                                   void *param);
60         __u16 (*capi_get_manufacturer) (__u32 contr, __u8 buf[CAPI_MANUFACTURER_LEN]);
61         __u16 (*capi_get_version) (__u32 contr, struct capi_version * verp);
62          __u16(*capi_get_serial) (__u32 contr, __u8 serial[CAPI_SERIAL_LEN]);
63          __u16(*capi_get_profile) (__u32 contr, struct capi_profile * profp);
64
65         /*
66          * to init controllers, data is always in user memory
67          */
68         int (*capi_manufacturer) (unsigned int cmd, void *data);
69
70 };
71
72 struct capi_ncciinfo {
73         __u16 applid;
74         __u32 ncci;
75 };
76
77 #define KCI_CONTRUP     0       /* struct capi_profile */
78 #define KCI_CONTRDOWN   1       /* NULL */
79 #define KCI_NCCIUP      2       /* struct capi_ncciinfo */
80 #define KCI_NCCIDOWN    3       /* struct capi_ncciinfo */
81
82 struct capi_interface_user {
83         char name[20];
84         void (*callback) (unsigned int cmd, __u32 contr, void *data);
85         /* internal */
86         struct capi_interface_user *next;
87 };
88
89 struct capi_interface *attach_capi_interface(struct capi_interface_user *);
90 int detach_capi_interface(struct capi_interface_user *);
91
92
93 #define CAPI_NOERROR                      0x0000
94
95 #define CAPI_TOOMANYAPPLS                 0x1001
96 #define CAPI_LOGBLKSIZETOSMALL            0x1002
97 #define CAPI_BUFFEXECEEDS64K              0x1003
98 #define CAPI_MSGBUFSIZETOOSMALL           0x1004
99 #define CAPI_ANZLOGCONNNOTSUPPORTED       0x1005
100 #define CAPI_REGRESERVED                  0x1006
101 #define CAPI_REGBUSY                      0x1007
102 #define CAPI_REGOSRESOURCEERR             0x1008
103 #define CAPI_REGNOTINSTALLED              0x1009
104 #define CAPI_REGCTRLERNOTSUPPORTEXTEQUIP  0x100a
105 #define CAPI_REGCTRLERONLYSUPPORTEXTEQUIP 0x100b
106
107 #define CAPI_ILLAPPNR                     0x1101
108 #define CAPI_ILLCMDORSUBCMDORMSGTOSMALL   0x1102
109 #define CAPI_SENDQUEUEFULL                0x1103
110 #define CAPI_RECEIVEQUEUEEMPTY            0x1104
111 #define CAPI_RECEIVEOVERFLOW              0x1105
112 #define CAPI_UNKNOWNNOTPAR                0x1106
113 #define CAPI_MSGBUSY                      0x1107
114 #define CAPI_MSGOSRESOURCEERR             0x1108
115 #define CAPI_MSGNOTINSTALLED              0x1109
116 #define CAPI_MSGCTRLERNOTSUPPORTEXTEQUIP  0x110a
117 #define CAPI_MSGCTRLERONLYSUPPORTEXTEQUIP 0x110b
118
119 typedef enum {
120         CapiMessageNotSupportedInCurrentState = 0x2001,
121         CapiIllContrPlciNcci                  = 0x2002,
122         CapiNoPlciAvailable                   = 0x2003,
123         CapiNoNcciAvailable                   = 0x2004,
124         CapiNoListenResourcesAvailable        = 0x2005,
125         CapiNoFaxResourcesAvailable           = 0x2006,
126         CapiIllMessageParmCoding              = 0x2007,
127 } RESOURCE_CODING_PROBLEM;
128
129 typedef enum {
130         CapiB1ProtocolNotSupported                      = 0x3001,
131         CapiB2ProtocolNotSupported                      = 0x3002,
132         CapiB3ProtocolNotSupported                      = 0x3003,
133         CapiB1ProtocolParameterNotSupported             = 0x3004,
134         CapiB2ProtocolParameterNotSupported             = 0x3005,
135         CapiB3ProtocolParameterNotSupported             = 0x3006,
136         CapiBProtocolCombinationNotSupported            = 0x3007,
137         CapiNcpiNotSupported                            = 0x3008,
138         CapiCipValueUnknown                             = 0x3009,
139         CapiFlagsNotSupported                           = 0x300a,
140         CapiFacilityNotSupported                        = 0x300b,
141         CapiDataLengthNotSupportedByCurrentProtocol     = 0x300c,
142         CapiResetProcedureNotSupportedByCurrentProtocol = 0x300d,
143         CapiTeiAssignmentFailed                         = 0x300e,
144 } REQUESTED_SERVICES_PROBLEM;
145
146 typedef enum {
147         CapiSuccess                                     = 0x0000,
148         CapiSupplementaryServiceNotSupported            = 0x300e,
149         CapiRequestNotAllowedInThisState                = 0x3010,
150 } SUPPLEMENTARY_SERVICE_INFO;
151
152 typedef enum {
153         CapiProtocolErrorLayer1                         = 0x3301,
154         CapiProtocolErrorLayer2                         = 0x3302,
155         CapiProtocolErrorLayer3                         = 0x3303,
156         CapiTimeOut                                     = 0x3303, // SuppServiceReason
157         CapiCallGivenToOtherApplication                 = 0x3304,
158 } CAPI_REASON;
159
160 #endif                          /* __KERNEL__ */
161
162 #endif                          /* __KERNELCAPI_H__ */