Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
In linux, are we able to share the RTC interrupt? I found that in the diver file(/usr/src/linux-2.6.24.7/drivers/char/rtc.c)it is written as "IRQF_DISABLED"only so I changed it to "IRQF_SHARED" and recompiled the kernel. But after that while booting it is showing that "IRQ 8 is not free" and when i try to open the rtc it is showing "bad file descriptor" .Is it the problem with my editing? or compilaton? anybody can help me,please?
Thanks for your reply.But I heard that ISA bus is obsolete and nowadays it is not used.
Modern computers have no ISA bus, but the old ISA devices are still implemented in the southbridge or as LPC devices.
From the software side, these device behave exactly the same.
Thanks Cladisch. I decided to use hardware interrupts to get precise timing. I have heard that now PIT and RTC is emulated by HPET and we can use the remaining timers of this high precision timer.But using this may make machine dependency . Is there any way to get precise timing in linux(microsecond accuracy)?
What do you mean with "timing"? Do you want to read the current time, or do you want to schedule to execute some code?
Reading the current time can be done with do_gettimeofday().
If you have to run some timer function, you can use the RTC timer, but this won't work if another driver or application is already using it.
You can use the hrtimer to get precise timing on machines that support it; if not, the hrtimer functions use the HZ system timer.
Yes,i want to run a timer so that i can write some function which will be invoked when the timer ticks.But since we are not able to share the rtc timer how we will invoke the function? can we use the existing driver ("rtc.c")?
Is this hrtimer similar to HPET? and how can i know that my machine will support it?
I need the timer to execute a periodic task.This periodic task will send a burst of UDP datagrams every period.By using the hardware interrupt we will get the interrupt in a precise period(timing).
But using rtc we can get the interrupts in a predefined set of values. ie even if you want 1 ms you cannot get it. you can get only1/1024,1/512ms etc.So is there any way to get that?
I need the timer to execute a periodic task.This periodic task will send a burst of UDP datagrams every period.
I doubt you'll be able to send network packets from an interrupt handler; you'll need a workqueue or something like that.
Quote:
But using rtc we can get the interrupts in a predefined set of values. ie even if you want 1 ms you cannot get it. you can get only1/1024,1/512ms etc.So is there any way to get that?
UDP packets are quite asynchronous anyway; the receiver should be able to handle jitter.
I hope my BIOS supports hpet.
$dmesg | grep hpet
hpet clock event registered
hpet0:at MMIO 0xfed00000,IRQs2,8,0,0
hpet0:4 64-bit timers,14318180Hz
hpet-resorces:0xfed00000 is busy .
In some others it is hpet0:at MMIO 0xfed00000,IRQs2,8,0,
hpet0:3 64-bit timers,14318180Hz
This is the result that i found.Out of four timers ,two will be used for 8254 and rtc if we are using the legacy replacement mode and it will be routed to irq 0 and 8 . am i right? How can i know that the BIOS is supporting the access of others? and if yes how i will access? I tried the userspace code that is given in the hpet.txt. but it fails in my pc and it is working in others.
Out of four timers ,two will be used for 8254 and rtc if we are using the legacy replacement mode and it will be routed to irq 0 and 8 . am i right? How can i know that the BIOS is supporting the access of others?
The other(s) can be used if they have an IRQ different from 0.
In your examples, this is not the case.
However, the first timer is used by the kernel and can be used with all the normal timer functions; if you have a recent enough kernel, timers created by timer_create() or timerfd_create() will be able to give you 1000 Hz.
In the first case it is working and in the second it is not.why it happens so?if we are emulating timer using the hpet timer0 who is making the irq line from 2 to 0(timer irq line)?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.