Skip to contentSkip to conversation

Timer and calibration

Xenomai-core ROSSIER Daniel 2 participants 2 messages Feb 21, 2006

lore
Share & tools
lore
#0 lore raw

Hello,

We are currently porting Adeos/Xenomai with Linux 2.6.14 on a ARM9-based Freescale i.mx21 (litekit) development board.

We started from the available patch for the ARM-based Integrator board.

We are now facing some interesting problems regarding clock/timer frequencies with this board, but they are about to be solved :-)

However, we have a question of understanding; as far as we know, ipipe starts with an aperiodic (one-shot) timer at the initialization time, and that before

the calibrate function has been called. So, we get one interrupt only since the xenomai scheduler has not been registered (we understand

that the xenomai scheduler should give the next timer shot, but since it is not registered yet, no timer reprogramming is achieved).

So, how can the calibrate function can be invoked safely if no timer IRQ is received since this kind of calibration comes before the xenomai registration

(the calibrate function needs IRQ timers to calibrate the number of busy loops between two jiffies) ?

How is it realized with a x86 architecture (another timer source?)

Is there any documentation - or discussion threads - which gives some information about the use of timers/RTC/TSC with Xenomai?

Thanks so much for your help

Kind regards

Daniel Rossier

#1 lore raw
Quoted 18 lines · ROSSIER Daniel

Hello,

We are currently porting Adeos/Xenomai with Linux 2.6.14 on a ARM9-based Freescale i.mx21 (litekit) development board.

We started from the available patch for the ARM-based Integrator board.

We are now facing some interesting problems regarding clock/timer frequencies with this board, but they are about to be solved J

However, we have a question of understanding; as far as we know, ipipe starts with an aperiodic (one-shot) timer at the initialization time, and that before

the calibrate function has been called. So, we get one interrupt only since the xenomai scheduler has not been registered (we understand

Quoted 8 lines

that the xenomai scheduler should give the next timer shot, but since it is not registered yet, no timer reprogramming is achieved).

So, how can the calibrate function can be invoked safely if no timer IRQ is received since this kind of calibration comes before the xenomai registration

(the calibrate function needs IRQ timers to calibrate the number of busy loops between two jiffies) ?

Unlike Linux's calibrate_delay loop, Xenomai's timer calibration code does not measure the CPU performance level, but only the average cost of programming the underlying timer hw in oneshot mode (time-wise), so that the nucleus can take this unavoidable delay into account when programming the next shot.

Nowadays, this is basically an x86+8254 PIT only issue, since on this platform, one has to go through the ISA bus to (re)program the PIT for the next timer shot, and this is quite expensive (1.5 - 2.5 us for each outb, and you need two of them for programming the shot). Btw, this is the reason why using the APIC when available on x86 is always a good idea, since it only costs ~100 ns to program the timer there through a memory mapped register.

IOW, the code does not wait for any timer IRQ, but only measures the average time for setting up the proper hw registers in order to program a timer shot.

Quoted 4 lines

How is it realized with a x86 architecture (another timer source?)

Look at ksrc/arch/*/hal.c, where all archs implement rthal_timer_calibrate() their own way.

Quoted 4 lines

Is there any documentation – or discussion threads - which gives some information about the use of timers/RTC/TSC with Xenomai?

Maybe. Try browsing the archive.

Quoted 19 lines

Thanks so much for your help

Kind regards

Daniel Rossier

------------------------------------------------------------------------

_______________________________________________
Xenomai-core mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-core

Signature · 1 line
Philippe.