e2c997ae84fef9bdcc50caf3d090e7f855e430d6
[AROS.git] / arch / ppc-chrp / efika / timer / readeclock.c
blobe2c997ae84fef9bdcc50caf3d090e7f855e430d6
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: ReadEClock() - read the base frequency of timers.
6 Lang: english
7 */
9 /*****************************************************************************
11 NAME */
12 #include <devices/timer.h>
13 #include <proto/timer.h>
14 #include <proto/exec.h>
16 #include <asm/mpc5200b.h>
18 #include "lowlevel.h"
20 AROS_LH1(ULONG, ReadEClock,
22 /* SYNOPSIS */
23 AROS_LHA(struct EClockVal *, dest, A0),
25 /* LOCATION */
26 struct TimerBase *, TimerBase, 10, Timer)
28 /* FUNCTION
29 ReadEClock() reads current value of E-Clock and stores
30 it in the destination EClockVal structure passed as
31 argument. It also returns the frequency of EClock of the
32 system.
34 This call is supposed to be very fast.
35 INPUTS
36 dest - Destination EClockVal
38 RESULT
39 The EClock frequency (tics/s)
41 NOTES
42 This function is safe to call from interrupts.
44 EXAMPLE
46 BUGS
48 SEE ALSO
50 INTERNALS
52 HISTORY
53 19-08-2005 schulz Implemented.
55 *****************************************************************************/
57 AROS_LIBFUNC_INIT
59 Disable();
61 EClockUpdate(TimerBase);
63 dest->ev_hi = TimerBase->tb_ticks_total >> 32;
64 dest->ev_lo = TimerBase->tb_ticks_total & 0xffffffff;
66 Enable();
67 return 33000000;
69 AROS_LIBFUNC_EXIT
70 } /* CmpTime */