ts-7000
[Top] [All Lists]

Re: [ts-7000] Re: Accessing Latched Outputs TS7390

To:
Subject: Re: [ts-7000] Re: Accessing Latched Outputs TS7390
From: Jim Jackson <>
Date: Wed, 1 Oct 2008 13:11:14 +0100 (BST)


On Wed, 1 Oct 2008, PeterElliot wrote:

> Hi,
>
> When you use mmap you should always use a page aligned base address
> and then add an offset to the returned pointer.
>
> Thus:
>
> spi_ioptr = (unsigned long)mmap(0, getpagesize(),
> PROT_READ|PROT_WRITE, MAP_SHARED, spi_fd, 0x600FF084);
>
> should be:
>
> volatile unsigned long *spi_ioptr
>
> spi_ioptr = (unsigned long)mmap(0, getpagesize(),
               (unsigned long *).....



> PROT_READ|PROT_WRITE, MAP_SHARED, spi_fd, 0x600FF000);
>
> <check it's assigned correctly here>
>
> spi_ioptr += spi_ioptr (0x84/sizeof(unsigned long));
>
> You then access the data via spi_ioptr[offset];
>
> Hope this helps.
>
> PJE
>
> --- In  "jtckendrick" <> wrote:
>>
>> I am having an issue with getting access to the memory area
> specified.
>> When I try to write to that area of memory I get SIGSEGV faults.  I
> am
>> referencing the TS7350 preliminary manual. Here is a sample of the
> code.
>> spi_fd is integer type and spi_ioptr it unsigned long.  SPI_IOBASE
> is
>> defined as 0x600FF084.
>>
>> spi_fd = open("/dev/mem", O_RDWR|O_SYNC);
>>
>> spi_ioptr = (unsigned long)mmap(0, getpagesize(),
> PROT_READ|PROT_WRITE,spi_fd, SPI_IOBASE);
>>
>>
>> assert(&spi_ioptr != MAP_FAILED);
>>
>> PEEK32(spi_ioptr,1);
>>
>> SIGSEGV is thrown on PEEK32
>>
>
>
>
>

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

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