ReactOS  0.4.15-dev-1206-g731eddf
pdo.c File Reference
#include "parport.h"
Include dependency graph for pdo.c:

Go to the source code of this file.

Functions

NTSTATUS NTAPI PdoCreate (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI PdoClose (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI PdoCleanup (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI PdoRead (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI PdoWrite (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI PdoPnp (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI PdoPower (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 

Function Documentation

◆ PdoCleanup()

NTSTATUS NTAPI PdoCleanup ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 67 of file pdo.c.

69 {
70  DPRINT("PdoCleanup()\n");
71 
72  Irp->IoStatus.Information = 0;
73  Irp->IoStatus.Status = STATUS_SUCCESS;
75  return STATUS_SUCCESS;
76 }
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define IO_NO_INCREMENT
Definition: iotypes.h:581
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by DispatchCleanup().

◆ PdoClose()

NTSTATUS NTAPI PdoClose ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 47 of file pdo.c.

49 {
50  PPDO_DEVICE_EXTENSION pDeviceExtension;
51 
52  DPRINT("PdoClose()\n");
53 
54  pDeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
55  pDeviceExtension->OpenCount--;
56 
57  Irp->IoStatus.Information = 0;
58  Irp->IoStatus.Status = STATUS_SUCCESS;
60 
61  return STATUS_SUCCESS;
62 }
_In_ PIRP Irp
Definition: csq.h:116
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
#define IO_NO_INCREMENT
Definition: iotypes.h:581
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by DispatchClose().

◆ PdoCreate()

NTSTATUS NTAPI PdoCreate ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 14 of file pdo.c.

16 {
17  PPDO_DEVICE_EXTENSION DeviceExtension;
18  PIO_STACK_LOCATION Stack;
20 
21  DPRINT("PdoCreate()\n");
22 
24  DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
25 
26  if (Stack->Parameters.Create.Options & FILE_DIRECTORY_FILE)
27  {
28  DPRINT1("Not a directory\n");
30  goto done;
31  }
32 
33  DPRINT("Open LPT%lu: successful\n", DeviceExtension->LptPort);
34  DeviceExtension->OpenCount++;
35 
36 done:
37  Irp->IoStatus.Status = Status;
38  Irp->IoStatus.Information = 0;
40 
41  return Status;
42 }
_In_ PIRP Irp
Definition: csq.h:116
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
LONG NTSTATUS
Definition: precomp.h:26
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
#define STATUS_NOT_A_DIRECTORY
Definition: udferr_usr.h:169
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
if(!(yy_init))
Definition: macro.lex.yy.c:714
Status
Definition: gdiplustypes.h:24
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:581
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3107
return STATUS_SUCCESS
Definition: btrfs.c:3014
HRESULT Create([out]ITransactionReceiver **ppReceiver)

Referenced by DispatchCreate().

◆ PdoPnp()

NTSTATUS NTAPI PdoPnp ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 161 of file pdo.c.

163 {
165  DPRINT("PdoPnp()\n");
166 
167  Status = Irp->IoStatus.Status;
169  return Status;
170 }
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
Status
Definition: gdiplustypes.h:24
#define IO_NO_INCREMENT
Definition: iotypes.h:581

Referenced by DispatchPnp().

◆ PdoPower()

NTSTATUS NTAPI PdoPower ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 175 of file pdo.c.

177 {
179  PIO_STACK_LOCATION IoStack;
180 
181  DPRINT("PdoPower()\n");
182 
184 
185  switch (IoStack->MinorFunction)
186  {
187  case IRP_MN_SET_POWER:
188  case IRP_MN_QUERY_POWER:
189  Irp->IoStatus.Status = STATUS_SUCCESS;
190  break;
191  }
192 
193  Status = Irp->IoStatus.Status;
196  return Status;
197 }
#define IRP_MN_QUERY_POWER
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
Status
Definition: gdiplustypes.h:24
#define IRP_MN_SET_POWER
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:737
#define IO_NO_INCREMENT
Definition: iotypes.h:581
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by DispatchPower().

◆ PdoRead()

NTSTATUS NTAPI PdoRead ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 81 of file pdo.c.

83 {
84  DPRINT("PdoRead()\n");
85 
86  Irp->IoStatus.Information = 0;
87  Irp->IoStatus.Status = STATUS_SUCCESS;
89  return STATUS_SUCCESS;
90 }
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define IO_NO_INCREMENT
Definition: iotypes.h:581
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by DispatchRead().

◆ PdoWrite()

NTSTATUS NTAPI PdoWrite ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 95 of file pdo.c.

97 {
98  PPDO_DEVICE_EXTENSION PdoDeviceExtension;
99  PFDO_DEVICE_EXTENSION FdoDeviceExtension;
100  PIO_STACK_LOCATION IoStack;
101  PUCHAR Buffer;
102  ULONG i;
104  ULONG ulCount;
105 
106  DPRINT("PdoWrite()\n");
107 
108  PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
109  FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)PdoDeviceExtension->AttachedFdo->DeviceExtension;
110 
112 
114  DPRINT("Length: %lu\n", IoStack->Parameters.Write.Length);
115  DPRINT("Buffer: %p\n", Buffer);
116 
117  for (i = 0; i < IoStack->Parameters.Write.Length; i++)
118  {
119  ulCount = 0;
120 
121  do
122  {
124  PortStatus = READ_PORT_UCHAR(UlongToPtr(FdoDeviceExtension->BaseAddress + 1));
125  ulCount++;
126  }
127  while (ulCount < 500000 && !(PortStatus & LP_PBUSY));
128 
129  if (ulCount == 500000)
130  {
131  DPRINT("Timed out\n");
132 
133  Irp->IoStatus.Information = 0;
134  Irp->IoStatus.Status = STATUS_TIMEOUT;
136 
137  return STATUS_TIMEOUT;
138  }
139 
140  /* Write character */
141  WRITE_PORT_UCHAR(UlongToPtr(FdoDeviceExtension->BaseAddress), Buffer[i]);
142 
144 
145  WRITE_PORT_UCHAR(UlongToPtr(FdoDeviceExtension->BaseAddress + 2), (LP_PSELECP | LP_PINITP | LP_PSTROBE));
146 
148 
149  WRITE_PORT_UCHAR(UlongToPtr(FdoDeviceExtension->BaseAddress + 2), (LP_PSELECP | LP_PINITP));
150  }
151 
152  Irp->IoStatus.Information = 0;
153  Irp->IoStatus.Status = STATUS_SUCCESS;
155  return STATUS_SUCCESS;
156 }
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:21
_In_ PIRP Irp
Definition: csq.h:116
unsigned char * PUCHAR
Definition: retypes.h:3
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
#define STATUS_TIMEOUT
Definition: ntstatus.h:81
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define LP_PINITP
Definition: parallel.h:119
PVOID DeviceExtension
Definition: env_spec_w32.h:418
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define LP_PSELECP
Definition: parallel.h:118
Definition: bufpool.h:45
#define UlongToPtr(u)
Definition: config.h:106
PVOID GetUserBuffer(IN PIRP Irp)
Definition: misc.c:76
#define LP_PSTROBE
Definition: parallel.h:121
PDEVICE_OBJECT AttachedFdo
Definition: parport.h:59
unsigned char UCHAR
Definition: xmlstorage.h:181
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:20
_Outptr_ PUSB_DEVICE_HANDLE _In_ PUSB_DEVICE_HANDLE _In_ USHORT PortStatus
Definition: hubbusif.h:40
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
#define LP_PBUSY
Definition: parallel.h:106
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:581
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3107
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:3014
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:95

Referenced by DispatchWrite().