1 /* $NetBSD: tms320av110var.h,v 1.8 2006/02/16 20:17:16 perry 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 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 /*
40 * Machine independent definitions, declarations and data structures for
41 * access to the TMS320AV110 data sheet.
42 *
43 * Currently, only minimum support for audio output. For audio/video
44 * synchronization, more is needed.
45 */
46
47 #ifndef _TMS320AV110_VAR_H_
48 #define _TMS320AV110_VAR_H_
49
50 #include <machine/bus.h>
51
52 /* softc */
53
54 struct tav_softc {
55 struct device sc_dev;
56
57 bus_space_tag_t sc_iot;
58 bus_space_handle_t sc_ioh;
59
60 /* above audio callback function */
61 void (*sc_intr)(void *);
62 void *sc_intrarg;
63 int sc_bsize;
64
65 /* below audio interrupt acknowledge function. Ignored if NULL */
66 void (*sc_intack)(struct tav_softc *);
67
68 /* initialization from below */
69
70 uint8_t sc_pcm_div; /* passed in */
71 uint8_t sc_pcm_ord; /* passed in */
72 uint8_t sc_pcm_18; /* passed in */
73 uint8_t sc_dif; /* passed in */
74 };
75
76 /* prototypes */
77
78 void tms320av110_attach_mi(struct tav_softc *);
79 int tms320av110_intr(void *);
80
81 static void tav_write_short(bus_space_tag_t, bus_space_handle_t,
82 bus_size_t, uint16_t);
83
84 /* access functions/macros: */
85 /* XXX shouldn't these be in the reg.h file? */
86
87 #define tav_read_byte(ioh, iot, off) bus_space_read_1(ioh, iot, off)
88
89 #define tav_read_short(ioh, iot, off) ( \
90 bus_space_read_1((ioh), (iot), (off)) | \
91 bus_space_read_1((ioh), (iot), (off)+1) << 8)
92
93 #define tav_read_long(ioh, iot, off) ( \
94 bus_space_read_1((ioh), (iot), (off)) | \
95 bus_space_read_1((ioh), (iot), (off)+1) << 8 | \
96 bus_space_read_1((ioh), (iot), (off)+2) << 16 | \
97 bus_space_read_1((ioh), (iot), (off)+3))
98
99 #define tav_read_time(ioh, iot, off) ( \
100 bus_space_read_1((ioh), (iot), (off)) | \
101 bus_space_read_1((ioh), (iot), (off)+1) << 8 | \
102 bus_space_read_1((ioh), (iot), (off)+2) << 16 | \
103 bus_space_read_1((ioh), (iot), (off)+3) << 24 | \
104 bus_space_read_1((ioh), (iot), (off)+4) << 32)
105
106 #define tav_write_byte(ioh, iot, off, v) bus_space_write_1(ioh, iot, off, v)
107
108 static __inline void
109 tav_write_short(bus_space_tag_t iot, bus_space_handle_t ioh,
110 bus_size_t off, uint16_t val)
111 {
112
113 bus_space_write_1(iot, ioh, off+1, (val)>>8);
114 bus_space_write_1(iot, ioh, off, (uint8_t)val);
115 }
116
117 #endif /* _TMS320AV110_VAR_H_ */
Cache object: 0b64b59c1fb6346afa7a8f1701089252
|