changeset 453:6228d27738d1

target-utils: wait_ARM_cycles() added to libbase
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 09 Feb 2019 07:35:07 +0000
parents 688380565e0f
children daaab2701761
files target-utils/libbase/Makefile target-utils/libbase/waitarm.S
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/target-utils/libbase/Makefile	Fri Feb 08 02:14:53 2019 +0000
+++ b/target-utils/libbase/Makefile	Sat Feb 09 07:35:07 2019 +0000
@@ -4,7 +4,7 @@
 AR=	arm-elf-ar
 RANLIB=	arm-elf-ranlib
 
-OBJS=	abbdrv.o osmodelay.o serio.o spidrv.o
+OBJS=	abbdrv.o osmodelay.o serio.o spidrv.o waitarm.o
 
 all:	libbase.a
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/libbase/waitarm.S	Sat Feb 09 07:35:07 2019 +0000
@@ -0,0 +1,17 @@
+/*
+ * This assembly module provides a wait_ARM_cycles() function just like
+ * in TI's firmware; it is meant to gradually replace and phase out
+ * osmo_delay_ms().  One loop count for this function equals 5 ARM clock
+ * cycles when running out of IRAM.
+ */
+
+	.text
+	.code	32
+	.globl	wait_ARM_cycles
+wait_ARM_cycles:
+	cmp	r0, #0
+	bxeq	lr
+1:	sub	r0, r0, #1
+	cmp	r0, #0
+	bne	1b
+	bx	lr