ts-7000
[Top] [All Lists]

Re: [ts-7000] Re: Reading GPIO ports

To:
Subject: Re: [ts-7000] Re: Reading GPIO ports
From: Jim Jackson <>
Date: Mon, 24 Jul 2006 17:51:49 +0100 (BST)
Hi Guille,

Thanks for the taking the time.

On Mon, 24 Jul 2006, Guillermo Prandi wrote:

> 2) Kernel problem:
>
> You *think* you're not using read/write operations, but mmap consists
> precisely in read/write file system operations... **except** when you
> mmap /dev/mem **and** you use O_SYNC.

actually it doesn't. I've had some fun read kernel sources :-)
Each file device has a function table for various file related functions,
one such function is what to do for an mmap call on the file.

For /dev/mem, it uses the function mmap_mem() in drivers/char/mem.c If the
file flag has O_SYNC set mmap_mem() marks the physical memory for the
regional concerned as non-hardware-cachable. Without O_SYNC you still do a
real memory access, but you may be in danger of reading the last hardware
cache value.

> The fact you are using memory
> accesses doesn't mean that the file system below isn't working.
> Imagine what would happen if you use mmap to access any regular file
> like /etc/hosts or /etc/passwd.

It appears the mmap call for more regular files is often
generic_file_mmap() in mm/filemap.c which does the usual file system
buffering so that mmap will work with disk files as we usually expect.

I've now learnt stuff - so thanks to all conerned.

cheers
Jim


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU