Mistake on this page?
Report an issue in GitHub or email us
sleep_manager_api_tests.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2018 ARM Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /**
18  * @addtogroup hal_sleep_manager_tests
19  * @{
20  */
21 
22 #ifndef MBED_HAL_SLEEP_MANAGER_API_TESTS_H
23 #define MBED_HAL_SLEEP_MANAGER_API_TESTS_H
24 
25 #if DEVICE_SLEEP
26 
27 /** Test lock/unlock
28  *
29  * Given no prior calls to lock/unlock
30  * When the deep sleep status is checked
31  * Then the deep sleep is allowed
32  *
33  * When the lock function is called
34  * Then the deep sleep is not allowed
35  *
36  * When the unlock function is called
37  * Then the deep sleep is allowed again
38  */
39 void test_lock_unlock();
40 
41 /** Test lock USHRT_MAX times
42  *
43  * Given a device with sleep mode support
44  * When deep sleep mode is locked USHRT_MAX times
45  * Then the deep sleep mode is locked
46  *
47  * When unlock is called repeatedly
48  * Then deep sleep mode stays locked until the number
49  * of unlock calls is equal to number of lock calls
50  */
52 
53 /** Test sleep_auto calls sleep and deep sleep based on lock
54  *
55  * Given a device with sleep mode support
56  * When the deep sleep mode is locked
57  * Then sleep_auto uses sleep mode
58  *
59  * When the deep sleep mode is unlocked
60  * Then sleep_auto uses deep sleep mode
61  */
62 void test_sleep_auto();
63 
64 /** Test lock/unlock test_check fun
65  *
66  * Given the deep sleep has not been locked
67  * When the deep sleep status is checked
68  * Then sleep_manager_can_deep_sleep() returns true
69  * and sleep_manager_can_deep_sleep_test_check() returns true instantly.
70  *
71  * When the deep sleep mode is locked
72  * Then sleep_manager_can_deep_sleep() returns false
73  * and sleep_manager_can_deep_sleep_test_check() returns false with 2 ms delay.
74  *
75  * When the deep sleep mode is unlocked with a 1 ms delay
76  * Then sleep_manager_can_deep_sleep() returns false
77  * and sleep_manager_can_deep_sleep_test_check() returns true with 1 ms delay
78  * and sleep_manager_can_deep_sleep() returns true when checked again.
79  */
81 
82 #endif
83 
84 #endif
85 
86 /** @}*/
void test_lock_unlock_test_check()
Test lock/unlock test_check fun.
void test_lock_eq_ushrt_max()
Test lock USHRT_MAX times.
void test_lock_unlock()
Test lock/unlock.
void test_sleep_auto()
Test sleep_auto calls sleep and deep sleep based on lock.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.