Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic - init panpot at reset
details: https://anonhg.NetBSD.org/src/rev/4c89fad39099
branches: trunk
changeset: 542833:4c89fad39099
user: itohy <itohy%NetBSD.org@localhost>
date: Sun Feb 09 09:28:21 2003 +0000
description:
- init panpot at reset
- whitespace police
diffstat:
sys/dev/ic/opl.c | 39 ++++++++++++++++++++-------------------
1 files changed, 20 insertions(+), 19 deletions(-)
diffs (169 lines):
diff -r 49334fdcbfac -r 4c89fad39099 sys/dev/ic/opl.c
--- a/sys/dev/ic/opl.c Sun Feb 09 09:14:58 2003 +0000
+++ b/sys/dev/ic/opl.c Sun Feb 09 09:28:21 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opl.c,v 1.17 2001/11/13 13:14:42 lukem Exp $ */
+/* $NetBSD: opl.c,v 1.18 2003/02/09 09:28:21 itohy Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: opl.c,v 1.17 2001/11/13 13:14:42 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: opl.c,v 1.18 2003/02/09 09:28:21 itohy Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -145,7 +145,7 @@
oplsyn_pitchbend,
0
};
-
+
void
opl_attach(sc)
struct opl_softc *sc;
@@ -163,7 +163,7 @@
sc->syn.nvoice = sc->model == OPL_2 ? OPL2_NVOICE : OPL3_NVOICE;
sc->syn.flags = MS_DOALLOC | MS_FREQXLATE;
midisyn_attach(&sc->mididev, &sc->syn);
-
+
/* Set up voice table */
for (i = 0; i < OPL3_NVOICE; i++)
sc->voices[i] = voicetab[i];
@@ -173,8 +173,6 @@
printf(": model OPL%d", sc->model);
/* Set up panpot */
- for (i = 0; i < MIDI_MAX_CHANS; i++)
- sc->pan[i] = OPL_VOICE_TO_LEFT | OPL_VOICE_TO_RIGHT;
sc->panl = OPL_VOICE_TO_LEFT;
sc->panr = OPL_VOICE_TO_RIGHT;
if (sc->model == OPL_3 &&
@@ -209,7 +207,7 @@
int offs;
int addr, data;
{
- DPRINTFN(4, ("opl_command: sc=%p, offs=%d addr=0x%02x data=0x%02x\n",
+ DPRINTFN(4, ("opl_command: sc=%p, offs=%d addr=0x%02x data=0x%02x\n",
sc, offs, addr, data));
offs += sc->offs;
bus_space_write_1(sc->iot, sc->ioh, OPL_ADDR+offs, addr);
@@ -234,7 +232,7 @@
sc->model = OPL_2; /* worst case assumtion */
/* Reset timers 1 and 2 */
- opl_command(sc, OPL_L, OPL_TIMER_CONTROL,
+ opl_command(sc, OPL_L, OPL_TIMER_CONTROL,
OPL_TIMER1_MASK | OPL_TIMER2_MASK);
/* Reset the IRQ of the FM chip */
opl_command(sc, OPL_L, OPL_TIMER_CONTROL, OPL_IRQ_RESET);
@@ -250,7 +248,7 @@
/* get status bits again */
status2 = bus_space_read_1(sc->iot,sc->ioh,OPL_STATUS+OPL_L+sc->offs);
- opl_command(sc, OPL_L, OPL_TIMER_CONTROL,
+ opl_command(sc, OPL_L, OPL_TIMER_CONTROL,
OPL_TIMER1_MASK | OPL_TIMER2_MASK);
opl_command(sc, OPL_L, OPL_TIMER_CONTROL, OPL_IRQ_RESET);
@@ -272,12 +270,12 @@
return (0);
}
- DPRINTFN(2,("opl_find: OPL%d at 0x%x detected\n",
+ DPRINTFN(2,("opl_find: OPL%d at 0x%x detected\n",
sc->model, (int)sc->ioh));
return (1);
}
-void
+void
opl_set_op_reg(sc, base, voice, op, value)
struct opl_softc *sc;
int base;
@@ -289,7 +287,7 @@
opl_command(sc, v->iooffs, base + v->op[op], value);
}
-void
+void
opl_set_ch_reg(sc, base, voice, value)
struct opl_softc *sc;
int base;
@@ -301,7 +299,7 @@
}
-void
+void
opl_load_patch(sc, v)
struct opl_softc *sc;
int v;
@@ -338,7 +336,7 @@
return (OPL_FNUM_FAIL);
else
return ((block << 10) | f_num);
- }
+}
void
@@ -358,6 +356,9 @@
}
sc->volume = 64;
+
+ for (i = 0; i < MIDI_MAX_CHANS; i++)
+ sc->pan[i] = OPL_VOICE_TO_LEFT | OPL_VOICE_TO_RIGHT;
}
int
@@ -406,7 +407,7 @@
sd->name = sc->model == OPL_2 ? "Yamaha OPL2" : "Yamaha OPL3";
sd->type = SYNTH_TYPE_FM;
- sd->subtype = sc->model == OPL_2 ? SYNTH_SUB_FM_TYPE_ADLIB
+ sd->subtype = sc->model == OPL_2 ? SYNTH_SUB_FM_TYPE_ADLIB
: SYNTH_SUB_FM_TYPE_OPL3;
sd->capabilities = 0;
}
@@ -441,7 +442,7 @@
int
opl_calc_vol(regbyte, volume, mainvol)
- int regbyte;
+ int regbyte;
int volume;
int mainvol;
{
@@ -479,7 +480,7 @@
u_int8_t r20m, r20c, r40m, r40c, rA0, rB0;
u_int8_t vol0, vol1;
- DPRINTFN(3, ("oplsyn_noteon: %p %d %d\n", sc, voice,
+ DPRINTFN(3, ("oplsyn_noteon: %p %d %d\n", sc, voice,
MIDISYN_FREQ_TO_HZ(freq)));
#ifdef DIAGNOSTIC
@@ -494,7 +495,7 @@
opl_set_ch_reg(sc, OPL_KEYON_BLOCK, voice, 0);
v = &sc->voices[voice];
-
+
chan = MS_GETCHAN(&ms->voices[voice]);
p = &opl2_instrs[ms->pgms[chan]];
v->patch = p;
@@ -563,7 +564,7 @@
struct opl_softc *sc = ms->data;
struct opl_voice *v;
- DPRINTFN(3, ("oplsyn_noteoff: %p %d %d\n", sc, voice,
+ DPRINTFN(3, ("oplsyn_noteoff: %p %d %d\n", sc, voice,
MIDISYN_FREQ_TO_HZ(note)));
#ifdef DIAGNOSTIC
Home |
Main Index |
Thread Index |
Old Index