This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

eCos clock tick Help..


hi,

   I was trying to minimise the clock tick to as low as possible . In eCos
    1 tick = 10 ms , I was trying to reduce it to low to 1ms . The
problem is I tried to get a value of how much loops a tick is and while
it is 10 ms and also tried it using 5 ms and 1 ms .

   I changed the tick by changing  CYGNUM_HAL_RTC_NUMERATOR value . but
the no of loops per tick is quite uneasy to accept . is there any other
place where change is required .

  The no of loops values are like

        for 10 ms   -> approx 4986325
             5 ms   -> approx 3816406
             1 ms   -> approx 3399930

  Can any one tell me where all i have to change to get correct values .

  the code used for this is

void init_loops_per_tick(void)
{
    int old_ticks, new_ticks;
    int i;
    cyg_uint32 j;


    if (loops_per_tick != 0) return;

    loops_per_tick = 0;
    old_ticks = (int) cyg_current_time();
    // Wait for time to roll
    while ((new_ticks = (int)cyg_current_time()) == old_ticks) ;
    // Now, see how many loops can happen before the next tick

    // Wait for time to roll
        i=0;
    while ((old_ticks = (int)cyg_current_time()) == new_ticks) {
          i++;
       for (j = 0; j < 3399980 ; j++);
        }

        loops_per_tick=j;

        safe_printf("%d, %lu loops per tick \n", i , j);


}


     Pai





-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]