diff --git a/doc/connectivity/bluetooth/api/hci.txt b/doc/connectivity/bluetooth/api/hci.txt index 2ad17bfae5e..a23b24e6ad0 100644 --- a/doc/connectivity/bluetooth/api/hci.txt +++ b/doc/connectivity/bluetooth/api/hci.txt @@ -1085,14 +1085,13 @@ represents. | Event | Event Code | Event Parameters | +-------------------------------+------------+-------------------------------+ | Fatal_Error | 0xFF | Subevent_Code, | -| | | Error_Data_Type, | | | | Error_Data | +-------------------------------+------------+-------------------------------+ -The Error_Data_Type provides an information about what is the Error_Data size -and content. +The Subevent_Code provides an information about what is the Error_Data size and +content. - Error_Data_Type: Size: 1 Octet + Subevent_Code: Size: 1 Octet +--------------------+--------------------------------------+ | Value | Parameter Description | +--------------------+--------------------------------------+ @@ -1157,6 +1156,7 @@ Zephyr Fatal Error event may be generated by k_sys_fatal_error_handler. | a4 | 4 octets | General purpose register | | ip | 4 octets | Instruction pointer register | | lr | 4 octets | Link register | + | pc | 4 octets | Program counter register | | xpsr | 4 octets | Program status register | +--------------------+--------------------------------------------+ diff --git a/doc/releases/migration-guide-4.3.rst b/doc/releases/migration-guide-4.3.rst index e2e6c21b57d..83dc5e77120 100644 --- a/doc/releases/migration-guide-4.3.rst +++ b/doc/releases/migration-guide-4.3.rst @@ -91,10 +91,13 @@ Bluetooth Bluetooth Controller ==================== -* The following Kconfig option have been renamed: +* The following have been renamed: * :kconfig:option:`CONFIG_BT_CTRL_ADV_ADI_IN_SCAN_RSP` to :kconfig:option:`CONFIG_BT_CTLR_ADV_ADI_IN_SCAN_RSP` + * :c:struct:`bt_hci_vs_fata_error_cpu_data_cortex_m` to + :c:struct:`bt_hci_vs_fatal_error_cpu_data_cortex_m` and now contains the program counter + value. .. zephyr-keep-sorted-start re(^\w) diff --git a/include/zephyr/bluetooth/hci_vs.h b/include/zephyr/bluetooth/hci_vs.h index 1170c41474a..904bcbdb2d5 100644 --- a/include/zephyr/bluetooth/hci_vs.h +++ b/include/zephyr/bluetooth/hci_vs.h @@ -222,20 +222,20 @@ struct bt_hci_evt_vs { uint8_t subevent; } __packed; -#define BT_HCI_EVT_VS_FATAL_ERROR 0x02 - #define BT_HCI_EVT_VS_ERROR_DATA_TYPE_STACK_FRAME 0x01 #define BT_HCI_EVT_VS_ERROR_DATA_TYPE_CTRL_ASSERT 0x02 #define BT_HCI_EVT_VS_ERROR_DATA_TYPE_TRACE 0x03 -struct bt_hci_vs_fata_error_cpu_data_cortex_m { +struct bt_hci_vs_fatal_error_cpu_data_cortex_m { uint32_t a1; uint32_t a2; uint32_t a3; uint32_t a4; uint32_t ip; uint32_t lr; + uint32_t pc; uint32_t xpsr; } __packed; + #define BT_HCI_EVT_VS_ERROR_CPU_TYPE_CORTEX_M 0x01 struct bt_hci_vs_fatal_error_stack_frame { uint32_t reason; diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf index 9e322562184..2827eeeeab2 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf @@ -44,8 +44,9 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y -CONFIG_BT_CTLR_ASSERT_HANDLER=y CONFIG_BT_CTLR_DTM_HCI=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y # Rx ACL and Adv Reports CONFIG_BT_CTLR_RX_BUFFERS=9 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf index 89ba46ff357..1ba04dc5dd5 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf @@ -12,6 +12,8 @@ CONFIG_BT_MAX_CONN=16 # Controller CONFIG_BT_LL_SW_SPLIT=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y # Disable unused Bluetooth features CONFIG_BT_CTLR_DUP_FILTER_LEN=0 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf index 740de0cc83e..1f652ddbeb5 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf @@ -43,8 +43,9 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y -CONFIG_BT_CTLR_ASSERT_HANDLER=y CONFIG_BT_CTLR_DTM_HCI=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y # Rx ACL and Adv Reports CONFIG_BT_CTLR_RX_BUFFERS=9 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf index 663751c16e6..7a6f8544986 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf @@ -29,8 +29,9 @@ CONFIG_BT_MAX_CONN=2 # Controller CONFIG_BT_LL_SW_SPLIT=y -CONFIG_BT_CTLR_ASSERT_HANDLER=y CONFIG_BT_CTLR_DTM_HCI=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y # Rx ACL and Adv Reports CONFIG_BT_CTLR_RX_BUFFERS=9 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf index 710530568ac..6016318536b 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf @@ -53,8 +53,9 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y -CONFIG_BT_CTLR_ASSERT_HANDLER=y CONFIG_BT_CTLR_DTM_HCI=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y # Rx ACL and Adv Reports CONFIG_BT_CTLR_RX_BUFFERS=9 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf index c63928dd27c..015a0e102f7 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf @@ -30,6 +30,8 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1 # ISO Broadcast Controller CONFIG_BT_LL_SW_SPLIT=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191 CONFIG_BT_CTLR_ADV_ISO=y diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf index 55e680990ee..6f84bc3d7cf 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf @@ -40,6 +40,8 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf index 0031111ede8..3629ee8c917 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf @@ -40,6 +40,8 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf index c0922ba9f93..1b2e85e7a60 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf @@ -22,6 +22,8 @@ CONFIG_BT_PERIPHERAL=n # ISO Receive Controller CONFIG_BT_LL_SW_SPLIT=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y CONFIG_BT_CTLR_SYNC_PERIODIC=y CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 CONFIG_BT_CTLR_SYNC_ISO=y diff --git a/samples/bluetooth/hci_ipc/src/main.c b/samples/bluetooth/hci_ipc/src/main.c index 3641d5d9896..1dd941b58bd 100644 --- a/samples/bluetooth/hci_ipc/src/main.c +++ b/samples/bluetooth/hci_ipc/src/main.c @@ -307,7 +307,10 @@ void bt_ctlr_assert_handle(char *file, uint32_t line) LOG_PANIC(); while (true) { + k_cpu_idle(); }; + + CODE_UNREACHABLE; } #endif /* CONFIG_BT_CTLR_ASSERT_HANDLER */ @@ -338,6 +341,7 @@ void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *esf) LOG_PANIC(); while (true) { + k_cpu_idle(); }; CODE_UNREACHABLE; diff --git a/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf b/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf index 05fbeb7be78..e5b65559919 100644 --- a/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf @@ -28,8 +28,9 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y -CONFIG_BT_CTLR_ASSERT_HANDLER=y CONFIG_BT_CTLR_DTM_HCI=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_VS_FATAL_ERROR=y # Rx ACL and Adv Reports CONFIG_BT_CTLR_RX_BUFFERS=9 diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index ca1a5bbede4..98107940b94 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -1190,6 +1190,21 @@ rsource "Kconfig.df" rsource "Kconfig.ll_sw_split" rsource "Kconfig.dtm" +config BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE_SUPPORT + bool + +config BT_CTLR_ASSERT_DEBUG + bool "Development asserts" + default y + help + This option enables development asserts used for code coverage. + + The Controller will continue to function without memory leak or corruption with these + assertion checks disabled. Example, run-time mis-aligned memory access etc. which do + otherwise implicitly cause CPU fault during development testing. But these type of + asserted are essentially required for debugging, code and unit test coverage during + development cycle. + config BT_CTLR_ASSERT_HANDLER bool "Application Defined Assertion Handler" help @@ -1199,6 +1214,18 @@ config BT_CTLR_ASSERT_HANDLER and will be invoked whenever the controller code encounters an unrecoverable error. +config BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE + bool "Assertions optimized for code size" + depends on BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE_SUPPORT + default y + help + Optimize Controller assertion check for code size. + + Example, reduces assertion check code size for ARM Cortex-M CPUs by using the undefined + instruction exception. + `arm-none-eabi-addr2line` commandline can be used to get the source file and line number + from the program counter value. + config BT_CTLR_VS_SCAN_REQ_RX bool "Use scan request reporting" depends on BT_HCI_VS && !BT_CTLR_ADV_EXT diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index 950e9bc7e58..b6774d63c7c 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -22,8 +22,7 @@ config BT_LLL_VENDOR_NORDIC !BT_CTLR_DATA_LENGTH_CLEAR && \ !BT_CTLR_PHY_2M_NRF select BT_CTLR_PRIVACY_SUPPORT if BT_CTLR_CRYPTO_SUPPORT && \ - !SOC_SERIES_NRF51X && \ - !SOC_COMPATIBLE_NRF54LX + !SOC_SERIES_NRF51X select BT_CTLR_CONN_PARAM_REQ_SUPPORT select BT_CTLR_EXT_REJ_IND_SUPPORT select BT_CTLR_PER_INIT_FEAT_XCHG_SUPPORT @@ -70,6 +69,8 @@ config BT_LLL_VENDOR_NORDIC select BT_TICKER_PREFER_START_BEFORE_STOP if BT_TICKER_SLOT_AGNOSTIC + select BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE_SUPPORT if CPU_CORTEX_M + default y help Use Nordic Lower Link Layer implementation. diff --git a/subsys/bluetooth/controller/hal/debug.h b/subsys/bluetooth/controller/hal/debug.h index 653aa304b07..98e827534fe 100644 --- a/subsys/bluetooth/controller/hal/debug.h +++ b/subsys/bluetooth/controller/hal/debug.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Nordic Semiconductor ASA + * Copyright (c) 2016-2025 Nordic Semiconductor ASA * Copyright (c) 2016 Vinayak Kariappa Chettimada * * SPDX-License-Identifier: Apache-2.0 @@ -7,25 +7,79 @@ #include "common/assert.h" -#ifdef CONFIG_BT_CTLR_ASSERT_HANDLER +#if defined(CONFIG_BT_CTLR_ASSERT_HANDLER) void bt_ctlr_assert_handle(char *file, uint32_t line); + +#if defined(CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE) +BUILD_ASSERT(IS_ENABLED(CONFIG_CPU_CORTEX_M)); +/* Generate assertion as undefined instruction exception. + */ +#define LL_ASSERT(x) \ + do { \ + if (unlikely(!(x))) { \ + __asm__ inline volatile (".inst 0xde00\n"); \ + } \ + } while (0) + +#else /* !CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE */ +/* Generate assertion with file name and line number. + * NOTE: Variable code size increase per assertion check, depends on full file name path string + * length. + */ #define LL_ASSERT(cond) \ - if (!(cond)) { \ + if (unlikely(!(cond))) { \ BT_ASSERT_PRINT(cond); \ bt_ctlr_assert_handle(__FILE__, __LINE__); \ } +#endif /* !CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE */ + #define LL_ASSERT_MSG(cond, fmt, ...) \ - if (!(cond)) { \ + if (unlikely(!(cond))) { \ BT_ASSERT_PRINT(cond); \ BT_ASSERT_PRINT_MSG(fmt, ##__VA_ARGS__); \ bt_ctlr_assert_handle(__FILE__, __LINE__); \ } -#else + +#else /* !CONFIG_BT_CTLR_ASSERT_HANDLER */ + +#if defined(CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE) +BUILD_ASSERT(IS_ENABLED(CONFIG_CPU_CORTEX_M)); +/* Generate assertion as undefined instruction exception. + */ +#define LL_ASSERT(x) \ + do { \ + if (unlikely(!(x))) { \ + __asm__ inline volatile (".inst 0xde00\n"); \ + } \ + } while (0) + +#else /* !CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE */ #define LL_ASSERT(cond) \ BT_ASSERT(cond) +#endif /* !CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE */ + #define LL_ASSERT_MSG(cond, fmt, ...) \ BT_ASSERT_MSG(cond, fmt, ##__VA_ARGS__) -#endif +#endif /* !CONFIG_BT_CTLR_ASSERT_HANDLER */ + +/* Fatal asserts. + * The Controller will otherwise misbehave causing memory leak or system-wide memory corruptions due + * to uncontrolled DMA transfers etc. + * It is not safe to disable these assertion checks. + */ +#define LL_ASSERT_ERR(cond) LL_ASSERT(cond) + +/* Development asserts. + * The Controller will continue to function without memory leak or corruption with these assertion + * checks disabled. Example, run-time mis-aligned memory access etc. which do otherwise implicitly + * cause CPU fault during development testing. But these type of asserted are essentially required + * for debugging, code and unit test coverage during development cycle. + */ +#if defined(CONFIG_BT_CTLR_ASSERT_DEBUG) +#define LL_ASSERT_DBG(cond) LL_ASSERT(cond) +#else /* !CONFIG_BT_CTLR_ASSERT_DEBUG */ +#define LL_ASSERT_DBG(cond) ARG_UNUSED((cond)) +#endif /* !CONFIG_BT_CTLR_ASSERT_DEBUG */ #if defined(CONFIG_BT_CTLR_ASSERT_VENDOR) #define LL_ASSERT_INFO1(cond, param) \ diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c index 683c4cadf91..81856d7c428 100644 --- a/subsys/bluetooth/controller/hci/hci.c +++ b/subsys/bluetooth/controller/hci/hci.c @@ -3222,7 +3222,7 @@ static void le_df_connection_iq_report(struct node_rx_pdu *node_rx, struct net_b phy_rx = lll->phy_rx; /* Make sure the report is generated for connection on PHY UNCODED */ - LL_ASSERT(phy_rx != PHY_CODED); + LL_ASSERT_DBG(phy_rx != PHY_CODED); #else phy_rx = PHY_1M; #endif /* CONFIG_BT_CTLR_PHY */ @@ -4412,7 +4412,7 @@ static void le_cis_request(struct pdu_data *pdu_data, * event. */ node = pdu_data; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_conn_iso_estab)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_conn_iso_estab)); req = node; if (!(ll_feat_get() & BIT64(BT_LE_FEAT_BIT_ISO_CHANNELS)) || @@ -4459,7 +4459,7 @@ static void le_cis_established(struct pdu_data *pdu_data, * event. */ node = pdu_data; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_conn_iso_estab)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_conn_iso_estab)); est = node; sep->status = est->status; @@ -4518,7 +4518,7 @@ static void le_per_adv_sync_transfer_received(struct pdu_data *pdu_data_rx, * event. */ node = pdu_data_rx; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_past_received)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_past_received)); se = node; sep->status = se->rx_sync.status; @@ -5273,9 +5273,9 @@ NET_BUF_POOL_FIXED_DEFINE(vs_err_tx_pool, 1, BT_BUF_EVT_RX_SIZE, 0, NULL); * the alias is defined here. */ #if defined(CONFIG_CPU_CORTEX_M) -typedef struct bt_hci_vs_fata_error_cpu_data_cortex_m bt_hci_vs_fatal_error_cpu_data; +static struct net_buf *vs_err_evt_create(uint8_t subevt, uint8_t len); -static void vs_err_fatal_cpu_data_fill(bt_hci_vs_fatal_error_cpu_data *cpu_data, +static void vs_err_fatal_cpu_data_fill(struct bt_hci_vs_fatal_error_cpu_data_cortex_m *cpu_data, const struct arch_esf *esf) { cpu_data->a1 = sys_cpu_to_le32(esf->basic.a1); @@ -5284,9 +5284,38 @@ static void vs_err_fatal_cpu_data_fill(bt_hci_vs_fatal_error_cpu_data *cpu_data, cpu_data->a4 = sys_cpu_to_le32(esf->basic.a4); cpu_data->ip = sys_cpu_to_le32(esf->basic.ip); cpu_data->lr = sys_cpu_to_le32(esf->basic.lr); + cpu_data->pc = sys_cpu_to_le32(esf->basic.pc); cpu_data->xpsr = sys_cpu_to_le32(esf->basic.xpsr); } -#endif /* CONFIG_CPU_CORTEX_M */ + +struct net_buf *hci_vs_err_stack_frame(unsigned int reason, const struct arch_esf *esf) +{ + /* Prepare vendor specific HCI Fatal Error event */ + struct bt_hci_vs_fatal_error_stack_frame *sf; + struct bt_hci_vs_fatal_error_cpu_data_cortex_m *cpu_data; + struct net_buf *buf; + + buf = vs_err_evt_create(BT_HCI_EVT_VS_ERROR_DATA_TYPE_STACK_FRAME, + sizeof(*sf) + sizeof(*cpu_data)); + if (buf != NULL) { + sf = net_buf_add(buf, (sizeof(*sf) + sizeof(*cpu_data))); + sf->reason = sys_cpu_to_le32(reason); + sf->cpu_type = BT_HCI_EVT_VS_ERROR_CPU_TYPE_CORTEX_M; + + vs_err_fatal_cpu_data_fill((void *)sf->cpu_data, esf); + } else { + LOG_WRN("Can't create HCI Fatal Error event"); + } + + return buf; +} + +#else /* !CONFIG_CPU_CORTEX_M */ +struct net_buf *hci_vs_err_stack_frame(unsigned int reason, const struct arch_esf *esf) +{ + return NULL; +} +#endif /* !CONFIG_CPU_CORTEX_M */ static struct net_buf *vs_err_evt_create(uint8_t subevt, uint8_t len) { @@ -5310,29 +5339,6 @@ static struct net_buf *vs_err_evt_create(uint8_t subevt, uint8_t len) return buf; } -struct net_buf *hci_vs_err_stack_frame(unsigned int reason, const struct arch_esf *esf) -{ - /* Prepare vendor specific HCI Fatal Error event */ - struct bt_hci_vs_fatal_error_stack_frame *sf; - bt_hci_vs_fatal_error_cpu_data *cpu_data; - struct net_buf *buf; - - buf = vs_err_evt_create(BT_HCI_EVT_VS_ERROR_DATA_TYPE_STACK_FRAME, - sizeof(*sf) + sizeof(*cpu_data)); - if (buf != NULL) { - sf = net_buf_add(buf, (sizeof(*sf) + sizeof(*cpu_data))); - sf->reason = sys_cpu_to_le32(reason); - sf->cpu_type = BT_HCI_EVT_VS_ERROR_CPU_TYPE_CORTEX_M; - - vs_err_fatal_cpu_data_fill( - (bt_hci_vs_fatal_error_cpu_data *)sf->cpu_data, esf); - } else { - LOG_ERR("Can't create HCI Fatal Error event"); - } - - return buf; -} - static struct net_buf *hci_vs_err_trace_create(uint8_t data_type, const char *file_path, uint32_t line, uint64_t pc) @@ -5520,7 +5526,7 @@ static void vs_le_df_connection_iq_report(struct node_rx_pdu *node_rx, struct ne phy_rx = lll->phy_rx; /* Make sure the report is generated for connection on PHY UNCODED */ - LL_ASSERT(phy_rx != PHY_CODED); + LL_ASSERT_DBG(phy_rx != PHY_CODED); #else phy_rx = PHY_1M; #endif /* CONFIG_BT_CTLR_PHY */ @@ -6300,7 +6306,7 @@ int hci_iso_handle(struct net_buf *buf, struct net_buf **evt) /* Start Fragmentation */ /* FIXME: need to ensure ISO-AL returns proper isoal_status. - * Currently there are cases where ISO-AL calls LL_ASSERT. + * Currently there are cases where ISO-AL calls LL_ASSERT_ERR. */ isoal_status_t isoal_status = isoal_tx_sdu_fragment(stream->dp->source_hdl, &sdu_frag_tx); @@ -6554,7 +6560,7 @@ static inline void le_dir_adv_report(struct pdu_adv *adv, struct net_buf *buf, return; } - LL_ASSERT(adv->type == PDU_ADV_TYPE_DIRECT_IND); + LL_ASSERT_DBG(adv->type == PDU_ADV_TYPE_DIRECT_IND); #if CONFIG_BT_CTLR_DUP_FILTER_LEN > 0 if (dup_scan && @@ -6624,7 +6630,7 @@ static inline void le_mesh_scan_report(struct pdu_adv *adv, uint32_t instant; uint8_t chan; - LL_ASSERT(adv->type == PDU_ADV_TYPE_NONCONN_IND); + LL_ASSERT_DBG(adv->type == PDU_ADV_TYPE_NONCONN_IND); /* Filter based on currently active Scan Filter */ if (sf_curr < ARRAY_SIZE(scan_filters) && @@ -7093,7 +7099,7 @@ static void ext_adv_pdu_frag(uint8_t evt_type, uint8_t phy, uint8_t sec_phy, *data_len_total -= data_len_frag; *evt_buf = bt_buf_get_rx(BT_BUF_EVT, BUF_GET_TIMEOUT); - LL_ASSERT(*evt_buf); + LL_ASSERT_ERR(*evt_buf); net_buf_frag_add(buf, *evt_buf); @@ -7630,7 +7636,7 @@ static void le_ext_adv_report(struct pdu_data *pdu_data, * event. */ evt_buf = bt_buf_get_rx(BT_BUF_EVT, BUF_GET_TIMEOUT); - LL_ASSERT(evt_buf); + LL_ASSERT_ERR(evt_buf); net_buf_frag_add(buf, evt_buf); @@ -7726,7 +7732,7 @@ static void le_per_adv_sync_established(struct pdu_data *pdu_data, * event. */ node = pdu_data; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_sync)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_sync)); se = node; sep->status = se->status; @@ -8006,7 +8012,7 @@ static void le_per_adv_sync_report(struct pdu_data *pdu_data, data_status = BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS_PARTIAL; evt_buf = bt_buf_get_rx(BT_BUF_EVT, BUF_GET_TIMEOUT); - LL_ASSERT(evt_buf); + LL_ASSERT_ERR(evt_buf); net_buf_frag_add(buf, evt_buf); @@ -8062,7 +8068,7 @@ static void le_per_adv_sync_report(struct pdu_data *pdu_data, */ if (!evt_buf) { evt_buf = bt_buf_get_rx(BT_BUF_EVT, BUF_GET_TIMEOUT); - LL_ASSERT(evt_buf); + LL_ASSERT_ERR(evt_buf); net_buf_frag_add(buf, evt_buf); } @@ -8147,7 +8153,7 @@ static void le_big_sync_established(struct pdu_data *pdu, * established event. */ node = pdu; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_sync_iso)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_sync_iso)); se = node; sep->status = se->status; @@ -8451,7 +8457,7 @@ static void le_conn_complete(struct pdu_data *pdu_data, uint16_t handle, * complete event. */ node = pdu_data; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_cc)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_cc)); cc = node; status = cc->status; @@ -8588,7 +8594,7 @@ static void le_conn_update_complete(struct pdu_data *pdu_data, uint16_t handle, * update complete event. */ node = pdu_data; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_cu)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_cu)); cu = node; sep->status = cu->status; @@ -8845,7 +8851,7 @@ static void encode_control(struct node_rx_pdu *node_rx, #elif defined(CONFIG_BT_CTLR_VS_SCAN_REQ_RX) le_vs_scan_req_received(pdu_data, node_rx, buf); #else - LL_ASSERT(0); + LL_ASSERT_DBG(0); #endif /* CONFIG_BT_CTLR_ADV_EXT */ break; #endif /* CONFIG_BT_CTLR_SCAN_REQ_NOTIFY */ @@ -8984,7 +8990,7 @@ static void encode_control(struct node_rx_pdu *node_rx, #endif /* CONFIG_BT_CTLR_USER_EVT_RANGE > 0 */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); return; } } @@ -9212,7 +9218,7 @@ static void encode_data_ctrl(struct node_rx_pdu *node_rx, break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); return; } } @@ -9243,20 +9249,20 @@ void hci_acl_encode(struct node_rx_pdu *node_rx, struct net_buf *buf) memcpy(data, pdu_data->lldata, pdu_data->len); #if defined(CONFIG_BT_HCI_ACL_FLOW_CONTROL) if (hci_hbuf_total > 0) { - LL_ASSERT((hci_hbuf_sent - hci_hbuf_acked) < + LL_ASSERT_DBG((hci_hbuf_sent - hci_hbuf_acked) < hci_hbuf_total); hci_hbuf_sent++; /* Note: This requires linear handle values starting * from 0 */ - LL_ASSERT(handle < ARRAY_SIZE(hci_hbuf_pend)); + LL_ASSERT_DBG(handle < ARRAY_SIZE(hci_hbuf_pend)); hci_hbuf_pend[handle]++; } #endif /* CONFIG_BT_HCI_ACL_FLOW_CONTROL */ break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } diff --git a/subsys/bluetooth/controller/hci/hci_driver.c b/subsys/bluetooth/controller/hci/hci_driver.c index 8f3fd04d8e9..43b2ad1ef65 100644 --- a/subsys/bluetooth/controller/hci/hci_driver.c +++ b/subsys/bluetooth/controller/hci/hci_driver.c @@ -91,21 +91,20 @@ isoal_status_t sink_sdu_alloc_hci(const struct isoal_sink *sink_ctx, const struct isoal_pdu_rx *valid_pdu, struct isoal_sdu_buffer *sdu_buffer) { + struct net_buf *buf; + ARG_UNUSED(sink_ctx); ARG_UNUSED(valid_pdu); /* TODO copy valid pdu into netbuf ? */ - struct net_buf *buf = bt_buf_get_rx(BT_BUF_ISO_IN, K_FOREVER); + buf = bt_buf_get_rx(BT_BUF_ISO_IN, K_FOREVER); + LL_ASSERT_ERR(buf); - if (buf) { - /* Increase reserved space for headers */ - net_buf_reset(buf); - net_buf_reserve(buf, BT_BUF_RESERVE + SDU_HCI_HDR_SIZE); - - sdu_buffer->dbuf = buf; - sdu_buffer->size = net_buf_tailroom(buf); - } else { - LL_ASSERT(0); - } + /* Increase reserved space for headers */ + net_buf_reset(buf); + net_buf_reserve(buf, BT_BUF_RESERVE + SDU_HCI_HDR_SIZE); + + sdu_buffer->dbuf = buf; + sdu_buffer->size = net_buf_tailroom(buf); return ISOAL_STATUS_OK; } @@ -212,11 +211,13 @@ isoal_status_t sink_sdu_write_hci(void *dbuf, const uint8_t *pdu_payload, const size_t consume_len) { + struct net_buf *buf; + ARG_UNUSED(sdu_written); - struct net_buf *buf = (struct net_buf *) dbuf; + buf = (struct net_buf *) dbuf; + LL_ASSERT_ERR(buf); - LL_ASSERT(buf); net_buf_add_mem(buf, pdu_payload, consume_len); return ISOAL_STATUS_OK; @@ -364,7 +365,7 @@ static void prio_recv_thread(void *p1, void *p2, void *p3) LOG_DBG("Num Complete: 0x%04x:%u", handle, num_cmplt); err = bt_recv_prio(dev, buf); - LL_ASSERT(err == 0); + LL_ASSERT_DBG(err == 0); k_yield(); #endif /* CONFIG_BT_CONN || CONFIG_BT_CTLR_ADV_ISO */ @@ -392,7 +393,7 @@ static void prio_recv_thread(void *p1, void *p2, void *p3) } err = bt_recv_prio(dev, buf); - LL_ASSERT(err == 0); + LL_ASSERT_DBG(err == 0); /* bt_recv_prio would not release normal evt * buf. @@ -470,7 +471,7 @@ static void node_rx_recv(const struct device *dev) #if defined(CONFIG_BT_CONN) || defined(CONFIG_BT_CTLR_ADV_ISO) struct net_buf *buf; - LL_ASSERT(node_rx == NULL); + LL_ASSERT_DBG(node_rx == NULL); buf = bt_buf_get_evt(BT_HCI_EVT_NUM_COMPLETED_PACKETS, false, K_FOREVER); @@ -482,7 +483,7 @@ static void node_rx_recv(const struct device *dev) k_yield(); #else /* !CONFIG_BT_CONN && !CONFIG_BT_CTLR_ADV_ISO */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); #endif /* !CONFIG_BT_CONN && !CONFIG_BT_CTLR_ADV_ISO */ num_cmplt = ll_rx_get((void *)&node_rx, &handle); @@ -589,7 +590,7 @@ static inline struct net_buf *encode_node(struct node_rx_pdu *node_rx, isoal_rx_pdu_recombine(dp->sink_hdl, &pckt_meta); /* TODO handle err */ - LL_ASSERT(err == ISOAL_STATUS_OK); + LL_ASSERT_ERR(err == ISOAL_STATUS_OK); } } #endif /* CONFIG_BT_CTLR_CONN_ISO */ @@ -613,13 +614,13 @@ static inline struct net_buf *encode_node(struct node_rx_pdu *node_rx, isoal_rx.pdu = (void *)node_rx->pdu; err = isoal_rx_pdu_recombine(stream->dp->sink_hdl, &isoal_rx); - LL_ASSERT(err == ISOAL_STATUS_OK || - err == ISOAL_STATUS_ERR_SDU_ALLOC); + LL_ASSERT_ERR(err == ISOAL_STATUS_OK || + err == ISOAL_STATUS_ERR_SDU_ALLOC); } #endif /* CONFIG_BT_CTLR_SYNC_ISO */ } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } node_rx->hdr.next = NULL; @@ -630,7 +631,7 @@ static inline struct net_buf *encode_node(struct node_rx_pdu *node_rx, #endif /* CONFIG_BT_CTLR_SYNC_ISO || CONFIG_BT_CTLR_CONN_ISO */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -668,7 +669,7 @@ static inline struct net_buf *process_node(struct node_rx_pdu *node_rx) } break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -741,7 +742,7 @@ static inline struct net_buf *process_hbuf(struct node_rx_pdu *n) case HCI_CLASS_EVT_DISCARDABLE: case HCI_CLASS_EVT_REQUIRED: default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -823,7 +824,7 @@ static void recv_thread(void *p1, void *p2, void *p3) int err; err = k_poll(events, ARRAY_SIZE(events), K_FOREVER); - LL_ASSERT(err == 0 || err == -EINTR); + LL_ASSERT_ERR(err == 0 || err == -EINTR); if (false) { @@ -835,7 +836,7 @@ static void recv_thread(void *p1, void *p2, void *p3) #if !defined(CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE) } else if (events[EVENT_SEM].state == K_POLL_STATE_SEM_AVAILABLE) { err = k_sem_take(events[EVENT_SEM].sem, K_NO_WAIT); - LL_ASSERT(err == 0); + LL_ASSERT_DBG(err == 0); node_rx_recv(dev); #endif /* !CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE */ @@ -1047,7 +1048,7 @@ static int hci_driver_close(const struct device *dev) /* Resetting the LL stops all roles */ err = ll_deinit(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #if defined(CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE) /* Abort prio RX thread */ diff --git a/subsys/bluetooth/controller/include/ll.h b/subsys/bluetooth/controller/include/ll.h index 378686064e1..f807842e6c3 100644 --- a/subsys/bluetooth/controller/include/ll.h +++ b/subsys/bluetooth/controller/include/ll.h @@ -1,63 +1,39 @@ /* - * Copyright (c) 2016-2021 Nordic Semiconductor ASA + * Copyright (c) 2016-2025 Nordic Semiconductor ASA * Copyright (c) 2016 Vinayak Kariappa Chettimada * * SPDX-License-Identifier: Apache-2.0 */ +#if defined(CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING) +#define LL_ADV_HANDLE_MAPPING +#else /* !CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING */ +#define LL_ADV_HANDLE_MAPPING static __attribute__((always_inline)) inline +#endif /* !CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING */ + +/* Initialization and Reset Interfaces */ int ll_init(struct k_sem *sem_rx); int ll_deinit(void); void ll_reset(void); +/* Features Interfaces */ uint8_t ll_set_host_feature(uint8_t bit_number, uint8_t bit_value); uint64_t ll_feat_get(void); +/* Device Address Interfaces */ uint8_t ll_addr_set(uint8_t addr_type, uint8_t const *const p_bdaddr); uint8_t *ll_addr_get(uint8_t addr_type); uint8_t *ll_addr_read(uint8_t addr_type, uint8_t *const bdaddr); -#if defined(CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING) -uint8_t ll_adv_set_by_hci_handle_get(uint8_t hci_handle, uint8_t *handle); -uint8_t ll_adv_set_by_hci_handle_get_or_new(uint8_t hci_handle, - uint8_t *handle); -uint8_t ll_adv_set_hci_handle_get(uint8_t handle); -uint8_t ll_adv_iso_by_hci_handle_get(uint8_t hci_handle, uint8_t *handle); -uint8_t ll_adv_iso_by_hci_handle_new(uint8_t hci_handle, uint8_t *handle); -#else -static inline uint8_t ll_adv_set_by_hci_handle_get(uint8_t hci_handle, - uint8_t *handle) -{ - *handle = hci_handle; - return 0; -} - -static inline uint8_t ll_adv_set_by_hci_handle_get_or_new(uint8_t hci_handle, - uint8_t *handle) -{ - *handle = hci_handle; - return 0; -} - -static inline uint8_t ll_adv_set_hci_handle_get(uint8_t handle) -{ - return handle; -} - -static inline uint8_t ll_adv_iso_by_hci_handle_get(uint8_t hci_handle, - uint8_t *handle) -{ - *handle = hci_handle; - return 0; -} - -static inline uint8_t ll_adv_iso_by_hci_handle_new(uint8_t hci_handle, - uint8_t *handle) -{ - *handle = hci_handle; - return 0; -} -#endif +/* Advertising Handles Interfaces */ +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_set_by_hci_handle_get(uint8_t hci_handle, uint8_t *handle); +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_set_by_hci_handle_get_or_new(uint8_t hci_handle, + uint8_t *handle); +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_set_hci_handle_get(uint8_t handle); +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_iso_by_hci_handle_get(uint8_t hci_handle, uint8_t *handle); +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_iso_by_hci_handle_new(uint8_t hci_handle, uint8_t *handle); +/* Advertising State Interfaces */ #if defined(CONFIG_BT_CTLR_ADV_EXT) uint8_t ll_adv_params_set(uint8_t handle, uint16_t evt_prop, uint32_t interval, uint8_t adv_type, uint8_t own_addr_type, @@ -78,6 +54,7 @@ uint8_t ll_adv_data_set(uint8_t len, uint8_t const *const p_data); uint8_t ll_adv_scan_rsp_set(uint8_t len, uint8_t const *const p_data); #endif /* !CONFIG_BT_CTLR_ADV_EXT */ +/* Extended Advertising State Interfaces */ uint8_t ll_adv_aux_random_addr_set(uint8_t handle, uint8_t const *const addr); uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, uint8_t len, uint8_t const *const data); @@ -87,12 +64,15 @@ uint16_t ll_adv_aux_max_data_length_get(void); uint8_t ll_adv_aux_set_count_get(void); uint8_t ll_adv_aux_set_remove(uint8_t handle); uint8_t ll_adv_aux_set_clear(void); + +/* Periodic Advertising State Interfaces */ uint8_t ll_adv_sync_param_set(uint8_t handle, uint16_t interval, uint16_t flags); uint8_t ll_adv_sync_ad_data_set(uint8_t handle, uint8_t op, uint8_t len, uint8_t const *const data); uint8_t ll_adv_sync_enable(uint8_t handle, uint8_t enable); +/* Advertising Enable and Disable Interfaces */ #if defined(CONFIG_BT_CTLR_ADV_EXT) || defined(CONFIG_BT_HCI_MESH_EXT) #if defined(CONFIG_BT_HCI_MESH_EXT) uint8_t ll_adv_enable(uint8_t handle, uint8_t enable, @@ -108,6 +88,7 @@ uint8_t ll_adv_enable(uint8_t enable); uint8_t ll_adv_disable_all(void); +/* Broadcast ISO State Interfaces */ uint8_t ll_big_create(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bis, uint32_t sdu_interval, uint16_t max_sdu, uint16_t max_latency, uint8_t rtn, uint8_t phy, @@ -121,6 +102,7 @@ uint8_t ll_big_test_create(uint8_t big_handle, uint8_t adv_handle, uint8_t pto, uint8_t encryption, uint8_t *bcode); uint8_t ll_big_terminate(uint8_t big_handle, uint8_t reason); +/* Scanning State Interfaces */ uint8_t ll_scan_params_set(uint8_t type, uint16_t interval, uint16_t window, uint8_t own_addr_type, uint8_t filter_policy); #if defined(CONFIG_BT_CTLR_ADV_EXT) @@ -129,24 +111,30 @@ uint8_t ll_scan_enable(uint8_t enable, uint16_t duration, uint16_t period); uint8_t ll_scan_enable(uint8_t enable); #endif /* !CONFIG_BT_CTLR_ADV_EXT */ +/* Periodic Advertising Sync State Interfaces */ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type, uint8_t *adv_addr, uint16_t skip, uint16_t sync_timeout, uint8_t sync_cte_type); uint8_t ll_sync_create_cancel(void **rx); uint8_t ll_sync_terminate(uint16_t handle); uint8_t ll_sync_recv_enable(uint16_t handle, uint8_t enable); + +/* Periodic Advertising Sync Transfer Interfaces */ uint8_t ll_sync_transfer(uint16_t conn_handle, uint16_t service_data, uint16_t sync_handle); uint8_t ll_adv_sync_set_info_transfer(uint16_t conn_handle, uint16_t service_data, uint8_t adv_handle); uint8_t ll_past_param(uint16_t conn_handle, uint8_t mode, uint16_t skip, uint16_t timeout, uint8_t cte_type); uint8_t ll_default_past_param(uint8_t mode, uint16_t skip, uint16_t timeout, uint8_t cte_type); + +/* Broadcast ISO Sync Receiver State Interfaces */ uint8_t ll_big_sync_create(uint8_t big_handle, uint16_t sync_handle, uint8_t encryption, uint8_t *bcode, uint8_t mse, uint16_t sync_timeout, uint8_t num_bis, uint8_t *bis); uint8_t ll_big_sync_terminate(uint8_t big_handle, void **rx); +/* Connected ISO State Interfaces */ uint8_t ll_cig_parameters_open(uint8_t cig_id, uint32_t c_interval, uint32_t p_interval, uint8_t sca, uint8_t packing, uint8_t framing, @@ -172,6 +160,15 @@ uint8_t ll_cis_parameters_test_set(uint8_t cis_id, uint8_t nse, uint16_t c_pdu, uint16_t p_pdu, uint8_t c_phy, uint8_t p_phy, uint8_t c_bn, uint8_t p_bn); +uint8_t ll_cig_remove(uint8_t cig_id); +uint8_t ll_cis_create_check(uint16_t cis_handle, uint16_t acl_handle); +void ll_cis_create(uint16_t cis_handle, uint16_t acl_handle); +uint8_t ll_cis_accept(uint16_t handle); +uint8_t ll_cis_reject(uint16_t handle, uint8_t reason); +uint8_t ll_conn_iso_accept_timeout_get(uint16_t *timeout); +uint8_t ll_conn_iso_accept_timeout_set(uint16_t timeout); + +/* ISO SDU data Interfaces */ /* Must be implemented by vendor if vendor-specific data path is supported */ uint8_t ll_configure_data_path(uint8_t data_path_dir, uint8_t data_path_id, @@ -200,24 +197,19 @@ uint8_t ll_iso_read_test_counters(uint16_t handle, uint32_t *received_cnt, uint32_t *missed_cnt, uint32_t *failed_cnt); -uint8_t ll_cig_remove(uint8_t cig_id); - -uint8_t ll_cis_create_check(uint16_t cis_handle, uint16_t acl_handle); -void ll_cis_create(uint16_t cis_handle, uint16_t acl_handle); - -uint8_t ll_cis_accept(uint16_t handle); -uint8_t ll_cis_reject(uint16_t handle, uint8_t reason); - +/* Filter Accept List Interfaces */ uint8_t ll_fal_size_get(void); uint8_t ll_fal_clear(void); uint8_t ll_fal_add(bt_addr_le_t *addr); uint8_t ll_fal_remove(bt_addr_le_t *addr); +/* Privacy Accept List Interfaces */ uint8_t ll_pal_size_get(void); uint8_t ll_pal_clear(void); uint8_t ll_pal_add(const bt_addr_le_t *const addr, const uint8_t sid); uint8_t ll_pal_remove(const bt_addr_le_t *const addr, const uint8_t sid); +/* Private Resolvable Address Resolution Interfaces */ void ll_rl_id_addr_get(uint8_t rl_idx, uint8_t *id_addr_type, uint8_t *id_addr); uint8_t ll_rl_size_get(void); uint8_t ll_rl_clear(void); @@ -231,6 +223,7 @@ uint8_t ll_rl_enable(uint8_t enable); void ll_rl_timeout_set(uint16_t timeout); uint8_t ll_priv_mode_set(bt_addr_le_t *id_addr, uint8_t mode); +/* Connection State Interfaces */ #if defined(CONFIG_BT_CTLR_ADV_EXT) uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window, uint8_t filter_policy, uint8_t peer_addr_type, @@ -267,10 +260,10 @@ uint8_t ll_tx_pwr_lvl_set(uint8_t handle_type, uint16_t handle, uint8_t ll_apto_get(uint16_t handle, uint16_t *const apto); uint8_t ll_apto_set(uint16_t handle, uint16_t apto); -uint32_t ll_length_req_send(uint16_t handle, uint16_t tx_octets, uint16_t tx_time); +uint8_t ll_length_req_send(uint16_t handle, uint16_t tx_octets, uint16_t tx_time); void ll_length_default_get(uint16_t *const max_tx_octets, uint16_t *const max_tx_time); -uint32_t ll_length_default_set(uint16_t max_tx_octets, uint16_t max_tx_time); +uint8_t ll_length_default_set(uint16_t max_tx_octets, uint16_t max_tx_time); void ll_length_max_get(uint16_t *const max_tx_octets, uint16_t *const max_tx_time, uint16_t *const max_rx_octets, @@ -283,7 +276,7 @@ uint8_t ll_phy_req_send(uint16_t handle, uint8_t tx, uint8_t flags, uint8_t rx); uint8_t ll_set_min_used_chans(uint16_t handle, uint8_t const phys, uint8_t const min_used_chans); -/* Direction Finding */ +/* Direction Finding Interfaces */ /* Sets CTE transmission parameters for periodic advertising */ uint8_t ll_df_set_cl_cte_tx_params(uint8_t adv_handle, uint8_t cte_len, uint8_t cte_type, uint8_t cte_count, @@ -316,12 +309,21 @@ void ll_df_read_ant_inf(uint8_t *switch_sample_rates, uint8_t *max_switch_pattern_len, uint8_t *max_cte_len); -/* Downstream - Data */ +/* Path Loss Monitoring Interfaces */ +uint8_t ll_conn_set_path_loss_parameters(uint16_t handle, + uint8_t high_threshold, + uint8_t high_hysteresis, + uint8_t low_threshold, + uint8_t low_hysteresis, + uint16_t min_time_spent); +uint8_t ll_conn_set_path_loss_reporting(uint16_t handle, uint8_t enable); + +/* Downstream - ACL Data */ void *ll_tx_mem_acquire(void); void ll_tx_mem_release(void *node_tx); int ll_tx_mem_enqueue(uint16_t handle, void *node_tx); -/* Upstream - Num. Completes, Events and Data */ +/* Upstream - Num. Completes, Events, ACL and ISO Data */ uint8_t ll_rx_get(void **node_rx, uint16_t *handle); void ll_rx_dequeue(void); void ll_rx_mem_release(void **node_rx); @@ -333,9 +335,6 @@ void ll_iso_tx_mem_release(void *tx); int ll_iso_tx_mem_enqueue(uint16_t handle, void *tx, void *link); void ll_iso_link_tx_release(void *link); -uint8_t ll_conn_iso_accept_timeout_get(uint16_t *timeout); -uint8_t ll_conn_iso_accept_timeout_set(uint16_t timeout); - /* External co-operation */ void ll_timeslice_ticker_id_get(uint8_t * const instance_index, uint8_t * const ticker_id); @@ -344,11 +343,35 @@ void ll_coex_ticker_id_get(uint8_t * const instance_index, void ll_radio_state_abort(void); uint32_t ll_radio_state_is_idle(void); -uint8_t ll_conn_set_path_loss_parameters(uint16_t handle, - uint8_t high_threshold, - uint8_t high_hysteresis, - uint8_t low_threshold, - uint8_t low_hysteresis, - uint16_t min_time_spent); +/* Static inline functions */ +#if !defined(CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING) +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_set_by_hci_handle_get(uint8_t hci_handle, uint8_t *handle) +{ + *handle = hci_handle; + return 0U; +} -uint8_t ll_conn_set_path_loss_reporting(uint16_t handle, uint8_t enable); +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_set_by_hci_handle_get_or_new(uint8_t hci_handle, + uint8_t *handle) +{ + *handle = hci_handle; + return 0U; +} + +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_set_hci_handle_get(uint8_t handle) +{ + return handle; +} + +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_iso_by_hci_handle_get(uint8_t hci_handle, uint8_t *handle) +{ + *handle = hci_handle; + return 0U; +} + +LL_ADV_HANDLE_MAPPING uint8_t ll_adv_iso_by_hci_handle_new(uint8_t hci_handle, uint8_t *handle) +{ + *handle = hci_handle; + return 0U; +} +#endif /* !CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING */ diff --git a/subsys/bluetooth/controller/include/ll_feat.h b/subsys/bluetooth/controller/include/ll_feat.h index 94644172076..9e5cd3144b7 100644 --- a/subsys/bluetooth/controller/include/ll_feat.h +++ b/subsys/bluetooth/controller/include/ll_feat.h @@ -63,11 +63,11 @@ #define LL_FEAT_BIT_EXT_SCAN 0 #endif /* !CONFIG_BT_CTLR_EXT_SCAN_FP */ -#if defined(CONFIG_BT_CTLR_PHY_2M) +#if defined(CONFIG_BT_CTLR_PHY) && defined(CONFIG_BT_CTLR_PHY_2M) #define LL_FEAT_BIT_PHY_2M BIT64(BT_LE_FEAT_BIT_PHY_2M) -#else /* !CONFIG_BT_CTLR_PHY_2M */ +#else /* !CONFIG_BT_CTLR_PHY || !CONFIG_BT_CTLR_PHY_2M */ #define LL_FEAT_BIT_PHY_2M 0 -#endif /* !CONFIG_BT_CTLR_PHY_2M */ +#endif /* !CONFIG_BT_CTLR_PHY || !CONFIG_BT_CTLR_PHY_2M */ #if defined(CONFIG_BT_CTLR_SMI_TX) #if defined(CONFIG_BT_CTLR_SMI_TX_SETTING) @@ -86,11 +86,11 @@ #define LL_FEAT_BIT_SMI_RX 0 #endif /* !CONFIG_BT_CTLR_SMI_RX */ -#if defined(CONFIG_BT_CTLR_PHY_CODED) +#if defined(CONFIG_BT_CTLR_PHY) && defined(CONFIG_BT_CTLR_PHY_CODED) #define LL_FEAT_BIT_PHY_CODED BIT64(BT_LE_FEAT_BIT_PHY_CODED) -#else /* !CONFIG_BT_CTLR_PHY_CODED */ +#else /* !CONFIG_BT_CTLR_PHY || !CONFIG_BT_CTLR_PHY_CODED */ #define LL_FEAT_BIT_PHY_CODED 0 -#endif /* !CONFIG_BT_CTLR_PHY_CODED */ +#endif /* !CONFIG_BT_CTLR_PHY || !CONFIG_BT_CTLR_PHY_CODED */ #if defined(CONFIG_BT_CTLR_ADV_EXT) #define LL_FEAT_BIT_EXT_ADV BIT64(BT_LE_FEAT_BIT_EXT_ADV) diff --git a/subsys/bluetooth/controller/include/ll_settings.h b/subsys/bluetooth/controller/include/ll_settings.h index c79a4fb1537..df3835481f3 100644 --- a/subsys/bluetooth/controller/include/ll_settings.h +++ b/subsys/bluetooth/controller/include/ll_settings.h @@ -1,25 +1,31 @@ /* + * Copyright (c) 2025 Nordic Semiconductor ASA * Copyright (c) 2019 Oticon A/S * * SPDX-License-Identifier: Apache-2.0 */ #if defined(CONFIG_BT_CTLR_VERSION_SETTINGS) +#define LL_VERSION_SETTINGS +#else /* !CONFIG_BT_CTLR_VERSION_SETTINGS */ +#define LL_VERSION_SETTINGS static __attribute__((always_inline)) inline +#endif /* !CONFIG_BT_CTLR_VERSION_SETTINGS */ -uint16_t ll_settings_company_id(void); -uint16_t ll_settings_subversion_number(void); +/* Version Interfaces */ +LL_VERSION_SETTINGS uint16_t ll_settings_company_id(void); +LL_VERSION_SETTINGS uint16_t ll_settings_subversion_number(void); -#else +/* Stable Modulation Index Interfaces */ +bool ll_settings_smi_tx(void); -static inline uint16_t ll_settings_company_id(void) +/* Static inline functions */ +#if !defined(CONFIG_BT_CTLR_VERSION_SETTINGS) +LL_VERSION_SETTINGS uint16_t ll_settings_company_id(void) { return CONFIG_BT_CTLR_COMPANY_ID; } -static inline uint16_t ll_settings_subversion_number(void) +LL_VERSION_SETTINGS uint16_t ll_settings_subversion_number(void) { return CONFIG_BT_CTLR_SUBVERSION_NUMBER; } - -#endif /* CONFIG_BT_CTLR_VERSION_SETTINGS */ - -bool ll_settings_smi_tx(void); +#endif /* !CONFIG_BT_CTLR_VERSION_SETTINGS */ diff --git a/subsys/bluetooth/controller/ll_sw/isoal.c b/subsys/bluetooth/controller/ll_sw/isoal.c index 625edbbb63d..9d2db83668d 100644 --- a/subsys/bluetooth/controller/ll_sw/isoal.c +++ b/subsys/bluetooth/controller/ll_sw/isoal.c @@ -151,8 +151,8 @@ static bool isoal_get_time_diff(uint32_t time_before, uint32_t time_after, uint3 { bool valid = false; - LL_ASSERT(time_before <= ISOAL_TIME_WRAPPING_POINT_US); - LL_ASSERT(time_after <= ISOAL_TIME_WRAPPING_POINT_US); + LL_ASSERT_DBG(time_before <= ISOAL_TIME_WRAPPING_POINT_US); + LL_ASSERT_DBG(time_after <= ISOAL_TIME_WRAPPING_POINT_US); if (time_before > time_after) { if (time_before >= ISOAL_TIME_MID_POINT_US && @@ -225,13 +225,13 @@ static void isoal_sink_deallocate(isoal_sink_handle_t hdl) if (hdl < ARRAY_SIZE(isoal_global.sink_allocated)) { isoal_global.sink_allocated[hdl] = ISOAL_ALLOC_STATE_FREE; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } if (hdl < ARRAY_SIZE(isoal_global.sink_state)) { (void)memset(&isoal_global.sink_state[hdl], 0, sizeof(struct isoal_sink)); } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -350,7 +350,7 @@ isoal_status_t isoal_sink_create( session->sdu_sync_const = group_sync_delay; } } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } /* Remember the platform-specific callbacks */ @@ -378,7 +378,7 @@ void isoal_sink_enable(isoal_sink_handle_t hdl) /* Atomically enable */ isoal_global.sink_state[hdl].sdu_production.mode = ISOAL_PRODUCTION_MODE_ENABLED; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -392,7 +392,7 @@ void isoal_sink_disable(isoal_sink_handle_t hdl) /* Atomically disable */ isoal_global.sink_state[hdl].sdu_production.mode = ISOAL_PRODUCTION_MODE_DISABLED; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -441,7 +441,7 @@ static isoal_status_t isoal_rx_allocate_sdu(struct isoal_sink *sink, /* Nothing has been written into buffer yet */ sp->sdu_written = 0; sp->sdu_available = sdu->contents.size; - LL_ASSERT(sdu->contents.size > 0); + LL_ASSERT_ERR(sdu->contents.size > 0); /* Get seq number from session counter */ sdu->sn = session->sn; @@ -568,7 +568,7 @@ static isoal_status_t isoal_rx_buffered_emit_sdu(struct isoal_sink *sink, bool e #endif /* ISOAL_BUFFER_RX_SDUS_ENABLE */ } else { /* Unreachable */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } return err; @@ -653,7 +653,6 @@ static isoal_status_t isoal_rx_append_to_sdu(struct isoal_sink *sink, handle_error_case = (is_end_fragment && (packet_available == 0)); pdu_payload = pdu_meta->pdu->payload + offset; - LL_ASSERT(pdu_payload); /* While there is something left of the packet to consume */ err = ISOAL_STATUS_OK; @@ -880,7 +879,7 @@ static isoal_status_t isoal_rx_unframed_consume(struct isoal_sink *sink, /* Unsupported case */ err = ISOAL_STATUS_ERR_UNSPECIFIED; LOG_ERR("Invalid unframed LLID (%d)", llid); - LL_ASSERT(0); + LL_ASSERT_ERR(0); } break; @@ -1459,7 +1458,8 @@ static void isoal_source_deallocate(isoal_source_handle_t hdl) if (hdl < ARRAY_SIZE(isoal_global.source_state)) { source = &isoal_global.source_state[hdl]; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); + return; } @@ -1477,7 +1477,7 @@ static void isoal_source_deallocate(isoal_source_handle_t hdl) if (hdl < ARRAY_SIZE(isoal_global.source_allocated)) { isoal_global.source_allocated[hdl] = ISOAL_ALLOC_STATE_FREE; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } (void)memset(source, 0, sizeof(struct isoal_source)); @@ -1594,7 +1594,7 @@ void isoal_source_enable(isoal_source_handle_t hdl) /* Atomically enable */ isoal_global.source_state[hdl].pdu_production.mode = ISOAL_PRODUCTION_MODE_ENABLED; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -1608,7 +1608,7 @@ void isoal_source_disable(isoal_source_handle_t hdl) /* Atomically disable */ isoal_global.source_state[hdl].pdu_production.mode = ISOAL_PRODUCTION_MODE_DISABLED; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -1770,7 +1770,7 @@ static isoal_status_t isoal_tx_allocate_pdu(struct isoal_source *source, pp->pdu_written = 0; pp->pdu_available = available_len; pp->pdu_allocated = 1U; - LL_ASSERT(available_len > 0); + LL_ASSERT_ERR(available_len > 0); pp->pdu_cnt++; } @@ -1982,7 +1982,7 @@ static isoal_status_t isoal_tx_unframed_produce(isoal_source_handle_t source_hdl packet_available = tx_sdu->size; sdu_payload = tx_sdu->dbuf; - LL_ASSERT(sdu_payload); + LL_ASSERT_DBG(sdu_payload); zero_length_sdu = (packet_available == 0 && tx_sdu->sdu_state == BT_ISO_SINGLE); @@ -2468,12 +2468,12 @@ static uint16_t isoal_tx_framed_find_correct_tx_event(const struct isoal_source time_diff_valid = isoal_get_time_diff(time_stamp_selected, actual_grp_ref_point, &time_diff); - LL_ASSERT(time_diff_valid); - LL_ASSERT(time_diff > 0); + LL_ASSERT_DBG(time_diff_valid); + LL_ASSERT_DBG(time_diff > 0); /* Time difference must be less than the maximum possible * time-offset of 24-bits. */ - LL_ASSERT(time_diff <= 0x00FFFFFF); + LL_ASSERT_DBG(time_diff <= 0x00FFFFFF); } *payload_number = next_payload_number; @@ -2514,7 +2514,7 @@ static isoal_status_t isoal_tx_framed_produce(isoal_source_handle_t source_hdl, packet_available = tx_sdu->size; sdu_payload = tx_sdu->dbuf; - LL_ASSERT(sdu_payload); + LL_ASSERT_DBG(sdu_payload); zero_length_sdu = (packet_available == 0 && tx_sdu->sdu_state == BT_ISO_SINGLE); @@ -2791,7 +2791,7 @@ static isoal_status_t isoal_tx_framed_event_prepare_handle(isoal_source_handle_t } /* Not possible to recover if allocation or emit fails here*/ - LL_ASSERT(!(err || err_alloc)); + LL_ASSERT_ERR(!(err || err_alloc)); if (pp->payload_number < last_event_payload + 1ULL) { pp->payload_number = last_event_payload + 1ULL; diff --git a/subsys/bluetooth/controller/ll_sw/lll_chan.c b/subsys/bluetooth/controller/ll_sw/lll_chan.c index 213fce38a8f..e45134144b6 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_chan.c +++ b/subsys/bluetooth/controller/ll_sw/lll_chan.c @@ -349,39 +349,39 @@ void lll_chan_sel_2_ut(void) /* Tests when ISO not supported */ /* Section 3.1 Sample Data 1 (37 used channels) */ m = lll_chan_sel_2(0U, chan_id, chan_map_1, chan_map_1_37_used); - LL_ASSERT(m == 25U); + LL_ASSERT_ERR(m == 25U); m = lll_chan_sel_2(1U, chan_id, chan_map_1, chan_map_1_37_used); - LL_ASSERT(m == 20U); + LL_ASSERT_ERR(m == 20U); m = lll_chan_sel_2(2U, chan_id, chan_map_1, chan_map_1_37_used); - LL_ASSERT(m == 6U); + LL_ASSERT_ERR(m == 6U); m = lll_chan_sel_2(3U, chan_id, chan_map_1, chan_map_1_37_used); - LL_ASSERT(m == 21U); + LL_ASSERT_ERR(m == 21U); /* Section 3.2 Sample Data 2 (9 used channels) */ m = lll_chan_sel_2(6U, chan_id, chan_map_2, chan_map_2_9_used); - LL_ASSERT(m == 23U); + LL_ASSERT_ERR(m == 23U); m = lll_chan_sel_2(7U, chan_id, chan_map_2, chan_map_2_9_used); - LL_ASSERT(m == 9U); + LL_ASSERT_ERR(m == 9U); m = lll_chan_sel_2(8U, chan_id, chan_map_2, chan_map_2_9_used); - LL_ASSERT(m == 34U); + LL_ASSERT_ERR(m == 34U); /* FIXME: Use Sample Data from Spec, if one is added. * Below is a random sample to cover implementation in this file. */ /* Section x.x Sample Data 3 (2 used channels) */ m = lll_chan_sel_2(11U, chan_id, chan_map_3, chan_map_3_2_used); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR(m == 1U); m = lll_chan_sel_2(12U, chan_id, chan_map_3, chan_map_3_2_used); - LL_ASSERT(m == 2U); + LL_ASSERT_ERR(m == 2U); m = lll_chan_sel_2(13U, chan_id, chan_map_3, chan_map_3_2_used); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR(m == 1U); #if defined(CONFIG_BT_CTLR_ISO) uint16_t prn_subevent_lu; @@ -393,164 +393,164 @@ void lll_chan_sel_2_ut(void) prn_s = 56857U ^ chan_id; prn_subevent_lu = prn_s; prn_subevent_se = chan_prn_subevent_se(chan_id, &prn_subevent_lu); - LL_ASSERT(prn_subevent_se == 11710U); + LL_ASSERT_ERR(prn_subevent_se == 11710U); /* BIS subevent 3, event counter 0 */ prn_subevent_se = chan_prn_subevent_se(chan_id, &prn_subevent_lu); - LL_ASSERT(prn_subevent_se == 16649U); + LL_ASSERT_ERR(prn_subevent_se == 16649U); /* BIS subevent 4, event counter 0 */ prn_subevent_se = chan_prn_subevent_se(chan_id, &prn_subevent_lu); - LL_ASSERT(prn_subevent_se == 38198U); + LL_ASSERT_ERR(prn_subevent_se == 38198U); /* Section 3.1 Sample Data 1 (37 used channels) */ /* BIS subevent 1, event counter 0 */ m = lll_chan_iso_event(0U, chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 56857U); - LL_ASSERT(m == 25U); - LL_ASSERT(remap_idx == 25U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 56857U); + LL_ASSERT_ERR(m == 25U); + LL_ASSERT_ERR(remap_idx == 25U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 1U); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR(remap_idx == 1U); + LL_ASSERT_ERR(m == 1U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 16U); - LL_ASSERT(m == 16U); + LL_ASSERT_ERR(remap_idx == 16U); + LL_ASSERT_ERR(m == 16U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 36U); - LL_ASSERT(m == 36U); + LL_ASSERT_ERR(remap_idx == 36U); + LL_ASSERT_ERR(m == 36U); /* BIS subevent 1, event counter 1 */ m = lll_chan_iso_event(1U, chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 1685U); - LL_ASSERT(m == 20U); - LL_ASSERT(remap_idx == 20U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 1685U); + LL_ASSERT_ERR(m == 20U); + LL_ASSERT_ERR(remap_idx == 20U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 36U); - LL_ASSERT(m == 36U); + LL_ASSERT_ERR(remap_idx == 36U); + LL_ASSERT_ERR(m == 36U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 12U); - LL_ASSERT(m == 12U); + LL_ASSERT_ERR(remap_idx == 12U); + LL_ASSERT_ERR(m == 12U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 34U); - LL_ASSERT(m == 34U); + LL_ASSERT_ERR(remap_idx == 34U); + LL_ASSERT_ERR(m == 34U); /* BIS subevent 1, event counter 2 */ m = lll_chan_iso_event(2U, chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 38301U); - LL_ASSERT(m == 6U); - LL_ASSERT(remap_idx == 6U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 38301U); + LL_ASSERT_ERR(m == 6U); + LL_ASSERT_ERR(remap_idx == 6U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 18U); - LL_ASSERT(m == 18U); + LL_ASSERT_ERR(remap_idx == 18U); + LL_ASSERT_ERR(m == 18U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 32U); - LL_ASSERT(m == 32U); + LL_ASSERT_ERR(remap_idx == 32U); + LL_ASSERT_ERR(m == 32U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 21U); - LL_ASSERT(m == 21U); + LL_ASSERT_ERR(remap_idx == 21U); + LL_ASSERT_ERR(m == 21U); /* BIS subevent 1, event counter 3 */ m = lll_chan_iso_event(3U, chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 27475U); - LL_ASSERT(m == 21U); - LL_ASSERT(remap_idx == 21U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 27475U); + LL_ASSERT_ERR(m == 21U); + LL_ASSERT_ERR(remap_idx == 21U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 4U); - LL_ASSERT(m == 4U); + LL_ASSERT_ERR(remap_idx == 4U); + LL_ASSERT_ERR(m == 4U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 22U); - LL_ASSERT(m == 22U); + LL_ASSERT_ERR(remap_idx == 22U); + LL_ASSERT_ERR(m == 22U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_1, chan_map_1_37_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 8U); - LL_ASSERT(m == 8U); + LL_ASSERT_ERR(remap_idx == 8U); + LL_ASSERT_ERR(m == 8U); /* Section 3.2 Sample Data 2 (9 used channels) */ /* BIS subevent 1, event counter 6 */ m = lll_chan_iso_event(6U, chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 10975U); - LL_ASSERT(remap_idx == 4U); - LL_ASSERT(m == 23U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 10975U); + LL_ASSERT_ERR(remap_idx == 4U); + LL_ASSERT_ERR(m == 23U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 7U); - LL_ASSERT(m == 35U); + LL_ASSERT_ERR(remap_idx == 7U); + LL_ASSERT_ERR(m == 35U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 2U); - LL_ASSERT(m == 21U); + LL_ASSERT_ERR(remap_idx == 2U); + LL_ASSERT_ERR(m == 21U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 8U); - LL_ASSERT(m == 36U); + LL_ASSERT_ERR(remap_idx == 8U); + LL_ASSERT_ERR(m == 36U); /* BIS subevent 1, event counter 7 */ m = lll_chan_iso_event(7U, chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 5490U); - LL_ASSERT(remap_idx == 0U); - LL_ASSERT(m == 9U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 5490U); + LL_ASSERT_ERR(remap_idx == 0U); + LL_ASSERT_ERR(m == 9U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 3U); - LL_ASSERT(m == 22U); + LL_ASSERT_ERR(remap_idx == 3U); + LL_ASSERT_ERR(m == 22U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 8U); - LL_ASSERT(m == 36U); + LL_ASSERT_ERR(remap_idx == 8U); + LL_ASSERT_ERR(m == 36U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 5U); - LL_ASSERT(m == 33U); + LL_ASSERT_ERR(remap_idx == 5U); + LL_ASSERT_ERR(m == 33U); /* BIS subevent 1, event counter 8 */ m = lll_chan_iso_event(8U, chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 46970U); - LL_ASSERT(remap_idx == 6U); - LL_ASSERT(m == 34U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 46970U); + LL_ASSERT_ERR(remap_idx == 6U); + LL_ASSERT_ERR(m == 34U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 0U); - LL_ASSERT(m == 9U); + LL_ASSERT_ERR(remap_idx == 0U); + LL_ASSERT_ERR(m == 9U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 5U); - LL_ASSERT(m == 33U); + LL_ASSERT_ERR(remap_idx == 5U); + LL_ASSERT_ERR(m == 33U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_2, chan_map_2_9_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 1U); - LL_ASSERT(m == 10U); + LL_ASSERT_ERR(remap_idx == 1U); + LL_ASSERT_ERR(m == 10U); /* FIXME: Use Sample Data from Spec, if one is added. * Below is a random sample to cover implementation in this file. @@ -558,66 +558,66 @@ void lll_chan_sel_2_ut(void) /* Section x.x Sample Data 3 (2 used channels) */ /* BIS subevent 1, event counter 11 */ m = lll_chan_iso_event(11U, chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 8628U); - LL_ASSERT(remap_idx == 0U); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 8628U); + LL_ASSERT_ERR(remap_idx == 0U); + LL_ASSERT_ERR(m == 1U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 1U); - LL_ASSERT(m == 2U); + LL_ASSERT_ERR(remap_idx == 1U); + LL_ASSERT_ERR(m == 2U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 0U); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR(remap_idx == 0U); + LL_ASSERT_ERR(m == 1U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 1U); - LL_ASSERT(m == 2U); + LL_ASSERT_ERR(remap_idx == 1U); + LL_ASSERT_ERR(m == 2U); /* BIS subevent 1, event counter 12 */ m = lll_chan_iso_event(12U, chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 34748U); - LL_ASSERT(remap_idx == 1U); - LL_ASSERT(m == 2U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 34748U); + LL_ASSERT_ERR(remap_idx == 1U); + LL_ASSERT_ERR(m == 2U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 0U); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR(remap_idx == 0U); + LL_ASSERT_ERR(m == 1U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 1U); - LL_ASSERT(m == 2U); + LL_ASSERT_ERR(remap_idx == 1U); + LL_ASSERT_ERR(m == 2U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 0U); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR(remap_idx == 0U); + LL_ASSERT_ERR(m == 1U); /* BIS subevent 1, event counter 13 */ m = lll_chan_iso_event(13U, chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT((prn_s ^ chan_id) == 22072U); - LL_ASSERT(remap_idx == 0U); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR((prn_s ^ chan_id) == 22072U); + LL_ASSERT_ERR(remap_idx == 0U); + LL_ASSERT_ERR(m == 1U); /* BIS subvent 2 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 1U); - LL_ASSERT(m == 2U); + LL_ASSERT_ERR(remap_idx == 1U); + LL_ASSERT_ERR(m == 2U); /* BIS subvent 3 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 0U); - LL_ASSERT(m == 1U); + LL_ASSERT_ERR(remap_idx == 0U); + LL_ASSERT_ERR(m == 1U); /* BIS subvent 4 */ m = lll_chan_iso_subevent(chan_id, chan_map_3, chan_map_3_2_used, &prn_s, &remap_idx); - LL_ASSERT(remap_idx == 1U); - LL_ASSERT(m == 2U); + LL_ASSERT_ERR(remap_idx == 1U); + LL_ASSERT_ERR(m == 2U); #endif /* CONFIG_BT_CTLR_ISO */ } diff --git a/subsys/bluetooth/controller/ll_sw/lll_common.c b/subsys/bluetooth/controller/ll_sw/lll_common.c index c6c561dbb76..96861aa7201 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_common.c +++ b/subsys/bluetooth/controller/ll_sw/lll_common.c @@ -77,7 +77,7 @@ void lll_resume(void *param) next = param; err = lll_prepare_resolve(next->is_abort_cb, next->abort_cb, next->prepare_cb, &next->prepare_param, next->is_resume, 1U); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } #if defined(CONFIG_BT_CTLR_JIT_SCHEDULING) diff --git a/subsys/bluetooth/controller/ll_sw/lll_scan.h b/subsys/bluetooth/controller/ll_sw/lll_scan.h index db0f08a182e..b9633f89938 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_scan.h +++ b/subsys/bluetooth/controller/ll_sw/lll_scan.h @@ -17,6 +17,14 @@ struct lll_scan { uint8_t adv_addr[BDADDR_SIZE]; uint32_t conn_win_offset_us; uint16_t conn_timeout; + +#if defined(CONFIG_BT_CTLR_SCHED_ADVANCED) + /* Stores prepare parameters for deferred mayfly execution. + * This prevents use-after-release issues by ensuring the parameters + * remain valid until execution. + */ + struct lll_prepare_param prepare_param; +#endif /* CONFIG_BT_CTLR_SCHED_ADVANCED */ #endif /* CONFIG_BT_CENTRAL */ uint8_t state:1; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/cntr.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/cntr.c index eb1116c987f..ba6487b5353 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/cntr.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/cntr.c @@ -110,7 +110,7 @@ uint32_t cntr_start(void) uint32_t cntr_stop(void) { - LL_ASSERT(_refcount); + LL_ASSERT_ERR(_refcount); if (--_refcount) { return 1; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ecb.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ecb.c index 2398bdc44fd..38b70c491d7 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ecb.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ecb.c @@ -225,7 +225,7 @@ static void isr_ecb(const void *arg) } else { - LL_ASSERT(false); + LL_ASSERT_DBG(false); } } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/mayfly.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/mayfly.c index 531cbd5b241..73408b23454 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/mayfly.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/mayfly.c @@ -42,7 +42,7 @@ void mayfly_enable_cb(uint8_t caller_id, uint8_t callee_id, uint8_t enable) break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -62,7 +62,7 @@ uint32_t mayfly_is_enabled(uint8_t caller_id, uint8_t callee_id) return irq_is_enabled(HAL_SWI_JOB_IRQ); default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -120,7 +120,7 @@ void mayfly_pend(uint8_t caller_id, uint8_t callee_id) break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c index 90a0945f5a1..7056f020bc2 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c @@ -10,6 +10,7 @@ #include #include +#include #include #include "util/mem.h" @@ -221,7 +222,11 @@ void radio_reset(void) RADIO_TIMING_RU_Msk; #endif /* !CONFIG_BT_CTLR_TIFS_HW */ +#if defined(CONFIG_NRF_SYS_EVENT) + (void)nrf_sys_event_request_global_constlat(); +#else /* !CONFIG_NRF_SYS_EVENT */ NRF_POWER->TASKS_CONSTLAT = 1U; +#endif /* !CONFIG_NRF_SYS_EVENT */ #endif /* CONFIG_SOC_COMPATIBLE_NRF54LX */ #if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) || defined(HAL_RADIO_GPIO_HAVE_LNA_PIN) @@ -312,7 +317,7 @@ void radio_tx_power_set(int8_t power) value = hal_radio_tx_power_value(power); NRF_RADIO->TXPOWER = value; -#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) +#elif defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) uint32_t value; /* NOTE: TXPOWER register only accepts upto 0dBm, hence use the HAL @@ -323,12 +328,12 @@ void radio_tx_power_set(int8_t power) NRF_RADIO->TXPOWER = value; hal_radio_tx_power_high_voltage_set(power); -#else /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#else /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ /* NOTE: valid value range is passed by Kconfig define. */ NRF_RADIO->TXPOWER = (uint32_t)power; -#endif /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ } void radio_tx_power_max_set(void) @@ -346,25 +351,25 @@ int8_t radio_tx_power_min_get(void) int8_t radio_tx_power_max_get(void) { -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) return RADIO_TXPOWER_TXPOWER_Pos3dBm; -#else /* !CONFIG_SOC_COMPATIBLE_NRF53X */ +#else /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET */ return (int8_t)hal_radio_tx_power_max_get(); -#endif /* !CONFIG_SOC_COMPATIBLE_NRF53X */ +#endif /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET */ } int8_t radio_tx_power_floor(int8_t power) { -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) /* NOTE: TXPOWER register only accepts upto 0dBm, +3dBm permitted by * use of high voltage being set for radio when TXPOWER register is set. */ if (power >= (int8_t)RADIO_TXPOWER_TXPOWER_Pos3dBm) { return RADIO_TXPOWER_TXPOWER_Pos3dBm; } -#endif /* CONFIG_SOC_COMPATIBLE_NRF53X */ +#endif /* CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET */ return (int8_t)hal_radio_tx_power_floor(power); } @@ -422,7 +427,7 @@ void radio_pkt_configure(uint8_t bits_len, uint8_t max_len, uint8_t flags) bits_s1 = RADIO_PKT_CONF_LENGTH_8BIT - bits_len; #elif defined(CONFIG_SOC_COMPATIBLE_NRF52X) || \ - defined(CONFIG_SOC_COMPATIBLE_NRF53X) || \ + defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || \ defined(CONFIG_SOC_COMPATIBLE_NRF54LX) extra = 0U; @@ -520,7 +525,7 @@ uint32_t radio_rx_chain_delay_get(uint8_t phy, uint8_t flags) void radio_rx_enable(void) { #if !defined(CONFIG_BT_CTLR_TIFS_HW) -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) /* NOTE: Timer clear DPPI configuration is needed only for nRF53 * because of calls to radio_disable() and * radio_switch_complete_and_disable() inside a radio event call @@ -533,7 +538,7 @@ void radio_rx_enable(void) * radio event but when the radio event is done. */ hal_sw_switch_timer_clear_ppi_config(); -#endif /* CONFIG_SOC_COMPATIBLE_NRF53X || CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET || CONFIG_SOC_COMPATIBLE_NRF54LX */ #endif /* !CONFIG_BT_CTLR_TIFS_HW */ nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_RXEN); @@ -542,7 +547,7 @@ void radio_rx_enable(void) void radio_tx_enable(void) { #if !defined(CONFIG_BT_CTLR_TIFS_HW) -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) /* NOTE: Timer clear DPPI configuration is needed only for nRF53 * because of calls to radio_disable() and * radio_switch_complete_and_disable() inside a radio event call @@ -555,7 +560,7 @@ void radio_tx_enable(void) * radio event but when the radio event is done. */ hal_sw_switch_timer_clear_ppi_config(); -#endif /* CONFIG_SOC_COMPATIBLE_NRF53X || CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET || CONFIG_SOC_COMPATIBLE_NRF54LX */ #endif /* !CONFIG_BT_CTLR_TIFS_HW */ nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_TXEN); @@ -934,13 +939,13 @@ void sw_switch(uint8_t dir_curr, uint8_t dir_next, uint8_t phy_curr, uint8_t fla * time-stamp. */ hal_radio_end_time_capture_ppi_config(); -#if !defined(CONFIG_SOC_COMPATIBLE_NRF53X) && !defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if !defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) && !defined(CONFIG_SOC_COMPATIBLE_NRF54LX) /* The function is not called for nRF5340 single timer configuration because * HAL_SW_SWITCH_TIMER_CLEAR_PPI is equal to HAL_RADIO_END_TIME_CAPTURE_PPI, * so channel is already enabled. */ hal_radio_nrf_ppi_channels_enable(BIT(HAL_RADIO_END_TIME_CAPTURE_PPI)); -#endif /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ #endif /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ sw_tifs_toggle += 1U; @@ -1355,38 +1360,38 @@ void radio_tmr_rx_status_reset(void) void radio_tmr_tx_enable(void) { -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) -#else /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#else /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ #if (HAL_RADIO_ENABLE_TX_ON_TICK_PPI == HAL_RADIO_ENABLE_RX_ON_TICK_PPI) hal_radio_enable_on_tick_ppi_config_and_enable(1U); #endif /* HAL_RADIO_ENABLE_TX_ON_TICK_PPI == HAL_RADIO_ENABLE_RX_ON_TICK_PPI */ -#endif /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ } void radio_tmr_rx_enable(void) { -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) -#else /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#else /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ #if (HAL_RADIO_ENABLE_TX_ON_TICK_PPI == HAL_RADIO_ENABLE_RX_ON_TICK_PPI) hal_radio_enable_on_tick_ppi_config_and_enable(0U); #endif /* HAL_RADIO_ENABLE_TX_ON_TICK_PPI == HAL_RADIO_ENABLE_RX_ON_TICK_PPI */ -#endif /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ } void radio_tmr_tx_disable(void) { -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) nrf_radio_subscribe_clear(NRF_RADIO, NRF_RADIO_TASK_TXEN); -#else /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ -#endif /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#else /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ } void radio_tmr_rx_disable(void) { -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) nrf_radio_subscribe_clear(NRF_RADIO, NRF_RADIO_TASK_RXEN); -#else /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ -#endif /* !CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#else /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX */ } void radio_tmr_tifs_set(uint32_t tifs) @@ -1622,7 +1627,7 @@ uint32_t radio_tmr_start_tick(uint8_t trx, uint32_t ticks_start) #if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) last_pdu_end_us_init(latency_us); #endif /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) /* NOTE: Timer clear DPPI configuration is needed only for nRF53 * because of calls to radio_disable() and * radio_switch_complete_and_disable() inside a radio event call @@ -1635,7 +1640,7 @@ uint32_t radio_tmr_start_tick(uint8_t trx, uint32_t ticks_start) * radio event but when the radio event is done. */ hal_sw_switch_timer_clear_ppi_config(); -#endif /* CONFIG_SOC_COMPATIBLE_NRF53X || CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET || CONFIG_SOC_COMPATIBLE_NRF54LX */ #endif /* !CONFIG_BT_CTLR_TIFS_HW */ return remainder_us; @@ -1652,7 +1657,7 @@ uint32_t radio_tmr_start_us(uint8_t trx, uint32_t start_us) */ start_us -= last_pdu_end_us; #endif /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ -#if defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX) /* NOTE: Timer clear DPPI configuration is needed only for nRF53 * because of calls to radio_disable() and * radio_switch_complete_and_disable() inside a radio event call @@ -1665,7 +1670,7 @@ uint32_t radio_tmr_start_us(uint8_t trx, uint32_t start_us) * radio event but when the radio event is done. */ hal_sw_switch_timer_clear_ppi_config(); -#endif /* CONFIG_SOC_COMPATIBLE_NRF53X || CONFIG_SOC_COMPATIBLE_NRF54LX */ +#endif /* CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET || CONFIG_SOC_COMPATIBLE_NRF54LX */ #endif /* !CONFIG_BT_CTLR_TIFS_HW */ /* start_us could be the current count in the timer */ @@ -1788,7 +1793,11 @@ void radio_tmr_stop(void) #endif /* !CONFIG_BT_CTLR_TIFS_HW */ #if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#if defined(CONFIG_NRF_SYS_EVENT) + (void)nrf_sys_event_release_global_constlat(); +#else /* !CONFIG_NRF_SYS_EVENT */ NRF_POWER->TASKS_LOWPWR = 1U; +#endif /* !CONFIG_NRF_SYS_EVENT */ #endif /* CONFIG_SOC_COMPATIBLE_NRF54LX */ } @@ -1867,13 +1876,14 @@ void radio_tmr_end_capture(void) * hal_sw_switch_timer_clear_ppi_config() and sw_switch(). There is no need to * configure the channel again in this function. */ -#if (!defined(CONFIG_SOC_COMPATIBLE_NRF53X) && !defined(CONFIG_SOC_COMPATIBLE_NRF54LX)) || \ - ((defined(CONFIG_SOC_COMPATIBLE_NRF53X) || defined(CONFIG_SOC_COMPATIBLE_NRF54LX)) && \ +#if (!defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) && !defined(CONFIG_SOC_COMPATIBLE_NRF54LX)) || \ + ((defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) || \ + defined(CONFIG_SOC_COMPATIBLE_NRF54LX)) && \ !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)) hal_radio_end_time_capture_ppi_config(); hal_radio_nrf_ppi_channels_enable(BIT(HAL_RADIO_END_TIME_CAPTURE_PPI)); -#endif /* (!CONFIG_SOC_COMPATIBLE_NRF53X && !CONFIG_SOC_COMPATIBLE_NRF54LX) || - * ((CONFIG_SOC_COMPATIBLE_NRF53X || CONFIG_SOC_COMPATIBLE_NRF54LX) && +#endif /* (!CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET && !CONFIG_SOC_COMPATIBLE_NRF54LX) || + * ((CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET || CONFIG_SOC_COMPATIBLE_NRF54LX) && * !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) */ } @@ -2104,10 +2114,14 @@ static void *radio_ccm_ext_rx_pkt_set(struct ccm *cnf, uint8_t phy, uint8_t pdu_ NRF_CCM->ENABLE = CCM_ENABLE_ENABLE_Disabled; NRF_CCM->ENABLE = CCM_ENABLE_ENABLE_Enabled; - mode = (CCM_MODE_MODE_Decryption << CCM_MODE_MODE_Pos) & + /* Select the CCM decryption mode for the SoC */ +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + /* NOTE: Use fast decryption as rx data is decrypt after payload is received, compared to + * decrypting in parallel with radio reception of address in nRF51/nRF52/nRF53. + */ + mode = (CCM_MODE_MODE_FastDecryption << CCM_MODE_MODE_Pos) & CCM_MODE_MODE_Msk; -#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) /* Enable CCM Protocol Mode Bluetooth LE */ mode |= (CCM_MODE_PROTOCOL_Ble << CCM_MODE_PROTOCOL_Pos) & CCM_MODE_PROTOCOL_Msk; @@ -2116,21 +2130,30 @@ static void *radio_ccm_ext_rx_pkt_set(struct ccm *cnf, uint8_t phy, uint8_t pdu_ mode |= (CCM_MODE_MACLEN_M4 << CCM_MODE_MACLEN_Pos) & CCM_MODE_MACLEN_Msk; -#elif !defined(CONFIG_SOC_SERIES_NRF51X) +#elif defined(CONFIG_SOC_COMPATIBLE_NRF52X) || defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) + mode = (CCM_MODE_MODE_Decryption << CCM_MODE_MODE_Pos) & + CCM_MODE_MODE_Msk; + /* Enable CCM support for 8-bit length field PDUs. */ mode |= (CCM_MODE_LENGTH_Extended << CCM_MODE_LENGTH_Pos) & CCM_MODE_LENGTH_Msk; -#endif /* !CONFIG_SOC_SERIES_NRF51X */ + +#elif defined(CONFIG_SOC_SERIES_NRF51X) + mode = (CCM_MODE_MODE_Decryption << CCM_MODE_MODE_Pos) & + CCM_MODE_MODE_Msk; + +#else +#error "H/w accelerated decryption unsupported." +#endif /* Select CCM data rate based on current PHY in use. */ switch (phy) { default: case PHY_1M: -#if !defined(CONFIG_SOC_SERIES_NRF51X) - mode |= (CCM_MODE_DATARATE_1Mbit << - CCM_MODE_DATARATE_Pos) & +#if !defined(CONFIG_SOC_SERIES_NRF51X) && !defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + mode |= (CCM_MODE_DATARATE_1Mbit << CCM_MODE_DATARATE_Pos) & CCM_MODE_DATARATE_Msk; -#endif /* !CONFIG_SOC_SERIES_NRF51X */ +#endif /* !CONFIG_SOC_SERIES_NRF51X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ if (false) { @@ -2153,11 +2176,10 @@ static void *radio_ccm_ext_rx_pkt_set(struct ccm *cnf, uint8_t phy, uint8_t pdu_ break; case PHY_2M: -#if !defined(CONFIG_SOC_SERIES_NRF51X) - mode |= (CCM_MODE_DATARATE_2Mbit << - CCM_MODE_DATARATE_Pos) & +#if !defined(CONFIG_SOC_SERIES_NRF51X) && !defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + mode |= (CCM_MODE_DATARATE_2Mbit << CCM_MODE_DATARATE_Pos) & CCM_MODE_DATARATE_Msk; -#endif /* !CONFIG_SOC_SERIES_NRF51X */ +#endif /* !CONFIG_SOC_SERIES_NRF51X && !CONFIG_SOC_COMPATIBLE_NRF54LX */ hal_trigger_crypt_ppi_config(); hal_radio_nrf_ppi_channels_enable(BIT(HAL_TRIGGER_CRYPT_PPI)); @@ -2167,9 +2189,10 @@ static void *radio_ccm_ext_rx_pkt_set(struct ccm *cnf, uint8_t phy, uint8_t pdu_ #if defined(CONFIG_BT_CTLR_PHY_CODED) #if defined(CONFIG_HAS_HW_NRF_RADIO_BLE_CODED) case PHY_CODED: - mode |= (CCM_MODE_DATARATE_125Kbps << - CCM_MODE_DATARATE_Pos) & +#if !defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + mode |= (CCM_MODE_DATARATE_125Kbps << CCM_MODE_DATARATE_Pos) & CCM_MODE_DATARATE_Msk; +#endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ NRF_CCM->RATEOVERRIDE = (CCM_RATEOVERRIDE_RATEOVERRIDE_500Kbps << @@ -2336,22 +2359,11 @@ static void *radio_ccm_ext_tx_pkt_set(struct ccm *cnf, uint8_t pdu_type, void *p NRF_CCM->ENABLE = CCM_ENABLE_ENABLE_Disabled; NRF_CCM->ENABLE = CCM_ENABLE_ENABLE_Enabled; + /* Select the CCM encryption mode for the SoC */ +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) mode = (CCM_MODE_MODE_Encryption << CCM_MODE_MODE_Pos) & CCM_MODE_MODE_Msk; -#if defined(CONFIG_SOC_COMPATIBLE_NRF52X) || \ - defined(CONFIG_SOC_COMPATIBLE_NRF53X) - /* Enable CCM support for 8-bit length field PDUs. */ - mode |= (CCM_MODE_LENGTH_Extended << CCM_MODE_LENGTH_Pos) & - CCM_MODE_LENGTH_Msk; - - /* NOTE: use fastest data rate as tx data needs to be prepared before - * radio Tx on any PHY. - */ - mode |= (CCM_MODE_DATARATE_2Mbit << CCM_MODE_DATARATE_Pos) & - CCM_MODE_DATARATE_Msk; - -#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) /* Enable CCM Protocol Mode Bluetooth LE */ mode |= (CCM_MODE_PROTOCOL_Ble << CCM_MODE_PROTOCOL_Pos) & CCM_MODE_PROTOCOL_Msk; @@ -2365,6 +2377,27 @@ static void *radio_ccm_ext_tx_pkt_set(struct ccm *cnf, uint8_t pdu_type, void *p /* Enable CCM MAC Length 4 bytes */ mode |= (CCM_MODE_MACLEN_M4 << CCM_MODE_MACLEN_Pos) & CCM_MODE_MACLEN_Msk; + +#elif defined(CONFIG_SOC_COMPATIBLE_NRF52X) || defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET) + mode = (CCM_MODE_MODE_Encryption << CCM_MODE_MODE_Pos) & + CCM_MODE_MODE_Msk; + + /* Enable CCM support for 8-bit length field PDUs. */ + mode |= (CCM_MODE_LENGTH_Extended << CCM_MODE_LENGTH_Pos) & + CCM_MODE_LENGTH_Msk; + + /* NOTE: use fastest data rate as tx data needs to be prepared before + * radio Tx on any PHY. + */ + mode |= (CCM_MODE_DATARATE_2Mbit << CCM_MODE_DATARATE_Pos) & + CCM_MODE_DATARATE_Msk; + +#elif defined(CONFIG_SOC_SERIES_NRF51X) + mode = (CCM_MODE_MODE_Encryption << CCM_MODE_MODE_Pos) & + CCM_MODE_MODE_Msk; + +#else +#error "H/w accelerated encryption unsupported." #endif NRF_CCM->MODE = mode; @@ -2529,7 +2562,48 @@ void radio_ccm_disable(void) #endif /* CONFIG_BT_CTLR_LE_ENC || CONFIG_BT_CTLR_BROADCAST_ISO_ENC */ #if defined(CONFIG_BT_CTLR_PRIVACY) +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +struct aar_job_ptr { + void *ptr; + struct { + uint32_t length:24; + uint32_t attribute:8; + } __packed; +} __packed; + +#define AAR_JOB_PTR_ATTRIBUTE_HASH 11U +#define AAR_JOB_PTR_ATTRIBUTE_PRAND 12U +#define AAR_JOB_PTR_ATTRIBUTE_IRK 13U +#define AAR_JOB_PTR_ATTRIBUTE_INDEX 11U + +#define AAR_JOB_OUT_MAX_RESOLVED 1U + +#define AAR_IRK_SIZE 16U + +#define RADIO_PACKET_PTR_TO_PDU_OFFSET 3U + +#define BDADDR_HASH_OFFSET 0U +#define BDADDR_HASH_SIZE 3U +#define BDADDR_PRND_OFFSET 3U +#define BDADDR_PRND_SIZE 3U + +/* AAR HAL global memory referenced by the h/w peripheral and its DMA */ +static struct { + /* Index of the IRK match in the AAR job list, on successful resolution */ + uint32_t status; + + /* Input AAR job list; list of Hash, Prand, IRKs and a terminating empty job entry */ + struct aar_job_ptr in[CONFIG_BT_CTLR_RL_SIZE + 3]; + + /* Output AAR job list of one entry */ + struct aar_job_ptr out[AAR_JOB_OUT_MAX_RESOLVED]; + + /* NOTE: Refer to the AAR section in the SoC product specification for details */ +} aar_job; + +#else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ static uint8_t MALIGN(4) _aar_scratch[3]; +#endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ void radio_ar_configure(uint32_t nirk, void *irk, uint8_t flags) { @@ -2566,10 +2640,57 @@ void radio_ar_configure(uint32_t nirk, void *irk, uint8_t flags) NRF_AAR->ENABLE = (AAR_ENABLE_ENABLE_Enabled << AAR_ENABLE_ENABLE_Pos) & AAR_ENABLE_ENABLE_Msk; + +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + /* Input, Resolvable Address Hash offset in the legacy or extended advertising PDU. + * Radio packet pointer offset by 3 compared to legacy AAR in nRF51/52/53 SoCs that took + * Radio packet pointer value. + */ + aar_job.in[0].ptr = (uint8_t *)addrptr + RADIO_PACKET_PTR_TO_PDU_OFFSET + + BDADDR_HASH_OFFSET; + aar_job.in[0].length = BDADDR_HASH_SIZE; + aar_job.in[0].attribute = AAR_JOB_PTR_ATTRIBUTE_HASH; + + /* Input, Resolvable Address Random offset in the legacy or extended advertising PDU. + * Radio packet pointer offset by 3 compared to legacy AAR in nRF51/52/53 SoCs that took + * Radio packet pointer, plus offset of the 24-bit random in the legacy or extended + * advertising PDU after the 24-bit Hash in the Resolvable Address. + */ + aar_job.in[1].ptr = (uint8_t *)addrptr + RADIO_PACKET_PTR_TO_PDU_OFFSET + + BDADDR_PRND_OFFSET; + aar_job.in[1].length = BDADDR_PRND_SIZE; + aar_job.in[1].attribute = AAR_JOB_PTR_ATTRIBUTE_PRAND; + + /* Input, list of IRKs used for resolution */ + for (uint32_t i = 0; i < nirk; i++) { + aar_job.in[2U + i].ptr = (void *)(((uint8_t *)irk) + (AAR_IRK_SIZE * i)); + aar_job.in[2U + i].length = AAR_IRK_SIZE; + aar_job.in[2U + i].attribute = AAR_JOB_PTR_ATTRIBUTE_IRK; + } + + /* A terminating empty job entry */ + aar_job.in[2U + nirk].ptr = 0U; + aar_job.in[2U + nirk].length = 0U; + aar_job.in[2U + nirk].attribute = 0U; + + /* Reset match index to invalid value ( >= CONFIG_BT_CTLR_RL_SIZE ) */ + aar_job.status = UINT32_MAX; + + /* Output, single job entry that populates the `status` value with match index */ + aar_job.out[0].ptr = &aar_job.status; + aar_job.out[0].length = sizeof(aar_job.status); + aar_job.out[0].attribute = AAR_JOB_PTR_ATTRIBUTE_INDEX; + + NRF_AAR->IN.PTR = (uint32_t)&aar_job.in[0]; + NRF_AAR->OUT.PTR = (uint32_t)&aar_job.out[0]; + NRF_AAR->MAXRESOLVED = AAR_JOB_OUT_MAX_RESOLVED; + +#else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ NRF_AAR->NIRK = nirk; NRF_AAR->IRKPTR = (uint32_t)irk; NRF_AAR->ADDRPTR = addrptr; NRF_AAR->SCRATCHPTR = (uint32_t)&_aar_scratch[0]; +#endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ nrf_aar_event_clear(NRF_AAR, NRF_AAR_EVENT_END); nrf_aar_event_clear(NRF_AAR, NRF_AAR_EVENT_RESOLVED); @@ -2584,7 +2705,11 @@ void radio_ar_configure(uint32_t nirk, void *irk, uint8_t flags) uint32_t radio_ar_match_get(void) { +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + return aar_job.status; +#else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ return NRF_AAR->STATUS; +#endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ } void radio_ar_status_reset(void) @@ -2627,7 +2752,25 @@ uint8_t radio_ar_resolve(const uint8_t *addr) NRF_AAR->ENABLE = (AAR_ENABLE_ENABLE_Enabled << AAR_ENABLE_ENABLE_Pos) & AAR_ENABLE_ENABLE_Msk; +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + /* Input, Resolvable Address Hash offset in the supplied address buffer */ + aar_job.in[0].ptr = (void *)&addr[BDADDR_HASH_OFFSET]; + + /* Input, Resolvable Address Prand offset in the supplied address buffer */ + aar_job.in[1].ptr = (void *)&addr[BDADDR_PRND_OFFSET]; + + /* Reset match index to invalid value ( >= CONFIG_BT_CTLR_RL_SIZE ) */ + aar_job.status = UINT32_MAX; + + /* NOTE: Other `aar_job` structure members are initialized in `radio_ar_configure()` */ + + NRF_AAR->IN.PTR = (uint32_t)&aar_job.in[0]; + NRF_AAR->OUT.PTR = (uint32_t)&aar_job.out[0]; + NRF_AAR->MAXRESOLVED = AAR_JOB_OUT_MAX_RESOLVED; + +#else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ NRF_AAR->ADDRPTR = (uint32_t)addr - 3; +#endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ nrf_aar_event_clear(NRF_AAR, NRF_AAR_EVENT_END); nrf_aar_event_clear(NRF_AAR, NRF_AAR_EVENT_RESOLVED); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5.h index f01f9859db4..1b15f41c408 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5.h @@ -40,6 +40,7 @@ #include #include "radio_nrf5340.h" #elif defined(CONFIG_SOC_SERIES_NRF54LX) +#include #include "radio_nrf54lx.h" #elif defined(CONFIG_BOARD_NRF52_BSIM) #include "radio_sim_nrf52.h" @@ -47,6 +48,7 @@ #include #include "radio_sim_nrf5340.h" #elif defined(CONFIG_BOARD_NRF54L15BSIM_NRF54L15_CPUAPP) +#include #include "radio_sim_nrf54l.h" #else #error "Unsupported SoC." @@ -54,7 +56,6 @@ #if defined(CONFIG_BT_CTLR_NRF_GRTC) #include -#include #else /* !CONFIG_BT_CTLR_NRF_GRTC */ #include #endif /* !CONFIG_BT_CTLR_NRF_GRTC */ diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h index 047e3ea2487..3a8206d7976 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h @@ -398,6 +398,9 @@ #define CCM_MODE_DATARATE_500Kbps CCM_MODE_DATARATE_500Kbit #define CCM_RATEOVERRIDE_RATEOVERRIDE_500Kbps CCM_RATEOVERRIDE_RATEOVERRIDE_500Kbit +/* HAL abstraction of AAR h/w */ +#define NRF_AAR NRF_AAR00 + static inline void hal_radio_reset(void) { /* TODO: Add any required setup for each radio event diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h index 11bb973994b..1085f72f0b9 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h @@ -106,17 +106,17 @@ static inline void hal_event_timer_start_ppi_config(void) nrf_grtc_publish_set(NRF_GRTC, HAL_CNTR_GRTC_EVENT_COMPARE_RADIO, HAL_EVENT_TIMER_START_PPI); - /* Enable same DPPI in Peripheral domain */ - nrf_dppi_channels_enable(NRF_DPPIC20, - BIT(HAL_EVENT_TIMER_START_PPI)); + /* Setup PPIB receive publish */ + nrf_ppib_publish_set(NRF_PPIB11, HAL_PPIB_RECEIVE_EVENT_TIMER_START_PPI, + HAL_EVENT_TIMER_START_PPI); /* Setup PPIB send subscribe */ nrf_ppib_subscribe_set(NRF_PPIB21, HAL_PPIB_SEND_EVENT_TIMER_START_PPI, HAL_EVENT_TIMER_START_PPI); - /* Setup PPIB receive publish */ - nrf_ppib_publish_set(NRF_PPIB11, HAL_PPIB_RECEIVE_EVENT_TIMER_START_PPI, - HAL_EVENT_TIMER_START_PPI); + /* Enable same DPPI in Peripheral domain */ + nrf_dppi_channels_enable(NRF_DPPIC20, + BIT(HAL_EVENT_TIMER_START_PPI)); #else /* !CONFIG_BT_CTLR_NRF_GRTC */ nrf_rtc_publish_set(NRF_RTC, NRF_RTC_EVENT_COMPARE_2, HAL_EVENT_TIMER_START_PPI); @@ -148,22 +148,22 @@ static inline void hal_radio_ready_time_capture_ppi_config(void) */ static inline void hal_trigger_crypt_ppi_config(void) { +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_PAYLOAD, HAL_TRIGGER_CRYPT_PPI); nrf_ccm_subscribe_set(NRF_CCM, NRF_CCM_TASK_START, HAL_TRIGGER_CRYPT_PPI); -#if !defined(CONFIG_SOC_COMPATIBLE_NRF54LX) - nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_ADDRESS, HAL_TRIGGER_CRYPT_PPI); + /* Setup PPIB receive publish */ + nrf_ppib_publish_set(NRF_PPIB00, HAL_PPIB_RECEIVE_TRIGGER_CRYPT_PPI, HAL_TRIGGER_CRYPT_PPI); -#else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ - nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_PAYLOAD, HAL_TRIGGER_CRYPT_PPI); + /* Setup PPIB send subscribe */ + nrf_ppib_subscribe_set(NRF_PPIB10, HAL_PPIB_SEND_TRIGGER_CRYPT_PPI, HAL_TRIGGER_CRYPT_PPI); /* Enable same DPPI in MCU domain */ nrf_dppi_channels_enable(NRF_DPPIC00, BIT(HAL_TRIGGER_CRYPT_PPI)); - /* Setup PPIB send subscribe */ - nrf_ppib_subscribe_set(NRF_PPIB10, HAL_PPIB_SEND_TRIGGER_CRYPT_PPI, HAL_TRIGGER_CRYPT_PPI); - - /* Setup PPIB receive publish */ - nrf_ppib_publish_set(NRF_PPIB00, HAL_PPIB_RECEIVE_TRIGGER_CRYPT_PPI, HAL_TRIGGER_CRYPT_PPI); +#else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ + nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_ADDRESS, HAL_TRIGGER_CRYPT_PPI); + nrf_ccm_subscribe_set(NRF_CCM, NRF_CCM_TASK_START, HAL_TRIGGER_CRYPT_PPI); #endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ } @@ -226,6 +226,17 @@ static inline void hal_trigger_aar_ppi_config(void) { nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_BCMATCH, HAL_TRIGGER_AAR_PPI); nrf_aar_subscribe_set(NRF_AAR, NRF_AAR_TASK_START, HAL_TRIGGER_AAR_PPI); + +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) + /* Enable same DPPI in MCU domain */ + nrf_dppi_channels_enable(NRF_DPPIC00, BIT(HAL_TRIGGER_AAR_PPI)); + + /* Setup PPIB send subscribe */ + nrf_ppib_subscribe_set(NRF_PPIB10, HAL_PPIB_SEND_TRIGGER_AAR_PPI, HAL_TRIGGER_AAR_PPI); + + /* Setup PPIB receive publish */ + nrf_ppib_publish_set(NRF_PPIB00, HAL_PPIB_RECEIVE_TRIGGER_AAR_PPI, HAL_TRIGGER_AAR_PPI); +#endif /* CONFIG_SOC_COMPATIBLE_NRF54LX */ } #endif /* CONFIG_BT_CTLR_PRIVACY */ diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi_resources.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi_resources.h index 3c9a9e6949b..3a49b97e7b2 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi_resources.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi_resources.h @@ -60,19 +60,25 @@ */ #if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) #define HAL_TRIGGER_CRYPT_PPI 7 -#else /* CONFIG_SOC_COMPATIBLE_NRF54LX */ -#define HAL_TRIGGER_CRYPT_PPI HAL_RADIO_RECV_TIMEOUT_CANCEL_PPI -#endif /* CONFIG_SOC_COMPATIBLE_NRF54LX */ #define HAL_PPIB_SEND_TRIGGER_CRYPT_PPI \ _CONCAT(NRF_PPIB_TASK_SEND_, HAL_TRIGGER_CRYPT_PPI) #define HAL_PPIB_RECEIVE_TRIGGER_CRYPT_PPI \ _CONCAT(NRF_PPIB_EVENT_RECEIVE_, HAL_TRIGGER_CRYPT_PPI) +#else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ +#define HAL_TRIGGER_CRYPT_PPI HAL_RADIO_RECV_TIMEOUT_CANCEL_PPI +#endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ /******************************************************************************* * Trigger automatic address resolution on Bit counter match: * wire the RADIO EVENTS_BCMATCH event to the AAR TASKS_START task. */ #define HAL_TRIGGER_AAR_PPI 6 +#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) +#define HAL_PPIB_SEND_TRIGGER_AAR_PPI \ + _CONCAT(NRF_PPIB_TASK_SEND_, HAL_TRIGGER_AAR_PPI) +#define HAL_PPIB_RECEIVE_TRIGGER_AAR_PPI \ + _CONCAT(NRF_PPIB_EVENT_RECEIVE_, HAL_TRIGGER_AAR_PPI) +#endif /* CONFIG_SOC_COMPATIBLE_NRF54LX */ #if defined(CONFIG_BT_CTLR_PHY_CODED) && \ defined(CONFIG_HAS_HW_NRF_RADIO_BLE_CODED) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf54l.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf54l.h index 324f2c8edb3..8987031db5f 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf54l.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf54l.h @@ -392,6 +392,9 @@ #define CCM_MODE_DATARATE_500Kbps CCM_MODE_DATARATE_500Kbit #define CCM_RATEOVERRIDE_RATEOVERRIDE_500Kbps CCM_RATEOVERRIDE_RATEOVERRIDE_500Kbit +/* HAL abstraction of AAR h/w */ +#define NRF_AAR NRF_AAR00 + static inline void hal_radio_reset(void) { /* TODO: Add any required setup for each radio event diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ticker.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ticker.c index 9ebafae2e9c..e46ba7f6f62 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ticker.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ticker.c @@ -38,10 +38,10 @@ uint8_t hal_ticker_instance0_caller_id_get(uint8_t user_id) { uint8_t caller_id; - LL_ASSERT(user_id < sizeof(caller_id_lut)); + LL_ASSERT_DBG(user_id < sizeof(caller_id_lut)); caller_id = caller_id_lut[user_id]; - LL_ASSERT(caller_id != TICKER_CALL_ID_NONE); + LL_ASSERT_DBG(caller_id != TICKER_CALL_ID_NONE); return caller_id; } @@ -73,7 +73,7 @@ void hal_ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id, uint8_t ch break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; @@ -96,7 +96,7 @@ void hal_ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id, uint8_t ch break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; @@ -119,7 +119,7 @@ void hal_ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id, uint8_t ch break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; @@ -157,7 +157,7 @@ void hal_ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id, uint8_t ch break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; @@ -181,13 +181,13 @@ void hal_ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id, uint8_t ch break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c index cada046f049..0bf5d1772f1 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c @@ -461,7 +461,7 @@ void lll_disable(void *param) if (event.curr.abort_cb && event.curr.param) { event.curr.abort_cb(NULL, event.curr.param); } else { - LL_ASSERT(!param); + LL_ASSERT_ERR(!param); } } { @@ -519,12 +519,12 @@ int lll_done(void *param) /* Assert if param supplied without a pending prepare to cancel. */ next = ull_prepare_dequeue_get(); - LL_ASSERT(!param || next); + LL_ASSERT_ERR(!param || next); /* check if current LLL event is done */ if (!param) { /* Reset current event instance */ - LL_ASSERT(event.curr.abort_cb); + LL_ASSERT_ERR(event.curr.abort_cb); event.curr.abort_cb = NULL; param = event.curr.param; @@ -567,7 +567,7 @@ int lll_done(void *param) lll_done_score(param, result); extra = ull_event_done_extra_get(); - LL_ASSERT(extra); + LL_ASSERT_ERR(extra); /* Set result in done extra data - type was set by the role */ extra->result = result; @@ -575,7 +575,7 @@ int lll_done(void *param) /* Let ULL know about LLL event done */ evdone = ull_event_done(ull); - LL_ASSERT(evdone); + LL_ASSERT_ERR(evdone); return 0; } @@ -583,7 +583,7 @@ int lll_done(void *param) #if defined(CONFIG_BT_CTLR_LOW_LAT_ULL_DONE) void lll_done_ull_inc(void) { - LL_ASSERT(event.done.ull_count != event.done.lll_count); + LL_ASSERT_ERR(event.done.ull_count != event.done.lll_count); event.done.ull_count++; } #endif /* CONFIG_BT_CTLR_LOW_LAT_ULL_DONE */ @@ -623,7 +623,7 @@ void lll_abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); lll_done(param); } @@ -681,7 +681,7 @@ void lll_chan_set(uint32_t chan) } else if (chan < 40) { radio_freq_chan_set(28 + ((chan - 11) * 2U)); } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } break; } @@ -805,7 +805,7 @@ void lll_isr_cleanup(void *param) radio_stop(); err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); lll_done(NULL); } @@ -822,7 +822,7 @@ void lll_isr_early_abort(void *param) } err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); lll_done(NULL); } @@ -852,16 +852,41 @@ int lll_prepare_resolve(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb, ticks_at_preempt_next = ready->prepare_param.ticks_at_expire; diff = ticker_ticks_diff_get(ticks_at_preempt_min, ticks_at_preempt_next); + /* If the enqueued prepare is a resume or current ready prepare is shorter, then we + * should pick current ready prepare for setting up the prepare timeout. + */ if (is_resume || ((diff & BIT(HAL_TICKER_CNTR_MSBIT)) == 0U)) { ticks_at_preempt_min = ticks_at_preempt_next; if (&ready->prepare_param != prepare_param) { + /* There is a shorter prepare in the pipeline */ ready_short = ready; + } else { + /* It is the same prepare in the pipeline being enqueued. + * This can happen executing `lll_done()`. + * Hence, we should ignore it being the `first` that setup the + * preempt timeout and also it has already setup the preempt + * timeout, refer to `preempt_ticker_start()` for details. + * + * We also set the `ready` to NULL as it is the same ready, the one + * being enqueued. This help short circuit a related assertion check + * later in this function. + */ + ready = NULL; } } else { ready = NULL; idx_backup = UINT8_MAX; } + /* Loop and find any short prepare present out-of-order in the prepare pipeline. + * + * NOTE: This loop is O(n), where n is number of items in prepare pipeline present + * before a short prepare was enqueued in to the FIFO. + * Use of ordered linked list implementation has show improved lower latencies + * and less CPU use. + * TODO: Replace use of FIFO for prepare pipeline with ordered linked list + * implementation. + */ do { struct lll_event *ready_next; @@ -900,7 +925,7 @@ int lll_prepare_resolve(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb, /* Store the next prepare for deferred call */ next = ull_prepare_enqueue(is_abort_cb, abort_cb, prepare_param, prepare_cb, is_resume); - LL_ASSERT(next); + LL_ASSERT_ERR(next); #if !defined(CONFIG_BT_CTLR_LOW_LAT) if (is_resume || prepare_param->defer) { @@ -918,8 +943,8 @@ int lll_prepare_resolve(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb, /* Start the preempt timeout */ ret = preempt_ticker_start(first, ready, next); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); #else /* CONFIG_BT_CTLR_LOW_LAT */ next = NULL; @@ -941,7 +966,7 @@ int lll_prepare_resolve(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb, /* check if resume requested by curr */ err = event.curr.is_abort_cb(NULL, event.curr.param, &resume_cb); - LL_ASSERT(err); + LL_ASSERT_DBG(err); if (err == -EAGAIN) { void *curr_param; @@ -954,9 +979,9 @@ int lll_prepare_resolve(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb, next = resume_enqueue(event.curr.is_abort_cb, event.curr.abort_cb, resume_cb, curr_param); - LL_ASSERT(next); + LL_ASSERT_ERR(next); } else { - LL_ASSERT(err == -ECANCELED); + LL_ASSERT_ERR(err == -ECANCELED); } } #endif /* CONFIG_BT_CTLR_LOW_LAT */ @@ -964,7 +989,7 @@ int lll_prepare_resolve(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb, return -EINPROGRESS; } - LL_ASSERT(!ready || &ready->prepare_param == prepare_param); + LL_ASSERT_ERR(!ready || &ready->prepare_param == prepare_param); event.curr.param = prepare_param->param; event.curr.is_abort_cb = is_abort_cb; @@ -996,8 +1021,8 @@ int lll_prepare_resolve(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb, /* Start the preempt timeout */ ret = preempt_ticker_start(next, NULL, next); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); #endif /* !CONFIG_BT_CTLR_LOW_LAT */ return err; @@ -1012,7 +1037,7 @@ static int init_reset(void) static inline void done_inc(void) { event.done.lll_count++; - LL_ASSERT(event.done.lll_count != event.done.ull_count); + LL_ASSERT_ERR(event.done.lll_count != event.done.ull_count); } #endif /* CONFIG_BT_CTLR_LOW_LAT_ULL_DONE */ @@ -1066,7 +1091,7 @@ static void ticker_stop_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(preempt_stop_req != preempt_stop_ack); + LL_ASSERT_ERR(preempt_stop_req != preempt_stop_ack); preempt_stop_ack = preempt_stop_req; /* We do not fail on status not being success because under scenarios @@ -1077,7 +1102,7 @@ static void ticker_stop_op_cb(uint32_t status, void *param) * safe to reset preempt_req and preempt_ack here. */ if (status == TICKER_STATUS_SUCCESS) { - LL_ASSERT(preempt_req != preempt_ack); + LL_ASSERT_ERR(preempt_req != preempt_ack); } preempt_req = preempt_ack; @@ -1086,18 +1111,18 @@ static void ticker_stop_op_cb(uint32_t status, void *param) static void ticker_start_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); /* Increase preempt requested count before acknowledging that the * ticker start operation for the preempt timeout has been handled. */ - LL_ASSERT(preempt_req == preempt_ack); + LL_ASSERT_ERR(preempt_req == preempt_ack); preempt_req++; /* Increase preempt start ack count, to acknowledge that the ticker * start operation has been handled. */ - LL_ASSERT(preempt_start_req != preempt_start_ack); + LL_ASSERT_ERR(preempt_start_req != preempt_start_ack); preempt_start_ack = preempt_start_req; } @@ -1141,8 +1166,8 @@ static uint32_t preempt_ticker_start(struct lll_event *first, /* Stop any scheduled preempt ticker */ ret = preempt_ticker_stop(); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); /* Schedule short preempt timeout */ first = next; @@ -1196,8 +1221,8 @@ static uint32_t preempt_ticker_stop(void) TICKER_USER_ID_LLL, TICKER_ID_LLL_PREEMPT, ticker_stop_op_cb, NULL); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); return ret; } @@ -1210,13 +1235,13 @@ static void preempt_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, static struct mayfly mfy = {0, 0, &link, NULL, preempt}; uint32_t ret; - LL_ASSERT(preempt_ack != preempt_req); + LL_ASSERT_ERR(preempt_ack != preempt_req); preempt_ack = preempt_req; mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void preempt(void *param) @@ -1287,8 +1312,8 @@ static void preempt(void *param) /* Start the preempt timeout for (short) ready event */ ret = preempt_ticker_start(ready, NULL, ready); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); return; } @@ -1322,7 +1347,7 @@ static void preempt(void *param) return; } - LL_ASSERT(ready->prepare_param.param == param); + LL_ASSERT_ERR(ready->prepare_param.param == param); } /* Check if current event want to continue */ @@ -1345,8 +1370,8 @@ static void preempt(void *param) /* Start the preempt timeout for next ready prepare */ ret = preempt_ticker_start(ready, NULL, ready); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } else { /* Let preemptor LLL know about the cancelled prepare */ @@ -1416,9 +1441,9 @@ static void preempt(void *param) /* Enqueue as resume event */ iter = resume_enqueue(is_abort_cb, abort_cb, resume_cb, curr_param); - LL_ASSERT(iter); + LL_ASSERT_ERR(iter); } else { - LL_ASSERT(err == -ECANCELED); + LL_ASSERT_ERR(err == -ECANCELED); } } #else /* CONFIG_BT_CTLR_LOW_LAT */ @@ -1432,8 +1457,8 @@ static void mfy_ticker_job_idle_get(void *param) ret = ticker_job_idle_get(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_LOW, ticker_op_job_disable, NULL); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } static void ticker_op_job_disable(uint32_t status, void *op_context) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c index 96d93b2b855..8c7837bf980 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c @@ -435,12 +435,12 @@ struct pdu_adv *lll_adv_pdu_alloc_pdu_adv(void) } err = k_sem_take(&sem_pdu_free, PDU_FREE_TIMEOUT); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); k_sem_reset(&sem_pdu_free); p = MFIFO_DEQUEUE(pdu_free); - LL_ASSERT(p); + LL_ASSERT_ERR(p); #if defined(CONFIG_BT_CTLR_ADV_PDU_LINK) PDU_ADV_NEXT_PTR(p) = NULL; @@ -681,10 +681,10 @@ void lll_adv_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); err = lll_prepare(is_abort_cb, abort_cb, prepare_cb, 0, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } bool lll_adv_scan_req_check(struct lll_adv *lll, struct pdu_adv *sr, @@ -836,7 +836,7 @@ static void *adv_extra_data_allocate(struct lll_adv_pdu *pdu, uint8_t last) extra_data = MFIFO_DEQUEUE_PEEK(extra_data_free); if (extra_data) { err = k_sem_take(&sem_extra_data_free, K_NO_WAIT); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); MFIFO_DEQUEUE(extra_data_free); pdu->extra_data[last] = extra_data; @@ -852,10 +852,10 @@ static void *adv_extra_data_allocate(struct lll_adv_pdu *pdu, uint8_t last) } err = k_sem_take(&sem_extra_data_free, PDU_FREE_TIMEOUT); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); extra_data = MFIFO_DEQUEUE(extra_data_free); - LL_ASSERT(extra_data); + LL_ASSERT_ERR(extra_data); pdu->extra_data[last] = (void *)extra_data; @@ -913,7 +913,7 @@ static void extra_data_free_sem_give(void) retval = mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!retval); + LL_ASSERT_ERR(!retval); } #else /* !CONFIG_BT_CTLR_ZLI */ @@ -1062,7 +1062,7 @@ static int prepare_cb(struct lll_prepare_param *p) #endif ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_A(1); @@ -1102,7 +1102,7 @@ static int is_abort_cb(void *next, void *curr, lll_prepare_cb_t *resume_cb) /* Retain HF clk */ err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); return -EAGAIN; #endif /* CONFIG_BT_PERIPHERAL */ @@ -1140,7 +1140,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); lll_done(param); } @@ -1178,11 +1178,16 @@ static void isr_tx(void *param) /* setup Rx buffer */ node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_pkt_rx_set(node_rx->pdu); /* assert if radio packet ptr is not set and radio started rx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -1421,7 +1426,7 @@ static void isr_done(void *param) struct event_done_extra *extra; extra = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_ADV); - LL_ASSERT(extra); + LL_ASSERT_ERR(extra); } #endif /* CONFIG_BT_CTLR_ADV_EXT || CONFIG_BT_CTLR_JIT_SCHEDULING */ @@ -1459,7 +1464,7 @@ static void isr_abort_all(void *param) /* Abort any LLL prepare/resume enqueued in pipeline */ mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_LLL, 1U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } #endif /* CONFIG_BT_PERIPHERAL */ @@ -1470,7 +1475,7 @@ static struct pdu_adv *chan_prepare(struct lll_adv *lll) uint8_t upd; chan = find_lsb_set(lll->chan_map_curr); - LL_ASSERT(chan); + LL_ASSERT_DBG(chan); lll->chan_map_curr &= (lll->chan_map_curr - 1); @@ -1479,7 +1484,7 @@ static struct pdu_adv *chan_prepare(struct lll_adv *lll) /* FIXME: get latest only when primary PDU without Aux PDUs */ upd = 0U; pdu = lll_adv_data_latest_get(lll, &upd); - LL_ASSERT(pdu); + LL_ASSERT_DBG(pdu); radio_pkt_tx_set(pdu); @@ -1489,7 +1494,7 @@ static struct pdu_adv *chan_prepare(struct lll_adv *lll) struct pdu_adv *scan_pdu; scan_pdu = lll_adv_scan_rsp_latest_get(lll, &upd); - LL_ASSERT(scan_pdu); + LL_ASSERT_DBG(scan_pdu); #if defined(CONFIG_BT_CTLR_PRIVACY) if (upd) { @@ -1546,7 +1551,7 @@ static inline int isr_rx_pdu(struct lll_adv *lll, #endif /* CONFIG_BT_CTLR_PRIVACY */ node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu_rx = (void *)node_rx->pdu; pdu_adv = lll_adv_data_curr_get(lll); @@ -1571,7 +1576,12 @@ static inline int isr_rx_pdu(struct lll_adv *lll, radio_pkt_tx_set(lll_adv_scan_rsp_curr_get(lll)); /* assert if radio packet ptr is not set and radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -1642,7 +1652,12 @@ static inline int isr_rx_pdu(struct lll_adv *lll, radio_disable(); /* assert if radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c index 731ca94ed50..f4b48cabab9 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c @@ -104,10 +104,10 @@ void lll_adv_aux_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); err = lll_prepare(lll_is_abort_cb, lll_abort_cb, prepare_cb, 0, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } void lll_adv_aux_pback_prepare(void *param) @@ -143,7 +143,7 @@ static int prepare_cb(struct lll_prepare_param *p) /* FIXME: get latest only when primary PDU without Aux PDUs */ upd = 0U; sec_pdu = lll_adv_aux_data_latest_get(lll, &upd); - LL_ASSERT(sec_pdu); + LL_ASSERT_DBG(sec_pdu); #if defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) struct ll_adv_aux_set *aux; @@ -163,14 +163,14 @@ static int prepare_cb(struct lll_prepare_param *p) /* Get reference to primary PDU */ pri_pdu = lll_adv_data_curr_get(lll_adv); - LL_ASSERT(pri_pdu->type == PDU_ADV_TYPE_EXT_IND); + LL_ASSERT_DBG(pri_pdu->type == PDU_ADV_TYPE_EXT_IND); /* Get reference to common extended header */ com_hdr = (void *)&pri_pdu->adv_ext_ind; /* Get reference to aux pointer structure */ err = aux_ptr_get(pri_pdu, &aux_ptr); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* Abort if no aux_ptr filled */ if (unlikely(!aux_ptr || !PDU_ADV_AUX_PTR_OFFSET_GET(aux_ptr))) { @@ -218,7 +218,7 @@ static int prepare_cb(struct lll_prepare_param *p) struct pdu_adv *scan_pdu; scan_pdu = lll_adv_scan_rsp_latest_get(lll_adv, &upd); - LL_ASSERT(scan_pdu); + LL_ASSERT_DBG(scan_pdu); radio_isr_set(isr_tx_rx, lll); radio_tmr_tifs_set(EVENT_IFS_US); @@ -340,7 +340,7 @@ static int prepare_cb(struct lll_prepare_param *p) #endif /* CONFIG_BT_CTLR_ADV_AUX_PDU_BACK2BACK */ ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_A(1); @@ -411,7 +411,7 @@ static void isr_early_abort(void *param) /* Generate auxiliary radio event done */ extra = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_ADV_AUX); - LL_ASSERT(extra); + LL_ASSERT_ERR(extra); radio_isr_set(isr_race, param); if (!radio_is_idle()) { @@ -419,7 +419,7 @@ static void isr_early_abort(void *param) } err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); lll_done(NULL); } @@ -434,7 +434,7 @@ static void isr_done(void *param) /* Generate auxiliary radio event done */ extra = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_ADV_AUX); - LL_ASSERT(extra); + LL_ASSERT_ERR(extra); /* Cleanup radio event and dispatch the done event */ lll_isr_cleanup(param); @@ -462,14 +462,14 @@ static void isr_tx_chain(void *param) /* Get reference to aux pointer structure */ err = aux_ptr_get(lll_aux->last_pdu, &aux_ptr); - LL_ASSERT(!err && aux_ptr); + LL_ASSERT_ERR(!err && aux_ptr); /* Use channel idx that was in aux_ptr */ lll_chan_set(aux_ptr->chan_idx); /* Get reference to the auxiliary chain PDU */ pdu = lll_adv_pdu_linked_next_get(lll_aux->last_pdu); - LL_ASSERT(pdu); + LL_ASSERT_DBG(pdu); /* Set the last used auxiliary PDU for transmission */ lll_aux->last_pdu = pdu; @@ -488,7 +488,12 @@ static void isr_tx_chain(void *param) radio_pkt_tx_set(pdu); /* assert if radio packet ptr is not set and radio started rx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -552,7 +557,7 @@ static void aux_ptr_chan_idx_set(struct lll_adv_aux *lll, struct pdu_adv *pdu) /* Get reference to aux pointer structure */ err = aux_ptr_get(pdu, &aux_ptr); - LL_ASSERT(!err && aux_ptr); + LL_ASSERT_ERR(!err && aux_ptr); /* Calculate a new channel index */ aux = HDR_LLL2ULL(lll); @@ -598,11 +603,16 @@ static void isr_tx_rx(void *param) /* setup Rx buffer */ node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_pkt_rx_set(node_rx->pdu); /* assert if radio packet ptr is not set and radio started rx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -754,12 +764,12 @@ static inline int isr_rx_pdu(struct lll_adv_aux *lll_aux, uint8_t phy_flags_rx, lll = lll_aux->adv; node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu_rx = (void *)node_rx->pdu; pdu_adv = lll_adv_data_curr_get(lll); pdu_aux = lll_adv_aux_data_latest_get(lll_aux, &upd); - LL_ASSERT(pdu_aux); + LL_ASSERT_DBG(pdu_aux); hdr = &pdu_aux->adv_ext_ind.ext_hdr; @@ -809,7 +819,12 @@ static inline int isr_rx_pdu(struct lll_adv_aux *lll_aux, uint8_t phy_flags_rx, radio_pkt_tx_set(sr_pdu); /* assert if radio packet ptr is not set and radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -881,7 +896,12 @@ static inline int isr_rx_pdu(struct lll_adv_aux *lll_aux, uint8_t phy_flags_rx, radio_pkt_tx_set(pdu_tx); /* assert if radio packet ptr is not set and radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c index 0b9ff8d938c..cc26f729dfc 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c @@ -115,7 +115,7 @@ static void prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); p = param; @@ -135,7 +135,7 @@ static void create_prepare_bh(void *param) /* Invoke common pipeline handling of prepare */ err = lll_prepare(lll_is_abort_cb, lll_abort_cb, create_prepare_cb, 0U, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } static void prepare_bh(void *param) @@ -144,7 +144,7 @@ static void prepare_bh(void *param) /* Invoke common pipeline handling of prepare */ err = lll_prepare(lll_is_abort_cb, lll_abort_cb, prepare_cb, 0U, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } static int create_prepare_cb(struct lll_prepare_param *p) @@ -269,7 +269,7 @@ static int prepare_cb_common(struct lll_prepare_param *p) stream_handle = lll->stream_handle[bis_idx]; handle = LL_BIS_ADV_HANDLE_FROM_IDX(stream_handle); stream = ull_adv_iso_lll_stream_get(stream_handle); - LL_ASSERT(stream); + LL_ASSERT_DBG(stream); do { link = memq_peek(stream->memq_tx.head, @@ -448,7 +448,7 @@ static int prepare_cb_common(struct lll_prepare_param *p) #endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */ ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); /* Calculate ahead the next subevent channel index */ if (false) { @@ -470,7 +470,7 @@ static int prepare_cb_common(struct lll_prepare_param *p) #endif /* CONFIG_BT_CTLR_ADV_ISO_INTERLEAVED */ } else { - LL_ASSERT(false); + LL_ASSERT_DBG(false); } return 0; @@ -582,7 +582,7 @@ static void isr_tx_common(void *param, } else { bis = 0U; - LL_ASSERT(false); + LL_ASSERT_DBG(false); } if (!is_ctrl) { @@ -649,7 +649,7 @@ static void isr_tx_common(void *param, stream_handle = lll->stream_handle[bis_idx]; handle = LL_BIS_ADV_HANDLE_FROM_IDX(stream_handle); stream = ull_adv_iso_lll_stream_get(stream_handle); - LL_ASSERT(stream); + LL_ASSERT_DBG(stream); do { struct node_tx_iso *tx; @@ -727,7 +727,7 @@ static void isr_tx_common(void *param, /* FIXME: memq_peek_n function does not support indices > UINT8_MAX, * add assertion check to honor this limitation. */ - LL_ASSERT(payload_index <= UINT8_MAX); + LL_ASSERT_DBG(payload_index <= UINT8_MAX); } else { payload_index = lll->bn_curr - 1U; /* 3 bits */ } @@ -742,7 +742,7 @@ static void isr_tx_common(void *param, stream_handle = lll->stream_handle[lll->bis_curr - 1U]; stream = ull_adv_iso_lll_stream_get(stream_handle); - LL_ASSERT(stream); + LL_ASSERT_DBG(stream); link = memq_peek_n(stream->memq_tx.head, stream->memq_tx.tail, payload_index, (void **)&tx); @@ -869,7 +869,12 @@ static void isr_tx_common(void *param, } /* assert if radio packet ptr is not set and radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -917,7 +922,7 @@ static void isr_tx_common(void *param, #endif /* CONFIG_BT_CTLR_ADV_ISO_INTERLEAVED */ } else { - LL_ASSERT(false); + LL_ASSERT_DBG(false); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -1033,7 +1038,7 @@ static void isr_done_term(void *param) lll_isr_status_reset(); lll = param; - LL_ASSERT(lll->ctrl_expire); + LL_ASSERT_DBG(lll->ctrl_expire); elapsed_event = lll->latency_event + 1U; if (lll->ctrl_expire > elapsed_event) { @@ -1070,7 +1075,7 @@ static void isr_done_term(void *param) * Advertising PDU. */ rx = ull_pdu_rx_alloc(); - LL_ASSERT(rx); + LL_ASSERT_ERR(rx); rx->hdr.type = NODE_RX_TYPE_BIG_CHM_COMPLETE; rx->rx_ftr.param = lll; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c index e30b6d6b8d2..be8b8aa03a4 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c @@ -86,11 +86,11 @@ void lll_adv_sync_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Invoke common pipeline handling of prepare */ err = lll_prepare(lll_is_abort_cb, abort_cb, prepare_cb, 0, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } static int init_reset(void) @@ -176,7 +176,7 @@ static int prepare_cb(struct lll_prepare_param *p) upd = 0U; pdu = lll_adv_sync_data_latest_get(lll, NULL, &upd); - LL_ASSERT(pdu); + LL_ASSERT_DBG(pdu); #if defined(CONFIG_BT_CTLR_DF_ADV_CTE_TX) lll_df_cte_tx_enable(lll, pdu, &cte_len_us); @@ -278,7 +278,7 @@ static int prepare_cb(struct lll_prepare_param *p) #endif /* CONFIG_BT_CTLR_ADV_SYNC_PDU_BACK2BACK */ ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_A(1); @@ -305,7 +305,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Accumulate the latency as event is aborted while being in pipeline */ lll = prepare_param->param; @@ -336,7 +336,7 @@ static void isr_done(void *param) * the thread context. */ rx = ull_pdu_rx_alloc(); - LL_ASSERT(rx); + LL_ASSERT_ERR(rx); rx->hdr.type = NODE_RX_TYPE_SYNC_CHM_COMPLETE; rx->rx_ftr.param = lll; @@ -370,14 +370,14 @@ static void isr_tx(void *param) /* Get reference to aux pointer structure */ err = aux_ptr_get(lll_sync->last_pdu, &aux_ptr); - LL_ASSERT(!err && aux_ptr); + LL_ASSERT_ERR(!err && aux_ptr); /* Use channel idx that was in aux_ptr */ lll_chan_set(aux_ptr->chan_idx); /* Get reference to the auxiliary chain PDU */ pdu = lll_adv_pdu_linked_next_get(lll_sync->last_pdu); - LL_ASSERT(pdu); + LL_ASSERT_DBG(pdu); /* Set the last used auxiliary PDU for transmission */ lll_sync->last_pdu = pdu; @@ -401,7 +401,12 @@ static void isr_tx(void *param) radio_pkt_tx_set(pdu); /* assert if radio packet ptr is not set and radio started rx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -509,7 +514,7 @@ static void aux_ptr_chan_idx_set(struct lll_adv_sync *lll, struct pdu_adv *pdu) /* Get reference to aux pointer structure */ err = aux_ptr_get(pdu, &aux_ptr); - LL_ASSERT(!err && aux_ptr); + LL_ASSERT_ERR(!err && aux_ptr); /* Calculate a new channel index */ chan_idx = lll_chan_sel_2(lll->data_chan_counter, lll->data_chan_id, diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c index 4f082b4957a..fb170046a96 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c @@ -72,12 +72,12 @@ void lll_central_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Invoke common pipeline handling of prepare */ err = lll_prepare(lll_conn_central_is_abort_cb, lll_conn_abort_cb, prepare_cb, 0, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } static int init_reset(void) @@ -139,7 +139,7 @@ static int prepare_cb(struct lll_prepare_param *p) lll->data_chan_count); #else /* !CONFIG_BT_CTLR_CHAN_SEL_2 */ data_chan_use = 0; - LL_ASSERT(0); + LL_ASSERT_DBG(0); #endif /* !CONFIG_BT_CTLR_CHAN_SEL_2 */ } else { data_chan_use = lll_chan_sel_1(&lll->data_chan_use, @@ -266,7 +266,7 @@ static int prepare_cb(struct lll_prepare_param *p) #endif /* !CONFIG_BT_CTLR_XTAL_ADVANCED */ ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_M(1); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c index 7ae759dd2be..3d02a092f33 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c @@ -34,6 +34,7 @@ #include "lll_internal.h" #include "lll_tim_internal.h" +#include "lll_prof_internal.h" #include "ll_feat.h" @@ -96,11 +97,11 @@ void lll_central_iso_prepare(void *param) /* Initiate HF clock start up */ err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Invoke common pipeline handling of prepare */ err = lll_prepare(lll_is_abort_cb, abort_cb, prepare_cb, 0U, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } static int init_reset(void) @@ -142,7 +143,7 @@ static int prepare_cb(struct lll_prepare_param *p) cis_lll = ull_conn_iso_lll_stream_get_by_group(cig_lll, &cis_handle_curr); } while (cis_lll && !cis_lll->active); - LL_ASSERT(cis_lll); + LL_ASSERT_DBG(cis_lll); /* Unconditionally set the prepared flag. * This flag ensures current CIG event does not pick up a new CIS becoming active when the @@ -155,7 +156,7 @@ static int prepare_cb(struct lll_prepare_param *p) /* Get reference to ACL context */ conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); /* Pick the event_count calculated in the ULL prepare */ cis_lll->event_count = cis_lll->event_count_prepare; @@ -394,7 +395,7 @@ static int prepare_cb(struct lll_prepare_param *p) /* Prepare is done */ ret = lll_prepare_done(cig_lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_M(1); @@ -434,7 +435,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) /* Get reference to ACL context */ const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); if (conn_lll->enc_rx) { radio_ccm_disable(); @@ -448,7 +449,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Get reference to CIG LLL context */ cig_lll = prepare_param->param; @@ -466,6 +467,10 @@ static void isr_tx(void *param) struct node_rx_pdu *node_rx; uint32_t hcto; + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_latency_capture(); + } + /* Call to ensure packet/event timer accumulates the elapsed time * under single timer use. */ @@ -489,13 +494,13 @@ static void isr_tx(void *param) /* Acquire rx node for reception */ node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); #if defined(CONFIG_BT_CTLR_LE_ENC) /* Get reference to ACL context */ const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); #endif /* CONFIG_BT_CTLR_LE_ENC */ /* PHY */ @@ -538,7 +543,12 @@ static void isr_tx(void *param) } /* assert if radio packet ptr is not set and radio started rx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } /* +/- 2us active clock jitter, +1 us PPI to timer start compensation */ hcto = radio_tmr_tifs_base_get() + cis_lll->tifs_us + @@ -598,12 +608,12 @@ static void isr_tx(void *param) (cis_lll->sub_interval * se_curr); start_us = radio_tmr_start_us(1U, subevent_us); - LL_ASSERT(start_us == (subevent_us + 1U)); + LL_ASSERT_ERR(start_us == (subevent_us + 1U)); #endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ /* Get reference to ACL context */ evt_conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(evt_conn_lll != NULL); + LL_ASSERT_DBG(evt_conn_lll != NULL); /* Calculate the radio channel to use for next subevent */ data_chan_id = lll_chan_id(cis_lll->access_addr); @@ -642,7 +652,7 @@ static void isr_tx(void *param) subevent_us += next_cis_lll->offset - cis_offset_first; start_us = radio_tmr_start_us(1U, subevent_us); - LL_ASSERT(start_us == (subevent_us + 1U)); + LL_ASSERT_ERR(start_us == (subevent_us + 1U)); #endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ /* Event counter value, 0-15 bit of cisEventCounter */ @@ -650,7 +660,7 @@ static void isr_tx(void *param) /* Get reference to ACL context */ next_conn_lll = ull_conn_lll_get(next_cis_lll->acl_handle); - LL_ASSERT(next_conn_lll != NULL); + LL_ASSERT_DBG(next_conn_lll != NULL); /* Calculate the radio channel to use for ISO event */ data_chan_id = lll_chan_id(next_cis_lll->access_addr); @@ -705,6 +715,10 @@ static void isr_rx(void *param) uint8_t crc_ok; uint8_t cie; + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_latency_capture(); + } + /* Read radio status and events */ trx_done = radio_is_done(); if (trx_done) { @@ -758,7 +772,7 @@ static void isr_rx(void *param) /* Get reference to received PDU */ node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu_rx = (void *)node_rx->pdu; /* Tx ACK */ @@ -791,7 +805,7 @@ static void isr_rx(void *param) /* Get reference to ACL context */ const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); /* If required, wait for CCM to finish */ @@ -799,7 +813,7 @@ static void isr_rx(void *param) uint32_t done; done = radio_ccm_is_done(); - LL_ASSERT(done); + LL_ASSERT_ERR(done); if (!radio_ccm_mic_is_valid()) { /* Record MIC invalid */ @@ -880,7 +894,7 @@ static void isr_rx(void *param) /* Get reference to ACL context */ next_conn_lll = ull_conn_lll_get(next_cis_lll->acl_handle); - LL_ASSERT(next_conn_lll != NULL); + LL_ASSERT_DBG(next_conn_lll != NULL); /* Calculate CIS channel if not already calculated */ if (se_curr < cis_lll->nse) { @@ -898,7 +912,7 @@ static void isr_rx(void *param) subevent_us += next_cis_lll->offset - cis_offset_first; start_us = radio_tmr_start_us(1U, subevent_us); - LL_ASSERT(start_us == (subevent_us + 1U)); + LL_ASSERT_ERR(start_us == (subevent_us + 1U)); #endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ /* Event counter value, 0-15 bit of cisEventCounter */ @@ -975,6 +989,10 @@ static void isr_rx(void *param) isr_prepare_subevent(param); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_send(); + } + return; isr_rx_done: @@ -1057,7 +1075,7 @@ static void isr_prepare_subevent(void *param) /* Get reference to ACL context */ const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); #endif /* CONFIG_BT_CTLR_LE_ENC */ /* PHY */ @@ -1116,7 +1134,7 @@ static void isr_prepare_subevent(void *param) #if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) start_us = radio_tmr_start_us(1U, subevent_us); - LL_ASSERT(start_us == (subevent_us + 1U)); + LL_ASSERT_ERR(start_us == (subevent_us + 1U)); #else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ /* Compensate for the 1 us added by radio_tmr_start_us() */ @@ -1131,6 +1149,13 @@ static void isr_prepare_subevent(void *param) radio_tmr_end_capture(); #if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) + /* PA enable is overwriting packet end used in ISR profiling, hence + * back it up for later use. + */ + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_radio_end_backup(); + } + radio_gpio_pa_setup(); #if defined(CONFIG_BT_CTLR_PHY) @@ -1148,7 +1173,16 @@ static void isr_prepare_subevent(void *param) #endif /* !HAL_RADIO_GPIO_HAVE_PA_PIN */ /* assert if radio packet ptr is not set and radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } + + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_cputime_capture(); + } radio_isr_set(isr_tx, param); @@ -1169,7 +1203,7 @@ static void isr_done(void *param) payload_count_flush_or_inc_on_close(cis_lll); e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); e->type = EVENT_DONE_EXTRA_TYPE_CIS; e->trx_performed_bitmask = trx_performed_bitmask; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c index 1527987c02d..76663641f80 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c @@ -189,7 +189,7 @@ int lll_conn_central_is_abort_cb(void *next, void *curr, return -EBUSY; } - LL_ASSERT(trx_busy_iteration < CENTRAL_TRX_BUSY_ITERATION_MAX); + LL_ASSERT_DBG(trx_busy_iteration < CENTRAL_TRX_BUSY_ITERATION_MAX); return -ECANCELED; } @@ -223,7 +223,7 @@ int lll_conn_peripheral_is_abort_cb(void *next, void *curr, return -EBUSY; } - LL_ASSERT(trx_busy_iteration < PERIPHERAL_TRX_BUSY_ITERATION_MAX); + LL_ASSERT_DBG(trx_busy_iteration < PERIPHERAL_TRX_BUSY_ITERATION_MAX); return -ECANCELED; } @@ -268,7 +268,7 @@ void lll_conn_abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Get reference to LLL connection context */ lll = prepare_param->param; @@ -290,7 +290,7 @@ void lll_conn_abort_cb(struct lll_prepare_param *prepare_param, void *param) /* Extra done event, to check supervision timeout */ e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); e->type = EVENT_DONE_EXTRA_TYPE_CONN; e->trx_cnt = 0U; @@ -311,9 +311,6 @@ void lll_conn_isr_rx(void *param) struct pdu_data *pdu_data_tx; struct node_rx_pdu *node_rx; struct node_tx *tx_release; -#if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) - uint32_t pa_lna_enable_us; -#endif /* HAL_RADIO_GPIO_HAVE_PA_PIN */ uint8_t is_rx_enqueue; struct lll_conn *lll; uint8_t rssi_ready; @@ -367,7 +364,7 @@ void lll_conn_isr_rx(void *param) lll = param; node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu_data_rx = (void *)node_rx->pdu; @@ -384,7 +381,12 @@ void lll_conn_isr_rx(void *param) radio_disable(); /* assert if radio started tx before being disabled */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", + __func__, lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } goto lll_conn_isr_rx_exit; } @@ -468,10 +470,13 @@ void lll_conn_isr_rx(void *param) } else if (!lll->role) { radio_disable(); - /* assert if radio packet ptr is not set and radio - * started tx. - */ - LL_ASSERT(!radio_is_ready()); + /* assert if radio started tx before being disabled */ + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", + __func__, lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } /* Restore state if last transmitted was empty PDU */ lll->empty = is_empty_pdu_tx_retry; @@ -507,6 +512,7 @@ void lll_conn_isr_rx(void *param) lll_conn_tx_pkt_set(lll, pdu_data_tx); #if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) + uint32_t pa_lna_enable_us; #if defined(CONFIG_BT_CTLR_PROFILE_ISR) /* PA enable is overwriting packet end used in ISR profiling, hence @@ -529,10 +535,10 @@ void lll_conn_isr_rx(void *param) /* assert if radio packet ptr is not set and radio started tx */ if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { - LL_ASSERT_MSG(!radio_is_address(), "%s: Radio ISR latency: %u", __func__, + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_address()); + LL_ASSERT_ERR(!radio_is_ready()); } #if defined(CONFIG_BT_CTLR_TX_DEFER) @@ -564,7 +570,7 @@ void lll_conn_isr_rx(void *param) is_ull_rx = 0U; if (tx_release) { - LL_ASSERT(lll->handle != 0xFFFF); + LL_ASSERT_DBG(lll->handle != 0xFFFF); ull_conn_lll_ack_enqueue(lll->handle, tx_release); @@ -727,15 +733,15 @@ void lll_conn_isr_tx(void *param) /* assert if radio packet ptr is not set and radio started rx */ if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { - LL_ASSERT_MSG(!radio_is_address(), "%s: Radio ISR latency: %u", __func__, + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_address()); + LL_ASSERT_ERR(!radio_is_ready()); } #if defined(CONFIG_BT_CTLR_DF_CONN_CTE_TX) pdu_tx = get_last_tx_pdu(lll); - LL_ASSERT(pdu_tx); + LL_ASSERT_DBG(pdu_tx); if (pdu_tx->cp) { cte_len = CTE_LEN_US(pdu_tx->octet3.cte_info.time); @@ -830,7 +836,7 @@ void lll_conn_rx_pkt_set(struct lll_conn *lll) uint8_t phy; node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); /* In case of ISR latencies, if packet pointer has not been set on time * then we do not want to check uninitialized length in rx buffer that @@ -1035,7 +1041,7 @@ static void isr_done(void *param) lll_isr_status_reset(); e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); e->type = EVENT_DONE_EXTRA_TYPE_CONN; e->trx_cnt = trx_cnt; @@ -1176,7 +1182,7 @@ static inline int isr_rx_pdu(struct lll_conn *lll, struct pdu_data *pdu_data_rx, FORCE_MD_CNT_SET(); } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } if (IS_ENABLED(CONFIG_BT_CENTRAL) && !lll->role && @@ -1203,7 +1209,7 @@ static inline int isr_rx_pdu(struct lll_conn *lll, struct pdu_data *pdu_data_rx, uint32_t done; done = radio_ccm_is_done(); - LL_ASSERT(done); + LL_ASSERT_ERR(done); bool mic_failure = !radio_ccm_mic_is_valid(); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_df.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_df.c index f4a12ef5e93..a9a575a3230 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_df.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_df.c @@ -103,7 +103,7 @@ void lll_df_cte_tx_enable(struct lll_adv_sync *lll_sync, const struct pdu_adv *p const struct lll_df_adv_cfg *df_cfg; df_cfg = lll_adv_sync_extra_data_curr_get(lll_sync); - LL_ASSERT(df_cfg); + LL_ASSERT_DBG(df_cfg); lll_df_cte_tx_configure(df_cfg->cte_type, df_cfg->cte_length, df_cfg->ant_sw_len, df_cfg->ant_ids); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c index 8c3b83efd72..a25265400db 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c @@ -73,7 +73,7 @@ void lll_periph_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); p = param; @@ -82,7 +82,7 @@ void lll_periph_prepare(void *param) /* Invoke common pipeline handling of prepare */ err = lll_prepare(lll_conn_peripheral_is_abort_cb, lll_conn_abort_cb, prepare_cb, 0U, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } static int init_reset(void) @@ -143,7 +143,7 @@ static int prepare_cb(struct lll_prepare_param *p) lll->data_chan_count); #else /* !CONFIG_BT_CTLR_CHAN_SEL_2 */ data_chan_use = 0; - LL_ASSERT(0); + LL_ASSERT_DBG(0); #endif /* !CONFIG_BT_CTLR_CHAN_SEL_2 */ } else { data_chan_use = lll_chan_sel_1(&lll->data_chan_use, @@ -355,7 +355,7 @@ static int prepare_cb(struct lll_prepare_param *p) #endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */ ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_S(1); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c index 5d23a12993b..8178be1c7d2 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c @@ -34,6 +34,7 @@ #include "lll_internal.h" #include "lll_tim_internal.h" +#include "lll_prof_internal.h" #include "ll_feat.h" @@ -99,7 +100,7 @@ void lll_peripheral_iso_prepare(void *param) /* Initiate HF clock start up */ err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); p = param; @@ -107,7 +108,7 @@ void lll_peripheral_iso_prepare(void *param) /* Invoke common pipeline handling of prepare */ err = lll_prepare(lll_is_abort_cb, abort_cb, prepare_cb, 0U, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } void lll_peripheral_iso_flush(uint16_t handle, struct lll_conn_iso_stream *lll) @@ -156,7 +157,7 @@ static int prepare_cb(struct lll_prepare_param *p) cis_lll = ull_conn_iso_lll_stream_sorted_get_by_group(cig_lll, &cis_handle_curr); } while (cis_lll && !cis_lll->active); - LL_ASSERT(cis_lll); + LL_ASSERT_DBG(cis_lll); /* Unconditionally set the prepared flag. * This flag ensures current CIG event does not pick up a new CIS becoming active when the @@ -169,7 +170,7 @@ static int prepare_cb(struct lll_prepare_param *p) /* Get reference to ACL context */ conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); /* Pick the event_count calculated in the ULL prepare */ cis_lll->event_count = cis_lll->event_count_prepare; @@ -232,7 +233,7 @@ static int prepare_cb(struct lll_prepare_param *p) lll_chan_set(data_chan_use); node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); /* Encryption */ if (false) { @@ -409,7 +410,7 @@ static int prepare_cb(struct lll_prepare_param *p) /* Prepare is done */ ret = lll_prepare_done(cig_lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_S(1); @@ -450,7 +451,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) /* Get reference to ACL context */ const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); if (conn_lll->enc_rx) { radio_ccm_disable(); @@ -464,7 +465,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Get reference to CIG LLL context */ cig_lll = prepare_param->param; @@ -496,6 +497,10 @@ static void isr_rx(void *param) uint8_t crc_ok; uint8_t cie; + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_latency_capture(); + } + /* Read radio status and events */ trx_done = radio_is_done(); if (trx_done) { @@ -573,7 +578,7 @@ static void isr_rx(void *param) /* Get reference to ACL context */ conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); if (crc_ok) { struct node_rx_pdu *node_rx; @@ -581,7 +586,7 @@ static void isr_rx(void *param) /* Get reference to received PDU */ node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu_rx = (void *)node_rx->pdu; @@ -619,7 +624,7 @@ static void isr_rx(void *param) uint32_t done; done = radio_ccm_is_done(); - LL_ASSERT(done); + LL_ASSERT_ERR(done); if (!radio_ccm_mic_is_valid()) { /* Record MIC invalid */ @@ -774,6 +779,13 @@ static void isr_rx(void *param) #if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) uint32_t pa_lna_enable_us; + /* PA enable is overwriting packet end used in ISR profiling, hence + * back it up for later use. + */ + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_radio_end_backup(); + } + radio_gpio_pa_setup(); pa_lna_enable_us = radio_tmr_tifs_base_get() + cis_lll->tifs_us - @@ -788,7 +800,16 @@ static void isr_rx(void *param) #endif /* HAL_RADIO_GPIO_HAVE_PA_PIN */ /* assert if radio packet ptr is not set and radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } + + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_cputime_capture(); + } /* Schedule next subevent */ if (!cie && (se_curr < cis_lll->nse)) { @@ -863,8 +884,12 @@ static void isr_rx(void *param) #endif /* !CONFIG_BT_CTLR_PHY */ start_us = radio_tmr_start_us(0U, subevent_us); - LL_ASSERT(start_us == (subevent_us + 1U)); + LL_ASSERT_ERR(start_us == (subevent_us + 1U)); #endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ + + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_send(); + } } static void isr_tx(void *param) @@ -876,6 +901,10 @@ static void isr_tx(void *param) uint32_t start_us; uint32_t hcto; + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + lll_prof_latency_capture(); + } + /* Call to ensure packet/event timer accumulates the elapsed time * under single timer use. */ @@ -887,13 +916,13 @@ static void isr_tx(void *param) cis_lll = param; node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); #if defined(CONFIG_BT_CTLR_LE_ENC) /* Get reference to ACL context */ const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); #endif /* CONFIG_BT_CTLR_LE_ENC */ /* PHY */ @@ -970,7 +999,7 @@ static void isr_tx(void *param) #if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) start_us = radio_tmr_start_us(0U, subevent_us); - LL_ASSERT(start_us == (subevent_us + 1U)); + LL_ASSERT_ERR(start_us == (subevent_us + 1U)); #else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ /* Compensate for the 1 us added by radio_tmr_start_us() */ @@ -994,6 +1023,10 @@ static void isr_tx(void *param) radio_tmr_hcto_configure_abs(hcto); +#if defined(CONFIG_BT_CTLR_PROFILE_ISR) || defined(HAL_RADIO_GPIO_HAVE_PA_PIN) + radio_tmr_end_capture(); +#endif /* CONFIG_BT_CTLR_PROFILE_ISR || HAL_RADIO_GPIO_HAVE_PA_PIN */ + #if defined(HAL_RADIO_GPIO_HAVE_LNA_PIN) radio_gpio_lna_setup(); @@ -1058,7 +1091,7 @@ static void isr_prepare_subevent(void *param) /* Get reference to ACL context */ conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); /* Calculate the radio channel to use for next subevent */ @@ -1084,7 +1117,7 @@ static void isr_prepare_subevent_next_cis(void *param) /* Get reference to ACL context */ conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); /* Event counter value, 0-15 bit of cisEventCounter */ event_counter = cis_lll->event_count; @@ -1116,13 +1149,13 @@ static void isr_prepare_subevent_common(void *param) cis_lll = param; node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); #if defined(CONFIG_BT_CTLR_LE_ENC) /* Get reference to ACL context */ const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle); - LL_ASSERT(conn_lll != NULL); + LL_ASSERT_DBG(conn_lll != NULL); #endif /* CONFIG_BT_CTLR_LE_ENC */ /* PHY */ @@ -1203,7 +1236,7 @@ static void isr_prepare_subevent_common(void *param) } start_us = radio_tmr_start_us(0U, subevent_us); - LL_ASSERT(!trx_performed_bitmask || (start_us == (subevent_us + 1U))); + LL_ASSERT_ERR(!trx_performed_bitmask || (start_us == (subevent_us + 1U))); /* If no anchor point sync yet, continue to capture access address * timestamp. @@ -1264,7 +1297,7 @@ static void isr_done(void *param) payload_count_rx_flush_or_txrx_inc(cis_lll); e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); e->type = EVENT_DONE_EXTRA_TYPE_CIS; e->trx_performed_bitmask = trx_performed_bitmask; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c index 79f60677be7..5cfa63b3bcf 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c @@ -125,10 +125,10 @@ void lll_scan_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); err = lll_prepare(is_abort_cb, abort_cb, prepare_cb, 0, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } void lll_scan_isr_resume(void *param) @@ -391,7 +391,7 @@ static int common_prepare_cb(struct lll_prepare_param *p, bool is_resume) #endif /* !CONFIG_BT_CTLR_ADV_EXT */ node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_pkt_rx_set(node_rx->pdu); @@ -497,8 +497,8 @@ static int common_prepare_cb(struct lll_prepare_param *p, bool is_resume) ticks_at_event, lll->ticks_window, TICKER_NULL_PERIOD, TICKER_NULL_REMAINDER, TICKER_NULL_LAZY, TICKER_NULL_SLOT, ticker_stop_cb, lll, ticker_op_start_cb, (void *)__LINE__); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } #if defined(CONFIG_BT_CENTRAL) && defined(CONFIG_BT_CTLR_SCHED_ADVANCED) @@ -509,18 +509,24 @@ static int common_prepare_cb(struct lll_prepare_param *p, bool is_resume) static memq_link_t link; static struct mayfly mfy_after_cen_offset_get = { 0U, 0U, &link, NULL, ull_sched_mfy_after_cen_offset_get}; - uint32_t retval; + struct lll_prepare_param *prepare_param; - mfy_after_cen_offset_get.param = p; + /* Copy the required values to calculate the offsets */ + prepare_param = &lll->prepare_param; + prepare_param->ticks_at_expire = p->ticks_at_expire; + prepare_param->remainder = p->remainder; + prepare_param->param = lll; - retval = mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_ULL_LOW, 1U, - &mfy_after_cen_offset_get); - LL_ASSERT(!retval); + mfy_after_cen_offset_get.param = prepare_param; + + ret = mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_ULL_LOW, 1U, + &mfy_after_cen_offset_get); + LL_ASSERT_ERR(!ret); } #endif /* CONFIG_BT_CENTRAL && CONFIG_BT_CTLR_SCHED_ADVANCED */ ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_O(1); @@ -561,7 +567,7 @@ static int is_abort_cb(void *next, void *curr, lll_prepare_cb_t *resume_cb) /* Retain HF clock */ err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Yield to the pre-emptor, but be * resumed thereafter. @@ -629,7 +635,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); lll_done(param); } @@ -645,14 +651,14 @@ static void ticker_stop_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void ticker_op_start_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); } static void isr_rx(void *param) @@ -708,7 +714,7 @@ static void isr_rx(void *param) } node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu = (void *)node_rx->pdu; @@ -787,15 +793,15 @@ static void isr_tx(void *param) radio_switch_complete_and_disable(); node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_pkt_rx_set(node_rx->pdu); /* assert if radio packet ptr is not set and radio started rx */ if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { - LL_ASSERT_MSG(!radio_is_address(), "%s: Radio ISR latency: %u", __func__, + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_address()); + LL_ASSERT_ERR(!radio_is_ready()); } #if defined(CONFIG_BT_CTLR_PRIVACY) @@ -865,7 +871,7 @@ static void isr_common_done(void *param) } node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_pkt_rx_set(node_rx->pdu); #if defined(CONFIG_BT_CTLR_PRIVACY) @@ -1006,7 +1012,7 @@ static void isr_abort(void *param) * detected in ULL. */ extra = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_SCAN); - LL_ASSERT(extra); + LL_ASSERT_ERR(extra); #endif /* CONFIG_BT_CTLR_ADV_EXT */ lll_isr_cleanup(param); @@ -1084,7 +1090,7 @@ static void isr_done_cleanup(void *param) * detected in ULL. */ extra = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_SCAN); - LL_ASSERT(extra); + LL_ASSERT_ERR(extra); } /* Prevent scan events in pipeline from being scheduled if duration has @@ -1103,7 +1109,7 @@ static void isr_done_cleanup(void *param) lll->is_aux_sched = 0U; node_rx2 = ull_pdu_rx_alloc(); - LL_ASSERT(node_rx2); + LL_ASSERT_ERR(node_rx2); node_rx2->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE; @@ -1126,7 +1132,7 @@ static void isr_done_cleanup(void *param) mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_LLL, 1U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } lll_isr_cleanup(param); @@ -1217,10 +1223,10 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx, /* assert if radio packet ptr is not set and radio started tx */ if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { - LL_ASSERT_MSG(!radio_is_address(), "%s: Radio ISR latency: %u", __func__, + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_address()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -1354,10 +1360,10 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx, /* assert if radio packet ptr is not set and radio started tx */ if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { - LL_ASSERT_MSG(!radio_is_address(), "%s: Radio ISR latency: %u", __func__, + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_address()); + LL_ASSERT_ERR(!radio_is_ready()); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -1567,7 +1573,7 @@ static int isr_rx_scan_report(struct lll_scan *lll, uint8_t devmatch_ok, break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c index 1a8aeb536f0..8606a791360 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c @@ -108,10 +108,10 @@ void lll_scan_aux_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); err = lll_prepare(is_abort_cb, abort_cb, prepare_cb, 0, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } uint8_t lll_scan_aux_setup(struct pdu_adv *pdu, uint8_t pdu_phy, @@ -132,7 +132,7 @@ uint8_t lll_scan_aux_setup(struct pdu_adv *pdu, uint8_t pdu_phy, uint32_t pdu_us; uint8_t phy; - LL_ASSERT(pdu->type == PDU_ADV_TYPE_EXT_IND); + LL_ASSERT_DBG(pdu->type == PDU_ADV_TYPE_EXT_IND); /* Get reference to extended header */ pri_com_hdr = (void *)&pdu->adv_ext_ind; @@ -231,7 +231,7 @@ uint8_t lll_scan_aux_setup(struct pdu_adv *pdu, uint8_t pdu_phy, } node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); /* Store the lll context, aux_ptr and start of PDU in footer */ ftr = &(node_rx->rx_ftr); @@ -499,7 +499,7 @@ static int prepare_cb(struct lll_prepare_param *p) RADIO_PKT_CONF_PHY(lll_aux->phy)); node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_pkt_rx_set(node_rx->pdu); @@ -607,21 +607,28 @@ static int prepare_cb(struct lll_prepare_param *p) static memq_link_t link; static struct mayfly mfy_after_cen_offset_get = { 0U, 0U, &link, NULL, ull_sched_mfy_after_cen_offset_get}; + struct lll_prepare_param *prepare_param; - /* NOTE: LLL scan instance passed, as done when + /* Copy the required values to calculate the offsets + * + * NOTE: LLL scan instance passed, as done when * establishing legacy connections. */ - p->param = lll; - mfy_after_cen_offset_get.param = p; + prepare_param = &lll->prepare_param; + prepare_param->ticks_at_expire = p->ticks_at_expire; + prepare_param->remainder = p->remainder; + prepare_param->param = lll; + + mfy_after_cen_offset_get.param = prepare_param; ret = mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_ULL_LOW, 1U, &mfy_after_cen_offset_get); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } #endif /* CONFIG_BT_CENTRAL && CONFIG_BT_CTLR_SCHED_ADVANCED */ ret = lll_prepare_done(lll_aux); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_O(1); @@ -640,7 +647,7 @@ static int is_abort_cb(void *next, void *curr, lll_prepare_cb_t *resume_cb) /* Auxiliary event shall not overlap as they are not periodically * scheduled. */ - LL_ASSERT(next != curr); + LL_ASSERT_DBG(next != curr); lll = ull_scan_lll_is_valid_get(next); if (lll) { @@ -674,10 +681,10 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); e = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_SCAN_AUX); - LL_ASSERT(e); + LL_ASSERT_ERR(e); #if defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) e->lll = param; @@ -711,7 +718,7 @@ static void isr_done(void *param) * generated thereafter by HCI as incomplete. */ node_rx = ull_pdu_rx_alloc(); - LL_ASSERT(node_rx); + LL_ASSERT_ERR(node_rx); node_rx->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE; @@ -725,7 +732,7 @@ static void isr_done(void *param) struct event_done_extra *e; e = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_SCAN_AUX); - LL_ASSERT(e); + LL_ASSERT_ERR(e); #if defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) e->lll = param; @@ -744,7 +751,7 @@ static void isr_done(void *param) mfy.param = scan_lll; ret = mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_LLL, 1U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } lll_isr_cleanup(param); @@ -905,7 +912,7 @@ static void isr_rx(struct lll_scan *lll, struct lll_scan_aux *lll_aux, struct node_rx_pdu *node_rx2; node_rx2 = ull_pdu_rx_alloc(); - LL_ASSERT(node_rx2); + LL_ASSERT_ERR(node_rx2); node_rx2->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE; @@ -1051,7 +1058,12 @@ static int isr_rx_pdu(struct lll_scan *lll, struct lll_scan_aux *lll_aux, radio_pkt_tx_set(pdu_tx); /* assert if radio packet ptr is not set and radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -1201,7 +1213,12 @@ static int isr_rx_pdu(struct lll_scan *lll, struct lll_scan_aux *lll_aux, radio_pkt_tx_set(pdu_tx); /* assert if radio packet ptr is not set and radio started tx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -1407,7 +1424,12 @@ static void isr_tx(struct lll_scan_aux *lll_aux, void *pdu_rx, radio_pkt_rx_set(pdu_rx); /* assert if radio packet ptr is not set and radio started rx */ - LL_ASSERT(!radio_is_ready()); + if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { + LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + lll_prof_latency_get()); + } else { + LL_ASSERT_ERR(!radio_is_ready()); + } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { lll_prof_cputime_capture(); @@ -1469,7 +1491,7 @@ static void isr_tx_scan_req_ull_schedule(void *param) struct node_rx_pdu *node_rx; node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); isr_tx(param, node_rx->pdu, isr_rx_ull_schedule, param); } @@ -1483,7 +1505,7 @@ static void isr_tx_scan_req_lll_schedule(void *param) lll = node_rx_adv->rx_ftr.param; node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); isr_tx(lll->lll_aux, node_rx->pdu, isr_rx_lll_schedule, param); } @@ -1494,7 +1516,7 @@ static void isr_tx_connect_req(void *param) struct node_rx_pdu *node_rx; node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); isr_tx(param, (void *)node_rx->pdu, isr_rx_connect_rsp, param); } @@ -1544,7 +1566,7 @@ static void isr_rx_connect_rsp(void *param) * release it if failed to receive AUX_CONNECT_RSP PDU. */ rx = lll_aux->node_conn_rx; - LL_ASSERT(rx); + LL_ASSERT_DBG(rx); lll_aux->node_conn_rx = NULL; #if defined(CONFIG_BT_CTLR_PRIVACY) @@ -1562,7 +1584,7 @@ static void isr_rx_connect_rsp(void *param) pdu_tx = radio_pkt_scratch_get(); node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu_rx = (void *)node_rx->pdu; trx_done = isr_rx_connect_rsp_check(lll, pdu_tx, pdu_rx, @@ -1645,7 +1667,7 @@ static void isr_rx_connect_rsp(void *param) /* Send message to flush Auxiliary PDU list */ node_rx = ull_pdu_rx_alloc(); - LL_ASSERT(node_rx); + LL_ASSERT_ERR(node_rx); node_rx->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE; @@ -1698,7 +1720,7 @@ static void isr_early_abort(void *param) struct event_done_extra *e; e = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_SCAN_AUX); - LL_ASSERT(e); + LL_ASSERT_ERR(e); #if defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) e->lll = param; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c index d549d914f59..fe5b9efdb98 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c @@ -101,11 +101,11 @@ void lll_sync_create_prepare(void *param) /* Request to start HF Clock */ err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Invoke common pipeline handling of prepare */ err = lll_prepare(is_abort_cb, abort_cb, create_prepare_cb, 0, param); - LL_ASSERT(!err || err == -EINPROGRESS); + LL_ASSERT_ERR(!err || err == -EINPROGRESS); } void lll_sync_prepare(void *param) @@ -114,11 +114,11 @@ void lll_sync_prepare(void *param) /* Request to start HF Clock */ err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Invoke common pipeline handling of prepare */ err = lll_prepare(is_abort_cb, abort_cb, prepare_cb, 0, param); - LL_ASSERT(err == 0 || err == -EINPROGRESS); + LL_ASSERT_ERR(err == 0 || err == -EINPROGRESS); } void lll_sync_aux_prepare_cb(struct lll_sync *lll, @@ -137,7 +137,7 @@ void lll_sync_aux_prepare_cb(struct lll_sync *lll, RADIO_PKT_CONF_PHY(lll_aux->phy)); node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_pkt_rx_set(node_rx->pdu); @@ -456,7 +456,7 @@ static int prepare_cb_common(struct lll_prepare_param *p, uint8_t chan_idx) lll_chan_set(chan_idx); node_rx = ull_pdu_rx_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_pkt_rx_set(node_rx->pdu); @@ -510,7 +510,7 @@ static int prepare_cb_common(struct lll_prepare_param *p, uint8_t chan_idx) #endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */ ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_START_O(1); @@ -617,7 +617,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Get reference to LLL connection context */ lll = prepare_param->param; @@ -635,7 +635,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) /* Extra done event, to check sync lost */ e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); e->type = EVENT_DONE_EXTRA_TYPE_SYNC; e->trx_cnt = 0U; @@ -745,7 +745,7 @@ static void isr_aux_setup(void *param) aux_start_us -= EVENT_JITTER_US; start_us = radio_tmr_start_us(0, aux_start_us); - LL_ASSERT(start_us == (aux_start_us + 1U)); + LL_ASSERT_ERR(start_us == (aux_start_us + 1U)); /* Setup header complete timeout */ hcto = start_us; @@ -951,7 +951,7 @@ static void isr_rx_adv_sync_estab(void *param) /* TODO: Combine the early exit with above if-then-else block */ #if defined(CONFIG_BT_CTLR_DF_SCAN_CTE_RX) - LL_ASSERT(!lll->node_cte_incomplete); + LL_ASSERT_DBG(!lll->node_cte_incomplete); #endif /* CONFIG_BT_CTLR_DF_SCAN_CTE_RX */ goto isr_rx_done; @@ -1137,7 +1137,7 @@ static void isr_rx_aux_chain(void *param) * generated thereafter by HCI as incomplete. */ node_rx = ull_pdu_rx_alloc(); - LL_ASSERT(node_rx); + LL_ASSERT_ERR(node_rx); node_rx->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE; @@ -1188,7 +1188,7 @@ static void isr_rx_done_cleanup(struct lll_sync *lll, uint8_t crc_ok, bool sync_ /* Calculate and place the drift information in done event */ e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); e->type = EVENT_DONE_EXTRA_TYPE_SYNC; e->trx_cnt = trx_cnt; @@ -1240,7 +1240,7 @@ static void isr_done(void *param) * generated thereafter by HCI as incomplete. */ node_rx = ull_pdu_rx_alloc(); - LL_ASSERT(node_rx); + LL_ASSERT_ERR(node_rx); node_rx->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE; @@ -1325,7 +1325,7 @@ static int iq_report_create_put(struct lll_sync *lll, uint8_t rssi_ready, uint8_ if (!lll->is_cte_incomplete && is_max_cte_reached(cfg->max_cte_count, cfg->cte_count)) { iq_report = ull_df_iq_report_alloc(); - LL_ASSERT(iq_report); + LL_ASSERT_ERR(iq_report); iq_report_create(lll, rssi_ready, packet_status, cfg->slot_durations, iq_report); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c index 4f4dad90754..d6931c9b7f5 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c @@ -101,11 +101,11 @@ void lll_sync_iso_create_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); err = lll_prepare(is_abort_cb, abort_cb, create_prepare_cb, 0U, param); - LL_ASSERT(err == 0 || err == -EINPROGRESS); + LL_ASSERT_ERR(err == 0 || err == -EINPROGRESS); } void lll_sync_iso_prepare(void *param) @@ -113,10 +113,10 @@ void lll_sync_iso_prepare(void *param) int err; err = lll_hfclock_on(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); err = lll_prepare(is_abort_cb, abort_cb, prepare_cb, 0U, param); - LL_ASSERT(err == 0 || err == -EINPROGRESS); + LL_ASSERT_ERR(err == 0 || err == -EINPROGRESS); } void lll_sync_iso_flush(uint8_t handle, struct lll_sync_iso *lll) @@ -288,7 +288,7 @@ static int prepare_cb_common(struct lll_prepare_param *p) #endif /* CONFIG_BT_CTLR_SYNC_ISO_INTERLEAVED */ } else { - LL_ASSERT(false); + LL_ASSERT_DBG(false); } } @@ -313,7 +313,7 @@ static int prepare_cb_common(struct lll_prepare_param *p) * setting up radio for new PDU reception. */ node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); /* Encryption */ if (IS_ENABLED(CONFIG_BT_CTLR_BROADCAST_ISO_ENC) && @@ -400,7 +400,7 @@ static int prepare_cb_common(struct lll_prepare_param *p) #endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */ ret = lll_prepare_done(lll); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); /* Calculate ahead the next subevent channel index */ if (false) { @@ -422,7 +422,7 @@ static int prepare_cb_common(struct lll_prepare_param *p) #endif /* CONFIG_BT_CTLR_SYNC_ISO_INTERLEAVED */ } else { - LL_ASSERT(false); + LL_ASSERT_DBG(false); } return 0; @@ -468,7 +468,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) * currently in preparation pipeline. */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Get reference to LLL connection context */ lll = prepare_param->param; @@ -486,7 +486,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) /* Extra done event, to check sync lost */ e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); e->type = EVENT_DONE_EXTRA_TYPE_SYNC_ISO; e->estab_failed = 0U; @@ -531,7 +531,7 @@ static void isr_rx_estab(void *param) * for new PDU reception. */ node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); /* Get reference to received PDU and validate MIC for non-empty PDU */ pdu = (void *)node_rx->pdu; @@ -540,7 +540,7 @@ static void isr_rx_estab(void *param) uint32_t done; done = radio_ccm_is_done(); - LL_ASSERT(done); + LL_ASSERT_ERR(done); mic_failure = !radio_ccm_mic_is_valid(); if (mic_failure) { @@ -555,7 +555,7 @@ static void isr_rx_estab(void *param) /* Calculate and place the drift information in done event */ e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); e->type = EVENT_DONE_EXTRA_TYPE_SYNC_ISO_ESTAB; e->estab_failed = lll->term_reason ? 1U : 0U; @@ -659,7 +659,7 @@ static void isr_rx(void *param) } else { se_offset_us = 0U; - LL_ASSERT(false); + LL_ASSERT_DBG(false); } radio_tmr_aa_save(radio_tmr_aa_get() - se_offset_us); @@ -702,7 +702,7 @@ static void isr_rx(void *param) } node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu = (void *)node_rx->pdu; @@ -753,7 +753,7 @@ static void isr_rx(void *param) uint32_t done; done = radio_ccm_is_done(); - LL_ASSERT(done); + LL_ASSERT_ERR(done); mic_failure = !radio_ccm_mic_is_valid(); if (mic_failure) { @@ -850,7 +850,7 @@ static void isr_rx(void *param) * skip subevents as buffers at these high offset are unavailable. */ payload_offset = (lll->latency_event * lll->bn); - LL_ASSERT(payload_offset <= UINT8_MAX); + LL_ASSERT_ERR(payload_offset <= UINT8_MAX); /* Find the index of the (irc_curr)th bn = 1 Rx PDU * buffer. @@ -941,7 +941,7 @@ static void isr_rx(void *param) * these high offsets are unavailable. */ payload_offset = (lll->latency_event * lll->bn); - LL_ASSERT(payload_offset <= UINT8_MAX); + LL_ASSERT_ERR(payload_offset <= UINT8_MAX); /* Find the index of the (irc_curr)th bn = 1 Rx * PDU buffer. @@ -1062,7 +1062,7 @@ static void isr_rx(void *param) lll->bis_curr = sync_stream->bis_index; bis_idx = lll->bis_curr - 1U; } else { - LL_ASSERT(false); + LL_ASSERT_DBG(false); } } @@ -1261,7 +1261,7 @@ static void isr_rx(void *param) * available for setting up radio for new PDU reception. */ node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu = (void *)node_rx->pdu; } else { @@ -1288,7 +1288,7 @@ static void isr_rx(void *param) * available for setting up radio for new PDU reception. */ node_rx = ull_iso_pdu_rx_alloc_peek(1U); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); pdu = (void *)node_rx->pdu; } else { @@ -1331,7 +1331,7 @@ static void isr_rx(void *param) nse = 0U; hcto = 0U; - LL_ASSERT(false); + LL_ASSERT_DBG(false); } if (trx_cnt) { @@ -1352,34 +1352,37 @@ static void isr_rx(void *param) hcto -= addr_us_get(lll->phy); hcto -= radio_rx_ready_delay_get(lll->phy, PHY_FLAGS_S8); - overhead_us = radio_rx_chain_delay_get(lll->phy, PHY_FLAGS_S8); - overhead_us += addr_us_get(lll->phy); - overhead_us += radio_rx_ready_delay_get(lll->phy, PHY_FLAGS_S8); + /* Overhead within EVENT_IFS_US to exclude from max. jitter */ + /* Required radio ready duration, settling time */ + overhead_us = radio_rx_ready_delay_get(lll->phy, PHY_FLAGS_S8); + /* If single timer used, then consider required max. latency */ + overhead_us += HAL_RADIO_ISR_LATENCY_MAX_US; + /* Add chain delay overhead */ + overhead_us += radio_rx_chain_delay_get(lll->phy, PHY_FLAGS_S8); + /* Add base clock jitter overhead */ overhead_us += (EVENT_CLOCK_JITTER_US << 1); + LL_ASSERT_DBG(EVENT_IFS_US > overhead_us); - LL_ASSERT(EVENT_IFS_US > overhead_us); - + /* Max. available clock jitter */ jitter_max_us = (EVENT_IFS_US - overhead_us) >> 1; + /* Max. clock jitter per subevent */ jitter_max_us = (jitter_max_us * nse) / (lll->num_bis * lll->nse); - overhead_us = HAL_RADIO_TMR_START_DELAY_US; - if (jitter_max_us > overhead_us) { - jitter_max_us -= overhead_us; - } else { - jitter_max_us = 0U; - } + /* Min. clock jitter we shall use */ + jitter_max_us = MAX(jitter_max_us, (EVENT_CLOCK_JITTER_US << 1)); + /* Jitter for current subevent */ jitter_us = (EVENT_CLOCK_JITTER_US << 1) * nse; if (jitter_us > jitter_max_us) { jitter_us = jitter_max_us; } - LL_ASSERT(hcto > jitter_us); + LL_ASSERT_DBG(hcto > jitter_us); hcto -= jitter_us; start_us = hcto; hcto = radio_tmr_start_us(0U, start_us); - LL_ASSERT(hcto == (start_us + 1U)); + LL_ASSERT_ERR(hcto == (start_us + 1U)); /* Add 8 us * subevents so far, as radio was setup to listen * 4 us early and subevents could have a 4 us drift each until @@ -1396,7 +1399,7 @@ static void isr_rx(void *param) start_us = hcto; hcto = radio_tmr_start_us(0U, start_us); - LL_ASSERT(hcto == (start_us + 1U)); + LL_ASSERT_ERR(hcto == (start_us + 1U)); hcto += ((EVENT_JITTER_US + EVENT_TICKER_RES_MARGIN_US + lll->window_widening_event_us) << 1) + @@ -1445,7 +1448,7 @@ static void isr_rx(void *param) #endif /* CONFIG_BT_CTLR_SYNC_ISO_INTERLEAVED */ } else { - LL_ASSERT(false); + LL_ASSERT_DBG(false); } if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { @@ -1543,7 +1546,7 @@ static void isr_rx_done(void *param) } e = ull_event_done_extra_get(); - LL_ASSERT(e); + LL_ASSERT_ERR(e); /* Check if BIG terminate procedure received */ if (lll->term_reason) { diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_test.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_test.c index 9715b934e5e..c724bd08e0b 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_test.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_test.c @@ -238,7 +238,7 @@ static void isr_rx(void *param) if (test_cte_len > 0) { /* Get free iq report node for next Rx operation. */ node_rx = ull_df_iq_report_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_df_iq_data_packet_set(node_rx->pdu, IQ_SAMPLE_TOTAL_CNT); } @@ -435,7 +435,7 @@ static uint8_t cte_rx_init(uint8_t expected_cte_len, uint8_t expected_cte_type, struct node_rx_iq_report *node_rx; node_rx = ull_df_iq_report_alloc_peek(1); - LL_ASSERT(node_rx); + LL_ASSERT_DBG(node_rx); radio_df_iq_data_packet_set(node_rx->pdu, IQ_SAMPLE_TOTAL_CNT); #else @@ -498,7 +498,7 @@ static uint8_t init(uint8_t chan, uint8_t phy, int8_t tx_power, /* Setup resources required by Radio */ err = lll_hfclock_on_wait(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Reset Radio h/w */ radio_reset(); @@ -744,7 +744,7 @@ uint8_t ll_test_end(uint16_t *num_rx) /* Release resources acquired for Radio */ err = lll_hfclock_off(); - LL_ASSERT(err >= 0); + LL_ASSERT_ERR(err >= 0); /* Stop coarse timer */ cntr_stop(); diff --git a/subsys/bluetooth/controller/ll_sw/ull.c b/subsys/bluetooth/controller/ll_sw/ull.c index bf15820ecd6..4ff06e60fda 100644 --- a/subsys/bluetooth/controller/ll_sw/ull.c +++ b/subsys/bluetooth/controller/ll_sw/ull.c @@ -627,7 +627,7 @@ int ll_init(struct k_sem *sem_rx) hal_ticker_instance0_caller_id_get, hal_ticker_instance0_sched, hal_ticker_instance0_trigger_set); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* Initialize semaphore for ticker API blocking wait */ k_sem_init(&sem_ticker_api_cb, 0, 1); @@ -816,12 +816,12 @@ void ll_reset(void) #if defined(CONFIG_BT_CTLR_ADV_ISO) /* Reset adv iso sets */ err = ull_adv_iso_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CTLR_ADV_ISO */ /* Reset adv state */ err = ull_adv_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_BROADCASTER */ #if defined(CONFIG_BT_OBSERVER) @@ -829,43 +829,43 @@ void ll_reset(void) #if defined(CONFIG_BT_CTLR_SYNC_ISO) /* Reset sync iso sets */ err = ull_sync_iso_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CTLR_SYNC_ISO */ /* Reset periodic sync sets */ err = ull_sync_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ /* Reset scan state */ err = ull_scan_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_OBSERVER */ #if defined(CONFIG_BT_CTLR_PERIPHERAL_ISO) err = ull_peripheral_iso_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CTLR_PERIPHERAL_ISO */ #if defined(CONFIG_BT_CTLR_CENTRAL_ISO) err = ull_central_iso_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CTLR_CENTRAL_ISO */ #if defined(CONFIG_BT_CTLR_CONN_ISO) err = ull_conn_iso_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CTLR_CONN_ISO */ #if defined(CONFIG_BT_CTLR_ISO) err = ull_iso_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CTLR_ISO */ #if defined(CONFIG_BT_CONN) /* Reset conn role */ err = ull_conn_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); MFIFO_INIT(tx_ack); #endif /* CONFIG_BT_CONN */ @@ -912,7 +912,7 @@ void ll_reset(void) retval = mayfly_enqueue(TICKER_USER_ID_THREAD, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!retval); + LL_ASSERT_ERR(!retval); #if !defined(CONFIG_BT_CTLR_ZLI) /* LLL reset must complete before returning - wait for @@ -925,7 +925,7 @@ void ll_reset(void) #if defined(CONFIG_BT_BROADCASTER) /* Finalize after adv state LLL context reset */ err = ull_adv_reset_finalize(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_BROADCASTER */ /* Reset/End DTM Tx or Rx commands */ @@ -938,7 +938,7 @@ void ll_reset(void) /* Common to init and reset */ err = init_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #if defined(CONFIG_BT_CTLR_DF) /* Direction Finding has to be reset after ull init_reset call because @@ -946,7 +946,7 @@ void ll_reset(void) * in common ull init_reset. */ err = ull_df_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif #if defined(CONFIG_BT_CTLR_SET_HOST_FEATURE) @@ -1101,7 +1101,7 @@ void ll_rx_dequeue(void) link = memq_dequeue(memq_ll_rx.tail, &memq_ll_rx.head, (void **)&rx); - LL_ASSERT(link); + LL_ASSERT_DBG(link); ll_rx_link_release(link); @@ -1129,7 +1129,7 @@ void ll_rx_dequeue(void) while (rx_curr) { memq_link_t *link_free; - LL_ASSERT(loop); + LL_ASSERT_ERR(loop); loop--; link_free = rx_curr->hdr.link; @@ -1154,7 +1154,7 @@ void ll_rx_dequeue(void) struct lll_adv_aux *lll_aux; adv = ull_adv_set_get(rx->hdr.handle); - LL_ASSERT(adv); + LL_ASSERT_DBG(adv); lll_aux = adv->lll.aux; if (lll_aux) { @@ -1174,11 +1174,11 @@ void ll_rx_dequeue(void) break; } - LL_ASSERT(!lll_conn->link_tx_free); + LL_ASSERT_DBG(!lll_conn->link_tx_free); memq_link_t *memq_link = memq_deinit(&lll_conn->memq_tx.head, &lll_conn->memq_tx.tail); - LL_ASSERT(memq_link); + LL_ASSERT_DBG(memq_link); lll_conn->link_tx_free = memq_link; @@ -1223,13 +1223,13 @@ void ll_rx_dequeue(void) memq_link_t *memq_link; conn_lll = lll->conn; - LL_ASSERT(conn_lll); + LL_ASSERT_DBG(conn_lll); lll->conn = NULL; - LL_ASSERT(!conn_lll->link_tx_free); + LL_ASSERT_DBG(!conn_lll->link_tx_free); memq_link = memq_deinit(&conn_lll->memq_tx.head, &conn_lll->memq_tx.tail); - LL_ASSERT(memq_link); + LL_ASSERT_DBG(memq_link); conn_lll->link_tx_free = memq_link; conn = HDR_LLL2ULL(conn_lll); @@ -1294,7 +1294,7 @@ void ll_rx_dequeue(void) scan->is_enabled = 0U; #else /* !CONFIG_BT_CENTRAL */ } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); #endif /* !CONFIG_BT_CENTRAL */ } @@ -1416,11 +1416,11 @@ void ll_rx_dequeue(void) * code block. */ case NODE_RX_TYPE_NONE: - LL_ASSERT(rx->hdr.type != NODE_RX_TYPE_NONE); + LL_ASSERT_DBG(rx->hdr.type != NODE_RX_TYPE_NONE); break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -1432,11 +1432,11 @@ void ll_rx_dequeue(void) struct ll_scan_set *scan; adv = ull_adv_is_enabled_get(0); - LL_ASSERT(adv); + LL_ASSERT_DBG(adv); adv->is_enabled = 0U; scan = ull_scan_is_enabled_get(0); - LL_ASSERT(scan); + LL_ASSERT_DBG(scan); scan->is_enabled = 0U; @@ -1520,7 +1520,7 @@ void ll_rx_mem_release(void **node_rx) #endif /* CONFIG_BT_CENTRAL */ } else { - LL_ASSERT(!cc->status); + LL_ASSERT_DBG(!cc->status); } } @@ -1607,7 +1607,7 @@ void ll_rx_mem_release(void **node_rx) * code block. */ case NODE_RX_TYPE_NONE: - LL_ASSERT(rx_free->hdr.type != NODE_RX_TYPE_NONE); + LL_ASSERT_DBG(rx_free->hdr.type != NODE_RX_TYPE_NONE); ll_rx_link_quota_inc(); ll_rx_release(rx_free); break; @@ -1652,7 +1652,7 @@ void ll_rx_mem_release(void **node_rx) break; } else { - LL_ASSERT(status == BT_HCI_ERR_OP_CANCELLED_BY_HOST); + LL_ASSERT_DBG(status == BT_HCI_ERR_OP_CANCELLED_BY_HOST); /* Fall through and release sync context */ } @@ -1716,12 +1716,12 @@ void ll_rx_mem_release(void **node_rx) memq_link_t *link; conn = ll_conn_get(rx_free->hdr.handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); - LL_ASSERT(!conn->lll.link_tx_free); + LL_ASSERT_DBG(!conn->lll.link_tx_free); link = memq_deinit(&conn->lll.memq_tx.head, &conn->lll.memq_tx.tail); - LL_ASSERT(link); + LL_ASSERT_DBG(link); conn->lll.link_tx_free = link; ll_conn_release(conn); @@ -1735,7 +1735,7 @@ void ll_rx_mem_release(void **node_rx) case NODE_RX_TYPE_EVENT_DONE: default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -1747,7 +1747,7 @@ void ll_rx_mem_release(void **node_rx) static void ll_rx_link_quota_update(int8_t delta) { - LL_ASSERT(delta <= 0 || mem_link_rx.quota_pdu < RX_CNT); + LL_ASSERT_DBG(delta <= 0 || mem_link_rx.quota_pdu < RX_CNT); mem_link_rx.quota_pdu += delta; } @@ -1837,7 +1837,7 @@ void ll_tx_ack_put(uint16_t handle, struct node_tx *node_tx) uint8_t idx; idx = MFIFO_ENQUEUE_GET(tx_ack, (void **)&tx); - LL_ASSERT(tx); + LL_ASSERT_ERR(tx); tx->handle = handle; tx->node = node_tx; @@ -1868,7 +1868,7 @@ void ll_radio_state_abort(void) ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } uint32_t ll_radio_state_is_idle(void) @@ -2053,7 +2053,7 @@ int ull_disable(void *lll) mfy.param = lll; ret = mayfly_enqueue(TICKER_USER_ID_THREAD, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); err = k_sem_take(&sem, ULL_DISABLE_TIMEOUT); if (err != 0) { @@ -2195,7 +2195,7 @@ void ull_prepare_dequeue(uint8_t caller_id) /* Assert if we exceed iterations processing the prepare queue */ - LL_ASSERT(loop); + LL_ASSERT_ERR(loop); loop--; /* Let LLL invoke the `prepare` interface if radio not in active @@ -2210,7 +2210,7 @@ void ull_prepare_dequeue(uint8_t caller_id) mfy.param = next; ret = mayfly_enqueue(caller_id, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } MFIFO_DEQUEUE(prep); @@ -2391,14 +2391,14 @@ static inline int init_reset(void) /* Acquire a link to initialize ull rx memq */ link = mem_acquire(&mem_link_rx.free); - LL_ASSERT(link); + LL_ASSERT_DBG(link); /* Initialize ull rx memq */ MEMQ_INIT(ull_rx, link); /* Acquire a link to initialize ll rx memq */ link = mem_acquire(&mem_link_rx.free); - LL_ASSERT(link); + LL_ASSERT_DBG(link); /* Initialize ll rx memq */ MEMQ_INIT(ll_rx, link); @@ -2428,29 +2428,29 @@ static void perform_lll_reset(void *param) /* Reset LLL */ err = lll_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #if defined(CONFIG_BT_BROADCASTER) /* Reset adv state */ err = lll_adv_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_BROADCASTER */ #if defined(CONFIG_BT_OBSERVER) /* Reset scan state */ err = lll_scan_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_OBSERVER */ #if defined(CONFIG_BT_CONN) /* Reset conn role */ err = lll_conn_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CONN */ #if defined(CONFIG_BT_CTLR_DF) err = lll_df_reset(); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #endif /* CONFIG_BT_CTLR_DF */ #if !defined(CONFIG_BT_CTLR_ZLI) @@ -2611,7 +2611,7 @@ static void rx_demux(void *param) link = memq_peek(memq_ull_rx.head, memq_ull_rx.tail, (void **)&rx); if (link) { - LL_ASSERT(rx); + LL_ASSERT_DBG(rx); #if defined(CONFIG_BT_CONN) link_tx = ull_conn_ack_by_last_peek(rx->ack_last, &handle, &tx); @@ -2910,7 +2910,7 @@ static inline void rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx) (void)memq_dequeue(memq_ull_rx.tail, &memq_ull_rx.head, NULL); conn = ll_conn_get(rx->handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); if (ull_cp_cc_awaiting_established(conn)) { ull_cp_cc_established(conn, BT_HCI_ERR_SUCCESS); @@ -3021,7 +3021,7 @@ static inline void rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx) rx_demux_rx_proprietary(link, rx, memq_ull_rx.tail, &memq_ull_rx.head); #else - LL_ASSERT(0); + LL_ASSERT_DBG(0); #endif /* CONFIG_BT_CTLR_USER_EXT */ } break; @@ -3037,7 +3037,7 @@ static inline void rx_demux_event_done(memq_link_t *link, /* Decrement prepare reference if ULL will not resume */ ull_hdr = done->param; if (ull_hdr) { - LL_ASSERT(ull_ref_get(ull_hdr)); + LL_ASSERT_DBG(ull_ref_get(ull_hdr)); ull_ref_dec(ull_hdr); } else { /* No reference count decrement, event placed back as resume event in the pipeline. @@ -3127,14 +3127,14 @@ static inline void rx_demux_event_done(memq_link_t *link, break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } /* Release done */ done->extra.type = 0U; release = RXFIFO_RELEASE(done, link, done); - LL_ASSERT(release == done); + LL_ASSERT_DBG(release == done); #if defined(CONFIG_BT_CTLR_LOW_LAT_ULL_DONE) /* dequeue prepare pipeline */ @@ -3218,7 +3218,7 @@ void *ull_rxfifo_release(uint8_t s, uint8_t n, uint8_t f, uint8_t *l, uint8_t *m */ uint32_t ull_get_wrapped_time_us(uint32_t time_now_us, int32_t time_diff_us) { - LL_ASSERT(time_now_us <= ULL_TIME_WRAPPING_POINT_US); + LL_ASSERT_DBG(time_now_us <= ULL_TIME_WRAPPING_POINT_US); uint32_t result = ((uint64_t)time_now_us + ULL_TIME_SPAN_FULL_US + time_diff_us) % ((uint64_t)ULL_TIME_SPAN_FULL_US); diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv.c b/subsys/bluetooth/controller/ll_sw/ull_adv.c index 18f3f24b11d..f9f1ee78afe 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv.c @@ -206,7 +206,7 @@ uint8_t ll_adv_set_hci_handle_get(uint8_t handle) struct ll_adv_set *adv; adv = ull_adv_set_get(handle); - LL_ASSERT(adv && adv->is_created); + LL_ASSERT_DBG(adv && adv->is_created); return adv->hci_handle; } @@ -442,8 +442,8 @@ uint8_t ll_adv_params_set(uint16_t interval, uint8_t adv_type, if (pdu->len == 0U) { adv->ad_data_backup.len = 0U; } else { - LL_ASSERT(pdu->len >= - offsetof(struct pdu_adv_adv_ind, data)); + LL_ASSERT_DBG(pdu->len >= + offsetof(struct pdu_adv_adv_ind, data)); adv->ad_data_backup.len = pdu->len - offsetof(struct pdu_adv_adv_ind, data); @@ -1970,9 +1970,9 @@ static uint32_t ticker_update_rand(struct ll_adv_set *adv, uint32_t ticks_delay_ ticks_adjust_minus, 0, 0, 0, 0, fp_op_func, adv); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY) || - (fp_op_func == NULL)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY) || + (fp_op_func == NULL)); return random_delay; } @@ -2090,7 +2090,7 @@ void ull_adv_done(struct node_rx_event_done *done) } handle = ull_adv_handle_get(adv); - LL_ASSERT(handle < BT_CTLR_ADV_SET); + LL_ASSERT_DBG(handle < BT_CTLR_ADV_SET); rx->hdr.type = NODE_RX_TYPE_EXT_ADV_TERMINATE; rx->hdr.handle = handle; @@ -2115,8 +2115,8 @@ void ull_adv_done(struct node_rx_event_done *done) ticker_stop_ext_op_cb, adv); } - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); #endif /* CONFIG_BT_CTLR_ADV_EXT */ } #endif /* CONFIG_BT_CTLR_ADV_EXT || CONFIG_BT_CTLR_JIT_SCHEDULING */ @@ -2369,7 +2369,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, (lazy != TICKER_LAZY_MUST_EXPIRE)) { /* Increment prepare reference count */ ref = ull_ref_inc(&adv->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); #if defined(CONFIG_BT_CTLR_ADV_EXT) && (CONFIG_BT_CTLR_ADV_AUX_SET > 0) && \ defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) @@ -2377,7 +2377,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, uint32_t ticks_to_expire; uint32_t other_remainder = 0U; - LL_ASSERT(context->other_expire_info); + LL_ASSERT_DBG(context->other_expire_info); /* Adjust ticks to expire based on remainder value */ ticks_to_expire = context->other_expire_info->ticks_to_expire; @@ -2405,7 +2405,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); #if defined(CONFIG_BT_CTLR_JIT_SCHEDULING) || \ (defined(CONFIG_BT_CTLR_ADV_EXT) && \ @@ -2496,7 +2496,7 @@ static void ticker_update_op_cb(uint32_t status, void *param) /* Reset update requested */ ticker_update_ack = ticker_update_req; -#if defined(CONFIG_BT_PERIPHERAL) && (defined(CONFIG_BT_ASSERT) || defined(CONFIG_ASSERT)) +#if defined(CONFIG_BT_PERIPHERAL) struct ll_adv_set *adv = param; struct pdu_adv *pdu = lll_adv_data_peek(&adv->lll); bool connectable = (pdu->type == PDU_ADV_TYPE_ADV_IND) || @@ -2508,13 +2508,13 @@ static void ticker_update_op_cb(uint32_t status, void *param) 0; #endif /* CONFIG_BT_PERIPHERAL && (CONFIG_BT_ASSERT || CONFIG_ASSERT) */ - LL_ASSERT(status == TICKER_STATUS_SUCCESS || - param == ull_disable_mark_get() || + LL_ASSERT_ERR((status == TICKER_STATUS_SUCCESS) || + (param == ull_disable_mark_get()) || #if defined(CONFIG_BT_PERIPHERAL) - /* if using connectable adv and lll.conn is 0 -> a connection is underway */ - (connectable && !adv->lll.conn) || + /* if using connectable adv and lll.conn is 0 -> a connection is underway */ + (connectable && !adv->lll.conn) || #endif /* CONFIG_BT_PERIPHERAL */ - 0); + 0); } #if defined(CONFIG_BT_PERIPHERAL) @@ -2527,13 +2527,13 @@ static void ticker_stop_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, uint32_t ret; handle = ull_adv_handle_get(adv); - LL_ASSERT(handle < BT_CTLR_ADV_SET); + LL_ASSERT_DBG(handle < BT_CTLR_ADV_SET); ret = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, TICKER_ID_ADV_BASE + handle, ticker_stop_op_cb, adv); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } static void ticker_stop_op_cb(uint32_t status, void *param) @@ -2560,7 +2560,7 @@ static void ticker_stop_op_cb(uint32_t status, void *param) mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void adv_disable(void *param) @@ -2581,14 +2581,14 @@ static void adv_disable(void *param) /* Setup disabled callback to be called when ref count * returns to zero. */ - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = mfy.param; hdr->disabled_cb = disabled_cb; /* Trigger LLL disable */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } else { /* No pending LLL events */ disabled_cb(&adv->lll); @@ -2604,11 +2604,11 @@ static void disabled_cb(void *param) adv = ((struct lll_hdr *)param)->parent; - LL_ASSERT(adv->link_cc_free); + LL_ASSERT_DBG(adv->link_cc_free); link = adv->link_cc_free; adv->link_cc_free = NULL; - LL_ASSERT(adv->node_rx_cc_free); + LL_ASSERT_DBG(adv->node_rx_cc_free); rx = adv->node_rx_cc_free; adv->node_rx_cc_free = NULL; @@ -2628,7 +2628,7 @@ static void disabled_cb(void *param) ll_rx_put(link, rx); handle = ull_adv_handle_get(adv); - LL_ASSERT(handle < BT_CTLR_ADV_SET); + LL_ASSERT_DBG(handle < BT_CTLR_ADV_SET); rx = (void *)adv->lll.node_rx_adv_term; rx->hdr.type = NODE_RX_TYPE_EXT_ADV_TERMINATE; @@ -2649,9 +2649,9 @@ static void conn_release(struct ll_adv_set *adv) struct lll_conn *lll = adv->lll.conn; memq_link_t *link; - LL_ASSERT(!lll->link_tx_free); + LL_ASSERT_DBG(!lll->link_tx_free); link = memq_deinit(&lll->memq_tx.head, &lll->memq_tx.tail); - LL_ASSERT(link); + LL_ASSERT_DBG(link); lll->link_tx_free = link; ll_conn_release(lll->hdr.parent); @@ -2702,13 +2702,13 @@ static void ticker_stop_aux_op_cb(uint32_t status, void *param) static struct mayfly mfy = {0, 0, &link, NULL, aux_disable}; uint32_t ret; - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); /* Check if any pending LLL events that need to be aborted */ mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void aux_disable(void *param) @@ -2723,7 +2723,7 @@ static void aux_disable(void *param) aux = HDR_LLL2ULL(lll_aux); hdr = &aux->ull; if (ull_ref_get(hdr)) { - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = adv; hdr->disabled_cb = aux_disabled_cb; } else { @@ -2741,8 +2741,8 @@ static void aux_disabled_cb(void *param) TICKER_USER_ID_ULL_HIGH, (TICKER_ID_ADV_BASE + handle), ticker_stop_ext_op_cb, param); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } static void ticker_stop_ext_op_cb(uint32_t status, void *param) @@ -2762,7 +2762,7 @@ static void ticker_stop_ext_op_cb(uint32_t status, void *param) mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void ext_disable(void *param) @@ -2783,14 +2783,14 @@ static void ext_disable(void *param) /* Setup disabled callback to be called when ref count * returns to zero. */ - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = mfy.param; hdr->disabled_cb = ext_disabled_cb; /* Trigger LLL disable */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } else { /* No pending LLL events */ ext_disabled_cb(&adv->lll); @@ -2852,7 +2852,7 @@ static inline uint8_t disable(uint8_t handle) #endif /* CONFIG_BT_PERIPHERAL */ mark = ull_disable_mark(adv); - LL_ASSERT(mark == adv); + LL_ASSERT_DBG(mark == adv); #if defined(CONFIG_BT_PERIPHERAL) if (adv->lll.is_hdcd) { @@ -2863,7 +2863,7 @@ static inline uint8_t disable(uint8_t handle) ret = ull_ticker_status_take(ret, &ret_cb); if (ret) { mark = ull_disable_unmark(adv); - LL_ASSERT(mark == adv); + LL_ASSERT_DBG(mark == adv); return BT_HCI_ERR_CMD_DISALLOWED; } @@ -2877,16 +2877,16 @@ static inline uint8_t disable(uint8_t handle) ret = ull_ticker_status_take(ret, &ret_cb); if (ret) { mark = ull_disable_unmark(adv); - LL_ASSERT(mark == adv); + LL_ASSERT_DBG(mark == adv); return BT_HCI_ERR_CMD_DISALLOWED; } err = ull_disable(&adv->lll); - LL_ASSERT(!err || (err == -EALREADY)); + LL_ASSERT_ERR(!err || (err == -EALREADY)); mark = ull_disable_unmark(adv); - LL_ASSERT(mark == adv); + LL_ASSERT_DBG(mark == adv); #if defined(CONFIG_BT_CTLR_ADV_EXT) && (CONFIG_BT_CTLR_ADV_AUX_SET > 0) struct lll_adv_aux *lll_aux = adv->lll.aux; @@ -3043,7 +3043,7 @@ static inline uint8_t *adv_pdu_adva_get(struct pdu_adv *pdu) /* All extended PDUs have AdvA at the same offset in common header */ if (pdu->type == PDU_ADV_TYPE_EXT_IND) { - LL_ASSERT(hdr_flags.adv_addr); + LL_ASSERT_DBG(hdr_flags.adv_addr); return &com_hdr->ext_hdr_adv_data[1]; } diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c b/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c index d77c004069e..8701f3f65fa 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c @@ -256,7 +256,7 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, /* Get the reference to auxiliary PDU chain */ pdu_prev = lll_adv_aux_data_alloc(adv->lll.aux, &idx); - LL_ASSERT(idx == sec_idx); + LL_ASSERT_DBG(idx == sec_idx); /* Current auxiliary PDU */ pdu = pdu_prev; @@ -269,7 +269,7 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, pdu_parent = lll_adv_aux_data_alloc(adv->lll.aux, &idx); - LL_ASSERT(idx == sec_idx); + LL_ASSERT_DBG(idx == sec_idx); /* Remove/Release any previous chain PDU * allocations @@ -340,7 +340,7 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, 0U, hdr_data); ad_len_prev = hdr_data[ULL_ADV_HDR_DATA_LEN_OFFSET]; - LL_ASSERT(!err || (err == BT_HCI_ERR_PACKET_TOO_LONG)); + LL_ASSERT_DBG(!err || (err == BT_HCI_ERR_PACKET_TOO_LONG)); /* Check of max supported AD data len */ ad_len_total += ad_len_prev; @@ -363,8 +363,8 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, pdu_chain_prev = lll_adv_pdu_linked_next_get(pdu_prev); pdu_chain = lll_adv_pdu_linked_next_get(pdu); - LL_ASSERT((pdu_chain_prev && pdu_chain) || - (!pdu_chain_prev && !pdu_chain)); + LL_ASSERT_DBG((pdu_chain_prev && pdu_chain) || + (!pdu_chain_prev && !pdu_chain)); } while (pdu_chain_prev); /* No AD data overflow */ @@ -408,7 +408,7 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, ULL_ADV_PDU_HDR_FIELD_AD_DATA_APPEND, 0U, hdr_data); - LL_ASSERT((!chain_err) || (chain_err == BT_HCI_ERR_PACKET_TOO_LONG)); + LL_ASSERT_DBG((!chain_err) || (chain_err == BT_HCI_ERR_PACKET_TOO_LONG)); /* FIXME: the code has become quite complex, an alternative and simpler * implementation would be to first fill an array with all data that @@ -456,7 +456,7 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, chain_err = ull_adv_aux_pdu_set_clear(adv, pdu_prev, pdu, chain_add_fields, 0U, hdr_data); - LL_ASSERT(chain_err == 0U); + LL_ASSERT_DBG(chain_err == 0U); /* * in the next PDU we still need to add ad_len_chain bytes of data * but we do not have overflow, since we already added @@ -495,7 +495,7 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, /* Allocate new PDU */ pdu_chain = lll_adv_pdu_alloc_pdu_adv(); - LL_ASSERT(pdu_chain); + LL_ASSERT_ERR(pdu_chain); /* Populate the appended chain PDU */ pdu_chain->type = PDU_ADV_TYPE_AUX_CHAIN_IND; @@ -509,7 +509,8 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, hdr_chain = (void *)&com_hdr_chain->ext_hdr_adv_data[0]; dptr_chain = (void *)hdr_chain; - LL_ASSERT(dptr_chain); + LL_ASSERT_DBG(dptr_chain); + /* Flags */ *dptr_chain = 0U; @@ -781,7 +782,7 @@ uint8_t ll_adv_aux_sr_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, } /* Scannable advertising shall have aux context allocated */ - LL_ASSERT(lll->aux); + LL_ASSERT_DBG(lll->aux); /* Get reference to previous secondary channel PDU */ sec_pdu_prev = lll_adv_aux_data_peek(lll->aux); @@ -1046,7 +1047,7 @@ uint8_t ll_adv_aux_sr_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, err = ull_adv_aux_pdu_set_clear(adv, sr_pdu_prev, sr_pdu, hdr_add_fields, 0U, hdr_data); - LL_ASSERT(!err || (err == BT_HCI_ERR_PACKET_TOO_LONG)); + LL_ASSERT_DBG(!err || (err == BT_HCI_ERR_PACKET_TOO_LONG)); /* Get PDUs previous AD data length */ ad_len_prev = @@ -1073,8 +1074,8 @@ uint8_t ll_adv_aux_sr_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, pdu_chain_prev = lll_adv_pdu_linked_next_get(sr_pdu_prev); pdu_chain = lll_adv_pdu_linked_next_get(sr_pdu); - LL_ASSERT((pdu_chain_prev && pdu_chain) || - (!pdu_chain_prev && !pdu_chain)); + LL_ASSERT_DBG((pdu_chain_prev && pdu_chain) || + (!pdu_chain_prev && !pdu_chain)); } while (pdu_chain_prev); if (err == BT_HCI_ERR_PACKET_TOO_LONG) { @@ -1141,7 +1142,7 @@ uint8_t ll_adv_aux_sr_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, /* Allocate new PDU */ pdu_chain = lll_adv_pdu_alloc_pdu_adv(); - LL_ASSERT(pdu_chain); + LL_ASSERT_ERR(pdu_chain); /* Populate the appended chain PDU */ pdu_chain->type = PDU_ADV_TYPE_AUX_CHAIN_IND; @@ -1528,8 +1529,8 @@ uint8_t ull_adv_aux_hdr_set_clear(struct ll_adv_set *adv, lll = &adv->lll; /* Can't have both flags set here since both use 'hdr_data' param */ - LL_ASSERT(!(sec_hdr_add_fields & ULL_ADV_PDU_HDR_FIELD_ADVA) || - !(sec_hdr_add_fields & ULL_ADV_PDU_HDR_FIELD_AD_DATA)); + LL_ASSERT_DBG(!(sec_hdr_add_fields & ULL_ADV_PDU_HDR_FIELD_ADVA) || + !(sec_hdr_add_fields & ULL_ADV_PDU_HDR_FIELD_AD_DATA)); /* Get reference to previous primary PDU data */ pri_pdu_prev = lll_adv_data_peek(lll); @@ -1579,7 +1580,7 @@ uint8_t ull_adv_aux_hdr_set_clear(struct ll_adv_set *adv, if (!lll_aux) { aux = ull_adv_aux_acquire(lll); if (!aux) { - LL_ASSERT(pri_pdu != pri_pdu_prev); + LL_ASSERT_DBG(pri_pdu != pri_pdu_prev); return BT_HCI_ERR_MEM_CAPACITY_EXCEEDED; } @@ -2566,7 +2567,7 @@ void ull_adv_sync_started_stopped(struct ll_adv_aux_set *aux) struct ll_adv_sync_set *sync; uint8_t aux_handle; - LL_ASSERT(lll_sync); + LL_ASSERT_DBG(lll_sync); sync = HDR_LLL2ULL(lll_sync); aux_handle = ull_adv_aux_handle_get(aux); @@ -2760,7 +2761,7 @@ void ull_adv_aux_offset_get(struct ll_adv_set *adv) mfy.param = adv; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } #endif /* !CONFIG_BT_TICKER_EXT_EXPIRE_INFO */ @@ -2886,7 +2887,7 @@ void ull_adv_aux_chain_pdu_duplicate(struct pdu_adv *pdu_prev, if (!pdu_chain) { /* Get a new chain PDU */ pdu_chain = lll_adv_pdu_alloc_pdu_adv(); - LL_ASSERT(pdu_chain); + LL_ASSERT_ERR(pdu_chain); /* Copy previous chain PDU into new chain PDU */ (void)memcpy(pdu_chain, pdu_chain_prev, @@ -3240,7 +3241,7 @@ static void mfy_aux_offset_get(void *param) } success = (ret_cb == TICKER_STATUS_SUCCESS); - LL_ASSERT(success); + LL_ASSERT_ERR(success); /* FIXME: If the reference ticks change then implement the * compensation by adding the difference to the @@ -3249,9 +3250,9 @@ static void mfy_aux_offset_get(void *param) * ticker expiry that update the ticks_current. * For now assert until the fix implementation is added. */ - LL_ASSERT((ticks_current == ticks_previous) || retry--); + LL_ASSERT_ERR((ticks_current == ticks_previous) || retry--); - LL_ASSERT(id != TICKER_NULL); + LL_ASSERT_ERR(id != TICKER_NULL); } while (id != ticker_id); /* Adjust ticks to expire based on remainder value */ @@ -3326,7 +3327,7 @@ static void mfy_aux_offset_get(void *param) ticks_elapsed = ticker_ticks_diff_get(ticks_now, ticks_current); ticks_to_start = HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_XTAL_US) - HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_PREEMPT_MIN_US); - LL_ASSERT(ticks_elapsed < ticks_to_start); + LL_ASSERT_ERR(ticks_elapsed < ticks_to_start); } static void ticker_op_cb(uint32_t status, void *param) @@ -3358,7 +3359,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&aux->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); #if defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) #if defined(CONFIG_BT_CTLR_ADV_PERIODIC) @@ -3374,7 +3375,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, uint32_t ticks_to_expire; uint32_t sync_remainder_us = 0U; - LL_ASSERT(context->other_expire_info); + LL_ASSERT_DBG(context->other_expire_info); /* Reduce a tick for negative remainder and return positive remainder * value. @@ -3418,7 +3419,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); #if defined(CONFIG_BT_CTLR_ADV_PERIODIC) && !defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) struct ll_adv_set *adv; @@ -3441,8 +3442,8 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, #if defined(CONFIG_BT_CTLR_ADV_PERIODIC) && defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) static void ticker_update_op_cb(uint32_t status, void *param) { - LL_ASSERT(status == TICKER_STATUS_SUCCESS || - param == ull_disable_mark_get()); + LL_ASSERT_ERR((status == TICKER_STATUS_SUCCESS) || + (param == ull_disable_mark_get())); } #endif /* !CONFIG_BT_CTLR_ADV_PERIODIC && CONFIG_BT_TICKER_EXT_EXPIRE_INFO */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv_iso.c b/subsys/bluetooth/controller/ll_sw/ull_adv_iso.c index f8f7cb35d64..775baf1c63e 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv_iso.c @@ -507,7 +507,7 @@ static uint8_t big_create(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bi lll_adv_iso->max_sdu = max_sdu; res = util_saa_le32(lll_adv_iso->seed_access_addr, big_handle); - LL_ASSERT(!res); + LL_ASSERT_DBG(!res); (void)lll_csrand_get(lll_adv_iso->base_crc_init, sizeof(lll_adv_iso->base_crc_init)); @@ -604,11 +604,11 @@ static uint8_t big_create(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bi /* Calculate GSK */ err = bt_crypto_h7(BIG1, bcode, igltk); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); err = bt_crypto_h6(igltk, BIG2, gltk); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); err = bt_crypto_h8(gltk, big_info->gskd, BIG3, gsk); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* Prepare the CCM parameters */ ccm_tx = &lll_adv_iso->ccm_tx; @@ -820,7 +820,7 @@ int ull_adv_iso_reset(void) } mark = ull_disable_mark(adv_iso); - LL_ASSERT(mark == adv_iso); + LL_ASSERT_DBG(mark == adv_iso); /* Stop event scheduling */ ret_cb = TICKER_STATUS_BUSY; @@ -830,20 +830,20 @@ int ull_adv_iso_reset(void) ret = ull_ticker_status_take(ret, &ret_cb); if (ret) { mark = ull_disable_unmark(adv_iso); - LL_ASSERT(mark == adv_iso); + LL_ASSERT_DBG(mark == adv_iso); /* Assert as there shall be a ticker instance active */ - LL_ASSERT(false); + LL_ASSERT_DBG(false); return BT_HCI_ERR_CMD_DISALLOWED; } /* Abort any events in LLL pipeline */ err = ull_disable(adv_iso_lll); - LL_ASSERT(!err || (err == -EALREADY)); + LL_ASSERT_ERR(!err || (err == -EALREADY)); mark = ull_disable_unmark(adv_iso); - LL_ASSERT(mark == adv_iso); + LL_ASSERT_DBG(mark == adv_iso); /* Reset associated streams */ while (adv_iso_lll->num_bis--) { @@ -970,7 +970,7 @@ void ull_adv_iso_offset_get(struct ll_adv_sync_set *sync) mfy.param = sync; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } #if defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) @@ -1071,8 +1071,8 @@ void ull_adv_iso_done_terminate(struct node_rx_event_done *done) ret = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, (TICKER_ID_ADV_ISO_BASE + lll->handle), ticker_stop_op_cb, adv_iso); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); /* Invalidate the handle */ lll->handle = LLL_ADV_HANDLE_INVALID; @@ -1115,10 +1115,10 @@ void ull_adv_iso_stream_release(struct ll_adv_iso_set *adv_iso) stream_handle = lll->stream_handle[lll->num_bis]; stream = ull_adv_iso_stream_get(stream_handle); - LL_ASSERT(!stream->link_tx_free); + LL_ASSERT_DBG(!stream->link_tx_free); link = memq_deinit(&stream->memq_tx.head, &stream->memq_tx.tail); - LL_ASSERT(link); + LL_ASSERT_DBG(link); stream->link_tx_free = link; dp = stream->dp; @@ -1220,7 +1220,7 @@ static uint8_t ptc_calc(const struct lll_adv_iso *lll, uint32_t event_spacing, * running buffer offset related to nse. Fix ptc and ptc_curr definitions, * until then lets have an assert check here. */ - LL_ASSERT(ptc <= BIT_MASK(4)); + LL_ASSERT_DBG(ptc <= BIT_MASK(4)); return ptc; } @@ -1378,11 +1378,11 @@ static void adv_iso_chm_complete_commit(struct lll_adv_iso *lll_iso) adv = HDR_LLL2ULL(lll_iso->adv); err = ull_adv_sync_pdu_alloc(adv, ULL_ADV_PDU_EXTRA_DATA_ALLOC_IF_EXIST, &pdu_prev, &pdu, NULL, NULL, &ter_idx); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* Copy content */ err = ull_adv_sync_duplicate(pdu_prev, pdu); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* Get the current ACAD */ acad = ull_adv_sync_get_acad(pdu, &acad_len); @@ -1390,7 +1390,7 @@ static void adv_iso_chm_complete_commit(struct lll_adv_iso *lll_iso) lll_sync = adv->lll.sync; /* Dev assert if ACAD empty */ - LL_ASSERT(acad_len); + LL_ASSERT_DBG(acad_len); /* Find the BIGInfo */ len = acad_len; @@ -1404,12 +1404,13 @@ static void adv_iso_chm_complete_commit(struct lll_adv_iso *lll_iso) ad_len += 1U; - LL_ASSERT(ad_len <= len); + LL_ASSERT_DBG(ad_len <= len); ad += ad_len; len -= ad_len; } while (len); - LL_ASSERT(len); + + LL_ASSERT_DBG(len); /* Get reference to BIGInfo */ bi = (void *)&ad[PDU_ADV_DATA_HEADER_DATA_OFFSET]; @@ -1474,11 +1475,11 @@ static void mfy_iso_offset_get(void *param) } success = (ret_cb == TICKER_STATUS_SUCCESS); - LL_ASSERT(success); + LL_ASSERT_ERR(success); - LL_ASSERT((ticks_current == ticks_previous) || retry--); + LL_ASSERT_ERR((ticks_current == ticks_previous) || retry--); - LL_ASSERT(id != TICKER_NULL); + LL_ASSERT_ERR(id != TICKER_NULL); } while (id != ticker_id); payload_count = lll_iso->payload_count + @@ -1593,7 +1594,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&adv_iso->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* Append timing parameters */ p.ticks_at_expire = ticks_at_expire; @@ -1606,7 +1607,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy_lll_prepare); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); /* Calculate the BIG reference point of current BIG event */ remainder_us = remainder; @@ -1630,13 +1631,13 @@ static void ticker_stop_op_cb(uint32_t status, void *param) static struct mayfly mfy = {0U, 0U, &link, NULL, adv_iso_disable}; uint32_t ret; - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); /* Check if any pending LLL events that need to be aborted */ mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void adv_iso_disable(void *param) @@ -1657,14 +1658,14 @@ static void adv_iso_disable(void *param) /* Setup disabled callback to be called when ref count * returns to zero. */ - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = mfy.param; hdr->disabled_cb = disabled_cb; /* Trigger LLL disable */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } else { /* No pending LLL events */ disabled_cb(&adv_iso->lll); @@ -1680,7 +1681,7 @@ static void disabled_cb(void *param) mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void tx_lll_flush(void *param) @@ -1726,7 +1727,7 @@ static void tx_lll_flush(void *param) adv_iso = HDR_LLL2ULL(lll); rx = (void *)&adv_iso->node_rx_terminate; link = rx->hdr.link; - LL_ASSERT(link); + LL_ASSERT_DBG(link); rx->hdr.link = NULL; /* Enqueue the terminate towards ULL context */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv_sync.c b/subsys/bluetooth/controller/ll_sw/ull_adv_sync.c index 8c4d610b887..ea1311c528e 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv_sync.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv_sync.c @@ -176,7 +176,7 @@ uint8_t ll_adv_sync_param_set(uint8_t handle, uint16_t interval, uint16_t flags) lll_hdr_init(lll_sync, sync); err = util_aa_le32(lll_sync->access_addr); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); lll_sync->data_chan_id = lll_chan_id(lll_sync->access_addr); chm_last = lll_sync->chm_first; @@ -940,11 +940,11 @@ void ull_adv_sync_chm_complete(struct node_rx_pdu *rx) adv = HDR_LLL2ULL(lll_sync->adv); err = ull_adv_sync_pdu_alloc(adv, ULL_ADV_PDU_EXTRA_DATA_ALLOC_IF_EXIST, &pdu_prev, &pdu, NULL, NULL, &ter_idx); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); err = ull_adv_sync_remove_from_acad(lll_sync, pdu_prev, pdu, PDU_ADV_DATA_TYPE_CHANNEL_MAP_UPDATE_IND); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); lll_adv_sync_data_enqueue(lll_sync, ter_idx); } @@ -981,7 +981,7 @@ void ull_adv_sync_offset_get(struct ll_adv_set *adv) mfy.param = adv; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } #endif /* CONFIG_BT_TICKER_EXT_EXPIRE_INFO */ @@ -1013,11 +1013,12 @@ void ull_adv_sync_pdu_init(struct pdu_adv *pdu, uint8_t ext_hdr_flags, *(uint8_t *)ext_hdr = ext_hdr_flags; dptr = ext_hdr->data; - LL_ASSERT(!(ext_hdr_flags & (ULL_ADV_PDU_HDR_FIELD_ADVA | ULL_ADV_PDU_HDR_FIELD_TARGETA | + LL_ASSERT_DBG(!(ext_hdr_flags & (ULL_ADV_PDU_HDR_FIELD_ADVA | + ULL_ADV_PDU_HDR_FIELD_TARGETA | #if !defined(CONFIG_BT_CTLR_ADV_PERIODIC_ADI_SUPPORT) - ULL_ADV_PDU_HDR_FIELD_ADI | + ULL_ADV_PDU_HDR_FIELD_ADI | #endif /* CONFIG_BT_CTLR_ADV_PERIODIC_ADI_SUPPORT */ - ULL_ADV_PDU_HDR_FIELD_SYNC_INFO))); + ULL_ADV_PDU_HDR_FIELD_SYNC_INFO))); #if defined(CONFIG_BT_CTLR_ADV_SYNC_PDU_BACK2BACK) if (IS_ENABLED(CONFIG_BT_CTLR_DF_ADV_CTE_TX) && @@ -1174,8 +1175,8 @@ static void ull_adv_sync_add_to_header(struct pdu_adv *pdu, /* Push back any adv data - overflow will be returned via ad_overflow */ if (pdu->len > hdr->ext_hdr_len + 1U) { if (pdu->len > PDU_AC_EXT_PAYLOAD_SIZE_MAX - delta) { - LL_ASSERT(ad_overflow); - LL_ASSERT(overflow_len); + LL_ASSERT_DBG(ad_overflow); + LL_ASSERT_DBG(overflow_len); #if defined(CONFIG_BT_CTLR_ADV_SYNC_PDU_LINK) *overflow_len = delta - (PDU_AC_EXT_PAYLOAD_SIZE_MAX - pdu->len); memcpy(ad_overflow, @@ -1375,7 +1376,7 @@ static void ull_adv_sync_copy_pdu_header(struct pdu_adv *target_pdu, const uint8_t *source_dptr; uint8_t *target_dptr; - LL_ASSERT(target_pdu != source_pdu); + LL_ASSERT_DBG(target_pdu != source_pdu); /* Initialize PDU header */ target_pdu->type = source_pdu->type; @@ -1861,7 +1862,8 @@ static uint8_t ull_adv_sync_add_adi(struct lll_adv_sync *lll_sync, last_pdu = pdu; /* We should always have enough available overflow space to fit an ADI */ - LL_ASSERT(total_overflow_len + sizeof(struct pdu_adv_adi) <= sizeof(ad_overflow)); + LL_ASSERT_DBG((total_overflow_len + sizeof(struct pdu_adv_adi)) <= + sizeof(ad_overflow)); ull_adv_sync_add_to_header(pdu, &add_fields, &ad_overflow[total_overflow_len], &overflow_len); @@ -2054,7 +2056,7 @@ uint8_t ull_adv_sync_remove_from_acad(struct lll_adv_sync *lll_sync, ad_len += 1U; - LL_ASSERT(ad_len <= len); + LL_ASSERT_DBG(ad_len <= len); ad += ad_len; len -= ad_len; @@ -2180,7 +2182,8 @@ uint8_t ull_adv_sync_add_cteinfo(struct lll_adv_sync *lll_sync, last_pdu = pdu; /* We should always have enough available overflow space to fit CTEInfo */ - LL_ASSERT(total_overflow_len + sizeof(struct pdu_cte_info) <= sizeof(ad_overflow)); + LL_ASSERT_DBG((total_overflow_len + sizeof(struct pdu_cte_info)) <= + sizeof(ad_overflow)); ull_adv_sync_add_to_header(pdu, &add_fields, &ad_overflow[total_overflow_len], &overflow_len); @@ -2720,11 +2723,11 @@ static void mfy_sync_offset_get(void *param) } success = (ret_cb == TICKER_STATUS_SUCCESS); - LL_ASSERT(success); + LL_ASSERT_ERR(success); - LL_ASSERT((ticks_current == ticks_previous) || retry--); + LL_ASSERT_ERR((ticks_current == ticks_previous) || retry--); - LL_ASSERT(id != TICKER_NULL); + LL_ASSERT_ERR(id != TICKER_NULL); } while (id != ticker_id); /* Reduced a tick for negative remainder and return positive remainder @@ -2861,14 +2864,14 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&sync->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); #if defined(CONFIG_BT_CTLR_ADV_ISO) && \ defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) if (lll->iso) { struct lll_adv_iso *lll_iso = lll->iso; - LL_ASSERT(context->other_expire_info); + LL_ASSERT_DBG(context->other_expire_info); /* Check: No need for remainder in this case? */ lll_iso->ticks_sync_pdu_offset = context->other_expire_info->ticks_to_expire; @@ -2887,7 +2890,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); #if defined(CONFIG_BT_CTLR_ADV_ISO) && \ !defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) @@ -2903,7 +2906,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO) static void ticker_update_op_cb(uint32_t status, void *param) { - LL_ASSERT(status == TICKER_STATUS_SUCCESS || - param == ull_disable_mark_get()); + LL_ASSERT_ERR((status == TICKER_STATUS_SUCCESS) || + (param == ull_disable_mark_get())); } #endif /* !CONFIG_BT_CTLR_ADV_ISO && CONFIG_BT_TICKER_EXT_EXPIRE_INFO */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_central.c b/subsys/bluetooth/controller/ll_sw/ull_central.c index 1771cda124b..f4bc227cfdf 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_central.c +++ b/subsys/bluetooth/controller/ll_sw/ull_central.c @@ -190,7 +190,7 @@ uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window, conn_lll = &conn->lll; err = util_aa_le32(conn_lll->access_addr); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); lll_csrand_get(conn_lll->crc_init, sizeof(conn_lll->crc_init)); @@ -519,7 +519,7 @@ uint8_t ll_connect_disable(void **rx) conn = HDR_LLL2ULL(conn_lll); node_rx = (void *)&conn->llcp_terminate.node_rx.rx; link = node_rx->hdr.link; - LL_ASSERT(link); + LL_ASSERT_DBG(link); /* free the memq link early, as caller could overwrite it */ ll_rx_link_release(link); @@ -603,7 +603,7 @@ int ull_central_reset(void) } } - LL_ASSERT(scan); + LL_ASSERT_DBG(scan); scan->is_enabled = 0U; scan->lll.conn = NULL; @@ -628,13 +628,13 @@ void ull_central_cleanup(struct node_rx_pdu *rx_free) */ scan = HDR_LLL2ULL(rx_free->rx_ftr.param); conn_lll = scan->lll.conn; - LL_ASSERT(conn_lll); + LL_ASSERT_DBG(conn_lll); scan->lll.conn = NULL; - LL_ASSERT(!conn_lll->link_tx_free); + LL_ASSERT_DBG(!conn_lll->link_tx_free); link = memq_deinit(&conn_lll->memq_tx.head, &conn_lll->memq_tx.tail); - LL_ASSERT(link); + LL_ASSERT_DBG(link); conn_lll->link_tx_free = link; conn = HDR_LLL2ULL(conn_lll); @@ -655,7 +655,7 @@ void ull_central_cleanup(struct node_rx_pdu *rx_free) ull_scan_is_enabled_get(SCAN_HANDLE_PHY_CODED); if (scan_coded && scan_coded != scan) { conn_lll = scan_coded->lll.conn; - LL_ASSERT(conn_lll); + LL_ASSERT_DBG(conn_lll); scan_coded->lll.conn = NULL; scan_coded->is_enabled = 0U; @@ -699,7 +699,7 @@ void ull_central_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, * complete event. */ node = pdu_tx; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_cc)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_cc)); /* Populate the fields required for connection complete event */ cc = node; @@ -831,8 +831,8 @@ void ull_central_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, TICKER_USER_ID_ULL_HIGH, ticker_id_scan, ticks_at_stop, ticker_op_stop_scan_cb, scan); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); #if defined(CONFIG_BT_CTLR_ADV_EXT) && defined(CONFIG_BT_CTLR_PHY_CODED) /* Determine if coded PHY was also enabled, if so, reset the assigned @@ -853,8 +853,8 @@ void ull_central_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, ticker_id_scan, ticker_op_stop_scan_other_cb, scan_other); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); } } #endif /* CONFIG_BT_CTLR_ADV_EXT && CONFIG_BT_CTLR_PHY_CODED */ @@ -880,8 +880,8 @@ void ull_central_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, (conn->ull.ticks_slot + ticks_slot_overhead), ull_central_ticker_cb, conn, ticker_op_cb, (void *)__LINE__); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); #if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) /* enable ticker job, irrespective of disabled in this function so @@ -944,7 +944,7 @@ void ull_central_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&conn->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* Increment event counter. * @@ -972,7 +972,7 @@ void ull_central_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ err = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!err); + LL_ASSERT_ERR(!err); /* De-mux remaining tx nodes from FIFO */ ull_conn_tx_demux(UINT8_MAX); @@ -1044,7 +1044,7 @@ static void ticker_op_stop_scan_other_cb(uint32_t status, void *param) ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } } #endif /* CONFIG_BT_CTLR_ADV_EXT && CONFIG_BT_CTLR_PHY_CODED */ @@ -1053,7 +1053,7 @@ static void ticker_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); } static inline void conn_release(struct ll_scan_set *scan) @@ -1064,16 +1064,16 @@ static inline void conn_release(struct ll_scan_set *scan) memq_link_t *link; lll = scan->lll.conn; - LL_ASSERT(!lll->link_tx_free); + LL_ASSERT_DBG(!lll->link_tx_free); link = memq_deinit(&lll->memq_tx.head, &lll->memq_tx.tail); - LL_ASSERT(link); + LL_ASSERT_DBG(link); lll->link_tx_free = link; conn = HDR_LLL2ULL(lll); cc = (void *)&conn->llcp_terminate.node_rx.rx; link = cc->hdr.link; - LL_ASSERT(link); + LL_ASSERT_DBG(link); ll_rx_link_release(link); diff --git a/subsys/bluetooth/controller/ll_sw/ull_central_iso.c b/subsys/bluetooth/controller/ll_sw/ull_central_iso.c index c2f86c263df..d99896a975b 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_central_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_central_iso.c @@ -355,7 +355,7 @@ uint8_t ll_cig_parameters_commit(uint8_t cig_id, uint16_t *handles) tx = cis->lll.tx.bn && cis->lll.tx.max_pdu; rx = cis->lll.rx.bn && cis->lll.rx.max_pdu; } else { - LL_ASSERT(cis->framed || iso_interval_us >= cig->c_sdu_interval); + LL_ASSERT_DBG(cis->framed || iso_interval_us >= cig->c_sdu_interval); tx = cig->c_sdu_interval && cis->c_max_sdu; rx = cig->p_sdu_interval && cis->p_max_sdu; @@ -463,7 +463,7 @@ uint8_t ll_cig_parameters_commit(uint8_t cig_id, uint16_t *handles) if (!cig->central.test) { #if defined(CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY) /* TODO: Only implemented for sequential packing */ - LL_ASSERT(cig->central.packing == BT_ISO_PACKING_SEQUENTIAL); + LL_ASSERT_ERR(cig->central.packing == BT_ISO_PACKING_SEQUENTIAL); /* Use symmetric flush timeout */ cis->lll.tx.ft = DIV_ROUND_UP(total_time, iso_interval_us); @@ -494,7 +494,7 @@ uint8_t ll_cig_parameters_commit(uint8_t cig_id, uint16_t *handles) } #else - LL_ASSERT(0); + LL_ASSERT_ERR(0); #endif cis->lll.nse = DIV_ROUND_UP(se[i].total_count, cis->lll.tx.ft); } @@ -736,7 +736,7 @@ void ll_cis_create(uint16_t cis_handle, uint16_t acl_handle) /* Create access address */ err = util_aa_le32(cis->lll.access_addr); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* Initialize stream states */ cis->established = 0; @@ -754,7 +754,7 @@ void ll_cis_create(uint16_t cis_handle, uint16_t acl_handle) /* Initiate CIS Request Control Procedure */ if (ull_cp_cis_create(conn, cis) == BT_HCI_ERR_SUCCESS) { - LL_ASSERT(cis->group); + LL_ASSERT_DBG(cis->group); if (cis->group->state == CIG_STATE_CONFIGURABLE) { /* This CIG is now initiating an ISO connection */ @@ -859,7 +859,7 @@ uint8_t ull_central_iso_setup(uint16_t cis_handle, /* ACL connection of the new CIS */ conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); #if defined(CONFIG_BT_CTLR_JIT_SCHEDULING) uint16_t event_counter; @@ -980,10 +980,10 @@ int ull_central_iso_cis_offset_get(uint16_t cis_handle, struct ll_conn *conn; cis = ll_conn_iso_stream_get(cis_handle); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); /* `ull_conn_llcp()` (caller of this function) is called before `ull_ref_inc()` hence we do * not need to use `ull_conn_event_counter()`. @@ -1032,7 +1032,7 @@ static void cig_offset_get(struct ll_conn_iso_stream *cis) mfy.param = cis; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void mfy_cig_offset_get(void *param) @@ -1055,7 +1055,7 @@ static void mfy_cig_offset_get(void *param) */ err = ull_sched_conn_iso_free_offset_get(cig->ull.ticks_slot, &ticks_to_expire); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* Calculate the offset for the select CIS in the CIG */ offset_min_us = HAL_TICKER_TICKS_TO_US(ticks_to_expire) + @@ -1063,7 +1063,7 @@ static void mfy_cig_offset_get(void *param) offset_min_us += cig->sync_delay - cis->sync_delay; conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); /* Ensure the offset is not greater than the ACL interval, considering * the minimum CIS offset requirement. @@ -1088,7 +1088,7 @@ static void cis_offset_get(struct ll_conn_iso_stream *cis) mfy.param = cis; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void mfy_cis_offset_get(void *param) @@ -1161,11 +1161,11 @@ static void mfy_cis_offset_get(void *param) } success = (ret_cb == TICKER_STATUS_SUCCESS); - LL_ASSERT(success); + LL_ASSERT_ERR(success); - LL_ASSERT((ticks_current == ticks_previous) || retry--); + LL_ASSERT_ERR((ticks_current == ticks_previous) || retry--); - LL_ASSERT(id != TICKER_NULL); + LL_ASSERT_ERR(id != TICKER_NULL); } while (id != ticker_id); /* Reduced a tick for negative remainder and return positive remainder @@ -1175,7 +1175,7 @@ static void mfy_cis_offset_get(void *param) cig_remainder_us = remainder; conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); /* Add a tick for negative remainder and return positive remainder * value. diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn.c b/subsys/bluetooth/controller/ll_sw/ull_conn.c index b68eaea1958..fb6e98915d7 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn.c @@ -444,7 +444,7 @@ uint8_t ll_terminate_ind_send(uint16_t handle, uint8_t reason) } else if (cis->group->state == CIG_STATE_INITIATING) { conn = ll_connected_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); /* CIS is not yet established - try to cancel procedure */ if (ull_cp_cc_cancel(conn)) { @@ -452,7 +452,7 @@ uint8_t ll_terminate_ind_send(uint16_t handle, uint8_t reason) struct node_rx_pdu *node_terminate; node_terminate = ull_pdu_rx_alloc(); - LL_ASSERT(node_terminate); + LL_ASSERT_ERR(node_terminate); node_terminate->hdr.handle = handle; node_terminate->hdr.type = NODE_RX_TYPE_TERMINATE; @@ -562,8 +562,7 @@ static bool ll_len_validate(uint16_t tx_octets, uint16_t tx_time) return true; } -uint32_t ll_length_req_send(uint16_t handle, uint16_t tx_octets, - uint16_t tx_time) +uint8_t ll_length_req_send(uint16_t handle, uint16_t tx_octets, uint16_t tx_time) { struct ll_conn *conn; @@ -601,7 +600,7 @@ void ll_length_default_get(uint16_t *max_tx_octets, uint16_t *max_tx_time) *max_tx_time = default_tx_time; } -uint32_t ll_length_default_set(uint16_t max_tx_octets, uint16_t max_tx_time) +uint8_t ll_length_default_set(uint16_t max_tx_octets, uint16_t max_tx_time) { if (IS_ENABLED(CONFIG_BT_CTLR_PARAM_CHECK) && !ll_len_validate(max_tx_octets, max_tx_time)) { @@ -901,7 +900,7 @@ void ull_conn_setup(memq_link_t *rx_link, struct node_rx_pdu *rx) /* Setup connection in ULL disabled callback, * pass the node rx as disabled callback parameter. */ - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = rx; hdr->disabled_cb = conn_setup_adv_scan_disabled_cb; @@ -977,7 +976,7 @@ void ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx) int ull_conn_llcp(struct ll_conn *conn, uint32_t ticks_at_expire, uint32_t remainder, uint16_t lazy) { - LL_ASSERT(conn->lll.handle != LLL_HANDLE_INVALID); + LL_ASSERT_DBG(conn->lll.handle != LLL_HANDLE_INVALID); conn->llcp.prep.ticks_at_expire = ticks_at_expire; conn->llcp.prep.remainder = remainder; @@ -1411,9 +1410,9 @@ void ull_conn_done(struct node_rx_event_done *done) lazy, force, ticker_update_conn_op_cb, conn_ll); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY) || - ((void *)conn_ll == ull_disable_mark_get())); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY) || + ((void *)conn_ll == ull_disable_mark_get())); } } @@ -1480,7 +1479,7 @@ void ull_conn_tx_lll_enqueue(struct ll_conn *conn, uint8_t count) } link = mem_acquire(&mem_link_tx.free); - LL_ASSERT(link); + LL_ASSERT_ERR(link); /* Enqueue towards LLL */ memq_enqueue(link, tx, &conn->lll.memq_tx.tail); @@ -1543,7 +1542,7 @@ void ull_conn_lll_ack_enqueue(uint16_t handle, struct node_tx *tx) uint8_t idx; idx = MFIFO_ENQUEUE_GET(conn_ack, (void **)&lll_tx); - LL_ASSERT(lll_tx); + LL_ASSERT_ERR(lll_tx); lll_tx->handle = handle; lll_tx->node = tx; @@ -1556,13 +1555,13 @@ void ull_conn_tx_ack(uint16_t handle, memq_link_t *link, struct node_tx *tx) struct pdu_data *pdu_tx; pdu_tx = (void *)tx->pdu; - LL_ASSERT(pdu_tx->len); + LL_ASSERT_DBG(pdu_tx->len); if (pdu_tx->ll_id == PDU_DATA_LLID_CTRL) { if (handle != LLL_HANDLE_INVALID) { struct ll_conn *conn = ll_conn_get(handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); ull_cp_tx_ack(conn, tx); } @@ -1572,7 +1571,7 @@ void ull_conn_tx_ack(uint16_t handle, memq_link_t *link, struct node_tx *tx) struct ll_conn *conn; /* Tx Node not re-used, ensure link->next is non-NULL */ - LL_ASSERT(link->next); + LL_ASSERT_DBG(link->next); /* Pass conn as-is to ull_cp_release_tx(), NULL check is done there */ conn = ll_connected_get(handle); @@ -1586,12 +1585,12 @@ void ull_conn_tx_ack(uint16_t handle, memq_link_t *link, struct node_tx *tx) return; } - LL_ASSERT(!link->next); + LL_ASSERT_DBG(!link->next); } else if (handle == LLL_HANDLE_INVALID) { pdu_tx->ll_id = PDU_DATA_LLID_RESV; } else { - LL_ASSERT(handle != LLL_HANDLE_INVALID); + LL_ASSERT_DBG(handle != LLL_HANDLE_INVALID); } ll_tx_ack_put(handle, tx); @@ -1785,29 +1784,33 @@ static void ticker_update_conn_op_cb(uint32_t status, void *param) * when disconnecting or connection update (race between ticker_update * and ticker_stop calls). */ - LL_ASSERT(status == TICKER_STATUS_SUCCESS || - param == ull_update_mark_get() || - param == ull_disable_mark_get()); + LL_ASSERT_ERR((status == TICKER_STATUS_SUCCESS) || + (param == ull_update_mark_get()) || + (param == ull_disable_mark_get())); } static void ticker_stop_conn_op_cb(uint32_t status, void *param) { void *p; - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); p = ull_update_mark(param); - LL_ASSERT(p == param); + if (p != param) { + LL_ASSERT_DBG(false); + } } static void ticker_start_conn_op_cb(uint32_t status, void *param) { void *p; - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); p = ull_update_unmark(param); - LL_ASSERT(p == param); + if (p != param) { + LL_ASSERT_DBG(false); + } } static void conn_setup_adv_scan_disabled_cb(void *param) @@ -1846,7 +1849,7 @@ static void conn_setup_adv_scan_disabled_cb(void *param) #endif /* CONFIG_BT_PERIPHERAL */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -1857,7 +1860,7 @@ static inline void disable(uint16_t handle) int err; conn = ll_conn_get(handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); err = ull_ticker_stop_with_mark(TICKER_ID_CONN_BASE + handle, conn, &conn->lll); @@ -1910,9 +1913,9 @@ static void conn_cleanup_finalize(struct ll_conn *conn) TICKER_USER_ID_ULL_HIGH, TICKER_ID_CONN_BASE + lll->handle, ticker_stop_op_cb, conn); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY) || - ((void *)conn == ull_disable_mark_get())); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY) || + ((void *)conn == ull_disable_mark_get())); /* Invalidate the connection context */ lll->handle = LLL_HANDLE_INVALID; @@ -1969,7 +1972,7 @@ static void tx_ull_flush(struct ll_conn *conn) memq_link_t *link; link = mem_acquire(&mem_link_tx.free); - LL_ASSERT(link); + LL_ASSERT_ERR(link); /* Enqueue towards LLL */ memq_enqueue(link, tx, &conn->lll.memq_tx.tail); @@ -1988,7 +1991,7 @@ static void ticker_stop_op_cb(uint32_t status, void *param) * when disconnecting (race with ticker_stop), say on HCI Reset. */ if (status != TICKER_STATUS_SUCCESS) { - LL_ASSERT(param == ull_disable_mark_get()); + LL_ASSERT_ERR(param == ull_disable_mark_get()); return; } @@ -1997,7 +2000,7 @@ static void ticker_stop_op_cb(uint32_t status, void *param) mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void conn_disable(void *param) @@ -2018,14 +2021,14 @@ static void conn_disable(void *param) /* Setup disabled callback to be called when ref count * returns to zero. */ - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = mfy.param; hdr->disabled_cb = disabled_cb; /* Trigger LLL disable */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } else { /* No pending LLL events */ disabled_cb(&conn->lll); @@ -2041,7 +2044,7 @@ static void disabled_cb(void *param) mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void tx_lll_flush(void *param) @@ -2067,7 +2070,7 @@ static void tx_lll_flush(void *param) struct lll_tx *tx_buf; idx = MFIFO_ENQUEUE_GET(conn_ack, (void **)&tx_buf); - LL_ASSERT(tx_buf); + LL_ASSERT_ERR(tx_buf); tx_buf->handle = LLL_HANDLE_INVALID; tx_buf->node = tx; @@ -2087,7 +2090,7 @@ static void tx_lll_flush(void *param) * populated before this mayfly function was scheduled. */ rx = (void *)&conn->llcp_terminate.node_rx; - LL_ASSERT(rx->hdr.link); + LL_ASSERT_DBG(rx->hdr.link); link = rx->hdr.link; rx->hdr.link = NULL; @@ -2240,8 +2243,8 @@ static void ull_conn_update_ticker(struct ll_conn *conn, uint32_t ticker_status = ticker_stop_abs(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, ticker_id_conn, ticks_at_expire, ticker_stop_conn_op_cb, (void *)conn); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); ticker_status = ticker_start( TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, ticker_id_conn, ticks_at_expire, ticks_win_offset, HAL_TICKER_US_TO_TICKS(periodic_us), @@ -2261,8 +2264,8 @@ static void ull_conn_update_ticker(struct ll_conn *conn, ull_central_ticker_cb, #endif /* CONFIG_BT_PERIPHERAL && CONFIG_BT_CENTRAL */ conn, ticker_start_conn_op_cb, (void *)conn); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); #if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) /* enable ticker job, if disabled in this function */ @@ -2464,7 +2467,7 @@ void ull_conn_update_parameters(struct ll_conn *conn, uint8_t is_cu_proc, uint8_ #endif /*CONFIG_BT_CENTRAL */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -2826,7 +2829,7 @@ static uint32_t get_ticker_offset(uint8_t ticker_id, uint16_t *lazy) } } - LL_ASSERT(ret_cb == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(ret_cb == TICKER_STATUS_SUCCESS); /* Reduced a tick for negative remainder and return positive remainder * value. @@ -2868,7 +2871,7 @@ static void mfy_past_sender_offset_get(void *param) if (adv_sync_handle != BT_HCI_ADV_HANDLE_INVALID) { const struct ll_adv_sync_set *adv_sync = ull_adv_sync_get(adv_sync_handle); - LL_ASSERT(adv_sync); + LL_ASSERT_DBG(adv_sync); ticker_offset_us = get_ticker_offset(TICKER_ID_ADV_SYNC_BASE + adv_sync_handle, &lazy); @@ -2880,7 +2883,7 @@ static void mfy_past_sender_offset_get(void *param) uint32_t interval_us = sync->interval * PERIODIC_INT_UNIT_US; uint32_t window_widening_event_us; - LL_ASSERT(sync); + LL_ASSERT_DBG(sync); ticker_offset_us = get_ticker_offset(TICKER_ID_SCAN_SYNC_BASE + sync_handle, &lazy); @@ -2924,7 +2927,7 @@ void ull_conn_past_sender_offset_request(struct ll_conn *conn) mfy.param = conn; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } #endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c b/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c index a2865521873..30dcb8419ad 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c @@ -460,7 +460,7 @@ void ull_conn_iso_done(struct node_rx_event_done *done) /* Check all CISes for supervison/establishment timeout */ for (cis_idx = 0; cis_idx < cig->lll.num_cis; cis_idx++) { cis = ll_conn_iso_stream_get_by_group(cig, &handle_iter); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); if (cis->lll.active && cis->lll.handle != LLL_HANDLE_INVALID) { /* CIS was setup and is now expected to be going */ @@ -485,7 +485,7 @@ void ull_conn_iso_done(struct node_rx_event_done *done) if (!cis->event_expire) { struct ll_conn *conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); cis->event_expire = RADIO_CONN_EVENTS( conn->supervision_timeout * 10U * 1000U, @@ -532,7 +532,7 @@ void ull_conn_iso_done(struct node_rx_event_done *done) struct ll_conn *conn; conn = ll_connected_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); ticker_status = ticker_update(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, @@ -543,9 +543,9 @@ void ull_conn_iso_done(struct node_rx_event_done *done) ticker_update_cig_op_cb, cig); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY) || - ((void *)conn == ull_disable_mark_get())); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY) || + ((void *)conn == ull_disable_mark_get())); } } @@ -569,8 +569,8 @@ void ull_conn_iso_cis_stop(struct ll_conn_iso_stream *cis, if (cis->teardown) { /* Teardown already started */ - LL_ASSERT(!cis->released_cb || !cis_released_cb || - (cis->released_cb == cis_released_cb)); + LL_ASSERT_ERR(!cis->released_cb || !cis_released_cb || + (cis->released_cb == cis_released_cb)); if (cis_released_cb) { cis->released_cb = cis_released_cb; @@ -600,15 +600,15 @@ void ull_conn_iso_cis_stop(struct ll_conn_iso_stream *cis, * continue CIS teardown from there. The disabled_cb cannot be * reserved for other use. */ - LL_ASSERT(!hdr->disabled_cb || - (hdr->disabled_cb == cis_disabled_cb)); + LL_ASSERT_ERR(!hdr->disabled_cb || + (hdr->disabled_cb == cis_disabled_cb)); hdr->disabled_param = mfy.param; hdr->disabled_cb = cis_disabled_cb; /* Trigger LLL disable */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } else { /* No pending LLL events */ @@ -707,7 +707,7 @@ void ull_conn_iso_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment CIS event counters */ for (int i = 0; i < cig->lll.num_cis; i++) { cis = ll_conn_iso_stream_get_by_group(cig, &handle_iter); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); /* New CIS may become available by creation prior to the CIG * event in which it has event_count == 0. Don't increment @@ -747,7 +747,7 @@ void ull_conn_iso_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&cig->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* Append timing parameters */ p.ticks_at_expire = ticks_at_expire; @@ -767,7 +767,7 @@ void ull_conn_iso_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, mfy.fp = lll_peripheral_iso_prepare; #else /* !CONFIG_BT_CTLR_CENTRAL_ISO && !CONFIG_BT_CTLR_PERIPHERAL_ISO */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); return; #endif /* !CONFIG_BT_CTLR_CENTRAL_ISO && !CONFIG_BT_CTLR_PERIPHERAL_ISO */ @@ -791,7 +791,7 @@ void ull_conn_iso_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ err = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!err); + LL_ASSERT_ERR(!err); /* Handle ISO Transmit Test for this CIG */ ull_conn_iso_transmit_test_cig_interval(cig->lll.handle, ticks_at_expire); @@ -979,6 +979,17 @@ void ull_conn_iso_start(struct ll_conn *conn, uint16_t cis_handle, lost_cig_events = 1U; cis_offset = cis->offset + iso_interval_us - acl_latency_us; } + /* Correct the cis_offset to next CIG event, if the ACL and CIG overlaps. + * ACL radio event at the instant was skipped and a relative CIS offset at + * the current ACL event has been calculated. But the current ACL event + * is partially overlapping with the other of CISes (not yet established) in + * the CIG event. Hence, lets establish the CIS at the next ISO interval so + * as to have a positive CIG event offset. + */ + if (cis_offset < (cig->sync_delay - cis->sync_delay)) { + cis_offset += iso_interval_us; + lost_cig_events++; + } cis->lll.event_count_prepare += lost_cig_events; @@ -1022,9 +1033,9 @@ void ull_conn_iso_start(struct ll_conn *conn, uint16_t cis_handle, /* FIXME: Handle latency due to skipped ACL events around the * instant to start CIG */ - LL_ASSERT(instant_latency == 0U); + LL_ASSERT_ERR(instant_latency == 0U); } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); return; } @@ -1032,7 +1043,7 @@ void ull_conn_iso_start(struct ll_conn *conn, uint16_t cis_handle, /* Make sure we have time to service first subevent. TODO: Improve * by skipping interval(s) and incrementing event_count. */ - LL_ASSERT(cig_offset_us > 0); + LL_ASSERT_ERR(cig_offset_us > 0); ull_hdr_init(&cig->ull); @@ -1097,8 +1108,8 @@ void ull_conn_iso_start(struct ll_conn *conn, uint16_t cis_handle, TICKER_NULL_LAZY, ticks_slot, ull_conn_iso_ticker_cb, cig, ticker_start_op_cb, NULL); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); /* Set CIG and the first CIS state as active */ cig->state = CIG_STATE_ACTIVE; @@ -1114,7 +1125,7 @@ static void cis_lazy_fill(struct ll_conn_iso_stream *cis) mfy.param = cis; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void mfy_cis_lazy_fill(void *param) @@ -1177,11 +1188,11 @@ static void mfy_cis_lazy_fill(void *param) } success = (ret_cb == TICKER_STATUS_SUCCESS); - LL_ASSERT(success); + LL_ASSERT_ERR(success); - LL_ASSERT((ticks_current == ticks_previous) || retry--); + LL_ASSERT_ERR((ticks_current == ticks_previous) || retry--); - LL_ASSERT(id != TICKER_NULL); + LL_ASSERT_ERR(id != TICKER_NULL); } while (id != ticker_id); /* Set CIS active in already active CIG and any previous laziness in @@ -1203,7 +1214,7 @@ static void ticker_start_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); } static void ticker_update_cig_op_cb(uint32_t status, void *param) @@ -1212,9 +1223,9 @@ static void ticker_update_cig_op_cb(uint32_t status, void *param) * when disconnecting (race between ticker_update and ticker_stop * calls). TODO: Are the race-checks needed? */ - LL_ASSERT(status == TICKER_STATUS_SUCCESS || - param == ull_update_mark_get() || - param == ull_disable_mark_get()); + LL_ASSERT_ERR((status == TICKER_STATUS_SUCCESS) || + (param == ull_update_mark_get()) || + (param == ull_disable_mark_get())); } static void cis_disabled_cb(void *param) @@ -1241,7 +1252,7 @@ static void cis_disabled_cb(void *param) num_cis = cig->lll.num_cis; for (cis_idx = 0; cis_idx < num_cis; cis_idx++) { cis = ll_conn_iso_stream_get_by_group(cig, &handle_iter); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); if (!cis->lll.active && (cis->lll.flush != LLL_CIS_FLUSH_COMPLETE)) { /* CIS is not active and did not just complete LLL flush - skip it */ @@ -1257,7 +1268,7 @@ static void cis_disabled_cb(void *param) ll_iso_stream_released_cb_t cis_released_cb; conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); cis_released_cb = cis->released_cb; cis->released_cb = NULL; @@ -1285,7 +1296,7 @@ static void cis_disabled_cb(void *param) cis->lll.acl_handle = LLL_HANDLE_INVALID; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } /* CIS is no longer active */ @@ -1313,7 +1324,7 @@ static void cis_disabled_cb(void *param) * further enqueuing of TX nodes for terminating CIS. */ node_terminate = ull_pdu_rx_alloc(); - LL_ASSERT(node_terminate); + LL_ASSERT_ERR(node_terminate); node_terminate->hdr.handle = cis->lll.handle; node_terminate->hdr.type = NODE_RX_TYPE_TERMINATE; *((uint8_t *)node_terminate->pdu) = cis->terminate_reason; @@ -1321,7 +1332,7 @@ static void cis_disabled_cb(void *param) ll_rx_put_sched(node_terminate->hdr.link, node_terminate); } else { conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); /* CIS was not established - complete the procedure with error */ if (ull_cp_cc_awaiting_established(conn)) { @@ -1369,8 +1380,8 @@ static void cis_disabled_cb(void *param) ticker_stop_op_cb, cig); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); } } @@ -1395,7 +1406,7 @@ static void cis_tx_lll_flush(void *param) memq_link_t *link; cis = ll_conn_iso_stream_get_by_group(cig, &handle_iter); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); lll = &cis->lll; @@ -1423,9 +1434,9 @@ static void cis_tx_lll_flush(void *param) (void **)&tx); } - LL_ASSERT(!lll->link_tx_free); + LL_ASSERT_DBG(!lll->link_tx_free); link = memq_deinit(&lll->memq_tx.head, &lll->memq_tx.tail); - LL_ASSERT(link); + LL_ASSERT_DBG(link); lll->link_tx_free = link; lll->flush = LLL_CIS_FLUSH_COMPLETE; @@ -1444,13 +1455,13 @@ static void ticker_stop_op_cb(uint32_t status, void *param) uint32_t ret; /* Assert if race between thread and ULL */ - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); /* Check if any pending LLL events that need to be aborted */ mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void cig_disable(void *param) @@ -1471,14 +1482,14 @@ static void cig_disable(void *param) /* Setup disabled callback to be called when ref count * returns to zero. */ - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = mfy.param; hdr->disabled_cb = cig_disabled_cb; /* Trigger LLL disable */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } else { /* No pending LLL events */ cig_disabled_cb(&cig->lll); @@ -1527,7 +1538,7 @@ void ull_conn_iso_transmit_test_cig_interval(uint16_t handle, uint32_t ticks_at_ uint8_t tx_sdu_count; cig = ll_conn_iso_group_get(handle); - LL_ASSERT(cig); + LL_ASSERT_DBG(cig); handle_iter = UINT16_MAX; @@ -1540,7 +1551,7 @@ void ull_conn_iso_transmit_test_cig_interval(uint16_t handle, uint32_t ticks_at_ sdu_interval = cig->c_sdu_interval; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); return; } @@ -1550,7 +1561,7 @@ void ull_conn_iso_transmit_test_cig_interval(uint16_t handle, uint32_t ticks_at_ /* Handle ISO Transmit Test for all active CISes in the group */ for (uint8_t i = 0; i < cig->lll.num_cis; i++) { cis = ll_conn_iso_stream_get_by_group(cig, &handle_iter); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); if (!cis->hdr.test_mode.tx.enabled || cis->lll.handle == LLL_HANDLE_INVALID) { continue; diff --git a/subsys/bluetooth/controller/ll_sw/ull_df.c b/subsys/bluetooth/controller/ll_sw/ull_df.c index ba04dac1648..ac26c11cd72 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_df.c +++ b/subsys/bluetooth/controller/ll_sw/ull_df.c @@ -451,7 +451,7 @@ uint8_t ll_df_set_cl_iq_sampling_enable(uint16_t handle, #if defined(CONFIG_BT_CTLR_DF_DEBUG_ENABLE) /* When CTE is enabled there should be no iq report allocated */ - IF_SINGLE_ADV_SYNC_SET(LL_ASSERT(iq_report_alloc_count == 0)); + IF_SINGLE_ADV_SYNC_SET(LL_ASSERT_DBG(iq_report_alloc_count == 0)); #endif /* CONFIG_BT_CTLR_DF_DEBUG_ENABLE */ /* Enable of already enabled CTE updates AoA configuration */ @@ -510,7 +510,7 @@ uint8_t ll_df_set_cl_iq_sampling_enable(uint16_t handle, * Periodic sync lost event also disables the CTE sampling. */ err = ull_sync_slot_update(sync, slot_plus_us, slot_minus_us); - LL_ASSERT(err == 0 || err == -ENOENT); + LL_ASSERT_DBG(err == 0 || err == -ENOENT); } return 0; @@ -580,7 +580,7 @@ void ull_df_iq_report_mem_release(struct node_rx_pdu *rx) void ull_iq_report_link_inc_quota(int8_t delta) { - LL_ASSERT(delta <= 0 || mem_link_iq_report_quota_pdu < (IQ_REPORT_CNT)); + LL_ASSERT_DBG(delta <= 0 || mem_link_iq_report_quota_pdu < (IQ_REPORT_CNT)); mem_link_iq_report_quota_pdu += delta; } diff --git a/subsys/bluetooth/controller/ll_sw/ull_filter.c b/subsys/bluetooth/controller/ll_sw/ull_filter.c index bff2a063367..8466e20731e 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_filter.c +++ b/subsys/bluetooth/controller/ll_sw/ull_filter.c @@ -277,8 +277,8 @@ uint8_t ll_fal_remove(bt_addr_le_t *addr) #if defined(CONFIG_BT_CTLR_PRIVACY) void ll_rl_id_addr_get(uint8_t rl_idx, uint8_t *id_addr_type, uint8_t *id_addr) { - LL_ASSERT(rl_idx < CONFIG_BT_CTLR_RL_SIZE); - LL_ASSERT(rl[rl_idx].taken); + LL_ASSERT_DBG(rl_idx < CONFIG_BT_CTLR_RL_SIZE); + LL_ASSERT_DBG(rl[rl_idx].taken); *id_addr_type = rl[rl_idx].id_addr_type; (void)memcpy(id_addr, rl[rl_idx].id_addr.val, BDADDR_SIZE); @@ -607,7 +607,7 @@ bool ull_filter_ull_pal_listed(const uint8_t rl_idx, uint8_t *const addr_type, return false; } - LL_ASSERT(rl[rl_idx].taken); + LL_ASSERT_DBG(rl[rl_idx].taken); if (rl[rl_idx].pal) { uint8_t pal_idx = rl[rl_idx].pal - 1; @@ -663,7 +663,7 @@ struct lll_filter *ull_filter_lll_get(bool filter) } return &rl_filter; #else - LL_ASSERT(filter); + LL_ASSERT_DBG(filter); return &fal_filter; #endif } @@ -752,7 +752,7 @@ void ull_filter_rpa_update(bool timeout) sys_memcpy_swap(irk, peer_irks[rl[i].pirk_idx], IRK_SIZE); err = bt_rpa_create(irk, &rl[i].peer_rpa); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); #if defined(CONFIG_BT_CTLR_SW_DEFERRED_PRIVACY) /* a new key was added, * invalidate the known/unknown peer RPA cache @@ -766,7 +766,7 @@ void ull_filter_rpa_update(bool timeout) bt_addr_t rpa; err = bt_rpa_create(rl[i].local_irk, &rpa); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* pointer read/write assumed to be atomic * so that if ISR fires the local_rpa pointer * will always point to a valid full RPA @@ -805,7 +805,7 @@ const uint8_t *ull_filter_adva_get(uint8_t rl_idx) { /* AdvA */ if (rl_idx < ARRAY_SIZE(rl) && rl[rl_idx].lirk) { - LL_ASSERT(rl[rl_idx].rpas_ready); + LL_ASSERT_DBG(rl[rl_idx].rpas_ready); return rl[rl_idx].local_rpa->val; } @@ -884,13 +884,13 @@ uint8_t ull_filter_lll_rl_idx(bool filter, uint8_t devmatch_id) uint8_t i; if (filter) { - LL_ASSERT(devmatch_id < ARRAY_SIZE(fal)); - LL_ASSERT(fal[devmatch_id].taken); + LL_ASSERT_DBG(devmatch_id < ARRAY_SIZE(fal)); + LL_ASSERT_DBG(fal[devmatch_id].taken); i = fal[devmatch_id].rl_idx; } else { - LL_ASSERT(devmatch_id < ARRAY_SIZE(rl)); + LL_ASSERT_DBG(devmatch_id < ARRAY_SIZE(rl)); i = devmatch_id; - LL_ASSERT(rl[i].taken); + LL_ASSERT_DBG(rl[i].taken); } return i; @@ -900,10 +900,10 @@ uint8_t ull_filter_lll_rl_irk_idx(uint8_t irkmatch_id) { uint8_t i; - LL_ASSERT(irkmatch_id < peer_irk_count); + LL_ASSERT_DBG(irkmatch_id < peer_irk_count); i = peer_irk_rl_ids[irkmatch_id]; - LL_ASSERT(i < CONFIG_BT_CTLR_RL_SIZE); - LL_ASSERT(rl[i].taken); + LL_ASSERT_DBG(i < CONFIG_BT_CTLR_RL_SIZE); + LL_ASSERT_DBG(rl[i].taken); return i; } @@ -914,7 +914,7 @@ bool ull_filter_lll_irk_in_fal(uint8_t rl_idx) return false; } - LL_ASSERT(rl[rl_idx].taken); + LL_ASSERT_DBG(rl[rl_idx].taken); return rl[rl_idx].fal; } @@ -938,8 +938,8 @@ bool ull_filter_lll_rl_idx_allowed(uint8_t irkmatch_ok, uint8_t rl_idx) return true; } - LL_ASSERT(rl_idx < CONFIG_BT_CTLR_RL_SIZE); - LL_ASSERT(rl[rl_idx].taken); + LL_ASSERT_DBG(rl_idx < CONFIG_BT_CTLR_RL_SIZE); + LL_ASSERT_DBG(rl[rl_idx].taken); return !rl[rl_idx].pirk || rl[rl_idx].dev; } diff --git a/subsys/bluetooth/controller/ll_sw/ull_iso.c b/subsys/bluetooth/controller/ll_sw/ull_iso.c index 31a51a8bc14..c32aaced207 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_iso.c @@ -662,7 +662,7 @@ static isoal_status_t ll_iso_test_sdu_alloc(const struct isoal_sink *sink_ctx, struct ll_conn_iso_stream *cis; cis = ll_iso_stream_connected_get(sink_ctx->session.handle); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); /* For unframed, SDU counter is the payload number */ cis->hdr.test_mode.rx.sdu_counter = @@ -675,7 +675,7 @@ static isoal_status_t ll_iso_test_sdu_alloc(const struct isoal_sink *sink_ctx, stream_handle = LL_BIS_SYNC_IDX_FROM_HANDLE(handle); sync_stream = ull_sync_iso_stream_get(stream_handle); - LL_ASSERT(sync_stream); + LL_ASSERT_DBG(sync_stream); sync_stream->test_mode->sdu_counter = (uint32_t)valid_pdu->meta->payload_number; @@ -709,7 +709,7 @@ static isoal_status_t ll_iso_test_sdu_emit(const struct isoal_sink * struct ll_conn_iso_stream *cis; cis = ll_iso_stream_connected_get(sink_ctx->session.handle); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); test_mode_rx = &cis->hdr.test_mode.rx; max_sdu = cis->c_max_sdu; @@ -721,7 +721,7 @@ static isoal_status_t ll_iso_test_sdu_emit(const struct isoal_sink * stream_handle = LL_BIS_SYNC_IDX_FROM_HANDLE(handle); sync_stream = ull_sync_iso_stream_get(stream_handle); - LL_ASSERT(sync_stream); + LL_ASSERT_DBG(sync_stream); sync_iso = ull_sync_iso_by_stream_get(stream_handle); @@ -790,7 +790,7 @@ static isoal_status_t ll_iso_test_sdu_emit(const struct isoal_sink * break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); return ISOAL_STATUS_ERR_SDU_EMIT; } break; @@ -1105,7 +1105,7 @@ void ll_iso_transmit_test_send_sdu(uint16_t handle, uint32_t ticks_at_expire) uint8_t rand_8; cis = ll_iso_stream_connected_get(handle); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); if (!cis->hdr.test_mode.tx.enabled) { /* Transmit Test Mode not enabled */ @@ -1130,12 +1130,12 @@ void ll_iso_transmit_test_send_sdu(uint16_t handle, uint32_t ticks_at_expire) break; case BT_HCI_ISO_TEST_MAX_SIZE_SDU: - LL_ASSERT(max_sdu > ISO_TEST_PACKET_COUNTER_SIZE); + LL_ASSERT_DBG(max_sdu > ISO_TEST_PACKET_COUNTER_SIZE); remaining_tx = max_sdu; break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); return; } @@ -1206,7 +1206,7 @@ void ll_iso_transmit_test_send_sdu(uint16_t handle, uint32_t ticks_at_expire) /* Send to ISOAL */ err = isoal_tx_sdu_fragment(source_handle, &sdu); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); remaining_tx -= sdu.size; @@ -1222,7 +1222,7 @@ void ll_iso_transmit_test_send_sdu(uint16_t handle, uint32_t ticks_at_expire) } else if (IS_ADV_ISO_HANDLE(handle)) { /* FIXME: Implement for broadcaster */ } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } #endif /* CONFIG_BT_CTLR_CONN_ISO */ @@ -1503,7 +1503,7 @@ void ull_iso_lll_ack_enqueue(uint16_t handle, struct node_tx_iso *node_tx) ll_tx_ack_put(handle, (void *)node_tx); ll_rx_sched(); } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -1538,7 +1538,7 @@ void ull_iso_lll_event_prepare(uint16_t handle, uint64_t event_count) isoal_tx_event_prepare(dp->source_hdl, event_count); } } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } #endif /* CONFIG_BT_CTLR_ADV_ISO || CONFIG_BT_CTLR_CONN_ISO */ @@ -1692,7 +1692,7 @@ static void iso_rx_demux(void *param) const isoal_status_t err = isoal_rx_pdu_recombine(dp->sink_hdl, &pckt_meta); - LL_ASSERT(err == ISOAL_STATUS_OK); /* TODO handle err */ + LL_ASSERT_ERR(err == ISOAL_STATUS_OK); /* TODO handle err */ } #endif /* CONFIG_BT_CTLR_CONN_ISO || CONFIG_BT_CTLR_SYNC_ISO */ @@ -1702,7 +1702,7 @@ static void iso_rx_demux(void *param) break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -1749,7 +1749,7 @@ void ll_iso_rx_dequeue(void) link = memq_dequeue(memq_ll_iso_rx.tail, &memq_ll_iso_rx.head, (void **)&rx); - LL_ASSERT(link); + LL_ASSERT_DBG(link); mem_release(link, &mem_link_iso_rx.free); @@ -1758,7 +1758,7 @@ void ll_iso_rx_dequeue(void) case NODE_RX_TYPE_ISO_PDU: break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -1825,7 +1825,7 @@ static isoal_status_t ll_iso_pdu_alloc(struct isoal_pdu_buffer *pdu_buffer) /* TODO: Report overflow to HCI and remove assert * data_buf_overflow(evt, BT_OVERFLOW_LINK_ISO) */ - LL_ASSERT(0); + LL_ASSERT_ERR(0); return ISOAL_STATUS_ERR_PDU_ALLOC; } @@ -1860,9 +1860,9 @@ static isoal_status_t ll_iso_pdu_write(struct isoal_pdu_buffer *pdu_buffer, ARG_UNUSED(pdu_offset); ARG_UNUSED(consume_len); - LL_ASSERT(pdu_buffer); - LL_ASSERT(pdu_buffer->pdu); - LL_ASSERT(sdu_payload); + LL_ASSERT_DBG(pdu_buffer); + LL_ASSERT_DBG(pdu_buffer->pdu); + LL_ASSERT_DBG(sdu_payload); if ((pdu_offset + consume_len) > pdu_buffer->size) { /* Exceeded PDU buffer */ @@ -1887,7 +1887,7 @@ static isoal_status_t ll_iso_pdu_emit(struct node_tx_iso *node_tx, memq_link_t *link; link = mem_acquire(&mem_link_iso_tx.free); - LL_ASSERT(link); + LL_ASSERT_ERR(link); if (ll_iso_tx_mem_enqueue(handle, node_tx, link)) { return ISOAL_STATUS_ERR_PDU_EMIT; @@ -1947,7 +1947,7 @@ static int init_reset(void) /* Acquire a link to initialize ull rx memq */ link = mem_acquire(&mem_link_iso_rx.free); - LL_ASSERT(link); + LL_ASSERT_DBG(link); #if defined(CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH) /* Initialize ull rx memq */ @@ -1956,7 +1956,7 @@ static int init_reset(void) /* Acquire a link to initialize ll_iso_rx memq */ link = mem_acquire(&mem_link_iso_rx.free); - LL_ASSERT(link); + LL_ASSERT_DBG(link); /* Initialize ll_iso_rx memq */ MEMQ_INIT(ll_iso_rx, link); @@ -2012,7 +2012,7 @@ void ull_iso_resume_ticker_start(struct lll_event *resume_event, ticker_id = TICKER_ID_SCAN_SYNC_ISO_RESUME_BASE + group_handle; #endif /* CONFIG_BT_CTLR_SYNC_ISO */ } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } if (role == BT_HCI_ROLE_PERIPHERAL) { @@ -2031,7 +2031,7 @@ void ull_iso_resume_ticker_start(struct lll_event *resume_event, cis = ll_conn_iso_stream_get(stream_handle); conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); phy = conn->lll.phy_rx; #endif /* CONFIG_BT_CTLR_CONN_ISO */ @@ -2045,7 +2045,7 @@ void ull_iso_resume_ticker_start(struct lll_event *resume_event, phy = sync_iso->lll.phy; #endif /* CONFIG_BT_CTLR_SYNC_ISO */ } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); } resume_delay_us += @@ -2058,7 +2058,7 @@ void ull_iso_resume_ticker_start(struct lll_event *resume_event, } resume_offset_us = (int32_t)(resume_timeout - resume_delay_us); - LL_ASSERT(resume_offset_us >= 0); + LL_ASSERT_DBG(resume_offset_us >= 0); /* Setup resume timeout as single-shot */ ret = ticker_start(TICKER_INSTANCE_ID_CTLR, @@ -2073,15 +2073,15 @@ void ull_iso_resume_ticker_start(struct lll_event *resume_event, ticker_resume_cb, resume_event, ticker_resume_op_cb, NULL); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } static void ticker_resume_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); } static void ticker_resume_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, @@ -2094,7 +2094,7 @@ static void ticker_resume_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, uint32_t ret; ARG_UNUSED(ticks_drift); - LL_ASSERT(lazy == 0); + LL_ASSERT_DBG(lazy == 0); resume_event = param; @@ -2109,6 +2109,6 @@ static void ticker_resume_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } #endif /* CONFIG_BT_CTLR_CONN_ISO || CONFIG_BT_CTLR_SYNC_ISO */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp.c b/subsys/bluetooth/controller/ll_sw/ull_llcp.c index 0f9877ecc84..f23b7f388bc 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp.c @@ -109,7 +109,7 @@ static struct proc_ctx *proc_ctx_acquire(struct llcp_mem_pool *owner) void llcp_proc_ctx_release(struct proc_ctx *ctx) { /* We need to have an owner otherwise the memory allocated would leak */ - LL_ASSERT(ctx->owner); + LL_ASSERT_DBG(ctx->owner); /* Release the memory back to the owner */ mem_release(ctx, &ctx->owner->free); @@ -297,7 +297,7 @@ void llcp_tx_resume_data(struct ll_conn *conn, enum llcp_tx_q_pause_data_mask re void llcp_rx_node_retain(struct proc_ctx *ctx) { - LL_ASSERT(ctx->node_ref.rx); + LL_ASSERT_DBG(ctx->node_ref.rx); /* Only retain if not already retained */ if (ctx->node_ref.rx->hdr.type != NODE_RX_TYPE_RETAIN) { @@ -311,7 +311,7 @@ void llcp_rx_node_retain(struct proc_ctx *ctx) void llcp_rx_node_release(struct proc_ctx *ctx) { - LL_ASSERT(ctx->node_ref.rx); + LL_ASSERT_DBG(ctx->node_ref.rx); /* Only release if retained */ if (ctx->node_ref.rx->hdr.type == NODE_RX_TYPE_RETAIN) { @@ -472,7 +472,7 @@ void ull_cp_release_tx(struct ll_conn *conn, struct node_tx *tx) { #if defined(LLCP_TX_CTRL_BUF_QUEUE_ENABLE) if (conn) { - LL_ASSERT(conn->llcp.tx_buffer_alloc > 0); + LL_ASSERT_DBG(conn->llcp.tx_buffer_alloc > 0); if (conn->llcp.tx_buffer_alloc > CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM) { common_tx_buffer_alloc--; } @@ -511,7 +511,7 @@ int ull_cp_prt_elapse(struct ll_conn *conn, uint16_t elapsed_event, uint8_t *err struct proc_ctx *ctx; ctx = llcp_lr_peek(conn); - LL_ASSERT(ctx); + LL_ASSERT_DBG(ctx); if (ctx->proc == PROC_TERMINATE) { /* Active procedure is ACL Termination */ @@ -1026,7 +1026,7 @@ uint8_t ull_cp_conn_update(struct ll_conn *conn, uint16_t interval_min, uint16_t } #endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */ } else { - LL_ASSERT(0); /* Unknown procedure */ + LL_ASSERT_DBG(0); /* Unknown procedure */ } llcp_lr_enqueue(conn, ctx); @@ -1051,7 +1051,7 @@ uint8_t ull_cp_periodic_sync(struct ll_conn *conn, struct ll_sync_set *sync, uint8_t phy; /* Exactly one of the sync and adv_sync pointers should be non-null */ - LL_ASSERT((!adv_sync && sync) || (adv_sync && !sync)); + LL_ASSERT_DBG((!adv_sync && sync) || (adv_sync && !sync)); if (!feature_peer_periodic_sync_recv(conn)) { return BT_HCI_ERR_UNSUPP_REMOTE_FEATURE; @@ -1080,7 +1080,7 @@ uint8_t ull_cp_periodic_sync(struct ll_conn *conn, struct ll_sync_set *sync, rl_idx = ull_filter_rl_find(addr_type, sync->peer_id_addr, NULL); /* A resolved address must be present in the resolve list */ - LL_ASSERT(rl_idx < ll_rl_size_get()); + LL_ASSERT_DBG(rl_idx < ll_rl_size_get()); /* Generate RPAs if required */ ull_filter_rpa_update(false); @@ -1999,7 +1999,7 @@ void ull_cp_rx(struct ll_conn *conn, memq_link_t *link, struct node_rx_pdu *rx) */ /* Process PDU as a new remote request */ - LL_ASSERT(pdu_valid); + LL_ASSERT_DBG(pdu_valid); llcp_rr_new(conn, link, rx, true); } else { /* Local active procedure diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c index 6e12571d88c..e70d6e664fc 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c @@ -65,7 +65,7 @@ static void cc_ntf_established(struct ll_conn *conn, struct proc_ctx *ctx) /* Allocate ntf node */ ntf = ctx->node_ref.rx; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); ctx->node_ref.rx = NULL; piggy_back = (ntf->hdr.type != NODE_RX_TYPE_RETAIN); @@ -146,7 +146,7 @@ static void llcp_rp_cc_tx_rsp(struct ll_conn *conn, struct proc_ctx *ctx) /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; conn_event_count = ctx->data.cis_create.conn_event_count; @@ -201,7 +201,7 @@ static void llcp_rp_cc_tx_reject(struct ll_conn *conn, struct proc_ctx *ctx, uin /* Allocate tx node */ tx = ctx->node_ref.tx; - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); ctx->node_ref.tx = NULL; pdu = (struct pdu_data *)tx->pdu; @@ -221,7 +221,7 @@ static void rp_cc_ntf_create(struct ll_conn *conn, struct proc_ctx *ctx) ntf = ctx->node_ref.rx; ctx->node_ref.rx = NULL; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); ntf->hdr.type = NODE_RX_TYPE_CIS_REQUEST; ntf->hdr.handle = conn->lll.handle; @@ -490,7 +490,7 @@ static void rp_cc_state_wait_rx_cis_ind(struct ll_conn *conn, struct proc_ctx *c } /* If we get to here the CIG_ID referred in req/acquire has become void/invalid */ /* This cannot happen unless the universe has started to deflate */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); case RP_CC_EVT_REJECT: /* Handle CIS creation rejection */ break; @@ -656,7 +656,7 @@ static void rp_cc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_ break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -767,7 +767,7 @@ static void lp_cc_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -781,7 +781,7 @@ static void lp_cc_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) break; default: /* Unknown opcode */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -929,7 +929,7 @@ static void lp_cc_st_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t ev break; default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; @@ -971,7 +971,7 @@ static void cc_prepare_cis_ind(struct ll_conn *conn, struct proc_ctx *ctx) &ctx->data.cis_create.cis_offset_max, &ctx->data.cis_create.conn_event_count, ctx->data.cis_create.aa); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); ctx->state = LP_CC_STATE_WAIT_INSTANT; ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_UNUSED; @@ -1054,7 +1054,7 @@ static void lp_cc_st_wait_rx_cis_rsp_cancel(struct ll_conn *conn, struct proc_ct case LP_CC_EVT_CIS_RSP: /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -1177,7 +1177,7 @@ static void lp_cc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_ break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_chmu.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_chmu.c index 04b51ce7994..772aba812d1 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_chmu.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_chmu.c @@ -89,7 +89,7 @@ static void lp_chmu_tx(struct ll_conn *conn, struct proc_ctx *ctx) /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -180,7 +180,7 @@ static void lp_chmu_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -293,7 +293,7 @@ static void rp_chmu_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c index b0e28e124bd..84098f1b149 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c @@ -159,7 +159,7 @@ static void lp_comm_tx(struct ll_conn *conn, struct proc_ctx *ctx) /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -218,7 +218,7 @@ static void lp_comm_tx(struct ll_conn *conn, struct proc_ctx *ctx) #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } ctx->tx_opcode = pdu->llctrl.opcode; @@ -255,7 +255,7 @@ static void lp_comm_ntf_feature_exchange(struct ll_conn *conn, struct proc_ctx * break; default: /* Unexpected PDU, should not get through, so ASSERT */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -268,7 +268,7 @@ static void lp_comm_ntf_version_ind(struct ll_conn *conn, struct proc_ctx *ctx, break; default: /* Unexpected PDU, should not get through, so ASSERT */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -305,7 +305,7 @@ static void lp_comm_ntf_cte_req(struct ll_conn *conn, struct proc_ctx *ctx, stru break; default: /* Unexpected PDU, should not get through, so ASSERT */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -393,7 +393,7 @@ static void lp_comm_ntf(struct ll_conn *conn, struct proc_ctx *ctx) if (!ntf) { /* Allocate ntf node */ ntf = llcp_ntf_alloc(); - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); piggy_back = 0U; } @@ -424,7 +424,7 @@ static void lp_comm_ntf(struct ll_conn *conn, struct proc_ctx *ctx) break; #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -585,7 +585,7 @@ static void lp_comm_complete(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -716,7 +716,7 @@ static void lp_comm_send_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -819,7 +819,7 @@ static void lp_comm_rx_decode(struct ll_conn *conn, struct proc_ctx *ctx, struct break; case PDU_DATA_LLCTRL_TYPE_TERMINATE_IND: /* No response expected */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; #if defined(CONFIG_BT_CTLR_DATA_LENGTH) case PDU_DATA_LLCTRL_TYPE_LENGTH_RSP: @@ -844,7 +844,7 @@ static void lp_comm_rx_decode(struct ll_conn *conn, struct proc_ctx *ctx, struct break; default: /* Unknown opcode */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -889,7 +889,7 @@ static void lp_comm_st_wait_ntf_avail(struct ll_conn *conn, struct proc_ctx *ctx * out of the ones handled in ull_llcp_common should end up waiting for * non-piggy-back'ed NTF */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; @@ -919,7 +919,7 @@ static void lp_comm_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -1034,7 +1034,7 @@ static void rp_comm_rx_decode(struct ll_conn *conn, struct proc_ctx *ctx, struct #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ default: /* Unknown opcode */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -1045,7 +1045,7 @@ static void rp_comm_tx(struct ll_conn *conn, struct proc_ctx *ctx) /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -1115,7 +1115,7 @@ static void rp_comm_tx(struct ll_conn *conn, struct proc_ctx *ctx) #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } ctx->tx_opcode = pdu->llctrl.opcode; @@ -1147,10 +1147,10 @@ static void rp_comm_ntf(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t gene /* Allocate ntf node */ ntf = ctx->node_ref.rx; ctx->node_ref.rx = NULL; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); /* This should be an 'old' RX node, so put/sched when done */ - LL_ASSERT(ntf->hdr.type == NODE_RX_TYPE_RETAIN); + LL_ASSERT_DBG(ntf->hdr.type == NODE_RX_TYPE_RETAIN); /* And release memory if no NTF to be generated */ ntf->hdr.type = NODE_RX_TYPE_RELEASE; @@ -1159,7 +1159,7 @@ static void rp_comm_ntf(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t gene ntf->hdr.type = NODE_RX_TYPE_DC_PDU; ntf->hdr.handle = conn->lll.handle; pdu = (struct pdu_data *)ntf->pdu; - LL_ASSERT(ctx->proc == PROC_DATA_LENGTH_UPDATE); + LL_ASSERT_DBG(ctx->proc == PROC_DATA_LENGTH_UPDATE); llcp_ntf_encode_length_change(conn, pdu); } @@ -1291,7 +1291,7 @@ static void rp_comm_send_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -1313,7 +1313,7 @@ static void rp_comm_st_postpone_terminate(struct ll_conn *conn, struct proc_ctx { switch (evt) { case RP_COMMON_EVT_RUN: - LL_ASSERT(ctx->proc == PROC_TERMINATE); + LL_ASSERT_DBG(ctx->proc == PROC_TERMINATE); /* Note: now we terminate, mimicking legacy LLCP behaviour * A check should be added to ensure that the ack of the terminate_ind was @@ -1415,7 +1415,7 @@ static void rp_comm_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c index 5fc5a261640..d1a91c8d673 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c @@ -260,7 +260,7 @@ static void cu_ntf(struct ll_conn *conn, struct proc_ctx *ctx) /* Allocate ntf node */ ntf = ctx->node_ref.rx; ctx->node_ref.rx = NULL; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); piggy_back = (ntf->hdr.type != NODE_RX_TYPE_RETAIN); @@ -300,7 +300,7 @@ static void lp_cu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) if (!tx) { /* Allocate tx node if non pre-alloc'ed */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); } pdu = (struct pdu_data *)tx->pdu; @@ -323,7 +323,7 @@ static void lp_cu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) #endif /* CONFIG_BT_CENTRAL */ default: /* Unknown opcode */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -408,7 +408,7 @@ static void lp_cu_send_conn_param_req(struct ll_conn *conn, struct proc_ctx *ctx #endif /* CONFIG_BT_PERIPHERAL */ default: /* Unknown role */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -491,7 +491,7 @@ static void lp_cu_st_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t ev #endif /* CONFIG_BT_CENTRAL */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; @@ -761,7 +761,7 @@ static void lp_cu_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_ break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -815,7 +815,7 @@ static void rp_cu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) if (!tx) { /* Allocate tx node if non pre-alloc'ed */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); } pdu = (struct pdu_data *)tx->pdu; @@ -841,7 +841,7 @@ static void rp_cu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) break; default: /* Unknown opcode */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -869,7 +869,7 @@ static void rp_cu_conn_param_req_ntf(struct ll_conn *conn, struct proc_ctx *ctx) /* Allocate ntf node */ ntf = ctx->node_ref.rx; ctx->node_ref.rx = NULL; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); piggy_back = (ntf->hdr.type != NODE_RX_TYPE_RETAIN); @@ -903,7 +903,7 @@ static void rp_cu_send_conn_update_ind_finalize(struct ll_conn *conn, struct pro uint8_t evt, void *param) { /* Central role path, should not get here with !=NULL rx-node reference */ - LL_ASSERT(ctx->node_ref.rx == NULL); + LL_ASSERT_DBG(ctx->node_ref.rx == NULL); /* We pre-alloc NTF node */ ctx->node_ref.rx = llcp_ntf_alloc(); @@ -1015,7 +1015,7 @@ static void rp_cu_st_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t ev break; default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } break; @@ -1162,7 +1162,7 @@ static void rp_cu_state_wait_conn_param_req_reply_continue(struct ll_conn *conn, } } else { /* Unknown role */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } break; default: @@ -1313,7 +1313,7 @@ static void rp_cu_st_wait_rx_conn_update_ind(struct ll_conn *conn, struct proc_c break; default: /* Unknown role */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } default: /* Ignore other evts */ @@ -1382,7 +1382,7 @@ static void rp_cu_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_ break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_enc.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_enc.c index 392f37963ae..13fae31f9e5 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_enc.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_enc.c @@ -187,7 +187,7 @@ static struct node_tx *llcp_lp_enc_tx(struct ll_conn *conn, struct proc_ctx *ctx /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -206,7 +206,7 @@ static struct node_tx *llcp_lp_enc_tx(struct ll_conn *conn, struct proc_ctx *ctx llcp_pdu_encode_pause_enc_rsp(pdu); break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); } ctx->tx_opcode = pdu->llctrl.opcode; @@ -228,7 +228,7 @@ static void lp_enc_ntf(struct ll_conn *conn, struct proc_ctx *ctx) /* Piggy-back on RX node */ ntf = ctx->node_ref.rx; ctx->node_ref.rx = NULL; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); ntf->hdr.type = NODE_RX_TYPE_DC_PDU; ntf->hdr.handle = conn->lll.handle; @@ -244,7 +244,7 @@ static void lp_enc_ntf(struct ll_conn *conn, struct proc_ctx *ctx) ntf->hdr.type = NODE_RX_TYPE_ENC_REFRESH; } else { /* Should never happen */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } else { llcp_pdu_encode_reject_ind(pdu, ctx->data.enc.error); @@ -379,7 +379,7 @@ static inline uint8_t reject_error_code(struct pdu_data *pdu) #endif /* CONFIG_BT_CTLR_EXT_REJ_IND */ } else { /* Called with an invalid PDU */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); /* Keep compiler happy */ error = BT_HCI_ERR_UNSPECIFIED; @@ -639,7 +639,7 @@ static void lp_enc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8 break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -705,7 +705,7 @@ static struct node_tx *llcp_rp_enc_tx(struct ll_conn *conn, struct proc_ctx *ctx /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -732,7 +732,7 @@ static struct node_tx *llcp_rp_enc_tx(struct ll_conn *conn, struct proc_ctx *ctx } break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); } ctx->tx_opcode = pdu->llctrl.opcode; @@ -755,7 +755,7 @@ static void rp_enc_ntf_ltk(struct ll_conn *conn, struct proc_ctx *ctx) /* Piggy-back on RX node */ ntf = ctx->node_ref.rx; ctx->node_ref.rx = NULL; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); piggy_back = (ntf->hdr.type != NODE_RX_TYPE_RETAIN); @@ -780,7 +780,7 @@ static void rp_enc_ntf(struct ll_conn *conn, struct proc_ctx *ctx) /* Piggy-back on RX node */ ntf = ctx->node_ref.rx; ctx->node_ref.rx = NULL; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); ntf->hdr.type = NODE_RX_TYPE_DC_PDU; ntf->hdr.handle = conn->lll.handle; @@ -795,7 +795,7 @@ static void rp_enc_ntf(struct ll_conn *conn, struct proc_ctx *ctx) ntf->hdr.type = NODE_RX_TYPE_ENC_REFRESH; } else { /* Should never happen */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -884,7 +884,7 @@ static void rp_enc_send_reject_ind(struct ll_conn *conn, struct proc_ctx *ctx, u */ } else { /* Shouldn't happen */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } } @@ -1232,7 +1232,7 @@ static void rp_enc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8 break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c index 8c97bcdfb5f..812d84955aa 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c @@ -79,13 +79,13 @@ void llcp_lr_check_done(struct ll_conn *conn, struct proc_ctx *ctx) struct proc_ctx *ctx_header; ctx_header = llcp_lr_peek(conn); - LL_ASSERT(ctx_header == ctx); + LL_ASSERT_DBG(ctx_header == ctx); /* If we have a node rx it must not be marked RETAIN as * the memory referenced would leak */ - LL_ASSERT(ctx->node_ref.rx == NULL || - ctx->node_ref.rx->hdr.type != NODE_RX_TYPE_RETAIN); + LL_ASSERT_DBG(ctx->node_ref.rx == NULL || + ctx->node_ref.rx->hdr.type != NODE_RX_TYPE_RETAIN); lr_dequeue(conn); @@ -326,7 +326,7 @@ void llcp_lr_rx(struct ll_conn *conn, struct proc_ctx *ctx, memq_link_t *link, #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -475,7 +475,7 @@ static void lr_act_run(struct ll_conn *conn) #endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -487,7 +487,7 @@ static void lr_act_complete(struct ll_conn *conn) struct proc_ctx *ctx; ctx = llcp_lr_peek(conn); - LL_ASSERT(ctx != NULL); + LL_ASSERT_DBG(ctx != NULL); /* Stop procedure response timeout timer */ llcp_lr_prt_stop(conn); @@ -617,7 +617,7 @@ static void lr_execute_fsm(struct ll_conn *conn, uint8_t evt, void *param) break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c index 8b8f88147e0..53e16b9f52a 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c @@ -326,7 +326,7 @@ static void rp_past_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint #endif /* CONFIG_BT_CTLR_SW_DEFERRED_PRIVACY */ default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } @@ -400,7 +400,7 @@ static void lp_past_tx(struct ll_conn *conn, struct proc_ctx *ctx) /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -563,7 +563,7 @@ static void lp_past_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c index a9b48be2702..9e8ebaf7a40 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c @@ -379,7 +379,7 @@ static void lp_pu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, vo struct node_tx *tx; struct pdu_data *pdu; - LL_ASSERT(ctx->node_ref.tx); + LL_ASSERT_DBG(ctx->node_ref.tx); #if defined(CONFIG_BT_CTLR_DATA_LENGTH) if (!((ctx->tx_opcode == PDU_DATA_LLCTRL_TYPE_PHY_REQ) && @@ -390,7 +390,7 @@ static void lp_pu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, vo return; } ctx->data.pu.ntf_dle_node = llcp_ntf_alloc(); - LL_ASSERT(ctx->data.pu.ntf_dle_node); + LL_ASSERT_DBG(ctx->data.pu.ntf_dle_node); } #endif /* CONFIG_BT_CTLR_DATA_LENGTH */ @@ -417,7 +417,7 @@ static void lp_pu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, vo break; #endif /* CONFIG_BT_CENTRAL */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); } /* Enqueue LL Control PDU towards LLL */ @@ -435,10 +435,10 @@ static void pu_ntf(struct ll_conn *conn, struct proc_ctx *ctx) /* Piggy-back on stored RX node */ ntf = ctx->node_ref.rx; ctx->node_ref.rx = NULL; - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); if (ctx->data.pu.ntf_pu) { - LL_ASSERT(ntf->hdr.type == NODE_RX_TYPE_RETAIN); + LL_ASSERT_DBG(ntf->hdr.type == NODE_RX_TYPE_RETAIN); ntf->hdr.type = NODE_RX_TYPE_PHY_UPDATE; ntf->hdr.handle = conn->lll.handle; pdu = (struct node_rx_pu *)ntf->pdu; @@ -476,7 +476,7 @@ static void pu_dle_ntf(struct ll_conn *conn, struct proc_ctx *ctx) /* Signal to release pre-allocated node in case there is no DLE ntf */ ntf->hdr.type = NODE_RX_TYPE_RELEASE; } else { - LL_ASSERT(ntf); + LL_ASSERT_DBG(ntf); ntf->hdr.type = NODE_RX_TYPE_DC_PDU; ntf->hdr.handle = conn->lll.handle; @@ -646,7 +646,7 @@ static void lp_pu_st_wait_tx_ack_phy_req(struct ll_conn *conn, struct proc_ctx * #endif /* CONFIG_BT_PERIPHERAL */ default: /* Unknown role */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } break; @@ -675,7 +675,7 @@ static void lp_pu_st_wait_tx_ack_phy_update_ind(struct ll_conn *conn, struct pro { switch (evt) { case LP_PU_EVT_ACK: - LL_ASSERT(conn->lll.role == BT_HCI_ROLE_CENTRAL); + LL_ASSERT_DBG(conn->lll.role == BT_HCI_ROLE_CENTRAL); if (ctx->data.pu.p_to_c_phy || ctx->data.pu.c_to_p_phy) { /* Either phys should change */ if (ctx->data.pu.c_to_p_phy) { @@ -711,7 +711,7 @@ static void lp_pu_st_wait_rx_phy_update_ind(struct ll_conn *conn, struct proc_ct { switch (evt) { case LP_PU_EVT_PHY_UPDATE_IND: - LL_ASSERT(conn->lll.role == BT_HCI_ROLE_PERIPHERAL); + LL_ASSERT_DBG(conn->lll.role == BT_HCI_ROLE_PERIPHERAL); llcp_rr_set_incompat(conn, INCOMPAT_RESERVED); llcp_pdu_decode_phy_update_ind(ctx, (struct pdu_data *)param); const uint8_t end_procedure = pu_check_update_ind(conn, ctx); @@ -867,7 +867,7 @@ static void lp_pu_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_ #endif /* CONFIG_BT_CTLR_DATA_LENGTH */ default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } @@ -930,7 +930,7 @@ static void rp_pu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, vo struct node_tx *tx; struct pdu_data *pdu; - LL_ASSERT(ctx->node_ref.tx); + LL_ASSERT_DBG(ctx->node_ref.tx); #if defined(CONFIG_BT_CTLR_DATA_LENGTH) if (!llcp_ntf_alloc_is_available()) { @@ -940,7 +940,7 @@ static void rp_pu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, vo } ctx->data.pu.ntf_dle_node = llcp_ntf_alloc(); - LL_ASSERT(ctx->data.pu.ntf_dle_node); + LL_ASSERT_DBG(ctx->data.pu.ntf_dle_node); #endif /* CONFIG_BT_CTLR_DATA_LENGTH */ tx = ctx->node_ref.tx; @@ -967,7 +967,7 @@ static void rp_pu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, vo break; #endif /* CONFIG_BT_CENTRAL */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); } /* Enqueue LL Control PDU towards LLL */ @@ -1073,7 +1073,7 @@ static void rp_pu_st_wait_rx_phy_req(struct ll_conn *conn, struct proc_ctx *ctx, #endif /* CONFIG_BT_PERIPHERAL */ default: /* Unknown role */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } break; default: @@ -1105,7 +1105,7 @@ static void rp_pu_st_wait_tx_ack_phy(struct ll_conn *conn, struct proc_ctx *ctx, if (0) { #if defined(CONFIG_BT_PERIPHERAL) } else if (ctx->state == RP_PU_STATE_WAIT_TX_ACK_PHY_RSP) { - LL_ASSERT(conn->lll.role == BT_HCI_ROLE_PERIPHERAL); + LL_ASSERT_DBG(conn->lll.role == BT_HCI_ROLE_PERIPHERAL); /* When we act as peripheral apply timing restriction */ pu_set_timing_restrict( conn, pu_select_phy_timing_restrict(conn, ctx->data.pu.tx)); @@ -1114,7 +1114,7 @@ static void rp_pu_st_wait_tx_ack_phy(struct ll_conn *conn, struct proc_ctx *ctx, #endif /* CONFIG_BT_PERIPHERAL */ #if defined(CONFIG_BT_CENTRAL) } else if (ctx->state == RP_PU_STATE_WAIT_TX_ACK_PHY_UPDATE_IND) { - LL_ASSERT(conn->lll.role == BT_HCI_ROLE_CENTRAL); + LL_ASSERT_DBG(conn->lll.role == BT_HCI_ROLE_CENTRAL); if (ctx->data.pu.c_to_p_phy || ctx->data.pu.p_to_c_phy) { /* UPDATE_IND acked, so lets await instant */ if (ctx->data.pu.c_to_p_phy) { @@ -1289,7 +1289,7 @@ static void rp_pu_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_ #endif /* CONFIG_BT_CTLR_DATA_LENGTH */ default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c index 185cad7911d..3a90a9d950b 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c @@ -104,7 +104,7 @@ static bool proc_with_instant(struct proc_ctx *ctx) return 1U; default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -117,12 +117,12 @@ void llcp_rr_check_done(struct ll_conn *conn, struct proc_ctx *ctx) struct proc_ctx *ctx_header; ctx_header = llcp_rr_peek(conn); - LL_ASSERT(ctx_header == ctx); + LL_ASSERT_DBG(ctx_header == ctx); /* If we have a node rx it must not be marked RETAIN as * the memory referenced would leak */ - LL_ASSERT(ctx->node_ref.rx == NULL || + LL_ASSERT_DBG(ctx->node_ref.rx == NULL || ctx->node_ref.rx->hdr.type != NODE_RX_TYPE_RETAIN); rr_dequeue(conn); @@ -319,7 +319,7 @@ void llcp_rr_rx(struct ll_conn *conn, struct proc_ctx *ctx, memq_link_t *link, #endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -459,7 +459,7 @@ static void rr_act_run(struct ll_conn *conn) #endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ default: /* Unknown procedure */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); break; } @@ -475,7 +475,7 @@ static void rr_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) /* Allocate tx node */ tx = llcp_tx_alloc(conn, ctx); - LL_ASSERT(tx); + LL_ASSERT_DBG(tx); pdu = (struct pdu_data *)tx->pdu; @@ -502,7 +502,7 @@ static void rr_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) llcp_pdu_encode_unknown_rsp(ctx, pdu); break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); } ctx->tx_opcode = pdu->llctrl.opcode; @@ -515,7 +515,7 @@ static void rr_act_reject(struct ll_conn *conn) { struct proc_ctx *ctx = llcp_rr_peek(conn); - LL_ASSERT(ctx != NULL); + LL_ASSERT_DBG(ctx != NULL); if (llcp_rr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) { rr_set_state(conn, RR_STATE_REJECT); @@ -531,7 +531,7 @@ static void rr_act_unsupported(struct ll_conn *conn) { struct proc_ctx *ctx = llcp_rr_peek(conn); - LL_ASSERT(ctx != NULL); + LL_ASSERT_DBG(ctx != NULL); if (llcp_rr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) { rr_set_state(conn, RR_STATE_UNSUPPORTED); @@ -550,7 +550,7 @@ static void rr_act_complete(struct ll_conn *conn) rr_set_collision(conn, 0U); ctx = llcp_rr_peek(conn); - LL_ASSERT(ctx != NULL); + LL_ASSERT_DBG(ctx != NULL); /* Stop procedure response timeout timer */ llcp_rr_prt_stop(conn); @@ -777,7 +777,7 @@ static void rr_execute_fsm(struct ll_conn *conn, uint8_t evt, void *param) break; default: /* Unknown state */ - LL_ASSERT(0); + LL_ASSERT_DBG(0); } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_peripheral.c b/subsys/bluetooth/controller/ll_sw/ull_peripheral.c index 8032b18e995..aa6db211ed1 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_peripheral.c +++ b/subsys/bluetooth/controller/ll_sw/ull_peripheral.c @@ -250,7 +250,7 @@ void ull_periph_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, * complete event. */ node = pdu_adv; - LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_cc)); + LL_ASSERT_DBG(IS_PTR_ALIGNED(node, struct node_rx_cc)); /* Populate the fields required for connection complete event */ cc = node; @@ -334,7 +334,7 @@ void ull_periph_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, link = rx->hdr.link; handle = ull_adv_handle_get(adv); - LL_ASSERT(handle < BT_CTLR_ADV_SET); + LL_ASSERT_DBG(handle < BT_CTLR_ADV_SET); rx->hdr.type = NODE_RX_TYPE_EXT_ADV_TERMINATE; rx->hdr.handle = handle; @@ -494,8 +494,8 @@ void ull_periph_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, ticks_slot_overhead), ull_periph_ticker_cb, conn, ticker_op_cb, (void *)__LINE__); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); #if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) /* enable ticker job, irrespective of disabled in this function so @@ -520,8 +520,8 @@ void ull_periph_latency_cancel(struct ll_conn *conn, uint16_t handle) 0, 0, 0, 0, 1, 0, ticker_update_latency_cancel_op_cb, (void *)conn); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); } } @@ -578,7 +578,7 @@ void ull_periph_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&conn->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* Increment event counter */ conn->event_counter += (lazy + 1U); @@ -594,7 +594,7 @@ void ull_periph_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ err = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!err); + LL_ASSERT_ERR(!err); /* De-mux remaining tx nodes from FIFO */ ull_conn_tx_demux(UINT8_MAX); @@ -664,15 +664,15 @@ static void invalid_release(struct ull_hdr *hdr, struct lll_conn *lll, static void ticker_op_stop_adv_cb(uint32_t status, void *param) { - LL_ASSERT(status != TICKER_STATUS_FAILURE || - param == ull_disable_mark_get()); + LL_ASSERT_ERR((status != TICKER_STATUS_FAILURE) || + (param == ull_disable_mark_get())); } static void ticker_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); } static void ticker_update_latency_cancel_op_cb(uint32_t ticker_status, @@ -680,7 +680,7 @@ static void ticker_update_latency_cancel_op_cb(uint32_t ticker_status, { struct ll_conn *conn = param; - LL_ASSERT(ticker_status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(ticker_status == TICKER_STATUS_SUCCESS); conn->periph.latency_cancel = 0U; } diff --git a/subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c b/subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c index dd360c9f9eb..21ff94e90bb 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c @@ -158,7 +158,7 @@ void ull_peripheral_iso_release(uint16_t cis_handle) struct ll_conn_iso_group *cig; cis = ll_conn_iso_stream_get(cis_handle); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); cig = cis->group; @@ -318,7 +318,7 @@ uint8_t ull_peripheral_iso_setup(struct pdu_data_llctrl_cis_ind *ind, } conn = ll_conn_get(cis->lll.acl_handle); - LL_ASSERT(conn != NULL); + LL_ASSERT_DBG(conn != NULL); cis_offset = sys_get_le24(ind->cis_offset); @@ -366,7 +366,7 @@ static void ticker_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); } void ull_peripheral_iso_update_ticker(struct ll_conn_iso_group *cig, @@ -378,8 +378,8 @@ void ull_peripheral_iso_update_ticker(struct ll_conn_iso_group *cig, uint8_t ticker_id_cig = TICKER_ID_CONN_ISO_BASE + ll_conn_iso_group_handle_get(cig); uint32_t ticker_status = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, ticker_id_cig, ticker_op_cb, NULL); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); ticker_status = ticker_start(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, @@ -393,8 +393,8 @@ void ull_peripheral_iso_update_ticker(struct ll_conn_iso_group *cig, ull_conn_iso_ticker_cb, cig, ticker_op_cb, NULL); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); } @@ -412,8 +412,9 @@ void ull_peripheral_iso_update_peer_sca(struct ll_conn *acl) if (!cig || !cig->lll.num_cis) { continue; } + cis = ll_conn_iso_stream_get_by_group(cig, NULL); - LL_ASSERT(cis); + LL_ASSERT_DBG(cis); uint16_t cis_handle = cis->lll.handle; diff --git a/subsys/bluetooth/controller/ll_sw/ull_scan.c b/subsys/bluetooth/controller/ll_sw/ull_scan.c index 493c2330db0..514072643e1 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_scan.c +++ b/subsys/bluetooth/controller/ll_sw/ull_scan.c @@ -696,7 +696,7 @@ uint8_t ull_scan_disable(uint8_t handle, struct ll_scan_set *scan) * sync role. */ parent = aux->parent; - LL_ASSERT(!parent || (parent != aux_scan_lll)); + LL_ASSERT_DBG(!parent || (parent != aux_scan_lll)); } } #endif /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ @@ -727,7 +727,7 @@ void ull_scan_done(struct node_rx_event_done *done) lll->duration_reload = 0U; handle = ull_scan_handle_get(scan); - LL_ASSERT(handle < BT_CTLR_SCAN_SET); + LL_ASSERT_DBG(handle < BT_CTLR_SCAN_SET); #if defined(CONFIG_BT_CTLR_PHY_CODED) /* Prevent duplicate terminate event if ull_scan_done get called by @@ -751,8 +751,8 @@ void ull_scan_done(struct node_rx_event_done *done) (TICKER_ID_SCAN_BASE + handle), ticker_stop_ext_op_cb, scan); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } void ull_scan_term_dequeue(uint8_t handle) @@ -760,7 +760,7 @@ void ull_scan_term_dequeue(uint8_t handle) struct ll_scan_set *scan; scan = ull_scan_set_get(handle); - LL_ASSERT(scan); + LL_ASSERT_DBG(scan); scan->is_enabled = 0U; @@ -773,7 +773,7 @@ void ull_scan_term_dequeue(uint8_t handle) uint8_t err; err = disable(SCAN_HANDLE_PHY_CODED); - LL_ASSERT(!err); + LL_ASSERT_ERR(!err); } } else { struct ll_scan_set *scan_1m; @@ -783,7 +783,7 @@ void ull_scan_term_dequeue(uint8_t handle) uint8_t err; err = disable(SCAN_HANDLE_1M); - LL_ASSERT(!err); + LL_ASSERT_ERR(!err); } } #endif /* CONFIG_BT_CTLR_PHY_CODED */ @@ -924,7 +924,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&scan->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* Append timing parameters */ p.ticks_at_expire = ticks_at_expire; @@ -937,7 +937,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); #if defined(CONFIG_BT_CTLR_ADV_EXT) if (lll->duration_expire) { @@ -955,7 +955,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, scan->duration_lazy - elapsed; handle = ull_scan_handle_get(scan); - LL_ASSERT(handle < BT_CTLR_SCAN_SET); + LL_ASSERT_DBG(handle < BT_CTLR_SCAN_SET); ret = ticker_update(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, @@ -963,8 +963,8 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, handle), 0, 0, 0, 0, duration_lazy, 0, NULL, NULL); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } lll->duration_expire = 0U; @@ -973,15 +973,15 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, uint8_t handle; handle = ull_scan_handle_get(scan); - LL_ASSERT(handle < BT_CTLR_SCAN_SET); + LL_ASSERT_DBG(handle < BT_CTLR_SCAN_SET); lll->duration_expire = lll->duration_reload; ret = ticker_update(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, (TICKER_ID_SCAN_BASE + handle), 0, 0, 0, 0, 1, 1, NULL, NULL); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } #endif /* CONFIG_BT_CTLR_ADV_EXT */ @@ -1105,7 +1105,7 @@ static void ticker_stop_ext_op_cb(uint32_t status, void *param) mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void ext_disable(void *param) @@ -1126,14 +1126,14 @@ static void ext_disable(void *param) /* Setup disabled callback to be called when ref count * returns to zero. */ - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = mfy.param; hdr->disabled_cb = ext_disabled_cb; /* Trigger LLL disable */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } else { /* No pending LLL events */ ext_disabled_cb(&scan->lll); diff --git a/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c b/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c index 953575885bc..012168b768d 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c +++ b/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c @@ -215,7 +215,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) rx_incomplete = NULL; lll = ftr->param; - LL_ASSERT(!lll->lll_aux); + LL_ASSERT_DBG(!lll->lll_aux); scan = HDR_LLL2ULL(lll); sync = sync_create_get(scan); @@ -234,7 +234,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) rx_incomplete = NULL; lll = ftr->param; - LL_ASSERT(!lll->lll_aux); + LL_ASSERT_DBG(!lll->lll_aux); scan = HDR_LLL2ULL(lll); sync = sync_create_get(scan); @@ -259,7 +259,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) /* aux parent will be NULL for periodic sync */ lll = aux->parent; - LL_ASSERT(lll); + LL_ASSERT_DBG(lll); ticker_yield_handle = TICKER_ID_SCAN_AUX_BASE + aux_handle_get(aux); @@ -280,10 +280,10 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) * is being received before we process the node here. */ lll_aux = ftr->lll_aux; - LL_ASSERT(lll_aux); + LL_ASSERT_DBG(lll_aux); aux = HDR_LLL2ULL(lll_aux); - LL_ASSERT(lll == aux->parent); + LL_ASSERT_DBG(lll == aux->parent); ticker_yield_handle = TICKER_NULL; @@ -301,10 +301,10 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) * is being received before we process the node here. */ lll_aux = ftr->lll_aux; - LL_ASSERT(lll_aux); + LL_ASSERT_DBG(lll_aux); aux = HDR_LLL2ULL(lll_aux); - LL_ASSERT(sync_lll == aux->parent); + LL_ASSERT_DBG(sync_lll == aux->parent); ticker_yield_handle = TICKER_NULL; } @@ -340,7 +340,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) break; #endif /* CONFIG_BT_CTLR_PHY_CODED */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); + return; } @@ -375,7 +376,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) * passed in the node rx footer field. */ sync_lll = ftr->param; - LL_ASSERT(!sync_lll->lll_aux); + LL_ASSERT_DBG(!sync_lll->lll_aux); ull_sync = HDR_LLL2ULL(sync_lll); rx->hdr.handle = ull_sync_handle_get(ull_sync); @@ -406,7 +407,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) } break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); + return; } @@ -601,7 +603,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) } if (is_scan_req) { - LL_ASSERT(aux && aux->rx_last); + LL_ASSERT_DBG(aux && aux->rx_last); aux->rx_last->rx_ftr.extra = rx; aux->rx_last = rx; @@ -818,7 +820,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) * scheduling, or receiving a chain then it will * reuse the aux context. */ - LL_ASSERT(!lll->lll_aux || (lll->lll_aux == lll_aux)); + LL_ASSERT_DBG(!lll->lll_aux || (lll->lll_aux == lll_aux)); /* Associate Scan context with the Aux context so that * it can continue reception in LLL scheduling. @@ -841,7 +843,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) /* Switching to ULL scheduling to receive auxiliary PDUs */ if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || lll) { - LL_ASSERT(scan); + LL_ASSERT_DBG(scan); /* Do not ULL schedule if scan disable requested */ if (unlikely(scan->is_stop)) { @@ -857,8 +859,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) } else { struct ll_sync_set *sync_set; - LL_ASSERT(sync_lll && - (!sync_lll->lll_aux || sync_lll->lll_aux == lll_aux)); + LL_ASSERT_ERR(sync_lll && + (!sync_lll->lll_aux || sync_lll->lll_aux == lll_aux)); /* Do not ULL schedule if sync terminate requested */ sync_set = HDR_LLL2ULL(sync_lll); @@ -917,8 +919,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) ticks_aux_offset - ticks_slot_offset), NULL, NULL); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); } aux_handle = aux_handle_get(aux); @@ -933,10 +935,10 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) (aux->ull.ticks_slot + ticks_slot_overhead), ticker_cb, aux, ticker_op_cb, aux); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY) || - ((ticker_status == TICKER_STATUS_FAILURE) && - IS_ENABLED(CONFIG_BT_TICKER_LOW_LAT))); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY) || + ((ticker_status == TICKER_STATUS_FAILURE) && + IS_ENABLED(CONFIG_BT_TICKER_LOW_LAT))); #if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) /* enable ticker job, queued ticker operation will be handled @@ -960,7 +962,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) * immediately since we are in sync context. */ if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || aux->rx_last) { - LL_ASSERT(scan); + LL_ASSERT_DBG(scan); /* If scan is being disabled, rx could already be * enqueued before coming here to ull_scan_aux_rx_flush. @@ -990,7 +992,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) } else { const struct ll_sync_set *sync_set; - LL_ASSERT(sync_lll); + LL_ASSERT_DBG(sync_lll); ll_rx_put_sched(link, rx); @@ -1000,7 +1002,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) } } - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); flush_safe(aux); @@ -1028,7 +1030,7 @@ void ull_scan_aux_done(struct node_rx_event_done *done) struct ll_sync_set *sync; sync = CONTAINER_OF(done->param, struct ll_sync_set, ull); - LL_ASSERT(ull_sync_is_valid_get(sync)); + LL_ASSERT_DBG(ull_sync_is_valid_get(sync)); /* Auxiliary context will be flushed by ull_scan_aux_stop() */ if (unlikely(sync->is_stop) || !sync->lll.lll_aux) { @@ -1036,16 +1038,16 @@ void ull_scan_aux_done(struct node_rx_event_done *done) } aux = HDR_LLL2ULL(sync->lll.lll_aux); - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); } else { struct ll_scan_set *scan; struct lll_scan *lll; lll = aux->parent; - LL_ASSERT(lll); + LL_ASSERT_DBG(lll); scan = HDR_LLL2ULL(lll); - LL_ASSERT(ull_scan_is_valid_get(scan)); + LL_ASSERT_DBG(ull_scan_is_valid_get(scan)); /* Auxiliary context will be flushed by ull_scan_aux_stop() */ if (unlikely(scan->is_stop)) { @@ -1086,7 +1088,7 @@ void *ull_scan_aux_lll_parent_get(struct lll_scan_aux *lll, struct lll_scan *lllscan; lllscan = aux->parent; - LL_ASSERT(lllscan); + LL_ASSERT_DBG(lllscan); scan = HDR_LLL2ULL(lllscan); *is_lll_scan = !!ull_scan_is_valid_get(scan); @@ -1196,7 +1198,8 @@ void ull_scan_aux_release(memq_link_t *link, struct node_rx_pdu *rx) rx->rx_ftr.extra = NULL; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); + lll_aux = NULL; } @@ -1208,7 +1211,7 @@ void ull_scan_aux_release(memq_link_t *link, struct node_rx_pdu *rx) aux = HDR_LLL2ULL(lll_aux); lll = aux->parent; - LL_ASSERT(lll); + LL_ASSERT_DBG(lll); scan = HDR_LLL2ULL(lll); scan = ull_scan_is_valid_get(scan); @@ -1222,12 +1225,13 @@ void ull_scan_aux_release(memq_link_t *link, struct node_rx_pdu *rx) sync = HDR_LLL2ULL(sync_lll); is_stop = sync->is_stop; } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); + return; } if (!is_stop) { - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); flush_safe(aux); @@ -1287,7 +1291,7 @@ int ull_scan_aux_stop(struct ll_scan_aux_set *aux) struct lll_scan *lll; lll = aux->parent; - LL_ASSERT(lll); + LL_ASSERT_DBG(lll); scan = HDR_LLL2ULL(lll); scan = ull_scan_is_valid_get(scan); @@ -1308,7 +1312,7 @@ int ull_scan_aux_stop(struct ll_scan_aux_set *aux) mfy.param = aux; ret = mayfly_enqueue(TICKER_USER_ID_THREAD, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); return 0; } @@ -1333,7 +1337,7 @@ static inline void aux_release(struct ll_scan_aux_set *aux) /* Clear the parent so that when scan is being disabled then this * auxiliary context shall not associate itself from being disable. */ - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); aux->parent = NULL; mem_release(aux, &scan_aux_free); @@ -1350,7 +1354,7 @@ static void done_disabled_cb(void *param) struct ll_scan_aux_set *aux; aux = param; - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); flush(aux); } @@ -1362,7 +1366,7 @@ static void flush_safe(void *param) uint8_t ref; aux = param; - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); /* ref == 0 * All PDUs were scheduled from LLL and there is no pending done @@ -1382,9 +1386,9 @@ static void flush_safe(void *param) * cannot overlap, i.e. ULL reference count * shall be less than 2. */ - LL_ASSERT(ref < 2U); + LL_ASSERT_DBG(ref < 2U); - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = aux; hdr->disabled_cb = done_disabled_cb; @@ -1406,7 +1410,7 @@ static void flush(void *param) * auxiliary channel PDUs. */ aux = param; - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); rx = aux->rx_head; if (rx) { @@ -1456,7 +1460,7 @@ static void aux_sync_partial(void *param) rx = aux->rx_head; aux->rx_head = NULL; - LL_ASSERT(rx); + LL_ASSERT_DBG(rx); rx->rx_ftr.aux_sched = 1U; ll_rx_put_sched(rx->hdr.link, rx); @@ -1468,7 +1472,7 @@ static void aux_sync_incomplete(void *param) struct ll_scan_aux_set *aux; aux = param; - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); /* ULL scheduling succeeded hence no backup node rx present, use the * extra node rx reserved for incomplete data status generation. @@ -1480,7 +1484,7 @@ static void aux_sync_incomplete(void *param) /* get reference to sync context */ lll = aux->parent; - LL_ASSERT(lll); + LL_ASSERT_DBG(lll); sync = HDR_LLL2ULL(lll); /* reset data len total */ @@ -1488,7 +1492,7 @@ static void aux_sync_incomplete(void *param) /* pick extra node rx stored in aux context */ rx = aux->rx_incomplete; - LL_ASSERT(rx); + LL_ASSERT_DBG(rx); aux->rx_incomplete = NULL; /* prepare sync report with failure */ @@ -1508,7 +1512,7 @@ static void aux_sync_incomplete(void *param) aux->rx_head = rx; } - LL_ASSERT(!ull_ref_get(&aux->ull)); + LL_ASSERT_DBG(!ull_ref_get(&aux->ull)); flush(aux); #endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ @@ -1529,7 +1533,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&aux->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* Append timing parameters */ p.ticks_at_expire = ticks_at_expire; @@ -1542,7 +1546,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_PREPARE_O(1); } @@ -1560,7 +1564,7 @@ static void ticker_op_cb(uint32_t status, void *param) aux = param; sync_lll = aux->parent; - LL_ASSERT(sync_lll); + LL_ASSERT_DBG(sync_lll); sync = HDR_LLL2ULL(sync_lll); sync = ull_sync_is_valid_get(sync); @@ -1581,7 +1585,7 @@ static void ticker_op_cb(uint32_t status, void *param) struct ll_scan_aux_set *aux; aux = param; - LL_ASSERT(aux->parent); + LL_ASSERT_DBG(aux->parent); mfy.fp = flush_safe; } @@ -1591,7 +1595,7 @@ static void ticker_op_cb(uint32_t status, void *param) ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } #else /* CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ @@ -1648,7 +1652,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) rx_incomplete = NULL; lll = ftr->param; - LL_ASSERT(!lll->lll_aux); + LL_ASSERT_DBG(!lll->lll_aux); scan = HDR_LLL2ULL(lll); sync = sync_create_get(scan); @@ -1664,7 +1668,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) rx_incomplete = NULL; lll = ftr->param; - LL_ASSERT(!lll->lll_aux); + LL_ASSERT_DBG(!lll->lll_aux); scan = HDR_LLL2ULL(lll); sync = sync_create_get(scan); @@ -1686,7 +1690,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) /* chain parent will be NULL for periodic sync */ lll = chain->parent; - LL_ASSERT(lll); + LL_ASSERT_DBG(lll); } else if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || ull_scan_is_valid_get(HDR_LLL2ULL(ftr->param))) { @@ -1700,10 +1704,10 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) lll = ftr->param; lll_aux = lll->lll_aux; - LL_ASSERT(lll_aux); + LL_ASSERT_DBG(lll_aux); chain = CONTAINER_OF(lll_aux, struct ll_scan_aux_chain, lll); - LL_ASSERT(lll == chain->parent); + LL_ASSERT_DBG(lll == chain->parent); } else { lll = NULL; @@ -1713,10 +1717,10 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) sync_lll = ftr->param; lll_aux = sync_lll->lll_aux; - LL_ASSERT(lll_aux); + LL_ASSERT_DBG(lll_aux); chain = CONTAINER_OF(lll_aux, struct ll_scan_aux_chain, lll); - LL_ASSERT(sync_lll == chain->parent); + LL_ASSERT_DBG(sync_lll == chain->parent); } if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || lll) { @@ -1750,7 +1754,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) break; #endif /* CONFIG_BT_CTLR_PHY_CODED */ default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); + return; } @@ -1785,7 +1790,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) * passed in the node rx footer field. */ sync_lll = ftr->param; - LL_ASSERT(!sync_lll->lll_aux); + LL_ASSERT_DBG(!sync_lll->lll_aux); ull_sync = HDR_LLL2ULL(sync_lll); rx->hdr.handle = ull_sync_handle_get(ull_sync); @@ -1813,7 +1818,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) } break; default: - LL_ASSERT(0); + LL_ASSERT_DBG(0); + return; } @@ -2009,7 +2015,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) PDU_ADV_AUX_PTR_PHY_GET(aux_ptr) == EXT_ADV_AUX_PHY_LE_CODED) || (aux_ptr->chan_idx >= CHM_USED_COUNT_MAX)) { if (is_scan_req) { - LL_ASSERT(chain && chain->rx_last); + LL_ASSERT_DBG(chain && chain->rx_last); chain->rx_last->rx_ftr.extra = rx; chain->rx_last = rx; @@ -2207,7 +2213,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) /* Switching to ULL scheduling to receive auxiliary PDUs */ if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || lll) { - LL_ASSERT(scan); + LL_ASSERT_DBG(scan); /* Do not ULL schedule if scan disable requested */ if (unlikely(scan->is_stop)) { @@ -2223,8 +2229,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) } else { struct ll_sync_set *sync_set; - LL_ASSERT(sync_lll && - (!sync_lll->lll_aux || sync_lll->lll_aux == lll_aux)); + LL_ASSERT_ERR(sync_lll && + (!sync_lll->lll_aux || sync_lll->lll_aux == lll_aux)); /* Do not ULL schedule if sync terminate requested */ sync_set = HDR_LLL2ULL(sync_lll); @@ -2278,7 +2284,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) * immediately since we are in sync context. */ if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || chain->rx_last) { - LL_ASSERT(scan); + LL_ASSERT_DBG(scan); /* rx could already be enqueued before coming here - * check if rx not the last in the list of received PDUs @@ -2291,12 +2297,12 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) chain->rx_last = rx; } } else { - LL_ASSERT(sync_lll); + LL_ASSERT_DBG(sync_lll); ll_rx_put_sched(link, rx); } - LL_ASSERT(chain->parent); + LL_ASSERT_DBG(chain->parent); flush_safe(chain); @@ -2318,7 +2324,7 @@ void ull_scan_aux_done(struct node_rx_event_done *done) /* Get reference to chain */ chain = CONTAINER_OF(done->extra.lll, struct ll_scan_aux_chain, lll); - LL_ASSERT(scan_aux_chain_is_valid_get(chain)); + LL_ASSERT_DBG(scan_aux_chain_is_valid_get(chain)); /* Remove chain from active list */ chain_remove_from_list(&scan_aux_set.active_chains, chain); @@ -2343,7 +2349,7 @@ void *ull_scan_aux_lll_parent_get(struct lll_scan_aux *lll, struct lll_scan *lllscan; lllscan = chain->parent; - LL_ASSERT(lllscan); + LL_ASSERT_DBG(lllscan); scan = HDR_LLL2ULL(lllscan); *is_lll_scan = !!ull_scan_is_valid_get(scan); @@ -2419,7 +2425,8 @@ void ull_scan_aux_release(memq_link_t *link, struct node_rx_pdu *rx) rx->rx_ftr.extra = NULL; } } else { - LL_ASSERT(0); + LL_ASSERT_DBG(0); + lll_aux = NULL; } @@ -2431,7 +2438,7 @@ void ull_scan_aux_release(memq_link_t *link, struct node_rx_pdu *rx) chain = CONTAINER_OF(lll_aux, struct ll_scan_aux_chain, lll); lll = chain->parent; - LL_ASSERT(lll); + LL_ASSERT_DBG(lll); scan = HDR_LLL2ULL(lll); scan = ull_scan_is_valid_get(scan); @@ -2447,7 +2454,7 @@ void ull_scan_aux_release(memq_link_t *link, struct node_rx_pdu *rx) } if (!is_stop) { - LL_ASSERT(chain->parent); + LL_ASSERT_DBG(chain->parent); /* Remove chain from active list and flush */ chain_remove_from_list(&scan_aux_set.active_chains, chain); @@ -2474,8 +2481,8 @@ static void scan_aux_stop_all_chains_for_parent(void *parent) /* Scheduled head is about to be removed - stop running ticker */ ticker_status = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, TICKER_ID_SCAN_AUX, NULL, NULL); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); ticker_stopped = true; } @@ -2531,7 +2538,7 @@ static void scan_aux_stop_all_chains_for_parent(void *parent) mfy.param = &curr->lll; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } } else { prev = curr; @@ -2555,7 +2562,7 @@ int ull_scan_aux_stop(void *parent) /* Stop chains in ULL execution context */ mfy.param = parent; ret = mayfly_enqueue(TICKER_USER_ID_THREAD, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); /* Wait for chains to be stopped before returning */ (void)k_sem_take(&sem_scan_aux_stop, K_FOREVER); @@ -2587,7 +2594,7 @@ static inline void aux_chain_release(struct ll_scan_aux_chain *chain) /* Clear the parent so that when scan is being disabled then this * auxiliary context shall not associate itself from being disable. */ - LL_ASSERT(chain->parent); + LL_ASSERT_DBG(chain->parent); chain->parent = NULL; mem_release(chain, &scan_aux_free); @@ -2614,7 +2621,7 @@ static void flush_safe(void *param) struct ll_scan_aux_chain *chain; chain = param; - LL_ASSERT(chain->parent); + LL_ASSERT_DBG(chain->parent); if (chain_is_in_list(scan_aux_set.flushing_chains, chain)) { /* Chain already marked for flushing */ @@ -2646,7 +2653,7 @@ static void flush(struct ll_scan_aux_chain *chain) /* Debug check that parent was assigned when allocated for reception of * auxiliary channel PDUs. */ - LL_ASSERT(chain->parent); + LL_ASSERT_DBG(chain->parent); /* Chain is being flushed now - remove from flushing_chains if present */ chain_remove_from_list(&scan_aux_set.flushing_chains, chain); @@ -2702,7 +2709,7 @@ static void flush(struct ll_scan_aux_chain *chain) sync_lll = chain->parent; sync = HDR_LLL2ULL(sync_lll); - LL_ASSERT(sync->is_stop || sync_lll->lll_aux); + LL_ASSERT_DBG(sync->is_stop || sync_lll->lll_aux); sync_lll->lll_aux = NULL; } @@ -2716,16 +2723,16 @@ static void aux_sync_incomplete(struct ll_scan_aux_chain *chain) struct node_rx_pdu *rx; struct lll_sync *lll; - LL_ASSERT(chain->parent); + LL_ASSERT_DBG(chain->parent); /* get reference to sync context */ lll = chain->parent; - LL_ASSERT(lll); + LL_ASSERT_DBG(lll); sync = HDR_LLL2ULL(lll); /* pick extra node rx stored in sync context */ rx = sync->rx_incomplete; - LL_ASSERT(rx); + LL_ASSERT_DBG(rx); sync->rx_incomplete = NULL; /* prepare sync report with failure */ @@ -2810,16 +2817,16 @@ static void chain_start_ticker(struct ll_scan_aux_chain *chain, bool replace) (chain->ticker_ticks - ticks_slot_offset), NULL, NULL); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); } #endif /* !CONFIG_BT_TICKER_SLOT_AGNOSTIC */ if (replace) { ticker_status = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, TICKER_ID_SCAN_AUX, NULL, NULL); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); } ticker_status = ticker_start(TICKER_INSTANCE_ID_CTLR, @@ -2834,13 +2841,13 @@ static void chain_start_ticker(struct ll_scan_aux_chain *chain, bool replace) ticks_slot_overhead), ticker_cb, chain, ticker_op_cb, chain); #if defined(CONFIG_BT_TICKER_SLOT_AGNOSTIC) - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); #else - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY) || - ((ticker_status == TICKER_STATUS_FAILURE) && - IS_ENABLED(CONFIG_BT_TICKER_LOW_LAT))); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY) || + ((ticker_status == TICKER_STATUS_FAILURE) && + IS_ENABLED(CONFIG_BT_TICKER_LOW_LAT))); #endif /* !CONFIG_BT_TICKER_SLOT_AGNOSTIC */ #if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) @@ -2866,10 +2873,10 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&scan_aux_set.ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* The chain should always be the first in the sched_chains list */ - LL_ASSERT(scan_aux_set.sched_chains == chain); + LL_ASSERT_DBG(scan_aux_set.sched_chains == chain); /* Move chain to active list */ chain_remove_from_list(&scan_aux_set.sched_chains, chain); @@ -2886,7 +2893,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); if (scan_aux_set.sched_chains) { /* Start ticker for next chain */ @@ -2916,7 +2923,7 @@ static void ticker_start_failed(void *param) static void ticker_op_cb(uint32_t status, void *param) { #if defined(CONFIG_BT_TICKER_SLOT_AGNOSTIC) - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); #else /* !CONFIG_BT_TICKER_SLOT_AGNOSTIC */ static memq_link_t link; static struct mayfly mfy = {0, 0, &link, NULL, ticker_start_failed}; @@ -2930,7 +2937,7 @@ static void ticker_op_cb(uint32_t status, void *param) ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 1, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); #endif /* !CONFIG_BT_TICKER_SLOT_AGNOSTIC */ } diff --git a/subsys/bluetooth/controller/ll_sw/ull_sched.c b/subsys/bluetooth/controller/ll_sw/ull_sched.c index 116ea101d13..5309e5c1f2a 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sched.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sched.c @@ -465,12 +465,12 @@ static uint8_t after_match_slot_get(uint8_t user_id, uint32_t ticks_slot_abs, /* Using a local variable to address the Coverity rule: * Incorrect expression (ASSERT_SIDE_EFFECT) - * Argument "ret_cb" of LL_ASSERT() has a side effect + * Argument "ret_cb" of LL_ASSERT_ERR() has a side effect * because the variable is volatile. The containing function * might work differently in a non-debug build. */ success = (ret_cb == TICKER_STATUS_SUCCESS); - LL_ASSERT(success); + LL_ASSERT_ERR(success); /* There is a possibility that tickers expire while we * iterate through the active list of tickers, start over with @@ -478,7 +478,7 @@ static uint8_t after_match_slot_get(uint8_t user_id, uint32_t ticks_slot_abs, */ if ((ticker_id_prev != TICKER_NULL) && (*ticks_anchor != ticks_anchor_prev)) { - LL_ASSERT(retry); + LL_ASSERT_ERR(retry); retry--; ticker_id = ticker_id_prev = TICKER_NULL; diff --git a/subsys/bluetooth/controller/ll_sw/ull_sync.c b/subsys/bluetooth/controller/ll_sw/ull_sync.c index 0ce9658e8d2..183e8bc72bf 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sync.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sync.c @@ -425,8 +425,8 @@ void ull_sync_setup_from_sync_transfer(struct ll_conn *conn, uint16_t service_da (sync->ull.ticks_slot + ticks_slot_overhead), ticker_cb, sync, ticker_start_op_cb, (void *)__LINE__); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } #endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ @@ -490,7 +490,7 @@ uint8_t ll_sync_create_cancel(void **rx) if (sync->timeout_reload != 0U) { uint16_t sync_handle = ull_sync_handle_get(sync); - LL_ASSERT(sync_handle <= UINT8_MAX); + LL_ASSERT_DBG(sync_handle <= UINT8_MAX); /* Sync is not established yet, so stop sync ticker */ const int err = @@ -585,7 +585,7 @@ uint8_t ll_sync_terminate(uint16_t handle) } #if !defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) - LL_ASSERT(!aux->parent); + LL_ASSERT_DBG(!aux->parent); #endif /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ } @@ -1153,8 +1153,8 @@ void ull_sync_setup(struct ll_scan_set *scan, uint8_t phy, (sync->ull.ticks_slot + ticks_slot_overhead), ticker_cb, sync, ticker_start_op_cb, (void *)__LINE__); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } void ull_sync_setup_reset(struct ll_sync_set *sync) @@ -1418,9 +1418,9 @@ void ull_sync_done(struct node_rx_event_done *done) ticks_drift_minus, 0, 0, lazy, force, ticker_update_op_cb, sync); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY) || - ((void *)sync == ull_disable_mark_get())); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY) || + ((void *)sync == ull_disable_mark_get())); } } } @@ -1435,7 +1435,7 @@ void ull_sync_chm_update(uint8_t sync_handle, uint8_t *acad, uint8_t acad_len) /* Get reference to LLL context */ sync = ull_sync_set_get(sync_handle); - LL_ASSERT(sync); + LL_ASSERT_DBG(sync); lll = &sync->lll; /* Ignore if already in progress */ @@ -1612,7 +1612,7 @@ static struct ll_sync_set *ull_sync_create(uint8_t sid, uint16_t timeout, uint16 /* Make sure that the node_rx_sync_establ hasn't got anything assigned. It is used to * mark when sync establishment is in progress. */ - LL_ASSERT(!sync->node_rx_sync_estab); + LL_ASSERT_DBG(!sync->node_rx_sync_estab); sync->node_rx_sync_estab = node_rx; /* Reporting initially enabled/disabled */ @@ -1659,7 +1659,7 @@ static struct ll_sync_set *ull_sync_create(uint8_t sid, uint16_t timeout, uint16 #if defined(CONFIG_BT_CTLR_DF_SCAN_CTE_RX) ull_df_sync_cfg_init(&lll->df_cfg); - LL_ASSERT(!lll->node_cte_incomplete); + LL_ASSERT_DBG(!lll->node_cte_incomplete); #endif /* CONFIG_BT_CTLR_DF_SCAN_CTE_RX */ /* Initialise ULL and LLL headers */ @@ -1677,8 +1677,8 @@ static void sync_ticker_cleanup(struct ll_sync_set *sync, ticker_op_func stop_op /* Stop Periodic Sync Ticker */ ret = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, TICKER_ID_SCAN_SYNC_BASE + sync_handle, stop_op_cb, (void *)sync); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); /* Mark sync context not sync established */ sync->timeout_reload = 0U; @@ -1706,7 +1706,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&sync->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* Append timing parameters */ p.ticks_at_expire = ticks_at_expire; @@ -1720,7 +1720,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, &mfy_lll_prepare); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_PREPARE_O(1); } @@ -1728,13 +1728,13 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, static void ticker_start_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); } static void ticker_update_op_cb(uint32_t status, void *param) { - LL_ASSERT(status == TICKER_STATUS_SUCCESS || - param == ull_disable_mark_get()); + LL_ASSERT_ERR((status == TICKER_STATUS_SUCCESS) || + (param == ull_disable_mark_get())); } static void ticker_stop_sync_expire_op_cb(uint32_t status, void *param) @@ -1743,13 +1743,13 @@ static void ticker_stop_sync_expire_op_cb(uint32_t status, void *param) static memq_link_t link; static struct mayfly mfy = {0, 0, &link, NULL, sync_expire}; - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); mfy.param = param; retval = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!retval); + LL_ASSERT_ERR(!retval); } static void sync_expire(void *param) @@ -1789,7 +1789,7 @@ static void ticker_stop_sync_lost_op_cb(uint32_t status, void *param) * sync lost scenario, do not generate the sync lost node rx from here */ if (status != TICKER_STATUS_SUCCESS) { - LL_ASSERT(param == ull_disable_mark_get()); + LL_ASSERT_DBG(param == ull_disable_mark_get()); return; } @@ -1798,7 +1798,7 @@ static void ticker_stop_sync_lost_op_cb(uint32_t status, void *param) retval = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0, &mfy); - LL_ASSERT(!retval); + LL_ASSERT_ERR(!retval); } static void sync_lost(void *param) @@ -1900,8 +1900,8 @@ static struct pdu_cte_info *pdu_cte_info_get(struct pdu_adv *pdu) } /* Make sure there are no fields that are not allowed for AUX_SYNC_IND and AUX_CHAIN_IND */ - LL_ASSERT(!hdr->adv_addr); - LL_ASSERT(!hdr->tgt_addr); + LL_ASSERT_DBG(!hdr->adv_addr); + LL_ASSERT_DBG(!hdr->tgt_addr); return (struct pdu_cte_info *)hdr->data; } @@ -1956,7 +1956,7 @@ void ull_sync_transfer_received(struct ll_conn *conn, uint16_t service_data, conn_evt_current = ull_conn_event_counter(conn); /* LLCP should have ensured this holds */ - LL_ASSERT(sync_conn_event_count != conn_evt_current); + LL_ASSERT_DBG(sync_conn_event_count != conn_evt_current); ull_sync_setup_from_sync_transfer(conn, service_data, sync, si, conn_event_count - conn_evt_current, diff --git a/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c b/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c index b3737c8fc4a..de741adfd6d 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c @@ -203,9 +203,9 @@ uint8_t ll_big_sync_create(uint8_t big_handle, uint16_t sync_handle, /* Calculate GLTK */ err = bt_crypto_h7(BIG1, bcode, igltk); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); err = bt_crypto_h6(igltk, BIG2, sync_iso->gltk); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); lll->enc = 1U; } else { @@ -309,7 +309,8 @@ uint8_t ll_big_sync_terminate(uint8_t big_handle, void **rx) mfy.param = &sync_iso->lll; ret = mayfly_enqueue(TICKER_USER_ID_THREAD, TICKER_USER_ID_LLL, 0, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); + k_sem_take(&sem, K_FOREVER); sync_iso->flush_sem = NULL; @@ -390,7 +391,7 @@ void ull_sync_iso_stream_release(struct ll_sync_iso_set *sync_iso) stream_handle = lll->stream_handle[lll->stream_count]; stream = ull_sync_iso_stream_get(stream_handle); - LL_ASSERT(stream); + LL_ASSERT_DBG(stream); dp = stream->dp; if (dp) { @@ -489,20 +490,22 @@ void ull_sync_iso_setup(struct ll_sync_iso_set *sync_iso, lll->irc = PDU_BIG_INFO_IRC_GET(bi); if (lll->pto) { uint8_t nse; + uint8_t ptc; nse = lll->irc * lll->bn; /* 4 bits * 3 bits, total 7 bits */ if (nse >= lll->nse) { return; } - lll->ptc = lll->nse - nse; + ptc = lll->nse - nse; /* FIXME: Do not remember why ptc is 4 bits, it should be 5 bits as ptc is a * running buffer offset related to nse. * Fix ptc and ptc_curr definitions, until then we keep an assertion check * here. */ - LL_ASSERT(lll->ptc <= BIT_MASK(4)); + LL_ASSERT_DBG(ptc <= BIT_MASK(4)); + lll->ptc = ptc; } else { lll->ptc = 0U; } @@ -532,7 +535,7 @@ void ull_sync_iso_setup(struct ll_sync_iso_set *sync_iso, /* Calculate GSK */ err = bt_crypto_h8(sync_iso->gltk, bi->gskd, BIG3, gsk); - LL_ASSERT(!err); + LL_ASSERT_DBG(!err); /* Prepare the CCM parameters */ ccm_rx = &lll->ccm_rx; @@ -584,6 +587,8 @@ void ull_sync_iso_setup(struct ll_sync_iso_set *sync_iso, lll->window_size_event_us; /* Skip to first selected BIS subevent */ stream = ull_sync_iso_stream_get(lll->stream_handle[0]); + LL_ASSERT_DBG(stream); + if (lll->bis_spacing >= (lll->sub_interval * lll->nse)) { sync_iso_offset_us += (stream->bis_index - 1U) * lll->sub_interval * @@ -705,8 +710,8 @@ void ull_sync_iso_setup(struct ll_sync_iso_set *sync_iso, (sync_iso->ull.ticks_slot + ticks_slot_overhead), ticker_cb, sync_iso, ticker_start_op_cb, (void *)__LINE__); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } void ull_sync_iso_estab_done(struct node_rx_event_done *done) @@ -843,9 +848,9 @@ void ull_sync_iso_done(struct node_rx_event_done *done) lazy, force, ticker_update_op_cb, sync_iso); - LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || - (ticker_status == TICKER_STATUS_BUSY) || - ((void *)sync_iso == ull_disable_mark_get())); + LL_ASSERT_ERR((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY) || + ((void *)sync_iso == ull_disable_mark_get())); } } @@ -995,7 +1000,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Increment prepare reference count */ ref = ull_ref_inc(&sync_iso->ull); - LL_ASSERT(ref); + LL_ASSERT_DBG(ref); /* Append timing parameters */ p.ticks_at_expire = ticks_at_expire; @@ -1008,7 +1013,7 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, /* Kick LLL prepare */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0U, &mfy_lll_prepare); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); DEBUG_RADIO_PREPARE_O(1); } @@ -1017,13 +1022,13 @@ static void ticker_start_op_cb(uint32_t status, void *param) { ARG_UNUSED(param); - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); } static void ticker_update_op_cb(uint32_t status, void *param) { - LL_ASSERT(status == TICKER_STATUS_SUCCESS || - param == ull_disable_mark_get()); + LL_ASSERT_ERR((status == TICKER_STATUS_SUCCESS) || + (param == ull_disable_mark_get())); } static void ticker_stop_op_cb(uint32_t status, void *param) @@ -1032,13 +1037,13 @@ static void ticker_stop_op_cb(uint32_t status, void *param) static struct mayfly mfy = {0U, 0U, &link, NULL, sync_iso_disable}; uint32_t ret; - LL_ASSERT(status == TICKER_STATUS_SUCCESS); + LL_ASSERT_ERR(status == TICKER_STATUS_SUCCESS); /* Check if any pending LLL events that need to be aborted */ mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, 0U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void sync_iso_disable(void *param) @@ -1059,14 +1064,14 @@ static void sync_iso_disable(void *param) /* Setup disabled callback to be called when ref count * returns to zero. */ - LL_ASSERT(!hdr->disabled_cb); + LL_ASSERT_ERR(!hdr->disabled_cb); hdr->disabled_param = mfy.param; hdr->disabled_cb = disabled_cb; /* Trigger LLL disable */ ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } else { /* No pending LLL events */ disabled_cb(&sync_iso->lll); @@ -1103,7 +1108,7 @@ static void disabled_cb(void *param) /* Generate BIG sync lost */ rx = (void *)&sync_iso->node_rx_lost; - LL_ASSERT(rx->hdr.link); + LL_ASSERT_DBG(rx->hdr.link); link = rx->hdr.link; rx->hdr.link = NULL; @@ -1113,7 +1118,7 @@ static void disabled_cb(void *param) mfy.param = param; ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0U, &mfy); - LL_ASSERT(!ret); + LL_ASSERT_ERR(!ret); } static void stop_ticker(struct ll_sync_iso_set *sync_iso, ticker_op_func fp_op_func) @@ -1133,6 +1138,6 @@ static void stop_ticker(struct ll_sync_iso_set *sync_iso, ticker_op_func fp_op_f sync_iso_handle_to_index(handle), fp_op_func, fp_op_func ? (void *)sync_iso : NULL); - LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || - (ret == TICKER_STATUS_BUSY)); + LL_ASSERT_ERR((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); } diff --git a/subsys/bluetooth/controller/ticker/ticker.c b/subsys/bluetooth/controller/ticker/ticker.c index 065e9981c5f..567301756e2 100644 --- a/subsys/bluetooth/controller/ticker/ticker.c +++ b/subsys/bluetooth/controller/ticker/ticker.c @@ -1448,7 +1448,7 @@ void ticker_worker(void *param) timeout_func = ticker->ext_data->ext_timeout_func; expire_info = ticker->ext_data->other_expire_info; if (ticker->ext_data->expire_info_id != TICKER_NULL) { - LL_ASSERT(expire_info && !expire_info->outdated); + LL_ASSERT_DBG(expire_info && !expire_info->outdated); } ext_context.context = ticker->context; @@ -2327,7 +2327,7 @@ static inline uint32_t ticker_job_op_start(struct ticker_instance *instance, #if defined(CONFIG_BT_TICKER_LOW_LAT) /* Must expire is not supported in compatibility mode */ - LL_ASSERT(start->lazy < TICKER_LAZY_MUST_EXPIRE_KEEP); + LL_ASSERT_DBG(start->lazy < TICKER_LAZY_MUST_EXPIRE_KEEP); #else #if !defined(CONFIG_BT_TICKER_SLOT_AGNOSTIC) if (start->lazy != TICKER_LAZY_MUST_EXPIRE_KEEP) { @@ -2492,7 +2492,7 @@ static uint8_t ticker_job_reschedule_in_window(struct ticker_instance *instance) } /* Ensure that resched ticker is expired */ - LL_ASSERT(ticker_resched->ticks_to_expire == 0U); + LL_ASSERT_DBG(ticker_resched->ticks_to_expire == 0U); /* Use ticker's reserved time ticks_slot, else for unreserved * tickers use the reschedule margin as ticks_slot. @@ -2500,7 +2500,7 @@ static uint8_t ticker_job_reschedule_in_window(struct ticker_instance *instance) if (ticker_resched->ticks_slot) { ticks_slot = ticker_resched->ticks_slot; } else { - LL_ASSERT(TICKER_HAS_SLOT_WINDOW(ticker_resched)); + LL_ASSERT_DBG(TICKER_HAS_SLOT_WINDOW(ticker_resched)); ticks_slot = HAL_TICKER_RESCHEDULE_MARGIN; } @@ -3181,7 +3181,7 @@ ticker_job_compare_update(struct ticker_instance *instance, uint32_t ticks_elapsed; uint32_t ticks_diff; - LL_ASSERT(i); + LL_ASSERT_ERR(i); i--; cc = instance->ticks_current; diff --git a/tests/bluetooth/init/prj_ctlr.conf b/tests/bluetooth/init/prj_ctlr.conf index b311a76b1cd..c733ef4ad3f 100644 --- a/tests/bluetooth/init/prj_ctlr.conf +++ b/tests/bluetooth/init/prj_ctlr.conf @@ -8,6 +8,7 @@ CONFIG_BT_SMP_SC_ONLY=y CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y CONFIG_BT_GATT_CLIENT=y CONFIG_BT_CLASSIC=n +CONFIG_BT_CTLR_ASSERT_DEBUG=n CONFIG_FLASH=y CONFIG_SOC_FLASH_NRF_RADIO_SYNC_TICKER=y CONFIG_ZTEST=y diff --git a/tests/bluetooth/init/prj_ctlr_dbg.conf b/tests/bluetooth/init/prj_ctlr_dbg.conf index cc6f478b66b..956c562c5aa 100644 --- a/tests/bluetooth/init/prj_ctlr_dbg.conf +++ b/tests/bluetooth/init/prj_ctlr_dbg.conf @@ -31,6 +31,7 @@ CONFIG_BT_CTLR_SCAN_REQ_RSSI=y CONFIG_BT_CTLR_SCAN_INDICATION=y CONFIG_BT_CTLR_OPTIMIZE_FOR_SPEED=y CONFIG_BT_CTLR_PROFILE_ISR=y +CONFIG_BT_CTLR_ASSERT_DEBUG=y CONFIG_BT_CTLR_DEBUG_PINS=y CONFIG_BT_CTLR_TEST=y CONFIG_BT_HCI_VS=y diff --git a/tests/bsim/bluetooth/compile.nrf54l15bsim_nrf54l15_cpuapp.sh b/tests/bsim/bluetooth/compile.nrf54l15bsim_nrf54l15_cpuapp.sh index 9db8bbcf8d2..ee428e1a97c 100755 --- a/tests/bsim/bluetooth/compile.nrf54l15bsim_nrf54l15_cpuapp.sh +++ b/tests/bsim/bluetooth/compile.nrf54l15bsim_nrf54l15_cpuapp.sh @@ -13,6 +13,11 @@ export BOARD="${BOARD:-nrf54l15bsim/nrf54l15/cpuapp}" source ${ZEPHYR_BASE}/tests/bsim/compile.source +app=tests/bsim/bluetooth/ll/advx compile +app=tests/bsim/bluetooth/ll/advx conf_overlay=overlay-ticker_expire_info.conf compile +app=tests/bsim/bluetooth/ll/advx conf_overlay=overlay-scan_aux_use_chains.conf compile +app=tests/bsim/bluetooth/ll/conn conf_file=prj_split.conf compile +app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_privacy.conf compile app=tests/bsim/bluetooth/ll/throughput compile app=tests/bsim/bluetooth/ll/throughput conf_overlay=overlay-no_phy_update.conf compile app=tests/bsim/bluetooth/ll/multiple_id compile diff --git a/tests/bsim/bluetooth/ll/advx/src/main.c b/tests/bsim/bluetooth/ll/advx/src/main.c index cd9f0a4cd50..ac9d99976c5 100644 --- a/tests/bsim/bluetooth/ll/advx/src/main.c +++ b/tests/bsim/bluetooth/ll/advx/src/main.c @@ -29,7 +29,11 @@ #define EVT_PROP_TXP BIT(6) #define ADV_INTERVAL 0x20 /* 20 ms advertising interval */ #define ADV_WAIT_MS 10 /* 10 ms wait loop */ +#if defined(CONFIG_BT_CTLR_PRIVACY) +#define OWN_ADDR_TYPE BT_HCI_OWN_ADDR_RPA_OR_RANDOM +#else /* !CONFIG_BT_CTLR_PRIVACY */ #define OWN_ADDR_TYPE BT_HCI_OWN_ADDR_RANDOM +#endif /* !CONFIG_BT_CTLR_PRIVACY */ #define PEER_ADDR_TYPE BT_HCI_OWN_ADDR_RANDOM #define PEER_ADDR peer_addr #define ADV_CHAN_MAP 0x07 @@ -675,28 +679,32 @@ static void test_advx_main(void) k_sleep(K_MSEC(1000)); - printk("Add to resolving list..."); - bt_addr_le_t peer_id_addr = { - .type = BT_ADDR_LE_RANDOM, - .a = { - .val = {0xc6, 0xc7, 0xc8, 0xc9, 0xc1, 0xcb} - } - }; - uint8_t pirk[16] = {0x00, }; - uint8_t lirk[16] = {0x01, }; + if (IS_ENABLED(CONFIG_BT_CTLR_PRIVACY)) { + printk("Add to resolving list..."); + bt_addr_le_t peer_id_addr = { + .type = BT_ADDR_LE_RANDOM, + .a = { + .val = {0xc6, 0xc7, 0xc8, 0xc9, 0xc1, 0xcb} + } + }; + uint8_t pirk[16] = {0xAB, 0xBA, 0xAB, 0xBA, 0xAB, 0xBA, 0xAB, 0xBA, + 0xAB, 0xBA, 0xAB, 0xBA, 0xAB, 0xBA, 0xAB, 0xBA}; + uint8_t lirk[16] = {0x12, 0x21, 0x12, 0x21, 0x12, 0x21, 0x12, 0x21, + 0x12, 0x21, 0x12, 0x21, 0x12, 0x21, 0x12, 0x21}; - err = ll_rl_add(&peer_id_addr, pirk, lirk); - if (err) { - goto exit; - } - printk("success.\n"); + err = ll_rl_add(&peer_id_addr, pirk, lirk); + if (err) { + goto exit; + } + printk("success.\n"); - printk("Enable resolving list..."); - err = ll_rl_enable(BT_HCI_ADDR_RES_ENABLE); - if (err) { - goto exit; + printk("Enable resolving list..."); + err = ll_rl_enable(BT_HCI_ADDR_RES_ENABLE); + if (err) { + goto exit; + } + printk("success.\n"); } - printk("success.\n"); printk("Enabling extended..."); err = ll_adv_enable(handle, 1, 0, 0); @@ -1716,28 +1724,46 @@ static void test_scanx_main(void) } printk("done.\n"); - printk("Add to resolving list..."); bt_addr_le_t peer_id_addr = { .type = BT_ADDR_LE_RANDOM, .a = { .val = {0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5} } }; - uint8_t pirk[16] = {0x01, }; - uint8_t lirk[16] = {0x00, }; - err = ll_rl_add(&peer_id_addr, pirk, lirk); - if (err) { - goto exit; - } - printk("success.\n"); + if (IS_ENABLED(CONFIG_BT_CTLR_PRIVACY)) { + printk("Add to resolving list..."); + bt_addr_le_t some_id_addr = { + .type = BT_ADDR_LE_RANDOM, + .a = { + .val = {0x78, 0x87, 0x78, 0x87, 0x78, 0x87} + } + }; + uint8_t pirk[16] = {0x12, 0x21, 0x12, 0x21, 0x12, 0x21, 0x12, 0x21, + 0x12, 0x21, 0x12, 0x21, 0x12, 0x21, 0x12, 0x21}; + uint8_t lirk[16] = {0xCD, 0xDC, 0xCD, 0xDC, 0xCD, 0xDC, 0xCD, 0xDC, + 0xCD, 0xDC, 0xCD, 0xDC, 0xCD, 0xDC, 0xCD, 0xDC}; + + /* some_id_addr with swapped peer IRK and local IRK */ + err = ll_rl_add(&some_id_addr, lirk, pirk); + if (err) { + goto exit; + } - printk("Enable resolving list..."); - err = ll_rl_enable(BT_HCI_ADDR_RES_ENABLE); - if (err) { - goto exit; + /* peer_id_addr with correct peer IRK and local IRK */ + err = ll_rl_add(&peer_id_addr, pirk, lirk); + if (err) { + goto exit; + } + printk("success.\n"); + + printk("Enable resolving list..."); + err = ll_rl_enable(BT_HCI_ADDR_RES_ENABLE); + if (err) { + goto exit; + } + printk("success.\n"); } - printk("success.\n"); printk("Add device to periodic advertising list..."); err = bt_le_per_adv_list_add(&peer_id_addr, per_sid); diff --git a/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx.sh b/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx.sh index 540611f69a3..02add45e85e 100755 --- a/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx.sh +++ b/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx.sh @@ -13,10 +13,10 @@ EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf \ - -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=advx + -v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=0 -testid=advx Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf\ - -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=scanx + -v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=1 -testid=scanx Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ -D=2 -sim_length=60e6 $@ diff --git a/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_scan_aux_use_chains.sh b/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_scan_aux_use_chains.sh index 0e26ae907de..0331788a630 100755 --- a/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_scan_aux_use_chains.sh +++ b/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_scan_aux_use_chains.sh @@ -13,10 +13,10 @@ EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf_overlay-scan_aux_use_chains_conf \ - -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=advx + -v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=0 -testid=advx Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf_overlay-scan_aux_use_chains_conf \ - -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=scanx + -v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=1 -testid=scanx Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ -D=2 -sim_length=60e6 $@ diff --git a/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_ticker_expire_info.sh b/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_ticker_expire_info.sh index cabee84f015..65573263917 100755 --- a/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_ticker_expire_info.sh +++ b/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_ticker_expire_info.sh @@ -13,10 +13,10 @@ EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf_overlay-ticker_expire_info_conf \ - -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=advx + -v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=0 -testid=advx Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf_overlay-ticker_expire_info_conf \ - -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=scanx + -v=${verbosity_level} -s=${simulation_id} -RealEncryption=1 -d=1 -testid=scanx Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ -D=2 -sim_length=60e6 $@ diff --git a/tests/bsim/bluetooth/tests.nrf54l15bsim_nrf54l15_cpuapp.txt b/tests/bsim/bluetooth/tests.nrf54l15bsim_nrf54l15_cpuapp.txt index d5dee727d5e..d289755e9fb 100644 --- a/tests/bsim/bluetooth/tests.nrf54l15bsim_nrf54l15_cpuapp.txt +++ b/tests/bsim/bluetooth/tests.nrf54l15bsim_nrf54l15_cpuapp.txt @@ -1,5 +1,8 @@ # Search paths(s) for tests which will be run in the nrf54l15 app core # This file is used in CI to select which tests are run +tests/bsim/bluetooth/ll/advx/ +tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_encrypted_split.sh +tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_encrypted_split_privacy.sh tests/bsim/bluetooth/ll/throughput/ tests/bsim/bluetooth/ll/multiple_id/ tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso_interleaved.sh