• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Bestechnic (Shanghai) 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 #ifndef __HAL_TIMER_RAW_H__
16 #define __HAL_TIMER_RAW_H__
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #ifndef IGNORE_HAL_TIMER_RAW_API_CHECK
23 #if !(defined(ROM_BUILD) || defined(SIMU))
24 #error "Raw timer API can only be used in rom or simulation environment!"
25 #endif
26 #endif
27 
28 #include "hal_timer.h"
29 
30 void hal_timer_setup(enum HAL_TIMER_TYPE_T type, HAL_TIMER_IRQ_HANDLER_T handler);
31 
32 #ifdef BSP_NICKNAME_SUPPORT
33 void hal_timer_start_nickname(uint32_t load);
34 void hal_timer_stop_nickname(void);
35 #define hal_timer_start hal_timer_start_nickname
36 #define hal_timer_stop hal_timer_stop_nickname
37 #else
38 void hal_timer_start(uint32_t load);
39 void hal_timer_stop(void);
40 #endif
41 void hal_timer_continue(void);
42 
43 int hal_timer_is_enabled(void);
44 
45 void hal_timer_reload(uint32_t load);
46 
47 uint32_t hal_timer_get_raw_value(void);
48 
49 int hal_timer_irq_active(void);
50 
51 int hal_timer_irq_pending(void);
52 
53 uint32_t hal_timer_get_elapsed_time(void);
54 
55 #ifdef __cplusplus
56 }
57 #endif
58 
59 #endif
60