xref: /csrg-svn/sys/sparc/dev/bsd_audiovar.h (revision 55499)
155103Storek /*
255103Storek  * Copyright (c) 1992 The Regents of the University of California.
355103Storek  * All rights reserved.
455103Storek  *
555103Storek  * This software was developed by the Computer Systems Engineering group
655103Storek  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
755103Storek  * contributed to Berkeley.
855103Storek  *
9*55499Sbostic  * All advertising materials mentioning features or use of this software
10*55499Sbostic  * must display the following acknowledgement:
11*55499Sbostic  *	This product includes software developed by the University of
12*55499Sbostic  *	California, Lawrence Berkeley Laboratories.
13*55499Sbostic  *
1455103Storek  * %sccs.include.redist.c%
1555103Storek  *
16*55499Sbostic  *	@(#)bsd_audiovar.h	7.2 (Berkeley) 07/21/92
1755103Storek  *
1855103Storek  * from: $Header: bsd_audiovar.h,v 1.4 92/07/03 23:23:12 mccanne Exp $ (LBL)
1955103Storek  */
2055103Storek 
2155103Storek #define AUCB_SIZE 4096
2255103Storek #define AUCB_MOD(k)	((k) & (AUCB_SIZE - 1))
2355103Storek 
2455103Storek #define AUCB_INIT(cb)	((cb)->cb_head = (cb)->cb_tail = (cb)->cb_drops = \
2555103Storek 			 (cb)->cb_pdrops = 0)
2655103Storek 
2755103Storek #define AUCB_EMPTY(cb)	((cb)->cb_head == (cb)->cb_tail)
2855103Storek #define AUCB_FULL(cb)	(AUCB_MOD((cb)->cb_tail + 1) == (cb)->cb_head)
2955103Storek #define AUCB_LEN(cb)	(AUCB_MOD((cb)->cb_tail - (cb)->cb_head))
3055103Storek 
3155103Storek #define MAXBLKSIZE (AUCB_SIZE / 2)
3255103Storek #define DEFBLKSIZE 128
3355103Storek 
3455103Storek #ifndef LOCORE
3555103Storek /*
3655103Storek  * aucb's are used for communication between the trap handler and
3755103Storek  * the software interrupt.
3855103Storek  */
3955103Storek struct aucb {
4055103Storek 	int	cb_head;		/* queue head */
4155103Storek 	int	cb_tail;		/* queue tail */
4255103Storek 	int	cb_thresh;		/* threshold for wakeup */
4355103Storek 	u_short	cb_waking;		/* needs wakeup at softint level */
4455103Storek 	u_short	cb_pause;		/* io paused */
4555103Storek 	u_long	cb_drops;		/* missed samples from over/underrun */
4655103Storek 	u_long	cb_pdrops;		/* sun compat -- paused samples */
4755103Storek 	u_char	cb_data[AUCB_SIZE];	/* data buffer */
4855103Storek };
4955103Storek 
5055103Storek #if !defined(__STDC__) && !defined(volatile)
5155103Storek #define volatile
5255103Storek #endif
5355103Storek 
5455103Storek struct auio {
5555103Storek 	volatile struct amd7930 *au_amd;/* chip registers */
5655103Storek 	u_long	au_stamp;		/* time stamp */
5755103Storek 	int	au_lowat;		/* xmit low water mark (for wakeup) */
5855103Storek 	int	au_hiwat;		/* xmit high water mark (for wakeup) */
5955103Storek 	int	au_blksize;		/* recv block (chunk) size */
6055103Storek 	struct	aucb au_rb;		/* read (recv) buffer */
6155103Storek 	struct	aucb au_wb;		/* write (xmit) buffer */
6255103Storek };
6355103Storek #endif
64