This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to tell that a SYS/BIOS Clock is still running ?

Hi.

We are trying to wrap the SYS/BIOS Clock API with our own abstraction. One of the abstraction functions is a "is the timer still running" query. Now I could implement a "state" variable inside the abstraction, set it to "running" when I start the Clock and set it to "stopped" when the Clock timer expires. However, I was hoping that I could get the Clock to tell me instead.

So, I wrote a test program which starts a Clock and then periodically calls Clock_getTimeout() in the hope that while the Clock is running, the result would be non-zero and then after the Clock timer expires, the value returned by Clock_getTimeout() would be zero.

Unfortunately, after the Clock timer expires, the value returned by Clock_getTimeout() seems to be reset back to the original timeout value (even though I set the Clock up as a "oneshot" one). This is most unhelpful.

Am I doing something wrong ?

Has anyone any handy hints as to how I can implement this without using an abstraction state variable ?

Output from my test program:

---- snip snip ----

[C66xx_1] mainTaskFunc: enter
[C66xx_1] mainTaskFunc: Clock_getTimeout() = 100
[C66xx_1] mainTaskFunc: Clock_getTimeout() = 89
[C66xx_1] mainTaskFunc: Clock_getTimeout() = 78
[C66xx_1] mainTaskFunc: Clock_getTimeout() = 67
[C66xx_1] mainTaskFunc: Clock_getTimeout() = 56
[C66xx_1] mainTaskFunc: Clock_getTimeout() = 45
[C66xx_1] mainTaskFunc: Clock_getTimeout() = 34
[C66xx_1] mainTaskFunc: Clock_getTimeout() = 23
[C66xx_1] mainTaskFunc: Clock_getTimeout() = 12
[C66xx_1] mainTaskFunc: Clock_getTimeout() = 1
[C66xx_1] mainTaskFunc: after timer func called, Clock_getTimeout() = 100
[C66xx_1] mainTaskFunc: leave
[C66xx_1] myIdleFunc: calling BIOS_exit(0)

---- snip snip ----

and test program:

---- snip snip ----

5040.main.c

---- snip snip ----

and (finally) the RTSC config:

---- snip snip ----

5127.clockTick.cfg

---- snip snip ----

Thanks for reading this far !

Graham.

  • Graham,

    Sadly, I think your best bet is the state variable that is set to TRUE when the Clock object is started and FALSE by the Clock object's function when it is invoked.

    I filed an enhancement request for a new Clock API that returns TRUE or FALSE depending on a Clock object's internal state.

    Alan

  • This is an interesting issue.  With Ti getting involved you may have a software resolution soon.  I admit I am more a hardware guy so my solution would reqire making a memory map, use a dedicated clock IC ( with regulator and button cell ) and the eqivalent of BIOS screen to even have access to the IC to change the time.  During the POST process, toggle 1 single address/data line to an enable pin ( 74hs245 as example ) and data through the buffer to change the date/time and as part of the ending of the POST to ensure it is set to running and toggle again to dis-allow the clock from getting changed.

    I admit the hardware route increases cost and parts count, yet it is an option.

    Hope this at least amuses you while waiting for a fix from Ti,

    Eric

  • Alan,

    Thanks for the confirmation, suggestion and commiseration. I'll carry on with the state variable implementation ...

    Graham

  • Eric,

    Thanks for that out-of-the-box suggestion. I'll pass it along to our h/w guys and see what they can do :-)

    Graham.

  • The new "Clock_isActive()" API is scheduled for inclusion in BIOS 6.35 due out in Q1 2013.

    It may appear in a 6.34.xx point release prior to that. I'll update this thread if so.

    Alan