LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   undefined reference (https://www.linuxquestions.org/questions/programming-9/undefined-reference-281954/)

mp4-10 01-25-2005 04:55 AM

undefined reference
 
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
:confused:
BYE

leonscape 01-25-2005 05:10 AM

Are you writing a driver/module?

mp4-10 01-25-2005 06:41 AM

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...

leonscape 01-25-2005 12:38 PM

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.


All times are GMT -5. The time now is 05:20 AM.