Hello All.
I'm having difficulty with the SA1110 GPIO and mmap. The following code
compiles and executes, however, the appropriate pin does not toggle as
expected:
volatile unsigned int *gpio_ptr; /* GPIO Register Base Pointer */
volatile unsigned int *GPDR;
volatile unsigned int *GPSR;
volatile unsigned int *GPCR;
/* Open the virtual Memory Map */
int mem_fd = open("/dev/mem",O_SYNC|O_RDWR);
if (mem_fd < 0) {
printf("\nCould not open memory");
exit(1);
}
/* set up the GPIO */
gpio_ptr = (volatile unsigned int*)mmap(NULL,0x4000,
(PROT_READ|PROT_WRITE),MAP_SHARED, mem_fd, 0x90040000);
/* now gpio_ptr points to a virtual mapping to physmem at 0x90040000 */
/* Setup the Various Needed Registers */
GPDR = gpio_ptr + 0x00000004;
GPSR = gpio_ptr + 0x00000008;
GPCR = gpio_ptr + 0x0000000C;
/* Setup the appropriate pins to be outputs */
*GPDR |= 0x0000007C;
/* Set the SC pin high */
*GPSR |= 0x00000004;
Does anyone have any ideas here?
Thanks very much,
Phil
_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
Please visit the above address for information on this list.