xref: /csrg-svn/sys/sparc/dev/bsd_audiovar.h (revision 55103)
1*55103Storek /*
2*55103Storek  * Copyright (c) 1992 The Regents of the University of California.
3*55103Storek  * All rights reserved.
4*55103Storek  *
5*55103Storek  * This software was developed by the Computer Systems Engineering group
6*55103Storek  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7*55103Storek  * contributed to Berkeley.
8*55103Storek  *
9*55103Storek  * %sccs.include.redist.c%
10*55103Storek  *
11*55103Storek  *	@(#)bsd_audiovar.h	7.1 (Berkeley) 07/13/92
12*55103Storek  *
13*55103Storek  * from: $Header: bsd_audiovar.h,v 1.4 92/07/03 23:23:12 mccanne Exp $ (LBL)
14*55103Storek  */
15*55103Storek 
16*55103Storek #define AUCB_SIZE 4096
17*55103Storek #define AUCB_MOD(k)	((k) & (AUCB_SIZE - 1))
18*55103Storek 
19*55103Storek #define AUCB_INIT(cb)	((cb)->cb_head = (cb)->cb_tail = (cb)->cb_drops = \
20*55103Storek 			 (cb)->cb_pdrops = 0)
21*55103Storek 
22*55103Storek #define AUCB_EMPTY(cb)	((cb)->cb_head == (cb)->cb_tail)
23*55103Storek #define AUCB_FULL(cb)	(AUCB_MOD((cb)->cb_tail + 1) == (cb)->cb_head)
24*55103Storek #define AUCB_LEN(cb)	(AUCB_MOD((cb)->cb_tail - (cb)->cb_head))
25*55103Storek 
26*55103Storek #define MAXBLKSIZE (AUCB_SIZE / 2)
27*55103Storek #define DEFBLKSIZE 128
28*55103Storek 
29*55103Storek #ifndef LOCORE
30*55103Storek /*
31*55103Storek  * aucb's are used for communication between the trap handler and
32*55103Storek  * the software interrupt.
33*55103Storek  */
34*55103Storek struct aucb {
35*55103Storek 	int	cb_head;		/* queue head */
36*55103Storek 	int	cb_tail;		/* queue tail */
37*55103Storek 	int	cb_thresh;		/* threshold for wakeup */
38*55103Storek 	u_short	cb_waking;		/* needs wakeup at softint level */
39*55103Storek 	u_short	cb_pause;		/* io paused */
40*55103Storek 	u_long	cb_drops;		/* missed samples from over/underrun */
41*55103Storek 	u_long	cb_pdrops;		/* sun compat -- paused samples */
42*55103Storek 	u_char	cb_data[AUCB_SIZE];	/* data buffer */
43*55103Storek };
44*55103Storek 
45*55103Storek #if !defined(__STDC__) && !defined(volatile)
46*55103Storek #define volatile
47*55103Storek #endif
48*55103Storek 
49*55103Storek struct auio {
50*55103Storek 	volatile struct amd7930 *au_amd;/* chip registers */
51*55103Storek 	u_long	au_stamp;		/* time stamp */
52*55103Storek 	int	au_lowat;		/* xmit low water mark (for wakeup) */
53*55103Storek 	int	au_hiwat;		/* xmit high water mark (for wakeup) */
54*55103Storek 	int	au_blksize;		/* recv block (chunk) size */
55*55103Storek 	struct	aucb au_rb;		/* read (recv) buffer */
56*55103Storek 	struct	aucb au_wb;		/* write (xmit) buffer */
57*55103Storek };
58*55103Storek #endif
59