On Fri, 2011-02-11 at 01:04 +0000, Clark wrote:
>
> 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.
I once suggested playing with these registers from userland and was
soundly corrected by Jim Jackson (thanks Jim).
> // __________________________________________________________
>
> #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;
If this is on a ts7260 you need to do a read-modify-write when changing
the port f control registers
> *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;
> }
--
--
Joel R. Morgan
Morgan Millwright Services, Inc.
Linux User #504110 http://counter.li.org/
------------------------------------
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/
|