Home | History | Annotate | Download | only in sys
      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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
     31 
     32 #ifdef	__cplusplus
     33 extern "C" {
     34 #endif
     35 
     36 #include <sys/types.h>
     37 #include <sys/audioio.h>
     38 
     39 #define	AUDIO_NAME		"audio support"	/* STREAMS module name */
     40 #define	AUDIO_VERSION		"Rev 1"		/* 1st version of audio arch. */
     41 #define	AUDIO_CONFIGURATION	"Config A"	/* 1st configuration */
     42 #define	AUDIO_MOD_NAME		"Audio Device Support"
     43 						/* STREAMS modldrv name */
     44 
     45 #define	AUDIO_PLAY			0x0001		/* output */
     46 #define	AUDIO_RECORD			0x0002		/* input */
     47 #define	AUDIO_BOTH			(AUDIO_PLAY|AUDIO_RECORD)
     48 #define	AUDIO_NO_SLEEP			0x0004
     49 #define	AUDIO_SLEEP			0x0008
     50 
     51 
     52 #define	AUDIO_INIT(I, S) {						\
     53 		uint8_t *__x__;						\
     54 		for (__x__ = (uint8_t *)(I);				\
     55 			__x__ < (((uint8_t *)(I)) + (S));		\
     56 				*__x__++ = (uint8_t)~0);		\
     57 		}
     58 
     59 /*
     60  * Audio support ioctls.
     61  */
     62 #define	AIOC				('A'<<8)
     63 #define	AUDIO_GET_CH_NUMBER		(AIOC|10)
     64 #define	AUDIO_GET_CH_TYPE		(AIOC|11)
     65 #define	AUDIO_GET_NUM_CHS		(AIOC|12)
     66 #define	AUDIO_GET_AD_DEV		(AIOC|13)
     67 #define	AUDIO_GET_APM_DEV		(AIOC|14)
     68 #define	AUDIO_GET_AS_DEV		(AIOC|15)
     69 
     70 /*
     71  * audio_device_type_e	- type of audio device the channel is associated with.
     72  */
     73 enum audio_device_type {
     74 	UNDEFINED = 0, AUDIO = 1, AUDIOCTL = 2, WTABLE = 3, MIDI = 4,
     75 	ATIME = 5, USER1 = 9, USER2 = 10, USER3 = 11
     76 };
     77 typedef enum audio_device_type audio_device_type_e;
     78 
     79 /*
     80  * audio_channel_t	- structure holds info on individual channels
     81  */
     82 struct audio_channel {
     83 	/*
     84 	 * Process ID of the process that has this channel open. If this is
     85 	 * set to 0 then the channel isn't owned by any process and is free.
     86 	 */
     87 	pid_t			pid;
     88 
     89 	/*
     90 	 * When a channel is opened it is a given a new minor number, we always
     91 	 * clone the device. The ch_number is directly related to that new
     92 	 * minor number. Each open gets a unique channel number.
     93 	 */
     94 	uint_t			ch_number;
     95 
     96 	/*
     97 	 * Type of audio device opened. This cloned channel retains that
     98 	 * type, which determines which Audio Personality Module to use.
     99 	 */
    100 	audio_device_type_e	dev_type;
    101 
    102 	/*
    103 	 * Each device type has a state structure which describes the hardware.
    104 	 * Because each state structure is different we need to know the size
    105 	 * for apps to allocate the correct space.
    106 	 */
    107 	size_t			info_size;
    108 
    109 	/*
    110 	 * The device type's state structure.
    111 	 */
    112 	void			*info;
    113 };
    114 typedef struct audio_channel audio_channel_t;
    115 
    116 #ifdef	__cplusplus
    117 }
    118 #endif
    119 
    120 #endif	/* _SYS_AUDIO_H */
    121