add time delta to hwtimer
This commit is contained in:
parent
cf2a40ee48
commit
7e02c7dd2b
@ -45,6 +45,7 @@
|
|||||||
#define HWTIMERMINOFFSET 100000
|
#define HWTIMERMINOFFSET 100000
|
||||||
|
|
||||||
static unsigned long native_hwtimer_now;
|
static unsigned long native_hwtimer_now;
|
||||||
|
static unsigned long time_null;
|
||||||
|
|
||||||
static int native_hwtimer_irq[ARCH_MAXTIMERS];
|
static int native_hwtimer_irq[ARCH_MAXTIMERS];
|
||||||
static struct itimerval native_hwtimer[ARCH_MAXTIMERS];
|
static struct itimerval native_hwtimer[ARCH_MAXTIMERS];
|
||||||
@ -240,7 +241,7 @@ unsigned long hwtimer_arch_now(void)
|
|||||||
#endif
|
#endif
|
||||||
_native_in_syscall = 0;
|
_native_in_syscall = 0;
|
||||||
|
|
||||||
native_hwtimer_now = ts2ticks(&t);
|
native_hwtimer_now = ts2ticks(&t) - time_null;
|
||||||
|
|
||||||
DEBUG("hwtimer_arch_now(): it is now %lu s %lu ns\n",
|
DEBUG("hwtimer_arch_now(): it is now %lu s %lu ns\n",
|
||||||
(unsigned long)t.tv_sec, (unsigned long)t.tv_nsec);
|
(unsigned long)t.tv_sec, (unsigned long)t.tv_nsec);
|
||||||
@ -263,6 +264,10 @@ void hwtimer_arch_init(void (*handler)(int), uint32_t fcpu)
|
|||||||
native_hwtimer[i].it_interval.tv_usec = 0;
|
native_hwtimer[i].it_interval.tv_usec = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* init time delta */
|
||||||
|
time_null = 0;
|
||||||
|
time_null = hwtimer_arch_now();
|
||||||
|
|
||||||
hwtimer_arch_enable_interrupt();
|
hwtimer_arch_enable_interrupt();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user