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