Browse Source

drivers: bluetooth: hci: refactor silabs controller init

Refactor the controller init to use the new init routines the
controller now provides. Instead of using a hardcoded set of
features, the features are now initialized based on Kconfig
values that the application selects.

Add config files under modules/hal_silabs, used by the controller
init routines in the external module hal_silabs to determine which
features to enable based on Kconfig options. This brings the
controller feature configurability to roughly parity with the
Simplicity SDK.

Signed-off-by: Jori Rintahaka <jori.rintahaka@silabs.com>
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
pull/89798/head
Jori Rintahaka 5 months ago committed by Anas Nashif
parent
commit
133f5bc3c2
  1. 1
      drivers/bluetooth/hci/Kconfig
  2. 181
      drivers/bluetooth/hci/Kconfig.silabs
  3. 80
      drivers/bluetooth/hci/hci_silabs_efr32.c
  4. 14
      modules/hal_silabs/simplicity_sdk/CMakeLists.txt
  5. 15
      modules/hal_silabs/simplicity_sdk/config/ll/sl_bluetooth.h
  6. 15
      modules/hal_silabs/simplicity_sdk/config/ll/sl_bluetooth_advertiser_config.h
  7. 15
      modules/hal_silabs/simplicity_sdk/config/ll/sl_bluetooth_connection_config.h
  8. 18
      modules/hal_silabs/simplicity_sdk/config/ll/sl_bluetooth_cs_config.h
  9. 15
      modules/hal_silabs/simplicity_sdk/config/ll/sl_bluetooth_periodic_sync_config.h
  10. 15
      modules/hal_silabs/simplicity_sdk/config/ll/sl_bt_accept_list_config.h
  11. 22
      modules/hal_silabs/simplicity_sdk/config/ll/sl_bt_pawr_advertiser_config.h
  12. 15
      modules/hal_silabs/simplicity_sdk/config/ll/sl_bt_pawr_sync_config.h
  13. 15
      modules/hal_silabs/simplicity_sdk/config/ll/sl_bt_periodic_advertiser_config.h
  14. 36
      modules/hal_silabs/simplicity_sdk/config/ll/sl_bt_power_control_config.h
  15. 15
      modules/hal_silabs/simplicity_sdk/config/ll/sl_bt_resolving_list_config.h
  16. 166
      modules/hal_silabs/simplicity_sdk/config/ll/sl_btctrl_config.h
  17. 25
      modules/hal_silabs/simplicity_sdk/config/ll/sl_btctrl_phy_support_config.h
  18. 57
      modules/hal_silabs/simplicity_sdk/config/ll/sl_btctrl_scheduler_priority_config.h
  19. 97
      modules/hal_silabs/simplicity_sdk/src/blob_stubs.c
  20. 26
      modules/hal_silabs/simplicity_sdk/src/sl_btctrl_hci_reset_shim.c

1
drivers/bluetooth/hci/Kconfig

@ -169,6 +169,7 @@ config BT_SILABS_EFR32 @@ -169,6 +169,7 @@ config BT_SILABS_EFR32
select BT_CTLR_CHAN_SEL_2_SUPPORT
select BT_CTLR_CONN_RSSI_SUPPORT
select BT_CTLR_ADV_EXT_SUPPORT
select BT_CTLR_PRIVACY_SUPPORT
help
Use Silicon Labs binary Bluetooth library to connect to the
controller.

181
drivers/bluetooth/hci/Kconfig.silabs

