xref: /btstack/platform/embedded/hal_tick.h (revision 2fca4dad957cd7b88f4657ed51e89c12615dda72)
1a705b1a2SMatthias Ringwald /*
2a705b1a2SMatthias Ringwald  * Copyright (C) 2014 BlueKitchen GmbH
3a705b1a2SMatthias Ringwald  *
4a705b1a2SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5a705b1a2SMatthias Ringwald  * modification, are permitted provided that the following conditions
6a705b1a2SMatthias Ringwald  * are met:
7a705b1a2SMatthias Ringwald  *
8a705b1a2SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9a705b1a2SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10a705b1a2SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11a705b1a2SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12a705b1a2SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13a705b1a2SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14a705b1a2SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15a705b1a2SMatthias Ringwald  *    from this software without specific prior written permission.
16a705b1a2SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
17a705b1a2SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
18a705b1a2SMatthias Ringwald  *    monetary gain.
19a705b1a2SMatthias Ringwald  *
20a705b1a2SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21a705b1a2SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22a705b1a2SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*2fca4dadSMilanka Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
24*2fca4dadSMilanka Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25a705b1a2SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26a705b1a2SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27a705b1a2SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28a705b1a2SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29a705b1a2SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30a705b1a2SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31a705b1a2SMatthias Ringwald  * SUCH DAMAGE.
32a705b1a2SMatthias Ringwald  *
33a705b1a2SMatthias Ringwald  * Please inquire about commercial licensing options at
34a705b1a2SMatthias Ringwald  * [email protected]
35a705b1a2SMatthias Ringwald  *
36a705b1a2SMatthias Ringwald  */
37a705b1a2SMatthias Ringwald 
38a705b1a2SMatthias Ringwald /*
39a705b1a2SMatthias Ringwald  *  hal_tick.h
40a705b1a2SMatthias Ringwald  *
41a705b1a2SMatthias Ringwald  *  Hardware abstraction layer for periodic ticks
42a705b1a2SMatthias Ringwald  *
43a705b1a2SMatthias Ringwald  */
44a705b1a2SMatthias Ringwald 
4580e33422SMatthias Ringwald #ifndef HAL_TICK_H
4680e33422SMatthias Ringwald #define HAL_TICK_H
47a705b1a2SMatthias Ringwald 
48a705b1a2SMatthias Ringwald #include <stdint.h>
49a705b1a2SMatthias Ringwald 
50a705b1a2SMatthias Ringwald #if defined __cplusplus
51a705b1a2SMatthias Ringwald extern "C" {
52a705b1a2SMatthias Ringwald #endif
53a705b1a2SMatthias Ringwald 
54a705b1a2SMatthias Ringwald void hal_tick_init(void);
55a705b1a2SMatthias Ringwald void hal_tick_set_handler(void (*tick_handler)(void));
56a705b1a2SMatthias Ringwald int  hal_tick_get_tick_period_in_ms(void);
57a705b1a2SMatthias Ringwald 
58a705b1a2SMatthias Ringwald #if defined __cplusplus
59a705b1a2SMatthias Ringwald }
60a705b1a2SMatthias Ringwald #endif
6180e33422SMatthias Ringwald #endif // HAL_TICK_H
62