1 #ifndef DEVICES_TIMER_H 2 #define DEVICES_TIMER_H 3 4 /* 5 timer.device include (V52) 6 7 Copyright © 2002-2018 The MorphOS Development Team, All Rights Reserved. 8 */ 9 10 #ifndef EXEC_TYPES_H 11 # include <exec/types.h> 12 #endif 13 14 #ifndef EXEC_IO_H 15 # include <exec/io.h> 16 #endif 17 18 #pragma pack(2) 19 20 21 #define UNIT_MICROHZ 0 22 #define UNIT_VBLANK 1 23 #define UNIT_ECLOCK 2 24 #define UNIT_WAITUNTIL 3 25 #define UNIT_WAITECLOCK 4 26 /*** V50 ***/ 27 #define UNIT_CPUCLOCK 5 28 #define UNIT_WAITCPUCLOCK 6 29 /*** V52 ***/ 30 #define UNIT_WAITUTC 7 31 32 33 #define TIMERNAME "timer.device" 34 35 /* 36 New in SDK 3.20 onwards: The timer.device uses "struct TimeVal" consistently, 37 rather than trying to align it to <sys/time.h> "struct timeval". These 38 structures have always been different (for example, the seconds value is 39 unsigned for timer.device but is signed for sys/time.h). This caused 40 inconsistencies and outright miscompilation of code when both headers were 41 included, entirely depending on the order in which the headers were included. 42 There is a compatibility define from timeval to TimeVal, which will be 43 removed if <sys/time.h> is also included. This means that some old code that 44 compiled before may refer to structure fields that do not really exist, and 45 will thus fail to compile with new SDK. It is highly recommended to use the 46 structures consistently without mixing them. To identify if the timer.device 47 structure name is the new TimeVal, you can check for the following define: 48 */ 49 #define DEVICES_TIMER_H_TIMEVAL_CAMELCASE 1 50 51 struct TimeVal 52 { 53 ULONG tv_secs; 54 ULONG tv_micro; 55 }; 56 #if !defined(_SYS__TIMEVAL_H_) && !defined(_SYS_TIME_H_) && !defined(DEVICES_TIMER_H_TIMEVAL_ALIAS) 57 #define DEVICES_TIMER_H_TIMEVAL_ALIAS 58 #define timeval TimeVal 59 #endif 60 61 struct EClockVal 62 { 63 ULONG ev_hi; 64 ULONG ev_lo; 65 }; 66 67 struct timerequest 68 { 69 struct IORequest tr_node; 70 struct TimeVal tr_time; 71 }; 72 73 74 #define TR_ADDREQUEST (CMD_NONSTD) 75 #define TR_GETSYSTIME (CMD_NONSTD + 1) 76 #define TR_SETSYSTIME (CMD_NONSTD + 2) 77 #define TR_GETUTCSYSTIME (CMD_NONSTD + 3) 78 #define TR_SETUTCSYSTIME (CMD_NONSTD + 4) 79 80 81 #pragma pack() 82 83 #endif /* DEVICES_TIMER_H */