clang-format in src/
This commit is contained in:
123
src/86box.c
123
src/86box.c
@@ -104,7 +104,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Stuff that used to be globally declared in plat.h but is now extern there
|
||||
and declared here instead. */
|
||||
int dopause; /* system is paused */
|
||||
@@ -213,15 +212,12 @@ int title_update;
|
||||
int framecountx = 0;
|
||||
int hard_reset_pending = 0;
|
||||
|
||||
|
||||
// int unscaled_size_x = SCREEN_RES_X; /* current unscaled size X */
|
||||
// int unscaled_size_y = SCREEN_RES_Y; /* current unscaled size Y */
|
||||
// int efscrnsz_y = SCREEN_RES_Y;
|
||||
|
||||
|
||||
static wchar_t mouse_msg[3][200];
|
||||
|
||||
|
||||
#ifndef RELEASE_BUILD
|
||||
static char buff[1024];
|
||||
static int seen = 0;
|
||||
@@ -269,7 +265,6 @@ pclog_ex(const char *fmt, va_list ap)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pclog_toggle_suppr(void)
|
||||
{
|
||||
@@ -278,7 +273,6 @@ pclog_toggle_suppr(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Log something. We only do this in non-release builds. */
|
||||
void
|
||||
pclog(const char *fmt, ...)
|
||||
@@ -292,7 +286,6 @@ pclog(const char *fmt, ...)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Log a fatal error, and display a UI message before exiting. */
|
||||
void
|
||||
fatal(const char *fmt, ...)
|
||||
@@ -326,7 +319,8 @@ fatal(const char *fmt, ...)
|
||||
#endif
|
||||
|
||||
/* Make sure the message does not have a trailing newline. */
|
||||
if ((sp = strchr(temp, '\n')) != NULL) *sp = '\0';
|
||||
if ((sp = strchr(temp, '\n')) != NULL)
|
||||
*sp = '\0';
|
||||
|
||||
/* Cleanly terminate all of the emulator's components so as
|
||||
to avoid things like threads getting stuck. */
|
||||
@@ -339,7 +333,6 @@ fatal(const char *fmt, ...)
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
fatal_ex(const char *fmt, va_list ap)
|
||||
{
|
||||
@@ -368,7 +361,8 @@ fatal_ex(const char *fmt, va_list ap)
|
||||
#endif
|
||||
|
||||
/* Make sure the message does not have a trailing newline. */
|
||||
if ((sp = strchr(temp, '\n')) != NULL) *sp = '\0';
|
||||
if ((sp = strchr(temp, '\n')) != NULL)
|
||||
*sp = '\0';
|
||||
|
||||
/* Cleanly terminate all of the emulator's components so as
|
||||
to avoid things like threads getting stuck. */
|
||||
@@ -379,11 +373,9 @@ fatal_ex(const char *fmt, va_list ap)
|
||||
fflush(stdlog);
|
||||
}
|
||||
|
||||
|
||||
#ifdef ENABLE_PC_LOG
|
||||
int pc_do_log = ENABLE_PC_LOG;
|
||||
|
||||
|
||||
static void
|
||||
pc_log(const char *fmt, ...)
|
||||
{
|
||||
@@ -399,7 +391,6 @@ pc_log(const char *fmt, ...)
|
||||
# define pc_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Perform initial startup of the PC.
|
||||
*
|
||||
@@ -460,7 +451,8 @@ pc_init(int argc, char *argv[])
|
||||
plat_getcwd(rom_path, sizeof(rom_path) - 1);
|
||||
|
||||
for (c = 1; c < argc; c++) {
|
||||
if (argv[c][0] != '-') break;
|
||||
if (argv[c][0] != '-')
|
||||
break;
|
||||
|
||||
if (!strcasecmp(argv[c], "--help") || !strcasecmp(argv[c], "-?")) {
|
||||
usage:
|
||||
@@ -489,72 +481,63 @@ usage:
|
||||
printf("-Z or --lastvmpath - the last parameter is VM path rather than config\n");
|
||||
printf("\nA config file can be specified. If none is, the default file will be used.\n");
|
||||
return (0);
|
||||
} else if (!strcasecmp(argv[c], "--lastvmpath") ||
|
||||
!strcasecmp(argv[c], "-Z")) {
|
||||
} else if (!strcasecmp(argv[c], "--lastvmpath") || !strcasecmp(argv[c], "-Z")) {
|
||||
lvmp = 1;
|
||||
} else if (!strcasecmp(argv[c], "--dumpcfg") ||
|
||||
!strcasecmp(argv[c], "-O")) {
|
||||
} else if (!strcasecmp(argv[c], "--dumpcfg") || !strcasecmp(argv[c], "-O")) {
|
||||
do_dump_config = 1;
|
||||
#ifdef _WIN32
|
||||
} else if (!strcasecmp(argv[c], "--debug") ||
|
||||
!strcasecmp(argv[c], "-D")) {
|
||||
} else if (!strcasecmp(argv[c], "--debug") || !strcasecmp(argv[c], "-D")) {
|
||||
force_debug = 1;
|
||||
#endif
|
||||
#ifdef ENABLE_NG
|
||||
} else if (!strcasecmp(argv[c], "--nographic") ||
|
||||
!strcasecmp(argv[c], "-E")) {
|
||||
} else if (!strcasecmp(argv[c], "--nographic") || !strcasecmp(argv[c], "-E")) {
|
||||
/* Currently does nothing, but if/when we implement a built-in manager,
|
||||
it's going to force the manager not to run, allowing the old usage
|
||||
without parameter. */
|
||||
ng = 1;
|
||||
#endif
|
||||
} else if (!strcasecmp(argv[c], "--fullscreen") ||
|
||||
!strcasecmp(argv[c], "-F")) {
|
||||
} else if (!strcasecmp(argv[c], "--fullscreen") || !strcasecmp(argv[c], "-F")) {
|
||||
start_in_fullscreen = 1;
|
||||
} else if (!strcasecmp(argv[c], "--logfile") ||
|
||||
!strcasecmp(argv[c], "-L")) {
|
||||
if ((c+1) == argc) goto usage;
|
||||
} else if (!strcasecmp(argv[c], "--logfile") || !strcasecmp(argv[c], "-L")) {
|
||||
if ((c + 1) == argc)
|
||||
goto usage;
|
||||
|
||||
strcpy(log_path, argv[++c]);
|
||||
} else if (!strcasecmp(argv[c], "--vmpath") ||
|
||||
!strcasecmp(argv[c], "-P")) {
|
||||
if ((c+1) == argc) goto usage;
|
||||
} else if (!strcasecmp(argv[c], "--vmpath") || !strcasecmp(argv[c], "-P")) {
|
||||
if ((c + 1) == argc)
|
||||
goto usage;
|
||||
|
||||
ppath = argv[++c];
|
||||
} else if (!strcasecmp(argv[c], "--rompath") ||
|
||||
!strcasecmp(argv[c], "-R")) {
|
||||
if ((c+1) == argc) goto usage;
|
||||
} else if (!strcasecmp(argv[c], "--rompath") || !strcasecmp(argv[c], "-R")) {
|
||||
if ((c + 1) == argc)
|
||||
goto usage;
|
||||
|
||||
rpath = argv[++c];
|
||||
rom_add_path(rpath);
|
||||
} else if (!strcasecmp(argv[c], "--config") ||
|
||||
!strcasecmp(argv[c], "-C")) {
|
||||
if ((c+1) == argc || plat_dir_check(argv[c + 1])) goto usage;
|
||||
} else if (!strcasecmp(argv[c], "--config") || !strcasecmp(argv[c], "-C")) {
|
||||
if ((c + 1) == argc || plat_dir_check(argv[c + 1]))
|
||||
goto usage;
|
||||
|
||||
cfg = argv[++c];
|
||||
} else if (!strcasecmp(argv[c], "--vmname") ||
|
||||
!strcasecmp(argv[c], "-V")) {
|
||||
if ((c+1) == argc) goto usage;
|
||||
} else if (!strcasecmp(argv[c], "--vmname") || !strcasecmp(argv[c], "-V")) {
|
||||
if ((c + 1) == argc)
|
||||
goto usage;
|
||||
|
||||
strcpy(vm_name, argv[++c]);
|
||||
} else if (!strcasecmp(argv[c], "--settings") ||
|
||||
!strcasecmp(argv[c], "-S")) {
|
||||
} else if (!strcasecmp(argv[c], "--settings") || !strcasecmp(argv[c], "-S")) {
|
||||
settings_only = 1;
|
||||
} else if (!strcasecmp(argv[c], "--noconfirm") ||
|
||||
!strcasecmp(argv[c], "-N")) {
|
||||
} else if (!strcasecmp(argv[c], "--noconfirm") || !strcasecmp(argv[c], "-N")) {
|
||||
confirm_exit_cmdl = 0;
|
||||
#ifdef _WIN32
|
||||
} else if (!strcasecmp(argv[c], "--hwnd") ||
|
||||
!strcasecmp(argv[c], "-H")) {
|
||||
} else if (!strcasecmp(argv[c], "--hwnd") || !strcasecmp(argv[c], "-H")) {
|
||||
|
||||
if ((c+1) == argc) goto usage;
|
||||
if ((c + 1) == argc)
|
||||
goto usage;
|
||||
|
||||
uid = (uint32_t *) &unique_id;
|
||||
shwnd = (uint32_t *) &source_hwnd;
|
||||
sscanf(argv[++c], "%08X%08X,%08X%08X", uid + 1, uid, shwnd + 1, shwnd);
|
||||
} else if (!strcasecmp(argv[c], "--lang") ||
|
||||
!strcasecmp(argv[c], "-G")) {
|
||||
|
||||
} else if (!strcasecmp(argv[c], "--lang") || !strcasecmp(argv[c], "-G")) {
|
||||
|
||||
#endif
|
||||
// This function is currently unimplemented for *nix but has placeholders.
|
||||
@@ -573,14 +556,16 @@ usage:
|
||||
return (0);
|
||||
#ifdef USE_INSTRUMENT
|
||||
} else if (!strcasecmp(argv[c], "--instrument")) {
|
||||
if ((c+1) == argc) goto usage;
|
||||
if ((c + 1) == argc)
|
||||
goto usage;
|
||||
instru_enabled = 1;
|
||||
sscanf(argv[++c], "%llu", &instru_run_ms);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Uhm... out of options here.. */
|
||||
else goto usage;
|
||||
else
|
||||
goto usage;
|
||||
}
|
||||
|
||||
/* One argument (config file) allowed. */
|
||||
@@ -591,7 +576,8 @@ usage:
|
||||
cfg = argv[c++];
|
||||
}
|
||||
|
||||
if (c != argc) goto usage;
|
||||
if (c != argc)
|
||||
goto usage;
|
||||
|
||||
path_slash(usr_path);
|
||||
path_slash(rom_path);
|
||||
@@ -762,7 +748,6 @@ usage:
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pc_speed_changed(void)
|
||||
{
|
||||
@@ -772,7 +757,6 @@ pc_speed_changed(void)
|
||||
pit_set_clock(14318184.0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pc_full_speed(void)
|
||||
{
|
||||
@@ -783,7 +767,6 @@ pc_full_speed(void)
|
||||
atfullspeed = 1;
|
||||
}
|
||||
|
||||
|
||||
/* Initialize modules, ran once, after pc_init. */
|
||||
int
|
||||
pc_init_modules(void)
|
||||
@@ -913,7 +896,6 @@ pc_init_modules(void)
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pc_send_ca(uint16_t sc)
|
||||
{
|
||||
@@ -925,7 +907,6 @@ pc_send_ca(uint16_t sc)
|
||||
keyboard_input(0, 0x1D); /* Ctrl key released */
|
||||
}
|
||||
|
||||
|
||||
/* Send the machine a Control-Alt-DEL sequence. */
|
||||
void
|
||||
pc_send_cad(void)
|
||||
@@ -933,7 +914,6 @@ pc_send_cad(void)
|
||||
pc_send_ca(0x153);
|
||||
}
|
||||
|
||||
|
||||
/* Send the machine a Control-Alt-ESC sequence. */
|
||||
void
|
||||
pc_send_cae(void)
|
||||
@@ -941,7 +921,6 @@ pc_send_cae(void)
|
||||
pc_send_ca(1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pc_reset_hard_close(void)
|
||||
{
|
||||
@@ -985,7 +964,6 @@ pc_reset_hard_close(void)
|
||||
cpu_close();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This is basically the spot where we start up the actual machine,
|
||||
* by issuing a 'hard reset' to the entire configuration. Order is
|
||||
@@ -1103,7 +1081,8 @@ pc_reset_hard_init(void)
|
||||
update_mouse_msg();
|
||||
}
|
||||
|
||||
void update_mouse_msg()
|
||||
void
|
||||
update_mouse_msg()
|
||||
{
|
||||
wchar_t wcpufamily[2048], wcpu[2048], wmachine[2048], *wcp;
|
||||
|
||||
@@ -1142,7 +1121,6 @@ pc_reset_hard(void)
|
||||
hard_reset_pending = 1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pc_close(thread_t *ptr)
|
||||
{
|
||||
@@ -1208,16 +1186,15 @@ pc_close(thread_t *ptr)
|
||||
gdbstub_close();
|
||||
}
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
static void _ui_window_title(void *s)
|
||||
static void
|
||||
_ui_window_title(void *s)
|
||||
{
|
||||
ui_window_title((wchar_t *) s);
|
||||
free(s);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
pc_run(void)
|
||||
{
|
||||
@@ -1261,7 +1238,6 @@ pc_run(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Handler for the 1-second timer to refresh the window title. */
|
||||
void
|
||||
pc_onesec(void)
|
||||
@@ -1283,10 +1259,14 @@ set_screen_size_monitor(int x, int y, int monitor_index)
|
||||
#if 0
|
||||
pc_log("SetScreenSize(%d, %d) resize=%d\n", x, y, vid_resize);
|
||||
#endif
|
||||
if (x < 320) x = 320;
|
||||
if (y < 200) y = 200;
|
||||
if (x > 2048) x = 2048;
|
||||
if (y > 2048) y = 2048;
|
||||
if (x < 320)
|
||||
x = 320;
|
||||
if (y < 200)
|
||||
y = 200;
|
||||
if (x > 2048)
|
||||
x = 2048;
|
||||
if (y > 2048)
|
||||
y = 2048;
|
||||
|
||||
/* Save the new values as "real" (unscaled) resolution. */
|
||||
monitors[monitor_index].mon_unscaled_size_x = x;
|
||||
@@ -1366,7 +1346,6 @@ reset_screen_size(void)
|
||||
set_screen_size(monitors[i].mon_unscaled_size_x, monitors[i].mon_efscrnsz_y);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
set_screen_size_natural(void)
|
||||
{
|
||||
@@ -1374,14 +1353,12 @@ set_screen_size_natural(void)
|
||||
set_screen_size(monitors[i].mon_unscaled_size_x, monitors[i].mon_unscaled_size_y);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
get_actual_size_x(void)
|
||||
{
|
||||
return (unscaled_size_x);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
get_actual_size_y(void)
|
||||
{
|
||||
|
||||
347
src/acpi.c
347
src/acpi.c
File diff suppressed because it is too large
Load Diff
12
src/apm.c
12
src/apm.c
@@ -27,11 +27,9 @@
|
||||
#include <86box/io.h>
|
||||
#include <86box/apm.h>
|
||||
|
||||
|
||||
#ifdef ENABLE_APM_LOG
|
||||
int apm_do_log = ENABLE_APM_LOG;
|
||||
|
||||
|
||||
static void
|
||||
apm_log(const char *fmt, ...)
|
||||
{
|
||||
@@ -47,14 +45,12 @@ apm_log(const char *fmt, ...)
|
||||
# define apm_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
apm_set_do_smi(apm_t *dev, uint8_t do_smi)
|
||||
{
|
||||
dev->do_smi = do_smi;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
apm_out(uint16_t port, uint8_t val, void *p)
|
||||
{
|
||||
@@ -72,7 +68,6 @@ apm_out(uint16_t port, uint8_t val, void *p)
|
||||
dev->stat = val;
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
apm_in(uint16_t port, void *p)
|
||||
{
|
||||
@@ -91,7 +86,6 @@ apm_in(uint16_t port, void *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
apm_reset(void *p)
|
||||
{
|
||||
@@ -100,7 +94,6 @@ apm_reset(void *p)
|
||||
dev->cmd = dev->stat = 0x00;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
apm_close(void *p)
|
||||
{
|
||||
@@ -109,9 +102,9 @@ apm_close(void *p)
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
*apm_init(const device_t *info)
|
||||
*
|
||||
apm_init(const device_t *info)
|
||||
{
|
||||
apm_t *dev = (apm_t *) malloc(sizeof(apm_t));
|
||||
memset(dev, 0, sizeof(apm_t));
|
||||
@@ -122,7 +115,6 @@ static void
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
const device_t apm_device = {
|
||||
.name = "Advanced Power Management",
|
||||
.internal_name = "apm",
|
||||
|
||||
@@ -73,7 +73,6 @@
|
||||
#include <86box/ui.h>
|
||||
#include <86box/snd_opl.h>
|
||||
|
||||
|
||||
static int cx, cy, cw, ch;
|
||||
static ini_t config;
|
||||
|
||||
@@ -799,7 +798,6 @@ load_network(void)
|
||||
sprintf(temp, "net_%02i_link", c + 1);
|
||||
net_cards_conf[c].link_state = ini_section_get_int(cat, temp,
|
||||
(NET_LINK_10_HD | NET_LINK_10_FD | NET_LINK_100_HD | NET_LINK_100_FD | NET_LINK_1000_HD | NET_LINK_1000_FD));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,11 +35,9 @@
|
||||
#include <86box/dma.h>
|
||||
#include <86box/ddma.h>
|
||||
|
||||
|
||||
#ifdef ENABLE_DDMA_LOG
|
||||
int ddma_do_log = ENABLE_DDMA_LOG;
|
||||
|
||||
|
||||
static void
|
||||
ddma_log(const char *fmt, ...)
|
||||
{
|
||||
@@ -87,7 +85,6 @@ ddma_reg_read(uint16_t addr, void *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ddma_reg_write(uint16_t addr, uint8_t val, void *p)
|
||||
{
|
||||
@@ -144,7 +141,6 @@ ddma_reg_write(uint16_t addr, uint8_t val, void *p)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ddma_update_io_mapping(ddma_t *dev, int ch, uint8_t base_l, uint8_t base_h, int enable)
|
||||
{
|
||||
@@ -158,7 +154,6 @@ ddma_update_io_mapping(ddma_t *dev, int ch, uint8_t base_l, uint8_t base_h, int
|
||||
io_sethandler(dev->channels[ch].io_base, 0x10, ddma_reg_read, NULL, NULL, ddma_reg_write, NULL, NULL, &dev->channels[ch]);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ddma_close(void *priv)
|
||||
{
|
||||
@@ -167,7 +162,6 @@ ddma_close(void *priv)
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
ddma_init(const device_t *info)
|
||||
{
|
||||
@@ -175,7 +169,8 @@ ddma_init(const device_t *info)
|
||||
int i;
|
||||
|
||||
dev = (ddma_t *) malloc(sizeof(ddma_t));
|
||||
if (dev == NULL) return(NULL);
|
||||
if (dev == NULL)
|
||||
return (NULL);
|
||||
memset(dev, 0x00, sizeof(ddma_t));
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
|
||||
86
src/device.c
86
src/device.c
@@ -53,19 +53,15 @@
|
||||
#include <86box/rom.h>
|
||||
#include <86box/sound.h>
|
||||
|
||||
|
||||
#define DEVICE_MAX 256 /* max # of devices */
|
||||
|
||||
|
||||
static device_t *devices[DEVICE_MAX];
|
||||
static void *device_priv[DEVICE_MAX];
|
||||
static device_context_t device_current, device_prev;
|
||||
|
||||
|
||||
#ifdef ENABLE_DEVICE_LOG
|
||||
int device_do_log = ENABLE_DEVICE_LOG;
|
||||
|
||||
|
||||
static void
|
||||
device_log(const char *fmt, ...)
|
||||
{
|
||||
@@ -81,7 +77,6 @@ device_log(const char *fmt, ...)
|
||||
# define device_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
/* Initialize the module for use. */
|
||||
void
|
||||
device_init(void)
|
||||
@@ -89,7 +84,6 @@ device_init(void)
|
||||
memset(devices, 0x00, sizeof(devices));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
device_set_context(device_context_t *c, const device_t *d, int inst)
|
||||
{
|
||||
@@ -112,7 +106,6 @@ device_set_context(device_context_t *c, const device_t *d, int inst)
|
||||
sprintf(c->name, "%s", d->name);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
device_context_common(const device_t *d, int inst)
|
||||
{
|
||||
@@ -120,28 +113,24 @@ device_context_common(const device_t *d, int inst)
|
||||
device_set_context(&device_current, d, inst);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
device_context(const device_t *d)
|
||||
{
|
||||
device_context_common(d, 0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
device_context_inst(const device_t *d, int inst)
|
||||
{
|
||||
device_context_common(d, inst);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
device_context_restore(void)
|
||||
{
|
||||
memcpy(&device_current, &device_prev, sizeof(device_context_t));
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
device_add_common(const device_t *d, const device_t *cd, void *p, int inst)
|
||||
{
|
||||
@@ -153,7 +142,8 @@ device_add_common(const device_t *d, const device_t *cd, void *p, int inst)
|
||||
device_log("DEVICE: device already exists!\n");
|
||||
return (NULL);
|
||||
}
|
||||
if (devices[c] == NULL) break;
|
||||
if (devices[c] == NULL)
|
||||
break;
|
||||
}
|
||||
if (c >= DEVICE_MAX)
|
||||
fatal("DEVICE: too many devices\n");
|
||||
@@ -194,7 +184,6 @@ device_add_common(const device_t *d, const device_t *cd, void *p, int inst)
|
||||
return (priv);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
device_get_internal_name(const device_t *d)
|
||||
{
|
||||
@@ -204,14 +193,12 @@ device_get_internal_name(const device_t *d)
|
||||
return (char *) d->internal_name;
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
device_add(const device_t *d)
|
||||
{
|
||||
return device_add_common(d, d, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
/* For devices that do not have an init function (internal video etc.) */
|
||||
void
|
||||
device_add_ex(const device_t *d, void *priv)
|
||||
@@ -219,14 +206,12 @@ device_add_ex(const device_t *d, void *priv)
|
||||
device_add_common(d, d, priv, 0);
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
device_add_inst(const device_t *d, int inst)
|
||||
{
|
||||
return device_add_common(d, d, NULL, inst);
|
||||
}
|
||||
|
||||
|
||||
/* For devices that do not have an init function (internal video etc.) */
|
||||
void
|
||||
device_add_inst_ex(const device_t *d, void *priv, int inst)
|
||||
@@ -234,7 +219,6 @@ device_add_inst_ex(const device_t *d, void *priv, int inst)
|
||||
device_add_common(d, d, priv, inst);
|
||||
}
|
||||
|
||||
|
||||
/* These four are to add a device with another device's context - will be
|
||||
used to add machines' internal devices. */
|
||||
void *
|
||||
@@ -243,7 +227,6 @@ device_cadd(const device_t *d, const device_t *cd)
|
||||
return device_add_common(d, cd, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
/* For devices that do not have an init function (internal video etc.) */
|
||||
void
|
||||
device_cadd_ex(const device_t *d, const device_t *cd, void *priv)
|
||||
@@ -251,14 +234,12 @@ device_cadd_ex(const device_t *d, const device_t *cd, void *priv)
|
||||
device_add_common(d, cd, priv, 0);
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
device_cadd_inst(const device_t *d, const device_t *cd, int inst)
|
||||
{
|
||||
return device_add_common(d, cd, NULL, inst);
|
||||
}
|
||||
|
||||
|
||||
/* For devices that do not have an init function (internal video etc.) */
|
||||
void
|
||||
device_cadd_inst_ex(const device_t *d, const device_t *cd, void *priv, int inst)
|
||||
@@ -266,7 +247,6 @@ device_cadd_inst_ex(const device_t *d, const device_t *cd, void *priv, int inst)
|
||||
device_add_common(d, cd, priv, inst);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
device_close_all(void)
|
||||
{
|
||||
@@ -283,7 +263,6 @@ device_close_all(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
device_reset_all(void)
|
||||
{
|
||||
@@ -297,7 +276,6 @@ device_reset_all(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Reset all attached PCI devices - needed for PCI turbo reset control. */
|
||||
void
|
||||
device_reset_all_pci(void)
|
||||
@@ -312,7 +290,6 @@ device_reset_all_pci(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
device_get_priv(const device_t *d)
|
||||
{
|
||||
@@ -328,7 +305,6 @@ device_get_priv(const device_t *d)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
device_available(const device_t *d)
|
||||
{
|
||||
@@ -371,7 +347,6 @@ device_available(const device_t *d)
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
device_has_config(const device_t *d)
|
||||
{
|
||||
@@ -395,7 +370,6 @@ device_has_config(const device_t *d)
|
||||
return (c > 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
device_poll(const device_t *d, int x, int y, int z, int b)
|
||||
{
|
||||
@@ -413,7 +387,6 @@ device_poll(const device_t *d, int x, int y, int z, int b)
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
device_register_pci_slot(const device_t *d, int device, int type, int inta, int intb, int intc, int intd)
|
||||
{
|
||||
@@ -432,7 +405,6 @@ device_register_pci_slot(const device_t *d, int device, int type, int inta, int
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
device_get_name(const device_t *d, int bus, char *name)
|
||||
{
|
||||
@@ -523,7 +495,6 @@ device_get_name(const device_t *d, int bus, char *name)
|
||||
strcat(name, d->name);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
device_speed_changed(void)
|
||||
{
|
||||
@@ -539,7 +510,6 @@ device_speed_changed(void)
|
||||
sound_speed_changed();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
device_force_redraw(void)
|
||||
{
|
||||
@@ -553,7 +523,6 @@ device_force_redraw(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
device_get_config_string(const char *s)
|
||||
{
|
||||
@@ -569,7 +538,6 @@ device_get_config_string(const char *s)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
device_get_config_int(const char *s)
|
||||
{
|
||||
@@ -585,7 +553,6 @@ device_get_config_int(const char *s)
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
device_get_config_int_ex(const char *s, int def)
|
||||
{
|
||||
@@ -601,7 +568,6 @@ device_get_config_int_ex(const char *s, int def)
|
||||
return (def);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
device_get_config_hex16(const char *s)
|
||||
{
|
||||
@@ -617,7 +583,6 @@ device_get_config_hex16(const char *s)
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
device_get_config_hex20(const char *s)
|
||||
{
|
||||
@@ -633,7 +598,6 @@ device_get_config_hex20(const char *s)
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
device_get_config_mac(const char *s, int def)
|
||||
{
|
||||
@@ -649,7 +613,6 @@ device_get_config_mac(const char *s, int def)
|
||||
return (def);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
device_set_config_int(const char *s, int val)
|
||||
{
|
||||
@@ -665,7 +628,6 @@ device_set_config_int(const char *s, int val)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
device_set_config_hex16(const char *s, int val)
|
||||
{
|
||||
@@ -681,7 +643,6 @@ device_set_config_hex16(const char *s, int val)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
device_set_config_hex20(const char *s, int val)
|
||||
{
|
||||
@@ -697,7 +658,6 @@ device_set_config_hex20(const char *s, int val)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
device_set_config_mac(const char *s, int val)
|
||||
{
|
||||
@@ -713,43 +673,53 @@ device_set_config_mac(const char *s, int val)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
device_is_valid(const device_t *device, int m)
|
||||
{
|
||||
if (device == NULL) return(1);
|
||||
if (device == NULL)
|
||||
return (1);
|
||||
|
||||
if ((device->flags & DEVICE_AT) && !machine_has_bus(m, MACHINE_BUS_ISA16)) return(0);
|
||||
if ((device->flags & DEVICE_AT) && !machine_has_bus(m, MACHINE_BUS_ISA16))
|
||||
return (0);
|
||||
|
||||
if ((device->flags & DEVICE_CBUS) && !machine_has_bus(m, MACHINE_BUS_CBUS)) return(0);
|
||||
if ((device->flags & DEVICE_CBUS) && !machine_has_bus(m, MACHINE_BUS_CBUS))
|
||||
return (0);
|
||||
|
||||
if ((device->flags & DEVICE_ISA) && !machine_has_bus(m, MACHINE_BUS_ISA)) return(0);
|
||||
if ((device->flags & DEVICE_ISA) && !machine_has_bus(m, MACHINE_BUS_ISA))
|
||||
return (0);
|
||||
|
||||
if ((device->flags & DEVICE_MCA) && !machine_has_bus(m, MACHINE_BUS_MCA)) return(0);
|
||||
if ((device->flags & DEVICE_MCA) && !machine_has_bus(m, MACHINE_BUS_MCA))
|
||||
return (0);
|
||||
|
||||
if ((device->flags & DEVICE_EISA) && !machine_has_bus(m, MACHINE_BUS_EISA)) return(0);
|
||||
if ((device->flags & DEVICE_EISA) && !machine_has_bus(m, MACHINE_BUS_EISA))
|
||||
return (0);
|
||||
|
||||
if ((device->flags & DEVICE_VLB) && !machine_has_bus(m, MACHINE_BUS_VLB)) return(0);
|
||||
if ((device->flags & DEVICE_VLB) && !machine_has_bus(m, MACHINE_BUS_VLB))
|
||||
return (0);
|
||||
|
||||
if ((device->flags & DEVICE_PCI) && !machine_has_bus(m, MACHINE_BUS_PCI)) return(0);
|
||||
if ((device->flags & DEVICE_PCI) && !machine_has_bus(m, MACHINE_BUS_PCI))
|
||||
return (0);
|
||||
|
||||
if ((device->flags & DEVICE_AGP) && !machine_has_bus(m, MACHINE_BUS_AGP)) return(0);
|
||||
if ((device->flags & DEVICE_AGP) && !machine_has_bus(m, MACHINE_BUS_AGP))
|
||||
return (0);
|
||||
|
||||
if ((device->flags & DEVICE_PS2) && !machine_has_bus(m, MACHINE_BUS_PS2)) return(0);
|
||||
if ((device->flags & DEVICE_PS2) && !machine_has_bus(m, MACHINE_BUS_PS2))
|
||||
return (0);
|
||||
|
||||
if ((device->flags & DEVICE_AC97) && !machine_has_bus(m, MACHINE_BUS_AC97)) return(0);
|
||||
if ((device->flags & DEVICE_AC97) && !machine_has_bus(m, MACHINE_BUS_AC97))
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
machine_get_config_int(char *s)
|
||||
{
|
||||
const device_t *d = machine_getdevice(machine);
|
||||
const device_config_t *c;
|
||||
|
||||
if (d == NULL) return(0);
|
||||
if (d == NULL)
|
||||
return (0);
|
||||
|
||||
c = d->config;
|
||||
while (c && c->type != -1) {
|
||||
@@ -762,14 +732,14 @@ machine_get_config_int(char *s)
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
machine_get_config_string(char *s)
|
||||
{
|
||||
const device_t *d = machine_getdevice(machine);
|
||||
const device_config_t *c;
|
||||
|
||||
if (d == NULL) return(0);
|
||||
if (d == NULL)
|
||||
return (0);
|
||||
|
||||
c = d->config;
|
||||
while (c && c->type != -1) {
|
||||
|
||||
66
src/dma.c
66
src/dma.c
@@ -32,12 +32,10 @@
|
||||
#include <86box/pic.h>
|
||||
#include <86box/dma.h>
|
||||
|
||||
|
||||
dma_t dma[8];
|
||||
uint8_t dma_e;
|
||||
uint8_t dma_m;
|
||||
|
||||
|
||||
static uint8_t dmaregs[3][16];
|
||||
static int dma_wp[2];
|
||||
static uint8_t dma_stat;
|
||||
@@ -60,7 +58,6 @@ static struct {
|
||||
int is_ps2;
|
||||
} dma_ps2;
|
||||
|
||||
|
||||
#define DMA_PS2_IOA (1 << 0)
|
||||
#define DMA_PS2_AUTOINIT (1 << 1)
|
||||
#define DMA_PS2_XFER_MEM_TO_IO (1 << 2)
|
||||
@@ -69,11 +66,9 @@ static struct {
|
||||
#define DMA_PS2_DEC2 (1 << 4)
|
||||
#define DMA_PS2_SIZE16 (1 << 6)
|
||||
|
||||
|
||||
#ifdef ENABLE_DMA_LOG
|
||||
int dma_do_log = ENABLE_DMA_LOG;
|
||||
|
||||
|
||||
static void
|
||||
dma_log(const char *fmt, ...)
|
||||
{
|
||||
@@ -89,17 +84,14 @@ dma_log(const char *fmt, ...)
|
||||
# define dma_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
static void dma_ps2_run(int channel);
|
||||
|
||||
|
||||
int
|
||||
dma_get_drq(int channel)
|
||||
{
|
||||
return !!(dma_stat_rq_pc & (1 << channel));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma_set_drq(int channel, int set)
|
||||
{
|
||||
@@ -108,14 +100,12 @@ dma_set_drq(int channel, int set)
|
||||
dma_stat_rq_pc |= (1 << channel);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dma_transfer_size(dma_t *dev)
|
||||
{
|
||||
return dev->transfer_mode & 0xff;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dma_sg_next_addr(dma_t *dev)
|
||||
{
|
||||
@@ -139,7 +129,6 @@ dma_sg_next_addr(dma_t *dev)
|
||||
dev->ptr_cur += 8;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dma_block_transfer(int channel)
|
||||
{
|
||||
@@ -167,7 +156,6 @@ dma_block_transfer(int channel)
|
||||
dma_req_is_soft = 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dma_mem_to_mem_transfer(void)
|
||||
{
|
||||
@@ -189,7 +177,6 @@ dma_mem_to_mem_transfer(void)
|
||||
dma_req_is_soft = 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dma_sg_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -244,7 +231,6 @@ dma_sg_write(uint16_t port, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dma_sg_writew(uint16_t port, uint16_t val, void *priv)
|
||||
{
|
||||
@@ -275,7 +261,6 @@ dma_sg_writew(uint16_t port, uint16_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dma_sg_writel(uint16_t port, uint32_t val, void *priv)
|
||||
{
|
||||
@@ -302,7 +287,6 @@ dma_sg_writel(uint16_t port, uint32_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
dma_sg_read(uint16_t port, void *priv)
|
||||
{
|
||||
@@ -348,7 +332,6 @@ dma_sg_read(uint16_t port, void *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static uint16_t
|
||||
dma_sg_readw(uint16_t port, void *priv)
|
||||
{
|
||||
@@ -380,7 +363,6 @@ dma_sg_readw(uint16_t port, void *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static uint32_t
|
||||
dma_sg_readl(uint16_t port, void *priv)
|
||||
{
|
||||
@@ -409,7 +391,6 @@ dma_sg_readl(uint16_t port, void *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dma_ext_mode_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -438,7 +419,6 @@ dma_ext_mode_write(uint16_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
dma_sg_int_status_read(uint16_t addr, void *priv)
|
||||
{
|
||||
@@ -453,7 +433,6 @@ dma_sg_int_status_read(uint16_t addr, void *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
dma_read(uint16_t addr, void *priv)
|
||||
{
|
||||
@@ -495,7 +474,6 @@ dma_read(uint16_t addr, void *priv)
|
||||
return (dmaregs[0][addr & 0xf]);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dma_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -588,7 +566,6 @@ dma_write(uint16_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
dma_ps2_read(uint16_t addr, void *priv)
|
||||
{
|
||||
@@ -654,7 +631,6 @@ dma_ps2_read(uint16_t addr, void *priv)
|
||||
return (temp);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dma_ps2_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -747,7 +723,6 @@ dma_ps2_write(uint16_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
dma16_read(uint16_t addr, void *priv)
|
||||
{
|
||||
@@ -791,7 +766,6 @@ dma16_read(uint16_t addr, void *priv)
|
||||
return (dmaregs[1][addr & 0xf]);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dma16_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -885,9 +859,10 @@ dma16_write(uint16_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define CHANNELS { 8, 2, 3, 1, 8, 8, 8, 0 }
|
||||
|
||||
#define CHANNELS \
|
||||
{ \
|
||||
8, 2, 3, 1, 8, 8, 8, 0 \
|
||||
}
|
||||
|
||||
static void
|
||||
dma_page_write(uint16_t addr, uint8_t val, void *priv)
|
||||
@@ -922,7 +897,6 @@ dma_page_write(uint16_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
dma_page_read(uint16_t addr, void *priv)
|
||||
{
|
||||
@@ -943,7 +917,6 @@ dma_page_read(uint16_t addr, void *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dma_high_page_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -964,7 +937,6 @@ dma_high_page_write(uint16_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
dma_high_page_read(uint16_t addr, void *priv)
|
||||
{
|
||||
@@ -984,7 +956,6 @@ dma_high_page_read(uint16_t addr, void *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma_set_params(uint8_t advanced, uint32_t mask)
|
||||
{
|
||||
@@ -992,7 +963,6 @@ dma_set_params(uint8_t advanced, uint32_t mask)
|
||||
dma_mask = mask;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma_set_mask(uint32_t mask)
|
||||
{
|
||||
@@ -1006,14 +976,12 @@ dma_set_mask(uint32_t mask)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma_set_at(uint8_t at)
|
||||
{
|
||||
dma_at = at;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma_reset(void)
|
||||
{
|
||||
@@ -1050,7 +1018,6 @@ dma_reset(void)
|
||||
dma_at = is286;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma_remove_sg(void)
|
||||
{
|
||||
@@ -1077,7 +1044,6 @@ dma_remove_sg(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma_set_sg_base(uint8_t sg_base)
|
||||
{
|
||||
@@ -1106,7 +1072,6 @@ dma_set_sg_base(uint8_t sg_base)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma_ext_mode_init(void)
|
||||
{
|
||||
@@ -1116,7 +1081,6 @@ dma_ext_mode_init(void)
|
||||
NULL, NULL, NULL, dma_ext_mode_write, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma_high_page_init(void)
|
||||
{
|
||||
@@ -1124,7 +1088,6 @@ dma_high_page_init(void)
|
||||
dma_high_page_read, NULL, NULL, dma_high_page_write, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma_init(void)
|
||||
{
|
||||
@@ -1137,7 +1100,6 @@ dma_init(void)
|
||||
dma_ps2.is_ps2 = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma16_init(void)
|
||||
{
|
||||
@@ -1149,7 +1111,6 @@ dma16_init(void)
|
||||
dma_page_read, NULL, NULL, dma_page_write, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma_alias_set(void)
|
||||
{
|
||||
@@ -1159,7 +1120,6 @@ dma_alias_set(void)
|
||||
dma_page_read, NULL, NULL, dma_page_write, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma_alias_set_piix(void)
|
||||
{
|
||||
@@ -1173,7 +1133,6 @@ dma_alias_set_piix(void)
|
||||
dma_page_read, NULL, NULL, dma_page_write, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma_alias_remove(void)
|
||||
{
|
||||
@@ -1183,7 +1142,6 @@ dma_alias_remove(void)
|
||||
dma_page_read, NULL, NULL, dma_page_write, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma_alias_remove_piix(void)
|
||||
{
|
||||
@@ -1197,7 +1155,6 @@ dma_alias_remove_piix(void)
|
||||
dma_page_read, NULL, NULL, dma_page_write, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ps2_dma_init(void)
|
||||
{
|
||||
@@ -1210,11 +1167,9 @@ ps2_dma_init(void)
|
||||
dma_ps2.is_ps2 = 1;
|
||||
}
|
||||
|
||||
|
||||
extern void dma_bm_read(uint32_t PhysAddress, uint8_t *DataRead, uint32_t TotalSize, int TransferSize);
|
||||
extern void dma_bm_write(uint32_t PhysAddress, const uint8_t *DataWrite, uint32_t TotalSize, int TransferSize);
|
||||
|
||||
|
||||
static int
|
||||
dma_sg(uint8_t *data, int transfer_length, int out, void *priv)
|
||||
{
|
||||
@@ -1279,7 +1234,6 @@ dma_sg(uint8_t *data, int transfer_length, int out, void *priv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
_dma_read(uint32_t addr, dma_t *dma_c)
|
||||
{
|
||||
@@ -1296,7 +1250,6 @@ _dma_read(uint32_t addr, dma_t *dma_c)
|
||||
return (temp);
|
||||
}
|
||||
|
||||
|
||||
static uint16_t
|
||||
_dma_readw(uint32_t addr, dma_t *dma_c)
|
||||
{
|
||||
@@ -1313,7 +1266,6 @@ _dma_readw(uint32_t addr, dma_t *dma_c)
|
||||
return (temp);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_dma_write(uint32_t addr, uint8_t val, dma_t *dma_c)
|
||||
{
|
||||
@@ -1329,7 +1281,6 @@ _dma_write(uint32_t addr, uint8_t val, dma_t *dma_c)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_dma_writew(uint32_t addr, uint16_t val, dma_t *dma_c)
|
||||
{
|
||||
@@ -1344,7 +1295,6 @@ _dma_writew(uint32_t addr, uint16_t val, dma_t *dma_c)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dma_retreat(dma_t *dma_c)
|
||||
{
|
||||
@@ -1361,7 +1311,6 @@ dma_retreat(dma_t *dma_c)
|
||||
dma_c->ac = ((dma_c->ac & 0xffff0000) & dma_mask) | ((dma_c->ac - as) & 0xffff);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma_advance(dma_t *dma_c)
|
||||
{
|
||||
@@ -1378,7 +1327,6 @@ dma_advance(dma_t *dma_c)
|
||||
dma_c->ac = ((dma_c->ac & 0xffff0000) & dma_mask) | ((dma_c->ac + as) & 0xffff);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
dma_channel_read(int channel)
|
||||
{
|
||||
@@ -1471,7 +1419,6 @@ dma_channel_read(int channel)
|
||||
return (temp);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
dma_channel_write(int channel, uint16_t val)
|
||||
{
|
||||
@@ -1559,7 +1506,6 @@ dma_channel_write(int channel, uint16_t val)
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dma_ps2_run(int channel)
|
||||
{
|
||||
@@ -1645,18 +1591,15 @@ dma_ps2_run(int channel)
|
||||
|
||||
dma_stat |= (1 << channel);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
dma_mode(int channel)
|
||||
{
|
||||
return (dma[channel].mode);
|
||||
}
|
||||
|
||||
|
||||
/* DMA Bus Master Page Read/Write */
|
||||
void
|
||||
dma_bm_read(uint32_t PhysAddress, uint8_t *DataRead, uint32_t TotalSize, int TransferSize)
|
||||
@@ -1680,7 +1623,6 @@ dma_bm_read(uint32_t PhysAddress, uint8_t *DataRead, uint32_t TotalSize, int Tra
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dma_bm_write(uint32_t PhysAddress, const uint8_t *DataWrite, uint32_t TotalSize, int TransferSize)
|
||||
{
|
||||
|
||||
33
src/fifo8.c
33
src/fifo8.c
@@ -21,7 +21,8 @@
|
||||
#include <86box/86box.h>
|
||||
#include <86box/fifo8.h>
|
||||
|
||||
void fifo8_create(Fifo8 *fifo, uint32_t capacity)
|
||||
void
|
||||
fifo8_create(Fifo8 *fifo, uint32_t capacity)
|
||||
{
|
||||
fifo->data = (uint8_t *) malloc(capacity);
|
||||
memset(fifo->data, 0, capacity);
|
||||
@@ -30,7 +31,8 @@ void fifo8_create(Fifo8 *fifo, uint32_t capacity)
|
||||
fifo->num = 0;
|
||||
}
|
||||
|
||||
void fifo8_destroy(Fifo8 *fifo)
|
||||
void
|
||||
fifo8_destroy(Fifo8 *fifo)
|
||||
{
|
||||
if (fifo->data) {
|
||||
free(fifo->data);
|
||||
@@ -38,14 +40,16 @@ void fifo8_destroy(Fifo8 *fifo)
|
||||
}
|
||||
}
|
||||
|
||||
void fifo8_push(Fifo8 *fifo, uint8_t data)
|
||||
void
|
||||
fifo8_push(Fifo8 *fifo, uint8_t data)
|
||||
{
|
||||
assert(fifo->num < fifo->capacity);
|
||||
fifo->data[(fifo->head + fifo->num) % fifo->capacity] = data;
|
||||
fifo->num++;
|
||||
}
|
||||
|
||||
void fifo8_push_all(Fifo8 *fifo, const uint8_t *data, uint32_t num)
|
||||
void
|
||||
fifo8_push_all(Fifo8 *fifo, const uint8_t *data, uint32_t num)
|
||||
{
|
||||
uint32_t start, avail;
|
||||
|
||||
@@ -64,7 +68,8 @@ void fifo8_push_all(Fifo8 *fifo, const uint8_t *data, uint32_t num)
|
||||
fifo->num += num;
|
||||
}
|
||||
|
||||
uint8_t fifo8_pop(Fifo8 *fifo)
|
||||
uint8_t
|
||||
fifo8_pop(Fifo8 *fifo)
|
||||
{
|
||||
uint8_t ret;
|
||||
|
||||
@@ -75,7 +80,8 @@ uint8_t fifo8_pop(Fifo8 *fifo)
|
||||
return ret;
|
||||
}
|
||||
|
||||
const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *num)
|
||||
const uint8_t *
|
||||
fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *num)
|
||||
{
|
||||
uint8_t *ret;
|
||||
|
||||
@@ -88,28 +94,33 @@ const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *num)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void fifo8_reset(Fifo8 *fifo)
|
||||
void
|
||||
fifo8_reset(Fifo8 *fifo)
|
||||
{
|
||||
fifo->num = 0;
|
||||
fifo->head = 0;
|
||||
}
|
||||
|
||||
int fifo8_is_empty(Fifo8 *fifo)
|
||||
int
|
||||
fifo8_is_empty(Fifo8 *fifo)
|
||||
{
|
||||
return (fifo->num == 0);
|
||||
}
|
||||
|
||||
int fifo8_is_full(Fifo8 *fifo)
|
||||
int
|
||||
fifo8_is_full(Fifo8 *fifo)
|
||||
{
|
||||
return (fifo->num == fifo->capacity);
|
||||
}
|
||||
|
||||
uint32_t fifo8_num_free(Fifo8 *fifo)
|
||||
uint32_t
|
||||
fifo8_num_free(Fifo8 *fifo)
|
||||
{
|
||||
return fifo->capacity - fifo->num;
|
||||
}
|
||||
|
||||
uint32_t fifo8_num_used(Fifo8 *fifo)
|
||||
uint32_t
|
||||
fifo8_num_used(Fifo8 *fifo)
|
||||
{
|
||||
return fifo->num;
|
||||
}
|
||||
|
||||
34
src/io.c
34
src/io.c
@@ -30,10 +30,8 @@
|
||||
#include "cpu.h"
|
||||
#include <86box/m_amstrad.h>
|
||||
|
||||
|
||||
#define NPORTS 65536 /* PC/AT supports 64K ports */
|
||||
|
||||
|
||||
typedef struct _io_ {
|
||||
uint8_t (*inb)(uint16_t addr, void *priv);
|
||||
uint16_t (*inw)(uint16_t addr, void *priv);
|
||||
@@ -58,11 +56,9 @@ typedef struct {
|
||||
int initialized = 0;
|
||||
io_t *io[NPORTS], *io_last[NPORTS];
|
||||
|
||||
|
||||
#ifdef ENABLE_IO_LOG
|
||||
int io_do_log = ENABLE_IO_LOG;
|
||||
|
||||
|
||||
static void
|
||||
io_log(const char *fmt, ...)
|
||||
{
|
||||
@@ -78,7 +74,6 @@ io_log(const char *fmt, ...)
|
||||
# define io_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
io_init(void)
|
||||
{
|
||||
@@ -109,7 +104,6 @@ io_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
io_sethandler_common(uint16_t base, int size,
|
||||
uint8_t (*inb)(uint16_t addr, void *priv),
|
||||
@@ -150,7 +144,6 @@ io_sethandler_common(uint16_t base, int size,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
io_removehandler_common(uint16_t base, int size,
|
||||
uint8_t (*inb)(uint16_t addr, void *priv),
|
||||
@@ -170,10 +163,7 @@ io_removehandler_common(uint16_t base, int size,
|
||||
continue;
|
||||
while (p) {
|
||||
q = p->next;
|
||||
if ((p->inb == inb) && (p->inw == inw) &&
|
||||
(p->inl == inl) && (p->outb == outb) &&
|
||||
(p->outw == outw) && (p->outl == outl) &&
|
||||
(p->priv == priv)) {
|
||||
if ((p->inb == inb) && (p->inw == inw) && (p->inl == inl) && (p->outb == outb) && (p->outw == outw) && (p->outl == outl) && (p->priv == priv)) {
|
||||
if (p->prev)
|
||||
p->prev->next = p->next;
|
||||
else
|
||||
@@ -191,7 +181,6 @@ io_removehandler_common(uint16_t base, int size,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
io_handler_common(int set, uint16_t base, int size,
|
||||
uint8_t (*inb)(uint16_t addr, void *priv),
|
||||
@@ -208,7 +197,6 @@ io_handler_common(int set, uint16_t base, int size,
|
||||
io_removehandler_common(base, size, inb, inw, inl, outb, outw, outl, priv, step);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
io_sethandler(uint16_t base, int size,
|
||||
uint8_t (*inb)(uint16_t addr, void *priv),
|
||||
@@ -222,7 +210,6 @@ io_sethandler(uint16_t base, int size,
|
||||
io_sethandler_common(base, size, inb, inw, inl, outb, outw, outl, priv, 1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
io_removehandler(uint16_t base, int size,
|
||||
uint8_t (*inb)(uint16_t addr, void *priv),
|
||||
@@ -236,7 +223,6 @@ io_removehandler(uint16_t base, int size,
|
||||
io_removehandler_common(base, size, inb, inw, inl, outb, outw, outl, priv, 1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
io_handler(int set, uint16_t base, int size,
|
||||
uint8_t (*inb)(uint16_t addr, void *priv),
|
||||
@@ -250,7 +236,6 @@ io_handler(int set, uint16_t base, int size,
|
||||
io_handler_common(set, base, size, inb, inw, inl, outb, outw, outl, priv, 1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
io_sethandler_interleaved(uint16_t base, int size,
|
||||
uint8_t (*inb)(uint16_t addr, void *priv),
|
||||
@@ -264,7 +249,6 @@ io_sethandler_interleaved(uint16_t base, int size,
|
||||
io_sethandler_common(base, size, inb, inw, inl, outb, outw, outl, priv, 2);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
io_removehandler_interleaved(uint16_t base, int size,
|
||||
uint8_t (*inb)(uint16_t addr, void *priv),
|
||||
@@ -278,7 +262,6 @@ io_removehandler_interleaved(uint16_t base, int size,
|
||||
io_removehandler_common(base, size, inb, inw, inl, outb, outw, outl, priv, 2);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
io_handler_interleaved(int set, uint16_t base, int size,
|
||||
uint8_t (*inb)(uint16_t addr, void *priv),
|
||||
@@ -292,7 +275,6 @@ io_handler_interleaved(int set, uint16_t base, int size,
|
||||
io_handler_common(set, base, size, inb, inw, inl, outb, outw, outl, priv, 2);
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
inb(uint16_t port)
|
||||
{
|
||||
@@ -333,7 +315,6 @@ inb(uint16_t port)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
outb(uint16_t port, uint8_t val)
|
||||
{
|
||||
@@ -365,7 +346,6 @@ outb(uint16_t port, uint8_t val)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
uint16_t
|
||||
inw(uint16_t port)
|
||||
{
|
||||
@@ -420,7 +400,6 @@ inw(uint16_t port)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
outw(uint16_t port, uint16_t val)
|
||||
{
|
||||
@@ -466,7 +445,6 @@ outw(uint16_t port, uint16_t val)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
uint32_t
|
||||
inl(uint16_t port)
|
||||
{
|
||||
@@ -549,7 +527,6 @@ inl(uint16_t port)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
outl(uint16_t port, uint32_t val)
|
||||
{
|
||||
@@ -610,7 +587,6 @@ outl(uint16_t port, uint32_t val)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
io_trap_readb(uint16_t addr, void *priv)
|
||||
{
|
||||
@@ -619,7 +595,6 @@ io_trap_readb(uint16_t addr, void *priv)
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
|
||||
static uint16_t
|
||||
io_trap_readw(uint16_t addr, void *priv)
|
||||
{
|
||||
@@ -628,7 +603,6 @@ io_trap_readw(uint16_t addr, void *priv)
|
||||
return 0xffff;
|
||||
}
|
||||
|
||||
|
||||
static uint32_t
|
||||
io_trap_readl(uint16_t addr, void *priv)
|
||||
{
|
||||
@@ -637,7 +611,6 @@ io_trap_readl(uint16_t addr, void *priv)
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
io_trap_writeb(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -645,7 +618,6 @@ io_trap_writeb(uint16_t addr, uint8_t val, void *priv)
|
||||
trap->func(1, addr, 1, val, trap->priv);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
io_trap_writew(uint16_t addr, uint16_t val, void *priv)
|
||||
{
|
||||
@@ -653,7 +625,6 @@ io_trap_writew(uint16_t addr, uint16_t val, void *priv)
|
||||
trap->func(2, addr, 1, val, trap->priv);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
io_trap_writel(uint16_t addr, uint32_t val, void *priv)
|
||||
{
|
||||
@@ -661,7 +632,6 @@ io_trap_writel(uint16_t addr, uint32_t val, void *priv)
|
||||
trap->func(4, addr, 1, val, trap->priv);
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
io_trap_add(void (*func)(int size, uint16_t addr, uint8_t write, uint8_t val, void *priv),
|
||||
void *priv)
|
||||
@@ -676,7 +646,6 @@ io_trap_add(void (*func)(int size, uint16_t addr, uint8_t write, uint8_t val, vo
|
||||
return trap;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
io_trap_remap(void *handle, int enable, uint16_t addr, uint16_t size)
|
||||
{
|
||||
@@ -709,7 +678,6 @@ io_trap_remap(void *handle, int enable, uint16_t addr, uint16_t size)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
io_trap_remove(void *handle)
|
||||
{
|
||||
|
||||
@@ -28,16 +28,13 @@
|
||||
#include <86box/mem.h>
|
||||
#include <86box/chipset.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t dummy;
|
||||
} ioapic_t;
|
||||
|
||||
|
||||
#ifdef ENABLE_IOAPIC_LOG
|
||||
int ioapic_do_log = ENABLE_IOAPIC_LOG;
|
||||
|
||||
|
||||
static void
|
||||
ioapic_log(const char *fmt, ...)
|
||||
{
|
||||
@@ -53,7 +50,6 @@ ioapic_log(const char *fmt, ...)
|
||||
# define ioapic_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
ioapic_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -86,13 +82,11 @@ ioapic_write(uint16_t port, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ioapic_reset(ioapic_t *dev)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ioapic_close(void *priv)
|
||||
{
|
||||
@@ -104,7 +98,6 @@ ioapic_close(void *priv)
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
ioapic_init(const device_t *info)
|
||||
{
|
||||
@@ -119,7 +112,6 @@ ioapic_init(const device_t *info)
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
const device_t ioapic_device = {
|
||||
.name = "I/O Advanced Programmable Interrupt Controller",
|
||||
.internal_name = "ioapic",
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <86box/version.h>
|
||||
#include <86box/log.h>
|
||||
|
||||
|
||||
#ifndef RELEASE_BUILD
|
||||
typedef struct
|
||||
{
|
||||
@@ -42,10 +41,8 @@ typedef struct
|
||||
int seen, suppr_seen;
|
||||
} log_t;
|
||||
|
||||
|
||||
extern FILE *stdlog; /* file to log output to */
|
||||
|
||||
|
||||
void
|
||||
log_set_suppr_seen(void *priv, int suppr_seen)
|
||||
{
|
||||
@@ -54,7 +51,6 @@ log_set_suppr_seen(void *priv, int suppr_seen)
|
||||
log->suppr_seen = suppr_seen;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
log_set_dev_name(void *priv, char *dev_name)
|
||||
{
|
||||
@@ -63,7 +59,6 @@ log_set_dev_name(void *priv, char *dev_name)
|
||||
log->dev_name = dev_name;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
log_copy(log_t *log, char *dest, const char *src, size_t dest_size)
|
||||
{
|
||||
@@ -75,7 +70,6 @@ log_copy(log_t *log, char *dest, const char *src, size_t dest_size)
|
||||
strcat(dest, src);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Log something to the logfile or stdout.
|
||||
*
|
||||
@@ -121,7 +115,6 @@ log_out(void *priv, const char *fmt, va_list ap)
|
||||
fflush(stdlog);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
log_fatal(void *priv, const char *fmt, ...)
|
||||
{
|
||||
@@ -140,7 +133,6 @@ log_fatal(void *priv, const char *fmt, ...)
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
log_open(char *dev_name)
|
||||
{
|
||||
@@ -154,7 +146,6 @@ log_open(char *dev_name)
|
||||
return (void *) log;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
log_close(void *priv)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
machine_status_t machine_status;
|
||||
|
||||
void
|
||||
machine_status_init() {
|
||||
machine_status_init()
|
||||
{
|
||||
for (size_t i = 0; i < FDD_NUM; ++i) {
|
||||
machine_status.fdd[i].empty = (strlen(floppyfns[i]) == 0);
|
||||
machine_status.fdd[i].active = false;
|
||||
|
||||
30
src/mca.c
30
src/mca.c
@@ -5,7 +5,6 @@
|
||||
#include <86box/io.h>
|
||||
#include <86box/mca.h>
|
||||
|
||||
|
||||
void (*mca_card_write[8])(int addr, uint8_t val, void *priv);
|
||||
uint8_t (*mca_card_read[8])(int addr, void *priv);
|
||||
uint8_t (*mca_card_feedb[8])(void *priv);
|
||||
@@ -15,8 +14,8 @@ void *mca_priv[8];
|
||||
static int mca_index;
|
||||
static int mca_nr_cards;
|
||||
|
||||
|
||||
void mca_init(int nr_cards)
|
||||
void
|
||||
mca_init(int nr_cards)
|
||||
{
|
||||
int c;
|
||||
|
||||
@@ -31,12 +30,14 @@ void mca_init(int nr_cards)
|
||||
mca_nr_cards = nr_cards;
|
||||
}
|
||||
|
||||
void mca_set_index(int index)
|
||||
void
|
||||
mca_set_index(int index)
|
||||
{
|
||||
mca_index = index;
|
||||
}
|
||||
|
||||
uint8_t mca_read(uint16_t port)
|
||||
uint8_t
|
||||
mca_read(uint16_t port)
|
||||
{
|
||||
if (mca_index >= mca_nr_cards)
|
||||
return 0xff;
|
||||
@@ -45,7 +46,8 @@ uint8_t mca_read(uint16_t port)
|
||||
return mca_card_read[mca_index](port, mca_priv[mca_index]);
|
||||
}
|
||||
|
||||
uint8_t mca_read_index(uint16_t port, int index)
|
||||
uint8_t
|
||||
mca_read_index(uint16_t port, int index)
|
||||
{
|
||||
if (mca_index >= mca_nr_cards)
|
||||
return 0xff;
|
||||
@@ -54,12 +56,14 @@ uint8_t mca_read_index(uint16_t port, int index)
|
||||
return mca_card_read[index](port, mca_priv[index]);
|
||||
}
|
||||
|
||||
int mca_get_nr_cards(void)
|
||||
int
|
||||
mca_get_nr_cards(void)
|
||||
{
|
||||
return mca_nr_cards;
|
||||
}
|
||||
|
||||
void mca_write(uint16_t port, uint8_t val)
|
||||
void
|
||||
mca_write(uint16_t port, uint8_t val)
|
||||
{
|
||||
if (mca_index >= mca_nr_cards)
|
||||
return;
|
||||
@@ -67,7 +71,8 @@ void mca_write(uint16_t port, uint8_t val)
|
||||
mca_card_write[mca_index](port, val, mca_priv[mca_index]);
|
||||
}
|
||||
|
||||
uint8_t mca_feedb(void)
|
||||
uint8_t
|
||||
mca_feedb(void)
|
||||
{
|
||||
if (mca_card_feedb[mca_index])
|
||||
return !!(mca_card_feedb[mca_index](mca_priv[mca_index]));
|
||||
@@ -75,7 +80,8 @@ uint8_t mca_feedb(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mca_reset(void)
|
||||
void
|
||||
mca_reset(void)
|
||||
{
|
||||
int c;
|
||||
|
||||
@@ -85,8 +91,8 @@ void mca_reset(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mca_add(uint8_t (*read)(int addr, void *priv), void (*write)(int addr, uint8_t val, void *priv), uint8_t (*feedb)(void *priv), void (*reset)(void *priv), void *priv)
|
||||
void
|
||||
mca_add(uint8_t (*read)(int addr, void *priv), void (*write)(int addr, uint8_t val, void *priv), uint8_t (*feedb)(void *priv), void (*reset)(void *priv), void *priv)
|
||||
{
|
||||
int c;
|
||||
|
||||
|
||||
@@ -8,17 +8,16 @@
|
||||
#include <86box/io.h>
|
||||
#include <86box/nmi.h>
|
||||
|
||||
|
||||
int nmi_mask;
|
||||
|
||||
|
||||
void nmi_write(uint16_t port, uint8_t val, void *p)
|
||||
void
|
||||
nmi_write(uint16_t port, uint8_t val, void *p)
|
||||
{
|
||||
nmi_mask = val & 0x80;
|
||||
}
|
||||
|
||||
|
||||
void nmi_init(void)
|
||||
void
|
||||
nmi_init(void)
|
||||
{
|
||||
io_sethandler(0x00a0, 0x000f, NULL, NULL, NULL, nmi_write, NULL, NULL, NULL);
|
||||
nmi_mask = 0;
|
||||
|
||||
36
src/nvr.c
36
src/nvr.c
@@ -62,19 +62,15 @@
|
||||
#include <86box/plat.h>
|
||||
#include <86box/nvr.h>
|
||||
|
||||
|
||||
int nvr_dosave; /* NVR is dirty, needs saved */
|
||||
|
||||
|
||||
static int8_t days_in_month[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
static struct tm intclk;
|
||||
static nvr_t *saved_nvr = NULL;
|
||||
|
||||
|
||||
#ifdef ENABLE_NVR_LOG
|
||||
int nvr_do_log = ENABLE_NVR_LOG;
|
||||
|
||||
|
||||
static void
|
||||
nvr_log(const char *fmt, ...)
|
||||
{
|
||||
@@ -90,19 +86,20 @@ nvr_log(const char *fmt, ...)
|
||||
# define nvr_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
/* Determine whether or not the year is leap. */
|
||||
int
|
||||
nvr_is_leap(int year)
|
||||
{
|
||||
if (year % 400 == 0) return(1);
|
||||
if (year % 100 == 0) return(0);
|
||||
if (year % 4 == 0) return(1);
|
||||
if (year % 400 == 0)
|
||||
return (1);
|
||||
if (year % 100 == 0)
|
||||
return (0);
|
||||
if (year % 4 == 0)
|
||||
return (1);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/* Determine the days in the current month. */
|
||||
int
|
||||
nvr_get_days(int month, int year)
|
||||
@@ -113,7 +110,6 @@ nvr_get_days(int month, int year)
|
||||
return (nvr_is_leap(year) ? 29 : 28);
|
||||
}
|
||||
|
||||
|
||||
/* One more second has passed, update the internal clock. */
|
||||
void
|
||||
rtc_tick(void)
|
||||
@@ -125,8 +121,7 @@ rtc_tick(void)
|
||||
intclk.tm_min = 0;
|
||||
if (++intclk.tm_hour == 24) {
|
||||
intclk.tm_hour = 0;
|
||||
if (++intclk.tm_mday == (nvr_get_days(intclk.tm_mon,
|
||||
intclk.tm_year) + 1)) {
|
||||
if (++intclk.tm_mday == (nvr_get_days(intclk.tm_mon, intclk.tm_year) + 1)) {
|
||||
intclk.tm_mday = 1;
|
||||
if (++intclk.tm_mon == 13) {
|
||||
intclk.tm_mon = 1;
|
||||
@@ -138,7 +133,6 @@ rtc_tick(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This is the RTC one-second timer. */
|
||||
static void
|
||||
onesec_timer(void *priv)
|
||||
@@ -162,7 +156,6 @@ onesec_timer(void *priv)
|
||||
timer_advance_u64(&nvr->onesec_time, (uint64_t) (10000ULL * TIMER_USEC));
|
||||
}
|
||||
|
||||
|
||||
/* Initialize the generic NVRAM/RTC device. */
|
||||
void
|
||||
nvr_init(nvr_t *nvr)
|
||||
@@ -197,7 +190,6 @@ nvr_init(nvr_t *nvr)
|
||||
(void) nvr_load();
|
||||
}
|
||||
|
||||
|
||||
/* Get path to the NVR folder. */
|
||||
char *
|
||||
nvr_path(char *str)
|
||||
@@ -220,7 +212,6 @@ nvr_path(char *str)
|
||||
return (temp);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Load an NVR from file.
|
||||
*
|
||||
@@ -240,7 +231,8 @@ nvr_load(void)
|
||||
uint8_t regs[NVR_MAXSIZE] = { 0 };
|
||||
|
||||
/* Make sure we have been initialized. */
|
||||
if (saved_nvr == NULL) return(0);
|
||||
if (saved_nvr == NULL)
|
||||
return (0);
|
||||
|
||||
/* Clear out any old data. */
|
||||
memset(saved_nvr->regs, 0x00, sizeof(saved_nvr->regs));
|
||||
@@ -274,14 +266,12 @@ nvr_load(void)
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nvr_set_ven_save(void (*ven_save)(void))
|
||||
{
|
||||
saved_nvr->ven_save = ven_save;
|
||||
}
|
||||
|
||||
|
||||
/* Save the current NVR to a file. */
|
||||
int
|
||||
nvr_save(void)
|
||||
@@ -290,7 +280,8 @@ nvr_save(void)
|
||||
FILE *fp;
|
||||
|
||||
/* Make sure we have been initialized. */
|
||||
if (saved_nvr == NULL) return(0);
|
||||
if (saved_nvr == NULL)
|
||||
return (0);
|
||||
|
||||
if (saved_nvr->size != 0) {
|
||||
path = nvr_path(saved_nvr->fn);
|
||||
@@ -312,14 +303,12 @@ nvr_save(void)
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nvr_close(void)
|
||||
{
|
||||
saved_nvr = NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nvr_time_sync(void)
|
||||
{
|
||||
@@ -337,7 +326,6 @@ nvr_time_sync(void)
|
||||
nvr_time_set(tm);
|
||||
}
|
||||
|
||||
|
||||
/* Get current time from internal clock. */
|
||||
void
|
||||
nvr_time_get(struct tm *tm)
|
||||
@@ -360,7 +348,6 @@ nvr_time_get(struct tm *tm)
|
||||
tm->tm_year = (intclk.tm_year - 1900);
|
||||
}
|
||||
|
||||
|
||||
/* Set internal clock time. */
|
||||
void
|
||||
nvr_time_set(struct tm *tm)
|
||||
@@ -374,7 +361,6 @@ nvr_time_set(struct tm *tm)
|
||||
intclk.tm_year = (tm->tm_year + 1900);
|
||||
}
|
||||
|
||||
|
||||
/* Open or create a file in the NVR area. */
|
||||
FILE *
|
||||
nvr_fopen(char *str, char *mode)
|
||||
|
||||
70
src/nvr_at.c
70
src/nvr_at.c
@@ -238,7 +238,6 @@
|
||||
#include <86box/device.h>
|
||||
#include <86box/nvr.h>
|
||||
|
||||
|
||||
/* RTC registers and bit definitions. */
|
||||
#define RTC_SECONDS 0
|
||||
#define RTC_ALSECONDS 1
|
||||
@@ -297,7 +296,6 @@
|
||||
#define FLAG_P6RP4_HACK 0x10
|
||||
#define FLAG_PIIX4 0x20
|
||||
|
||||
|
||||
typedef struct {
|
||||
int8_t stat;
|
||||
|
||||
@@ -317,10 +315,8 @@ typedef struct {
|
||||
rtc_timer;
|
||||
} local_t;
|
||||
|
||||
|
||||
static uint8_t nvr_at_inited = 0;
|
||||
|
||||
|
||||
/* Get the current NVR time. */
|
||||
static void
|
||||
time_get(nvr_t *nvr, struct tm *tm)
|
||||
@@ -359,7 +355,6 @@ time_get(nvr_t *nvr, struct tm *tm)
|
||||
tm->tm_hour = ((temp & ~RTC_AMPM) % 12) + ((temp & RTC_AMPM) ? 12 : 0);
|
||||
}
|
||||
|
||||
|
||||
/* Set the current NVR time. */
|
||||
static void
|
||||
time_set(nvr_t *nvr, struct tm *tm)
|
||||
@@ -412,16 +407,13 @@ time_set(nvr_t *nvr, struct tm *tm)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Check if the current time matches a set alarm time. */
|
||||
static int8_t
|
||||
check_alarm(nvr_t *nvr, int8_t addr)
|
||||
{
|
||||
return((nvr->regs[addr+1] == nvr->regs[addr]) ||
|
||||
((nvr->regs[addr+1] & AL_DONTCARE) == AL_DONTCARE));
|
||||
return ((nvr->regs[addr + 1] == nvr->regs[addr]) || ((nvr->regs[addr + 1] & AL_DONTCARE) == AL_DONTCARE));
|
||||
}
|
||||
|
||||
|
||||
/* Check for VIA stuff. */
|
||||
static int8_t
|
||||
check_alarm_via(nvr_t *nvr, int8_t addr, int8_t addr_2)
|
||||
@@ -429,13 +421,11 @@ check_alarm_via(nvr_t *nvr, int8_t addr, int8_t addr_2)
|
||||
local_t *local = (local_t *) nvr->data;
|
||||
|
||||
if (local->cent == RTC_CENTURY_VIA) {
|
||||
return((nvr->regs[addr_2] == nvr->regs[addr]) ||
|
||||
((nvr->regs[addr_2] & AL_DONTCARE) == AL_DONTCARE));
|
||||
return ((nvr->regs[addr_2] == nvr->regs[addr]) || ((nvr->regs[addr_2] & AL_DONTCARE) == AL_DONTCARE));
|
||||
} else
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Update the NVR registers from the internal clock. */
|
||||
static void
|
||||
timer_update(void *priv)
|
||||
@@ -457,13 +447,10 @@ timer_update(void *priv)
|
||||
local->stat = 0x00;
|
||||
|
||||
/* Check for any alarms we need to handle. */
|
||||
if (check_alarm(nvr, RTC_SECONDS) &&
|
||||
check_alarm(nvr, RTC_MINUTES) &&
|
||||
check_alarm(nvr, RTC_HOURS) &&
|
||||
check_alarm_via(nvr, RTC_DOM, RTC_ALDAY) &&
|
||||
check_alarm_via(nvr, RTC_MONTH, RTC_ALMONTH)/* &&
|
||||
if (check_alarm(nvr, RTC_SECONDS) && check_alarm(nvr, RTC_MINUTES) && check_alarm(nvr, RTC_HOURS) && check_alarm_via(nvr, RTC_DOM, RTC_ALDAY) && check_alarm_via(nvr, RTC_MONTH, RTC_ALMONTH) /* &&
|
||||
check_alarm_via(nvr, RTC_DOM, RTC_ALDAY_SIS) &&
|
||||
check_alarm_via(nvr, RTC_MONTH, RTC_ALMONT_SIS)*/) {
|
||||
check_alarm_via(nvr, RTC_MONTH, RTC_ALMONT_SIS)*/
|
||||
) {
|
||||
nvr->regs[RTC_REGC] |= REGC_AF;
|
||||
if (nvr->regs[RTC_REGB] & REGB_AIE) {
|
||||
/* Generate an interrupt. */
|
||||
@@ -489,7 +476,6 @@ timer_update(void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
timer_load_count(nvr_t *nvr)
|
||||
{
|
||||
@@ -509,7 +495,8 @@ timer_load_count(nvr_t *nvr)
|
||||
case 0:
|
||||
local->state = 0;
|
||||
break;
|
||||
case 1: case 2:
|
||||
case 1:
|
||||
case 2:
|
||||
local->count = 1 << (c + 6);
|
||||
timer_set_delay_u64(&local->rtc_timer, (local->count) * RTCCONST);
|
||||
break;
|
||||
@@ -520,7 +507,6 @@ timer_load_count(nvr_t *nvr)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
timer_intr(void *priv)
|
||||
{
|
||||
@@ -541,7 +527,6 @@ timer_intr(void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Callback from internal clock, another second passed. */
|
||||
static void
|
||||
timer_tick(nvr_t *nvr)
|
||||
@@ -561,7 +546,6 @@ timer_tick(nvr_t *nvr)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
nvr_reg_common_write(uint16_t reg, uint8_t val, nvr_t *nvr, local_t *local)
|
||||
{
|
||||
@@ -583,7 +567,6 @@ nvr_reg_common_write(uint16_t reg, uint8_t val, nvr_t *nvr, local_t *local)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This must be exposed because ACPI uses it. */
|
||||
void
|
||||
nvr_reg_write(uint16_t reg, uint8_t val, void *priv)
|
||||
@@ -651,7 +634,6 @@ nvr_reg_write(uint16_t reg, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Write to one of the NVR registers. */
|
||||
static void
|
||||
nvr_write(uint16_t addr, uint8_t val, void *priv)
|
||||
@@ -683,7 +665,6 @@ nvr_write(uint16_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Read from one of the NVR registers. */
|
||||
static uint8_t
|
||||
nvr_read(uint16_t addr, void *priv)
|
||||
@@ -698,7 +679,8 @@ nvr_read(uint16_t addr, void *priv)
|
||||
|
||||
if (local->bank[addr_id] == 0xff)
|
||||
ret = 0xff;
|
||||
else if (addr & 1) switch(local->addr[addr_id]) {
|
||||
else if (addr & 1)
|
||||
switch (local->addr[addr_id]) {
|
||||
case RTC_REGA:
|
||||
ret = (nvr->regs[RTC_REGA] & 0x7f) | local->stat;
|
||||
break;
|
||||
@@ -808,7 +790,8 @@ nvr_read(uint16_t addr, void *priv)
|
||||
default:
|
||||
ret = nvr->regs[local->addr[addr_id]];
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ret = local->addr[addr_id];
|
||||
if (!local->read_addr)
|
||||
ret &= 0x80;
|
||||
@@ -819,7 +802,6 @@ nvr_read(uint16_t addr, void *priv)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
/* Secondary NVR write - used by SMC. */
|
||||
static void
|
||||
nvr_sec_write(uint16_t addr, uint8_t val, void *priv)
|
||||
@@ -827,7 +809,6 @@ nvr_sec_write(uint16_t addr, uint8_t val, void *priv)
|
||||
nvr_write(0x72 + (addr & 1), val, priv);
|
||||
}
|
||||
|
||||
|
||||
/* Secondary NVR read - used by SMC. */
|
||||
static uint8_t
|
||||
nvr_sec_read(uint16_t addr, void *priv)
|
||||
@@ -835,7 +816,6 @@ nvr_sec_read(uint16_t addr, void *priv)
|
||||
return nvr_read(0x72 + (addr & 1), priv);
|
||||
}
|
||||
|
||||
|
||||
/* Reset the RTC state to 1980/01/01 00:00. */
|
||||
static void
|
||||
nvr_reset(nvr_t *nvr)
|
||||
@@ -888,7 +868,6 @@ nvr_start(nvr_t *nvr)
|
||||
nvr->regs[RTC_REGB] = REGB_2412;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
nvr_at_speed_changed(void *priv)
|
||||
{
|
||||
@@ -905,7 +884,6 @@ nvr_at_speed_changed(void *priv)
|
||||
timer_set_delay_u64(&nvr->onesec_time, (10000ULL * TIMER_USEC));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nvr_at_handler(int set, uint16_t base, nvr_t *nvr)
|
||||
{
|
||||
@@ -913,7 +891,6 @@ nvr_at_handler(int set, uint16_t base, nvr_t *nvr)
|
||||
nvr_read, NULL, NULL, nvr_write, NULL, NULL, nvr);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nvr_at_sec_handler(int set, uint16_t base, nvr_t *nvr)
|
||||
{
|
||||
@@ -929,7 +906,6 @@ nvr_read_addr_set(int set, nvr_t *nvr)
|
||||
local->read_addr = set;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nvr_wp_set(int set, int h, nvr_t *nvr)
|
||||
{
|
||||
@@ -938,7 +914,6 @@ nvr_wp_set(int set, int h, nvr_t *nvr)
|
||||
local->wp[h] = set;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nvr_via_wp_set(int set, int reg, nvr_t *nvr)
|
||||
{
|
||||
@@ -950,7 +925,6 @@ nvr_via_wp_set(int set, int reg, nvr_t *nvr)
|
||||
local->wp_32 = set;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nvr_bank_set(int base, uint8_t bank, nvr_t *nvr)
|
||||
{
|
||||
@@ -959,7 +933,6 @@ nvr_bank_set(int base, uint8_t bank, nvr_t *nvr)
|
||||
local->bank[base] = bank;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nvr_lock_set(int base, int size, int lock, nvr_t *nvr)
|
||||
{
|
||||
@@ -970,14 +943,12 @@ nvr_lock_set(int base, int size, int lock, nvr_t *nvr)
|
||||
local->lock[base + i] = lock;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nvr_irq_set(int irq, nvr_t *nvr)
|
||||
{
|
||||
nvr->irq = irq;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
nvr_at_reset(void *priv)
|
||||
{
|
||||
@@ -988,7 +959,6 @@ nvr_at_reset(void *priv)
|
||||
nvr->regs[RTC_REGC] &= ~(REGC_PF | REGC_AF | REGC_UF | REGC_IRQF);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
nvr_at_init(const device_t *info)
|
||||
{
|
||||
@@ -997,7 +967,8 @@ nvr_at_init(const device_t *info)
|
||||
|
||||
/* Allocate an NVR for this machine. */
|
||||
nvr = (nvr_t *) malloc(sizeof(nvr_t));
|
||||
if (nvr == NULL) return(NULL);
|
||||
if (nvr == NULL)
|
||||
return (NULL);
|
||||
memset(nvr, 0x00, sizeof(nvr_t));
|
||||
|
||||
local = (local_t *) malloc(sizeof(local_t));
|
||||
@@ -1109,7 +1080,6 @@ nvr_at_init(const device_t *info)
|
||||
return (nvr);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
nvr_at_close(void *priv)
|
||||
{
|
||||
@@ -1225,8 +1195,11 @@ const device_t ps_no_nmi_nvr_device = {
|
||||
"ps1_nvr",
|
||||
DEVICE_PS2,
|
||||
10,
|
||||
nvr_at_init, nvr_at_close, nvr_at_reset,
|
||||
{ NULL }, nvr_at_speed_changed,
|
||||
nvr_at_init,
|
||||
nvr_at_close,
|
||||
nvr_at_reset,
|
||||
{ NULL },
|
||||
nvr_at_speed_changed,
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -1235,8 +1208,11 @@ const device_t amstrad_no_nmi_nvr_device = {
|
||||
"amstrad_nvr",
|
||||
DEVICE_ISA | DEVICE_AT,
|
||||
11,
|
||||
nvr_at_init, nvr_at_close, nvr_at_reset,
|
||||
{ NULL }, nvr_at_speed_changed,
|
||||
nvr_at_init,
|
||||
nvr_at_close,
|
||||
nvr_at_reset,
|
||||
{ NULL },
|
||||
nvr_at_speed_changed,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
#include <86box/nvr_ps2.h>
|
||||
#include <86box/rom.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
int addr;
|
||||
|
||||
@@ -59,7 +58,6 @@ typedef struct {
|
||||
char *fn;
|
||||
} ps2_nvr_t;
|
||||
|
||||
|
||||
static uint8_t
|
||||
ps2_nvr_read(uint16_t port, void *priv)
|
||||
{
|
||||
@@ -83,7 +81,6 @@ ps2_nvr_read(uint16_t port, void *priv)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ps2_nvr_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -104,7 +101,6 @@ ps2_nvr_write(uint16_t port, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
ps2_nvr_init(const device_t *info)
|
||||
{
|
||||
@@ -141,7 +137,6 @@ ps2_nvr_init(const device_t *info)
|
||||
return (nvr);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ps2_nvr_close(void *priv)
|
||||
{
|
||||
|
||||
85
src/pci.c
85
src/pci.c
@@ -35,7 +35,6 @@
|
||||
#include <86box/pci.h>
|
||||
#include <86box/keyboard.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t bus, id, type;
|
||||
uint8_t irq_routing[4];
|
||||
@@ -50,7 +49,6 @@ typedef struct {
|
||||
uint8_t irq_line;
|
||||
} pci_mirq_t;
|
||||
|
||||
|
||||
int pci_burst_time, agp_burst_time,
|
||||
pci_nonburst_time, agp_nonburst_time;
|
||||
|
||||
@@ -70,14 +68,11 @@ static int pci_type,
|
||||
pci_key;
|
||||
static int trc_reg = 0;
|
||||
|
||||
|
||||
static void pci_reset_regs(void);
|
||||
|
||||
|
||||
#ifdef ENABLE_PCI_LOG
|
||||
int pci_do_log = ENABLE_PCI_LOG;
|
||||
|
||||
|
||||
static void
|
||||
pci_log(const char *fmt, ...)
|
||||
{
|
||||
@@ -93,7 +88,6 @@ pci_log(const char *fmt, ...)
|
||||
# define pci_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
pci_clear_slot(int card)
|
||||
{
|
||||
@@ -112,7 +106,6 @@ pci_clear_slot(int card)
|
||||
pci_cards[card].priv = NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pci_relocate_slot(int type, int new_slot)
|
||||
{
|
||||
@@ -140,7 +133,6 @@ pci_relocate_slot(int type, int new_slot)
|
||||
pci_card_to_slot_mapping[0][new_slot] = mapping;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pci_cf8_write(uint16_t port, uint32_t val, void *priv)
|
||||
{
|
||||
@@ -152,15 +144,12 @@ pci_cf8_write(uint16_t port, uint32_t val, void *priv)
|
||||
pci_enable = (val >> 31) & 1;
|
||||
}
|
||||
|
||||
|
||||
static uint32_t
|
||||
pci_cf8_read(uint16_t port, void *priv)
|
||||
{
|
||||
return pci_index | (pci_func << 8) |
|
||||
(pci_card << 11) | (pci_bus << 16) | (pci_enable << 31);
|
||||
return pci_index | (pci_func << 8) | (pci_card << 11) | (pci_bus << 16) | (pci_enable << 31);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pci_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -170,7 +159,10 @@ pci_write(uint16_t port, uint8_t val, void *priv)
|
||||
pci_log("(%i) %03x write: %02X\n", pci_enable, port, val);
|
||||
|
||||
switch (port) {
|
||||
case 0xcfc: case 0xcfd: case 0xcfe: case 0xcff:
|
||||
case 0xcfc:
|
||||
case 0xcfd:
|
||||
case 0xcfe:
|
||||
case 0xcff:
|
||||
if (!pci_enable)
|
||||
return;
|
||||
|
||||
@@ -195,7 +187,6 @@ pci_write(uint16_t port, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pci_writew(uint16_t port, uint16_t val, void *priv)
|
||||
{
|
||||
@@ -205,7 +196,10 @@ pci_writew(uint16_t port, uint16_t val, void *priv)
|
||||
pci_log("(%i) %03x write: %02X\n", pci_enable, port, val);
|
||||
|
||||
switch (port) {
|
||||
case 0xcfc: case 0xcfd: case 0xcfe: case 0xcff:
|
||||
case 0xcfc:
|
||||
case 0xcfd:
|
||||
case 0xcfe:
|
||||
case 0xcff:
|
||||
if (!pci_enable)
|
||||
return;
|
||||
|
||||
@@ -231,7 +225,6 @@ pci_writew(uint16_t port, uint16_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pci_writel(uint16_t port, uint32_t val, void *priv)
|
||||
{
|
||||
@@ -241,7 +234,10 @@ pci_writel(uint16_t port, uint32_t val, void *priv)
|
||||
pci_log("(%i) %03x write: %02X\n", pci_enable, port, val);
|
||||
|
||||
switch (port) {
|
||||
case 0xcfc: case 0xcfd: case 0xcfe: case 0xcff:
|
||||
case 0xcfc:
|
||||
case 0xcfd:
|
||||
case 0xcfe:
|
||||
case 0xcff:
|
||||
if (!pci_enable)
|
||||
return;
|
||||
|
||||
@@ -269,7 +265,6 @@ pci_writel(uint16_t port, uint32_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
pci_read(uint16_t port, void *priv)
|
||||
{
|
||||
@@ -280,7 +275,10 @@ pci_read(uint16_t port, void *priv)
|
||||
pci_log("(%i) %03x read\n", pci_enable, port);
|
||||
|
||||
switch (port) {
|
||||
case 0xcfc: case 0xcfd: case 0xcfe: case 0xcff:
|
||||
case 0xcfc:
|
||||
case 0xcfd:
|
||||
case 0xcfe:
|
||||
case 0xcff:
|
||||
if (!pci_enable)
|
||||
return 0xff;
|
||||
|
||||
@@ -304,7 +302,6 @@ pci_read(uint16_t port, void *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static uint16_t
|
||||
pci_readw(uint16_t port, void *priv)
|
||||
{
|
||||
@@ -315,7 +312,10 @@ pci_readw(uint16_t port, void *priv)
|
||||
pci_log("(%i) %03x read\n", pci_enable, port);
|
||||
|
||||
switch (port) {
|
||||
case 0xcfc: case 0xcfd: case 0xcfe: case 0xcff:
|
||||
case 0xcfc:
|
||||
case 0xcfd:
|
||||
case 0xcfe:
|
||||
case 0xcff:
|
||||
if (!pci_enable)
|
||||
return 0xff;
|
||||
|
||||
@@ -341,7 +341,6 @@ pci_readw(uint16_t port, void *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static uint32_t
|
||||
pci_readl(uint16_t port, void *priv)
|
||||
{
|
||||
@@ -352,7 +351,10 @@ pci_readl(uint16_t port, void *priv)
|
||||
pci_log("(%i) %03x read\n", pci_enable, port);
|
||||
|
||||
switch (port) {
|
||||
case 0xcfc: case 0xcfd: case 0xcfe: case 0xcff:
|
||||
case 0xcfc:
|
||||
case 0xcfd:
|
||||
case 0xcfe:
|
||||
case 0xcff:
|
||||
if (!pci_enable)
|
||||
return 0xff;
|
||||
|
||||
@@ -380,11 +382,9 @@ pci_readl(uint16_t port, void *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void pci_type2_write(uint16_t port, uint8_t val, void *priv);
|
||||
static uint8_t pci_type2_read(uint16_t port, void *priv);
|
||||
|
||||
|
||||
void
|
||||
pci_set_pmc(uint8_t pmc)
|
||||
{
|
||||
@@ -413,7 +413,6 @@ pci_set_pmc(uint8_t pmc)
|
||||
pci_pmc = (pmc & 0x01);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pci_type2_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -457,7 +456,6 @@ pci_type2_write(uint16_t port, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pci_type2_writel(uint16_t port, uint32_t val, void *priv)
|
||||
{
|
||||
@@ -471,7 +469,6 @@ pci_type2_writel(uint16_t port, uint32_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
pci_type2_read(uint16_t port, void *priv)
|
||||
{
|
||||
@@ -504,35 +501,30 @@ pci_type2_read(uint16_t port, void *priv)
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pci_set_irq_routing(int pci_int, int irq)
|
||||
{
|
||||
pci_irqs[pci_int - 1] = irq;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pci_set_irq_level(int pci_int, int level)
|
||||
{
|
||||
pci_irq_level[pci_int - 1] = !!level;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pci_enable_mirq(int mirq)
|
||||
{
|
||||
pci_mirqs[mirq].enabled = 1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pci_set_mirq_routing(int mirq, int irq)
|
||||
{
|
||||
pci_mirqs[mirq].irq_line = irq;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pci_set_mirq(uint8_t mirq, int level)
|
||||
{
|
||||
@@ -588,7 +580,6 @@ pci_set_mirq(uint8_t mirq, int level)
|
||||
pci_log("pci_set_mirq(%02X): Edge-triggered interrupt, not marking\n", mirq);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pci_set_irq(uint8_t card, uint8_t pci_int)
|
||||
{
|
||||
@@ -662,7 +653,6 @@ pci_set_irq(uint8_t card, uint8_t pci_int)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pci_clear_mirq(uint8_t mirq, int level)
|
||||
{
|
||||
@@ -715,7 +705,6 @@ pci_clear_mirq(uint8_t mirq, int level)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pci_clear_irq(uint8_t card, uint8_t pci_int)
|
||||
{
|
||||
@@ -782,14 +771,12 @@ pci_clear_irq(uint8_t card, uint8_t pci_int)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
pci_get_int(uint8_t slot, uint8_t pci_int)
|
||||
{
|
||||
return pci_cards[slot].irq_routing[pci_int - PCI_INTA];
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pci_reset_regs(void)
|
||||
{
|
||||
@@ -800,7 +787,6 @@ pci_reset_regs(void)
|
||||
pci_type2_write, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pci_pic_reset(void)
|
||||
{
|
||||
@@ -808,7 +794,6 @@ pci_pic_reset(void)
|
||||
pic_set_pci_flag(last_pci_card > 0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pci_reset_hard(void)
|
||||
{
|
||||
@@ -827,7 +812,6 @@ pci_reset_hard(void)
|
||||
pci_pic_reset();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pci_reset(void)
|
||||
{
|
||||
@@ -847,7 +831,6 @@ pci_reset(void)
|
||||
pci_reset_hard();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pci_slots_clear(void)
|
||||
{
|
||||
@@ -869,28 +852,24 @@ pci_slots_clear(void)
|
||||
pci_bus_number_to_index_mapping[0] = 0; /* always map bus 0 to index 0 */
|
||||
}
|
||||
|
||||
|
||||
uint32_t
|
||||
trc_readl(uint16_t port, void *priv)
|
||||
{
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
|
||||
uint16_t
|
||||
trc_readw(uint16_t port, void *priv)
|
||||
{
|
||||
return 0xffff;
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
trc_read(uint16_t port, void *priv)
|
||||
{
|
||||
return trc_reg & 0xfb;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
trc_reset(uint8_t val)
|
||||
{
|
||||
@@ -914,19 +893,16 @@ trc_reset(uint8_t val)
|
||||
resetx86();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
trc_writel(uint16_t port, uint32_t val, void *priv)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
trc_writew(uint16_t port, uint16_t val, void *priv)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
trc_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -941,7 +917,6 @@ trc_write(uint16_t port, uint8_t val, void *priv)
|
||||
trc_reg &= 0xfb;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
trc_init(void)
|
||||
{
|
||||
@@ -951,7 +926,6 @@ trc_init(void)
|
||||
trc_read, trc_readw, trc_readl, trc_write, trc_writew, trc_writel, NULL);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pci_init(int type)
|
||||
{
|
||||
@@ -1008,14 +982,12 @@ pci_init(int type)
|
||||
pic_set_pci_flag(1);
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
pci_register_bus()
|
||||
{
|
||||
return last_pci_bus++;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pci_remap_bus(uint8_t bus_index, uint8_t bus_number)
|
||||
{
|
||||
@@ -1029,14 +1001,12 @@ pci_remap_bus(uint8_t bus_index, uint8_t bus_number)
|
||||
pci_bus_number_to_index_mapping[bus_number] = bus_index;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pci_register_slot(int card, int type, int inta, int intb, int intc, int intd)
|
||||
{
|
||||
pci_register_bus_slot(0, card, type, inta, intb, intc, intd);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pci_register_bus_slot(int bus, int card, int type, int inta, int intb, int intc, int intd)
|
||||
{
|
||||
@@ -1061,7 +1031,6 @@ pci_register_bus_slot(int bus, int card, int type, int inta, int intb, int intc,
|
||||
last_pci_card++;
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
pci_find_slot(uint8_t add_type, uint8_t ignore_slot)
|
||||
{
|
||||
@@ -1078,8 +1047,7 @@ pci_find_slot(uint8_t add_type, uint8_t ignore_slot)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (((dev->type == PCI_CARD_NORMAL) && ((add_type & 0x7f) >= PCI_ADD_NORMAL)) ||
|
||||
(dev->type == (add_type & 0x7f))) {
|
||||
if (((dev->type == PCI_CARD_NORMAL) && ((add_type & 0x7f) >= PCI_ADD_NORMAL)) || (dev->type == (add_type & 0x7f))) {
|
||||
ret = i;
|
||||
break;
|
||||
}
|
||||
@@ -1090,7 +1058,6 @@ pci_find_slot(uint8_t add_type, uint8_t ignore_slot)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
pci_add_card(uint8_t add_type, uint8_t (*read)(int func, int addr, void *priv), void (*write)(int func, int addr, uint8_t val, void *priv), void *priv)
|
||||
{
|
||||
|
||||
@@ -15,25 +15,22 @@ static bar_t pci_bar[2];
|
||||
static uint8_t interrupt_on = 0x00;
|
||||
static uint8_t card = 0;
|
||||
|
||||
static void pci_dummy_interrupt(int set)
|
||||
{
|
||||
if (set)
|
||||
static void
|
||||
pci_dummy_interrupt(int set)
|
||||
{
|
||||
if (set) {
|
||||
pci_set_irq(card, pci_regs[0x3D]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
pci_clear_irq(card, pci_regs[0x3D]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t pci_dummy_read(uint16_t Port, void *p)
|
||||
static uint8_t
|
||||
pci_dummy_read(uint16_t Port, void *p)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
|
||||
switch(Port & 0x20)
|
||||
{
|
||||
switch (Port & 0x20) {
|
||||
case 0x00:
|
||||
return 0x1A;
|
||||
case 0x01:
|
||||
@@ -48,8 +45,7 @@ static uint8_t pci_dummy_read(uint16_t Port, void *p)
|
||||
return pci_regs[0x3D];
|
||||
case 0x06:
|
||||
ret = interrupt_on;
|
||||
if (interrupt_on)
|
||||
{
|
||||
if (interrupt_on) {
|
||||
pci_dummy_interrupt(0);
|
||||
interrupt_on = 0;
|
||||
}
|
||||
@@ -59,25 +55,24 @@ static uint8_t pci_dummy_read(uint16_t Port, void *p)
|
||||
}
|
||||
}
|
||||
|
||||
static uint16_t pci_dummy_readw(uint16_t Port, void *p)
|
||||
static uint16_t
|
||||
pci_dummy_readw(uint16_t Port, void *p)
|
||||
{
|
||||
return pci_dummy_read(Port, p);
|
||||
}
|
||||
|
||||
|
||||
static uint32_t pci_dummy_readl(uint16_t Port, void *p)
|
||||
static uint32_t
|
||||
pci_dummy_readl(uint16_t Port, void *p)
|
||||
{
|
||||
return pci_dummy_read(Port, p);
|
||||
}
|
||||
|
||||
|
||||
static void pci_dummy_write(uint16_t Port, uint8_t Val, void *p)
|
||||
{
|
||||
switch(Port & 0x20)
|
||||
static void
|
||||
pci_dummy_write(uint16_t Port, uint8_t Val, void *p)
|
||||
{
|
||||
switch (Port & 0x20) {
|
||||
case 0x06:
|
||||
if (!interrupt_on)
|
||||
{
|
||||
if (!interrupt_on) {
|
||||
interrupt_on = 1;
|
||||
pci_dummy_interrupt(1);
|
||||
}
|
||||
@@ -87,29 +82,32 @@ static void pci_dummy_write(uint16_t Port, uint8_t Val, void *p)
|
||||
}
|
||||
}
|
||||
|
||||
static void pci_dummy_writew(uint16_t Port, uint16_t Val, void *p)
|
||||
static void
|
||||
pci_dummy_writew(uint16_t Port, uint16_t Val, void *p)
|
||||
{
|
||||
pci_dummy_write(Port, Val & 0xFF, p);
|
||||
}
|
||||
|
||||
static void pci_dummy_writel(uint16_t Port, uint32_t Val, void *p)
|
||||
static void
|
||||
pci_dummy_writel(uint16_t Port, uint32_t Val, void *p)
|
||||
{
|
||||
pci_dummy_write(Port, Val & 0xFF, p);
|
||||
}
|
||||
|
||||
|
||||
static void pci_dummy_io_remove(void)
|
||||
static void
|
||||
pci_dummy_io_remove(void)
|
||||
{
|
||||
io_removehandler(pci_bar[0].addr, 0x0020, pci_dummy_read, pci_dummy_readw, pci_dummy_readl, pci_dummy_write, pci_dummy_writew, pci_dummy_writel, NULL);
|
||||
}
|
||||
|
||||
static void pci_dummy_io_set(void)
|
||||
static void
|
||||
pci_dummy_io_set(void)
|
||||
{
|
||||
io_sethandler(pci_bar[0].addr, 0x0020, pci_dummy_read, pci_dummy_readw, pci_dummy_readl, pci_dummy_write, pci_dummy_writew, pci_dummy_writel, NULL);
|
||||
}
|
||||
|
||||
|
||||
static uint8_t pci_dummy_pci_read(int func, int addr, void *priv)
|
||||
static uint8_t
|
||||
pci_dummy_pci_read(int func, int addr, void *priv)
|
||||
{
|
||||
pclog("AB0B:071A: PCI_Read(%d, %04x)\n", func, addr);
|
||||
|
||||
@@ -173,7 +171,8 @@ static uint8_t pci_dummy_pci_read(int func, int addr, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
static void pci_dummy_pci_write(int func, int addr, uint8_t val, void *priv)
|
||||
static void
|
||||
pci_dummy_pci_write(int func, int addr, uint8_t val, void *priv)
|
||||
{
|
||||
uint8_t valxor;
|
||||
|
||||
@@ -182,11 +181,9 @@ static void pci_dummy_pci_write(int func, int addr, uint8_t val, void *priv)
|
||||
switch (addr) {
|
||||
case 0x04: /* PCI_COMMAND_LO */
|
||||
valxor = (val & 0x03) ^ pci_regs[addr];
|
||||
if (valxor & PCI_COMMAND_IO)
|
||||
{
|
||||
if (valxor & PCI_COMMAND_IO) {
|
||||
pci_dummy_io_remove();
|
||||
if (((pci_bar[0].addr & 0xffe0) != 0) && (val & PCI_COMMAND_IO))
|
||||
{
|
||||
if (((pci_bar[0].addr & 0xffe0) != 0) && (val & PCI_COMMAND_IO)) {
|
||||
pci_dummy_io_set();
|
||||
}
|
||||
}
|
||||
@@ -214,10 +211,8 @@ static void pci_dummy_pci_write(int func, int addr, uint8_t val, void *priv)
|
||||
pclog("AB0B:071A: PCI: new I/O base is %04X\n", pci_bar[0].addr);
|
||||
|
||||
/* We're done, so get out of the here. */
|
||||
if (pci_regs[4] & PCI_COMMAND_IO)
|
||||
{
|
||||
if ((pci_bar[0].addr) != 0)
|
||||
{
|
||||
if (pci_regs[4] & PCI_COMMAND_IO) {
|
||||
if ((pci_bar[0].addr) != 0) {
|
||||
pci_dummy_io_set();
|
||||
}
|
||||
}
|
||||
@@ -230,8 +225,8 @@ static void pci_dummy_pci_write(int func, int addr, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void pci_dummy_init(void)
|
||||
void
|
||||
pci_dummy_init(void)
|
||||
{
|
||||
card = pci_add_card(PCI_ADD_NORMAL, pci_dummy_pci_read, pci_dummy_pci_write, NULL);
|
||||
|
||||
|
||||
49
src/pic.c
49
src/pic.c
@@ -36,19 +36,15 @@
|
||||
#include <86box/nvr.h>
|
||||
#include <86box/acpi.h>
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
STATE_NONE = 0,
|
||||
STATE_ICW2,
|
||||
STATE_ICW3,
|
||||
STATE_ICW4
|
||||
};
|
||||
|
||||
|
||||
pic_t pic, pic2;
|
||||
|
||||
|
||||
static pc_timer_t pic_timer;
|
||||
|
||||
static int shadow = 0, elcr_enabled = 0,
|
||||
@@ -60,11 +56,9 @@ static uint16_t smi_irq_mask = 0x0000,
|
||||
|
||||
static void (*update_pending)(void);
|
||||
|
||||
|
||||
#ifdef ENABLE_PIC_LOG
|
||||
int pic_do_log = ENABLE_PIC_LOG;
|
||||
|
||||
|
||||
static void
|
||||
pic_log(const char *fmt, ...)
|
||||
{
|
||||
@@ -80,14 +74,12 @@ pic_log(const char *fmt, ...)
|
||||
# define pic_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
pic_reset_smi_irq_mask(void)
|
||||
{
|
||||
smi_irq_mask = 0x0000;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pic_set_smi_irq_mask(int irq, int set)
|
||||
{
|
||||
@@ -105,7 +97,6 @@ pic_get_smi_irq_status(void)
|
||||
return smi_irq_status;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pic_clear_smi_irq_status(int irq)
|
||||
{
|
||||
@@ -113,7 +104,6 @@ pic_clear_smi_irq_status(int irq)
|
||||
smi_irq_status &= ~(1 << irq);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pic_elcr_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -140,7 +130,6 @@ pic_elcr_write(uint16_t port, uint8_t val, void *priv)
|
||||
(val & 0x80) ? 'L' : 'E');
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
pic_elcr_read(uint16_t port, void *priv)
|
||||
{
|
||||
@@ -151,21 +140,18 @@ pic_elcr_read(uint16_t port, void *priv)
|
||||
return dev->elcr;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
pic_elcr_get_enabled(void)
|
||||
{
|
||||
return elcr_enabled;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pic_elcr_set_enabled(int enabled)
|
||||
{
|
||||
elcr_enabled = enabled;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pic_elcr_io_handler(int set)
|
||||
{
|
||||
@@ -177,24 +163,20 @@ pic_elcr_io_handler(int set)
|
||||
pic_elcr_write, NULL, NULL, &pic2);
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
pic_cascade_mode(pic_t *dev)
|
||||
{
|
||||
return !(dev->icw1 & 2);
|
||||
}
|
||||
|
||||
|
||||
static __inline uint8_t
|
||||
pic_slave_on(pic_t *dev, int channel)
|
||||
{
|
||||
pic_log("pic_slave_on(%i): %i, %02X, %02X\n", channel, pic_cascade_mode(dev), dev->icw4 & 0x0c, dev->icw3 & (1 << channel));
|
||||
|
||||
return pic_cascade_mode(dev) && (dev->is_master || ((dev->icw4 & 0x0c) == 0x0c)) &&
|
||||
(dev->icw3 & (1 << channel));
|
||||
return pic_cascade_mode(dev) && (dev->is_master || ((dev->icw4 & 0x0c) == 0x0c)) && (dev->icw3 & (1 << channel));
|
||||
}
|
||||
|
||||
|
||||
static __inline int
|
||||
find_best_interrupt(pic_t *dev)
|
||||
{
|
||||
@@ -228,7 +210,6 @@ find_best_interrupt(pic_t *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static __inline void
|
||||
pic_update_pending_xt(void)
|
||||
{
|
||||
@@ -240,7 +221,6 @@ pic_update_pending_xt(void)
|
||||
pic.int_pending = 0;
|
||||
}
|
||||
|
||||
|
||||
static __inline void
|
||||
pic_update_pending_at(void)
|
||||
{
|
||||
@@ -254,7 +234,6 @@ pic_update_pending_at(void)
|
||||
pic.int_pending = (find_best_interrupt(&pic) != -1);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pic_callback(void *priv)
|
||||
{
|
||||
@@ -267,7 +246,6 @@ pic_callback(void *priv)
|
||||
timer_on_auto(&pic_timer, 0.35);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pic_reset()
|
||||
{
|
||||
@@ -298,21 +276,18 @@ pic_reset()
|
||||
pic_pci = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pic_set_shadow(int sh)
|
||||
{
|
||||
shadow = sh;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pic_set_pci_flag(int pci)
|
||||
{
|
||||
pic_pci = pci;
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
pic_level_triggered(pic_t *dev, int irq)
|
||||
{
|
||||
@@ -322,14 +297,12 @@ pic_level_triggered(pic_t *dev, int irq)
|
||||
return !!(dev->icw1 & 8);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
picint_is_level(int irq)
|
||||
{
|
||||
return pic_level_triggered(((irq > 7) ? &pic2 : &pic), irq & 7);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pic_acknowledge(pic_t *dev)
|
||||
{
|
||||
@@ -341,7 +314,6 @@ pic_acknowledge(pic_t *dev)
|
||||
dev->irr &= ~pic_int_num;
|
||||
}
|
||||
|
||||
|
||||
/* Find IRQ for non-specific EOI (either by command or automatic) by finding the highest IRQ
|
||||
priority with ISR bit set, that is also not masked if the PIC is in special mask mode. */
|
||||
static uint8_t
|
||||
@@ -363,7 +335,6 @@ pic_non_specific_find(pic_t *dev)
|
||||
return irq;
|
||||
}
|
||||
|
||||
|
||||
/* Do the EOI and rotation, if either is requested, on the given IRQ. */
|
||||
static void
|
||||
pic_action(pic_t *dev, uint8_t irq, uint8_t eoi, uint8_t rotate)
|
||||
@@ -380,7 +351,6 @@ pic_action(pic_t *dev, uint8_t irq, uint8_t eoi, uint8_t rotate)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Automatic non-specific EOI. */
|
||||
static __inline void
|
||||
pic_auto_non_specific_eoi(pic_t *dev)
|
||||
@@ -394,7 +364,6 @@ pic_auto_non_specific_eoi(pic_t *dev)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Do the PIC command specified by bits 7-5 of the value written to the OCW2 register. */
|
||||
static void
|
||||
pic_command(pic_t *dev)
|
||||
@@ -412,7 +381,6 @@ pic_command(pic_t *dev)
|
||||
dev->auto_eoi_rotate = !!(dev->ocw2 & 0x80);
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
pic_read(uint16_t addr, void *priv)
|
||||
{
|
||||
@@ -464,7 +432,6 @@ pic_read(uint16_t addr, void *priv)
|
||||
return dev->data_bus;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pic_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -528,7 +495,6 @@ pic_write(uint16_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pic_set_pci(void)
|
||||
{
|
||||
@@ -545,7 +511,6 @@ pic_set_pci(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pic_init(void)
|
||||
{
|
||||
@@ -555,7 +520,6 @@ pic_init(void)
|
||||
io_sethandler(0x0020, 0x0002, pic_read, NULL, NULL, pic_write, NULL, NULL, &pic);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pic_init_pcjr(void)
|
||||
{
|
||||
@@ -565,7 +529,6 @@ pic_init_pcjr(void)
|
||||
io_sethandler(0x0020, 0x0008, pic_read, NULL, NULL, pic_write, NULL, NULL, &pic);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pic2_init(void)
|
||||
{
|
||||
@@ -573,7 +536,6 @@ pic2_init(void)
|
||||
pic.slaves[2] = &pic2;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
picint_common(uint16_t num, int level, int set)
|
||||
{
|
||||
@@ -645,35 +607,30 @@ picint_common(uint16_t num, int level, int set)
|
||||
update_pending();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
picint(uint16_t num)
|
||||
{
|
||||
picint_common(num, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
picintlevel(uint16_t num)
|
||||
{
|
||||
picint_common(num, 1, 1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
picintc(uint16_t num)
|
||||
{
|
||||
picint_common(num, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
pic_i86_mode(pic_t *dev)
|
||||
{
|
||||
return !!(dev->icw4 & 1);
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
pic_irq_ack_read(pic_t *dev, int phase)
|
||||
{
|
||||
@@ -718,7 +675,6 @@ pic_irq_ack_read(pic_t *dev, int phase)
|
||||
return dev->data_bus;
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
pic_irq_ack(void)
|
||||
{
|
||||
@@ -750,7 +706,6 @@ pic_irq_ack(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
picinterrupt()
|
||||
{
|
||||
|
||||
64
src/pit.c
64
src/pit.c
@@ -58,20 +58,16 @@ uint64_t PITCONST, ISACONST,
|
||||
int refresh_at_enable = 1,
|
||||
io_delay = 5;
|
||||
|
||||
|
||||
int64_t firsttime = 1;
|
||||
|
||||
|
||||
#define PIT_PS2 16 /* The PIT is the PS/2's second PIT. */
|
||||
#define PIT_EXT_IO 32 /* The PIT has externally specified port I/O. */
|
||||
#define PIT_CUSTOM_CLOCK 64 /* The PIT uses custom clock inputs provided by another provider. */
|
||||
#define PIT_SECONDARY 128 /* The PIT is secondary (ports 0048-004B). */
|
||||
|
||||
|
||||
#ifdef ENABLE_PIT_LOG
|
||||
int pit_do_log = ENABLE_PIT_LOG;
|
||||
|
||||
|
||||
static void
|
||||
pit_log(const char *fmt, ...)
|
||||
{
|
||||
@@ -87,7 +83,6 @@ pit_log(const char *fmt, ...)
|
||||
# define pit_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
ctr_set_out(ctr_t *ctr, int out)
|
||||
{
|
||||
@@ -99,7 +94,6 @@ ctr_set_out(ctr_t *ctr, int out)
|
||||
ctr->out = out;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ctr_decrease_count(ctr_t *ctr)
|
||||
{
|
||||
@@ -127,7 +121,6 @@ ctr_decrease_count(ctr_t *ctr)
|
||||
ctr->count = (ctr->count - 1) & 0xffff;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ctr_load_count(ctr_t *ctr)
|
||||
{
|
||||
@@ -139,7 +132,6 @@ ctr_load_count(ctr_t *ctr)
|
||||
ctr->newcount = !!(l & 1);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ctr_tick(ctr_t *ctr)
|
||||
{
|
||||
@@ -194,7 +186,8 @@ ctr_tick(ctr_t *ctr)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2: case 6:
|
||||
case 2:
|
||||
case 6:
|
||||
/* Rate generator */
|
||||
switch (state) {
|
||||
case 3:
|
||||
@@ -215,7 +208,8 @@ ctr_tick(ctr_t *ctr)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3: case 7:
|
||||
case 3:
|
||||
case 7:
|
||||
/* Square wave mode */
|
||||
switch (state) {
|
||||
case 2:
|
||||
@@ -257,7 +251,8 @@ ctr_tick(ctr_t *ctr)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4: case 5:
|
||||
case 4:
|
||||
case 5:
|
||||
/* Software triggered strobe */
|
||||
/* Hardware triggered strobe */
|
||||
if ((ctr->gate != 0) || (ctr->m != 4)) {
|
||||
@@ -286,7 +281,6 @@ ctr_tick(ctr_t *ctr)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ctr_clock(void *data, int counter_id)
|
||||
{
|
||||
@@ -303,7 +297,6 @@ ctr_clock(void *data, int counter_id)
|
||||
ctr_tick(ctr);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ctr_set_state_1(ctr_t *ctr)
|
||||
{
|
||||
@@ -313,7 +306,6 @@ ctr_set_state_1(ctr_t *ctr)
|
||||
ctr->state = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ctr_load(ctr_t *ctr)
|
||||
{
|
||||
@@ -337,7 +329,6 @@ ctr_load(ctr_t *ctr)
|
||||
pit_log("Counter loaded, state = %i, gate = %i\n", ctr->state, ctr->gate);
|
||||
}
|
||||
|
||||
|
||||
static __inline void
|
||||
ctr_latch_status(ctr_t *ctr)
|
||||
{
|
||||
@@ -345,7 +336,6 @@ ctr_latch_status(ctr_t *ctr)
|
||||
ctr->do_read_status = 1;
|
||||
}
|
||||
|
||||
|
||||
static __inline void
|
||||
ctr_latch_count(ctr_t *ctr)
|
||||
{
|
||||
@@ -375,7 +365,6 @@ ctr_latch_count(ctr_t *ctr)
|
||||
pit_log("latched counter = %04X\n", ctr->rl & 0xffff);
|
||||
}
|
||||
|
||||
|
||||
uint16_t
|
||||
pit_ctr_get_count(void *data, int counter_id)
|
||||
{
|
||||
@@ -385,7 +374,6 @@ pit_ctr_get_count(void *data, int counter_id)
|
||||
return (uint16_t) ctr->l;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pit_ctr_set_load_func(void *data, int counter_id, void (*func)(uint8_t new_m, int new_count))
|
||||
{
|
||||
@@ -398,7 +386,6 @@ pit_ctr_set_load_func(void *data, int counter_id, void (*func)(uint8_t new_m, in
|
||||
ctr->load_func = func;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pit_ctr_set_out_func(void *data, int counter_id, void (*func)(int new_out, int old_out))
|
||||
{
|
||||
@@ -411,7 +398,6 @@ pit_ctr_set_out_func(void *data, int counter_id, void (*func)(int new_out, int o
|
||||
ctr->out_func = func;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pit_ctr_set_gate(void *data, int counter_id, int gate)
|
||||
{
|
||||
@@ -424,7 +410,12 @@ pit_ctr_set_gate(void *data, int counter_id, int gate)
|
||||
ctr->gate = gate;
|
||||
|
||||
switch (mode) {
|
||||
case 1: case 2: case 3: case 5: case 6: case 7:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
if (!old && gate) {
|
||||
/* Here we handle the rising edges. */
|
||||
if (mode & 1) {
|
||||
@@ -442,7 +433,6 @@ pit_ctr_set_gate(void *data, int counter_id, int gate)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static __inline void
|
||||
pit_ctr_set_clock_common(ctr_t *ctr, int clock)
|
||||
{
|
||||
@@ -471,14 +461,12 @@ pit_ctr_set_clock_common(ctr_t *ctr, int clock)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pit_ctr_set_clock(ctr_t *ctr, int clock)
|
||||
{
|
||||
pit_ctr_set_clock_common(ctr, clock);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pit_ctr_set_using_timer(void *data, int counter_id, int using_timer)
|
||||
{
|
||||
@@ -489,7 +477,6 @@ pit_ctr_set_using_timer(void *data, int counter_id, int using_timer)
|
||||
ctr->using_timer = using_timer;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pit_timer_over(void *p)
|
||||
{
|
||||
@@ -504,7 +491,6 @@ pit_timer_over(void *p)
|
||||
timer_advance_u64(&dev->callback_timer, PITCONST >> 1ULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pit_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -588,7 +574,8 @@ pit_write(uint16_t addr, uint8_t val, void *priv)
|
||||
ctr_set_out(ctr, 0);
|
||||
ctr_load(ctr);
|
||||
break;
|
||||
case 3: case 0x83:
|
||||
case 3:
|
||||
case 0x83:
|
||||
if (ctr->wm & 0x80) {
|
||||
ctr->l = (ctr->l & 0x00ff) | (val << 8);
|
||||
pit_log("PIT %i: Written high byte %02X, latch now %04X\n", t, val, ctr->l);
|
||||
@@ -612,7 +599,6 @@ pit_write(uint16_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
pit_read(uint16_t addr, void *priv)
|
||||
{
|
||||
@@ -649,8 +635,10 @@ pit_read(uint16_t addr, void *priv)
|
||||
ctr->rm |= 0x80;
|
||||
|
||||
ctr->latched--;
|
||||
} else switch (ctr->rm) {
|
||||
case 0: case 0x80:
|
||||
} else
|
||||
switch (ctr->rm) {
|
||||
case 0:
|
||||
case 0x80:
|
||||
ret = 0x00;
|
||||
break;
|
||||
|
||||
@@ -662,7 +650,8 @@ pit_read(uint16_t addr, void *priv)
|
||||
ret = count >> 8;
|
||||
break;
|
||||
|
||||
case 3: case 0x83:
|
||||
case 3:
|
||||
case 0x83:
|
||||
/* Yes, wm is correct here - this is to ensure correct readout while the
|
||||
count is being written. */
|
||||
if (ctr->wm & 0x80)
|
||||
@@ -684,7 +673,6 @@ pit_read(uint16_t addr, void *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pit_irq0_timer_ps2(int new_out, int old_out)
|
||||
{
|
||||
@@ -700,7 +688,6 @@ pit_irq0_timer_ps2(int new_out, int old_out)
|
||||
pit_devs[1].ctr_clock(pit_devs[1].data, 0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pit_refresh_timer_xt(int new_out, int old_out)
|
||||
{
|
||||
@@ -708,7 +695,6 @@ pit_refresh_timer_xt(int new_out, int old_out)
|
||||
dma_channel_read(0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pit_refresh_timer_at(int new_out, int old_out)
|
||||
{
|
||||
@@ -716,7 +702,6 @@ pit_refresh_timer_at(int new_out, int old_out)
|
||||
ppi.pb ^= 0x10;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pit_speaker_timer(int new_out, int old_out)
|
||||
{
|
||||
@@ -737,7 +722,6 @@ pit_speaker_timer(int new_out, int old_out)
|
||||
ppispeakon = new_out;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pit_nmi_timer_ps2(int new_out, int old_out)
|
||||
{
|
||||
@@ -747,7 +731,6 @@ pit_nmi_timer_ps2(int new_out, int old_out)
|
||||
nmi_auto_clear = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ctr_reset(ctr_t *ctr)
|
||||
{
|
||||
@@ -765,7 +748,6 @@ ctr_reset(ctr_t *ctr)
|
||||
ctr->l_det = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pit_reset(pit_t *dev)
|
||||
{
|
||||
@@ -782,14 +764,12 @@ pit_reset(pit_t *dev)
|
||||
dev->counters[2].gate = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pit_handler(int set, uint16_t base, int size, void *priv)
|
||||
{
|
||||
io_handler(set, base, size, pit_read, NULL, NULL, pit_write, NULL, NULL, priv);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pit_close(void *priv)
|
||||
{
|
||||
@@ -805,7 +785,6 @@ pit_close(void *priv)
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
pit_init(const device_t *info)
|
||||
{
|
||||
@@ -923,7 +902,6 @@ pit_common_init(int type, void (*out0)(int new_out, int old_out), void (*out1)(i
|
||||
pit = device_add(&i8254_fast_device);
|
||||
*pit_intf = pit_fast_intf;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
pit_intf->data = pit;
|
||||
@@ -943,7 +921,6 @@ pit_common_init(int type, void (*out0)(int new_out, int old_out), void (*out1)(i
|
||||
return pit;
|
||||
}
|
||||
|
||||
|
||||
pit_t *
|
||||
pit_ps2_init(int type)
|
||||
{
|
||||
@@ -980,7 +957,6 @@ pit_ps2_init(int type)
|
||||
return pit;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pit_set_clock(int clock)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <86box/video.h>
|
||||
#include <86box/port_6x.h>
|
||||
|
||||
|
||||
#define PS2_REFRESH_TIME (16 * TIMER_USEC)
|
||||
|
||||
#define PORT_6X_TURBO 1
|
||||
@@ -43,7 +42,6 @@
|
||||
#define PORT_6X_MIRROR 4
|
||||
#define PORT_6X_SWA 8
|
||||
|
||||
|
||||
static void
|
||||
port_6x_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -150,7 +148,6 @@ port_6x_refresh(void *priv)
|
||||
timer_advance_u64(&dev->refresh_timer, PS2_REFRESH_TIME);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
port_6x_close(void *priv)
|
||||
{
|
||||
@@ -161,7 +158,6 @@ port_6x_close(void *priv)
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
port_6x_init(const device_t *info)
|
||||
{
|
||||
|
||||
@@ -30,14 +30,12 @@
|
||||
#include <86box/pit.h>
|
||||
#include <86box/port_92.h>
|
||||
|
||||
|
||||
#define PORT_92_INV 1
|
||||
#define PORT_92_WORD 2
|
||||
#define PORT_92_PCI 4
|
||||
#define PORT_92_RESET 8
|
||||
#define PORT_92_A20 16
|
||||
|
||||
|
||||
static uint8_t
|
||||
port_92_readb(uint16_t port, void *priv)
|
||||
{
|
||||
@@ -47,8 +45,7 @@ port_92_readb(uint16_t port, void *priv)
|
||||
if (port == 0x92) {
|
||||
/* Return bit 1 directly from mem_a20_alt, so the
|
||||
pin can be reset independently of the device. */
|
||||
ret = (dev->reg & ~0x03) | (mem_a20_alt & 2) |
|
||||
(cpu_alt_reset & 1);
|
||||
ret = (dev->reg & ~0x03) | (mem_a20_alt & 2) | (cpu_alt_reset & 1);
|
||||
|
||||
if (dev->flags & PORT_92_INV)
|
||||
ret |= 0xfc;
|
||||
@@ -60,7 +57,6 @@ port_92_readb(uint16_t port, void *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static uint16_t
|
||||
port_92_readw(uint16_t port, void *priv)
|
||||
{
|
||||
@@ -73,7 +69,6 @@ port_92_readw(uint16_t port, void *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
port_92_pulse(void *priv)
|
||||
{
|
||||
@@ -81,7 +76,6 @@ port_92_pulse(void *priv)
|
||||
cpu_set_edx();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
port_92_writeb(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -108,7 +102,6 @@ port_92_writeb(uint16_t port, uint8_t val, void *priv)
|
||||
dev->reg |= 0xfc;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
port_92_writew(uint16_t port, uint16_t val, void *priv)
|
||||
{
|
||||
@@ -118,7 +111,6 @@ port_92_writew(uint16_t port, uint16_t val, void *priv)
|
||||
port_92_writeb(port, val & 0xff, priv);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
port_92_set_period(void *priv, uint64_t pulse_period)
|
||||
{
|
||||
@@ -127,7 +119,6 @@ port_92_set_period(void *priv, uint64_t pulse_period)
|
||||
dev->pulse_period = pulse_period;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
port_92_set_features(void *priv, int reset, int a20)
|
||||
{
|
||||
@@ -149,7 +140,6 @@ port_92_set_features(void *priv, int reset, int a20)
|
||||
mem_a20_recalc();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
port_92_add(void *priv)
|
||||
{
|
||||
@@ -163,7 +153,6 @@ port_92_add(void *priv)
|
||||
port_92_readb, NULL, NULL, port_92_writeb, NULL, NULL, dev);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
port_92_remove(void *priv)
|
||||
{
|
||||
@@ -177,7 +166,6 @@ port_92_remove(void *priv)
|
||||
port_92_readb, NULL, NULL, port_92_writeb, NULL, NULL, dev);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
port_92_close(void *priv)
|
||||
{
|
||||
@@ -188,7 +176,6 @@ port_92_close(void *priv)
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
port_92_init(const device_t *info)
|
||||
{
|
||||
|
||||
@@ -15,11 +15,9 @@
|
||||
#include <86box/pit.h>
|
||||
#include <86box/ppi.h>
|
||||
|
||||
|
||||
PPI ppi;
|
||||
int ppispeakon;
|
||||
|
||||
|
||||
void
|
||||
ppi_reset(void)
|
||||
{
|
||||
|
||||
28
src/random.c
28
src/random.c
@@ -24,8 +24,8 @@
|
||||
|
||||
uint32_t preconst = 0x6ED9EBA1;
|
||||
|
||||
|
||||
static __inline uint32_t rotl32c (uint32_t x, uint32_t n)
|
||||
static __inline uint32_t
|
||||
rotl32c(uint32_t x, uint32_t n)
|
||||
{
|
||||
#if 0
|
||||
assert (n<32);
|
||||
@@ -33,7 +33,8 @@ static __inline uint32_t rotl32c (uint32_t x, uint32_t n)
|
||||
return (x << n) | (x >> (-n & 31));
|
||||
}
|
||||
|
||||
static __inline uint32_t rotr32c (uint32_t x, uint32_t n)
|
||||
static __inline uint32_t
|
||||
rotr32c(uint32_t x, uint32_t n)
|
||||
{
|
||||
#if 0
|
||||
assert (n<32);
|
||||
@@ -45,7 +46,8 @@ static __inline uint32_t rotr32c (uint32_t x, uint32_t n)
|
||||
|
||||
#define ROTATE_RIGHT rotr32c
|
||||
|
||||
static __inline unsigned long long rdtsc(void)
|
||||
static __inline unsigned long long
|
||||
rdtsc(void)
|
||||
{
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
unsigned hi, lo;
|
||||
@@ -56,7 +58,8 @@ static __inline unsigned long long rdtsc(void)
|
||||
mov lo, eax
|
||||
}
|
||||
# else
|
||||
__asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
|
||||
__asm__ __volatile__("rdtsc"
|
||||
: "=a"(lo), "=d"(hi));
|
||||
# endif
|
||||
return ((unsigned long long) lo) | (((unsigned long long) hi) << 32);
|
||||
#else
|
||||
@@ -64,13 +67,14 @@ static __inline unsigned long long rdtsc(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint32_t RDTSC(void)
|
||||
static uint32_t
|
||||
RDTSC(void)
|
||||
{
|
||||
return (uint32_t) (rdtsc());
|
||||
}
|
||||
|
||||
|
||||
static void random_twist(uint32_t *val)
|
||||
static void
|
||||
random_twist(uint32_t *val)
|
||||
{
|
||||
*val = ROTATE_LEFT(*val, rand() % 32);
|
||||
*val ^= 0x5A827999;
|
||||
@@ -78,8 +82,8 @@ static void random_twist(uint32_t *val)
|
||||
*val ^= 0x4ED32706;
|
||||
}
|
||||
|
||||
|
||||
uint8_t random_generate(void)
|
||||
uint8_t
|
||||
random_generate(void)
|
||||
{
|
||||
uint16_t r = 0;
|
||||
r = (RDTSC() ^ ROTATE_LEFT(preconst, rand() % 32)) % 256;
|
||||
@@ -87,8 +91,8 @@ uint8_t random_generate(void)
|
||||
return (r & 0xff);
|
||||
}
|
||||
|
||||
|
||||
void random_init(void)
|
||||
void
|
||||
random_init(void)
|
||||
{
|
||||
uint32_t seed = RDTSC();
|
||||
srand(seed);
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
|
||||
struct event_cpp11_t
|
||||
{
|
||||
struct event_cpp11_t {
|
||||
std::condition_variable cond;
|
||||
std::mutex mutex;
|
||||
bool state = false;
|
||||
@@ -26,7 +25,8 @@ thread_create(void (*thread_rout)(void *param), void *param)
|
||||
int
|
||||
thread_wait(thread_t *arg)
|
||||
{
|
||||
if (!arg) return 0;
|
||||
if (!arg)
|
||||
return 0;
|
||||
auto thread = reinterpret_cast<std::thread *>(arg);
|
||||
thread->join();
|
||||
return 0;
|
||||
@@ -60,7 +60,6 @@ thread_wait_mutex(mutex_t *_mutex)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
thread_release_mutex(mutex_t *_mutex)
|
||||
{
|
||||
@@ -72,7 +71,6 @@ thread_release_mutex(mutex_t *_mutex)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
thread_close_mutex(mutex_t *_mutex)
|
||||
{
|
||||
@@ -135,5 +133,4 @@ thread_destroy_event(event_t *handle)
|
||||
auto event = reinterpret_cast<event_cpp11_t *>(handle);
|
||||
delete event;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
12
src/timer.c
12
src/timer.c
@@ -5,7 +5,6 @@
|
||||
#include <86box/86box.h>
|
||||
#include <86box/timer.h>
|
||||
|
||||
|
||||
uint64_t TIMER_USEC;
|
||||
uint32_t timer_target;
|
||||
|
||||
@@ -16,7 +15,6 @@ pc_timer_t *timer_head = NULL;
|
||||
/* Are we initialized? */
|
||||
int timer_inited = 0;
|
||||
|
||||
|
||||
void
|
||||
timer_enable(pc_timer_t *timer)
|
||||
{
|
||||
@@ -81,7 +79,6 @@ timer_enable(pc_timer_t *timer)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
timer_disable(pc_timer_t *timer)
|
||||
{
|
||||
@@ -102,7 +99,6 @@ timer_disable(pc_timer_t *timer)
|
||||
timer->prev = timer->next = NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
timer_process(void)
|
||||
{
|
||||
@@ -133,7 +129,6 @@ timer_process(void)
|
||||
timer_target = timer_head->ts.ts32.integer;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
timer_close(void)
|
||||
{
|
||||
@@ -153,7 +148,6 @@ timer_close(void)
|
||||
timer_inited = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
timer_init(void)
|
||||
{
|
||||
@@ -163,7 +157,6 @@ timer_init(void)
|
||||
timer_inited = 1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
timer_add(pc_timer_t *timer, void (*callback)(void *p), void *p, int start_timer)
|
||||
{
|
||||
@@ -177,7 +170,6 @@ timer_add(pc_timer_t *timer, void (*callback)(void *p), void *p, int start_timer
|
||||
timer_set_delay_u64(timer, 0);
|
||||
}
|
||||
|
||||
|
||||
/* The API for big timer periods starts here. */
|
||||
void
|
||||
timer_stop(pc_timer_t *timer)
|
||||
@@ -190,7 +182,6 @@ timer_stop(pc_timer_t *timer)
|
||||
timer->flags &= ~TIMER_SPLIT;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
timer_do_period(pc_timer_t *timer, uint64_t period, int start)
|
||||
{
|
||||
@@ -203,7 +194,6 @@ timer_do_period(pc_timer_t *timer, uint64_t period, int start)
|
||||
timer_advance_u64(timer, period);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
timer_advance_ex(pc_timer_t *timer, int start)
|
||||
{
|
||||
@@ -224,7 +214,6 @@ timer_advance_ex(pc_timer_t *timer, int start)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
timer_on(pc_timer_t *timer, double period, int start)
|
||||
{
|
||||
@@ -235,7 +224,6 @@ timer_on(pc_timer_t *timer, double period, int start)
|
||||
timer_advance_ex(timer, start);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
timer_on_auto(pc_timer_t *timer, double period)
|
||||
{
|
||||
|
||||
@@ -38,11 +38,9 @@
|
||||
# include <86box/io.h>
|
||||
# include <86box/timer.h>
|
||||
|
||||
|
||||
# ifdef ENABLE_UPI42_LOG
|
||||
int upi42_do_log = ENABLE_UPI42_LOG;
|
||||
|
||||
|
||||
void
|
||||
upi42_log(const char *fmt, ...)
|
||||
{
|
||||
@@ -1290,7 +1288,6 @@ upi42_write(uint16_t port, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
upi42_read(uint16_t port, void *priv)
|
||||
{
|
||||
@@ -1372,8 +1369,7 @@ upi42_read(uint16_t port, void *priv)
|
||||
|
||||
/* 0 = I, 1 = I Raise, 2 = TCNTI Raise, 3 = IRQ Mask, 4 = T0, 5 = T1, 6 = Flags, 7 = DBF. */
|
||||
case 0x0194:
|
||||
ret = (upi42->i & 0x01) || ((upi42->i_raise & 0x01) << 1) || ((upi42->tcnti_raise & 0x01) << 2) || ((upi42->irq_mask & 0x01) << 3) ||
|
||||
((upi42->t0 & 0x01) << 4) || ((upi42->t1 & 0x01) << 5) || ((upi42->flags & 0x01) << 6) || ((upi42->dbf & 0x01) << 7);
|
||||
ret = (upi42->i & 0x01) || ((upi42->i_raise & 0x01) << 1) || ((upi42->tcnti_raise & 0x01) << 2) || ((upi42->irq_mask & 0x01) << 3) || ((upi42->t0 & 0x01) << 4) || ((upi42->t1 & 0x01) << 5) || ((upi42->flags & 0x01) << 6) || ((upi42->dbf & 0x01) << 7);
|
||||
break;
|
||||
|
||||
/* 0 = Suspend. */
|
||||
|
||||
58
src/usb.c
58
src/usb.c
@@ -29,11 +29,9 @@
|
||||
#include <86box/usb.h>
|
||||
#include "cpu.h"
|
||||
|
||||
|
||||
#ifdef ENABLE_USB_LOG
|
||||
int usb_do_log = ENABLE_USB_LOG;
|
||||
|
||||
|
||||
static void
|
||||
usb_log(const char *fmt, ...)
|
||||
{
|
||||
@@ -49,7 +47,6 @@ usb_log(const char *fmt, ...)
|
||||
# define usb_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
static uint8_t
|
||||
uhci_reg_read(uint16_t addr, void *p)
|
||||
{
|
||||
@@ -63,7 +60,6 @@ uhci_reg_read(uint16_t addr, void *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
uhci_reg_write(uint16_t addr, uint8_t val, void *p)
|
||||
{
|
||||
@@ -82,7 +78,8 @@ uhci_reg_write(uint16_t addr, uint8_t val, void *p)
|
||||
case 0x09:
|
||||
regs[0x09] = (val & 0xf0);
|
||||
break;
|
||||
case 0x0a: case 0x0b:
|
||||
case 0x0a:
|
||||
case 0x0b:
|
||||
regs[addr] = val;
|
||||
break;
|
||||
case 0x0c:
|
||||
@@ -91,7 +88,6 @@ uhci_reg_write(uint16_t addr, uint8_t val, void *p)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
uhci_reg_writew(uint16_t addr, uint16_t val, void *p)
|
||||
{
|
||||
@@ -111,7 +107,8 @@ uhci_reg_writew(uint16_t addr, uint16_t val, void *p)
|
||||
case 0x06:
|
||||
regs[0x03] = (val & 0x07ff);
|
||||
break;
|
||||
case 0x10: case 0x12:
|
||||
case 0x10:
|
||||
case 0x12:
|
||||
regs[addr >> 1] = ((regs[addr >> 1] & 0xedbb) | (val & 0x1244)) & ~(val & 0x080a);
|
||||
break;
|
||||
default:
|
||||
@@ -121,7 +118,6 @@ uhci_reg_writew(uint16_t addr, uint16_t val, void *p)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
uhci_update_io_mapping(usb_t *dev, uint8_t base_l, uint8_t base_h, int enable)
|
||||
{
|
||||
@@ -135,7 +131,6 @@ uhci_update_io_mapping(usb_t *dev, uint8_t base_l, uint8_t base_h, int enable)
|
||||
io_sethandler(dev->uhci_io_base, 0x20, uhci_reg_read, NULL, NULL, uhci_reg_write, uhci_reg_writew, NULL, dev);
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
ohci_mmio_read(uint32_t addr, void *p)
|
||||
{
|
||||
@@ -152,7 +147,6 @@ ohci_mmio_read(uint32_t addr, void *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ohci_mmio_write(uint32_t addr, uint8_t val, void *p)
|
||||
{
|
||||
@@ -188,7 +182,8 @@ ohci_mmio_write(uint32_t addr, uint8_t val, void *p)
|
||||
case 0x0c:
|
||||
dev->ohci_mmio[addr] &= ~(val & 0x7f);
|
||||
return;
|
||||
case 0x0d: case 0x0e:
|
||||
case 0x0d:
|
||||
case 0x0e:
|
||||
return;
|
||||
case 0x0f:
|
||||
dev->ohci_mmio[addr] &= ~(val & 0x40);
|
||||
@@ -196,15 +191,22 @@ ohci_mmio_write(uint32_t addr, uint8_t val, void *p)
|
||||
case 0x3b:
|
||||
dev->ohci_mmio[addr] = (val & 0x80);
|
||||
return;
|
||||
case 0x39: case 0x41:
|
||||
case 0x39:
|
||||
case 0x41:
|
||||
dev->ohci_mmio[addr] = (val & 0x3f);
|
||||
return;
|
||||
case 0x45:
|
||||
dev->ohci_mmio[addr] = (val & 0x0f);
|
||||
return;
|
||||
case 0x3a:
|
||||
case 0x3e: case 0x3f: case 0x42: case 0x43:
|
||||
case 0x46: case 0x47: case 0x48: case 0x4a:
|
||||
case 0x3e:
|
||||
case 0x3f:
|
||||
case 0x42:
|
||||
case 0x43:
|
||||
case 0x46:
|
||||
case 0x47:
|
||||
case 0x48:
|
||||
case 0x4a:
|
||||
return;
|
||||
case 0x49:
|
||||
dev->ohci_mmio[addr] = (val & 0x1b);
|
||||
@@ -216,19 +218,22 @@ ohci_mmio_write(uint32_t addr, uint8_t val, void *p)
|
||||
case 0x4b:
|
||||
dev->ohci_mmio[addr] = (val & 0x03);
|
||||
return;
|
||||
case 0x4c: case 0x4e:
|
||||
case 0x4c:
|
||||
case 0x4e:
|
||||
dev->ohci_mmio[addr] = (val & 0x06);
|
||||
if ((addr == 0x4c) && !(val & 0x04)) {
|
||||
if (!(dev->ohci_mmio[0x58] & 0x01))
|
||||
dev->ohci_mmio[0x5a] |= 0x01;
|
||||
dev->ohci_mmio[0x58] |= 0x01;
|
||||
} if ((addr == 0x4c) && !(val & 0x02)) {
|
||||
}
|
||||
if ((addr == 0x4c) && !(val & 0x02)) {
|
||||
if (!(dev->ohci_mmio[0x54] & 0x01))
|
||||
dev->ohci_mmio[0x56] |= 0x01;
|
||||
dev->ohci_mmio[0x54] |= 0x01;
|
||||
}
|
||||
return;
|
||||
case 0x4d: case 0x4f:
|
||||
case 0x4d:
|
||||
case 0x4f:
|
||||
return;
|
||||
case 0x50:
|
||||
if (val & 0x01) {
|
||||
@@ -275,7 +280,8 @@ ohci_mmio_write(uint32_t addr, uint8_t val, void *p)
|
||||
if (val & 0x80)
|
||||
dev->ohci_mmio[0x51] &= ~0x80;
|
||||
return;
|
||||
case 0x54: case 0x58:
|
||||
case 0x54:
|
||||
case 0x58:
|
||||
old = dev->ohci_mmio[addr];
|
||||
|
||||
if (val & 0x10) {
|
||||
@@ -314,7 +320,8 @@ ohci_mmio_write(uint32_t addr, uint8_t val, void *p)
|
||||
dev->ohci_mmio[addr] &= ~0x01;
|
||||
dev->ohci_mmio[0x54] &= ~0x17;
|
||||
dev->ohci_mmio[0x56] &= ~0x17;
|
||||
} if ((val & 0x01) && ((dev->ohci_mmio[0x49] & 0x03) == 0x00) && (dev->ohci_mmio[0x4e] & 0x02)) {
|
||||
}
|
||||
if ((val & 0x01) && ((dev->ohci_mmio[0x49] & 0x03) == 0x00) && (dev->ohci_mmio[0x4e] & 0x02)) {
|
||||
dev->ohci_mmio[addr] |= 0x01;
|
||||
dev->ohci_mmio[0x58] &= ~0x17;
|
||||
dev->ohci_mmio[0x5a] &= ~0x17;
|
||||
@@ -326,17 +333,18 @@ ohci_mmio_write(uint32_t addr, uint8_t val, void *p)
|
||||
if ((val & 0x01) && ((dev->ohci_mmio[0x49] & 0x03) == 0x00) && (dev->ohci_mmio[0x4e] & 0x04))
|
||||
dev->ohci_mmio[addr] |= 0x01;
|
||||
return;
|
||||
case 0x56: case 0x5a:
|
||||
case 0x56:
|
||||
case 0x5a:
|
||||
dev->ohci_mmio[addr] &= ~(val & 0x1f);
|
||||
return;
|
||||
case 0x57: case 0x5b:
|
||||
case 0x57:
|
||||
case 0x5b:
|
||||
return;
|
||||
}
|
||||
|
||||
dev->ohci_mmio[addr] = val;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ohci_update_mem_mapping(usb_t *dev, uint8_t base1, uint8_t base2, uint8_t base3, int enable)
|
||||
{
|
||||
@@ -350,7 +358,6 @@ ohci_update_mem_mapping(usb_t *dev, uint8_t base1, uint8_t base2, uint8_t base3,
|
||||
mem_mapping_set_addr(&dev->ohci_mmio_mapping, dev->ohci_mem_base, 0x1000);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usb_reset(void *priv)
|
||||
{
|
||||
@@ -372,7 +379,6 @@ usb_reset(void *priv)
|
||||
dev->ohci_enable = 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usb_close(void *priv)
|
||||
{
|
||||
@@ -381,14 +387,14 @@ usb_close(void *priv)
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
usb_init(const device_t *info)
|
||||
{
|
||||
usb_t *dev;
|
||||
|
||||
dev = (usb_t *) malloc(sizeof(usb_t));
|
||||
if (dev == NULL) return(NULL);
|
||||
if (dev == NULL)
|
||||
return (NULL);
|
||||
memset(dev, 0x00, sizeof(usb_t));
|
||||
|
||||
memset(dev->uhci_io, 0x00, 128);
|
||||
|
||||
21
src/vnc.c
21
src/vnc.c
@@ -32,13 +32,11 @@
|
||||
#include <86box/ui.h>
|
||||
#include <86box/vnc.h>
|
||||
|
||||
|
||||
#define VNC_MIN_X 320
|
||||
#define VNC_MAX_X 2048
|
||||
#define VNC_MIN_Y 200
|
||||
#define VNC_MAX_Y 2048
|
||||
|
||||
|
||||
static rfbScreenInfoPtr rfb = NULL;
|
||||
static int clients;
|
||||
static int updatingSize;
|
||||
@@ -46,11 +44,9 @@ static int allowedX,
|
||||
allowedY;
|
||||
static int ptr_x, ptr_y, ptr_but;
|
||||
|
||||
|
||||
#ifdef ENABLE_VNC_LOG
|
||||
int vnc_do_log = ENABLE_VNC_LOG;
|
||||
|
||||
|
||||
static void
|
||||
vnc_log(const char *fmt, ...)
|
||||
{
|
||||
@@ -66,7 +62,6 @@ vnc_log(const char *fmt, ...)
|
||||
# define vnc_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
vnc_kbdevent(rfbBool down, rfbKeySym k, rfbClientPtr cl)
|
||||
{
|
||||
@@ -76,7 +71,6 @@ vnc_kbdevent(rfbBool down, rfbKeySym k, rfbClientPtr cl)
|
||||
vnc_kbinput(down ? 1 : 0, (int) k);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
vnc_ptrevent(int but, int x, int y, rfbClientPtr cl)
|
||||
{
|
||||
@@ -85,7 +79,8 @@ vnc_ptrevent(int but, int x, int y, rfbClientPtr cl)
|
||||
if (x != ptr_x || y != ptr_y) {
|
||||
mouse_x += (x - ptr_x) / 100;
|
||||
mouse_y += (y - ptr_y) / 100;
|
||||
ptr_x = x; ptr_y = y;
|
||||
ptr_x = x;
|
||||
ptr_y = y;
|
||||
}
|
||||
|
||||
if (but != ptr_but) {
|
||||
@@ -103,7 +98,6 @@ vnc_ptrevent(int but, int x, int y, rfbClientPtr cl)
|
||||
rfbDefaultPtrAddEvent(but, x, y, cl);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
vnc_clientgone(rfbClientPtr cl)
|
||||
{
|
||||
@@ -122,7 +116,6 @@ vnc_clientgone(rfbClientPtr cl)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static enum rfbNewClientAction
|
||||
vnc_newclient(rfbClientPtr cl)
|
||||
{
|
||||
@@ -150,7 +143,6 @@ vnc_newclient(rfbClientPtr cl)
|
||||
return (RFB_CLIENT_ACCEPT);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
vnc_display(rfbClientPtr cl)
|
||||
{
|
||||
@@ -165,7 +157,6 @@ vnc_display(rfbClientPtr cl)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
vnc_blit(int x, int y, int w, int h, int monitor_index)
|
||||
{
|
||||
@@ -193,7 +184,6 @@ vnc_blit(int x, int y, int w, int h, int monitor_index)
|
||||
rfbMarkRectAsModified(rfb, 0, 0, allowedX, allowedY);
|
||||
}
|
||||
|
||||
|
||||
/* Initialize VNC for operation. */
|
||||
int
|
||||
vnc_init(UNUSED(void *arg))
|
||||
@@ -251,7 +241,6 @@ vnc_init(UNUSED(void *arg))
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
vnc_close(void)
|
||||
{
|
||||
@@ -266,14 +255,14 @@ vnc_close(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
vnc_resize(int x, int y)
|
||||
{
|
||||
rfbClientIteratorPtr iterator;
|
||||
rfbClientPtr cl;
|
||||
|
||||
if (rfb == NULL) return;
|
||||
if (rfb == NULL)
|
||||
return;
|
||||
|
||||
/* TightVNC doesn't like certain sizes.. */
|
||||
if (x < VNC_MIN_X || x > VNC_MAX_X || y < VNC_MIN_Y || y > VNC_MAX_Y) {
|
||||
@@ -299,7 +288,6 @@ vnc_resize(int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Tell them to pause if we have no clients. */
|
||||
int
|
||||
vnc_pause(void)
|
||||
@@ -307,7 +295,6 @@ vnc_pause(void)
|
||||
return ((clients > 0) ? 0 : 1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
vnc_take_screenshot(wchar_t *fn)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#include <86box/plat.h>
|
||||
#include <86box/vnc.h>
|
||||
|
||||
|
||||
static int keysyms_00[] = {
|
||||
0x0000, /* 0x00 */
|
||||
0x0000,
|
||||
@@ -622,12 +621,10 @@ static int keysyms_ff[] = {
|
||||
0xe053 /* 0xff (XK_Delete) */
|
||||
};
|
||||
|
||||
|
||||
#ifdef ENABLE_VNC_KEYMAP_LOG
|
||||
int vnc_keymap_do_log = ENABLE_VNC_KEYMAP_LOG;
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
vnc_keymap_log(const char *format, ...)
|
||||
{
|
||||
@@ -642,7 +639,6 @@ vnc_keymap_log(const char *format, ...)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
vnc_kbinput(int down, int k)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user