From efacb21bbc4c5e4ae5ef661233ee6249ee8a0e7f Mon Sep 17 00:00:00 2001 From: tanimura Date: Mon, 27 Dec 1999 04:37:19 +0000 Subject: Add support of SB for PC98 into VoxWare 3.5, and more $FreeBSD$. Submitted by: T.Yamaoka Pressed to review by: nyan --- sys/i386/isa/sound/opl3.c | 7 ++++++- sys/i386/isa/sound/sb16_dsp.c | 20 ++++++++++++++++++++ sys/i386/isa/sound/sb16_midi.c | 12 ++++++++++++ sys/i386/isa/sound/sb_dsp.c | 23 +++++++++++++++++++++++ sys/i386/isa/sound/sbcard.h | 18 ++++++++++++++++++ sys/i386/isa/sound/sound_config.h | 6 ++++++ 6 files changed, 85 insertions(+), 1 deletion(-) diff --git a/sys/i386/isa/sound/opl3.c b/sys/i386/isa/sound/opl3.c index 1baeadd..1302437 100644 --- a/sys/i386/isa/sound/opl3.c +++ b/sys/i386/isa/sound/opl3.c @@ -25,6 +25,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $FreeBSD$ + * */ /* @@ -697,8 +699,11 @@ opl3_command(int io_addr, u_int addr, u_int val) for (i = 0; i < 2; i++) inb(io_addr); +#ifdef PC98 + outb(io_addr + 0x100, (u_char) (val & 0xff)); +#else outb(io_addr + 1, (u_char) (val & 0xff)); - +#endif if (devc->model != 2) DELAY(30); else diff --git a/sys/i386/isa/sound/sb16_dsp.c b/sys/i386/isa/sound/sb16_dsp.c index 72c8012..c78ce24 100644 --- a/sys/i386/isa/sound/sb16_dsp.c +++ b/sys/i386/isa/sound/sb16_dsp.c @@ -429,6 +429,17 @@ set_irq_hw(int level) int ival; switch (level) { +#ifdef PC98 + case 5: + ival = 8; + break; + case 3: + ival = 1; + break; + case 10: + ival = 2; + break; +#else case 5: ival = 2; break; @@ -441,6 +452,7 @@ set_irq_hw(int level) case 10: ival = 8; break; +#endif default: printf("SB16_IRQ_LEVEL %d does not exist\n", level); return; @@ -492,12 +504,16 @@ sb16_dsp_detect(struct address_info * hw_config) if (sbc_major < 4) /* Set by the plain SB driver */ return 0; /* Not a SB16 */ +#ifdef PC98 + hw_config->dma = sb_config->dma; +#else if (hw_config->dma < 4) if (hw_config->dma != sb_config->dma) { printf("SB16 Error: Invalid DMA channel %d/%d\n", sb_config->dma, hw_config->dma); return 0; } +#endif dma16 = hw_config->dma; dma8 = sb_config->dma; /* hw_config->irq = 0; sb_config->irq; @@ -505,7 +521,11 @@ sb16_dsp_detect(struct address_info * hw_config) */ set_irq_hw(sb_config->irq); +#ifdef PC98 + sb_setmixer (DMA_NR, hw_config->dma == 0 ? 1 : 2); +#else sb_setmixer(DMA_NR, (1 << hw_config->dma) | (1 << sb_config->dma)); +#endif DEB(printf("SoundBlaster 16: IRQ %d DMA %d OK\n", sb_config->irq, hw_config->dma)); diff --git a/sys/i386/isa/sound/sb16_midi.c b/sys/i386/isa/sound/sb16_midi.c index e7b5084..86b338f 100644 --- a/sys/i386/isa/sound/sb16_midi.c +++ b/sys/i386/isa/sound/sb16_midi.c @@ -25,6 +25,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $FreeBSD$ + * */ #include @@ -34,9 +36,15 @@ #include "sb.h" +#ifdef PC98 +#define DATAPORT (sb16midi_base) +#define COMDPORT (sb16midi_base+0x100) +#define STATPORT (sb16midi_base+0x100) +#else #define DATAPORT (sb16midi_base) #define COMDPORT (sb16midi_base+1) #define STATPORT (sb16midi_base+1) +#endif extern sound_os_info *sb_osp; @@ -54,7 +62,11 @@ extern sound_os_info *sb_osp; #define UART_MODE_ON 0x3F static int sb16midi_opened = 0; +#ifdef PC98 +static int sb16midi_base = 0x80d2; +#else static int sb16midi_base = 0x330; +#endif static int sb16midi_detected = 0; static int my_dev; extern int sbc_base; diff --git a/sys/i386/isa/sound/sb_dsp.c b/sys/i386/isa/sound/sb_dsp.c index 8017bb9..7033ba9 100644 --- a/sys/i386/isa/sound/sb_dsp.c +++ b/sys/i386/isa/sound/sb_dsp.c @@ -29,6 +29,8 @@ * Pro * * JRA Gibson April 1995 Code added for MV ProSonic/Jazz 16 in 16 bit mode + * + * $FreeBSD$ */ #include @@ -952,6 +954,27 @@ sb_dsp_detect(struct address_info * hw_config) if (!sb_reset_dsp()) return 0; #endif +#ifdef PC98 + switch (sbc_irq) { + case 3: + sb_setmixer (IRQ_NR, 1); + break; + case 5: + sb_setmixer (IRQ_NR, 8); + break; + case 10: + sb_setmixer (IRQ_NR, 2); + break; + } + switch (hw_config->dma) { + case 0: + sb_setmixer (DMA_NR, 1); + break; + case 3: + sb_setmixer (DMA_NR, 2); + break; + } +#endif return 1; /* Detected */ } diff --git a/sys/i386/isa/sound/sbcard.h b/sys/i386/isa/sound/sbcard.h index 464128c..20e33a1 100644 --- a/sys/i386/isa/sound/sbcard.h +++ b/sys/i386/isa/sound/sbcard.h @@ -1,5 +1,8 @@ /* * file: sbcard.h + * + * $FreeBSD$ + * */ extern int sbc_major, sbc_minor ; @@ -7,6 +10,20 @@ extern int sbc_major, sbc_minor ; * sound blaster registers */ +#ifdef PC98 +#define DSP_RESET (sbc_base + 0x600) +#define DSP_READ (sbc_base + 0xA00) +#define DSP_WRITE (sbc_base + 0xC00) +#define DSP_COMMAND (sbc_base + 0xC00) +#define DSP_STATUS (sbc_base + 0xC00) +#define DSP_DATA_AVAIL (sbc_base + 0xE00) +#define DSP_DATA_AVL16 (sbc_base + 0xF00) +#define MIXER_ADDR (sbc_base + 0x400) +#define MIXER_DATA (sbc_base + 0x500) +#define OPL3_LEFT (sbc_base + 0x000) +#define OPL3_RIGHT (sbc_base + 0x200) +#define OPL3_BOTH (sbc_base + 0x800) +#else #define DSP_RESET (sbc_base + 0x6) #define DSP_READ (sbc_base + 0xA) #define DSP_WRITE (sbc_base + 0xC) @@ -19,6 +36,7 @@ extern int sbc_major, sbc_minor ; #define OPL3_LEFT (sbc_base + 0x0) #define OPL3_RIGHT (sbc_base + 0x2) #define OPL3_BOTH (sbc_base + 0x8) +#endif /* * DSP Commands. There are many, and in many cases they are used explicitly diff --git a/sys/i386/isa/sound/sound_config.h b/sys/i386/isa/sound/sound_config.h index a802763..91f4391 100644 --- a/sys/i386/isa/sound/sound_config.h +++ b/sys/i386/isa/sound/sound_config.h @@ -25,6 +25,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $FreeBSD$ + * */ /* @@ -83,7 +85,11 @@ #define DMA_AUTOINIT 0x10 /* XXX never used */ +#ifdef PC98 +#define FM_MONO 0x28d2 +#else #define FM_MONO 0x388 /* This is the I/O address used by AdLib */ +#endif #ifndef AWE32_BASE #define AWE32_BASE 0x620 /* Default = 0x620-3, 0xA20-3, 0xE20-3 */ -- cgit v1.1