@@ -318,13 +318,17 unsigned int ahbuartplugin::Read(unsigne | |||
|
318 | 318 | } |
|
319 | 319 | for(int i=0;(unsigned int)i<cnt;i++) |
|
320 | 320 | { |
|
321 | for(int j =0;j<4;j++) | |
|
322 | { | |
|
323 | Value[i]= ((unsigned char)(result[i*4+j])) + Value[i]*256; | |
|
324 | } | |
|
325 |
|
|
|
326 | ||
|
321 | #if __BYTE_ORDER == __LITTLE_ENDIAN | |
|
322 | // for(int j =0;j<4;j++) | |
|
323 | // { | |
|
324 | // Value[i]= ((unsigned char)(result[i*4+j])) + Value[i]*256; | |
|
325 | // } | |
|
326 | Value[i]= socexplorerBswap32(((uint32_t*)result)[i]); | |
|
327 | #elif __BYTE_ORDER == __BIG_ENDIAN | |
|
328 | Value[i]= ((uint32_t*)result)[i]; | |
|
329 | #endif | |
|
327 | 330 | } |
|
331 | read = cnt*4; | |
|
328 | 332 | if(cnt>128) |
|
329 | 333 | SocExplorerEngine::deleteProgressBar(progress); |
|
330 | 334 | free(result); |
@@ -365,10 +369,17 unsigned int ahbuartplugin::Write(unsign | |||
|
365 | 369 | CMD[4] = (char)(((unsigned int)address)&0xFF); |
|
366 | 370 | for(int i=0;i<32;i++) |
|
367 | 371 | { |
|
372 | #if __BYTE_ORDER == __LITTLE_ENDIAN | |
|
368 | 373 | CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF); |
|
369 | 374 | CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF); |
|
370 | 375 | CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF); |
|
371 | 376 | CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset])&0xFF); |
|
377 | #elif __BYTE_ORDER == __BIG_ENDIAN | |
|
378 | CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset])&0xFF); | |
|
379 | CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF); | |
|
380 | CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF); | |
|
381 | CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF); | |
|
382 | #endif | |
|
372 | 383 | } |
|
373 | 384 | SAFEWRITE(CMD,((32*4)+5),timeout,1000,return 0); |
|
374 | 385 | writen+=32; |
@@ -392,10 +403,17 unsigned int ahbuartplugin::Write(unsign | |||
|
392 | 403 | CMD[4] = (char)(((unsigned int)address)&0xFF); |
|
393 | 404 | for(int i=0;(unsigned int) i<(count);i++) |
|
394 | 405 | { |
|
406 | #if __BYTE_ORDER == __LITTLE_ENDIAN | |
|
395 | 407 | CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF); |
|
396 | 408 | CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF); |
|
397 | 409 | CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF); |
|
398 | 410 | CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset])&0xFF); |
|
411 | #elif __BYTE_ORDER == __BIG_ENDIAN | |
|
412 | CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset])&0xFF); | |
|
413 | CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF); | |
|
414 | CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF); | |
|
415 | CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF); | |
|
416 | #endif | |
|
399 | 417 | } |
|
400 | 418 | SAFEWRITE(CMD,((count*4)+5),timeout,1000,return 0); |
|
401 | 419 | writen+=count; |
General Comments 0
You need to be logged in to leave comments.
Login now