Hi Geoffrey,<br><br>thanks for your detailed description. <br>i will try it out to make timer and interrupt controller work correctly!<br><br>&amp; Happy New Year &nbsp;&nbsp;to all~<br><br><br>best,<br><br>kashin lin<br><br><div><span class="gmail_quote">
2007/12/26, Geoffrey Lee &lt;<a href="mailto:glee@ok-labs.com">glee@ok-labs.com</a>&gt;:</span><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
On Wed, Dec 26, 2007 at 12:10:09AM +0800, kashin Lin wrote:<br>&gt; Hi,<br><br>hi<br><br>&gt;<br>&gt; After trying to modify some codes in<br>&gt; &quot;src/platform&quot; to adapt okl4 to my target, i found i&#39;m<br>&gt; confused about the driver&#39;s relationship.( my target is Davinci from TI
<br>&gt; which has arm926ej-s and DSP inside)<br>&gt; the naming example works correctly on my target now. and the following are<br>&gt; my questions:<br>&gt;<br>&gt; 1. in pxa&#39;s machine.py for example:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;drivers = [timer_driver] + 
pxa.drivers&nbsp;&nbsp;&amp;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v2_drivers = [ (&quot;pxa250_timer&quot;, &quot;vtimer&quot;), (&quot;uart_8250&quot;, &quot;vserial&quot;),]<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; does &quot;v2_driver&quot; replace &quot;driver&quot; (so &quot;driver&quot; is no use) ?
<br><br><br>The drivers line, from inspection, I suspect is a leftover wart from<br>the driverv1 days.&nbsp;&nbsp;In the latest release of OKL4 pxa should use<br>driverv2 not driverv1.<br><br><br>&gt;<br>&gt; 2. &quot;Timer driver&quot; :
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; what&#39;s the difference between &quot;src/drivers/pxa250_timer&quot; &amp;<br>&gt; &quot;src/platform/pxa/pistachio/src/timer.cc&quot;?<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; as<br>&gt; i comprehend, the timer in platform/ is OS timer and responds to
<br>&gt; generate a period interrupt to<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; trigger scheduling in kernel. if it&#39;s right, this seems to be a<br>&gt; indispensable component.<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; but why okl4 still works even i<br>&gt; don&#39;t set the memory map address to OS timer correctly?
<br><br><br>Yes, one is in the kernel the other is in userland.&nbsp;&nbsp;The one in the<br>kernel has to work if you the timer tick and scheduling to work<br>properly.<br><br>The one in userland typically links into the timer server of Iguana
<br>to provide timer-related functions (e.g. sleep, timeout, seconds since<br>boot, etc).<br><br>Not having a timer interrupt (i.e. kernel timer disabled or does not<br>work) means that there will be no timeslice expiry, 
i.e. current thread<br>will run forever until explicit yield.&nbsp;&nbsp;Note that not having a timer<br>interrupt is not supported.&nbsp;&nbsp;The above, however, explains why<br>things may appear to work when the kernel timer driver is<br>
disabled or broken.<br><br>Because L4 currently requires a periodic timer tick, it is very easy<br>to verify whether the presence of a timer by putting in a print or a debug<br>breakin in the interrupt routine.&nbsp;&nbsp;I suspect that if your timer is not
<br>present you won&#39;t see anything.<br><br>&gt; ( i try naming example )<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; what is the function of<br>&gt; the timer in drivers/ ? does l4 kernel use this driver? for what?<br><br><br>The drivers in the drivers/ directory are user-level drivers.
<br>They provide support for the various peripherials on a particular<br>platform (e.g. UART, LCD, touchscreen, etc)<br><br>&gt;<br>&gt; 3. &quot;UART driver&quot; :<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; what&#39;s the difference between &quot;src/drivers/uart_8250&quot; &amp;
<br>&gt; &quot;src/platform/pxa/pistachio/kdb/console.cc&quot;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; it seems the printf function call is based on console.cc, so the<br>&gt; output msgs from target through rs232<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; are visible only when i set the correct memory map address to it.
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; but what is the function of the uart driver in drivers/ ?<br>&gt;<br><br><br>One is the kernel driver.&nbsp;&nbsp;The kernel driver is src/platform/pxa/pis...<br>console.cc and that handles prints that come from the kernel, including
<br>kdb and the KDB print routines in l4/kdebug.h.<br><br>The one in drivers/ is the user-level UART driver.&nbsp;&nbsp;This links against<br>the vserial program to provide a user-level UART device.<br><br>Sometimes, because some boards only have one console output UART, the
<br>kernel driver and the user-level driver may drive the same physical<br>device which I think is the source of some of your confusion.<br><br>To summarize, printf() and kdb output from the kernel always go out<br>via the kernel driver.&nbsp;&nbsp;When you are in userland, the things get
<br>a bit complicated.&nbsp;&nbsp;YOu have the option of using the L4_KDB* in<br>l4/kdebug.h in which case they go out via the kernel driver, or you<br>have the option of using the user-level UART device, in which case,<br>you go out to the user-level serial driver via vserial.
<br><br><br>&gt; 4. in src/platform/pxa/, there are some codes like irq.cc and intctrl.h<br>&gt;&nbsp;&nbsp;related to interrupt controller.<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; but why okl4 still works even i don&#39;t set the memory map to INT<br>&gt; controller&#39;s registers correctly?
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; i add printf in OS timer&#39;s INT handler further, but no output shown.<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;so does OKL4 not use any interrupt?<br><br>The only drivers in the kernel are the console device and timer<br>driver and interrupt controller.&nbsp;&nbsp;The timer interrupt is handled in-
<br>kernel if it is a timeslice expiry.&nbsp;&nbsp;The console device typically runs<br>on polling I/O and does not use interrupts.&nbsp;&nbsp;There is nothing to stop<br>you from implementing an interrupt-driven device in the kernel at<br>least for the console there is probably little reason for doing so.
<br><br>If your interrupt controller driver is non-functional things will still<br>work, but you probably won&#39;t get very far, as soon as you try receiving<br>interrupts things will break.<br><br>As for your timer interrupt you probably have to get the interrupt
<br>controller going first before looking into the timer interrupt.<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-gl<br><br>&gt;<br>&gt; thanks for answering my questions.<br>&gt;<br>&gt;<br>&gt; best regards,<br>&gt;<br>&gt; kashin lin<br><br>&gt; _______________________________________________
<br>&gt; Developer mailing list<br>&gt; <a href="mailto:Developer@okl4.org">Developer@okl4.org</a><br>&gt; <a href="https://lists.okl4.org/mailman/listinfo/developer">https://lists.okl4.org/mailman/listinfo/developer</a><br>
<br><br>--<br>Lalalalalalalalala...<br><br></blockquote></div><br>