Replaced linux io calls

svn path=/trunk/; revision=1414
This commit is contained in:
Eric Kohl 2000-10-22 02:02:28 +00:00
parent 1db1c12cf3
commit 9267a79b9e

View file

@ -1,4 +1,4 @@
/* $Id: parallel.c,v 1.5 2000/06/29 23:35:49 dwelch Exp $
/* $Id: parallel.c,v 1.6 2000/10/22 02:02:28 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -13,7 +13,6 @@
/* FUNCTIONS **************************************************************/
#include <ddk/ntddk.h>
#include "../../../ntoskrnl/include/internal/i386/io.h"
#include "parallel.h"
@ -22,7 +21,7 @@
#define LP_B (0x378)
#define LP_S (inb_p(LP_B+1))
#define LP_S (READ_PORT_UCHAR((PUCHAR)(LP_B+1)))
#define LP_C (LP_B+2)
static void Parallel_Reset(void)
@ -32,9 +31,9 @@ static void Parallel_Reset(void)
{
int i;
outb_p(LP_C,0);
WRITE_PORT_UCHAR((PUCHAR)LP_C,0);
for (i=0;i<LP_DELAY;i++);
outb_p(LP_C,LP_PSELECP | LP_PINITP);
WRITE_PORT_UCHAR((PUCHAR)LP_C,LP_PSELECP | LP_PINITP);
}
static void Parallel_putchar(unsigned char ch)
@ -62,14 +61,15 @@ static void Parallel_putchar(unsigned char ch)
return;
}
outb_p(LP_B,ch);
WRITE_PORT_UCHAR((PUCHAR)LP_B,ch);
while (wait != 10000) { wait++; }
outb_p(LP_C, (LP_PSELECP | LP_PINITP | LP_PSTROBE ));
WRITE_PORT_UCHAR((PUCHAR)LP_C, (LP_PSELECP | LP_PINITP | LP_PSTROBE ));
while (wait) { wait--; }
outb_p(LP_C, LP_PSELECP | LP_PINITP);
WRITE_PORT_UCHAR((PUCHAR)LP_C, LP_PSELECP | LP_PINITP);
}
NTSTATUS Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS STDCALL
Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
@ -127,33 +127,32 @@ DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
*/
{
PDEVICE_OBJECT DeviceObject;
NTSTATUS ret;
ANSI_STRING ansi_device_name;
UNICODE_STRING device_name;
UNICODE_STRING DeviceName;
NTSTATUS Status;
DbgPrint("Parallel Port Driver 0.0.1\n");
RtlInitAnsiString (&ansi_device_name, "\\Device\\Parallel");
RtlAnsiStringToUnicodeString (&device_name, &ansi_device_name, TRUE);
ret = IoCreateDevice(DriverObject,
RtlInitUnicodeString (&DeviceName,
L"\\Device\\Parallel");
Status = IoCreateDevice(DriverObject,
0,
&device_name,
&DeviceName,
FILE_DEVICE_PARALLEL_PORT,
0,
FALSE,
&DeviceObject);
if (ret!=STATUS_SUCCESS)
if (!NT_SUCCESS(Status))
{
return(ret);
return(Status);
}
DeviceObject->Flags=0;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = Dispatch;
DriverObject->MajorFunction[IRP_MJ_CREATE] = Dispatch;
DriverObject->MajorFunction[IRP_MJ_WRITE] = Dispatch;
DriverObject->MajorFunction[IRP_MJ_WRITE] = Dispatch;
DriverObject->DriverUnload = NULL;
return(STATUS_SUCCESS);
}
/* EOF */