How to share RTC interrupt?
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 in advance. |
On standard PCs, the RTC is an ISA device; its interrupt cannot be shared.
|
Thanks for your reply.But I heard that ISA bus is obsolete and nowadays it is not used.
|
Quote:
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? Thanks in advance. |
Quote:
Quote:
Quote:
Quote:
|
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?:scratch: |
Quote:
Quote:
|
If the receiver wants precise period , We cannot assure that period using RTC. Can we use HPET for this?
|
Quote:
|
Thanks cladisch,
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. |
Quote:
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. |
Quote:
|
All times are GMT -5. The time now is 02:49 AM. |