Access control , data and status register of parallel port

Hi,

I have written a small kernel mode driver that access the raw parallel port… I am able successfully allocate parallel port and get information from parallel port using internal parallel port internal IOCTLs.

Now I want to access the data, control registers and status register (read and write to it) .

So one of the method is to use the Controller member of PARALLEL_PORT_INFORMATION to access these registers i.e. (Controller+ 0 ) = Data or ECP FIFO (Address), (Controller + 1 ) = Status Register, (Controller + 2 ) = Control Register .

But that will mean directly accessing the register using mapped address which will not bring parport.sys into picture… I am not sure whether this is the correct method ? . Please suggest if any other proper way or IOCTL is available through which I can access these registers.

Also is there any mechanism available to change the direction of? parallel port direction… ?

?
Thanks
Anshul Makkar
www.justkernel.com

anshul makkar wrote:

I have written a small kernel mode driver that access the raw parallel
port… I am able successfully allocate parallel port and get
information from parallel port using internal parallel port internal
IOCTLs.

Now I want to access the data, control registers and status register
(read and write to it) .
So one of the method is to use the Controller member of
PARALLEL_PORT_INFORMATION to access these registers i.e. (Controller+
0 ) = Data or ECP FIFO (Address), (Controller + 1 ) = Status Register,
(Controller + 2 ) = Control Register .

But that will mean directly accessing the register using mapped
address which will not bring parport.sys into picture… I am not sure
whether this is the correct method ? . Please suggest if any other
proper way or IOCTL is available through which I can access these
registers.

The theory is that you use the ioctls to direct parport.sys to change
the bits the way you need them. It is an abstraction.

Also is there any mechanism available to change the direction of
parallel port direction… ?

If you are using the “blessed” interface, then you will use IRP_MJ_READ
and IRP_MJ_WRITE, and parport.sys will manage the direction.

If you can’t make the abstraction do what you need, then you may need to
override parport.sys with your own driver.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Tim, thanks for the reply… Sorry, but i couldn’t understand completly.
I have used IOCTLS directed towards parport.sys to access the parallel port and get parallel port and pnp information.
But i couldn’t find any IOCTL to change the bits of control, status or data register.
Request you too please suggest.

Anshul makkar

-----Original message-----
From: Tim Roberts
Sent: 28/02/2012, 23:24
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Access control , data and status register of parallel port

anshul makkar wrote:

I have written a small kernel mode driver that access the raw parallel
port… I am able successfully allocate parallel port and get
information from parallel port using internal parallel port internal
IOCTLs.

Now I want to access the data, control registers and status register
(read and write to it) .
So one of the method is to use the Controller member of
PARALLEL_PORT_INFORMATION to access these registers i.e. (Controller+
0 ) = Data or ECP FIFO (Address), (Controller + 1 ) = Status Register,
(Controller + 2 ) = Control Register .

But that will mean directly accessing the register using mapped
address which will not bring parport.sys into picture… I am not sure
whether this is the correct method ? . Please suggest if any other
proper way or IOCTL is available through which I can access these
registers.

The theory is that you use the ioctls to direct parport.sys to change
the bits the way you need them. It is an abstraction.

Also is there any mechanism available to change the direction of
parallel port direction… ?

If you are using the “blessed” interface, then you will use IRP_MJ_READ
and IRP_MJ_WRITE, and parport.sys will manage the direction.

If you can’t make the abstraction do what you need, then you may need to
override parport.sys with your own driver.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Anshul Makkar wrote:

Tim, thanks for the reply… Sorry, but i couldn’t understand completly.
I have used IOCTLS directed towards parport.sys to access the parallel port and get parallel port and pnp information.
But i couldn’t find any IOCTL to change the bits of control, status or data register.
Request you too please suggest.

What bits do you want to control? You have
IOCTL_INTERNAL_PARALLEL_SET_CHIP_MODE to select EPP and ECP modes. To
write data, you use an IRP_MJ_WRITE request. To read data, you use an
IRP_MJ_READ request. You aren’t supposed to worry about the specific
bits in the control and status registers. That’s handled internally by
parport.sys. That’s what it means to have an abstraction – parport.sys
worries about the bit-level details. You worry about the task you need
to do.

