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