xref: /csrg-svn/sys/sparc/dev/bsd_audiovar.h (revision 63318)
155103Storek /*
2*63318Sbostic  * Copyright (c) 1992, 1993
3*63318Sbostic  *	The Regents of the University of California.  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  *
955499Sbostic  * All advertising materials mentioning features or use of this software
1055499Sbostic  * must display the following acknowledgement:
1155499Sbostic  *	This product includes software developed by the University of
1259184Storek  *	California, Lawrence Berkeley Laboratory.
1355499Sbostic  *
1455103Storek  * %sccs.include.redist.c%
1555103Storek  *
16*63318Sbostic  *	@(#)bsd_audiovar.h	8.1 (Berkeley) 06/11/93
1755103Storek  *
1859184Storek  * from: $Header: bsd_audiovar.h,v 1.6 92/11/21 20:46:49 van 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
5359184Storek #if !defined(__STDC__) && !defined(const)
5459184Storek #define const
5559184Storek #endif
5655103Storek 
5755103Storek struct auio {
5855103Storek 	volatile struct amd7930 *au_amd;/* chip registers */
5955103Storek 	u_long	au_stamp;		/* time stamp */
6055103Storek 	int	au_lowat;		/* xmit low water mark (for wakeup) */
6155103Storek 	int	au_hiwat;		/* xmit high water mark (for wakeup) */
6255103Storek 	int	au_blksize;		/* recv block (chunk) size */
6359184Storek 	int	au_backlog;		/* # samples of xmit backlog to gen. */
6455103Storek 	struct	aucb au_rb;		/* read (recv) buffer */
6555103Storek 	struct	aucb au_wb;		/* write (xmit) buffer */
6655103Storek };
6755103Storek #endif
68