1 /* $NetBSD: cs4231var.h,v 1.7 2007/03/04 06:01:53 christos Exp $ */
4 * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _DEV_IC_CS4231VAR_H_
33 #define _DEV_IC_CS4231VAR_H_
35 #define AUDIOCS_PROM_NAME "SUNW,CS4231"
38 * List of device memory allocations (see cs4231_malloc/cs4231_free).
44 bus_dma_segment_t segs
[1];
51 * DMA transfer to/from CS4231.
54 int t_active
; /* this transfer is currently active */
55 struct cs_dma
*t_dma
; /* dma memory to transfer from/to */
56 vsize_t t_segsz
; /* size of the segment */
57 vsize_t t_blksz
; /* call audio(9) after this many bytes */
58 vsize_t t_cnt
; /* how far are we into the segment */
60 void (*t_intr
)(void*); /* audio(9) callback */
63 const char *t_name
; /* for error/debug messages */
65 struct evcnt t_intrcnt
;
66 struct evcnt t_ierrcnt
;
71 * Software state, per CS4231 audio chip.
74 struct ad1848_softc sc_ad1848
; /* base device */
76 bus_space_tag_t sc_bustag
;
77 bus_dma_tag_t sc_dmatag
;
79 struct cs_dma
*sc_dmas
; /* allocated dma resources */
81 struct evcnt sc_intrcnt
; /* parent counter */
83 struct cs_transfer sc_playback
;
84 struct cs_transfer sc_capture
;
89 * Bus independent code shared by sbus and ebus attachments.
91 void cs4231_common_attach(struct cs4231_softc
*, bus_space_handle_t
);
92 int cs4231_transfer_init(struct cs4231_softc
*, struct cs_transfer
*,
93 bus_addr_t
*, bus_size_t
*,
94 void *, void *, int, void (*)(void *), void *);
95 void cs4231_transfer_advance(struct cs_transfer
*,
96 bus_addr_t
*, bus_size_t
*);
100 * Bus independent audio(9) methods.
102 int cs4231_open(void *, int);
103 void cs4231_close(void *);
104 int cs4231_getdev(void *, struct audio_device
*);
105 int cs4231_set_port(void *, mixer_ctrl_t
*);
106 int cs4231_get_port(void *, mixer_ctrl_t
*);
107 int cs4231_query_devinfo(void *, mixer_devinfo_t
*);
108 int cs4231_get_props(void *);
110 void *cs4231_malloc(void *, int, size_t, struct malloc_type
*, int);
111 void cs4231_free(void *, void *, struct malloc_type
*);
113 #endif /* _DEV_IC_CS4231VAR_H_ */