Timer Interrupt Handler

Xavier LEBARS xlebars at pactenovation.fr
Wed Jul 16 15:10:29 CEST 2014


Hi everyone,

 

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;

 

The private timers are bind to the GIC with the IRQ 27, so I mentioned
this value in the static unsigned irq() function.

GIC is initialized in the bsp/zynq/pic-arm-zynq.cpp file (similar to the
iMX6 architecture)

 

Pic::init()

{

  typedef Irq_mgr_multi_chip<Gic_sz> M;

 

  M *m = new Boot_object<M>(1);

 

  gic.construct(Kmem::mmio_remap(Mem_layout::Gic_cpu_phys_base),

                Kmem::mmio_remap(Mem_layout::Gic_dist_phys_base));

  m->add_chip(0, gic, gic->nr_irqs());

 

  Irq_mgr::mgr = m;

}

 

To finish I saw timer_tick class. It seems to be a good way to update
system clock because there are interrupts handler which call the
update_system_clock function. So I added a call to  the
Timer_tick::setup() function in my startup-arm.cpp file after timer
initialization. But when I boot the sytem I obtain the following message

 

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

 

Best regards,

Xavier Le Bars

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://os.inf.tu-dresden.de/pipermail/l4-hackers/attachments/20140716/509ccd23/attachment.html>


More information about the l4-hackers mailing list