[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Axcessing *R_PAR1_CTRL_DATA from programs under Linux.
On Mon, 30 Apr 2001, Jonas Aaberg wrote:
> > > If you need to access the registers you should do it
> > > from kernel space e.g. from a device driver.
> But on a second thought, for example the X server must be
> able to change internal registers to switch to graphic mode.
Because Linux on an x86 platform supports the various forms of memory
mapping needed to access PCI-space and I/O. But please note that this has
been one of the worst things with the X-server in linux; the fact that you
need to be setuid root and directly fiddle with that hardware. With
xfree86 4, DRI and kernel-modules it starts to get better though.
You can do the same on Linux/CRIS; make a /dev/ioregs which user-space can
mmap. It would not be recommended for anything except testing though since
it negates any gain you get in debugging by having an MMU (your program
can completely crash the system, destroy your hardware or whatever if you
have a single bug in it).
On the x86, a simulation layer is used to provide individual access to any
of the ports so you don't need to give an application direct access to all
of them (as the mmap would). Something like that could be applied here to
give user-space direct access to a selected set of I/O registers, but it
would be more complicated to implement.
The /dev/gpio device is there for allowing user-mode to fiddle with I/O in
a simple and safe way (using the ioctl's). The par-port driver should
provide the same kind of ioctl to directly access the port, or it should
be added to the gpio driver.