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