Annotation of sys/dev/audiovar.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: audiovar.h,v 1.9 2002/08/26 16:20:04 mickey Exp $ */
2: /* $NetBSD: audiovar.h,v 1.18 1998/03/03 09:16:16 augustss Exp $ */
3:
4: /*
5: * Copyright (c) 1991-1993 Regents of the University of California.
6: * All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: * 3. All advertising materials mentioning features or use of this software
17: * must display the following acknowledgement:
18: * This product includes software developed by the Computer Systems
19: * Engineering Group at Lawrence Berkeley Laboratory.
20: * 4. Neither the name of the University nor of the Laboratory may be used
21: * to endorse or promote products derived from this software without
22: * specific prior written permission.
23: *
24: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34: * SUCH DAMAGE.
35: *
36: * From: Header: audiovar.h,v 1.3 93/07/18 14:07:25 mccanne Exp (LBL)
37: */
38:
39: /*
40: * Initial/default block duration is both configurable and patchable.
41: */
42: #ifndef AUDIO_BLK_MS
43: #define AUDIO_BLK_MS 50 /* 50 ms */
44: #endif
45:
46: #ifndef AU_RING_SIZE
47: #define AU_RING_SIZE 65536
48: #endif
49:
50: #define AUMINBUF 512
51: #define AUMINBLK 32
52: #define AUMINNOBLK 2
53: struct audio_ringbuffer {
54: int bufsize; /* allocated memory */
55: int blksize; /* I/O block size */
56: int maxblks; /* no of blocks in ring */
57: u_char *start; /* start of buffer area */
58: u_char *end; /* end of buffer area */
59: u_char *inp; /* input pointer (to buffer) */
60: u_char *outp; /* output pointer (from buffer) */
61: int used; /* no of used bytes */
62: int usedlow; /* start writer when used falls below this */
63: int usedhigh; /* stop writer when used goes above this */
64: u_long stamp; /* bytes transferred */
65: u_long stamp_last; /* old value of bytes transferred */
66: u_long drops; /* missed samples from over/underrun */
67: u_long pdrops; /* paused samples */
68: char pause; /* transfer is paused */
69: char copying; /* data is being copied */
70: char needfill; /* buffer needs filling when copying is done */
71: char mmapped; /* device is mmap()-ed */
72: };
73:
74: #define AUDIO_N_PORTS 4
75:
76: struct au_mixer_ports {
77: int index;
78: int master;
79: int nports;
80: u_char isenum;
81: u_int allports;
82: u_int aumask[AUDIO_N_PORTS];
83: u_int misel [AUDIO_N_PORTS];
84: u_int miport[AUDIO_N_PORTS];
85: };
86:
87: /*
88: * Software state, per audio device.
89: */
90: struct audio_softc {
91: struct device dev;
92: void *hw_hdl; /* Hardware driver handle */
93: struct audio_hw_if *hw_if; /* Hardware interface */
94: struct device *sc_dev; /* Hardware device struct */
95: u_char sc_open; /* single use device */
96: #define AUOPEN_READ 0x01
97: #define AUOPEN_WRITE 0x02
98: u_char sc_mode; /* bitmask for RECORD/PLAY */
99:
100: struct selinfo sc_wsel; /* write selector */
101: struct selinfo sc_rsel; /* read selector */
102: struct proc *sc_async_audio; /* process who wants audio SIGIO */
103: struct mixer_asyncs {
104: struct mixer_asyncs *next;
105: struct proc *proc;
106: } *sc_async_mixer; /* processes who want mixer SIGIO */
107:
108: /* Sleep channels for reading and writing. */
109: int sc_rchan;
110: int sc_wchan;
111:
112: /* Ring buffers, separate for record and play. */
113: struct audio_ringbuffer sc_rr; /* Record ring */
114: struct audio_ringbuffer sc_pr; /* Play ring */
115:
116: u_char sc_blkset; /* Blocksize has been set */
117:
118: u_char *sc_sil_start; /* start of silence in buffer */
119: int sc_sil_count; /* # of silence bytes */
120:
121: u_char sc_rbus; /* input dma in progress */
122: u_char sc_pbus; /* output dma in progress */
123:
124: struct audio_params sc_pparams; /* play encoding parameters */
125: struct audio_params sc_rparams; /* record encoding parameters */
126:
127: int sc_eof; /* EOF, i.e. zero sized write, counter */
128: u_long sc_wstamp;
129: u_long sc_playdrop;
130:
131: int sc_full_duplex; /* device in full duplex mode */
132:
133: struct au_mixer_ports sc_inports, sc_outports;
134: int sc_monitor_port;
135:
136: int sc_refcnt;
137: int sc_dying;
138:
139: #ifdef AUDIO_INTR_TIME
140: u_long sc_pfirstintr; /* first time we saw a play interrupt */
141: int sc_pnintr; /* number of interrupts */
142: u_long sc_plastintr; /* last time we saw a play interrupt */
143: long sc_pblktime; /* nominal time between interrupts */
144: u_long sc_rfirstintr; /* first time we saw a rec interrupt */
145: int sc_rnintr; /* number of interrupts */
146: u_long sc_rlastintr; /* last time we saw a rec interrupt */
147: long sc_rblktime; /* nominal time between interrupts */
148: #endif
149: };
CVSweb