[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gpio question on Axis82



I'd like to use the gpio pins g1-g4, which are available through a NAND gate on
header pinx X23.

using this basic test program below, the pins don't seem to change.  The pins
are multiplexed to a bunch of devices, but I'm pretty sure I've disabled
everything in the kernel config except for Shared-RAM, sicne I'm not sure where
to configure that.  According to the schematic, the pins aren't connected to
anything else, so I think they should be available for use.  How do I ensure
that Shared-RAM is disabled?  is this the same thing as SDRAM (I don't think
so).  Is there something else I need to do?

thanks,

	Kevin

****************************************************************************


#include <stdio.h>
#include <asm/etraxgpio.h>
#include <fcntl.h>
#include <sys/ioctl.h>

int main()
{
    int fd;
    unsigned long bits, mask;


    fd = open("/dev/gpiog", O_RDWR);
    if (fd < 0) {
	printf ("Error opening /dev/gpiog\n");
	perror("open");
	return 0;
    }
    
    bits = ((0x1 << 1) | (0x1 << 4));    // set bits to indicate g1 and g4
    //g1 and g4 have permanent outputs
    while (1) {
	printf ("set bits\n");
	if (ioctl(fd, _IO(ETRAXGPIO_IOCTYPE,IO_SETBITS), bits) <0 ){
	    perror("ioctl, set bits");
	}
	getchar();
	printf("clear bits");
	if (ioctl(fd, _IO(ETRAXGPIO_IOCTYPE,IO_CLRBITS), bits) < 0) {
	    perror("ioctl, clr bits");
	}
	getchar();
    }
}