Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
[platform/adaptation/renesas_rcar/renesas_kernel.git] / include / linux / kernelcapi.h
1 /*
2  * $Id: kernelcapi.h,v 1.8.6.2 2001/02/07 11:31:31 kai Exp $
3  * 
4  * Kernel CAPI 2.0 Interface for Linux
5  * 
6  * (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
7  * 
8  */
9
10 #ifndef __KERNELCAPI_H__
11 #define __KERNELCAPI_H__
12
13 #define CAPI_MAXAPPL    240     /* maximum number of applications  */
14 #define CAPI_MAXCONTR   32      /* maximum number of controller    */
15 #define CAPI_MAXDATAWINDOW      8
16
17
18 typedef struct kcapi_flagdef {
19         int contr;
20         int flag;
21 } kcapi_flagdef;
22
23 typedef struct kcapi_carddef {
24         char            driver[32];
25         unsigned int    port;
26         unsigned        irq;
27         unsigned int    membase;
28         int             cardnr;
29 } kcapi_carddef;
30
31 /* new ioctls >= 10 */
32 #define KCAPI_CMD_TRACE         10
33 #define KCAPI_CMD_ADDCARD       11      /* OBSOLETE */
34
35 /* 
36  * flag > 2 => trace also data
37  * flag & 1 => show trace
38  */
39 #define KCAPI_TRACE_OFF                 0
40 #define KCAPI_TRACE_SHORT_NO_DATA       1
41 #define KCAPI_TRACE_FULL_NO_DATA        2
42 #define KCAPI_TRACE_SHORT               3
43 #define KCAPI_TRACE_FULL                4
44
45
46 #ifdef __KERNEL__
47
48 #include <linux/list.h>
49 #include <linux/skbuff.h>
50 #include <linux/workqueue.h>
51 #include <linux/notifier.h>
52
53 struct capi20_appl {
54         u16 applid;
55         capi_register_params rparam;
56         void (*recv_message)(struct capi20_appl *ap, struct sk_buff *skb);
57         void *private;
58
59         /* internal to kernelcapi.o */
60         unsigned long nrecvctlpkt;
61         unsigned long nrecvdatapkt;
62         unsigned long nsentctlpkt;
63         unsigned long nsentdatapkt;
64         struct mutex recv_mtx;
65         struct sk_buff_head recv_queue;
66         struct work_struct recv_work;
67         int release_in_progress;
68 };
69
70 u16 capi20_isinstalled(void);
71 u16 capi20_register(struct capi20_appl *ap);
72 u16 capi20_release(struct capi20_appl *ap);
73 u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb);
74 u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]);
75 u16 capi20_get_version(u32 contr, struct capi_version *verp);
76 u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]);
77 u16 capi20_get_profile(u32 contr, struct capi_profile *profp);
78 int capi20_manufacturer(unsigned int cmd, void __user *data);
79
80 #define CAPICTR_UP                      0
81 #define CAPICTR_DOWN                    1
82
83 int register_capictr_notifier(struct notifier_block *nb);
84 int unregister_capictr_notifier(struct notifier_block *nb);
85
86 #define CAPI_NOERROR                      0x0000
87
88 #define CAPI_TOOMANYAPPLS                 0x1001
89 #define CAPI_LOGBLKSIZETOSMALL            0x1002
90 #define CAPI_BUFFEXECEEDS64K              0x1003
91 #define CAPI_MSGBUFSIZETOOSMALL           0x1004
92 #define CAPI_ANZLOGCONNNOTSUPPORTED       0x1005
93 #define CAPI_REGRESERVED                  0x1006
94 #define CAPI_REGBUSY                      0x1007
95 #define CAPI_REGOSRESOURCEERR             0x1008
96 #define CAPI_REGNOTINSTALLED              0x1009
97 #define CAPI_REGCTRLERNOTSUPPORTEXTEQUIP  0x100a
98 #define CAPI_REGCTRLERONLYSUPPORTEXTEQUIP 0x100b
99
100 #define CAPI_ILLAPPNR                     0x1101
101 #define CAPI_ILLCMDORSUBCMDORMSGTOSMALL   0x1102
102 #define CAPI_SENDQUEUEFULL                0x1103
103 #define CAPI_RECEIVEQUEUEEMPTY            0x1104
104 #define CAPI_RECEIVEOVERFLOW              0x1105
105 #define CAPI_UNKNOWNNOTPAR                0x1106
106 #define CAPI_MSGBUSY                      0x1107
107 #define CAPI_MSGOSRESOURCEERR             0x1108
108 #define CAPI_MSGNOTINSTALLED              0x1109
109 #define CAPI_MSGCTRLERNOTSUPPORTEXTEQUIP  0x110a
110 #define CAPI_MSGCTRLERONLYSUPPORTEXTEQUIP 0x110b
111
112 typedef enum {
113         CapiMessageNotSupportedInCurrentState = 0x2001,
114         CapiIllContrPlciNcci                  = 0x2002,
115         CapiNoPlciAvailable                   = 0x2003,
116         CapiNoNcciAvailable                   = 0x2004,
117         CapiNoListenResourcesAvailable        = 0x2005,
118         CapiNoFaxResourcesAvailable           = 0x2006,
119         CapiIllMessageParmCoding              = 0x2007,
120 } RESOURCE_CODING_PROBLEM;
121
122 typedef enum {
123         CapiB1ProtocolNotSupported                      = 0x3001,
124         CapiB2ProtocolNotSupported                      = 0x3002,
125         CapiB3ProtocolNotSupported                      = 0x3003,
126         CapiB1ProtocolParameterNotSupported             = 0x3004,
127         CapiB2ProtocolParameterNotSupported             = 0x3005,
128         CapiB3ProtocolParameterNotSupported             = 0x3006,
129         CapiBProtocolCombinationNotSupported            = 0x3007,
130         CapiNcpiNotSupported                            = 0x3008,
131         CapiCipValueUnknown                             = 0x3009,
132         CapiFlagsNotSupported                           = 0x300a,
133         CapiFacilityNotSupported                        = 0x300b,
134         CapiDataLengthNotSupportedByCurrentProtocol     = 0x300c,
135         CapiResetProcedureNotSupportedByCurrentProtocol = 0x300d,
136         CapiTeiAssignmentFailed                         = 0x300e,
137 } REQUESTED_SERVICES_PROBLEM;
138
139 typedef enum {
140         CapiSuccess                                     = 0x0000,
141         CapiSupplementaryServiceNotSupported            = 0x300e,
142         CapiRequestNotAllowedInThisState                = 0x3010,
143 } SUPPLEMENTARY_SERVICE_INFO;
144
145 typedef enum {
146         CapiProtocolErrorLayer1                         = 0x3301,
147         CapiProtocolErrorLayer2                         = 0x3302,
148         CapiProtocolErrorLayer3                         = 0x3303,
149         CapiTimeOut                                     = 0x3303, // SuppServiceReason
150         CapiCallGivenToOtherApplication                 = 0x3304,
151 } CAPI_REASON;
152
153 #endif                          /* __KERNEL__ */
154
155 #endif                          /* __KERNELCAPI_H__ */