1*6f8537cbSmiod /* $OpenBSD: cs4231var.h,v 1.9 2006/06/02 20:00:56 miod Exp $ */ 27f529f01Sjason 37f529f01Sjason /* 47f529f01Sjason * Copyright (c) 1999 Jason L. Wright (jason@thought.net) 57f529f01Sjason * All rights reserved. 67f529f01Sjason * 77f529f01Sjason * Redistribution and use in source and binary forms, with or without 87f529f01Sjason * modification, are permitted provided that the following conditions 97f529f01Sjason * are met: 107f529f01Sjason * 1. Redistributions of source code must retain the above copyright 117f529f01Sjason * notice, this list of conditions and the following disclaimer. 127f529f01Sjason * 2. Redistributions in binary form must reproduce the above copyright 137f529f01Sjason * notice, this list of conditions and the following disclaimer in the 147f529f01Sjason * documentation and/or other materials provided with the distribution. 157f529f01Sjason * 167f529f01Sjason * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 177f529f01Sjason * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 187f529f01Sjason * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 197f529f01Sjason * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 207f529f01Sjason * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 217f529f01Sjason * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 227f529f01Sjason * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 237f529f01Sjason * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 247f529f01Sjason * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 257f529f01Sjason * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 267f529f01Sjason * POSSIBILITY OF SUCH DAMAGE. 275248d82bSjason * 285248d82bSjason * Effort sponsored in part by the Defense Advanced Research Projects 295248d82bSjason * Agency (DARPA) and Air Force Research Laboratory, Air Force 305248d82bSjason * Materiel Command, USAF, under agreement number F30602-01-2-0537. 315248d82bSjason * 327f529f01Sjason */ 337f529f01Sjason 347f529f01Sjason /* 357f529f01Sjason * Driver for CS4231 based audio found in some sun4m systems 367f529f01Sjason */ 377f529f01Sjason 387f529f01Sjason /* 397f529f01Sjason * List of device memory allocations (see cs4231_malloc/cs4231_free). 407f529f01Sjason */ 417f529f01Sjason struct cs_dma { 427f529f01Sjason struct cs_dma * next; 437f529f01Sjason caddr_t addr; 447f529f01Sjason bus_dmamap_t dmamap; 457f529f01Sjason bus_dma_segment_t segs[1]; 467f529f01Sjason int nsegs; 477f529f01Sjason size_t size; 487f529f01Sjason }; 497f529f01Sjason 507f529f01Sjason struct cs_volume { 517f529f01Sjason u_int8_t left; 527f529f01Sjason u_int8_t right; 537f529f01Sjason }; 547f529f01Sjason 559820c8cbSjason struct cs_channel { 569820c8cbSjason void (*cs_intr)(void *); /* interrupt handler */ 579820c8cbSjason void *cs_arg; /* interrupt arg */ 589820c8cbSjason struct cs_dma *cs_curdma; /* current dma block */ 599820c8cbSjason u_int32_t cs_cnt; /* current block count */ 609820c8cbSjason u_int32_t cs_blksz; /* current block size */ 619820c8cbSjason u_int32_t cs_segsz; /* current segment size */ 629820c8cbSjason int cs_locked; /* channel locked? */ 639820c8cbSjason }; 649820c8cbSjason 657f529f01Sjason struct cs4231_softc { 667f529f01Sjason struct device sc_dev; /* base device */ 677f529f01Sjason struct intrhand sc_ih; /* interrupt vectoring */ 687f529f01Sjason bus_dma_tag_t sc_dmatag; 697f529f01Sjason bus_space_tag_t sc_bustag; /* CS4231/APC register tag */ 707f529f01Sjason bus_space_handle_t sc_regs; /* CS4231/APC register handle */ 717f529f01Sjason int sc_burst; /* XXX: DMA burst size in effect */ 727f529f01Sjason int sc_open; /* already open? */ 737f529f01Sjason 749820c8cbSjason struct cs_channel sc_playback, sc_capture; 757f529f01Sjason 767f529f01Sjason char sc_mute[9]; /* which devs are muted */ 777f529f01Sjason u_int8_t sc_out_port; /* output port */ 789820c8cbSjason u_int8_t sc_in_port; /* input port */ 797f529f01Sjason struct cs_volume sc_volume[9]; /* software volume */ 809820c8cbSjason struct cs_volume sc_adc; /* adc volume */ 817f529f01Sjason 827f529f01Sjason int sc_format_bits; 837f529f01Sjason int sc_speed_bits; 847f529f01Sjason int sc_precision; 857f529f01Sjason int sc_need_commit; 867f529f01Sjason int sc_channels; 877f529f01Sjason struct cs_dma *sc_dmas; /* dma list */ 887f529f01Sjason }; 89