simulavr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Simulavr-devel] Clock Call Back


From: Theodore A. Roth
Subject: Re: [Simulavr-devel] Clock Call Back
Date: Mon, 10 Nov 2003 12:04:40 -0800 (PST)


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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]