blob: 43df6dc83bf60da62661d8ea97efde3560833386 [file] [log] [blame]
Shad Ansari2f7f9be2017-06-07 13:34:53 -07001/*
2<:copyright-BRCM:2016:DUAL/GPL:standard
3
4 Broadcom Proprietary and Confidential.(c) 2016 Broadcom
5 All Rights Reserved
6
7Unless you and Broadcom execute a separate written software license
8agreement governing use of this software, this software is licensed
9to you under the terms of the GNU General Public License version 2
10(the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
11with the following added to such license:
12
13 As a special exception, the copyright holders of this software give
14 you permission to link this software with independent modules, and
15 to copy and distribute the resulting executable under terms of your
16 choice, provided that you also meet, for each linked independent
17 module, the terms and conditions of the license of that module.
18 An independent module is a module which is not derived from this
19 software. The special exception does not apply to any modifications
20 of the software.
21
22Not withstanding the above, under no circumstances may you combine
23this software in any way with any other Broadcom software provided
24under a license other than the GPL, without Broadcom's express prior
25written consent.
26
27:>
28 */
29
30/*
31 * bcmos_sysif.h
32 *
33 * This internal header file includes OS-specific services
34 * that are referred in OS-independent OS abstraction implementation
35 *
36 */
37
38#ifndef BCMOS_SYSIF_H_
39#define BCMOS_SYSIF_H_
40
41/*
42 * OS-specific init
43 */
44
45/** Initialize system library
46 * Must be called before any other system function
47 * \returns 0=OK or error code <0
48 */
49bcmos_errno bcmos_sys_init(void);
50
51/** Clean-up system library
52 */
53void bcmos_sys_exit(void);
54
55
56/*
57 * Timer support
58 */
59
60/* OS abstraction must define struct bcmos_sys_timer
61 */
62typedef struct bcmos_sys_timer bcmos_sys_timer;
63
64/* System timer handler. Implemented in common OS abstraction services */
65typedef void (*bcmos_sys_timer_handler)(void *data);
66
67/* Create system timer
68 * It is expected that only one high-resolution system timer is needed.
69 * It is used to "kick" timer pool implemented in OS abstraction
70 * \param[in] timer System timer
71 * \param[in] handler Timer handler
72 * \param[in] data Data to be passed to the handler
73 * \returns 0 if OK or error < 0
74 */
75bcmos_errno bcmos_sys_timer_create(bcmos_sys_timer *timer, bcmos_sys_timer_handler handler, void *data);
76
77/* Destroy system timer
78 * \param[in] timer System timer
79 */
80void bcmos_sys_timer_destroy(bcmos_sys_timer *timer);
81
82/* Start system timer
83 * \param[in] timer System timer
84 * \param[in] interval Interval (us)
85 */
86void bcmos_sys_timer_start(bcmos_sys_timer *timer, uint32_t interval);
87
88/* Stop system timer
89 * \param[in] timer System timer
90 */
91void bcmos_sys_timer_stop(bcmos_sys_timer *timer);
92
93#endif /* BCMOS_SYSIF_H_ */