Mistake on this page?
Report an issue in GitHub or email us
rtc_test.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2017-2017 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 /** \addtogroup hal_rtc_tests
19  * @{
20  */
21 
22 #ifndef MBED_RTC_TEST_H
23 #define MBED_RTC_TEST_H
24 
25 #if DEVICE_RTC
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 /** Test that ::rtc_init can be called multiple times.
32  *
33  * Given board provides RTC.
34  * When ::rtc_init is called multiple times.
35  * Then ::rtc_init are successfully performed (no exception is generated).
36  *
37  */
38 void rtc_init_test(void);
39 
40 /** Test that the RTC keeps counting in the various sleep modes.
41  *
42  * Given board provides RTC.
43  * When system enters sleep/deep-sleep mode.
44  * RTC keeps counting.
45  *
46  */
47 void rtc_sleep_test(void);
48 
49 /** Test that the RTC keeps counting even after ::rtc_free has been called.
50  *
51  * Given board provides RTC.
52  * When ::rtc_free has been called.
53  * RTC keeps counting.
54  *
55  */
56 void rtc_persist_test(void);
57 
58 /** Test time does not glitch backwards due to an incorrectly implemented ripple counter driver.
59  *
60  * Given board provides RTC.
61  * When RTC is enabled and counts.
62  * Then time does not glitch backwards due to an incorrectly implemented ripple counter driver.
63  *
64  */
65 void rtc_glitch_test(void);
66 
67 /** Test that the RTC correctly handles large time values.
68  *
69  * Given board provides RTC.
70  * When RTC is enabled and counts.
71  * The RTC correctly handles different time values.
72  */
73 void rtc_range_test(void);
74 
75 /** Test that the RTC accuracy is at least 10%.
76  *
77  * Given platform provides Real Time Clock.
78  * When delay is performed based on RTC (10 sec delay).
79  * Then the delay time measured using high frequency timer indicate that RTC accuracy is at least 10%.
80  *
81  */
82 void rtc_accuracy_test(void);
83 
84 /** Test that ::rtc_write/::rtc_read functions provides availability to set/get RTC time.
85  *
86  * Given platform provides Real Time Clock.
87  * When an example RTC time is set by means of rtc_write function and rtc_read is performed immediately after this operation.
88  * Then rtc_read function returns time which has been set.
89  *
90  */
91 void rtc_write_read_test(void);
92 
93 /** Test that ::rtc_isenabled function returns 1 if the RTC is counting and the time has been set, 0 otherwise
94  *
95  * NOTE: RTC is counting when it has been initialised by means of rtc_init().
96  * RTC time is set by means of rtc_write() function.
97  * RTC must be initialised before rtc_isenabled() function can be called.
98  *
99  * Given platform provides Real Time Clock.
100  * When rtc_isenabled() function is called.
101  * Then the result is 1 if RTC time has been set, otherwise the result is 0.
102  *
103  */
104 void rtc_enabled_test(void);
105 
106 /**@}*/
107 
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 #endif
113 
114 #endif
115 
116 /** @}*/
void rtc_range_test(void)
Test that the RTC correctly handles large time values.
void rtc_sleep_test(void)
Test that the RTC keeps counting in the various sleep modes.
void rtc_accuracy_test(void)
Test that the RTC accuracy is at least 10%.
void rtc_write_read_test(void)
Test that rtc_write/rtc_read functions provides availability to set/get RTC time. ...
void rtc_glitch_test(void)
Test time does not glitch backwards due to an incorrectly implemented ripple counter driver...
void rtc_init_test(void)
Test that rtc_init can be called multiple times.
void rtc_persist_test(void)
Test that the RTC keeps counting even after rtc_free has been called.
void rtc_enabled_test(void)
Test that rtc_isenabled function returns 1 if the RTC is counting and the time has been set...
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.