delay.s
437 Bytes
#include <asm.h>
#include <sys/regdef.h>
/*
** Delay
*/
LEAF(osDelay)
sll t0,a0,2 /* t0 = a0*4 */
addu t0,a0 /* t0 = a0*5 */
sll t0,t0,2 /* t0 = a0*20 */
beqz a0,2f
/* 5 cycle spin loop */
.set noreorder
1: subu t0,1
nop;nop
bnez t0,1b
nop
.set reorder
2:
j ra
END(osDelay)