Added per-device configuration.
Reworked configuration parser a bit. Added configuration for S3 ViRGE and 8-bit Sound Blasters. IRQ 2 routed to IRQ 9 on AT machines.
This commit is contained in:
parent
3c8a675d01
commit
2207f704dd
18 changed files with 1061 additions and 123 deletions
33
src/device.c
33
src/device.c
|
|
@ -1,9 +1,12 @@
|
|||
#include "ibm.h"
|
||||
#include "config.h"
|
||||
#include "device.h"
|
||||
|
||||
static void *device_priv[256];
|
||||
static device_t *devices[256];
|
||||
|
||||
static device_t *current_device;
|
||||
|
||||
void device_init()
|
||||
{
|
||||
memset(devices, 0, sizeof(devices));
|
||||
|
|
@ -20,6 +23,8 @@ void device_add(device_t *d)
|
|||
if (c >= 256)
|
||||
fatal("device_add : too many devices\n");
|
||||
|
||||
current_device = d;
|
||||
|
||||
priv = d->init();
|
||||
if (priv == NULL)
|
||||
fatal("device_add : device init failed\n");
|
||||
|
|
@ -105,3 +110,31 @@ char *device_add_status_info(char *s, int max_len)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
int device_get_config_int(char *s)
|
||||
{
|
||||
device_config_t *config = current_device->config;
|
||||
|
||||
while (config->type != -1)
|
||||
{
|
||||
if (!strcmp(s, config->name))
|
||||
return get_config_int(current_device->name, s, config->default_int);
|
||||
|
||||
config++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *device_get_config_string(char *s)
|
||||
{
|
||||
device_config_t *config = current_device->config;
|
||||
|
||||
while (config->type != -1)
|
||||
{
|
||||
if (!strcmp(s, config->name))
|
||||
return get_config_string(current_device->name, s, config->default_string);
|
||||
|
||||
config++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue