Merge pull request #618 from richardg867/temp
Implement POST card device
This commit is contained in:
@@ -99,6 +99,7 @@ extern int vid_cga_contrast, /* (C) video */
|
|||||||
gfxcard; /* (C) graphics/video card */
|
gfxcard; /* (C) graphics/video card */
|
||||||
extern int serial_enabled[], /* (C) enable serial ports */
|
extern int serial_enabled[], /* (C) enable serial ports */
|
||||||
bugger_enabled, /* (C) enable ISAbugger */
|
bugger_enabled, /* (C) enable ISAbugger */
|
||||||
|
postcard_enabled, /* (C) enable POST card */
|
||||||
isamem_type[], /* (C) enable ISA mem cards */
|
isamem_type[], /* (C) enable ISA mem cards */
|
||||||
isartc_type; /* (C) enable ISA RTC card */
|
isartc_type; /* (C) enable ISA RTC card */
|
||||||
extern int sound_is_float, /* (C) sound uses FP values */
|
extern int sound_is_float, /* (C) sound uses FP values */
|
||||||
|
@@ -806,6 +806,7 @@ load_other_peripherals(void)
|
|||||||
ide_qua_enabled = !!config_get_int(cat, "ide_qua", 0);
|
ide_qua_enabled = !!config_get_int(cat, "ide_qua", 0);
|
||||||
|
|
||||||
bugger_enabled = !!config_get_int(cat, "bugger_enabled", 0);
|
bugger_enabled = !!config_get_int(cat, "bugger_enabled", 0);
|
||||||
|
postcard_enabled = !!config_get_int(cat, "postcard_enabled", 0);
|
||||||
|
|
||||||
for (c = 0; c < ISAMEM_MAX; c++) {
|
for (c = 0; c < ISAMEM_MAX; c++) {
|
||||||
sprintf(temp, "isamem%d_type", c);
|
sprintf(temp, "isamem%d_type", c);
|
||||||
@@ -1686,6 +1687,11 @@ save_other_peripherals(void)
|
|||||||
else
|
else
|
||||||
config_set_int(cat, "bugger_enabled", bugger_enabled);
|
config_set_int(cat, "bugger_enabled", bugger_enabled);
|
||||||
|
|
||||||
|
if (postcard_enabled == 0)
|
||||||
|
config_delete_var(cat, "postcard_enabled");
|
||||||
|
else
|
||||||
|
config_set_int(cat, "postcard_enabled", postcard_enabled);
|
||||||
|
|
||||||
for (c = 0; c < ISAMEM_MAX; c++) {
|
for (c = 0; c < ISAMEM_MAX; c++) {
|
||||||
sprintf(temp, "isamem%d_type", c);
|
sprintf(temp, "isamem%d_type", c);
|
||||||
if (isamem_type[c] == 0)
|
if (isamem_type[c] == 0)
|
||||||
|
6
src/pc.c
6
src/pc.c
@@ -49,6 +49,7 @@
|
|||||||
#include "nvr.h"
|
#include "nvr.h"
|
||||||
#include "machine.h"
|
#include "machine.h"
|
||||||
#include "bugger.h"
|
#include "bugger.h"
|
||||||
|
#include "postcard.h"
|
||||||
#include "isamem.h"
|
#include "isamem.h"
|
||||||
#include "isartc.h"
|
#include "isartc.h"
|
||||||
#include "lpt.h"
|
#include "lpt.h"
|
||||||
@@ -112,6 +113,7 @@ int vid_cga_contrast = 0, /* (C) video */
|
|||||||
force_43 = 0; /* (C) video */
|
force_43 = 0; /* (C) video */
|
||||||
int serial_enabled[SERIAL_MAX] = {0,0}, /* (C) enable serial ports */
|
int serial_enabled[SERIAL_MAX] = {0,0}, /* (C) enable serial ports */
|
||||||
bugger_enabled = 0, /* (C) enable ISAbugger */
|
bugger_enabled = 0, /* (C) enable ISAbugger */
|
||||||
|
postcard_enabled = 0, /* (C) enable POST card */
|
||||||
isamem_type[ISAMEM_MAX] = { 0,0,0,0 }, /* (C) enable ISA mem cards */
|
isamem_type[ISAMEM_MAX] = { 0,0,0,0 }, /* (C) enable ISA mem cards */
|
||||||
isartc_type = 0; /* (C) enable ISA RTC card */
|
isartc_type = 0; /* (C) enable ISA RTC card */
|
||||||
int gfxcard = 0; /* (C) graphics/video card */
|
int gfxcard = 0; /* (C) graphics/video card */
|
||||||
@@ -779,7 +781,9 @@ pc_reset_hard_init(void)
|
|||||||
|
|
||||||
/* Needs the status bar... */
|
/* Needs the status bar... */
|
||||||
if (bugger_enabled)
|
if (bugger_enabled)
|
||||||
device_add(&bugger_device);
|
device_add(&bugger_device);
|
||||||
|
if (postcard_enabled)
|
||||||
|
device_add(&postcard_device);
|
||||||
|
|
||||||
/* Reset the CPU module. */
|
/* Reset the CPU module. */
|
||||||
resetx86();
|
resetx86();
|
||||||
|
142
src/postcard.c
Normal file
142
src/postcard.c
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Implementation of a port 80h POST diagnostic card.
|
||||||
|
*
|
||||||
|
* Version: @(#)postcard.c 1.0.0 2020/03/23
|
||||||
|
*
|
||||||
|
* Author: RichardG, <richardg867@gmail.com>
|
||||||
|
* Copyright 2020 RichardG.
|
||||||
|
*/
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
#define HAVE_STDARG_H
|
||||||
|
#include "86box.h"
|
||||||
|
#include "86box_io.h"
|
||||||
|
#include "device.h"
|
||||||
|
#include "machine.h"
|
||||||
|
#include "plat.h"
|
||||||
|
#include "ui.h"
|
||||||
|
#include "postcard.h"
|
||||||
|
|
||||||
|
|
||||||
|
static uint16_t postcard_port;
|
||||||
|
static uint8_t postcard_written;
|
||||||
|
static uint8_t postcard_code, postcard_prev_code;
|
||||||
|
#define UISTR_LEN 13
|
||||||
|
static char postcard_str[UISTR_LEN]; /* UI output string */
|
||||||
|
|
||||||
|
|
||||||
|
extern void ui_sb_bugui(char *__str);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef ENABLE_POSTCARD_LOG
|
||||||
|
int postcard_do_log = ENABLE_POSTCARD_LOG;
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
postcard_log(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
if (postcard_do_log) {
|
||||||
|
va_start(ap, fmt);
|
||||||
|
pclog_ex(fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
int postcard_do_log = 0;
|
||||||
|
|
||||||
|
#define postcard_log(fmt, ...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
postcard_setui(void)
|
||||||
|
{
|
||||||
|
if (!postcard_written)
|
||||||
|
sprintf(postcard_str, "POST: -- --");
|
||||||
|
else if (postcard_written == 1)
|
||||||
|
sprintf(postcard_str, "POST: %02X --", postcard_code);
|
||||||
|
else
|
||||||
|
sprintf(postcard_str, "POST: %02X %02X", postcard_code, postcard_prev_code);
|
||||||
|
|
||||||
|
ui_sb_bugui(postcard_str);
|
||||||
|
|
||||||
|
if (postcard_do_log) {
|
||||||
|
/* log same string sent to the UI */
|
||||||
|
int len = strlen(postcard_str);
|
||||||
|
postcard_str[len + 1] = '\0';
|
||||||
|
postcard_str[len] = '\n';
|
||||||
|
postcard_log(postcard_str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
postcard_reset(void)
|
||||||
|
{
|
||||||
|
postcard_written = 0;
|
||||||
|
postcard_code = postcard_prev_code = 0x00;
|
||||||
|
|
||||||
|
postcard_setui();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
postcard_write(uint16_t port, uint8_t val, void *priv)
|
||||||
|
{
|
||||||
|
postcard_prev_code = postcard_code;
|
||||||
|
postcard_code = val;
|
||||||
|
if (postcard_written < 2)
|
||||||
|
postcard_written++;
|
||||||
|
|
||||||
|
postcard_setui();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void *
|
||||||
|
postcard_init(const device_t *info)
|
||||||
|
{
|
||||||
|
postcard_reset();
|
||||||
|
|
||||||
|
if (machines[machine].flags & MACHINE_MCA)
|
||||||
|
postcard_port = 0x680; /* MCA machines */
|
||||||
|
else if (strstr(machines[machine].name, " PS/2 "))
|
||||||
|
postcard_port = 0x90; /* ISA PS/2 machines */
|
||||||
|
else
|
||||||
|
postcard_port = 0x80; /* AT and clone machines */
|
||||||
|
postcard_log("POST card initializing on port %04Xh\n", postcard_port);
|
||||||
|
|
||||||
|
if (postcard_port) io_sethandler(postcard_port, 1,
|
||||||
|
NULL, NULL, NULL, postcard_write, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
return postcard_write;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
postcard_close(UNUSED(void *priv))
|
||||||
|
{
|
||||||
|
if (postcard_port) io_removehandler(postcard_port, 1,
|
||||||
|
NULL, NULL, NULL, postcard_write, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const device_t postcard_device = {
|
||||||
|
"POST Card",
|
||||||
|
DEVICE_ISA,
|
||||||
|
0,
|
||||||
|
postcard_init, postcard_close, NULL,
|
||||||
|
NULL, NULL, NULL,
|
||||||
|
NULL
|
||||||
|
};
|
35
src/postcard.h
Normal file
35
src/postcard.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.
|
||||||
|
*
|
||||||
|
* Implementation of a port 80h POST diagnostic card.
|
||||||
|
*
|
||||||
|
* Version: @(#)postcard.c 1.0.0 2020/03/23
|
||||||
|
*
|
||||||
|
* Author: RichardG, <richardg867@gmail.com>
|
||||||
|
* Copyright 2020 RichardG.
|
||||||
|
*/
|
||||||
|
#ifndef POSTCARD_H
|
||||||
|
# define POSTCARD_H
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Global variables. */
|
||||||
|
extern const device_t postcard_device;
|
||||||
|
|
||||||
|
|
||||||
|
/* Functions. */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /*BUGGER_H*/
|
@@ -474,6 +474,9 @@ BEGIN
|
|||||||
CONTROL "ISABugger device",IDC_CHECK_BUGGER,"Button",
|
CONTROL "ISABugger device",IDC_CHECK_BUGGER,"Button",
|
||||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,80,94,10
|
BS_AUTOCHECKBOX | WS_TABSTOP,7,80,94,10
|
||||||
|
|
||||||
|
CONTROL "POST card",IDC_CHECK_POSTCARD,"Button",
|
||||||
|
BS_AUTOCHECKBOX | WS_TABSTOP,147,80,94,10
|
||||||
|
|
||||||
LTEXT "ISA RTC",IDT_1767,7,99,48,10
|
LTEXT "ISA RTC",IDT_1767,7,99,48,10
|
||||||
COMBOBOX IDC_COMBO_ISARTC,64,98,155,120,
|
COMBOBOX IDC_COMBO_ISARTC,64,98,155,120,
|
||||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
|
@@ -597,7 +597,7 @@ MCHOBJ := machine.o machine_table.o \
|
|||||||
m_at_286_386sx.o m_at_386dx_486.o \
|
m_at_286_386sx.o m_at_386dx_486.o \
|
||||||
m_at_socket4_5.o m_at_socket7_s7.o
|
m_at_socket4_5.o m_at_socket7_s7.o
|
||||||
|
|
||||||
DEVOBJ := bugger.o hwm.o hwm_w83781d.o ibm_5161.o isamem.o isartc.o lpt.o $(SERIAL) \
|
DEVOBJ := bugger.o hwm.o hwm_w83781d.o ibm_5161.o isamem.o isartc.o lpt.o postcard.o $(SERIAL) \
|
||||||
sio_acc3221.o \
|
sio_acc3221.o \
|
||||||
sio_fdc37c66x.o sio_fdc37c669.o \
|
sio_fdc37c66x.o sio_fdc37c669.o \
|
||||||
sio_fdc37c93x.o \
|
sio_fdc37c93x.o \
|
||||||
|
@@ -602,7 +602,7 @@ MCHOBJ := machine.o machine_table.o \
|
|||||||
m_at_286_386sx.o m_at_386dx_486.o \
|
m_at_286_386sx.o m_at_386dx_486.o \
|
||||||
m_at_socket4_5.o m_at_socket7_s7.o
|
m_at_socket4_5.o m_at_socket7_s7.o
|
||||||
|
|
||||||
DEVOBJ := bugger.o hwm.o hwm_w83781d.o ibm_5161.o isamem.o isartc.o lpt.o $(SERIAL) \
|
DEVOBJ := bugger.o hwm.o hwm_w83781d.o ibm_5161.o isamem.o isartc.o lpt.o postcard.o $(SERIAL) \
|
||||||
sio_acc3221.o \
|
sio_acc3221.o \
|
||||||
sio_fdc37c66x.o sio_fdc37c669.o \
|
sio_fdc37c66x.o sio_fdc37c669.o \
|
||||||
sio_fdc37c93x.o \
|
sio_fdc37c93x.o \
|
||||||
|
@@ -175,7 +175,7 @@
|
|||||||
#define IDC_CHECK_IDE_QUA 1127
|
#define IDC_CHECK_IDE_QUA 1127
|
||||||
#define IDC_BUTTON_IDE_QUA 1128
|
#define IDC_BUTTON_IDE_QUA 1128
|
||||||
#define IDC_CHECK_BUGGER 1129
|
#define IDC_CHECK_BUGGER 1129
|
||||||
#define IDC_CONFIGURE_BUGGER 1130
|
#define IDC_CHECK_POSTCARD 1130
|
||||||
#define IDC_COMBO_ISARTC 1131
|
#define IDC_COMBO_ISARTC 1131
|
||||||
#define IDC_CONFIGURE_ISARTC 1132
|
#define IDC_CONFIGURE_ISARTC 1132
|
||||||
#define IDC_GROUP_ISAMEM 1140
|
#define IDC_GROUP_ISAMEM 1140
|
||||||
|
@@ -97,6 +97,7 @@ static int temp_serial[2], temp_lpt[3];
|
|||||||
/* Other peripherals category */
|
/* Other peripherals category */
|
||||||
static int temp_hdc, temp_scsi_card, temp_ide_ter, temp_ide_qua;
|
static int temp_hdc, temp_scsi_card, temp_ide_ter, temp_ide_qua;
|
||||||
static int temp_bugger;
|
static int temp_bugger;
|
||||||
|
static int temp_postcard;
|
||||||
static int temp_isartc;
|
static int temp_isartc;
|
||||||
static int temp_isamem[ISAMEM_MAX];
|
static int temp_isamem[ISAMEM_MAX];
|
||||||
|
|
||||||
@@ -248,6 +249,7 @@ win_settings_init(void)
|
|||||||
temp_ide_ter = ide_ter_enabled;
|
temp_ide_ter = ide_ter_enabled;
|
||||||
temp_ide_qua = ide_qua_enabled;
|
temp_ide_qua = ide_qua_enabled;
|
||||||
temp_bugger = bugger_enabled;
|
temp_bugger = bugger_enabled;
|
||||||
|
temp_postcard = postcard_enabled;
|
||||||
temp_isartc = isartc_type;
|
temp_isartc = isartc_type;
|
||||||
|
|
||||||
/* ISA memory boards. */
|
/* ISA memory boards. */
|
||||||
@@ -356,6 +358,7 @@ win_settings_changed(void)
|
|||||||
i = i || (temp_ide_ter != ide_ter_enabled);
|
i = i || (temp_ide_ter != ide_ter_enabled);
|
||||||
i = i || (temp_ide_qua != ide_qua_enabled);
|
i = i || (temp_ide_qua != ide_qua_enabled);
|
||||||
i = i || (temp_bugger != bugger_enabled);
|
i = i || (temp_bugger != bugger_enabled);
|
||||||
|
i = i || (temp_postcard != postcard_enabled);
|
||||||
i = i || (temp_isartc != isartc_type);
|
i = i || (temp_isartc != isartc_type);
|
||||||
|
|
||||||
/* ISA memory boards. */
|
/* ISA memory boards. */
|
||||||
@@ -460,6 +463,7 @@ win_settings_save(void)
|
|||||||
ide_ter_enabled = temp_ide_ter;
|
ide_ter_enabled = temp_ide_ter;
|
||||||
ide_qua_enabled = temp_ide_qua;
|
ide_qua_enabled = temp_ide_qua;
|
||||||
bugger_enabled = temp_bugger;
|
bugger_enabled = temp_bugger;
|
||||||
|
postcard_enabled = temp_postcard;
|
||||||
isartc_type = temp_isartc;
|
isartc_type = temp_isartc;
|
||||||
|
|
||||||
/* ISA memory boards. */
|
/* ISA memory boards. */
|
||||||
@@ -1594,6 +1598,9 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
h=GetDlgItem(hdlg, IDC_CHECK_BUGGER);
|
h=GetDlgItem(hdlg, IDC_CHECK_BUGGER);
|
||||||
SendMessage(h, BM_SETCHECK, temp_bugger, 0);
|
SendMessage(h, BM_SETCHECK, temp_bugger, 0);
|
||||||
|
|
||||||
|
h=GetDlgItem(hdlg, IDC_CHECK_POSTCARD);
|
||||||
|
SendMessage(h, BM_SETCHECK, temp_postcard, 0);
|
||||||
|
|
||||||
/* Populate the ISA RTC card dropdown. */
|
/* Populate the ISA RTC card dropdown. */
|
||||||
e = 0;
|
e = 0;
|
||||||
h = GetDlgItem(hdlg, IDC_COMBO_ISARTC);
|
h = GetDlgItem(hdlg, IDC_COMBO_ISARTC);
|
||||||
@@ -1797,6 +1804,9 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
h = GetDlgItem(hdlg, IDC_CHECK_BUGGER);
|
h = GetDlgItem(hdlg, IDC_CHECK_BUGGER);
|
||||||
temp_bugger = SendMessage(h, BM_GETCHECK, 0, 0);
|
temp_bugger = SendMessage(h, BM_GETCHECK, 0, 0);
|
||||||
|
|
||||||
|
h = GetDlgItem(hdlg, IDC_CHECK_POSTCARD);
|
||||||
|
temp_postcard = SendMessage(h, BM_GETCHECK, 0, 0);
|
||||||
|
|
||||||
free(stransi);
|
free(stransi);
|
||||||
free(lptsTemp);
|
free(lptsTemp);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user