Next round of sonarlint cleanups

This commit is contained in:
Jasmine Iwanek
2023-06-26 12:47:04 -04:00
parent 2fe3bcd5d2
commit 21adfd4d50
176 changed files with 2791 additions and 1377 deletions

View File

@@ -61,44 +61,76 @@ extern "C" {
typedef struct
{
uint8_t acpitst, auxen, auxsts, plvl2, plvl3,
smicmd, gpio_dir,
gpio_val, muxcntrl, ali_soft_smi,
timer32, smireg,
gpireg[3], gporeg[4],
extiotrapsts, extiotrapen;
uint16_t pmsts, pmen,
pmcntrl, gpsts, gpsts1,
gpen, gpen1, gpscien,
gpcntrl, gplvl, gpmux,
gpsel, gpsmien, pscntrl,
gpscists;
int smi_lock, smi_active;
uint32_t pcntrl, p2cntrl, glbsts,
devsts, glben,
glbctl, devctl,
padsts, paden,
gptren, gptimer,
gpo_val, gpi_val,
extsmi_val, pad0;
uint8_t acpitst;
uint8_t auxen;
uint8_t auxsts;
uint8_t plvl2;
uint8_t plvl3;
uint8_t smicmd;
uint8_t gpio_dir;
uint8_t gpio_val;
uint8_t muxcntrl;
uint8_t ali_soft_smi;
uint8_t timer32;
uint8_t smireg;
uint8_t gpireg[3];
uint8_t gporeg[4];
uint8_t extiotrapsts, extiotrapen;
uint16_t pmsts;
uint16_t pmen;
uint16_t pmcntrl;
uint16_t gpsts;
uint16_t gpsts1;
uint16_t gpen;
uint16_t gpen1;
uint16_t gpscien;
uint16_t gpcntrl;
uint16_t gplvl;
uint16_t gpmux;
uint16_t gpsel;
uint16_t gpsmien;
uint16_t pscntrl;
uint16_t gpscists;
int smi_lock;
int smi_active;
uint32_t pcntrl;
uint32_t p2cntrl;
uint32_t glbsts;
uint32_t devsts;
uint32_t glben;
uint32_t glbctl;
uint32_t devctl;
uint32_t padsts;
uint32_t paden;
uint32_t gptren;
uint32_t gptimer;
uint32_t gpo_val;
uint32_t gpi_val;
uint32_t extsmi_val;
uint32_t pad0;
} acpi_regs_t;
typedef struct
{
acpi_regs_t regs;
uint8_t gpireg2_default, pad[3],
gporeg_default[4],
suspend_types[8];
uint16_t io_base, aux_io_base;
int vendor,
slot, irq_mode,
irq_pin, irq_line,
mirq_is_level;
pc_timer_t timer, resume_timer, pwrbtn_timer;
nvr_t *nvr;
apm_t *apm;
void *i2c,
(*trap_update)(void *priv), *trap_priv;
uint8_t gpireg2_default;
uint8_t pad[3];
uint8_t gporeg_default[4];
uint8_t suspend_types[8];
uint16_t io_base;
uint16_t aux_io_base;
int vendor;
int slot, irq_mode;
int irq_pin, irq_line;
int mirq_is_level;
pc_timer_t timer;
pc_timer_t resume_timer;
pc_timer_t pwrbtn_timer;
nvr_t *nvr;
apm_t *apm;
void *i2c;
void (*trap_update)(void *priv);
void *trap_priv;
} acpi_t;
/* Global variables. */

View File

@@ -23,8 +23,9 @@ extern "C" {
typedef struct
{
uint8_t cmd,
stat, do_smi;
uint8_t cmd;
uint8_t stat;
uint8_t do_smi;
} apm_t;
/* Global variables. */

View File

@@ -55,9 +55,9 @@ extern "C" {
enum {
CDROM_BUS_DISABLED = 0,
CDROM_BUS_ATAPI = 5,
CDROM_BUS_SCSI,
CDROM_BUS_MITSUMI,
CDROM_BUS_USB
CDROM_BUS_SCSI = 6,
CDROM_BUS_MITSUMI = 7,
CDROM_BUS_USB = 8
};
#define KNOWN_CDROM_DRIVE_TYPES 35
@@ -67,12 +67,12 @@ enum {
static const struct
{
const char vendor[9];
const char model[17];
const char revision[5];
const char vendor[9];
const char model[17];
const char revision[5];
const char *name;
const char *internal_name;
const int bus_type;
const int bus_type;
} cdrom_drive_types[] =
{
{ "86BOX", "CD-ROM", "1.00", "(ATAPI/SCSI) 86BOX CD-ROM 1.00", "86BOX_CD-ROM_1.00", BUS_TYPE_ALL}, /*1*/
@@ -117,15 +117,23 @@ static const struct
struct cdrom;
typedef struct {
uint8_t attr, track,
index,
abs_m, abs_s, abs_f,
rel_m, rel_s, rel_f;
uint8_t attr;
uint8_t track;
uint8_t index;
uint8_t abs_m;
uint8_t abs_s;
uint8_t abs_f;
uint8_t rel_m;
uint8_t rel_s;
uint8_t rel_f;
} subchannel_t;
typedef struct {
int number;
uint8_t attr, m, s, f;
uint8_t attr;
uint8_t m;
uint8_t s;
uint8_t f;
} track_info_t;
/* Define the various CD-ROM drive operations (ops). */
@@ -144,32 +152,39 @@ typedef struct cdrom {
uint8_t id;
union {
uint8_t res, res0, /* Reserved for other ID's. */
res1,
ide_channel, scsi_device_id;
uint8_t res;
uint8_t res0; /* Reserved for other ID's. */
uint8_t res1;
uint8_t ide_channel;
uint8_t scsi_device_id;
};
uint8_t bus_type, /* 0 = ATAPI, 1 = SCSI */
bus_mode, /* Bit 0 = PIO suported;
Bit 1 = DMA supportd. */
cd_status, /* Struct variable reserved for
media status. */
speed, cur_speed;
uint8_t bus_type; /* 0 = ATAPI, 1 = SCSI */
uint8_t bus_mode; /* Bit 0 = PIO suported;
Bit 1 = DMA supportd. */
uint8_t cd_status; /* Struct variable reserved for
media status. */
uint8_t speed;
uint8_t cur_speed;
int is_dir;
void *priv;
char image_path[1024],
prev_image_path[1024];
char image_path[1024];
char prev_image_path[1024];
char *image_history[CD_IMAGE_HISTORY];
uint32_t sound_on, cdrom_capacity,
seek_pos,
seek_diff, cd_end, type;
uint32_t sound_on;
uint32_t cdrom_capacity;
uint32_t seek_pos;
uint32_t seek_diff;
uint32_t cd_end, type;
int host_drive, prev_host_drive,
cd_buflen, audio_op;
int host_drive;
int prev_host_drive;
int cd_buflen;
int audio_op;
const cdrom_ops_t *ops;

View File

@@ -56,10 +56,17 @@ typedef struct {
} track_file_t;
typedef struct {
int number, track_number, attr, sector_size,
mode2, form, pre, pad;
uint64_t start, length,
skip;
int number;
int track_number;
int attr;
int sector_size;
int mode2;
int form;
int pre;
int pad;
uint64_t start;
uint64_t length;
uint64_t skip;
track_file_t *file;
} track_t;

View File

@@ -24,7 +24,8 @@ extern "C" {
typedef struct
{
uint16_t io_base;
int channel, enable;
int channel;
int enable;
} ddma_channel_t;
typedef struct

View File

@@ -96,8 +96,10 @@ typedef struct {
const char *internal_name;
int bios_type;
int files_no;
uint32_t local, size;
void *dev1, *dev2;
uint32_t local;
uint32_t size;
void *dev1;
void *dev2;
const char *files[9];
} device_config_bios_t;

View File

@@ -40,10 +40,12 @@ typedef struct {
static const disk_size_t disk_sizes[14] = {
// clang-format off
// { 1, 1, 2, 1, 1, 77, 26, 0, 0, 4, 2, 6, 68 }, /* 250k 8" */
// { 1, 2, 2, 1, 1, 77, 26, 0, 0, 4, 2, 6, 68 }, /* 500k 8" */
// { 1, 1, 2, 1, 1, 77, 8, 3, 0, 1, 2, 2, 192 }, /* 616k 8" */
// { 1, 2, 0, 1, 1, 77, 8, 3, 0, 1, 2, 2, 192 }, /* 1232k 8" */
#if 0
{ 1, 1, 2, 1, 1, 77, 26, 0, 0, 4, 2, 6, 68 }, /* 250k 8" */
{ 1, 2, 2, 1, 1, 77, 26, 0, 0, 4, 2, 6, 68 }, /* 500k 8" */
{ 1, 1, 2, 1, 1, 77, 8, 3, 0, 1, 2, 2, 192 }, /* 616k 8" */
{ 1, 2, 0, 1, 1, 77, 8, 3, 0, 1, 2, 2, 192 }, /* 1232k 8" */
#endif
{ 0, 1, 2, 1, 0, 40, 8, 2, 0xfe, 2, 2, 1, 64 }, /* 160k */
{ 0, 1, 2, 1, 0, 40, 9, 2, 0xfc, 2, 2, 1, 64 }, /* 180k */
{ 0, 2, 2, 1, 0, 40, 8, 2, 0xff, 2, 2, 1, 112 }, /* 320k */
@@ -58,8 +60,10 @@ static const disk_size_t disk_sizes[14] = {
{ 2, 2, 3, 1, 0, 80, 36, 2, 0xf0, 2, 2, 9, 240 }, /* 2.88M */
{ 0, 64, 0, 0, 0, 96, 32, 2, 0, 0, 0, 0, 0 }, /* ZIP 100 */
{ 0, 64, 0, 0, 0, 239, 32, 2, 0, 0, 0, 0, 0 }, /* ZIP 250 */
// { 0, 8, 0, 0, 0, 963, 32, 2, 0, 0, 0, 0, 0 }, /* LS-120 */
// { 0, 32, 0, 0, 0, 262, 56, 2, 0, 0, 0, 0, 0 } /* LS-240 */
#if 0
{ 0, 8, 0, 0, 0, 963, 32, 2, 0, 0, 0, 0, 0 }, /* LS-120 */
{ 0, 32, 0, 0, 0, 262, 56, 2, 0, 0, 0, 0, 0 } /* LS-240 */
#endif
// clang-format on
};

View File

@@ -44,21 +44,36 @@
#define DMA_VERIFY 0x20000
typedef struct {
uint8_t m, mode, page, stat,
stat_rq, command,
ps2_mode, arb_level,
sg_command, sg_status,
ptr0, enabled,
ext_mode, page_l,
page_h, pad;
uint16_t cb, io_addr,
base, transfer_mode;
uint32_t ptr, ptr_cur,
addr,
ab, ac;
int cc, wp,
size, count,
eot;
uint8_t m;
uint8_t mode;
uint8_t page;
uint8_t stat;
uint8_t stat_rq;
uint8_t command;
uint8_t ps2_mode;
uint8_t arb_level;
uint8_t sg_command;
uint8_t sg_status;
uint8_t ptr0;
uint8_t enabled;
uint8_t ext_mode;
uint8_t page_l;
uint8_t page_h;
uint8_t pad;
uint16_t cb;
uint16_t io_addr;
uint16_t base;
uint16_t transfer_mode;
uint32_t ptr;
uint32_t ptr_cur;
uint32_t addr;
uint32_t ab;
uint32_t ac;
int cc;
int wp;
int size;
int count;
int eot;
} dma_t;
extern dma_t dma[8];

View File

@@ -57,41 +57,78 @@ extern int fdc_type;
#define FDC_FLAG_QUA 0x3000 /* Is Quaternary */
typedef struct {
uint8_t dor, stat, command, processed_cmd, dat, st0, swap, dtl;
uint8_t swwp, disable_write, st5, st6, error;
uint8_t params[8], res[11];
uint8_t dor;
uint8_t stat;
uint8_t command;
uint8_t processed_cmd;
uint8_t dat;
uint8_t st0;
uint8_t swap;
uint8_t dtl;
uint8_t swwp;
uint8_t disable_write;
uint8_t st5;
uint8_t st6;
uint8_t error;
uint8_t params[8];
uint8_t res[11];
uint8_t specify[2];
uint8_t config, pretrk;
uint8_t config;
uint8_t pretrk;
uint8_t fifobuf[16];
uint16_t base_address;
int head, sector, drive, lastdrive;
int pcn[4], eot[4];
int rw_track, pos;
int pnum, ptot;
int rate, reset_stat;
int lock, perp;
int format_state, format_n;
int step, seek_dir;
int tc, noprec;
int head;
int sector;
int drive;
int lastdrive;
int pcn[4];
int eot[4];
int rw_track;
int pos;
int pnum;
int ptot;
int rate;
int reset_stat;
int lock;
int perp;
int format_state;
int format_n;
int step;
int seek_dir;
int tc;
int noprec;
int data_ready, inread;
int bitcell_period, enh_mode;
int rwc[4], drvrate[4];
int boot_drive, dma;
int densel_polarity, densel_force;
int fifo, tfifo;
int fifobufpos, drv2en;
int data_ready;
int inread;
int bitcell_period;
int enh_mode;
int rwc[4];
int drvrate[4];
int boot_drive;
int dma;
int densel_polarity;
int densel_force;
int fifo;
int tfifo;
int fifobufpos;
int drv2en;
int gap;
int enable_3f1, format_sectors;
int max_track, mfm;
int deleted, wrong_am;
int sc, satisfying_sectors;
int fintr, rw_drive;
int enable_3f1;
int format_sectors;
int max_track;
int mfm;
int deleted;
int wrong_am;
int sc;
int satisfying_sectors;
int fintr;
int rw_drive;
int flags, interrupt;
int flags;
int interrupt;
int irq; /* Should be 6 by default. */
int dma_ch; /* Should be 2 by default. */
@@ -99,11 +136,13 @@ typedef struct {
int bit_rate; /* Should be 250 at start. */
int paramstogo;
sector_id_t read_track_sector, format_sector_id;
sector_id_t read_track_sector;
sector_id_t format_sector_id;
uint64_t watchdog_count;
pc_timer_t timer, watchdog_timer;
pc_timer_t timer;
pc_timer_t watchdog_timer;
} fdc_t;
extern void fdc_remove(fdc_t *fdc);

View File

@@ -91,9 +91,9 @@ typedef struct {
int (*read_axis)(void *p, int axis);
void (*a0_over)(void *p);
int axis_count,
button_count,
pov_count;
int axis_count;
int button_count;
int pov_count;
int max_joysticks;
const char *axis_names[8];
const char *button_names[32];

View File

@@ -24,14 +24,14 @@
#define GDBSTUB_MEM_AWATCH 32
enum {
GDBSTUB_EXEC = 0,
GDBSTUB_SSTEP,
GDBSTUB_BREAK,
GDBSTUB_BREAK_SW,
GDBSTUB_BREAK_HW,
GDBSTUB_BREAK_RWATCH,
GDBSTUB_BREAK_WWATCH,
GDBSTUB_BREAK_AWATCH
GDBSTUB_EXEC = 0,
GDBSTUB_SSTEP = 1,
GDBSTUB_BREAK = 2,
GDBSTUB_BREAK_SW = 3,
GDBSTUB_BREAK_HW = 4,
GDBSTUB_BREAK_RWATCH = 5,
GDBSTUB_BREAK_WWATCH = 6,
GDBSTUB_BREAK_AWATCH = 7
};
#ifdef USE_GDBSTUB

View File

@@ -43,23 +43,37 @@ enum {
#ifdef SCSI_DEVICE_H
typedef struct ide_s {
uint8_t selected,
atastat, error,
command, fdisk;
int type, board,
irqstat, service,
blocksize, blockcount,
hdd_num, channel,
pos, sector_pos,
lba,
reset, mdma_mode,
do_initial_read;
uint32_t secount, sector,
cylinder, head,
drive, cylprecomp,
cfg_spt, cfg_hpc,
lba_addr, tracks,
spt, hpc;
uint8_t selected;
uint8_t atastat;
uint8_t error;
uint8_t command;
uint8_t fdisk;
int type;
int board;
int irqstat;
int service;
int blocksize;
int blockcount;
int hdd_num;
int channel;
int pos;
int sector_pos;
int lba;
int reset;
int mdma_mode;
int do_initial_read;
uint32_t secount;
uint32_t sector;
uint32_t cylinder;
uint32_t head;
uint32_t drive;
uint32_t cylprecomp;
uint32_t cfg_spt;
uint32_t cfg_hpc;
uint32_t lba_addr;
uint32_t tracks;
uint32_t spt;
uint32_t hpc;
uint16_t *buffer;
uint8_t *sector_buffer;
@@ -96,10 +110,10 @@ extern ide_t *ide_drives[IDE_NUM];
This will eventually be hookable. */
enum {
TYPE_PIO = 0,
TYPE_SDMA,
TYPE_MDMA,
TYPE_UDMA
TYPE_PIO = 0,
TYPE_SDMA = 1,
TYPE_MDMA = 2,
TYPE_UDMA = 3
};
/* Return:
@@ -108,9 +122,9 @@ enum {
This will eventually be hookable. */
enum {
TIMINGS_DMA = 0,
TIMINGS_PIO,
TIMINGS_PIO_FC
TIMINGS_DMA = 0,
TIMINGS_PIO = 1,
TIMINGS_PIO_FC = 2
};
extern int ide_ter_enabled;

View File

@@ -22,17 +22,26 @@
typedef struct
{
uint8_t command, status,
ptr0, enabled,
dma_mode, pad,
pad0, pad1;
uint16_t base, pad2;
uint32_t ptr, ptr_cur,
addr;
int count, eot,
slot,
irq_mode[2], irq_level[2],
irq_pin, irq_line;
uint8_t command;
uint8_t status;
uint8_t ptr0;
uint8_t enabled;
uint8_t dma_mode;
uint8_t pad;
uint8_t pad0;
uint8_t pad1;
uint16_t base;
uint16_t pad2;
uint32_t ptr;
uint32_t ptr_cur;
uint32_t addr;
int count;
int eot;
int slot;
int irq_mode[2];
int irq_level[2];
int irq_pin;
int irq_line;
} sff8038i_t;
extern const device_t sff8038i_device;

View File

@@ -34,54 +34,54 @@
Bit 5 = Removable (0 = no, 1 yes). */
enum {
BUS_DISABLED = 0x00,
BUS_DISABLED = 0x00,
BUS_MFM = 0x01, /* These four are for hard disk only. */
BUS_XIDE = 0x02,
BUS_XTA = 0x03,
BUS_ESDI = 0x04,
BUS_MFM = 0x01, /* These four are for hard disk only. */
BUS_XIDE = 0x02,
BUS_XTA = 0x03,
BUS_ESDI = 0x04,
BUS_PANASONIC = 0x21, / These four are for CD-ROM only. */
BUS_PHILIPS = 0x22,
BUS_SONY = 0x23,
BUS_MITSUMI = 0x24,
BUS_PANASONIC = 0x21, / These four are for CD-ROM only. */
BUS_PHILIPS = 0x22,
BUS_SONY = 0x23,
BUS_MITSUMI = 0x24,
BUS_IDE_PIO_ONLY = 0x05,
BUS_IDE_PIO_AND_DMA = 0x15,
BUS_IDE_R_PIO_ONLY = 0x25,
BUS_IDE_R_PIO_AND_DMA = 0x35,
BUS_IDE_PIO_ONLY = 0x05,
BUS_IDE_PIO_AND_DMA = 0x15,
BUS_IDE_R_PIO_ONLY = 0x25,
BUS_IDE_R_PIO_AND_DMA = 0x35,
BUS_ATAPI_PIO_ONLY = 0x06,
BUS_ATAPI_PIO_AND_DMA = 0x16,
BUS_ATAPI_R_PIO_ONLY = 0x26,
BUS_ATAPI_R_PIO_AND_DMA = 0x36,
BUS_ATAPI_PIO_ONLY = 0x06,
BUS_ATAPI_PIO_AND_DMA = 0x16,
BUS_ATAPI_R_PIO_ONLY = 0x26,
BUS_ATAPI_R_PIO_AND_DMA = 0x36,
BUS_SASI = 0x07,
BUS_SASI_R = 0x27,
BUS_SASI = 0x07,
BUS_SASI_R = 0x27,
BUS_SCSI = 0x08,
BUS_SCSI_R = 0x28,
BUS_SCSI = 0x08,
BUS_SCSI_R = 0x28,
BUS_USB = 0x09,
BUS_USB_R = 0x29
BUS_USB = 0x09,
BUS_USB_R = 0x29
};
#else
enum {
HDD_BUS_DISABLED = 0,
HDD_BUS_MFM,
HDD_BUS_XTA,
HDD_BUS_ESDI,
HDD_BUS_IDE,
HDD_BUS_ATAPI,
HDD_BUS_SCSI,
HDD_BUS_USB
HDD_BUS_MFM = 1,
HDD_BUS_XTA = 2,
HDD_BUS_ESDI = 3,
HDD_BUS_IDE = 4,
HDD_BUS_ATAPI = 5,
HDD_BUS_SCSI = 6,
HDD_BUS_USB = 7
};
#endif
enum {
HDD_OP_SEEK = 0,
HDD_OP_READ,
HDD_OP_WRITE
HDD_OP_SEEK = 0,
HDD_OP_READ = 2,
HDD_OP_WRITE = 3
};
#define HDD_MAX_ZONES 16
@@ -147,21 +147,23 @@ typedef struct {
uint8_t ide_channel;
uint8_t scsi_id;
};
uint8_t bus,
res; /* Reserved for bus mode */
uint8_t bus;
uint8_t res; /* Reserved for bus mode */
uint8_t wp; /* Disk has been mounted READ-ONLY */
uint8_t pad, pad0;
uint8_t pad;
uint8_t pad0;
void *priv;
char fn[1024]; /* Name of current image file */
char vhd_parent[1041]; /* Differential VHD parent file */
uint32_t res0, pad1,
base,
spt,
hpc, /* Physical geometry parameters */
tracks;
uint32_t res0;
uint32_t pad1;
uint32_t base;
uint32_t spt;
uint32_t hpc; /* Physical geometry parameters */
uint32_t tracks;
hdd_zone_t zones[HDD_MAX_ZONES];
uint32_t num_zones;

View File

@@ -33,7 +33,8 @@ typedef struct {
uint8_t regs[8];
uint8_t addr_register;
uint8_t i2c_addr : 7, i2c_state : 2;
uint8_t i2c_addr : 7;
uint8_t i2c_state : 2;
uint8_t i2c_enabled : 1;
} lm75_t;

View File

@@ -25,25 +25,29 @@
#define ISAPNP_DMA_DISABLED 4
enum {
ISAPNP_CARD_DISABLE = 0,
ISAPNP_CARD_ENABLE = 1,
ISAPNP_CARD_FORCE_CONFIG, /* cheat code for UMC UM8669F */
ISAPNP_CARD_NO_KEY /* cheat code for Crystal CS423x */
ISAPNP_CARD_DISABLE = 0,
ISAPNP_CARD_ENABLE = 1,
ISAPNP_CARD_FORCE_CONFIG = 2, /* cheat code for UMC UM8669F */
ISAPNP_CARD_NO_KEY = 3 /* cheat code for Crystal CS423x */
};
typedef struct {
uint8_t activate;
struct {
uint32_t base : 24, size : 24;
uint32_t base : 24;
uint32_t size : 24;
} mem[4];
struct {
uint32_t base, size;
uint32_t base;
uint32_t size;
} mem32[4];
struct {
uint16_t base;
} io[8];
struct {
uint8_t irq : 4, level : 1, type : 1;
uint8_t irq : 4;
uint8_t level : 1;
uint8_t type : 1;
} irq[2];
struct {
uint8_t dma : 3;

View File

@@ -24,23 +24,24 @@
enum {
DEV_KBD = 0,
DEV_AUX
DEV_AUX = 1
};
enum {
DEV_STATE_MAIN_1 = 0,
DEV_STATE_MAIN_OUT,
DEV_STATE_MAIN_2,
DEV_STATE_MAIN_CMD,
DEV_STATE_MAIN_WANT_IN,
DEV_STATE_MAIN_IN,
DEV_STATE_EXECUTE_BAT,
DEV_STATE_MAIN_WANT_EXECUTE_BAT
DEV_STATE_MAIN_1 = 0,
DEV_STATE_MAIN_OUT = 1,
DEV_STATE_MAIN_2 = 2,
DEV_STATE_MAIN_CMD = 3,
DEV_STATE_MAIN_WANT_IN = 4,
DEV_STATE_MAIN_IN = 5,
DEV_STATE_EXECUTE_BAT = 6,
DEV_STATE_MAIN_WANT_EXECUTE_BAT = 7
};
/* Used by the AT / PS/2 keyboard controller, common device, keyboard, and mouse. */
typedef struct {
uint8_t wantcmd, dat;
uint8_t wantcmd;
uint8_t dat;
int16_t out_new;
@@ -53,9 +54,16 @@ typedef struct {
typedef struct {
const char *name; /* name of this device */
uint8_t type, command, last_scan_code, state,
resolution, rate, cmd_queue_start, cmd_queue_end,
queue_start, queue_end;
uint8_t type;
uint8_t command;
uint8_t last_scan_code;
uint8_t state;
uint8_t resolution;
uint8_t rate;
uint8_t cmd_queue_start;
uint8_t cmd_queue_end;
uint8_t queue_start;
uint8_t queue_end;
uint16_t flags;
@@ -65,8 +73,12 @@ typedef struct {
uint8_t queue[64];
int fifo_mask, mode,
x, y, z, b;
int fifo_mask;
int mode;
int x;
int y;
int z;
int b;
int *scan;

View File

@@ -10,12 +10,12 @@
#define LPT_MDA_IRQ 7
#define LPT4_ADDR 0x0268
#define LPT4_IRQ 5
/*
#if 0
#define LPT5_ADDR 0x027c
#define LPT5_IRQ 7
#define LPT6_ADDR 0x026c
#define LPT6_IRQ 5
*/
#endif
typedef struct
{
@@ -53,7 +53,7 @@ extern void lpt1_remove_ams(void);
#define lpt4_irq(a) lpt_port_irq(3, a)
#define lpt4_remove() lpt_port_remove(3)
/*
#if 0
#define lpt5_init(a) lpt_port_init(4, a)
#define lpt5_irq(a) lpt_port_irq(4, a)
#define lpt5_remove() lpt_port_remove(4)
@@ -61,16 +61,20 @@ extern void lpt1_remove_ams(void);
#define lpt6_init(a) lpt_port_init(5, a)
#define lpt6_irq(a) lpt_port_irq(5, a)
#define lpt6_remove() lpt_port_remove(5)
*/
#endif
void lpt_devices_init(void);
void lpt_devices_close(void);
typedef struct {
uint8_t enabled, irq,
dat, ctrl;
uint16_t addr, pad0;
int device, enable_irq;
uint8_t enabled;
uint8_t irq;
uint8_t dat;
uint8_t ctrl;
uint16_t addr;
uint16_t pad0;
int device;
int enable_irq;
lpt_device_t *dt;
void *priv;
} lpt_port_t;

View File

@@ -143,31 +143,31 @@
#endif
enum {
MACHINE_TYPE_NONE = 0,
MACHINE_TYPE_8088,
MACHINE_TYPE_8086,
MACHINE_TYPE_286,
MACHINE_TYPE_386SX,
MACHINE_TYPE_486SLC,
MACHINE_TYPE_386DX,
MACHINE_TYPE_386DX_486,
MACHINE_TYPE_486,
MACHINE_TYPE_486_S2,
MACHINE_TYPE_486_S3,
MACHINE_TYPE_486_MISC,
MACHINE_TYPE_SOCKET4,
MACHINE_TYPE_SOCKET5,
MACHINE_TYPE_SOCKET7_3V,
MACHINE_TYPE_SOCKET7,
MACHINE_TYPE_SOCKETS7,
MACHINE_TYPE_SOCKET8,
MACHINE_TYPE_SLOT1,
MACHINE_TYPE_SLOT1_2,
MACHINE_TYPE_SLOT1_370,
MACHINE_TYPE_SLOT2,
MACHINE_TYPE_SOCKET370,
MACHINE_TYPE_MISC,
MACHINE_TYPE_MAX
MACHINE_TYPE_NONE = 0,
MACHINE_TYPE_8088 = 1,
MACHINE_TYPE_8086 = 2,
MACHINE_TYPE_286 = 3,
MACHINE_TYPE_386SX = 4,
MACHINE_TYPE_486SLC = 5,
MACHINE_TYPE_386DX = 6,
MACHINE_TYPE_386DX_486 = 7,
MACHINE_TYPE_486 = 8,
MACHINE_TYPE_486_S2 = 9,
MACHINE_TYPE_486_S3 = 10,
MACHINE_TYPE_486_MISC = 11,
MACHINE_TYPE_SOCKET4 = 12,
MACHINE_TYPE_SOCKET5 = 13,
MACHINE_TYPE_SOCKET7_3V = 14,
MACHINE_TYPE_SOCKET7 = 15,
MACHINE_TYPE_SOCKETS7 = 16,
MACHINE_TYPE_SOCKET8 = 17,
MACHINE_TYPE_SLOT1 = 18,
MACHINE_TYPE_SLOT1_2 = 19,
MACHINE_TYPE_SLOT1_370 = 20,
MACHINE_TYPE_SLOT2 = 21,
MACHINE_TYPE_SOCKET370 = 22,
MACHINE_TYPE_MISC = 23,
MACHINE_TYPE_MAX = 24
};
enum {
@@ -281,7 +281,10 @@ typedef struct _machine_ {
uint32_t type;
uintptr_t chipset;
int (*init)(const struct _machine_ *);
uintptr_t pad, pad0, pad1, pad2;
uintptr_t pad;
uintptr_t pad0;
uintptr_t pad1;
uintptr_t pad2;
const machine_cpu_t cpu;
uintptr_t bus_flags;
uintptr_t flags;

View File

@@ -159,10 +159,10 @@
mem_set_access((smm ? ACCESS_BUS_SMM : ACCESS_BUS), 1, base, size, is_smram)
typedef struct {
uint16_t x : 5,
w : 5,
r : 5,
pad : 1;
uint16_t x : 5;
uint16_t w : 5;
uint16_t r : 5;
uint16_t pad : 1;
} state_t;
typedef union {
@@ -255,7 +255,8 @@ extern uint8_t *ram, *ram2;
extern uint32_t rammask;
extern uint8_t *rom;
extern uint32_t biosmask, biosaddr;
extern uint32_t biosmask;
extern uint32_t biosaddr;
extern int readlookup[256];
extern uintptr_t *readlookup2;
@@ -283,7 +284,8 @@ extern uint32_t mem_logical_addr;
extern page_t *pages;
extern page_t **page_lookup;
extern uint32_t get_phys_virt, get_phys_phys;
extern uint32_t get_phys_virt;
extern uint32_t get_phys_phys;
extern int shadowbios;
extern int shadowbios_write;

View File

@@ -47,13 +47,21 @@ typedef struct midi_in_handler_t {
} midi_in_handler_t;
typedef struct midi_t {
uint8_t midi_rt_buf[8], midi_cmd_buf[8],
midi_status, midi_sysex_data[SYSEX_SIZE];
int midi_cmd_pos, midi_cmd_len, midi_cmd_r,
midi_realtime, thruchan, midi_clockout;
unsigned int midi_sysex_start, midi_sysex_delay,
midi_pos;
midi_device_t *m_out_device, *m_in_device;
uint8_t midi_rt_buf[8];
uint8_t midi_cmd_buf[8];
uint8_t midi_status;
uint8_t midi_sysex_data[SYSEX_SIZE];
int midi_cmd_pos;
int midi_cmd_len;
int midi_cmd_r;
int midi_realtime;
int thruchan;
int midi_clockout;
unsigned int midi_sysex_start;
unsigned int midi_sysex_delay;
unsigned int midi_pos;
midi_device_t *m_out_device;
midi_device_t *m_in_device;
} midi_t;
extern midi_t *midi_out;

View File

@@ -85,34 +85,38 @@ static const mo_drive_type_t mo_drive_types[KNOWN_MO_DRIVE_TYPES] = {
enum {
MO_BUS_DISABLED = 0,
MO_BUS_ATAPI = 5,
MO_BUS_SCSI,
MO_BUS_USB
MO_BUS_SCSI = 6,
MO_BUS_USB = 7
};
typedef struct {
uint8_t id;
union {
uint8_t res, res0, /* Reserved for other ID's. */
res1,
ide_channel, scsi_device_id;
uint8_t res;
uint8_t res0; /* Reserved for other ID's. */
uint8_t res1;
uint8_t ide_channel;
uint8_t scsi_device_id;
};
uint8_t bus_type, /* 0 = ATAPI, 1 = SCSI */
bus_mode, /* Bit 0 = PIO suported;
Bit 1 = DMA supportd. */
read_only, /* Struct variable reserved for
media status. */
pad, pad0;
uint8_t bus_type; /* 0 = ATAPI, 1 = SCSI */
uint8_t bus_mode; /* Bit 0 = PIO suported;
Bit 1 = DMA supportd. */
uint8_t read_only; /* Struct variable reserved for
media status. */
uint8_t pad;
uint8_t pad0;
FILE *f;
void *priv;
char image_path[1024],
prev_image_path[1024];
char image_path[1024];
char prev_image_path[1024];
uint32_t type, medium_size,
base;
uint32_t type;
uint32_t medium_size;
uint32_t base;
uint16_t sector_size;
} mo_drive_t;
@@ -122,25 +126,36 @@ typedef struct {
mo_drive_t *drv;
uint8_t *buffer,
atapi_cdb[16],
current_cdb[16],
sense[256];
uint8_t *buffer;
uint8_t atapi_cdb[16];
uint8_t current_cdb[16];
uint8_t sense[256];
uint8_t status, phase,
error, id,
features, cur_lun,
pad0, pad1;
uint8_t status;
uint8_t phase;
uint8_t error;
uint8_t id;
uint8_t features;
uint8_t cur_lun;
uint8_t pad0;
uint8_t pad1;
uint16_t request_length, max_transfer_len;
uint16_t request_length;
uint16_t max_transfer_len;
int requested_blocks, packet_status,
total_length, do_page_save,
unit_attention, request_pos,
old_len, pad3;
int requested_blocks;
int packet_status;
int total_length;
int do_page_save;
int unit_attention;
int request_pos;
int old_len;
int pad3;
uint32_t sector_pos, sector_len,
packet_len, pos;
uint32_t sector_pos;
uint32_t sector_len;
uint32_t packet_len;
uint32_t pos;
double callback;
} mo_t;

View File

@@ -43,16 +43,16 @@
extern "C" {
#endif
extern int mouse_type;
extern int mouse_x;
extern int mouse_y;
extern int mouse_z;
extern int mouse_mode; /* 1 = Absolute, 0 = Relative */
extern int mouse_tablet_in_proximity;
extern int mouse_type;
extern int mouse_x;
extern int mouse_y;
extern int mouse_z;
extern int mouse_mode; /* 1 = Absolute, 0 = Relative */
extern int mouse_tablet_in_proximity;
extern double mouse_x_abs;
extern double mouse_y_abs;
extern int mouse_buttons;
extern int tablet_tool_type;
extern int mouse_buttons;
extern int tablet_tool_type;
#ifdef EMU_DEVICE_H
extern const device_t *mouse_get_device(int mouse);

View File

@@ -45,13 +45,13 @@
#define NET_WD8003_H
enum {
WD_NONE = 0,
WD8003E, /* WD8003E : 8-bit ISA, no interface chip */
WD8003EB, /* WD8003EB : 8-bit ISA, 5x3 interface chip */
WD8013EBT, /* WD8013EBT : 16-bit ISA, no interface chip */
WD8003ETA, /* WD8003ET/A: 16-bit MCA, no interface chip */
WD8003EA, /* WD8003E/A : 16-bit MCA, 5x3 interface chip */
WD8013EPA
WD_NONE = 0,
WD8003E = 1, /* WD8003E : 8-bit ISA, no interface chip */
WD8003EB = 2, /* WD8003EB : 8-bit ISA, 5x3 interface chip */
WD8013EBT = 3, /* WD8013EBT : 16-bit ISA, no interface chip */
WD8003ETA = 4, /* WD8003ET/A: 16-bit MCA, no interface chip */
WD8003EA = 5, /* WD8003E/A : 16-bit MCA, 5x3 interface chip */
WD8013EPA = 6
};
extern const device_t wd8003e_device;

View File

@@ -80,17 +80,17 @@ enum {
/* Supported network cards. */
enum {
NONE = 0,
NE1000,
NE2000,
RTL8019AS,
RTL8029AS
NONE = 0,
NE1000 = 1,
NE2000 = 2,
RTL8019AS = 3,
RTL8029AS = 4
};
enum {
NET_QUEUE_RX,
NET_QUEUE_TX_VM,
NET_QUEUE_TX_HOST
NET_QUEUE_RX = 0,
NET_QUEUE_TX_VM = 1,
NET_QUEUE_TX_HOST = 2
};
typedef struct {
@@ -168,11 +168,11 @@ extern "C" {
#endif
/* Global variables. */
extern int nic_do_log; /* config */
extern int nic_do_log; // config
extern network_devmap_t network_devmap;
extern int network_ndev; // Number of pcap devices
extern int network_ndev; // Number of pcap devices
extern network_devmap_t network_devmap; // Bitmap of available network types
extern netdev_t network_devs[NET_HOST_INTF_MAX];
extern netdev_t network_devs[NET_HOST_INTF_MAX];
/* Function prototypes. */

View File

@@ -64,7 +64,8 @@
typedef struct _nvr_ {
char *fn; /* pathname of image file */
uint16_t size; /* device configuration */
int8_t irq, is_new;
int8_t irq;
int8_t is_new;
uint8_t onesec_cnt;
pc_timer_t onesec_time;

View File

@@ -56,37 +56,37 @@
#define PCI_ADD_STRICT 0x80
enum {
PCI_CARD_NORTHBRIDGE = 0,
PCI_CARD_AGPBRIDGE,
PCI_CARD_SOUTHBRIDGE,
PCI_CARD_SOUTHBRIDGE_IDE,
PCI_CARD_SOUTHBRIDGE_PMU,
PCI_CARD_SOUTHBRIDGE_USB,
PCI_CARD_AGP = 0x0f,
PCI_CARD_NORMAL = 0x10,
PCI_CARD_VIDEO,
PCI_CARD_SCSI,
PCI_CARD_SOUND,
PCI_CARD_IDE,
PCI_CARD_NETWORK,
PCI_CARD_BRIDGE,
PCI_CARD_NORTHBRIDGE = 0,
PCI_CARD_AGPBRIDGE = 1,
PCI_CARD_SOUTHBRIDGE = 2,
PCI_CARD_SOUTHBRIDGE_IDE = 3,
PCI_CARD_SOUTHBRIDGE_PMU = 4,
PCI_CARD_SOUTHBRIDGE_USB = 5,
PCI_CARD_AGP = 0x0f,
PCI_CARD_NORMAL = 0x10,
PCI_CARD_VIDEO = 0x11,
PCI_CARD_SCSI = 0x12,
PCI_CARD_SOUND = 0x13,
PCI_CARD_IDE = 0x14,
PCI_CARD_NETWORK = 0x15,
PCI_CARD_BRIDGE = 0x16,
};
enum {
PCI_ADD_NORTHBRIDGE = 0,
PCI_ADD_AGPBRIDGE,
PCI_ADD_SOUTHBRIDGE,
PCI_ADD_SOUTHBRIDGE_IDE,
PCI_ADD_SOUTHBRIDGE_PMU,
PCI_ADD_SOUTHBRIDGE_USB,
PCI_ADD_AGP = 0x0f,
PCI_ADD_NORMAL = 0x10,
PCI_ADD_VIDEO,
PCI_ADD_SCSI,
PCI_ADD_SOUND,
PCI_ADD_IDE,
PCI_ADD_NETWORK,
PCI_ADD_BRIDGE
PCI_ADD_NORTHBRIDGE = 0,
PCI_ADD_AGPBRIDGE = 1,
PCI_ADD_SOUTHBRIDGE = 2,
PCI_ADD_SOUTHBRIDGE_IDE = 3,
PCI_ADD_SOUTHBRIDGE_PMU = 4,
PCI_ADD_SOUTHBRIDGE_USB = 5,
PCI_ADD_AGP = 0x0f,
PCI_ADD_NORMAL = 0x10,
PCI_ADD_VIDEO = 0x11,
PCI_ADD_SCSI = 0x12,
PCI_ADD_SOUND = 0x13,
PCI_ADD_IDE = 0x14,
PCI_ADD_NETWORK = 0x15,
PCI_ADD_BRIDGE = 0x16
};
typedef union {

View File

@@ -20,11 +20,26 @@
#define EMU_PIC_H
typedef struct pic {
uint8_t icw1, icw2, icw3, icw4,
imr, isr, irr, ocw2,
ocw3, int_pending, is_master, elcr,
state, ack_bytes, priority, special_mask_mode,
auto_eoi_rotate, interrupt, lines, data_bus;
uint8_t icw1;
uint8_t icw2;
uint8_t icw3;
uint8_t icw4;
uint8_t imr;
uint8_t isr;
uint8_t irr;
uint8_t ocw2;
uint8_t ocw3;
uint8_t int_pending;
uint8_t is_master;
uint8_t elcr;
uint8_t state;
uint8_t ack_bytes;
uint8_t priority;
uint8_t special_mask_mode;
uint8_t auto_eoi_rotate;
uint8_t interrupt;
uint8_t lines;
uint8_t data_bus;
uint32_t at;
struct pic *slaves[8];
} pic_t;

View File

@@ -20,16 +20,28 @@
#define EMU_PIT_H
typedef struct {
uint8_t m, ctrl,
read_status, latch,
s1_det, l_det,
bcd, incomplete;
uint8_t m;
uint8_t ctrl;
uint8_t read_status;
uint8_t latch;
uint8_t s1_det;
uint8_t l_det;
uint8_t bcd;
uint8_t incomplete;
uint16_t rl;
int rm, wm, gate, out,
newcount, clock, using_timer, latched,
state, null_count, do_read_status;
int rm;
int wm;
int gate;
int out;
int newcount;
int clock;
int using_timer;
int latched;
int state;
int null_count;
int do_read_status;
union {
int count;
@@ -49,7 +61,8 @@ typedef struct {
} ctr_t;
typedef struct PIT {
int flags, clock;
int flags;
int clock;
pc_timer_t callback_timer;
ctr_t counters[3];
@@ -58,10 +71,10 @@ typedef struct PIT {
} pit_t;
enum {
PIT_8253 = 0,
PIT_8254,
PIT_8253_FAST,
PIT_8254_FAST
PIT_8253 = 0,
PIT_8254 = 1,
PIT_8253_FAST = 2,
PIT_8254_FAST = 3
};
typedef struct {

View File

@@ -20,14 +20,23 @@
#define EMU_PIT_FAST_H
typedef struct {
uint8_t m, ctrl,
read_status, latch, bcd;
uint8_t m;
uint8_t ctrl;
uint8_t read_status;
uint8_t latch;
uint8_t bcd;
uint16_t rl;
int rm, wm, gate, out,
newcount, clock, using_timer, latched,
do_read_status;
int rm;
int wm;
int gate;
int out;
int newcount;
int clock;
int using_timer;
int latched;
int do_read_status;
int enabled;
int disabled;
int initial;

View File

@@ -81,9 +81,9 @@ extern "C" {
#endif
/* Global variables residing in the platform module. */
extern int dopause, /* system is paused */
mouse_capture; /* mouse is captured in app */
extern volatile int is_quit; /* system exit requested */
extern int dopause; /* system is paused */
extern int mouse_capture; /* mouse is captured in app */
extern volatile int is_quit; /* system exit requested */
#ifdef MTR_ENABLED
extern int tracing_on;
@@ -95,7 +95,9 @@ extern char emu_version[200]; /* version ID string */
extern int rctrl_is_lalt;
extern int update_icons;
extern int kbd_req_capture, hide_status_bar, hide_tool_bar;
extern int kbd_req_capture;
extern int hide_status_bar;
extern int hide_tool_bar;
/* System-related functions. */
extern char *fix_exe_path(char *str);

View File

@@ -0,0 +1,31 @@
/*
* 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.
*
* Define the various platform support functions.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2016-2019 Miran Grca.
* Copyright 2017-2019 Fred N. van Kempen.
* Copyright 2021 Laci bá'
*/
#ifndef EMU_PLAT_UNUSED_H
#define EMU_PLAT_UNUSED_H
#ifdef _MSC_VER
# define UNUSED(arg) arg
#else
/* A hack (GCC-specific?) to allow us to ignore unused parameters. */
# define UNUSED(arg) __attribute__((unused)) arg
#endif
#endif /*EMU_PLAT_UNUSED_H*/

View File

@@ -22,7 +22,8 @@
#ifdef _TIMER_H_
typedef struct
{
uint8_t refresh, flags;
uint8_t refresh;
uint8_t flags;
pc_timer_t refresh_timer;
} port_6x_t;

View File

@@ -22,7 +22,8 @@
#ifdef _TIMER_H_
typedef struct
{
uint8_t reg, flags;
uint8_t reg;
uint8_t flags;
pc_timer_t pulse_timer;

View File

@@ -3,7 +3,8 @@
typedef struct PPI {
int s2;
uint8_t pa, pb;
uint8_t pa;
uint8_t pb;
} PPI;
extern int ppispeakon;

View File

@@ -28,25 +28,36 @@ typedef struct {
cdrom_t *drv;
uint8_t *buffer,
atapi_cdb[16],
current_cdb[16],
sense[256];
uint8_t *buffer;
uint8_t atapi_cdb[16];
uint8_t current_cdb[16];
uint8_t sense[256];
uint8_t status, phase,
error, id,
features, cur_lun,
early, pad1;
uint8_t status;
uint8_t phase;
uint8_t error;
uint8_t id;
uint8_t features;
uint8_t cur_lun;
uint8_t early;
uint8_t pad1;
uint16_t request_length, max_transfer_len;
uint16_t request_length;
uint16_t max_transfer_len;
int requested_blocks, packet_status,
total_length, do_page_save,
unit_attention, request_pos,
old_len, media_status;
int requested_blocks;
int packet_status;
int total_length;
int do_page_save;
int unit_attention;
int request_pos;
int old_len;
int media_status;
uint32_t sector_pos, sector_len,
packet_len, pos;
uint32_t sector_pos;
uint32_t sector_len;
uint32_t packet_len;
uint32_t pos;
double callback;

View File

@@ -43,142 +43,142 @@
#define MCR_ERR 0x08 /* Media change request */
/* SCSI commands. */
#define GPCMD_TEST_UNIT_READY 0x00
#define GPCMD_REZERO_UNIT 0x01
#define GPCMD_REQUEST_SENSE 0x03
#define GPCMD_FORMAT_UNIT 0x04
#define GPCMD_IOMEGA_SENSE 0x06
#define GPCMD_READ_6 0x08
#define GPCMD_WRITE_6 0x0a
#define GPCMD_SEEK_6 0x0b
#define GPCMD_IOMEGA_SET_PROTECTION_MODE 0x0c
#define GPCMD_IOMEGA_EJECT 0x0d /* ATAPI only? */
#define GPCMD_NO_OPERATION_TOSHIBA 0x0d /* Toshiba Vendor Unique command */
#define GPCMD_NO_OPERATION_NEC 0x0d /* NEC Vendor Unique command */
#define GPCMD_INQUIRY 0x12
#define GPCMD_VERIFY_6 0x13
#define GPCMD_MODE_SELECT_6 0x15
#define GPCMD_SCSI_RESERVE 0x16
#define GPCMD_SCSI_RELEASE 0x17
#define GPCMD_MODE_SENSE_6 0x1a
#define GPCMD_START_STOP_UNIT 0x1b
#define GPCMD_SEND_DIAGNOSTIC 0x1d
#define GPCMD_PREVENT_REMOVAL 0x1e
#define GPCMD_READ_FORMAT_CAPACITIES 0x23
#define GPCMD_READ_CDROM_CAPACITY 0x25
#define GPCMD_UNKNOWN_CHINON 0x26 /*Chinon Vendor Unique command*/
#define GPCMD_READ_10 0x28
#define GPCMD_READ_GENERATION 0x29
#define GPCMD_WRITE_10 0x2a
#define GPCMD_SEEK_10 0x2b
#define GPCMD_ERASE_10 0x2c
#define GPCMD_WRITE_AND_VERIFY_10 0x2e
#define GPCMD_VERIFY_10 0x2f
#define GPCMD_READ_BUFFER 0x3c
#define GPCMD_WRITE_SAME_10 0x41
#define GPCMD_READ_SUBCHANNEL 0x42
#define GPCMD_READ_TOC_PMA_ATIP 0x43
#define GPCMD_READ_HEADER 0x44
#define GPCMD_PLAY_AUDIO_10 0x45
#define GPCMD_GET_CONFIGURATION 0x46
#define GPCMD_PLAY_AUDIO_MSF 0x47
#define GPCMD_PLAY_AUDIO_TRACK_INDEX 0x48
#define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_10 0x49
#define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a
#define GPCMD_PAUSE_RESUME 0x4b
#define GPCMD_STOP_PLAY_SCAN 0x4e
#define GPCMD_READ_DISC_INFORMATION 0x51
#define GPCMD_READ_TRACK_INFORMATION 0x52
#define GPCMD_MODE_SELECT_10 0x55
#define GPCMD_MODE_SENSE_10 0x5a
#define GPCMD_PLAY_AUDIO_12 0xa5
#define GPCMD_READ_12 0xa8
#define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_12 0xa9
#define GPCMD_WRITE_12 0xaa
#define GPCMD_ERASE_12 0xac
#define GPCMD_READ_DVD_STRUCTURE 0xad /* For reading. */
#define GPCMD_WRITE_AND_VERIFY_12 0xae
#define GPCMD_VERIFY_12 0xaf
#define GPCMD_PLAY_CD_OLD 0xb4
#define GPCMD_READ_CD_OLD 0xb8
#define GPCMD_READ_CD_MSF 0xb9
#define GPCMD_AUDIO_SCAN 0xba
#define GPCMD_SET_SPEED 0xbb
#define GPCMD_PLAY_CD 0xbc
#define GPCMD_MECHANISM_STATUS 0xbd
#define GPCMD_READ_CD 0xbe
#define GPCMD_SEND_DVD_STRUCTURE 0xbf /* This is for writing only, irrelevant to 86Box. */
#define GPCMD_EJECT_CHINON 0xc0 /* Chinon Vendor Unique command */
#define GPCMD_AUDIO_TRACK_SEARCH_TOSHIBA 0xc0 /* Toshiba Vendor Unique command */
#define GPCMD_UNKNOWN_SONY 0xc0 /* Sony Vendor Unique command */
#define GPCMD_PLAY_AUDIO_TOSHIBA 0xc1 /* Toshiba Vendor Unique command */
#define GPCMD_READ_TOC_SONY 0xc1 /* Sony Vendor Unique command */
#define GPCMD_PAUSE_RESUME_ALT 0xc2
#define GPCMD_READ_SUBCHANNEL_MATSUSHITA 0xc2 /* Matsushita Vendor Unique command */
#define GPCMD_READ_SUBCHANNEL_SONY 0xc2 /* Sony Vendor Unique command */
#define GPCMD_STILL_TOSHIBA 0xc2 /* Toshiba Vendor Unique command */
#define GPCMD_READ_TOC_MATSUSHITA 0xc3 /* Matsushita Vendor Unique command */
#define GPCMD_READ_HEADER_SONY 0xc3 /* Sony Vendor Unique command */
#define GPCMD_SET_STOP_TIME_TOSHIBA 0xc3 /* Toshiba Vendor Unique command */
#define GPCMD_READ_HEADER_MATSUSHITA 0xc4 /* Matsushita Vendor Unique command */
#define GPCMD_PLAYBACK_STATUS_TOSHIBA 0xc4 /* Sony Vendor Unique command */
#define GPCMD_CADDY_EJECT_TOSHIBA 0xc4 /* Toshiba Vendor Unique command */
#define GPCMD_PAUSE_SONY 0xc5 /* Sony Vendor Unique command */
#define GPCMD_PLAY_AUDIO_MATSUSHITA 0xc5 /* Matsushita Vendor Unique command */
#define GPCMD_STOP_CHINON 0xc6 /* Chinon Vendor Unique command */
#define GPCMD_PLAT_TRACK_SONY 0xc6 /* Sony Vendor Unique command */
#define GPCMD_READ_SUBCODEQ_PLAYING_STATUS_TOSHIBA 0xc6 /* Toshiba Vendor Unique command */
#define GPCMD_PLAY_AUDIO_MSF_MATSUSHITA 0xc7 /* Matsushita Vendor Unique command*/
#define GPCMD_PLAY_MSF_SONY 0xc7 /* Sony Vendor Unique command*/
#define GPCMD_READ_DISC_INFORMATION_TOSHIBA 0xc7 /* Toshiba Vendor Unique command */
#define GPCMD_PLAY_AUDIO_TRACK_INDEX_MATSUSHITA 0xc8 /* Matsushita Vendor Unique command */
#define GPCMD_PLAY_AUDIO_SONY 0xc8 /* Sony Vendor Unique command */
#define GPCMD_TEST_UNIT_READY 0x00
#define GPCMD_REZERO_UNIT 0x01
#define GPCMD_REQUEST_SENSE 0x03
#define GPCMD_FORMAT_UNIT 0x04
#define GPCMD_IOMEGA_SENSE 0x06
#define GPCMD_READ_6 0x08
#define GPCMD_WRITE_6 0x0a
#define GPCMD_SEEK_6 0x0b
#define GPCMD_IOMEGA_SET_PROTECTION_MODE 0x0c
#define GPCMD_IOMEGA_EJECT 0x0d /* ATAPI only? */
#define GPCMD_NO_OPERATION_TOSHIBA 0x0d /* Toshiba Vendor Unique command */
#define GPCMD_NO_OPERATION_NEC 0x0d /* NEC Vendor Unique command */
#define GPCMD_INQUIRY 0x12
#define GPCMD_VERIFY_6 0x13
#define GPCMD_MODE_SELECT_6 0x15
#define GPCMD_SCSI_RESERVE 0x16
#define GPCMD_SCSI_RELEASE 0x17
#define GPCMD_MODE_SENSE_6 0x1a
#define GPCMD_START_STOP_UNIT 0x1b
#define GPCMD_SEND_DIAGNOSTIC 0x1d
#define GPCMD_PREVENT_REMOVAL 0x1e
#define GPCMD_READ_FORMAT_CAPACITIES 0x23
#define GPCMD_READ_CDROM_CAPACITY 0x25
#define GPCMD_UNKNOWN_CHINON 0x26 /*Chinon Vendor Unique command*/
#define GPCMD_READ_10 0x28
#define GPCMD_READ_GENERATION 0x29
#define GPCMD_WRITE_10 0x2a
#define GPCMD_SEEK_10 0x2b
#define GPCMD_ERASE_10 0x2c
#define GPCMD_WRITE_AND_VERIFY_10 0x2e
#define GPCMD_VERIFY_10 0x2f
#define GPCMD_READ_BUFFER 0x3c
#define GPCMD_WRITE_SAME_10 0x41
#define GPCMD_READ_SUBCHANNEL 0x42
#define GPCMD_READ_TOC_PMA_ATIP 0x43
#define GPCMD_READ_HEADER 0x44
#define GPCMD_PLAY_AUDIO_10 0x45
#define GPCMD_GET_CONFIGURATION 0x46
#define GPCMD_PLAY_AUDIO_MSF 0x47
#define GPCMD_PLAY_AUDIO_TRACK_INDEX 0x48
#define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_10 0x49
#define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a
#define GPCMD_PAUSE_RESUME 0x4b
#define GPCMD_STOP_PLAY_SCAN 0x4e
#define GPCMD_READ_DISC_INFORMATION 0x51
#define GPCMD_READ_TRACK_INFORMATION 0x52
#define GPCMD_MODE_SELECT_10 0x55
#define GPCMD_MODE_SENSE_10 0x5a
#define GPCMD_PLAY_AUDIO_12 0xa5
#define GPCMD_READ_12 0xa8
#define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_12 0xa9
#define GPCMD_WRITE_12 0xaa
#define GPCMD_ERASE_12 0xac
#define GPCMD_READ_DVD_STRUCTURE 0xad /* For reading. */
#define GPCMD_WRITE_AND_VERIFY_12 0xae
#define GPCMD_VERIFY_12 0xaf
#define GPCMD_PLAY_CD_OLD 0xb4
#define GPCMD_READ_CD_OLD 0xb8
#define GPCMD_READ_CD_MSF 0xb9
#define GPCMD_AUDIO_SCAN 0xba
#define GPCMD_SET_SPEED 0xbb
#define GPCMD_PLAY_CD 0xbc
#define GPCMD_MECHANISM_STATUS 0xbd
#define GPCMD_READ_CD 0xbe
#define GPCMD_SEND_DVD_STRUCTURE 0xbf /* This is for writing only, irrelevant to 86Box. */
#define GPCMD_EJECT_CHINON 0xc0 /* Chinon Vendor Unique command */
#define GPCMD_AUDIO_TRACK_SEARCH_TOSHIBA 0xc0 /* Toshiba Vendor Unique command */
#define GPCMD_UNKNOWN_SONY 0xc0 /* Sony Vendor Unique command */
#define GPCMD_PLAY_AUDIO_TOSHIBA 0xc1 /* Toshiba Vendor Unique command */
#define GPCMD_READ_TOC_SONY 0xc1 /* Sony Vendor Unique command */
#define GPCMD_PAUSE_RESUME_ALT 0xc2
#define GPCMD_READ_SUBCHANNEL_MATSUSHITA 0xc2 /* Matsushita Vendor Unique command */
#define GPCMD_READ_SUBCHANNEL_SONY 0xc2 /* Sony Vendor Unique command */
#define GPCMD_STILL_TOSHIBA 0xc2 /* Toshiba Vendor Unique command */
#define GPCMD_READ_TOC_MATSUSHITA 0xc3 /* Matsushita Vendor Unique command */
#define GPCMD_READ_HEADER_SONY 0xc3 /* Sony Vendor Unique command */
#define GPCMD_SET_STOP_TIME_TOSHIBA 0xc3 /* Toshiba Vendor Unique command */
#define GPCMD_READ_HEADER_MATSUSHITA 0xc4 /* Matsushita Vendor Unique command */
#define GPCMD_PLAYBACK_STATUS_TOSHIBA 0xc4 /* Sony Vendor Unique command */
#define GPCMD_CADDY_EJECT_TOSHIBA 0xc4 /* Toshiba Vendor Unique command */
#define GPCMD_PAUSE_SONY 0xc5 /* Sony Vendor Unique command */
#define GPCMD_PLAY_AUDIO_MATSUSHITA 0xc5 /* Matsushita Vendor Unique command */
#define GPCMD_STOP_CHINON 0xc6 /* Chinon Vendor Unique command */
#define GPCMD_PLAT_TRACK_SONY 0xc6 /* Sony Vendor Unique command */
#define GPCMD_READ_SUBCODEQ_PLAYING_STATUS_TOSHIBA 0xc6 /* Toshiba Vendor Unique command */
#define GPCMD_PLAY_AUDIO_MSF_MATSUSHITA 0xc7 /* Matsushita Vendor Unique command*/
#define GPCMD_PLAY_MSF_SONY 0xc7 /* Sony Vendor Unique command*/
#define GPCMD_READ_DISC_INFORMATION_TOSHIBA 0xc7 /* Toshiba Vendor Unique command */
#define GPCMD_PLAY_AUDIO_TRACK_INDEX_MATSUSHITA 0xc8 /* Matsushita Vendor Unique command */
#define GPCMD_PLAY_AUDIO_SONY 0xc8 /* Sony Vendor Unique command */
#define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_10_MATSUSHITA 0xc9 /*Matsushita Vendor Unique command */
#define GPCMD_PLAYBACK_CONTROL_SONY 0xc9 /* Sony Vendor Unique command */
#define GPCMD_PAUSE_RESUME_MATSUSHITA 0xcb /* Matsushita Vendor Unique command */
#define GPCMD_SCAN_PIONEER 0xcd /* Should be equivalent to 0xba */
#define GPCMD_AUDIO_TRACK_SEARCH_NEC 0xd8 /* NEC Vendor Unique command */
#define GPCMD_PLAY_AUDIO_NEC 0xd9 /* NEC Vendor Unique command */
#define GPCMD_STILL_NEC 0xda /* NEC Vendor Unique command */
#define GPCMD_SET_SPEED_ALT 0xda /* Should be equivalent to 0xbb */
#define GPCMD_SET_STOP_TIME_NEC 0xdb /* NEC Vendor Unique command */
#define GPCMD_CADDY_EJECT_NEC 0xdc /* NEC Vendor Unique command */
#define GPCMD_READ_SUBCODEQ_PLAYING_STATUS_NEC 0xdd /* NEC Vendor Unique command */
#define GPCMD_READ_DISC_INFORMATION_NEC 0xde /* NEC Vendor Unique command */
#define GPCMD_PLAY_AUDIO_12_MATSUSHITA 0xe5 /* Matsushita Vendor Unique command */
#define GPCMD_PLAYBACK_CONTROL_SONY 0xc9 /* Sony Vendor Unique command */
#define GPCMD_PAUSE_RESUME_MATSUSHITA 0xcb /* Matsushita Vendor Unique command */
#define GPCMD_SCAN_PIONEER 0xcd /* Should be equivalent to 0xba */
#define GPCMD_AUDIO_TRACK_SEARCH_NEC 0xd8 /* NEC Vendor Unique command */
#define GPCMD_PLAY_AUDIO_NEC 0xd9 /* NEC Vendor Unique command */
#define GPCMD_STILL_NEC 0xda /* NEC Vendor Unique command */
#define GPCMD_SET_SPEED_ALT 0xda /* Should be equivalent to 0xbb */
#define GPCMD_SET_STOP_TIME_NEC 0xdb /* NEC Vendor Unique command */
#define GPCMD_CADDY_EJECT_NEC 0xdc /* NEC Vendor Unique command */
#define GPCMD_READ_SUBCODEQ_PLAYING_STATUS_NEC 0xdd /* NEC Vendor Unique command */
#define GPCMD_READ_DISC_INFORMATION_NEC 0xde /* NEC Vendor Unique command */
#define GPCMD_PLAY_AUDIO_12_MATSUSHITA 0xe5 /* Matsushita Vendor Unique command */
#define GPCMD_PLAY_AUDIO_TRACK_RELATIVE_12_MATSUSHITA 0xe9 /* Matsushita Vendor Unique command */
/* Mode page codes for mode sense/set */
#define GPMODE_R_W_ERROR_PAGE 0x01
#define GPMODE_DISCONNECT_PAGE 0x02 /* Disconnect/reconnect page */
#define GPMODE_FORMAT_DEVICE_PAGE 0x03
#define GPMODE_RIGID_DISK_PAGE 0x04 /* Rigid disk geometry page */
#define GPMODE_FLEXIBLE_DISK_PAGE 0x05
#define GPMODE_CACHING_PAGE 0x08
#define GPMODE_CDROM_PAGE_SONY 0x08
#define GPMODE_R_W_ERROR_PAGE 0x01
#define GPMODE_DISCONNECT_PAGE 0x02 /* Disconnect/reconnect page */
#define GPMODE_FORMAT_DEVICE_PAGE 0x03
#define GPMODE_RIGID_DISK_PAGE 0x04 /* Rigid disk geometry page */
#define GPMODE_FLEXIBLE_DISK_PAGE 0x05
#define GPMODE_CACHING_PAGE 0x08
#define GPMODE_CDROM_PAGE_SONY 0x08
#define GPMODE_CDROM_AUDIO_PAGE_SONY 0x09
#define GPMODE_CDROM_PAGE 0x0d
#define GPMODE_CDROM_AUDIO_PAGE 0x0e
#define GPMODE_CAPABILITIES_PAGE 0x2a
#define GPMODE_IOMEGA_PAGE 0x2f
#define GPMODE_UNK_VENDOR_PAGE 0x30
#define GPMODE_ALL_PAGES 0x3f
#define GPMODE_CDROM_PAGE 0x0d
#define GPMODE_CDROM_AUDIO_PAGE 0x0e
#define GPMODE_CAPABILITIES_PAGE 0x2a
#define GPMODE_IOMEGA_PAGE 0x2f
#define GPMODE_UNK_VENDOR_PAGE 0x30
#define GPMODE_ALL_PAGES 0x3f
/* Mode page codes for presence */
#define GPMODEP_R_W_ERROR_PAGE 0x0000000000000002LL
#define GPMODEP_DISCONNECT_PAGE 0x0000000000000004LL
#define GPMODEP_FORMAT_DEVICE_PAGE 0x0000000000000008LL
#define GPMODEP_RIGID_DISK_PAGE 0x0000000000000010LL
#define GPMODEP_FLEXIBLE_DISK_PAGE 0x0000000000000020LL
#define GPMODEP_CACHING_PAGE 0x0000000000000100LL
#define GPMODEP_CDROM_PAGE_SONY 0x0000000000000200LL
#define GPMODEP_R_W_ERROR_PAGE 0x0000000000000002LL
#define GPMODEP_DISCONNECT_PAGE 0x0000000000000004LL
#define GPMODEP_FORMAT_DEVICE_PAGE 0x0000000000000008LL
#define GPMODEP_RIGID_DISK_PAGE 0x0000000000000010LL
#define GPMODEP_FLEXIBLE_DISK_PAGE 0x0000000000000020LL
#define GPMODEP_CACHING_PAGE 0x0000000000000100LL
#define GPMODEP_CDROM_PAGE_SONY 0x0000000000000200LL
#define GPMODEP_CDROM_AUDIO_PAGE_SONY 0x0000000000000400LL
#define GPMODEP_CDROM_PAGE 0x0000000000002000LL
#define GPMODEP_CDROM_AUDIO_PAGE 0x0000000000004000LL
#define GPMODEP_CAPABILITIES_PAGE 0x0000040000000000LL
#define GPMODEP_IOMEGA_PAGE 0x0000800000000000LL
#define GPMODEP_UNK_VENDOR_PAGE 0x0001000000000000LL
#define GPMODEP_ALL_PAGES 0x8000000000000000LL
#define GPMODEP_CDROM_PAGE 0x0000000000002000LL
#define GPMODEP_CDROM_AUDIO_PAGE 0x0000000000004000LL
#define GPMODEP_CAPABILITIES_PAGE 0x0000040000000000LL
#define GPMODEP_IOMEGA_PAGE 0x0000800000000000LL
#define GPMODEP_UNK_VENDOR_PAGE 0x0001000000000000LL
#define GPMODEP_ALL_PAGES 0x8000000000000000LL
/* SCSI Status Codes */
#define SCSI_STATUS_OK 0
@@ -349,26 +349,37 @@ typedef struct scsi_common_s {
void *p;
uint8_t *temp_buffer,
atapi_cdb[16], /* This is atapi_cdb in ATAPI-supporting devices,
and pad in SCSI-only devices. */
current_cdb[16],
sense[256];
uint8_t *temp_buffer;
uint8_t atapi_cdb[16]; /* This is atapi_cdb in ATAPI-supporting devices,
and pad in SCSI-only devices. */
uint8_t current_cdb[16];
uint8_t sense[256];
uint8_t status, phase,
error, id,
features, cur_lun,
pad0, pad1;
uint8_t status;
uint8_t phase;
uint8_t error;
uint8_t id;
uint8_t features;
uint8_t cur_lun;
uint8_t pad0;
uint8_t pad1;
uint16_t request_length, max_transfer_len;
uint16_t request_length;
uint16_t max_transfer_len;
int requested_blocks, packet_status,
total_length, do_page_save,
unit_attention, request_pos,
old_len, media_status;
int requested_blocks;
int packet_status;
int total_length;
int do_page_save;
int unit_attention;
int request_pos;
int old_len;
int media_status;
uint32_t sector_pos, sector_len,
packet_len, pos;
uint32_t sector_pos;
uint32_t sector_len;
uint32_t packet_len;
uint32_t pos;
double callback;
} scsi_common_t;
@@ -376,7 +387,8 @@ typedef struct scsi_common_s {
typedef struct {
int32_t buffer_length;
uint8_t status, phase;
uint8_t status;
uint8_t phase;
uint16_t type;
scsi_common_t *sc;

View File

@@ -21,26 +21,37 @@ typedef struct {
hard_disk_t *drv;
uint8_t *temp_buffer,
pad[16], /* This is atapi_cdb in ATAPI-supporting devices,
and pad in SCSI-only devices. */
current_cdb[16],
sense[256];
uint8_t *temp_buffer;
uint8_t pad[16]; /* This is atapi_cdb in ATAPI-supporting devices,
and pad in SCSI-only devices. */
uint8_t current_cdb[16];
uint8_t sense[256];
uint8_t status, phase,
error, id,
pad0, cur_lun,
pad1, pad2;
uint8_t status;
uint8_t phase;
uint8_t error;
uint8_t id;
uint8_t pad0;
uint8_t cur_lun;
uint8_t pad1;
uint8_t pad2;
uint16_t request_length, pad4;
uint16_t request_length;
uint16_t pad4;
int requested_blocks, packet_status,
total_length, do_page_save,
unit_attention, pad5,
pad6, pad7;
int requested_blocks;
int packet_status;
int total_length;
int do_page_save;
int unit_attention;
int pad5;
int pad6;
int pad7;
uint32_t sector_pos, sector_len,
packet_len, pos;
uint32_t sector_pos;
uint32_t sector_len;
uint32_t packet_len;
uint32_t pos;
double callback;
} scsi_disk_t;

View File

@@ -196,28 +196,28 @@
#define MAX_SG_DESCRIPTORS 32 /* Always make the array 32 elements long, if less are used, that's not an issue. */
#pragma pack(push, 1)
typedef struct {
typedef struct addr24_s {
uint8_t hi;
uint8_t mid;
uint8_t lo;
} addr24;
} addr24_t;
/* Structure for the INQUIRE_SETUP_INFORMATION reply. */
typedef struct {
uint8_t uOffset : 4,
uTransferPeriod : 3,
fSynchronous : 1;
uint8_t uOffset : 4;
uint8_t uTransferPeriod : 3;
uint8_t fSynchronous : 1;
} ReplyInquireSetupInformationSynchronousValue;
typedef struct {
uint8_t fSynchronousInitiationEnabled : 1,
fParityCheckingEnabled : 1,
uReserved1 : 6;
uint8_t fSynchronousInitiationEnabled : 1;
uint8_t fParityCheckingEnabled : 1;
uint8_t uReserved1 : 6;
uint8_t uBusTransferRate;
uint8_t uPreemptTimeOnBus;
uint8_t uTimeOffBus;
uint8_t cMailbox;
addr24 MailboxAddress;
addr24_t MailboxAddress;
ReplyInquireSetupInformationSynchronousValue SynchronousValuesId0To7[8];
uint8_t uDisconnectPermittedId0To7;
uint8_t VendorSpecificData[28];
@@ -225,12 +225,12 @@ typedef struct {
typedef struct {
uint8_t Count;
addr24 Address;
addr24_t Address;
} MailboxInit_t;
typedef struct {
uint8_t CmdStatus;
addr24 CCBPointer;
uint8_t CmdStatus;
addr24_t CCBPointer;
} Mailbox_t;
typedef struct {
@@ -278,20 +278,20 @@ typedef struct {
} CCB32;
typedef struct {
uint8_t Opcode;
uint8_t Lun : 3,
ControlByte : 2,
Id : 3;
uint8_t CdbLength;
uint8_t RequestSenseLength;
addr24 DataLength;
addr24 DataPointer;
addr24 LinkPointer;
uint8_t LinkId;
uint8_t HostStatus;
uint8_t TargetStatus;
uint8_t Reserved[2];
uint8_t Cdb[12];
uint8_t Opcode;
uint8_t Lun : 3;
uint8_t ControlByte : 2;
uint8_t Id : 3;
uint8_t CdbLength;
uint8_t RequestSenseLength;
addr24_t DataLength;
addr24_t DataPointer;
addr24_t LinkPointer;
uint8_t LinkId;
uint8_t HostStatus;
uint8_t TargetStatus;
uint8_t Reserved[2];
uint8_t Cdb[12];
} CCB;
typedef struct {
@@ -347,7 +347,7 @@ typedef struct
} lba;
} u;
uint8_t secount;
addr24 dma_address;
addr24_t dma_address;
} BIOSCMD;
typedef struct {
@@ -356,8 +356,8 @@ typedef struct {
} SGE32;
typedef struct {
addr24 Segment;
addr24 SegmentPointer;
addr24_t Segment;
addr24_t SegmentPointer;
} SGE;
#pragma pack(pop)

View File

@@ -48,23 +48,52 @@ struct serial_device_s;
struct serial_s;
typedef struct serial_s {
uint8_t lsr, thr, mctrl, rcr,
iir, ier, lcr, msr,
dat, int_status, scratch, fcr,
irq, type, inst, transmit_enabled,
fifo_enabled, rcvr_fifo_len, bits, data_bits,
baud_cycles, rcvr_fifo_full, txsr, out,
msr_set, pad, pad0, pad1;
uint8_t lsr;
uint8_t thr;
uint8_t mctrl;
uint8_t rcr;
uint8_t iir;
uint8_t ier;
uint8_t lcr;
uint8_t msr;
uint8_t dat;
uint8_t int_status;
uint8_t scratch;
uint8_t fcr;
uint8_t irq;
uint8_t type;
uint8_t inst;
uint8_t transmit_enabled;
uint8_t fifo_enabled;
uint8_t rcvr_fifo_len;
uint8_t bits;
uint8_t data_bits;
uint8_t baud_cycles;
uint8_t rcvr_fifo_full;
uint8_t txsr;
uint8_t out;
uint8_t msr_set;
uint8_t pad;
uint8_t pad0;
uint8_t pad1;
uint16_t dlab, base_address, out_new, pad2;
uint16_t dlab;
uint16_t base_address;
uint16_t out_new;
uint16_t pad2;
uint8_t rcvr_fifo_pos, xmit_fifo_pos,
rcvr_fifo_end, xmit_fifo_end,
rcvr_fifo[SERIAL_FIFO_SIZE], xmit_fifo[SERIAL_FIFO_SIZE];
uint8_t rcvr_fifo_pos;
uint8_t xmit_fifo_pos;
uint8_t rcvr_fifo_end;
uint8_t xmit_fifo_end;
uint8_t rcvr_fifo[SERIAL_FIFO_SIZE];
uint8_t xmit_fifo[SERIAL_FIFO_SIZE];
pc_timer_t transmit_timer, timeout_timer,
receive_timer;
double clock_src, transmit_period;
pc_timer_t transmit_timer;
pc_timer_t timeout_timer;
pc_timer_t receive_timer;
double clock_src;
double transmit_period;
struct serial_device_s *sd;
} serial_t;

View File

@@ -43,7 +43,8 @@ typedef struct serial_passthrough_s {
pc_timer_t serial_to_host_timer;
serial_t *serial;
double baudrate;
uint8_t bits, data_bits;
uint8_t bits;
uint8_t data_bits;
uint8_t port;
uint8_t data;
char slave_pt[32]; /* used for pseudo term name of slave side */

View File

@@ -26,27 +26,39 @@
enum {
SMBUS_PIIX4 = 0,
SMBUS_VIA
SMBUS_VIA = 1
};
typedef struct {
uint32_t local;
uint16_t io_base;
int clock;
double bit_period;
uint8_t stat, next_stat, ctl, cmd, addr,
data0, data1,
index, data[SMBUS_PIIX4_BLOCK_DATA_SIZE];
uint32_t local;
uint16_t io_base;
int clock;
double bit_period;
uint8_t stat;
uint8_t next_stat;
uint8_t ctl;
uint8_t cmd;
uint8_t addr;
uint8_t data0;
uint8_t data1;
uint8_t index;
uint8_t data[SMBUS_PIIX4_BLOCK_DATA_SIZE];
pc_timer_t response_timer;
void *i2c;
} smbus_piix4_t;
typedef struct {
uint32_t local;
uint16_t io_base;
uint8_t stat, next_stat, ctl, cmd, addr,
data0, data1,
index, data[SMBUS_ALI7101_BLOCK_DATA_SIZE];
uint32_t local;
uint16_t io_base;
uint8_t stat;
uint8_t next_stat;
uint8_t ctl;
uint8_t cmd;
uint8_t addr;
uint8_t data0;
uint8_t data1;
uint8_t index;
uint8_t data[SMBUS_ALI7101_BLOCK_DATA_SIZE];
pc_timer_t response_timer;
void *i2c;
} smbus_ali7101_t;

View File

@@ -19,13 +19,16 @@
#define EMU_SMRAM_H
typedef struct _smram_ {
struct _smram_ *prev, *next;
struct _smram_ *prev;
struct _smram_ *next;
mem_mapping_t mapping;
uint32_t host_base, ram_base,
size,
old_host_base, old_size;
uint32_t host_base;
uint32_t ram_base;
uint32_t size;
uint32_t old_host_base;
uint32_t old_size;
} smram_t;
/* Make a backup copy of host_base and size of all the SMRAM structs, needed so that if

View File

@@ -93,14 +93,14 @@
/* New codecs should be added to the end of this enum to avoid breaking configs. */
enum {
AC97_CODEC_AD1881 = 0,
AC97_CODEC_ALC100,
AC97_CODEC_CS4297,
AC97_CODEC_CS4297A,
AC97_CODEC_WM9701A,
AC97_CODEC_STAC9708,
AC97_CODEC_STAC9721,
AC97_CODEC_AK4540
AC97_CODEC_AD1881 = 0,
AC97_CODEC_ALC100 = 1,
AC97_CODEC_CS4297 = 2,
AC97_CODEC_CS4297A = 3,
AC97_CODEC_WM9701A = 4,
AC97_CODEC_STAC9708 = 5,
AC97_CODEC_STAC9721 = 6,
AC97_CODEC_AK4540 = 7
};
typedef struct {

View File

@@ -24,26 +24,42 @@
enum {
AD1848_TYPE_DEFAULT = 0,
AD1848_TYPE_CS4248,
AD1848_TYPE_CS4231,
AD1848_TYPE_CS4235,
AD1848_TYPE_CS4236
AD1848_TYPE_CS4248 = 1,
AD1848_TYPE_CS4231 = 2,
AD1848_TYPE_CS4235 = 3,
AD1848_TYPE_CS4236 = 4
};
typedef struct {
uint8_t type, index, xindex, regs[32], xregs[32], status; /* 16 original registers + 16 CS4231A extensions + 32 CS4236 extensions */
uint8_t type;
uint8_t index;
uint8_t xindex;
uint8_t regs[32];
uint8_t xregs[32];
uint8_t status; /* 16 original registers + 16 CS4231A extensions + 32 CS4236 extensions */
int count;
uint8_t trd, mce, wten : 1;
uint8_t trd;
uint8_t mce;
uint8_t wten : 1;
int16_t out_l, out_r;
double cd_vol_l, cd_vol_r;
int fm_vol_l, fm_vol_r;
uint8_t fmt_mask, wave_vol_mask;
int16_t out_l;
int16_t out_r;
double cd_vol_l;
double cd_vol_r;
int fm_vol_l;
int fm_vol_r;
uint8_t fmt_mask;
uint8_t wave_vol_mask;
uint8_t enable : 1, irq : 4, dma : 3, adpcm_ref;
uint8_t enable : 1;
uint8_t irq : 4;
uint8_t dma : 3;
uint8_t adpcm_ref;
int8_t adpcm_step;
int freq, adpcm_data, adpcm_pos;
int freq;
int adpcm_data;
int adpcm_pos;
pc_timer_t timer_count;
uint64_t timer_latch;

View File

@@ -85,10 +85,14 @@ typedef struct emu8k_mem_pointers_t {
*/
typedef struct emu8k_envelope_t {
int state;
int32_t delay_samples, hold_samples, attack_samples;
int32_t value_amp_hz, value_db_oct;
int32_t delay_samples;
int32_t hold_samples;
int32_t attack_samples;
int32_t value_amp_hz;
int32_t value_db_oct;
int32_t sustain_value_db_oct;
int32_t attack_amount_amp_hz, ramp_amount_db_oct;
int32_t attack_amount_amp_hz;
int32_t ramp_amount_db_oct;
} emu8k_envelope_t;
typedef struct emu8k_chorus_eng_t {
@@ -320,10 +324,14 @@ typedef struct emu8k_voice_t {
emu8k_envelope_t vol_envelope;
emu8k_envelope_t mod_envelope;
int64_t lfo1_speed, lfo2_speed;
emu8k_mem_internal_t lfo1_count, lfo2_count;
int32_t lfo1_delay_samples, lfo2_delay_samples;
int vol_l, vol_r;
int64_t lfo1_speed;
int64_t lfo2_speed;
emu8k_mem_internal_t lfo1_count;
emu8k_mem_internal_t lfo2_count;
int32_t lfo1_delay_samples;
int32_t lfo2_delay_samples;
int vol_l;
int vol_r;
int16_t fixed_modenv_filter_height;
int16_t fixed_modenv_pitch_height;
@@ -342,28 +350,44 @@ typedef struct emu8k_voice_t {
typedef struct emu8k_t {
emu8k_voice_t voice[32];
uint16_t hwcf1, hwcf2, hwcf3;
uint32_t hwcf4, hwcf5, hwcf6, hwcf7;
uint16_t hwcf1;
uint16_t hwcf2;
uint16_t hwcf3;
uint32_t hwcf4;
uint32_t hwcf5;
uint32_t hwcf6;
uint32_t hwcf7;
uint16_t init1[32], init2[32], init3[32], init4[32];
uint16_t init1[32];
uint16_t init2[32];
uint16_t init3[32];
uint16_t init4[32];
uint32_t smalr, smarr, smalw, smarw;
uint16_t smld_buffer, smrd_buffer;
uint32_t smalr;
uint32_t smarr;
uint32_t smalw;
uint32_t smarw;
uint16_t smld_buffer;
uint16_t smrd_buffer;
uint16_t wc;
uint16_t id;
/* The empty block is used to act as an unallocated memory returning zero. */
int16_t *ram, *rom, *empty;
int16_t *ram;
int16_t *rom;
int16_t *empty;
/* RAM pointers are a way to avoid checking ram boundaries on read */
int16_t *ram_pointers[0x100];
uint32_t ram_end_addr;
int cur_reg, cur_voice;
int cur_reg;
int cur_voice;
int16_t out_l, out_r;
int16_t out_l;
int16_t out_r;
emu8k_chorus_eng_t chorus_engine;
int32_t chorus_in_buffer[SOUNDBUFLEN];

View File

@@ -71,74 +71,112 @@ typedef enum RecState {
typedef struct mpu_t {
uint16_t addr;
int uart_mode, intelligent,
irq, midi_thru,
queue_pos, queue_used;
uint8_t rx_data, is_mca,
status,
queue[MPU401_QUEUE], pos_regs[8];
int uart_mode;
int intelligent;
int irq;
int midi_thru;
int queue_pos;
int queue_used;
uint8_t rx_data;
uint8_t is_mca;
uint8_t status;
uint8_t queue[MPU401_QUEUE];
uint8_t pos_regs[8];
MpuMode mode;
uint8_t rec_queue[MPU401_INPUT_QUEUE];
int rec_queue_pos, rec_queue_used;
int rec_queue_pos;
int rec_queue_used;
uint32_t ch_toref[16];
struct track {
int counter;
uint8_t value[3], sys_val,
vlength, length;
int counter;
uint8_t value[3];
uint8_t sys_val;
uint8_t vlength;
uint8_t length;
MpuDataType type;
} playbuf[8], condbuf;
struct {
int conductor, cond_req,
cond_set, block_ack,
playing, reset,
wsd, wsm, wsd_start,
run_irq, irq_pending,
track_req,
send_now, eoi_scheduled,
data_onoff, clock_to_host,
sync_in, sysex_in_finished,
rec_copy;
int conductor;
int cond_req;
int cond_set;
int block_ack;
int playing;
int reset;
int wsd;
int wsm;
int wsd_start;
int run_irq;
int irq_pending;
int track_req;
int send_now;
int eoi_scheduled;
int data_onoff;
int clock_to_host;
int sync_in;
int sysex_in_finished;
int rec_copy;
RecState rec;
uint8_t tmask, cmask,
amask,
last_rtcmd;
uint16_t midi_mask, req_mask;
uint32_t command_byte, cmd_pending,
track, old_track;
uint8_t tmask;
uint8_t cmask;
uint8_t amask;
uint8_t last_rtcmd;
uint16_t midi_mask;
uint16_t req_mask;
uint32_t command_byte;
uint32_t cmd_pending;
uint32_t track;
uint32_t old_track;
} state;
struct {
uint8_t timebase, old_timebase,
tempo, old_tempo,
tempo_rel, old_tempo_rel,
tempo_grad, cth_rate[4],
cth_mode, midimetro,
metromeas;
uint32_t cth_counter, cth_old,
rec_counter;
int32_t measure_counter, meas_old,
freq;
int ticks_in, active;
float freq_mod;
uint8_t timebase;
uint8_t old_timebase;
uint8_t tempo;
uint8_t old_tempo;
uint8_t tempo_rel;
uint8_t old_tempo_rel;
uint8_t tempo_grad;
uint8_t cth_rate[4];
uint8_t cth_mode;
uint8_t midimetro;
uint8_t metromeas;
uint32_t cth_counter;
uint32_t cth_old;
uint32_t rec_counter;
int32_t measure_counter;
int32_t meas_old;
int32_t freq;
int ticks_in;
int active;
float freq_mod;
} clock;
struct {
int all_thru, midi_thru,
sysex_thru, commonmsgs_thru,
modemsgs_in, commonmsgs_in,
bender_in, sysex_in,
allnotesoff_out, rt_affection,
rt_out, rt_in,
timing_in_stop, data_in_stop,
rec_measure_end;
int all_thru;
int midi_thru;
int sysex_thru;
int commonmsgs_thru;
int modemsgs_in;
int commonmsgs_in;
int bender_in;
int sysex_in;
int allnotesoff_out;
int rt_affection;
int rt_out;
int rt_in;
int timing_in_stop;
int data_in_stop;
int rec_measure_end;
uint8_t prchg_buf[16];
uint16_t prchg_mask;
} filter;
struct {
int on;
uint8_t chan, trmask;
uint8_t chan;
uint8_t trmask;
uint32_t key[4];
} chanref[5], inputref[16];
pc_timer_t mpu401_event_callback, mpu401_eoi_callback,
mpu401_reset_callback;
pc_timer_t mpu401_event_callback;
pc_timer_t mpu401_eoi_callback;
pc_timer_t mpu401_reset_callback;
void (*ext_irq_update)(void *priv, int set);
int (*ext_irq_pending)(void *priv);
void *priv;

View File

@@ -18,17 +18,17 @@
#define SOUND_OPL_H
enum fm_type {
FM_YM3812 = 0,
FM_YMF262,
FM_YMF289B,
FM_YMF278B,
FM_MAX
FM_YM3812 = 0, /* OPL2 */
FM_YMF262 = 1, /* OPL3 */
FM_YMF289B = 2, /* OPL3-L */
FM_YMF278B = 3, /* OPL 4 */
FM_MAX = 4
};
enum fm_driver {
FM_DRV_NUKED = 0,
FM_DRV_YMFM,
FM_DRV_MAX
FM_DRV_YMFM = 1,
FM_DRV_MAX = 2
};
typedef struct {

View File

@@ -48,16 +48,16 @@ typedef struct sb_ct1335_mixer_t {
/* SB PRO */
typedef struct sb_ct1345_mixer_t {
double master_l,
master_r;
double voice_l,
voice_r;
double fm_l,
fm_r;
double cd_l,
cd_r;
double line_l,
line_r;
double master_l;
double master_r;
double voice_l;
double voice_r;
double fm_l;
double fm_r;
double cd_l;
double cd_r;
double line_l;
double line_r;
double mic;
/*see sb_ct1745_mixer for values for input selector*/
int32_t input_selector;
@@ -76,23 +76,23 @@ typedef struct sb_ct1345_mixer_t {
/* SB16 and AWE32 */
typedef struct sb_ct1745_mixer_t {
double master_l,
master_r;
double voice_l,
voice_r;
double fm_l,
fm_r;
double cd_l,
cd_r;
double line_l,
line_r;
double master_l;
double master_r;
double voice_l;
double voice_r;
double fm_l;
double fm_r;
double cd_l;
double cd_r;
double line_l;
double line_r;
double mic;
double speaker;
int bass_l,
bass_r;
int treble_l,
treble_r;
int bass_l;
int bass_r;
int treble_l;
int treble_r;
int output_selector;
#define OUTPUT_MIC 1
@@ -125,12 +125,12 @@ typedef struct sb_ct1745_mixer_t {
} sb_ct1745_mixer_t;
typedef struct sb_t {
uint8_t cms_enabled,
opl_enabled,
mixer_enabled;
uint8_t cms_enabled;
uint8_t opl_enabled;
uint8_t mixer_enabled;
cms_t cms;
fm_drv_t opl,
opl2;
fm_drv_t opl;
fm_drv_t opl2;
sb_dsp_t dsp;
union {
sb_ct1335_mixer_t mixer_sb2;
@@ -143,8 +143,8 @@ typedef struct sb_t {
int pos;
uint8_t pos_regs[8],
pnp_rom[512];
uint8_t pos_regs[8];
uint8_t pnp_rom[512];
uint16_t opl_pnp_addr;

View File

@@ -15,19 +15,34 @@ typedef struct sb_dsp_t {
int sb_subtype; /* which clone */
void *parent; /* "sb_t *" if default subtype, "azt2316a_t *" if aztech. */
int sb_8_length, sb_8_origlength, sb_8_format, sb_8_autoinit, sb_8_pause, sb_8_enable, sb_8_autolen, sb_8_output;
int sb_8_length;
int sb_8_origlength;
int sb_8_format;
int sb_8_autoinit;
int sb_8_pause;
int sb_8_enable;
int sb_8_autolen;
int sb_8_output;
int sb_8_dmanum;
int sb_16_length, sb_16_origlength, sb_16_format, sb_16_autoinit, sb_16_pause, sb_16_enable, sb_16_autolen, sb_16_output;
int sb_16_length;
int sb_16_origlength;
int sb_16_format;
int sb_16_autoinit;
int sb_16_pause;
int sb_16_enable;
int sb_16_autolen;
int sb_16_output;
int sb_16_dmanum;
int sb_pausetime;
int (*dma_readb)(void *priv),
(*dma_readw)(void *priv),
(*dma_writeb)(void *priv, uint8_t val),
(*dma_writew)(void *priv, uint16_t val);
int (*dma_readb)(void *priv);
int (*dma_readw)(void *priv);
int (*dma_writeb)(void *priv, uint8_t val);
int (*dma_writew)(void *priv, uint16_t val);
void *dma_priv;
uint8_t sb_read_data[256];
int sb_read_wp, sb_read_rp;
int sb_read_wp;
int sb_read_rp;
int sb_speaker;
int muted;
@@ -41,8 +56,8 @@ typedef struct sb_dsp_t {
int midi_in_timestamp;
int sb_irqnum;
void (*irq_update)(void *priv, int set),
*irq_priv;
void (*irq_update)(void *priv, int set);
void *irq_priv;
uint8_t sbe2;
int sbe2count;
@@ -53,23 +68,30 @@ typedef struct sb_dsp_t {
int16_t sbdat;
int sbdat2;
int16_t sbdatl, sbdatr;
int16_t sbdatl;
int16_t sbdatr;
uint8_t sbref;
int8_t sbstep;
int sbdacpos;
int sbleftright, sbleftright_default;
int sbleftright;
int sbleftright_default;
int sbreset;
uint8_t sbreaddat;
uint8_t sb_command;
uint8_t sb_test;
int sb_timei, sb_timeo;
int sb_timei;
int sb_timeo;
int sb_irq8, sb_irq16, sb_irq401;
int sb_irqm8, sb_irqm16, sb_irqm401;
int sb_irq8;
int sb_irq16;
int sb_irq401;
int sb_irqm8;
int sb_irqm16;
int sb_irqm401;
uint8_t sb_asp_regs[256];
uint8_t sb_asp_mode;
@@ -79,11 +101,14 @@ typedef struct sb_dsp_t {
uint8_t sb_8051_ram[256];
int sbenable, sb_enable_i;
int sbenable;
int sb_enable_i;
pc_timer_t output_timer, input_timer;
pc_timer_t output_timer;
pc_timer_t input_timer;
double sblatcho, sblatchi;
double sblatcho;
double sblatchi;
uint16_t sb_addr;

View File

@@ -14,8 +14,10 @@ extern int sn76489_mute;
typedef struct sn76489_t {
int stat[4];
int latch[4], count[4];
int freqlo[4], freqhi[4];
int latch[4];
int count[4];
int freqlo[4];
int freqhi[4];
int vol[4];
uint32_t shift;
uint8_t noise;

View File

@@ -2,19 +2,26 @@
#define SOUND_YM7128_H
typedef struct ym7128_t {
int a0, sci;
int a0;
int sci;
uint8_t dat;
int reg_sel;
uint8_t regs[32];
int gl[8], gr[8];
int vm, vc, vl, vr;
int c0, c1;
int gl[8];
int gr[8];
int vm;
int vc;
int vl;
int vr;
int c0;
int c1;
int t[9];
int16_t filter_dat;
int16_t prev_l, prev_r;
int16_t prev_l;
int16_t prev_r;
int16_t delay_buffer[2400];
int delay_pos;

View File

@@ -46,49 +46,92 @@
#define SPD_SDR_ATTR_VCC_LOW_5 0x10
#define SPD_SDR_ATTR_VCC_HI_5 0x20
typedef struct {
uint8_t bytes_used, spd_size, mem_type,
row_bits, col_bits, banks,
data_width_lsb, data_width_msb,
signal_level, trac, tcac,
config, refresh_rate,
dram_width, ecc_width,
reserved[47],
spd_rev, checksum,
mfg_jedec[8], mfg_loc;
typedef struct spd_edo_t {
uint8_t bytes_used;
uint8_t spd_size;
uint8_t mem_type;
uint8_t row_bits;
uint8_t col_bits;
uint8_t banks;
uint8_t data_width_lsb;
uint8_t data_width_msb;
uint8_t signal_level;
uint8_t trac;
uint8_t tcac;
uint8_t config;
uint8_t refresh_rate;
uint8_t dram_width;
uint8_t ecc_width;
uint8_t reserved[47];
uint8_t spd_rev;
uint8_t checksum;
uint8_t mfg_jedec[8];
uint8_t mfg_loc;
char part_no[18];
uint8_t rev_code[2],
mfg_year, mfg_week, serial[4], mfg_specific[27],
vendor_specific[2],
other_data[127],
checksum2;
uint8_t rev_code[2];
uint8_t mfg_year;
uint8_t mfg_week;
uint8_t serial[4];
uint8_t mfg_specific[27];
uint8_t vendor_specific[2];
uint8_t other_data[127];
uint8_t checksum2;
} spd_edo_t;
typedef struct {
uint8_t bytes_used, spd_size, mem_type,
row_bits, col_bits, rows,
data_width_lsb, data_width_msb,
signal_level, tclk, tac,
config, refresh_rate,
sdram_width, ecc_width,
tccd, burst, banks, cas, cslat, we,
mod_attr, dev_attr,
tclk2, tac2, tclk3, tac3,
trp, trrd, trcd, tras,
bank_density,
ca_setup, ca_hold, data_setup, data_hold,
reserved[26],
spd_rev, checksum,
mfg_jedec[8], mfg_loc;
typedef struct spd_sdram_t {
uint8_t bytes_used;
uint8_t spd_size;
uint8_t mem_type;
uint8_t row_bits;
uint8_t col_bits;
uint8_t rows;
uint8_t data_width_lsb;
uint8_t data_width_msb;
uint8_t signal_level;
uint8_t tclk;
uint8_t tac;
uint8_t config;
uint8_t refresh_rate;
uint8_t sdram_width;
uint8_t ecc_width;
uint8_t tccd;
uint8_t burst;
uint8_t banks;
uint8_t cas;
uint8_t cslat;
uint8_t we;
uint8_t mod_attr;
uint8_t dev_attr;
uint8_t tclk2;
uint8_t tac2;
uint8_t tclk3;
uint8_t tac3;
uint8_t trp;
uint8_t trrd;
uint8_t trcd;
uint8_t tras;
uint8_t bank_density;
uint8_t ca_setup;
uint8_t ca_hold;
uint8_t data_setup;
uint8_t data_hold;
uint8_t reserved[26];
uint8_t spd_rev, checksum;
uint8_t mfg_jedec[8];
uint8_t mfg_loc;
char part_no[18];
uint8_t rev_code[2],
mfg_year, mfg_week, serial[4], mfg_specific[27],
freq, features,
other_data[127],
checksum2;
uint8_t rev_code[2];
uint8_t mfg_year;
uint8_t mfg_week;
uint8_t serial[4];
uint8_t mfg_specific[27];
uint8_t freq;
uint8_t features;
uint8_t other_data[127];
uint8_t checksum2;
} spd_sdram_t;
typedef struct {
typedef struct spd_t {
uint8_t slot;
uint16_t size;
uint16_t row1;

View File

@@ -11,14 +11,14 @@
#define TIMER_ENABLED 1
#pragma pack(push, 1)
typedef struct
typedef struct ts_struct_t
{
uint32_t frac;
uint32_t integer;
} ts_struct_t;
#pragma pack(pop)
typedef union {
typedef union ts_t {
uint64_t ts64;
ts_struct_t ts32;
} ts_t;
@@ -42,14 +42,16 @@ typedef struct pc_timer_t {
#else
ts_t ts;
#endif
int flags, pad; /* The flags are defined above. */
double period; /* This is used for large period timers to count
the microseconds and split the period. */
int flags; /* The flags are defined above. */
int pad;
double period; /* This is used for large period timers to count
the microseconds and split the period. */
void (*callback)(void *p);
void *p;
struct pc_timer_t *prev, *next;
struct pc_timer_t *prev;
struct pc_timer_t *next;
} pc_timer_t;
#ifdef __cplusplus

View File

@@ -27,28 +27,28 @@ typedef struct usb_device_t usb_device_t;
enum usb_pid
{
USB_PID_OUT = 0xE1,
USB_PID_IN = 0x69,
USB_PID_OUT = 0xE1,
USB_PID_IN = 0x69,
USB_PID_SETUP = 0x2D
};
enum usb_errors
{
USB_ERROR_NO_ERROR = 0,
USB_ERROR_NAK = 1,
USB_ERROR_OVERRUN = 2,
USB_ERROR_NAK = 1,
USB_ERROR_OVERRUN = 2,
USB_ERROR_UNDERRUN = 3
};
enum usb_bus_types
{
USB_BUS_OHCI = 0,
USB_BUS_UHCI,
USB_BUS_MAX
USB_BUS_UHCI = 1,
USB_BUS_MAX = 2
};
/* USB device creation parameters struct */
typedef struct
typedef struct usb_params_t
{
void (*update_interrupt)(usb_t*, void*);
/* Handle (but do not raise) SMI. Returns 1 if SMI can be raised, 0 otherwise. */
@@ -69,24 +69,26 @@ typedef struct usb_t
uint8_t uhci_io[32];
ohci_mmio_t ohci_mmio[1024];
uint16_t uhci_io_base;
int uhci_enable, ohci_enable;
uint32_t ohci_mem_base, irq_level;
int uhci_enable;
int ohci_enable;
uint32_t ohci_mem_base;
uint32_t irq_level;
mem_mapping_t ohci_mmio_mapping;
pc_timer_t ohci_frame_timer;
pc_timer_t ohci_port_reset_timer[2];
uint8_t ohci_interrupt_counter : 3;
usb_device_t* ohci_devices[2];
usb_device_t* uhci_devices[2];
usb_device_t *ohci_devices[2];
usb_device_t *uhci_devices[2];
uint8_t ohci_usb_buf[4096];
uint8_t ohci_initial_start;
usb_params_t* usb_params;
usb_params_t *usb_params;
} usb_t;
#pragma pack(push, 1)
/* Base USB descriptor struct. */
typedef struct
typedef struct usb_desc_base_t
{
uint8_t bLength;
uint8_t bDescriptorType;
@@ -94,46 +96,46 @@ typedef struct
enum usb_desc_setup_req_types
{
USB_SETUP_TYPE_DEVICE = 0x0,
USB_SETUP_TYPE_DEVICE = 0x0,
USB_SETUP_TYPE_INTERFACE = 0x1,
USB_SETUP_TYPE_ENDPOING = 0x2,
USB_SETUP_TYPE_OTHER = 0x3,
USB_SETUP_TYPE_ENDPOING = 0x2,
USB_SETUP_TYPE_OTHER = 0x3,
};
#define USB_SETUP_TYPE_MAX 0x1F
#define USB_SETUP_DEV_TO_HOST 0x80
typedef struct
typedef struct usb_desc_setup_t
{
uint8_t bmRequestType;
uint8_t bRequest;
uint8_t bmRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} usb_desc_setup_t;
typedef struct
typedef struct usb_desc_endpoint_t
{
usb_desc_base_t base;
uint8_t bEndpointAddress;
uint8_t bmAttributes;
uint16_t wMaxPacketSize;
uint8_t bInterval;
uint8_t bEndpointAddress;
uint8_t bmAttributes;
uint16_t wMaxPacketSize;
uint8_t bInterval;
} usb_desc_endpoint_t;
typedef struct
typedef struct usb_desc_hid_t
{
usb_desc_base_t base;
uint16_t bcdHID;
uint8_t bCountryCode;
uint8_t bNumDescriptors;
uint8_t bDescriptorType;
uint8_t bCountryCode;
uint8_t bNumDescriptors;
uint8_t bDescriptorType;
uint16_t wDescriptorLength;
} usb_desc_hid_t;
typedef struct
typedef struct usb_desc_interface_t
{
usb_desc_base_t base;
@@ -146,13 +148,13 @@ typedef struct
uint8_t iInterface;
} usb_desc_interface_t;
typedef struct
typedef struct usb_desc_string_t
{
usb_desc_base_t base;
uint16_t bString[];
uint16_t bString[];
} usb_desc_string_t;
typedef struct
typedef struct usb_desc_conf_t
{
usb_desc_base_t base;
@@ -164,22 +166,22 @@ typedef struct
uint8_t bMaxPower;
} usb_desc_conf_t;
typedef struct
typedef struct usb_desc_device_t
{
usb_desc_base_t base;
uint16_t bcdUSB;
uint8_t bDeviceClass;
uint8_t bDeviceSubClass;
uint8_t bDeviceProtocol;
uint8_t bMaxPacketSize;
uint8_t bDeviceClass;
uint8_t bDeviceSubClass;
uint8_t bDeviceProtocol;
uint8_t bMaxPacketSize;
uint16_t idVendor;
uint16_t idProduct;
uint16_t bcdDevice;
uint8_t iManufacturer;
uint8_t iProduct;
uint8_t iSerialNumber;
uint8_t bNumConfigurations;
uint8_t iManufacturer;
uint8_t iProduct;
uint8_t iSerialNumber;
uint8_t bNumConfigurations;
} usb_desc_device_t;
#pragma pack(pop)
@@ -189,7 +191,7 @@ typedef struct usb_device_t
{
usb_desc_device_t device_desc;
struct {
usb_desc_conf_t conf_desc;
usb_desc_conf_t conf_desc;
usb_desc_base_t* other_descs[16];
} conf_desc_items;

View File

@@ -103,17 +103,21 @@ extern "C" {
#endif
extern HINSTANCE hinstance;
extern HWND hwndMain,
hwndRender,
hwndRender2;
extern HANDLE ghMutex;
extern HICON hIcon[256];
extern int dpi;
extern RECT oldclip;
extern int sbar_height, tbar_height, user_resize;
extern int acp_utf8;
extern HWND hwndMain;
extern HWND hwndRender;
extern HWND hwndRender2;
extern HANDLE ghMutex;
extern HICON hIcon[256];
extern int dpi;
extern RECT oldclip;
extern int sbar_height;
extern int tbar_height;
extern int user_resize;
extern int acp_utf8;
// extern int status_is_open;
#if 0
extern int status_is_open;
#endif
extern char openfilestring[512];
extern WCHAR wopenfilestring[512];

View File

@@ -32,60 +32,75 @@
enum {
ZIP_BUS_DISABLED = 0,
ZIP_BUS_ATAPI = 5,
ZIP_BUS_SCSI,
ZIP_BUS_USB
ZIP_BUS_SCSI = 6,
ZIP_BUS_USB = 7
};
typedef struct {
typedef struct zip_drive_t {
uint8_t id;
union {
uint8_t res, res0, /* Reserved for other ID's. */
res1,
ide_channel, scsi_device_id;
uint8_t res;
uint8_t res0; /* Reserved for other ID's. */
uint8_t res1;
uint8_t ide_channel;
uint8_t scsi_device_id;
};
uint8_t bus_type, /* 0 = ATAPI, 1 = SCSI */
bus_mode, /* Bit 0 = PIO suported;
Bit 1 = DMA supportd. */
read_only, /* Struct variable reserved for
media status. */
pad, pad0;
uint8_t bus_type; /* 0 = ATAPI, 1 = SCSI */
uint8_t bus_mode; /* Bit 0 = PIO suported;
Bit 1 = DMA supportd. */
uint8_t read_only; /* Struct variable reserved for
media status. */
uint8_t pad;
uint8_t pad0;
FILE *f;
void *priv;
char image_path[1024],
prev_image_path[1024];
char image_path[1024];
char prev_image_path[1024];
uint32_t is_250, medium_size,
base;
uint32_t is_250;
uint32_t medium_size;
uint32_t base;
} zip_drive_t;
typedef struct {
typedef struct zip_t {
mode_sense_pages_t ms_pages_saved;
zip_drive_t *drv;
uint8_t *buffer,
atapi_cdb[16],
current_cdb[16],
sense[256];
uint8_t *buffer;
uint8_t atapi_cdb[16];
uint8_t current_cdb[16];
uint8_t sense[256];
uint8_t status, phase,
error, id,
features, cur_lun,
pad0, pad1;
uint8_t status;
uint8_t phase;
uint8_t error;
uint8_t id;
uint8_t features;
uint8_t cur_lun;
uint8_t pad0;
uint8_t pad1;
uint16_t request_length, max_transfer_len;
uint16_t request_length;
uint16_t max_transfer_len;
int requested_blocks, packet_status,
total_length, do_page_save,
unit_attention, request_pos,
old_len, pad3;
int requested_blocks;
int packet_status;
int total_length;
int do_page_save;
int unit_attention;
int request_pos;
int old_len;
int pad3;
uint32_t sector_pos, sector_len,
packet_len, pos;
uint32_t sector_pos;
uint32_t sector_len;
uint32_t packet_len;
uint32_t pos;
double callback;
} zip_t;