Can I do floating point operations in interrupt handler ? (x86 or 64) Also I would like know can I use print function inside the interrupt handler ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Inside an interrupt handler, don’t use anything that can block. That means don’t use print functions unless they are non-blocking. Ideally, your ISR should do the bare minimum needed to clear the interrupt and then launch a normal thread to do the rest of the processing. If you need the print statements for debugging, then consider having the non-ISR part of your program declare a global, volatile buffer and have your ISR write your debug data into it. Your non-ISR code can check the buffer and
printfthe data from it if needed.You should avoid floating-point operations inside an ISR (and in kernel code in general) as well.