[ECOS] Re: In trouble of timer operations

ariga masahiro ariga@link-lab.co.jp
Wed Jun 4 05:25:00 GMT 2008


Hello Andrew,Paul,and others,

I am afraid I dig up the same question but I think this is important,at 
least for me,
so please forgive my inquiring again.
The problem is return_time of cyg_thread_delay.I am determined to use TMU1 
as Free-Run Counter(0xffffffff-0)
and made function(HAL_CLOCK_READ1) to read TMU1 clock count.I am affirmed 
it's working correctry.
I used it to calculate return time in hipri_test() in timeslice2.c.
I am baffled by the result.

--testing code
hipri_test(CYG_ADDRESS id)
{
    cyg_int32 start;

    while( 1 )
    {
        HAL_CLOCK_READ1(&start);
        diag_printf("id=hi 0x%x\n",start);
        cyg_thread_delay(1);
        cyg_thread_delay(2);
    }
}
I calculated several cases.
(1) I only used cyg_thread_delay(2)
(2) I used Andrew's proposition of using 
cyg_thread_delay(1),cyg_thread_delay(2) like above code.
(3) same as (2) except changed cyg_thread_delay(2) to cyg_thread_delay(20)
(4) only used cyg_thread_delay(20)

result
(1) return value 1152.6microsec   -- 1tick=576.3microsec
(2) return value 2041.7292mirosec
(3) return value 13286.6304microsec
(4) return value 12669.3792microsec -- 1tick=633.46microsec

I cannot help concluding that 1 tick takes only about 600microsec.
I checked related option values in untitled.ecc file.(I appended)
CYGNUM_HAL_RTC_NUMERATOR   # Default value: 1000000000
CYGNUM_HAL_RTC_DENOMINATOR # Default value: 100
CYGNUM_HAL_RTC_PERIOD {
    #     CYGHWR_HAL_SH_ONCHIP_PERIPHERAL_SPEED == 29491200
    #     CYGNUM_HAL_RTC_DENOMINATOR == 100
    #     CYGHWR_HAL_SH_RTC_PRESCALE == 4
    #   --> 73728
};

Since CYGNUM_HAL_RTC_DENOMINATOR=100,I guess clock interrupt frequency 
should be 100H(=1 tick is 10millisec).
Please teach me where I am making mistakes.
If I am missing your points please forgive my ignorance and enlighten me.
Masahiro Ariga
-------------- next part --------------
A non-text attachment was scrubbed...
Name: untitled.ecc.gz
Type: application/x-gzip
Size: 89721 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/ecos-discuss/attachments/20080604/f326eb76/attachment.bin>
-------------- next part --------------
-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


More information about the Ecos-discuss mailing list