1 /*
2  * Copyright (c) 2024 Trackunit Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/types.h>
8 #include <zephyr/kernel.h>
9 
10 #ifndef ZEPHYR_MODEM_STATS_
11 #define ZEPHYR_MODEM_STATS_
12 
13 /**
14  * @cond INTERNAL_HIDDEN
15  */
16 
17 /** Modem statistics buffer structure */
18 struct modem_stats_buffer {
19 	sys_snode_t node;
20 	char name[CONFIG_MODEM_STATS_BUFFER_NAME_SIZE];
21 	uint32_t max_used;
22 	uint32_t size;
23 };
24 
25 /**
26  * @endcond
27  */
28 
29 /**
30  * @brief Initialize modem statistics buffer
31  *
32  * @param buffer Modem statistics buffer instance
33  * @param name Name of buffer instance
34  * @param size Size of buffer
35  */
36 void modem_stats_buffer_init(struct modem_stats_buffer *buffer,
37 			     const char *name, uint32_t size);
38 
39 /**
40  * @brief Advertise modem statistics buffer size
41  *
42  * @param buffer Modem statistics buffer instance
43  * @param length Length of buffer
44  *
45  * @note Invoke when buffer size changes
46  * @note Safe to invoke from ISR
47  */
48 void modem_stats_buffer_advertise_length(struct modem_stats_buffer *buffer, uint32_t length);
49 
50 #endif /* ZEPHYR_MODEM_STATS_ */
51