Changeset 345 for soft/giet_vm/giet_libs/mwmr_channel.c
- Timestamp:
- Jun 25, 2014, 2:19:37 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_libs/mwmr_channel.c
r258 r345 43 43 register unsigned int delay = 100; 44 44 asm volatile ( 45 " mwmr_lock_try:\n"45 "1: \n" 46 46 "ll $2, 0(%0) \n" /* $2 <= lock current value */ 47 "bnez $2, mwmr_lock_delay\n" /* retry after delay if lock busy */47 "bnez $2, 2f \n" /* retry after delay if lock busy */ 48 48 "li $3, 1 \n" /* $3 <= argument for sc */ 49 49 "sc $3, 0(%0) \n" /* try to get lock */ 50 "bnez $3, mwmr_lock_ok\n" /* exit if atomic */51 " mwmr_lock_delay:\n"52 "move $4, %1 \n" /* $4 <= delay */53 " mwmr_lock_loop:\n"54 "beqz $4, mwmr_lock_loop\n" /* test end delay */55 "addi $4, $4, -1 \n" /* $4 <= $4 - 1 */56 "j mwmr_lock_try\n" /* retry ll */57 "nop \n"58 " mwmr_lock_ok:\n"50 "bnez $3, 3f \n" /* exit if atomic */ 51 "2: \n" 52 "move $4, %1 \n" /* $4 <= delay */ 53 "4: \n" 54 "beqz $4, 4b \n" /* test end delay */ 55 "addi $4, $4, -1 \n" /* $4 <= $4 - 1 */ 56 "j 1b \n" /* retry ll */ 57 "nop \n" 58 "3: \n" 59 59 : 60 60 :"r"(plock), "r"(delay)
Note: See TracChangeset
for help on using the changeset viewer.