Lines Matching refs:tc

8 void timecounter_init(struct timecounter *tc,  in timecounter_init()  argument
12 tc->cc = cc; in timecounter_init()
13 tc->cycle_last = cc->read(cc); in timecounter_init()
14 tc->nsec = start_tstamp; in timecounter_init()
15 tc->mask = (1ULL << cc->shift) - 1; in timecounter_init()
16 tc->frac = 0; in timecounter_init()
31 static u64 timecounter_read_delta(struct timecounter *tc) in timecounter_read_delta() argument
37 cycle_now = tc->cc->read(tc->cc); in timecounter_read_delta()
40 cycle_delta = (cycle_now - tc->cycle_last) & tc->cc->mask; in timecounter_read_delta()
43 ns_offset = cyclecounter_cyc2ns(tc->cc, cycle_delta, in timecounter_read_delta()
44 tc->mask, &tc->frac); in timecounter_read_delta()
47 tc->cycle_last = cycle_now; in timecounter_read_delta()
52 u64 timecounter_read(struct timecounter *tc) in timecounter_read() argument
57 nsec = timecounter_read_delta(tc); in timecounter_read()
58 nsec += tc->nsec; in timecounter_read()
59 tc->nsec = nsec; in timecounter_read()
79 u64 timecounter_cyc2time(const struct timecounter *tc, in timecounter_cyc2time() argument
82 u64 delta = (cycle_tstamp - tc->cycle_last) & tc->cc->mask; in timecounter_cyc2time()
83 u64 nsec = tc->nsec, frac = tc->frac; in timecounter_cyc2time()
90 if (delta > tc->cc->mask / 2) { in timecounter_cyc2time()
91 delta = (tc->cycle_last - cycle_tstamp) & tc->cc->mask; in timecounter_cyc2time()
92 nsec -= cc_cyc2ns_backwards(tc->cc, delta, tc->mask, frac); in timecounter_cyc2time()
94 nsec += cyclecounter_cyc2ns(tc->cc, delta, tc->mask, &frac); in timecounter_cyc2time()