This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: 2 qns : thread priority level , clock / timer resolution
- From: Andrew Lunn <andrew at lunn dot ch>
- To: ecosrtos ecosrtos <ecosrtos at gmail dot com>
- Cc: ecos-discuss at sources dot redhat dot com,ecosrtos ecosrtos <doodoo902102002 at yahoo dot com>
- Date: Wed, 12 Jan 2005 23:12:36 +0100
- Subject: Re: [ECOS] 2 qns : thread priority level , clock / timer resolution
- References: <852b6999050112102531fe2154@mail.gmail.com>
On Wed, Jan 12, 2005 at 10:25:48AM -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?
These are different things. Kernel->Kernel Schedulars->Number of
priority levels is to do with thread priorities and has nothing to do
with interrupts.
>
> 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?
By default the timer returned by cyg_current_time ticks are 10ms
intervals.
Try using HAL_CLOCK_READ.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss