I need to control an GPIO from the boot loader.
I modify the function board_init() in
u-boot-2009.11-psp03.00.01.06.sdk/board/ti/var-am35xx/var-am35xx.c
int board_init(void)
{
unsigned int Teo1;
DECLARE_GLOBAL_DATA_PTR;
gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
/* board id for Linux */
gd->bd->bi_arch_number = MACH_TYPE_OMAP3517EVM;
/* boot param addr */
gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
Teo1 = (*(volatile unsigned int *)(OMAP34XX_GPIO5_BASE +
OMAP24XX_GPIO_OE));//set direction
Teo1 = Teo1 | 0b1000; //4 I/O (gpio_131) is an input
(*(volatile unsigned int *)(OMAP34XX_GPIO5_BASE +
OMAP24XX_GPIO_OE)) = Teo1;
while (1)
{
unsigned int nTeo2 = (*(volatile unsigned int
*)(OMAP34XX_GPIO5_BASE + OMAP24XX_GPIO_DATAOUT));
unsigned int nTeo3 = (*(volatile unsigned int
*)(OMAP34XX_GPIO5_BASE + OMAP24XX_GPIO_DATAIN));
printf("nTeo2 %d\n",nTeo2);
printf("nTeo3 %d\n",nTeo3);
}
return 0;
}
The outuput string doesn't change even if I change the the input.
Where Is the error?
Is there another modality?
Thanks
Teo