Changeset 313 for trunk/hal/tsar_mips32/core/hal_remote.c
- Timestamp:
- Aug 2, 2017, 3:24:57 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/core/hal_remote.c
r296 r313 447 447 448 448 } // end hal_remote_strcpy() 449 450 //////////////////////////////////////// 451 void hal_remote_memset( xptr_t buf_xp, 452 uint8_t byte, 453 uint32_t size ) 454 { 455 uint32_t save_sr; 456 uint32_t i; 457 uint32_t wsize; 458 uint32_t buf_ptr = (uint32_t)GET_PTR( buf_xp ); 459 uint32_t buf_cxy = (uint32_t)GET_CXY( buf_xp ); 460 uint32_t word = ((uint32_t)byte)<<24 | 461 ((uint32_t)byte)<<16 | 462 ((uint32_t)byte)<<8 | 463 ((uint32_t)byte) ; 464 465 hal_disable_irq( &save_sr ); 466 467 if( (buf_ptr & 0x3) ) wsize = 0; // do it all in bytes 468 else wsize = size >> 2; 469 470 for( i = 0 ; i < wsize ; i++ ) // transfer one word per iteration 471 { 472 asm volatile( 473 ".set noreorder \n" 474 "mfc2 $15, $24 \n" /* $15 <= PADDR_EXT */ 475 "mtc2 %0, $24 \n" /* PADDR_EXT <= buf_cxy */ 476 "sw %2, 0(%1) \n" /* set one word */ 477 "mtc2 $15, $24 \n" /* PADDR_EXT <= $15 */ 478 ".set reorder \n" 479 : : "r"(buf_cxy), "r" (buf_ptr+(i<<2)), "r"(byte) : "$15" ); 480 } 481 482 for( i = wsize << 2 ; i < size ; i++ ) // transfer one byte per iteration 483 { 484 asm volatile( 485 ".set noreorder \n" 486 "mfc2 $15, $24 \n" /* $15 <= PADDR_EXT */ 487 "mtc2 %0, $24 \n" /* PADDR_EXT <= buf_cxy */ 488 "sb %2, 0(%1) \n" /* set one byte */ 489 "mtc2 $15, $24 \n" /* PADDR_EXT <= $15 */ 490 ".set reorder \n" 491 : : "r"(buf_cxy), "r"(buf_ptr+i), "r"(word) : "$15" ); 492 } 493 494 hal_restore_irq( save_sr ); 495 496 } // end hal_remote_memset() 497
Note: See TracChangeset
for help on using the changeset viewer.