Commit 9d082540 authored by Aurelio Colosimo's avatar Aurelio Colosimo Committed by Alessandro Rubini

spec_time function copied from ppsi

Note: spec_time function is obsolete; this patch should be reverted sooner
or later.
parent c62f4eee
......@@ -44,3 +44,23 @@ void timer_delay(uint32_t how_long)
while (t_start + how_long > timer_get_tics()) ;
}
/* return a monotonic seconds count from the counter above;
* FIXME horrible obsolete code, still used by ppsi */
int spec_time(void)
{
static uint32_t prev, secs;
static int rest; /* millisecs */
uint32_t tics = timer_get_tics();
if (!prev) {
prev = tics;
secs = 1; /* Start from a small number! */
return secs;
}
rest += tics - prev;
secs += rest / 1000;
rest %= 1000;
prev = tics;
return secs;
}
......@@ -60,4 +60,6 @@ static inline int sysc_get_memsize()
return (SYSC_HWFR_MEMSIZE_R(syscon->HWFR) + 1) * 16;
}
int spec_time(void);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment