lkml.org 
[lkml]   [2004]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] new timeofday core subsystem (v.A1)
hoi :)

On Tue, Dec 07, 2004 at 05:56:38PM -0800, john stultz wrote:
> +struct timesource_t {

usually only typedefs end with _t

> + char* name;
> + int priority;
> + enum {
> + TIMESOURCE_FUNCTION,
> + TIMESOURCE_MMIO_32,
> + TIMESOURCE_MMIO_64
> + } type;
> + cycle_t (*read_fnct)(void);
> + void* ptr;

This could be made __iomem if it is intended to point to an IO memory region.
Hmm, but then there is no ioread64, so I guess I'm wrong.

> + cycle_t mask;
> + u32 mult;
> + u32 shift;
> +};

> +static inline nsec_t cyc2ns(struct timesource_t* ts, cycle_t cycles, cycle_t* rem)
> +{
> + u64 ret;
> + ret = (u64)cycles;
> + ret *= ts->mult;
> + ret >>= ts->shift;
> + if (rem) /* XXX we still need to do remainder math */
> + *rem = (cycle_t)0;
> + return (nsec_t)ret;
> +}

well, the math is simple:
if (rem) *rem = ret & (1 << ts->shift -1);
ret >>= ts->shift;

--
Martin Waitz
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.210 / U:0.112 seconds]
©2003-2014 Jasper Spaans. hosted at Digital Ocean