• 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 #include <common/bk_include.h>
16 #include "bk_ps_time.h"
17 #include "bk_wdt.h"
18 #include <components/system.h>
19 #include <os/os.h>
20 #include "los_timer.h"
21 #include "los_tick.h"
22 
23 extern void HalTickHandler(u8 param);
24 
bk_tick_handle(uint8_t arg)25 void bk_tick_handle(uint8_t arg)
26 {
27 	GLOBAL_INT_DECLARATION();
28 
29 #if CONFIG_TICK_CALI
30 	if (!mcu_ps_need_pstick())
31 		return;
32 #endif
33 
34 	GLOBAL_INT_DISABLE();
35 
36 	HalTickHandler(0);
37 
38 #if (CONFIG_INT_WDT)
39 	bk_int_wdt_feed();
40 #endif
41 
42 #if (CONFIG_TASK_WDT)
43 	bk_task_wdt_timeout_check();
44 #endif
45 	GLOBAL_INT_RESTORE();
46 }
47 
bk_update_tick(uint32_t tick)48 int bk_update_tick(uint32_t tick)
49 {
50 	return 0;
51 }
52 
bk_get_tick(void)53 uint64_t bk_get_tick(void)
54 {
55 	return LOS_TickCountGet();
56 }
57 
bk_get_second(void)58 uint32_t bk_get_second(void)
59 {
60 	return (bk_get_tick() / bk_get_ticks_per_second());
61 }
62 
bk_get_ticks_per_second(void)63 uint32_t bk_get_ticks_per_second(void)
64 {
65 	return LOS_TICKS_PER_SECOND;
66 }
67 
bk_get_ms_per_tick(void)68 uint32_t bk_get_ms_per_tick(void)
69 {
70 	return LOS_TICK_MS;
71 }
72