rewrite the device subsystem interfaces (#48)
[lunaix-os.git] / lunaix-os / includes / lunaix / timer.h
index 5ab38644c24cf4b615dcc8760c31750f11f0a7a9..fbbe2b78150c285898ce4f6d29926991481aab84 100644 (file)
@@ -2,34 +2,13 @@
 #define __LUNAIX_TIMER_H
 
 #include <lunaix/ds/llist.h>
 #define __LUNAIX_TIMER_H
 
 #include <lunaix/ds/llist.h>
-#include <stdint.h>
+#include <lunaix/time.h>
+#include <lunaix/hart_state.h>
 
 
-#define SYS_TIMER_FREQUENCY_HZ 1024
+#define SYS_TIMER_FREQUENCY_HZ 1000
 
 #define TIMER_MODE_PERIODIC 0x1
 
 
 #define TIMER_MODE_PERIODIC 0x1
 
-typedef u32_t ticks_t;
-
-struct lx_timer_context
-{
-    struct lx_timer* active_timers;
-    /**
-     * @brief APIC timer base frequency (ticks per seconds)
-     *
-     */
-    ticks_t base_frequency;
-    /**
-     * @brief Desired system running frequency
-     *
-     */
-    u32_t running_frequency;
-    /**
-     * @brief Ticks per hertz
-     *
-     */
-    ticks_t tphz;
-};
-
 struct lx_timer
 {
     struct llist_header link;
 struct lx_timer
 {
     struct llist_header link;
@@ -46,7 +25,7 @@ struct lx_timer
  * @param frequency The frequency that timer should run in Hz.
  */
 void
  * @param frequency The frequency that timer should run in Hz.
  */
 void
-timer_init(u32_t frequency);
+timer_init();
 
 struct lx_timer*
 timer_run_second(u32_t second,
 
 struct lx_timer*
 timer_run_second(u32_t second,
@@ -63,7 +42,4 @@ timer_run_ms(u32_t millisecond,
 struct lx_timer*
 timer_run(ticks_t ticks, void (*callback)(void*), void* payload, u8_t flags);
 
 struct lx_timer*
 timer_run(ticks_t ticks, void (*callback)(void*), void* payload, u8_t flags);
 
-struct lx_timer_context*
-timer_context();
-
 #endif /* __LUNAIX_TIMER_H */
 #endif /* __LUNAIX_TIMER_H */