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