revert between 56095 -> 55830 in arch
[AROS.git] / compiler / posixc / __posixc_timer.c
blob60099238776d95386b40ae10c83473711d1477ff
3 #include <proto/exec.h>
4 #include <proto/dos.h>
5 #include <proto/timer.h>
6 #include <exec/types.h>
7 #include <devices/timer.h>
8 #include <aros/symbolsets.h>
9 #include <aros/debug.h>
11 #include <time.h>
12 #include <errno.h>
14 #include "__posixc_intbase.h"
16 void __init_timerbase(struct PosixCIntBase *PosixCBase)
18 memset( &PosixCBase->timerPort, 0, sizeof( PosixCBase->timerPort ) );
19 PosixCBase->timerPort.mp_Node.ln_Type = NT_MSGPORT;
20 PosixCBase->timerPort.mp_Flags = PA_IGNORE;
21 PosixCBase->timerPort.mp_SigTask = FindTask(NULL);
22 NEWLIST(&PosixCBase->timerPort.mp_MsgList);
24 PosixCBase->timerReq.tr_node.io_Message.mn_Node.ln_Type = NT_MESSAGE;
25 PosixCBase->timerReq.tr_node.io_Message.mn_Node.ln_Pri = 0;
26 PosixCBase->timerReq.tr_node.io_Message.mn_Node.ln_Name = NULL;
27 PosixCBase->timerReq.tr_node.io_Message.mn_ReplyPort = &PosixCBase->timerPort;
28 PosixCBase->timerReq.tr_node.io_Message.mn_Length = sizeof (PosixCBase->timerReq);
32 OpenDevice
34 "timer.device",
35 UNIT_VBLANK,
36 (struct IORequest *)&PosixCBase->timerReq,
43 PosixCBase->timerBase = (struct Device *)PosixCBase->timerReq.tr_node.io_Device;
47 static void __exit_timerbase(struct PosixCIntBase *PosixCBase)
49 if (PosixCBase->timerBase != NULL)
51 CloseDevice((struct IORequest *)&PosixCBase->timerReq);
52 PosixCBase->timerBase = NULL;
56 ADD2EXIT(__exit_timerbase, 0);