1 #ifndef _BFLB_MTIMER_H
2 #define _BFLB_MTIMER_H
3 
4 #include "stdint.h"
5 #include "stdio.h"
6 
7 /** @addtogroup LHAL
8   * @{
9   */
10 
11 /** @addtogroup MTIMER
12   * @{
13   */
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 /**
20  * @brief Config mtimer interrupt.
21  *
22  * @param [in] ticks ticks to invoke interrupt.
23  * @param [in] interruptfun interrupt callback
24  */
25 void bflb_mtimer_config(uint64_t ticks, void (*interruptfun)(void));
26 
27 /**
28  * @brief Get mtimer current frequence.
29  *
30  * @return frequence
31  */
32 uint32_t bflb_mtimer_get_freq(void);
33 
34 /**
35  * @brief Mtimer delay with ms.
36  *
37  * @param [in] time delay time
38  */
39 void bflb_mtimer_delay_ms(uint32_t time);
40 
41 /**
42  * @brief Mtimer delay with us.
43  *
44  * @param [in] time delay time
45  */
46 void bflb_mtimer_delay_us(uint32_t time);
47 
48 /**
49  * @brief Get current mtimer time with us.
50  *
51  * @return time with us
52  */
53 uint64_t bflb_mtimer_get_time_us();
54 
55 /**
56  * @brief Get current mtimer time with ms.
57  *
58  * @return time with ms
59  */
60 uint64_t bflb_mtimer_get_time_ms();
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 /**
67   * @}
68   */
69 
70 /**
71   * @}
72   */
73 
74 #endif