Home | History | Annotate | Line # | Download | only in pci
cmpcivar.h revision 1.2.2.1
      1  1.2.2.1   nathanw /*	$NetBSD: cmpcivar.h,v 1.2.2.1 2001/09/21 22:35:54 nathanw Exp $	*/
      2      1.1  augustss 
      3      1.1  augustss /*
      4      1.1  augustss  * Copyright (c) 2000 The NetBSD Foundation, Inc.
      5      1.1  augustss  * All rights reserved.
      6      1.1  augustss  *
      7      1.1  augustss  * This code is derived from software contributed to The NetBSD Foundation
      8      1.2  tshiozak  * by Takuya SHIOZAKI <tshiozak (at) netbsd.org> .
      9      1.1  augustss  *
     10      1.1  augustss  * Redistribution and use in source and binary forms, with or without
     11      1.1  augustss  * modification, are permitted provided that the following conditions
     12      1.1  augustss  * are met:
     13      1.1  augustss  * 1. Redistributions of source code must retain the above copyright
     14      1.1  augustss  *    notice, this list of conditions and the following disclaimer.
     15      1.1  augustss  * 2. Redistributions in binary form must reproduce the above copyright
     16      1.1  augustss  *    notice, this list of conditions and the following disclaimer in the
     17      1.1  augustss  *    documentation and/or other materials provided with the distribution.
     18      1.1  augustss  *
     19      1.1  augustss  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     20      1.1  augustss  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21      1.1  augustss  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22      1.1  augustss  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     23      1.1  augustss  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24      1.1  augustss  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25      1.1  augustss  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26      1.1  augustss  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27      1.1  augustss  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28      1.1  augustss  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29      1.1  augustss  * SUCH DAMAGE.
     30      1.1  augustss  *
     31      1.1  augustss  */
     32      1.1  augustss 
     33      1.1  augustss /* C-Media CMI8x38 Audio Chip Support */
     34      1.1  augustss 
     35      1.1  augustss #ifndef _DEV_PCI_CMPCIVAR_H_
     36      1.1  augustss #define _DEV_PCI_CMPCIVAR_H_ (1)
     37      1.1  augustss 
     38      1.1  augustss 
     39      1.1  augustss /*
     40      1.1  augustss  * DMA pool
     41      1.1  augustss  */
     42      1.1  augustss struct cmpci_dmanode {
     43      1.2  tshiozak 	bus_dma_tag_t		cd_tag;
     44      1.2  tshiozak 	int			cd_nsegs;
     45      1.2  tshiozak 	bus_dma_segment_t	cd_segs[1];
     46      1.2  tshiozak 	bus_dmamap_t		cd_map;
     47      1.2  tshiozak 	caddr_t			cd_addr;
     48      1.2  tshiozak 	size_t			cd_size;
     49      1.2  tshiozak 	struct cmpci_dmanode	*cd_next;
     50      1.1  augustss };
     51      1.1  augustss 
     52      1.1  augustss typedef struct cmpci_dmanode *cmpci_dmapool_t;
     53      1.1  augustss #define KVADDR(dma)  ((void *)(dma)->cd_addr)
     54      1.1  augustss #define DMAADDR(dma) ((dma)->cd_map->dm_segs[0].ds_addr)
     55      1.1  augustss 
     56      1.1  augustss 
     57      1.1  augustss /*
     58      1.1  augustss  * Mixer - SoundBraster16 Compatible
     59      1.1  augustss  */
     60      1.1  augustss #define CMPCI_MASTER_VOL		0
     61      1.1  augustss #define CMPCI_FM_VOL			1
     62      1.1  augustss #define CMPCI_CD_VOL			2
     63      1.1  augustss #define CMPCI_VOICE_VOL			3
     64      1.1  augustss #define CMPCI_OUTPUT_CLASS		4
     65      1.1  augustss 
     66      1.1  augustss #define CMPCI_MIC_VOL			5
     67      1.1  augustss #define CMPCI_LINE_IN_VOL		6
     68      1.1  augustss #define CMPCI_RECORD_SOURCE		7
     69      1.1  augustss #define CMPCI_TREBLE			8
     70      1.1  augustss #define CMPCI_BASS			9
     71      1.1  augustss #define CMPCI_RECORD_CLASS		10
     72      1.1  augustss #define CMPCI_INPUT_CLASS		11
     73      1.1  augustss 
     74      1.1  augustss #define CMPCI_PCSPEAKER			12
     75      1.1  augustss #define CMPCI_INPUT_GAIN		13
     76      1.1  augustss #define CMPCI_OUTPUT_GAIN		14
     77      1.1  augustss #define CMPCI_AGC			15
     78      1.1  augustss #define CMPCI_EQUALIZATION_CLASS	16
     79      1.1  augustss 
     80      1.1  augustss #define CMPCI_CD_IN_MUTE		17
     81      1.1  augustss #define CMPCI_MIC_IN_MUTE		18
     82      1.1  augustss #define CMPCI_LINE_IN_MUTE		19
     83      1.1  augustss #define CMPCI_FM_IN_MUTE		20
     84      1.1  augustss 
     85      1.1  augustss #define CMPCI_CD_SWAP			21
     86      1.1  augustss #define CMPCI_MIC_SWAP			22
     87      1.1  augustss #define CMPCI_LINE_SWAP			23
     88      1.1  augustss #define CMPCI_FM_SWAP			24
     89      1.1  augustss 
     90      1.1  augustss #define CMPCI_CD_OUT_MUTE		25
     91      1.1  augustss #define CMPCI_MIC_OUT_MUTE		26
     92      1.1  augustss #define CMPCI_LINE_OUT_MUTE		27
     93      1.1  augustss 
     94      1.2  tshiozak #define CMPCI_SPDIF_IN_MUTE		28
     95      1.2  tshiozak #define CMPCI_SPDIF_CLASS		29
     96      1.2  tshiozak #define CMPCI_SPDIF_LOOP		30
     97      1.2  tshiozak #define CMPCI_SPDIF_LEGACY		31
     98      1.2  tshiozak #define CMPCI_SPDIF_OUT_VOLTAGE		32
     99      1.2  tshiozak #define CMPCI_SPDIF_IN_PHASE		33
    100      1.2  tshiozak #define CMPCI_REAR			34
    101      1.2  tshiozak #define CMPCI_INDIVIDUAL		35
    102      1.2  tshiozak #define CMPCI_REVERSE			36
    103      1.2  tshiozak #define CMPCI_SURROUND			37
    104      1.1  augustss #define CmpciNspdif			"spdif"
    105      1.2  tshiozak #define CmpciCspdif			"spdif"
    106      1.2  tshiozak #define CmpciNloop			"loop"
    107      1.2  tshiozak #define CmpciNlegacy			"legacy"
    108      1.2  tshiozak #define CmpciNout_voltage		"out_voltage"
    109      1.2  tshiozak #define CmpciNin_phase			"in_phase"
    110      1.2  tshiozak #define CmpciNpositive			"positive"
    111      1.2  tshiozak #define CmpciNnegative			"negative"
    112      1.2  tshiozak #define CmpciNrear			"rear"
    113      1.2  tshiozak #define CmpciNindividual		"individual"
    114      1.2  tshiozak #define CmpciNreverse			"reverse"
    115      1.2  tshiozak #define CmpciNlow_v			"0.5V"
    116      1.2  tshiozak #define CmpciNhigh_v			"5V"
    117      1.2  tshiozak #define CmpciNsurround			"surround"
    118      1.2  tshiozak #define CMPCI_NDEVS			38
    119      1.1  augustss 
    120      1.1  augustss #define CMPCI_IS_IN_MUTE(x) ((x) < CMPCI_CD_SWAP)
    121      1.1  augustss 
    122  1.2.2.1   nathanw /* record sorce bitmap */
    123  1.2.2.1   nathanw #define CMPCI_RECORD_SOURCE_MIC		(1 << 0)
    124  1.2.2.1   nathanw #define CMPCI_RECORD_SOURCE_CD		(1 << 1)
    125  1.2.2.1   nathanw #define CMPCI_RECORD_SOURCE_LINE_IN	(1 << 2)
    126  1.2.2.1   nathanw #define CMPCI_RECORD_SOURCE_FM		(1 << 3)
    127  1.2.2.1   nathanw #define CMPCI_RECORD_SOURCE_SPDIF	(1 << 4)
    128      1.1  augustss 
    129      1.1  augustss /*
    130      1.1  augustss  * softc
    131      1.1  augustss  */
    132      1.1  augustss struct cmpci_softc {
    133      1.2  tshiozak 	struct device		sc_dev;
    134      1.1  augustss 
    135      1.1  augustss 	/* model/rev */
    136      1.2  tshiozak 	uint32_t		sc_id;
    137      1.2  tshiozak 	uint32_t		sc_class;
    138      1.2  tshiozak 	uint32_t		sc_capable;
    139      1.2  tshiozak #define CMPCI_CAP_SPDIN			0x00000001
    140      1.2  tshiozak #define CMPCI_CAP_SPDOUT		0x00000002
    141      1.2  tshiozak #define CMPCI_CAP_SPDLOOP		0x00000004
    142      1.2  tshiozak #define CMPCI_CAP_SPDLEGACY		0x00000008
    143      1.2  tshiozak #define CMPCI_CAP_SPDIN_MONITOR		0x00000010
    144      1.2  tshiozak #define CMPCI_CAP_XSPDOUT		0x00000020
    145      1.2  tshiozak #define CMPCI_CAP_SPDOUT_VOLTAGE	0x00000040
    146      1.2  tshiozak #define CMPCI_CAP_SPDOUT_48K		0x00000080
    147      1.2  tshiozak #define CMPCI_CAP_SURROUND		0x00000100
    148      1.2  tshiozak #define CMPCI_CAP_REAR			0x00000200
    149      1.2  tshiozak #define CMPCI_CAP_INDIVIDUAL_REAR	0x00000400
    150      1.2  tshiozak #define CMPCI_CAP_REVERSE_FR		0x00000800
    151      1.2  tshiozak #define CMPCI_CAP_SPDIN_PHASE		0x00001000
    152      1.2  tshiozak 
    153      1.2  tshiozak #define CMPCI_CAP_CMI8338 	(CMPCI_CAP_SPDIN | CMPCI_CAP_SPDOUT | \
    154      1.2  tshiozak 				CMPCI_CAP_SPDLOOP | CMPCI_CAP_SPDLEGACY)
    155      1.2  tshiozak 
    156      1.2  tshiozak #define CMPCI_CAP_CMI8738	(CMPCI_CAP_CMI8338 | \
    157      1.2  tshiozak 				CMPCI_CAP_SPDIN_MONITOR | \
    158      1.2  tshiozak 				CMPCI_CAP_XSPDOUT | \
    159      1.2  tshiozak 				CMPCI_CAP_SPDOUT_VOLTAGE | \
    160      1.2  tshiozak 				CMPCI_CAP_SPDOUT_48K | CMPCI_CAP_SURROUND |\
    161      1.2  tshiozak 				CMPCI_CAP_REAR | \
    162      1.2  tshiozak 				CMPCI_CAP_INDIVIDUAL_REAR | \
    163      1.2  tshiozak 				CMPCI_CAP_REVERSE_FR | \
    164      1.2  tshiozak 				CMPCI_CAP_SPDIN_PHASE)
    165      1.2  tshiozak #define CMPCI_ISCAP(sc, name)	(sc->sc_capable & CMPCI_CAP_ ## name)
    166      1.1  augustss 
    167      1.1  augustss 	/* I/O Base device */
    168      1.2  tshiozak 	bus_space_tag_t		sc_iot;
    169      1.2  tshiozak 	bus_space_handle_t	sc_ioh;
    170  1.2.2.1   nathanw 
    171  1.2.2.1   nathanw 	bus_space_handle_t	sc_mpu_ioh;
    172  1.2.2.1   nathanw 	struct device		*sc_mpudev;
    173      1.1  augustss 
    174      1.1  augustss 	/* intr handle */
    175      1.2  tshiozak 	pci_intr_handle_t	*sc_ih;
    176      1.1  augustss 
    177      1.1  augustss 	/* DMA */
    178      1.2  tshiozak 	bus_dma_tag_t		sc_dmat;
    179      1.2  tshiozak 	cmpci_dmapool_t		sc_dmap;
    180      1.1  augustss 
    181      1.1  augustss 	/* each channel */
    182      1.1  augustss 	struct {
    183      1.2  tshiozak 		void		(*intr) __P((void *));
    184      1.2  tshiozak 		void		*intr_arg;
    185      1.2  tshiozak 		int		md_divide;
    186      1.1  augustss 	} sc_play, sc_rec;
    187      1.1  augustss 
    188      1.1  augustss 	/* mixer */
    189      1.2  tshiozak 	uint8_t			sc_gain[CMPCI_NDEVS][2];
    190      1.2  tshiozak #define CMPCI_LEFT	0
    191      1.2  tshiozak #define CMPCI_RIGHT	1
    192      1.2  tshiozak #define CMPCI_LR	0
    193      1.2  tshiozak 	uint16_t		sc_in_mask;
    194      1.1  augustss };
    195      1.1  augustss 
    196      1.1  augustss 
    197      1.1  augustss #endif /* _DEV_PCI_CMPCIVAR_H_ */
    198      1.1  augustss 
    199      1.1  augustss /* end of file */
    200