Skip to contentSkip to conversation

PICs on Linux

DISCUSSION Bart Oldeman 2 participants 2 messages Nov 8, 2004 – Nov 11, 2004

lore
Share & tools
lore
#0 lore raw

Hello,

Quoted 5 lines

The printer driver and DOSEMU's port passing cannot share the physical printer port. Therefore you need to disable the printer driver if you want to use DOSEMU's port passing, either temporarily or permanently.

Quoted 7 lines

Yes, and remember to use 'fast' unless you want to do debugging/tracing: $_ports = "fast range 0x378 0x37a"

means pass through 0x378-0x37a in fast mode.

You have to start DOSEMU as root or use sudo in order for port/irq passing to work.

It's still a bit tricky. This is the nature of direct hardware access under Linux, the jail around you (protected mode OS) needs to be partially broken down. There are security issues to deal with, etc etc. -- this is why we can never let this happen out of the box for a normal (non-root) user.

This is not unique to Linux, under Windows XP there are even people trying to make a buck selling direct hardware access.
http://www.zeecube.com/ParPort2004.htm
we don't ask for $19.95 but you have to pay in other ways (trickier setup) so to speak.

However:
Linux 2.4 and 2.6 kernels provide a ppdev device driver that allows raw parallel port access via /dev/parports/0 etc. DOSEMU could virtualize the parallel port hardware and re-route it through that device thereby avoiding the root issue. I don't have any parallel port hardware to play with but it could be a nice little project to implement in DOSEMU one day.

Speed shouldn't be such a big deal: according to
http://www.ussg.iu.edu/hypermail/linux/kernel/0303.0/0978.html
you can only do about 300000 inb's and outb's per second anyway.

Bart

#1 lore raw

Hi Bart,

Quoted 5 lines · Bart Oldeman

Speed shouldn't be such a big deal: according to
http://www.ussg.iu.edu/hypermail/linux/kernel/0303.0/0978.html
you can only do about 300000 inb's and outb's per second anyway.

Speed betweeen a virtualized and non-virtualized parallel port I/O can be a big deal in my experience. I have at least one device that gives up when parallel ports are passed through in non-fast mode. It operates with tristate data lines and one strobe pin. I'm not sure what the problem is, only that the port must be fast for it to work. On a (much?) faster machine, probably the port virtualization would not affect it. But requiring the use of ppdev doesn't make sense in this case.

By the way, I have benchmarked ppdev vs raw portio performance on this device with a linux program. The difference is quite significant (ppdev only performs around 60% of the rawio speed IIRC). On a better device which uses interrupt or DMA driven I/O, the difference would not be that significant, but on this device, transfer rate depends on how fast the registers of parallel port can be "twiddled", so it is greatly affected by any delay therein.

Signature · 1 line
Ryan Underwood, <[email protected]>