Trivial fixes and cleanups for serial & parallel
This commit is contained in:
10
src/config.c
10
src/config.c
@@ -1042,12 +1042,12 @@ load_ports(void)
|
||||
char temp[512];
|
||||
int c, d;
|
||||
|
||||
for (c = 0; c < 4; c++) {
|
||||
for (c = 0; c < SERIAL_MAX; c++) {
|
||||
sprintf(temp, "serial%d_enabled", c + 1);
|
||||
serial_enabled[c] = !!config_get_int(cat, temp, (c >= 2) ? 0 : 1);
|
||||
}
|
||||
|
||||
for (c = 0; c < 3; c++) {
|
||||
for (c = 0; c < PARALLEL_MAX; c++) {
|
||||
sprintf(temp, "lpt%d_enabled", c + 1);
|
||||
lpt_ports[c].enabled = !!config_get_int(cat, temp, (c == 0) ? 1 : 0);
|
||||
|
||||
@@ -1059,7 +1059,7 @@ load_ports(void)
|
||||
/* Legacy config compatibility. */
|
||||
d = config_get_int(cat, "lpt_enabled", 2);
|
||||
if (d < 2) {
|
||||
for (c = 0; c < 3; c++)
|
||||
for (c = 0; c < PARALLEL_MAX; c++)
|
||||
lpt_ports[c].enabled = d;
|
||||
}
|
||||
config_delete_var(cat, "lpt_enabled");
|
||||
@@ -2512,7 +2512,7 @@ save_ports(void)
|
||||
char temp[512];
|
||||
int c, d;
|
||||
|
||||
for (c = 0; c < 4; c++) {
|
||||
for (c = 0; c < SERIAL_MAX; c++) {
|
||||
sprintf(temp, "serial%d_enabled", c + 1);
|
||||
if (((c < 2) && serial_enabled[c]) || ((c >= 2) && !serial_enabled[c]))
|
||||
config_delete_var(cat, temp);
|
||||
@@ -2520,7 +2520,7 @@ save_ports(void)
|
||||
config_set_int(cat, temp, serial_enabled[c]);
|
||||
}
|
||||
|
||||
for (c = 0; c < 3; c++) {
|
||||
for (c = 0; c < PARALLEL_MAX; c++) {
|
||||
sprintf(temp, "lpt%d_enabled", c + 1);
|
||||
d = (c == 0) ? 1 : 0;
|
||||
if (lpt_ports[c].enabled == d)
|
||||
|
@@ -717,20 +717,8 @@ serial_set_next_inst(int ni)
|
||||
|
||||
void
|
||||
serial_standalone_init(void) {
|
||||
if (next_inst == 0) {
|
||||
device_add_inst(&i8250_device, 1);
|
||||
device_add_inst(&i8250_device, 2);
|
||||
device_add_inst(&i8250_device, 3);
|
||||
device_add_inst(&i8250_device, 4);
|
||||
} else if (next_inst == 1) {
|
||||
device_add_inst(&i8250_device, 2);
|
||||
device_add_inst(&i8250_device, 3);
|
||||
device_add_inst(&i8250_device, 4);
|
||||
} else if (next_inst == 2) {
|
||||
device_add_inst(&i8250_device, 3);
|
||||
device_add_inst(&i8250_device, 4);
|
||||
} else
|
||||
device_add_inst(&i8250_device, 4);
|
||||
for ( ; next_inst < 4; )
|
||||
device_add_inst(&i8250_device, next_inst + 1);
|
||||
};
|
||||
|
||||
|
||||
|
@@ -110,9 +110,9 @@ typedef struct {
|
||||
/* Ports category */
|
||||
char parallel_devices[3][32]; /* LPT device names */
|
||||
#ifdef USE_SERIAL_DEVICES
|
||||
char serial_devices[2][32]; /* Serial device names */
|
||||
char serial_devices[4][32]; /* Serial device names */
|
||||
#endif
|
||||
int serial_enabled[2], /* Serial ports 1 and 2 enabled */
|
||||
int serial_enabled[4], /* Serial ports 1 and 2 enabled */
|
||||
parallel_enabled[3]; /* LPT1, LPT2, LPT3 enabled */
|
||||
|
||||
/* Other peripherals category */
|
||||
|
@@ -27,6 +27,8 @@
|
||||
#define SERIAL_NS16450 2
|
||||
#define SERIAL_NS16550 3
|
||||
|
||||
#define SERIAL_FIFO_SIZE 16
|
||||
|
||||
/* Default settings for the standard ports. */
|
||||
#define SERIAL1_ADDR 0x03f8
|
||||
#define SERIAL1_IRQ 4
|
||||
@@ -54,7 +56,7 @@ typedef struct serial_s
|
||||
|
||||
uint8_t rcvr_fifo_pos, xmit_fifo_pos,
|
||||
pad0, pad1,
|
||||
rcvr_fifo[16], xmit_fifo[16];
|
||||
rcvr_fifo[SERIAL_FIFO_SIZE], xmit_fifo[SERIAL_FIFO_SIZE];
|
||||
|
||||
pc_timer_t transmit_timer, timeout_timer;
|
||||
double clock_src, transmit_period;
|
||||
|
@@ -867,7 +867,7 @@ machine_pcjr_init(const machine_t *model)
|
||||
device_add(&fdc_pcjr_device);
|
||||
|
||||
device_add(&i8250_pcjr_device);
|
||||
serial_set_next_inst(2); /* So that serial_standalone_init() won't do anything. */
|
||||
serial_set_next_inst(MAX_SERIAL); /* So that serial_standalone_init() won't do anything. */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@@ -154,7 +154,7 @@ machine_xt_z184_init(const machine_t *model)
|
||||
lpt2_remove();
|
||||
lpt1_init(0x278);
|
||||
device_add(&i8250_device);
|
||||
serial_set_next_inst(2); /* So that serial_standalone_init() won't do anything. */
|
||||
serial_set_next_inst(MAX_SERIAL); /* So that serial_standalone_init() won't do anything. */
|
||||
|
||||
device_add(&cga_device);
|
||||
|
||||
|
Reference in New Issue
Block a user