Linux-2.6.12-rc2
[linux-flexiantxendom0-natty.git] / drivers / isdn / hardware / eicon / kst_ifc.h
1 /*
2  *
3   Copyright (c) Eicon Networks, 2000.
4  *
5   This source file is supplied for the use with
6   Eicon Networks range of DIVA Server Adapters.
7  *
8   Eicon File Revision :    1.9
9  *
10   This program is free software; you can redistribute it and/or modify
11   it under the terms of the GNU General Public License as published by
12   the Free Software Foundation; either version 2, or (at your option)
13   any later version.
14  *
15   This program is distributed in the hope that it will be useful,
16   but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
17   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18   See the GNU General Public License for more details.
19  *
20   You should have received a copy of the GNU General Public License
21   along with this program; if not, write to the Free Software
22   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  *
24  */
25 #ifndef __DIVA_EICON_TRACE_API__
26 #define __DIVA_EICON_TRACE_API__
27
28 #define DIVA_TRACE_LINE_TYPE_LEN 64
29 #define DIVA_TRACE_IE_LEN        64
30 #define DIVA_TRACE_FAX_PRMS_LEN  128
31
32 typedef struct _diva_trace_ie {
33         byte length;
34         byte data[DIVA_TRACE_IE_LEN];
35 } diva_trace_ie_t;
36
37 /*
38         Structure used to represent "State\\BX\\Modem" directory
39         to user.
40         */
41 typedef struct _diva_trace_modem_state {
42         dword   ChannelNumber;
43
44         dword   Event;
45
46         dword   Norm;
47
48         dword Options; /* Options received from Application */
49
50         dword   TxSpeed;
51         dword   RxSpeed;
52
53         dword RoundtripMsec;
54
55         dword SymbolRate;
56
57         int             RxLeveldBm;
58         int             EchoLeveldBm;
59
60         dword   SNRdb;
61         dword MAE;
62
63         dword LocalRetrains;
64         dword RemoteRetrains;
65         dword LocalResyncs;
66         dword RemoteResyncs;
67
68         dword DiscReason;
69
70 } diva_trace_modem_state_t;
71
72 /*
73         Representation of "State\\BX\\FAX" directory
74         */
75 typedef struct _diva_trace_fax_state {
76         dword   ChannelNumber;
77         dword Event;
78         dword Page_Counter;
79         dword Features;
80         char Station_ID[DIVA_TRACE_FAX_PRMS_LEN];
81         char Subaddress[DIVA_TRACE_FAX_PRMS_LEN];
82         char Password[DIVA_TRACE_FAX_PRMS_LEN];
83         dword Speed;
84         dword Resolution;
85         dword Paper_Width;
86         dword Paper_Length;
87         dword Scanline_Time;
88         dword Disc_Reason;
89         dword   dummy;
90 } diva_trace_fax_state_t;
91
92 /*
93         Structure used to represent Interface State in the abstract
94         and interface/D-channel protocol independent form.
95         */
96 typedef struct _diva_trace_interface_state {
97         char Layer1[DIVA_TRACE_LINE_TYPE_LEN];
98         char Layer2[DIVA_TRACE_LINE_TYPE_LEN];
99 } diva_trace_interface_state_t;
100
101 typedef struct _diva_incoming_call_statistics {
102         dword Calls;
103         dword Connected;
104         dword User_Busy;
105         dword Call_Rejected;
106         dword Wrong_Number;
107         dword Incompatible_Dst;
108         dword Out_of_Order;
109         dword Ignored;
110 } diva_incoming_call_statistics_t;
111
112 typedef struct _diva_outgoing_call_statistics {
113         dword Calls;
114         dword Connected;
115         dword User_Busy;
116         dword No_Answer;
117         dword Wrong_Number;
118         dword Call_Rejected;
119         dword Other_Failures;
120 } diva_outgoing_call_statistics_t;
121
122 typedef struct _diva_modem_call_statistics {
123         dword Disc_Normal;
124         dword Disc_Unspecified;
125         dword Disc_Busy_Tone;
126         dword Disc_Congestion;
127         dword Disc_Carr_Wait;
128         dword Disc_Trn_Timeout;
129         dword Disc_Incompat;
130         dword Disc_Frame_Rej;
131         dword Disc_V42bis;
132 } diva_modem_call_statistics_t;
133
134 typedef struct _diva_fax_call_statistics {
135         dword Disc_Normal;
136         dword Disc_Not_Ident;
137         dword Disc_No_Response;
138         dword Disc_Retries;
139         dword Disc_Unexp_Msg;
140         dword Disc_No_Polling;
141         dword Disc_Training;
142         dword Disc_Unexpected;
143         dword Disc_Application;
144         dword Disc_Incompat;
145         dword Disc_No_Command;
146         dword Disc_Long_Msg;
147         dword Disc_Supervisor;
148         dword Disc_SUB_SEP_PWD;
149         dword Disc_Invalid_Msg;
150         dword Disc_Page_Coding;
151         dword Disc_App_Timeout;
152         dword Disc_Unspecified;
153 } diva_fax_call_statistics_t;
154
155 typedef struct _diva_prot_statistics {
156         dword X_Frames;
157         dword X_Bytes;
158         dword X_Errors;
159         dword R_Frames;
160         dword R_Bytes;
161         dword R_Errors;
162 } diva_prot_statistics_t;
163
164 typedef struct _diva_ifc_statistics {
165         diva_incoming_call_statistics_t inc;
166         diva_outgoing_call_statistics_t outg;
167         diva_modem_call_statistics_t            mdm;
168         diva_fax_call_statistics_t                      fax;
169         diva_prot_statistics_t                                  b1;
170         diva_prot_statistics_t                                  b2;
171         diva_prot_statistics_t                                  d1;
172         diva_prot_statistics_t                                  d2;
173 } diva_ifc_statistics_t;
174
175 /*
176         Structure used to represent "State\\BX" directory
177         to user.
178         */
179 typedef struct _diva_trace_line_state {
180         dword   ChannelNumber;
181
182         char Line[DIVA_TRACE_LINE_TYPE_LEN];
183
184         char Framing[DIVA_TRACE_LINE_TYPE_LEN];
185
186         char Layer2[DIVA_TRACE_LINE_TYPE_LEN];
187         char Layer3[DIVA_TRACE_LINE_TYPE_LEN];
188
189         char RemoteAddress[DIVA_TRACE_LINE_TYPE_LEN];
190         char RemoteSubAddress[DIVA_TRACE_LINE_TYPE_LEN];
191
192         char LocalAddress[DIVA_TRACE_LINE_TYPE_LEN];
193         char LocalSubAddress[DIVA_TRACE_LINE_TYPE_LEN];
194
195         diva_trace_ie_t call_BC;
196         diva_trace_ie_t call_HLC;
197         diva_trace_ie_t call_LLC;
198
199         dword Charges;
200
201         dword CallReference;
202
203         dword LastDisconnecCause;
204
205         char UserID[DIVA_TRACE_LINE_TYPE_LEN];
206
207         diva_trace_modem_state_t modem;
208         diva_trace_fax_state_t   fax;
209
210         diva_trace_interface_state_t* pInterface;
211
212         diva_ifc_statistics_t*                          pInterfaceStat;
213
214 } diva_trace_line_state_t;
215
216 #define DIVA_SUPER_TRACE_NOTIFY_LINE_CHANGE             ('l')
217 #define DIVA_SUPER_TRACE_NOTIFY_MODEM_CHANGE            ('m')
218 #define DIVA_SUPER_TRACE_NOTIFY_FAX_CHANGE              ('f')
219 #define DIVA_SUPER_TRACE_INTERFACE_CHANGE               ('i')
220 #define DIVA_SUPER_TRACE_NOTIFY_STAT_CHANGE             ('s')
221 #define DIVA_SUPER_TRACE_NOTIFY_MDM_STAT_CHANGE         ('M')
222 #define DIVA_SUPER_TRACE_NOTIFY_FAX_STAT_CHANGE         ('F')
223
224 struct _diva_strace_library_interface;
225 typedef void (*diva_trace_channel_state_change_proc_t)(void* user_context,
226                                                         struct _diva_strace_library_interface* hLib,
227                                                         int Adapter,
228                                                         diva_trace_line_state_t* channel, int notify_subject);
229 typedef void (*diva_trace_channel_trace_proc_t)(void* user_context,
230                                                         struct _diva_strace_library_interface* hLib,
231                                                         int Adapter, void* xlog_buffer, int length);
232 typedef void (*diva_trace_error_proc_t)(void* user_context,
233                                                         struct _diva_strace_library_interface* hLib,
234                                                         int Adapter,
235                                                         int error, const char* file, int line);
236
237 /*
238         This structure creates interface from user to library
239         */
240 typedef struct _diva_trace_library_user_interface {
241         void*                                                                                                                                           user_context;
242         diva_trace_channel_state_change_proc_t  notify_proc;
243         diva_trace_channel_trace_proc_t                                 trace_proc;
244         diva_trace_error_proc_t                                                                 error_notify_proc;
245 } diva_trace_library_user_interface_t;
246
247 /*
248         Interface from Library to User
249         */
250 typedef int   (*DivaSTraceLibraryStart_proc_t)(void* hLib);
251 typedef int   (*DivaSTraceLibraryFinit_proc_t)(void* hLib);
252 typedef int   (*DivaSTraceMessageInput_proc_t)(void* hLib);
253 typedef void*   (*DivaSTraceGetHandle_proc_t)(void* hLib);
254
255 /*
256         Turn Audio Tap trace on/off
257         Channel should be in the range 1 ... Number of Channels
258         */
259 typedef int (*DivaSTraceSetAudioTap_proc_t)(void* hLib, int Channel, int on);
260
261 /*
262         Turn B-channel trace on/off
263         Channel should be in the range 1 ... Number of Channels
264         */
265 typedef int (*DivaSTraceSetBChannel_proc_t)(void* hLib, int Channel, int on);
266
267 /*
268         Turn    D-channel (Layer1/Layer2/Layer3) trace on/off
269                 Layer1 - All D-channel frames received/sent over the interface
270                                                  inclusive Layer 2 headers, Layer 2 frames and TEI management frames
271                 Layer2 - Events from LAPD protocol instance with SAPI of signalling protocol
272                 Layer3 - All D-channel frames addressed to assigned to the card TEI and
273                                                  SAPI of signalling protocol, and signalling protocol events.
274         */
275 typedef int (*DivaSTraceSetDChannel_proc_t)(void* hLib, int on);
276
277 /*
278         Get overall card statistics
279         */
280 typedef int (*DivaSTraceGetOutgoingCallStatistics_proc_t)(void* hLib);
281 typedef int (*DivaSTraceGetIncomingCallStatistics_proc_t)(void* hLib);
282 typedef int (*DivaSTraceGetModemStatistics_proc_t)(void* hLib);
283 typedef int (*DivaSTraceGetFaxStatistics_proc_t)(void* hLib);
284 typedef int (*DivaSTraceGetBLayer1Statistics_proc_t)(void* hLib);
285 typedef int (*DivaSTraceGetBLayer2Statistics_proc_t)(void* hLib);
286 typedef int (*DivaSTraceGetDLayer1Statistics_proc_t)(void* hLib);
287 typedef int (*DivaSTraceGetDLayer2Statistics_proc_t)(void* hLib);
288
289 /*
290         Call control
291         */
292 typedef int (*DivaSTraceClearCall_proc_t)(void* hLib, int Channel);
293
294 typedef struct _diva_strace_library_interface {
295         void* hLib;
296   DivaSTraceLibraryStart_proc_t DivaSTraceLibraryStart;
297   DivaSTraceLibraryStart_proc_t DivaSTraceLibraryStop;
298         DivaSTraceLibraryFinit_proc_t DivaSTraceLibraryFinit;
299         DivaSTraceMessageInput_proc_t DivaSTraceMessageInput;
300         DivaSTraceGetHandle_proc_t    DivaSTraceGetHandle;
301         DivaSTraceSetAudioTap_proc_t  DivaSTraceSetAudioTap;
302         DivaSTraceSetBChannel_proc_t  DivaSTraceSetBChannel;
303         DivaSTraceSetDChannel_proc_t  DivaSTraceSetDChannel;
304         DivaSTraceSetDChannel_proc_t  DivaSTraceSetInfo;
305         DivaSTraceGetOutgoingCallStatistics_proc_t \
306                                                                                                                                 DivaSTraceGetOutgoingCallStatistics;
307         DivaSTraceGetIncomingCallStatistics_proc_t \
308                                                                                                                                 DivaSTraceGetIncomingCallStatistics;
309         DivaSTraceGetModemStatistics_proc_t \
310                                                                                                                                 DivaSTraceGetModemStatistics;
311         DivaSTraceGetFaxStatistics_proc_t \
312                                                                                                                                 DivaSTraceGetFaxStatistics;
313         DivaSTraceGetBLayer1Statistics_proc_t \
314                                                                                                                                 DivaSTraceGetBLayer1Statistics;
315         DivaSTraceGetBLayer2Statistics_proc_t \
316                                                                                                                                 DivaSTraceGetBLayer2Statistics;
317         DivaSTraceGetDLayer1Statistics_proc_t \
318                                                                                                                                 DivaSTraceGetDLayer1Statistics;
319         DivaSTraceGetDLayer2Statistics_proc_t \
320                                                                                                                                 DivaSTraceGetDLayer2Statistics;
321         DivaSTraceClearCall_proc_t    DivaSTraceClearCall;
322 } diva_strace_library_interface_t;
323
324 /*
325         Create and return Library interface
326         */
327 diva_strace_library_interface_t* DivaSTraceLibraryCreateInstance (int Adapter,
328                                                                                                         const diva_trace_library_user_interface_t* user_proc,
329                           byte* pmem);
330 dword DivaSTraceGetMemotyRequirement (int channels);
331
332 #define DIVA_MAX_ADAPTERS  64
333 #define DIVA_MAX_LINES     32
334
335 #endif
336