• 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 "hal_config.h"
18 #include "calendar_hw.h"
19 #include "calendar_ll.h"
20 #include <driver/hal/hal_calendar_types.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 typedef struct {
27 	calendar_hw_t *hw;
28 	calendar_unit_t id;
29 } calendar_hal_t;
30 
31 #define calendar_hal_enable(hal) calendar_ll_enable((hal)->hw)
32 #define calendar_hal_disable(hal) calendar_ll_disable((hal)->hw)
33 #define calendar_hal_set_init_value(hal, val) calendar_ll_set_init_value((hal)->hw, val)
34 #define calendar_hal_reset_config_to_default(hal) calendar_ll_reset_config_to_default((hal)->hw)
35 #define calendar_hal_get_second_cnt(hal) calendar_ll_get_second_cnt((hal)->hw)
36 #define calendar_hal_get_us_cnt(hal) calendar_ll_get_us_cnt((hal)->hw)
37 
38 bk_err_t calendar_hal_init(calendar_hal_t *hal);
39 
40 #if CFG_HAL_DEBUG_CALENDAR
41 void calendar_struct_dump(void);
42 #else
43 #define calendar_struct_dump()
44 #endif
45 
46 #ifdef __cplusplus
47 }
48 #endif
49 
50