Fixed compile-breaking mistakes in ATI 28800 code; The base address, IRQ, and DMA channel of the Sound Blaster 16 and Sound Blaster AWE32 are now configurable.
This commit is contained in:
152
src/sound_sb.c
152
src/sound_sb.c
@@ -444,11 +444,14 @@ void *sb_pro_v2_init()
|
|||||||
void *sb_16_init()
|
void *sb_16_init()
|
||||||
{
|
{
|
||||||
sb_t *sb = malloc(sizeof(sb_t));
|
sb_t *sb = malloc(sizeof(sb_t));
|
||||||
|
uint16_t addr = device_get_config_int("addr");
|
||||||
memset(sb, 0, sizeof(sb_t));
|
memset(sb, 0, sizeof(sb_t));
|
||||||
|
|
||||||
opl3_init(&sb->opl);
|
opl3_init(&sb->opl);
|
||||||
sb_dsp_init(&sb->dsp, SB16);
|
sb_dsp_init(&sb->dsp, SB16);
|
||||||
sb_dsp_setaddr(&sb->dsp, 0x0220);
|
sb_dsp_setaddr(&sb->dsp, addr);
|
||||||
|
sb_dsp_setirq(&sb->dsp, device_get_config_int("irq"));
|
||||||
|
sb_dsp_setdma8(&sb->dsp, device_get_config_int("dma"));
|
||||||
sb_mixer_init(&sb->mixer);
|
sb_mixer_init(&sb->mixer);
|
||||||
io_sethandler(0x0220, 0x0004, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &sb->opl);
|
io_sethandler(0x0220, 0x0004, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &sb->opl);
|
||||||
io_sethandler(0x0228, 0x0002, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &sb->opl);
|
io_sethandler(0x0228, 0x0002, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &sb->opl);
|
||||||
@@ -482,12 +485,15 @@ int sb_awe32_available()
|
|||||||
void *sb_awe32_init()
|
void *sb_awe32_init()
|
||||||
{
|
{
|
||||||
sb_t *sb = malloc(sizeof(sb_t));
|
sb_t *sb = malloc(sizeof(sb_t));
|
||||||
|
uint16_t addr = device_get_config_int("addr");
|
||||||
int onboard_ram = device_get_config_int("onboard_ram");
|
int onboard_ram = device_get_config_int("onboard_ram");
|
||||||
memset(sb, 0, sizeof(sb_t));
|
memset(sb, 0, sizeof(sb_t));
|
||||||
|
|
||||||
opl3_init(&sb->opl);
|
opl3_init(&sb->opl);
|
||||||
sb_dsp_init(&sb->dsp, SB16 + 1);
|
sb_dsp_init(&sb->dsp, SB16 + 1);
|
||||||
sb_dsp_setaddr(&sb->dsp, 0x0220);
|
sb_dsp_setaddr(&sb->dsp, addr);
|
||||||
|
sb_dsp_setirq(&sb->dsp, device_get_config_int("irq"));
|
||||||
|
sb_dsp_setdma8(&sb->dsp, device_get_config_int("dma"));
|
||||||
sb_mixer_init(&sb->mixer);
|
sb_mixer_init(&sb->mixer);
|
||||||
io_sethandler(0x0220, 0x0004, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &sb->opl);
|
io_sethandler(0x0220, 0x0004, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &sb->opl);
|
||||||
io_sethandler(0x0228, 0x0002, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &sb->opl);
|
io_sethandler(0x0228, 0x0002, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &sb->opl);
|
||||||
@@ -593,7 +599,7 @@ static device_config_t sb_config[] =
|
|||||||
.description = ""
|
.description = ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
.default_int = 7
|
.default_int = 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "dma",
|
.name = "dma",
|
||||||
@@ -669,7 +675,7 @@ static device_config_t sb_pro_config[] =
|
|||||||
.description = ""
|
.description = ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
.default_int = 7
|
.default_int = 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "dma",
|
.name = "dma",
|
||||||
@@ -698,6 +704,75 @@ static device_config_t sb_pro_config[] =
|
|||||||
|
|
||||||
static device_config_t sb_16_config[] =
|
static device_config_t sb_16_config[] =
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
.name = "addr",
|
||||||
|
.description = "Address",
|
||||||
|
.type = CONFIG_BINARY,
|
||||||
|
.type = CONFIG_SELECTION,
|
||||||
|
.selection =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
.description = "0x220",
|
||||||
|
.value = 0x220
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.description = "0x240",
|
||||||
|
.value = 0x240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.description = ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.default_int = 0x220
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "irq",
|
||||||
|
.description = "IRQ",
|
||||||
|
.type = CONFIG_SELECTION,
|
||||||
|
.selection =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
.description = "IRQ 2",
|
||||||
|
.value = 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.description = "IRQ 5",
|
||||||
|
.value = 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.description = "IRQ 7",
|
||||||
|
.value = 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.description = "IRQ 10",
|
||||||
|
.value = 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.description = ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.default_int = 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "dma",
|
||||||
|
.description = "DMA",
|
||||||
|
.type = CONFIG_SELECTION,
|
||||||
|
.selection =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
.description = "DMA 1",
|
||||||
|
.value = 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.description = "DMA 3",
|
||||||
|
.value = 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.description = ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.default_int = 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.name = "midi",
|
.name = "midi",
|
||||||
.description = "MIDI out device",
|
.description = "MIDI out device",
|
||||||
@@ -711,6 +786,75 @@ static device_config_t sb_16_config[] =
|
|||||||
|
|
||||||
static device_config_t sb_awe32_config[] =
|
static device_config_t sb_awe32_config[] =
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
.name = "addr",
|
||||||
|
.description = "Address",
|
||||||
|
.type = CONFIG_BINARY,
|
||||||
|
.type = CONFIG_SELECTION,
|
||||||
|
.selection =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
.description = "0x220",
|
||||||
|
.value = 0x220
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.description = "0x240",
|
||||||
|
.value = 0x240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.description = ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.default_int = 0x220
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "irq",
|
||||||
|
.description = "IRQ",
|
||||||
|
.type = CONFIG_SELECTION,
|
||||||
|
.selection =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
.description = "IRQ 2",
|
||||||
|
.value = 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.description = "IRQ 5",
|
||||||
|
.value = 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.description = "IRQ 7",
|
||||||
|
.value = 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.description = "IRQ 10",
|
||||||
|
.value = 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.description = ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.default_int = 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "dma",
|
||||||
|
.description = "DMA",
|
||||||
|
.type = CONFIG_SELECTION,
|
||||||
|
.selection =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
.description = "DMA 1",
|
||||||
|
.value = 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.description = "DMA 3",
|
||||||
|
.value = 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.description = ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.default_int = 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.name = "midi",
|
.name = "midi",
|
||||||
.description = "MIDI out device",
|
.description = "MIDI out device",
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#include "vid_ati_eeprom.h"
|
#include "vid_ati_eeprom.h"
|
||||||
#include "vid_svga.h"
|
#include "vid_svga.h"
|
||||||
#include "vid_svga_render.h"
|
#include "vid_svga_render.h"
|
||||||
|
#include "timer.h"
|
||||||
|
|
||||||
typedef struct ati28800_t
|
typedef struct ati28800_t
|
||||||
{
|
{
|
||||||
@@ -85,7 +86,7 @@ void ati28800_out(uint16_t addr, uint8_t val, void *p)
|
|||||||
if (svga->crtcreg < 0xe || svga->crtcreg > 0x10)
|
if (svga->crtcreg < 0xe || svga->crtcreg > 0x10)
|
||||||
{
|
{
|
||||||
svga->fullchange = changeframecount;
|
svga->fullchange = changeframecount;
|
||||||
ati28800_svga_recalctimings(svga);
|
ati28800_svga_recalctimings(ati28800);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -149,11 +150,12 @@ uint8_t ati28800_in(uint16_t addr, void *p)
|
|||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ati28800_svga_recalctimings(svga_t *svga)
|
void ati28800_svga_recalctimings(ati28800_t *ati28800)
|
||||||
{
|
{
|
||||||
double crtcconst;
|
double crtcconst;
|
||||||
double _dispontime, _dispofftime, disptime;
|
double _dispontime, _dispofftime, disptime;
|
||||||
int hdisp_old;
|
int hdisp_old;
|
||||||
|
svga_t *svga = &ati28800->svga;
|
||||||
|
|
||||||
svga->vtotal = svga->crtc[6];
|
svga->vtotal = svga->crtc[6];
|
||||||
svga->dispend = svga->crtc[0x12];
|
svga->dispend = svga->crtc[0x12];
|
||||||
@@ -391,7 +393,7 @@ void ati28800_speed_changed(void *p)
|
|||||||
{
|
{
|
||||||
ati28800_t *ati28800 = (ati28800_t *)p;
|
ati28800_t *ati28800 = (ati28800_t *)p;
|
||||||
|
|
||||||
ati28800_svga_recalctimings(&ati28800->svga);
|
ati28800_svga_recalctimings(ati28800);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ati28800_force_redraw(void *p)
|
void ati28800_force_redraw(void *p)
|
||||||
|
Reference in New Issue
Block a user