@ -21,7 +21,7 @@ config BT_SILABS_EFR32_USER_ADVERTISERS @@ -21,7 +21,7 @@ config BT_SILABS_EFR32_USER_ADVERTISERS
int "User advertisement sets"
default 1
help
Amount of advertisement sets reserved for application.
Number of advertisement sets reserved for the application.
config BT_SILABS_EFR32_ACCEPT_LIST_SIZE
int "Accept list size"
@ -33,19 +33,188 @@ config BT_SILABS_EFR32_COMPLETED_PACKETS_THRESHOLD @@ -33,19 +33,188 @@ config BT_SILABS_EFR32_COMPLETED_PACKETS_THRESHOLD
int "Completed packet reporting threshold"
default 1
help
Completed packet reporting threshold value.
The number of transmitted air interface ACL packets to trigger the
Number Of Completed Packets HCI event. In most cases, this should be
set to 1, because the host stack uses this to determine whether a
packet has been sent over the air.
config BT_SILABS_EFR32_COMPLETED_PACKETS_TIMEOUT
int "Completed packet report event timeout"
default 3
help
Completed packet report event timeout.
The maximum number of connection events since the previous Number Of
Completed Packets HCI event to trigger reporting of any unreported
completed ACL packets.
config BT_SILABS_EFR32_ACCEPT_LINK_LAYER_STACK_SIZE
int "Link layer stack size"
config BT_SILABS_EFR32_LINK_LAYER_STACK_SIZE
int "Link layer thread stack size"
default 1024
help
Link layer stack size.
Link layer thread stack size.
config BT_SILABS_EFR32_MAX_QUEUED_ADV_REPORTS
int "Maximum queued advertising reports"
default 10
help
Maximum queued advertising reports.
Additional advertising reports are dropped.
config BT_SILABS_EFR32_HIGH_POWER
bool "High power transmission"
help
Normally the transmit power is limited to 10 dBm. Enable this option
to allow the controller to transmit at higher power levels. Note that
this feature is not available on all devices.
config BT_SILABS_EFR32_HIGH_POWER_AFH
bool "Adaptive frequency hopping for high power transmitters"
depends on BT_SILABS_EFR32_HIGH_POWER
help
When high power is used, the controller may be required to perform
adaptive frequency hopping to comply with regulatory requirements.
config BT_SILABS_EFR32_MAX_CS_CONFIGS_PER_CONNECTION
int "Maximum number of CS configurations per connection"
default 4
help
Defines the number of Channel Sounding configurations the application
needs per Bluetooth connection.
config BT_SILABS_EFR32_MAX_CS_PROCEDURES
int "Maximum number of CS procedures per CS configuration"
default 2
help
Defines the number of Channel Sounding procedures the application
needs per Channel Sounding configuration.
config BT_SILABS_EFR32_MAX_PAWR_SYNCHRONIZERS
int "Maximum number of PAWR synchronizers"
default 1
depends on BT_PER_ADV_SYNC
range 1 BT_PER_ADV_SYNC_MAX
help
Define the number of periodic synchronizing instances that the
application needs to use concurrently for Periodic Advertising
with Responses. This number must not exceed the number of periodic
advertising synchronization instances.
config BT_SILABS_EFR32_MAX_PERIODIC_ADVERTISERS
int "Maximum number of periodic advertisers"
default 1
depends on BT_PER_ADV
range 1 BT_EXT_ADV_MAX_ADV_SET
help
Define the number of periodic advertising instances that the
application needs to use concurrently. This number must not exceed
the number of total advertisement sets.
if BT_PER_ADV_RSP
config BT_SILABS_EFR32_MAX_PAWR_ADVERTISERS
int "Maximum numbers of Periodic Advertising With Response advertisers"
default 0
range 0 BT_SILABS_EFR32_MAX_PERIODIC_ADVERTISERS
config BT_SILABS_EFR32_MAX_PAWR_ADVERTISED_DATA_LENGTH_HINT
int "Give a hint to the controller about the maximum PAwR data length"
default 61
range 0 251
help
The maximum data length that the application expects to send in a
Periodic Advertising with Response packet. The controller will use
this hint to optimize the scheduling of concurrent connections.
This value does not preclude using longer data lengths.
config BT_SILABS_EFR32_PAWR_PACKET_REQUEST_COUNT
int "Number of PAwR packets from host per request"
default 4
range 1 12
help
The number of packets the controller requests from the host in one LE
Periodic Advertising Subevent Data Request event. This is a tradeoff
between the controller's memory usage and the number of separate HCI
events the controller must send. This value is applied to each PAwR
advertiser separately. Note that the request count is limited by the
number of subevents in the PAwR train, and the request advance
configuration.
config BT_SILABS_EFR32_PAWR_PACKET_REQUEST_ADVANCE
int "Number of subevents in advance to request PAwR data"
default 1
range 1 6
help
The controller asks the host to provide data for upcoming subevents
before the subevents are sent over the air. This parameter is used to
configure how many subevents in advance the requests are sent to the
host. The bigger the advance is, the more time the host has to
process the request, but the controller has to reserve more memory
for buffering the subevent data. Note that the maximum advance is
limited by the number of subevents configured for a PAwR train.
Therefore, the actual advance may be less than the number configured
in this parameter.
endif # BT_PER_ADV_RSP
if BT_TRANSMIT_POWER_CONTROL
config BT_SILABS_EFR32_ACTIVATE_POWER_CONTROL
bool "EFR32 LE Power Control"
default y
help
Enable power control to adjust the transmit power based on the
received signal strength. The controller will ask the transmitter
to adjust its transmit power to keep the RSSI of the received
packets within the golden ranges, specified separately for each PHY.
config BT_SILABS_EFR32_GOLDEN_RSSI_MIN_1M
int "Lower bound of the golden RSSI range for 1M PHY"
default -60
help
The lower bound of the golden RSSI range for 1M PHY.
config BT_SILABS_EFR32_GOLDEN_RSSI_MAX_1M
int "Upper bound of the golden RSSI range for 1M PHY"
default -40
help
The upper bound of the golden RSSI range for 1M PHY.
config BT_SILABS_EFR32_GOLDEN_RSSI_MIN_2M
int "Lower bound of the golden RSSI range for 2M PHY"
default -60
help
The lower bound of the golden RSSI range for 2M PHY.
config BT_SILABS_EFR32_GOLDEN_RSSI_MAX_2M
int "Upper bound of the golden RSSI range for 2M PHY"
default -40
help
The upper bound of the golden RSSI range for 2M PHY.
config BT_SILABS_EFR32_GOLDEN_RSSI_MIN_CODED_S8
int "Lower bound of the golden RSSI range for Coded S=8 PHY"
default -60
help
The lower bound of the golden RSSI range for Coded S=8 PHY.
config BT_SILABS_EFR32_GOLDEN_RSSI_MAX_CODED_S8
int "Upper bound of the golden RSSI range for Coded S=8 PHY"
default -40
help
The upper bound of the golden RSSI range for Coded S=8 PHY.
config BT_SILABS_EFR32_GOLDEN_RSSI_MIN_CODED_S2
int "Lower bound of the golden RSSI range for Coded S=2 PHY"
default -60
help
The lower bound of the golden RSSI range for Coded S=2 PHY.
config BT_SILABS_EFR32_GOLDEN_RSSI_MAX_CODED_S2
int "Upper bound of the golden RSSI range for Coded S=2 PHY"
default -40
help
The upper bound of the golden RSSI range for Coded S=2 PHY.
endif # BT_TRANSMIT_POWER_CONTROL
config BT_SILABS_EFR32_LL_THREAD_PRIO
# Hidden option for Co-Operative Link Layer thread priority

80
drivers/bluetooth/hci/hci_silabs_efr32.c

