ROSS
bgl.c
Go to the documentation of this file.
1 #include <ross.h>
2 
3 static const tw_optdef clock_opts [] =
4 {
5  TWOPT_GROUP("ROSS Timing"),
6  TWOPT_ULONGLONG("clock-rate", g_tw_clock_rate, "CPU Clock Rate"),
7  TWOPT_END()
8 };
9 
11 {
12  return clock_opts;
13 }
14 
17 {
18  tw_clock result = 0;
19 #ifdef ROSS_timing
20  unsigned long int upper, lower,tmp;
21 
22  __asm__ volatile(
23  "0: \n"
24  "\tmftbu %0 \n"
25  "\tmftb %1 \n"
26  "\tmftbu %2 \n"
27  "\tcmpw %2,%0 \n"
28  "\tbne 0b \n"
29  : "=r"(upper),"=r"(lower),"=r"(tmp)
30  );
31 
32  result = upper;
33  result = result<<32;
34  result = result|lower;
35 #endif
36  return(result);
37 }
38 
39 void
41 {
42  me->clock_time = 0;
44 }
45 
48 {
50  return me->clock_time;
51 }
unsigned long long g_tw_clock_rate
Definition: ross-global.c:98
void tw_clock_init(tw_pe *me)
Definition: bgl.c:40
const tw_optdef * tw_clock_setup(void)
Definition: bgl.c:10
static const tw_optdef clock_opts[]
Definition: bgl.c:3
tw_clock tw_clock_read(void)
Definition: bgl.c:16
Holds the entire PE state.
Definition: ross-types.h:375
#define TWOPT_ULONGLONG(n, v, h)
Definition: tw-opts.h:29
tw_clock clock_offset
Initial clock value for this PE.
Definition: ross-types.h:396
tw_clock clock_time
Most recent clock value for this PE.
Definition: ross-types.h:397
#define TWOPT_END()
Definition: tw-opts.h:35
tw_clock tw_clock_now(tw_pe *me)
Definition: bgl.c:47
uint64_t tw_clock
Definition: aarch64.h:4
#define TWOPT_GROUP(h)
Definition: tw-opts.h:27