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