* Réf. : Re: Read in /dev/port with Segmentation Fault
@ 2005-06-09 9:30 scarayol
2005-06-09 14:58 ` R?f. " Matt Porter
0 siblings, 1 reply; 2+ messages in thread
From: scarayol @ 2005-06-09 9:30 UTC (permalink / raw)
To: Matt Porter; +Cc: linuxppc-embedded
Matt,
then what is the use of /dev/port driver file ? When i do "cat /dev/port"
on the standard console, i have also a segmentation fault.
Another question, if i use mmap to map physical addresses of I/O registers,
could i dereference the pointer on virtual adresse to access data or should
i use read/write on the file descriptor ?
Best regards.
Sophie CARAYOL
Matt Porter
<mporter@kernel.cra Pour : scarayol@assystembrime.com
shing.org> cc : linuxppc-embedded@ozlabs.org
Objet : Re: Read in /dev/port with Segmentation Fault
09/06/05 11:12
On Thu, Jun 09, 2005 at 09:30:43AM +0200, scarayol@assystembrime.com wrote:
> Hi all,
>
> I want to access to IO ports on a MPC885. The iopl() is not implemented,
in
> my distribution, to use inw() outw().
> So I use /dev/port. It works for open("/dev/port",..) and lseek() but
when
> i do a read() i have a segmentation fault. I gave all the right to
> /dev/port
> Does anybody have an idea ?
You are trying to use x86-specific interfaces to x86-specific IO space.
By "IO ports" you must mean memory mapped I/O registers since you are
on PPC. From userspace, use mmap() to map physical address space to a
user virtual address range.
-Matt
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: R?f. : Re: Read in /dev/port with Segmentation Fault
2005-06-09 9:30 Réf. : Re: Read in /dev/port with Segmentation Fault scarayol
@ 2005-06-09 14:58 ` Matt Porter
0 siblings, 0 replies; 2+ messages in thread
From: Matt Porter @ 2005-06-09 14:58 UTC (permalink / raw)
To: scarayol; +Cc: linuxppc-embedded
On Thu, Jun 09, 2005 at 11:30:53AM +0200, scarayol@assystembrime.com wrote:
>
> Matt,
>
> then what is the use of /dev/port driver file ? When i do "cat /dev/port"
> on the standard console, i have also a segmentation fault.
Well, it's of no use on PPC. It's an x86-specific driver. It is simply
an alternative method to access x86 I/O ports. This is a hardware
construct that simply does not exist on PPC.
> Another question, if i use mmap to map physical addresses of I/O registers,
> could i dereference the pointer on virtual adresse to access data or should
> i use read/write on the file descriptor ?
Yes you can dereference, that's the point of mmaping I/O into userspace.
You may want to read Linux Device Drivers (either hardcopy or free
version online) for more details. If you google around you'll find
countless examples of people doing simple userspace driver work via
mmaped regs...those might help as a guideline.
-Matt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-06-09 14:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-09 9:30 Réf. : Re: Read in /dev/port with Segmentation Fault scarayol
2005-06-09 14:58 ` R?f. " Matt Porter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).