You haven’t really shared with us what, exactly, you are trying to do.
What are you controlling here? If you’re just trying to stream data in
and out, the abstraction will do what you need. If you need more direct
control, then you need to toss out parport.sys and do your own thing.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Tim, thanks a lot for the detailed explaination.
I am working on a virtualization product , so i need to expose / control host’s control and status registers.
Thanks
anshul makkar
-----Original message-----
From: Tim Roberts
Sent: 29/02/2012, 00:11
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Access control , data and status register of parallel port

Anshul Makkar wrote:

Tim, thanks for the reply… Sorry, but i couldn’t understand completly.
I have used IOCTLS directed towards parport.sys to access the parallel port and get parallel port and pnp information.
But i couldn’t find any IOCTL to change the bits of control, status or data register.
Request you too please suggest.

What bits do you want to control? You have
IOCTL_INTERNAL_PARALLEL_SET_CHIP_MODE to select EPP and ECP modes. To
write data, you use an IRP_MJ_WRITE request. To read data, you use an
IRP_MJ_READ request. You aren’t supposed to worry about the specific
bits in the control and status registers. That’s handled internally by
parport.sys. That’s what it means to have an abstraction – parport.sys
worries about the bit-level details. You worry about the task you need
to do.

You haven’t really shared with us what, exactly, you are trying to do.
What are you controlling here? If you’re just trying to stream data in
and out, the abstraction will do what you need. If you need more direct
control, then you need to toss out parport.sys and do your own thing.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Hi,

Yes I have used IOCTL_INTERNAL_PARALLEL_SET_CHIP_MODE to set the the modes ECP/EPP modes… But I want to access the control and status register for which I am unable to find the IOCTL. I need to access these registers on the host and then expose them to guest running on VM…

Please suggest whether I can use parport.sys to achieve above task or I need to directly access these registers using addresses…

?
Thanks
Anshul Makkar
www.justkernel.com


From: Anshul Makkar
To: Windows System Software Devs Interest List
Sent: Wednesday, 29 February 2012 5:24 AM
Subject: RE: [ntdev] Access control , data and status register of parallel port

Tim, thanks a lot for the detailed explaination.
I am working on a virtualization product , so i need to expose / control host’s? control and status registers.
Thanks
anshul makkar
-----Original message-----
From: Tim Roberts
Sent:? 29/02/2012, 00:11
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Access control , data and status register of parallel port

Anshul Makkar wrote:
> Tim, thanks for the reply… Sorry, but i couldn’t understand completly.
> I have used IOCTLS directed towards parport.sys to access the parallel port and get parallel port and pnp information.
> But i couldn’t find any IOCTL to change the bits of control, status or data register.
> Request you too please suggest.

What bits do you want to control?? You have
IOCTL_INTERNAL_PARALLEL_SET_CHIP_MODE to select EPP and ECP modes.? To
write data, you use an IRP_MJ_WRITE request.? To read data, you use an
IRP_MJ_READ request.? You aren’t supposed to worry about the specific
bits in the control and status registers.? That’s handled internally by
parport.sys.? That’s what it means to have an abstraction – parport.sys
worries about the bit-level details.? You worry about the task you need
to do.

You haven’t really shared with us what, exactly, you are trying to do.
What are you controlling here?? If you’re just trying to stream data in
and out, the abstraction will do what you need.? If you need more direct
control, then you need to toss out parport.sys and do your own thing.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

The presumption that the bits in the registers have some meaning is
unfounded. I might have a built-in parallel port on some old legacy
board, or I might have a PCI-based adapter which doesn’t have I/O ports at
all (just memory-mapped registers). The drivers worry about this, and
anything above the lowest-level driver has NO IDEA what the implementation
is. As Time says, that’s what we mean by “abstraction”.

If you go for the raw ports, it means you will develop a driver that is
known to work on exactly one machine in the known universe: yours. If you
expect it to work on any other machine, stick with the abstractions.
joe

