From:  <[email protected]>
Reply-To:  "[email protected]" <[email protected]>
Date:  Saturday, August 16, 2014 at 9:01 PM
To:  "[email protected]" <[email protected]>
Subject:  [beagleboard] Why use C/C++ file I/O to access GPIO pins?

> Greetings all,
> I've been playing with software and hardware for 30+ years, but I'm new to
> Linux and embedded Linux systems. The code snippets I've been able to find for
> GPIO access all seem use file I/O functions. I've never seen this approach
> before -- I'm accustomed to reading and writing processor registers. The file
> I/O approach seems strange to me, but I'm new here, and there's a lot that
> seems strange.
> 
> So, can someone explain why the file I/O approach is used? Is this a typical
> technique for Linux systems, or something particular to ARM processors? I
> suppose it doesn't really matter, but I prefer to understand why things are
> done as they are.
Well, that is because you are trying to access the GPIO from user space. If
you wanted to access the GPIO from kernel space, you would use a similar
approach to what you did on your smaller processors. The only difference
would be that each pin supports several functions which are defined by Mode
0 through 7. To use a pin for GPIO, you would use Mode 7. Also, the
processor has a set register and a clear register so that you don¹t have to
disable interrupts during a real/modify/write. One other approach is to use
mmap so that you can access the processor registers in user space for GPIO
operations or as others have proposed, use the PRU to control GPIO.

Regards,
John
> 
> 
> Thanks very much, folks.
> 
> Yours in newness,
> Tim
> 
> 
> -- 
> For more options, visit http://beagleboard.org/discuss
> --- 
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.


-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to