grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / popupmenu / timer.c
blobd923cdaf13404cbd1ced7fdd43af37d42886341a
1 #include <exec/types.h>
2 #include <devices/timer.h>
3 #include <proto/exec.h>
5 void EZDeleteTimer(TimeRequest)
6 struct timerequest *TimeRequest;
8 struct MsgPort *TimePort;
10 if(TimeRequest)
12 if(TimeRequest->tr_node.io_Device)
13 CloseDevice(TimeRequest);
15 if((TimePort=TimeRequest->tr_node.io_Message.mn_ReplyPort))
16 DeletePort(TimePort);
18 DeleteExtIO(TimeRequest);
22 struct timerequest *EZCreateTimer(LONG Unit)
24 struct MsgPort *TimePort;
25 struct timerequest *TimeRequest;
27 if(!(TimePort = (struct MsgPort *)CreatePort(NULL,0)))
28 return(NULL);
30 if(!(TimeRequest = (struct timerequest *)CreateExtIO(TimePort,sizeof(struct timerequest))))
32 DeletePort(TimePort);
34 return(NULL);
37 if(OpenDevice(TIMERNAME,Unit,TimeRequest,0))
39 DeleteExtIO(TimeRequest);
40 DeletePort(TimePort);
42 return(NULL);
45 return(TimeRequest);