1 /*
2  * Common functions and helpers for MTU Update test
3  *
4  * Copyright (c) 2022 Nordic Semiconductor ASA
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  */
8 
9 #include <stddef.h>
10 
11 #include "bs_types.h"
12 #include "bs_tracing.h"
13 #include "bstests.h"
14 
15 #define FAIL(...)					\
16 	do {						\
17 		bst_result = Failed;			\
18 		bs_trace_error_time_line(__VA_ARGS__);	\
19 	} while (0)
20 
21 #define PASS(...)					\
22 	do {						\
23 		bst_result = Passed;			\
24 		bs_trace_info_time(1, __VA_ARGS__);	\
25 	} while (0)
26 
27 extern enum bst_result_t bst_result;
28 
29 #define CREATE_FLAG(flag) static atomic_t flag = (atomic_t)false
30 #define SET_FLAG(flag) (void)atomic_set(&flag, (atomic_t)true)
31 #define WAIT_FOR_FLAG(flag)                                                                        \
32 	while (!(bool)atomic_get(&flag)) {                                                         \
33 		(void)k_sleep(K_MSEC(1));                                                          \
34 	}
35 
36 #define WAIT_TIME (20e6) /* 20 seconds */
37 #define PERIPHERAL_NOTIFY_TIME ((WAIT_TIME - 10e6) / 1e6)
38