Hello,
We're doing board bringup on custom HW for an OMAP4460. We'd like to be able to twiddle GPIOs outside of any operating system context, using code that might look something like this:
#define __raw_readl(a) (*(volatile unsigned int*)(a))
#define __raw_writel(v,a) (*(volatile unsigned int*)(a)=(v))
main()
{
unsigned int addr,val;
// write peripheral 1
addr=0x4A31013C;
val=1;
__raw_writel(val,addr);
// read peripheral 2
addr=0x4805513C;
val=__raw_readl(addr);
}
Section 25 of the OMAP4460 TRM discusses the programming of GPIOs, but the explanation is not very clear, and example code is lacking. We know that each bank of GPIOs comes with a set of associated registers that also have to be programmed depending on the purpose (GPIO_SYSCONFIG, GPIO_LEVELDETECT0 if it's an input, etc), and our above example probably needs to include all that. Can someone point us to some code that might assist us?
Ultimately, we'll do GPIO access within the context of Linux device drivers, but for board bringup, we're trying to build a small C/asm source set that does nothing more than validate our target HW.
Thank you,
Petrov