This is the mail archive of the ecos-discuss@sources.redhat.com 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]

Re: 2 qns : thread priority level , clock / timer resolution


On Wed, 2005-01-12 at 10:25 -0800, ecosrtos ecosrtos wrote:
> 1) the at91 based processor has 8 levels of interrupt in hardware. In
> configtool, under ecoS Kernel -> Kernel Schedulers -> Number of
> priority levels; it mentions 32 priority levels. Am i supposed to
> decrease this number to 8? What is the correlation b/w *interrupt*
> levels supported in hardware and the *priority* levels mentioned in
> configtool?

There is no relationship between these.  Scheduling priorities are
used to choose which thread to run (assuming that there are more
than one thread ready to run, choose the one with the highest priority).
Hardware [interrupt] priorities are used to allow more "important"
I/O devices to cause interrupts even if other devices have interrupts
being processed.

> 
> 2) I want to measure time difference b/w two interrupts and I use
> following code for the DSR.
> 
> //DSR Code for interrupt
> {
> static cyg_tick_count_t oldTicks = 0; //stores clock ticks from RTC
> cyg_tick_count_t newTicks = 0; //stores current tick value
> system_clockH = cyg_real_time_clock(); //return an handle to rtc
> cyg_clock_to_counter(system_clockH, &test_counterH);//convert to
> counter to use kernel counter apis
> newTicks = cyg_current_time(); //get current tick value
> timeInterval = newTicks - oldTicks; //calculate time elapsed since
> last interrupt was called
> oldTicks = newTicks; //store current tick value
> cyg_interrupt_unmask(vector); //allow this 'type' of interrupt to occur again
> }
> 
> the problem is the resolution of this method. timeIntervel hardly
> crosses 0 or 1. The processor runs at 66Mhz. and the setting are:
> real time clock numerator = 10^9
> real time clock denomintaro = 10^2
> real time clock period = 20625
> 
> question is what do i do to get microsecond resolution for timeInterval?

Look at the code in the kernel test program "tm_basic.cxx".  There you
can see how to measure times down to the hardware clock resolution, as
well as how to measure things like interrupt latencies.

Of course, you could just run tm_basic and observe the values :-)

-- 
------------------------------------------------------------
Gary Thomas                 |
MLB Associates              |  Consulting for the
+1 (970) 352-4947           |    Embedded world
http://www.mlbassoc.com/    |
email: <gary@mlbassoc.com>  |
gpg: http://www.chez-thomas.org/gary/gpg_key.asc
------------------------------------------------------------


-- 
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]