Timer Interrupt Handler

Xavier LEBARS xlebars at pactenovation.fr
Mon Jul 21 17:53:40 CEST 2014


> -----Message d'origine-----
> De : l4-hackers [mailto:l4-hackers-bounces at os.inf.tu-dresden.de] De la part
> de Adam Lackorzynski
> Envoyé : dimanche 20 juillet 2014 23:15
> À : l4-hackers at os.inf.tu-dresden.de
> Objet : Re: Timer Interrupt Handler
> 
> On Fri Jul 18, 2014 at 11:27:16 +0200, Xavier LEBARS wrote:
> > > -----Message d'origine-----
> > > De : l4-hackers [mailto:l4-hackers-bounces at os.inf.tu-dresden.de] De
> > > la part de Adam Lackorzynski Envoyé : jeudi 17 juillet 2014 23:21 À
> > > : l4-hackers at os.inf.tu-dresden.de Objet : Re: Timer Interrupt
> > > Handler Importance : Haute
> > >
> > > On Wed Jul 16, 2014 at 15:10:29 +0200, Xavier LEBARS wrote:
> > > > I'm always trying to configure the timer for my Zedboard and the
> > > > system clock doesn't advance. I checked this in the
> > > > Timer::system_clock() function
> > > >
> > > >
> > > >
> > > > In order to construct my timer driver, I use mptimer option, so I
> > > > configured the private timer of my board in the file
> > > > timer-arm-mptimer.cpp. Private Timers call the function interval()
> > > > which use the global timer of the board  (bsp/zynq/
> > > > timer-arm-mptimer-zynq.cpp
> > > > file) Here is a part of the implementation of my global timer (I
> > > > just launch counter) :
> > > >   Mmio_register_block
> > > t(Kmem::mmio_remap(Mem_layout::Gpt_phys_base));
> > > >   t.write<Mword>(0, GPT_CR);
> > > >
> > > >   t.write<Mword>(0, GPT_CNT0);
> > > >
> > > >   t.write<Mword>(0, GPT_CNT1);
> > > >   t.modify<Mword>(GPT_CR_EN, 0, GPT_CR);
> > > >   Mword vc = start_as_counter();
> > > >
> > > >   while (t.read<Mword>(GPT_CNT0) < Gpt_ticks)
> > > >     ;
> > > >   Mword interval = (vc - stop_counter()) / Ticks;
> > > >
> > > >   t.write<Mword>(0, GPT_CR);
> > > >
> > > >   return interval;
> > >
> > > Is this calculating a proper interval value? For a start you can
> > > also just return a fixed value.
> >
> > With  this configuration :
> >  Timer_freq = 32768,
> >  Ticks = 50,
> >
> > I obtain the following interval value : 85899345
> 
> That's far too large.
> 
> > When I try to use a fixed value like in Tegra configuration (249 999
> > or 499 999), I see no effects.
> 
> Values must be in this range given the frequency the system uses.
> 
> > > > The private timers are bind to the GIC with the IRQ 27, so I
> > > > mentioned this value in the static unsigned irq() function.
> > >
> > > Why 27 and not 29?
> >
> > A mistake between  Global Timer Interrupts ID 27 and private timer
> > interrupts ID 29
> 
> Ok.
> 
> > > > Panic - Could not allocate scheduling IRQ 27
> > > >
> > > > The origin of this problem is the allocate_irq() function
> > > >
> > > > So do I have to modify something in my IRQ manager or did I forget
> > > > one step during the construction of my timer driver ? Thanks in
> > > > advance
> > >
> > > For the mptimer it should just work given a proper interval() value.
> > > So does the mptimer tick, i.e. reading the counter register multiple
> > > times gives a changing value everytime? Regarding the interrupt
> > > number, timer- arm-mptimer.cpp already has it defined.
> >
> > The counter register value change correctly
> 
> It also wraps around? So there's no IRQ29. Does the UART IRQ work, i.e.
> entering JDB via ESC works (saying 'IRQ ENTRY')?
 
Sorry, I didn't understand the question about wrapping. 
The UART IRQ doesn't work, I can't use JDB on this board 

Xavier



More information about the l4-hackers mailing list