Re: [Qemu-devel] [PATCH v6 2/4] cadence_ttc: initial version of device model

2012-02-28 Thread Peter Crosthwaite
On Tue, Feb 28, 2012 at 10:07 PM, Paul Brook wrote: >> > Thinking about that, I realised why I don't like the following line: >> >> +    s->reg_value = (uint32_t)((x + interval) % interval); >> > >> > This assumes x > -interval, which is not always true. >> >> This would mean you have wrapped twic

Re: [Qemu-devel] [PATCH v6 2/4] cadence_ttc: initial version of device model

2012-02-28 Thread Paul Brook
> > Thinking about that, I realised why I don't like the following line: > >> +s->reg_value = (uint32_t)((x + interval) % interval); > > > > This assumes x > -interval, which is not always true. > > This would mean you have wrapped twice or more in one time step, which > I am assuming is a fa

Re: [Qemu-devel] [PATCH v6 2/4] cadence_ttc: initial version of device model

2012-02-27 Thread Peter Crosthwaite
Heres the diff for proposed comments: @@ -129,6 +129,8 @@ static uint64_t cadence_timer_get_steps(CadenceTimerState *s, uint64_t ns) return r; } +/* determine if x is inbetween a and b, exclusive of a, inclusive of b */ + static inline int64_t is_between(int64_t x, int64_t a, int64_t b) {

Re: [Qemu-devel] [PATCH v6 2/4] cadence_ttc: initial version of device model

2012-02-27 Thread Peter Crosthwaite
On Tue, Feb 28, 2012 at 1:45 AM, Paul Brook wrote: >> On Tue, Feb 21, 2012 at 11:04 PM, Paul Brook wrote: >> >> > +static inline int64_t is_between(int64_t x, int64_t a, int64_t b) >> >> > +{ >> >> > +    if (a < b) { >> >> > +        return x > a && x <= b; >> >> > +    } >> >> > +    return x <

Re: [Qemu-devel] [PATCH v6 2/4] cadence_ttc: initial version of device model

2012-02-27 Thread Paul Brook
> On Tue, Feb 21, 2012 at 11:04 PM, Paul Brook wrote: > >> > +static inline int64_t is_between(int64_t x, int64_t a, int64_t b) > >> > +{ > >> > +if (a < b) { > >> > +return x > a && x <= b; > >> > +} > >> > +return x < a && x >= b; > >> > +} > >> > >> This looks slightly odd

Re: [Qemu-devel] [PATCH v6 2/4] cadence_ttc: initial version of device model

2012-02-22 Thread Peter Crosthwaite
On Tue, Feb 21, 2012 at 5:32 AM, Peter Maydell wrote: > On 20 February 2012 01:45, Peter A. G. Crosthwaite > wrote: >> Implemented cadence Triple Timer Counter (TCC) >> >> Signed-off-by: Peter A. G. Crosthwaite >> Signed-off-by: John Linn >> --- >> changed from v4: >> fixed FSF addess >> change

Re: [Qemu-devel] [PATCH v6 2/4] cadence_ttc: initial version of device model

2012-02-22 Thread Peter Crosthwaite
On Tue, Feb 21, 2012 at 11:04 PM, Paul Brook wrote: >> > +static inline int64_t is_between(int64_t x, int64_t a, int64_t b) >> > +{ >> > +    if (a < b) { >> > +        return x > a && x <= b; >> > +    } >> > +    return x < a && x >= b; >> > +} >> >> This looks slightly odd -- should the boundar

Re: [Qemu-devel] [PATCH v6 2/4] cadence_ttc: initial version of device model

2012-02-21 Thread Paul Brook
> > +static inline int64_t is_between(int64_t x, int64_t a, int64_t b) > > +{ > > +if (a < b) { > > +return x > a && x <= b; > > +} > > +return x < a && x >= b; > > +} > > This looks slightly odd -- should the boundary condition for whether > a value equal to the max/min really

Re: [Qemu-devel] [PATCH v6 2/4] cadence_ttc: initial version of device model

2012-02-20 Thread Peter Maydell
On 20 February 2012 01:45, Peter A. G. Crosthwaite wrote: > Implemented cadence Triple Timer Counter (TCC) > > Signed-off-by: Peter A. G. Crosthwaite > Signed-off-by: John Linn > --- > changed from v4: > fixed FSF addess > changed device_init -> type_init > changed from v3: > Fixed race conditio

[Qemu-devel] [PATCH v6 2/4] cadence_ttc: initial version of device model

2012-02-19 Thread Peter A. G. Crosthwaite
Implemented cadence Triple Timer Counter (TCC) Signed-off-by: Peter A. G. Crosthwaite Signed-off-by: John Linn --- changed from v4: fixed FSF addess changed device_init -> type_init changed from v3: Fixed race condition where timer could miss match events on wrap around changed from v2: changed