Home | History | Annotate | Line # | Download | only in ic
tms320av110var.h revision 1.11.8.1
      1  1.11.8.1       tls /*	$NetBSD: tms320av110var.h,v 1.11.8.1 2012/11/20 03:02:08 tls Exp $	*/
      2       1.1        is 
      3       1.1        is /*-
      4       1.3        is  * Copyright (c) 1997 The NetBSD Foundation, Inc.
      5       1.2        is  * All rights reserved.
      6       1.2        is  *
      7       1.2        is  * This code is derived from software contributed to The NetBSD Foundation
      8       1.2        is  * by Ignatios Souvatzis.
      9       1.1        is  *
     10       1.1        is  * Redistribution and use in source and binary forms, with or without
     11       1.1        is  * modification, are permitted provided that the following conditions
     12       1.1        is  * are met:
     13       1.1        is  * 1. Redistributions of source code must retain the above copyright
     14       1.1        is  *    notice, this list of conditions and the following disclaimer.
     15       1.1        is  * 2. Redistributions in binary form must reproduce the above copyright
     16       1.1        is  *    notice, this list of conditions and the following disclaimer in the
     17       1.1        is  *    documentation and/or other materials provided with the distribution.
     18       1.1        is  *
     19       1.2        is  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20       1.2        is  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21       1.2        is  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22       1.2        is  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23       1.2        is  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24       1.2        is  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25       1.2        is  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26       1.2        is  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27       1.2        is  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28       1.2        is  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29       1.2        is  * POSSIBILITY OF SUCH DAMAGE.
     30       1.1        is  */
     31       1.1        is 
     32       1.1        is /*
     33       1.1        is  * Machine independent definitions, declarations and data structures for
     34       1.1        is  * access to the TMS320AV110 data sheet.
     35       1.1        is  *
     36       1.1        is  * Currently, only minimum support for audio output. For audio/video
     37       1.1        is  * synchronization, more is needed.
     38       1.1        is  */
     39       1.1        is 
     40       1.1        is #ifndef _TMS320AV110_VAR_H_
     41       1.1        is #define _TMS320AV110_VAR_H_
     42       1.1        is 
     43       1.9        ad #include <sys/bus.h>
     44       1.1        is 
     45       1.1        is /* softc */
     46       1.1        is 
     47       1.1        is struct tav_softc {
     48  1.11.8.1       tls 	device_t	sc_dev;
     49      1.11  jmcneill 	kmutex_t	sc_lock;
     50      1.11  jmcneill 	kmutex_t	sc_intr_lock;
     51      1.11  jmcneill 	kcondvar_t	sc_cv;
     52       1.1        is 
     53       1.1        is 	bus_space_tag_t sc_iot;
     54       1.1        is 	bus_space_handle_t sc_ioh;
     55       1.1        is 
     56       1.1        is 	/* above audio callback function */
     57       1.5      kent 	void		(*sc_intr)(void *);
     58       1.5      kent 	void		*sc_intrarg;
     59       1.1        is 	int		sc_bsize;
     60       1.1        is 
     61       1.4       wiz 	/* below audio interrupt acknowledge function. Ignored if NULL */
     62       1.5      kent 	void		(*sc_intack)(struct tav_softc *);
     63       1.1        is 
     64       1.1        is 	/* initialization from below */
     65       1.1        is 
     66       1.5      kent 	uint8_t		sc_pcm_div;	/* passed in */
     67       1.5      kent 	uint8_t		sc_pcm_ord;	/* passed in */
     68       1.5      kent 	uint8_t		sc_pcm_18;	/* passed in */
     69       1.5      kent 	uint8_t		sc_dif;	/* passed in */
     70       1.1        is };
     71       1.1        is 
     72       1.1        is /* prototypes */
     73       1.1        is 
     74       1.5      kent void tms320av110_attach_mi(struct tav_softc *);
     75       1.5      kent int tms320av110_intr(void *);
     76       1.1        is 
     77       1.5      kent static void tav_write_short(bus_space_tag_t, bus_space_handle_t,
     78       1.5      kent     bus_size_t, uint16_t);
     79       1.1        is 
     80       1.1        is /* access functions/macros: */
     81       1.1        is /* XXX shouldn't these be in the reg.h file? */
     82       1.1        is 
     83       1.1        is #define tav_read_byte(ioh, iot, off) bus_space_read_1(ioh, iot, off)
     84       1.1        is 
     85       1.1        is #define tav_read_short(ioh, iot, off)	(		\
     86       1.5      kent 	bus_space_read_1((ioh), (iot), (off))	|	\
     87       1.1        is 	bus_space_read_1((ioh), (iot), (off)+1) << 8)
     88       1.1        is 
     89       1.1        is #define tav_read_long(ioh, iot, off)	(		\
     90       1.5      kent 	bus_space_read_1((ioh), (iot), (off))	|	\
     91       1.1        is 	bus_space_read_1((ioh), (iot), (off)+1) << 8 |	\
     92       1.1        is 	bus_space_read_1((ioh), (iot), (off)+2) << 16 |	\
     93       1.1        is 	bus_space_read_1((ioh), (iot), (off)+3))
     94       1.1        is 
     95       1.1        is #define tav_read_time(ioh, iot, off)	(		\
     96       1.5      kent 	bus_space_read_1((ioh), (iot), (off))	|	\
     97       1.1        is 	bus_space_read_1((ioh), (iot), (off)+1) << 8 |	\
     98       1.1        is 	bus_space_read_1((ioh), (iot), (off)+2) << 16 |	\
     99       1.1        is 	bus_space_read_1((ioh), (iot), (off)+3) << 24 |	\
    100       1.1        is 	bus_space_read_1((ioh), (iot), (off)+4) << 32)
    101       1.1        is 
    102       1.1        is #define tav_write_byte(ioh, iot, off, v) bus_space_write_1(ioh, iot, off, v)
    103       1.1        is 
    104       1.8     perry static __inline void
    105       1.5      kent tav_write_short(bus_space_tag_t iot, bus_space_handle_t ioh,
    106       1.5      kent     bus_size_t off, uint16_t val)
    107       1.1        is {
    108       1.5      kent 
    109       1.1        is 	bus_space_write_1(iot, ioh, off+1, (val)>>8);
    110       1.5      kent 	bus_space_write_1(iot, ioh, off,  (uint8_t)val);
    111       1.1        is }
    112       1.1        is 
    113       1.1        is #endif /* _TMS320AV110_VAR_H_ */
    114