Add dummy 86Box Unit Tester device
This commit is contained in:
@@ -65,6 +65,7 @@
|
|||||||
#include <86box/machine.h>
|
#include <86box/machine.h>
|
||||||
#include <86box/bugger.h>
|
#include <86box/bugger.h>
|
||||||
#include <86box/postcard.h>
|
#include <86box/postcard.h>
|
||||||
|
#include <86box/unittester.h>
|
||||||
#include <86box/isamem.h>
|
#include <86box/isamem.h>
|
||||||
#include <86box/isartc.h>
|
#include <86box/isartc.h>
|
||||||
#include <86box/lpt.h>
|
#include <86box/lpt.h>
|
||||||
@@ -1222,6 +1223,8 @@ pc_reset_hard_init(void)
|
|||||||
device_add(&bugger_device);
|
device_add(&bugger_device);
|
||||||
if (postcard_enabled)
|
if (postcard_enabled)
|
||||||
device_add(&postcard_device);
|
device_add(&postcard_device);
|
||||||
|
if (unittester_enabled)
|
||||||
|
device_add(&unittester_device);
|
||||||
|
|
||||||
if (IS_ARCH(machine, MACHINE_BUS_PCI)) {
|
if (IS_ARCH(machine, MACHINE_BUS_PCI)) {
|
||||||
pci_register_cards();
|
pci_register_cards();
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
add_library(dev OBJECT bugger.c cassette.c cartridge.c hasp.c hwm.c hwm_lm75.c hwm_lm78.c hwm_gl518sm.c
|
add_library(dev OBJECT bugger.c cassette.c cartridge.c hasp.c hwm.c hwm_lm75.c hwm_lm78.c hwm_gl518sm.c
|
||||||
hwm_vt82c686.c ibm_5161.c isamem.c isartc.c ../lpt.c pci_bridge.c
|
hwm_vt82c686.c ibm_5161.c isamem.c isartc.c ../lpt.c pci_bridge.c
|
||||||
postcard.c serial.c clock_ics9xxx.c isapnp.c i2c.c i2c_gpio.c
|
postcard.c serial.c unittester.c clock_ics9xxx.c isapnp.c i2c.c i2c_gpio.c
|
||||||
smbus_piix4.c smbus_ali7101.c keyboard.c keyboard_xt.c
|
smbus_piix4.c smbus_ali7101.c keyboard.c keyboard_xt.c
|
||||||
kbc_at.c kbc_at_dev.c
|
kbc_at.c kbc_at_dev.c
|
||||||
keyboard_at.c
|
keyboard_at.c
|
||||||
|
79
src/device/unittester.c
Normal file
79
src/device/unittester.c
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||||
|
* running old operating systems and software designed for IBM
|
||||||
|
* PC systems and compatibles from 1981 through fairly recent
|
||||||
|
* system designs based on the PCI bus.
|
||||||
|
*
|
||||||
|
* This file is part of the 86Box distribution.
|
||||||
|
*
|
||||||
|
* Debug device for assisting in unit testing.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Authors: GreaseMonkey, <thematrixeatsyou+86b@gmail.com>
|
||||||
|
*
|
||||||
|
* Copyright 2024 GreaseMonkey.
|
||||||
|
*/
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
#define HAVE_STDARG_H
|
||||||
|
#include <86box/86box.h>
|
||||||
|
#include <86box/plat.h>
|
||||||
|
#include <86box/unittester.h>
|
||||||
|
|
||||||
|
static uint16_t unittester_trigger_port = 0x0080;
|
||||||
|
static uint16_t unittester_base_port = 0xFFFF;
|
||||||
|
|
||||||
|
/* FIXME TEMPORARY --GM */
|
||||||
|
#define ENABLE_UNITTESTER_LOG 1
|
||||||
|
|
||||||
|
#ifdef ENABLE_UNITTESTER_LOG
|
||||||
|
int unittester_do_log = ENABLE_UNITTESTER_LOG;
|
||||||
|
|
||||||
|
static void
|
||||||
|
unittester_log(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
if (unittester_do_log) {
|
||||||
|
va_start(ap, fmt);
|
||||||
|
pclog_ex(fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# define unittester_log(fmt, ...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void *
|
||||||
|
unittester_init(UNUSED(const device_t *info))
|
||||||
|
{
|
||||||
|
//io_sethandler(unittester_trigger_port, 1, NULL, NULL, NULL, unittester_write, NULL, NULL, NULL);
|
||||||
|
unittester_log("[UT] 86Box Unit Tester initialised\n");
|
||||||
|
|
||||||
|
return &unittester_trigger_port; /* Dummy non-NULL value */
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
unittester_close(UNUSED(void *priv))
|
||||||
|
{
|
||||||
|
//io_removehandler(unittester_trigger_port, 1, NULL, NULL, NULL, unittester_write, NULL, NULL, NULL);
|
||||||
|
unittester_log("[UT] 86Box Unit Tester closed\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
const device_t unittester_device = {
|
||||||
|
.name = "86Box Unit Tester",
|
||||||
|
.internal_name = "unittester",
|
||||||
|
.flags = DEVICE_ISA,
|
||||||
|
.local = 0,
|
||||||
|
.init = unittester_init,
|
||||||
|
.close = unittester_close,
|
||||||
|
.reset = NULL,
|
||||||
|
{ .available = NULL },
|
||||||
|
.speed_changed = NULL,
|
||||||
|
.force_redraw = NULL,
|
||||||
|
.config = NULL
|
||||||
|
};
|
35
src/include/86box/unittester.h
Normal file
35
src/include/86box/unittester.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||||
|
* running old operating systems and software designed for IBM
|
||||||
|
* PC systems and compatibles from 1981 through fairly recent
|
||||||
|
* system designs based on the PCI bus.
|
||||||
|
*
|
||||||
|
* This file is part of the 86Box distribution.
|
||||||
|
*
|
||||||
|
* Debug device for assisting in unit testing.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Authors: GreaseMonkey, <thematrixeatsyou+86b@gmail.com>
|
||||||
|
*
|
||||||
|
* Copyright 2024 GreaseMonkey.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef UNITTESTER_H
|
||||||
|
#define UNITTESTER_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Global variables. */
|
||||||
|
extern const device_t unittester_device;
|
||||||
|
|
||||||
|
/* Functions. */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /*UNITTESTER_H*/
|
||||||
|
|
Reference in New Issue
Block a user