1*fd30400eSjakemsr /* $OpenBSD: ce4231var.h,v 1.11 2010/07/26 23:17:19 jakemsr Exp $ */ 26b49f623Sjason 36b49f623Sjason /* 46b49f623Sjason * Copyright (c) 1999 Jason L. Wright (jason@thought.net) 56b49f623Sjason * All rights reserved. 66b49f623Sjason * 76b49f623Sjason * Redistribution and use in source and binary forms, with or without 86b49f623Sjason * modification, are permitted provided that the following conditions 96b49f623Sjason * are met: 106b49f623Sjason * 1. Redistributions of source code must retain the above copyright 116b49f623Sjason * notice, this list of conditions and the following disclaimer. 126b49f623Sjason * 2. Redistributions in binary form must reproduce the above copyright 136b49f623Sjason * notice, this list of conditions and the following disclaimer in the 146b49f623Sjason * documentation and/or other materials provided with the distribution. 156b49f623Sjason * 166b49f623Sjason * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 176b49f623Sjason * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 186b49f623Sjason * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 196b49f623Sjason * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 206b49f623Sjason * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 216b49f623Sjason * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 226b49f623Sjason * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 236b49f623Sjason * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 246b49f623Sjason * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 256b49f623Sjason * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 266b49f623Sjason * 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 * 326b49f623Sjason */ 336b49f623Sjason 346b49f623Sjason /* 356b49f623Sjason * Driver for CS4231/EBDMA based audio found in some sun4u systems 366b49f623Sjason */ 376b49f623Sjason 386b49f623Sjason /* 396b49f623Sjason * List of device memory allocations (see ce4231_malloc/ce4231_free). 406b49f623Sjason */ 416b49f623Sjason struct cs_dma { 426b49f623Sjason struct cs_dma * next; 436b49f623Sjason caddr_t addr; 446b49f623Sjason bus_dmamap_t dmamap; 456b49f623Sjason bus_dma_segment_t segs[1]; 466b49f623Sjason int nsegs; 476b49f623Sjason size_t size; 486b49f623Sjason }; 496b49f623Sjason 506b49f623Sjason struct cs_volume { 516b49f623Sjason u_int8_t left; 526b49f623Sjason u_int8_t right; 536b49f623Sjason }; 546b49f623Sjason 55*fd30400eSjakemsr /* DMA info container for each channel (play and record). */ 56*fd30400eSjakemsr struct cs_chdma { 57*fd30400eSjakemsr struct cs_dma *cur_dma; 58*fd30400eSjakemsr u_int32_t blksz; 59*fd30400eSjakemsr u_int32_t count; 60*fd30400eSjakemsr u_int32_t segsz; 61*fd30400eSjakemsr u_int32_t lastaddr; 62*fd30400eSjakemsr }; 635af2fbe5Sedd 646b49f623Sjason struct ce4231_softc { 656b49f623Sjason struct device sc_dev; /* base device */ 666b49f623Sjason struct intrhand sc_ih; /* interrupt vectoring */ 676b49f623Sjason bus_dma_tag_t sc_dmatag; 686b49f623Sjason bus_space_tag_t sc_bustag; /* CS4231/DMA register tag */ 696b49f623Sjason bus_space_handle_t sc_cshandle; /* CS4231 handle */ 706b49f623Sjason bus_space_handle_t sc_cdmahandle; /* capture DMA handle */ 716b49f623Sjason bus_space_handle_t sc_pdmahandle; /* playback DMA handle */ 726b49f623Sjason bus_space_handle_t sc_auxhandle; /* AUX handle */ 736b49f623Sjason int sc_open; /* already open? */ 746b49f623Sjason 756b49f623Sjason void (*sc_rintr)(void *); /* input completion intr handler */ 766b49f623Sjason void *sc_rarg; /* arg for sc_rintr() */ 776b49f623Sjason void (*sc_pintr)(void *); /* output completion intr handler */ 786b49f623Sjason void *sc_parg; /* arg for sc_pintr() */ 796b49f623Sjason 806b49f623Sjason int sc_format_bits; 816b49f623Sjason int sc_speed_bits; 826b49f623Sjason int sc_precision; 836b49f623Sjason int sc_need_commit; 846b49f623Sjason int sc_channels; 856b49f623Sjason u_int sc_last_format; 866b49f623Sjason u_int32_t sc_burst; 876b49f623Sjason struct cs_dma *sc_dmas; /* dma list */ 88*fd30400eSjakemsr struct cs_chdma sc_pchdma; 89*fd30400eSjakemsr struct cs_chdma sc_rchdma; 90464a640fSjason void *sc_pih, *sc_cih; 916b49f623Sjason }; 92