revert between 56095 -> 55830 in arch
[AROS.git] / rom / devs / ata / timer.c
blobfe938e97677630014d9e6fc0e59b5be7189f784b
1 /*
2 Copyright © 2009-2013, The AROS Development Team. All rights reserved
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include <aros/debug.h>
11 #include <proto/exec.h>
13 /* We want all other bases obtained from our base */
14 #define __NOLIBBASE__
16 #include <proto/timer.h>
18 #include <exec/types.h>
19 #include <devices/timer.h>
20 #include <exec/io.h>
22 #include "timer.h"
23 #include "ata.h"
25 struct IORequest *ata_OpenTimer(struct ataBase *base)
27 struct MsgPort *p = CreateMsgPort();
28 if (NULL != p)
30 struct IORequest *io = CreateIORequest(p, sizeof(struct timerequest));
32 if (NULL != io)
35 * ok. ECLOCK does not have too great resolution, either.
36 * we will have to sacrifice our performance a little bit, meaning, the 400ns will turn into (worst case) 2us.
37 * hopefully we won't have to call that TOO often...
39 if (0 == OpenDevice("timer.device", UNIT_MICROHZ, io, 0))
41 return io;
43 else
45 bug("[ATA ] Failed to open timer.device, unit MICROHZ\n");
47 DeleteIORequest(io);
49 else
51 bug("[ATA ] Failed to create timerequest\n");
53 DeleteMsgPort(p);
55 else
57 bug("[ATA ] Failed to create timer port\n");
60 return NULL;
63 void ata_CloseTimer(struct IORequest *tmr)
65 if (NULL != tmr)
67 struct MsgPort *p = tmr->io_Message.mn_ReplyPort;
68 CloseDevice(tmr);
69 DeleteIORequest(tmr);
70 DeleteMsgPort(p);