xref: /original-bsd/sys/sparc/dev/bsd_audiovar.h (revision c73f6197)
1 /*
2  * Copyright (c) 1992, 1993
3  *	The Regents of the University of California.  All rights reserved.
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  *
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
12  *	California, Lawrence Berkeley Laboratory.
13  *
14  * %sccs.include.redist.c%
15  *
16  *	@(#)bsd_audiovar.h	8.1 (Berkeley) 06/11/93
17  *
18  * from: $Header: bsd_audiovar.h,v 1.6 92/11/21 20:46:49 van Exp $ (LBL)
19  */
20 
21 #define AUCB_SIZE 4096
22 #define AUCB_MOD(k)	((k) & (AUCB_SIZE - 1))
23 
24 #define AUCB_INIT(cb)	((cb)->cb_head = (cb)->cb_tail = (cb)->cb_drops = \
25 			 (cb)->cb_pdrops = 0)
26 
27 #define AUCB_EMPTY(cb)	((cb)->cb_head == (cb)->cb_tail)
28 #define AUCB_FULL(cb)	(AUCB_MOD((cb)->cb_tail + 1) == (cb)->cb_head)
29 #define AUCB_LEN(cb)	(AUCB_MOD((cb)->cb_tail - (cb)->cb_head))
30 
31 #define MAXBLKSIZE (AUCB_SIZE / 2)
32 #define DEFBLKSIZE 128
33 
34 #ifndef LOCORE
35 /*
36  * aucb's are used for communication between the trap handler and
37  * the software interrupt.
38  */
39 struct aucb {
40 	int	cb_head;		/* queue head */
41 	int	cb_tail;		/* queue tail */
42 	int	cb_thresh;		/* threshold for wakeup */
43 	u_short	cb_waking;		/* needs wakeup at softint level */
44 	u_short	cb_pause;		/* io paused */
45 	u_long	cb_drops;		/* missed samples from over/underrun */
46 	u_long	cb_pdrops;		/* sun compat -- paused samples */
47 	u_char	cb_data[AUCB_SIZE];	/* data buffer */
48 };
49 
50 #if !defined(__STDC__) && !defined(volatile)
51 #define volatile
52 #endif
53 #if !defined(__STDC__) && !defined(const)
54 #define const
55 #endif
56 
57 struct auio {
58 	volatile struct amd7930 *au_amd;/* chip registers */
59 	u_long	au_stamp;		/* time stamp */
60 	int	au_lowat;		/* xmit low water mark (for wakeup) */
61 	int	au_hiwat;		/* xmit high water mark (for wakeup) */
62 	int	au_blksize;		/* recv block (chunk) size */
63 	int	au_backlog;		/* # samples of xmit backlog to gen. */
64 	struct	aucb au_rb;		/* read (recv) buffer */
65 	struct	aucb au_wb;		/* write (xmit) buffer */
66 };
67 #endif
68