Anshul Makkar wrote:
> Tim, thanks for the reply… Sorry, but i couldn’t understand completly.
> I have used IOCTLS directed towards parport.sys to access the parallel
> port and get parallel port and pnp information.
> But i couldn’t find any IOCTL to change the bits of control, status or
> data register.
> Request you too please suggest.

What bits do you want to control? You have
IOCTL_INTERNAL_PARALLEL_SET_CHIP_MODE to select EPP and ECP modes. To
write data, you use an IRP_MJ_WRITE request. To read data, you use an
IRP_MJ_READ request. You aren’t supposed to worry about the specific
bits in the control and status registers. That’s handled internally by
parport.sys. That’s what it means to have an abstraction – parport.sys
worries about the bit-level details. You worry about the task you need
to do.

You haven’t really shared with us what, exactly, you are trying to do.
What are you controlling here? If you’re just trying to stream data in
and out, the abstraction will do what you need. If you need more direct
control, then you need to toss out parport.sys and do your own thing.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Joe, I totally agree with you … I need to stick to abstraction…
But that’s what I am wondering and trying to find an answer to - How to access status and control register using abstraction… I need to access them , does abstraction provides any means (functions or IOCTLs) which can give me access to these registers.

?
Thanks
Anshul Makkar
www.justkernel.com


From: “xxxxx@flounder.com
To: Windows System Software Devs Interest List
Sent: Wednesday, 29 February 2012 11:40 AM
Subject: Re: [ntdev] Access control , data and status register of parallel port

The presumption that the bits in the registers have some meaning is
unfounded.? I might have a built-in parallel port on some old legacy
board, or I might have a PCI-based adapter which doesn’t have I/O ports at
all (just memory-mapped registers).? The drivers worry about this, and
anything above the lowest-level driver has NO IDEA what the implementation
is.? As Time says, that’s what we mean by “abstraction”.

If you go for the raw ports, it means you will develop a driver that is
known to work on exactly one machine in the known universe: yours.? If you
expect it to work on any other machine, stick with the abstractions.
? ? ? joe

> Anshul Makkar wrote:
>> Tim, thanks for the reply… Sorry, but i couldn’t understand completly.
>> I have used IOCTLS directed towards parport.sys to access the parallel
>> port and get parallel port and pnp information.
>> But i couldn’t find any IOCTL to change the bits of control, status or
>> data register.
>> Request you too please suggest.
>
> What bits do you want to control?? You have
> IOCTL_INTERNAL_PARALLEL_SET_CHIP_MODE to select EPP and ECP modes.? To
> write data, you use an IRP_MJ_WRITE request.? To read data, you use an
> IRP_MJ_READ request.? You aren’t supposed to worry about the specific
> bits in the control and status registers.? That’s handled internally by
> parport.sys.? That’s what it means to have an abstraction – parport.sys
> worries about the bit-level details.? You worry about the task you need
> to do.
>
> You haven’t really shared with us what, exactly, you are trying to do.
> What are you controlling here?? If you’re just trying to stream data in
> and out, the abstraction will do what you need.? If you need more direct
> control, then you need to toss out parport.sys and do your own thing.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

The point Tim & Joe are trying to make is that you don’t need access to them. What you need is some way to present a parallel port to a virtual environment that runs in Windows.

Depending on what that virtual environment consists of, there are several ways to provide that ability, but no one other than you knows what is possible in your environment unless you tell us more

“anshul makkar” wrote in message news:xxxxx@ntdev…
Joe, I totally agree with you … I need to stick to abstraction…
But that’s what I am wondering and trying to find an answer to - How to access status and control register using abstraction… I need to access them , does abstraction provides any means (functions or IOCTLs) which can give me access to these registers.

Thanks
Anshul Makkar
www.justkernel.com

--------------------------------------------------------------------------------
From: “xxxxx@flounder.com
To: Windows System Software Devs Interest List
Sent: Wednesday, 29 February 2012 11:40 AM
Subject: Re: [ntdev] Access control , data and status register of parallel port

