zephyr/subsys/bluetooth/controller/ll_sw/ll_feat.c
Théo Battrel e458f5aae6 Bluetooth: Use Zephyr standard log system instead of bluetooth/common/log
The `bluetooth/common/log.h` and `bluetooth/common/log.c` files have been
removed. Files that were using them have been updated to use
`zephyr/logging/log.h` instead.

Those replacement have been done consequently:
- `/BT_DBG/LOG_DBG/`
- `/BT_ERR/LOG_ERR/`
- `/BT_WARN/LOG_WRN/`
- `/BT_INFO/LOG_INF/`
- `/BT_HEXDUMP_DBG/LOG_HEXDUMP_DBG/`
- `/BT_DBG_OBJ_ID/LOG_DBG_OBJ_ID/`

Also, some files were relying on the `common/log.h` include to include
`zephyr/bluetooth/hci.h`, in those cases the include of `hci.h` has
been added.

For files that were including `common/log.h` but not using any logs,
the include has been removed and not replaced.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2022-11-25 17:08:36 +01:00

83 lines
1.7 KiB
C

/*
* Copyright (c) 2021 Nordic Semiconductor ASA
* Copyright (c) 2020 Demant
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include "util/util.h"
#include "util/memq.h"
#include "util/dbuf.h"
#include "hal/ccm.h"
#include "pdu.h"
#include "lll.h"
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "ull_conn_internal.h"
#include "ll_feat.h"
#include "ll_settings.h"
#include <zephyr/bluetooth/hci.h>
#include "hal/debug.h"
#if defined(CONFIG_BT_CTLR_SET_HOST_FEATURE)
static uint64_t host_features;
uint8_t ll_set_host_feature(uint8_t bit_number, uint8_t bit_value)
{
uint64_t feature;
/* Check if Bit_Number is not controlled by the Host */
feature = BIT64(bit_number);
if (!(feature & LL_FEAT_HOST_BIT_MASK)) {
return BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL;
}
#if defined(CONFIG_BT_CONN)
/* Check if the Controller has an established ACL */
uint16_t conn_free_count = ll_conn_free_count_get();
/* Check if any connection contexts where allocated */
if (conn_free_count != CONFIG_BT_MAX_CONN) {
uint16_t handle;
/* Check if there are established connections */
for (handle = 0U; handle < CONFIG_BT_MAX_CONN; handle++) {
if (ll_connected_get(handle)) {
return BT_HCI_ERR_CMD_DISALLOWED;
}
}
}
#endif /* CONFIG_BT_CONN */
/* Set or Clear the Host feature bit */
if (bit_value) {
host_features |= feature;
} else {
host_features &= ~feature;
}
return BT_HCI_ERR_SUCCESS;
}
uint64_t ll_feat_get(void)
{
return LL_FEAT | (host_features & LL_FEAT_HOST_BIT_MASK);
}
#else /* !CONFIG_BT_CTLR_SET_HOST_FEATURE */
uint64_t ll_feat_get(void)
{
return LL_FEAT;
}
#endif /* !CONFIG_BT_CTLR_SET_HOST_FEATURE */