From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KoLGX-0000q7-0T for qemu-devel@nongnu.org; Fri, 10 Oct 2008 12:55:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KoLGU-0000pv-H8 for qemu-devel@nongnu.org; Fri, 10 Oct 2008 12:54:59 -0400 Received: from [199.232.76.173] (port=37716 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KoLGU-0000ps-Bc for qemu-devel@nongnu.org; Fri, 10 Oct 2008 12:54:58 -0400 Received: from wmproxy1-g27.free.fr ([212.27.42.91]:1174) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KoLGU-00085r-0e for qemu-devel@nongnu.org; Fri, 10 Oct 2008 12:54:58 -0400 Received: from UNKNOWN (unknown [172.20.243.132]) by wmproxy1-g27.free.fr (Postfix) with ESMTP id 360A630321 for ; Fri, 10 Oct 2008 19:30:09 +0200 (CEST) Message-ID: <1223657696.48ef88e0224fa@imp.free.fr> Date: Fri, 10 Oct 2008 18:54:56 +0200 From: adrien lebre MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] i8254 - Cannot change Timer frequency Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi all, I posted the following question on the QEMU general forum few weeks ago (http://qemu-forum.ipi.fi/viewtopic.php?f=3D3&t=3D4638#p13814). Someone a= dviced me to post it directly on the development mailing list. I already tried to l= ook up into the archive but I didn't find any answers. Since several people seem= s to be concerned by this issue, I finally decided to do it. Thanks in advance for your help. Best Regards, Adrien PS: please find below the copy/paste from the QEMU forum. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -= - - - i8254 - Cannot change Timer frequency by alebre on Wed Sep 17, 2008 4:26 pm Hi all, In the context of study, we have to develop a simple operating system fro= m scratch. To develop our ''kernel'' we are using QEMU. For few days, we have fighted with the I8254 chip in order to create a ti= mer for our system. Based on the code provided in the Simple OS (http://sos.enix.org/lxr/source/hwcore/i8254.c), we are trying to change = the frequency. Unfortunately, whatever the value of nb_tick, the frequency does not chan= ge. Here, I just copied the related code. We tried by setting the nb_tick wit= h 11931, 1193 and 119 directly in the following functions. Unfortunately, t= he time frequency (according to the IRQ timer handler) is still the same . Does anyone have an idea ? Thanks in advance, Adrien. /** 82c54 clock frequency */ #define I8254_MAX_FREQ 1193180 /* Ports to communicate with the 82c54 */ #define I8254_TIMER0 0x40 #define I8254_TIMER1 0x41 #define I8254_TIMER2 0x42 #define I8254_CONTROL 0x43 ... int i8254_set_frequency(unsigned int freq){ unsigned int nb_tick; if (freq <=3D 0) return -255; /* Compute counter value */ nb_tick =3D I8254_MAX_FREQ / freq; /* Counter must be between 1 and 65536 */ if (nb_tick > 65536) return -255; if (nb_tick <=3D 0) return -255; /* The i8254 interprets 0 to mean counter =3D=3D 65536, because 65536 cannot be coded on 16bits */ if (nb_tick =3D=3D 65536) nb_tick =3D 0; /* We want to configure timer0, we want to send both LSB+MSB to set timer0 freq (-> 0x30), and we configure timer0 in mode 2, ie as a rate generator (-> 0x4) =3D=3D> 0x34 */ outb(0x34, I8254_CONTROL); /* Send LSB of counter first */ outb((nb_tick & 0xFF), I8254_TIMER0); /* Send MSB of counter */ outb((nb_tick >> 8) & 0xFF, I8254_TIMER0); return 1; } Re: i8254 - Cannot change Timer frequency by alebre on Wed Sep 17, 2008 4:37 pm What is the behavior of QEMU with regard to such instructions ? Does QEMU emulate the I8254 chip or does it simply forward the instructio= n to the host OS ? In that case, the host OS could simply does not consider su= ch an instruction ? Adrien, still looking for some explanations.... --=20