The presumption that the bits in the registers have some meaning is
unfounded. I might have a built-in parallel port on some old legacy
board, or I might have a PCI-based adapter which doesn’t have I/O ports at
all (just memory-mapped registers). The drivers worry about this, and
anything above the lowest-level driver has NO IDEA what the implementation
is. As Time says, that’s what we mean by “abstraction”.

If you go for the raw ports, it means you will develop a driver that is
known to work on exactly one machine in the known universe: yours. If you
expect it to work on any other machine, stick with the abstractions.
joe

> Anshul Makkar wrote:
>> Tim, thanks for the reply… Sorry, but i couldn’t understand completly.
>> I have used IOCTLS directed towards parport.sys to access the parallel
>> port and get parallel port and pnp information.
>> But i couldn’t find any IOCTL to change the bits of control, status or
>> data register.
>> Request you too please suggest.
>
> What bits do you want to control? You have
> IOCTL_INTERNAL_PARALLEL_SET_CHIP_MODE to select EPP and ECP modes. To
> write data, you use an IRP_MJ_WRITE request. To read data, you use an
> IRP_MJ_READ request. You aren’t supposed to worry about the specific
> bits in the control and status registers. That’s handled internally by
> parport.sys. That’s what it means to have an abstraction – parport.sys
> worries about the bit-level details. You worry about the task you need
> to do.
>
> You haven’t really shared with us what, exactly, you are trying to do.
> What are you controlling here? If you’re just trying to stream data in
> and out, the abstraction will do what you need. If you need more direct
> control, then you need to toss out parport.sys and do your own thing.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Sorry , if I was not able to comprehend the mail properly.

Yes, exactly I need to present the parallel port to virtual environment so that guest can direct access it.

Please suggest some ways of providing this ability…

What I was thinking off is write a kernel mode driver that can gain exclusive access to parallel port data register and also to control and status register. That’s why I was looking for some way of (“getting access” was wrongly interpreted) “presenting parallel port” (control , status and data registers) to virtual environment.(using abstraction) .

Please let me know if you want any other information…

 
Thanks
Anshul Makkar
www.justkernel.com


From: m
To: Windows System Software Devs Interest List
Sent: Wednesday, 29 February 2012 7:09 PM
Subject: Re:[ntdev] Access control , data and status register of parallel port

The point Tim & Joe are trying to make is that you don’t need access to
them. What you need is some way to present a parallel port to a virtual
environment that runs in Windows.

Depending on what that virtual environment consists of, there are several
ways to provide that ability, but no one other than you knows what is possible
in your environment unless you tell us more



“anshul makkar” wrote in message
news:xxxxx@ntdev…
Joe, I totally agree with you … I need to stick to
abstraction…
But that’s what I am wondering and trying to find an answer to - How
to access status and control register using abstraction… I need to access them
, does abstraction provides any means (functions or IOCTLs) which can give me
access to these registers.


Thanks
Anshul Makkar
www.justkernel.com



________________________________
From: “xxxxx@flounder.com

To: Windows System Software Devs Interest
List
Sent: Wednesday, 29 February 2012 11:40
AM
Subject: Re: [ntdev] Access
control , data and status register of parallel port

The
presumption that the bits in the registers have some meaning
is
unfounded. I might have a built-in parallel port on some old
legacy
board, or I might have a PCI-based adapter which doesn’t have I/O
ports at
all (just memory-mapped registers). The drivers worry about
this, and
anything above the lowest-level driver has NO IDEA what the
implementation
is. As Time says, that’s what we mean by
“abstraction”.

If you go for the raw ports, it means you will develop a
driver that is
known to work on exactly one machine in the known universe:
yours. If you
expect it to work on any other machine, stick with the
abstractions.
joe

