Mistake on this page?
Report an issue in GitHub or email us
watchdog_api_tests.h
1 /*
2  * Copyright (c) 2018-2019 Arm Limited and affiliates.
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_watchdog_tests
20  * @{
21  */
22 
23 #ifndef MBED_HAL_WATCHDOG_API_TESTS_H
24 #define MBED_HAL_WATCHDOG_API_TESTS_H
25 
26 #if DEVICE_WATCHDOG
27 
28 /** Test max_timeout validity
29  *
30  * Given a device supporting Watchdog HAL API,
31  * when @a hal_watchdog_get_platform_features() is called,
32  * then max_timeout member of returned watchdog_features_t struct is greater than 1.
33  */
35 
36 /** Test Watchdog features if a stopped Watchdog can be started again
37  *
38  * Given a device supporting Watchdog HAL API,
39  * when the device supports the @a disable_watchdog feature,
40  * then the device also supports @a update_config feature.
41  */
43 
44 /** Test Watchdog stop
45  *
46  * Given a device without a support for the @a disable_watchdog feature,
47  * when @a hal_watchdog_stop() is called,
48  * then WATCHDOG_STATUS_NOT_SUPPORTED is returned.
49  *
50  * Otherwise, given the device with @a disable_watchdog feature support:
51  *
52  * Given the Watchdog is *NOT* running,
53  * when @a hal_watchdog_stop() is called,
54  * then WATCHDOG_STATUS_OK is returned.
55  *
56  * Given the Watchdog is running,
57  * when @a hal_watchdog_stop() is called before the timeout expires,
58  * then WATCHDOG_STATUS_OK is returned and the device is not restarted.
59  *
60  * Given the Watchdog is *NOT* running (it has already been stopped),
61  * when @a hal_watchdog_stop() is called,
62  * then WATCHDOG_STATUS_OK is returned.
63  */
64 void test_stop();
65 
66 /** Test Watchdog init multiple times
67  *
68  * Given a set of unique timeout values,
69  * when @a config.timeout_ms is set to each of these values (T),
70  * then, for every value T, @a hal_watchdog_init() returns @a WATCHDOG_STATUS_OK
71  * and @a hal_watchdog_get_reload_value() returns a reload value R
72  * and T <= R < 2 * T.
73  */
74 void test_update_config();
75 
76 /** Test Watchdog init with a valid config
77  *
78  * Given @a config.timeout_ms is set to T ms,
79  * which is within supported Watchdog timeout range,
80  * when @a hal_watchdog_init() is called,
81  * then @a WATCHDOG_STATUS_OK is returned
82  * and @a hal_watchdog_get_reload_value() returns a reload value R
83  * and T <= R < 2 * T.
84  */
85 template<uint32_t timeout_ms>
86 void test_init();
87 
88 /** Test Watchdog init with a max_timeout
89  *
90  * Given @a config.timeout_ms is set to max_timeout,
91  * which is a value returned by @a hal_watchdog_get_platform_features(),
92  * when @a hal_watchdog_init() is called,
93  * then @a WATCHDOG_STATUS_OK is returned
94  * and @a hal_watchdog_get_reload_value() returns max_timeout.
95  */
97 
98 #endif
99 
100 #endif
101 
102 /** @}*/
103 
void test_update_config()
Test Watchdog init multiple times.
void test_init()
Test Watchdog init with a valid config.
void test_stop()
Test Watchdog stop.
void test_init_max_timeout()
Test Watchdog init with a max_timeout.
void test_max_timeout_is_valid()
Test max_timeout validity.
void test_restart_is_possible()
Test Watchdog features if a stopped Watchdog can be started again.
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.