mirror of
https://github.com/reactos/reactos.git
synced 2024-08-04 18:40:59 +00:00
[NTVDM]
- Do not export (for the PIC/PIT/Speaker) the port functions but use instead the common port interface. - In bios.c : IOWriteB(PIC_MASTER_DATA, PIC_ICW4_8086 /* | PIC_ICW4_AEOI */); (line 377) : in NXVM they add PIC_ICW4_AEOI; [TheFlash], can you have a look at this and see whether it is required for the master PIC only, otherwise remove this comment. svn path=/branches/ntvdm/; revision=61590
This commit is contained in:
parent
40f773b96b
commit
f0466501fc
|
@ -361,29 +361,30 @@ BOOLEAN BiosInitialize(HANDLE ConsoleInput, HANDLE ConsoleOutput)
|
||||||
* The POST (Power On-Self Test)
|
* The POST (Power On-Self Test)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Initialize the PIC */
|
/* Initialize the master and the slave PICs */
|
||||||
IOWriteB(PIC_MASTER_CMD, PIC_ICW1 | PIC_ICW1_ICW4);
|
IOWriteB(PIC_MASTER_CMD, PIC_ICW1 | PIC_ICW1_ICW4);
|
||||||
IOWriteB(PIC_SLAVE_CMD , PIC_ICW1 | PIC_ICW1_ICW4);
|
IOWriteB(PIC_SLAVE_CMD , PIC_ICW1 | PIC_ICW1_ICW4);
|
||||||
|
|
||||||
/* Set the interrupt offsets */
|
/* Set the interrupt offsets */
|
||||||
IOWriteB(PIC_MASTER_DATA, BIOS_PIC_MASTER_INT);
|
IOWriteB(PIC_MASTER_DATA, BIOS_PIC_MASTER_INT);
|
||||||
IOWriteB(PIC_SLAVE_DATA , BIOS_PIC_SLAVE_INT);
|
IOWriteB(PIC_SLAVE_DATA , BIOS_PIC_SLAVE_INT );
|
||||||
|
|
||||||
/* Tell the master PIC there is a slave at IRQ 2 */
|
/* Tell the master PIC there is a slave at IRQ 2 */
|
||||||
IOWriteB(PIC_MASTER_DATA, 1 << 2);
|
IOWriteB(PIC_MASTER_DATA, 1 << 2);
|
||||||
IOWriteB(PIC_SLAVE_DATA , 2);
|
IOWriteB(PIC_SLAVE_DATA , 2);
|
||||||
|
|
||||||
/* Make sure the PIC is in 8086 mode */
|
/* Make sure both PICs are in 8086 mode */
|
||||||
IOWriteB(PIC_MASTER_DATA, PIC_ICW4_8086);
|
IOWriteB(PIC_MASTER_DATA, PIC_ICW4_8086 /* | PIC_ICW4_AEOI */);
|
||||||
IOWriteB(PIC_SLAVE_DATA , PIC_ICW4_8086);
|
IOWriteB(PIC_SLAVE_DATA , PIC_ICW4_8086);
|
||||||
|
|
||||||
/* Clear the masks for both PICs */
|
/* Clear the masks for both PICs */
|
||||||
IOWriteB(PIC_MASTER_DATA, 0x00);
|
IOWriteB(PIC_MASTER_DATA, 0x00);
|
||||||
IOWriteB(PIC_SLAVE_DATA , 0x00);
|
IOWriteB(PIC_SLAVE_DATA , 0x00);
|
||||||
|
|
||||||
PitWriteCommand(0x34);
|
/* Initialize the PIT */
|
||||||
PitWriteData(0, 0x00);
|
IOWriteB(PIT_COMMAND_PORT, 0x34);
|
||||||
PitWriteData(0, 0x00);
|
IOWriteB(PIT_DATA_PORT(0), 0x00);
|
||||||
|
IOWriteB(PIT_DATA_PORT(0), 0x00);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,20 +16,23 @@
|
||||||
|
|
||||||
/* DEFINES ********************************************************************/
|
/* DEFINES ********************************************************************/
|
||||||
|
|
||||||
#define PIC_MASTER_CMD 0x20
|
#define PIC_MASTER_CMD 0x20
|
||||||
#define PIC_MASTER_DATA 0x21
|
#define PIC_MASTER_DATA 0x21
|
||||||
#define PIC_SLAVE_CMD 0xA0
|
#define PIC_SLAVE_CMD 0xA0
|
||||||
#define PIC_SLAVE_DATA 0xA1
|
#define PIC_SLAVE_DATA 0xA1
|
||||||
#define PIC_ICW1 0x10
|
|
||||||
#define PIC_ICW1_ICW4 (1 << 0)
|
#define PIC_ICW1 0x10
|
||||||
|
#define PIC_ICW1_ICW4 (1 << 0)
|
||||||
#define PIC_ICW1_SINGLE (1 << 1)
|
#define PIC_ICW1_SINGLE (1 << 1)
|
||||||
#define PIC_ICW4_8086 (1 << 0)
|
#define PIC_ICW4_8086 (1 << 0)
|
||||||
#define PIC_ICW4_AEOI (1 << 1)
|
#define PIC_ICW4_AEOI (1 << 1)
|
||||||
#define PIC_OCW2_NUM_MASK 0x07
|
|
||||||
#define PIC_OCW2_EOI (1 << 5)
|
#define PIC_OCW2_NUM_MASK 0x07
|
||||||
#define PIC_OCW2_SL (1 << 6)
|
#define PIC_OCW2_EOI (1 << 5)
|
||||||
#define PIC_OCW3 (1 << 3)
|
#define PIC_OCW2_SL (1 << 6)
|
||||||
#define PIC_OCW3_READ_ISR 0x0B
|
|
||||||
|
#define PIC_OCW3 (1 << 3)
|
||||||
|
#define PIC_OCW3_READ_ISR 0x0B
|
||||||
|
|
||||||
typedef struct _PIC
|
typedef struct _PIC
|
||||||
{
|
{
|
||||||
|
@ -50,6 +53,7 @@ typedef struct _PIC
|
||||||
|
|
||||||
VOID PicInterruptRequest(BYTE Number);
|
VOID PicInterruptRequest(BYTE Number);
|
||||||
BYTE PicGetInterrupt(VOID);
|
BYTE PicGetInterrupt(VOID);
|
||||||
|
|
||||||
VOID PicInitialize(VOID);
|
VOID PicInitialize(VOID);
|
||||||
|
|
||||||
#endif // _PIC_H_
|
#endif // _PIC_H_
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
/* FUNCTIONS ******************************************************************/
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
VOID GenerateKeyboardInterrupts(VOID);
|
VOID GenerateKeyboardInterrupts(VOID);
|
||||||
|
|
||||||
BOOLEAN PS2Initialize(HANDLE ConsoleInput);
|
BOOLEAN PS2Initialize(HANDLE ConsoleInput);
|
||||||
VOID PS2Cleanup(VOID);
|
VOID PS2Cleanup(VOID);
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,14 @@
|
||||||
static BYTE Port61hState = 0x00;
|
static BYTE Port61hState = 0x00;
|
||||||
HANDLE hBeep = NULL;
|
HANDLE hBeep = NULL;
|
||||||
|
|
||||||
/* PUBLIC FUNCTIONS ***********************************************************/
|
/* PRIVATE FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
BYTE SpeakerReadStatus(VOID)
|
static BYTE SpeakerReadStatus(VOID)
|
||||||
{
|
{
|
||||||
return Port61hState;
|
return Port61hState;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID SpeakerWriteCommand(BYTE Value)
|
static VOID SpeakerWriteCommand(BYTE Value)
|
||||||
{
|
{
|
||||||
BOOLEAN IsConnectedToPITChannel2;
|
BOOLEAN IsConnectedToPITChannel2;
|
||||||
UCHAR SpeakerData;
|
UCHAR SpeakerData;
|
||||||
|
@ -121,16 +121,18 @@ VOID SpeakerWriteCommand(BYTE Value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BYTE WINAPI SpeakerReadPort(ULONG Port)
|
static BYTE WINAPI SpeakerReadPort(ULONG Port)
|
||||||
{
|
{
|
||||||
return SpeakerReadStatus();
|
return SpeakerReadStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID WINAPI SpeakerWritePort(ULONG Port, BYTE Data)
|
static VOID WINAPI SpeakerWritePort(ULONG Port, BYTE Data)
|
||||||
{
|
{
|
||||||
SpeakerWriteCommand(Data);
|
SpeakerWriteCommand(Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* PUBLIC FUNCTIONS ***********************************************************/
|
||||||
|
|
||||||
VOID SpeakerInitialize(VOID)
|
VOID SpeakerInitialize(VOID)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
|
|
||||||
VOID SpeakerInitialize(VOID);
|
VOID SpeakerInitialize(VOID);
|
||||||
VOID SpeakerCleanup(VOID);
|
VOID SpeakerCleanup(VOID);
|
||||||
BYTE SpeakerReadStatus(VOID);
|
|
||||||
VOID SpeakerWriteCommand(BYTE Value);
|
|
||||||
|
|
||||||
#endif // _SPEAKER_H_
|
#endif // _SPEAKER_H_
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
static PIT_CHANNEL PitChannels[PIT_CHANNELS];
|
static PIT_CHANNEL PitChannels[PIT_CHANNELS];
|
||||||
PPIT_CHANNEL PitChannel2 = &PitChannels[2];
|
PPIT_CHANNEL PitChannel2 = &PitChannels[2];
|
||||||
|
|
||||||
/* PUBLIC FUNCTIONS ***********************************************************/
|
/* PRIVATE FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
VOID PitWriteCommand(BYTE Value)
|
static VOID PitWriteCommand(BYTE Value)
|
||||||
{
|
{
|
||||||
BYTE Channel = Value >> 6;
|
BYTE Channel = Value >> 6;
|
||||||
BYTE Mode = (Value >> 1) & 0x07;
|
BYTE Mode = (Value >> 1) & 0x07;
|
||||||
|
@ -69,7 +69,7 @@ VOID PitWriteCommand(BYTE Value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BYTE PitReadData(BYTE Channel)
|
static BYTE PitReadData(BYTE Channel)
|
||||||
{
|
{
|
||||||
WORD CurrentValue = PitChannels[Channel].CurrentValue;
|
WORD CurrentValue = PitChannels[Channel].CurrentValue;
|
||||||
BYTE AccessMode = PitChannels[Channel].AccessMode;
|
BYTE AccessMode = PitChannels[Channel].AccessMode;
|
||||||
|
@ -119,7 +119,7 @@ BYTE PitReadData(BYTE Channel)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID PitWriteData(BYTE Channel, BYTE Value)
|
static VOID PitWriteData(BYTE Channel, BYTE Value)
|
||||||
{
|
{
|
||||||
BYTE AccessMode = PitChannels[Channel].AccessMode;
|
BYTE AccessMode = PitChannels[Channel].AccessMode;
|
||||||
|
|
||||||
|
@ -184,6 +184,8 @@ static VOID WINAPI PitWritePort(ULONG Port, BYTE Data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* PUBLIC FUNCTIONS ***********************************************************/
|
||||||
|
|
||||||
VOID PitDecrementCount(DWORD Count)
|
VOID PitDecrementCount(DWORD Count)
|
||||||
{
|
{
|
||||||
INT i;
|
INT i;
|
||||||
|
|
|
@ -47,11 +47,9 @@ extern PPIT_CHANNEL PitChannel2; // Needed for PC Speaker
|
||||||
|
|
||||||
/* FUNCTIONS ******************************************************************/
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
VOID PitWriteCommand(BYTE Value);
|
|
||||||
VOID PitWriteData(BYTE Channel, BYTE Value);
|
|
||||||
|
|
||||||
VOID PitDecrementCount(DWORD Count);
|
VOID PitDecrementCount(DWORD Count);
|
||||||
DWORD PitGetResolution(VOID);
|
DWORD PitGetResolution(VOID);
|
||||||
|
|
||||||
VOID PitInitialize(VOID);
|
VOID PitInitialize(VOID);
|
||||||
|
|
||||||
#endif // _TIMER_H_
|
#endif // _TIMER_H_
|
||||||
|
|
Loading…
Reference in a new issue