> Anshul
Makkar wrote:
>> Tim, thanks for the reply… Sorry, but i couldn’t
understand completly.
>> I have used IOCTLS directed towards
parport.sys to access the parallel
>> port and get parallel port and
pnp information.
>> But i couldn’t find any IOCTL to change the bits of
control, status or
>> data register.
>> Request you too please
suggest.
>
> What bits do you want to control? You
have
> IOCTL_INTERNAL_PARALLEL_SET_CHIP_MODE to select EPP and ECP
modes. To
> write data, you use an IRP_MJ_WRITE request. To
read data, you use an
> IRP_MJ_READ request. You aren’t supposed to
worry about the specific
> bits in the control and status registers.
That’s handled internally by
> parport.sys. That’s what it means to
have an abstraction – parport.sys
> worries about the bit-level
details. You worry about the task you need
> to do.
>
>
You haven’t really shared with us what, exactly, you are trying to do.
>
What are you controlling here? If you’re just trying to stream data
in
> and out, the abstraction will do what you need. If you need
more direct
> control, then you need to toss out parport.sys and do your
own thing.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza &
Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by
OSR
>
> For our schedule of WDF, WDM, debugging and other seminars
visit:
> http://www.osr.com/seminars
>
> To unsubscribe,
visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV
is sponsored by OSR

For our schedule of WDF, WDM, debugging and other
seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the
List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

What you need to do is to emulate a port rather than hijacking a port on the physical machine. The data that you read out of this virtual port can then be redirected to the physical parallel port (if one exists in the machine) or to some other device or stream. This eliminates the problems you have with direct hardware access of a device you don’t own (and may not exist) and also allows you to arbitrate between multiple guests who gets access to what and when. The limitation of this design is that the virtual environment can’t directly access the hardware, but then that is usually one of the main features of virtual environments in the first place.

“anshul makkar” wrote in message news:xxxxx@ntdev…
Sorry , if I was not able to comprehend the mail properly.

Yes, exactly I need to present the parallel port to virtual environment so that guest can direct access it.

Please suggest some ways of providing this ability…

What I was thinking off is write a kernel mode driver that can gain exclusive access to parallel port data register and also to control and status register. That’s why I was looking for some way of (“getting access” was wrongly interpreted) “presenting parallel port” (control , status and data registers) to virtual environment.(using abstraction) .

Please let me know if you want any other information…

Thanks
Anshul Makkar
www.justkernel.com

--------------------------------------------------------------------------------
From: m
To: Windows System Software Devs Interest List
Sent: Wednesday, 29 February 2012 7:09 PM
Subject: Re:[ntdev] Access control , data and status register of parallel port

The point Tim & Joe are trying to make is that you don’t need access to them. What you need is some way to present a parallel port to a virtual environment that runs in Windows.

Depending on what that virtual environment consists of, there are several ways to provide that ability, but no one other than you knows what is possible in your environment unless you tell us more

“anshul makkar” wrote in message news:xxxxx@ntdev…
Joe, I totally agree with you … I need to stick to abstraction…
But that’s what I am wondering and trying to find an answer to - How to access status and control register using abstraction… I need to access them , does abstraction provides any means (functions or IOCTLs) which can give me access to these registers.

Thanks
Anshul Makkar
www.justkernel.com

--------------------------------------------------------------------------------
From: “xxxxx@flounder.com
To: Windows System Software Devs Interest List
Sent: Wednesday, 29 February 2012 11:40 AM
Subject: Re: [ntdev] Access control , data and status register of parallel port

The presumption that the bits in the registers have some meaning is
unfounded. I might have a built-in parallel port on some old legacy
board, or I might have a PCI-based adapter which doesn’t have I/O ports at
all (just memory-mapped registers). The drivers worry about this, and
anything above the lowest-level driver has NO IDEA what the implementation
is. As Time says, that’s what we mean by “abstraction”.

If you go for the raw ports, it means you will develop a driver that is
known to work on exactly one machine in the known universe: yours. If you
expect it to work on any other machine, stick with the abstractions.
joe

> Anshul Makkar wrote:
>> Tim, thanks for the reply… Sorry, but i couldn’t understand completly.
>> I have used IOCTLS directed towards parport.sys to access the parallel
>> port and get parallel port and pnp information.
>> But i couldn’t find any IOCTL to change the bits of control, status or
>> data register.
>> Request you too please suggest.
>
> What bits do you want to control? You have
> IOCTL_INTERNAL_PARALLEL_SET_CHIP_MODE to select EPP and ECP modes. To
> write data, you use an IRP_MJ_WRITE request. To read data, you use an
> IRP_MJ_READ request. You aren’t supposed to worry about the specific
> bits in the control and status registers. That’s handled internally by
> parport.sys. That’s what it means to have an abstraction – parport.sys
> worries about the bit-level details. You worry about the task you need
> to do.
>
> You haven’t really shared with us what, exactly, you are trying to do.
> What are you controlling here? If you’re just trying to stream data in
> and out, the abstraction will do what you need. If you need more direct
> control, then you need to toss out parport.sys and do your own thing.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Right, exactly, thats what I am trying to achieve.

