BSD 4_4_Lite1 release
[unix-history] / usr / src / sys / sparc / include / bsd_audioio.h
CommitLineData
90587a41 1/*
ad787160
C
2 * Copyright (c) 1991, 1992, 1993
3 * The Regents of the University of California. All rights reserved.
90587a41
CT
4 *
5 * This software was developed by the Computer Systems Engineering group
6 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7 * contributed to Berkeley.
8 *
b480239a
KB
9 * All advertising materials mentioning features or use of this software
10 * must display the following acknowledgement:
11 * This product includes software developed by the University of
c8cc9df9 12 * California, Lawrence Berkeley Laboratory.
b480239a 13 *
ad787160
C
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 * 3. All advertising materials mentioning features or use of this software
23 * must display the following acknowledgement:
24 * This product includes software developed by the University of
25 * California, Berkeley and its contributors.
26 * 4. Neither the name of the University nor the names of its contributors
27 * may be used to endorse or promote products derived from this software
28 * without specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
31 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
34 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 * SUCH DAMAGE.
90587a41 41 *
ad787160 42 * @(#)bsd_audioio.h 8.1 (Berkeley) 6/11/93
90587a41 43 *
c8cc9df9 44 * from: $Header: bsd_audioio.h,v 1.5 92/11/21 20:46:46 van Exp $ (LBL)
90587a41
CT
45 */
46
47#ifndef _BSD_AUDIOIO_H_
48#define _BSD_AUDIOIO_H_
49
50/*
51 * /dev/audio ioctls. needs comments!
52 */
c8cc9df9
CT
53#define AUDIO_MIN_GAIN (0)
54#define AUDIO_MAX_GAIN (255)
90587a41 55
c8cc9df9
CT
56#define AUDIO_ENCODING_ULAW (1)
57#define AUDIO_ENCODING_ALAW (2)
90587a41
CT
58
59struct audio_prinfo {
60 u_int sample_rate;
61 u_int channels;
62 u_int precision;
63 u_int encoding;
64 u_int gain;
65 u_int port;
c8cc9df9
CT
66 u_long seek; /* BSD extension */
67 u_int ispare[3];
90587a41 68 u_int samples;
c8cc9df9 69 u_int eof;
90587a41
CT
70
71 u_char pause;
72 u_char error;
73 u_char waiting;
c8cc9df9 74 u_char cspare[3];
90587a41 75 u_char open;
c8cc9df9 76 u_char active;
90587a41 77
90587a41
CT
78};
79
80struct audio_info {
81 struct audio_prinfo play;
82 struct audio_prinfo record;
83 u_int monitor_gain;
84 /* BSD extensions */
85 u_int blocksize; /* input blocking threshold */
86 u_int hiwat; /* output high water mark */
87 u_int lowat; /* output low water mark */
c8cc9df9 88 u_int backlog; /* samples of output backlog to gen. */
90587a41
CT
89};
90typedef struct audio_info audio_info_t;
91
92#define AUDIO_INITINFO(p)\
93 (void)memset((void *)(p), 0xff, sizeof(struct audio_info))
94
95#if (defined(sun) || defined(ibm032)) && !defined(__GNUC__)
c8cc9df9
CT
96#define AUDIO_GETINFO _IOR(A, 21, struct audio_info)
97#define AUDIO_SETINFO _IOWR(A, 22, struct audio_info)
98#define AUDIO_DRAIN _IO(A, 23)
99#define AUDIO_FLUSH _IO(A, 24)
100#define AUDIO_WSEEK _IOR(A, 25, u_long)
101#define AUDIO_RERROR _IOR(A, 26, int)
102#define AUDIO_GETMAP _IOR(A, 27, struct mapreg)
103#define AUDIO_SETMAP _IOW(A, 28, struct mapreg)
90587a41 104#else
c8cc9df9
CT
105#define AUDIO_GETINFO _IOR('A', 21, struct audio_info)
106#define AUDIO_SETINFO _IOWR('A', 22, struct audio_info)
107#define AUDIO_DRAIN _IO('A', 23)
108#define AUDIO_FLUSH _IO('A', 24)
109#define AUDIO_WSEEK _IOR('A', 25, u_long)
110#define AUDIO_RERROR _IOR('A', 26, int)
111#define AUDIO_GETMAP _IOR('A', 27, struct mapreg)
112#define AUDIO_SETMAP _IOW('A', 28, struct mapreg)
90587a41
CT
113#endif
114
115#define AUDIO_SPEAKER 1
116#define AUDIO_HEADPHONE 2
117
118/*
119 * Low level interface.
120 */
121struct mapreg {
122 u_short mr_x[8];
123 u_short mr_r[8];
124 u_short mr_gx;
125 u_short mr_gr;
126 u_short mr_ger;
127 u_short mr_stgr;
128 u_short mr_ftgr;
129 u_short mr_atgr;
130 u_char mr_mmr1;
131 u_char mr_mmr2;
132};
133
134#endif /* _BSD_AUDIOIO_H_ */