1 /***************************************************************************/ /**
2  * @file  sli_siwx917_timer.h
3  *******************************************************************************
4  * # License
5  * <b>Copyright 2024 Silicon Laboratories Inc. www.silabs.com</b>
6  *******************************************************************************
7  *
8  * SPDX-License-Identifier: Zlib
9  *
10  * The licensor of this software is Silicon Laboratories Inc.
11  *
12  * This software is provided 'as-is', without any express or implied
13  * warranty. In no event will the authors be held liable for any damages
14  * arising from the use of this software.
15  *
16  * Permission is granted to anyone to use this software for any purpose,
17  * including commercial applications, and to alter it and redistribute it
18  * freely, subject to the following restrictions:
19  *
20  * 1. The origin of this software must not be misrepresented; you must not
21  *    claim that you wrote the original software. If you use this software
22  *    in a product, an acknowledgment in the product documentation would be
23  *    appreciated but is not required.
24  * 2. Altered source versions must be plainly marked as such, and must not be
25  *    misrepresented as being the original software.
26  * 3. This notice may not be removed or altered from any source distribution.
27  *
28  ******************************************************************************/
29 
30 #pragma once
31 
32 #include <stdint.h>
33 
34 /******************************************************
35  * *                      Macros
36  * ******************************************************/
37 #define sl_si91x_timer_NODE_0 0
38 
39 /******************************************************
40  * *                 Type Definitions
41  * ******************************************************/
42 
43 typedef struct {
44   uint32_t start_time;
45   uint32_t timeout;
46 } sl_si91x_timer_t;
47 
48 /******************************************************
49  * *               Function Declarations
50  * ******************************************************/
51 void sl_si91x_timer_expiry_interrupt_handler(void);
52 uint32_t sl_si91x_timer_read_counter(void);
53 void sl_si91x_timer_init(sl_si91x_timer_t *timer, uint32_t duration);
54 int32_t sl_si91x_timer_expired(const sl_si91x_timer_t *timer);
55 uint32_t sl_si91x_timer_left(const sl_si91x_timer_t *timer);
56 
57 uint32_t rsi_hal_gettickcount(void);
58