zephyr/subsys/bluetooth/controller/ll_sw/ll_settings.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

97 lines
2.1 KiB
C

/*
* Copyright (c) 2019 Oticon A/S
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include <zephyr/settings/settings.h>
#include <zephyr/bluetooth/bluetooth.h>
#include "ll_settings.h"
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(bt_ctlr_ll_settings, LOG_LEVEL_DBG);
#include "hal/debug.h"
#if defined(CONFIG_BT_CTLR_VERSION_SETTINGS)
static uint16_t company_id = CONFIG_BT_CTLR_COMPANY_ID;
static uint16_t subversion = CONFIG_BT_CTLR_SUBVERSION_NUMBER;
uint16_t ll_settings_company_id(void)
{
return company_id;
}
uint16_t ll_settings_subversion_number(void)
{
return subversion;
}
#endif /* CONFIG_BT_CTLR_VERSION_SETTINGS */
#if defined(CONFIG_BT_CTLR_SMI_TX_SETTING)
static uint8_t smi_tx;
bool ll_settings_smi_tx(void)
{
return smi_tx;
}
#endif /* CONFIG_BT_CTLR_SMI_TX_SETTING */
static int ctlr_set(const char *name, size_t len_rd,
settings_read_cb read_cb, void *store)
{
ssize_t len;
int nlen;
const char *next;
nlen = settings_name_next(name, &next);
#if defined(CONFIG_BT_CTLR_VERSION_SETTINGS)
if (!strncmp(name, "company", nlen)) {
len = read_cb(store, &company_id, sizeof(company_id));
if (len < 0) {
LOG_ERR("Failed to read Company Id from storage"
" (err %zd)", len);
} else {
LOG_DBG("Company Id set to %04x", company_id);
}
return 0;
}
if (!strncmp(name, "subver", nlen)) {
len = read_cb(store, &subversion, sizeof(subversion));
if (len < 0) {
LOG_ERR("Failed to read Subversion from storage"
" (err %zd)", len);
} else {
LOG_DBG("Subversion set to %04x", subversion);
}
return 0;
}
#endif /* CONFIG_BT_CTLR_VERSION_SETTINGS */
#if defined(CONFIG_BT_CTLR_SMI_TX_SETTING)
if (!strncmp(name, "smi_tx", nlen)) {
len = read_cb(store, &smi_tx, sizeof(smi_tx));
if (len < 0) {
LOG_ERR("Failed to read SMI TX flag from storage"
" (err %zd)", len);
} else {
LOG_DBG("SMI TX flag set to %04x", smi_tx);
}
return 0;
}
#endif /* CONFIG_BT_CTLR_SMI_TX_SETTING */
return 0;
}
SETTINGS_STATIC_HANDLER_DEFINE(bt_ctlr, "bt/ctlr", NULL, ctlr_set, NULL, NULL);