3 * This file is part of 0cpm Firmerware.
5 * 0cpm Firmerware is Copyright (c)2011 Rick van Rein, OpenFortress.
7 * 0cpm Firmerware is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation, version 3.
11 * 0cpm Firmerware is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with 0cpm Firmerware. If not, see <http://www.gnu.org/licenses/>.
27 /* The bottom defines a few useful things:
28 * typedef uint..._t timing_t;
29 * #define TIME_MSEC(x) ...
30 * #define TIME_SEC(x) ...
31 * #define TIME_BEOFRE(x,y) ...
32 * #define TIME_BEFOREQ(x,y) ...
33 * The former can be used as a parameter without pointers;
34 * the TIME_xxx define such periods in terms of that time.
38 /* Timer drivers are split in a top half and a bottom half. The top half is generic, the
39 * bottom half is device-specific. The bottom half routines start with bottom_irqtimer_
40 * while the top half functions start with irqtimer_
42 * The bottom system is only aware of the time of the next hardware-raised interrupt.
43 * The top system maintains a timeout-ordered queue of interrupts to raise.
46 typedef struct irqtimer_type irqtimer_t;
47 struct irqtimer_type {
54 /* Managing functions for kernel-defined timers */
55 void irqtimer_start (irqtimer_t *tmr, timing_t delay, irq_handler_t hdl, priority_t prio);
56 void irqtimer_restart (irqtimer_t *tmr, timing_t intval);
57 void irqtimer_stop (irqtimer_t *tmr);
60 /* Top-half operations to manipulate timers; return the desired
61 * new timer setting to follow up after the expiration has
63 timing_t top_timer_expiration (timing_t exptime);
66 /* Bottom-half operations to manipulate the next timer interrupt */
67 timing_t bottom_time (void);
68 timing_t bottom_timer_set (timing_t nextirq);