Fedora Linux Support Community & Resources Center
  #1  
Old 28th February 2006, 02:38 AM
liuyijun Offline
Registered User
 
Join Date: Feb 2006
Posts: 5
How to call timer interrupt service routine on fedora core 4?

Hi,
I'm using fedora core 4. I'm doing my school project that requires me to write program in C and run on linux. I need to call timer interrupt service routine in the program, found a code that seems to be able to do it in windows, but when i compiled it in fedora, gcc doesn't recognise <dos.h> and <bios.h> that's included in the code.
Anyone knows how to call timer interrupt that gcc recognizes? Urgently need help! Thanks.
Reply With Quote
  #2  
Old 28th February 2006, 11:04 AM
markkuk Offline
Registered User
 
Join Date: Apr 2005
Location: Finland
Posts: 5,075
All interrupt handling in Linux is done by the kernel. You can't "call timer interrupt" in an user-level program, you must use the POSIX timer functions like timer_create(), timer_gettime() and timer_delete().
See "man timer_create" and the Single Unix Specification
Reply With Quote
  #3  
Old 28th February 2006, 03:30 PM
liuyijun Offline
Registered User
 
Join Date: Feb 2006
Posts: 5
Thank you. I did some read-up on that. Tried out some example codes, unfortunately POSIX functions like clock_gettime etc don't seem to be supported in my time.h, looks like it requires POSIX.4? I tried out another function setitmer() and this one works ok. I suppose they are under different category of POSIX? Where or how can i download the POSIX.4 include files?
Reply With Quote
  #4  
Old 28th February 2006, 10:53 PM
markkuk Offline
Registered User
 
Join Date: Apr 2005
Location: Finland
Posts: 5,075
The Fedora Core 4 time.h header declares clock_gettime(), timer_create() and all other POSIX timer functions. You don't need to download anything.
What's the exact error message you get when you try to use those functions?
Are you linking your code with librt? (-lrt)
Reply With Quote
  #5  
Old 1st March 2006, 04:40 AM
liuyijun Offline
Registered User
 
Join Date: Feb 2006
Posts: 5
I checked the time.h, some of the functions, eg clock_gettime() and timer_create() are declared as extern. When compiled, the error message is "undefined reference in clock_gettime".

Prior to this, i was trying to install rtai onto fedora 4 and ran some patches on the kernel following the instructions in http://www.cs.rose-hulman.edu/~ellis...9-adeos-howto/, with linux-2.6.11.tar.gz and adeos-linux-2.6.11-i386-r13.patch, i was able to proceed till the make all
step just before step 3 build RTAI stuff. During the make all step, i encountered a few errors after a long wait:
In file included from drivers/i2c/algos/i2c-algo-bit.c:31:
include/linux/i2c.h:58: error: array type has incomplete element type
include/linux/i2c.h:197: error: array type has incomplete element type
make[3]: *** [drivers/i2c/algos/i2c-algo-bit.o] Error 1
make[2]: *** [drivers/i2c/algos] Error 2
make[1]: *** [drivers/i2c] Error 2
make: *** [drivers] Error 2

and thus couldn't proceed anymore. would these patches overwrite the original libraries?
Reply With Quote
  #6  
Old 1st March 2006, 11:09 AM
markkuk Offline
Registered User
 
Join Date: Apr 2005
Location: Finland
Posts: 5,075
Quote:
Originally Posted by liuyijun
I checked the time.h, some of the functions, eg clock_gettime() and timer_create() are declared as extern. When compiled, the error message is "undefined reference in clock_gettime".
This means you aren't linking with the necessary library. Add -lrt to the gcc command line.
Reply With Quote
  #7  
Old 2nd March 2006, 10:53 PM
liuyijun Offline
Registered User
 
Join Date: Feb 2006
Posts: 5
ah... it works now. Thank you very much for your advice. You've provided a great help!
Reply With Quote
Reply

Tags
core, fedora, interrupt, routine, service, timer

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Timer Interrupt Error during reboot lipteck Using Fedora 10 21st January 2008 09:05 AM
fedora kernel timer interrupt rate Paprika Using Fedora 1 11th June 2007 04:29 AM
hdb lost interrupt when installing Fedora Core 3 holdem Installation, Upgrades and Live Media 0 11th May 2005 10:45 PM
how to connect my roadrunner service or aol service to my fedora core 1 on my compter john nelson jr Using Fedora 1 14th March 2005 12:22 AM


Current GMT-time: 10:03 (Sunday, 21-09-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat