Fork me on GitHub

root/include/fiwix/timer.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * fiwix/include/fiwix/timer.h
   3  *
   4  * Copyright 2018, Jordi Sanfeliu. All rights reserved.
   5  * Distributed under the terms of the Fiwix License.
   6  */
   7 
   8 #ifndef _FIWIX_TIMER_H
   9 #define _FIWIX_TIMER_H
  10 
  11 #include <fiwix/types.h>
  12 #include <fiwix/sigcontext.h>
  13 
  14 #define TIMER_IRQ       0
  15 #define HZ              100     /* kernel's Hertz rate (100 = 10ms) */
  16 #define TICK            (1000000 / HZ)
  17 
  18 #define UNIX_EPOCH      1970
  19 
  20 #define LEAP_YEAR(y)    ((y % 4) == 0 && ((y % 100) != 0 || (y % 400) == 0))
  21 #define DAYS_PER_YEAR(y)        ((LEAP_YEAR(y)) ? 366 : 365)
  22 
  23 #define SECS_PER_MIN    60
  24 #define SECS_PER_HOUR   (SECS_PER_MIN * 60)
  25 #define SECS_PER_DAY    (SECS_PER_HOUR * 24)
  26 
  27 #define INFINITE_WAIT   0xFFFFFFFF
  28 
  29 struct callout {
  30         int expires;
  31         void (*fn)(unsigned int);
  32         unsigned int arg;
  33         struct callout *next;
  34 };
  35 
  36 struct callout_req {
  37         void (*fn)(unsigned int);
  38         unsigned int arg;
  39 };
  40 
  41 void add_callout(struct callout_req *, unsigned int);
  42 void del_callout(struct callout_req *);
  43 void irq_timer(int, struct sigcontext *);
  44 void irq_timer_bh(void);
  45 void do_callouts_bh(void);
  46 void get_system_time(void);
  47 void set_system_time(__time_t);
  48 void timer_init(void);
  49 
  50 #endif /* _FIWIX_TIMER_H */

/* [previous][next][first][last][top][bottom][index][help] */