LibXenon
Bare-metal Xbox 360 homebrew library
Loading...
Searching...
No Matches
libxenon
drivers
ppc
timebase.h
Go to the documentation of this file.
1
#ifndef __drivers_ppc_timebase_h
2
#define __drivers_ppc_timebase_h
3
4
#include <stdint.h>
5
6
#define PPC_TIMEBASE_FREQ (3192000000LL/64LL)
7
8
static
inline
uint64_t
mftb(
void
)
9
{
10
uint32_t
l, u;
11
asm
volatile
(
"mftbl %0"
:
"=r"
(l));
12
asm
volatile
(
"mftbu %0"
:
"=r"
(u));
13
return
(((
uint64_t
)u) << 32) | l;
14
}
15
16
static
inline
unsigned
long
tb_diff_sec(
uint64_t
end,
uint64_t
start)
17
{
18
return
(end-start)/
PPC_TIMEBASE_FREQ
;
19
}
20
21
static
inline
unsigned
long
tb_diff_msec(
uint64_t
end,
uint64_t
start)
22
{
23
return
(end-start)/(
PPC_TIMEBASE_FREQ
/1000);
24
}
25
26
static
inline
unsigned
long
tb_diff_usec(
uint64_t
end,
uint64_t
start)
27
{
28
return
(end-start)/(
PPC_TIMEBASE_FREQ
/1000000);
29
}
30
31
#endif
uint32_t
u32 uint32_t
Definition:
libfdt_env.h:11
uint64_t
u64 uint64_t
Definition:
libfdt_env.h:12
PPC_TIMEBASE_FREQ
#define PPC_TIMEBASE_FREQ
Definition:
timebase.h:6
Generated by
1.9.5