[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [microblaze-uclinux] insmod doesn't work
Hi Anders,
barnet wrote:
> Is it possible to use the microblaze_timer_configure function in a
> module? What i want is to configure my second timer i have added in the
> design to generate interrupts at a specified rate and that function
> looks perfect if it only would work. What happens now is that when i run
> insmod i get the following error "insmod: unresolved symbol
> microblaze_timer_configure". Is it possible to use it? if it is, what do
> i have to do to make it work?
You could add a line
EXPORT_SYMBOL (microblaze_timer_configure)
in arch/microblaze/kernel/microblaze_ksyms.c, that should make it
visible to modules.
However, there's a trickier problem which is that both channels on an
opb_timer peripheral share the same IRQ line. Currently the
timer_interrupt() function (in arch/microblaze/kernel/time.c) assumes
that it's only a single channel.
The following patch to microblaze/kernel/time.c should do the trick:
Index: time.c
===================================================================
--- time.c (revision 165)
+++ time.c (working copy)
@@ -54,6 +54,10 @@
/* timer 0 is hard coded - bleugh */
unsigned int csr = timer_get_csr(CONFIG_XILINX_TIMER_0_BASEADDR,0);
+ /* Confirm this channel generated the interrupt */
+ if(!(csr & TIMER_INTERRUPT))
+ return;
+
/* may need to kick the hardware timer */
if (mach_tick)
mach_tick ();
Then, you should be ok to issue a request_irq() on the timer interrupt.
Make sure your interrupt handler also checks the status register of the
timer (CH1), to make sure that the 2nd channel is the one generating the
interrupt (similar to the little fragment above, but on channel 1
instead of 0).
Doing it this way should work, but it will add a bit of overhead,
especially if your own timer interrupt frequency is high.
It would be cleaner and pretty easy to add a second opb_timer into the
system, and your module could have it all to itself. You can still use
the various microblaze_timer_* functions to control it, and request_irq
etc etc.
Regards,
John
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/