Kernel - Expose thread timer for EVENT_TIMER, multiple sleepers for workqueue, cleanu...
[tpg/acess2.git] / KernelLand / Kernel / include / timers.h
1 /*
2  * Acess2 Kernel
3  * - By John Hodge (thePowersGang)
4  *
5  * timers.h
6  * - Kernel timers
7  */
8 #ifndef _KERNEL_TIMERS_H_
9 #define _KERNEL_TIMERS_H_
10 /**
11  * \file timers.h
12  * \brief Kernel timers
13  */
14
15 typedef struct sTimer   tTimer;
16
17 /**
18  * \brief Timer callback function
19  */
20 typedef void (tTimerCallback)(void *);
21
22 /**
23  * \brief Creates a one-shot timer
24  * \param Delta Period of the timer
25  * \param Callback      Function to call each time
26  * \param Argument      Argument to pass to the callback
27  */
28 extern tTimer   *Time_CreateTimer(int Delta, tTimerCallback *Callback, void *Argument) DEPRECATED;
29
30 /**
31  * \brief Allocate (but don't schedule) a timer object
32  * \param Callback      Function to call (if NULL, EVENT_TIMER is delivered to the current thread)
33  * \param Argument      Argument passed to \a Callback (ignored if \a Callback is NULL)
34  * \return New timer pointer
35  */
36 extern tTimer   *Time_AllocateTimer(tTimerCallback *Callback, void *Argument);
37
38 /**
39  * \brief Free an allocated timer object
40  * \param Timer Object pointer returned by Time_AllocateTimer
41  */
42 extern void     Time_FreeTimer(tTimer *Timer);
43
44 /**
45  * \brief Schedules a timer to fire in \a Delta ms
46  * \param Timer Timer object returned by Time_AllocateTimer
47  * \param Delta Time until timer fires (in milliseconds)
48  */
49 extern void     Time_ScheduleTimer(tTimer *Timer, int Delta);
50
51 /**
52  * \brief Removed an active timer
53  */
54 extern void     Time_RemoveTimer(tTimer *Timer);
55
56 /**
57  * Schedule a THREAD_EVENT_TIMER to fire in \a Delay milliseconds
58  */
59 extern void     Time_ScheduleEvent(int Delay);
60
61 /**
62  * \brief Wait for a period of milliseconds
63  */
64 extern void     Time_Delay(int Delay);
65
66 /**
67  * \brief Busy wait for a period of milliseconds
68  */
69 extern void     Time_MicroSleep(Uint16 Delay);
70
71 #endif
72

UCC git Repository :: git.ucc.asn.au