]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/uapi/linux/telephony.h
Merge tag 'pinctrl-v4.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[mirror_ubuntu-bionic-kernel.git] / include / uapi / linux / telephony.h
CommitLineData
e2be04c7 1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
1da177e4
LT
2/******************************************************************************
3 *
4 * telephony.h
5 *
6 * Basic Linux Telephony Interface
7 *
8 * (c) Copyright 1999-2001 Quicknet Technologies, Inc.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 *
15 * Authors: Ed Okerson, <eokerson@quicknet.net>
16 * Greg Herlein, <gherlein@quicknet.net>
17 *
0906dd9d 18 * Contributors: Alan Cox, <alan@lxorguk.ukuu.org.uk>
1da177e4
LT
19 * David W. Erhart, <derhart@quicknet.net>
20 *
21 * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR
22 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
23 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF QUICKNET
24 * TECHNOLOGIES, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * QUICKNET TECHNOLOGIES, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES,
27 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
28 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
29 * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION
30 * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
31 *
1da177e4
LT
32 *****************************************************************************/
33
34#ifndef TELEPHONY_H
35#define TELEPHONY_H
36
37#define TELEPHONY_VERSION 3013
38
39#define PHONE_VENDOR_IXJ 1
40#define PHONE_VENDOR_QUICKNET PHONE_VENDOR_IXJ
41#define PHONE_VENDOR_VOICETRONIX 2
42#define PHONE_VENDOR_ACULAB 3
43#define PHONE_VENDOR_DIGI 4
44#define PHONE_VENDOR_FRANKLIN 5
45
46/******************************************************************************
47 * Vendor Summary Information Area
48 *
49 * Quicknet Technologies, Inc. - makes low density analog telephony cards
50 * with audio compression, POTS and PSTN interfaces (www.quicknet.net)
51 *
52 * (other vendors following this API shuld add a short description of
53 * the telephony products they support under Linux)
54 *
55 *****************************************************************************/
56#define QTI_PHONEJACK 100
57#define QTI_LINEJACK 300
58#define QTI_PHONEJACK_LITE 400
59#define QTI_PHONEJACK_PCI 500
60#define QTI_PHONECARD 600
61
62/******************************************************************************
63*
64* The capabilities ioctls can inform you of the capabilities of each phone
65* device installed in your system. The PHONECTL_CAPABILITIES ioctl
66* returns an integer value indicating the number of capabilities the
67* device has. The PHONECTL_CAPABILITIES_LIST will fill an array of
68* capability structs with all of its capabilities. The
69* PHONECTL_CAPABILITIES_CHECK takes a single capability struct and returns
70* a TRUE if the device has that capability, otherwise it returns false.
71*
72******************************************************************************/
73typedef enum {
74 vendor = 0,
75 device,
76 port,
77 codec,
78 dsp
79} phone_cap;
80
81struct phone_capability {
82 char desc[80];
83 phone_cap captype;
84 int cap;
85 int handle;
86};
87
88typedef enum {
89 pots = 0,
90 pstn,
91 handset,
92 speaker
93} phone_ports;
94
95#define PHONE_CAPABILITIES _IO ('q', 0x80)
96#define PHONE_CAPABILITIES_LIST _IOR ('q', 0x81, struct phone_capability *)
97#define PHONE_CAPABILITIES_CHECK _IOW ('q', 0x82, struct phone_capability *)
98
99typedef struct {
100 char month[3];
101 char day[3];
102 char hour[3];
103 char min[3];
104 int numlen;
105 char number[11];
106 int namelen;
107 char name[80];
108} PHONE_CID;
109
110#define PHONE_RING _IO ('q', 0x83)
111#define PHONE_HOOKSTATE _IO ('q', 0x84)
112#define PHONE_MAXRINGS _IOW ('q', 0x85, char)
113#define PHONE_RING_CADENCE _IOW ('q', 0x86, short)
114#define OLD_PHONE_RING_START _IO ('q', 0x87)
115#define PHONE_RING_START _IOW ('q', 0x87, PHONE_CID *)
116#define PHONE_RING_STOP _IO ('q', 0x88)
117
118#define USA_RING_CADENCE 0xC0C0
119
120#define PHONE_REC_CODEC _IOW ('q', 0x89, int)
121#define PHONE_REC_START _IO ('q', 0x8A)
122#define PHONE_REC_STOP _IO ('q', 0x8B)
123#define PHONE_REC_DEPTH _IOW ('q', 0x8C, int)
124#define PHONE_FRAME _IOW ('q', 0x8D, int)
125#define PHONE_REC_VOLUME _IOW ('q', 0x8E, int)
126#define PHONE_REC_VOLUME_LINEAR _IOW ('q', 0xDB, int)
127#define PHONE_REC_LEVEL _IO ('q', 0x8F)
128
129#define PHONE_PLAY_CODEC _IOW ('q', 0x90, int)
130#define PHONE_PLAY_START _IO ('q', 0x91)
131#define PHONE_PLAY_STOP _IO ('q', 0x92)
132#define PHONE_PLAY_DEPTH _IOW ('q', 0x93, int)
133#define PHONE_PLAY_VOLUME _IOW ('q', 0x94, int)
134#define PHONE_PLAY_VOLUME_LINEAR _IOW ('q', 0xDC, int)
135#define PHONE_PLAY_LEVEL _IO ('q', 0x95)
136#define PHONE_DTMF_READY _IOR ('q', 0x96, int)
137#define PHONE_GET_DTMF _IOR ('q', 0x97, int)
138#define PHONE_GET_DTMF_ASCII _IOR ('q', 0x98, int)
139#define PHONE_DTMF_OOB _IOW ('q', 0x99, int)
140#define PHONE_EXCEPTION _IOR ('q', 0x9A, int)
141#define PHONE_PLAY_TONE _IOW ('q', 0x9B, char)
142#define PHONE_SET_TONE_ON_TIME _IOW ('q', 0x9C, int)
143#define PHONE_SET_TONE_OFF_TIME _IOW ('q', 0x9D, int)
144#define PHONE_GET_TONE_ON_TIME _IO ('q', 0x9E)
145#define PHONE_GET_TONE_OFF_TIME _IO ('q', 0x9F)
146#define PHONE_GET_TONE_STATE _IO ('q', 0xA0)
147#define PHONE_BUSY _IO ('q', 0xA1)
148#define PHONE_RINGBACK _IO ('q', 0xA2)
149#define PHONE_DIALTONE _IO ('q', 0xA3)
150#define PHONE_CPT_STOP _IO ('q', 0xA4)
151
152#define PHONE_PSTN_SET_STATE _IOW ('q', 0xA4, int)
153#define PHONE_PSTN_GET_STATE _IO ('q', 0xA5)
154
155#define PSTN_ON_HOOK 0
156#define PSTN_RINGING 1
157#define PSTN_OFF_HOOK 2
158#define PSTN_PULSE_DIAL 3
159
160/******************************************************************************
161*
162* The wink duration is tunable with this ioctl. The default wink duration
163* is 320ms. You do not need to use this ioctl if you do not require a
164* different wink duration.
165*
166******************************************************************************/
167#define PHONE_WINK_DURATION _IOW ('q', 0xA6, int)
168#define PHONE_WINK _IOW ('q', 0xAA, int)
169
170/******************************************************************************
171*
172* Codec Definitions
173*
174******************************************************************************/
175typedef enum {
176 G723_63 = 1,
177 G723_53 = 2,
178 TS85 = 3,
179 TS48 = 4,
180 TS41 = 5,
181 G728 = 6,
182 G729 = 7,
183 ULAW = 8,
184 ALAW = 9,
185 LINEAR16 = 10,
186 LINEAR8 = 11,
187 WSS = 12,
188 G729B = 13
189} phone_codec;
190
191struct phone_codec_data
192{
193 phone_codec type;
194 unsigned short buf_min, buf_opt, buf_max;
195};
196
197#define PHONE_QUERY_CODEC _IOWR ('q', 0xA7, struct phone_codec_data *)
198#define PHONE_PSTN_LINETEST _IO ('q', 0xA8)
199
200/******************************************************************************
201*
202* This controls the VAD/CNG functionality of G.723.1. The driver will
203* always pass full size frames, any unused bytes will be padded with zeros,
204* and frames passed to the driver should also be padded with zeros. The
205* frame type is encoded in the least significant two bits of the first
206* WORD of the frame as follows:
207*
208* bits 1-0 Frame Type Data Rate Significant Words
209* 00 0 G.723.1 6.3 12
210* 01 1 G.723.1 5.3 10
211* 10 2 VAD/CNG 2
212* 11 3 Repeat last CNG 2 bits
213*
214******************************************************************************/
215#define PHONE_VAD _IOW ('q', 0xA9, int)
216
217
218/******************************************************************************
219*
220* The exception structure allows us to multiplex multiple events onto the
221* select() exception set. If any of these flags are set select() will
222* return with a positive indication on the exception set. The dtmf_ready
223* bit indicates if there is data waiting in the DTMF buffer. The
224* hookstate bit is set if there is a change in hookstate status, it does not
225* indicate the current state of the hookswitch. The pstn_ring bit
226* indicates that the DAA on a LineJACK card has detected ring voltage on
227* the PSTN port. The caller_id bit indicates that caller_id data has been
228* received and is available. The pstn_wink bit indicates that the DAA on
229* the LineJACK has received a wink from the telco switch. The f0, f1, f2
230* and f3 bits indicate that the filter has been triggered by detecting the
231* frequency programmed into that filter.
232*
233* The remaining bits should be set to zero. They will become defined over time
234* for other interface cards and their needs.
235*
236******************************************************************************/
237struct phone_except
238{
239 unsigned int dtmf_ready:1;
240 unsigned int hookstate:1;
241 unsigned int pstn_ring:1;
242 unsigned int caller_id:1;
243 unsigned int pstn_wink:1;
244 unsigned int f0:1;
245 unsigned int f1:1;
246 unsigned int f2:1;
247 unsigned int f3:1;
248 unsigned int flash:1;
249 unsigned int fc0:1;
250 unsigned int fc1:1;
251 unsigned int fc2:1;
252 unsigned int fc3:1;
253 unsigned int reserved:18;
254};
255
256union telephony_exception {
257 struct phone_except bits;
258 unsigned int bytes;
259};
260
261
262#endif /* TELEPHONY_H */
263