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