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/
|