[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Simulavr-devel] Clock Call Back
From: |
Keith Gudger |
Subject: |
Re: [Simulavr-devel] Clock Call Back |
Date: |
Mon, 10 Nov 2003 14:23:18 -0800 (PST) |
Ted:
I checked out the timer clock call backs, and they are working correctly.
It's just my code for the adc. I put in a printf for the call back
installation, and it only shows up once. I put in a printf for the case
where the callback gets called with the same clock value more than once,
and it's inconsistent. I'll get a string of clocks where the callback
gets called around 60 times for each clock, then big gaps where the
callback only gets called once for a bunch of clocks. Here are some
examples:
Same Clock 3351823297 65 times
Same Clock 3351823297 66 times
Same Clock 3351823297 67 times
Same Clock 3351823298 1 times
Same Clock 3351823298 2 times
Same Clock 3351823298 3 times
^ consecutive clocks example, v gap in clocks example
Same Clock 3351823302 38 times
Same Clock 3351823302 39 times
Same Clock 3351823302 40 times
Same Clock 3351823377 1 times
Same Clock 3351823377 2 times
...
If you have any clues, I appreciate the help. Thanks.
Keith
On Mon, 10 Nov 2003, Theodore A. Roth wrote:
>
>
> On Mon, 10 Nov 2003, Keith Gudger wrote:
>
> > Ted:
> >
> > I'm in the process of trying to debug my ADC, and noticed something I
> > can't explain (and am hoping you can ;-)
> >
> > I had my clk_incr_cb routine print out every time it found the clock to be
> > a multiple of the divisor. The output for several calls is:
> >
> > Clock Count = 3340837324 divisor = 12
> > Clock Count = 3340837324 divisor = 12
> > Clock Count = 3340837324 divisor = 12
> > Clock Count = 3340837324 divisor = 12
> >
> > I probably have something wrong, but it appears that the value "ck" passed
> > to the callback is the same for multiple calls. Is this possible? If so,
> > then all of the clock call backs I've been working on are in error.
>
> Look at avr_core_step(). It has this loop:
>
> /* Execute the clock callbacks */
> while ( core->inst_CKS > 0 )
> {
> /* propagate clocks here */
> avr_core_clk_cb_exec( core );
>
> avr_core_CK_incr( core );
>
> core->inst_CKS--;
> }
>
> The call to avr_core_clk_cb_exec() will call _all_ the call backs in the
> call back list and pass them all the same clock count value.
>
> That is the only place that avr_core_clk_cb_exec() is called.
>
> So, if you installed your callback more than once in the callback list,
> you could see that happen.
>
> I'll try to have a look at your timer patch tonight. I meant to get to
> it over the weekend, but time wasn't in my favor... :-(
>
> Ted Roth
>
>
>