ce4231var.h revision 1.5
1/*	$OpenBSD: ce4231var.h,v 1.5 2002/04/08 17:49:42 jason Exp $	*/
2
3/*
4 * Copyright (c) 1999 Jason L. Wright (jason@thought.net)
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 *    must display the following acknowledgement:
17 *	This product includes software developed by Jason L. Wright
18 * 4. The name of the author may not be used to endorse or promote products
19 *    derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 *
33 * Effort sponsored in part by the Defense Advanced Research Projects
34 * Agency (DARPA) and Air Force Research Laboratory, Air Force
35 * Materiel Command, USAF, under agreement number F30602-01-2-0537.
36 *
37 */
38
39/*
40 * Driver for CS4231/EBDMA based audio found in some sun4u systems
41 */
42
43/*
44 * List of device memory allocations (see ce4231_malloc/ce4231_free).
45 */
46struct cs_dma {
47	struct cs_dma *		next;
48	caddr_t			addr;
49	bus_dmamap_t		dmamap;
50	bus_dma_segment_t	segs[1];
51	int			nsegs;
52	size_t			size;
53};
54
55struct cs_volume {
56	u_int8_t	left;
57	u_int8_t	right;
58};
59
60struct ce4231_softc {
61	struct	device sc_dev;		/* base device */
62	struct	sbusdev sc_sd;		/* sbus device */
63	struct	intrhand sc_ih;		/* interrupt vectoring */
64	bus_dma_tag_t sc_dmatag;
65	bus_space_tag_t	sc_bustag;	/* CS4231/DMA register tag */
66	bus_space_handle_t sc_cshandle;	/* CS4231 handle */
67	bus_space_handle_t sc_cdmahandle; /* capture DMA handle */
68	bus_space_handle_t sc_pdmahandle; /* playback DMA handle */
69	bus_space_handle_t sc_auxhandle;  /* AUX handle */
70	struct	evcnt sc_intrcnt;	/* statistics */
71	int	sc_open;		/* already open? */
72	int	sc_locked;		/* locked? */
73
74	void	(*sc_rintr)(void *);	/* input completion intr handler */
75	void	*sc_rarg;		/* arg for sc_rintr() */
76	void	(*sc_pintr)(void *);	/* output completion intr handler */
77	void	*sc_parg;		/* arg for sc_pintr() */
78
79	char		sc_mute[9];	/* which devs are muted */
80	u_int8_t	sc_out_port;	/* output port */
81	struct	cs_volume sc_volume[9];	/* software volume */
82
83	int sc_format_bits;
84	int sc_speed_bits;
85	int sc_precision;
86	int sc_need_commit;
87	int sc_channels;
88	u_int sc_last_format;
89	u_int32_t	sc_blksz;
90	u_int32_t	sc_playcnt;
91	u_int32_t	sc_playsegsz;
92	u_int32_t	sc_burst;
93	u_int32_t	sc_lastaddr;
94	struct cs_dma	*sc_dmas;	/* dma list */
95	struct cs_dma	*sc_nowplaying;
96	void *sc_pih, *sc_cih;
97};
98