2 * Copyright (C) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
3 * Helsinki University of Technology, Finland.
5 * Copyright (C) 2005 Neil Cafferkey
6 * Copyright (C) 2005 Pavel Fedin
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
28 #include <sys/cdefs.h>
31 #ifndef AMIGA_INCLUDES_H
32 #include <kern/amiga_includes.h>
36 * Globals defined in amiga_time.c
39 extern struct Library
*TimerBase
;
41 extern struct Device
*TimerBase
;
45 * Define an extended timerequest to make implementing the UNIX kernel function
49 typedef void (*TimerCallback_t
)(void);
51 struct timeoutRequest
{
52 struct timerequest timeout_request
; /* timer.device sees only this */
53 struct timeval timeout_timeval
; /* timeout interval */
54 TimerCallback_t timeout_function
; /* timeout function to be called */
59 * Command field must be TR_ADDREQUEST before this is called!
60 * A request may be sent again ONLY AFTER PREVIOUS REQUEST HAS BEEN RETURNED!
63 sendTimeoutRequest(struct timeoutRequest
*tr
)
65 tr
->timeout_request
.tr_time
= tr
->timeout_timeval
;
66 SendIO((struct IORequest
*)&(tr
->timeout_request
));
70 * This MUST be called at splsoftclock()
73 handleTimeoutRequest(struct timeoutRequest
*tr
)
78 (*(tr
->timeout_function
))();
82 * prototypes for functions defined in kern/amiga_time.c
84 ULONG
timer_init(void);
85 void timer_deinit(void);
86 void timer_send(void);
87 struct timeoutRequest
* createTimeoutRequest(TimerCallback_t fun
,
88 ULONG seconds
, ULONG micros
);
89 void deleteTimeoutRequest(struct timeoutRequest
*tr
);
90 BOOL
timer_poll(VOID
);
92 #endif /* AMIGA_TIME_H */