[PATCH] Kprobes: Track kprobe on a per_cpu basis - i386 changes
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / asm-sparc64 / audioio.h
blobcf16173f521b00a026c3a4eceb8f243fb1ab52fa
1 /*
2 * include/asm-sparc/audioio.h
4 * Sparc Audio Midlayer
5 * Copyright (C) 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu)
6 */
8 #ifndef _AUDIOIO_H_
9 #define _AUDIOIO_H_
12 * SunOS/Solaris /dev/audio interface
15 #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
16 #include <linux/types.h>
17 #include <linux/time.h>
18 #include <linux/ioctl.h>
19 #endif
22 * This structure contains state information for audio device IO streams.
24 typedef struct audio_prinfo {
26 * The following values describe the audio data encoding.
28 unsigned int sample_rate; /* samples per second */
29 unsigned int channels; /* number of interleaved channels */
30 unsigned int precision; /* bit-width of each sample */
31 unsigned int encoding; /* data encoding method */
34 * The following values control audio device configuration
36 unsigned int gain; /* gain level: 0 - 255 */
37 unsigned int port; /* selected I/O port (see below) */
38 unsigned int avail_ports; /* available I/O ports (see below) */
39 unsigned int _xxx[2]; /* Reserved for future use */
41 unsigned int buffer_size; /* I/O buffer size */
44 * The following values describe driver state
46 unsigned int samples; /* number of samples converted */
47 unsigned int eof; /* End Of File counter (play only) */
49 unsigned char pause; /* non-zero for pause, zero to resume */
50 unsigned char error; /* non-zero if overflow/underflow */
51 unsigned char waiting; /* non-zero if a process wants access */
52 unsigned char balance; /* stereo channel balance */
54 unsigned short minordev;
57 * The following values are read-only state flags
59 unsigned char open; /* non-zero if open access permitted */
60 unsigned char active; /* non-zero if I/O is active */
61 } audio_prinfo_t;
65 * This structure describes the current state of the audio device.
67 typedef struct audio_info {
69 * Per-stream information
71 audio_prinfo_t play; /* output status information */
72 audio_prinfo_t record; /* input status information */
75 * Per-unit/channel information
77 unsigned int monitor_gain; /* input to output mix: 0 - 255 */
78 unsigned char output_muted; /* non-zero if output is muted */
79 unsigned char _xxx[3]; /* Reserved for future use */
80 unsigned int _yyy[3]; /* Reserved for future use */
81 } audio_info_t;
85 * Audio encoding types
87 #define AUDIO_ENCODING_NONE (0) /* no encoding assigned */
88 #define AUDIO_ENCODING_ULAW (1) /* u-law encoding */
89 #define AUDIO_ENCODING_ALAW (2) /* A-law encoding */
90 #define AUDIO_ENCODING_LINEAR (3) /* Linear PCM encoding */
91 #define AUDIO_ENCODING_FLOAT (4) /* IEEE float (-1. <-> +1.) */
92 #define AUDIO_ENCODING_DVI (104) /* DVI ADPCM */
93 #define AUDIO_ENCODING_LINEAR8 (105) /* 8 bit UNSIGNED */
94 #define AUDIO_ENCODING_LINEARLE (106) /* Linear PCM LE encoding */
97 * These ranges apply to record, play, and monitor gain values
99 #define AUDIO_MIN_GAIN (0) /* minimum gain value */
100 #define AUDIO_MAX_GAIN (255) /* maximum gain value */
103 * These values apply to the balance field to adjust channel gain values
105 #define AUDIO_LEFT_BALANCE (0) /* left channel only */
106 #define AUDIO_MID_BALANCE (32) /* equal left/right channel */
107 #define AUDIO_RIGHT_BALANCE (64) /* right channel only */
108 #define AUDIO_BALANCE_SHIFT (3)
111 * Generic minimum/maximum limits for number of channels, both modes
113 #define AUDIO_MIN_PLAY_CHANNELS (1)
114 #define AUDIO_MAX_PLAY_CHANNELS (4)
115 #define AUDIO_MIN_REC_CHANNELS (1)
116 #define AUDIO_MAX_REC_CHANNELS (4)
119 * Generic minimum/maximum limits for sample precision
121 #define AUDIO_MIN_PLAY_PRECISION (8)
122 #define AUDIO_MAX_PLAY_PRECISION (32)
123 #define AUDIO_MIN_REC_PRECISION (8)
124 #define AUDIO_MAX_REC_PRECISION (32)
127 * Define some convenient names for typical audio ports
130 * output ports (several may be enabled simultaneously)
132 #define AUDIO_SPEAKER 0x01 /* output to built-in speaker */
133 #define AUDIO_HEADPHONE 0x02 /* output to headphone jack */
134 #define AUDIO_LINE_OUT 0x04 /* output to line out */
137 * input ports (usually only one at a time)
139 #define AUDIO_MICROPHONE 0x01 /* input from microphone */
140 #define AUDIO_LINE_IN 0x02 /* input from line in */
141 #define AUDIO_CD 0x04 /* input from on-board CD inputs */
142 #define AUDIO_INTERNAL_CD_IN AUDIO_CD /* input from internal CDROM */
143 #define AUDIO_ANALOG_LOOPBACK 0x40 /* input from output */
147 * This macro initializes an audio_info structure to 'harmless' values.
148 * Note that (~0) might not be a harmless value for a flag that was
149 * a signed int.
151 #define AUDIO_INITINFO(i) { \
152 unsigned int *__x__; \
153 for (__x__ = (unsigned int *)(i); \
154 (char *) __x__ < (((char *)(i)) + sizeof (audio_info_t)); \
155 *__x__++ = ~0); \
159 * These allow testing for what the user wants to set
161 #define AUD_INITVALUE (~0)
162 #define Modify(X) ((unsigned int)(X) != AUD_INITVALUE)
163 #define Modifys(X) ((X) != (unsigned short)AUD_INITVALUE)
164 #define Modifyc(X) ((X) != (unsigned char)AUD_INITVALUE)
167 * Parameter for the AUDIO_GETDEV ioctl to determine current
168 * audio devices.
170 #define MAX_AUDIO_DEV_LEN (16)
171 typedef struct audio_device {
172 char name[MAX_AUDIO_DEV_LEN];
173 char version[MAX_AUDIO_DEV_LEN];
174 char config[MAX_AUDIO_DEV_LEN];
175 } audio_device_t;
179 * Ioctl calls for the audio device.
183 * AUDIO_GETINFO retrieves the current state of the audio device.
185 * AUDIO_SETINFO copies all fields of the audio_info structure whose
186 * values are not set to the initialized value (-1) to the device state.
187 * It performs an implicit AUDIO_GETINFO to return the new state of the
188 * device. Note that the record.samples and play.samples fields are set
189 * to the last value before the AUDIO_SETINFO took effect. This allows
190 * an application to reset the counters while atomically retrieving the
191 * last value.
193 * AUDIO_DRAIN suspends the calling process until the write buffers are
194 * empty.
196 * AUDIO_GETDEV returns a structure of type audio_device_t which contains
197 * three strings. The string "name" is a short identifying string (for
198 * example, the SBus Fcode name string), the string "version" identifies
199 * the current version of the device, and the "config" string identifies
200 * the specific configuration of the audio stream. All fields are
201 * device-dependent -- see the device specific manual pages for details.
203 * AUDIO_GETDEV_SUNOS returns a number which is an audio device defined
204 * herein (making it not too portable)
206 * AUDIO_FLUSH stops all playback and recording, clears all queued buffers,
207 * resets error counters, and restarts recording and playback as appropriate
208 * for the current sampling mode.
210 #define AUDIO_GETINFO _IOR('A', 1, audio_info_t)
211 #define AUDIO_SETINFO _IOWR('A', 2, audio_info_t)
212 #define AUDIO_DRAIN _IO('A', 3)
213 #define AUDIO_GETDEV _IOR('A', 4, audio_device_t)
214 #define AUDIO_GETDEV_SUNOS _IOR('A', 4, int)
215 #define AUDIO_FLUSH _IO('A', 5)
217 /* Define possible audio hardware configurations for
218 * old SunOS-style AUDIO_GETDEV ioctl */
219 #define AUDIO_DEV_UNKNOWN (0) /* not defined */
220 #define AUDIO_DEV_AMD (1) /* audioamd device */
221 #define AUDIO_DEV_SPEAKERBOX (2) /* dbri device with speakerbox */
222 #define AUDIO_DEV_CODEC (3) /* dbri device (internal speaker) */
223 #define AUDIO_DEV_CS4231 (5) /* cs4231 device */
226 * The following ioctl sets the audio device into an internal loopback mode,
227 * if the hardware supports this. The argument is TRUE to set loopback,
228 * FALSE to reset to normal operation. If the hardware does not support
229 * internal loopback, the ioctl should fail with EINVAL.
230 * Causes ADC data to be digitally mixed in and sent to the DAC.
232 #define AUDIO_DIAG_LOOPBACK _IOW('A', 101, int)
234 #endif /* _AUDIOIO_H_ */