RES: GPIO
Wendell Pereira da Silva
wendell.silva at compsisnet.com.br
Mon May 23 18:46:26 UTC 2011
Guilherme,
In this case (ERC-32), the GPIO configuration register is at 0x01F800A8, and the I/O register is 0x01F800AC. So, the following code fragment illustrates what you want to do:
#define GPIO_DATA_ADDR (unsigned long *)0x01F800AC
#define GPIO_CONF_ADDR (unsigned long *)0x01F800A8
rtems_task Init(...)
{
// configure all GPIO pins as output
*GPIO_CONF_ADDR = 0x00;
// set bit GPIO[0] and clear other ones.
*GPIO_DATA_ADDR = 0x01;
// set bit GPIO[3] and leave others untouched.
*GPIO_DATA_ADDR = *GPIO_DATA_ADDR | (1 << 3);
}
See the ERC32 datasheet for further details.
Also, there's a lot of good references on Embedded Development in the Internet.
A good one is the book: http://ebookee.org/Programming-Embedded-Systems-With-C-and-Gnu-Development-Tools-2nd-Edition_336503.html
Att.
Wendell.
De: rtems-users-bounces at rtems.org [mailto:rtems-users-bounces at rtems.org] Em nome de Guilherme Resende
Enviada em: segunda-feira, 23 de maio de 2011 10:45
Para: rtems-users at rtems.org
Assunto: GPIO
Hello everyone,
First of all, I would like to apologize if the level of my doubt is too low , but I am a newbie in the world of RTEMS and Embedded Programming.
What I've been trying to do , is to access the GPIO ports bit by bit, like, setting GPIO[7] through GPIO[1] as outputs
and GPIO[0] as an input.
Could anyone help me with that?
My embedded processor is Sparc ERC-32
Thanks!
Guilherme Resende
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20110523/c0ca42d4/attachment-0001.html>
More information about the users
mailing list