You may need to write to the PC/104 MUX registers at 0xE8000030 to 0xE800003C
to set the pins to function as GPIO instead of ISA bus.
--- In "craignied" <> wrote:
>
> This is really strange. The following code should set all of the TS-7800
> PC-104's row A to square waves when OFFSET is 0x10, all of row B when it's
> 0x14, C when it's 0x18 and D when it's 0x1C, right? But I'm only seeing a
> square wave on the 2nd pin of row B (the first pin is GND.) None of the
> other pins in row B show waves when OFFSET is 0x14, and none of the other
> rows ever show waves no matter what the OFFSET is. What am I doing wrong?
>
> TIA,
> Craig
>
> #include <stdio.h> // printf()
> #include <fcntl.h> // open()
> #include <sys/mman.h> // mmap()
> #include <unistd.h> // getpagesize()
> #include <assert.h>
>
> #define BASE 0xE8000000
> #define OFFSET 0x10
>
> int main(int argc, char **argv)
> {
> volatile unsigned int *base, *DR, *DDR;
> unsigned int i, val;
>
> int fd= open( "/dev/mem", O_RDWR|O_SYNC );
> assert( fd != -1 );
>
> // Get pointers to the base address, GPIO and DDR registers
> base = ( unsigned int * ) mmap( 0, getpagesize(), PROT_READ |
> PROT_WRITE, MAP_SHARED, fd, BASE );
> DR = ( unsigned int * ) ( base + ( OFFSET / 0x04 ) ); // data register
> DDR = ( unsigned int * ) ( base + ( ( OFFSET + 0x10 ) / 0x04 ) ); //
> data direction register
>
> *DDR = 0xFFFFFFFF; // set all on DDR to outputs
>
> for ( i = 0; i < 100000; i++ )
> {
> *DR = 0xFFFFFFFF; // turn all pins on DR on
> usleep( 10000 );
> *DR = 0x0; // turn 'em off
> usleep( 10000 );
> }
>
> 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/
|