view target-utils/libbase/osmodelay.S @ 497:74610c4f10f7

target-utils: added 10 ms delay at the end of abb_power_off() The deosmification of the ABB access code (replacement of osmo_delay_ms() bogus delays with correctly-timed ones, which are significantly shorter) had one annoying side effect: when executing the poweroff command from any of the programs, one last '=' prompt character was being sent (and received by the x86 host) as the Calypso board powers off. With delays being shorter now, the abb_power_off() function was returning and the standalone program's main loop was printing its prompt before the Iota chip fully executed the switch-off sequence! I thought about inserting an endless tight loop at the end of the abb_power_off() function, but the implemented solution of a 10 ms delay is a little nicer IMO because if the DEVOFF operation doesn't happen for some reason in a manual hacking scenario, there won't be an artificial blocker in the form of a tight loop keeping us from further poking around.
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 25 May 2019 20:44:05 +0000
parents e7502631a0f9
children
line wrap: on
line source

/*
 * This assembly module provides a replica of OsmocomBB's bogo-millisecond
 * delay_ms() function.  It is literally a copy of what OsmocomBB's delay_ms()
 * compiles to with their gcc version and their optimization settings, as seen
 * by doing arm-elf-objdump on their lib/delay.o.
 *
 * This hack is intended for those cases where we have to copy OsmocomBB's
 * black magic voodoo operations with no ability to understand what is actually
 * needed, such as SPCA552E initialization on the Pirelli DP-L10.
 */

	.text
	.code	32
	.globl	osmo_delay_ms
osmo_delay_ms:
	mov     r3, #0
	sub     sp, sp, #4
	str     r3, [sp]
	ldr     r3, =1300
	mul     r3, r0, r3
	b       2f
1:	ldr     r2, [sp]
	ldr     r2, [sp]
	add     r2, r2, #1
	str     r2, [sp]
2:	ldr     r2, [sp]
	cmp     r2, r3
	bcc     1b
	add     sp, sp, #4
	bx      lr