1 /* $NetBSD: melody.c,v 1.14 2007/10/17 19:53:17 garbled Exp $ */
4 * Copyright (c) 1997 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Ignatios Souvatzis.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
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.
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.
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: melody.c,v 1.14 2007/10/17 19:53:17 garbled Exp $");
36 * Melody audio driver.
38 * Currently, only minimum support for audio output. For audio/video
39 * synchronization, more is needed.
42 #include <sys/types.h>
43 #include <sys/param.h>
44 #include <sys/systm.h>
45 #include <sys/kernel.h>
46 #include <sys/device.h>
48 #include <dev/ic/tms320av110reg.h>
49 #include <dev/ic/tms320av110var.h>
51 #include <machine/bus.h>
53 #include <amiga/dev/zbusvar.h>
54 #include <amiga/amiga/isr.h>
57 struct tav_softc sc_tav
;
58 struct bus_space_tag sc_bst_leftbyte
;
63 int melody_match(struct device
*, struct cfdata
*, void *);
64 void melody_attach(struct device
*, struct device
*, void *);
65 void melody_intack(struct tav_softc
*);
67 CFATTACH_DECL(melody
, sizeof(struct melody_softc
),
68 melody_match
, melody_attach
, NULL
, NULL
);
71 melody_match(struct device
*parent
, struct cfdata
*cfp
, void *aux
)
73 struct zbus_args
*zap
;
76 if (zap
->manid
!= 2145)
79 if (zap
->prodid
!= 128)
86 melody_attach(struct device
*parent
, struct device
*self
, void *aux
)
88 struct melody_softc
*sc
;
89 struct zbus_args
*zap
;
91 bus_space_handle_t ioh
;
93 sc
= (struct melody_softc
*)self
;
96 sc
->sc_bst_leftbyte
.base
= (u_long
)zap
->va
+ 0;
97 sc
->sc_bst_leftbyte
.absm
= &amiga_bus_stride_2
;
98 sc
->sc_intack
= (uint8_t *)zap
->va
+ 0xc000;
100 /* set up board specific part in sc_tav */
102 iot
= &sc
->sc_bst_leftbyte
;
104 if (bus_space_map(iot
, 0, 128, 0, &ioh
)) {
105 panic("melody: cant bus_space_map");
108 sc
->sc_tav
.sc_iot
= iot
;
109 sc
->sc_tav
.sc_ioh
= ioh
;
110 sc
->sc_tav
.sc_pcm_ord
= 0;
111 sc
->sc_tav
.sc_pcm_18
= 0;
112 sc
->sc_tav
.sc_dif
= 0;
113 sc
->sc_tav
.sc_pcm_div
= 12;
116 * Attach option boards now. They might provide additional
117 * functionality to our audio part.
120 /* attach our audio driver */
122 printf(" #%d", zap
->serno
);
123 tms320av110_attach_mi(&sc
->sc_tav
);
124 sc
->sc_isr
.isr_ipl
= 6;
125 sc
->sc_isr
.isr_arg
= &sc
->sc_tav
;
126 sc
->sc_isr
.isr_intr
= tms320av110_intr
;
127 add_isr(&sc
->sc_isr
);
131 melody_intack(struct tav_softc
*p
)
133 struct melody_softc
*sc
;
135 sc
= (struct melody_softc
*)p
;