LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Thread Tools
Old 01-25-2005, 05:55 AM   #1
mp4-10
LQ Newbie
 
Registered: Jan 2005
Posts: 16
Thanked: 0
undefined reference


[Log in to get rid of this advertisement]
Hi,

I am writing my project in C language and using gcc.
The code is compiled ok, there are linker errors.
I am trying to use interrupts that's why there is used request_irq function which is in linux/sched.h .
I am using KDEVELOP!!!
Do I need to use some additional library?

The piece of code is:
int xinit_module(void){

int ret;


outb_p(0, SERPORT + 3); // reset DLAB
outb_p(0, SERPORT + 1);

ret = request_irq(4, &handler, SA_INTERRUPT, "/dev/ttyS0", NULL);
if (ret) {
printf ("##### error requesting irq 4: returned %d\n", ret);
}
enable_irq(4);

outb_p(0, SERPORT + 3);
outb_p(0xC7, SERPORT + 2);
outb_p(0x0B, SERPORT + 4);


// Bit 3 Enable Modem Status Interrupt
// Bit 2 Enable Receiver Line Status Interrupt
outb_p(0x0C, SERPORT + 1);


return 0;
}

Error from linker is:
comport.o(.text+0x361): In function `xinit_module':
: undefined reference to `request_irq'

I hope someone can help me

BYE
mp4-10 is offline     Reply With Quote
Old 01-25-2005, 06:10 AM   #2
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313
Thanked: 0
Are you writing a driver/module?
leonscape is offline     Reply With Quote
Old 01-25-2005, 07:41 AM   #3
mp4-10
LQ Newbie
 
Registered: Jan 2005
Posts: 16
Thanked: 0

Original Poster
Hmmm,
I would like to detect interrupt on serial port and reply with handler function in my project, so I do not know if driver module should be used for this...
mp4-10 is offline     Reply With Quote
Old 01-25-2005, 01:38 PM   #4
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313
Thanked: 0
I think the code your trying to link to is for the internals of the kernel and not for userland programming. What you probably look into is checking stty and the /dev files.

Heres a useful link for you all about serial interfaces Serial HOWTO. I haven't gone through the document myself but it seems to have a lot of the details you will need.
leonscape is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Undefined reference, why? george_mercury Programming 4 05-07-2009 01:15 AM
undefined reference to `XF86VidModeGetModeLine' apokryphos Linux - General 1 08-07-2005 07:40 PM
Undefined Reference ChemicalBurn Programming 2 02-14-2005 04:01 AM
undefined reference to 'request_irq()' deimosSan Programming 2 11-10-2003 09:15 AM
Yet another 'undefined reference' problem faulpelz2 Linux - Software 3 04-04-2003 12:18 PM


All times are GMT -5. The time now is 04:36 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration