chore: fix almost *ALL* warnings.
[lunaix-os.git] / lunaix-os / includes / lunaix / timer.h
index 1b36db5cdfa0d91a94412cb6cd67d8b9e5b2c0a1..5ab38644c24cf4b615dcc8760c31750f11f0a7a9 100644 (file)
@@ -4,57 +4,66 @@
 #include <lunaix/ds/llist.h>
 #include <stdint.h>
 
-#define SYS_TIMER_FREQUENCY_HZ      2048
+#define SYS_TIMER_FREQUENCY_HZ 1024
 
-#define TIMER_MODE_PERIODIC   0x1
+#define TIMER_MODE_PERIODIC 0x1
 
-typedef uint32_t ticks_t;
+typedef u32_t ticks_t;
 
-struct lx_timer_context {
-    struct lx_timer *active_timers;
+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
-     * 
+     *
      */
-    uint32_t running_frequency;
+    u32_t running_frequency;
     /**
-     * @brief Ticks per second relative to desired system running frequency
-     * 
+     * @brief Ticks per hertz
+     *
      */
-    ticks_t tps;
+    ticks_t tphz;
 };
 
-struct lx_timer {
+struct lx_timer
+{
     struct llist_header link;
     ticks_t deadline;
     ticks_t counter;
     void* payload;
     void (*callback)(void*);
-    uint8_t flags;
+    u8_t flags;
 };
 
-
 /**
  * @brief Initialize the system timer that runs at specified frequency
- * 
+ *
  * @param frequency The frequency that timer should run in Hz.
  */
 void
-timer_init(uint32_t frequency);
+timer_init(u32_t frequency);
+
+struct lx_timer*
+timer_run_second(u32_t second,
+                 void (*callback)(void*),
+                 void* payload,
+                 u8_t flags);
 
-int
-timer_run_second(uint32_t second, void (*callback)(void*), void* payload, uint8_t flags);
-timer_run_ms(uint32_t millisecond, void (*callback)(void*), void* payload, uint8_t flags);
+struct lx_timer*
+timer_run_ms(u32_t millisecond,
+             void (*callback)(void*),
+             void* payload,
+             u8_t flags);
 
-int
-timer_run(ticks_t ticks, void (*callback)(void*), void* payload, uint8_t flags);
+struct lx_timer*
+timer_run(ticks_t ticks, void (*callback)(void*), void* payload, u8_t flags);
 
-struct lx_timer_context* 
+struct lx_timer_context*
 timer_context();
 
 #endif /* __LUNAIX_TIMER_H */