From d8ea8e3d1fc20a7bc7c05c94e42e85181b41f4b5 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Mon, 19 Jun 2023 15:41:48 +0200 Subject: [PATCH] nimble: improve integration with NuttX 1. add Makefile.nimble that helps integrate NimBLE with custom applications To enable NimBLE for an custom application, user needs to include Makefile.nimble in the app's Makefile: include $(APPDIR)/wireless/bluetooth/nimble/Makefile.nimble 2. add NuttX specific syscfg.h - file based on nimble/porting/examples/nuttx/include/syscfg/syscfg.h - all unnecessary definitions was removed - definitions are configurable from Kconfig 3. add NuttX specific logcfg.h - bind NimBLE logging with debug.h macros --- wireless/bluetooth/nimble/Kconfig | 206 +++++++++++- wireless/bluetooth/nimble/Makefile | 4 +- wireless/bluetooth/nimble/Makefile.nimble | 69 ++++ .../bluetooth/nimble/include/logcfg/logcfg.h | 66 ++++ .../bluetooth/nimble/include/syscfg/syscfg.h | 306 ++++++++++++++++++ 5 files changed, 645 insertions(+), 6 deletions(-) create mode 100644 wireless/bluetooth/nimble/Makefile.nimble create mode 100644 wireless/bluetooth/nimble/include/logcfg/logcfg.h create mode 100644 wireless/bluetooth/nimble/include/syscfg/syscfg.h diff --git a/wireless/bluetooth/nimble/Kconfig b/wireless/bluetooth/nimble/Kconfig index d8f45006c..975e4723d 100644 --- a/wireless/bluetooth/nimble/Kconfig +++ b/wireless/bluetooth/nimble/Kconfig @@ -1,9 +1,9 @@ config NIMBLE - bool "Apache nimBLE (BLE host-layer)" + bool "Apache NimBLE (BLE host-layer)" default n depends on !WIRELESS_BLUETOOTH_HOST ---help--- - Enable Apache nimBLE Bluetooth Low Energy + Enable Apache NimBLE Bluetooth Low Energy host-layer stack. if NIMBLE @@ -12,10 +12,208 @@ config NIMBLE_REF string "Version" default "bc7828341226d860429c63994065f8f1b8b8d7b0" ---help--- - Git ref name to use when downloading from nimBLE repo + Git ref name to use when downloading from NimBLE repo + +if DEBUG_FEATURES + +config NIMBLE_DEBUG_ERROR + bool "Apache NimBLE error output" + default n + depends on DEBUG_ERROR + +config NIMBLE_DEBUG_WARN + bool "Apache NimBLE warnings output" + default n + depends on DEBUG_ERROR + +config NIMBLE_DEBUG_INFO + bool "Apache NimBLE informational debug output" + default n + depends on DEBUG_INFO + +endif # DEBUG_FEATURES + +config NIMBLE_TINYCRYPT + bool "Apache NimBLE tinycrypt support" + default y + +config NIMBLE_MESH + bool "Apache NimBLE mesh support" + default n + depends on EXPERIMENTAL + +menu "NimBLE role configuration" + +config NIMBLE_ROLE_BROADCASTER + bool "NimBLE broadcaster role" + default n + +config NIMBLE_ROLE_CENTRAL + bool "NimBLE central role" + default n + +config NIMBLE_ROLE_OBSERVER + bool "NimBLE observer role" + default n + +config NIMBLE_ROLE_PERIPHERAL + bool "NimBLE peripheral role" + default n + +endmenu # "NimBLE role configuration" + +choice + prompt "NimBLE BLE version" + default NIMBLE_BLE_VERSION_50 + +config NIMBLE_BLE_VERSION_50 + bool "NimBLE BLE version 5.0" + +config NIMBLE_BLE_VERSION_51 + bool "NimBLE BLE version 5.1" + +config NIMBLE_BLE_VERSION_52 + bool "NimBLE BLE version 5.2" + +config NIMBLE_BLE_VERSION_53 + bool "NimBLE BLE version 5.3" + +endchoice # "NimBLE BLE version" + +config NIMBLE_BLE_VERSION + int + default 50 if NIMBLE_BLE_VERSION_50 + default 51 if NIMBLE_BLE_VERSION_51 + default 52 if NIMBLE_BLE_VERSION_52 + default 53 if NIMBLE_BLE_VERSION_53 + +menu "NimBLE BLE features" + +config NIMBLE_BLE_SUBRATING + bool "NimBLE connection subrating support" + default n + +config NIMBLE_BLE_EXT_ADV + bool "NimBLE extended advertising support" + default n + +config NIMBLE_BLE_EXT_ADV_MAX_SIZE + int "NimBLE extended advertising maximum size" + depends on NIMBLE_BLE_EXT_ADV + range 31 1650 + default 31 + +config NIMBLE_BLE_MAX_CONN + int "NimBLE maximum number of connections" + default 1 + +config NIMBLE_BLE_MAX_PERIODIC_SYNCS + int "NimBLE maximum number of period syncs" + default 1 + +config NIMBLE_BLE_MULTI_ADV_INSTANCES + int "NimBLE number of multi-advertising instances" + default 0 + ---help--- + The total number of advertising instances is this number plus 1 + +config NIMBLE_BLE_PERIODIC_ADV + bool "NimBLE periodic advertising support" + default n + +config NIMBLE_BLE_PERIODIC_ADV_SYNC_TRANSFER + int "NimBLE periodic advertising sync transfer support" + depends on NIMBLE_BLE_PERIODIC_ADV && NIMBLE_BLE_VERSION > 50 + default 0 + +config NIMBLE_BLE_POWER_CONTROL + bool "NimBLE BLE LE power control support" + depends on NIMBLE_BLE_VERSION > 51 + default n + +config NIMBLE_BLE_WHITELIST + bool "NimBLE BLE whitelist support" + default n + +endmenu # "NimBLE BLE features" + +menu "NimBLE BLE Host configuration" + +config NIMBLE_HS_FLOW_CTRL + bool "NimBLE Host flow control enable" + default n + +endmenu # "NimBLE BLE Host configuration" + +config NIMBLE_BLE_ATT_PREFFERED_MTU + int "NimBLE preferred MTU size" + default 256 + +config NIMBLE_L2CAP_COC_MAX_NUM + int "NimBLE maximum number of connection oriented channels" + range 0 9 + default 0 + ---help--- + When set to 0, BLE COC is disabled + +menu "NimBLE BLE privacy and security settings" + +config NIMBLE_BLE_RPA_TIMEOUT + int "NimBLE BLE RPA timeout" + default 300 + ---help--- + The rate that new random addresses should be generated (seconds) + +config NIMBLE_BLE_SM_BONDING + bool "NimBLE BLE bonding enable" + default y + ---help--- + Enables bonding (persistence and restoration of secure links) + +config NIMBLE_BLE_SM_LEGACY + bool "NimBLE security manager legacy pairing" + default y + +config NIMBLE_BLE_SM_SC + bool "NimBLE security manager secure connections" + default y + +if NIMBLE_BLE_SM_SC + +config NIMBLE_BLE_SM_SC_DEBUG + bool "NimBLE secure connections debug mode" + default n + +config NIMBLE_BLE_SM_SC_ONLY + bool "NimBLE secure connections pairing only" + default n + +endif # NIMBLE_BLE_SM_SC + +endmenu # "NimBLE BLE security manager settings" + +menu "NimBLE memory configuration" + +config NIMBLE_MSYS_1_BLOCK_COUNT + int "NimBLE MSYS_1 block count" + default 12 + +config NIMBLE_MSYS_1_BLOCK_SIZE + int "NimBLE MSYS_1 block size" + default 292 + +config NIMBLE_MSYS_2_BLOCK_COUNT + int "NimBLE MSYS_2 block count" + default 0 + +config NIMBLE_MSYS_2_BLOCK_SIZE + int "NimBLE MSYS_2 block size" + default 0 + +endmenu # "NimBLE memory configuration" config NIMBLE_PORTING_EXAMPLE - bool "Apache nimBLE NuttX porting example" + bool "Apache NimBLE NuttX porting example" default y if NIMBLE_PORTING_EXAMPLE diff --git a/wireless/bluetooth/nimble/Makefile b/wireless/bluetooth/nimble/Makefile index db768db9f..5aba9a4be 100644 --- a/wireless/bluetooth/nimble/Makefile +++ b/wireless/bluetooth/nimble/Makefile @@ -27,13 +27,13 @@ NIMBLE_TAR := $(CONFIG_NIMBLE_REF).tar.gz NIMBLE_URL := https://github.com/apache/mynewt-nimble/archive/$(NIMBLE_TAR) ifneq ($(CONFIG_NIMBLE_PORTING_EXAMPLE),) -# Nimble porting example built-in application +# NimBLE porting example built-in application -include $(NIMBLE_ROOT)/porting/examples/nuttx/Make.defs PRIORITY = 255 STACKSIZE = $(CONFIG_NIMBLE_PORTING_EXAMPLE_STACKSIZE) -# nimBLE assumes this flag since it expects undefined macros to be zero value +# NimBLE assumes this flag since it expects undefined macros to be zero value CFLAGS += -Wno-pointer-to-int-cast -Wno-undef endif diff --git a/wireless/bluetooth/nimble/Makefile.nimble b/wireless/bluetooth/nimble/Makefile.nimble new file mode 100644 index 000000000..84f7cb5af --- /dev/null +++ b/wireless/bluetooth/nimble/Makefile.nimble @@ -0,0 +1,69 @@ +############################################################################ +# apps/wireless/bluetooth/nimble/Makefile.nimble +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +NIMBLE_ROOT = $(APPDIR)/wireless/bluetooth/nimble/mynewt-nimble + +# Configure NimBLE variables + +ifneq ($(CONFIG_NIMBLE_TINYCRYPT),) +NIMBLE_CFG_TINYCRYPT = 1 +endif + +ifneq ($(CONFIG_NIMBLE_MESH),) +NIMBLE_CFG_MESH = 1 +endif + +# Skip files that don't build for this port + +NIMBLE_IGNORE += $(NIMBLE_ROOT)/porting/nimble/src/hal_timer.c +NIMBLE_IGNORE += $(NIMBLE_ROOT)/porting/nimble/src/os_cputime.c +NIMBLE_IGNORE += $(NIMBLE_ROOT)/porting/nimble/src/os_cputime_pwr2.c + +# include NimBLE porting defs + +include $(NIMBLE_ROOT)/porting/nimble/Makefile.defs + +CSRCS += $(NIMBLE_SRC) + +# Source files for NPL OSAL + +CSRCS += $(wildcard $(NIMBLE_ROOT)/porting/npl/nuttx/src/*.c) +CSRCS += $(wildcard $(NIMBLE_ROOT)/nimble/transport/socket/src/*.c) +CSRCS += $(TINYCRYPT_SRC) + +# Add NPL and all NimBLE directories to include paths + +NIMBLE_ALL_INC = $(APPDIR)/wireless/bluetooth/nimble/include +NIMBLE_ALL_INC += $(NIMBLE_ROOT)/porting/npl/nuttx/include +NIMBLE_ALL_INC += $(NIMBLE_ROOT)/nimble/transport/socket/include +NIMBLE_ALL_INC += $(NIMBLE_ROOT)/nimble/include +NIMBLE_ALL_INC += $(NIMBLE_INCLUDE) +NIMBLE_ALL_INC += $(TINYCRYPT_INCLUDE) + +CFLAGS += $(addprefix ${INCDIR_PREFIX}, $(NIMBLE_ALL_INC)) +CXXFLAGS += $(addprefix ${INCDIR_PREFIX}, $(NIMBLE_ALL_INC)) + +# NimBLE assumes this flag since it expects undefined macros to be zero value + +CFLAGS += -Wno-pointer-to-int-cast -Wno-undef + +# disable printf format checks + +CFLAGS += -Wno-format diff --git a/wireless/bluetooth/nimble/include/logcfg/logcfg.h b/wireless/bluetooth/nimble/include/logcfg/logcfg.h new file mode 100644 index 000000000..458ea624c --- /dev/null +++ b/wireless/bluetooth/nimble/include/logcfg/logcfg.h @@ -0,0 +1,66 @@ +/**************************************************************************** + * apps/wireless/bluetooth/nimble/include/logcfg/logcfg.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __APPS_WIRELESS_BLUETOOTH_NIMBLE_INCLUDE_LOGCFG_LOGCFG_H +#define __APPS_WIRELESS_BLUETOOTH_NIMBLE_INCLUDE_LOGCFG_LOGCFG_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifdef CONFIG_NIMBLE_DEBUG_ERROR +# define nimble_err _err +#else +# define nimble_err _none +#endif + +#ifdef CONFIG_NIMBLE_DEBUG_WARN +# define nimble_warn _warn +#else +# define nimble_warn _none +#endif + +#ifdef CONFIG_NIMBLE_DEBUG_INFO +# define nimble_info _info +#else +# define nimble_info _none +#endif + +#define BLE_HS_LOG_DEBUG(msg, ...) nimble_info(msg, ##__VA_ARGS__) +#define BLE_HS_LOG_INFO(msg, ...) nimble_info(msg, ##__VA_ARGS__) +#define BLE_HS_LOG_WARN(msg, ...) nimble_warn(msg, ##__VA_ARGS__) +#define BLE_HS_LOG_ERROR(msg, ...) nimble_err(msg, ##__VA_ARGS__) +#define BLE_HS_LOG_CRITICAL(msg, ...) nimble_err(msg, ##__VA_ARGS__) +#define BLE_HS_LOG_DISABLED(msg, ...) nimble_err(msg, ##__VA_ARGS__) + +#define DFLT_LOG_DEBUG(msg, ...) nimble_info(msg, ##__VA_ARGS__) +#define DFLT_LOG_INFO(msg, ...) nimble_info(msg, ##__VA_ARGS__) +#define DFLT_LOG_WARN(msg, ...) nimble_warn(msg, ##__VA_ARGS__) +#define DFLT_LOG_ERROR(msg, ...) nimble_err(msg, ##__VA_ARGS__) +#define DFLT_LOG_CRITICAL(msg, ...) nimble_err(msg, ##__VA_ARGS__) +#define DFLT_LOG_DISABLED(msg, ...) nimble_err(msg, ##__VA_ARGS__) + +#endif /* __APPS_WIRELESS_BLUETOOTH_NIMBLE_INCLUDE_LOGCFG_LOGCFG_H */ diff --git a/wireless/bluetooth/nimble/include/syscfg/syscfg.h b/wireless/bluetooth/nimble/include/syscfg/syscfg.h new file mode 100644 index 000000000..9be9a5eec --- /dev/null +++ b/wireless/bluetooth/nimble/include/syscfg/syscfg.h @@ -0,0 +1,306 @@ +/**************************************************************************** + * apps/wireless/bluetooth/nimble/include/syscfg/syscfg.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __APPS_WIRELESS_BLUETOOTH_NIMBLE_INCLUDE_SYSCFG_SYSCFG_H +#define __APPS_WIRELESS_BLUETOOTH_NIMBLE_INCLUDE_SYSCFG_SYSCFG_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Macros used by NimBLE ****************************************************/ + +#define MYNEWT_VAL(_name) MYNEWT_VAL_ ## _name +#define MYNEWT_VAL_CHOICE(_name, _val) MYNEWT_VAL_ ## _name ## __ ## _val + +/* NimBLE NuttX specific configuration **************************************/ + +#define MYNEWT_VAL_BLE_SOCK_USE_NUTTX (1) +#define MYNEWT_VAL_NEWT_FEATURE_LOGCFG (1) + +/* NimBLE user specific configuration ***************************************/ + +#define MYNEWT_VAL_MSYS_1_BLOCK_COUNT (CONFIG_NIMBLE_MSYS_1_BLOCK_COUNT) +#define MYNEWT_VAL_MSYS_1_BLOCK_SIZE (CONFIG_NIMBLE_MSYS_1_BLOCK_SIZE) +#define MYNEWT_VAL_MSYS_2_BLOCK_COUNT (CONFIG_NIMBLE_MSYS_2_BLOCK_COUNT) +#define MYNEWT_VAL_MSYS_2_BLOCK_SIZE (CONFIG_NIMBLE_MSYS_2_BLOCK_SIZE) + +/* MSYS sanity check not supported */ + +#define MYNEWT_VAL_MSYS_1_SANITY_MIN_COUNT (0) +#define MYNEWT_VAL_MSYS_2_SANITY_MIN_COUNT (0) + +/* Transport configuration */ + +#define MYNEWT_VAL_BLE_TRANSPORT_ACL_FROM_HS_COUNT (10) +#define MYNEWT_VAL_BLE_TRANSPORT_ACL_FROM_LL_COUNT (0) +#define MYNEWT_VAL_BLE_TRANSPORT_ACL_SIZE (251) +#define MYNEWT_VAL_BLE_TRANSPORT_EVT_COUNT (4) +#define MYNEWT_VAL_BLE_TRANSPORT_EVT_DISCARDABLE_COUNT (16) +#define MYNEWT_VAL_BLE_TRANSPORT_EVT_SIZE (70) + +/* L2CAP configuration */ + +#define MYNEWT_VAL_BLE_L2CAP_COC_MAX_NUM (CONFIG_NIMBLE_L2CAP_COC_MAX_NUM) +#define MYNEWT_VAL_BLE_L2CAP_COC_MPS (MYNEWT_VAL_MSYS_1_BLOCK_SIZE-8) +#define MYNEWT_VAL_BLE_L2CAP_COC_SDU_BUFF_COUNT (1) +#define MYNEWT_VAL_BLE_L2CAP_ENHANCED_COC (0) +#define MYNEWT_VAL_BLE_L2CAP_JOIN_RX_FRAGS (1) +#define MYNEWT_VAL_BLE_L2CAP_MAX_CHANS (3*MYNEWT_VAL_BLE_MAX_CONNECTIONS) +#define MYNEWT_VAL_BLE_L2CAP_RX_FRAG_TIMEOUT (30000) +#define MYNEWT_VAL_BLE_L2CAP_SIG_MAX_PROCS (1) + +/* Host configuration */ + +#define MYNEWT_VAL_BLE_HOST (1) +#define MYNEWT_VAL_BLE_HS_AUTO_START (1) +#define MYNEWT_VAL_BLE_HS_DEBUG (0) + +#ifdef CONFIG_NIMBLE_HS_FLOW_CTRL +# define MYNEWT_VAL_BLE_HS_FLOW_CTRL (1) +# define MYNEWT_VAL_BLE_HS_FLOW_CTRL_ITVL (1000) +# define MYNEWT_VAL_BLE_HS_FLOW_CTRL_THRESH (2) +# define MYNEWT_VAL_BLE_HS_FLOW_CTRL_TX_ON_DISCONNECT (0) +#else +# define MYNEWT_VAL_BLE_HS_FLOW_CTRL (0) +#endif + +#define MYNEWT_VAL_BLE_HS_PHONY_HCI_ACKS (0) +#define MYNEWT_VAL_BLE_HS_REQUIRE_OS (1) +#define MYNEWT_VAL_BLE_HS_STOP_ON_SHUTDOWN (1) +#define MYNEWT_VAL_BLE_HS_STOP_ON_SHUTDOWN_TIMEOUT (2000) + +/* BLE role configuration */ + +#ifdef CONFIG_NIMBLE_ROLE_BROADCASTER +# define MYNEWT_VAL_BLE_ROLE_BROADCASTER (1) +#else +# define MYNEWT_VAL_BLE_ROLE_BROADCASTER (0) +#endif + +#ifdef CONFIG_NIMBLE_ROLE_CENTRAL +# define MYNEWT_VAL_BLE_ROLE_CENTRAL (1) +#else +# define MYNEWT_VAL_BLE_ROLE_CENTRAL (0) +#endif + +#ifdef CONFIG_NIMBLE_ROLE_OBSERVER +# define MYNEWT_VAL_BLE_ROLE_OBSERVER (1) +#else +# define MYNEWT_VAL_BLE_ROLE_OBSERVER (0) +#endif + +#ifdef CONFIG_NIMBLE_ROLE_PERIPHERAL +# define MYNEWT_VAL_BLE_ROLE_PERIPHERAL (1) +#else +# define MYNEWT_VAL_BLE_ROLE_PERIPHERAL (0) +#endif + +/* BLE features */ + +#ifdef CONFIG_NIMBLE_MESH +# define MYNEWT_VAL_BLE_MESH (1) +#else +# define MYNEWT_VAL_BLE_MESH (0) +#endif + +#ifdef CONFIG_NIMBLE_BLE_CONN_SUBRATING +# define MYNEWT_VAL_BLE_CONN_SUBRATING (1) +#else +# define MYNEWT_VAL_BLE_CONN_SUBRATING (0) +#endif + +#ifdef CONFIG_NIMBLE_BLE_EXT_ADV +# define MYNEWT_VAL_BLE_EXT_ADV (1) +# define MYNEWT_VAL_BLE_EXT_ADV_MAX_SIZE (CONFIG_NIMBLE_BLE_EXT_ADV_MAX_SIZE) +#else +# define MYNEWT_VAL_BLE_EXT_ADV (0) +#endif + +#define MYNEWT_VAL_BLE_MAX_CONNECTIONS (CONFIG_NIMBLE_BLE_MAX_CONN) +#define MYNEWT_VAL_BLE_MAX_PERIODIC_SYNCS (CONFIG_NIMBLE_BLE_MAX_PERIODIC_SYNCS) +#define MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES (CONFIG_NIMBLE_BLE_MULTI_ADV_INSTANCES) + +#ifdef CONFIG_NIMBLE_BLE_PERIODIC_ADV +# define MYNEWT_VAL_BLE_PERIODIC_ADV (1) +#else +# define MYNEWT_VAL_BLE_PERIODIC_ADV (0) +#endif + +#ifdef CONFIG_NIMBLE_BLE_PERIODIC_ADV_SYNC_TRANSFER +# define MYNEWT_VAL_BLE_PERIODIC_ADV_SYNC_TRANSFER (1) +#else +# define MYNEWT_VAL_BLE_PERIODIC_ADV_SYNC_TRANSFER (0) +#endif + +#ifdef CONFIG_NIMBLE_BLE_POWER_CONTROL +# define MYNEWT_VAL_BLE_POWER_CONTROL (1) +#else +# define MYNEWT_VAL_BLE_POWER_CONTROL (0) +#endif + +#define MYNEWT_VAL_BLE_VERSION (CONFIG_NIMBLE_BLE_VERSION) + +#ifdef CONFIG_NIMBLE_BLE_WHITELIST +# define MYNEWT_VAL_BLE_WHITELIST (1) +#else +# define MYNEWT_VAL_BLE_WHITELIST (0) +#endif + +/* ATT configuration */ + +#define MYNEWT_VAL_BLE_ATT_PREFERRED_MTU (CONFIG_NIMBLE_BLE_ATT_PREFFERED_MTU) +#define MYNEWT_VAL_BLE_ATT_SVR_FIND_INFO (1) +#define MYNEWT_VAL_BLE_ATT_SVR_FIND_TYPE (1) +#define MYNEWT_VAL_BLE_ATT_SVR_INDICATE (1) +#define MYNEWT_VAL_BLE_ATT_SVR_MAX_PREP_ENTRIES (64) +#define MYNEWT_VAL_BLE_ATT_SVR_NOTIFY (1) +#define MYNEWT_VAL_BLE_ATT_SVR_QUEUED_WRITE (1) +#define MYNEWT_VAL_BLE_ATT_SVR_QUEUED_WRITE_TMO (30000) +#define MYNEWT_VAL_BLE_ATT_SVR_READ (1) +#define MYNEWT_VAL_BLE_ATT_SVR_READ_BLOB (1) +#define MYNEWT_VAL_BLE_ATT_SVR_READ_GROUP_TYPE (1) +#define MYNEWT_VAL_BLE_ATT_SVR_READ_MULT (1) +#define MYNEWT_VAL_BLE_ATT_SVR_READ_TYPE (1) +#define MYNEWT_VAL_BLE_ATT_SVR_SIGNED_WRITE (1) +#define MYNEWT_VAL_BLE_ATT_SVR_WRITE (1) +#define MYNEWT_VAL_BLE_ATT_SVR_WRITE_NO_RSP (1) + +/* GAP configuration */ + +#define MYNEWT_VAL_BLE_GAP_MAX_PENDING_CONN_PARAM_UPDATE (1) + +/* GATT configuration */ + +#define MYNEWT_VAL_BLE_GATT_DISC_ALL_CHRS (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#define MYNEWT_VAL_BLE_GATT_DISC_ALL_DSCS (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#define MYNEWT_VAL_BLE_GATT_DISC_ALL_SVCS (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#define MYNEWT_VAL_BLE_GATT_DISC_CHR_UUID (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#define MYNEWT_VAL_BLE_GATT_DISC_SVC_UUID (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#define MYNEWT_VAL_BLE_GATT_FIND_INC_SVCS (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#define MYNEWT_VAL_BLE_GATT_INDICATE (1) +#define MYNEWT_VAL_BLE_GATT_MAX_PROCS (4) +#define MYNEWT_VAL_BLE_GATT_NOTIFY (1) +#define MYNEWT_VAL_BLE_GATT_READ (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#define MYNEWT_VAL_BLE_GATT_READ_LONG (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#define MYNEWT_VAL_BLE_GATT_READ_MAX_ATTRS (8) +#define MYNEWT_VAL_BLE_GATT_READ_MULT (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#define MYNEWT_VAL_BLE_GATT_READ_UUID (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#define MYNEWT_VAL_BLE_GATT_RESUME_RATE (1000) +#define MYNEWT_VAL_BLE_GATT_SIGNED_WRITE (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#define MYNEWT_VAL_BLE_GATT_WRITE (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#define MYNEWT_VAL_BLE_GATT_WRITE_LONG (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#define MYNEWT_VAL_BLE_GATT_WRITE_MAX_ATTRS (4) +#define MYNEWT_VAL_BLE_GATT_WRITE_NO_RSP (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#define MYNEWT_VAL_BLE_GATT_WRITE_RELIABLE (MYNEWT_VAL_BLE_ROLE_CENTRAL) + +/* Security configuration */ + +#define MYNEWT_VAL_BLE_RPA_TIMEOUT (CONFIG_NIMBLE_BLE_RPA_TIMEOUT) + +#ifdef CONFIG_NIMBLE_BLE_SM_BONDING +# define MYNEWT_VAL_BLE_SM_BONDING (1) +#else +# define MYNEWT_VAL_BLE_SM_BONDING (0) +#endif + +#ifdef CONFIG_NIMBLE_BLE_SM_LEGACY +# define MYNEWT_VAL_BLE_SM_LEGACY (1) +#else +# define MYNEWT_VAL_BLE_SM_LEGACY (0) +#endif + +#ifdef CONFIG_NIMBLE_BLE_SM_SC +# define MYNEWT_VAL_BLE_SM_SC (1) +#else +# define MYNEWT_VAL_BLE_SM_SC (0) +#endif + +#ifdef CONFIG_NIMBLE_BLE_SM_SC_DEBUG +# define MYNEWT_VAL_BLE_SM_SC_DEBUG_KEYS (1) +#else +# define MYNEWT_VAL_BLE_SM_SC_DEBUG_KEYS (0) +#endif + +#ifdef CONFIG_NIMBLE_BLE_SM_SC_ONLY +# define MYNEWT_VAL_BLE_SM_SC_ONLY (1) +#else +# define MYNEWT_VAL_BLE_SM_SC_ONLY (0) +#endif + +#define MYNEWT_VAL_BLE_SM_IO_CAP (BLE_HS_IO_NO_INPUT_OUTPUT) +#define MYNEWT_VAL_BLE_SM_KEYPRESS (0) +#define MYNEWT_VAL_BLE_SM_LVL (0) +#define MYNEWT_VAL_BLE_SM_MAX_PROCS (1) +#define MYNEWT_VAL_BLE_SM_MITM (0) +#define MYNEWT_VAL_BLE_SM_OOB_DATA_FLAG (0) +#define MYNEWT_VAL_BLE_SM_OUR_KEY_DIST (0) +#define MYNEWT_VAL_BLE_SM_THEIR_KEY_DIST (0) +#define MYNEWT_VAL_BLE_STORE_MAX_BONDS (3) +#define MYNEWT_VAL_BLE_STORE_MAX_CCCDS (8) + +/* ANS service */ + +#define MYNEWT_VAL_BLE_SVC_ANS_NEW_ALERT_CAT (0) +#define MYNEWT_VAL_BLE_SVC_ANS_UNR_ALERT_CAT (0) + +/* BAS service */ + +#define MYNEWT_VAL_BLE_SVC_BAS_BATTERY_LEVEL_NOTIFY_ENABLE (1) +#define MYNEWT_VAL_BLE_SVC_BAS_BATTERY_LEVEL_READ_PERM (0) + +/* DIS service */ + +#define MYNEWT_VAL_BLE_SVC_DIS_DEFAULT_READ_PERM (-1) +#define MYNEWT_VAL_BLE_SVC_DIS_FIRMWARE_REVISION_DEFAULT (NULL) +#define MYNEWT_VAL_BLE_SVC_DIS_FIRMWARE_REVISION_READ_PERM (-1) +#define MYNEWT_VAL_BLE_SVC_DIS_HARDWARE_REVISION_DEFAULT (NULL) +#define MYNEWT_VAL_BLE_SVC_DIS_HARDWARE_REVISION_READ_PERM (-1) +#define MYNEWT_VAL_BLE_SVC_DIS_MANUFACTURER_NAME_DEFAULT (NULL) +#define MYNEWT_VAL_BLE_SVC_DIS_MANUFACTURER_NAME_READ_PERM (-1) +#define MYNEWT_VAL_BLE_SVC_DIS_MODEL_NUMBER_DEFAULT "Apache NuttX NimBLE" +#define MYNEWT_VAL_BLE_SVC_DIS_MODEL_NUMBER_READ_PERM (0) +#define MYNEWT_VAL_BLE_SVC_DIS_SERIAL_NUMBER_DEFAULT (NULL) +#define MYNEWT_VAL_BLE_SVC_DIS_SERIAL_NUMBER_READ_PERM (-1) +#define MYNEWT_VAL_BLE_SVC_DIS_SOFTWARE_REVISION_DEFAULT (NULL) +#define MYNEWT_VAL_BLE_SVC_DIS_SOFTWARE_REVISION_READ_PERM (-1) +#define MYNEWT_VAL_BLE_SVC_DIS_SYSTEM_ID_DEFAULT (NULL) +#define MYNEWT_VAL_BLE_SVC_DIS_SYSTEM_ID_READ_PERM (-1) + +/* GAP service */ + +#define MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE (0) +#define MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE_WRITE_PERM (-1) +#define MYNEWT_VAL_BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION (-1) +#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME "nimble" +#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_MAX_LENGTH (31) +#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_WRITE_PERM (-1) +#define MYNEWT_VAL_BLE_SVC_GAP_PPCP_MAX_CONN_INTERVAL (0) +#define MYNEWT_VAL_BLE_SVC_GAP_PPCP_MIN_CONN_INTERVAL (0) +#define MYNEWT_VAL_BLE_SVC_GAP_PPCP_SLAVE_LATENCY (0) +#define MYNEWT_VAL_BLE_SVC_GAP_PPCP_SUPERVISION_TMO (0) + +#endif /* __APPS_WIRELESS_BLUETOOTH_NIMBLE_INCLUDE_SYSCFG_SYSCFG_H */