EINT pins in GPIO connector.

Sandeep G.R grsandeep85 at gmail.com
Thu Dec 10 02:06:00 EST 2009


 Hi,

     I am using S3C2440+7" touchscreen, i need to toggle(0 or 1) the EINT
pins in the GPIO connector ( say GPIO11 & GPIO12) and i have made an program
to toggle the pins but i run my program the pins will be always high(1) by
default and if i change the programs to GPIO connector (say GPIO29, 30, 31,
32 which has been connected to led's in the board) it will toggle and work
fine, Below is my program


*#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>


#define MAP_SIZE 4096UL        /* the size of one page of virtual memory */
#define MAP_MASK (MAP_SIZE - 1)    /* mask used for the one page of virtual
memory */

#define GPIOG_CON    0x56000060 /* physical address of the GPIO G control
register */
#define GPIOG_DAT    0x56000064 /* physical address of the GPIO G data
register */

int main(int argc, char **argv) {
    int fd,count;
    void *map_base, *virt_addr;
    unsigned long read_result, writeval;

    if(argc < 2) {
    fprintf(stderr, "\nUsage:\t%s { seconds }\n"
        "\tseconds : number of seconds to blink\n\n",
        argv[0]);
    exit(1);
    }

    count = strtoul(argv[1], 0, 0);

    /* open the memory device file descriptor */
    if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1)
    return -1;

    /* Map one page */
    map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd,
GPIOG_CON & ~MAP_MASK);
    if(map_base == (void *) -1)
    return -1;

    /* set the virtual memory address to the GPIO G control register */
    virt_addr = map_base + (GPIOG_CON & MAP_MASK);

    /* read the current value for GPIO G control register */
    read_result = *((unsigned long *) virt_addr);

    writeval = read_result;
   // writeval &= ~0x03;        /* mask off the first two bits */
    writeval |= 0x1400;        /* set gpio G5 and G6 to output with value of
0x01 (output)*/
    printf("writing data finished\n");

    *((unsigned long *) virt_addr) = writeval;


    /* change virtual memory address to GPIO G data register */
    virt_addr = map_base + (GPIOG_DAT & MAP_MASK);

    for ( count ; count > 0 ; count--) {
       printf("count=%d\n",count);
    /* read the current value for GPIO G data register */
    read_result = *((unsigned long *) virt_addr);
    writeval = read_result;

    if ( (read_result&(1<<5)) )
    {    writeval &= ~(1<<5);
         writeval |=(1<<6);
    }else
    {
           writeval &= ~(1<<6);
                  writeval |= (1<<5);
    }

    *((unsigned long *) virt_addr) = writeval;
    sleep(1);

    }


    /* read the current value for GPIO G control register */
    read_result = *((unsigned long *) virt_addr);


    writeval = read_result;
    writeval |= (1<<0);


    *((unsigned long *) virt_addr) = writeval;

    /* unmap the virtual memory before exiting the program */
    if(munmap(map_base, MAP_SIZE) == -1)
    return -1;

    close(fd);
    return 0;

}*

How to toggle the EINT pins in the GPIO connector any suggestions would be
advantage.



Thanks & Regards,
SANDEEP G R,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm/attachments/20091210/63df0601/attachment-0001.htm>


More information about the linux-arm mailing list