1 /* $Id: capi.h,v 1.5 1998/11/05 22:12:48 fritz Exp $
3 * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000.
5 * Copyright 1998 by Fritz Elfert (fritz@isdn4linux.de)
6 * Thanks to Friedemann Baitinger and IBM Germany
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 * Revision 1.5 1998/11/05 22:12:48 fritz
24 * Changed mail-address.
26 * Revision 1.4 1997/10/01 09:21:04 fritz
27 * Removed old compatibility stuff for 2.0.X kernels.
28 * From now on, this code is for 2.1.X ONLY!
29 * Old stuff is still in the separate branch.
31 * Revision 1.3 1997/09/25 17:25:41 fritz
32 * Support for adding cards at runtime.
33 * Support for new Firmware.
35 * Revision 1.2 1997/09/24 19:44:15 fritz
36 * Added MSN mapping support, some cleanup.
38 * Revision 1.1 1997/09/23 18:00:10 fritz
39 * New driver for IBM Active 2000.
46 /* Command-part of a CAPI message */
47 typedef struct actcapi_msgcmd
{
52 /* CAPI message header */
53 typedef struct actcapi_msghdr
{
60 /* CAPI message description (for debugging) */
61 typedef struct actcapi_msgdsc
{
67 typedef struct actcapi_addr
{
68 __u8 len
; /* Length of element */
69 __u8 tnp
; /* Type/Numbering Plan */
70 __u8 num
[20]; /* Caller ID */
73 /* CAPI INFO element mask */
74 typedef union actcapi_infonr
{ /* info number */
75 __u16 mask
; /* info-mask field */
76 struct bmask
{ /* bit definitions */
77 unsigned codes
: 3; /* code set */
78 unsigned rsvd
: 5; /* reserved */
79 unsigned svind
: 1; /* single, variable length ind. */
80 unsigned wtype
: 7; /* W-element type */
84 /* CAPI INFO element */
85 typedef union actcapi_infoel
{ /* info element */
86 __u8 len
; /* length of info element */
87 __u8 display
[40]; /* display contents */
88 __u8 uuinfo
[40]; /* User-user info field */
89 struct cause
{ /* Cause information */
90 unsigned ext2
: 1; /* extension */
91 unsigned cod
: 2; /* coding standard */
92 unsigned spare
: 1; /* spare */
93 unsigned loc
: 4; /* location */
94 unsigned ext1
: 1; /* extension */
95 unsigned cval
: 7; /* Cause value */
97 struct charge
{ /* Charging information */
98 __u8 toc
; /* type of charging info */
99 __u8 unit
[10]; /* charging units */
101 __u8 date
[20]; /* date fields */
102 __u8 stat
; /* state of remote party */
105 /* Message for EAZ<->MSN Mapping */
106 typedef struct actcapi_msn
{
108 __u8 len
; /* Length of MSN */
109 __u8 msn
[15] __attribute__ ((packed
));
112 typedef struct actcapi_dlpd
{
113 __u8 len
; /* Length of structure */
114 __u16 dlen
__attribute__ ((packed
)); /* Data Length */
115 __u8 laa
__attribute__ ((packed
)); /* Link Address A */
116 __u8 lab
; /* Link Address B */
117 __u8 modulo
; /* Modulo Mode */
118 __u8 win
; /* Window size */
119 __u8 xid
[100]; /* XID Information */
122 typedef struct actcapi_ncpd
{
123 __u8 len
; /* Length of structure */
124 __u16 lic
__attribute__ ((packed
));
125 __u16 hic
__attribute__ ((packed
));
126 __u16 ltc
__attribute__ ((packed
));
127 __u16 htc
__attribute__ ((packed
));
128 __u16 loc
__attribute__ ((packed
));
129 __u16 hoc
__attribute__ ((packed
));
130 __u8 modulo
__attribute__ ((packed
));
132 #define actcapi_ncpi actcapi_ncpd
135 * Layout of NCCI field in a B3 DATA CAPI message is different from
136 * standard at act2000:
139 * Bit 5-7 = Controller
142 #define MAKE_NCCI(plci,contr,ncci) \
143 ((plci & 0x1f) | ((contr & 0x7) << 5) | ((ncci & 0xff) << 8))
145 #define EVAL_NCCI(fakencci,plci,contr,ncci) { \
146 plci = fakencci & 0x1f; \
147 contr = (fakencci >> 5) & 0x7; \
148 ncci = (fakencci >> 8) & 0xff; \
152 * Layout of PLCI field in a B3 DATA CAPI message is different from
153 * standard at act2000:
156 * Bit 5-7 = Controller
157 * Bit 8-15 = reserved (must be 0)
159 #define MAKE_PLCI(plci,contr) \
160 ((plci & 0x1f) | ((contr & 0x7) << 5))
162 #define EVAL_PLCI(fakeplci,plci,contr) { \
163 plci = fakeplci & 0x1f; \
164 contr = (fakeplci >> 5) & 0x7; \
167 typedef struct actcapi_msg
{
171 struct manufacturer_req_net
{
175 } manufacturer_req_net
;
176 struct manufacturer_req_v42
{
180 } manufacturer_req_v42
;
181 struct manufacturer_conf_v42
{
184 } manufacturer_conf_v42
;
185 struct manufacturer_req_err
{
188 } manufacturer_req_err
;
189 struct manufacturer_ind_err
{
193 __u8 errstring
; /* actually up to 160 */
194 } manufacturer_ind_err
;
195 struct manufacturer_req_msn
{
199 } manufacturer_req_msn
;
200 /* TODO: TraceInit-req/conf/ind/resp and
201 * TraceDump-req/conf/ind/resp
206 __u32 infomask
__attribute__ ((packed
));
212 struct connect_conf
{
224 struct connect_resp
{
228 struct connect_active_ind
{
231 } connect_active_ind
;
232 struct connect_active_resp
{
234 } connect_active_resp
;
235 struct connect_b3_req
{
239 struct connect_b3_conf
{
244 struct connect_b3_ind
{
249 struct connect_b3_resp
{
252 actcapi_ncpi ncpi
__attribute__ ((packed
));
254 struct disconnect_req
{
258 struct disconnect_conf
{
262 struct disconnect_ind
{
266 struct disconnect_resp
{
269 struct connect_b3_active_ind
{
272 } connect_b3_active_ind
;
273 struct connect_b3_active_resp
{
275 } connect_b3_active_resp
;
276 struct disconnect_b3_req
{
280 struct disconnect_b3_conf
{
283 } disconnect_b3_conf
;
284 struct disconnect_b3_ind
{
289 struct disconnect_b3_resp
{
291 } disconnect_b3_resp
;
300 struct listen_b3_req
{
303 struct listen_b3_conf
{
307 struct select_b2_protocol_req
{
310 actcapi_dlpd dlpd
__attribute__ ((packed
));
311 } select_b2_protocol_req
;
312 struct select_b2_protocol_conf
{
315 } select_b2_protocol_conf
;
316 struct select_b3_protocol_req
{
319 actcapi_ncpd ncpd
__attribute__ ((packed
));
320 } select_b3_protocol_req
;
321 struct select_b3_protocol_conf
{
324 } select_b3_protocol_conf
;
331 __u16 dummy
; /* 2 Length-bytes of 2 Structs MUST always be 0!!! */
340 __u32 infomask
__attribute__ ((packed
));
341 __u16 eazmask
__attribute__ ((packed
));
342 __u16 simask
__attribute__ ((packed
));
346 __u16 info
__attribute__ ((packed
));
354 __u16 flags
__attribute__ ((packed
));
361 __u16 flags
__attribute__ ((packed
));
363 struct data_b3_resp
{
367 struct data_b3_conf
{
370 __u16 info
__attribute__ ((packed
));
375 extern __inline__
unsigned short
376 actcapi_nextsmsg(act2000_card
*card
)
385 card
->msgnum
&= 0x7fff;
386 restore_flags(flags
);
390 #undef DEBUG_DATA_MSG
391 #undef DEBUG_DUMP_SKB
393 extern int actcapi_chkhdr(act2000_card
*, actcapi_msghdr
*);
394 extern int actcapi_listen_req(act2000_card
*);
395 extern int actcapi_manufacturer_req_net(act2000_card
*);
396 extern int actcapi_manufacturer_req_v42(act2000_card
*, ulong
);
397 extern int actcapi_manufacturer_req_errh(act2000_card
*);
398 extern int actcapi_manufacturer_req_msn(act2000_card
*);
399 extern int actcapi_connect_req(act2000_card
*, act2000_chan
*, char *, char, int, int);
400 extern void actcapi_select_b2_protocol_req(act2000_card
*, act2000_chan
*);
401 extern void actcapi_disconnect_b3_req(act2000_card
*, act2000_chan
*);
402 extern void actcapi_connect_resp(act2000_card
*, act2000_chan
*, __u8
);
403 extern void actcapi_dispatch(act2000_card
*);
405 extern void actcapi_debug_msg(struct sk_buff
*skb
, int);
407 #define actcapi_debug_msg(skb, len)