1 /*
2  * Copyright (c) 2021 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #include "test_helpers.h"
7 #include <zephyr/logging/log_internal.h>
8 #include <zephyr/logging/log_ctrl.h>
9 
10 
11 static log_timestamp_t stamp;
12 
timestamp_get(void)13 static log_timestamp_t timestamp_get(void)
14 {
15 	return stamp++;
16 }
17 
z_impl_test_helpers_log_setup(void)18 void z_impl_test_helpers_log_setup(void)
19 {
20 	stamp = 0;
21 	log_core_init();
22 	log_init();
23 	z_log_dropped_read_and_clear();
24 
25 	log_set_timestamp_func(timestamp_get, 0);
26 
27 }
28 
29 #ifdef CONFIG_USERSPACE
z_vrfy_test_helpers_log_setup(void)30 static inline void z_vrfy_test_helpers_log_setup(void)
31 {
32 	z_impl_test_helpers_log_setup();
33 }
34 #include <zephyr/syscalls/test_helpers_log_setup_mrsh.c>
35 #endif
36 
z_impl_test_helpers_cycle_get(void)37 int z_impl_test_helpers_cycle_get(void)
38 {
39 	return arch_k_cycle_get_32();
40 }
41 
42 #ifdef CONFIG_USERSPACE
z_vrfy_test_helpers_cycle_get(void)43 static inline int z_vrfy_test_helpers_cycle_get(void)
44 {
45 	return z_impl_test_helpers_cycle_get();
46 }
47 #include <zephyr/syscalls/test_helpers_cycle_get_mrsh.c>
48 #endif
49 
z_impl_test_helpers_log_dropped_pending(void)50 bool z_impl_test_helpers_log_dropped_pending(void)
51 {
52 	return z_log_dropped_pending();
53 }
54 
55 #ifdef CONFIG_USERSPACE
z_vrfy_test_helpers_log_dropped_pending(void)56 static inline bool z_vrfy_test_helpers_log_dropped_pending(void)
57 {
58 	return z_impl_test_helpers_log_dropped_pending();
59 }
60 #include <zephyr/syscalls/test_helpers_log_dropped_pending_mrsh.c>
61 #endif
62