I have a emulation driver ready that creates virtual parallel port visible to guest on the VM. Now I need to transfer data from the emulation driver to the actual physical port which I do through my kernel port driver (This driver writes to the parallel port via parport.sy “abstraction”).

Now we also have he provision so as to enable guest access status and control register … (This is what I want to achieve).

Thanks
Anshul Makkar
www.justkernel.com


From: m
To: Windows System Software Devs Interest List
Sent: Wednesday, 29 February 2012 8:44 PM
Subject: Re:[ntdev] Access control , data and status register of parallel port

What you need to do is to emulate a port rather than hijacking a port on
the physical machine. The data that you read out of this virtual port can
then be redirected to the physical parallel port (if one exists in the machine)
or to some other device or stream. This eliminates the problems you have
with direct hardware access of a device you don’t own (and may not exist) and
also allows you to arbitrate between multiple guests who gets access to what and
when. The limitation of this design is that the virtual environment can’t
directly access the hardware, but then that is usually one of the main features
of virtual environments in the first place.

“anshul makkar” wrote in message
news:xxxxx@ntdev…
Sorry , if I was not able to comprehend the mail
properly.

Yes, exactly I need to present the parallel port to virtual
environment so that guest can direct access it.

Please suggest some ways of providing this ability…

What I was thinking off is write a kernel mode driver that can gain
exclusive access to parallel port data register and also to control and status
register. That’s why I was looking for some way of (“getting access” was wrongly
interpreted) “presenting parallel port” (control , status and data registers) to
virtual environment.(using abstraction) .

Please let me know if you want any other
information…


Thanks
Anshul Makkar
www.justkernel.com




From: m

To: Windows System Software Devs Interest
List
Sent: Wednesday, 29 February 2012 7:09
PM
Subject: Re:[ntdev] Access
control , data and status register of parallel port

The point Tim & Joe are trying to make is that you don’t need access to
them. What you need is some way to present a parallel port to a virtual
environment that runs in Windows.

Depending on what that virtual environment consists of, there are several
ways to provide that ability, but no one other than you knows what is possible
in your environment unless you tell us more



“anshul makkar” wrote in message
news:xxxxx@ntdev…
Joe, I totally agree with you … I need to stick to
abstraction…
But that’s what I am wondering and trying to find an answer to - How
to access status and control register using abstraction… I need to access them
, does abstraction provides any means (functions or IOCTLs) which can give me
access to these registers.


Thanks
Anshul Makkar
www.justkernel.com




From: “xxxxx@flounder.com

To: Windows System Software Devs Interest
List
Sent: Wednesday, 29 February 2012 11:40
AM
Subject: Re: [ntdev] Access
control , data and status register of parallel port

The
presumption that the bits in the registers have some meaning
is
unfounded. I might have a built-in parallel port on some old
legacy
board, or I might have a PCI-based adapter which doesn’t have I/O
ports at
all (just memory-mapped registers). The drivers worry about
this, and
anything above the lowest-level driver has NO IDEA what the
implementation
is. As Time says, that’s what we mean by
“abstraction”.

If you go for the raw ports, it means you will develop a
driver that is
known to work on exactly one machine in the known universe:
yours. If you
expect it to work on any other machine, stick with the
abstractions.
joe

