Skip to content

Commit 4afe766

Browse files
timer: Fix busywait inline assembly
Make inline assembly portable/maintainable Signed-off-by: Muhammed Zamroodh <[email protected]>
1 parent ee59d04 commit 4afe766

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/timer/mchp_dspic33_timer.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,9 @@ static void initialize_timer(void)
9393
#ifdef CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT
9494
void arch_busy_wait(uint32_t usec_to_wait)
9595
{
96-
ARG_UNUSED(usec_to_wait);
97-
__asm__ volatile("sl.l w0,#0x03,w0\n\t"
98-
"repeat.w w0\n\t"
99-
"nop\n\n\t");
96+
usec_to_wait <<= 3;
97+
__asm__ volatile("repeat.w %0\n\t"
98+
"nop\n\t"::"r"(usec_to_wait));
10099
}
101100
#endif
102101

0 commit comments

Comments
 (0)