NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
hal_timer.h
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20
28#ifndef H_HAL_TIMER_
29#define H_HAL_TIMER_
30
31#include <inttypes.h>
32#include "../os/queue.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38/* HAL timer callback */
39typedef void (*hal_timer_cb)(void *arg);
40
51struct hal_timer {
53 void *bsp_timer;
55 hal_timer_cb cb_func;
57 void *cb_arg;
59 uint32_t expiry;
60 TAILQ_ENTRY(hal_timer) link; /* Queue linked list structure */
61};
62
70int hal_timer_init(int timer_num, void *cfg);
71
77int hal_timer_deinit(int timer_num);
78
88int hal_timer_config(int timer_num, uint32_t freq_hz);
89
100uint32_t hal_timer_get_resolution(int timer_num);
101
109uint32_t hal_timer_read(int timer_num);
110
119int hal_timer_delay(int timer_num, uint32_t ticks);
120
132int hal_timer_set_cb(int timer_num, struct hal_timer *tmr, hal_timer_cb cb_func,
133 void *arg);
134
143int hal_timer_start(struct hal_timer *tmr, uint32_t ticks);
144
155int hal_timer_start_at(struct hal_timer *tmr, uint32_t tick);
156
162int hal_timer_stop(struct hal_timer *tmr);
163
164#ifdef __cplusplus
165}
166#endif
167
168#endif /* H_HAL_TIMER_ */
169
uint32_t hal_timer_get_resolution(int timer_num)
Definition hal_timer.c:742
int hal_timer_start(struct hal_timer *tmr, uint32_t ticks)
Definition hal_timer.c:843
uint32_t hal_timer_read(int timer_num)
Definition hal_timer.c:768
int hal_timer_set_cb(int timer_num, struct hal_timer *tmr, hal_timer_cb cb_func, void *arg)
Definition hal_timer.c:823
int hal_timer_start_at(struct hal_timer *tmr, uint32_t tick)
Definition hal_timer.c:861
int hal_timer_delay(int timer_num, uint32_t ticks)
Definition hal_timer.c:801
int hal_timer_stop(struct hal_timer *tmr)
Definition hal_timer.c:910
int hal_timer_deinit(int timer_num)
Definition hal_timer.c:697
int hal_timer_init(int timer_num, void *cfg)
Definition hal_timer.c:467
int hal_timer_config(int timer_num, uint32_t freq_hz)
Definition hal_timer.c:566
Definition hal_timer.h:51
void * cb_arg
Definition hal_timer.h:57
void * bsp_timer
Definition hal_timer.h:53
hal_timer_cb cb_func
Definition hal_timer.h:55
uint32_t expiry
Definition hal_timer.h:59