RE: Timer Interrupt Handler
"Xavier LEBARS" <[email protected]>
| Newsgroups | gmane.comp.micro-kernel.l4.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, Thanks for your answer, > -----Message d'origine----- > De : l4-hackers [mailto:[email protected]] De la part > de Adam Lackorzynski > Envoyé : jeudi 17 juillet 2014 23:21 > À : [email protected] > 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 When I try to use a fixed value like in Tegra configuration (249 999 or 499 999), I see no effects. > > 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 > > 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; > > } > > This looks fine. > > > 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 > > I do not think you need to add anything there. 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 Xavier Le Bars