xref: /illumos-gate/usr/src/uts/common/sys/audio.h (revision d48be21240dfd051b689384ce2b23479d757f2d8)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1999-2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_SYS_AUDIO_H
28 #define	_SYS_AUDIO_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/types.h>
35 #include <sys/audioio.h>
36 
37 #define	AUDIO_NAME		"audio support"	/* STREAMS module name */
38 #define	AUDIO_VERSION		"Rev 1"		/* 1st version of audio arch. */
39 #define	AUDIO_CONFIGURATION	"Config A"	/* 1st configuration */
40 #define	AUDIO_MOD_NAME		"Audio Device Support"
41 						/* STREAMS modldrv name */
42 
43 #define	AUDIO_PLAY			0x0001		/* output */
44 #define	AUDIO_RECORD			0x0002		/* input */
45 #define	AUDIO_BOTH			(AUDIO_PLAY|AUDIO_RECORD)
46 #define	AUDIO_NO_SLEEP			0x0004
47 #define	AUDIO_SLEEP			0x0008
48 
49 
50 #define	AUDIO_INIT(I, S) {						\
51 		uint8_t *__x__;						\
52 		for (__x__ = (uint8_t *)(I);				\
53 			__x__ < (((uint8_t *)(I)) + (S));		\
54 				*__x__++ = (uint8_t)~0);		\
55 		}
56 
57 /*
58  * Audio support ioctls.
59  */
60 #define	AIOC				('A'<<8)
61 #define	AUDIO_GET_CH_NUMBER		(AIOC|10)
62 #define	AUDIO_GET_CH_TYPE		(AIOC|11)
63 #define	AUDIO_GET_NUM_CHS		(AIOC|12)
64 #define	AUDIO_GET_AD_DEV		(AIOC|13)
65 #define	AUDIO_GET_APM_DEV		(AIOC|14)
66 #define	AUDIO_GET_AS_DEV		(AIOC|15)
67 
68 /*
69  * audio_device_type_e	- type of audio device the channel is associated with.
70  */
71 enum audio_device_type {
72 	UNDEFINED = 0, AUDIO = 1, AUDIOCTL = 2, WTABLE = 3, MIDI = 4,
73 	ATIME = 5, USER1 = 9, USER2 = 10, USER3 = 11
74 };
75 typedef enum audio_device_type audio_device_type_e;
76 
77 /*
78  * audio_channel_t	- structure holds info on individual channels
79  */
80 struct audio_channel {
81 	/*
82 	 * Process ID of the process that has this channel open. If this is
83 	 * set to 0 then the channel isn't owned by any process and is free.
84 	 */
85 	pid_t			pid;
86 
87 	/*
88 	 * When a channel is opened it is a given a new minor number, we always
89 	 * clone the device. The ch_number is directly related to that new
90 	 * minor number. Each open gets a unique channel number.
91 	 */
92 	uint_t			ch_number;
93 
94 	/*
95 	 * Type of audio device opened. This cloned channel retains that
96 	 * type, which determines which Audio Personality Module to use.
97 	 */
98 	audio_device_type_e	dev_type;
99 
100 	/*
101 	 * Each device type has a state structure which describes the hardware.
102 	 * Because each state structure is different we need to know the size
103 	 * for apps to allocate the correct space.
104 	 */
105 	size_t			info_size;
106 
107 	/*
108 	 * The device type's state structure.
109 	 */
110 	void			*info;
111 };
112 typedef struct audio_channel audio_channel_t;
113 
114 #ifdef	__cplusplus
115 }
116 #endif
117 
118 #endif	/* _SYS_AUDIO_H */
119