ts-7000
[Top] [All Lists]

[ts-7000] Re: 7260 SPI & MAX6675

To:
Subject: [ts-7000] Re: 7260 SPI & MAX6675
From: "yavin229" <>
Date: Fri, 05 Nov 2010 01:39:30 -0000
Hi Jim, I think my misunderstanding on how the variable types change my 
offset's is likely
the source of all my problems. I would really like to understand the math 
behind the problem you
see. So in the snip you took:


#define MEMLOC 0x80840000


 volatile unsigned long int *memloc;

 memloc = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, MEMLOC);
 assert(memloc != MAP_FAILED);


---------
So my 'getconf PAGE_SIZE' returns 4096(bytes?) so I should be able to configure 
offsets to anywhere in this
range from this one mapping, is that correct?


--------
You mentioned that adding 4 to my 'memloc' INT pointer would actually give me a 
'memloc + 16 in bytes'.
I guess I don't understand the translation. A 'char' and a (short) 'int' are 
both 8 bits long I thought?
My thinking was i was adding 4 blocks of 8bits or 32 bits which traslates to 4 
bytes or 
0x80840000(byte address) + 4bytes = 0x80840004. 


--------
One last question I had was if someone could help me understand the PEEK 
fuction:

int fd,diobits,diobits_post_change, dio_direction_bits, 
dio_direction_bits_post_change;
 diobits = PEEK8( (unsigned long)(memloc + 0x04));

Lets say for this case I changed memloc to be a char:

 volatile unsigned char *memloc;

Forgive my ignorance here but I am not sure what the 'unsigned long' after PEEK 
is doing here. 
Is it passing the result of my char+4 into the function as a unsigned long then 
spiting out a 'int'
to my variable?


Thanks for all the help!









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

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