> Anshul
Makkar wrote:
>> Tim, thanks for the reply… Sorry, but i couldn’t
understand completly.
>> I have used IOCTLS directed towards
parport.sys to access the parallel
>> port and get parallel port and
pnp information.
>> But i couldn’t find any IOCTL to change the bits of
control, status or
>> data register.
>> Request you too please
suggest.
>
> What bits do you want to control? You
have
> IOCTL_INTERNAL_PARALLEL_SET_CHIP_MODE to select EPP and ECP
modes. To
> write data, you use an IRP_MJ_WRITE request. To
read data, you use an
> IRP_MJ_READ request. You aren’t supposed to
worry about the specific
> bits in the control and status registers.
That’s handled internally by
> parport.sys. That’s what it means to
have an abstraction – parport.sys
> worries about the bit-level
details. You worry about the task you need
> to do.
>
>
You haven’t really shared with us what, exactly, you are trying to do.
>
What are you controlling here? If you’re just trying to stream data
in
> and out, the abstraction will do what you need. If you need
more direct
> control, then you need to toss out parport.sys and do your
own thing.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza &
Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by
OSR
>
> For our schedule of WDF, WDM, debugging and other seminars
visit:
> http://www.osr.com/seminars
>
> To unsubscribe,
visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV
is sponsored by OSR

For our schedule of WDF, WDM, debugging and other
seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the
List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging
and other seminars visit:
http://www.osr.com/seminars

To
unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

anshul makkar wrote:

Right, exactly, thats what I am trying to achieve.

I have a emulation driver ready that creates virtual parallel port
visible to guest on the VM. Now I need to transfer data from the
emulation driver to the actual physical port which I do through my
kernel port driver (This driver writes to the parallel port via
parport.sy “abstraction”).

Now we also have he provision so as to enable guest access status and
control register … (This is what I want to achieve).

Do you plan to offer completely general purpose parallel port services
to your client systems? For example, do you plan to support Linux and
MS-DOS clients? If you really need general and arbitrary access, then I
don’t see that you have any choice other than to throw out parport.sys
and write your own driver. The abstraction is always going to be in the
way.

Parport.sys, for example, never uses motherboard DMA, because it always
hurts performance. If you want to allow clients to use that, you’ll
have to handle it yourself.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

In order to allow the guest to get access like this, you will need to have a driver for THE parallel port hardware on the system. The general purpose abstract interface cannot support arbitrary hardware access (by design) and so you will need to write a COMPLETE replacement for ALL models of parallel port you plan to support.

Then again, this is only really relevant if your guest is DOS or something like it. For any other OS, it would be easier by far to write a driver for that OS that interfaces with your hypervisor (a la hyper-v extensions).

“anshul makkar” wrote in message news:xxxxx@ntdev…
Right, exactly, thats what I am trying to achieve.

I have a emulation driver ready that creates virtual parallel port visible to guest on the VM. Now I need to transfer data from the emulation driver to the actual physical port which I do through my kernel port driver (This driver writes to the parallel port via parport.sy “abstraction”).

Now we also have he provision so as to enable guest access status and control register … (This is what I want to achieve).

Thanks
Anshul Makkar
www.justkernel.com

--------------------------------------------------------------------------------
From: m
To: Windows System Software Devs Interest List
Sent: Wednesday, 29 February 2012 8:44 PM
Subject: Re:[ntdev] Access control , data and status register of parallel port

What you need to do is to emulate a port rather than hijacking a port on the physical machine. The data that you read out of this virtual port can then be redirected to the physical parallel port (if one exists in the machine) or to some other device or stream. This eliminates the problems you have with direct hardware access of a device you don’t own (and may not exist) and also allows you to arbitrate between multiple guests who gets access to what and when. The limitation of this design is that the virtual environment can’t directly access the hardware, but then that is usually one of the main features of virtual environments in the first place.

“anshul makkar” wrote in message news:xxxxx@ntdev…
Sorry , if I was not able to comprehend the mail properly.

Yes, exactly I need to present the parallel port to virtual environment so that guest can direct access it.

Please suggest some ways of providing this ability…

What I was thinking off is write a kernel mode driver that can gain exclusive access to parallel port data register and also to control and status register. That’s why I was looking for some way of (“getting access” was wrongly interpreted) “presenting parallel port” (control , status and data registers) to virtual environment.(using abstraction) .

Please let me know if you want any other information…

Thanks
Anshul Makkar
www.justkernel.com

