tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / workbench / network / stacks / AROSTCP / bsdsocket / kern / amiga_time.h
blob6287b256aac81eeb1431dff91e53739d164065ba
1 /*
2 * Copyright (C) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
3 * Helsinki University of Technology, Finland.
4 * All rights reserved.
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,
20 * MA 02111-1307, USA.
24 #ifndef AMIGA_TIME_H
25 #define AMIGA_TIME_H
27 #ifndef SYS_CDEFS_H
28 #include <sys/cdefs.h>
29 #endif
31 #ifndef AMIGA_INCLUDES_H
32 #include <kern/amiga_includes.h>
33 #endif
36 * Globals defined in amiga_time.c
38 #ifdef __MORPHOS__
39 extern struct Library *TimerBase;
40 #else
41 extern struct Device *TimerBase;
42 #endif
45 * Define an extended timerequest to make implementing the UNIX kernel function
46 * timeout() easier.
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!
62 static inline void
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()
72 static inline void
73 handleTimeoutRequest(struct timeoutRequest *tr)
76 * call the function
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 */