git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: use a more decent physical memory map
[lunaix-os.git]
/
lunaix-os
/
hal
/
timer
/
hwtimer.c
diff --git
a/lunaix-os/hal/timer/hwtimer.c
b/lunaix-os/hal/timer/hwtimer.c
index 9c864c7bdd3f29eb03d6926d3ed387ec93921125..bd6477a6173077c287ff93632ce222a2358ed01a 100644
(file)
--- a/
lunaix-os/hal/timer/hwtimer.c
+++ b/
lunaix-os/hal/timer/hwtimer.c
@@
-1,7
+1,7
@@
#include <hal/hwtimer.h>
#include <lunaix/spike.h>
#include <hal/hwtimer.h>
#include <lunaix/spike.h>
-struct hwtimer_context*
sys_hwtctx
;
+struct hwtimer_context*
current_timer
;
void
hwtimer_init(u32_t hertz, void* tick_callback)
void
hwtimer_init(u32_t hertz, void* tick_callback)
@@
-11,19
+11,19
@@
hwtimer_init(u32_t hertz, void* tick_callback)
hwt_ctx->init(hwt_ctx, hertz, tick_callback);
hwt_ctx->running_freq = hertz;
hwt_ctx->init(hwt_ctx, hertz, tick_callback);
hwt_ctx->running_freq = hertz;
-
sys_hwtctx
= hwt_ctx;
+
current_timer
= hwt_ctx;
}
ticks_t
hwtimer_base_frequency()
{
}
ticks_t
hwtimer_base_frequency()
{
- return
sys_hwtctx
->base_freq;
+ return
current_timer
->base_freq;
}
ticks_t
hwtimer_current_systicks()
{
}
ticks_t
hwtimer_current_systicks()
{
- return
sys_hwtctx
->systicks();
+ return
current_timer
->systicks();
}
ticks_t
}
ticks_t
@@
-31,10
+31,10
@@
hwtimer_to_ticks(u32_t value, int unit)
{
// in case system frequency is less than 1000Hz
if (unit != TIME_MS) {
{
// in case system frequency is less than 1000Hz
if (unit != TIME_MS) {
- return
sys_hwtctx
->running_freq * unit * value;
+ return
current_timer
->running_freq * unit * value;
}
}
- ticks_t freq_ms =
sys_hwtctx
->running_freq / 1000;
+ ticks_t freq_ms =
current_timer
->running_freq / 1000;
return freq_ms * value;
}
\ No newline at end of file
return freq_ms * value;
}
\ No newline at end of file