mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 06:55:55 +00:00
[HALPC98] Add Hardware Abstraction Layer for NEC PC-98 series (#3002)
This commit is contained in:
parent
0c222cfe96
commit
b36018ff26
37 changed files with 1880 additions and 372 deletions
|
@ -7,13 +7,15 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define CPU_IO_o_RESET 0x0F
|
||||
#define CPU_IO_o_RESET 0xF0
|
||||
#define CPU_IO_o_A20_UNMASK 0xF2
|
||||
|
||||
#define CPU_IO_o_A20_CONTROL 0xF6
|
||||
#define CPU_A20_ENABLE 0x02
|
||||
#define CPU_A20_DISABLE 0x03
|
||||
|
||||
#define CPU_IO_o_FPU_BUSY_LATCH 0xF8
|
||||
|
||||
/*
|
||||
* ARTIC (A Relative Time Indication Counter) - 24-bit binary up counter
|
||||
*/
|
||||
|
|
231
sdk/include/reactos/drivers/pc98/pic.h
Normal file
231
sdk/include/reactos/drivers/pc98/pic.h
Normal file
|
@ -0,0 +1,231 @@
|
|||
/*
|
||||
* PROJECT: NEC PC-98 series onboard hardware
|
||||
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||
* PURPOSE: Intel 8259A PIC header file
|
||||
* COPYRIGHT: Copyright 2020 Dmitry Borisov (di.sean@protonmail.com)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define PIC1_CONTROL_PORT 0x00
|
||||
#define PIC1_DATA_PORT 0x02
|
||||
#define PIC2_CONTROL_PORT 0x08
|
||||
#define PIC2_DATA_PORT 0x0A
|
||||
|
||||
#define PIC_TIMER_IRQ 0
|
||||
#define PIC_CASCADE_IRQ 7
|
||||
#define PIC_RTC_IRQ 15
|
||||
|
||||
/*
|
||||
* Definitions for ICW/OCW Bits
|
||||
*/
|
||||
typedef enum _I8259_ICW1_OPERATING_MODE
|
||||
{
|
||||
Cascade,
|
||||
Single
|
||||
} I8259_ICW1_OPERATING_MODE;
|
||||
|
||||
typedef enum _I8259_ICW1_INTERRUPT_MODE
|
||||
{
|
||||
EdgeTriggered,
|
||||
LevelTriggered
|
||||
} I8259_ICW1_INTERRUPT_MODE;
|
||||
|
||||
typedef enum _I8259_ICW1_INTERVAL
|
||||
{
|
||||
Interval8,
|
||||
Interval4
|
||||
} I8259_ICW1_INTERVAL;
|
||||
|
||||
typedef enum _I8259_ICW4_SYSTEM_MODE
|
||||
{
|
||||
Mcs8085Mode,
|
||||
New8086Mode
|
||||
} I8259_ICW4_SYSTEM_MODE;
|
||||
|
||||
typedef enum _I8259_ICW4_EOI_MODE
|
||||
{
|
||||
NormalEoi,
|
||||
AutomaticEoi
|
||||
} I8259_ICW4_EOI_MODE;
|
||||
|
||||
typedef enum _I8259_ICW4_BUFFERED_MODE
|
||||
{
|
||||
NonBuffered,
|
||||
NonBuffered2,
|
||||
BufferedSlave,
|
||||
BufferedMaster
|
||||
} I8259_ICW4_BUFFERED_MODE;
|
||||
|
||||
typedef enum _I8259_READ_REQUEST
|
||||
{
|
||||
InvalidRequest,
|
||||
InvalidRequest2,
|
||||
ReadIdr,
|
||||
ReadIsr
|
||||
} I8259_READ_REQUEST;
|
||||
|
||||
typedef enum _I8259_EOI_MODE
|
||||
{
|
||||
RotateAutoEoiClear,
|
||||
NonSpecificEoi,
|
||||
InvalidEoiMode,
|
||||
SpecificEoi,
|
||||
RotateAutoEoiSet,
|
||||
RotateNonSpecific,
|
||||
SetPriority,
|
||||
RotateSpecific
|
||||
} I8259_EOI_MODE;
|
||||
|
||||
/*
|
||||
* Definitions for ICW Registers
|
||||
*/
|
||||
typedef union _I8259_ICW1
|
||||
{
|
||||
struct
|
||||
{
|
||||
UCHAR NeedIcw4:1;
|
||||
UCHAR OperatingMode:1;
|
||||
UCHAR Interval:1;
|
||||
UCHAR InterruptMode:1;
|
||||
UCHAR Init:1;
|
||||
UCHAR InterruptVectorAddress:3;
|
||||
};
|
||||
UCHAR Bits;
|
||||
} I8259_ICW1, *PI8259_ICW1;
|
||||
|
||||
typedef union _I8259_ICW2
|
||||
{
|
||||
struct
|
||||
{
|
||||
UCHAR Sbz:3;
|
||||
UCHAR InterruptVector:5;
|
||||
};
|
||||
UCHAR Bits;
|
||||
} I8259_ICW2, *PI8259_ICW2;
|
||||
|
||||
typedef union _I8259_ICW3
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
UCHAR SlaveIrq0:1;
|
||||
UCHAR SlaveIrq1:1;
|
||||
UCHAR SlaveIrq2:1;
|
||||
UCHAR SlaveIrq3:1;
|
||||
UCHAR SlaveIrq4:1;
|
||||
UCHAR SlaveIrq5:1;
|
||||
UCHAR SlaveIrq6:1;
|
||||
UCHAR SlaveIrq7:1;
|
||||
};
|
||||
struct
|
||||
{
|
||||
UCHAR SlaveId:3;
|
||||
UCHAR Reserved:5;
|
||||
};
|
||||
};
|
||||
UCHAR Bits;
|
||||
} I8259_ICW3, *PI8259_ICW3;
|
||||
|
||||
typedef union _I8259_ICW4
|
||||
{
|
||||
struct
|
||||
{
|
||||
UCHAR SystemMode:1;
|
||||
UCHAR EoiMode:1;
|
||||
UCHAR BufferedMode:2;
|
||||
UCHAR SpecialFullyNestedMode:1;
|
||||
UCHAR Reserved:3;
|
||||
};
|
||||
UCHAR Bits;
|
||||
} I8259_ICW4, *PI8259_ICW4;
|
||||
|
||||
typedef union _I8259_OCW2
|
||||
{
|
||||
struct
|
||||
{
|
||||
UCHAR IrqNumber:3;
|
||||
UCHAR Sbz:2;
|
||||
UCHAR EoiMode:3;
|
||||
};
|
||||
UCHAR Bits;
|
||||
} I8259_OCW2, *PI8259_OCW2;
|
||||
|
||||
typedef union _I8259_OCW3
|
||||
{
|
||||
struct
|
||||
{
|
||||
UCHAR ReadRequest:2;
|
||||
UCHAR PollCommand:1;
|
||||
UCHAR Sbo:1;
|
||||
UCHAR Sbz:1;
|
||||
UCHAR SpecialMaskMode:2;
|
||||
UCHAR Reserved:1;
|
||||
};
|
||||
UCHAR Bits;
|
||||
} I8259_OCW3, *PI8259_OCW3;
|
||||
|
||||
typedef union _I8259_ISR
|
||||
{
|
||||
struct
|
||||
{
|
||||
UCHAR Irq0:1;
|
||||
UCHAR Irq1:1;
|
||||
UCHAR Irq2:1;
|
||||
UCHAR Irq3:1;
|
||||
UCHAR Irq4:1;
|
||||
UCHAR Irq5:1;
|
||||
UCHAR Irq6:1;
|
||||
UCHAR Irq7:1;
|
||||
};
|
||||
UCHAR Bits;
|
||||
} I8259_ISR, *PI8259_ISR;
|
||||
|
||||
typedef I8259_ISR I8259_IDR, *PI8259_IDR;
|
||||
|
||||
/*
|
||||
* NESA Edge/Level Triggered Register
|
||||
*/
|
||||
#define EISA_ELCR_MASTER 0x98D2
|
||||
#define EISA_ELCR_SLAVE 0x98D4
|
||||
|
||||
typedef union _EISA_ELCR
|
||||
{
|
||||
struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
UCHAR Irq0Level:1;
|
||||
UCHAR Irq1Level:1;
|
||||
UCHAR Irq2Level:1;
|
||||
UCHAR Irq3Level:1;
|
||||
UCHAR Irq4Level:1;
|
||||
UCHAR Irq5Level:1;
|
||||
UCHAR Irq6Level:1;
|
||||
UCHAR Irq7Level:1;
|
||||
} Master;
|
||||
struct
|
||||
{
|
||||
UCHAR Irq8Level:1;
|
||||
UCHAR Irq9Level:1;
|
||||
UCHAR Irq10Level:1;
|
||||
UCHAR Irq11Level:1;
|
||||
UCHAR Irq12Level:1;
|
||||
UCHAR Irq13Level:1;
|
||||
UCHAR Irq14Level:1;
|
||||
UCHAR Irq15Level:1;
|
||||
} Slave;
|
||||
};
|
||||
USHORT Bits;
|
||||
} EISA_ELCR, *PEISA_ELCR;
|
||||
|
||||
typedef union _PIC_MASK
|
||||
{
|
||||
struct
|
||||
{
|
||||
UCHAR Master;
|
||||
UCHAR Slave;
|
||||
};
|
||||
USHORT Both;
|
||||
} PIC_MASK, *PPIC_MASK;
|
44
sdk/include/reactos/drivers/pc98/rtc.h
Normal file
44
sdk/include/reactos/drivers/pc98/rtc.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* PROJECT: NEC PC-98 series onboard hardware
|
||||
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||
* PURPOSE: NEC uPD1990A/uPD4990A RTC header file
|
||||
* COPYRIGHT: Copyright 2020 Dmitry Borisov (di.sean@protonmail.com)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define RTC_IO_o_DATA 0x20
|
||||
/* Input terminals */
|
||||
#define RTC_DATA_INPUT 0x20
|
||||
#define RTC_CLOCK 0x10
|
||||
#define RTC_STROBE 0x08
|
||||
/* Commands, shift register 40 bit */
|
||||
#define RTC_CMD_REGISTER_HOLD 0x00
|
||||
#define RTC_CMD_REGISTER_SHIFT 0x01
|
||||
#define RTC_CMD_TIME_SET_COUNTER_HOLD 0x02
|
||||
#define RTC_CMD_TIME_READ 0x03
|
||||
#define RTC_CMD_TIMING_PULSE_64_HZ 0x04
|
||||
#define RTC_CMD_TIMING_PULSE_256_HZ 0x05
|
||||
#define RTC_CMD_TIMING_PULSE_2048_HZ 0x06
|
||||
#define RTC_CMD_SERIAL_TRANSFER_MODE 0x07
|
||||
/* Serial data commands, shift register 52 bit (uPD4990A only) */
|
||||
#define RTC_CMD_TIMING_PULSE_4096_HZ 0x07
|
||||
#define RTC_CMD_TIMING_PULSE_1_S_INT 0x08
|
||||
#define RTC_CMD_TIMING_PULSE_10_S_INT 0x09
|
||||
#define RTC_CMD_TIMING_PULSE_30_S_INT 0x0A
|
||||
#define RTC_CMD_TIMING_PULSE_60_S_INT 0x0B
|
||||
#define RTC_CMD_INTERRUPT_RESET 0x0C
|
||||
#define RTC_CMD_INTERRUPT_START 0x0D
|
||||
#define RTC_CMD_INTERRUPT_STOP 0x0E
|
||||
#define RTC_CMD_TEST_MODE 0x0F
|
||||
|
||||
#define RTC_IO_o_MODE 0x22
|
||||
|
||||
#define RTC_IO_o_INT_CLOCK_DIVISOR 0x128
|
||||
#define RTC_INT_CLOCK_DIVISOR_64 0x00
|
||||
#define RTC_INT_CLOCK_DIVISOR_32 0x01
|
||||
#define RTC_INT_CLOCK_DIVISOR_0 0x02
|
||||
#define RTC_INT_CLOCK_DIVISOR_16 0x03
|
||||
|
||||
#define RTC_IO_i_MODE 0x22
|
||||
#define RTC_IO_i_INTERRUPT_RESET 0x128
|
|
@ -8,7 +8,12 @@
|
|||
#pragma once
|
||||
|
||||
#define PPI_IO_o_PORT_C 0x35
|
||||
|
||||
#define PPI_IO_o_CONTROL 0x37
|
||||
#define PPI_TIMER_1_GATE_TO_SPEAKER 0x06
|
||||
#define PPI_TIMER_1_UNGATE_TO_SPEAKER 0x07
|
||||
#define PPI_SHUTDOWN_1_ENABLE 0x0B
|
||||
#define PPI_SHUTDOWN_0_ENABLE 0x0F
|
||||
|
||||
#define PPI_IO_i_PORT_A 0x31
|
||||
#define PPI_IO_i_PORT_B 0x33
|
||||
|
@ -64,19 +69,3 @@ typedef union _SYSTEM_CONTROL_PORT_C_REGISTER
|
|||
};
|
||||
UCHAR Bits;
|
||||
} SYSTEM_CONTROL_PORT_C_REGISTER, *PSYSTEM_CONTROL_PORT_C_REGISTER;
|
||||
|
||||
typedef union _SYSTEM_CONTROL_PORT_REGISTER
|
||||
{
|
||||
struct
|
||||
{
|
||||
UCHAR InterruptEnableRxReady:1;
|
||||
UCHAR InterruptEnableTxEmpty:1;
|
||||
UCHAR InterruptEnableTxReady:1;
|
||||
UCHAR Timer1GateToSpeaker:1;
|
||||
UCHAR Mcke:1;
|
||||
UCHAR Shut1:1;
|
||||
UCHAR PrinterStrobeSignal:1;
|
||||
UCHAR Shut0:1;
|
||||
};
|
||||
UCHAR Bits;
|
||||
} SYSTEM_CONTROL_PORT_REGISTER, *PSYSTEM_CONTROL_PORT_REGISTER;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue