More linting in src
This commit is contained in:
@@ -255,7 +255,7 @@ static void
|
||||
load_machine(void)
|
||||
{
|
||||
ini_section_t cat = ini_find_section(config, "Machine");
|
||||
char *p;
|
||||
const char *p;
|
||||
const char *migrate_from = NULL;
|
||||
int c;
|
||||
int i;
|
||||
|
||||
@@ -191,13 +191,13 @@ device_add_common(const device_t *dev, const device_t *cd, void *p, void *params
|
||||
return priv;
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
device_get_internal_name(const device_t *dev)
|
||||
{
|
||||
if (dev == NULL)
|
||||
return "";
|
||||
|
||||
return (char *) dev->internal_name;
|
||||
return dev->internal_name;
|
||||
}
|
||||
|
||||
void *
|
||||
|
||||
@@ -1271,8 +1271,6 @@ dma_sg(uint8_t *data, int transfer_length, int out, void *priv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
|
||||
66
src/fifo.c
66
src/fifo.c
@@ -49,7 +49,7 @@ fifo_log(const char *fmt, ...)
|
||||
int
|
||||
fifo_get_count(void *priv)
|
||||
{
|
||||
fifo_t *fifo = (fifo_t *) priv;
|
||||
const fifo_t *fifo = (fifo_t *) priv;
|
||||
int ret = fifo->len;
|
||||
|
||||
if (fifo->end == fifo->start)
|
||||
@@ -199,7 +199,7 @@ fifo_clear_overrun(void *priv)
|
||||
int
|
||||
fifo_get_full(void *priv)
|
||||
{
|
||||
fifo_t *fifo = (fifo_t *) priv;
|
||||
const fifo_t *fifo = (fifo_t *) priv;
|
||||
|
||||
return fifo->full;
|
||||
}
|
||||
@@ -211,13 +211,14 @@ fifo_get_d_full(void *priv)
|
||||
int ret = fifo->d_full;
|
||||
|
||||
fifo->d_full = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
fifo_get_empty(void *priv)
|
||||
{
|
||||
fifo_t *fifo = (fifo_t *) priv;
|
||||
const fifo_t *fifo = (fifo_t *) priv;
|
||||
|
||||
return fifo->empty;
|
||||
}
|
||||
@@ -229,13 +230,14 @@ fifo_get_d_empty(void *priv)
|
||||
int ret = fifo->d_empty;
|
||||
|
||||
fifo->d_empty = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
fifo_get_overrun(void *priv)
|
||||
{
|
||||
fifo_t *fifo = (fifo_t *) priv;
|
||||
const fifo_t *fifo = (fifo_t *) priv;
|
||||
|
||||
return fifo->overrun;
|
||||
}
|
||||
@@ -247,13 +249,14 @@ fifo_get_d_overrun(void *priv)
|
||||
int ret = fifo->d_overrun;
|
||||
|
||||
fifo->d_overrun = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
fifo_get_ready(void *priv)
|
||||
{
|
||||
fifo_t *fifo = (fifo_t *) priv;
|
||||
const fifo_t *fifo = (fifo_t *) priv;
|
||||
|
||||
return fifo->ready;
|
||||
}
|
||||
@@ -265,13 +268,14 @@ fifo_get_d_ready(void *priv)
|
||||
int ret = fifo->d_ready;
|
||||
|
||||
fifo->d_ready = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
fifo_get_trigger_len(void *priv)
|
||||
{
|
||||
fifo_t *fifo = (fifo_t *) priv;
|
||||
const fifo_t *fifo = (fifo_t *) priv;
|
||||
|
||||
return fifo->trigger_len;
|
||||
}
|
||||
@@ -380,9 +384,9 @@ fifo_init(int len)
|
||||
void *fifo = NULL;
|
||||
|
||||
if (len == 64)
|
||||
fifo = (void *) calloc(1, sizeof(fifo64_t));
|
||||
fifo = calloc(1, sizeof(fifo64_t));
|
||||
else if (len == 16)
|
||||
fifo = (void *) calloc(1, sizeof(fifo16_t));
|
||||
fifo = calloc(1, sizeof(fifo16_t));
|
||||
else {
|
||||
fatal("FIFO : Invalid FIFO length: %i\n", len);
|
||||
return NULL;
|
||||
@@ -405,11 +409,14 @@ enum {
|
||||
SERIAL_INT_TIMEOUT = 16
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t lsr, int_status, tsr, tsr_empty;
|
||||
typedef struct serial_t {
|
||||
uint8_t lsr;
|
||||
uint8_t int_status;
|
||||
uint8_t tsr;
|
||||
uint8_t tsr_empty;
|
||||
|
||||
fifo16_t *rcvr_fifo, *xmit_fifo;
|
||||
fifo16_t *rcvr_fifo;
|
||||
fifo16_t *xmit_fifo;
|
||||
} serial_t;
|
||||
|
||||
static void
|
||||
@@ -421,29 +428,32 @@ serial_receive_timer(fifo16_t *f16, uint8_t val)
|
||||
fifo_get_full(f16), fifo_get_empty(f16),
|
||||
fifo_get_overrun(f16), fifo_get_ready(f16));
|
||||
|
||||
/*
|
||||
#if 0
|
||||
if (fifo_get_d_overrun(f16))
|
||||
dev->lsr = (dev->lsr & 0xfd) | (fifo_get_overrun(f16) << 1);
|
||||
*/
|
||||
#endif
|
||||
|
||||
if (fifo_get_d_overrun(f16)) printf(" FIFO overrun state changed: %i -> %i\n",
|
||||
!fifo_get_overrun(f16), fifo_get_overrun(f16));
|
||||
|
||||
/*
|
||||
#if 0
|
||||
if (fifo_get_d_empty(f16)) {
|
||||
dev->lsr = (dev->lsr & 0xfe) | !fifo_get_empty(f16);
|
||||
timer_on_auto(&dev->timeout_timer, 4.0 * dev->bits * dev->transmit_period);
|
||||
}
|
||||
*/
|
||||
if (fifo_get_d_empty(f16)) printf(" FIFO empty state changed: %i -> %i\n",
|
||||
#endif
|
||||
|
||||
if (fifo_get_d_empty(f16))
|
||||
printf(" FIFO empty state changed: %i -> %i\n",
|
||||
!fifo_get_empty(f16), fifo_get_empty(f16));
|
||||
|
||||
/*
|
||||
#if 0
|
||||
if (fifo_get_d_ready(f16)) {
|
||||
dev->int_status = (dev->int_status & ~SERIAL_INT_RECEIVE) |
|
||||
(fifo_get_ready(f16) ? SERIAL_INT_RECEIVE : 0);
|
||||
serial_update_ints();
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
if (fifo_get_d_ready(f16)) printf(" FIFO ready state changed: %i -> %i\n",
|
||||
!fifo_get_ready(f16), fifo_get_ready(f16));
|
||||
}
|
||||
@@ -459,23 +469,26 @@ serial_read(fifo16_t *f16)
|
||||
fifo_get_full(f16), fifo_get_empty(f16),
|
||||
fifo_get_overrun(f16), fifo_get_ready(f16));
|
||||
|
||||
/*
|
||||
#if 0
|
||||
if (fifo_get_d_ready(f16)) {
|
||||
dev->int_status = (dev->int_status & ~SERIAL_INT_RECEIVE) |
|
||||
(fifo_get_ready(f16) ? SERIAL_INT_RECEIVE : 0);
|
||||
serial_update_ints();
|
||||
}
|
||||
*/
|
||||
if (fifo_get_d_ready(f16)) printf(" FIFO ready state changed: %i -> %i\n",
|
||||
#endif
|
||||
|
||||
if (fifo_get_d_ready(f16))
|
||||
printf(" FIFO ready state changed: %i -> %i\n",
|
||||
!fifo_get_ready(f16), fifo_get_ready(f16));
|
||||
|
||||
/*
|
||||
#if 0
|
||||
if (fifo_get_d_empty(f16)) {
|
||||
dev->lsr = (dev->lsr & 0xfe) | !fifo_get_empty(f16);
|
||||
timer_on_auto(&dev->timeout_timer, 4.0 * dev->bits * dev->transmit_period);
|
||||
}
|
||||
*/
|
||||
if (fifo_get_d_empty(f16)) printf(" FIFO empty state changed: %i -> %i\n",
|
||||
#endif
|
||||
if (fifo_get_d_empty(f16))
|
||||
printf(" FIFO empty state changed: %i -> %i\n",
|
||||
!fifo_get_empty(f16), fifo_get_empty(f16));
|
||||
|
||||
return ret;
|
||||
@@ -532,7 +545,8 @@ serial_rcvr_d_ready_evt(void *priv)
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
uint8_t val, ret;
|
||||
uint8_t val;
|
||||
uint8_t ret;
|
||||
|
||||
printf("Initializing serial...\n");
|
||||
serial_t *dev = (serial_t *) calloc(1, sizeof(serial_t));
|
||||
|
||||
@@ -86,8 +86,8 @@ extern uint8_t lpt_read(uint16_t port, void *priv);
|
||||
extern uint8_t lpt_read_status(int port);
|
||||
extern void lpt_irq(void *priv, int raise);
|
||||
|
||||
extern char *lpt_device_get_name(int id);
|
||||
extern char *lpt_device_get_internal_name(int id);
|
||||
extern const char *lpt_device_get_name(int id);
|
||||
extern const char *lpt_device_get_internal_name(int id);
|
||||
|
||||
extern int lpt_device_get_from_internal_name(char *s);
|
||||
|
||||
|
||||
48
src/ini.c
48
src/ini.c
@@ -266,22 +266,22 @@ ini_close(ini_t ini)
|
||||
static int
|
||||
ini_detect_bom(const char *fn)
|
||||
{
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
unsigned char bom[4] = { 0, 0, 0, 0 };
|
||||
|
||||
#if defined(ANSI_CFG) || !defined(_WIN32)
|
||||
f = plat_fopen(fn, "rt");
|
||||
fp = plat_fopen(fn, "rt");
|
||||
#else
|
||||
f = plat_fopen(fn, "rt, ccs=UTF-8");
|
||||
fp = plat_fopen(fn, "rt, ccs=UTF-8");
|
||||
#endif
|
||||
if (f == NULL)
|
||||
if (fp == NULL)
|
||||
return 0;
|
||||
(void) !fread(bom, 1, 3, f);
|
||||
(void) !fread(bom, 1, 3, fp);
|
||||
if (bom[0] == 0xEF && bom[1] == 0xBB && bom[2] == 0xBF) {
|
||||
fclose(f);
|
||||
fclose(fp);
|
||||
return 1;
|
||||
}
|
||||
fclose(f);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -323,16 +323,16 @@ ini_read(const char *fn)
|
||||
int c;
|
||||
int d;
|
||||
int bom;
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
list_t *head;
|
||||
|
||||
bom = ini_detect_bom(fn);
|
||||
#if defined(ANSI_CFG) || !defined(_WIN32)
|
||||
f = plat_fopen(fn, "rt");
|
||||
fp = plat_fopen(fn, "rt");
|
||||
#else
|
||||
f = plat_fopen(fn, "rt, ccs=UTF-8");
|
||||
fp = plat_fopen(fn, "rt, ccs=UTF-8");
|
||||
#endif
|
||||
if (f == NULL)
|
||||
if (fp == NULL)
|
||||
return NULL;
|
||||
|
||||
head = malloc(sizeof(list_t));
|
||||
@@ -343,16 +343,16 @@ ini_read(const char *fn)
|
||||
|
||||
list_add(&sec->list, head);
|
||||
if (bom)
|
||||
fseek(f, 3, SEEK_SET);
|
||||
fseek(fp, 3, SEEK_SET);
|
||||
|
||||
while (1) {
|
||||
memset(buff, 0x00, sizeof(buff));
|
||||
#ifdef __HAIKU__
|
||||
ini_fgetws(buff, sizeof_w(buff), f);
|
||||
#else
|
||||
(void) !fgetws(buff, sizeof_w(buff), f);
|
||||
(void) !fgetws(buff, sizeof_w(buff), fp);
|
||||
#endif
|
||||
if (feof(f))
|
||||
if (feof(fp))
|
||||
break;
|
||||
|
||||
/* Make sure there are no stray newlines or hard-returns in there. */
|
||||
@@ -436,7 +436,7 @@ ini_read(const char *fn)
|
||||
list_add(&ne->list, &sec->entry_head);
|
||||
}
|
||||
|
||||
(void) fclose(f);
|
||||
(void) fclose(fp);
|
||||
|
||||
return (ini_t) head;
|
||||
}
|
||||
@@ -448,7 +448,7 @@ ini_write(ini_t ini, const char *fn)
|
||||
wchar_t wtemp[512];
|
||||
list_t *list = (list_t *) ini;
|
||||
section_t *sec;
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
int fl = 0;
|
||||
|
||||
if (list == NULL)
|
||||
@@ -457,11 +457,11 @@ ini_write(ini_t ini, const char *fn)
|
||||
sec = (section_t *) list->next;
|
||||
|
||||
#if defined(ANSI_CFG) || !defined(_WIN32)
|
||||
f = plat_fopen(fn, "wt");
|
||||
fp = plat_fopen(fn, "wt");
|
||||
#else
|
||||
f = plat_fopen(fn, "wt, ccs=UTF-8");
|
||||
fp = plat_fopen(fn, "wt, ccs=UTF-8");
|
||||
#endif
|
||||
if (f == NULL)
|
||||
if (fp == NULL)
|
||||
return;
|
||||
|
||||
while (sec != NULL) {
|
||||
@@ -470,9 +470,9 @@ ini_write(ini_t ini, const char *fn)
|
||||
if (sec->name[0]) {
|
||||
mbstowcs(wtemp, sec->name, strlen(sec->name) + 1);
|
||||
if (fl)
|
||||
fwprintf(f, L"\n[%ls]\n", wtemp);
|
||||
fwprintf(fp, L"\n[%ls]\n", wtemp);
|
||||
else
|
||||
fwprintf(f, L"[%ls]\n", wtemp);
|
||||
fwprintf(fp, L"[%ls]\n", wtemp);
|
||||
fl++;
|
||||
}
|
||||
|
||||
@@ -481,9 +481,9 @@ ini_write(ini_t ini, const char *fn)
|
||||
if (ent->name[0] != '\0') {
|
||||
mbstowcs(wtemp, ent->name, 128);
|
||||
if (ent->wdata[0] == L'\0')
|
||||
fwprintf(f, L"%ls = \n", wtemp);
|
||||
fwprintf(fp, L"%ls = \n", wtemp);
|
||||
else
|
||||
fwprintf(f, L"%ls = %ls\n", wtemp, ent->wdata);
|
||||
fwprintf(fp, L"%ls = %ls\n", wtemp, ent->wdata);
|
||||
fl++;
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ ini_write(ini_t ini, const char *fn)
|
||||
sec = (section_t *) sec->list.next;
|
||||
}
|
||||
|
||||
(void) fclose(f);
|
||||
(void) fclose(fp);
|
||||
}
|
||||
|
||||
ini_t
|
||||
|
||||
14
src/lpt.c
14
src/lpt.c
@@ -45,22 +45,22 @@ static const struct {
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
char *
|
||||
const char *
|
||||
lpt_device_get_name(int id)
|
||||
{
|
||||
if (strlen((char *) lpt_devices[id].internal_name) == 0)
|
||||
if (strlen(lpt_devices[id].internal_name) == 0)
|
||||
return NULL;
|
||||
if (!lpt_devices[id].device)
|
||||
return "None";
|
||||
return (char *) lpt_devices[id].device->name;
|
||||
return lpt_devices[id].device->name;
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
lpt_device_get_internal_name(int id)
|
||||
{
|
||||
if (strlen((char *) lpt_devices[id].internal_name) == 0)
|
||||
if (strlen(lpt_devices[id].internal_name) == 0)
|
||||
return NULL;
|
||||
return (char *) lpt_devices[id].internal_name;
|
||||
return lpt_devices[id].internal_name;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -68,7 +68,7 @@ lpt_device_get_from_internal_name(char *s)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (strlen((char *) lpt_devices[c].internal_name) != 0) {
|
||||
while (strlen(lpt_devices[c].internal_name) != 0) {
|
||||
if (strcmp(lpt_devices[c].internal_name, s) == 0)
|
||||
return c;
|
||||
c++;
|
||||
|
||||
@@ -274,7 +274,7 @@ nvr_set_ven_save(void (*ven_save)(void))
|
||||
int
|
||||
nvr_save(void)
|
||||
{
|
||||
char *path;
|
||||
const char *path;
|
||||
FILE *fp;
|
||||
|
||||
/* Make sure we have been initialized. */
|
||||
|
||||
@@ -1001,7 +1001,7 @@ nvr_smi_enable(int enable, nvr_t *nvr)
|
||||
uint8_t
|
||||
nvr_smi_status(nvr_t *nvr)
|
||||
{
|
||||
local_t *local = (local_t *) nvr->data;
|
||||
const local_t *local = (local_t *) nvr->data;
|
||||
|
||||
return local->smi_status;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ static void *
|
||||
ps2_nvr_init(const device_t *info)
|
||||
{
|
||||
ps2_nvr_t *nvr;
|
||||
FILE *f = NULL;
|
||||
FILE *fp = NULL;
|
||||
int c;
|
||||
|
||||
nvr = (ps2_nvr_t *) malloc(sizeof(ps2_nvr_t));
|
||||
@@ -130,14 +130,14 @@ ps2_nvr_init(const device_t *info)
|
||||
io_sethandler(0x0074, 3,
|
||||
ps2_nvr_read, NULL, NULL, ps2_nvr_write, NULL, NULL, nvr);
|
||||
|
||||
f = nvr_fopen(nvr->fn, "rb");
|
||||
fp = nvr_fopen(nvr->fn, "rb");
|
||||
|
||||
nvr->ram = (uint8_t *) malloc(nvr->size);
|
||||
memset(nvr->ram, 0xff, nvr->size);
|
||||
if (f != NULL) {
|
||||
if (fread(nvr->ram, 1, nvr->size, f) != nvr->size)
|
||||
if (fp != NULL) {
|
||||
if (fread(nvr->ram, 1, nvr->size, fp) != nvr->size)
|
||||
fatal("ps2_nvr_init(): Error reading EEPROM data\n");
|
||||
fclose(f);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
return nvr;
|
||||
@@ -147,13 +147,13 @@ static void
|
||||
ps2_nvr_close(void *priv)
|
||||
{
|
||||
ps2_nvr_t *nvr = (ps2_nvr_t *) priv;
|
||||
FILE *f = NULL;
|
||||
FILE *fp = NULL;
|
||||
|
||||
f = nvr_fopen(nvr->fn, "wb");
|
||||
fp = nvr_fopen(nvr->fn, "wb");
|
||||
|
||||
if (f != NULL) {
|
||||
(void) fwrite(nvr->ram, nvr->size, 1, f);
|
||||
fclose(f);
|
||||
if (fp != NULL) {
|
||||
(void) fwrite(nvr->ram, nvr->size, 1, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
if (nvr->ram != NULL)
|
||||
|
||||
17
src/pci.c
17
src/pci.c
@@ -442,6 +442,9 @@ pci_write(uint16_t port, uint8_t val, UNUSED(void *priv))
|
||||
if ((pci_flags & FLAG_MECHANISM_2) && (pci_flags & FLAG_CONFIG_IO_ON))
|
||||
pci_reg_write(port, val);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,6 +464,9 @@ pci_writew(uint16_t port, uint16_t val, UNUSED(void *priv))
|
||||
pci_write(port, val & 0xff, priv);
|
||||
pci_write(port + 1, val >> 8, priv);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -499,6 +505,9 @@ pci_writel(uint16_t port, uint32_t val, UNUSED(void *priv))
|
||||
pci_writew(port, val & 0xffff, priv);
|
||||
pci_writew(port + 2, val >> 16, priv);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -594,6 +603,9 @@ pci_readw(uint16_t port, UNUSED(void *priv))
|
||||
ret = pci_read(port, priv);
|
||||
ret |= ((uint16_t) pci_read(port + 1, priv)) << 8;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -751,7 +763,7 @@ pci_add_card(uint8_t add_type, uint8_t (*read)(int func, int addr, void *priv),
|
||||
}
|
||||
|
||||
static void
|
||||
pci_clear_card(int pci_card)
|
||||
pci_clear_card(UNUSED(int pci_card))
|
||||
{
|
||||
pci_card_desc_t *dev;
|
||||
|
||||
@@ -815,7 +827,6 @@ pci_add_bridge(uint8_t agp, uint8_t (*read)(int func, int addr, void *priv), voi
|
||||
void
|
||||
pci_register_cards(void)
|
||||
{
|
||||
uint8_t i;
|
||||
uint8_t normal;
|
||||
#ifdef ENABLE_PCI_LOG
|
||||
uint8_t type;
|
||||
@@ -825,7 +836,7 @@ pci_register_cards(void)
|
||||
next_normal_pci_card = 0;
|
||||
|
||||
if (next_pci_card > 0) {
|
||||
for (i = 0; i < next_pci_card; i++) {
|
||||
for (uint8_t i = 0; i < next_pci_card; i++) {
|
||||
#ifdef ENABLE_PCI_LOG
|
||||
type = pci_card_descs[i].type;
|
||||
slot = pci_card_descs[i].slot;
|
||||
|
||||
@@ -478,7 +478,6 @@ static void
|
||||
pic_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
pic_t *dev = (pic_t *) priv;
|
||||
uint8_t i;
|
||||
|
||||
pic_log("pic_write(%04X, %02X, %08X)\n", addr, val, priv);
|
||||
|
||||
@@ -527,7 +526,7 @@ pic_write(uint16_t addr, uint8_t val, void *priv)
|
||||
dev->irr = 0x00;
|
||||
dev->edge_lines = 0x00;
|
||||
dev->irq_latch = 0x00;
|
||||
for (i = 0; i <= 7; i++)
|
||||
for (uint8_t i = 0; i <= 7; i++)
|
||||
pic_update_request(dev, i);
|
||||
dev->flags &= ~PIC_MASTER_CLEAR;
|
||||
dev->imr = dev->isr = 0x00;
|
||||
@@ -647,7 +646,8 @@ pic2_init(void)
|
||||
void
|
||||
pic_update_lines(pic_t *dev, uint16_t num, int level, int set, uint8_t *irq_state)
|
||||
{
|
||||
uint8_t old_edge_lines, bit;
|
||||
uint8_t old_edge_lines;
|
||||
uint8_t bit;
|
||||
|
||||
switch (level) {
|
||||
case PIC_IRQ_EDGE:
|
||||
@@ -672,6 +672,9 @@ pic_update_lines(pic_t *dev, uint16_t num, int level, int set, uint8_t *irq_stat
|
||||
if ((!!*irq_state) != !!set)
|
||||
*irq_state = set;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1096,9 +1096,9 @@ pit_set_clock(int clock)
|
||||
|
||||
isa_timing = (cpuclock / (double) cpu_isa_speed);
|
||||
if (cpu_64bitbus)
|
||||
bus_timing = (cpuclock / ((double) cpu_busspeed / 2));
|
||||
bus_timing = (cpuclock / (cpu_busspeed / 2));
|
||||
else
|
||||
bus_timing = (cpuclock / (double) cpu_busspeed);
|
||||
bus_timing = (cpuclock / cpu_busspeed);
|
||||
pci_timing = (cpuclock / (double) cpu_pci_speed);
|
||||
agp_timing = (cpuclock / (double) cpu_agp_speed);
|
||||
|
||||
|
||||
@@ -87,8 +87,6 @@ timer_enable(pc_timer_t *timer)
|
||||
void
|
||||
timer_disable(pc_timer_t *timer)
|
||||
{
|
||||
pc_timer_t *cur, *temp;
|
||||
|
||||
if (!timer_inited || (timer == NULL) || !(timer->flags & TIMER_ENABLED))
|
||||
return;
|
||||
|
||||
@@ -238,8 +236,6 @@ timer_on(pc_timer_t *timer, double period, int start)
|
||||
void
|
||||
timer_on_auto(pc_timer_t *timer, double period)
|
||||
{
|
||||
uint32_t *p = NULL;
|
||||
|
||||
if (!timer_inited || (timer == NULL))
|
||||
return;
|
||||
|
||||
|
||||
10
src/upi42.c
10
src/upi42.c
@@ -916,7 +916,7 @@ timer:
|
||||
uint8_t
|
||||
upi42_port_read(void *priv, int port)
|
||||
{
|
||||
upi42_t *upi42 = (upi42_t *) priv;
|
||||
const upi42_t *upi42 = (upi42_t *) priv;
|
||||
|
||||
/* Read base port value. */
|
||||
port &= 7;
|
||||
@@ -1056,13 +1056,13 @@ main(int argc, char **argv)
|
||||
|
||||
/* Load ROM. */
|
||||
uint8_t rom[4096] = { 0 };
|
||||
FILE *f = fopen(argv[1], "rb");
|
||||
if (!f) {
|
||||
FILE *fp = fopen(argv[1], "rb");
|
||||
if (!fp) {
|
||||
upi42_log("Could not read ROM file.\n");
|
||||
return 2;
|
||||
}
|
||||
size_t rom_size = fread(rom, sizeof(rom[0]), sizeof(rom), f);
|
||||
fclose(f);
|
||||
size_t rom_size = fread(rom, sizeof(rom[0]), sizeof(rom), fp);
|
||||
fclose(fp);
|
||||
|
||||
/* Determine chip type from ROM. */
|
||||
upi42_log("%d-byte ROM, ", rom_size);
|
||||
|
||||
42
src/usb.c
42
src/usb.c
@@ -28,6 +28,7 @@
|
||||
#include <86box/mem.h>
|
||||
#include <86box/usb.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#ifdef ENABLE_USB_LOG
|
||||
int usb_do_log = ENABLE_USB_LOG;
|
||||
@@ -48,10 +49,11 @@ usb_log(const char *fmt, ...)
|
||||
#endif
|
||||
|
||||
static uint8_t
|
||||
uhci_reg_read(uint16_t addr, void *p)
|
||||
uhci_reg_read(uint16_t addr, void *priv)
|
||||
{
|
||||
usb_t *dev = (usb_t *) p;
|
||||
uint8_t ret, *regs = dev->uhci_io;
|
||||
const usb_t *dev = (usb_t *) priv;
|
||||
uint8_t ret;
|
||||
const uint8_t *regs = dev->uhci_io;
|
||||
|
||||
addr &= 0x0000001f;
|
||||
|
||||
@@ -61,9 +63,9 @@ uhci_reg_read(uint16_t addr, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
uhci_reg_write(uint16_t addr, uint8_t val, void *p)
|
||||
uhci_reg_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
usb_t *dev = (usb_t *) p;
|
||||
usb_t *dev = (usb_t *) priv;
|
||||
uint8_t *regs = dev->uhci_io;
|
||||
|
||||
addr &= 0x0000001f;
|
||||
@@ -85,13 +87,16 @@ uhci_reg_write(uint16_t addr, uint8_t val, void *p)
|
||||
case 0x0c:
|
||||
regs[0x0c] = (val & 0x7f);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
uhci_reg_writew(uint16_t addr, uint16_t val, void *p)
|
||||
uhci_reg_writew(uint16_t addr, uint16_t val, void *priv)
|
||||
{
|
||||
usb_t *dev = (usb_t *) p;
|
||||
usb_t *dev = (usb_t *) priv;
|
||||
uint16_t *regs = (uint16_t *) dev->uhci_io;
|
||||
|
||||
addr &= 0x0000001f;
|
||||
@@ -112,8 +117,8 @@ uhci_reg_writew(uint16_t addr, uint16_t val, void *p)
|
||||
regs[addr >> 1] = ((regs[addr >> 1] & 0xedbb) | (val & 0x1244)) & ~(val & 0x080a);
|
||||
break;
|
||||
default:
|
||||
uhci_reg_write(addr, val & 0xff, p);
|
||||
uhci_reg_write(addr + 1, (val >> 8) & 0xff, p);
|
||||
uhci_reg_write(addr, val & 0xff, priv);
|
||||
uhci_reg_write(addr + 1, (val >> 8) & 0xff, priv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -132,9 +137,9 @@ uhci_update_io_mapping(usb_t *dev, uint8_t base_l, uint8_t base_h, int enable)
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
ohci_mmio_read(uint32_t addr, void *p)
|
||||
ohci_mmio_read(uint32_t addr, void *priv)
|
||||
{
|
||||
usb_t *dev = (usb_t *) p;
|
||||
const usb_t *dev = (usb_t *) priv;
|
||||
uint8_t ret = 0x00;
|
||||
|
||||
addr &= 0x00000fff;
|
||||
@@ -148,9 +153,9 @@ ohci_mmio_read(uint32_t addr, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
ohci_mmio_write(uint32_t addr, uint8_t val, void *p)
|
||||
ohci_mmio_write(uint32_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
usb_t *dev = (usb_t *) p;
|
||||
usb_t *dev = (usb_t *) priv;
|
||||
uint8_t old;
|
||||
|
||||
addr &= 0x00000fff;
|
||||
@@ -312,8 +317,10 @@ ohci_mmio_write(uint32_t addr, uint8_t val, void *p)
|
||||
|
||||
if (!(dev->ohci_mmio[addr] & 0x04) && (old & 0x04))
|
||||
dev->ohci_mmio[addr + 2] |= 0x04;
|
||||
/* if (!(dev->ohci_mmio[addr] & 0x02))
|
||||
dev->ohci_mmio[addr + 2] |= 0x02; */
|
||||
#if 0
|
||||
if (!(dev->ohci_mmio[addr] & 0x02))
|
||||
dev->ohci_mmio[addr + 2] |= 0x02;
|
||||
#endif
|
||||
return;
|
||||
case 0x55:
|
||||
if ((val & 0x02) && ((dev->ohci_mmio[0x49] & 0x03) == 0x00) && (dev->ohci_mmio[0x4e] & 0x02)) {
|
||||
@@ -340,6 +347,9 @@ ohci_mmio_write(uint32_t addr, uint8_t val, void *p)
|
||||
case 0x57:
|
||||
case 0x5b:
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
dev->ohci_mmio[addr] = val;
|
||||
@@ -388,7 +398,7 @@ usb_close(void *priv)
|
||||
}
|
||||
|
||||
static void *
|
||||
usb_init(const device_t *info)
|
||||
usb_init(UNUSED(const device_t *info))
|
||||
{
|
||||
usb_t *dev;
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ herculesplus_out(uint16_t port, uint8_t val, void *priv)
|
||||
static uint8_t
|
||||
herculesplus_in(uint16_t port, void *priv)
|
||||
{
|
||||
herculesplus_t *dev = (herculesplus_t *) priv;
|
||||
const herculesplus_t *dev = (herculesplus_t *) priv;
|
||||
uint8_t ret = 0xff;
|
||||
|
||||
switch (port) {
|
||||
@@ -215,7 +215,7 @@ herculesplus_write(uint32_t addr, uint8_t val, void *priv)
|
||||
static uint8_t
|
||||
herculesplus_read(uint32_t addr, void *priv)
|
||||
{
|
||||
herculesplus_t *dev = (herculesplus_t *) priv;
|
||||
const herculesplus_t *dev = (herculesplus_t *) priv;
|
||||
|
||||
return dev->vram[addr & 0xffff];
|
||||
}
|
||||
@@ -355,7 +355,7 @@ draw_char_ram48(herculesplus_t *dev, int x, uint8_t chr, uint8_t attr)
|
||||
if (font >= 12)
|
||||
font &= 7;
|
||||
|
||||
attr = (attr >> 4) ^ 0x0f;;
|
||||
attr = (attr >> 4) ^ 0x0f;
|
||||
|
||||
blk = 0;
|
||||
if (blink) {
|
||||
|
||||
Reference in New Issue
Block a user