EINT pins in GPIO connector.

"Sandeep G.R" <[email protected]>
Newsgroups gmane.linux.ports.arm.general
Message-ID <[email protected]>
 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,

_______________________________________________
linux-arm mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.