From a14f5546572469c3419e52c7bc0058ca27ac0122 Mon Sep 17 00:00:00 2001 From: Kostas Missos Date: Thu, 5 Jul 2018 02:02:17 +0300 Subject: [PATCH] Make the sleeps faster Based on tests they are not faster, even though the raw sleeps have less instuctions. But having them call get_tmr breaks important logic. Make both raw to avoid any future problems. --- ipl/util.c | 8 ++++---- ipl/util.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ipl/util.c b/ipl/util.c index 5913656..c659aa1 100755 --- a/ipl/util.c +++ b/ipl/util.c @@ -37,15 +37,15 @@ u32 get_tmr_us() void msleep(u32 milliseconds) { - u32 start = get_tmr_ms(); - while ((get_tmr_ms() - start) <= milliseconds) + u32 start = RTC(0x10) | (RTC(0xC)<< 10); + while (((RTC(0x10) | (RTC(0xC)<< 10)) - start) <= milliseconds) ; } void usleep(u32 microseconds) { - u32 start = get_tmr_us(); - while ((get_tmr_us() - start) <= microseconds) + u32 start = TMR(0x10); + while ((TMR(0x10) - start) <= microseconds) ; } diff --git a/ipl/util.h b/ipl/util.h index e86a048..a18166a 100755 --- a/ipl/util.h +++ b/ipl/util.h @@ -21,7 +21,7 @@ #include "types.h" #define byte_swap_32(num) ((num>>24)&0xff) | ((num<<8)&0xff0000) | \ - ((num>>8)&0xff00) | ((num<<24)&0xff000000); \ + ((num>>8)&0xff00) | ((num<<24)&0xff000000) \ typedef struct _cfg_op_t { @@ -38,7 +38,7 @@ void exec_cfg(u32 *base, const cfg_op_t *ops, u32 num_ops); u32 crc32c(const void *buf, u32 len); /* This is a faster implementation of memcmp that checks two u32 values */ -/* every 128 Bytes block. Intented for only for Backup and Restore */ +/* every 128 Bytes block. Intented only for Backup and Restore */ u32 memcmp32sparse(const u32 *buf1, const u32 *buf2, u32 len); #endif