How to record and unusual wake-up interrupt sources

Source: Internet
Author: User

Whether the Android system or VxWorks with other real-time systems, there are often situations in which the system wakes up and the debugging process is interrupted. The system is awakened, sometimes normal wake-up, for example, when the interrupt timer to wake up the system processing business, sometimes, abnormal awakening, let us set the time-out unreasonable, the system will cause power consumption, battery is very quickly exhausted, reduce the terminal standby or use time, At this point we need some means to record who wakes the system and then analyze whether it is reasonable to wake up. Unreasonable let the relevant responsible person change.

So in Android (similar to Linux), we are able to record the interrupt status at the Syscore level of the resume callback register callback function;

Why choose Syscore Level callback function, mainly Syscore level suspend and resume callback is completely in lock interrupt, at this time the system does not respond to interrupt. We are able to record the outage status here. One might ask. Why not register the SUSPEND_NOIRQ or RESUME_NOIRQ-level callback functions inside DPM? Give me a sample. On wake-up, after running the Syscore level resume, the system has been able to respond to an outage before running DPM's RESUME_NOIRQ. Assume a RESUME_NOIRQ-level callback. The system has already responded to the interrupt and erased the interrupt before calling the callback function to get the interrupt state, and it is not possible to obtain and record the interrupt state.

The introduction of the principle is finished. Let's take a simple look at the usage.

1. First, define your own callback function

static void My_resume (void)

{

/* Get interrupt status, depending on the actual need to choose whether to print out or another processing * *

}

2. Define your own register variables

Static Syscore_ops My_pm_ops = {

. Resume = My_resume,

};


3. Register Syscore OPS in your own initialization function

static int __init my_init (void) {

Register_syscore_ops (&my_pm_ops);

return 0;

}


Interested students can participate in the Linux core syscore_ops.h and syscore.c


Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

How to record and unusual wake-up interrupt sources

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.