| |

VerySource

 Forgot password?
 Register
Search
View: 850|Reply: 3

Interrupt function and printk ()

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-15 12:30:01
| Show all posts |Read mode
1. Must the return value and parameter type of the interrupt handler be void?
2. The printk () function is a kernel print. Can it be printed on the terminal?
Thank you!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Unknown

Post time: 2020-4-20 08:30:02
| Show all posts
Printk information can be displayed in the terminal
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-4-20 23:30:01
| Show all posts
What about the interrupt function, continue to ask
Reply

Use magic Report

0

Threads

8

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 Unknown

Post time: 2020-5-5 13:15:02
| Show all posts
Look at the prototype request_irq of the 2.4 and 2.6 kernels.

2.4:
int request_irq (unsigned int irq,
                void (* handler) (int, void *, struct pt_regs *),
                unsigned long flags,
                const char * dev_name,
                void * dev_id);

2.6:
int request_irq (unsigned int irq,
                irqreturn_t (* handler) (int, void *, struct pt_regs *),
                unsigned long flags,
                const char * dev_name,
                void * dev_id);

The following is an excerpt from LDD3 (2.6kernel):

Interrupt handlers should return a value indicating whether there was actually an interrupt to handle. If the handler found that its device did, indeed, need attention, it should return IRQ_HANDLED; otherwise the return value should be IRQ_NONE. You can also generate the return value with this macro:

IRQ_RETVAL (handled)
where handled is nonzero if you were able to handle the interrupt. The return value is used by the kernel to detect and suppress spurious interrupts. If your device gives you no way to tell whether it really interrupted, you should return IRQ_HANDLED.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list