1 /* 2 * Copyright (c) 2022 Winner Microelectronics Co., Ltd. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @file wm_rtc.h 18 * 19 * @brief rtc Driver Module 20 * 21 * @author dave 22 * 23 * Copyright (c) 2014 Winner Microelectronics Co., Ltd. 24 */ 25 #ifndef WM_RTC_H 26 #define WM_RTC_H 27 28 #include <time.h> 29 #include "wm_type_def.h" 30 31 /** rtc interrupt callback */ 32 typedef void (*tls_rtc_irq_callback)(void *arg); 33 34 /** 35 * @defgroup Driver_APIs Driver APIs 36 * @brief Driver APIs 37 */ 38 39 /** 40 * @addtogroup Driver_APIs 41 * @{ 42 */ 43 44 /** 45 * @defgroup RTC_Driver_APIs RTC Driver APIs 46 * @brief RTC driver APIs 47 */ 48 49 /** 50 * @addtogroup RTC_Driver_APIs 51 * @{ 52 */ 53 54 /** 55 * @brief This function is used to set pmu rtc time 56 * 57 * @param[in] tblock time value 58 * 59 * @return None 60 * 61 * @note None 62 */ 63 void tls_set_rtc(struct tm *tblock); 64 65 /** 66 * @brief This function is used to get pmu rtc time 67 * 68 * @param[out] tblock time value 69 * 70 * @return None 71 * 72 * @note None 73 */ 74 void tls_get_rtc(struct tm *tblock); 75 76 /** 77 * @brief This function is used to register pmu rtc interrupt 78 * 79 * @param[in] callback the rtc interrupt call back function 80 * @param[in] arg parameter of call back function 81 * 82 * @return None 83 * 84 * @note 85 * User does not need to clear the interrupt flag. 86 * Rtc callback function is called in interrupt, 87 * so do not operate the critical data in the callback fuuction. 88 * Sending messages to other tasks to handle is recommended. 89 */ 90 void tls_rtc_isr_register(tls_rtc_irq_callback callback, void *arg); 91 92 /** 93 * @brief This function is used to start pmu rtc timer 94 * 95 * @param[in] tblock timer value 96 * 97 * @return None 98 * 99 * @note None 100 */ 101 void tls_rtc_timer_start(struct tm *tblock); 102 103 /** 104 * @brief This function is used to stop pmu rtc timer 105 * 106 * @param None 107 * 108 * @return None 109 * 110 * @note This function also is used to clear rtc timer interrupt 111 */ 112 void tls_rtc_timer_stop(void); 113 114 /** 115 * @} 116 */ 117 118 /** 119 * @} 120 */ 121 122 #endif 123 124