diff --git a/sys/conf/options.pc98 b/sys/conf/options.pc98 index 4374f029d4e8..3f3edc680001 100644 --- a/sys/conf/options.pc98 +++ b/sys/conf/options.pc98 @@ -1,4 +1,4 @@ -# $Id: options.pc98,v 1.5 1996/10/09 21:45:47 asami Exp $ +# $Id: options.pc98,v 1.6 1996/10/23 07:24:55 asami Exp $ BOUNCEPAGES opt_bounce.h USER_LDT MATH_EMULATE opt_math_emulate.h @@ -15,6 +15,8 @@ AUTO_EOI_1 opt_auto_eoi.h AUTO_EOI_2 opt_auto_eoi.h BREAK_TO_DEBUGGER opt_comconsole.h COMCONSOLE opt_comconsole.h +CONADDR opt_comconsole.h +CONUNIT opt_comconsole.h COM_ESP opt_sio.h COM_MULTIPORT opt_sio.h DSI_SOFT_MODEM opt_sio.h @@ -41,7 +43,6 @@ I586_FAST_BCOPY opt_temporary.h I586_OPTIMIZED_BCOPY opt_temporary.h I586_OPTIMIZED_BZERO opt_temporary.h -SC_KBD_PROBE_WORKS opt_syscons.h SC_SPLASH_SCREEN opt_syscons.h MAXCONS opt_syscons.h SLOW_VGA opt_syscons.h diff --git a/sys/i386/isa/sound/os.h b/sys/i386/isa/sound/os.h index 6866017976c5..5b233b5f943a 100644 --- a/sys/i386/isa/sound/os.h +++ b/sys/i386/isa/sound/os.h @@ -247,8 +247,13 @@ extern unsigned long get_time(void); * The outb(0, 0x80) is just for slowdown. It's bit unsafe since * this address could be used for something usefull. */ -#define OUTB(addr, data) {outb(data, addr);outb(0, 0x80);} -#define OUTW(addr, data) {outw(data, addr);outb(0, 0x80);} +#ifdef PC98 +#define OUTB(addr, data) {outb(data, addr);outb(0x5f, 0);} +#define OUTW(addr, data) {outw(data, addr);outb(0x5f, 0);} +#else /* IBM-PC */ +#define OUTB(addr, data) {outb(data, addr);outb(0x80, 0);} +#define OUTW(addr, data) {outw(data, addr);outb(0x80, 0);} +#endif /* PC98 */ #else #define OUTB(addr, data) outb(data, addr) #define OUTW(addr, data) outw(data, addr) diff --git a/sys/pc98/boot/biosboot/boot2.S b/sys/pc98/boot/biosboot/boot2.S index 63f518148ee7..de94f0098b56 100644 --- a/sys/pc98/boot/biosboot/boot2.S +++ b/sys/pc98/boot/biosboot/boot2.S @@ -172,7 +172,9 @@ ENTRY(boot2) movl %esp, EXT(dflt_name) #endif +#ifdef PC98 movb 0x11584, %dl +#endif movzbl %dl, %edx /* discard head (%dh) and random high bits */ pushl %edx call EXT(boot) diff --git a/sys/pc98/boot/biosboot/sys.c b/sys/pc98/boot/biosboot/sys.c index 2d597b3c052c..a555bdc48f33 100644 --- a/sys/pc98/boot/biosboot/sys.c +++ b/sys/pc98/boot/biosboot/sys.c @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:36:34 rpd - * $Id: sys.c,v 1.4 1996/09/12 11:36:09 asami Exp $ + * $Id: sys.c,v 1.5 1996/10/09 21:45:32 asami Exp $ */ /* @@ -275,8 +275,9 @@ openrd(void) #ifdef PC98 dosdev_copy = unit | 0xa0; disk_equips = *(unsigned char *)0x11482; + sdunit = unit; unit = 0; - for (i = 0; i < unit; i++) + for (i = 0; i < sdunit; i++) unit += ((disk_equips >> i) & 0x01); #else /* IBM-PC */ dosdev_copy = biosdrive | 0x80; diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c index d96f66190355..3e9faf9441fd 100644 --- a/sys/pc98/cbus/clock.c +++ b/sys/pc98/cbus/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.7 1996/10/09 21:46:11 asami Exp $ + * $Id: clock.c,v 1.8 1996/10/23 07:25:13 asami Exp $ */ /* @@ -45,8 +45,7 @@ */ /* - * modified for PC98 - * $Id: clock.c,v 1.7 1996/10/09 21:46:11 asami Exp $ + * modified for PC98 by Kakefuda */ /* @@ -482,7 +481,6 @@ DELAY(int n) n -= 20; /* * Calculate (n * (timer_freq / 1e6)) without using floating point - * Calculate (n * (TIMER_FREQ / 1e6)) without using floating point * and without any avoidable overflows. */ sec = n / 1000000; diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c index d96f66190355..3e9faf9441fd 100644 --- a/sys/pc98/cbus/pcrtc.c +++ b/sys/pc98/cbus/pcrtc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.7 1996/10/09 21:46:11 asami Exp $ + * $Id: clock.c,v 1.8 1996/10/23 07:25:13 asami Exp $ */ /* @@ -45,8 +45,7 @@ */ /* - * modified for PC98 - * $Id: clock.c,v 1.7 1996/10/09 21:46:11 asami Exp $ + * modified for PC98 by Kakefuda */ /* @@ -482,7 +481,6 @@ DELAY(int n) n -= 20; /* * Calculate (n * (timer_freq / 1e6)) without using floating point - * Calculate (n * (TIMER_FREQ / 1e6)) without using floating point * and without any avoidable overflows. */ sec = n / 1000000; diff --git a/sys/pc98/conf/majors.pc98 b/sys/pc98/conf/majors.pc98 index e13c5d7b25bb..f89f9d1f71c5 100644 --- a/sys/pc98/conf/majors.pc98 +++ b/sys/pc98/conf/majors.pc98 @@ -1,4 +1,4 @@ -$Id: majors.pc98,v 1.3 1996/09/03 10:23:13 asami Exp $ +$Id: majors.pc98,v 1.4 1996/10/23 07:24:52 asami Exp $ Hopefully, this list will one day be obsoleted by DEVFS, but for now this is the current allocation of device major numbers. @@ -91,13 +91,13 @@ chrdev name comments 51 joy joystick 52 tun IP tunnel device 53 snp tty snoop -54 nic ISDN system -55 isdn ISDN system -56 ity ISDN system -57 itel ISDN system +54 OLDnic ISDN system +55 OLDisdn ISDN system +56 OLDity ISDN system +57 OLDitel ISDN system 58 dgb Digiboard -59 ispy ISDN system -60 nnic ISDN system +59 OLDispy ISDN system +60 OLDnnic ISDN system 61 pt SCSI "processor type" 62 worm SCSI "worm type" 63 rc Riscom/8 driver diff --git a/sys/pc98/conf/options.pc98 b/sys/pc98/conf/options.pc98 index 4374f029d4e8..3f3edc680001 100644 --- a/sys/pc98/conf/options.pc98 +++ b/sys/pc98/conf/options.pc98 @@ -1,4 +1,4 @@ -# $Id: options.pc98,v 1.5 1996/10/09 21:45:47 asami Exp $ +# $Id: options.pc98,v 1.6 1996/10/23 07:24:55 asami Exp $ BOUNCEPAGES opt_bounce.h USER_LDT MATH_EMULATE opt_math_emulate.h @@ -15,6 +15,8 @@ AUTO_EOI_1 opt_auto_eoi.h AUTO_EOI_2 opt_auto_eoi.h BREAK_TO_DEBUGGER opt_comconsole.h COMCONSOLE opt_comconsole.h +CONADDR opt_comconsole.h +CONUNIT opt_comconsole.h COM_ESP opt_sio.h COM_MULTIPORT opt_sio.h DSI_SOFT_MODEM opt_sio.h @@ -41,7 +43,6 @@ I586_FAST_BCOPY opt_temporary.h I586_OPTIMIZED_BCOPY opt_temporary.h I586_OPTIMIZED_BZERO opt_temporary.h -SC_KBD_PROBE_WORKS opt_syscons.h SC_SPLASH_SCREEN opt_syscons.h MAXCONS opt_syscons.h SLOW_VGA opt_syscons.h diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index 73725c7f9287..282b74dc4853 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.9 1996/10/09 21:45:56 asami Exp $ + * $Id: machdep.c,v 1.10 1996/10/23 07:25:00 asami Exp $ */ #include "npx.h" @@ -257,12 +257,6 @@ cpu_startup(dummy) */ setup_netisrs(&netisr_set); -/* -#ifdef ISDN - DONET(isdnintr, NETISR_ISDN); -#endif -*/ - /* * Allocate space for system data structures. * The first available kernel virtual address is in "v". diff --git a/sys/pc98/i386/userconfig.c b/sys/pc98/i386/userconfig.c index 9022390b673b..ba5da41c8ce5 100644 --- a/sys/pc98/i386/userconfig.c +++ b/sys/pc98/i386/userconfig.c @@ -46,7 +46,7 @@ ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ** - ** $Id: userconfig.c,v 1.7 1996/10/09 21:46:01 asami Exp $ + ** $Id: userconfig.c,v 1.8 1996/10/23 07:25:04 asami Exp $ **/ /** @@ -283,8 +283,6 @@ static DEV_INFO device_info[] = { {"cy", "Cyclades multiport async adapter", 0, CLS_COMMS}, #endif {"lpt", "Parallel printer port", 0, CLS_COMMS}, -{"nic", "ISDN driver", 0, CLS_COMMS}, -{"nnic", "ISDN driver", 0, CLS_COMMS}, #ifndef PC98 {"gp", "National Instruments AT-GPIB/TNT driver", 0, CLS_COMMS}, #endif @@ -2249,7 +2247,7 @@ visuserconfig(void) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: userconfig.c,v 1.7 1996/10/09 21:46:01 asami Exp $ + * $Id: userconfig.c,v 1.8 1996/10/23 07:25:04 asami Exp $ */ #include "scbus.h" diff --git a/sys/pc98/pc98/clock.c b/sys/pc98/pc98/clock.c index d96f66190355..3e9faf9441fd 100644 --- a/sys/pc98/pc98/clock.c +++ b/sys/pc98/pc98/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.7 1996/10/09 21:46:11 asami Exp $ + * $Id: clock.c,v 1.8 1996/10/23 07:25:13 asami Exp $ */ /* @@ -45,8 +45,7 @@ */ /* - * modified for PC98 - * $Id: clock.c,v 1.7 1996/10/09 21:46:11 asami Exp $ + * modified for PC98 by Kakefuda */ /* @@ -482,7 +481,6 @@ DELAY(int n) n -= 20; /* * Calculate (n * (timer_freq / 1e6)) without using floating point - * Calculate (n * (TIMER_FREQ / 1e6)) without using floating point * and without any avoidable overflows. */ sec = n / 1000000; diff --git a/sys/pc98/pc98/if_ed.c b/sys/pc98/pc98/if_ed.c index 0b1b88014786..6b7bf2f8b0ba 100644 --- a/sys/pc98/pc98/if_ed.c +++ b/sys/pc98/pc98/if_ed.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_ed.c,v 1.8 1996/10/09 21:46:18 asami Exp $ + * $Id: if_ed.c,v 1.9 1996/10/23 07:25:17 asami Exp $ */ /* @@ -1941,7 +1941,7 @@ ed_hpp_set_physical_link(struct ed_softc *sc) #ifdef PC98 static int ed_probe_SIC98(struct isa_device* pc98_dev) { - int i; + u_int i; struct ed_softc *sc = &ed_softc[pc98_dev->id_unit]; u_char sum; u_int memsize; @@ -2030,7 +2030,7 @@ ed_probe_CNET98(isa_dev) { struct ed_softc *sc = &ed_softc[isa_dev->id_unit]; - int i; + u_int i; u_char sum; /* diff --git a/sys/pc98/pc98/kbdtables.h b/sys/pc98/pc98/kbdtables.h index 36832a379317..4a822a9b142c 100644 --- a/sys/pc98/pc98/kbdtables.h +++ b/sys/pc98/pc98/kbdtables.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: kbdtables.h,v 1.31 1996/01/25 16:37:20 ache Exp $ + * $Id: kbdtables.h,v 1.1.1.1 1996/06/14 10:04:44 asami Exp $ */ #define SET8 0x80 /* set eight bit on */ @@ -98,7 +98,7 @@ static keymap_t key_map = { 0x80, /* PC98 keymap */ /* sc=36 */ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51), 0xFF, 0x00, /* sc=37 */ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59), 0xFF, 0x00, /* sc=38 */ F(60), F(60), F(60), F(60), F(60), F(60), F(60), F(60), 0xFF, 0x00, -/* sc=39 */ 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, 0x00, +/* sc=39 */ 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, RBT, RBT, 0x00, 0x00, /* sc=3a */ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50), 0xFF, 0x00, /* sc=3b */ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53), 0xFF, 0x00, /* sc=3c */ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55), 0xFF, 0x00, diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 73725c7f9287..282b74dc4853 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.9 1996/10/09 21:45:56 asami Exp $ + * $Id: machdep.c,v 1.10 1996/10/23 07:25:00 asami Exp $ */ #include "npx.h" @@ -257,12 +257,6 @@ cpu_startup(dummy) */ setup_netisrs(&netisr_set); -/* -#ifdef ISDN - DONET(isdnintr, NETISR_ISDN); -#endif -*/ - /* * Allocate space for system data structures. * The first available kernel virtual address is in "v". diff --git a/sys/pc98/pc98/npx.c b/sys/pc98/pc98/npx.c index ddff97dd9ed1..186510ad3d2d 100644 --- a/sys/pc98/pc98/npx.c +++ b/sys/pc98/pc98/npx.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.6 1996/09/10 09:38:17 asami Exp $ + * $Id: npx.c,v 1.7 1996/10/09 21:46:29 asami Exp $ */ #include "npx.h" @@ -367,7 +367,7 @@ npxattach(dvp) struct isa_device *dvp; { if (npx_ex16) - printf("npx%d: Exception 16 interface\n", dvp->id_unit); + printf("npx%d: INT 16 interface\n", dvp->id_unit); else if (npx_irq13) ; /* higher level has printed "irq 13" */ #if defined(MATH_EMULATE) || defined(GPL_MATH_EMULATE) diff --git a/sys/pc98/pc98/pc98.c b/sys/pc98/pc98/pc98.c index b9f900bcbd54..8515f3347422 100644 --- a/sys/pc98/pc98/pc98.c +++ b/sys/pc98/pc98/pc98.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $Id: pc98.c,v 1.8 1996/10/09 21:46:31 asami Exp $ + * $Id: pc98.c,v 1.9 1996/10/23 07:25:20 asami Exp $ */ /* @@ -739,6 +739,10 @@ void isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan) #ifndef PC98 if ((chan & 4) == 0) { + /* + * Program one of DMA channels 0..3. These are + * byte mode channels. + */ #endif /* set dma channel mode, and reset address ff */ @@ -763,11 +767,11 @@ void isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan) outb(dmapageport[chan], phys>>16); /* send count */ - outb(waport + 2, --nbytes); /* 0x3, 0x7, 0xb, 0xf */ + outb(waport + 2, --nbytes); outb(waport + 2, nbytes>>8); /* unmask channel */ - outb(DMA1_SMSK, chan & 3); + outb(DMA1_SMSK, chan); #ifndef PC98 } else { /* @@ -802,7 +806,7 @@ void isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan) outb(waport + 2, nbytes>>8); /* unmask channel */ - outb(DMA2_SMSK, chan); + outb(DMA2_SMSK, chan & 3); } #endif } diff --git a/sys/pc98/pc98/pc98_machdep.c b/sys/pc98/pc98/pc98_machdep.c index af9e7024daea..eddd27802b33 100644 --- a/sys/pc98/pc98/pc98_machdep.c +++ b/sys/pc98/pc98/pc98_machdep.c @@ -48,6 +48,7 @@ extern int Maxmem_under16M; static void init_cpu_accel_mem __P((void)); void pc98_init_dmac __P((void)); +void pc98_getmemsize __P((void)); #ifdef EPSON_MEMWIN static void init_epson_memwin __P((void)); diff --git a/sys/pc98/pc98/sound/ad1848_mixer.h b/sys/pc98/pc98/sound/ad1848_mixer.h deleted file mode 100644 index 2c1bddb6aab9..000000000000 --- a/sys/pc98/pc98/sound/ad1848_mixer.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * sound/ad1848_mixer.h - * - * Definitions for the mixer of AD1848 and compatible codecs. - * - * Copyright by Hannu Savolainen 1994 - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. 2. - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* - * The AD1848 codec has generic input lines called Line, Aux1 and Aux2. - * Soundcard manufacturers have connected actual inputs (CD, synth, line, - * etc) to these inputs in different order. Therefore it's difficult - * to assign mixer channels to to these inputs correctly. The following - * contains two alternative mappings. The first one is for GUS MAX and - * the second is just a generic one (line1, line2 and line3). - * (Actually this is not a mapping but rather some kind of interleaving - * solution). - */ -#ifdef GUSMAX_MIXER -#define MODE1_REC_DEVICES (SOUND_MASK_LINE | SOUND_MASK_MIC | \ - SOUND_MASK_CD) - -#define MODE1_MIXER_DEVICES (SOUND_MASK_SYNTH | SOUND_MASK_MIC | \ - SOUND_MASK_CD | \ - SOUND_MASK_IGAIN | \ - SOUND_MASK_PCM|SOUND_MASK_IMIX) - -#define MODE2_MIXER_DEVICES (SOUND_MASK_SYNTH | SOUND_MASK_LINE | SOUND_MASK_MIC | \ - SOUND_MASK_CD | SOUND_MASK_SPEAKER | \ - SOUND_MASK_IGAIN | \ - SOUND_MASK_PCM | SOUND_MASK_IMIX) -#else /* Generic mapping */ -#define MODE1_REC_DEVICES (SOUND_MASK_LINE3 | SOUND_MASK_MIC | \ - SOUND_MASK_LINE1) - -#define MODE1_MIXER_DEVICES (SOUND_MASK_LINE1 | SOUND_MASK_MIC | \ - SOUND_MASK_LINE2 | \ - SOUND_MASK_IGAIN | \ - SOUND_MASK_PCM | SOUND_MASK_IMIX) - -#define MODE2_MIXER_DEVICES (SOUND_MASK_LINE1 | SOUND_MASK_LINE2 | SOUND_MASK_MIC | \ - SOUND_MASK_LINE3 | SOUND_MASK_SPEAKER | \ - SOUND_MASK_IGAIN | \ - SOUND_MASK_PCM | SOUND_MASK_IMIX) -#endif - -struct mixer_def { - unsigned int regno: 7; - unsigned int polarity:1; /* 0=normal, 1=reversed */ - unsigned int bitpos:4; - unsigned int nbits:4; -}; - - -typedef struct mixer_def mixer_ent; - -/* - * Most of the mixer entries work in backwards. Setting the polarity field - * makes them to work correctly. - * - * The channel numbering used by individual soundcards is not fixed. Some - * cards have assigned different meanings for the AUX1, AUX2 and LINE inputs. - * The current version doesn't try to compensate this. - */ - -#define MIX_ENT(name, reg_l, pola_l, pos_l, len_l, reg_r, pola_r, pos_r, len_r) \ - {{reg_l, pola_l, pos_r, len_l}, {reg_r, pola_r, pos_r, len_r}} - -static mixer_ent mix_devices[32][2] = { /* As used in GUS MAX */ -MIX_ENT(SOUND_MIXER_VOLUME, 0, 0, 0, 0, 0, 0, 0, 0), -MIX_ENT(SOUND_MIXER_BASS, 0, 0, 0, 0, 0, 0, 0, 0), -MIX_ENT(SOUND_MIXER_TREBLE, 0, 0, 0, 0, 0, 0, 0, 0), -MIX_ENT(SOUND_MIXER_SYNTH, 4, 1, 0, 5, 5, 1, 0, 5), -MIX_ENT(SOUND_MIXER_PCM, 6, 1, 0, 6, 7, 1, 0, 6), -MIX_ENT(SOUND_MIXER_SPEAKER, 26, 1, 0, 4, 0, 0, 0, 0), -MIX_ENT(SOUND_MIXER_LINE, 18, 1, 0, 5, 19, 1, 0, 5), -MIX_ENT(SOUND_MIXER_MIC, 0, 1, 5, 1, 1, 1, 5, 1), -MIX_ENT(SOUND_MIXER_CD, 2, 1, 0, 5, 3, 1, 0, 5), -MIX_ENT(SOUND_MIXER_IMIX, 13, 1, 2, 6, 0, 0, 0, 0), -MIX_ENT(SOUND_MIXER_ALTPCM, 0, 0, 0, 0, 0, 0, 0, 0), -MIX_ENT(SOUND_MIXER_RECLEV, 0, 0, 0, 0, 0, 0, 0, 0), -MIX_ENT(SOUND_MIXER_IGAIN, 0, 0, 0, 4, 1, 0, 0, 4), -MIX_ENT(SOUND_MIXER_OGAIN, 0, 0, 0, 0, 0, 0, 0, 0), -MIX_ENT(SOUND_MIXER_LINE1, 2, 1, 0, 5, 3, 1, 0, 5), -MIX_ENT(SOUND_MIXER_LINE2, 4, 1, 0, 5, 5, 1, 0, 5), -MIX_ENT(SOUND_MIXER_LINE3, 18, 1, 0, 5, 19, 1, 0, 5) -}; - -static unsigned short default_mixer_levels[SOUND_MIXER_NRDEVICES] = -{ - 0x5a5a, /* Master Volume */ - 0x3232, /* Bass */ - 0x3232, /* Treble */ - 0x4b4b, /* FM */ - 0x6464, /* PCM */ - 0x4b4b, /* PC Speaker */ - 0x4b4b, /* Ext Line */ - 0x1010, /* Mic */ - 0x4b4b, /* CD */ - 0x0000, /* Recording monitor */ - 0x4b4b, /* SB PCM */ - 0x4b4b, /* Recording level */ - 0x4b4b, /* Input gain */ - 0x4b4b, /* Output gain */ - 0x4b4b, /* Line1 */ - 0x4b4b, /* Line2 */ - 0x4b4b /* Line3 */ -}; - -#define LEFT_CHN 0 -#define RIGHT_CHN 1 diff --git a/sys/pc98/pc98/sound/adlib_card.c b/sys/pc98/pc98/sound/adlib_card.c index aabd8379cde2..4ec55b9ea81c 100644 --- a/sys/pc98/pc98/sound/adlib_card.c +++ b/sys/pc98/pc98/sound/adlib_card.c @@ -27,7 +27,11 @@ * */ +#ifdef PC98 +#include +#else #include +#endif #if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_YM3812) diff --git a/sys/pc98/pc98/sound/aedsp16.c b/sys/pc98/pc98/sound/aedsp16.c deleted file mode 100644 index a292d9e584da..000000000000 --- a/sys/pc98/pc98/sound/aedsp16.c +++ /dev/null @@ -1,838 +0,0 @@ -/* - sound/aedsp16.c - - Audio Excel DSP 16 software configuration routines - - Copyright (C) 1995 Riccardo Facchetti (riccardo@cdc8g5.cdc.polimi.it) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. 2. - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. - - READ THIS - - This module is intended for Audio Excel DSP 16 Sound Card. - - Audio Excel DSP 16 is an SB pro II, Microsoft Sound System - and MPU-401 compatible card. - It is software-only configurable (no jumpers to hard-set irq/dma/mpu-irq), - so before this module, the only way to configure the DSP under linux was - boot the MS-BAU loading the sound.sys device driver (this driver soft- - configure the sound board hardware by massaging someone of its registers), - and then ctrl-alt-del to boot linux with the DSP configured by the DOG - driver. - - This module works configuring your Audio Excel DSP 16's - irq, dma and mpu-401-irq. The voxware probe routines rely on the - fact that if the hardware is there, they can detect it. The problem - with AEDSP16 is that no hardware can be found by the probe routines - if the sound card is not well configured. Sometimes the kernel probe - routines can find an SBPRO even when the card is not configured (this - is the standard setup of the card), but the SBPRO emulation don't work - well if the card is not properly initialized. For this reason - - InitAEDSP16_...() - - routines are called before the voxware probe routines try to detect the - hardware. - - NOTE (READ THE NOTE TOO, IT CONTAIN USEFUL INFORMATIONS) - - The Audio Excel DSP 16 Sound Card emulates both SBPRO and MSS; - the voxware sound driver can be configured for SBPRO and MSS cards - at the same time, but the aedsp16 can't be two cards!! - When we configure it, we have to choose the SBPRO or the MSS emulation - for AEDSP16. We also can install a *REAL* card of the other type - (see [1], not tested but I can't see any reason for it to fail). - - NOTE: If someone can test the combination AEDSP16+MSS or AEDSP16+SBPRO - please let me know if it works. - - The MPU-401 support can be compiled in together with one of the other - two operating modes. - - The board configuration calls, are in the probe_...() routines because - we have to configure the board before probing it for a particular - hardware. After card configuration, we can probe the hardware. - - NOTE: This is something like plug-and-play: we have only to plug - the AEDSP16 board in the socket, and then configure and compile - a kernel that uses the AEDSP16 software configuration capability. - No jumper setting is needed! - - For example, if you want AEDSP16 to be an SBPro, on irq 10, dma 3 - you have just to make config the voxware package, configuring - the SBPro sound card with that parameters, then when configure - asks if you have an AEDSP16, answer yes. That's it. - Compile the kernel and run it. - - NOTE: This means that you can choose irq and dma, but not the - I/O addresses. To change I/O addresses you have to set them - with jumpers. - - NOTE: InitAEDSP16_...() routines get as parameter the hw_config, - the hardware configuration of the - to be configured - board. - The InitAEDSP16() routine, configure the board following our - wishes, that are in the hw_config structure. - - You can change the irq/dma/mirq settings WITHOUT THE NEED to open - your computer and massage the jumpers (there are no irq/dma/mirq - jumpers to be configured anyway, only I/O port ones have to be - configured with jumpers) - - For some ununderstandable reason, the card default of irq 7, dma 1, - don't work for me. Seems to be an IRQ or DMA conflict. Under heavy - HDD work, the kernel start to erupt out a lot of messages like: - - 'Sound: DMA timed out - IRQ/DRQ config error?' - - For what I can say, I have NOT any conflict at irq 7 (under linux I'm - using the lp polling driver), and dma line 1 is unused as stated by - /proc/dma. I can suppose this is a bug of AEDSP16. I know my hardware so - I'm pretty sure I have not any conflict, but may be I'm wrong. Who knows! - Anyway a setting of irq 10, dma 3 works really fine. - - NOTE: if someone can use AEDSP16 with irq 7, dma 1, please let me know - the emulation mode, all the installed hardware and the hardware - configuration (irq and dma settings of all the hardware). - - This init module should work with SBPRO+MSS, when one of the two is - the AEDSP16 emulation and the other the real card. (see [1]) - For example: - - AEDSP16 (0x220) in SBPRO emu (0x220) + real MSS + other - AEDSP16 (0x220) in MSS emu + real SBPRO (0x240) + other - - MPU401 should work. (see [1]) - - [1] Not tested by me for lack of hardware. - - TODO, WISHES AND TECH - - May be there's lot of redundant delays, but for now I want to leave it - this way. - - Should be interesting eventually write down a new ioctl for the - aedsp16, to let the suser() change the irq/dma/mirq on the fly. - The thing is not trivial. - In the real world, there's no need to have such an ioctl because - when we configure the kernel for compile, we can choose the config - parameters. If we change our mind, we can easily re-config the kernel - and re-compile. - Why let the suser() change the config parameters on the fly ? - If anyone have a reasonable answer to this question, I will write down - the code to do it. - - More integration with voxware, using voxware low level routines to - read-write dsp is not possible because you may want to have MSS - support and in that case we can not rely on the functions included - in sb_dsp.c to control 0x2yy I/O ports. I will continue to use my - own I/O functions. - - - About I/O ports allocation - - - The request_region should be done at device probe in every sound card - module. This module is not the best site for requesting regions. - When the request_region code will be added to the main modules such as - sb, adlib, gus, ad1848, etc, the requesting code in this module should - go away. - - I think the request regions should be done this way: - - if (check_region(...)) - return ERR; // I/O region alredy reserved - device_probe(...); - device_attach(...); - request_region(...); // reserve only when we are sure all is okay - - Request the 2x0h region in any case if we are using this card. - - NOTE: the "(sbpro)" string with which we are requesting the aedsp16 region - (see code) does not mean necessarly that we are emulating sbpro. - It mean that the region is the sbpro I/O ports region. We use this - region to access the control registers of the card, and if emulating - sbpro, I/O sbpro registers too. If we are emulating MSS, the sbpro - registers are not used, in no way, to emulate an sbpro: they are - used only for configuration pourposes. - - Someone pointed out that should be possible use both the SBPRO and MSS - modes because the sound card have all the two chipsets, supposing that - the card is really two cards. I have tried something to have the two - modes work together, but, for some reason unknown to me, without success. - - I think all the soft-config only cards have an init sequence similar to - this. If you have a card that is not an aedsp16, you can try to start - with this module changing it (mainly in the CMD? I think) to fit your - needs. - - Started Fri Mar 17 16:13:18 MET 1995 - - v0.1 (ALPHA, was an user-level program called AudioExcelDSP16.c) - - Initial code. - v0.2 (ALPHA) - - Cleanups. - - Integrated with Linux voxware v 2.90-2 kernel sound driver. - - SoundBlaster Pro mode configuration. - - Microsoft Sound System mode configuration. - - MPU-401 mode configuration. - v0.3 (ALPHA) - - Cleanups. - - Rearranged the code to let InitAEDSP16 be more general. - - Erased the REALLY_SLOW_IO. We don't need it. Erased the linux/io.h - inclusion too. We rely on os.h - - Used the INB and OUTB #defined in os.h instead of inb and outb. - - Corrected the code for GetCardName (DSP Copyright) to get a variable - len string (we are not sure about the len of Copyright string). - This works with any SB and compatible. - - Added the code to request_region at device init (should go in - the main body of voxware). - v0.4 (BETA) - - Better configure.c patch for aedsp16 configuration (better - logic of inclusion of AEDSP16 support) - - Modified the conditional compilation to better support more than - one sound card of the emulated type (read the NOTES above) - - Moved the sb init routine from the attach to the very first - probe in sb_card.c - - Rearrangemens and cleanups - - Wiped out some unnecessary code and variables: this is kernel - code so it is better save some TEXT and DATA - - Fixed the request_region code. We must allocate the aedsp16 (sbpro) - I/O ports in any case because they are used to access the DSP - configuration registers and we can not allow anyone to get them. - v0.5 - - cleanups on comments - - prep for diffs against v3.0-proto-950402 - - */ - -/* - * Include the main voxware header file. It include all the os/voxware/etc - * headers needed by this source. - */ -#include -/* - * all but ioport.h :) - */ -#include - -#if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_AEDSP16) - -#define VERSION "0.5" /* Version of Audio Excel DSP 16 driver */ - -#undef AEDSP16_DEBUG /* Define this to enable debug code */ -/* Actually no debug code is activated */ - -/* - * Hardware related defaults - */ -#define IRQ 7 /* 5 7(default) 9 10 11 */ -#define MIRQ 0 /* 5 7 9 10 0(default), 0 means disable */ -#define DMA 1 /* 0 1(default) 3 */ - -/* - * Commands of AEDSP16's DSP (SBPRO+special). - * For now they are CMDn, in the future they may change. - */ -#define CMD1 0xe3 /* Get DSP Copyright */ -#define CMD2 0xe1 /* Get DSP Version */ -#define CMD3 0x88 /* */ -#define CMD4 0x5c /* */ -#define CMD5 0x50 /* Set M&I&DRQ mask (the real config) */ -#define CMD6 0x8c /* Enable Microsoft Sound System mode */ - -/* - * Offsets of AEDSP16 DSP I/O ports. The offest is added to portbase - * to have the actual I/O port. - * Register permissions are: - * (wo) == Write Only - * (ro) == Read Only - * (w-) == Write - * (r-) == Read - */ -#define DSP_RESET 0x06 /* offset of DSP RESET (wo) */ -#define DSP_READ 0x0a /* offset of DSP READ (ro) */ -#define DSP_WRITE 0x0c /* offset of DSP WRITE (w-) */ -#define DSP_COMMAND 0x0c /* offset of DSP COMMAND (w-) */ -#define DSP_STATUS 0x0c /* offset of DSP STATUS (r-) */ -#define DSP_DATAVAIL 0x0e /* offset of DSP DATA AVAILABLE (ro) */ - - -#define RETRY 10 /* Various retry values on I/O opera- */ -#define STATUSRETRY 1000 /* tions. Sometimes we have to */ -#define HARDRETRY 500000 /* wait for previous cmd to complete */ - -/* - * Size of character arrays that store name and version of sound card - */ -#define CARDNAMELEN 15 /* Size of the card's name in chars */ -#define CARDVERLEN 2 /* Size of the card's version in chars */ - -/* - * Bit mapped flags for calling InitAEDSP16(), and saving the current - * emulation mode. - */ -#define INIT_NONE (0 ) -#define INIT_SBPRO (1<<0) -#define INIT_MSS (1<<1) -#define INIT_MPU401 (1<<2) -#define RESET_DSP16 (1<<3) - -/* Base HW Port for Audio Card */ -static int portbase = AEDSP16_BASE; -static int irq = IRQ; /* irq for DSP I/O */ -static int mirq = MIRQ; /* irq for MPU-401 I/O */ -static int dma = DMA; /* dma for DSP I/O */ - -/* Init status of the card */ -static int ae_init = INIT_NONE; /* (bitmapped variable) */ -static int oredparams = 0; /* Will contain or'ed values of params */ -static int gc = 0; /* generic counter (utility counter) */ -struct orVals - { /* Contain the values to be or'ed */ - int val; /* irq|mirq|dma */ - int or; /* oredparams |= TheStruct.or */ - }; - -/* - * Magic values that the DSP will eat when configuring irq/mirq/dma - */ -/* DSP IRQ conversion array */ -static struct orVals orIRQ[] = -{ - {0x05, 0x28}, - {0x07, 0x08}, - {0x09, 0x10}, - {0x0a, 0x18}, - {0x0b, 0x20}, - {0x00, 0x00} -}; - -/* MPU-401 IRQ conversion array */ -static struct orVals orMIRQ[] = -{ - {0x05, 0x04}, - {0x07, 0x44}, - {0x09, 0x84}, - {0x0a, 0xc4}, - {0x00, 0x00} -}; - -/* DMA Channels conversion array */ -static struct orVals orDMA[] = -{ - {0x00, 0x01}, - {0x01, 0x02}, - {0x03, 0x03}, - {0x00, 0x00} -}; - -/* - * Buffers to store audio card informations - */ -static char AudioExcelName[CARDNAMELEN + 1]; -static char AudioExcelVersion[CARDVERLEN + 1]; - -static void -tenmillisec (void) -{ - - for (gc = 0; gc < 1000; gc++) - tenmicrosec (); -} - -static int -WaitForDataAvail (int port) -{ - int loop = STATUSRETRY; - unsigned char ret = 0; - - do - { - ret = INB (port + DSP_DATAVAIL); - /* - * Wait for data available (bit 7 of ret == 1) - */ - } - while (!(ret & 0x80) && loop--); - - if (ret & 0x80) - return 0; - - return -1; -} - -static int -ReadData (int port) -{ - if (WaitForDataAvail (port)) - return -1; - return INB (port + DSP_READ); -} - -static int -CheckDSPOkay (int port) -{ - return ((ReadData (port) == 0xaa) ? 0 : -1); -} - -static int -ResetBoard (int port) -{ - /* - * Reset DSP - */ - OUTB (1, (port + DSP_RESET)); - tenmicrosec (); - OUTB (0, (port + DSP_RESET)); - tenmicrosec (); - tenmicrosec (); - return CheckDSPOkay (port); -} - -static int -WriteDSPCommand (int port, int cmd) -{ - unsigned char ret; - int loop = HARDRETRY; - - do - { - ret = INB (port + DSP_STATUS); - /* - * DSP ready to receive data if bit 7 of ret == 0 - */ - if (!(ret & 0x80)) - { - OUTB (cmd, port + DSP_COMMAND); - return 0; - } - } - while (loop--); - - printk ("[aedsp16] DSP Command (0x%x) timeout.\n", cmd); - return -1; -} - -int -InitMSS (int port) -{ - - tenmillisec (); - - if (WriteDSPCommand (port, CMD6)) - { - printk ("[aedsp16] CMD 0x%x: failed!\n", CMD6); - return -1; - } - - tenmillisec (); - - return 0; -} - -static int -SetUpBoard (int port) -{ - int loop = RETRY; - - do - { - if (WriteDSPCommand (portbase, CMD3)) - { - printk ("[aedsp16] CMD 0x%x: failed!\n", CMD3); - return -1; - } - - tenmillisec (); - - } - while (WaitForDataAvail (port) && loop--); - -#if defined(THIS_SHOULD_GO_AWAY) - if (CheckDSPOkay (port)) - { - printk ("[aedsp16] CheckDSPOkay: failed\n"); - return -1; - } -#else - if (ReadData (port) == -1) - { - printk ("[aedsp16] ReadData after CMD 0x%x: failed\n", CMD3); - return -1; - } -#endif - - if (WriteDSPCommand (portbase, CMD4)) - { - printk ("[aedsp16] CMD 0x%x: failed!\n", CMD4); - return -1; - } - - if (WriteDSPCommand (portbase, CMD5)) - { - printk ("[aedsp16] CMD 0x%x: failed!\n", CMD5); - return -1; - } - - if (WriteDSPCommand (portbase, oredparams)) - { - printk ("[aedsp16] Initialization of (M)IRQ and DMA: failed!\n"); - return -1; - } - return 0; -} - -static int -GetCardVersion (int port) -{ - int len = 0; - int ret; - int ver[3]; - - do - { - if ((ret = ReadData (port)) == -1) - return -1; - /* - * We alredy know how many int are stored (2), so we know when the - * string is finished. - */ - ver[len++] = ret; - } - while (len < CARDVERLEN); - sprintf (AudioExcelVersion, "%d.%d", ver[0], ver[1]); - return 0; -} - -static int -GetCardName (int port) -{ - int len = 0; - int ret; - - do - { - if ((ret = ReadData (port)) == -1) - /* - * If no more data availabe, return to the caller, no error if len>0. - * We have no other way to know when the string is finished. - */ - return (len ? 0 : -1); - - AudioExcelName[len++] = ret; - - } - while (len < CARDNAMELEN); - return 0; -} - -static void -InitializeHardParams (void) -{ - - memset (AudioExcelName, 0, CARDNAMELEN + 1); - memset (AudioExcelVersion, 0, CARDVERLEN + 1); - - for (gc = 0; orIRQ[gc].or; gc++) - if (orIRQ[gc].val == irq) - oredparams |= orIRQ[gc].or; - - for (gc = 0; orMIRQ[gc].or; gc++) - if (orMIRQ[gc].or == mirq) - oredparams |= orMIRQ[gc].or; - - for (gc = 0; orDMA[gc].or; gc++) - if (orDMA[gc].val == dma) - oredparams |= orDMA[gc].or; -} - -static int -InitAEDSP16 (int which) -{ - static char *InitName = NULL; - - InitializeHardParams (); - - if (ResetBoard (portbase)) - { - printk ("[aedsp16] ResetBoard: failed!\n"); - return -1; - } - -#if defined(THIS_SHOULD_GO_AWAY) - if (CheckDSPOkay (portbase)) - { - printk ("[aedsp16] CheckDSPOkay: failed!\n"); - return -1; - } -#endif - - if (WriteDSPCommand (portbase, CMD1)) - { - printk ("[aedsp16] CMD 0x%x: failed!\n", CMD1); - return -1; - } - - if (GetCardName (portbase)) - { - printk ("[aedsp16] GetCardName: failed!\n"); - return -1; - } - - /* - * My AEDSP16 card return SC-6000 in AudioExcelName, so - * if we have something different, we have to be warned. - */ - if (strcmp ("SC-6000", AudioExcelName)) - printk ("[aedsp16] Warning: non SC-6000 audio card!\n"); - - if (WriteDSPCommand (portbase, CMD2)) - { - printk ("[aedsp16] CMD 0x%x: failed!\n", CMD2); - return -1; - } - - if (GetCardVersion (portbase)) - { - printk ("[aedsp16] GetCardVersion: failed!\n"); - return -1; - } - - if (SetUpBoard (portbase)) - { - printk ("[aedsp16] SetUpBoard: failed!\n"); - return -1; - } - - if (which == INIT_MSS) - { - if (InitMSS (portbase)) - { - printk ("[aedsp16] Can't initialize Microsoft Sound System mode.\n"); - return -1; - } - } - - /* - * If we are resetting, do not print any message because we may be - * in playing and we do not want lost too much time. - */ - if (!(which & RESET_DSP16)) - { - if (which & INIT_MPU401) - InitName = "MPU401"; - else if (which & INIT_SBPRO) - InitName = "SBPro"; - else if (which & INIT_MSS) - InitName = "MSS"; - else - InitName = "None"; - - printk ("Audio Excel DSP 16 init v%s (%s %s) [%s]\n", - VERSION, AudioExcelName, - AudioExcelVersion, InitName); - } - - tenmillisec (); - - return 0; -} - -#if defined(AEDSP16_SBPRO) - -int -InitAEDSP16_SBPRO (struct address_info *hw_config) -{ - /* - * If the card is alredy init'ed MSS, we can not init it to SBPRO too - * because the board can not emulate simultaneously MSS and SBPRO. - */ - if (ae_init & INIT_MSS) - return -1; - if (ae_init & INIT_SBPRO) - return 0; - - /* - * For now we will leave this - * code included only when INCLUDE_AEDSP16 is configured in, but it should - * be better include it every time. - */ - if (!(ae_init & INIT_MPU401)) - { - if (check_region (hw_config->io_base, 0x0f)) - { - printk ("AEDSP16/SBPRO I/O port region is alredy in use.\n"); - return -1; - } - } - - /* - * Set up the internal hardware parameters, to let the driver reach - * the Sound Card. - */ - portbase = hw_config->io_base; - irq = hw_config->irq; - dma = hw_config->dma; - if (InitAEDSP16 (INIT_SBPRO)) - return -1; - - if (!(ae_init & INIT_MPU401)) - request_region (hw_config->io_base, 0x0f, "aedsp16 (sbpro)"); - - ae_init |= INIT_SBPRO; - return 0; -} - -#endif /* AEDSP16_SBPRO */ - -#if defined(AEDSP16_MSS) - -int -InitAEDSP16_MSS (struct address_info *hw_config) -{ - /* - * If the card is alredy init'ed SBPRO, we can not init it to MSS too - * because the board can not emulate simultaneously MSS and SBPRO. - */ - if (ae_init & INIT_SBPRO) - return -1; - if (ae_init & INIT_MSS) - return 0; - - /* - * For now we will leave this - * code included only when INCLUDE_AEDSP16 is configured in, but it should - * be better include it every time. - */ - if (check_region (hw_config->io_base, 0x08)) - { - printk ("MSS I/O port region is alredy in use.\n"); - return -1; - } - - /* - * We must allocate the AEDSP16 region too because these are the I/O ports - * to access card's control registers. - */ - if (!(ae_init & INIT_MPU401)) - { - if (check_region (AEDSP16_BASE, 0x0f)) - { - printk ("AEDSP16 I/O port region is alredy in use.\n"); - return -1; - } - } - - - /* - * If we are configuring the card for MSS, the portbase for card configuration - * is the default one (0x220 unless you have changed the factory default - * with board switches), so no need to modify the portbase variable. - * The default is AEDSP16_BASE, that is the right value. - */ - irq = hw_config->irq; - dma = hw_config->dma; - if (InitAEDSP16 (INIT_MSS)) - return -1; - - request_region (hw_config->io_base, 0x08, "aedsp16 (mss)"); - - if (!(ae_init & INIT_MPU401)) - request_region (AEDSP16_BASE, 0x0f, "aedsp16 (sbpro)"); - - ae_init |= INIT_MSS; - return 0; -} - -#endif /* AEDSP16_MSS */ - -#if defined(AEDSP16_MPU401) - -int -InitAEDSP16_MPU401 (struct address_info *hw_config) -{ - if (ae_init & INIT_MPU401) - return 0; - - /* - * For now we will leave this - * code included only when INCLUDE_AEDSP16 is configured in, but it should - * be better include it every time. - */ - if (check_region (hw_config->io_base, 0x02)) - { - printk ("SB I/O port region is alredy in use.\n"); - return -1; - } - - /* - * We must allocate the AEDSP16 region too because these are the I/O ports - * to access card's control registers. - */ - if (!(ae_init & (INIT_MSS | INIT_SBPRO))) - { - if (check_region (AEDSP16_BASE, 0x0f)) - { - printk ("AEDSP16 I/O port region is alredy in use.\n"); - return -1; - } - } - - /* - * If mpu401, the irq and dma are not important, do not touch it - * because we may use the default if sbpro is not yet configured, - * we may use the sbpro ones if configured, and nothing wrong - * should happen. - * - * The mirq default is 0, but once set it to non-0 value, we should - * not touch it anymore (unless I write an ioctl to do it, of course). - */ - mirq = hw_config->irq; - if (InitAEDSP16 (INIT_MPU401)) - return -1; - - request_region (hw_config->io_base, 0x02, "aedsp16 (mpu401)"); - - if (!(ae_init & (INIT_MSS | INIT_SBPRO))) - request_region (AEDSP16_BASE, 0x0f, "aedsp16 (sbpro)"); - - ae_init |= INIT_MPU401; - return 0; -} - -#endif /* AEDSP16_MPU401 */ - -#if 0 /* Leave it out for now. We are not using this portion of code. */ - -/* - * Entry point for a reset function. - * May be I will write the infamous ioctl :) - */ -int -ResetAEDSP16 (void) -{ -#if defined(AEDSP16_DEBUG) - printk ("[aedsp16] ResetAEDSP16 called.\n"); -#endif - return InitAEDSP16 (RESET_DSP16); -} - -#endif /* 0 */ - -#endif /* !EXCLUDE_AEDSP16 */ diff --git a/sys/pc98/pc98/sound/audio.c b/sys/pc98/pc98/sound/audio.c index c6f7972bc377..51e983dffd86 100644 --- a/sys/pc98/pc98/sound/audio.c +++ b/sys/pc98/pc98/sound/audio.c @@ -27,7 +27,11 @@ * */ +#ifdef PC98 +#include +#else #include +#endif #ifdef CONFIGURE_SOUNDCARD #ifndef EXCLUDE_AUDIO diff --git a/sys/pc98/pc98/sound/coproc.h b/sys/pc98/pc98/sound/coproc.h deleted file mode 100644 index f9023821d3f2..000000000000 --- a/sys/pc98/pc98/sound/coproc.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Definitions for various on board processors on the soundcards. For - * example DSP processors. - */ - -/* - * Coprocessor access types - */ -#define COPR_CUSTOM 0x0001 /* Custom applications */ -#define COPR_MIDI 0x0002 /* MIDI (MPU-401) emulation */ -#define COPR_PCM 0x0004 /* Digitized voice applications */ -#define COPR_SYNTH 0x0008 /* Music synthesis */ diff --git a/sys/pc98/pc98/sound/dev_table.c b/sys/pc98/pc98/sound/dev_table.c index 49023249a6be..2b6142b4f77a 100644 --- a/sys/pc98/pc98/sound/dev_table.c +++ b/sys/pc98/pc98/sound/dev_table.c @@ -28,7 +28,11 @@ */ #define _DEV_TABLE_C_ +#ifdef PC98 +#include +#else #include +#endif #ifdef CONFIGURE_SOUNDCARD diff --git a/sys/pc98/pc98/sound/dmabuf.c b/sys/pc98/pc98/sound/dmabuf.c index 20095d211ab7..90673afcc848 100644 --- a/sys/pc98/pc98/sound/dmabuf.c +++ b/sys/pc98/pc98/sound/dmabuf.c @@ -27,7 +27,11 @@ * */ +#ifdef PC98 +#include +#else #include +#endif #ifdef CONFIGURE_SOUNDCARD diff --git a/sys/pc98/pc98/sound/finetune.h b/sys/pc98/pc98/sound/finetune.h deleted file mode 100644 index b86a0eb15a1f..000000000000 --- a/sys/pc98/pc98/sound/finetune.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifdef SEQUENCER_C -/* - * Copyright by Hannu Savolainen 1993 - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - - unsigned short finetune_table[128] = - { -/* 0 */ 9439, 9447, 9456, 9464, 9473, 9481, 9490, 9499, -/* 8 */ 9507, 9516, 9524, 9533, 9542, 9550, 9559, 9567, -/* 16 */ 9576, 9585, 9593, 9602, 9611, 9619, 9628, 9637, -/* 24 */ 9645, 9654, 9663, 9672, 9680, 9689, 9698, 9707, -/* 32 */ 9715, 9724, 9733, 9742, 9750, 9759, 9768, 9777, -/* 40 */ 9786, 9795, 9803, 9812, 9821, 9830, 9839, 9848, -/* 48 */ 9857, 9866, 9874, 9883, 9892, 9901, 9910, 9919, -/* 56 */ 9928, 9937, 9946, 9955, 9964, 9973, 9982, 9991, -/* 64 */ 10000, 10009, 10018, 10027, 10036, 10045, 10054, 10063, -/* 72 */ 10072, 10082, 10091, 10100, 10109, 10118, 10127, 10136, -/* 80 */ 10145, 10155, 10164, 10173, 10182, 10191, 10201, 10210, -/* 88 */ 10219, 10228, 10237, 10247, 10256, 10265, 10274, 10284, -/* 96 */ 10293, 10302, 10312, 10321, 10330, 10340, 10349, 10358, -/* 104 */ 10368, 10377, 10386, 10396, 10405, 10415, 10424, 10433, -/* 112 */ 10443, 10452, 10462, 10471, 10481, 10490, 10499, 10509, -/* 120 */ 10518, 10528, 10537, 10547, 10556, 10566, 10576, 10585 - }; -#else - extern unsigned short finetune_table[128]; -#endif diff --git a/sys/pc98/pc98/sound/gus_hw.h b/sys/pc98/pc98/sound/gus_hw.h deleted file mode 100644 index f97a0b8670e3..000000000000 --- a/sys/pc98/pc98/sound/gus_hw.h +++ /dev/null @@ -1,50 +0,0 @@ - -/* - * I/O addresses - */ - -#define u_Base (gus_base + 0x000) -#define u_Mixer u_Base -#define u_Status (gus_base + 0x006) -#define u_TimerControl (gus_base + 0x008) -#define u_TimerData (gus_base + 0x009) -#define u_IRQDMAControl (gus_base + 0x00b) -#define u_MidiControl (gus_base + 0x100) -#define MIDI_RESET 0x03 -#define MIDI_ENABLE_XMIT 0x20 -#define MIDI_ENABLE_RCV 0x80 -#define u_MidiStatus u_MidiControl -#define MIDI_RCV_FULL 0x01 -#define MIDI_XMIT_EMPTY 0x02 -#define MIDI_FRAME_ERR 0x10 -#define MIDI_OVERRUN 0x20 -#define MIDI_IRQ_PEND 0x80 -#define u_MidiData (gus_base + 0x101) -#define u_Voice (gus_base + 0x102) -#define u_Command (gus_base + 0x103) -#define u_DataLo (gus_base + 0x104) -#define u_DataHi (gus_base + 0x105) -#define u_MixData (gus_base + 0x106) /* Rev. 3.7+ mixing */ -#define u_MixSelect (gus_base + 0x506) /* registers. */ -#define u_IrqStatus u_Status -# define MIDI_TX_IRQ 0x01 /* pending MIDI xmit IRQ */ -# define MIDI_RX_IRQ 0x02 /* pending MIDI recv IRQ */ -# define GF1_TIMER1_IRQ 0x04 /* general purpose timer */ -# define GF1_TIMER2_IRQ 0x08 /* general purpose timer */ -# define WAVETABLE_IRQ 0x20 /* pending wavetable IRQ */ -# define ENVELOPE_IRQ 0x40 /* pending volume envelope IRQ */ -# define DMA_TC_IRQ 0x80 /* pending dma tc IRQ */ - -#define ICS2101 1 -# define ICS_MIXDEVS 6 -# define DEV_MIC 0 -# define DEV_LINE 1 -# define DEV_CD 2 -# define DEV_GF1 3 -# define DEV_UNUSED 4 -# define DEV_VOL 5 - -# define CHN_LEFT 0 -# define CHN_RIGHT 1 -#define CS4231 2 -#define u_DRAMIO (gus_base + 0x107) diff --git a/sys/pc98/pc98/sound/gus_linearvol.h b/sys/pc98/pc98/sound/gus_linearvol.h deleted file mode 100644 index 7ad0c30d4fd9..000000000000 --- a/sys/pc98/pc98/sound/gus_linearvol.h +++ /dev/null @@ -1,18 +0,0 @@ -static unsigned short gus_linearvol[128] = { - 0x0000, 0x08ff, 0x09ff, 0x0a80, 0x0aff, 0x0b40, 0x0b80, 0x0bc0, - 0x0bff, 0x0c20, 0x0c40, 0x0c60, 0x0c80, 0x0ca0, 0x0cc0, 0x0ce0, - 0x0cff, 0x0d10, 0x0d20, 0x0d30, 0x0d40, 0x0d50, 0x0d60, 0x0d70, - 0x0d80, 0x0d90, 0x0da0, 0x0db0, 0x0dc0, 0x0dd0, 0x0de0, 0x0df0, - 0x0dff, 0x0e08, 0x0e10, 0x0e18, 0x0e20, 0x0e28, 0x0e30, 0x0e38, - 0x0e40, 0x0e48, 0x0e50, 0x0e58, 0x0e60, 0x0e68, 0x0e70, 0x0e78, - 0x0e80, 0x0e88, 0x0e90, 0x0e98, 0x0ea0, 0x0ea8, 0x0eb0, 0x0eb8, - 0x0ec0, 0x0ec8, 0x0ed0, 0x0ed8, 0x0ee0, 0x0ee8, 0x0ef0, 0x0ef8, - 0x0eff, 0x0f04, 0x0f08, 0x0f0c, 0x0f10, 0x0f14, 0x0f18, 0x0f1c, - 0x0f20, 0x0f24, 0x0f28, 0x0f2c, 0x0f30, 0x0f34, 0x0f38, 0x0f3c, - 0x0f40, 0x0f44, 0x0f48, 0x0f4c, 0x0f50, 0x0f54, 0x0f58, 0x0f5c, - 0x0f60, 0x0f64, 0x0f68, 0x0f6c, 0x0f70, 0x0f74, 0x0f78, 0x0f7c, - 0x0f80, 0x0f84, 0x0f88, 0x0f8c, 0x0f90, 0x0f94, 0x0f98, 0x0f9c, - 0x0fa0, 0x0fa4, 0x0fa8, 0x0fac, 0x0fb0, 0x0fb4, 0x0fb8, 0x0fbc, - 0x0fc0, 0x0fc4, 0x0fc8, 0x0fcc, 0x0fd0, 0x0fd4, 0x0fd8, 0x0fdc, - 0x0fe0, 0x0fe4, 0x0fe8, 0x0fec, 0x0ff0, 0x0ff4, 0x0ff8, 0x0ffc -}; diff --git a/sys/pc98/pc98/sound/hex2hex.h b/sys/pc98/pc98/sound/hex2hex.h deleted file mode 100644 index ecd7b4c4239c..000000000000 --- a/sys/pc98/pc98/sound/hex2hex.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * This file is a part of configure.c - * - * hex2hex reads an input file in Intel HEX format and produces - * an (unsigned char) array which contains the bytes and writes it to the - * output file using C syntax - */ - -#define MAX_SIZE (256*1024) -#define ABANDON(why) { \ - fprintf(stderr, "%s: " why "\n", source); \ - fclose(inf);fclose(outf);return 0; \ - } - -int hex2hex(char *source, char *target, char *varline) -{ - FILE *inf, *outf; - - int i,l, c; - unsigned char buf[MAX_SIZE]; - - if ((inf=fopen(source, "r"))==NULL) - { - perror(source); - return 0; - } - - if ((outf=fopen(target, "w"))==NULL) - { - perror(target); - fclose(inf); - return 0; - } - - l=0; - - while ((c=getc(inf))!=EOF) - { - if (c == ':') /* Sync with beginning of line */ - { - int n, check; - unsigned char sum; - int addr; - int linetype; - - if (fscanf(inf, "%02x", &n) != 1) - ABANDON("File format error"); - sum = n; - - if (fscanf(inf, "%04x", &addr) != 1) - ABANDON("File format error"); - sum += addr/256; - sum += addr%256; - - if (fscanf(inf, "%02x", &linetype) != 1) - ABANDON("File format error"); - sum += linetype; - - if (linetype != 0) - continue; - - for (i=0;i= MAX_SIZE) - ABANDON("File too large"); - buf[addr++] = c; - if (addr > l) - l = addr; - sum += c; - } - - if (fscanf(inf, "%02x", &check) != 1) - ABANDON("File format error"); - - sum = ~sum + 1; - if (check != sum) - ABANDON("Line checksum error"); - } - } - - fprintf(outf, "/*\n *\t Computer generated file. Do not edit.\n */\n"); - fprintf(outf, "%s[] = {\n", varline); - - for (i=0;i +#include "sb.h" #if NSB == 0 && !defined(EXCLUDE_SB) #define EXCLUDE_SB #endif @@ -72,7 +72,7 @@ #define EXCLUDE_SB16MIDI #endif -#include +#include "pas.h" #if NPAS == 0 && !defined(EXCLUDE_PAS) #define EXCLUDE_PAS #endif diff --git a/sys/pc98/pc98/sound/mad16.h b/sys/pc98/pc98/sound/mad16.h deleted file mode 100644 index 0370973667a4..000000000000 --- a/sys/pc98/pc98/sound/mad16.h +++ /dev/null @@ -1,91 +0,0 @@ - -/* - * Initialization code for OPTI MAD16 interface chip by - * Davor Jadrijevic - * (Included by ad1848.c when MAD16 support is enabled) - * - * It looks like MAD16 is similar than the Mozart chip (OAK OTI-601). - * It could be even possible that these chips are exactly the same. Can - * anybody confirm this? - */ - -static void wr_a_mad16(int base, int v, int a) -{ - OUTB(a, base + 0xf); - OUTB(v, base + 0x11); -} - -static void wr_b_mad16(int base, int v, int a) -{ - OUTB(a, base + 0xf); - OUTB(v, base + 0xd); -} - -/* -static int rd_a_mad16(int base, int a) -{ - OUTB(a, base + 0xf); - return INB(base + 0x11); -} -*/ - -static int rd_b_mad16(int base, int a) -{ - OUTB(a, base + 0xf); - return INB(base + 0xd); -} - -/* -static int rd_0_mad16(int base, int a) -{ - OUTB(a, base + 0xf); - return INB(base + 0xf); -} - -static void wr_ad(int base, int v, int a) -{ - OUTB(a, base + 4); - OUTB(v, base + 5); -} - -static int rd_ad(int base, int a) -{ - OUTB(a, base + 4); - return INB(base + 5); -} -*/ - -static int mad16init(int adr) -{ - int j; - long i; - - static int ad1848_bases[] = -{ 0x220, -1, -1, 0x240, -1, -1, -1, -1, 0x530, 0xE80, 0xF40, 0x604, 0 }; - - int mad16_base = 0xf80, ad1848_base; - - - for(j = 0; (j < 16) && (ad1848_bases[j] != 0); j++) - if(adr == ad1848_bases[j]) - break; - - if( (ad1848_base = ad1848_bases[j]) < 0x530) - { - printk("Unknown MAD16 setting 0x%3X\n", adr); - return -1; - } - - /* printk("OPTi MAD16 WSS at 0x%3X\n", ad1848_base); */ - - rd_b_mad16(mad16_base, 0xe2); - wr_a_mad16(mad16_base, 0x1a, 0xe2); - wr_b_mad16(mad16_base, j * 16 + 1, 0xe2); - wr_a_mad16(mad16_base, 0x1a, 0xe2); - for( i = 0; i < 10000; i++) - if( (INB(ad1848_base+4) & 0x80) == 0 ) - break; - - return 0; -}; - diff --git a/sys/pc98/pc98/sound/midi_ctrl.h b/sys/pc98/pc98/sound/midi_ctrl.h deleted file mode 100644 index 8b68c7d91db3..000000000000 --- a/sys/pc98/pc98/sound/midi_ctrl.h +++ /dev/null @@ -1,22 +0,0 @@ -static unsigned char ctrl_def_values[128] = -{ - 0x40,0x40,0x40,0x40, 0x40,0x40,0x40,0x40, /* 0 to 7 */ - 0x40,0x40,0x40,0x40, 0x40,0x40,0x40,0x40, /* 8 to 15 */ - 0x40,0x40,0x40,0x40, 0x40,0x40,0x40,0x40, /* 16 to 23 */ - 0x40,0x40,0x40,0x40, 0x40,0x40,0x40,0x40, /* 24 to 31 */ - - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, /* 32 to 39 */ - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, /* 40 to 47 */ - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, /* 48 to 55 */ - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, /* 56 to 63 */ - - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, /* 64 to 71 */ - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, /* 72 to 79 */ - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, /* 80 to 87 */ - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, /* 88 to 95 */ - - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, /* 96 to 103 */ - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, /* 104 to 111 */ - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, /* 112 to 119 */ - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, /* 120 to 127 */ -}; diff --git a/sys/pc98/pc98/sound/midi_synth.c b/sys/pc98/pc98/sound/midi_synth.c index fb1fdc42707a..7e4ecb022910 100644 --- a/sys/pc98/pc98/sound/midi_synth.c +++ b/sys/pc98/pc98/sound/midi_synth.c @@ -30,7 +30,11 @@ #define USE_SEQ_MACROS #define USE_SIMPLE_MACROS +#ifdef PC98 +#include +#else #include +#endif #if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_MIDI) diff --git a/sys/pc98/pc98/sound/midi_synth.h b/sys/pc98/pc98/sound/midi_synth.h deleted file mode 100644 index 22f56acccad3..000000000000 --- a/sys/pc98/pc98/sound/midi_synth.h +++ /dev/null @@ -1,48 +0,0 @@ -int midi_synth_ioctl (int dev, - unsigned int cmd, unsigned int arg); -int midi_synth_kill_note (int dev, int channel, int note, int velocity); -int midi_synth_set_instr (int dev, int channel, int instr_no); -int midi_synth_start_note (int dev, int channel, int note, int volume); -void midi_synth_reset (int dev); -int midi_synth_open (int dev, int mode); -void midi_synth_close (int dev); -void midi_synth_hw_control (int dev, unsigned char *event); -int midi_synth_load_patch (int dev, int format, snd_rw_buf * addr, - int offs, int count, int pmgr_flag); -void midi_synth_panning (int dev, int channel, int pressure); -void midi_synth_aftertouch (int dev, int channel, int pressure); -void midi_synth_controller (int dev, int channel, int ctrl_num, int value); -int midi_synth_patchmgr (int dev, struct patmgr_info *rec); -void midi_synth_bender (int dev, int chn, int value); -void midi_synth_setup_voice (int dev, int voice, int chn); - - -#ifndef _MIDI_SYNTH_C_ -static struct synth_info std_synth_info = -{MIDI_SYNTH_NAME, 0, SYNTH_TYPE_MIDI, 0, 0, 128, 0, 128, MIDI_SYNTH_CAPS}; - -static struct synth_operations std_midi_synth = -{ - &std_synth_info, - 0, - SYNTH_TYPE_MIDI, - 0, - midi_synth_open, - midi_synth_close, - midi_synth_ioctl, - midi_synth_kill_note, - midi_synth_start_note, - midi_synth_set_instr, - midi_synth_reset, - midi_synth_hw_control, - midi_synth_load_patch, - midi_synth_aftertouch, - midi_synth_controller, - midi_synth_panning, - NULL, - midi_synth_patchmgr, - midi_synth_bender, - NULL, /* alloc_voice */ - midi_synth_setup_voice -}; -#endif diff --git a/sys/pc98/pc98/sound/midibuf.c b/sys/pc98/pc98/sound/midibuf.c index c05d44000e86..bb4add6a5c1e 100644 --- a/sys/pc98/pc98/sound/midibuf.c +++ b/sys/pc98/pc98/sound/midibuf.c @@ -27,7 +27,11 @@ * */ +#ifdef PC98 +#include +#else #include +#endif static void drain_midi_queue __P((int dev)); diff --git a/sys/pc98/pc98/sound/opl3.c b/sys/pc98/pc98/sound/opl3.c index 42379cd32c47..749e38faaa38 100644 --- a/sys/pc98/pc98/sound/opl3.c +++ b/sys/pc98/pc98/sound/opl3.c @@ -34,7 +34,11 @@ * hooft@chem.ruu.nl */ +#ifdef PC98 +#include +#else #include +#endif #if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_YM3812) diff --git a/sys/pc98/pc98/sound/opl3.h b/sys/pc98/pc98/sound/opl3.h deleted file mode 100644 index d25116b22a9b..000000000000 --- a/sys/pc98/pc98/sound/opl3.h +++ /dev/null @@ -1,261 +0,0 @@ -/* - * opl3.h - Definitions of the OPL-3 registers - * - * Copyright by Hannu Savolainen 1993 - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* - * The OPL-3 mode is switched on by writing 0x01, to the offset 5 - * of the right side. - * - * Another special register at the right side is at offset 4. It contains - * a bit mask defining which voices are used as 4 OP voices. - * - * The percussive mode is implemented in the left side only. - * - * With the above exeptions the both sides can be operated independently. - * - * A 4 OP voice can be created by setting the corresponding - * bit at offset 4 of the right side. - * - * For example setting the rightmost bit (0x01) changes the - * first voice on the right side to the 4 OP mode. The fourth - * voice is made inaccessible. - * - * If a voice is set to the 2 OP mode, it works like 2 OP modes - * of the original YM3812 (AdLib). In addition the voice can - * be connected the left, right or both stereo channels. It can - * even be left unconnected. This works with 4 OP voices also. - * - * The stereo connection bits are located in the FEEDBACK_CONNECTION - * register of the voice (0xC0-0xC8). In 4 OP voices these bits are - * in the second half of the voice. - */ - -/* - * Register numbers for the global registers - */ - -#define TEST_REGISTER 0x01 -#define ENABLE_WAVE_SELECT 0x20 - -#define TIMER1_REGISTER 0x02 -#define TIMER2_REGISTER 0x03 -#define TIMER_CONTROL_REGISTER 0x04 /* Left side */ -#define IRQ_RESET 0x80 -#define TIMER1_MASK 0x40 -#define TIMER2_MASK 0x20 -#define TIMER1_START 0x01 -#define TIMER2_START 0x02 - -#define CONNECTION_SELECT_REGISTER 0x04 /* Right side */ -#define RIGHT_4OP_0 0x01 -#define RIGHT_4OP_1 0x02 -#define RIGHT_4OP_2 0x04 -#define LEFT_4OP_0 0x08 -#define LEFT_4OP_1 0x10 -#define LEFT_4OP_2 0x20 - -#define OPL3_MODE_REGISTER 0x05 /* Right side */ -#define OPL3_ENABLE 0x01 -#define OPL4_ENABLE 0x02 - -#define KBD_SPLIT_REGISTER 0x08 /* Left side */ -#define COMPOSITE_SINE_WAVE_MODE 0x80 /* Don't use with OPL-3? */ -#define KEYBOARD_SPLIT 0x40 - -#define PERCUSSION_REGISTER 0xbd /* Left side only */ -#define TREMOLO_DEPTH 0x80 -#define VIBRATO_DEPTH 0x40 -#define PERCUSSION_ENABLE 0x20 -#define BASSDRUM_ON 0x10 -#define SNAREDRUM_ON 0x08 -#define TOMTOM_ON 0x04 -#define CYMBAL_ON 0x02 -#define HIHAT_ON 0x01 - -/* - * Offsets to the register banks for operators. To get the - * register number just add the operator offset to the bank offset - * - * AM/VIB/EG/KSR/Multiple (0x20 to 0x35) - */ - #define AM_VIB 0x20 - #define TREMOLO_ON 0x80 - #define VIBRATO_ON 0x40 - #define SUSTAIN_ON 0x20 - #define KSR 0x10 /* Key scaling rate */ - #define MULTIPLE_MASK 0x0f /* Frequency multiplier */ - - /* - * KSL/Total level (0x40 to 0x55) - */ -#define KSL_LEVEL 0x40 -#define KSL_MASK 0xc0 /* Envelope scaling bits */ -#define TOTAL_LEVEL_MASK 0x3f /* Strength (volume) of OP */ - -/* - * Attack / Decay rate (0x60 to 0x75) - */ -#define ATTACK_DECAY 0x60 -#define ATTACK_MASK 0xf0 -#define DECAY_MASK 0x0f - -/* - * Sustain level / Release rate (0x80 to 0x95) - */ -#define SUSTAIN_RELEASE 0x80 -#define SUSTAIN_MASK 0xf0 -#define RELEASE_MASK 0x0f - -/* - * Wave select (0xE0 to 0xF5) - */ -#define WAVE_SELECT 0xe0 - -/* - * Offsets to the register banks for voices. Just add to the - * voice number to get the register number. - * - * F-Number low bits (0xA0 to 0xA8). - */ -#define FNUM_LOW 0xa0 - -/* - * F-number high bits / Key on / Block (octave) (0xB0 to 0xB8) - */ -#define KEYON_BLOCK 0xb0 -#define KEYON_BIT 0x20 -#define BLOCKNUM_MASK 0x1c -#define FNUM_HIGH_MASK 0x03 - -/* - * Feedback / Connection (0xc0 to 0xc8) - * - * These registers have two new bits when the OPL-3 mode - * is selected. These bits controls connecting the voice - * to the stereo channels. For 4 OP voices this bit is - * defined in the second half of the voice (add 3 to the - * register offset). - * - * For 4 OP voices the connection bit is used in the - * both halfs (gives 4 ways to connect the operators). - */ -#define FEEDBACK_CONNECTION 0xc0 -#define FEEDBACK_MASK 0x0e /* Valid just for 1st OP of a voice */ -#define CONNECTION_BIT 0x01 -/* - * In the 4 OP mode there is four possible configurations how the - * operators can be connected together (in 2 OP modes there is just - * AM or FM). The 4 OP connection mode is defined by the rightmost - * bit of the FEEDBACK_CONNECTION (0xC0-0xC8) on the both halfs. - * - * First half Second half Mode - * - * +---+ - * v | - * 0 0 >+-1-+--2--3--4--> - * - * - * - * +---+ - * | | - * 0 1 >+-1-+--2-+ - * |-> - * >--3----4-+ - * - * +---+ - * | | - * 1 0 >+-1-+-----+ - * |-> - * >--2--3--4-+ - * - * +---+ - * | | - * 1 1 >+-1-+--+ - * | - * >--2--3-+-> - * | - * >--4----+ - */ -#define STEREO_BITS 0x30 /* OPL-3 only */ -#define VOICE_TO_LEFT 0x10 -#define VOICE_TO_RIGHT 0x20 - -/* - * Definition table for the physical voices - */ - -struct physical_voice_info { - unsigned char voice_num; - unsigned char voice_mode; /* 0=unavailable, 2=2 OP, 4=4 OP */ - unsigned short ioaddr; /* I/O port (left or right side) */ - unsigned char op[4]; /* Operator offsets */ - }; - -/* - * There is 18 possible 2 OP voices - * (9 in the left and 9 in the right). - * The first OP is the modulator and 2nd is the carrier. - * - * The first three voices in the both sides may be connected - * with another voice to a 4 OP voice. For example voice 0 - * can be connected with voice 3. The operators of voice 3 are - * used as operators 3 and 4 of the new 4 OP voice. - * In this case the 2 OP voice number 0 is the 'first half' and - * voice 3 is the second. - */ - -#define USE_LEFT 0 -#define USE_RIGHT 1 - -static struct physical_voice_info physical_voices[18] = -{ -/* No Mode Side OP1 OP2 OP3 OP4 */ -/* --------------------------------------------------- */ - { 0, 2, USE_LEFT, {0x00, 0x03, 0x08, 0x0b}}, - { 1, 2, USE_LEFT, {0x01, 0x04, 0x09, 0x0c}}, - { 2, 2, USE_LEFT, {0x02, 0x05, 0x0a, 0x0d}}, - - { 3, 2, USE_LEFT, {0x08, 0x0b, 0x00, 0x00}}, - { 4, 2, USE_LEFT, {0x09, 0x0c, 0x00, 0x00}}, - { 5, 2, USE_LEFT, {0x0a, 0x0d, 0x00, 0x00}}, - - { 6, 2, USE_LEFT, {0x10, 0x13, 0x00, 0x00}}, /* Used by percussive voices */ - { 7, 2, USE_LEFT, {0x11, 0x14, 0x00, 0x00}}, /* if the percussive mode */ - { 8, 2, USE_LEFT, {0x12, 0x15, 0x00, 0x00}}, /* is selected */ - - { 0, 2, USE_RIGHT, {0x00, 0x03, 0x08, 0x0b}}, - { 1, 2, USE_RIGHT, {0x01, 0x04, 0x09, 0x0c}}, - { 2, 2, USE_RIGHT, {0x02, 0x05, 0x0a, 0x0d}}, - - { 3, 2, USE_RIGHT, {0x08, 0x0b, 0x00, 0x00}}, - { 4, 2, USE_RIGHT, {0x09, 0x0c, 0x00, 0x00}}, - { 5, 2, USE_RIGHT, {0x0a, 0x0d, 0x00, 0x00}}, - - { 6, 2, USE_RIGHT, {0x10, 0x13, 0x00, 0x00}}, - { 7, 2, USE_RIGHT, {0x11, 0x14, 0x00, 0x00}}, - { 8, 2, USE_RIGHT, {0x12, 0x15, 0x00, 0x00}} -}; diff --git a/sys/pc98/pc98/sound/os.h b/sys/pc98/pc98/sound/os.h deleted file mode 100644 index 3881e37c4ebd..000000000000 --- a/sys/pc98/pc98/sound/os.h +++ /dev/null @@ -1,353 +0,0 @@ -#ifndef _OS_H_ -#define _OS_H_ -/* - * OS specific settings for FreeBSD - * - * This chould be used as an example when porting the driver to a new - * operating systems. - * - * What you should do is to rewrite the soundcard.c and os.h (this file). - * You should create a new subdirectory and put these two files there. - * In addition you have to do a makefile.. - * - * If you have to make changes to other than these two files, please contact me - * before making the changes. It's possible that I have already made the - * change. - */ - -/* - * Insert here the includes required by your kernel. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if NSND > 0 -#define CONFIGURE_SOUNDCARD -#else -#undef CONFIGURED_SOUNDCARD -#endif - - -/* - * Rest of the file is compiled only if the driver is really required. - */ -#ifdef CONFIGURE_SOUNDCARD - -/* - * select() is currently implemented in Linux specific way. Don't enable. - * I don't remember what the SHORT_BANNERS means so forget it. - */ - -/*#undef ALLOW_SELECT*/ -#define SHORT_BANNERS - -/* The soundcard.h could be in a nonstandard place so inclyde it here. */ -#include - -/* - * Here is the first portability problem. Every OS has it's own way to - * pass a pointer to the buffer in read() and write() calls. In Linux it's - * just a char*. In BSD it's struct uio. This parameter is passed to - * all functions called from read() or write(). Since nothing can be - * assumed about this structure, the driver uses set of macros for - * accessing the user buffer. - * - * The driver reads/writes bytes in the user buffer sequentially which - * means that calls like uiomove() can be used. - * - * snd_rw_buf is the type which is passed to the device file specific - * read() and write() calls. - * - * The following macros are used to move date to and from the - * user buffer. These macros should be used only when the - * target or source parameter has snd_rw_buf type. - * The offs parameter is a offset relative to the beginning of - * the user buffer. In Linux the offset is required but for example - * BSD passes the offset info in the uio structure. It could be usefull - * if these macros verify that the offs parameter and the value in - * the snd_rw_buf structure are equal. - */ -typedef struct uio snd_rw_buf; - -/* - * Move bytes from the buffer which the application given in a - * write() call. - * offs is position relative to the beginning of the buffer in - * user space. The count is number of bytes to be moved. - */ -#define COPY_FROM_USER(target, source, offs, count) \ - do { if (uiomove((caddr_t ) target, count, (struct uio *)source)) { \ - printf ("sb: Bad copyin()!\n"); \ - } } while(0) - -/* Like COPY_FOM_USER but for writes. */ - -#define COPY_TO_USER(target, offs, source, count) \ - do { if (uiomove(source, count, (struct uio *)target)) { \ - printf ("sb: Bad copyout()!\n"); \ - } } while(0) -/* - * The following macros are like COPY_*_USER but work just with one byte (8bit), - * short (16 bit) or long (32 bit) at a time. - * The same restrictions apply than for COPY_*_USER - */ -#define GET_BYTE_FROM_USER(target, addr, offs) {uiomove((char*)&(target), 1, (struct uio *)addr);} -#define GET_SHORT_FROM_USER(target, addr, offs) {uiomove((char*)&(target), 2, (struct uio *)addr);} -#define GET_WORD_FROM_USER(target, addr, offs) {uiomove((char*)&(target), 4, (struct uio *)addr);} -#define PUT_WORD_TO_USER(addr, offs, data) {uiomove((char*)&(data), 4, (struct uio *)addr);} - - -#define EREMOTEIO -1 - -/* - * The way how the ioctl arguments are passed is another nonportable thing. - * In Linux the argument is just a pointer directly to the user segment. On - * FreeBSD the data is already moved to the kernel space. The following - * macros should handle the difference. - */ - -/* - * IOCTL_FROM_USER is used to copy a record pointed by the argument to - * a buffer in the kernel space. On FreeBSD it can be done just by calling - * memcpy. With Linux a memcpy_from_fs should be called instead. - * Parameters of the following macros are like in the COPY_*_USER macros. - */ - -/* - * When the ioctl argument points to a record or array (longer than 32 bits), - * the macros IOCTL_*_USER are used. It's assumed that the source and target - * parameters are direct memory addresses. - */ -#define IOCTL_FROM_USER(target, source, offs, count) {memcpy(target, &((source)[offs]), count);} -#define IOCTL_TO_USER(target, offs, source, count) {memcpy(&((target)[offs]), source, count);} -/* The following macros are used if the ioctl argument points to 32 bit int */ -#define IOCTL_IN(arg) (*(int*)arg) -#define IOCTL_OUT(arg, ret) *(int*)arg = ret - -/* - * When the driver displays something to the console, printk() will be called. - * The name can be changed here. - */ -#define printk printf - -/* - * The following macros define an interface to the process management. - */ - -struct snd_wait { - int mode; - int aborting; -}; - -/* - * DEFINE_WAIT_QUEUE is used where a wait queue is required. It must define - * a structure which can be passed as a parameter to a sleep(). The second - * parameter is name of a flag variable (must be defined as int). - */ -#define DEFINE_WAIT_QUEUE(qname, flag) static int *qname = NULL; \ - static volatile struct snd_wait flag = {0} -/* Like the above but defines an array of wait queues and flags */ -#define DEFINE_WAIT_QUEUES(qname, flag) static int *qname = {NULL}; \ - static volatile struct snd_wait flag = {{0}} - -#define RESET_WAIT_QUEUE(q, f) {f.aborting = 0;f.mode = WK_NONE;} -#define SET_ABORT_FLAG(q, f) f.aborting = 1 -#define TIMED_OUT(q, f) (f.mode & WK_TIMEOUT) -#define SOMEONE_WAITING(q, f) (f.mode & WK_SLEEP) -/* - * This driver handles interrupts little bit nonstandard way. The following - * macro is used to test if the current process has received a signal which - * is aborts the process. This macro is called from close() to see if the - * buffers should be discarded. If this kind info is not available, a constant - * 1 or 0 could be returned (1 should be better than 0). - */ -#define PROCESS_ABORTING(q, f) (f.aborting || CURSIG(curproc)) - -/* - * The following macro calls tsleep. It should be implemented such that - * the process is resumed if it receives a signal. - * The q parameter is a wait_queue defined with DEFINE_WAIT_QUEUE(), - * and the second is a workarea parameter. The third is a timeout - * in ticks. Zero means no timeout. - */ -#define DO_SLEEP(q, f, time_limit) \ - { \ - int flag; \ - f.mode = WK_SLEEP; \ - flag=tsleep(&q, (PRIBIO-5)|PCATCH, "sndint", time_limit); \ - f.mode &= ~WK_SLEEP; \ - if (flag == EWOULDBLOCK) { \ - f.mode |= WK_TIMEOUT; \ - f.aborting = 0; \ - } else \ - f.aborting = flag; \ - } -/* An the following wakes up a process */ -#define WAKE_UP(q, f) wakeup(&q) - -/* - * Timing macros. This driver assumes that there is a timer running in the - * kernel. The timer should return a value which is increased once at every - * timer tick. The macro HZ should return the number of such ticks/sec. - */ - -#ifndef HZ -#define HZ hz -#endif - -/* - * GET_TIME() returns current value of the counter incremented at timer - * ticks. This can overflow, so the timeout might be real big... - * - */ - -extern unsigned long get_time(void); -#define GET_TIME() get_time() -/*#define GET_TIME() (lbolt) */ /* Returns current time (1/HZ secs since boot) */ - -/* - * The following three macros are called before and after atomic - * code sequences. The flags parameter has always type of unsigned long. - * The macro DISABLE_INTR() should ensure that all interrupts which - * may invoke any part of the driver (timer, soundcard interrupts) are - * disabled. - * RESTORE_INTR() should return the interrupt status back to the - * state when DISABLE_INTR() was called. The flags parameter is - * a variable which can carry 32 bits of state information between - * DISABLE_INTR() and RESTORE_INTR() calls. - */ -#define DISABLE_INTR(flags) flags = splhigh() -#define RESTORE_INTR(flags) splx(flags) - -/* - * INB() and OUTB() should be obvious. NOTE! The order of - * paratemeters of OUTB() is different than on some other - * operating systems. - */ - -#define INB inb -#define INW inb - -#if 0 -/* - * The outb(0, 0x80) is just for slowdown. It's bit unsafe since - * this address could be used for something usefull. - */ -#ifdef PC98 -#define OUTB(addr, data) {outb(data, addr);outb(0x5f, 0);} -#define OUTW(addr, data) {outw(data, addr);outb(0x5f, 0);} -#else -#define OUTB(addr, data) {outb(data, addr);outb(0, 0x80);} -#define OUTW(addr, data) {outw(data, addr);outb(0, 0x80);} -#endif -#else -#define OUTB(addr, data) outb(data, addr) -#define OUTW(addr, data) outw(data, addr) -#endif - -/* memcpy() was not defined on FreeBSD. Lets define it here */ -#define memcpy(d, s, c) bcopy(s, d, c) - -/* - * When a error (such as EINVAL) is returned by a function, - * the following macro is used. The driver assumes that a - * error is signalled by returning a negative value. - */ - -#define RET_ERROR(err) -(err) - -/* - KERNEL_MALLOC() allocates requested number of memory and - KERNEL_FREE is used to free it. - These macros are never called from interrupt, in addition the - nbytes will never be more than 4096 bytes. Generally the driver - will allocate memory in blocks of 4k. If the kernel has just a - page level memory allocation, 4K can be safely used as the size - (the nbytes parameter can be ignored). -*/ -#define KERNEL_MALLOC(nbytes) malloc(nbytes, M_TEMP, M_WAITOK) -#define KERNEL_FREE(addr) free(addr, M_TEMP) - -/* - * The macro PERMANENT_MALLOC(typecast, mem_ptr, size, linux_ptr) - * returns size bytes of - * (kernel virtual) memory which will never get freed by the driver. - * This macro is called only during boot. The linux_ptr is a linux specific - * parameter which should be ignored in other operating systems. - * The mem_ptr is a pointer variable where the macro assigns pointer to the - * memory area. The type is the type of the mem_ptr. - */ -#define PERMANENT_MALLOC(typecast, mem_ptr, size, linux_ptr) \ - {mem_ptr = (typecast)malloc(size, M_DEVBUF, M_NOWAIT); \ - if (!mem_ptr)panic("SOUND: Cannot allocate memory\n");} - -/* - * The macro DEFINE_TIMER defines variables for the ACTIVATE_TIMER if - * required. The name is the variable/name to be used and the proc is - * the procedure to be called when the timer expires. - */ - -#define DEFINE_TIMER(name, proc) - -/* - * The ACTIVATE_TIMER requests system to call 'proc' after 'time' ticks. - */ - -#define ACTIVATE_TIMER(name, proc, time) \ - timeout((timeout_func_t)proc, 0, time); -/* - * The rest of this file is not complete yet. The functions using these - * macros will not work - */ -#define ALLOC_DMA_CHN(chn,deviceID) (isa_dma_acquire(chn)) -#define RELEASE_DMA_CHN(chn) (isa_dma_release(chn)) -#define DMA_MODE_READ 0 -#define DMA_MODE_WRITE 1 -#define RELEASE_IRQ(irq_no) - -/* - * The macro DECLARE_FILE() adds an entry to struct fileinfo referencing the - * connected filestructure. - * This entry must be initialized in sound_open() in soundcard.c - * - * ISSET_FILE_FLAG() allows checking of flags like O_NONBLOCK on files - * - */ - -#define DECLARE_FILE() struct file *filp -#ifdef notdef -#define ISSET_FILE_FLAG(fileinfo, flag) (fileinfo->filp->f_flag & (flag) ? \ - 1 : 0) -#else -#define ISSET_FILE_FLAG(fileinfo, flag) 0 -#endif -#define INT_HANDLER_PROTO() void(*hndlr)(int) -#define INT_HANDLER_PARMS(irq, parms) int irq -#define INT_HANDLER_CALL(irq) irq - -/* - * For select call... - */ -#ifdef ALLOW_SELECT -typedef struct proc select_table; -#define SEL_IN FREAD -#define SEL_OUT FWRITE -#define SEL_EX 0 -extern struct selinfo selinfo[]; -#endif -#endif -#endif diff --git a/sys/pc98/pc98/sound/pas.h b/sys/pc98/pc98/sound/pas.h deleted file mode 100644 index c4af2d499db4..000000000000 --- a/sys/pc98/pc98/sound/pas.h +++ /dev/null @@ -1,250 +0,0 @@ -/* */ -/* Port addresses and bit fields for the Media Vision Pro AudioSpectrum second generation sound cards. */ -/* */ -/* Feel free to use this header file in any application you create that has support for the Media Vision */ -/* Pro AudioSpectrum second generation sound cards. Other uses prohibited without prior permission. */ -/* */ -/* - cmetz@thor.tjhsst.edu */ -/* */ -/* Notes: */ -/* */ -/* * All of these ports go into the MVD101 multimedia controller chip, which then signals the other chips to do */ -/* the actual work. Many ports like the FM ones functionally attach directly to the destination chip though */ -/* they don't actually have a direct connection. */ -/* */ -/* * The PAS2 series cards have an MVD101 multimedia controller chip, the original PAS cards don't. The original */ -/* PAS cards are pretty defunct now, so no attempt is made here to support them. */ -/* */ -/* * The PAS2 series cards are all really different at the hardware level, though the MVD101 hides some of the */ -/* incompatibilities, there still are differences that need to be accounted for. */ -/* */ -/* Card CD-ROM interface PCM chip Mixer chip FM chip */ -/* PAS Plus Sony proprietary (Crystal?) 8-bit DAC National OPL3 */ -/* PAS 16 Zilog SCSI MVA416 16-bit Codec MVA508 OPL3 */ -/* CDPC Sony proprietary Sony 16-bit Codec National OPL3 */ -/* Fusion CD 16 Sony proprietary MVA416 16-bit Codec MVA508 OPL3 */ -/* Fusion CD Sony proprietary (Crystal?) 8-bit DAC National OPL3 */ -/* */ -#define PAS_DEFAULT_BASE 0x388 - -/* Symbolic Name Value R W Subsystem Description */ -#define SPEAKER_CONTROL 0x61 /* W PC speaker Control register */ -#define SPEAKER_CONTROL_GHOST 0x738B /* R W PC speaker Control ghost register */ -#define SPEAKER_TIMER_CONTROL 0x43 /* W PC speaker Timer control register */ -#define SPEAKER_TIMER_CONTROL_GHOST 0x778B /* R W PC speaker Timer control register ghost */ -#define SPEAKER_TIMER_DATA 0x42 /* W PC speaker Timer data register */ -#define SPEAKER_TIMER_DATA_GHOST 0x138A /* R W PC speaker Timer data register ghost */ - -#define WARM_BOOT 0x41 /* W Control Used to detect system warm boot */ -#define WARM_BOOT_GHOST 0x7789 /* ? W Control Use to get the card to fake warm boot */ -#define MASTER_DECODE 0x9A01 /* W Control Address >> 2 of card base address */ -#define PRESCALE_DIVIDER 0xBF8A /* R W PCM Ration between Codec clock and master clock */ -#define WAIT_STATE 0xBF88 /* R W Control Four-bit bus wait-state count (~140ns ea.) */ -#define BOARD_REV_ID 0x2789 /* R Control Extended Board Revision ID */ - -#define CHIP_REV 0xFF88 /* R 0=PAS, 1=PAS+, 2=CDPC, 3=PAS16C, 4=PAS16D */ - -#define SYSTEM_CONFIGURATION_1 0x8388 /* R W Control */ - #define S_C_1_PCS_ENABLE 0x01 /* R W PC speaker 1=enable, 0=disable PC speaker emulation */ - #define S_C_1_PCM_CLOCK_SELECT 0x02 /* R W PCM 1=14.31818Mhz/12, 0=28.224Mhz master clock */ - #define S_C_1_FM_EMULATE_CLOCK 0x04 /* R W FM 1=use 28.224Mhz/2, 0=use 14.31818Mhz clock */ - #define S_C_1_PCS_STEREO 0x10 /* R W PC speaker 1=enable PC speaker stereo effect, 0=disable */ - #define S_C_1_PCS_REALSOUND 0x20 /* R W PC speaker 1=enable RealSound enhancement, 0=disable */ - #define S_C_1_FORCE_EXT_RESET 0x40 /* R W Control Force external reset */ - #define S_C_1_FORCE_INT_RESET 0x80 /* R W Control Force internal reset */ -#define SYSTEM_CONFIGURATION_2 0x8389 /* R W Control */ - #define S_C_2_PCM_OVERSAMPLING 0x03 /* R W PCM 00=0x, 01=2x, 10=4x, 11=reserved */ - #define S_C_2_PCM_16_BIT 0x04 /* R W PCM 1=16-bit, 0=8-bit samples */ -#define SYSTEM_CONFIGURATION_3 0x838A /* R W Control */ - #define S_C_3_PCM_CLOCK_SELECT 0x02 /* R W PCM 1=use 1.008Mhz clock for PCM, 0=don't */ -#define SYSTEM_CONFIGURATION_4 0x838B /* R W Control CD-ROM interface controls */ - -#define IO_CONFIGURATION_1 0xF388 /* R W Control */ - #define I_C_1_BOOT_RESET_ENABLE 0x80 /* R W Control 1=reset board on warm boot, 0=don't */ - #define I_C_1_JOYSTICK_ENABLE 0x40 /* R W Control 1=enable joystick port, 0=don't */ -#define IO_CONFIGURATION_2 0xF389 /* R W Control */ - #define I_C_2_PCM_DMA_DISABLED 0x00 /* R W PCM PCM DMA disabled */ -#define IO_CONFIGURATION_3 0xF38A /* R W Control */ - #define I_C_3_PCM_IRQ_DISABLED 0x00 /* R W PCM PCM IRQ disabled */ - -#define COMPATIBILITY_ENABLE 0xF788 /* R W Control */ - #define C_E_MPU401_ENABLE 0x01 /* R W MIDI 1=enable, 0=disable MPU401 MIDI emulation */ - #define C_E_SB_ENABLE 0x02 /* R W PCM 1=enable, 0=disable Sound Blaster emulation */ - #define C_E_SB_ACTIVE 0x04 /* R PCM "Sound Blaster Interrupt active" */ - #define C_E_MPU401_ACTIVE 0x08 /* R MIDI "MPU UART mode active" */ - #define C_E_PCM_COMPRESSION 0x10 /* R W PCM 1=enable, 0=disabled compression */ -#define EMULATION_ADDRESS 0xF789 /* R W Control */ - #define E_A_SB_BASE 0x0f /* R W PCM bits A4-A7 for SB base port */ - #define E_A_MPU401_BASE 0xf0 /* R W MIDI bits A4-A7 for MPU401 base port */ -#define EMULATION_CONFIGURATION 0xFB8A /* R W ***** Only valid on newer PAS2 cards (?) ***** */ - #define E_C_MPU401_IRQ 0x07 /* R W MIDI MPU401 emulation IRQ */ - #define E_C_SB_IRQ 0x38 /* R W PCM SB emulation IRQ */ - #define E_C_SB_DMA 0xC0 /* R W PCM SB emulation DMA */ - -#define OPERATION_MODE_1 0xEF8B /* R Control */ - #define O_M_1_CDROM_TYPE 0x03 /* R CD-ROM 3=SCSI, 2=Sony, 0=no CD-ROM interface */ - #define O_M_1_FM_TYPE 0x04 /* R FM 1=sterero, 0=mono FM chip */ - #define O_M_1_PCM_TYPE 0x08 /* R PCM 1=16-bit Codec, 0=8-bit DAC */ -#define OPERATION_MODE_2 0xFF8B /* R Control */ - #define O_M_2_PCS_ENABLED 0x02 /* R PC speaker PC speaker emulation 1=enabled, 0=disabled */ - #define O_M_2_BUS_TIMING 0x10 /* R Control 1=AT bus timing, 0=XT bus timing */ - #define O_M_2_BOARD_REVISION 0xe0 /* R Control Board revision */ - -#define INTERRUPT_MASK 0x0B8B /* R W Control */ - #define I_M_FM_LEFT_IRQ_ENABLE 0x01 /* R W FM Enable FM left interrupt */ - #define I_M_FM_RIGHT_IRQ_ENABLE 0x02 /* R W FM Enable FM right interrupt */ - #define I_M_PCM_RATE_IRQ_ENABLE 0x04 /* R W PCM Enable Sample Rate interrupt */ - #define I_M_PCM_BUFFER_IRQ_ENABLE 0x08 /* R W PCM Enable Sample Buffer interrupt */ - #define I_M_MIDI_IRQ_ENABLE 0x10 /* R W MIDI Enable MIDI interrupt */ - #define I_M_BOARD_REV 0xE0 /* R Control Board revision */ - -#define INTERRUPT_STATUS 0x0B89 /* R W Control */ - #define I_S_FM_LEFT_IRQ 0x01 /* R W FM Left FM Interrupt Pending */ - #define I_S_FM_RIGHT_IRQ 0x02 /* R W FM Right FM Interrupt Pending */ - #define I_S_PCM_SAMPLE_RATE_IRQ 0x04 /* R W PCM Sample Rate Interrupt Pending */ - #define I_S_PCM_SAMPLE_BUFFER_IRQ 0x08 /* R W PCM Sample Buffer Interrupt Pending */ - #define I_S_MIDI_IRQ 0x10 /* R W MIDI MIDI Interrupt Pending */ - #define I_S_PCM_CHANNEL 0x20 /* R W PCM 1=right, 0=left */ - #define I_S_RESET_ACTIVE 0x40 /* R W Control Reset is active (Timed pulse not finished) */ - #define I_S_PCM_CLIPPING 0x80 /* R W PCM Clipping has occurred */ - -#define FILTER_FREQUENCY 0x0B8A /* R W Control */ - #define F_F_FILTER_DISABLED 0x00 /* R W Mixer No filter */ -#if 0 - struct { /* R W Mixer Filter translation */ - unsigned int freq:24; - unsigned int value:8; - } F_F_FILTER_translate[] = - { { 73500, 0x01 }, /* 73500Hz - divide by 16 */ - { 65333, 0x02 }, /* 65333Hz - divide by 18 */ - { 49000, 0x09 }, /* 49000Hz - divide by 24 */ - { 36750, 0x11 }, /* 36750Hz - divide by 32 */ - { 24500, 0x19 }, /* 24500Hz - divide by 48 */ - { 18375, 0x07 }, /* 18375Hz - divide by 64 */ - { 12783, 0x0f }, /* 12783Hz - divide by 92 */ - { 12250, 0x04 }, /* 12250Hz - divide by 96 */ - { 9188, 0x17 }, /* 9188Hz - divide by 128 */ - { 6125, 0x1f }, /* 6125Hz - divide by 192 */ - }; -#endif - #define F_F_MIXER_UNMUTE 0x20 /* R W Mixer 1=disable, 0=enable board mute */ - #define F_F_PCM_RATE_COUNTER 0x40 /* R W PCM 1=enable, 0=disable sample rate counter */ - #define F_F_PCM_BUFFER_COUNTER 0x80 /* R W PCM 1=enable, 0=disable sample buffer counter */ - -#define PAS_NONE 0 -#define PAS_PLUS 1 -#define PAS_CDPC 2 -#define PAS_16 3 -#define PAS_16D 4 - -#ifdef DEFINE_TRANSLATIONS -static unsigned char I_C_2_PCM_DMA_translate[] = /* R W PCM PCM DMA channel value translations */ - { 4, 1, 2, 3, 0, 5, 6, 7 }; -static unsigned char I_C_3_PCM_IRQ_translate[] = /* R W PCM PCM IRQ level value translation */ - { 0, 0, 1, 2, 3, 4, 5, 6, 0, 1, 7, 8, 9, 0, 10, 11 }; -#ifdef unused -static unsigned char E_C_MPU401_IRQ_translate[] = /* R W MIDI MPU401 emulation IRQ value translation */ - { 0x00, 0x00, 0x01, 0x02, 0x00, 0x03, 0x00, 0x04, 0x00, 0x01, 0x05, 0x06, 0x07 }; -#endif -static unsigned char E_C_SB_IRQ_translate[] = /* R W PCM SB emulation IRQ translate */ - { 0x00, 0x00, 0x08, 0x10, 0x00, 0x18, 0x00, 0x20, 0x00, 0x08, 0x28, 0x30, 0x38, 0, 0 }; -static unsigned char E_C_SB_DMA_translate[] = /* R W PCM SB emulation DMA translate */ - { 0x00, 0x40, 0x80, 0xC0, 0, 0, 0, 0 }; -#ifdef unused -static unsigned char O_M_1_to_card[] = /* R W Control Translate (OM1 & 0x0f) to card type */ - { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 4, 0, 2, 3 }; -#endif -#endif - -#define PARALLEL_MIXER 0x078B /* W Mixer Documented for MVD101 as FM Mono Right decode?? */ - #define P_M_MV508_ADDRESS 0x80 /* W Mixer MVD508 Address/mixer select */ - #define P_M_MV508_DATA 0x00 - #define P_M_MV508_LEFT 0x20 /* W Mixer MVD508 Left channel select */ - #define P_M_MV508_RIGHT 0x40 /* W Mixer MVD508 Right channel select */ - #define P_M_MV508_BOTH 0x00 /* W Mixer MVD508 Both channel select */ - #define P_M_MV508_MIXER 0x10 /* W Mixer MVD508 Select a mixer (rather than a volume) */ - #define P_M_MV508_VOLUME 0x00 - - #define P_M_MV508_INPUTMIX 0x20 /* W Mixer MVD508 Select mixer A */ - #define P_M_MV508_OUTPUTMIX 0x00 /* W Mixer MVD508 Select mixer B */ - - #define P_M_MV508_MASTER_A 0x01 /* W Mixer MVD508 Master volume control A (output) */ - #define P_M_MV508_MASTER_B 0x02 /* W Mixer MVD508 Master volume control B (DSP input) */ - #define P_M_MV508_BASS 0x03 /* W Mixer MVD508 Bass control */ - #define P_M_MV508_TREBLE 0x04 /* W Mixer MVD508 Treble control */ - #define P_M_MV508_MODE 0x05 /* W Mixer MVD508 Master mode control */ - - #define P_M_MV508_LOUDNESS 0x04 /* W Mixer MVD508 Mode control - Loudness filter */ - #define P_M_MV508_ENHANCE_BITS 0x03 - #define P_M_MV508_ENHANCE_NONE 0x00 /* W Mixer MVD508 Mode control - No stereo enhancement */ - #define P_M_MV508_ENHANCE_40 0x01 /* W Mixer MVD508 Mode control - 40% stereo enhancement */ - #define P_M_MV508_ENHANCE_60 0x02 /* W Mixer MVD508 Mode control - 60% stereo enhancement */ - #define P_M_MV508_ENHANCE_80 0x03 /* W Mixer MVD508 Mode control - 80% stereo enhancement */ - - #define P_M_MV508_FM 0x00 /* W Mixer MVD508 Channel 0 - FM */ - #define P_M_MV508_IMIXER 0x01 /* W Mixer MVD508 Channel 1 - Input mixer (rec monitor) */ - #define P_M_MV508_LINE 0x02 /* W Mixer MVD508 Channel 2 - Line in */ - #define P_M_MV508_CDROM 0x03 /* W Mixer MVD508 Channel 3 - CD-ROM */ - #define P_M_MV508_MIC 0x04 /* W Mixer MVD508 Channel 4 - Microphone */ - #define P_M_MV508_PCM 0x05 /* W Mixer MVD508 Channel 5 - PCM */ - #define P_M_MV508_SPEAKER 0x06 /* W Mixer MVD508 Channel 6 - PC Speaker */ - #define P_M_MV508_SB 0x07 /* W Mixer MVD508 Channel 7 - SB DSP */ - -#define SERIAL_MIXER 0xB88 /* R W Control Serial mixer control (used other ways) */ - #define S_M_PCM_RESET 0x01 /* R W PCM Codec/DSP reset */ - #define S_M_FM_RESET 0x02 /* R W FM FM chip reset */ - #define S_M_SB_RESET 0x04 /* R W PCM SB emulation chip reset */ - #define S_M_MIXER_RESET 0x10 /* R W Mixer Mixer chip reset */ - #define S_M_INTEGRATOR_ENABLE 0x40 /* R W Speaker Enable PC speaker integrator (FORCE RealSound) */ - #define S_M_OPL3_DUAL_MONO 0x80 /* R W FM Set the OPL-3 to dual mono mode */ - -#define PCM_CONTROL 0xF8A /* R W PCM PCM Control Register */ - #define P_C_MIXER_CROSS_FIELD 0x0f - #define P_C_MIXER_CROSS_R_TO_R 0x01 /* R W Mixer Connect Right to Right */ - #define P_C_MIXER_CROSS_L_TO_R 0x02 /* R W Mixer Connect Left to Right */ - #define P_C_MIXER_CROSS_R_TO_L 0x04 /* R W Mixer Connect Right to Left */ - #define P_C_MIXER_CROSS_L_TO_L 0x08 /* R W Mixer Connect Left to Left */ - #define P_C_PCM_DAC_MODE 0x10 /* R W PCM Playback (DAC) mode */ - #define P_C_PCM_ADC_MODE 0x00 /* R W PCM Record (ADC) mode */ - #define P_C_PCM_MONO 0x20 /* R W PCM Mono mode */ - #define P_C_PCM_STEREO 0x00 /* R W PCM Stereo mode */ - #define P_C_PCM_ENABLE 0x40 /* R W PCM Enable PCM engine */ - #define P_C_PCM_DMA_ENABLE 0x80 /* R W PCM Enable DRQ */ - -#define SAMPLE_COUNTER_CONTROL 0x138B /* R W PCM Sample counter control register */ - #define S_C_C_SQUARE_WAVE 0x04 /* R W PCM Square wave generator (use for sample rate) */ - #define S_C_C_RATE 0x06 /* R W PCM Rate generator (use for sample buffer count) */ - #define S_C_C_LSB_THEN_MSB 0x30 /* R W PCM Change all 16 bits, LSB first, then MSB */ - - /* MVD101 and SDK documentations have S_C_C_SAMPLE_RATE and S_C_C_SAMPLE_BUFFER transposed. Only one works :-) */ - #define S_C_C_SAMPLE_RATE 0x00 /* R W PCM Select sample rate timer */ - #define S_C_C_SAMPLE_BUFFER 0x40 /* R W PCM Select sample buffer counter */ - - #define S_C_C_PC_SPEAKER 0x80 /* R W PCM Select PC speaker counter */ - -#define SAMPLE_RATE_TIMER 0x1388 /* W PCM Sample rate timer register (PCM wait interval) */ -#define SAMPLE_BUFFER_COUNTER 0x1389 /* R W PCM Sample buffer counter (DMA buffer size) */ - -#define MIDI_CONTROL 0x178b /* R W MIDI Midi control register */ - #define M_C_ENA_TSTAMP_IRQ 0x01 /* R W MIDI Enable Time Stamp Interrupts */ - #define M_C_ENA_TME_COMP_IRQ 0x02 /* R W MIDI Enable time compare interrupts */ - #define M_C_ENA_INPUT_IRQ 0x04 /* R W MIDI Enable input FIFO interrupts */ - #define M_C_ENA_OUTPUT_IRQ 0x08 /* R W MIDI Enable output FIFO interrupts */ - #define M_C_ENA_OUTPUT_HALF_IRQ 0x10 /* R W MIDI Enable output FIFO half full interrupts */ - #define M_C_RESET_INPUT_FIFO 0x20 /* R W MIDI Reset input FIFO pointer */ - #define M_C_RESET_OUTPUT_FIFO 0x40 /* R W MIDI Reset output FIFO pointer */ - #define M_C_ENA_THRU_MODE 0x80 /* R W MIDI Echo input to output (THRU) */ - -#define MIDI_STATUS 0x1B88 /* R W MIDI Midi (interrupt) status register */ - #define M_S_TIMESTAMP 0x01 /* R W MIDI Midi time stamp interrupt occurred */ - #define M_S_COMPARE 0x02 /* R W MIDI Midi compare time interrupt occurred */ - #define M_S_INPUT_AVAIL 0x04 /* R W MIDI Midi input data available interrupt occurred */ - #define M_S_OUTPUT_EMPTY 0x08 /* R W MIDI Midi output FIFO empty interrupt occurred */ - #define M_S_OUTPUT_HALF_EMPTY 0x10 /* R W MIDI Midi output FIFO half empty interrupt occurred */ - #define M_S_INPUT_OVERRUN 0x20 /* R W MIDI Midi input overrun error occurred */ - #define M_S_OUTPUT_OVERRUN 0x40 /* R W MIDI Midi output overrun error occurred */ - #define M_S_FRAMING_ERROR 0x80 /* R W MIDI Midi input framing error occurred */ - -#define MIDI_FIFO_STATUS 0x1B89 /* R W MIDI Midi fifo status */ -#define MIDI_DATA 0x178A /* R W MIDI Midi data register */ -#define MIDI_INPUT_AVAILABLE 0x0f /* RW MIDI */ diff --git a/sys/pc98/pc98/sound/patmgr.c b/sys/pc98/pc98/sound/patmgr.c index f0139846b385..90534159b83b 100644 --- a/sys/pc98/pc98/sound/patmgr.c +++ b/sys/pc98/pc98/sound/patmgr.c @@ -28,7 +28,11 @@ */ #define PATMGR_C +#ifdef PC98 +#include +#else #include +#endif #if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_SEQUENCER) diff --git a/sys/pc98/pc98/sound/sb16_dsp.c b/sys/pc98/pc98/sound/sb16_dsp.c index 5e84e67e2886..a195dbad5533 100644 --- a/sys/pc98/pc98/sound/sb16_dsp.c +++ b/sys/pc98/pc98/sound/sb16_dsp.c @@ -34,7 +34,11 @@ /* * #define DEB_DMARES */ +#ifdef PC98 +#include +#else #include +#endif #include #include diff --git a/sys/pc98/pc98/sound/sb16_midi.c b/sys/pc98/pc98/sound/sb16_midi.c index 7dae75011248..6cd70f6f9763 100644 --- a/sys/pc98/pc98/sound/sb16_midi.c +++ b/sys/pc98/pc98/sound/sb16_midi.c @@ -27,7 +27,11 @@ * */ +#ifdef PC98 +#include +#else #include +#endif #ifdef CONFIGURE_SOUNDCARD diff --git a/sys/pc98/pc98/sound/sb_card.c b/sys/pc98/pc98/sound/sb_card.c index 37455d10d665..6656df74061d 100644 --- a/sys/pc98/pc98/sound/sb_card.c +++ b/sys/pc98/pc98/sound/sb_card.c @@ -30,7 +30,11 @@ * - Added the Audio Excel DSP 16 initialization routine. */ +#ifdef PC98 +#include +#else #include +#endif #if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_SB) diff --git a/sys/pc98/pc98/sound/sb_dsp.c b/sys/pc98/pc98/sound/sb_dsp.c index 82a2178317a4..f8922c9be428 100644 --- a/sys/pc98/pc98/sound/sb_dsp.c +++ b/sys/pc98/pc98/sound/sb_dsp.c @@ -33,7 +33,11 @@ * Code added for MV ProSonic/Jazz 16 in 16 bit mode */ +#ifdef PC98 +#include +#else #include +#endif #if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_SB) diff --git a/sys/pc98/pc98/sound/sb_midi.c b/sys/pc98/pc98/sound/sb_midi.c index de661ac35903..0c63af5b8067 100644 --- a/sys/pc98/pc98/sound/sb_midi.c +++ b/sys/pc98/pc98/sound/sb_midi.c @@ -27,7 +27,11 @@ * */ +#ifdef PC98 +#include +#else #include +#endif #if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_SB) && !defined(EXCLUDE_MIDI) diff --git a/sys/pc98/pc98/sound/sb_mixer.c b/sys/pc98/pc98/sound/sb_mixer.c index 4fd2db20a2fc..b044412863cd 100644 --- a/sys/pc98/pc98/sound/sb_mixer.c +++ b/sys/pc98/pc98/sound/sb_mixer.c @@ -32,7 +32,11 @@ * */ +#ifdef PC98 +#include +#else #include +#endif #if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_SB) && !defined(EXCLUDE_SBPRO) #define __SB_MIXER_C__ diff --git a/sys/pc98/pc98/sound/sb_mixer.h b/sys/pc98/pc98/sound/sb_mixer.h deleted file mode 100644 index b712eea40277..000000000000 --- a/sys/pc98/pc98/sound/sb_mixer.h +++ /dev/null @@ -1,256 +0,0 @@ -/* - * sound/sb_mixer.h - * - * Definitions for the SB Pro and SB16 mixers - * - * Copyright by Hannu Savolainen 1993 - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. 2. - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Modified: - * Hunyue Yau Jan 6 1994 - * Added defines for the Sound Galaxy NX Pro mixer. - * - */ - -#define SBPRO_RECORDING_DEVICES (SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD) - -/* Same as SB Pro, unless I find otherwise */ -#define SGNXPRO_RECORDING_DEVICES SBPRO_RECORDING_DEVICES - -#define SBPRO_MIXER_DEVICES (SOUND_MASK_SYNTH | SOUND_MASK_PCM | SOUND_MASK_LINE | SOUND_MASK_MIC | \ - SOUND_MASK_CD | SOUND_MASK_VOLUME) - -/* SG NX Pro has treble and bass settings on the mixer. The 'speaker' - * channel is the COVOX/DisneySoundSource emulation volume control - * on the mixer. It does NOT control speaker volume. Should have own - * mask eventually? - */ -#define SGNXPRO_MIXER_DEVICES (SBPRO_MIXER_DEVICES|SOUND_MASK_BASS| \ - SOUND_MASK_TREBLE|SOUND_MASK_SPEAKER ) - -#define SB16_RECORDING_DEVICES (SOUND_MASK_SYNTH | SOUND_MASK_LINE | SOUND_MASK_MIC | \ - SOUND_MASK_CD) - -#define SB16_MIXER_DEVICES (SOUND_MASK_SYNTH | SOUND_MASK_PCM | SOUND_MASK_SPEAKER | SOUND_MASK_LINE | SOUND_MASK_MIC | \ - SOUND_MASK_CD | \ - SOUND_MASK_IGAIN | SOUND_MASK_OGAIN | \ - SOUND_MASK_VOLUME | SOUND_MASK_BASS | SOUND_MASK_TREBLE) - -/* - * Mixer registers - * - * NOTE! RECORD_SRC == IN_FILTER - */ - -/* - * Mixer registers of SB Pro - */ -#define VOC_VOL 0x04 -#define MIC_VOL 0x0A -#define MIC_MIX 0x0A -#define RECORD_SRC 0x0C -#define IN_FILTER 0x0C -#define OUT_FILTER 0x0E -#define MASTER_VOL 0x22 -#define FM_VOL 0x26 -#define CD_VOL 0x28 -#define LINE_VOL 0x2E -#define IRQ_NR 0x80 -#define DMA_NR 0x81 -#define IRQ_STAT 0x82 -#define OPSW 0x3c - -/* - * Additional registers on the SG NX Pro - */ -#define COVOX_VOL 0x42 -#define TREBLE_LVL 0x44 -#define BASS_LVL 0x46 - -#define FREQ_HI (1 << 3)/* Use High-frequency ANFI filters */ -#define FREQ_LOW 0 /* Use Low-frequency ANFI filters */ -#define FILT_ON 0 /* Yes, 0 to turn it on, 1 for off */ -#define FILT_OFF (1 << 5) - -#define MONO_DAC 0x00 -#define STEREO_DAC 0x02 - -/* - * Mixer registers of SB16 - */ -#define SB16_IMASK_L 0x3d -#define SB16_IMASK_R 0x3e - -#define LEFT_CHN 0 -#define RIGHT_CHN 1 - -struct mixer_def { - unsigned int regno: 8; - unsigned int bitoffs:4; - unsigned int nbits:4; -}; - - -typedef struct mixer_def mixer_tab[32][2]; -typedef struct mixer_def mixer_ent; - -#define MIX_ENT(name, reg_l, bit_l, len_l, reg_r, bit_r, len_r) \ - {{reg_l, bit_l, len_l}, {reg_r, bit_r, len_r}} - -#ifdef __SB_MIXER_C__ -static mixer_tab sbpro_mix = { -MIX_ENT(SOUND_MIXER_VOLUME, 0x22, 7, 4, 0x22, 3, 4), -MIX_ENT(SOUND_MIXER_BASS, 0x00, 0, 0, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_TREBLE, 0x00, 0, 0, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_SYNTH, 0x26, 7, 4, 0x26, 3, 4), -MIX_ENT(SOUND_MIXER_PCM, 0x04, 7, 4, 0x04, 3, 4), -MIX_ENT(SOUND_MIXER_SPEAKER, 0x00, 0, 0, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_LINE, 0x2e, 7, 4, 0x2e, 3, 4), -MIX_ENT(SOUND_MIXER_MIC, 0x0a, 2, 3, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_CD, 0x28, 7, 4, 0x28, 3, 4), -MIX_ENT(SOUND_MIXER_IMIX, 0x00, 0, 0, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_ALTPCM, 0x00, 0, 0, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_RECLEV, 0x00, 0, 0, 0x00, 0, 0) -}; - -#ifdef __SGNXPRO__ -static mixer_tab sgnxpro_mix = { -MIX_ENT(SOUND_MIXER_VOLUME, 0x22, 7, 4, 0x22, 3, 4), -MIX_ENT(SOUND_MIXER_BASS, 0x46, 2, 3, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_TREBLE, 0x44, 2, 3, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_SYNTH, 0x26, 7, 4, 0x26, 3, 4), -MIX_ENT(SOUND_MIXER_PCM, 0x04, 7, 4, 0x04, 3, 4), -MIX_ENT(SOUND_MIXER_SPEAKER, 0x42, 2, 3, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_LINE, 0x2e, 7, 4, 0x2e, 3, 4), -MIX_ENT(SOUND_MIXER_MIC, 0x0a, 2, 3, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_CD, 0x28, 7, 4, 0x28, 3, 4), -MIX_ENT(SOUND_MIXER_IMIX, 0x00, 0, 0, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_ALTPCM, 0x00, 0, 0, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_RECLEV, 0x00, 0, 0, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_IGAIN, 0x00, 0, 0, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_OGAIN, 0x00, 0, 0, 0x00, 0, 0) -}; -#endif - -static mixer_tab sb16_mix = { -MIX_ENT(SOUND_MIXER_VOLUME, 0x30, 7, 5, 0x31, 7, 5), -MIX_ENT(SOUND_MIXER_BASS, 0x46, 7, 4, 0x47, 7, 4), -MIX_ENT(SOUND_MIXER_TREBLE, 0x44, 7, 4, 0x45, 7, 4), -MIX_ENT(SOUND_MIXER_SYNTH, 0x34, 7, 5, 0x35, 7, 5), -MIX_ENT(SOUND_MIXER_PCM, 0x32, 7, 5, 0x33, 7, 5), -MIX_ENT(SOUND_MIXER_SPEAKER, 0x3b, 7, 2, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_LINE, 0x38, 7, 5, 0x39, 7, 5), -MIX_ENT(SOUND_MIXER_MIC, 0x3a, 7, 5, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_CD, 0x36, 7, 5, 0x37, 7, 5), -MIX_ENT(SOUND_MIXER_IMIX, 0x00, 0, 0, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_ALTPCM, 0x00, 0, 0, 0x00, 0, 0), -MIX_ENT(SOUND_MIXER_RECLEV, 0x3f, 7, 2, 0x40, 7, 2), /* Obsolete. Use IGAIN */ -MIX_ENT(SOUND_MIXER_IGAIN, 0x3f, 7, 2, 0x40, 7, 2), -MIX_ENT(SOUND_MIXER_OGAIN, 0x41, 7, 2, 0x42, 7, 2) -}; - -#ifdef SM_GAMES /* Master volume is lower and PCM & FM volumes - higher than with SB Pro. This improves the - sound quality */ - -static unsigned short levels[SOUND_MIXER_NRDEVICES] = -{ - 0x2020, /* Master Volume */ - 0x4b4b, /* Bass */ - 0x4b4b, /* Treble */ - 0x6464, /* FM */ - 0x6464, /* PCM */ - 0x4b4b, /* PC Speaker */ - 0x4b4b, /* Ext Line */ - 0x0000, /* Mic */ - 0x4b4b, /* CD */ - 0x4b4b, /* Recording monitor */ - 0x4b4b, /* SB PCM */ - 0x4b4b, /* Recording level */ - 0x4b4b, /* Input gain */ - 0x4b4b}; /* Output gain */ - -#else /* If the user selected just plain SB Pro */ - -static unsigned short levels[SOUND_MIXER_NRDEVICES] = -{ - 0x5a5a, /* Master Volume */ - 0x4b4b, /* Bass */ - 0x4b4b, /* Treble */ - 0x4b4b, /* FM */ - 0x4b4b, /* PCM */ - 0x4b4b, /* PC Speaker */ - 0x4b4b, /* Ext Line */ - 0x1010, /* Mic */ - 0x4b4b, /* CD */ - 0x4b4b, /* Recording monitor */ - 0x4b4b, /* SB PCM */ - 0x4b4b, /* Recording level */ - 0x4b4b, /* Input gain */ - 0x4b4b}; /* Output gain */ -#endif /* SM_GAMES */ - -static unsigned char sb16_recmasks_L[SOUND_MIXER_NRDEVICES] = -{ - 0x00, /* SOUND_MIXER_VOLUME */ - 0x00, /* SOUND_MIXER_BASS */ - 0x00, /* SOUND_MIXER_TREBLE */ - 0x40, /* SOUND_MIXER_SYNTH */ - 0x00, /* SOUND_MIXER_PCM */ - 0x00, /* SOUND_MIXER_SPEAKER */ - 0x10, /* SOUND_MIXER_LINE */ - 0x01, /* SOUND_MIXER_MIC */ - 0x04, /* SOUND_MIXER_CD */ - 0x00, /* SOUND_MIXER_IMIX */ - 0x00, /* SOUND_MIXER_ALTPCM */ - 0x00, /* SOUND_MIXER_RECLEV */ - 0x00, /* SOUND_MIXER_IGAIN */ - 0x00 /* SOUND_MIXER_OGAIN */ -}; - -static unsigned char sb16_recmasks_R[SOUND_MIXER_NRDEVICES] = -{ - 0x00, /* SOUND_MIXER_VOLUME */ - 0x00, /* SOUND_MIXER_BASS */ - 0x00, /* SOUND_MIXER_TREBLE */ - 0x20, /* SOUND_MIXER_SYNTH */ - 0x00, /* SOUND_MIXER_PCM */ - 0x00, /* SOUND_MIXER_SPEAKER */ - 0x08, /* SOUND_MIXER_LINE */ - 0x01, /* SOUND_MIXER_MIC */ - 0x02, /* SOUND_MIXER_CD */ - 0x00, /* SOUND_MIXER_IMIX */ - 0x00, /* SOUND_MIXER_ALTPCM */ - 0x00, /* SOUND_MIXER_RECLEV */ - 0x00, /* SOUND_MIXER_IGAIN */ - 0x00 /* SOUND_MIXER_OGAIN */ -}; - -/* - * Recording sources (SB Pro) - */ - -#define SRC_MIC 1 /* Select Microphone recording source */ -#define SRC_CD 3 /* Select CD recording source */ -#define SRC_LINE 7 /* Use Line-in for recording source */ - -#endif diff --git a/sys/pc98/pc98/sound/sequencer.c b/sys/pc98/pc98/sound/sequencer.c index b49baed2e919..30da4c644bb6 100644 --- a/sys/pc98/pc98/sound/sequencer.c +++ b/sys/pc98/pc98/sound/sequencer.c @@ -28,7 +28,11 @@ */ #define SEQUENCER_C +#ifdef PC98 +#include +#else #include +#endif #include extern void seq_drain_midi_queues __P((void)); diff --git a/sys/pc98/pc98/sound/sound_config.h b/sys/pc98/pc98/sound/sound_config.h index 2330fa94b1a1..a714c3387018 100644 --- a/sys/pc98/pc98/sound/sound_config.h +++ b/sys/pc98/pc98/sound/sound_config.h @@ -28,7 +28,11 @@ * */ +#ifdef PC98 +#include +#else #include +#endif #include #include @@ -358,8 +362,13 @@ struct channel_info { #define OPEN_WRITE 2 #define OPEN_READWRITE 3 +#ifdef PC98 +#include +#include +#else #include #include +#endif #ifndef DEB #define DEB(x) diff --git a/sys/pc98/pc98/sound/sound_switch.c b/sys/pc98/pc98/sound/sound_switch.c index 83994e0daa5c..551c1c150b1d 100644 --- a/sys/pc98/pc98/sound/sound_switch.c +++ b/sys/pc98/pc98/sound/sound_switch.c @@ -27,7 +27,11 @@ * */ +#ifdef PC98 +#include +#else #include +#endif #ifdef CONFIGURE_SOUNDCARD diff --git a/sys/pc98/pc98/sound/soundcard.c b/sys/pc98/pc98/sound/soundcard.c index 3a06b6cd4efc..6a85fb9d3e58 100644 --- a/sys/pc98/pc98/sound/soundcard.c +++ b/sys/pc98/pc98/sound/soundcard.c @@ -26,16 +26,24 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: soundcard.c,v 1.43 1996/09/10 08:26:06 bde Exp $ + * $Id: soundcard.c,v 1.5 1996/09/12 11:11:59 asami Exp $ */ +#ifdef PC98 +#include +#else #include +#endif #include #include #ifdef CONFIGURE_SOUNDCARD +#ifdef PC98 +#include +#else #include +#endif #include #include #include diff --git a/sys/pc98/pc98/sound/soundvers.h b/sys/pc98/pc98/sound/soundvers.h deleted file mode 100644 index ca892e8259da..000000000000 --- a/sys/pc98/pc98/sound/soundvers.h +++ /dev/null @@ -1 +0,0 @@ -#define SOUND_VERSION_STRING "3.0-beta-950506" diff --git a/sys/pc98/pc98/sound/sys_timer.c b/sys/pc98/pc98/sound/sys_timer.c index 2c752f7bb89b..8abeacb9cba8 100644 --- a/sys/pc98/pc98/sound/sys_timer.c +++ b/sys/pc98/pc98/sound/sys_timer.c @@ -29,7 +29,11 @@ */ #define SEQUENCER_C +#ifdef PC98 +#include +#else #include +#endif #ifdef CONFIGURE_SOUNDCARD diff --git a/sys/pc98/pc98/sound/tuning.h b/sys/pc98/pc98/sound/tuning.h deleted file mode 100644 index 98048cc89c92..000000000000 --- a/sys/pc98/pc98/sound/tuning.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifdef SEQUENCER_C - -static unsigned short semitone_tuning[24] = -{ -/* 0 */ 10000, 10595, 11225, 11892, 12599, 13348, 14142, 14983, -/* 8 */ 15874, 16818, 17818, 18877, 20000, 21189, 22449, 23784, -/* 16 */ 25198, 26697, 28284, 29966, 31748, 33636, 35636, 37755 -}; - -static unsigned short cent_tuning[100] = -{ -/* 0 */ 10000, 10006, 10012, 10017, 10023, 10029, 10035, 10041, -/* 8 */ 10046, 10052, 10058, 10064, 10070, 10075, 10081, 10087, -/* 16 */ 10093, 10099, 10105, 10110, 10116, 10122, 10128, 10134, -/* 24 */ 10140, 10145, 10151, 10157, 10163, 10169, 10175, 10181, -/* 32 */ 10187, 10192, 10198, 10204, 10210, 10216, 10222, 10228, -/* 40 */ 10234, 10240, 10246, 10251, 10257, 10263, 10269, 10275, -/* 48 */ 10281, 10287, 10293, 10299, 10305, 10311, 10317, 10323, -/* 56 */ 10329, 10335, 10341, 10347, 10353, 10359, 10365, 10371, -/* 64 */ 10377, 10383, 10389, 10395, 10401, 10407, 10413, 10419, -/* 72 */ 10425, 10431, 10437, 10443, 10449, 10455, 10461, 10467, -/* 80 */ 10473, 10479, 10485, 10491, 10497, 10503, 10509, 10515, -/* 88 */ 10521, 10528, 10534, 10540, 10546, 10552, 10558, 10564, -/* 96 */ 10570, 10576, 10582, 10589 -}; -#endif diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c index 576ec7a2428e..12514f375cef 100644 --- a/sys/pc98/pc98/syscons.c +++ b/sys/pc98/pc98/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.10 1996/10/09 21:46:49 asami Exp $ + * $Id: syscons.c,v 1.11 1996/10/23 07:25:30 asami Exp $ */ #include "sc.h" @@ -424,9 +424,7 @@ scprobe(struct isa_device *dev) gotres: if (retries < 0) { printf("scprobe: keyboard won't accept RESET command\n"); -#ifdef SC_KBD_PROBE_WORKS - return (0); -#endif + goto fail; } else { i = 10; /* At most 10 retries. */ gotack: @@ -439,9 +437,7 @@ scprobe(struct isa_device *dev) goto gotack; if (val != KB_RESET_DONE) { printf("scprobe: keyboard RESET failed (result = 0x%02x)\n", val); -#ifdef SC_KBD_PROBE_WORKS - return (0); -#endif + goto fail; } } #ifdef XT_KEYBOARD @@ -451,7 +447,12 @@ scprobe(struct isa_device *dev) outb(KB_DATA, 1); kbd_wait(); #endif /* XT_KEYBOARD */ + + succeed: return (IO_KBDSIZE); + + fail: + return ((dev->id_flags & DETECT_KBD) ? 0 : IO_KBDSIZE); #endif } diff --git a/sys/pc98/pc98/syscons.h b/sys/pc98/pc98/syscons.h index 38e4fb9cf1c9..39bd5682ce70 100644 --- a/sys/pc98/pc98/syscons.h +++ b/sys/pc98/pc98/syscons.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.h,v 1.4 1996/10/09 21:46:51 asami Exp $ + * $Id: syscons.h,v 1.5 1996/10/23 07:25:33 asami Exp $ */ #ifndef _PC98_PC98_SYSCONS_H_ @@ -69,6 +69,7 @@ #define VISUAL_BELL 0x00001 #define BLINK_CURSOR 0x00002 #define CHAR_CURSOR 0x00004 +#define DETECT_KBD 0x00008 /* attribute flags */ #define NORMAL_ATTR 0x00