c - Void * parameter address shift -


i using codewarrior 8.3 (ide version 5.9) program 56f8367 dsc.

i using respected third party software, imagine know doing , don't want mess code much, playing around passing void * parameters , not totally familiar with.

so have function:

static void t_callback _transmit(   void *pcontext,   tx_data *ptxdescriptor) {   context *plinkcontext = (context *)pcontext;   ... } 

which being called through function pointer. when stop processor before function call, can see address pointed pcontext 0x1000, after cast here, address pointed plinkcontext 0x0800. this, causes problems because start writing , reading different part of memory.

there weird going on byte addressing/alignment getting "shifted" on 1 bit. see going wrong, don't understand why or, more importantly, how solve problem.

what should looking for?

(editing add call per comment request) - although, i'm not sure how considering buried in structures , being called through function pointer. can "ptprtcontext->tmw.pchannel->plinkcontext" of different type context, plinkcontext match beginning of context, think trying insert in there.

static void t_local _transmitnextframe(   d_context *ptprtcontext) {   ...   /* transmit frame */   ptprtcontext->t.pchannel->plink->plinktransmit(     ptprtcontext->t.pchannel->plinkcontext, &ptprtcontext->linktxdescriptor); } 

you "shifted on 1 byte," 1 bit, is, number divided 2.

this result of using byte address in 1 context , (2-byte) word address in context. refer same address.

does decipher it?


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -