BK_TIMER
BK_TIMER API Status
API |
|---|
BK_TIMER API Reference
Header File
Functions
-
uint32_t bk_timer_create(pfunc_bk_timer_t pfn_timer_func, void *pv_arg, uint32_t caller_addr)
create a timer.
创建一个timer,即超时后会执行pfn_timer_func
参见
bk_timer_destroy() 来销毁创建的timer
备注
该timer在xtal 26M被关闭的时候会停止跳动
- 参数:
pfn_timer_func – [in] timer执行函数
pv_arg – [in] timer执行函数的参数
caller_addr – [in] caller address, 不清楚时可以传0
- 返回值:
0 – fail
other – success
- 返回:
timer handle
-
int32_t bk_timer_start_periodic(uint32_t timer_handle, uint32_t timeout_half_us)
start a periodic timer.
启动一个周期性的timer
- 参数:
timer_handle – [in] bk_timer_create()的返回值
timeout_half_us – [in] 周期时间,单位是 0.5us
- 返回值:
0 – success [BK_RET_OK]
other – fail
- 返回:
result
-
int32_t bk_timer_start_once(uint32_t timer_handle, uint32_t timeout_half_us)
start a timer only once.
启动一个一次性的timer
- 参数:
timer_handle – [in] bk_timer_create()的返回值
timeout_half_us – [in] 超时时间,单位是 0.5us
- 返回值:
0 – success [BK_RET_OK]
other – fail
- 返回:
result
-
int32_t bk_timer_stop(uint32_t timer_handle)
stop a timer.
停止一个timer,后面可以通过调用bk_timer_start_xxx()再次启动
- 参数:
timer_handle – [in] bk_timer_create()的返回值
- 返回值:
0 – success [BK_RET_OK]
other – fail
- 返回:
result
-
int32_t bk_timer_destroy(uint32_t timer_handle)
destroy a timer.
销毁一个timer,不再使用该timer的时候应该调用该函数
- 参数:
timer_handle – [in] bk_timer_create()的返回值
- 返回值:
0 – success [BK_RET_OK]
other – fail
- 返回:
result
Type Definitions
-
typedef int32_t (*pfunc_bk_timer_t)(void *pv_arg)