Hello, Thanks for Venkat's response , but my system still crash. Before I used the rtl_hard_enable_irq function, my system didn't crash even if i returned 0.
I found that the following URL has an example .It uses the rtl_hard_enable_irq function , and returns 0,too. http://www.linuxdevices.com/articles/AT8948080759.html So...i still don't know why my system crashed :~ Here is my code : #include <rtl.h> #include <rtl_fifo.h> #include <rtl_time.h> #include <rtl_sched.h> #include <rtl_sync.h> #include <rtl_core.h> #include "common.h" #define IRQ1 4 // IRQ of device1 , eth0 unsigned int int_handler(unsigned int irq, struct pt_regs *regs) { long long t; t = lrdtsc(); switch (irq) { case IRQ1 : rtf_put(0, &t, sizeof(t)); break; default : break; } rtl_hard_enable_irq(irq); return 1; // it was 0 , now changes to 1 , but still crash } int init_module(void) { int ret; if (rtf_create(0, 1024*sizeof(long long)) != 0) rtl_printf("Fail to create fifo 0\n"); ret = rtl_request_irq(IRQ1, int_handler); if (ret) { rtl_printf("failed to get irq%d: %d\n", IRQ1, ret); } else { rtl_printf("got irq%d\n", IRQ1); } return 0; } void cleanup_module(void) { if (rtf_destroy(0) < 0) rtl_printf("Fail to destroy fifo 0\n"); rtl_free_irq(IRQ1); } ----- Original Message ----- From: "A V" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, April 15, 2002 12:20 PM Subject: Re: [rtl] about rtl_hard_enable_irq > > U return 1 dont return 0. If u return 1 OS thinks that > ur interrupt was handled. And if u return 0 OS thinks > the interrupt is not handled and searches for suitable > handler. But it fails and crashes. > > Regards > Venkat > > --- ¸Î¤å <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I got a problem with the rtl_hard_enable_irq > > function. > > When i put the function in a rtl interrupt > > handler like this... > > > > > > unsigned int int_handler(unsigned int irq, struct > > pt_regs *regs) > > { > > long long t; > > t = lrdtsc(); > > switch (irq) { > > case IRQ1 : > > rtl_hard_enable_irq(IRQ1); > > rtf_put(0, &t, sizeof(t)); > > break; > > case IRQ2 : > > rtl_hard_enable_irq(IRQ2); > > rtf_put(1, &t, sizeof(t)); > > break; > > > > > > default : > > break; > > } > > return 0; > > } > > > > when there's an interrupt occur(IRQ1=4 , IRQ2=3 > > ), my system will > > crash seriously. But if i don't use the > > function. rtlinux will not receive > > anymore interrupt(IRQ1 and IRQ2) before > > rtl_global_pend_irq(). > > > > I searched some others' codes, all of them put > > the rtl_hard_enable_irq > > in their interrupt handler. So i can not > > understand why my system crashed. > > Does anyone have the answer ? > > > > enviroment: redhat 7.0 > > kernel2.2.19-rtl > > rtlinux-3.1 > > NIC Card IRQ : 4 and 3 > > > > > > > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Tax Center - online filing with TurboTax > http://taxes.yahoo.com/ > -- [rtl] --- > To unsubscribe: > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] > -- > For more information on Real-Time Linux see: > http://www.rtlinux.org/ -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] -- For more information on Real-Time Linux see: http://www.rtlinux.org/