• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2022 Beken Corporation
2 //
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 #pragma once
16 
17 #include <common/bk_include.h>
18 #include <driver/calendar_types.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 /**
25  * @brief     Init the calendar driver
26  *
27  * This API init the resoure common:
28  *   - Init calendar driver control memory
29  *
30  * @attention 1. This API should be called before any other calendar APIs.
31  *
32  * @return
33  *    - BK_OK: succeed
34  *    - others: other errors.
35  */
36 bk_err_t bk_calendar_driver_init(void);
37 
38 /**
39  * @brief     Deinit the calendar driver
40  *
41  * This API free all resource related to calendar and disable calendar.
42  *
43  * @return
44  *    - BK_OK: succeed
45  *    - others: other errors.
46  */
47 bk_err_t bk_calendar_driver_deinit(void);
48 
49 /**
50  * @brief     Set the calendar init value
51  *
52  * @param init_val calendar init value
53  *
54  * @return
55  *    - BK_OK: succeed
56  *    - others: other errors.
57  */
58 bk_err_t bk_calendar_set_init_value(uint32_t init_val);
59 
60 /**
61  * @brief     Get the calendar time us
62  *
63  * @return the calendar time us
64  */
65 uint64_t bk_calendar_get_time_us(void);
66 
67 #ifdef __cplusplus
68 }
69 #endif
70 
71