"start" is a pointer to unsigned int, which is a 4-byte data type. Therefore,
"(start + 0x8)" is the address 0xE8000020. Try this:
volatile unsigned char *start;
--- In "craignied" <> wrote:
>
> Any idea why the following isn't turning on the green LED on the TS-7800?
> The user manual claims that the Lattice FPGA's core is at base physical
> address 0xe8000000, and the green LED is bit 30 at offset 0x8
> (http://www.embeddedarm.com/about/resource.php?item=393#appendixB) ?
>
>
> int main(int argc, char **argv)
> {
> volatile unsigned int *start, *LED;
> int fd = open("/dev/mem", O_RDWR|O_SYNC);
> assert(fd != -1);
>
> start = (unsigned int *)mmap(0, getpagesize(), PROT_READ|PROT_WRITE,
> MAP_SHARED, fd, 0xE8000000);
> LED = (unsigned int *)(start + 0x8);
> while( 1 )
> {
> *LED = 0x40000000;
> }
>
> close( fd );
> return 0;
> }
>
> TIA,
> Craig
>
------------------------------------
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/
|