1/*
2 * Copyright (C) 2015, Broadcom Corporation. All Rights Reserved.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 *
16 * Low resolution timer interface. Timer handlers may be called
17 * in a deferred manner in a different task context after the
18 * timer expires or in the task context from which the timer
19 * was created, depending on the implementation.
20 *
21 * $Id: bcmtimer.h 241182 2011-02-17 21:50:03Z $
22 */
23#ifndef __bcmtimer_h__
24#define __bcmtimer_h__
25
26/* ANSI headers */
27#include <time.h>
28
29/* timer ID */
30typedef unsigned int bcm_timer_module_id;
31typedef unsigned int bcm_timer_id;
32
33/* timer callback */
34typedef void (*bcm_timer_cb)(bcm_timer_id id, int data);
35
36/* OS-independant interfaces, applications should call these functions only */
37int bcm_timer_module_init(int timer_entries, bcm_timer_module_id *module_id);
38int bcm_timer_module_cleanup(bcm_timer_module_id module_id);
39int bcm_timer_module_enable(bcm_timer_module_id module_id, int enable);
40int bcm_timer_create(bcm_timer_module_id module_id, bcm_timer_id *timer_id);
41int bcm_timer_delete(bcm_timer_id timer_id);
42int bcm_timer_gettime(bcm_timer_id timer_id, struct itimerspec *value);
43int bcm_timer_settime(bcm_timer_id timer_id, const struct itimerspec *value);
44int bcm_timer_connect(bcm_timer_id timer_id, bcm_timer_cb func, int data);
45int bcm_timer_cancel(bcm_timer_id timer_id);
46int bcm_timer_change_expirytime(bcm_timer_id timer_id, const struct itimerspec *timer_spec);
47
48#endif	/* #ifndef __bcmtimer_h__ */
49