@ -34,7 +34,7 @@ struct hci_data { @@ -34,7 +34,7 @@ struct hci_data {
#define CTLR_RL_SIZE 0
#endif
static K_KERNEL_STACK_DEFINE(slz_ll_stack, CONFIG_BT_SILABS_EFR32_ACCEPT_LINK_LAYER_STACK_SIZE);
static K_KERNEL_STACK_DEFINE(slz_ll_stack, CONFIG_BT_SILABS_EFR32_LINK_LAYER_STACK_SIZE);
static struct k_thread slz_ll_thread;
static K_KERNEL_STACK_DEFINE(slz_rx_stack, CONFIG_BT_DRV_RX_STACK_SIZE);
@ -54,7 +54,6 @@ void BTLE_LL_EventRaise(uint32_t events); @@ -54,7 +54,6 @@ void BTLE_LL_EventRaise(uint32_t events);
void BTLE_LL_Process(uint32_t events);
int16_t BTLE_LL_SetMaxPower(int16_t power);
bool sli_pending_btctrl_events(void);
RAIL_Handle_t BTLE_LL_GetRadioHandle(void);
void rail_isr_installer(void)
{
@ -257,6 +256,7 @@ static int slz_bt_open(const struct device *dev, bt_hci_recv_t recv) @@ -257,6 +256,7 @@ static int slz_bt_open(const struct device *dev, bt_hci_recv_t recv)
{
struct hci_data *hci = dev->data;
int ret;
sl_status_t sl_status;
BUILD_ASSERT(CONFIG_NUM_METAIRQ_PRIORITIES > 0,
"Config NUM_METAIRQ_PRIORITIES must be greater than 0");
@ -278,65 +278,19 @@ static int slz_bt_open(const struct device *dev, bt_hci_recv_t recv) @@ -278,65 +278,19 @@ static int slz_bt_open(const struct device *dev, bt_hci_recv_t recv)
rail_isr_installer();
sl_rail_util_pa_init();
/* Disable 2M and coded PHYs, they do not work with the current configuration */
sl_btctrl_disable_2m_phy();
sl_btctrl_disable_coded_phy();
/* sl_btctrl_init_mem returns the number of memory buffers allocated */
ret = sl_btctrl_init_mem(CONFIG_BT_SILABS_EFR32_BUFFER_MEMORY);
if (!ret) {
LOG_ERR("Failed to allocate memory %d", ret);
return -ENOMEM;
}
sl_btctrl_configure_le_buffer_size(CONFIG_BT_BUF_ACL_TX_COUNT);
if (IS_ENABLED(CONFIG_BT_CTLR_PRIVACY)) {
sl_btctrl_allocate_resolving_list_memory(CTLR_RL_SIZE);
sl_btctrl_init_privacy();
}
ret = sl_btctrl_init_ll();
if (ret) {
LOG_ERR("Bluetooth link layer init failed %d", ret);
/* Initialize Controller features based on Kconfig values */
sl_status = sl_btctrl_init();
if (sl_status != SL_STATUS_OK) {
LOG_ERR("sl_bt_controller_init failed, status=%d", sl_status);
ret = -EIO;
goto deinit;
}
slz_set_tx_power(CONFIG_BT_CTLR_TX_PWR_ANTENNA);
sl_btctrl_init_adv();
sl_btctrl_init_scan();
sl_btctrl_init_conn();
sl_btctrl_init_phy();
if (IS_ENABLED(CONFIG_BT_EXT_ADV)) {
sl_btctrl_init_adv_ext();
sl_btctrl_init_scan_ext();
}
ret = sl_btctrl_init_basic(MAX_CONN, CONFIG_BT_SILABS_EFR32_USER_ADVERTISERS + MAX_CONN,
CONFIG_BT_SILABS_EFR32_ACCEPT_LIST_SIZE);
if (ret) {
LOG_ERR("Failed to initialize the controller %d", ret);
goto deinit;
}
sl_btctrl_configure_completed_packets_reporting(
CONFIG_BT_SILABS_EFR32_COMPLETED_PACKETS_THRESHOLD,
CONFIG_BT_SILABS_EFR32_COMPLETED_PACKETS_TIMEOUT);
sl_bthci_init_upper();
sl_btctrl_hci_parser_init_default();
sl_btctrl_hci_parser_init_conn();
sl_btctrl_hci_parser_init_adv();
sl_btctrl_hci_parser_init_phy();
if (IS_ENABLED(CONFIG_BT_SILABS_EFR32_HCI_VS)) {
sl_bthci_init_vs();
}
if (IS_ENABLED(CONFIG_PM)) {
RAIL_ConfigSleep(BTLE_LL_GetRadioHandle(), RAIL_SLEEP_CONFIG_TIMERSYNC_ENABLED);
RAIL_ConfigSleep(sli_btctrl_get_radio_context_handle(),
RAIL_SLEEP_CONFIG_TIMERSYNC_ENABLED);
RAIL_Status_t status = RAIL_InitPowerManager();
if (status != RAIL_STATUS_NO_ERROR) {
@ -347,17 +301,13 @@ static int slz_bt_open(const struct device *dev, bt_hci_recv_t recv) @@ -347,17 +301,13 @@ static int slz_bt_open(const struct device *dev, bt_hci_recv_t recv)
}
}
if (IS_ENABLED(CONFIG_BT_CTLR_PRIVACY)) {
sl_btctrl_hci_parser_init_privacy();
}
hci->recv = recv;
LOG_DBG("SiLabs BT HCI started");
return 0;
deinit:
sli_btctrl_deinit_mem();
sl_btctrl_deinit(); /* No-op if controller initialization failed */
return ret;
}
@ -366,6 +316,11 @@ bool sli_pending_btctrl_events(void) @@ -366,6 +316,11 @@ bool sli_pending_btctrl_events(void)
return false; /* TODO: check if this should really return false! */
}
void sli_btctrl_events_init(void)
{
atomic_clear(&sli_btctrl_events);
}
/* Store event flags and increment the LL semaphore */
void BTLE_LL_EventRaise(uint32_t events)
{
@ -373,11 +328,6 @@ void BTLE_LL_EventRaise(uint32_t events) @@ -373,11 +328,6 @@ void BTLE_LL_EventRaise(uint32_t events)
k_sem_give(&slz_ll_sem);
}
void sl_bt_controller_init(void)
{
/* No extra initialization procedure required */
}
static DEVICE_API(bt_hci, drv) = {
.open = slz_bt_open,
.send = slz_bt_send,

14
modules/hal_silabs/simplicity_sdk/CMakeLists.txt

@ -64,7 +64,21 @@ if(CONFIG_SOC_GECKO_HAS_RADIO) @@ -64,7 +64,21 @@ if(CONFIG_SOC_GECKO_HAS_RADIO)
# prebuilt libs
add_prebuilt_library(liblinklayer protocol/bluetooth/bgstack/ll/build/gcc/xg${SILABS_DEVICE_FAMILY_NUMBER}/release/liblinklayer.a)
add_prebuilt_library(libbgcommon protocol/bluetooth/bgcommon/lib/build/gcc/cortex-m33/bgcommon/release/libbgcommon.a)
if(NOT CONFIG_BUILD_ONLY_NO_BLOBS)
# There is a circular dependency between the libs: libbgcommon depends on the symbol
# bg_pool_pools while liblinklayer depends on many symbols in libbgcommon
target_link_libraries(libbgcommon INTERFACE liblinklayer)
target_link_libraries(liblinklayer INTERFACE libbgcommon)
# Only two functions need to be stubbed if this is not included when no blobs are used.
# The contents of the init/deinit functions are provided by the Link Layer from SiSDK,
# and we should not care about their exact implementation and which calls they make.
zephyr_library_sources(
${BLUETOOTH_DIR}/bgstack/ll/src/sl_btctrl_init.c
${BLUETOOTH_DIR}/bgstack/ll/src/sl_btctrl_init_tasklets.c
)
endif()
zephyr_library_sources(src/sl_btctrl_hci_reset_shim.c)
zephyr_include_directories(config/ll)
# link mbedTLS
if(CONFIG_MBEDTLS)

15
modules/hal_silabs/simplicity_sdk/config/ll/sl_bluetooth.h

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* This configuration header is used by the Silicon Labs Bluetooth Controller init
* functions. It is provided for compatibility only.
*/
#ifndef SL_BLUETOOTH_H
#define SL_BLUETOOTH_H
/* This is a dummy file for compatibility */
#endif

15
modules/hal_silabs/simplicity_sdk/config/ll/sl_bluetooth_advertiser_config.h

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* This configuration header is used by the Silicon Labs Bluetooth Controller init
* functions. It is used to configure generic advertiser settings.
*/
#ifndef SL_BT_ADVERTISER_CONFIG_H
#define SL_BT_ADVERTISER_CONFIG_H
#define SL_BT_CONFIG_USER_ADVERTISERS CONFIG_BT_SILABS_EFR32_USER_ADVERTISERS
#endif

15
modules/hal_silabs/simplicity_sdk/config/ll/sl_bluetooth_connection_config.h

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* This configuration header is used by the Silicon Labs Bluetooth Controller init
* functions. It is used to configure connection options.
*/
#ifndef SL_BT_CONNECTION_CONFIG_H
#define SL_BT_CONNECTION_CONFIG_H
#define SL_BT_CONFIG_MAX_CONNECTIONS CONFIG_BT_MAX_CONN
#endif

18
modules/hal_silabs/simplicity_sdk/config/ll/sl_bluetooth_cs_config.h

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* This configuration header is used by the Silicon Labs Bluetooth Controller init
* functions. It is used to configure Channel Sounding options.
*/
#ifndef SL_BT_CS_CONFIG_H
#define SL_BT_CS_CONFIG_H
#define SL_BT_CONFIG_MAX_CS_CONFIGS_PER_CONNECTION \
CONFIG_BT_SILABS_EFR32_MAX_CS_CONFIGS_PER_CONNECTION
#define SL_BT_CONFIG_MAX_CS_PROCEDURES CONFIG_BT_SILABS_EFR32_MAX_CS_PROCEDURES
#endif

15
modules/hal_silabs/simplicity_sdk/config/ll/sl_bluetooth_periodic_sync_config.h

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* This configuration header is used by the Silicon Labs Bluetooth Controller init
* functions. It is used to configure Periodic Advertising Synchronizer options.
*/
#ifndef SL_BT_PERIODIC_SYNC_CONFIG_H
#define SL_BT_PERIODIC_SYNC_CONFIG_H
#define SL_BT_CONFIG_MAX_PERIODIC_ADVERTISING_SYNC CONFIG_BT_PER_ADV_SYNC_MAX
#endif

15
modules/hal_silabs/simplicity_sdk/config/ll/sl_bt_accept_list_config.h

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* This configuration header is used by the Silicon Labs Bluetooth Controller init
* functions. It is used to configure Accept List options.
*/
#ifndef SL_BT_ACCEPT_LIST_CONFIG_H
#define SL_BT_ACCEPT_LIST_CONFIG_H
#define SL_BT_CONFIG_ACCEPT_LIST_SIZE CONFIG_BT_SILABS_EFR32_ACCEPT_LIST_SIZE
#endif

22
modules/hal_silabs/simplicity_sdk/config/ll/sl_bt_pawr_advertiser_config.h

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* This configuration header is used by the Silicon Labs Bluetooth Controller init
* functions. It is used to configure Periodic Advertising With Response options.
*/
#ifndef SL_BT_PAWR_ADVERTISER_CONFIG_H
#define SL_BT_PAWR_ADVERTISER_CONFIG_H
#define SL_BT_CONFIG_MAX_PAWR_ADVERTISERS CONFIG_BT_SILABS_EFR32_MAX_PAWR_ADVERTISERS
#define SL_BT_CONFIG_MAX_PAWR_ADVERTISED_DATA_LENGTH_HINT \
CONFIG_BT_SILABS_EFR32_MAX_PAWR_ADVERTISED_DATA_LENGTH_HINT
#define SL_BT_CONFIG_PAWR_PACKET_REQUEST_COUNT CONFIG_BT_SILABS_EFR32_PAWR_PACKET_REQUEST_COUNT
#define SL_BT_CONFIG_PAWR_PACKET_REQUEST_ADVANCE CONFIG_BT_SILABS_EFR32_PAWR_PACKET_REQUEST_ADVANCE
#endif

15
modules/hal_silabs/simplicity_sdk/config/ll/sl_bt_pawr_sync_config.h

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* This configuration header is used by the Silicon Labs Bluetooth Controller init functions.
* It is used to configure Periodic Advertising With Response Synchronizer options.
*/
#ifndef SL_BT_PAWR_SYNC_CONFIG_H
#define SL_BT_PAWR_SYNC_CONFIG_H
#define SL_BT_CONFIG_MAX_PAWR_SYNCHRONIZERS CONFIG_BT_SILABS_EFR32_MAX_PAWR_SYNCHRONIZERS
#endif

15
modules/hal_silabs/simplicity_sdk/config/ll/sl_bt_periodic_advertiser_config.h

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* This configuration header is used by the Silicon Labs Bluetooth Controller init functions.
* It is used to configure Periodic Advertising Sender options.
*/
#ifndef SL_BT_PERIODIC_ADVERTISER_CONFIG_H
#define SL_BT_PERIODIC_ADVERTISER_CONFIG_H
#define SL_BT_CONFIG_MAX_PERIODIC_ADVERTISERS CONFIG_BT_SILABS_EFR32_MAX_PERIODIC_ADVERTISERS
#endif

36
modules/hal_silabs/simplicity_sdk/config/ll/sl_bt_power_control_config.h

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* This configuration header is used by the Silicon Labs Bluetooth Controller init functions.
* It is used to configure LE Power Control options.
*/
#ifndef SL_BT_POWER_CONTROL_CONFIG_H
#define SL_BT_POWER_CONTROL_CONFIG_H
#define SL_BT_ACTIVATE_POWER_CONTROL CONFIG_BT_SILABS_EFR32_ACTIVATE_POWER_CONTROL
#define SL_BT_GOLDEN_RSSI_MIN_1M CONFIG_BT_SILABS_EFR32_GOLDEN_RSSI_MIN_1M
#define SL_BT_GOLDEN_RSSI_MAX_1M CONFIG_BT_SILABS_EFR32_GOLDEN_RSSI_MAX_1M
#define SL_BT_GOLDEN_RSSI_MIN_2M CONFIG_BT_SILABS_EFR32_GOLDEN_RSSI_MIN_2M
#define SL_BT_GOLDEN_RSSI_MAX_2M CONFIG_BT_SILABS_EFR32_GOLDEN_RSSI_MAX_2M
#define SL_BT_GOLDEN_RSSI_MIN_CODED_S8 CONFIG_BT_SILABS_EFR32_GOLDEN_RSSI_MIN_CODED_S8
#define SL_BT_GOLDEN_RSSI_MAX_CODED_S8 CONFIG_BT_SILABS_EFR32_GOLDEN_RSSI_MAX_CODED_S8
#define SL_BT_GOLDEN_RSSI_MIN_CODED_S2 CONFIG_BT_SILABS_EFR32_GOLDEN_RSSI_MIN_CODED_S2
#define SL_BT_GOLDEN_RSSI_MAX_CODED_S2 CONFIG_BT_SILABS_EFR32_GOLDEN_RSSI_MAX_CODED_S2
/* TODO: make these configurable in a sensible way, preferably based on HW limits */
#define SL_BT_DEFAULT_MAX_POWER_LEVEL SL_BT_USE_MAX_POWER_LEVEL_SUPPORTED_BY_RADIO
#define SL_BT_DEFAULT_MIN_POWER_LEVEL SL_BT_USE_MIN_POWER_LEVEL_SUPPORTED_BY_RADIO
#endif

15
modules/hal_silabs/simplicity_sdk/config/ll/sl_bt_resolving_list_config.h

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* This configuration header is used by the Silicon Labs Bluetooth Controller init functions.
* It is used to configure Resolving List options.
*/
#ifndef SL_BTCTRL_RESOLVING_LIST_CONFIG_H
#define SL_BTCTRL_RESOLVING_LIST_CONFIG_H
#define SL_BT_CONFIG_RESOLVING_LIST_SIZE CONFIG_BT_CTLR_RL_SIZE
#endif

166
modules/hal_silabs/simplicity_sdk/config/ll/sl_btctrl_config.h

@ -0,0 +1,166 @@ @@ -0,0 +1,166 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* This configuration header is used by the Silicon Labs Bluetooth Controller init
* functions. Kconfig options are converted to config macros expected by the Controller.
*/
#ifndef SL_BTCTRL_CONFIG_H
#define SL_BTCTRL_CONFIG_H
/* The following section maps common Zephyr Bluetooth host Kconfig options
* to SL_CATALOG items. Note that the feature dependencies are handled
* indirectly via Kconfig dependency resolution.
*/
#ifdef CONFIG_BT_FILTER_ACCEPT_LIST
#define SL_CATALOG_BLUETOOTH_FEATURE_ACCEPT_LIST_PRESENT
#endif
#ifdef CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER
#ifdef CONFIG_BT_PER_ADV
#define SL_CATALOG_BLUETOOTH_FEATURE_ADVERTISER_PAST_PRESENT
#endif
#ifdef CONFIG_BT_PER_ADV_SYNC
#define SL_CATALOG_BLUETOOTH_FEATURE_SYNC_PAST_PRESENT
#endif
#endif
#ifdef CONFIG_BT_BROADCASTER
/* Both the legacy and extended advertiser require the base advertiser. */
#define SL_CATALOG_BLUETOOTH_FEATURE_ADVERTISER_PRESENT
#define SL_CATALOG_BLUETOOTH_FEATURE_LEGACY_ADVERTISER_PRESENT
#endif
#ifdef CONFIG_BT_ISO
#define SL_CATALOG_BLUETOOTH_FEATURE_CIS_PRESENT
#endif
#ifdef CONFIG_BT_CONN
#define SL_CATALOG_BLUETOOTH_FEATURE_CONNECTION_PRESENT
#endif
#ifdef CONFIG_BT_SUBRATING
#define SL_CATALOG_BLUETOOTH_FEATURE_CONNECTION_SUBRATING_PRESENT
#endif
#ifdef CONFIG_BT_PHY_UPDATE
#define SL_CATALOG_BLUETOOTH_FEATURE_CONNECTION_PHY_UPDATE_PRESENT
#else
#define SL_CATALOG_BLUETOOTH_CONNECTION_PHY_UPDATE_INCOMPATIBLE_PRESENT
#endif
#ifdef CONFIG_BT_CHANNEL_SOUNDING
#define SL_CATALOG_BLUETOOTH_FEATURE_CS_PRESENT
#endif
#ifdef CONFIG_BT_CHANNEL_SOUNDING_TEST
#define SL_CATALOG_BLUETOOTH_FEATURE_CS_TEST_PRESENT
#endif
#ifdef CONFIG_BT_EXT_ADV
#define SL_CATALOG_BLUETOOTH_FEATURE_EXTENDED_ADVERTISER_PRESENT
#endif
#ifdef CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER
#define SL_CATALOG_BLUETOOTH_FEATURE_PAST_RECEIVER_PRESENT
#endif
#ifdef CONFIG_BT_PER_ADV_RSP
#define SL_CATALOG_BLUETOOTH_FEATURE_PAWR_ADVERTISER_PRESENT
#ifdef CONFIG_BT_CONN
#define SL_CATALOG_BLUETOOTH_FEATURE_CONNECTION_PAWR_SCHEDULING_PRESENT
#endif
#endif
#ifdef CONFIG_BT_PER_ADV_SYNC_RSP
#define SL_CATALOG_BLUETOOTH_FEATURE_PAWR_SYNC_PRESENT
#endif
#ifdef CONFIG_BT_PER_ADV
#define SL_CATALOG_BLUETOOTH_FEATURE_PERIODIC_ADVERTISER_PRESENT
#endif
#ifdef CONFIG_BT_EXT_ADV_CODING_SELECTION
/* This does not have any corresponding SL_CATALOG feature, as the coding selection
* is implicitly supported depending on the 2M / Coded PHY support, when extended
* advertising is enabled.
*/
#endif
#ifdef CONFIG_BT_TRANSMIT_POWER_CONTROL
#define SL_CATALOG_BLUETOOTH_FEATURE_POWER_CONTROL_PRESENT
#endif
#ifdef CONFIG_BT_CTLR_PRIVACY
#define SL_CATALOG_BLUETOOTH_FEATURE_RESOLVING_LIST_PRESENT
#endif
#ifdef CONFIG_BT_OBSERVER
#define SL_CATALOG_BLUETOOTH_FEATURE_SCANNER_PRESENT
#endif
#ifdef CONFIG_BT_PER_ADV_SYNC
#define SL_CATALOG_BLUETOOTH_FEATURE_SYNC_PRESENT
#endif
#ifdef CONFIG_BT_CTLR_DTM_HCI
#define SL_CATALOG_BLUETOOTH_FEATURE_HCI_TEST_COMMANDS_PRESENT
#endif
#define SL_CATALOG_BLUETOOTH_FEATURE_PHY_SUPPORT_CONFIG_PRESENT
/* The following maps vendor-specific features to SL_CATALOG items */
#ifdef CONFIG_BT_SILABS_EFR32_HIGH_POWER
#define SL_CATALOG_BLUETOOTH_FEATURE_HIGH_POWER_PRESENT
#endif
#ifdef CONFIG_BT_SILABS_EFR32_HIGH_POWER_AFH
#define SL_CATALOG_BLUETOOTH_FEATURE_AFH_PRESENT
#endif
#ifndef CONFIG_BT_SILABS_EFR32_HCI_VS
#define SL_BLUETOOTH_NO_VS_HCI_COMMANDS
#endif
#define SL_CATALOG_BLUETOOTH_RCP_PRESENT
/* The following features are not currently supported with Zephyr */
#undef SL_CATALOG_BLUETOOTH_FEATURE_AOA_RECEIVER_PRESENT
#undef SL_CATALOG_BLUETOOTH_FEATURE_AOA_TRANSMITTER_PRESENT
#undef SL_CATALOG_BLUETOOTH_FEATURE_AOD_RECEIVER_PRESENT
#undef SL_CATALOG_BLUETOOTH_FEATURE_AOD_TRANSMITTER_PRESENT
#undef SL_CATALOG_BLUETOOTH_FEATURE_CONNECTION_ANALYZER_PRESENT
#undef SL_CATALOG_BLUETOOTH_FEATURE_CONNECTION_STATISTICS_PRESENT
#undef SL_CATALOG_BLUETOOTH_FEATURE_EVEN_SCHEDULING_PRESENT
#undef SL_CATALOG_BLUETOOTH_FEATURE_HCI_DEBUG_PRESENT
#undef SL_CATALOG_BLUETOOTH_FEATURE_RADIO_WATCHDOG_PRESENT
#undef SL_CATALOG_BLUETOOTH_FEATURE_USER_POWER_CONTROL_PRESENT
#undef SL_CATALOG_KERNEL_PRESENT /* Only relevant in the SiSDK RTOS adaptation */
#undef SL_CATALOG_RAIL_UTIL_COEX_PRESENT
#undef SL_RAIL_LIB_MULTIPROTOCOL_SUPPORT
/* Maps the controller configuration options from Kconfig to Silabs defines */
#define SL_BT_CONTROLLER_BUFFER_MEMORY CONFIG_BT_SILABS_EFR32_BUFFER_MEMORY
#define SL_BT_CONTROLLER_LE_BUFFER_SIZE_MAX CONFIG_BT_BUF_ACL_TX_COUNT
#define SL_BT_CONTROLLER_USER_ADVERTISERS CONFIG_BT_SILABS_EFR32_USER_ADVERTISERS
#define SL_BT_CONTROLLER_COMPLETED_PACKETS_THRESHOLD \
CONFIG_BT_SILABS_EFR32_COMPLETED_PACKETS_THRESHOLD
#define SL_BT_CONTROLLER_COMPLETED_PACKETS_EVENTS_TIMEOUT \
CONFIG_BT_SILABS_EFR32_COMPLETED_PACKETS_TIMEOUT
#define SL_BT_CONFIG_MAX_QUEUED_ADV_REPORTS CONFIG_BT_SILABS_EFR32_MAX_QUEUED_ADV_REPORTS
/* Default interrupt priorities. These get overwritten later as part of HCI driver init. */
#define SL_BT_CONTROLLER_LINKLAYER_IRQ_PRIORITY 5
#define SL_BT_CONTROLLER_RADIO_IRQ_PRIORITY 4
/* Power level configuration override is not exposed in Zephyr, use RAIL PA config instead. */
#define SL_BT_CONTROLLER_MIN_POWER_LEVEL_OVERRIDE 0
#define SL_BT_CONTROLLER_MAX_POWER_LEVEL_OVERRIDE 0
#define SL_BT_CONTROLLER_SCANNER_RECEPTION_EARLY_ABORT 0
#define SL_BT_CONTROLLER_CONN_EVENT_LENGTH_MIN 3
#define SL_BT_CONTROLLER_CONN_EVENT_LENGTH_EXTENSION 0
#define SL_BT_CONTROLLER_USE_LEGACY_VENDOR_SPECIFIC_EVENT_CODE 0
#endif /* SL_BTCTRL_CONFIG_H */

25
modules/hal_silabs/simplicity_sdk/config/ll/sl_btctrl_phy_support_config.h

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* This configuration header is used by the Silicon Labs Bluetooth Controller init functions.
* It is used to configure PHY support options.
*/
#ifndef SL_BTCTRL_PHY_SUPPORT_CONFIG_H
#define SL_BTCTRL_PHY_SUPPORT_CONFIG_H
#if defined(CONFIG_BT_CTLR_PHY_2M)
#define SL_BT_CONTROLLER_2M_PHY_SUPPORT 1
#else
#define SL_BT_CONTROLLER_2M_PHY_SUPPORT 0
#endif
#if defined(CONFIG_BT_CTLR_PHY_CODED)
#define SL_BT_CONTROLLER_CODED_PHY_SUPPORT 1
#else
#define SL_BT_CONTROLLER_CODED_PHY_SUPPORT 0
#endif
#endif /* SL_BTCTRL_PHY_SUPPORT_CONFIG_H */

57
modules/hal_silabs/simplicity_sdk/config/ll/sl_btctrl_scheduler_priority_config.h

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* This configuration header is used by the Silicon Labs Bluetooth Controller init functions.
* It is used to configure scheduler priority options.
*/
#ifndef SL_BTCTRL_SCHEDULER_PRIORITY_CONFIG_H
#define SL_BTCTRL_SCHEDULER_PRIORITY_CONFIG_H
#include "sl_btctrl_linklayer_defs.h"
#define SL_BT_CONTROLLER_SCHEDULER_PRI_SCAN_MIN 191
#define SL_BT_CONTROLLER_SCHEDULER_PRI_SCAN_MAX 143
#define SL_BT_CONTROLLER_SCHEDULER_PRI_SCAN_STEP 4
#define SL_BT_CONTROLLER_SCHEDULER_PRI_ADV_MIN 175
#define SL_BT_CONTROLLER_SCHEDULER_PRI_ADV_MAX 127
#define SL_BT_CONTROLLER_SCHEDULER_PRI_ADV_STEP 4
#define SL_BT_CONTROLLER_SCHEDULER_PRI_CONN_MIN 135
#define SL_BT_CONTROLLER_SCHEDULER_PRI_CONN_MAX 0
#define SL_BT_CONTROLLER_SCHEDULER_PRI_INIT_MIN 55
#define SL_BT_CONTROLLER_SCHEDULER_PRI_INIT_MAX 15
#define SL_BT_CONTROLLER_SCHEDULER_PRI_RAIL_WINDOW_MIN 16
#define SL_BT_CONTROLLER_SCHEDULER_PRI_RAIL_WINDOW_MAX 32
#define SL_BT_CONTROLLER_SCHEDULER_PRI_PAWR_TX_MIN 15
#define SL_BT_CONTROLLER_SCHEDULER_PRI_PAWR_TX_MAX 5
#define SL_BT_CONTROLLER_SCHEDULER_PRI_PAWR_RX_MIN 20
#define SL_BT_CONTROLLER_SCHEDULER_PRI_PAWR_RX_MAX 10
/* Default priority configuration */
#define SL_BTCTRL_SCHEDULER_PRIORITIES \
{.scan_min = SL_BT_CONTROLLER_SCHEDULER_PRI_SCAN_MIN, \
.scan_max = SL_BT_CONTROLLER_SCHEDULER_PRI_SCAN_MAX, \
.adv_min = SL_BT_CONTROLLER_SCHEDULER_PRI_ADV_MIN, \
.adv_max = SL_BT_CONTROLLER_SCHEDULER_PRI_ADV_MAX, \
.conn_min = SL_BT_CONTROLLER_SCHEDULER_PRI_CONN_MIN, \
.conn_max = SL_BT_CONTROLLER_SCHEDULER_PRI_CONN_MAX, \
.init_min = SL_BT_CONTROLLER_SCHEDULER_PRI_INIT_MIN, \
.init_max = SL_BT_CONTROLLER_SCHEDULER_PRI_INIT_MAX, \
.rail_mapping_offset = SL_BT_CONTROLLER_SCHEDULER_PRI_RAIL_WINDOW_MIN, \
.rail_mapping_range = (SL_BT_CONTROLLER_SCHEDULER_PRI_RAIL_WINDOW_MAX - \
SL_BT_CONTROLLER_SCHEDULER_PRI_RAIL_WINDOW_MIN), \
0, \
.adv_step = SL_BT_CONTROLLER_SCHEDULER_PRI_ADV_STEP, \
.scan_step = SL_BT_CONTROLLER_SCHEDULER_PRI_SCAN_STEP, \
.pawr_tx_min = SL_BT_CONTROLLER_SCHEDULER_PRI_PAWR_TX_MIN, \
.pawr_tx_max = SL_BT_CONTROLLER_SCHEDULER_PRI_PAWR_TX_MAX, \
.pawr_rx_min = SL_BT_CONTROLLER_SCHEDULER_PRI_PAWR_RX_MIN, \
.pawr_rx_max = SL_BT_CONTROLLER_SCHEDULER_PRI_PAWR_RX_MAX}
#endif /* SL_BTCTRL_SCHEDULER_PRIORITY_CONFIG_H */

97
modules/hal_silabs/simplicity_sdk/src/blob_stubs.c

@ -9,113 +9,54 @@ @@ -9,113 +9,54 @@
#include <stdint.h>
#include <stdbool.h>
#include <rail.h>
#include <sl_status.h>
struct RAIL_TxPowerCurvesConfigAlt {
};
void RAIL_VerifyTxPowerCurves(const struct RAIL_TxPowerCurvesConfigAlt *config)
RAIL_Status_t RAIL_VerifyTxPowerCurves(const struct RAIL_TxPowerCurvesConfigAlt *config)
{
return RAIL_STATUS_NO_ERROR;
}
void RAIL_EnablePaCal(bool enable)
{
}
int16_t sl_btctrl_hci_receive(uint8_t *data, int16_t len, bool lastFragment)
RAIL_Status_t RAIL_ConfigSleep(RAIL_Handle_t handle, RAIL_SleepConfig_t config)
{
return 0;
return RAIL_STATUS_NO_ERROR;
}
void BTLE_LL_Process(uint32_t events)
RAIL_Status_t RAIL_InitPowerManager(void)
{
return RAIL_STATUS_NO_ERROR;
}
int16_t BTLE_LL_SetMaxPower(int16_t power)
int16_t sl_btctrl_hci_receive(uint8_t *data, int16_t len, bool lastFragment)
{
return 0;
}
void sl_btctrl_disable_2m_phy(void)
{
}
void sl_btctrl_disable_coded_phy(void)
void BTLE_LL_Process(uint32_t events)
{
}
uint32_t sl_btctrl_init_mem(uint32_t memsize)
int16_t BTLE_LL_SetMaxPower(int16_t power)
{
return 0;
}
void sl_btctrl_configure_le_buffer_size(uint8_t count)
{
}
sl_status_t sl_btctrl_init_ll(void)
{
return SL_STATUS_NOT_AVAILABLE;
}
void sli_btctrl_deinit_mem(void)
{
}
void sl_btctrl_init_adv(void)
{
}
void sl_btctrl_init_adv_ext(void)
{
}
void sl_btctrl_init_scan(void)
{
}
void sl_btctrl_init_scan_ext(void)
{
}
void sl_btctrl_init_conn(void)
{
}
void sl_btctrl_init_phy(void)
{
}
void sl_btctrl_init_basic(void)
{
}
void sl_btctrl_configure_completed_packets_reporting(uint8_t packets, uint8_t events)
{
}
void sl_bthci_init_upper(void)
{
}
void sl_btctrl_hci_parser_init_default(void)
{
}
void sl_btctrl_hci_parser_init_conn(void)
{
}
void sl_btctrl_hci_parser_init_adv(void)
sl_status_t sl_btctrl_init(void)
{
return SL_STATUS_OK;
}
void sl_btctrl_hci_parser_init_phy(void)
void sl_btctrl_deinit(void)
{
}
void sl_bthci_init_vs(void)
void *sli_btctrl_get_radio_context_handle(void)
{
return 0;
}
void AGC_IRQHandler(void)
@ -130,6 +71,10 @@ void FRC_IRQHandler(void) @@ -130,6 +71,10 @@ void FRC_IRQHandler(void)
{
}
void FRC_PRI_IRQHandler(void)
{
}
void MODEM_IRQHandler(void)
{
}
@ -150,6 +95,10 @@ void SYNTH_IRQHandler(void) @@ -150,6 +95,10 @@ void SYNTH_IRQHandler(void)
{
}
void HOSTMAILBOX_IRQHandler(void)
{
}
void RDMAILBOX_IRQHandler(void)
{
}

26
modules/hal_silabs/simplicity_sdk/src/sl_btctrl_hci_reset_shim.c

@ -6,16 +6,8 @@ @@ -6,16 +6,8 @@
* Shim for sl_btctrl_hci_reset API
*/
#include <stdbool.h>
bool sl_btctrl_hci_reset_reason_is_sys_reset(void)
{
/* If this function returns true, the LL will emit command complete for HCI Reset during
* init. This only makes sense when the LL runs on a separate device from the host stack.
* Always return false.
*/
return false;
}
#include <zephyr/sys/util.h>
#include <stdint.h>
void sl_btctrl_hci_reset(void)
{
@ -24,3 +16,17 @@ void sl_btctrl_hci_reset(void) @@ -24,3 +16,17 @@ void sl_btctrl_hci_reset(void)
* the LL runs on a separate device from the host stack. Do nothing.
*/
}
void sl_btctrl_reset_set_custom_reason(uint32_t reason)
{
ARG_UNUSED(reason);
}
uint32_t sl_btctrl_reset_get_custom_reason(void)
{
return 0;
}
void sl_btctrl_reset_clear_custom_reason(void)
{
}

Loading…
Cancel
Save