mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
hw/m68k: add VIA support
Inside the 680x0 Macintosh, VIA (Versatile Interface Adapter) is used to interface the keyboard, Mouse, and real-time clock. It also provides control line for the floppy disk driver, video interface, sound circuitry and serial interface. This implementation is based on the MOS6522 object. Co-developed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Hervé Poussineau <hpoussin@reactos.org> Message-Id: <20191026164546.30020-6-laurent@vivier.eu>
This commit is contained in:
@@ -917,6 +917,12 @@ F: hw/m68k/next-*.c
|
||||
F: hw/display/next-fb.c
|
||||
F: include/hw/m68k/next-cube.h
|
||||
|
||||
q800
|
||||
M: Laurent Vivier <laurent@vivier.eu>
|
||||
S: Maintained
|
||||
F: hw/misc/mac_via.c
|
||||
F: include/hw/misc/mac_via.h
|
||||
|
||||
MicroBlaze Machines
|
||||
-------------------
|
||||
petalogix_s3adsp1800
|
||||
|
||||
@@ -7,3 +7,4 @@ CONFIG_SEMIHOSTING=y
|
||||
CONFIG_AN5206=y
|
||||
CONFIG_MCF5208=y
|
||||
CONFIG_NEXTCUBE=y
|
||||
CONFIG_Q800=y
|
||||
|
||||
@@ -12,3 +12,7 @@ config NEXTCUBE
|
||||
bool
|
||||
select FRAMEBUFFER
|
||||
select ESCC
|
||||
|
||||
config Q800
|
||||
bool
|
||||
select MAC_VIA
|
||||
|
||||
@@ -120,4 +120,8 @@ config AUX
|
||||
config UNIMP
|
||||
bool
|
||||
|
||||
config MAC_VIA
|
||||
bool
|
||||
select MOS6522
|
||||
|
||||
source macio/Kconfig
|
||||
|
||||
@@ -79,5 +79,6 @@ common-obj-$(CONFIG_ASPEED_SOC) += aspeed_xdma.o
|
||||
common-obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o
|
||||
common-obj-$(CONFIG_MSF2) += msf2-sysreg.o
|
||||
common-obj-$(CONFIG_NRF51_SOC) += nrf51_rng.o
|
||||
obj-$(CONFIG_MAC_VIA) += mac_via.o
|
||||
|
||||
common-obj-$(CONFIG_GRLIB) += grlib_ahb_apb_pnp.o
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2011-2018 Laurent Vivier
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef HW_MISC_MAC_VIA_H
|
||||
#define HW_MISC_MAC_VIA_H
|
||||
|
||||
#include "exec/memory.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/misc/mos6522.h"
|
||||
|
||||
|
||||
/* VIA 1 */
|
||||
#define VIA1_IRQ_ONE_SECOND_BIT 0
|
||||
#define VIA1_IRQ_VBLANK_BIT 1
|
||||
#define VIA1_IRQ_ADB_READY_BIT 2
|
||||
#define VIA1_IRQ_ADB_DATA_BIT 3
|
||||
#define VIA1_IRQ_ADB_CLOCK_BIT 4
|
||||
|
||||
#define VIA1_IRQ_NB 8
|
||||
|
||||
#define VIA1_IRQ_ONE_SECOND (1 << VIA1_IRQ_ONE_SECOND_BIT)
|
||||
#define VIA1_IRQ_VBLANK (1 << VIA1_IRQ_VBLANK_BIT)
|
||||
#define VIA1_IRQ_ADB_READY (1 << VIA1_IRQ_ADB_READY_BIT)
|
||||
#define VIA1_IRQ_ADB_DATA (1 << VIA1_IRQ_ADB_DATA_BIT)
|
||||
#define VIA1_IRQ_ADB_CLOCK (1 << VIA1_IRQ_ADB_CLOCK_BIT)
|
||||
|
||||
|
||||
#define TYPE_MOS6522_Q800_VIA1 "mos6522-q800-via1"
|
||||
#define MOS6522_Q800_VIA1(obj) OBJECT_CHECK(MOS6522Q800VIA1State, (obj), \
|
||||
TYPE_MOS6522_Q800_VIA1)
|
||||
|
||||
typedef struct MOS6522Q800VIA1State {
|
||||
/*< private >*/
|
||||
MOS6522State parent_obj;
|
||||
|
||||
qemu_irq irqs[VIA1_IRQ_NB];
|
||||
uint8_t last_b;
|
||||
uint8_t PRAM[256];
|
||||
|
||||
/* external timers */
|
||||
QEMUTimer *one_second_timer;
|
||||
int64_t next_second;
|
||||
QEMUTimer *VBL_timer;
|
||||
int64_t next_VBL;
|
||||
} MOS6522Q800VIA1State;
|
||||
|
||||
|
||||
/* VIA 2 */
|
||||
#define VIA2_IRQ_SCSI_DATA_BIT 0
|
||||
#define VIA2_IRQ_SLOT_BIT 1
|
||||
#define VIA2_IRQ_UNUSED_BIT 2
|
||||
#define VIA2_IRQ_SCSI_BIT 3
|
||||
#define VIA2_IRQ_ASC_BIT 4
|
||||
|
||||
#define VIA2_IRQ_NB 8
|
||||
|
||||
#define VIA2_IRQ_SCSI_DATA (1 << VIA2_IRQ_SCSI_DATA_BIT)
|
||||
#define VIA2_IRQ_SLOT (1 << VIA2_IRQ_SLOT_BIT)
|
||||
#define VIA2_IRQ_UNUSED (1 << VIA2_IRQ_SCSI_BIT)
|
||||
#define VIA2_IRQ_SCSI (1 << VIA2_IRQ_UNUSED_BIT)
|
||||
#define VIA2_IRQ_ASC (1 << VIA2_IRQ_ASC_BIT)
|
||||
|
||||
#define TYPE_MOS6522_Q800_VIA2 "mos6522-q800-via2"
|
||||
#define MOS6522_Q800_VIA2(obj) OBJECT_CHECK(MOS6522Q800VIA2State, (obj), \
|
||||
TYPE_MOS6522_Q800_VIA2)
|
||||
|
||||
typedef struct MOS6522Q800VIA2State {
|
||||
/*< private >*/
|
||||
MOS6522State parent_obj;
|
||||
} MOS6522Q800VIA2State;
|
||||
|
||||
|
||||
#define TYPE_MAC_VIA "mac_via"
|
||||
#define MAC_VIA(obj) OBJECT_CHECK(MacVIAState, (obj), TYPE_MAC_VIA)
|
||||
|
||||
typedef struct MacVIAState {
|
||||
SysBusDevice busdev;
|
||||
|
||||
/* MMIO */
|
||||
MemoryRegion mmio;
|
||||
MemoryRegion via1mem;
|
||||
MemoryRegion via2mem;
|
||||
|
||||
/* VIAs */
|
||||
MOS6522Q800VIA1State mos6522_via1;
|
||||
MOS6522Q800VIA2State mos6522_via2;
|
||||
|
||||
/* RTC */
|
||||
uint32_t tick_offset;
|
||||
|
||||
uint8_t data_out;
|
||||
int data_out_cnt;
|
||||
uint8_t data_in;
|
||||
uint8_t data_in_cnt;
|
||||
uint8_t cmd;
|
||||
int wprotect;
|
||||
int alt;
|
||||
|
||||
/* ADB */
|
||||
ADBBusState adb_bus;
|
||||
} MacVIAState;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user