1 /* $OpenBSD: cmpcivar.h,v 1.2 2000/08/26 13:07:50 kevlo Exp $ */ 2 3 /* 4 * Copyright (c) 2000 Takuya SHIOZAKI 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 AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 */ 29 30 /* C-Media CMI8x38 Audio Chip Support */ 31 32 /* 33 * DMA pool 34 */ 35 struct cmpci_dmanode { 36 bus_dma_tag_t cd_tag; 37 int cd_nsegs; 38 bus_dma_segment_t cd_segs[1]; 39 bus_dmamap_t cd_map; 40 caddr_t cd_addr; 41 size_t cd_size; 42 struct cmpci_dmanode *cd_next; 43 }; 44 45 typedef struct cmpci_dmanode *cmpci_dmapool_t; 46 #define KVADDR(dma) ((void *)(dma)->cd_addr) 47 #define DMAADDR(dma) ((dma)->cd_map->dm_segs[0].ds_addr) 48 49 50 /* 51 * Mixer - SoundBlaster16 Compatible 52 */ 53 #define CMPCI_MASTER_VOL 0 54 #define CMPCI_FM_VOL 1 55 #define CMPCI_CD_VOL 2 56 #define CMPCI_VOICE_VOL 3 57 #define CMPCI_OUTPUT_CLASS 4 58 59 #define CMPCI_MIC_VOL 5 60 #define CMPCI_LINE_IN_VOL 6 61 #define CMPCI_RECORD_SOURCE 7 62 #define CMPCI_TREBLE 8 63 #define CMPCI_BASS 9 64 #define CMPCI_RECORD_CLASS 10 65 #define CMPCI_INPUT_CLASS 11 66 67 #define CMPCI_PCSPEAKER 12 68 #define CMPCI_INPUT_GAIN 13 69 #define CMPCI_OUTPUT_GAIN 14 70 #define CMPCI_AGC 15 71 #define CMPCI_EQUALIZATION_CLASS 16 72 73 #define CMPCI_CD_IN_MUTE 17 74 #define CMPCI_MIC_IN_MUTE 18 75 #define CMPCI_LINE_IN_MUTE 19 76 #define CMPCI_FM_IN_MUTE 20 77 78 #define CMPCI_CD_SWAP 21 79 #define CMPCI_MIC_SWAP 22 80 #define CMPCI_LINE_SWAP 23 81 #define CMPCI_FM_SWAP 24 82 83 #define CMPCI_CD_OUT_MUTE 25 84 #define CMPCI_MIC_OUT_MUTE 26 85 #define CMPCI_LINE_OUT_MUTE 27 86 87 #ifdef CMPCI_SPDIF_SUPPORT 88 #define CMPCI_SPDIF_IN 28 89 #define CMPCI_SPDIF_IN_MUTE 29 90 #define CmpciNspdif "spdif" 91 #define CMPCI_NDEVS 30 92 #else 93 #define CMPCI_NDEVS 28 94 #endif 95 96 #define CMPCI_IS_IN_MUTE(x) ((x) < CMPCI_CD_SWAP) 97 98 99 /* 100 * softc 101 */ 102 struct cmpci_softc { 103 struct device sc_dev; 104 105 /* I/O Base device */ 106 bus_space_tag_t sc_iot; 107 bus_space_handle_t sc_ioh; 108 109 /* intr handle */ 110 pci_intr_handle_t * sc_ih; 111 112 /* DMA */ 113 bus_dma_tag_t sc_dmat; 114 cmpci_dmapool_t sc_dmap; 115 116 /* each channel */ 117 struct { 118 void (*intr) __P((void *)); 119 void *intr_arg; 120 } sc_play, sc_rec; 121 122 /* mixer */ 123 uint8_t gain[CMPCI_NDEVS][2]; 124 #define CMPCI_LEFT 0 125 #define CMPCI_RIGHT 1 126 #define CMPCI_LR 0 127 uint16_t in_mask; 128 }; 129