<div class="gmail_quote"><div class="gmail_quote"><div>






Hi,<br><br>     I am using S3C2440+7&quot; touchscreen, i need to toggle(0 or 1) the EINT pins in the GPIO connector ( say GPIO11 &amp; 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&#39;s in the board) it will toggle and work fine, Below is my program<div>
<div></div><div class="h5"><br>
<br><b style="color: rgb(0, 0, 153);">#include &lt;stdio.h&gt;<br>#include &lt;stdlib.h&gt;<br>#include &lt;fcntl.h&gt;<br>#include &lt;sys/mman.h&gt;<br><br>  <br>#define MAP_SIZE 4096UL        /* the size of one page of virtual memory */<br>

#define MAP_MASK (MAP_SIZE - 1)    /* mask used for the one page of virtual memory */<br><br>#define GPIOG_CON    0x56000060 /* physical address of the GPIO G control register */<br>#define GPIOG_DAT    0x56000064 /* physical address of the GPIO G data register */<br>

<br>int main(int argc, char **argv) {<br>    int fd,count;<br>    void *map_base, *virt_addr; <br>    unsigned long read_result, writeval;<br><br>    if(argc &lt; 2) {<br>    fprintf(stderr, &quot;\nUsage:\t%s { seconds }\n&quot;<br>

        &quot;\tseconds : number of seconds to blink\n\n&quot;,<br>        argv[0]);<br>    exit(1);<br>    }<br><br>    count = strtoul(argv[1], 0, 0);<br><br>    /* open the memory device file descriptor */<br>    if((fd = open(&quot;/dev/mem&quot;, O_RDWR | O_SYNC)) == -1)<br>

    return -1;<br>    <br>    /* Map one page */<br>    map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, GPIOG_CON &amp; ~MAP_MASK);<br>    if(map_base == (void *) -1)<br>    return -1;<br>    <br>    /* set the virtual memory address to the GPIO G control register */<br>

    virt_addr = map_base + (GPIOG_CON &amp; MAP_MASK);<br><br>    /* read the current value for GPIO G control register */<br>    read_result = *((unsigned long *) virt_addr);<br><br>    writeval = read_result;<br>   // writeval &amp;= ~0x03;        /* mask off the first two bits */<br>

    writeval |= 0x1400;        /* set gpio G5 and G6 to output with value of 0x01 (output)*/ <br>    printf(&quot;writing data finished\n&quot;);<br>    <br>    *((unsigned long *) virt_addr) = writeval;<br><br><br>    /* change virtual memory address to GPIO G data register */<br>

    virt_addr = map_base + (GPIOG_DAT &amp; MAP_MASK);<br><br>    for ( count ; count &gt; 0 ; count--) { <br>       printf(&quot;count=%d\n&quot;,count);<br>    /* read the current value for GPIO G data register */<br>    read_result = *((unsigned long *) virt_addr);<br>

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

                  writeval |= (1&lt;&lt;5);    <br>    }<br>    <br>    *((unsigned long *) virt_addr) = writeval;<br>    sleep(1);<br><br>    }<br><br><br>    /* read the current value for GPIO G control register */<br>
    read_result = *((unsigned long *) virt_addr);<br>
<br>    <br>    writeval = read_result;<br>    writeval |= (1&lt;&lt;0);        <br><br>    <br>    *((unsigned long *) virt_addr) = writeval;<br><br>    /* unmap the virtual memory before exiting the program */<br>    if(munmap(map_base, MAP_SIZE) == -1)<br>

    return -1;<br>        <br>    close(fd);<br>    return 0;<br><br>}</b><br><br></div></div>How to toggle the EINT pins in the GPIO connector any suggestions would be advantage.<br></div><br><br>
</div><br>Thanks &amp; Regards,<br><font color="#888888">SANDEEP G R, <br><br></font></div><br>