From ee695e71f9b4efa822bc5e5b4f75a5c133bdfd8e Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 9 Jun 2023 23:46:54 -0400 Subject: [PATCH] More sonarlint work --- README.md | 9 + src/86box.c | 8 +- src/acpi.c | 2 +- src/apm.c | 5 +- src/cdrom/cdrom.c | 2 +- src/cdrom/cdrom_image_backend.c | 4 +- src/cdrom/cdrom_mitsumi.c | 1 + src/chipset/82c100.c | 8 +- src/chipset/ali1621.c | 4 +- src/chipset/ali6117.c | 2 +- src/chipset/headland.c | 18 +- src/chipset/intel_420ex.c | 9 +- src/chipset/intel_4x0.c | 4 + src/chipset/opti283.c | 2 +- src/chipset/sis_5571.c | 1 + src/chipset/via_pipc.c | 2 +- src/config.c | 18 +- src/cpu/cpu.h | 4 +- src/ddma.c | 6 +- src/device.c | 12 +- src/device/kbc_at.c | 10 +- src/device/kbc_at_dev.c | 2 +- src/device/mouse_bus.c | 1 - src/device/mouse_serial.c | 4 +- src/device/smbus_ali7101.c | 2 +- src/device/smbus_piix4.c | 6 +- src/disk/hdc_esdi_at.c | 4 +- src/disk/hdc_ide.c | 10 +- src/disk/hdc_st506_xt.c | 4 +- src/disk/hdc_xta.c | 6 +- src/disk/mo.c | 4 +- src/disk/zip.c | 6 +- src/dma.c | 10 +- src/floppy/fdc.c | 6 +- src/floppy/fdd.c | 5 +- src/floppy/fdd_86f.c | 188 ++++---- src/floppy/fdd_fdi.c | 20 +- src/floppy/fdd_imd.c | 68 +-- src/floppy/fdd_img.c | 214 ++++----- src/floppy/fdd_json.c | 35 +- src/floppy/fdd_mfm.c | 32 +- src/floppy/fdd_td0.c | 47 +- src/floppy/fdi2raw.c | 57 ++- src/gdbstub.c | 26 +- src/include/86box/mem.h | 86 ++-- src/include/86box/midi.h | 11 +- src/include/86box/pci.h | 2 +- src/include/86box/timer.h | 14 +- src/include/86box/vid_8514a.h | 139 ++++-- src/include/86box/vid_ati_eeprom.h | 8 +- src/include/86box/vid_cga.h | 26 +- src/include/86box/vid_ega.h | 122 +++-- src/include/86box/vid_hercules.h | 38 +- src/include/86box/vid_mda.h | 25 +- src/include/86box/vid_pgc.h | 59 ++- src/include/86box/vid_svga.h | 188 ++++++-- src/include/86box/vid_svga_render.h | 10 +- src/include/86box/vid_voodoo_banshee.h | 2 +- src/include/86box/vid_voodoo_codegen_x86-64.h | 80 ++-- src/include/86box/vid_voodoo_codegen_x86.h | 150 +++--- src/include/86box/vid_voodoo_common.h | 4 +- src/include/86box/vid_xga.h | 134 ++++-- src/machine/m_amstrad.c | 171 ++++--- src/machine/m_at_386dx_486.c | 11 +- src/machine/m_at_commodore.c | 9 +- src/machine/m_at_compaq.c | 85 ++-- src/machine/m_at_slot1.c | 4 +- src/machine/m_at_socket4.c | 4 +- src/machine/m_at_socket7_3v.c | 4 +- src/machine/m_at_t3100e.c | 64 ++- src/machine/m_at_t3100e_vid.c | 76 +-- src/machine/m_elt.c | 28 +- src/machine/m_europc.c | 43 +- src/machine/m_pcjr.c | 119 +++-- src/machine/m_ps1.c | 6 + src/machine/m_ps1_hdc.c | 190 ++++---- src/machine/m_ps2_isa.c | 9 + src/machine/m_ps2_mca.c | 115 +++-- src/machine/m_tandy.c | 89 ++-- src/machine/m_v86p.c | 8 +- src/machine/m_xt_laserxt.c | 14 +- src/machine/m_xt_olivetti.c | 49 +- src/machine/m_xt_philips.c | 12 +- src/machine/m_xt_t1000.c | 25 +- src/machine/m_xt_t1000_vid.c | 104 ++-- src/machine/m_xt_xi8088.c | 3 +- src/machine/m_xt_zenith.c | 15 +- src/machine/machine.c | 15 +- src/machine/machine_table.c | 5 +- src/mem/catalyst_flash.c | 34 +- src/mem/intel_flash.c | 51 +- src/mem/mem.c | 182 +++---- src/mem/rom.c | 79 ++- src/mem/row.c | 57 ++- src/mem/spd.c | 6 +- src/network/net_3c501.c | 14 +- src/network/net_3c503.c | 38 +- src/network/net_dp8390.c | 15 +- src/network/net_event.c | 3 +- src/network/net_ne2000.c | 62 ++- src/network/net_null.c | 5 +- src/network/net_pcap.c | 31 +- src/network/net_pcnet.c | 47 +- src/network/net_plip.c | 28 +- src/network/net_slirp.c | 19 +- src/network/net_vde.c | 20 +- src/network/net_wd8003.c | 32 +- src/nvr_at.c | 4 +- src/pci.c | 1 + src/pci_dummy.c | 2 +- src/printer/png.c | 5 +- src/printer/prt_cpmap.c | 4 +- src/printer/prt_escp.c | 2 +- src/printer/prt_ps.c | 3 +- src/printer/prt_text.c | 2 +- src/scsi/scsi_aha154x.c | 60 ++- src/scsi/scsi_buslogic.c | 187 ++++---- src/scsi/scsi_cdrom.c | 59 ++- src/scsi/scsi_device.c | 3 +- src/scsi/scsi_disk.c | 68 ++- src/scsi/scsi_ncr5380.c | 72 ++- src/scsi/scsi_ncr53c8xx.c | 152 +++--- src/scsi/scsi_pcscsi.c | 73 ++- src/scsi/scsi_spock.c | 49 +- src/scsi/scsi_x54x.c | 24 +- src/sound/midi.c | 12 +- src/sound/midi_fluidsynth.c | 9 +- src/sound/midi_mt32.c | 20 +- src/sound/midi_rtmidi.cpp | 13 +- src/sound/openal.c | 3 +- src/sound/snd_ac97_codec.c | 2 +- src/sound/snd_ac97_via.c | 54 ++- src/sound/snd_ad1848.c | 26 +- src/sound/snd_adlib.c | 28 +- src/sound/snd_adlibgold.c | 122 +++-- src/sound/snd_audiopci.c | 244 ++++++---- src/sound/snd_azt2316a.c | 165 +++++-- src/sound/snd_cmi8x38.c | 80 +++- src/sound/snd_cms.c | 41 +- src/sound/snd_cs423x.c | 71 ++- src/sound/snd_emu8k.c | 318 ++++++++---- src/sound/snd_gus.c | 131 +++-- src/sound/snd_lpt_dac.c | 22 +- src/sound/snd_lpt_dss.c | 33 +- src/sound/snd_mpu401.c | 70 ++- src/sound/snd_opl_nuked.c | 43 +- src/sound/snd_opl_ymfm.cpp | 5 +- src/sound/snd_optimc.c | 64 ++- src/sound/snd_pas16.c | 82 ++-- src/sound/snd_ps1.c | 18 +- src/sound/snd_pssj.c | 39 +- src/sound/snd_resid.cc | 52 +- src/sound/snd_sb.c | 148 +++--- src/sound/snd_sb_dsp.c | 38 +- src/sound/snd_sn76489.c | 26 +- src/sound/snd_speaker.c | 3 +- src/sound/snd_ssi2001.c | 23 +- src/sound/snd_wss.c | 9 +- src/sound/snd_ym7128.c | 10 +- src/sound/sound.c | 20 +- src/sound/xaudio2.c | 21 +- src/timer.c | 6 +- src/video/agpgart.c | 3 +- src/video/vid_8514a.c | 205 ++++++-- src/video/vid_ati18800.c | 32 +- src/video/vid_ati28800.c | 47 +- src/video/vid_ati68860_ramdac.c | 15 +- src/video/vid_ati_eeprom.c | 49 +- src/video/vid_ati_mach64.c | 453 +++++++++++------- src/video/vid_ati_mach8.c | 437 +++++++++++------ src/video/vid_att20c49x_ramdac.c | 9 + src/video/vid_att2xc498_ramdac.c | 6 + src/video/vid_av9194.c | 8 +- src/video/vid_bt48x_ramdac.c | 38 +- src/video/vid_cga.c | 47 +- src/video/vid_cga_comp.c | 4 +- src/video/vid_cl54xx.c | 256 +++++----- src/video/vid_colorplus.c | 31 +- src/video/vid_compaq_cga.c | 12 +- src/video/vid_ega.c | 30 +- src/video/vid_ega_render.c | 13 +- src/video/vid_et3000.c | 21 +- src/video/vid_et4000.c | 25 +- src/video/vid_et4000w32.c | 48 +- src/video/vid_f82c425.c | 32 +- src/video/vid_genius.c | 32 +- src/video/vid_hercules.c | 9 +- src/video/vid_herculesplus.c | 12 +- src/video/vid_ht216.c | 65 +-- src/video/vid_ibm_rgb528_ramdac.c | 3 +- src/video/vid_icd2061.c | 7 +- src/video/vid_ics2494.c | 4 +- src/video/vid_ics2595.c | 10 +- src/video/vid_im1024.c | 4 +- src/video/vid_incolor.c | 3 +- src/video/vid_mda.c | 40 +- src/video/vid_mga.c | 186 +++---- src/video/vid_nga.c | 5 +- src/video/vid_oak_oti.c | 32 +- src/video/vid_ogc.c | 5 +- src/video/vid_paradise.c | 38 +- src/video/vid_pgc.c | 5 +- src/video/vid_s3.c | 151 +++--- src/video/vid_s3_virge.c | 80 ++-- src/video/vid_sdac_ramdac.c | 4 +- src/video/vid_sigma.c | 36 +- src/video/vid_stg_ramdac.c | 4 +- src/video/vid_svga.c | 156 +++--- src/video/vid_tgui9440.c | 236 ++++----- src/video/vid_tvga.c | 22 +- src/video/vid_tvp3026_ramdac.c | 4 +- src/video/vid_vga.c | 20 +- src/video/vid_voodoo.c | 64 +-- src/video/vid_voodoo_banshee.c | 12 +- src/video/vid_voodoo_texture.c | 4 +- src/video/vid_wy700.c | 32 +- src/video/vid_xga.c | 182 +++---- src/vnc_keymap.c | 12 +- 218 files changed, 6282 insertions(+), 3845 deletions(-) diff --git a/README.md b/README.md index b554fd7d1..a1e1b4432 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ 86Box ===== + [![Build Status](https://ci.86box.net/job/86Box/badge/icon)](https://ci.86box.net/job/86Box/) **86Box** is a low level x86 emulator that runs older operating systems and software designed for IBM PC systems and compatibles from 1981 through fairly recent system designs based on the PCI bus. Features -------- + * Easy to use interface inspired by mainstream hypervisor software * Low level emulation of 8086-based processors up to the Mendocino-era Celeron with focus on accuracy * Great range of customizability of virtual machines @@ -16,6 +18,7 @@ Features Minimum system requirements and recommendations ----------------------------------------------- + * Intel Core 2 or AMD Athlon 64 processor or newer * Windows version: Windows 7 Service Pack 1 or later * Linux version: Ubuntu 16.04, Debian 9.0 or other distributions from 2016 onwards @@ -25,6 +28,7 @@ Minimum system requirements and recommendations Performance may vary depending on both host and guest configuration. Most emulation logic is executed in a single thread; therefore, systems with better IPC (instructions per clock) generally should be able to emulate higher clock speeds. It is also recommended to use a manager application with 86Box for easier handling of multiple virtual machines. + * [86Box Manager](https://github.com/86Box/86BoxManager) by [Overdoze](https://github.com/daviunic) (Windows only) * [86Box Manager Lite](https://github.com/insanemal/86box_manager_py) by [Insanemal](https://github.com/insanemal) * [WinBox for 86Box](https://github.com/86Box/WinBox-for-86Box) by Laci bá' (Windows only) @@ -35,10 +39,12 @@ It is also possible to use 86Box on its own with the `--vmpath`/`-P` command lin Getting started --------------- + See [our documentation](https://86box.readthedocs.io/en/latest/index.html) for an overview of the emulator's features and user interface. Community --------- + We operate an IRC channel and a Discord server for discussing 86Box, its development and anything related to retro computing. We look forward to hearing from you! [![Visit our IRC channel](https://kiwiirc.com/buttons/irc.ringoflightning.net/86Box.png)](https://kiwiirc.com/client/irc.ringoflightning.net/?nick=86box|?#86Box) @@ -47,16 +53,19 @@ We operate an IRC channel and a Discord server for discussing 86Box, its develop Contributions --------- + We welcome all contributions to the project, as long as the [contribution guidelines](CONTRIBUTING.md) are followed. Licensing --------- + 86Box is released under the [GNU General Public License, version 2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) or later. For more information, see the `COPYING` file in the root of the repository. The emulator can also optionally make use of [munt](https://github.com/munt/munt), [FluidSynth](https://www.fluidsynth.org/), [Ghostscript](https://www.ghostscript.com/) and [Discord Game SDK](https://discord.com/developers/docs/game-sdk/sdk-starter-guide), which are distributed under their respective licenses. Donations --------- + We do not charge you for the emulator but donations are still welcome: https://paypal.me/86Box. diff --git a/src/86box.c b/src/86box.c index 8db2fc75a..12701e4d2 100644 --- a/src/86box.c +++ b/src/86box.c @@ -1144,9 +1144,9 @@ pc_reset_hard_init(void) void update_mouse_msg(void) { - wchar_t wcpufamily[2048]; - wchar_t wcpu[2048]; - wchar_t wmachine[2048]; + wchar_t wcpufamily[2048]; + wchar_t wcpu[2048]; + wchar_t wmachine[2048]; wchar_t *wcp; mbstowcs(wmachine, machine_getname(), strlen(machine_getname()) + 1); @@ -1185,7 +1185,7 @@ pc_reset_hard(void) } void -pc_close(thread_t *ptr) +pc_close(UNUSED(thread_t *ptr)) { /* Wait a while so things can shut down. */ plat_delay_ms(200); diff --git a/src/acpi.c b/src/acpi.c index 495419f4e..797a5281b 100644 --- a/src/acpi.c +++ b/src/acpi.c @@ -1694,7 +1694,7 @@ acpi_init(const device_t *info) dev = (acpi_t *) malloc(sizeof(acpi_t)); if (dev == NULL) - return (NULL); + return NULL; memset(dev, 0x00, sizeof(acpi_t)); cpu_to_acpi = ACPI_TIMER_FREQ / cpuclock; diff --git a/src/apm.c b/src/apm.c index 8ea3f435d..278cea565 100644 --- a/src/apm.c +++ b/src/apm.c @@ -102,9 +102,8 @@ apm_close(void *priv) free(dev); } -static void - * - apm_init(const device_t *info) +static void * +apm_init(const device_t *info) { apm_t *dev = (apm_t *) malloc(sizeof(apm_t)); memset(dev, 0, sizeof(apm_t)); diff --git a/src/cdrom/cdrom.c b/src/cdrom/cdrom.c index d7cd6f734..3ca7e6885 100644 --- a/src/cdrom/cdrom.c +++ b/src/cdrom/cdrom.c @@ -163,7 +163,7 @@ cdrom_interface_get_from_internal_name(char *s) int c = 0; while (controllers[c].device != NULL) { - if (!strcmp((char *) controllers[c].device->internal_name, s)) + if (!strcmp(controllers[c].device->internal_name, s)) return c; c++; } diff --git a/src/cdrom/cdrom_image_backend.c b/src/cdrom/cdrom_image_backend.c index 7dae28bf4..cf8bb7368 100644 --- a/src/cdrom/cdrom_image_backend.c +++ b/src/cdrom/cdrom_image_backend.c @@ -652,7 +652,7 @@ cdi_cue_get_buffer(char *str, char **line, int up) done = 1; break; } - /*FALLTHROUGH*/ + [[fallthrough]]; default: if (up && islower((int) *s)) @@ -787,7 +787,7 @@ cdi_add_track(cd_img_t *cdi, track_t *cur, uint64_t *shift, uint64_t prestart, u *total_pregap += cur_pregap; cur->start += *total_pregap; } else { - temp = prev->file->get_length(prev->file) - ((uint64_t) prev->skip); + temp = prev->file->get_length(prev->file) - (prev->skip); prev->length = temp / ((uint64_t) prev->sector_size); if ((temp % prev->sector_size) != 0) prev->length++; diff --git a/src/cdrom/cdrom_mitsumi.c b/src/cdrom/cdrom_mitsumi.c index 079ae3556..e2a70ac77 100644 --- a/src/cdrom/cdrom_mitsumi.c +++ b/src/cdrom/cdrom_mitsumi.c @@ -324,6 +324,7 @@ mitsumi_cdrom_out(uint16_t port, uint8_t val, void *priv) break; case 5: dev->readmsf = 0; + [[fallthrough]]; case 4: case 3: dev->readmsf |= CD_DCB(val) << ((dev->cmdrd_count - 3) << 3); diff --git a/src/chipset/82c100.c b/src/chipset/82c100.c index abac4b618..beae4e8da 100644 --- a/src/chipset/82c100.c +++ b/src/chipset/82c100.c @@ -286,7 +286,7 @@ mem_read_emsb(uint32_t addr, void *priv) addr = addr - page->virt + page->phys; - if (addr < ((uint32_t) mem_size << 10)) + if (addr < (mem_size << 10)) ret = ram[addr]; ct_82c100_log("mem_read_emsb(%08X = %08X): %02X\n", old_addr, addr, ret); @@ -305,7 +305,7 @@ mem_read_emsw(uint32_t addr, void *priv) addr = addr - page->virt + page->phys; - if (addr < ((uint32_t) mem_size << 10)) + if (addr < (mem_size << 10)) ret = *(uint16_t *) &ram[addr]; ct_82c100_log("mem_read_emsw(%08X = %08X): %04X\n", old_addr, addr, ret); @@ -323,7 +323,7 @@ mem_write_emsb(uint32_t addr, uint8_t val, void *priv) addr = addr - page->virt + page->phys; - if (addr < ((uint32_t) mem_size << 10)) + if (addr < (mem_size << 10)) ram[addr] = val; ct_82c100_log("mem_write_emsb(%08X = %08X, %02X)\n", old_addr, addr, val); @@ -339,7 +339,7 @@ mem_write_emsw(uint32_t addr, uint16_t val, void *priv) addr = addr - page->virt + page->phys; - if (addr < ((uint32_t) mem_size << 10)) + if (addr < (mem_size << 10)) *(uint16_t *) &ram[addr] = val; ct_82c100_log("mem_write_emsw(%08X = %08X, %04X)\n", old_addr, addr, val); diff --git a/src/chipset/ali1621.c b/src/chipset/ali1621.c index 73b65d801..cb1df7e11 100644 --- a/src/chipset/ali1621.c +++ b/src/chipset/ali1621.c @@ -108,7 +108,7 @@ ali1621_smram_recalc(uint8_t val, ali1621_t *dev) switch (val & 0x30) { case 0x10: /* Open. */ access_normal = ACCESS_SMRAM_RX; - /* FALLTHROUGH */ + [[fallthrough]]; case 0x30: /* Protect. */ access_smm |= ACCESS_SMRAM_R; break; @@ -121,7 +121,7 @@ ali1621_smram_recalc(uint8_t val, ali1621_t *dev) switch (val & 0x30) { case 0x10: /* Open. */ access_normal |= ACCESS_SMRAM_W; - /* FALLTHROUGH */ + [[fallthrough]]; case 0x30: /* Protect. */ access_smm |= ACCESS_SMRAM_W; break; diff --git a/src/chipset/ali6117.c b/src/chipset/ali6117.c index 433316c50..c0ca89d90 100644 --- a/src/chipset/ali6117.c +++ b/src/chipset/ali6117.c @@ -233,7 +233,7 @@ ali6117_reg_write(uint16_t addr, uint8_t val, void *priv) case 0x12: val &= 0xf7; - /* FALL-THROUGH */ + [[fallthrough]]; case 0x14: case 0x15: diff --git a/src/chipset/headland.c b/src/chipset/headland.c index 30ee44b0f..db5922470 100644 --- a/src/chipset/headland.c +++ b/src/chipset/headland.c @@ -165,7 +165,7 @@ get_addr(headland_t *dev, uint32_t addr, headland_mr_t *mr) static void hl_ems_disable(headland_t *dev, uint8_t mar, uint32_t base_addr, uint8_t indx) { - if (base_addr < ((uint32_t) mem_size << 10)) + if (base_addr < (mem_size << 10)) mem_mapping_set_exec(&dev->ems_mapping[mar & 0x3f], ram + base_addr); else mem_mapping_set_exec(&dev->ems_mapping[mar & 0x3f], NULL); @@ -197,7 +197,7 @@ hl_ems_update(headland_t *dev, uint8_t mar) dev->ems_mr[mar & 0x3f].virt_base = virt_addr; if (indx < 24) mem_mapping_disable(&dev->upper_mapping[indx]); - if (virt_addr < ((uint32_t) mem_size << 10)) + if (virt_addr < (mem_size << 10)) mem_mapping_set_exec(&dev->ems_mapping[mar & 0x3f], ram + virt_addr); else mem_mapping_set_exec(&dev->ems_mapping[mar & 0x3f], NULL); @@ -244,7 +244,7 @@ memmap_state_update(headland_t *dev) for (uint8_t i = 0; i < 24; i++) { addr = get_addr(dev, 0x40000 + (i << 14), NULL); - mem_mapping_set_exec(&dev->upper_mapping[i], addr < ((uint32_t) mem_size << 10) ? ram + addr : NULL); + mem_mapping_set_exec(&dev->upper_mapping[i], addr < (mem_size << 10) ? ram + addr : NULL); } memmap_state_default(dev, ht_romcs); @@ -513,7 +513,7 @@ mem_read_b(uint32_t addr, void *priv) uint8_t ret = 0xff; addr = get_addr(dev, addr, mr); - if (addr < ((uint32_t) mem_size << 10)) + if (addr < (mem_size << 10)) ret = ram[addr]; return ret; @@ -527,7 +527,7 @@ mem_read_w(uint32_t addr, void *priv) uint16_t ret = 0xffff; addr = get_addr(dev, addr, mr); - if (addr < ((uint32_t) mem_size << 10)) + if (addr < (mem_size << 10)) ret = *(uint16_t *) &ram[addr]; return ret; @@ -541,7 +541,7 @@ mem_read_l(uint32_t addr, void *priv) uint32_t ret = 0xffffffff; addr = get_addr(dev, addr, mr); - if (addr < ((uint32_t) mem_size << 10)) + if (addr < (mem_size << 10)) ret = *(uint32_t *) &ram[addr]; return ret; @@ -554,7 +554,7 @@ mem_write_b(uint32_t addr, uint8_t val, void *priv) headland_t *dev = mr->headland; addr = get_addr(dev, addr, mr); - if (addr < ((uint32_t) mem_size << 10)) + if (addr < (mem_size << 10)) ram[addr] = val; } @@ -565,7 +565,7 @@ mem_write_w(uint32_t addr, uint16_t val, void *priv) headland_t *dev = mr->headland; addr = get_addr(dev, addr, mr); - if (addr < ((uint32_t) mem_size << 10)) + if (addr < (mem_size << 10)) *(uint16_t *) &ram[addr] = val; } @@ -576,7 +576,7 @@ mem_write_l(uint32_t addr, uint32_t val, void *priv) headland_t *dev = mr->headland; addr = get_addr(dev, addr, mr); - if (addr < ((uint32_t) mem_size << 10)) + if (addr < (mem_size << 10)) *(uint32_t *) &ram[addr] = val; } diff --git a/src/chipset/intel_420ex.c b/src/chipset/intel_420ex.c index 9ab21e449..dfc99bccd 100644 --- a/src/chipset/intel_420ex.c +++ b/src/chipset/intel_420ex.c @@ -165,15 +165,14 @@ i420ex_smram_handler_phase1(i420ex_t *dev) static void i420ex_drb_recalc(i420ex_t *dev) { - int i; uint32_t boundary; - for (i = 4; i >= 0; i--) + for (uint8_t i = 4; i >= 0; i--) row_disable(i); - for (i = 0; i <= 4; i++) { - boundary = ((uint32_t) dev->regs[0x60 + i]) & 0xff; - row_set_boundary(i, boundary); + for (uint8_t i = 0; i <= 4; i++) { + boundary = ((uint32_t) dev->regs[0x60 + i]) & 0xff; + row_set_boundary(i, boundary); } flushmmucache(); diff --git a/src/chipset/intel_4x0.c b/src/chipset/intel_4x0.c index 0d07914b2..39a0b72bb 100644 --- a/src/chipset/intel_4x0.c +++ b/src/chipset/intel_4x0.c @@ -1068,6 +1068,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_440ZX: case INTEL_440GX: regs[addr] = val; + break; + default: break; } @@ -1077,6 +1079,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_440BX: case INTEL_440ZX: regs[0x77] = val & 0x03; + break; + default: break; } diff --git a/src/chipset/opti283.c b/src/chipset/opti283.c index 1a6b21221..3811b53bb 100644 --- a/src/chipset/opti283.c +++ b/src/chipset/opti283.c @@ -228,7 +228,7 @@ opti283_write(uint16_t addr, uint8_t val, void *priv) case 0x14: reset_on_hlt = !!(val & 0x40); - /* FALLTHROUGH */ + [[fallthrough]]; case 0x11: case 0x12: case 0x13: diff --git a/src/chipset/sis_5571.c b/src/chipset/sis_5571.c index 950146ed4..39dff414a 100644 --- a/src/chipset/sis_5571.c +++ b/src/chipset/sis_5571.c @@ -638,6 +638,7 @@ pci_isa_bridge_write(int func, int addr, uint8_t val, void *priv) break; } sis_5571_log("SiS5571-USB: dev->pci_conf[%02x] = %02x\n", addr, val); + break; default: break; diff --git a/src/chipset/via_pipc.c b/src/chipset/via_pipc.c index b39c21a1d..d41caa22b 100644 --- a/src/chipset/via_pipc.c +++ b/src/chipset/via_pipc.c @@ -1474,7 +1474,7 @@ pipc_write(int func, int addr, uint8_t val, void *priv) case 0xd2: if (dev->local == VIA_PIPC_686B) smbus_piix4_setclock(dev->smbus, (val & 0x04) ? 65536 : 16384); - /* fall-through */ + [[fallthrough]]; case 0x90: case 0x91: diff --git a/src/config.c b/src/config.c index 32824c2d4..6bae95c3b 100644 --- a/src/config.c +++ b/src/config.c @@ -448,7 +448,7 @@ load_machine(void) cpu_f = cpu_get_family(legacy_table_entry->family); if (cpu_f) { /* Save the new values. */ - ini_section_set_string(cat, "cpu_family", (char *) legacy_table_entry->family); + ini_section_set_string(cat, "cpu_family", legacy_table_entry->family); ini_section_set_int(cat, "cpu_speed", legacy_table_entry->rspeed); ini_section_set_double(cat, "cpu_multi", legacy_table_entry->multi); } @@ -500,7 +500,7 @@ load_machine(void) cpu_waitstates = ini_section_get_int(cat, "cpu_waitstates", 0); - p = (char *) ini_section_get_string(cat, "fpu_type", "none"); + p = ini_section_get_string(cat, "fpu_type", "none"); fpu_type = fpu_get_type(cpu_f, cpu, p); mem_size = ini_section_get_int(cat, "mem_size", 64); @@ -911,7 +911,7 @@ load_ports(void) lpt_ports[c].enabled = !!ini_section_get_int(cat, temp, (c == 0) ? 1 : 0); sprintf(temp, "lpt%d_device", c + 1); - p = (char *) ini_section_get_string(cat, temp, "none"); + p = ini_section_get_string(cat, temp, "none"); lpt_ports[c].device = lpt_device_get_from_internal_name(p); } @@ -2226,7 +2226,7 @@ save_machine(void) p = machine_get_internal_name(); ini_section_set_string(cat, "machine", p); - ini_section_set_string(cat, "cpu_family", (char *) cpu_f->internal_name); + ini_section_set_string(cat, "cpu_family", cpu_f->internal_name); ini_section_set_int(cat, "cpu_speed", cpu_f->cpus[cpu].rspeed); ini_section_set_double(cat, "cpu_multi", cpu_f->cpus[cpu].multi); if (cpu_override) @@ -2254,7 +2254,7 @@ save_machine(void) i = 0; while (cpu_legacy_table[c].tables[legacy_mfg][i].family) { - legacy_table_entry = (cpu_legacy_table_t *) &cpu_legacy_table[c].tables[legacy_mfg][i]; + legacy_table_entry = &cpu_legacy_table[c].tables[legacy_mfg][i]; /* Match the family name, speed and multiplier. */ if (!strcmp(cpu_f->internal_name, legacy_table_entry->family)) { @@ -2294,7 +2294,7 @@ save_machine(void) if (fpu_type == 0) ini_section_delete_var(cat, "fpu_type"); else - ini_section_set_string(cat, "fpu_type", (char *) fpu_get_internal_name(cpu_f, cpu, fpu_type)); + ini_section_set_string(cat, "fpu_type", fpu_get_internal_name(cpu_f, cpu, fpu_type)); // Write the mem_size explicitly to the setttings in order to help managers to display it without having the actual machine table ini_section_delete_var(cat, "mem_size"); @@ -2613,7 +2613,7 @@ save_ports(void) ini_section_delete_var(cat, temp); else ini_section_set_string(cat, temp, - (char *) lpt_device_get_internal_name(lpt_ports[c].device)); + lpt_device_get_internal_name(lpt_ports[c].device)); } ini_delete_section_if_empty(config, cat); @@ -2738,7 +2738,7 @@ save_other_peripherals(void) ini_section_delete_var(cat, temp); else ini_section_set_string(cat, temp, - (char *) isamem_get_internal_name(isamem_type[c])); + isamem_get_internal_name(isamem_type[c])); } if (isartc_type == 0) @@ -2836,7 +2836,7 @@ save_hard_disks(void) if (!hdd_is_valid(c) || (hdd[c].bus != HDD_BUS_IDE && hdd[c].bus != HDD_BUS_ESDI)) ini_section_delete_var(cat, temp); else - ini_section_set_string(cat, temp, (char *) hdd_preset_get_internal_name(hdd[c].speed_preset)); + ini_section_set_string(cat, temp, hdd_preset_get_internal_name(hdd[c].speed_preset)); } ini_delete_section_if_empty(config, cat); diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 3d6d0622a..d13201608 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -133,13 +133,13 @@ enum { # define LOOKUP_INV -1 #endif -typedef struct { +typedef struct fpu_t { const char *name; const char *internal_name; const int type; } FPU; -typedef struct { +typedef struct cpu_t { const char *name; uint64_t cpu_type; const FPU *fpus; diff --git a/src/ddma.c b/src/ddma.c index 098b1c573..c4fc90d3d 100644 --- a/src/ddma.c +++ b/src/ddma.c @@ -60,7 +60,7 @@ ddma_reg_read(uint16_t addr, void *priv) ddma_channel_t *dev = (ddma_channel_t *) priv; uint8_t ret = 0xff; int ch = dev->channel; - int dmab = (ch >= 4) ? 0xc0 : 0x00; + uint8_t dmab = (ch >= 4) ? 0xc0 : 0x00; switch (addr & 0x0f) { case 0x00: @@ -94,8 +94,8 @@ ddma_reg_write(uint16_t addr, uint8_t val, void *priv) { ddma_channel_t *dev = (ddma_channel_t *) priv; int ch = dev->channel; - int page_regs[4] = { 7, 3, 1, 2 }; - int dmab = (ch >= 4) ? 0xc0 : 0x00; + uint8_t page_regs[4] = { 7, 3, 1, 2 }; + uint8_t dmab = (ch >= 4) ? 0xc0 : 0x00; switch (addr & 0x0f) { case 0x00: diff --git a/src/device.c b/src/device.c index 47dae84cf..108b6de9d 100644 --- a/src/device.c +++ b/src/device.c @@ -143,7 +143,7 @@ device_add_common(const device_t *dev, const device_t *cd, void *p, void *params int c; for (c = 0; c < 256; c++) { - if (!inst && (devices[c] == (device_t *) dev)) { + if (!inst && (devices[c] == dev)) { device_log("DEVICE: device already exists!\n"); return (NULL); } @@ -349,7 +349,7 @@ device_available(const device_t *dev) int i = 0; if (dev != NULL) { - config = (device_config_t *) dev->config; + config = dev->config; if (config != NULL) { while (config->type != -1) { if (config->type == CONFIG_BIOS) { @@ -359,7 +359,7 @@ device_available(const device_t *dev) while (bios->files_no != 0) { i = 0; for (int bf = 0; bf < bios->files_no; bf++) - i += !!rom_present((char *) bios->files[bf]); + i += !!rom_present(bios->files[bf]); if (i == bios->files_no) roms_present++; bios++; @@ -389,11 +389,11 @@ device_get_bios_file(const device_t *dev, const char *internal_name, int file_no device_config_bios_t *bios = NULL; if (dev != NULL) { - config = (device_config_t *) dev->config; + config = dev->config; if (config != NULL) { while (config->type != -1) { if (config->type == CONFIG_BIOS) { - bios = (device_config_bios_t *) config->bios; + bios = config->bios; /* Go through the ROM's in the device configuration. */ while (bios->files_no != 0) { @@ -427,7 +427,7 @@ device_has_config(const device_t *dev) if (dev->config == NULL) return 0; - config = (device_config_t *) dev->config; + config = dev->config; while (config->type != -1) { if (config->type != CONFIG_MAC) diff --git a/src/device/kbc_at.c b/src/device/kbc_at.c index ee5a6d17e..5b45e7fb0 100644 --- a/src/device/kbc_at.c +++ b/src/device/kbc_at.c @@ -463,7 +463,7 @@ kbc_at_poll_at(atkbc_t *dev) case STATE_KBC_AMI_OUT: if (dev->status & STAT_OFULL) break; - /* FALLTHROUGH */ + [[fallthrough]]; case STATE_MAIN_IBF: default: at_main_ibf: @@ -586,7 +586,7 @@ kbc_at_poll_ps2(atkbc_t *dev) case STATE_KBC_AMI_OUT: if (dev->status & STAT_OFULL) break; - /* FALLTHROUGH */ + [[fallthrough]]; case STATE_MAIN_IBF: default: ps2_main_ibf: @@ -1027,6 +1027,9 @@ write64_generic(void *priv, uint8_t val) kbc_at_log("ATkbc: pulse %01X\n", val & 0x0f); pulse_output(dev, val & 0x0f); return 0; + + default: + break; } kbc_at_log("ATkbc: bad command %02X\n", val); @@ -1328,12 +1331,13 @@ write64_siemens(void *priv, uint8_t val) static uint8_t write60_quadtel(void *priv, UNUSED(uint8_t val)) { - atkbc_t *dev = (atkbc_t *) priv; + const atkbc_t *dev = (atkbc_t *) priv; switch (dev->command) { case 0xcf: /*??? - sent by MegaPC BIOS*/ kbc_at_log("ATkbc: ??? - sent by MegaPC BIOS\n"); return 0; + default: break; } diff --git a/src/device/kbc_at_dev.c b/src/device/kbc_at_dev.c index 32323ceeb..4e57e1e7a 100644 --- a/src/device/kbc_at_dev.c +++ b/src/device/kbc_at_dev.c @@ -135,7 +135,7 @@ kbc_at_dev_poll(void *priv) dev->port->wantcmd = 0; break; } - /* FALLTHROUGH */ + [[fallthrough]]; case DEV_STATE_MAIN_WANT_IN: /* Output command response and then return to main loop #2. */ if ((dev->port->out_new == -1) && (dev->cmd_queue_start != dev->cmd_queue_end)) { diff --git a/src/device/mouse_bus.c b/src/device/mouse_bus.c index 675686280..0537c0cb4 100644 --- a/src/device/mouse_bus.c +++ b/src/device/mouse_bus.c @@ -226,7 +226,6 @@ lt_read(uint16_t port, void *priv) return (dev->control_val | 0x0F) & ~IRQ_MASK; else return 0xff; - break; default: break; diff --git a/src/device/mouse_serial.c b/src/device/mouse_serial.c index 7e50bd49d..48e83bf32 100644 --- a/src/device/mouse_serial.c +++ b/src/device/mouse_serial.c @@ -507,7 +507,7 @@ sermouse_command_timer(void *priv) break; case PHASE_ACK: serial_write_fifo(dev->serial, 0x06); - /* FALLTHROUGH */ + [[fallthrough]]; case PHASE_BAUD_RATE: sermouse_command_phase_idle(dev); sermouse_timer_on(dev, dev->report_period, 1); @@ -645,7 +645,7 @@ ltsermouse_write(UNUSED(struct serial_s *serial), void *priv, uint8_t data) switch (data) { default: mouse_serial_log("Serial mouse: Invalid period %02X, using 1200 bps\n", data); - /*FALLTHROUGH*/ + [[fallthrough]]; case 0x6E: dev->transmit_period = sermouse_transmit_period(dev, 1200, -1); break; diff --git a/src/device/smbus_ali7101.c b/src/device/smbus_ali7101.c index d48749d28..8e0b543cd 100644 --- a/src/device/smbus_ali7101.c +++ b/src/device/smbus_ali7101.c @@ -193,7 +193,7 @@ smbus_ali7101_write(uint16_t addr, uint8_t val, void *priv) case 0x4: /* block R/W */ timer_bytes++; /* count the SMBus length byte now */ - /* fall-through */ + [[fallthrough]]; default: /* unknown */ dev->next_stat = 0x20; /* raise DEV_ERR */ diff --git a/src/device/smbus_piix4.c b/src/device/smbus_piix4.c index 48a04451e..7a75844af 100644 --- a/src/device/smbus_piix4.c +++ b/src/device/smbus_piix4.c @@ -195,7 +195,7 @@ smbus_piix4_write(uint16_t addr, uint8_t val, void *priv) timer_bytes++; } - /* fall-through */ + [[fallthrough]]; case 0xc: /* I2C process call */ if (!read) { /* word write (only when writing) */ @@ -214,7 +214,7 @@ smbus_piix4_write(uint16_t addr, uint8_t val, void *priv) case 0x5: /* block R/W */ timer_bytes++; /* count the SMBus length byte now */ - /* fall-through */ + [[fallthrough]]; case 0xd: /* I2C block R/W */ i2c_write(i2c_smbus, smbus_addr, dev->cmd); @@ -247,7 +247,7 @@ smbus_piix4_write(uint16_t addr, uint8_t val, void *priv) i2c_write(i2c_smbus, smbus_addr, dev->cmd); timer_bytes++; - /* fall-through */ + [[fallthrough]]; case 0xe: /* I2C with 7-bit address */ if (!read) { /* word write (only when writing) */ diff --git a/src/disk/hdc_esdi_at.c b/src/disk/hdc_esdi_at.c index 014212b1d..1ce62e432 100644 --- a/src/disk/hdc_esdi_at.c +++ b/src/disk/hdc_esdi_at.c @@ -338,7 +338,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv) esdi->command &= ~0x03; if (val & 0x02) fatal("Read with ECC\n"); - /*FALLTHROUGH*/ + [[fallthrough]]; case 0xa0: esdi->status = STAT_BUSY; @@ -397,7 +397,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv) default: esdi_at_log("WD1007: bad command %02X\n", val); - /*FALLTHROUGH*/ + [[fallthrough]]; case 0xe8: /*???*/ esdi->status = STAT_BUSY; esdi_set_callback(esdi, 200 * HDC_TIME); diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index 041d8ffc4..94d43fc6c 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -1655,7 +1655,7 @@ ide_writeb(uint16_t addr, uint8_t val, void *priv) disabled, the Read Multiple operation is rejected with an Aborted Com- mand error. */ ide->blockcount = 0; - /*FALLTHROUGH*/ + [[fallthrough]]; case WIN_READ: case WIN_READ_NORETRY: @@ -1704,7 +1704,7 @@ ide_writeb(uint16_t addr, uint8_t val, void *priv) /* Turn on the activity indicator *here* so that it gets turned on less times. */ ui_sb_update_icon(SB_HDD | hdd[ide->hdd_num].bus, 1); - /*FALLTHROUGH*/ + [[fallthrough]]; case WIN_WRITE: case WIN_WRITE_NORETRY: @@ -1843,6 +1843,9 @@ ide_bad_command: return; } return; + + default: + break; } } @@ -2062,6 +2065,9 @@ ide_readb(uint16_t addr, void *priv) ide_irq_lower(ide); temp = ide_status(ide, ide_drives[ch ^ 1], ch); break; + + default: + break; } ide_log("ide_readb(%04X, %08X) = %02X\n", addr, priv, temp); diff --git a/src/disk/hdc_st506_xt.c b/src/disk/hdc_st506_xt.c index c895aab45..f27b481a9 100644 --- a/src/disk/hdc_st506_xt.c +++ b/src/disk/hdc_st506_xt.c @@ -623,6 +623,8 @@ st506_callback(void *priv) st506_complete(dev); break; } + [[fallthrough]]; + case CMD_FORMAT_TRACK: case CMD_FORMAT_BAD_TRACK: switch (dev->state) { @@ -1604,7 +1606,7 @@ st506_init(const device_t *info) case ST506_XT_TYPE_ST11R: /* Seagate ST-11R (RLL) */ dev->spt = RLL_SECTORS; - /*FALLTHROUGH*/ + [[fallthrough]]; case ST506_XT_TYPE_ST11M: /* Seagate ST-11M (MFM) */ dev->nr_err = ERR_NOT_AVAILABLE; diff --git a/src/disk/hdc_xta.c b/src/disk/hdc_xta.c index 99e638335..da1828fa4 100644 --- a/src/disk/hdc_xta.c +++ b/src/disk/hdc_xta.c @@ -509,7 +509,7 @@ hdc_callback(void *priv) case CMD_READ_VERIFY: no_data = 1; - /*FALLTHROUGH*/ + [[fallthrough]]; case CMD_READ_SECTORS: if (!drive->present) { @@ -534,7 +534,7 @@ hdc_callback(void *priv) dev->buf_len = 512; dev->state = STATE_SEND; - /*FALLTHROUGH*/ + [[fallthrough]]; case STATE_SEND: /* Activate the status icon. */ @@ -642,7 +642,7 @@ do_send: dev->buf_len = 512; dev->state = STATE_RECV; - /*FALLTHROUGH*/ + [[fallthrough]]; case STATE_RECV: /* Activate the status icon. */ diff --git a/src/disk/mo.c b/src/disk/mo.c index d7dbba895..2423474d8 100644 --- a/src/disk/mo.c +++ b/src/disk/mo.c @@ -655,7 +655,7 @@ mo_update_request_length(mo_t *dev, int len, int block_len) break; } } - /*FALLTHROUGH*/ + [[fallthrough]]; default: dev->packet_len = len; break; @@ -1342,7 +1342,7 @@ mo_command(scsi_common_t *sc, uint8_t *cdb) mo_invalid_field(dev); return; } - /*FALLTHROUGH*/ + [[fallthrough]]; case GPCMD_SCSI_RESERVE: case GPCMD_SCSI_RELEASE: case GPCMD_TEST_UNIT_READY: diff --git a/src/disk/zip.c b/src/disk/zip.c index 648182cc3..3e1233462 100644 --- a/src/disk/zip.c +++ b/src/disk/zip.c @@ -821,7 +821,8 @@ zip_update_request_length(zip_t *dev, int len, int block_len) break; } } - /*FALLTHROUGH*/ + [[fallthrough]]; + default: dev->packet_len = len; break; @@ -1408,7 +1409,7 @@ zip_command(scsi_common_t *sc, uint8_t *cdb) zip_invalid_field(dev); return; } - /*FALLTHROUGH*/ + [[fallthrough]]; case GPCMD_SCSI_RESERVE: case GPCMD_SCSI_RELEASE: case GPCMD_TEST_UNIT_READY: @@ -1571,6 +1572,7 @@ zip_command(scsi_common_t *sc, uint8_t *cdb) zip_command_complete(dev); break; } + [[fallthrough]]; case GPCMD_WRITE_6: case GPCMD_WRITE_10: case GPCMD_WRITE_AND_VERIFY_10: diff --git a/src/dma.c b/src/dma.c index 9dc984125..d51beb241 100644 --- a/src/dma.c +++ b/src/dma.c @@ -118,7 +118,7 @@ dma_sg_next_addr(dma_t *dev) dev->eot = dev->count >> 31; dev->count &= 0xfffe; dev->cb = (uint16_t) dev->count; - dev->cc = (int) dev->count; + dev->cc = dev->count; if (!dev->count) dev->count = 65536; if (ts == 2) @@ -133,9 +133,7 @@ dma_sg_next_addr(dma_t *dev) static void dma_block_transfer(int channel) { - int bit16; - - bit16 = (channel >= 4); + int bit16 = (channel >= 4); if (dma_advanced) bit16 = !!(dma_transfer_size(&(dma[channel])) == 2); @@ -1280,7 +1278,7 @@ dma_sg(uint8_t *data, int transfer_length, int out, void *priv) uint8_t _dma_read(uint32_t addr, dma_t *dma_c) { - uint8_t temp; + uint8_t temp = 0; if (dma_advanced) { if (dma_c->sg_status & 1) @@ -1296,7 +1294,7 @@ _dma_read(uint32_t addr, dma_t *dma_c) static uint16_t _dma_readw(uint32_t addr, dma_t *dma_c) { - uint16_t temp; + uint16_t temp = 0; if (dma_advanced) { if (dma_c->sg_status & 1) diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index 99767d857..ffba58a59 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -916,7 +916,7 @@ fdc_write(uint16_t addr, uint8_t val, void *priv) fdc_bad_command(fdc); break; } - /*FALLTHROUGH*/ + [[fallthrough]]; case 0x07: /*Recalibrate*/ fdc->pnum = 0; fdc->ptot = 1; @@ -959,7 +959,7 @@ fdc_write(uint16_t addr, uint8_t val, void *priv) fdc_bad_command(fdc); break; } - /*FALLTHROUGH*/ + [[fallthrough]]; case 0x10: /*Get version*/ case 0x14: /*Unlock*/ case 0x94: /*Lock*/ @@ -1081,7 +1081,7 @@ fdc_write(uint16_t addr, uint8_t val, void *priv) case 0x16: /* Verify */ if (fdc->params[0] & 0x80) fdc->sc = fdc->params[7]; - /*FALLTHROUGH*/ + [[fallthrough]]; case 0x06: /* Read data */ case 0x0c: /* Read deleted data */ fdc_io_command_phase1(fdc, 0); diff --git a/src/floppy/fdd.c b/src/floppy/fdd.c index 16d414af3..93235e88a 100644 --- a/src/floppy/fdd.c +++ b/src/floppy/fdd.c @@ -64,7 +64,7 @@ #define FLAG_IGNORE_DENSEL 512 #define FLAG_PS2 1024 -typedef struct { +typedef struct fdd_t { int type; int track; int densel; @@ -586,6 +586,9 @@ fdd_get_bitcell_period(int rate) case 3: /*Extended density*/ bit_rate = 1000; break; + + default: + break; } return 1000000 / bit_rate * 2; /*Bitcell period in ns*/ diff --git a/src/floppy/fdd_86f.c b/src/floppy/fdd_86f.c index f2c0ffbbc..f4581ecc0 100644 --- a/src/floppy/fdd_86f.c +++ b/src/floppy/fdd_86f.c @@ -180,7 +180,7 @@ typedef struct sector_t { * specifies the entire bitcell count */ typedef struct d86f_t { - FILE *f; + FILE *fp; uint8_t state; uint8_t fill; uint8_t sector_count; @@ -1659,7 +1659,7 @@ d86f_write_sector_data(int drive, int side, int mfm, uint16_t am) d86f_handler[drive].write_data(drive, side, dev->data_find.bytes_obtained - 1, dev->current_byte[side]); } else { /* We're in the data field of the sector, use a CRC byte. */ - dev->current_byte[side] = dev->calc_crc.bytes[(dev->data_find.bytes_obtained & 1)]; + dev->current_byte[side] = dev->calc_crc.bytes[dev->data_find.bytes_obtained & 1]; } dev->current_bit[side] = (15 - (dev->data_find.bits_obtained & 15)) >> 1; @@ -1951,7 +1951,7 @@ d86f_format_track(int drive, int side, int do_write) if (dev->datac == 3) fdc_stop_id_request(d86f_fdc); } - /*FALLTHROUGH*/ + [[fallthrough]]; case FMT_PRETRK_SYNC: case FMT_SECTOR_DATA_SYNC: @@ -2294,7 +2294,7 @@ d86f_turbo_poll(int drive, int side) case STATE_0D_SPIN_TO_INDEX: dev->sector_count = 0; dev->datac = 5; - /*FALLTHROUGH*/ + [[fallthrough]]; case STATE_02_SPIN_TO_INDEX: dev->state++; @@ -2339,7 +2339,7 @@ d86f_turbo_poll(int drive, int side) dev->last_sector.id.r = dev->req_sector.id.r; dev->last_sector.id.n = dev->req_sector.id.n; d86f_handler[drive].set_sector(drive, side, dev->last_sector.id.c, dev->last_sector.id.h, dev->last_sector.id.r, dev->last_sector.id.n); - /*FALLTHROUGH*/ + [[fallthrough]]; case STATE_0A_FIND_ID: dev->turbo_pos = 0; @@ -2905,12 +2905,12 @@ d86f_read_track(int drive, int track, int thin_track, int side, uint16_t *da, ui if (dev->track_offset[logical_track]) { if (!thin_track) { - if (fseek(dev->f, dev->track_offset[logical_track], SEEK_SET) == -1) + if (fseek(dev->fp, dev->track_offset[logical_track], SEEK_SET) == -1) fatal("d86f_read_track(): Error seeking to offset dev->track_offset[logical_track]\n"); - if (fread(&(dev->side_flags[side]), 1, 2, dev->f) != 2) + if (fread(&(dev->side_flags[side]), 1, 2, dev->fp) != 2) fatal("d86f_read_track(): Error reading side flags\n"); if (d86f_has_extra_bit_cells(drive)) { - if (fread(&(dev->extra_bit_cells[side]), 1, 4, dev->f) != 4) + if (fread(&(dev->extra_bit_cells[side]), 1, 4, dev->fp) != 4) fatal("d86f_read_track(): Error reading number of extra bit cells\n"); /* If RPM shift is 0% and direction is 1, do not adjust extra bit cells, as that is the whole track length. */ @@ -2922,13 +2922,13 @@ d86f_read_track(int drive, int track, int thin_track, int side, uint16_t *da, ui } } else dev->extra_bit_cells[side] = 0; - (void) !fread(&(dev->index_hole_pos[side]), 4, 1, dev->f); + (void) !fread(&(dev->index_hole_pos[side]), 4, 1, dev->fp); } else - fseek(dev->f, dev->track_offset[logical_track] + d86f_track_header_size(drive), SEEK_SET); + fseek(dev->fp, dev->track_offset[logical_track] + d86f_track_header_size(drive), SEEK_SET); array_size = d86f_get_array_size(drive, side, 0); - (void) !fread(da, 1, array_size, dev->f); + (void) !fread(da, 1, array_size, dev->fp); if (d86f_has_surface_desc(drive)) - (void) !fread(sa, 1, array_size, dev->f); + (void) !fread(sa, 1, array_size, dev->fp); } else { if (!thin_track) { switch ((dev->disk_flags >> 1) & 3) { @@ -3125,22 +3125,22 @@ d86f_writeback(int drive) #endif header_size = d86f_header_size(drive); - if (!dev->f) + if (!dev->fp) return; /* First write the track offsets table. */ - if (fseek(dev->f, 0, SEEK_SET) == -1) + if (fseek(dev->fp, 0, SEEK_SET) == -1) fatal("86F write_back(): Error seeking to the beginning of the file\n"); - if (fread(header, 1, header_size, dev->f) != header_size) + if (fread(header, 1, header_size, dev->fp) != header_size) fatal("86F write_back(): Error reading header size\n"); - if (fseek(dev->f, 8, SEEK_SET) == -1) + if (fseek(dev->fp, 8, SEEK_SET) == -1) fatal("86F write_back(): Error seeking\n"); size = d86f_get_track_table_size(drive); - if (fwrite(dev->track_offset, 1, size, dev->f) != size) + if (fwrite(dev->track_offset, 1, size, dev->fp) != size) fatal("86F write_back(): Error writing data\n"); - d86f_write_tracks(drive, &dev->f, NULL); + d86f_write_tracks(drive, &dev->fp, NULL); #ifdef D86F_COMPRESS if (dev->is_compressed) { @@ -3152,16 +3152,16 @@ d86f_writeback(int drive) /* Write the header to the original file. */ fwrite(header, 1, header_size, cf); - fseek(dev->f, 0, SEEK_END); - len = ftell(dev->f); + fseek(dev->fp, 0, SEEK_END); + len = ftell(dev->fp); len -= header_size; - fseek(dev->f, header_size, SEEK_SET); + fseek(dev->fp, header_size, SEEK_SET); /* Compress data from the temporary uncompressed file to the original, compressed file. */ dev->filebuf = (uint8_t *) malloc(len); dev->outbuf = (uint8_t *) malloc(len - 1); - fread(dev->filebuf, 1, len, dev->f); + fread(dev->filebuf, 1, len, dev->fp); ret = lzf_compress(dev->filebuf, len, dev->outbuf, len - 1); if (!ret) @@ -3421,7 +3421,7 @@ d86f_export(int drive, char *fn) uint32_t tt[512]; d86f_t *dev = d86f[drive]; d86f_t *temp86; - FILE *f; + FILE *fp; int tracks = 86; int inc = 1; uint32_t magic = 0x46423638; @@ -3430,19 +3430,19 @@ d86f_export(int drive, char *fn) memset(tt, 0, 512 * sizeof(uint32_t)); - f = plat_fopen(fn, "wb"); - if (!f) + fp = plat_fopen(fn, "wb"); + if (!fp) return 0; /* Allocate a temporary drive for conversion. */ temp86 = (d86f_t *) malloc(sizeof(d86f_t)); memcpy(temp86, dev, sizeof(d86f_t)); - fwrite(&magic, 4, 1, f); - fwrite(&version, 2, 1, f); - fwrite(&disk_flags, 2, 1, f); + fwrite(&magic, 4, 1, fp); + fwrite(&version, 2, 1, fp); + fwrite(&disk_flags, 2, 1, fp); - fwrite(tt, 1, ((d86f_get_sides(drive) == 2) ? 2048 : 1024), f); + fwrite(tt, 1, ((d86f_get_sides(drive) == 2) ? 2048 : 1024), fp); /* In the case of a thick track drive, always increment track by two, since two tracks are going to get output at once. */ @@ -3455,17 +3455,17 @@ d86f_export(int drive, char *fn) else fdd_do_seek(drive, i); dev->cur_track = i; - d86f_write_tracks(drive, &f, tt); + d86f_write_tracks(drive, &fp, tt); } - fclose(f); + fclose(fp); - f = plat_fopen(fn, "rb+"); + fp = plat_fopen(fn, "rb+"); - fseek(f, 8, SEEK_SET); - fwrite(tt, 1, ((d86f_get_sides(drive) == 2) ? 2048 : 1024), f); + fseek(fp, 8, SEEK_SET); + fwrite(tt, 1, ((d86f_get_sides(drive) == 2) ? 2048 : 1024), fp); - fclose(f); + fclose(fp); fdd_do_seek(drive, fdd_current_track(drive)); @@ -3492,10 +3492,10 @@ d86f_load(int drive, char *fn) writeprot[drive] = 0; - dev->f = plat_fopen(fn, "rb+"); - if (!dev->f) { - dev->f = plat_fopen(fn, "rb"); - if (!dev->f) { + dev->fp = plat_fopen(fn, "rb+"); + if (!dev->fp) { + dev->fp = plat_fopen(fn, "rb"); + if (!dev->fp) { memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); free(dev); return; @@ -3508,16 +3508,16 @@ d86f_load(int drive, char *fn) } fwriteprot[drive] = writeprot[drive]; - fseek(dev->f, 0, SEEK_END); - len = ftell(dev->f); - fseek(dev->f, 0, SEEK_SET); + fseek(dev->fp, 0, SEEK_END); + len = ftell(dev->fp); + fseek(dev->fp, 0, SEEK_SET); - (void) !fread(&magic, 4, 1, dev->f); + (void) !fread(&magic, 4, 1, dev->fp); if (len < 16) { /* File is WAY too small, abort. */ - fclose(dev->f); - dev->f = NULL; + fclose(dev->fp); + dev->fp = NULL; memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); free(dev); return; @@ -3526,13 +3526,13 @@ d86f_load(int drive, char *fn) if ((magic != 0x46423638) && (magic != 0x66623638)) { /* File is not of the valid format, abort. */ d86f_log("86F: Unrecognized magic bytes: %08X\n", magic); - fclose(dev->f); + fclose(dev->fp); memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); free(dev); return; } - if (fread(&(dev->version), 1, 2, dev->f) != 2) + if (fread(&(dev->version), 1, 2, dev->fp) != 2) fatal("d86f_load(): Error reading format version\n"); if (dev->version != D86FVER) { @@ -3544,8 +3544,8 @@ d86f_load(int drive, char *fn) } else { d86f_log("86F: Unrecognized file version: %i.%02i\n", dev->version >> 8, dev->version & 0xff); } - fclose(dev->f); - dev->f = NULL; + fclose(dev->fp); + dev->fp = NULL; memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); free(dev); return; @@ -3553,7 +3553,7 @@ d86f_load(int drive, char *fn) d86f_log("86F: Recognized file version: %i.%02i\n", dev->version >> 8, dev->version & 0xff); } - (void) !fread(&(dev->disk_flags), 2, 1, dev->f); + (void) !fread(&(dev->disk_flags), 2, 1, dev->fp); if (d86f_has_surface_desc(drive)) { for (uint8_t i = 0; i < 2; i++) @@ -3572,31 +3572,31 @@ d86f_load(int drive, char *fn) if (len < 51052) { #endif /* File too small, abort. */ - fclose(dev->f); - dev->f = NULL; + fclose(dev->fp); + dev->fp = NULL; memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); free(dev); return; } #ifdef DO_CRC64 - fseek(dev->f, 8, SEEK_SET); - fread(&read_crc64, 1, 8, dev->f); + fseek(dev->fp, 8, SEEK_SET); + fread(&read_crc64, 1, 8, dev->fp); - fseek(dev->f, 0, SEEK_SET); + fseek(dev->fp, 0, SEEK_SET); crc64 = 0xffffffffffffffff; dev->filebuf = malloc(len); - fread(dev->filebuf, 1, len, dev->f); + fread(dev->filebuf, 1, len, dev->fp); *(uint64_t *) &(dev->filebuf[8]) = 0xffffffffffffffff; crc64 = (uint64_t) crc64speed(0, dev->filebuf, len); free(dev->filebuf); if (crc64 != read_crc64) { d86f_log("86F: CRC64 error\n"); - fclose(dev->f); - dev->f = NULL; + fclose(dev->fp); + dev->fp = NULL; memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); free(dev); return; @@ -3608,11 +3608,11 @@ d86f_load(int drive, char *fn) memcpy(temp_file_name, drive ? nvr_path("TEMP$$$1.$$$") : nvr_path("TEMP$$$0.$$$"), 256); memcpy(dev->original_file_name, fn, strlen(fn) + 1); - fclose(dev->f); - dev->f = NULL; + fclose(dev->fp); + dev->fp = NULL; - dev->f = plat_fopen(temp_file_name, "wb"); - if (!dev->f) { + dev->fp = plat_fopen(temp_file_name, "wb"); + if (!dev->fp) { d86f_log("86F: Unable to create temporary decompressed file\n"); memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); free(dev); @@ -3621,9 +3621,9 @@ d86f_load(int drive, char *fn) tf = plat_fopen(fn, "rb"); - for (i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { fread(&temp, 1, 2, tf); - fwrite(&temp, 1, 2, dev->f); + fwrite(&temp, 1, 2, dev->fp); } dev->filebuf = (uint8_t *) malloc(len); @@ -3631,14 +3631,14 @@ d86f_load(int drive, char *fn) fread(dev->filebuf, 1, len, tf); temp = lzf_decompress(dev->filebuf, len, dev->outbuf, 67108864); if (temp) { - fwrite(dev->outbuf, 1, temp, dev->f); + fwrite(dev->outbuf, 1, temp, dev->fp); } free(dev->outbuf); free(dev->filebuf); fclose(tf); - fclose(dev->f); - dev->f = NULL; + fclose(dev->fp); + dev->fp = NULL; if (!temp) { d86f_log("86F: Error decompressing file\n"); @@ -3648,15 +3648,15 @@ d86f_load(int drive, char *fn) return; } - dev->f = plat_fopen(temp_file_name, "rb+"); + dev->fp = plat_fopen(temp_file_name, "rb+"); } #endif if (dev->disk_flags & 0x100) { /* Zoned disk. */ d86f_log("86F: Disk is zoned (Apple or Sony)\n"); - fclose(dev->f); - dev->f = NULL; + fclose(dev->fp); + dev->fp = NULL; #ifdef D86F_COMPRESS if (dev->is_compressed) plat_remove(temp_file_name); @@ -3669,8 +3669,8 @@ d86f_load(int drive, char *fn) if (dev->disk_flags & 0x600) { /* Zone type is not 0 but the disk is fixed-RPM. */ d86f_log("86F: Disk is fixed-RPM but zone type is not 0\n"); - fclose(dev->f); - dev->f = NULL; + fclose(dev->fp); + dev->fp = NULL; #ifdef D86F_COMPRESS if (dev->is_compressed) plat_remove(temp_file_name); @@ -3686,29 +3686,29 @@ d86f_load(int drive, char *fn) } if (writeprot[drive]) { - fclose(dev->f); - dev->f = NULL; + fclose(dev->fp); + dev->fp = NULL; #ifdef D86F_COMPRESS if (dev->is_compressed) - dev->f = plat_fopen(temp_file_name, "rb"); + dev->fp = plat_fopen(temp_file_name, "rb"); else #endif - dev->f = plat_fopen(fn, "rb"); + dev->fp = plat_fopen(fn, "rb"); } /* OK, set the drive data, other code needs it. */ d86f[drive] = dev; - fseek(dev->f, 8, SEEK_SET); + fseek(dev->fp, 8, SEEK_SET); - (void) !fread(dev->track_offset, 1, d86f_get_track_table_size(drive), dev->f); + (void) !fread(dev->track_offset, 1, d86f_get_track_table_size(drive), dev->fp); if (!(dev->track_offset[0])) { /* File has no track 0 side 0, abort. */ d86f_log("86F: No Track 0 side 0\n"); - fclose(dev->f); - dev->f = NULL; + fclose(dev->fp); + dev->fp = NULL; memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); free(dev); d86f[drive] = NULL; @@ -3718,8 +3718,8 @@ d86f_load(int drive, char *fn) if ((d86f_get_sides(drive) == 2) && !(dev->track_offset[1])) { /* File is 2-sided but has no track 0 side 1, abort. */ d86f_log("86F: No Track 0 side 1\n"); - fclose(dev->f); - dev->f = NULL; + fclose(dev->fp); + dev->fp = NULL; memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); free(dev); d86f[drive] = NULL; @@ -3727,12 +3727,12 @@ d86f_load(int drive, char *fn) } /* Load track 0 flags as default. */ - if (fseek(dev->f, dev->track_offset[0], SEEK_SET) == -1) + if (fseek(dev->fp, dev->track_offset[0], SEEK_SET) == -1) fatal("d86f_load(): Track 0: Error seeking to the beginning of the file\n"); - if (fread(&(dev->side_flags[0]), 1, 2, dev->f) != 2) + if (fread(&(dev->side_flags[0]), 1, 2, dev->fp) != 2) fatal("d86f_load(): Track 0: Error reading side flags\n"); if (dev->disk_flags & 0x80) { - if (fread(&(dev->extra_bit_cells[0]), 1, 4, dev->f) != 4) + if (fread(&(dev->extra_bit_cells[0]), 1, 4, dev->fp) != 4) fatal("d86f_load(): Track 0: Error reading the amount of extra bit cells\n"); if ((dev->disk_flags & 0x1060) != 0x1000) { if (dev->extra_bit_cells[0] < -32768) @@ -3745,12 +3745,12 @@ d86f_load(int drive, char *fn) } if (d86f_get_sides(drive) == 2) { - if (fseek(dev->f, dev->track_offset[1], SEEK_SET) == -1) + if (fseek(dev->fp, dev->track_offset[1], SEEK_SET) == -1) fatal("d86f_load(): Track 1: Error seeking to the beginning of the file\n"); - if (fread(&(dev->side_flags[1]), 1, 2, dev->f) != 2) + if (fread(&(dev->side_flags[1]), 1, 2, dev->fp) != 2) fatal("d86f_load(): Track 1: Error reading side flags\n"); if (dev->disk_flags & 0x80) { - if (fread(&(dev->extra_bit_cells[1]), 1, 4, dev->f) != 4) + if (fread(&(dev->extra_bit_cells[1]), 1, 4, dev->fp) != 4) fatal("d86f_load(): Track 4: Error reading the amount of extra bit cells\n"); if ((dev->disk_flags & 0x1060) != 0x1000) { if (dev->extra_bit_cells[1] < -32768) @@ -3781,10 +3781,10 @@ d86f_load(int drive, char *fn) dev->extra_bit_cells[1] = 0; } - fseek(dev->f, 0, SEEK_END); - dev->file_size = ftell(dev->f); + fseek(dev->fp, 0, SEEK_END); + dev->file_size = ftell(dev->fp); - fseek(dev->f, 0, SEEK_SET); + fseek(dev->fp, 0, SEEK_SET); d86f_register_86f(drive); @@ -3847,9 +3847,9 @@ d86f_close(int drive) } } - if (dev->f) { - fclose(dev->f); - dev->f = NULL; + if (dev->fp) { + fclose(dev->fp); + dev->fp = NULL; } #ifdef D86F_COMPRESS if (dev->is_compressed) diff --git a/src/floppy/fdd_fdi.c b/src/floppy/fdd_fdi.c index a1a2a61ee..5cca21d64 100644 --- a/src/floppy/fdd_fdi.c +++ b/src/floppy/fdd_fdi.c @@ -36,8 +36,8 @@ #include <86box/fdc.h> #include -typedef struct { - FILE *f; +typedef struct fdi_t { + FILE *fp; FDI *h; int lasttrack; @@ -291,7 +291,7 @@ fdi_seek(int drive, int track) d86f_set_cur_track(drive, track); - if (dev->f == NULL) + if (dev->fp == NULL) return; if (track < 0) @@ -327,16 +327,16 @@ fdi_load(int drive, char *fn) d86f_unregister(drive); - dev->f = plat_fopen(fn, "rb"); - if (fread(header, 1, 25, dev->f) != 25) + dev->fp = plat_fopen(fn, "rb"); + if (fread(header, 1, 25, dev->fp) != 25) fatal("fdi_load(): Error reading header\n"); - if (fseek(dev->f, 0, SEEK_SET) == -1) + if (fseek(dev->fp, 0, SEEK_SET) == -1) fatal("fdi_load(): Error seeking to the beginning of the file\n"); header[25] = 0; if (strcmp(header, "Formatted Disk Image file") != 0) { /* This is a Japanese FDI file. */ fdi_log("fdi_load(): Japanese FDI file detected, redirecting to IMG loader\n"); - fclose(dev->f); + fclose(dev->fp); free(dev); img_load(drive, fn); return; @@ -345,7 +345,7 @@ fdi_load(int drive, char *fn) /* Set up the drive unit. */ fdi[drive] = dev; - dev->h = fdi2raw_header(dev->f); + dev->h = fdi2raw_header(dev->fp); dev->lasttrack = fdi2raw_get_last_track(dev->h); dev->sides = fdi2raw_get_last_head(dev->h) + 1; @@ -386,8 +386,8 @@ fdi_close(int drive) if (dev->h) fdi2raw_header_free(dev->h); - if (dev->f) - fclose(dev->f); + if (dev->fp) + fclose(dev->fp); /* Release the memory. */ free(dev); diff --git a/src/floppy/fdd_imd.c b/src/floppy/fdd_imd.c index 211b18373..9439467fc 100644 --- a/src/floppy/fdd_imd.c +++ b/src/floppy/fdd_imd.c @@ -31,7 +31,7 @@ #include <86box/fdd_imd.h> #include <86box/fdc.h> -typedef struct { +typedef struct imd_track_t { uint8_t is_present; uint32_t file_offs; uint8_t params[5]; @@ -47,8 +47,8 @@ typedef struct { uint8_t max_sector_size; } imd_track_t; -typedef struct { - FILE *f; +typedef struct imd_t { + FILE *fp; char *buffer; uint32_t start_offs; int track_count; @@ -150,7 +150,7 @@ track_is_xdf(int drive, int side, int track) effective_sectors = xdf_sectors = high_sectors = low_sectors = 0; - for (i = 0; i < 256; i++) + for (uint16_t i = 0; i < 256; i++) dev->xdf_ordered_pos[i][side] = 0; if (dev->tracks[track][side].params[2] & 0xC0) @@ -175,7 +175,7 @@ track_is_xdf(int drive, int side, int track) expected_low_count = 0; } - for (i = 0; i < dev->tracks[track][side].params[3]; i++) { + for (uint8_t i = 0; i < dev->tracks[track][side].params[3]; i++) { if ((r_map[i] >= 0x81) && (r_map[i] <= max_high_id)) { high_sectors++; dev->xdf_ordered_pos[(int) r_map[i]][side] = i; @@ -196,7 +196,7 @@ track_is_xdf(int drive, int side, int track) n_map = (uint8_t *) (dev->buffer + dev->tracks[track][side].n_map_offs); - for (i = 0; i < dev->tracks[track][side].params[3]; i++) { + for (uint8_t i = 0; i < dev->tracks[track][side].params[3]; i++) { effective_sectors++; if (!(r_map[i]) && !(n_map[i])) effective_sectors--; @@ -310,7 +310,7 @@ imd_seek(int drive, int track) uint8_t *data; int flags = 0x00; - if (dev->f == NULL) + if (dev->fp == NULL) return; if (!dev->track_width && fdd_doublestep_40(drive)) @@ -526,26 +526,26 @@ imd_writeback(int drive) for (int side = 0; side < dev->sides; side++) { if (dev->tracks[track][side].is_present) { - fseek(dev->f, dev->tracks[track][side].file_offs, SEEK_SET); + fseek(dev->fp, dev->tracks[track][side].file_offs, SEEK_SET); h = dev->tracks[track][side].params[2]; spt = dev->tracks[track][side].params[3]; n = dev->tracks[track][side].params[4]; - fwrite(dev->tracks[track][side].params, 1, 5, dev->f); + fwrite(dev->tracks[track][side].params, 1, 5, dev->fp); if (h & 0x80) - fwrite(dev->buffer + dev->tracks[track][side].c_map_offs, 1, spt, dev->f); + fwrite(dev->buffer + dev->tracks[track][side].c_map_offs, 1, spt, dev->fp); if (h & 0x40) - fwrite(dev->buffer + dev->tracks[track][side].h_map_offs, 1, spt, dev->f); + fwrite(dev->buffer + dev->tracks[track][side].h_map_offs, 1, spt, dev->fp); if (n == 0xFF) { n_map = dev->buffer + dev->tracks[track][side].n_map_offs; - fwrite(n_map, 1, spt, dev->f); + fwrite(n_map, 1, spt, dev->fp); } for (uint8_t i = 0; i < spt; i++) { ssize = (n == 0xFF) ? n_map[i] : n; ssize = 128 << ssize; - fwrite(dev->buffer + dev->tracks[track][side].sector_data_offs[i], 1, ssize, dev->f); + fwrite(dev->buffer + dev->tracks[track][side].sector_data_offs[i], 1, ssize, dev->fp); } } } @@ -637,10 +637,10 @@ imd_load(int drive, char *fn) dev = (imd_t *) malloc(sizeof(imd_t)); memset(dev, 0x00, sizeof(imd_t)); - dev->f = plat_fopen(fn, "rb+"); - if (dev->f == NULL) { - dev->f = plat_fopen(fn, "rb"); - if (dev->f == NULL) { + dev->fp = plat_fopen(fn, "rb+"); + if (dev->fp == NULL) { + dev->fp = plat_fopen(fn, "rb"); + if (dev->fp == NULL) { memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); free(dev); return; @@ -652,40 +652,40 @@ imd_load(int drive, char *fn) writeprot[drive] = 1; fwriteprot[drive] = writeprot[drive]; - if (fseek(dev->f, 0, SEEK_SET) == -1) + if (fseek(dev->fp, 0, SEEK_SET) == -1) fatal("imd_load(): Error seeking to the beginning of the file\n"); - if (fread(&magic, 1, 4, dev->f) != 4) + if (fread(&magic, 1, 4, dev->fp) != 4) fatal("imd_load(): Error reading the magic number\n"); if (magic != 0x20444D49) { imd_log("IMD: Not a valid ImageDisk image\n"); - fclose(dev->f); + fclose(dev->fp); free(dev); memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); return; } else imd_log("IMD: Valid ImageDisk image\n"); - if (fseek(dev->f, 0, SEEK_END) == -1) + if (fseek(dev->fp, 0, SEEK_END) == -1) fatal("imd_load(): Error seeking to the end of the file\n"); - fsize = ftell(dev->f); + fsize = ftell(dev->fp); if (fsize <= 0) { imd_log("IMD: Too small ImageDisk image\n"); - fclose(dev->f); + fclose(dev->fp); free(dev); memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); return; } - if (fseek(dev->f, 0, SEEK_SET) == -1) + if (fseek(dev->fp, 0, SEEK_SET) == -1) fatal("imd_load(): Error seeking to the beginning of the file again\n"); dev->buffer = malloc(fsize); - if (fread(dev->buffer, 1, fsize, dev->f) != fsize) + if (fread(dev->buffer, 1, fsize, dev->fp) != fsize) fatal("imd_load(): Error reading data\n"); buffer = dev->buffer; buffer2 = memchr(buffer, 0x1A, fsize); if (buffer2 == NULL) { imd_log("IMD: No ASCII EOF character\n"); - fclose(dev->f); + fclose(dev->fp); free(dev); memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); return; @@ -696,7 +696,7 @@ imd_load(int drive, char *fn) buffer2++; if ((buffer2 - buffer) == fsize) { imd_log("IMD: File ends after ASCII EOF character\n"); - fclose(dev->f); + fclose(dev->fp); free(dev); memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); return; @@ -775,7 +775,7 @@ imd_load(int drive, char *fn) dev->tracks[track][side].data_offs = last_offset; - for (i = 0; i < track_spt; i++) { + for (int i = 0; i < track_spt; i++) { data_size = buffer2[i]; data_size = 128 << data_size; dev->tracks[track][side].sector_data_offs[i] = last_offset; @@ -784,7 +784,7 @@ imd_load(int drive, char *fn) /* Invalid sector data type, possibly a malformed HxC IMG image (it outputs data errored sectors with a variable amount of bytes, against the specification). */ imd_log("IMD: Invalid sector data type %02X\n", dev->buffer[dev->tracks[track][side].sector_data_offs[i]]); - fclose(dev->f); + fclose(dev->fp); free(dev); imd[drive] = NULL; memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); @@ -807,7 +807,7 @@ imd_load(int drive, char *fn) } else { dev->tracks[track][side].data_offs = last_offset; - for (i = 0; i < track_spt; i++) { + for (int i = 0; i < track_spt; i++) { data_size = sector_size; data_size = 128 << data_size; dev->tracks[track][side].sector_data_offs[i] = last_offset; @@ -816,7 +816,7 @@ imd_load(int drive, char *fn) /* Invalid sector data type, possibly a malformed HxC IMG image (it outputs data errored sectors with a variable amount of bytes, against the specification). */ imd_log("IMD: Invalid sector data type %02X\n", dev->buffer[dev->tracks[track][side].sector_data_offs[i]]); - fclose(dev->f); + fclose(dev->fp); free(dev); imd[drive] = NULL; memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); @@ -865,7 +865,7 @@ imd_load(int drive, char *fn) if (size_diff < gap_sum) { /* If we can't fit the sectors with a reasonable minimum gap even at 2% slower RPM, abort. */ imd_log("IMD: Unable to fit the %i sectors in a track\n", track_spt); - fclose(dev->f); + fclose(dev->fp); free(dev); imd[drive] = NULL; memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); @@ -931,10 +931,10 @@ imd_close(int drive) d86f_unregister(drive); - if (dev->f != NULL) { + if (dev->fp != NULL) { free(dev->buffer); - fclose(dev->f); + fclose(dev->fp); } /* Release the memory. */ diff --git a/src/floppy/fdd_img.c b/src/floppy/fdd_img.c index 9d5232cdf..cfe196db8 100644 --- a/src/floppy/fdd_img.c +++ b/src/floppy/fdd_img.c @@ -40,8 +40,8 @@ #include <86box/fdd_img.h> #include <86box/fdc.h> -typedef struct { - FILE *f; +typedef struct img_t { + FILE *fp; uint8_t track_data[2][688128]; int sectors, tracks, sides; uint8_t sector_size; @@ -418,17 +418,17 @@ write_back(int drive) int ssize = 128 << ((int) dev->sector_size); int size; - if (dev->f == NULL) + if (dev->fp == NULL) return; if (dev->disk_at_once) return; - if (fseek(dev->f, dev->base + (dev->track * dev->sectors * ssize * dev->sides), SEEK_SET) == -1) + if (fseek(dev->fp, dev->base + (dev->track * dev->sectors * ssize * dev->sides), SEEK_SET) == -1) pclog("IMG write_back(): Error seeking to the beginning of the file\n"); for (int side = 0; side < dev->sides; side++) { size = dev->sectors * ssize; - if (fwrite(dev->track_data[side], 1, size, dev->f) != size) + if (fwrite(dev->track_data[side], 1, size, dev->fp) != size) fatal("IMG write_back(): Error writing data\n"); } } @@ -507,7 +507,7 @@ img_seek(int drive, int track) int ssize = 128 << ((int) dev->sector_size); uint32_t cur_pos = 0; - if (dev->f == NULL) + if (dev->fp == NULL) return; if (!dev->track_width && fdd_doublestep_40(drive)) @@ -519,7 +519,7 @@ img_seek(int drive, int track) is_t0 = (track == 0) ? 1 : 0; if (!dev->disk_at_once) { - if (fseek(dev->f, dev->base + (track * dev->sectors * ssize * dev->sides), SEEK_SET) == -1) + if (fseek(dev->fp, dev->base + (track * dev->sectors * ssize * dev->sides), SEEK_SET) == -1) fatal("img_seek(): Error seeking\n"); } @@ -528,7 +528,7 @@ img_seek(int drive, int track) cur_pos = (track * dev->sectors * ssize * dev->sides) + (side * dev->sectors * ssize); memcpy(dev->track_data[side], dev->disk_data + cur_pos, (size_t) dev->sectors * ssize); } else { - read_bytes = fread(dev->track_data[side], 1, (size_t) dev->sectors * ssize, dev->f); + read_bytes = fread(dev->track_data[side], 1, (size_t) dev->sectors * ssize, dev->fp); if (read_bytes < (dev->sectors * ssize)) memset(dev->track_data[side] + read_bytes, 0xf6, (dev->sectors * ssize) - read_bytes); } @@ -682,10 +682,10 @@ img_load(int drive, char *fn) dev = (img_t *) malloc(sizeof(img_t)); memset(dev, 0x00, sizeof(img_t)); - dev->f = plat_fopen(fn, "rb+"); - if (dev->f == NULL) { - dev->f = plat_fopen(fn, "rb"); - if (dev->f == NULL) { + dev->fp = plat_fopen(fn, "rb+"); + if (dev->fp == NULL) { + dev->fp = plat_fopen(fn, "rb"); + if (dev->fp == NULL) { free(dev); memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); return; @@ -710,23 +710,23 @@ img_load(int drive, char *fn) if (!strcasecmp(ext, "FDI")) { /* This is a Japanese FDI image, so let's read the header */ img_log("img_load(): File is a Japanese FDI image...\n"); - fseek(dev->f, 0x10, SEEK_SET); - (void) !fread(&bpb_bps, 1, 2, dev->f); - fseek(dev->f, 0x0C, SEEK_SET); - (void) !fread(&size, 1, 4, dev->f); + fseek(dev->fp, 0x10, SEEK_SET); + (void) !fread(&bpb_bps, 1, 2, dev->fp); + fseek(dev->fp, 0x0C, SEEK_SET); + (void) !fread(&size, 1, 4, dev->fp); bpb_total = size / bpb_bps; - fseek(dev->f, 0x08, SEEK_SET); - (void) !fread(&(dev->base), 1, 4, dev->f); - fseek(dev->f, dev->base + 0x15, SEEK_SET); - bpb_mid = fgetc(dev->f); + fseek(dev->fp, 0x08, SEEK_SET); + (void) !fread(&(dev->base), 1, 4, dev->fp); + fseek(dev->fp, dev->base + 0x15, SEEK_SET); + bpb_mid = fgetc(dev->fp); if (bpb_mid < 0xF0) bpb_mid = 0xF0; - fseek(dev->f, 0x14, SEEK_SET); - bpb_sectors = fgetc(dev->f); - fseek(dev->f, 0x18, SEEK_SET); - bpb_sides = fgetc(dev->f); - fseek(dev->f, dev->base, SEEK_SET); - first_byte = fgetc(dev->f); + fseek(dev->fp, 0x14, SEEK_SET); + bpb_sectors = fgetc(dev->fp); + fseek(dev->fp, 0x18, SEEK_SET); + bpb_sides = fgetc(dev->fp); + fseek(dev->fp, dev->base, SEEK_SET); + first_byte = fgetc(dev->fp); fdi = 1; cqm = 0; @@ -734,53 +734,53 @@ img_load(int drive, char *fn) fdf = 0; } else { /* Read the first four bytes. */ - fseek(dev->f, 0x00, SEEK_SET); - first_byte = fgetc(dev->f); - fseek(dev->f, 0x01, SEEK_SET); - second_byte = fgetc(dev->f); - fseek(dev->f, 0x02, SEEK_SET); - third_byte = fgetc(dev->f); - fseek(dev->f, 0x03, SEEK_SET); - fourth_byte = fgetc(dev->f); + fseek(dev->fp, 0x00, SEEK_SET); + first_byte = fgetc(dev->fp); + fseek(dev->fp, 0x01, SEEK_SET); + second_byte = fgetc(dev->fp); + fseek(dev->fp, 0x02, SEEK_SET); + third_byte = fgetc(dev->fp); + fseek(dev->fp, 0x03, SEEK_SET); + fourth_byte = fgetc(dev->fp); if ((first_byte == 0x1A) && (second_byte == 'F') && (third_byte == 'D') && (fourth_byte == 'F')) { /* This is a FDF image. */ img_log("img_load(): File is a FDF image...\n"); fwriteprot[drive] = writeprot[drive] = 1; - fclose(dev->f); - dev->f = plat_fopen(fn, "rb"); + fclose(dev->fp); + dev->fp = plat_fopen(fn, "rb"); fdf = 1; cqm = 0; dev->disk_at_once = 1; - fseek(dev->f, 0x50, SEEK_SET); - (void) !fread(&dev->tracks, 1, 4, dev->f); + fseek(dev->fp, 0x50, SEEK_SET); + (void) !fread(&dev->tracks, 1, 4, dev->fp); /* Decode the entire file - pass 1, no write to buffer, determine length. */ - fseek(dev->f, 0x80, SEEK_SET); + fseek(dev->fp, 0x80, SEEK_SET); size = 0; track_bytes = 0; bpos = dev->disk_data; - while (!feof(dev->f)) { + while (!feof(dev->fp)) { if (!track_bytes) { /* Skip first 3 bytes - their meaning is unknown to us but could be a checksum. */ - first_byte = fgetc(dev->f); - (void) !fread(&track_bytes, 1, 2, dev->f); + first_byte = fgetc(dev->fp); + (void) !fread(&track_bytes, 1, 2, dev->fp); img_log("Block header: %02X %04X ", first_byte, track_bytes); /* Read the length of encoded data block. */ - (void) !fread(&track_bytes, 1, 2, dev->f); + (void) !fread(&track_bytes, 1, 2, dev->fp); img_log("%04X\n", track_bytes); } - if (feof(dev->f)) + if (feof(dev->fp)) break; if (first_byte == 0xFF) break; if (first_byte) { - run = fgetc(dev->f); + run = fgetc(dev->fp); /* I *HAVE* to read something because fseek tries to be smart and never hits EOF, causing an infinite loop. */ track_bytes--; @@ -788,12 +788,12 @@ img_load(int drive, char *fn) if (run & 0x80) { /* Repeat. */ track_bytes--; - rep_byte = fgetc(dev->f); + rep_byte = fgetc(dev->fp); } else { /* Literal. */ track_bytes -= (run & 0x7f); literal = (uint8_t *) malloc(run & 0x7f); - (void) !fread(literal, 1, (run & 0x7f), dev->f); + (void) !fread(literal, 1, (run & 0x7f), dev->fp); free(literal); } size += (run & 0x7f); @@ -803,12 +803,12 @@ img_load(int drive, char *fn) /* Literal block. */ size += (track_bytes - fdf_suppress_final_byte); literal = (uint8_t *) malloc(track_bytes); - (void) !fread(literal, 1, track_bytes, dev->f); + (void) !fread(literal, 1, track_bytes, dev->fp); free(literal); track_bytes = 0; } - if (feof(dev->f)) + if (feof(dev->fp)) break; } @@ -816,28 +816,28 @@ img_load(int drive, char *fn) dev->disk_data = (uint8_t *) malloc(size); /* Decode the entire file - pass 2, write to buffer. */ - fseek(dev->f, 0x80, SEEK_SET); + fseek(dev->fp, 0x80, SEEK_SET); track_bytes = 0; bpos = dev->disk_data; - while (!feof(dev->f)) { + while (!feof(dev->fp)) { if (!track_bytes) { /* Skip first 3 bytes - their meaning is unknown to us but could be a checksum. */ - first_byte = fgetc(dev->f); - (void) !fread(&track_bytes, 1, 2, dev->f); + first_byte = fgetc(dev->fp); + (void) !fread(&track_bytes, 1, 2, dev->fp); img_log("Block header: %02X %04X ", first_byte, track_bytes); /* Read the length of encoded data block. */ - (void) !fread(&track_bytes, 1, 2, dev->f); + (void) !fread(&track_bytes, 1, 2, dev->fp); img_log("%04X\n", track_bytes); } - if (feof(dev->f)) + if (feof(dev->fp)) break; if (first_byte == 0xFF) break; if (first_byte) { - run = fgetc(dev->f); + run = fgetc(dev->fp); real_run = (run & 0x7f); /* I *HAVE* to read something because fseek tries to be smart and never hits EOF, causing an infinite loop. */ @@ -848,14 +848,14 @@ img_load(int drive, char *fn) track_bytes--; if (!track_bytes) real_run -= fdf_suppress_final_byte; - rep_byte = fgetc(dev->f); + rep_byte = fgetc(dev->fp); if (real_run) memset(bpos, rep_byte, real_run); } else { /* Literal. */ track_bytes -= real_run; literal = (uint8_t *) malloc(real_run); - (void) !fread(literal, 1, real_run, dev->f); + (void) !fread(literal, 1, real_run, dev->fp); if (!track_bytes) real_run -= fdf_suppress_final_byte; if (run & 0x7f) @@ -866,14 +866,14 @@ img_load(int drive, char *fn) } else { /* Literal block. */ literal = (uint8_t *) malloc(track_bytes); - (void) !fread(literal, 1, track_bytes, dev->f); + (void) !fread(literal, 1, track_bytes, dev->fp); memcpy(bpos, literal, track_bytes - fdf_suppress_final_byte); free(literal); bpos += (track_bytes - fdf_suppress_final_byte); track_bytes = 0; } - if (feof(dev->f)) + if (feof(dev->fp)) break; } @@ -892,48 +892,48 @@ img_load(int drive, char *fn) if (((first_byte == 'C') && (second_byte == 'Q')) || ((first_byte == 'c') && (second_byte == 'q'))) { img_log("img_load(): File is a CopyQM image...\n"); fwriteprot[drive] = writeprot[drive] = 1; - fclose(dev->f); - dev->f = plat_fopen(fn, "rb"); + fclose(dev->fp); + dev->fp = plat_fopen(fn, "rb"); - fseek(dev->f, 0x03, SEEK_SET); - (void) !fread(&bpb_bps, 1, 2, dev->f); + fseek(dev->fp, 0x03, SEEK_SET); + (void) !fread(&bpb_bps, 1, 2, dev->fp); #if 0 - fseek(dev->f, 0x0B, SEEK_SET); - (void) !fread(&bpb_total, 1, 2, dev->f); + fseek(dev->fp, 0x0B, SEEK_SET); + (void) !fread(&bpb_total, 1, 2, dev->fp); #endif - fseek(dev->f, 0x10, SEEK_SET); - bpb_sectors = fgetc(dev->f); - fseek(dev->f, 0x12, SEEK_SET); - bpb_sides = fgetc(dev->f); - fseek(dev->f, 0x5B, SEEK_SET); - dev->tracks = fgetc(dev->f); + fseek(dev->fp, 0x10, SEEK_SET); + bpb_sectors = fgetc(dev->fp); + fseek(dev->fp, 0x12, SEEK_SET); + bpb_sides = fgetc(dev->fp); + fseek(dev->fp, 0x5B, SEEK_SET); + dev->tracks = fgetc(dev->fp); bpb_total = ((uint16_t) bpb_sectors) * ((uint16_t) bpb_sides) * dev->tracks; - fseek(dev->f, 0x74, SEEK_SET); - dev->interleave = fgetc(dev->f); - fseek(dev->f, 0x76, SEEK_SET); - dev->skew = fgetc(dev->f); + fseek(dev->fp, 0x74, SEEK_SET); + dev->interleave = fgetc(dev->fp); + fseek(dev->fp, 0x76, SEEK_SET); + dev->skew = fgetc(dev->fp); dev->disk_data = (uint8_t *) malloc(((uint32_t) bpb_total) * ((uint32_t) bpb_bps)); memset(dev->disk_data, 0xf6, ((uint32_t) bpb_total) * ((uint32_t) bpb_bps)); - fseek(dev->f, 0x6F, SEEK_SET); - (void) !fread(&comment_len, 1, 2, dev->f); + fseek(dev->fp, 0x6F, SEEK_SET); + (void) !fread(&comment_len, 1, 2, dev->fp); - fseek(dev->f, -1, SEEK_END); - size = ftell(dev->f) + 1; + fseek(dev->fp, -1, SEEK_END); + size = ftell(dev->fp) + 1; - fseek(dev->f, 133 + comment_len, SEEK_SET); + fseek(dev->fp, 133 + comment_len, SEEK_SET); cur_pos = 0; - while (!feof(dev->f)) { - (void) !fread(&block_len, 1, 2, dev->f); + while (!feof(dev->fp)) { + (void) !fread(&block_len, 1, 2, dev->fp); - if (!feof(dev->f)) { + if (!feof(dev->fp)) { if (block_len < 0) { - rep_byte = fgetc(dev->f); + rep_byte = fgetc(dev->fp); block_len = -block_len; if ((cur_pos + block_len) > ((uint32_t) bpb_total) * ((uint32_t) bpb_bps)) { block_len = ((uint32_t) bpb_total) * ((uint32_t) bpb_bps) - cur_pos; @@ -946,10 +946,10 @@ img_load(int drive, char *fn) } else if (block_len > 0) { if ((cur_pos + block_len) > ((uint32_t) bpb_total) * ((uint32_t) bpb_bps)) { block_len = ((uint32_t) bpb_total) * ((uint32_t) bpb_bps) - cur_pos; - (void) !fread(dev->disk_data + cur_pos, 1, block_len, dev->f); + (void) !fread(dev->disk_data + cur_pos, 1, block_len, dev->fp); break; } else { - (void) !fread(dev->disk_data + cur_pos, 1, block_len, dev->f); + (void) !fread(dev->disk_data + cur_pos, 1, block_len, dev->fp); cur_pos += block_len; } } @@ -969,22 +969,22 @@ img_load(int drive, char *fn) fwriteprot[drive] = writeprot[drive] = 1; } else img_log("img_load(): File is a raw image...\n"); - fseek(dev->f, dev->base + 0x0B, SEEK_SET); - (void) !fread(&bpb_bps, 1, 2, dev->f); - fseek(dev->f, dev->base + 0x13, SEEK_SET); - (void) !fread(&bpb_total, 1, 2, dev->f); - fseek(dev->f, dev->base + 0x15, SEEK_SET); - bpb_mid = fgetc(dev->f); - fseek(dev->f, dev->base + 0x18, SEEK_SET); - bpb_sectors = fgetc(dev->f); - fseek(dev->f, dev->base + 0x1A, SEEK_SET); - bpb_sides = fgetc(dev->f); + fseek(dev->fp, dev->base + 0x0B, SEEK_SET); + (void) !fread(&bpb_bps, 1, 2, dev->fp); + fseek(dev->fp, dev->base + 0x13, SEEK_SET); + (void) !fread(&bpb_total, 1, 2, dev->fp); + fseek(dev->fp, dev->base + 0x15, SEEK_SET); + bpb_mid = fgetc(dev->fp); + fseek(dev->fp, dev->base + 0x18, SEEK_SET); + bpb_sectors = fgetc(dev->fp); + fseek(dev->fp, dev->base + 0x1A, SEEK_SET); + bpb_sides = fgetc(dev->fp); cqm = 0; } - fseek(dev->f, -1, SEEK_END); - size = ftell(dev->f) + 1; + fseek(dev->fp, -1, SEEK_END); + size = ftell(dev->fp) + 1; if (ddi) size -= 0x2400; @@ -1125,7 +1125,7 @@ jump_if_fdf: dev->tracks = 86; } else { img_log("Image is bigger than can fit on an ED floppy, ejecting...\n"); - fclose(dev->f); + fclose(dev->fp); free(dev); memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); return; @@ -1138,9 +1138,9 @@ jump_if_fdf: /* The BPB readings appear to be valid, so let's set the values. */ if (fdi) { /* The image is a Japanese FDI, therefore we read the number of tracks from the header. */ - if (fseek(dev->f, 0x1C, SEEK_SET) == -1) + if (fseek(dev->fp, 0x1C, SEEK_SET) == -1) fatal("Japanese FDI: Failed when seeking to 0x1C\n"); - (void) !fread(&(dev->tracks), 1, 4, dev->f); + (void) !fread(&(dev->tracks), 1, 4, dev->fp); } else { if (!cqm && !fdf) { /* Number of tracks = number of total sectors divided by sides times sectors per track. */ @@ -1182,7 +1182,7 @@ jump_if_fdf: if (temp_rate == 0xFF) { img_log("Image is bigger than can fit on an ED floppy, ejecting...\n"); - fclose(dev->f); + fclose(dev->fp); free(dev); memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); return; @@ -1199,7 +1199,7 @@ jump_if_fdf: } if (!dev->gap3_size) { img_log("ERROR: Floppy image of unknown format was inserted into drive %c:!\n", drive + 0x41); - fclose(dev->f); + fclose(dev->fp); free(dev); memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); return; @@ -1259,9 +1259,9 @@ img_close(int drive) d86f_unregister(drive); - if (dev->f != NULL) { - fclose(dev->f); - dev->f = NULL; + if (dev->fp != NULL) { + fclose(dev->fp); + dev->fp = NULL; } if (dev->disk_data != NULL) diff --git a/src/floppy/fdd_json.c b/src/floppy/fdd_json.c index 1b70d8fc8..440fcf694 100644 --- a/src/floppy/fdd_json.c +++ b/src/floppy/fdd_json.c @@ -62,7 +62,7 @@ #define NSIDES 2 #define NSECTORS 256 -typedef struct { +typedef struct sector_t { uint8_t track; /* ID: track number */ uint8_t side; /* side number */ uint8_t sector; /* sector number 1.. */ @@ -70,8 +70,8 @@ typedef struct { uint8_t *data; /* allocated data for it */ } sector_t; -typedef struct { - FILE *f; +typedef struct json_t { + FILE *fp; /* Geometry. */ uint8_t tracks; /* number of tracks */ @@ -215,7 +215,7 @@ load_image(json_t *dev) int level; char *ptr; - if (dev->f == NULL) { + if (dev->fp == NULL) { json_log("JSON: no file loaded!\n"); return 0; } @@ -232,8 +232,8 @@ load_image(json_t *dev) level = state = 0; while (state >= 0) { /* Get a character from the input. */ - c = fgetc(dev->f); - if ((c == EOF) || ferror(dev->f)) { + c = fgetc(dev->fp); + if ((c == EOF) || ferror(dev->fp)) { state = -1; break; } @@ -372,6 +372,9 @@ load_image(json_t *dev) } dev->track++; break; + + default: + break; } } @@ -396,7 +399,7 @@ json_seek(int drive, int track) int rsec; int asec; - if (dev->f == NULL) { + if (dev->fp == NULL) { json_log("JSON: seek: no file loaded!\n"); return; } @@ -530,8 +533,8 @@ json_load(int drive, char *fn) memset(dev, 0x00, sizeof(json_t)); /* Open the image file. */ - dev->f = plat_fopen(fn, "rb"); - if (dev->f == NULL) { + dev->fp = plat_fopen(fn, "rb"); + if (dev->fp == NULL) { free(dev); memset(fn, 0x00, sizeof(char)); return; @@ -546,7 +549,7 @@ json_load(int drive, char *fn) /* Load all sectors from the image file. */ if (!load_image(dev)) { json_log("JSON: failed to initialize\n"); - (void) fclose(dev->f); + (void) fclose(dev->fp); free(dev); images[drive] = NULL; memset(fn, 0x00, sizeof(char)); @@ -608,8 +611,8 @@ json_load(int drive, char *fn) if (temp_rate == 0xff) { json_log("JSON: invalid image (temp_rate=0xff)\n"); - (void) fclose(dev->f); - dev->f = NULL; + (void) fclose(dev->fp); + dev->fp = NULL; free(dev); images[drive] = NULL; memset(fn, 0x00, sizeof(char)); @@ -630,8 +633,8 @@ json_load(int drive, char *fn) if (!dev->gap3_len) { json_log("JSON: image of unknown format was inserted into drive %c:!\n", 'C' + drive); - (void) fclose(dev->f); - dev->f = NULL; + (void) fclose(dev->fp); + dev->fp = NULL; free(dev); images[drive] = NULL; memset(fn, 0x00, sizeof(char)); @@ -692,8 +695,8 @@ json_close(int drive) } } - if (dev->f != NULL) - (void) fclose(dev->f); + if (dev->fp != NULL) + (void) fclose(dev->fp); /* Release the memory. */ free(dev); diff --git a/src/floppy/fdd_mfm.c b/src/floppy/fdd_mfm.c index 5719c3672..86cca92ae 100644 --- a/src/floppy/fdd_mfm.c +++ b/src/floppy/fdd_mfm.c @@ -32,7 +32,7 @@ #include <86box/fdc.h> #pragma pack(push, 1) -typedef struct { +typedef struct mfm_header_t { uint8_t hdr_name[7]; uint16_t tracks_no; @@ -45,14 +45,14 @@ typedef struct { uint32_t track_list_offset; } mfm_header_t; -typedef struct { +typedef struct mfm_track_t { uint16_t track_no; uint8_t side_no; uint32_t track_size; uint32_t track_offset; } mfm_track_t; -typedef struct { +typedef struct mfm_adv_track_t { uint16_t track_no; uint8_t side_no; uint16_t rpm; @@ -62,8 +62,8 @@ typedef struct { } mfm_adv_track_t; #pragma pack(pop) -typedef struct { - FILE *f; +typedef struct mfm_t { + FILE *fp; mfm_header_t hdr; mfm_track_t *tracks; @@ -345,12 +345,12 @@ mfm_read_side(int drive, int side) memset(dev->track_data[side], 0x00, track_bytes); else { if (dev->hdr.if_type & 0x80) - ret = fseek(dev->f, dev->adv_tracks[track_index].track_offset, SEEK_SET); + ret = fseek(dev->fp, dev->adv_tracks[track_index].track_offset, SEEK_SET); else - ret = fseek(dev->f, dev->tracks[track_index].track_offset, SEEK_SET); + ret = fseek(dev->fp, dev->tracks[track_index].track_offset, SEEK_SET); if (ret == -1) fatal("mfm_read_side(): Error seeking to the beginning of the file\n"); - if (fread(dev->track_data[side], 1, track_bytes, dev->f) != track_bytes) + if (fread(dev->track_data[side], 1, track_bytes, dev->fp) != track_bytes) fatal("mfm_read_side(): Error reading track bytes\n"); } @@ -373,7 +373,7 @@ mfm_seek(int drive, int track) dev->cur_track = track; d86f_set_cur_track(drive, track); - if (dev->f == NULL) + if (dev->fp == NULL) return; if (track < 0) @@ -399,8 +399,8 @@ mfm_load(int drive, char *fn) dev = (mfm_t *) malloc(sizeof(mfm_t)); memset(dev, 0x00, sizeof(mfm_t)); - dev->f = plat_fopen(fn, "rb"); - if (dev->f == NULL) { + dev->fp = plat_fopen(fn, "rb"); + if (dev->fp == NULL) { free(dev); memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); return; @@ -410,7 +410,7 @@ mfm_load(int drive, char *fn) /* Read the header. */ size = sizeof(mfm_header_t); - if (fread(&dev->hdr, 1, size, dev->f) != size) + if (fread(&dev->hdr, 1, size, dev->fp) != size) fatal("mfm_load(): Error reading header\n"); /* Calculate tracks * sides, allocate the tracks array, and read it. */ @@ -418,12 +418,12 @@ mfm_load(int drive, char *fn) if (dev->hdr.if_type & 0x80) { dev->adv_tracks = (mfm_adv_track_t *) malloc(dev->total_tracks * sizeof(mfm_adv_track_t)); size = dev->total_tracks * sizeof(mfm_adv_track_t); - if (fread(dev->adv_tracks, 1, size, dev->f) != size) + if (fread(dev->adv_tracks, 1, size, dev->fp) != size) fatal("mfm_load(): Error reading advanced tracks\n"); } else { dev->tracks = (mfm_track_t *) malloc(dev->total_tracks * sizeof(mfm_track_t)); size = dev->total_tracks * sizeof(mfm_track_t); - if (fread(dev->tracks, 1, size, dev->f) != size) + if (fread(dev->tracks, 1, size, dev->fp) != size) fatal("mfm_load(): Error reading tracks\n"); } @@ -504,8 +504,8 @@ mfm_close(int drive) if (dev->adv_tracks) free(dev->adv_tracks); - if (dev->f) - fclose(dev->f); + if (dev->fp) + fclose(dev->fp); /* Release the memory. */ free(dev); diff --git a/src/floppy/fdd_td0.c b/src/floppy/fdd_td0.c index 87856b904..4ca1fdc6c 100644 --- a/src/floppy/fdd_td0.c +++ b/src/floppy/fdd_td0.c @@ -60,7 +60,7 @@ /* update when cumulative frequency */ /* reaches to this value */ -typedef struct { +typedef struct tdlzhuf_t { uint16_t r; uint16_t bufcnt; /* string buffer */ uint16_t bufndx; /* string buffer */ @@ -72,7 +72,7 @@ typedef struct { uint8_t inbuf[BUFSZ]; /* input buffer */ } tdlzhuf; -typedef struct { +typedef struct td0dsk_t { FILE *fdd_file; off_t fdd_file_offset; @@ -93,7 +93,7 @@ typedef struct { uint8_t getlen; } td0dsk_t; -typedef struct { +typedef struct td0_sector_t { uint8_t track; uint8_t head; uint8_t sector; @@ -103,8 +103,8 @@ typedef struct { uint8_t *data; } td0_sector_t; -typedef struct { - FILE *f; +typedef struct td0_t { + FILE *fp; int tracks; int track_width; @@ -227,9 +227,9 @@ fdd_image_read(int drive, char *buffer, uint32_t offset, uint32_t len) { td0_t *dev = td0[drive]; - if (fseek(dev->f, offset, SEEK_SET) == -1) + if (fseek(dev->fp, offset, SEEK_SET) == -1) fatal("fdd_image_read(): Error seeking to the beginning of the file\n"); - if (fread(buffer, 1, len, dev->f) != len) + if (fread(buffer, 1, len, dev->fp) != len) fatal("fdd_image_read(): Error reading data\n"); } @@ -627,13 +627,13 @@ td0_initialize(int drive) int size_diff; int gap_sum; - if (dev->f == NULL) { + if (dev->fp == NULL) { td0_log("TD0: Attempted to initialize without loading a file first\n"); return 0; } - fseek(dev->f, 0, SEEK_END); - file_size = ftell(dev->f); + fseek(dev->fp, 0, SEEK_END); + file_size = ftell(dev->fp); if (file_size < 12) { td0_log("TD0: File is too small to even contain the header\n"); @@ -645,21 +645,21 @@ td0_initialize(int drive) return 0; } - fseek(dev->f, 0, SEEK_SET); - (void) !fread(header, 1, 12, dev->f); + fseek(dev->fp, 0, SEEK_SET); + (void) !fread(header, 1, 12, dev->fp); head_count = header[9]; if (header[0] == 't') { td0_log("TD0: File is compressed\n"); - disk_decode.fdd_file = dev->f; + disk_decode.fdd_file = dev->fp; state_init_Decode(&disk_decode); disk_decode.fdd_file_offset = 12; state_Decode(&disk_decode, dev->imagebuf, TD0_MAX_BUFSZ); } else { td0_log("TD0: File is uncompressed\n"); - if (fseek(dev->f, 12, SEEK_SET) == -1) + if (fseek(dev->fp, 12, SEEK_SET) == -1) fatal("td0_initialize(): Error seeking to offet 12\n"); - if (fread(dev->imagebuf, 1, file_size - 12, dev->f) != (file_size - 12)) + if (fread(dev->imagebuf, 1, file_size - 12, dev->fp) != (file_size - 12)) fatal("td0_initialize(): Error reading image buffer\n"); } @@ -710,6 +710,9 @@ td0_initialize(int drive) dev->default_track_flags = (density == 1) ? 0x00 : ((density == 2) ? 0x03 : 0x02); dev->max_sector_size = (density == 1) ? 6 : ((density == 2) ? 7 : 5); /* 16384, 8192, or 4096 bytes. */ break; + + default: + break; } dev->disk_flags = header[5] & 0x06; @@ -1064,7 +1067,7 @@ td0_seek(int drive, int track) int fm; int sector_adjusted; - if (dev->f == NULL) + if (dev->fp == NULL) return; if (!dev->track_width && fdd_doublestep_40(drive)) @@ -1182,8 +1185,8 @@ td0_abort(int drive) free(dev->imagebuf); if (dev->processed_buf) free(dev->processed_buf); - if (dev->f) - fclose(dev->f); + if (dev->fp) + fclose(dev->fp); memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); free(dev); td0[drive] = NULL; @@ -1203,8 +1206,8 @@ td0_load(int drive, char *fn) memset(dev, 0x00, sizeof(td0_t)); td0[drive] = dev; - dev->f = plat_fopen(fn, "rb"); - if (dev->f == NULL) { + dev->fp = plat_fopen(fn, "rb"); + if (dev->fp == NULL) { memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); return; } @@ -1285,8 +1288,8 @@ td0_close(int drive) memset(dev->sects[i][j], 0, sizeof(td0_sector_t)); } - if (dev->f != NULL) - fclose(dev->f); + if (dev->fp != NULL) + fclose(dev->fp); /* Release resources. */ free(dev); diff --git a/src/floppy/fdi2raw.c b/src/floppy/fdi2raw.c index 7210c89b2..da54f56ab 100644 --- a/src/floppy/fdi2raw.c +++ b/src/floppy/fdi2raw.c @@ -36,7 +36,9 @@ #include #include <86box/plat_unused.h> +#ifdef DEBUG #undef DEBUG +#endif #define VERBOSE #undef VERBOSE @@ -96,24 +98,24 @@ static int fdi_allocated; #ifdef DEBUG static void -fdi_free(void *p) +fdi_free(void *priv) { int size; - if (!p) + if (!priv) return; - size = ((int *) p)[-1]; + size = ((int *) priv)[-1]; fdi_allocated -= size; write_log("%d freed (%d)\n", size, fdi_allocated); - free((int *) p - 1); + free((int *) priv - 1); } static void * fdi_malloc(int size) { - void *p = xmalloc(size + sizeof(int)); - ((int *) p)[0] = size; + void *priv = xmalloc(size + sizeof(int)); + ((int *) prv)[0] = size; fdi_allocated += size; write_log("%d allocated (%d)\n", size, fdi_allocated); - return (int *) p + 1; + return (int *) priv + 1; } #else # define fdi_free free @@ -1290,6 +1292,9 @@ track_atari_st(struct fdi *fdi, int max_sector) case 10: gap3 = 24; break; + + default: + break; } s15(fdi); for (int i = 0; i < max_sector; i++) { @@ -1944,8 +1949,8 @@ decode_lowlevel_track(FDI *fdi, int track, struct fdi_cache *cache) uint32_t maxidx; uint32_t totalavg; uint32_t weakbits; - int i; int j; + int k; int len; int pulses; int indexoffset; @@ -1974,7 +1979,7 @@ decode_lowlevel_track(FDI *fdi, int track, struct fdi_cache *cache) maxp = (uint32_t *) fdi_decompress(pulses, p1 + 6, p1 + len, &max_free); len += get_u24(p1 + 6) & 0x3fffff; /* Computes the real min and max values */ - for (i = 0; i < pulses; i++) { + for (int i = 0; i < pulses; i++) { maxp[i] = avgp[i] + minp[i] - maxp[i]; minp[i] = avgp[i] - minp[i]; } @@ -2000,7 +2005,7 @@ decode_lowlevel_track(FDI *fdi, int track, struct fdi_cache *cache) } else { idxp = fdi_malloc(pulses * 2); idx_free = 1; - for (i = 0; i < pulses; i++) { + for (int i = 0; i < pulses; i++) { idxp[i * 2 + 0] = 2; idxp[i * 2 + 1] = 0; } @@ -2011,43 +2016,43 @@ decode_lowlevel_track(FDI *fdi, int track, struct fdi_cache *cache) maxidx = 0; indexoffset = 0; p1 = idxp; - for (i = 0; i < pulses; i++) { + for (int i = 0; i < pulses; i++) { if ((uint32_t) p1[idx_off1] + (uint32_t) p1[idx_off2] > maxidx) maxidx = p1[idx_off1] + p1[idx_off2]; p1 += idx_off3; } p1 = idxp; - for (i = 0; (i < pulses) && (p1[idx_off2] != 0); i++) /* falling edge, replace with idx_off1 for rising edge */ + for (k = 0; (k < pulses) && (p1[idx_off2] != 0); k++) /* falling edge, replace with idx_off1 for rising edge */ p1 += idx_off3; - if (i < pulses) { - j = i; + if (k < pulses) { + j = k; do { - i++; + k++; p1 += idx_off3; - if (i >= pulses) { - i = 0; + if (k >= pulses) { + k = 0; p1 = idxp; } - } while ((i != j) && (p1[idx_off2] == 0)); /* falling edge, replace with idx_off1 for rising edge */ - if (i != j) /* index pulse detected */ + } while ((k != j) && (p1[idx_off2] == 0)); /* falling edge, replace with idx_off1 for rising edge */ + if (k != j) /* index pulse detected */ { - while ((i != j) && (p1[idx_off1] > p1[idx_off2])) { /* falling edge, replace with "<" for rising edge */ - i++; + while ((k != j) && (p1[idx_off1] > p1[idx_off2])) { /* falling edge, replace with "<" for rising edge */ + k++; p1 += idx_off3; - if (i >= pulses) { - i = 0; + if (k >= pulses) { + k = 0; p1 = idxp; } } - if (i != j) - indexoffset = i; /* index position detected */ + if (k != j) + indexoffset = k; /* index position detected */ } } p1 = idxp; p2 = avgp; totalavg = 0; weakbits = 0; - for (i = 0; i < pulses; i++) { + for (int i = 0; i < pulses; i++) { uint32_t sum = p1[idx_off1] + p1[idx_off2]; if (sum >= maxidx) { totalavg += *p2; diff --git a/src/gdbstub.c b/src/gdbstub.c index 867ebe1d1..2cf49837e 100644 --- a/src/gdbstub.c +++ b/src/gdbstub.c @@ -120,13 +120,20 @@ typedef struct _gdbstub_client_ { int socket; struct sockaddr_in addr; - char packet[16384], response[16384]; - int has_packet : 1, first_packet_received : 1, ida_mode : 1, waiting_stop : 1, - packet_pos, response_pos; + char packet[16384], response[16384]; + uint8_t has_packet : 1; + uint8_t first_packet_received : 1; + uint8_t ida_mode : 1; + uint8_t waiting_stop : 1; + int packet_pos; + int response_pos; - event_t *processed_event, *response_event; + event_t *processed_event; + event_t *response_event; - uint16_t last_io_base, last_io_len, last_io_value; + uint16_t last_io_base; + uint16_t last_io_len; + uint16_t last_io_value; struct _gdbstub_client_ *next; } gdbstub_client_t; @@ -339,7 +346,8 @@ static gdbstub_breakpoint_t *first_rwatch = NULL; static gdbstub_breakpoint_t *first_wwatch = NULL; static gdbstub_breakpoint_t *first_awatch = NULL; -int gdbstub_step = 0, gdbstub_next_asap = 0; +int gdbstub_step = 0; +int gdbstub_next_asap = 0; uint64_t gdbstub_watch_pages[(((uint32_t) -1) >> (MEM_GRANULARITY_BITS + 6)) + 1]; static void @@ -461,6 +469,9 @@ gdbstub_num_decode(char *p, int *dest, int mode) else return 0; break; + + default: + break; } p++; } @@ -1491,7 +1502,6 @@ gdbstub_client_thread(void *priv) gdbstub_client_t *client = (gdbstub_client_t *) priv; uint8_t buf[256]; ssize_t bytes_read; - int i; gdbstub_log("GDB Stub: New connection from %s:%d\n", inet_ntoa(client->addr.sin_addr), client->addr.sin_port); @@ -1500,7 +1510,7 @@ gdbstub_client_thread(void *priv) /* Read data from client. */ while ((bytes_read = recv(client->socket, (char *) buf, sizeof(buf), 0)) > 0) { - for (i = 0; i < bytes_read; i++) { + for (ssize_t i = 0; i < bytes_read; i++) { switch (buf[i]) { case '$': /* packet start */ /* Wait for any existing packets to be processed. */ diff --git a/src/include/86box/mem.h b/src/include/86box/mem.h index 57ab009e3..30e9359bf 100644 --- a/src/include/86box/mem.h +++ b/src/include/86box/mem.h @@ -194,7 +194,7 @@ typedef struct _mem_mapping_ { /* There is never a needed to pass a pointer to the mapping itself, it is much preferable to prepare a structure with the requires data (usually, the base address and mask) instead. */ - void *p; /* backpointer to device */ + void *priv; /* backpointer to device */ } mem_mapping_t; #ifdef USE_NEW_DYNAREC @@ -207,9 +207,9 @@ extern uint64_t *byte_code_present_mask; # define EVICT_NOT_IN_LIST ((uint32_t) -1) typedef struct page_t { - void (*write_b)(uint32_t addr, uint8_t val, struct page_t *p); - void (*write_w)(uint32_t addr, uint16_t val, struct page_t *p); - void (*write_l)(uint32_t addr, uint32_t val, struct page_t *p); + void (*write_b)(uint32_t addr, uint8_t val, struct page_t *page); + void (*write_w)(uint32_t addr, uint16_t val, struct page_t *page); + void (*write_l)(uint32_t addr, uint32_t val, struct page_t *page); uint8_t *mem; @@ -218,9 +218,11 @@ typedef struct page_t { /*Head of codeblock tree associated with this page*/ uint16_t head; - uint64_t code_present_mask, dirty_mask; + uint64_t code_present_mask; + uint64_t dirty_mask; - uint32_t evict_prev, evict_next; + uint32_t evict_prev; + uint32_t evict_next; uint64_t *byte_dirty_mask; uint64_t *byte_code_present_mask; @@ -228,31 +230,33 @@ typedef struct page_t { extern uint32_t purgable_page_list_head; __attribute__((always_inline)) static inline int -page_in_evict_list(page_t *p) +page_in_evict_list(page_t *page) { - return (p->evict_prev != EVICT_NOT_IN_LIST); + return (page->evict_prev != EVICT_NOT_IN_LIST); } -void page_remove_from_evict_list(page_t *p); -void page_add_to_evict_list(page_t *p); +void page_remove_from_evict_list(page_t *page); +void page_add_to_evict_list(page_t *page); #else typedef struct _page_ { - void (*write_b)(uint32_t addr, uint8_t val, struct _page_ *p); - void (*write_w)(uint32_t addr, uint16_t val, struct _page_ *p); - void (*write_l)(uint32_t addr, uint32_t val, struct _page_ *p); + void (*write_b)(uint32_t addr, uint8_t val, struct _page_ *page); + void (*write_w)(uint32_t addr, uint16_t val, struct _page_ *page); + void (*write_l)(uint32_t addr, uint32_t val, struct _page_ *page); uint8_t *mem; - uint64_t code_present_mask[4], - dirty_mask[4]; + uint64_t code_present_mask[4]; + uint64_t dirty_mask[4]; - struct codeblock_t *block[4], *block_2[4]; + struct codeblock_t *block[4]; + struct codeblock_t *block_2[4]; /*Head of codeblock tree associated with this page*/ struct codeblock_t *head; } page_t; #endif -extern uint8_t *ram, *ram2; +extern uint8_t *ram; +extern uint8_t *ram2; extern uint32_t rammask; extern uint8_t *rom; @@ -336,37 +340,37 @@ extern void addwritelookup(uint32_t virt, uint32_t phys); extern void mem_mapping_set(mem_mapping_t *, uint32_t base, uint32_t size, - uint8_t (*read_b)(uint32_t addr, void *p), - uint16_t (*read_w)(uint32_t addr, void *p), - uint32_t (*read_l)(uint32_t addr, void *p), - void (*write_b)(uint32_t addr, uint8_t val, void *p), - void (*write_w)(uint32_t addr, uint16_t val, void *p), - void (*write_l)(uint32_t addr, uint32_t val, void *p), + uint8_t (*read_b)(uint32_t addr, void *priv), + uint16_t (*read_w)(uint32_t addr, void *priv), + uint32_t (*read_l)(uint32_t addr, void *priv), + void (*write_b)(uint32_t addr, uint8_t val, void *priv), + void (*write_w)(uint32_t addr, uint16_t val, void *priv), + void (*write_l)(uint32_t addr, uint32_t val, void *priv), uint8_t *exec, uint32_t flags, - void *p); + void *priv); extern void mem_mapping_add(mem_mapping_t *, uint32_t base, uint32_t size, - uint8_t (*read_b)(uint32_t addr, void *p), - uint16_t (*read_w)(uint32_t addr, void *p), - uint32_t (*read_l)(uint32_t addr, void *p), - void (*write_b)(uint32_t addr, uint8_t val, void *p), - void (*write_w)(uint32_t addr, uint16_t val, void *p), - void (*write_l)(uint32_t addr, uint32_t val, void *p), + uint8_t (*read_b)(uint32_t addr, void *priv), + uint16_t (*read_w)(uint32_t addr, void *priv), + uint32_t (*read_l)(uint32_t addr, void *priv), + void (*write_b)(uint32_t addr, uint8_t val, void *priv), + void (*write_w)(uint32_t addr, uint16_t val, void *priv), + void (*write_l)(uint32_t addr, uint32_t val, void *priv), uint8_t *exec, uint32_t flags, - void *p); + void *priv); extern void mem_mapping_set_handler(mem_mapping_t *, - uint8_t (*read_b)(uint32_t addr, void *p), - uint16_t (*read_w)(uint32_t addr, void *p), - uint32_t (*read_l)(uint32_t addr, void *p), - void (*write_b)(uint32_t addr, uint8_t val, void *p), - void (*write_w)(uint32_t addr, uint16_t val, void *p), - void (*write_l)(uint32_t addr, uint32_t val, void *p)); + uint8_t (*read_b)(uint32_t addr, void *priv), + uint16_t (*read_w)(uint32_t addr, void *priv), + uint32_t (*read_l)(uint32_t addr, void *priv), + void (*write_b)(uint32_t addr, uint8_t val, void *priv), + void (*write_w)(uint32_t addr, uint16_t val, void *priv), + void (*write_l)(uint32_t addr, uint32_t val, void *priv)); -extern void mem_mapping_set_p(mem_mapping_t *, void *p); +extern void mem_mapping_set_p(mem_mapping_t *, void *priv); extern void mem_mapping_set_addr(mem_mapping_t *, uint32_t base, uint32_t size); @@ -407,9 +411,9 @@ extern uint64_t mmutranslate_noabrt(uint32_t addr, int rw); extern void mem_invalidate_range(uint32_t start_addr, uint32_t end_addr); -extern void mem_write_ramb_page(uint32_t addr, uint8_t val, page_t *p); -extern void mem_write_ramw_page(uint32_t addr, uint16_t val, page_t *p); -extern void mem_write_raml_page(uint32_t addr, uint32_t val, page_t *p); +extern void mem_write_ramb_page(uint32_t addr, uint8_t val, page_t *page); +extern void mem_write_ramw_page(uint32_t addr, uint16_t val, page_t *page); +extern void mem_write_raml_page(uint32_t addr, uint32_t val, page_t *page); extern void mem_flush_write_page(uint32_t addr, uint32_t virt); extern void mem_reset_page_blocks(void); diff --git a/src/include/86box/midi.h b/src/include/86box/midi.h index 029ad06dc..af7fd217d 100644 --- a/src/include/86box/midi.h +++ b/src/include/86box/midi.h @@ -40,10 +40,11 @@ typedef struct midi_in_handler_t { int cnt; uint32_t len; - void (*msg)(void *p, uint8_t *msg, uint32_t len); - int (*sysex)(void *p, uint8_t *buffer, uint32_t len, int abort); - struct midi_in_handler_t *p; - struct midi_in_handler_t *prev, *next; + void (*msg)(void *priv, uint8_t *msg, uint32_t len); + int (*sysex)(void *priv, uint8_t *buffer, uint32_t len, int abort); + struct midi_in_handler_t *priv; + struct midi_in_handler_t *prev; + struct midi_in_handler_t *next; } midi_in_handler_t; typedef struct midi_t { @@ -77,7 +78,7 @@ extern void midi_raw_out_byte(uint8_t val); extern void midi_clear_buffer(void); extern void midi_poll(void); -extern void midi_in_handler(int set, void (*msg)(void *p, uint8_t *msg, uint32_t len), int (*sysex)(void *p, uint8_t *buffer, uint32_t len, int abort), void *p); +extern void midi_in_handler(int set, void (*msg)(void *p, uint8_t *msg, uint32_t len), int (*sysex)(void *p, uint8_t *buffer, uint32_t len, int abort), void *priv); extern void midi_in_handlers_clear(void); extern void midi_in_msg(uint8_t *msg, uint32_t len); extern void midi_in_sysex(uint8_t *buffer, uint32_t len); diff --git a/src/include/86box/pci.h b/src/include/86box/pci.h index 60c0d8742..df9c4c573 100644 --- a/src/include/86box/pci.h +++ b/src/include/86box/pci.h @@ -69,7 +69,7 @@ enum { PCI_CARD_SOUND = 0x13, PCI_CARD_IDE = 0x14, PCI_CARD_NETWORK = 0x15, - PCI_CARD_BRIDGE = 0x16, + PCI_CARD_BRIDGE = 0x16 }; enum { diff --git a/src/include/86box/timer.h b/src/include/86box/timer.h index 774729e17..e38ac51a3 100644 --- a/src/include/86box/timer.h +++ b/src/include/86box/timer.h @@ -47,8 +47,8 @@ typedef struct pc_timer_t { double period; /* This is used for large period timers to count the microseconds and split the period. */ - void (*callback)(void *p); - void *p; + void (*callback)(void *priv); + void *priv; struct pc_timer_t *prev; struct pc_timer_t *next; @@ -76,7 +76,7 @@ extern void timer_init(void); /*Add new timer. If start_timer is set, timer will be enabled with a zero timestamp - this is useful for permanently enabled timers*/ -extern void timer_add(pc_timer_t *timer, void (*callback)(void *p), void *p, int start_timer); +extern void timer_add(pc_timer_t *timer, void (*callback)(void *priv), void *priv, int start_timer); /*1us in 32:32 format*/ extern uint64_t TIMER_USEC; @@ -162,16 +162,16 @@ timer_get_remaining_u64(pc_timer_t *timer) /*Set timer callback function*/ static __inline void -timer_set_callback(pc_timer_t *timer, void (*callback)(void *p)) +timer_set_callback(pc_timer_t *timer, void (*callback)(void *priv)) { timer->callback = callback; } /*Set timer private data*/ static __inline void -timer_set_p(pc_timer_t *timer, void *p) +timer_set_p(pc_timer_t *timer, void *priv) { - timer->p = p; + timer->priv = priv; } /* The API for big timer periods starts here. */ @@ -209,7 +209,7 @@ timer_process_inline(void) if (timer->flags & TIMER_SPLIT) timer_advance_ex(timer, 0); /* We're splitting a > 1 s period into multiple <= 1 s periods. */ else if (timer->callback != NULL) /* Make sure it's no NULL, so that we can have a NULL callback when no operation is needed. */ - timer->callback(timer->p); + timer->callback(timer->priv); } timer_target = timer_head->ts.ts32.integer; diff --git a/src/include/86box/vid_8514a.h b/src/include/86box/vid_8514a.h index b21da9fba..efc6fbb6f 100644 --- a/src/include/86box/vid_8514a.h +++ b/src/include/86box/vid_8514a.h @@ -39,14 +39,18 @@ typedef struct ibm8514_t { struct { uint16_t subsys_cntl; uint16_t setup_md; - uint8_t advfunc_cntl, ext_advfunc_cntl; - uint16_t cur_y, cur_y_bitres; - uint16_t cur_x, cur_x_bitres; + uint8_t advfunc_cntl; + uint8_t ext_advfunc_cntl; + uint16_t cur_y; + uint16_t cur_y_bitres; + uint16_t cur_x; + uint16_t cur_x_bitres; int16_t desty_axstp; int16_t destx_distp; int16_t err_term; int16_t maj_axis_pcnt; - uint16_t cmd, cmd_back; + uint16_t cmd; + uint16_t cmd_back; uint16_t short_stroke; uint16_t bkgd_color; uint16_t frgd_color; @@ -57,63 +61,120 @@ typedef struct ibm8514_t { uint16_t frgd_mix; uint16_t multifunc_cntl; uint16_t multifunc[16]; - int16_t clip_left, clip_top; + int16_t clip_left; + int16_t clip_top; uint8_t pix_trans[2]; int poly_draw; int ssv_state; - int16_t x1, x2, x3, y1, y2; - int sys_cnt, sys_cnt2; + int x1; + int x2; + int x3; + int y1; + int y2; + int sys_cnt; + int sys_cnt2; int temp_cnt; - int16_t cx, cy, oldcy; - int16_t sx, sy; - int16_t dx, dy; + int16_t cx; + int16_t cy; + int16_t oldcy; + int16_t sx; + int16_t sy; + int16_t dx; + int16_t dy; int16_t err; - uint32_t src, dest; - uint32_t newsrc_blt, newdest_blt; - uint32_t newdest_in, newdest_out; - uint8_t *writemono, *nibbleset; - int x_count, xx_count, y_count; - int input, output; + uint32_t src; + uint16_t dest; + uint32_t newsrc_blt; + uint16_t newdest_blt; + uint32_t newdest_in; + uint16_t newdest_out; + uint8_t *writemono; + uint8_t *nibbleset; + int x_count; + int xx_count; + int y_count; + int input; + int output; - uint16_t cur_x_bit12, cur_y_bit12; + uint16_t cur_x_bit12; + uint16_t cur_y_bit12; int ssv_len; uint8_t ssv_dir; uint8_t ssv_draw; - int odd_in, odd_out; + int odd_in; + int odd_out; uint16_t scratch; - int fill_state, xdir, ydir; + int fill_state; + int xdir; + int ydir; uint32_t ge_offset; } accel; uint16_t test; - int ibm_mode; + int ibm_mode; - int v_total, dispend, v_syncstart, split, - h_disp, h_disp_old, h_total, h_disp_time, rowoffset, - dispon, hdisp_on, linecountff, - vc, linepos, oddeven, cursoron, blink, scrollcache, - firstline, lastline, firstline_draw, lastline_draw, - displine, fullchange; - uint32_t ma, maback; + int v_total; + int dispend; + int v_syncstart; + int split; + int h_disp; + int h_disp_old; + int h_total; + int h_disp_time; + int rowoffset; + int dispon; + int hdisp_on; + int linecountff; + int vc; + int linepos; + int oddeven; + int cursoron; + int blink; + int scrollcache; + int firstline; + int lastline; + int firstline_draw; + int lastline_draw; + int displine; + int fullchange; + uint32_t ma; + uint32_t maback; - uint8_t *vram, *changedvram, linedbl; + uint8_t *vram; + uint8_t *changedvram; + uint8_t linedbl; - uint8_t data_available, data_available2; - uint8_t scanmodulos, rowcount; - int htotal, hdisp, vtadj, vdadj, vsadj, sc, - vtb, vdb, vsb, vsyncstart, vsyncwidth; - int vtotal, vdisp; - int disp_cntl, interlace; - uint8_t subsys_cntl, subsys_stat; + uint8_t data_available; + uint8_t data_available2; + uint8_t scanmodulos; + uint8_t rowcount; + int htotal; + int hdisp; + int vtadj; + int vdadj; + int vsadj; + int sc; + int vtb; + int vdb; + int vsb; + int vsyncstart; + int vsyncwidth; + int vtotal; + int vdisp; + int disp_cntl; + int interlace; + uint8_t subsys_cntl; + uint8_t subsys_stat; - atomic_int force_busy, force_busy2; + atomic_int force_busy; + atomic_int force_busy2; int blitter_busy; uint64_t blitter_time; uint64_t status_time; - int pitch; - int ext_pitch; - int ext_crt_pitch; + int pitch; + int ext_pitch; + int ext_crt_pitch; } ibm8514_t; #endif /*VIDEO_8514A_H*/ diff --git a/src/include/86box/vid_ati_eeprom.h b/src/include/86box/vid_ati_eeprom.h index 7de5170d8..99af36eda 100644 --- a/src/include/86box/vid_ati_eeprom.h +++ b/src/include/86box/vid_ati_eeprom.h @@ -32,8 +32,12 @@ enum { typedef struct ati_eeprom_t { uint16_t data[256]; - int oldclk, oldena; - int opcode, state, count, out; + int oldclk; + int oldena; + int opcode; + int state; + int count; + int out; int wp; uint32_t dat; int type; diff --git a/src/include/86box/vid_cga.h b/src/include/86box/vid_cga.h index 39e1c24ef..414460acc 100644 --- a/src/include/86box/vid_cga.h +++ b/src/include/86box/vid_cga.h @@ -28,21 +28,31 @@ typedef struct cga_t { uint8_t cgastat; - uint8_t cgamode, cgacol; + uint8_t cgamode; + uint8_t cgacol; int fontbase; - int linepos, displine; - int sc, vc; + int linepos; + int displine; + int sc; + int vc; int cgadispon; - int con, coff, cursoron, cgablink; - int vsynctime, vadj; - uint16_t ma, maback; + int con; + int coff; + int cursoron; + int cgablink; + int vsynctime; + int vadj; + uint16_t ma; + uint16_t maback; int oddeven; - uint64_t dispontime, dispofftime; + uint64_t dispontime; + uint64_t dispofftime; pc_timer_t timer; - int firstline, lastline; + int firstline; + int lastline; int drawcursor; diff --git a/src/include/86box/vid_ega.h b/src/include/86box/vid_ega.h index 6c4eb02a8..97a08b583 100644 --- a/src/include/86box/vid_ega.h +++ b/src/include/86box/vid_ega.h @@ -27,11 +27,26 @@ typedef struct ega_t { rom_t bios_rom; - uint8_t crtcreg, gdcaddr, attraddr, attrff, - attr_palette_enable, seqaddr, miscout, - writemask, la, lb, lc, ld, - stat, colourcompare, colournocare, scrblank, - plane_mask, pad, pad0, pad1; + uint8_t crtcreg; + uint8_t gdcaddr; + uint8_t attraddr; + uint8_t attrff; + uint8_t attr_palette_enable; + uint8_t seqaddr; + uint8_t miscout; + uint8_t writemask; + uint8_t la; + uint8_t lb; + uint8_t lc; + uint8_t ld; + uint8_t stat; + uint8_t colourcompare; + uint8_t colournocare; + uint8_t scrblank; + uint8_t plane_mask; + uint8_t pad; + uint8_t pad0; + uint8_t pad1; uint8_t crtc[32]; uint8_t gdcreg[16]; uint8_t attrregs[32]; @@ -41,25 +56,72 @@ typedef struct ega_t { uint8_t *vram; - int vidclock, fast, extvram, vres, - readmode, writemode, readplane, vrammask, - chain4, chain2_read, chain2_write, con, - oddeven_page, oddeven_chain, vc, sc, - dispon, hdisp_on, cursoron, blink, fullchange, - linepos, vslines, linecountff, oddeven, - lowres, interlace, linedbl, lindebl, rowcount, - vtotal, dispend, vsyncstart, split, - hdisp, hdisp_old, htotal, hdisp_time, rowoffset, - vblankstart, scrollcache, firstline, lastline, - firstline_draw, lastline_draw, x_add, y_add, - displine, res_x, res_y, bpp, index; + int vidclock; + int fast; + int extvram; + int vres; + int readmode; + int writemode; + int readplane; + int vrammask; + int chain4; + int chain2_read; + int chain2_write; + int con; + int oddeven_page; + int oddeven_chain; + int vc; + int sc; + int dispon; + int hdisp_on; + int cursoron; + int blink; + int fullchange; + int linepos; + int vslines; + int linecountff; + int oddeven; + int lowres; + int interlace; + int linedbl; + int lindebl; + int rowcount; + int vtotal; + int dispend; + int vsyncstart; + int split; + int hdisp; + int hdisp_old; + int htotal; + int hdisp_time; + int rowoffset; + int vblankstart; + int scrollcache; + int firstline; + int lastline; + int firstline_draw; + int lastline_draw; + int x_add; + int y_add; + int displine; + int res_x; + int res_y; + int bpp; + int index; - uint32_t charseta, charsetb, ma_latch, ma, - maback, ca, vram_limit, overscan_color; + uint32_t charseta; + uint32_t charsetb; + uint32_t ma_latch; + uint32_t ma; + uint32_t maback; + uint32_t ca; + uint32_t vram_limit; + uint32_t overscan_color; uint32_t *pallook; - uint64_t dispontime, dispofftime; + uint64_t dispontime; + uint64_t dispofftime; pc_timer_t timer; double clock; @@ -97,18 +159,22 @@ extern void ega_recalctimings(struct ega_t *ega); extern void ega_recalc_remap_func(struct ega_t *ega); #endif -extern void ega_out(uint16_t addr, uint8_t val, void *p); -extern uint8_t ega_in(uint16_t addr, void *p); -extern void ega_poll(void *p); -extern void ega_write(uint32_t addr, uint8_t val, void *p); -extern uint8_t ega_read(uint32_t addr, void *p); +extern void ega_out(uint16_t addr, uint8_t val, void *priv); +extern uint8_t ega_in(uint16_t addr, void *priv); +extern void ega_poll(void *priv); +extern void ega_write(uint32_t addr, uint8_t val, void *priv); +extern uint8_t ega_read(uint32_t addr, void *priv); -extern int firstline_draw, lastline_draw; +extern int firstline_draw; +extern int lastline_draw; extern int displine; extern int sc; -extern uint32_t ma, ca; -extern int con, cursoron, cgablink; +extern uint32_t ma; +extern uint32_t ca; +extern int con; +extern int cursoron; +extern int cgablink; extern int scrollcache; diff --git a/src/include/86box/vid_hercules.h b/src/include/86box/vid_hercules.h index bbb4239aa..b5ba6af9f 100644 --- a/src/include/86box/vid_hercules.h +++ b/src/include/86box/vid_hercules.h @@ -25,30 +25,32 @@ typedef struct { mem_mapping_t mapping; - uint8_t crtc[32], charbuffer[4096]; + uint8_t crtc[32]; + uint8_t charbuffer[4096]; int crtcreg; - uint8_t ctrl, - ctrl2, - stat; + uint8_t ctrl; + uint8_t ctrl2; + uint8_t stat; - uint64_t dispontime, - dispofftime; + uint64_t dispontime; + uint64_t dispofftime; pc_timer_t timer; - int firstline, - lastline; + int firstline; + int lastline; - int linepos, - displine; - int vc, - sc; - uint16_t ma, - maback; - int con, coff, - cursoron; - int dispon, - blink; + int linepos; + int displine; + int vc; + int sc; + uint16_t ma; + uint16_t maback; + int con; + int coff; + int cursoron; + int dispon; + int blink; int vsynctime; int vadj; diff --git a/src/include/86box/vid_mda.h b/src/include/86box/vid_mda.h index 0f5080865..37a4f6b21 100644 --- a/src/include/86box/vid_mda.h +++ b/src/include/86box/vid_mda.h @@ -11,18 +11,27 @@ typedef struct mda_t { uint8_t crtc[32]; int crtcreg; - uint8_t ctrl, stat; + uint8_t ctrl; + uint8_t stat; - uint64_t dispontime, dispofftime; + uint64_t dispontime; + uint64_t dispofftime; pc_timer_t timer; - int firstline, lastline; + int firstline; + int lastline; - int linepos, displine; - int vc, sc; - uint16_t ma, maback; - int con, coff, cursoron; - int dispon, blink; + int linepos; + int displine; + int vc; + int sc; + uint16_t ma; + uint16_t maback; + int con; + int coff; + int cursoron; + int dispon; + int blink; int vsynctime; int vadj; int monitor_index; diff --git a/src/include/86box/vid_pgc.h b/src/include/86box/vid_pgc.h index 12450c0d1..a59ca3d8e 100644 --- a/src/include/86box/vid_pgc.h +++ b/src/include/86box/vid_pgc.h @@ -59,10 +59,10 @@ typedef struct pgc { mem_mapping_t mapping; mem_mapping_t cga_mapping; - pgc_cl_t *clist, - *clcur; - const pgc_cmd_t *master, - *commands; + pgc_cl_t *clist; + pgc_cl_t *clcur; + const pgc_cmd_t *master; + const pgc_cmd_t *commands; uint8_t mapram[2048]; /* host <> PGC communication buffer */ uint8_t *cga_vram; @@ -73,10 +73,18 @@ typedef struct pgc { uint32_t userpal[256]; uint32_t maxw, maxh; /* maximum framebuffer size */ uint32_t visw, vish; /* maximum screen size */ - uint32_t screenw, screenh; - int16_t pan_x, pan_y; - uint16_t win_x1, win_x2, win_y1, win_y2; - uint16_t vp_x1, vp_x2, vp_y1, vp_y2; + uint32_t screenw; + uint32_t screenh; + int16_t pan_x; + int16_t pan_y; + uint16_t win_x1; + uint16_t win_x2; + uint16_t win_y1; + uint16_t win_y2; + uint16_t vp_x1; + uint16_t vp_x2; + uint16_t vp_y1; + uint16_t vp_y2; int16_t fill_pattern[16]; int16_t line_pattern; uint8_t draw_mode; @@ -86,7 +94,9 @@ typedef struct pgc { uint8_t tjust_v; /* vert alignment 1=bottom 2=ctr 3=top*/ int32_t tsize; /* horizontal spacing */ - int32_t x, y, z; /* drawing position */ + int32_t x; + int32_t y; + int32_t z; /* drawing position */ thread_t *pgc_thread; event_t *pgc_wake_thread; @@ -98,18 +108,23 @@ typedef struct pgc { int ascii_mode; int result_count; - int fontbase; - int linepos, - displine; + int fontbase; + int linepos; + int displine; int vc; int cgadispon; - int con, coff, cursoron, cgablink; - int vsynctime, vadj; - uint16_t ma, maback; + int con; + int coff; + int cursoron; + int cgablink; + int vsynctime; + int vadj; + uint16_t ma; + uint16_t maback; int oddeven; - uint64_t dispontime, - dispofftime; + uint64_t dispontime; + uint64_t dispofftime; pc_timer_t timer; double native_pixel_clock; @@ -140,10 +155,14 @@ extern void pgc_init(pgc_t *, extern void pgc_sto_raster(pgc_t *, int16_t *x, int16_t *y); extern void pgc_ito_raster(pgc_t *, int32_t *x, int32_t *y); extern void pgc_dto_raster(pgc_t *, double *x, double *y); -// extern int pgc_input_byte(pgc_t *, uint8_t *val); -// extern int pgc_output_byte(pgc_t *, uint8_t val); +#if 0 +extern int pgc_input_byte(pgc_t *, uint8_t *val); +extern int pgc_output_byte(pgc_t *, uint8_t val); +#endif extern int pgc_output_string(pgc_t *, const char *val); -// extern int pgc_error_byte(pgc_t *, uint8_t val); +#if 0 +extern int pgc_error_byte(pgc_t *, uint8_t val); +#endif extern int pgc_error_string(pgc_t *, const char *val); extern int pgc_error(pgc_t *, int err); diff --git a/src/include/86box/vid_svga.h b/src/include/86box/vid_svga.h index f8dafdd20..2fc877f16 100644 --- a/src/include/86box/vid_svga.h +++ b/src/include/86box/vid_svga.h @@ -36,11 +36,18 @@ # define FLAG_512K_MASK 512 struct monitor_t; -typedef struct { - int ena, - x, y, xoff, yoff, cur_xsize, cur_ysize, - v_acc, h_acc; - uint32_t addr, pitch; +typedef struct hwcursor_t { + int ena; + int x; + int y; + int xoff; + int yoff; + int cur_xsize; + int cur_ysize; + int v_acc; + int h_acc; + uint32_t addr; + uint32_t pitch; } hwcursor_t; typedef union { @@ -55,25 +62,78 @@ typedef struct svga_t { xga_t xga; mem_mapping_t mapping; - uint8_t fast, chain4, chain2_write, chain2_read, - ext_overscan, bus_size, - lowres, interlace, linedbl, rowcount, - set_reset_disabled, bpp, ramdac_type, fb_only, - readmode, writemode, readplane, - hwcursor_oddeven, dac_hwcursor_oddeven, overlay_oddeven, - fcr, hblank_overscan; + uint8_t fast; + uint8_t chain4; + uint8_t chain2_write; + uint8_t chain2_read; + uint8_t ext_overscan; + uint8_t bus_size; + uint8_t lowres; + uint8_t interlace; + uint8_t linedbl; + uint8_t rowcount; + uint8_t set_reset_disabled; + uint8_t bpp; + uint8_t ramdac_type; + uint8_t fb_only; + uint8_t readmode; + uint8_t writemode; + uint8_t readplane; + uint8_t hwcursor_oddeven; + uint8_t dac_hwcursor_oddeven; + uint8_t overlay_oddeven; + uint8_t fcr; + uint8_t hblank_overscan; - int dac_addr, dac_pos, dac_r, dac_g, - vtotal, dispend, vsyncstart, split, vblankstart, - hdisp, hdisp_old, htotal, hdisp_time, rowoffset, - dispon, hdisp_on, - vc, sc, linepos, vslines, linecountff, oddeven, - con, cursoron, blink, scrollcache, char_width, - firstline, lastline, firstline_draw, lastline_draw, - displine, fullchange, x_add, y_add, pan, - vram_display_mask, vidclock, dots_per_clock, hblank_ext, - hwcursor_on, dac_hwcursor_on, overlay_on, set_override, - hblankstart, hblankend, hblank_sub, hblank_end_val, hblank_end_len; + int dac_addr; + int dac_pos; + int dac_r; + int dac_g; + int vtotal; + int dispend; + int vsyncstart; + int split; + int vblankstart; + int hdisp; + int hdisp_old; + int htotal; + int hdisp_time; + int rowoffset; + int dispon; + int hdisp_on; + int vc; + int sc; + int linepos; + int vslines; + int linecountff; + int oddeven; + int con; + int cursoron; + int blink; + int scrollcache; + int char_width; + int firstline; + int lastline; + int firstline_draw; + int lastline_draw; + int displine; + int fullchange; + int x_add; + int y_add; + int pan; + int vram_display_mask; + int vidclock; + int dots_per_clock; + int hblank_ext; + int hwcursor_on; + int dac_hwcursor_on; + int overlay_on; + int set_override; + int hblankstart; + int hblankend; + int hblank_sub; + int hblank_end_val; + int hblank_end_len; /*The three variables below allow us to implement memory maps like that seen on a 1MB Trio64 : 0MB-1MB - VRAM @@ -84,29 +144,41 @@ typedef struct svga_t { For the example memory map, decode_mask would be 4MB-1 (4MB address space), vram_max would be 2MB (present video memory only responds to first 2MB), vram_mask would be 1MB-1 (video memory wraps at 1MB) */ - uint32_t decode_mask, vram_max, - vram_mask, - charseta, charsetb, - adv_flags, ma_latch, - ca_adj, ma, maback, - write_bank, read_bank, - extra_banks[2], - banked_mask, - ca, overscan_color, - *map8, pallook[512]; + uint32_t decode_mask; + uint32_t vram_max; + uint32_t vram_mask; + uint32_t charseta; + uint32_t charsetb; + uint32_t adv_flags; + uint32_t ma_latch; + uint32_t ca_adj; + uint32_t ma; + uint32_t maback; + uint32_t write_bank; + uint32_t read_bank; + uint32_t extra_banks[2]; + uint32_t banked_mask; + uint32_t ca; + uint32_t overscan_color; + uint32_t *map8; + uint32_t pallook[512]; PALETTE vgapal; - uint64_t dispontime, dispofftime; + uint64_t dispontime; + uint64_t dispofftime; latch_t latch; pc_timer_t timer; double clock; - hwcursor_t hwcursor, hwcursor_latch, - dac_hwcursor, dac_hwcursor_latch, - overlay, overlay_latch; + hwcursor_t hwcursor; + hwcursor_t hwcursor_latch; + hwcursor_t dac_hwcursor; + hwcursor_t dac_hwcursor_latch; + hwcursor_t overlay; + hwcursor_t overlay_latch; void (*render)(struct svga_t *svga); void (*recalctimings_ex)(struct svga_t *svga); @@ -137,20 +209,35 @@ typedef struct svga_t { /*If set then another device is driving the monitor output and the SVGA card should not attempt to display anything */ int override; - void *p; + void *priv; - uint8_t crtc[256], gdcreg[256], attrregs[32], seqregs[256], - egapal[16], - *vram, *changedvram; + uint8_t crtc[256]; + uint8_t gdcreg[256]; + uint8_t attrregs[32]; + uint8_t seqregs[256]; + uint8_t egapal[16]; + uint8_t *vram; + uint8_t *changedvram; - uint8_t crtcreg, gdcaddr, - attrff, attr_palette_enable, attraddr, seqaddr, - miscout, cgastat, scrblank, - plane_mask, writemask, - colourcompare, colournocare, - dac_mask, dac_status, - dpms, dpms_ui, - ksc5601_sbyte_mask, ksc5601_udc_area_msb[2]; + uint8_t crtcreg; + uint8_t gdcaddr; + uint8_t attrff; + uint8_t attr_palette_enable; + uint8_t attraddr; + uint8_t seqaddr; + uint8_t miscout; + uint8_t cgastat; + uint8_t scrblank; + uint8_t plane_mask; + uint8_t writemask; + uint8_t colourcompare; + uint8_t colournocare; + uint8_t dac_mask; + uint8_t dac_status; + uint8_t dpms; + uint8_t dpms_ui; + uint8_t ksc5601_sbyte_mask; + uint8_t ksc5601_udc_area_msb[2]; int ksc5601_swap_mode; uint16_t ksc5601_english_font_type; @@ -172,7 +259,8 @@ typedef struct svga_t { int remap_required; uint32_t (*remap_func)(struct svga_t *svga, uint32_t in_addr); - void *ramdac, *clock_gen; + void *ramdac; + void *clock_gen; /* Monitor Index */ uint8_t monitor_index; diff --git a/src/include/86box/vid_svga_render.h b/src/include/86box/vid_svga_render.h index 13ff527e0..1f587d4f5 100644 --- a/src/include/86box/vid_svga_render.h +++ b/src/include/86box/vid_svga_render.h @@ -20,12 +20,16 @@ #ifndef VIDEO_SVGA_RENDER_H #define VIDEO_SVGA_RENDER_H -extern int firstline_draw, lastline_draw; +extern int firstline_draw; +extern int lastline_draw; extern int displine; extern int sc; -extern uint32_t ma, ca; -extern int con, cursoron, cgablink; +extern uint32_t ma; +extern uint32_t ca; +extern int con; +extern int cursoron; +extern int cgablink; extern int scrollcache; diff --git a/src/include/86box/vid_voodoo_banshee.h b/src/include/86box/vid_voodoo_banshee.h index 56fd47eeb..89298e94e 100644 --- a/src/include/86box/vid_voodoo_banshee.h +++ b/src/include/86box/vid_voodoo_banshee.h @@ -18,6 +18,6 @@ #ifndef VIDEO_VOODOO_BANSHEE_H #define VIDEO_VOODOO_BANSHEE_H -void banshee_set_overlay_addr(void *p, uint32_t addr); +void banshee_set_overlay_addr(void *priv, uint32_t addr); #endif /*VIDEO_VOODOO_BANSHEE_H*/ diff --git a/src/include/86box/vid_voodoo_codegen_x86-64.h b/src/include/86box/vid_voodoo_codegen_x86-64.h index b50d3332a..dc0ebce72 100644 --- a/src/include/86box/vid_voodoo_codegen_x86-64.h +++ b/src/include/86box/vid_voodoo_codegen_x86-64.h @@ -38,7 +38,9 @@ typedef struct voodoo_x86_data_t { int is_tiled; } voodoo_x86_data_t; -// static voodoo_x86_data_t voodoo_x86_data[2][BLOCK_NUM]; +#if 0 +static voodoo_x86_data_t voodoo_x86_data[2][BLOCK_NUM]; +#endif static int last_block[4] = { 0, 0 }; static int next_block_to_write[4] = { 0, 0 }; @@ -234,10 +236,12 @@ codegen_texture_fetch(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *pa addlong(1); addbyte(0x28); /*SUB DL, CL*/ addbyte(0xca); - // addbyte(0x8a); /*MOV DL, params->tex_shift[RSI+ECX*4]*/ - // addbyte(0x94); - // addbyte(0x8e); - // addlong(offsetof(voodoo_params_t, tex_shift)); +#if 0 + addbyte(0x8a); /*MOV DL, params->tex_shift[RSI+ECX*4]*/ + addbyte(0x94); + addbyte(0x8e); + addlong(offsetof(voodoo_params_t, tex_shift)); +#endif addbyte(0xd3); /*SHL EBP, CL*/ addbyte(0xe5); addbyte(0x8b); /*MOV EAX, state->tex_s[RDI]*/ @@ -656,24 +660,29 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, int depth_jump_pos = 0; int depth_jump_pos2 = 0; int loop_jump_pos = 0; - // xmm_01_w = (__m128i)0x0001000100010001ull; - // xmm_ff_w = (__m128i)0x00ff00ff00ff00ffull; - // xmm_ff_b = (__m128i)0x00000000ffffffffull; +#if 0 + xmm_01_w = (__m128i)0x0001000100010001ull; + xmm_ff_w = (__m128i)0x00ff00ff00ff00ffull; + xmm_ff_b = (__m128i)0x00000000ffffffffull; +#endif xmm_01_w = _mm_set_epi32(0, 0, 0x00010001, 0x00010001); xmm_ff_w = _mm_set_epi32(0, 0, 0x00ff00ff, 0x00ff00ff); xmm_ff_b = _mm_set_epi32(0, 0, 0, 0x00ffffff); minus_254 = _mm_set_epi32(0, 0, 0xff02ff02, 0xff02ff02); - // *(uint64_t *)&const_1_48 = 0x45b0000000000000ull; - // block_pos = 0; - // voodoo_get_depth = &code_block[block_pos]; +#if 0 + *(uint64_t *)&const_1_48 = 0x45b0000000000000ull; + block_pos = 0; + voodoo_get_depth = &code_block[block_pos]; +#endif /*W at (%esp+4) Z at (%esp+12) new_depth at (%esp+16)*/ - // if ((params->fbzMode & FBZ_DEPTH_ENABLE) && (depth_op == DEPTHOP_NEVER)) - // { - // addbyte(0xC3); /*RET*/ - // return; - // } +#if 0 + if ((params->fbzMode & FBZ_DEPTH_ENABLE) && (depth_op == DEPTHOP_NEVER)) { + addbyte(0xC3); /*RET*/ + return; + } +#endif addbyte(0x55); /*PUSH RBP*/ addbyte(0x57); /*PUSH RDI*/ addbyte(0x56); /*PUSH RSI*/ @@ -796,7 +805,9 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0x75); /*JNZ got_depth*/ depth_jump_pos = block_pos; addbyte(0); - // addbyte(4+5+2+3+2+5+5+3+2+2+2+/*3+*/3+2+6+4+5+2+3); +#if 0 + addbyte(4+5+2+3+2+5+5+3+2+2+2+/*3+*/3+2+6+4+5+2+3); +#endif addbyte(0x8b); /*MOV EDX, w*/ addbyte(0x97); addlong(offsetof(voodoo_state_t, w)); @@ -810,7 +821,9 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0x74); /*JZ got_depth*/ depth_jump_pos2 = block_pos; addbyte(0); - // addbyte(5+5+3+2+2+2+/*3+*/3+2+6+4+5+2+3); +#if 0 + addbyte(5+5+3+2+2+2+/*3+*/3+2+6+4+5+2+3); +#endif addbyte(0xb9); /*MOV ECX, 19*/ addlong(19); addbyte(0x0f); /*BSR EAX, EDX*/ @@ -2224,10 +2237,12 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(10); addbyte(0x01); /*ADD EAX, EBX*/ addbyte(0xd8); - /* int fog_idx = (w_depth >> 10) & 0x3f; +#if 0 + int fog_idx = (w_depth >> 10) & 0x3f; - fog_a = params->fogTable[fog_idx].fog; - fog_a += (params->fogTable[fog_idx].dfog * ((w_depth >> 2) & 0xff)) >> 10;*/ + fog_a = params->fogTable[fog_idx].fog; + fog_a += (params->fogTable[fog_idx].dfog * ((w_depth >> 2) & 0xff)) >> 10; +#endif break; case FOG_Z: @@ -2239,7 +2254,9 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(12); addbyte(0x25); /*AND EAX, 0xff*/ addlong(0xff); - // fog_a = (z >> 20) & 0xff; +#if 0 + fog_a = (z >> 20) & 0xff; +#endif break; case FOG_ALPHA: @@ -2261,7 +2278,9 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0x0f); /*CMOVAE EAX, EBX*/ addbyte(0x43); addbyte(0xc3); - // fog_a = CLAMP(ia >> 12); +#if 0 + fog_a = CLAMP(ia >> 12); +#endif break; case FOG_W: @@ -2282,7 +2301,9 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0x0f); /*CMOVAE EAX, EBX*/ addbyte(0x43); addbyte(0xc3); - // fog_a = CLAMP(w >> 32); +#if 0 + fog_a = CLAMP(w >> 32); +#endif break; } addbyte(0x01); /*ADD EAX, EAX*/ @@ -3164,12 +3185,11 @@ int voodoo_recomp = 0; static inline void * voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int odd_even) { - int c; int b = last_block[odd_even]; voodoo_x86_data_t *voodoo_x86_data = voodoo->codegen_data; voodoo_x86_data_t *data; - for (c = 0; c < 8; c++) { + for (uint8_t c = 0; c < 8; c++) { data = &voodoo_x86_data[odd_even + c * 4]; //&voodoo_x86_data[odd_even][b]; if (state->xdir == data->xdir && params->alphaMode == data->alphaMode && params->fbzMode == data->fbzMode && params->fogMode == data->fogMode && params->fbzColorPath == data->fbzColorPath && (voodoo->trexInit1[0] & (1 << 18)) == data->trexInit1 && params->textureMode[0] == data->textureMode[0] && params->textureMode[1] == data->textureMode[1] && (params->tLOD[0] & LOD_MASK) == data->tLOD[0] && (params->tLOD[1] & LOD_MASK) == data->tLOD[1] && ((params->col_tiled || params->aux_tiled) ? 1 : 0) == data->is_tiled) { @@ -3181,7 +3201,9 @@ voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *stat } voodoo_recomp++; data = &voodoo_x86_data[odd_even + next_block_to_write[odd_even] * 4]; - // code_block = data->code_block; +#if 0 + code_block = data->code_block; +#endif voodoo_generate(data->code_block, voodoo, params, state, depth_op); @@ -3205,11 +3227,9 @@ voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *stat void voodoo_codegen_init(voodoo_t *voodoo) { - int c; - voodoo->codegen_data = plat_mmap(sizeof(voodoo_x86_data_t) * BLOCK_NUM * 4, 1); - for (c = 0; c < 256; c++) { + for (uint16_t c = 0; c < 256; c++) { int d[4]; int _ds = c & 0xf; int dt = c >> 4; diff --git a/src/include/86box/vid_voodoo_codegen_x86.h b/src/include/86box/vid_voodoo_codegen_x86.h index 9454c9bff..996bd28f1 100644 --- a/src/include/86box/vid_voodoo_codegen_x86.h +++ b/src/include/86box/vid_voodoo_codegen_x86.h @@ -639,24 +639,29 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, int depth_jump_pos = 0; int depth_jump_pos2 = 0; int loop_jump_pos = 0; - // xmm_01_w = (__m128i)0x0001000100010001ull; - // xmm_ff_w = (__m128i)0x00ff00ff00ff00ffull; - // xmm_ff_b = (__m128i)0x00000000ffffffffull; +#if 0 + xmm_01_w = (__m128i)0x0001000100010001ull; + xmm_ff_w = (__m128i)0x00ff00ff00ff00ffull; + xmm_ff_b = (__m128i)0x00000000ffffffffull; +#endif xmm_01_w = _mm_set_epi32(0, 0, 0x00010001, 0x00010001); xmm_ff_w = _mm_set_epi32(0, 0, 0x00ff00ff, 0x00ff00ff); xmm_ff_b = _mm_set_epi32(0, 0, 0, 0x00ffffff); minus_254 = _mm_set_epi32(0, 0, 0xff02ff02, 0xff02ff02); - // *(uint64_t *)&const_1_48 = 0x45b0000000000000ull; - // block_pos = 0; - // voodoo_get_depth = &code_block[block_pos]; +#if 0 + *(uint64_t *)&const_1_48 = 0x45b0000000000000ull; + block_pos = 0; + voodoo_get_depth = &code_block[block_pos]; +#endif /*W at (%esp+4) Z at (%esp+12) new_depth at (%esp+16)*/ - // if ((params->fbzMode & FBZ_DEPTH_ENABLE) && (depth_op == DEPTHOP_NEVER)) - // { - // addbyte(0xC3); /*RET*/ - // return; - // } +#if 0 + if ((params->fbzMode & FBZ_DEPTH_ENABLE) && (depth_op == DEPTHOP_NEVER)) { + addbyte(0xC3); /*RET*/ + return; + } +#endif addbyte(0x55); /*PUSH EBP*/ addbyte(0x57); /*PUSH EDI*/ addbyte(0x56); /*PUSH ESI*/ @@ -871,16 +876,19 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, fatal("Bad depth_op\n"); } else if ((params->fbzMode & FBZ_DEPTH_ENABLE) && (depthop == DEPTHOP_NEVER)) { addbyte(0xC3); /*RET*/ - // addbyte(0x30); /*XOR EAX, EAX*/ - // addbyte(0xc0); +#if 0 + addbyte(0x30); /*XOR EAX, EAX*/ + addbyte(0xc0); +#endif + } +#if 0 + else { + addbyte(0xb0); /*MOV AL, 1*/ + addbyte(1); } - // else - // { - // addbyte(0xb0); /*MOV AL, 1*/ - // addbyte(1); - // } - // voodoo_combine = &code_block[block_pos]; + voodoo_combine = &code_block[block_pos]; +#endif /*XMM0 = colour*/ /*XMM2 = 0 (for unpacking*/ @@ -2076,12 +2084,13 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0x05); addlong((uint32_t) &xmm_ff_b); } - // #if 0 - // addbyte(0x66); /*MOVD state->out[EDI], XMM0*/ - // addbyte(0x0f); - // addbyte(0x7e); - // addbyte(0x87); - // addlong(offsetof(voodoo_state_t, out)); +#if 0 + addbyte(0x66); /*MOVD state->out[EDI], XMM0*/ + addbyte(0x0f); + addbyte(0x7e); + addbyte(0x87); + addlong(offsetof(voodoo_state_t, out)); +#endif if (params->fogMode & FOG_ENABLE) { if (params->fogMode & FOG_CONSTANT) { addbyte(0x66); /*MOVD XMM3, params->fogColor[ESI]*/ @@ -2093,11 +2102,18 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0x0f); addbyte(0xdc); addbyte(0xc3); - /* src_r += params->fogColor.r; - src_g += params->fogColor.g; - src_b += params->fogColor.b; */ +#if 0 + src_r += params->fogColor.r; + src_g += params->fogColor.g; + src_b += params->fogColor.b; */ +#endif } else { - /*int fog_r, fog_g, fog_b, fog_a; */ +#if 0 + int fog_r; + int fog_g; + int fog_b; + int fog_a; +#endif addbyte(0x66); /*PUNPCKLBW XMM0, XMM2*/ addbyte(0x0f); @@ -2168,10 +2184,12 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0x01); /*ADD EAX, EBX*/ addbyte(0xd8); - /* int fog_idx = (w_depth >> 10) & 0x3f; +#if 0 + int fog_idx = (w_depth >> 10) & 0x3f; - fog_a = params->fogTable[fog_idx].fog; - fog_a += (params->fogTable[fog_idx].dfog * ((w_depth >> 2) & 0xff)) >> 10;*/ + fog_a = params->fogTable[fog_idx].fog; + fog_a += (params->fogTable[fog_idx].dfog * ((w_depth >> 2) & 0xff)) >> 10; +#endif break; case FOG_Z: @@ -2183,7 +2201,9 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(12); addbyte(0x25); /*AND EAX, 0xff*/ addlong(0xff); - // fog_a = (z >> 20) & 0xff; +#if 0 + fog_a = (z >> 20) & 0xff; +#endif break; case FOG_ALPHA: @@ -2205,7 +2225,9 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0x0f); /*CMOVAE EAX, EBX*/ addbyte(0x43); addbyte(0xc3); - // fog_a = CLAMP(ia >> 12); +#if 0 + fog_a = CLAMP(ia >> 12); +#endif break; case FOG_W: @@ -2226,13 +2248,16 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0x0f); /*CMOVAE EAX, EBX*/ addbyte(0x43); addbyte(0xc3); - // fog_a = CLAMP(w >> 32); +#if 0 + fog_a = CLAMP(w >> 32); +#endif break; } addbyte(0x01); /*ADD EAX, EAX*/ addbyte(0xc0); - // fog_a++; - +#if 0 + fog_a++; +#endif addbyte(0x66); /*PMULLW XMM3, alookup+4[EAX*8]*/ addbyte(0x0f); addbyte(0xd5); @@ -2244,9 +2269,11 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0x71); addbyte(0xe3); addbyte(7); - /* fog_r = (fog_r * fog_a) >> 8; - fog_g = (fog_g * fog_a) >> 8; - fog_b = (fog_b * fog_a) >> 8;*/ +#if 0 + fog_r = (fog_r * fog_a) >> 8; + fog_g = (fog_g * fog_a) >> 8; + fog_b = (fog_b * fog_a) >> 8; +#endif if (params->fogMode & FOG_MULT) { addbyte(0xf3); /*MOV XMM0, XMM3*/ @@ -2258,9 +2285,11 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0x0f); addbyte(0xfd); addbyte(0xc3); - /* src_r += fog_r; - src_g += fog_g; - src_b += fog_b;*/ +#if 0 + src_r += fog_r; + src_g += fog_g; + src_b += fog_b; +#endif } addbyte(0x66); /*PACKUSWB XMM0, XMM0*/ addbyte(0x0f); @@ -2268,9 +2297,11 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0xc0); } - /* src_r = CLAMP(src_r); - src_g = CLAMP(src_g); - src_b = CLAMP(src_b);*/ +#if 0 + src_r = CLAMP(src_r); + src_g = CLAMP(src_g); + src_b = CLAMP(src_b); +#endif } if ((params->alphaMode & 1) && (alpha_func != AFUNC_NEVER) && (alpha_func != AFUNC_ALWAYS)) { @@ -2696,12 +2727,13 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0x67); addbyte(0xc0); } - // #endif - // addbyte(0x8b); /*MOV EDX, x (ESP+12)*/ - // addbyte(0x54); - // addbyte(0x24); - // addbyte(12); +#if 0 + addbyte(0x8b); /*MOV EDX, x (ESP+12)*/ + addbyte(0x54); + addbyte(0x24); + addbyte(12); +#endif addbyte(0x8b); /*MOV EDX, state->x[EDI]*/ addbyte(0x97); @@ -2716,9 +2748,11 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0xc0); if (params->fbzMode & FBZ_RGB_WMASK) { - // addbyte(0x89); /*MOV state->rgb_out[EDI], EAX*/ - // addbyte(0x87); - // addlong(offsetof(voodoo_state_t, rgb_out)); +#if 0 + addbyte(0x89); /*MOV state->rgb_out[EDI], EAX*/ + addbyte(0x87); + addlong(offsetof(voodoo_state_t, rgb_out)); +#endif if (dither) { addbyte(0x8b); /*MOV ESI, real_y (ESP+16)*/ @@ -3118,7 +3152,9 @@ voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *stat } voodoo_recomp++; data = &codegen_data[odd_even + next_block_to_write[odd_even] * 4]; - // code_block = data->code_block; +#if 0 + code_block = data->code_block; +#endif voodoo_generate(data->code_block, voodoo, params, state, depth_op); @@ -3142,11 +3178,9 @@ voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *stat void voodoo_codegen_init(voodoo_t *voodoo) { - int c; - voodoo->codegen_data = plat_mmap(sizeof(voodoo_x86_data_t) * BLOCK_NUM * 4, 1); - for (c = 0; c < 256; c++) { + for (uint16_t c = 0; c < 256; c++) { int d[4]; int _ds = c & 0xf; int dt = c >> 4; diff --git a/src/include/86box/vid_voodoo_common.h b/src/include/86box/vid_voodoo_common.h index 6eae0bf6d..92c608789 100644 --- a/src/include/86box/vid_voodoo_common.h +++ b/src/include/86box/vid_voodoo_common.h @@ -596,7 +596,9 @@ typedef struct voodoo_t { uint32_t vidOverlayDudxOffsetSrcWidth; uint32_t vidOverlayDvdy; uint32_t vidOverlayDvdyOffset; - // uint32_t vidDesktopOverlayStride; +#if 0 + uint32_t vidDesktopOverlayStride; +#endif int start_x; int start_y; diff --git a/src/include/86box/vid_xga.h b/src/include/86box/vid_xga.h index 550ae7cd6..af5191a81 100644 --- a/src/include/86box/vid_xga.h +++ b/src/include/86box/vid_xga.h @@ -20,7 +20,7 @@ #include <86box/rom.h> -typedef struct { +typedef struct xga_hwcursor_t { int ena; int x; int y; @@ -37,11 +37,14 @@ typedef struct xga_t { mem_mapping_t video_mapping; rom_t bios_rom; rom_t vga_bios_rom; - xga_hwcursor_t hwcursor, hwcursor_latch; + xga_hwcursor_t hwcursor; + xga_hwcursor_t hwcursor_latch; PALETTE extpal; - uint8_t test, atest[2], testpixel; - ; + uint8_t test; + uint8_t atest[2]; + uint8_t testpixel; + uint8_t pos_regs[8]; uint8_t disp_addr; uint8_t cfg_reg; @@ -54,33 +57,43 @@ typedef struct xga_t { uint8_t regs_idx; uint8_t hwc_hotspot_x; uint8_t hwc_hotspot_y; - uint8_t disp_cntl_1, disp_cntl_2; - uint8_t clk_sel_1, clk_sel_2; + uint8_t disp_cntl_1; + uint8_t disp_cntl_2; + uint8_t clk_sel_1; + uint8_t clk_sel_2; uint8_t hwc_control; uint8_t bus_arb; uint8_t isa_pos_enable; uint8_t hwcursor_oddeven; uint8_t cfg_reg_instance; uint8_t rowcount; - uint8_t pal_idx, pal_idx_prefetch; + uint8_t pal_idx; + uint8_t pal_idx_prefetch; uint8_t pal_seq; uint8_t pal_mask; - uint8_t pal_r, pal_r_prefetch; - uint8_t pal_g, pal_g_prefetch; - uint8_t pal_b, pal_b_prefetch; + uint8_t pal_r; + uint8_t pal_r_prefetch; + uint8_t pal_g; + uint8_t pal_g_prefetch; + uint8_t pal_b; + uint8_t pal_b_prefetch; uint8_t sprite_data[1024]; uint8_t scrollcache; uint8_t direct_color; uint8_t dma_channel; - uint8_t instance_isa, instance_num, ext_mem_addr; - uint8_t *vram, *changedvram; + uint8_t instance_isa; + uint8_t instance_num; + uint8_t ext_mem_addr; + uint8_t *vram; + uint8_t *changedvram; int16_t hwc_pos_x; int16_t hwc_pos_y; uint16_t pos_idx; uint16_t htotal; - uint16_t sprite_idx, sprite_idx_prefetch; + uint16_t sprite_idx; + uint16_t sprite_idx_prefetch; uint16_t hdisp; uint16_t vtotal; uint16_t vdispend; @@ -88,41 +101,74 @@ typedef struct xga_t { uint16_t vsyncstart; uint16_t linecmp; uint16_t pix_map_width; - uint16_t sprite_pal_addr_idx, old_pal_addr_idx; + uint16_t sprite_pal_addr_idx; + uint16_t old_pal_addr_idx; uint16_t sprite_pal_addr_idx_prefetch; - int v_total, dispend, v_syncstart, split, v_blankstart, - h_disp, h_disp_old, h_total, h_disp_time, rowoffset, - dispon, h_disp_on, vc, sc, linepos, oddeven, firstline, lastline, - firstline_draw, lastline_draw, displine, fullchange, interlace, - char_width, hwcursor_on; - int pal_pos, pal_pos_prefetch; + int v_total; + int dispend; + int v_syncstart; + int split; + int v_blankstart; + int h_disp; + int h_disp_old; + int h_total; + int h_disp_time; + int rowoffset; + int dispon; + int h_disp_on; + int vc; + int sc; + int linepos; + int oddeven; + int firstline; + int lastline; + int firstline_draw; + int lastline_draw; + int displine; + int fullchange; + int interlace; + int char_width; + int hwcursor_on; + int pal_pos; + int pal_pos_prefetch; int on; - int op_mode_reset, linear_endian_reverse; - int sprite_pos, sprite_pos_prefetch, cursor_data_on; - int pal_test, a5_test; - int type, bus; + int op_mode_reset; + int linear_endian_reverse; + int sprite_pos; + int sprite_pos_prefetch; + int cursor_data_on; + int pal_test; + int a5_test; + int type; + int bus; - uint32_t linear_base, linear_size, banked_mask; + uint32_t linear_base; + uint32_t linear_size; + uint32_t banked_mask; uint32_t base_addr_1mb; - uint32_t hwc_color0, hwc_color1; + uint32_t hwc_color0; + uint32_t hwc_color1; uint32_t disp_start_addr; uint32_t ma_latch; uint32_t vram_size; uint32_t vram_mask; uint32_t rom_addr; - uint32_t ma, maback; + uint32_t ma; + uint32_t maback; uint32_t extpallook[256]; - uint32_t read_bank, write_bank; + uint32_t read_bank; + uint32_t write_bank; uint32_t px_map_base; - uint64_t dispontime, dispofftime; + uint64_t dispontime; + uint64_t dispofftime; - struct - { + struct { uint8_t control; uint8_t px_map_idx; - uint8_t frgd_mix, bkgd_mix; + uint8_t frgd_mix; + uint8_t bkgd_mix; uint8_t cc_cond; uint8_t octant; uint8_t draw_mode; @@ -133,15 +179,19 @@ typedef struct xga_t { uint8_t short_stroke_vector4; int16_t bres_err_term; - int16_t bres_k1, bres_k2; + int16_t bres_k1; + int16_t bres_k2; uint16_t blt_width; uint16_t blt_height; uint16_t mask_map_origin_x_off; uint16_t mask_map_origin_y_off; - uint16_t src_map_x, src_map_y; - uint16_t dst_map_x, dst_map_y; - uint16_t pat_map_x, pat_map_y; + uint16_t src_map_x; + uint16_t src_map_y; + uint16_t dst_map_x; + uint16_t dst_map_y; + uint16_t pat_map_x; + uint16_t pat_map_y; int ssv_state; int pat_src; @@ -149,7 +199,14 @@ typedef struct xga_t { int dst_map; int bkgd_src; int fore_src; - int x, y, sx, sy, dx, dy, px, py; + int x; + int y; + int sx; + int sy; + int dx; + int dy; + int px; + int py; int pattern; int command_len; @@ -157,7 +214,8 @@ typedef struct xga_t { uint32_t color_cmp; uint32_t carry_chain; uint32_t plane_mask; - uint32_t frgd_color, bkgd_color; + uint32_t frgd_color; + uint32_t bkgd_color; uint32_t command; uint32_t dir_cmd; diff --git a/src/machine/m_amstrad.c b/src/machine/m_amstrad.c index 17caf6141..dec9f7669 100644 --- a/src/machine/m_amstrad.c +++ b/src/machine/m_amstrad.c @@ -74,6 +74,7 @@ #include <86box/vid_mda.h> #include <86box/machine.h> #include <86box/m_amstrad.h> +#include <86box/plat_unused.h> #define STAT_PARITY 0x80 #define STAT_RTIMEOUT 0x40 @@ -84,60 +85,64 @@ #define STAT_IFULL 0x02 #define STAT_OFULL 0x01 -typedef struct { - rom_t bios_rom; /* 1640 */ - cga_t cga; /* 1640/200 */ - mda_t mda; /* 1512/200/PPC512/640*/ - ega_t ega; /* 1640 */ - uint8_t emulation; /* Which display are we emulating? */ - uint8_t dipswitches; /* DIP switches 1-3 */ - uint8_t crtc_index; /* CRTC index readback - * Bit 7: CGA control port written - * Bit 6: Operation control port written - * Bit 5: CRTC register written - * Bits 0-4: Last CRTC register selected */ - uint8_t operation_ctrl; - uint8_t reg_3df, type; - uint8_t crtc[32]; - int crtcreg; - int cga_enabled; /* 1640 */ - uint8_t cgacol, - cgamode, - stat; - uint8_t plane_write, /* 1512/200 */ - plane_read, /* 1512/200 */ - border, /* 1512/200 */ - invert; /* 512/640 */ - int fontbase; /* 1512/200 */ - int linepos, - displine; - int sc, vc; - int cgadispon; - int con, coff, - cursoron, - cgablink; - int vsynctime; - int fullchange; - int vadj; - uint16_t ma, maback; - int dispon; - int blink; - uint64_t dispontime, /* 1512/1640 */ - dispofftime; /* 1512/1640 */ - pc_timer_t timer; /* 1512/1640 */ - int firstline, - lastline; - uint8_t *vram; - void *ams; +typedef struct amsvid_t { + rom_t bios_rom; /* 1640 */ + cga_t cga; /* 1640/200 */ + mda_t mda; /* 1512/200/PPC512/640*/ + ega_t ega; /* 1640 */ + uint8_t emulation; /* Which display are we emulating? */ + uint8_t dipswitches; /* DIP switches 1-3 */ + uint8_t crtc_index; /* CRTC index readback + * Bit 7: CGA control port written + * Bit 6: Operation control port written + * Bit 5: CRTC register written + * Bits 0-4: Last CRTC register selected */ + uint8_t operation_ctrl; + uint8_t reg_3df; + uint8_t type; + uint8_t crtc[32]; + int crtcreg; + int cga_enabled; /* 1640 */ + uint8_t cgacol; + uint8_t cgamode; + uint8_t stat; + uint8_t plane_write; /* 1512/200 */ + uint8_t plane_read; /* 1512/200 */ + uint8_t border; /* 1512/200 */ + uint8_t invert; /* 512/640 */ + int fontbase; /* 1512/200 */ + int linepos; + int displine; + int sc; + int vc; + int cgadispon; + int con; + int coff; + int cursoron; + int cgablink; + int vsynctime; + int fullchange; + int vadj; + uint16_t ma; + uint16_t maback; + int dispon; + int blink; + uint64_t dispontime; /* 1512/1640 */ + uint64_t dispofftime; /* 1512/1640 */ + pc_timer_t timer; /* 1512/1640 */ + int firstline; + int lastline; + uint8_t *vram; + void *ams; } amsvid_t; -typedef struct { +typedef struct amstrad_t { /* Machine stuff. */ uint8_t dead; - uint8_t stat1, - stat2; - uint8_t type, - language; + uint8_t stat1; + uint8_t stat2; + uint8_t type; + uint8_t language; /* Keyboard stuff. */ int8_t wantirq; @@ -147,8 +152,8 @@ typedef struct { pc_timer_t send_delay_timer; /* Mouse stuff. */ - uint8_t mousex, - mousey; + uint8_t mousex; + uint8_t mousey; int oldb; /* Video stuff. */ @@ -160,7 +165,7 @@ uint32_t amstrad_latch; static uint8_t key_queue[16]; static int key_queue_start = 0; -static int key_queue_end = 0; +static int key_queue_end = 0; static uint8_t crtc_mask[32] = { 0xff, 0xff, 0xff, 0xff, 0x7f, 0x1f, 0x7f, 0x7f, 0xf3, 0x1f, 0x7f, 0x1f, 0x3f, 0xff, 0x3f, 0xff, @@ -263,6 +268,9 @@ vid_out_1512(uint16_t addr, uint8_t val, void *priv) case 0x03df: vid->border = val; return; + + default: + return; } } @@ -287,6 +295,9 @@ vid_in_1512(uint16_t addr, void *priv) case 0x03da: ret = vid->stat; break; + + default: + break; } return ret; @@ -780,9 +791,15 @@ vid_out_1640(uint16_t addr, uint8_t val, void *priv) mem_mapping_set_addr(&vid->ega.mapping, 0xb8000, 0x08000); break; + + default: + break; } } return; + + default: + break; } if (vid->cga_enabled) @@ -924,6 +941,9 @@ ams_inform(amsvid_t *vid) case PC200_LCDM: video_inform(VIDEO_FLAG_TYPE_MDA, &timing_pc200); break; + + default: + break; } } @@ -1013,6 +1033,9 @@ set_lcd_cols(uint8_t mode_reg) lcdcols[c][0][0] = lcdcols[c][1][0] = blue; lcdcols[c][0][1] = lcdcols[c][1][1] = blue; break; + + default: + break; } } } @@ -1043,6 +1066,9 @@ vid_in_200(uint16_t addr, void *priv) case 0x03df: return (vid->reg_3df); + + default: + break; } if (addr >= 0x3D0 && addr <= 0x3DF) @@ -1176,6 +1202,9 @@ vid_out_200(uint16_t addr, uint8_t val, void *priv) mem_mapping_enable(&vid->cga.mapping); } return; + + default: + break; } if (addr >= 0x3D0 && addr <= 0x3DF) @@ -1272,7 +1301,7 @@ lcdm_poll(amsvid_t *vid) drawcursor = ((mda->ma == ca) && mda->con && mda->cursoron); blink = ((mda->blink & 16) && (mda->ctrl & 0x20) && (attr & 0x80) && !drawcursor); - lcd_draw_char_80(vid, &((uint32_t *) (buffer32->line[mda->displine]))[x * 8], chr, attr, drawcursor, blink, mda->sc, 0, mda->ctrl); + lcd_draw_char_80(vid, &((buffer32->line[mda->displine]))[x * 8], chr, attr, drawcursor, blink, mda->sc, 0, mda->ctrl); mda->ma++; } } @@ -1422,7 +1451,7 @@ lcdc_poll(amsvid_t *vid) dat = (cga->vram[((cga->ma << 1) & 0x1fff) + ((cga->sc & 1) * 0x2000)] << 8) | cga->vram[((cga->ma << 1) & 0x1fff) + ((cga->sc & 1) * 0x2000) + 1]; cga->ma++; for (uint8_t c = 0; c < 16; c++) { - buffer32->line[(cga->displine << 1)][(x << 4) + c] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + c] = (dat & 0x8000) ? blue : green; + buffer32->line[cga->displine << 1][(x << 4) + c] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + c] = (dat & 0x8000) ? blue : green; dat <<= 1; } } @@ -1568,9 +1597,9 @@ lcdc_poll(amsvid_t *vid) } static void -vid_poll_200(void *p) +vid_poll_200(void *priv) { - amsvid_t *vid = (amsvid_t *) p; + amsvid_t *vid = (amsvid_t *) priv; switch (vid->emulation) { case PC200_LCDM: @@ -1579,6 +1608,9 @@ vid_poll_200(void *p) case PC200_LCDC: lcdc_poll(vid); return; + + default: + break; } } @@ -1614,6 +1646,9 @@ vid_init_200(amstrad_t *ams) break; /* The other combination is 'IDA disabled' (0x20) - see * m_amstrad.c */ + + default: + break; } else switch (vid->emulation) { @@ -1635,6 +1670,9 @@ vid_init_200(amstrad_t *ams) case PC200_LCDM: vid->dipswitches = 0x10; break; + + default: + break; } cga = &vid->cga; @@ -1969,7 +2007,7 @@ const device_t vid_pc3086_device = { }; static void -ms_write(uint16_t addr, uint8_t val, void *priv) +ms_write(uint16_t addr, UNUSED(uint8_t val), void *priv) { amstrad_t *ams = (amstrad_t *) priv; @@ -1997,7 +2035,7 @@ ms_read(uint16_t addr, void *priv) } static int -ms_poll(int x, int y, int z, int b, void *priv) +ms_poll(int x, int y, UNUSED(int z), int b, void *priv) { amstrad_t *ams = (amstrad_t *) priv; @@ -2222,6 +2260,9 @@ ams_write(uint16_t port, uint8_t val, void *priv) case 0xdead: ams->dead = val; break; + + default: + break; } } @@ -2285,6 +2326,9 @@ ams_read(uint16_t port, void *priv) case AMSTRAD_SW10: ret |= 0x20; break; + + default: + break; } break; @@ -2300,6 +2344,9 @@ ams_read(uint16_t port, void *priv) case 0xdead: ret = ams->dead; break; + + default: + break; } return ret; @@ -2482,6 +2529,9 @@ machine_amstrad_init(const machine_t *model, int type) case AMS_PC3086: ams->fdc = device_add(&fdc_at_actlow_device); break; + + default: + break; } ams->language = 7; @@ -2539,6 +2589,9 @@ machine_amstrad_init(const machine_t *model, int type) device_context_restore(); device_add(¶dise_pvga1a_pc3086_device); break; + + default: + break; } else if ((type == AMS_PC200) || (type == AMS_PPC512)) io_sethandler(0x03de, 1, diff --git a/src/machine/m_at_386dx_486.c b/src/machine/m_at_386dx_486.c index deaa540c4..3f37c13c4 100644 --- a/src/machine/m_at_386dx_486.c +++ b/src/machine/m_at_386dx_486.c @@ -48,6 +48,7 @@ #include <86box/scsi_ncr53c8xx.h> #include <86box/hwm.h> #include <86box/machine.h> +#include <86box/plat_unused.h> int machine_at_acc386_init(const machine_t *model) @@ -812,7 +813,7 @@ machine_at_greenb_init(const machine_t *model) } static void -machine_at_sis_85c496_common_init(const machine_t *model) +machine_at_sis_85c496_common_init(UNUSED(const machine_t *model)) { device_add(&ide_pci_2ch_device); @@ -1281,7 +1282,9 @@ machine_at_abpb4_init(const machine_t *model) device_add(&ali1489_device); device_add(&w83787f_device); device_add(&keyboard_at_device); - // device_add(&intel_flash_bxt_device); +#if 0 + device_add(&intel_flash_bxt_device); +#endif device_add(&sst_flash_29ee010_device); return ret; @@ -1788,7 +1791,7 @@ machine_at_tg486gp_init(const machine_t *model) int machine_at_tg486g_init(const machine_t *model) { - int ret, i; + int ret; ret = bios_load_linear("roms/machines/tg486g/tg486g.bin", 0x000c0000, 262144, 0); @@ -1803,7 +1806,7 @@ machine_at_tg486g_init(const machine_t *model) device_add(&keyboard_ps2_tg_ami_pci_device); if (gfxcard[0] != VID_INTERNAL) { - for (i = 0; i < 32768; i++) + for (uint16_t i = 0; i < 32768; i++) rom[i] = mem_readb_phys(0x000c0000 + i); } mem_mapping_set_addr(&bios_mapping, 0x0c0000, 0x40000); diff --git a/src/machine/m_at_commodore.c b/src/machine/m_at_commodore.c index 3587db44a..a0b522371 100644 --- a/src/machine/m_at_commodore.c +++ b/src/machine/m_at_commodore.c @@ -52,11 +52,12 @@ #include <86box/fdd.h> #include <86box/fdc.h> #include <86box/machine.h> +#include <86box/plat_unused.h> static serial_t *cmd_uart; static void -cbm_io_write(uint16_t port, uint8_t val, void *p) +cbm_io_write(UNUSED(uint16_t port), uint8_t val, UNUSED(void *priv)) { lpt1_remove(); lpt2_remove(); @@ -71,6 +72,9 @@ cbm_io_write(uint16_t port, uint8_t val, void *p) case 3: lpt1_init(LPT2_ADDR); break; + + default: + break; } switch (val & 0xc) { @@ -80,6 +84,9 @@ cbm_io_write(uint16_t port, uint8_t val, void *p) case 0x8: serial_setup(cmd_uart, COM1_ADDR, COM1_IRQ); break; + + default: + break; } } diff --git a/src/machine/m_at_compaq.c b/src/machine/m_at_compaq.c index 3676a9d92..0731aa810 100644 --- a/src/machine/m_at_compaq.c +++ b/src/machine/m_at_compaq.c @@ -41,6 +41,7 @@ #include <86box/video.h> #include <86box/vid_cga.h> #include <86box/vid_cga_comp.h> +#include <86box/plat_unused.h> static video_timings_t timing_compaq_plasma = { .type = VIDEO_ISA, .write_b = 8, .write_w = 16, .write_l = 32, .read_b = 8, .read_w = 16, .read_l = 32 }; @@ -127,7 +128,7 @@ compaq_plasma_recalctimings(compaq_plasma_t *self) } static void -compaq_plasma_waitstates(void *p) +compaq_plasma_waitstates(UNUSED(void *priv)) { int ws_array[16] = { 3, 4, 5, 6, 7, 8, 4, 5, 6, 7, 8, 4, 5, 6, 7, 8 }; int ws; @@ -205,6 +206,9 @@ compaq_plasma_out(uint16_t addr, uint8_t val, void *priv) else mem_mapping_enable(&self->cga.mapping); break; + + default: + break; } } @@ -249,22 +253,25 @@ compaq_plasma_in(uint16_t addr, void *priv) case 0x23c6: ret = 0; break; + + default: + break; } return ret; } static void -compaq_plasma_poll(void *p) +compaq_plasma_poll(void *priv) { - compaq_plasma_t *self = (compaq_plasma_t *) p; - uint8_t chr, attr; + compaq_plasma_t *self = (compaq_plasma_t *) priv; + uint8_t chr; + uint8_t attr; uint8_t sc; uint16_t ma = (self->cga.crtc[13] | (self->cga.crtc[12] << 8)) & 0x7fff; uint16_t ca = (self->cga.crtc[15] | (self->cga.crtc[14] << 8)) & 0x7fff; uint16_t addr; int drawcursor; - int x, c; int cursorline; int blink = 0; int underline = 0; @@ -272,8 +279,10 @@ compaq_plasma_poll(void *p) uint32_t fg = (self->cga.cgacol & 0x0f) ? amber : black; uint32_t bg = black; uint32_t cols[2]; - uint8_t dat2, pattern; - uint32_t ink0 = 0, ink1 = 0; + uint8_t dat2; + uint8_t pattern; + uint32_t ink0 = 0; + uint32_t ink1 = 0; /* Switch between internal plasma and external CRT display. */ if ((cpq_st_display_internal != -1) && (cpq_st_display_internal != self->internal_monitor)) { @@ -304,25 +313,25 @@ compaq_plasma_poll(void *p) } else { addr = ((self->cga.displine >> 1) & 1) * 0x2000 + (self->cga.displine >> 2) * 80 + ((ma & ~1) << 1); } - for (x = 0; x < 80; x++) { - dat2 = self->cga.vram[(addr & 0x7FFF)]; + for (uint8_t x = 0; x < 80; x++) { + dat2 = self->cga.vram[addr & 0x7FFF]; addr++; - for (c = 0; c < 8; c++) { + for (uint8_t c = 0; c < 8; c++) { ink = (dat2 & 0x80) ? fg : bg; if (!(self->cga.cgamode & 8)) ink = black; - ((uint32_t *) buffer32->line[self->cga.displine])[x * 8 + c] = ink; + (buffer32->line[self->cga.displine])[x * 8 + c] = ink; dat2 <<= 1; } } } else { addr = ((self->cga.displine >> 1) & 1) * 0x2000 + (self->cga.displine >> 2) * 80 + ((ma & ~1) << 1); - for (x = 0; x < 80; x++) { - dat2 = self->cga.vram[(addr & 0x7fff)]; + for (uint8_t x = 0; x < 80; x++) { + dat2 = self->cga.vram[addr & 0x7fff]; addr++; - for (c = 0; c < 4; c++) { + for (uint8_t c = 0; c < 4; c++) { pattern = (dat2 & 0xC0) >> 6; if (!(self->cga.cgamode & 8)) pattern = 0; @@ -352,6 +361,9 @@ compaq_plasma_poll(void *p) case 3: ink0 = ink1 = amber; break; + + default: + break; } buffer32->line[self->cga.displine][x * 8 + 2 * c] = ink0; buffer32->line[self->cga.displine][x * 8 + 2 * c + 1] = ink1; @@ -371,7 +383,7 @@ compaq_plasma_poll(void *p) cursorline = ((self->cga.crtc[0x0a] & 0x0f) * 2 <= sc) && ((self->cga.crtc[0x0b] & 0x0F) * 2 >= sc); /* for each text column */ - for (x = 0; x < 80; x++) { + for (uint8_t x = 0; x < 80; x++) { /* video output enabled */ if (self->cga.cgamode & 8) { chr = self->cga.vram[(addr + 2 * x) & 0x7fff]; @@ -405,13 +417,13 @@ compaq_plasma_poll(void *p) /* character underline active and 7th row of pixels in character height being drawn */ if (underline && (sc == 7)) { /* for each pixel in character width */ - for (c = 0; c < 8; c++) + for (uint8_t c = 0; c < 8; c++) buffer32->line[self->cga.displine][(x << 3) + c] = mdaattr[attr][blink][1]; } else if (drawcursor) { - for (c = 0; c < 8; c++) + for (uint8_t c = 0; c < 8; c++) buffer32->line[self->cga.displine][(x << 3) + c] = cols[(fontdatm[chr + self->cga.fontbase][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (amber ^ black); } else { - for (c = 0; c < 8; c++) + for (uint8_t c = 0; c < 8; c++) buffer32->line[self->cga.displine][(x << 3) + c] = cols[(fontdatm[chr + self->cga.fontbase][sc] & (1 << (c ^ 7))) ? 1 : 0]; } @@ -427,7 +439,7 @@ compaq_plasma_poll(void *p) else cursorline = ((self->cga.crtc[0x0a] & 0x0f) * 2 <= sc) && ((self->cga.crtc[0x0b] & 0x0F) * 2 >= sc); - for (x = 0; x < 40; x++) { + for (uint8_t x = 0; x < 40; x++) { if (self->cga.cgamode & 8) { chr = self->cga.vram[(addr + 2 * x) & 0x7fff]; attr = self->cga.vram[(addr + 2 * x + 1) & 0x7fff]; @@ -460,14 +472,14 @@ compaq_plasma_poll(void *p) /* character underline active and 7th row of pixels in character height being drawn */ if (underline && (sc == 7)) { /* for each pixel in character width */ - for (c = 0; c < 8; c++) + for (uint8_t c = 0; c < 8; c++) buffer32->line[self->cga.displine][(x << 4) + (c * 2)] = buffer32->line[self->cga.displine][(x << 4) + (c * 2) + 1] = mdaattr[attr][blink][1]; } else if (drawcursor) { - for (c = 0; c < 8; c++) { + for (uint8_t c = 0; c < 8; c++) { buffer32->line[self->cga.displine][(x << 4) + c * 2] = buffer32->line[self->cga.displine][(x << 4) + c * 2 + 1] = cols[(fontdatm[chr][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (amber ^ black); } } else { - for (c = 0; c < 8; c++) { + for (uint8_t c = 0; c < 8; c++) { buffer32->line[self->cga.displine][(x << 4) + c * 2] = buffer32->line[self->cga.displine][(x << 4) + c * 2 + 1] = cols[(fontdatm[chr][sc] & (1 << (c ^ 7))) ? 1 : 0]; } } @@ -530,9 +542,7 @@ compaq_plasma_poll(void *p) static void compaq_plasma_mdaattr_rebuild(void) { - int c; - - for (c = 0; c < 256; c++) { + for (uint16_t c = 0; c < 256; c++) { mdaattr[c][0][0] = mdaattr[c][1][0] = mdaattr[c][1][1] = 16; if (c & 8) mdaattr[c][0][1] = 15 + 16; @@ -636,7 +646,7 @@ compaq_plasma_recalcattrs(compaq_plasma_t *self) } static void * -compaq_plasma_init(const device_t *info) +compaq_plasma_init(UNUSED(const device_t *info)) { compaq_plasma_t *self = malloc(sizeof(compaq_plasma_t)); memset(self, 0, sizeof(compaq_plasma_t)); @@ -674,18 +684,18 @@ compaq_plasma_init(const device_t *info) } static void -compaq_plasma_close(void *p) +compaq_plasma_close(void *priv) { - compaq_plasma_t *self = (compaq_plasma_t *) p; + compaq_plasma_t *self = (compaq_plasma_t *) priv; free(self->cga.vram); free(self); } static void -compaq_plasma_speed_changed(void *p) +compaq_plasma_speed_changed(void *priv) { - compaq_plasma_t *self = (compaq_plasma_t *) p; + compaq_plasma_t *self = (compaq_plasma_t *) priv; compaq_plasma_recalctimings(self); } @@ -727,7 +737,7 @@ const device_t compaq_plasma_device = { }; static uint8_t -read_ram(uint32_t addr, void *priv) +read_ram(uint32_t addr, UNUSED(void *priv)) { addr = (addr & 0x7ffff) + 0x80000; addreadlookup(mem_logical_addr, addr); @@ -736,7 +746,7 @@ read_ram(uint32_t addr, void *priv) } static uint16_t -read_ramw(uint32_t addr, void *priv) +read_ramw(uint32_t addr, UNUSED(void *priv)) { addr = (addr & 0x7ffff) + 0x80000; addreadlookup(mem_logical_addr, addr); @@ -745,7 +755,7 @@ read_ramw(uint32_t addr, void *priv) } static uint32_t -read_raml(uint32_t addr, void *priv) +read_raml(uint32_t addr, UNUSED(void *priv)) { addr = (addr & 0x7ffff) + 0x80000; addreadlookup(mem_logical_addr, addr); @@ -754,7 +764,7 @@ read_raml(uint32_t addr, void *priv) } static void -write_ram(uint32_t addr, uint8_t val, void *priv) +write_ram(uint32_t addr, uint8_t val, UNUSED(void *priv)) { addr = (addr & 0x7ffff) + 0x80000; addwritelookup(mem_logical_addr, addr); @@ -763,7 +773,7 @@ write_ram(uint32_t addr, uint8_t val, void *priv) } static void -write_ramw(uint32_t addr, uint16_t val, void *priv) +write_ramw(uint32_t addr, uint16_t val, UNUSED(void *priv)) { addr = (addr & 0x7ffff) + 0x80000; addwritelookup(mem_logical_addr, addr); @@ -772,7 +782,7 @@ write_ramw(uint32_t addr, uint16_t val, void *priv) } static void -write_raml(uint32_t addr, uint32_t val, void *priv) +write_raml(uint32_t addr, uint32_t val, UNUSED(void *priv)) { addr = (addr & 0x7ffff) + 0x80000; addwritelookup(mem_logical_addr, addr); @@ -830,6 +840,9 @@ machine_at_compaq_init(const machine_t *model, int type) machine_at_common_init(model); device_add(&keyboard_at_compaq_device); break; + + default: + break; } } diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index f13fe72cd..184cfc34d 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -211,7 +211,9 @@ machine_at_p2bls_init(const machine_t *model) device_add(&piix4e_device); device_add(&keyboard_ps2_ami_pci_device); device_add(&w83977ef_device); - // device_add(ics9xxx_get(ICS9150_08)); /* setting proper speeds requires some interaction with the AS97127F ASIC */ +#if 0 + device_add(ics9xxx_get(ICS9150_08)); /* setting proper speeds requires some interaction with the AS97127F ASIC */ +#endif device_add(&sst_flash_39sf020_device); spd_register(SPD_TYPE_SDRAM, 0xF, 256); device_add(&w83781d_device); /* fans: Chassis, CPU, Power; temperatures: MB, unused, CPU */ diff --git a/src/machine/m_at_socket4.c b/src/machine/m_at_socket4.c index ef745d088..b8e080d62 100644 --- a/src/machine/m_at_socket4.c +++ b/src/machine/m_at_socket4.c @@ -81,7 +81,9 @@ machine_at_award_common_init(const machine_t *model) if (fdc_type == FDC_INTERNAL) device_add(&fdc_at_device); - // device_add(&keyboard_ps2_pci_device); +#if 0 + device_add(&keyboard_ps2_pci_device); +#endif device_add(&keyboard_ps2_ami_pci_device); } diff --git a/src/machine/m_at_socket7_3v.c b/src/machine/m_at_socket7_3v.c index d8be38bb1..852ce0a55 100644 --- a/src/machine/m_at_socket7_3v.c +++ b/src/machine/m_at_socket7_3v.c @@ -61,7 +61,9 @@ machine_at_thor_common_init(const machine_t *model, int mr) if (gfxcard[0] == VID_INTERNAL) device_add(&s3_phoenix_trio64vplus_onboard_pci_device); - // device_add(&keyboard_ps2_ami_pci_device); +#if 0 + device_add(&keyboard_ps2_ami_pci_device); +#endif device_add(&keyboard_ps2_intel_ami_pci_device); device_add(&i430fx_device); device_add(&piix_device); diff --git a/src/machine/m_at_t3100e.c b/src/machine/m_at_t3100e.c index b1f8d10f6..0d0a9e372 100644 --- a/src/machine/m_at_t3100e.c +++ b/src/machine/m_at_t3100e.c @@ -166,6 +166,7 @@ #include <86box/fdc_ext.h> #include <86box/machine.h> #include <86box/m_at_t3100e.h> +#include <86box/plat_unused.h> extern uint8_t *ram; /* Physical RAM */ @@ -191,12 +192,12 @@ static unsigned t3100e_ems_page_reg[] = { 0x4208, 0x8208, 0xc208, /* The first four map the first 2Mb */ - /* of RAM into the page frame */ + /* of RAM into the page frame */ 0x218, 0x4218, 0x8218, 0xc218, /* The next four map the next 2Mb */ - /* of RAM */ + /* of RAM */ 0x258, 0x4258, 0x8258, @@ -221,7 +222,7 @@ struct t3100e_ems_regs { /* Bit 0 is 0 for colour, 1 for mono */ } t3100e_ems; -void t3100e_ems_out(uint16_t addr, uint8_t val, void *p); +void t3100e_ems_out(uint16_t addr, uint8_t val, void *priv); #ifdef ENABLE_T3100E_LOG int t3100e_do_log = ENABLE_T3100E_LOG; @@ -331,11 +332,15 @@ port_to_page(uint16_t addr) return 14; case 0xC268: return 15; + + default: + break; } return -1; } -/* Used to dump the memory mapping table, for debugging +/* Used to dump the memory mapping table, for debugging */ +#if 0 void dump_mappings(void) { mem_mapping_t *mm = base_mapping.next; @@ -377,7 +382,8 @@ void dump_mappings(void) mm = mm->next; } -}*/ +} +#endif void t3100e_map_ram(uint8_t val) @@ -437,7 +443,9 @@ t3100e_map_ram(uint8_t val) &t3100e_ems); } - // dump_mappings(); +#if 0 + dump_mappings(); +#endif } void @@ -470,9 +478,9 @@ t3100e_turbo_set(uint8_t value) } uint8_t -t3100e_sys_in(uint16_t addr, void *p) +t3100e_sys_in(UNUSED(uint16_t addr), void *priv) { - struct t3100e_ems_regs *regs = (struct t3100e_ems_regs *) p; + struct t3100e_ems_regs *regs = (struct t3100e_ems_regs *) priv; /* The low 4 bits always seem to be 0x0C. The high 4 are a * notification sent by the keyboard controller when it detects @@ -483,9 +491,11 @@ t3100e_sys_in(uint16_t addr, void *p) /* Handle writes to the T3100e system control port at 0x8084 */ void -t3100e_sys_out(uint16_t addr, uint8_t val, void *p) +t3100e_sys_out(UNUSED(uint16_t addr), uint8_t val, UNUSED(void *priv)) { - // struct t3100e_ems_regs *regs = (struct t3100e_ems_regs *)p; +#if 0 + struct t3100e_ems_regs *regs = (struct t3100e_ems_regs *) priv; +#endif switch (val & 0xE0) { case 0x00: /* Set serial port IRQs. Not implemented */ @@ -551,6 +561,9 @@ t3100e_config_get(void) value |= 0x10; break; /* Tri-mode */ /* All others will be treated as 1.4M */ + + default: + break; } break; case 4: @@ -574,7 +587,11 @@ t3100e_config_get(void) prt_switch = 0; /* No external drive */ } break; + + default: + break; } /* End switch */ + switch (prt_switch) { case 0: value |= 4; @@ -585,15 +602,18 @@ t3100e_config_get(void) case 2: value |= 6; break; /* External floppy is B: */ + + default: + break; } return value; } /* Read EMS page register */ uint8_t -t3100e_ems_in(uint16_t addr, void *p) +t3100e_ems_in(uint16_t addr, void *priv) { - struct t3100e_ems_regs *regs = (struct t3100e_ems_regs *) p; + struct t3100e_ems_regs *regs = (struct t3100e_ems_regs *) priv; int page = port_to_page(addr); if (page >= 0) @@ -606,9 +626,9 @@ t3100e_ems_in(uint16_t addr, void *p) /* Write EMS page register */ void -t3100e_ems_out(uint16_t addr, uint8_t val, void *p) +t3100e_ems_out(uint16_t addr, uint8_t val, void *priv) { - struct t3100e_ems_regs *regs = (struct t3100e_ems_regs *) p; + struct t3100e_ems_regs *regs = (struct t3100e_ems_regs *) priv; int pg = port_to_page(addr); if (pg == -1) @@ -654,9 +674,13 @@ ems_read_ramw(uint32_t addr, void *priv) if (pg < 0) return 0xFFFF; - // t3100e_log("ems_read_ramw addr=%05x ", addr); +#if 0 + t3100e_log("ems_read_ramw addr=%05x ", addr); +#endif addr = regs->page_exec[pg] + (addr & 0x3FFF); - // t3100e_log("-> %06x val=%04x\n", addr, *(uint16_t *)&ram[addr]); +#if 0 + // t3100e_log("-> %06x val=%04x\n", addr, *(uint16_t *) &ram[addr]); +#endif return *(uint16_t *) &ram[addr]; } @@ -693,9 +717,13 @@ ems_write_ramw(uint32_t addr, uint16_t val, void *priv) if (pg < 0) return; - // t3100e_log("ems_write_ramw addr=%05x ", addr); +#if 0 + t3100e_log("ems_write_ramw addr=%05x ", addr); +#endif addr = regs->page_exec[pg] + (addr & 0x3FFF); - // t3100e_log("-> %06x val=%04x\n", addr, val); +#if 0 + t3100e_log("-> %06x val=%04x\n", addr, val); +#endif *(uint16_t *) &ram[addr] = val; } diff --git a/src/machine/m_at_t3100e_vid.c b/src/machine/m_at_t3100e_vid.c index 9602b7b9e..d8ff55a82 100644 --- a/src/machine/m_at_t3100e_vid.c +++ b/src/machine/m_at_t3100e_vid.c @@ -66,6 +66,7 @@ #include <86box/video.h> #include <86box/vid_cga.h> #include <86box/m_at_t3100e.h> +#include <86box/plat_unused.h> #define T3100E_XSIZE 640 #define T3100E_YSIZE 400 @@ -134,14 +135,14 @@ typedef struct t3100e_t { static video_timings_t timing_t3100e = { VIDEO_ISA, 8, 16, 32, 8, 16, 32 }; void t3100e_recalctimings(t3100e_t *t3100e); -void t3100e_write(uint32_t addr, uint8_t val, void *p); -uint8_t t3100e_read(uint32_t addr, void *p); +void t3100e_write(uint32_t addr, uint8_t val, void *priv); +uint8_t t3100e_read(uint32_t addr, void *priv); void t3100e_recalcattrs(t3100e_t *t3100e); void -t3100e_out(uint16_t addr, uint8_t val, void *p) +t3100e_out(uint16_t addr, uint8_t val, void *priv) { - t3100e_t *t3100e = (t3100e_t *) p; + t3100e_t *t3100e = (t3100e_t *) priv; switch (addr) { /* Emulated CRTC, register select */ case 0x3d0: @@ -168,21 +169,20 @@ t3100e_out(uint16_t addr, uint8_t val, void *p) t3100e_recalctimings(t3100e); return; - /* CGA control register */ - case 0x3D8: - cga_out(addr, val, &t3100e->cga); - return; - /* CGA colour register */ - case 0x3D9: + case 0x3D8: /* CGA control register */ + case 0x3D9: /* CGA colour register */ cga_out(addr, val, &t3100e->cga); return; + + default: + break; } } uint8_t -t3100e_in(uint16_t addr, void *p) +t3100e_in(uint16_t addr, void *priv) { - t3100e_t *t3100e = (t3100e_t *) p; + t3100e_t *t3100e = (t3100e_t *) priv; uint8_t val; switch (addr) { @@ -196,24 +196,28 @@ t3100e_in(uint16_t addr, void *p) val |= 0x30; /* Plasma / CRT */ return val; } + break; + + default: + break; } return cga_in(addr, &t3100e->cga); } void -t3100e_write(uint32_t addr, uint8_t val, void *p) +t3100e_write(uint32_t addr, uint8_t val, void *priv) { - t3100e_t *t3100e = (t3100e_t *) p; + t3100e_t *t3100e = (t3100e_t *) priv; t3100e->vram[addr & 0x7fff] = val; cycles -= 4; } uint8_t -t3100e_read(uint32_t addr, void *p) +t3100e_read(uint32_t addr, void *priv) { - t3100e_t *t3100e = (t3100e_t *) p; + t3100e_t *t3100e = (t3100e_t *) priv; cycles -= 4; return t3100e->vram[addr & 0x7fff]; @@ -242,7 +246,6 @@ void t3100e_text_row80(t3100e_t *t3100e) { uint32_t cols[2]; - int c; uint8_t chr; uint8_t attr; int drawcursor; @@ -287,12 +290,12 @@ t3100e_text_row80(t3100e_t *t3100e) cols[0] = normcols[attr][0]; } if (drawcursor) { - for (c = 0; c < 8; c++) { - ((uint32_t *) buffer32->line[t3100e->displine])[(x << 3) + c] = cols[(fontdatm[bold][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (amber ^ black); + for (uint8_t c = 0; c < 8; c++) { + (buffer32->line[t3100e->displine])[(x << 3) + c] = cols[(fontdatm[bold][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (amber ^ black); } } else { - for (c = 0; c < 8; c++) - ((uint32_t *) buffer32->line[t3100e->displine])[(x << 3) + c] = cols[(fontdatm[bold][sc] & (1 << (c ^ 7))) ? 1 : 0]; + for (uint8_t c = 0; c < 8; c++) + (buffer32->line[t3100e->displine])[(x << 3) + c] = cols[(fontdatm[bold][sc] & (1 << (c ^ 7))) ? 1 : 0]; } ++ma; } @@ -349,11 +352,11 @@ t3100e_text_row40(t3100e_t *t3100e) } if (drawcursor) { for (c = 0; c < 8; c++) { - ((uint32_t *) buffer32->line[t3100e->displine])[(x << 4) + c * 2] = ((uint32_t *) buffer32->line[t3100e->displine])[(x << 4) + c * 2 + 1] = cols[(fontdatm[bold][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (amber ^ black); + (buffer32->line[t3100e->displine])[(x << 4) + c * 2] = (buffer32->line[t3100e->displine])[(x << 4) + c * 2 + 1] = cols[(fontdatm[bold][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (amber ^ black); } } else { for (c = 0; c < 8; c++) { - ((uint32_t *) buffer32->line[t3100e->displine])[(x << 4) + c * 2] = ((uint32_t *) buffer32->line[t3100e->displine])[(x << 4) + c * 2 + 1] = cols[(fontdatm[bold][sc] & (1 << (c ^ 7))) ? 1 : 0]; + (buffer32->line[t3100e->displine])[(x << 4) + c * 2] = (buffer32->line[t3100e->displine])[(x << 4) + c * 2 + 1] = cols[(fontdatm[bold][sc] & (1 << (c ^ 7))) ? 1 : 0]; } } ++ma; @@ -386,8 +389,8 @@ t3100e_cgaline6(t3100e_t *t3100e) ink = (dat & 0x80) ? fg : bg; if (!(t3100e->cga.cgamode & 8)) ink = black; - ((uint32_t *) buffer32->line[t3100e->displine])[x * 8 + c] = ink; - dat = dat << 1; + (buffer32->line[t3100e->displine])[x * 8 + c] = ink; + dat = dat << 1; } } } @@ -445,18 +448,21 @@ t3100e_cgaline4(t3100e_t *t3100e) case 3: ink0 = ink1 = amber; break; + + default: + break; } - ((uint32_t *) buffer32->line[t3100e->displine])[x * 8 + 2 * c] = ink0; - ((uint32_t *) buffer32->line[t3100e->displine])[x * 8 + 2 * c + 1] = ink1; - dat = dat << 2; + (buffer32->line[t3100e->displine])[x * 8 + 2 * c] = ink0; + (buffer32->line[t3100e->displine])[x * 8 + 2 * c + 1] = ink1; + dat = dat << 2; } } } void -t3100e_poll(void *p) +t3100e_poll(void *priv) { - t3100e_t *t3100e = (t3100e_t *) p; + t3100e_t *t3100e = (t3100e_t *) priv; if (t3100e->video_options != st_video_options) { t3100e->video_options = st_video_options; @@ -646,7 +652,7 @@ t3100e_recalcattrs(t3100e_t *t3100e) } void * -t3100e_init(const device_t *info) +t3100e_init(UNUSED(const device_t *info)) { t3100e_t *t3100e = malloc(sizeof(t3100e_t)); memset(t3100e, 0, sizeof(t3100e_t)); @@ -680,18 +686,18 @@ t3100e_init(const device_t *info) } void -t3100e_close(void *p) +t3100e_close(void *priv) { - t3100e_t *t3100e = (t3100e_t *) p; + t3100e_t *t3100e = (t3100e_t *) priv; free(t3100e->vram); free(t3100e); } void -t3100e_speed_changed(void *p) +t3100e_speed_changed(void *priv) { - t3100e_t *t3100e = (t3100e_t *) p; + t3100e_t *t3100e = (t3100e_t *) priv; t3100e_recalctimings(t3100e); } diff --git a/src/machine/m_elt.c b/src/machine/m_elt.c index fb7919f26..2fa92acca 100644 --- a/src/machine/m_elt.c +++ b/src/machine/m_elt.c @@ -50,11 +50,12 @@ #include <86box/rom.h> #include <86box/video.h> #include <86box/vid_cga.h> +#include <86box/plat_unused.h> static void -elt_vid_off_poll(void *p) +elt_vid_off_poll(void *priv) { - cga_t *cga = p; + cga_t *cga = priv; uint8_t hdisp = cga->crtc[1]; /* Don't display anything. @@ -65,9 +66,9 @@ elt_vid_off_poll(void *p) } static void -sysstat_out(uint16_t port, uint8_t val, void *p) +sysstat_out(UNUSED(uint16_t port), uint8_t val, void *priv) { - cga_t *cga = p; + cga_t *cga = priv; switch (val) { case 0: @@ -88,9 +89,9 @@ sysstat_out(uint16_t port, uint8_t val, void *p) } static uint8_t -sysstat_in(uint16_t port, void *p) +sysstat_in(UNUSED(uint16_t port), void *priv) { - cga_t *cga = p; + cga_t *cga = priv; uint8_t ret = 0x0a; /* No idea what these bits are */ /* External CRT. We don't emulate the LCD/CRT switching, let's just @@ -103,9 +104,9 @@ sysstat_in(uint16_t port, void *p) } static void -elt_vid_out(uint16_t addr, uint8_t val, void *p) +elt_vid_out(uint16_t addr, uint8_t val, void *priv) { - cga_t *cga = p; + cga_t *cga = priv; /* The Equity LT chipset's CRTC contains more registers than the * regular CGA. The BIOS writes one of them, register 36 (0x24). @@ -122,22 +123,23 @@ elt_vid_out(uint16_t addr, uint8_t val, void *p) case 0x3d1: if (cga->crtcreg >= 32) return; - /* FALLTHROUGH */ + [[fallthrough]]; + default: cga->crtcreg &= 31; - cga_out(addr, val, p); + cga_out(addr, val, priv); } } static uint8_t -elt_vid_in(uint16_t addr, void *p) +elt_vid_in(uint16_t addr, void *priv) { - cga_t *cga = p; + cga_t *cga = priv; /* Just make sure we don't ever let regular CGA code run with crtcreg * pointing out of crtcregs[] bounds. */ cga->crtcreg &= 31; - return cga_in(addr, p); + return cga_in(addr, priv); } static void diff --git a/src/machine/m_europc.c b/src/machine/m_europc.c index 615d6ff7b..e541cf718 100644 --- a/src/machine/m_europc.c +++ b/src/machine/m_europc.c @@ -104,6 +104,7 @@ #include <86box/hdc.h> #include <86box/video.h> #include <86box/machine.h> +#include <86box/plat_unused.h> #define EUROPC_DEBUG 0 /* current debugging level */ @@ -125,7 +126,7 @@ #define MRTC_CHECK_HI 0x0e /* Checksum, high byte */ #define MRTC_CTRLSTAT 0x0f /* RTC control/status, binary */ -typedef struct { +typedef struct europc_t { uint16_t jim; /* JIM base address */ uint8_t regs[16]; /* JIM internal regs (8) */ @@ -372,13 +373,17 @@ jim_set(europc_t *sys, uint8_t reg, uint8_t val) switch (val) { case 0x1f: /* 0001 1111 */ case 0x0b: /* 0000 1011 */ - // europc_jim.mode=AGA_MONO; +#if 0 + europc_jim.mode=AGA_MONO; +#endif europc_log("EuroPC: AGA Monochrome mode!\n"); break; case 0x18: /* 0001 1000 */ case 0x1a: /* 0001 1010 */ - // europc_jim.mode=AGA_COLOR; +#if 0 + europc_jim.mode=AGA_COLOR; +#endif break; case 0x0e: /* 0000 1100 */ @@ -392,7 +397,9 @@ jim_set(europc_t *sys, uint8_t reg, uint8_t val) break; default: - // europc_jim.mode=AGA_OFF; +#if 0 + europc_jim.mode=AGA_OFF; +#endif break; } break; @@ -400,15 +407,21 @@ jim_set(europc_t *sys, uint8_t reg, uint8_t val) case 4: /* CPU Speed control */ switch (val & 0xc0) { case 0x00: /* 4.77 MHz */ - // cpu_set_clockscale(0, 1.0/2); +#if 0 + cpu_set_clockscale(0, 1.0/2); +#endif break; case 0x40: /* 7.16 MHz */ - // cpu_set_clockscale(0, 3.0/4); +#if 0 + cpu_set_clockscale(0, 3.0/4); +#endif break; default: /* 9.54 MHz */ - // cpu_set_clockscale(0, 1);break; +#if 0 + cpu_set_clockscale(0, 1);break; +#endif break; } break; @@ -465,6 +478,9 @@ jim_write(uint16_t addr, uint8_t val, void *priv) sys->nvr_stat = 0; nvr_dosave++; break; + + default: + break; } break; @@ -511,6 +527,9 @@ jim_read(uint16_t addr, void *priv) r = (sys->nvr.regs[sys->nvr_addr] & 0x0f); sys->nvr_stat = 0; break; + + default: + break; } break; @@ -528,7 +547,7 @@ jim_read(uint16_t addr, void *priv) /* Initialize the mainboard 'device' of the machine. */ static void * -europc_boot(const device_t *info) +europc_boot(UNUSED(const device_t *info)) { europc_t *sys = &europc; uint8_t b; @@ -573,6 +592,9 @@ europc_boot(const device_t *info) case 640: b |= 0x00; break; + + default: + break; } sys->nvr.regs[MRTC_CONF_C] = b; @@ -590,6 +612,9 @@ europc_boot(const device_t *info) case 2: /* 8088, 9.56 MHz */ b |= 0x80; break; + + default: + break; } sys->nvr.regs[MRTC_CONF_D] = b; @@ -642,7 +667,7 @@ europc_boot(const device_t *info) } static void -europc_close(void *priv) +europc_close(UNUSED(void *priv)) { nvr_t *nvr = &europc.nvr; diff --git a/src/machine/m_pcjr.c b/src/machine/m_pcjr.c index c2163746b..9fd75ce0b 100644 --- a/src/machine/m_pcjr.c +++ b/src/machine/m_pcjr.c @@ -49,6 +49,7 @@ #include <86box/video.h> #include <86box/vid_cga_comp.h> #include <86box/machine.h> +#include <86box/plat_unused.h> #define PCJR_RGB 0 #define PCJR_COMPOSITE 1 @@ -62,7 +63,7 @@ #define STAT_IFULL 0x02 #define STAT_OFULL 0x01 -typedef struct { +typedef struct pcjr_t { /* Video Controller stuff. */ mem_mapping_t mapping; uint8_t crtc[32]; @@ -73,20 +74,28 @@ typedef struct { int memctrl; uint8_t stat; int addr_mode; - uint8_t *vram, - *b8000; - int linepos, displine; - int sc, vc; - int dispon; - int con, coff, cursoron, blink; - int vsynctime; - int fullchange; - int vadj; - uint16_t ma, maback; - uint64_t dispontime, dispofftime; - pc_timer_t timer; - int firstline, lastline; - int composite; + uint8_t *vram; + uint8_t *b8000; + int linepos; + int displine; + int sc; + int vc; + int dispon; + int con; + int coff; + int cursoron; + int blink; + int vsynctime; + int fullchange; + int vadj; + uint16_t ma; + uint16_t maback; + uint64_t dispontime; + uint64_t dispofftime; + pc_timer_t timer; + int firstline; + int lastline; + int composite; /* Keyboard Controller stuff. */ int latched; @@ -145,9 +154,9 @@ recalc_timings(pcjr_t *pcjr) } static void -vid_out(uint16_t addr, uint8_t val, void *p) +vid_out(uint16_t addr, uint8_t val, void *priv) { - pcjr_t *pcjr = (pcjr_t *) p; + pcjr_t *pcjr = (pcjr_t *) priv; uint8_t old; switch (addr) { @@ -184,13 +193,16 @@ vid_out(uint16_t addr, uint8_t val, void *p) pcjr->addr_mode = val >> 6; recalc_address(pcjr); break; + + default: + break; } } static uint8_t -vid_in(uint16_t addr, void *p) +vid_in(uint16_t addr, void *priv) { - pcjr_t *pcjr = (pcjr_t *) p; + pcjr_t *pcjr = (pcjr_t *) priv; uint8_t ret = 0xff; switch (addr) { @@ -207,15 +219,18 @@ vid_in(uint16_t addr, void *p) pcjr->stat ^= 0x10; ret = pcjr->stat; break; + + default: + break; } return ret; } static void -vid_write(uint32_t addr, uint8_t val, void *p) +vid_write(uint32_t addr, uint8_t val, void *priv) { - pcjr_t *pcjr = (pcjr_t *) p; + pcjr_t *pcjr = (pcjr_t *) priv; if (pcjr->memctrl == -1) return; @@ -224,9 +239,9 @@ vid_write(uint32_t addr, uint8_t val, void *p) } static uint8_t -vid_read(uint32_t addr, void *p) +vid_read(uint32_t addr, void *priv) { - pcjr_t *pcjr = (pcjr_t *) p; + pcjr_t *pcjr = (pcjr_t *) priv; if (pcjr->memctrl == -1) return 0xff; @@ -235,13 +250,12 @@ vid_read(uint32_t addr, void *p) } static void -vid_poll(void *p) +vid_poll(void *priv) { - pcjr_t *pcjr = (pcjr_t *) p; + pcjr_t *pcjr = (pcjr_t *) priv; uint16_t ca = (pcjr->crtc[15] | (pcjr->crtc[14] << 8)) & 0x3fff; int drawcursor; int x; - int c; int xs_temp; int ys_temp; int oldvc; @@ -268,8 +282,8 @@ vid_poll(void *p) } pcjr->lastline = pcjr->displine; cols[0] = (pcjr->array[2] & 0xf) + 16; - for (c = 0; c < 8; c++) { - ((uint32_t *) buffer32->line[pcjr->displine])[c] = cols[0]; + for (uint8_t c = 0; c < 8; c++) { + (buffer32->line[pcjr->displine])[c] = cols[0]; if (pcjr->array[0] & 1) { buffer32->line[pcjr->displine << 1][c + (pcjr->crtc[1] << 3) + 8] = buffer32->line[(pcjr->displine << 1) + 1][c + (pcjr->crtc[1] << 3) + 8] = cols[0]; } else { @@ -288,6 +302,9 @@ vid_poll(void *p) case 3: /*High resolution graphics*/ offset = (pcjr->sc & 3) * 0x2000; break; + + default: + break; } switch ((pcjr->array[0] & 0x13) | ((pcjr->array[3] & 0x08) << 5)) { case 0x13: /*320x200x16*/ @@ -314,7 +331,7 @@ vid_poll(void *p) for (x = 0; x < pcjr->crtc[1]; x++) { dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) | pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1]; pcjr->ma++; - for (c = 0; c < 8; c++) { + for (uint8_t c = 0; c < 8; c++) { chr = (dat >> 7) & 1; chr |= ((dat >> 14) & 2); buffer32->line[pcjr->displine << 1][(x << 3) + 8 + c] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 8 + c] = pcjr->array[(chr & pcjr->array[1]) + 16] + 16; @@ -337,16 +354,16 @@ vid_poll(void *p) cols[0] = pcjr->array[((attr >> 4) & pcjr->array[1]) + 16] + 16; } if (pcjr->sc & 8) { - for (c = 0; c < 8; c++) { + for (uint8_t c = 0; c < 8; c++) { buffer32->line[pcjr->displine << 1][(x << 3) + c + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + c + 8] = cols[0]; } } else { - for (c = 0; c < 8; c++) { + for (uint8_t c = 0; c < 8; c++) { buffer32->line[pcjr->displine << 1][(x << 3) + c + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0]; } } if (drawcursor) { - for (c = 0; c < 8; c++) { + for (uint8_t c = 0; c < 8; c++) { buffer32->line[pcjr->displine << 1][(x << 3) + c + 8] ^= 15; buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + c + 8] ^= 15; } @@ -370,17 +387,17 @@ vid_poll(void *p) } pcjr->ma++; if (pcjr->sc & 8) { - for (c = 0; c < 8; c++) { - buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[0]; + for (uint8_t c = 0; c < 8; c++) { + buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[0]; } } else { - for (c = 0; c < 8; c++) { - buffer32->line[(pcjr->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0]; + for (uint8_t c = 0; c < 8; c++) { + buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0]; } } if (drawcursor) { - for (c = 0; c < 16; c++) { - buffer32->line[(pcjr->displine << 1)][(x << 4) + c + 8] ^= 15; + for (uint8_t c = 0; c < 16; c++) { + buffer32->line[pcjr->displine << 1][(x << 4) + c + 8] ^= 15; buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + c + 8] ^= 15; } } @@ -394,8 +411,8 @@ vid_poll(void *p) for (x = 0; x < pcjr->crtc[1]; x++) { dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) | pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1]; pcjr->ma++; - for (c = 0; c < 8; c++) { - buffer32->line[(pcjr->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14]; + for (uint8_t c = 0; c < 8; c++) { + buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14]; dat <<= 2; } } @@ -406,12 +423,15 @@ vid_poll(void *p) for (x = 0; x < pcjr->crtc[1]; x++) { dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) | pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1]; pcjr->ma++; - for (c = 0; c < 16; c++) { - buffer32->line[(pcjr->displine << 1)][(x << 4) + c + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + c + 8] = cols[dat >> 15]; + for (uint8_t c = 0; c < 16; c++) { + buffer32->line[pcjr->displine << 1][(x << 4) + c + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + c + 8] = cols[dat >> 15]; dat <<= 1; } } break; + + default: + break; } } else { if (pcjr->array[3] & 4) { @@ -438,7 +458,7 @@ vid_poll(void *p) else x = (pcjr->crtc[1] << 4) + 16; if (pcjr->composite) { - Composite_Process(pcjr->array[0], 0, x >> 2, buffer32->line[(pcjr->displine << 1)]); + Composite_Process(pcjr->array[0], 0, x >> 2, buffer32->line[pcjr->displine << 1]); Composite_Process(pcjr->array[0], 0, x >> 2, buffer32->line[(pcjr->displine << 1) + 1]); } else { video_process_8(x, pcjr->displine << 1); @@ -550,7 +570,7 @@ vid_poll(void *p) pcjr->sc &= 31; pcjr->ma = pcjr->maback; } - if ((pcjr->sc == (pcjr->crtc[10] & 31) || ((pcjr->crtc[8] & 3) == 3 && pcjr->sc == ((pcjr->crtc[10] & 31) >> 1)))) + if (pcjr->sc == (pcjr->crtc[10] & 31) || ((pcjr->crtc[8] & 3) == 3 && pcjr->sc == ((pcjr->crtc[10] & 31) >> 1))) pcjr->con = 1; } } @@ -591,6 +611,9 @@ kbd_write(uint16_t port, uint8_t val, void *priv) case 0x60: sn76489_mute = 0; break; + + default: + break; } break; @@ -598,6 +621,9 @@ kbd_write(uint16_t port, uint8_t val, void *priv) nmi_mask = val & 0x80; pit_devs[0].set_using_timer(pit_devs[0].data, 1, !(val & 0x20)); break; + + default: + break; } } @@ -637,6 +663,9 @@ kbd_read(uint16_t port, void *priv) pcjr->latched = 0; ret = 0; break; + + default: + break; } return ret; @@ -765,7 +794,7 @@ const device_t pcjr_device = { }; int -machine_pcjr_init(const machine_t *model) +machine_pcjr_init(UNUSED(const machine_t *model)) { int display_type; pcjr_t *pcjr; diff --git a/src/machine/m_ps1.c b/src/machine/m_ps1.c index e3675e74b..d2c9f80ba 100644 --- a/src/machine/m_ps1.c +++ b/src/machine/m_ps1.c @@ -153,6 +153,9 @@ ps1_write(uint16_t port, uint8_t val, void *priv) case 2: lpt1_init(LPT2_ADDR); break; + + default: + break; } } ps->ps1_102 = val; @@ -174,6 +177,9 @@ ps1_write(uint16_t port, uint8_t val, void *priv) case 0x0190: ps->ps1_190 = val; break; + + default: + break; } } diff --git a/src/machine/m_ps1_hdc.c b/src/machine/m_ps1_hdc.c index bd0c8851d..e81e0820c 100644 --- a/src/machine/m_ps1_hdc.c +++ b/src/machine/m_ps1_hdc.c @@ -161,54 +161,54 @@ enum { * block is transferred. */ #pragma pack(push, 1) -typedef struct { +typedef struct ssb_t { /* Status byte 0. */ - uint8_t track_0 : 1, /* T0 */ - mbz1 : 1, /* 0 */ - mbz2 : 1, /* 0 */ - cylinder_err : 1, /* CE */ - write_fault : 1, /* WF */ - mbz3 : 1, /* 0 */ - seek_end : 1, /* SE */ - not_ready : 1; /* NR */ + uint8_t track_0 : 1; /* T0 */ + uint8_t mbz1 : 1; /* 0 */ + uint8_t mbz2 : 1; /* 0 */ + uint8_t cylinder_err : 1; /* CE */ + uint8_t write_fault : 1; /* WF */ + uint8_t mbz3 : 1; /* 0 */ + uint8_t seek_end : 1; /* SE */ + uint8_t not_ready : 1; /* NR */ /* Status byte 1. */ - uint8_t id_not_found : 1, /* ID */ - mbz4 : 1, /* 0 */ - mbz5 : 1, /* 0 */ - wrong_cyl : 1, /* WC */ - all_bit_set : 1, /* BT */ - mark_not_found : 1, /* AM */ - ecc_crc_err : 1, /* ET */ - ecc_crc_field : 1; /* EF */ + uint8_t id_not_found : 1; /* ID */ + uint8_t mbz4 : 1; /* 0 */ + uint8_t mbz5 : 1; /* 0 */ + uint8_t wrong_cyl : 1; /* WC */ + uint8_t all_bit_set : 1; /* BT */ + uint8_t mark_not_found : 1; /* AM */ + uint8_t ecc_crc_err : 1; /* ET */ + uint8_t ecc_crc_field : 1; /* EF */ /* Status byte 2. */ - uint8_t headsel_state : 4, /* headsel state[4] */ - defective_sector : 1, /* DS */ - retried_ok : 1, /* RG */ - need_reset : 1, /* RR */ + uint8_t headsel_state : 4; /* headsel state[4] */ + uint8_t defective_sector : 1; /* DS */ + uint8_t retried_ok : 1; /* RG */ + uint8_t need_reset : 1; /* RR */ #if 1 - valid : 1; /* 0 (abused as VALID) */ + uint8_t valid : 1; /* 0 (abused as VALID) */ #else - mbz6 : 1; /* 0 */ + uint8_t mbz6 : 1; /* 0 */ #endif /* Most recent ID field seen. */ - uint8_t last_cyl_low; /* Cyl_Low[8] */ - uint8_t last_head : 4, /* HD[4] */ - mbz7 : 1, /* 0 */ - last_cyl_high : 2, /* Cyl_high[2] */ - last_def_sect : 1; /* DS */ - uint8_t last_sect; /* Sect[8] */ + uint8_t last_cyl_low; /* Cyl_Low[8] */ + uint8_t last_head : 4; /* HD[4] */ + uint8_t mbz7 : 1; /* 0 */ + uint8_t last_cyl_high : 2; /* Cyl_high[2] */ + uint8_t last_def_sect : 1; /* DS */ + uint8_t last_sect; /* Sect[8] */ uint8_t sect_size; /* Size[8] = 02 */ /* Current position. */ - uint8_t curr_cyl_high : 2, /* Cyl_High_[2] */ - mbz8 : 1, /* 0 */ - mbz9 : 1, /* 0 */ - curr_head : 4; /* HD_2[4] */ - uint8_t curr_cyl_low; /* Cyl_Low_2[8] */ + uint8_t curr_cyl_high : 2; /* Cyl_High_[2] */ + uint8_t mbz8 : 1; /* 0 */ + uint8_t mbz9 : 1; /* 0 */ + uint8_t curr_head : 4; /* HD_2[4] */ + uint8_t curr_cyl_low; /* Cyl_Low_2[8] */ uint8_t sect_corr; /* sectors corrected */ @@ -290,21 +290,21 @@ typedef struct { * bits 0. */ #pragma pack(push, 1) -typedef struct { - uint8_t cyl_high : 2, /* cylinder [9:8] bits */ - defective_sector : 1, /* DS */ - mbz1 : 1, /* 0 */ - head : 4; /* head number */ +typedef struct fcb_t { + uint8_t cyl_high : 2; /* cylinder [9:8] bits */ + uint8_t defective_sector : 1; /* DS */ + uint8_t mbz1 : 1; /* 0 */ + uint8_t head : 4; /* head number */ - uint8_t cyl_low; /* cylinder [7:0] bits */ + uint8_t cyl_low; /* cylinder [7:0] bits */ - uint8_t sector; /* sector number */ + uint8_t sector; /* sector number */ - uint8_t mbz2 : 1, /* 0 */ - mbo : 1, /* 1 */ - mbz3 : 6; /* 000000 */ + uint8_t mbz2 : 1; /* 0 */ + uint8_t mbo : 1; /* 1 */ + uint8_t mbz3 : 6; /* 000000 */ - uint8_t fill; /* filler byte */ + uint8_t fill; /* filler byte */ } fcb_t; #pragma pack(pop) @@ -316,31 +316,31 @@ typedef struct { * through a DMA or PIO operation. */ #pragma pack(push, 1) -typedef struct { - uint8_t ec_p : 1, /* EC/P (ecc/park) */ - mbz1 : 1, /* 0 */ - auto_seek : 1, /* AS (auto-seek) */ - no_data : 1, /* ND (no data) */ - cmd : 4; /* command code[4] */ +typedef struct ccb_t{ + uint8_t ec_p : 1; /* EC/P (ecc/park) */ + uint8_t mbz1 : 1; /* 0 */ + uint8_t auto_seek : 1; /* AS (auto-seek) */ + uint8_t no_data : 1; /* ND (no data) */ + uint8_t cmd : 4; /* command code[4] */ - uint8_t cyl_high : 2, /* cylinder [9:8] bits */ - mbz2 : 2, /* 00 */ - head : 4; /* head number */ + uint8_t cyl_high : 2; /* cylinder [9:8] bits */ + uint8_t mbz2 : 2; /* 00 */ + uint8_t head : 4; /* head number */ uint8_t cyl_low; /* cylinder [7:0] bits */ uint8_t sector; /* sector number */ - uint8_t mbz3 : 1, /* 0 */ - mbo1 : 1, /* 1 */ - mbz4 : 6; /* 000000 */ + uint8_t mbz3 : 1; /* 0 */ + uint8_t mbo1 : 1; /* 1 */ + uint8_t mbz4 : 6; /* 000000 */ uint8_t count; /* blk count/interleave */ } ccb_t; #pragma pack(pop) /* Define the hard drive geometry table. */ -typedef struct { +typedef struct geom_t { uint16_t cyl; uint8_t hpc; uint8_t spt; @@ -349,54 +349,54 @@ typedef struct { } geom_t; /* Define an attached drive. */ -typedef struct { - int8_t id, /* drive ID on bus */ - present, /* drive is present */ - hdd_num, /* index to global disk table */ - type; /* drive type ID */ +typedef struct drive_t { + int8_t id; /* drive ID on bus */ + int8_t present; /* drive is present */ + int8_t hdd_num; /* index to global disk table */ + int8_t type; /* drive type ID */ uint16_t cur_cyl; /* last known position of heads */ - uint8_t spt, /* active drive parameters */ - hpc; + uint8_t spt; /* active drive parameters */ + uint8_t hpc; uint16_t tracks; - uint8_t cfg_spt, /* configured drive parameters */ - cfg_hpc; + uint8_t cfg_spt; /* configured drive parameters */ + uint8_t cfg_hpc; uint16_t cfg_tracks; } drive_t; -typedef struct { +typedef struct hdc_t { uint16_t base; /* controller base I/O address */ int8_t irq; /* controller IRQ channel */ int8_t dma; /* controller DMA channel */ /* Registers. */ - uint8_t attn, /* ATTENTION register */ - ctrl, /* Control register (ACR) */ - status, /* Status register (ASR) */ - intstat; /* Interrupt Status register (ISR) */ + uint8_t attn; /* ATTENTION register */ + uint8_t ctrl; /* Control register (ACR) */ + uint8_t status; /* Status register (ASR) */ + uint8_t intstat; /* Interrupt Status register (ISR) */ uint8_t *reg_91; /* handle to system board's register 0x91 */ /* Controller state. */ uint64_t callback; pc_timer_t timer; - int8_t state, /* controller state */ - reset; /* reset state counter */ + int8_t state; /* controller state */ + int8_t reset; /* reset state counter */ /* Data transfer. */ - int16_t buf_idx, /* buffer index and pointer */ - buf_len; + int16_t buf_idx; /* buffer index and pointer */ + int16_t buf_len; uint8_t *buf_ptr; /* Current operation parameters. */ - ssb_t ssb; /* sense block */ - ccb_t ccb; /* command control block */ - uint16_t track; /* requested track# */ - uint8_t head, /* requested head# */ - sector; /* requested sector# */ - int count; /* requested sector count */ + ssb_t ssb; /* sense block */ + ccb_t ccb; /* command control block */ + uint16_t track; /* requested track# */ + uint8_t head; /* requested head# */ + uint8_t sector; /* requested sector# */ + int count; /* requested sector count */ drive_t drives[XTA_NUM]; /* the attached drive(s) */ @@ -602,8 +602,10 @@ do_seek(hdc_t *dev, drive_t *drive, uint16_t cyl) static void do_format(hdc_t *dev, drive_t *drive, ccb_t *ccb) { - int start_cyl, end_cyl; - int intr = 0, val; + int start_cyl; + int end_cyl; + int intr = 0; + int val; off64_t addr; #if 0 fcb_t *fcb; @@ -697,8 +699,7 @@ do_fmt: /* Done with this track. */ dev->state = STATE_FDONE; - /*FALLTHROUGH*/ - + [[fallthrough]]; case STATE_FDONE: /* One more track done. */ if (++start_cyl == end_cyl) { @@ -712,6 +713,9 @@ do_fmt: /* This saves us a LOT of code. */ dev->state = STATE_FINIT; goto do_fmt; + + default: + break; } /* If we errored out, go back idle. */ @@ -870,6 +874,9 @@ do_send: /* This saves us a LOT of code. */ dev->state = STATE_SEND; goto do_send; + + default: + break; } break; @@ -1012,6 +1019,9 @@ do_recv: /* This saves us a LOT of code. */ dev->state = STATE_RECV; goto do_recv; + + default: + break; } break; @@ -1125,6 +1135,9 @@ hdc_read(uint16_t port, void *priv) ret = dev->intstat; dev->intstat = 0x00; break; + + default: + break; } return ret; @@ -1231,11 +1244,14 @@ hdc_write(uint16_t port, uint8_t val, void *priv) set_intr(dev, 1); } break; + + default: + break; } } static void * -ps1_hdc_init(const device_t *info) +ps1_hdc_init(UNUSED(const device_t *info)) { drive_t *drive; hdc_t *dev; diff --git a/src/machine/m_ps2_isa.c b/src/machine/m_ps2_isa.c index af4fc5849..fa9c5acc2 100644 --- a/src/machine/m_ps2_isa.c +++ b/src/machine/m_ps2_isa.c @@ -72,6 +72,9 @@ ps2_write(uint16_t port, uint8_t val, void *priv) case 2: lpt1_init(LPT2_ADDR); break; + + default: + break; } } ps2->ps2_102 = val; @@ -93,6 +96,9 @@ ps2_write(uint16_t port, uint8_t val, void *priv) case 0x0190: ps2->ps2_190 = val; break; + + default: + break; } } @@ -131,6 +137,9 @@ ps2_read(uint16_t port, void *priv) case 0x0190: temp = ps2->ps2_190; break; + + default: + break; } return temp; diff --git a/src/machine/m_ps2_mca.c b/src/machine/m_ps2_mca.c index c43f7ef9b..b93f332db 100644 --- a/src/machine/m_ps2_mca.c +++ b/src/machine/m_ps2_mca.c @@ -68,15 +68,16 @@ #include <86box/serial.h> #include <86box/video.h> #include <86box/machine.h> +#include <86box/plat_unused.h> -static struct -{ +static struct ps2_t { uint8_t adapter_setup; uint8_t option[4]; uint8_t pos_vga; uint8_t setup; uint8_t sys_ctrl_port_a; - uint8_t subaddr_lo, subaddr_hi; + uint8_t subaddr_lo; + uint8_t subaddr_hi; uint8_t memory_bank[8]; @@ -88,11 +89,12 @@ static struct mem_mapping_t cache_mapping; uint8_t (*planar_read)(uint16_t port); - void (*planar_write)(uint16_t port, uint8_t val); + void (*planar_write)(uint16_t port, uint8_t val); uint8_t mem_regs[3]; - uint32_t split_addr, split_size; + uint32_t split_addr; + uint32_t split_size; uint32_t split_phys; uint8_t mem_pos_regs[8]; @@ -158,7 +160,7 @@ ps2_mca_log(const char *fmt, ...) #endif static uint8_t -ps2_read_cache_ram(uint32_t addr, void *priv) +ps2_read_cache_ram(uint32_t addr, UNUSED(void *priv)) { ps2_mca_log("ps2_read_cache_ram: addr=%08x %i %04x:%04x\n", addr, ps2_cache_valid[addr >> 3], CS, cpu_state.pc); if (!ps2_cache_valid[addr >> 3]) { @@ -170,7 +172,7 @@ ps2_read_cache_ram(uint32_t addr, void *priv) return ps2_cache[addr]; } static uint16_t -ps2_read_cache_ramw(uint32_t addr, void *priv) +ps2_read_cache_ramw(uint32_t addr, UNUSED(void *priv)) { ps2_mca_log("ps2_read_cache_ramw: addr=%08x %i %04x:%04x\n", addr, ps2_cache_valid[addr >> 3], CS, cpu_state.pc); if (!ps2_cache_valid[addr >> 3]) { @@ -182,7 +184,7 @@ ps2_read_cache_ramw(uint32_t addr, void *priv) return *(uint16_t *) &ps2_cache[addr]; } static uint32_t -ps2_read_cache_raml(uint32_t addr, void *priv) +ps2_read_cache_raml(uint32_t addr, UNUSED(void *priv)) { ps2_mca_log("ps2_read_cache_raml: addr=%08x %i %04x:%04x\n", addr, ps2_cache_valid[addr >> 3], CS, cpu_state.pc); if (!ps2_cache_valid[addr >> 3]) { @@ -194,7 +196,7 @@ ps2_read_cache_raml(uint32_t addr, void *priv) return *(uint32_t *) &ps2_cache[addr]; } static void -ps2_write_cache_ram(uint32_t addr, uint8_t val, void *priv) +ps2_write_cache_ram(uint32_t addr, uint8_t val, UNUSED(void *priv)) { ps2_mca_log("ps2_write_cache_ram: addr=%08x val=%02x %04x:%04x %i\n", addr, val, CS, cpu_state.pc); ps2_cache[addr] = val; @@ -268,6 +270,9 @@ model_50_read(uint16_t port) return ps2.subaddr_lo; case 0x107: return ps2.subaddr_hi; + + default: + break; } return 0xff; } @@ -292,6 +297,9 @@ model_55sx_read(uint16_t port) return ps2.subaddr_lo; case 0x107: return ps2.subaddr_hi; + + default: + break; } return 0xff; } @@ -316,6 +324,9 @@ model_70_type3_read(uint16_t port) return ps2.subaddr_lo; case 0x107: return ps2.subaddr_hi; + + default: + break; } return 0xff; } @@ -340,6 +351,9 @@ model_80_read(uint16_t port) return ps2.subaddr_lo; case 0x107: return ps2.subaddr_hi; + + default: + break; } return 0xff; } @@ -373,6 +387,9 @@ model_50_write(uint16_t port, uint8_t val) case 2: lpt1_init(LPT2_ADDR); break; + + default: + break; } } ps2.option[0] = val; @@ -392,6 +409,9 @@ model_50_write(uint16_t port, uint8_t val) case 0x107: ps2.subaddr_hi = val; break; + + default: + break; } } @@ -458,11 +478,12 @@ model_55sx_mem_recalc(void) mem_set_mem_state(0xe0000, 0x20000, state); - /* if (!(ps2.option[3] & 0x08)) - { +#if 0 + if (!(ps2.option[3] & 0x08)) { ps2_mca_log("Memory not yet configured\n"); return; - } */ + } +#endif ps2_mca_log("Enable shadow mapping at %06X-%06X\n", (mem_size * 1024), (mem_size * 1024) + (remap_size * 1024) - 1); @@ -503,6 +524,9 @@ model_55sx_write(uint16_t port, uint8_t val) case 2: lpt1_init(LPT2_ADDR); break; + + default: + break; } } ps2.option[0] = val; @@ -529,6 +553,9 @@ model_55sx_write(uint16_t port, uint8_t val) case 0x107: ps2.subaddr_hi = val; break; + + default: + break; } } @@ -560,6 +587,9 @@ model_70_type3_write(uint16_t port, uint8_t val) case 2: lpt1_init(LPT2_ADDR); break; + + default: + break; } } ps2.option[0] = val; @@ -581,6 +611,9 @@ model_70_type3_write(uint16_t port, uint8_t val) case 0x107: ps2.subaddr_hi = val; break; + + default: + break; } } @@ -612,6 +645,9 @@ model_80_write(uint16_t port, uint8_t val) case 2: lpt1_init(LPT2_ADDR); break; + + default: + break; } } ps2.option[0] = val; @@ -631,17 +667,22 @@ model_80_write(uint16_t port, uint8_t val) case 0x107: ps2.subaddr_hi = val; break; + + default: + break; } } uint8_t -ps2_mca_read(uint16_t port, void *p) +ps2_mca_read(uint16_t port, UNUSED(void *priv)) { uint8_t temp; switch (port) { case 0x91: - // fatal("Read 91 setup=%02x adapter=%02x\n", ps2.setup, ps2.adapter_setup); +#if 0 + fatal("Read 91 setup=%02x adapter=%02x\n", ps2.setup, ps2.adapter_setup); +#endif if (!(ps2.setup & PS2_SETUP_IO)) temp = 0x00; else if (!(ps2.setup & PS2_SETUP_VGA)) @@ -740,7 +781,7 @@ ps2_mca_read(uint16_t port, void *p) } static void -ps2_mca_write(uint16_t port, uint8_t val, void *p) +ps2_mca_write(uint16_t port, uint8_t val, UNUSED(void *priv)) { ps2_mca_log("ps2_write: port=%04x val=%02x %04x:%04x\n", port, val, CS, cpu_state.pc); @@ -763,7 +804,7 @@ ps2_mca_write(uint16_t port, uint8_t val, void *p) case 0x101: if (!(ps2.setup & PS2_SETUP_IO)) ps2.planar_write(port, val); - else if ((ps2.setup & PS2_SETUP_VGA) && (ps2.setup & PS2_SETUP_VGA) && (ps2.adapter_setup & PS2_ADAPTER_SETUP)) + else if ((ps2.setup & PS2_SETUP_VGA) && (ps2.adapter_setup & PS2_ADAPTER_SETUP)) mca_write(port, val); break; case 0x102: @@ -804,6 +845,9 @@ ps2_mca_write(uint16_t port, uint8_t val, void *p) else if (ps2.adapter_setup & PS2_ADAPTER_SETUP) mca_write(port, val); break; + + default: + break; } } @@ -824,13 +868,13 @@ ps2_mca_board_common_init(void) } static uint8_t -ps2_mem_expansion_read(int port, void *p) +ps2_mem_expansion_read(int port, UNUSED(void *priv)) { return ps2.mem_pos_regs[port & 7]; } static void -ps2_mem_expansion_write(int port, uint8_t val, void *p) +ps2_mem_expansion_write(int port, uint8_t val, UNUSED(void *priv)) { if (port < 0x102 || port == 0x104) return; @@ -844,7 +888,7 @@ ps2_mem_expansion_write(int port, uint8_t val, void *p) } static uint8_t -ps2_mem_expansion_feedb(void *p) +ps2_mem_expansion_feedb(UNUSED(void *priv)) { return (ps2.mem_pos_regs[2] & 1); } @@ -888,6 +932,9 @@ ps2_mca_mem_fffc_init(int start_mb) case 8: ps2.mem_pos_regs[4] = 0xaa; /* 10 10 10 10 = 2 2 2 2 */ break; + + default: + break; } mca_add(ps2_mem_expansion_read, ps2_mem_expansion_write, ps2_mem_expansion_feedb, NULL, NULL); @@ -988,9 +1035,6 @@ ps2_mca_board_model_55sx_init(int has_sec_nvram, int slots) ps2.memory_bank[1] = 0x61; break; case 6: - ps2.memory_bank[0] = 0x01; - ps2.memory_bank[1] = 0x51; - break; case 7: /*Not supported*/ ps2.memory_bank[0] = 0x01; ps2.memory_bank[1] = 0x51; @@ -999,6 +1043,9 @@ ps2_mca_board_model_55sx_init(int has_sec_nvram, int slots) ps2.memory_bank[0] = 0x01; ps2.memory_bank[1] = 0x01; break; + + default: + break; } mca_init(slots); @@ -1071,18 +1118,21 @@ mem_encoding_update(void) } static uint8_t -mem_encoding_read(uint16_t addr, void *p) +mem_encoding_read(uint16_t addr, UNUSED(void *priv)) { switch (addr) { case 0xe0: return ps2.mem_regs[0]; case 0xe1: return ps2.mem_regs[1]; + + default: + break; } return 0xff; } static void -mem_encoding_write(uint16_t addr, uint8_t val, void *p) +mem_encoding_write(uint16_t addr, uint8_t val, UNUSED(void *priv)) { switch (addr) { case 0xe0: @@ -1091,12 +1141,15 @@ mem_encoding_write(uint16_t addr, uint8_t val, void *p) case 0xe1: ps2.mem_regs[1] = val; break; + + default: + break; } mem_encoding_update(); } static uint8_t -mem_encoding_read_cached(uint16_t addr, void *p) +mem_encoding_read_cached(uint16_t addr, UNUSED(void *priv)) { switch (addr) { case 0xe0: @@ -1105,12 +1158,15 @@ mem_encoding_read_cached(uint16_t addr, void *p) return ps2.mem_regs[1]; case 0xe2: return ps2.mem_regs[2]; + + default: + break; } return 0xff; } static void -mem_encoding_write_cached(uint16_t addr, uint8_t val, void *p) +mem_encoding_write_cached(uint16_t addr, uint8_t val, UNUSED(void *priv)) { uint8_t old; @@ -1145,6 +1201,9 @@ mem_encoding_write_cached(uint16_t addr, uint8_t val, void *p) ram_mid_mapping.flags &= ~MEM_MAPPING_ROM_WS; #endif break; + + default: + break; } ps2_mca_log("mem_encoding_write: addr=%02x val=%02x %04x:%04x %02x %02x\n", addr, val, CS, cpu_state.pc, ps2.mem_regs[1], ps2.mem_regs[2]); mem_encoding_update(); @@ -1253,7 +1312,7 @@ ps2_mca_board_model_70_type34_init(int is_type4, int slots) } static void -ps2_mca_board_model_80_type2_init(int is486) +ps2_mca_board_model_80_type2_init(int is486ps2) { ps2_mca_board_common_init(); @@ -1313,7 +1372,7 @@ ps2_mca_board_model_80_type2_init(int is486) NULL); mem_mapping_disable(&ps2.split_mapping); - if ((mem_size > 4096) && !is486) { + if ((mem_size > 4096) && !is486ps2) { /* Only 4 MB supported on planar, create a memory expansion card for the rest */ if (mem_size > 12288) ps2_mca_mem_d071_init(4); diff --git a/src/machine/m_tandy.c b/src/machine/m_tandy.c index 24ecc654a..eaacefc7b 100644 --- a/src/machine/m_tandy.c +++ b/src/machine/m_tandy.c @@ -43,6 +43,7 @@ #include <86box/video.h> #include <86box/vid_cga_comp.h> #include <86box/machine.h> +#include <86box/plat_unused.h> enum { TANDY_RGB = 0, @@ -62,7 +63,7 @@ enum { EEPROM_WRITE }; -typedef struct { +typedef struct t1kvid_t { mem_mapping_t mapping; mem_mapping_t vram_mapping; @@ -72,36 +73,41 @@ typedef struct { int array_index; uint8_t array[256]; int memctrl; - uint8_t mode, col; + uint8_t mode; + uint8_t col; uint8_t stat; - uint8_t *vram, *b8000; + uint8_t *vram; + uint8_t *b8000; uint32_t b8000_mask; uint32_t b8000_limit; uint8_t planar_ctrl; - int linepos, - displine; - int sc, vc; - int dispon; - int con, coff, - cursoron, - blink; + int linepos; + int displine; + int sc; + int vc; + int dispon; + int con; + int coff; + int cursoron; + int blink; int fullchange; int vsynctime; int vadj; - uint16_t ma, maback; + uint16_t ma; + uint16_t maback; - uint64_t dispontime, - dispofftime; + uint64_t dispontime; + uint64_t dispofftime; pc_timer_t timer; - int firstline, - lastline; + int firstline; + int lastline; int composite; } t1kvid_t; -typedef struct { +typedef struct t1keep_t { char *path; int state; @@ -112,7 +118,7 @@ typedef struct { uint16_t store[64]; } t1keep_t; -typedef struct { +typedef struct tandy_t { mem_mapping_t ram_mapping; mem_mapping_t rom_mapping; /* SL2 */ @@ -573,6 +579,9 @@ vid_out(uint16_t addr, uint8_t val, void *priv) vid->planar_ctrl = val; recalc_mapping(dev); break; + + default: + break; } } @@ -598,6 +607,9 @@ vid_in(uint16_t addr, void *priv) case 0x03da: ret = vid->stat; break; + + default: + break; } return ret; @@ -696,7 +708,7 @@ vid_poll(void *priv) } else { buffer32->line[vid->displine << 1][c] = buffer32->line[(vid->displine << 1) + 1][c] = (vid->col & 15) + 16; if (vid->mode & 1) { - buffer32->line[(vid->displine << 1)][c + (vid->crtc[1] << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 3) + 8] = (vid->col & 15) + 16; + buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 3) + 8] = (vid->col & 15) + 16; } else { buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 4) + 8] = (vid->col & 15) + 16; } @@ -773,7 +785,7 @@ vid_poll(void *priv) } if (drawcursor) { for (c = 0; c < 8; c++) { - buffer32->line[(vid->displine << 1)][(x << 3) + c + 8] ^= 15; + buffer32->line[vid->displine << 1][(x << 3) + c + 8] ^= 15; buffer32->line[(vid->displine << 1) + 1][(x << 3) + c + 8] ^= 15; } } @@ -796,19 +808,19 @@ vid_poll(void *priv) vid->ma++; if (vid->sc & 8) { for (c = 0; c < 8; c++) - buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = cols[0]; + buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 1 + 8] = cols[0]; } else { for (c = 0; c < 8; c++) { if (vid->sc == 8) { - buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][7] & (1 << (c ^ 7))) ? 1 : 0]; + buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][7] & (1 << (c ^ 7))) ? 1 : 0]; } else { - buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][vid->sc & 7] & (1 << (c ^ 7))) ? 1 : 0]; + buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][vid->sc & 7] & (1 << (c ^ 7))) ? 1 : 0]; } } } if (drawcursor) { for (c = 0; c < 16; c++) { - buffer32->line[(vid->displine << 1)][(x << 4) + c + 8] ^= 15; + buffer32->line[vid->displine << 1][(x << 4) + c + 8] ^= 15; buffer32->line[(vid->displine << 1) + 1][(x << 4) + c + 8] ^= 15; } } @@ -837,7 +849,7 @@ vid_poll(void *priv) dat = (vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 1) * 0x2000)] << 8) | vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 1) * 0x2000) + 1]; vid->ma++; for (c = 0; c < 8; c++) { - buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14]; + buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14]; dat <<= 2; } } @@ -848,7 +860,7 @@ vid_poll(void *priv) dat = (vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 1) * 0x2000)] << 8) | vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 1) * 0x2000) + 1]; vid->ma++; for (c = 0; c < 16; c++) { - buffer32->line[(vid->displine << 1)][(x << 4) + c + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + c + 8] = cols[dat >> 15]; + buffer32->line[vid->displine << 1][(x << 4) + c + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + c + 8] = cols[dat >> 15]; dat <<= 1; } } @@ -879,7 +891,7 @@ vid_poll(void *priv) else x = (vid->crtc[1] << 4) + 16; if (!dev->is_sl2 && vid->composite) { - Composite_Process(vid->mode, 0, x >> 2, buffer32->line[(vid->displine << 1)]); + Composite_Process(vid->mode, 0, x >> 2, buffer32->line[vid->displine << 1]); Composite_Process(vid->mode, 0, x >> 2, buffer32->line[(vid->displine << 1) + 1]); } else { video_process_8(x, vid->displine << 1); @@ -967,7 +979,7 @@ vid_poll(void *priv) if (!enable_overscan) xs_temp -= 16; - if (((xs_temp != xsize) || (ys_temp != ysize) || video_force_resize_get())) { + if ((xs_temp != xsize) || (ys_temp != ysize) || video_force_resize_get()) { xsize = xs_temp; ysize = ys_temp; set_screen_size(xsize, ysize + (enable_overscan ? 16 : 0)); @@ -1021,7 +1033,7 @@ vid_poll(void *priv) vid->sc &= 31; vid->ma = vid->maback; } - if ((vid->sc == (vid->crtc[10] & 31) || ((vid->crtc[8] & 3) == 3 && vid->sc == ((vid->crtc[10] & 31) >> 1)))) + if (vid->sc == (vid->crtc[10] & 31) || ((vid->crtc[8] & 3) == 3 && vid->sc == ((vid->crtc[10] & 31) >> 1))) vid->con = 1; } } @@ -1139,7 +1151,7 @@ const device_t vid_device_sl = { }; static void -eep_write(uint16_t addr, uint8_t val, void *priv) +eep_write(UNUSED(uint16_t addr), uint8_t val, void *priv) { t1keep_t *eep = (t1keep_t *) priv; @@ -1166,6 +1178,9 @@ eep_write(uint16_t addr, uint8_t val, void *priv) eep->state = EEPROM_GET_OPERATION; eep->count = 0; break; + + default: + break; } break; @@ -1211,6 +1226,9 @@ eep_write(uint16_t addr, uint8_t val, void *priv) eep->store[eep->addr] = eep->data; } break; + + default: + break; } eep->clk = val & 4; @@ -1233,6 +1251,9 @@ eep_init(const device_t *info) case TYPE_TANDY1000SL2: eep->path = "tandy1000sl2.bin"; break; + + default: + break; } f = nvr_fopen(eep->path, "rb"); @@ -1319,6 +1340,10 @@ tandy_write(uint16_t addr, uint8_t val, void *priv) dev->rom_offset = ((val ^ 4) & 7) * 0x10000; mem_mapping_set_exec(&dev->rom_mapping, &dev->rom[dev->rom_offset]); + break; + + default: + break; } } @@ -1340,6 +1365,9 @@ tandy_read(uint16_t addr, void *priv) case 0xffea: ret = (dev->rom_bank ^ 0x10); break; + + default: + break; } return ret; @@ -1475,6 +1503,9 @@ machine_tandy1k_init(const machine_t *model, int type) device_add(&pssj_device); device_add(&eep_1000sl2_device); break; + + default: + break; } standalone_gameport_type = &gameport_device; diff --git a/src/machine/m_v86p.c b/src/machine/m_v86p.c index 62b6e4834..54af9b053 100644 --- a/src/machine/m_v86p.c +++ b/src/machine/m_v86p.c @@ -52,7 +52,7 @@ int machine_v86p_init(const machine_t *model) { int ret; - int rom = 0; + int rom_id = 0; ret = bios_load_interleavedr("roms/machines/v86p/INTEL8086AWD_BIOS_S3.1_V86P_122089_Even.rom", "roms/machines/v86p/INTEL8086AWD_BIOS_S3.1_V86P_122089_Odd.rom", @@ -60,7 +60,7 @@ machine_v86p_init(const machine_t *model) if (!ret) { /* Try an older version of the BIOS. */ - rom = 1; + rom_id = 1; ret = bios_load_interleavedr("roms/machines/v86p/INTEL8086AWD_BIOS_S3.1_V86P_090489_Even.rom", "roms/machines/v86p/INTEL8086AWD_BIOS_S3.1_V86P_090489_Odd.rom", 0x000f8000, 65536, 0); @@ -68,7 +68,7 @@ machine_v86p_init(const machine_t *model) if (!ret) { /* Try JVERNET's BIOS. */ - rom = 2; + rom_id = 2; ret = bios_load_linear("roms/machines/v86p/V86P.ROM", 0x000f0000, 65536, 0); } @@ -76,7 +76,7 @@ machine_v86p_init(const machine_t *model) if (bios_only || !ret) return ret; - if (rom == 2) + if (rom_id == 2) loadfont("roms/machines/v86p/V86P.FON", 8); else loadfont("roms/machines/v86p/v86pfont.rom", 8); diff --git a/src/machine/m_xt_laserxt.c b/src/machine/m_xt_laserxt.c index 59db0cbe0..87c2fe362 100644 --- a/src/machine/m_xt_laserxt.c +++ b/src/machine/m_xt_laserxt.c @@ -19,6 +19,7 @@ #include <86box/fdc_ext.h> #include <86box/gameport.h> #include <86box/keyboard.h> +#include <86box/plat_unused.h> static int laserxt_emspage[4]; static int laserxt_emscontrol[4]; @@ -37,7 +38,7 @@ get_laserxt_ems_addr(uint32_t addr) } static void -laserxt_write(uint16_t port, uint8_t val, void *priv) +laserxt_write(uint16_t port, uint8_t val, UNUSED(void *priv)) { uint32_t paddr; uint32_t vaddr; @@ -73,11 +74,14 @@ laserxt_write(uint16_t port, uint8_t val, void *priv) mem_mapping_set_addr(&laserxt_ems_mapping[3], 0xCC000 + (((laserxt_ems_baseaddr_index + 1) & 0x0C) << 14), 0x4000); flushmmucache(); break; + + default: + break; } } static uint8_t -laserxt_read(uint16_t port, void *priv) +laserxt_read(uint16_t port, UNUSED(void *priv)) { switch (port) { case 0x0208: @@ -90,13 +94,15 @@ laserxt_read(uint16_t port, void *priv) case 0x8209: case 0xC209: return laserxt_emscontrol[port >> 14]; + + default: break; } return 0xff; } static void -mem_write_laserxtems(uint32_t addr, uint8_t val, void *priv) +mem_write_laserxtems(uint32_t addr, uint8_t val, UNUSED(void *priv)) { addr = get_laserxt_ems_addr(addr); if (addr < (mem_size << 10)) @@ -104,7 +110,7 @@ mem_write_laserxtems(uint32_t addr, uint8_t val, void *priv) } static uint8_t -mem_read_laserxtems(uint32_t addr, void *priv) +mem_read_laserxtems(uint32_t addr, UNUSED(void *priv)) { uint8_t val = 0xFF; addr = get_laserxt_ems_addr(addr); diff --git a/src/machine/m_xt_olivetti.c b/src/machine/m_xt_olivetti.c index 4d6522295..54c7f6c3a 100644 --- a/src/machine/m_xt_olivetti.c +++ b/src/machine/m_xt_olivetti.c @@ -57,6 +57,7 @@ #include <86box/vid_ogc.h> #include <86box/vid_colorplus.h> #include <86box/vid_cga_comp.h> +#include <86box/plat_unused.h> #define STAT_PARITY 0x80 #define STAT_RTIMEOUT 0x40 @@ -115,7 +116,7 @@ enum MM58274_ADDR { static struct tm intclk; -typedef struct { +typedef struct m24_kbd_t { /* Keyboard stuff. */ int wantirq; uint8_t command; @@ -123,18 +124,20 @@ typedef struct { uint8_t out; uint8_t output_port; uint8_t id; - int param, - param_total; + int param; + int param_total; uint8_t params[16]; uint8_t scan[7]; /* Mouse stuff. */ int mouse_mode; - int x, y, b; + int x; + int y; + int b; pc_timer_t send_delay_timer; } m24_kbd_t; -typedef struct { +typedef struct m19_vid_t { ogc_t ogc; colorplus_t colorplus; int mode; @@ -635,6 +638,10 @@ m24_kbd_write(uint16_t port, uint8_t val, void *priv) if (val == 0x02) m24_kbd_adddata(0x00); + break; + + default: + break; } } @@ -725,7 +732,7 @@ m24_kbd_reset(void *priv) } static int -ms_poll(int x, int y, int z, int b, void *priv) +ms_poll(int x, int y, UNUSED(int z), int b, void *priv) { m24_kbd_t *m24_kbd = (m24_kbd_t *) priv; @@ -1492,12 +1499,16 @@ m19_vid_init(m19_vid_t *vid) { device_context(&m19_vid_device); - /* int display_type; */ +#if 0 + int display_type; +#endif vid->mode = OLIVETTI_OGC_MODE; video_inform(VIDEO_FLAG_TYPE_CGA, &timing_m19_vid); - /* display_type = device_get_config_int("display_type"); */ +#if 0 + display_type = device_get_config_int("display_type"); +#endif /* OGC emulation part begin */ loadfont_ex("roms/machines/m19/BIOS.BIN", 1, 90); @@ -1508,7 +1519,9 @@ m19_vid_init(m19_vid_t *vid) vid->ogc.cga.vram = malloc(0x8000); - /* cga_comp_init(vid->ogc.cga.revision); */ +#if 0 + cga_comp_init(vid->ogc.cga.revision); +#endif vid->ogc.cga.rgb_type = device_get_config_int("rgb_type"); cga_palette = (vid->ogc.cga.rgb_type << 1); @@ -1525,11 +1538,15 @@ m19_vid_init(m19_vid_t *vid) /* Plantronics emulation part begin*/ /* composite is not working yet */ vid->colorplus.cga.composite = 0; //(display_type != CGA_RGB); - /* vid->colorplus.cga.snow_enabled = device_get_config_int("snow_enabled"); */ +#if 0 + vid->colorplus.cga.snow_enabled = device_get_config_int("snow_enabled"); +#endif vid->colorplus.cga.vram = malloc(0x8000); - /* vid->colorplus.cga.cgamode = 0x1; */ +#if 0 + vid->colorplus.cga.cgamode = 0x1; +#endif /* Plantronics emulation part end*/ timer_add(&vid->ogc.cga.timer, ogc_poll, &vid->ogc, 1); @@ -1602,7 +1619,7 @@ const device_t m19_vid_device = { }; static uint8_t -m24_read(uint16_t port, void *priv) +m24_read(uint16_t port, UNUSED(void *priv)) { uint8_t ret = 0x00; int fdd_count = 0; @@ -1706,13 +1723,16 @@ m24_read(uint16_t port, void *priv) /* 1 = 720 kB (3.5"), 0 = 360 kB (5.25") */ ret |= (fdd_doublestep_40(0) || fdd_doublestep_40(1)) ? 0x1 : 0x0; break; + + default: + break; } return ret; } static uint8_t -m240_read(uint16_t port, void *priv) +m240_read(uint16_t port, UNUSED(void *priv)) { uint8_t ret = 0x00; int fdd_count = 0; @@ -1761,6 +1781,9 @@ m240_read(uint16_t port, void *priv) ret |= fdd_doublestep_40(1) ? 0x40 : 0x00; ret |= fdd_doublestep_40(0) ? 0x20 : 0x00; break; + + default: + break; } return ret; diff --git a/src/machine/m_xt_philips.c b/src/machine/m_xt_philips.c index bc1b6f792..4caff1431 100644 --- a/src/machine/m_xt_philips.c +++ b/src/machine/m_xt_philips.c @@ -39,9 +39,9 @@ #include <86box/chipset.h> #include <86box/io.h> #include <86box/video.h> +#include <86box/plat_unused.h> -typedef struct -{ +typedef struct philips_t { uint8_t reg; } philips_t; @@ -80,6 +80,9 @@ philips_write(uint16_t port, uint8_t val, void *priv) else cpu_dynamic_switch(0); break; + + default: + break; } philips_log("Philips XT Mainboard: Write %02x at %02x\n", val, port); @@ -100,6 +103,9 @@ philips_read(uint16_t port, void *priv) case 0xc0: ret = dev->reg; break; + + default: + break; } philips_log("Philips XT Mainboard: Read %02x at %02x\n", ret, port); @@ -116,7 +122,7 @@ philips_close(void *priv) } static void * -philips_init(const device_t *info) +philips_init(UNUSED(const device_t *info)) { philips_t *dev = (philips_t *) malloc(sizeof(philips_t)); memset(dev, 0, sizeof(philips_t)); diff --git a/src/machine/m_xt_t1000.c b/src/machine/m_xt_t1000.c index 755840599..be092241d 100644 --- a/src/machine/m_xt_t1000.c +++ b/src/machine/m_xt_t1000.c @@ -135,7 +135,7 @@ enum TC8521_ADDR { TC8521_LEAPYEAR = 0x1B }; -typedef struct { +typedef struct t1000_t { /* ROM drive */ uint8_t *romdrive; uint8_t rom_ctl; @@ -237,7 +237,7 @@ tc8521_time_get(uint8_t *regs, struct tm *tm) /* This is called every second through the NVR/RTC hook. */ static void -tc8521_tick(nvr_t *nvr) +tc8521_tick(UNUSED(nvr_t *nvr)) { t1000_log("TC8521: ping\n"); } @@ -336,7 +336,7 @@ tc8521_init(nvr_t *nvr, int size) /* Given an EMS page ID, return its physical address in RAM. */ static uint32_t -ems_execaddr(t1000_t *sys, int pg, uint16_t val) +ems_execaddr(t1000_t *sys, UNUSED(int pg), uint16_t val) { if (!(val & 0x80)) return 0; /* Bit 7 reset => not mapped */ @@ -595,6 +595,9 @@ read_ctl(uint16_t addr, void *priv) case 0x52: ret = (sys->is_640k ? 0x80 : 0); break; + + default: + break; } break; @@ -656,8 +659,14 @@ write_ctl(uint16_t addr, uint8_t val, void *priv) case 0x52: ems_set_640k(sys, val); break; + + default: + break; } break; + + default: + break; } } @@ -689,6 +698,9 @@ t1000_read_nvram(uint16_t addr, void *priv) tmp |= 0x2e; /* Bits 5, 3, 2, 1 always 1 */ tmp |= (sys->nvr_active & 0x40) >> 6; /* Ready state */ break; + + default: + break; } return tmp; @@ -733,6 +745,9 @@ t1000_write_nvram(uint16_t addr, uint8_t val, void *priv) if (val == 0x80) sys->nvr_addr = -1; break; + + default: + break; } } @@ -757,7 +772,7 @@ write_t1200_nvram(uint32_t addr, uint8_t value, void *priv) /* Port 0xC8 controls the ROM drive */ static uint8_t -t1000_read_rom_ctl(uint16_t addr, void *priv) +t1000_read_rom_ctl(UNUSED(uint16_t addr), void *priv) { t1000_t *sys = (t1000_t *) priv; @@ -765,7 +780,7 @@ t1000_read_rom_ctl(uint16_t addr, void *priv) } static void -t1000_write_rom_ctl(uint16_t addr, uint8_t val, void *priv) +t1000_write_rom_ctl(UNUSED(uint16_t addr), uint8_t val, void *priv) { t1000_t *sys = (t1000_t *) priv; diff --git a/src/machine/m_xt_t1000_vid.c b/src/machine/m_xt_t1000_vid.c index 45a15649d..2dcaca3d0 100644 --- a/src/machine/m_xt_t1000_vid.c +++ b/src/machine/m_xt_t1000_vid.c @@ -51,12 +51,14 @@ #include <86box/video.h> #include <86box/vid_cga.h> #include <86box/m_xt_t1000.h> +#include <86box/plat_unused.h> #define T1000_XSIZE 640 #define T1000_YSIZE 200 /* Mapping of attributes to colours */ -static uint32_t blue, grey; +static uint32_t blue; +static uint32_t grey; static uint8_t boldcols[256]; /* Which attributes use the bold font */ static uint32_t blinkcols[256][2]; static uint32_t normcols[256][2]; @@ -124,14 +126,14 @@ typedef struct t1000_t { } t1000_t; static void t1000_recalctimings(t1000_t *t1000); -static void t1000_write(uint32_t addr, uint8_t val, void *p); -static uint8_t t1000_read(uint32_t addr, void *p); +static void t1000_write(uint32_t addr, uint8_t val, void *priv); +static uint8_t t1000_read(uint32_t addr, void *priv); static void t1000_recalcattrs(t1000_t *t1000); static void -t1000_out(uint16_t addr, uint8_t val, void *p) +t1000_out(uint16_t addr, uint8_t val, void *priv) { - t1000_t *t1000 = (t1000_t *) p; + t1000_t *t1000 = (t1000_t *) priv; switch (addr) { /* Emulated CRTC, register select */ case 0x3d0: @@ -158,21 +160,20 @@ t1000_out(uint16_t addr, uint8_t val, void *p) t1000_recalctimings(t1000); return; - /* CGA control register */ - case 0x3D8: - cga_out(addr, val, &t1000->cga); - return; - /* CGA colour register */ - case 0x3D9: + case 0x3D8: /* CGA control register */ + case 0x3D9: /* CGA colour register */ cga_out(addr, val, &t1000->cga); return; + + default: + break; } } static uint8_t -t1000_in(uint16_t addr, void *p) +t1000_in(uint16_t addr, void *priv) { - t1000_t *t1000 = (t1000_t *) p; + t1000_t *t1000 = (t1000_t *) priv; uint8_t val; switch (addr) { @@ -186,24 +187,29 @@ t1000_in(uint16_t addr, void *p) val |= 0x20; /* LCD / CRT */ return val; } + break; + + default: + break; } return cga_in(addr, &t1000->cga); } static void -t1000_write(uint32_t addr, uint8_t val, void *p) +t1000_write(uint32_t addr, uint8_t val, void *priv) { - t1000_t *t1000 = (t1000_t *) p; + t1000_t *t1000 = (t1000_t *) priv; t1000->vram[addr & 0x3fff] = val; cycles -= 4; } static uint8_t -t1000_read(uint32_t addr, void *p) +t1000_read(uint32_t addr, void *priv) { - t1000_t *t1000 = (t1000_t *) p; + t1000_t *t1000 = (t1000_t *) priv; + cycles -= 4; return t1000->vram[addr & 0x3fff]; @@ -213,7 +219,8 @@ static void t1000_recalctimings(t1000_t *t1000) { double disptime; - double _dispontime, _dispofftime; + double _dispontime; + double _dispofftime; if (!t1000->internal) { cga_recalctimings(&t1000->cga); @@ -231,7 +238,6 @@ static void t1000_text_row80(t1000_t *t1000) { uint32_t cols[2]; - int c; uint8_t chr; uint8_t attr; int drawcursor; @@ -277,12 +283,12 @@ t1000_text_row80(t1000_t *t1000) cols[0] = normcols[attr][0]; } if (drawcursor) { - for (c = 0; c < 8; c++) { - ((uint32_t *) buffer32->line[t1000->displine])[(x << 3) + c] = cols[(fontdat[bold][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (blue ^ grey); + for (uint8_t c = 0; c < 8; c++) { + (buffer32->line[t1000->displine])[(x << 3) + c] = cols[(fontdat[bold][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (blue ^ grey); } } else { - for (c = 0; c < 8; c++) - ((uint32_t *) buffer32->line[t1000->displine])[(x << 3) + c] = cols[(fontdat[bold][sc] & (1 << (c ^ 7))) ? 1 : 0]; + for (uint8_t c = 0; c < 8; c++) + (buffer32->line[t1000->displine])[(x << 3) + c] = cols[(fontdat[bold][sc] & (1 << (c ^ 7))) ? 1 : 0]; } ++ma; } @@ -293,8 +299,8 @@ static void t1000_text_row40(t1000_t *t1000) { uint32_t cols[2]; - int x, c; - uint8_t chr, attr; + uint8_t chr; + uint8_t attr; int drawcursor; int cursorline; int bold; @@ -313,7 +319,7 @@ t1000_text_row40(t1000_t *t1000) } else { cursorline = ((t1000->cga.crtc[10] & 0x0F) <= sc) && ((t1000->cga.crtc[11] & 0x0F) >= sc); } - for (x = 0; x < 40; x++) { + for (uint8_t x = 0; x < 40; x++) { chr = t1000->vram[(addr + 2 * x) & 0x3FFF]; attr = t1000->vram[(addr + 2 * x + 1) & 0x3FFF]; drawcursor = ((ma == ca) && cursorline && (t1000->cga.cgamode & 8) && (t1000->cga.cgablink & 16)); @@ -338,12 +344,12 @@ t1000_text_row40(t1000_t *t1000) cols[0] = normcols[attr][0]; } if (drawcursor) { - for (c = 0; c < 8; c++) { - ((uint32_t *) buffer32->line[t1000->displine])[(x << 4) + c * 2] = ((uint32_t *) buffer32->line[t1000->displine])[(x << 4) + c * 2 + 1] = cols[(fontdat[bold][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (blue ^ grey); + for (uint8_t c = 0; c < 8; c++) { + (buffer32->line[t1000->displine])[(x << 4) + c * 2] = (buffer32->line[t1000->displine])[(x << 4) + c * 2 + 1] = cols[(fontdat[bold][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (blue ^ grey); } } else { - for (c = 0; c < 8; c++) { - ((uint32_t *) buffer32->line[t1000->displine])[(x << 4) + c * 2] = ((uint32_t *) buffer32->line[t1000->displine])[(x << 4) + c * 2 + 1] = cols[(fontdat[bold][sc] & (1 << (c ^ 7))) ? 1 : 0]; + for (uint8_t c = 0; c < 8; c++) { + (buffer32->line[t1000->displine])[(x << 4) + c * 2] = (buffer32->line[t1000->displine])[(x << 4) + c * 2 + 1] = cols[(fontdat[bold][sc] & (1 << (c ^ 7))) ? 1 : 0]; } } ++ma; @@ -354,7 +360,6 @@ t1000_text_row40(t1000_t *t1000) static void t1000_cgaline6(t1000_t *t1000) { - int x, c; uint8_t dat; uint32_t ink = 0; uint16_t addr; @@ -365,15 +370,15 @@ t1000_cgaline6(t1000_t *t1000) addr = ((t1000->displine) & 1) * 0x2000 + (t1000->displine >> 1) * 80 + ((ma & ~1) << 1); - for (x = 0; x < 80; x++) { + for (uint8_t x = 0; x < 80; x++) { dat = t1000->vram[addr & 0x3FFF]; addr++; - for (c = 0; c < 8; c++) { + for (uint8_t c = 0; c < 8; c++) { ink = (dat & 0x80) ? fg : bg; if (!(t1000->cga.cgamode & 8)) ink = grey; - ((uint32_t *) buffer32->line[t1000->displine])[x * 8 + c] = ink; + (buffer32->line[t1000->displine])[x * 8 + c] = ink; dat = dat << 1; } } @@ -384,19 +389,20 @@ t1000_cgaline6(t1000_t *t1000) static void t1000_cgaline4(t1000_t *t1000) { - int x, c; - uint8_t dat, pattern; - uint32_t ink0, ink1; + uint8_t dat; + uint8_t pattern; + uint32_t ink0; + uint32_t ink1; uint16_t addr; uint16_t ma = (t1000->cga.crtc[13] | (t1000->cga.crtc[12] << 8)) & 0x3fff; addr = ((t1000->displine) & 1) * 0x2000 + (t1000->displine >> 1) * 80 + ((ma & ~1) << 1); - for (x = 0; x < 80; x++) { + for (uint8_t x = 0; x < 80; x++) { dat = t1000->vram[addr & 0x3FFF]; addr++; - for (c = 0; c < 4; c++) { + for (uint8_t c = 0; c < 4; c++) { pattern = (dat & 0xC0) >> 6; if (!(t1000->cga.cgamode & 8)) pattern = 0; @@ -428,17 +434,17 @@ t1000_cgaline4(t1000_t *t1000) ink0 = ink1 = blue; break; } - ((uint32_t *) buffer32->line[t1000->displine])[x * 8 + 2 * c] = ink0; - ((uint32_t *) buffer32->line[t1000->displine])[x * 8 + 2 * c + 1] = ink1; - dat = dat << 2; + (buffer32->line[t1000->displine])[x * 8 + 2 * c] = ink0; + (buffer32->line[t1000->displine])[x * 8 + 2 * c + 1] = ink1; + dat = dat << 2; } } } static void -t1000_poll(void *p) +t1000_poll(void *priv) { - t1000_t *t1000 = (t1000_t *) p; + t1000_t *t1000 = (t1000_t *) priv; if (t1000->video_options != st_video_options || t1000->enabled != st_enabled) { t1000->video_options = st_video_options; @@ -643,7 +649,7 @@ t1000_recalcattrs(t1000_t *t1000) } static void * -t1000_init(const device_t *info) +t1000_init(UNUSED(const device_t *info)) { t1000_t *t1000 = malloc(sizeof(t1000_t)); memset(t1000, 0, sizeof(t1000_t)); @@ -681,18 +687,18 @@ t1000_init(const device_t *info) } static void -t1000_close(void *p) +t1000_close(void *priv) { - t1000_t *t1000 = (t1000_t *) p; + t1000_t *t1000 = (t1000_t *) priv; free(t1000->vram); free(t1000); } static void -t1000_speed_changed(void *p) +t1000_speed_changed(void *priv) { - t1000_t *t1000 = (t1000_t *) p; + t1000_t *t1000 = (t1000_t *) priv; t1000_recalctimings(t1000); } diff --git a/src/machine/m_xt_xi8088.c b/src/machine/m_xt_xi8088.c index 5bf958d8a..3f07e6a4e 100644 --- a/src/machine/m_xt_xi8088.c +++ b/src/machine/m_xt_xi8088.c @@ -24,6 +24,7 @@ #include <86box/video.h> #include <86box/machine.h> #include "cpu.h" +#include <86box/plat_unused.h> #include <86box/m_xt_xi8088.h> @@ -67,7 +68,7 @@ xi8088_bios_128kb(void) } static void * -xi8088_init(const device_t *info) +xi8088_init(UNUSED(const device_t *info)) { xi8088.turbo = 1; xi8088.turbo_setting = device_get_config_int("turbo_setting"); diff --git a/src/machine/m_xt_zenith.c b/src/machine/m_xt_zenith.c index e5cebe552..628b98e8b 100644 --- a/src/machine/m_xt_zenith.c +++ b/src/machine/m_xt_zenith.c @@ -46,6 +46,7 @@ #include <86box/machine.h> #include <86box/io.h> #include <86box/vid_cga.h> +#include <86box/plat_unused.h> typedef struct { mem_mapping_t scratchpad_mapping; @@ -53,21 +54,21 @@ typedef struct { } zenith_t; static uint8_t -zenith_scratchpad_read(uint32_t addr, void *p) +zenith_scratchpad_read(uint32_t addr, void *priv) { - zenith_t *dev = (zenith_t *) p; + zenith_t *dev = (zenith_t *) priv; return dev->scratchpad_ram[addr & 0x3fff]; } static void -zenith_scratchpad_write(uint32_t addr, uint8_t val, void *p) +zenith_scratchpad_write(uint32_t addr, uint8_t val, void *priv) { - zenith_t *dev = (zenith_t *) p; + zenith_t *dev = (zenith_t *) priv; dev->scratchpad_ram[addr & 0x3fff] = val; } static void * -zenith_scratchpad_init(const device_t *info) +zenith_scratchpad_init(UNUSED(const device_t *info)) { zenith_t *dev; @@ -85,9 +86,9 @@ zenith_scratchpad_init(const device_t *info) } static void -zenith_scratchpad_close(void *p) +zenith_scratchpad_close(void *priv) { - zenith_t *dev = (zenith_t *) p; + zenith_t *dev = (zenith_t *) priv; free(dev->scratchpad_ram); free(dev); diff --git a/src/machine/machine.c b/src/machine/machine.c index d48cbdf21..0bdae527b 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -42,6 +42,7 @@ #include <86box/machine.h> #include <86box/isamem.h> #include <86box/pci.h> +#include <86box/plat_unused.h> int bios_only = 0; int machine; @@ -78,8 +79,10 @@ machine_init_ex(int m) gameport_instance_id = 0; /* Set up the architecture flags. */ - // AT = IS_AT(machine); - // PCI = IS_ARCH(machine, MACHINE_BUS_PCI); +#if 0 + AT = IS_AT(machine); + PCI = IS_ARCH(machine, MACHINE_BUS_PCI); +#endif cpu_set(); pc_speed_changed(); @@ -141,14 +144,14 @@ int machine_available(int m) { int ret; - device_t *d = (device_t *) machine_get_device(m); + device_t *dev = (device_t *) machine_get_device(m); bios_only = 1; - ret = device_available(d); + ret = device_available(dev); /* Do not check via machine_init_ex() if the device is not NULL and it has a CONFIG_BIOS field. */ - if ((d == NULL) || (ret != -1)) + if ((dev == NULL) || (ret != -1)) ret = machine_init_ex(m); bios_only = 0; @@ -167,7 +170,7 @@ pit_irq0_timer(int new_out, int old_out) } void -machine_common_init(const machine_t *model) +machine_common_init(UNUSED(const machine_t *model)) { /* System devices first. */ pic_init(); diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 5c52f7de0..fa34bdef8 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -34,6 +34,7 @@ #include <86box/keyboard.h> #include <86box/sound.h> #include <86box/video.h> +#include <86box/plat_unused.h> // Temporarily here till we move everything out into the right files extern const device_t pcjr_device; @@ -12953,7 +12954,7 @@ machine_get_p1(void) } void -machine_load_p1(int m) +machine_load_p1(UNUSED(int m)) { machine_p1 = machines[machine].kbc_p1; } @@ -12965,7 +12966,7 @@ machine_get_gpio(void) } void -machine_load_gpio(int m) +machine_load_gpio(UNUSED(int m)) { machine_gpio = machines[machine].gpio; } diff --git a/src/mem/catalyst_flash.c b/src/mem/catalyst_flash.c index 46294a60a..768678961 100644 --- a/src/mem/catalyst_flash.c +++ b/src/mem/catalyst_flash.c @@ -98,9 +98,9 @@ flash_read(uint32_t addr, void *priv) } static uint16_t -flash_readw(uint32_t addr, void *p) +flash_readw(uint32_t addr, void *priv) { - flash_t *dev = (flash_t *) p; + flash_t *dev = (flash_t *) priv; uint16_t *q; addr &= biosmask; @@ -111,9 +111,9 @@ flash_readw(uint32_t addr, void *p) } static uint32_t -flash_readl(uint32_t addr, void *p) +flash_readl(uint32_t addr, void *priv) { - flash_t *dev = (flash_t *) p; + flash_t *dev = (flash_t *) priv; uint32_t *q; addr &= biosmask; @@ -124,9 +124,9 @@ flash_readl(uint32_t addr, void *p) } static void -flash_write(uint32_t addr, uint8_t val, void *p) +flash_write(uint32_t addr, uint8_t val, void *priv) { - flash_t *dev = (flash_t *) p; + flash_t *dev = (flash_t *) priv; addr &= biosmask; @@ -189,7 +189,7 @@ catalyst_flash_reset(void *priv) static void * catalyst_flash_init(UNUSED(const device_t *info)) { - FILE *f; + FILE *fp; flash_t *dev; dev = malloc(sizeof(flash_t)); @@ -207,24 +207,24 @@ catalyst_flash_init(UNUSED(const device_t *info)) dev->command = CMD_RESET; - f = nvr_fopen(flash_path, "rb"); - if (f) { - (void) !fread(dev->array, 0x20000, 1, f); - fclose(f); + fp = nvr_fopen(flash_path, "rb"); + if (fp) { + (void) !fread(dev->array, 0x20000, 1, fp); + fclose(fp); } return dev; } static void -catalyst_flash_close(void *p) +catalyst_flash_close(void *priv) { - FILE *f; - flash_t *dev = (flash_t *) p; + FILE *fp; + flash_t *dev = (flash_t *) priv; - f = nvr_fopen(flash_path, "wb"); - fwrite(dev->array, 0x20000, 1, f); - fclose(f); + fp = nvr_fopen(flash_path, "wb"); + fwrite(dev->array, 0x20000, 1, fp); + fclose(fp); free(dev->array); dev->array = NULL; diff --git a/src/mem/intel_flash.c b/src/mem/intel_flash.c index ce529670e..a8820f675 100644 --- a/src/mem/intel_flash.c +++ b/src/mem/intel_flash.c @@ -221,10 +221,9 @@ flash_write(uint32_t addr, uint8_t val, void *priv) } static void -flash_writew(uint32_t addr, uint16_t val, void *p) +flash_writew(uint32_t addr, uint16_t val, void *priv) { - flash_t *dev = (flash_t *) p; - int i; + flash_t *dev = (flash_t *) priv; uint32_t bb_mask = biosmask & 0xffffe000; if (biosmask == 0x7ffff) bb_mask &= 0xffff8000; @@ -239,7 +238,7 @@ flash_writew(uint32_t addr, uint16_t val, void *p) switch (dev->command) { case CMD_ERASE_SETUP: if (val == CMD_ERASE_CONFIRM) { - for (i = 0; i < 6; i++) { + for (uint8_t i = 0; i < 6; i++) { if ((i == dev->program_addr) && (addr >= dev->block_start[i]) && (addr <= dev->block_end[i])) memset(&(dev->array[dev->block_start[i]]), 0xff, dev->block_len[i]); } @@ -264,7 +263,7 @@ flash_writew(uint32_t addr, uint16_t val, void *p) dev->status = 0; break; case CMD_ERASE_SETUP: - for (i = 0; i < 7; i++) { + for (uint8_t i = 0; i < 7; i++) { if ((addr >= dev->block_start[i]) && (addr <= dev->block_end[i])) dev->program_addr = i; } @@ -292,7 +291,7 @@ flash_writel(UNUSED(uint32_t addr), UNUSED(uint32_t val), UNUSED(void *priv)) static void intel_flash_add_mappings(flash_t *dev) { - int max = 2; + uint8_t max = 2; uint32_t base; uint32_t fbase; uint32_t sub = 0x20000; @@ -305,7 +304,7 @@ intel_flash_add_mappings(flash_t *dev) max = 4; } - for (int i = 0; i < max; i++) { + for (uint8_t i = 0; i < max; i++) { if (biosmask == 0x7ffff) base = 0x80000 + (i << 16); else if (biosmask == 0x3ffff) @@ -348,7 +347,7 @@ intel_flash_reset(void *priv) static void * intel_flash_init(const device_t *info) { - FILE *f; + FILE *fp; flash_t *dev; uint8_t type = info->local & 0xff; @@ -513,19 +512,19 @@ intel_flash_init(const device_t *info) dev->command = CMD_READ_ARRAY; dev->status = 0; - f = nvr_fopen(flash_path, "rb"); - if (f) { - (void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN1]]), dev->block_len[BLOCK_MAIN1], 1, f); + fp = nvr_fopen(flash_path, "rb"); + if (fp) { + (void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN1]]), dev->block_len[BLOCK_MAIN1], 1, fp); if (dev->block_len[BLOCK_MAIN2]) - (void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN2]]), dev->block_len[BLOCK_MAIN2], 1, f); + (void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN2]]), dev->block_len[BLOCK_MAIN2], 1, fp); if (dev->block_len[BLOCK_MAIN3]) - (void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN3]]), dev->block_len[BLOCK_MAIN3], 1, f); + (void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN3]]), dev->block_len[BLOCK_MAIN3], 1, fp); if (dev->block_len[BLOCK_MAIN4]) - (void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN4]]), dev->block_len[BLOCK_MAIN4], 1, f); + (void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN4]]), dev->block_len[BLOCK_MAIN4], 1, fp); - (void) !fread(&(dev->array[dev->block_start[BLOCK_DATA1]]), dev->block_len[BLOCK_DATA1], 1, f); - (void) !fread(&(dev->array[dev->block_start[BLOCK_DATA2]]), dev->block_len[BLOCK_DATA2], 1, f); - fclose(f); + (void) !fread(&(dev->array[dev->block_start[BLOCK_DATA1]]), dev->block_len[BLOCK_DATA1], 1, fp); + (void) !fread(&(dev->array[dev->block_start[BLOCK_DATA2]]), dev->block_len[BLOCK_DATA2], 1, fp); + fclose(fp); } return dev; @@ -534,21 +533,21 @@ intel_flash_init(const device_t *info) static void intel_flash_close(void *priv) { - FILE *f; + FILE *fp; flash_t *dev = (flash_t *) priv; - f = nvr_fopen(flash_path, "wb"); - fwrite(&(dev->array[dev->block_start[BLOCK_MAIN1]]), dev->block_len[BLOCK_MAIN1], 1, f); + fp = nvr_fopen(flash_path, "wb"); + fwrite(&(dev->array[dev->block_start[BLOCK_MAIN1]]), dev->block_len[BLOCK_MAIN1], 1, fp); if (dev->block_len[BLOCK_MAIN2]) - fwrite(&(dev->array[dev->block_start[BLOCK_MAIN2]]), dev->block_len[BLOCK_MAIN2], 1, f); + fwrite(&(dev->array[dev->block_start[BLOCK_MAIN2]]), dev->block_len[BLOCK_MAIN2], 1, fp); if (dev->block_len[BLOCK_MAIN3]) - fwrite(&(dev->array[dev->block_start[BLOCK_MAIN3]]), dev->block_len[BLOCK_MAIN3], 1, f); + fwrite(&(dev->array[dev->block_start[BLOCK_MAIN3]]), dev->block_len[BLOCK_MAIN3], 1, fp); if (dev->block_len[BLOCK_MAIN4]) - fwrite(&(dev->array[dev->block_start[BLOCK_MAIN4]]), dev->block_len[BLOCK_MAIN4], 1, f); + fwrite(&(dev->array[dev->block_start[BLOCK_MAIN4]]), dev->block_len[BLOCK_MAIN4], 1, fp); - fwrite(&(dev->array[dev->block_start[BLOCK_DATA1]]), dev->block_len[BLOCK_DATA1], 1, f); - fwrite(&(dev->array[dev->block_start[BLOCK_DATA2]]), dev->block_len[BLOCK_DATA2], 1, f); - fclose(f); + fwrite(&(dev->array[dev->block_start[BLOCK_DATA1]]), dev->block_len[BLOCK_DATA1], 1, fp); + fwrite(&(dev->array[dev->block_start[BLOCK_DATA2]]), dev->block_len[BLOCK_DATA2], 1, fp); + fclose(fp); free(dev->array); dev->array = NULL; diff --git a/src/mem/mem.c b/src/mem/mem.c index b23ab3253..298e1a611 100644 --- a/src/mem/mem.c +++ b/src/mem/mem.c @@ -69,7 +69,7 @@ page_t *pages; /* RAM page table */ page_t **page_lookup; /* pagetable lookup */ uint32_t pages_sz; /* #pages in table */ -uint8_t *ram; +uint8_t *ram; /* the virtual RAM */ uint8_t *ram2; /* the virtual RAM */ uint8_t page_ff[4096]; uint32_t rammask; @@ -522,7 +522,7 @@ mmutranslate_noabrt_pae(uint32_t addr, int rw) addr4 = (temp & ~0xfffULL) + ((addr >> 9) & 0xff8); temp = rammap64(addr4) & 0x000000ffffffffffULL; - ; + temp3 = temp & temp4; if (!(temp & 1) || ((CPL == 3) && !(temp3 & 4) && !cpl_override) || (rw && !(temp3 & 2) && ((CPL == 3) || (cr0 & WP_FLAG)))) @@ -705,7 +705,7 @@ read_mem_b(uint32_t addr) map = read_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->read_b) - ret = map->read_b(addr, map->p); + ret = map->read_b(addr, map->priv); resub_cycles(old_cycles); @@ -728,9 +728,9 @@ read_mem_w(uint32_t addr) map = read_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->read_w) - ret = map->read_w(addr, map->p); + ret = map->read_w(addr, map->priv); else if (map && map->read_b) - ret = map->read_b(addr, map->p) | (map->read_b(addr + 1, map->p) << 8); + ret = map->read_b(addr, map->priv) | (map->read_b(addr + 1, map->priv) << 8); } resub_cycles(old_cycles); @@ -749,7 +749,7 @@ write_mem_b(uint32_t addr, uint8_t val) map = write_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->write_b) - map->write_b(addr, val, map->p); + map->write_b(addr, val, map->priv); resub_cycles(old_cycles); } @@ -770,10 +770,10 @@ write_mem_w(uint32_t addr, uint16_t val) map = write_mapping[addr >> MEM_GRANULARITY_BITS]; if (map) { if (map->write_w) - map->write_w(addr, val, map->p); + map->write_w(addr, val, map->priv); else if (map->write_b) { - map->write_b(addr, val, map->p); - map->write_b(addr + 1, val >> 8, map->p); + map->write_b(addr, val, map->priv); + map->write_b(addr + 1, val >> 8, map->priv); } } } @@ -805,7 +805,7 @@ readmembl(uint32_t addr) map = read_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->read_b) - return map->read_b(addr, map->p); + return map->read_b(addr, map->priv); return 0xff; } @@ -839,7 +839,7 @@ writemembl(uint32_t addr, uint8_t val) map = write_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->write_b) - map->write_b(addr, val, map->p); + map->write_b(addr, val, map->priv); } /* Read a byte from memory without MMU translation - result of previous MMU translation passed as value. */ @@ -862,7 +862,7 @@ readmembl_no_mmut(uint32_t addr, uint32_t a64) map = read_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->read_b) - return map->read_b(addr, map->p); + return map->read_b(addr, map->priv); return 0xff; } @@ -892,7 +892,7 @@ writemembl_no_mmut(uint32_t addr, uint32_t a64, uint8_t val) map = write_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->write_b) - map->write_b(addr, val, map->p); + map->write_b(addr, val, map->priv); } uint16_t @@ -944,10 +944,10 @@ readmemwl(uint32_t addr) map = read_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->read_w) - return map->read_w(addr, map->p); + return map->read_w(addr, map->priv); if (map && map->read_b) { - return map->read_b(addr, map->p) | ((uint16_t) (map->read_b(addr + 1, map->p)) << 8); + return map->read_b(addr, map->priv) | ((uint16_t) (map->read_b(addr + 1, map->priv)) << 8); } return 0xffff; @@ -1016,13 +1016,13 @@ writememwl(uint32_t addr, uint16_t val) map = write_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->write_w) { - map->write_w(addr, val, map->p); + map->write_w(addr, val, map->priv); return; } if (map && map->write_b) { - map->write_b(addr, val, map->p); - map->write_b(addr + 1, val >> 8, map->p); + map->write_b(addr, val, map->priv); + map->write_b(addr + 1, val >> 8, map->priv); return; } } @@ -1064,10 +1064,10 @@ readmemwl_no_mmut(uint32_t addr, uint32_t *a64) map = read_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->read_w) - return map->read_w(addr, map->p); + return map->read_w(addr, map->priv); if (map && map->read_b) { - return map->read_b(addr, map->p) | ((uint16_t) (map->read_b(addr + 1, map->p)) << 8); + return map->read_b(addr, map->priv) | ((uint16_t) (map->read_b(addr + 1, map->priv)) << 8); } return 0xffff; @@ -1119,13 +1119,13 @@ writememwl_no_mmut(uint32_t addr, uint32_t *a64, uint16_t val) map = write_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->write_w) { - map->write_w(addr, val, map->p); + map->write_w(addr, val, map->priv); return; } if (map && map->write_b) { - map->write_b(addr, val, map->p); - map->write_b(addr + 1, val >> 8, map->p); + map->write_b(addr, val, map->priv); + map->write_b(addr + 1, val >> 8, map->priv); return; } } @@ -1193,13 +1193,13 @@ readmemll(uint32_t addr) map = read_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->read_l) - return map->read_l(addr, map->p); + return map->read_l(addr, map->priv); if (map && map->read_w) - return map->read_w(addr, map->p) | ((uint32_t) (map->read_w(addr + 2, map->p)) << 16); + return map->read_w(addr, map->priv) | ((uint32_t) (map->read_w(addr + 2, map->priv)) << 16); if (map && map->read_b) - return map->read_b(addr, map->p) | ((uint32_t) (map->read_b(addr + 1, map->p)) << 8) | ((uint32_t) (map->read_b(addr + 2, map->p)) << 16) | ((uint32_t) (map->read_b(addr + 3, map->p)) << 24); + return map->read_b(addr, map->priv) | ((uint32_t) (map->read_b(addr + 1, map->priv)) << 8) | ((uint32_t) (map->read_b(addr + 2, map->priv)) << 16) | ((uint32_t) (map->read_b(addr + 3, map->priv)) << 24); return 0xffffffff; } @@ -1280,19 +1280,19 @@ writememll(uint32_t addr, uint32_t val) map = write_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->write_l) { - map->write_l(addr, val, map->p); + map->write_l(addr, val, map->priv); return; } if (map && map->write_w) { - map->write_w(addr, val, map->p); - map->write_w(addr + 2, val >> 16, map->p); + map->write_w(addr, val, map->priv); + map->write_w(addr + 2, val >> 16, map->priv); return; } if (map && map->write_b) { - map->write_b(addr, val, map->p); - map->write_b(addr + 1, val >> 8, map->p); - map->write_b(addr + 2, val >> 16, map->p); - map->write_b(addr + 3, val >> 24, map->p); + map->write_b(addr, val, map->priv); + map->write_b(addr + 1, val >> 8, map->priv); + map->write_b(addr + 2, val >> 16, map->priv); + map->write_b(addr + 3, val >> 24, map->priv); return; } } @@ -1334,13 +1334,13 @@ readmemll_no_mmut(uint32_t addr, uint32_t *a64) map = read_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->read_l) - return map->read_l(addr, map->p); + return map->read_l(addr, map->priv); if (map && map->read_w) - return map->read_w(addr, map->p) | ((uint32_t) (map->read_w(addr + 2, map->p)) << 16); + return map->read_w(addr, map->priv) | ((uint32_t) (map->read_w(addr + 2, map->priv)) << 16); if (map && map->read_b) - return map->read_b(addr, map->p) | ((uint32_t) (map->read_b(addr + 1, map->p)) << 8) | ((uint32_t) (map->read_b(addr + 2, map->p)) << 16) | ((uint32_t) (map->read_b(addr + 3, map->p)) << 24); + return map->read_b(addr, map->priv) | ((uint32_t) (map->read_b(addr + 1, map->priv)) << 8) | ((uint32_t) (map->read_b(addr + 2, map->priv)) << 16) | ((uint32_t) (map->read_b(addr + 3, map->priv)) << 24); return 0xffffffff; } @@ -1391,19 +1391,19 @@ writememll_no_mmut(uint32_t addr, uint32_t *a64, uint32_t val) map = write_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->write_l) { - map->write_l(addr, val, map->p); + map->write_l(addr, val, map->priv); return; } if (map && map->write_w) { - map->write_w(addr, val, map->p); - map->write_w(addr + 2, val >> 16, map->p); + map->write_w(addr, val, map->priv); + map->write_w(addr + 2, val >> 16, map->priv); return; } if (map && map->write_b) { - map->write_b(addr, val, map->p); - map->write_b(addr + 1, val >> 8, map->p); - map->write_b(addr + 2, val >> 16, map->p); - map->write_b(addr + 3, val >> 24, map->p); + map->write_b(addr, val, map->priv); + map->write_b(addr + 1, val >> 8, map->priv); + map->write_b(addr + 2, val >> 16, map->priv); + map->write_b(addr + 3, val >> 24, map->priv); return; } } @@ -1469,7 +1469,7 @@ readmemql(uint32_t addr) map = read_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->read_l) - return map->read_l(addr, map->p) | ((uint64_t) map->read_l(addr + 4, map->p) << 32); + return map->read_l(addr, map->priv) | ((uint64_t) map->read_l(addr + 4, map->priv) << 32); return readmemll(addr) | ((uint64_t) readmemll(addr + 4) << 32); } @@ -1548,26 +1548,26 @@ writememql(uint32_t addr, uint64_t val) map = write_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->write_l) { - map->write_l(addr, val, map->p); - map->write_l(addr + 4, val >> 32, map->p); + map->write_l(addr, val, map->priv); + map->write_l(addr + 4, val >> 32, map->priv); return; } if (map && map->write_w) { - map->write_w(addr, val, map->p); - map->write_w(addr + 2, val >> 16, map->p); - map->write_w(addr + 4, val >> 32, map->p); - map->write_w(addr + 6, val >> 48, map->p); + map->write_w(addr, val, map->priv); + map->write_w(addr + 2, val >> 16, map->priv); + map->write_w(addr + 4, val >> 32, map->priv); + map->write_w(addr + 6, val >> 48, map->priv); return; } if (map && map->write_b) { - map->write_b(addr, val, map->p); - map->write_b(addr + 1, val >> 8, map->p); - map->write_b(addr + 2, val >> 16, map->p); - map->write_b(addr + 3, val >> 24, map->p); - map->write_b(addr + 4, val >> 32, map->p); - map->write_b(addr + 5, val >> 40, map->p); - map->write_b(addr + 6, val >> 48, map->p); - map->write_b(addr + 7, val >> 56, map->p); + map->write_b(addr, val, map->priv); + map->write_b(addr + 1, val >> 8, map->priv); + map->write_b(addr + 2, val >> 16, map->priv); + map->write_b(addr + 3, val >> 24, map->priv); + map->write_b(addr + 4, val >> 32, map->priv); + map->write_b(addr + 5, val >> 40, map->priv); + map->write_b(addr + 6, val >> 48, map->priv); + map->write_b(addr + 7, val >> 56, map->priv); return; } } @@ -1634,7 +1634,7 @@ mem_readb_phys(uint32_t addr) if (map->exec) ret = map->exec[(addr - map->base) & map->mask]; else if (map->read_b) - ret = map->read_b(addr, map->p); + ret = map->read_b(addr, map->priv); } return ret; @@ -1653,7 +1653,7 @@ mem_readw_phys(uint32_t addr) p = (uint16_t *) &(map->exec[(addr - map->base) & map->mask]); ret = *p; } else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_HBOUND) && (map && map->read_w)) - ret = map->read_w(addr, map->p); + ret = map->read_w(addr, map->priv); else { ret = mem_readb_phys(addr + 1) << 8; ret |= mem_readb_phys(addr); @@ -1675,7 +1675,7 @@ mem_readl_phys(uint32_t addr) p = (uint32_t *) &(map->exec[(addr - map->base) & map->mask]); ret = *p; } else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_QBOUND) && (map && map->read_l)) - ret = map->read_l(addr, map->p); + ret = map->read_l(addr, map->priv); else { ret = mem_readw_phys(addr + 2) << 16; ret |= mem_readw_phys(addr); @@ -1714,7 +1714,7 @@ mem_writeb_phys(uint32_t addr, uint8_t val) if (map->exec) map->exec[(addr - map->base) & map->mask] = val; else if (map->write_b) - map->write_b(addr, val, map->p); + map->write_b(addr, val, map->priv); } } @@ -1730,7 +1730,7 @@ mem_writew_phys(uint32_t addr, uint16_t val) p = (uint16_t *) &(map->exec[(addr - map->base) & map->mask]); *p = val; } else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_HBOUND) && (map && map->write_w)) - map->write_w(addr, val, map->p); + map->write_w(addr, val, map->priv); else { mem_writeb_phys(addr, val & 0xff); mem_writeb_phys(addr + 1, (val >> 8) & 0xff); @@ -1749,7 +1749,7 @@ mem_writel_phys(uint32_t addr, uint32_t val) p = (uint32_t *) &(map->exec[(addr - map->base) & map->mask]); *p = val; } else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_QBOUND) && (map && map->write_l)) - map->write_l(addr, val, map->p); + map->write_l(addr, val, map->priv); else { mem_writew_phys(addr, val & 0xffff); mem_writew_phys(addr + 2, (val >> 16) & 0xffff); @@ -2051,7 +2051,7 @@ mem_write_ram(uint32_t addr, uint8_t val, UNUSED(void *priv)) } void -mem_write_ramw(uint32_t addr, uint16_t val, void *priv) +mem_write_ramw(uint32_t addr, uint16_t val, UNUSED(void *priv)) { #ifdef ENABLE_MEM_LOG if ((addr >= 0xa0000) && (addr <= 0xbffff)) @@ -2145,7 +2145,7 @@ mem_write_remapped(uint32_t addr, uint8_t val, UNUSED(void *priv)) } static void -mem_write_remappedw(uint32_t addr, uint16_t val, void *priv) +mem_write_remappedw(uint32_t addr, uint16_t val, UNUSED(void *priv)) { uint32_t oldaddr = addr; addr = 0xA0000 + (addr - remap_start_addr); @@ -2181,7 +2181,7 @@ mem_write_remapped2(uint32_t addr, uint8_t val, UNUSED(void *priv)) } static void -mem_write_remappedw2(uint32_t addr, uint16_t val, void *priv) +mem_write_remappedw2(uint32_t addr, uint16_t val, UNUSED(void *priv)) { uint32_t oldaddr = addr; addr = 0xD0000 + (addr - remap_start_addr2); @@ -2384,15 +2384,15 @@ void mem_mapping_set(mem_mapping_t *map, uint32_t base, uint32_t size, - uint8_t (*read_b)(uint32_t addr, void *p), - uint16_t (*read_w)(uint32_t addr, void *p), - uint32_t (*read_l)(uint32_t addr, void *p), - void (*write_b)(uint32_t addr, uint8_t val, void *p), - void (*write_w)(uint32_t addr, uint16_t val, void *p), - void (*write_l)(uint32_t addr, uint32_t val, void *p), + uint8_t (*read_b)(uint32_t addr, void *priv), + uint16_t (*read_w)(uint32_t addr, void *priv), + uint32_t (*read_l)(uint32_t addr, void *priv), + void (*write_b)(uint32_t addr, uint8_t val, void *priv), + void (*write_w)(uint32_t addr, uint16_t val, void *priv), + void (*write_l)(uint32_t addr, uint32_t val, void *priv), uint8_t *exec, uint32_t fl, - void *p) + void *priv) { if (size != 0x00000000) map->enable = 1; @@ -2409,7 +2409,7 @@ mem_mapping_set(mem_mapping_t *map, map->write_l = write_l; map->exec = exec; map->flags = fl; - map->p = p; + map->priv = priv; map->next = NULL; mem_log("mem_mapping_add(): Linked list structure: %08X -> %08X -> %08X\n", map->prev, map, map->next); @@ -2422,15 +2422,15 @@ void mem_mapping_add(mem_mapping_t *map, uint32_t base, uint32_t size, - uint8_t (*read_b)(uint32_t addr, void *p), - uint16_t (*read_w)(uint32_t addr, void *p), - uint32_t (*read_l)(uint32_t addr, void *p), - void (*write_b)(uint32_t addr, uint8_t val, void *p), - void (*write_w)(uint32_t addr, uint16_t val, void *p), - void (*write_l)(uint32_t addr, uint32_t val, void *p), + uint8_t (*read_b)(uint32_t addr, void *priv), + uint16_t (*read_w)(uint32_t addr, void *priv), + uint32_t (*read_l)(uint32_t addr, void *priv), + void (*write_b)(uint32_t addr, uint8_t val, void *priv), + void (*write_w)(uint32_t addr, uint16_t val, void *priv), + void (*write_l)(uint32_t addr, uint32_t val, void *priv), uint8_t *exec, uint32_t fl, - void *p) + void *priv) { /* Do a sanity check */ if ((base_mapping == NULL) && (last_mapping != NULL)) { @@ -2461,7 +2461,7 @@ mem_mapping_add(mem_mapping_t *map, last_mapping = map; mem_mapping_set(map, base, size, read_b, read_w, read_l, - write_b, write_w, write_l, exec, fl, p); + write_b, write_w, write_l, exec, fl, priv); } void @@ -2472,12 +2472,12 @@ mem_mapping_do_recalc(mem_mapping_t *map) void mem_mapping_set_handler(mem_mapping_t *map, - uint8_t (*read_b)(uint32_t addr, void *p), - uint16_t (*read_w)(uint32_t addr, void *p), - uint32_t (*read_l)(uint32_t addr, void *p), - void (*write_b)(uint32_t addr, uint8_t val, void *p), - void (*write_w)(uint32_t addr, uint16_t val, void *p), - void (*write_l)(uint32_t addr, uint32_t val, void *p)) + uint8_t (*read_b)(uint32_t addr, void *priv), + uint16_t (*read_w)(uint32_t addr, void *priv), + uint32_t (*read_l)(uint32_t addr, void *priv), + void (*write_b)(uint32_t addr, uint8_t val, void *priv), + void (*write_w)(uint32_t addr, uint16_t val, void *priv), + void (*write_l)(uint32_t addr, uint32_t val, void *priv)) { map->read_b = read_b; map->read_w = read_w; @@ -2521,9 +2521,9 @@ mem_mapping_set_mask(mem_mapping_t *map, uint32_t mask) } void -mem_mapping_set_p(mem_mapping_t *map, void *p) +mem_mapping_set_p(mem_mapping_t *map, void *priv) { - map->p = p; + map->priv = priv; } void diff --git a/src/mem/rom.c b/src/mem/rom.c index 2ace87de7..6182a466c 100644 --- a/src/mem/rom.c +++ b/src/mem/rom.c @@ -140,11 +140,11 @@ rom_getfile(char *fn, char *s, int size) int rom_present(char *fn) { - FILE *f; + FILE *fp; - f = rom_fopen(fn, "rb"); - if (f != NULL) { - (void) fclose(f); + fp = rom_fopen(fn, "rb"); + if (fp != NULL) { + (void) fclose(fp); return 1; } @@ -205,10 +205,9 @@ rom_readl(uint32_t addr, void *priv) int rom_load_linear_oddeven(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr) { - FILE *f = rom_fopen(fn, "rb"); - int i; + FILE *fp = rom_fopen(fn, "rb"); - if (f == NULL) { + if (fp == NULL) { rom_log("ROM: image '%s' not found\n", fn); return 0; } @@ -220,19 +219,19 @@ rom_load_linear_oddeven(const char *fn, uint32_t addr, int sz, int off, uint8_t addr &= 0x03ffff; if (ptr != NULL) { - if (fseek(f, off, SEEK_SET) == -1) + if (fseek(fp, off, SEEK_SET) == -1) fatal("rom_load_linear(): Error seeking to the beginning of the file\n"); - for (i = 0; i < (sz >> 1); i++) { - if (fread(ptr + (addr + (i << 1)), 1, 1, f) != 1) + for (int i = 0; i < (sz >> 1); i++) { + if (fread(ptr + (addr + (i << 1)), 1, 1, fp) != 1) fatal("rom_load_linear(): Error reading even data\n"); } - for (i = 0; i < (sz >> 1); i++) { - if (fread(ptr + (addr + (i << 1) + 1), 1, 1, f) != 1) + for (int i = 0; i < (sz >> 1); i++) { + if (fread(ptr + (addr + (i << 1) + 1), 1, 1, fp) != 1) fatal("rom_load_linear(): Error reading od data\n"); } } - (void) fclose(f); + (void) fclose(fp); return 1; } @@ -241,9 +240,9 @@ rom_load_linear_oddeven(const char *fn, uint32_t addr, int sz, int off, uint8_t int rom_load_linear(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr) { - FILE *f = rom_fopen(fn, "rb"); + FILE *fp = rom_fopen(fn, "rb"); - if (f == NULL) { + if (fp == NULL) { rom_log("ROM: image '%s' not found\n", fn); return 0; } @@ -255,13 +254,13 @@ rom_load_linear(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr) addr &= 0x03ffff; if (ptr != NULL) { - if (fseek(f, off, SEEK_SET) == -1) + if (fseek(fp, off, SEEK_SET) == -1) fatal("rom_load_linear(): Error seeking to the beginning of the file\n"); - if (fread(ptr + addr, 1, sz, f) > sz) + if (fread(ptr + addr, 1, sz, fp) > sz) fatal("rom_load_linear(): Error reading data\n"); } - (void) fclose(f); + (void) fclose(fp); return 1; } @@ -270,9 +269,9 @@ rom_load_linear(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr) int rom_load_linear_inverted(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr) { - FILE *f = rom_fopen(fn, "rb"); + FILE *fp = rom_fopen(fn, "rb"); - if (f == NULL) { + if (fp == NULL) { rom_log("ROM: image '%s' not found\n", fn); return 0; } @@ -284,22 +283,22 @@ rom_load_linear_inverted(const char *fn, uint32_t addr, int sz, int off, uint8_t addr &= 0x03ffff; } - (void) fseek(f, 0, SEEK_END); - if (ftell(f) < sz) { - (void) fclose(f); + (void) fseek(fp, 0, SEEK_END); + if (ftell(fp) < sz) { + (void) fclose(fp); return 0; } if (ptr != NULL) { - if (fseek(f, off, SEEK_SET) == -1) + if (fseek(fp, off, SEEK_SET) == -1) fatal("rom_load_linear_inverted(): Error seeking to the beginning of the file\n"); - if (fread(ptr + addr + 0x10000, 1, sz >> 1, f) > (sz >> 1)) + if (fread(ptr + addr + 0x10000, 1, sz >> 1, fp) > (sz >> 1)) fatal("rom_load_linear_inverted(): Error reading the upper half of the data\n"); - if (fread(ptr + addr, sz >> 1, 1, f) > (sz >> 1)) + if (fread(ptr + addr, sz >> 1, 1, fp) > (sz >> 1)) fatal("rom_load_linear_inverted(): Error reading the lower half of the data\n"); } - (void) fclose(f); + (void) fclose(fp); return 1; } @@ -308,18 +307,18 @@ rom_load_linear_inverted(const char *fn, uint32_t addr, int sz, int off, uint8_t int rom_load_interleaved(const char *fnl, const char *fnh, uint32_t addr, int sz, int off, uint8_t *ptr) { - FILE *fl = rom_fopen(fnl, "rb"); - FILE *fh = rom_fopen(fnh, "rb"); + FILE *fpl = rom_fopen(fnl, "rb"); + FILE *fph = rom_fopen(fnh, "rb"); - if (fl == NULL || fh == NULL) { - if (fl == NULL) + if (fpl == NULL || fph == NULL) { + if (fpl == NULL) rom_log("ROM: image '%s' not found\n", fnl); else - (void) fclose(fl); - if (fh == NULL) + (void) fclose(fpl); + if (fph == NULL) rom_log("ROM: image '%s' not found\n", fnh); else - (void) fclose(fh); + (void) fclose(fph); return 0; } @@ -332,16 +331,16 @@ rom_load_interleaved(const char *fnl, const char *fnh, uint32_t addr, int sz, in } if (ptr != NULL) { - (void) fseek(fl, off, SEEK_SET); - (void) fseek(fh, off, SEEK_SET); + (void) fseek(fpl, off, SEEK_SET); + (void) fseek(fph, off, SEEK_SET); for (int c = 0; c < sz; c += 2) { - ptr[addr + c] = fgetc(fl) & 0xff; - ptr[addr + c + 1] = fgetc(fh) & 0xff; + ptr[addr + c] = fgetc(fpl) & 0xff; + ptr[addr + c + 1] = fgetc(fph) & 0xff; } } - (void) fclose(fh); - (void) fclose(fl); + (void) fclose(fph); + (void) fclose(fpl); return 1; } diff --git a/src/mem/row.c b/src/mem/row.c index 2152c1f54..a88113166 100644 --- a/src/mem/row.c +++ b/src/mem/row.c @@ -30,11 +30,12 @@ #include <86box/mem.h> #include <86box/spd.h> #include <86box/row.h> - +#include <86box/plat_unused.h> /* 0 1 2 3 4 5 6 7 */ -static uint8_t rows_num, rows_default, - rows_bits; +static uint8_t rows_num; +static uint8_t rows_default; +static uint8_t rows_bits; static uint32_t row_unit; static uint8_t drb_defaults[16]; static row_t *rows; @@ -112,7 +113,7 @@ row_writel(uint32_t addr, uint32_t val, void *priv) void row_allocate(uint8_t row_id, uint8_t set) { - uint32_t c, offset; + uint32_t offset; /* Do nothing if size is either zero or invalid. */ if ((rows[row_id].host_size == 0x00000000) || (rows[row_id].host_size == 0xffffffff)) @@ -121,7 +122,7 @@ row_allocate(uint8_t row_id, uint8_t set) if (rows[row_id].ram_size == 0x00000000) return; - for (c = (rows[row_id].host_base >> 12); c < ((rows[row_id].host_base + rows[row_id].host_size) >> 12); c++) { + for (uint32_t c = (rows[row_id].host_base >> 12); c < ((rows[row_id].host_base + rows[row_id].host_size) >> 12); c++) { offset = c - (rows[row_id].host_base >> 12); pages[c].mem = set ? (rows[row_id].buf + rows[row_id].ram_base + ((offset << 12) & rows[row_id].ram_mask)) : page_ff; @@ -129,22 +130,22 @@ row_allocate(uint8_t row_id, uint8_t set) pages[c].write_w = set ? mem_write_ramw_page : NULL; pages[c].write_l = set ? mem_write_raml_page : NULL; #ifdef USE_NEW_DYNAREC - pages[c].evict_prev = EVICT_NOT_IN_LIST; - pages[c].byte_dirty_mask = &byte_dirty_mask[offset * 64]; - pages[c].byte_code_present_mask = &byte_code_present_mask[offset * 64]; + pages[c].evict_prev = EVICT_NOT_IN_LIST; + pages[c].byte_dirty_mask = &byte_dirty_mask[offset * 64]; + pages[c].byte_code_present_mask = &byte_code_present_mask[offset * 64]; #endif } if (rows[row_id].host_base >= 0x00100000) { - mem_set_mem_state_both(rows[row_id].host_base, rows[row_id].host_base + rows[row_id].host_size, + mem_set_mem_state_both(rows[row_id].host_base, rows[row_id].host_base + rows[row_id].host_size, set ? (MEM_READ_INTERNAL | MEM_WRITE_INTERNAL) : (MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL)); } else { if (0x000a0000 > rows[row_id].host_base) { - mem_set_mem_state_both(rows[row_id].host_base, 0x000a0000 - rows[row_id].host_base, + mem_set_mem_state_both(rows[row_id].host_base, 0x000a0000 - rows[row_id].host_base, set ? (MEM_READ_INTERNAL | MEM_WRITE_INTERNAL) : (MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL)); } if ((rows[row_id].host_base + rows[row_id].host_size) > 0x00100000) { - mem_set_mem_state_both(0x00100000, (rows[row_id].host_base + rows[row_id].host_size) - 0x00100000, + mem_set_mem_state_both(0x00100000, (rows[row_id].host_base + rows[row_id].host_size) - 0x00100000, set ? (MEM_READ_INTERNAL | MEM_WRITE_INTERNAL) : (MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL)); } } @@ -208,15 +209,15 @@ row_set_boundary(uint8_t row_id, uint32_t boundary) void -row_reset(void *priv) +row_reset(UNUSED(void *priv)) { - int i; - uint32_t boundary, shift; + uint32_t boundary; + uint32_t shift; - for (i = (rows_num - 1); i >= 0; i--) + for (uint8_t i = (rows_num - 1); i >= 0; i--) row_disable(i); - for (i = 0; i < rows_num; i++) { + for (uint8_t i = 0; i < rows_num; i++) { shift = (i & 1) << 2; boundary = ((uint32_t) drb_defaults[i]) + (((((uint32_t) drb_defaults[(i >> 1) + 8]) >> shift) & 0xf) << 8); row_set_boundary(i, boundary); @@ -225,7 +226,7 @@ row_reset(void *priv) void -row_close(void *priv) +row_close(UNUSED(void *priv)) { free(rows); rows = NULL; @@ -235,14 +236,18 @@ row_close(void *priv) void * row_init(const device_t *info) { - uint32_t cur_drb = 0, cur_drbe = 0; - uint32_t last_drb = 0, last_drbe = 0; - uint8_t phys_drbs[16]; - int i, max = info->local & 0xff; - int c; - uint32_t shift, drb; - uint32_t boundary, mask; - row_t *new_rows = NULL; + uint32_t cur_drb = 0; + uint32_t cur_drbe = 0; + uint32_t last_drb = 0; + uint32_t last_drbe = 0; + uint8_t phys_drbs[16]; + int i; + int max = info->local & 0xff; + uint32_t shift; + uint32_t drb; + uint32_t boundary; + uint32_t mask; + row_t *new_rows = NULL; rows_bits = ((info->local >> 24) & 0xff); mask = (1 << rows_bits) - 1; @@ -268,7 +273,7 @@ row_init(const device_t *info) mem_mapping_disable(&ram_2gb_mapping); #endif - for (c = 0; c < pages_sz; c++) { + for (uint32_t c = 0; c < pages_sz; c++) { pages[c].mem = page_ff; pages[c].write_b = NULL; pages[c].write_w = NULL; diff --git a/src/mem/spd.c b/src/mem/spd.c index 6d3e88a93..176c80d3e 100644 --- a/src/mem/spd.c +++ b/src/mem/spd.c @@ -31,8 +31,8 @@ #define SPD_ROLLUP(x) ((x) >= 16 ? ((x) -15) : (x)) -int spd_present = 0; -spd_t *spd_modules[SPD_MAX_SLOTS]; +uint8_t spd_present = 0; +spd_t *spd_modules[SPD_MAX_SLOTS]; static const device_t spd_device; @@ -548,8 +548,8 @@ spd_write_drbs_ali1621(uint8_t *regs, uint8_t reg_min, uint8_t reg_max) regs[drb + 3] |= 0x06; switch (size) { - case 4: default: + case 4: regs[drb + 2] = 0x00; break; case 8: diff --git a/src/network/net_3c501.c b/src/network/net_3c501.c index 0c73ea028..74f7cbdc6 100644 --- a/src/network/net_3c501.c +++ b/src/network/net_3c501.c @@ -58,6 +58,7 @@ #include <86box/network.h> #include <86box/net_3c501.h> #include <86box/bswap.h> +#include <86box/plat_unused.h> /* Maximum number of times we report a link down to the guest (failure to send frame) */ #define ELNK_MAX_LINKDOWN_REPORTED 3 @@ -192,7 +193,7 @@ typedef struct ELNK_INTR_STAT { uint8_t unused : 5; } EL_INTR_STAT; -typedef struct { +typedef struct threec501_t { uint32_t base_address; int base_irq; uint32_t bios_addr; @@ -390,6 +391,7 @@ padr_bcast(threec501_t *dev, const uint8_t *buf) static uint8_t aBCAST[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; struct ether_header *hdr = (struct ether_header *) buf; int result = (dev->RcvCmd.adr_match == EL_ADRM_BCAST) && !memcmp(hdr->ether_dhost, aBCAST, 6); + return result; } @@ -401,6 +403,7 @@ padr_mcast(threec501_t *dev, const uint8_t *buf) { struct ether_header *hdr = (struct ether_header *) buf; int result = (dev->RcvCmd.adr_match == EL_ADRM_MCAST) && ETHER_IS_MULTICAST(hdr->ether_dhost); + return result; } @@ -692,7 +695,6 @@ elnkAsyncTransmit(threec501_t *dev) #ifdef ENABLE_3COM501_LOG threec501_log("3Com501: illegal giant frame (%u bytes) -> signalling error\n", cb); #endif - ; } } else { /* Signal a transmit error pretending there was a collision. */ @@ -921,6 +923,9 @@ threec501_read(uint16_t addr, void *priv) retval = dev->abPacketBuf[ELNK_GP(dev)]; dev->uGPBufPtr = (dev->uGPBufPtr + 1) & ELNK_GP_MASK; break; + + default: + break; } elnkUpdateIrq(dev); @@ -1007,6 +1012,9 @@ threec501_write(uint16_t addr, uint8_t value, void *priv) dev->abPacketBuf[ELNK_GP(dev)] = value; dev->uGPBufPtr = (dev->uGPBufPtr + 1) & ELNK_GP_MASK; break; + + default: + break; } #ifdef ENABLE_3COM501_LOG @@ -1068,7 +1076,7 @@ elnkR3TimerRestore(void *priv) } static void * -threec501_nic_init(const device_t *info) +threec501_nic_init(UNUSED(const device_t *info)) { uint32_t mac; threec501_t *dev; diff --git a/src/network/net_3c503.c b/src/network/net_3c503.c index ce4650456..f4a6dafba 100644 --- a/src/network/net_3c503.c +++ b/src/network/net_3c503.c @@ -62,8 +62,9 @@ #include <86box/net_dp8390.h> #include <86box/net_3c503.h> #include <86box/bswap.h> +#include <86box/plat_unused.h> -typedef struct { +typedef struct threec503_t { dp8390_t *dp8390; mem_mapping_t ram_mapping; uint32_t base_address; @@ -129,6 +130,9 @@ threec503_interrupt(void *priv, int set) case 5: dev->regs.idcfr = 0x80; break; + + default: + break; } if (set) @@ -174,6 +178,9 @@ threec503_set_drq(threec503_t *dev) case 3: dev->regs.idcfr = 4; break; + + default: + break; } } @@ -223,6 +230,9 @@ threec503_nic_lo_read(uint16_t addr, void *priv) case 0x03: retval = 0xff; break; + + default: + break; } break; @@ -237,6 +247,9 @@ threec503_nic_lo_read(uint16_t addr, void *priv) case 0x03: retval = 0xff; break; + + default: + break; } return retval; @@ -272,6 +285,9 @@ threec503_nic_lo_write(uint16_t addr, uint8_t val, void *priv) case 0x03: break; + + default: + break; } break; @@ -279,6 +295,9 @@ threec503_nic_lo_write(uint16_t addr, uint8_t val, void *priv) case 0x02: case 0x03: break; + + default: + break; } threec503_log("3Com503: write addr %x, value %x\n", addr, val); @@ -338,7 +357,6 @@ threec503_nic_hi_read(uint16_t addr, void *priv) } return dev->regs.bcfr; - break; case 0x04: switch (dev->bios_addr) { @@ -357,10 +375,12 @@ threec503_nic_hi_read(uint16_t addr, void *priv) case 0xc8000: dev->regs.pcfr = 0x10; break; + + default: + break; } return dev->regs.pcfr; - break; case 0x05: return dev->regs.gacfr; @@ -397,6 +417,9 @@ threec503_nic_hi_read(uint16_t addr, void *priv) threec503_set_drq(dev); return dp8390_chipmem_read(dev->dp8390, dev->regs.da++, 1); + + default: + break; } return 0; @@ -527,6 +550,9 @@ threec503_nic_hi_write(uint16_t addr, uint8_t val, void *priv) dp8390_chipmem_write(dev->dp8390, dev->regs.da++, val, 1); break; + + default: + break; } } @@ -543,7 +569,7 @@ threec503_nic_ioset(threec503_t *dev, uint16_t addr) } static void * -threec503_nic_init(const device_t *info) +threec503_nic_init(UNUSED(const device_t *info)) { uint32_t mac; threec503_t *dev; @@ -605,7 +631,9 @@ threec503_nic_init(const device_t *info) threec503_ram_read, NULL, NULL, threec503_ram_write, NULL, NULL, NULL, MEM_MAPPING_EXTERNAL, dev); - // mem_mapping_disable(&dev->ram_mapping); +#if 0 + mem_mapping_disable(&dev->ram_mapping); +#endif dev->regs.gacfr = 0x09; /* Start with RAM mapping enabled. */ /* Attach ourselves to the network module. */ diff --git a/src/network/net_dp8390.c b/src/network/net_dp8390.c index a1fa4b336..8264d41f9 100644 --- a/src/network/net_dp8390.c +++ b/src/network/net_dp8390.c @@ -29,6 +29,7 @@ #include <86box/timer.h> #include <86box/network.h> #include <86box/net_dp8390.h> +#include <86box/plat_unused.h> static void dp8390_tx(dp8390_t *dev, uint32_t val); static int dp8390_rx_common(void *priv, uint8_t *buf, int io_len); @@ -242,7 +243,7 @@ dp8390_write_cr(dp8390_t *dev, uint32_t val) } static void -dp8390_tx(dp8390_t *dev, uint32_t val) +dp8390_tx(dp8390_t *dev, UNUSED(uint32_t val)) { dev->CR.tx_packet = 0; dev->TSR.tx_ok = 1; @@ -506,7 +507,7 @@ dp8390_page0_read(dp8390_t *dev, uint32_t off, unsigned int len) } void -dp8390_page0_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len) +dp8390_page0_write(dp8390_t *dev, uint32_t off, uint32_t val, UNUSED(unsigned len)) { uint8_t val2; @@ -697,7 +698,7 @@ dp8390_page0_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len) /* Handle reads/writes to the first page of the DS8390 register file. */ uint32_t -dp8390_page1_read(dp8390_t *dev, uint32_t off, unsigned int len) +dp8390_page1_read(dp8390_t *dev, uint32_t off, UNUSED(unsigned int len)) { dp8390_log("DP8390: Page1 read from register 0x%02x, len=%u\n", off, len); @@ -734,7 +735,7 @@ dp8390_page1_read(dp8390_t *dev, uint32_t off, unsigned int len) } void -dp8390_page1_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len) +dp8390_page1_write(dp8390_t *dev, uint32_t off, uint32_t val, UNUSED(unsigned len)) { dp8390_log("DP8390: Page1 write to register 0x%02x, len=%u, value=0x%04x\n", off, len, val); @@ -778,7 +779,7 @@ dp8390_page1_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len) /* Handle reads/writes to the second page of the DS8390 register file. */ uint32_t -dp8390_page2_read(dp8390_t *dev, uint32_t off, unsigned int len) +dp8390_page2_read(dp8390_t *dev, uint32_t off, UNUSED(unsigned int len)) { dp8390_log("DP8390: Page2 read from register 0x%02x, len=%u\n", off, len); @@ -835,7 +836,7 @@ dp8390_page2_read(dp8390_t *dev, uint32_t off, unsigned int len) } void -dp8390_page2_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len) +dp8390_page2_write(dp8390_t *dev, uint32_t off, uint32_t val, UNUSED(unsigned len)) { /* Maybe all writes here should be BX_PANIC()'d, since they affect internal operation, but let them through for now @@ -999,7 +1000,7 @@ dp8390_soft_reset(dp8390_t *dev) } static void * -dp8390_init(const device_t *info) +dp8390_init(UNUSED(const device_t *info)) { dp8390_t *dp8390 = (dp8390_t *) malloc(sizeof(dp8390_t)); memset(dp8390, 0, sizeof(dp8390_t)); diff --git a/src/network/net_event.c b/src/network/net_event.c index 6e68f1fe3..c39c12254 100644 --- a/src/network/net_event.c +++ b/src/network/net_event.c @@ -7,6 +7,7 @@ #endif #include <86box/net_event.h> +#include <86box/plat_unused.h> #ifndef _WIN32 static void @@ -40,7 +41,7 @@ net_event_set(net_evt_t *event) } void -net_event_clear(net_evt_t *event) +net_event_clear(UNUSED(net_evt_t *event)) { #ifdef _WIN32 /* Do nothing on WIN32 since we use an auto-reset event */ diff --git a/src/network/net_ne2000.c b/src/network/net_ne2000.c index 263d38970..599d5c626 100644 --- a/src/network/net_ne2000.c +++ b/src/network/net_ne2000.c @@ -68,6 +68,7 @@ #include <86box/net_ne2000.h> #include <86box/bswap.h> #include <86box/isapnp.h> +#include <86box/plat_unused.h> /* ROM BIOS file paths. */ #define ROM_PATH_NE1000 "roms/network/ne1000/ne1000.rom" @@ -93,28 +94,33 @@ static uint8_t rtl8019as_pnp_rom[] = { 0x79, 0x00 /* end tag, dummy checksum (filled in by isapnp_add_card) */ }; -typedef struct { +typedef struct nic_t { dp8390_t *dp8390; const char *name; int board; - int is_pci, is_mca, is_8bit; + int is_pci; + int is_mca; + int is_8bit; uint32_t base_address; int base_irq; - uint32_t bios_addr, - bios_size, - bios_mask; - int card; /* PCI card slot */ - int has_bios, pad; - bar_t pci_bar[2]; - uint8_t pci_regs[PCI_REGSIZE]; - uint8_t eeprom[128]; /* for RTL8029AS */ - rom_t bios_rom; - void *pnp_card; - uint8_t pnp_csnsav; - uint8_t maclocal[6]; /* configured MAC (local) address */ + uint32_t bios_addr; + uint32_t bios_size; + uint32_t bios_mask; + int card; /* PCI card slot */ + int has_bios; + int pad; + bar_t pci_bar[2]; + uint8_t pci_regs[PCI_REGSIZE]; + uint8_t eeprom[128]; /* for RTL8029AS */ + rom_t bios_rom; + void *pnp_card; + uint8_t pnp_csnsav; + uint8_t maclocal[6]; /* configured MAC (local) address */ /* RTL8019AS/RTL8029AS registers */ - uint8_t config0, config2, config3; + uint8_t config0; + uint8_t config2; + uint8_t config3; uint8_t _9346cr; uint32_t pad0; @@ -308,7 +314,7 @@ asic_write(nic_t *dev, uint32_t off, uint32_t val, unsigned len) /* Writes to this page are illegal. */ static uint32_t -page3_read(nic_t *dev, uint32_t off, unsigned int len) +page3_read(nic_t *dev, uint32_t off, UNUSED(unsigned int len)) { if (dev->board >= NE2K_RTL8019AS) switch (off) { @@ -346,7 +352,7 @@ page3_read(nic_t *dev, uint32_t off, unsigned int len) } static void -page3_write(nic_t *dev, uint32_t off, uint32_t val, unsigned len) +page3_write(nic_t *dev, uint32_t off, uint32_t val, UNUSED(unsigned len)) { if (dev->board >= NE2K_RTL8019AS) { nelog(3, "%s: Page2 write to register 0x%02x, len=%u, value=0x%04x\n", @@ -535,6 +541,9 @@ nic_pnp_read_vendor_reg(uint8_t ld, uint8_t reg, void *priv) case 0xF5: return dev->pnp_csnsav; + + default: + break; } return 0x00; @@ -623,7 +632,7 @@ nic_update_bios(nic_t *dev) } static uint8_t -nic_pci_read(int func, int addr, void *priv) +nic_pci_read(UNUSED(int func), int addr, void *priv) { nic_t *dev = (nic_t *) priv; uint8_t ret = 0x00; @@ -707,6 +716,9 @@ nic_pci_read(int func, int addr, void *priv) case 0x3D: /* PCI_IPR */ ret = dev->pci_regs[addr]; break; + + default: + break; } nelog(2, "%s: PCI_Read(%d, %04x) = %02x\n", dev->name, func, addr, ret); @@ -715,7 +727,7 @@ nic_pci_read(int func, int addr, void *priv) } static void -nic_pci_write(int func, int addr, uint8_t val, void *priv) +nic_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv) { nic_t *dev = (nic_t *) priv; uint8_t valxor; @@ -737,7 +749,7 @@ nic_pci_write(int func, int addr, uint8_t val, void *priv) case 0x10: /* PCI_BAR */ val &= 0xe0; /* 0xe0 acc to RTL DS */ val |= 0x01; /* re-enable IOIN bit */ - /*FALLTHROUGH*/ + [[fallthrough]]; case 0x11: /* PCI_BAR */ case 0x12: /* PCI_BAR */ @@ -767,7 +779,9 @@ nic_pci_write(int func, int addr, uint8_t val, void *priv) case 0x32: /* PCI_ROMBAR */ case 0x33: /* PCI_ROMBAR */ dev->pci_bar[1].addr_regs[addr & 3] = val; - /* dev->pci_bar[1].addr_regs[1] &= dev->bios_mask; */ +#if 0 + dev->pci_bar[1].addr_regs[1] &= dev->bios_mask; +#endif dev->pci_bar[1].addr &= 0xffff8001; dev->bios_addr = dev->pci_bar[1].addr & 0xffff8000; nic_update_bios(dev); @@ -778,6 +792,9 @@ nic_pci_write(int func, int addr, uint8_t val, void *priv) dev->base_irq = val; dev->pci_regs[addr] = dev->base_irq; return; + + default: + break; } } @@ -1000,6 +1017,9 @@ nic_init(const device_t *info) dp8390_set_id(dev->dp8390, 0x50, (dev->board == NE2K_RTL8019AS) ? 0x70 : 0x43); dp8390_mem_alloc(dev->dp8390, 0x4000, 0x8000); break; + + default: + break; } memcpy(dev->dp8390->physaddr, dev->maclocal, sizeof(dev->maclocal)); diff --git a/src/network/net_null.c b/src/network/net_null.c index 27a0d4da7..6fb3f3440 100644 --- a/src/network/net_null.c +++ b/src/network/net_null.c @@ -37,6 +37,7 @@ #include <86box/timer.h> #include <86box/network.h> #include <86box/net_event.h> +#include <86box/plat_unused.h> enum { NET_EVENT_STOP = 0, @@ -53,7 +54,7 @@ enum { #define NULL_PKT_BATCH NET_QUEUE_LEN -typedef struct { +typedef struct net_null_t { uint8_t mac_addr[6]; netcard_t *card; thread_t *poll_tid; @@ -158,7 +159,7 @@ net_null_thread(void *priv) #endif void * -net_null_init(const netcard_t *card, const uint8_t *mac_addr, void *priv, char *netdrv_errbuf) +net_null_init(const netcard_t *card, const uint8_t *mac_addr, UNUSED(void *priv), UNUSED(char *netdrv_errbuf)) { net_null_log("Null Network: Init\n"); diff --git a/src/network/net_pcap.c b/src/network/net_pcap.c index b9e2f32e8..4981fb9a3 100644 --- a/src/network/net_pcap.c +++ b/src/network/net_pcap.c @@ -247,7 +247,7 @@ net_pcap_in(void *pcap, uint8_t *bufp, int len) if (pcap == NULL) return; - f_pcap_sendpacket((void *) pcap, bufp, len); + f_pcap_sendpacket(pcap, bufp, len); } void @@ -268,7 +268,7 @@ net_pcap_thread(void *priv) HANDLE events[NET_EVENT_MAX]; events[NET_EVENT_STOP] = net_event_get_handle(&pcap->stop_event); events[NET_EVENT_TX] = net_event_get_handle(&pcap->tx_event); - events[NET_EVENT_RX] = f_pcap_getevent((void *) pcap->pcap); + events[NET_EVENT_RX] = f_pcap_getevent(pcap->pcap); bool run = true; @@ -296,6 +296,9 @@ net_pcap_thread(void *priv) case NET_EVENT_RX: f_pcap_dispatch(pcap->pcap, PCAP_PKT_BATCH, net_pcap_rx_handler, (u_char *) pcap); break; + + default: + break; } } @@ -467,22 +470,22 @@ net_pcap_init(const netcard_t *card, const uint8_t *mac_addr, void *priv, char * return NULL; } - if (f_pcap_setnonblock((void *) pcap->pcap, 1, errbuf) != 0) + if (f_pcap_setnonblock(pcap->pcap, 1, errbuf) != 0) pcap_log("PCAP: failed nonblock %s\n", errbuf); - if (f_pcap_set_immediate_mode((void *) pcap->pcap, 1) != 0) + if (f_pcap_set_immediate_mode(pcap->pcap, 1) != 0) pcap_log("PCAP: error setting immediate mode\n"); - if (f_pcap_set_promisc((void *) pcap->pcap, 1) != 0) + if (f_pcap_set_promisc(pcap->pcap, 1) != 0) pcap_log("PCAP: error enabling promiscuous mode\n"); - if (f_pcap_set_snaplen((void *) pcap->pcap, NET_MAX_FRAME) != 0) + if (f_pcap_set_snaplen(pcap->pcap, NET_MAX_FRAME) != 0) pcap_log("PCAP: error setting snaplen\n"); - if (f_pcap_activate((void *) pcap->pcap) != 0) { + if (f_pcap_activate(pcap->pcap) != 0) { snprintf(errbuf_prep, NET_DRV_ERRBUF_SIZE, "%s", (char *)f_pcap_geterr(pcap->pcap)); net_pcap_error(netdrv_errbuf, errbuf_prep); - f_pcap_close((void *) pcap->pcap); + f_pcap_close(pcap->pcap); free(pcap); return NULL; } @@ -494,18 +497,18 @@ net_pcap_init(const netcard_t *card, const uint8_t *mac_addr, void *priv, char * "( ((ether dst ff:ff:ff:ff:ff:ff) or (ether dst %02x:%02x:%02x:%02x:%02x:%02x)) and not (ether src %02x:%02x:%02x:%02x:%02x:%02x) )", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5], mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); - if (f_pcap_compile((void *) pcap->pcap, &fp, filter_exp, 0, 0xffffffff) != -1) { - if (f_pcap_setfilter((void *) pcap->pcap, &fp) != 0) { + if (f_pcap_compile(pcap->pcap, &fp, filter_exp, 0, 0xffffffff) != -1) { + if (f_pcap_setfilter(pcap->pcap, &fp) != 0) { snprintf(errbuf_prep, NET_DRV_ERRBUF_SIZE, "Error installing filter (%s)\n", filter_exp); net_pcap_error(netdrv_errbuf, errbuf_prep); - f_pcap_close((void *) pcap->pcap); + f_pcap_close(pcap->pcap); free(pcap); return NULL; } } else { - snprintf(errbuf_prep, NET_DRV_ERRBUF_SIZE, "Could not compile filter (%s) : %s!\n", filter_exp, (char *)f_pcap_geterr((void *) pcap->pcap)); + snprintf(errbuf_prep, NET_DRV_ERRBUF_SIZE, "Could not compile filter (%s) : %s!\n", filter_exp, (char *)f_pcap_geterr(pcap->pcap)); net_pcap_error(netdrv_errbuf, errbuf_prep); - f_pcap_close((void *) pcap->pcap); + f_pcap_close(pcap->pcap); free(pcap); return NULL; } @@ -554,7 +557,7 @@ net_pcap_close(void *priv) f_pcap_sendqueue_destroy((void *) pcap->pcap_queue); #endif /* OK, now shut down Pcap itself. */ - f_pcap_close((void *) pcap->pcap); + f_pcap_close(pcap->pcap); net_event_close(&pcap->tx_event); net_event_close(&pcap->stop_event); diff --git a/src/network/net_pcnet.c b/src/network/net_pcnet.c index b1ea475ae..e1f47c221 100644 --- a/src/network/net_pcnet.c +++ b/src/network/net_pcnet.c @@ -47,6 +47,7 @@ #include <86box/network.h> #include <86box/net_pcnet.h> #include <86box/bswap.h> +#include <86box/plat_unused.h> /* PCI info. */ #define PCI_VENDID 0x1022 /* AMD */ @@ -744,11 +745,12 @@ static const uint32_t crctab[256] = }; static __inline int -padr_match(nic_t *dev, const uint8_t *buf, int size) +padr_match(nic_t *dev, const uint8_t *buf, UNUSED(int size)) { struct ether_header *hdr = (struct ether_header *) buf; int result; uint8_t padr[6]; + padr[0] = dev->aCSR[12] & 0xff; padr[1] = dev->aCSR[12] >> 8; padr[2] = dev->aCSR[13] & 0xff; @@ -768,19 +770,22 @@ padr_match(nic_t *dev, const uint8_t *buf, int size) } static __inline int -padr_bcast(nic_t *dev, const uint8_t *buf, size_t size) +padr_bcast(nic_t *dev, const uint8_t *buf, UNUSED(size_t size)) { static uint8_t aBCAST[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; struct ether_header *hdr = (struct ether_header *) buf; int result = !CSR_DRCVBC(dev) && !memcmp(hdr->ether_dhost, aBCAST, 6); + pcnet_log(3, "%s: padr_bcast result=%d\n", dev->name, result); + return result; } static int -ladr_match(nic_t *dev, const uint8_t *buf, size_t size) +ladr_match(nic_t *dev, const uint8_t *buf, UNUSED(size_t size)) { struct ether_header *hdr = (struct ether_header *) buf; + if ((hdr->ether_dhost[0] & 0x01) && ((uint64_t *) &dev->aCSR[8])[0] != 0LL) { int index; uint8_t ladr[8]; @@ -861,6 +866,9 @@ pcnetSoftReset(nic_t *dev) dev->aCSR[88] = 0x3003; dev->aCSR[89] = 0x0262; break; + + default: + break; } dev->aCSR[94] = 0x0000; @@ -1680,9 +1688,9 @@ pcnetPollRxTx(nic_t *dev) } static void -pcnetPollTimer(void *p) +pcnetPollTimer(void *priv) { - nic_t *dev = (nic_t *) p; + nic_t *dev = (nic_t *) priv; timer_advance_u64(&dev->timer, 2000 * TIMER_USEC); @@ -2223,6 +2231,9 @@ pcnet_word_write(nic_t *dev, uint32_t addr, uint16_t val) case 0x06: pcnet_bcr_writew(dev, dev->u32RAP, val); break; + + default: + break; } } } @@ -2238,6 +2249,9 @@ pcnet_byte_read(nic_t *dev, uint32_t addr) pcnetSoftReset(dev); val = 0; break; + + default: + break; } } @@ -2275,6 +2289,9 @@ pcnet_word_read(nic_t *dev, uint32_t addr) case 0x06: val = pcnet_bcr_readw(dev, dev->u32RAP); break; + + default: + break; } } @@ -2302,6 +2319,9 @@ pcnet_dword_write(nic_t *dev, uint32_t addr, uint32_t val) case 0x0c: pcnet_bcr_writew(dev, dev->u32RAP, val & 0xffff); break; + + default: + break; } } else if ((addr & 0x0f) == 0) { /* switch device to dword i/o mode */ @@ -2334,6 +2354,9 @@ pcnet_dword_read(nic_t *dev, uint32_t addr) case 0x0c: val = pcnet_bcr_readw(dev, dev->u32RAP); break; + + default: + break; } } @@ -2540,9 +2563,9 @@ pcnet_ioset(nic_t *dev, uint16_t addr, int len) } static void -pcnet_pci_write(int func, int addr, uint8_t val, void *p) +pcnet_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv) { - nic_t *dev = (nic_t *) p; + nic_t *dev = (nic_t *) priv; uint8_t valxor; pcnet_log(4, "%s: Write value %02X to register %02X\n", dev->name, val, addr & 0xff); @@ -2616,13 +2639,16 @@ pcnet_pci_write(int func, int addr, uint8_t val, void *p) dev->base_irq = val; pcnet_pci_regs[addr] = val; return; + + default: + break; } } static uint8_t -pcnet_pci_read(int func, int addr, void *p) +pcnet_pci_read(UNUSED(int func), int addr, void *priv) { - nic_t *dev = (nic_t *) p; + nic_t *dev = (nic_t *) priv; pcnet_log(4, "%s: Read to register %02X\n", dev->name, addr & 0xff); @@ -2687,6 +2713,9 @@ pcnet_pci_read(int func, int addr, void *p) return 0x06; case 0x3F: return 0xff; + + default: + break; } return 0; diff --git a/src/network/net_plip.c b/src/network/net_plip.c index 58274e62a..d081608ee 100644 --- a/src/network/net_plip.c +++ b/src/network/net_plip.c @@ -35,6 +35,7 @@ #include <86box/timer.h> #include <86box/network.h> #include <86box/net_plip.h> +#include <86box/plat_unused.h> enum { PLIP_START = 0x00, @@ -57,20 +58,28 @@ enum { PLIP_END = 0x40 }; -typedef struct -{ +typedef struct plip_t { uint8_t mac[6]; void *lpt; pc_timer_t rx_timer; pc_timer_t timeout_timer; - uint8_t status, ctrl; + uint8_t status; + uint8_t ctrl; - uint8_t state, ack, tx_checksum, tx_checksum_calc, *tx_pkt; - uint16_t tx_len, tx_ptr; + uint8_t state; + uint8_t ack; + uint8_t tx_checksum; + uint8_t tx_checksum_calc; + uint8_t *tx_pkt; + uint16_t tx_len; + uint16_t tx_ptr; - uint8_t *rx_pkt, rx_checksum, rx_return_state; - uint16_t rx_len, rx_ptr; + uint8_t *rx_pkt; + uint8_t rx_checksum; + uint8_t rx_return_state; + uint16_t rx_len; + uint16_t rx_ptr; netcard_t *card; } plip_t; @@ -334,6 +343,9 @@ plip_write_data(uint8_t val, void *priv) /* Disengage timeout timer. */ timer_disable(&dev->timeout_timer); return; + + default: + break; } /* Engage timeout timer unless otherwise specified. */ @@ -454,7 +466,7 @@ plip_lpt_init(void *lpt) } static void * -plip_net_init(const device_t *info) +plip_net_init(UNUSED(const device_t *info)) { plip_log(1, "PLIP: net_init()"); diff --git a/src/network/net_slirp.c b/src/network/net_slirp.c index bb1d82c2d..6aff76a90 100644 --- a/src/network/net_slirp.c +++ b/src/network/net_slirp.c @@ -58,7 +58,7 @@ enum { NET_EVENT_MAX }; -typedef struct { +typedef struct net_slirp_t { Slirp *slirp; uint8_t mac_addr[6]; netcard_t *card; /* netcard attached to us */ @@ -68,9 +68,10 @@ typedef struct { netpkt_t pkt; netpkt_t pkt_tx_v[SLIRP_PKT_BATCH]; #ifdef _WIN32 - HANDLE sock_event; + HANDLE sock_event; #else - uint32_t pfd_len, pfd_size; + uint32_t pfd_len; + uint32_t pfd_size; struct pollfd *pfd; #endif } net_slirp_t; @@ -94,19 +95,19 @@ slirp_log(const char *fmt, ...) #endif static void -net_slirp_guest_error(const char *msg, void *opaque) +net_slirp_guest_error(UNUSED(const char *msg), UNUSED(void *opaque)) { slirp_log("SLiRP: guest_error(): %s\n", msg); } static int64_t -net_slirp_clock_get_ns(void *opaque) +net_slirp_clock_get_ns(UNUSED(void *opaque)) { return (int64_t) ((double) tsc / cpuclock * 1000000000.0); } static void * -net_slirp_timer_new(SlirpTimerCb cb, void *cb_opaque, void *opaque) +net_slirp_timer_new(SlirpTimerCb cb, void *cb_opaque, UNUSED(void *opaque)) { pc_timer_t *timer = malloc(sizeof(pc_timer_t)); timer_add(timer, cb, cb_opaque, 0); @@ -114,14 +115,14 @@ net_slirp_timer_new(SlirpTimerCb cb, void *cb_opaque, void *opaque) } static void -net_slirp_timer_free(void *timer, void *opaque) +net_slirp_timer_free(void *timer, UNUSED(void *opaque)) { timer_stop(timer); free(timer); } static void -net_slirp_timer_mod(void *timer, int64_t expire_timer, void *opaque) +net_slirp_timer_mod(void *timer, int64_t expire_timer, UNUSED(void *opaque)) { timer_on_auto(timer, expire_timer * 1000); } @@ -384,7 +385,7 @@ static int slirp_card_num = 2; /* Initialize SLiRP for use. */ void * -net_slirp_init(const netcard_t *card, const uint8_t *mac_addr, void *priv, char *netdrv_errbuf) +net_slirp_init(const netcard_t *card, const uint8_t *mac_addr, UNUSED(void *priv), char *netdrv_errbuf) { slirp_log("SLiRP: initializing...\n"); net_slirp_t *slirp = calloc(1, sizeof(net_slirp_t)); diff --git a/src/network/net_vde.c b/src/network/net_vde.c index 5bcf1ffff..afeeaac9c 100644 --- a/src/network/net_vde.c +++ b/src/network/net_vde.c @@ -62,15 +62,15 @@ static volatile void *libvde_handle = NULL; //+ // VDE connection structure //- -typedef struct { - void *vdeconn; // VDEPLUG Connection - netcard_t *card; // NIC linked to - thread_t *poll_tid; // Polling thread - net_evt_t tx_event; // Packets to transmit event - net_evt_t stop_event; // Stop thread event - netpkt_t pkt; // Packet read/sent - netpkt_t pktv[VDE_PKT_BATCH]; // Packet queue - uint8_t mac_addr[6]; // MAC Address +typedef struct net_vde_t { + void *vdeconn; // VDEPLUG Connection + netcard_t *card; // NIC linked to + thread_t *poll_tid; // Polling thread + net_evt_t tx_event; // Packets to transmit event + net_evt_t stop_event; // Stop thread event + netpkt_t pkt; // Packet read/sent + netpkt_t pktv[VDE_PKT_BATCH]; // Packet queue + uint8_t mac_addr[6]; // MAC Address } net_vde_t; //+ @@ -221,7 +221,7 @@ void net_vde_close(void *priv) { free(vde->pktv[i].data); } free(vde->pkt.data); - f_vde_close((void *) vde->vdeconn); + f_vde_close(vde->vdeconn); net_event_close(&vde->tx_event); net_event_close(&vde->stop_event); free(vde); diff --git a/src/network/net_wd8003.c b/src/network/net_wd8003.c index 385f4332a..65a085557 100644 --- a/src/network/net_wd8003.c +++ b/src/network/net_wd8003.c @@ -64,6 +64,7 @@ #include <86box/net_dp8390.h> #include <86box/net_wd8003.h> #include <86box/bswap.h> +#include <86box/plat_unused.h> #include "cpu.h" @@ -98,12 +99,14 @@ #define WE_ID_EXTRA_RAM 0x40 #define WE_ID_BUS_MCA 0x80 -typedef struct { +typedef struct wd_t { dp8390_t *dp8390; mem_mapping_t ram_mapping; - uint32_t ram_addr, ram_size; + uint32_t ram_addr; + uint32_t ram_size; uint8_t maclocal[6]; /* configured MAC (local) address */ - uint8_t bit16, pad; + uint8_t bit16; + uint8_t pad; int board; const char *name; uint32_t base_address; @@ -113,11 +116,12 @@ typedef struct { uint8_t pos_regs[8]; /* Memory for WD cards*/ - uint8_t msr, /* Memory Select Register (MSR) */ - icr, /* Interface Configuration Register (ICR) */ - irr, /* Interrupt Request Register (IRR) */ - laar, /* LA Address Register (read by Windows 98!) */ - if_chip, board_chip; + uint8_t msr; /* Memory Select Register (MSR) */ + uint8_t icr; /* Interface Configuration Register (ICR) */ + uint8_t irr; /* Interrupt Request Register (IRR) */ + uint8_t laar; /* LA Address Register (read by Windows 98!) */ + uint8_t if_chip; + uint8_t board_chip; } wd_t; #ifdef ENABLE_WD_LOG @@ -280,6 +284,9 @@ wd_smc_read(wd_t *dev, uint32_t off) retval = 0xff - (checksum & 0xff); break; + + default: + break; } wdlog("%s: ASIC read addr=0x%02x, value=0x%04x\n", @@ -602,6 +609,9 @@ wd_8013epa_mca_write(int port, uint8_t val, void *priv) case 0x0c: dev->irq = 14; break; + + default: + break; } if (dev->pos_regs[3] & 0x10) @@ -629,7 +639,7 @@ wd_8013epa_mca_write(int port, uint8_t val, void *priv) } static uint8_t -wd_mca_feedb(void *priv) +wd_mca_feedb(UNUSED(void *priv)) { return 1; } @@ -724,6 +734,7 @@ wd_init(const device_t *info) /* Ethernet, MCA, 5x3 interface chip, RAM 16k */ case WD8003EA: dev->board_chip = WE_ID_SOFT_CONFIG; + [[fallthrough]]; /* Ethernet, MCA, no interface chip, RAM 16k */ case WD8003ETA: dev->board_chip |= WE_TYPE_WD8013EBT | WE_ID_BUS_MCA; @@ -740,6 +751,9 @@ wd_init(const device_t *info) dev->pos_regs[1] = 0x61; dev->bit16 = 3; break; + + default: + break; } dev->irr |= WE_IRR_ENABLE_IRQ; diff --git a/src/nvr_at.c b/src/nvr_at.c index 7d0b18ae4..2ae5cef75 100644 --- a/src/nvr_at.c +++ b/src/nvr_at.c @@ -834,7 +834,9 @@ nvr_reset(nvr_t *nvr) { local_t *local = (local_t *) nvr->data; - /* memset(nvr->regs, local->def, RTC_REGS); */ +#if 0 + memset(nvr->regs, local->def, RTC_REGS); +#endif memset(nvr->regs, local->def, nvr->size); nvr->regs[RTC_DOM] = 1; nvr->regs[RTC_MONTH] = 1; diff --git a/src/pci.c b/src/pci.c index 5b4282c5a..2aa4a20dc 100644 --- a/src/pci.c +++ b/src/pci.c @@ -979,6 +979,7 @@ static void pci_slots_clear(void) { uint8_t i; + last_pci_card = last_normal_pci_card = 0; last_pci_bus = 1; diff --git a/src/pci_dummy.c b/src/pci_dummy.c index 3d437247d..2f9782232 100644 --- a/src/pci_dummy.c +++ b/src/pci_dummy.c @@ -210,7 +210,7 @@ pci_dummy_pci_write(int func, int addr, uint8_t val, void *priv) case 0x10: /* PCI_BAR */ val &= 0xe0; /* 0xe0 acc to RTL DS */ - /*FALLTHROUGH*/ + [[fallthrough]]; case 0x11: /* PCI_BAR */ /* Remove old I/O. */ diff --git a/src/printer/png.c b/src/printer/png.c index 2134f3343..c7443252b 100644 --- a/src/printer/png.c +++ b/src/printer/png.c @@ -196,7 +196,6 @@ png_write_rgb(char *fn, uint8_t *pix, int16_t w, int16_t h, uint16_t pitch, PALE png_bytep *rows; png_color palette[256]; FILE *fp; - int i; /* Create the image file. */ fp = plat_fopen(fn, "wb"); @@ -248,7 +247,7 @@ error: PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); - for (i = 0; i < 256; i++) { + for (uint16_t i = 0; i < 256; i++) { palette[i].red = palcol[i].r; palette[i].green = palcol[i].g; palette[i].blue = palcol[i].b; @@ -259,7 +258,7 @@ error: /* Create a buffer for scanlines of pixels. */ rows = (png_bytep *) malloc(sizeof(png_bytep) * h); - for (i = 0; i < h; i++) { + for (int16_t i = 0; i < h; i++) { /* Create a buffer for this scanline. */ rows[i] = (pix + (i * pitch)); } diff --git a/src/printer/prt_cpmap.c b/src/printer/prt_cpmap.c index f2916eef8..153008f35 100644 --- a/src/printer/prt_cpmap.c +++ b/src/printer/prt_cpmap.c @@ -585,6 +585,6 @@ select_codepage(uint16_t code, uint16_t *curmap) i++; } - for (i = 0; i < 256; i++) - curmap[i] = map_to_use[i]; + for (uint16_t j = 0; j < 256; j++) + curmap[j] = map_to_use[j]; } diff --git a/src/printer/prt_escp.c b/src/printer/prt_escp.c index 7837b0434..6776519e4 100644 --- a/src/printer/prt_escp.c +++ b/src/printer/prt_escp.c @@ -1462,7 +1462,7 @@ process_char(escp_t *dev, uint8_t ch) dev->curr_x = dev->left_margin; if (!dev->autofeed) return 1; - /*FALLTHROUGH*/ + [[fallthrough]]; case 0x0a: /* Line feed */ if (dev->font_style & STYLE_DOUBLEWIDTHONELINE) { diff --git a/src/printer/prt_ps.c b/src/printer/prt_ps.c index caa166a10..06ae16336 100644 --- a/src/printer/prt_ps.c +++ b/src/printer/prt_ps.c @@ -58,8 +58,7 @@ #define POSTSCRIPT_BUFFER_LENGTH 65536 -typedef struct -{ +typedef struct ps_t { const char *name; void *lpt; diff --git a/src/printer/prt_text.c b/src/printer/prt_text.c index 6fe0f531a..4eab6ae2b 100644 --- a/src/printer/prt_text.c +++ b/src/printer/prt_text.c @@ -283,7 +283,7 @@ process_char(prnt_t *dev, uint8_t ch) dev->curr_x = 0; if (!dev->autofeed) return 1; - /*FALLTHROUGH*/ + [[fallthrough]]; case 0x0a: /* Line feed */ dev->curr_x = 0; diff --git a/src/scsi/scsi_aha154x.c b/src/scsi/scsi_aha154x.c index de2d014c3..1cd776ff3 100644 --- a/src/scsi/scsi_aha154x.c +++ b/src/scsi/scsi_aha154x.c @@ -71,7 +71,7 @@ uint16_t aha_ports[] = { static uint8_t *aha1542cp_pnp_rom = NULL; #pragma pack(push, 1) -typedef struct { +typedef struct aha_setup_t { uint8_t CustomerSignature[20]; uint8_t uAutoRetry; uint8_t uBoardSwitches; @@ -163,7 +163,7 @@ aha_eeprom_save(x54x_t *dev) } static uint8_t -aha154x_eeprom(x54x_t *dev, uint8_t cmd, uint8_t arg, uint8_t len, uint8_t off, uint8_t *bufp) +aha154x_eeprom(x54x_t *dev, uint8_t cmd, UNUSED(uint8_t arg), uint8_t len, uint8_t off, uint8_t *bufp) { uint8_t r = 0xff; int c; @@ -217,39 +217,42 @@ aha154x_mmap(x54x_t *dev, uint8_t cmd) /* Enable the mapper, so, set ROM2 active. */ dev->bios.rom = dev->rom2; break; + + default: + break; } return 0; } static uint8_t -aha_get_host_id(void *p) +aha_get_host_id(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; return dev->nvr[0] & 0x07; } static uint8_t -aha_get_irq(void *p) +aha_get_irq(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; return (dev->nvr[1] & 0x07) + 9; } static uint8_t -aha_get_dma(void *p) +aha_get_dma(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; return (dev->nvr[1] >> 4) & 0x07; } static uint8_t -aha_cmd_is_fast(void *p) +aha_cmd_is_fast(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; if (dev->Command == CMD_BIOS_SCSI) return 1; @@ -258,9 +261,9 @@ aha_cmd_is_fast(void *p) } static uint8_t -aha_fast_cmds(void *p, uint8_t cmd) +aha_fast_cmds(void *priv, uint8_t cmd) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; if (cmd == CMD_BIOS_SCSI) { dev->BIOSMailboxReq++; @@ -271,9 +274,9 @@ aha_fast_cmds(void *p, uint8_t cmd) } static uint8_t -aha_param_len(void *p) +aha_param_len(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; switch (dev->Command) { case CMD_BIOS_MBINIT: @@ -307,9 +310,9 @@ aha_param_len(void *p) } static uint8_t -aha_cmds(void *p) +aha_cmds(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; MailboxInit_t *mbi; if (!dev->CmdParamLeft) { @@ -351,7 +354,9 @@ aha_cmds(void *p) * and expects a 0x04 back in the INTR * register. --FvK */ - /* dev->Interrupt = aha154x_shram(dev,val); */ +#if 0 + dev->Interrupt = aha154x_shram(dev,val); +#endif dev->Interrupt = aha154x_shram(dev, dev->CmdBuf[0]); break; @@ -451,9 +456,9 @@ aha_cmds(void *p) } static void -aha_setup_data(void *p) +aha_setup_data(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; ReplyInquireSetupInformation *ReplyISI; aha_setup_t *aha_setup; @@ -486,9 +491,9 @@ aha_do_bios_mail(x54x_t *dev) } static void -aha_callback(void *p) +aha_callback(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; if (dev->BIOSMailboxInit && dev->BIOSMailboxReq) aha_do_bios_mail(dev); @@ -551,6 +556,9 @@ aha_mca_write(int port, uint8_t val, void *priv) case 0x10: /* [1]=xx01 0xxx */ dev->rom_addr = 0xC8000; break; + + default: + break; } else { /* Disabled. */ @@ -696,6 +704,8 @@ aha_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv) break; #endif + default: + break; } } @@ -997,6 +1007,9 @@ aha_init(const device_t *info) case 0x0334: dev->bios_path = "roms/scsi/adaptec/aha1540b320_334.bin"; break; + + default: + break; } dev->fw_rev = "A005"; /* The 3.2 microcode says A012. */ /* This is configurable from the configuration for the 154xB, the rest of the controllers read it from the EEPROM. */ @@ -1082,6 +1095,9 @@ aha_init(const device_t *info) mca_add(aha_mca_read, aha_mca_write, aha_mca_feedb, NULL, dev); dev->ha_bps = 5000000.0; /* normal SCSI */ break; + + default: + break; } /* Initialize ROM BIOS if needed. */ @@ -1106,7 +1122,7 @@ aha_init(const device_t *info) } } - return (dev); + return dev; } // clang-format off diff --git a/src/scsi/scsi_buslogic.c b/src/scsi/scsi_buslogic.c index 5616042ec..f460b6491 100644 --- a/src/scsi/scsi_buslogic.c +++ b/src/scsi/scsi_buslogic.c @@ -53,20 +53,20 @@ * configuration parameters. */ #pragma pack(push, 1) -typedef struct { - uint8_t aInternalSignature[2]; - uint8_t cbInformation; - uint8_t aHostAdaptertype[6]; - uint8_t uReserved1; - uint8_t fFloppyEnabled : 1, - fFloppySecondary : 1, - fLevelSensitiveInterrupt : 1, - uReserved2 : 2, - uSystemRAMAreForBIOS : 3; - uint8_t uDMAChannel : 7, - fDMAAutoConfiguration : 1, - uIrqChannel : 7, - fIrqAutoConfiguration : 1; +typedef struct AutoSCSIRam_t { + uint8_t aInternalSignature[2]; + uint8_t cbInformation; + uint8_t aHostAdaptertype[6]; + uint8_t uReserved1; + uint8_t fFloppyEnabled : 1; + uint8_t fFloppySecondary : 1; + uint8_t fLevelSensitiveInterrupt : 1; + uint8_t uReserved2 : 2; + uint8_t uSystemRAMAreForBIOS : 3; + uint8_t uDMAChannel : 7; + uint8_t fDMAAutoConfiguration : 1; + uint8_t uIrqChannel : 7; + uint8_t fIrqAutoConfiguration : 1; uint8_t uDMATransferRate; uint8_t uSCSIId; uint8_t uSCSIConfiguration; @@ -142,46 +142,45 @@ typedef struct { /* Structure for the INQUIRE_EXTENDED_SETUP_INFORMATION. */ #pragma pack(push, 1) -typedef struct { +typedef struct ReplyInquireExtendedSetupInformation_t { uint8_t uBusType; uint8_t uBiosAddress; uint16_t u16ScatterGatherLimit; uint8_t cMailbox; uint32_t uMailboxAddressBase; - uint8_t uReserved1 : 2, - fFastEISA : 1, - uReserved2 : 3, - fLevelSensitiveInterrupt : 1, - uReserved3 : 1; + uint8_t uReserved1 : 2; + uint8_t fFastEISA : 1; + uint8_t uReserved2 : 3; + uint8_t fLevelSensitiveInterrupt : 1; + uint8_t uReserved3 : 1; uint8_t aFirmwareRevision[3]; - uint8_t fHostWideSCSI : 1, - fHostDifferentialSCSI : 1, - fHostSupportsSCAM : 1, - fHostUltraSCSI : 1, - fHostSmartTermination : 1, - uReserved4 : 3; + uint8_t fHostWideSCSI : 1; + uint8_t fHostDifferentialSCSI : 1; + uint8_t fHostSupportsSCAM : 1; + uint8_t fHostUltraSCSI : 1; + uint8_t fHostSmartTermination : 1; + uint8_t uReserved4 : 3; } ReplyInquireExtendedSetupInformation; #pragma pack(pop) /* Structure for the INQUIRE_PCI_HOST_ADAPTER_INFORMATION reply. */ #pragma pack(push, 1) -typedef struct { +typedef struct BuslogicPCIInformation_t { uint8_t IsaIOPort; uint8_t IRQ; - uint8_t LowByteTerminated : 1, - HighByteTerminated : 1, - uReserved : 2, /* Reserved. */ - JP1 : 1, /* Whatever that means. */ - JP2 : 1, /* Whatever that means. */ - JP3 : 1, /* Whatever that means. */ - InformationIsValid : 1; - uint8_t uReserved2; /* Reserved. */ + uint8_t LowByteTerminated : 1; + uint8_t HighByteTerminated : 1; + uint8_t uReserved : 2; /* Reserved. */ + uint8_t JP1 : 1; /* Whatever that means. */ + uint8_t JP2 : 1; /* Whatever that means. */ + uint8_t JP3 : 1; /* Whatever that means. */ + uint8_t InformationIsValid : 1; + uint8_t uReserved2; /* Reserved. */ } BuslogicPCIInformation_t; #pragma pack(pop) #pragma pack(push, 1) -typedef struct -{ +typedef struct ESCMD_t { /** Data length. */ uint32_t DataLength; /** Data pointer. */ @@ -204,14 +203,14 @@ typedef struct #pragma pack(pop) #pragma pack(push, 1) -typedef struct { +typedef struct MailboxInitExtended_t { uint8_t Count; uint32_t Address; } MailboxInitExtended_t; #pragma pack(pop) #pragma pack(push, 1) -typedef struct { +typedef struct buslogic_data_t { rom_t bios; int ExtendedLUNCCBFormat; int fAggressiveRoundRobinMode; @@ -220,11 +219,11 @@ typedef struct { int MMIOBase; int chip; int has_bios; - uint32_t bios_addr, - bios_size, - bios_mask; - uint8_t AutoSCSIROM[32768]; - uint8_t SCAMData[65536]; + uint32_t bios_addr; + uint32_t bios_size; + uint32_t bios_mask; + uint8_t AutoSCSIROM[32768]; + uint8_t SCAMData[65536]; } buslogic_data_t; #pragma pack(pop) @@ -325,6 +324,9 @@ BuslogicAutoSCSIRamSetDefaults(x54x_t *dev, uint8_t safe) case CHIP_BUSLOGIC_PCI_958D_1995_12_30: memcpy(&(HALR->structured.autoSCSIData.aHostAdaptertype[1]), "958D", 4); break; + + default: + break; } HALR->structured.autoSCSIData.fLevelSensitiveInterrupt = (bl->chip == CHIP_BUSLOGIC_PCI_958D_1995_12_30) ? 1 : 0; @@ -410,14 +412,14 @@ BuslogicInitializeAutoSCSIRam(x54x_t *dev) buslogic_data_t *bl = (buslogic_data_t *) dev->ven_data; HALocalRAM *HALR = &bl->LocalRAM; - FILE *f; + FILE *fp; - f = nvr_fopen(BuslogicGetNVRFileName(bl), "rb"); - if (f) { - if (fread(&(bl->LocalRAM.structured.autoSCSIData), 1, 64, f) != 64) + fp = nvr_fopen(BuslogicGetNVRFileName(bl), "rb"); + if (fp) { + if (fread(&(bl->LocalRAM.structured.autoSCSIData), 1, 64, fp) != 64) fatal("BuslogicInitializeAutoSCSIRam(): Error reading data\n"); - fclose(f); - f = NULL; + fclose(fp); + fp = NULL; if (bl->chip == CHIP_BUSLOGIC_PCI_958D_1995_12_30) { x54x_io_remove(dev, dev->Base, 4); switch (HALR->structured.autoSCSIData.uHostAdapterIoPortAddress) { @@ -439,9 +441,9 @@ BuslogicInitializeAutoSCSIRam(x54x_t *dev) } static void -buslogic_cmd_phase1(void *p) +buslogic_cmd_phase1(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; if ((dev->CmdParam == 2) && (dev->Command == 0x90)) { dev->CmdParamLeft = dev->CmdBuf[1]; @@ -463,9 +465,9 @@ buslogic_cmd_phase1(void *p) } static uint8_t -buslogic_get_host_id(void *p) +buslogic_get_host_id(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; buslogic_data_t *bl = (buslogic_data_t *) dev->ven_data; HALocalRAM *HALR = &bl->LocalRAM; @@ -477,9 +479,9 @@ buslogic_get_host_id(void *p) } static uint8_t -buslogic_get_irq(void *p) +buslogic_get_irq(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; buslogic_data_t *bl = (buslogic_data_t *) dev->ven_data; uint8_t bl_irq[7] = { 0, 9, 10, 11, 12, 14, 15 }; @@ -493,9 +495,9 @@ buslogic_get_irq(void *p) } static uint8_t -buslogic_get_dma(void *p) +buslogic_get_dma(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; buslogic_data_t *bl = (buslogic_data_t *) dev->ven_data; uint8_t bl_dma[4] = { 0, 5, 6, 7 }; @@ -511,9 +513,9 @@ buslogic_get_dma(void *p) } static uint8_t -buslogic_param_len(void *p) +buslogic_param_len(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; buslogic_data_t *bl = (buslogic_data_t *) dev->ven_data; switch (dev->Command) { @@ -577,10 +579,10 @@ BuslogicSCSIBIOSDMATransfer(x54x_t *dev, ESCMD *ESCSICmd, uint8_t TargetID, int if (dir && ((ESCSICmd->DataDirection == CCB_DATA_XFER_OUT) || (ESCSICmd->DataDirection == 0x00))) { buslogic_log("BusLogic BIOS DMA: Reading %i bytes from %08X\n", TransferLength, Address); - dma_bm_read(Address, (uint8_t *) sd->sc->temp_buffer, TransferLength, transfer_size); + dma_bm_read(Address, sd->sc->temp_buffer, TransferLength, transfer_size); } else if (!dir && ((ESCSICmd->DataDirection == CCB_DATA_XFER_IN) || (ESCSICmd->DataDirection == 0x00))) { buslogic_log("BusLogic BIOS DMA: Writing %i bytes at %08X\n", TransferLength, Address); - dma_bm_write(Address, (uint8_t *) sd->sc->temp_buffer, TransferLength, transfer_size); + dma_bm_write(Address, sd->sc->temp_buffer, TransferLength, transfer_size); } } } @@ -666,9 +668,9 @@ BuslogicSCSIBIOSRequestSetup(x54x_t *dev, uint8_t *CmdBuf, uint8_t *DataInBuf, u } static uint8_t -buslogic_cmds(void *p) +buslogic_cmds(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; buslogic_data_t *bl = (buslogic_data_t *) dev->ven_data; HALocalRAM *HALR = &bl->LocalRAM; @@ -827,6 +829,9 @@ buslogic_cmds(void *p) case CHIP_BUSLOGIC_PCI_958D_1995_12_30: ReplyIESI->uBusType = 'E'; /* PCI style */ break; + + default: + break; } ReplyIESI->uBiosAddress = 0xd8; ReplyIESI->u16ScatterGatherLimit = 8192; @@ -1012,9 +1017,9 @@ buslogic_cmds(void *p) } static void -buslogic_setup_data(void *p) +buslogic_setup_data(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; ReplyInquireSetupInformation *ReplyISI; buslogic_setup_t *bl_setup; buslogic_data_t *bl = (buslogic_data_t *) dev->ven_data; @@ -1048,13 +1053,16 @@ buslogic_setup_data(void *p) case CHIP_BUSLOGIC_PCI_958D_1995_12_30: bl_setup->uHostBusType = 'F'; break; + + default: + break; } } static uint8_t -buslogic_is_aggressive_mode(void *p) +buslogic_is_aggressive_mode(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; buslogic_data_t *bl = (buslogic_data_t *) dev->ven_data; buslogic_log("Buslogic: Aggressive mode = %d\n", bl->fAggressiveRoundRobinMode); @@ -1063,9 +1071,9 @@ buslogic_is_aggressive_mode(void *p) } static uint8_t -buslogic_interrupt_type(void *p) +buslogic_interrupt_type(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; buslogic_data_t *bl = (buslogic_data_t *) dev->ven_data; if ((bl->chip == CHIP_BUSLOGIC_ISA_542B_1991_12_14) || (bl->chip == CHIP_BUSLOGIC_ISA_545S_1992_10_05) || (bl->chip == CHIP_BUSLOGIC_ISA_542BH_1993_05_23) || (bl->chip == CHIP_BUSLOGIC_VLB_445S_1993_11_16) || (bl->chip == CHIP_BUSLOGIC_MCA_640A_1993_05_23)) @@ -1075,9 +1083,9 @@ buslogic_interrupt_type(void *p) } static void -buslogic_reset(void *p) +buslogic_reset(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; buslogic_data_t *bl = (buslogic_data_t *) dev->ven_data; bl->ExtendedLUNCCBFormat = 0; @@ -1108,9 +1116,9 @@ BuslogicBIOSUpdate(buslogic_data_t *bl) } static uint8_t -BuslogicPCIRead(int func, int addr, void *p) +BuslogicPCIRead(UNUSED(int func), int addr, void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; #ifdef ENABLE_BUSLOGIC_LOG buslogic_data_t *bl = (buslogic_data_t *) dev->ven_data; #endif @@ -1175,28 +1183,28 @@ BuslogicPCIRead(int func, int addr, void *p) case 0x31: /* PCI_ROMBAR 15:11 */ buslogic_log("BT-958D: BIOS BAR 01 = %02X\n", (buslogic_pci_bar[2].addr_regs[1] & bl->bios_mask)); return buslogic_pci_bar[2].addr_regs[1]; - break; case 0x32: /* PCI_ROMBAR 23:16 */ buslogic_log("BT-958D: BIOS BAR 02 = %02X\n", buslogic_pci_bar[2].addr_regs[2]); return buslogic_pci_bar[2].addr_regs[2]; - break; case 0x33: /* PCI_ROMBAR 31:24 */ buslogic_log("BT-958D: BIOS BAR 03 = %02X\n", buslogic_pci_bar[2].addr_regs[3]); return buslogic_pci_bar[2].addr_regs[3]; - break; case 0x3C: return dev->Irq; case 0x3D: return PCI_INTA; + + default: + break; } return 0; } static void -BuslogicPCIWrite(int func, int addr, uint8_t val, void *p) +BuslogicPCIWrite(UNUSED(int func), int addr, uint8_t val, void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; buslogic_data_t *bl = (buslogic_data_t *) dev->ven_data; uint8_t valxor; @@ -1224,7 +1232,7 @@ BuslogicPCIWrite(int func, int addr, uint8_t val, void *p) case 0x10: val &= 0xe0; val |= 1; - /*FALLTHROUGH*/ + [[fallthrough]]; case 0x11: case 0x12: @@ -1248,7 +1256,7 @@ BuslogicPCIWrite(int func, int addr, uint8_t val, void *p) case 0x14: val &= 0xe0; - /*FALLTHROUGH*/ + [[fallthrough]]; case 0x15: case 0x16: @@ -1259,7 +1267,9 @@ BuslogicPCIWrite(int func, int addr, uint8_t val, void *p) /* Then let's set the PCI regs. */ buslogic_pci_bar[1].addr_regs[addr & 3] = val; /* Then let's calculate the new I/O base. */ - // bl->MMIOBase = buslogic_pci_bar[1].addr & 0xffffffe0; +#if 0 + bl->MMIOBase = buslogic_pci_bar[1].addr & 0xffffffe0; +#endif /* Give it a 4 kB alignment as that's this emulator's granularity. */ buslogic_pci_bar[1].addr &= 0xffffc000; bl->MMIOBase = buslogic_pci_bar[1].addr & 0xffffc000; @@ -1292,6 +1302,9 @@ BuslogicPCIWrite(int func, int addr, uint8_t val, void *p) } else dev->Irq = 0; return; + + default: + break; } } @@ -1386,6 +1399,9 @@ buslogic_mca_write(int port, uint8_t val, void *priv) case 0x20: /* [0]=001x xxxx */ bl->bios_addr = 0xC4000; break; + + default: + break; } else { /* Disabled. */ @@ -1497,9 +1513,9 @@ buslogic_mca_feedb(void *priv) } void -BuslogicDeviceReset(void *p) +BuslogicDeviceReset(void *priv) { - x54x_t *dev = (x54x_t *) p; + x54x_t *dev = (x54x_t *) priv; buslogic_data_t *bl = (buslogic_data_t *) dev->ven_data; x54x_device_reset(dev); @@ -1684,6 +1700,9 @@ buslogic_init(const device_t *info) dev->ha_bps = 20000000.0; /* ultra SCSI */ dev->max_id = 15; /* wide SCSI */ break; + + default: + break; } if ((dev->Base != 0) && !(dev->card_bus & DEVICE_MCA) && !(dev->card_bus & DEVICE_PCI)) { diff --git a/src/scsi/scsi_cdrom.c b/src/scsi/scsi_cdrom.c index d100902d2..5d16f279d 100644 --- a/src/scsi/scsi_cdrom.c +++ b/src/scsi/scsi_cdrom.c @@ -42,8 +42,7 @@ #include <86box/version.h> #pragma pack(push, 1) -typedef struct -{ +typedef struct gesn_cdb_t { uint8_t opcode; uint8_t polled; uint8_t reserved2[2]; @@ -53,8 +52,7 @@ typedef struct uint8_t control; } gesn_cdb_t; -typedef struct -{ +typedef struct gesn_event_header_t { uint16_t len; uint8_t notification_class; uint8_t supported_events; @@ -565,6 +563,9 @@ scsi_cdrom_atapi_phase_to_scsi(scsi_cdrom_t *dev) return 1; case 3: return 7; + + default: + break; } } else { if ((dev->phase & 3) == 3) @@ -577,9 +578,9 @@ scsi_cdrom_atapi_phase_to_scsi(scsi_cdrom_t *dev) } static uint32_t -scsi_cdrom_get_channel(void *p, int channel) +scsi_cdrom_get_channel(void *priv, int channel) { - scsi_cdrom_t *dev = (scsi_cdrom_t *) p; + scsi_cdrom_t *dev = (scsi_cdrom_t *) priv; if (!dev) return channel + 1; @@ -591,9 +592,9 @@ scsi_cdrom_get_channel(void *p, int channel) } static uint32_t -scsi_cdrom_get_volume(void *p, int channel) +scsi_cdrom_get_volume(void *priv, int channel) { - scsi_cdrom_t *dev = (scsi_cdrom_t *) p; + scsi_cdrom_t *dev = (scsi_cdrom_t *) priv; if (!dev) return 255; @@ -682,7 +683,7 @@ scsi_cdrom_drive_status_load(scsi_cdrom_t *dev) } static uint8_t -scsi_cdrom_drive_status_read(scsi_cdrom_t *dev, uint8_t page_control, uint8_t page, uint8_t pos) +scsi_cdrom_drive_status_read(scsi_cdrom_t *dev, UNUSED(uint8_t page_control), uint8_t page, uint8_t pos) { return dev->ms_drive_status_pages_saved.pages[page][pos]; } @@ -735,12 +736,12 @@ scsi_cdrom_mode_sense_read(scsi_cdrom_t *dev, uint8_t page_control, uint8_t page case 0: case 3: return dev->ms_pages_saved_sony.pages[page][pos]; - break; case 1: return scsi_cdrom_mode_sense_pages_changeable_sony.pages[page][pos]; - break; case 2: return scsi_cdrom_mode_sense_pages_default_sony_scsi.pages[page][pos]; + + default: break; } } else { @@ -748,16 +749,17 @@ scsi_cdrom_mode_sense_read(scsi_cdrom_t *dev, uint8_t page_control, uint8_t page case 0: case 3: return dev->ms_pages_saved.pages[page][pos]; - break; case 1: return scsi_cdrom_mode_sense_pages_changeable.pages[page][pos]; - break; case 2: if (dev->drv->bus_type == CDROM_BUS_SCSI) return scsi_cdrom_mode_sense_pages_default_scsi.pages[page][pos]; else return scsi_cdrom_mode_sense_pages_default.pages[page][pos]; + + default: break; + } } @@ -881,7 +883,7 @@ scsi_cdrom_update_request_length(scsi_cdrom_t *dev, int len, int block_len) break; } } - /* FALLTHROUGH */ + [[fallthrough]]; default: dev->packet_len = len; @@ -957,7 +959,7 @@ scsi_cdrom_command_common(scsi_cdrom_t *dev) scsi_cdrom_log("CD-ROM %i: Seek period: %" PRIu64 " us\n", dev->id, (uint64_t) period); dev->callback += period; - /*FALLTHROUGH*/ + [[fallthrough]]; case 0x25: case 0x42: case 0x43: @@ -1116,7 +1118,7 @@ scsi_cdrom_data_command_finish(scsi_cdrom_t *dev, int len, int block_len, int al } static void -scsi_cdrom_sense_clear(scsi_cdrom_t *dev, int command) +scsi_cdrom_sense_clear(scsi_cdrom_t *dev, UNUSED(int command)) { scsi_cdrom_sense_key = scsi_cdrom_asc = scsi_cdrom_ascq = 0; } @@ -1495,9 +1497,9 @@ scsi_cdrom_read_dvd_structure(scsi_cdrom_t *dev, int format, const uint8_t *pack } static void -scsi_cdrom_insert(void *p) +scsi_cdrom_insert(void *priv) { - scsi_cdrom_t *dev = (scsi_cdrom_t *) p; + scsi_cdrom_t *dev = (scsi_cdrom_t *) priv; if (!dev) return; @@ -1934,7 +1936,7 @@ begin: /* IMPORTANT: Convert the command to new read CD for pass through purposes. */ dev->current_cdb[0] = GPCMD_READ_CD; - /*FALLTHROUGH*/ + [[fallthrough]]; case GPCMD_READ_6: case GPCMD_READ_10: @@ -2012,6 +2014,9 @@ begin: return; } break; + + default: + break; } if (!dev->sector_len) { @@ -2549,6 +2554,9 @@ begin: pos = (cdb[2] << 24) | (cdb[3] << 16) | (cdb[4] << 8) | cdb[5]; len = (cdb[6] << 24) | (cdb[7] << 16) | (cdb[8] << 8) | cdb[9]; break; + + default: + break; } if ((dev->drv->host_drive < 1) || (dev->drv->cd_status <= CD_STATUS_DATA_ONLY)) { @@ -2767,6 +2775,9 @@ begin: case 3: /* Load the disc (close tray). */ cdrom_reload(dev->id); break; + + default: + break; } scsi_cdrom_command_complete(dev); @@ -3105,6 +3116,9 @@ atapi_out: case GPCMD_SEEK_10: pos = (cdb[2] << 24) | (cdb[3] << 16) | (cdb[4] << 8) | cdb[5]; break; + + default: + break; } dev->drv->seek_diff = ABS((int) (pos - dev->drv->seek_pos)); if (cdb[0] == GPCMD_SEEK_10) { @@ -3439,6 +3453,9 @@ scsi_cdrom_phase_data_out(scsi_common_t *sc) } } break; + + default: + break; } scsi_cdrom_command_stop((scsi_common_t *) dev); @@ -3446,9 +3463,9 @@ scsi_cdrom_phase_data_out(scsi_common_t *sc) } static void -scsi_cdrom_close(void *p) +scsi_cdrom_close(void *priv) { - scsi_cdrom_t *dev = (scsi_cdrom_t *) p; + scsi_cdrom_t *dev = (scsi_cdrom_t *) priv; if (dev) free(dev); diff --git a/src/scsi/scsi_device.c b/src/scsi/scsi_device.c index 42725c91b..4fce9f989 100644 --- a/src/scsi/scsi_device.c +++ b/src/scsi/scsi_device.c @@ -25,6 +25,7 @@ #include <86box/hdd.h> #include <86box/scsi.h> #include <86box/scsi_device.h> +#include <86box/plat_unused.h> scsi_device_t scsi_devices[SCSI_BUS_MAX][SCSI_ID_MAX]; @@ -97,7 +98,7 @@ scsi_device_valid(scsi_device_t *dev) } int -scsi_device_cdb_length(scsi_device_t *dev) +scsi_device_cdb_length(UNUSED(scsi_device_t *dev)) { /* Right now, it's 12 for all devices. */ return 12; diff --git a/src/scsi/scsi_disk.c b/src/scsi/scsi_disk.c index f504985ef..582a46c48 100644 --- a/src/scsi/scsi_disk.c +++ b/src/scsi/scsi_disk.c @@ -182,9 +182,9 @@ scsi_disk_mode_sense_read(scsi_disk_t *dev, uint8_t page_control, uint8_t page, case 2: case 3: switch (pos) { + default: case 0: case 1: - default: return scsi_disk_mode_sense_pages_default.pages[page][pos]; case 2: case 6: @@ -201,6 +201,8 @@ scsi_disk_mode_sense_read(scsi_disk_t *dev, uint8_t page_control, uint8_t page, case 5: return dev->drv->hpc & 0xff; } + + default: break; } else if (page == GPMODE_FORMAT_DEVICE_PAGE) @@ -210,9 +212,9 @@ scsi_disk_mode_sense_read(scsi_disk_t *dev, uint8_t page_control, uint8_t page, case 2: case 3: switch (pos) { + default: case 0: case 1: - default: return scsi_disk_mode_sense_pages_default.pages[page][pos]; /* Actual sectors + the 1 "alternate sector" we report. */ case 10: @@ -220,6 +222,8 @@ scsi_disk_mode_sense_read(scsi_disk_t *dev, uint8_t page_control, uint8_t page, case 11: return (dev->drv->spt + 1) & 0xff; } + + default: break; } else @@ -229,6 +233,9 @@ scsi_disk_mode_sense_read(scsi_disk_t *dev, uint8_t page_control, uint8_t page, return dev->ms_pages_saved.pages[page][pos]; case 2: return scsi_disk_mode_sense_pages_default.pages[page][pos]; + + default: + break; } return 0; @@ -306,7 +313,7 @@ scsi_disk_command_write_dma(scsi_disk_t *dev) } static void -scsi_disk_data_command_finish(scsi_disk_t *dev, int len, int block_len, int alloc_len, int direction) +scsi_disk_data_command_finish(scsi_disk_t *dev, int len, UNUSED(int block_len), int alloc_len, int direction) { scsi_disk_log("SCSI HD %i: Finishing command (%02X): %i, %i, %i, %i, %i\n", dev->id, dev->current_cdb[0], len, block_len, alloc_len, direction, dev->request_length); @@ -325,7 +332,7 @@ scsi_disk_data_command_finish(scsi_disk_t *dev, int len, int block_len, int allo } static void -scsi_disk_sense_clear(scsi_disk_t *dev, int command) +scsi_disk_sense_clear(scsi_disk_t *dev, UNUSED(int command)) { scsi_disk_sense_key = scsi_disk_asc = scsi_disk_ascq = 0; } @@ -500,7 +507,7 @@ scsi_disk_request_sense_for_scsi(scsi_common_t *sc, uint8_t *buffer, uint8_t all } static void -scsi_disk_set_buf_len(scsi_disk_t *dev, int32_t *BufLen, int32_t *src_len) +scsi_disk_set_buf_len(UNUSED(scsi_disk_t *dev), int32_t *BufLen, int32_t *src_len) { if (*BufLen == -1) *BufLen = *src_len; @@ -590,7 +597,7 @@ scsi_disk_command(scsi_common_t *sc, uint8_t *cdb) scsi_disk_invalid_field(dev); return; } - /*FALLTHROUGH*/ + [[fallthrough]]; case GPCMD_SCSI_RESERVE: case GPCMD_SCSI_RELEASE: case GPCMD_TEST_UNIT_READY: @@ -661,6 +668,9 @@ scsi_disk_command(scsi_common_t *sc, uint8_t *cdb) dev->sector_len = (((uint32_t) cdb[6]) << 24) | (((uint32_t) cdb[7]) << 16) | (((uint32_t) cdb[8]) << 8) | ((uint32_t) cdb[9]); dev->sector_pos = (((uint32_t) cdb[2]) << 24) | (((uint32_t) cdb[3]) << 16) | (((uint32_t) cdb[4]) << 8) | ((uint32_t) cdb[5]); break; + + default: + break; } if ((dev->sector_pos > last_sector) /* || ((dev->sector_pos + dev->sector_len - 1) > last_sector)*/) { @@ -737,6 +747,9 @@ scsi_disk_command(scsi_common_t *sc, uint8_t *cdb) dev->sector_len = (((uint32_t) cdb[6]) << 24) | (((uint32_t) cdb[7]) << 16) | (((uint32_t) cdb[8]) << 8) | ((uint32_t) cdb[9]); dev->sector_pos = (((uint32_t) cdb[2]) << 24) | (((uint32_t) cdb[3]) << 16) | (((uint32_t) cdb[4]) << 8) | ((uint32_t) cdb[5]); break; + + default: + break; } if ((dev->sector_pos > last_sector) /* || @@ -1001,6 +1014,9 @@ atapi_out: case GPCMD_SEEK_10: pos = (cdb[2] << 24) | (cdb[3] << 16) | (cdb[4] << 8) | cdb[5]; break; + + default: + break; } scsi_disk_seek(dev, pos); @@ -1046,26 +1062,26 @@ scsi_disk_command_stop(scsi_common_t *sc) static uint8_t scsi_disk_phase_data_out(scsi_common_t *sc) { - scsi_disk_t *dev = (scsi_disk_t *) sc; - uint8_t scsi_bus = (dev->drv->scsi_id >> 4) & 0x0f; - uint8_t scsi_id = dev->drv->scsi_id & 0x0f; - int i; - int32_t *BufLen = &scsi_devices[scsi_bus][scsi_id].buffer_length; - uint32_t last_sector = hdd_image_get_last_sector(dev->id); - uint32_t c; - uint32_t h; - uint32_t s; - uint32_t last_to_write = 0; - uint16_t block_desc_len; - uint16_t pos; - uint16_t param_list_len; - uint8_t hdr_len; - uint8_t val; - uint8_t old_val; - uint8_t ch; - uint8_t error = 0; - uint8_t page; - uint8_t page_len; + scsi_disk_t *dev = (scsi_disk_t *) sc; + uint8_t scsi_bus = (dev->drv->scsi_id >> 4) & 0x0f; + uint8_t scsi_id = dev->drv->scsi_id & 0x0f; + int i; + const int32_t *BufLen = &scsi_devices[scsi_bus][scsi_id].buffer_length; + uint32_t last_sector = hdd_image_get_last_sector(dev->id); + uint32_t c; + uint32_t h; + uint32_t s; + uint32_t last_to_write = 0; + uint16_t block_desc_len; + uint16_t pos; + uint16_t param_list_len; + uint8_t hdr_len; + uint8_t val; + uint8_t old_val; + uint8_t ch; + uint8_t error = 0; + uint8_t page; + uint8_t page_len; if (!*BufLen) { scsi_disk_set_phase(dev, SCSI_PHASE_STATUS); diff --git a/src/scsi/scsi_ncr5380.c b/src/scsi/scsi_ncr5380.c index 2d21592c9..f4b4ed57c 100644 --- a/src/scsi/scsi_ncr5380.c +++ b/src/scsi/scsi_ncr5380.c @@ -93,9 +93,15 @@ #define STATUS_BUFFER_NOT_READY 0x04 #define STATUS_53C80_ACCESSIBLE 0x80 -typedef struct { - uint8_t icr, mode, tcr, data_wait; - uint8_t isr, output_data, target_id, tx_data; +typedef struct ncr_t { + uint8_t icr; + uint8_t mode; + uint8_t tcr; + uint8_t data_wait; + uint8_t isr; + uint8_t output_data; + uint8_t target_id; + uint8_t tx_data; uint8_t msglun; uint8_t command[20]; @@ -103,12 +109,19 @@ typedef struct { int msgout_pos; int is_msgout; - int dma_mode, cur_bus, bus_in, new_phase; - int state, clear_req, wait_data, wait_complete; - int command_pos, data_pos; + int dma_mode; + int cur_bus; + int bus_in; + int new_phase; + int state; + int clear_req; + int wait_data; + int wait_complete; + int command_pos; + int data_pos; } ncr_t; -typedef struct { +typedef struct t128_t { uint8_t ctrl; uint8_t status; uint8_t buffer[512]; @@ -121,14 +134,15 @@ typedef struct { int bios_enabled; } t128_t; -typedef struct { +typedef struct ncr5380_t { ncr_t ncr; t128_t t128; const char *name; uint8_t buffer[128]; - uint8_t int_ram[0x40], ext_ram[0x600]; + uint8_t int_ram[0x40]; + uint8_t ext_ram[0x600]; uint32_t rom_addr; uint16_t base; @@ -440,7 +454,9 @@ ncr_bus_update(void *priv, int bus) if (ncr->command_pos == cmd_len[(ncr->command[0] >> 5) & 7]) { if (ncr->is_msgout) { ncr->is_msgout = 0; - // ncr->command[1] = (ncr->command[1] & 0x1f) | (ncr->msglun << 5); +#if 0 + ncr->command[1] = (ncr->command[1] & 0x1f) | (ncr->msglun << 5); +#endif } /*Reset data position to default*/ @@ -565,6 +581,9 @@ ncr_bus_update(void *priv, int bus) SET_BUS_STATE(ncr, SCSI_PHASE_COMMAND); } break; + + default: + break; } ncr->bus_in = bus; @@ -823,7 +842,7 @@ ncr_read(uint16_t port, void *priv) ncr_log("NCR5380 read(%04x)=%02x\n", port & 7, ret); - return (ret); + return ret; } /* Memory-mapped I/O READ handler. */ @@ -899,8 +918,14 @@ memio_read(uint32_t addr, void *priv) case 0x3983: ret = 0xff; break; + + default: + break; } break; + + default: + break; } #if ENABLE_NCR5380_LOG @@ -976,8 +1001,14 @@ memio_write(uint32_t addr, uint8_t val, void *priv) ncr_dev->status_ctrl &= ~STATUS_BUFFER_NOT_READY; } break; + + default: + break; } break; + + default: + break; } } @@ -995,7 +1026,7 @@ t130b_read(uint32_t addr, void *priv) ret = ncr_dev->ext_ram[addr & 0x7f]; ncr_log("MEM: Reading %02X from %08X\n", ret, addr); - return (ret); + return ret; } /* Memory-mapped I/O WRITE handler for the Trantor T130B. */ @@ -1039,10 +1070,13 @@ t130b_in(uint16_t port, void *priv) case 0x0f: ret = ncr_read(port, ncr_dev); break; + + default: + break; } ncr_log("I/O: Reading %02X from %04X\n", ret, port); - return (ret); + return ret; } static void @@ -1075,6 +1109,9 @@ t130b_out(uint16_t port, uint8_t val, void *priv) case 0x0f: ncr_write(port, val, ncr_dev); break; + + default: + break; } } @@ -1325,6 +1362,9 @@ ncr_callback(void *priv) } ncr_dma_initiator_receive(ncr_dev, ncr, dev); break; + + default: + break; } ncr_bus_read(ncr_dev); @@ -1457,6 +1497,9 @@ rt1000b_mc_write(int port, uint8_t val, void *priv) case 0xe0: ncr_dev->rom_addr = 0xd8000; break; + + default: + break; } mem_mapping_set_addr(&ncr_dev->bios_rom.mapping, ncr_dev->rom_addr, 0x4000); @@ -1577,6 +1620,9 @@ ncr_init(const device_t *info) memio_write, NULL, NULL, ncr_dev->bios_rom.rom, MEM_MAPPING_EXTERNAL, ncr_dev); break; + + default: + break; } sprintf(temp, "%s: BIOS=%05X", ncr_dev->name, ncr_dev->rom_addr); diff --git a/src/scsi/scsi_ncr53c8xx.c b/src/scsi/scsi_ncr53c8xx.c index 482e098e3..9a00ac720 100644 --- a/src/scsi/scsi_ncr53c8xx.c +++ b/src/scsi/scsi_ncr53c8xx.c @@ -204,7 +204,7 @@ typedef enum { SCSI_STATE_WRITE_MESSAGE } scsi_state_t; -typedef struct { +typedef struct ncr53c8xx_t { char *nvr_path; uint8_t pci_slot; uint8_t chip, wide; @@ -291,9 +291,16 @@ typedef struct { uint32_t dbc; uint32_t dsp; uint32_t dsps; - uint32_t scratcha, scratchb, scratchc, scratchd; - uint32_t scratche, scratchf, scratchg, scratchh; - uint32_t scratchi, scratchj; + uint32_t scratcha; + uint32_t scratchb; + uint32_t scratchc; + uint32_t scratchd; + uint32_t scratche; + uint32_t scratchf; + uint32_t scratchg; + uint32_t scratchh; + uint32_t scratchi; + uint32_t scratchj; int last_level; void *hba_private; uint32_t buffer_pos; @@ -479,7 +486,7 @@ ncr53c8xx_write(ncr53c8xx_t *dev, uint32_t addr, uint8_t *buf, uint32_t len) } static __inline uint32_t -read_dword(ncr53c8xx_t *dev, uint32_t addr) +read_dword(UNUSED(ncr53c8xx_t *dev), uint32_t addr) { uint32_t buf; ncr53c8xx_log("Reading the next DWORD from memory (%08X)...\n", addr); @@ -578,7 +585,7 @@ ncr53c8xx_set_phase(ncr53c8xx_t *dev, int phase) } static void -ncr53c8xx_bad_phase(ncr53c8xx_t *dev, int out, int new_phase) +ncr53c8xx_bad_phase(ncr53c8xx_t *dev, UNUSED(int out), int new_phase) { /* Trigger a phase mismatch. */ ncr53c8xx_log("Phase mismatch interrupt\n"); @@ -603,7 +610,7 @@ ncr53c8xx_disconnect(ncr53c8xx_t *dev) } static void -ncr53c8xx_bad_selection(ncr53c8xx_t *dev, uint32_t id) +ncr53c8xx_bad_selection(ncr53c8xx_t *dev, UNUSED(uint32_t id)) { ncr53c8xx_log("Selected absent target %d\n", id); ncr53c8xx_script_scsi_interrupt(dev, 0, NCR_SIST1_STO); @@ -863,7 +870,7 @@ ncr53c8xx_skip_msgbytes(ncr53c8xx_t *dev, unsigned int n) } static void -ncr53c8xx_bad_message(ncr53c8xx_t *dev, uint8_t msg) +ncr53c8xx_bad_message(ncr53c8xx_t *dev, UNUSED(uint8_t msg)) { ncr53c8xx_log("Unimplemented message 0x%02x\n", msg); ncr53c8xx_set_phase(dev, PHASE_MI); @@ -1191,6 +1198,9 @@ again: if (insn & (1 << 10)) dev->carry = 0; break; + + default: + break; } } else { reg = ((insn >> 16) & 0x7f) | (insn & 0x80); @@ -1216,6 +1226,9 @@ again: else op1 = data8; break; + + default: + break; } switch (operator) { @@ -1252,6 +1265,9 @@ again: else dev->carry = op0 < op1; break; + + default: + break; } switch (opcode) { @@ -1262,6 +1278,9 @@ again: case 6: /* To SFBR */ dev->sfbr = op0; break; + + default: + break; } } break; @@ -1403,9 +1422,9 @@ ncr53c8xx_execute_script(ncr53c8xx_t *dev) } static void -ncr53c8xx_callback(void *p) +ncr53c8xx_callback(void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; if (!dev->sstop) { if (dev->waiting) @@ -1559,7 +1578,9 @@ ncr53c8xx_reg_writeb(ncr53c8xx_t *dev, uint32_t offset, uint8_t val) ncr53c8xx_log("Woken by SIGP\n"); dev->waiting = 0; dev->dsp = dev->dnad; - /* ncr53c8xx_execute_script(dev); */ +#if 0 + ncr53c8xx_execute_script(dev); +#endif } if ((val & NCR_ISTAT_SRST) && !(tmp & NCR_ISTAT_SRST)) { ncr53c8xx_soft_reset(dev); @@ -1978,6 +1999,9 @@ ncr53c8xx_reg_readb(ncr53c8xx_t *dev, uint32_t offset) CASE_GET_REG32_COND(scratchh, 0x74) CASE_GET_REG32_COND(scratchi, 0x78) CASE_GET_REG32_COND(scratchj, 0x7c) + + default: + break; } ncr53c8xx_log("readb 0x%x\n", offset); return 0; @@ -1987,16 +2011,17 @@ ncr53c8xx_reg_readb(ncr53c8xx_t *dev, uint32_t offset) } static uint8_t -ncr53c8xx_io_readb(uint16_t addr, void *p) +ncr53c8xx_io_readb(uint16_t addr, void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; + return ncr53c8xx_reg_readb(dev, addr & 0xff); } static uint16_t -ncr53c8xx_io_readw(uint16_t addr, void *p) +ncr53c8xx_io_readw(uint16_t addr, void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; uint16_t val; addr &= 0xff; @@ -2006,9 +2031,9 @@ ncr53c8xx_io_readw(uint16_t addr, void *p) } static uint32_t -ncr53c8xx_io_readl(uint16_t addr, void *p) +ncr53c8xx_io_readl(uint16_t addr, void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; uint32_t val; addr &= 0xff; @@ -2020,25 +2045,28 @@ ncr53c8xx_io_readl(uint16_t addr, void *p) } static void -ncr53c8xx_io_writeb(uint16_t addr, uint8_t val, void *p) +ncr53c8xx_io_writeb(uint16_t addr, uint8_t val, void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; + ncr53c8xx_reg_writeb(dev, addr & 0xff, val); } static void -ncr53c8xx_io_writew(uint16_t addr, uint16_t val, void *p) +ncr53c8xx_io_writew(uint16_t addr, uint16_t val, void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; + addr &= 0xff; ncr53c8xx_reg_writeb(dev, addr, val & 0xff); ncr53c8xx_reg_writeb(dev, addr + 1, (val >> 8) & 0xff); } static void -ncr53c8xx_io_writel(uint16_t addr, uint32_t val, void *p) +ncr53c8xx_io_writel(uint16_t addr, uint32_t val, void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; + addr &= 0xff; ncr53c8xx_reg_writeb(dev, addr, val & 0xff); ncr53c8xx_reg_writeb(dev, addr + 1, (val >> 8) & 0xff); @@ -2047,17 +2075,17 @@ ncr53c8xx_io_writel(uint16_t addr, uint32_t val, void *p) } static void -ncr53c8xx_mmio_writeb(uint32_t addr, uint8_t val, void *p) +ncr53c8xx_mmio_writeb(uint32_t addr, uint8_t val, void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; ncr53c8xx_reg_writeb(dev, addr & 0xff, val); } static void -ncr53c8xx_mmio_writew(uint32_t addr, uint16_t val, void *p) +ncr53c8xx_mmio_writew(uint32_t addr, uint16_t val, void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; addr &= 0xff; ncr53c8xx_reg_writeb(dev, addr, val & 0xff); @@ -2065,9 +2093,9 @@ ncr53c8xx_mmio_writew(uint32_t addr, uint16_t val, void *p) } static void -ncr53c8xx_mmio_writel(uint32_t addr, uint32_t val, void *p) +ncr53c8xx_mmio_writel(uint32_t addr, uint32_t val, void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; addr &= 0xff; ncr53c8xx_reg_writeb(dev, addr, val & 0xff); @@ -2077,17 +2105,17 @@ ncr53c8xx_mmio_writel(uint32_t addr, uint32_t val, void *p) } static uint8_t -ncr53c8xx_mmio_readb(uint32_t addr, void *p) +ncr53c8xx_mmio_readb(uint32_t addr, void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; return ncr53c8xx_reg_readb(dev, addr & 0xff); } static uint16_t -ncr53c8xx_mmio_readw(uint32_t addr, void *p) +ncr53c8xx_mmio_readw(uint32_t addr, void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; uint16_t val; addr &= 0xff; @@ -2097,9 +2125,9 @@ ncr53c8xx_mmio_readw(uint32_t addr, void *p) } static uint32_t -ncr53c8xx_mmio_readl(uint32_t addr, void *p) +ncr53c8xx_mmio_readl(uint32_t addr, void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; uint32_t val; addr &= 0xff; @@ -2112,57 +2140,57 @@ ncr53c8xx_mmio_readl(uint32_t addr, void *p) } static void -ncr53c8xx_ram_writeb(uint32_t addr, uint8_t val, void *p) +ncr53c8xx_ram_writeb(uint32_t addr, uint8_t val, void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; dev->ram[addr & 0x0fff] = val; } static void -ncr53c8xx_ram_writew(uint32_t addr, uint16_t val, void *p) +ncr53c8xx_ram_writew(uint32_t addr, uint16_t val, void *priv) { - ncr53c8xx_ram_writeb(addr, val & 0xff, p); - ncr53c8xx_ram_writeb(addr + 1, (val >> 8) & 0xff, p); + ncr53c8xx_ram_writeb(addr, val & 0xff, priv); + ncr53c8xx_ram_writeb(addr + 1, (val >> 8) & 0xff, priv); } static void -ncr53c8xx_ram_writel(uint32_t addr, uint32_t val, void *p) +ncr53c8xx_ram_writel(uint32_t addr, uint32_t val, void *priv) { - ncr53c8xx_ram_writeb(addr, val & 0xff, p); - ncr53c8xx_ram_writeb(addr + 1, (val >> 8) & 0xff, p); - ncr53c8xx_ram_writeb(addr + 2, (val >> 16) & 0xff, p); - ncr53c8xx_ram_writeb(addr + 3, (val >> 24) & 0xff, p); + ncr53c8xx_ram_writeb(addr, val & 0xff, priv); + ncr53c8xx_ram_writeb(addr + 1, (val >> 8) & 0xff, priv); + ncr53c8xx_ram_writeb(addr + 2, (val >> 16) & 0xff, priv); + ncr53c8xx_ram_writeb(addr + 3, (val >> 24) & 0xff, priv); } static uint8_t -ncr53c8xx_ram_readb(uint32_t addr, void *p) +ncr53c8xx_ram_readb(uint32_t addr, void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; return dev->ram[addr & 0x0fff]; } static uint16_t -ncr53c8xx_ram_readw(uint32_t addr, void *p) +ncr53c8xx_ram_readw(uint32_t addr, void *priv) { uint16_t val; - val = ncr53c8xx_ram_readb(addr, p); - val |= ncr53c8xx_ram_readb(addr + 1, p) << 8; + val = ncr53c8xx_ram_readb(addr, priv); + val |= ncr53c8xx_ram_readb(addr + 1, priv) << 8; return val; } static uint32_t -ncr53c8xx_ram_readl(uint32_t addr, void *p) +ncr53c8xx_ram_readl(uint32_t addr, void *priv) { uint32_t val; - val = ncr53c8xx_ram_readb(addr, p); - val |= ncr53c8xx_ram_readb(addr + 1, p) << 8; - val |= ncr53c8xx_ram_readb(addr + 2, p) << 16; - val |= ncr53c8xx_ram_readb(addr + 3, p) << 24; + val = ncr53c8xx_ram_readb(addr, priv); + val |= ncr53c8xx_ram_readb(addr + 1, priv) << 8; + val |= ncr53c8xx_ram_readb(addr + 2, priv) << 16; + val |= ncr53c8xx_ram_readb(addr + 3, priv) << 24; return val; } @@ -2246,9 +2274,9 @@ uint8_t ncr53c8xx_pci_regs[256]; bar_t ncr53c8xx_pci_bar[4]; static uint8_t -ncr53c8xx_pci_read(int func, int addr, void *p) +ncr53c8xx_pci_read(UNUSED(int func), int addr, void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; ncr53c8xx_log("NCR53c8xx: Reading register %02X\n", addr & 0xff); @@ -2341,15 +2369,18 @@ ncr53c8xx_pci_read(int func, int addr, void *p) return 0x11; case 0x3F: return 0x40; + + default: + break; } return 0; } static void -ncr53c8xx_pci_write(int func, int addr, uint8_t val, void *p) +ncr53c8xx_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv) { - ncr53c8xx_t *dev = (ncr53c8xx_t *) p; + ncr53c8xx_t *dev = (ncr53c8xx_t *) priv; uint8_t valxor; ncr53c8xx_log("NCR53c8xx: Write value %02X to register %02X\n", val, addr & 0xff); @@ -2479,6 +2510,9 @@ ncr53c8xx_pci_write(int func, int addr, uint8_t val, void *p) ncr53c8xx_pci_regs[addr] = val; dev->irq = val; return; + + default: + break; } } diff --git a/src/scsi/scsi_pcscsi.c b/src/scsi/scsi_pcscsi.c index c0244ed4f..f084133ad 100644 --- a/src/scsi/scsi_pcscsi.c +++ b/src/scsi/scsi_pcscsi.c @@ -149,7 +149,7 @@ #define SBAC_STATUS (1 << 24) #define SBAC_PABTEN (1 << 25) -typedef struct { +typedef struct esp_t { mem_mapping_t mmio_mapping; mem_mapping_t ram_mapping; char *nvr_path; @@ -188,10 +188,10 @@ typedef struct { int mca; uint16_t Base; - uint8_t HostID, DmaChannel; + uint8_t HostID; + uint8_t DmaChannel; - struct - { + struct { uint8_t mode; uint8_t status; int pos; @@ -952,9 +952,9 @@ esp_write_response(esp_t *dev) } static void -esp_callback(void *p) +esp_callback(void *priv) { - esp_t *dev = (esp_t *) p; + esp_t *dev = (esp_t *) priv; if (dev->dma_enabled || dev->do_cmd || ((dev->rregs[ESP_CMD] & CMD_CMD) == CMD_PAD)) { if ((dev->rregs[ESP_CMD] & CMD_CMD) == CMD_TI) { @@ -1029,7 +1029,7 @@ esp_reg_write(esp_t *dev, uint32_t saddr, uint32_t val) switch (saddr) { case ESP_TCHI: dev->tchi_written = 1; - /* fall through */ + [[fallthrough]]; case ESP_TCLO: case ESP_TCMID: esp_log("Transfer count regs %02x = %i\n", saddr, val); @@ -1134,6 +1134,9 @@ esp_reg_write(esp_t *dev, uint32_t saddr, uint32_t val) esp_log("ESP Disable Selection\n"); esp_raise_irq(dev); break; + + default: + break; } break; case ESP_WBUSID: @@ -1259,6 +1262,9 @@ esp_pci_dma_write(esp_t *dev, uint16_t saddr, uint32_t val) dev->dma_regs[DMA_STAT] &= ~(val & mask); } break; + + default: + break; } } @@ -1361,44 +1367,49 @@ esp_io_pci_write(esp_t *dev, uint32_t addr, uint32_t val, unsigned int size) } static void -esp_pci_io_writeb(uint16_t addr, uint8_t val, void *p) +esp_pci_io_writeb(uint16_t addr, uint8_t val, void *priv) { - esp_t *dev = (esp_t *) p; + esp_t *dev = (esp_t *) priv; + esp_io_pci_write(dev, addr, val, 1); } static void -esp_pci_io_writew(uint16_t addr, uint16_t val, void *p) +esp_pci_io_writew(uint16_t addr, uint16_t val, void *priv) { - esp_t *dev = (esp_t *) p; + esp_t *dev = (esp_t *) priv; + esp_io_pci_write(dev, addr, val, 2); } static void -esp_pci_io_writel(uint16_t addr, uint32_t val, void *p) +esp_pci_io_writel(uint16_t addr, uint32_t val, void *priv) { - esp_t *dev = (esp_t *) p; + esp_t *dev = (esp_t *) priv; esp_io_pci_write(dev, addr, val, 4); } static uint8_t -esp_pci_io_readb(uint16_t addr, void *p) +esp_pci_io_readb(uint16_t addr, void *priv) { - esp_t *dev = (esp_t *) p; + esp_t *dev = (esp_t *) priv; + return esp_io_pci_read(dev, addr, 1); } static uint16_t -esp_pci_io_readw(uint16_t addr, void *p) +esp_pci_io_readw(uint16_t addr, void *priv) { - esp_t *dev = (esp_t *) p; + esp_t *dev = (esp_t *) priv; + return esp_io_pci_read(dev, addr, 2); } static uint32_t -esp_pci_io_readl(uint16_t addr, void *p) +esp_pci_io_readl(uint16_t addr, void *priv) { - esp_t *dev = (esp_t *) p; + esp_t *dev = (esp_t *) priv; + return esp_io_pci_read(dev, addr, 4); } @@ -1549,6 +1560,9 @@ dc390_write_eeprom(esp_t *dev, int ena, int clk, int dat) esp_log("EEPROM Write enable command\n"); eeprom->wp = 0; break; + + default: + break; } } else { esp_log("EEPROM Read, write or erase word\n"); @@ -1622,9 +1636,9 @@ uint8_t esp_pci_regs[256]; bar_t esp_pci_bar[2]; static uint8_t -esp_pci_read(int func, int addr, void *p) +esp_pci_read(UNUSED(int func), int addr, void *priv) { - esp_t *dev = (esp_t *) p; + esp_t *dev = (esp_t *) priv; // esp_log("ESP PCI: Reading register %02X\n", addr & 0xff); @@ -1695,15 +1709,18 @@ esp_pci_read(int func, int addr, void *p) case 0x40 ... 0x4f: return esp_pci_regs[addr]; + + default: + break; } return 0; } static void -esp_pci_write(int func, int addr, uint8_t val, void *p) +esp_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv) { - esp_t *dev = (esp_t *) p; + esp_t *dev = (esp_t *) priv; uint8_t valxor; int eesk; int eedi; @@ -1799,11 +1816,14 @@ esp_pci_write(int func, int addr, uint8_t val, void *p) case 0x40 ... 0x4f: esp_pci_regs[addr] = val; return; + + default: + break; } } static void * -dc390_init(const device_t *info) +dc390_init(UNUSED(const device_t *info)) { esp_t *dev; @@ -1872,6 +1892,9 @@ ncr53c90_in(uint16_t port, void *priv) case 0x0c: ret = dev->dma_86c01.status; break; + + default: + break; } } @@ -1995,7 +2018,7 @@ ncr53c90_mca_feedb(void *priv) } static void * -ncr53c90_mca_init(const device_t *info) +ncr53c90_mca_init(UNUSED(const device_t *info)) { esp_t *dev; diff --git a/src/scsi/scsi_spock.c b/src/scsi/scsi_spock.c index cddf15740..17dabf4f3 100644 --- a/src/scsi/scsi_spock.c +++ b/src/scsi/scsi_spock.c @@ -286,9 +286,9 @@ spock_add_to_period(spock_t *scsi, int TransferLength) } static void -spock_write(uint16_t port, uint8_t val, void *p) +spock_write(uint16_t port, uint8_t val, void *priv) { - spock_t *scsi = (spock_t *) p; + spock_t *scsi = (spock_t *) priv; spock_log("spock_write: port=%04x val=%02x %04x:%04x\n", port, val, CS, cpu_state.pc); @@ -320,13 +320,16 @@ spock_write(uint16_t port, uint8_t val, void *p) scsi->basic_ctrl = val; spock_rethink_irqs(scsi); break; + + default: + break; } } static void -spock_writew(uint16_t port, uint16_t val, void *p) +spock_writew(uint16_t port, uint16_t val, void *priv) { - spock_t *scsi = (spock_t *) p; + spock_t *scsi = (spock_t *) priv; switch (port & 7) { case 0: /*Command Interface Register*/ @@ -339,15 +342,18 @@ spock_writew(uint16_t port, uint16_t val, void *p) scsi->cir_pending[3] = val >> 8; scsi->cir_status |= 2; break; + + default: + break; } spock_log("spock_writew: port=%04x val=%04x\n", port, val); } static uint8_t -spock_read(uint16_t port, void *p) +spock_read(uint16_t port, void *priv) { - spock_t *scsi = (spock_t *) p; + spock_t *scsi = (spock_t *) priv; uint8_t temp = 0xff; switch (port & 7) { @@ -378,6 +384,9 @@ spock_read(uint16_t port, void *p) temp |= STATUS_CMD_FULL; } break; + + default: + break; } spock_log("spock_read: port=%04x val=%02x %04x(%05x):%04x.\n", port, temp, CS, cs, cpu_state.pc); @@ -385,9 +394,9 @@ spock_read(uint16_t port, void *p) } static uint16_t -spock_readw(uint16_t port, void *p) +spock_readw(uint16_t port, void *priv) { - spock_t *scsi = (spock_t *) p; + spock_t *scsi = (spock_t *) priv; uint16_t temp = 0xffff; switch (port & 7) { @@ -397,6 +406,9 @@ spock_readw(uint16_t port, void *p) case 2: /*Command Interface Register*/ temp = scsi->cir_pending[2] | (scsi->cir_pending[3] << 8); break; + + default: + break; } spock_log("spock_readw: port=%04x val=%04x\n", port, temp); @@ -797,6 +809,9 @@ spock_execute_cmd(spock_t *scsi, scb_t *scb) scsi->scsi_state = SCSI_STATE_SELECT; scsi->scb_state = 2; return; + + default: + break; } break; @@ -843,6 +858,9 @@ spock_execute_cmd(spock_t *scsi, scb_t *scb) spock_log("Complete SCB ID = %d.\n", scsi->attention & 0x0f); } break; + + default: + break; } } while (scsi->scb_state != old_scb_state); } @@ -1000,6 +1018,9 @@ spock_callback(void *priv) case CMD_RESET: spock_process_imm_cmd(scsi); break; + + default: + break; } break; @@ -1024,6 +1045,9 @@ spock_callback(void *priv) scsi->irq_status = 0; spock_clear_irq(scsi, scsi->attention & 0x0f); break; + + default: + break; } } } @@ -1097,7 +1121,7 @@ spock_mca_reset(void *priv) } static void * -spock_init(const device_t *info) +spock_init(UNUSED(const device_t *info)) { spock_t *scsi = malloc(sizeof(spock_t)); memset(scsi, 0x00, sizeof(spock_t)); @@ -1117,6 +1141,9 @@ spock_init(const device_t *info) rom_init_interleaved(&scsi->bios_rom, SPOCK_U68_1990_ROM, SPOCK_U69_1990_ROM, 0xc8000, 0x8000, 0x7fff, 0x4000, MEM_MAPPING_EXTERNAL); break; + + default: + break; } mem_mapping_disable(&scsi->bios_rom.mapping); @@ -1142,9 +1169,9 @@ spock_init(const device_t *info) } static void -spock_close(void *p) +spock_close(void *priv) { - spock_t *scsi = (spock_t *) p; + spock_t *scsi = (spock_t *) priv; if (scsi) { free(scsi); diff --git a/src/scsi/scsi_x54x.c b/src/scsi/scsi_x54x.c index b379f322c..b6aee84a5 100644 --- a/src/scsi/scsi_x54x.c +++ b/src/scsi/scsi_x54x.c @@ -238,6 +238,9 @@ completion_code(uint8_t *sense) case ASC_MEDIUM_NOT_PRESENT: ret = 0xaa; break; + + default: + break; } return ret; @@ -483,6 +486,7 @@ x54x_bios_command(x54x_t *x54x, uint8_t max_id, BIOSCMD *cmd, int8_t islba) default: x54x_log("BIOS: Unimplemented command: %02X\n", cmd->command); + [[fallthrough]]; case 0x05: /* Format Track, invalid since SCSI has no tracks */ case 0x0a: /* ???? */ case 0x0b: /* ???? */ @@ -605,7 +609,9 @@ static void x54x_mbi(x54x_t *dev) { Req_t *req = &dev->Req; - // uint32_t CCBPointer = req->CCBPointer; +#if 0 + uint32_t CCBPointer = req->CCBPointer; +#endif addr24_t CCBPointer; CCBU *CmdBlock = &(req->CmdBlock); uint8_t HostStatus = req->HostStatus; @@ -1035,7 +1041,7 @@ x54x_notify(x54x_t *dev) } static void -x54x_req_setup(x54x_t *dev, uint32_t CCBPointer, Mailbox32_t *Mailbox32) +x54x_req_setup(x54x_t *dev, uint32_t CCBPointer, UNUSED(Mailbox32_t *Mailbox32)) { Req_t *req = &dev->Req; uint8_t id; @@ -1161,9 +1167,11 @@ x54x_mbo_process(x54x_t *dev) } else if (!dev->MailboxIsBIOS && (mb32.u.out.ActionCode == MBO_ABORT)) { x54x_log("Abort Mailbox Command\n"); x54x_req_abort(dev, mb32.CCBPointer); - } /* else { +#if 0 + } else { x54x_log("Invalid action code: %02X\n", mb32.u.out.ActionCode); - } */ +#endif + } if ((mb32.u.out.ActionCode == MBO_START) || (!dev->MailboxIsBIOS && (mb32.u.out.ActionCode == MBO_ABORT))) { /* We got the mailbox, decrease the number of pending requests. */ @@ -1282,7 +1290,9 @@ x54x_cmd_callback(void *priv) period = (1000000.0 / dev->ha_bps) * ((double) dev->temp_period); timer_on(&dev->timer, dev->media_period + period + 10.0, 0); - // x54x_log("Temporary period: %lf us (%" PRIi64 " periods)\n", dev->timer.period, dev->temp_period); +#if 0 + x54x_log("Temporary period: %lf us (%" PRIi64 " periods)\n", dev->timer.period, dev->temp_period); +#endif } static uint8_t @@ -1292,8 +1302,8 @@ x54x_in(uint16_t port, void *priv) uint8_t ret; switch (port & 3) { - case 0: default: + case 0: ret = dev->Status; break; @@ -1329,8 +1339,8 @@ x54x_in(uint16_t port, void *priv) ret = dev->Geometry; else { switch (dev->Geometry) { - case 0: default: + case 0: ret = 'A'; break; case 1: diff --git a/src/sound/midi.c b/src/sound/midi.c index 50ddaaeb4..1a9c24657 100644 --- a/src/sound/midi.c +++ b/src/sound/midi.c @@ -408,7 +408,7 @@ midi_clear_buffer(void) } void -midi_in_handler(int set, void (*msg)(void *p, uint8_t *msg, uint32_t len), int (*sysex)(void *p, uint8_t *buffer, uint32_t len, int abort), void *p) +midi_in_handler(int set, void (*msg)(void *priv, uint8_t *msg, uint32_t len), int (*sysex)(void *priv, uint8_t *buffer, uint32_t len, int abort), void *priv) { midi_in_handler_t *temp = NULL; midi_in_handler_t *next; @@ -425,7 +425,7 @@ midi_in_handler(int set, void (*msg)(void *p, uint8_t *msg, uint32_t len), int ( memset(temp, 0, sizeof(midi_in_handler_t)); temp->msg = msg; temp->sysex = sysex; - temp->p = p; + temp->priv = priv; if (mih_last == NULL) mih_first = mih_last = temp; @@ -440,7 +440,7 @@ midi_in_handler(int set, void (*msg)(void *p, uint8_t *msg, uint32_t len), int ( if (temp == NULL) break; - if ((temp->msg == msg) && (temp->sysex == sysex) && (temp->p == p)) { + if ((temp->msg == msg) && (temp->sysex == sysex) && (temp->priv == priv)) { if (temp->prev != NULL) temp->prev->next = temp->next; @@ -500,7 +500,7 @@ midi_in_msg(uint8_t *msg, uint32_t len) break; if (temp->msg) - temp->msg(temp->p, msg, len); + temp->msg(temp->priv, msg, len); temp = temp->next; @@ -548,9 +548,9 @@ midi_do_sysex(void) ret = 0; if (temp->sysex) { if (temp->cnt == 0) - ret = temp->sysex(temp->p, temp->buf, 0, 0); + ret = temp->sysex(temp->priv, temp->buf, 0, 0); else - ret = temp->sysex(temp->p, temp->buf, temp->len, 0); + ret = temp->sysex(temp->priv, temp->buf, temp->len, 0); } /* If count is 0 and length is 0, then this is just a finishing diff --git a/src/sound/midi_fluidsynth.c b/src/sound/midi_fluidsynth.c index efe8159fc..08aefe16c 100644 --- a/src/sound/midi_fluidsynth.c +++ b/src/sound/midi_fluidsynth.c @@ -17,6 +17,7 @@ # include <86box/midi.h> # include <86box/thread.h> # include <86box/sound.h> +# include <86box/plat_unused.h> # define RENDER_RATE 100 # define BUFFER_SEGMENTS 10 @@ -151,7 +152,7 @@ fluidsynth_sysex(uint8_t *data, unsigned int len) } void * -fluidsynth_init(const device_t *info) +fluidsynth_init(UNUSED(const device_t *info)) { fluidsynth_t *data = &fsdev; midi_device_t *dev; @@ -165,7 +166,7 @@ fluidsynth_init(const device_t *info) data->synth = new_fluid_synth(data->settings); - const char *sound_font = (char *) device_get_config_string("sound_font"); + const char *sound_font = device_get_config_string("sound_font"); # ifdef __unix__ if (!sound_font || sound_font[0] == 0) sound_font = (access("/usr/share/sounds/sf2/FluidR3_GM.sf2", F_OK) == 0 ? "/usr/share/sounds/sf2/FluidR3_GM.sf2" : @@ -286,9 +287,9 @@ fluidsynth_init(const device_t *info) } void -fluidsynth_close(void *p) +fluidsynth_close(void *priv) { - if (!p) + if (!priv) return; fluidsynth_t *data = &fsdev; diff --git a/src/sound/midi_mt32.c b/src/sound/midi_mt32.c index 230914d72..91d85e438 100644 --- a/src/sound/midi_mt32.c +++ b/src/sound/midi_mt32.c @@ -110,7 +110,7 @@ static mt32emu_context context = NULL; static int roms_present[2] = { -1, -1 }; mt32emu_return_code -mt32_check(const char *func, mt32emu_return_code ret, mt32emu_return_code expected) +mt32_check(UNUSED(const char *func), mt32emu_return_code ret, mt32emu_return_code expected) { if (ret != expected) { return 0; @@ -165,13 +165,13 @@ static int16_t *buffer_int16 = NULL; static int midi_pos = 0; static mt32emu_report_handler_version -get_mt32_report_handler_version(mt32emu_report_handler_i i) +get_mt32_report_handler_version(UNUSED(mt32emu_report_handler_i i)) { return MT32EMU_REPORT_HANDLER_VERSION_0; } static void -display_mt32_message(void *instance_data, const char *message) +display_mt32_message(UNUSED(void *instance_data), const char *message) { int sz = 0; char *ui_msg = NULL; @@ -209,7 +209,7 @@ mt32_poll(void) } static void -mt32_thread(void *param) +mt32_thread(UNUSED(void *param)) { int buf_pos = 0; int bsize = buf_size / BUFFER_SEGMENTS; @@ -321,33 +321,33 @@ mt32emu_init(char *control_rom, char *pcm_rom) } void * -mt32_old_init(const device_t *info) +mt32_old_init(UNUSED(const device_t *info)) { return mt32emu_init(MT32_OLD_CTRL_ROM, MT32_OLD_PCM_ROM); } void * -mt32_new_init(const device_t *info) +mt32_new_init(UNUSED(const device_t *info)) { return mt32emu_init(MT32_NEW_CTRL_ROM, MT32_NEW_PCM_ROM); } void * -cm32l_init(const device_t *info) +cm32l_init(UNUSED(const device_t *info)) { return mt32emu_init(CM32L_CTRL_ROM, CM32L_PCM_ROM); } void * -cm32ln_init(const device_t *info) +cm32ln_init(UNUSED(const device_t *info)) { return mt32emu_init(CM32LN_CTRL_ROM, CM32LN_PCM_ROM); } void -mt32_close(void *p) +mt32_close(void *priv) { - if (!p) + if (!priv) return; mt32_on = 0; diff --git a/src/sound/midi_rtmidi.cpp b/src/sound/midi_rtmidi.cpp index 354c7f61b..72df8fd32 100644 --- a/src/sound/midi_rtmidi.cpp +++ b/src/sound/midi_rtmidi.cpp @@ -35,6 +35,7 @@ extern "C" { #include <86box/midi_rtmidi.h> #include <86box/ini.h> #include <86box/config.h> +#include <86box/plat_unused.h> // Disable c99-designator to avoid the warnings in rtmidi_*_device #ifdef __clang__ @@ -50,7 +51,7 @@ static int midi_out_id = 0, midi_in_id = 0; static const int midi_lengths[8] = { 3, 3, 3, 3, 2, 2, 3, 1 }; int -rtmidi_write(uint8_t val) +rtmidi_write(UNUSED(uint8_t val)) { return 0; } @@ -70,7 +71,7 @@ rtmidi_play_sysex(uint8_t *sysex, unsigned int len) } void * -rtmidi_output_init(const device_t *info) +rtmidi_output_init(UNUSED(const device_t *info)) { midi_device_t *dev = (midi_device_t *) malloc(sizeof(midi_device_t)); memset(dev, 0, sizeof(midi_device_t)); @@ -110,7 +111,7 @@ rtmidi_output_init(const device_t *info) } void -rtmidi_output_close(void *p) +rtmidi_output_close(UNUSED(void *priv)) { if (!midiout) return; @@ -144,7 +145,7 @@ rtmidi_out_get_dev_name(int num, char *s) } void -rtmidi_input_callback(double timeStamp, std::vector *message, void *userData) +rtmidi_input_callback(UNUSED(double timeStamp), std::vector *message, UNUSED(void *userData)) { if (message->front() == 0xF0) midi_in_sysex(message->data(), message->size()); @@ -153,7 +154,7 @@ rtmidi_input_callback(double timeStamp, std::vector *message, voi } void * -rtmidi_input_init(const device_t *info) +rtmidi_input_init(UNUSED(const device_t *info)) { midi_device_t *dev = (midi_device_t *) malloc(sizeof(midi_device_t)); memset(dev, 0, sizeof(midi_device_t)); @@ -198,7 +199,7 @@ rtmidi_input_init(const device_t *info) } void -rtmidi_input_close(void *p) +rtmidi_input_close(UNUSED(void *priv)) { midiin->cancelCallback(); midiin->closePort(); diff --git a/src/sound/openal.c b/src/sound/openal.c index 8fe101d64..802330909 100644 --- a/src/sound/openal.c +++ b/src/sound/openal.c @@ -33,6 +33,7 @@ #include <86box/86box.h> #include <86box/midi.h> #include <86box/sound.h> +#include <86box/plat_unused.h> #define FREQ SOUND_FREQ #define BUFLEN SOUNDBUFLEN @@ -58,7 +59,7 @@ al_set_midi(int freq, int buf_size) void closeal(void); ALvoid -alutInit(ALint *argc, ALbyte **argv) +alutInit(UNUSED(ALint *argc), UNUSED(ALbyte **argv)) { /* Open device */ Device = alcOpenDevice((ALCchar *) ""); diff --git a/src/sound/snd_ac97_codec.c b/src/sound/snd_ac97_codec.c index 38d44bff3..b2702c0f5 100644 --- a/src/sound/snd_ac97_codec.c +++ b/src/sound/snd_ac97_codec.c @@ -418,7 +418,7 @@ rate: /* Writable only if VRA/VRM is set. */ prev = dev->vendor_reg_pages[(i << 3) | ((reg & 0x0e) >> 1)]; } - /* fall-through */ + [[fallthrough]]; case 0x5a ... 0x5e: /* Vendor Reserved */ case 0x70 ... 0x7a: diff --git a/src/sound/snd_ac97_via.c b/src/sound/snd_ac97_via.c index 81babc78b..2fb4644df 100644 --- a/src/sound/snd_ac97_via.c +++ b/src/sound/snd_ac97_via.c @@ -30,38 +30,59 @@ #include <86box/snd_ac97.h> #include <86box/sound.h> #include <86box/timer.h> +#include <86box/plat_unused.h> -typedef struct { - uint8_t id, always_run; +typedef struct ac97_via_sgd_t { + uint8_t id; + uint8_t always_run; struct _ac97_via_ *dev; - uint32_t entry_ptr, sample_ptr, fifo_pos, fifo_end; + uint32_t entry_ptr; + uint32_t sample_ptr; + uint32_t fifo_pos; + uint32_t fifo_end; int32_t sample_count; - uint8_t entry_flags, fifo[32], restart; + uint8_t entry_flags; + uint8_t fifo[32]; + uint8_t restart; - int16_t out_l, out_r; - int vol_l, vol_r, pos; + int16_t out_l; + int16_t out_r; + int vol_l; + int vol_r; + int pos; int32_t buffer[SOUNDBUFLEN * 2]; uint64_t timer_latch; - pc_timer_t dma_timer, poll_timer; + pc_timer_t dma_timer; + pc_timer_t poll_timer; } ac97_via_sgd_t; typedef struct _ac97_via_ { - uint16_t audio_sgd_base, audio_codec_base, modem_sgd_base, modem_codec_base; - uint8_t sgd_regs[256], pcm_enabled : 1, fm_enabled : 1, vsr_enabled : 1; + uint16_t audio_sgd_base; + uint16_t audio_codec_base; + uint16_t modem_sgd_base; + uint16_t modem_codec_base; + uint8_t sgd_regs[256]; + uint8_t pcm_enabled : 1; + uint8_t fm_enabled : 1; + uint8_t vsr_enabled : 1; struct { union { uint8_t regs_codec[2][128]; uint8_t regs_linear[256]; }; } codec_shadow[2]; - int slot, irq_pin; + int slot; + int irq_pin; ac97_codec_t *codec[2][2]; ac97_via_sgd_t sgd[6]; - int master_vol_l, master_vol_r, cd_vol_l, cd_vol_r; + int master_vol_l; + int master_vol_r; + int cd_vol_l; + int cd_vol_r; } ac97_via_t; #ifdef ENABLE_AC97_VIA_LOG @@ -350,6 +371,9 @@ ac97_via_sgd_write(uint16_t addr, uint8_t val, void *priv) case 0x8 ... 0xf: /* Read-only registers. */ return; + + default: + break; } } else { /* Process regular registers. */ @@ -404,6 +428,9 @@ ac97_via_sgd_write(uint16_t addr, uint8_t val, void *priv) val = dev->sgd_regs[addr] | (val & 0xc0); #endif break; + + default: + break; } } @@ -676,6 +703,9 @@ ac97_via_poll_stereo(void *priv) return; } break; + + default: + break; } /* Feed silence if the FIFO is empty. */ @@ -753,7 +783,7 @@ ac97_via_speed_changed(void *priv) } static void * -ac97_via_init(const device_t *info) +ac97_via_init(UNUSED(const device_t *info)) { ac97_via_t *dev = malloc(sizeof(ac97_via_t)); memset(dev, 0, sizeof(ac97_via_t)); diff --git a/src/sound/snd_ad1848.c b/src/sound/snd_ad1848.c index 0feb3ab74..ac9f0298d 100644 --- a/src/sound/snd_ad1848.c +++ b/src/sound/snd_ad1848.c @@ -111,6 +111,9 @@ ad1848_updatefreq(ad1848_t *ad1848) case 0x20: freq /= 256 * set; break; + + default: + break; } set = 1; } @@ -143,6 +146,9 @@ ad1848_updatefreq(ad1848_t *ad1848) case 7: freq /= 2560; break; + + default: + break; } } @@ -194,12 +200,18 @@ ad1848_read(uint16_t addr, void *priv) ret = ad1848->xregs[ad1848->xindex]; } break; + + default: + break; } break; case 2: ret = ad1848->status; break; + + default: + break; } return ret; @@ -229,7 +241,7 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv) case 10: if (ad1848->type < AD1848_TYPE_CS4235) break; - /* fall-through */ + [[fallthrough]]; case 8: updatefreq = 1; @@ -359,6 +371,9 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv) case 25: return; + + default: + break; } ad1848->xregs[ad1848->xindex] = val; @@ -383,6 +398,9 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv) if (ad1848->type != AD1848_TYPE_DEFAULT) return; break; + + default: + break; } ad1848->regs[ad1848->index] = val; @@ -406,6 +424,9 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv) ad1848->status &= 0xfe; ad1848->regs[24] &= 0x0f; break; + + default: + break; } } @@ -561,6 +582,9 @@ ad1848_poll(void *priv) break; /* 0xe0 and 0xf0 reserved */ + + default: + break; } if (ad1848->regs[6] & 0x80) diff --git a/src/sound/snd_adlib.c b/src/sound/snd_adlib.c index d9498d567..5c6c80866 100644 --- a/src/sound/snd_adlib.c +++ b/src/sound/snd_adlib.c @@ -13,6 +13,7 @@ #include <86box/sound.h> #include <86box/timer.h> #include <86box/snd_opl.h> +#include <86box/plat_unused.h> #ifdef ENABLE_ADLIB_LOG int adlib_do_log = ENABLE_ADLIB_LOG; @@ -39,22 +40,22 @@ typedef struct adlib_t { } adlib_t; static void -adlib_get_buffer(int32_t *buffer, int len, void *p) +adlib_get_buffer(int32_t *buffer, int len, void *priv) { - adlib_t *adlib = (adlib_t *) p; + adlib_t *adlib = (adlib_t *) priv; int32_t *opl_buf = adlib->opl.update(adlib->opl.priv); for (int c = 0; c < len * 2; c++) - buffer[c] += (int32_t) opl_buf[c]; + buffer[c] += opl_buf[c]; adlib->opl.reset_buffer(adlib->opl.priv); } uint8_t -adlib_mca_read(int port, void *p) +adlib_mca_read(int port, void *priv) { - adlib_t *adlib = (adlib_t *) p; + adlib_t *adlib = (adlib_t *) priv; adlib_log("adlib_mca_read: port=%04x\n", port); @@ -62,9 +63,9 @@ adlib_mca_read(int port, void *p) } void -adlib_mca_write(int port, uint8_t val, void *p) +adlib_mca_write(int port, uint8_t val, void *priv) { - adlib_t *adlib = (adlib_t *) p; + adlib_t *adlib = (adlib_t *) priv; if (port < 0x102) return; @@ -84,20 +85,23 @@ adlib_mca_write(int port, uint8_t val, void *p) adlib->opl.write, NULL, NULL, adlib->opl.priv); break; + + default: + break; } adlib->pos_regs[port & 7] = val; } uint8_t -adlib_mca_feedb(void *p) +adlib_mca_feedb(void *priv) { - adlib_t *adlib = (adlib_t *) p; + adlib_t *adlib = (adlib_t *) priv; return (adlib->pos_regs[2] & 1); } void * -adlib_init(const device_t *info) +adlib_init(UNUSED(const device_t *info)) { adlib_t *adlib = malloc(sizeof(adlib_t)); memset(adlib, 0, sizeof(adlib_t)); @@ -133,9 +137,9 @@ adlib_mca_init(const device_t *info) } void -adlib_close(void *p) +adlib_close(void *priv) { - adlib_t *adlib = (adlib_t *) p; + adlib_t *adlib = (adlib_t *) priv; free(adlib); } diff --git a/src/sound/snd_adlibgold.c b/src/sound/snd_adlibgold.c index e4330cba3..bb602a5e1 100644 --- a/src/sound/snd_adlibgold.c +++ b/src/sound/snd_adlibgold.c @@ -17,15 +17,18 @@ #include <86box/sound.h> #include <86box/snd_opl.h> #include <86box/snd_ym7128.h> +#include <86box/plat_unused.h> typedef struct adgold_t { int adgold_irq_status; - int irq, dma; + int irq; + int dma; uint8_t adgold_eeprom[0x1a]; uint8_t adgold_status; - int adgold_38x_state, adgold_38x_addr; + int adgold_38x_state; + int adgold_38x_addr; uint8_t adgold_38x_regs[0x1a]; int adgold_mma_addr; @@ -33,7 +36,8 @@ typedef struct adgold_t { int adgold_mma_enable[2]; uint8_t adgold_mma_fifo[2][256]; - int adgold_mma_fifo_start[2], adgold_mma_fifo_end[2]; + int adgold_mma_fifo_start[2]; + int adgold_mma_fifo_end[2]; uint8_t adgold_mma_status; int16_t adgold_mma_out[2]; @@ -41,28 +45,42 @@ typedef struct adgold_t { pc_timer_t adgold_mma_timer_count; - uint8_t adgold_midi_ctrl, midi_queue[16]; - int midi_r, midi_w; - int uart_in, uart_out, sysex; + uint8_t adgold_midi_ctrl; + uint8_t midi_queue[16]; + int midi_r; + int midi_w; + int uart_in; + int uart_out; + int sysex; - struct - { - int timer0_latch, timer0_count; - int timerbase_latch, timerbase_count; - int timer1_latch, timer1_count; - int timer2_latch, timer2_count, timer2_read; + struct { + int timer0_latch; + int timer0_count; + int timerbase_latch; + int timerbase_count; + int timer1_latch; + int timer1_count; + int timer2_latch; + int timer2_count; + int timer2_read; - int voice_count[2], voice_latch[2]; + int voice_count[2]; + int voice_latch[2]; } adgold_mma; fm_drv_t opl; ym7128_t ym7128; - int fm_vol_l, fm_vol_r; - int samp_vol_l, samp_vol_r; - int aux_vol_l, aux_vol_r; - int vol_l, vol_r; - int treble, bass; + int fm_vol_l; + int fm_vol_r; + int samp_vol_l; + int samp_vol_r; + int aux_vol_l; + int aux_vol_r; + int vol_l; + int vol_r; + int treble; + int bass; int16_t opl_buffer[SOUNDBUFLEN * 2]; int16_t mma_buffer[2][SOUNDBUFLEN]; @@ -131,7 +149,7 @@ static int treble_cut[6] = { (int) (0.354 * 16384) /*-3 dB - filter output is at +6 dB*/ }; -void adgold_timer_poll(void *p); +void adgold_timer_poll(void *priv); void adgold_update(adgold_t *adgold); void @@ -192,9 +210,9 @@ adgold_getsamp_dma(adgold_t *adgold, int channel) } void -adgold_write(uint16_t addr, uint8_t val, void *p) +adgold_write(uint16_t addr, uint8_t val, void *priv) { - adgold_t *adgold = (adgold_t *) p; + adgold_t *adgold = (adgold_t *) priv; switch (addr & 7) { case 0: case 1: @@ -337,6 +355,9 @@ adgold_write(uint16_t addr, uint8_t val, void *p) case 0x18: adgold->adgold_mma.voice_latch[0] = 72; break; /* 7350 Hz*/ + + default: + break; } if (val & 0x80) { adgold->adgold_mma_enable[0] = 0; @@ -438,6 +459,9 @@ adgold_write(uint16_t addr, uint8_t val, void *p) adgold_update_irq_status(adgold); } break; + + default: + break; } adgold->adgold_mma_regs[0][adgold->adgold_mma_addr] = val; break; @@ -460,6 +484,9 @@ adgold_write(uint16_t addr, uint8_t val, void *p) case 0x18: adgold->adgold_mma.voice_latch[1] = 72; break; /* 7350 Hz*/ + + default: + break; } if (val & 0x80) { adgold->adgold_mma_enable[1] = 0; @@ -497,16 +524,22 @@ adgold_write(uint16_t addr, uint8_t val, void *p) case 0xc: adgold->adgold_mma_intpos[1] = (7 - ((val >> 2) & 7)) * 8; break; + + default: + break; } adgold->adgold_mma_regs[1][adgold->adgold_mma_addr] = val; break; + + default: + break; } } uint8_t -adgold_read(uint16_t addr, void *p) +adgold_read(uint16_t addr, void *priv) { - adgold_t *adgold = (adgold_t *) p; + adgold_t *adgold = (adgold_t *) priv; uint8_t temp = 0; switch (addr & 7) { @@ -586,6 +619,9 @@ adgold_read(uint16_t addr, void *p) else temp = adgold->adgold_mma_regs[1][adgold->adgold_mma_addr]; break; + + default: + break; } return temp; } @@ -633,6 +669,9 @@ adgold_mma_poll(adgold_t *adgold, int channel) adgold->adgold_mma_fifo_start[channel] = (adgold->adgold_mma_fifo_start[channel] + 1) & 255; adgold->adgold_mma_out[channel] = dat; break; + + default: + break; } if (adgold->adgold_mma_regs[channel][0xc] & 1) { @@ -649,9 +688,9 @@ adgold_mma_poll(adgold_t *adgold, int channel) } void -adgold_timer_poll(void *p) +adgold_timer_poll(void *priv) { - adgold_t *adgold = (adgold_t *) p; + adgold_t *adgold = (adgold_t *) priv; /*A small timer period will result in hangs.*/ timer_on_auto(&adgold->adgold_mma_timer_count, 4.88964); @@ -718,9 +757,9 @@ adgold_timer_poll(void *p) } static void -adgold_get_buffer(int32_t *buffer, int len, void *p) +adgold_get_buffer(int32_t *buffer, int len, void *priv) { - adgold_t *adgold = (adgold_t *) p; + adgold_t *adgold = (adgold_t *) priv; int16_t *adgold_buffer = malloc(sizeof(int16_t) * len * 2); if (adgold_buffer == NULL) fatal("adgold_buffer = NULL"); @@ -755,6 +794,9 @@ adgold_get_buffer(int32_t *buffer, int len, void *p) break; case 6: /*Left and right channels*/ break; + + default: + break; } switch (adgold->adgold_38x_regs[0x8] & 0x18) { @@ -781,6 +823,9 @@ adgold_get_buffer(int32_t *buffer, int len, void *p) adgold_buffer[c + 1] += (l / 3) + ((r * 2) / 3); } break; + + default: + break; } for (c = 0; c < len * 2; c += 2) { @@ -831,9 +876,9 @@ adgold_get_buffer(int32_t *buffer, int len, void *p) } static void -adgold_filter_cd_audio(int channel, double *buffer, void *p) +adgold_filter_cd_audio(int channel, double *buffer, void *priv) { - adgold_t *adgold = (adgold_t *) p; + adgold_t *adgold = (adgold_t *) priv; double c; int aux = channel ? adgold->aux_vol_r : adgold->aux_vol_l; int vol = channel ? adgold->vol_r : adgold->vol_l; @@ -883,7 +928,7 @@ adgold_input_sysex(void *p, uint8_t *buffer, uint32_t len, int abort) } void * -adgold_init(const device_t *info) +adgold_init(UNUSED(const device_t *info)) { FILE *f; int c; @@ -957,6 +1002,9 @@ adgold_init(const device_t *info) case 7: adgold->adgold_eeprom[0x13] |= 0x03; break; + + default: + break; } adgold->adgold_eeprom[0x13] |= (adgold->dma << 3); adgold->adgold_eeprom[0x14] |= (adgold->dma << 4); @@ -993,15 +1041,15 @@ adgold_init(const device_t *info) } void -adgold_close(void *p) +adgold_close(void *priv) { - FILE *f; - adgold_t *adgold = (adgold_t *) p; + FILE *fp; + adgold_t *adgold = (adgold_t *) priv; - f = nvr_fopen("adgold.bin", "wb"); - if (f) { - fwrite(adgold->adgold_eeprom, 0x1a, 1, f); - fclose(f); + fp = nvr_fopen("adgold.bin", "wb"); + if (fp) { + fwrite(adgold->adgold_eeprom, 0x1a, 1, fp); + fclose(fp); } free(adgold); diff --git a/src/sound/snd_audiopci.c b/src/sound/snd_audiopci.c index d91ab38b9..7d4191849 100644 --- a/src/sound/snd_audiopci.c +++ b/src/sound/snd_audiopci.c @@ -38,6 +38,7 @@ #include <86box/snd_ac97.h> #include <86box/sound.h> #include <86box/timer.h> +#include <86box/plat_unused.h> #define N 16 @@ -45,8 +46,9 @@ static float low_fir_es1371_coef[ES1371_NCoef]; -typedef struct { - uint8_t pci_command, pci_serr; +typedef struct es1371_t { + uint8_t pci_command; + uint8_t pci_serr; uint32_t base_addr; @@ -54,9 +56,10 @@ typedef struct { uint16_t pmcsr; - uint32_t int_ctrl, int_status, - legacy_ctrl; - void *gameport; + uint32_t int_ctrl; + uint32_t int_status; + uint32_t legacy_ctrl; + void *gameport; int mem_page; @@ -65,17 +68,22 @@ typedef struct { uint32_t sr_cir; uint16_t sr_ram[128]; - uint8_t uart_data, uart_ctrl, - uart_status, uart_res; + uint8_t uart_data; + uint8_t uart_ctrl; + uint8_t uart_status; + uint8_t uart_res; uint32_t uart_fifo[8]; - uint8_t read_fifo_pos, write_fifo_pos; + uint8_t read_fifo_pos; + uint8_t write_fifo_pos; ac97_codec_t *codec; uint32_t codec_ctrl; struct { - uint32_t addr, addr_latch; - uint16_t count, size; + uint32_t addr; + uint32_t addr_latch; + uint16_t count; + uint16_t size; uint16_t samp_ct; int curr_samp_ct; @@ -83,24 +91,34 @@ typedef struct { pc_timer_t timer; uint64_t latch; - uint32_t vf, ac; + uint32_t vf; + uint32_t ac; - int16_t buffer_l[64], buffer_r[64]; - int buffer_pos, buffer_pos_end; + int16_t buffer_l[64]; + int16_t buffer_r[64]; + int buffer_pos; + int buffer_pos_end; - int filtered_l[32], filtered_r[32]; + int filtered_l[32]; + int filtered_r[32]; int f_pos; - int16_t out_l, out_r; + int16_t out_l; + int16_t out_r; - int32_t vol_l, vol_r; + int32_t vol_l; + int32_t vol_r; } dac[2], adc; - int64_t dac_latch, dac_time; + int64_t dac_latch; + int64_t dac_time; - int master_vol_l, master_vol_r, - pcm_vol_l, pcm_vol_r, - cd_vol_l, cd_vol_r; + int master_vol_l; + int master_vol_r; + int pcm_vol_l; + int pcm_vol_r; + int cd_vol_l; + int cd_vol_r; int card; @@ -299,9 +317,9 @@ es1371_reset_fifo(es1371_t *dev) } static void -es1371_reset(void *p) +es1371_reset(void *priv) { - es1371_t *dev = (es1371_t *) p; + es1371_t *dev = (es1371_t *) priv; nmi = 0; @@ -435,6 +453,9 @@ es1371_read_frame_reg(es1371_t *dev, int frame, int page) dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)]); ret = dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)]; break; + + default: + break; } break; case 0x34: @@ -458,6 +479,9 @@ es1371_read_frame_reg(es1371_t *dev, int frame, int page) dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)]); ret = dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)]; break; + + default: + break; } break; case 0x38: @@ -476,6 +500,9 @@ es1371_read_frame_reg(es1371_t *dev, int frame, int page) dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)]); ret = dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)]; break; + + default: + break; } break; case 0x3c: @@ -494,8 +521,14 @@ es1371_read_frame_reg(es1371_t *dev, int frame, int page) dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)]); ret = dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)]; break; + + default: + break; } break; + + default: + break; } return ret; @@ -525,6 +558,9 @@ es1371_write_frame_reg(es1371_t *dev, int frame, int page, uint32_t val) ((page & 0x01) << 2) + ((frame >> 2) & 0x03), val); dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)] = val; break; + + default: + break; } break; case 0x34: @@ -549,6 +585,9 @@ es1371_write_frame_reg(es1371_t *dev, int frame, int page, uint32_t val) ((page & 0x01) << 2) + ((frame >> 2) & 0x03), val); dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)] = val; break; + + default: + break; } break; case 0x38: @@ -566,6 +605,9 @@ es1371_write_frame_reg(es1371_t *dev, int frame, int page, uint32_t val) ((page & 0x01) << 2) + ((frame >> 2) & 0x03), val); dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)] = val; break; + + default: + break; } break; case 0x3c: @@ -584,8 +626,14 @@ es1371_write_frame_reg(es1371_t *dev, int frame, int page, uint32_t val) ((page & 0x01) << 2) + ((frame >> 2) & 0x03), val); dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)] = val; break; + + default: + break; } break; + + default: + break; } if (page == 0x0e || page == 0x0f) { @@ -594,9 +642,9 @@ es1371_write_frame_reg(es1371_t *dev, int frame, int page, uint32_t val) } static uint8_t -es1371_inb(uint16_t port, void *p) +es1371_inb(uint16_t port, void *priv) { - es1371_t *dev = (es1371_t *) p; + es1371_t *dev = (es1371_t *) priv; uint8_t ret = 0xff; switch (port & 0x3f) { @@ -705,9 +753,9 @@ es1371_inb(uint16_t port, void *p) } static uint16_t -es1371_inw(uint16_t port, void *p) +es1371_inw(uint16_t port, void *priv) { - es1371_t *dev = (es1371_t *) p; + es1371_t *dev = (es1371_t *) priv; uint16_t ret = 0xffff; switch (port & 0x3e) { @@ -786,6 +834,9 @@ es1371_inw(uint16_t port, void *p) case 0x3e: ret = es1371_read_frame_reg(dev, port & 0x3c, dev->mem_page) >> 16; break; + + default: + break; } audiopci_log("es1371_inw: port=%04x ret=%04x\n", port, ret); @@ -794,9 +845,9 @@ es1371_inw(uint16_t port, void *p) } static uint32_t -es1371_inl(uint16_t port, void *p) +es1371_inl(uint16_t port, void *priv) { - es1371_t *dev = (es1371_t *) p; + es1371_t *dev = (es1371_t *) priv; uint32_t ret = 0xffffffff; switch (port & 0x3c) { @@ -868,6 +919,9 @@ es1371_inl(uint16_t port, void *p) case 0x3c: ret = es1371_read_frame_reg(dev, port & 0x3c, dev->mem_page); break; + + default: + break; } audiopci_log("es1371_inl: port=%04x ret=%08x\n", port, ret); @@ -875,9 +929,9 @@ es1371_inl(uint16_t port, void *p) } static void -es1371_outb(uint16_t port, uint8_t val, void *p) +es1371_outb(uint16_t port, uint8_t val, void *priv) { - es1371_t *dev = (es1371_t *) p; + es1371_t *dev = (es1371_t *) priv; uint32_t old_legacy_ctrl; audiopci_log("es1371_outb: port=%04x val=%02x\n", port, val); @@ -995,9 +1049,9 @@ es1371_outb(uint16_t port, uint8_t val, void *p) } static void -es1371_outw(uint16_t port, uint16_t val, void *p) +es1371_outw(uint16_t port, uint16_t val, void *priv) { - es1371_t *dev = (es1371_t *) p; + es1371_t *dev = (es1371_t *) priv; uint32_t old_legacy_ctrl; switch (port & 0x3f) { @@ -1074,13 +1128,16 @@ es1371_outw(uint16_t port, uint16_t val, void *p) case 0x2c: dev->adc.samp_ct = val; break; + + default: + break; } } static void -es1371_outl(uint16_t port, uint32_t val, void *p) +es1371_outl(uint16_t port, uint32_t val, void *priv) { - es1371_t *dev = (es1371_t *) p; + es1371_t *dev = (es1371_t *) priv; uint32_t old_legacy_ctrl; audiopci_log("es1371_outl: port=%04x val=%08x\n", port, val); @@ -1160,6 +1217,9 @@ es1371_outl(uint16_t port, uint32_t val, void *p) case 0x7f: dev->dac[1].vol_r = (int32_t) (int16_t) (val & 0xffff); break; + + default: + break; } } break; @@ -1225,6 +1285,9 @@ es1371_outl(uint16_t port, uint32_t val, void *p) case 0x3c: es1371_write_frame_reg(dev, port & 0x3c, dev->mem_page, val); break; + + default: + break; } } @@ -1243,106 +1306,106 @@ capture_event(es1371_t *dev, int type, int rw, uint16_t port) } static void -capture_write_sscape(uint16_t port, uint8_t val, void *p) +capture_write_sscape(uint16_t port, UNUSED(uint8_t val), void *priv) { - capture_event(p, LEGACY_EVENT_SSCAPE, 1, port); + capture_event(priv, LEGACY_EVENT_SSCAPE, 1, port); } static void -capture_write_codec(uint16_t port, uint8_t val, void *p) +capture_write_codec(uint16_t port, UNUSED(uint8_t val), void *priv) { - capture_event(p, LEGACY_EVENT_CODEC, 1, port); + capture_event(priv, LEGACY_EVENT_CODEC, 1, port); } static void -capture_write_sb(uint16_t port, uint8_t val, void *p) +capture_write_sb(uint16_t port, UNUSED(uint8_t val), void *priv) { - capture_event(p, LEGACY_EVENT_SB, 1, port); + capture_event(priv, LEGACY_EVENT_SB, 1, port); } static void -capture_write_adlib(uint16_t port, uint8_t val, void *p) +capture_write_adlib(uint16_t port, UNUSED(uint8_t val), void *priv) { - capture_event(p, LEGACY_EVENT_ADLIB, 1, port); + capture_event(priv, LEGACY_EVENT_ADLIB, 1, port); } static void -capture_write_master_pic(uint16_t port, uint8_t val, void *p) +capture_write_master_pic(uint16_t port, UNUSED(uint8_t val), void *priv) { - capture_event(p, LEGACY_EVENT_MASTER_PIC, 1, port); + capture_event(priv, LEGACY_EVENT_MASTER_PIC, 1, port); } static void -capture_write_master_dma(uint16_t port, uint8_t val, void *p) +capture_write_master_dma(uint16_t port, UNUSED(uint8_t val), void *priv) { - capture_event(p, LEGACY_EVENT_MASTER_DMA, 1, port); + capture_event(priv, LEGACY_EVENT_MASTER_DMA, 1, port); } static void -capture_write_slave_pic(uint16_t port, uint8_t val, void *p) +capture_write_slave_pic(uint16_t port, UNUSED(uint8_t val), void *priv) { - capture_event(p, LEGACY_EVENT_SLAVE_PIC, 1, port); + capture_event(priv, LEGACY_EVENT_SLAVE_PIC, 1, port); } static void -capture_write_slave_dma(uint16_t port, uint8_t val, void *p) +capture_write_slave_dma(uint16_t port, UNUSED(uint8_t val), void *priv) { - capture_event(p, LEGACY_EVENT_SLAVE_DMA, 1, port); + capture_event(priv, LEGACY_EVENT_SLAVE_DMA, 1, port); } static uint8_t -capture_read_sscape(uint16_t port, void *p) +capture_read_sscape(uint16_t port, void *priv) { - capture_event(p, LEGACY_EVENT_SSCAPE, 0, port); + capture_event(priv, LEGACY_EVENT_SSCAPE, 0, port); return 0xff; } static uint8_t -capture_read_codec(uint16_t port, void *p) +capture_read_codec(uint16_t port, void *priv) { - capture_event(p, LEGACY_EVENT_CODEC, 0, port); + capture_event(priv, LEGACY_EVENT_CODEC, 0, port); return 0xff; } static uint8_t -capture_read_sb(uint16_t port, void *p) +capture_read_sb(uint16_t port, void *priv) { - capture_event(p, LEGACY_EVENT_SB, 0, port); + capture_event(priv, LEGACY_EVENT_SB, 0, port); return 0xff; } static uint8_t -capture_read_adlib(uint16_t port, void *p) +capture_read_adlib(uint16_t port, void *priv) { - capture_event(p, LEGACY_EVENT_ADLIB, 0, port); + capture_event(priv, LEGACY_EVENT_ADLIB, 0, port); return 0xff; } static uint8_t -capture_read_master_pic(uint16_t port, void *p) +capture_read_master_pic(uint16_t port, void *priv) { - capture_event(p, LEGACY_EVENT_MASTER_PIC, 0, port); + capture_event(priv, LEGACY_EVENT_MASTER_PIC, 0, port); return 0xff; } static uint8_t -capture_read_master_dma(uint16_t port, void *p) +capture_read_master_dma(uint16_t port, void *priv) { - capture_event(p, LEGACY_EVENT_MASTER_DMA, 0, port); + capture_event(priv, LEGACY_EVENT_MASTER_DMA, 0, port); return 0xff; } static uint8_t -capture_read_slave_pic(uint16_t port, void *p) +capture_read_slave_pic(uint16_t port, void *priv) { - capture_event(p, LEGACY_EVENT_SLAVE_PIC, 0, port); + capture_event(priv, LEGACY_EVENT_SLAVE_PIC, 0, port); return 0xff; } static uint8_t -capture_read_slave_dma(uint16_t port, void *p) +capture_read_slave_dma(uint16_t port, void *priv) { - capture_event(p, LEGACY_EVENT_SLAVE_DMA, 0, port); + capture_event(priv, LEGACY_EVENT_SLAVE_DMA, 0, port); return 0xff; } @@ -1371,6 +1434,9 @@ update_legacy(es1371_t *dev, uint32_t old_legacy_ctrl) capture_read_sscape, NULL, NULL, capture_write_sscape, NULL, NULL, dev); break; + + default: + break; } } @@ -1391,6 +1457,9 @@ update_legacy(es1371_t *dev, uint32_t old_legacy_ctrl) capture_read_codec, NULL, NULL, capture_write_codec, NULL, NULL, dev); break; + + default: + break; } } @@ -1458,6 +1527,9 @@ update_legacy(es1371_t *dev, uint32_t old_legacy_ctrl) capture_read_sscape, NULL, NULL, capture_write_sscape, NULL, NULL, dev); break; + + default: + break; } } @@ -1478,6 +1550,9 @@ update_legacy(es1371_t *dev, uint32_t old_legacy_ctrl) capture_read_codec, NULL, NULL, capture_write_codec, NULL, NULL, dev); break; + + default: + break; } } @@ -1525,9 +1600,9 @@ update_legacy(es1371_t *dev, uint32_t old_legacy_ctrl) } static uint8_t -es1371_pci_read(int func, int addr, void *p) +es1371_pci_read(int func, int addr, void *priv) { - es1371_t *dev = (es1371_t *) p; + es1371_t *dev = (es1371_t *) priv; if (func > 0) return 0xff; @@ -1609,6 +1684,9 @@ es1371_pci_read(int func, int addr, void *p) return dev->pmcsr & 0xff; case 0xe1: return dev->pmcsr >> 8; + + default: + break; } return 0x00; @@ -1625,9 +1703,9 @@ es1371_io_set(es1371_t *dev, int set) } static void -es1371_pci_write(int func, int addr, uint8_t val, void *p) +es1371_pci_write(int func, int addr, uint8_t val, void *priv) { - es1371_t *dev = (es1371_t *) p; + es1371_t *dev = (es1371_t *) priv; if (func) return; @@ -1669,6 +1747,9 @@ es1371_pci_write(int func, int addr, uint8_t val, void *p) case 0xe1: dev->pmcsr = (dev->pmcsr & 0x00ff) | ((val & 0x01) << 8); break; + + default: + break; } } @@ -1754,6 +1835,9 @@ es1371_fetch(es1371_t *dev, int dac_nr) } } break; + + default: + break; } } @@ -1845,9 +1929,9 @@ es1371_update(es1371_t *dev) } static void -es1371_poll(void *p) +es1371_poll(void *priv) { - es1371_t *dev = (es1371_t *) p; + es1371_t *dev = (es1371_t *) priv; int frac; int idx; int samp1_l; @@ -1913,9 +1997,9 @@ es1371_poll(void *p) } static void -es1371_get_buffer(int32_t *buffer, int len, void *p) +es1371_get_buffer(int32_t *buffer, int len, void *priv) { - es1371_t *dev = (es1371_t *) p; + es1371_t *dev = (es1371_t *) priv; es1371_update(dev); @@ -1926,9 +2010,9 @@ es1371_get_buffer(int32_t *buffer, int len, void *p) } static void -es1371_filter_cd_audio(int channel, double *buffer, void *p) +es1371_filter_cd_audio(int channel, double *buffer, void *priv) { - es1371_t *dev = (es1371_t *) p; + es1371_t *dev = (es1371_t *) priv; double c; int cd = channel ? dev->cd_vol_r : dev->cd_vol_l; int master = channel ? dev->master_vol_r : dev->master_vol_l; @@ -2041,17 +2125,17 @@ es1371_init(const device_t *info) } static void -es1371_close(void *p) +es1371_close(void *priv) { - es1371_t *dev = (es1371_t *) p; + es1371_t *dev = (es1371_t *) priv; free(dev); } static void -es1371_speed_changed(void *p) +es1371_speed_changed(void *priv) { - es1371_t *dev = (es1371_t *) p; + es1371_t *dev = (es1371_t *) priv; dev->dac[1].latch = (uint64_t) ((double) TIMER_USEC * (1000000.0 / (double) SOUND_FREQ)); } diff --git a/src/sound/snd_azt2316a.c b/src/sound/snd_azt2316a.c index ee5c982f4..6b198e1f0 100644 --- a/src/sound/snd_azt2316a.c +++ b/src/sound/snd_azt2316a.c @@ -150,6 +150,7 @@ #include <86box/snd_ad1848.h> #include <86box/snd_azt2316a.h> #include <86box/snd_sb.h> +#include <86box/plat_unused.h> /*530, 11, 3 - 530=23*/ /*530, 11, 1 - 530=22*/ @@ -164,7 +165,9 @@ static int azt2316a_wss_dma[4] = { 0, 0, 1, 3 }; static int azt2316a_wss_irq[8] = { 5, 7, 9, 10, 11, 12, 14, 15 }; /* W95 only uses 7-10, others may be wrong */ -// static uint16_t azt2316a_wss_addr[4] = {0x530, 0x604, 0xe80, 0xf40}; +#if 0 +static uint16_t azt2316a_wss_addr[4] = {0x530, 0x604, 0xe80, 0xf40}; +#endif typedef struct azt2316a_t { int type; @@ -172,10 +175,14 @@ typedef struct azt2316a_t { uint8_t wss_config; - uint16_t cur_addr, cur_wss_addr, cur_mpu401_addr; + uint16_t cur_addr; + uint16_t cur_wss_addr; + uint16_t cur_mpu401_addr; int cur_irq, cur_dma; - int cur_wss_enabled, cur_wss_irq, cur_wss_dma; + int cur_wss_enabled; + int cur_wss_irq; + int cur_wss_dma; int cur_mpu401_irq; int cur_mpu401_enabled; @@ -191,9 +198,9 @@ typedef struct azt2316a_t { } azt2316a_t; static uint8_t -azt2316a_wss_read(uint16_t addr, void *p) +azt2316a_wss_read(uint16_t addr, void *priv) { - azt2316a_t *azt2316a = (azt2316a_t *) p; + azt2316a_t *azt2316a = (azt2316a_t *) priv; uint8_t temp; /* TODO: when windows is initializing, writing 0x48, 0x58 and 0x60 to @@ -208,9 +215,9 @@ azt2316a_wss_read(uint16_t addr, void *p) } static void -azt2316a_wss_write(uint16_t addr, uint8_t val, void *p) +azt2316a_wss_write(UNUSED(uint16_t addr), uint8_t val, void *priv) { - azt2316a_t *azt2316a = (azt2316a_t *) p; + azt2316a_t *azt2316a = (azt2316a_t *) priv; int interrupt = 0; if (azt2316a->wss_interrupt_after_config) { @@ -231,9 +238,9 @@ azt2316a_wss_write(uint16_t addr, uint8_t val, void *p) /* generate a config word based on current settings */ static void -azt1605_create_config_word(void *p) +azt1605_create_config_word(void *priv) { - azt2316a_t *azt2316a = (azt2316a_t *) p; + azt2316a_t *azt2316a = (azt2316a_t *) priv; uint32_t temp = 0; /* not implemented / hardcoded */ @@ -244,8 +251,10 @@ azt1605_create_config_word(void *p) switch (azt2316a->cur_addr) { case 0x220: - /* do nothing - temp += 0 << 0; */ + // do nothing +#if 0 + temp += 0 << 0; +#endif break; case 0x240: temp += 1 << 0; @@ -258,6 +267,8 @@ azt1605_create_config_word(void *p) temp += 3 << 0; break; #endif + default: + break; } switch (azt2316a->cur_irq) { @@ -273,12 +284,17 @@ azt1605_create_config_word(void *p) case 7: temp += 1 << 11; break; + + default: + break; } switch (azt2316a->cur_wss_addr) { case 0x530: - /* do nothing - temp += 0 << 16; */ + // do nothing +#if 0 + temp += 0 << 16; +#endif break; case 0x604: temp += 1 << 16; @@ -289,6 +305,9 @@ azt1605_create_config_word(void *p) case 0xF40: temp += 3 << 16; break; + + default: + break; } if (azt2316a->cur_wss_enabled) @@ -299,12 +318,17 @@ azt1605_create_config_word(void *p) switch (azt2316a->cur_mpu401_addr) { case 0x300: - /* do nothing - temp += 0 << 2; */ + // do nothing +#if 0 + temp += 0 << 2; +#endif break; case 0x330: temp += 1 << 2; break; + + default: + break; } if (azt2316a->cur_mpu401_enabled) @@ -336,6 +360,9 @@ azt1605_create_config_word(void *p) case 7: // unused temp += 7 << 5; break; + + default: + break; } switch (cd_dma8) { @@ -352,6 +379,9 @@ azt1605_create_config_word(void *p) case 3: temp += 3 << 22; break; + + default: + break; } switch (azt2316a->cur_mpu401_irq) { @@ -367,6 +397,9 @@ azt1605_create_config_word(void *p) case 7: temp += 1 << 15; break; + + default: + break; } switch (cd_irq) { @@ -382,15 +415,18 @@ azt1605_create_config_word(void *p) case 15: temp += 1 << 21; break; + + default: + break; } azt2316a->config_word = temp; } static void -azt2316a_create_config_word(void *p) +azt2316a_create_config_word(void *priv) { - azt2316a_t *azt2316a = (azt2316a_t *) p; + azt2316a_t *azt2316a = (azt2316a_t *) priv; uint32_t temp = 0; /* not implemented / hardcoded */ @@ -402,14 +438,16 @@ azt2316a_create_config_word(void *p) uint8_t cd_irq = 15; if (azt2316a->type == SB_SUBTYPE_CLONE_AZT1605_0X0C) { - azt1605_create_config_word(p); + azt1605_create_config_word(priv); return; } switch (azt2316a->cur_addr) { case 0x220: - /* do nothing - temp += 0 << 0; */ + // do nothing +#if 0 + temp += 0 << 0; +#endif break; case 0x240: temp += 1 << 0; @@ -422,6 +460,8 @@ azt2316a_create_config_word(void *p) temp += 3 << 0; break; #endif + default: + break; } switch (azt2316a->cur_irq) { @@ -437,6 +477,9 @@ azt2316a_create_config_word(void *p) case 10: temp += 1 << 5; break; + + default: + break; } switch (azt2316a->cur_dma) { @@ -456,12 +499,17 @@ azt2316a_create_config_word(void *p) case 3: temp += 3 << 6; break; + + default: + break; } switch (azt2316a->cur_wss_addr) { case 0x530: // do nothing - // temp += 0 << 8; +#if 0 + temp += 0 << 8; +#endif break; case 0x604: temp += 1 << 8; @@ -472,6 +520,9 @@ azt2316a_create_config_word(void *p) case 0xF40: temp += 3 << 8; break; + + default: + break; } if (azt2316a->cur_wss_enabled) temp += 1 << 10; @@ -480,11 +531,16 @@ azt2316a_create_config_word(void *p) switch (azt2316a->cur_mpu401_addr) { case 0x300: // do nothing - // temp += 0 << 12; +#if 0 + temp += 0 << 12; +#endif break; case 0x330: temp += 1 << 12; break; + + default: + break; } if (azt2316a->cur_mpu401_enabled) @@ -493,7 +549,9 @@ azt2316a_create_config_word(void *p) switch (cd_addr) { case 0x310: // do nothing - // temp += 0 << 14; +#if 0 + temp += 0 << 14; +#endif break; case 0x320: temp += 1 << 14; @@ -504,11 +562,16 @@ azt2316a_create_config_word(void *p) case 0x350: temp += 3 << 14; break; + + default: + break; } switch (cd_type) { - case 0: /* disabled - do nothing + case 0: /* disabled */ + // do nothing +#if 0 temp += 0 << 16; */ +#endif break; case 1: /* panasonic */ temp += 1 << 16; @@ -531,6 +594,9 @@ azt2316a_create_config_word(void *p) case 7: /* unused */ temp += 7 << 16; break; + + default: + break; } switch (cd_dma8) { @@ -549,6 +615,9 @@ azt2316a_create_config_word(void *p) case 3: temp += 3 << 20; break; + + default: + break; } switch (cd_dma16) { @@ -565,6 +634,9 @@ azt2316a_create_config_word(void *p) case 7: temp += 3 << 22; break; + + default: + break; } switch (azt2316a->cur_mpu401_irq) { @@ -580,6 +652,9 @@ azt2316a_create_config_word(void *p) case 10: temp += 1 << 27; break; + + default: + break; } switch (cd_irq) { @@ -595,15 +670,18 @@ azt2316a_create_config_word(void *p) case 15: temp += 1 << 31; break; + + default: + break; } azt2316a->config_word = temp; } static uint8_t -azt2316a_config_read(uint16_t addr, void *p) +azt2316a_config_read(uint16_t addr, void *priv) { - azt2316a_t *azt2316a = (azt2316a_t *) p; + azt2316a_t *azt2316a = (azt2316a_t *) priv; uint8_t temp = 0; /* Some WSS config here + config change enable bit @@ -635,6 +713,9 @@ azt2316a_config_read(uint16_t addr, void *p) case 3: temp = (azt2316a->config_word >> 24); break; + + default: + break; } } @@ -642,9 +723,9 @@ azt2316a_config_read(uint16_t addr, void *p) } static void -azt1605_config_write(uint16_t addr, uint8_t val, void *p) +azt1605_config_write(uint16_t addr, uint8_t val, void *priv) { - azt2316a_t *azt2316a = (azt2316a_t *) p; + azt2316a_t *azt2316a = (azt2316a_t *) priv; uint8_t temp; if (addr == (azt2316a->cur_addr + 0x404)) { @@ -731,6 +812,9 @@ azt1605_config_write(uint16_t addr, uint8_t val, void *p) break; case 3: break; + + default: + break; } /* update sbprov2 configs */ sb_dsp_setaddr(&azt2316a->sb->dsp, azt2316a->cur_addr); @@ -743,9 +827,9 @@ azt1605_config_write(uint16_t addr, uint8_t val, void *p) } static void -azt2316a_config_write(uint16_t addr, uint8_t val, void *p) +azt2316a_config_write(uint16_t addr, uint8_t val, void *priv) { - azt2316a_t *azt2316a = (azt2316a_t *) p; + azt2316a_t *azt2316a = (azt2316a_t *) priv; uint8_t temp; if (azt2316a->type == SB_SUBTYPE_CLONE_AZT1605_0X0C) { @@ -839,6 +923,9 @@ azt2316a_config_write(uint16_t addr, uint8_t val, void *p) azt2316a->cur_mpu401_irq = 10; /* else undefined? */ break; + + default: + break; } /* update sbprov2 configs */ sb_dsp_setaddr(&azt2316a->sb->dsp, azt2316a->cur_addr); @@ -852,9 +939,9 @@ azt2316a_config_write(uint16_t addr, uint8_t val, void *p) /* How it behaves when one or another is activated may affect games auto-detecting (and will also use more of the limited system resources!) */ void -azt2316a_enable_wss(uint8_t enable, void *p) +azt2316a_enable_wss(uint8_t enable, void *priv) { - azt2316a_t *azt2316a = (azt2316a_t *) p; + azt2316a_t *azt2316a = (azt2316a_t *) priv; if (enable) azt2316a->cur_mode = 1; @@ -863,9 +950,9 @@ azt2316a_enable_wss(uint8_t enable, void *p) } static void -azt2316a_get_buffer(int32_t *buffer, int len, void *p) +azt2316a_get_buffer(int32_t *buffer, int len, void *priv) { - azt2316a_t *azt2316a = (azt2316a_t *) p; + azt2316a_t *azt2316a = (azt2316a_t *) priv; /* wss part */ ad1848_update(&azt2316a->ad1848); @@ -1182,9 +1269,9 @@ azt_init(const device_t *info) } static void -azt_close(void *p) +azt_close(void *priv) { - azt2316a_t *azt2316a = (azt2316a_t *) p; + azt2316a_t *azt2316a = (azt2316a_t *) priv; char *fn = NULL; FILE *f; uint8_t checksum = 0x7f; @@ -1217,9 +1304,9 @@ azt_close(void *p) } static void -azt_speed_changed(void *p) +azt_speed_changed(void *priv) { - azt2316a_t *azt2316a = (azt2316a_t *) p; + azt2316a_t *azt2316a = (azt2316a_t *) priv; ad1848_speed_changed(&azt2316a->ad1848); sb_speed_changed(azt2316a->sb); diff --git a/src/sound/snd_cmi8x38.c b/src/sound/snd_cmi8x38.c index ee37d7f26..1e09acdca 100644 --- a/src/sound/snd_cmi8x38.c +++ b/src/sound/snd_cmi8x38.c @@ -34,6 +34,7 @@ #include <86box/gameport.h> #include <86box/nmi.h> #include <86box/ui.h> +#include <86box/plat_unused.h> enum { /* [23:16] = reg 0F [7:0] (reg 0C [31:24]) @@ -53,37 +54,67 @@ enum { TRAP_MAX }; -typedef struct { - uint8_t id, reg, always_run, playback_enabled, channels; +typedef struct cmi8x38_dma_t { + uint8_t id; + uint8_t reg; + uint8_t always_run; + uint8_t playback_enabled; + uint8_t channels; struct _cmi8x38_ *dev; - uint32_t sample_ptr, fifo_pos, fifo_end; - int32_t frame_count_dma, frame_count_fragment, sample_count_out; - uint8_t fifo[256], restart; + uint32_t sample_ptr; + uint32_t fifo_pos; + uint32_t fifo_end; + int32_t frame_count_dma; + int32_t frame_count_fragment; + int32_t sample_count_out; + uint8_t fifo[256]; + uint8_t restart; - int16_t out_fl, out_fr, out_rl, out_rr, out_c, out_lfe; - int vol_l, vol_r, pos; + int16_t out_fl; + int16_t out_fr; + int16_t out_rl; + int16_t out_rr; + int16_t out_c; + int16_t out_lfe; + int vol_l; + int vol_r; + int pos; int32_t buffer[SOUNDBUFLEN * 2]; uint64_t timer_latch; double dma_latch; - pc_timer_t dma_timer, poll_timer; + pc_timer_t dma_timer; + pc_timer_t poll_timer; } cmi8x38_dma_t; typedef struct _cmi8x38_ { uint32_t type; - uint16_t io_base, sb_base, opl_base, mpu_base; - uint8_t pci_regs[256], io_regs[256]; + uint16_t io_base; + uint16_t sb_base; + uint16_t opl_base; + uint16_t mpu_base; + uint8_t pci_regs[256]; + uint8_t io_regs[256]; int slot; sb_t *sb; - void *gameport, *io_traps[TRAP_MAX]; + void *gameport; + void *io_traps[TRAP_MAX]; cmi8x38_dma_t dma[2]; - uint16_t tdma_base_addr, tdma_base_count; - int tdma_8, tdma_16, tdma_mask, prev_mask, tdma_irq_mask; + uint16_t tdma_base_addr; + uint16_t tdma_base_count; + int tdma_8; + int tdma_16; + int tdma_mask; + int prev_mask; + int tdma_irq_mask; - int master_vol_l, master_vol_r, cd_vol_l, cd_vol_r; + int master_vol_l; + int master_vol_r; + int cd_vol_l; + int cd_vol_r; } cmi8x38_t; #ifdef ENABLE_CMI8X38_LOG @@ -307,7 +338,7 @@ cmi8x38_sb_dma_writew(void *priv, uint16_t val) } static void -cmi8x38_dma_write(uint16_t addr, uint8_t val, void *priv) +cmi8x38_dma_write(uint16_t addr, UNUSED(uint8_t val), void *priv) { cmi8x38_t *dev = (cmi8x38_t *) priv; @@ -348,7 +379,7 @@ cmi8x38_dma_write(uint16_t addr, uint8_t val, void *priv) } static void -cmi8x38_dma_mask_write(uint16_t addr, uint8_t val, void *priv) +cmi8x38_dma_mask_write(UNUSED(uint16_t addr), UNUSED(uint8_t val), void *priv) { cmi8x38_t *dev = (cmi8x38_t *) priv; @@ -365,7 +396,7 @@ cmi8x38_dma_mask_write(uint16_t addr, uint8_t val, void *priv) } static void -cmi8338_io_trap(int size, uint16_t addr, uint8_t write, uint8_t val, void *priv) +cmi8338_io_trap(UNUSED(int size), uint16_t addr, uint8_t write, uint8_t val, void *priv) { cmi8x38_t *dev = (cmi8x38_t *) priv; @@ -435,10 +466,13 @@ cmi8x38_sb_mixer_write(uint16_t addr, uint8_t val, void *priv) case 0xf8 ... 0xff: if (dev->type == CMEDIA_CMI8338) mixer->regs[mixer->index] = val; - /* fall-through */ + [[fallthrough]]; case 0xf1 ... 0xf7: return; + + default: + break; } sb_ct1745_mixer_write(addr, val, dev->sb); @@ -446,8 +480,8 @@ cmi8x38_sb_mixer_write(uint16_t addr, uint8_t val, void *priv) /* No [3F:47] controls. */ mixer->input_gain_L = 0; mixer->input_gain_R = 0; - mixer->output_gain_L = (double) 1.0; - mixer->output_gain_R = (double) 1.0; + mixer->output_gain_L = 1.0; + mixer->output_gain_R = 1.0; mixer->bass_l = 8; mixer->bass_r = 8; mixer->treble_l = 8; @@ -1201,8 +1235,14 @@ cmi8x38_poll(void *priv) return; } break; + + default: + break; } break; + + default: + break; } /* Feed silence if the FIFO is empty. */ diff --git a/src/sound/snd_cms.c b/src/sound/snd_cms.c index b451dea30..3c048b5da 100644 --- a/src/sound/snd_cms.c +++ b/src/sound/snd_cms.c @@ -10,17 +10,16 @@ #include <86box/io.h> #include <86box/snd_cms.h> #include <86box/sound.h> +#include <86box/plat_unused.h> void cms_update(cms_t *cms) { for (; cms->pos < sound_pos_global; cms->pos++) { - int c; - int d; int16_t out_l = 0; int16_t out_r = 0; - for (c = 0; c < 4; c++) { + for (uint8_t c = 0; c < 4; c++) { switch (cms->noisetype[c >> 1][c & 1]) { case 0: cms->noisefreq[c >> 1][c & 1] = MASTER_CLOCK / 256; @@ -34,11 +33,14 @@ cms_update(cms_t *cms) case 3: cms->noisefreq[c >> 1][c & 1] = cms->freq[c >> 1][(c & 1) * 3]; break; + + default: + break; } } - for (c = 0; c < 2; c++) { + for (uint8_t c = 0; c < 2; c++) { if (cms->regs[c][0x1C] & 1) { - for (d = 0; d < 6; d++) { + for (uint8_t d = 0; d < 6; d++) { if (cms->regs[c][0x14] & (1 << d)) { if (cms->stat[c][d]) out_l += (cms->vol[c][d][0] * 90); @@ -56,7 +58,7 @@ cms_update(cms_t *cms) out_r += (cms->vol[c][d][0] * 90); } } - for (d = 0; d < 2; d++) { + for (uint8_t d = 0; d < 2; d++) { cms->noisecount[c][d] += cms->noisefreq[c][d]; while (cms->noisecount[c][d] >= 24000) { cms->noisecount[c][d] -= 24000; @@ -73,9 +75,9 @@ cms_update(cms_t *cms) } void -cms_get_buffer(int32_t *buffer, int len, void *p) +cms_get_buffer(int32_t *buffer, int len, void *priv) { - cms_t *cms = (cms_t *) p; + cms_t *cms = (cms_t *) priv; cms_update(cms); @@ -86,9 +88,9 @@ cms_get_buffer(int32_t *buffer, int len, void *p) } void -cms_write(uint16_t addr, uint8_t val, void *p) +cms_write(uint16_t addr, uint8_t val, void *priv) { - cms_t *cms = (cms_t *) p; + cms_t *cms = (cms_t *) priv; int voice; int chip = (addr & 2) >> 1; @@ -138,19 +140,25 @@ cms_write(uint16_t addr, uint8_t val, void *p) cms->noisetype[chip][0] = val & 3; cms->noisetype[chip][1] = (val >> 4) & 3; break; + + default: + break; } break; case 0x6: case 0x7: cms->latched_data = val; break; + + default: + break; } } uint8_t -cms_read(uint16_t addr, void *p) +cms_read(uint16_t addr, void *priv) { - cms_t *cms = (cms_t *) p; + cms_t *cms = (cms_t *) priv; switch (addr & 0xf) { case 0x1: @@ -162,12 +170,15 @@ cms_read(uint16_t addr, void *p) case 0xa: case 0xb: return cms->latched_data; + + default: + break; } return 0xff; } void * -cms_init(const device_t *info) +cms_init(UNUSED(const device_t *info)) { cms_t *cms = malloc(sizeof(cms_t)); memset(cms, 0, sizeof(cms_t)); @@ -179,9 +190,9 @@ cms_init(const device_t *info) } void -cms_close(void *p) +cms_close(void *priv) { - cms_t *cms = (cms_t *) p; + cms_t *cms = (cms_t *) priv; free(cms); } diff --git a/src/sound/snd_cs423x.c b/src/sound/snd_cs423x.c index 58b217fbd..3604bd4b2 100644 --- a/src/sound/snd_cs423x.c +++ b/src/sound/snd_cs423x.c @@ -36,6 +36,7 @@ #include <86box/snd_ad1848.h> #include <86box/snd_opl.h> #include <86box/snd_sb.h> +#include <86box/plat_unused.h> #define CRYSTAL_NOEEPROM 0x100 @@ -133,14 +134,32 @@ typedef struct cs423x_t { ad1848_t ad1848; sb_t *sb; void *gameport; - void *i2c, *eeprom; + void *i2c; + void *eeprom; - uint16_t wss_base, opl_base, sb_base, ctrl_base, ram_addr, eeprom_size : 11, pnp_offset; - uint8_t type, ad1848_type, regs[8], indirect_regs[16], - eeprom_data[2048], ram_data[65536], ram_dl : 2, opl_wss : 1; - char *nvr_path; + uint16_t wss_base; + uint16_t opl_base; + uint16_t sb_base; + uint16_t ctrl_base; + uint16_t ram_addr; + uint16_t eeprom_size : 11; + uint16_t pnp_offset; + uint8_t type; + uint8_t ad1848_type; + uint8_t regs[8]; + uint8_t indirect_regs[16]; + uint8_t eeprom_data[2048]; + uint8_t ram_data[65536]; + uint8_t ram_dl : 2; + uint8_t opl_wss : 1; + char *nvr_path; - uint8_t pnp_enable : 1, key_pos : 5, slam_enable : 1, slam_state : 2, slam_ld, slam_reg; + uint8_t pnp_enable : 1; + uint8_t key_pos : 5; + uint8_t slam_enable : 1; + uint8_t slam_state : 2; + uint8_t slam_ld; + uint8_t slam_reg; isapnp_device_config_t *slam_config; } cs423x_t; @@ -198,6 +217,9 @@ cs423x_read(uint16_t addr, void *priv) ret |= 0x20; break; + + default: + break; } return ret; @@ -264,6 +286,9 @@ cs423x_write(uint16_t addr, uint8_t val, void *priv) dev->ad1848.wten = !!(val & 0x08); ad1848_updatevolmask(&dev->ad1848); break; + + default: + break; } dev->indirect_regs[dev->regs[3]] = val; break; @@ -274,7 +299,7 @@ cs423x_write(uint16_t addr, uint8_t val, void *priv) switch (val) { case 0x55: /* Disable PnP Key */ dev->pnp_enable = 0; - /* fall-through */ + [[fallthrough]]; case 0x5a: /* Update Hardware Configuration Data */ cs423x_pnp_enable(dev, 0, 1); @@ -290,6 +315,9 @@ cs423x_write(uint16_t addr, uint8_t val, void *priv) case 0xaa: /* Download RAM */ dev->ram_dl = 1; break; + + default: + break; } break; @@ -306,6 +334,9 @@ cs423x_write(uint16_t addr, uint8_t val, void *priv) case 3: /* data */ dev->ram_data[dev->ram_addr++] = val; break; + + default: + break; } break; @@ -321,13 +352,16 @@ cs423x_write(uint16_t addr, uint8_t val, void *priv) case 7: /* Global Status */ return; + + default: + break; } dev->regs[reg] = val; } static void -cs423x_slam_write(uint16_t addr, uint8_t val, void *priv) +cs423x_slam_write(UNUSED(uint16_t addr), uint8_t val, void *priv) { cs423x_t *dev = (cs423x_t *) priv; uint8_t idx; @@ -441,11 +475,17 @@ cs423x_slam_write(uint16_t addr, uint8_t val, void *priv) /* Activate or deactivate the device. */ dev->slam_config->activate = val & 0x01; break; + + default: + break; } /* Prepare for the next register, unless a two-byte read returns above. */ dev->slam_state = CRYSTAL_SLAM_INDEX; break; + + default: + break; } } @@ -467,7 +507,7 @@ cs423x_slam_enable(cs423x_t *dev, uint8_t enable) } static void -cs423x_ctxswitch_write(uint16_t addr, uint8_t val, void *priv) +cs423x_ctxswitch_write(uint16_t addr, UNUSED(uint8_t val), void *priv) { cs423x_t *dev = (cs423x_t *) priv; uint8_t ctx = (dev->regs[7] & 0x80); @@ -542,7 +582,9 @@ cs423x_pnp_enable(cs423x_t *dev, uint8_t update_rom, uint8_t update_hwconfig) /* But wait! The TriGem Delhi-III BIOS sends command 0x55, and its behavior doesn't line up with real hardware (still listed in the POST summary and seen by software). Disable the PnP key disabling mechanism until someone figures something out. */ - // isapnp_enable_card(dev->pnp_card, ((dev->ram_data[0x4002] & 0x20) || !dev->pnp_enable) ? ISAPNP_CARD_NO_KEY : ISAPNP_CARD_ENABLE); +#if 0 + isapnp_enable_card(dev->pnp_card, ((dev->ram_data[0x4002] & 0x20) || !dev->pnp_enable) ? ISAPNP_CARD_NO_KEY : ISAPNP_CARD_ENABLE); +#endif if ((dev->ram_data[0x4002] & 0x20) || !dev->pnp_enable) pclog("CS423x: Attempted to disable PnP key\n"); } @@ -674,6 +716,9 @@ cs423x_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv } break; + + default: + break; } } @@ -764,6 +809,9 @@ cs423x_init(const device_t *info) dev->eeprom_data[26] = 0x38; dev->nvr_path = "cs4238b.nvr"; break; + + default: + break; } /* Load EEPROM contents from file if present. */ @@ -775,6 +823,9 @@ cs423x_init(const device_t *info) dev->gameport = gameport_add(((dev->type == CRYSTAL_CS4235) || (dev->type == CRYSTAL_CS4236B)) ? &gameport_pnp_device : &gameport_pnp_6io_device); break; + + default: + break; } /* Initialize I2C bus for the EEPROM. */ diff --git a/src/sound/snd_emu8k.c b/src/sound/snd_emu8k.c index 99a703d14..ad00461f1 100644 --- a/src/sound/snd_emu8k.c +++ b/src/sound/snd_emu8k.c @@ -17,81 +17,90 @@ #include <86box/sound.h> #include <86box/snd_emu8k.h> #include <86box/timer.h> +#include <86box/plat_unused.h> #if !defined FILTER_INITIAL && !defined FILTER_MOOG && !defined FILTER_CONSTANT -// #define FILTER_INITIAL +#if 0 +#define FILTER_INITIAL +#endif # define FILTER_MOOG -// #define FILTER_CONSTANT +#if 0 +#define FILTER_CONSTANT +#endif #endif #if !defined RESAMPLER_LINEAR && !defined RESAMPLER_CUBIC -// #define RESAMPLER_LINEAR +#if 0 +#define RESAMPLER_LINEAR +#endif # define RESAMPLER_CUBIC #endif -// #define EMU8K_DEBUG_REGISTERS +#if 0 +#define EMU8K_DEBUG_REGISTERS +#endif char *PORT_NAMES[][8] = { - /* Data 0 ( 0x620/0x622) */ + /* Data 0 ( 0x620/0x622) */ { - "AWE_CPF", - "AWE_PTRX", - "AWE_CVCF", - "AWE_VTFT", - "Unk-620-4", - "Unk-620-5", - "AWE_PSST", - "AWE_CSL", - }, - /* Data 1 0xA20 */ + "AWE_CPF", + "AWE_PTRX", + "AWE_CVCF", + "AWE_VTFT", + "Unk-620-4", + "Unk-620-5", + "AWE_PSST", + "AWE_CSL", + }, + /* Data 1 0xA20 */ { - "AWE_CCCA", - 0, - /* - "AWE_HWCF4" - "AWE_HWCF5" - "AWE_HWCF6" - "AWE_HWCF7" - "AWE_SMALR" - "AWE_SMARR" - "AWE_SMALW" - "AWE_SMARW" - "AWE_SMLD" - "AWE_SMRD" - "AWE_WC" - "AWE_HWCF1" - "AWE_HWCF2" - "AWE_HWCF3" - */ - 0, //"AWE_INIT1", - 0, //"AWE_INIT3", + "AWE_CCCA", + 0, + /* + "AWE_HWCF4" + "AWE_HWCF5" + "AWE_HWCF6" + "AWE_HWCF7" + "AWE_SMALR" + "AWE_SMARR" + "AWE_SMALW" + "AWE_SMARW" + "AWE_SMLD" + "AWE_SMRD" + "AWE_WC" + "AWE_HWCF1" + "AWE_HWCF2" + "AWE_HWCF3" + */ + 0, //"AWE_INIT1", + 0, //"AWE_INIT3", "AWE_ENVVOL", - "AWE_DCYSUSV", - "AWE_ENVVAL", - "AWE_DCYSUS", - }, - /* Data 2 0xA22 */ + "AWE_DCYSUSV", + "AWE_ENVVAL", + "AWE_DCYSUS", + }, + /* Data 2 0xA22 */ { - "AWE_CCCA", - 0, - 0, //"AWE_INIT2", - 0, //"AWE_INIT4", + "AWE_CCCA", + 0, + 0, //"AWE_INIT2", + 0, //"AWE_INIT4", "AWE_ATKHLDV", - "AWE_LFO1VAL", - "AWE_ATKHLD", - "AWE_LFO2VAL", - }, - /* Data 3 0xE20 */ + "AWE_LFO1VAL", + "AWE_ATKHLD", + "AWE_LFO2VAL", + }, + /* Data 3 0xE20 */ { - "AWE_IP", - "AWE_IFATN", - "AWE_PEFE", - "AWE_FMMOD", - "AWE_TREMFRQ", - "AWE_FM2FRQ2", - 0, - 0, - }, + "AWE_IP", + "AWE_IFATN", + "AWE_PEFE", + "AWE_FMMOD", + "AWE_TREMFRQ", + "AWE_FM2FRQ2", + 0, + 0, + }, }; enum { @@ -143,13 +152,13 @@ static int32_t env_attack_to_samples[128]; * In other words, the unit of the table is the 1/21845th of a dB per sample frame, to be added or * substracted to the accumulating value_db of the envelope. */ static int32_t env_decay_to_dbs_or_oct[128] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 32, - 33, 34, 36, 38, 39, 41, 43, 45, 49, 51, 53, 55, 58, 60, 63, 66, - 69, 72, 75, 78, 82, 85, 89, 93, 97, 102, 106, 111, 116, 121, 126, 132, - 138, 144, 150, 157, 164, 171, 179, 186, 195, 203, 212, 222, 232, 243, 253, 264, - 276, 288, 301, 315, 328, 342, 358, 374, 390, 406, 425, 444, 466, 485, 506, 528, - 553, 580, 602, 634, 660, 689, 721, 755, 780, 820, 849, 897, 932, 970, 1012, 1057, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 32, + 33, 34, 36, 38, 39, 41, 43, 45, 49, 51, 53, 55, 58, 60, 63, 66, + 69, 72, 75, 78, 82, 85, 89, 93, 97, 102, 106, 111, 116, 121, 126, 132, + 138, 144, 150, 157, 164, 171, 179, 186, 195, 203, 212, 222, 232, 243, 253, 264, + 276, 288, 301, 315, 328, 342, 358, 374, 390, 406, 425, 444, 466, 485, 506, 528, + 553, 580, 602, 634, 660, 689, 721, 755, 780, 820, 849, 897, 932, 970, 1012, 1057, 1106, 1160, 1219, 1285, 1321, 1399, 1441, 1534, 1585, 1640, 1698, 1829, 1902, 1981, 2068, 2162 }; @@ -158,17 +167,19 @@ static int32_t env_decay_to_dbs_or_oct[128] = { * I tried calculating it using the instructions in awe32p10 from Judge Dredd, but the formula there * is wrong. * + */ +#if 0 static int32_t env_decay_to_millis[128] = { -0, 45120, 22614, 15990, 11307, 9508, 7995, 6723, 5653, 5184, 4754, 4359, 3997, 3665, 3361, 3082, -2828, 2765, 2648, 2535, 2428, 2325, 2226, 2132, 2042, 1955, 1872, 1793, 1717, 1644, 1574, 1507, -1443, 1382, 1324, 1267, 1214, 1162, 1113, 1066, 978, 936, 897, 859, 822, 787, 754, 722, -691, 662, 634, 607, 581, 557, 533, 510, 489, 468, 448, 429, 411, 393, 377, 361, -345, 331, 317, 303, 290, 278, 266, 255, 244, 234, 224, 214, 205, 196, 188, 180, -172, 165, 158, 151, 145, 139, 133, 127, 122, 117, 112, 107, 102, 98, 94, 90, -86, 82, 79, 75, 72, 69, 66, 63, 61, 58, 56, 53, 51, 49, 47, 45, -43, 41, 39, 37, 36, 34, 33, 31, 30, 29, 28, 26, 25, 24, 23, 22, + 0, 45120, 22614, 15990, 11307, 9508, 7995, 6723, 5653, 5184, 4754, 4359, 3997, 3665, 3361, 3082, + 2828, 2765, 2648, 2535, 2428, 2325, 2226, 2132, 2042, 1955, 1872, 1793, 1717, 1644, 1574, 1507, + 1443, 1382, 1324, 1267, 1214, 1162, 1113, 1066, 978, 936, 897, 859, 822, 787, 754, 722, + 691, 662, 634, 607, 581, 557, 533, 510, 489, 468, 448, 429, 411, 393, 377, 361, + 345, 331, 317, 303, 290, 278, 266, 255, 244, 234, 224, 214, 205, 196, 188, 180, + 172, 165, 158, 151, 145, 139, 133, 127, 122, 117, 112, 107, 102, 98, 94, 90, + 86, 82, 79, 75, 72, 69, 66, 63, 61, 58, 56, 53, 51, 49, 47, 45, + 43, 41, 39, 37, 36, 34, 33, 31, 30, 29, 28, 26, 25, 24, 23, 22, }; -*/ +#endif /* Table represeting the LFO waveform (signed 16bits with 32768 max int. >> 15 to move back to +/-1 range). */ static int32_t lfotable[65536]; @@ -348,7 +359,9 @@ EMU8K_READ_INTERP_CUBIC(emu8k_t *emu8k, uint32_t int_addr, uint16_t fract) * the card could use two oscillators (usually 31 and 32) where it would * be writing the OPL3 output, and to which, chorus and reverb could be applied to get * those effects for OPL3 sounds.*/ - // if ((addr & EMU8K_FM_MEM_ADDRESS) == EMU8K_FM_MEM_ADDRESS) {} +#if 0 + if ((addr & EMU8K_FM_MEM_ADDRESS) == EMU8K_FM_MEM_ADDRESS) {} +#endif /* This is cubic interpolation. * Not the same than 3-point interpolation, but a better approximation than linear @@ -383,9 +396,9 @@ EMU8K_WRITE(emu8k_t *emu8k, uint32_t addr, uint16_t val) } uint16_t -emu8k_inw(uint16_t addr, void *p) +emu8k_inw(uint16_t addr, void *priv) { - emu8k_t *emu8k = (emu8k_t *) p; + emu8k_t *emu8k = (emu8k_t *) priv; uint16_t ret = 0xffff; #ifdef EMU8K_DEBUG_REGISTERS @@ -557,6 +570,9 @@ emu8k_inw(uint16_t addr, void *p) case 7: READ16(addr, emu8k->voice[emu8k->cur_voice].csl); return ret; + + default: + break; } break; @@ -611,6 +627,9 @@ emu8k_inw(uint16_t addr, void *p) | ((emu8k->hwcf3 & 0x08) ? 0x20 : 0) | ((emu8k->hwcf3 & 0x10) ? 0x80 : 0); case 31: /*Configuration Word 3*/ return emu8k->hwcf2 & 0x1f; + + default: + break; } break; @@ -631,6 +650,9 @@ emu8k_inw(uint16_t addr, void *p) case 7: return emu8k->voice[emu8k->cur_voice].dcysus; + + default: + break; } break; @@ -690,6 +712,9 @@ emu8k_inw(uint16_t addr, void *p) the amount of calls and wait time */ case 27: /*Sample Counter ( 44Khz clock) */ return emu8k->wc; + + default: + break; } break; @@ -710,6 +735,9 @@ emu8k_inw(uint16_t addr, void *p) case 7: return emu8k->voice[emu8k->cur_voice].lfo2val; + + default: + break; } break; @@ -738,6 +766,9 @@ emu8k_inw(uint16_t addr, void *p) case 7: /*ID?*/ return 0x1c | ((emu8k->id & 0x0002) ? 0xff02 : 0); + + default: + break; } break; @@ -749,15 +780,18 @@ emu8k_inw(uint16_t addr, void *p) * cubic player has a similar code, where it waits until value & 0x1000 is nonzero, and then waits again until it changes to zero.*/ random_helper = (random_helper + 1) & 0x1F; return ((0x80 | random_helper) << 8) | (emu8k->cur_reg << 5) | emu8k->cur_voice; + + default: + break; } emu8k_log("EMU8K READ : Unknown register read: %04X-%02X(%d/%d) \n", addr, (emu8k->cur_reg << 5) | emu8k->cur_voice, emu8k->cur_reg, emu8k->cur_voice); return 0xffff; } void -emu8k_outw(uint16_t addr, uint16_t val, void *p) +emu8k_outw(uint16_t addr, uint16_t val, void *priv) { - emu8k_t *emu8k = (emu8k_t *) p; + emu8k_t *emu8k = (emu8k_t *) priv; /*TODO: I would like to not call this here, but i found it was needed or else cubic player would not finish opening (take a looot more of time than usual). * Basically, being here means that the audio is generated in the emulation thread, instead of the audio thread.*/ @@ -879,6 +913,9 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p) /* TODO: Should we update only on MSB update, or this could be used as some sort of hack by applications? */ emu8k->voice[emu8k->cur_voice].loop_end.int_address = emu8k->voice[emu8k->cur_voice].csl & EMU8K_MEM_ADDRESS_MASK; return; + + default: + break; } break; @@ -933,6 +970,9 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p) case 31: emu8k->hwcf3 = val; return; + + default: + break; } break; @@ -966,17 +1006,29 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p) case 0x9: emu8k->reverb_engine.reflections[0].feedback = (val & 0xF) / 15.0; break; - case 0xB: // emu8k->reverb_engine.reflections[0].feedback_r = (val&0xF)/15.0; + case 0xB: +#if 0 + emu8k->reverb_engine.reflections[0].feedback_r = (val&0xF)/15.0; +#endif break; case 0x11: emu8k->reverb_engine.reflections[1].feedback = (val & 0xF) / 15.0; break; - case 0x13: // emu8k->reverb_engine.reflections[1].feedback_r = (val&0xF)/15.0; + case 0x13: +#if 0 + emu8k->reverb_engine.reflections[1].feedback_r = (val&0xF)/15.0; +#endif break; case 0x19: emu8k->reverb_engine.reflections[2].feedback = (val & 0xF) / 15.0; break; - case 0x1B: // emu8k->reverb_engine.reflections[2].feedback_r = (val&0xF)/15.0; + case 0x1B: +#if 0 + emu8k->reverb_engine.reflections[2].feedback_r = (val&0xF)/15.0; +#endif + break; + + default: break; } } @@ -998,7 +1050,13 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p) case 1: emu8k->reverb_engine.refl_in_amp = val & 0xFF; break; - case 3: // emu8k->reverb_engine.refl_in_amp_r = val&0xFF; + case 3: +#if 0 + emu8k->reverb_engine.refl_in_amp_r = val&0xFF; +#endif + break; + + default: break; } } @@ -1105,6 +1163,9 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p) } } return; + + default: + break; } break; @@ -1180,6 +1241,9 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p) EMU8K_WRITE(emu8k, emu8k->smarw, val); emu8k->smarw++; return; + + default: + break; } break; @@ -1230,17 +1294,29 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p) case 0x1: emu8k->reverb_engine.reflections[3].feedback = (val & 0xF) / 15.0; break; - case 0x3: // emu8k->reverb_engine.reflections[3].feedback_r = (val&0xF)/15.0; + case 0x3: +#if 0 + emu8k->reverb_engine.reflections[3].feedback_r = (val&0xF)/15.0; +#endif break; case 0x9: emu8k->reverb_engine.reflections[4].feedback = (val & 0xF) / 15.0; break; - case 0xb: // emu8k->reverb_engine.reflections[4].feedback_r = (val&0xF)/15.0; + case 0xb: +#if 0 + emu8k->reverb_engine.reflections[4].feedback_r = (val&0xF)/15.0; +#endif break; case 0x11: emu8k->reverb_engine.reflections[5].feedback = (val & 0xF) / 15.0; break; - case 0x13: // emu8k->reverb_engine.reflections[5].feedback_r = (val&0xF)/15.0; + case 0x13: +#if 0 + emu8k->reverb_engine.reflections[5].feedback_r = (val&0xF)/15.0; +#endif + break; + + default: break; } } @@ -1261,6 +1337,9 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p) case 0x1F: emu8k->reverb_engine.link_return_amp = val & 0xFF; break; + + default: + break; } } return; @@ -1346,6 +1425,9 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p) emu8k->voice[emu8k->cur_voice].lfo2_delay_samples = LFOxVAL_TO_EMU_SAMPLES(val); return; + + default: + break; } break; @@ -1429,6 +1511,9 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p) case 7: /*ID? I believe that this allows applications to know if the emu is in use by another application */ emu8k->id = val; return; + + default: + break; } break; @@ -1436,30 +1521,33 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p) emu8k->cur_voice = (val & 31); emu8k->cur_reg = ((val >> 5) & 7); return; + + default: + break; } emu8k_log("EMU8K WRITE: Unknown register write: %04X-%02X(%d/%d): %04X \n", addr, (emu8k->cur_reg) << 5 | emu8k->cur_voice, emu8k->cur_reg, emu8k->cur_voice, val); } uint8_t -emu8k_inb(uint16_t addr, void *p) +emu8k_inb(uint16_t addr, void *priv) { /* Reading a single byte is a feature that at least Impulse tracker uses, * but only on detection code and not for odd addresses.*/ if (addr & 1) - return emu8k_inw(addr & ~1, p) >> 1; - return emu8k_inw(addr, p) & 0xff; + return emu8k_inw(addr & ~1, priv) >> 1; + return emu8k_inw(addr, priv) & 0xff; } void -emu8k_outb(uint16_t addr, uint8_t val, void *p) +emu8k_outb(uint16_t addr, uint8_t val, void *priv) { /* TODO: AWE32 docs says that you cannot write in bytes, but if * an app were to use this implementation, the content of the LS Byte would be lost.*/ if (addr & 1) - emu8k_outw(addr & ~1, val << 8, p); + emu8k_outw(addr & ~1, val << 8, priv); else - emu8k_outw(addr, val, p); + emu8k_outw(addr, val, priv); } /* TODO: This is not a correct emulation, just a workalike implementation. */ @@ -1468,7 +1556,9 @@ emu8k_work_chorus(int32_t *inbuf, int32_t *outbuf, emu8k_chorus_eng_t *engine, i { for (int pos = 0; pos < count; pos++) { double lfo_inter1 = chortable[engine->lfo_pos.int_address]; - // double lfo_inter2 = chortable[(engine->lfo_pos.int_address+1)&0xFFFF]; +#if 0 + double lfo_inter2 = chortable[(engine->lfo_pos.int_address+1)&0xFFFF]; +#endif double offset_lfo = lfo_inter1; //= lfo_inter1 + ((lfo_inter2-lfo_inter1)*engine->lfo_pos.fract_address/65536.0); offset_lfo *= engine->lfodepth_multip; @@ -1567,10 +1657,14 @@ emu8k_reverb_tail_work(emu8k_reverb_combfilter_t *comb, emu8k_reverb_combfilter_ /* store new value in delayed buffer */ comb->reflection[comb->read_pos] = in; - // output = emu8k_reverb_allpass_work(&allpasses[0],output); +#if 0 + output = emu8k_reverb_allpass_work(&allpasses[0],output); +#endif output = emu8k_reverb_diffuser_work(&allpasses[1], output); output = emu8k_reverb_diffuser_work(&allpasses[2], output); - // output = emu8k_reverb_allpass_work(&allpasses[3],output); +#if 0 + output = emu8k_reverb_allpass_work(&allpasses[3],output); +#endif if (++comb->read_pos >= comb->bufsize) comb->read_pos = 0; @@ -1636,7 +1730,7 @@ emu8k_work_reverb(int32_t *inbuf, int32_t *outbuf, emu8k_reverb_eng_t *engine, i } } void -emu8k_work_eq(int32_t *inoutbuf, int count) +emu8k_work_eq(UNUSED(int32_t *inoutbuf), UNUSED(int count)) { // TODO: Work EQ over buf } @@ -1656,9 +1750,11 @@ emu8k_vol_slide(emu8k_slide_t *slide, int32_t target) return slide->last; } -// int32_t old_pitch[32]={0}; -// int32_t old_cut[32]={0}; -// int32_t old_vol[32]={0}; +#if 0 +int32_t old_pitch[32] = { 0 }; +int32_t old_cut[32] = { 0 }; +int32_t old_vol[32] = { 0 }; +#endif void emu8k_update(emu8k_t *emu8k) { @@ -1861,6 +1957,9 @@ emu8k_update(emu8k_t *emu8k) case ENV_STOPPED: attenuation = 0x1FFFFF; break; + + default: + break; } emu8k_envelope_t *modenv = &emu_voice->mod_envelope; @@ -1912,6 +2011,9 @@ emu8k_update(emu8k_t *emu8k) modenv->state = ENV_SUSTAIN; } break; + + default: + break; } /* run lfos */ @@ -2009,11 +2111,13 @@ emu8k_update(emu8k_t *emu8k) emu_voice->ccca = (((uint32_t) emu_voice->ccca_qcontrol) << 24) | emu_voice->addr.int_address; emu_voice->cpf_curr_frac_addr = emu_voice->addr.fract_address; - // if ( emu_voice->cvcf_curr_volume != old_vol[c]) { - // pclog("EMUVOL (%d):%d\n", c, emu_voice->cvcf_curr_volume); - // old_vol[c]=emu_voice->cvcf_curr_volume; - // } - // pclog("EMUFILT :%d\n", emu_voice->cvcf_curr_filt_ctoff); +#if 0 + if (emu_voice->cvcf_curr_volume != old_vol[c]) { + pclog("EMUVOL (%d):%d\n", c, emu_voice->cvcf_curr_volume); + old_vol[c]=emu_voice->cvcf_curr_volume; + } + pclog("EMUFILT :%d\n", emu_voice->cvcf_curr_filt_ctoff); +#endif } buf = &emu8k->buffer[emu8k->pos * 2]; @@ -2142,8 +2246,10 @@ emu8k_init(emu8k_t *emu8k, uint16_t emu_addr, int onboard_ram) * Important: Using 65535 as max output value because this is intended to be used with the volume target register! */ out = 65535.0; for (c = 0; c < 0x10000; c++) { - // double db = -(c*6.0205999/65535.0)*16.0; - // out = powf(10.f,db/20.f) * 65536.0; +#if 0 + double db = -(c*6.0205999/65535.0)*16.0; + out = powf(10.f,db/20.f) * 65536.0; +#endif env_vol_db_to_vol_target[c] = (int32_t) out; /* calculated from the 65536th root of 65536 */ out /= 1.00016923970; diff --git a/src/sound/snd_gus.c b/src/sound/snd_gus.c index 9dfd7269b..6b6936c28 100644 --- a/src/sound/snd_gus.c +++ b/src/sound/snd_gus.c @@ -17,6 +17,7 @@ #include <86box/sound.h> #include <86box/timer.h> #include <86box/snd_ad1848.h> +#include <86box/plat_unused.h> enum { MIDI_INT_RECEIVE = 0x01, @@ -48,28 +49,42 @@ typedef struct gus_t { int reset; int global; - uint32_t addr, dmaaddr; + uint32_t addr; + uint32_t dmaaddr; int voice; - uint32_t start[32], end[32], cur[32]; - uint32_t startx[32], endx[32], curx[32]; - int rstart[32], rend[32]; + uint32_t start[32]; + uint32_t end[32]; + uint32_t cur[32]; + uint32_t startx[32]; + uint32_t endx[32]; + uint32_t curx[32]; + int rstart[32]; + int rend[32]; int rcur[32]; uint16_t freq[32]; uint16_t rfreq[32]; uint8_t ctrl[32]; uint8_t rctrl[32]; int curvol[32]; - int pan_l[32], pan_r[32]; - int t1on, t2on; + int pan_l[32]; + int pan_r[32]; + int t1on; + int t2on; uint8_t tctrl; - uint16_t t1, t2, t1l, t2l; - uint8_t irqstatus, irqstatus2; + uint16_t t1; + uint16_t t2; + uint16_t t1l; + uint16_t t2l; + uint8_t irqstatus; + uint8_t irqstatus2; uint8_t adcommand; - int waveirqs[32], rampirqs[32]; + int waveirqs[32]; + int rampirqs[32]; int voices; uint8_t dmactrl; - int32_t out_l, out_r; + int32_t out_l; + int32_t out_r; int16_t buffer[2][SOUNDBUFLEN]; int pos; @@ -82,27 +97,41 @@ typedef struct gus_t { int irqnext; - pc_timer_t timer_1, timer_2; + pc_timer_t timer_1; + pc_timer_t timer_2; - int irq, dma, irq_midi; + int irq; + int dma; + int irq_midi; uint16_t base; int latch_enable; - uint8_t sb_2xa, sb_2xc, sb_2xe; + uint8_t sb_2xa; + uint8_t sb_2xc; + uint8_t sb_2xe; uint8_t sb_ctrl; int sb_nmi; uint8_t reg_ctrl; - uint8_t ad_status, ad_data; + uint8_t ad_status; + uint8_t ad_data; uint8_t ad_timer_ctrl; - uint8_t midi_ctrl, midi_status, midi_queue[64], midi_data; - int midi_r, midi_w; - int uart_in, uart_out, sysex; + uint8_t midi_ctrl; + uint8_t midi_status; + uint8_t midi_queue[64]; + uint8_t midi_data; + int midi_r; + int midi_w; + int uart_in; + int uart_out; + int sysex; - uint8_t gp1, gp2; - uint16_t gp1_addr, gp2_addr; + uint8_t gp1; + uint8_t gp2; + uint16_t gp1_addr; + uint16_t gp2_addr; uint8_t usrr; @@ -127,13 +156,12 @@ double vol16bit[4096]; void gus_update_int_status(gus_t *gus) { - int c; int irq_pending = 0; int midi_irq_pending = 0; gus->irqstatus &= ~0x60; gus->irqstatus2 = 0xE0; - for (c = 0; c < 32; c++) { + for (uint8_t c = 0; c < 32; c++) { if (gus->waveirqs[c]) { gus->irqstatus2 = 0x60 | c; if (gus->rampirqs[c]) @@ -199,9 +227,9 @@ gus_midi_update_int_status(gus_t *gus) } void -writegus(uint16_t addr, uint8_t val, void *p) +writegus(uint16_t addr, uint8_t val, void *priv) { - gus_t *gus = (gus_t *) p; + gus_t *gus = (gus_t *) priv; int c; int d; int old; @@ -299,6 +327,9 @@ writegus(uint16_t addr, uint8_t val, void *p) gus->tctrl = val; gus_update_int_status(gus); break; + + default: + break; } break; case 0x305: /*Global high*/ @@ -479,6 +510,9 @@ writegus(uint16_t addr, uint8_t val, void *p) case 0x4c: /*Reset*/ gus->reset = val; break; + + default: + break; } break; case 0x307: /*DRAM access*/ @@ -566,6 +600,9 @@ writegus(uint16_t addr, uint8_t val, void *p) break; case 6: break; + + default: + break; } break; @@ -589,7 +626,7 @@ writegus(uint16_t addr, uint8_t val, void *p) else if (gus->irq != -1) picint(1 << gus->irq); } - /*FALLTHROUGH*/ + [[fallthrough]]; case 0x20d: gus->sb_2xc = val; break; @@ -619,13 +656,16 @@ writegus(uint16_t addr, uint8_t val, void *p) } #endif break; + + default: + break; } } uint8_t -readgus(uint16_t addr, void *p) +readgus(uint16_t addr, void *priv) { - gus_t *gus = (gus_t *) p; + gus_t *gus = (gus_t *) priv; uint8_t val = 0xff; uint16_t port; @@ -717,6 +757,9 @@ readgus(uint16_t addr, void *p) case 0x0f: val = 0xff; break; + + default: + break; } break; case 0x305: /*Global high*/ @@ -777,6 +820,9 @@ readgus(uint16_t addr, void *p) case 0x0f: val = 0xff; break; + + default: + break; } break; case 0x306: @@ -787,7 +833,6 @@ readgus(uint16_t addr, void *p) val = 0xff; /*Pre 3.7 - no mixer*/ break; - break; case 0x307: /*DRAM access*/ val = gus->ram[gus->addr]; gus->addr &= 0xFFFFF; @@ -813,6 +858,9 @@ readgus(uint16_t addr, void *p) case 4: val = gus->gp2_addr; break; + + default: + break; } break; @@ -848,14 +896,17 @@ readgus(uint16_t addr, void *p) case 0x20A: val = gus->adcommand; break; + + default: + break; } return val; } void -gus_poll_timer_1(void *p) +gus_poll_timer_1(void *priv) { - gus_t *gus = (gus_t *) p; + gus_t *gus = (gus_t *) priv; timer_advance_u64(&gus->timer_1, (uint64_t) (TIMER_USEC * 80)); if (gus->t1on) { @@ -879,9 +930,9 @@ gus_poll_timer_1(void *p) } void -gus_poll_timer_2(void *p) +gus_poll_timer_2(void *priv) { - gus_t *gus = (gus_t *) p; + gus_t *gus = (gus_t *) priv; timer_advance_u64(&gus->timer_2, (uint64_t) (TIMER_USEC * 320)); if (gus->t2on) { @@ -922,9 +973,9 @@ gus_update(gus_t *gus) } void -gus_poll_wave(void *p) +gus_poll_wave(void *priv) { - gus_t *gus = (gus_t *) p; + gus_t *gus = (gus_t *) priv; uint32_t addr; int16_t v; int32_t vl; @@ -1055,9 +1106,9 @@ gus_poll_wave(void *p) } static void -gus_get_buffer(int32_t *buffer, int len, void *p) +gus_get_buffer(int32_t *buffer, int len, void *priv) { - gus_t *gus = (gus_t *) p; + gus_t *gus = (gus_t *) priv; #if defined(DEV_BRANCH) && defined(USE_GUSMAX) if (gus->max_ctrl) @@ -1121,7 +1172,7 @@ gus_input_sysex(void *p, uint8_t *buffer, uint32_t len, int abort) } void * -gus_init(const device_t *info) +gus_init(UNUSED(const device_t *info)) { int c; double out = 1.0; @@ -1180,18 +1231,18 @@ gus_init(const device_t *info) } void -gus_close(void *p) +gus_close(void *priv) { - gus_t *gus = (gus_t *) p; + gus_t *gus = (gus_t *) priv; free(gus->ram); free(gus); } void -gus_speed_changed(void *p) +gus_speed_changed(void *priv) { - gus_t *gus = (gus_t *) p; + gus_t *gus = (gus_t *) priv; if (gus->voices < 14) gus->samp_latch = (uint64_t) (TIMER_USEC * (1000000.0 / 44100.0)); diff --git a/src/sound/snd_lpt_dac.c b/src/sound/snd_lpt_dac.c index c0712d8be..8fb526f14 100644 --- a/src/sound/snd_lpt_dac.c +++ b/src/sound/snd_lpt_dac.c @@ -11,11 +11,13 @@ #include <86box/machine.h> #include <86box/sound.h> #include <86box/timer.h> +#include <86box/plat_unused.h> typedef struct lpt_dac_t { void *lpt; - uint8_t dac_val_l, dac_val_r; + uint8_t dac_val_l; + uint8_t dac_val_r; int is_stereo; int channel; @@ -34,9 +36,9 @@ dac_update(lpt_dac_t *lpt_dac) } static void -dac_write_data(uint8_t val, void *p) +dac_write_data(uint8_t val, void *priv) { - lpt_dac_t *lpt_dac = (lpt_dac_t *) p; + lpt_dac_t *lpt_dac = (lpt_dac_t *) priv; if (lpt_dac->is_stereo) { if (lpt_dac->channel) @@ -49,24 +51,24 @@ dac_write_data(uint8_t val, void *p) } static void -dac_write_ctrl(uint8_t val, void *p) +dac_write_ctrl(uint8_t val, void *priv) { - lpt_dac_t *lpt_dac = (lpt_dac_t *) p; + lpt_dac_t *lpt_dac = (lpt_dac_t *) priv; if (lpt_dac->is_stereo) lpt_dac->channel = val & 0x01; } static uint8_t -dac_read_status(void *p) +dac_read_status(UNUSED(void *priv)) { return 0x0f; } static void -dac_get_buffer(int32_t *buffer, int len, void *p) +dac_get_buffer(int32_t *buffer, int len, void *priv) { - lpt_dac_t *lpt_dac = (lpt_dac_t *) p; + lpt_dac_t *lpt_dac = (lpt_dac_t *) priv; dac_update(lpt_dac); @@ -100,9 +102,9 @@ dac_stereo_init(void *lpt) return lpt_dac; } static void -dac_close(void *p) +dac_close(void *priv) { - lpt_dac_t *lpt_dac = (lpt_dac_t *) p; + lpt_dac_t *lpt_dac = (lpt_dac_t *) priv; free(lpt_dac); } diff --git a/src/sound/snd_lpt_dss.c b/src/sound/snd_lpt_dss.c index 9ae2ffdbe..a9bbcb507 100644 --- a/src/sound/snd_lpt_dss.c +++ b/src/sound/snd_lpt_dss.c @@ -11,15 +11,17 @@ #include <86box/machine.h> #include <86box/sound.h> #include <86box/timer.h> +#include <86box/plat_unused.h> typedef struct dss_t { void *lpt; uint8_t fifo[16]; - int read_idx, write_idx; + int read_idx; + int write_idx; - uint8_t dac_val, - status; + uint8_t dac_val; + uint8_t status; pc_timer_t timer; @@ -49,9 +51,9 @@ dss_update_status(dss_t *dss) } static void -dss_write_data(uint8_t val, void *p) +dss_write_data(uint8_t val, void *priv) { - dss_t *dss = (dss_t *) p; + dss_t *dss = (dss_t *) priv; if ((dss->write_idx - dss->read_idx) < 16) { dss->fifo[dss->write_idx & 15] = val; @@ -61,22 +63,23 @@ dss_write_data(uint8_t val, void *p) } static void -dss_write_ctrl(uint8_t val, void *p) +dss_write_ctrl(UNUSED(uint8_t val), UNUSED(void *priv)) { + // } static uint8_t -dss_read_status(void *p) +dss_read_status(void *priv) { - dss_t *dss = (dss_t *) p; + dss_t *dss = (dss_t *) priv; return dss->status | 0x0f; } static void -dss_get_buffer(int32_t *buffer, int len, void *p) +dss_get_buffer(int32_t *buffer, int len, void *priv) { - dss_t *dss = (dss_t *) p; + dss_t *dss = (dss_t *) priv; int16_t val; float fval; @@ -84,7 +87,7 @@ dss_get_buffer(int32_t *buffer, int len, void *p) for (int c = 0; c < len * 2; c += 2) { fval = dss_iir((float) dss->buffer[c >> 1]); - val = (float) fval; + val = fval; buffer[c] += val; buffer[c + 1] += val; @@ -94,9 +97,9 @@ dss_get_buffer(int32_t *buffer, int len, void *p) } static void -dss_callback(void *p) +dss_callback(void *priv) { - dss_t *dss = (dss_t *) p; + dss_t *dss = (dss_t *) priv; dss_update(dss); @@ -123,9 +126,9 @@ dss_init(void *lpt) return dss; } static void -dss_close(void *p) +dss_close(void *priv) { - dss_t *dss = (dss_t *) p; + dss_t *dss = (dss_t *) priv; free(dss); } diff --git a/src/sound/snd_mpu401.c b/src/sound/snd_mpu401.c index 0758393cc..5b1fa807b 100644 --- a/src/sound/snd_mpu401.c +++ b/src/sound/snd_mpu401.c @@ -38,6 +38,7 @@ #include <86box/timer.h> #include <86box/snd_mpu401.h> #include <86box/sound.h> +#include <86box/plat_unused.h> static uint32_t MPUClockBase[8] = { 48, 72, 96, 120, 144, 168, 192 }; static uint8_t cth_data[16] = { 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0 }; @@ -52,7 +53,7 @@ int mpu401_standalone_enable = 0; static void MPU401_WriteCommand(mpu_t *mpu, uint8_t val); static void MPU401_IntelligentOut(mpu_t *mpu, uint8_t track); static void MPU401_EOIHandler(void *priv); -static void MPU401_EOIHandlerDispatch(void *p); +static void MPU401_EOIHandlerDispatch(void *priv); static void MPU401_NotesOff(mpu_t *mpu, int i); #ifdef ENABLE_MPU401_LOG @@ -137,7 +138,7 @@ MPU401_RunClock(mpu_t *mpu) } static void -MPU401_QueueByteEx(mpu_t *mpu, uint8_t data, int irq) +MPU401_QueueByteEx(mpu_t *mpu, uint8_t data, UNUSED(int irq)) { if (mpu->state.block_ack) { mpu->state.block_ack = 0; @@ -186,7 +187,7 @@ MPU401_IRQPending(mpu_t *mpu) } static void -MPU401_RecQueueBuffer(mpu_t *mpu, uint8_t *buf, uint32_t len, int block) +MPU401_RecQueueBuffer(mpu_t *mpu, uint8_t *buf, uint32_t len, UNUSED(int block)) { uint32_t cnt = 0; int pos; @@ -405,6 +406,9 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val) mpu->clock.measure_counter = mpu->clock.meas_old; mpu->clock.cth_counter = mpu->clock.cth_old; break; + + default: + break; } switch (val & 0xc) { /* Playing */ case 0x4: /* Stop */ @@ -418,6 +422,9 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val) mpu->state.playing = 1; MPU401_StartClock(mpu); break; + + default: + break; } switch (val & 0x30) { /* Recording */ case 0: /* check if it waited for MIDI RT command */ @@ -450,6 +457,9 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val) MPU401_StartClock(mpu); } break; + + default: + break; } } MPU401_QueueByte(mpu, MSG_MPU_ACK); @@ -679,8 +689,11 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val) return; break; - /* default: - mpu401_log("MPU-401:Unhandled command %X",val); */ + default: +#if 0 + mpu401_log("MPU-401:Unhandled command %X",val); +#endif + break; } MPU401_QueueByte(mpu, MSG_MPU_ACK); @@ -793,7 +806,9 @@ MPU401_WriteData(mpu_t *mpu, uint8_t val) break; case 0xf0: - /* mpu401_log("MPU-401:Illegal WSD byte\n"); */ +#if 0 + mpu401_log("MPU-401:Illegal WSD byte\n"); +#endif mpu->state.wsd = 0; mpu->state.track = mpu->state.old_track; return; @@ -900,6 +915,9 @@ MPU401_WriteData(mpu_t *mpu, uint8_t val) mpu->state.data_onoff = -1; mpu->state.cond_req = 0; break; + + default: + break; } return; } @@ -944,7 +962,9 @@ MPU401_WriteData(mpu_t *mpu, uint8_t val) if (val == 0xf9) mpu->clock.measure_counter = 0; } else { - /* mpu401_log("MPU-401:Illegal message"); */ +#if 0 + mpu401_log("MPU-401:Illegal message"); +#endif mpu->playbuf[mpu->state.track].type = T_OVERFLOW; } mpu->state.data_onoff = -1; @@ -969,6 +989,9 @@ MPU401_WriteData(mpu_t *mpu, uint8_t val) MPU401_EOIHandler(mpu); } break; + + default: + break; } return; @@ -1022,6 +1045,9 @@ MPU401_IntelligentOut(mpu_t *mpu, uint8_t track) return; } break; + + default: + break; } if (retrigger) { midi_raw_out_byte(0x80 | chan); @@ -1130,7 +1156,7 @@ MPU401_EOIHandlerDispatch(void *priv) } static void -imf_write(uint16_t addr, uint8_t val, void *priv) +imf_write(UNUSED(uint16_t addr), UNUSED(uint8_t val), UNUSED(void *priv)) { mpu401_log("IMF:Wr %4X,%X\n", addr, val); } @@ -1245,6 +1271,9 @@ mpu401_write(uint16_t addr, uint8_t val, void *priv) MPU401_WriteCommand(mpu, val); mpu401_log("Write Command (0x331) %x\n", val); break; + + default: + break; } } @@ -1269,6 +1298,9 @@ mpu401_read(uint16_t addr, void *priv) mpu401_log("Read Status (0x331) %x\n", ret); break; + + default: + break; } /* mpu401_log("MPU401 Read Port %04X, ret %x\n", addr, ret); */ @@ -1520,8 +1552,11 @@ MPU401_InputMsg(void *p, uint8_t *msg, uint32_t len) } } } - break; } + break; + + default: + break; } } if ((msg[0] >= 0xf0) || (mpu->state.midi_mask & (1 << chan))) { @@ -1617,9 +1652,16 @@ MPU401_InputMsg(void *p, uint8_t *msg, uint32_t len) if (mpu->filter.rt_out) midi_raw_out_rt_byte(msg[0]); break; + + default: + break; } return; } + break; + + default: + break; } } if (send_thru && mpu->midi_thru) { @@ -1728,17 +1770,17 @@ mpu401_device_add(void) } static uint8_t -mpu401_mca_read(int port, void *p) +mpu401_mca_read(int port, void *priv) { - mpu_t *mpu = (mpu_t *) p; + mpu_t *mpu = (mpu_t *) priv; return mpu->pos_regs[port & 7]; } static void -mpu401_mca_write(int port, uint8_t val, void *p) +mpu401_mca_write(int port, uint8_t val, void *priv) { - mpu_t *mpu = (mpu_t *) p; + mpu_t *mpu = (mpu_t *) priv; uint16_t addr; if (port < 0x102) @@ -1762,7 +1804,7 @@ mpu401_mca_write(int port, uint8_t val, void *p) } static uint8_t -mpu401_mca_feedb(void *p) +mpu401_mca_feedb(UNUSED(void *priv)) { return 1; } diff --git a/src/sound/snd_opl_nuked.c b/src/sound/snd_opl_nuked.c index 20b956b1d..046e09273 100644 --- a/src/sound/snd_opl_nuked.c +++ b/src/sound/snd_opl_nuked.c @@ -125,9 +125,9 @@ typedef struct chan { uint8_t con; uint8_t alg; uint8_t ksv; - uint16_t cha, - chb; - uint8_t ch_num; + uint16_t cha; + uint16_t chb; + uint8_t ch_num; } chan_t; typedef struct wrbuf { @@ -177,12 +177,14 @@ typedef struct chip { typedef struct { nuked_t opl; - int8_t flags, pad; + int8_t flags; + int8_t pad; uint16_t port; - uint8_t status, timer_ctrl; - uint16_t timer_count[2], - timer_cur_count[2]; + uint8_t status; + uint8_t timer_ctrl; + uint16_t timer_count[2]; + uint16_t timer_cur_count[2]; pc_timer_t timers[2]; @@ -543,6 +545,9 @@ env_calc(slot_t *slot) case envelope_gen_num_release: reg_rate = slot->reg_rr; break; + + default: + break; } slot->pg_reset = reset; @@ -619,6 +624,9 @@ env_calc(slot_t *slot) if (!eg_off && !reset && shift > 0) eg_inc = 1 << (shift - 1); break; + + default: + break; } slot->eg_rout = (eg_rout + eg_inc) & 0x1ff; @@ -810,6 +818,9 @@ channel_setup_alg(chan_t *ch) ch->slots[0]->mod = &ch->slots[0]->fbmod; ch->slots[1]->mod = &ch->dev->zeromod; break; + + default: + break; } return; } @@ -867,6 +878,9 @@ channel_setup_alg(chan_t *ch) ch->out[2] = &ch->slots[1]->out; ch->out[3] = &ch->dev->zeromod; break; + + default: + break; } } else switch (ch->alg & 0x01) { @@ -887,6 +901,9 @@ channel_setup_alg(chan_t *ch) ch->out[2] = &ch->dev->zeromod; ch->out[3] = &ch->dev->zeromod; break; + + default: + break; } } @@ -1128,12 +1145,18 @@ nuked_write_reg(void *priv, uint16_t reg, uint8_t val) case 0x05: dev->newm = val & 0x01; break; + + default: + break; } else switch (regm & 0x0f) { case 0x08: dev->nts = (val >> 6) & 0x01; break; + + default: + break; } break; @@ -1191,6 +1214,9 @@ nuked_write_reg(void *priv, uint16_t reg, uint8_t val) if (ad_slot[regm & 0x1f] >= 0) slot_write_e0(&dev->slot[18 * high + ad_slot[regm & 0x1f]], val); break; + + default: + break; } } @@ -1576,6 +1602,9 @@ nuked_drv_write(uint16_t port, uint8_t val, void *priv) nuked_log("Status mask now %02X (val = %02X)\n", (val & ~CTRL_TMR_MASK) & CTRL_TMR_MASK, val); } break; + + default: + break; } } else { dev->port = nuked_write_addr(&dev->opl, port, val) & 0x01ff; diff --git a/src/sound/snd_opl_ymfm.cpp b/src/sound/snd_opl_ymfm.cpp index 8390bc1ed..c6cf13a33 100644 --- a/src/sound/snd_opl_ymfm.cpp +++ b/src/sound/snd_opl_ymfm.cpp @@ -29,6 +29,7 @@ extern "C" { #include <86box/snd_opl.h> #include <86box/mem.h> #include <86box/rom.h> +#include <86box/plat_unused.h> // Disable c99-designator to avoid the warnings in *_ymfm_device #ifdef __clang__ @@ -50,7 +51,7 @@ enum { class YMFMChipBase { public: - YMFMChipBase(uint32_t clock, fm_type type, uint32_t samplerate) + YMFMChipBase(uint32_t clock, fm_type type, UNUSED(uint32_t samplerate)) : m_buf_pos(0) , m_flags(0) , m_type(type) @@ -295,8 +296,8 @@ ymfm_drv_init(const device_t *info) YMFMChipBase *fm; switch (info->local) { - case FM_YM3812: default: + case FM_YM3812: fm = (YMFMChipBase *) new YMFMChip(3579545, FM_YM3812, OPL_FREQ); break; diff --git a/src/sound/snd_optimc.c b/src/sound/snd_optimc.c index 11aea6896..d7afca382 100644 --- a/src/sound/snd_optimc.c +++ b/src/sound/snd_optimc.c @@ -38,6 +38,7 @@ #include <86box/snd_sb.h> #include <86box/mem.h> #include <86box/rom.h> +#include <86box/plat_unused.h> static int optimc_wss_dma[4] = { 0, 0, 1, 3 }; static int optimc_wss_irq[8] = { 5, 7, 9, 10, 11, 12, 14, 15 }; @@ -48,14 +49,21 @@ enum optimc_local_flags { }; typedef struct optimc_t { - uint8_t type, fm_type; + uint8_t type; + uint8_t fm_type; - uint8_t wss_config, reg_enabled; + uint8_t wss_config; + uint8_t reg_enabled; - uint16_t cur_addr, cur_wss_addr, cur_mpu401_addr; + uint16_t cur_addr; + uint16_t cur_wss_addr; + uint16_t cur_mpu401_addr; - int cur_irq, cur_dma; - int cur_wss_enabled, cur_wss_irq, cur_wss_dma; + int cur_irq; + int cur_dma; + int cur_wss_enabled; + int cur_wss_irq; + int cur_wss_dma; int cur_mpu401_irq; int cur_mpu401_enabled; void *gameport; @@ -82,9 +90,9 @@ optimc_filter_opl(void *priv, double *out_l, double *out_r) } static uint8_t -optimc_wss_read(uint16_t addr, void *priv) +optimc_wss_read(UNUSED(uint16_t addr), void *priv) { - optimc_t *optimc = (optimc_t *) priv; + const optimc_t *optimc = (optimc_t *) priv; if (!(optimc->regs[4] & 0x10) && optimc->cur_mode == 0) return 0xFF; @@ -93,7 +101,7 @@ optimc_wss_read(uint16_t addr, void *priv) } static void -optimc_wss_write(uint16_t addr, uint8_t val, void *priv) +optimc_wss_write(UNUSED(uint16_t addr), uint8_t val, void *priv) { optimc_t *optimc = (optimc_t *) priv; @@ -105,9 +113,9 @@ optimc_wss_write(uint16_t addr, uint8_t val, void *priv) } static void -optimc_get_buffer(int32_t *buffer, int len, void *p) +optimc_get_buffer(int32_t *buffer, int len, void *priv) { - optimc_t *optimc = (optimc_t *) p; + optimc_t *optimc = (optimc_t *) priv; if (optimc->regs[3] & 0x4) return; @@ -141,9 +149,9 @@ optimc_add_opl(optimc_t *optimc) } static void -optimc_reg_write(uint16_t addr, uint8_t val, void *p) +optimc_reg_write(uint16_t addr, uint8_t val, void *priv) { - optimc_t *optimc = (optimc_t *) p; + optimc_t *optimc = (optimc_t *) priv; uint16_t idx = addr - 0xF8D; uint8_t old = optimc->regs[idx]; static uint8_t reg_enable_phase = 0; @@ -176,6 +184,9 @@ optimc_reg_write(uint16_t addr, uint8_t val, void *p) case 3: /* WSBase = 0x604 */ optimc->cur_wss_addr = 0x604; break; + + default: + break; } io_sethandler(optimc->cur_wss_addr, 0x0004, optimc_wss_read, NULL, NULL, optimc_wss_write, NULL, NULL, optimc); io_sethandler(optimc->cur_wss_addr + 0x0004, 0x0004, ad1848_read, NULL, NULL, ad1848_write, NULL, NULL, &optimc->ad1848); @@ -247,6 +258,9 @@ optimc_reg_write(uint16_t addr, uint8_t val, void *p) case 3: optimc->cur_mpu401_irq = 7; break; + + default: + break; } switch ((val >> 5) & 0x3) { case 0: @@ -261,11 +275,17 @@ optimc_reg_write(uint16_t addr, uint8_t val, void *p) case 3: optimc->cur_mpu401_addr = 0x300; break; + + default: + break; } mpu401_change_addr(optimc->mpu, optimc->cur_mpu401_addr); mpu401_setirq(optimc->mpu, optimc->cur_mpu401_irq); } break; + + default: + break; } } if (optimc->reg_enabled) @@ -291,6 +311,9 @@ optimc_reg_write(uint16_t addr, uint8_t val, void *p) reg_enable_phase = 1; } break; + + default: + break; } } else reg_enable_phase = 1; @@ -299,9 +322,9 @@ optimc_reg_write(uint16_t addr, uint8_t val, void *p) } static uint8_t -optimc_reg_read(uint16_t addr, void *p) +optimc_reg_read(uint16_t addr, void *priv) { - optimc_t *optimc = (optimc_t *) p; + optimc_t *optimc = (optimc_t *) priv; uint8_t temp = 0xFF; if (optimc->reg_enabled) { @@ -316,6 +339,9 @@ optimc_reg_read(uint16_t addr, void *p) case 2: /* MC3 */ temp = (optimc->regs[2] & ~0x3) | 0x2; break; + + default: + break; } optimc->reg_enabled = 0; } @@ -398,19 +424,19 @@ optimc_init(const device_t *info) } static void -optimc_close(void *p) +optimc_close(void *priv) { - optimc_t *optimc = (optimc_t *) p; + optimc_t *optimc = (optimc_t *) priv; sb_close(optimc->sb); free(optimc->mpu); - free(p); + free(priv); } static void -optimc_speed_changed(void *p) +optimc_speed_changed(void *priv) { - optimc_t *optimc = (optimc_t *) p; + optimc_t *optimc = (optimc_t *) priv; ad1848_speed_changed(&optimc->ad1848); sb_speed_changed(optimc->sb); diff --git a/src/sound/snd_pas16.c b/src/sound/snd_pas16.c index 10e6bd1c4..da87df56a 100644 --- a/src/sound/snd_pas16.c +++ b/src/sound/snd_pas16.c @@ -20,6 +20,7 @@ #include <86box/snd_opl.h> #include <86box/snd_sb.h> #include <86box/snd_sb_dsp.h> +#include <86box/plat_unused.h> /* Original PAS uses 2 x OPL2 @@ -97,39 +98,51 @@ typedef struct pas16_t { uint16_t base; - int irq, dma; + int irq; + int dma; uint8_t audiofilt; uint8_t audio_mixer; - uint8_t compat, compat_base; + uint8_t compat; + uint8_t compat_base; uint8_t enhancedscsi; - uint8_t io_conf_1, io_conf_2, io_conf_3, io_conf_4; + uint8_t io_conf_1; + uint8_t io_conf_2; + uint8_t io_conf_3; + uint8_t io_conf_4; - uint8_t irq_stat, irq_ena; + uint8_t irq_stat; + uint8_t irq_ena; uint8_t pcm_ctrl; uint16_t pcm_dat; - uint16_t pcm_dat_l, pcm_dat_r; + uint16_t pcm_dat_l; + uint16_t pcm_dat_r; uint8_t sb_irqdma; int stereo_lr; - uint8_t sys_conf_1, sys_conf_2, sys_conf_3, sys_conf_4; + uint8_t sys_conf_1; + uint8_t sys_conf_2; + uint8_t sys_conf_3; + uint8_t sys_conf_4; - struct - { + struct { uint32_t l[3]; int64_t c[3]; pc_timer_t timer[3]; uint8_t m[3]; - uint8_t ctrl, ctrls[2]; - int wp, rm[3], wm[3]; + uint8_t ctrl; + uint8_t ctrls[2]; + int wp; + int rm[3]; + int wm[3]; uint16_t rl[3]; int thit[3]; int delay[3]; @@ -192,9 +205,9 @@ pas16_log(const char *fmt, ...) #endif static uint8_t -pas16_in(uint16_t port, void *p) +pas16_in(uint16_t port, void *priv) { - pas16_t *pas16 = (pas16_t *) p; + pas16_t *pas16 = (pas16_t *) priv; uint8_t temp = 0xff; switch ((port - pas16->base) + 0x388) { case 0x388: @@ -286,15 +299,18 @@ pas16_in(uint16_t port, void *p) case 0xff8b: /*Master mode read*/ temp = 0x20 | 0x10 | 0x01; /*AT bus, XT/AT timing*/ break; + + default: + break; } pas16_log("pas16_in : port %04X return %02X %04X:%04X\n", port, temp, CS, cpu_state.pc); return temp; } static void -pas16_out(uint16_t port, uint8_t val, void *p) +pas16_out(uint16_t port, uint8_t val, void *priv) { - pas16_t *pas16 = (pas16_t *) p; + pas16_t *pas16 = (pas16_t *) priv; pas16_log("pas16_out : port %04X val %02X %04X:%04X\n", port, val, CS, cpu_state.pc); switch ((port - pas16->base) + 0x388) { case 0x388: @@ -409,9 +425,9 @@ pas16_out(uint16_t port, uint8_t val, void *p) } static void -pas16_pit_out(uint16_t port, uint8_t val, void *p) +pas16_pit_out(uint16_t port, uint8_t val, void *priv) { - pas16_t *pas16 = (pas16_t *) p; + pas16_t *pas16 = (pas16_t *) priv; int t; switch (port & 3) { case 3: /*CTRL*/ @@ -496,6 +512,9 @@ pas16_pit_out(uint16_t port, uint8_t val, void *p) pas16->pit.l[t] |= val; pas16->pit.wm[t] = 0; break; + + default: + break; } if (!pas16->pit.l[t]) { pas16->pit.l[t] |= 0x10000; @@ -504,13 +523,16 @@ pas16_pit_out(uint16_t port, uint8_t val, void *p) timer_set_delay_u64(&pas16->pit.timer[t], pas16->pit.c[t] * PITCONST); } break; + + default: + break; } } static uint8_t -pas16_pit_in(uint16_t port, void *p) +pas16_pit_in(uint16_t port, void *priv) { - pas16_t *pas16 = (pas16_t *) p; + pas16_t *pas16 = (pas16_t *) priv; uint8_t temp = 0xff; int t = port & 3; switch (port & 3) { @@ -550,11 +572,17 @@ pas16_pit_in(uint16_t port, void *p) else pas16->pit.rm[t] = 0; break; + + default: + break; } break; case 3: /*Control*/ temp = pas16->pit.ctrl; break; + + default: + break; } return temp; } @@ -566,9 +594,9 @@ pas16_readdma(pas16_t *pas16) } static void -pas16_pcm_poll(void *p) +pas16_pcm_poll(void *priv) { - pas16_t *pas16 = (pas16_t *) p; + pas16_t *pas16 = (pas16_t *) priv; pas16_update(pas16); if (pas16->pit.m[0] & 2) { @@ -633,9 +661,9 @@ pas16_pcm_poll(void *p) } static void -pas16_out_base(uint16_t port, uint8_t val, void *p) +pas16_out_base(UNUSED(uint16_t port), uint8_t val, void *priv) { - pas16_t *pas16 = (pas16_t *) p; + pas16_t *pas16 = (pas16_t *) priv; io_removehandler((pas16->base - 0x388) + 0x0388, 0x0004, pas16_in, NULL, NULL, pas16_out, NULL, NULL, pas16); io_removehandler((pas16->base - 0x388) + 0x0788, 0x0004, pas16_in, NULL, NULL, pas16_out, NULL, NULL, pas16); @@ -696,9 +724,9 @@ pas16_update(pas16_t *pas16) } void -pas16_get_buffer(int32_t *buffer, int len, void *p) +pas16_get_buffer(int32_t *buffer, int len, void *priv) { - pas16_t *pas16 = (pas16_t *) p; + pas16_t *pas16 = (pas16_t *) priv; int32_t *opl_buf = pas16->opl.update(pas16->opl.priv); sb_dsp_update(&pas16->dsp); @@ -715,7 +743,7 @@ pas16_get_buffer(int32_t *buffer, int len, void *p) } static void * -pas16_init(const device_t *info) +pas16_init(UNUSED(const device_t *info)) { pas16_t *pas16 = malloc(sizeof(pas16_t)); memset(pas16, 0, sizeof(pas16_t)); @@ -733,9 +761,9 @@ pas16_init(const device_t *info) } static void -pas16_close(void *p) +pas16_close(void *priv) { - pas16_t *pas16 = (pas16_t *) p; + pas16_t *pas16 = (pas16_t *) priv; free(pas16); } diff --git a/src/sound/snd_ps1.c b/src/sound/snd_ps1.c index d440af9d0..60b4515f8 100644 --- a/src/sound/snd_ps1.c +++ b/src/sound/snd_ps1.c @@ -13,15 +13,18 @@ #include <86box/sound.h> #include <86box/snd_sn76489.h> #include <86box/timer.h> +#include <86box/plat_unused.h> -typedef struct { +typedef struct ps1snd_t { sn76489_t sn76489; - uint8_t status, ctrl; + uint8_t status; + uint8_t ctrl; uint64_t timer_latch; pc_timer_t timer_count; int timer_enable; uint8_t fifo[2048]; - int fifo_read_idx, fifo_write_idx; + int fifo_read_idx; + int fifo_write_idx; int fifo_threshold; uint8_t dac_val; int16_t buffer[SOUNDBUFLEN]; @@ -73,6 +76,10 @@ ps1snd_read(uint16_t port, void *priv) case 6: case 7: ret = 0; + break; + + default: + break; } return ret; @@ -109,6 +116,9 @@ ps1snd_write(uint16_t port, uint8_t val, void *priv) case 4: /* almost empty */ ps1snd->fifo_threshold = val * 4; break; + + default: + break; } } @@ -154,7 +164,7 @@ ps1snd_get_buffer(int32_t *buffer, int len, void *priv) } static void * -ps1snd_init(const device_t *info) +ps1snd_init(UNUSED(const device_t *info)) { ps1snd_t *ps1snd = malloc(sizeof(ps1snd_t)); memset(ps1snd, 0x00, sizeof(ps1snd_t)); diff --git a/src/sound/snd_pssj.c b/src/sound/snd_pssj.c index 705a83517..41bd7e885 100644 --- a/src/sound/snd_pssj.c +++ b/src/sound/snd_pssj.c @@ -12,6 +12,7 @@ #include <86box/sound.h> #include <86box/snd_sn76489.h> #include <86box/timer.h> +#include <86box/plat_unused.h> typedef struct pssj_t { sn76489_t sn76489; @@ -41,9 +42,9 @@ pssj_update_irq(pssj_t *pssj) } static void -pssj_write(uint16_t port, uint8_t val, void *p) +pssj_write(uint16_t port, uint8_t val, void *priv) { - pssj_t *pssj = (pssj_t *) p; + pssj_t *pssj = (pssj_t *) priv; switch (port & 3) { case 0: @@ -67,6 +68,9 @@ pssj_write(uint16_t port, uint8_t val, void *p) case 3: /*Direct DAC*/ pssj->dac_val = val; break; + + default: + break; } break; case 2: @@ -76,12 +80,15 @@ pssj_write(uint16_t port, uint8_t val, void *p) pssj->freq = (pssj->freq & 0x0ff) | ((val & 0xf) << 8); pssj->amplitude = val >> 4; break; + + default: + break; } } static uint8_t -pssj_read(uint16_t port, void *p) +pssj_read(uint16_t port, void *priv) { - pssj_t *pssj = (pssj_t *) p; + pssj_t *pssj = (pssj_t *) priv; switch (port & 3) { case 0: @@ -96,6 +103,9 @@ pssj_read(uint16_t port, void *p) return 0x80; case 3: /*Direct DAC*/ return pssj->dac_val; + + default: + break; } break; case 2: @@ -117,9 +127,9 @@ pssj_update(pssj_t *pssj) } static void -pssj_callback(void *p) +pssj_callback(void *priv) { - pssj_t *pssj = (pssj_t *) p; + pssj_t *pssj = (pssj_t *) priv; int data; pssj_update(pssj); @@ -157,6 +167,9 @@ pssj_callback(void *p) case 0xc0: pssj->dac_val = 0x80; break; + + default: + break; } pssj->wave_pos = (pssj->wave_pos + 1) & 31; } @@ -165,9 +178,9 @@ pssj_callback(void *p) } static void -pssj_get_buffer(int32_t *buffer, int len, void *p) +pssj_get_buffer(int32_t *buffer, int len, void *priv) { - pssj_t *pssj = (pssj_t *) p; + pssj_t *pssj = (pssj_t *) priv; pssj_update(pssj); @@ -178,7 +191,7 @@ pssj_get_buffer(int32_t *buffer, int len, void *p) } void * -pssj_init(const device_t *info) +pssj_init(UNUSED(const device_t *info)) { pssj_t *pssj = malloc(sizeof(pssj_t)); memset(pssj, 0, sizeof(pssj_t)); @@ -193,7 +206,7 @@ pssj_init(const device_t *info) } void * -pssj_1e0_init(const device_t *info) +pssj_1e0_init(UNUSED(const device_t *info)) { pssj_t *pssj = malloc(sizeof(pssj_t)); memset(pssj, 0, sizeof(pssj_t)); @@ -208,7 +221,7 @@ pssj_1e0_init(const device_t *info) } void * -pssj_isa_init(const device_t *info) +pssj_isa_init(UNUSED(const device_t *info)) { pssj_t *pssj = malloc(sizeof(pssj_t)); memset(pssj, 0, sizeof(pssj_t)); @@ -225,9 +238,9 @@ pssj_isa_init(const device_t *info) } void -pssj_close(void *p) +pssj_close(void *priv) { - pssj_t *pssj = (pssj_t *) p; + pssj_t *pssj = (pssj_t *) priv; free(pssj); } diff --git a/src/sound/snd_resid.cc b/src/sound/snd_resid.cc index 68d9fa71c..94bbcd591 100644 --- a/src/sound/snd_resid.cc +++ b/src/sound/snd_resid.cc @@ -20,12 +20,16 @@ psid_t *psid; void * sid_init(void) { - // psid_t *psid; +#if 0 + psid_t *psid; +#endif sampling_method method = SAMPLE_INTERPOLATE; float cycles_per_sec = 14318180.0 / 16.0; psid = new psid_t; - // psid = (psid_t *)malloc(sizeof(sound_t)); +#if 0 + psid = (psid_t *)malloc(sizeof(sound_t)); +#endif psid->sid = new SIDFP; psid->sid->set_chip_model(MOS8580FP); @@ -42,9 +46,11 @@ sid_init(void) for (uint8_t c = 0; c < 32; c++) psid->sid->write(c, 0); - if (!psid->sid->set_sampling_parameters((float) cycles_per_sec, method, + if (!psid->sid->set_sampling_parameters(cycles_per_sec, method, (float) RESID_FREQ, 0.9 * (float) RESID_FREQ / 2.0)) { - // printf("reSID failed!\n"); +#if 0 + printf("reSID failed!\n"); +#endif } psid->sid->set_chip_model(MOS6581FP); @@ -58,17 +64,23 @@ sid_init(void) } void -sid_close(UNUSED(void *p)) +sid_close(UNUSED(void *priv)) { - // psid_t *psid = (psid_t *)p; +#if 0 + psid_t *psid = (psid_t *) priv; +#endif delete psid->sid; - // free(psid); +#if 0 + free(psid); +#endif } void -sid_reset(UNUSED(void *p)) +sid_reset(UNUSED(void *priv)) { - // psid_t *psid = (psid_t *)p; +#if 0 + psid_t *psid = (psid_t *) priv; +#endif psid->sid->reset(); @@ -77,18 +89,24 @@ sid_reset(UNUSED(void *p)) } uint8_t -sid_read(uint16_t addr, UNUSED(void *p)) +sid_read(uint16_t addr, UNUSED(void *priv)) { - // psid_t *psid = (psid_t *)p; +#if 0 + psid_t *psid = (psid_t *) priv; +#endif return psid->sid->read(addr & 0x1f); - // return 0xFF; +#if 0 + return 0xFF; +#endif } void -sid_write(uint16_t addr, uint8_t val, UNUSED(void *p)) +sid_write(uint16_t addr, uint8_t val, UNUSED(void *priv)) { - // psid_t *psid = (psid_t *)p; +#if 0 + psid_t *psid = (psid_t *) priv; +#endif psid->sid->write(addr & 0x1f, val); } @@ -105,9 +123,11 @@ fillbuf2(int &count, int16_t *buf, int len) psid->last_sample = *buf; } void -sid_fillbuf(int16_t *buf, int len, UNUSED(void *p)) +sid_fillbuf(int16_t *buf, int len, UNUSED(void *priv)) { - // psid_t *psid = (psid_t *)p; +#if 0 + psid_t *psid = (psid_t *) priv; +#endif int x = CLOCK_DELTA(len); fillbuf2(x, buf, len); diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index 9c25be7a1..3aca43963 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -41,6 +41,7 @@ #include <86box/sound.h> #include <86box/timer.h> #include <86box/snd_sb.h> +#include <86box/plat_unused.h> /* 0 to 7 -> -14dB to 0dB i 2dB steps. 8 to 15 -> 0 to +14dB in 2dB steps. Note that for positive dB values, this is not amplitude, it is amplitude - 1. */ @@ -177,9 +178,9 @@ sb_log(const char *fmt, ...) /* SB 1, 1.5, MCV, and 2 do not have a mixer, so signal is hardwired. */ static void -sb_get_buffer_sb2(int32_t *buffer, int len, void *p) +sb_get_buffer_sb2(int32_t *buffer, int len, void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; sb_ct1335_mixer_t *mixer = &sb->mixer_sb2; double out_mono = 0.0; double out_l = 0.0; @@ -245,9 +246,9 @@ sb_get_buffer_sb2(int32_t *buffer, int len, void *p) } static void -sb2_filter_cd_audio(int channel, double *buffer, void *p) +sb2_filter_cd_audio(UNUSED(int channel), double *buffer, void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; sb_ct1335_mixer_t *mixer = &sb->mixer_sb2; double c; @@ -255,15 +256,15 @@ sb2_filter_cd_audio(int channel, double *buffer, void *p) c = ((sb_iir(1, 0, *buffer) / 1.3) * mixer->cd) / 3.0; *buffer = c * mixer->master; } else { - c = (((sb_iir(1, 0, ((double) *buffer)) / 1.3) * 65536) / 3.0) / 65536.0; + c = (((sb_iir(1, 0, (*buffer)) / 1.3) * 65536) / 3.0) / 65536.0; *buffer = c; } } void -sb_get_buffer_sbpro(int32_t *buffer, int len, void *p) +sb_get_buffer_sbpro(int32_t *buffer, int len, void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; sb_ct1345_mixer_t *mixer = &sb->mixer_sbpro; double out_l = 0.0; double out_r = 0.0; @@ -281,7 +282,8 @@ sb_get_buffer_sbpro(int32_t *buffer, int len, void *p) sb_dsp_update(&sb->dsp); for (int c = 0; c < len * 2; c += 2) { - out_l = 0.0, out_r = 0.0; + out_l = 0.0; + out_r = 0.0; if (sb->opl_enabled) { if (sb->dsp.sb_type == SBPRO) { @@ -327,9 +329,9 @@ sb_get_buffer_sbpro(int32_t *buffer, int len, void *p) } void -sbpro_filter_cd_audio(int channel, double *buffer, void *p) +sbpro_filter_cd_audio(int channel, double *buffer, void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; sb_ct1345_mixer_t *mixer = &sb->mixer_sbpro; double c; double cd = channel ? mixer->cd_r : mixer->cd_l; @@ -343,9 +345,9 @@ sbpro_filter_cd_audio(int channel, double *buffer, void *p) } static void -sb_get_buffer_sb16_awe32(int32_t *buffer, int len, void *p) +sb_get_buffer_sb16_awe32(int32_t *buffer, int len, void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; sb_ct1745_mixer_t *mixer = &sb->mixer_sb16; int dsp_rec_pos = sb->dsp.record_pos_write; int c_emu8k = 0; @@ -477,9 +479,9 @@ sb_get_buffer_sb16_awe32(int32_t *buffer, int len, void *p) } void -sb16_awe32_filter_cd_audio(int channel, double *buffer, void *p) +sb16_awe32_filter_cd_audio(int channel, double *buffer, void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; sb_ct1745_mixer_t *mixer = &sb->mixer_sb16; double c; double cd = channel ? mixer->cd_r : mixer->cd_l /* / 3.0 */; @@ -519,9 +521,9 @@ sb16_awe32_filter_cd_audio(int channel, double *buffer, void *p) } void -sb_ct1335_mixer_write(uint16_t addr, uint8_t val, void *p) +sb_ct1335_mixer_write(uint16_t addr, uint8_t val, void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; sb_ct1335_mixer_t *mixer = &sb->mixer_sb2; if (!(addr & 1)) { @@ -558,9 +560,9 @@ sb_ct1335_mixer_write(uint16_t addr, uint8_t val, void *p) } uint8_t -sb_ct1335_mixer_read(uint16_t addr, void *p) +sb_ct1335_mixer_read(uint16_t addr, void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; sb_ct1335_mixer_t *mixer = &sb->mixer_sb2; if (!(addr & 1)) @@ -589,9 +591,9 @@ sb_ct1335_mixer_reset(sb_t *sb) } void -sb_ct1345_mixer_write(uint16_t addr, uint8_t val, void *p) +sb_ct1345_mixer_write(uint16_t addr, uint8_t val, void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; sb_ct1345_mixer_t *mixer = &sb->mixer_sbpro; if (!(addr & 1)) { @@ -685,9 +687,9 @@ sb_ct1345_mixer_write(uint16_t addr, uint8_t val, void *p) } uint8_t -sb_ct1345_mixer_read(uint16_t addr, void *p) +sb_ct1345_mixer_read(uint16_t addr, void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; sb_ct1345_mixer_t *mixer = &sb->mixer_sbpro; if (!(addr & 1)) @@ -727,9 +729,9 @@ sb_ct1345_mixer_reset(sb_t *sb) } void -sb_ct1745_mixer_write(uint16_t addr, uint8_t val, void *p) +sb_ct1745_mixer_write(uint16_t addr, uint8_t val, void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; sb_ct1745_mixer_t *mixer = &sb->mixer_sb16; if (!(addr & 1)) @@ -861,6 +863,9 @@ sb_ct1745_mixer_write(uint16_t addr, uint8_t val, void *p) mpu401_change_addr(sb->mpu, 0); } break; + + default: + break; } mixer->output_selector = mixer->regs[0x3c]; @@ -897,9 +902,9 @@ sb_ct1745_mixer_write(uint16_t addr, uint8_t val, void *p) } uint8_t -sb_ct1745_mixer_read(uint16_t addr, void *p) +sb_ct1745_mixer_read(uint16_t addr, void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; sb_ct1745_mixer_t *mixer = &sb->mixer_sb16; uint8_t temp; uint8_t ret = 0xff; @@ -974,6 +979,9 @@ sb_ct1745_mixer_read(uint16_t addr, void *p) case 10: ret = 8; break; + + default: + break; } break; @@ -996,6 +1004,9 @@ sb_ct1745_mixer_read(uint16_t addr, void *p) case 3: ret |= 8; break; + + default: + break; } switch (sb->dsp.sb_16_dmanum) { case 5: @@ -1007,6 +1018,9 @@ sb_ct1745_mixer_read(uint16_t addr, void *p) case 7: ret |= 0x80; break; + + default: + break; } break; @@ -1078,9 +1092,9 @@ sb_ct1745_mixer_reset(sb_t *sb) } uint8_t -sb_mcv_read(int port, void *p) +sb_mcv_read(int port, void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; sb_log("sb_mcv_read: port=%04x\n", port); @@ -1088,10 +1102,10 @@ sb_mcv_read(int port, void *p) } void -sb_mcv_write(int port, uint8_t val, void *p) +sb_mcv_write(int port, uint8_t val, void *priv) { uint16_t addr; - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; if (port < 0x102) return; @@ -1133,17 +1147,17 @@ sb_mcv_write(int port, uint8_t val, void *p) } uint8_t -sb_mcv_feedb(void *p) +sb_mcv_feedb(void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; return (sb->pos_regs[2] & 1); } static uint8_t -sb_pro_mcv_read(int port, void *p) +sb_pro_mcv_read(int port, void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; uint8_t ret = sb->pos_regs[port & 7]; sb_log("sb_pro_mcv_read: port=%04x ret=%02x\n", port, ret); @@ -1152,10 +1166,10 @@ sb_pro_mcv_read(int port, void *p) } static void -sb_pro_mcv_write(int port, uint8_t val, void *p) +sb_pro_mcv_write(int port, uint8_t val, void *priv) { uint16_t addr; - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; if (port < 0x102) return; @@ -1212,9 +1226,9 @@ sb_pro_mcv_write(int port, uint8_t val, void *p) } static uint8_t -sb_16_reply_mca_read(int port, void *p) +sb_16_reply_mca_read(int port, void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; uint8_t ret = sb->pos_regs[port & 7]; sb_log("sb_16_reply_mca_read: port=%04x ret=%02x\n", port, ret); @@ -1223,13 +1237,13 @@ sb_16_reply_mca_read(int port, void *p) } static void -sb_16_reply_mca_write(int port, uint8_t val, void *p) +sb_16_reply_mca_write(int port, uint8_t val, void *priv) { uint16_t addr; uint16_t mpu401_addr; int low_dma; int high_dma; - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; if (port < 0x102) return; @@ -1347,6 +1361,9 @@ sb_16_reply_mca_write(int port, uint8_t val, void *p) case 0x60: sb_dsp_setirq(&sb->dsp, 10); break; + + default: + break; } low_dma = sb->pos_regs[3] & 3; @@ -1458,6 +1475,9 @@ sb_16_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv) case 4: /* StereoEnhance (32) */ break; + + default: + break; } } @@ -1476,6 +1496,9 @@ sb_awe32_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *pr case 3: /* WaveTable */ sb_16_pnp_config_changed(ld ^ 1, config, sb); break; + + default: + break; } } @@ -1493,11 +1516,14 @@ sb_awe64_gold_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, voi case 1: /* Game */ sb_16_pnp_config_changed(3, config, sb); break; + + default: + break; } } void * -sb_1_init(const device_t *info) +sb_1_init(UNUSED(const device_t *info)) { /* SB1/2 port mappings, 210h to 260h in 10h steps 2x0 to 2x3 -> CMS chip @@ -1545,7 +1571,7 @@ sb_1_init(const device_t *info) } void * -sb_15_init(const device_t *info) +sb_15_init(UNUSED(const device_t *info)) { /* SB1/2 port mappings, 210h to 260h in 10h steps 2x0 to 2x3 -> CMS chip @@ -1595,7 +1621,7 @@ sb_15_init(const device_t *info) } void * -sb_mcv_init(const device_t *info) +sb_mcv_init(UNUSED(const device_t *info)) { /* SB1/2 port mappings, 210h to 260h in 10h steps 2x6, 2xA, 2xC, 2xE -> DSP chip @@ -1628,7 +1654,7 @@ sb_mcv_init(const device_t *info) } void * -sb_2_init(const device_t *info) +sb_2_init(UNUSED(const device_t *info)) { /* SB2 port mappings, 220h or 240h. 2x0 to 2x3 -> CMS chip @@ -1724,7 +1750,7 @@ sb_pro_v1_opl_write(uint16_t port, uint8_t val, void *priv) } static void * -sb_pro_v1_init(const device_t *info) +sb_pro_v1_init(UNUSED(const device_t *info)) { /* SB Pro port mappings, 220h or 240h. 2x0 to 2x3 -> FM chip, Left and Right (9*2 voices) @@ -1784,7 +1810,7 @@ sb_pro_v1_init(const device_t *info) } static void * -sb_pro_v2_init(const device_t *info) +sb_pro_v2_init(UNUSED(const device_t *info)) { /* SB Pro 2 port mappings, 220h or 240h. 2x0 to 2x3 -> FM chip (18 voices) @@ -1836,7 +1862,7 @@ sb_pro_v2_init(const device_t *info) } static void * -sb_pro_mcv_init(const device_t *info) +sb_pro_mcv_init(UNUSED(const device_t *info)) { /* SB Pro MCV port mappings, 220h or 240h. 2x0 to 2x3 -> FM chip, Left and Right (18 voices) @@ -1868,7 +1894,7 @@ sb_pro_mcv_init(const device_t *info) } static void * -sb_pro_compat_init(const device_t *info) +sb_pro_compat_init(UNUSED(const device_t *info)) { sb_t *sb = malloc(sizeof(sb_t)); memset(sb, 0, sizeof(sb_t)); @@ -1890,7 +1916,7 @@ sb_pro_compat_init(const device_t *info) } static void * -sb_16_init(const device_t *info) +sb_16_init(UNUSED(const device_t *info)) { sb_t *sb = malloc(sizeof(sb_t)); uint16_t addr = device_get_config_hex16("base"); @@ -1946,7 +1972,7 @@ sb_16_init(const device_t *info) } static void * -sb_16_reply_mca_init(const device_t *info) +sb_16_reply_mca_init(UNUSED(const device_t *info)) { sb_t *sb = malloc(sizeof(sb_t)); memset(sb, 0x00, sizeof(sb_t)); @@ -1981,7 +2007,7 @@ sb_16_reply_mca_init(const device_t *info) } static void * -sb_16_pnp_init(const device_t *info) +sb_16_pnp_init(UNUSED(const device_t *info)) { sb_t *sb = malloc(sizeof(sb_t)); memset(sb, 0x00, sizeof(sb_t)); @@ -2083,7 +2109,7 @@ sb_awe64_gold_available(void) } static void * -sb_awe32_init(const device_t *info) +sb_awe32_init(UNUSED(const device_t *info)) { sb_t *sb = malloc(sizeof(sb_t)); uint16_t addr = device_get_config_hex16("base"); @@ -2194,6 +2220,9 @@ sb_awe32_pnp_init(const device_t *info) case 4: pnp_rom_file = "roms/sound/CT4540 PnP.BIN"; break; + + default: + break; } uint8_t *pnp_rom = NULL; @@ -2220,6 +2249,9 @@ sb_awe32_pnp_init(const device_t *info) case 4: isapnp_add_card(pnp_rom, sizeof(sb->pnp_rom), sb_awe64_gold_pnp_config_changed, NULL, NULL, NULL, sb); break; + + default: + break; } sb_dsp_setaddr(&sb->dsp, 0); @@ -2238,18 +2270,18 @@ sb_awe32_pnp_init(const device_t *info) } void -sb_close(void *p) +sb_close(void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; sb_dsp_close(&sb->dsp); free(sb); } static void -sb_awe32_close(void *p) +sb_awe32_close(void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; emu8k_close(&sb->emu8k); @@ -2257,9 +2289,9 @@ sb_awe32_close(void *p) } void -sb_speed_changed(void *p) +sb_speed_changed(void *priv) { - sb_t *sb = (sb_t *) p; + sb_t *sb = (sb_t *) priv; sb_dsp_speed_changed(&sb->dsp); } diff --git a/src/sound/snd_sb_dsp.c b/src/sound/snd_sb_dsp.c index 5b9637a81..6f7cb44bc 100644 --- a/src/sound/snd_sb_dsp.c +++ b/src/sound/snd_sb_dsp.c @@ -25,6 +25,7 @@ #include <86box/sound.h> #include <86box/timer.h> #include <86box/snd_sb.h> +#include <86box/plat_unused.h> #define ADPCM_4 1 #define ADPCM_26 2 @@ -33,8 +34,8 @@ /*The recording safety margin is intended for uneven "len" calls to the get_buffer mixer calls on sound_sb*/ #define SB_DSP_REC_SAFEFTY_MARGIN 4096 -void pollsb(void *p); -void sb_poll_i(void *p); +void pollsb(void *priv); +void sb_poll_i(void *priv); static int sbe2dat[4][9] = { {0x01, -0x02, -0x04, 0x08, -0x10, 0x20, 0x40, -0x80, -106}, @@ -205,8 +206,8 @@ sb_update_status(sb_dsp_t *dsp, int bit, int set) int masked = 0; switch (bit) { - case 0: default: + case 0: dsp->sb_irq8 = set; masked = dsp->sb_irqm8; break; @@ -595,7 +596,7 @@ sb_exec_command(sb_dsp_t *dsp) case 0x75: /* 4-bit ADPCM output with reference */ dsp->sbref = dsp->dma_readb(dsp->dma_priv); dsp->sbstep = 0; - /* Fall through */ + [[fallthrough]]; case 0x74: /* 4-bit ADPCM output */ sb_start_dma(dsp, 1, 0, ADPCM_4, dsp->sb_data[0] + (dsp->sb_data[1] << 8)); dsp->sbdat2 = dsp->dma_readb(dsp->dma_priv); @@ -917,6 +918,9 @@ sb_exec_command(sb_dsp_t *dsp) * 0FCh DSP Auxiliary Status SB16 * 0FDh DSP Command Status SB16 */ + + default: + break; } /* Update 8051 ram with the last DSP command. @@ -1046,6 +1050,9 @@ sb_read(uint16_t a, void *priv) sb_dsp_log("SB 16-bit ACK read 0xFF\n"); ret = 0xff; break; + + default: + break; } return ret; @@ -1192,9 +1199,9 @@ sb_dsp_dma_attach(sb_dsp_t *dsp, } void -pollsb(void *p) +pollsb(void *priv) { - sb_dsp_t *dsp = (sb_dsp_t *) p; + sb_dsp_t *dsp = (sb_dsp_t *) priv; int tempi; int ref; int data[2]; @@ -1378,6 +1385,9 @@ pollsb(void *p) } else dsp->sbdatl = dsp->sbdatr = dsp->sbdat; break; + + default: + break; } if (dsp->sb_8_length < 0) { @@ -1426,6 +1436,9 @@ pollsb(void *p) dsp->sbdatr = data[1]; dsp->sb_16_length -= 2; break; + + default: + break; } if (dsp->sb_16_length < 0) { @@ -1451,9 +1464,9 @@ pollsb(void *p) } void -sb_poll_i(void *p) +sb_poll_i(void *priv) { - sb_dsp_t *dsp = (sb_dsp_t *) p; + sb_dsp_t *dsp = (sb_dsp_t *) priv; int processed = 0; timer_advance_u64(&dsp->input_timer, dsp->sblatchi); @@ -1486,6 +1499,9 @@ sb_poll_i(void *p) dsp->record_pos_read += 2; dsp->record_pos_read &= 0xFFFF; break; + + default: + break; } if (dsp->sb_8_length < 0) { @@ -1531,6 +1547,9 @@ sb_poll_i(void *p) dsp->record_pos_read += 2; dsp->record_pos_read &= 0xFFFF; break; + + default: + break; } if (dsp->sb_16_length < 0) { @@ -1565,6 +1584,7 @@ sb_dsp_update(sb_dsp_t *dsp) } void -sb_dsp_close(sb_dsp_t *dsp) +sb_dsp_close(UNUSED(sb_dsp_t *dsp)) { + // } diff --git a/src/sound/snd_sn76489.c b/src/sound/snd_sn76489.c index 56b3538d8..519219934 100644 --- a/src/sound/snd_sn76489.c +++ b/src/sound/snd_sn76489.c @@ -10,6 +10,7 @@ #include <86box/io.h> #include <86box/sound.h> #include <86box/snd_sn76489.h> +#include <86box/plat_unused.h> int sn76489_mute; @@ -33,7 +34,7 @@ sn76489_update(sn76489_t *sn76489) result += (int16_t) (volslog[sn76489->vol[c]] * 127); sn76489->count[c] -= (256 * sn76489->psgconst); - while ((int) sn76489->count[c] < 0) { + while (sn76489->count[c] < 0) { sn76489->count[c] += sn76489->latch[c]; sn76489->stat[c] = -sn76489->stat[c]; } @@ -41,7 +42,7 @@ sn76489_update(sn76489_t *sn76489) result += (((sn76489->shift & 1) ^ 1) * 127 * volslog[sn76489->vol[0]] * 2); sn76489->count[0] -= (512 * sn76489->psgconst); - while ((int) sn76489->count[0] < 0 && sn76489->latch[0]) { + while (sn76489->count[0] < 0 && sn76489->latch[0]) { sn76489->count[0] += (sn76489->latch[0] * 4); if (!(sn76489->noise & 4)) { if (sn76489->shift & 1) @@ -59,9 +60,9 @@ sn76489_update(sn76489_t *sn76489) } void -sn76489_get_buffer(int32_t *buffer, int len, void *p) +sn76489_get_buffer(int32_t *buffer, int len, void *priv) { - sn76489_t *sn76489 = (sn76489_t *) p; + sn76489_t *sn76489 = (sn76489_t *) priv; sn76489_update(sn76489); @@ -74,9 +75,9 @@ sn76489_get_buffer(int32_t *buffer, int len, void *p) } void -sn76489_write(uint16_t addr, uint8_t data, void *p) +sn76489_write(UNUSED(uint16_t addr), uint8_t data, void *priv) { - sn76489_t *sn76489 = (sn76489_t *) p; + sn76489_t *sn76489 = (sn76489_t *) priv; int freq; sn76489_update(sn76489); @@ -140,6 +141,9 @@ sn76489_write(uint16_t addr, uint8_t data, void *p) data &= 0xf; sn76489->vol[0] = 0xf - data; break; + + default: + break; } } else { if ((sn76489->firstdat & 0x70) == 0x60 && (sn76489->type == SN76496)) { @@ -197,7 +201,7 @@ sn76489_init(sn76489_t *sn76489, uint16_t base, uint16_t size, int type, int fre } void * -sn76489_device_init(const device_t *info) +sn76489_device_init(UNUSED(const device_t *info)) { sn76489_t *sn76489 = malloc(sizeof(sn76489_t)); memset(sn76489, 0, sizeof(sn76489_t)); @@ -208,7 +212,7 @@ sn76489_device_init(const device_t *info) } void * -ncr8496_device_init(const device_t *info) +ncr8496_device_init(UNUSED(const device_t *info)) { sn76489_t *sn76489 = malloc(sizeof(sn76489_t)); memset(sn76489, 0, sizeof(sn76489_t)); @@ -219,7 +223,7 @@ ncr8496_device_init(const device_t *info) } void * -tndy_device_init(const device_t *info) +tndy_device_init(UNUSED(const device_t *info)) { sn76489_t *sn76489 = malloc(sizeof(sn76489_t)); memset(sn76489, 0, sizeof(sn76489_t)); @@ -232,9 +236,9 @@ tndy_device_init(const device_t *info) } void -sn76489_device_close(void *p) +sn76489_device_close(void *priv) { - sn76489_t *sn76489 = (sn76489_t *) p; + sn76489_t *sn76489 = (sn76489_t *) priv; free(sn76489); } diff --git a/src/sound/snd_speaker.c b/src/sound/snd_speaker.c index babc8aee1..693c3afc3 100644 --- a/src/sound/snd_speaker.c +++ b/src/sound/snd_speaker.c @@ -26,6 +26,7 @@ #include <86box/pit.h> #include <86box/snd_speaker.h> #include <86box/sound.h> +#include <86box/plat_unused.h> int speaker_mute = 0; int speaker_gated = 0; @@ -85,7 +86,7 @@ speaker_update(void) } void -speaker_get_buffer(int32_t *buffer, int len, void *p) +speaker_get_buffer(int32_t *buffer, int len, UNUSED(void *priv)) { int32_t val; diff --git a/src/sound/snd_ssi2001.c b/src/sound/snd_ssi2001.c index 7c2a18f5a..1f3c294ce 100644 --- a/src/sound/snd_ssi2001.c +++ b/src/sound/snd_ssi2001.c @@ -12,6 +12,7 @@ #include <86box/io.h> #include <86box/snd_resid.h> #include <86box/sound.h> +#include <86box/plat_unused.h> typedef struct ssi2001_t { void *psid; @@ -31,9 +32,9 @@ ssi2001_update(ssi2001_t *ssi2001) } static void -ssi2001_get_buffer(int32_t *buffer, int len, void *p) +ssi2001_get_buffer(int32_t *buffer, int len, void *priv) { - ssi2001_t *ssi2001 = (ssi2001_t *) p; + ssi2001_t *ssi2001 = (ssi2001_t *) priv; ssi2001_update(ssi2001); @@ -44,26 +45,26 @@ ssi2001_get_buffer(int32_t *buffer, int len, void *p) } static uint8_t -ssi2001_read(uint16_t addr, void *p) +ssi2001_read(uint16_t addr, void *priv) { - ssi2001_t *ssi2001 = (ssi2001_t *) p; + ssi2001_t *ssi2001 = (ssi2001_t *) priv; ssi2001_update(ssi2001); - return sid_read(addr, p); + return sid_read(addr, priv); } static void -ssi2001_write(uint16_t addr, uint8_t val, void *p) +ssi2001_write(uint16_t addr, uint8_t val, void *priv) { - ssi2001_t *ssi2001 = (ssi2001_t *) p; + ssi2001_t *ssi2001 = (ssi2001_t *) priv; ssi2001_update(ssi2001); - sid_write(addr, val, p); + sid_write(addr, val, priv); } void * -ssi2001_init(const device_t *info) +ssi2001_init(UNUSED(const device_t *info)) { ssi2001_t *ssi2001 = malloc(sizeof(ssi2001_t)); memset(ssi2001, 0, sizeof(ssi2001_t)); @@ -80,9 +81,9 @@ ssi2001_init(const device_t *info) } void -ssi2001_close(void *p) +ssi2001_close(void *priv) { - ssi2001_t *ssi2001 = (ssi2001_t *) p; + ssi2001_t *ssi2001 = (ssi2001_t *) priv; sid_close(ssi2001->psid); diff --git a/src/sound/snd_wss.c b/src/sound/snd_wss.c index 274a0579e..64cb95c2c 100644 --- a/src/sound/snd_wss.c +++ b/src/sound/snd_wss.c @@ -33,6 +33,7 @@ #include <86box/timer.h> #include <86box/snd_ad1848.h> #include <86box/snd_opl.h> +#include <86box/plat_unused.h> /* 530, 11, 3 - 530=23 * 530, 11, 1 - 530=22 @@ -59,14 +60,14 @@ typedef struct wss_t { } wss_t; uint8_t -wss_read(uint16_t addr, void *priv) +wss_read(UNUSED(uint16_t addr), void *priv) { wss_t *wss = (wss_t *) priv; return 4 | (wss->config & 0x40); } void -wss_write(uint16_t addr, uint8_t val, void *priv) +wss_write(UNUSED(uint16_t addr), uint8_t val, void *priv) { wss_t *wss = (wss_t *) priv; @@ -97,7 +98,7 @@ wss_get_buffer(int32_t *buffer, int len, void *priv) } void * -wss_init(const device_t *info) +wss_init(UNUSED(const device_t *info)) { wss_t *wss = malloc(sizeof(wss_t)); memset(wss, 0, sizeof(wss_t)); @@ -196,7 +197,7 @@ ncr_audio_mca_feedb(void *priv) } void * -ncr_audio_init(const device_t *info) +ncr_audio_init(UNUSED(const device_t *info)) { wss_t *wss = malloc(sizeof(wss_t)); memset(wss, 0, sizeof(wss_t)); diff --git a/src/sound/snd_ym7128.c b/src/sound/snd_ym7128.c index e7cf37b2a..59e5691e9 100644 --- a/src/sound/snd_ym7128.c +++ b/src/sound/snd_ym7128.c @@ -5,12 +5,13 @@ #include <86box/86box.h> #include <86box/snd_ym7128.h> +#include <86box/plat_unused.h> static int attenuation[32]; static int tap_position[32]; void -ym7128_init(ym7128_t *ym7128) +ym7128_init(UNUSED(ym7128_t *ym7128)) { int c; double out = 65536.0; @@ -97,6 +98,9 @@ ym7128_write(ym7128_t *ym7128, uint8_t val) case 0x1e: ym7128->t[ym7128->reg_sel - 0x16] = tap_position[ym7128->dat & 0x1f]; break; + + default: + break; } ym7128->regs[ym7128->reg_sel] = ym7128->dat; } @@ -137,8 +141,8 @@ ym7128_apply(ym7128_t *ym7128, int16_t *buffer, int len) samp_l = (samp_l * ym7128->vl * 2) >> 16; samp_r = (samp_r * ym7128->vr * 2) >> 16; - buffer[c] += ((int32_t) samp_l + (int32_t) ym7128->prev_l) / 2; - buffer[c + 1] += ((int32_t) samp_r + (int32_t) ym7128->prev_r) / 2; + buffer[c] += (samp_l + (int32_t) ym7128->prev_l) / 2; + buffer[c + 1] += (samp_r + (int32_t) ym7128->prev_r) / 2; buffer[c + 2] += samp_l; buffer[c + 3] += samp_r; diff --git a/src/sound/sound.c b/src/sound/sound.c index 94fbad394..542528ccb 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -47,7 +47,7 @@ typedef struct { } SOUND_CARD; typedef struct { - void (*get_buffer)(int32_t *buffer, int len, void *p); + void (*get_buffer)(int32_t *buffer, int len, void *priv); void *priv; } sound_handler_t; @@ -76,7 +76,7 @@ static int cd_buf_update = CD_BUFLEN / SOUNDBUFLEN; static volatile int cdaudioon = 0; static int cd_thread_enable = 0; -static void (*filter_cd_audio)(int channel, double *buffer, void *p) = NULL; +static void (*filter_cd_audio)(int channel, double *buffer, void *priv) = NULL; static void *filter_cd_audio_p = NULL; static const device_t sound_none_device = { @@ -208,7 +208,7 @@ sound_card_get_from_internal_name(const char *s) int c = 0; while (sound_cards[c].device != NULL) { - if (!strcmp((char *) sound_cards[c].device->internal_name, s)) + if (!strcmp(sound_cards[c].device->internal_name, s)) return c; c++; } @@ -246,7 +246,7 @@ sound_cd_clean_buffers(void) } static void -sound_cd_thread(void *param) +sound_cd_thread(UNUSED(void *param)) { uint32_t lba; int r; @@ -425,24 +425,24 @@ sound_init(void) } void -sound_add_handler(void (*get_buffer)(int32_t *buffer, int len, void *p), void *p) +sound_add_handler(void (*get_buffer)(int32_t *buffer, int len, void *priv), void *priv) { sound_handlers[sound_handlers_num].get_buffer = get_buffer; - sound_handlers[sound_handlers_num].priv = p; + sound_handlers[sound_handlers_num].priv = priv; sound_handlers_num++; } void -sound_set_cd_audio_filter(void (*filter)(int channel, double *buffer, void *p), void *p) +sound_set_cd_audio_filter(void (*filter)(int channel, double *buffer, void *priv), void *priv) { if ((filter_cd_audio == NULL) || (filter == NULL)) { filter_cd_audio = filter; - filter_cd_audio_p = p; + filter_cd_audio_p = priv; } } void -sound_poll(void *priv) +sound_poll(UNUSED(void *priv)) { timer_advance_u64(&sound_poll_timer, sound_poll_latch); @@ -459,7 +459,7 @@ sound_poll(void *priv) for (c = 0; c < SOUNDBUFLEN * 2; c++) { if (sound_is_float) - outbuffer_ex[c] = ((float) outbuffer[c]) / 32768.0; + outbuffer_ex[c] = ((float) outbuffer[c]) / (float) 32768.0; else { if (outbuffer[c] > 32767) outbuffer[c] = 32767; diff --git a/src/sound/xaudio2.c b/src/sound/xaudio2.c index 9f26fe517..57a9ded01 100644 --- a/src/sound/xaudio2.c +++ b/src/sound/xaudio2.c @@ -33,6 +33,7 @@ #include <86box/midi.h> #include <86box/plat_dynld.h> #include <86box/sound.h> +#include <86box/plat_unused.h> #if defined(_WIN32) && !defined(USE_FAUDIO) static void *xaudio2_handle = NULL; @@ -57,32 +58,38 @@ static IXAudio2SourceVoice *srcvoicecd = NULL; #define BUFLEN SOUNDBUFLEN static void WINAPI -OnVoiceProcessingPassStart(IXAudio2VoiceCallback *callback, uint32_t bytesRequired) +OnVoiceProcessingPassStart(UNUSED(IXAudio2VoiceCallback *callback), UNUSED(uint32_t bytesRequired)) { + // } static void WINAPI -OnVoiceProcessingPassEnd(IXAudio2VoiceCallback *callback) +OnVoiceProcessingPassEnd(UNUSED(IXAudio2VoiceCallback *callback)) { + // } static void WINAPI -OnStreamEnd(IXAudio2VoiceCallback *callback) +OnStreamEnd(UNUSED(IXAudio2VoiceCallback *callback)) { + // } static void WINAPI -OnBufferStart(IXAudio2VoiceCallback *callback, void *pBufferContext) +OnBufferStart(UNUSED(IXAudio2VoiceCallback *callback), UNUSED(void *pBufferContext)) { + // } static void WINAPI -OnLoopEnd(IXAudio2VoiceCallback *callback, void *pBufferContext) +OnLoopEnd(UNUSED(IXAudio2VoiceCallback *callback), UNUSED(void *pBufferContext)) { + // } static void WINAPI -OnVoiceError(IXAudio2VoiceCallback *callback, void *pBufferContext, HRESULT error) +OnVoiceError(UNUSED(IXAudio2VoiceCallback *callback), UNUSED(void *pBufferContext), UNUSED(HRESULT error)) { + // } static void WINAPI -OnBufferEnd(IXAudio2VoiceCallback *callback, void *pBufferContext) +OnBufferEnd(UNUSED(IXAudio2VoiceCallback *callback), UNUSED(void *pBufferContext)) { free(pBufferContext); } diff --git a/src/timer.c b/src/timer.c index dde6fbdbc..e863c2f21 100644 --- a/src/timer.c +++ b/src/timer.c @@ -123,7 +123,7 @@ timer_process(void) if (timer->flags & TIMER_SPLIT) timer_advance_ex(timer, 0); /* We're splitting a > 1 s period into multiple <= 1 s periods. */ else if (timer->callback != NULL) /* Make sure it's no NULL, so that we can have a NULL callback when no operation is needed. */ - timer->callback(timer->p); + timer->callback(timer->priv); } timer_target = timer_head->ts.ts32.integer; @@ -159,12 +159,12 @@ timer_init(void) } void -timer_add(pc_timer_t *timer, void (*callback)(void *p), void *priv, int start_timer) +timer_add(pc_timer_t *timer, void (*callback)(void *priv), void *priv, int start_timer) { memset(timer, 0, sizeof(pc_timer_t)); timer->callback = callback; - timer->p = priv; + timer->priv = priv; timer->flags = 0; timer->prev = timer->next = NULL; if (start_timer) diff --git a/src/video/agpgart.c b/src/video/agpgart.c index 523fcc996..b8ae2bdc8 100644 --- a/src/video/agpgart.c +++ b/src/video/agpgart.c @@ -24,6 +24,7 @@ #include <86box/device.h> #include <86box/mem.h> #include <86box/agpgart.h> +#include <86box/plat_unused.h> #ifdef ENABLE_AGPGART_LOG int agpgart_do_log = ENABLE_AGPGART_LOG; @@ -129,7 +130,7 @@ agpgart_aperture_writel(uint32_t addr, uint32_t val, void *priv) } static void * -agpgart_init(const device_t *info) +agpgart_init(UNUSED(const device_t *info)) { agpgart_t *dev = malloc(sizeof(agpgart_t)); memset(dev, 0, sizeof(agpgart_t)); diff --git a/src/video/vid_8514a.c b/src/video/vid_8514a.c index ebf2d0b3f..9118dec72 100644 --- a/src/video/vid_8514a.c +++ b/src/video/vid_8514a.c @@ -38,10 +38,10 @@ #include <86box/vid_svga_render.h> #include "cpu.h" -static void ibm8514_accel_outb(uint16_t port, uint8_t val, void *p); -static void ibm8514_accel_outw(uint16_t port, uint16_t val, void *p); -static uint8_t ibm8514_accel_inb(uint16_t port, void *p); -static uint16_t ibm8514_accel_inw(uint16_t port, void *p); +static void ibm8514_accel_outb(uint16_t port, uint8_t val, void *priv); +static void ibm8514_accel_outw(uint16_t port, uint16_t val, void *priv); +static uint8_t ibm8514_accel_inb(uint16_t port, void *priv); +static uint16_t ibm8514_accel_inw(uint16_t port, void *priv); #ifdef ENABLE_IBM8514_LOG int ibm8514_do_log = ENABLE_IBM8514_LOG; @@ -238,7 +238,7 @@ ibm8514_cpu_dest(svga_t *svga) } void -ibm8514_accel_out_pixtrans(svga_t *svga, uint16_t port, uint16_t val, int len) +ibm8514_accel_out_pixtrans(svga_t *svga, UNUSED(uint16_t port), uint16_t val, int len) { ibm8514_t *dev = &svga->dev8514; uint8_t nibble = 0; @@ -536,6 +536,7 @@ ibm8514_accel_out_fifo(svga_t *svga, uint16_t port, uint32_t val, int len) case 0x92e8: if (len != 1) dev->test = val; + [[fallthrough]]; case 0xd2e8: if (len == 1) dev->accel.err_term = (dev->accel.err_term & 0x3f00) | val; @@ -778,21 +779,24 @@ ibm8514_accel_out_fifo(svga_t *svga, uint16_t port, uint32_t val, int len) dev->accel.cmd_back = 0; } break; + + default: + break; } } void -ibm8514_ramdac_out(uint16_t port, uint8_t val, void *p) +ibm8514_ramdac_out(uint16_t port, uint8_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; svga_out(port, val, svga); } uint8_t -ibm8514_ramdac_in(uint16_t port, void *p) +ibm8514_ramdac_in(uint16_t port, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; uint8_t ret; ret = svga_in(port, svga); @@ -980,21 +984,24 @@ ibm8514_accel_out(uint16_t port, uint32_t val, svga_t *svga, int len) ibm8514_log("IBM 8514/A: VGA ON = %i, val = %02x\n", vga_on, val); svga_recalctimings(svga); break; + + default: + break; } } } static void -ibm8514_accel_outb(uint16_t port, uint8_t val, void *p) +ibm8514_accel_outb(uint16_t port, uint8_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; ibm8514_accel_out(port, val, svga, 1); } static void -ibm8514_accel_outw(uint16_t port, uint16_t val, void *p) +ibm8514_accel_outw(uint16_t port, uint16_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; ibm8514_accel_out(port, val, svga, 2); } @@ -1120,21 +1127,24 @@ ibm8514_accel_in(uint16_t port, svga_t *svga, int len) } } break; + + default: + break; } return temp; } static uint8_t -ibm8514_accel_inb(uint16_t port, void *p) +ibm8514_accel_inb(uint16_t port, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; return ibm8514_accel_in(port, svga, 1); } static uint16_t -ibm8514_accel_inw(uint16_t port, void *p) +ibm8514_accel_inw(uint16_t port, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; return ibm8514_accel_in(port, svga, 2); } @@ -1157,27 +1167,30 @@ ibm8514_short_stroke_start(int count, int cpu_input, uint32_t mix_dat, uint32_t } void -ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, svga_t *svga, int len) +ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, svga_t *svga, UNUSED(int len)) { ibm8514_t *dev = &svga->dev8514; - uint16_t *vram_w = (uint16_t *)svga->vram; - uint16_t src_dat = 0, dest_dat, old_dest_dat; - int frgd_mix, bkgd_mix; - uint16_t clip_b = dev->accel.multifunc[3]; - uint16_t clip_r = dev->accel.multifunc[4]; - int pixcntl = (dev->accel.multifunc[0x0a] >> 6) & 3; - uint16_t mix_mask = ((svga->bpp == 8) || (svga->bpp == 24)) ? 0x80 : 0x8000; - uint16_t compare = dev->accel.color_cmp; - int compare_mode = dev->accel.multifunc[0x0a] & 0x38; - int cmd = dev->accel.cmd >> 13; - uint16_t wrt_mask = dev->accel.wrt_mask; - uint16_t rd_mask = dev->accel.rd_mask; - uint16_t rd_mask_polygon = dev->accel.rd_mask; - uint16_t frgd_color = dev->accel.frgd_color; - uint16_t bkgd_color = dev->accel.bkgd_color; - uint32_t old_mix_dat; - int and3 = dev->accel.cur_x & 3; - uint16_t poly_src = 0; + uint16_t *vram_w = (uint16_t *)svga->vram; + uint16_t src_dat = 0; + uint16_t dest_dat; + uint16_t old_dest_dat; + int frgd_mix; + int bkgd_mix; + uint16_t clip_b = dev->accel.multifunc[3]; + uint16_t clip_r = dev->accel.multifunc[4]; + int pixcntl = (dev->accel.multifunc[0x0a] >> 6) & 3; + uint16_t mix_mask = ((svga->bpp == 8) || (svga->bpp == 24)) ? 0x80 : 0x8000; + uint16_t compare = dev->accel.color_cmp; + int compare_mode = dev->accel.multifunc[0x0a] & 0x38; + int cmd = dev->accel.cmd >> 13; + uint16_t wrt_mask = dev->accel.wrt_mask; + uint16_t rd_mask = dev->accel.rd_mask; + uint16_t rd_mask_polygon = dev->accel.rd_mask; + uint16_t frgd_color = dev->accel.frgd_color; + uint16_t bkgd_color = dev->accel.bkgd_color; + uint32_t old_mix_dat; + int and3 = dev->accel.cur_x & 3; + uint16_t poly_src = 0; if ((svga->bpp == 8) || (svga->bpp == 24)) { compare &= 0xff; @@ -1210,7 +1223,7 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat count >>= 3; } - if (((svga->bpp == 15) || (svga->bpp == 16))) { + if ((svga->bpp == 15) || (svga->bpp == 16)) { if ((dev->accel.cmd & 0x200) && (count == 2)) count >>= 1; } @@ -1318,6 +1331,9 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat case 3: src_dat = 0; break; + + default: + break; } READ((dev->accel.cy * dev->pitch) + dev->accel.cx, dest_dat); @@ -1375,13 +1391,16 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat dev->accel.cx++; dev->accel.cy++; break; + + default: + break; } dev->accel.ssv_len--; } } else { while (count-- && (dev->accel.ssv_len >= 0)) { - if ((dev->accel.cx >= dev->accel.clip_left && dev->accel.cx <= clip_r && dev->accel.cy >= dev->accel.clip_top && dev->accel.cy <= clip_b)) { + if (dev->accel.cx >= dev->accel.clip_left && dev->accel.cx <= clip_r && dev->accel.cy >= dev->accel.clip_top && dev->accel.cy <= clip_b) { switch ((mix_dat & mix_mask) ? frgd_mix : bkgd_mix) { case 0: src_dat = bkgd_color; @@ -1395,6 +1414,9 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat case 3: src_dat = 0; break; + + default: + break; } READ((dev->accel.cy * dev->pitch) + dev->accel.cx, dest_dat); @@ -1452,6 +1474,9 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat case 0xe0: dev->accel.cx++; break; + + default: + break; } } else dev->accel.err_term += dev->accel.desty_axstp; @@ -1482,6 +1507,9 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat case 0xe0: dev->accel.cy++; break; + + default: + break; } dev->accel.ssv_len--; @@ -1579,6 +1607,9 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat case 3: src_dat = 0; break; + + default: + break; } READ((dev->accel.cy * dev->pitch) + dev->accel.cx, dest_dat); @@ -1697,6 +1728,9 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat dev->accel.cx++; dev->accel.cy++; break; + + default: + break; } dev->accel.sy--; @@ -1728,6 +1762,9 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat case 3: src_dat = 0; break; + + default: + break; } READ((dev->accel.cy * dev->pitch) + dev->accel.cx, dest_dat); @@ -1783,6 +1820,9 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat case 0xe0: dev->accel.cx++; break; + + default: + break; } } else dev->accel.err_term += dev->accel.desty_axstp; @@ -1813,6 +1853,9 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat case 0xe0: dev->accel.cy++; break; + + default: + break; } dev->accel.sy--; @@ -1847,6 +1890,9 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat case 3: src_dat = 0; break; + + default: + break; } READ((dev->accel.cy * dev->pitch) + dev->accel.cx, dest_dat); @@ -1902,6 +1948,9 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat case 0xe0: dev->accel.cx++; break; + + default: + break; } } else dev->accel.err_term += dev->accel.desty_axstp; @@ -1932,6 +1981,9 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat case 0xe0: dev->accel.cy++; break; + + default: + break; } dev->accel.sy--; @@ -2067,6 +2119,9 @@ rect_fill_pix: case 3: src_dat = 0; break; + + default: + break; } READ(dev->accel.dest + dev->accel.cx, dest_dat); @@ -2161,6 +2216,9 @@ rect_fill_pix: case 0xe0: dev->accel.cx++; break; + + default: + break; } dev->accel.sx--; @@ -2200,6 +2258,9 @@ rect_fill_pix: case 0xe0: dev->accel.cy++; break; + + default: + break; } dev->accel.dest = dev->accel.cy * dev->pitch; @@ -2239,6 +2300,9 @@ rect_fill_pix: case 3: src_dat = 0; break; + + default: + break; } READ(dev->accel.dest + dev->accel.cx, dest_dat); @@ -2320,6 +2384,9 @@ rect_fill_pix: case 3: src_dat = 0; break; + + default: + break; } } @@ -2556,6 +2623,9 @@ rect_fill_pix: case 3: src_dat = 0; break; + + default: + break; } READ(dev->accel.dest + dev->accel.cx, dest_dat); @@ -2632,6 +2702,9 @@ rect_fill: case 3: src_dat = 0; break; + + default: + break; } READ(dev->accel.dest + dev->accel.cx, dest_dat); @@ -2699,6 +2772,9 @@ rect_fill: case 3: src_dat = 0; break; + + default: + break; } READ(dev->accel.dest + dev->accel.cx, dest_dat); @@ -2762,6 +2838,9 @@ rect_fill: case 3: src_dat = 0; break; + + default: + break; } READ(dev->accel.dest + dev->accel.cx, poly_src); @@ -2838,6 +2917,9 @@ rect_fill: case 3: src_dat = 0; break; + + default: + break; } READ(dev->accel.dest + dev->accel.cx, dest_dat); @@ -2926,6 +3008,9 @@ rect_fill: case 3: src_dat = 0; break; + + default: + break; } READ((dev->accel.cy * dev->pitch) + dev->accel.cx, dest_dat); @@ -2989,6 +3074,9 @@ rect_fill: case 0xe0: dev->accel.cx++; break; + + default: + break; } } else dev->accel.err_term += dev->accel.desty_axstp; @@ -3023,6 +3111,9 @@ rect_fill: dev->accel.oldcy = dev->accel.cy; dev->accel.cy++; break; + + default: + break; } dev->accel.sy++; @@ -3111,6 +3202,9 @@ bitblt_pix: } } break; + + default: + break; } READ(dev->accel.dest + dev->accel.dx, dest_dat); @@ -3200,6 +3294,9 @@ bitblt_pix: } } break; + + default: + break; } READ(dev->accel.dest + dev->accel.dx, dest_dat); @@ -3307,6 +3404,9 @@ bitblt_pix: } } break; + + default: + break; } READ(dev->accel.dest + dev->accel.dx, dest_dat); @@ -3385,6 +3485,9 @@ bitblt: case 3: READ(dev->accel.src + dev->accel.cx, src_dat); break; + + default: + break; } READ(dev->accel.dest + dev->accel.dx, dest_dat); @@ -3459,6 +3562,9 @@ bitblt: case 3: READ(dev->accel.src + dev->accel.cx, src_dat); break; + + default: + break; } READ(dev->accel.dest + dev->accel.dx, dest_dat); @@ -3514,13 +3620,14 @@ bitblt: } } else { if ((svga->bpp == 24) && dev->local && (dev->accel.cmd == 0xc2b5)) { - int64_t cx, dx; + int64_t cx; + int64_t dx; cx = (int64_t)dev->accel.cx; dx = (int64_t)dev->accel.dx; while (1) { - if (((dx) >= (((int64_t)dev->accel.clip_left) * 3) && (dx) <= (((uint64_t)clip_r) * 3) && dev->accel.dy >= (dev->accel.clip_top << 1) && dev->accel.dy <= (clip_b << 1))) { + if (dx >= (((int64_t)dev->accel.clip_left) * 3) && dx <= (((uint64_t)clip_r) * 3) && dev->accel.dy >= (dev->accel.clip_top << 1) && dev->accel.dy <= (clip_b << 1)) { READ(dev->accel.src + (dev->accel.ge_offset << 2) + cx, src_dat); READ(dev->accel.dest + (dev->accel.ge_offset << 2) + dx, dest_dat); @@ -3570,6 +3677,9 @@ bitblt: } } break; + + default: + break; } READ(dev->accel.dest + dev->accel.dx, dest_dat); @@ -3632,6 +3742,9 @@ bitblt: } } break; + + default: + break; } } @@ -3960,9 +4073,9 @@ static void } static void -ibm8514_close(void *p) +ibm8514_close(void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; ibm8514_t *dev = &svga->dev8514; if (dev) { @@ -3972,17 +4085,17 @@ ibm8514_close(void *p) } static void -ibm8514_speed_changed(void *p) +ibm8514_speed_changed(void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; svga_recalctimings(svga); } static void -ibm8514_force_redraw(void *p) +ibm8514_force_redraw(void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; svga->fullchange = changeframecount; } diff --git a/src/video/vid_ati18800.c b/src/video/vid_ati18800.c index 2b37eb6fd..3e0af9620 100644 --- a/src/video/vid_ati18800.c +++ b/src/video/vid_ati18800.c @@ -62,9 +62,9 @@ typedef struct ati18800_t { static video_timings_t timing_ati18800 = { .type = VIDEO_ISA, .write_b = 8, .write_w = 16, .write_l = 32, .read_b = 8, .read_w = 16, .read_l = 32 }; static void -ati18800_out(uint16_t addr, uint8_t val, void *p) +ati18800_out(uint16_t addr, uint8_t val, void *priv) { - ati18800_t *ati18800 = (ati18800_t *) p; + ati18800_t *ati18800 = (ati18800_t *) priv; svga_t *svga = &ati18800->svga; uint8_t old; @@ -93,6 +93,9 @@ ati18800_out(uint16_t addr, uint8_t val, void *p) case 0xb3: ati_eeprom_write(&ati18800->eeprom, val & 8, val & 2, val & 1); break; + + default: + break; } break; @@ -118,14 +121,17 @@ ati18800_out(uint16_t addr, uint8_t val, void *p) } } break; + + default: + break; } svga_out(addr, val, svga); } static uint8_t -ati18800_in(uint16_t addr, void *p) +ati18800_in(uint16_t addr, void *priv) { - ati18800_t *ati18800 = (ati18800_t *) p; + ati18800_t *ati18800 = (ati18800_t *) priv; svga_t *svga = &ati18800->svga; uint8_t temp = 0xff; @@ -165,7 +171,7 @@ ati18800_in(uint16_t addr, void *p) static void ati18800_recalctimings(svga_t *svga) { - ati18800_t *ati18800 = (ati18800_t *) svga->p; + ati18800_t *ati18800 = (ati18800_t *) svga->priv; if (svga->crtc[0x17] & 4) { svga->vtotal <<= 1; @@ -193,11 +199,9 @@ ati18800_init(const device_t *info) video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_ati18800); switch (info->local) { -#if defined(DEV_BRANCH) && defined(USE_VGAWONDER) - case ATI18800_WONDER: -#endif default: #if defined(DEV_BRANCH) && defined(USE_VGAWONDER) + case ATI18800_WONDER: rom_init(&ati18800->bios_rom, BIOS_ROM_PATH_WONDER, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL); break; #endif @@ -254,9 +258,9 @@ ati18800_available(void) } static void -ati18800_close(void *p) +ati18800_close(void *priv) { - ati18800_t *ati18800 = (ati18800_t *) p; + ati18800_t *ati18800 = (ati18800_t *) priv; svga_close(&ati18800->svga); @@ -264,17 +268,17 @@ ati18800_close(void *p) } static void -ati18800_speed_changed(void *p) +ati18800_speed_changed(void *priv) { - ati18800_t *ati18800 = (ati18800_t *) p; + ati18800_t *ati18800 = (ati18800_t *) priv; svga_recalctimings(&ati18800->svga); } static void -ati18800_force_redraw(void *p) +ati18800_force_redraw(void *priv) { - ati18800_t *ati18800 = (ati18800_t *) p; + ati18800_t *ati18800 = (ati18800_t *) priv; ati18800->svga.fullchange = changeframecount; } diff --git a/src/video/vid_ati28800.c b/src/video/vid_ati28800.c index b41e1ca82..72a650184 100644 --- a/src/video/vid_ati28800.c +++ b/src/video/vid_ati28800.c @@ -108,9 +108,9 @@ ati28800_log(const char *fmt, ...) static void ati28800_recalctimings(svga_t *svga); static void -ati28800_out(uint16_t addr, uint8_t val, void *p) +ati28800_out(uint16_t addr, uint8_t val, void *priv) { - ati28800_t *ati28800 = (ati28800_t *) p; + ati28800_t *ati28800 = (ati28800_t *) priv; svga_t *svga = &ati28800->svga; uint8_t old; @@ -169,6 +169,9 @@ ati28800_out(uint16_t addr, uint8_t val, void *p) if ((old ^ val) & 2) svga_recalctimings(svga); break; + + default: + break; } break; @@ -205,14 +208,17 @@ ati28800_out(uint16_t addr, uint8_t val, void *p) } } break; + + default: + break; } svga_out(addr, val, svga); } static void -ati28800k_out(uint16_t addr, uint8_t val, void *p) +ati28800k_out(uint16_t addr, uint8_t val, void *priv) { - ati28800_t *ati28800 = (ati28800_t *) p; + ati28800_t *ati28800 = (ati28800_t *) priv; svga_t *svga = &ati28800->svga; uint16_t oldaddr = addr; @@ -225,7 +231,7 @@ ati28800k_out(uint16_t addr, uint8_t val, void *p) ati28800->ksc5601_mode_enabled = val & 0x20; svga_recalctimings(svga); } - ati28800_out(oldaddr, val, p); + ati28800_out(oldaddr, val, priv); break; case 0x3DD: ati28800->port_03dd_val = val; @@ -259,20 +265,23 @@ ati28800k_out(uint16_t addr, uint8_t val, void *p) if (val & 2) ati28800->in_get_korean_font_kind_set = 1; break; + + default: + break; } break; } break; default: - ati28800_out(oldaddr, val, p); + ati28800_out(oldaddr, val, priv); break; } } static uint8_t -ati28800_in(uint16_t addr, void *p) +ati28800_in(uint16_t addr, void *priv) { - ati28800_t *ati28800 = (ati28800_t *) p; + ati28800_t *ati28800 = (ati28800_t *) priv; svga_t *svga = &ati28800->svga; uint8_t temp; @@ -346,9 +355,9 @@ ati28800_in(uint16_t addr, void *p) } static uint8_t -ati28800k_in(uint16_t addr, void *p) +ati28800k_in(uint16_t addr, void *priv) { - ati28800_t *ati28800 = (ati28800_t *) p; + ati28800_t *ati28800 = (ati28800_t *) priv; svga_t *svga = &ati28800->svga; uint16_t oldaddr = addr; uint8_t temp = 0xFF; @@ -380,7 +389,7 @@ ati28800k_in(uint16_t addr, void *p) } break; default: - temp = ati28800_in(oldaddr, p); + temp = ati28800_in(oldaddr, priv); break; } if (addr != 0x3da) @@ -391,7 +400,7 @@ ati28800k_in(uint16_t addr, void *p) static void ati28800_recalctimings(svga_t *svga) { - ati28800_t *ati28800 = (ati28800_t *) svga->p; + ati28800_t *ati28800 = (ati28800_t *) svga->priv; if (ati28800->regs[0xa3] & 0x10) svga->ma_latch |= 0x10000; @@ -507,8 +516,14 @@ ati28800_recalctimings(svga_t *svga) svga->ma_latch <<= 1; } break; + + default: + break; } break; + + default: + break; } } } @@ -517,7 +532,7 @@ ati28800_recalctimings(svga_t *svga) static void ati28800k_recalctimings(svga_t *svga) { - ati28800_t *ati28800 = (ati28800_t *) svga->p; + ati28800_t *ati28800 = (ati28800_t *) svga->priv; ati28800_recalctimings(svga); @@ -550,8 +565,8 @@ ati28800k_init(const device_t *info) ati28800->ksc5601_mode_enabled = 0; switch (ati28800->type_korean) { - case 0: default: + case 0: rom_init(&ati28800->bios_rom, BIOS_ATIKOR_PATH, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL); loadfont(FONT_ATIKOR_PATH, 6); break; @@ -705,9 +720,9 @@ ati28800_close(void *priv) } static void -ati28800_speed_changed(void *p) +ati28800_speed_changed(void *priv) { - ati28800_t *ati28800 = (ati28800_t *) p; + ati28800_t *ati28800 = (ati28800_t *) priv; svga_recalctimings(&ati28800->svga); } diff --git a/src/video/vid_ati68860_ramdac.c b/src/video/vid_ati68860_ramdac.c index 107b63039..5a8de5455 100644 --- a/src/video/vid_ati68860_ramdac.c +++ b/src/video/vid_ati68860_ramdac.c @@ -48,13 +48,16 @@ #include <86box/video.h> #include <86box/vid_svga.h> #include <86box/vid_svga_render.h> +#include <86box/plat_unused.h> typedef struct ati68860_ramdac_t { uint8_t regs[16]; void (*render)(struct svga_t *svga); - int dac_addr, dac_pos; - int dac_r, dac_g; + int dac_addr; + int dac_pos; + int dac_r; + int dac_g; PALETTE pal; uint32_t pallook[2]; @@ -113,6 +116,9 @@ ati68860_ramdac_out(uint16_t addr, uint8_t val, void *p, svga_t *svga) ramdac->dac_pos = 0; ramdac->dac_addr = (ramdac->dac_addr + 1) & 255; break; + + default: + break; } break; case 0xb: @@ -153,6 +159,9 @@ ati68860_ramdac_out(uint16_t addr, uint8_t val, void *p, svga_t *svga) case 0xc: svga_set_ramdac_type(svga, (val & 1) ? RAMDAC_6BIT : RAMDAC_8BIT); break; + + default: + break; } break; } @@ -217,7 +226,7 @@ ati68860_set_ramdac_type(void *p, int type) } static void * -ati68860_ramdac_init(const device_t *info) +ati68860_ramdac_init(UNUSED(const device_t *info)) { ati68860_ramdac_t *ramdac = (ati68860_ramdac_t *) malloc(sizeof(ati68860_ramdac_t)); memset(ramdac, 0, sizeof(ati68860_ramdac_t)); diff --git a/src/video/vid_ati_eeprom.c b/src/video/vid_ati_eeprom.c index 10b37212d..b3556a827 100644 --- a/src/video/vid_ati_eeprom.c +++ b/src/video/vid_ati_eeprom.c @@ -30,49 +30,49 @@ void ati_eeprom_load(ati_eeprom_t *eeprom, char *fn, int type) { - FILE *f; + FILE *fp; int size; eeprom->type = type; strncpy(eeprom->fn, fn, sizeof(eeprom->fn) - 1); - f = nvr_fopen(eeprom->fn, "rb"); + fp = nvr_fopen(eeprom->fn, "rb"); size = eeprom->type ? 512 : 128; - if (!f) { + if (!fp) { memset(eeprom->data, 0xff, size); return; } - if (fread(eeprom->data, 1, size, f) != size) + if (fread(eeprom->data, 1, size, fp) != size) memset(eeprom->data, 0, size); - fclose(f); + fclose(fp); } void ati_eeprom_load_mach8(ati_eeprom_t *eeprom, char *fn) { - FILE *f; + FILE *fp; int size; eeprom->type = 0; strncpy(eeprom->fn, fn, sizeof(eeprom->fn) - 1); - f = nvr_fopen(eeprom->fn, "rb"); + fp = nvr_fopen(eeprom->fn, "rb"); size = 128; - if (!f) { /*The ATI Graphics Ultra bios expects an immediate write to nvram if none is present at boot time otherwise + if (!fp) { /*The ATI Graphics Ultra bios expects an immediate write to nvram if none is present at boot time otherwise it would hang the machine.*/ memset(eeprom->data, 0, size); - f = nvr_fopen(eeprom->fn, "wb"); - fwrite(eeprom->data, 1, size, f); + fp = nvr_fopen(eeprom->fn, "wb"); + fwrite(eeprom->data, 1, size, fp); } - if (fread(eeprom->data, 1, size, f) != size) + if (fread(eeprom->data, 1, size, fp) != size) memset(eeprom->data, 0, size); - fclose(f); + fclose(fp); } void ati_eeprom_save(ati_eeprom_t *eeprom) { - FILE *f = nvr_fopen(eeprom->fn, "wb"); - if (!f) + FILE *fp = nvr_fopen(eeprom->fn, "wb"); + if (!fp) return; - fwrite(eeprom->data, 1, eeprom->type ? 512 : 128, f); - fclose(f); + fwrite(eeprom->data, 1, eeprom->type ? 512 : 128, fp); + fclose(fp); } void @@ -93,7 +93,7 @@ ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat) if (!dat) break; eeprom->state = EEPROM_OPCODE; - /* fall through */ + [[fallthrough]]; case EEPROM_OPCODE: eeprom->opcode = (eeprom->opcode << 1) | (dat ? 1 : 0); eeprom->count--; @@ -119,6 +119,9 @@ ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat) eeprom->state = EEPROM_INPUT; eeprom->dat = 0; break; + + default: + break; } } break; @@ -160,6 +163,9 @@ ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat) case EEPROM_OP_EWEN: eeprom->wp = 0; break; + + default: + break; } eeprom->state = EEPROM_IDLE; eeprom->out = 1; @@ -183,9 +189,15 @@ ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat) eeprom->state = EEPROM_IDLE; eeprom->out = 1; break; + + default: + break; } } break; + + default: + break; } } eeprom->oldena = ena; @@ -200,6 +212,9 @@ ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat) eeprom->state = EEPROM_IDLE; } break; + + default: + break; } } } diff --git a/src/video/vid_ati_mach64.c b/src/video/vid_ati_mach64.c index 39371e882..80d1cc9c3 100644 --- a/src/video/vid_ati_mach64.c +++ b/src/video/vid_ati_mach64.c @@ -67,8 +67,7 @@ enum { FIFO_WRITE_DWORD = (0x03 << 24) }; -typedef struct -{ +typedef struct fifo_entry_t { uint32_t addr_type; uint32_t val; } fifo_entry_t; @@ -157,17 +156,21 @@ typedef struct mach64_t { uint32_t ovr_wid_top_bottom; uint32_t pat_cntl; - uint32_t pat_reg0, pat_reg1; + uint32_t pat_reg0; + uint32_t pat_reg1; - uint32_t sc_left_right, sc_top_bottom; + uint32_t sc_left_right; + uint32_t sc_top_bottom; - uint32_t scratch_reg0, scratch_reg1; + uint32_t scratch_reg0; + uint32_t scratch_reg1; uint32_t src_cntl; uint32_t src_off_pitch; uint32_t src_y_x; uint32_t src_y_x_start; - uint32_t src_height1_width1, src_height2_width2; + uint32_t src_height1_width1; + uint32_t src_height2_width2; uint32_t write_mask; uint32_t chain_mask; @@ -175,33 +178,54 @@ typedef struct mach64_t { uint32_t linear_base; uint32_t io_base; - struct - { + struct { int op; - int dst_x, dst_y; - int dst_x_start, dst_y_start; - int src_x, src_y; - int src_x_start, src_y_start; - int xinc, yinc; - int x_count, y_count; + int dst_x; + int dst_y; + int dst_x_start; + int dst_y_start; + int src_x; + int src_y; + int src_x_start; + int src_y_start; + int xinc; + int yinc; + int x_count; + int y_count; int xx_count; - int src_x_count, src_y_count; - int src_width1, src_height1; - int src_width2, src_height2; - uint32_t src_offset, src_pitch; - uint32_t dst_offset, dst_pitch; - int mix_bg, mix_fg; - int source_bg, source_fg, source_mix; + int src_x_count; + int src_y_count; + int src_width1; + int src_height1; + int src_width2; + int src_height2; + uint32_t src_offset; + uint32_t src_pitch; + uint32_t dst_offset; + uint32_t dst_pitch; + int mix_bg; + int mix_fg; + int source_bg; + int source_fg; + int source_mix; int source_host; - int dst_width, dst_height; + int dst_width; + int dst_height; int busy; int pattern[8][8]; uint8_t pattern_clr4x2[2][4]; uint8_t pattern_clr8x1[8]; - int sc_left, sc_right, sc_top, sc_bottom; - int dst_pix_width, src_pix_width, host_pix_width; - int dst_size, src_size, host_size; + int sc_left; + int sc_right; + int sc_top; + int sc_bottom; + int dst_pix_width; + int src_pix_width; + int host_pix_width; + int dst_size; + int src_size; + int host_size; uint32_t dp_bkgd_clr; uint32_t dp_frgd_clr; @@ -217,7 +241,8 @@ typedef struct mach64_t { } accel; fifo_entry_t fifo[FIFO_SIZE]; - atomic_int fifo_read_idx, fifo_write_idx; + atomic_int fifo_read_idx; + atomic_int fifo_write_idx; thread_t *fifo_thread; event_t *wake_fifo_thread; @@ -238,26 +263,32 @@ typedef struct mach64_t { uint32_t config_stat0; - uint32_t cur_clr0, cur_clr1; + uint32_t cur_clr0; + uint32_t cur_clr1; uint32_t overlay_dat[1024]; - uint32_t overlay_graphics_key_clr, overlay_graphics_key_msk; - uint32_t overlay_video_key_clr, overlay_video_key_msk; + uint32_t overlay_graphics_key_clr; + uint32_t overlay_graphics_key_msk; + uint32_t overlay_video_key_clr; + uint32_t overlay_video_key_msk; uint32_t overlay_key_cntl; uint32_t overlay_scale_inc; uint32_t overlay_scale_cntl; - uint32_t overlay_y_x_start, overlay_y_x_end; + uint32_t overlay_y_x_start; + uint32_t overlay_y_x_end; uint32_t scaler_height_width; int scaler_format; int scaler_update; - uint32_t buf_offset[2], buf_pitch[2]; + uint32_t buf_offset[2]; + uint32_t buf_pitch[2]; int overlay_v_acc; uint8_t thread_run; - void *i2c, *ddc; + void *i2c; + void *ddc; } mach64_t; static video_timings_t timing_mach64_isa = { .type = VIDEO_ISA, .write_b = 3, .write_w = 3, .write_l = 6, .read_b = 5, .read_w = 5, .read_l = 10 }; @@ -362,9 +393,9 @@ mach64_log(const char *fmt, ...) #endif void -mach64_out(uint16_t addr, uint8_t val, void *p) +mach64_out(uint16_t addr, uint8_t val, void *priv) { - mach64_t *mach64 = p; + mach64_t *mach64 = priv; svga_t *svga = &mach64->svga; uint8_t old; @@ -426,14 +457,17 @@ mach64_out(uint16_t addr, uint8_t val, void *p) } } break; + + default: + break; } svga_out(addr, val, svga); } uint8_t -mach64_in(uint16_t addr, void *p) +mach64_in(uint16_t addr, void *priv) { - mach64_t *mach64 = p; + mach64_t *mach64 = priv; svga_t *svga = &mach64->svga; if (((addr & 0xFFF0) == 0x3D0 || (addr & 0xFFF0) == 0x3B0) && !(svga->miscout & 1)) @@ -459,6 +493,9 @@ mach64_in(uint16_t addr, void *p) if (svga->crtcreg > 0x18) return 0xff; return svga->crtc[svga->crtcreg]; + + default: + break; } return svga_in(addr, svga); } @@ -466,7 +503,7 @@ mach64_in(uint16_t addr, void *p) void mach64_recalctimings(svga_t *svga) { - mach64_t *mach64 = (mach64_t *) svga->p; + mach64_t *mach64 = (mach64_t *) svga->priv; if (((mach64->crtc_gen_cntl >> 24) & 3) == 3) { svga->vtotal = (mach64->crtc_v_total_disp & 2047) + 1; @@ -518,6 +555,9 @@ mach64_recalctimings(svga_t *svga) svga->hdisp <<= 3; svga->rowoffset <<= 1; break; + + default: + break; } svga->vram_display_mask = mach64->vram_mask; @@ -568,6 +608,9 @@ mach64_updatemapping(mach64_t *mach64) mem_mapping_set_addr(&svga->mapping, 0xb8000, 0x08000); svga->banked_mask = 0x7fff; break; + + default: + break; } mach64_log("Mach64 linear aperture = %08x.\n", mach64->linear_base); @@ -705,7 +748,7 @@ mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val) case 0x11e: case 0x11f: WRITE8(addr, mach64->dst_height_width, val); - /*FALLTHROUGH*/ + [[fallthrough]]; case 0x113: if (((addr & 0x3ff) == 0x11b || (addr & 0x3ff) == 0x11f || (addr & 0x3ff) == 0x113) && !(val & 0x80)) { mach64_start_fill(mach64); @@ -928,7 +971,7 @@ mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val) case 0x2a4: case 0x2a5: addr += 2; - /*FALLTHROUGH*/ + [[fallthrough]]; case 0x2aa: case 0x2ab: WRITE8(addr, mach64->sc_left_right, val); @@ -943,7 +986,7 @@ mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val) case 0x2b0: case 0x2b1: addr += 2; - /*FALLTHROUGH*/ + [[fallthrough]]; case 0x2b6: case 0x2b7: WRITE8(addr, mach64->sc_top_bottom, val); @@ -1033,6 +1076,9 @@ mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val) else mach64->host_cntl &= ~HOST_BYTE_ALIGN; break; + + default: + break; } } static void @@ -1197,7 +1243,7 @@ mach64_start_fill(mach64_t *mach64) mach64->accel.dst_y = 0; mach64->accel.dst_x_start = (mach64->dst_y_x >> 16) & 0xfff; - if (((mach64->dst_y_x >> 16) & 0x1000)) + if ((mach64->dst_y_x >> 16) & 0x1000) mach64->accel.dst_x_start |= ~0xfff; mach64->accel.dst_y_start = mach64->dst_y_x & 0x3fff; if (mach64->dst_y_x & 0x4000) @@ -1218,7 +1264,7 @@ mach64_start_fill(mach64_t *mach64) mach64->accel.src_y = 0; mach64->accel.src_x_start = (mach64->src_y_x >> 16) & 0xfff; - if (((mach64->src_y_x >> 16) & 0x1000)) + if ((mach64->src_y_x >> 16) & 0x1000) mach64->accel.src_x_start |= ~0xfff; mach64->accel.src_y_start = mach64->src_y_x & 0x3fff; if (mach64->src_y_x & 0x4000) @@ -1334,14 +1380,14 @@ void mach64_start_line(mach64_t *mach64) { mach64->accel.dst_x = (mach64->dst_y_x >> 16) & 0xfff; - if (((mach64->dst_y_x >> 16) & 0x1000)) + if ((mach64->dst_y_x >> 16) & 0x1000) mach64->accel.dst_x |= ~0xfff; mach64->accel.dst_y = mach64->dst_y_x & 0x3fff; if (mach64->dst_y_x & 0x4000) mach64->accel.dst_y |= ~0x3fff; mach64->accel.src_x = (mach64->src_y_x >> 16) & 0xfff; - if (((mach64->src_y_x >> 16) & 0x1000)) + if ((mach64->src_y_x >> 16) & 0x1000) mach64->accel.src_x |= ~0xfff; mach64->accel.src_y = mach64->src_y_x & 0x3fff; if (mach64->src_y_x & 0x4000) @@ -1554,6 +1600,9 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) case 2: count -= 32; break; + + default: + break; } } else count--; @@ -1581,9 +1630,12 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) READ(mach64->accel.src_offset + (src_y * mach64->accel.src_pitch) + src_x, mix, WIDTH_1BIT); } break; + + default: + break; } - if ((dst_x) >= mach64->accel.sc_left && (dst_x) <= mach64->accel.sc_right && (dst_y) >= mach64->accel.sc_top && (dst_y) <= mach64->accel.sc_bottom) { + if (dst_x >= mach64->accel.sc_left && dst_x <= mach64->accel.sc_right && dst_y >= mach64->accel.sc_top && dst_y <= mach64->accel.sc_bottom) { switch (mix ? mach64->accel.source_fg : mach64->accel.source_bg) { case SRC_HOST: src_dat = host_dat; @@ -1664,6 +1716,9 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) case 5: /*DST_CLR == CLR_CMP_CLR*/ cmp_clr = (((mach64->accel.clr_cmp_src) ? src_dat : dest_dat) & mach64->accel.clr_cmp_mask) == mach64->accel.clr_cmp_clr; break; + + default: + break; } if (!cmp_clr) { @@ -1788,6 +1843,9 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) case 2: count -= 32; break; + + default: + break; } } else count--; @@ -1811,6 +1869,9 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) case MONO_SRC_BLITSRC: READ(mach64->accel.src_offset + (mach64->accel.src_y * mach64->accel.src_pitch) + mach64->accel.src_x, mix, WIDTH_1BIT); break; + + default: + break; } if ((mach64->accel.dst_x >= mach64->accel.sc_left) && (mach64->accel.dst_x <= mach64->accel.sc_right) && (mach64->accel.dst_y >= mach64->accel.sc_top) && (mach64->accel.dst_y <= mach64->accel.sc_bottom)) { @@ -1852,6 +1913,9 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) case 5: /*DST_CLR == CLR_CMP_CLR*/ cmp_clr = (((mach64->accel.clr_cmp_src) ? src_dat : dest_dat) & mach64->accel.clr_cmp_mask) == mach64->accel.clr_cmp_clr; break; + + default: + break; } if (!cmp_clr) @@ -1915,6 +1979,9 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) case 2: count -= 32; break; + + default: + break; } } else count--; @@ -1976,6 +2043,9 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) case 5: /*DST_CLR == CLR_CMP_CLR*/ cmp_clr = (((mach64->accel.clr_cmp_src) ? src_dat : dest_dat) & mach64->accel.clr_cmp_mask) == mach64->accel.clr_cmp_clr; break; + + default: + break; } if (!cmp_clr) @@ -2013,6 +2083,9 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) mach64->accel.src_y++; mach64->accel.dst_y++; break; + + default: + break; } mach64_log("x %i y %i err %i inc %i dec %i\n", mach64->accel.dst_x, mach64->accel.dst_y, mach64->accel.err, mach64->dst_bres_inc, mach64->dst_bres_dec); if (mach64->accel.err >= 0) { @@ -2039,12 +2112,18 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) mach64->accel.src_x++; mach64->accel.dst_x++; break; + + default: + break; } } else mach64->accel.err += mach64->dst_bres_inc; } } break; + + default: + break; } } @@ -2144,6 +2223,9 @@ pll_write(mach64_t *mach64, uint32_t addr, uint8_t val) mach64_log(" %g\n", mach64->pll_freq[c]); } break; + + default: + break; } } @@ -2151,7 +2233,7 @@ pll_write(mach64_t *mach64, uint32_t addr, uint8_t val) static void mach64_vblank_start(svga_t *svga) { - mach64_t *mach64 = (mach64_t *) svga->p; + mach64_t *mach64 = (mach64_t *) svga->priv; int overlay_cmp_mix = (mach64->overlay_key_cntl >> 8) & 0xf; mach64->crtc_int_cntl |= 4; @@ -2173,9 +2255,9 @@ mach64_vblank_start(svga_t *svga) } uint8_t -mach64_ext_readb(uint32_t addr, void *p) +mach64_ext_readb(uint32_t addr, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; uint8_t ret = 0xff; if (!(addr & 0x400)) { @@ -2789,9 +2871,9 @@ mach64_ext_readb(uint32_t addr, void *p) return ret; } uint16_t -mach64_ext_readw(uint32_t addr, void *p) +mach64_ext_readw(uint32_t addr, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; uint16_t ret; if (!(addr & 0x400)) { mach64_log("nmach64_ext_readw: addr=%04x\n", addr); @@ -2808,8 +2890,8 @@ mach64_ext_readw(uint32_t addr, void *p) break; default: - ret = mach64_ext_readb(addr, p); - ret |= mach64_ext_readb(addr + 1, p) << 8; + ret = mach64_ext_readb(addr, priv); + ret |= mach64_ext_readb(addr + 1, priv) << 8; break; } if ((addr & 0x3fc) != 0x018) @@ -2817,9 +2899,9 @@ mach64_ext_readw(uint32_t addr, void *p) return ret; } uint32_t -mach64_ext_readl(uint32_t addr, void *p) +mach64_ext_readl(uint32_t addr, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; uint32_t ret; if (!(addr & 0x400)) { mach64_log("nmach64_ext_readl: addr=%04x\n", addr); @@ -2840,8 +2922,8 @@ mach64_ext_readl(uint32_t addr, void *p) break; default: - ret = mach64_ext_readw(addr, p); - ret |= mach64_ext_readw(addr + 2, p) << 16; + ret = mach64_ext_readw(addr, priv); + ret |= mach64_ext_readw(addr + 2, priv) << 16; break; } if ((addr & 0x3fc) != 0x018) @@ -2850,9 +2932,9 @@ mach64_ext_readl(uint32_t addr, void *p) } void -mach64_ext_writeb(uint32_t addr, uint8_t val, void *p) +mach64_ext_writeb(uint32_t addr, uint8_t val, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; svga_t *svga = &mach64->svga; mach64_log("mach64_ext_writeb : addr %08X val %02X\n", addr, val); @@ -2952,6 +3034,9 @@ mach64_ext_writeb(uint32_t addr, uint8_t val, void *p) case 0xa7: WRITE8(addr, mach64->buf_pitch[1], val); break; + + default: + break; } mach64_log("nmach64_ext_writeb: addr=%04x val=%02x\n", addr, val); @@ -3169,18 +3254,21 @@ mach64_ext_writeb(uint32_t addr, uint8_t val, void *p) if (mach64->type != MACH64_GX) WRITE8(addr, mach64->config_stat0, val); break; + + default: + break; } } void -mach64_ext_writew(uint32_t addr, uint16_t val, void *p) +mach64_ext_writew(uint32_t addr, uint16_t val, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; mach64_log("mach64_ext_writew : addr %08X val %04X\n", addr, val); if (!(addr & 0x400)) { mach64_log("mach64_ext_writew: addr=%04x val=%04x\n", addr, val); - mach64_ext_writeb(addr, val, p); - mach64_ext_writeb(addr + 1, val >> 8, p); + mach64_ext_writeb(addr, val, priv); + mach64_ext_writeb(addr + 1, val >> 8, priv); } else if (addr & 0x300) { if (((mach64->crtc_gen_cntl >> 8) & 7) == BPP_24) mach64_accel_write_fifo_w(mach64, addr & 0x3fe, val); @@ -3189,22 +3277,22 @@ mach64_ext_writew(uint32_t addr, uint16_t val, void *p) } else switch (addr & 0x3fe) { default: - mach64_ext_writeb(addr, val, p); - mach64_ext_writeb(addr + 1, val >> 8, p); + mach64_ext_writeb(addr, val, priv); + mach64_ext_writeb(addr + 1, val >> 8, priv); break; } } void -mach64_ext_writel(uint32_t addr, uint32_t val, void *p) +mach64_ext_writel(uint32_t addr, uint32_t val, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; if ((addr & 0x3c0) != 0x200) mach64_log("mach64_ext_writel : addr %08X val %08X\n", addr, val); if (!(addr & 0x400)) { mach64_log("mach64_ext_writel: addr=%04x val=%08x\n", addr, val); - mach64_ext_writew(addr, val, p); - mach64_ext_writew(addr + 2, val >> 16, p); + mach64_ext_writew(addr, val, priv); + mach64_ext_writew(addr + 2, val >> 16, priv); } else if (addr & 0x300) { if (((mach64->crtc_gen_cntl >> 8) & 7) == BPP_24) mach64_accel_write_fifo_l(mach64, addr & 0x3fc, val); @@ -3213,16 +3301,16 @@ mach64_ext_writel(uint32_t addr, uint32_t val, void *p) } else switch (addr & 0x3fc) { default: - mach64_ext_writew(addr, val, p); - mach64_ext_writew(addr + 2, val >> 16, p); + mach64_ext_writew(addr, val, priv); + mach64_ext_writew(addr + 2, val >> 16, priv); break; } } uint8_t -mach64_ext_inb(uint16_t port, void *p) +mach64_ext_inb(uint16_t port, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; uint8_t ret = 0xff; switch (port) { @@ -3234,135 +3322,135 @@ mach64_ext_inb(uint16_t port, void *p) case 0x7eed: case 0x7eee: case 0x7eef: - ret = mach64_ext_readb(0x400 | 0x00 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x00 | (port & 3), priv); break; case 0x0aec: case 0x0aed: case 0x0aee: case 0x0aef: - ret = mach64_ext_readb(0x400 | 0x08 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x08 | (port & 3), priv); break; case 0x0eec: case 0x0eed: case 0x0eee: case 0x0eef: - ret = mach64_ext_readb(0x400 | 0x0c | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x0c | (port & 3), priv); break; case 0x12ec: case 0x12ed: case 0x12ee: case 0x12ef: - ret = mach64_ext_readb(0x400 | 0x10 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x10 | (port & 3), priv); break; case 0x16ec: case 0x16ed: case 0x16ee: case 0x16ef: - ret = mach64_ext_readb(0x400 | 0x14 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x14 | (port & 3), priv); break; case 0x1aec: - ret = mach64_ext_readb(0x400 | 0x18, p); + ret = mach64_ext_readb(0x400 | 0x18, priv); break; case 0x1eec: case 0x1eed: case 0x1eee: case 0x1eef: - ret = mach64_ext_readb(0x400 | 0x1c | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x1c | (port & 3), priv); break; case 0x22ec: case 0x22ed: case 0x22ee: case 0x22ef: - ret = mach64_ext_readb(0x400 | 0x40 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x40 | (port & 3), priv); break; case 0x26ec: case 0x26ed: case 0x26ee: case 0x26ef: - ret = mach64_ext_readb(0x400 | 0x44 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x44 | (port & 3), priv); break; case 0x2aec: case 0x2aed: case 0x2aee: case 0x2aef: - ret = mach64_ext_readb(0x400 | 0x48 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x48 | (port & 3), priv); break; case 0x2eec: case 0x2eed: case 0x2eee: case 0x2eef: - ret = mach64_ext_readb(0x400 | 0x60 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x60 | (port & 3), priv); break; case 0x32ec: case 0x32ed: case 0x32ee: case 0x32ef: - ret = mach64_ext_readb(0x400 | 0x64 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x64 | (port & 3), priv); break; case 0x36ec: case 0x36ed: case 0x36ee: case 0x36ef: - ret = mach64_ext_readb(0x400 | 0x68 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x68 | (port & 3), priv); break; case 0x3aec: case 0x3aed: case 0x3aee: case 0x3aef: - ret = mach64_ext_readb(0x400 | 0x6c | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x6c | (port & 3), priv); break; case 0x3eec: case 0x3eed: case 0x3eee: case 0x3eef: - ret = mach64_ext_readb(0x400 | 0x70 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x70 | (port & 3), priv); break; case 0x42ec: case 0x42ed: case 0x42ee: case 0x42ef: - ret = mach64_ext_readb(0x400 | 0x80 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x80 | (port & 3), priv); break; case 0x46ec: case 0x46ed: case 0x46ee: case 0x46ef: - ret = mach64_ext_readb(0x400 | 0x84 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x84 | (port & 3), priv); break; case 0x4aec: case 0x4aed: case 0x4aee: case 0x4aef: - ret = mach64_ext_readb(0x400 | 0x90 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0x90 | (port & 3), priv); break; case 0x52ec: case 0x52ed: case 0x52ee: case 0x52ef: - ret = mach64_ext_readb(0x400 | 0xb0 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0xb0 | (port & 3), priv); break; case 0x56ec: - ret = mach64_ext_readb(0x400 | 0xb4, p); + ret = mach64_ext_readb(0x400 | 0xb4, priv); break; case 0x56ed: case 0x56ee: - ret = mach64_ext_readb(0x400 | 0xb5, p); + ret = mach64_ext_readb(0x400 | 0xb5, priv); break; case 0x5aec: - ret = mach64_ext_readb(0x400 | 0xb8, p); + ret = mach64_ext_readb(0x400 | 0xb8, priv); break; case 0x5aed: case 0x5aee: - ret = mach64_ext_readb(0x400 | 0xb9, p); + ret = mach64_ext_readb(0x400 | 0xb9, priv); break; case 0x5eec: @@ -3379,14 +3467,14 @@ mach64_ext_inb(uint16_t port, void *p) case 0x62ed: case 0x62ee: case 0x62ef: - ret = mach64_ext_readb(0x400 | 0xc4 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0xc4 | (port & 3), priv); break; case 0x66ec: case 0x66ed: case 0x66ee: case 0x66ef: - ret = mach64_ext_readb(0x400 | 0xd0 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0xd0 | (port & 3), priv); break; case 0x6aec: @@ -3401,14 +3489,14 @@ mach64_ext_inb(uint16_t port, void *p) case 0x6eed: case 0x6eee: case 0x6eef: - ret = mach64_ext_readb(0x400 | 0xe0 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0xe0 | (port & 3), priv); break; case 0x72ec: case 0x72ed: case 0x72ee: case 0x72ef: - ret = mach64_ext_readb(0x400 | 0xe4 | (port & 3), p); + ret = mach64_ext_readb(0x400 | 0xe4 | (port & 3), priv); break; default: @@ -3419,33 +3507,33 @@ mach64_ext_inb(uint16_t port, void *p) return ret; } uint16_t -mach64_ext_inw(uint16_t port, void *p) +mach64_ext_inw(uint16_t port, void *priv) { uint16_t ret; switch (port) { default: - ret = mach64_ext_inb(port, p); - ret |= (mach64_ext_inb(port + 1, p) << 8); + ret = mach64_ext_inb(port, priv); + ret |= (mach64_ext_inb(port + 1, priv) << 8); break; } mach64_log("mach64_ext_inw : port %04X ret %04X\n", port, ret); return ret; } uint32_t -mach64_ext_inl(uint16_t port, void *p) +mach64_ext_inl(uint16_t port, void *priv) { uint32_t ret; switch (port) { case 0x56ec: - ret = mach64_ext_readl(0x400 | 0xb4, p); + ret = mach64_ext_readl(0x400 | 0xb4, priv); break; case 0x5aec: - ret = mach64_ext_readl(0x400 | 0xb8, p); + ret = mach64_ext_readl(0x400 | 0xb8, priv); break; default: - ret = mach64_ext_inw(port, p); - ret |= (mach64_ext_inw(port + 2, p) << 16); + ret = mach64_ext_inw(port, priv); + ret |= (mach64_ext_inw(port + 2, priv) << 16); break; } mach64_log("mach64_ext_inl : port %04X ret %08X\n", port, ret); @@ -3453,9 +3541,9 @@ mach64_ext_inl(uint16_t port, void *p) } void -mach64_ext_outb(uint16_t port, uint8_t val, void *p) +mach64_ext_outb(uint16_t port, uint8_t val, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; mach64_log("mach64_ext_outb : port %04X val %02X\n", port, val); switch (port) { @@ -3467,128 +3555,128 @@ mach64_ext_outb(uint16_t port, uint8_t val, void *p) case 0x7eed: case 0x7eee: case 0x7eef: - mach64_ext_writeb(0x400 | 0x00 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x00 | (port & 3), val, priv); break; case 0x0aec: case 0x0aed: case 0x0aee: case 0x0aef: - mach64_ext_writeb(0x400 | 0x08 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x08 | (port & 3), val, priv); break; case 0x0eec: case 0x0eed: case 0x0eee: case 0x0eef: - mach64_ext_writeb(0x400 | 0x0c | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x0c | (port & 3), val, priv); break; case 0x16ec: case 0x16ed: case 0x16ee: case 0x16ef: - mach64_ext_writeb(0x400 | 0x14 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x14 | (port & 3), val, priv); break; case 0x1aec: - mach64_ext_writeb(0x400 | 0x18, val, p); + mach64_ext_writeb(0x400 | 0x18, val, priv); break; case 0x1eec: case 0x1eed: case 0x1eee: case 0x1eef: - mach64_ext_writeb(0x400 | 0x1c | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x1c | (port & 3), val, priv); break; case 0x22ec: case 0x22ed: case 0x22ee: case 0x22ef: - mach64_ext_writeb(0x400 | 0x40 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x40 | (port & 3), val, priv); break; case 0x26ec: case 0x26ed: case 0x26ee: case 0x26ef: - mach64_ext_writeb(0x400 | 0x44 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x44 | (port & 3), val, priv); break; case 0x2aec: case 0x2aed: case 0x2aee: case 0x2aef: - mach64_ext_writeb(0x400 | 0x48 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x48 | (port & 3), val, priv); break; case 0x2eec: case 0x2eed: case 0x2eee: case 0x2eef: - mach64_ext_writeb(0x400 | 0x60 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x60 | (port & 3), val, priv); break; case 0x32ec: case 0x32ed: case 0x32ee: case 0x32ef: - mach64_ext_writeb(0x400 | 0x64 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x64 | (port & 3), val, priv); break; case 0x36ec: case 0x36ed: case 0x36ee: case 0x36ef: - mach64_ext_writeb(0x400 | 0x68 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x68 | (port & 3), val, priv); break; case 0x3aec: case 0x3aed: case 0x3aee: case 0x3aef: - mach64_ext_writeb(0x400 | 0x6c | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x6c | (port & 3), val, priv); break; case 0x3eec: case 0x3eed: case 0x3eee: case 0x3eef: - mach64_ext_writeb(0x400 | 0x70 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x70 | (port & 3), val, priv); break; case 0x42ec: case 0x42ed: case 0x42ee: case 0x42ef: - mach64_ext_writeb(0x400 | 0x80 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x80 | (port & 3), val, priv); break; case 0x46ec: case 0x46ed: case 0x46ee: case 0x46ef: - mach64_ext_writeb(0x400 | 0x84 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x84 | (port & 3), val, priv); break; case 0x4aec: case 0x4aed: case 0x4aee: case 0x4aef: - mach64_ext_writeb(0x400 | 0x90 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0x90 | (port & 3), val, priv); break; case 0x52ec: case 0x52ed: case 0x52ee: case 0x52ef: - mach64_ext_writeb(0x400 | 0xb0 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0xb0 | (port & 3), val, priv); break; case 0x56ec: - mach64_ext_writeb(0x400 | 0xb4, val, p); + mach64_ext_writeb(0x400 | 0xb4, val, priv); break; case 0x56ed: case 0x56ee: - mach64_ext_writeb(0x400 | 0xb5, val, p); + mach64_ext_writeb(0x400 | 0xb5, val, priv); break; case 0x5aec: - mach64_ext_writeb(0x400 | 0xb8, val, p); + mach64_ext_writeb(0x400 | 0xb8, val, priv); break; case 0x5aed: case 0x5aee: - mach64_ext_writeb(0x400 | 0xb9, val, p); + mach64_ext_writeb(0x400 | 0xb9, val, priv); break; case 0x5eec: @@ -3605,14 +3693,14 @@ mach64_ext_outb(uint16_t port, uint8_t val, void *p) case 0x62ed: case 0x62ee: case 0x62ef: - mach64_ext_writeb(0x400 | 0xc4 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0xc4 | (port & 3), val, priv); break; case 0x66ec: case 0x66ed: case 0x66ee: case 0x66ef: - mach64_ext_writeb(0x400 | 0xd0 | (port & 3), val, p); + mach64_ext_writeb(0x400 | 0xd0 | (port & 3), val, priv); break; case 0x6aec: @@ -3625,32 +3713,32 @@ mach64_ext_outb(uint16_t port, uint8_t val, void *p) } } void -mach64_ext_outw(uint16_t port, uint16_t val, void *p) +mach64_ext_outw(uint16_t port, uint16_t val, void *priv) { mach64_log("mach64_ext_outw : port %04X val %04X\n", port, val); switch (port) { default: - mach64_ext_outb(port, val, p); - mach64_ext_outb(port + 1, val >> 8, p); + mach64_ext_outb(port, val, priv); + mach64_ext_outb(port + 1, val >> 8, priv); break; } } void -mach64_ext_outl(uint16_t port, uint32_t val, void *p) +mach64_ext_outl(uint16_t port, uint32_t val, void *priv) { mach64_log("mach64_ext_outl : port %04X val %08X\n", port, val); switch (port) { default: - mach64_ext_outw(port, val, p); - mach64_ext_outw(port + 2, val >> 16, p); + mach64_ext_outw(port, val, priv); + mach64_ext_outw(port + 2, val >> 16, priv); break; } } static uint8_t -mach64_block_inb(uint16_t port, void *p) +mach64_block_inb(uint16_t port, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; uint8_t ret; ret = mach64_ext_readb(0x400 | (port & 0x3ff), mach64); @@ -3658,9 +3746,9 @@ mach64_block_inb(uint16_t port, void *p) return ret; } static uint16_t -mach64_block_inw(uint16_t port, void *p) +mach64_block_inw(uint16_t port, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; uint16_t ret; ret = mach64_ext_readw(0x400 | (port & 0x3ff), mach64); @@ -3668,9 +3756,9 @@ mach64_block_inw(uint16_t port, void *p) return ret; } static uint32_t -mach64_block_inl(uint16_t port, void *p) +mach64_block_inl(uint16_t port, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; uint32_t ret; ret = mach64_ext_readl(0x400 | (port & 0x3ff), mach64); @@ -3679,51 +3767,51 @@ mach64_block_inl(uint16_t port, void *p) } static void -mach64_block_outb(uint16_t port, uint8_t val, void *p) +mach64_block_outb(uint16_t port, uint8_t val, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; mach64_log("mach64_block_outb : port %04X val %02X\n ", port, val); mach64_ext_writeb(0x400 | (port & 0x3ff), val, mach64); } static void -mach64_block_outw(uint16_t port, uint16_t val, void *p) +mach64_block_outw(uint16_t port, uint16_t val, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; mach64_log("mach64_block_outw : port %04X val %04X\n ", port, val); mach64_ext_writew(0x400 | (port & 0x3ff), val, mach64); } static void -mach64_block_outl(uint16_t port, uint32_t val, void *p) +mach64_block_outl(uint16_t port, uint32_t val, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; mach64_log("mach64_block_outl : port %04X val %08X\n ", port, val); mach64_ext_writel(0x400 | (port & 0x3ff), val, mach64); } void -mach64_write(uint32_t addr, uint8_t val, void *p) +mach64_write(uint32_t addr, uint8_t val, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; svga_t *svga = &mach64->svga; addr = (addr & 0x7fff) + mach64->bank_w[(addr >> 15) & 1]; svga_write_linear(addr, val, svga); } void -mach64_writew(uint32_t addr, uint16_t val, void *p) +mach64_writew(uint32_t addr, uint16_t val, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; svga_t *svga = &mach64->svga; addr = (addr & 0x7fff) + mach64->bank_w[(addr >> 15) & 1]; svga_writew_linear(addr, val, svga); } void -mach64_writel(uint32_t addr, uint32_t val, void *p) +mach64_writel(uint32_t addr, uint32_t val, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; svga_t *svga = &mach64->svga; addr = (addr & 0x7fff) + mach64->bank_w[(addr >> 15) & 1]; @@ -3731,9 +3819,9 @@ mach64_writel(uint32_t addr, uint32_t val, void *p) } uint8_t -mach64_read(uint32_t addr, void *p) +mach64_read(uint32_t addr, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; svga_t *svga = &mach64->svga; uint8_t ret; addr = (addr & 0x7fff) + mach64->bank_r[(addr >> 15) & 1]; @@ -3741,18 +3829,18 @@ mach64_read(uint32_t addr, void *p) return ret; } uint16_t -mach64_readw(uint32_t addr, void *p) +mach64_readw(uint32_t addr, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; svga_t *svga = &mach64->svga; addr = (addr & 0x7fff) + mach64->bank_r[(addr >> 15) & 1]; return svga_readw_linear(addr, svga); } uint32_t -mach64_readl(uint32_t addr, void *p) +mach64_readl(uint32_t addr, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; svga_t *svga = &mach64->svga; addr = (addr & 0x7fff) + mach64->bank_r[(addr >> 15) & 1]; @@ -3886,7 +3974,7 @@ mach64_readl(uint32_t addr, void *p) void mach64_overlay_draw(svga_t *svga, int displine) { - mach64_t *mach64 = (mach64_t *) svga->p; + mach64_t *mach64 = (mach64_t *) svga->priv; int x; int h_acc = 0; int h_max = (mach64->scaler_height_width >> 16) & 0x3ff; @@ -3960,6 +4048,9 @@ mach64_overlay_draw(svga_t *svga, int displine) case 5: vid_cmp = !((mach64->overlay_dat[h] ^ mach64->overlay_video_key_clr) & mach64->overlay_video_key_msk); break; + + default: + break; } switch (graphics_key_fn) { case 0: @@ -3974,6 +4065,9 @@ mach64_overlay_draw(svga_t *svga, int displine) case 5: gr_cmp = !(((p[x]) ^ mach64->overlay_graphics_key_clr) & mach64->overlay_graphics_key_msk & 0xffffff); break; + + default: + break; } vid_cmp = vid_cmp ? -1 : 0; gr_cmp = gr_cmp ? -1 : 0; @@ -4027,6 +4121,9 @@ mach64_overlay_draw(svga_t *svga, int displine) case 0xf: use_video = ~gr_cmp & ~vid_cmp; break; + + default: + break; } if (use_video) @@ -4058,8 +4155,8 @@ mach64_io_remove(mach64_t *mach64) uint16_t io_base = 0x02ec; switch (mach64->io_base) { - case 0: default: + case 0: io_base = 0x02ec; break; case 1: @@ -4111,9 +4208,9 @@ mach64_io_set(mach64_t *mach64) } uint8_t -mach64_pci_read(int func, int addr, void *p) +mach64_pci_read(UNUSED(int func), int addr, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; switch (addr) { case 0x00: @@ -4187,14 +4284,17 @@ mach64_pci_read(int func, int addr, void *p) case 0x40: return mach64->use_block_decoded_io | mach64->io_base; + + default: + break; } return 0; } void -mach64_pci_write(int func, int addr, uint8_t val, void *p) +mach64_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; switch (addr) { case PCI_REG_COMMAND: @@ -4272,6 +4372,9 @@ mach64_pci_write(int func, int addr, uint8_t val, void *p) if (mach64->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_IO) mach64_io_set(mach64); break; + + default: + break; } } @@ -4413,9 +4516,9 @@ mach64vt2_available(void) } void -mach64_close(void *p) +mach64_close(void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; mach64->thread_run = 0; thread_set_event(mach64->wake_fifo_thread); @@ -4432,17 +4535,17 @@ mach64_close(void *p) } void -mach64_speed_changed(void *p) +mach64_speed_changed(void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; svga_recalctimings(&mach64->svga); } void -mach64_force_redraw(void *p) +mach64_force_redraw(void *priv) { - mach64_t *mach64 = (mach64_t *) p; + mach64_t *mach64 = (mach64_t *) priv; mach64->svga.fullchange = changeframecount; } diff --git a/src/video/vid_ati_mach8.c b/src/video/vid_ati_mach8.c index 9c0cbb616..4114fafd7 100644 --- a/src/video/vid_ati_mach8.c +++ b/src/video/vid_ati_mach8.c @@ -147,10 +147,10 @@ static video_timings_t timing_mach32_vlb = { .type = VIDEO_BUS, .write_b = 2, .w static video_timings_t timing_mach32_pci = { .type = VIDEO_PCI, .write_b = 2, .write_w = 2, .write_l = 1, .read_b = 20, .read_w = 20, .read_l = 21 }; -static void mach_accel_outb(uint16_t port, uint8_t val, void *p); -static void mach_accel_outw(uint16_t port, uint16_t val, void *p); -static uint8_t mach_accel_inb(uint16_t port, void *p); -static uint16_t mach_accel_inw(uint16_t port, void *p); +static void mach_accel_outb(uint16_t port, uint8_t val, void *priv); +static void mach_accel_outw(uint16_t port, uint16_t val, void *priv); +static uint8_t mach_accel_inb(uint16_t port, void *priv); +static uint16_t mach_accel_inw(uint16_t port, void *priv); static void mach32_updatemapping(mach_t *mach); @@ -368,7 +368,7 @@ mach_pixel_read(mach_t *mach) } static void -mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint32_t cpu_dat, mach_t *mach, ibm8514_t *dev, int len) +mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint32_t cpu_dat, mach_t *mach, ibm8514_t *dev, UNUSED(int len)) { svga_t *svga = &mach->svga; int compare_mode; @@ -376,9 +376,12 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 uint16_t rd_mask = dev->accel.rd_mask; uint16_t wrt_mask = dev->accel.wrt_mask; uint16_t dest_cmp_clr = dev->accel.color_cmp; - int frgd_sel, bkgd_sel, mono_src; + int frgd_sel; + int bkgd_sel; + int mono_src; int compare = 0; - uint16_t src_dat = 0, dest_dat = 0; + uint16_t src_dat = 0; + uint16_t dest_dat = 0; uint16_t old_dest_dat; uint16_t *vram_w = (uint16_t *) svga->vram; uint16_t mix = 0; @@ -386,7 +389,8 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 int16_t clip_t = dev->accel.clip_top & 0x7ff; int16_t clip_r = dev->accel.multifunc[4] & 0x7ff; int16_t clip_b = dev->accel.multifunc[3] & 0x7ff; - uint32_t mono_dat0 = 0, mono_dat1 = 0; + uint32_t mono_dat0 = 0; + uint32_t mono_dat1 = 0; if ((svga->bpp == 8) || (svga->bpp == 24)) { rd_mask &= 0xff; @@ -518,9 +522,12 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 } mix = (mix & rd_mask) == rd_mask; break; + + default: + break; } - if ((((dev->accel.dx) >= clip_l) && ((dev->accel.dx) <= clip_r) && ((dev->accel.dy) >= clip_t) && ((dev->accel.dy) <= clip_b))) { + if (((dev->accel.dx) >= clip_l) && ((dev->accel.dx) <= clip_r) && ((dev->accel.dy) >= clip_t) && ((dev->accel.dy) <= clip_b)) { if (mach->accel.linedraw_opt & 0x02) { if ((svga->bpp == 15) || (svga->bpp == 16)) { READ((mach->accel.ge_offset << 1) + ((dev->accel.cy) * (dev->pitch)) + (dev->accel.cx), poly_src, dev->local); @@ -563,6 +570,9 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 } else src_dat = 0; break; + + default: + break; } if ((svga->bpp == 15) || (svga->bpp == 16)) { @@ -577,22 +587,25 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 compare = 1; break; case 2: - compare = ((dest_dat) >= dest_cmp_clr) ? 0 : 1; + compare = (dest_dat >= dest_cmp_clr) ? 0 : 1; break; case 3: - compare = ((dest_dat) < dest_cmp_clr) ? 0 : 1; + compare = (dest_dat < dest_cmp_clr) ? 0 : 1; break; case 4: - compare = ((dest_dat) != dest_cmp_clr) ? 0 : 1; + compare = (dest_dat != dest_cmp_clr) ? 0 : 1; break; case 5: - compare = ((dest_dat) == dest_cmp_clr) ? 0 : 1; + compare = (dest_dat == dest_cmp_clr) ? 0 : 1; break; case 6: - compare = ((dest_dat) <= dest_cmp_clr) ? 0 : 1; + compare = (dest_dat <= dest_cmp_clr) ? 0 : 1; break; case 7: - compare = ((dest_dat) > dest_cmp_clr) ? 0 : 1; + compare = (dest_dat > dest_cmp_clr) ? 0 : 1; + break; + + default: break; } @@ -674,6 +687,9 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 dev->accel.cy++; dev->accel.dy++; break; + + default: + break; } dev->accel.sx++; @@ -717,9 +733,12 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 } mix = (mix & rd_mask) == rd_mask; break; + + default: + break; } - if ((((dev->accel.dx) >= clip_l) && ((dev->accel.dx) <= clip_r) && ((dev->accel.dy) >= clip_t) && ((dev->accel.dy) <= clip_b))) { + if (((dev->accel.dx) >= clip_l) && ((dev->accel.dx) <= clip_r) && ((dev->accel.dy) >= clip_t) && ((dev->accel.dy) <= clip_b)) { if (mach->accel.linedraw_opt & 0x02) { if ((svga->bpp == 15) || (svga->bpp == 16)) { READ((mach->accel.ge_offset << 1) + ((dev->accel.cy) * (dev->pitch)) + (dev->accel.cx), poly_src, dev->local); @@ -762,6 +781,9 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 } else src_dat = 0; break; + + default: + break; } if ((svga->bpp == 15) || (svga->bpp == 16)) { @@ -776,22 +798,25 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 compare = 1; break; case 2: - compare = ((dest_dat) >= dest_cmp_clr) ? 0 : 1; + compare = (dest_dat >= dest_cmp_clr) ? 0 : 1; break; case 3: - compare = ((dest_dat) < dest_cmp_clr) ? 0 : 1; + compare = (dest_dat < dest_cmp_clr) ? 0 : 1; break; case 4: - compare = ((dest_dat) != dest_cmp_clr) ? 0 : 1; + compare = (dest_dat != dest_cmp_clr) ? 0 : 1; break; case 5: - compare = ((dest_dat) == dest_cmp_clr) ? 0 : 1; + compare = (dest_dat == dest_cmp_clr) ? 0 : 1; break; case 6: - compare = ((dest_dat) <= dest_cmp_clr) ? 0 : 1; + compare = (dest_dat <= dest_cmp_clr) ? 0 : 1; break; case 7: - compare = ((dest_dat) > dest_cmp_clr) ? 0 : 1; + compare = (dest_dat > dest_cmp_clr) ? 0 : 1; + break; + + default: break; } @@ -1051,7 +1076,7 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 mach->accel.color_pattern_idx = mach->accel.patt_idx; } - if ((mach->accel.dy_end == mach->accel.dy_start)) { + if (mach->accel.dy_end == mach->accel.dy_start) { mach_log("No DEST.\n"); return; } @@ -1112,10 +1137,13 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 READ(dev->accel.src + ((dev->accel.cx)), mix, dev->local); mix = (mix & rd_mask) == rd_mask; break; + + default: + break; } - if (((dev->accel.dx) >= (clip_l) && (dev->accel.dx) <= (clip_r) && - (dev->accel.dy) >= (clip_t) && (dev->accel.dy) <= (clip_b))) { + if ((dev->accel.dx) >= clip_l && (dev->accel.dx) <= clip_r && + (dev->accel.dy) >= clip_t && (dev->accel.dy) <= clip_b) { if (mach->accel.dp_config & 0x02) { READ(dev->accel.src + (dev->accel.cx), poly_src, dev->local); poly_src = ((poly_src & rd_mask) == rd_mask); @@ -1154,6 +1182,9 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 } else src_dat = 0; break; + + default: + break; } } @@ -1172,22 +1203,25 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 compare = 1; break; case 2: - compare = ((dest_dat) >= dest_cmp_clr) ? 0 : 1; + compare = (dest_dat >= dest_cmp_clr) ? 0 : 1; break; case 3: - compare = ((dest_dat) < dest_cmp_clr) ? 0 : 1; + compare = (dest_dat < dest_cmp_clr) ? 0 : 1; break; case 4: - compare = ((dest_dat) != dest_cmp_clr) ? 0 : 1; + compare = (dest_dat != dest_cmp_clr) ? 0 : 1; break; case 5: - compare = ((dest_dat) == dest_cmp_clr) ? 0 : 1; + compare = (dest_dat == dest_cmp_clr) ? 0 : 1; break; case 6: - compare = ((dest_dat) <= dest_cmp_clr) ? 0 : 1; + compare = (dest_dat <= dest_cmp_clr) ? 0 : 1; break; case 7: - compare = ((dest_dat) > dest_cmp_clr) ? 0 : 1; + compare = (dest_dat > dest_cmp_clr) ? 0 : 1; + break; + + default: break; } @@ -1367,7 +1401,7 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 mix_dat <<= 1; mix_dat |= 1; - if ((((dev->accel.cx) >= clip_l) && ((dev->accel.cx) <= clip_r) && ((dev->accel.cy) >= clip_t) && ((dev->accel.cy) <= clip_b))) { + if (((dev->accel.cx) >= clip_l) && ((dev->accel.cx) <= clip_r) && ((dev->accel.cy) >= clip_t) && ((dev->accel.cy) <= clip_b)) { mach->accel.clip_overrun = 0; switch (mix ? frgd_sel : bkgd_sel) { case 0: @@ -1392,6 +1426,9 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 } else src_dat = 0; break; + + default: + break; } if ((svga->bpp == 15) || (svga->bpp == 16)) { @@ -1405,22 +1442,25 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 compare = 1; break; case 2: - compare = ((dest_dat) >= dest_cmp_clr) ? 0 : 1; + compare = (dest_dat >= dest_cmp_clr) ? 0 : 1; break; case 3: - compare = ((dest_dat) < dest_cmp_clr) ? 0 : 1; + compare = (dest_dat < dest_cmp_clr) ? 0 : 1; break; case 4: - compare = ((dest_dat) != dest_cmp_clr) ? 0 : 1; + compare = (dest_dat != dest_cmp_clr) ? 0 : 1; break; case 5: - compare = ((dest_dat) == dest_cmp_clr) ? 0 : 1; + compare = (dest_dat == dest_cmp_clr) ? 0 : 1; break; case 6: - compare = ((dest_dat) <= dest_cmp_clr) ? 0 : 1; + compare = (dest_dat <= dest_cmp_clr) ? 0 : 1; break; case 7: - compare = ((dest_dat) > dest_cmp_clr) ? 0 : 1; + compare = (dest_dat > dest_cmp_clr) ? 0 : 1; + break; + + default: break; } @@ -1478,9 +1518,12 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 } } break; + + default: + break; } - if ((((dev->accel.cx) >= clip_l) && ((dev->accel.cx) <= clip_r) && ((dev->accel.cy) >= clip_t) && ((dev->accel.cy) <= clip_b))) { + if (((dev->accel.cx) >= clip_l) && ((dev->accel.cx) <= clip_r) && ((dev->accel.cy) >= clip_t) && ((dev->accel.cy) <= clip_b)) { mach->accel.clip_overrun = 0; switch (mix ? frgd_sel : bkgd_sel) { case 0: @@ -1505,6 +1548,9 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 } else src_dat = 0; break; + + default: + break; } if ((svga->bpp == 15) || (svga->bpp == 16)) { @@ -1518,22 +1564,25 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 compare = 1; break; case 2: - compare = ((dest_dat) >= dest_cmp_clr) ? 0 : 1; + compare = (dest_dat >= dest_cmp_clr) ? 0 : 1; break; case 3: - compare = ((dest_dat) < dest_cmp_clr) ? 0 : 1; + compare = (dest_dat < dest_cmp_clr) ? 0 : 1; break; case 4: - compare = ((dest_dat) != dest_cmp_clr) ? 0 : 1; + compare = (dest_dat != dest_cmp_clr) ? 0 : 1; break; case 5: - compare = ((dest_dat) == dest_cmp_clr) ? 0 : 1; + compare = (dest_dat == dest_cmp_clr) ? 0 : 1; break; case 6: - compare = ((dest_dat) <= dest_cmp_clr) ? 0 : 1; + compare = (dest_dat <= dest_cmp_clr) ? 0 : 1; break; case 7: - compare = ((dest_dat) > dest_cmp_clr) ? 0 : 1; + compare = (dest_dat > dest_cmp_clr) ? 0 : 1; + break; + + default: break; } @@ -1596,7 +1645,7 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 mix_dat <<= 1; mix_dat |= 1; - if ((((dev->accel.cx) >= clip_l) && ((dev->accel.cx) <= clip_r) && ((dev->accel.cy) >= clip_t) && ((dev->accel.cy) <= clip_b))) { + if (((dev->accel.cx) >= clip_l) && ((dev->accel.cx) <= clip_r) && ((dev->accel.cy) >= clip_t) && ((dev->accel.cy) <= clip_b)) { mach->accel.clip_overrun = 0; switch (mix ? frgd_sel : bkgd_sel) { case 0: @@ -1621,6 +1670,9 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 } else src_dat = 0; break; + + default: + break; } if ((svga->bpp == 15) || (svga->bpp == 16)) { @@ -1633,22 +1685,25 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 compare = 1; break; case 2: - compare = ((dest_dat) >= dest_cmp_clr) ? 0 : 1; + compare = (dest_dat >= dest_cmp_clr) ? 0 : 1; break; case 3: - compare = ((dest_dat) < dest_cmp_clr) ? 0 : 1; + compare = (dest_dat < dest_cmp_clr) ? 0 : 1; break; case 4: - compare = ((dest_dat) != dest_cmp_clr) ? 0 : 1; + compare = (dest_dat != dest_cmp_clr) ? 0 : 1; break; case 5: - compare = ((dest_dat) == dest_cmp_clr) ? 0 : 1; + compare = (dest_dat == dest_cmp_clr) ? 0 : 1; break; case 6: - compare = ((dest_dat) <= dest_cmp_clr) ? 0 : 1; + compare = (dest_dat <= dest_cmp_clr) ? 0 : 1; break; case 7: - compare = ((dest_dat) > dest_cmp_clr) ? 0 : 1; + compare = (dest_dat > dest_cmp_clr) ? 0 : 1; + break; + + default: break; } @@ -1707,9 +1762,12 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 } } break; + + default: + break; } - if ((((dev->accel.cx) >= clip_l) && ((dev->accel.cx) <= clip_r) && ((dev->accel.cy) >= clip_t) && ((dev->accel.cy) <= clip_b))) { + if (((dev->accel.cx) >= clip_l) && ((dev->accel.cx) <= clip_r) && ((dev->accel.cy) >= clip_t) && ((dev->accel.cy) <= clip_b)) { mach->accel.clip_overrun = 0; switch (mix ? frgd_sel : bkgd_sel) { case 0: @@ -1734,6 +1792,9 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 } else src_dat = 0; break; + + default: + break; } if ((svga->bpp == 15) || (svga->bpp == 16)) { @@ -1747,22 +1808,25 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 compare = 1; break; case 2: - compare = ((dest_dat) >= dest_cmp_clr) ? 0 : 1; + compare = (dest_dat >= dest_cmp_clr) ? 0 : 1; break; case 3: - compare = ((dest_dat) < dest_cmp_clr) ? 0 : 1; + compare = (dest_dat < dest_cmp_clr) ? 0 : 1; break; case 4: - compare = ((dest_dat) != dest_cmp_clr) ? 0 : 1; + compare = (dest_dat != dest_cmp_clr) ? 0 : 1; break; case 5: - compare = ((dest_dat) == dest_cmp_clr) ? 0 : 1; + compare = (dest_dat == dest_cmp_clr) ? 0 : 1; break; case 6: - compare = ((dest_dat) <= dest_cmp_clr) ? 0 : 1; + compare = (dest_dat <= dest_cmp_clr) ? 0 : 1; break; case 7: - compare = ((dest_dat) > dest_cmp_clr) ? 0 : 1; + compare = (dest_dat > dest_cmp_clr) ? 0 : 1; + break; + + default: break; } @@ -2004,10 +2068,13 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 READ(dev->accel.src + (dev->accel.cx), mix, dev->local); mix = (mix & rd_mask) == rd_mask; break; + + default: + break; } - if ((dev->accel.dx) >= (clip_l) && (dev->accel.dx) <= (clip_r) && - (dev->accel.dy) >= (clip_t) && (dev->accel.dy) <= (clip_b)) { + if ((dev->accel.dx) >= clip_l && (dev->accel.dx) <= clip_r && + (dev->accel.dy) >= clip_t && (dev->accel.dy) <= clip_b) { switch (mix ? frgd_sel : bkgd_sel) { case 0: src_dat = dev->accel.bkgd_color; @@ -2040,6 +2107,9 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 } else src_dat = 0; break; + + default: + break; } READ(dev->accel.dest + (dev->accel.dx), dest_dat, dev->local); @@ -2049,22 +2119,25 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 compare = 1; break; case 2: - compare = ((dest_dat) >= dest_cmp_clr) ? 0 : 1; + compare = (dest_dat >= dest_cmp_clr) ? 0 : 1; break; case 3: - compare = ((dest_dat) < dest_cmp_clr) ? 0 : 1; + compare = (dest_dat < dest_cmp_clr) ? 0 : 1; break; case 4: - compare = ((dest_dat) != dest_cmp_clr) ? 0 : 1; + compare = (dest_dat != dest_cmp_clr) ? 0 : 1; break; case 5: - compare = ((dest_dat) == dest_cmp_clr) ? 0 : 1; + compare = (dest_dat == dest_cmp_clr) ? 0 : 1; break; case 6: - compare = ((dest_dat) <= dest_cmp_clr) ? 0 : 1; + compare = (dest_dat <= dest_cmp_clr) ? 0 : 1; break; case 7: - compare = ((dest_dat) > dest_cmp_clr) ? 0 : 1; + compare = (dest_dat > dest_cmp_clr) ? 0 : 1; + break; + + default: break; } @@ -2134,13 +2207,18 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3 } } break; + + default: + break; } } static void -mach_accel_out_pixtrans(mach_t *mach, ibm8514_t *dev, uint16_t port, uint16_t val, uint16_t len) +mach_accel_out_pixtrans(mach_t *mach, ibm8514_t *dev, UNUSED(uint16_t port), uint16_t val, uint16_t len) { - int frgd_sel, bkgd_sel, mono_src; + int frgd_sel; + int bkgd_sel; + int mono_src; frgd_sel = (mach->accel.dp_config >> 13) & 7; bkgd_sel = (mach->accel.dp_config >> 7) & 3; @@ -2152,7 +2230,7 @@ mach_accel_out_pixtrans(mach_t *mach, ibm8514_t *dev, uint16_t port, uint16_t va switch (mach->accel.dp_config & 0x200) { case 0x000: /*8-bit size*/ - if ((mono_src == 2)) { + if (mono_src == 2) { if ((frgd_sel != 2) && (bkgd_sel != 2)) { if ((mach->accel.dp_config & 0x1000) && dev->local) val = (val >> 8) | (val << 8); @@ -2163,7 +2241,7 @@ mach_accel_out_pixtrans(mach_t *mach, ibm8514_t *dev, uint16_t port, uint16_t va mach_accel_start(mach->accel.cmd_type, 1, 1, -1, val | (val << 16), mach, dev, len); break; case 0x200: /*16-bit size*/ - if ((mono_src == 2)) { + if (mono_src == 2) { if ((frgd_sel != 2) && (bkgd_sel != 2)) { if (mach->accel.dp_config & 0x1000) val = (val >> 8) | (val << 8); @@ -2175,13 +2253,16 @@ mach_accel_out_pixtrans(mach_t *mach, ibm8514_t *dev, uint16_t port, uint16_t va mach_accel_start(mach->accel.cmd_type, 1, 2, -1, val | (val << 16), mach, dev, len); } break; + + default: + break; } } static void -mach_out(uint16_t addr, uint8_t val, void *p) +mach_out(uint16_t addr, uint8_t val, void *priv) { - mach_t *mach = (mach_t *) p; + mach_t *mach = (mach_t *) priv; svga_t *svga = &mach->svga; ibm8514_t *dev = &svga->dev8514; uint8_t old; @@ -2225,15 +2306,15 @@ mach_out(uint16_t addr, uint8_t val, void *p) mach->bank_r = (((mach->regs[0xb2] & 1) << 3) | ((mach->regs[0xb2] & 0xe0) >> 5)); mach->bank_w = ((mach->regs[0xb2] & 0x1e) >> 1); if (dev->local) { - mach->bank_r |= (((mach->regs[0xae] & 0x0c) << 2)); - mach->bank_w |= (((mach->regs[0xae] & 3) << 4)); + mach->bank_r |= ((mach->regs[0xae] & 0x0c) << 2); + mach->bank_w |= ((mach->regs[0xae] & 3) << 4); } if (ibm8514_on) mach_log("Separate B2Bank = %02x, AEbank = %02x.\n", mach->regs[0xb2], mach->regs[0xae]); } else { /* Single bank mode */ mach->bank_w = ((mach->regs[0xb2] & 0x1e) >> 1); if (dev->local) { - mach->bank_w |= (((mach->regs[0xae] & 3) << 4)); + mach->bank_w |= ((mach->regs[0xae] & 3) << 4); } mach->bank_r = mach->bank_w; if (ibm8514_on) @@ -2272,6 +2353,9 @@ mach_out(uint16_t addr, uint8_t val, void *p) if ((old ^ val) & 2) svga_recalctimings(svga); break; + + default: + break; } break; @@ -2336,14 +2420,17 @@ mach_out(uint16_t addr, uint8_t val, void *p) } } break; + + default: + break; } svga_out(addr, val, svga); } static uint8_t -mach_in(uint16_t addr, void *p) +mach_in(uint16_t addr, void *priv) { - mach_t *mach = (mach_t *) p; + mach_t *mach = (mach_t *) priv; svga_t *svga = &mach->svga; ibm8514_t *dev = &svga->dev8514; uint8_t temp; @@ -2436,59 +2523,60 @@ mach_in(uint16_t addr, void *p) static void mach_recalctimings(svga_t *svga) { - mach_t *mach = (mach_t *) svga->p; + mach_t *mach = (mach_t *) svga->priv; ibm8514_t *dev = &svga->dev8514; if (vga_on && !ibm8514_on) { switch (((mach->regs[0xbe] & 0x10) >> 1) | ((mach->regs[0xb9] & 2) << 1) | ((svga->miscout & 0x0c) >> 2)) { case 0x00: - svga->clock = (cpuclock * (double) (1ull << 32)) / 42954000.0; + svga->clock = (cpuclock * (double) (1ULL << 32)) / 42954000.0; break; case 0x01: - svga->clock = (cpuclock * (double) (1ull << 32)) / 48771000.0; + svga->clock = (cpuclock * (double) (1ULL << 32)) / 48771000.0; break; case 0x02: mach_log("clock 2\n"); break; case 0x03: - svga->clock = (cpuclock * (double) (1ull << 32)) / 36000000.0; + svga->clock = (cpuclock * (double) (1ULL << 32)) / 36000000.0; break; case 0x04: - svga->clock = (cpuclock * (double) (1ull << 32)) / 50350000.0; + svga->clock = (cpuclock * (double) (1ULL << 32)) / 50350000.0; break; case 0x05: - svga->clock = (cpuclock * (double) (1ull << 32)) / 56640000.0; + svga->clock = (cpuclock * (double) (1ULL << 32)) / 56640000.0; break; case 0x06: mach_log("clock 2\n"); break; case 0x07: - svga->clock = (cpuclock * (double) (1ull << 32)) / 44900000.0; + svga->clock = (cpuclock * (double) (1ULL << 32)) / 44900000.0; break; case 0x08: - svga->clock = (cpuclock * (double) (1ull << 32)) / 30240000.0; + svga->clock = (cpuclock * (double) (1ULL << 32)) / 30240000.0; break; case 0x09: - svga->clock = (cpuclock * (double) (1ull << 32)) / 32000000.0; + svga->clock = (cpuclock * (double) (1ULL << 32)) / 32000000.0; break; case 0x0A: - svga->clock = (cpuclock * (double) (1ull << 32)) / 37500000.0; + svga->clock = (cpuclock * (double) (1ULL << 32)) / 37500000.0; break; case 0x0B: - svga->clock = (cpuclock * (double) (1ull << 32)) / 39000000.0; + svga->clock = (cpuclock * (double) (1ULL << 32)) / 39000000.0; break; case 0x0C: - svga->clock = (cpuclock * (double) (1ull << 32)) / 50350000.0; + svga->clock = (cpuclock * (double) (1ULL << 32)) / 50350000.0; break; case 0x0D: - svga->clock = (cpuclock * (double) (1ull << 32)) / 56644000.0; + svga->clock = (cpuclock * (double) (1ULL << 32)) / 56644000.0; break; case 0x0E: - svga->clock = (cpuclock * (double) (1ull << 32)) / 75000000.0; + svga->clock = (cpuclock * (double) (1ULL << 32)) / 75000000.0; break; case 0x0F: - svga->clock = (cpuclock * (double) (1ull << 32)) / 65000000.0; + svga->clock = (cpuclock * (double) (1ULL << 32)) / 65000000.0; break; + default: break; } @@ -2520,6 +2608,9 @@ mach_recalctimings(svga_t *svga) case 0xc0: svga->clock *= 4; break; + + default: + break; } } @@ -2567,8 +2658,13 @@ mach_recalctimings(svga_t *svga) } break; + default: + break; } break; + + default: + break; } } } @@ -2617,7 +2713,7 @@ mach_recalctimings(svga_t *svga) dev->pitch = dev->ext_pitch; svga->rowoffset = dev->ext_crt_pitch; - svga->clock = (cpuclock * (double) (1ull << 32)) / 44900000.0; + svga->clock = (cpuclock * (double) (1ULL << 32)) / 44900000.0; } else { if (dev->ibm_mode) { if ((svga->hdisp == 1024) && !dev->internal_pitch) { @@ -2638,11 +2734,11 @@ mach_recalctimings(svga_t *svga) dev->pitch = dev->ext_pitch; svga->rowoffset = dev->ext_crt_pitch; - svga->clock = (cpuclock * (double) (1ull << 32)) / 25175000.0; + svga->clock = (cpuclock * (double) (1ULL << 32)) / 25175000.0; } switch (svga->bpp) { - case 8: default: + case 8: svga->render = svga_render_8bpp_highres; break; case 15: @@ -2664,7 +2760,10 @@ mach_recalctimings(svga_t *svga) static void mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, uint32_t val, int len) { - int frgd_sel, bkgd_sel, mono_src; + int frgd_sel; + int bkgd_sel; + int mono_src; + switch (port) { case 0x82e8: case 0xc2e8: @@ -2739,6 +2838,7 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u case 0x92e8: if (len != 1) dev->test = val; + [[fallthrough]]; case 0xd2e8: mach_log("92E8 = %04x\n", val); if (len == 1) @@ -2929,6 +3029,9 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u } else mach_accel_start(mach->accel.cmd_type, 1, 2, -1, mach->accel.pix_trans[0] | (mach->accel.pix_trans[1] << 8), mach, dev, len); break; + + default: + break; } } } @@ -3011,6 +3114,9 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u } else mach_accel_start(mach->accel.cmd_type, 1, 2, -1, mach->accel.pix_trans[0] | (mach->accel.pix_trans[1] << 8), mach, dev, len); break; + + default: + break; } } } @@ -3456,6 +3562,9 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u mach->accel.line_idx++; } break; + + default: + break; } } @@ -3968,6 +4077,9 @@ mach_accel_out(uint16_t port, uint32_t val, mach_t *mach, int len) svga->bpp = 24; dev->ext_crt_pitch *= 3; break; + + default: + break; } if (mach->accel.ext_ge_config & 0x800) { svga_recalctimings(svga); @@ -3998,6 +4110,9 @@ mach_accel_out(uint16_t port, uint32_t val, mach_t *mach, int len) svga->bpp = 24; dev->ext_crt_pitch *= 3; break; + + default: + break; } if (mach->accel.ext_ge_config & 0x800) { svga_recalctimings(svga); @@ -4010,6 +4125,9 @@ mach_accel_out(uint16_t port, uint32_t val, mach_t *mach, int len) case 0x7eee: mach->accel.eeprom_control = val; break; + + default: + break; } } } @@ -4017,14 +4135,16 @@ mach_accel_out(uint16_t port, uint32_t val, mach_t *mach, int len) static uint32_t mach_accel_in(uint16_t port, mach_t *mach, int len) { - svga_t *svga = &mach->svga; + svga_t *svga = &mach->svga; ibm8514_t *dev = &svga->dev8514; - uint16_t *vram_w = (uint16_t *) svga->vram; + uint16_t *vram_w = (uint16_t *) svga->vram; uint16_t temp = 0; int cmd; - int vpos = dev->displine + svga->y_add; - int vblankend = svga->vblankstart + svga->crtc[0x16]; - int frgd_sel, bkgd_sel, mono_src; + int vpos = dev->displine + svga->y_add; + int vblankend = svga->vblankstart + svga->crtc[0x16]; + int frgd_sel; + int bkgd_sel; + int mono_src; switch (port) { case 0x2e8: @@ -4281,6 +4401,9 @@ mach_accel_in(uint16_t port, mach_t *mach, int len) } else mach_accel_start(mach->accel.cmd_type, 1, 2, -1, mach->accel.pix_trans[0] | (mach->accel.pix_trans[1] << 8), mach, dev, len); break; + + default: + break; } } } @@ -4319,6 +4442,9 @@ mach_accel_in(uint16_t port, mach_t *mach, int len) case 0x0a: temp = dev->accel.multifunc[0x0a]; break; + + default: + break; } } break; @@ -4662,6 +4788,9 @@ mach_accel_in(uint16_t port, mach_t *mach, int len) temp = 0x22; } break; + + default: + break; } if (port != 0x9ae8 && port != 0x9ae9 && port != 0x62ee && port != 0x9aee) { mach_log("Port accel in = %04x, temp = %04x, len = %d, mode = %d.\n", port, temp, len, dev->ibm_mode); @@ -4670,40 +4799,40 @@ mach_accel_in(uint16_t port, mach_t *mach, int len) } static void -mach_accel_outb(uint16_t port, uint8_t val, void *p) +mach_accel_outb(uint16_t port, uint8_t val, void *priv) { - mach_t *mach = (mach_t *) p; + mach_t *mach = (mach_t *) priv; mach_accel_out(port, val, mach, 1); } static void -mach_accel_outw(uint16_t port, uint16_t val, void *p) +mach_accel_outw(uint16_t port, uint16_t val, void *priv) { - mach_t *mach = (mach_t *) p; + mach_t *mach = (mach_t *) priv; mach_accel_out(port, val, mach, 2); } static uint8_t -mach_accel_inb(uint16_t port, void *p) +mach_accel_inb(uint16_t port, void *priv) { - mach_t *mach = (mach_t *) p; + mach_t *mach = (mach_t *) priv; return mach_accel_in(port, mach, 1); } static uint16_t -mach_accel_inw(uint16_t port, void *p) +mach_accel_inw(uint16_t port, void *priv) { - mach_t *mach = (mach_t *) p; + mach_t *mach = (mach_t *) priv; return mach_accel_in(port, mach, 2); } static void -mach32_ap_writeb(uint32_t addr, uint8_t val, void *p) +mach32_ap_writeb(uint32_t addr, uint8_t val, void *priv) { - mach_t *mach = (mach_t *) p; + mach_t *mach = (mach_t *) priv; uint8_t port_dword = addr & 0xfc; - if (((addr >= ((mach->ap_size << 20) - 0x200)) && (addr < (mach->ap_size << 20)))) { + if ((addr >= ((mach->ap_size << 20) - 0x200)) && (addr < (mach->ap_size << 20))) { if (addr & 0x100) { mach_log("Port WORDB Write=%04x.\n", 0x02ee + (port_dword << 8)); mach_accel_outb(0x02ee + (addr & 1) + (port_dword << 8), val, mach); @@ -4718,12 +4847,12 @@ mach32_ap_writeb(uint32_t addr, uint8_t val, void *p) } static void -mach32_ap_writew(uint32_t addr, uint16_t val, void *p) +mach32_ap_writew(uint32_t addr, uint16_t val, void *priv) { - mach_t *mach = (mach_t *) p; + mach_t *mach = (mach_t *) priv; uint8_t port_dword = addr & 0xfc; - if (((addr >= ((mach->ap_size << 20) - 0x200)) && (addr < (mach->ap_size << 20)))) { + if ((addr >= ((mach->ap_size << 20) - 0x200)) && (addr < (mach->ap_size << 20))) { if (addr & 0x100) { mach_log("Port WORDW Write=%04x.\n", 0x02ee + (port_dword << 8)); mach_accel_outw(0x02ee + (port_dword << 8), val, mach); @@ -4738,12 +4867,12 @@ mach32_ap_writew(uint32_t addr, uint16_t val, void *p) } static void -mach32_ap_writel(uint32_t addr, uint32_t val, void *p) +mach32_ap_writel(uint32_t addr, uint32_t val, void *priv) { - mach_t *mach = (mach_t *) p; + mach_t *mach = (mach_t *) priv; uint8_t port_dword = addr & 0xfc; - if (((addr >= ((mach->ap_size << 20) - 0x200)) && (addr < (mach->ap_size << 20)))) { + if ((addr >= ((mach->ap_size << 20) - 0x200)) && (addr < (mach->ap_size << 20))) { if (addr & 0x100) { mach_log("Port WORDL Write=%04x.\n", 0x02ee + (port_dword << 8)); mach_accel_outw(0x02ee + (port_dword << 8), val & 0xffff, mach); @@ -4760,13 +4889,13 @@ mach32_ap_writel(uint32_t addr, uint32_t val, void *p) } static uint8_t -mach32_ap_readb(uint32_t addr, void *p) +mach32_ap_readb(uint32_t addr, void *priv) { - mach_t *mach = (mach_t *) p; + mach_t *mach = (mach_t *) priv; uint8_t temp; uint8_t port_dword = addr & 0xfc; - if (((addr >= ((mach->ap_size << 20) - 0x200)) && (addr < (mach->ap_size << 20)))) { + if ((addr >= ((mach->ap_size << 20) - 0x200)) && (addr < (mach->ap_size << 20))) { if (addr & 0x100) { temp = mach_accel_inb(0x02ee + (addr & 1) + (port_dword << 8), mach); } else { @@ -4779,13 +4908,13 @@ mach32_ap_readb(uint32_t addr, void *p) } static uint16_t -mach32_ap_readw(uint32_t addr, void *p) +mach32_ap_readw(uint32_t addr, void *priv) { - mach_t *mach = (mach_t *) p; + mach_t *mach = (mach_t *) priv; uint16_t temp; uint8_t port_dword = addr & 0xfc; - if (((addr >= ((mach->ap_size << 20) - 0x200)) && (addr < (mach->ap_size << 20)))) { + if ((addr >= ((mach->ap_size << 20) - 0x200)) && (addr < (mach->ap_size << 20))) { if (addr & 0x100) { temp = mach_accel_inw(0x02ee + (port_dword << 8), mach); } else { @@ -4798,13 +4927,13 @@ mach32_ap_readw(uint32_t addr, void *p) } static uint32_t -mach32_ap_readl(uint32_t addr, void *p) +mach32_ap_readl(uint32_t addr, void *priv) { - mach_t *mach = (mach_t *) p; + mach_t *mach = (mach_t *) priv; uint32_t temp; uint8_t port_dword = addr & 0xfc; - if (((addr >= ((mach->ap_size << 20) - 0x200)) && (addr < (mach->ap_size << 20)))) { + if ((addr >= ((mach->ap_size << 20) - 0x200)) && (addr < (mach->ap_size << 20))) { if (addr & 0x100) { temp = mach_accel_inw(0x02ee + (port_dword << 8), mach); temp |= (mach_accel_inw(0x02ee + (port_dword << 8) + 4, mach) << 8); @@ -4823,7 +4952,7 @@ mach32_updatemapping(mach_t *mach) { svga_t *svga = &mach->svga; - if ((mach->pci_bus && (!(mach->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM)))) { + if (mach->pci_bus && (!(mach->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM))) { mem_mapping_disable(&svga->mapping); mem_mapping_disable(&mach->mmio_linear_mapping); return; @@ -4851,6 +4980,9 @@ mach32_updatemapping(mach_t *mach) mem_mapping_set_addr(&svga->mapping, 0xb8000, 0x08000); svga->banked_mask = 0x7fff; break; + + default: + break; } } @@ -4882,11 +5014,12 @@ mach32_updatemapping(mach_t *mach) static void mach32_hwcursor_draw(svga_t *svga, int displine) { - mach_t *mach = (mach_t *) svga->p; + mach_t *mach = (mach_t *) svga->priv; uint16_t dat; int comb; int offset = svga->hwcursor_latch.x - svga->hwcursor_latch.xoff; - uint32_t color0, color1; + uint32_t color0; + uint32_t color1; if (svga->bpp == 8) { color0 = svga->pallook[mach->cursor_col_0]; @@ -4916,13 +5049,16 @@ mach32_hwcursor_draw(svga_t *svga, int displine) if (offset >= svga->hwcursor_latch.x) { switch (comb) { case 0: - ((uint32_t *) svga->monitor->target_buffer->line[displine])[offset + svga->x_add] = color0; + (svga->monitor->target_buffer->line[displine])[offset + svga->x_add] = color0; break; case 1: - ((uint32_t *) svga->monitor->target_buffer->line[displine])[offset + svga->x_add] = color1; + (svga->monitor->target_buffer->line[displine])[offset + svga->x_add] = color1; break; case 3: - ((uint32_t *) svga->monitor->target_buffer->line[displine])[offset + svga->x_add] ^= 0xffffff; + (svga->monitor->target_buffer->line[displine])[offset + svga->x_add] ^= 0xffffff; + break; + + default: break; } } @@ -5175,10 +5311,10 @@ mach_io_set(mach_t *mach) } static uint8_t -mach32_pci_read(int func, int addr, void *p) +mach32_pci_read(UNUSED(int func), int addr, void *priv) { - mach_t *mach = (mach_t *) p; - uint8_t ret = 0x00; + mach_t *mach = (mach_t *) priv; + uint8_t ret = 0x00; switch (addr) { case 0x00: @@ -5242,15 +5378,18 @@ mach32_pci_read(int func, int addr, void *p) case 0x3d: ret = PCI_INTA; break; + + default: + break; } return ret; } static void -mach32_pci_write(int func, int addr, uint8_t val, void *p) +mach32_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv) { - mach_t *mach = (mach_t *) p; + mach_t *mach = (mach_t *) priv; switch (addr) { case PCI_REG_COMMAND: @@ -5288,6 +5427,9 @@ mach32_pci_write(int func, int addr, uint8_t val, void *p) case 0x3c: mach->int_line = val; break; + + default: + break; } } @@ -5355,6 +5497,9 @@ mach8_init(const device_t *info) case 4096: mach->misc |= 0x0c; break; + + default: + break; } svga->hwcursor.cur_ysize = 64; mach->config1 = 0x20; @@ -5414,7 +5559,7 @@ mach8_init(const device_t *info) ati_eeprom_load_mach8(&mach->eeprom, "mach8.nvr"); } - return (mach); + return mach; } static int @@ -5442,9 +5587,9 @@ mach32_pci_available(void) } static void -mach_close(void *p) +mach_close(void *priv) { - mach_t *mach = (mach_t *) p; + mach_t *mach = (mach_t *) priv; svga_t *svga = &mach->svga; ibm8514_t *dev = &svga->dev8514; @@ -5458,18 +5603,18 @@ mach_close(void *p) } static void -mach_speed_changed(void *p) +mach_speed_changed(void *priv) { - mach_t *mach = (mach_t *) p; + mach_t *mach = (mach_t *) priv; svga_t *svga = &mach->svga; svga_recalctimings(svga); } static void -mach_force_redraw(void *p) +mach_force_redraw(void *priv) { - mach_t *mach = (mach_t *) p; + mach_t *mach = (mach_t *) priv; svga_t *svga = &mach->svga; svga->fullchange = changeframecount; diff --git a/src/video/vid_att20c49x_ramdac.c b/src/video/vid_att20c49x_ramdac.c index 1874afce9..3f995c56a 100644 --- a/src/video/vid_att20c49x_ramdac.c +++ b/src/video/vid_att20c49x_ramdac.c @@ -63,6 +63,9 @@ att49x_ramdac_control(uint8_t val, void *p, svga_t *svga) case 7: svga->bpp = 24; break; + + default: + break; } if (ramdac->type == ATT_490 || ramdac->type == ATT_491) svga_set_ramdac_type(svga, (val & 2) ? RAMDAC_8BIT : RAMDAC_6BIT); @@ -100,6 +103,9 @@ att49x_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *p, svga_t *svga) att49x_ramdac_control(val, ramdac, svga); ramdac->state = 0; break; + + default: + break; } } @@ -143,6 +149,9 @@ att49x_ramdac_in(uint16_t addr, int rs2, void *p, svga_t *svga) temp = ramdac->ctrl; ramdac->state = 0; break; + + default: + break; } return temp; diff --git a/src/video/vid_att2xc498_ramdac.c b/src/video/vid_att2xc498_ramdac.c index 2dab4b903..9919b7111 100644 --- a/src/video/vid_att2xc498_ramdac.c +++ b/src/video/vid_att2xc498_ramdac.c @@ -102,6 +102,9 @@ att498_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *p, svga_t *svga) case 0x06: att498_ramdac_control(val, ramdac, svga); break; + + default: + break; } } @@ -147,6 +150,9 @@ att498_ramdac_in(uint16_t addr, int rs2, void *p, svga_t *svga) temp = ramdac->ctrl; ramdac->state = 0; break; + + default: + break; } return temp; diff --git a/src/video/vid_av9194.c b/src/video/vid_av9194.c index f8ebc89de..e7cf75dee 100644 --- a/src/video/vid_av9194.c +++ b/src/video/vid_av9194.c @@ -27,9 +27,10 @@ #include <86box/timer.h> #include <86box/video.h> #include <86box/vid_svga.h> +#include <86box/plat_unused.h> float -av9194_getclock(int clock, void *p) +av9194_getclock(int clock, UNUSED(void *priv)) { float ret = 0.0; @@ -79,13 +80,16 @@ av9194_getclock(int clock, void *p) case 0xf: ret = 94500000.0; break; + + default: + break; } return ret; } static void * -av9194_init(const device_t *info) +av9194_init(UNUSED(const device_t *info)) { /* Return something non-NULL. */ return (void *) &av9194_device; diff --git a/src/video/vid_bt48x_ramdac.c b/src/video/vid_bt48x_ramdac.c index 9ef75b09e..bb276ece6 100644 --- a/src/video/vid_bt48x_ramdac.c +++ b/src/video/vid_bt48x_ramdac.c @@ -77,6 +77,9 @@ bt48x_set_bpp(bt48x_ramdac_t *ramdac, svga_t *svga) case 0x60: svga->bpp = 4; break; + + default: + break; } svga_recalctimings(svga); } @@ -104,7 +107,7 @@ bt48x_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, void *p, svga_t * svga->dac_status = addr & 0x03; svga->dac_addr = val; if (ramdac->type >= BT485) - svga->dac_addr |= ((int) (ramdac->cmd_r3 & 0x03) << 8); + svga->dac_addr |= ((ramdac->cmd_r3 & 0x03) << 8); if (svga->dac_status) svga->dac_addr = (svga->dac_addr + 1) & da_mask; break; @@ -143,6 +146,9 @@ bt48x_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, void *p, svga_t * svga->dac_addr = (svga->dac_addr + 1) & 0xff; svga->dac_pos = 0; break; + + default: + break; } break; case 0x06: /* Command Register 0 (RS value = 0110) */ @@ -183,6 +189,9 @@ bt48x_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, void *p, svga_t * break; } break; + + default: + break; } } break; @@ -215,6 +224,9 @@ bt48x_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, void *p, svga_t * ramdac->hwc_y = (ramdac->hwc_y & 0x00ff) | ((val & 0x0f) << 8); svga->dac_hwcursor.y = ramdac->hwc_y - svga->dac_hwcursor.cur_ysize; break; + + default: + break; } return; @@ -271,6 +283,9 @@ bt48x_ramdac_in(uint16_t addr, int rs2, int rs3, void *p, svga_t *svga) else temp = ramdac->extpal[index].b & 0x3f; break; + + default: + break; } break; case 0x06: /* Command Register 0 (RS value = 0110) */ @@ -285,8 +300,8 @@ bt48x_ramdac_in(uint16_t addr, int rs2, int rs3, void *p, svga_t *svga) case 0x0a: if ((ramdac->type >= BT485) && (ramdac->cmd_r0 & 0x80)) { switch (svga->dac_addr & ((ramdac->type >= BT485A) ? 0xff : 0x3f)) { - case 0x00: default: + case 0x00: temp = ramdac->status | (svga->dac_status ? 0x04 : 0x00); break; case 0x01: @@ -307,7 +322,6 @@ bt48x_ramdac_in(uint16_t addr, int rs2, int rs3, void *p, svga_t *svga) temp = 0xff; break; } - break; } } else temp = ramdac->status | (svga->dac_status ? 0x04 : 0x00); @@ -337,6 +351,9 @@ bt48x_ramdac_in(uint16_t addr, int rs2, int rs3, void *p, svga_t *svga) case 0x0f: /* Cursor Y High Register (RS value = 1111) */ temp = (ramdac->hwc_y >> 8) & 0xff; break; + + default: + break; } return temp; @@ -419,6 +436,9 @@ bt48x_hwcursor_draw(svga_t *svga, int displine) case 3: p[x_pos] = clr3; break; + + default: + break; } break; case 2: /* PM/Windows */ @@ -432,6 +452,9 @@ bt48x_hwcursor_draw(svga_t *svga, int displine) case 3: p[x_pos] ^= 0xffffff; break; + + default: + break; } break; case 3: /* X-Windows */ @@ -442,8 +465,14 @@ bt48x_hwcursor_draw(svga_t *svga, int displine) case 3: p[x_pos] = clr2; break; + + default: + break; } break; + + default: + break; } } offset++; @@ -484,6 +513,9 @@ bt48x_ramdac_init(const device_t *info) case BT485A: ramdac->status = 0x20; break; + + default: + break; } return ramdac; diff --git a/src/video/vid_cga.c b/src/video/vid_cga.c index 1fd8babb5..69d9609c6 100644 --- a/src/video/vid_cga.c +++ b/src/video/vid_cga.c @@ -33,6 +33,7 @@ #include <86box/video.h> #include <86box/vid_cga.h> #include <86box/vid_cga_comp.h> +#include <86box/plat_unused.h> #define CGA_RGB 0 #define CGA_COMPOSITE 1 @@ -50,9 +51,9 @@ static video_timings_t timing_cga = { .type = VIDEO_ISA, .write_b = 8, .write_w void cga_recalctimings(cga_t *cga); void -cga_out(uint16_t addr, uint8_t val, void *p) +cga_out(uint16_t addr, uint8_t val, void *priv) { - cga_t *cga = (cga_t *) p; + cga_t *cga = (cga_t *) priv; uint8_t old; if ((addr >= 0x3d0) && (addr <= 0x3d7)) @@ -89,13 +90,16 @@ cga_out(uint16_t addr, uint8_t val, void *p) if (old ^ val) cga_recalctimings(cga); return; + + default: + break; } } uint8_t -cga_in(uint16_t addr, void *p) +cga_in(uint16_t addr, void *priv) { - cga_t *cga = (cga_t *) p; + cga_t *cga = (cga_t *) priv; uint8_t ret = 0xff; @@ -112,29 +116,32 @@ cga_in(uint16_t addr, void *p) case 0x3DA: ret = cga->cgastat; break; + + default: + break; } return ret; } void -cga_pravetz_out(uint16_t addr, uint8_t val, void *p) +cga_pravetz_out(UNUSED(uint16_t addr), uint8_t val, void *priv) { - cga_t *cga = (cga_t *) p; + cga_t *cga = (cga_t *) priv; cga->fontbase = (((unsigned int) val) << 8); } uint8_t -cga_pravetz_in(uint16_t addr, void *p) +cga_pravetz_in(UNUSED(uint16_t addr), void *priv) { - cga_t *cga = (cga_t *) p; + cga_t *cga = (cga_t *) priv; return (cga->fontbase >> 8); } void -cga_waitstates(void *p) +cga_waitstates(UNUSED(void *priv)) { int ws_array[16] = { 3, 4, 5, 6, 7, 8, 4, 5, 6, 7, 8, 4, 5, 6, 7, 8 }; int ws; @@ -144,9 +151,9 @@ cga_waitstates(void *p) } void -cga_write(uint32_t addr, uint8_t val, void *p) +cga_write(uint32_t addr, uint8_t val, void *priv) { - cga_t *cga = (cga_t *) p; + cga_t *cga = (cga_t *) priv; cga->vram[addr & 0x3fff] = val; if (cga->snow_enabled) { @@ -158,9 +165,9 @@ cga_write(uint32_t addr, uint8_t val, void *p) } uint8_t -cga_read(uint32_t addr, void *p) +cga_read(uint32_t addr, void *priv) { - cga_t *cga = (cga_t *) p; + cga_t *cga = (cga_t *) priv; cga_waitstates(cga); if (cga->snow_enabled) { @@ -193,9 +200,9 @@ cga_recalctimings(cga_t *cga) } void -cga_poll(void *p) +cga_poll(void *priv) { - cga_t *cga = (cga_t *) p; + cga_t *cga = (cga_t *) priv; uint16_t ca = (cga->crtc[15] | (cga->crtc[14] << 8)) & 0x3fff; int drawcursor; int x; @@ -508,7 +515,7 @@ cga_init(cga_t *cga) } void * -cga_standalone_init(const device_t *info) +cga_standalone_init(UNUSED(const device_t *info)) { int display_type; cga_t *cga = malloc(sizeof(cga_t)); @@ -554,18 +561,18 @@ cga_pravetz_init(const device_t *info) } void -cga_close(void *p) +cga_close(void *priv) { - cga_t *cga = (cga_t *) p; + cga_t *cga = (cga_t *) priv; free(cga->vram); free(cga); } void -cga_speed_changed(void *p) +cga_speed_changed(void *priv) { - cga_t *cga = (cga_t *) p; + cga_t *cga = (cga_t *) priv; cga_recalctimings(cga); } diff --git a/src/video/vid_cga_comp.c b/src/video/vid_cga_comp.c index 6ffc5cbcd..52e7675ee 100644 --- a/src/video/vid_cga_comp.c +++ b/src/video/vid_cga_comp.c @@ -244,7 +244,7 @@ Composite_Process(uint8_t cgamode, Bit8u border, Bit32u blocks /*, bool doublewi if ((cgamode & 4) != 0) { /* Decode */ i = temp + 5; - srgb = (Bit32u *) TempLine; + srgb = TempLine; for (x2 = 0; x2 < blocks * 4; ++x2) { int c = (i[0] + i[0]) << 3; int d = (i[-1] + i[1]) << 3; @@ -268,7 +268,7 @@ Composite_Process(uint8_t cgamode, Bit8u border, Bit32u blocks /*, bool doublewi i = temp + 5; i[-1] = (i[-1] << 3) - ap[-1]; i[0] = (i[0] << 3) - ap[0]; - srgb = (Bit32u *) TempLine; + srgb = TempLine; for (x2 = 0; x2 < blocks; ++x2) { int y; int a; diff --git a/src/video/vid_cl54xx.c b/src/video/vid_cl54xx.c index 637598345..225810974 100644 --- a/src/video/vid_cl54xx.c +++ b/src/video/vid_cl54xx.c @@ -236,19 +236,19 @@ static video_timings_t timing_gd54xx_vlb = { .type = VIDEO_BUS, .write_b = 4, .w static video_timings_t timing_gd54xx_pci = { .type = VIDEO_PCI, .write_b = 4, .write_w = 4, .write_l = 8, .read_b = 10, .read_w = 10, .read_l = 20 }; static void -gd543x_mmio_write(uint32_t addr, uint8_t val, void *p); +gd543x_mmio_write(uint32_t addr, uint8_t val, void *priv); static void -gd543x_mmio_writeb(uint32_t addr, uint8_t val, void *p); +gd543x_mmio_writeb(uint32_t addr, uint8_t val, void *priv); static void -gd543x_mmio_writew(uint32_t addr, uint16_t val, void *p); +gd543x_mmio_writew(uint32_t addr, uint16_t val, void *priv); static void -gd543x_mmio_writel(uint32_t addr, uint32_t val, void *p); +gd543x_mmio_writel(uint32_t addr, uint32_t val, void *priv); static uint8_t -gd543x_mmio_read(uint32_t addr, void *p); +gd543x_mmio_read(uint32_t addr, void *priv); static uint16_t -gd543x_mmio_readw(uint32_t addr, void *p); +gd543x_mmio_readw(uint32_t addr, void *priv); static uint32_t -gd543x_mmio_readl(uint32_t addr, void *p); +gd543x_mmio_readl(uint32_t addr, void *priv); static void gd54xx_recalc_banking(gd54xx_t *gd54xx); @@ -492,7 +492,7 @@ gd54xx_update_irqs(gd54xx_t *gd54xx) static void gd54xx_vblank_start(svga_t *svga) { - gd54xx_t *gd54xx = (gd54xx_t *) svga->p; + gd54xx_t *gd54xx = (gd54xx_t *) svga->priv; if (gd54xx->vblank_irq >= 0) { gd54xx->vblank_irq = 1; gd54xx_update_irqs(gd54xx); @@ -512,7 +512,7 @@ gd54xx_is_5422(svga_t *svga) static void gd54xx_overlay_draw(svga_t *svga, int displine) { - gd54xx_t *gd54xx = (gd54xx_t *) svga->p; + gd54xx_t *gd54xx = (gd54xx_t *) svga->priv; int shift = (svga->crtc[0x27] >= CIRRUS_ID_CLGD5446) ? 2 : 0; int h_acc = svga->overlay_latch.h_acc; int r[8]; @@ -612,9 +612,9 @@ gd54xx_is_5434(svga_t *svga) } static void -gd54xx_out(uint16_t addr, uint8_t val, void *p) +gd54xx_out(uint16_t addr, uint8_t val, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; uint8_t old; uint8_t o; @@ -1157,9 +1157,9 @@ gd54xx_out(uint16_t addr, uint8_t val, void *p) } static uint8_t -gd54xx_in(uint16_t addr, void *p) +gd54xx_in(uint16_t addr, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; uint8_t index; @@ -1646,7 +1646,7 @@ gd543x_recalc_mapping(gd54xx_t *gd54xx) static void gd54xx_recalctimings(svga_t *svga) { - gd54xx_t *gd54xx = (gd54xx_t *) svga->p; + gd54xx_t *gd54xx = (gd54xx_t *) svga->priv; uint8_t clocksel; uint8_t rdmask; uint8_t linedbl = svga->dispend * 9 / 10 >= svga->hdisp; @@ -1833,7 +1833,7 @@ gd54xx_recalctimings(svga_t *svga) static void gd54xx_hwcursor_draw(svga_t *svga, int displine) { - gd54xx_t *gd54xx = (gd54xx_t *) svga->p; + gd54xx_t *gd54xx = (gd54xx_t *) svga->priv; int comb; int b0; int b1; @@ -1988,9 +1988,9 @@ gd54xx_mem_sys_src_write(gd54xx_t *gd54xx, uint8_t val) } static void -gd54xx_write(uint32_t addr, uint8_t val, void *p) +gd54xx_write(uint32_t addr, uint8_t val, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) { @@ -2009,9 +2009,9 @@ gd54xx_write(uint32_t addr, uint8_t val, void *p) } static void -gd54xx_writew(uint32_t addr, uint16_t val, void *p) +gd54xx_writew(uint32_t addr, uint16_t val, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) { @@ -2036,9 +2036,9 @@ gd54xx_writew(uint32_t addr, uint16_t val, void *p) } static void -gd54xx_writel(uint32_t addr, uint32_t val, void *p) +gd54xx_writel(uint32_t addr, uint32_t val, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) { @@ -2147,9 +2147,9 @@ gd54xx_aperture2_enabled(gd54xx_t *gd54xx) } static uint8_t -gd54xx_readb_linear(uint32_t addr, void *p) +gd54xx_readb_linear(uint32_t addr, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; uint8_t ap = gd54xx_get_aperture(addr); @@ -2187,9 +2187,9 @@ gd54xx_readb_linear(uint32_t addr, void *p) } static uint16_t -gd54xx_readw_linear(uint32_t addr, void *p) +gd54xx_readw_linear(uint32_t addr, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; uint8_t ap = gd54xx_get_aperture(addr); @@ -2209,8 +2209,8 @@ gd54xx_readw_linear(uint32_t addr, void *p) /* Do mem sys dest reads here if the blitter is neither paused, nor is there a second aperture. */ if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && !gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) { - temp = gd54xx_readb_linear(addr, p); - temp |= gd54xx_readb_linear(addr + 1, p) << 8; + temp = gd54xx_readb_linear(addr, priv); + temp |= gd54xx_readb_linear(addr + 1, priv) << 8; return temp; } @@ -2235,9 +2235,9 @@ gd54xx_readw_linear(uint32_t addr, void *p) } static uint32_t -gd54xx_readl_linear(uint32_t addr, void *p) +gd54xx_readl_linear(uint32_t addr, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; uint8_t ap = gd54xx_get_aperture(addr); @@ -2257,10 +2257,10 @@ gd54xx_readl_linear(uint32_t addr, void *p) /* Do mem sys dest reads here if the blitter is neither paused, nor is there a second aperture. */ if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && !gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) { - temp = gd54xx_readb_linear(addr, p); - temp |= gd54xx_readb_linear(addr + 1, p) << 8; - temp |= gd54xx_readb_linear(addr + 2, p) << 16; - temp |= gd54xx_readb_linear(addr + 3, p) << 24; + temp = gd54xx_readb_linear(addr, priv); + temp |= gd54xx_readb_linear(addr + 1, priv) << 8; + temp |= gd54xx_readb_linear(addr + 2, priv) << 16; + temp |= gd54xx_readb_linear(addr + 3, priv) << 24; return temp; } @@ -2294,9 +2294,9 @@ gd54xx_readl_linear(uint32_t addr, void *p) } static uint8_t -gd5436_aperture2_readb(uint32_t addr, void *p) +gd5436_aperture2_readb(uint32_t addr, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) return gd54xx_mem_sys_dest_read(gd54xx); @@ -2305,14 +2305,14 @@ gd5436_aperture2_readb(uint32_t addr, void *p) } static uint16_t -gd5436_aperture2_readw(uint32_t addr, void *p) +gd5436_aperture2_readw(uint32_t addr, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; uint16_t ret = 0xffff; if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) { - ret = gd5436_aperture2_readb(addr, p); - ret |= gd5436_aperture2_readb(addr + 1, p) << 8; + ret = gd5436_aperture2_readb(addr, priv); + ret |= gd5436_aperture2_readb(addr + 1, priv) << 8; return ret; } @@ -2320,16 +2320,16 @@ gd5436_aperture2_readw(uint32_t addr, void *p) } static uint32_t -gd5436_aperture2_readl(uint32_t addr, void *p) +gd5436_aperture2_readl(uint32_t addr, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; uint32_t ret = 0xffffffff; if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) { - ret = gd5436_aperture2_readb(addr, p); - ret |= gd5436_aperture2_readb(addr + 1, p) << 8; - ret |= gd5436_aperture2_readb(addr + 2, p) << 16; - ret |= gd5436_aperture2_readb(addr + 3, p) << 24; + ret = gd5436_aperture2_readb(addr, priv); + ret |= gd5436_aperture2_readb(addr + 1, priv) << 8; + ret |= gd5436_aperture2_readb(addr + 2, priv) << 16; + ret |= gd5436_aperture2_readb(addr + 3, priv) << 24; return ret; } @@ -2337,9 +2337,9 @@ gd5436_aperture2_readl(uint32_t addr, void *p) } static void -gd5436_aperture2_writeb(uint32_t addr, uint8_t val, void *p) +gd5436_aperture2_writeb(uint32_t addr, uint8_t val, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest && gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) @@ -2347,9 +2347,9 @@ gd5436_aperture2_writeb(uint32_t addr, uint8_t val, void *p) } static void -gd5436_aperture2_writew(uint32_t addr, uint16_t val, void *p) +gd5436_aperture2_writew(uint32_t addr, uint16_t val, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest && gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) { @@ -2359,9 +2359,9 @@ gd5436_aperture2_writew(uint32_t addr, uint16_t val, void *p) } static void -gd5436_aperture2_writel(uint32_t addr, uint32_t val, void *p) +gd5436_aperture2_writel(uint32_t addr, uint32_t val, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest && gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) { @@ -2373,9 +2373,9 @@ gd5436_aperture2_writel(uint32_t addr, uint32_t val, void *p) } static void -gd54xx_writeb_linear(uint32_t addr, uint8_t val, void *p) +gd54xx_writeb_linear(uint32_t addr, uint8_t val, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; uint8_t ap = gd54xx_get_aperture(addr); @@ -2401,8 +2401,8 @@ gd54xx_writeb_linear(uint32_t addr, uint8_t val, void *p) } switch (ap) { - case 0: default: + case 0: break; case 1: /* 0 -> 1, 1 -> 0, 2 -> 3, 3 -> 2 */ @@ -2420,9 +2420,9 @@ gd54xx_writeb_linear(uint32_t addr, uint8_t val, void *p) } static void -gd54xx_writew_linear(uint32_t addr, uint16_t val, void *p) +gd54xx_writew_linear(uint32_t addr, uint16_t val, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; uint8_t ap = gd54xx_get_aperture(addr); @@ -2484,9 +2484,9 @@ gd54xx_writew_linear(uint32_t addr, uint16_t val, void *p) } static void -gd54xx_writel_linear(uint32_t addr, uint32_t val, void *p) +gd54xx_writel_linear(uint32_t addr, uint32_t val, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; uint8_t ap = gd54xx_get_aperture(addr); @@ -2561,9 +2561,9 @@ gd54xx_writel_linear(uint32_t addr, uint32_t val, void *p) } static uint8_t -gd54xx_read(uint32_t addr, void *p) +gd54xx_read(uint32_t addr, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; if ((svga->seqregs[0x07] & 0x01) == 0) @@ -2577,9 +2577,9 @@ gd54xx_read(uint32_t addr, void *p) } static uint16_t -gd54xx_readw(uint32_t addr, void *p) +gd54xx_readw(uint32_t addr, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; uint16_t ret; @@ -2587,8 +2587,8 @@ gd54xx_readw(uint32_t addr, void *p) return svga_readw(addr, svga); if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) { - ret = gd54xx_read(addr, p); - ret |= gd54xx_read(addr + 1, p) << 8; + ret = gd54xx_read(addr, priv); + ret |= gd54xx_read(addr + 1, priv) << 8; return ret; } @@ -2597,9 +2597,9 @@ gd54xx_readw(uint32_t addr, void *p) } static uint32_t -gd54xx_readl(uint32_t addr, void *p) +gd54xx_readl(uint32_t addr, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; uint32_t ret; @@ -2607,10 +2607,10 @@ gd54xx_readl(uint32_t addr, void *p) return svga_readl(addr, svga); if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) { - ret = gd54xx_read(addr, p); - ret |= gd54xx_read(addr + 1, p) << 8; - ret |= gd54xx_read(addr + 2, p) << 16; - ret |= gd54xx_read(addr + 3, p) << 24; + ret = gd54xx_read(addr, priv); + ret |= gd54xx_read(addr + 1, priv) << 8; + ret |= gd54xx_read(addr + 2, priv) << 16; + ret |= gd54xx_read(addr + 3, priv) << 24; return ret; } @@ -2628,9 +2628,9 @@ gd543x_do_mmio(svga_t *svga, uint32_t addr) } static void -gd543x_mmio_write(uint32_t addr, uint8_t val, void *p) +gd543x_mmio_write(uint32_t addr, uint8_t val, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; uint8_t old; @@ -2794,9 +2794,9 @@ gd543x_mmio_write(uint32_t addr, uint8_t val, void *p) } static void -gd543x_mmio_writeb(uint32_t addr, uint8_t val, void *p) +gd543x_mmio_writeb(uint32_t addr, uint8_t val, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; if (!gd543x_do_mmio(svga, addr) && !gd54xx->blt.ms_is_dest && gd54xx->countminusone && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) { @@ -2804,13 +2804,13 @@ gd543x_mmio_writeb(uint32_t addr, uint8_t val, void *p) return; } - gd543x_mmio_write(addr, val, p); + gd543x_mmio_write(addr, val, priv); } static void -gd543x_mmio_writew(uint32_t addr, uint16_t val, void *p) +gd543x_mmio_writew(uint32_t addr, uint16_t val, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; if (gd543x_do_mmio(svga, addr)) { @@ -2828,9 +2828,9 @@ gd543x_mmio_writew(uint32_t addr, uint16_t val, void *p) } static void -gd543x_mmio_writel(uint32_t addr, uint32_t val, void *p) +gd543x_mmio_writel(uint32_t addr, uint32_t val, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; if (gd543x_do_mmio(svga, addr)) { @@ -2854,9 +2854,9 @@ gd543x_mmio_writel(uint32_t addr, uint32_t val, void *p) } static uint8_t -gd543x_mmio_read(uint32_t addr, void *p) +gd543x_mmio_read(uint32_t addr, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; uint8_t ret = 0xff; @@ -2993,9 +2993,9 @@ gd543x_mmio_read(uint32_t addr, void *p) } static uint16_t -gd543x_mmio_readw(uint32_t addr, void *p) +gd543x_mmio_readw(uint32_t addr, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; uint16_t ret = 0xffff; @@ -3004,8 +3004,8 @@ gd543x_mmio_readw(uint32_t addr, void *p) else if (gd54xx->mmio_vram_overlap) ret = gd54xx_read(addr, gd54xx) | (gd54xx_read(addr + 1, gd54xx) << 8); else if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) { - ret = gd543x_mmio_read(addr, p); - ret |= gd543x_mmio_read(addr + 1, p) << 8; + ret = gd543x_mmio_read(addr, priv); + ret |= gd543x_mmio_read(addr + 1, priv) << 8; return ret; } @@ -3013,9 +3013,9 @@ gd543x_mmio_readw(uint32_t addr, void *p) } static uint32_t -gd543x_mmio_readl(uint32_t addr, void *p) +gd543x_mmio_readl(uint32_t addr, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; uint32_t ret = 0xffffffff; @@ -3024,10 +3024,10 @@ gd543x_mmio_readl(uint32_t addr, void *p) else if (gd54xx->mmio_vram_overlap) ret = gd54xx_read(addr, gd54xx) | (gd54xx_read(addr + 1, gd54xx) << 8) | (gd54xx_read(addr + 2, gd54xx) << 16) | (gd54xx_read(addr + 3, gd54xx) << 24); else if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) { - ret = gd543x_mmio_read(addr, p); - ret |= gd543x_mmio_read(addr + 1, p) << 8; - ret |= gd543x_mmio_read(addr + 2, p) << 16; - ret |= gd543x_mmio_read(addr + 3, p) << 24; + ret = gd543x_mmio_read(addr, priv); + ret |= gd543x_mmio_read(addr + 1, priv) << 8; + ret |= gd543x_mmio_read(addr + 2, priv) << 16; + ret |= gd543x_mmio_read(addr + 3, priv) << 24; return ret; } @@ -3035,86 +3035,86 @@ gd543x_mmio_readl(uint32_t addr, void *p) } static void -gd5480_vgablt_write(uint32_t addr, uint8_t val, void *p) +gd5480_vgablt_write(uint32_t addr, uint8_t val, void *priv) { addr &= 0x00000fff; if ((addr >= 0x00000100) && (addr < 0x00000200)) - gd543x_mmio_writeb((addr & 0x000000ff) | 0x000b8000, val, p); + gd543x_mmio_writeb((addr & 0x000000ff) | 0x000b8000, val, priv); else if (addr < 0x00000100) - gd54xx_out(0x03c0 + addr, val, p); + gd54xx_out(0x03c0 + addr, val, priv); } static void -gd5480_vgablt_writew(uint32_t addr, uint16_t val, void *p) +gd5480_vgablt_writew(uint32_t addr, uint16_t val, void *priv) { addr &= 0x00000fff; if ((addr >= 0x00000100) && (addr < 0x00000200)) - gd543x_mmio_writew((addr & 0x000000ff) | 0x000b8000, val, p); + gd543x_mmio_writew((addr & 0x000000ff) | 0x000b8000, val, priv); else if (addr < 0x00000100) { - gd5480_vgablt_write(addr, val & 0xff, p); - gd5480_vgablt_write(addr + 1, val >> 8, p); + gd5480_vgablt_write(addr, val & 0xff, priv); + gd5480_vgablt_write(addr + 1, val >> 8, priv); } } static void -gd5480_vgablt_writel(uint32_t addr, uint32_t val, void *p) +gd5480_vgablt_writel(uint32_t addr, uint32_t val, void *priv) { addr &= 0x00000fff; if ((addr >= 0x00000100) && (addr < 0x00000200)) - gd543x_mmio_writel((addr & 0x000000ff) | 0x000b8000, val, p); + gd543x_mmio_writel((addr & 0x000000ff) | 0x000b8000, val, priv); else if (addr < 0x00000100) { - gd5480_vgablt_writew(addr, val & 0xffff, p); - gd5480_vgablt_writew(addr + 2, val >> 16, p); + gd5480_vgablt_writew(addr, val & 0xffff, priv); + gd5480_vgablt_writew(addr + 2, val >> 16, priv); } } static uint8_t -gd5480_vgablt_read(uint32_t addr, void *p) +gd5480_vgablt_read(uint32_t addr, void *priv) { uint8_t ret = 0xff; addr &= 0x00000fff; if ((addr >= 0x00000100) && (addr < 0x00000200)) - ret = gd543x_mmio_read((addr & 0x000000ff) | 0x000b8000, p); + ret = gd543x_mmio_read((addr & 0x000000ff) | 0x000b8000, priv); else if (addr < 0x00000100) - ret = gd54xx_in(0x03c0 + addr, p); + ret = gd54xx_in(0x03c0 + addr, priv); return ret; } static uint16_t -gd5480_vgablt_readw(uint32_t addr, void *p) +gd5480_vgablt_readw(uint32_t addr, void *priv) { uint16_t ret = 0xffff; addr &= 0x00000fff; if ((addr >= 0x00000100) && (addr < 0x00000200)) - ret = gd543x_mmio_readw((addr & 0x000000ff) | 0x000b8000, p); + ret = gd543x_mmio_readw((addr & 0x000000ff) | 0x000b8000, priv); else if (addr < 0x00000100) { - ret = gd5480_vgablt_read(addr, p); - ret |= (gd5480_vgablt_read(addr + 1, p) << 8); + ret = gd5480_vgablt_read(addr, priv); + ret |= (gd5480_vgablt_read(addr + 1, priv) << 8); } return ret; } static uint32_t -gd5480_vgablt_readl(uint32_t addr, void *p) +gd5480_vgablt_readl(uint32_t addr, void *priv) { uint32_t ret = 0xffffffff; addr &= 0x00000fff; if ((addr >= 0x00000100) && (addr < 0x00000200)) - ret = gd543x_mmio_readl((addr & 0x000000ff) | 0x000b8000, p); + ret = gd543x_mmio_readl((addr & 0x000000ff) | 0x000b8000, priv); else if (addr < 0x00000100) { - ret = gd5480_vgablt_readw(addr, p); - ret |= (gd5480_vgablt_readw(addr + 2, p) << 16); + ret = gd5480_vgablt_readw(addr, priv); + ret |= (gd5480_vgablt_readw(addr + 2, priv) << 16); } return ret; @@ -3557,9 +3557,9 @@ gd54xx_start_blit(uint32_t cpu_dat, uint32_t count, gd54xx_t *gd54xx, svga_t *sv } static uint8_t -cl_pci_read(int func, int addr, void *p) +cl_pci_read(int func, int addr, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; uint8_t ret = 0x00; @@ -3656,9 +3656,9 @@ cl_pci_read(int func, int addr, void *p) } static void -cl_pci_write(int func, int addr, uint8_t val, void *p) +cl_pci_write(int func, int addr, uint8_t val, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_t *svga = &gd54xx->svga; uint32_t byte; @@ -3724,17 +3724,17 @@ cl_pci_write(int func, int addr, uint8_t val, void *p) } static uint8_t -gd5428_mca_read(int port, void *p) +gd5428_mca_read(int port, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; return gd54xx->pos_regs[port & 7]; } static void -gd5428_mca_write(int port, uint8_t val, void *p) +gd5428_mca_write(int port, uint8_t val, void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; if (port < 0x102) return; @@ -3744,7 +3744,7 @@ gd5428_mca_write(int port, uint8_t val, void *p) } static uint8_t -gd5428_mca_feedb(void *p) +gd5428_mca_feedb(void *priv) { return 1; } @@ -4264,9 +4264,9 @@ gd5480_available(void) } void -gd54xx_close(void *p) +gd54xx_close(void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_close(&gd54xx->svga); @@ -4279,17 +4279,17 @@ gd54xx_close(void *p) } void -gd54xx_speed_changed(void *p) +gd54xx_speed_changed(void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; svga_recalctimings(&gd54xx->svga); } void -gd54xx_force_redraw(void *p) +gd54xx_force_redraw(void *priv) { - gd54xx_t *gd54xx = (gd54xx_t *) p; + gd54xx_t *gd54xx = (gd54xx_t *) priv; gd54xx->svga.fullchange = gd54xx->svga.monitor->mon_changeframecount; } diff --git a/src/video/vid_colorplus.c b/src/video/vid_colorplus.c index 81c1746f3..be176d9d0 100644 --- a/src/video/vid_colorplus.c +++ b/src/video/vid_colorplus.c @@ -34,6 +34,7 @@ #include <86box/vid_cga.h> #include <86box/vid_colorplus.h> #include <86box/vid_cga_comp.h> +#include <86box/plat_unused.h> /* Bits in the colorplus control register: */ #define COLORPLUS_PLANE_SWAP 0x40 /* Swap planes at 0000h and 4000h */ @@ -55,9 +56,9 @@ video_timings_t timing_colorplus = { .type = VIDEO_ISA, .write_b = 8, .write_w = void cga_recalctimings(cga_t *cga); void -colorplus_out(uint16_t addr, uint8_t val, void *p) +colorplus_out(uint16_t addr, uint8_t val, void *priv) { - colorplus_t *colorplus = (colorplus_t *) p; + colorplus_t *colorplus = (colorplus_t *) priv; if (addr == 0x3DD) { colorplus->control = val & 0x70; @@ -67,17 +68,17 @@ colorplus_out(uint16_t addr, uint8_t val, void *p) } uint8_t -colorplus_in(uint16_t addr, void *p) +colorplus_in(uint16_t addr, void *priv) { - colorplus_t *colorplus = (colorplus_t *) p; + colorplus_t *colorplus = (colorplus_t *) priv; return cga_in(addr, &colorplus->cga); } void -colorplus_write(uint32_t addr, uint8_t val, void *p) +colorplus_write(uint32_t addr, uint8_t val, void *priv) { - colorplus_t *colorplus = (colorplus_t *) p; + colorplus_t *colorplus = (colorplus_t *) priv; if ((colorplus->control & COLORPLUS_PLANE_SWAP) && (colorplus->control & COLORPLUS_EITHER_MODE) && (colorplus->cga.cgamode & CGA_GRAPHICS_MODE)) { addr ^= 0x4000; @@ -94,9 +95,9 @@ colorplus_write(uint32_t addr, uint8_t val, void *p) } uint8_t -colorplus_read(uint32_t addr, void *p) +colorplus_read(uint32_t addr, void *priv) { - colorplus_t *colorplus = (colorplus_t *) p; + colorplus_t *colorplus = (colorplus_t *) priv; if ((colorplus->control & COLORPLUS_PLANE_SWAP) && (colorplus->control & COLORPLUS_EITHER_MODE) && (colorplus->cga.cgamode & CGA_GRAPHICS_MODE)) { addr ^= 0x4000; @@ -119,9 +120,9 @@ colorplus_recalctimings(colorplus_t *colorplus) } void -colorplus_poll(void *p) +colorplus_poll(void *priv) { - colorplus_t *colorplus = (colorplus_t *) p; + colorplus_t *colorplus = (colorplus_t *) priv; int x; int c; int oldvc; @@ -333,7 +334,7 @@ colorplus_init(colorplus_t *colorplus) } void * -colorplus_standalone_init(const device_t *info) +colorplus_standalone_init(UNUSED(const device_t *info)) { int display_type; @@ -362,18 +363,18 @@ colorplus_standalone_init(const device_t *info) } void -colorplus_close(void *p) +colorplus_close(void *priv) { - colorplus_t *colorplus = (colorplus_t *) p; + colorplus_t *colorplus = (colorplus_t *) priv; free(colorplus->cga.vram); free(colorplus); } void -colorplus_speed_changed(void *p) +colorplus_speed_changed(void *priv) { - colorplus_t *colorplus = (colorplus_t *) p; + colorplus_t *colorplus = (colorplus_t *) priv; cga_recalctimings(&colorplus->cga); } diff --git a/src/video/vid_compaq_cga.c b/src/video/vid_compaq_cga.c index c913e6e7c..4753ec223 100644 --- a/src/video/vid_compaq_cga.c +++ b/src/video/vid_compaq_cga.c @@ -83,9 +83,9 @@ compaq_cga_recalctimings(compaq_cga_t *self) } void -compaq_cga_poll(void *p) +compaq_cga_poll(void *priv) { - compaq_cga_t *self = (compaq_cga_t *) p; + compaq_cga_t *self = (compaq_cga_t *) priv; uint16_t ca = (self->cga.crtc[15] | (self->cga.crtc[14] << 8)) & 0x3fff; int drawcursor; int x; @@ -452,18 +452,18 @@ compaq_cga_init(const device_t *info) } void -compaq_cga_close(void *p) +compaq_cga_close(void *priv) { - compaq_cga_t *self = (compaq_cga_t *) p; + compaq_cga_t *self = (compaq_cga_t *) priv; free(self->cga.vram); free(self); } void -compaq_cga_speed_changed(void *p) +compaq_cga_speed_changed(void *priv) { - compaq_cga_t *self = (compaq_cga_t *) p; + compaq_cga_t *self = (compaq_cga_t *) priv; if (self->cga.crtc[9] == 13) /* Character height */ compaq_cga_recalctimings(self); diff --git a/src/video/vid_ega.c b/src/video/vid_ega.c index 8cfd51db6..2f13a5c0e 100644 --- a/src/video/vid_ega.c +++ b/src/video/vid_ega.c @@ -67,12 +67,12 @@ int egaswitchread; int egaswitches = 9; int update_overscan = 0; -uint8_t ega_in(uint16_t addr, void *p); +uint8_t ega_in(uint16_t addr, void *priv); void -ega_out(uint16_t addr, uint8_t val, void *p) +ega_out(uint16_t addr, uint8_t val, void *priv) { - ega_t *ega = (ega_t *) p; + ega_t *ega = (ega_t *) priv; uint8_t o; uint8_t old; @@ -248,9 +248,9 @@ ega_out(uint16_t addr, uint8_t val, void *p) } uint8_t -ega_in(uint16_t addr, void *p) +ega_in(uint16_t addr, void *priv) { - ega_t *ega = (ega_t *) p; + ega_t *ega = (ega_t *) priv; uint8_t ret = 0xff; if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(ega->miscout & 1)) @@ -481,9 +481,9 @@ ega_recalctimings(ega_t *ega) } void -ega_poll(void *p) +ega_poll(void *priv) { - ega_t *ega = (ega_t *) p; + ega_t *ega = (ega_t *) priv; int x; int old_ma; int wx = 640; @@ -831,9 +831,9 @@ ega_remap_cpu_addr(uint32_t inaddr, ega_t *ega) } void -ega_write(uint32_t addr, uint8_t val, void *p) +ega_write(uint32_t addr, uint8_t val, void *priv) { - ega_t *ega = (ega_t *) p; + ega_t *ega = (ega_t *) priv; uint8_t vala; uint8_t valb; uint8_t valc; @@ -1006,9 +1006,9 @@ ega_write(uint32_t addr, uint8_t val, void *p) } uint8_t -ega_read(uint32_t addr, void *p) +ega_read(uint32_t addr, void *priv) { - ega_t *ega = (ega_t *) p; + ega_t *ega = (ega_t *) priv; uint8_t temp; uint8_t temp2; uint8_t temp3; @@ -1292,9 +1292,9 @@ et2000_standalone_available(void) } static void -ega_close(void *p) +ega_close(void *priv) { - ega_t *ega = (ega_t *) p; + ega_t *ega = (ega_t *) priv; if (ega->eeprom) free(ega->eeprom); @@ -1303,9 +1303,9 @@ ega_close(void *p) } static void -ega_speed_changed(void *p) +ega_speed_changed(void *priv) { - ega_t *ega = (ega_t *) p; + ega_t *ega = (ega_t *) priv; ega_recalctimings(ega); } diff --git a/src/video/vid_ega_render.c b/src/video/vid_ega_render.c index 4b6710891..01ee7ac04 100644 --- a/src/video/vid_ega_render.c +++ b/src/video/vid_ega_render.c @@ -47,29 +47,30 @@ ega_display_line(ega_t *ega) void ega_render_blank(ega_t *ega) { - int xx; - if ((ega->displine + ega->y_add) < 0) return; for (int x = 0; x < (ega->hdisp + ega->scrollcache); x++) { switch (ega->seqregs[1] & 9) { case 0: - for (xx = 0; xx < 9; xx++) + for (uint8_t xx = 0; xx < 9; xx++) buffer32->line[ega->displine + ega->y_add][ega->x_add + (x * 9) + xx] = 0; break; case 1: - for (xx = 0; xx < 8; xx++) + for (uint8_t xx = 0; xx < 8; xx++) buffer32->line[ega->displine + ega->y_add][ega->x_add + (x * 8) + xx] = 0; break; case 8: - for (xx = 0; xx < 18; xx++) + for (uint8_t xx = 0; xx < 18; xx++) buffer32->line[ega->displine + ega->y_add][ega->x_add + (x * 18) + xx] = 0; break; case 9: - for (xx = 0; xx < 16; xx++) + for (uint8_t xx = 0; xx < 16; xx++) buffer32->line[ega->displine + ega->y_add][ega->x_add + (x * 16) + xx] = 0; break; + + default: + break; } } } diff --git a/src/video/vid_et3000.c b/src/video/vid_et3000.c index 28e3a0f02..e1290cd99 100644 --- a/src/video/vid_et3000.c +++ b/src/video/vid_et3000.c @@ -66,6 +66,9 @@ et3000_in(uint16_t addr, void *priv) case 0x3d5: return svga->crtc[svga->crtcreg]; + + default: + break; } return svga_in(addr, svga); @@ -124,6 +127,9 @@ et3000_out(uint16_t addr, uint8_t val, void *priv) svga->write_bank = (val & 7) << 16; svga->read_bank = ((val >> 3) & 7) << 16; break; + + default: + break; } } return; @@ -147,6 +153,9 @@ et3000_out(uint16_t addr, uint8_t val, void *priv) } } break; + + default: + break; } svga_out(addr, val, svga); @@ -184,11 +193,16 @@ et3000_recalctimings(svga_t *svga) case 0x60: svga->render = svga_render_8bpp_highres; break; + + default: + break; } } - /* pclog("HDISP = %i, HTOTAL = %i, ROWOFFSET = %i, INTERLACE = %i\n", - svga->hdisp, svga->htotal, svga->rowoffset, svga->interlace); */ +#if 0 + pclog("HDISP = %i, HTOTAL = %i, ROWOFFSET = %i, INTERLACE = %i\n", + svga->hdisp, svga->htotal, svga->rowoffset, svga->interlace); +#endif switch (((svga->miscout >> 2) & 3) | ((svga->crtc[0x24] << 1) & 4)) { case 0: @@ -227,6 +241,9 @@ et3000_init(const device_t *info) io_sethandler(0x03c0, 32, et3000_in, NULL, NULL, et3000_out, NULL, NULL, dev); break; + + default: + break; } rom_init(&dev->bios_rom, (char *) fn, diff --git a/src/video/vid_et4000.c b/src/video/vid_et4000.c index b4c505dae..dd8bb4ad9 100644 --- a/src/video/vid_et4000.c +++ b/src/video/vid_et4000.c @@ -52,6 +52,7 @@ #include <86box/video.h> #include <86box/vid_svga.h> #include <86box/vid_svga_render.h> +#include <86box/plat_unused.h> #define ET4000_TYPE_ISA 1 /* ISA ET4000AX */ #define ET4000_TYPE_MCA 2 /* MCA ET4000AX */ @@ -105,8 +106,8 @@ static const uint8_t crtc_mask[0x40] = { static video_timings_t timing_et4000_isa = { .type = VIDEO_ISA, .write_b = 3, .write_w = 3, .write_l = 6, .read_b = 5, .read_w = 5, .read_l = 10 }; static video_timings_t timing_et4000_mca = { .type = VIDEO_MCA, .write_b = 4, .write_w = 5, .write_l = 10, .read_b = 5, .read_w = 5, .read_l = 10 }; -static void et4000_kasan_out(uint16_t addr, uint8_t val, void *p); -static uint8_t et4000_kasan_in(uint16_t addr, void *p); +static void et4000_kasan_out(uint16_t addr, uint8_t val, void *priv); +static uint8_t et4000_kasan_in(uint16_t addr, void *priv); static uint8_t et4000_in(uint16_t addr, void *priv) @@ -146,6 +147,9 @@ et4000_in(uint16_t addr, void *priv) case 0x3d5: return svga->crtc[svga->crtcreg]; + + default: + break; } return svga_in(addr, svga); @@ -288,6 +292,9 @@ et4000_out(uint16_t addr, uint8_t val, void *priv) } } break; + + default: + break; } svga_out(addr, val, svga); @@ -425,6 +432,7 @@ et4000_kasan_out(uint16_t addr, uint8_t val, void *priv) case 5: et4000->kasan_cfg_regs[5] = val; et4000->svga.ksc5601_english_font_type = 0x100 | val; + [[fallthrough]]; case 6: case 7: et4000->svga.ksc5601_udc_area_msb[et4000->kasan_cfg_index - 0xF6] = val; @@ -474,9 +482,9 @@ et4000_kasan_out(uint16_t addr, uint8_t val, void *priv) } uint32_t -get_et4000_addr(uint32_t addr, void *p) +get_et4000_addr(uint32_t addr, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; uint32_t nbank; switch (svga->crtc[0x37] & 0x0B) { @@ -536,7 +544,7 @@ get_et4000_addr(uint32_t addr, void *p) static void et4000_recalctimings(svga_t *svga) { - et4000_t *dev = (et4000_t *) svga->p; + et4000_t *dev = (et4000_t *) svga->priv; svga->ma_latch |= (svga->crtc[0x33] & 3) << 16; if (svga->crtc[0x35] & 1) @@ -580,6 +588,9 @@ et4000_recalctimings(svga_t *svga) case 24: svga->hdisp /= 3; break; + + default: + break; } if (dev->type == ET4000_TYPE_KOREAN || dev->type == ET4000_TYPE_TRIGEM || dev->type == ET4000_TYPE_KASAN) { @@ -598,7 +609,7 @@ et4000_recalctimings(svga_t *svga) static void et4000_kasan_recalctimings(svga_t *svga) { - et4000_t *et4000 = (et4000_t *) svga->p; + et4000_t *et4000 = (et4000_t *) svga->priv; et4000_recalctimings(svga); @@ -633,7 +644,7 @@ et4000_mca_write(int port, uint8_t val, void *priv) } static uint8_t -et4000_mca_feedb(void *priv) +et4000_mca_feedb(UNUSED(void *priv)) { return 1; } diff --git a/src/video/vid_et4000w32.c b/src/video/vid_et4000w32.c index ee5a2117b..c2ce39778 100644 --- a/src/video/vid_et4000w32.c +++ b/src/video/vid_et4000w32.c @@ -130,14 +130,14 @@ static video_timings_t timing_et4000w32_isa = { .type = VIDEO_ISA, .write_b = 4, void et4000w32p_recalcmapping(et4000w32p_t *et4000); -static uint8_t et4000w32p_mmu_read(uint32_t addr, void *p); -static void et4000w32p_mmu_write(uint32_t addr, uint8_t val, void *p); +static uint8_t et4000w32p_mmu_read(uint32_t addr, void *priv); +static void et4000w32p_mmu_write(uint32_t addr, uint8_t val, void *priv); static void et4000w32_blit_start(et4000w32p_t *et4000); static void et4000w32p_blit_start(et4000w32p_t *et4000); static void et4000w32_blit(int count, int cpu_input, uint32_t src_dat, uint32_t mix_dat, et4000w32p_t *et4000); static void et4000w32p_blit(int count, uint32_t mix, uint32_t sdat, int cpu_input, et4000w32p_t *et4000); -uint8_t et4000w32p_in(uint16_t addr, void *p); +uint8_t et4000w32p_in(uint16_t addr, void *priv); #ifdef ENABLE_ET4000W32_LOG int et4000w32_do_log = ENABLE_ET4000W32_LOG; @@ -158,9 +158,9 @@ et4000w32_log(const char *fmt, ...) #endif void -et4000w32p_out(uint16_t addr, uint8_t val, void *p) +et4000w32p_out(uint16_t addr, uint8_t val, void *priv) { - et4000w32p_t *et4000 = (et4000w32p_t *) p; + et4000w32p_t *et4000 = (et4000w32p_t *) priv; svga_t *svga = &et4000->svga; uint8_t old; uint32_t add2addr = 0; @@ -321,9 +321,9 @@ et4000w32p_out(uint16_t addr, uint8_t val, void *p) } uint8_t -et4000w32p_in(uint16_t addr, void *p) +et4000w32p_in(uint16_t addr, void *priv) { - et4000w32p_t *et4000 = (et4000w32p_t *) p; + et4000w32p_t *et4000 = (et4000w32p_t *) priv; svga_t *svga = &et4000->svga; if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) @@ -343,7 +343,6 @@ et4000w32p_in(uint16_t addr, void *p) return sdac_ramdac_in(addr, 0, svga->ramdac, svga); else return stg_ramdac_in(addr, svga->ramdac, svga); - break; case 0x3cb: return et4000->banking2; @@ -417,7 +416,7 @@ et4000w32p_in(uint16_t addr, void *p) void et4000w32p_recalctimings(svga_t *svga) { - et4000w32p_t *et4000 = (et4000w32p_t *) svga->p; + et4000w32p_t *et4000 = (et4000w32p_t *) svga->priv; svga->ma_latch |= (svga->crtc[0x33] & 0x7) << 16; if (svga->crtc[0x35] & 0x01) @@ -899,9 +898,9 @@ et4000w32p_accel_write_mmu(et4000w32p_t *et4000, uint32_t addr, uint8_t val, uin } static void -et4000w32p_mmu_write(uint32_t addr, uint8_t val, void *p) +et4000w32p_mmu_write(uint32_t addr, uint8_t val, void *priv) { - et4000w32p_t *et4000 = (et4000w32p_t *) p; + et4000w32p_t *et4000 = (et4000w32p_t *) priv; svga_t *svga = &et4000->svga; switch (addr & 0x6000) { @@ -975,9 +974,9 @@ et4000w32p_mmu_write(uint32_t addr, uint8_t val, void *p) } static uint8_t -et4000w32p_mmu_read(uint32_t addr, void *p) +et4000w32p_mmu_read(uint32_t addr, void *priv) { - et4000w32p_t *et4000 = (et4000w32p_t *) p; + et4000w32p_t *et4000 = (et4000w32p_t *) priv; svga_t *svga = &et4000->svga; uint8_t temp; @@ -1075,7 +1074,6 @@ et4000w32p_mmu_read(uint32_t addr, void *p) return et4000->acl.internal.pixel_depth; else return et4000->acl.internal.vbus; - break; case 0x8f: return et4000->acl.internal.xy_dir; case 0x90: @@ -2453,7 +2451,7 @@ et4000w32p_blit(int count, uint32_t mix, uint32_t sdat, int cpu_input, et4000w32 void et4000w32p_hwcursor_draw(svga_t *svga, int displine) { - et4000w32p_t *et4000 = (et4000w32p_t *) svga->p; + et4000w32p_t *et4000 = (et4000w32p_t *) svga->priv; int offset; int xx; int xx2; @@ -2559,9 +2557,9 @@ et4000w32p_io_set(et4000w32p_t *et4000) } uint8_t -et4000w32p_pci_read(int func, int addr, void *p) +et4000w32p_pci_read(UNUSED(int func), int addr, void *priv) { - et4000w32p_t *et4000 = (et4000w32p_t *) p; + et4000w32p_t *et4000 = (et4000w32p_t *) priv; addr &= 0xff; @@ -2615,9 +2613,9 @@ et4000w32p_pci_read(int func, int addr, void *p) } void -et4000w32p_pci_write(int func, int addr, uint8_t val, void *p) +et4000w32p_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv) { - et4000w32p_t *et4000 = (et4000w32p_t *) p; + et4000w32p_t *et4000 = (et4000w32p_t *) priv; svga_t *svga = &et4000->svga; addr &= 0xff; @@ -2873,9 +2871,9 @@ et4000w32p_cardex_available(void) } void -et4000w32p_close(void *p) +et4000w32p_close(void *priv) { - et4000w32p_t *et4000 = (et4000w32p_t *) p; + et4000w32p_t *et4000 = (et4000w32p_t *) priv; svga_close(&et4000->svga); @@ -2883,17 +2881,17 @@ et4000w32p_close(void *p) } void -et4000w32p_speed_changed(void *p) +et4000w32p_speed_changed(void *priv) { - et4000w32p_t *et4000 = (et4000w32p_t *) p; + et4000w32p_t *et4000 = (et4000w32p_t *) priv; svga_recalctimings(&et4000->svga); } void -et4000w32p_force_redraw(void *p) +et4000w32p_force_redraw(void *priv) { - et4000w32p_t *et4000 = (et4000w32p_t *) p; + et4000w32p_t *et4000 = (et4000w32p_t *) priv; et4000->svga.fullchange = changeframecount; } diff --git a/src/video/vid_f82c425.c b/src/video/vid_f82c425.c index d2fd22dce..a2ffeddb5 100644 --- a/src/video/vid_f82c425.c +++ b/src/video/vid_f82c425.c @@ -63,6 +63,7 @@ #include "cpu.h" #include <86box/video.h> #include <86box/vid_cga.h> +#include <86box/plat_unused.h> #define F82C425_XSIZE 640 #define F82C425_YSIZE 200 @@ -226,9 +227,9 @@ f82c425_colormap(f82c425_t *f82c425) } static void -f82c425_out(uint16_t addr, uint8_t val, void *p) +f82c425_out(uint16_t addr, uint8_t val, void *priv) { - f82c425_t *f82c425 = (f82c425_t *) p; + f82c425_t *f82c425 = (f82c425_t *) priv; if (addr == 0x3d4) f82c425->crtcreg = val; @@ -271,9 +272,9 @@ f82c425_out(uint16_t addr, uint8_t val, void *p) } static uint8_t -f82c425_in(uint16_t addr, void *p) +f82c425_in(uint16_t addr, void *priv) { - f82c425_t *f82c425 = (f82c425_t *) p; + f82c425_t *f82c425 = (f82c425_t *) priv; if ((f82c425->function & 0x01) == 0) return 0xff; @@ -305,18 +306,18 @@ f82c425_in(uint16_t addr, void *p) } static void -f82c425_write(uint32_t addr, uint8_t val, void *p) +f82c425_write(uint32_t addr, uint8_t val, void *priv) { - f82c425_t *f82c425 = (f82c425_t *) p; + f82c425_t *f82c425 = (f82c425_t *) priv; f82c425->vram[addr & 0x3fff] = val; cycles -= 4; } static uint8_t -f82c425_read(uint32_t addr, void *p) +f82c425_read(uint32_t addr, void *priv) { - f82c425_t *f82c425 = (f82c425_t *) p; + f82c425_t *f82c425 = (f82c425_t *) priv; cycles -= 4; return f82c425->vram[addr & 0x3fff]; @@ -454,9 +455,9 @@ f82c425_cgaline4(f82c425_t *f82c425) } static void -f82c425_poll(void *p) +f82c425_poll(void *priv) { - f82c425_t *f82c425 = (f82c425_t *) p; + f82c425_t *f82c425 = (f82c425_t *) priv; if (f82c425->video_options != st_video_options || !!(f82c425->function & 1) != st_enabled) { f82c425->video_options = st_video_options; @@ -560,9 +561,10 @@ f82c425_poll(void *p) } static void * -f82c425_init(const device_t *info) +f82c425_init(UNUSED(const device_t *info)) { f82c425_t *f82c425 = malloc(sizeof(f82c425_t)); + memset(f82c425, 0, sizeof(f82c425_t)); cga_init(&f82c425->cga); video_inform(VIDEO_FLAG_TYPE_CGA, &timing_f82c425); @@ -595,18 +597,18 @@ f82c425_init(const device_t *info) } static void -f82c425_close(void *p) +f82c425_close(void *priv) { - f82c425_t *f82c425 = (f82c425_t *) p; + f82c425_t *f82c425 = (f82c425_t *) priv; free(f82c425->vram); free(f82c425); } static void -f82c425_speed_changed(void *p) +f82c425_speed_changed(void *priv) { - f82c425_t *f82c425 = (f82c425_t *) p; + f82c425_t *f82c425 = (f82c425_t *) priv; f82c425_recalctimings(f82c425); } diff --git a/src/video/vid_genius.c b/src/video/vid_genius.c index 09f2f6ada..763cfe540 100644 --- a/src/video/vid_genius.c +++ b/src/video/vid_genius.c @@ -138,13 +138,13 @@ static uint8_t genius_pal[4]; static uint8_t mdaattr[256][2][2]; void genius_recalctimings(genius_t *genius); -void genius_write(uint32_t addr, uint8_t val, void *p); -uint8_t genius_read(uint32_t addr, void *p); +void genius_write(uint32_t addr, uint8_t val, void *priv); +uint8_t genius_read(uint32_t addr, void *priv); void -genius_out(uint16_t addr, uint8_t val, void *p) +genius_out(uint16_t addr, uint8_t val, void *priv) { - genius_t *genius = (genius_t *) p; + genius_t *genius = (genius_t *) priv; switch (addr) { case 0x3b0: /* Command / control register */ @@ -208,9 +208,9 @@ genius_out(uint16_t addr, uint8_t val, void *p) } uint8_t -genius_in(uint16_t addr, void *p) +genius_in(uint16_t addr, void *priv) { - genius_t *genius = (genius_t *) p; + genius_t *genius = (genius_t *) priv; uint8_t ret = 0xff; switch (addr) { @@ -269,9 +269,9 @@ genius_waitstates(void) } void -genius_write(uint32_t addr, uint8_t val, void *p) +genius_write(uint32_t addr, uint8_t val, void *priv) { - genius_t *genius = (genius_t *) p; + genius_t *genius = (genius_t *) priv; genius_waitstates(); if (genius->genius_control & 1) { @@ -293,9 +293,9 @@ genius_write(uint32_t addr, uint8_t val, void *p) } uint8_t -genius_read(uint32_t addr, void *p) +genius_read(uint32_t addr, void *priv) { - genius_t *genius = (genius_t *) p; + genius_t *genius = (genius_t *) priv; uint8_t ret; genius_waitstates(); @@ -623,9 +623,9 @@ genius_hiresline(genius_t *genius) } void -genius_poll(void *p) +genius_poll(void *priv) { - genius_t *genius = (genius_t *) p; + genius_t *genius = (genius_t *) priv; uint8_t background; if (!genius->linepos) { @@ -784,9 +784,9 @@ void } void -genius_close(void *p) +genius_close(void *priv) { - genius_t *genius = (genius_t *) p; + genius_t *genius = (genius_t *) priv; free(genius->vram); free(genius); @@ -799,9 +799,9 @@ genius_available(void) } void -genius_speed_changed(void *p) +genius_speed_changed(void *priv) { - genius_t *genius = (genius_t *) p; + genius_t *genius = (genius_t *) priv; genius_recalctimings(genius); } diff --git a/src/video/vid_hercules.c b/src/video/vid_hercules.c index f3ce178cd..e2879cec3 100644 --- a/src/video/vid_hercules.c +++ b/src/video/vid_hercules.c @@ -32,6 +32,7 @@ #include <86box/device.h> #include <86box/video.h> #include <86box/vid_hercules.h> +#include <86box/plat_unused.h> static video_timings_t timing_hercules = { .type = VIDEO_ISA, .write_b = 8, .write_w = 16, .write_l = 32, .read_b = 8, .read_w = 16, .read_l = 32 }; @@ -192,7 +193,7 @@ hercules_in(uint16_t addr, void *priv) } static void -hercules_waitstates(void *p) +hercules_waitstates(UNUSED(void *priv)) { int ws_array[16] = { 3, 4, 5, 6, 7, 8, 4, 5, 6, 7, 8, 4, 5, 6, 7, 8 }; int ws; @@ -493,7 +494,9 @@ hercules_poll(void *priv) else video_blit_memtoscreen(8, dev->firstline + 14, xsize, ysize); frames++; - // if ((dev->ctrl & 2) && (dev->ctrl2 & 1)) { +#if 0 + if ((dev->ctrl & 2) && (dev->ctrl2 & 1)) { +#endif if (dev->ctrl & 0x02) { video_res_x = dev->crtc[1] * 16; video_res_y = dev->crtc[6] * 4; @@ -527,7 +530,7 @@ hercules_poll(void *priv) } static void * -hercules_init(const device_t *info) +hercules_init(UNUSED(const device_t *info)) { hercules_t *dev; diff --git a/src/video/vid_herculesplus.c b/src/video/vid_herculesplus.c index a5422fbc1..587410c07 100644 --- a/src/video/vid_herculesplus.c +++ b/src/video/vid_herculesplus.c @@ -30,6 +30,7 @@ #include <86box/rom.h> #include <86box/device.h> #include <86box/video.h> +#include <86box/plat_unused.h> /* extended CRTC registers */ #define HERCULESPLUS_CRTC_XMODE 20 /* xMode register */ @@ -162,6 +163,9 @@ herculesplus_out(uint16_t port, uint8_t val, void *priv) else mem_mapping_set_addr(&dev->mapping, 0xb0000, 0x08000); return; + + default: + break; } } @@ -191,6 +195,9 @@ herculesplus_in(uint16_t port, void *priv) /* 0x10: Hercules Plus card identity */ ret = (dev->stat & 0xf) | ((dev->stat & 8) << 4) | 0x10; break; + + default: + break; } return ret; @@ -458,6 +465,9 @@ text_line(herculesplus_t *dev, uint16_t ca) case 5: /* 48k RAMfont */ draw_char_ram48(dev, x, chr, attr); break; + + default: + break; } ++dev->ma; @@ -641,7 +651,7 @@ herculesplus_poll(void *priv) } static void * -herculesplus_init(const device_t *info) +herculesplus_init(UNUSED(const device_t *info)) { herculesplus_t *dev; diff --git a/src/video/vid_ht216.c b/src/video/vid_ht216.c index 6b99975d5..b8e265c16 100644 --- a/src/video/vid_ht216.c +++ b/src/video/vid_ht216.c @@ -35,6 +35,7 @@ #include <86box/video.h> #include <86box/vid_svga.h> #include <86box/vid_svga_render.h> +#include <86box/plat_unused.h> typedef struct ht216_t { svga_t svga; @@ -92,8 +93,8 @@ typedef struct ht216_t { void ht216_remap(ht216_t *ht216); -void ht216_out(uint16_t addr, uint8_t val, void *p); -uint8_t ht216_in(uint16_t addr, void *p); +void ht216_out(uint16_t addr, uint8_t val, void *priv); +uint8_t ht216_in(uint16_t addr, void *priv); #define BIOS_G2_GC205_PATH "roms/video/video7/BIOS.BIN" #define BIOS_VIDEO7_VGA_1024I_PATH "roms/video/video7/Video Seven VGA 1024i - BIOS - v2.19 - 435-0062-05 - U17 - 27C256.BIN" @@ -164,9 +165,9 @@ ht216_recalc_bank_regs(ht216_t *ht216, int mode) } void -ht216_out(uint16_t addr, uint8_t val, void *p) +ht216_out(uint16_t addr, uint8_t val, void *priv) { - ht216_t *ht216 = (ht216_t *) p; + ht216_t *ht216 = (ht216_t *) priv; svga_t *svga = &ht216->svga; uint8_t old; @@ -319,7 +320,7 @@ ht216_out(uint16_t addr, uint8_t val, void *p) svga->adv_flags &= ~FLAG_RAMDAC_SHIFT; if (val & 0x04) svga->adv_flags |= FLAG_RAMDAC_SHIFT; - /* FALLTHROUGH */ + [[fallthrough]]; /*Bank registers*/ case 0xe8: case 0xe9: @@ -463,9 +464,9 @@ ht216_out(uint16_t addr, uint8_t val, void *p) } uint8_t -ht216_in(uint16_t addr, void *p) +ht216_in(uint16_t addr, void *priv) { - ht216_t *ht216 = (ht216_t *) p; + ht216_t *ht216 = (ht216_t *) priv; svga_t *svga = &ht216->svga; uint8_t ret = 0xff; @@ -606,7 +607,7 @@ ht216_remap(ht216_t *ht216) void ht216_recalctimings(svga_t *svga) { - ht216_t *ht216 = (ht216_t *) svga->p; + ht216_t *ht216 = (ht216_t *) svga->priv; int high_res_256 = 0; switch ((((((svga->miscout >> 2) & 3) || ((ht216->ht_regs[0xa4] >> 2) & 3)) | ((ht216->ht_regs[0xa4] >> 2) & 4)) || ((ht216->ht_regs[0xf8] >> 5) & 0x0f)) | ((ht216->ht_regs[0xf8] << 1) & 8)) { @@ -702,7 +703,7 @@ ht216_recalctimings(svga_t *svga) static void ht216_hwcursor_draw(svga_t *svga, int displine) { - ht216_t *ht216 = (ht216_t *) svga->p; + ht216_t *ht216 = (ht216_t *) svga->priv; int shift = (ht216->adjust_cursor ? 2 : 1); uint32_t dat[2]; int offset = svga->hwcursor_latch.x + svga->hwcursor_latch.xoff; @@ -1164,9 +1165,9 @@ ht216_write_common(ht216_t *ht216, uint32_t addr, uint8_t val) } static void -ht216_write(uint32_t addr, uint8_t val, void *p) +ht216_write(uint32_t addr, uint8_t val, void *priv) { - ht216_t *ht216 = (ht216_t *) p; + ht216_t *ht216 = (ht216_t *) priv; svga_t *svga = &ht216->svga; uint32_t prev_addr = addr; @@ -1185,9 +1186,9 @@ ht216_write(uint32_t addr, uint8_t val, void *p) } static void -ht216_writew(uint32_t addr, uint16_t val, void *p) +ht216_writew(uint32_t addr, uint16_t val, void *priv) { - ht216_t *ht216 = (ht216_t *) p; + ht216_t *ht216 = (ht216_t *) priv; svga_t *svga = &ht216->svga; uint32_t prev_addr = addr; @@ -1208,9 +1209,9 @@ ht216_writew(uint32_t addr, uint16_t val, void *p) } static void -ht216_writel(uint32_t addr, uint32_t val, void *p) +ht216_writel(uint32_t addr, uint32_t val, void *priv) { - ht216_t *ht216 = (ht216_t *) p; + ht216_t *ht216 = (ht216_t *) priv; svga_t *svga = &ht216->svga; uint32_t prev_addr = addr; @@ -1233,9 +1234,9 @@ ht216_writel(uint32_t addr, uint32_t val, void *p) } static void -ht216_write_linear(uint32_t addr, uint8_t val, void *p) +ht216_write_linear(uint32_t addr, uint8_t val, void *priv) { - ht216_t *ht216 = (ht216_t *) p; + ht216_t *ht216 = (ht216_t *) priv; svga_t *svga = &ht216->svga; addr -= ht216->linear_base; @@ -1250,9 +1251,9 @@ ht216_write_linear(uint32_t addr, uint8_t val, void *p) } static void -ht216_writew_linear(uint32_t addr, uint16_t val, void *p) +ht216_writew_linear(uint32_t addr, uint16_t val, void *priv) { - ht216_t *ht216 = (ht216_t *) p; + ht216_t *ht216 = (ht216_t *) priv; svga_t *svga = &ht216->svga; addr -= ht216->linear_base; @@ -1269,9 +1270,9 @@ ht216_writew_linear(uint32_t addr, uint16_t val, void *p) } static void -ht216_writel_linear(uint32_t addr, uint32_t val, void *p) +ht216_writel_linear(uint32_t addr, uint32_t val, void *priv) { - ht216_t *ht216 = (ht216_t *) p; + ht216_t *ht216 = (ht216_t *) priv; svga_t *svga = &ht216->svga; addr -= ht216->linear_base; @@ -1372,9 +1373,9 @@ ht216_read_common(ht216_t *ht216, uint32_t addr) } static uint8_t -ht216_read(uint32_t addr, void *p) +ht216_read(uint32_t addr, void *priv) { - ht216_t *ht216 = (ht216_t *) p; + ht216_t *ht216 = (ht216_t *) priv; svga_t *svga = &ht216->svga; uint32_t prev_addr = addr; @@ -1390,9 +1391,9 @@ ht216_read(uint32_t addr, void *p) } static uint8_t -ht216_read_linear(uint32_t addr, void *p) +ht216_read_linear(uint32_t addr, void *priv) { - ht216_t *ht216 = (ht216_t *) p; + ht216_t *ht216 = (ht216_t *) priv; svga_t *svga = &ht216->svga; addr -= ht216->linear_base; @@ -1427,7 +1428,7 @@ radius_mca_write(int port, uint8_t val, void *priv) } static uint8_t -radius_mca_feedb(void *priv) +radius_mca_feedb(UNUSED(void *priv)) { return 1; } @@ -1611,9 +1612,9 @@ radius_svga_multiview_available(void) } void -ht216_close(void *p) +ht216_close(void *priv) { - ht216_t *ht216 = (ht216_t *) p; + ht216_t *ht216 = (ht216_t *) priv; svga_close(&ht216->svga); @@ -1621,17 +1622,17 @@ ht216_close(void *p) } void -ht216_speed_changed(void *p) +ht216_speed_changed(void *priv) { - ht216_t *ht216 = (ht216_t *) p; + ht216_t *ht216 = (ht216_t *) priv; svga_recalctimings(&ht216->svga); } void -ht216_force_redraw(void *p) +ht216_force_redraw(void *priv) { - ht216_t *ht216 = (ht216_t *) p; + ht216_t *ht216 = (ht216_t *) priv; ht216->svga.fullchange = changeframecount; } diff --git a/src/video/vid_ibm_rgb528_ramdac.c b/src/video/vid_ibm_rgb528_ramdac.c index 339cf6700..b7a27781b 100644 --- a/src/video/vid_ibm_rgb528_ramdac.c +++ b/src/video/vid_ibm_rgb528_ramdac.c @@ -25,6 +25,7 @@ #include <86box/timer.h> #include <86box/video.h> #include <86box/vid_svga.h> +#include <86box/plat_unused.h> typedef union { uint8_t pixel; @@ -913,7 +914,7 @@ ibm_rgb528_hwcursor_draw(svga_t *svga, int displine) } void * -ibm_rgb528_ramdac_init(const device_t *info) +ibm_rgb528_ramdac_init(UNUSED(const device_t *info)) { ibm_rgb528_ramdac_t *ramdac = (ibm_rgb528_ramdac_t *) malloc(sizeof(ibm_rgb528_ramdac_t)); memset(ramdac, 0, sizeof(ibm_rgb528_ramdac_t)); diff --git a/src/video/vid_icd2061.c b/src/video/vid_icd2061.c index 57dcdce38..adfaf6ad4 100644 --- a/src/video/vid_icd2061.c +++ b/src/video/vid_icd2061.c @@ -29,6 +29,7 @@ #define HAVE_STDARG_H #include <86box/86box.h> #include <86box/device.h> +#include <86box/plat_unused.h> typedef struct icd2061_t { float freq[3]; @@ -135,9 +136,9 @@ icd2061_write(void *p, int val) } float -icd2061_getclock(int clock, void *p) +icd2061_getclock(int clock, void *priv) { - icd2061_t *icd2061 = (icd2061_t *) p; + icd2061_t *icd2061 = (icd2061_t *) priv; if (clock > 2) clock = 2; @@ -146,7 +147,7 @@ icd2061_getclock(int clock, void *p) } static void * -icd2061_init(const device_t *info) +icd2061_init(UNUSED(const device_t *info)) { icd2061_t *icd2061 = (icd2061_t *) malloc(sizeof(icd2061_t)); memset(icd2061, 0, sizeof(icd2061_t)); diff --git a/src/video/vid_ics2494.c b/src/video/vid_ics2494.c index 99a877a75..16c4139fe 100644 --- a/src/video/vid_ics2494.c +++ b/src/video/vid_ics2494.c @@ -49,9 +49,9 @@ ics2494_log(const char *fmt, ...) #endif float -ics2494_getclock(int clock, void *p) +ics2494_getclock(int clock, void *priv) { - ics2494_t *ics2494 = (ics2494_t *) p; + ics2494_t *ics2494 = (ics2494_t *) priv; if (clock > 15) clock = 15; diff --git a/src/video/vid_ics2595.c b/src/video/vid_ics2595.c index 520bcda43..6420ee7e4 100644 --- a/src/video/vid_ics2595.c +++ b/src/video/vid_ics2595.c @@ -23,6 +23,7 @@ #include #include <86box/86box.h> #include <86box/device.h> +#include <86box/plat_unused.h> typedef struct ics2595_t { int oldfs3, oldfs2; @@ -70,6 +71,9 @@ ics2595_write(void *p, int strobe, int dat) ics2595->state = ICS2595_IDLE; } break; + + default: + break; } } @@ -81,7 +85,7 @@ ics2595_write(void *p, int strobe, int dat) } static void * -ics2595_init(const device_t *info) +ics2595_init(UNUSED(const device_t *info)) { ics2595_t *ics2595 = (ics2595_t *) malloc(sizeof(ics2595_t)); memset(ics2595, 0, sizeof(ics2595_t)); @@ -99,9 +103,9 @@ ics2595_close(void *priv) } double -ics2595_getclock(void *p) +ics2595_getclock(void *priv) { - ics2595_t *ics2595 = (ics2595_t *) p; + ics2595_t *ics2595 = (ics2595_t *) priv; return ics2595->output_clock; } diff --git a/src/video/vid_im1024.c b/src/video/vid_im1024.c index cb3999be4..25ba92e9c 100644 --- a/src/video/vid_im1024.c +++ b/src/video/vid_im1024.c @@ -635,7 +635,7 @@ hndl_poly(pgc_t *pgc) } static int -parse_poly(pgc_t *pgc, pgc_cl_t *cl, int c) +parse_poly(pgc_t *pgc, pgc_cl_t *cl, UNUSED(int c)) { uint8_t count; @@ -1031,7 +1031,7 @@ static const pgc_cmd_t im1024_commands[] = { }; static void * -im1024_init(const device_t *info) +im1024_init(UNUSED(const device_t *info)) { im1024_t *dev; diff --git a/src/video/vid_incolor.c b/src/video/vid_incolor.c index 6e8054aaa..7a3b416fc 100644 --- a/src/video/vid_incolor.c +++ b/src/video/vid_incolor.c @@ -30,6 +30,7 @@ #include <86box/rom.h> #include <86box/device.h> #include <86box/video.h> +#include <86box/plat_unused.h> /* extended CRTC registers */ #define INCOLOR_CRTC_XMODE 20 /* xMode register */ @@ -972,7 +973,7 @@ incolor_poll(void *priv) } static void * -incolor_init(const device_t *info) +incolor_init(UNUSED(const device_t *info)) { incolor_t *dev; int c; diff --git a/src/video/vid_mda.c b/src/video/vid_mda.c index 44f91ec95..8888208e2 100644 --- a/src/video/vid_mda.c +++ b/src/video/vid_mda.c @@ -31,6 +31,7 @@ #include <86box/device.h> #include <86box/video.h> #include <86box/vid_mda.h> +#include <86box/plat_unused.h> static int mdacols[256][2][2]; @@ -39,9 +40,10 @@ static video_timings_t timing_mda = { .type = VIDEO_ISA, .write_b = 8, .write_w void mda_recalctimings(mda_t *mda); void -mda_out(uint16_t addr, uint8_t val, void *p) +mda_out(uint16_t addr, uint8_t val, void *priv) { - mda_t *mda = (mda_t *) p; + mda_t *mda = (mda_t *) priv; + switch (addr) { case 0x3b0: case 0x3b2: @@ -64,13 +66,17 @@ mda_out(uint16_t addr, uint8_t val, void *p) case 0x3b8: mda->ctrl = val; return; + + default: + break; } } uint8_t -mda_in(uint16_t addr, void *p) +mda_in(uint16_t addr, void *priv) { - mda_t *mda = (mda_t *) p; + mda_t *mda = (mda_t *) priv; + switch (addr) { case 0x3b0: case 0x3b2: @@ -84,21 +90,25 @@ mda_in(uint16_t addr, void *p) return mda->crtc[mda->crtcreg]; case 0x3ba: return mda->stat | 0xF0; + + default: + break; } return 0xff; } void -mda_write(uint32_t addr, uint8_t val, void *p) +mda_write(uint32_t addr, uint8_t val, void *priv) { - mda_t *mda = (mda_t *) p; + mda_t *mda = (mda_t *) priv; mda->vram[addr & 0xfff] = val; } uint8_t -mda_read(uint32_t addr, void *p) +mda_read(uint32_t addr, void *priv) { - mda_t *mda = (mda_t *) p; + mda_t *mda = (mda_t *) priv; + return mda->vram[addr & 0xfff]; } @@ -118,9 +128,9 @@ mda_recalctimings(mda_t *mda) } void -mda_poll(void *p) +mda_poll(void *priv) { - mda_t *mda = (mda_t *) p; + mda_t *mda = (mda_t *) priv; uint16_t ca = (mda->crtc[15] | (mda->crtc[14] << 8)) & 0x3fff; int drawcursor; int x; @@ -299,7 +309,7 @@ mda_init(mda_t *mda) } void * -mda_standalone_init(const device_t *info) +mda_standalone_init(UNUSED(const device_t *info)) { mda_t *mda = malloc(sizeof(mda_t)); memset(mda, 0, sizeof(mda_t)); @@ -324,18 +334,18 @@ mda_setcol(int chr, int blink, int fg, uint8_t cga_ink) } void -mda_close(void *p) +mda_close(void *priv) { - mda_t *mda = (mda_t *) p; + mda_t *mda = (mda_t *) priv; free(mda->vram); free(mda); } void -mda_speed_changed(void *p) +mda_speed_changed(void *priv) { - mda_t *mda = (mda_t *) p; + mda_t *mda = (mda_t *) priv; mda_recalctimings(mda); } diff --git a/src/video/vid_mga.c b/src/video/vid_mga.c index 677531c29..fb616d44e 100644 --- a/src/video/vid_mga.c +++ b/src/video/vid_mga.c @@ -633,28 +633,28 @@ static void wake_fifo_thread(mystique_t *mystique); static void wait_fifo_idle(mystique_t *mystique); static void mystique_queue(mystique_t *mystique, uint32_t addr, uint32_t val, uint32_t type); -static uint8_t mystique_readb_linear(uint32_t addr, void *p); -static uint16_t mystique_readw_linear(uint32_t addr, void *p); -static uint32_t mystique_readl_linear(uint32_t addr, void *p); -static void mystique_writeb_linear(uint32_t addr, uint8_t val, void *p); -static void mystique_writew_linear(uint32_t addr, uint16_t val, void *p); -static void mystique_writel_linear(uint32_t addr, uint32_t val, void *p); +static uint8_t mystique_readb_linear(uint32_t addr, void *priv); +static uint16_t mystique_readw_linear(uint32_t addr, void *priv); +static uint32_t mystique_readl_linear(uint32_t addr, void *priv); +static void mystique_writeb_linear(uint32_t addr, uint8_t val, void *priv); +static void mystique_writew_linear(uint32_t addr, uint16_t val, void *priv); +static void mystique_writel_linear(uint32_t addr, uint32_t val, void *priv); static void mystique_recalc_mapping(mystique_t *mystique); static int mystique_line_compare(svga_t *svga); -static uint8_t mystique_iload_read_b(uint32_t addr, void *p); -static uint32_t mystique_iload_read_l(uint32_t addr, void *p); -static void mystique_iload_write_b(uint32_t addr, uint8_t val, void *p); -static void mystique_iload_write_l(uint32_t addr, uint32_t val, void *p); +static uint8_t mystique_iload_read_b(uint32_t addr, void *priv); +static uint32_t mystique_iload_read_l(uint32_t addr, void *priv); +static void mystique_iload_write_b(uint32_t addr, uint8_t val, void *priv); +static void mystique_iload_write_l(uint32_t addr, uint32_t val, void *priv); static uint32_t blit_idump_read(mystique_t *mystique); static void blit_iload_write(mystique_t *mystique, uint32_t data, int size); void -mystique_out(uint16_t addr, uint8_t val, void *p) +mystique_out(uint16_t addr, uint8_t val, void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; svga_t *svga = &mystique->svga; uint8_t old; @@ -664,6 +664,7 @@ mystique_out(uint16_t addr, uint8_t val, void *p) switch (addr) { case 0x3c8: mystique->xreg_idx = val; + [[fallthrough]]; case 0x3c6: case 0x3c7: case 0x3c9: @@ -746,9 +747,9 @@ mystique_out(uint16_t addr, uint8_t val, void *p) } uint8_t -mystique_in(uint16_t addr, void *p) +mystique_in(uint16_t addr, void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; svga_t *svga = &mystique->svga; uint8_t temp = 0xff; @@ -803,7 +804,7 @@ mystique_in(uint16_t addr, void *p) static int mystique_line_compare(svga_t *svga) { - mystique_t *mystique = (mystique_t *) svga->p; + mystique_t *mystique = (mystique_t *) svga->priv; mystique->status |= STATUS_VLINEPEN; mystique_update_irqs(mystique); @@ -814,7 +815,7 @@ mystique_line_compare(svga_t *svga) static void mystique_vsync_callback(svga_t *svga) { - mystique_t *mystique = (mystique_t *) svga->p; + mystique_t *mystique = (mystique_t *) svga->priv; if (svga->crtc[0x11] & 0x10) { mystique->status |= STATUS_VSYNCPEN; @@ -823,9 +824,9 @@ mystique_vsync_callback(svga_t *svga) } static float -mystique_getclock(int clock, void *p) +mystique_getclock(int clock, void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; if (clock == 0) return 25175000.0; @@ -845,7 +846,7 @@ mystique_getclock(int clock, void *p) void mystique_recalctimings(svga_t *svga) { - mystique_t *mystique = (mystique_t *) svga->p; + mystique_t *mystique = (mystique_t *) svga->priv; int clk_sel = (svga->miscout >> 2) & 3; svga->clock = (cpuclock * (float) (1ULL << 32)) / svga->getclock(clk_sel & 3, svga->clock_gen); @@ -1361,9 +1362,9 @@ mystique_write_xreg(mystique_t *mystique, int reg, uint8_t val) } static uint8_t -mystique_ctrl_read_b(uint32_t addr, void *p) +mystique_ctrl_read_b(uint32_t addr, void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; svga_t *svga = &mystique->svga; uint8_t ret = 0xff; int fifocount; @@ -1586,9 +1587,9 @@ mystique_ctrl_read_b(uint32_t addr, void *p) } static void -mystique_accel_ctrl_write_b(uint32_t addr, uint8_t val, void *p) +mystique_accel_ctrl_write_b(uint32_t addr, uint8_t val, void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; int start_blit = 0; if ((addr & 0x300) == 0x100) { @@ -1705,7 +1706,9 @@ mystique_accel_ctrl_write_b(uint32_t addr, uint8_t val, void *p) case REG_YDSTLEN: case REG_YDSTLEN + 1: WRITE8(addr, mystique->dwgreg.length, val); - /* pclog("Write YDSTLEN+%i %i\n", addr&1, mystique->dwgreg.length); */ +#if 0 + pclog("Write YDSTLEN+%i %i\n", addr&1, mystique->dwgreg.length); +#endif break; case REG_YDSTLEN + 2: mystique->dwgreg.ydst = (mystique->dwgreg.ydst & ~0xff) | val; @@ -1924,9 +1927,9 @@ mystique_accel_ctrl_write_b(uint32_t addr, uint8_t val, void *p) } static void -mystique_ctrl_write_b(uint32_t addr, uint8_t val, void *p) +mystique_ctrl_write_b(uint32_t addr, uint8_t val, void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; svga_t *svga = &mystique->svga; uint16_t addr_0x0f = 0; uint16_t addr_0x03 = 0; @@ -1962,7 +1965,7 @@ mystique_ctrl_write_b(uint32_t addr, uint8_t val, void *p) } if ((addr & 0x3fff) < 0x1c00) { - mystique_iload_write_b(addr, val, p); + mystique_iload_write_b(addr, val, priv); return; } if ((addr & 0x3e00) == 0x1c00 || (addr & 0x3e00) == 0x2c00) { @@ -2144,25 +2147,25 @@ mystique_ctrl_write_b(uint32_t addr, uint8_t val, void *p) } static uint32_t -mystique_ctrl_read_l(uint32_t addr, void *p) +mystique_ctrl_read_l(uint32_t addr, void *priv) { uint32_t ret; if ((addr & 0x3fff) < 0x1c00) - return mystique_iload_read_l(addr, p); + return mystique_iload_read_l(addr, priv); - ret = mystique_ctrl_read_b(addr, p); - ret |= mystique_ctrl_read_b(addr + 1, p) << 8; - ret |= mystique_ctrl_read_b(addr + 2, p) << 16; - ret |= mystique_ctrl_read_b(addr + 3, p) << 24; + ret = mystique_ctrl_read_b(addr, priv); + ret |= mystique_ctrl_read_b(addr + 1, priv) << 8; + ret |= mystique_ctrl_read_b(addr + 2, priv) << 16; + ret |= mystique_ctrl_read_b(addr + 3, priv) << 24; return ret; } static void -mystique_accel_ctrl_write_l(uint32_t addr, uint32_t val, void *p) +mystique_accel_ctrl_write_l(uint32_t addr, uint32_t val, void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; int start_blit = 0; if ((addr & 0x300) == 0x100) { @@ -2256,7 +2259,9 @@ mystique_accel_ctrl_write_l(uint32_t addr, uint32_t val, void *p) mystique->dwgreg.pattern[y][x] = val & (1 << (x + (y * 16))); } } - // pclog("SRC0 = 0x%08X\n", val); +#if 0 + pclog("SRC0 = 0x%08X\n", val); +#endif if (mystique->busy && (mystique->dwgreg.dwgctrl_running & DWGCTRL_OPCODE_MASK) == DWGCTRL_OPCODE_ILOAD) blit_iload_write(mystique, mystique->dwgreg.src[0], 32); } @@ -2379,10 +2384,10 @@ mystique_accel_ctrl_write_l(uint32_t addr, uint32_t val, void *p) break; default: - mystique_accel_ctrl_write_b(addr, val & 0xff, p); - mystique_accel_ctrl_write_b(addr + 1, (val >> 8) & 0xff, p); - mystique_accel_ctrl_write_b(addr + 2, (val >> 16) & 0xff, p); - mystique_accel_ctrl_write_b(addr + 3, (val >> 24) & 0xff, p); + mystique_accel_ctrl_write_b(addr, val & 0xff, priv); + mystique_accel_ctrl_write_b(addr + 1, (val >> 8) & 0xff, priv); + mystique_accel_ctrl_write_b(addr + 2, (val >> 16) & 0xff, priv); + mystique_accel_ctrl_write_b(addr + 3, (val >> 24) & 0xff, priv); break; } @@ -2391,13 +2396,13 @@ mystique_accel_ctrl_write_l(uint32_t addr, uint32_t val, void *p) } static void -mystique_ctrl_write_l(uint32_t addr, uint32_t val, void *p) +mystique_ctrl_write_l(uint32_t addr, uint32_t val, void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; uint32_t reg_addr; if ((addr & 0x3fff) < 0x1c00) { - mystique_iload_write_l(addr, val, p); + mystique_iload_write_l(addr, val, priv); return; } @@ -2452,18 +2457,18 @@ mystique_ctrl_write_l(uint32_t addr, uint32_t val, void *p) break; default: - mystique_ctrl_write_b(addr, val & 0xff, p); - mystique_ctrl_write_b(addr + 1, (val >> 8) & 0xff, p); - mystique_ctrl_write_b(addr + 2, (val >> 16) & 0xff, p); - mystique_ctrl_write_b(addr + 3, (val >> 24) & 0xff, p); + mystique_ctrl_write_b(addr, val & 0xff, priv); + mystique_ctrl_write_b(addr + 1, (val >> 8) & 0xff, priv); + mystique_ctrl_write_b(addr + 2, (val >> 16) & 0xff, priv); + mystique_ctrl_write_b(addr + 3, (val >> 24) & 0xff, priv); break; } } static uint8_t -mystique_iload_read_b(uint32_t addr, void *p) +mystique_iload_read_b(UNUSED(uint32_t addr), void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; wait_fifo_idle(mystique); @@ -2474,9 +2479,9 @@ mystique_iload_read_b(uint32_t addr, void *p) } static uint32_t -mystique_iload_read_l(uint32_t addr, void *p) +mystique_iload_read_l(UNUSED(uint32_t addr), void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; wait_fifo_idle(mystique); @@ -2488,22 +2493,23 @@ mystique_iload_read_l(uint32_t addr, void *p) } static void -mystique_iload_write_b(uint32_t addr, uint8_t val, void *p) +mystique_iload_write_b(UNUSED(uint32_t addr), UNUSED(uint8_t val), UNUSED(void *priv)) { + // } static void -mystique_iload_write_l(uint32_t addr, uint32_t val, void *p) +mystique_iload_write_l(UNUSED(uint32_t addr), uint32_t val, void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; mystique_queue(mystique, 0, val, FIFO_WRITE_ILOAD_LONG); } static void -mystique_accel_iload_write_l(uint32_t addr, uint32_t val, void *p) +mystique_accel_iload_write_l(UNUSED(uint32_t addr), uint32_t val, void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; switch (mystique->dwgreg.dmamod) { case DMA_MODE_REG: @@ -2531,15 +2537,18 @@ mystique_accel_iload_write_l(uint32_t addr, uint32_t val, void *p) blit_iload_write(mystique, val, 32); break; - /* default: - pclog("ILOAD write DMAMOD %i\n", mystique->dwgreg.dmamod); */ + default: +#if 0 + pclog("ILOAD write DMAMOD %i\n", mystique->dwgreg.dmamod); */ +#endif + break; } } static uint8_t -mystique_readb_linear(uint32_t addr, void *p) +mystique_readb_linear(uint32_t addr, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; cycles -= video_timing_read_b; @@ -2551,9 +2560,9 @@ mystique_readb_linear(uint32_t addr, void *p) } static uint16_t -mystique_readw_linear(uint32_t addr, void *p) +mystique_readw_linear(uint32_t addr, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; cycles -= video_timing_read_w; @@ -2565,9 +2574,9 @@ mystique_readw_linear(uint32_t addr, void *p) } static uint32_t -mystique_readl_linear(uint32_t addr, void *p) +mystique_readl_linear(uint32_t addr, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; cycles -= video_timing_read_l; @@ -2579,9 +2588,9 @@ mystique_readl_linear(uint32_t addr, void *p) } static void -mystique_writeb_linear(uint32_t addr, uint8_t val, void *p) +mystique_writeb_linear(uint32_t addr, uint8_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; cycles -= video_timing_write_b; @@ -2594,9 +2603,9 @@ mystique_writeb_linear(uint32_t addr, uint8_t val, void *p) } static void -mystique_writew_linear(uint32_t addr, uint16_t val, void *p) +mystique_writew_linear(uint32_t addr, uint16_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; cycles -= video_timing_write_w; @@ -2609,9 +2618,9 @@ mystique_writew_linear(uint32_t addr, uint16_t val, void *p) } static void -mystique_writel_linear(uint32_t addr, uint32_t val, void *p) +mystique_writel_linear(uint32_t addr, uint32_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; cycles -= video_timing_write_l; @@ -2751,9 +2760,9 @@ run_dma(mystique_t *mystique) } static void -fifo_thread(void *p) +fifo_thread(void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; while (mystique->thread_run) { thread_set_event(mystique->fifo_not_full_event); @@ -2815,9 +2824,9 @@ wake_fifo_thread_now(mystique_t *mystique) } static void -mystique_wake_timer(void *p) +mystique_wake_timer(void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; thread_set_event(mystique->wake_fifo_thread); /*Wake up FIFO thread if moving from idle*/ } @@ -2837,9 +2846,9 @@ wait_fifo_idle(mystique_t *mystique) SOFTRAP IRQs and code reading the status register. Croc will get into an IRQ loop and triple fault if the ENDPRDMASTS flag is seen before the IRQ is taken*/ static void -mystique_softrap_pending_timer(void *p) +mystique_softrap_pending_timer(void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; timer_advance_u64(&mystique->softrap_pending_timer, TIMER_USEC * 100); @@ -3268,6 +3277,9 @@ blit_iload_iload(mystique_t *mystique, uint32_t data, int size) case MACCESS_PWIDTH_32: min_size = 32; break; + + default: + break; } while (size >= min_size) { @@ -5148,7 +5160,7 @@ mystique_start_blit(mystique_t *mystique) static void mystique_hwcursor_draw(svga_t *svga, int displine) { - mystique_t *mystique = (mystique_t *) svga->p; + mystique_t *mystique = (mystique_t *) svga->priv; uint64_t dat[2]; int offset = svga->hwcursor_latch.x - svga->hwcursor_latch.xoff; @@ -5178,9 +5190,9 @@ mystique_hwcursor_draw(svga_t *svga, int displine) } static uint8_t -mystique_pci_read(int func, int addr, void *p) +mystique_pci_read(UNUSED(int func), int addr, void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; uint8_t ret = 0x00; if ((addr >= 0x30) && (addr <= 0x33) && !(mystique->pci_regs[0x43] & 0x40)) @@ -5328,9 +5340,9 @@ mystique_pci_read(int func, int addr, void *p) } static void -mystique_pci_write(int func, int addr, uint8_t val, void *p) +mystique_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; switch (addr) { case PCI_REG_COMMAND: @@ -5569,9 +5581,9 @@ mystique_init(const device_t *info) } static void -mystique_close(void *p) +mystique_close(void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; mystique->thread_run = 0; thread_set_event(mystique->wake_fifo_thread); @@ -5608,17 +5620,17 @@ mystique_220_available(void) } static void -mystique_speed_changed(void *p) +mystique_speed_changed(void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; svga_recalctimings(&mystique->svga); } static void -mystique_force_redraw(void *p) +mystique_force_redraw(void *priv) { - mystique_t *mystique = (mystique_t *) p; + mystique_t *mystique = (mystique_t *) priv; mystique->svga.fullchange = changeframecount; } diff --git a/src/video/vid_nga.c b/src/video/vid_nga.c index 2d673393b..32c103a8b 100644 --- a/src/video/vid_nga.c +++ b/src/video/vid_nga.c @@ -38,6 +38,7 @@ #include <86box/vid_cga.h> #include <86box/vid_nga.h> #include <86box/vid_cga_comp.h> +#include <86box/plat_unused.h> #define CGA_RGB 0 #define CGA_COMPOSITE 1 @@ -86,7 +87,7 @@ nga_in(uint16_t addr, void *priv) } void -nga_waitstates(void *p) +nga_waitstates(UNUSED(void *priv)) { int ws_array[16] = { 3, 4, 5, 6, 7, 8, 4, 5, 6, 7, 8, 4, 5, 6, 7, 8 }; int ws; @@ -553,7 +554,7 @@ nga_speed_changed(void *priv) } void * -nga_init(const device_t *info) +nga_init(UNUSED(const device_t *info)) { int mem; uint8_t charset; diff --git a/src/video/vid_oak_oti.c b/src/video/vid_oak_oti.c index 4a3b22934..932e13913 100644 --- a/src/video/vid_oak_oti.c +++ b/src/video/vid_oak_oti.c @@ -29,6 +29,7 @@ #include <86box/video.h> #include <86box/vid_svga.h> #include <86box/vid_svga_render.h> +#include <86box/plat_unused.h> #define BIOS_037C_PATH "roms/video/oti/bios.bin" #define BIOS_067_AMA932J_PATH "roms/machines/ama932j/OTI067.BIN" @@ -64,9 +65,9 @@ typedef struct { static video_timings_t timing_oti = { .type = VIDEO_ISA, .write_b = 6, .write_w = 8, .write_l = 16, .read_b = 6, .read_w = 8, .read_l = 16 }; static void -oti_out(uint16_t addr, uint8_t val, void *p) +oti_out(uint16_t addr, uint8_t val, void *priv) { - oti_t *oti = (oti_t *) p; + oti_t *oti = (oti_t *) priv; svga_t *svga = &oti->svga; uint8_t old; uint8_t idx; @@ -85,7 +86,6 @@ oti_out(uint16_t addr, uint8_t val, void *p) return; } else break; - break; case 0x3c6: case 0x3c7: @@ -199,9 +199,9 @@ oti_out(uint16_t addr, uint8_t val, void *p) } static uint8_t -oti_in(uint16_t addr, void *p) +oti_in(uint16_t addr, void *priv) { - oti_t *oti = (oti_t *) p; + oti_t *oti = (oti_t *) priv; svga_t *svga = &oti->svga; uint8_t idx; uint8_t temp; @@ -319,9 +319,9 @@ oti_in(uint16_t addr, void *p) } static void -oti_pos_out(uint16_t addr, uint8_t val, void *p) +oti_pos_out(UNUSED(uint16_t addr), uint8_t val, void *priv) { - oti_t *oti = (oti_t *) p; + oti_t *oti = (oti_t *) priv; if ((val ^ oti->pos) & 8) { if (val & 8) @@ -336,9 +336,9 @@ oti_pos_out(uint16_t addr, uint8_t val, void *p) } static uint8_t -oti_pos_in(uint16_t addr, void *p) +oti_pos_in(UNUSED(uint16_t addr), void *priv) { - oti_t *oti = (oti_t *) p; + oti_t *oti = (oti_t *) priv; return (oti->pos); } @@ -373,7 +373,7 @@ oti_getclock(int clock) static void oti_recalctimings(svga_t *svga) { - oti_t *oti = (oti_t *) svga->p; + oti_t *oti = (oti_t *) svga->priv; int clk_sel = ((svga->miscout >> 2) & 3) | ((oti->regs[0x0d] & 0x20) >> 3); svga->clock = (cpuclock * (double) (1ULL << 32)) / oti_getclock(clk_sel); @@ -479,9 +479,9 @@ oti_init(const device_t *info) } static void -oti_close(void *p) +oti_close(void *priv) { - oti_t *oti = (oti_t *) p; + oti_t *oti = (oti_t *) priv; svga_close(&oti->svga); @@ -489,17 +489,17 @@ oti_close(void *p) } static void -oti_speed_changed(void *p) +oti_speed_changed(void *priv) { - oti_t *oti = (oti_t *) p; + oti_t *oti = (oti_t *) priv; svga_recalctimings(&oti->svga); } static void -oti_force_redraw(void *p) +oti_force_redraw(void *priv) { - oti_t *oti = (oti_t *) p; + oti_t *oti = (oti_t *) priv; oti->svga.fullchange = changeframecount; } diff --git a/src/video/vid_ogc.c b/src/video/vid_ogc.c index 20be41fad..edc4c841e 100644 --- a/src/video/vid_ogc.c +++ b/src/video/vid_ogc.c @@ -39,6 +39,7 @@ #include <86box/vid_cga.h> #include <86box/vid_ogc.h> #include <86box/vid_cga_comp.h> +#include <86box/plat_unused.h> /* * Current bugs: @@ -140,7 +141,7 @@ ogc_in(uint16_t addr, void *priv) } void -ogc_waitstates(void *p) +ogc_waitstates(UNUSED(void *priv)) { int ws_array[16] = { 3, 4, 5, 6, 7, 8, 4, 5, 6, 7, 8, 4, 5, 6, 7, 8 }; int ws; @@ -572,7 +573,7 @@ ogc_mdaattr_rebuild(void) * - Optional EGC expansion board (which handles 640x400x16) not implemented */ void * -ogc_init(const device_t *info) +ogc_init(UNUSED(const device_t *info)) { // int display_type; ogc_t *ogc = (ogc_t *) malloc(sizeof(ogc_t)); diff --git a/src/video/vid_paradise.c b/src/video/vid_paradise.c index 8971fe01e..a00015f9e 100644 --- a/src/video/vid_paradise.c +++ b/src/video/vid_paradise.c @@ -75,9 +75,9 @@ static video_timings_t timing_paradise_wd90c = { .type = VIDEO_ISA, .write_b = void paradise_remap(paradise_t *paradise); uint8_t -paradise_in(uint16_t addr, void *p) +paradise_in(uint16_t addr, void *priv) { - paradise_t *paradise = (paradise_t *) p; + paradise_t *paradise = (paradise_t *) priv; svga_t *svga = ¶dise->svga; if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) @@ -135,9 +135,9 @@ paradise_in(uint16_t addr, void *p) } void -paradise_out(uint16_t addr, uint8_t val, void *p) +paradise_out(uint16_t addr, uint8_t val, void *priv) { - paradise_t *paradise = (paradise_t *) p; + paradise_t *paradise = (paradise_t *) priv; svga_t *svga = ¶dise->svga; uint8_t old; @@ -301,7 +301,7 @@ paradise_remap(paradise_t *paradise) void paradise_recalctimings(svga_t *svga) { - paradise_t *paradise = (paradise_t *) svga->p; + paradise_t *paradise = (paradise_t *) svga->priv; svga->lowres = !(svga->gdcreg[0x0e] & 0x01); @@ -345,9 +345,9 @@ paradise_recalctimings(svga_t *svga) } static void -paradise_write(uint32_t addr, uint8_t val, void *p) +paradise_write(uint32_t addr, uint8_t val, void *priv) { - paradise_t *paradise = (paradise_t *) p; + paradise_t *paradise = (paradise_t *) priv; svga_t *svga = ¶dise->svga; uint32_t prev_addr; uint32_t prev_addr2; @@ -394,9 +394,9 @@ paradise_write(uint32_t addr, uint8_t val, void *p) svga_write_linear(addr, val, svga); } static void -paradise_writew(uint32_t addr, uint16_t val, void *p) +paradise_writew(uint32_t addr, uint16_t val, void *priv) { - paradise_t *paradise = (paradise_t *) p; + paradise_t *paradise = (paradise_t *) priv; svga_t *svga = ¶dise->svga; uint32_t prev_addr; uint32_t prev_addr2; @@ -444,9 +444,9 @@ paradise_writew(uint32_t addr, uint16_t val, void *p) } static uint8_t -paradise_read(uint32_t addr, void *p) +paradise_read(uint32_t addr, void *priv) { - paradise_t *paradise = (paradise_t *) p; + paradise_t *paradise = (paradise_t *) priv; svga_t *svga = ¶dise->svga; uint32_t prev_addr; uint32_t prev_addr2; @@ -493,9 +493,9 @@ paradise_read(uint32_t addr, void *p) return svga_read_linear(addr, svga); } static uint16_t -paradise_readw(uint32_t addr, void *p) +paradise_readw(uint32_t addr, void *priv) { - paradise_t *paradise = (paradise_t *) p; + paradise_t *paradise = (paradise_t *) priv; svga_t *svga = ¶dise->svga; uint32_t prev_addr; uint32_t prev_addr2; @@ -728,9 +728,9 @@ paradise_wd90c30_standalone_available(void) } void -paradise_close(void *p) +paradise_close(void *priv) { - paradise_t *paradise = (paradise_t *) p; + paradise_t *paradise = (paradise_t *) priv; svga_close(¶dise->svga); @@ -738,17 +738,17 @@ paradise_close(void *p) } void -paradise_speed_changed(void *p) +paradise_speed_changed(void *priv) { - paradise_t *paradise = (paradise_t *) p; + paradise_t *paradise = (paradise_t *) priv; svga_recalctimings(¶dise->svga); } void -paradise_force_redraw(void *p) +paradise_force_redraw(void *priv) { - paradise_t *paradise = (paradise_t *) p; + paradise_t *paradise = (paradise_t *) priv; paradise->svga.fullchange = changeframecount; } diff --git a/src/video/vid_pgc.c b/src/video/vid_pgc.c index d68850bef..0033e96d1 100644 --- a/src/video/vid_pgc.c +++ b/src/video/vid_pgc.c @@ -414,7 +414,7 @@ hndl_clbeg(pgc_t *dev) } static void -hndl_clend(pgc_t *dev) +hndl_clend(UNUSED(pgc_t *dev)) { /* Should not happen outside a CLBEG. */ } @@ -1035,7 +1035,7 @@ hndl_poly(pgc_t *dev) /* Parse but don't execute a POLY command (for adding to a command list) */ static int -parse_poly(pgc_t *dev, pgc_cl_t *cl, int c) +parse_poly(pgc_t *dev, pgc_cl_t *cl, UNUSED(int c)) { uint8_t count; @@ -1898,7 +1898,6 @@ pgc_param_coord(pgc_t *dev, int32_t *value) pgc_error(dev, PGC_ERROR_MISSING); return err_digit(dev); } - break; /* Scientific notation. */ case 'd': diff --git a/src/video/vid_s3.c b/src/video/vid_s3.c index 7f840d134..bcdd64d40 100644 --- a/src/video/vid_s3.c +++ b/src/video/vid_s3.c @@ -376,24 +376,24 @@ typedef struct s3_t { static void s3_updatemapping(s3_t *s3); -static void s3_accel_write(uint32_t addr, uint8_t val, void *p); -static void s3_accel_write_w(uint32_t addr, uint16_t val, void *p); -static void s3_accel_write_l(uint32_t addr, uint32_t val, void *p); -static uint8_t s3_accel_read(uint32_t addr, void *p); -static uint16_t s3_accel_read_w(uint32_t addr, void *p); -static uint32_t s3_accel_read_l(uint32_t addr, void *p); +static void s3_accel_write(uint32_t addr, uint8_t val, void *priv); +static void s3_accel_write_w(uint32_t addr, uint16_t val, void *priv); +static void s3_accel_write_l(uint32_t addr, uint32_t val, void *priv); +static uint8_t s3_accel_read(uint32_t addr, void *priv); +static uint16_t s3_accel_read_w(uint32_t addr, void *priv); +static uint32_t s3_accel_read_l(uint32_t addr, void *priv); -static void s3_out(uint16_t addr, uint8_t val, void *p); -static uint8_t s3_in(uint16_t addr, void *p); +static void s3_out(uint16_t addr, uint8_t val, void *priv); +static uint8_t s3_in(uint16_t addr, void *priv); -static void s3_accel_out(uint16_t port, uint8_t val, void *p); -static void s3_accel_out_w(uint16_t port, uint16_t val, void *p); -static void s3_accel_out_l(uint16_t port, uint32_t val, void *p); -static uint8_t s3_accel_in(uint16_t port, void *p); -static uint16_t s3_accel_in_w(uint16_t port, void *p); -static uint32_t s3_accel_in_l(uint16_t port, void *p); -static uint8_t s3_pci_read(int func, int addr, void *p); -static void s3_pci_write(int func, int addr, uint8_t val, void *p); +static void s3_accel_out(uint16_t port, uint8_t val, void *priv); +static void s3_accel_out_w(uint16_t port, uint16_t val, void *priv); +static void s3_accel_out_l(uint16_t port, uint32_t val, void *priv); +static uint8_t s3_accel_in(uint16_t port, void *priv); +static uint16_t s3_accel_in_w(uint16_t port, void *priv); +static uint32_t s3_accel_in_l(uint16_t port, void *priv); +static uint8_t s3_pci_read(int func, int addr, void *priv); +static void s3_pci_write(int func, int addr, uint8_t val, void *priv); /*Remap address for chain-4/doubleword style layout. These will stay for convenience.*/ @@ -1980,7 +1980,7 @@ s3_accel_write_fifo_l(s3_t *s3, uint32_t addr, uint32_t val) static void s3_vblank_start(svga_t *svga) { - s3_t *s3 = (s3_t *) svga->p; + s3_t *s3 = (s3_t *) svga->priv; s3->subsys_stat |= INT_VSY; s3_update_irqs(s3); @@ -2003,7 +2003,7 @@ s3_hwcursor_convert_addr(svga_t *svga) static void s3_hwcursor_draw(svga_t *svga, int displine) { - s3_t *s3 = (s3_t *) svga->p; + s3_t *s3 = (s3_t *) svga->priv; int shift = 1; int width = 16; uint16_t dat[2]; @@ -2332,7 +2332,7 @@ s3_hwcursor_draw(svga_t *svga, int displine) static void s3_trio64v_overlay_draw(svga_t *svga, int displine) { - s3_t *s3 = (s3_t *) svga->p; + s3_t *s3 = (s3_t *) svga->priv; int offset = (s3->streams.sec_x - s3->streams.pri_x) + 1; int h_acc = s3->streams.dda_horiz_accumulator; int r[8]; @@ -2562,9 +2562,9 @@ s3_io_set(s3_t *s3) } static void -s3_out(uint16_t addr, uint8_t val, void *p) +s3_out(uint16_t addr, uint8_t val, void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; svga_t *svga = &s3->svga; uint8_t old; uint8_t mask; @@ -2909,9 +2909,9 @@ s3_out(uint16_t addr, uint8_t val, void *p) } static uint8_t -s3_in(uint16_t addr, void *p) +s3_in(uint16_t addr, void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; svga_t *svga = &s3->svga; int rs2; int rs3; @@ -3018,7 +3018,6 @@ s3_in(uint16_t addr, void *p) } } else return svga->crtc[0x6b]; - break; case 0x6c: if (s3->chip != S3_TRIO64V2) { if (svga->crtc[0x53] & 0x08) { @@ -3027,7 +3026,6 @@ s3_in(uint16_t addr, void *p) return (svga->crtc[0x5a] & 0x80); } else return svga->crtc[0x6c]; - break; } return svga->crtc[svga->crtcreg]; } @@ -3037,7 +3035,7 @@ s3_in(uint16_t addr, void *p) static void s3_recalctimings(svga_t *svga) { - s3_t *s3 = (s3_t *) svga->p; + s3_t *s3 = (s3_t *) svga->priv; int clk_sel = (svga->miscout >> 2) & 3; if (!svga->scrblank && svga->attr_palette_enable) { @@ -3348,7 +3346,7 @@ s3_recalctimings(svga_t *svga) static void s3_trio64v_recalctimings(svga_t *svga) { - s3_t *s3 = (s3_t *) svga->p; + s3_t *s3 = (s3_t *) svga->priv; int clk_sel = (svga->miscout >> 2) & 3; if (!svga->scrblank && svga->attr_palette_enable) { @@ -3582,9 +3580,9 @@ s3_updatemapping(s3_t *s3) } static float -s3_trio64_getclock(int clock, void *p) +s3_trio64_getclock(int clock, void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; svga_t *svga = &s3->svga; float t; int m; @@ -3602,9 +3600,9 @@ s3_trio64_getclock(int clock, void *p) } static void -s3_accel_out(uint16_t port, uint8_t val, void *p) +s3_accel_out(uint16_t port, uint8_t val, void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; svga_t *svga = &s3->svga; if (port >= 0x8000) { @@ -3650,9 +3648,9 @@ s3_accel_out(uint16_t port, uint8_t val, void *p) } static void -s3_accel_out_w(uint16_t port, uint16_t val, void *p) +s3_accel_out_w(uint16_t port, uint16_t val, void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; if (!s3->enable_8514) return; @@ -3664,9 +3662,9 @@ s3_accel_out_w(uint16_t port, uint16_t val, void *p) } static void -s3_accel_out_l(uint16_t port, uint32_t val, void *p) +s3_accel_out_l(uint16_t port, uint32_t val, void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; if (!s3->enable_8514) return; @@ -3678,9 +3676,9 @@ s3_accel_out_l(uint16_t port, uint32_t val, void *p) } static uint8_t -s3_accel_in(uint16_t port, void *p) +s3_accel_in(uint16_t port, void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; svga_t *svga = &s3->svga; int temp; @@ -4262,9 +4260,9 @@ s3_accel_in(uint16_t port, void *p) } static uint16_t -s3_accel_in_w(uint16_t port, void *p) +s3_accel_in_w(uint16_t port, void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; svga_t *svga = &s3->svga; uint16_t temp = 0x0000; uint16_t *vram_w = (uint16_t *) svga->vram; @@ -4318,9 +4316,9 @@ s3_accel_in_w(uint16_t port, void *p) } static uint32_t -s3_accel_in_l(uint16_t port, void *p) +s3_accel_in_l(UNUSED(uint16_t port), void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; svga_t *svga = &s3->svga; uint32_t temp = 0x00000000; uint16_t *vram_w = (uint16_t *) svga->vram; @@ -4371,9 +4369,9 @@ s3_accel_in_l(uint16_t port, void *p) } static void -s3_accel_write(uint32_t addr, uint8_t val, void *p) +s3_accel_write(uint32_t addr, uint8_t val, void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; svga_t *svga = &s3->svga; if (!s3->enable_8514) @@ -4389,9 +4387,9 @@ s3_accel_write(uint32_t addr, uint8_t val, void *p) } static void -s3_accel_write_w(uint32_t addr, uint16_t val, void *p) +s3_accel_write_w(uint32_t addr, uint16_t val, void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; svga_t *svga = &s3->svga; if (!s3->enable_8514) @@ -4407,9 +4405,9 @@ s3_accel_write_w(uint32_t addr, uint16_t val, void *p) } static void -s3_accel_write_l(uint32_t addr, uint32_t val, void *p) +s3_accel_write_l(uint32_t addr, uint32_t val, void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; svga_t *svga = &s3->svga; if (!s3->enable_8514) @@ -4425,9 +4423,9 @@ s3_accel_write_l(uint32_t addr, uint32_t val, void *p) } static uint8_t -s3_accel_read(uint32_t addr, void *p) +s3_accel_read(uint32_t addr, void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; svga_t *svga = &s3->svga; uint8_t temp = 0x00; @@ -4492,12 +4490,12 @@ s3_accel_read(uint32_t addr, void *p) case 0x8505: return s3->subsys_cntl; default: - return s3_accel_in(addr & 0xffff, p); + return s3_accel_in(addr & 0xffff, priv); } return 0xff; } else { if (addr & 0x8000) { - temp = s3_accel_in(addr & 0xffff, p); + temp = s3_accel_in(addr & 0xffff, priv); } else if (s3_cpu_dest(s3)) { READ_PIXTRANS_BYTE_MM @@ -4528,9 +4526,9 @@ s3_accel_read(uint32_t addr, void *p) } static uint16_t -s3_accel_read_w(uint32_t addr, void *p) +s3_accel_read_w(uint32_t addr, void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; svga_t *svga = &s3->svga; uint16_t temp = 0x0000; uint16_t *vram_w = (uint16_t *) svga->vram; @@ -4546,7 +4544,7 @@ s3_accel_read_w(uint32_t addr, void *p) return s3->accel.short_stroke; default: - return s3_accel_read(addr, p) | s3_accel_read(addr + 1, p) << 8; + return s3_accel_read(addr, priv) | s3_accel_read(addr + 1, priv) << 8; } return 0xffff; } else { @@ -4556,8 +4554,8 @@ s3_accel_read_w(uint32_t addr, void *p) s3_wait_fifo_idle(s3); temp = s3->accel.short_stroke; } else { - temp = s3_accel_read((addr & 0xfffe), p); - temp |= s3_accel_read((addr & 0xfffe) + 1, p) << 8; + temp = s3_accel_read((addr & 0xfffe), priv); + temp |= s3_accel_read((addr & 0xfffe) + 1, priv) << 8; } } else if (s3_cpu_dest(s3)) { READ_PIXTRANS_WORD @@ -4589,9 +4587,9 @@ s3_accel_read_w(uint32_t addr, void *p) } static uint32_t -s3_accel_read_l(uint32_t addr, void *p) +s3_accel_read_l(uint32_t addr, void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; svga_t *svga = &s3->svga; uint32_t temp = 0x00000000; uint16_t *vram_w = (uint16_t *) svga->vram; @@ -4721,15 +4719,15 @@ s3_accel_read_l(uint32_t addr, void *p) break; default: - temp = s3_accel_read_w(addr, p) | (s3_accel_read_w(addr + 2, p) << 16); + temp = s3_accel_read_w(addr, priv) | (s3_accel_read_w(addr + 2, priv) << 16); break; } } else { if (addr & 0x8000) { - temp = s3_accel_read((addr & 0xfffc), p); - temp |= s3_accel_read((addr & 0xfffc) + 1, p) << 8; - temp |= s3_accel_read((addr & 0xfffc) + 2, p) << 16; - temp |= s3_accel_read((addr & 0xfffc) + 3, p) << 24; + temp = s3_accel_read((addr & 0xfffc), priv); + temp |= s3_accel_read((addr & 0xfffc) + 1, priv) << 8; + temp |= s3_accel_read((addr & 0xfffc) + 2, priv) << 16; + temp |= s3_accel_read((addr & 0xfffc) + 3, priv) << 24; } else if (s3_cpu_dest(s3)) { READ_PIXTRANS_LONG @@ -7319,9 +7317,9 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ } static uint8_t -s3_pci_read(int func, int addr, void *p) +s3_pci_read(UNUSED(int func), int addr, void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; svga_t *svga = &s3->svga; switch (addr) { @@ -7340,7 +7338,6 @@ s3_pci_read(int func, int addr, void *p) return s3->pci_regs[PCI_REG_COMMAND] | 0x80; /*Respond to IO and memory accesses*/ else return s3->pci_regs[PCI_REG_COMMAND]; /*Respond to IO and memory accesses*/ - break; case 0x07: return (s3->chip == S3_TRIO64V2) ? (s3->pci_regs[0x07] & 0x36) : (1 << 1); /*Medium DEVSEL timing*/ @@ -7355,17 +7352,14 @@ s3_pci_read(int func, int addr, void *p) return 0x00; /*Supports VGA interface*/ else return 0x01; - break; case 0x0b: if (s3->chip >= S3_TRIO32 || s3->chip == S3_VISION968 || s3->chip == S3_VISION868) return 0x03; else return 0x00; - break; case 0x0d: return (s3->chip == S3_TRIO64V2) ? (s3->pci_regs[0x0d] & 0xf8) : 0x00; - break; case 0x10: return 0x00; /*Linear frame buffer address*/ @@ -7376,7 +7370,6 @@ s3_pci_read(int func, int addr, void *p) return 0x00; else return (svga->crtc[0x5a] & 0x80); - break; case 0x13: if (svga->crtc[0x53] & 0x08) { @@ -7384,7 +7377,6 @@ s3_pci_read(int func, int addr, void *p) } else { return svga->crtc[0x59]; } - break; case 0x30: return s3->has_bios ? (s3->pci_regs[0x30] & 0x01) : 0x00; /*BIOS ROM address*/ @@ -7405,15 +7397,14 @@ s3_pci_read(int func, int addr, void *p) break; case 0x3f: return (s3->chip == S3_TRIO64V2) ? 0xff : 0x00; - break; } return 0; } static void -s3_pci_write(int func, int addr, uint8_t val, void *p) +s3_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; svga_t *svga = &s3->svga; switch (addr) { @@ -8565,9 +8556,9 @@ s3_trio64v2_dx_available(void) } static void -s3_close(void *p) +s3_close(void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; s3->fifo_thread_run = 0; thread_set_event(s3->wake_fifo_thread); @@ -8584,17 +8575,17 @@ s3_close(void *p) } static void -s3_speed_changed(void *p) +s3_speed_changed(void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; svga_recalctimings(&s3->svga); } static void -s3_force_redraw(void *p) +s3_force_redraw(void *priv) { - s3_t *s3 = (s3_t *) p; + s3_t *s3 = (s3_t *) priv; s3->svga.fullchange = s3->svga.monitor->mon_changeframecount; } diff --git a/src/video/vid_s3_virge.c b/src/video/vid_s3_virge.c index 1eb1fa855..7d087503a 100644 --- a/src/video/vid_s3_virge.c +++ b/src/video/vid_s3_virge.c @@ -39,6 +39,7 @@ #include <86box/vid_ddc.h> #include <86box/vid_svga.h> #include <86box/vid_svga_render.h> +#include <86box/plat_unused.h> static int dither[4][4] = { {0, 4, 1, 5}, @@ -307,12 +308,12 @@ static void s3_virge_updatemapping(virge_t *virge); static void s3_virge_bitblt(virge_t *virge, int count, uint32_t cpu_dat); -static uint8_t s3_virge_mmio_read(uint32_t addr, void *p); -static uint16_t s3_virge_mmio_read_w(uint32_t addr, void *p); -static uint32_t s3_virge_mmio_read_l(uint32_t addr, void *p); -static void s3_virge_mmio_write(uint32_t addr, uint8_t val, void *p); -static void s3_virge_mmio_write_w(uint32_t addr, uint16_t val, void *p); -static void s3_virge_mmio_write_l(uint32_t addr, uint32_t val, void *p); +static uint8_t s3_virge_mmio_read(uint32_t addr, void *priv); +static uint16_t s3_virge_mmio_read_w(uint32_t addr, void *rivp); +static uint32_t s3_virge_mmio_read_l(uint32_t addr, void *priv); +static void s3_virge_mmio_write(uint32_t addr, uint8_t val, void *priv); +static void s3_virge_mmio_write_w(uint32_t addr, uint16_t val, void *priv); +static void s3_virge_mmio_write_l(uint32_t addr, uint32_t val, void *priv); enum { CMD_SET_AE = 1, @@ -387,9 +388,9 @@ s3_virge_log(const char *fmt, ...) #endif static void -s3_virge_tri_timer(void *p) +s3_virge_tri_timer(void *priv) { - virge_t *virge = (virge_t *) p; + virge_t *virge = (virge_t *) priv; thread_set_event(virge->wake_render_thread); /*Wake up FIFO thread if moving from idle*/ } @@ -447,9 +448,9 @@ render_thread(void *param) } static void -s3_virge_out(uint16_t addr, uint8_t val, void *p) +s3_virge_out(uint16_t addr, uint8_t val, void *priv) { - virge_t *virge = (virge_t *) p; + virge_t *virge = (virge_t *) priv; svga_t *svga = &virge->svga; uint8_t old; uint32_t cursoraddr; @@ -653,9 +654,9 @@ s3_virge_out(uint16_t addr, uint8_t val, void *p) } static uint8_t -s3_virge_in(uint16_t addr, void *p) +s3_virge_in(uint16_t addr, void *priv) { - virge_t *virge = (virge_t *) p; + virge_t *virge = (virge_t *) priv; svga_t *svga = &virge->svga; uint8_t ret; @@ -760,7 +761,7 @@ s3_virge_in(uint16_t addr, void *p) static void s3_virge_recalctimings(svga_t *svga) { - virge_t *virge = (virge_t *) svga->p; + virge_t *virge = (virge_t *) svga->priv; svga->hdisp = svga->hdisp_old; @@ -988,7 +989,7 @@ s3_virge_updatemapping(virge_t *virge) static void s3_virge_vblank_start(svga_t *svga) { - virge_t *virge = (virge_t *) svga->p; + virge_t *virge = (virge_t *) svga->priv; virge->subsys_stat |= INT_VSY; s3_virge_update_irqs(virge); @@ -1471,9 +1472,9 @@ s3_virge_mmio_fifo_write_l(uint32_t addr, uint32_t val, virge_t *virge) } static uint8_t -s3_virge_mmio_read(uint32_t addr, void *p) +s3_virge_mmio_read(uint32_t addr, void *priv) { - virge_t *virge = (virge_t *) p; + virge_t *virge = (virge_t *) priv; uint8_t ret = 0xff; s3_virge_log("[%04X:%08X]: MMIO ReadB addr = %04x\n", CS, cpu_state.pc, addr & 0xffff); @@ -1555,9 +1556,9 @@ s3_virge_mmio_read(uint32_t addr, void *p) return 0xff; } static uint16_t -s3_virge_mmio_read_w(uint32_t addr, void *p) +s3_virge_mmio_read_w(uint32_t addr, void *priv) { - virge_t *virge = (virge_t *) p; + virge_t *virge = (virge_t *) priv; uint16_t ret = 0xffff; s3_virge_log("[%04X:%08X]: MMIO ReadW addr = %04x\n", CS, cpu_state.pc, addr & 0xfffe); @@ -1584,9 +1585,9 @@ s3_virge_mmio_read_w(uint32_t addr, void *p) } static uint32_t -s3_virge_mmio_read_l(uint32_t addr, void *p) +s3_virge_mmio_read_l(uint32_t addr, void *priv) { - virge_t *virge = (virge_t *) p; + virge_t *virge = (virge_t *) priv; uint32_t ret = 0xffffffff; s3_virge_log("[%04X:%08X]: MMIO ReadL addr = %04x\n", CS, cpu_state.pc, addr & 0xfffc); @@ -1745,9 +1746,9 @@ s3_virge_mmio_read_l(uint32_t addr, void *p) } static void -s3_virge_mmio_write(uint32_t addr, uint8_t val, void *p) +s3_virge_mmio_write(uint32_t addr, uint8_t val, void *priv) { - virge_t *virge = (virge_t *) p; + virge_t *virge = (virge_t *) priv; s3_virge_log("MMIO WriteB addr = %04x, val = %02x\n", addr & 0xffff, val); if (((addr & 0xffff) >= 0x8590) || ((addr & 0xffff) < 0x8000)) { if ((addr & 0xffff) == 0xff20) { @@ -1812,9 +1813,9 @@ s3_virge_mmio_write(uint32_t addr, uint8_t val, void *p) } static void -s3_virge_mmio_write_w(uint32_t addr, uint16_t val, void *p) +s3_virge_mmio_write_w(uint32_t addr, uint16_t val, void *priv) { - virge_t *virge = (virge_t *) p; + virge_t *virge = (virge_t *) priv; s3_virge_log("[%04X:%08X]: MMIO WriteW addr = %04x, val = %04x\n", CS, cpu_state.pc, addr & 0xfffe, val); if (((addr & 0xfffe) >= 0x8590) || ((addr & 0xfffe) < 0x8000)) if ((addr & 0xfffe) == 0xff20) @@ -1830,9 +1831,9 @@ s3_virge_mmio_write_w(uint32_t addr, uint16_t val, void *p) } static void -s3_virge_mmio_write_l(uint32_t addr, uint32_t val, void *p) +s3_virge_mmio_write_l(uint32_t addr, uint32_t val, void *priv) { - virge_t *virge = (virge_t *) p; + virge_t *virge = (virge_t *) priv; svga_t *svga = &virge->svga; s3_virge_log("[%04X:%08X]: MMIO WriteL addr = %04x, val = %04x\n", CS, cpu_state.pc, addr & 0xfffc, val); @@ -3486,7 +3487,7 @@ s3_virge_triangle(virge_t *virge, s3d_t *s3d_tri) static void s3_virge_hwcursor_draw(svga_t *svga, int displine) { - virge_t *virge = (virge_t *) svga->p; + virge_t *virge = (virge_t *) svga->priv; uint16_t dat[2]; int xx; int offset = svga->hwcursor_latch.x - svga->hwcursor_latch.xoff; @@ -3771,7 +3772,7 @@ s3_virge_hwcursor_draw(svga_t *svga, int displine) static void s3_virge_overlay_draw(svga_t *svga, int displine) { - virge_t *virge = (virge_t *) svga->p; + virge_t *virge = (virge_t *) svga->priv; int offset = (virge->streams.sec_x - virge->streams.pri_x) + 1; int h_acc = virge->streams.dda_horiz_accumulator; int r[8]; @@ -3813,9 +3814,9 @@ s3_virge_overlay_draw(svga_t *svga, int displine) } static uint8_t -s3_virge_pci_read(int func, int addr, void *p) +s3_virge_pci_read(UNUSED(int func), int addr, void *priv) { - virge_t *virge = (virge_t *) p; + virge_t *virge = (virge_t *) priv; svga_t *svga = &virge->svga; uint8_t ret = 0; @@ -3975,9 +3976,9 @@ s3_virge_pci_read(int func, int addr, void *p) } static void -s3_virge_pci_write(int func, int addr, uint8_t val, void *p) +s3_virge_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv) { - virge_t *virge = (virge_t *) p; + virge_t *virge = (virge_t *) priv; svga_t *svga = &virge->svga; switch (addr) { case 0x00: @@ -4304,7 +4305,8 @@ s3_virge_init(const device_t *info) case S3_VIRGE_GX: virge->virge_rev = 0x01; - /*FALLTHROUGH*/ + [[fallthrough]]; + default: virge->svga.decode_mask = (4 << 20) - 1; virge->virge_id_high = 0x8a; @@ -4382,9 +4384,9 @@ s3_virge_init(const device_t *info) } static void -s3_virge_close(void *p) +s3_virge_close(void *priv) { - virge_t *virge = (virge_t *) p; + virge_t *virge = (virge_t *) priv; virge->render_thread_run = 0; thread_set_event(virge->wake_render_thread); @@ -4462,17 +4464,17 @@ s3_trio3d2x_available(void) } static void -s3_virge_speed_changed(void *p) +s3_virge_speed_changed(void *priv) { - virge_t *virge = (virge_t *) p; + virge_t *virge = (virge_t *) priv; svga_recalctimings(&virge->svga); } static void -s3_virge_force_redraw(void *p) +s3_virge_force_redraw(void *priv) { - virge_t *virge = (virge_t *) p; + virge_t *virge = (virge_t *) priv; virge->svga.fullchange = changeframecount; } diff --git a/src/video/vid_sdac_ramdac.c b/src/video/vid_sdac_ramdac.c index 1587bf0e0..d68af2bfa 100644 --- a/src/video/vid_sdac_ramdac.c +++ b/src/video/vid_sdac_ramdac.c @@ -243,9 +243,9 @@ sdac_ramdac_in(uint16_t addr, int rs2, void *p, svga_t *svga) } float -sdac_getclock(int clock, void *p) +sdac_getclock(int clock, void *priv) { - sdac_ramdac_t *ramdac = (sdac_ramdac_t *) p; + sdac_ramdac_t *ramdac = (sdac_ramdac_t *) priv; float t; int m; int n1; diff --git a/src/video/vid_sigma.c b/src/video/vid_sigma.c index 148dcc81c..97383bc65 100644 --- a/src/video/vid_sigma.c +++ b/src/video/vid_sigma.c @@ -192,9 +192,9 @@ static video_timings_t timing_sigma = { .type = VIDEO_ISA, .write_b = 8, .write_ static void sigma_recalctimings(sigma_t *cga); static void -sigma_out(uint16_t addr, uint8_t val, void *p) +sigma_out(uint16_t addr, uint8_t val, void *priv) { - sigma_t *sigma = (sigma_t *) p; + sigma_t *sigma = (sigma_t *) priv; uint8_t old; if (addr >= 0x3D0 && addr < 0x3E0) { @@ -260,10 +260,10 @@ sigma_out(uint16_t addr, uint8_t val, void *p) } static uint8_t -sigma_in(uint16_t addr, void *p) +sigma_in(uint16_t addr, void *priv) { uint8_t result = 0xFF; - sigma_t *sigma = (sigma_t *) p; + sigma_t *sigma = (sigma_t *) priv; switch (addr) { case 0x2D0: @@ -332,27 +332,27 @@ sigma_in(uint16_t addr, void *p) } static void -sigma_write(uint32_t addr, uint8_t val, void *p) +sigma_write(uint32_t addr, uint8_t val, void *priv) { - sigma_t *sigma = (sigma_t *) p; + sigma_t *sigma = (sigma_t *) priv; sigma->vram[sigma->plane * 0x8000 + (addr & 0x7fff)] = val; cycles -= 4; } static uint8_t -sigma_read(uint32_t addr, void *p) +sigma_read(uint32_t addr, void *priv) { - sigma_t *sigma = (sigma_t *) p; + sigma_t *sigma = (sigma_t *) priv; cycles -= 4; return sigma->vram[sigma->plane * 0x8000 + (addr & 0x7fff)]; } static void -sigma_bwrite(uint32_t addr, uint8_t val, void *p) +sigma_bwrite(uint32_t addr, uint8_t val, void *priv) { - sigma_t *sigma = (sigma_t *) p; + sigma_t *sigma = (sigma_t *) priv; addr &= 0x3FFF; if ((addr < 0x1800) || sigma->rom_paged || (addr >= 0x2000)) @@ -362,9 +362,9 @@ sigma_bwrite(uint32_t addr, uint8_t val, void *p) } static uint8_t -sigma_bread(uint32_t addr, void *p) +sigma_bread(uint32_t addr, void *priv) { - sigma_t *sigma = (sigma_t *) p; + sigma_t *sigma = (sigma_t *) priv; uint8_t result; addr &= 0x3FFF; @@ -589,9 +589,9 @@ sigma_gfx4col(sigma_t *sigma) } static void -sigma_poll(void *p) +sigma_poll(void *priv) { - sigma_t *sigma = (sigma_t *) p; + sigma_t *sigma = (sigma_t *) priv; int x; int c; int oldvc; @@ -833,18 +833,18 @@ sigma_available(void) } static void -sigma_close(void *p) +sigma_close(void *priv) { - sigma_t *sigma = (sigma_t *) p; + sigma_t *sigma = (sigma_t *) priv; free(sigma->vram); free(sigma); } void -sigma_speed_changed(void *p) +sigma_speed_changed(void *priv) { - sigma_t *sigma = (sigma_t *) p; + sigma_t *sigma = (sigma_t *) priv; sigma_recalctimings(sigma); } diff --git a/src/video/vid_stg_ramdac.c b/src/video/vid_stg_ramdac.c index d235477c9..64dd27def 100644 --- a/src/video/vid_stg_ramdac.c +++ b/src/video/vid_stg_ramdac.c @@ -199,9 +199,9 @@ stg_ramdac_in(uint16_t addr, void *p, svga_t *svga) } float -stg_getclock(int clock, void *p) +stg_getclock(int clock, void *priv) { - stg_ramdac_t *ramdac = (stg_ramdac_t *) p; + stg_ramdac_t *ramdac = (stg_ramdac_t *) priv; float t; int m; int n; diff --git a/src/video/vid_svga.c b/src/video/vid_svga.c index 913a052ff..a491bb5e1 100644 --- a/src/video/vid_svga.c +++ b/src/video/vid_svga.c @@ -108,9 +108,9 @@ svga_set_override(svga_t *svga, int val) } void -svga_out(uint16_t addr, uint8_t val, void *p) +svga_out(uint16_t addr, uint8_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; uint8_t o; uint8_t index; @@ -161,9 +161,9 @@ svga_out(uint16_t addr, uint8_t val, void *p) case 0x3c2: svga->miscout = val; svga->vidclock = val & 4; - io_removehandler(0x03a0, 0x0020, svga->video_in, NULL, NULL, svga->video_out, NULL, NULL, svga->p); + io_removehandler(0x03a0, 0x0020, svga->video_in, NULL, NULL, svga->video_out, NULL, NULL, svga->priv); if (!(val & 1)) - io_sethandler(0x03a0, 0x0020, svga->video_in, NULL, NULL, svga->video_out, NULL, NULL, svga->p); + io_sethandler(0x03a0, 0x0020, svga->video_in, NULL, NULL, svga->video_out, NULL, NULL, svga->priv); svga_recalctimings(svga); break; case 0x3c3: @@ -299,9 +299,9 @@ svga_out(uint16_t addr, uint8_t val, void *p) } uint8_t -svga_in(uint16_t addr, void *p) +svga_in(uint16_t addr, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; uint8_t index; uint8_t ret = 0xff; @@ -693,9 +693,9 @@ svga_do_render(svga_t *svga) } void -svga_poll(void *p) +svga_poll(void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; ibm8514_t *dev = &svga->dev8514; uint32_t x; uint32_t blink_delay; @@ -982,16 +982,16 @@ svga_poll(void *p) } int -svga_init(const device_t *info, svga_t *svga, void *p, int memsize, +svga_init(const device_t *info, svga_t *svga, void *priv, int memsize, void (*recalctimings_ex)(struct svga_t *svga), - uint8_t (*video_in)(uint16_t addr, void *p), - void (*video_out)(uint16_t addr, uint8_t val, void *p), + uint8_t (*video_in)(uint16_t addr, void *priv), + void (*video_out)(uint16_t addr, uint8_t val, void *priv), void (*hwcursor_draw)(struct svga_t *svga, int displine), void (*overlay_draw)(struct svga_t *svga, int displine)) { int e; - svga->p = p; + svga->priv = priv; svga->monitor_index = monitor_index_global; svga->monitor = &monitors[svga->monitor_index]; @@ -1119,9 +1119,9 @@ svga_decode_addr(svga_t *svga, uint32_t addr, int write) } static __inline void -svga_write_common(uint32_t addr, uint8_t val, uint8_t linear, void *p) +svga_write_common(uint32_t addr, uint8_t val, uint8_t linear, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; int writemask2 = svga->writemask; int reset_wm = 0; @@ -1197,7 +1197,7 @@ svga_write_common(uint32_t addr, uint8_t val, uint8_t linear, void *p) addr &= svga->decode_mask; if (svga->translate_address) - addr = svga->translate_address(addr, p); + addr = svga->translate_address(addr, priv); if (addr >= svga->vram_max) return; @@ -1332,9 +1332,9 @@ svga_write_common(uint32_t addr, uint8_t val, uint8_t linear, void *p) } static __inline uint8_t -svga_read_common(uint32_t addr, uint8_t linear, void *p) +svga_read_common(uint32_t addr, uint8_t linear, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; uint32_t latch_addr = 0; int readplane = svga->readplane; uint8_t count; @@ -1386,7 +1386,7 @@ svga_read_common(uint32_t addr, uint8_t linear, void *p) else if ((svga->chain4 && (svga->packed_chain4 || svga->force_old_addr)) || svga->fb_only) { addr &= svga->decode_mask; if (svga->translate_address) - addr = svga->translate_address(addr, p); + addr = svga->translate_address(addr, priv); if (addr >= svga->vram_max) return 0xff; latch_addr = (addr & svga->vram_mask) & ~3; @@ -1418,8 +1418,8 @@ svga_read_common(uint32_t addr, uint8_t linear, void *p) addr &= svga->decode_mask; if (svga->translate_address) { - latch_addr = svga->translate_address(latch_addr, p); - addr = svga->translate_address(addr, p); + latch_addr = svga->translate_address(latch_addr, priv); + addr = svga->translate_address(addr, priv); } /* standard VGA latched access */ @@ -1459,27 +1459,27 @@ svga_read_common(uint32_t addr, uint8_t linear, void *p) } void -svga_write(uint32_t addr, uint8_t val, void *p) +svga_write(uint32_t addr, uint8_t val, void *priv) { - svga_write_common(addr, val, 0, p); + svga_write_common(addr, val, 0, priv); } void -svga_write_linear(uint32_t addr, uint8_t val, void *p) +svga_write_linear(uint32_t addr, uint8_t val, void *priv) { - svga_write_common(addr, val, 1, p); + svga_write_common(addr, val, 1, priv); } uint8_t -svga_read(uint32_t addr, void *p) +svga_read(uint32_t addr, void *priv) { - return svga_read_common(addr, 0, p); + return svga_read_common(addr, 0, priv); } uint8_t -svga_read_linear(uint32_t addr, void *p) +svga_read_linear(uint32_t addr, void *priv) { - return svga_read_common(addr, 1, p); + return svga_read_common(addr, 1, priv); } void @@ -1570,12 +1570,12 @@ svga_doblit(int wx, int wy, svga_t *svga) } void -svga_writeb_linear(uint32_t addr, uint8_t val, void *p) +svga_writeb_linear(uint32_t addr, uint8_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; if (!svga->fast) { - svga_write_linear(addr, val, p); + svga_write_linear(addr, val, priv); return; } @@ -1588,13 +1588,13 @@ svga_writeb_linear(uint32_t addr, uint8_t val, void *p) } void -svga_writew_common(uint32_t addr, uint16_t val, uint8_t linear, void *p) +svga_writew_common(uint32_t addr, uint16_t val, uint8_t linear, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; if (!svga->fast) { - svga_write_common(addr, val, linear, p); - svga_write_common(addr + 1, val >> 8, linear, p); + svga_write_common(addr, val, linear, priv); + svga_write_common(addr + 1, val >> 8, linear, priv); return; } @@ -1609,12 +1609,12 @@ svga_writew_common(uint32_t addr, uint16_t val, uint8_t linear, void *p) addr &= svga->decode_mask; if (svga->translate_address) { - uint32_t addr2 = svga->translate_address(addr, p); + uint32_t addr2 = svga->translate_address(addr, priv); if (addr2 < svga->vram_max) { svga->vram[addr2 & svga->vram_mask] = val & 0xff; svga->changedvram[addr2 >> 12] = svga->monitor->mon_changeframecount; } - addr2 = svga->translate_address(addr + 1, p); + addr2 = svga->translate_address(addr + 1, priv); if (addr2 < svga->vram_max) { svga->vram[addr2 & svga->vram_mask] = (val >> 8) & 0xff; svga->changedvram[addr2 >> 12] = svga->monitor->mon_changeframecount; @@ -1630,27 +1630,27 @@ svga_writew_common(uint32_t addr, uint16_t val, uint8_t linear, void *p) } void -svga_writew(uint32_t addr, uint16_t val, void *p) +svga_writew(uint32_t addr, uint16_t val, void *priv) { - svga_writew_common(addr, val, 0, p); + svga_writew_common(addr, val, 0, priv); } void -svga_writew_linear(uint32_t addr, uint16_t val, void *p) +svga_writew_linear(uint32_t addr, uint16_t val, void *priv) { - svga_writew_common(addr, val, 1, p); + svga_writew_common(addr, val, 1, priv); } void -svga_writel_common(uint32_t addr, uint32_t val, uint8_t linear, void *p) +svga_writel_common(uint32_t addr, uint32_t val, uint8_t linear, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; if (!svga->fast) { - svga_write_common(addr, val, linear, p); - svga_write_common(addr + 1, val >> 8, linear, p); - svga_write_common(addr + 2, val >> 16, linear, p); - svga_write_common(addr + 3, val >> 24, linear, p); + svga_write_common(addr, val, linear, priv); + svga_write_common(addr + 1, val >> 8, linear, priv); + svga_write_common(addr + 2, val >> 16, linear, priv); + svga_write_common(addr + 3, val >> 24, linear, priv); return; } @@ -1665,22 +1665,22 @@ svga_writel_common(uint32_t addr, uint32_t val, uint8_t linear, void *p) addr &= svga->decode_mask; if (svga->translate_address) { - uint32_t addr2 = svga->translate_address(addr, p); + uint32_t addr2 = svga->translate_address(addr, priv); if (addr2 < svga->vram_max) { svga->vram[addr2 & svga->vram_mask] = val & 0xff; svga->changedvram[addr2 >> 12] = svga->monitor->mon_changeframecount; } - addr2 = svga->translate_address(addr + 1, p); + addr2 = svga->translate_address(addr + 1, priv); if (addr2 < svga->vram_max) { svga->vram[addr2 & svga->vram_mask] = (val >> 8) & 0xff; svga->changedvram[addr2 >> 12] = svga->monitor->mon_changeframecount; } - addr2 = svga->translate_address(addr + 2, p); + addr2 = svga->translate_address(addr + 2, priv); if (addr2 < svga->vram_max) { svga->vram[addr2 & svga->vram_mask] = (val >> 16) & 0xff; svga->changedvram[addr2 >> 12] = svga->monitor->mon_changeframecount; } - addr2 = svga->translate_address(addr + 3, p); + addr2 = svga->translate_address(addr + 3, priv); if (addr2 < svga->vram_max) { svga->vram[addr2 & svga->vram_mask] = (val >> 24) & 0xff; svga->changedvram[addr2 >> 12] = svga->monitor->mon_changeframecount; @@ -1696,24 +1696,24 @@ svga_writel_common(uint32_t addr, uint32_t val, uint8_t linear, void *p) } void -svga_writel(uint32_t addr, uint32_t val, void *p) +svga_writel(uint32_t addr, uint32_t val, void *priv) { - svga_writel_common(addr, val, 0, p); + svga_writel_common(addr, val, 0, priv); } void -svga_writel_linear(uint32_t addr, uint32_t val, void *p) +svga_writel_linear(uint32_t addr, uint32_t val, void *priv) { - svga_writel_common(addr, val, 1, p); + svga_writel_common(addr, val, 1, priv); } uint8_t -svga_readb_linear(uint32_t addr, void *p) +svga_readb_linear(uint32_t addr, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; if (!svga->fast) - return svga_read_linear(addr, p); + return svga_read_linear(addr, priv); addr &= svga->decode_mask; if (addr >= svga->vram_max) @@ -1723,12 +1723,12 @@ svga_readb_linear(uint32_t addr, void *p) } uint16_t -svga_readw_common(uint32_t addr, uint8_t linear, void *p) +svga_readw_common(uint32_t addr, uint8_t linear, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; if (!svga->fast) - return svga_read_common(addr, linear, p) | (svga_read_common(addr + 1, linear, p) << 8); + return svga_read_common(addr, linear, priv) | (svga_read_common(addr + 1, linear, priv) << 8); cycles -= svga->monitor->mon_video_timing_read_w; @@ -1743,10 +1743,10 @@ svga_readw_common(uint32_t addr, uint8_t linear, void *p) if (svga->translate_address) { uint8_t val1 = 0xff; uint8_t val2 = 0xff; - uint32_t addr2 = svga->translate_address(addr, p); + uint32_t addr2 = svga->translate_address(addr, priv); if (addr2 < svga->vram_max) val1 = svga->vram[addr2 & svga->vram_mask]; - addr2 = svga->translate_address(addr + 1, p); + addr2 = svga->translate_address(addr + 1, priv); if (addr2 < svga->vram_max) val2 = svga->vram[addr2 & svga->vram_mask]; return (val2 << 8) | val1; @@ -1758,24 +1758,24 @@ svga_readw_common(uint32_t addr, uint8_t linear, void *p) } uint16_t -svga_readw(uint32_t addr, void *p) +svga_readw(uint32_t addr, void *priv) { - return svga_readw_common(addr, 0, p); + return svga_readw_common(addr, 0, priv); } uint16_t -svga_readw_linear(uint32_t addr, void *p) +svga_readw_linear(uint32_t addr, void *priv) { - return svga_readw_common(addr, 1, p); + return svga_readw_common(addr, 1, priv); } uint32_t -svga_readl_common(uint32_t addr, uint8_t linear, void *p) +svga_readl_common(uint32_t addr, uint8_t linear, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; if (!svga->fast) { - return svga_read_common(addr, linear, p) | (svga_read_common(addr + 1, linear, p) << 8) | (svga_read_common(addr + 2, linear, p) << 16) | (svga_read_common(addr + 3, linear, p) << 24); + return svga_read_common(addr, linear, priv) | (svga_read_common(addr + 1, linear, priv) << 8) | (svga_read_common(addr + 2, linear, priv) << 16) | (svga_read_common(addr + 3, linear, priv) << 24); } cycles -= svga->monitor->mon_video_timing_read_l; @@ -1793,16 +1793,16 @@ svga_readl_common(uint32_t addr, uint8_t linear, void *p) uint8_t val2 = 0xff; uint8_t val3 = 0xff; uint8_t val4 = 0xff; - uint32_t addr2 = svga->translate_address(addr, p); + uint32_t addr2 = svga->translate_address(addr, priv); if (addr2 < svga->vram_max) val1 = svga->vram[addr2 & svga->vram_mask]; - addr2 = svga->translate_address(addr + 1, p); + addr2 = svga->translate_address(addr + 1, priv); if (addr2 < svga->vram_max) val2 = svga->vram[addr2 & svga->vram_mask]; - addr2 = svga->translate_address(addr + 2, p); + addr2 = svga->translate_address(addr + 2, priv); if (addr2 < svga->vram_max) val3 = svga->vram[addr2 & svga->vram_mask]; - addr2 = svga->translate_address(addr + 3, p); + addr2 = svga->translate_address(addr + 3, priv); if (addr2 < svga->vram_max) val4 = svga->vram[addr2 & svga->vram_mask]; return (val4 << 24) | (val3 << 16) | (val2 << 8) | val1; @@ -1814,13 +1814,13 @@ svga_readl_common(uint32_t addr, uint8_t linear, void *p) } uint32_t -svga_readl(uint32_t addr, void *p) +svga_readl(uint32_t addr, void *priv) { - return svga_readl_common(addr, 0, p); + return svga_readl_common(addr, 0, priv); } uint32_t -svga_readl_linear(uint32_t addr, void *p) +svga_readl_linear(uint32_t addr, void *priv) { - return svga_readl_common(addr, 1, p); + return svga_readl_common(addr, 1, priv); } diff --git a/src/video/vid_tgui9440.c b/src/video/vid_tgui9440.c index fc191b249..f659f90fe 100644 --- a/src/video/vid_tgui9440.c +++ b/src/video/vid_tgui9440.c @@ -169,17 +169,17 @@ typedef struct tgui_t { video_timings_t timing_tgui_vlb = { .type = VIDEO_BUS, .write_b = 4, .write_w = 8, .write_l = 16, .read_b = 4, .read_w = 8, .read_l = 16 }; video_timings_t timing_tgui_pci = { .type = VIDEO_PCI, .write_b = 4, .write_w = 8, .write_l = 16, .read_b = 4, .read_w = 8, .read_l = 16 }; -static void tgui_out(uint16_t addr, uint8_t val, void *p); -static uint8_t tgui_in(uint16_t addr, void *p); +static void tgui_out(uint16_t addr, uint8_t val, void *priv); +static uint8_t tgui_in(uint16_t addr, void *priv); static void tgui_recalcmapping(tgui_t *tgui); -static void tgui_accel_out(uint16_t addr, uint8_t val, void *p); -static void tgui_accel_out_w(uint16_t addr, uint16_t val, void *p); -static void tgui_accel_out_l(uint16_t addr, uint32_t val, void *p); -static uint8_t tgui_accel_in(uint16_t addr, void *p); -static uint16_t tgui_accel_in_w(uint16_t addr, void *p); -static uint32_t tgui_accel_in_l(uint16_t addr, void *p); +static void tgui_accel_out(uint16_t addr, uint8_t val, void *priv); +static void tgui_accel_out_w(uint16_t addr, uint16_t val, void *priv); +static void tgui_accel_out_l(uint16_t addr, uint32_t val, void *priv); +static uint8_t tgui_accel_in(uint16_t addr, void *priv); +static uint16_t tgui_accel_in_w(uint16_t addr, void *priv); +static uint32_t tgui_accel_in_l(uint16_t addr, void *priv); static uint8_t tgui_accel_read(uint32_t addr, void *priv); static uint16_t tgui_accel_read_w(uint32_t addr, void *priv); @@ -193,15 +193,15 @@ static void tgui_accel_write_fb_b(uint32_t addr, uint8_t val, void *priv); static void tgui_accel_write_fb_w(uint32_t addr, uint16_t val, void *priv); static void tgui_accel_write_fb_l(uint32_t addr, uint32_t val, void *priv); -static uint8_t tgui_ext_linear_read(uint32_t addr, void *p); -static void tgui_ext_linear_write(uint32_t addr, uint8_t val, void *p); -static void tgui_ext_linear_writew(uint32_t addr, uint16_t val, void *p); -static void tgui_ext_linear_writel(uint32_t addr, uint32_t val, void *p); +static uint8_t tgui_ext_linear_read(uint32_t addr, void *priv); +static void tgui_ext_linear_write(uint32_t addr, uint8_t val, void *priv); +static void tgui_ext_linear_writew(uint32_t addr, uint16_t val, void *priv); +static void tgui_ext_linear_writel(uint32_t addr, uint32_t val, void *priv); -static uint8_t tgui_ext_read(uint32_t addr, void *p); -static void tgui_ext_write(uint32_t addr, uint8_t val, void *p); -static void tgui_ext_writew(uint32_t addr, uint16_t val, void *p); -static void tgui_ext_writel(uint32_t addr, uint32_t val, void *p); +static uint8_t tgui_ext_read(uint32_t addr, void *priv); +static void tgui_ext_write(uint32_t addr, uint8_t val, void *priv); +static void tgui_ext_writew(uint32_t addr, uint16_t val, void *priv); +static void tgui_ext_writel(uint32_t addr, uint32_t val, void *priv); /*Remap address for chain-4/doubleword style layout*/ static __inline uint32_t @@ -289,9 +289,9 @@ tgui_set_io(tgui_t *tgui) } static void -tgui_out(uint16_t addr, uint8_t val, void *p) +tgui_out(uint16_t addr, uint8_t val, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; svga_t *svga = &tgui->svga; uint8_t old; @@ -531,9 +531,9 @@ tgui_out(uint16_t addr, uint8_t val, void *p) } static uint8_t -tgui_in(uint16_t addr, void *p) +tgui_in(uint16_t addr, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; svga_t *svga = &tgui->svga; uint8_t temp; @@ -624,7 +624,7 @@ tgui_in(uint16_t addr, void *p) void tgui_recalctimings(svga_t *svga) { - tgui_t *tgui = (tgui_t *) svga->p; + tgui_t *tgui = (tgui_t *) svga->priv; uint8_t ger22lower = tgui->accel.ger22 & 0xff; uint8_t ger22upper = (tgui->accel.ger22 >> 8); @@ -927,9 +927,9 @@ tgui_hwcursor_draw(svga_t *svga, int displine) } uint8_t -tgui_pci_read(int func, int addr, void *p) +tgui_pci_read(int func, int addr, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; switch (addr) { case 0x00: @@ -994,9 +994,9 @@ tgui_pci_read(int func, int addr, void *p) } void -tgui_pci_write(int func, int addr, uint8_t val, void *p) +tgui_pci_write(int func, int addr, uint8_t val, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; svga_t *svga = &tgui->svga; switch (addr) { @@ -1064,10 +1064,10 @@ tgui_pci_write(int func, int addr, uint8_t val, void *p) } static uint8_t -tgui_ext_linear_read(uint32_t addr, void *p) +tgui_ext_linear_read(uint32_t addr, void *priv) { - svga_t *svga = (svga_t *) p; - tgui_t *tgui = (tgui_t *) svga->p; + svga_t *svga = (svga_t *) priv; + tgui_t *tgui = (tgui_t *) svga->priv; cycles -= video_timing_read_b; @@ -1087,9 +1087,9 @@ tgui_ext_linear_read(uint32_t addr, void *p) } static uint8_t -tgui_ext_read(uint32_t addr, void *p) +tgui_ext_read(uint32_t addr, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; addr = (addr & svga->banked_mask) + svga->read_bank; @@ -1097,10 +1097,10 @@ tgui_ext_read(uint32_t addr, void *p) } static void -tgui_ext_linear_write(uint32_t addr, uint8_t val, void *p) +tgui_ext_linear_write(uint32_t addr, uint8_t val, void *priv) { - svga_t *svga = (svga_t *) p; - tgui_t *tgui = (tgui_t *) svga->p; + svga_t *svga = (svga_t *) priv; + tgui_t *tgui = (tgui_t *) svga->priv; int c; uint8_t fg[2] = { tgui->ext_gdc_regs[4], tgui->ext_gdc_regs[5] }; uint8_t bg[2] = { tgui->ext_gdc_regs[1], tgui->ext_gdc_regs[2] }; @@ -1171,10 +1171,10 @@ tgui_ext_linear_write(uint32_t addr, uint8_t val, void *p) } static void -tgui_ext_linear_writew(uint32_t addr, uint16_t val, void *p) +tgui_ext_linear_writew(uint32_t addr, uint16_t val, void *priv) { - svga_t *svga = (svga_t *) p; - tgui_t *tgui = (tgui_t *) svga->p; + svga_t *svga = (svga_t *) priv; + tgui_t *tgui = (tgui_t *) svga->priv; int c; uint8_t fg[2] = { tgui->ext_gdc_regs[4], tgui->ext_gdc_regs[5] }; uint8_t bg[2] = { tgui->ext_gdc_regs[1], tgui->ext_gdc_regs[2] }; @@ -1247,33 +1247,33 @@ tgui_ext_linear_writew(uint32_t addr, uint16_t val, void *p) } static void -tgui_ext_linear_writel(uint32_t addr, uint32_t val, void *p) +tgui_ext_linear_writel(uint32_t addr, uint32_t val, void *priv) { - tgui_ext_linear_writew(addr, val, p); + tgui_ext_linear_writew(addr, val, priv); } static void -tgui_ext_write(uint32_t addr, uint8_t val, void *p) +tgui_ext_write(uint32_t addr, uint8_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; addr = (addr & svga->banked_mask) + svga->read_bank; tgui_ext_linear_write(addr, val, svga); } static void -tgui_ext_writew(uint32_t addr, uint16_t val, void *p) +tgui_ext_writew(uint32_t addr, uint16_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; addr = (addr & svga->banked_mask) + svga->read_bank; tgui_ext_linear_writew(addr, val, svga); } static void -tgui_ext_writel(uint32_t addr, uint32_t val, void *p) +tgui_ext_writel(uint32_t addr, uint32_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; addr = (addr & svga->banked_mask) + svga->read_bank; @@ -1995,9 +1995,9 @@ tgui_accel_command(int count, uint32_t cpu_dat, tgui_t *tgui) } static void -tgui_accel_out(uint16_t addr, uint8_t val, void *p) +tgui_accel_out(uint16_t addr, uint8_t val, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; switch (addr) { case 0x2122: @@ -2339,17 +2339,17 @@ tgui_accel_out(uint16_t addr, uint8_t val, void *p) } static void -tgui_accel_out_w(uint16_t addr, uint16_t val, void *p) +tgui_accel_out_w(uint16_t addr, uint16_t val, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; tgui_accel_out(addr, val, tgui); tgui_accel_out(addr + 1, val >> 8, tgui); } static void -tgui_accel_out_l(uint16_t addr, uint32_t val, void *p) +tgui_accel_out_l(uint16_t addr, uint32_t val, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; switch (addr) { case 0x2124: /*Long version of Command and ROP together*/ @@ -2369,9 +2369,9 @@ tgui_accel_out_l(uint16_t addr, uint32_t val, void *p) } static uint8_t -tgui_accel_in(uint16_t addr, void *p) +tgui_accel_in(uint16_t addr, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; switch (addr) { case 0x2120: /*Status*/ @@ -2622,23 +2622,23 @@ tgui_accel_in(uint16_t addr, void *p) } static uint16_t -tgui_accel_in_w(uint16_t addr, void *p) +tgui_accel_in_w(uint16_t addr, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; return tgui_accel_in(addr, tgui) | (tgui_accel_in(addr + 1, tgui) << 8); } static uint32_t -tgui_accel_in_l(uint16_t addr, void *p) +tgui_accel_in_l(uint16_t addr, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; return tgui_accel_in_w(addr, tgui) | (tgui_accel_in_w(addr + 2, tgui) << 16); } static void -tgui_accel_write(uint32_t addr, uint8_t val, void *p) +tgui_accel_write(uint32_t addr, uint8_t val, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; svga_t *svga = &tgui->svga; if ((svga->crtc[0x36] & 0x03) == 0x02) { @@ -2989,18 +2989,18 @@ tgui_accel_write(uint32_t addr, uint8_t val, void *p) } static void -tgui_accel_write_w(uint32_t addr, uint16_t val, void *p) +tgui_accel_write_w(uint32_t addr, uint16_t val, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; tgui_accel_write(addr, val, tgui); tgui_accel_write(addr + 1, val >> 8, tgui); } static void -tgui_accel_write_l(uint32_t addr, uint32_t val, void *p) +tgui_accel_write_l(uint32_t addr, uint32_t val, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; svga_t *svga = &tgui->svga; switch (addr & 0xff) { @@ -3026,9 +3026,9 @@ tgui_accel_write_l(uint32_t addr, uint32_t val, void *p) } static uint8_t -tgui_accel_read(uint32_t addr, void *p) +tgui_accel_read(uint32_t addr, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; svga_t *svga = &tgui->svga; if ((svga->crtc[0x36] & 0x03) == 0x02) { @@ -3288,24 +3288,26 @@ tgui_accel_read(uint32_t addr, void *p) } static uint16_t -tgui_accel_read_w(uint32_t addr, void *p) +tgui_accel_read_w(uint32_t addr, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; + return tgui_accel_read(addr, tgui) | (tgui_accel_read(addr + 1, tgui) << 8); } static uint32_t -tgui_accel_read_l(uint32_t addr, void *p) +tgui_accel_read_l(uint32_t addr, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; + return tgui_accel_read_w(addr, tgui) | (tgui_accel_read_w(addr + 2, tgui) << 16); } static void -tgui_accel_write_fb_b(uint32_t addr, uint8_t val, void *p) +tgui_accel_write_fb_b(uint32_t addr, uint8_t val, void *priv) { - svga_t *svga = (svga_t *) p; - tgui_t *tgui = (tgui_t *) svga->p; + svga_t *svga = (svga_t *) priv; + tgui_t *tgui = (tgui_t *) svga->priv; if (tgui->write_blitter) { tgui_accel_command(8, val << 24, tgui); @@ -3314,10 +3316,10 @@ tgui_accel_write_fb_b(uint32_t addr, uint8_t val, void *p) } static void -tgui_accel_write_fb_w(uint32_t addr, uint16_t val, void *p) +tgui_accel_write_fb_w(uint32_t addr, uint16_t val, void *priv) { - svga_t *svga = (svga_t *) p; - tgui_t *tgui = (tgui_t *) svga->p; + svga_t *svga = (svga_t *) priv; + tgui_t *tgui = (tgui_t *) svga->priv; if (tgui->write_blitter) tgui_accel_command(16, (((val & 0xff00) >> 8) | ((val & 0x00ff) << 8)) << 16, tgui); @@ -3326,10 +3328,10 @@ tgui_accel_write_fb_w(uint32_t addr, uint16_t val, void *p) } static void -tgui_accel_write_fb_l(uint32_t addr, uint32_t val, void *p) +tgui_accel_write_fb_l(uint32_t addr, uint32_t val, void *priv) { - svga_t *svga = (svga_t *) p; - tgui_t *tgui = (tgui_t *) svga->p; + svga_t *svga = (svga_t *) priv; + tgui_t *tgui = (tgui_t *) svga->priv; if (tgui->write_blitter) tgui_accel_command(32, ((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) | ((val & 0x0000ff00) << 8) | ((val & 0x000000ff) << 24), tgui); @@ -3338,63 +3340,63 @@ tgui_accel_write_fb_l(uint32_t addr, uint32_t val, void *p) } static void -tgui_mmio_write(uint32_t addr, uint8_t val, void *p) +tgui_mmio_write(uint32_t addr, uint8_t val, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; svga_t *svga = &tgui->svga; addr &= 0x0000ffff; if (((svga->crtc[0x36] & 0x03) == 0x00) && (addr >= 0x2100 && addr <= 0x21ff)) - tgui_accel_out(addr, val, p); + tgui_accel_out(addr, val, priv); else if (((svga->crtc[0x36] & 0x03) > 0x00) && (addr <= 0xff)) - tgui_accel_write(addr, val, p); + tgui_accel_write(addr, val, priv); else - tgui_out(addr, val, p); + tgui_out(addr, val, priv); } static void -tgui_mmio_write_w(uint32_t addr, uint16_t val, void *p) +tgui_mmio_write_w(uint32_t addr, uint16_t val, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; svga_t *svga = &tgui->svga; addr &= 0x0000ffff; if (((svga->crtc[0x36] & 0x03) == 0x00) && (addr >= 0x2100 && addr <= 0x21ff)) - tgui_accel_out_w(addr, val, p); + tgui_accel_out_w(addr, val, priv); else if (((svga->crtc[0x36] & 0x03) > 0x00) && (addr <= 0xff)) - tgui_accel_write_w(addr, val, p); + tgui_accel_write_w(addr, val, priv); else { - tgui_out(addr, val & 0xff, p); - tgui_out(addr + 1, val >> 8, p); + tgui_out(addr, val & 0xff, priv); + tgui_out(addr + 1, val >> 8, priv); } } static void -tgui_mmio_write_l(uint32_t addr, uint32_t val, void *p) +tgui_mmio_write_l(uint32_t addr, uint32_t val, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; svga_t *svga = &tgui->svga; addr &= 0x0000ffff; if (((svga->crtc[0x36] & 0x03) == 0x00) && (addr >= 0x2100 && addr <= 0x21ff)) - tgui_accel_out_l(addr, val, p); + tgui_accel_out_l(addr, val, priv); else if (((svga->crtc[0x36] & 0x03) > 0x00) && (addr <= 0xff)) - tgui_accel_write_l(addr, val, p); + tgui_accel_write_l(addr, val, priv); else { - tgui_out(addr, val & 0xff, p); - tgui_out(addr + 1, val >> 8, p); - tgui_out(addr + 2, val >> 16, p); - tgui_out(addr + 3, val >> 24, p); + tgui_out(addr, val & 0xff, priv); + tgui_out(addr + 1, val >> 8, priv); + tgui_out(addr + 2, val >> 16, priv); + tgui_out(addr + 3, val >> 24, priv); } } static uint8_t -tgui_mmio_read(uint32_t addr, void *p) +tgui_mmio_read(uint32_t addr, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; svga_t *svga = &tgui->svga; uint8_t ret = 0xff; @@ -3402,49 +3404,49 @@ tgui_mmio_read(uint32_t addr, void *p) addr &= 0x0000ffff; if (((svga->crtc[0x36] & 0x03) == 0x00) && (addr >= 0x2100 && addr <= 0x21ff)) - ret = tgui_accel_in(addr, p); + ret = tgui_accel_in(addr, priv); else if (((svga->crtc[0x36] & 0x03) > 0x00) && (addr <= 0xff)) - ret = tgui_accel_read(addr, p); + ret = tgui_accel_read(addr, priv); else - ret = tgui_in(addr, p); + ret = tgui_in(addr, priv); return ret; } static uint16_t -tgui_mmio_read_w(uint32_t addr, void *p) +tgui_mmio_read_w(uint32_t addr, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; svga_t *svga = &tgui->svga; uint16_t ret = 0xffff; addr &= 0x0000ffff; if (((svga->crtc[0x36] & 0x03) == 0x00) && (addr >= 0x2100 && addr <= 0x21ff)) - ret = tgui_accel_in_w(addr, p); + ret = tgui_accel_in_w(addr, priv); else if (((svga->crtc[0x36] & 0x03) > 0x00) && (addr <= 0xff)) - ret = tgui_accel_read_w(addr, p); + ret = tgui_accel_read_w(addr, priv); else - ret = tgui_in(addr, p) | (tgui_in(addr + 1, p) << 8); + ret = tgui_in(addr, priv) | (tgui_in(addr + 1, priv) << 8); return ret; } static uint32_t -tgui_mmio_read_l(uint32_t addr, void *p) +tgui_mmio_read_l(uint32_t addr, void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; svga_t *svga = &tgui->svga; uint32_t ret = 0xffffffff; addr &= 0x0000ffff; if (((svga->crtc[0x36] & 0x03) == 0x00) && (addr >= 0x2100 && addr <= 0x21ff)) - ret = tgui_accel_in_l(addr, p); + ret = tgui_accel_in_l(addr, priv); else if (((svga->crtc[0x36] & 0x03) > 0x00) && (addr <= 0xff)) - ret = tgui_accel_read_l(addr, p); + ret = tgui_accel_read_l(addr, priv); else - ret = tgui_in(addr, p) | (tgui_in(addr + 1, p) << 8) | (tgui_in(addr + 2, p) << 16) | (tgui_in(addr + 3, p) << 24); + ret = tgui_in(addr, priv) | (tgui_in(addr + 1, priv) << 8) | (tgui_in(addr + 2, priv) << 16) | (tgui_in(addr + 3, priv) << 24); return ret; } @@ -3556,9 +3558,9 @@ tgui96xx_available(void) } void -tgui_close(void *p) +tgui_close(void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; svga_close(&tgui->svga); @@ -3571,17 +3573,17 @@ tgui_close(void *p) } void -tgui_speed_changed(void *p) +tgui_speed_changed(void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; svga_recalctimings(&tgui->svga); } void -tgui_force_redraw(void *p) +tgui_force_redraw(void *priv) { - tgui_t *tgui = (tgui_t *) p; + tgui_t *tgui = (tgui_t *) priv; tgui->svga.fullchange = changeframecount; } diff --git a/src/video/vid_tvga.c b/src/video/vid_tvga.c index 5cac5fb06..8483bbd33 100644 --- a/src/video/vid_tvga.c +++ b/src/video/vid_tvga.c @@ -74,9 +74,9 @@ static uint8_t crtc_mask[0x40] = { static void tvga_recalcbanking(tvga_t *tvga); void -tvga_out(uint16_t addr, uint8_t val, void *p) +tvga_out(uint16_t addr, uint8_t val, void *priv) { - tvga_t *tvga = (tvga_t *) p; + tvga_t *tvga = (tvga_t *) priv; svga_t *svga = &tvga->svga; uint8_t old; @@ -199,9 +199,9 @@ tvga_out(uint16_t addr, uint8_t val, void *p) } uint8_t -tvga_in(uint16_t addr, void *p) +tvga_in(uint16_t addr, void *priv) { - tvga_t *tvga = (tvga_t *) p; + tvga_t *tvga = (tvga_t *) priv; svga_t *svga = &tvga->svga; if (((addr & 0xFFF0) == 0x3D0 || (addr & 0xFFF0) == 0x3B0) && !(svga->miscout & 1)) @@ -261,7 +261,7 @@ tvga_recalcbanking(tvga_t *tvga) void tvga_recalctimings(svga_t *svga) { - tvga_t *tvga = (tvga_t *) svga->p; + tvga_t *tvga = (tvga_t *) svga->priv; int clksel; int high_res_256 = 0; @@ -458,9 +458,9 @@ tvga9000b_nec_sv9000_available(void) } void -tvga_close(void *p) +tvga_close(void *priv) { - tvga_t *tvga = (tvga_t *) p; + tvga_t *tvga = (tvga_t *) priv; svga_close(&tvga->svga); @@ -468,17 +468,17 @@ tvga_close(void *p) } void -tvga_speed_changed(void *p) +tvga_speed_changed(void *priv) { - tvga_t *tvga = (tvga_t *) p; + tvga_t *tvga = (tvga_t *) priv; svga_recalctimings(&tvga->svga); } void -tvga_force_redraw(void *p) +tvga_force_redraw(void *priv) { - tvga_t *tvga = (tvga_t *) p; + tvga_t *tvga = (tvga_t *) priv; tvga->svga.fullchange = changeframecount; } diff --git a/src/video/vid_tvp3026_ramdac.c b/src/video/vid_tvp3026_ramdac.c index 8a59f6e01..da75543ca 100644 --- a/src/video/vid_tvp3026_ramdac.c +++ b/src/video/vid_tvp3026_ramdac.c @@ -550,9 +550,9 @@ tvp3026_hwcursor_draw(svga_t *svga, int displine) } float -tvp3026_getclock(int clock, void *p) +tvp3026_getclock(int clock, void *priv) { - tvp3026_ramdac_t *ramdac = (tvp3026_ramdac_t *) p; + tvp3026_ramdac_t *ramdac = (tvp3026_ramdac_t *) priv; int n; int m; int pl; diff --git a/src/video/vid_vga.c b/src/video/vid_vga.c index ac26c2b5d..cd70a1bc1 100644 --- a/src/video/vid_vga.c +++ b/src/video/vid_vga.c @@ -35,9 +35,9 @@ static video_timings_t timing_ps1_svga_isa = { .type = VIDEO_ISA, .write_b = 6, static video_timings_t timing_ps1_svga_mca = { .type = VIDEO_MCA, .write_b = 6, .write_w = 8, .write_l = 16, .read_b = 6, .read_w = 8, .read_l = 16 }; void -vga_out(uint16_t addr, uint8_t val, void *p) +vga_out(uint16_t addr, uint8_t val, void *priv) { - vga_t *vga = (vga_t *) p; + vga_t *vga = (vga_t *) priv; svga_t *svga = &vga->svga; uint8_t old; @@ -74,9 +74,9 @@ vga_out(uint16_t addr, uint8_t val, void *p) } uint8_t -vga_in(uint16_t addr, void *p) +vga_in(uint16_t addr, void *priv) { - vga_t *vga = (vga_t *) p; + vga_t *vga = (vga_t *) priv; svga_t *svga = &vga->svga; uint8_t temp; @@ -157,9 +157,9 @@ vga_available(void) } void -vga_close(void *p) +vga_close(void *priv) { - vga_t *vga = (vga_t *) p; + vga_t *vga = (vga_t *) priv; svga_close(&vga->svga); @@ -167,17 +167,17 @@ vga_close(void *p) } void -vga_speed_changed(void *p) +vga_speed_changed(void *priv) { - vga_t *vga = (vga_t *) p; + vga_t *vga = (vga_t *) priv; svga_recalctimings(&vga->svga); } void -vga_force_redraw(void *p) +vga_force_redraw(void *priv) { - vga_t *vga = (vga_t *) p; + vga_t *vga = (vga_t *) priv; vga->svga.fullchange = changeframecount; } diff --git a/src/video/vid_voodoo.c b/src/video/vid_voodoo.c index 6544246be..610e15e6c 100644 --- a/src/video/vid_voodoo.c +++ b/src/video/vid_voodoo.c @@ -149,9 +149,9 @@ voodoo_recalc(voodoo_t *voodoo) } static uint16_t -voodoo_readw(uint32_t addr, void *p) +voodoo_readw(uint32_t addr, void *priv) { - voodoo_t *voodoo = (voodoo_t *) p; + voodoo_t *voodoo = (voodoo_t *) priv; addr &= 0xffffff; @@ -184,9 +184,9 @@ voodoo_readw(uint32_t addr, void *p) } static uint32_t -voodoo_readl(uint32_t addr, void *p) +voodoo_readl(uint32_t addr, void *priv) { - voodoo_t *voodoo = (voodoo_t *) p; + voodoo_t *voodoo = (voodoo_t *) priv; uint32_t temp = 0xffffffff; int fifo_size; voodoo->rd_count++; @@ -394,9 +394,9 @@ voodoo_readl(uint32_t addr, void *p) } static void -voodoo_writew(uint32_t addr, uint16_t val, void *p) +voodoo_writew(uint32_t addr, uint16_t val, void *priv) { - voodoo_t *voodoo = (voodoo_t *) p; + voodoo_t *voodoo = (voodoo_t *) priv; voodoo->wr_count++; addr &= 0xffffff; @@ -407,9 +407,9 @@ voodoo_writew(uint32_t addr, uint16_t val, void *p) } static void -voodoo_writel(uint32_t addr, uint32_t val, void *p) +voodoo_writel(uint32_t addr, uint32_t val, void *priv) { - voodoo_t *voodoo = (voodoo_t *) p; + voodoo_t *voodoo = (voodoo_t *) priv; voodoo->wr_count++; @@ -670,32 +670,32 @@ voodoo_writel(uint32_t addr, uint32_t val, void *p) } static uint16_t -voodoo_snoop_readw(uint32_t addr, void *p) +voodoo_snoop_readw(uint32_t addr, void *priv) { - voodoo_set_t *set = (voodoo_set_t *) p; + voodoo_set_t *set = (voodoo_set_t *) priv; return voodoo_readw(addr, set->voodoos[0]); } static uint32_t -voodoo_snoop_readl(uint32_t addr, void *p) +voodoo_snoop_readl(uint32_t addr, void *priv) { - voodoo_set_t *set = (voodoo_set_t *) p; + voodoo_set_t *set = (voodoo_set_t *) priv; return voodoo_readl(addr, set->voodoos[0]); } static void -voodoo_snoop_writew(uint32_t addr, uint16_t val, void *p) +voodoo_snoop_writew(uint32_t addr, uint16_t val, void *priv) { - voodoo_set_t *set = (voodoo_set_t *) p; + voodoo_set_t *set = (voodoo_set_t *) priv; voodoo_writew(addr, val, set->voodoos[0]); voodoo_writew(addr, val, set->voodoos[1]); } static void -voodoo_snoop_writel(uint32_t addr, uint32_t val, void *p) +voodoo_snoop_writel(uint32_t addr, uint32_t val, void *priv) { - voodoo_set_t *set = (voodoo_set_t *) p; + voodoo_set_t *set = (voodoo_set_t *) priv; voodoo_writel(addr, val, set->voodoos[0]); voodoo_writel(addr, val, set->voodoos[1]); @@ -747,14 +747,16 @@ voodoo_recalcmapping(voodoo_set_t *set) } uint8_t -voodoo_pci_read(int func, int addr, void *p) +voodoo_pci_read(int func, int addr, void *priv) { - voodoo_t *voodoo = (voodoo_t *) p; + voodoo_t *voodoo = (voodoo_t *) priv; if (func) return 0; - // voodoo_log("Voodoo PCI read %08X PC=%08x\n", addr, cpu_state.pc); +#if 0 + voodoo_log("Voodoo PCI read %08X PC=%08x\n", addr, cpu_state.pc); +#endif switch (addr) { case 0x00: @@ -806,14 +808,16 @@ voodoo_pci_read(int func, int addr, void *p) } void -voodoo_pci_write(int func, int addr, uint8_t val, void *p) +voodoo_pci_write(int func, int addr, uint8_t val, void *priv) { - voodoo_t *voodoo = (voodoo_t *) p; + voodoo_t *voodoo = (voodoo_t *) priv; if (func) return; - // voodoo_log("Voodoo PCI write %04X %02X PC=%08x\n", addr, val, cpu_state.pc); +#if 0 + voodoo_log("Voodoo PCI write %04X %02X PC=%08x\n", addr, val, cpu_state.pc); +#endif switch (addr) { case 0x04: @@ -844,9 +848,9 @@ voodoo_pci_write(int func, int addr, uint8_t val, void *p) } static void -voodoo_speed_changed(void *p) +voodoo_speed_changed(void *priv) { - voodoo_set_t *voodoo_set = (voodoo_set_t *) p; + voodoo_set_t *voodoo_set = (voodoo_set_t *) priv; voodoo_pixelclock_update(voodoo_set->voodoos[0]); voodoo_set->voodoos[0]->read_time = pci_nonburst_time + pci_burst_time * ((voodoo_set->voodoos[0]->fbiInit4 & 1) ? 2 : 1); @@ -858,13 +862,15 @@ voodoo_speed_changed(void *p) voodoo_set->voodoos[1]->write_time = pci_nonburst_time + pci_burst_time * ((voodoo_set->voodoos[1]->fbiInit1 & 2) ? 1 : 0); voodoo_set->voodoos[1]->burst_time = pci_burst_time * ((voodoo_set->voodoos[1]->fbiInit1 & 2) ? 2 : 1); } - // voodoo_log("Voodoo read_time=%i write_time=%i burst_time=%i %08x %08x\n", voodoo->read_time, voodoo->write_time, voodoo->burst_time, voodoo->fbiInit1, voodoo->fbiInit4); +#if 0 + voodoo_log("Voodoo read_time=%i write_time=%i burst_time=%i %08x %08x\n", voodoo->read_time, voodoo->write_time, voodoo->burst_time, voodoo->fbiInit1, voodoo->fbiInit4); +#endif } static void -voodoo_force_blit(void *p) +voodoo_force_blit(void *priv) { - voodoo_set_t *voodoo_set = (voodoo_set_t *) p; + voodoo_set_t *voodoo_set = (voodoo_set_t *) priv; thread_wait_mutex(voodoo_set->voodoos[0]->force_blit_mutex); if (voodoo_set->voodoos[0]->can_blit) { @@ -1261,9 +1267,9 @@ voodoo_card_close(voodoo_t *voodoo) } void -voodoo_close(void *p) +voodoo_close(void *priv) { - voodoo_set_t *voodoo_set = (voodoo_set_t *) p; + voodoo_set_t *voodoo_set = (voodoo_set_t *) priv; if (voodoo_set->nr_cards == 2) voodoo_card_close(voodoo_set->voodoos[1]); diff --git a/src/video/vid_voodoo_banshee.c b/src/video/vid_voodoo_banshee.c index 4fcd6af61..0b3a3a043 100644 --- a/src/video/vid_voodoo_banshee.c +++ b/src/video/vid_voodoo_banshee.c @@ -315,7 +315,7 @@ banshee_update_irqs(banshee_t *banshee) static void banshee_vblank_start(svga_t *svga) { - banshee_t *banshee = (banshee_t *) svga->p; + banshee_t *banshee = (banshee_t *) svga->priv; if (banshee->vblank_irq >= 0) { banshee->vblank_irq = 1; banshee_update_irqs(banshee); @@ -460,7 +460,7 @@ banshee_updatemapping(banshee_t *banshee) static void banshee_render_16bpp_tiled(svga_t *svga) { - banshee_t *banshee = (banshee_t *) svga->p; + banshee_t *banshee = (banshee_t *) svga->priv; uint32_t *p = &((uint32_t *) svga->monitor->target_buffer->line[svga->displine + svga->y_add])[svga->x_add]; uint32_t addr; int drawn = 0; @@ -500,7 +500,7 @@ banshee_render_16bpp_tiled(svga_t *svga) static void banshee_recalctimings(svga_t *svga) { - banshee_t *banshee = (banshee_t *) svga->p; + banshee_t *banshee = (banshee_t *) svga->priv; voodoo_t *voodoo = banshee->voodoo; /*7 R/W Horizontal Retrace End bit 5. - @@ -1981,7 +1981,7 @@ banshee_write_linear_l(uint32_t addr, uint32_t val, void *priv) void banshee_hwcursor_draw(svga_t *svga, int displine) { - banshee_t *banshee = (banshee_t *) svga->p; + banshee_t *banshee = (banshee_t *) svga->priv; int x; int x_off; int xx; @@ -2329,7 +2329,7 @@ voodoo_generate_vb_filters(voodoo_t *voodoo, int fcr, int fcg) static void banshee_overlay_draw(svga_t *svga, int displine) { - banshee_t *banshee = (banshee_t *) svga->p; + banshee_t *banshee = (banshee_t *) svga->priv; voodoo_t *voodoo = banshee->voodoo; uint32_t *p; int x; @@ -2581,7 +2581,7 @@ banshee_set_overlay_addr(void *priv, UNUSED(uint32_t addr)) static void banshee_vsync_callback(svga_t *svga) { - banshee_t *banshee = (banshee_t *) svga->p; + banshee_t *banshee = (banshee_t *) svga->priv; voodoo_t *voodoo = banshee->voodoo; voodoo->retrace_count++; diff --git a/src/video/vid_voodoo_texture.c b/src/video/vid_voodoo_texture.c index d02041d16..8b8f1366d 100644 --- a/src/video/vid_voodoo_texture.c +++ b/src/video/vid_voodoo_texture.c @@ -585,12 +585,12 @@ flush_texture_cache(voodoo_t *voodoo, uint32_t dirty_addr, int tmu) } void -voodoo_tex_writel(uint32_t addr, uint32_t val, void *p) +voodoo_tex_writel(uint32_t addr, uint32_t val, void *priv) { int lod; int s; int t; - voodoo_t *voodoo = (voodoo_t *) p; + voodoo_t *voodoo = (voodoo_t *) priv; int tmu; if (addr & 0x400000) diff --git a/src/video/vid_wy700.c b/src/video/vid_wy700.c index c81a41de8..6695709cc 100644 --- a/src/video/vid_wy700.c +++ b/src/video/vid_wy700.c @@ -216,16 +216,16 @@ static int cgacols[256][2][2]; static int mdacols[256][2][2]; void wy700_recalctimings(wy700_t *wy700); -void wy700_write(uint32_t addr, uint8_t val, void *p); -uint8_t wy700_read(uint32_t addr, void *p); +void wy700_write(uint32_t addr, uint8_t val, void *priv); +uint8_t wy700_read(uint32_t addr, void *priv); void wy700_checkchanges(wy700_t *wy700); static video_timings_t timing_wy700 = { .type = VIDEO_ISA, .write_b = 8, .write_w = 16, .write_l = 32, .read_b = 8, .read_w = 16, .read_l = 32 }; void -wy700_out(uint16_t addr, uint8_t val, void *p) +wy700_out(uint16_t addr, uint8_t val, void *priv) { - wy700_t *wy700 = (wy700_t *) p; + wy700_t *wy700 = (wy700_t *) priv; switch (addr) { /* These three registers are only mapped in the 3Dx range, * not the 3Bx range. */ @@ -287,9 +287,9 @@ wy700_out(uint16_t addr, uint8_t val, void *p) } uint8_t -wy700_in(uint16_t addr, void *p) +wy700_in(uint16_t addr, void *priv) { - wy700_t *wy700 = (wy700_t *) p; + wy700_t *wy700 = (wy700_t *) priv; switch (addr) { case 0x3b0: case 0x3b2: @@ -456,9 +456,9 @@ wy700_checkchanges(wy700_t *wy700) } void -wy700_write(uint32_t addr, uint8_t val, void *p) +wy700_write(uint32_t addr, uint8_t val, void *priv) { - wy700_t *wy700 = (wy700_t *) p; + wy700_t *wy700 = (wy700_t *) priv; if (wy700->wy700_mode & 0x80) /* High-res mode. */ { @@ -475,9 +475,9 @@ wy700_write(uint32_t addr, uint8_t val, void *p) } uint8_t -wy700_read(uint32_t addr, void *p) +wy700_read(uint32_t addr, void *priv) { - wy700_t *wy700 = (wy700_t *) p; + wy700_t *wy700 = (wy700_t *) priv; if (wy700->wy700_mode & 0x80) /* High-res mode. */ { addr &= 0xFFFF; @@ -745,9 +745,9 @@ wy700_hiresline(wy700_t *wy700) } void -wy700_poll(void *p) +wy700_poll(void *priv) { - wy700_t *wy700 = (wy700_t *) p; + wy700_t *wy700 = (wy700_t *) priv; int mode; if (!wy700->linepos) { @@ -959,18 +959,18 @@ wy700_init(const device_t *info) } void -wy700_close(void *p) +wy700_close(void *priv) { - wy700_t *wy700 = (wy700_t *) p; + wy700_t *wy700 = (wy700_t *) priv; free(wy700->vram); free(wy700); } void -wy700_speed_changed(void *p) +wy700_speed_changed(void *priv) { - wy700_t *wy700 = (wy700_t *) p; + wy700_t *wy700 = (wy700_t *) priv; wy700_recalctimings(wy700); } diff --git a/src/video/vid_xga.c b/src/video/vid_xga.c index db1ae0afb..50cfcb90a 100644 --- a/src/video/vid_xga.c +++ b/src/video/vid_xga.c @@ -42,15 +42,15 @@ static video_timings_t timing_xga_isa = { .type = VIDEO_ISA, .write_b = 3, .write_w = 3, .write_l = 6, .read_b = 5, .read_w = 5, .read_l = 10 }; static video_timings_t timing_xga_mca = { .type = VIDEO_MCA, .write_b = 4, .write_w = 5, .write_l = 10, .read_b = 5, .read_w = 5, .read_l = 10 }; -static void xga_ext_outb(uint16_t addr, uint8_t val, void *p); -static uint8_t xga_ext_inb(uint16_t addr, void *p); +static void xga_ext_outb(uint16_t addr, uint8_t val, void *priv); +static uint8_t xga_ext_inb(uint16_t addr, void *priv); int xga_has_vga = 0; void -svga_xga_out(uint16_t addr, uint8_t val, void *p) +svga_xga_out(uint16_t addr, uint8_t val, void *priv) { - svga_t *svga = (svga_t *)p; + svga_t *svga = (svga_t *) priv; uint8_t old; if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) @@ -86,9 +86,9 @@ svga_xga_out(uint16_t addr, uint8_t val, void *p) } uint8_t -svga_xga_in(uint16_t addr, void *p) +svga_xga_in(uint16_t addr, void *priv) { - svga_t *svga = (svga_t *)p; + svga_t *svga = (svga_t *) priv; uint8_t temp; if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1)) @@ -451,9 +451,9 @@ xga_ext_out_reg(xga_t *xga, svga_t *svga, uint8_t idx, uint8_t val) } static void -xga_ext_outb(uint16_t addr, uint8_t val, void *p) +xga_ext_outb(uint16_t addr, uint8_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; //pclog("[%04X:%08X]: EXT OUTB = %02x, val = %02x\n", CS, cpu_state.pc, addr, val); @@ -500,9 +500,9 @@ xga_ext_outb(uint16_t addr, uint8_t val, void *p) } static uint8_t -xga_ext_inb(uint16_t addr, void *p) +xga_ext_inb(uint16_t addr, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; uint8_t ret = 0xff; uint8_t index; @@ -2014,9 +2014,9 @@ exec_command: } static void -xga_memio_writeb(uint32_t addr, uint8_t val, void *p) +xga_memio_writeb(uint32_t addr, uint8_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; xga_mem_write(addr, val, xga, svga, 1); @@ -2024,9 +2024,9 @@ xga_memio_writeb(uint32_t addr, uint8_t val, void *p) } static void -xga_memio_writew(uint32_t addr, uint16_t val, void *p) +xga_memio_writew(uint32_t addr, uint16_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; xga_mem_write(addr, val, xga, svga, 2); @@ -2034,9 +2034,9 @@ xga_memio_writew(uint32_t addr, uint16_t val, void *p) } static void -xga_memio_writel(uint32_t addr, uint32_t val, void *p) +xga_memio_writel(uint32_t addr, uint32_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; xga_mem_write(addr, val, xga, svga, 4); @@ -2125,9 +2125,9 @@ xga_mem_read(uint32_t addr, xga_t *xga, svga_t *svga) } static uint8_t -xga_memio_readb(uint32_t addr, void *p) +xga_memio_readb(uint32_t addr, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; uint8_t temp; @@ -2138,9 +2138,9 @@ xga_memio_readb(uint32_t addr, void *p) } static uint16_t -xga_memio_readw(uint32_t addr, void *p) +xga_memio_readw(uint32_t addr, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; uint16_t temp; @@ -2152,9 +2152,9 @@ xga_memio_readw(uint32_t addr, void *p) } static uint32_t -xga_memio_readl(uint32_t addr, void *p) +xga_memio_readl(uint32_t addr, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; uint32_t temp; @@ -2326,9 +2326,9 @@ xga_render_16bpp(xga_t *xga, svga_t *svga) } static void -xga_write(uint32_t addr, uint8_t val, void *p) +xga_write(uint32_t addr, uint8_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; if (!xga->on) { @@ -2349,34 +2349,34 @@ xga_write(uint32_t addr, uint8_t val, void *p) } static void -xga_writeb(uint32_t addr, uint8_t val, void *p) +xga_writeb(uint32_t addr, uint8_t val, void *priv) { // pclog("[%04X:%08X]: WriteB\n", CS, cpu_state.pc); - xga_write(addr, val, p); + xga_write(addr, val, priv); } static void -xga_writew(uint32_t addr, uint16_t val, void *p) +xga_writew(uint32_t addr, uint16_t val, void *priv) { // pclog("[%04X:%08X]: WriteW\n", CS, cpu_state.pc); - xga_write(addr, val, p); - xga_write(addr + 1, val >> 8, p); + xga_write(addr, val, priv); + xga_write(addr + 1, val >> 8, priv); } static void -xga_writel(uint32_t addr, uint32_t val, void *p) +xga_writel(uint32_t addr, uint32_t val, void *priv) { // pclog("[%04X:%08X]: WriteL\n", CS, cpu_state.pc); - xga_write(addr, val, p); - xga_write(addr + 1, val >> 8, p); - xga_write(addr + 2, val >> 16, p); - xga_write(addr + 3, val >> 24, p); + xga_write(addr, val, priv); + xga_write(addr + 1, val >> 8, priv); + xga_write(addr + 2, val >> 16, priv); + xga_write(addr + 3, val >> 24, priv); } static void -xga_write_linear(uint32_t addr, uint8_t val, void *p) +xga_write_linear(uint32_t addr, uint8_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; if (!xga->on) { @@ -2396,9 +2396,9 @@ xga_write_linear(uint32_t addr, uint8_t val, void *p) } static void -xga_writew_linear(uint32_t addr, uint16_t val, void *p) +xga_writew_linear(uint32_t addr, uint16_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; if (!xga->on) { @@ -2408,33 +2408,33 @@ xga_writew_linear(uint32_t addr, uint16_t val, void *p) if (xga->linear_endian_reverse) { if (xga->accel.px_map_format[xga->accel.dst_map] == 0x0c) { - xga_write_linear(addr, val, p); - xga_write_linear(addr + 1, val >> 8, p); + xga_write_linear(addr, val, priv); + xga_write_linear(addr + 1, val >> 8, priv); } else if (xga->accel.px_map_format[xga->accel.dst_map] == 4) { - xga_write_linear(addr + 1, val, p); - xga_write_linear(addr, val >> 8, p); + xga_write_linear(addr + 1, val, priv); + xga_write_linear(addr, val >> 8, priv); } else { - xga_write_linear(addr, val, p); - xga_write_linear(addr + 1, val >> 8, p); + xga_write_linear(addr, val, priv); + xga_write_linear(addr + 1, val >> 8, priv); } } else { if (xga->accel.px_map_format[xga->accel.dst_map] == 0x0c) { - xga_write_linear(addr + 1, val, p); - xga_write_linear(addr, val >> 8, p); + xga_write_linear(addr + 1, val, priv); + xga_write_linear(addr, val >> 8, priv); } else if (xga->accel.px_map_format[xga->accel.dst_map] == 4) { - xga_write_linear(addr, val, p); - xga_write_linear(addr + 1, val >> 8, p); + xga_write_linear(addr, val, priv); + xga_write_linear(addr + 1, val >> 8, priv); } else { - xga_write_linear(addr, val, p); - xga_write_linear(addr + 1, val >> 8, p); + xga_write_linear(addr, val, priv); + xga_write_linear(addr + 1, val >> 8, priv); } } } static void -xga_writel_linear(uint32_t addr, uint32_t val, void *p) +xga_writel_linear(uint32_t addr, uint32_t val, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; if (!xga->on) { @@ -2442,16 +2442,16 @@ xga_writel_linear(uint32_t addr, uint32_t val, void *p) return; } - xga_write_linear(addr, val, p); - xga_write_linear(addr + 1, val >> 8, p); - xga_write_linear(addr + 2, val >> 16, p); - xga_write_linear(addr + 3, val >> 24, p); + xga_write_linear(addr, val, priv); + xga_write_linear(addr + 1, val >> 8, priv); + xga_write_linear(addr + 2, val >> 16, priv); + xga_write_linear(addr + 3, val >> 24, priv); } static uint8_t -xga_read(uint32_t addr, void *p) +xga_read(uint32_t addr, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; if (!xga->on) @@ -2469,43 +2469,43 @@ xga_read(uint32_t addr, void *p) } static uint8_t -xga_readb(uint32_t addr, void *p) +xga_readb(uint32_t addr, void *priv) { uint8_t ret; - ret = xga_read(addr, p); + ret = xga_read(addr, priv); return ret; } static uint16_t -xga_readw(uint32_t addr, void *p) +xga_readw(uint32_t addr, void *priv) { uint16_t ret; - ret = xga_read(addr, p); - ret |= (xga_read(addr + 1, p) << 8); + ret = xga_read(addr, priv); + ret |= (xga_read(addr + 1, priv) << 8); return ret; } static uint32_t -xga_readl(uint32_t addr, void *p) +xga_readl(uint32_t addr, void *priv) { uint32_t ret; - ret = xga_read(addr, p); - ret |= (xga_read(addr + 1, p) << 8); - ret |= (xga_read(addr + 2, p) << 16); - ret |= (xga_read(addr + 3, p) << 24); + ret = xga_read(addr, priv); + ret |= (xga_read(addr + 1, priv) << 8); + ret |= (xga_read(addr + 2, priv) << 16); + ret |= (xga_read(addr + 3, priv) << 24); return ret; } static uint8_t -xga_read_linear(uint32_t addr, void *p) +xga_read_linear(uint32_t addr, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; if (!xga->on) @@ -2522,9 +2522,9 @@ xga_read_linear(uint32_t addr, void *p) } static uint16_t -xga_readw_linear(uint32_t addr, void *p) +xga_readw_linear(uint32_t addr, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; uint16_t ret; @@ -2533,32 +2533,32 @@ xga_readw_linear(uint32_t addr, void *p) if (xga->linear_endian_reverse) { if (xga->accel.px_map_format[xga->accel.src_map] == 0x0c) { - ret = xga_read_linear(addr, p) | (xga_read_linear(addr + 1, p) << 8); + ret = xga_read_linear(addr, priv) | (xga_read_linear(addr + 1, priv) << 8); } else if (xga->accel.px_map_format[xga->accel.src_map] == 4) { - ret = xga_read_linear(addr + 1, p) | (xga_read_linear(addr, p) << 8); + ret = xga_read_linear(addr + 1, priv) | (xga_read_linear(addr, priv) << 8); } else - ret = xga_read_linear(addr, p) | (xga_read_linear(addr + 1, p) << 8); + ret = xga_read_linear(addr, priv) | (xga_read_linear(addr + 1, priv) << 8); } else { if (xga->accel.px_map_format[xga->accel.src_map] == 0x0c) { - ret = xga_read_linear(addr + 1, p) | (xga_read_linear(addr, p) << 8); + ret = xga_read_linear(addr + 1, priv) | (xga_read_linear(addr, priv) << 8); } else if (xga->accel.px_map_format[xga->accel.src_map] == 4) { - ret = xga_read_linear(addr, p) | (xga_read_linear(addr + 1, p) << 8); + ret = xga_read_linear(addr, priv) | (xga_read_linear(addr + 1, priv) << 8); } else - ret = xga_read_linear(addr, p) | (xga_read_linear(addr + 1, p) << 8); + ret = xga_read_linear(addr, priv) | (xga_read_linear(addr + 1, priv) << 8); } return ret; } static uint32_t -xga_readl_linear(uint32_t addr, void *p) +xga_readl_linear(uint32_t addr, void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; if (!xga->on) return svga_readl_linear(addr, svga); - return xga_read_linear(addr, p) | (xga_read_linear(addr + 1, p) << 8) | (xga_read_linear(addr + 2, p) << 16) | (xga_read_linear(addr + 3, p) << 24); + return xga_read_linear(addr, priv) | (xga_read_linear(addr + 1, priv) << 8) | (xga_read_linear(addr + 2, priv) << 16) | (xga_read_linear(addr + 3, priv) << 24); } static void @@ -2793,9 +2793,9 @@ xga_mca_feedb(void *priv) } static void -xga_mca_reset(void *p) +xga_mca_reset(void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; xga->on = 0; @@ -2804,9 +2804,9 @@ xga_mca_reset(void *p) } static void -xga_reset(void *p) +xga_reset(void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; mem_mapping_disable(&xga->bios_rom.mapping); @@ -3090,9 +3090,9 @@ static void } static void -xga_close(void *p) +xga_close(void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; xga_t *xga = &svga->xga; if (svga) { @@ -3114,17 +3114,17 @@ inmos_xga_available(void) } static void -xga_speed_changed(void *p) +xga_speed_changed(void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; svga_recalctimings(svga); } static void -xga_force_redraw(void *p) +xga_force_redraw(void *priv) { - svga_t *svga = (svga_t *) p; + svga_t *svga = (svga_t *) priv; svga->fullchange = svga->monitor->mon_changeframecount; } diff --git a/src/vnc_keymap.c b/src/vnc_keymap.c index 2e5f3c0d8..599ba1d9b 100644 --- a/src/vnc_keymap.c +++ b/src/vnc_keymap.c @@ -623,21 +623,21 @@ static int keysyms_ff[] = { #ifdef ENABLE_VNC_KEYMAP_LOG int vnc_keymap_do_log = ENABLE_VNC_KEYMAP_LOG; -#endif static void -vnc_keymap_log(const char *format, ...) +vnc_keymap_log(const char *fmt, ...) { -#ifdef ENABLE_VNC_KEYMAP_LOG va_list ap; if (vnc_keymap_do_log) { - va_start(ap, format); - pclog_ex(format, ap); + va_start(ap, fmt); + pclog_ex(fmt, ap); va_end(ap); } -#endif } +#else +# define vnc_keymap_log(fmt, ...) +#endif void vnc_kbinput(int down, int k)