Home | History | Annotate | Line # | Download | only in pci
ydsvar.h revision 1.10.28.1
      1  1.10.28.1      yamt /*	$NetBSD: ydsvar.h,v 1.10.28.1 2012/04/17 00:07:58 yamt Exp $	*/
      2        1.1   minoura 
      3        1.1   minoura /*
      4        1.1   minoura  * Copyright (c) 2000, 2001 Kazuki Sakamoto and Minoura Makoto.
      5        1.1   minoura  * All rights reserved.
      6        1.1   minoura  *
      7        1.1   minoura  * Redistribution and use in source and binary forms, with or without
      8        1.1   minoura  * modification, are permitted provided that the following conditions
      9        1.1   minoura  * are met:
     10        1.1   minoura  * 1. Redistributions of source code must retain the above copyright
     11        1.1   minoura  *    notice, this list of conditions and the following disclaimer.
     12        1.1   minoura  * 2. Redistributions in binary form must reproduce the above copyright
     13        1.1   minoura  *    notice, this list of conditions and the following disclaimer in the
     14        1.1   minoura  *    documentation and/or other materials provided with the distribution.
     15        1.1   minoura  *
     16        1.1   minoura  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17        1.1   minoura  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18        1.1   minoura  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19        1.1   minoura  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20        1.1   minoura  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     21        1.1   minoura  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     22        1.1   minoura  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     23        1.1   minoura  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24        1.1   minoura  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     25        1.1   minoura  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26        1.1   minoura  */
     27        1.1   minoura 
     28        1.1   minoura #ifndef _DEV_PCI_YDSVAR_H_
     29        1.1   minoura #define	_DEV_PCI_YDSVAR_H_
     30        1.1   minoura 
     31        1.1   minoura #define N_PLAY_SLOTS		2		/* We use only 2 (R and L) */
     32        1.1   minoura #define	N_PLAY_SLOT_CTRL	2
     33        1.1   minoura #define WORK_SIZE		0x0400
     34        1.1   minoura 
     35        1.1   minoura /*
     36        1.1   minoura  * softc
     37        1.1   minoura  */
     38        1.1   minoura struct yds_dma {
     39        1.1   minoura 	bus_dmamap_t map;
     40        1.8  christos 	void *addr;			/* VA */
     41        1.1   minoura 	bus_dma_segment_t segs[1];
     42        1.1   minoura 	int nsegs;
     43        1.1   minoura 	size_t size;
     44        1.1   minoura 	struct yds_dma *next;
     45        1.1   minoura };
     46        1.1   minoura 
     47        1.1   minoura struct yds_codec_softc {
     48        1.1   minoura 	struct yds_softc *sc;
     49        1.1   minoura 	int id;
     50        1.1   minoura 	int status_data;
     51        1.1   minoura 	int status_addr;
     52        1.1   minoura 	struct ac97_host_if host_if;
     53        1.1   minoura 	struct ac97_codec_if *codec_if;
     54        1.1   minoura };
     55        1.1   minoura 
     56        1.1   minoura struct yds_softc {
     57       1.10     joerg 	device_t		sc_dev;
     58  1.10.28.1      yamt 	kmutex_t		sc_lock;
     59  1.10.28.1      yamt 	kmutex_t		sc_intr_lock;
     60        1.1   minoura 	pci_chipset_tag_t	sc_pc;
     61        1.1   minoura 	pcitag_t		sc_pcitag;
     62        1.1   minoura 	pcireg_t		sc_id;
     63        1.2    someya 	int			sc_revision;
     64        1.1   minoura 	void			*sc_ih;		/* interrupt vectoring */
     65        1.1   minoura 	bus_space_tag_t		memt;
     66        1.1   minoura 	bus_space_handle_t	memh;
     67        1.1   minoura 	bus_dma_tag_t		sc_dmatag;	/* DMA tag */
     68        1.1   minoura 	u_int			sc_flags;
     69        1.1   minoura 
     70        1.1   minoura 	struct yds_codec_softc	sc_codec[2];	/* Primary/Secondary AC97 */
     71        1.1   minoura 
     72        1.1   minoura 	struct yds_dma		*sc_dmas;	/* List of DMA handles */
     73        1.1   minoura 
     74        1.1   minoura 	/*
     75        1.1   minoura 	 * Play/record status
     76        1.1   minoura 	 */
     77        1.1   minoura 	struct {
     78        1.1   minoura 		void		(*intr)(void *); /* rint/pint */
     79        1.1   minoura 		void		*intr_arg;	/* arg for intr */
     80        1.3      kent 		u_int		offset;		/* filled up to here */
     81        1.3      kent 		u_int		blksize;
     82        1.3      kent 		u_int		factor;		/* byte per sample */
     83        1.1   minoura 		u_int		length;		/* ring buffer length */
     84        1.1   minoura 		struct yds_dma	*dma;		/* DMA handle for ring buf */
     85        1.1   minoura 	} sc_play, sc_rec;
     86        1.1   minoura 
     87        1.1   minoura 	/*
     88        1.1   minoura 	 * DSP control data
     89        1.1   minoura 	 *
     90        1.1   minoura 	 * Work space, play control data table, play slot control data,
     91        1.1   minoura 	 * rec slot control data and effect slot control data are
     92        1.1   minoura 	 * stored in a single memory segment in this order.
     93        1.1   minoura 	 */
     94        1.1   minoura 	struct yds_dma			sc_ctrldata;
     95        1.1   minoura 	/* KVA and offset in buffer of play ctrl data tbl */
     96        1.5      kent 	uint32_t			*ptbl;
     97        1.1   minoura 	off_t				ptbloff;
     98        1.1   minoura 	/* KVA and offset in buffer of rec slot ctrl data */
     99        1.1   minoura 	struct rec_slot_ctrl_bank	*rbank;
    100        1.1   minoura 	off_t				rbankoff;
    101        1.1   minoura 	/* Array of KVA pointers and offset of play slot control data */
    102        1.1   minoura 	struct play_slot_ctrl_bank	*pbankp[N_PLAY_SLOT_CTRL_BANK
    103        1.1   minoura 					       *N_PLAY_SLOTS];
    104        1.1   minoura 	off_t				pbankoff;
    105        1.1   minoura 
    106        1.1   minoura 	/*
    107        1.1   minoura 	 * Legacy support
    108        1.1   minoura 	 */
    109        1.1   minoura 	bus_space_tag_t		sc_legacy_iot;
    110        1.1   minoura 	bus_space_handle_t	sc_opl_ioh;
    111        1.9   xtraeme 	device_t 		sc_mpu;
    112        1.1   minoura 	bus_space_handle_t	sc_mpu_ioh;
    113        1.4      kent 
    114        1.4      kent 	struct audio_encoding_set *sc_encodings;
    115        1.7  jmcneill 
    116        1.7  jmcneill 	/*
    117        1.7  jmcneill 	 * Power management
    118        1.7  jmcneill 	 */
    119        1.7  jmcneill 	struct pci_conf_state	sc_pciconf;
    120        1.7  jmcneill 	pcireg_t		sc_dsctrl;
    121        1.7  jmcneill 	pcireg_t		sc_legacy;
    122        1.7  jmcneill 	pcireg_t		sc_ba[2];
    123        1.1   minoura };
    124        1.1   minoura #define sc_opl_iot	sc_legacy_iot
    125        1.1   minoura #define sc_mpu_iot	sc_legacy_iot
    126        1.1   minoura 
    127        1.1   minoura #endif /* _DEV_PCI_YDSVAR_H_ */
    128