1 /**
2  * @file dummy.c
3  * Static compilation checks.
4  */
5 
6 /*
7  * Copyright (c) 2017 Nordic Semiconductor ASA
8  *
9  * SPDX-License-Identifier: Apache-2.0
10  */
11 
12 #include <stdalign.h>
13 
14 #include <zephyr/kernel.h>
15 #include <zephyr/bluetooth/bluetooth.h>
16 #include <zephyr/bluetooth/buf.h>
17 
18 /*
19  * The unpacked structs below are used inside __packed structures that reflect
20  * what goes on the wire. While alignment is not a problem for those, since all
21  * their members are bytes or byte arrays, the size is. They must not be padded
22  * by the compiler, otherwise the on-wire packet will not map the packed
23  * structure correctly.
24  *
25  * The bt_addr structs are not marked __packed because it's considered ugly by
26  * some. But here is a proof that the structs have all the properties of, and
27  * can be safely used as packed structs.
28  */
29 BUILD_ASSERT(sizeof(bt_addr_t) == BT_ADDR_SIZE);
30 BUILD_ASSERT(alignof(bt_addr_t) == 1);
31 BUILD_ASSERT(sizeof(bt_addr_le_t) == BT_ADDR_LE_SIZE);
32 BUILD_ASSERT(alignof(bt_addr_le_t) == 1);
33 
34 #if defined(CONFIG_BT_HCI_HOST)
35 /* The Bluetooth subsystem requires that higher priority events shall be given
36  * in a priority higher than the Bluetooth Host's Tx and the Controller's
37  * receive thread priority.
38  * This is required in order to dispatch Number of Completed Packets event
39  * before any new data arrives on a connection to the Host threads.
40  */
41 BUILD_ASSERT(CONFIG_BT_DRIVER_RX_HIGH_PRIO < CONFIG_BT_HCI_TX_PRIO);
42 #endif /* defined(CONFIG_BT_HCI_HOST) */
43 
44 #if (defined(CONFIG_LOG_BACKEND_RTT) &&                     \
45      (defined(CONFIG_SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL) || \
46       defined(CONFIG_LOG_BACKEND_RTT_MODE_BLOCK))) ||       \
47     defined(CONFIG_LOG_BACKEND_NET) ||                      \
48     defined(CONFIG_LOG_IMMEDIATE_CLEAN_OUTPUT)
49 #define INCOMPATIBLE_IMMEDIATE_LOG_BACKEND 1
50 #endif
51 
52 /* Immediate logging on most backend is not supported
53  * with the software-based Link Layer since it introduces ISR latency
54  * due to outputting log messages with interrupts disabled.
55  */
56 #if !defined(CONFIG_TEST) && !defined(CONFIG_ARCH_POSIX) && \
57     defined(CONFIG_BT_LL_SW_SPLIT) &&                       \
58     defined(INCOMPATIBLE_IMMEDIATE_LOG_BACKEND)
59 BUILD_ASSERT(!IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE), "Immediate logging "
60 	     "on selected backend(s) not "
61 	     "supported with the software Link Layer");
62 #endif
63