2017-06-15 10:31:06 +02:00
|
|
|
/**
|
|
|
|
* @file dummy.c
|
|
|
|
* Static compilation checks.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 Nordic Semiconductor ASA
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2024-04-10 21:37:51 +02:00
|
|
|
#include <stdalign.h>
|
|
|
|
|
includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.
The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.
NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-25 09:58:46 +02:00
|
|
|
#include <zephyr/kernel.h>
|
2022-05-06 11:12:04 +02:00
|
|
|
#include <zephyr/bluetooth/bluetooth.h>
|
2024-07-08 14:52:07 +02:00
|
|
|
#include <zephyr/bluetooth/buf.h>
|
2021-09-29 14:54:51 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The unpacked structs below are used inside __packed structures that reflect
|
|
|
|
* what goes on the wire. While alignment is not a problem for those, since all
|
|
|
|
* their members are bytes or byte arrays, the size is. They must not be padded
|
|
|
|
* by the compiler, otherwise the on-wire packet will not map the packed
|
|
|
|
* structure correctly.
|
2024-04-10 21:37:51 +02:00
|
|
|
*
|
|
|
|
* The bt_addr structs are not marked __packed because it's considered ugly by
|
|
|
|
* some. But here is a proof that the structs have all the properties of, and
|
|
|
|
* can be safely used as packed structs.
|
2021-09-29 14:54:51 +02:00
|
|
|
*/
|
|
|
|
BUILD_ASSERT(sizeof(bt_addr_t) == BT_ADDR_SIZE);
|
2024-04-10 21:37:51 +02:00
|
|
|
BUILD_ASSERT(alignof(bt_addr_t) == 1);
|
2021-09-29 14:54:51 +02:00
|
|
|
BUILD_ASSERT(sizeof(bt_addr_le_t) == BT_ADDR_LE_SIZE);
|
2024-04-10 21:37:51 +02:00
|
|
|
BUILD_ASSERT(alignof(bt_addr_le_t) == 1);
|
2017-06-15 10:31:06 +02:00
|
|
|
|
2018-10-04 13:44:33 +02:00
|
|
|
#if defined(CONFIG_BT_HCI_HOST)
|
2020-08-19 17:16:01 +02:00
|
|
|
/* The Bluetooth subsystem requires that higher priority events shall be given
|
|
|
|
* in a priority higher than the Bluetooth Host's Tx and the Controller's
|
|
|
|
* receive thread priority.
|
2017-07-11 09:47:08 +02:00
|
|
|
* This is required in order to dispatch Number of Completed Packets event
|
|
|
|
* before any new data arrives on a connection to the Host threads.
|
|
|
|
*/
|
2020-08-19 17:16:01 +02:00
|
|
|
BUILD_ASSERT(CONFIG_BT_DRIVER_RX_HIGH_PRIO < CONFIG_BT_HCI_TX_PRIO);
|
|
|
|
#endif /* defined(CONFIG_BT_HCI_HOST) */
|
2019-10-01 14:21:27 +02:00
|
|
|
|
2020-08-31 15:33:36 +02:00
|
|
|
#if (defined(CONFIG_LOG_BACKEND_RTT) && \
|
|
|
|
(defined(CONFIG_SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL) || \
|
|
|
|
defined(CONFIG_LOG_BACKEND_RTT_MODE_BLOCK))) || \
|
|
|
|
defined(CONFIG_LOG_BACKEND_NET) || \
|
|
|
|
defined(CONFIG_LOG_IMMEDIATE_CLEAN_OUTPUT)
|
|
|
|
#define INCOMPATIBLE_IMMEDIATE_LOG_BACKEND 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Immediate logging on most backend is not supported
|
|
|
|
* with the software-based Link Layer since it introduces ISR latency
|
|
|
|
* due to outputting log messages with interrupts disabled.
|
2019-10-01 14:21:27 +02:00
|
|
|
*/
|
|
|
|
#if !defined(CONFIG_TEST) && !defined(CONFIG_ARCH_POSIX) && \
|
2020-08-31 15:33:36 +02:00
|
|
|
defined(CONFIG_BT_LL_SW_SPLIT) && \
|
|
|
|
defined(INCOMPATIBLE_IMMEDIATE_LOG_BACKEND)
|
2022-01-12 15:52:48 +01:00
|
|
|
BUILD_ASSERT(!IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE), "Immediate logging "
|
2020-08-31 15:33:36 +02:00
|
|
|
"on selected backend(s) not "
|
2020-03-12 17:16:00 +02:00
|
|
|
"supported with the software Link Layer");
|
2019-10-01 14:21:27 +02:00
|
|
|
#endif
|