Author: hbelusca Date: Sat Jan 11 21:45:01 2014 New Revision: 61590
URL: http://svn.reactos.org/svn/reactos?rev=61590&view=rev Log: [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.
Modified: branches/ntvdm/subsystems/ntvdm/bios/bios.c branches/ntvdm/subsystems/ntvdm/hardware/pic.h branches/ntvdm/subsystems/ntvdm/hardware/ps2.h branches/ntvdm/subsystems/ntvdm/hardware/speaker.c branches/ntvdm/subsystems/ntvdm/hardware/speaker.h branches/ntvdm/subsystems/ntvdm/hardware/timer.c branches/ntvdm/subsystems/ntvdm/hardware/timer.h
Modified: branches/ntvdm/subsystems/ntvdm/bios/bios.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios/bios... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/bios/bios.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/bios/bios.c [iso-8859-1] Sat Jan 11 21:45:01 2014 @@ -361,29 +361,30 @@ * 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_SLAVE_CMD , PIC_ICW1 | PIC_ICW1_ICW4);
/* Set the interrupt offsets */ 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 */ IOWriteB(PIC_MASTER_DATA, 1 << 2); IOWriteB(PIC_SLAVE_DATA , 2);
- /* Make sure the PIC is in 8086 mode */ - IOWriteB(PIC_MASTER_DATA, PIC_ICW4_8086); + /* Make sure both PICs are in 8086 mode */ + IOWriteB(PIC_MASTER_DATA, PIC_ICW4_8086 /* | PIC_ICW4_AEOI */); IOWriteB(PIC_SLAVE_DATA , PIC_ICW4_8086);
/* Clear the masks for both PICs */ IOWriteB(PIC_MASTER_DATA, 0x00); IOWriteB(PIC_SLAVE_DATA , 0x00);
- PitWriteCommand(0x34); - PitWriteData(0, 0x00); - PitWriteData(0, 0x00); + /* Initialize the PIT */ + IOWriteB(PIT_COMMAND_PORT, 0x34); + IOWriteB(PIT_DATA_PORT(0), 0x00); + IOWriteB(PIT_DATA_PORT(0), 0x00);
return TRUE; }
Modified: branches/ntvdm/subsystems/ntvdm/hardware/pic.h URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/hardware/... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/hardware/pic.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/hardware/pic.h [iso-8859-1] Sat Jan 11 21:45:01 2014 @@ -16,20 +16,23 @@
/* DEFINES ********************************************************************/
-#define PIC_MASTER_CMD 0x20 +#define PIC_MASTER_CMD 0x20 #define PIC_MASTER_DATA 0x21 -#define PIC_SLAVE_CMD 0xA0 -#define PIC_SLAVE_DATA 0xA1 -#define PIC_ICW1 0x10 -#define PIC_ICW1_ICW4 (1 << 0) +#define PIC_SLAVE_CMD 0xA0 +#define PIC_SLAVE_DATA 0xA1 + +#define PIC_ICW1 0x10 +#define PIC_ICW1_ICW4 (1 << 0) #define PIC_ICW1_SINGLE (1 << 1) -#define PIC_ICW4_8086 (1 << 0) -#define PIC_ICW4_AEOI (1 << 1) -#define PIC_OCW2_NUM_MASK 0x07 -#define PIC_OCW2_EOI (1 << 5) -#define PIC_OCW2_SL (1 << 6) -#define PIC_OCW3 (1 << 3) -#define PIC_OCW3_READ_ISR 0x0B +#define PIC_ICW4_8086 (1 << 0) +#define PIC_ICW4_AEOI (1 << 1) + +#define PIC_OCW2_NUM_MASK 0x07 +#define PIC_OCW2_EOI (1 << 5) +#define PIC_OCW2_SL (1 << 6) + +#define PIC_OCW3 (1 << 3) +#define PIC_OCW3_READ_ISR 0x0B
typedef struct _PIC { @@ -50,6 +53,7 @@
VOID PicInterruptRequest(BYTE Number); BYTE PicGetInterrupt(VOID); + VOID PicInitialize(VOID);
#endif // _PIC_H_
Modified: branches/ntvdm/subsystems/ntvdm/hardware/ps2.h URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/hardware/... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/hardware/ps2.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/hardware/ps2.h [iso-8859-1] Sat Jan 11 21:45:01 2014 @@ -25,6 +25,7 @@ /* FUNCTIONS ******************************************************************/
VOID GenerateKeyboardInterrupts(VOID); + BOOLEAN PS2Initialize(HANDLE ConsoleInput); VOID PS2Cleanup(VOID);
Modified: branches/ntvdm/subsystems/ntvdm/hardware/speaker.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/hardware/... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/hardware/speaker.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/hardware/speaker.c [iso-8859-1] Sat Jan 11 21:45:01 2014 @@ -28,14 +28,14 @@ static BYTE Port61hState = 0x00; HANDLE hBeep = NULL;
-/* PUBLIC FUNCTIONS ***********************************************************/ +/* PRIVATE FUNCTIONS **********************************************************/
-BYTE SpeakerReadStatus(VOID) +static BYTE SpeakerReadStatus(VOID) { return Port61hState; }
-VOID SpeakerWriteCommand(BYTE Value) +static VOID SpeakerWriteCommand(BYTE Value) { BOOLEAN IsConnectedToPITChannel2; UCHAR SpeakerData; @@ -121,15 +121,17 @@ } }
-BYTE WINAPI SpeakerReadPort(ULONG Port) +static BYTE WINAPI SpeakerReadPort(ULONG Port) { return SpeakerReadStatus(); }
-VOID WINAPI SpeakerWritePort(ULONG Port, BYTE Data) +static VOID WINAPI SpeakerWritePort(ULONG Port, BYTE Data) { SpeakerWriteCommand(Data); } + +/* PUBLIC FUNCTIONS ***********************************************************/
VOID SpeakerInitialize(VOID) {
Modified: branches/ntvdm/subsystems/ntvdm/hardware/speaker.h URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/hardware/... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/hardware/speaker.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/hardware/speaker.h [iso-8859-1] Sat Jan 11 21:45:01 2014 @@ -21,8 +21,6 @@
VOID SpeakerInitialize(VOID); VOID SpeakerCleanup(VOID); -BYTE SpeakerReadStatus(VOID); -VOID SpeakerWriteCommand(BYTE Value);
#endif // _SPEAKER_H_
Modified: branches/ntvdm/subsystems/ntvdm/hardware/timer.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/hardware/... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/hardware/timer.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/hardware/timer.c [iso-8859-1] Sat Jan 11 21:45:01 2014 @@ -20,9 +20,9 @@ static PIT_CHANNEL PitChannels[PIT_CHANNELS]; PPIT_CHANNEL PitChannel2 = &PitChannels[2];
-/* PUBLIC FUNCTIONS ***********************************************************/ - -VOID PitWriteCommand(BYTE Value) +/* PRIVATE FUNCTIONS **********************************************************/ + +static VOID PitWriteCommand(BYTE Value) { BYTE Channel = Value >> 6; BYTE Mode = (Value >> 1) & 0x07; @@ -69,7 +69,7 @@ } }
-BYTE PitReadData(BYTE Channel) +static BYTE PitReadData(BYTE Channel) { WORD CurrentValue = PitChannels[Channel].CurrentValue; BYTE AccessMode = PitChannels[Channel].AccessMode; @@ -119,7 +119,7 @@ return 0; }
-VOID PitWriteData(BYTE Channel, BYTE Value) +static VOID PitWriteData(BYTE Channel, BYTE Value) { BYTE AccessMode = PitChannels[Channel].AccessMode;
@@ -183,6 +183,8 @@ } } } + +/* PUBLIC FUNCTIONS ***********************************************************/
VOID PitDecrementCount(DWORD Count) {
Modified: branches/ntvdm/subsystems/ntvdm/hardware/timer.h URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/hardware/... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/hardware/timer.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/hardware/timer.h [iso-8859-1] Sat Jan 11 21:45:01 2014 @@ -47,11 +47,9 @@
/* FUNCTIONS ******************************************************************/
-VOID PitWriteCommand(BYTE Value); -VOID PitWriteData(BYTE Channel, BYTE Value); - VOID PitDecrementCount(DWORD Count); DWORD PitGetResolution(VOID); + VOID PitInitialize(VOID);
#endif // _TIMER_H_