Knight KE / Mbed OS Game_Master
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rtc_test.h Source File

rtc_test.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2017-2017 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 /** \addtogroup hal_rtc_tests
00018  *  @{
00019  */
00020 
00021 #ifndef MBED_RTC_TEST_H
00022 #define MBED_RTC_TEST_H
00023 
00024 #if DEVICE_RTC
00025 
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029 
00030 /** Test that ::rtc_init can be called multiple times.
00031  *
00032  *  Given board provides RTC.
00033  *  When ::rtc_init is called multiple times.
00034  *  Then ::rtc_init are successfully performed (no exception is generated).
00035  *
00036  */
00037 void rtc_init_test(void);
00038 
00039 /** Test that the RTC keeps counting in the various sleep modes.
00040  *
00041  * Given board provides RTC.
00042  * When system enters sleep/deep-sleep mode.
00043  * RTC keeps counting.
00044  *
00045  */
00046 void rtc_sleep_test(void);
00047 
00048 /** Test that the RTC keeps counting even after ::rtc_free has been called.
00049  *
00050  * Given board provides RTC.
00051  * When ::rtc_free has been called.
00052  * RTC keeps counting.
00053  *
00054  */
00055 void rtc_persist_test(void);
00056 
00057 /** Test time does not glitch backwards due to an incorrectly implemented ripple counter driver.
00058  *
00059  * Given board provides RTC.
00060  * When RTC is enabled and counts.
00061  * Then time does not glitch backwards due to an incorrectly implemented ripple counter driver.
00062  *
00063  */
00064 void rtc_glitch_test(void);
00065 
00066 /** Test that the RTC correctly handles large time values.
00067  *
00068  * Given board provides RTC.
00069  * When RTC is enabled and counts.
00070  * The RTC correctly handles different time values.
00071  */
00072 void rtc_range_test(void);
00073 
00074 /** Test that the RTC accuracy is at least 10%.
00075  *
00076  *  Given platform provides Real Time Clock.
00077  *  When delay is performed based on RTC (10 sec delay).
00078  *  Then the delay time measured using high frequency timer indicate that RTC accuracy is at least 10%.
00079  *
00080  */
00081 void rtc_accuracy_test(void);
00082 
00083 /** Test that ::rtc_write/::rtc_read functions provides availability to set/get RTC time.
00084  *
00085  *  Given platform provides Real Time Clock.
00086  *  When an example RTC time is set by means of rtc_write function and rtc_read is performed immediately after this operation.
00087  *  Then rtc_read function returns time which has been set.
00088  *
00089  */
00090 void rtc_write_read_test(void);
00091 
00092 /** Test that ::rtc_isenabled function returns 1 if the RTC is counting and the time has been set, 0 otherwise
00093  *
00094  *  NOTE: RTC is counting when it has been initialised by means of rtc_init().
00095  *        RTC time is set by means of rtc_write() function.
00096  *        RTC must be initialised before rtc_isenabled() function can be called.
00097  *
00098  *  Given platform provides Real Time Clock.
00099  *  When rtc_isenabled() function is called.
00100  *  Then the result is 1 if RTC time has been set, otherwise the result is 0.
00101  *
00102  */
00103 void rtc_enabled_test(void);
00104 
00105 /**@}*/
00106 
00107 #ifdef __cplusplus
00108 }
00109 #endif
00110 
00111 #endif
00112 
00113 #endif
00114 
00115 /** @}*/