--------------------------------------------------------------------------------
From: m
To: Windows System Software Devs Interest List
Sent: Wednesday, 29 February 2012 7:09 PM
Subject: Re:[ntdev] Access control , data and status register of parallel port

The point Tim & Joe are trying to make is that you don’t need access to them. What you need is some way to present a parallel port to a virtual environment that runs in Windows.

Depending on what that virtual environment consists of, there are several ways to provide that ability, but no one other than you knows what is possible in your environment unless you tell us more

“anshul makkar” wrote in message news:xxxxx@ntdev…
Joe, I totally agree with you … I need to stick to abstraction…
But that’s what I am wondering and trying to find an answer to - How to access status and control register using abstraction… I need to access them , does abstraction provides any means (functions or IOCTLs) which can give me access to these registers.

Thanks
Anshul Makkar
www.justkernel.com

--------------------------------------------------------------------------------
From: “xxxxx@flounder.com
To: Windows System Software Devs Interest List
Sent: Wednesday, 29 February 2012 11:40 AM
Subject: Re: [ntdev] Access control , data and status register of parallel port

The presumption that the bits in the registers have some meaning is
unfounded. I might have a built-in parallel port on some old legacy
board, or I might have a PCI-based adapter which doesn’t have I/O ports at
all (just memory-mapped registers). The drivers worry about this, and
anything above the lowest-level driver has NO IDEA what the implementation
is. As Time says, that’s what we mean by “abstraction”.

If you go for the raw ports, it means you will develop a driver that is
known to work on exactly one machine in the known universe: yours. If you
expect it to work on any other machine, stick with the abstractions.
joe

> Anshul Makkar wrote:
>> Tim, thanks for the reply… Sorry, but i couldn’t understand completly.
>> I have used IOCTLS directed towards parport.sys to access the parallel
>> port and get parallel port and pnp information.
>> But i couldn’t find any IOCTL to change the bits of control, status or
>> data register.
>> Request you too please suggest.
>
> What bits do you want to control? You have
> IOCTL_INTERNAL_PARALLEL_SET_CHIP_MODE to select EPP and ECP modes. To
> write data, you use an IRP_MJ_WRITE request. To read data, you use an
> IRP_MJ_READ request. You aren’t supposed to worry about the specific
> bits in the control and status registers. That’s handled internally by
> parport.sys. That’s what it means to have an abstraction – parport.sys
> worries about the bit-level details. You worry about the task you need
> to do.
>
> You haven’t really shared with us what, exactly, you are trying to do.
> What are you controlling here? If you’re just trying to stream data in
> and out, the abstraction will do what you need. If you need more direct
> control, then you need to toss out parport.sys and do your own thing.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I presume you know that the parallel port is implemented in a specific
fashion, and from a specific manufacturer. Knowing where it is on your
machine is not particularly interesting if you expect this driver to work
on any machine other than yours.

In the modern world, most machines don’t even HAVE parallel ports, unless
the owner has installed a third-party port. If so, you have no idea how
that port is implemented, so you cannot depend on what the implementation
values mean.

Why do you think the address is mapped? You will be dealing with a port,
not a memory-mapped address, if you are using default parallel port
implementations.

If this is some private project that exists only on your machine, feel
free. But if you expect it to work on any other machine, you can’t read
and write the ports directly, because they may not exist.
joe

Hi,

I have written a small kernel mode driver that access the raw parallel
port… I am able successfully allocate parallel port and get information
from parallel port using internal parallel port internal IOCTLs.

Now I want to access the data, control registers and status register (read
and write to it) .

So one of the method is to use the Controller member of
PARALLEL_PORT_INFORMATION to access these registers i.e. (Controller+ 0 )
= Data or ECP FIFO (Address), (Controller + 1 ) = Status Register,
(Controller + 2 ) = Control Register .

But that will mean directly accessing the register using mapped address
which will not bring parport.sys into picture… I am not sure whether this
is the correct method ? . Please suggest if any other proper way or IOCTL
is available through which I can access these registers.

Also is there any mechanism available to change the direction of  parallel
port direction… ?

 
Thanks
Anshul Makkar
www.justkernel.com


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer