ts-7000
[Top] [All Lists]

[ts-7000] GPIO cannot disable IRQ ?!?

To:
Subject: [ts-7000] GPIO cannot disable IRQ ?!?
From: "Clark" <>
Date: Fri, 11 Feb 2011 01:04:50 -0000
I thought that GPIO would have to have GPIOFIntEn 
read as non-zero for the interrupt to be enabled.
NO.  Interrupts are unaffected by the values in GPIOFIntEn,
GPIOFIntType1, and GPIOFIntType2 and frankly I am very
confused. 

IRQ 40 gets enabled but the GPIO registers do not change.  Also, 
setting them using the below code has no effect.  From kernel side, 
I don't read back what I write, only ever zeros.  The user 
mode program has been hacked many ways now, yet setting zeros into GPIOFIntEn 
does not disable the interrupt?  How can that be?

The TS schematic shows that the interrupt pin we are asserting (with a slow TTL 
square wave) is in fact INT2, which "should" correspond to GPIO port F, right??

Is there some call that sets up GPIO or a jumper that I have missed or 
something?

I wrote a tool today at the behest of several knowledgeable
folk (thank you) that uses /dev/mem to get at GPIO from user mode.
This program is very naive and the values written persist after the
program exits. Why doesn't the interrupt 
enable/disable have any effect?

THANKS

// ___________________________________________________________________________

#include<unistd.h>
#include<sys/types.h>
#include<sys/mman.h>
#include<stdio.h>
#include<fcntl.h>
#include<string.h>

int main(int argc, char **argv)
{
    volatile unsigned int *PFDR, *PFDDR, *GPIOFDB, *GPIOFIntEn, *GPIOFIntType1, 
*GPIOFIntType2;
    int i;
    unsigned char state;
    unsigned char *gpio_ptr;
    int fd = open("/dev/mem", O_RDWR|O_SYNC);

    gpio_ptr = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 
0x80840000);
    
    PFDR = (unsigned int *)(gpio_ptr + 0x30);     // port f
    PFDDR = (unsigned int *)(gpio_ptr + 0x34);    // port f direction register
    GPIOFDB = (unsigned int *)(gpio_ptr + 0x64);  // debounce on port b

    GPIOFIntEn = (unsigned int *)(gpio_ptr + 0x58);
    GPIOFIntType1 = (unsigned int *)(gpio_ptr + 0x4C);
    GPIOFIntType2 = (unsigned int *)(gpio_ptr + 0x50);

    printf( "PFDR=0x%x PFDDR=0x%x GPIOFDB=0x%x GPIOFIntEn=0x%x 
GPIOFIntType1=0x%x GPIOFIntType2=0x%02x\n", *PFDR, *PFDDR, *GPIOFDB, 
*GPIOFIntEn, *GPIOFIntType1, *GPIOFIntType2 );

    if( argc >=2 ) {
        printf( "Configuring port\n" );
        *PFDDR = 0x0;
        *GPIOFIntType1 = 0xffffffff;
        *GPIOFIntEn=0x0; /* all ffff's out of desperation */
        *GPIOFIntType2 = 0x0;
        printf( "PFDR=0x%x PFDDR=0x%x GPIOFDB=0x%x GPIOFIntEn=0x%x 
GPIOFIntType1=0x%x GPIOFIntType2=0x%x\n", *PFDR, *PFDDR, *GPIOFDB, *GPIOFIntEn, 
*GPIOFIntType1, *GPIOFIntType2 );
    }
    
    close(fd);
    return 0;
}




------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU