- Stephen Rothwell: APM updates
[davej-history.git] / include / linux / telephony.h
blob3dd5a969aaa35d38d957b903b1f392351c109d0d
1 /******************************************************************************
3 * telephony.h
5 * Basic Linux Telephony Interface
7 * (c) Copyright 1999 Quicknet Technologies, Inc.
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
14 * Authors: Ed Okerson, <eokerson@quicknet.net>
15 * Greg Herlein, <gherlein@quicknet.net>
17 * Contributors: Alan Cox, <alan@redhat.com>
18 * David W. Erhart, <derhart@quicknet.net>
20 * Version: 0.1.0 - December 19, 1999
22 * Fixes:
24 *****************************************************************************/
26 #ifndef TELEPHONY_H
27 #define TELEPHONY_H
29 #define PHONE_VENDOR_IXJ 1
30 #define PHONE_VENDOR_QUICKNET PHONE_VENDOR_IXJ
31 #define PHONE_VENDOR_VOICETRONIX 2
32 #define PHONE_VENDOR_ACULAB 3
33 #define PHONE_VENDOR_DIGI 4
34 #define PHONE_VENDOR_FRANKLIN 5
36 /******************************************************************************
37 * Vendor Summary Information Area
39 * Quicknet Technologies, Inc. - makes low density analog telephony cards
40 * with audio compression, POTS and PSTN interfaces (www.quicknet.net)
42 * (other vendors following this API shuld add a short description of
43 * the telephony products they support under Linux)
45 *****************************************************************************/
47 /******************************************************************************
49 * The capabilities ioctls can inform you of the capabilities of each phone
50 * device installed in your system. The PHONECTL_CAPABILITIES ioctl
51 * returns an integer value indicating the number of capabilities the
52 * device has. The PHONECTL_CAPABILITIES_LIST will fill an array of
53 * capability structs with all of it's capabilities. The
54 * PHONECTL_CAPABILITIES_CHECK takes a single capability struct and returns
55 * a TRUE if the device has that capability, otherwise it returns false.
57 ******************************************************************************/
58 typedef enum {
59 vendor = 0,
60 device,
61 port,
62 codec,
63 dsp
64 } phone_cap;
66 struct phone_capability {
67 char desc[80];
68 phone_cap captype;
69 int cap;
70 int handle;
73 typedef enum {
74 pots = 0,
75 pstn,
76 handset,
77 speaker
78 } phone_ports;
80 #define PHONE_CAPABILITIES _IO ('q', 0x80)
81 #define PHONE_CAPABILITIES_LIST _IOR ('q', 0x81, struct phone_capability *)
82 #define PHONE_CAPABILITIES_CHECK _IOW ('q', 0x82, struct phone_capability *)
84 typedef struct {
85 char month[3];
86 char day[3];
87 char hour[3];
88 char min[3];
89 int numlen;
90 char number[11];
91 int namelen;
92 char name[80];
93 } PHONE_CID;
95 #define PHONE_RING _IO ('q', 0x83)
96 #define PHONE_HOOKSTATE _IO ('q', 0x84)
97 #define PHONE_MAXRINGS _IOW ('q', 0x85, char)
98 #define PHONE_RING_CADENCE _IOW ('q', 0x86, short)
99 #define OLD_PHONE_RING_START _IO ('q', 0x87)
100 #define PHONE_RING_START _IOW ('q', 0x87, PHONE_CID *)
101 #define PHONE_RING_STOP _IO ('q', 0x88)
103 #define USA_RING_CADENCE 0xC0C0
105 #define PHONE_REC_CODEC _IOW ('q', 0x89, int)
106 #define PHONE_REC_START _IO ('q', 0x8A)
107 #define PHONE_REC_STOP _IO ('q', 0x8B)
108 #define PHONE_REC_DEPTH _IOW ('q', 0x8C, int)
109 #define PHONE_FRAME _IOW ('q', 0x8D, int)
110 #define PHONE_REC_VOLUME _IOW ('q', 0x8E, int)
111 #define PHONE_REC_LEVEL _IO ('q', 0x8F)
113 #define PHONE_PLAY_CODEC _IOW ('q', 0x90, int)
114 #define PHONE_PLAY_START _IO ('q', 0x91)
115 #define PHONE_PLAY_STOP _IO ('q', 0x92)
116 #define PHONE_PLAY_DEPTH _IOW ('q', 0x93, int)
117 #define PHONE_PLAY_VOLUME _IOW ('q', 0x94, int)
118 #define PHONE_PLAY_LEVEL _IO ('q', 0x95)
119 #define PHONE_DTMF_READY _IOR ('q', 0x96, int)
120 #define PHONE_GET_DTMF _IOR ('q', 0x97, int)
121 #define PHONE_GET_DTMF_ASCII _IOR ('q', 0x98, int)
122 #define PHONE_DTMF_OOB _IOW ('q', 0x99, int)
123 #define PHONE_EXCEPTION _IOR ('q', 0x9A, int)
124 #define PHONE_PLAY_TONE _IOW ('q', 0x9B, char)
125 #define PHONE_SET_TONE_ON_TIME _IOW ('q', 0x9C, int)
126 #define PHONE_SET_TONE_OFF_TIME _IOW ('q', 0x9D, int)
127 #define PHONE_GET_TONE_ON_TIME _IO ('q', 0x9E)
128 #define PHONE_GET_TONE_OFF_TIME _IO ('q', 0x9F)
129 #define PHONE_GET_TONE_STATE _IO ('q', 0xA0)
130 #define PHONE_BUSY _IO ('q', 0xA1)
131 #define PHONE_RINGBACK _IO ('q', 0xA2)
132 #define PHONE_DIALTONE _IO ('q', 0xA3)
133 #define PHONE_CPT_STOP _IO ('q', 0xA4)
135 #define PHONE_PSTN_SET_STATE _IOW ('q', 0xA4, int)
136 #define PHONE_PSTN_GET_STATE _IO ('q', 0xA5)
138 #define PSTN_ON_HOOK 0
139 #define PSTN_RINGING 1
140 #define PSTN_OFF_HOOK 2
141 #define PSTN_PULSE_DIAL 3
143 /******************************************************************************
145 * The wink duration is tunable with this ioctl. The default wink duration
146 * is 320ms. You do not need to use this ioctl if you do not require a
147 * different wink duration.
149 ******************************************************************************/
150 #define PHONE_WINK_DURATION _IOW ('q', 0xA6, int)
153 /******************************************************************************
155 * Codec Definitions
157 ******************************************************************************/
158 typedef enum {
159 G723_63 = 1,
160 G723_53 = 2,
161 TS85 = 3,
162 TS48 = 4,
163 TS41 = 5,
164 G728 = 6,
165 G729 = 7,
166 ULAW = 8,
167 ALAW = 9,
168 LINEAR16 = 10,
169 LINEAR8 = 11,
170 WSS = 12
171 } phone_codec;
173 struct phone_codec_data
175 phone_codec type;
176 unsigned short buf_min, buf_opt, buf_max;
179 #define PHONE_QUERY_CODEC _IOWR ('q', 0xA7, struct phone_codec_data *)
180 #define PHONE_PSTN_LINETEST _IO ('q', 0xA8)
182 /******************************************************************************
184 * This controls the VAD/CNG functionality of G.723.1. The driver will
185 * always pass full size frames, any unused bytes will be padded with zeros,
186 * and frames passed to the driver should also be padded with zeros. The
187 * frame type is encoded in the least significant two bits of the first
188 * WORD of the frame as follows:
190 * bits 1-0 Frame Type Data Rate Significant Words
191 * 00 0 G.723.1 6.3 12
192 * 01 1 G.723.1 5.3 10
193 * 10 2 VAD/CNG 2
194 * 11 3 Repeat last CNG 2 bits
196 ******************************************************************************/
197 #define PHONE_VAD _IOW ('q', 0xA9, int)
200 /******************************************************************************
202 * The exception structure allows us to multiplex multiple events onto the
203 * select() exception set. If any of these flags are set select() will
204 * return with a positive indication on the exception set. The dtmf_ready
205 * bit indicates if there is data waiting in the DTMF buffer. The
206 * hookstate bit is set if there is a change in hookstate status, it does not
207 * indicate the current state of the hookswitch. The pstn_ring bit
208 * indicates that the DAA on a LineJACK card has detected ring voltage on
209 * the PSTN port. The caller_id bit indicates that caller_id data has been
210 * recieved and is available. The pstn_wink bit indicates that the DAA on
211 * the LineJACK has recieved a wink from the telco switch. The f0, f1, f2
212 * and f3 bits indicate that the filter has been triggered by detecting the
213 * frequency programmed into that filter.
215 * The remaining bits should be set to zero. They will become defined over time
216 * for other interface cards and their needs.
218 ******************************************************************************/
219 struct phone_except
221 unsigned int dtmf_ready:1;
222 unsigned int hookstate:1;
223 unsigned int pstn_ring:1;
224 unsigned int caller_id:1;
225 unsigned int pstn_wink:1;
226 unsigned int f0:1;
227 unsigned int f1:1;
228 unsigned int f2:1;
229 unsigned int f3:1;
230 unsigned int flash:1;
231 unsigned int fc0:1;
232 unsigned int fc1:1;
233 unsigned int fc2:1;
234 unsigned int fc3:1;
235 unsigned int reserved:18;
238 union telephony_exception {
239 struct phone_except bits;
240 unsigned int bytes;
244 #endif /* TELEPHONY_H */