Function report |
Source Code:kernel\power\suspend_test.c |
Create Date:2022-07-28 09:58:33 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:To test system suspend, we need a hands-off mechanism to resume the* system. RTCs wake alarms are a common self-contained mechanism.
Proto:static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state)
Type:void
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct rtc_device * | rtc | |
| suspend_state_t | state |
| 64 | static char err_readtime[] __initdata = r conditions "PM: can't read %s time, err %d\n" |
| 66 | static char err_wakealarm[] __initdata = r conditions "PM: can't set %s wakealarm, err %d\n" |
| 68 | static char err_suspend[] __initdata = r conditions "PM: suspend test failed, error %d\n" |
| 70 | static char info_test[] __initdata = formational "PM: test RTC wakeup from '%s' suspend\n" |
| 78 | repeat : |
| 79 | status = rtc_read_time(rtc, & ime the alarm is set to ) |
| 80 | If status < 0 Then |
| 81 | printk(err_readtime, dev_name( & dev), status) |
| 82 | Return |
| 84 | rtc_tm_to_time( & ime the alarm is set to , & now) |
| 87 | rtc_time_to_tm(now + We test the system suspend code by setting an RTC wakealarm a short* time in the future, then suspending, & ime the alarm is set to ) |
| 88 | 0 = alarm disabled, 1 = alarm enabled = true |
| 90 | status = rtc_set_alarm(rtc, & alm) |
| 91 | If status < 0 Then |
| 92 | printk(err_wakealarm, dev_name( & dev), status) |
| 93 | Return |
| 96 | If state == PM_SUSPEND_MEM Then |
| 99 | If status == -ENODEV Then state = PM_SUSPEND_STANDBY |
| 102 | If state == PM_SUSPEND_STANDBY Then |
| 105 | If status < 0 Then state = PM_SUSPEND_TO_IDLE |
| 108 | If state == PM_SUSPEND_TO_IDLE Then |
| 113 | If status < 0 Then printk(err_suspend, status) |
| 117 | If test_repeat_count_current < test_repeat_count_max Then Go to repeat |
| 124 | 0 = alarm disabled, 1 = alarm enabled = false |
| 125 | rtc_set_alarm(rtc, & alm) |
| Name | Describe |
|---|---|
| test_suspend |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |