1 /* $OpenBSD: cs4231var.h,v 1.9 2006/06/02 20:00:56 miod 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 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 25 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 * POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Effort sponsored in part by the Defense Advanced Research Projects 29 * Agency (DARPA) and Air Force Research Laboratory, Air Force 30 * Materiel Command, USAF, under agreement number F30602-01-2-0537. 31 * 32 */ 33 34 /* 35 * Driver for CS4231 based audio found in some sun4m systems 36 */ 37 38 /* 39 * List of device memory allocations (see cs4231_malloc/cs4231_free). 40 */ 41 struct cs_dma { 42 struct cs_dma * next; 43 caddr_t addr; 44 bus_dmamap_t dmamap; 45 bus_dma_segment_t segs[1]; 46 int nsegs; 47 size_t size; 48 }; 49 50 struct cs_volume { 51 u_int8_t left; 52 u_int8_t right; 53 }; 54 55 struct cs_channel { 56 void (*cs_intr)(void *); /* interrupt handler */ 57 void *cs_arg; /* interrupt arg */ 58 struct cs_dma *cs_curdma; /* current dma block */ 59 u_int32_t cs_cnt; /* current block count */ 60 u_int32_t cs_blksz; /* current block size */ 61 u_int32_t cs_segsz; /* current segment size */ 62 int cs_locked; /* channel locked? */ 63 }; 64 65 struct cs4231_softc { 66 struct device sc_dev; /* base device */ 67 struct intrhand sc_ih; /* interrupt vectoring */ 68 bus_dma_tag_t sc_dmatag; 69 bus_space_tag_t sc_bustag; /* CS4231/APC register tag */ 70 bus_space_handle_t sc_regs; /* CS4231/APC register handle */ 71 int sc_burst; /* XXX: DMA burst size in effect */ 72 int sc_open; /* already open? */ 73 74 struct cs_channel sc_playback, sc_capture; 75 76 char sc_mute[9]; /* which devs are muted */ 77 u_int8_t sc_out_port; /* output port */ 78 u_int8_t sc_in_port; /* input port */ 79 struct cs_volume sc_volume[9]; /* software volume */ 80 struct cs_volume sc_adc; /* adc volume */ 81 82 int sc_format_bits; 83 int sc_speed_bits; 84 int sc_precision; 85 int sc_need_commit; 86 int sc_channels; 87 struct cs_dma *sc_dmas; /* dma list */ 88 }; 89