include upstream ip1000a driver version 2.09f
[linux-2.4.git] / drivers / isdn / eicon / eicon_dsp.h
1 /* $Id: eicon_dsp.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2  *
3  * ISDN lowlevel-module for Eicon active cards.
4  * DSP definitions
5  *
6  * Copyright 1999,2000  by Armin Schindler (mac@melware.de)
7  * Copyright 1999,2000  Cytronics & Melware (info@melware.de)
8  *
9  * This software may be used and distributed according to the terms
10  * of the GNU General Public License, incorporated herein by reference.
11  *
12  */
13
14 #ifndef DSP_H 
15 #define DSP_H
16
17 #include "dsp_defs.h"
18
19
20 #define DSP_UDATA_REQUEST_SWITCH_FRAMER         1
21 /*
22 parameters:
23   <byte> transmit framer type
24   <byte> receive framer type
25 */
26
27 #define DSP_REQUEST_SWITCH_FRAMER_HDLC          0
28 #define DSP_REQUEST_SWITCH_FRAMER_TRANSPARENT   1
29 #define DSP_REQUEST_SWITCH_FRAMER_ASYNC         2
30
31
32 #define DSP_UDATA_REQUEST_CLEARDOWN             2
33 /*
34 parameters:
35   - none -
36 */
37
38
39 #define DSP_UDATA_REQUEST_TX_CONFIRMATION_ON    3
40 /*
41 parameters:
42   - none -
43 */
44
45
46 #define DSP_UDATA_REQUEST_TX_CONFIRMATION_OFF   4
47 /*
48 parameters:
49   - none -
50 */
51
52 typedef struct eicon_dsp_ind {
53         __u16   time            __attribute__ ((packed));
54         __u8    norm            __attribute__ ((packed));
55         __u16   options         __attribute__ ((packed));
56         __u32   speed           __attribute__ ((packed));
57         __u16   delay           __attribute__ ((packed));
58         __u32   txspeed         __attribute__ ((packed));
59         __u32   rxspeed         __attribute__ ((packed));
60 } eicon_dsp_ind;
61
62 #define DSP_CONNECTED_OPTION_V42_TRANS           0x0002
63 #define DSP_CONNECTED_OPTION_V42_LAPM            0x0004
64 #define DSP_CONNECTED_OPTION_SHORT_TRAIN         0x0008
65 #define DSP_CONNECTED_OPTION_TALKER_ECHO_PROTECT 0x0010
66
67 #define DSP_UDATA_INDICATION_DISCONNECT         5
68 /*
69 returns:
70   <byte> cause
71 */
72
73 #define DSP_DISCONNECT_CAUSE_NONE               0x00
74 #define DSP_DISCONNECT_CAUSE_BUSY_TONE          0x01
75 #define DSP_DISCONNECT_CAUSE_CONGESTION_TONE    0x02
76 #define DSP_DISCONNECT_CAUSE_INCOMPATIBILITY    0x03
77 #define DSP_DISCONNECT_CAUSE_CLEARDOWN          0x04
78 #define DSP_DISCONNECT_CAUSE_TRAINING_TIMEOUT   0x05
79
80 #define DSP_UDATA_INDICATION_TX_CONFIRMATION    6
81 /*
82 returns:
83   <word> confirmation number
84 */
85
86
87 #define DSP_UDATA_REQUEST_SEND_DTMF_DIGITS      16
88 /*
89 parameters:
90   <word> tone duration (ms)
91   <word> gap duration (ms)
92   <byte> digit 0 tone code
93   ...
94   <byte> digit n tone code
95 */
96
97 #define DSP_SEND_DTMF_DIGITS_HEADER_LENGTH      5
98
99 #define DSP_DTMF_DIGIT_TONE_LOW_GROUP_697_HZ    0x00
100 #define DSP_DTMF_DIGIT_TONE_LOW_GROUP_770_HZ    0x01
101 #define DSP_DTMF_DIGIT_TONE_LOW_GROUP_852_HZ    0x02
102 #define DSP_DTMF_DIGIT_TONE_LOW_GROUP_941_HZ    0x03
103 #define DSP_DTMF_DIGIT_TONE_LOW_GROUP_MASK      0x03
104 #define DSP_DTMF_DIGIT_TONE_HIGH_GROUP_1209_HZ  0x00
105 #define DSP_DTMF_DIGIT_TONE_HIGH_GROUP_1336_HZ  0x04
106 #define DSP_DTMF_DIGIT_TONE_HIGH_GROUP_1477_HZ  0x08
107 #define DSP_DTMF_DIGIT_TONE_HIGH_GROUP_1633_HZ  0x0c
108 #define DSP_DTMF_DIGIT_TONE_HIGH_GROUP_MASK     0x0c
109
110 #define DSP_DTMF_DIGIT_TONE_CODE_0              0x07
111 #define DSP_DTMF_DIGIT_TONE_CODE_1              0x00
112 #define DSP_DTMF_DIGIT_TONE_CODE_2              0x04
113 #define DSP_DTMF_DIGIT_TONE_CODE_3              0x08
114 #define DSP_DTMF_DIGIT_TONE_CODE_4              0x01
115 #define DSP_DTMF_DIGIT_TONE_CODE_5              0x05
116 #define DSP_DTMF_DIGIT_TONE_CODE_6              0x09
117 #define DSP_DTMF_DIGIT_TONE_CODE_7              0x02
118 #define DSP_DTMF_DIGIT_TONE_CODE_8              0x06
119 #define DSP_DTMF_DIGIT_TONE_CODE_9              0x0a
120 #define DSP_DTMF_DIGIT_TONE_CODE_STAR           0x03
121 #define DSP_DTMF_DIGIT_TONE_CODE_HASHMARK       0x0b
122 #define DSP_DTMF_DIGIT_TONE_CODE_A              0x0c
123 #define DSP_DTMF_DIGIT_TONE_CODE_B              0x0d
124 #define DSP_DTMF_DIGIT_TONE_CODE_C              0x0e
125 #define DSP_DTMF_DIGIT_TONE_CODE_D              0x0f
126
127
128 #define DSP_UDATA_INDICATION_DTMF_DIGITS_SENT   16
129 /*
130 returns:
131   - none -
132   One indication will be sent for every request.
133 */
134
135
136 #define DSP_UDATA_REQUEST_ENABLE_DTMF_RECEIVER  17
137 /*
138 parameters:
139   <word> tone duration (ms)
140   <word> gap duration (ms)
141 */
142 typedef struct enable_dtmf_s {
143         __u16 tone;
144         __u16 gap;
145 } enable_dtmf_s;
146
147 #define DSP_UDATA_REQUEST_DISABLE_DTMF_RECEIVER 18
148 /*
149 parameters:
150   - none -
151 */
152
153 #define DSP_UDATA_INDICATION_DTMF_DIGITS_RECEIVED 17
154 /*
155 returns:
156   <byte> digit 0 tone code
157   ...
158   <byte> digit n tone code
159 */
160
161 #define DSP_DTMF_DIGITS_RECEIVED_HEADER_LENGTH  1
162
163
164 #define DSP_UDATA_INDICATION_MODEM_CALLING_TONE 18
165 /*
166 returns:
167   - none -
168 */
169
170 #define DSP_UDATA_INDICATION_FAX_CALLING_TONE   19
171 /*
172 returns:
173   - none -
174 */
175
176 #define DSP_UDATA_INDICATION_ANSWER_TONE        20
177 /*
178 returns:
179   - none -
180 */
181
182 /* ============= FAX ================ */
183
184 #define EICON_FAXID_LEN 20
185
186 typedef struct eicon_t30_s {
187   __u8          code;
188   __u8          rate;
189   __u8          resolution;
190   __u8          format;
191   __u8          pages_low;
192   __u8          pages_high;
193   __u8          atf;
194   __u8          control_bits_low;
195   __u8          control_bits_high;
196   __u8          feature_bits_low;
197   __u8          feature_bits_high;
198   __u8          universal_5;
199   __u8          universal_6;
200   __u8          universal_7;
201   __u8          station_id_len;
202   __u8          head_line_len;
203   __u8          station_id[EICON_FAXID_LEN];
204 /* __u8          head_line[]; */
205 } eicon_t30_s;
206
207         /* EDATA transmit messages */
208 #define EDATA_T30_DIS       0x01
209 #define EDATA_T30_FTT       0x02
210 #define EDATA_T30_MCF       0x03
211
212         /* EDATA receive messages */
213 #define EDATA_T30_DCS       0x81
214 #define EDATA_T30_TRAIN_OK  0x82
215 #define EDATA_T30_EOP       0x83
216 #define EDATA_T30_MPS       0x84
217 #define EDATA_T30_EOM       0x85
218 #define EDATA_T30_DTC       0x86
219
220 #define T30_FORMAT_SFF            0
221 #define T30_FORMAT_ASCII          1
222 #define T30_FORMAT_COUNT          2
223
224 #define T30_CONTROL_BIT_DISABLE_FINE      0x0001
225 #define T30_CONTROL_BIT_ENABLE_ECM        0x0002
226 #define T30_CONTROL_BIT_ECM_64_BYTES      0x0004
227 #define T30_CONTROL_BIT_ENABLE_2D_CODING  0x0008
228 #define T30_CONTROL_BIT_ENABLE_T6_CODING  0x0010
229 #define T30_CONTROL_BIT_ENABLE_UNCOMPR    0x0020
230 #define T30_CONTROL_BIT_ACCEPT_POLLING    0x0040
231 #define T30_CONTROL_BIT_REQUEST_POLLING   0x0080
232 #define T30_CONTROL_BIT_MORE_DOCUMENTS    0x0100
233
234 #define T30_CONTROL_BIT_ALL_FEATURES\
235   (T30_CONTROL_BIT_ENABLE_ECM | T30_CONTROL_BIT_ENABLE_2D_CODING |\
236    T30_CONTROL_BIT_ENABLE_T6_CODING | T30_CONTROL_BIT_ENABLE_UNCOMPR)
237
238 #define T30_FEATURE_BIT_FINE              0x0001
239 #define T30_FEATURE_BIT_ECM               0x0002
240 #define T30_FEATURE_BIT_ECM_64_BYTES      0x0004
241 #define T30_FEATURE_BIT_2D_CODING         0x0008
242 #define T30_FEATURE_BIT_T6_CODING         0x0010
243 #define T30_FEATURE_BIT_UNCOMPR_ENABLED   0x0020
244 #define T30_FEATURE_BIT_POLLING           0x0040
245
246 #define FAX_OBJECT_DOCU         1
247 #define FAX_OBJECT_PAGE         2
248 #define FAX_OBJECT_LINE         3
249
250 #define T4_EOL                  0x800
251 #define T4_EOL_BITSIZE          12
252 #define T4_EOL_DWORD            (T4_EOL << (32 - T4_EOL_BITSIZE))
253 #define T4_EOL_MASK_DWORD       ((__u32) -1 << (32 - T4_EOL_BITSIZE))
254
255 #define SFF_LEN_FLD_SIZE        3
256
257 #define _DLE_   0x10
258 #define _ETX_   0x03
259
260 typedef struct eicon_sff_dochead {
261         __u32   id              __attribute__ ((packed));
262         __u8    version         __attribute__ ((packed));
263         __u8    reserved1       __attribute__ ((packed));
264         __u16   userinfo        __attribute__ ((packed));
265         __u16   pagecount       __attribute__ ((packed));
266         __u16   off1pagehead    __attribute__ ((packed));
267         __u32   offnpagehead    __attribute__ ((packed));
268         __u32   offdocend       __attribute__ ((packed));
269 } eicon_sff_dochead;
270
271 typedef struct eicon_sff_pagehead {
272         __u8    pageheadid      __attribute__ ((packed));
273         __u8    pageheadlen     __attribute__ ((packed));
274         __u8    resvert         __attribute__ ((packed));
275         __u8    reshoriz        __attribute__ ((packed));
276         __u8    coding          __attribute__ ((packed));
277         __u8    reserved2       __attribute__ ((packed));
278         __u16   linelength      __attribute__ ((packed));
279         __u16   pagelength      __attribute__ ((packed));
280         __u32   offprevpage     __attribute__ ((packed));
281         __u32   offnextpage     __attribute__ ((packed));
282 } eicon_sff_pagehead;
283
284 #endif  /* DSP_H */
285