From d57681519e54db8eaea9e9b848a9bf97dfee7c68 Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Tue, 13 Sep 2022 08:55:17 +0200 Subject: [PATCH 1/3] lib: hci: Add stm32wba BLE controller library Make required changes to port STM32WBA BLE controller library on Zephyr. This work is made of two parts: - Configure zephyr/module.yaml to allow importation of the 2 required binary blobs that are required to get a BLE stack working with STM32WBA A copy of the license required to use these binary blobs (ST ULTIMATE LIBERTY) is made available as part of this commit - Import bluetooth controller related files that are needed to implement a BLE controller library. These files are provided with OSI approved Licenses (BSD-3 of MIT depending on the case). Signed-off-by: Erwan Gouriou --- lib/CMakeLists.txt | 49 +- lib/stm32wba/hci/LICENSE.md | 27 + lib/stm32wba/hci/README | 96 + lib/stm32wba/hci/RTDebug.c | 80 + lib/stm32wba/hci/RTDebug.h | 88 + lib/stm32wba/hci/app_common.h | 115 + lib/stm32wba/hci/app_conf.h | 547 ++ lib/stm32wba/hci/app_debug.h | 59 + lib/stm32wba/hci/app_entry.h | 78 + lib/stm32wba/hci/auto/ble_types.h | 4665 +++++++++++++++++ lib/stm32wba/hci/ble_bufsize.h | 144 + lib/stm32wba/hci/ble_const.h | 90 + lib/stm32wba/hci/ble_defs.h | 480 ++ lib/stm32wba/hci/ble_std.h | 368 ++ lib/stm32wba/hci/bleplat.h | 238 + lib/stm32wba/hci/blestack.h | 232 + lib/stm32wba/hci/bpka.c | 223 + lib/stm32wba/hci/bpka.h | 59 + lib/stm32wba/hci/debug_config.h | 1524 ++++++ lib/stm32wba/hci/debug_signals.h | 807 +++ lib/stm32wba/hci/hw.h | 486 ++ lib/stm32wba/hci/hw_aes.c | 179 + lib/stm32wba/hci/hw_if.h | 288 + lib/stm32wba/hci/hw_pka.c | 172 + lib/stm32wba/hci/linklayer_plat.h | 183 + .../hci/ll/_40nm_reg_files/DWC_ble154combo.h | 61 + lib/stm32wba/hci/ll/bsp.h | 593 +++ lib/stm32wba/hci/ll/common_types.h | 419 ++ lib/stm32wba/hci/ll/event_manager.h | 352 ++ lib/stm32wba/hci/ll/evnt_schdlr_gnrc_if.h | 209 + lib/stm32wba/hci/ll/hci.h | 236 + lib/stm32wba/hci/ll/ll_fw_config.h | 100 + lib/stm32wba/hci/ll/ll_intf.h | 4408 ++++++++++++++++ lib/stm32wba/hci/ll/mem_intf.h | 98 + lib/stm32wba/hci/ll/os_wrapper.h | 501 ++ lib/stm32wba/hci/ll/power_table.h | 104 + lib/stm32wba/hci/ll_sys.h | 100 + lib/stm32wba/hci/ll_sys_cs.c | 70 + lib/stm32wba/hci/ll_sys_dp_slp.c | 177 + lib/stm32wba/hci/ll_sys_intf.c | 172 + lib/stm32wba/hci/ll_sys_startup.c | 98 + lib/stm32wba/hci/ll_sys_startup.h | 29 + lib/stm32wba/hci/local_debug_tables.h | 1138 ++++ lib/stm32wba/hci/log_module.c | 318 ++ lib/stm32wba/hci/log_module.h | 368 ++ lib/stm32wba/hci/main.h | 82 + lib/stm32wba/hci/pka_p256.c | 237 + lib/stm32wba/hci/power_table.c | 119 + lib/stm32wba/hci/scm.c | 848 +++ lib/stm32wba/hci/scm.h | 223 + lib/stm32wba/hci/stm32_adv_trace.h | 273 + lib/stm32wba/hci/stm32_mem.h | 70 + lib/stm32wba/hci/stm32_timer.h | 303 ++ lib/stm32wba/hci/stm32_tiny_vsnprintf.h | 60 + lib/stm32wba/hci/stm32_wpan_common.h | 130 + lib/stm32wba/hci/utilities_common.h | 144 + lib/stm32wba/hci/utilities_conf.h | 170 + zephyr/blobs/stm32wba/lib/license.md | 80 + zephyr/module.yml | 15 + 59 files changed, 23581 insertions(+), 1 deletion(-) create mode 100644 lib/stm32wba/hci/LICENSE.md create mode 100644 lib/stm32wba/hci/README create mode 100644 lib/stm32wba/hci/RTDebug.c create mode 100644 lib/stm32wba/hci/RTDebug.h create mode 100644 lib/stm32wba/hci/app_common.h create mode 100644 lib/stm32wba/hci/app_conf.h create mode 100644 lib/stm32wba/hci/app_debug.h create mode 100644 lib/stm32wba/hci/app_entry.h create mode 100644 lib/stm32wba/hci/auto/ble_types.h create mode 100644 lib/stm32wba/hci/ble_bufsize.h create mode 100644 lib/stm32wba/hci/ble_const.h create mode 100644 lib/stm32wba/hci/ble_defs.h create mode 100644 lib/stm32wba/hci/ble_std.h create mode 100644 lib/stm32wba/hci/bleplat.h create mode 100644 lib/stm32wba/hci/blestack.h create mode 100644 lib/stm32wba/hci/bpka.c create mode 100644 lib/stm32wba/hci/bpka.h create mode 100644 lib/stm32wba/hci/debug_config.h create mode 100644 lib/stm32wba/hci/debug_signals.h create mode 100644 lib/stm32wba/hci/hw.h create mode 100644 lib/stm32wba/hci/hw_aes.c create mode 100644 lib/stm32wba/hci/hw_if.h create mode 100644 lib/stm32wba/hci/hw_pka.c create mode 100644 lib/stm32wba/hci/linklayer_plat.h create mode 100644 lib/stm32wba/hci/ll/_40nm_reg_files/DWC_ble154combo.h create mode 100644 lib/stm32wba/hci/ll/bsp.h create mode 100644 lib/stm32wba/hci/ll/common_types.h create mode 100644 lib/stm32wba/hci/ll/event_manager.h create mode 100644 lib/stm32wba/hci/ll/evnt_schdlr_gnrc_if.h create mode 100644 lib/stm32wba/hci/ll/hci.h create mode 100644 lib/stm32wba/hci/ll/ll_fw_config.h create mode 100644 lib/stm32wba/hci/ll/ll_intf.h create mode 100644 lib/stm32wba/hci/ll/mem_intf.h create mode 100644 lib/stm32wba/hci/ll/os_wrapper.h create mode 100644 lib/stm32wba/hci/ll/power_table.h create mode 100644 lib/stm32wba/hci/ll_sys.h create mode 100644 lib/stm32wba/hci/ll_sys_cs.c create mode 100644 lib/stm32wba/hci/ll_sys_dp_slp.c create mode 100644 lib/stm32wba/hci/ll_sys_intf.c create mode 100644 lib/stm32wba/hci/ll_sys_startup.c create mode 100644 lib/stm32wba/hci/ll_sys_startup.h create mode 100644 lib/stm32wba/hci/local_debug_tables.h create mode 100644 lib/stm32wba/hci/log_module.c create mode 100644 lib/stm32wba/hci/log_module.h create mode 100644 lib/stm32wba/hci/main.h create mode 100644 lib/stm32wba/hci/pka_p256.c create mode 100644 lib/stm32wba/hci/power_table.c create mode 100644 lib/stm32wba/hci/scm.c create mode 100644 lib/stm32wba/hci/scm.h create mode 100644 lib/stm32wba/hci/stm32_adv_trace.h create mode 100644 lib/stm32wba/hci/stm32_mem.h create mode 100644 lib/stm32wba/hci/stm32_timer.h create mode 100644 lib/stm32wba/hci/stm32_tiny_vsnprintf.h create mode 100644 lib/stm32wba/hci/stm32_wpan_common.h create mode 100644 lib/stm32wba/hci/utilities_common.h create mode 100644 lib/stm32wba/hci/utilities_conf.h create mode 100644 zephyr/blobs/stm32wba/lib/license.md diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 4d2d9f42e..1003cb6d3 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -16,4 +16,51 @@ if(CONFIG_HAS_STM32LIB) zephyr_sources(stm32wb/hci/tl_mbox.c) endif() -endif() \ No newline at end of file + + if(CONFIG_BT_STM32WBA) + + if(DEFINED CONFIG_BOARD_NUCLEO_WBA52CG) + message(FATAL_ERROR "BLE library is not compatible with nucleo_wba52cg") + endif() + + zephyr_compile_definitions( -DBLE ) + + zephyr_include_directories(stm32wba/hci) + zephyr_include_directories(stm32wba/hci/ll) + + zephyr_sources(stm32wba/hci/ll_sys_cs.c) + zephyr_sources(stm32wba/hci/ll_sys_intf.c) + zephyr_sources(stm32wba/hci/ll_sys_dp_slp.c) + zephyr_sources(stm32wba/hci/ll_sys_startup.c) + zephyr_sources(stm32wba/hci/RTDebug.c) + zephyr_sources(stm32wba/hci/hw_pka.c) + zephyr_sources(stm32wba/hci/pka_p256.c) + zephyr_sources(stm32wba/hci/bpka.c) + zephyr_sources(stm32wba/hci/power_table.c) + zephyr_sources(stm32wba/hci/scm.c) + + set(STM32WBA_BLE_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../zephyr/blobs/stm32wba/lib) + set(STM32WBA_BLE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/stm32wba/hci) + + add_library(stm32wba_ble_lib STATIC IMPORTED GLOBAL) + add_library(stm32wba_ll_lib STATIC IMPORTED GLOBAL) + + add_dependencies( + stm32wba_ble_lib + stm32wba_ll_lib + ) + set_target_properties( + stm32wba_ble_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_BLE_LIB_DIR}/stm32wba_ble_stack_llo.a + ) + set_target_properties( + stm32wba_ll_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_BLE_LIB_DIR}/LinkLayer_BLE_Full_lib.a + ) + + set_target_properties(stm32wba_ble_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${STM32WBA_BLE_INCLUDE_DIR}) + set_target_properties(stm32wba_ll_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${STM32WBA_BLE_INCLUDE_DIR}) + + target_link_libraries(app PUBLIC stm32wba_ble_lib) + target_link_libraries(app PUBLIC stm32wba_ll_lib) + + endif() +endif() diff --git a/lib/stm32wba/hci/LICENSE.md b/lib/stm32wba/hci/LICENSE.md new file mode 100644 index 000000000..06b212251 --- /dev/null +++ b/lib/stm32wba/hci/LICENSE.md @@ -0,0 +1,27 @@ +Copyright 2019-2021 STMicroelectronics. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/lib/stm32wba/hci/README b/lib/stm32wba/hci/README new file mode 100644 index 000000000..5c4a5b621 --- /dev/null +++ b/lib/stm32wba/hci/README @@ -0,0 +1,96 @@ +STM32WBA BLE controller interfacing library +########################################### + +Origin: + ST Microelectronics + https://github.com/STMicroelectronics/STM32CubeWBA + +Status: + version v1.1.2 + +Purpose: + This library is used on STM32WBA series to port BLE controller library in + a hosting environment (Zephyr RTOS in current case). + +Description: + + This library is using the following files extracted the STM32CubeWBA package: + Middlewares/ST/STM32_WPAN/ble/stack/include/auto/ble_types.h + Middlewares/ST/STM32_WPAN/ble/stack/include/ble_bufsize.h + Middlewares/ST/STM32_WPAN/ble/stack/include/ble_const.h + Middlewares/ST/STM32_WPAN/ble/stack/include/ble_defs.h + Middlewares/ST/STM32_WPAN/ble/stack/include/ble_std.h + Middlewares/ST/STM32_WPAN/ble/stack/include/bleplat.h + Middlewares/ST/STM32_WPAN/ble/stack/include/blestack.h + Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/_40nm_reg_files/DWC_ble154combo.h + Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/bsp.h + Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/common_types.h + Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/event_manager.h + Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/evnt_schdlr_gnrc_if.h + Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/hci.h + Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/ll_intf.h + Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/mem_intf.h + Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/os_wrapper.h + Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/power_table.h + Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/config/ble_full/ll_fw_config.h + Middlewares/ST/STM32_WPAN/link_layer/ll_sys/inc/linklayer_plat.h + Middlewares/ST/STM32_WPAN/link_layer/ll_sys/inc/ll_sys.h + Middlewares/ST/STM32_WPAN/link_layer/ll_sys/src/ll_sys_cs.c + Middlewares/ST/STM32_WPAN/link_layer/ll_sys/src/ll_sys_dp_slp.c + Middlewares/ST/STM32_WPAN/link_layer/ll_sys/src/ll_sys_intf.c + Middlewares/ST/STM32_WPAN/link_layer/ll_sys/src/ll_sys_startup.c + Middlewares/ST/STM32_WPAN/link_layer/ll_sys/inc/ll_sys_startup.h + Middlewares/ST/STM32_WPAN/stm32_wpan_common.h + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/Core/Inc/app_common.h + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/Core/Inc/app_conf.h + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/Core/Inc/app_entry.h + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/Core/Inc/utilities_conf.h + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/Core/Inc/main.h + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/System/Modules/RTDebug/debug_signals.h + Projects/NUCLEO-WBA55CG/Applications/BLE/BLE_HeartRate/System/Modules/RTDebug/RTDebug.c + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/System/Modules/RTDebug/RTDebug.h + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/System/Modules/RTDebug/local_debug_tables.h + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/System/Modules/scm.c + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/System/Modules/scm.h + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/System/Modules/utilities_common.h + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/System/Interfaces/hw.h + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/System/Interfaces/hw_aes.c + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/System/Interfaces/hw_if.h + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/System/Interfaces/hw_pka.c + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/System/Interfaces/pka_p256.c + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/System/Config/Log/log_module.c + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/System/Config/Log/log_module.h + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/System/Config/Debug_GPIO/app_debug.h + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/System/Config/Debug_GPIO/debug_config.h + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/STM32_WPAN/Target/power_table.c + Projects/NUCLEO-WBA52CG/Applications/BLE/BLE_HeartRate/STM32_WPAN/Target/bpka.c + Projects/NUCLEO-WBA55CG/Applications/BLE/BLE_HeartRate/STM32_WPAN/Target/bpka.h + Utilities/trace/adv_trace/stm32_adv_trace.h + Utilities/misc/stm32_mem.h + Utilities/tim_serv/stm32_timer.h + Utilities/misc/stm32_tiny_vsnprintf.h + +Dependencies: + This library depends on STM32Cube HAL API. + It is available in stm32cube/stm32wbaxx/drivers + +URL: + https://github.com/STMicroelectronics/STM32CubeWBA + +commit: + v1.2.0 + +Maintained-by: + External + +License: + BSD-3-Clause + MIT + +License Link: + opensource.org/licenses/BSD-3-Clause + opensource.org/license/mit + +Patch List: + + * NA diff --git a/lib/stm32wba/hci/RTDebug.c b/lib/stm32wba/hci/RTDebug.c new file mode 100644 index 000000000..e4598ca3b --- /dev/null +++ b/lib/stm32wba/hci/RTDebug.c @@ -0,0 +1,80 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file RTDebug.c + * @author MCD Application Team + * @brief Real Time Debug module API definition + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ +#include "RTDebug.h" +#include "local_debug_tables.h" +#include "stm32wbaxx_hal.h" +#include + +#if(CFG_RT_DEBUG_GPIO_MODULE == 1) +static_assert((sizeof(general_debug_table)/sizeof(st_gpio_debug_t)) == RT_DEBUG_SIGNALS_TOTAL_NUM, + "Debug signals number is different from debug signal table size." +); +#endif /* CFG_RT_DEBUG_GPIO_MODULE */ + +/***********************/ +/** System debug APIs **/ +/***********************/ + +void SYSTEM_DEBUG_SIGNAL_SET(system_debug_signal_t signal) +{ +#if(CFG_RT_DEBUG_GPIO_MODULE == 1) + GENERIC_DEBUG_GPIO_SET(signal, system_debug_table); +#endif /* CFG_RT_DEBUG_GPIO_MODULE */ +} + +void SYSTEM_DEBUG_SIGNAL_RESET(system_debug_signal_t signal) +{ +#if(CFG_RT_DEBUG_GPIO_MODULE == 1) + GENERIC_DEBUG_GPIO_RESET(signal, system_debug_table); +#endif /* CFG_RT_DEBUG_GPIO_MODULE */ +} + +void SYSTEM_DEBUG_SIGNAL_TOGGLE(system_debug_signal_t signal) +{ +#if(CFG_RT_DEBUG_GPIO_MODULE == 1) + GENERIC_DEBUG_GPIO_TOGGLE(signal, system_debug_table); +#endif /* CFG_RT_DEBUG_GPIO_MODULE */ +} + +/***************************/ +/** Link Layer debug APIs **/ +/***************************/ + +/* Link Layer debug API definition */ +void LINKLAYER_DEBUG_SIGNAL_SET(linklayer_debug_signal_t signal) +{ +#if(CFG_RT_DEBUG_GPIO_MODULE == 1) + GENERIC_DEBUG_GPIO_SET(signal, linklayer_debug_table); +#endif /* CFG_RT_DEBUG_GPIO_MODULE */ +} + +void LINKLAYER_DEBUG_SIGNAL_RESET(linklayer_debug_signal_t signal) +{ +#if(CFG_RT_DEBUG_GPIO_MODULE == 1) + GENERIC_DEBUG_GPIO_RESET(signal, linklayer_debug_table); +#endif /* CFG_RT_DEBUG_GPIO_MODULE */ +} + +void LINKLAYER_DEBUG_SIGNAL_TOGGLE(linklayer_debug_signal_t signal) +{ +#if(CFG_RT_DEBUG_GPIO_MODULE == 1) + GENERIC_DEBUG_GPIO_TOGGLE(signal, linklayer_debug_table); +#endif /* CFG_RT_DEBUG_GPIO_MODULE */ +} diff --git a/lib/stm32wba/hci/RTDebug.h b/lib/stm32wba/hci/RTDebug.h new file mode 100644 index 000000000..d983f426c --- /dev/null +++ b/lib/stm32wba/hci/RTDebug.h @@ -0,0 +1,88 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file RTDebug.h + * @author MCD Application Team + * @brief Real Time Debug module API declaration + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ +#ifndef SYSTEM_DEBUG_H +#define SYSTEM_DEBUG_H + +#include "debug_config.h" + +#if(CFG_RT_DEBUG_GPIO_MODULE == 1) + +/**************************************************************/ +/** Generic macros for local signal table index recuperation **/ +/** and global signal table GPIO manipulation **/ +/**************************************************************/ + +#define GENERIC_DEBUG_GPIO_SET(signal, table) do { \ + uint32_t debug_table_idx = 0; \ + if(signal >= sizeof(table)) \ + { \ + return; \ + } \ + debug_table_idx = table[signal]; \ + if(debug_table_idx != RT_DEBUG_SIGNAL_UNUSED) \ + { \ + HAL_GPIO_WritePin(general_debug_table[debug_table_idx].GPIO_port, \ + general_debug_table[debug_table_idx].GPIO_pin, \ + GPIO_PIN_SET); \ + } \ +} while(0) + +#define GENERIC_DEBUG_GPIO_RESET(signal, table) do { \ + uint32_t debug_table_idx = 0; \ + if(signal >= sizeof(table)) \ + { \ + return; \ + } \ + debug_table_idx = table[signal]; \ + if(debug_table_idx != RT_DEBUG_SIGNAL_UNUSED) \ + { \ + HAL_GPIO_WritePin(general_debug_table[debug_table_idx].GPIO_port, \ + general_debug_table[debug_table_idx].GPIO_pin, \ + GPIO_PIN_RESET); \ + } \ +} while(0) + +#define GENERIC_DEBUG_GPIO_TOGGLE(signal, table) do { \ + uint32_t debug_table_idx = 0; \ + if(signal >= sizeof(table)) \ + { \ + return; \ + } \ + debug_table_idx = table[signal]; \ + if(debug_table_idx != RT_DEBUG_SIGNAL_UNUSED) \ + { \ + HAL_GPIO_TogglePin(general_debug_table[debug_table_idx].GPIO_port, \ + general_debug_table[debug_table_idx].GPIO_pin); \ + } \ +} while(0) + +#endif /* CFG_RT_DEBUG_GPIO_MODULE */ + +/* System debug API definition */ +void SYSTEM_DEBUG_SIGNAL_SET(system_debug_signal_t signal); +void SYSTEM_DEBUG_SIGNAL_RESET(system_debug_signal_t signal); +void SYSTEM_DEBUG_SIGNAL_TOGGLE(system_debug_signal_t signal); + +/* Link Layer debug API definition */ +void LINKLAYER_DEBUG_SIGNAL_SET(linklayer_debug_signal_t signal); +void LINKLAYER_DEBUG_SIGNAL_RESET(linklayer_debug_signal_t signal); +void LINKLAYER_DEBUG_SIGNAL_TOGGLE(linklayer_debug_signal_t signal); + +#endif /* SYSTEM_DEBUG_H */ diff --git a/lib/stm32wba/hci/app_common.h b/lib/stm32wba/hci/app_common.h new file mode 100644 index 000000000..4d3f2f49f --- /dev/null +++ b/lib/stm32wba/hci/app_common.h @@ -0,0 +1,115 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file app_common.h + * @author MCD Application Team + * @brief App Common application configuration file for STM32WPAN Middleware. + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef APP_COMMON_H +#define APP_COMMON_H + +#ifdef __cplusplus +extern "C"{ +#endif + +#include +#include +#include +#include +#include + +#include "app_conf.h" +#include "hw.h" +#include "ll_sys.h" + +/* -------------------------------- * + * Basic definitions * + * -------------------------------- */ +#undef NULL +#define NULL 0 + +#undef FALSE +#define FALSE 0 + +#undef TRUE +#define TRUE (!0) + +/* -------------------------------- * + * Critical Section definition * + * -------------------------------- */ +#define BACKUP_PRIMASK() uint32_t primask_bit= __get_PRIMASK() +#define DISABLE_IRQ() __disable_irq() +#define RESTORE_PRIMASK() __set_PRIMASK(primask_bit) + +/* -------------------------------- * + * Macro delimiters * + * -------------------------------- */ +#define M_BEGIN do { + +#define M_END } while(0) + +/* -------------------------------- * + * Some useful macro definitions * + * -------------------------------- */ +#ifndef MAX +#define MAX( x, y ) (((x)>(y))?(x):(y)) +#endif + +#ifndef MIN +#define MIN( x, y ) (((x)<(y))?(x):(y)) +#endif + +#define MODINC( a, m ) M_BEGIN (a)++; if ((a)>=(m)) (a)=0; M_END + +#define MODDEC( a, m ) M_BEGIN if ((a)==0) (a)=(m); (a)--; M_END + +#define MODADD( a, b, m ) M_BEGIN (a)+=(b); if ((a)>=(m)) (a)-=(m); M_END + +#define MODSUB( a, b, m ) MODADD( a, (m)-(b), m ) + +#define PAUSE( t ) M_BEGIN \ + __IO int _i; \ + for ( _i = t; _i > 0; _i -- ); \ + M_END + +#define DIVF( x, y ) ((x)/(y)) + +#define DIVC( x, y ) (((x)+(y)-1)/(y)) + +#define DIVR( x, y ) (((x)+((y)/2))/(y)) + +#define SHRR( x, n ) ((((x)>>((n)-1))+1)>>1) + +#define BITN( w, n ) (((w)[(n)/32] >> ((n)%32)) & 1) + +#define BITNSET( w, n, b ) M_BEGIN (w)[(n)/32] |= ((U32)(b))<<((n)%32); M_END + +/* -------------------------------- * + * Compiler * + * -------------------------------- */ +#define PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__))) + +#ifdef WIN32 +#define ALIGN(n) +#else +#define ALIGN(n) __attribute__((aligned(n))) +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*APP_COMMON_H */ diff --git a/lib/stm32wba/hci/app_conf.h b/lib/stm32wba/hci/app_conf.h new file mode 100644 index 000000000..bba699839 --- /dev/null +++ b/lib/stm32wba/hci/app_conf.h @@ -0,0 +1,547 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file app_conf.h + * @author MCD Application Team + * @brief Application configuration file for STM32WPAN Middleware. + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef APP_CONF_H +#define APP_CONF_H + +/* Includes ------------------------------------------------------------------*/ +#include "hw_if.h" +#include "utilities_conf.h" +#include "log_module.h" + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/****************************************************************************** + * Application Config + ******************************************************************************/ +/**< generic parameters ******************************************************/ + +/** + * Define Tx Power + */ +#define CFG_TX_POWER (0x19) /* 0x19 <=> -0.3 dBm */ + +/** + * Define Advertising parameters + */ +#define CFG_BD_ADDRESS (0x0008E12A1234) + +/** + * Define BD_ADDR type: define proper address. Can only be GAP_PUBLIC_ADDR (0x00) or GAP_STATIC_RANDOM_ADDR (0x01) + */ +#define CFG_BD_ADDRESS_TYPE (GAP_PUBLIC_ADDR) + +/** + * Define privacy: PRIVACY_DISABLED or PRIVACY_ENABLED + */ +#define CFG_PRIVACY (PRIVACY_DISABLED) + +/** + * Define BLE Address Type + * Bluetooth address types defined in ble_legacy.h + * if CFG_PRIVACY equals PRIVACY_DISABLED, CFG_BLE_ADDRESS_TYPE has 2 allowed values: GAP_PUBLIC_ADDR or GAP_STATIC_RANDOM_ADDR + * if CFG_PRIVACY equals PRIVACY_ENABLED, CFG_BLE_ADDRESS_TYPE has 2 allowed values: GAP_RESOLVABLE_PRIVATE_ADDR or GAP_NON_RESOLVABLE_PRIVATE_ADDR + */ +#define CFG_BLE_ADDRESS_TYPE (GAP_PUBLIC_ADDR) + +#define ADV_INTERVAL_MIN (0x0080) +#define ADV_INTERVAL_MAX (0x00A0) +#define ADV_LP_INTERVAL_MIN (0x0640) +#define ADV_LP_INTERVAL_MAX (0x0FA0) +#define ADV_TYPE ADV_IND +#define ADV_FILTER NO_WHITE_LIST_USE + +/** + * Define IO Authentication + */ +#define CFG_BONDING_MODE (1) +#define CFG_USED_FIXED_PIN (0) /* 0->fixed pin is used ; 1->No fixed pin used*/ +#define CFG_FIXED_PIN (111111) +#define CFG_ENCRYPTION_KEY_SIZE_MAX (16) +#define CFG_ENCRYPTION_KEY_SIZE_MIN (8) + +/** + * Define Input Output capabilities + */ +#define CFG_IO_CAPABILITY (IO_CAP_DISPLAY_YES_NO) + +/** + * Define Man In The Middle modes + */ +#define CFG_MITM_PROTECTION (MITM_PROTECTION_REQUIRED) + +/** + * Define Secure Connections Support + */ +#define CFG_SC_SUPPORT (SC_PAIRING_OPTIONAL) + +/** + * Define Keypress Notification Support + */ +#define CFG_KEYPRESS_NOTIFICATION_SUPPORT (KEYPRESS_NOT_SUPPORTED) + +/** +* Identity root key used to derive IRK and DHK(Legacy) +*/ +#define CFG_BLE_IR {0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0} + +/** +* Encryption root key used to derive LTK(Legacy) and CSRK +*/ +#define CFG_BLE_ER {0xFE, 0xDC, 0xBA, 0x09, 0x87, 0x65, 0x43, 0x21, 0xFE, 0xDC, 0xBA, 0x09, 0x87, 0x65, 0x43, 0x21} + +/* USER CODE BEGIN Generic_Parameters */ + +/* USER CODE END Generic_Parameters */ + +/**< specific parameters */ +/*****************************************************/ + +/* USER CODE BEGIN Specific_Parameters */ + +/* USER CODE END Specific_Parameters */ + +/****************************************************************************** + * BLE Stack + ******************************************************************************/ +/** + * BLE stack options, bitmap to active or not some features at BleStack_Init() function call. + */ +#define CFG_BLE_OPTIONS (0 | \ + 0 | \ + 0 | \ + 0 | \ + 0 | \ + 0 | \ + 0 | \ + 0) + +/** + * Maximum number of simultaneous connections and advertising that the device will support. + * This setting should not exceed the number of BLE connection supported by BLE host stack. + */ +#define CFG_BLE_NUM_LINK (2) + +/** + * Maximum number of Services that can be stored in the GATT database. + * Note that the GAP and GATT services are automatically added so this parameter should be 2 plus the number of user services + */ +#define CFG_BLE_NUM_GATT_SERVICES (8) + +/** + * Maximum number of Attributes + * (i.e. the number of characteristic + the number of characteristic values + the number of descriptors, excluding the services) + * that can be stored in the GATT database. + * Note that certain characteristics and relative descriptors are added automatically during device initialization + * so this parameters should be 9 plus the number of user Attributes + */ +#define CFG_BLE_NUM_GATT_ATTRIBUTES (68) + +/** + * Maximum supported ATT_MTU size + * This setting should be aligned with ATT_MTU value configured in the ble host + */ +#define CFG_BLE_ATT_MTU_MAX (251) + +/** + * Size of the storage area for Attribute values + * This value depends on the number of attributes used by application. In particular the sum of the following quantities (in octets) should be made for each attribute: + * - attribute value length + * - 5, if UUID is 16 bit; 19, if UUID is 128 bit + * - 2, if server configuration descriptor is used + * - 2*DTM_NUM_LINK, if client configuration descriptor is used + * - 2, if extended properties is used + * The total amount of memory needed is the sum of the above quantities for each attribute. + */ +#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344) + +/** + * depth of the PREPARE WRITE queue when PREPARE WRITE REQUEST + */ +#define CFG_BLE_ATTR_PREPARE_WRITE_VALUE_SIZE (30) + +#define CFG_BLE_MBLOCK_COUNT_MARGIN (0x15) + +#define PREP_WRITE_LIST_SIZE (BLE_DEFAULT_PREP_WRITE_LIST_SIZE) + +/** + * Number of allocated memory blocks used to transmit and receive data packets + */ +#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(PREP_WRITE_LIST_SIZE, \ + CFG_BLE_ATT_MTU_MAX, CFG_BLE_NUM_LINK) \ + + CFG_BLE_MBLOCK_COUNT_MARGIN) + +/** + * Appearance of device set into BLE GAP + */ +#define CFG_GAP_APPEARANCE (GAP_APPEARANCE_UNKNOWN) + +/** + * Connection Oriented Channel parameters + */ +#define CFG_BLE_COC_NBR_MAX (64) +#define CFG_BLE_COC_MPS_MAX (248) +#define CFG_BLE_COC_INITIATOR_NBR_MAX (32) + +/** + * PHY preferences + */ +#define CFG_PHY_PREF (0) +#define CFG_PHY_PREF_TX (HCI_TX_PHYS_LE_2M_PREF) +#define CFG_PHY_PREF_RX (HCI_RX_PHYS_LE_2M_PREF) + +/* USER CODE BEGIN BLE_Stack */ + +/* USER CODE END BLE_Stack */ + +/****************************************************************************** + * Low Power + * + * When CFG_LPM_LEVEL is set to: + * - 0 : Low Power Mode is not activated, RUN mode will be used. + * - 1 : Low power active, the one selected with CFG_LPM_STDBY_SUPPORTED + * - 2 : In addition, force to disable modules to reach lowest power figures. + * + * When CFG_LPM_STDBY_SUPPORTED is set to: + * - 1 : Standby is used as low power mode. + * - 0 : Standby is not used, so stop mode 1 is used as low power mode. + * + ******************************************************************************/ +#define CFG_LPM_LEVEL (2) +#define CFG_LPM_STDBY_SUPPORTED (1) + +/* USER CODE BEGIN Low_Power 0 */ + +/* USER CODE END Low_Power 0 */ + +/** + * Supported requester to the MCU Low Power Manager - can be increased up to 32 + * It list a bit mapping of all user of the Low Power Manager + */ +typedef enum +{ + CFG_LPM_APP, + CFG_LPM_LOG, + /* USER CODE BEGIN CFG_LPM_Id_t */ + + /* USER CODE END CFG_LPM_Id_t */ +} CFG_LPM_Id_t; + +/* USER CODE BEGIN Low_Power 1 */ + +/* USER CODE END Low_Power 1 */ + +/* Core voltage supply selection, it can be PWR_LDO_SUPPLY or PWR_SMPS_SUPPLY */ +#define CFG_CORE_SUPPLY (PWR_LDO_SUPPLY) + +/****************************************************************************** + * RTC + ******************************************************************************/ +#define RTC_N_PREDIV_S (10) +#define RTC_PREDIV_S ((1< NO ; 1 --> YES) */ +#define USE_TEMPERATURE_BASED_RADIO_CALIBRATION (1) + +#define RADIO_INTR_NUM RADIO_IRQn /* 2.4GHz RADIO global interrupt */ +#define RADIO_INTR_PRIO_HIGH (0) /* 2.4GHz RADIO interrupt priority when radio is Active */ +#define RADIO_INTR_PRIO_LOW (5) /* 2.4GHz RADIO interrupt priority when radio is Not Active - Sleep Timer Only */ + +#if (USE_RADIO_LOW_ISR == 1) +#define RADIO_SW_LOW_INTR_NUM HASH_IRQn /* Selected interrupt vector for 2.4GHz RADIO low ISR */ +#define RADIO_SW_LOW_INTR_PRIO (15) /* 2.4GHz RADIO low ISR priority */ +#endif /* USE_RADIO_LOW_ISR */ + +/* Link Layer supported number of antennas */ +#define RADIO_NUM_OF_ANTENNAS (4) + +#define RCC_INTR_PRIO (1) /* HSERDY and PLL1RDY */ + +/* RF TX power table ID selection: + * 0 -> RF TX output level from -20 dBm to +10 dBm + * 1 -> RF TX output level from -20 dBm to +3 dBm + */ +#define CFG_RF_TX_POWER_TABLE_ID (1) + +/* USER CODE BEGIN Radio_Configuration */ + +/* USER CODE END Radio_Configuration */ + +/****************************************************************************** + * HW_RNG configuration + ******************************************************************************/ + +/* Number of 32-bit random values stored in internal pool */ +#define CFG_HW_RNG_POOL_SIZE (32) + +/* USER CODE BEGIN HW_RNG_Configuration */ + +/* USER CODE END HW_RNG_Configuration */ + +/****************************************************************************** + * MEMORY MANAGER + ******************************************************************************/ + +#define CFG_MM_POOL_SIZE (4000) +#define CFG_PWR_VOS2_SUPPORTED (0) /* VOS2 power configuration not currently supported with radio activity */ +#define CFG_AMM_VIRTUAL_MEMORY_NUMBER (2u) +#define CFG_AMM_VIRTUAL_STACK_BLE (1U) +#define CFG_AMM_VIRTUAL_STACK_BLE_BUFFER_SIZE (400U) +#define CFG_AMM_VIRTUAL_APP_BLE (2U) +#define CFG_AMM_VIRTUAL_APP_BLE_BUFFER_SIZE (200U) +#define CFG_AMM_POOL_SIZE DIVC(CFG_MM_POOL_SIZE, sizeof (uint32_t)) \ + + (AMM_VIRTUAL_INFO_ELEMENT_SIZE * CFG_AMM_VIRTUAL_MEMORY_NUMBER) + +/* USER CODE BEGIN MEMORY_MANAGER_Configuration */ + +/* USER CODE END MEMORY_MANAGER_Configuration */ + +/* USER CODE BEGIN Defines */ +/** + * User interaction + * When CFG_LED_SUPPORTED is set, LEDS are activated if requested + * When CFG_BUTTON_SUPPORTED is set, the push button are activated if requested + */ + +#define CFG_LED_SUPPORTED (0) +#define CFG_BUTTON_SUPPORTED (1) + +/** + * Overwrite some configuration imposed by Low Power level selected. + */ +#if (CFG_LPM_LEVEL > 1) + #if CFG_LED_SUPPORTED + #undef CFG_LED_SUPPORTED + #define CFG_LED_SUPPORTED (0) + #endif /* CFG_LED_SUPPORTED */ +#endif /* CFG_LPM_LEVEL */ + +/* USER CODE END Defines */ + +/** + * Overwrite some configuration imposed by Low Power level selected. + */ +#if (CFG_LPM_LEVEL > 1) + #if CFG_LOG_SUPPORTED + #undef CFG_LOG_SUPPORTED + #define CFG_LOG_SUPPORTED (0) + #endif /* CFG_LOG_SUPPORTED */ + #if CFG_DEBUGGER_LEVEL + #undef CFG_DEBUGGER_LEVEL + #define CFG_DEBUGGER_LEVEL (0) + #endif /* CFG_DEBUGGER_LEVEL */ +#endif /* CFG_LPM_LEVEL */ + +#if (CFG_LPM_STDBY_SUPPORTED == 1) + #if CFG_LOG_SUPPORTED + #undef CFG_LOG_SUPPORTED + #define CFG_LOG_SUPPORTED (0) + #endif /* CFG_LOG_SUPPORTED */ +#endif /* CFG_LPM_STDBY_SUPPORTED */ + +/* USER CODE BEGIN Defines_2 */ + +/* USER CODE END Defines_2 */ + +#endif /*APP_CONF_H */ diff --git a/lib/stm32wba/hci/app_debug.h b/lib/stm32wba/hci/app_debug.h new file mode 100644 index 000000000..9b8c28b90 --- /dev/null +++ b/lib/stm32wba/hci/app_debug.h @@ -0,0 +1,59 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file app_debug.h + * @author MCD Application Team + * @brief Real Time Debug module application APIs and signal table + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ +#ifndef APP_DEBUG_H +#define APP_DEBUG_H + +#include "RTDebug.h" + +/***************************************************/ +/** Specific application debug signals definition **/ +/***************************************************/ +typedef enum { + APP_APPE_INIT, +} app_debug_signal_t; + +#if(CFG_RT_DEBUG_GPIO_MODULE == 1) + +/************************************/ +/** Application local signal table **/ +/************************************/ +static const rt_debug_signal_t app_debug_table[] = { +#if (USE_RT_DEBUG_APP_APPE_INIT == 1) + [APP_APPE_INIT] = RT_DEBUG_APP_APPE_INIT, +#else + [APP_APPE_INIT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_APP_APPE_INIT */ +}; + +#endif /* CFG_RT_DEBUG_GPIO_MODULE */ + +/**************************************/ +/** Application debug API definition **/ +/**************************************/ +void APP_DEBUG_SIGNAL_SET(app_debug_signal_t signal); +void APP_DEBUG_SIGNAL_RESET(app_debug_signal_t signal); +void APP_DEBUG_SIGNAL_TOGGLE(app_debug_signal_t signal); + +/*******************************/ +/** Debug GPIO Initialization **/ +/*******************************/ +void RT_DEBUG_GPIO_Init(void); + +#endif /* APP_DEBUG_H */ diff --git a/lib/stm32wba/hci/app_entry.h b/lib/stm32wba/hci/app_entry.h new file mode 100644 index 000000000..510e20f24 --- /dev/null +++ b/lib/stm32wba/hci/app_entry.h @@ -0,0 +1,78 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file app_entry.h + * @author MCD Application Team + * @brief Interface to the application + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef APP_ENTRY_H +#define APP_ENTRY_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ + +/* Private includes ----------------------------------------------------------*/ +#include "app_common.h" +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* Exported types ------------------------------------------------------------*/ +/* USER CODE BEGIN ET */ + +/* USER CODE END ET */ + +/* Exported constants --------------------------------------------------------*/ +#define WPAN_SUCCESS 0u + +/* USER CODE BEGIN EC */ + +/* USER CODE END EC */ + +/* Exported variables --------------------------------------------------------*/ +/* USER CODE BEGIN EV */ + +/* USER CODE END EV */ + +/* Exported macros ------------------------------------------------------------*/ +/* USER CODE BEGIN EM */ + +/* USER CODE END EM */ + +/* Exported functions prototypes ---------------------------------------------*/ +void MX_APPE_Config(void); +uint32_t MX_APPE_Init(void *p_param); +void MX_APPE_Process(void); + +/* USER CODE BEGIN EFP */ +#if (CFG_BUTTON_SUPPORTED == 1) +uint8_t APPE_ButtonIsLongPressed(uint16_t btnIdx); +void APPE_Button1Action(void); +void APPE_Button2Action(void); +void APPE_Button3Action(void); +#endif + +/* USER CODE END EFP */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*APP_ENTRY_H */ diff --git a/lib/stm32wba/hci/auto/ble_types.h b/lib/stm32wba/hci/auto/ble_types.h new file mode 100644 index 000000000..2aae9466a --- /dev/null +++ b/lib/stm32wba/hci/auto/ble_types.h @@ -0,0 +1,4665 @@ +/***************************************************************************** + * @file ble_types.h + * @author MDG + * @brief STM32WBA BLE command/event types + * Auto-generated file: do not edit! + ***************************************************************************** + * @attention + * + * Copyright (c) 2018-2023 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ***************************************************************************** + */ + +#ifndef BLE_TYPES_H__ +#define BLE_TYPES_H__ + + +#include +#include "ble_const.h" + +/* Type used for function return value */ +typedef uint8_t tBleStatus; + +/* Definition of Host_Nb_Of_Completed_Pkt_Pair_t */ +typedef __PACKED_STRUCT +{ + /** + * Connection_Handle[i] + * Values: + * - 0x0000 ... 0x0EFF + */ + uint16_t Connection_Handle; + /** + * The number of HCI Data Packets [i] that have been completed for the + * associated Connection_Handle since the previous time the event was + * returned. + * Values: + * - 0x0000 ... 0xFFFF + */ + uint16_t Host_Num_Of_Completed_Packets; +} Host_Nb_Of_Completed_Pkt_Pair_t; + +/* Definition of Adv_Set_t */ +typedef __PACKED_STRUCT +{ + /** + * Used to identify an advertising set. + * Values: + * - 0x00 ... 0xEF + */ + uint8_t Advertising_Handle; + /** + * Duration of advertising set. + * Time = N * 10 ms. + * Values: + * - 0x0000 (0 ms) : No advertising duration. + * - 0x0001 (10 ms) ... 0xFFFF (655350 ms) : Advertising duration + */ + uint16_t Duration; + /** + * Maximum number of advertising events. + * Values: + * - 0x00: No maximum number of advertising events + * - 0x01 ... 0xFF: Maximum number of extended advertising events the + * Controller shall attempt to send prior to terminating the extended + * advertising + */ + uint8_t Max_Extended_Advertising_Events; +} Adv_Set_t; + +/* Definition of Scan_Param_Phy_t */ +typedef __PACKED_STRUCT +{ + /** + * Passive or active scanning. With passive scanning, no scan request PDUs + * are sent. + * Values: + * - 0x00: Passive scanning + * - 0x01: Active scanning + */ + uint8_t Scan_Type; + /** + * Time interval from when the Controller started its last scan until it + * begins the subsequent scan on the primary advertising physical channel. + * Time = N * 0.625 ms. + * Values: + * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : STM32WB + * - 0x0004 (2.500 ms) ... 0xFFFF (40959.375 ms) : STM32WBA + */ + uint16_t Scan_Interval; + /** + * Duration of the scan on the primary advertising physical channel. + * Time = N * 0.625 ms. + * Values: + * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : STM32WB + * - 0x0004 (2.500 ms) ... 0xFFFF (40959.375 ms) : STM32WBA + */ + uint16_t Scan_Window; +} Scan_Param_Phy_t; + +/* Definition of Init_Param_Phy_t */ +typedef __PACKED_STRUCT +{ + /** + * Time interval from when the Controller started its last scan until it + * begins the subsequent scan on the primary advertising physical channel. + * Time = N * 0.625 ms. + * Values: + * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : STM32WB + * - 0x0004 (2.500 ms) ... 0xFFFF (40959.375 ms) : STM32WBA + */ + uint16_t Scan_Interval; + /** + * Duration of the scan on the primary advertising physical channel. + * Time = N * 0.625 ms. + * Values: + * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : STM32WB + * - 0x0004 (2.500 ms) ... 0xFFFF (40959.375 ms) : STM32WBA + */ + uint16_t Scan_Window; + /** + * Minimum value for the connection event interval. + * Time = N * 1.25 ms. + * Values: + * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms) + */ + uint16_t Conn_Interval_Min; + /** + * Maximum value for the connection event interval. + * Time = N * 1.25 ms. + * Values: + * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms) + */ + uint16_t Conn_Interval_Max; + /** + * Maximum Peripheral latency for the connection in number of connection + * events. + * Values: + * - 0x0000 ... 0x01F3 + */ + uint16_t Conn_Latency; + /** + * Supervision timeout for the LE Link. + * It shall be a multiple of 10 ms and larger than (1 + + * connPeripheralLatency) * connInterval * 2. + * Time = N * 10 ms. + * Values: + * - 0x000A (100 ms) ... 0x0C80 (32000 ms) + */ + uint16_t Supervision_Timeout; + /** + * Information parameter about the minimum length of connection needed for + * this LE connection. + * Time = N * 0.625 ms. + * Values: + * - 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms) + */ + uint16_t Min_CE_Length; + /** + * Information parameter about the maximum length of connection needed for + * this LE connection. + * Time = N * 0.625 ms. + * Values: + * - 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms) + */ + uint16_t Max_CE_Length; +} Init_Param_Phy_t; + +/* Definition of CIS_cfg_t */ +typedef __PACKED_STRUCT +{ + /** + * CIS identifier. + * Values: + * - 0x00 ... 0xEF + */ + uint8_t CIS_ID; + /** + * Maximum size, in octets, of the payload from the Central's Host. + * Values: + * - 0x0000 ... 0x0FFF + */ + uint16_t Max_SDU_C_To_P; + /** + * Maximum size, in octets, of the payload from the Peripheral's Host. + * Values: + * - 0x0000 ... 0x0FFF + */ + uint16_t Max_SDU_P_To_C; + /** + * PHY used for transmission from the Central to the Peripheral. + * Flags: + * - 0x01: The transmitter PHY of packets from the Central is LE 1M + * - 0x02: The transmitter PHY of packets from the Central is LE 2M + * - 0x04: The transmitter PHY of packets from the Central is LE Coded + */ + uint8_t PHY_C_To_P; + /** + * PHY used for transmission from the Peripheral to the Central. + * Flags: + * - 0x01: The transmitter PHY of packets from the Peripheral is LE 1M + * - 0x02: The transmitter PHY of packets from the Peripheral is LE 2M + * - 0x04: The transmitter PHY of packets from the Peripheral is LE Coded + */ + uint8_t PHY_P_To_C; + /** + * Number of times every CIS Data PDU should be retransmitted from the + * Central to the Peripheral. + */ + uint8_t RTN_C_To_P; + /** + * Number of times every CIS Data PDU should be retransmitted from the + * Peripheral to the Central. + */ + uint8_t RTN_P_To_C; +} CIS_cfg_t; + +/* Definition of CIS_tst_cfg_t */ +typedef __PACKED_STRUCT +{ + /** + * CIS identifier. + * Values: + * - 0x00 ... 0xEF + */ + uint8_t CIS_ID; + /** + * Number of subevents in each interval of each BIS in the BIG. + * Values: + * - 0x01 ... 0x1F + */ + uint8_t NSE; + /** + * Maximum size, in octets, of the payload from the Central's Host. + * Values: + * - 0x0000 ... 0x0FFF + */ + uint16_t Max_SDU_C_To_P; + /** + * Maximum size, in octets, of the payload from the Peripheral's Host. + * Values: + * - 0x0000 ... 0x0FFF + */ + uint16_t Max_SDU_P_To_C; + /** + * Maximum size, in octets, of the payload from the Central to the + * Peripheral. + * Values: + * - 0x0000 ... 0x00FB + */ + uint16_t Max_PDU_C_To_P; + /** + * Maximum size, in octets, of the payload from the Peripheral to the + * Central. + * Values: + * - 0x0000 ... 0x00FB + */ + uint16_t Max_PDU_P_To_C; + /** + * PHY used for transmission from the Central to the Peripheral. + * Flags: + * - 0x01: The transmitter PHY of packets from the Central is LE 1M + * - 0x02: The transmitter PHY of packets from the Central is LE 2M + * - 0x04: The transmitter PHY of packets from the Central is LE Coded + */ + uint8_t PHY_C_To_P; + /** + * PHY used for transmission from the Peripheral to the Central. + * Flags: + * - 0x01: The transmitter PHY of packets from the Peripheral is LE 1M + * - 0x02: The transmitter PHY of packets from the Peripheral is LE 2M + * - 0x04: The transmitter PHY of packets from the Peripheral is LE Coded + */ + uint8_t PHY_P_To_C; + /** + * Burst number for Central to Peripheral. + * Values: + * - 0x00: No isochronous data from the Central to the Peripheral + * - 0x01 ... 0x0F + */ + uint8_t BN_C_To_P; + /** + * Burst number for Peripheral to Central. + * Values: + * - 0x00: No isochronous data from the Peripheral to the Central + * - 0x01 ... 0x0F + */ + uint8_t BN_P_To_C; +} CIS_tst_cfg_t; + +/* Definition of CIS_create_t */ +typedef __PACKED_STRUCT +{ + /** + * Connection handle of a CIS. + * Values: + * - 0x0000 ... 0x0EFF + */ + uint16_t CIS_Connection_Handle; + /** + * Connection handle of an ACL connection. + * Values: + * - 0x0000 ... 0x0EFF + */ + uint16_t ACL_Connection_Handle; +} CIS_create_t; + +/* Definition of Peer_Entry_t */ +typedef __PACKED_STRUCT +{ + /** + * Address type. + * Values: + * - 0x00: Public Device Address + * - 0x01: Random Device Address + */ + uint8_t Peer_Address_Type; + /** + * Public Device Address or Random Device Address. + */ + uint8_t Peer_Address[6]; +} Peer_Entry_t; + +/* Definition of Bonded_Device_Entry_t */ +typedef __PACKED_STRUCT +{ + /** + * Address type. + * Values: + * - 0x00: Public Device Address + * - 0x01: Random Device Address + */ + uint8_t Address_Type; + /** + * Public Device Address or Random Device Address. + */ + uint8_t Address[6]; +} Bonded_Device_Entry_t; + +/* Definition of Identity_Entry_t */ +typedef __PACKED_STRUCT +{ + /** + * Identity address type + * Values: + * - 0x00: Public Identity Address + * - 0x01: Random (static) Identity Address + */ + uint8_t Peer_Identity_Address_Type; + /** + * Public or Random (static) Identity Address of the peer device + */ + uint8_t Peer_Identity_Address[6]; +} Identity_Entry_t; + +/* Definition of List_Entry_t */ +typedef __PACKED_STRUCT +{ + /** + * Address type. + * Values: + * - 0x00: Public Device Address + * - 0x01: Random Device Address + */ + uint8_t Address_Type; + /** + * Public Device Address or Random Device Address. + */ + uint8_t Address[6]; +} List_Entry_t; + +/* Definition of Service_UUID_t */ +typedef __PACKED_UNION +{ + /** + * 16-bit UUID + */ + uint16_t Service_UUID_16; + /** + * 128-bit UUID + */ + uint8_t Service_UUID_128[16]; +} Service_UUID_t; + +/* Definition of Include_UUID_t */ +typedef __PACKED_UNION +{ + /** + * 16-bit UUID + */ + uint16_t Include_UUID_16; + /** + * 128-bit UUID + */ + uint8_t Include_UUID_128[16]; +} Include_UUID_t; + +/* Definition of Char_UUID_t */ +typedef __PACKED_UNION +{ + /** + * 16-bit UUID + */ + uint16_t Char_UUID_16; + /** + * 128-bit UUID + */ + uint8_t Char_UUID_128[16]; +} Char_UUID_t; + +/* Definition of Char_Desc_Uuid_t */ +typedef __PACKED_UNION +{ + /** + * 16-bit UUID + */ + uint16_t Char_UUID_16; + /** + * 128-bit UUID + */ + uint8_t Char_UUID_128[16]; +} Char_Desc_Uuid_t; + +/* Definition of UUID_t */ +typedef __PACKED_UNION +{ + /** + * 16-bit UUID + */ + uint16_t UUID_16; + /** + * 128-bit UUID + */ + uint8_t UUID_128[16]; +} UUID_t; + +/* Definition of Handle_Entry_t */ +typedef __PACKED_STRUCT +{ + /** + * Attribute handle + */ + uint16_t Handle; +} Handle_Entry_t; + +/* Definition of Handle_Packets_Pair_Entry_t */ +typedef __PACKED_STRUCT +{ + /** + * Connection handle + */ + uint16_t Connection_Handle; + /** + * The number of HCI Data Packets that have been completed (transmitted or + * flushed) for the associated Connection_Handle since the previous time the + * event was returned. + */ + uint16_t HC_Num_Of_Completed_Packets; +} Handle_Packets_Pair_Entry_t; + +/* Definition of Advertising_Report_t */ +typedef __PACKED_STRUCT +{ + /** + * Type of advertising report event: + * ADV_IND: Connectable undirected advertising', + * ADV_DIRECT_IND: Connectable directed advertising, + * ADV_SCAN_IND: Scannable undirected advertising, + * ADV_NONCONN_IND: Non connectable undirected advertising, + * SCAN_RSP: Scan response. + * Values: + * - 0x00: ADV_IND + * - 0x01: ADV_DIRECT_IND + * - 0x02: ADV_SCAN_IND + * - 0x03: ADV_NONCONN_IND + * - 0x04: SCAN_RSP + */ + uint8_t Event_Type; + /** + * Address type + * 0x00 Public Device Address + * 0x01 Random Device Address + * 0x02 Public Identity Address (Corresponds to Resolved Private Address) + * 0x03 Random (Static) Identity Address (Corresponds to Resolved Private + * Address) + * Values: + * - 0x00: Public Device Address + * - 0x01: Random Device Address + * - 0x02: Public Identity Address + * - 0x03: Random (Static) Identity Address + */ + uint8_t Address_Type; + /** + * Public Device Address or Random Device Address of the device to be + * connected. + */ + uint8_t Address[6]; + /** + * Length of the Data field for each device which responded. + * Values: + * - 0 ... 31 + */ + uint8_t Length_Data; + /** + * Octets of advertising or scan response data formatted as defined in + * Bluetooth spec. v.5.4 [Vol 3, Part C, 11]. + */ + const uint8_t* Data; + /** + * RSSI (signed integer). + * Units: dBm. + * Values: + * - 127: RSSI not available + * - -127 ... 20 + */ + uint8_t RSSI; +} Advertising_Report_t; + +/* Definition of Direct_Advertising_Report_t */ +typedef __PACKED_STRUCT +{ + /** + * Advertising type + * Values: + * - 0x01: Connectable directed advertising (ADV_DIRECT_IND) + */ + uint8_t Event_Type; + /** + * Address type + * 0x00 Public Device Address + * 0x01 Random Device Address + * 0x02 Public Identity Address (Corresponds to Resolved Private Address) + * 0x03 Random (Static) Identity Address (Corresponds to Resolved Private + * Address) + * Values: + * - 0x00: Public Device Address + * - 0x01: Random Device Address + * - 0x02: Public Identity Address + * - 0x03: Random (Static) Identity Address + */ + uint8_t Address_Type; + /** + * Public Device Address, Random Device Address, Public Identity Address or + * Random (static) Identity Address of the advertising device. + */ + uint8_t Address[6]; + /** + * 0x01 Random Device Address + * Values: + * - 0x01: Random Device Address + */ + uint8_t Direct_Address_Type; + /** + * Random Device Address + */ + uint8_t Direct_Address[6]; + /** + * RSSI (signed integer). + * Units: dBm. + * Values: + * - 127: RSSI not available + * - -127 ... 20 + */ + uint8_t RSSI; +} Direct_Advertising_Report_t; + +/* Definition of IQ_Sample_t */ +typedef __PACKED_STRUCT +{ + uint8_t I_Sample; + uint8_t Q_Sample; +} IQ_Sample_t; + +/* Definition of Connection_Handle_t */ +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} Connection_Handle_t; + +/* Definition of Attribute_Group_Handle_Pair_t */ +typedef __PACKED_STRUCT +{ + /** + * Found Attribute handle + */ + uint16_t Found_Attribute_Handle; + /** + * Group End handle + */ + uint16_t Group_End_Handle; +} Attribute_Group_Handle_Pair_t; + +/* Definition of Handle_Item_t */ +typedef __PACKED_STRUCT +{ + uint16_t Handle; +} Handle_Item_t; + +/* Internal types used by process functions */ + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Reason; +} hci_disconnect_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_disconnect_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} hci_read_remote_version_information_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_read_remote_version_information_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Event_Mask[8]; +} hci_set_event_mask_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_set_event_mask_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_reset_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Accept_Timeout; +} hci_read_connection_accept_timeout_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Accept_Timeout; +} hci_write_connection_accept_timeout_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_write_connection_accept_timeout_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Type; +} hci_read_transmit_power_level_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint8_t Transmit_Power_Level; +} hci_read_transmit_power_level_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Flow_Control_Enable; +} hci_set_controller_to_host_flow_control_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_set_controller_to_host_flow_control_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Host_ACL_Data_Packet_Length; + uint8_t Host_Synchronous_Data_Packet_Length; + uint16_t Host_Total_Num_ACL_Data_Packets; + uint16_t Host_Total_Num_Synchronous_Data_Packets; +} hci_host_buffer_size_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_host_buffer_size_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Number_Of_Handles; + Host_Nb_Of_Completed_Pkt_Pair_t Host_Nb_Of_Completed_Pkt_Pair[(BLE_CMD_MAX_PARAM_LEN - 1)/sizeof(Host_Nb_Of_Completed_Pkt_Pair_t)]; +} hci_host_number_of_completed_packets_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_host_number_of_completed_packets_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Event_Mask_Page_2[8]; +} hci_set_event_mask_page_2_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_set_event_mask_page_2_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} hci_read_authenticated_payload_timeout_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint16_t Authenticated_Payload_Timeout; +} hci_read_authenticated_payload_timeout_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Authenticated_Payload_Timeout; +} hci_write_authenticated_payload_timeout_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_write_authenticated_payload_timeout_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Interval; +} hci_set_ecosystem_base_interval_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_set_ecosystem_base_interval_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Data_Path_Direction; + uint8_t Data_Path_ID; + uint8_t Vendor_Specific_Config_Length; + uint8_t Vendor_Specific_Config[BLE_CMD_MAX_PARAM_LEN - 3]; +} hci_configure_data_path_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_configure_data_path_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t HCI_Version; + uint16_t HCI_Subversion; + uint8_t LMP_Version; + uint16_t Company_Identifier; + uint16_t LMP_Subversion; +} hci_read_local_version_information_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Supported_Commands[64]; +} hci_read_local_supported_commands_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t LMP_Features[8]; +} hci_read_local_supported_features_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t BD_ADDR[6]; +} hci_read_bd_addr_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Num_Supported_Standard_Codecs; + uint8_t Standard_Codec[(BLE_EVT_MAX_PARAM_LEN - 3) - 3]; +} hci_read_local_supported_codecs_v2_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Num_Supported_Vendor_Specific_Codecs; + uint8_t Vendor_Specific_Codec[(BLE_EVT_MAX_PARAM_LEN - 3) - 3]; +} hci_read_local_supported_codecs_v2_rp1; + +typedef __PACKED_STRUCT +{ + uint8_t Codec_ID[5]; + uint8_t Logical_Transport_Type; + uint8_t Direction; +} hci_read_local_supported_codec_capabilities_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Num_Codec_Capabilities; + uint8_t Codec_Capabilities[250]; +} hci_read_local_supported_codec_capabilities_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Codec_ID[5]; + uint8_t Logical_Transport_Type; + uint8_t Direction; + uint8_t Codec_Configuration_Length; + uint8_t Codec_Configuration[BLE_CMD_MAX_PARAM_LEN - 8]; +} hci_read_local_supported_controller_delay_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Min_Controller_Delay[3]; + uint8_t Max_Controller_Delay[3]; +} hci_read_local_supported_controller_delay_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} hci_read_rssi_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint8_t RSSI; +} hci_read_rssi_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t LE_Event_Mask[8]; +} hci_le_set_event_mask_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_event_mask_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t HC_LE_ACL_Data_Packet_Length; + uint8_t HC_Total_Num_LE_ACL_Data_Packets; +} hci_le_read_buffer_size_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t LE_Features[8]; +} hci_le_read_local_supported_features_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Random_Address[6]; +} hci_le_set_random_address_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_random_address_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Advertising_Interval_Min; + uint16_t Advertising_Interval_Max; + uint8_t Advertising_Type; + uint8_t Own_Address_Type; + uint8_t Peer_Address_Type; + uint8_t Peer_Address[6]; + uint8_t Advertising_Channel_Map; + uint8_t Advertising_Filter_Policy; +} hci_le_set_advertising_parameters_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_advertising_parameters_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Transmit_Power_Level; +} hci_le_read_advertising_physical_channel_tx_power_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Data_Length; + uint8_t Advertising_Data[31]; +} hci_le_set_advertising_data_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_advertising_data_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Scan_Response_Data_Length; + uint8_t Scan_Response_Data[31]; +} hci_le_set_scan_response_data_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_scan_response_data_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Enable; +} hci_le_set_advertising_enable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_advertising_enable_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t LE_Scan_Type; + uint16_t LE_Scan_Interval; + uint16_t LE_Scan_Window; + uint8_t Own_Address_Type; + uint8_t Scanning_Filter_Policy; +} hci_le_set_scan_parameters_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_scan_parameters_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t LE_Scan_Enable; + uint8_t Filter_Duplicates; +} hci_le_set_scan_enable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_scan_enable_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t LE_Scan_Interval; + uint16_t LE_Scan_Window; + uint8_t Initiator_Filter_Policy; + uint8_t Peer_Address_Type; + uint8_t Peer_Address[6]; + uint8_t Own_Address_Type; + uint16_t Conn_Interval_Min; + uint16_t Conn_Interval_Max; + uint16_t Conn_Latency; + uint16_t Supervision_Timeout; + uint16_t Minimum_CE_Length; + uint16_t Maximum_CE_Length; +} hci_le_create_connection_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_create_connection_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_create_connection_cancel_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Filter_Accept_List_Size; +} hci_le_read_filter_accept_list_size_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_clear_filter_accept_list_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Address_Type; + uint8_t Address[6]; +} hci_le_add_device_to_filter_accept_list_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_add_device_to_filter_accept_list_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Address_Type; + uint8_t Address[6]; +} hci_le_remove_device_from_filter_accept_list_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_remove_device_from_filter_accept_list_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Conn_Interval_Min; + uint16_t Conn_Interval_Max; + uint16_t Conn_Latency; + uint16_t Supervision_Timeout; + uint16_t Minimum_CE_Length; + uint16_t Maximum_CE_Length; +} hci_le_connection_update_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_connection_update_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t LE_Channel_Map[5]; +} hci_le_set_host_channel_classification_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_host_channel_classification_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} hci_le_read_channel_map_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint8_t LE_Channel_Map[5]; +} hci_le_read_channel_map_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} hci_le_read_remote_features_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_read_remote_features_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Key[16]; + uint8_t Plaintext_Data[16]; +} hci_le_encrypt_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Encrypted_Data[16]; +} hci_le_encrypt_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Random_Number[8]; +} hci_le_rand_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Random_Number[8]; + uint16_t Encrypted_Diversifier; + uint8_t Long_Term_Key[16]; +} hci_le_enable_encryption_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_enable_encryption_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Long_Term_Key[16]; +} hci_le_long_term_key_request_reply_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_long_term_key_request_reply_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} hci_le_long_term_key_request_negative_reply_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_long_term_key_request_negative_reply_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t LE_States[8]; +} hci_le_read_supported_states_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t RX_Frequency; +} hci_le_receiver_test_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_receiver_test_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t TX_Frequency; + uint8_t Length_Of_Test_Data; + uint8_t Packet_Payload; +} hci_le_transmitter_test_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_transmitter_test_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Number_Of_Packets; +} hci_le_test_end_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Interval_Min; + uint16_t Interval_Max; + uint16_t Max_Latency; + uint16_t Timeout; + uint16_t Min_CE_Length; + uint16_t Max_CE_Length; +} hci_le_remote_connection_parameter_request_reply_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_remote_connection_parameter_request_reply_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Reason; +} hci_le_remote_connection_parameter_request_negative_reply_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_remote_connection_parameter_request_negative_reply_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t TxOctets; + uint16_t TxTime; +} hci_le_set_data_length_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_set_data_length_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t SuggestedMaxTxOctets; + uint16_t SuggestedMaxTxTime; +} hci_le_read_suggested_default_data_length_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t SuggestedMaxTxOctets; + uint16_t SuggestedMaxTxTime; +} hci_le_write_suggested_default_data_length_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_write_suggested_default_data_length_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_read_local_p256_public_key_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Remote_P256_Public_Key[64]; +} hci_le_generate_dhkey_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_generate_dhkey_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Peer_Identity_Address_Type; + uint8_t Peer_Identity_Address[6]; + uint8_t Peer_IRK[16]; + uint8_t Local_IRK[16]; +} hci_le_add_device_to_resolving_list_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_add_device_to_resolving_list_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Peer_Identity_Address_Type; + uint8_t Peer_Identity_Address[6]; +} hci_le_remove_device_from_resolving_list_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_remove_device_from_resolving_list_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_clear_resolving_list_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Resolving_List_Size; +} hci_le_read_resolving_list_size_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Peer_Identity_Address_Type; + uint8_t Peer_Identity_Address[6]; +} hci_le_read_peer_resolvable_address_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Peer_Resolvable_Address[6]; +} hci_le_read_peer_resolvable_address_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Peer_Identity_Address_Type; + uint8_t Peer_Identity_Address[6]; +} hci_le_read_local_resolvable_address_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Local_Resolvable_Address[6]; +} hci_le_read_local_resolvable_address_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Address_Resolution_Enable; +} hci_le_set_address_resolution_enable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_address_resolution_enable_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t RPA_Timeout; +} hci_le_set_resolvable_private_address_timeout_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_resolvable_private_address_timeout_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t supportedMaxTxOctets; + uint16_t supportedMaxTxTime; + uint16_t supportedMaxRxOctets; + uint16_t supportedMaxRxTime; +} hci_le_read_maximum_data_length_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} hci_le_read_phy_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint8_t TX_PHY; + uint8_t RX_PHY; +} hci_le_read_phy_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t ALL_PHYS; + uint8_t TX_PHYS; + uint8_t RX_PHYS; +} hci_le_set_default_phy_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_default_phy_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t ALL_PHYS; + uint8_t TX_PHYS; + uint8_t RX_PHYS; + uint16_t PHY_options; +} hci_le_set_phy_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_phy_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t RX_Frequency; + uint8_t PHY; + uint8_t Modulation_Index; +} hci_le_receiver_test_v2_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_receiver_test_v2_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t TX_Frequency; + uint8_t Length_Of_Test_Data; + uint8_t Packet_Payload; + uint8_t PHY; +} hci_le_transmitter_test_v2_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_transmitter_test_v2_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; + uint8_t Random_Address[6]; +} hci_le_set_advertising_set_random_address_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_advertising_set_random_address_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; + uint16_t Adv_Event_Properties; + uint8_t Primary_Adv_Interval_Min[3]; + uint8_t Primary_Adv_Interval_Max[3]; + uint8_t Primary_Adv_Channel_Map; + uint8_t Own_Address_Type; + uint8_t Peer_Address_Type; + uint8_t Peer_Address[6]; + uint8_t Adv_Filter_Policy; + uint8_t Adv_TX_Power; + uint8_t Primary_Adv_PHY; + uint8_t Secondary_Adv_Max_Skip; + uint8_t Secondary_Adv_PHY; + uint8_t Adv_SID; + uint8_t Scan_Req_Notification_Enable; +} hci_le_set_extended_advertising_parameters_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Selected_TX_Power; +} hci_le_set_extended_advertising_parameters_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; + uint8_t Operation; + uint8_t Fragment_Preference; + uint8_t Advertising_Data_Length; + uint8_t Advertising_Data[BLE_CMD_MAX_PARAM_LEN - 4]; +} hci_le_set_extended_advertising_data_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_extended_advertising_data_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; + uint8_t Operation; + uint8_t Fragment_Preference; + uint8_t Scan_Response_Data_Length; + uint8_t Scan_Response_Data[BLE_CMD_MAX_PARAM_LEN - 4]; +} hci_le_set_extended_scan_response_data_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_extended_scan_response_data_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Enable; + uint8_t Num_Sets; + Adv_Set_t Adv_Set[(BLE_CMD_MAX_PARAM_LEN - 2)/sizeof(Adv_Set_t)]; +} hci_le_set_extended_advertising_enable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_extended_advertising_enable_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Max_Advertising_Data_Length; +} hci_le_read_maximum_advertising_data_length_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Num_Supported_Advertising_Sets; +} hci_le_read_number_of_supported_advertising_sets_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; +} hci_le_remove_advertising_set_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_remove_advertising_set_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_clear_advertising_sets_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; + uint16_t Periodic_Adv_Interval_Min; + uint16_t Periodic_Adv_Interval_Max; + uint16_t Periodic_Adv_Properties; +} hci_le_set_periodic_advertising_parameters_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_periodic_advertising_parameters_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; + uint8_t Operation; + uint8_t Advertising_Data_Length; + uint8_t Advertising_Data[BLE_CMD_MAX_PARAM_LEN - 3]; +} hci_le_set_periodic_advertising_data_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_periodic_advertising_data_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Enable; + uint8_t Advertising_Handle; +} hci_le_set_periodic_advertising_enable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_periodic_advertising_enable_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Own_Address_Type; + uint8_t Scanning_Filter_Policy; + uint8_t Scanning_PHYs; + Scan_Param_Phy_t Scan_Param_Phy[2]; +} hci_le_set_extended_scan_parameters_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_extended_scan_parameters_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Enable; + uint8_t Filter_Duplicates; + uint16_t Duration; + uint16_t Period; +} hci_le_set_extended_scan_enable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_extended_scan_enable_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Initiator_Filter_Policy; + uint8_t Own_Address_Type; + uint8_t Peer_Address_Type; + uint8_t Peer_Address[6]; + uint8_t Initiating_PHYs; + Init_Param_Phy_t Init_Param_Phy[3]; +} hci_le_extended_create_connection_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_extended_create_connection_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Options; + uint8_t Advertising_SID; + uint8_t Advertiser_Address_Type; + uint8_t Advertiser_Address[6]; + uint16_t Skip; + uint16_t Sync_Timeout; + uint8_t Sync_CTE_Type; +} hci_le_periodic_advertising_create_sync_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_periodic_advertising_create_sync_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_periodic_advertising_create_sync_cancel_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Sync_Handle; +} hci_le_periodic_advertising_terminate_sync_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_periodic_advertising_terminate_sync_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertiser_Address_Type; + uint8_t Advertiser_Address[6]; + uint8_t Advertising_SID; +} hci_le_add_device_to_periodic_advertiser_list_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_add_device_to_periodic_advertiser_list_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertiser_Address_Type; + uint8_t Advertiser_Address[6]; + uint8_t Advertising_SID; +} hci_le_remove_device_from_periodic_advertiser_list_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_remove_device_from_periodic_advertiser_list_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_clear_periodic_advertiser_list_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Periodic_Advertiser_List_Size; +} hci_le_read_periodic_advertiser_list_size_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Min_TX_Power; + uint8_t Max_TX_Power; +} hci_le_read_transmit_power_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t RF_TX_Path_Compensation; + uint16_t RF_RX_Path_Compensation; +} hci_le_read_rf_path_compensation_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t RF_TX_Path_Compensation; + uint16_t RF_RX_Path_Compensation; +} hci_le_write_rf_path_compensation_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_write_rf_path_compensation_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Peer_Identity_Address_Type; + uint8_t Peer_Identity_Address[6]; + uint8_t Privacy_Mode; +} hci_le_set_privacy_mode_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_privacy_mode_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t RX_Frequency; + uint8_t PHY; + uint8_t Modulation_Index; + uint8_t Expected_CTE_Length; + uint8_t Expected_CTE_Type; + uint8_t Slot_Durations; + uint8_t Switching_Pattern_Length; + uint8_t Antenna_IDs[BLE_CMD_MAX_PARAM_LEN - 7]; +} hci_le_receiver_test_v3_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_receiver_test_v3_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t TX_Frequency; + uint8_t Length_Of_Test_Data; + uint8_t Packet_Payload; + uint8_t PHY; + uint8_t CTE_Length; + uint8_t CTE_Type; + uint8_t Switching_Pattern_Length; + uint8_t Antenna_IDs[BLE_CMD_MAX_PARAM_LEN - 7]; +} hci_le_transmitter_test_v3_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_transmitter_test_v3_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; + uint8_t CTE_Length; + uint8_t CTE_Type; + uint8_t CTE_Count; + uint8_t Switching_Pattern_Length; + uint8_t Antenna_IDs[BLE_CMD_MAX_PARAM_LEN - 5]; +} hci_le_set_connectionless_cte_transmit_parameters_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_connectionless_cte_transmit_parameters_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; + uint8_t CTE_Enable; +} hci_le_set_connectionless_cte_transmit_enable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_connectionless_cte_transmit_enable_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Sync_Handle; + uint8_t Sampling_Enable; + uint8_t Slot_Durations; + uint8_t Max_Sampled_CTEs; + uint8_t Switching_Pattern_Length; + uint8_t Antenna_IDs[BLE_CMD_MAX_PARAM_LEN - 6]; +} hci_le_set_connectionless_iq_sampling_enable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Sync_Handle; +} hci_le_set_connectionless_iq_sampling_enable_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Sampling_Enable; + uint8_t Slot_Durations; + uint8_t Switching_Pattern_Length; + uint8_t Antenna_IDs[BLE_CMD_MAX_PARAM_LEN - 5]; +} hci_le_set_connection_cte_receive_parameters_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_set_connection_cte_receive_parameters_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t CTE_Types; + uint8_t Switching_Pattern_Length; + uint8_t Antenna_IDs[BLE_CMD_MAX_PARAM_LEN - 4]; +} hci_le_set_connection_cte_transmit_parameters_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_set_connection_cte_transmit_parameters_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Enable; + uint16_t CTE_Request_Interval; + uint8_t Requested_CTE_Length; + uint8_t Requested_CTE_Type; +} hci_le_connection_cte_request_enable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_connection_cte_request_enable_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Enable; +} hci_le_connection_cte_response_enable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_connection_cte_response_enable_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Supported_Switching_Sampling_Rates; + uint8_t Num_Antennae; + uint8_t Max_Switching_Pattern_Length; + uint8_t Max_CTE_Length; +} hci_le_read_antenna_information_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Sync_Handle; + uint8_t Enable; +} hci_le_set_periodic_advertising_receive_enable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_periodic_advertising_receive_enable_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Service_Data; + uint16_t Sync_Handle; +} hci_le_periodic_advertising_sync_transfer_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_periodic_advertising_sync_transfer_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Service_Data; + uint8_t Advertising_Handle; +} hci_le_periodic_advertising_set_info_transfer_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_periodic_advertising_set_info_transfer_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Mode; + uint16_t Skip; + uint16_t Sync_Timeout; + uint8_t CTE_Type; +} hci_le_set_periodic_advertising_sync_transfer_parameters_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_set_periodic_advertising_sync_transfer_parameters_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Mode; + uint16_t Skip; + uint16_t Sync_Timeout; + uint8_t CTE_Type; +} hci_le_set_default_periodic_advertising_sync_transfer_parameters_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_default_periodic_advertising_sync_transfer_parameters_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Remote_P256_Public_Key[64]; + uint8_t Key_Type; +} hci_le_generate_dhkey_v2_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_generate_dhkey_v2_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t LE_ACL_Data_Packet_Length; + uint8_t Total_Num_LE_ACL_Data_Packets; + uint16_t ISO_Data_Packet_Length; + uint8_t Total_Num_ISO_Data_Packets; +} hci_le_read_buffer_size_v2_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} hci_le_read_iso_tx_sync_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint16_t Packet_Sequence_Number; + uint32_t TX_Time_Stamp; + uint8_t Time_Offset[3]; +} hci_le_read_iso_tx_sync_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t CIG_ID; + uint8_t SDU_Interval_C_To_P[3]; + uint8_t SDU_Interval_P_To_C[3]; + uint8_t Worst_Case_SCA; + uint8_t Packing; + uint8_t Framing; + uint16_t Max_Transport_Latency_C_To_P; + uint16_t Max_Transport_Latency_P_To_C; + uint8_t CIS_Count; + CIS_cfg_t CIS_cfg[(BLE_CMD_MAX_PARAM_LEN - 15)/sizeof(CIS_cfg_t)]; +} hci_le_set_cig_parameters_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t CIG_ID; + uint8_t CIS_Count_Ret; + uint16_t Connection_Handle[((BLE_EVT_MAX_PARAM_LEN - 3) - 3)/sizeof(uint16_t)]; +} hci_le_set_cig_parameters_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t CIG_ID; + uint8_t SDU_Interval_C_To_P[3]; + uint8_t SDU_Interval_P_To_C[3]; + uint8_t FT_C_To_P; + uint8_t FT_P_To_C; + uint16_t ISO_Interval; + uint8_t Worst_Case_SCA; + uint8_t Packing; + uint8_t Framing; + uint8_t CIS_Count; + CIS_tst_cfg_t CIS_tst_cfg[(BLE_CMD_MAX_PARAM_LEN - 15)/sizeof(CIS_tst_cfg_t)]; +} hci_le_set_cig_parameters_test_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t CIG_ID; + uint8_t CIS_Count_Ret; + uint16_t Connection_Handle[((BLE_EVT_MAX_PARAM_LEN - 3) - 3)/sizeof(uint16_t)]; +} hci_le_set_cig_parameters_test_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t CIS_Count; + CIS_create_t CIS_create[(BLE_CMD_MAX_PARAM_LEN - 1)/sizeof(CIS_create_t)]; +} hci_le_create_cis_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_create_cis_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t CIG_ID; +} hci_le_remove_cig_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t CIG_ID; +} hci_le_remove_cig_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} hci_le_accept_cis_request_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_accept_cis_request_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Reason; +} hci_le_reject_cis_request_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_reject_cis_request_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t BIG_Handle; + uint8_t Advertising_Handle; + uint8_t Num_BIS; + uint8_t SDU_Interval[3]; + uint16_t Max_SDU; + uint16_t Max_Transport_Latency; + uint8_t RTN; + uint8_t PHY; + uint8_t Packing; + uint8_t Framing; + uint8_t Encryption; + uint8_t Broadcast_Code[16]; +} hci_le_create_big_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_create_big_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t BIG_Handle; + uint8_t Advertising_Handle; + uint8_t Num_BIS; + uint8_t SDU_Interval[3]; + uint16_t ISO_Interval; + uint8_t NSE; + uint16_t Max_SDU; + uint16_t Max_PDU; + uint8_t PHY; + uint8_t Packing; + uint8_t Framing; + uint8_t BN; + uint8_t IRC; + uint8_t PTO; + uint8_t Encryption; + uint8_t Broadcast_Code[16]; +} hci_le_create_big_test_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_create_big_test_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t BIG_Handle; + uint8_t Reason; +} hci_le_terminate_big_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_terminate_big_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t BIG_Handle; + uint16_t Sync_Handle; + uint8_t Encryption; + uint8_t Broadcast_Code[16]; + uint8_t MSE; + uint16_t BIG_Sync_Timeout; + uint8_t Num_BIS; + uint8_t BIS[BLE_CMD_MAX_PARAM_LEN - 24]; +} hci_le_big_create_sync_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_big_create_sync_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t BIG_Handle; +} hci_le_big_terminate_sync_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t BIG_Handle; +} hci_le_big_terminate_sync_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} hci_le_request_peer_sca_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_request_peer_sca_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Data_Path_Direction; + uint8_t Data_Path_ID; + uint8_t Codec_ID[5]; + uint8_t Controller_Delay[3]; + uint8_t Codec_Configuration_Length; + uint8_t Codec_Configuration[BLE_CMD_MAX_PARAM_LEN - 13]; +} hci_le_setup_iso_data_path_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_setup_iso_data_path_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Data_Path_Direction; +} hci_le_remove_iso_data_path_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_remove_iso_data_path_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Payload_Type; +} hci_le_iso_transmit_test_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_iso_transmit_test_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Payload_Type; +} hci_le_iso_receive_test_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_iso_receive_test_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} hci_le_iso_read_test_counters_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint32_t Received_SDU_Count; + uint32_t Missed_SDU_Count; + uint32_t Failed_SDU_Count; +} hci_le_iso_read_test_counters_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} hci_le_iso_test_end_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint32_t Received_SDU_Count; + uint32_t Missed_SDU_Count; + uint32_t Failed_SDU_Count; +} hci_le_iso_test_end_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Bit_Number; + uint8_t Bit_Value; +} hci_le_set_host_feature_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_set_host_feature_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} hci_le_read_iso_link_quality_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint32_t TX_UnACKed_Packets; + uint32_t TX_Flushed_Packets; + uint32_t TX_Last_Subevent_Packets; + uint32_t Retransmitted_Packets; + uint32_t CRC_Error_Packets; + uint32_t RX_Unreceived_Packets; + uint32_t Duplicate_Packets; +} hci_le_read_iso_link_quality_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t PHY; +} hci_le_enhanced_read_transmit_power_level_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint8_t PHY; + uint8_t Current_TX_Power_Level; + uint8_t Max_TX_Power_Level; +} hci_le_enhanced_read_transmit_power_level_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t PHY; +} hci_le_read_remote_transmit_power_level_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_read_remote_transmit_power_level_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t High_Threshold; + uint8_t High_Hysteresis; + uint8_t Low_Threshold; + uint8_t Low_Hysteresis; + uint16_t Min_Time_Spent; +} hci_le_set_path_loss_reporting_parameters_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_set_path_loss_reporting_parameters_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Enable; +} hci_le_set_path_loss_reporting_enable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_set_path_loss_reporting_enable_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Local_Enable; + uint8_t Remote_Enable; +} hci_le_set_transmit_power_reporting_enable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_set_transmit_power_reporting_enable_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t TX_Frequency; + uint8_t Length_Of_Test_Data; + uint8_t Packet_Payload; + uint8_t PHY; + uint8_t CTE_Length; + uint8_t CTE_Type; + uint8_t Switching_Pattern_Length; + uint8_t Antenna_IDs[BLE_CMD_MAX_PARAM_LEN - 8]; +} hci_le_transmitter_test_v4_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t TX_Power_Level; +} hci_le_transmitter_test_v4_cp1; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} hci_le_transmitter_test_v4_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; + uint16_t Periodic_Adv_Interval_Min; + uint16_t Periodic_Adv_Interval_Max; + uint16_t Periodic_Adv_Properties; + uint8_t Num_Subevents; + uint8_t Subevent_Interval; + uint8_t Response_Slot_Delay; + uint8_t Response_Slot_Spacing; + uint8_t Num_Response_Slots; +} hci_le_set_periodic_advertising_parameters_v2_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Advertising_Handle; +} hci_le_set_periodic_advertising_parameters_v2_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Build_Number; +} aci_hal_get_fw_build_number_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Offset; + uint8_t Length; + uint8_t Value[BLE_CMD_MAX_PARAM_LEN - 2]; +} aci_hal_write_config_data_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_hal_write_config_data_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Offset; +} aci_hal_read_config_data_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Data_Length; + uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 3) - 2]; +} aci_hal_read_config_data_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t En_High_Power; + uint8_t PA_Level; +} aci_hal_set_tx_power_level_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_hal_set_tx_power_level_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint32_t Number_Of_Packets; +} aci_hal_le_tx_test_packet_number_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t RF_Channel; + uint8_t Freq_offset; +} aci_hal_tone_start_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_hal_tone_start_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_hal_tone_stop_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Radio_Activity_Mask; +} aci_hal_set_radio_activity_mask_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_hal_set_radio_activity_mask_rp0; + +typedef __PACKED_STRUCT +{ + uint32_t Event_Mask; +} aci_hal_set_event_mask_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_hal_set_event_mask_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Link_Status[10]; + uint16_t Link_Connection_Handle[10]; +} aci_hal_get_link_status_v2_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Allocated_For_TX; + uint16_t Allocated_For_RX; + uint16_t Allocated_MBlocks; +} aci_hal_get_pm_debug_info_v2_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Enable; +} aci_hal_set_peripheral_latency_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_hal_set_peripheral_latency_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Group_Id; + uint8_t Enable_Sync; + uint8_t Enable_Cb_Trigger; + uint8_t Trigger_Source; +} aci_hal_set_sync_event_config_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_hal_set_sync_event_config_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t RSSI; +} aci_hal_read_rssi_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t RF_Channel; + uint8_t PHY; + uint8_t Pattern; +} aci_hal_continuous_tx_start_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_hal_continuous_tx_start_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_set_non_discoverable_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Type; + uint16_t Advertising_Interval_Min; + uint16_t Advertising_Interval_Max; + uint8_t Own_Address_Type; + uint8_t Advertising_Filter_Policy; + uint8_t Local_Name_Length; + uint8_t Local_Name[BLE_CMD_MAX_PARAM_LEN - 13]; +} aci_gap_set_limited_discoverable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Service_Uuid_length; + uint8_t Service_Uuid_List[BLE_CMD_MAX_PARAM_LEN - 13]; +} aci_gap_set_limited_discoverable_cp1; + +typedef __PACKED_STRUCT +{ + uint16_t Conn_Interval_Min; + uint16_t Conn_Interval_Max; +} aci_gap_set_limited_discoverable_cp2; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_set_limited_discoverable_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Type; + uint16_t Advertising_Interval_Min; + uint16_t Advertising_Interval_Max; + uint8_t Own_Address_Type; + uint8_t Advertising_Filter_Policy; + uint8_t Local_Name_Length; + uint8_t Local_Name[BLE_CMD_MAX_PARAM_LEN - 13]; +} aci_gap_set_discoverable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Service_Uuid_length; + uint8_t Service_Uuid_List[BLE_CMD_MAX_PARAM_LEN - 13]; +} aci_gap_set_discoverable_cp1; + +typedef __PACKED_STRUCT +{ + uint16_t Conn_Interval_Min; + uint16_t Conn_Interval_Max; +} aci_gap_set_discoverable_cp2; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_set_discoverable_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Own_Address_Type; + uint8_t Directed_Advertising_Type; + uint8_t Direct_Address_Type; + uint8_t Direct_Address[6]; + uint16_t Advertising_Interval_Min; + uint16_t Advertising_Interval_Max; +} aci_gap_set_direct_connectable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_set_direct_connectable_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t IO_Capability; +} aci_gap_set_io_capability_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_set_io_capability_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Bonding_Mode; + uint8_t MITM_Mode; + uint8_t SC_Support; + uint8_t KeyPress_Notification_Support; + uint8_t Min_Encryption_Key_Size; + uint8_t Max_Encryption_Key_Size; + uint8_t Use_Fixed_Pin; + uint32_t Fixed_Pin; + uint8_t Identity_Address_Type; +} aci_gap_set_authentication_requirement_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_set_authentication_requirement_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Authorization_Enable; +} aci_gap_set_authorization_requirement_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_set_authorization_requirement_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint32_t Pass_Key; +} aci_gap_pass_key_resp_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_pass_key_resp_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Authorize; +} aci_gap_authorization_resp_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_authorization_resp_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Role; + uint8_t privacy_enabled; + uint8_t device_name_char_len; +} aci_gap_init_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Service_Handle; + uint16_t Dev_Name_Char_Handle; + uint16_t Appearance_Char_Handle; +} aci_gap_init_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Event_Type; + uint8_t Own_Address_Type; +} aci_gap_set_non_connectable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_set_non_connectable_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Advertising_Interval_Min; + uint16_t Advertising_Interval_Max; + uint8_t Own_Address_Type; + uint8_t Adv_Filter_Policy; +} aci_gap_set_undirected_connectable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_set_undirected_connectable_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} aci_gap_peripheral_security_req_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_peripheral_security_req_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t AdvDataLen; + uint8_t AdvData[BLE_CMD_MAX_PARAM_LEN - 1]; +} aci_gap_update_adv_data_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_update_adv_data_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t ADType; +} aci_gap_delete_ad_type_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_delete_ad_type_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} aci_gap_get_security_level_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Security_Mode; + uint8_t Security_Level; +} aci_gap_get_security_level_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t GAP_Evt_Mask; +} aci_gap_set_event_mask_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_set_event_mask_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_configure_filter_accept_list_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Reason; +} aci_gap_terminate_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_terminate_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_clear_security_db_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} aci_gap_allow_rebond_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_allow_rebond_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t LE_Scan_Interval; + uint16_t LE_Scan_Window; + uint8_t Own_Address_Type; + uint8_t Filter_Duplicates; +} aci_gap_start_limited_discovery_proc_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_start_limited_discovery_proc_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t LE_Scan_Interval; + uint16_t LE_Scan_Window; + uint8_t Own_Address_Type; + uint8_t Filter_Duplicates; +} aci_gap_start_general_discovery_proc_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_start_general_discovery_proc_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t LE_Scan_Interval; + uint16_t LE_Scan_Window; + uint8_t Own_Address_Type; + uint16_t Conn_Interval_Min; + uint16_t Conn_Interval_Max; + uint16_t Conn_Latency; + uint16_t Supervision_Timeout; + uint16_t Minimum_CE_Length; + uint16_t Maximum_CE_Length; + uint8_t Num_of_Peer_Entries; + Peer_Entry_t Peer_Entry[(BLE_CMD_MAX_PARAM_LEN - 18)/sizeof(Peer_Entry_t)]; +} aci_gap_start_auto_connection_establish_proc_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_start_auto_connection_establish_proc_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t LE_Scan_Type; + uint16_t LE_Scan_Interval; + uint16_t LE_Scan_Window; + uint8_t Own_Address_Type; + uint8_t Scanning_Filter_Policy; + uint8_t Filter_Duplicates; +} aci_gap_start_general_connection_establish_proc_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_start_general_connection_establish_proc_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t LE_Scan_Type; + uint16_t LE_Scan_Interval; + uint16_t LE_Scan_Window; + uint8_t Own_Address_Type; + uint8_t Scanning_Filter_Policy; + uint8_t Filter_Duplicates; + uint8_t Num_of_Peer_Entries; + Peer_Entry_t Peer_Entry[(BLE_CMD_MAX_PARAM_LEN - 9)/sizeof(Peer_Entry_t)]; +} aci_gap_start_selective_connection_establish_proc_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_start_selective_connection_establish_proc_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t LE_Scan_Interval; + uint16_t LE_Scan_Window; + uint8_t Peer_Address_Type; + uint8_t Peer_Address[6]; + uint8_t Own_Address_Type; + uint16_t Conn_Interval_Min; + uint16_t Conn_Interval_Max; + uint16_t Conn_Latency; + uint16_t Supervision_Timeout; + uint16_t Minimum_CE_Length; + uint16_t Maximum_CE_Length; +} aci_gap_create_connection_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_create_connection_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Procedure_Code; +} aci_gap_terminate_gap_proc_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_terminate_gap_proc_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Conn_Interval_Min; + uint16_t Conn_Interval_Max; + uint16_t Conn_Latency; + uint16_t Supervision_Timeout; + uint16_t Minimum_CE_Length; + uint16_t Maximum_CE_Length; +} aci_gap_start_connection_update_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_start_connection_update_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Force_Rebond; +} aci_gap_send_pairing_req_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_send_pairing_req_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Address[6]; +} aci_gap_resolve_private_addr_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Actual_Address[6]; +} aci_gap_resolve_private_addr_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Advertising_Interval_Min; + uint16_t Advertising_Interval_Max; + uint8_t Advertising_Type; + uint8_t Own_Address_Type; + uint8_t Adv_Data_Length; + uint8_t Adv_Data[BLE_CMD_MAX_PARAM_LEN - 8]; +} aci_gap_set_broadcast_mode_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Num_of_Peer_Entries; + Peer_Entry_t Peer_Entry[(BLE_CMD_MAX_PARAM_LEN - 8)/sizeof(Peer_Entry_t)]; +} aci_gap_set_broadcast_mode_cp1; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_set_broadcast_mode_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t LE_Scan_Interval; + uint16_t LE_Scan_Window; + uint8_t LE_Scan_Type; + uint8_t Own_Address_Type; + uint8_t Filter_Duplicates; + uint8_t Scanning_Filter_Policy; +} aci_gap_start_observation_proc_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_start_observation_proc_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Num_of_Addresses; + Bonded_Device_Entry_t Bonded_Device_Entry[((BLE_EVT_MAX_PARAM_LEN - 3) - 2)/sizeof(Bonded_Device_Entry_t)]; +} aci_gap_get_bonded_devices_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Peer_Address_Type; + uint8_t Peer_Address[6]; +} aci_gap_is_device_bonded_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_is_device_bonded_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Confirm_Yes_No; +} aci_gap_numeric_comparison_value_confirm_yesno_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_numeric_comparison_value_confirm_yesno_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Input_Type; +} aci_gap_passkey_input_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_passkey_input_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t OOB_Data_Type; +} aci_gap_get_oob_data_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Address_Type; + uint8_t Address[6]; + uint8_t OOB_Data_Type; + uint8_t OOB_Data_Len; + uint8_t OOB_Data[16]; +} aci_gap_get_oob_data_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Device_Type; + uint8_t Address_Type; + uint8_t Address[6]; + uint8_t OOB_Data_Type; + uint8_t OOB_Data_Len; + uint8_t OOB_Data[16]; +} aci_gap_set_oob_data_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_set_oob_data_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Num_of_Resolving_list_Entries; + Identity_Entry_t Identity_Entry[(BLE_CMD_MAX_PARAM_LEN - 2)/sizeof(Identity_Entry_t)]; +} aci_gap_add_devices_to_resolving_list_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Clear_Resolving_List; +} aci_gap_add_devices_to_resolving_list_cp1; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_add_devices_to_resolving_list_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Peer_Identity_Address_Type; + uint8_t Peer_Identity_Address[6]; +} aci_gap_remove_bonded_device_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_remove_bonded_device_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Num_of_List_Entries; + List_Entry_t List_Entry[(BLE_CMD_MAX_PARAM_LEN - 2)/sizeof(List_Entry_t)]; +} aci_gap_add_devices_to_list_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Mode; +} aci_gap_add_devices_to_list_cp1; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_add_devices_to_list_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Adv_Mode; + uint8_t Advertising_Handle; + uint16_t Adv_Event_Properties; + uint32_t Primary_Adv_Interval_Min; + uint32_t Primary_Adv_Interval_Max; + uint8_t Primary_Adv_Channel_Map; + uint8_t Own_Address_Type; + uint8_t Peer_Address_Type; + uint8_t Peer_Address[6]; + uint8_t Adv_Filter_Policy; + uint8_t Adv_TX_Power; + uint8_t Secondary_Adv_Max_Skip; + uint8_t Secondary_Adv_PHY; + uint8_t Adv_SID; + uint8_t Scan_Req_Notification_Enable; +} aci_gap_adv_set_configuration_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_adv_set_configuration_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Enable; + uint8_t Num_Sets; + Adv_Set_t Adv_Set[(BLE_CMD_MAX_PARAM_LEN - 2)/sizeof(Adv_Set_t)]; +} aci_gap_adv_set_enable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_adv_set_enable_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; + uint8_t Operation; + uint8_t Fragment_Preference; + uint8_t Advertising_Data_Length; + uint8_t Advertising_Data[BLE_CMD_MAX_PARAM_LEN - 4]; +} aci_gap_adv_set_adv_data_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_adv_set_adv_data_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; + uint8_t Operation; + uint8_t Fragment_Preference; + uint8_t Scan_Response_Data_Length; + uint8_t Scan_Response_Data[BLE_CMD_MAX_PARAM_LEN - 4]; +} aci_gap_adv_set_scan_resp_data_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_adv_set_scan_resp_data_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; +} aci_gap_adv_remove_set_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_adv_remove_set_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_adv_clear_sets_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; + uint8_t Random_Address[6]; +} aci_gap_adv_set_random_address_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_adv_set_random_address_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; + uint16_t Periodic_Adv_Interval_Min; + uint16_t Periodic_Adv_Interval_Max; + uint16_t Periodic_Adv_Properties; + uint8_t Num_Subevents; + uint8_t Subevent_Interval; + uint8_t Response_Slot_Delay; + uint8_t Response_Slot_Spacing; + uint8_t Num_Response_Slots; +} aci_gap_adv_set_periodic_parameters_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_adv_set_periodic_parameters_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; + uint8_t Operation; + uint8_t Advertising_Data_Length; + uint8_t Advertising_Data[BLE_CMD_MAX_PARAM_LEN - 3]; +} aci_gap_adv_set_periodic_data_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_adv_set_periodic_data_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Enable; + uint8_t Advertising_Handle; +} aci_gap_adv_set_periodic_enable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_adv_set_periodic_enable_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Scan_Mode; + uint8_t Procedure; + uint8_t Own_Address_Type; + uint8_t Filter_Duplicates; + uint16_t Duration; + uint16_t Period; + uint8_t Scanning_Filter_Policy; + uint8_t Scanning_PHYs; + Scan_Param_Phy_t Scan_Param_Phy[2]; +} aci_gap_ext_start_scan_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_ext_start_scan_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Initiating_Mode; + uint8_t Procedure; + uint8_t Own_Address_Type; + uint8_t Peer_Address_Type; + uint8_t Peer_Address[6]; + uint8_t Advertising_Handle; + uint8_t Subevent; + uint8_t Initiator_Filter_Policy; + uint8_t Initiating_PHYs; + Init_Param_Phy_t Init_Param_Phy[3]; +} aci_gap_ext_create_connection_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gap_ext_create_connection_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_init_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Service_UUID_Type; + Service_UUID_t Service_UUID; +} aci_gatt_add_service_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Service_Type; + uint8_t Max_Attribute_Records; +} aci_gatt_add_service_cp1; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Service_Handle; +} aci_gatt_add_service_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Service_Handle; + uint16_t Include_Start_Handle; + uint16_t Include_End_Handle; + uint8_t Include_UUID_Type; + Include_UUID_t Include_UUID; +} aci_gatt_include_service_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Include_Handle; +} aci_gatt_include_service_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Service_Handle; + uint8_t Char_UUID_Type; + Char_UUID_t Char_UUID; +} aci_gatt_add_char_cp0; + +typedef __PACKED_STRUCT +{ + uint16_t Char_Value_Length; + uint8_t Char_Properties; + uint8_t Security_Permissions; + uint8_t GATT_Evt_Mask; + uint8_t Enc_Key_Size; + uint8_t Is_Variable; +} aci_gatt_add_char_cp1; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Char_Handle; +} aci_gatt_add_char_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Service_Handle; + uint16_t Char_Handle; + uint8_t Char_Desc_Uuid_Type; + Char_Desc_Uuid_t Char_Desc_Uuid; +} aci_gatt_add_char_desc_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Char_Desc_Value_Max_Len; + uint8_t Char_Desc_Value_Length; + uint8_t Char_Desc_Value[BLE_CMD_MAX_PARAM_LEN - 12]; +} aci_gatt_add_char_desc_cp1; + +typedef __PACKED_STRUCT +{ + uint8_t Security_Permissions; + uint8_t Access_Permissions; + uint8_t GATT_Evt_Mask; + uint8_t Enc_Key_Size; + uint8_t Is_Variable; +} aci_gatt_add_char_desc_cp2; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Char_Desc_Handle; +} aci_gatt_add_char_desc_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Service_Handle; + uint16_t Char_Handle; + uint8_t Val_Offset; + uint8_t Char_Value_Length; + uint8_t Char_Value[BLE_CMD_MAX_PARAM_LEN - 6]; +} aci_gatt_update_char_value_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_update_char_value_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Serv_Handle; + uint16_t Char_Handle; +} aci_gatt_del_char_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_del_char_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Serv_Handle; +} aci_gatt_del_service_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_del_service_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Serv_Handle; + uint16_t Include_Handle; +} aci_gatt_del_include_service_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_del_include_service_rp0; + +typedef __PACKED_STRUCT +{ + uint32_t GATT_Evt_Mask; +} aci_gatt_set_event_mask_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_set_event_mask_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} aci_gatt_exchange_config_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_exchange_config_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Start_Handle; + uint16_t End_Handle; +} aci_att_find_info_req_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_att_find_info_req_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Start_Handle; + uint16_t End_Handle; + uint16_t UUID; + uint8_t Attribute_Val_Length; + uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 9]; +} aci_att_find_by_type_value_req_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_att_find_by_type_value_req_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Start_Handle; + uint16_t End_Handle; + uint8_t UUID_Type; + UUID_t UUID; +} aci_att_read_by_type_req_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_att_read_by_type_req_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Start_Handle; + uint16_t End_Handle; + uint8_t UUID_Type; + UUID_t UUID; +} aci_att_read_by_group_type_req_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_att_read_by_group_type_req_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attr_Handle; + uint16_t Val_Offset; + uint8_t Attribute_Val_Length; + uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 7]; +} aci_att_prepare_write_req_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_att_prepare_write_req_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Execute; +} aci_att_execute_write_req_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_att_execute_write_req_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} aci_gatt_disc_all_primary_services_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_disc_all_primary_services_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t UUID_Type; + UUID_t UUID; +} aci_gatt_disc_primary_service_by_uuid_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_disc_primary_service_by_uuid_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Start_Handle; + uint16_t End_Handle; +} aci_gatt_find_included_services_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_find_included_services_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Start_Handle; + uint16_t End_Handle; +} aci_gatt_disc_all_char_of_service_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_disc_all_char_of_service_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Start_Handle; + uint16_t End_Handle; + uint8_t UUID_Type; + UUID_t UUID; +} aci_gatt_disc_char_by_uuid_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_disc_char_by_uuid_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Char_Handle; + uint16_t End_Handle; +} aci_gatt_disc_all_char_desc_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_disc_all_char_desc_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attr_Handle; +} aci_gatt_read_char_value_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_read_char_value_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Start_Handle; + uint16_t End_Handle; + uint8_t UUID_Type; + UUID_t UUID; +} aci_gatt_read_using_char_uuid_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_read_using_char_uuid_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attr_Handle; + uint16_t Val_Offset; +} aci_gatt_read_long_char_value_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_read_long_char_value_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Number_of_Handles; + Handle_Entry_t Handle_Entry[(BLE_CMD_MAX_PARAM_LEN - 3)/sizeof(Handle_Entry_t)]; +} aci_gatt_read_multiple_char_value_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_read_multiple_char_value_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attr_Handle; + uint8_t Attribute_Val_Length; + uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 5]; +} aci_gatt_write_char_value_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_write_char_value_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attr_Handle; + uint16_t Val_Offset; + uint8_t Attribute_Val_Length; + uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 7]; +} aci_gatt_write_long_char_value_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_write_long_char_value_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attr_Handle; + uint16_t Val_Offset; + uint8_t Attribute_Val_Length; + uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 7]; +} aci_gatt_write_char_reliable_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_write_char_reliable_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attr_Handle; + uint16_t Val_Offset; + uint8_t Attribute_Val_Length; + uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 7]; +} aci_gatt_write_long_char_desc_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_write_long_char_desc_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attr_Handle; + uint16_t Val_Offset; +} aci_gatt_read_long_char_desc_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_read_long_char_desc_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attr_Handle; + uint8_t Attribute_Val_Length; + uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 5]; +} aci_gatt_write_char_desc_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_write_char_desc_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attr_Handle; +} aci_gatt_read_char_desc_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_read_char_desc_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attr_Handle; + uint8_t Attribute_Val_Length; + uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 5]; +} aci_gatt_write_without_resp_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_write_without_resp_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attr_Handle; + uint8_t Attribute_Val_Length; + uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 5]; +} aci_gatt_signed_write_without_resp_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_signed_write_without_resp_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} aci_gatt_confirm_indication_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_confirm_indication_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attr_Handle; + uint8_t Write_status; + uint8_t Error_Code; + uint8_t Attribute_Val_Length; + uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 7]; +} aci_gatt_write_resp_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_write_resp_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} aci_gatt_allow_read_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_allow_read_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Serv_Handle; + uint16_t Attr_Handle; + uint8_t Security_Permissions; +} aci_gatt_set_security_permission_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_set_security_permission_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Serv_Handle; + uint16_t Char_Handle; + uint16_t Char_Desc_Handle; + uint16_t Val_Offset; + uint8_t Char_Desc_Value_Length; + uint8_t Char_Desc_Value[BLE_CMD_MAX_PARAM_LEN - 9]; +} aci_gatt_set_desc_value_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_set_desc_value_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Attr_Handle; + uint16_t Offset; + uint16_t Value_Length_Requested; +} aci_gatt_read_handle_value_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Length; + uint16_t Value_Length; + uint8_t Value[(BLE_EVT_MAX_PARAM_LEN - 3) - 5]; +} aci_gatt_read_handle_value_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Conn_Handle_To_Notify; + uint16_t Service_Handle; + uint16_t Char_Handle; + uint8_t Update_Type; + uint16_t Char_Length; + uint16_t Value_Offset; + uint8_t Value_Length; + uint8_t Value[BLE_CMD_MAX_PARAM_LEN - 12]; +} aci_gatt_update_char_value_ext_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_update_char_value_ext_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Error_Code; +} aci_gatt_deny_read_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_deny_read_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Serv_Handle; + uint16_t Attr_Handle; + uint8_t Access_Permissions; +} aci_gatt_set_access_permission_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_set_access_permission_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_store_db_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Number_of_Handles; + Handle_Entry_t Handle_Entry[(BLE_CMD_MAX_PARAM_LEN - 3)/sizeof(Handle_Entry_t)]; +} aci_gatt_send_mult_notification_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_send_mult_notification_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Number_of_Handles; + Handle_Entry_t Handle_Entry[(BLE_CMD_MAX_PARAM_LEN - 3)/sizeof(Handle_Entry_t)]; +} aci_gatt_read_multiple_var_char_value_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_gatt_read_multiple_var_char_value_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Conn_Interval_Min; + uint16_t Conn_Interval_Max; + uint16_t Latency; + uint16_t Timeout_Multiplier; +} aci_l2cap_connection_parameter_update_req_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_l2cap_connection_parameter_update_req_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Conn_Interval_Min; + uint16_t Conn_Interval_Max; + uint16_t Latency; + uint16_t Timeout_Multiplier; + uint16_t Minimum_CE_Length; + uint16_t Maximum_CE_Length; + uint8_t Identifier; + uint8_t Accept; +} aci_l2cap_connection_parameter_update_resp_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_l2cap_connection_parameter_update_resp_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t SPSM; + uint16_t MTU; + uint16_t MPS; + uint16_t Initial_Credits; + uint8_t Channel_Number; +} aci_l2cap_coc_connect_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_l2cap_coc_connect_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t MTU; + uint16_t MPS; + uint16_t Initial_Credits; + uint16_t Result; +} aci_l2cap_coc_connect_confirm_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Channel_Number; + uint8_t Channel_Index_List[(BLE_EVT_MAX_PARAM_LEN - 3) - 2]; +} aci_l2cap_coc_connect_confirm_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t MTU; + uint16_t MPS; + uint8_t Channel_Number; + uint8_t Channel_Index_List[BLE_CMD_MAX_PARAM_LEN - 7]; +} aci_l2cap_coc_reconf_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_l2cap_coc_reconf_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Result; +} aci_l2cap_coc_reconf_confirm_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_l2cap_coc_reconf_confirm_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Channel_Index; +} aci_l2cap_coc_disconnect_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_l2cap_coc_disconnect_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Channel_Index; + uint16_t Credits; +} aci_l2cap_coc_flow_control_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_l2cap_coc_flow_control_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Channel_Index; + uint16_t Length; + uint8_t Data[BLE_CMD_MAX_PARAM_LEN - 3]; +} aci_l2cap_coc_tx_data_cp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; +} aci_l2cap_coc_tx_data_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint8_t Reason; +} hci_disconnection_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint8_t Encryption_Enabled; +} hci_encryption_change_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint8_t Version; + uint16_t Manufacturer_Name; + uint16_t Subversion; +} hci_read_remote_version_information_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Hardware_Code; +} hci_hardware_error_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Number_of_Handles; + Handle_Packets_Pair_Entry_t Handle_Packets_Pair_Entry[(BLE_EVT_MAX_PARAM_LEN - 1)/sizeof(Handle_Packets_Pair_Entry_t)]; +} hci_number_of_completed_packets_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Link_Type; +} hci_data_buffer_overflow_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_encryption_key_refresh_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} hci_authenticated_payload_timeout_expired_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint8_t Role; + uint8_t Peer_Address_Type; + uint8_t Peer_Address[6]; + uint16_t Conn_Interval; + uint16_t Conn_Latency; + uint16_t Supervision_Timeout; + uint8_t Central_Clock_Accuracy; +} hci_le_connection_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Num_Reports; + Advertising_Report_t Advertising_Report[((BLE_EVT_MAX_PARAM_LEN - 1) - 1)/sizeof(Advertising_Report_t)]; +} hci_le_advertising_report_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint16_t Conn_Interval; + uint16_t Conn_Latency; + uint16_t Supervision_Timeout; +} hci_le_connection_update_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint8_t LE_Features[8]; +} hci_le_read_remote_features_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Random_Number[8]; + uint16_t Encrypted_Diversifier; +} hci_le_long_term_key_request_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Interval_Min; + uint16_t Interval_Max; + uint16_t Max_Latency; + uint16_t Timeout; +} hci_le_remote_connection_parameter_request_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t MaxTxOctets; + uint16_t MaxTxTime; + uint16_t MaxRxOctets; + uint16_t MaxRxTime; +} hci_le_data_length_change_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Local_P256_Public_Key[64]; +} hci_le_read_local_p256_public_key_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t DHKey[32]; +} hci_le_generate_dhkey_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint8_t Role; + uint8_t Peer_Address_Type; + uint8_t Peer_Address[6]; + uint8_t Local_Resolvable_Private_Address[6]; + uint8_t Peer_Resolvable_Private_Address[6]; + uint16_t Conn_Interval; + uint16_t Conn_Latency; + uint16_t Supervision_Timeout; + uint8_t Central_Clock_Accuracy; +} hci_le_enhanced_connection_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Num_Reports; + Direct_Advertising_Report_t Direct_Advertising_Report[((BLE_EVT_MAX_PARAM_LEN - 1) - 1)/sizeof(Direct_Advertising_Report_t)]; +} hci_le_directed_advertising_report_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint8_t TX_PHY; + uint8_t RX_PHY; +} hci_le_phy_update_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Num_Reports; + uint16_t Event_Type; + uint8_t Address_Type; + uint8_t Address[6]; + uint8_t Primary_PHY; + uint8_t Secondary_PHY; + uint8_t Advertising_SID; + uint8_t TX_Power; + uint8_t RSSI; + uint16_t Periodic_Adv_Interval; + uint8_t Direct_Address_Type; + uint8_t Direct_Address[6]; + uint8_t Data_Length; + uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 1) - 25]; +} hci_le_extended_advertising_report_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Sync_Handle; + uint8_t Advertising_SID; + uint8_t Advertiser_Address_Type; + uint8_t Advertiser_Address[6]; + uint8_t Advertiser_PHY; + uint16_t Periodic_Advertising_Interval; + uint8_t Advertiser_Clock_Accuracy; +} hci_le_periodic_advertising_sync_established_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Sync_Handle; + uint8_t TX_Power; + uint8_t RSSI; + uint8_t CTE_Type; + uint8_t Data_Status; + uint8_t Data_Length; + uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 1) - 7]; +} hci_le_periodic_advertising_report_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Sync_Handle; +} hci_le_periodic_advertising_sync_lost_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t Advertising_Handle; + uint16_t Connection_Handle; + uint8_t Num_Completed_Ext_Adv_Events; +} hci_le_advertising_set_terminated_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Advertising_Handle; + uint8_t Scanner_Address_Type; + uint8_t Scanner_Address[6]; +} hci_le_scan_request_received_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Channel_Selection_Algorithm; +} hci_le_channel_selection_algorithm_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Sync_Handle; + uint8_t Channel_Index; + uint16_t RSSI; + uint8_t RSSI_Antenna_ID; + uint8_t CTE_Type; + uint8_t Slot_Durations; + uint8_t Packet_Status; + uint16_t Periodic_Event_Counter; + uint8_t Sample_Count; + IQ_Sample_t IQ_Sample[((BLE_EVT_MAX_PARAM_LEN - 1) - 12)/sizeof(IQ_Sample_t)]; +} hci_le_connectionless_iq_report_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t RX_PHY; + uint8_t Data_Channel_Index; + uint16_t RSSI; + uint8_t RSSI_Antenna_ID; + uint8_t CTE_Type; + uint8_t Slot_Durations; + uint8_t Packet_Status; + uint16_t Connection_Event_Counter; + uint8_t Sample_Count; + IQ_Sample_t IQ_Sample[((BLE_EVT_MAX_PARAM_LEN - 1) - 13)/sizeof(IQ_Sample_t)]; +} hci_le_connection_iq_report_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; +} hci_le_cte_request_failed_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint16_t Service_Data; + uint16_t Sync_Handle; + uint8_t Advertising_SID; + uint8_t Advertiser_Address_Type; + uint8_t Advertiser_Address[6]; + uint8_t Advertiser_PHY; + uint16_t Periodic_Advertising_Interval; + uint8_t Advertiser_Clock_Accuracy; +} hci_le_periodic_advertising_sync_transfer_received_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint8_t CIG_Sync_Delay[3]; + uint8_t CIS_Sync_Delay[3]; + uint8_t Transport_Latency_C_To_P[3]; + uint8_t Transport_Latency_P_To_C[3]; + uint8_t PHY_C_To_P; + uint8_t PHY_P_To_C; + uint8_t NSE; + uint8_t BN_C_To_P; + uint8_t BN_P_To_C; + uint8_t FT_C_To_P; + uint8_t FT_P_To_C; + uint16_t Max_PDU_C_To_P; + uint16_t Max_PDU_P_To_C; + uint16_t ISO_Interval; +} hci_le_cis_established_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t ACL_Connection_Handle; + uint16_t CIS_Connection_Handle; + uint8_t CIG_ID; + uint8_t CIS_ID; +} hci_le_cis_request_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t BIG_Handle; + uint8_t BIG_Sync_Delay[3]; + uint8_t Transport_Latency_BIG[3]; + uint8_t PHY; + uint8_t NSE; + uint8_t BN; + uint8_t PTO; + uint8_t IRC; + uint16_t Max_PDU; + uint16_t ISO_Interval; + uint8_t Num_BIS; + Connection_Handle_t Connection_Handle[((BLE_EVT_MAX_PARAM_LEN - 1) - 18)/sizeof(Connection_Handle_t)]; +} hci_le_create_big_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t BIG_Handle; + uint8_t Reason; +} hci_le_terminate_big_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint8_t BIG_Handle; + uint8_t Transport_Latency_BIG[3]; + uint8_t NSE; + uint8_t BN; + uint8_t PTO; + uint8_t IRC; + uint16_t Max_PDU; + uint16_t ISO_Interval; + uint8_t Num_BIS; + Connection_Handle_t Connection_Handle[((BLE_EVT_MAX_PARAM_LEN - 1) - 14)/sizeof(Connection_Handle_t)]; +} hci_le_big_sync_established_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t BIG_Handle; + uint8_t Reason; +} hci_le_big_sync_lost_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint8_t Peer_Clock_Accuracy; +} hci_le_request_peer_sca_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Current_Path_Loss; + uint8_t Zone_Entered; +} hci_le_path_loss_threshold_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Status; + uint16_t Connection_Handle; + uint8_t Reason; + uint8_t PHY; + uint8_t TX_Power_Level; + uint8_t TX_Power_Level_Flag; + uint8_t Delta; +} hci_le_transmit_power_reporting_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Sync_Handle; + uint8_t Num_BIS; + uint8_t NSE; + uint16_t ISO_Interval; + uint8_t BN; + uint8_t PTO; + uint8_t IRC; + uint16_t Max_PDU; + uint8_t SDU_Interval[3]; + uint16_t Max_SDU; + uint8_t PHY; + uint8_t Framing; + uint8_t Encryption; +} hci_le_biginfo_advertising_report_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Last_State; + uint8_t Next_State; + uint32_t Next_State_SysTime; + uint8_t Last_State_Slot; + uint8_t Next_State_Slot; +} aci_hal_end_of_radio_activity_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t RSSI; + uint8_t Peer_Address_Type; + uint8_t Peer_Address[6]; +} aci_hal_scan_req_report_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t FW_Error_Type; + uint8_t Data_Length; + uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 2]; +} aci_hal_fw_error_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Group_Id; + uint32_t Next_Anchor_Point; + uint32_t Time_Stamp; + uint32_t Next_Sdu_Delivery_Timeout; +} aci_hal_sync_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Status; + uint8_t Reason; +} aci_gap_pairing_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} aci_gap_pass_key_req_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} aci_gap_authorization_req_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Procedure_Code; + uint8_t Status; + uint8_t Data_Length; + uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 3]; +} aci_gap_proc_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} aci_gap_addr_not_resolved_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint32_t Numeric_Value; +} aci_gap_numeric_comparison_value_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Notification_Type; +} aci_gap_keypress_notification_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Result; +} aci_l2cap_connection_update_resp_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Data_Length; + uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 3]; +} aci_l2cap_proc_timeout_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Identifier; + uint16_t L2CAP_Length; + uint16_t Interval_Min; + uint16_t Interval_Max; + uint16_t Latency; + uint16_t Timeout_Multiplier; +} aci_l2cap_connection_update_req_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Identifier; + uint16_t Reason; + uint8_t Data_Length; + uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 6]; +} aci_l2cap_command_reject_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t SPSM; + uint16_t MTU; + uint16_t MPS; + uint16_t Initial_Credits; + uint8_t Channel_Number; +} aci_l2cap_coc_connect_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t MTU; + uint16_t MPS; + uint16_t Initial_Credits; + uint16_t Result; + uint8_t Channel_Number; + uint8_t Channel_Index_List[(BLE_EVT_MAX_PARAM_LEN - 2) - 11]; +} aci_l2cap_coc_connect_confirm_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t MTU; + uint16_t MPS; + uint8_t Channel_Number; + uint8_t Channel_Index_List[(BLE_EVT_MAX_PARAM_LEN - 2) - 7]; +} aci_l2cap_coc_reconf_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Result; +} aci_l2cap_coc_reconf_confirm_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Channel_Index; +} aci_l2cap_coc_disconnect_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Channel_Index; + uint16_t Credits; +} aci_l2cap_coc_flow_control_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Channel_Index; + uint16_t Length; + uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 3]; +} aci_l2cap_coc_rx_data_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attr_Handle; + uint16_t Offset; + uint16_t Attr_Data_Length; + uint8_t Attr_Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 8]; +} aci_gatt_attribute_modified_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} aci_gatt_proc_timeout_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Server_RX_MTU; +} aci_att_exchange_mtu_resp_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Format; + uint8_t Event_Data_Length; + uint8_t Handle_UUID_Pair[(BLE_EVT_MAX_PARAM_LEN - 2) - 4]; +} aci_att_find_info_resp_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Num_of_Handle_Pair; + Attribute_Group_Handle_Pair_t Attribute_Group_Handle_Pair[((BLE_EVT_MAX_PARAM_LEN - 2) - 3)/sizeof(Attribute_Group_Handle_Pair_t)]; +} aci_att_find_by_type_value_resp_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Handle_Value_Pair_Length; + uint8_t Data_Length; + uint8_t Handle_Value_Pair_Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 4]; +} aci_att_read_by_type_resp_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Event_Data_Length; + uint8_t Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 3]; +} aci_att_read_resp_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Event_Data_Length; + uint8_t Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 3]; +} aci_att_read_blob_resp_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Event_Data_Length; + uint8_t Set_Of_Values[(BLE_EVT_MAX_PARAM_LEN - 2) - 3]; +} aci_att_read_multiple_resp_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Attribute_Data_Length; + uint8_t Data_Length; + uint8_t Attribute_Data_List[(BLE_EVT_MAX_PARAM_LEN - 2) - 4]; +} aci_att_read_by_group_type_resp_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attribute_Handle; + uint16_t Offset; + uint8_t Part_Attribute_Value_Length; + uint8_t Part_Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 7]; +} aci_att_prepare_write_resp_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} aci_att_exec_write_resp_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attribute_Handle; + uint8_t Attribute_Value_Length; + uint8_t Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 5]; +} aci_gatt_indication_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attribute_Handle; + uint8_t Attribute_Value_Length; + uint8_t Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 5]; +} aci_gatt_notification_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Error_Code; +} aci_gatt_proc_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Req_Opcode; + uint16_t Attribute_Handle; + uint8_t Error_Code; +} aci_gatt_error_resp_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attribute_Handle; + uint8_t Attribute_Value_Length; + uint8_t Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 5]; +} aci_gatt_disc_read_char_by_uuid_resp_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attribute_Handle; + uint8_t Data_Length; + uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 5]; +} aci_gatt_write_permit_req_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attribute_Handle; + uint16_t Offset; +} aci_gatt_read_permit_req_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint8_t Number_of_Handles; + Handle_Item_t Handle_Item[((BLE_EVT_MAX_PARAM_LEN - 2) - 3)/sizeof(Handle_Item_t)]; +} aci_gatt_read_multi_permit_req_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Available_Buffers; +} aci_gatt_tx_pool_available_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; +} aci_gatt_server_confirmation_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attribute_Handle; + uint16_t Offset; + uint8_t Data_Length; + uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 7]; +} aci_gatt_prepare_write_permit_req_event_rp0; + +typedef __PACKED_STRUCT +{ + uint8_t Channel_Index; + uint8_t EAB_State; + uint8_t Status; +} aci_gatt_eatt_bearer_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Offset; + uint16_t Data_Length; + uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 6]; +} aci_gatt_mult_notification_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Attr_Handle; +} aci_gatt_notification_complete_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Offset; + uint16_t Event_Data_Length; + uint8_t Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 6]; +} aci_gatt_read_ext_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attribute_Handle; + uint16_t Offset; + uint16_t Attribute_Value_Length; + uint8_t Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 8]; +} aci_gatt_indication_ext_event_rp0; + +typedef __PACKED_STRUCT +{ + uint16_t Connection_Handle; + uint16_t Attribute_Handle; + uint16_t Offset; + uint16_t Attribute_Value_Length; + uint8_t Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 8]; +} aci_gatt_notification_ext_event_rp0; + + +#endif /* BLE_TYPES_H__ */ diff --git a/lib/stm32wba/hci/ble_bufsize.h b/lib/stm32wba/hci/ble_bufsize.h new file mode 100644 index 000000000..70f160aec --- /dev/null +++ b/lib/stm32wba/hci/ble_bufsize.h @@ -0,0 +1,144 @@ +/***************************************************************************** + * @file ble_bufsize.h + * @author MDG + * @brief Definition of BLE stack buffers size + ***************************************************************************** + * @attention + * + * Copyright (c) 2018-2023 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ***************************************************************************** + */ + +#ifndef BLE_BUFSIZE_H__ +#define BLE_BUFSIZE_H__ + + +/* + * BLE_DEFAULT_ATT_MTU: minimum MTU value that GATT must support. + */ +#define BLE_DEFAULT_ATT_MTU 23 + +/* + * BLE_DEFAULT_MAX_ATT_SIZE: maximum attribute size. + */ +#define BLE_DEFAULT_MAX_ATT_SIZE 512 + +/* + * BLE_PREP_WRITE_X_ATT: compute how many Prepare Write Request are needed to + * write a characteristic with size 'max_att' when the used ATT_MTU value is + * equal to BLE_DEFAULT_ATT_MTU (23). + */ +#define BLE_PREP_WRITE_X_ATT(max_att) \ + (DIVC(max_att, BLE_DEFAULT_ATT_MTU - 5) * 2) + +/* + * BLE_DEFAULT_PREP_WRITE_LIST_SIZE: default minimum Prepare Write List size. + */ +#define BLE_DEFAULT_PREP_WRITE_LIST_SIZE \ + BLE_PREP_WRITE_X_ATT(BLE_DEFAULT_MAX_ATT_SIZE) + +/* + * BLE_MEM_BLOCK_X_MTU: compute how many memory blocks are needed to compose + * an ATT packet with ATT_MTU=mtu. + */ +#define BLE_MEM_BLOCK_SIZE 32 + +#define BLE_MEM_BLOCK_X_TX(mtu) \ + (DIVC((mtu) + 4U, BLE_MEM_BLOCK_SIZE) + 1U) + +#define BLE_MEM_BLOCK_X_RX(mtu, n_link) \ + ((DIVC((mtu) + 4U, BLE_MEM_BLOCK_SIZE) + 2U) * (n_link) + 1) + +#define BLE_MEM_BLOCK_X_MTU(mtu, n_link) \ + (BLE_MEM_BLOCK_X_TX(mtu) + BLE_MEM_BLOCK_X_RX(mtu, n_link)) + +/* + * BLE_MBLOCKS_SECURE_CONNECTIONS: minimum number of blocks required for + * secure connections + */ +#define BLE_MBLOCKS_SECURE_CONNECTIONS 4 + +/* + * BLE_MBLOCKS_CALC: minimum number of buffers needed by the stack. + * This is the minimum racomanded value and depends on: + * - pw: size of Prepare Write List + * - mtu: ATT_MTU size + * - n_link: maximum number of simultaneous connections + */ +#define BLE_MBLOCKS_CALC(pw, mtu, n_link) \ + ((pw) + MAX(BLE_MEM_BLOCK_X_MTU(mtu, n_link), \ + BLE_MBLOCKS_SECURE_CONNECTIONS)) + +/* + * BLE_FIXED_BUFFER_SIZE_BYTES: + * A part of the RAM, is dynamically allocated by initializing all the pointers + * defined in a global context variable "mem_alloc_ctx_p". + * This initialization is made in the Dynamic_allocator functions, which + * assign a portion of RAM given by the external application to the above + * mentioned "global pointers". + * + * The size of this Dynamic RAM is made of 2 main components: + * - a part that is parameters-dependent (num of links, GATT buffers, ...), + * and which value is made explicit by the following macro; + * - a part, that may be considered "fixed", i.e. independent from the above + * mentioned parameters. +*/ +#if (BASIC_FEATURES != 0) +#define BLE_FIXED_BUFFER_SIZE_BYTES 244 /* Basic Features */ +#else +#define BLE_FIXED_BUFFER_SIZE_BYTES 500 /* Full stack */ +#endif + +/* + * BLE_PER_LINK_SIZE_BYTES: additional memory size used per link + */ +#if (BASIC_FEATURES != 0) +#define BLE_PER_LINK_SIZE_BYTES 176 /* Basic Features */ +#else +#define BLE_PER_LINK_SIZE_BYTES 188 /* Full stack */ +#endif + +/* + * BLE_TOTAL_BUFFER_SIZE: this macro returns the amount of memory, in bytes, + * needed for the storage of data structures (except GATT database elements) + * whose size depends on the number of supported connections. + * + * @param n_link: Maximum number of simultaneous connections that the device + * will support. Valid values are from 1 to 8. + * + * @param mblocks_count: Number of memory blocks allocated for packets. + */ +#define BLE_TOTAL_BUFFER_SIZE(n_link, mblocks_count) \ + (16 + BLE_FIXED_BUFFER_SIZE_BYTES + \ + (BLE_PER_LINK_SIZE_BYTES * (n_link)) + \ + ((BLE_MEM_BLOCK_SIZE + 12) * (mblocks_count))) + +/* + * BLE_TOTAL_BUFFER_SIZE_GATT: this macro returns the amount of memory, + * in bytes, needed for the storage of GATT database elements. + * + * @param num_gatt_attributes: Maximum number of Attributes (i.e. the number + * of characteristic + the number of characteristic values + the number of + * descriptors, excluding the services) that can be stored in the GATT + * database. Note that certain characteristics and relative descriptors are + * added automatically during device initialization so this parameters should + * be 9 plus the number of user Attributes + * + * @param num_gatt_services: Maximum number of Services that can be stored in + * the GATT database. Note that the GAP and GATT services are automatically + * added so this parameter should be 2 plus the number of user services + * + * @param att_value_array_size: Size of the storage area for Attribute values. + */ +#define BLE_TOTAL_BUFFER_SIZE_GATT(num_gatt_attributes, num_gatt_services, att_value_array_size) \ + (((((att_value_array_size) - 1) | 3) + 1) + \ + (40 * (num_gatt_attributes)) + (48 * (num_gatt_services))) + + +#endif /* BLE_BUFSIZE_H__ */ diff --git a/lib/stm32wba/hci/ble_const.h b/lib/stm32wba/hci/ble_const.h new file mode 100644 index 000000000..6b8da5384 --- /dev/null +++ b/lib/stm32wba/hci/ble_const.h @@ -0,0 +1,90 @@ +/***************************************************************************** + * @file ble_const.h + * @author MDG + * @brief This file contains the definitions which are compiler dependent. + ***************************************************************************** + * @attention + * + * Copyright (c) 2018-2023 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ***************************************************************************** + */ + +#ifndef BLE_CONST_H__ +#define BLE_CONST_H__ + + +#include +#include +#include "ble_std.h" +#include "ble_defs.h" + + +/* Default BLE variant */ +#ifndef BASIC_FEATURES +#define BASIC_FEATURES 0 +#endif +#ifndef LL_ONLY +#define LL_ONLY 0 +#endif +#ifndef LL_ONLY_BASIC +#define LL_ONLY_BASIC 0 +#endif + +/* Size of command/events buffers: + * + * To change the size of commands and events parameters used in the + * auto-generated files, you need to update 2 defines: + * + * - BLE_CMD_MAX_PARAM_LEN + * - BLE_EVT_MAX_PARAM_LEN + * + * These 2 defines are set below with default values and can be changed. + * + * To compute the value to support a characteristic of 512 bytes for a specific + * command or an event, you need to look in "ble_types.h". + * + * Here are 2 examples, one with a command and one with an event: + * + * - aci_gatt_update_char_value_ext_cp0 + * ---------------------------------- + * + * we have in the structure: + * + * uint8_t Value[(BLE_CMD_MAX_PARAM_LEN- 12)/sizeof(uint8_t)]; + * + * so to support a 512 byte value, we need to have + * + * BLE_CMD_MAX_PARAM_LEN at least equal to: 512 + 12 = 524 + * + * - aci_gatt_read_handle_value_rp0 + * ------------------------------ + * + * we have in the structure: + * + * uint8_t Value[((BLE_EVT_MAX_PARAM_LEN - 3) - 5)/sizeof(uint8_t)]; + * + * so to support a 512 byte value, we need to have + * + * BLE_EVT_MAX_PARAM_LEN at least equal to: 512 + 3 + 5 = 520 + * + * If you need several events or commands with 512-size values, you need to + * take the maximum values for BLE_EVT_MAX_PARAM_LEN and BLE_CMD_MAX_PARAM_LEN. + * + */ + +/* Maximum parameter size of BLE commands. + * Change this value if needed. */ +#define BLE_CMD_MAX_PARAM_LEN HCI_COMMAND_MAX_PARAM_LEN + +/* Maximum parameter size of BLE responses/events. + * Change this value if needed. */ +#define BLE_EVT_MAX_PARAM_LEN HCI_EVENT_MAX_PARAM_LEN + + +#endif /* BLE_CONST_H__ */ diff --git a/lib/stm32wba/hci/ble_defs.h b/lib/stm32wba/hci/ble_defs.h new file mode 100644 index 000000000..b721011f3 --- /dev/null +++ b/lib/stm32wba/hci/ble_defs.h @@ -0,0 +1,480 @@ +/***************************************************************************** + * @file ble_defs.h + * @author MDG + * @brief This file contains definitions used for BLE Stack interface. + ***************************************************************************** + * @attention + * + * Copyright (c) 2018-2023 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ***************************************************************************** + */ + +#ifndef BLE_DEFS_H__ +#define BLE_DEFS_H__ + + +/* ------------------------------------------------------------------------- */ + +/* Status codes */ + +/* Returned when the command has completed with success + */ +#define BLE_STATUS_SUCCESS 0x00U + +/* The remote device in in the Blacklist and the pairing operation it requested + * cannot be performed. + */ +#define BLE_STATUS_DEV_IN_BLACKLIST 0x59U + +/* CSRK not found during validation of an incoming signed packet + */ +#define BLE_STATUS_CSRK_NOT_FOUND 0x5AU + +/* IRK not found (Currently not used) + */ +#define BLE_STATUS_IRK_NOT_FOUND 0x5BU + +/* A search for a specific remote device was unsuccessful because no entry + * exists either into NVM Database or in volatile database. + */ +#define BLE_STATUS_DEV_NOT_FOUND 0x5CU + +/* The remote device is not bonded, and no operations related to bonded devices + * may be performed (e.g. writing Gatt Client data). + */ +#define BLE_STATUS_DEV_NOT_BONDED 0x5EU + +/* The attribute handle is invalid. + */ +#define BLE_STATUS_INVALID_HANDLE 0x60U + +/* There aren't sufficient Attributes handles available for allocation during + * creation of Services, Characteristics or Descriptors. + */ +#define BLE_STATUS_OUT_OF_HANDLE 0x61U + +/* The requested GATT operation is not allowed in this context/status or using + * the provided parameters. + * This is a specific GATT error, different from generic Not Allowed error, + * because it refers to specific GATT specifications/rules. + */ +#define BLE_STATUS_INVALID_OPERATION 0x62U + +/* The requested operation failed for a temporary lack of resources + * (e.g. packet pool or timers), but it may be retried later when resources may + * become available (packets or timers may have been released by other + * consumers). + */ +#define BLE_STATUS_INSUFFICIENT_RESOURCES 0x64U + +/* Notification/Indication can't be sent to the requested remote device because + * it doesn't satisfy the needed security permission. + */ +#define BLE_STATUS_SEC_PERMISSION_ERROR 0x65U + +/* The address of the device could not be resolved using the IRK stored\n + */ +#define BLE_STATUS_ADDRESS_NOT_RESOLVED 0x70U + +/* Returned when no valid slots are available + * (e.g. when there are no available state machines). + */ +#define BLE_STATUS_NO_VALID_SLOT 0x82U + +/* The only slot available is not long enough to satisfy scan window request. + */ +#define BLE_STATUS_SCAN_WINDOW_SHORT 0x83U + +/* Returned when the maximum requested interval to be allocated is shorter + * then the current anchor period and there is no submultiple for the + * current anchor period that is between the minimum and the maximum requested + * intervals. + */ +#define BLE_STATUS_NEW_INTERVAL_FAILED 0x84U + +/* Returned when the maximum requested interval to be allocated is greater + * than the current anchor period and there is no multiple of the anchor + * period that is between the minimum and the maximum requested intervals. + */ +#define BLE_STATUS_INTERVAL_TOO_LARGE 0x85U + +/* Returned when the current anchor period or a new one can be found that + * is compatible to the interval range requested by the new slot but the + * maximum available length that can be allocated is less than the minimum + * requested slot length. + */ +#define BLE_STATUS_LENGTH_FAILED 0x86U + +/* The Host failed while performing the requested operation. + */ +#define BLE_STATUS_FAILED 0x91U + +/* Invalid parameters in Host commands + */ +#define BLE_STATUS_INVALID_PARAMS 0x92U + +/* The Host is already processing another request received in advance. + */ +#define BLE_STATUS_BUSY 0x93U + +/* The operation requested cannot be completed immediately by the Host + * (usually because of lack of resources). + * The operation is generally put on hold by the caller and it's usually + * retried on later time. + */ +#define BLE_STATUS_PENDING 0x95U + +/* The requested operation violates the logic of the called layer/function or + * the format of the data to be processed during the operation. + */ +#define BLE_STATUS_ERROR 0x97U + +/* The requested operation failed because of lack of memory. + * Out of memory shall be returned for situations where memory will never + * become available again (e.g. ATT database) + */ +#define BLE_STATUS_OUT_OF_MEMORY 0x98U + +/* Returned when a timeout occurs at BLE application interface + */ +#define BLE_STATUS_TIMEOUT 0xFFU + +/* ------------------------------------------------------------------------- */ + +/* Characteristic value lengths + */ +#define DEVICE_NAME_CHARACTERISTIC_LEN 8 +#define APPEARANCE_CHARACTERISTIC_LEN 2 +#define PERIPHERAL_PRIVACY_CHARACTERISTIC_LEN 1 +#define RECONNECTION_ADDR_CHARACTERISTIC_LEN 6 +#define PERIPHERAL_PREF_CONN_PARAMS_CHARACTERISTIC_LEN 8 + +/* Adv. lengths + */ +#define MAX_ADV_DATA_LEN 31U +#define BD_ADDR_SIZE 6U + +/* Privacy flag values + */ +#define PRIVACY_DISABLED 0x00 +#define PRIVACY_ENABLED 0x02 + +/* Intervals in terms of 625 micro sec + */ +#define DIR_CONN_ADV_INT_MIN 0x190U /* 250 ms */ +#define DIR_CONN_ADV_INT_MAX 0x320U /* 500 ms */ +#define UNDIR_CONN_ADV_INT_MIN 0x800U /* 1.28 s */ +#define UNDIR_CONN_ADV_INT_MAX 0x1000U /* 2.56 s */ +#define LIM_DISC_ADV_INT_MIN 0x190U /* 250 ms */ +#define LIM_DISC_ADV_INT_MAX 0x320U /* 500 ms */ +#define GEN_DISC_ADV_INT_MIN 0x800U /* 1.28 s */ +#define GEN_DISC_ADV_INT_MAX 0x1000U /* 2.56 s */ + +/* GAP Roles + */ +#define GAP_PERIPHERAL_ROLE 0x01U +#define GAP_BROADCASTER_ROLE 0x02U +#define GAP_CENTRAL_ROLE 0x04U +#define GAP_OBSERVER_ROLE 0x08U + +/* GAP procedure codes + * Procedure codes for ACI_GAP_PROC_COMPLETE_EVENT event + * and ACI_GAP_TERMINATE_GAP_PROC command. + */ +#define GAP_LIMITED_DISCOVERY_PROC 0x01U +#define GAP_GENERAL_DISCOVERY_PROC 0x02U +#define GAP_PERIODIC_ADVERTISING_CONNECTION_PROC 0x04U +#define GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC 0x08U +#define GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC 0x10U +#define GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC 0x20U +#define GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC 0x40U +#define GAP_OBSERVATION_PROC 0x80U + +/* GAP Address Type + */ +#define GAP_PUBLIC_ADDR 0x00U +#define GAP_STATIC_RANDOM_ADDR 0x01U +#define GAP_RESOLVABLE_PRIVATE_ADDR 0x02U +#define GAP_NON_RESOLVABLE_PRIVATE_ADDR 0x03U + +/* Bitmap definitions for Mode of ACI_GAP_ADD_DEVICES_TO_LIST + */ +#define GAP_ADD_DEV_MODE_RESOLVING_LIST_ONLY 0x00U +#define GAP_ADD_DEV_MODE_CLEAR 0x01U +#define GAP_ADD_DEV_MODE_FILTER_ACC_LIST_ONLY 0x02U +#define GAP_ADD_DEV_MODE_BOTH_LISTS 0x04U + +/* ------------------------------------------------------------------------- */ + +/* IO capabilities + * (ACI_GAP_SET_IO_CAPABILITY) + */ +#define IO_CAP_DISPLAY_ONLY 0x00U +#define IO_CAP_DISPLAY_YES_NO 0x01U +#define IO_CAP_KEYBOARD_ONLY 0x02U +#define IO_CAP_NO_INPUT_NO_OUTPUT 0x03U +#define IO_CAP_KEYBOARD_DISPLAY 0x04U + +/* Bonding mode + * (ACI_GAP_SET_AUTHENTICATION_REQUIREMENT) + */ +#define NO_BONDING 0x00U +#define BONDING 0x01U + +/* MITM protection + * (ACI_GAP_SET_AUTHENTICATION_REQUIREMENT) + */ +#define MITM_PROTECTION_NOT_REQUIRED 0x00U +#define MITM_PROTECTION_REQUIRED 0x01U + +/* LE Secure Connections support + * (ACI_GAP_SET_AUTHENTICATION_REQUIREMENT) + */ +#define SC_PAIRING_UNSUPPORTED 0x00U +#define SC_PAIRING_OPTIONAL 0x01U +#define SC_PAIRING_ONLY 0x02U + +/* Keypress notification support + * (ACI_GAP_SET_AUTHENTICATION_REQUIREMENT) + */ +#define KEYPRESS_NOT_SUPPORTED 0x00U +#define KEYPRESS_SUPPORTED 0x01U + +/* Use fixed pin + * (ACI_GAP_SET_AUTHENTICATION_REQUIREMENT) + */ +#define USE_FIXED_PIN_FOR_PAIRING_ALLOWED 0x00U +#define USE_FIXED_PIN_FOR_PAIRING_FORBIDDEN 0x01U + +/* Authorization requirements + * (ACI_GAP_SET_AUTHORIZATION_REQUIREMENT) + */ +#define AUTHORIZATION_NOT_REQUIRED 0x00U +#define AUTHORIZATION_REQUIRED 0x01U + +/* Connection authorization response + * (ACI_GAP_AUTHORIZATION_RESP) + */ +#define CONNECTION_AUTHORIZED 0x01U +#define CONNECTION_REJECTED 0x02U + +/* SMP pairing status + * (ACI_GAP_PAIRING_COMPLETE_EVENT) + */ +#define SMP_PAIRING_STATUS_SUCCESS 0x00U +#define SMP_PAIRING_STATUS_SMP_TIMEOUT 0x01U +#define SMP_PAIRING_STATUS_PAIRING_FAILED 0x02U +#define SMP_PAIRING_STATUS_ENCRYPT_FAILED 0x03U + +/* SMP pairing failed reason code + * (ACI_GAP_PAIRING_COMPLETE_EVENT) + */ +#define REASON_PASSKEY_ENTRY_FAILED 0x01U +#define REASON_OOB_NOT_AVAILABLE 0x02U +#define REASON_AUTHENTICATION_REQ 0x03U +#define REASON_CONFIRM_VALUE_FAILED 0x04U +#define REASON_PAIRING_NOT_SUPPORTED 0x05U +#define REASON_ENCRYPTION_KEY_SIZE 0x06U +#define REASON_COMMAND_NOT_SUPPORTED 0x07U +#define REASON_UNSPECIFIED_REASON 0x08U +#define REASON_REPEATED_ATTEMPTS 0x09U +#define REASON_INVALID_PARAMETERS 0x0AU +#define REASON_DHKEY_CHECK_FAILED 0x0BU +#define REASON_NUM_COMPARISON_FAILED 0x0CU +#define REASON_KEY_REJECTED 0x0FU + +/* Passkey input type detected + * (ACI_GAP_PASSKEY_INPUT) + */ +#define PASSKEY_ENTRY_STARTED 0x00U +#define PASSKEY_DIGIT_ENTERED 0x01U +#define PASSKEY_DIGIT_ERASED 0x02U +#define PASSKEY_CLEARED 0x03U +#define PASSKEY_ENTRY_COMPLETED 0x04U + +/* Numeric Comparison Confirm Value + * (ACI_GAP_NUMERIC_COMPARISON_VALUE_CONFIRM_YESNO) + */ +#define NUMERIC_COMPARISON_CONFIRM_NO 0x00U +#define NUMERIC_COMPARISON_CONFIRM_YES 0x01U + +/* OOB Device Type + * (ACI_GAP_SET_OOB_DATA) + */ +#define OOB_DEVICE_TYPE_LOCAL 0x00U +#define OOB_DEVICE_TYPE_REMOTE 0x01U + +/* OOB Data Type + * (ACI_GAP_GET_OOB_DATA, ACI_GAP_SET_OOB_DATA) + */ +#define OOB_DATA_TYPE_LP_TK 0x00U +#define OOB_DATA_TYPE_SC_RANDOM 0x01U +#define OOB_DATA_TYPE_SC_CONFIRM 0x02U + +/* ------------------------------------------------------------------------- */ + +/* Access permissions for an attribute + */ +#define ATTR_NO_ACCESS 0x00U +#define ATTR_ACCESS_READ_ONLY 0x01U +#define ATTR_ACCESS_WRITE_REQ_ONLY 0x02U +#define ATTR_ACCESS_READ_WRITE 0x03U +#define ATTR_ACCESS_WRITE_WITHOUT_RESPONSE 0x04U +#define ATTR_ACCESS_SIGNED_WRITE_ALLOWED 0x08U +#define ATTR_ACCESS_WRITE_ANY 0x0EU +#define ATTR_ACCESS_ANY 0x0FU + +/* Characteristic properties + */ +#define CHAR_PROP_NONE 0x00U +#define CHAR_PROP_BROADCAST 0x01U +#define CHAR_PROP_READ 0x02U +#define CHAR_PROP_WRITE_WITHOUT_RESP 0x04U +#define CHAR_PROP_WRITE 0x08U +#define CHAR_PROP_NOTIFY 0x10u +#define CHAR_PROP_INDICATE 0x20U +#define CHAR_PROP_SIGNED_WRITE 0x40U +#define CHAR_PROP_EXT 0x80U + +/* Security permissions for an attribute + */ +#define ATTR_PERMISSION_NONE 0x00U /* No security. */ +#define ATTR_PERMISSION_AUTHEN_READ 0x01U /* Need authentication to read */ +#define ATTR_PERMISSION_AUTHOR_READ 0x02U /* Need authorization to read */ +#define ATTR_PERMISSION_ENCRY_READ 0x04U /* Need encryption to read */ +#define ATTR_PERMISSION_AUTHEN_WRITE 0x08U /* Need authentication to write */ +#define ATTR_PERMISSION_AUTHOR_WRITE 0x10U /* Need authorization to write */ +#define ATTR_PERMISSION_ENCRY_WRITE 0x20U /* Need encryption to write */ + +/* Type of UUID (16 bit or 128 bit) + */ +#define UUID_TYPE_16 0x01U +#define UUID_TYPE_128 0x02U + +/* Type of service (primary or secondary) + */ +#define PRIMARY_SERVICE 0x01U +#define SECONDARY_SERVICE 0x02U + +/* Gatt Event Mask + * Type of event generated by GATT server + * See aci_gatt_add_char. + */ +#define GATT_DONT_NOTIFY_EVENTS 0x00U +#define GATT_NOTIFY_ATTRIBUTE_WRITE 0x01U +#define GATT_NOTIFY_WRITE_REQ_AND_WAIT_FOR_APPL_RESP 0x02U +#define GATT_NOTIFY_READ_REQ_AND_WAIT_FOR_APPL_RESP 0x04U +#define GATT_NOTIFY_NOTIFICATION_COMPLETION 0x08U + +/* Type of characteristic length (see ACI_GATT_ADD_CHAR) + */ +#define CHAR_VALUE_LEN_CONSTANT 0x00 +#define CHAR_VALUE_LEN_VARIABLE 0x01 + +/* Encryption key size + */ +#define MIN_ENCRY_KEY_SIZE 7U +#define MAX_ENCRY_KEY_SIZE 16U + +/* Format + */ +#define FORMAT_UINT8 0x04U +#define FORMAT_UINT16 0x06U +#define FORMAT_SINT16 0x0EU +#define FORMAT_SINT24 0x0FU + +/* Unit + */ +#define UNIT_UNITLESS 0x2700 +#define UNIT_TEMP_CELSIUS 0x272F +#define UNIT_PRESSURE_BAR 0x2780 + +/* Update_Type definitions for ACI_GATT_UPDATE_CHAR_VALUE_EXT + */ +#define GATT_CHAR_UPDATE_LOCAL_ONLY 0x00U +#define GATT_CHAR_UPDATE_SEND_NOTIFICATION 0x01U +#define GATT_CHAR_UPDATE_SEND_INDICATION 0x02U + +/* ------------------------------------------------------------------------- */ + +/* Advertising Type + */ +#define ADV_IND 0 +#define ADV_DIRECT_IND 1 +#define ADV_SCAN_IND 2 +#define ADV_NONCONN_IND 3 +#define ADV_DIRECT_IND_LDC 4 +#define SCAN_RSP 4 + +/* Advertising channels + */ +#define ADV_CH_37 0x01 +#define ADV_CH_38 0x02 +#define ADV_CH_39 0x04 + +/* ------------------------------------------------------------------------- */ + +/* Definitions for Radio_Activity_Mask + * (ACI_HAL_SET_RADIO_ACTIVITY_MASK) + */ +#define RADIO_ACT_MASK_IDLE 0x0001U +#define RADIO_ACT_MASK_ADVERTISING 0x0002U +#define RADIO_ACT_MASK_PERIPH_CONNECT 0x0004U +#define RADIO_ACT_MASK_SCANNING 0x0008U +#define RADIO_ACT_MASK_CENTR_CONNECT 0x0020U +#define RADIO_ACT_MASK_TX_TEST 0x0040U +#define RADIO_ACT_MASK_RX_TEST 0x0080U +#define RADIO_ACT_MASK_PERIOD_ADVERTISING 0x0200U +#define RADIO_ACT_MASK_PERIOD_SYNC 0x0400U +#define RADIO_ACT_MASK_ISO_BROADCAST 0x0800U +#define RADIO_ACT_MASK_ISO_SYNC 0x1000U +#define RADIO_ACT_MASK_ISO_PERIPH_CONNECT 0x2000U +#define RADIO_ACT_MASK_ISO_CENTR_CONNECT 0x4000U + +/* ------------------------------------------------------------------------- */ + +/* Definitions for FW_Error_Type + * (ACI_HAL_FW_ERROR_EVENT) + */ +#define FW_L2CAP_RECOMBINATION_ERROR 0x01U +#define FW_GATT_UNEXPECTED_PEER_MESSAGE 0x02U +#define FW_NVM_LEVEL_WARNING 0x03U +#define FW_COC_RX_DATA_LENGTH_TOO_LARGE 0x04U +#define FW_ECOC_CONN_RSP_ALREADY_ASSIGNED_DCID 0x05U + +/* ------------------------------------------------------------------------- */ + +/* Offset for configuration values (see ACI_HAL_WRITE_CONFIG_DATA) + */ +#define CONFIG_DATA_PUBADDR_OFFSET 0x00U +#define CONFIG_DATA_ER_OFFSET 0x08U +#define CONFIG_DATA_IR_OFFSET 0x18U +#define CONFIG_DATA_RANDOM_ADDRESS_OFFSET 0x2EU +#define CONFIG_DATA_GAP_ADD_REC_NBR_OFFSET 0x34U +#define CONFIG_DATA_SC_KEY_TYPE_OFFSET 0x35U +#define CONFIG_DATA_SMP_MODE_OFFSET 0xB0U +#define CONFIG_DATA_LL_SCAN_CHAN_MAP_OFFSET 0xC0U +#define CONFIG_DATA_LL_BG_SCAN_MODE_OFFSET 0xC1U + +/* Length for configuration values (see ACI_HAL_WRITE_CONFIG_DATA) + */ +#define CONFIG_DATA_PUBADDR_LEN 6 +#define CONFIG_DATA_ER_LEN 16 +#define CONFIG_DATA_IR_LEN 16 +#define CONFIG_DATA_RANDOM_ADDRESS_LEN 6 +#define CONFIG_DATA_GAP_ADD_REC_NBR_LEN 1 +#define CONFIG_DATA_SC_KEY_TYPE_LEN 1 +#define CONFIG_DATA_SMP_MODE_LEN 1 +#define CONFIG_DATA_LL_SCAN_CHAN_MAP_LEN 1 +#define CONFIG_DATA_LL_BG_SCAN_MODE_LEN 1 + +/* ------------------------------------------------------------------------- */ + + +#endif /* BLE_DEFS_H__ */ diff --git a/lib/stm32wba/hci/ble_std.h b/lib/stm32wba/hci/ble_std.h new file mode 100644 index 000000000..f9021a9bd --- /dev/null +++ b/lib/stm32wba/hci/ble_std.h @@ -0,0 +1,368 @@ +/****************************************************************************** + * @file ble_std.h + * @author MDG + * @brief BLE standard definitions + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2023 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ***************************************************************************** + */ + +#ifndef BLE_STD_H__ +#define BLE_STD_H__ + + +/* HCI packet type */ +#define HCI_COMMAND_PKT_TYPE 0x01U +#define HCI_ACLDATA_PKT_TYPE 0x02U +#define HCI_EVENT_PKT_TYPE 0x04U +#define HCI_ISODATA_PKT_TYPE 0x05U + +/* HCI packet header size */ +#define HCI_COMMAND_HDR_SIZE 4 +#define HCI_ACLDATA_HDR_SIZE 5 +#define HCI_EVENT_HDR_SIZE 3 +#define HCI_ISODATA_HDR_SIZE 5 + +/* HCI parameters length */ +#define HCI_COMMAND_MAX_PARAM_LEN 255 +#define HCI_ACLDATA_MAX_DATA_LEN 251 /* LE_ACL_Data_Packet_Length */ +#define HCI_EVENT_MAX_PARAM_LEN 255 +#define HCI_ISODATA_MAX_DATA_LEN 300 /* ISO_Data_Packet_Length */ +#define MAX_PARAM_CIS (BLE_CMD_MAX_PARAM_LEN/9) /*sizeof(CIS_cfg_t)*/ + +/* HCI packet maximum size */ +#define HCI_COMMAND_PKT_MAX_SIZE \ + (HCI_COMMAND_HDR_SIZE + HCI_COMMAND_MAX_PARAM_LEN) +#define HCI_ACLDATA_PKT_MAX_SIZE \ + (HCI_ACLDATA_HDR_SIZE + HCI_ACLDATA_MAX_DATA_LEN) +#define HCI_EVENT_PKT_MAX_SIZE \ + (HCI_EVENT_HDR_SIZE + HCI_EVENT_MAX_PARAM_LEN) +#define HCI_ISODATA_PKT_MAX_SIZE \ + (HCI_ISODATA_HDR_SIZE + HCI_ISODATA_MAX_DATA_LEN) + +/* HCI event code */ +#define HCI_DISCONNECTION_COMPLETE_EVT_CODE 0x05U +#define HCI_ENCRYPTION_CHANGE_EVT_CODE 0x08U +#define HCI_READ_REMOTE_VERSION_INFORMATION_COMPLETE_EVT_CODE 0x0CU +#define HCI_COMMAND_COMPLETE_EVT_CODE 0x0EU +#define HCI_COMMAND_STATUS_EVT_CODE 0x0FU +#define HCI_HARDWARE_ERROR_EVT_CODE 0x10U +#define HCI_NUMBER_OF_COMPLETED_PACKETS_EVT_CODE 0x13U +#define HCI_DATA_BUFFER_OVERFLOW_EVT_CODE 0x1AU +#define HCI_ENCRYPTION_KEY_REFRESH_COMPLETE_EVT_CODE 0x30U +#define HCI_LE_META_EVT_CODE 0x3EU +#define HCI_AUTHENTICATED_PAYLOAD_TIMEOUT_EXPIRED_EVT_CODE 0x57U +#define HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE 0xFFU + +/* HCI LE subevent code */ +#define HCI_LE_CONNECTION_COMPLETE_SUBEVT_CODE 0x01U +#define HCI_LE_ADVERTISING_REPORT_SUBEVT_CODE 0x02U +#define HCI_LE_CONNECTION_UPDATE_COMPLETE_SUBEVT_CODE 0x03U +#define HCI_LE_READ_REMOTE_FEATURES_COMPLETE_SUBEVT_CODE 0x04U +#define HCI_LE_LONG_TERM_KEY_REQUEST_SUBEVT_CODE 0x05U +#define HCI_LE_REMOTE_CONNECTION_PARAMETER_REQUEST_SUBEVT_CODE 0x06U +#define HCI_LE_DATA_LENGTH_CHANGE_SUBEVT_CODE 0x07U +#define HCI_LE_READ_LOCAL_P256_PUBLIC_KEY_COMPLETE_SUBEVT_CODE 0x08U +#define HCI_LE_GENERATE_DHKEY_COMPLETE_SUBEVT_CODE 0x09U +#define HCI_LE_ENHANCED_CONNECTION_COMPLETE_SUBEVT_CODE 0x0AU +#define HCI_LE_DIRECTED_ADVERTISING_REPORT_SUBEVT_CODE 0x0BU +#define HCI_LE_PHY_UPDATE_COMPLETE_SUBEVT_CODE 0x0CU +#define HCI_LE_EXTENDED_ADVERTISING_REPORT_SUBEVT_CODE 0x0DU +#define HCI_LE_PERIODIC_ADVERTISING_SYNC_ESTABLISHED_SUBEVT_CODE 0x0EU +#define HCI_LE_PERIODIC_ADVERTISING_REPORT_SUBEVT_CODE 0x0FU +#define HCI_LE_PERIODIC_ADVERTISING_SYNC_LOST_SUBEVT_CODE 0x10U +#define HCI_LE_SCAN_TIMEOUT_SUBEVT_CODE 0x11U +#define HCI_LE_ADVERTISING_SET_TERMINATED_SUBEVT_CODE 0x12U +#define HCI_LE_SCAN_REQUEST_RECEIVED_SUBEVT_CODE 0x13U +#define HCI_LE_CHANNEL_SELECTION_ALGORITHM_SUBEVT_CODE 0x14U +#define HCI_LE_CONNECTIONLESS_IQ_REPORT_SUBEVT_CODE 0x15U +#define HCI_LE_CONNECTION_IQ_REPORT_SUBEVT_CODE 0x16U +#define HCI_LE_CTE_REQUEST_FAILED_SUBEVT_CODE 0x17U +#define HCI_LE_PERIODIC_ADVERTISING_SYNC_TRANSFER_RECEIVED_SUBEVT_CODE 0x18U +#define HCI_LE_CIS_ESTABLISHED_SUBEVT_CODE 0x19U +#define HCI_LE_CIS_REQUEST_SUBEVT_CODE 0x1AU +#define HCI_LE_CREATE_BIG_COMPLETE_SUBEVT_CODE 0x1BU +#define HCI_LE_TERMINATE_BIG_COMPLETE_SUBEVT_CODE 0x1CU +#define HCI_LE_BIG_SYNC_ESTABLISHED_SUBEVT_CODE 0x1DU +#define HCI_LE_BIG_SYNC_LOST_SUBEVT_CODE 0x1EU +#define HCI_LE_REQUEST_PEER_SCA_COMPLETE_SUBEVT_CODE 0x1FU +#define HCI_LE_PATH_LOSS_THRESHOLD_SUBEVT_CODE 0x20U +#define HCI_LE_TRANSMIT_POWER_REPORTING_SUBEVT_CODE 0x21U +#define HCI_LE_BIGINFO_ADVERTISING_REPORT_SUBEVT_CODE 0x22U +#define HCI_LE_SUBRATE_CHANGE_SUBEVT_CODE 0x23U + +/* HCI error code */ +#define HCI_SUCCESS_ERR_CODE 0x00U +#define HCI_UNKNOWN_HCI_COMMAND_ERR_CODE 0x01U +#define HCI_UNKNOWN_CONNECTION_IDENTIFIER_ERR_CODE 0x02U +#define HCI_HARDWARE_FAILURE_ERR_CODE 0x03U +#define HCI_AUTHENTICATION_FAILURE_ERR_CODE 0x05U +#define HCI_PIN_OR_KEY_MISSING_ERR_CODE 0x06U +#define HCI_MEMORY_CAPACITY_EXCEEDED_ERR_CODE 0x07U +#define HCI_CONNECTION_TIMEOUT_ERR_CODE 0x08U +#define HCI_CONNECTION_LIMIT_EXCEEDED_ERR_CODE 0x09U +#define HCI_CONNECTION_ALREADY_EXISTS_ERR_CODE 0x0BU +#define HCI_COMMAND_DISALLOWED_ERR_CODE 0x0CU +#define HCI_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE_ERR_CODE 0x11U +#define HCI_INVALID_HCI_COMMAND_PARAMETERS_ERR_CODE 0x12U +#define HCI_REMOTE_USER_TERMINATED_CONNECTION_ERR_CODE 0x13U +#define HCI_REMOTE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES_ERR_CODE 0x14U +#define HCI_REMOTE_TERMINATED_CONNECTION_DUE_TO_POWER_OFF_ERR_CODE 0x15U +#define HCI_CONNECTION_TERMINATED_BY_LOCAL_HOST_ERR_CODE 0x16U +#define HCI_UNSUPPORTED_REMOTE_FEATURE_ERR_CODE 0x1AU +#define HCI_INVALID_LL_PARAMETERS_ERR_CODE 0x1EU +#define HCI_UNSPECIFIED_ERROR_ERR_CODE 0x1FU +#define HCI_UNSUPPORTED_LL_PARAMETER_VALUE_ERR_CODE 0x20U +#define HCI_LL_RESPONSE_TIMEOUT_ERR_CODE 0x22U +#define HCI_LL_PROCEDURE_COLLISION_ERR_CODE 0x23U +#define HCI_LMP_PDU_NOT_ALLOWED_ERR_CODE 0x24U +#define HCI_INSTANT_PASSED_ERR_CODE 0x28U +#define HCI_DIFFERENT_TRANSACTION_COLLISION_ERR_CODE 0x2AU +#define HCI_PARAMETER_OUT_OF_MANDATORY_RANGE_ERR_CODE 0x30U +#define HCI_HOST_BUSY_PAIRING_ERR_CODE 0x38U +#define HCI_CONTROLLER_BUSY_ERR_CODE 0x3AU +#define HCI_UNACCEPTABLE_CONNECTION_PARAMETERS_ERR_CODE 0x3BU +#define HCI_ADVERTISING_TIMEOUT_ERR_CODE 0x3CU +#define HCI_CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE_ERR_CODE 0x3DU +#define HCI_CONNECTION_FAILED_TO_BE_ESTABLISHED_ERR_CODE 0x3EU +#define HCI_UNKNOWN_ADVERTISING_IDENTIFIER_ERR_CODE 0x42U +#define HCI_ADVERTISING_LIMIT_REACHED_ERR_CODE 0x43U +#define HCI_PACKET_TOO_LONG_ERR_CODE 0x45U + +/* HCI_LE_Set_Advertising_Parameters: Advertising_Type */ +#define HCI_ADV_TYPE_ADV_IND 0x00U +#define HCI_ADV_TYPE_ADV_DIRECT_IND_HDC 0x01U +#define HCI_ADV_TYPE_ADV_SCAN_IND 0x02U +#define HCI_ADV_TYPE_ADV_NONCONN_IND 0x03U +#define HCI_ADV_TYPE_ADV_DIRECT_IND_LDC 0x04U + +/* HCI_LE_Set_Advertising_Parameters: Advertising_Filter_Policy */ +#define HCI_ADV_FILTER_NO 0x00U +#define HCI_ADV_FILTER_ACC_LIST_USED_FOR_SCAN 0x01U +#define HCI_ADV_FILTER_ACC_LIST_USED_FOR_CONNECT 0x02U +#define HCI_ADV_FILTER_ACC_LIST_USED_FOR_ALL 0x03U + +/* HCI_LE_Set_[Advertising/Scan]_Parameters: Own_Address_Type */ +#define HCI_OWN_ADDR_TYPE_PUBLIC 0x00U +#define HCI_OWN_ADDR_TYPE_RANDOM 0x01U +#define HCI_OWN_ADDR_TYPE_RP_OR_PUBLIC 0x02U +#define HCI_OWN_ADDR_TYPE_RP_OR_RANDOM 0x03U + +/* HCI_LE_Set_Scan_Parameters: LE_Scan_Type */ +#define HCI_SCAN_TYPE_PASSIVE 0x00U +#define HCI_SCAN_TYPE_ACTIVE 0x01U + +/* HCI_LE_Set_Scan_Parameters: Scanning_Filter_Policy */ +#define HCI_SCAN_FILTER_NO 0x00U +#define HCI_SCAN_FILTER_ACC_LIST_USED 0x01U +#define HCI_SCAN_FILTER_NO_EXT 0x02U +#define HCI_SCAN_FILTER_ACC_LIST_USED_EXT 0x03U + +/* HCI_LE_Create_Connection: Initiator_Filter_Policy */ +#define HCI_INIT_FILTER_NO 0x00U +#define HCI_INIT_FILTER_ACC_LIST_USED 0x01U + +/* HCI_LE_Read_PHY: TX_PHY */ +#define HCI_TX_PHY_LE_1M 0x01U +#define HCI_TX_PHY_LE_2M 0x02U +#define HCI_TX_PHY_LE_CODED 0x03U + +/* HCI_LE_Read_PHY: RX_PHY */ +#define HCI_RX_PHY_LE_1M 0x01U +#define HCI_RX_PHY_LE_2M 0x02U +#define HCI_RX_PHY_LE_CODED 0x03U + +/* HCI_LE_Set_PHY: ALL_PHYS */ +#define HCI_ALL_PHYS_TX_NO_PREF 0x01U +#define HCI_ALL_PHYS_RX_NO_PREF 0x02U + +/* HCI_LE_Set_PHY: TX_PHYS */ +#define HCI_TX_PHYS_LE_1M_PREF 0x01U +#define HCI_TX_PHYS_LE_2M_PREF 0x02U +#define HCI_TX_PHYS_LE_CODED_PREF 0x04U + +/* HCI_LE_Set_PHY: RX_PHYS */ +#define HCI_RX_PHYS_LE_1M_PREF 0x01U +#define HCI_RX_PHYS_LE_2M_PREF 0x02U +#define HCI_RX_PHYS_LE_CODED_PREF 0x04U + +/* HCI_LE_Set_Extended_Advertising_Parameters: Advertising_Event_Properties */ +#define HCI_ADV_EVENT_PROP_CONNECTABLE 0x0001U +#define HCI_ADV_EVENT_PROP_SCANNABLE 0x0002U +#define HCI_ADV_EVENT_PROP_DIRECTED 0x0004U +#define HCI_ADV_EVENT_PROP_HDC_DIRECTED 0x0008U +#define HCI_ADV_EVENT_PROP_LEGACY 0x0010U +#define HCI_ADV_EVENT_PROP_ANONYMOUS 0x0020U +#define HCI_ADV_EVENT_PROP_TXPOWER_INC 0x0040U + +/* HCI_LE_Set_Extended_Advertising_Parameters: Primary_Advertising_PHY */ +#define HCI_PRIMARY_ADV_PHY_LE_1M 0x01U +#define HCI_PRIMARY_ADV_PHY_LE_CODED 0x03U + +/* HCI_LE_Set_Extended_Advertising_Data: Operation */ +#define HCI_SET_ADV_DATA_OPERATION_INTERMEDIATE 0x00U +#define HCI_SET_ADV_DATA_OPERATION_FIRST 0x01U +#define HCI_SET_ADV_DATA_OPERATION_LAST 0x02U +#define HCI_SET_ADV_DATA_OPERATION_COMPLETE 0x03U +#define HCI_SET_ADV_DATA_OPERATION_UNCHANGED 0x04U + +/* HCI_LE_Advertising_Report: Event_Type */ +#define HCI_ADV_EVT_TYPE_ADV_IND 0x00U +#define HCI_ADV_EVT_TYPE_ADV_DIRECT_IND 0x01U +#define HCI_ADV_EVT_TYPE_ADV_SCAN_IND 0x02U +#define HCI_ADV_EVT_TYPE_ADV_NONCONN_IND 0x03U +#define HCI_ADV_EVT_TYPE_SCAN_RSP 0x04U + +/* HCI_LE_Set_Extended_Scan_Parameters: Scanning_PHYs */ +#define HCI_SCANNING_PHYS_LE_1M 0x01U +#define HCI_SCANNING_PHYS_LE_CODED 0x04U + +/* HCI_LE_Extended_Create_Connection: Initiating_PHYs */ +#define HCI_INIT_PHYS_SCAN_CONN_LE_1M 0x01U +#define HCI_INIT_PHYS_CONN_LE_2M 0x02U +#define HCI_INIT_PHYS_SCAN_CONN_LE_CODED 0x04U + +/* HCI_LE_Receiver_Test/HCI_LE_Transmitter_Test [v2]: PHY */ +#define HCI_TEST_PHY_LE_1M 0x01U +#define HCI_TEST_PHY_LE_2M 0x02U + +/* HCI_LE_Connection_Complete/HCI_LE_Enhanced_Connection_Complete: Role */ +#define HCI_ROLE_CENTRAL 0x00U +#define HCI_ROLE_PERIPHERAL 0x01U + +/* HCI_LE_Set_Privacy_Mode: Privacy_Mode */ +#define HCI_PRIV_MODE_NETWORK 0x00U +#define HCI_PRIV_MODE_DEVICE 0x01U + +/* Bluetooth Core Specification versions + */ +#define BLE_CORE_5_2 11 +#define BLE_CORE_5_3 12 +#define BLE_CORE_5_4 13 + +/* AD types for advertising data and scan response data + */ +#define AD_TYPE_FLAGS 0x01U +#define AD_TYPE_16_BIT_SERV_UUID 0x02U +#define AD_TYPE_16_BIT_SERV_UUID_CMPLT_LIST 0x03U +#define AD_TYPE_32_BIT_SERV_UUID 0x04U +#define AD_TYPE_32_BIT_SERV_UUID_CMPLT_LIST 0x05U +#define AD_TYPE_128_BIT_SERV_UUID 0x06U +#define AD_TYPE_128_BIT_SERV_UUID_CMPLT_LIST 0x07U +#define AD_TYPE_SHORTENED_LOCAL_NAME 0x08U +#define AD_TYPE_COMPLETE_LOCAL_NAME 0x09U +#define AD_TYPE_TX_POWER_LEVEL 0x0AU +#define AD_TYPE_CLASS_OF_DEVICE 0x0DU +#define AD_TYPE_SEC_MGR_TK_VALUE 0x10U +#define AD_TYPE_SEC_MGR_OOB_FLAGS 0x11U +#define AD_TYPE_PERIPHERAL_CONN_INTERVAL 0x12U +#define AD_TYPE_SERV_SOLICIT_16_BIT_UUID_LIST 0x14U +#define AD_TYPE_SERV_SOLICIT_128_BIT_UUID_LIST 0x15U +#define AD_TYPE_SERVICE_DATA 0x16U +#define AD_TYPE_APPEARANCE 0x19U +#define AD_TYPE_ADVERTISING_INTERVAL 0x1AU +#define AD_TYPE_LE_ROLE 0x1CU +#define AD_TYPE_SERV_SOLICIT_32_BIT_UUID_LIST 0x1FU +#define AD_TYPE_URI 0x24U +#define AD_TYPE_MANUFACTURER_SPECIFIC_DATA 0xFFU + +/* Flag bits for Flags AD Type + */ +#define FLAG_BIT_LE_LIMITED_DISCOVERABLE_MODE 0x01 +#define FLAG_BIT_LE_GENERAL_DISCOVERABLE_MODE 0x02 +#define FLAG_BIT_BR_EDR_NOT_SUPPORTED 0x04 +#define FLAG_BIT_LE_BR_EDR_CONTROLLER 0x08 +#define FLAG_BIT_LE_BR_EDR_HOST 0x10 + +/* Appearance values + */ +#define GAP_APPEARANCE_UNKNOWN 0x0000 +#define GAP_APPEARANCE_GENERIC_PHONE 0x0040 +#define GAP_APPEARANCE_GENERIC_COMPUTER 0x0080 +#define GAP_APPEARANCE_GENERIC_WATCH 0x00C0 +#define GAP_APPEARANCE_WATCH_SPORT_WATCH 0x00C1 +#define GAP_APPEARANCE_GENERIC_CLOCK 0x0100 +#define GAP_APPEARANCE_GENERIC_DISPLAY 0x0140 +#define GAP_APPEARANCE_GENERIC_REMOTE_CONTROL 0x0180 +#define GAP_APPEARANCE_GENERIC_EYE_GLASSES 0x01C0 +#define GAP_APPEARANCE_GENERIC_TAG 0x0200 +#define GAP_APPEARANCE_GENERIC_KEYRING 0x0240 +#define GAP_APPEARANCE_GENERIC_MEDIA_PLAYER 0x0280 +#define GAP_APPEARANCE_GENERIC_BARCODE_SCANNER 0x02C0 +#define GAP_APPEARANCE_GENERIC_THERMOMETER 0x0300 +#define GAP_APPEARANCE_THERMOMETER_EAR 0x0301 +#define GAP_APPEARANCE_GENERIC_HEART_RATE_SENSOR 0x0340 +#define GAP_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT 0x0341 +#define GAP_APPEARANCE_GENERIC_BLOOD_PRESSURE 0x0380 +#define GAP_APPEARANCE_BLOOD_PRESSURE_ARM 0x0381 +#define GAP_APPEARANCE_BLOOD_PRESSURE_WRIST 0x0382 +#define GAP_APPEARANCE_HUMAN_INTERFACE_DEVICE 0x03C0 +#define GAP_APPEARANCE_KEYBOARD 0x03C1 +#define GAP_APPEARANCE_MOUSE 0x03C2 +#define GAP_APPEARANCE_JOYSTICK 0x03C3 +#define GAP_APPEARANCE_GAMEPAD 0x03C4 +#define GAP_APPEARANCE_DIGITIZER_TABLET 0x03C5 +#define GAP_APPEARANCE_CARD_READER 0x03C6 +#define GAP_APPEARANCE_DIGITAL_PEN 0x03C7 +#define GAP_APPEARANCE_BARCODE_SCANNER 0x03C8 +#define GAP_APPEARANCE_GENERIC_GLUCOSE_METER 0x0400 +#define GAP_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR 0x0440 +#define GAP_APPEARANCE_RUNNING_WALKING_IN_SHOE 0x0441 +#define GAP_APPEARANCE_RUNNING_WALKING_ON_SHOE 0x0442 +#define GAP_APPEARANCE_RUNNING_WALKING_ON_HIP 0x0443 +#define GAP_APPEARANCE_GENERIC_CYCLING 0x0480 +#define GAP_APPEARANCE_CYCLING_CYCLING_COMPUTER 0x0481 +#define GAP_APPEARANCE_CYCLING_SPEED_SENSOR 0x0482 +#define GAP_APPEARANCE_CYCLING_CADENCE_SENSOR 0x0483 +#define GAP_APPEARANCE_CYCLING_POWER_SENSOR 0x0484 +#define GAP_APPEARANCE_CYCLING_SPEED_AND_CADENCE_SENSOR 0x0485 +#define GAP_APPEARANCE_GENERIC_PULSE_OXYMETER 0x0C40 +#define GAP_APPEARANCE_FINGERTIP 0x0C41 +#define GAP_APPEARANCE_WRIST_WORN 0x0C42 +#define GAP_APPEARANCE_GENERIC_WEIGHT_SCALE 0x0C80 +#define GAP_APPEARANCE_GENERIC_OUTDOOR_SPORT_ACTIVITY 0x1440 +#define GAP_APPEARANCE_LOCATION_DISPLAY_DEVICE 0x1441 +#define GAP_APPEARANCE_LOCATION_AND_NAVIGATION_DISPLAY_DEVICE 0x1442 +#define GAP_APPEARANCE_LOCATION_POD 0x1443 +#define GAP_APPEARANCE_LOCATION_AND_NAVIGATION_POD 0x1444 +#define GAP_APPEARANCE_GENERIC_ENVIRONMENTAL_SENSOR 0x1640 + +/* GATT UUIDs + */ +#define GATT_SERVICE_UUID 0x1801U +#define PRIMARY_SERVICE_UUID 0x2800U +#define SECONDARY_SERVICE_UUID 0x2801U +#define INCLUDE_SERVICE_UUID 0x2802U +#define CHARACTERISTIC_UUID 0x2803U +#define CHAR_EXTENDED_PROP_DESC_UUID 0x2900U +#define CHAR_USER_DESC_UUID 0x2901U +#define CHAR_CLIENT_CONFIG_DESC_UUID 0x2902U +#define CHAR_SERVER_CONFIG_DESC_UUID 0x2903U +#define CHAR_FORMAT_DESC_UUID 0x2904U +#define CHAR_AGGR_FMT_DESC_UUID 0x2905U +#define SERVICE_CHANGED_UUID 0x2A05U +#define CLIENT_SUPPORTED_FEATURES_UUID 0X2B29U +#define DATABASE_HASH_UUID 0X2B2AU +#define SERVER_SUPPORTED_FEATURES_UUID 0X2B3AU + +/* GAP UUIDs + */ +#define GAP_SERVICE_UUID 0x1800U +#define DEVICE_NAME_UUID 0x2A00U +#define APPEARANCE_UUID 0x2A01U +#define PERIPHERAL_PREFERRED_CONN_PARAMS_UUID 0x2A04U +#define CENTRAL_ADDRESS_RESOLUTION_UUID 0x2AA6U +#define RESOLVABLE_PRIVATE_ADDRESS_ONLY_UUID 0x2AC9U +#define ENCRYPTED_DATA_KEY_MATERIAL_UUID 0x2B88U +#define LE_GATT_SECURITY_LEVELS_UUID 0x2BF5U + + +#endif /* BLE_STD_H__ */ diff --git a/lib/stm32wba/hci/bleplat.h b/lib/stm32wba/hci/bleplat.h new file mode 100644 index 000000000..88a896169 --- /dev/null +++ b/lib/stm32wba/hci/bleplat.h @@ -0,0 +1,238 @@ +/***************************************************************************** + * @file bleplat.h + * @author MDG + * @brief This file contains the interface of the BLE platform layer + * (lower interface of the BLE stack library). + * It is included by the STM32WBX BLE stack library. + ***************************************************************************** + * @attention + * + * Copyright (c) 2018-2023 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ***************************************************************************** + */ + +#ifndef BLEPLAT_H__ +#define BLEPLAT_H__ + + +#include + +/* Enumerated values used for the return of the functions: + */ +enum +{ + BLEPLAT_OK = 0, /*The function did the job and returns an OK status*/ + BLEPLAT_FULL = -1, /*The function exits because the HW resource is full*/ + BLEPLAT_BUSY = -2, /*The function is busy and is not available for the requested operation*/ + BLEPLAT_EOF = -3, /*The function exits and notifies the HW resource (memory for example) reached the end*/ + BLEPLAT_WARN = -4, /*The function runs the asked operation and notifies that the HW resource is near to be full*/ + BLEPLAT_ERROR = -5 /*The function exits due to some issue (memory corruption or buffer overflow for example)*/ +}; + +/* Enumerated values used for the 'type' of NVM functions: + */ +enum +{ + BLEPLAT_NVM_TYPE_SEC = 0, + BLEPLAT_NVM_TYPE_GATT = 1, +}; + +/* Enumerated values used for the 'mode' of NVM functions: + */ +enum +{ + BLEPLAT_NVM_FIRST = 0, + BLEPLAT_NVM_NEXT = 1, + BLEPLAT_NVM_CURRENT = 2, + BLEPLAT_NVM_ALL = 3 +}; + +/* General functions: + */ +/** + * @brief This function is called by the Bluetooth® LE stack when it is + initialized or reset (via hci_reset). The user shall call here the functions to + reset the Timer, AES, PKA, NVM and RNG needed for the Bluetooth® LE stack. + * @param None + * @retval None + */ +extern void BLEPLAT_Init( void ); + +/* Non Volatile Memory (NVM) interface: + */ +/** + * @brief Store data in the NVM + * @param type: The type of data to be stored either security data (BLEPLAT_NVM_TYPE_SEC) or GATT data (BLEPLAT_NVM_TYPE_GATT) + * @param data: The data buffer to be stored + * @param size: The size of data to be stored + * @param extra_data: If there is extra data to be stored too. If not, this parameter shall be passed with “NULL” value + * @param extra_size: The size of extra data + * @retval status (BLEPLAT_XX) + */ +extern int BLEPLAT_NvmAdd( uint8_t type, + const uint8_t* data, + uint16_t size, + const uint8_t* extra_data, + uint16_t extra_size ); + + +/** + * @brief Read data from the NVM + * @param mode: The mode of NVM reading: + o BLEPLAT_NVM_FIRST + used to read the first record of NVM + o BLEPLAT_NVM_NEXT + used to read the next record (after a previous call to BLEPLAT_NvmGet) + o BLEPLAT_NVM_CURRENT + used to read the same record again (after a previous call to BLEPLAT_NvmGet) + * @param type: The type of data to be read, either security data (BLEPLAT_NVM_TYPE_SEC) + or GATT data (BLEPLAT_NVM_TYPE_GATT) + * @param offset: The offset from which the NVM starts the read an operation. + * @param data: The pointer to data read by the function + * @param size: The size of data to be read + * @retval status (BLEPLAT_XX) + */ +extern int BLEPLAT_NvmGet( uint8_t mode, + uint8_t type, + uint16_t offset, + uint8_t* data, + uint16_t size ); + +/** + * @brief Compare passed data as parameter with data stored in the NVM + * @param offset: The offset from which the NVM starts the comparison + * @param data: The data to be compared with stored data in the NVM + * @param size: The size of data to be compared + * @retval status (BLEPLAT_XX) + */ +extern int BLEPLAT_NvmCompare( uint16_t offset, + const uint8_t* data, + uint16_t size ); + +/** + * @brief Clear a block from the NVM or the whole NVM, storing the security + database (security and GATT records) + * @param mode: Mode of deleting data from the NVM, either clear all the + security database (BLEPLAT_NVM_ALL) or the current read NVM block (BLEPLAT_NVM_CURRENT) + * @retval None + */ +extern void BLEPLAT_NvmDiscard( uint8_t mode ); + +/* Public Key Algorithms (PKA) interface: + */ +/** + * @brief Start P-256 public key generation + * @param local_private_key: table of 8 x 32-bit words that contains the P-256 + private key (Little Endian format) + * @retval status (BLEPLAT_XX) + */ +extern int BLEPLAT_PkaStartP256Key( const uint32_t* local_private_key ); + +/** + * @brief Get result of P-256 public key generation + * @param local_public_key: table of 32 x 32-bit words that is filled by the + function with the generated P-256 public key (Little Endian format) + * @retval status (BLEPLAT_XX) + */ +extern void BLEPLAT_PkaReadP256Key( uint32_t* local_public_key ); + +/** + * @brief Start DH key computation + * @param local_private_key: table of 8 x 32-bit words that contains the local P-256 private key (Little Endian format) + * @param remote_public_key: table of 32 x 32-bit words that contains the remote P-256 public key (Little Endian format) + * @retval status (BLEPLAT_XX) + */ +extern int BLEPLAT_PkaStartDhKey( const uint32_t* local_private_key, + const uint32_t* remote_public_key ); +/** + * @brief Get result of DH key computation + * @param dh_key: table of 8 x 32-bit words that is filled by the function with the generated DH key (Little Endian format) + * @retval status (BLEPLAT_XX) + */ +extern int BLEPLAT_PkaReadDhKey( uint32_t* dh_key ); + +/** + * @brief Callback function implemented by the Bluetooth® LE stack that must be + called by the user to inform the Bluetooth® LE stack about completion of + P-256 public key generation or DH key computation + * @param None + * @retval status (BLEPLAT_XX) + */ +extern void BLEPLATCB_PkaComplete( void ); + +/* Advanced Encryption Standard (AES) interface: + */ +/** + * @brief Encrypt a single 128-bit block with a 128-bit key. + * @param key: table of 16 bytes that contains the key to use (Little Endian format) + * @param input: table of 16 bytes that contains the block to encrypt + * @param output: table of 16 bytes that is filled by the function with the encrypted block + * @retval None + */ +extern void BLEPLAT_AesEcbEncrypt( const uint8_t* key, + const uint8_t* input, + uint8_t* output ); + +/** + * @brief Set the 128-bit key to be used for CMAC computation. + * @param key: table of 16 bytes that contains the key to use (Little Endian format) + * @retval None + */ +extern void BLEPLAT_AesCmacSetKey( const uint8_t* key ); + +/** + * @brief CMAC computation: the function can be called several times with output_tag + set to 0 to append data to the computation. It must be called once at the + end with output_tag not set at 0 to complete the CMAC computation. + * @param input: table of “input_length” bytes that contains the data to append for the CMAC computation + * @param input_length: number of bytes in “input”. + * @param output_tag: must be set to 0 for append. Otherwise: table of 16 bytes that is filled by the function with the computed CMAC tag. + * @retval None + */ +extern void BLEPLAT_AesCmacCompute( const uint8_t* input, + uint32_t input_length, + uint8_t* output_tag ); + +/* Random Number Generation (RNG) interface: + */ +/** + * @brief Get random values. + * @param n: number of 32-bit words to read. + * @param val: pointer to a 32-bit table of size ‘n’ that are filled with random values by the function. + * @retval None + */ +extern void BLEPLAT_RngGet( uint8_t n, uint32_t* val ); + +/* Timer interface: + */ +/** + * @brief Start the Timer. + * @param layer: The timer ID to be started + * @param timeout: The timeout needed to stop the timer (in ms) + * @retval status (BLEPLAT_XX) + */ +extern uint8_t BLEPLAT_TimerStart( uint8_t layer, + uint32_t timeout ); + +/** + * @brief Stop the Timer + * @param layer: The timer ID to be stopped + * @retval None + */ +extern void BLEPLAT_TimerStop( uint8_t layer ); + +/** + * @brief The timer callback function called when the timeout of a given timer has elapsed + * @param layer: The timer ID + * @retval None + */ +extern void BLEPLATCB_TimerExpiry( uint8_t layer ); + + +#endif /* BLEPLAT_H__ */ diff --git a/lib/stm32wba/hci/blestack.h b/lib/stm32wba/hci/blestack.h new file mode 100644 index 000000000..b56a07606 --- /dev/null +++ b/lib/stm32wba/hci/blestack.h @@ -0,0 +1,232 @@ +/***************************************************************************** + * @file blestack.h + * @author MDG + * @brief Header file for BLE stack + ***************************************************************************** + * @attention + * + * Copyright (c) 2018-2023 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ***************************************************************************** + */ + +#ifndef BLESTACK_H__ +#define BLESTACK_H__ + + +#include "auto/ble_types.h" +#include "ble_bufsize.h" + + +/* + * Definitions for return value of BleStack_Process( ) + */ +enum +{ + BLE_SLEEPMODE_RUNNING = 0, + BLE_SLEEPMODE_CPU_HALT = 1, + BLE_SLEEPMODE_WAKETIMER = 2, + BLE_SLEEPMODE_NOTIMER = 3, +}; + +/* + * Definitions for 'options' parameter + */ +enum +{ + BLE_OPTIONS_LL_ONLY = 0x0001U, + BLE_OPTIONS_NO_SVC_CHANGE_DESC = 0x0002U, + BLE_OPTIONS_DEV_NAME_READ_ONLY = 0x0004U, + BLE_OPTIONS_EXTENDED_ADV = 0x0008U, + BLE_OPTIONS_REDUCED_DB_IN_NVM = 0x0020U, + BLE_OPTIONS_GATT_CACHING = 0x0040U, + BLE_OPTIONS_POWER_CLASS_1 = 0x0080U, + BLE_OPTIONS_APPEARANCE_WRITABLE = 0x0100U, + BLE_OPTIONS_ENHANCED_ATT = 0x0200U, +}; + +/* + * Definitions for 'debug' parameter + */ +enum +{ + BLE_DEBUG_RAND_ADDR_INIT = 0x00000010UL, +}; + +/* + * This structure contains memory and low level hardware configuration data + * for the device +*/ +typedef struct +{ + + /* Start address of the RAM buffer allocated for BLE stack library. + * It must be a 32bit aligned RAM area. + */ + uint8_t* bleStartRamAddress; + + /* Size of the RAM buffer allocated for BLE stack library. + * (could be filled with BLE_TOTAL_BUFFER_SIZE return value) + */ + uint32_t total_buffer_size; + + /* Start address of the RAM buffer allocated for GATT database. + * It must be a 32bit aligned RAM area. + */ + uint8_t* bleStartRamAddress_GATT; + + /* Size of the RAM buffer allocated for GATT database. + * (could be filled with BLE_TOTAL_BUFFER_SIZE_GATT return value) + */ + uint32_t total_buffer_size_GATT; + + /* Maximum number of Attributes (i.e. the number of characteristic + the + * number of characteristic values + the number of descriptors, excluding the + * services) that can be stored in the GATT database. + * Note that certain characteristics and relative descriptors are added + * automatically during device initialization so this parameters should be 9 + * (or 6 w.r.t. options) plus the number of user Attributes (NUM_GATT_ + * ATTRIBUTES used in the calculation of BLE TOTAL_BUFFER_SIZE_GATT) + */ + uint16_t numAttrRecord; + + /* Maximum number of Services that can be stored in the GATT database. + * Note that the GAP and GATT services are automatically added so this + * parameter should be 2 plus the number of user services (NUM_GATT_SERVICES + * used in the calculation of BLE_TOTAL_BUFFER_SIZE_GATT) + */ + uint16_t numAttrServ; + + /* Size of the storage area for Attribute values (ATT_VALUE_ARRAY_SIZE used + * in the calculation of BLE_TOTAL_BUFFER_SIZE_GATT) + * This value depends on the number of attributes used by application. In + * particular the sum of the following quantities (in octets) should be made + * for each attribute: + * - attribute value length + * - 5, if UUID is 16 bit; 19, if UUID is 128 bit + * - 2, if server configuration descriptor is used + * - 2*numOfLinks, if client configuration descriptor is used + * - 2, if extended properties is used + * The total amount of memory needed is the sum of the above quantities for + * each attribute. + */ + uint16_t attrValueArrSize; + + /* Maximum number of simultaneous connections that the device will support. + * Valid values are from 1 to 8 (NUM_LINKS used in the calculation of + * BLE_TOTAL_BUFFER_SIZE). + */ + uint8_t numOfLinks; + + /* Prepare Write List size in terms of number of packet with ATT_MTU=23 bytes + */ + uint8_t prWriteListSize; + + /* Number of allocated memory blocks + */ + uint16_t mblockCount; + + /* Maximum supported ATT_MTU size + */ + uint16_t attMtu; + + /* Maximum value of the connection-oriented channel Maximum Payload Size + * Range: 23 .. (BLE_EVT_MAX_PARAM_LEN - 7) + */ + uint16_t max_coc_mps; + + /* Maximum number of connection-oriented channels. + * Range: 0 .. 64 + */ + uint8_t max_coc_nbr; + + /* Maximum number of connection-oriented channels in initiator mode. + * Range: 0 .. max_coc_nbr + */ + uint8_t max_coc_initiator_nbr; + + /* Options flags + * Bitmap of the "BLE_OPTIONS_..." definitions (see above). + * - bit 0: 1: LL only 0: LL + host + * - bit 1: 1: no service change desc. 0: with service change desc. + * - bit 2: 1: device name Read-Only 0: device name R/W + * - bit 3: 1: extended adv supported 0: extended adv not supported + * - bit 5: 1: Reduced GATT db in NVM 0: Full GATT db in NVM + * - bit 6: 1: GATT caching is used 0: GATT caching is not used + * - bit 7: 1: LE Power Class 1 0: LE Power Class 2-3 + * - bit 8: 1: appearance Writable 0: appearance Read-Only + * - bit 9: 1: Enhanced ATT supported 0: Enhanced ATT not supported + * - other bits: reserved + */ + uint16_t options; + + /* Debug flags + * Bitmap of the "BLE_DEBUG_..." definitions (see above). + */ + uint32_t debug; + +} BleStack_init_t; + +/* + * BleStack_Init + * + * @brief The BLE Stack initialization routine + * + * @param[in] Init_params_p pointer to the const structure containing + * memory and low level hardware configuration + * data for the device + * + * @return Value indicating success or error code. + */ +extern tBleStatus BleStack_Init( const BleStack_init_t* init_params_p ); + +/* + * BleStack_Process + * + * @brief This function executes the processing of all Host Stack layers. + * It has to be executed regularly to process incoming Link Layer packets and + * to process Host Layers procedures. All stack callbacks are called by this + * function. + * + * No BLE stack function must be called while the BleStack_Process is running. + * For example, if a BLE stack function may be called inside an + * interrupt routine, that interrupt must be disabled during the execution of + * BleStack_Process(). + * + * @return + * BLE_SLEEPMODE_RUNNING (0) -> BLE Stack Process has to be executed, + * BLE_SLEEPMODE_CPU_HALT (1) -> BLE Stack Process does not have to be + * executed, + */ +extern uint8_t BleStack_Process( void ); + +/* + * BleStack_Request + * + * @brief This function gives a request from application to the BLE stack. + * The input parameter is a buffer of bytes in the BLE standard format: + * HCI/ACI command packet or ACL data packet. + * The response packet is returned in the same buffer and the size (in bytes) + * of the response is given by the function return value. + */ +extern uint16_t BleStack_Request( uint8_t* buffer ); + +/* + * BLECB_Indication + * + * @brief Callback called by the BLE stack (from BleStack_Process() context) + * to send an indication to the application. The indication is a BLE standard + * packet that can be either an ACI/HCI event or an ACL data. + */ +extern uint8_t BLECB_Indication( const uint8_t* data, + uint16_t length, + const uint8_t* ext_data, + uint16_t ext_length ); + + +#endif /* BLESTACK_H__ */ diff --git a/lib/stm32wba/hci/bpka.c b/lib/stm32wba/hci/bpka.c new file mode 100644 index 000000000..cefe4bb92 --- /dev/null +++ b/lib/stm32wba/hci/bpka.c @@ -0,0 +1,223 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file bpka.c + * @author MCD Application Team + * @brief This file implements the BLE PKA module. + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +#include "app_common.h" +#include "bpka.h" + +/*****************************************************************************/ + +enum +{ + BPKA_IDLE = 0, + BPKA_P256_KEY_GEN, + BPKA_RANGE_X_CHECK, + BPKA_RANGE_Y_CHECK, + BPKA_POINT_CHECK, + BPKA_DH_KEY_GEN, +}; + +/*****************************************************************************/ + +static uint8_t BPKA_state; +static uint8_t BPKA_error; +static uint32_t BPKA_buffer[24]; + +/*****************************************************************************/ + +void BPKA_Reset( void ) +{ + /* Disable PKA hardware */ + HW_PKA_Disable( ); + + BPKA_state = BPKA_IDLE; +} + +/*****************************************************************************/ + +int BPKA_StartP256Key( const uint32_t* local_private_key ) +{ + /* Enable PKA hardware */ + if ( ! HW_PKA_Enable( ) ) + return BPKA_BUSY; + + /* Call the PKA scalar multiplication with the local private key + as k and the standard point as starting point, + in order to compute the local public key */ + HW_PKA_P256_StartEccScalarMul( local_private_key, NULL, NULL ); + + BPKA_state = BPKA_P256_KEY_GEN; + + BPKACB_Process( ); + + return BPKA_OK; +} + +/*****************************************************************************/ + +void BPKA_ReadP256Key( uint32_t* local_public_key ) +{ + /* Get local public key from buffer */ + memcpy( local_public_key, BPKA_buffer, 64 ); +} + +/*****************************************************************************/ + +int BPKA_StartDhKey( const uint32_t* local_private_key, + const uint32_t* remote_public_key ) +{ + /* Enable PKA hardware */ + if ( ! HW_PKA_Enable( ) ) + return BPKA_BUSY; + + /* Call the PKA range check operation for public key X coordinate */ + HW_PKA_P256_StartRangeCheck( remote_public_key ); + + /* Save input data */ + memcpy( BPKA_buffer, local_private_key, 32 ); + memcpy( BPKA_buffer + 8, remote_public_key, 64 ); + + BPKA_state = BPKA_RANGE_X_CHECK; + BPKA_error = 1; + + BPKACB_Process( ); + + return BPKA_OK; +} + +/*****************************************************************************/ + +int BPKA_ReadDhKey( uint32_t* dh_key ) +{ + if ( BPKA_error ) + return BPKA_EOF; + + /* Get DH key from buffer */ + memcpy( dh_key, BPKA_buffer, 32 ); + + return BPKA_OK; +} + +/*****************************************************************************/ + +__WEAK void BPKACB_Complete( void ) +{ +} + +__WEAK void BPKACB_Process( void ) +{ +} + +/*****************************************************************************/ + +int BPKA_Process( void ) +{ + /* This function implements the offline key computation using the PKA + */ + if ( BPKA_state == BPKA_IDLE ) + { + return BPKA_OK; + } + + /* Check if the current operation is finished */ + if ( ! HW_PKA_EndOfOperation( ) ) + return BPKA_BUSY; + + switch ( BPKA_state ) + { + case BPKA_P256_KEY_GEN: + + /* Read the PKA scalar multiplication result which is the local public + key */ + HW_PKA_P256_ReadEccScalarMul( BPKA_buffer, BPKA_buffer + 8 ); + + break; + + case BPKA_RANGE_X_CHECK: + + /* Test result of range check operation for public key X coordinate */ + if ( ! HW_PKA_P256_IsRangeCheckOk( ) ) + break; + + /* Call the PKA range check operation for public key Y coordinate */ + HW_PKA_P256_StartRangeCheck( BPKA_buffer + 16 ); + + BPKA_state = BPKA_RANGE_Y_CHECK; + + return BPKA_BUSY; + + case BPKA_RANGE_Y_CHECK: + + /* Test result of range check operation for public key Y coordinate */ + if ( ! HW_PKA_P256_IsRangeCheckOk( ) ) + break; + + /* Call the PKA point check operation for remote public key */ + HW_PKA_P256_StartPointCheck( BPKA_buffer + 8, + BPKA_buffer + 16 ); + + BPKA_state = BPKA_POINT_CHECK; + + return BPKA_BUSY; + + case BPKA_POINT_CHECK: + + /* Test result of point check operation for remote public key */ + if ( ! HW_PKA_P256_IsPointCheckOk( ) ) + break; + + /* Call the PKA scalar multiplication with the local private key + as k and the remote public key as starting point, + in order to compute the DH key */ + HW_PKA_P256_StartEccScalarMul( BPKA_buffer, + BPKA_buffer + 8, + BPKA_buffer + 16 ); + + BPKA_state = BPKA_DH_KEY_GEN; + + return BPKA_BUSY; + + case BPKA_DH_KEY_GEN: + + /* Read the PKA scalar multiplication result which is the DH key */ + HW_PKA_P256_ReadEccScalarMul( BPKA_buffer, NULL ); + + BPKA_error = 0; + + break; + } + + /* Callback to inform the BLE stack of the completion of PKA operation */ + BPKACB_Complete( ); + + /* End of process: reset the PKA module */ + BPKA_Reset( ); + + return BPKA_OK; +} + +void BPKA_BG_Process( void ) +{ + if( BPKA_Process( ) != 0) + { + BPKACB_Process( ); + } +} + +/*****************************************************************************/ diff --git a/lib/stm32wba/hci/bpka.h b/lib/stm32wba/hci/bpka.h new file mode 100644 index 000000000..d591e670b --- /dev/null +++ b/lib/stm32wba/hci/bpka.h @@ -0,0 +1,59 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file bpka.h + * @author MCD Application Team + * @brief This file contains the interface of the BLE PKA module. + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +#ifndef BPKA_H__ +#define BPKA_H__ + +#include + +/* Enumerated values used for the return of the functions: + * (warning: this enum must be aligned with BLEPLAT corresponding one) + */ +enum +{ + BPKA_OK = 0, + BPKA_FULL = -1, + BPKA_BUSY = -2, + BPKA_EOF = -3, + BPKA_ERROR = -5 +}; + +void BPKA_Reset( void ); + +int BPKA_StartP256Key( const uint32_t* local_private_key ); + +void BPKA_ReadP256Key( uint32_t* local_public_key ); + +int BPKA_StartDhKey( const uint32_t* local_private_key, + const uint32_t* remote_public_key ); + +int BPKA_ReadDhKey( uint32_t* dh_key ); + +int BPKA_Process( void ); + +void BPKA_BG_Process( void ); + +/* Callback used by BPKA_Process to indicate the end of the processing + */ +void BPKACB_Complete( void ); + +void BPKACB_Process( void ); + +#endif /* BPKA_H__ */ diff --git a/lib/stm32wba/hci/debug_config.h b/lib/stm32wba/hci/debug_config.h new file mode 100644 index 000000000..55bbd896b --- /dev/null +++ b/lib/stm32wba/hci/debug_config.h @@ -0,0 +1,1524 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file debug_config.h + * @author MCD Application Team + * @brief Real Time Debug module general configuration file + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ +#ifndef DEBUG_CONFIG_H +#define DEBUG_CONFIG_H + +#include "app_conf.h" + +#if(CFG_RT_DEBUG_GPIO_MODULE == 1) + +/***********************************/ +/** Debug configuration selection **/ +/***********************************/ +/* Debug configuration for System purpose */ +#define USE_RT_DEBUG_CONFIGURATION_SYSTEM (0) + +/* Debug configuration for BLE purpose */ +#define USE_RT_DEBUG_CONFIGURATION_BLE (0) + +/* Debug configuration for MAC purpose */ +#define USE_RT_DEBUG_CONFIGURATION_MAC (0) + +/* Debug configuration for COEX purpose */ +#define USE_RT_DEBUG_CONFIGURATION_COEX (0) + +/*********************************/ +/** GPIO debug signal selection **/ +/*********************************/ + +/* System clock manager - System clock config */ +#define USE_RT_DEBUG_SCM_SYSTEM_CLOCK_CONFIG (0) +#define GPIO_DEBUG_SCM_SYSTEM_CLOCK_CONFIG {GPIOA, GPIO_PIN_12} + +/* System clock manager - Setup */ +#define USE_RT_DEBUG_SCM_SETUP (0) +#define GPIO_DEBUG_SCM_SETUP {GPIOA, GPIO_PIN_5} + +/* System clock manager - HSE RDY interrupt handling */ +#define USE_RT_DEBUG_SCM_HSERDY_ISR (0) +#define GPIO_DEBUG_SCM_HSERDY_ISR {GPIOA, GPIO_PIN_15} + +#define USE_RT_DEBUG_ADC_ACTIVATION (0) +#define GPIO_DEBUG_ADC_ACTIVATION {GPIOB, GPIO_PIN_4} + +#define USE_RT_DEBUG_ADC_DEACTIVATION (0) +#define GPIO_DEBUG_ADC_DEACTIVATION {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ADC_TEMPERATURE_ACQUISITION (0) +#define GPIO_DEBUG_ADC_TEMPERATURE_ACQUISITION {GPIOB, GPIO_PIN_8} + +#define USE_RT_DEBUG_RNG_ENABLE (0) +#define GPIO_DEBUG_RNG_ENABLE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RNG_DISABLE (0) +#define GPIO_DEBUG_RNG_DISABLE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RNG_GEN_RAND_NUM (0) +#define GPIO_DEBUG_RNG_GEN_RAND_NUM {GPIOB, GPIO_PIN_12} + +#define USE_RT_DEBUG_LOW_POWER_STOP_MODE_ENTER (0) +#define GPIO_DEBUG_LOW_POWER_STOP_MODE_ENTER {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LOW_POWER_STOP_MODE_EXIT (0) +#define GPIO_DEBUG_LOW_POWER_STOP_MODE_EXIT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LOW_POWER_STOP_MODE_ACTIVE (0) +#define GPIO_DEBUG_LOW_POWER_STOP_MODE_ACTIVE {GPIOB, GPIO_PIN_3} + +#define USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_ENTER (0) +#define GPIO_DEBUG_LOW_POWER_STANDBY_MODE_ENTER {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_EXIT (0) +#define GPIO_DEBUG_LOW_POWER_STANDBY_MODE_EXIT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_ACTIVE (0) +#define GPIO_DEBUG_LOW_POWER_STANDBY_MODE_ACTIVE {GPIOB, GPIO_PIN_15} + +#define USE_RT_DEBUG_HCI_READ_DONE (0) +#define GPIO_DEBUG_HCI_READ_DONE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_HCI_RCVD_CMD (0) +#define GPIO_DEBUG_HCI_RCVD_CMD {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_HCI_WRITE_DONE (0) +#define GPIO_DEBUG_HCI_WRITE_DONE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_SCHDLR_EVNT_UPDATE (0) +#define GPIO_DEBUG_SCHDLR_EVNT_UPDATE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_SCHDLR_TIMER_SET (0) +#define GPIO_DEBUG_SCHDLR_TIMER_SET {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_SCHDLR_PHY_CLBR_TIMER (0) +#define GPIO_DEBUG_SCHDLR_PHY_CLBR_TIMER {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_SCHDLR_EVNT_SKIPPED (0) +#define GPIO_DEBUG_SCHDLR_EVNT_SKIPPED {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_SCHDLR_HNDL_NXT_TRACE (0) +#define GPIO_DEBUG_SCHDLR_HNDL_NXT_TRACE {GPIOA, GPIO_PIN_12} + +#define USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_DETEDTED (0) +#define GPIO_DEBUG_ACTIVE_SCHDLR_NEAR_DETEDTED {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_GAP_CHECK (0) +#define GPIO_DEBUG_ACTIVE_SCHDLR_NEAR_GAP_CHECK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_TIME_CHECK (0) +#define GPIO_DEBUG_ACTIVE_SCHDLR_NEAR_TIME_CHECK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_TRACE (0) +#define GPIO_DEBUG_ACTIVE_SCHDLR_NEAR_TRACE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_SCHDLR_EVNT_RGSTR (0) +#define GPIO_DEBUG_SCHDLR_EVNT_RGSTR {GPIOB, GPIO_PIN_8} + +#define USE_RT_DEBUG_SCHDLR_ADD_CONFLICT_Q (0) +#define GPIO_DEBUG_SCHDLR_ADD_CONFLICT_Q {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_SCHDLR_HNDL_MISSED_EVNT (0) +#define GPIO_DEBUG_SCHDLR_HNDL_MISSED_EVNT {GPIOA, GPIO_PIN_5} + +#define USE_RT_DEBUG_SCHDLR_UNRGSTR_EVNT (0) +#define GPIO_DEBUG_SCHDLR_UNRGSTR_EVNT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_SCHDLR_EXEC_EVNT_TRACE (0) +#define GPIO_DEBUG_SCHDLR_EXEC_EVNT_TRACE {GPIOA, GPIO_PIN_15} + +#define USE_RT_DEBUG_SCHDLR_EXEC_EVNT_PROFILE (0) +#define GPIO_DEBUG_SCHDLR_EXEC_EVNT_PROFILE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_SCHDLR_EXEC_EVNT_ERROR (0) +#define GPIO_DEBUG_SCHDLR_EXEC_EVNT_ERROR {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_SCHDLR_EXEC_EVNT_WINDOW_WIDENING (0) +#define GPIO_DEBUG_SCHDLR_EXEC_EVNT_WINDOW_WIDENING {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_CMN_CLR_ISR (0) +#define GPIO_DEBUG_LLHWC_CMN_CLR_ISR {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLWCC_CMN_HG_ISR (0) +#define GPIO_DEBUG_LLWCC_CMN_HG_ISR {GPIOA, GPIO_PIN_15} + +#define USE_RT_DEBUG_LLHWC_CMN_LW_ISR (0) +#define GPIO_DEBUG_LLHWC_CMN_LW_ISR {GPIOA, GPIO_PIN_12} + +#define USE_RT_DEBUG_LLHWC_CMN_CLR_TIMER_ERROR (0) +#define GPIO_DEBUG_LLHWC_CMN_CLR_TIMER_ERROR {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_LL_ISR (0) +#define GPIO_DEBUG_LLHWC_LL_ISR {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_SPLTMR_SET (0) +#define GPIO_DEBUG_LLHWC_SPLTMR_SET {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_SPLTMR_GET (0) +#define GPIO_DEBUG_LLHWC_SPLTMR_GET {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_LOW_ISR (0) +#define GPIO_DEBUG_LLHWC_LOW_ISR {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_STOP_SCN (0) +#define GPIO_DEBUG_LLHWC_STOP_SCN {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_WAIT_ENVT_ON_AIR (0) +#define GPIO_DEBUG_LLHWC_WAIT_ENVT_ON_AIR {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_SET_CONN_EVNT_PARAM (0) +#define GPIO_DEBUG_LLHWC_SET_CONN_EVNT_PARAM {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_POST_EVNT (0) +#define GPIO_DEBUG_POST_EVNT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_HNDL_ALL_EVNTS (0) +#define GPIO_DEBUG_HNDL_ALL_EVNTS {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PROCESS_EVNT (0) +#define GPIO_DEBUG_PROCESS_EVNT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PROCESS_ISO_DATA (0) +#define GPIO_DEBUG_PROCESS_ISO_DATA {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ALLOC_TX_ISO_EMPTY_PKT (0) +#define GPIO_DEBUG_ALLOC_TX_ISO_EMPTY_PKT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_BIG_FREE_EMPTY_PKTS (0) +#define GPIO_DEBUG_BIG_FREE_EMPTY_PKTS {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_OK (0) +#define GPIO_DEBUG_RECOMBINE_UNFRMD_DATA_OK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_CRC (0) +#define GPIO_DEBUG_RECOMBINE_UNFRMD_DATA_CRC {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_NoRX (0) +#define GPIO_DEBUG_RECOMBINE_UNFRMD_DATA_NoRX {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_TRACE (0) +#define GPIO_DEBUG_RECOMBINE_UNFRMD_DATA_TRACE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ISO_HNDL_SDU (0) +#define GPIO_DEBUG_ISO_HNDL_SDU {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LL_INTF_INIT (0) +#define GPIO_DEBUG_LL_INTF_INIT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_DATA_TO_CNTRLR (0) +#define GPIO_DEBUG_DATA_TO_CNTRLR {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_FREE_LL_PKT_HNDLR (0) +#define GPIO_DEBUG_FREE_LL_PKT_HNDLR {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PHY_INIT_CLBR_TRACE (0) +#define GPIO_DEBUG_PHY_INIT_CLBR_TRACE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PHY_RUNTIME_CLBR_TRACE (0) +#define GPIO_DEBUG_PHY_RUNTIME_CLBR_TRACE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PHY_CLBR_ISR (0) +#define GPIO_DEBUG_PHY_CLBR_ISR {GPIOB, GPIO_PIN_3} + +#define USE_RT_DEBUG_PHY_INIT_CLBR_SINGLE_CH (0) +#define GPIO_DEBUG_PHY_INIT_CLBR_SINGLE_CH {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PHY_CLBR_STRTD (0) +#define GPIO_DEBUG_PHY_CLBR_STRTD {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PHY_CLBR_EXEC (0) +#define GPIO_DEBUG_PHY_CLBR_EXEC {GPIOB, GPIO_PIN_4} + +#define USE_RT_DEBUG_RCO_STRT_STOP_RUNTIME_CLBR_ACTV (0) +#define GPIO_DEBUG_RCO_STRT_STOP_RUNTIME_CLBR_ACTV {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RCO_STRT_STOP_RUNTIME_RCO_CLBR (0) +#define GPIO_DEBUG_RCO_STRT_STOP_RUNTIME_RCO_CLBR {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_SWT (0) +#define GPIO_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_SWT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_TRACE (0) +#define GPIO_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_TRACE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RCO_ISR_TRACE (0) +#define GPIO_DEBUG_RCO_ISR_TRACE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RCO_ISR_COMPENDATE (0) +#define GPIO_DEBUG_RCO_ISR_COMPENDATE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RAL_STRT_TX (0) +#define GPIO_DEBUG_RAL_STRT_TX {GPIOA, GPIO_PIN_5} + +#define USE_RT_DEBUG_RAL_ISR_TIMER_ERROR (0) +#define GPIO_DEBUG_RAL_ISR_TIMER_ERROR {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RAL_ISR_TRACE (0) +#define GPIO_DEBUG_RAL_ISR_TRACE {GPIOB, GPIO_PIN_3} + +#define USE_RT_DEBUG_RAL_STOP_OPRTN (0) +#define GPIO_DEBUG_RAL_STOP_OPRTN {GPIOB, GPIO_PIN_8} + +#define USE_RT_DEBUG_RAL_STRT_RX (0) +#define GPIO_DEBUG_RAL_STRT_RX {GPIOB, GPIO_PIN_12} + +#define USE_RT_DEBUG_RAL_DONE_CLBK_TX (0) +#define GPIO_DEBUG_RAL_DONE_CLBK_TX {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RAL_DONE_CLBK_RX (0) +#define GPIO_DEBUG_RAL_DONE_CLBK_RX {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RAL_DONE_CLBK_ED (0) +#define GPIO_DEBUG_RAL_DONE_CLBK_ED {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RAL_ED_SCAN (0) +#define GPIO_DEBUG_RAL_ED_SCAN {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ERROR_MEM_CAP_EXCED (0) +#define GPIO_DEBUG_ERROR_MEM_CAP_EXCED {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ERROR_COMMAND_DISALLOWED (0) +#define GPIO_DEBUG_ERROR_COMMAND_DISALLOWED {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PTA_INIT (0) +#define GPIO_DEBUG_PTA_INIT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PTA_EN (0) +#define GPIO_DEBUG_PTA_EN {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_PTA_SET_EN (0) +#define GPIO_DEBUG_LLHWC_PTA_SET_EN {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_PTA_SET_PARAMS (0) +#define GPIO_DEBUG_LLHWC_PTA_SET_PARAMS {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_COEX_STRT_ON_IDLE (0) +#define GPIO_DEBUG_COEX_STRT_ON_IDLE {GPIOB, GPIO_PIN_15} + +#define USE_RT_DEBUG_COEX_ASK_FOR_AIR (0) +#define GPIO_DEBUG_COEX_ASK_FOR_AIR {GPIOB, GPIO_PIN_3} + +#define USE_RT_DEBUG_COEX_TIMER_EVNT_CLBK (0) +#define GPIO_DEBUG_COEX_TIMER_EVNT_CLBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_COEX_STRT_ONE_SHOT (0) +#define GPIO_DEBUG_COEX_STRT_ONE_SHOT {GPIOA, GPIO_PIN_5} + +#define USE_RT_DEBUG_COEX_FORCE_STOP_RX (0) +#define GPIO_DEBUG_COEX_FORCE_STOP_RX {GPIOB, GPIO_PIN_12} + +#define USE_RT_DEBUG_LLHWC_ADV_DONE (0) +#define GPIO_DEBUG_LLHWC_ADV_DONE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_SCN_DONE (0) +#define GPIO_DEBUG_LLHWC_SCN_DONE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_INIT_DONE (0) +#define GPIO_DEBUG_LLHWC_INIT_DONE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_CONN_DONE (0) +#define GPIO_DEBUG_LLHWC_CONN_DONE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_CIG_DONE (0) +#define GPIO_DEBUG_LLHWC_CIG_DONE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_BIG_DONE (0) +#define GPIO_DEBUG_LLHWC_BIG_DONE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_OS_TMR_CREATE (0) +#define GPIO_DEBUG_OS_TMR_CREATE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ADV_EXT_TIMEOUT_CBK (0) +#define GPIO_DEBUG_ADV_EXT_TIMEOUT_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ADV_EXT_SCN_DUR_CBK (0) +#define GPIO_DEBUG_ADV_EXT_SCN_DUR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ADV_EXT_SCN_PERIOD_CBK (0) +#define GPIO_DEBUG_ADV_EXT_SCN_PERIOD_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ADV_EXT_PRDC_SCN_TIMEOUT_CBK (0) +#define GPIO_DEBUG_ADV_EXT_PRDC_SCN_TIMEOUT_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_BIS_SYNC_TIMEOUT_TMR_CBK (0) +#define GPIO_DEBUG_BIS_SYNC_TIMEOUT_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_BIS_TERM_TMR_CBK (0) +#define GPIO_DEBUG_BIS_TERM_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_BIS_TST_MODE_CBK (0) +#define GPIO_DEBUG_BIS_TST_MODE_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_BIS_TST_MODE_TMR_CBK (0) +#define GPIO_DEBUG_BIS_TST_MODE_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ISO_POST_TMR_CBK (0) +#define GPIO_DEBUG_ISO_POST_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ISO_TST_MODE_TMR_CBK (0) +#define GPIO_DEBUG_ISO_TST_MODE_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_CONN_POST_TMR_CBK (0) +#define GPIO_DEBUG_CONN_POST_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_EVNT_SCHDLR_TMR_CBK (0) +#define GPIO_DEBUG_EVNT_SCHDLR_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_HCI_POST_TMR_CBK (0) +#define GPIO_DEBUG_HCI_POST_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLCP_POST_TMR_CBK (0) +#define GPIO_DEBUG_LLCP_POST_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_ENRGY_DETECT_CBK (0) +#define GPIO_DEBUG_LLHWC_ENRGY_DETECT_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PRVCY_POST_TMR_CBK (0) +#define GPIO_DEBUG_PRVCY_POST_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ANT_PRPR_TMR_CBK (0) +#define GPIO_DEBUG_ANT_PRPR_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_COEX_TMR_FRC_STOP_AIR_GRANT_CBK (0) +#define GPIO_DEBUG_COEX_TMR_FRC_STOP_AIR_GRANT_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_MLME_RX_EN_TMR_CBK (0) +#define GPIO_DEBUG_MLME_RX_EN_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_MLME_GNRC_TMR_CBK (0) +#define GPIO_DEBUG_MLME_GNRC_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_MIB_JOIN_LST_TMR_CBK (0) +#define GPIO_DEBUG_MIB_JOIN_LST_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_MLME_PWR_PRES_TMR_CBK (0) +#define GPIO_DEBUG_MLME_PWR_PRES_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PRESISTENCE_TMR_CBK (0) +#define GPIO_DEBUG_PRESISTENCE_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RADIO_PHY_PRDC_CLBK_TMR_CBK (0) +#define GPIO_DEBUG_RADIO_PHY_PRDC_CLBK_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RADIO_CSMA_TMR_CBK (0) +#define GPIO_DEBUG_RADIO_CSMA_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RADIO_CSL_RCV_TMR_CBK (0) +#define GPIO_DEBUG_RADIO_CSL_RCV_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ED_TMR_CBK (0) +#define GPIO_DEBUG_ED_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_DIO_EXT_TMR_CBK (0) +#define GPIO_DEBUG_DIO_EXT_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RCO_CLBR_TMR_CBK (0) +#define GPIO_DEBUG_RCO_CLBR_TMR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ADV_EXT_MNGR_ADV_CBK (0) +#define GPIO_DEBUG_ADV_EXT_MNGR_ADV_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ADV_EXT_MNGR_SCN_CBK (0) +#define GPIO_DEBUG_ADV_EXT_MNGR_SCN_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ADV_EXT_MNGR_SCN_ERR_CBK (0) +#define GPIO_DEBUG_ADV_EXT_MNGR_SCN_ERR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CBK (0) +#define GPIO_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK (0) +#define GPIO_DEBUG_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_BIG_ADV_CBK (0) +#define GPIO_DEBUG_BIG_ADV_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_BIG_ADV_ERR_CBK (0) +#define GPIO_DEBUG_BIG_ADV_ERR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_BIG_SYNC_CBK (0) +#define GPIO_DEBUG_BIG_SYNC_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_BIG_SYNC_ERR_CBK (0) +#define GPIO_DEBUG_BIG_SYNC_ERR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ISO_CIS_PKT_TRNSM_RECEIVED_CBK (0) +#define GPIO_DEBUG_ISO_CIS_PKT_TRNSM_RECEIVED_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ISO_CIG_ERR_CBK (0) +#define GPIO_DEBUG_ISO_CIG_ERR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_CONN_PKT_TRNSM_RECEIVED_CBK (0) +#define GPIO_DEBUG_CONN_PKT_TRNSM_RECEIVED_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PRDC_CLBR_EXTRL_CBK (0) +#define GPIO_DEBUG_PRDC_CLBR_EXTRL_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PTR_PRDC_ADV_SYNC_CBK (0) +#define GPIO_DEBUG_PTR_PRDC_ADV_SYNC_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_NCONN_SCN_CBK (0) +#define GPIO_DEBUG_NCONN_SCN_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_NCONN_ADV_CBK (0) +#define GPIO_DEBUG_NCONN_ADV_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_NCONN_INIT_CBK (0) +#define GPIO_DEBUG_NCONN_INIT_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ANT_RADIO_CMPLT_EVNT_CBK (0) +#define GPIO_DEBUG_ANT_RADIO_CMPLT_EVNT_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ANT_STACK_EVNT_CBK (0) +#define GPIO_DEBUG_ANT_STACK_EVNT_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ADV_EXT_PROCESS_TMOUT_EVNT_CBK (0) +#define GPIO_DEBUG_ADV_EXT_PROCESS_TMOUT_EVNT_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ADV_EXT_MNGR_SCN_DUR_EVNT (0) +#define GPIO_DEBUG_ADV_EXT_MNGR_SCN_DUR_EVNT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ADV_EXT_MNGR_SCN_PERIODIC_EVNT (0) +#define GPIO_DEBUG_ADV_EXT_MNGR_SCN_PERIODIC_EVNT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT (0) +#define GPIO_DEBUG_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT (0) +#define GPIO_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_BIS_MNGR_BIG_TERM_CBK (0) +#define GPIO_DEBUG_BIS_MNGR_BIG_TERM_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_BIS_MNGR_SYNC_TMOUT_CBK (0) +#define GPIO_DEBUG_BIS_MNGR_SYNC_TMOUT_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ISOAL_MNGR_SDU_GEN (0) +#define GPIO_DEBUG_ISOAL_MNGR_SDU_GEN {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_ISO_MNGR_CIS_PROCESS_EVNT_CBK (0) +#define GPIO_DEBUG_ISO_MNGR_CIS_PROCESS_EVNT_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_CONN_MNGR_PROCESS_EVNT_CLBK (0) +#define GPIO_DEBUG_CONN_MNGR_PROCESS_EVNT_CLBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_CONN_MNGR_UPDT_CONN_PARAM_CBK (0) +#define GPIO_DEBUG_CONN_MNGR_UPDT_CONN_PARAM_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_EVNT_SCHDLR_HW_EVNT_CMPLT (0) +#define GPIO_DEBUG_EVNT_SCHDLR_HW_EVNT_CMPLT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_HCI_EVENT_HNDLR (0) +#define GPIO_DEBUG_HCI_EVENT_HNDLR {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_MLME_TMRS_CBK (0) +#define GPIO_DEBUG_MLME_TMRS_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_DIRECT_TX_EVNT_CBK (0) +#define GPIO_DEBUG_DIRECT_TX_EVNT_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_INDIRECT_PKT_TOUR_CBK (0) +#define GPIO_DEBUG_INDIRECT_PKT_TOUR_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RADIO_CSMA_TMR (0) +#define GPIO_DEBUG_RADIO_CSMA_TMR {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RAL_SM_DONE_EVNT_CBK (0) +#define GPIO_DEBUG_RAL_SM_DONE_EVNT_CBK {GPIOB, GPIO_PIN_4} + +#define USE_RT_DEBUG_ED_TMR_HNDL (0) +#define GPIO_DEBUG_ED_TMR_HNDL {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_OS_TMR_EVNT_CBK (0) +#define GPIO_DEBUG_OS_TMR_EVNT_CBK {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PROFILE_MARKER_PHY_WAKEUP_TIME (0) +#define GPIO_DEBUG_PROFILE_MARKER_PHY_WAKEUP_TIME {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PROFILE_END_DRIFT_TIME (0) +#define GPIO_DEBUG_PROFILE_END_DRIFT_TIME {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PROC_RADIO_RCV (0) +#define GPIO_DEBUG_PROC_RADIO_RCV {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_EVNT_TIME_UPDT (0) +#define GPIO_DEBUG_EVNT_TIME_UPDT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_MAC_RECEIVE_DONE (0) +#define GPIO_DEBUG_MAC_RECEIVE_DONE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_MAC_TX_DONE (0) +#define GPIO_DEBUG_MAC_TX_DONE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RADIO_APPLY_CSMA (0) +#define GPIO_DEBUG_RADIO_APPLY_CSMA {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RADIO_TRANSMIT (0) +#define GPIO_DEBUG_RADIO_TRANSMIT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_PROC_RADIO_TX (0) +#define GPIO_DEBUG_PROC_RADIO_TX {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RAL_TX_DONE (0) +#define GPIO_DEBUG_RAL_TX_DONE {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT (0) +#define GPIO_DEBUG_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RAL_TX_DONE_RST_BACKOFF_COUNT (0) +#define GPIO_DEBUG_RAL_TX_DONE_RST_BACKOFF_COUNT {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RAL_CONTINUE_RX (0) +#define GPIO_DEBUG_RAL_CONTINUE_RX {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RAL_PERFORM_CCA (0) +#define GPIO_DEBUG_RAL_PERFORM_CCA {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_RAL_ENABLE_TRANSMITTER (0) +#define GPIO_DEBUG_RAL_ENABLE_TRANSMITTER {GPIOA, GPIO_PIN_0} + +#define USE_RT_DEBUG_LLHWC_GET_CH_IDX_ALGO_2 (0) +#define GPIO_DEBUG_LLHWC_GET_CH_IDX_ALGO_2 {GPIOA, GPIO_PIN_0} + +/* Application signal selection and GPIO assignment. + CAN BE MODIFIED BY USER */ + +#define USE_RT_DEBUG_APP_APPE_INIT (1) +#define GPIO_DEBUG_APP_APPE_INIT {GPIOA, GPIO_PIN_0} + +/********************************/ +/** Debug configuration setup **/ +/*******************************/ + +/* + * + * Debug configuration for System purpose + * + */ +#if (USE_RT_DEBUG_CONFIGURATION_SYSTEM == 1U) +/* SCM_SETUP activation */ +#undef USE_RT_DEBUG_SCM_SETUP +#define USE_RT_DEBUG_SCM_SETUP (1U) + +/* SCM_SYSTEM_CLOCK_CONFIG activation */ +#undef USE_RT_DEBUG_SCM_SYSTEM_CLOCK_CONFIG +#define USE_RT_DEBUG_SCM_SYSTEM_CLOCK_CONFIG (1U) + +/* SCM_HSERDY_ISR activation */ +#undef USE_RT_DEBUG_SCM_HSERDY_ISR +#define USE_RT_DEBUG_SCM_HSERDY_ISR (1U) + +/* LOW_POWER_STOP_MODE_ACTIVE activation */ +#undef USE_RT_DEBUG_LOW_POWER_STOP_MODE_ACTIVE +#define USE_RT_DEBUG_LOW_POWER_STOP_MODE_ACTIVE (1U) + +/* ADC_ACTIVATION activation */ +#undef USE_RT_DEBUG_ADC_ACTIVATION +#define USE_RT_DEBUG_ADC_ACTIVATION (1U) + +/* ADC_TEMPERATURE_ACQUISITION activation */ +#undef USE_RT_DEBUG_ADC_TEMPERATURE_ACQUISITION +#define USE_RT_DEBUG_ADC_TEMPERATURE_ACQUISITION (1U) + +/* RNG_GEN_RAND_NUM activation */ +#undef USE_RT_DEBUG_RNG_GEN_RAND_NUM +#define USE_RT_DEBUG_RNG_GEN_RAND_NUM (1U) + +/* LOW_POWER_STANDBY_MODE_ACTIVE activation */ +#undef USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_ACTIVE +#define USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_ACTIVE (1U) + +/* + * + * Debug configuration for BLE purpose + * + */ +#elif (USE_RT_DEBUG_CONFIGURATION_BLE == 1U) + +/* LLHWC_CMN_LW_ISR activation */ +#undef USE_RT_DEBUG_LLHWC_CMN_LW_ISR +#define USE_RT_DEBUG_LLHWC_CMN_LW_ISR (1U) + +/* LLHWC_CMN_HG_ISR activation */ +#undef USE_RT_DEBUG_LLWCC_CMN_HG_ISR +#define USE_RT_DEBUG_LLWCC_CMN_HG_ISR (1U) + +/* PHY_CLBR_EXEC activation */ +#undef USE_RT_DEBUG_PHY_CLBR_EXEC +#define USE_RT_DEBUG_PHY_CLBR_EXEC (1U) + +/* SCHDLR_EVNT_RGSTR activation */ +#undef USE_RT_DEBUG_SCHDLR_EVNT_RGSTR +#define USE_RT_DEBUG_SCHDLR_EVNT_RGSTR (1U) + +/* SCHDLR_HNDL_MISSED_EVNT activation */ +#undef USE_RT_DEBUG_SCHDLR_HNDL_MISSED_EVNT +#define USE_RT_DEBUG_SCHDLR_HNDL_MISSED_EVNT (1U) + +/* SCHDLR_HNDL_NXT_TRACE activation */ +#undef USE_RT_DEBUG_SCHDLR_HNDL_NXT_TRACE +#define USE_RT_DEBUG_SCHDLR_HNDL_NXT_TRACE (1U) + +/* SCHDLR_EXEC_EVNT_TRACE activation */ +#undef USE_RT_DEBUG_SCHDLR_EXEC_EVNT_TRACE +#define USE_RT_DEBUG_SCHDLR_EXEC_EVNT_TRACE (1U) + +/* PHY_CLBR_ISR activation */ +#undef USE_RT_DEBUG_PHY_CLBR_ISR +#define USE_RT_DEBUG_PHY_CLBR_ISR (1U) + +/* + * + * Debug configuration for MAC purpose + * + */ +#elif (USE_RT_DEBUG_CONFIGURATION_MAC == 1U) + +/* LLHWC_CMN_LW_ISR activation */ +#undef USE_RT_DEBUG_LLHWC_CMN_LW_ISR +#define USE_RT_DEBUG_LLHWC_CMN_LW_ISR (1U) + +/* LLHWC_CMN_HG_ISR activation */ +#undef USE_RT_DEBUG_LLWCC_CMN_HG_ISR +#define USE_RT_DEBUG_LLWCC_CMN_HG_ISR (1U) + +/* RAL_ISR_TRACE activation */ +#undef USE_RT_DEBUG_RAL_ISR_TRACE +#define USE_RT_DEBUG_RAL_ISR_TRACE (1U) + +/* RAL_SM_DONE_EVNT_CBK activation */ +#undef USE_RT_DEBUG_RAL_SM_DONE_EVNT_CBK +#define USE_RT_DEBUG_RAL_SM_DONE_EVNT_CBK (1U) + +/* RAL_STOP_OPRTN activation */ +#undef USE_RT_DEBUG_RAL_STOP_OPRTN +#define USE_RT_DEBUG_RAL_STOP_OPRTN (1U) + +/* RAL_STRT_RX activation */ +#undef USE_RT_DEBUG_RAL_STRT_RX +#define USE_RT_DEBUG_RAL_STRT_RX (1U) + +/* RAL_STRT_TX activation */ +#undef USE_RT_DEBUG_RAL_STRT_TX +#define USE_RT_DEBUG_RAL_STRT_TX (1U) + +/* + * + * Debug configuration for COEX purpose + * + */ +#elif (USE_RT_DEBUG_CONFIGURATION_COEX == 1U) + +/* COEX_ASK_FOR_AIR activation */ +#undef USE_RT_DEBUG_COEX_ASK_FOR_AIR +#define USE_RT_DEBUG_COEX_ASK_FOR_AIR (1U) + +/* COEX_FORCE_STOP_RX activation */ +#undef USE_RT_DEBUG_COEX_FORCE_STOP_RX +#define USE_RT_DEBUG_COEX_FORCE_STOP_RX (1U) + +/* COEX_STRT_ON_IDLE activation */ +#undef USE_RT_DEBUG_COEX_STRT_ON_IDLE +#define USE_RT_DEBUG_COEX_STRT_ON_IDLE (1U) + +/* COEX_STRT_ONE_SHOT activation */ +#undef USE_RT_DEBUG_COEX_STRT_ONE_SHOT +#define USE_RT_DEBUG_COEX_STRT_ONE_SHOT (1U) + +/* SCHDLR_HNDL_NXT_TRACE activation */ +#undef USE_RT_DEBUG_SCHDLR_HNDL_NXT_TRACE +#define USE_RT_DEBUG_SCHDLR_HNDL_NXT_TRACE (1U) + +/* SCHDLR_EXEC_EVNT_TRACE activation */ +#undef USE_RT_DEBUG_SCHDLR_EXEC_EVNT_TRACE +#define USE_RT_DEBUG_SCHDLR_EXEC_EVNT_TRACE (1U) + +/* RAL_SM_DONE_EVNT_CBK activation */ +#undef USE_RT_DEBUG_RAL_SM_DONE_EVNT_CBK +#define USE_RT_DEBUG_RAL_SM_DONE_EVNT_CBK (1U) + +/* RAL_STOP_OPRTN activation */ +#undef USE_RT_DEBUG_RAL_STOP_OPRTN +#define USE_RT_DEBUG_RAL_STOP_OPRTN (1U) + +#else +/* Nothing to do */ +#endif /* (USE_RT_DEBUG_CONFIGURATION_COEX == 1U) */ + +#endif /* CFG_RT_DEBUG_GPIO_MODULE */ + +/******************************************************************/ +/** Association table between general debug signal and used gpio **/ +/******************************************************************/ + +#include "debug_signals.h" + +#if(CFG_RT_DEBUG_GPIO_MODULE == 1) + +#include "stm32wbaxx_hal.h" + +typedef struct { + GPIO_TypeDef* GPIO_port; + uint16_t GPIO_pin; +} st_gpio_debug_t; + +static const st_gpio_debug_t general_debug_table[] = { +#if (USE_RT_DEBUG_SCM_SYSTEM_CLOCK_CONFIG == 1) + [RT_DEBUG_SCM_SYSTEM_CLOCK_CONFIG] = GPIO_DEBUG_SCM_SYSTEM_CLOCK_CONFIG, +#endif /* USE_RT_DEBUG_SCM_SYSTEM_CLOCK_CONFIG */ + +#if (USE_RT_DEBUG_SCM_SETUP == 1) + [RT_DEBUG_SCM_SETUP] = GPIO_DEBUG_SCM_SETUP, +#endif /* USE_RT_DEBUG_SCM_SETUP */ + +#if (USE_RT_DEBUG_SCM_HSERDY_ISR == 1) + [RT_DEBUG_SCM_HSERDY_ISR] = GPIO_DEBUG_SCM_HSERDY_ISR, +#endif /* USE_RT_DEBUG_SCM_HSERDY_ISR */ + +#if (USE_RT_DEBUG_ADC_ACTIVATION == 1) + [RT_DEBUG_ADC_ACTIVATION] = GPIO_DEBUG_ADC_ACTIVATION, +#endif /* USE_RT_DEBUG_ADC_ACTIVATION */ + +#if (USE_RT_DEBUG_ADC_DEACTIVATION == 1) + [RT_DEBUG_ADC_DEACTIVATION] = GPIO_DEBUG_ADC_DEACTIVATION, +#endif /* USE_RT_DEBUG_ADC_DEACTIVATION */ + +#if (USE_RT_DEBUG_ADC_TEMPERATURE_ACQUISITION == 1) + [RT_DEBUG_ADC_TEMPERATURE_ACQUISITION] = GPIO_DEBUG_ADC_TEMPERATURE_ACQUISITION, +#endif /* USE_RT_DEBUG_ADC_TEMPERATURE_ACQUISITION */ + +#if (USE_RT_DEBUG_RNG_ENABLE == 1) + [RT_DEBUG_RNG_ENABLE] = GPIO_DEBUG_RNG_ENABLE, +#endif /* USE_RT_DEBUG_RNG_ENABLE */ + +#if (USE_RT_DEBUG_RNG_DISABLE == 1) + [RT_DEBUG_RNG_DISABLE] = GPIO_DEBUG_RNG_DISABLE, +#endif /* USE_RT_DEBUG_RNG_DISABLE */ + +#if (USE_RT_DEBUG_RNG_GEN_RAND_NUM == 1) + [RT_DEBUG_RNG_GEN_RAND_NUM] = GPIO_DEBUG_RNG_GEN_RAND_NUM, +#endif /* USE_RT_DEBUG_RNG_GEN_RAND_NUM */ + +#if (USE_RT_DEBUG_LOW_POWER_STOP_MODE_ENTER == 1) + [RT_DEBUG_LOW_POWER_STOP_MODE_ENTER] = GPIO_DEBUG_LOW_POWER_STOP_MODE_ENTER, +#endif /* USE_RT_DEBUG_LOW_POWER_STOP_MODE_ENTER */ + +#if (USE_RT_DEBUG_LOW_POWER_STOP_MODE_EXIT == 1) + [RT_DEBUG_LOW_POWER_STOP_MODE_EXIT] = GPIO_DEBUG_LOW_POWER_STOP_MODE_EXIT, +#endif /* USE_RT_DEBUG_LOW_POWER_STOP_MODE_EXIT */ + +#if (USE_RT_DEBUG_LOW_POWER_STOP_MODE_ACTIVE == 1) + [RT_DEBUG_LOW_POWER_STOP_MODE_ACTIVE] = GPIO_DEBUG_LOW_POWER_STOP_MODE_ACTIVE, +#endif /* USE_RT_DEBUG_LOW_POWER_STOP_MODE_ACTIVE */ + +#if (USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_ENTER == 1) + [RT_DEBUG_LOW_POWER_STANDBY_MODE_ENTER] = GPIO_DEBUG_LOW_POWER_STANDBY_MODE_ENTER, +#endif /* USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_ENTER */ + +#if (USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_EXIT == 1) + [RT_DEBUG_LOW_POWER_STANDBY_MODE_EXIT] = GPIO_DEBUG_LOW_POWER_STANDBY_MODE_EXIT, +#endif /* USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_EXIT */ + +#if (USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_ACTIVE == 1) + [RT_DEBUG_LOW_POWER_STANDBY_MODE_ACTIVE] = GPIO_DEBUG_LOW_POWER_STANDBY_MODE_ACTIVE, +#endif /* USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_ACTIVE */ + +#if (USE_RT_DEBUG_HCI_READ_DONE == 1) + [RT_DEBUG_HCI_READ_DONE] = GPIO_DEBUG_HCI_READ_DONE, +#endif /* USE_RT_DEBUG_HCI_READ_DONE */ + +#if (USE_RT_DEBUG_HCI_RCVD_CMD == 1) + [RT_DEBUG_HCI_RCVD_CMD] = GPIO_DEBUG_HCI_RCVD_CMD, +#endif /* USE_RT_DEBUG_HCI_RCVD_CMD */ + +#if (USE_RT_DEBUG_HCI_WRITE_DONE == 1) + [RT_DEBUG_HCI_WRITE_DONE] = GPIO_DEBUG_HCI_WRITE_DONE, +#endif /* USE_RT_DEBUG_HCI_WRITE_DONE */ + +#if (USE_RT_DEBUG_SCHDLR_EVNT_UPDATE == 1) + [RT_DEBUG_SCHDLR_EVNT_UPDATE] = GPIO_DEBUG_SCHDLR_EVNT_UPDATE, +#endif /* USE_RT_DEBUG_SCHDLR_EVNT_UPDATE */ + +#if (USE_RT_DEBUG_SCHDLR_TIMER_SET == 1) + [RT_DEBUG_SCHDLR_TIMER_SET] = GPIO_DEBUG_SCHDLR_TIMER_SET, +#endif /* USE_RT_DEBUG_SCHDLR_TIMER_SET */ + +#if (USE_RT_DEBUG_SCHDLR_PHY_CLBR_TIMER == 1) + [RT_DEBUG_SCHDLR_PHY_CLBR_TIMER] = GPIO_DEBUG_SCHDLR_PHY_CLBR_TIMER, +#endif /* USE_RT_DEBUG_SCHDLR_PHY_CLBR_TIMER */ + +#if (USE_RT_DEBUG_SCHDLR_EVNT_SKIPPED == 1) + [RT_DEBUG_SCHDLR_EVNT_SKIPPED] = GPIO_DEBUG_SCHDLR_EVNT_SKIPPED, +#endif /* USE_RT_DEBUG_SCHDLR_EVNT_SKIPPED */ + +#if (USE_RT_DEBUG_SCHDLR_HNDL_NXT_TRACE == 1) + [RT_DEBUG_SCHDLR_HNDL_NXT_TRACE] = GPIO_DEBUG_SCHDLR_HNDL_NXT_TRACE, +#endif /* USE_RT_DEBUG_SCHDLR_HNDL_NXT_TRACE */ + +#if (USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_DETEDTED == 1) + [RT_DEBUG_ACTIVE_SCHDLR_NEAR_DETEDTED] = GPIO_DEBUG_ACTIVE_SCHDLR_NEAR_DETEDTED, +#endif /* USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_DETEDTED */ + +#if (USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_GAP_CHECK == 1) + [RT_DEBUG_ACTIVE_SCHDLR_NEAR_GAP_CHECK] = GPIO_DEBUG_ACTIVE_SCHDLR_NEAR_GAP_CHECK, +#endif /* USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_GAP_CHECK */ + +#if (USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_TIME_CHECK == 1) + [RT_DEBUG_ACTIVE_SCHDLR_NEAR_TIME_CHECK] = GPIO_DEBUG_ACTIVE_SCHDLR_NEAR_TIME_CHECK, +#endif /* USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_TIME_CHECK */ + +#if (USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_TRACE == 1) + [RT_DEBUG_ACTIVE_SCHDLR_NEAR_TRACE] = GPIO_DEBUG_ACTIVE_SCHDLR_NEAR_TRACE, +#endif /* USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_TRACE */ + +#if (USE_RT_DEBUG_SCHDLR_EVNT_RGSTR == 1) + [RT_DEBUG_SCHDLR_EVNT_RGSTR] = GPIO_DEBUG_SCHDLR_EVNT_RGSTR, +#endif /* USE_RT_DEBUG_SCHDLR_EVNT_RGSTR */ + +#if (USE_RT_DEBUG_SCHDLR_ADD_CONFLICT_Q == 1) + [RT_DEBUG_SCHDLR_ADD_CONFLICT_Q] = GPIO_DEBUG_SCHDLR_ADD_CONFLICT_Q, +#endif /* USE_RT_DEBUG_SCHDLR_ADD_CONFLICT_Q */ + +#if (USE_RT_DEBUG_SCHDLR_HNDL_MISSED_EVNT == 1) + [RT_DEBUG_SCHDLR_HNDL_MISSED_EVNT] = GPIO_DEBUG_SCHDLR_HNDL_MISSED_EVNT, +#endif /* USE_RT_DEBUG_SCHDLR_HNDL_MISSED_EVNT */ + +#if (USE_RT_DEBUG_SCHDLR_UNRGSTR_EVNT == 1) + [RT_DEBUG_SCHDLR_UNRGSTR_EVNT] = GPIO_DEBUG_SCHDLR_UNRGSTR_EVNT, +#endif /* USE_RT_DEBUG_SCHDLR_UNRGSTR_EVNT */ + +#if (USE_RT_DEBUG_SCHDLR_EXEC_EVNT_TRACE == 1) + [RT_DEBUG_SCHDLR_EXEC_EVNT_TRACE] = GPIO_DEBUG_SCHDLR_EXEC_EVNT_TRACE, +#endif /* USE_RT_DEBUG_SCHDLR_EXEC_EVNT_TRACE */ + +#if (USE_RT_DEBUG_SCHDLR_EXEC_EVNT_PROFILE == 1) + [RT_DEBUG_SCHDLR_EXEC_EVNT_PROFILE] = GPIO_DEBUG_SCHDLR_EXEC_EVNT_PROFILE, +#endif /* USE_RT_DEBUG_SCHDLR_EXEC_EVNT_PROFILE */ + +#if (USE_RT_DEBUG_SCHDLR_EXEC_EVNT_ERROR == 1) + [RT_DEBUG_SCHDLR_EXEC_EVNT_ERROR] = GPIO_DEBUG_SCHDLR_EXEC_EVNT_ERROR, +#endif /* USE_RT_DEBUG_SCHDLR_EXEC_EVNT_ERROR */ + +#if (USE_RT_DEBUG_SCHDLR_EXEC_EVNT_WINDOW_WIDENING == 1) + [RT_DEBUG_SCHDLR_EXEC_EVNT_WINDOW_WIDENING] = GPIO_DEBUG_SCHDLR_EXEC_EVNT_WINDOW_WIDENING, +#endif /* USE_RT_DEBUG_SCHDLR_EXEC_EVNT_WINDOW_WIDENING */ + +#if (USE_RT_DEBUG_LLHWC_CMN_CLR_ISR == 1) + [RT_DEBUG_LLHWC_CMN_CLR_ISR] = GPIO_DEBUG_LLHWC_CMN_CLR_ISR, +#endif /* USE_RT_DEBUG_LLHWC_CMN_CLR_ISR */ + +#if (USE_RT_DEBUG_LLWCC_CMN_HG_ISR == 1) + [RT_DEBUG_LLWCC_CMN_HG_ISR] = GPIO_DEBUG_LLWCC_CMN_HG_ISR, +#endif /* USE_RT_DEBUG_LLWCC_CMN_HG_ISR */ + +#if (USE_RT_DEBUG_LLHWC_CMN_LW_ISR == 1) + [RT_DEBUG_LLHWC_CMN_LW_ISR] = GPIO_DEBUG_LLHWC_CMN_LW_ISR, +#endif /* USE_RT_DEBUG_LLHWC_CMN_LW_ISR */ + +#if (USE_RT_DEBUG_LLHWC_CMN_CLR_TIMER_ERROR == 1) + [RT_DEBUG_LLHWC_CMN_CLR_TIMER_ERROR] = GPIO_DEBUG_LLHWC_CMN_CLR_TIMER_ERROR, +#endif /* USE_RT_DEBUG_LLHWC_CMN_CLR_TIMER_ERROR */ + +#if (USE_RT_DEBUG_LLHWC_LL_ISR == 1) + [RT_DEBUG_LLHWC_LL_ISR] = GPIO_DEBUG_LLHWC_LL_ISR, +#endif /* USE_RT_DEBUG_LLHWC_LL_ISR */ + +#if (USE_RT_DEBUG_LLHWC_SPLTMR_SET == 1) + [RT_DEBUG_LLHWC_SPLTMR_SET] = GPIO_DEBUG_LLHWC_SPLTMR_SET, +#endif /* USE_RT_DEBUG_LLHWC_SPLTMR_SET */ + +#if (USE_RT_DEBUG_LLHWC_SPLTMR_GET == 1) + [RT_DEBUG_LLHWC_SPLTMR_GET] = GPIO_DEBUG_LLHWC_SPLTMR_GET, +#endif /* USE_RT_DEBUG_LLHWC_SPLTMR_GET */ + +#if (USE_RT_DEBUG_LLHWC_LOW_ISR == 1) + [RT_DEBUG_LLHWC_LOW_ISR] = GPIO_DEBUG_LLHWC_LOW_ISR, +#endif /* USE_RT_DEBUG_LLHWC_LOW_ISR */ + +#if (USE_RT_DEBUG_LLHWC_STOP_SCN == 1) + [RT_DEBUG_LLHWC_STOP_SCN] = GPIO_DEBUG_LLHWC_STOP_SCN, +#endif /* USE_RT_DEBUG_LLHWC_STOP_SCN */ + +#if (USE_RT_DEBUG_LLHWC_WAIT_ENVT_ON_AIR == 1) + [RT_DEBUG_LLHWC_WAIT_ENVT_ON_AIR] = GPIO_DEBUG_LLHWC_WAIT_ENVT_ON_AIR, +#endif /* USE_RT_DEBUG_LLHWC_WAIT_ENVT_ON_AIR */ + +#if (USE_RT_DEBUG_LLHWC_SET_CONN_EVNT_PARAM == 1) + [RT_DEBUG_LLHWC_SET_CONN_EVNT_PARAM] = GPIO_DEBUG_LLHWC_SET_CONN_EVNT_PARAM, +#endif /* USE_RT_DEBUG_LLHWC_SET_CONN_EVNT_PARAM */ + +#if (USE_RT_DEBUG_POST_EVNT == 1) + [RT_DEBUG_POST_EVNT] = GPIO_DEBUG_POST_EVNT, +#endif /* USE_RT_DEBUG_POST_EVNT */ + +#if (USE_RT_DEBUG_HNDL_ALL_EVNTS == 1) + [RT_DEBUG_HNDL_ALL_EVNTS] = GPIO_DEBUG_HNDL_ALL_EVNTS, +#endif /* USE_RT_DEBUG_HNDL_ALL_EVNTS */ + +#if (USE_RT_DEBUG_PROCESS_EVNT == 1) + [RT_DEBUG_PROCESS_EVNT] = GPIO_DEBUG_PROCESS_EVNT, +#endif /* USE_RT_DEBUG_PROCESS_EVNT */ + +#if (USE_RT_DEBUG_PROCESS_ISO_DATA == 1) + [RT_DEBUG_PROCESS_ISO_DATA] = GPIO_DEBUG_PROCESS_ISO_DATA, +#endif /* USE_RT_DEBUG_PROCESS_ISO_DATA */ + +#if (USE_RT_DEBUG_ALLOC_TX_ISO_EMPTY_PKT == 1) + [RT_DEBUG_ALLOC_TX_ISO_EMPTY_PKT] = GPIO_DEBUG_ALLOC_TX_ISO_EMPTY_PKT, +#endif /* USE_RT_DEBUG_ALLOC_TX_ISO_EMPTY_PKT */ + +#if (USE_RT_DEBUG_BIG_FREE_EMPTY_PKTS == 1) + [RT_DEBUG_BIG_FREE_EMPTY_PKTS] = GPIO_DEBUG_BIG_FREE_EMPTY_PKTS, +#endif /* USE_RT_DEBUG_BIG_FREE_EMPTY_PKTS */ + +#if (USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_OK == 1) + [RT_DEBUG_RECOMBINE_UNFRMD_DATA_OK] = GPIO_DEBUG_RECOMBINE_UNFRMD_DATA_OK, +#endif /* USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_OK */ + +#if (USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_CRC == 1) + [RT_DEBUG_RECOMBINE_UNFRMD_DATA_CRC] = GPIO_DEBUG_RECOMBINE_UNFRMD_DATA_CRC, +#endif /* USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_CRC */ + +#if (USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_NoRX == 1) + [RT_DEBUG_RECOMBINE_UNFRMD_DATA_NoRX] = GPIO_DEBUG_RECOMBINE_UNFRMD_DATA_NoRX, +#endif /* USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_NoRX */ + +#if (USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_TRACE == 1) + [RT_DEBUG_RECOMBINE_UNFRMD_DATA_TRACE] = GPIO_DEBUG_RECOMBINE_UNFRMD_DATA_TRACE, +#endif /* USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_TRACE */ + +#if (USE_RT_DEBUG_ISO_HNDL_SDU == 1) + [RT_DEBUG_ISO_HNDL_SDU] = GPIO_DEBUG_ISO_HNDL_SDU, +#endif /* USE_RT_DEBUG_ISO_HNDL_SDU */ + +#if (USE_RT_DEBUG_LL_INTF_INIT == 1) + [RT_DEBUG_LL_INTF_INIT] = GPIO_DEBUG_LL_INTF_INIT, +#endif /* USE_RT_DEBUG_LL_INTF_INIT */ + +#if (USE_RT_DEBUG_DATA_TO_CNTRLR == 1) + [RT_DEBUG_DATA_TO_CNTRLR] = GPIO_DEBUG_DATA_TO_CNTRLR, +#endif /* USE_RT_DEBUG_DATA_TO_CNTRLR */ + +#if (USE_RT_DEBUG_FREE_LL_PKT_HNDLR == 1) + [RT_DEBUG_FREE_LL_PKT_HNDLR] = GPIO_DEBUG_FREE_LL_PKT_HNDLR, +#endif /* USE_RT_DEBUG_FREE_LL_PKT_HNDLR */ + +#if (USE_RT_DEBUG_PHY_INIT_CLBR_TRACE == 1) + [RT_DEBUG_PHY_INIT_CLBR_TRACE] = GPIO_DEBUG_PHY_INIT_CLBR_TRACE, +#endif /* USE_RT_DEBUG_PHY_INIT_CLBR_TRACE */ + +#if (USE_RT_DEBUG_PHY_RUNTIME_CLBR_TRACE == 1) + [RT_DEBUG_PHY_RUNTIME_CLBR_TRACE] = GPIO_DEBUG_PHY_RUNTIME_CLBR_TRACE, +#endif /* USE_RT_DEBUG_PHY_RUNTIME_CLBR_TRACE */ + +#if (USE_RT_DEBUG_PHY_CLBR_ISR == 1) + [RT_DEBUG_PHY_CLBR_ISR] = GPIO_DEBUG_PHY_CLBR_ISR, +#endif /* USE_RT_DEBUG_PHY_CLBR_ISR */ + +#if (USE_RT_DEBUG_PHY_INIT_CLBR_SINGLE_CH == 1) + [RT_DEBUG_PHY_INIT_CLBR_SINGLE_CH] = GPIO_DEBUG_PHY_INIT_CLBR_SINGLE_CH, +#endif /* USE_RT_DEBUG_PHY_INIT_CLBR_SINGLE_CH */ + +#if (USE_RT_DEBUG_PHY_CLBR_STRTD == 1) + [RT_DEBUG_PHY_CLBR_STRTD] = GPIO_DEBUG_PHY_CLBR_STRTD, +#endif /* USE_RT_DEBUG_PHY_CLBR_STRTD */ + +#if (USE_RT_DEBUG_PHY_CLBR_EXEC == 1) + [RT_DEBUG_PHY_CLBR_EXEC] = GPIO_DEBUG_PHY_CLBR_EXEC, +#endif /* USE_RT_DEBUG_PHY_CLBR_EXEC */ + +#if (USE_RT_DEBUG_RCO_STRT_STOP_RUNTIME_CLBR_ACTV == 1) + [RT_DEBUG_RCO_STRT_STOP_RUNTIME_CLBR_ACTV] = GPIO_DEBUG_RCO_STRT_STOP_RUNTIME_CLBR_ACTV, +#endif /* USE_RT_DEBUG_RCO_STRT_STOP_RUNTIME_CLBR_ACTV */ + +#if (USE_RT_DEBUG_RCO_STRT_STOP_RUNTIME_RCO_CLBR == 1) + [RT_DEBUG_RCO_STRT_STOP_RUNTIME_RCO_CLBR] = GPIO_DEBUG_RCO_STRT_STOP_RUNTIME_RCO_CLBR, +#endif /* USE_RT_DEBUG_RCO_STRT_STOP_RUNTIME_RCO_CLBR */ + +#if (USE_RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_SWT == 1) + [RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_SWT] = GPIO_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_SWT, +#endif /* USE_RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_SWT */ + +#if (USE_RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_TRACE == 1) + [RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_TRACE] = GPIO_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_TRACE, +#endif /* USE_RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_TRACE */ + +#if (USE_RT_DEBUG_RCO_ISR_TRACE == 1) + [RT_DEBUG_RCO_ISR_TRACE] = GPIO_DEBUG_RCO_ISR_TRACE, +#endif /* USE_RT_DEBUG_RCO_ISR_TRACE */ + +#if (USE_RT_DEBUG_RCO_ISR_COMPENDATE == 1) + [RT_DEBUG_RCO_ISR_COMPENDATE] = GPIO_DEBUG_RCO_ISR_COMPENDATE, +#endif /* USE_RT_DEBUG_RCO_ISR_COMPENDATE */ + +#if (USE_RT_DEBUG_RAL_STRT_TX == 1) + [RT_DEBUG_RAL_STRT_TX] = GPIO_DEBUG_RAL_STRT_TX, +#endif /* USE_RT_DEBUG_RAL_STRT_TX */ + +#if (USE_RT_DEBUG_RAL_ISR_TIMER_ERROR == 1) + [RT_DEBUG_RAL_ISR_TIMER_ERROR] = GPIO_DEBUG_RAL_ISR_TIMER_ERROR, +#endif /* USE_RT_DEBUG_RAL_ISR_TIMER_ERROR */ + +#if (USE_RT_DEBUG_RAL_ISR_TRACE == 1) + [RT_DEBUG_RAL_ISR_TRACE] = GPIO_DEBUG_RAL_ISR_TRACE, +#endif /* USE_RT_DEBUG_RAL_ISR_TRACE */ + +#if (USE_RT_DEBUG_RAL_STOP_OPRTN == 1) + [RT_DEBUG_RAL_STOP_OPRTN] = GPIO_DEBUG_RAL_STOP_OPRTN, +#endif /* USE_RT_DEBUG_RAL_STOP_OPRTN */ + +#if (USE_RT_DEBUG_RAL_STRT_RX == 1) + [RT_DEBUG_RAL_STRT_RX] = GPIO_DEBUG_RAL_STRT_RX, +#endif /* USE_RT_DEBUG_RAL_STRT_RX */ + +#if (USE_RT_DEBUG_RAL_DONE_CLBK_TX == 1) + [RT_DEBUG_RAL_DONE_CLBK_TX] = GPIO_DEBUG_RAL_DONE_CLBK_TX, +#endif /* USE_RT_DEBUG_RAL_DONE_CLBK_TX */ + +#if (USE_RT_DEBUG_RAL_DONE_CLBK_RX == 1) + [RT_DEBUG_RAL_DONE_CLBK_RX] = GPIO_DEBUG_RAL_DONE_CLBK_RX, +#endif /* USE_RT_DEBUG_RAL_DONE_CLBK_RX */ + +#if (USE_RT_DEBUG_RAL_DONE_CLBK_ED == 1) + [RT_DEBUG_RAL_DONE_CLBK_ED] = GPIO_DEBUG_RAL_DONE_CLBK_ED, +#endif /* USE_RT_DEBUG_RAL_DONE_CLBK_ED */ + +#if (USE_RT_DEBUG_RAL_ED_SCAN == 1) + [RT_DEBUG_RAL_ED_SCAN] = GPIO_DEBUG_RAL_ED_SCAN, +#endif /* USE_RT_DEBUG_RAL_ED_SCAN */ + +#if (USE_RT_DEBUG_ERROR_MEM_CAP_EXCED == 1) + [RT_DEBUG_ERROR_MEM_CAP_EXCED] = GPIO_DEBUG_ERROR_MEM_CAP_EXCED, +#endif /* USE_RT_DEBUG_ERROR_MEM_CAP_EXCED */ + +#if (USE_RT_DEBUG_ERROR_COMMAND_DISALLOWED == 1) + [RT_DEBUG_ERROR_COMMAND_DISALLOWED] = GPIO_DEBUG_ERROR_COMMAND_DISALLOWED, +#endif /* USE_RT_DEBUG_ERROR_COMMAND_DISALLOWED */ + +#if (USE_RT_DEBUG_PTA_INIT == 1) + [RT_DEBUG_PTA_INIT] = GPIO_DEBUG_PTA_INIT, +#endif /* USE_RT_DEBUG_PTA_INIT */ + +#if (USE_RT_DEBUG_PTA_EN == 1) + [RT_DEBUG_PTA_EN] = GPIO_DEBUG_PTA_EN, +#endif /* USE_RT_DEBUG_PTA_EN */ + +#if (USE_RT_DEBUG_LLHWC_PTA_SET_EN == 1) + [RT_DEBUG_LLHWC_PTA_SET_EN] = GPIO_DEBUG_LLHWC_PTA_SET_EN, +#endif /* USE_RT_DEBUG_LLHWC_PTA_SET_EN */ + +#if (USE_RT_DEBUG_LLHWC_PTA_SET_PARAMS == 1) + [RT_DEBUG_LLHWC_PTA_SET_PARAMS] = GPIO_DEBUG_LLHWC_PTA_SET_PARAMS, +#endif /* USE_RT_DEBUG_LLHWC_PTA_SET_PARAMS */ + +#if (USE_RT_DEBUG_COEX_STRT_ON_IDLE == 1) + [RT_DEBUG_COEX_STRT_ON_IDLE] = GPIO_DEBUG_COEX_STRT_ON_IDLE, +#endif /* USE_RT_DEBUG_COEX_STRT_ON_IDLE */ + +#if (USE_RT_DEBUG_COEX_ASK_FOR_AIR == 1) + [RT_DEBUG_COEX_ASK_FOR_AIR] = GPIO_DEBUG_COEX_ASK_FOR_AIR, +#endif /* USE_RT_DEBUG_COEX_ASK_FOR_AIR */ + +#if (USE_RT_DEBUG_COEX_TIMER_EVNT_CLBK == 1) + [RT_DEBUG_COEX_TIMER_EVNT_CLBK] = GPIO_DEBUG_COEX_TIMER_EVNT_CLBK, +#endif /* USE_RT_DEBUG_COEX_TIMER_EVNT_CLBK */ + +#if (USE_RT_DEBUG_COEX_STRT_ONE_SHOT == 1) + [RT_DEBUG_COEX_STRT_ONE_SHOT] = GPIO_DEBUG_COEX_STRT_ONE_SHOT, +#endif /* USE_RT_DEBUG_COEX_STRT_ONE_SHOT */ + +#if (USE_RT_DEBUG_COEX_FORCE_STOP_RX == 1) + [RT_DEBUG_COEX_FORCE_STOP_RX] = GPIO_DEBUG_COEX_FORCE_STOP_RX, +#endif /* USE_RT_DEBUG_COEX_FORCE_STOP_RX */ + +#if (USE_RT_DEBUG_LLHWC_ADV_DONE == 1) + [RT_DEBUG_LLHWC_ADV_DONE] = GPIO_DEBUG_LLHWC_ADV_DONE, +#endif /* USE_RT_DEBUG_LLHWC_ADV_DONE */ + +#if (USE_RT_DEBUG_LLHWC_SCN_DONE == 1) + [RT_DEBUG_LLHWC_SCN_DONE] = GPIO_DEBUG_LLHWC_SCN_DONE, +#endif /* USE_RT_DEBUG_LLHWC_SCN_DONE */ + +#if (USE_RT_DEBUG_LLHWC_INIT_DONE == 1) + [RT_DEBUG_LLHWC_INIT_DONE] = GPIO_DEBUG_LLHWC_INIT_DONE, +#endif /* USE_RT_DEBUG_LLHWC_INIT_DONE */ + +#if (USE_RT_DEBUG_LLHWC_CONN_DONE == 1) + [RT_DEBUG_LLHWC_CONN_DONE] = GPIO_DEBUG_LLHWC_CONN_DONE, +#endif /* USE_RT_DEBUG_LLHWC_CONN_DONE */ + +#if (USE_RT_DEBUG_LLHWC_CIG_DONE == 1) + [RT_DEBUG_LLHWC_CIG_DONE] = GPIO_DEBUG_LLHWC_CIG_DONE, +#endif /* USE_RT_DEBUG_LLHWC_CIG_DONE */ + +#if (USE_RT_DEBUG_LLHWC_BIG_DONE == 1) + [RT_DEBUG_LLHWC_BIG_DONE] = GPIO_DEBUG_LLHWC_BIG_DONE, +#endif /* USE_RT_DEBUG_LLHWC_BIG_DONE */ + +#if (USE_RT_DEBUG_OS_TMR_CREATE == 1) + [RT_DEBUG_OS_TMR_CREATE] = GPIO_DEBUG_OS_TMR_CREATE, +#endif /* USE_RT_DEBUG_OS_TMR_CREATE */ + +#if (USE_RT_DEBUG_ADV_EXT_TIMEOUT_CBK == 1) + [RT_DEBUG_ADV_EXT_TIMEOUT_CBK] = GPIO_DEBUG_ADV_EXT_TIMEOUT_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_TIMEOUT_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_SCN_DUR_CBK == 1) + [RT_DEBUG_ADV_EXT_SCN_DUR_CBK] = GPIO_DEBUG_ADV_EXT_SCN_DUR_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_SCN_DUR_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_SCN_PERIOD_CBK == 1) + [RT_DEBUG_ADV_EXT_SCN_PERIOD_CBK] = GPIO_DEBUG_ADV_EXT_SCN_PERIOD_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_SCN_PERIOD_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_PRDC_SCN_TIMEOUT_CBK == 1) + [RT_DEBUG_ADV_EXT_PRDC_SCN_TIMEOUT_CBK] = GPIO_DEBUG_ADV_EXT_PRDC_SCN_TIMEOUT_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_PRDC_SCN_TIMEOUT_CBK */ + +#if (USE_RT_DEBUG_BIS_SYNC_TIMEOUT_TMR_CBK == 1) + [RT_DEBUG_BIS_SYNC_TIMEOUT_TMR_CBK] = GPIO_DEBUG_BIS_SYNC_TIMEOUT_TMR_CBK, +#endif /* USE_RT_DEBUG_BIS_SYNC_TIMEOUT_TMR_CBK */ + +#if (USE_RT_DEBUG_BIS_TERM_TMR_CBK == 1) + [RT_DEBUG_BIS_TERM_TMR_CBK] = GPIO_DEBUG_BIS_TERM_TMR_CBK, +#endif /* USE_RT_DEBUG_BIS_TERM_TMR_CBK */ + +#if (USE_RT_DEBUG_BIS_TST_MODE_CBK == 1) + [RT_DEBUG_BIS_TST_MODE_CBK] = GPIO_DEBUG_BIS_TST_MODE_CBK, +#endif /* USE_RT_DEBUG_BIS_TST_MODE_CBK */ + +#if (USE_RT_DEBUG_BIS_TST_MODE_TMR_CBK == 1) + [RT_DEBUG_BIS_TST_MODE_TMR_CBK] = GPIO_DEBUG_BIS_TST_MODE_TMR_CBK, +#endif /* USE_RT_DEBUG_BIS_TST_MODE_TMR_CBK */ + +#if (USE_RT_DEBUG_ISO_POST_TMR_CBK == 1) + [RT_DEBUG_ISO_POST_TMR_CBK] = GPIO_DEBUG_ISO_POST_TMR_CBK, +#endif /* USE_RT_DEBUG_ISO_POST_TMR_CBK */ + +#if (USE_RT_DEBUG_ISO_TST_MODE_TMR_CBK == 1) + [RT_DEBUG_ISO_TST_MODE_TMR_CBK] = GPIO_DEBUG_ISO_TST_MODE_TMR_CBK, +#endif /* USE_RT_DEBUG_ISO_TST_MODE_TMR_CBK */ + +#if (USE_RT_DEBUG_CONN_POST_TMR_CBK == 1) + [RT_DEBUG_CONN_POST_TMR_CBK] = GPIO_DEBUG_CONN_POST_TMR_CBK, +#endif /* USE_RT_DEBUG_CONN_POST_TMR_CBK */ + +#if (USE_RT_DEBUG_EVNT_SCHDLR_TMR_CBK == 1) + [RT_DEBUG_EVNT_SCHDLR_TMR_CBK] = GPIO_DEBUG_EVNT_SCHDLR_TMR_CBK, +#endif /* USE_RT_DEBUG_EVNT_SCHDLR_TMR_CBK */ + +#if (USE_RT_DEBUG_HCI_POST_TMR_CBK == 1) + [RT_DEBUG_HCI_POST_TMR_CBK] = GPIO_DEBUG_HCI_POST_TMR_CBK, +#endif /* USE_RT_DEBUG_HCI_POST_TMR_CBK */ + +#if (USE_RT_DEBUG_LLCP_POST_TMR_CBK == 1) + [RT_DEBUG_LLCP_POST_TMR_CBK] = GPIO_DEBUG_LLCP_POST_TMR_CBK, +#endif /* USE_RT_DEBUG_LLCP_POST_TMR_CBK */ + +#if (USE_RT_DEBUG_LLHWC_ENRGY_DETECT_CBK == 1) + [RT_DEBUG_LLHWC_ENRGY_DETECT_CBK] = GPIO_DEBUG_LLHWC_ENRGY_DETECT_CBK, +#endif /* USE_RT_DEBUG_LLHWC_ENRGY_DETECT_CBK */ + +#if (USE_RT_DEBUG_PRVCY_POST_TMR_CBK == 1) + [RT_DEBUG_PRVCY_POST_TMR_CBK] = GPIO_DEBUG_PRVCY_POST_TMR_CBK, +#endif /* USE_RT_DEBUG_PRVCY_POST_TMR_CBK */ + +#if (USE_RT_DEBUG_ANT_PRPR_TMR_CBK == 1) + [RT_DEBUG_ANT_PRPR_TMR_CBK] = GPIO_DEBUG_ANT_PRPR_TMR_CBK, +#endif /* USE_RT_DEBUG_ANT_PRPR_TMR_CBK */ + +#if (USE_RT_DEBUG_COEX_TMR_FRC_STOP_AIR_GRANT_CBK == 1) + [RT_DEBUG_COEX_TMR_FRC_STOP_AIR_GRANT_CBK] = GPIO_DEBUG_COEX_TMR_FRC_STOP_AIR_GRANT_CBK, +#endif /* USE_RT_DEBUG_COEX_TMR_FRC_STOP_AIR_GRANT_CBK */ + +#if (USE_RT_DEBUG_MLME_RX_EN_TMR_CBK == 1) + [RT_DEBUG_MLME_RX_EN_TMR_CBK] = GPIO_DEBUG_MLME_RX_EN_TMR_CBK, +#endif /* USE_RT_DEBUG_MLME_RX_EN_TMR_CBK */ + +#if (USE_RT_DEBUG_MLME_GNRC_TMR_CBK == 1) + [RT_DEBUG_MLME_GNRC_TMR_CBK] = GPIO_DEBUG_MLME_GNRC_TMR_CBK, +#endif /* USE_RT_DEBUG_MLME_GNRC_TMR_CBK */ + +#if (USE_RT_DEBUG_MIB_JOIN_LST_TMR_CBK == 1) + [RT_DEBUG_MIB_JOIN_LST_TMR_CBK] = GPIO_DEBUG_MIB_JOIN_LST_TMR_CBK, +#endif /* USE_RT_DEBUG_MIB_JOIN_LST_TMR_CBK */ + +#if (USE_RT_DEBUG_MLME_PWR_PRES_TMR_CBK == 1) + [RT_DEBUG_MLME_PWR_PRES_TMR_CBK] = GPIO_DEBUG_MLME_PWR_PRES_TMR_CBK, +#endif /* USE_RT_DEBUG_MLME_PWR_PRES_TMR_CBK */ + +#if (USE_RT_DEBUG_PRESISTENCE_TMR_CBK == 1) + [RT_DEBUG_PRESISTENCE_TMR_CBK] = GPIO_DEBUG_PRESISTENCE_TMR_CBK, +#endif /* USE_RT_DEBUG_PRESISTENCE_TMR_CBK */ + +#if (USE_RT_DEBUG_RADIO_PHY_PRDC_CLBK_TMR_CBK == 1) + [RT_DEBUG_RADIO_PHY_PRDC_CLBK_TMR_CBK] = GPIO_DEBUG_RADIO_PHY_PRDC_CLBK_TMR_CBK, +#endif /* USE_RT_DEBUG_RADIO_PHY_PRDC_CLBK_TMR_CBK */ + +#if (USE_RT_DEBUG_RADIO_CSMA_TMR_CBK == 1) + [RT_DEBUG_RADIO_CSMA_TMR_CBK] = GPIO_DEBUG_RADIO_CSMA_TMR_CBK, +#endif /* USE_RT_DEBUG_RADIO_CSMA_TMR_CBK */ + +#if (USE_RT_DEBUG_RADIO_CSL_RCV_TMR_CBK == 1) + [RT_DEBUG_RADIO_CSL_RCV_TMR_CBK] = GPIO_DEBUG_RADIO_CSL_RCV_TMR_CBK, +#endif /* USE_RT_DEBUG_RADIO_CSL_RCV_TMR_CBK */ + +#if (USE_RT_DEBUG_ED_TMR_CBK == 1) + [RT_DEBUG_ED_TMR_CBK] = GPIO_DEBUG_ED_TMR_CBK, +#endif /* USE_RT_DEBUG_ED_TMR_CBK */ + +#if (USE_RT_DEBUG_DIO_EXT_TMR_CBK == 1) + [RT_DEBUG_DIO_EXT_TMR_CBK] = GPIO_DEBUG_DIO_EXT_TMR_CBK, +#endif /* USE_RT_DEBUG_DIO_EXT_TMR_CBK */ + +#if (USE_RT_DEBUG_RCO_CLBR_TMR_CBK == 1) + [RT_DEBUG_RCO_CLBR_TMR_CBK] = GPIO_DEBUG_RCO_CLBR_TMR_CBK, +#endif /* USE_RT_DEBUG_RCO_CLBR_TMR_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_ADV_CBK == 1) + [RT_DEBUG_ADV_EXT_MNGR_ADV_CBK] = GPIO_DEBUG_ADV_EXT_MNGR_ADV_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_ADV_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_SCN_CBK == 1) + [RT_DEBUG_ADV_EXT_MNGR_SCN_CBK] = GPIO_DEBUG_ADV_EXT_MNGR_SCN_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_SCN_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_SCN_ERR_CBK == 1) + [RT_DEBUG_ADV_EXT_MNGR_SCN_ERR_CBK] = GPIO_DEBUG_ADV_EXT_MNGR_SCN_ERR_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_SCN_ERR_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CBK == 1) + [RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CBK] = GPIO_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK == 1) + [RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK] = GPIO_DEBUG_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK */ + +#if (USE_RT_DEBUG_BIG_ADV_CBK == 1) + [RT_DEBUG_BIG_ADV_CBK] = GPIO_DEBUG_BIG_ADV_CBK, +#endif /* USE_RT_DEBUG_BIG_ADV_CBK */ + +#if (USE_RT_DEBUG_BIG_ADV_ERR_CBK == 1) + [RT_DEBUG_BIG_ADV_ERR_CBK] = GPIO_DEBUG_BIG_ADV_ERR_CBK, +#endif /* USE_RT_DEBUG_BIG_ADV_ERR_CBK */ + +#if (USE_RT_DEBUG_BIG_SYNC_CBK == 1) + [RT_DEBUG_BIG_SYNC_CBK] = GPIO_DEBUG_BIG_SYNC_CBK, +#endif /* USE_RT_DEBUG_BIG_SYNC_CBK */ + +#if (USE_RT_DEBUG_BIG_SYNC_ERR_CBK == 1) + [RT_DEBUG_BIG_SYNC_ERR_CBK] = GPIO_DEBUG_BIG_SYNC_ERR_CBK, +#endif /* USE_RT_DEBUG_BIG_SYNC_ERR_CBK */ + +#if (USE_RT_DEBUG_ISO_CIS_PKT_TRNSM_RECEIVED_CBK == 1) + [RT_DEBUG_ISO_CIS_PKT_TRNSM_RECEIVED_CBK] = GPIO_DEBUG_ISO_CIS_PKT_TRNSM_RECEIVED_CBK, +#endif /* USE_RT_DEBUG_ISO_CIS_PKT_TRNSM_RECEIVED_CBK */ + +#if (USE_RT_DEBUG_ISO_CIG_ERR_CBK == 1) + [RT_DEBUG_ISO_CIG_ERR_CBK] = GPIO_DEBUG_ISO_CIG_ERR_CBK, +#endif /* USE_RT_DEBUG_ISO_CIG_ERR_CBK */ + +#if (USE_RT_DEBUG_CONN_PKT_TRNSM_RECEIVED_CBK == 1) + [RT_DEBUG_CONN_PKT_TRNSM_RECEIVED_CBK] = GPIO_DEBUG_CONN_PKT_TRNSM_RECEIVED_CBK, +#endif /* USE_RT_DEBUG_CONN_PKT_TRNSM_RECEIVED_CBK */ + +#if (USE_RT_DEBUG_PRDC_CLBR_EXTRL_CBK == 1) + [RT_DEBUG_PRDC_CLBR_EXTRL_CBK] = GPIO_DEBUG_PRDC_CLBR_EXTRL_CBK, +#endif /* USE_RT_DEBUG_PRDC_CLBR_EXTRL_CBK */ + +#if (USE_RT_DEBUG_PTR_PRDC_ADV_SYNC_CBK == 1) + [RT_DEBUG_PTR_PRDC_ADV_SYNC_CBK] = GPIO_DEBUG_PTR_PRDC_ADV_SYNC_CBK, +#endif /* USE_RT_DEBUG_PTR_PRDC_ADV_SYNC_CBK */ + +#if (USE_RT_DEBUG_NCONN_SCN_CBK == 1) + [RT_DEBUG_NCONN_SCN_CBK] = GPIO_DEBUG_NCONN_SCN_CBK, +#endif /* USE_RT_DEBUG_NCONN_SCN_CBK */ + +#if (USE_RT_DEBUG_NCONN_ADV_CBK == 1) + [RT_DEBUG_NCONN_ADV_CBK] = GPIO_DEBUG_NCONN_ADV_CBK, +#endif /* USE_RT_DEBUG_NCONN_ADV_CBK */ + +#if (USE_RT_DEBUG_NCONN_INIT_CBK == 1) + [RT_DEBUG_NCONN_INIT_CBK] = GPIO_DEBUG_NCONN_INIT_CBK, +#endif /* USE_RT_DEBUG_NCONN_INIT_CBK */ + +#if (USE_RT_DEBUG_ANT_RADIO_CMPLT_EVNT_CBK == 1) + [RT_DEBUG_ANT_RADIO_CMPLT_EVNT_CBK] = GPIO_DEBUG_ANT_RADIO_CMPLT_EVNT_CBK, +#endif /* USE_RT_DEBUG_ANT_RADIO_CMPLT_EVNT_CBK */ + +#if (USE_RT_DEBUG_ANT_STACK_EVNT_CBK == 1) + [RT_DEBUG_ANT_STACK_EVNT_CBK] = GPIO_DEBUG_ANT_STACK_EVNT_CBK, +#endif /* USE_RT_DEBUG_ANT_STACK_EVNT_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_PROCESS_TMOUT_EVNT_CBK == 1) + [RT_DEBUG_ADV_EXT_PROCESS_TMOUT_EVNT_CBK] = GPIO_DEBUG_ADV_EXT_PROCESS_TMOUT_EVNT_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_PROCESS_TMOUT_EVNT_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_SCN_DUR_EVNT == 1) + [RT_DEBUG_ADV_EXT_MNGR_SCN_DUR_EVNT] = GPIO_DEBUG_ADV_EXT_MNGR_SCN_DUR_EVNT, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_SCN_DUR_EVNT */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_SCN_PERIODIC_EVNT == 1) + [RT_DEBUG_ADV_EXT_MNGR_SCN_PERIODIC_EVNT] = GPIO_DEBUG_ADV_EXT_MNGR_SCN_PERIODIC_EVNT, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_SCN_PERIODIC_EVNT */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT == 1) + [RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT] = GPIO_DEBUG_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT == 1) + [RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT] = GPIO_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT */ + +#if (USE_RT_DEBUG_BIS_MNGR_BIG_TERM_CBK == 1) + [RT_DEBUG_BIS_MNGR_BIG_TERM_CBK] = GPIO_DEBUG_BIS_MNGR_BIG_TERM_CBK, +#endif /* USE_RT_DEBUG_BIS_MNGR_BIG_TERM_CBK */ + +#if (USE_RT_DEBUG_BIS_MNGR_SYNC_TMOUT_CBK == 1) + [RT_DEBUG_BIS_MNGR_SYNC_TMOUT_CBK] = GPIO_DEBUG_BIS_MNGR_SYNC_TMOUT_CBK, +#endif /* USE_RT_DEBUG_BIS_MNGR_SYNC_TMOUT_CBK */ + +#if (USE_RT_DEBUG_ISOAL_MNGR_SDU_GEN == 1) + [RT_DEBUG_ISOAL_MNGR_SDU_GEN] = GPIO_DEBUG_ISOAL_MNGR_SDU_GEN, +#endif /* USE_RT_DEBUG_ISOAL_MNGR_SDU_GEN */ + +#if (USE_RT_DEBUG_ISO_MNGR_CIS_PROCESS_EVNT_CBK == 1) + [RT_DEBUG_ISO_MNGR_CIS_PROCESS_EVNT_CBK] = GPIO_DEBUG_ISO_MNGR_CIS_PROCESS_EVNT_CBK, +#endif /* USE_RT_DEBUG_ISO_MNGR_CIS_PROCESS_EVNT_CBK */ + +#if (USE_RT_DEBUG_CONN_MNGR_PROCESS_EVNT_CLBK == 1) + [RT_DEBUG_CONN_MNGR_PROCESS_EVNT_CLBK] = GPIO_DEBUG_CONN_MNGR_PROCESS_EVNT_CLBK, +#endif /* USE_RT_DEBUG_CONN_MNGR_PROCESS_EVNT_CLBK */ + +#if (USE_RT_DEBUG_CONN_MNGR_UPDT_CONN_PARAM_CBK == 1) + [RT_DEBUG_CONN_MNGR_UPDT_CONN_PARAM_CBK] = GPIO_DEBUG_CONN_MNGR_UPDT_CONN_PARAM_CBK, +#endif /* USE_RT_DEBUG_CONN_MNGR_UPDT_CONN_PARAM_CBK */ + +#if (USE_RT_DEBUG_EVNT_SCHDLR_HW_EVNT_CMPLT == 1) + [RT_DEBUG_EVNT_SCHDLR_HW_EVNT_CMPLT] = GPIO_DEBUG_EVNT_SCHDLR_HW_EVNT_CMPLT, +#endif /* USE_RT_DEBUG_EVNT_SCHDLR_HW_EVNT_CMPLT */ + +#if (USE_RT_DEBUG_HCI_EVENT_HNDLR == 1) + [RT_DEBUG_HCI_EVENT_HNDLR] = GPIO_DEBUG_HCI_EVENT_HNDLR, +#endif /* USE_RT_DEBUG_HCI_EVENT_HNDLR */ + +#if (USE_RT_DEBUG_MLME_TMRS_CBK == 1) + [RT_DEBUG_MLME_TMRS_CBK] = GPIO_DEBUG_MLME_TMRS_CBK, +#endif /* USE_RT_DEBUG_MLME_TMRS_CBK */ + +#if (USE_RT_DEBUG_DIRECT_TX_EVNT_CBK == 1) + [RT_DEBUG_DIRECT_TX_EVNT_CBK] = GPIO_DEBUG_DIRECT_TX_EVNT_CBK, +#endif /* USE_RT_DEBUG_DIRECT_TX_EVNT_CBK */ + +#if (USE_RT_DEBUG_INDIRECT_PKT_TOUR_CBK == 1) + [RT_DEBUG_INDIRECT_PKT_TOUR_CBK] = GPIO_DEBUG_INDIRECT_PKT_TOUR_CBK, +#endif /* USE_RT_DEBUG_INDIRECT_PKT_TOUR_CBK */ + +#if (USE_RT_DEBUG_RADIO_CSMA_TMR == 1) + [RT_DEBUG_RADIO_CSMA_TMR] = GPIO_DEBUG_RADIO_CSMA_TMR, +#endif /* USE_RT_DEBUG_RADIO_CSMA_TMR */ + +#if (USE_RT_DEBUG_RAL_SM_DONE_EVNT_CBK == 1) + [RT_DEBUG_RAL_SM_DONE_EVNT_CBK] = GPIO_DEBUG_RAL_SM_DONE_EVNT_CBK, +#endif /* USE_RT_DEBUG_RAL_SM_DONE_EVNT_CBK */ + +#if (USE_RT_DEBUG_ED_TMR_HNDL == 1) + [RT_DEBUG_ED_TMR_HNDL] = GPIO_DEBUG_ED_TMR_HNDL, +#endif /* USE_RT_DEBUG_ED_TMR_HNDL */ + +#if (USE_RT_DEBUG_OS_TMR_EVNT_CBK == 1) + [RT_DEBUG_OS_TMR_EVNT_CBK] = GPIO_DEBUG_OS_TMR_EVNT_CBK, +#endif /* USE_RT_DEBUG_OS_TMR_EVNT_CBK */ + +#if (USE_RT_DEBUG_PROFILE_MARKER_PHY_WAKEUP_TIME == 1) + [RT_DEBUG_PROFILE_MARKER_PHY_WAKEUP_TIME] = GPIO_DEBUG_PROFILE_MARKER_PHY_WAKEUP_TIME, +#endif /* USE_RT_DEBUG_PROFILE_MARKER_PHY_WAKEUP_TIME */ + +#if (USE_RT_DEBUG_PROFILE_END_DRIFT_TIME == 1) + [RT_DEBUG_PROFILE_END_DRIFT_TIME] = GPIO_DEBUG_PROFILE_END_DRIFT_TIME, +#endif /* USE_RT_DEBUG_PROFILE_END_DRIFT_TIME */ + +#if (USE_RT_DEBUG_PROC_RADIO_RCV == 1) + [RT_DEBUG_PROC_RADIO_RCV] = GPIO_DEBUG_PROC_RADIO_RCV, +#endif /* USE_RT_DEBUG_PROC_RADIO_RCV */ + +#if (USE_RT_DEBUG_EVNT_TIME_UPDT == 1) + [RT_DEBUG_EVNT_TIME_UPDT] = GPIO_DEBUG_EVNT_TIME_UPDT, +#endif /* USE_RT_DEBUG_EVNT_TIME_UPDT */ + +#if (USE_RT_DEBUG_MAC_RECEIVE_DONE == 1) + [RT_DEBUG_MAC_RECEIVE_DONE] = GPIO_DEBUG_MAC_RECEIVE_DONE, +#endif /* USE_RT_DEBUG_MAC_RECEIVE_DONE */ + +#if (USE_RT_DEBUG_MAC_TX_DONE == 1) + [RT_DEBUG_MAC_TX_DONE] = GPIO_DEBUG_MAC_TX_DONE, +#endif /* USE_RT_DEBUG_MAC_TX_DONE */ + +#if (USE_RT_DEBUG_RADIO_APPLY_CSMA == 1) + [RT_DEBUG_RADIO_APPLY_CSMA] = GPIO_DEBUG_RADIO_APPLY_CSMA, +#endif /* USE_RT_DEBUG_RADIO_APPLY_CSMA */ + +#if (USE_RT_DEBUG_RADIO_TRANSMIT == 1) + [RT_DEBUG_RADIO_TRANSMIT] = GPIO_DEBUG_RADIO_TRANSMIT, +#endif /* USE_RT_DEBUG_RADIO_TRANSMIT */ + +#if (USE_RT_DEBUG_PROC_RADIO_TX == 1) + [RT_DEBUG_PROC_RADIO_TX] = GPIO_DEBUG_PROC_RADIO_TX, +#endif /* USE_RT_DEBUG_PROC_RADIO_TX */ + +#if (USE_RT_DEBUG_RAL_TX_DONE == 1) + [RT_DEBUG_RAL_TX_DONE] = GPIO_DEBUG_RAL_TX_DONE, +#endif /* USE_RT_DEBUG_RAL_TX_DONE */ + +#if (USE_RT_DEBUG_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT == 1) + [RT_DEBUG_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT] = GPIO_DEBUG_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT, +#endif /* USE_RT_DEBUG_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT */ + +#if (USE_RT_DEBUG_RAL_TX_DONE_RST_BACKOFF_COUNT == 1) + [RT_DEBUG_RAL_TX_DONE_RST_BACKOFF_COUNT] = GPIO_DEBUG_RAL_TX_DONE_RST_BACKOFF_COUNT, +#endif /* USE_RT_DEBUG_RAL_TX_DONE_RST_BACKOFF_COUNT */ + +#if (USE_RT_DEBUG_RAL_CONTINUE_RX == 1) + [RT_DEBUG_RAL_CONTINUE_RX] = GPIO_DEBUG_RAL_CONTINUE_RX, +#endif /* USE_RT_DEBUG_RAL_CONTINUE_RX */ + +#if (USE_RT_DEBUG_RAL_PERFORM_CCA == 1) + [RT_DEBUG_RAL_PERFORM_CCA] = GPIO_DEBUG_RAL_PERFORM_CCA, +#endif /* USE_RT_DEBUG_RAL_PERFORM_CCA */ + +#if (USE_RT_DEBUG_RAL_ENABLE_TRANSMITTER == 1) + [RT_DEBUG_RAL_ENABLE_TRANSMITTER] = GPIO_DEBUG_RAL_ENABLE_TRANSMITTER, +#endif /* USE_RT_DEBUG_RAL_ENABLE_TRANSMITTER */ + +#if (USE_RT_DEBUG_LLHWC_GET_CH_IDX_ALGO_2 == 1) + [RT_DEBUG_LLHWC_GET_CH_IDX_ALGO_2] = GPIO_DEBUG_LLHWC_GET_CH_IDX_ALGO_2, +#endif /* USE_RT_DEBUG_LLHWC_GET_CH_IDX_ALGO_2 */ + +/************************************************/ +/** Application signals in general debug table **/ +/************************************************/ + +#if (USE_RT_DEBUG_APP_APPE_INIT == 1) + [RT_DEBUG_APP_APPE_INIT] = GPIO_DEBUG_APP_APPE_INIT, +#endif /* USE_RT_DEBUG_OS_TMR_EVNT_CBK */ +}; + +#endif /* CFG_RT_DEBUG_GPIO_MODULE */ + +#endif /* DEBUG_CONFIG_H */ diff --git a/lib/stm32wba/hci/debug_signals.h b/lib/stm32wba/hci/debug_signals.h new file mode 100644 index 000000000..ecf1a4522 --- /dev/null +++ b/lib/stm32wba/hci/debug_signals.h @@ -0,0 +1,807 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file debug_signals.h + * @author MCD Application Team + * @brief Real Time Debug module System and Link Layer signal definition + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ +#ifndef DEBUG_SIGNALS_H +#define DEBUG_SIGNALS_H + +#include "bsp.h" + +/**************************************************/ +/** Specific Link Layer debug signals definition **/ +/**************************************************/ +typedef Debug_GPIO_t linklayer_debug_signal_t; + +/**********************************************/ +/** Specific System debug signals definition **/ +/**********************************************/ +typedef enum { + ADC_ACTIVATION, + ADC_DEACTIVATION, + ADC_TEMPERATURE_ACQUISITION, + RNG_ENABLE, + RNG_DISABLE, + RNG_GEN_RAND_NUM, + LOW_POWER_STOP_MODE_ENTER, + LOW_POWER_STOP_MODE_EXIT, + LOW_POWER_STOP_MODE_ACTIVE, + LOW_POWER_STANDBY_MODE_ENTER, + LOW_POWER_STANDBY_MODE_EXIT, + LOW_POWER_STANDBY_MODE_ACTIVE, + SCM_SETUP, + SCM_SYSTEM_CLOCK_CONFIG, + SCM_HSERDY_ISR, +} system_debug_signal_t; + +#if(CFG_RT_DEBUG_GPIO_MODULE == 1) + +/*************************************/ +/** Global debug signals definition **/ +/*************************************/ + +typedef enum { + RT_DEBUG_SIGNAL_UNUSED = 0x0, + +/********************/ +/** System signals **/ +/********************/ + +#if (USE_RT_DEBUG_SCM_SETUP == 1) + RT_DEBUG_SCM_SETUP, +#endif /* USE_RT_DEBUG_SCM_SETUP */ + +#if (USE_RT_DEBUG_SCM_HSERDY_ISR == 1) + RT_DEBUG_SCM_HSERDY_ISR, +#endif /* USE_RT_DEBUG_SCM_HSERDY_ISR */ + +#if (USE_RT_DEBUG_SCM_SYSTEM_CLOCK_CONFIG == 1) + RT_DEBUG_SCM_SYSTEM_CLOCK_CONFIG, +#endif /* USE_RT_DEBUG_SCM_SYSTEM_CLOCK_CONFIG */ + +#if (USE_RT_DEBUG_ADC_ACTIVATION == 1) + RT_DEBUG_ADC_ACTIVATION, +#endif /* USE_RT_DEBUG_ADC_ACTIVATION */ + +#if (USE_RT_DEBUG_ADC_DEACTIVATION == 1) + RT_DEBUG_ADC_DEACTIVATION, +#endif /* USE_RT_DEBUG_ADC_DEACTIVATION */ + +#if (USE_RT_DEBUG_ADC_TEMPERATURE_ACQUISITION == 1) + RT_DEBUG_ADC_TEMPERATURE_ACQUISITION, +#endif /* USE_RT_DEBUG_ADC_TEMPERATURE_ACQUISITION */ + +#if (USE_RT_DEBUG_RNG_ENABLE == 1) + RT_DEBUG_RNG_ENABLE, +#endif /* USE_RT_DEBUG_RNG_ENABLE */ + +#if (USE_RT_DEBUG_RNG_DISABLE == 1) + RT_DEBUG_RNG_DISABLE, +#endif /* USE_RT_DEBUG_RNG_DISABLE */ + +#if (USE_RT_DEBUG_RNG_GEN_RAND_NUM == 1) + RT_DEBUG_RNG_GEN_RAND_NUM, +#endif /* USE_RT_DEBUG_RNG_GEN_RAND_NUM */ + +#if (USE_RT_DEBUG_LOW_POWER_STOP_MODE_ENTER == 1) + RT_DEBUG_LOW_POWER_STOP_MODE_ENTER, +#endif /* USE_RT_DEBUG_LOW_POWER_STOP_MODE_ENTER */ + +#if (USE_RT_DEBUG_LOW_POWER_STOP_MODE_EXIT == 1) + RT_DEBUG_LOW_POWER_STOP_MODE_EXIT, +#endif /* USE_RT_DEBUG_LOW_POWER_STOP_MODE_EXIT */ + +#if (USE_RT_DEBUG_LOW_POWER_STOP_MODE_ACTIVE == 1) + RT_DEBUG_LOW_POWER_STOP_MODE_ACTIVE, +#endif /* USE_RT_DEBUG_LOW_POWER_STOP_MODE_ACTIVE */ + +#if (USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_ENTER == 1) + RT_DEBUG_LOW_POWER_STANDBY_MODE_ENTER, +#endif /* USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_ENTER */ + +#if (USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_EXIT == 1) + RT_DEBUG_LOW_POWER_STANDBY_MODE_EXIT, +#endif /* USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_EXIT */ + +#if (USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_ACTIVE == 1) + RT_DEBUG_LOW_POWER_STANDBY_MODE_ACTIVE, +#endif /* USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_ACTIVE */ + +/************************/ +/** Link Layer signals **/ +/************************/ + +#if (USE_RT_DEBUG_HCI_READ_DONE == 1) + RT_DEBUG_HCI_READ_DONE, +#endif /* USE_RT_DEBUG_HCI_READ_DONE */ + +#if (USE_RT_DEBUG_HCI_RCVD_CMD == 1) + RT_DEBUG_HCI_RCVD_CMD, +#endif /* USE_RT_DEBUG_HCI_RCVD_CMD */ + +#if (USE_RT_DEBUG_HCI_WRITE_DONE == 1) + RT_DEBUG_HCI_WRITE_DONE, +#endif /* USE_RT_DEBUG_HCI_WRITE_DONE */ + +#if (USE_RT_DEBUG_SCHDLR_EVNT_UPDATE == 1) + RT_DEBUG_SCHDLR_EVNT_UPDATE, +#endif /* USE_RT_DEBUG_SCHDLR_EVNT_UPDATE */ + +#if (USE_RT_DEBUG_SCHDLR_TIMER_SET == 1) + RT_DEBUG_SCHDLR_TIMER_SET, +#endif /* USE_RT_DEBUG_SCHDLR_TIMER_SET */ + +#if (USE_RT_DEBUG_SCHDLR_PHY_CLBR_TIMER == 1) + RT_DEBUG_SCHDLR_PHY_CLBR_TIMER, +#endif /* USE_RT_DEBUG_SCHDLR_PHY_CLBR_TIMER */ + +#if (USE_RT_DEBUG_SCHDLR_EVNT_SKIPPED == 1) + RT_DEBUG_SCHDLR_EVNT_SKIPPED, +#endif /* USE_RT_DEBUG_SCHDLR_EVNT_SKIPPED */ + +#if (USE_RT_DEBUG_SCHDLR_HNDL_NXT_TRACE == 1) + RT_DEBUG_SCHDLR_HNDL_NXT_TRACE, +#endif /* USE_RT_DEBUG_SCHDLR_HNDL_NXT_TRACE */ + +#if (USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_DETEDTED == 1) + RT_DEBUG_ACTIVE_SCHDLR_NEAR_DETEDTED, +#endif /* USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_DETEDTED */ + +#if (USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_GAP_CHECK == 1) + RT_DEBUG_ACTIVE_SCHDLR_NEAR_GAP_CHECK, +#endif /* USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_GAP_CHECK */ + +#if (USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_TIME_CHECK == 1) + RT_DEBUG_ACTIVE_SCHDLR_NEAR_TIME_CHECK, +#endif /* USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_TIME_CHECK */ + +#if (USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_TRACE == 1) + RT_DEBUG_ACTIVE_SCHDLR_NEAR_TRACE, +#endif /* USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_TRACE */ + +#if (USE_RT_DEBUG_SCHDLR_EVNT_RGSTR == 1) + RT_DEBUG_SCHDLR_EVNT_RGSTR, +#endif /* USE_RT_DEBUG_SCHDLR_EVNT_RGSTR */ + +#if (USE_RT_DEBUG_SCHDLR_ADD_CONFLICT_Q == 1) + RT_DEBUG_SCHDLR_ADD_CONFLICT_Q, +#endif /* USE_RT_DEBUG_SCHDLR_ADD_CONFLICT_Q */ + +#if (USE_RT_DEBUG_SCHDLR_HNDL_MISSED_EVNT == 1) + RT_DEBUG_SCHDLR_HNDL_MISSED_EVNT, +#endif /* USE_RT_DEBUG_SCHDLR_HNDL_MISSED_EVNT */ + +#if (USE_RT_DEBUG_SCHDLR_UNRGSTR_EVNT == 1) + RT_DEBUG_SCHDLR_UNRGSTR_EVNT, +#endif /* USE_RT_DEBUG_SCHDLR_UNRGSTR_EVNT */ + +#if (USE_RT_DEBUG_SCHDLR_EXEC_EVNT_TRACE == 1) + RT_DEBUG_SCHDLR_EXEC_EVNT_TRACE, +#endif /* USE_RT_DEBUG_SCHDLR_EXEC_EVNT_TRACE */ + +#if (USE_RT_DEBUG_SCHDLR_EXEC_EVNT_PROFILE == 1) + RT_DEBUG_SCHDLR_EXEC_EVNT_PROFILE, +#endif /* USE_RT_DEBUG_SCHDLR_EXEC_EVNT_PROFILE */ + +#if (USE_RT_DEBUG_SCHDLR_EXEC_EVNT_ERROR == 1) + RT_DEBUG_SCHDLR_EXEC_EVNT_ERROR, +#endif /* USE_RT_DEBUG_SCHDLR_EXEC_EVNT_ERROR */ + +#if (USE_RT_DEBUG_SCHDLR_EXEC_EVNT_WINDOW_WIDENING == 1) + RT_DEBUG_SCHDLR_EXEC_EVNT_WINDOW_WIDENING, +#endif /* USE_RT_DEBUG_SCHDLR_EXEC_EVNT_WINDOW_WIDENING */ + +#if (USE_RT_DEBUG_LLHWC_CMN_CLR_ISR == 1) + RT_DEBUG_LLHWC_CMN_CLR_ISR, +#endif /* USE_RT_DEBUG_LLHWC_CMN_CLR_ISR */ + +#if (USE_RT_DEBUG_LLWCC_CMN_HG_ISR == 1) + RT_DEBUG_LLWCC_CMN_HG_ISR, +#endif /* USE_RT_DEBUG_LLWCC_CMN_HG_ISR */ + +#if (USE_RT_DEBUG_LLHWC_CMN_LW_ISR == 1) + RT_DEBUG_LLHWC_CMN_LW_ISR, +#endif /* USE_RT_DEBUG_LLHWC_CMN_LW_ISR */ + +#if (USE_RT_DEBUG_LLHWC_CMN_CLR_TIMER_ERROR == 1) + RT_DEBUG_LLHWC_CMN_CLR_TIMER_ERROR, +#endif /* USE_RT_DEBUG_LLHWC_CMN_CLR_TIMER_ERROR */ + +#if (USE_RT_DEBUG_LLHWC_LL_ISR == 1) + RT_DEBUG_LLHWC_LL_ISR, +#endif /* USE_RT_DEBUG_LLHWC_LL_ISR */ + +#if (USE_RT_DEBUG_LLHWC_SPLTMR_SET == 1) + RT_DEBUG_LLHWC_SPLTMR_SET, +#endif /* USE_RT_DEBUG_LLHWC_SPLTMR_SET */ + +#if (USE_RT_DEBUG_LLHWC_SPLTMR_GET == 1) + RT_DEBUG_LLHWC_SPLTMR_GET, +#endif /* USE_RT_DEBUG_LLHWC_SPLTMR_GET */ + +#if (USE_RT_DEBUG_LLHWC_LOW_ISR == 1) + RT_DEBUG_LLHWC_LOW_ISR, +#endif /* USE_RT_DEBUG_LLHWC_LOW_ISR */ + +#if (USE_RT_DEBUG_LLHWC_STOP_SCN == 1) + RT_DEBUG_LLHWC_STOP_SCN, +#endif /* USE_RT_DEBUG_LLHWC_STOP_SCN */ + +#if (USE_RT_DEBUG_LLHWC_WAIT_ENVT_ON_AIR == 1) + RT_DEBUG_LLHWC_WAIT_ENVT_ON_AIR, +#endif /* USE_RT_DEBUG_LLHWC_WAIT_ENVT_ON_AIR */ + +#if (USE_RT_DEBUG_LLHWC_SET_CONN_EVNT_PARAM == 1) + RT_DEBUG_LLHWC_SET_CONN_EVNT_PARAM, +#endif /* USE_RT_DEBUG_LLHWC_SET_CONN_EVNT_PARAM */ + +#if (USE_RT_DEBUG_POST_EVNT == 1) + RT_DEBUG_POST_EVNT, +#endif /* USE_RT_DEBUG_POST_EVNT */ + +#if (USE_RT_DEBUG_HNDL_ALL_EVNTS == 1) + RT_DEBUG_HNDL_ALL_EVNTS, +#endif /* USE_RT_DEBUG_HNDL_ALL_EVNTS */ + +#if (USE_RT_DEBUG_PROCESS_EVNT == 1) + RT_DEBUG_PROCESS_EVNT, +#endif /* USE_RT_DEBUG_PROCESS_EVNT */ + +#if (USE_RT_DEBUG_PROCESS_ISO_DATA == 1) + RT_DEBUG_PROCESS_ISO_DATA, +#endif /* USE_RT_DEBUG_PROCESS_ISO_DATA */ + +#if (USE_RT_DEBUG_ALLOC_TX_ISO_EMPTY_PKT == 1) + RT_DEBUG_ALLOC_TX_ISO_EMPTY_PKT, +#endif /* USE_RT_DEBUG_ALLOC_TX_ISO_EMPTY_PKT */ + +#if (USE_RT_DEBUG_BIG_FREE_EMPTY_PKTS == 1) + RT_DEBUG_BIG_FREE_EMPTY_PKTS, +#endif /* USE_RT_DEBUG_BIG_FREE_EMPTY_PKTS */ + +#if (USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_OK == 1) + RT_DEBUG_RECOMBINE_UNFRMD_DATA_OK, +#endif /* USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_OK */ + +#if (USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_CRC == 1) + RT_DEBUG_RECOMBINE_UNFRMD_DATA_CRC, +#endif /* USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_CRC */ + +#if (USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_NoRX == 1) + RT_DEBUG_RECOMBINE_UNFRMD_DATA_NoRX, +#endif /* USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_NoRX */ + +#if (USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_TRACE == 1) + RT_DEBUG_RECOMBINE_UNFRMD_DATA_TRACE, +#endif /* USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_TRACE */ + +#if (USE_RT_DEBUG_ISO_HNDL_SDU == 1) + RT_DEBUG_ISO_HNDL_SDU, +#endif /* USE_RT_DEBUG_ISO_HNDL_SDU */ + +#if (USE_RT_DEBUG_LL_INTF_INIT == 1) + RT_DEBUG_LL_INTF_INIT, +#endif /* USE_RT_DEBUG_LL_INTF_INIT */ + +#if (USE_RT_DEBUG_DATA_TO_CNTRLR == 1) + RT_DEBUG_DATA_TO_CNTRLR, +#endif /* USE_RT_DEBUG_DATA_TO_CNTRLR */ + +#if (USE_RT_DEBUG_FREE_LL_PKT_HNDLR == 1) + RT_DEBUG_FREE_LL_PKT_HNDLR, +#endif /* USE_RT_DEBUG_FREE_LL_PKT_HNDLR */ + +#if (USE_RT_DEBUG_PHY_INIT_CLBR_TRACE == 1) + RT_DEBUG_PHY_INIT_CLBR_TRACE, +#endif /* USE_RT_DEBUG_PHY_INIT_CLBR_TRACE */ + +#if (USE_RT_DEBUG_PHY_RUNTIME_CLBR_TRACE == 1) + RT_DEBUG_PHY_RUNTIME_CLBR_TRACE, +#endif /* USE_RT_DEBUG_PHY_RUNTIME_CLBR_TRACE */ + +#if (USE_RT_DEBUG_PHY_CLBR_ISR == 1) + RT_DEBUG_PHY_CLBR_ISR, +#endif /* USE_RT_DEBUG_PHY_CLBR_ISR */ + +#if (USE_RT_DEBUG_PHY_INIT_CLBR_SINGLE_CH == 1) + RT_DEBUG_PHY_INIT_CLBR_SINGLE_CH, +#endif /* USE_RT_DEBUG_PHY_INIT_CLBR_SINGLE_CH */ + +#if (USE_RT_DEBUG_PHY_CLBR_STRTD == 1) + RT_DEBUG_PHY_CLBR_STRTD, +#endif /* USE_RT_DEBUG_PHY_CLBR_STRTD */ + +#if (USE_RT_DEBUG_PHY_CLBR_EXEC == 1) + RT_DEBUG_PHY_CLBR_EXEC, +#endif /* USE_RT_DEBUG_PHY_CLBR_EXEC */ + +#if (USE_RT_DEBUG_RCO_STRT_STOP_RUNTIME_CLBR_ACTV == 1) + RT_DEBUG_RCO_STRT_STOP_RUNTIME_CLBR_ACTV, +#endif /* USE_RT_DEBUG_RCO_STRT_STOP_RUNTIME_CLBR_ACTV */ + +#if (USE_RT_DEBUG_RCO_STRT_STOP_RUNTIME_RCO_CLBR == 1) + RT_DEBUG_RCO_STRT_STOP_RUNTIME_RCO_CLBR, +#endif /* USE_RT_DEBUG_RCO_STRT_STOP_RUNTIME_RCO_CLBR */ + +#if (USE_RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_SWT == 1) + RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_SWT, +#endif /* USE_RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_SWT */ + +#if (USE_RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_TRACE == 1) + RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_TRACE, +#endif /* USE_RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_TRACE */ + +#if (USE_RT_DEBUG_RCO_ISR_TRACE == 1) + RT_DEBUG_RCO_ISR_TRACE, +#endif /* USE_RT_DEBUG_RCO_ISR_TRACE */ + +#if (USE_RT_DEBUG_RCO_ISR_COMPENDATE == 1) + RT_DEBUG_RCO_ISR_COMPENDATE, +#endif /* USE_RT_DEBUG_RCO_ISR_COMPENDATE */ + +#if (USE_RT_DEBUG_RAL_STRT_TX == 1) + RT_DEBUG_RAL_STRT_TX, +#endif /* USE_RT_DEBUG_RAL_STRT_TX */ + +#if (USE_RT_DEBUG_RAL_ISR_TIMER_ERROR == 1) + RT_DEBUG_RAL_ISR_TIMER_ERROR, +#endif /* USE_RT_DEBUG_RAL_ISR_TIMER_ERROR */ + +#if (USE_RT_DEBUG_RAL_ISR_TRACE == 1) + RT_DEBUG_RAL_ISR_TRACE, +#endif /* USE_RT_DEBUG_RAL_ISR_TRACE */ + +#if (USE_RT_DEBUG_RAL_STOP_OPRTN == 1) + RT_DEBUG_RAL_STOP_OPRTN, +#endif /* USE_RT_DEBUG_RAL_STOP_OPRTN */ + +#if (USE_RT_DEBUG_RAL_STRT_RX == 1) + RT_DEBUG_RAL_STRT_RX, +#endif /* USE_RT_DEBUG_RAL_STRT_RX */ + +#if (USE_RT_DEBUG_RAL_DONE_CLBK_TX == 1) + RT_DEBUG_RAL_DONE_CLBK_TX, +#endif /* USE_RT_DEBUG_RAL_DONE_CLBK_TX */ + +#if (USE_RT_DEBUG_RAL_DONE_CLBK_RX == 1) + RT_DEBUG_RAL_DONE_CLBK_RX, +#endif /* USE_RT_DEBUG_RAL_DONE_CLBK_RX */ + +#if (USE_RT_DEBUG_RAL_DONE_CLBK_ED == 1) + RT_DEBUG_RAL_DONE_CLBK_ED, +#endif /* USE_RT_DEBUG_RAL_DONE_CLBK_ED */ + +#if (USE_RT_DEBUG_RAL_ED_SCAN == 1) + RT_DEBUG_RAL_ED_SCAN, +#endif /* USE_RT_DEBUG_RAL_ED_SCAN */ + +#if (USE_RT_DEBUG_ERROR_MEM_CAP_EXCED == 1) + RT_DEBUG_ERROR_MEM_CAP_EXCED, +#endif /* USE_RT_DEBUG_ERROR_MEM_CAP_EXCED */ + +#if (USE_RT_DEBUG_ERROR_COMMAND_DISALLOWED == 1) + RT_DEBUG_ERROR_COMMAND_DISALLOWED, +#endif /* USE_RT_DEBUG_ERROR_COMMAND_DISALLOWED */ + +#if (USE_RT_DEBUG_PTA_INIT == 1) + RT_DEBUG_PTA_INIT, +#endif /* USE_RT_DEBUG_PTA_INIT */ + +#if (USE_RT_DEBUG_PTA_EN == 1) + RT_DEBUG_PTA_EN, +#endif /* USE_RT_DEBUG_PTA_EN */ + +#if (USE_RT_DEBUG_LLHWC_PTA_SET_EN == 1) + RT_DEBUG_LLHWC_PTA_SET_EN, +#endif /* USE_RT_DEBUG_LLHWC_PTA_SET_EN */ + +#if (USE_RT_DEBUG_LLHWC_PTA_SET_PARAMS == 1) + RT_DEBUG_LLHWC_PTA_SET_PARAMS, +#endif /* USE_RT_DEBUG_LLHWC_PTA_SET_PARAMS */ + +#if (USE_RT_DEBUG_COEX_STRT_ON_IDLE == 1) + RT_DEBUG_COEX_STRT_ON_IDLE, +#endif /* USE_RT_DEBUG_COEX_STRT_ON_IDLE */ + +#if (USE_RT_DEBUG_COEX_ASK_FOR_AIR == 1) + RT_DEBUG_COEX_ASK_FOR_AIR, +#endif /* USE_RT_DEBUG_COEX_ASK_FOR_AIR */ + +#if (USE_RT_DEBUG_COEX_TIMER_EVNT_CLBK == 1) + RT_DEBUG_COEX_TIMER_EVNT_CLBK, +#endif /* USE_RT_DEBUG_COEX_TIMER_EVNT_CLBK */ + +#if (USE_RT_DEBUG_COEX_STRT_ONE_SHOT == 1) + RT_DEBUG_COEX_STRT_ONE_SHOT, +#endif /* USE_RT_DEBUG_COEX_STRT_ONE_SHOT */ + +#if (USE_RT_DEBUG_COEX_FORCE_STOP_RX == 1) + RT_DEBUG_COEX_FORCE_STOP_RX, +#endif /* USE_RT_DEBUG_COEX_FORCE_STOP_RX */ + +#if (USE_RT_DEBUG_LLHWC_ADV_DONE == 1) + RT_DEBUG_LLHWC_ADV_DONE, +#endif /* USE_RT_DEBUG_LLHWC_ADV_DONE */ + +#if (USE_RT_DEBUG_LLHWC_SCN_DONE == 1) + RT_DEBUG_LLHWC_SCN_DONE, +#endif /* USE_RT_DEBUG_LLHWC_SCN_DONE */ + +#if (USE_RT_DEBUG_LLHWC_INIT_DONE == 1) + RT_DEBUG_LLHWC_INIT_DONE, +#endif /* USE_RT_DEBUG_LLHWC_INIT_DONE */ + +#if (USE_RT_DEBUG_LLHWC_CONN_DONE == 1) + RT_DEBUG_LLHWC_CONN_DONE, +#endif /* USE_RT_DEBUG_LLHWC_CONN_DONE */ + +#if (USE_RT_DEBUG_LLHWC_CIG_DONE == 1) + RT_DEBUG_LLHWC_CIG_DONE, +#endif /* USE_RT_DEBUG_LLHWC_CIG_DONE */ + +#if (USE_RT_DEBUG_LLHWC_BIG_DONE == 1) + RT_DEBUG_LLHWC_BIG_DONE, +#endif /* USE_RT_DEBUG_LLHWC_BIG_DONE */ + +#if (USE_RT_DEBUG_OS_TMR_CREATE == 1) + RT_DEBUG_OS_TMR_CREATE, +#endif /* USE_RT_DEBUG_OS_TMR_CREATE */ + +#if (USE_RT_DEBUG_ADV_EXT_TIMEOUT_CBK == 1) + RT_DEBUG_ADV_EXT_TIMEOUT_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_TIMEOUT_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_SCN_DUR_CBK == 1) + RT_DEBUG_ADV_EXT_SCN_DUR_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_SCN_DUR_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_SCN_PERIOD_CBK == 1) + RT_DEBUG_ADV_EXT_SCN_PERIOD_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_SCN_PERIOD_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_PRDC_SCN_TIMEOUT_CBK == 1) + RT_DEBUG_ADV_EXT_PRDC_SCN_TIMEOUT_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_PRDC_SCN_TIMEOUT_CBK */ + +#if (USE_RT_DEBUG_BIS_SYNC_TIMEOUT_TMR_CBK == 1) + RT_DEBUG_BIS_SYNC_TIMEOUT_TMR_CBK, +#endif /* USE_RT_DEBUG_BIS_SYNC_TIMEOUT_TMR_CBK */ + +#if (USE_RT_DEBUG_BIS_TERM_TMR_CBK == 1) + RT_DEBUG_BIS_TERM_TMR_CBK, +#endif /* USE_RT_DEBUG_BIS_TERM_TMR_CBK */ + +#if (USE_RT_DEBUG_BIS_TST_MODE_CBK == 1) + RT_DEBUG_BIS_TST_MODE_CBK, +#endif /* USE_RT_DEBUG_BIS_TST_MODE_CBK */ + +#if (USE_RT_DEBUG_BIS_TST_MODE_TMR_CBK == 1) + RT_DEBUG_BIS_TST_MODE_TMR_CBK, +#endif /* USE_RT_DEBUG_BIS_TST_MODE_TMR_CBK */ + +#if (USE_RT_DEBUG_ISO_POST_TMR_CBK == 1) + RT_DEBUG_ISO_POST_TMR_CBK, +#endif /* USE_RT_DEBUG_ISO_POST_TMR_CBK */ + +#if (USE_RT_DEBUG_ISO_TST_MODE_TMR_CBK == 1) + RT_DEBUG_ISO_TST_MODE_TMR_CBK, +#endif /* USE_RT_DEBUG_ISO_TST_MODE_TMR_CBK */ + +#if (USE_RT_DEBUG_CONN_POST_TMR_CBK == 1) + RT_DEBUG_CONN_POST_TMR_CBK, +#endif /* USE_RT_DEBUG_CONN_POST_TMR_CBK */ + +#if (USE_RT_DEBUG_EVNT_SCHDLR_TMR_CBK == 1) + RT_DEBUG_EVNT_SCHDLR_TMR_CBK, +#endif /* USE_RT_DEBUG_EVNT_SCHDLR_TMR_CBK */ + +#if (USE_RT_DEBUG_HCI_POST_TMR_CBK == 1) + RT_DEBUG_HCI_POST_TMR_CBK, +#endif /* USE_RT_DEBUG_HCI_POST_TMR_CBK */ + +#if (USE_RT_DEBUG_LLCP_POST_TMR_CBK == 1) + RT_DEBUG_LLCP_POST_TMR_CBK, +#endif /* USE_RT_DEBUG_LLCP_POST_TMR_CBK */ + +#if (USE_RT_DEBUG_LLHWC_ENRGY_DETECT_CBK == 1) + RT_DEBUG_LLHWC_ENRGY_DETECT_CBK, +#endif /* USE_RT_DEBUG_LLHWC_ENRGY_DETECT_CBK */ + +#if (USE_RT_DEBUG_PRVCY_POST_TMR_CBK == 1) + RT_DEBUG_PRVCY_POST_TMR_CBK, +#endif /* USE_RT_DEBUG_PRVCY_POST_TMR_CBK */ + +#if (USE_RT_DEBUG_ANT_PRPR_TMR_CBK == 1) + RT_DEBUG_ANT_PRPR_TMR_CBK, +#endif /* USE_RT_DEBUG_ANT_PRPR_TMR_CBK */ + +#if (USE_RT_DEBUG_COEX_TMR_FRC_STOP_AIR_GRANT_CBK == 1) + RT_DEBUG_COEX_TMR_FRC_STOP_AIR_GRANT_CBK, +#endif /* USE_RT_DEBUG_COEX_TMR_FRC_STOP_AIR_GRANT_CBK */ + +#if (USE_RT_DEBUG_MLME_RX_EN_TMR_CBK == 1) + RT_DEBUG_MLME_RX_EN_TMR_CBK, +#endif /* USE_RT_DEBUG_MLME_RX_EN_TMR_CBK */ + +#if (USE_RT_DEBUG_MLME_GNRC_TMR_CBK == 1) + RT_DEBUG_MLME_GNRC_TMR_CBK, +#endif /* USE_RT_DEBUG_MLME_GNRC_TMR_CBK */ + +#if (USE_RT_DEBUG_MIB_JOIN_LST_TMR_CBK == 1) + RT_DEBUG_MIB_JOIN_LST_TMR_CBK, +#endif /* USE_RT_DEBUG_MIB_JOIN_LST_TMR_CBK */ + +#if (USE_RT_DEBUG_MLME_PWR_PRES_TMR_CBK == 1) + RT_DEBUG_MLME_PWR_PRES_TMR_CBK, +#endif /* USE_RT_DEBUG_MLME_PWR_PRES_TMR_CBK */ + +#if (USE_RT_DEBUG_PRESISTENCE_TMR_CBK == 1) + RT_DEBUG_PRESISTENCE_TMR_CBK, +#endif /* USE_RT_DEBUG_PRESISTENCE_TMR_CBK */ + +#if (USE_RT_DEBUG_RADIO_PHY_PRDC_CLBK_TMR_CBK == 1) + RT_DEBUG_RADIO_PHY_PRDC_CLBK_TMR_CBK, +#endif /* USE_RT_DEBUG_RADIO_PHY_PRDC_CLBK_TMR_CBK */ + +#if (USE_RT_DEBUG_RADIO_CSMA_TMR_CBK == 1) + RT_DEBUG_RADIO_CSMA_TMR_CBK, +#endif /* USE_RT_DEBUG_RADIO_CSMA_TMR_CBK */ + +#if (USE_RT_DEBUG_RADIO_CSL_RCV_TMR_CBK == 1) + RT_DEBUG_RADIO_CSL_RCV_TMR_CBK, +#endif /* USE_RT_DEBUG_RADIO_CSL_RCV_TMR_CBK */ + +#if (USE_RT_DEBUG_ED_TMR_CBK == 1) + RT_DEBUG_ED_TMR_CBK, +#endif /* USE_RT_DEBUG_ED_TMR_CBK */ + +#if (USE_RT_DEBUG_DIO_EXT_TMR_CBK == 1) + RT_DEBUG_DIO_EXT_TMR_CBK, +#endif /* USE_RT_DEBUG_DIO_EXT_TMR_CBK */ + +#if (USE_RT_DEBUG_RCO_CLBR_TMR_CBK == 1) + RT_DEBUG_RCO_CLBR_TMR_CBK, +#endif /* USE_RT_DEBUG_RCO_CLBR_TMR_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_ADV_CBK == 1) + RT_DEBUG_ADV_EXT_MNGR_ADV_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_ADV_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_SCN_CBK == 1) + RT_DEBUG_ADV_EXT_MNGR_SCN_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_SCN_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_SCN_ERR_CBK == 1) + RT_DEBUG_ADV_EXT_MNGR_SCN_ERR_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_SCN_ERR_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CBK == 1) + RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK == 1) + RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK */ + +#if (USE_RT_DEBUG_BIG_ADV_CBK == 1) + RT_DEBUG_BIG_ADV_CBK, +#endif /* USE_RT_DEBUG_BIG_ADV_CBK */ + +#if (USE_RT_DEBUG_BIG_ADV_ERR_CBK == 1) + RT_DEBUG_BIG_ADV_ERR_CBK, +#endif /* USE_RT_DEBUG_BIG_ADV_ERR_CBK */ + +#if (USE_RT_DEBUG_BIG_SYNC_CBK == 1) + RT_DEBUG_BIG_SYNC_CBK, +#endif /* USE_RT_DEBUG_BIG_SYNC_CBK */ + +#if (USE_RT_DEBUG_BIG_SYNC_ERR_CBK == 1) + RT_DEBUG_BIG_SYNC_ERR_CBK, +#endif /* USE_RT_DEBUG_BIG_SYNC_ERR_CBK */ + +#if (USE_RT_DEBUG_ISO_CIS_PKT_TRNSM_RECEIVED_CBK == 1) + RT_DEBUG_ISO_CIS_PKT_TRNSM_RECEIVED_CBK, +#endif /* USE_RT_DEBUG_ISO_CIS_PKT_TRNSM_RECEIVED_CBK */ + +#if (USE_RT_DEBUG_ISO_CIG_ERR_CBK == 1) + RT_DEBUG_ISO_CIG_ERR_CBK, +#endif /* USE_RT_DEBUG_ISO_CIG_ERR_CBK */ + +#if (USE_RT_DEBUG_CONN_PKT_TRNSM_RECEIVED_CBK == 1) + RT_DEBUG_CONN_PKT_TRNSM_RECEIVED_CBK, +#endif /* USE_RT_DEBUG_CONN_PKT_TRNSM_RECEIVED_CBK */ + +#if (USE_RT_DEBUG_PRDC_CLBR_EXTRL_CBK == 1) + RT_DEBUG_PRDC_CLBR_EXTRL_CBK, +#endif /* USE_RT_DEBUG_PRDC_CLBR_EXTRL_CBK */ + +#if (USE_RT_DEBUG_PTR_PRDC_ADV_SYNC_CBK == 1) + RT_DEBUG_PTR_PRDC_ADV_SYNC_CBK, +#endif /* USE_RT_DEBUG_PTR_PRDC_ADV_SYNC_CBK */ + +#if (USE_RT_DEBUG_NCONN_SCN_CBK == 1) + RT_DEBUG_NCONN_SCN_CBK, +#endif /* USE_RT_DEBUG_NCONN_SCN_CBK */ + +#if (USE_RT_DEBUG_NCONN_ADV_CBK == 1) + RT_DEBUG_NCONN_ADV_CBK, +#endif /* USE_RT_DEBUG_NCONN_ADV_CBK */ + +#if (USE_RT_DEBUG_NCONN_INIT_CBK == 1) + RT_DEBUG_NCONN_INIT_CBK, +#endif /* USE_RT_DEBUG_NCONN_INIT_CBK */ + +#if (USE_RT_DEBUG_ANT_RADIO_CMPLT_EVNT_CBK == 1) + RT_DEBUG_ANT_RADIO_CMPLT_EVNT_CBK, +#endif /* USE_RT_DEBUG_ANT_RADIO_CMPLT_EVNT_CBK */ + +#if (USE_RT_DEBUG_ANT_STACK_EVNT_CBK == 1) + RT_DEBUG_ANT_STACK_EVNT_CBK, +#endif /* USE_RT_DEBUG_ANT_STACK_EVNT_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_PROCESS_TMOUT_EVNT_CBK == 1) + RT_DEBUG_ADV_EXT_PROCESS_TMOUT_EVNT_CBK, +#endif /* USE_RT_DEBUG_ADV_EXT_PROCESS_TMOUT_EVNT_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_SCN_DUR_EVNT == 1) + RT_DEBUG_ADV_EXT_MNGR_SCN_DUR_EVNT, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_SCN_DUR_EVNT */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_SCN_PERIODIC_EVNT == 1) + RT_DEBUG_ADV_EXT_MNGR_SCN_PERIODIC_EVNT, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_SCN_PERIODIC_EVNT */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT == 1) + RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT == 1) + RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT */ + +#if (USE_RT_DEBUG_BIS_MNGR_BIG_TERM_CBK == 1) + RT_DEBUG_BIS_MNGR_BIG_TERM_CBK, +#endif /* USE_RT_DEBUG_BIS_MNGR_BIG_TERM_CBK */ + +#if (USE_RT_DEBUG_BIS_MNGR_SYNC_TMOUT_CBK == 1) + RT_DEBUG_BIS_MNGR_SYNC_TMOUT_CBK, +#endif /* USE_RT_DEBUG_BIS_MNGR_SYNC_TMOUT_CBK */ + +#if (USE_RT_DEBUG_ISOAL_MNGR_SDU_GEN == 1) + RT_DEBUG_ISOAL_MNGR_SDU_GEN, +#endif /* USE_RT_DEBUG_ISOAL_MNGR_SDU_GEN */ + +#if (USE_RT_DEBUG_ISO_MNGR_CIS_PROCESS_EVNT_CBK == 1) + RT_DEBUG_ISO_MNGR_CIS_PROCESS_EVNT_CBK, +#endif /* USE_RT_DEBUG_ISO_MNGR_CIS_PROCESS_EVNT_CBK */ + +#if (USE_RT_DEBUG_CONN_MNGR_PROCESS_EVNT_CLBK == 1) + RT_DEBUG_CONN_MNGR_PROCESS_EVNT_CLBK, +#endif /* USE_RT_DEBUG_CONN_MNGR_PROCESS_EVNT_CLBK */ + +#if (USE_RT_DEBUG_CONN_MNGR_UPDT_CONN_PARAM_CBK == 1) + RT_DEBUG_CONN_MNGR_UPDT_CONN_PARAM_CBK, +#endif /* USE_RT_DEBUG_CONN_MNGR_UPDT_CONN_PARAM_CBK */ + +#if (USE_RT_DEBUG_EVNT_SCHDLR_HW_EVNT_CMPLT == 1) + RT_DEBUG_EVNT_SCHDLR_HW_EVNT_CMPLT, +#endif /* USE_RT_DEBUG_EVNT_SCHDLR_HW_EVNT_CMPLT */ + +#if (USE_RT_DEBUG_HCI_EVENT_HNDLR == 1) + RT_DEBUG_HCI_EVENT_HNDLR, +#endif /* USE_RT_DEBUG_HCI_EVENT_HNDLR */ + +#if (USE_RT_DEBUG_MLME_TMRS_CBK == 1) + RT_DEBUG_MLME_TMRS_CBK, +#endif /* USE_RT_DEBUG_MLME_TMRS_CBK */ + +#if (USE_RT_DEBUG_DIRECT_TX_EVNT_CBK == 1) + RT_DEBUG_DIRECT_TX_EVNT_CBK, +#endif /* USE_RT_DEBUG_DIRECT_TX_EVNT_CBK */ + +#if (USE_RT_DEBUG_INDIRECT_PKT_TOUR_CBK == 1) + RT_DEBUG_INDIRECT_PKT_TOUR_CBK, +#endif /* USE_RT_DEBUG_INDIRECT_PKT_TOUR_CBK */ + +#if (USE_RT_DEBUG_RADIO_CSMA_TMR == 1) + RT_DEBUG_RADIO_CSMA_TMR, +#endif /* USE_RT_DEBUG_RADIO_CSMA_TMR */ + +#if (USE_RT_DEBUG_RAL_SM_DONE_EVNT_CBK == 1) + RT_DEBUG_RAL_SM_DONE_EVNT_CBK, +#endif /* USE_RT_DEBUG_RAL_SM_DONE_EVNT_CBK */ + +#if (USE_RT_DEBUG_ED_TMR_HNDL == 1) + RT_DEBUG_ED_TMR_HNDL, +#endif /* USE_RT_DEBUG_ED_TMR_HNDL */ + +#if (USE_RT_DEBUG_OS_TMR_EVNT_CBK == 1) + RT_DEBUG_OS_TMR_EVNT_CBK, +#endif /* USE_RT_DEBUG_OS_TMR_EVNT_CBK */ + +#if (USE_RT_DEBUG_PROFILE_MARKER_PHY_WAKEUP_TIME == 1) + RT_DEBUG_PROFILE_MARKER_PHY_WAKEUP_TIME, +#endif /* USE_RT_DEBUG_PROFILE_MARKER_PHY_WAKEUP_TIME */ + +#if (USE_RT_DEBUG_PROFILE_END_DRIFT_TIME == 1) + RT_DEBUG_PROFILE_END_DRIFT_TIME, +#endif /* USE_RT_DEBUG_PROFILE_END_DRIFT_TIME */ + +#if (USE_RT_DEBUG_PROC_RADIO_RCV == 1) + RT_DEBUG_PROC_RADIO_RCV, +#endif /* USE_RT_DEBUG_PROC_RADIO_RCV */ + +#if (USE_RT_DEBUG_EVNT_TIME_UPDT == 1) + RT_DEBUG_EVNT_TIME_UPDT, +#endif /* USE_RT_DEBUG_EVNT_TIME_UPDT */ + +#if (USE_RT_DEBUG_MAC_RECEIVE_DONE == 1) + RT_DEBUG_MAC_RECEIVE_DONE, +#endif /* USE_RT_DEBUG_MAC_RECEIVE_DONE */ + +#if (USE_RT_DEBUG_MAC_TX_DONE == 1) + RT_DEBUG_MAC_TX_DONE, +#endif /* USE_RT_DEBUG_MAC_TX_DONE */ + +#if (USE_RT_DEBUG_RADIO_APPLY_CSMA == 1) + RT_DEBUG_RADIO_APPLY_CSMA, +#endif /* USE_RT_DEBUG_RADIO_APPLY_CSMA */ + +#if (USE_RT_DEBUG_RADIO_TRANSMIT == 1) + RT_DEBUG_RADIO_TRANSMIT, +#endif /* USE_RT_DEBUG_RADIO_TRANSMIT */ + +#if (USE_RT_DEBUG_PROC_RADIO_TX == 1) + RT_DEBUG_PROC_RADIO_TX, +#endif /* USE_RT_DEBUG_PROC_RADIO_TX */ + +#if (USE_RT_DEBUG_RAL_TX_DONE == 1) + RT_DEBUG_RAL_TX_DONE, +#endif /* USE_RT_DEBUG_RAL_TX_DONE */ + +#if (USE_RT_DEBUG_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT == 1) + RT_DEBUG_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT, +#endif /* USE_RT_DEBUG_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT */ + +#if (USE_RT_DEBUG_RAL_TX_DONE_RST_BACKOFF_COUNT == 1) + RT_DEBUG_RAL_TX_DONE_RST_BACKOFF_COUNT, +#endif /* USE_RT_DEBUG_RAL_TX_DONE_RST_BACKOFF_COUNT */ + +#if (USE_RT_DEBUG_RAL_CONTINUE_RX == 1) + RT_DEBUG_RAL_CONTINUE_RX, +#endif /* USE_RT_DEBUG_RAL_CONTINUE_RX */ + +#if (USE_RT_DEBUG_RAL_PERFORM_CCA == 1) + RT_DEBUG_RAL_PERFORM_CCA, +#endif /* USE_RT_DEBUG_RAL_PERFORM_CCA */ + +#if (USE_RT_DEBUG_RAL_ENABLE_TRANSMITTER == 1) + RT_DEBUG_RAL_ENABLE_TRANSMITTER, +#endif /* USE_RT_DEBUG_RAL_ENABLE_TRANSMITTER */ + +#if (USE_RT_DEBUG_LLHWC_GET_CH_IDX_ALGO_2 == 1) + RT_DEBUG_LLHWC_GET_CH_IDX_ALGO_2, +#endif /* USE_RT_DEBUG_LLHWC_GET_CH_IDX_ALGO_2 */ + +#include "app_debug_signal_def.h" + + RT_DEBUG_SIGNALS_TOTAL_NUM +} rt_debug_signal_t; + +#endif /* CFG_RT_DEBUG_GPIO_MODULE */ + +#endif /* DEBUG_SIGNALS_H */ diff --git a/lib/stm32wba/hci/hw.h b/lib/stm32wba/hci/hw.h new file mode 100644 index 000000000..7329492de --- /dev/null +++ b/lib/stm32wba/hci/hw.h @@ -0,0 +1,486 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file hw.h + * @author MCD Application Team + * @brief This file contains the interface of STM32 HW drivers. + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +#ifndef HW_H__ +#define HW_H__ + +#include "stm32wbaxx.h" + +/* --------------------------------------------------------------------------- + * General + * --------------------------------------------------------------------------- + */ + +#ifndef CFG_HW_ERROR_OFFSET +#define CFG_HW_ERROR_OFFSET 0 +#endif + +/* Return values definition */ +enum +{ + HW_OK = 0, + HW_BUSY = 1 +}; + +/* + * HW_Init + * + * This function must be called once after reset before calling any of the + * other HW functions. + */ +extern void HW_Init( void ); + +/* + * HW_Delay + * + * This function is used internally for minimum delays. + * The input is given in microseconds and must be strictly higher than 0 (> 0) + * and lower than 16000000 (= 16 s). + * Be careful that the actual delay can be higher than the one programmed + * if the function is interrupted. + * The function is declared "weak" and can be overloaded by the user. + */ +extern void HW_Delay( uint32_t delay_us ); + +/* + * HW_GetPackageType + * + * Returns the package type (cf Package Data Register in STM32WB UM) + */ +extern uint32_t HW_GetPackageType( void ); + +/* + * HW_Config_HSE + */ +void HW_Config_HSE( uint8_t hsetune ); + +/* --------------------------------------------------------------------------- + * AES + * --------------------------------------------------------------------------- + */ + +/* Mode definitions used for HW_AES_SetKey() function */ +enum +{ + HW_AES_DEC = 0, + HW_AES_ENC = 1, + HW_AES_REV = 2, + HW_AES_SWAP = 4 +}; + +/* + * HW_AES_Enable + * + * Enables the AES hardware block. + * If the AES was already in use, the function does nothing and returns 0; + * otherwise it returns 1. + * Be careful: no re-entrance is ensured for the HW_AES functions + */ +extern int HW_AES_Enable( void ); + +/* + * HW_AES_SetKey + * + * Sets the key used for encryption/decryption. + * The "mode" parameter must be set to HW_AES_ENC for encryption and to + * HW_AES_DEC for decryption. It can be or-ed with HW_AES_REV for a reveresd + * oreder of key bytes, and with HW_AES_SWAP to use data byte swapping mode. + */ +extern void HW_AES_SetKey( uint32_t mode, + const uint8_t* key ); + +/* + * HW_AES_Crypt + * + * Encrypts/decrypts the 16-byte input data ("input"). Result is written in the + * 16-byte buffer ("output") allocated by the user. + */ +extern void HW_AES_Crypt( const uint32_t* input, + uint32_t* output ); + +/* + * HW_AES_Disable + * + * Disables the AES hardware block. + */ +extern void HW_AES_Disable( void ); + +/* --------------------------------------------------------------------------- + * PKA + * --------------------------------------------------------------------------- + */ + +/* + * HW_PKA_Enable + * + * Enables the PKA hardware block. + * If the driver is already in used, the function returns 0 immediately. + * If the PKA semaphore is available, this function locks the PKA semaphore, + * otherwise it returns 0. + * Then, when PKA semaphore is locked, the function enables PKA security, + * PKA clock and the block itself. + * This function must not be directly called when using P-256 elliptic curve + * dedicated functions. + * Be careful: no re-entrance is ensured for the HW_PKA functions + */ +extern int HW_PKA_Enable( void ); + +/* + * HW_PKA_WriteSingleInput + * + * Writes one single word into the PKA memory. + * This function must not be directly called when using P-256 elliptic curve + * dedicated functions. + */ +extern void HW_PKA_WriteSingleInput( uint32_t index, + uint32_t word ); + +/* + * HW_PKA_WriteOperand + * + * Writes one operand of size 'n' 32-bit words into the PKA memory. + * This function must not be directly called when using P-256 elliptic curve + * dedicated functions. + */ +extern void HW_PKA_WriteOperand( uint32_t index, + int size, + const uint32_t* in ); + +/* + * HW_PKA_Start + * + * Starts the PKA operation with mode defined by the parameter "mode". + * This function must not be directly called when using P-256 elliptic curve + * dedicated functions. + * + * "mode" can be one of the LL_PKA_MODE... definitions that can be found + * in "stm32wbxx_ll_pka.h" file. + */ +extern void HW_PKA_Start( uint32_t mode ); + +/* + * HW_PKA_EndOfOperation + * + * Returns 0 if the PKA processing is still active. + * Returns a value different from 0 when the PKA processing is complete. + */ +extern int HW_PKA_EndOfOperation( void ); + +/* + * HW_PKA_ReadSingleOutput + * + * Reads one 32-bit word result from the PKA memory. + * This function must not be directly called when using P-256 elliptic curve + * dedicated functions. + */ +extern uint32_t HW_PKA_ReadSingleOutput( uint32_t index ); + +/* + * HW_PKA_ReadResult + * + * Reads one multi-word result ("size" x 32-bit words) from the PKA memory. + * This function must not be directly called when using P-256 elliptic curve + * dedicated functions. + */ +extern void HW_PKA_ReadResult( uint32_t index, + int size, + uint32_t* out ); + +/* + * HW_PKA_Disable + * + * Disables the PKA hardware block. + * This function disables also the PKA clock and the PKA security. + * It then releases the PKA semaphore. + */ +extern void HW_PKA_Disable( void ); + +/* + * Notes: + * + * - this driver uses a semaphore to handle access to the PKA. The index of + * the semaphore must be configured with CFG_HW_PKA_SEMID. + */ + +/* --------------------------------------------------------------------------- + * PKA_P256 + * --------------------------------------------------------------------------- + */ + +/* + * HW_PKA_P256_StartRangeCheck + * + * Starts the range check of a point coordinate for P-256 elliptic curve. + * + * This function sets the parameters in PKA memory and then starts the + * processing. The PKA has to be enabled before with HW_PKA_Enable( ). + * The user must poll on the result availability by calling the + * HW_PKA_EndOfOperation() function. + * + * The input parameter is one the point coordinate. It must be a vector of + * 8 x 32-bit words (32 bytes). + * + * The check result is retrieved by calling HW_PKA_P256_IsRangeCheckOk(). + */ +extern void HW_PKA_P256_StartRangeCheck( const uint32_t* coord ); + +/* + * HW_PKA_P256_IsRangeCheckOk + * + * Reads the result of P-256 range check. This function must only be called + * when HW_PKA_EndOfOperation() returns a non-zero value. + * + * Returns 0 if the check fails ; 1 otherwise. + */ +extern uint32_t HW_PKA_P256_IsRangeCheckOk( void ); + +/* + * HW_PKA_P256_StartPointCheck + * + * Starts the check of a point for P-256 elliptic curve. + * + * This function sets the parameters in PKA memory and then starts the + * processing. The PKA has to be enabled before with HW_PKA_Enable( ). + * The user must poll on the result availability by calling the + * HW_PKA_EndOfOperation() function. + * + * The input parameters are the point coordinates. Each parameter must be a + * vector of 8 x 32-bit words (32 bytes). + * + * The check result is retrieved by calling HW_PKA_P256_IsPointCheckOk(). + */ +extern void HW_PKA_P256_StartPointCheck( const uint32_t* x, + const uint32_t* y ); + +/* + * HW_PKA_P256_IsPointCheckOk + * + * Reads the result of P-256 point check. This function must only be called + * when HW_PKA_EndOfOperation() returns a non-zero value. + * + * Returns 0 if the check fails ; 1 otherwise. + */ +extern uint32_t HW_PKA_P256_IsPointCheckOk( void ); + +/* + * HW_PKA_P256_StartEccScalarMul + * + * Starts the PKA scalar multiplication using the P-256 elliptic curve. + * + * This function sets the parameters in PKA memory and then starts the + * processing. The PKA has to be enabled before with HW_PKA_Enable( ). + * The user must poll on the result availability by calling the + * HW_PKA_EndOfOperation() function. + * + * The input parameter is the starting point P defined by its 2 coordinates + * p_x and p_y, and the scalar k. Each parameter must be a vector of 8 x 32-bit + * words (32 bytes). + */ +extern void HW_PKA_P256_StartEccScalarMul( const uint32_t* k, + const uint32_t* p_x, + const uint32_t* p_y ); + +/* + * HW_PKA_P256_ReadEccScalarMul + * + * Reads the result of PKA scalar multiplication using the P-256 elliptic + * curve. This function must only be called when HW_PKA_EndOfOperation() + * returns a non-zero value. + * + * This function retrieves the result from PKA memory: coordinates of point P, + * p_x and p_y, 8 x 32-bit words each (2 times 32 bytes). + * Before returning, it disables the PKA block, releasing the PKA semaphore. + */ +extern void HW_PKA_P256_ReadEccScalarMul( uint32_t* p_x, + uint32_t* p_y ); + +/* --------------------------------------------------------------------------- + * RNG + * --------------------------------------------------------------------------- + */ + +/* + * The RNG driver is made to generate the random numbers in background instead + * of generating them each time they are needed by the application. + * Thus, the function HW_RNG_Process() must be called regularly in background + * loop to generate a pool of random numbers. The function HW_RNG_Get() reads + * the random numbers from the pool. + * The size of the pool must be configured with CFG_HW_RNG_POOL_SIZE. + */ + +/* Error codes definition for HW_RNG return values */ +enum +{ + HW_RNG_CLOCK_ERROR = CFG_HW_ERROR_OFFSET + 0x101, + HW_RNG_NOISE_ERROR = CFG_HW_ERROR_OFFSET + 0x102, + HW_RNG_UFLOW_ERROR = CFG_HW_ERROR_OFFSET + 0x103, +}; + +/* RNG_KERNEL_CLK_ON + * + * Enable RNG kernel clock. + */ +void RNG_KERNEL_CLK_ON(void); + +/* RNG_KERNEL_CLK_OFF + * + * Disable RNG kernel clock. + */ +void RNG_KERNEL_CLK_OFF(void); + +/* HW_RNG_Disable + * + * Disables the RNG peripheral and switch off its clock in RCC. + */ +extern void HW_RNG_Disable( void ); + +/* HW_RNG_Start + * + * Starts the generation of random numbers using the RNG IP. This function has + * to be called only once at reset before calling HW_RNG_Get() to retrieve + * the generated random values. + */ +extern void HW_RNG_Start( void ); + +/* + * HW_RNG_Get + * + * Retrieves "n" random 32-bit words. + * "n" must be in the range [1, CFG_HW_RNG_POOL_SIZE]. + * The random numbers are written in memory from "val" pointer. + * "val" must point to a sufficient memory buffer allocated by the caller. + */ +extern void HW_RNG_Get( uint8_t n, + uint32_t* val ); + +/* + * HW_RNG_Process + * + * This function must be called in a separate task or in "background" loop. + * It implements a simple state machine that enables the RNG block, + * generates random numbers and then disables the RNG. + * It returns 0 (HW_OK) if the low power mode can be entered. + * It returns HW_BUSY as long as this function must be called. + * In error conditions, it returns one of the following error codes: + * - HW_RNG_CLOCK_ERROR for clock error, + * - HW_RNG_NOISE_ERROR for noise source error; + * the hardware must then be reset. + * - HW_RNG_UFLOW_ERROR in case of pool underflow error. + */ +extern int HW_RNG_Process( void ); + +/* + * HW_RNG_EnableClock + * + * This function enables the RNG clock for "other user" than RNG driver itself + */ +extern void HW_RNG_EnableClock( uint8_t user_mask ); + +/* + * HW_RNG_DisableClock + * + * This function disables the RNG clock for "other user" than RNG driver itself + */ +extern void HW_RNG_DisableClock( uint8_t user_mask ); + +extern void HWCB_RNG_Process( void ); + +/* --------------------------------------------------------------------------- + * GPIO + * --------------------------------------------------------------------------- + */ + +/* Index definitions used for all GPIO functions */ +enum +{ + HW_GPIO_DBG = 0, + HW_GPIO_GREEN_LED = 13, + HW_GPIO_RED_LED = 14, + HW_GPIO_BLUE_LED = 15, +}; + +/* + * HW_GPIO_Init + * + * This function initilaizes the GPIO pins used for debug. + */ +extern void HW_GPIO_Init( const uint32_t* dbg_pins ); + +/* + * HW_GPIO_Read + * + * This function reads the output pin which index is given in parameter. + * It returns 0 if the pin is low, 1 if the pin is high. + */ +extern uint8_t HW_GPIO_Read( uint8_t index ); + +/* + * HW_GPIO_Set + * + * This function sets to high level the output pin which index is given + * in parameter. + */ +extern void HW_GPIO_Set( uint8_t index ); + +/* + * HW_GPIO_Reset + * + * This function resets to low level the output pin which index is given + * in parameter. + */ +extern void HW_GPIO_Reset( uint8_t index ); + +extern void GPIO_SetDebug( int gpio_pin, + int pin_value ); + +/* --------------------------------------------------------------------------- + * OTP + * --------------------------------------------------------------------------- + */ + +typedef __PACKED_STRUCT +{ + uint8_t additional_data[8]; /*!< 64 bits of data to fill OTP slot */ + uint8_t bd_address[6]; /*!< Bluetooth Device Address*/ + uint8_t hsetune; /*!< Load capacitance to be applied on HSE pad */ + uint8_t index; /*!< Structure index */ +} HW_OTP_data_t; + +/* + * HW_OTP_Read + * + * Read the OTP + * + */ +int HW_OTP_Read( uint8_t index, + HW_OTP_data_t** data ); + +/* + * HW_OTP_Write + * + * ReadWrite the OTP + * + */ +int HW_OTP_Write( uint8_t* additional_data, + uint8_t* bd_address, + uint8_t hsetune, + uint8_t index ); + +#endif /* HW_H__ */ diff --git a/lib/stm32wba/hci/hw_aes.c b/lib/stm32wba/hci/hw_aes.c new file mode 100644 index 000000000..cad739801 --- /dev/null +++ b/lib/stm32wba/hci/hw_aes.c @@ -0,0 +1,179 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file hw_aes.c + * @author MCD Application Team + * @brief This file contains the AES driver for STM32WBA + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +#include "app_common.h" +#include "stm32wbaxx_ll_bus.h" + +/*****************************************************************************/ + +#define HW_AESX AES + +#define HW_AES_CLOCK_ENABLE( ) LL_AHB2_GRP1_EnableClock( LL_AHB2_GRP1_PERIPH_AES ) +#define HW_AES_CLOCK_DISABLE( ) LL_AHB2_GRP1_DisableClock( LL_AHB2_GRP1_PERIPH_AES ) + +#define HW_AES_CLOCK_IS_ENABLE( ) LL_AHB2_GRP1_IsEnabledClock( LL_AHB2_GRP1_PERIPH_AES ) + +/*****************************************************************************/ + +typedef struct +{ + uint8_t run; +} HW_AES_VAR_T; + +/*****************************************************************************/ + +static HW_AES_VAR_T HW_AES_var; + +/*****************************************************************************/ + +int HW_AES_Enable( void ) +{ + HW_AES_VAR_T* av = &HW_AES_var; + + /* Test if the driver is not already in use */ + + if ( HW_AES_CLOCK_IS_ENABLE() ) + { + return FALSE; + } + av->run = TRUE; + + UTILS_ENTER_CRITICAL_SECTION( ); + + /* Enable AES clock */ + HW_AES_CLOCK_ENABLE( ); + + UTILS_EXIT_CRITICAL_SECTION( ); + + return TRUE; +} + +/*****************************************************************************/ + +void HW_AES_SetKey( uint32_t mode, + const uint8_t* key ) +{ + uint32_t tmp[4]; + + /* Retrieve all bytes of key */ + memcpy( tmp, key, 16 ); + + /* Initialize the AES peripheral with default values: + - Processing: disabled + - Data type: 32-bit + - Operating mode: encryption + - Chaining mode: ECB + - Key size: 128-bit + */ + HW_AESX->CR = 0; + + /* Copy key bytes to the AES registers */ + + if ( mode & HW_AES_REV ) + { + HW_AESX->KEYR0 = tmp[0]; + HW_AESX->KEYR1 = tmp[1]; + HW_AESX->KEYR2 = tmp[2]; + HW_AESX->KEYR3 = tmp[3]; + } + else + { + HW_AESX->KEYR3 = __REV( tmp[0] ); + HW_AESX->KEYR2 = __REV( tmp[1] ); + HW_AESX->KEYR1 = __REV( tmp[2] ); + HW_AESX->KEYR0 = __REV( tmp[3] ); + } + + if ( !(mode & HW_AES_ENC) ) + { + /* Set key preparation mode */ + HW_AESX->CR = AES_CR_MODE_0; + + /* Enable AES processing */ + HW_AESX->CR |= AES_CR_EN; + + /* Wait for CCF flag to be raised */ + while ( ! (HW_AESX->SR & AES_SR_CCF) ); + + /* Clear CCF Flag */ + HW_AESX->ICR |= AES_ICR_CCF; + + /* Set decryption mode */ + HW_AESX->CR = AES_CR_MODE_1; + } + + /* Enable byte swapping if needed */ + if ( mode & HW_AES_SWAP ) + HW_AESX->CR |= AES_CR_DATATYPE_1; + + /* Wait until KEYVALID is set */ + while ( !(HW_AESX->SR & AES_SR_KEYVALID) ); + + /* Enable AES processing */ + HW_AESX->CR |= AES_CR_EN; +} + +/*****************************************************************************/ + +void HW_AES_Crypt( const uint32_t* input, + uint32_t* output ) +{ + /* Write the input block into the input FIFO */ + HW_AESX->DINR = input[0]; + HW_AESX->DINR = input[1]; + HW_AESX->DINR = input[2]; + HW_AESX->DINR = input[3]; + + /* Wait for CCF flag to be raised */ + while ( !(HW_AESX->SR & AES_SR_CCF) ); + + /* Read the output block from the output FIFO */ + output[0] = HW_AESX->DOUTR; + output[1] = HW_AESX->DOUTR; + output[2] = HW_AESX->DOUTR; + output[3] = HW_AESX->DOUTR; + + /* Clear CCF Flag */ + HW_AESX->ICR |= AES_ICR_CCF; +} + +/*****************************************************************************/ + +void HW_AES_Disable( void ) +{ + HW_AES_VAR_T* av = &HW_AES_var; + + if ( av->run ) + { + /* Disable AES processing */ + HW_AESX->CR = 0; + + UTILS_ENTER_CRITICAL_SECTION( ); + + /* Disable AES clock */ + HW_AES_CLOCK_DISABLE( ); + + UTILS_EXIT_CRITICAL_SECTION( ); + + av->run = FALSE; + } +} + +/*****************************************************************************/ diff --git a/lib/stm32wba/hci/hw_if.h b/lib/stm32wba/hci/hw_if.h new file mode 100644 index 000000000..4498aed07 --- /dev/null +++ b/lib/stm32wba/hci/hw_if.h @@ -0,0 +1,288 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file hw_if.h + * @author MCD Application Team + * @brief Hardware Interface + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef HW_IF_H +#define HW_IF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32wbaxx.h" +#include "stm32wbaxx_hal_conf.h" +#include "stm32wbaxx_hal_def.h" +#include "stm32wbaxx_ll_exti.h" +#include "stm32wbaxx_ll_system.h" +#include "stm32wbaxx_ll_rcc.h" +#include "stm32wbaxx_ll_bus.h" +#include "stm32wbaxx_ll_pwr.h" +#include "stm32wbaxx_ll_cortex.h" +#include "stm32wbaxx_ll_utils.h" +#include "stm32wbaxx_ll_gpio.h" +#include "stm32wbaxx_ll_rtc.h" + +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* Private typedef -----------------------------------------------------------*/ +/* USER CODE BEGIN PTD */ + +/* USER CODE END PTD */ + +/* Private define ------------------------------------------------------------*/ +/* USER CODE BEGIN PD */ + +/* USER CODE END PD */ + +/* Exported types ------------------------------------------------------------*/ +/****************************************************************************** + * HW UART + ******************************************************************************/ +typedef enum +{ + hw_uart1, + hw_uart2, + hw_lpuart1, +} hw_uart_id_t; + +typedef enum +{ + hw_uart_ok, + hw_uart_error, + hw_uart_busy, + hw_uart_to, +} hw_status_t; + +/****************************************************************************** + * HW TimerServer + ******************************************************************************/ +/** + * This setting is used when standby mode is supported. + * hw_ts_InitMode_Limited should be used when the device restarts from Standby Mode. In that case, the Timer Server does + * not re-initialized its context. Only the Hardware register which content has been lost is reconfigured + * Otherwise, hw_ts_InitMode_Full should be requested (Start from Power ON) and everything is re-initialized. + */ +typedef enum +{ + hw_ts_InitMode_Full, + hw_ts_InitMode_Limited, +} HW_TS_InitMode_t; + +/** + * When a Timer is created as a SingleShot timer, it is not automatically restarted when the timeout occurs. However, + * the timer is kept reserved in the list and could be restarted at anytime with HW_TS_Start() + * + * When a Timer is created as a Repeated timer, it is automatically restarted when the timeout occurs. + */ +typedef enum +{ + hw_ts_SingleShot, + hw_ts_Repeated +} HW_TS_Mode_t; + +/** + * hw_ts_Successful is returned when a Timer has been successfully created with HW_TS_Create(). Otherwise, hw_ts_Failed + * is returned. When hw_ts_Failed is returned, that means there are not enough free slots in the list to create a + * Timer. In that case, CFG_HW_TS_MAX_NBR_CONCURRENT_TIMER should be increased + */ +typedef enum +{ + hw_ts_Successful, + hw_ts_Failed, +}HW_TS_ReturnStatus_t; + +typedef void (*HW_TS_pTimerCb_t)(void); + +/* USER CODE BEGIN ET */ + +/* USER CODE END ET */ + +/* Exported constants --------------------------------------------------------*/ +/* USER CODE BEGIN EC */ + +/* USER CODE END EC */ + +/* External variables --------------------------------------------------------*/ +/* USER CODE BEGIN EV */ + +/* USER CODE END EV */ + +/* Private variables ---------------------------------------------------------*/ +/* USER CODE BEGIN PV */ + +/* USER CODE END PV */ + +/* Exported macro ------------------------------------------------------------*/ +/* USER CODE BEGIN EM */ + +/* USER CODE END EM */ + +/* Private function prototypes -----------------------------------------------*/ +/* USER CODE BEGIN PFP */ + +/* USER CODE END PFP */ + +/* Exported functions prototypes ---------------------------------------------*/ +/****************************************************************************** + * HW UART + ******************************************************************************/ +void HW_UART_Init(hw_uart_id_t hw_uart_id); +void HW_UART_Receive_IT(hw_uart_id_t hw_uart_id, uint8_t *pData, uint16_t Size, void (*Callback)(void)); +hw_status_t HW_UART_Receive_DMA(hw_uart_id_t hw_uart_id, uint8_t *p_data, uint16_t size, void (*cb)(void)); +void HW_UART_Transmit_IT(hw_uart_id_t hw_uart_id, uint8_t *pData, uint16_t Size, void (*Callback)(void)); +hw_status_t HW_UART_Transmit(hw_uart_id_t hw_uart_id, uint8_t *p_data, uint16_t size, uint32_t timeout); +hw_status_t HW_UART_Transmit_DMA(hw_uart_id_t hw_uart_id, uint8_t *p_data, uint16_t size, void (*Callback)(void)); +void HW_UART_Interrupt_Handler(hw_uart_id_t hw_uart_id); +void HW_UART_DMA_Interrupt_Handler(hw_uart_id_t hw_uart_id); + +/****************************************************************************** + * HW TimerServer + ******************************************************************************/ +/** + * @brief Initialize the timer server + * This API shall be called by the application before any timer is requested to the timer server. It + * configures the RTC module to be connected to the LSI input clock. + * + * @param TimerInitMode: When the device restarts from Standby, it should request hw_ts_InitMode_Limited so that the + * Timer context is not re-initialized. Otherwise, hw_ts_InitMode_Full should be requested + * @param hrtc: RTC Handle + * @retval None + */ +void HW_TS_Init(HW_TS_InitMode_t TimerInitMode, RTC_HandleTypeDef *hrtc); + +/** + * @brief Interface to create a virtual timer + * The user shall call this API to create a timer. Once created, the timer is reserved to the module until it + * has been deleted. When creating a timer, the user shall specify the mode (single shot or repeated), the + * callback to be notified when the timer expires and a module ID to identify in the timer interrupt handler + * which module is concerned. In return, the user gets a timer ID to handle it. + * + * @param TimerProcessID: This is an identifier provided by the user and returned in the callback to allow + * identification of the requester + * @param pTimerId: Timer Id returned to the user to request operation (start, stop, delete) + * @param TimerMode: Mode of the virtual timer (Single shot or repeated) + * @param pTimerCallBack: Callback when the virtual timer expires + * @retval HW_TS_ReturnStatus_t: Return whether the creation is successful or not + */ +HW_TS_ReturnStatus_t HW_TS_Create(uint32_t TimerProcessID, uint8_t *pTimerId, HW_TS_Mode_t TimerMode, HW_TS_pTimerCb_t pTimerCallBack); + +/** + * @brief Stop a virtual timer + * This API may be used to stop a running timer. A timer which is stopped is move to the pending state. + * A pending timer may be restarted at any time with a different timeout value but the mode cannot be changed. + * Nothing is done when it is called to stop a timer which has been already stopped + * + * @param TimerID: Id of the timer to stop + * @retval None + */ +void HW_TS_Stop(uint8_t TimerID); + +/** + * @brief Start a virtual timer + * This API shall be used to start a timer. The timeout value is specified and may be different each time. + * When the timer is in the single shot mode, it will move to the pending state when it expires. The user may + * restart it at any time with a different timeout value. When the timer is in the repeated mode, it always + * stay in the running state. When the timer expires, it will be restarted with the same timeout value. + * This API shall not be called on a running timer. + * + * @param TimerID: The ID Id of the timer to start + * @param timeout_ticks: Number of ticks of the virtual timer (Maximum value is (0xFFFFFFFF-0xFFFF = 0xFFFF0000) + * @retval None + */ +void HW_TS_Start(uint8_t TimerID, uint32_t timeout_ticks); + +/** + * @brief Delete a virtual timer from the list + * This API should be used when a timer is not needed anymore by the user. A deleted timer is removed from + * the timer list managed by the timer server. It cannot be restarted again. The user has to go with the + * creation of a new timer if required and may get a different timer id + * + * @param TimerID: The ID of the timer to remove from the list + * @retval None + */ +void HW_TS_Delete(uint8_t TimerID); + +/** + * @brief Schedule the timer list on the timer interrupt handler + * This interrupt handler shall be called by the application in the RTC interrupt handler. This handler takes + * care of clearing all status flag required in the RTC and EXTI peripherals + * + * @param None + * @retval None + */ +void HW_TS_RTC_Wakeup_Handler(void); + +/** + * @brief Return the number of ticks to count before the interrupt + * This API returns the number of ticks left to be counted before an interrupt is generated by the + * Timer Server. This API may be used by the application for power management optimization. When the system + * enters low power mode, the mode selection is a tradeoff between the wakeup time where the CPU is running + * and the time while the CPU will be kept in low power mode before next wakeup. The deeper is the + * low power mode used, the longer is the wakeup time. The low power mode management considering wakeup time + * versus time in low power mode is implementation specific + * When the timer is disabled (No timer in the list), it returns 0xFFFF + * + * @param None + * @retval The number of ticks left to count + */ +uint16_t HW_TS_RTC_ReadLeftTicksToCount(void); + +/** + * @brief Notify the application that a registered timer has expired + * This API shall be implemented by the user application. + * This API notifies the application that a timer expires. This API is running in the RTC Wakeup interrupt + * context. The application may implement an Operating System to change the context priority where the timer + * callback may be handled. This API provides the module ID to identify which module is concerned and to allow + * sending the information to the correct task + * + * @param TimerProcessID: The TimerProcessId associated with the timer when it has been created + * @param TimerID: The TimerID of the expired timer + * @param pTimerCallBack: The Callback associated with the timer when it has been created + * @retval None + */ +void HW_TS_RTC_Int_AppNot(uint32_t TimerProcessID, uint8_t TimerID, HW_TS_pTimerCb_t pTimerCallBack); + +/** + * @brief Notify the application that the wakeupcounter has been updated + * This API should be implemented by the user application + * This API notifies the application that the counter has been updated. This is expected to be used along + * with the HW_TS_RTC_ReadLeftTicksToCount () API. It could be that the counter has been updated since the + * last call of HW_TS_RTC_ReadLeftTicksToCount () and before entering low power mode. This notification + * provides a way to the application to solve that race condition to reevaluate the counter value before + * entering low power mode + * + * @param None + * @retval None + */ +void HW_TS_RTC_CountUpdated_AppNot(void); + +/* USER CODE BEGIN EFP */ + +/* USER CODE END EFP */ + +#ifdef __cplusplus +} +#endif + +#endif /*HW_IF_H */ diff --git a/lib/stm32wba/hci/hw_pka.c b/lib/stm32wba/hci/hw_pka.c new file mode 100644 index 000000000..395e1f231 --- /dev/null +++ b/lib/stm32wba/hci/hw_pka.c @@ -0,0 +1,172 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file hw_pka.c + * @author MCD Application Team + * @brief This file contains the PKA driver for STM32WBA + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +#include "app_common.h" +#include "stm32wbaxx_ll_bus.h" +#include "stm32wbaxx_ll_pka.h" + +/*****************************************************************************/ + +typedef struct +{ + uint8_t run; +} HW_PKA_VAR_T; + +/*****************************************************************************/ + +static HW_PKA_VAR_T HW_PKA_var; + +/*****************************************************************************/ + +int HW_PKA_Enable( void ) +{ + HW_PKA_VAR_T* pv = &HW_PKA_var; + + /* Test if the driver is not already in use */ + + if ( pv->run ) + { + return FALSE; + } + + pv->run = TRUE; + + /* Enable the RNG clock as it is needed. + * See PKA chapter in IUM: the RNG peripheral must be clocked. + */ + HW_RNG_EnableClock( 2 ); + + UTILS_ENTER_CRITICAL_SECTION( ); + + /* Enable the PKA clock */ + LL_AHB2_GRP1_EnableClock( LL_AHB2_GRP1_PERIPH_PKA ); + + UTILS_EXIT_CRITICAL_SECTION( ); + + /* Enable the PKA block */ + LL_PKA_Enable( PKA ); + + /* Wait for PKA initialization OK */ + while ( !(PKA->SR & PKA_SR_INITOK) ); + + /* Reset any pending flag */ + SET_BIT(PKA->CLRFR, (PKA_CLRFR_PROCENDFC | PKA_CLRFR_RAMERRFC | + PKA_CLRFR_ADDRERRFC | PKA_CLRFR_OPERRFC)); + + /* Disable the RNG clock as it is no more needed ??? + */ + HW_RNG_DisableClock( 2 ); + + return TRUE; +} + +/*****************************************************************************/ + +void HW_PKA_WriteSingleInput( uint32_t index, uint32_t word ) +{ + /* Write the single word into PKA RAM */ + + PKA->RAM[index] = word; +} + +/*****************************************************************************/ + +void HW_PKA_WriteOperand( uint32_t index, int size, const uint32_t* in ) +{ + uint32_t* pka_ram = (uint32_t*)&PKA->RAM[index]; + + /* Write the input data into PKA RAM */ + + for ( ; size > 0; size-- ) + { + *pka_ram++ = *in++; + } + + /* Write extra zeros into PKA RAM */ + + *pka_ram = 0; +} + +/*****************************************************************************/ + +void HW_PKA_Start( uint32_t mode ) +{ + /* Set the configuration */ + LL_PKA_Config( PKA, mode ); + + /* Start the PKA processing */ + LL_PKA_ClearFlag_PROCEND( PKA ); + LL_PKA_Start( PKA ); +} + +/*****************************************************************************/ + +int HW_PKA_EndOfOperation( void ) +{ + /* Return 0 if the processing is still active */ + return LL_PKA_IsActiveFlag_PROCEND( PKA ); +} + +/*****************************************************************************/ + +uint32_t HW_PKA_ReadSingleOutput( uint32_t index ) +{ + /* Read a single word from PKA RAM */ + + return PKA->RAM[index]; +} + +/*****************************************************************************/ + +void HW_PKA_ReadResult( uint32_t index, int size, uint32_t* out ) +{ + uint32_t* pka_ram = (uint32_t*)&PKA->RAM[index]; + + /* Read from PKA RAM */ + + for ( ; size > 0; size-- ) + { + *out++ = *pka_ram++; + } +} + +/*****************************************************************************/ + +void HW_PKA_Disable( void ) +{ + HW_PKA_VAR_T* pv = &HW_PKA_var; + + if ( pv->run ) + { + /* Disable the PKA block */ + LL_PKA_Disable( PKA ); + + UTILS_ENTER_CRITICAL_SECTION( ); + + /* Disable the PKA clock */ + LL_AHB2_GRP1_DisableClock( LL_AHB2_GRP1_PERIPH_PKA ); + + UTILS_EXIT_CRITICAL_SECTION( ); + + pv->run = FALSE; + } +} + +/*****************************************************************************/ diff --git a/lib/stm32wba/hci/linklayer_plat.h b/lib/stm32wba/hci/linklayer_plat.h new file mode 100644 index 000000000..64015f607 --- /dev/null +++ b/lib/stm32wba/hci/linklayer_plat.h @@ -0,0 +1,183 @@ +/** + ****************************************************************************** + * @file hw_radio.h + * @author MCD Application Team + * @brief Header for linklayer_plat.c interface module + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + +#ifndef LINKLAYER_PLAT_H +#define LINKLAYER_PLAT_H + +#include "bsp.h" +#include + +/** + * @brief Configure the necessary clock sources for the radio. + * @param None + * @retval None + */ +extern void LINKLAYER_PLAT_ClockInit(void); + +/** + * @brief Link Layer active waiting loop. + * @param delay: delay in us + * @retval None + */ +extern void LINKLAYER_PLAT_DelayUs(uint32_t delay); + +/** + * @brief Link Layer assertion API + * @param condition: conditional statement to be checked. + * @retval None + */ +extern void LINKLAYER_PLAT_Assert(uint8_t condition); + +/** + * @brief Enable/disable the Link Layer active clock (baseband clock). + * @param enable: boolean value to enable (1) or disable (0) the clock. + * @retval None + */ +extern void LINKLAYER_PLAT_AclkCtrl(uint8_t enable); + +/** + * @brief Active wait on bus clock readiness. + * @param None + * @retval None + */ +extern void LINKLAYER_PLAT_WaitHclkRdy(void); + +/** + * @brief Link Layer RNG request. + * @param ptr_rnd: pointer to the variable that hosts the number. + * @param len: number of byte of anthropy to get. + * @retval None + */ +extern void LINKLAYER_PLAT_GetRNG(uint8_t *ptr_rnd, uint32_t len); + +/** + * @brief Initialize Link Layer radio high priority interrupt. + * @param intr_cb: function pointer to assign for the radio high priority ISR routine. + * @retval None + */ +extern void LINKLAYER_PLAT_SetupRadioIT(void (*intr_cb)()); + +/** + * @brief Initialize Link Layer SW low priority interrupt. + * @param intr_cb: function pointer to assign for the SW low priority ISR routine. + * @retval None + */ +extern void LINKLAYER_PLAT_SetupSwLowIT(void (*intr_cb)()); + +/** + * @brief Trigger the link layer SW low interrupt. + * @param None + * @retval None + */ +extern void LINKLAYER_PLAT_TriggerSwLowIT(uint8_t priority); + +/** + * @brief Enable interrupts. + * @param None + * @retval None + */ +extern void LINKLAYER_PLAT_EnableIRQ(void); + +/** + * @brief Disable interrupts. + * @param None + * @retval None + */ +extern void LINKLAYER_PLAT_DisableIRQ(void); + +/** + * @brief Enable specific interrupt group. + * @param isr_type: mask for interrupt group to enable. + * This parameter can be one of the following: + * @arg LL_HIGH_ISR_ONLY: enable link layer high priority ISR. + * @arg LL_LOW_ISR_ONLY: enable link layer SW low priority ISR. + * @arg SYS_LOW_ISR: unmask interrupts for all the other system ISR with + * lower priority that link layer SW low interrupt. + * @retval None + */ +extern void LINKLAYER_PLAT_EnableSpecificIRQ(uint8_t isr_type); + +/** + * @brief Disable specific interrupt group. + * @param isr_type: mask for interrupt group to disable. + * This parameter can be one of the following: + * @arg LL_HIGH_ISR_ONLY: disable link layer high priority ISR. + * @arg LL_LOW_ISR_ONLY: disable link layer SW low priority ISR. + * @arg SYS_LOW_ISR: mask interrupts for all the other system ISR with + * lower priority that link layer SW low interrupt. + * @retval None + */ +extern void LINKLAYER_PLAT_DisableSpecificIRQ(uint8_t isr_type); + +/** + * @brief Enable link layer high priority ISR only. + * @param None + * @retval None + */ +extern void LINKLAYER_PLAT_EnableRadioIT(void); + +/** + * @brief Disable link layer high priority ISR only. + * @param None + * @retval None + */ +extern void LINKLAYER_PLAT_DisableRadioIT(void); + +/** + * @brief Link Layer notification for radio activity start. + * @param None + * @retval None + */ +extern void LINKLAYER_PLAT_StartRadioEvt(void); + +/** + * @brief Link Layer notification for radio activity end. + * @param None + * @retval None + */ +extern void LINKLAYER_PLAT_StopRadioEvt(void); + +/** + * @brief Link Layer requests temperature. + * @param None + * @retval None + */ +extern void LINKLAYER_PLAT_RequestTemperature(void); + +/** + * @brief Enable RTOS context switch. + * @param None + * @retval None + */ +extern void LINKLAYER_PLAT_EnableOSContextSwitch(void); + +/** + * @brief Disable RTOS context switch. + * @param None + * @retval None + */ +extern void LINKLAYER_PLAT_DisableOSContextSwitch(void); + +/** + * @brief Notify the upper layer that new Link Layer timings have been applied. + * @param evnt_timing[in]: Evnt_timing_t pointer to structure contains drift time , execution time and scheduling time + * @retval None. + */ +extern void LINKLAYER_PLAT_SCHLDR_TIMING_UPDATE_NOT(Evnt_timing_t * p_evnt_timing); + +#endif /* LINKLAYER_PLAT_H */ diff --git a/lib/stm32wba/hci/ll/_40nm_reg_files/DWC_ble154combo.h b/lib/stm32wba/hci/ll/_40nm_reg_files/DWC_ble154combo.h new file mode 100644 index 000000000..8a1d3ac2e --- /dev/null +++ b/lib/stm32wba/hci/ll/_40nm_reg_files/DWC_ble154combo.h @@ -0,0 +1,61 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.30a-SOW05PatchV6/firmware/public_inc/_40nm_reg_files/DWC_ble154combo.h#1 $*/ +/** + ******************************************************************************** + * @brief + * + * + ****************************************************************************** + * @copy + * This Synopsys DWC Bluetooth Low Energy Combo Link Layer/MAC software and + * associated documentation ( hereinafter the "Software") is an unsupported + * proprietary work of Synopsys, Inc. unless otherwise expressly agreed to in + * writing between Synopsys and you. The Software IS NOT an item of Licensed + * Software or a Licensed Product under any End User Software License Agreement + * or Agreement for Licensed Products with Synopsys or any supplement thereto. + * Synopsys is a registered trademark of Synopsys, Inc. Other names included in + * the SOFTWARE may be the trademarks of their respective owners. + * + * Synopsys MIT License: + * Copyright (c) 2020-Present Synopsys, Inc + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * the Software), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE ARISING FROM, + * OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * */ + +// Abstract: Configuration definition header file for DWC_ble154combo + +#define Z_DATA_SYNC_STAGES 2 +#define USE_SLPTMR_CAL 1 +#define USE_SCAN_OUT_MUX 1 +#define USE_RNG 0 +#define USE_JTAG 1 +#define Z_RESET_SYNC_STAGES 2 +#define USE_AES 1 +#define SW_ACT_HIGH 1 +#define ANT 1 +#define BUS_CLK 32 +#define PHY_TYPE 1 +#define BLE_MAC_ROLE 1 +#define BLE_LL_ROLE 1 +#define ACT_CLK 32 +#define DF_NO_ANTENNAS 8 +#define LST_ADDR 7 +#define SEQ_RAM_ADDR_WIDTH 7 +#define BLE_STANDARD 3 +#define JTAG_CLK 16 +#define DATA_RAM_ADDR_WIDTH 12 +#define POW_GUARD_TIME 5 diff --git a/lib/stm32wba/hci/ll/bsp.h b/lib/stm32wba/hci/ll/bsp.h new file mode 100644 index 000000000..8e2e7a7da --- /dev/null +++ b/lib/stm32wba/hci/ll/bsp.h @@ -0,0 +1,593 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.30a-SOW05PatchV6/firmware/public_inc/bsp.h#1 $*/ + +/** + ******************************************************************************** + * @file bsp.h + * @brief board support package interface wrapper file. + ****************************************************************************** + * @copy + * This Synopsys DWC Bluetooth Low Energy Combo Link Layer/MAC software and + * associated documentation ( hereinafter the "Software") is an unsupported + * proprietary work of Synopsys, Inc. unless otherwise expressly agreed to in + * writing between Synopsys and you. The Software IS NOT an item of Licensed + * Software or a Licensed Product under any End User Software License Agreement + * or Agreement for Licensed Products with Synopsys or any supplement thereto. + * Synopsys is a registered trademark of Synopsys, Inc. Other names included in + * the SOFTWARE may be the trademarks of their respective owners. + * + * Synopsys MIT License: + * Copyright (c) 2020-Present Synopsys, Inc + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * the Software), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE ARISING FROM, + * OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef LL_BSP_H_ +#define LL_BSP_H_ + +#include +#include "_40nm_reg_files/DWC_ble154combo.h" +#define INTERRUPT_ENABLE (1<<4) +#define SET_PRIORITY_LEVEL 2 +#define PRIORITY_LEVEL_MASK 0x0F + +/** + * This macros specify the different combinations that can be used to enable or disable + * a specific ISR + */ + +#define LL_HIGH_ISR_ONLY 0x01 // Specify only LL high ISR to be enabled or disabled +#define LL_LOW_ISR_ONLY 0x02 // Specify only LL LOW ISR to be enabled or disabled +#define SYS_LOW_ISR 0x04 // Specify only system low ISR to be enabled or disabled + +/** + * @brief InterruptPriorities Enum. + * it is used to define the different ISR priorities in the controller + */ +typedef enum InterruptPriorities { + INT_PRIO_HIGHEST = 0, + INT_PRIO_HIGH, + INT_PRIO_LOW, + INT_PRIO_LOWEST, + INT_PRIO_MAX +}InterruptPriorities; + +/** + * @brief Event notification state Enum. + * it is used to the state of radio activity ,being started or ended + */ +typedef enum EvntNotiState { + EVNT_START, + EVNT_END, + EVNT_NOT_SPECIIFED +}EvntNotiState; + +/** + * @brief periodic calibration state Enum. + * it is used to the state of Periodic calibration + */ +typedef enum _PhyClbrState { + PHY_CLBR_NOT_RUNNING, + PHY_CLBR_PNDING_OR_RUNNING, + PHY_CLBR_NOT_KNOWN +}PhyClbrState; + +/* MACRO to explicitly disable unused parameter warning */ +#define LL_UNUSED(x) (void)(x) + +/** + * @brief link layer bus structure. + * it defines the callback functions that will be be called by the transport bus driver + * after the requested operation is done. + */ +typedef struct _ble_ll_bus { + /** Bus read callback that will be called after the requested number of bytes is read from the bus */ + void (*read)(uint8_t *buffer); + /** Bus Write callback that will be called after the requested is written to the bus */ + void (*write)(uint8_t *buffer); +} ble_ll_bus; + +/* Structure holding the Event timing */ +typedef struct Evnt_timing_s{ + uint32_t drift_time; /* The total drift time between the software timer value and the start execution of the function evnt_schdlr_timer_callback */ + uint32_t exec_time; /* The time to get the event ready for air transmission */ + uint32_t schdling_time; /* The total time to server the completed event and start new cycle of it, the time from longest time of the state machine done isr to till the debug dio DBG_IO_PROFILE_END_DRIFT_TIME is raised */ +}Evnt_timing_t; +/** + * @brief enum holding all debugging gpio + * + * + * + */ +typedef enum Debug_GPIO_e{ + + + DBG_IO_HCI_READ_DONE , + DBG_IO_HCI_RCVD_CMD , + DBG_IO_HCI_WRITE_DONE , + DBG_IO_SCHDLR_EVNT_UPDATE , + DBG_IO_SCHDLR_TIMER_SET , + DBG_IO_SCHDLR_PHY_CLBR_TIMER , + DBG_IO_SCHDLR_EVNT_SKIPPED , + DBG_IO_SCHDLR_HNDL_NXT_TRACE , + DBG_IO_ACTIVE_SCHDLR_NEAR_DETEDTED , + DBG_IO_ACTIVE_SCHDLR_NEAR_GAP_CHECK , + DBG_IO_ACTIVE_SCHDLR_NEAR_TIME_CHECK , + DBG_IO_ACTIVE_SCHDLR_NEAR_TRACE , + DBG_IO_SCHDLR_EVNT_RGSTR , + DBG_IO_SCHDLR_ADD_CONFLICT_Q , + DBG_IO_SCHDLR_HNDL_MISSED_EVNT , + DBG_IO_SCHDLR_UNRGSTR_EVNT , + DBG_IO_SCHDLR_EXEC_EVNT_TRACE , + DBG_IO_SCHDLR_EXEC_EVNT_PROFILE , + DBG_IO_SCHDLR_EXEC_EVNT_ERROR , + DBG_IO_SCHDLR_EXEC_EVNT_WINDOW_WIDENING , + DBG_IO_LLHWC_CMN_CLR_ISR , + DBG_IO_LLWCC_CMN_HG_ISR , + DBG_IO_LLHWC_CMN_LW_ISR , + DBG_IO_LLHWC_CMN_CLR_TIMER_ERROR , + DBG_IO_LLHWC_LL_ISR , + DBG_IO_LLHWC_SPLTMR_SET , + DBG_IO_LLHWC_SPLTMR_GET , + DBG_IO_LLHWC_LOW_ISR , + DBG_IO_LLHWC_STOP_SCN , + DBG_IO_LLHWC_WAIT_ENVT_ON_AIR , + DBG_IO_LLHWC_SET_CONN_EVNT_PARAM , + DBG_IO_POST_EVNT , + DBG_IO_HNDL_ALL_EVNTS , + DBG_IO_PROCESS_EVNT , + DBG_IO_PROCESS_ISO_DATA , + DBG_IO_ALLOC_TX_ISO_EMPTY_PKT , + DBG_IO_BIG_FREE_EMPTY_PKTS , + DBG_IO_RECOMBINE_UNFRMD_DATA_OK , + DBG_IO_RECOMBINE_UNFRMD_DATA_CRC , + DBG_IO_RECOMBINE_UNFRMD_DATA_NoRX , + DBG_IO_RECOMBINE_UNFRMD_DATA_TRACE , + DBG_IO_ISO_HNDL_SDU , + DBG_IO_LL_INTF_INIT , + DBG_IO_DATA_TO_CNTRLR , + DBG_IO_FREE_LL_PKT_HNDLR , + DBG_IO_PHY_INIT_CLBR_TRACE , + DBG_IO_PHY_RUNTIME_CLBR_TRACE , + DBG_IO_PHY_CLBR_ISR , + DBG_IO_PHY_INIT_CLBR_SINGLE_CH , + DBG_IO_PHY_CLBR_STRTD , + DBG_IO_PHY_CLBR_EXEC , + DBG_IO_RCO_STRT_STOP_RUNTIME_CLBR_ACTV , + DBG_IO_RCO_STRT_STOP_RUNTIME_RCO_CLBR , + DBG_IO_STRT_STOP_RUNTIME_RCO_CLBR_SWT , + DBG_IO_STRT_STOP_RUNTIME_RCO_CLBR_TRACE , + DBG_IO_RCO_ISR_TRACE , + DBG_IO_RCO_ISR_COMPENDATE , + DBG_IO_RAL_STRT_TX , + DBG_IO_RAL_ISR_TIMER_ERROR , + DBG_IO_RAL_ISR_TRACE , + DBG_IO_RAL_STOP_OPRTN , + DBG_IO_RAL_STRT_RX , + DBG_IO_RAL_DONE_CLBK_TX , + DBG_IO_RAL_DONE_CLBK_RX , + DBG_IO_RAL_DONE_CLBK_ED , + DBG_IO_RAL_ED_SCAN , + DBG_IO_ERROR_MEM_CAP_EXCED , + DBG_IO_ERROR_COMMAND_DISALLOWED , + DBG_IO_PTA_INIT , + DBG_IO_PTA_EN , + DBG_IO_LLHWC_PTA_SET_EN , + DBG_IO_LLHWC_PTA_SET_PARAMS , + DBG_IO_COEX_STRT_ON_IDLE , + DBG_IO_COEX_ASK_FOR_AIR , + DBG_IO_COEX_TIMER_EVNT_CLBK , + DBG_IO_COEX_STRT_ONE_SHOT , + DBG_IO_COEX_FORCE_STOP_RX , + + + DBG_IO_LLHWC_ADV_DONE , + DBG_IO_LLHWC_SCN_DONE , + DBG_IO_LLHWC_INIT_DONE , + DBG_IO_LLHWC_CONN_DONE , + + DBG_IO_LLHWC_CIG_DONE , + DBG_IO_LLHWC_BIG_DONE , + DBG_IO_OS_TMR_CREATE , + DBG_IO_ADV_EXT_TIMEOUT_CBK , + DBG_IO_ADV_EXT_SCN_DUR_CBK , + DBG_IO_ADV_EXT_SCN_PERIOD_CBK , + DBG_IO_ADV_EXT_PRDC_SCN_TIMEOUT_CBK , + DBG_IO_BIS_SYNC_TIMEOUT_TMR_CBK , + DBG_IO_BIS_TERM_TMR_CBK , + DBG_IO_BIS_TST_MODE_CBK , + DBG_IO_BIS_TST_MODE_TMR_CBK , + DBG_IO_ISO_POST_TMR_CBK , + DBG_IO_ISO_TST_MODE_TMR_CBK , + DBG_IO_CONN_POST_TMR_CBK , + DBG_IO_EVNT_SCHDLR_TMR_CBK , + DBG_IO_HCI_POST_TMR_CBK , + DBG_IO_LLCP_POST_TMR_CBK , + DBG_IO_LLHWC_ENRGY_DETECT_CBK , + DBG_IO_PRVCY_POST_TMR_CBK , + + DBG_IO_ANT_PRPR_TMR_CBK , + + DBG_IO_COEX_TMR_FRC_STOP_AIR_GRANT_CBK , + DBG_IO_MLME_RX_EN_TMR_CBK , + DBG_IO_MLME_GNRC_TMR_CBK , + DBG_IO_MIB_JOIN_LST_TMR_CBK , + DBG_IO_MLME_PWR_PRES_TMR_CBK , + DBG_IO_PRESISTENCE_TMR_CBK , + DBG_IO_RADIO_PHY_PRDC_CLBK_TMR_CBK , + DBG_IO_RADIO_CSMA_TMR_CBK , + DBG_IO_RADIO_CSL_RCV_TMR_CBK , + DBG_IO_ED_TMR_CBK , + DBG_IO_DIO_EXT_TMR_CBK , + DBG_IO_RCO_CLBR_TMR_CBK + , + DBG_IO_ADV_EXT_MNGR_ADV_CBK , + DBG_IO_ADV_EXT_MNGR_SCN_CBK , + DBG_IO_ADV_EXT_MNGR_SCN_ERR_CBK , + DBG_IO_ADV_EXT_MNGR_PRDC_SCN_CBK , + DBG_IO_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK , + DBG_IO_BIG_ADV_CBK , + DBG_IO_BIG_ADV_ERR_CBK , + DBG_IO_BIG_SYNC_CBK , + DBG_IO_BIG_SYNC_ERR_CBK , + DBG_IO_ISO_CIS_PKT_TRNSM_RECEIVED_CBK , + DBG_IO_ISO_CIG_ERR_CBK , + DBG_IO_CONN_PKT_TRNSM_RECEIVED_CBK , + DBG_IO_PRDC_CLBR_EXTRL_CBK , + DBG_IO_PTR_PRDC_ADV_SYNC_CBK , + DBG_IO_NCONN_SCN_CBK , + DBG_IO_NCONN_ADV_CBK , + DBG_IO_NCONN_INIT_CBK , + DBG_IO_ANT_RADIO_CMPLT_EVNT_CBK , + DBG_IO_ANT_STACK_EVNT_CBK , + DBG_IO_ADV_EXT_PROCESS_TMOUT_EVNT_CBK , + DBG_IO_ADV_EXT_MNGR_SCN_DUR_EVNT , + DBG_IO_ADV_EXT_MNGR_SCN_PERIODIC_EVNT , + DBG_IO_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT , + DBG_IO_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT , + DBG_IO_BIS_MNGR_BIG_TERM_CBK , + DBG_IO_BIS_MNGR_SYNC_TMOUT_CBK , + DBG_IO_ISOAL_MNGR_SDU_GEN , + DBG_IO_ISO_MNGR_CIS_PROCESS_EVNT_CBK , + + DBG_IO_CONN_MNGR_PROCESS_EVNT_CLBK , + DBG_IO_CONN_MNGR_UPDT_CONN_PARAM_CBK , + DBG_IO_EVNT_SCHDLR_HW_EVNT_CMPLT , + + DBG_IO_HCI_EVENT_HNDLR , + + DBG_IO_MLME_TMRS_CBK , + DBG_IO_DIRECT_TX_EVNT_CBK , + DBG_IO_INDIRECT_PKT_TOUR_CBK , + DBG_IO_RADIO_CSMA_TMR , + DBG_IO_RAL_SM_DONE_EVNT_CBK , + DBG_IO_ED_TMR_HNDL , + DBG_IO_OS_TMR_EVNT_CBK , + DBG_IO_PROFILE_MARKER_PHY_WAKEUP_TIME , + DBG_IO_PROFILE_END_DRIFT_TIME , + DBG_IO_PROC_RADIO_RCV , + DBG_IO_EVNT_TIME_UPDT , + Debug_GPIO_num , + DBG_IO_MAC_RECEIVE_DONE , + DBG_IO_MAC_TX_DONE , + DBG_IO_RADIO_APPLY_CSMA , + DBG_IO_RADIO_TRANSMIT , + DBG_IO_PROC_RADIO_TX , + DBG_IO_RAL_TX_DONE , + DBG_IO_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT , + DBG_IO_RAL_TX_DONE_RST_BACKOFF_COUNT , + DBG_IO_RAL_CONTINUE_RX , + DBG_IO_RAL_PERFORM_CCA , + DBG_IO_RAL_ENABLE_TRANSMITTER , + DBG_IO_LLHWC_GET_CH_IDX_ALGO_2 + +}Debug_GPIO_t; + + + +/** +* @ingroup BSP_APIS +* @{ +*/ +/** + * @brief Bus initialization Function + * + * this function is used to initialize the used transport bus and link functions is @ref _ble_ll_bus to the ISRs of bus driver + * @param op[in] : pointer to @ref _ble_ll_bus structure that stores the bus callback functions + * @retval None + * + */ +void bus_init(ble_ll_bus * op); + +/** + * @brief Bus read Function + * This function is used read @ref size bytes from the Bus in the given @ref buffer + * @note this function is asynchronous, it is expected that Bus read callback function is called to indicate that the requested data is available + * the read callback function will be set by calling @ref bus_init + * @param *buffer [in]: pointer to the buffer of the data + * @param size [in]: size of bytes read from the buffer + * + * @retval None + */ +void bus_read(uint8_t *buffer, uint16_t size); + +/** + * @brief Bus write Function + * This function is used read @ref size bytes from the Bus in the given @ref buffer + * @note this function is asynchronous, it is expected that Bus will call read callback function when wrriting data is done + * the Write callback function will be set by calling @ref bus_init + * @param *buffer[in]: pointer to the buffer of the data + * @param size[in]: size of bytes written to the buffer + * + * @retval None + */ +void bus_write(uint8_t *buffer, uint16_t size); + +/** + * @brief logger port initialization + * + *this function is used to initalizer the logger + * @param None + * @retval None + * + */ +void logger_init(void); + +/** + * @brief logger write + * Thin function is used to log the data described by the input parameters + * @param *buffer: pointer to the buffer of the data to be written to logger + * @param size: size of bytes to be logged from the buffer + * + * @retval None + */ +void logger_write(uint8_t *buffer, uint32_t size); + +/** + * @brief enable interrupt request function + * This function enable the MCU interrupt ,after calling this function the LL code can be interrupted by the controller + * @param None + * + * @retval None + */ +extern void enable_irq(void); +/** + * @brief disable interrupt request function + * This function disable the MCU interrupt ,after calling this function the LL code must not be interrupted as it is in critical section + * @param None + * + * @retval None + */ +extern void disable_irq(void); + +/** + * @brief this function is used to enable a specific ISR + * @param[in] isr_type that holds specific ISR to be enabled by this function + * BIT[0] for LL_HIGH_ISR + * BIT[1] for LL_LOW_ISR + * BIT[2] for SYS_LOW_ISR + * @return None + */ +void enable_specific_irq (uint8_t isr_type); + + +/** + * @brief this function is used to disable a specific ISR + * @param[in] isr_type that holds specific ISR to be disabled by this function + * BIT[0] for LL_HIGH_ISR + * BIT[1] for LL_LOW_ISR + * BIT[2] for SYS_LOW_ISR + * @return None + */ +void disable_specific_irq (uint8_t isr_type); + + +/** + * @brief broad initialization Function + * + * this function is used to initialize the used MCU + * @param op[in] : pointer to @ref _ble_ll_bus structure that stores the bus callback functions + * @retval 0 if SUCCESS + * otherwise Not SUCESS + * + */ +int bsp_init(void); +/** + * @brief dealy us Function + * + * this function is microsecond delay function + * @param op[in] : Nunmber of microseconds that function this function execution should take + * @retval None + * + */ +void bsp_delay_us(uint32_t delay); + +/** + * @brief interrupt enable Function + * + * this function is used to enabled and register ISR for the given interrupt line + * @param intrNum[in] : number to the interrupt line to be enabled + * @param intr_cb[in] : pionter to ISR function the will be called when this interupt is fired + * @retval None + * + */ +int bsp_intr_enable (uint32_t intrNum, void (*intr_cb)()); +/** + * @brief interrupt set pri Function + * + * this function is used to set the interrupt priority and register ISR for the given interrupt line + * @param intrNum[in] : number to the configured interrupt line + * @param intr_cb[in] : pionter to ISR function the will be called when this interupt is fired + * @param intpri[in] : the priority oto used for the given interrupt + * @retval None + * + */ +int bsp_intr_set_pri(uint32_t intrNum, void (*intr_cb)(), int32_t intpri); + + + +/* */ +/** + * + * @brief is in LL BLE memory function + * it Checks whether the given pointer in BLE Memory or outside it if the pointer points to a location in BLE memory + * @param ptr [in] pointer to check if in BLE memory or not + * + * @retval 1 the given pointer is in LL BLE memory + * @retval 0 the given pointer is not in LL BLE memory + */ +int bsp_is_ptr_in_ble_mem(void* ptr); + + +/** + * @brief make the mcu sleep in a certain power mode according to its idle time. + * + * @param None. + * + * @retval None. + */ +void bsp_mcu_slp(void); + +/** + * @brief Enables/Disables the bus clock. + * + * @param enable: enable/disable flag + * + * @retval None. + */ +void bsp_control_hclk(uint8_t enable); + +/** + * @brief Enables/Disables the active clock. + * + * @param enable: enable/disable flag + * + * @retval None. + */ +void bsp_control_aclk(uint8_t enable); + + +/** + * @brief Notification that LL FW will start or end a radio activity . + * + * @param enable: EVNT_START , radio activity started + * : Evnt_END Radio event completed + * + * @retval None. + */ +void bsp_evnt_not(EvntNotiState enable); + +/** + * @brief used to assert/trigger the low priority interrupt from the SW. + * + * @param priority: if 1 then this SW ISR should be treated as if it was High priority HW ISR + * + * @retval None. + */ +void bsp_switch_to_lw_isr(uint8_t priority); + +/** + * @brief wait for bus clock ready signal + * + * A platform that has more accurate information about the readiness of the bus clock should implement this function to + * avoid redundant delay while reading sleep timer . + * + * @note this function will be called only if @ref USE_SOC_ACCURATE_BUS_CLK_READY_API is set to one otherwise LL FW will wait for a change in sleep timer reading. + * + * @param None. + * + * @retval None. + */ +void bsp_wait_for_busclkrdy(void); +/** + * @brief used to start temperature calculations + * if the upper layer has informed the link layer by the existence of temperature sensor through @ref ll_intf_set_temperature_sensor_stat() or llhwc_cmn_set_temperature_sensor_stat() . + * New temperature will be requested in the following cases: + * 1- at initialization when the @ref ll_intf_set_temperature_sensor_state or llhwc_cmn_set_temperature_sensor_stat is called + * 2- before any radio event + * Once temperature is ready the upper layer should call @ref ll_intf_set_temperature_value() or llhwc_cmn_set_temperature_value() to inform Link Layer with new Temperature value + * @retval None. + */ +void bsp_request_temperature(void); + +/** + * @brief a function to set a certain gpio pin. + * + * @param gpio[in]: one of the gpios defined in Debug_GPIO_t enum to be set + * + * @retval None. + * + * @note : some of the signals can be mapped to physical hardware and some may not be connected to a physical GPIO based in availability. + */ +void bsp_debug_gpio_set(Debug_GPIO_t gpio); + +/** + * @brief a function to clear a certain gpio pin. + * + * @param gpio[in]: one of the gpios defined in Debug_GPIO_t enum to be cleared + * + * @retval None. + * + * @note : some of the signals can be mapped to physical hardware and some may not be connected to a physical GPIO based in availability. + */ +void bsp_debug_gpio_clear(Debug_GPIO_t gpio); + +/** + * @brief a function to toggle a certain gpio pin. + * + * @param gpio[in]: one of the gpios defined in Debug_GPIO_t enum to be toggled + * + * @retval None. + * + * @note : some of the signals can be mapped to physical hardware and some may not be connected to a physical GPIO based in availability. + */ +void bsp_debug_gpio_toggle(Debug_GPIO_t gpio); + +/** + * @brief a function to inform the upper layer by state of periodic calibration state. + * + * @param state[in]: Value from @ref PhyClbrState, NO_PHY_CLBR_NEEDED when the calibration is completed , PHY_CLBR_PNDING_OR_RUNNING when calibration is started or about to start from background task + * + * @retval None. + */ +void bsp_set_phy_clbr_state(PhyClbrState state); +/** + * @brief a function to notify the upper layer to switch the clock. + * + * @param evnt_timing[in]: Evnt_timing_t pointer to structure contains drift time , execution time and scheduling time + * + * @retval None. + */ +void bsp_evnt_schldr_timing_update_not(Evnt_timing_t * p_evnt_timing); +/** + * @} + */ + +int logCons(void* devHandle, char* logStr); +void* logFileInit(const char * fileName); +int logFileClose(void* fileHandle); +int logFile(void* devHandle, char* logStr); +int logUart(void* devHandle, char* logStr); + + +void bsp_assert_log(uint8_t condition, uint8_t severity, const char *ptr_func_name, const int line); +void bsp_assert(uint8_t condition, uint8_t severity); + + + +#endif /* LL_BSP_H_ */ diff --git a/lib/stm32wba/hci/ll/common_types.h b/lib/stm32wba/hci/ll/common_types.h new file mode 100644 index 000000000..ae91b6e4f --- /dev/null +++ b/lib/stm32wba/hci/ll/common_types.h @@ -0,0 +1,419 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.30a-SOW05PatchV6/firmware/public_inc/common_types.h#1 $*/ +/** + ******************************************************************************** + * @file common_types.h + * @brief This file contains common includes for BLE FW LL. + ****************************************************************************** + * @copy + * This Synopsys DWC Bluetooth Low Energy Combo Link Layer/MAC software and + * associated documentation ( hereinafter the "Software") is an unsupported + * proprietary work of Synopsys, Inc. unless otherwise expressly agreed to in + * writing between Synopsys and you. The Software IS NOT an item of Licensed + * Software or a Licensed Product under any End User Software License Agreement + * or Agreement for Licensed Products with Synopsys or any supplement thereto. + * Synopsys is a registered trademark of Synopsys, Inc. Other names included in + * the SOFTWARE may be the trademarks of their respective owners. + * + * Synopsys MIT License: + * Copyright (c) 2020-Present Synopsys, Inc + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * the Software), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE ARISING FROM, + * OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * */ + +/* Define to prevent recursive inclusion -------------------------------------*/ + +#ifndef COMMON_TYPES_H_ +#define COMMON_TYPES_H_ +#include "_40nm_reg_files/DWC_ble154combo.h" +#include "bsp.h" +#include "ll_fw_config.h" +#include "mem_intf.h" +#include "os_wrapper.h" + + +/********************************************************************** */ +/****************** BLE MAC COMBO Configurations*********************** */ +/********************************************************************** */ +#ifdef BLE +#define SUPPORT_BLE 1 +#else +#define SUPPORT_BLE 0 +#endif + +#ifdef MAC +#define SUPPORT_MAC 1 +#else +#define SUPPORT_MAC 0 +#endif +#ifdef ANT_ROLE +#define SUPPORT_ANT 1 + +#ifdef SUPPORT_ANT_TESTING +#define SUPPORT_ANT_HCI_UART 1 +#else +#define SUPPORT_ANT_HCI_UART 0 +#endif /* SUPPORT_ANT_HCI_UART*/ + +#else +#define SUPPORT_ANT 0 +#define SUPPORT_ANT_HCI_UART 0 +#endif + +#ifdef MAC_LAYER +#define MAC_LAYER_BUILD 1 +#else +#define MAC_LAYER_BUILD 0 +#endif + +#ifdef SUPPORT_MAC_HCI_UART +#define SUPPORT_MAC_HCI_UART 1 +#else +#define SUPPORT_MAC_HCI_UART 0 +#endif + +#ifdef SUPPORT_AUG_MAC_HCI_UART +#define SUPPORT_AUG_MAC_HCI_UART 1 +#else +#define SUPPORT_AUG_MAC_HCI_UART 0 +#endif + +#if((!SUPPORT_BLE)&&(SUPPORT_MAC || SUPPORT_AUG_MAC_HCI_UART)&&(RAL_NUMBER_OF_INSTANCE>1)) +#error "BLE controller must be enabled to support MAC multiple Instances" +#endif + +#if((SUPPORT_MAC)&&(SUPPORT_AUG_MAC_HCI_UART)&&(RAL_NUMBER_OF_INSTANCE<2)) +#error "RAL_NUMBER_OF_INSTANCE must be 2 to support MAC and Augmented MAC" +#endif + +#if((!SUPPORT_BLE)&&(SUPPORT_MAC)&&(SUPPORT_ANT)) +#error "BLE controller must be enabled to support MAC and ANT Coexistence" +#endif +#if (SUPPORT_LE_ENHANCED_CONN_UPDATE) && (!SUPPORT_MASTER_CONNECTION && !SUPPORT_SLAVE_CONNECTION) +#error "LE Enhanced Connection Update(subrating) enabled only if master or slave enabled" +#endif /* (SUPPORT_LE_ENHANCED_CONN_UPDATE) && (!SUPPORT_MASTER_CONNECTION && !SUPPORT_SLAVE_CONNECTION) */ +#define SUPPORT_COEXISTENCE ((SUPPORT_BLE&&SUPPORT_MAC) || (SUPPORT_BLE&&SUPPORT_ANT)) +#define SUPPORT_ANT_COEXISTENCE (SUPPORT_BLE&&SUPPORT_ANT) +/****************** User configuration **********************************/ + +#define SUPPORT_GNRC_SCHDLR_IF (1) + + + + +/********************* Macros **********************************/ + +#ifndef SUCCESS +#define SUCCESS 0 +#endif +#ifndef GENERAL_FAILURE +#define GENERAL_FAILURE -1 +#endif +#ifndef GENERAL_ERROR_STATUS +#define GENERAL_ERROR_STATUS 0xFF +#endif + +#ifndef TRUE +#define TRUE 1 +#endif /* TRUE */ + +#ifndef FALSE +#define FALSE 0 +#endif /* FALSE */ + +#ifndef NULL +#define NULL ((void *)0) +#endif /* NULL */ + +#define MEMSET(ptr_memory, value, memory_size) ble_memset(ptr_memory, value, memory_size) +#define MEMCPY(ptr_destination, ptr_source, memory_size) ble_memcpy(ptr_destination, ptr_source, memory_size) +#define MEMCMP(ptr_destination, ptr_source, memory_size) ble_memcmp(ptr_destination, ptr_source, memory_size) + + + + + +extern os_mutex_id g_ll_lock; +#define LL_LOCK() os_rcrsv_mutex_wait(g_ll_lock,0xffffffff) +#define LL_UNLOCK() os_rcrsv_mutex_release(g_ll_lock) + +#if SUPPORT_MAC && SUPPORT_OPENTHREAD_1_2 +/* compiler flag to control supporting of CSL transmitter , RADIO TX at specific time , 1 supported , 0 not supported */ +#define CONFIG_MAC_CSL_TRANSMITTER_ENABLE 1 +/* compiler flag to control supporting of CSL receiver , RADIO RX at specific time, 1 supported , 0 not supported */ +#define CONFIG_MAC_CSL_RECEIVER_ENABLE 1 +/* compiler flag to control supporting of Radio security handling */ +#define SUPPORT_RADIO_SECURITY_OT_1_2 1 +/* compiler flag to control supporting of Enhanced Ack Link metrics probing */ +#define SUPPORT_ENH_ACK_LINK_METRICS_PROBING_OT_1_2 1 +/* compiler flag to control supporting of Time sync experimental feature of OT 1.2 + * (it is not a thread 1.2 shall not be added except for with OT 1.2 for testing purpose) */ +#define SUPPORT_TIME_SYNC_OT_1_2 1 +#else +#define CONFIG_MAC_CSL_TRANSMITTER_ENABLE 0 +#define CONFIG_MAC_CSL_RECEIVER_ENABLE 0 +#define SUPPORT_RADIO_SECURITY_OT_1_2 0 +#define SUPPORT_ENH_ACK_LINK_METRICS_PROBING_OT_1_2 0 +#define SUPPORT_TIME_SYNC_OT_1_2 0 +#endif /*SUPPORT_MAC && SUPPORT_OPENTHREAD_1_2 */ + +/* end of radio activity custom command flag */ +#define END_OF_RADIO_ACTIVITY_REPORTING 1 /* Enable\Disable end of radio activity reporting feature. Enable:1 - Disable:0 */ + +/* Supported PHYs*/ +typedef enum { + LE_NO_CHANGE = 0x00, + LE_1M = 0x01, + LE_2M = 0x02, + LE_CODED_S8 = 0x03, + LE_CODED = 0x04, +#if (SUPPORT_LE_POWER_CONTROL) + LE_PHY_UNDEFINED = 0xFC, + NEW_PHY_CODED_S2 = 0xFD, + NEW_PHY_CODED_S8 = 0xFE, + NEW_PHY_CODED_COMBINED = 0xFF, +#endif /* SUPPORT_LE_POWER_CONTROL */ + + /* PHY Recommendations - Combined Values */ +#if ((SUPPORT_CONNECTED_ISOCHRONOUS && SUPPORT_MASTER_CONNECTION) || SUPPORT_BRD_ISOCHRONOUS) + RECOMMEND_1M_2M = 0x03, + RECOMMEND_1M_CODED = 0x05, + RECOMMEND_2M_CODED = 0x06, + RECOMMEND_1M_2M_CODED = 0x07, +#endif /* ((SUPPORT_CONNECTED_ISOCHRONOUS && SUPPORT_MASTER_CONNECTION) || SUPPORT_BRD_ISOCHRONOUS) */ +} tx_rx_phy_e; + +/** + * @brief time stamp structure. + */ +typedef struct time_st { + uint32_t time_stamp_base; + uint16_t time_stamp_fine; + uint8_t overflow_flag; +} ble_time_t, *ble_time_p; +typedef enum dpslp_state { + DEEP_SLEEP_ENABLE = 0x01, + DEEP_SLEEP_DISABLE = 0x00 +} dpslp_state_e; + +/** + * @enum crypto_endian_enum_t + * @brief States the available endian formats. + * + */ +typedef enum { + CRYPTO_LITTLE_ENDIAN, + CRYPTO_BIG_ENDIAN +} crypto_endian_enum_t; + +/** + * @enum security_mode_enum_t + * @brief Contains the available security modes. + * + * Note: The enum values should be the same as specified in the register + * address header file. + */ +typedef enum { + ECB_DECRYPT = 0, + CCM_DECRYPT = 1, + ECB_ENCRYPT = 2, + CCM_ENCRYPT = 3, + CTR_ENCRYPT = 4, + CTR_DECRYPT = 5, + MODES_MAX_NUM +} security_mode_enum_t; + +#if SUPPORT_MAC +typedef enum ral_phy_rate_enum { +#if SUPPORT_A_MAC + RAL_RATE_125K = 0x00, + RAL_RATE_1M = 0x02, + RAL_RATE_2M = 0x03, +#endif + RAL_RATE_256K = 0x01 +} ral_phy_rate_enum_t; +#endif /*SUPPORT_MAC*/ +/** + * @enum extrnl_evnt_priority_e + * @brief External Event priority + */ +typedef enum _extrnl_evnt_priority_e +{ + PRIORITY_DEFAULT, + PRIORITY_HIGH, + PRIORITY_CRITICAL +}extrnl_evnt_priority_e; + +/** + * @enum extrnl_evnt_state_e + * @brief External Event Blocked State and reason + */ +typedef enum _extrnl_evnt_state_e +{ + STATE_BLOCKED_UNKNOWN, + STATE_BLOCKED_PRIORITY, + STATE_BLOCKED_CANCELLED, + STATE_BLOCKED_LATE, + STATE_BLOCKED_DEADLINE, + STATE_NOT_BLOCKED +}extrnl_evnt_state_e; + +/** + * @brief Enumeration of the source type used to drive the sleep timer. + */ +typedef enum _slptmr_src_type_e { + CRYSTAL_OSCILLATOR_SLPTMR = 0x00, +#if (USE_NON_ACCURATE_32K_SLEEP_CLK) + RCO_SLPTMR = 0x01, + RTC_SLPTMR = 0x02 +#endif /* USE_NON_ACCURATE_32K_SLEEP_CLK */ +}slptmr_src_type_e; + + + +/* + * @brief structure that hold some information about the data transmitted across layers. + */ +typedef struct ble_buff_hdr_st { + /* pointer to buffer allocated in TX/RX buffer*/ + uint8_t *buff_start; + /* pointer to next ble_buff_hdr node */ + struct ble_buff_hdr_st *next_pkt; + /* Total buffer size */ + uint16_t total_len; + /* offset to data location from the packet start pointed to by buff_start */ + uint16_t data_offset; + /* data size for the data pointed to by buff_start + data_offset*/ + uint16_t data_size; + /* bit field flags to be used for identifying buffer type data/control buffer, + * for data is it a BLE/MAC/ANT, does it contain complete SDU packet of it is a fragment, + * if it is a fragment is it the start or continuation or last fragment. */ + uint8_t ble_hdr_flags; +} pkt_buff_hdr_t ,ble_buff_hdr_t, *ble_buff_hdr_p; + +#if (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS || (SUPPORT_CONNECTED_ISOCHRONOUS && ( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION))) +/** + * @brief: PDU info structure + */ +typedef struct _iso_pdu_buff_hdr_st { + ble_buff_hdr_t pkt; /* PDU Packet */ +#if(SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) + uint8_t flsh_tmout_cnt; /* flush timeout counter */ + uint8_t flsh_tmout_subevnt_cnt; /* flush timeout subevent number */ +#endif //(SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) + uint8_t status; +} iso_pdu_buff_hdr_st; +/** + * @brief: SDU info structure + */ +typedef struct _sdu_buf_hdr_st { + iso_pdu_buff_hdr_st* ptr_last_pdu_buff_hdr; /* pointer to the last pdu buffer header pointed to this sdu */ + struct _sdu_buf_hdr_st* ptr_nxt_sdu_buff_hdr; /* next sdu pointer */ + uint32_t*ptr_sdu_buffer; /* pointer to SDU buffer in system memory for rx*/ + uint32_t time_stamp; /* Time Stamp associated with this SDU */ + uint32_t time_offset; /* Time Offset used only in framed SDUs */ + uint16_t pkt_sqnc_num; /* Packet Sequence Number */ + uint16_t iso_sdu_len; /* ISO SDU data real length */ + uint8_t pkt_status_flag; + uint8_t pb_flag; /* PB_flag used in rx */ + /* + * the first one will have the value 10 complete sdu until a new sdu fragment will be received then it will be 00 first fragment + * the subsequent one will have the value 11 last fragment until a new sdu fragment will be received then it will be 01 continuation fragment + * + * */ +} iso_sdu_buf_hdr_st, *iso_sdu_buf_hdr_p; +#endif /* (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUSs || (SUPPORT_CONNECTED_ISOCHRONOUS && ( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION))) */ + +/* + * @brief Transport layer event + */ +typedef enum { + HCI_CMD_PCKT = 0x01, + HCI_ACL_DATA_PCKT = 0x02, + HCI_EVNT_PCKT = 0x04, + HCI_ISO_DATA_PCKT = 0x05, +#if (SUPPORT_MAC && SUPPORT_MAC_HCI_UART) + HCI_MAC_REQ = 0x0A, + HCI_MAC_CFM = 0x0B, + HCI_MAC_KEY_TBL_CFM = 0x0E, +#endif /* SUPPORT_MAC && SUPPORT_MAC_HCI_UART */ +#if (SUPPORT_ANT_HCI_UART) + HCI_ANT_REQ = 0x07, + HCI_ANT_CFM = 0x08, +#endif /* SUPPORT_ANT_HCI_UART */ +#if (SUPPORT_AUG_MAC_HCI_UART) + AUG_HCI_MAC_REQ = 0x0C, + AUG_HCI_MAC_CFM = 0x0D, +#endif /* SUPPORT_AUG_MAC_HCI_UART */ + +} event_t; + + + +/*constant flags to be used with ble_buff_hdr_t:ble_hdr_flags*/ +#define BLE_BUFF_HDR_STRT_PKT (1<<0) +#define BLE_BUFF_HDR_CNTRL_PKT (1<<1) +#define BLE_BUFF_HDR_BUFF_FRGMNTD (1<<2) +#define BLE_BUFF_HDR_EVNT_CMD_PCKT (1<<3) +#define BLE_BUFF_HDR_ACL_DATA_PCKT (1<<4) + +#if ((SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) \ + ||(SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS)) +#define BLE_BUFF_HDR_NULL_PCKT (1<<3) +/* + * BLE_BUFF_HDR_ISO_DATA_PCKT_BIT1 : BLE_BUFF_HDR_ISO_DATA_PCKT_BIT0 = Mode + * 1 : 1 = Unframed CIS Data PDU; end fragment of an SDU or a complete SDU. LLID (0b00) + * 0 : 1 = Unframed CIS Data PDU; start or continuation fragment of an SDU. + * 1 : 0 = Framed CIS Data PDU; one or more segments of an SDU. + * */ +#define BLE_BUFF_HDR_ISO_DATA_PCKT_BIT0 (1<<5) +#define BLE_BUFF_HDR_ISO_DATA_PCKT_BIT1 (1<<6) +#endif /* (SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) */ +#if (SUPPORT_MAC && SUPPORT_MAC_HCI_UART) +#define BLE_BUFF_HDR_MAC_CMD_PCK (1<<6) +#define BLE_BUFF_HDR_MAC_KEY_TBL_CMD_PCK ((1<<7)|(1<<4)) +#endif /* (SUPPORT_MAC && SUPPORT_MAC_HCI_UART) */ +#if (SUPPORT_ANT_HCI_UART) +#define BLE_BUFF_HDR_ANT_CMD_PCK (1<<7) +#endif /* SUPPORT_ANT_HCI_UART */ +#if (SUPPORT_AUG_MAC_HCI_UART) +#define BLE_BUFF_HDR_AUG_MAC_CMD_PCK ((1<<7)|(1<<6)) +#endif + + +/** + * The default PHY periodic calibration period in second. this Macro can be set to any value , Zero means that phy periodic calibration is disabled + */ +#define DEFAULT_PHY_CALIBRATION_PERIOD 10 /* Time period for PHY calibration = 10s */ + + +#ifndef EXTERNAL_CUSTOM_CMDS +#define EXTERNAL_CUSTOM_CMDS 0 /* Indicates that an external custom HCI commands module exists */ +#endif /* EXTERNAL_CUSTOM_CMDS */ +#define SUPPORT_ZIGBEE_PHY_CERTIFICATION 0 /* 0 disable , 1 enable .. used to enable support of hci command required to implement zigbee phy Test cases*/ + + +#if (!USE_HCI_TRANSPORT) && (SUPPORT_BLE) /* SUPPORT_HCI_EVENT_ONLY cannot be supported with default HCI_transport */ +/* if this marco is enabled it will enable the below features + * -Queue events - ACL - ISO - Reports into different queues + -Allow host to register callback to refuse current controller event and receive it later with another callback*/ +#define SUPPORT_HCI_EVENT_ONLY 1 + +#endif/* (!USE_HCI_TRANSPORT) && (SUPPORT_BLE) */ + +#define SUPPORT_HW_AUDIO_SYNC_SIGNAL 1 +#endif /*COMMON_TYPES_H_*/ diff --git a/lib/stm32wba/hci/ll/event_manager.h b/lib/stm32wba/hci/ll/event_manager.h new file mode 100644 index 000000000..0f47e11a1 --- /dev/null +++ b/lib/stm32wba/hci/ll/event_manager.h @@ -0,0 +1,352 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.30a-SOW05PatchV6/firmware/public_inc/event_manager.h#1 $*/ +/** + ******************************************************************************** + * @file event_manager.h + * @brief This file contains all the functions prototypes for the event_manager.c. + ****************************************************************************** + * @copy + * This Synopsys DWC Bluetooth Low Energy Combo Link Layer/MAC software and + * associated documentation ( hereinafter the "Software") is an unsupported + * proprietary work of Synopsys, Inc. unless otherwise expressly agreed to in + * writing between Synopsys and you. The Software IS NOT an item of Licensed + * Software or a Licensed Product under any End User Software License Agreement + * or Agreement for Licensed Products with Synopsys or any supplement thereto. + * Synopsys is a registered trademark of Synopsys, Inc. Other names included in + * the SOFTWARE may be the trademarks of their respective owners. + * + * Synopsys MIT License: + * Copyright (c) 2020-Present Synopsys, Inc + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * the Software), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE ARISING FROM, + * OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * */ +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef INCLUDE_EVENT_MANAGER_H_ +#define INCLUDE_EVENT_MANAGER_H_ +#include +#include "ll_fw_config.h" +#include "common_types.h" + +/* Defination ----------------------------------------------------------------*/ +/*Event manager events*/ +#define EVENT_PENDING 1 +#define HANDLE_IS_FULL 77 +#define NO_EVENT_PENDING 0 + + +#define EVENT_NOT_BUSY 0 +#define EVENT_BUSY 1 + +#if (NUM_OF_CTSM_EMNGR_HNDLS > 3) +#error "NUM_OF_CTSM_EMNGR_HNDLS shouldn't exceed 3 !" +#endif + + + +typedef uint8_t (*conditional_cbk)(void * em_data , void * caller_data); + + + +/** + * @brief Enum event manager handler types. + */ + /* Event Manager IDs */ +typedef enum { +#if SUPPORT_BLE + LLHWC_EVENT, + PRDC_CLBR_EVENT, +#if ((SUPPORT_MASTER_CONNECTION) || (SUPPORT_SLAVE_CONNECTION)) + CONN_EVENT, /*connection event handler ID*/ + CONN_PARAM_UPDATE_EVENT, /* handler for connection parameter update initiated by link layer */ +#if(SUPPORT_CONNECTED_ISOCHRONOUS &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) + CIS_EVENT, +#endif /*SUPPORT_CONNECTED_ISOCHRONOUS*/ +#endif /* SUPPORT_MASTER_CONNECTION) || (SUPPORT_SLAVE_CONNECTION */ +#if(SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS) + BIS_TERM_EVENT, +#if(SUPPORT_SYNC_ISOCHRONOUS) + BIS_SYNC_TIMEOUT_EVENT, +#endif /* SUPPORT_EXPLCT_OBSERVER_ROLE */ +#endif /* SUPPORT_BROADCAST_ISOCHRONOUS */ +#endif /*SUPPORT_BLE*/ +#if ((SUPPORT_BLE)||(SUPPORT_MAC_HCI_UART)||(SUPPORT_ANT_HCI_UART) || (SUPPORT_AUG_MAC_HCI_UART)) + HCI_HANDLER, /* handler for the HCI events; handling events from Host to HCI*/ +#endif /*SUPPORT_BLE*/ +#if SUPPORT_BLE +#if SUPPORT_LE_EXTENDED_ADVERTISING + ADV_TIMEOUT_EVENT, /*handler for advertising extended timeout feature */ + SCN_DURATION_EVENT, /*handler for extended scanning duration */ + SCN_PERIOD_EVENT, /*handler for extended scanning period */ + PRDC_SCAN_TIMEOUT_EVENT, /*handler for periodoc scan sync timeout */ + PRDC_SCAN_CANCEL_EVENT, +#endif /* SUPPORT_LE_EXTENDED_ADVERTISING */ +#endif /*SUPPORT_BLE*/ +#if SUPPORT_COEXISTENCE + COEX_TIMER_EVENT, +#endif +#if SUPPORT_MAC + RAL_SM_DONE_EVENT, + MAC_SM_DONE_EVENT, + ED_TMR_EVENT, +#endif /*SUPPORT_MAC*/ +#if ((SUPPORT_BLE)||(SUPPORT_MAC_HCI_UART)||(SUPPORT_ANT_HCI_UART) || (SUPPORT_AUG_MAC_HCI_UART)) + HCI_TRANSPORT_HANDLER, /* handler for the HCI transport events; handling events from HCI to Host */ +#endif /*SUPPORT_BLE*/ +#if (SUPPORT_HCI_EVENT_ONLY) + GENERIC_EVENT, +#if SUPPORT_SYNC_ISOCHRONOUS || SUPPORT_CONNECTED_ISOCHRONOUS + ISO_DATA_EVENT, +#endif /* SUPPORT_SYNC_ISOCHRONOUS || SUPPORT_CONNECTED_ISOCHRONOUS */ +#if SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION + ACL_DATA_EVENT, +#endif /* SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION */ +#if SUPPORT_EXPLCT_OBSERVER_ROLE || SUPPORT_MASTER_CONNECTION || SUPPORT_SYNC_ISOCHRONOUS || (SUPPORT_AOA_AOD && SUPPORT_SLAVE_CONNECTION) + ADV_REPORT_EVENT, +#endif /* SUPPORT_EXPLCT_OBSERVER_ROLE || SUPPORT_MASTER_CONNECTION || SUPPORT_SYNC_ISOCHRONOUS || (SUPPORT_AOA_AOD && SUPPORT_SLAVE_CONNECTION) */ +#endif /* SUPPORT_HCI_EVENT_ONLY */ +#if ((SUPPORT_MAC) && (MAC_LAYER_BUILD)) + MLME_TIMER_EVENT, + DIRECT_DATA_TX_EVENT, + INDIRECT_DATA_TIMEOUT_EVENT, +#if SUPPORT_MAC_HCI_UART + MAC_HCI_HANDLER, +#endif /* SUPPORT_MAC_HCI_UART */ +#endif/*((SUPPORT_MAC) && (MAC_LAYER_BUILD)) */ +#if ((!SUPPORT_COEXISTENCE) && (SUPPORT_OPENTHREAD_1_2 && CONFIG_MAC_CSL_RECEIVER_ENABLE)) + CSL_RCV_TMR_EVENT, +#endif /*((!SUPPORT_COEXISTENCE) && (SUPPORT_OPENTHREAD_1_2 && CONFIG_MAC_CSL_RECEIVER_ENABLE))*/ +#if(!SUPPORT_COEXISTENCE && DEFAULT_PHY_CALIBRATION_PERIOD && SUPPORT_MAC) + PRDC_CLBR_TMR_EVENT, +#endif +#if SUPPORT_AUG_MAC_HCI_UART + AUG_MAC_HCI_HANDLER, +#endif/*SUPPORT_AUG_MAC_HCI_UART */ +#if SUPPORT_ANT + ANT_RADIO_CMPLT_EVENT, + ANT_STACK_TASK_EVENT, +#if SUPPORT_ANT_HCI_UART + ANT_HCI_HANDLER, +#endif /*SUPPORT_ANT_TESTING */ +#endif /* SUPPORT_ANT */ +#if (NUM_OF_CTSM_EMNGR_HNDLS >= 1) + CUSTOM_HANDLE_1, +#endif +#if (NUM_OF_CTSM_EMNGR_HNDLS >= 2) + CUSTOM_HANDLE_2, +#endif +#if (NUM_OF_CTSM_EMNGR_HNDLS >= 3) + CUSTOM_HANDLE_3, +#endif + + MAX_EM_HANDLE +} handler_t; +/* Exported functions ------------------------------------------------------- */ + + + +/** + * @brief Used to initialize the event manager component. + * + * @param None. + * + * @retval None. + */ +void emngr_init(void); + +/** + * @brief Used to reset the event manager structure. + * + * @param None. + * + * @retval Status : 0: SUCCESS. Otherwise: FAILED. + */ +int emngr_reset(void); + +/** @ingroup event_manager_functions + * @{ + */ +/** + * @brief Used to initialize a certain handle in the event manager. + * + * @param id : [in] ID of the handle to be initialized. [Range: 0 to 255]. + * @param max : [in] Maximum number of events that can be added to this handle. [Range: 0 to 255]. + * @param call_back_fun : [in] Pointer to the function that will process the events of that handle. + * + * @retval Status : 0: SUCCESS. Otherwise: FAILED. + */ +int emngr_handle_init(unsigned char id, unsigned char max, + void (*call_back_fun)(void *)); + +/** + * @brief Used to remove a certain handle from the event manager. + * + * @param id : [in] ID of the handle to be removed. [Range: 0 to 255]. + * + * @retval Status : 0: SUCCESS. Otherwise: FAILED. + */ +int emngr_handle_remove( + unsigned char id); + +/** + * @brief Used to post an event to a certain event manager handle that is identified by the handle ID. + * + * @param id : [in] ID of the handle to which the event will be posted. [Range: 0 to 255]. + * @param event : [in] Void pointer pointing to the data related to the posted event. + * + * @retval Status : 0: SUCCESS. Otherwise: FAILED. + */ +int emngr_post_event(unsigned char id, void *event); + +/** + * @brief Used to post an event to a certain event manager handle that is identified by the handle ID. + * This Event will be handled first + * + * @param id : [in] ID of the handle to which the event will be posted. [Range: 0 to 255]. + * @param event : [in] Void pointer pointing to the data related to the posted event. + * + * @retval Status : 0: SUCCESS. Otherwise: FAILED. + */ +int emngr_post_event_first(unsigned char id ,void *event); + +/** + * @brief Used to get an event from a certain event manager handle that is identified by the handle ID. + * + * @param id : [in] ID of the handle whose events are to be gotten. [Range: 0 to 255]. + * + * @retval event handle : Void pointer pointing to the returned event. + */ +void * emngr_get_event(unsigned char id); + +/** + * @brief Used to process an event from a a certain event manager handle that is identified by the handle ID, by first getting the event (in case the handle contains any) then processing it through the associated callback function. + * + * @param id : [in] ID of the handle whose events are to be processed. [Range: 0 to 255]. + * + * @retval Status : 0: SUCCESS. Otherwise: FAILED. + */ +int emngr_process_event(unsigned char id); + +/** + * @brief Used to return the number of events in the event manager. + * + * @param None. + * + * @retval Events Number. + */ +int emngr_get_total_events(void); + +/** + * @brief Used to return the number of events in a certain handle that is identified by the handle ID. + * + * @param id : [in] ID of the handle whose events number is to be returned. [Range: 0 to 255]. + * + * @retval Events Number per handle. + */ +int emngr_get_handle_events(unsigned char id); + +/** + * @brief Used to set a flag "busy_flag" to determine whether a certain handle is busy processing an event. + * + * @param id : [in] ID of the handle whose "busy_flag" parameter value is to be set. [Range: 0 to 255]. + * @param busy_flag : [in] Value to be set to the "busy_flag" parameter. 0: EVENT_NOT_BUSY. 1: EVENT_BUSY. + * + * @retval None. + */ +void emngr_set_event_handle_busy(unsigned char id, unsigned char busy_flag); + +/** + * @brief Used to return the state of the event "busy_flag", which indicates whether the events of a certain handle, identified by the handle ID, are being currently processed. + * + * @param id : [in] ID of the handle whose events are being currently processed. [Range: 0 to 255]. + * + * @retval busy_flag state : 0: EVENT_NOT_BUSY. 1: EVENT_BUSY. + */ +int emngr_is_event_busy( + unsigned char id); + +/** + * @brief Used to loop through all the registered handles in the event manager and process their events, if any exists. + * + * @param None. + * + * @retval None. + */ +void emngr_handle_all_events(void); + +/** + * @brief Used to process an event of a certain event manager handle that is identified by the handle ID. + * + * @param id : [in] ID of the handle whose event is to be processed. [Range: 0 to 255]. + * + * @retval None. + */ +void emngr_handle_event(handler_t id); + +/** + * @brief Used to return a pointer to the first event in a certain event manager handle, identified by the handle ID, without dequeuing that event. + * + * @param id : [in] ID of the handle whose first event is to be returned without being removed from the handle queue. [Range: 0 to 255]. + * + * @retval : void Pointer to the first event of the specified handle. + */ +void * emngr_peak_frst_event(unsigned char id); + +/** + * @brief Used to delete an event from a certain event manager handle, identified by the handle ID. + * + * @param id : [in] ID of the handle whose one of its events is to be deleted. [Range: 0 to 255]. + * @param data : [in] Pointer to the event data to be used for searching for the event to be deleted out of all the events in the specified handle. + * + * @retval handle : Void pointer to the event data of the event node that is being deleted. + */ +void * emngr_del_event(unsigned char id, void *data); + + +/* @breif Used to remove a certain event within a queue that satisfies the condition set by cbk + * the cbk can delete priv data if it has allocated data. + * @param id: [In] ID of the queue to search for + * @param only_one_event: [In] if False delete all events that satisfies the condition + * @param conitional_data: [In] Optional pointer to pass to cbk along with priv data + * @param cbk: [In] A callback function that returns True if the event priv data satisfies a condition + * @retval True if any event was found and removed + * */ +uint8_t emngr_remove_conditional_event( uint8_t id, uint8_t only_one_event, + void* conditional_data, conditional_cbk cbk); + + +/* + * @brief Check if MCU can sleep in the case that all events in the event manager are busy and + * of type that allows sleep while busy. + * @retval True if MCU can sleep. + * */ +uint8_t emngr_can_mcu_sleep(void); + +/* @breif Used to process a certain event within a queue that satisfies the condition set by cbk + * @param id: [In] ID of the queue to search for + * @param only_one_event: [In] if False process all events that satisfies the condition + * @param conitional_data: [In] Optional pointer to pass to cbk along with priv data + * @param cbk: [In] A callback function that returns True if the event priv data satisfies a condition + * */ +uint8_t emngr_process_conditional_event( uint8_t id, uint8_t only_one_event, + void* conditional_data, conditional_cbk cbk); + +/** + * @} + */ + +#endif /* INCLUDE_EVENT_MANAGER_H_ */ + diff --git a/lib/stm32wba/hci/ll/evnt_schdlr_gnrc_if.h b/lib/stm32wba/hci/ll/evnt_schdlr_gnrc_if.h new file mode 100644 index 000000000..92ff7af85 --- /dev/null +++ b/lib/stm32wba/hci/ll/evnt_schdlr_gnrc_if.h @@ -0,0 +1,209 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.30a-SOW05PatchV6/firmware/public_inc/evnt_schdlr_gnrc_if.h#1 $*/ +/** + ******************************************************************************** + * @file evnt_schdlr_gnrc_if.h + * @brief This file contains all the functions prototypes for the evnt_schdlr.c + * that are used by other layers to interface with the scheduler. + ****************************************************************************** + * @copy + * This Synopsys DWC Bluetooth Low Energy Combo Link Layer/MAC software and + * associated documentation ( hereinafter the "Software") is an unsupported + * proprietary work of Synopsys, Inc. unless otherwise expressly agreed to in + * writing between Synopsys and you. The Software IS NOT an item of Licensed + * Software or a Licensed Product under any End User Software License Agreement + * or Agreement for Licensed Products with Synopsys or any supplement thereto. + * Synopsys is a registered trademark of Synopsys, Inc. Other names included in + * the SOFTWARE may be the trademarks of their respective owners. + * + * Synopsys MIT License: + * Copyright (c) 2020-Present Synopsys, Inc + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * the Software), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE ARISING FROM, + * OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * */ + + /** + * @ingroup gnrc_schdlr_intf + * @brief Provides APIs to register an external event in the system, all operations for utilizing the generic interface are part of the APIs in evnt_schdlr_gnrc_if.h header file. + * * @{ + */ +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef INCLUDE_EVNT_GNRC_SCHDLR_IF_H_ +#define INCLUDE_EVNT_GNRC_SCHDLR_IF_H_ + + +/* Includes ------------------------------------------------------------------*/ +#include + +#include "bsp.h" +#include "os_wrapper.h" +#include "common_types.h" + +typedef void* ext_evnt_hndl_t; + + +/** + * @brief Generic External Event node that holds the the external event information. + * @note All parameters that are related to time assumed to be in microseconds + */ +typedef struct _extrnl_evnt_st_t{ + /** Event must end before this point in time (us) it is an optional parameter and + * it should set with zero if not used by stack.*/ + uint64_t deadline; + + /** Earliest time the event can start (us) , it is an optional parameter and + * it should set with zero if not used by stack.it is not logical to have periodic event with max start time. + * So, it will be neglected and never checked in case of periodic event.*/ + uint64_t strt_min; + /** Latest time the event can start (us), it is an optional parameter and + * it should set with zero if not used by stack.*/ + uint64_t strt_max; + /** Minimum amount of time that must be allocated to the event (us) , */ + uint32_t durn_min; + /** Maximum amount of time that the event is requesting (us), it is an optional parameter and + * it should set with zero if not used by stack.*/ + uint32_t durn_max; + /** Periodicity of the event (us), 0: Not Periodic + * if the value is not zero , it should be multiple of 1250 us to be aligned with BLE events.*/ + uint32_t prdc_intrvl; + /** Priority of the event from @ref _extrnl_evnt_priority_e*/ + extrnl_evnt_priority_e priority; + /** Event blocked or not, and reason if blocked from @ref _extrnl_evnt_state_e */ + extrnl_evnt_state_e blocked; + /** Pointer to private data that should passed with the call back function */ + void* ptr_priv; + /** Event Started Callback Function , this function will be called at the allocated time to do the job related to + * executing the event, it must not be NULL. + * At the end of given grant, @ref evnt_schdlr_gnrc_evnt_cmplt function should be called to inform scheduler + * that the event is finished, and PHY should not be accessed after that call until a new grant is given + * from event scheduler. @ref evnt_strtd_cbk should handle calling of @ref evnt_schdlr_gnrc_evnt_cmplt via timer or + * at the end of execution if the execution is blocking + * + * if @ref slot_durn is set to zero "0" , event scheduler has given the on idle event unlimited grant. + * It will be aborted later with a calling to evnt_abortd_cbk function.*/ + uint32_t (*evnt_strtd_cbk)(ext_evnt_hndl_t evnt_hndl, + uint32_t slot_durn, void* priv_data_ptr); + /** Event Blocked Callback Function , called if the event is blocked due deadline or other reasons as + * in @ref blocked_state .it could be NULL if not used by stack + * if it is not NULL ,it will be called when event exceeded the given maximum start time or the given deadline while scheduling the event*/ + uint32_t (*evnt_blckd_cbk)(extrnl_evnt_state_e blocked_state); + /** Event Aborted Callback Function. it could be NULL if not used by stack. it will be called when event execution is aborted. + * the event @ref EXTRNL_ON_IDLE is the only event type that can be aborted so it must not be NULL for this event type + * when it is called from event scheduler, the stack should stop all running operation that access phy, + * no need to call @ref evnt_schdlr_gnrc_evnt_cmpltafter calling this callback as it is called from scheduler itself. + * */ + uint32_t (*evnt_abortd_cbk)(); +#if (RADIO_CSMA) + /** Event coexistence error Callback Function. it will be called when @ref EXTRNL_GNRC event execution returned error. + * when @ref evnt_strtd_cbk of @ref EXTRNL_GNRC failed at execution for any reason, this callback will be called from event scheduler, + * it'll send the returned error to ral_tx_done to check if there will retransmission of failed packet or send the error to upper layers, + * */ + void (*coex_error_cbk)(uint32_t error); +#endif /*end of (RADIO_CSMA)*/ +} extrnl_evnt_st_t; +#if(SUPPORT_COEXISTENCE || SUPPORT_GNRC_SCHDLR_IF) +/** + * @brief request duration extension of previous registered external generic event. + * + * @param evnt_hndl_t [in] : Event handle of registered event. + * @param updated_priority [in] : Updated priority of the event during new extend request. + * @param flxbl_req [in] : Flexible request flag, + * True: scheduler will try to extend duration with available duration up to requested deadline + * False: scheduler will try to extend duration with requested duration only (full requested duration or not) + * @param reqstd_deadline [in and out] : Pointer to new end time that the event request to extend the grant to it. + * It is also will be used as an output to report the given grant end time if the request is successfully accepted.. + * @retval Status (0: SUCCESS, 0xXX: ERROR_CODE from @ref ble_stat_t). + */ +uint32_t evnt_schdlr_extend_gnrc_evnt_durn(ext_evnt_hndl_t evnt_hndl, extrnl_evnt_priority_e updated_priority, + uint8_t flxbl_req, uint64_t *reqstd_deadline); + +/** + * @brief register external generic event. + * This function is used to register external generic event in event scheduler.all required information to schedule this event are contained in @ref p_extrnl_evnt_st parameter + * @param p_extrnl_evnt_st [in] : Pointer to external event structure. + * @retval evnt_hndl_t : The event handle of registered event. + * @retval NULL : means that the event is not registered. + */ +ext_evnt_hndl_t evnt_schdlr_rgstr_gnrc_evnt(extrnl_evnt_st_t* p_extrnl_evnt_st); + +/** + * @brief un-register external generic/ onidle event. + * This function is used to remove external generic event from event scheduler. + * @param evnt_hndl [in] : Event handle of generic event to be removed from scheduler. + * @retval Status (0: SUCCESS, 0xXX: ERROR_CODE from @ref ble_stat_t). + */ +uint32_t evnt_schdlr_unrgstr_gnrc_evnt(ext_evnt_hndl_t evnt_hndl); +/** + * @brief register external on idle event. + * + * the external on idle event is low priority event that will be executed in scheduler idle time. + * if multiple on idle events are registered the scheduler will divide the idle on them in round robin manner. + * @note All parameters in in @ ref _extrnl_evnt_st_t will be ignored except ptr_priv parameter, + * as it will be passed to event started call back + * @note @ref evnt_strtd_cbk and @ref evnt_abortd_cbk pointers must not be NULL, + * as event scheduler will call evnt_abortd_cbk to stop current running on idle event + * if other higher event wants to access air while on idle event has grant to access it. + * + * @note There is no need to call this function more than once as the event scheduler + * stores the event and will call it every time it has a window to start on idle event + * + * @param p_extrnl_evnt_st [in] : Pointer to external event structure. + * @retval evnt_hndl_t : The event handle of registered event. + * @retval NULL : means that the event is not registered. + */ +ext_evnt_hndl_t evnt_schdlr_rgstr_on_idle_evnt(extrnl_evnt_st_t* p_extrnl_evnt_st); +#if SUPPORT_COEXISTENCE +/** + * @brief Disable aborting the on idle event given by the handle @ref on_idle_evnt_hdl. the user should call @ref evnt_schdlr_gnrc_evnt_cmplt after the event is completed + * + * @note the usage of this function should be limited to the cases where the event can't be aborted like MAC DTM. and the user should return the grant to scheduler as fast as possible. + * if this function is called where the event is granted, scheduler will ignore all other event till the grant is return to scheduler. it is not recommended to use this function + * + * @param on_idle_evnt_hdl [in] : handle of the on the idle event to disable aborting it + * @retval None + */ +void evnt_schdlr_disable_idle_abort(ext_evnt_hndl_t on_idle_evnt_hdl); +#endif /* SUPPORT_COEXISTENCE */ +#endif /* (#if SUPPORT_COEXISTENCE || SUPPORT_GNRC_SCHDLR_IF) */ + +/** + * @brief external generic event complete. + * + * This function is used to return the grant back to event scheduler + * at the end of duration given at the started function from event scheduler @ref _extrnl_evnt_st_t for more info + * + * @param evnt_hndl_t [in] : Event handle of registered event. + * @retval Status (0: SUCCESS, 0xXX: ERROR_CODE from @ref ble_stat_t). + */ +uint32_t evnt_schdlr_gnrc_evnt_cmplt(ext_evnt_hndl_t evnt_hndl); +#if(SUPPORT_COEXISTENCE || SUPPORT_GNRC_SCHDLR_IF) +/** + * @brief Confirm the event currently has grant to access phy from event scheduler. + * + * @param evnt_hndl [in] : pointer of event scheduler handle. + * @retval 1: grant given. + * @retval 0: no grant given. + */ +uint8_t evnt_schdlr_confrm_grant(void * evnt_hndl); +#endif /* (SUPPORT_COEXISTENCE || SUPPORT_GNRC_SCHDLR_IF) */ + +#endif /* INCLUDE_EVNT_SCHDLR_IF_H */ +/** + * @} + */ + + diff --git a/lib/stm32wba/hci/ll/hci.h b/lib/stm32wba/hci/ll/hci.h new file mode 100644 index 000000000..c0c9d3018 --- /dev/null +++ b/lib/stm32wba/hci/ll/hci.h @@ -0,0 +1,236 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.30a-SOW05PatchV6/firmware/public_inc/hci.h#1 $*/ +/** + ******************************************************************************** + * @file hci.h + * @brief This file contains all the functions prototypes for the hci.h. + ****************************************************************************** + * @copy + * This Synopsys DWC Bluetooth Low Energy Combo Link Layer/MAC software and + * associated documentation ( hereinafter the "Software") is an unsupported + * proprietary work of Synopsys, Inc. unless otherwise expressly agreed to in + * writing between Synopsys and you. The Software IS NOT an item of Licensed + * Software or a Licensed Product under any End User Software License Agreement + * or Agreement for Licensed Products with Synopsys or any supplement thereto. + * Synopsys is a registered trademark of Synopsys, Inc. Other names included in + * the SOFTWARE may be the trademarks of their respective owners. + * + * Synopsys MIT License: + * Copyright (c) 2020-Present Synopsys, Inc + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * the Software), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE ARISING FROM, + * OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * */ + +/** @defgroup hci_intf HCI Layer + * @ingroup BLE_STACK_API + * @brief Provide APIs to interface with HCI layer, like HCI layer initialization, allocation and free of HCI buffer header, process the received HCI command packet ...etc, HCI APIS are defined in hci.h header file. + * @{ + */ +/* Define to prevnt recursive inclusion */ +#ifndef INCLUDE_HCI_H +#define INCLUDE_HCI_H + +/* Includes ---------------------------------------------------------------------*/ + +#include +#include "bsp.h" +#include "ll_intf.h" + +/* Exported Enumerations -----------------------------------------------------*/ + +/** + * @brief Enumeration holding the types of the returned commands in response + * to a received HCI command. + */ +typedef enum { + HCI_RETURN_COMMAND_TYPE_COMPLETE, + HCI_RETURN_COMMAND_TYPE_STATUS, +} hci_return_command_type; + +/* Exported Defines -----------------------------------------------------------*/ + +typedef uint8_t (*hci_trnsprt_cbk)( + ble_buff_hdr_t *ptr_evnt_hdr); + +/** @ingroup ext_hci_cmds External HCI Commands + * @{ + */ +typedef ble_stat_t (*ble_ext_custm_cb_t) (uint16_t ocf, uint8_t *pckt_p, uint8_t *evnt_pckt_p, uint8_t* params_length, hci_return_command_type* return_command_type); +/**@} + */ + +/* Exported functions ---------------------------------------------------------*/ + +/** + * @brief Initialize the HCI layer and Registers a callback function to the upper layer + * + * @param p_trnsprt_cbk : [in] callback function + * + * @retval always returns SUCCESS + */ +ble_stat_t ll_hci_init( + hci_trnsprt_cbk p_trnsprt_cbk); + +/** + * @brief get a pointer to the HCI dispatch table. + * + * @param p_p_dispatch_tbl : [out] pointer to be filled by the address of the HCI dispatch table. + */ +void hci_get_dis_tbl( + const struct hci_dispatch_tbl** p_p_dispatch_tbl); + +#if !SUPPORT_HCI_EVENT_ONLY || SUPPORT_HCI_EVENT_ONLY_TESTING +#if (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) +/** + * @brief Process the received ACL data packet from the host. + * + * @param ptr_buff_hdr : [in] Pointer to the HCI command packet. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t hci_rcvd_acl_data_pckt_hndlr( + ble_buff_hdr_t *ptr_buff_hdr); +#endif /* (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) */ + +#if ((SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) || (SUPPORT_BRD_ISOCHRONOUS)) +/** + * @brief Process the received ISO data packet from the host. + * + * @param ptr_buff_hdr : [in] Pointer to the HCI command packet. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t hci_rcvd_iso_data_pckt_hndlr( + ble_buff_hdr_t *ptr_buff_hdr); +#endif /* ((SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) || SUPPORT_BRD_ISOCHRONOUS) */ +#endif /* !SUPPORT_HCI_EVENT_ONLY || SUPPORT_HCI_EVENT_ONLY_TESTING */ + + +/** + * @brief Process the received HCI command packet from the host. + * + * @param ptr_rcvd_pckt_strt : [in] Pointer to the HCI command packet. + * @param rcvd_pckt_len : [in] Length of the HCI command packet. + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t hci_rcvd_cmd_pckt_hndlr( + uint8_t *ptr_rcvd_pckt_strt, + uint16_t rcvd_pckt_len); + +/** + * @brief allocate a message structure to be sent to the HCI layer through event manager. + * + * @retval ble_buff_hdr_t* : pointer to the buffer header allocated. + */ +ble_buff_hdr_t* hci_alloc_msg(void); + +/** + * @brief free an allocated message structure + * + * @param ptr_hci_msg : [in] Pointer to the message to be freed. + */ +void hci_free_msg( + ble_buff_hdr_t *ptr_hci_msg); +/** + * @} + */ + +/** @ingroup ext_hci_cmds External HCI Commands + * @{ + */ +/** + * @brief Registers a custom callback function to be called when the + * hci_cstm_pckt_hndlr() cannot resolve the OCF. + * + * @param ext_custm_cbk :[IN] Pointer to the callback function. + * + * @retval False if the cbk is null, True otherwise. + */ +uint8_t hci_rgstr_ble_external_custom_cbk(ble_ext_custm_cb_t ext_custm_cbk); + +/**@} + */ + + +#if SUPPORT_HCI_EVENT_ONLY + +/** + * @brief Initialize event manager data/events queue call backs + * + * @retval ble_stat_t None + */ +void hci_init_events_queues(); +/** + * @brief Post data/event to appropriate queue. This function is called + * in case of sending data/events to host + * + * @param ptr_evnt_hdr data/event ble_buff_hdr to send + * + * @retval ble_stat_t None + */ +uint8_t hci_queue_send_pckt(ble_buff_hdr_t *ptr_evnt_hdr); + +/* + * @brief register callback to be called sending data to host + * @param upper_layer_cbk: host callback + * @retval None + * */ +void hci_rgstr_hst_cbk(hst_cbk cbk); +/* + * @brief register callback to be called on LL queue is full + * This function should be called at initialization + * @param cbk: host callback + * @retval None + * */ +void hci_rgstr_hst_cbk_ll_queue_full(hst_cbk_queue_full cbk); + +/* + * @brief sets the LE event mask in hci event only configuration + * @param event_mask : [In] an array of 8 bytes representing new event mask + * @retval: None + * */ +void hci_ll_set_le_event_mask(uint8_t event_mask[8]); + + +/* + * @brief sets the event mask in hci event only configuration + * @param event_mask : [In] an array of 8 bytes representing new event mask + * @retval: None + * */ +void hci_ll_set_event_mask(uint8_t event_mask[8]); + + +/* + * @brief sets the page 2 event mask in hci event only configuration + * @param event_mask : [In] an array of 8 bytes representing new event mask + * @retval: None + * */ +void hci_ll_set_event_mask_page2(uint8_t event_mask[8]); + +/* + * @brief sets the custom event mask in hci event only configuration + * @param cstm_evnt_mask : [In] custom event mask bitfield + * @retval: None + * */ +void hci_ll_set_custom_event_mask(uint8_t cstm_evnt_mask); + +#endif /* SUPPORT_HCI_EVENT_ONLY */ + +#endif /* INCLUDE_HCI_H */ + + + diff --git a/lib/stm32wba/hci/ll/ll_fw_config.h b/lib/stm32wba/hci/ll/ll_fw_config.h new file mode 100644 index 000000000..1b455220c --- /dev/null +++ b/lib/stm32wba/hci/ll/ll_fw_config.h @@ -0,0 +1,100 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.30a-SOW05PatchV6/firmware/public_inc/ll_fw_config.h#1 $*/ +/** + ******************************************************************************** + * @file ll_fw_config.h + * @brief This file contains the major configurations to the BLE controller. + ****************************************************************************** + * @copy + * This Synopsys DWC Bluetooth Low Energy Combo Link Layer/MAC software and + * associated documentation ( hereinafter the "Software") is an unsupported + * proprietary work of Synopsys, Inc. unless otherwise expressly agreed to in + * writing between Synopsys and you. The Software IS NOT an item of Licensed + * Software or a Licensed Product under any End User Software License Agreement + * or Agreement for Licensed Products with Synopsys or any supplement thereto. + * Synopsys is a registered trademark of Synopsys, Inc. Other names included in + * the SOFTWARE may be the trademarks of their respective owners. + * + * Synopsys MIT License: + * Copyright (c) 2020-Present Synopsys, Inc + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * the Software), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE ARISING FROM, + * OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * */ +#ifndef INCLUDE_LL_FW_CONFIG_H +#define INCLUDE_LL_FW_CONFIG_H + + +/*************************** BLE Configuration *************************************/ +/*Configurations of BLE will apply only when BLE is enabled*/ +/* Roles configurations */ +#define SUPPORT_EXPLCT_OBSERVER_ROLE 1 /* Enable\Disable Explicit observer role. Enable:1 - Disable:0 */ +#define SUPPORT_EXPLCT_BROADCASTER_ROLE 1 /* Enable\Disable Explicit broadcaster role. Enable:1 - Disable:0 */ +#define SUPPORT_MASTER_CONNECTION 1 /* Enable\Disable Master connection role. Enable:1 - Disable:0 */ +#define SUPPORT_SLAVE_CONNECTION 1 /* Enable\Disable Slave connection role. Enable:1 - Disable:0 */ + +/* Standard features configurations */ +#define SUPPORT_LE_ENCRYPTION 1 /* Enable\Disable Encryption feature. Enable:1 - Disable:0 */ +#define SUPPORT_PRIVACY 1 /* Enable\Disable Privacy feature. Enable:1 - Disable:0 */ + +/* Capabilities configurations */ +#define MAX_NUM_CNCRT_STAT_MCHNS 8 /* Set maximum number of states the controller can support */ +#define USE_NON_ACCURATE_32K_SLEEP_CLK 1 /* Allow to drive the sleep clock by sources other than the default crystal oscillator source.*/ + /*LL can use crystal oscillator or RTC or RCO to drive the sleep clock.This selection is done via "DEFAULT_SLEEP_CLOCK_SOURCE" macro. */ +#define SUPPORT_LE_EXTENDED_ADVERTISING 1 /* Enable\Disable Extended advertising feature. Enable:1 - Disable:0 */ +#define SUPPORT_LE_PERIODIC_ADVERTISING 1 /* Enable\Disable Periodic advertising feature. Enable:1 - Disable:0 */ +#define SUPPORT_LE_POWER_CLASS_1 0 /* Enable\Disable Low power class 1 feature. Enable:1 - Disable:0 */ +#define SUPPORT_AOA_AOD 1 /* Enable\Disable AOA_AOD feature. Enable:1 - Disable:0 */ +#define SUPPORT_PERIODIC_SYNC_TRANSFER 1 /* Enable\Disable PAST feature. Enable:1 - Disable:0 */ +#define SUPPORT_SLEEP_CLOCK_ACCURCY_UPDATES 1 /* Enable\Disable Sleep Clock Accuracy Updates Feature. Enable:1 - Disable:0 */ +#define SUPPORT_CONNECTED_ISOCHRONOUS 1 /* Enable\Disable Connected Isochronous Channel Feature. Enable:1 - Disable:0 */ +#define SUPPORT_BRD_ISOCHRONOUS 1 /* Enable\Disable Broadcast Isochronous Channel Feature. Enable:1 - Disable:0 */ +#define SUPPORT_SYNC_ISOCHRONOUS 1 /* Enable\Disable Broadcast Isochronous Synchronizer Channel Feature. Enable:1 - Disable:0 */ +#define SUPPORT_LE_POWER_CONTROL 1 /* Enable\Disable LE Power Control Feature. Enable:1 - Disable:0 */ + +/* 5.3 features */ +#define SUPPORT_CHANNEL_CLASSIFICATION 0 +#define SUPPORT_LE_ENHANCED_CONN_UPDATE 0 + +/* Capabilities configurations */ +#define MAX_NUM_CNCRT_STAT_MCHNS 8 /* Set maximum number of states the controller can support */ +#define USE_NON_ACCURATE_32K_SLEEP_CLK 1 /* Allow to drive the sleep clock by sources other than the default crystal oscillator source.*/ + /*LL can use crystal oscillator or RTC or RCO to drive the sleep clock.This selection is done via "DEFAULT_SLEEP_CLOCK_SOURCE" macro. */ + +/* Non-standard features configurations */ +#define NUM_OF_CTSM_EMNGR_HNDLS 1 /* Number of custom handles in event manager to be used for app specific needs */ +#define SUPPORT_AUGMENTED_BLE_MODE 1 /* Enable\Disable Augmented BLE Support. Enable:1 - Disable:0 */ +#define SUPPORT_PTA 0 /* Enable\Disable PTA Feature. Enable:1 - Disable:0 */ + +#define SUPPORT_AUTONOMOUS_POWER_CONTROL_REQ (1) +#define LL_BASIC 0 + +/*************************** MAC Configuration *************************************/ +/*Configurations of MAC will apply only when MAC is enabled*/ +#define FFD_DEVICE_CONFIG 0 /* Enable\Disable FFD:1 - RFD:0 */ +#ifdef SUPPORT_AUG_MAC_HCI_UART +#define RAL_NUMBER_OF_INSTANCE 0 /* The Number of RAL instances supported */ +#else +#define RAL_NUMBER_OF_INSTANCE 0 /* The Number of RAL instances supported */ +#endif +#define MAX_NUMBER_OF_INDIRECT_DATA 0 /* The maximum number of supported indirect data buffers */ +#define SUPPORT_OPENTHREAD_1_2 0 /* Enable / disable FW parts related to new features introduced in openthread 1.2*/ +#define SUPPORT_SEC 0 /* The MAC Security Supported : 1 - Not Supported:0 */ +#define RADIO_CSMA 0 /* Enable\Disable CSMA Algorithm in Radio Layer, Must be Enabled if MAC_LAYER_BUILD */ +#define SUPPORT_A_MAC 0 +#define SMPL_PRTCL_TEST_ENABLE 0 + +#endif /* INCLUDE_LL_FW_CONFIG_H */ diff --git a/lib/stm32wba/hci/ll/ll_intf.h b/lib/stm32wba/hci/ll/ll_intf.h new file mode 100644 index 000000000..2c9041243 --- /dev/null +++ b/lib/stm32wba/hci/ll/ll_intf.h @@ -0,0 +1,4408 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.30a-SOW05PatchV6/firmware/public_inc/ll_intf.h#1 $*/ +/** + ******************************************************************************** + * @file ll_intf_cmds.h + * @brief This file contains all the functions prototypes for the LL interface component. + ****************************************************************************** + * @copy + * This Synopsys DWC Bluetooth Low Energy Combo Link Layer/MAC software and + * associated documentation ( hereinafter the "Software") is an unsupported + * proprietary work of Synopsys, Inc. unless otherwise expressly agreed to in + * writing between Synopsys and you. The Software IS NOT an item of Licensed + * Software or a Licensed Product under any End User Software License Agreement + * or Agreement for Licensed Products with Synopsys or any supplement thereto. + * Synopsys is a registered trademark of Synopsys, Inc. Other names included in + * the SOFTWARE may be the trademarks of their respective owners. + * + * Synopsys MIT License: + * Copyright (c) 2020-Present Synopsys, Inc + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * the Software), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE ARISING FROM, + * OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * */ + +#ifndef INCLUDE_LL_INTF_CMDS_H +#define INCLUDE_LL_INTF_CMDS_H + +#include +#include "common_types.h" +#if SUPPORT_PTA +#include "pta.h" +#endif /* SUPPORT_PTA */ +/** + * @brief Global error definition across different components. + * refer the error codes defined in @ref ll_error.h for more information about the values that this type should set + */ +typedef uint32_t ble_stat_t; + +#ifndef ADDRESS_SIZE +#define ADDRESS_SIZE 6 +#endif /* ADDRESS_SIZE */ + +#define LE_FEATURES_BYTES_NO 8 +#define ISO_CODEC_ID_SIZE 5 + +/*! + * The link layer will write the received packets RX_DATA_OFFSET + * bytes after the start of the allocated shared memory. This may + * be used to meet the requirements of the host or application in + * case that some free space has to lead the received packets. + */ +#define RX_DATA_OFFSET 0 + +/** + * This defined value is used on Link Status custom command as + * the maximum number of states as follows: + * 8 (max num of state machines) + * + * in addition to: + * 2 (Broadcaster and Observer) + */ +#define LINK_STATUS_SIZE (MAX_NUM_CNCRT_STAT_MCHNS+2) +/** + * This defined value is used on Link Status custom command to indicate + * that the given state machine on a state other that a connection state + */ +#define LINK_STATUS_DEFAULT_HANDLE 0xFFFF + + +/** + * This defined values are used to check for the range of values that the + * channel classification parameters take (both min_spacing and max_delay) + */ +#define CHANNEL_CLASSIFICATION_REPORTING_TIMING_PARAM_MIN 5 +#define CHANNEL_CLASSIFICATION_REPORTING_TIMING_PARAM_MAX 150 + +extern const struct hci_dispatch_tbl* p_dis_tbl; +/*================================= Enumerations =====================================*/ + +/** + * @brief BLE role enumeration + */ +typedef enum _ble_conn_role_e { + BLE_ROLE_MASTER = 0 , + BLE_ROLE_SLAVE = 1 +}ble_conn_role_e; + +/** + * @brief Advertising event type enumeration + */ +typedef enum _ble_adv_event_type_e { + ADV_IND_EVENT, + ADV_DIRECT_IND_EVENT, + ADV_SCAN_IND_EVENT, + ADV_NONCONN_IND_EVENT, + SCAN_RSP_EVENT, +} ble_adv_event_type_e; + +/** + * @brief Enum device address type. + */ +typedef enum dev_addr_type { + PUBLIC, RANDOM, PUBLIC_ID, RANDOM_STATIC_ID, INVALID_TYPE, + ANNONYMOUS = 0xFF +} dev_addr_type_e; + +/** + * @brief Enum device address type. + */ +typedef enum _rec_adv_stat_e { + ADV_EXT_STAT, + AUX_ADV_STAT, + AUX_CHAIN_STAT, +} rec_adv_stat_e; + +#if (SUPPORT_AOA_AOD) +/** + * @brief Enum CTE_Type. + */ +typedef enum _cte_type_e { + AOA_CTE, + AOD_CTE_1_US_SLOTS, + AOD_CTE_2_US_SLOTS +} cte_type_e; + +/** + * @brief Enum CTE_Category (connection CTE or connectionless CTE). + */ +typedef enum _cte_category_e { + CONNECTION_CTE, + CONNECTIONLESS_CTE +} cte_category_e; + +/** + * @brief Enum CTE Slot Durations. + */ +typedef enum _cte_slot_durtn_e { + SLOT_DURTN_1_US = 0x01, + SLOT_DURTN_2_US +} cte_slot_durtn_e; +#endif /* SUPPORT_AOA_AOD */ + +/* + * @brief Privacy Modes + */ +typedef enum _ble_prvcy_mod_e { + NETWORK_MODE, + DEVICE_MODE +} ble_prvcy_mod_e; + +/** + * @brief State machine status for Get Link Status Command, it holds the + * values for different state machines based on its running event type + */ +enum _sm_status_e { + SM_STATUS_IDLE = 0, + SM_STATUS_ADV_EXTADV = 1, + SM_STATUS_PERI_CONN = 2, + SM_STATUS_SCN_EXTSCN = 3, + SM_STATUS_CENT_CONN = 5, + SM_STATUS_DTM_TX = 6, + SM_STATUS_DTM_RX = 7, + SM_STATUS_PRDC_ADV = 9, + SM_STATUS_PRDC_SYNC = 10, + SM_STATUS_BIG_ADV = 11, + SM_STATUS_BIG_SYNC = 12, + SM_STATUS_PERI_CIG = 13, + SM_STATUS_CENT_CIG = 14, +}; + +/*================================= Structures =====================================*/ + +/** + * @brief The data in one advertising report from the non-connection manager to the LL interface + * + * This structure contains the parameters should be sent from the link layer to the host per report. + */ +typedef struct _ble_intf_adv_report_data_st { + uint8_t adv_addr[ADDRESS_SIZE + 2]; + ble_buff_hdr_t adv_rprt_data; + int8_t rssi; + ble_adv_event_type_e evnt_type; + dev_addr_type_e adv_addr_type; +} ble_intf_adv_report_data_st; + +/** + * @brief Structure containing the advertising report data to be reported to host + */ +typedef struct _ble_intf_extended_adv_rprt_data_st { + rec_adv_stat_e adv_stat; + uint16_t event_type; + uint8_t address_type; + uint8_t *ptr_address; + uint8_t primary_phy; + uint8_t secondary_phy; + uint8_t advertising_sid; + uint16_t adv_data_id; + uint8_t TX_power; + int8_t rssi; + uint16_t periodic_advertisng_interval; + uint8_t direct_addresses_type; + uint8_t *ptr_direct_address; + uint8_t data_length; + ble_buff_hdr_t *ptr_data; + uint8_t rmv_adv_rprt; + uint8_t address [ADDRESS_SIZE]; +} ble_intf_extended_adv_rprt_data_st; + +#if (SUPPORT_PERIODIC_SYNC_TRANSFER) +/** + * @brief Structure containing the advertising sync transfer report to be reported to the host + */ +typedef struct _ble_intf_prdc_adv_sync_transfer_report_st { + uint8_t status; /* Periodic advertising sync successful/failed */ + uint16_t conn_handle; /* Used to identify connection */ + uint16_t service_data; /* A value provided by the peer device */ + uint16_t sync_handle; /* Used to identify the periodic advertiser */ + uint8_t advertising_sid; /* Value of the Advertising SID subfield in the ADI field of the PDU */ + uint8_t advertiser_address_type; /* Advertiser address type */ + uint8_t* ptr_advertiser_address; /* Pointer to advertiser address */ + uint8_t advertiser_phy; /* Advertiser PHY */ + uint16_t periodic_advertising_interval; /* Periodic advertising interval */ + uint8_t advertiser_clock_accuracy; /* Clock accuracy used by advertise */ +} ble_intf_prdc_adv_sync_transfer_report_st ; +#endif /* SUPPORT_PERIODIC_SYNC_TRANSFER */ + +/** + * @brief The data in one direct advertising report from the non-connection manager to the LL interface + * + * This structure contains the parameters should be sent from the link layer to the host per direct advertising report. + */ +typedef struct _ble_intf_dir_adv_report_data_st { + uint8_t addr[ADDRESS_SIZE + 2]; + uint8_t dir_addr[ADDRESS_SIZE + 2]; + int8_t rssi; + ble_adv_event_type_e evnt_type; + dev_addr_type_e addr_type; + dev_addr_type_e dir_addr_type; +} ble_intf_dir_adv_report_data_st; + +/** + * @brief Data contained in extended advertising enable command for each advertising handle. + * + * This structure contains the parameters that are passed by the Host in extended advertising enable command for each advertising handle . + * we divided the duration into two octets to avoid the structure padding + */ +typedef struct { + uint8_t advertising_handle; /* Advertising handle that identify the advertising sets.*/ + uint8_t duration_LSB; /* The Least Significant Octet of the Duration of the advertising */ + uint8_t duration_MSB; /* The Most Significant Octet of the Duration of the advertising */ + uint8_t max_extended_advertising_events; /* Max number of events of the advertising of each advertising handle */ +} st_ble_intf_ext_adv_enable_params; + +/** + * @brief Data contained in extended create connection command for each PHY. + * + * This structure contains the parameters that are passed by the Host in set extended scan parameters command for each PHY. + */ +typedef struct { + uint8_t scan_type; + uint16_t scan_interval; + uint16_t scan_window; +} st_ble_intf_ext_scn_params; + +#if (SUPPORT_CONNECTED_ISOCHRONOUS &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) +/** + * @brief Data contained in CIS established event + * + * This structure contains the parameters that are passed to the Host in different scenarios of CIS (eg: create_cis). + */ +typedef struct _ble_intf_cis_estblshd_evnt_st{ + uint32_t cig_sync_delay; /* The maximum time, in us, for transmission all CISes */ + uint32_t cis_sync_delay; /* The maximum time, in us, for transmission of PDUs of a CIS */ + uint32_t trsnprt_ltncy_m_to_s; /* The maximum time, in us, for transmission of SDUs of all CISes */ + uint32_t trsnprt_ltncy_s_to_m; + uint16_t conn_hndl; /* Connection handle of the CIS */ + uint16_t max_pdu_m_to_s; /* max pdu size */ + uint16_t max_pdu_s_to_m; + uint16_t iso_interval; + uint8_t status; /* Status of the establishment */ + uint8_t phy_m_to_s; /* Used PHY from Master to Slave */ + uint8_t phy_s_to_m; /* Used PHY from Slave to Master */ + uint8_t nse; /* number of sub-event*/ + uint8_t bn_m_to_s; /* number of payloads */ + uint8_t bn_s_to_m; + uint8_t ft_m_to_s; /* flush timeout */ + uint8_t ft_s_to_m; +} ble_intf_cis_estblshd_evnt_st; + +/** + * @brief Data contained in CIS Request event + * + * This structure contains the parameters passed from the master to the host of the slave in CIS creation procedure. + */ +typedef struct _ble_intf_cis_req_evnt_st{ + uint16_t acl_conn_hndl; /* ACL connection handle*/ + uint16_t cis_conn_hndl; /* CIS connection handle */ + uint8_t cis_id; /* CIS Identifier */ + uint8_t cig_id; /* CIG Identifier */ +} ble_intf_cis_req_evnt_st; + +#endif/* SUPPORT_CONNECTED_ISOCHRONOUS &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) */ + +#if ((SUPPORT_CONNECTED_ISOCHRONOUS &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) || (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS)) +/** + * @brief Structure containing the ISO sync event info to be reported to host + */ +typedef struct _ble_intf_sync_evnt_st{ + uint8_t group_id; /* identifier of the CIG or BIG*/ + uint32_t next_anchor_point; /* the time stamp in microseconds at the Controller clock of the next expected CIG or BIG anchor point */ + uint32_t time_stamp; /* the time stamp in microseconds at the Controller clock, this represent the time at which the Trigger is generated */ + uint32_t nxt_sdu_delivery_timeout; +} ble_intf_sync_evnt_st; +#endif /* (SUPPORT_CONNECTED_ISOCHRONOUS &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) || (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS) */ + +#if (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS) +/** + * @brief Structure containing the Create BIG Test command parameters + */ +typedef struct _ble_intf_create_big_test_cmd_st +{ + uint16_t iso_intrv; /* contains the time duration between two consecutive BIG anchor points*/ + uint16_t max_pdu; /* contains the maximum size of every BIS Data PDU for every BIS in the BIG*/ + uint8_t nse; /* Number of SubEvents */ + uint8_t bn; /* (Burst Number) the number of new payloads for each BIS in an isochronous interval*/ + uint8_t irc; /*(Immediate Repetition Count) the number of times the data packet is transmitted */ + uint8_t pto; /* (Pre_Transmission_Offset) the offset in number of ISO_Intervals for pre-transmissions of data packets */ +} ble_intf_create_big_test_cmd_st; + +/** + * @brief Structure containing the Create BIG SYNC command parameters + */ +typedef struct _ble_intf_big_common_sync_bc_cmd_st{ + uint8_t num_bis; /* Total number of BISes to synchronize*/ + uint32_t bcast_code[4]; /* used for deriving the session key for decrypting payloads of encrypted BISes.*/ + uint8_t big_hndle; /* the identifier of the BIG */ + uint8_t encrptn; /* identifies the encryption mode of the BISes */ +}ble_intf_big_common_sync_bc_cmd_st; + +/** + * @brief structure of common parameters between create_big and create_big_test + */ +typedef struct _ble_intf_create_big_common_param_cmd_st{ + uint32_t sdu_intrv; /* contains the time interval of the periodic SDUs */ + uint16_t max_sdu; /* contains the maximum size of an SDU*/ + uint8_t adv_hndle; /* identifies the associated periodic advertising train of the BIG */ + uint8_t pack; /* the preferred method of arranging subevents of multiple BISes*/ + uint8_t framing; /* indicates the format for sending BIS Data PDUs (framed or unframed)*/ + tx_rx_phy_e phy; /* the PHY used for transmission of PDUs of BISes in the BIG */ + ble_intf_big_common_sync_bc_cmd_st big_common_sync_bc; /* common parameters between the synchronizer and broadcaster */ +}ble_intf_create_big_common_param_cmd_st; + +#if(SUPPORT_BRD_ISOCHRONOUS) +/** + * @brief Data contained in big complete event + * + * This structure contains parameters that are passed to the Host while ig creation. + */ +typedef struct _ble_intf_big_cmplt_evnt_st{ + uint16_t *conn_hndle; /* the list of connection handles of all BISes in the BIG*/ + uint32_t big_sync_delay; /* the maximum time, in microseconds, for transmission of PDUs of all BISes in a BIG in an isochronous interval */ + uint32_t trnsprt_ltncy_big; /* the maximum time, in microseconds, for transmission of SDUs of all BISes in a BIG */ + uint16_t max_pdu; /*Maximum size, in octets, of the payload*/ + uint16_t iso_intrv; /* iso interval */ + uint8_t status; /*Create BIG successful/failed*/ + uint8_t big_hndle; /* the identifier of the BIG */ + uint8_t phy; /* the PHY used to create the BIG*/ + uint8_t num_bis; /* the total number of BISes in the BIG*/ + uint8_t nse; /*The number of subevents in each BIS event in the BIG*/ + uint8_t bn; /*The number of new payloads in each BIS event*/ + uint8_t pto; /*Offset used for pre-transmissions*/ + uint8_t irc; /*The number of times a payload is transmitted in a BIS event*/ +} ble_intf_big_cmplt_evnt_st; +#endif /* SUPPORT_BRD_ISOCHRONOUS */ + +#if(SUPPORT_SYNC_ISOCHRONOUS) +/** + * @brief Data contained in big sync established event + */ +typedef struct _ble_intf_big_sync_estblshd_evnt_st{ + uint32_t trnsprt_ltncy_big; /* the maximum time, in microseconds, for reception of SDUs of all BISes in aBIG */ + uint16_t *conn_hndle; /* The list of connection handles of all BISes in the BIG*/ + uint16_t max_pdu; /* Maximum size, in octets, of the payload*/ + uint16_t iso_intrvl; /* IsoInterval */ + uint8_t status; /* BIG sync establish successful/failed */ + uint8_t big_hndle; /* the identifier of the BIG */ + uint8_t num_bis; /* the total number of BISes in the BIG*/ + uint8_t nse; /*The number of subevents in each BIS event in the BIG*/ + uint8_t bn; /*The number of new payloads in each BIS event*/ + uint8_t pto; /*Offset used for pre-transmissions*/ + uint8_t irc; /*The number of times a payload is transmitted in a BIS event*/ +} ble_intf_big_sync_estblshd_evnt_st; + +/** + * @brief Data contained in BIGInfo report event + */ +typedef struct _ble_intf_biginfo_rprt_evnt_st{ + ble_intf_create_big_test_cmd_st test_param_st; + ble_intf_create_big_common_param_cmd_st non_test_param; + uint16_t sync_hndl; +} ble_intf_biginfo_rprt_evnt_st; + +#endif /* SUPPORT_SYNC_ISOCHRONOUS */ +#endif/* SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS */ + +#if (SUPPORT_AOA_AOD) +#if (SUPPORT_EXPLCT_OBSERVER_ROLE || SUPPORT_MASTER_CONNECTION || SUPPORT_SYNC_ISOCHRONOUS) +/** + * @brief This structure contains the parameters that should be sent from the link layer to the host through the LE_Connectionless_IQ_Report_Event. + */ +typedef struct _le_connless_iq_report_evnt_st { + ble_buff_hdr_t *ptr_iq_samples; /* Pointer to the IQ samples buffer received in AUX_SYNC_IND PDU */ + uint16_t sync_handle; + int16_t rssi; /* RSSI of the packet (excluding the Constant Tone Extension) */ + uint16_t pa_event_counter; + uint8_t rssi_antenna_id; /* ID of the antenna on which the RSSI was measured */ + uint8_t channel_index; /* Index of the channel on which the AUX_SYNC_IND PDU was received */ + uint8_t pckt_status; /* Indicate whether the received packet had a valid CRC */ + uint8_t sample_count; /* Total number of IQ sample pairs */ + cte_type_e cte_type; /* CTE field type */ + cte_slot_durtn_e slot_durations; /* CTE switching and sampling slot durations */ +} le_connless_iq_report_evnt_st; +#endif /* SUPPORT_EXPLCT_OBSERVER_ROLE || SUPPORT_MASTER_CONNECTION || SUPPORT_SYNC_ISOCHRONOUS*/ + +#if (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) +/** + * @brief This structure contains the parameters that should be sent from the link layer to the host through the LE_Connection_IQ_Report_Event. + */ +typedef struct _ble_intf_conn_iq_report_st { + ble_buff_hdr_t *ptr_iq_samples; /* Pointer to the IQ samples buffer received during the connection event */ + uint16_t conn_handle; + int16_t rssi; /* RSSI value of the received data packet */ + uint16_t conn_event_counter; + uint8_t rx_phy; /* Receiver PHY for the connection. 0x01: LE 1M PHY, 0x02: LE 2M PHY */ + uint8_t data_channel_index; /* Index of the data channel on which the Data Channel PDU was received */ + uint8_t rssi_antenna_id; /* ID of the antenna on which the RSSI was measured */ + uint8_t pckt_status; /* Indicate whether the received packet had a valid CRC */ + uint8_t sample_count; /* Total number of IQ sample pairs */ + cte_type_e cte_type; /* CTE field type */ + cte_slot_durtn_e slot_durations; /* CTE switching and sampling slot durations */ +} ble_intf_conn_iq_report_st; +#endif /* (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) */ +#endif /* SUPPORT_AOA_AOD */ + +#if (SUPPORT_LE_POWER_CONTROL) +/** + * @brief This structure contains the parameters that should be sent from the link layer to the host through the LE_Transmit_Power_Reporting_Event. + */ +typedef struct _le_tx_power_report_st { + uint16_t conn_handle_id; /* Connection handle for which the TX_Power level is reported to Host */ + uint8_t status; /* Status of the "HCI_LE_Read_Remote_Transmit_Power_Level" command */ + uint8_t reason; /* Indicates why the event was sent and the device whose TX_Power level is being reported: + 0x00: Local transmit power changed + 0x01: Remote transmit power changed + 0x02: HCI_LE_Read_Remote_Transmit_Power_Level command completed */ + uint8_t phy; /* Indicate the PHY involved (which might not be the current TX PHY for the relevant device) */ + uint8_t tx_power_level_flag;/* Indicate whether the TX_Power level that is being reported has reached its minimum and/or maximum level */ + int8_t tx_power_level; /* Indicate the TX_Power level for the PHY (unit: dBm) */ + int8_t delta; /* Set to the change in power level for the transmitter being reported (unit: dB) */ +} le_tx_power_report_st; + +/** + * @brief This structure contains the parameters that should be sent from the link layer to the host through the LE_Path_Loss_Threshold_Event. + */ +typedef struct _le_path_loss_threshold_evnt_st { + uint16_t conn_handle_id; /* Connection handle for which a path loss threshold crossing is reported to Host */ + uint8_t current_path_loss; /* The current path loss value as calculated by the Controller. (unit: dB) */ + uint8_t zone_entered; /* Indicates which zone was entered: + 0x00: Entered low zone + 0x01: Entered middle zone + 0x02: Entered high zone */ +} le_path_loss_threshold_evnt_st; +#endif /* SUPPORT_LE_POWER_CONTROL */ + +#if SUPPORT_LE_ENHANCED_CONN_UPDATE +/* struct holding the subrate parameters used in posting subrate change event to the host */ +typedef struct _le_subrate_change_evnt_st{ + uint16_t conn_handle_id; + uint16_t subrate_factor; + uint16_t peripheral_latency; + uint16_t continuation_num; + uint16_t supervisionTo; + uint8_t status; +}le_subrate_change_evnt_st; +#endif /* SUPPORT_LE_ENHANCED_CONN_UPDATE */ +/** + * @brief Data contained in extended create connection command for each PHY. + * + * This structure contains the parameters that are passed by the Host in extended create connection command for each PHY. + */ +typedef struct _ble_intf_ext_create_conn_st { + uint16_t scan_interval; /* scanning intervals for each PHY. */ + uint16_t scan_window; /* scanning windows for each PHY. */ + uint16_t conn_interval_min; /* minimum connection interval for each PHY. */ + uint16_t conn_interval_max; /* maximum connection interval for each PHY. */ + uint16_t conn_latency; /* connection latencies for each PHY. */ + uint16_t supervision_timeout; /* supervision timeout for each PHY. */ + uint16_t minimum_ce_length; /* minimum connection event length for each PHY. */ + uint16_t maximum_ce_length; +} st_ble_intf_ext_create_conn; + +/* HCI Commands Parameters Structures */ +#if (SUPPORT_AOA_AOD) +#if (SUPPORT_EXPLCT_BROADCASTER_ROLE) +/** + * @brief LE Set Connectionless CTE Transmit Parameters Command + */ +typedef struct _le_set_connless_cte_tx_params_cmd_st +{ + uint8_t adv_handle; + uint8_t cte_len; /* Length of the Constant Tone Extension in 8 us units. Range:[0x02 – 0x14] + 0x00: means Do not transmit a Constant Tone Extension */ + uint8_t cte_type; /* 0x00: AoA CTE + 0x01: AoD CTE with 1 us slots + 0x02: AoD CTE with 2 us slots */ + uint8_t cte_count; /* Number of CTEs to transmit in each periodic advertising interval*/ + uint8_t switching_pattern_len; /* The number of Antenna IDs in the switching pattern */ + uint8_t *ptr_antenna_ids; /* List of Antenna IDs in the pattern */ +}le_set_connless_cte_tx_params_cmd_st; + +/** + * @brief LE Set Connectionless CTE Transmit Enable Command + */ +typedef struct _le_set_connless_cte_tx_enable_cmd_st +{ + uint8_t adv_handle; + uint8_t connless_cte_enable; /* Enable/Disable Connectionless CTE transmission. Enable:1 - Disable:0 */ + +}le_set_connless_cte_tx_enable_cmd_st; +#endif /* (SUPPORT_EXPLCT_BROADCASTER_ROLE) */ + +#if (SUPPORT_EXPLCT_OBSERVER_ROLE || SUPPORT_MASTER_CONNECTION || SUPPORT_SYNC_ISOCHRONOUS) +/** + * @brief LE Set Connectionless IQ Sampling Enable Command + */ +typedef struct _le_set_connless_iq_sampling_enable_cmd_st +{ + uint16_t sync_handle; + uint8_t iq_sampling_enable; /* Enable/Disable Connectionless IQ samples capturing. Enable:1 - Disable:0 */ + uint8_t slot_durations; /* Switching and sampling slots' duration */ + uint8_t max_sampled_ctes; /* maximum number of CTEs to sample and report in each periodic advertising interval */ + uint8_t switching_pattern_len; /* The number of Antenna IDs in the switching pattern */ + uint8_t *ptr_antenna_ids; /* List of Antenna IDs in the pattern */ +}le_set_connless_iq_sampling_enable_cmd_st; +#endif /* (SUPPORT_EXPLCT_OBSERVER_ROLE || SUPPORT_MASTER_CONNECTION || SUPPORT_SYNC_ISOCHRONOUS) */ + +#if ((SUPPORT_MASTER_CONNECTION) || (SUPPORT_SLAVE_CONNECTION)) +/** + * @brief LE Set Connection CTE Receive Parameters Command + */ +typedef struct _le_set_conn_cte_rx_params_cmd_st +{ + uint16_t conn_handle_id; + uint8_t cte_sampling_enable; /* Enable/Disable sampling the received CTE fields on this connection handle. Enable:1 - Disable:0 */ + uint8_t slot_durations; /* Switching and sampling slots' duration */ + uint8_t switching_pattern_len; /* The number of Antenna IDs in the switching pattern */ + uint8_t *ptr_antenna_ids; /* List of Antenna IDs in the pattern */ +}le_set_conn_cte_rx_params_cmd_st; + +/** + * @brief LE Set Connection CTE Transmit Parameters Command + */ +typedef struct _le_set_conn_cte_tx_params_cmd_st +{ + uint16_t conn_handle_id; + uint8_t cte_types; /* 0x00: AoA CTE + 0x01: AoD CTE with 1 us slots + 0x02: AoD CTE with 2 us slots */ + uint8_t switching_pattern_len; /* The number of Antenna IDs in the switching pattern */ + uint8_t *ptr_antenna_ids; /* List of Antenna IDs in the pattern */ +}le_set_conn_cte_tx_params_cmd_st; + +/** + * @brief LE Connection CTE Request Enable Command + */ +typedef struct _le_set_conn_cte_req_enable_cmd_st +{ + uint16_t conn_handle_id; + uint16_t cte_req_intrvl; /* 0x00 : Send LL_CTE_REQ once, at the earliest practical opportunity + 0x0001 - 0xFFFF : Requested interval for sending LL_CTE_REQ PDUs in number of connection events. */ + uint8_t cte_req_enable; /* Enable/Disable CTE Request transmission for the connection. Enable:1 - Disable:0 */ + uint8_t requested_cte_len; /* Minimum length of the Constant Tone Extension being requested in 8 us units */ + uint8_t requested_cte_type; /* Indicates the type of CTE that the Controller shall request from the remote device, its values: + 0x00 : AoA Constant Tone Extension + 0x01 : AoD Constant Tone Extension with 1 us slots + 0x02 : AoD Constant Tone Extension with 2 us slots */ +}le_set_conn_cte_req_enable_cmd_st; + +/** + * @brief LE Connection CTE Response Enable Command + */ +typedef struct _le_set_conn_cte_rsp_enable_cmd_st +{ + uint16_t conn_handle_id; + uint8_t cte_rsp_enable; /* Enable/Disable CTE Response transmission for the connection. Enable:1 - Disable:0 */ +}le_set_conn_cte_rsp_enable_cmd_st; +#endif /* (SUPPORT_MASTER_CONNECTION) || (SUPPORT_SLAVE_CONNECTION) */ +#endif /* SUPPORT_AOA_AOD */ + +#if (SUPPORT_AOA_AOD) +/** + * @brief LE Receiver Test command [v3] + */ +typedef struct +{ + uint8_t rx_channel; /* specify the RF channel to be used by the receiver */ + uint8_t phy; /* specify the PHY to be used by the receiver */ + uint8_t modulation_index; /* specify whether or not the Controller should assume the receiver has a stable modulation index */ + uint8_t expected_cte_length; /* specify the expected length of the Constant Tone Extension in received test reference packets */ + uint8_t expected_cte_type; /* specify the expected type of the Constant Tone Extension in expected test reference packets */ + uint8_t switching_pattern_len; /* specify the length of the antenna switching pattern used when receiving an AoA CTE */ + uint8_t *ptr_antenna_ids; /* specify the antenna switching pattern used when receiving an AoA CTE */ + cte_slot_durtn_e slot_durations; /* specify the CTE sampling slots durations */ +}le_rx_test_v3_cmd_st; + +/** + * @brief LE Transmitter Test command [v3] + */ +typedef struct _le_tx_test_v3_cmd_st +{ + uint8_t tx_channel; /* specify the RF channel to be used by the transmitter */ + uint8_t length_of_test_data; /* specify the length of the Payload of the test reference packets */ + uint8_t packet_payload; /* specify the con_le_rx_test_v3_cmd_sttents of the Payload of the test reference packets */ + uint8_t phy; /* specify the PHY to be used by the transmitter */ + uint8_t cte_length; /* specify the length of the Constant Tone Extension in the test reference packets */ + uint8_t cte_type; /* specify the type of the Constant Tone Extension in the test reference packets */ + uint8_t switching_pattern_len; /* specify the length of the antenna switching pattern used when transmitting an AoD CTE */ + uint8_t *ptr_antenna_ids; /* specify the antenna switching pattern used when transmitting an AoD CTE */ +}le_tx_test_v3_cmd_st; +#endif /* SUPPORT_AOA_AOD */ + +/** + * @brief LE Set Connection Transmit Power Level command + */ +#if (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) +typedef struct _le_set_conn_tx_pwr_lvl_cmd_st{ + uint16_t conn_handle_id; /* Connection handle for which the TX_Power level used by the local controller is updated */ + uint8_t phy; /* PHY for which the TX_Power level used by the local controller is updated */ + int8_t tx_power; /* specify the change in the local TX_Power level, if any,for the PHY(s) specified */ +}le_set_conn_tx_pwr_lvl_cmd_st; +#endif /* SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION */ + +#if (SUPPORT_LE_POWER_CONTROL) +/** + * @brief LE Enhanced Read Transmit Power Level command + */ +typedef struct _le_enhanced_read_tx_pwr_lvl_cmd_st{ + uint16_t conn_handle_id; /* Connection handle for which the current and maximum TX_Power levels are reported */ + uint8_t phy; /* PHY for which the current and maximum TX_Power levels are reported */ +}le_enhanced_read_tx_pwr_lvl_cmd_st; + +/** + * @brief LE Read Remote Transmit Power Level command + */ +typedef struct _le_read_remote_tx_pwr_lvl_cmd_st{ + uint16_t conn_handle_id; /* Connection handle for which the TX_Power level used by the remote controller is reported */ + uint8_t phy; /* PHY for which the TX_Power level used by the remote controller is reported */ +}le_read_remote_tx_pwr_lvl_cmd_st; + +/** + * @brief LE Set Path Loss Reporting Parameters command + */ +typedef struct _le_set_path_loss_reporting_params_cmd_st{ + uint16_t conn_handle_id; /* Connection handle for which path loss threshold reporting parameters are set */ + uint16_t min_time_spent; /* Minimum time in number of connection events to be observed once the path crosses the threshold before an event is generated to Host */ + uint8_t high_threshold; /* High threshold for the path loss (unit: dB) */ + uint8_t high_hysteresis; /* Hysteresis value for the high threshold (unit: dB) */ + uint8_t low_threshold; /* Low threshold for the path loss (unit: dB) */ + uint8_t low_hysteresis; /* Hysteresis value for the low threshold (unit: dB) */ +}le_set_path_loss_reporting_params_cmd_st; + +/** + * @brief LE Set Path Loss Reporting Enable command + */ +typedef struct _le_set_path_loss_reporting_enable_cmd_st{ + uint16_t conn_handle_id; /* Connection handle for which path loss reporting to Host is enabled or disabled */ + uint8_t enable; /* Enable or Disabled the path loss reporting to Host. 0x00: Reporting disabled. 0x01: Reporting enabled */ +}le_set_path_loss_reporting_enable_cmd_st; + +/** + * @brief LE Set Transmit Power Reporting Enable command + */ +typedef struct _le_set_tx_pwr_reporting_enable_cmd_st{ + uint16_t conn_handle_id; /* Connection handle for which reporting to the local Host of TX_Power level changes in the local and remote Controllers is enabled or disabled */ + uint8_t local_enable; /* 0x00: Disable local transmit power reports + 0x01: Enable local transmit power reports */ + uint8_t remote_enable; /* 0x00: Disable remote transmit power reports + 0x01 Enable remote transmit power reports */ +}le_set_tx_pwr_reporting_enable_cmd_st; + +/** + * @brief LE Transmitter Test command [v4] + */ +typedef struct _le_tx_test_v4_cmd_st +{ + uint8_t tx_channel; /* specify the RF channel to be used by the transmitter */ + uint8_t length_of_test_data; /* specify the length of the Payload of the test reference packets */ + uint8_t packet_payload; /* specify the con_le_rx_test_v3_cmd_sttents of the Payload of the test reference packets */ + uint8_t phy; /* specify the PHY to be used by the transmitter */ + uint8_t cte_length; /* specify the length of the Constant Tone Extension in the test reference packets */ + uint8_t cte_type; /* specify the type of the Constant Tone Extension in the test reference packets */ + uint8_t switching_pattern_len; /* specify the length of the antenna switching pattern used when transmitting an AoD CTE */ + uint8_t *ptr_antenna_ids; /* specify the antenna switching pattern used when transmitting an AoD CTE */ + int8_t tx_power_level; /* specify the TX_Power level to be used by the transmitter. (Unit: dBm) + 0x7E: Set transmitter to minimum TX_Power. + 0x7F: Set transmitter to maximum TX_Power. + otherwise, Set transmitter to the specified or the nearest TX_Power level. */ +}le_tx_test_v4_cmd_st; +#endif /* SUPPORT_LE_POWER_CONTROL */ + +/** + * @brief LE Set ADV parameters + */ +typedef struct _le_set_adv_params_cmd_st { + uint16_t adv_intrv_min; /* Range: 0x0020 to 0x4000, Time = N * 0.625 msec, Time Range: 20 ms to 10.24 sec*/ + uint16_t adv_intrv_max; /* Range: 0x0020 to 0x4000, Time = N * 0.625 msec, Time Range: 20 ms to 10.24 sec*/ + uint8_t adv_type; /* Advertising type*/ + uint8_t own_addr_type; /* Address type of the source address */ + uint8_t peer_addr_type; /* peer address type */ + uint8_t peer_addr[ADDRESS_SIZE]; /* Public Device Address, Random Device Address, + Public Identity Address, or Random (static) + Identity Address of the device to be connected*/ + uint8_t adv_chnl_map; /* Advertising channel index used when transmitting advertising packets. */ + uint8_t adv_filter_policy; /* filter policy type. range 0:3 */ +} le_set_adv_params_cmd_st; + +/** + * @brief LE Create Connection Command + */ +typedef struct _le_set_scn_params_cmd_st { + uint8_t scn_type; /* Passive 0 or active 1 scanning*/ + uint16_t scn_interv; /* Range: 0x0020 to 0x4000, Time = N * 0.625 msec, Time Range: 20 ms to 10.24 sec*/ + uint16_t scn_wndw; /* Range: 0x0020 to 0x4000, Time = N * 0.625 msec, Time Range: 20 ms to 10.24 sec*/ + uint8_t own_addr_type; /* Address type of the source address */ + uint8_t scanning_filter_policy; /** S */ + uint32_t sdu_intrv_s_to_m; /* The interval, in us, of periodic SDUs S->M */ + uint16_t iso_interval; /* Time duration of the isochronous interval */ + uint16_t max_trnsprt_ltncy_m_to_s; /* Maximum time, in ms, for an SDU to be sent from the master to slave */ + uint16_t max_trnsprt_ltncy_s_to_m; /* Maximum time, in ms, for an SDU to be sent from the slave to master */ + uint8_t cig_id; /* CIG Identifer */ + uint8_t sca; /* The worst-case sleep clock accuracy of all the slaves */ + uint8_t pack; /* the preferred method of arranging subevents of multiple CISes */ + uint8_t framing; /* Framed or Unframed SDUs */ + uint8_t cis_cnt; /* Total number of CISes in the CIG being added or modified */ + uint8_t ft_m_to_s; /* The flush timeout in multiples of ISO_Interval for each payload sent from the master to slave */ + uint8_t ft_s_to_m; /* The flush timeout in multiples of ISO_Interval for each payload sent from the slave to master */ +} ble_intf_cig_host_param_st; + +/** + * @brief ble_intf_cis_host_param_st structure is a container to CIS(es) parameters passed from the host + */ +typedef struct _ble_intf_cis_host_param{ + uint8_t cis_id; /* Maximum number of subevents in each isochronous interval of CIS*/ + uint8_t max_sdu_m_to_s_least; /* max pdu size from master to slave Least OCTET*/ + uint8_t max_sdu_m_to_s_most; /* max pdu size from master to slave Most OCTET */ + uint8_t max_sdu_s_to_m_least; /* max pdu size from slave to master Least OCTET */ + uint8_t max_sdu_s_to_m_most; /* max pdu size from slave to master Most OCTET */ + uint8_t phy_m_to_s; /* The used PHY from master to slave */ + uint8_t phy_s_to_m; /* The used PHY from slave to master */ + uint8_t rtn_m_to_s; /* The recommendation retransmission effort from master to slave */ + uint8_t rtn_s_to_m; /* The recommendation retransmission effort from slave to master */ +} ble_intf_cis_host_param_st; + +/** + * @brief ble_intf_cis_host_param_test_st structure is a container to CIS(es) parameters passed from the host + */ +typedef struct _ble_intf_cis_host_param_test{ + uint8_t cis_id; /* Maximum number of subevents in each isochronous interval of CIS*/ + uint8_t nse; /* Maximum number of subevents in each isochronous interval of CIS*/ + uint8_t max_sdu_m_to_s_least; /* Maximum size, in octets, of an SDU from the master Host Least OCTET */ + uint8_t max_sdu_m_to_s_most; /* Maximum size, in octets, of an SDU from the master Host Most OCTET */ + uint8_t max_sdu_s_to_m_least; /* Maximum size, in octets, of an SDU from the slave Host Least OCTET */ + uint8_t max_sdu_s_to_m_most; /* Maximum size, in octets, of an SDU from the slave Host Most OCTET */ + uint8_t max_pdu_m_to_s_least; /* max pdu size from master to slave Least OCTET */ + uint8_t max_pdu_m_to_s_most; /* max pdu size from master to slave Most OCTET */ + uint8_t max_pdu_s_to_m_least; /* max pdu size from slave to master Least OCTET */ + uint8_t max_pdu_s_to_m_most; /* max pdu size from slave to master Most OCTET */ + uint8_t phy_m_to_s; /* The used PHY from master to slave */ + uint8_t phy_s_to_m; /* The used PHY from slave to master */ + uint8_t bn_m_to_s; /* burst number from master to slave */ + uint8_t bn_s_to_m; /* burst number from slave to master */ +} ble_intf_cis_host_param_test_st; + +/** + * @brief ble_intf_set_cig_params_comman_cmd_st structure is a container to CIS(es)/CIG parameters passed from the host + */ +typedef struct _ble_intf_set_cig_params_common_cmd_st { + + ble_intf_cis_host_param_st* cis_host_params; + ble_intf_cis_host_param_test_st* cis_host_params_test; + ble_intf_cig_host_param_st cig_host_params; + uint8_t slv_cis_id; +} ble_intf_set_cig_params_comman_cmd_st; + +/** + * @brief ble_intf_create_cis_cmd_st structure used to carry map between CISes and their corresponding ACL + */ +typedef struct _ble_intf_create_cis_cmd_hndl_st{ + uint16_t cis_conn_hndl; /* CIS connection handles */ + uint16_t acl_conn_hndl; /* ACL connection handles */ +} ble_intf_create_cis_cmd_hndl_st; + +/** + * @brief ble_intf_create_cis_cmd_st structure used to create a CIS stream + */ +typedef struct _ble_intf_create_cis_cmd_st{ + ble_intf_create_cis_cmd_hndl_st* create_cis_hndls; /* CIS to ACL connection handles */ + uint8_t cis_cnt; /* The number of CISes to be created */ +} ble_intf_create_cis_cmd_st; +#endif/* SUPPORT_CONNECTED_ISOCHRONOUS &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION */ + + +#if (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS) +#if(SUPPORT_SYNC_ISOCHRONOUS) +/** + * @brief ble_intf_big_create_sync_cmd_st structure used to create a BIG SYNC + */ +typedef struct _ble_intf_big_create_sync_cmd_st +{ + uint8_t *bis; /* List of indices of BISes*/ + uint16_t big_sync_timeout; /* Synchronization timeout for the BIG */ + uint16_t sync_hndle; /* Used to identify the periodic advertising train*/ + uint8_t mse; /* the maximum number of subevents that a Controller should use to receive data payloads in each interval for a BIS */ + ble_intf_big_common_sync_bc_cmd_st big_common_sync_bc; /* common parameters between the synchronizer and broadcaster */ +} ble_intf_big_create_sync_cmd_st; +#endif/* SUPPORT_SYNC_ISOCHRONOUS */ + +/** + * @brief ble_intf_create_big_cmd_st structure used to create a BIG + */ +typedef struct _ble_intf_create_big_cmd_st +{ + uint16_t max_trnsprt_ltncy; + uint8_t rtn; /* specifies the number of times every PDU should be retransmitted*/ +} ble_intf_create_big_cmd_st; + +/** + * @brief ble_intf_create_big_cmd_un union governing the create BIG commands + */ +typedef union _ble_intf_create_big_cmd_un{ + ble_intf_create_big_test_cmd_st create_big_test_cmd_st; + ble_intf_create_big_cmd_st create_big_cmd_st; +} ble_intf_create_big_cmd_un; + +/** + * @brief ble_intf_create_big_st Structure containing the Create BIG params + */ +typedef struct _ble_intf_create_big_st{ + /* Common parameters of create big and create big test */ + ble_intf_create_big_common_param_cmd_st create_big_common_param; + /* choose between create_big and create_big_test */ + ble_intf_create_big_cmd_un create_big_cmd_un; +} ble_intf_create_big_st; + +#endif/* SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS */ + +#if((SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) || (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS)) +/** + * @brief ble_intf_read_iso_link_cmd_st is a container to the output parameters used in read_iso_link_quality cmd + */ +typedef struct _ble_intf_read_iso_link_cmd_st{ + uint32_t crc_error_pkt_cntr; /*This counter is incremented when The Link Layer receives a packet with a CRC error.*/ + uint32_t rx_unreceived_pkt_cntr; /*This counter is incremented when The Link Layer does not receive a specific payload by its flush point (on a CIS) or the end of the event it is associated with (on a BIS)*/ + uint32_t tx_unacked_pkt_cntr; /*This counter is incremented when The Link Layer does not receive an acknowledgment for a CIS Data PDU that it transmitted at least once by its flush point*/ + uint32_t tx_flshed_pkt_cntr; /*This counter is incremented when The Link Layer does not transmit a specific payload by its flush point.*/ + uint32_t retrans_pkt_cntr; /*This counter is incremented when The Link Layer retransmits a CIS Data PDU.*/ + uint32_t duplicate_pkt_cntr; /*This counter is incremented when The Link Layer receives a retransmission of a CIS Data PDU.*/ + uint32_t tx_last_se_pkt_cntr; /*This counter is incremented when The Link Layer transmits a CIS Data PDU in the last subevent of a CIS event*/ +} ble_intf_read_iso_link_cmd_st; + +/** + * @brief ble_intf_setup_iso_data_path is a structure containing the ISO Setup Data Path params + */ +typedef struct _ble_intf_setup_iso_data_path{ + uint8_t* codec_config; /* Codec-specific configuration data */ + uint32_t controller_delay; /* Controller delay in microseconds */ + uint8_t codec_id[ISO_CODEC_ID_SIZE]; /* Octet 0 See Assigned Numbers for Coding Format + * Octet 1 to 2 Company ID, see Assigned Numbers for Company Identifier. (Shall be ignored if octet 0 is not 0xFF.) + * Octet 3 to 4 Vendor-defined codec ID. (Shall be ignored if octet 0 is not 0xFF.) + */ + uint8_t data_path_dir; /* input or output from from controller respective */ + uint8_t data_path_id; /* HCI or vendor specific */ + uint8_t codec_config_length; /* Length of codec configuration */ +} ble_intf_setup_iso_data_path; +#endif/* (SUPPORT_CONNECTED_ISOCHRONOUS || SUPPORT_BROADCAST_ISOCHRONOUS ) */ + +/** + * @brief Union containing the set parameters commands + */ +typedef union _hci_cmds_params_un +{ +#if (SUPPORT_AOA_AOD) +#if (SUPPORT_EXPLCT_BROADCASTER_ROLE) + le_set_connless_cte_tx_params_cmd_st le_set_connless_cte_tx_params_cmd; + le_set_connless_cte_tx_enable_cmd_st le_set_connless_cte_tx_enable_cmd; +#endif /* (SUPPORT_EXPLCT_BROADCASTER_ROLE) */ +#if (SUPPORT_EXPLCT_OBSERVER_ROLE) + le_set_connless_iq_sampling_enable_cmd_st le_set_connless_iq_sampling_enable_cmd; +#endif /* (SUPPORT_EXPLCT_OBSERVER_ROLE) */ +#if ((SUPPORT_MASTER_CONNECTION) || (SUPPORT_SLAVE_CONNECTION)) + le_set_conn_cte_rx_params_cmd_st le_set_conn_cte_rx_params_cmd; + le_set_conn_cte_req_enable_cmd_st le_set_conn_cte_req_enable_cmd; + le_set_conn_cte_tx_params_cmd_st le_set_conn_cte_tx_params_cmd; + le_set_conn_cte_rsp_enable_cmd_st le_set_conn_cte_rsp_enable_cmd; +#endif /* (SUPPORT_MASTER_CONNECTION) || (SUPPORT_SLAVE_CONNECTION) */ +#endif /* SUPPORT_AOA_AOD */ +#if (SUPPORT_AOA_AOD) + le_rx_test_v3_cmd_st le_rx_test_v3_cmd; + le_tx_test_v3_cmd_st le_tx_test_v3_cmd; +#endif /* SUPPORT_AOA_AOD */ + le_set_adv_params_cmd_st le_set_adv_params_cmd; + le_create_conn_cmd_st le_create_conn_cmd; + le_set_scn_params_cmd_st le_set_scn_params_cmd; + le_rmt_conn_param_req_rply_cmd_st le_rmt_conn_param_req_rply_cmd; + /* CONNECTION ISOCHRONOUS */ +#if (SUPPORT_CONNECTED_ISOCHRONOUS &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) + ble_intf_set_cig_params_comman_cmd_st ble_intf_set_cig_params_common_cmd; + ble_intf_create_cis_cmd_st ble_intf_create_cis_cmd; +// ble_intf_set_cig_params_comman_cmd_st ble_intf_set_cig_params_test_cmd; +#endif /* CONNECTION ISOCHRONOUS */ + /* BROADCAST ISOCHRONOUS */ +#if (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS) +/* SCANNER OBSERVER ROLE */ +#if(SUPPORT_SYNC_ISOCHRONOUS) + ble_intf_big_create_sync_cmd_st ble_intf_big_create_sync_cmd; +#endif/* SCANNER OBSERVER ROLE */ +/* ADVERTISER BC ROLE */ +#if(SUPPORT_BRD_ISOCHRONOUS) + ble_intf_create_big_st ble_intf_create_big_cmd; +#endif/* ADVERTISER BC ROLE */ +#endif/* BROADCAST ISOCHRONOUS */ +#if((SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION))|| (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS)) + ble_intf_setup_iso_data_path ble_intf_setup_iso_data_path_cmd; +#endif /* (SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) */ +#if (SUPPORT_LE_POWER_CONTROL) + le_enhanced_read_tx_pwr_lvl_cmd_st le_enhanced_read_tx_pwr_lvl_cmd; + le_read_remote_tx_pwr_lvl_cmd_st le_read_remote_tx_pwr_lvl_cmd; + le_set_path_loss_reporting_params_cmd_st le_set_path_loss_reporting_params_cmd; + le_set_path_loss_reporting_enable_cmd_st le_set_path_loss_reporting_enable_cmd; + le_set_tx_pwr_reporting_enable_cmd_st le_set_tx_pwr_reporting_enable_cmd; + le_tx_test_v4_cmd_st le_tx_test_v4_cmd; +#endif /* SUPPORT_LE_POWER_CONTROL */ +#if (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) + le_set_conn_tx_pwr_lvl_cmd_st le_set_conn_tx_pwr_lvl_cmd; +#endif /* SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION */ +} hci_cmds_params_un; + + + + +#if SUPPORT_LE_ENHANCED_CONN_UPDATE + + +/* struct holding the default subrate values requested by master's host also used to hold the values requested by the host from le_subrate_req */ +typedef struct subrate_default_params_st{ + uint16_t subrate_min; /*the minimum subrate factor allowed in requests by a Peripheral Range: 0x0001 to 0x01F4*/ + uint16_t subrate_max; /*the maximum subrate factor allowed in requests by a Peripheral Range: 0x0001 to 0x01F4*/ + uint16_t max_latency; /*the maximum slavePeripheral latency allowed in requests by a Peripheral,in units of subrated connection intervals Range: 0x0000 to 0x01F3*/ + uint16_t continuation_num;/*the minimum number of underlying connection events to remain active after a packet is sent or received in requests by a Peripheral Range: 0x0000 to 0x01F3*/ + uint16_t supervisionTO; /*the maximum supervision timeout allowed in requests by a Peripheral Range: 0x000A to 0x0C80*/ +}subrate_default_params_t; + +#endif /* SUPPORT_LE_ENHANCED_CONN_UPDATE */ + +/* Exported Definition ------------------------------------------------------*/ +#if ((SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) || (SUPPORT_SYNC_ISOCHRONOUS)) +typedef void (*vendor_specific_from_cntrl_to_host_cbk)(const iso_sdu_buf_hdr_p, const uint16_t conn_hndl); +#endif /* ((SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) || (SUPPORT_SYNC_ISOCHRONOUS)) */ + +#if SUPPORT_HCI_EVENT_ONLY +typedef uint8_t (*hst_cbk)(ble_buff_hdr_t *ptr_evnt_hdr); +typedef void (*hst_cbk_queue_full)(ble_buff_hdr_t *ptr_evnt_hdr); +#endif /* SUPPORT_HCI_EVENT_ONLY */ + +#if (SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) +/* missed cig events callback function type definition */ +typedef void (*hst_cig_missed_evnt_cbk)(uint8_t cig_id, uint8_t missed_intrvs, uint32_t nxt_anchor_pnt); +#endif /* (SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) */ + +#if (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS) +/* missed big events callback function type definition */ +typedef void (*hst_big_missed_evnt_cbk)(uint8_t big_hndl, uint8_t missed_intrvs, uint32_t nxt_anchor_pnt); +#endif /* (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS) */ + +/*##### Device Setup HCI Commands' Group #####*/ +/** @ingroup device_setup + * @{ + */ +/*========================================================================================================*/ +/*======================================= ll_intf Initialization ========================================*/ +/*========================================================================================================*/ +/** + * @brief Initializes the LL stack + * + * @param p_dispatch_tbl : [in] Dispatch table for HCI events + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_init(const struct hci_dispatch_tbl* p_dispatch_tbl); + + +/*========================================================================================================*/ +/*============================ HCI Commands' Groups (Based on Functionality) ============================*/ +/*========================================================================================================*/ + +/** + * @brief Reset the controller and the Link Layer on an LE controller . + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_reset(void); + +/** @} +*/ + +/*##### Controller Flow Control HCI Commands' Group #####*/ +/** @ingroup controller_info + * @{ + */ +#if(SUPPORT_SLAVE_CONNECTION || SUPPORT_MASTER_CONNECTION) +/** + * @brief Read the maximum size of the data portion of HCI LE ACL Data Packets sent from the Host to the Controller . + * + * @param le_acl_data_pkt_length : [out] Max length (in octets) of the data portion of each HCI ACL Data Packet that the controller is able to accept . + * @param total_num_le_acl_data_pkts : [out] Total number of HCI ACL Data Packets that can be stored in the data buffers of the controller . + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_read_buffer_size(uint16_t *le_acl_data_pkt_length, + uint8_t *total_num_le_acl_data_pkts); +#endif /*(SUPPORT_SLAVE_CONNECTION || SUPPORT_MASTER_CONNECTION)*/ +/*##### Controller Information HCI Commands' Group #####*/ + +/** + * @brief Read the values of the version information of the local controller . + * + * @param hci_version : [out] Defines the version information of the HCI layer . + * @param hci_revision : [out] Revision of the Current HCI in the BE/EDR Controller . + * @param lmp_version : [out] Version of the Current LMP or PAL in the Controller . + * @param manfacturer_name : [out] Manufacturer Name of the BR/EDR Controller . + * @param lmp_subversion : [out] Subversion of the Current LMP or PAL in the Controller . + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_read_local_ver_info(uint8_t *hci_version, + uint8_t *hci_revision, uint8_t *lmp_version, uint8_t *manfacturer_name, + uint8_t *lmp_subversion); + +/** + * @brief Read the version information of the controller . + * + * @param ptr_vrsn : [out] Defines the controller version information. + * @param length : [in] the length of the sent array to be written. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_read_cntrlr_ver_info(uint8_t *ptr_vrsn, uint8_t length); + +/** + * @brief Read the list of HCI commands supported for the local controller + * (It is implied that if a command is listed as supported, the feature underlying that command is also supported) . + * + * @param supported_cmds : [out] A bit mask for each HCI command, where: + * If the controller sets a bit to 1, then the controller supports the corresponding command and the features required for the comman, and + * If the controller sets a bit to 0, then this command is unsupported or undefined command . + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_read_local_supported_cmds(uint8_t supported_cmds[64]); + +/** + * @brief Read a list of the supported features for the local BR/EDR Controller including the LE Supported feature . + * + * @param lmp_features : [out] Bit Mask List of LMP features . + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_read_local_supported_features(uint8_t lmp_features[8]); + +/** + * @brief Read the list of the supported LE features for the Controller . + * + * @param le_features : [out] Bit Mask List of supported LE features . + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_read_local_supported_features( + uint8_t le_features[LE_FEATURES_BYTES_NO]); + +/** + * @brief Read the Public Device Address of the LE controller .Reset the controller and the Link Layer on an LE controller . + * + * @param bd_addr : [out] Public address of the LE controller . + * + * @retval ble_stat_t : Command status to be sent to the Host . + */ +ble_stat_t ll_intf_read_bd_addr(uint8_t bd_addr[6]); + +/*=============== Write BD_ADDR Command ===============*/ + +/** + * @brief write the Public Device Address of the LE controller . + * + * @param bd_addr : [in] Public address of the LE controller . + * + * @retval ble_stat_t : Command status to be sent to the Host . + */ +ble_stat_t ll_intf_write_bd_addr(uint8_t* bd_addr); + +/** + * @brief Read the states and state combinations that the link layer supports . + * + * @param le_states : [out] Bit Mask List of supported LE states and state combinations . + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_read_supported_states(uint8_t le_states[8]); + +#if(SUPPORT_SLAVE_CONNECTION || SUPPORT_MASTER_CONNECTION) +/** + * @brief Allow the Host to read the Controller maximum supported payload octets and packet duration times for transmission and reception . + * + * @param supported_max_tx_octets : [out] Max number of payload octets that the local Controller supports for transmission of a single LL Data Channel PDU . + * @param supported_max_tx_time : [out] Max time, in microseconds, that the local Controller supports for transmission of a single LL Data Channel PDU . + * @param supported_max_rx_octets : [out] Max number of payload octets that the local Controller supports for reception of a single LL Data Channel PDU . + * @param supported_max_rx_time : [out] Max time, in microseconds, that the local Controller supports for reception of a single LL Data Channel PDU . + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_read_max_data_length(uint8_t *supported_max_tx_octets, + uint8_t *supported_max_tx_time, uint8_t *supported_max_rx_octets, + uint8_t *supported_max_rx_time); +#endif /* SUPPORT_SLAVE_CONNECTION || SUPPORT_MASTER_CONNECTION */ + +/** @} +*/ +/*##### Controller Configuration HCI Commands' Group #####*/ +/** @ingroup adv_cfg + * @{ + */ +#if(SUPPORT_EXPLCT_BROADCASTER_ROLE || SUPPORT_SLAVE_CONNECTION || SUPPORT_BRD_ISOCHRONOUS) +/** + * @brief Set the advertising parameters, sent by the host, in the controller. + * + * @param ptr_hst_adv_params : [in] Structure containing the host adv params. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_adv_params(le_set_adv_params_cmd_st *ptr_hst_adv_params); + +/** + * @brief Set the data used in advertising packets that have a data field. This data is sent by the Host to the Controller. + * + * @param adv_data_length : [in] Number of significant octets in the advertising data command parameter. + * @param adv_data : [in] Advertising data sent by the host to be sent in the advertising packets. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_adv_data(uint8_t adv_data_length, + uint8_t adv_data[31]); +#endif /* SUPPORT_EXPLCT_BROADCASTER_ROLE || SUPPORT_SLAVE_CONNECTION || SUPPORT_BRD_ISOCHRONOUS */ + +#if (SUPPORT_SLAVE_CONNECTION || SUPPORT_EXPLCT_BROADCASTER_ROLE) +/** + * @brief Set the data used in Scanning Packets that have a data field. This data is sent by the Host to the Controller. + * + * @param scan_rsp_data_length : [in] Number of significant octets in the scan response data command parameter. + * @param scan_rsp_data : [in] Scanning response data sent by the host to be sent in the scanning packets. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_scan_rsp_data(uint8_t scan_rsp_data_length, + uint8_t scan_rsp_data[31]); +#endif /* SUPPORT_SLAVE_CONNECTION || SUPPORT_EXPLCT_BROADCASTER_ROLE */ + +#if(SUPPORT_EXPLCT_BROADCASTER_ROLE || SUPPORT_SLAVE_CONNECTION || SUPPORT_BRD_ISOCHRONOUS) +/** + * @brief Command the controller to start or stop advertising based on the Host's request. + * + * @param adv_enable : [in] If 0x00, advertising is disabled. + * If 0x01, advertising is enabled. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_adv_enable(uint8_t adv_enable); +#endif /* SUPPORT_EXPLCT_BROADCASTER_ROLE || SUPPORT_SLAVE_CONNECTION || SUPPORT_BRD_ISOCHRONOUS */ + +/** @} +*/ + +/** @ingroup controller_info + * @{ + */ +/** + * @brief Set the LE Random Device Address in the Controller. This address is sent by the Host. + * + * @param random_addr : [in] Random Device Address sent by the Host to the Controller. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_random_addr(uint8_t random_addr[6]); +/**@} + */ + +#if (SUPPORT_PRIVACY) +/*##### Controller Configuration HCI Commands' Group #####*/ +/** @ingroup privacy_cfg + * @{ + */ +/** + * @brief Set the length of time the controller uses a Resolvable Private Address before a new resolvable + private address is generated and starts being used. + * + * @param rpa_timeout : [in] Resolvable Private Address timeout measured in seconds. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +/**@} + */ +ble_stat_t ll_intf_le_set_resolvable_private_addr_timeout(uint16_t rpa_timeout); + +#endif /* SUPPORT_PRIVACY */ + +/*##### Device Discovery HCI Commands' Group #####*/ +/** @ingroup scn_cfg + * @{ + */ +#if(SUPPORT_MASTER_CONNECTION || SUPPORT_EXPLCT_OBSERVER_ROLE) +/** + * @brief Set the scan parameters, sent by the Host,in the controller. + * + * @param ptr_hst_scn_params : [in] Pointer to the set scan command parameters. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_scan_params(le_set_scn_params_cmd_st *ptr_hst_scn_params); + +/** + * @brief Command the controller to start or stop scanning based on the Host's request. + * + * @param scan_enable : [in] If 0x00, scanning is disabled,If 0x01, scanning is enabled. + * @param filter_duplicates : [in] control whether the LL should filter out duplicate advertising reports to the Host, or if the LL should generate advertising reports for each packet received. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_scan_enable(uint8_t scan_enable, + uint8_t filter_duplicates); +/**@} + */ +#endif /* SUPPORT_MASTER_CONNECTION || SUPPORT_EXPLCT_OBSERVER_ROLE */ + +/*##### Connection Setup HCI Commands' Group #####*/ +/** @ingroup Conn_cfg Connection Commands + * @{ + */ +#if(SUPPORT_MASTER_CONNECTION) +/** + * @brief Used to create a LL connection to a connectable advertiser. + * + * @param ptr_hst_init_params : [in] Pointer to the create connection command parameters. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_create_conn(le_create_conn_cmd_st *ptr_hst_init_params); + +/** + * @brief Used to cancel the "LE_Create_Connection" Command. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_create_conn_cancel(void); +#endif /* SUPPORT_MASTER_CONNECTION */ + +#if(SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) +/** + * @brief Used to terminate an existing connection. + * + * @param conn_handle_id : [in] Connection_Handle for the connection being disconnected. + * @param reason : [in] indicate the reason for ending the connection. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_disconnect(uint16_t conn_handle_id, uint8_t reason); +#endif +/** @} +*/ +/*##### Physical Links HCI Commands' Group #####*/ + +#if SUPPORT_MASTER_CONNECTION || \ + (SUPPORT_SLAVE_CONNECTION && SUPPORT_CHANNEL_CLASSIFICATION) || \ + (SUPPORT_LE_EXTENDED_ADVERTISING && (SUPPORT_SLAVE_CONNECTION || SUPPORT_EXPLCT_BROADCASTER_ROLE)) +/** @ingroup chnlmap_cfg Channel Map Commands + * @{ + */ +/** + * @brief Used to allow the Host to specify a channel classification for data channels based on its "local information". + * + * @param channel_map : [in] Bit Mask parameter to classify each LL channel index. + * If a bit is set to 0, then the corresponding LL channel index is bad, and + * If a bit is set to 1, then the corresponding LL channel index is unknown. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_host_channel_classification(uint8_t channel_map[]); +/**@} + */ +#endif /* SUPPORT_MASTER_CONNECTION || (SUPPORT_SLAVE_CONNECTION && SUPPORT_CHANNEL_CLASSIFICATION) || (SUPPORT_EXPLCT_BROADCASTER_ROLE && SUPPORT_LE_EXTENDED_ADVERTISING) */ + +/*##### Host Flow Control HCI Commands' Group #####*/ +/** @ingroup white_list_cfg White list Commands + * @{ + */ +/** + * @brief Add a single device to the white list stored in the Controller. + * + * @param addr_type : [in] Address type of the device to be added to the white list of the controller. + * @param addr : [in] Public Device Address or Random Device Address of the device to be added to the white list. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_add_device_white_list(uint8_t addr_type, uint8_t addr[6]); + +/** + * @brief Remove a single device from the white list stored in the Controller. + * + * @param addr_type : [in] Address type of the device to be added to the white list of the controller. + * @param addr : [in] Public Device Address or Random Device Address of the device to be removed from the white list. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_remove_device_white_list(uint8_t addr_type, + uint8_t addr[6]); + +/** + * @brief Clear the white list stored in the Controller. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_clear_white_list(void); + +/** + * @brief Read the total number of white list entries that can be stored in the Controller. + * + * @param white_list_size : [out] Total number of white list entries that can be stored in the Controller. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_read_white_list_size(uint8_t *white_list_size); + +/** @} +*/ + +/** @ingroup privacy_cfg + * @{ + */ + +#if (SUPPORT_PRIVACY &&(SUPPORT_EXPLCT_BROADCASTER_ROLE || SUPPORT_SLAVE_CONNECTION || SUPPORT_BRD_ISOCHRONOUS)) +/** + * @brief Set the reasons that trigger generating RPA + * bit0 : regenerate when adv data change + * bit1 : regenerate when scan response data change + * + * @param[in] handler handler to the advertising set to assign its change_reason parameter + * @param[in] chng_resns the new change_reason value bit 0 : Change the address whenever the advertising data changes bit 1 : Change the address whenever the scan response data changes + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_data_related_address_changes_command(uint8_t handler, uint8_t chng_resns); +#endif /*SUPPORT_PRIVACY &&(SUPPORT_EXPLCT_BROADCASTER_ROLE || SUPPORT_SLAVE_CONNECTION || SUPPORT_BRD_ISOCHRONOUS)*/ + + +#if (SUPPORT_PRIVACY) +/** + * @brief Used to add one device to the list of address translations used to resolve Resolvable Private + * Addresses in the Controller + * + * @param peer_id_addr_type : [in] Peer address type whether public or random (static). + * @param peer_id_addr : [in] Public or Random (static) Identity address of the peer device. + * @param peer_irk : [in] A pointer to the IRK of the peer device. + * @param lcl_irk : [in] A pointer to the IRK of the local device. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_add_device_rsolv_list(uint8_t peer_id_addr_type, + uint8_t peer_id_addr[ADDRESS_SIZE], uint8_t *peer_irk, uint8_t *lcl_irk); + +/** + * @brief Used to remove one device from the list of address translations used to resolve Resolvable + * Private Addresses in the controller. + * + * @param peer_id_addr_type : [in] Address type of the device to be added to the resolving list of the controller. + * @param peer_id_addr : [in] Public Device Address or Random Device Address of the device to be removed from the resolving list. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_remove_device_rsolv_list(uint8_t peer_id_addr_type, + uint8_t peer_id_addr[ADDRESS_SIZE]); + +/** + * @brief used to remove all devices from the list of address translations used to resolve + * Resolvable Private Addresses in the Controller. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_clear_rsolv_list(void); + +/** + * @brief Read the total number of white list entries that can be stored in the Controller. + * + * @param rsolv_list_size : [out] Number of address translation entries in the resolving list. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_read_rsolv_list_size(uint8_t *rsolv_list_size); + +/** + * @brief Used to get the current peer Resolvable Private Address being used for the corresponding + * peer Public and Random (static) Identity Address. + * + * @param peer_id_addr_type : [in] Address type of the peer device to be read by the controller. + * @param peer_id_addr : [in] Public Device Address or Random Device Address of the peer device to be read by the controller. + * @param peer_rsolvabl_addr : [out] Peer resolvable address of the peer device. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_read_peer_rsolvabl_addr(uint8_t peer_id_addr_type, + uint8_t peer_id_addr[ADDRESS_SIZE], + uint8_t peer_rsolvabl_addr[ADDRESS_SIZE]); + +/** + * @brief Used to get the current local Resolvable Private Address being used for the corresponding peer Identity Address. + * + * @param peer_id_addr_type : [in] Address type of the peer device. + * @param peer_id_addr : [in] Public Device Address or Random Device Address of the peer device. + * @param lcl_rsolvabl_addr : [out] Resolvable address of the local device read by the controller. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_read_lcl_rsolvabl_addr(uint8_t peer_id_addr_type, + uint8_t peer_id_addr[ADDRESS_SIZE], + uint8_t lcl_rsolvabl_addr[ADDRESS_SIZE]); + +/** + * @brief Used to enable resolution of Resolvable Private Addresses in the Controller. + * + * @param addr_rsln_enble : [in] Parameter to enable or disable the address resolution in the controller. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_addr_rsln_enble(uint8_t addr_rsln_enble); + +/* + * @brief Used to set the privacy mode for a specific peer in the Controller. + * + * @param peer_id_addr_type : [in] Address type of the peer device. + * @param peer_id_addr : [in] Public Device Address or Random Device Address of the peer device. + * @param prvcy_mode : [in] Privacy Mode of this peer (Network or Device). + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_privacy_mode(uint8_t peer_id_addr_type, + uint8_t peer_id_addr[ADDRESS_SIZE], + ble_prvcy_mod_e prvcy_mode); +/** @} +*/ +#endif + +/*##### Link Information HCI Commands' Group #####*/ +/*##### Connection Setup HCI Commands' Group #####*/ +/** @ingroup Conn_cfg Connection Commands + * @{ + */ +#if (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) +/** + * @brief Read the value of the transmit power level of certain connection handle. + * + * @param conn_handle_id : [in] Specify which Connection_Handle’s Transmit Power Level setting to read. + * @param type : [in] Type of the transmit power level to be read, whether current transmit power level or maximum transmit power level. + * @param transmit_power_level : [out] Transmit power level value to be returned. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_read_transmit_power_level(uint16_t conn_handle_id, + uint8_t type, int8_t *transmit_power_level); + +/** + * @brief Read the RSSI value for a ceratin connection from the controller. + * + * @param conn_handle_id : [in] Handle for the connection for which the RSSI is to be read. + * @param rssi : [out] RSSI (Received Signal Strength Indication) value read from the controller. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_read_rssi(uint16_t conn_handle_id, int8_t *rssi); +#endif /* SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION */ +/** @} +*/ + +#if(SUPPORT_SLAVE_CONNECTION || SUPPORT_EXPLCT_BROADCASTER_ROLE) +/** @ingroup tx_pwr_cfg Tx Power Commands + * @{ + */ +/** + * @brief Read the transmit power level used for LE advertising channel packets from the controller. + * + * @param transmit_power_level : [out] Transmit power level value for LE advertising channel packets read from the controller. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_read_adv_channel_tx_power(int8_t *transmit_power_level); +/**@} + */ +#endif /* SUPPORT_SLAVE_CONNECTION || SUPPORT_EXPLCT_BROADCASTER_ROLE */ + +#if (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) +/** @ingroup chnlmap_cfg Channel Map Commands + * @{ + */ +/** + * @brief Read the current channel map of a certain connection from the controller. + * + * @param conn_handle_id : [in] Connection handle for the connection for which the channel map is to be read. + * @param channel_map : [out] The current channel map for the specified connection handle. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_read_channel_map(uint16_t conn_handle_id, + uint8_t channel_map[5]); +/**@} + */ +#endif /* SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION */ + +/*##### Authentication and Encryption HCI Commands' Group #####*/ +/** @ingroup enc_cfg Authentication and Encryption Commands + * @{ + */ +#if (SUPPORT_LE_ENCRYPTION) +/** + * @brief Request the controller to encrypt the data provided with the given key. + * + * @param ptr_key : [in] A pointer to 128 bit key for the encryption of the data. + * @param ptr_plaintxt_data : [in] A pointer to 128 bit data block that is requested to be encrypted. + * @param ptr_encrptd_data : [out] A pointer to the encrypted data. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_encrypt(uint8_t *ptr_key, uint8_t *ptr_plaintxt_data, + uint8_t *ptr_encrptd_data); +#endif /* SUPPORT_LE_ENCRYPTION */ + +#if (SUPPORT_LE_ENCRYPTION && SUPPORT_SLAVE_CONNECTION) +/** + * @brief Used to reply to an LE Long Term Key Request event from the controller. + * + * @param conn_handle_id : [in] Connection_Handle to be used to identify the connection. + * @param ptr_long_trm_key : [in] A pointer to 128 bit long term key provided by the Host. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_rcvd_long_trm_key(uint16_t conn_handle_id, + uint8_t *ptr_long_trm_key); +#endif /* (SUPPORT_LE_ENCRYPTION && SUPPORT_SLAVE_CONNECTION) */ + +#if SUPPORT_LE_ENCRYPTION +/** + * @brief Request the Controller to generate 8 octets of random data to be sent to the Host. + * + * @param ptr_rand_data : [out] A pointer to the random number generated by the controller. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_rand_data(uint8_t *ptr_rand_data); +#endif /* SUPPORT_LE_ENCRYPTION */ + +#if (SUPPORT_LE_ENCRYPTION && SUPPORT_MASTER_CONNECTION) +/** + * @brief Used to authenticate the given encryption key and to encrypt the connection. + * + * @param conn_handle_id : [in] Connection_Handle to be used to identify the connection. + * @param ptr_rand_num : [in] A pointer to 64 bit random number to be used in encryption. + * @param encrptd_divrsfier : [in] A pointer to 16 bit encrypted diversifier to be used in encryption. + * @param ptr_long_trm_key : [in] A pointer to 128 bit long term key to be used in encryption. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_strt_encrpt(uint16_t conn_handle_id, + uint8_t *ptr_rand_num, uint16_t encrptd_divrsfier, + uint8_t * ptr_long_trm_key); +#endif /* SUPPORT_LE_ENCRYPTION && SUPPORT_MASTER_CONNECTION */ +/** @} +*/ + +/*##### DTM Commands' Group #####*/ +/** @ingroup dtm_cfg DTM Commands + * @{ + */ +/** + * @brief run the LE receiver test. + * + * @param rx_channel : [in] rx channel value: + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_receiver_test(uint8_t rx_channel); + +/** + * @brief run the LE transmitter test. + * + * @param tx_channel : [in] tx channel value. + * @param length_of_test_data : [in] Length in bytes of payload data in each packet. + * @param packet_payload : [in] Packet payload type in each packet as in (7.8.29). + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_transmitter_test(uint8_t tx_channel, + uint8_t length_of_test_data, uint8_t packet_payload); + +/** + * @brief end LE test. + * + * @param number_of_packets : Pointer to number of packets received. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_test_end(uint16_t* number_of_packets); + +/** + * @brief The LE Set PHY command is used to request a change to the transmitter PHY and receiver PHY for a connection. + * + * @param rx_channel : [in] Frequency Range 0x00 to 0x27 + * @param phy : [in] Receiver set to 1M/2M/coded PHY + * @param modulation_index : [in] Modulation index type (standard/stable) + * + * @retval status : [out] 0:SUCCESS, 0xXX:ERROR_CODE. + * + */ +ble_stat_t ll_intf_le_enhanced_receiver_test(uint8_t rx_channel, + uint8_t phy, uint8_t modulation_index); + +/** + * @brief The LE Set PHY command is used to request a change to the transmitter PHY and receiver PHY for a connection. + * + * @param tx_channel : [in] Frequency Range 0x00 to 0x27 + * @param length_of_test_data : [in] Length in bytes of payload data in each packet + * @param packet_payload : [in] Sequence + * @param phy : [in] Transmitter set to 1M/2M/coded PHY + * + * @retval status : [out] 0:SUCCESS, 0xXX:ERROR_CODE. + */ +ble_stat_t ll_intf_le_enhanced_transmitter_test(uint8_t tx_channel, + uint8_t length_of_test_data, uint8_t packet_payload, uint8_t phy); + + +#if (SUPPORT_AOA_AOD) +/*================ LE receiver Test [v3] Command =====================*/ +/** + * @brief Used to start a test where the DUT receives test reference packets at a fixed interval. This command includes the Constant Tone Extension feature. + * + * @param ptr_hci_cmd_params : [in] Pointer to the HCI command parameters. + * + * @retval status : [out] 0:SUCCESS, 0xXX:ERROR_CODE. + * + */ +ble_stat_t ll_intf_le_receiver_test_v3(le_rx_test_v3_cmd_st *ptr_hci_cmd_params); + +/*================ LE transmitter Test [v3] Command =====================*/ +/** + * @brief Used to start a test where the DUT generates test reference packets at a fixed interval and including the Constant Tone Extension feature. + * + * @param ptr_hci_cmd_params : [in] Pointer to the HCI command parameters. + * + * @retval status : [out] 0:SUCCESS, 0xXX:ERROR_CODE. + * + */ +ble_stat_t ll_intf_le_transmitter_test_v3(le_tx_test_v3_cmd_st *ptr_hci_cmd_params); +#endif /* SUPPORT_AOA_AOD */ + + +#if SUPPORT_CHANNEL_CLASSIFICATION +/** + * @brief Read the current channel assessment mode of the controller + * + * @param ptr_assessment_mode : [out] A pointer to the channel assessment mode used by the controller + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_read_afh_chnl_assessment_mode(uint8_t *ptr_assessment_mode); + +/** + * @brief Write channel assessment mode to be used by the controller + * + * @param assessment_mode : [in] channel assessment mode set by the host to be used by the controller + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_write_afh_chnl_assessment_mode(uint8_t assessment_mode); +#endif /* SUPPORT_CHANNEL_CLASSIFICATION */ + + +/** @} +*/ + +/** @ingroup enc_cfg Authentication and Encryption Commands + * @{ + */ +#if (SUPPORT_LE_ENCRYPTION && (SUPPORT_SLAVE_CONNECTION || SUPPORT_MASTER_CONNECTION)) +/** + * @brief Write the LE Authenticated Payload Timeout for the LE connection + * + * @param conn_handle_id : [in] Connection_Handle to be used to identify the connection. + * @param authn_pyld_tout : [in] Maximum amount of time specified between packets authenticated by a valid MIC. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_wrte_authn_pyld_tout(uint16_t conn_handle_id, + uint16_t authn_pyld_tout); + +/** + * @brief Read the LE Authenticated Payload Timeout for the LE connection. + * + * @param conn_handle_id : [in] Connection_Handle to be used to identify the connection. + * @param ptr_authn_pyld_tout : [out] A pointer to the authenticated payload timeout, which is the maximum amount of time + * specified between packets authenticated by a MIC. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_read_authn_pyld_tout(uint16_t conn_handle_id, + uint16_t *ptr_authn_pyld_tout); +#endif /* SUPPORT_LE_ENCRYPTION && (SUPPORT_SLAVE_CONNECTION || SUPPORT_MASTER_CONNECTION) */ +/** @} +*/ + +/*##### Remote Information HCI Commands' Group #####*/ + +/** @ingroup remote_info_cfg Remote Information HCI Commands + * @{ + */ +#if(SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) +/** + * @brief Read the values for the version information for the remote device associated with the Connection_Handle. + * + * @param conn_handle_id : [in] Connection Handle Id version information to get. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_read_remote_version_info(uint16_t conn_handle_id); + +/** + * @brief Read the used features of a LE remote device. + * + * @param conn_handle_id : [in] Connection Handle Id to identify a connection. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_read_remote_used_features(uint16_t conn_handle_id); +/**@} + */ + +/*##### Connection State HCI Commands' Group #####*/ +/** @ingroup conn_state_cmds Connection State HCI Commands + * @{ + */ +/** + * @brief Used to change the connection parameters of an existing connection. + * + * @param conn_handle_id : [in] Connection Handle Id to identify a connection. + * @param conn_interval_min : [in] Minimum value for the connection event interval. + * @param conn_interval_max : [in] Maximum value for the connection event interval. + * @param slave_latency : [in] Slave latency for the connection in number of connection events. + * @param supervsn_timeout : [in] Supervision timeout for the LE Link. + * @param min_ce_length : [in] Information parameter about the minimum length of connection event needed for this LE connection. + * @param max_ce_length : [in] Information parameter about the maximum length of connection event needed for this LE connection. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_conn_update(uint16_t conn_handle_id, + uint16_t conn_interval_min, uint16_t conn_interval_max, + uint16_t slave_latency, uint16_t supervsn_timeout, + uint16_t min_ce_length, uint16_t max_ce_length); + +/** + * @brief is used to accept the remote device’s request to change the connection parameters of the LE connection. + * + * @param conn_handle_id : [in] Connection Handle Id to be used to identify a connection. + * @param ptr_new_conn_param : [in] Pointer to the new connection parameters. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_remote_conn_parm_req_reply( + uint16_t conn_handle_id, + le_rmt_conn_param_req_rply_cmd_st *ptr_new_conn_param); + +/** + * @brief is used to reject the remote device’s request to change the connection parameters of the LE connection. + * + * @param conn_handle_id : [in] Connection Handle Id to be used to identify a connection. + * @param reason : [in] Reason that the connection parameter request was rejected. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_remote_conn_parm_req_neg_reply(uint16_t conn_handle_id, + uint8_t reason); + +/** + * @brief is used to suggest maximum packet sizes to the Controller. + * + * @param conn_handle_id : [in] Connection Handle Id to be used to identify a connection. + * @param tx_octets : [in] Preferred maximum number of payload octets that the local Controller should include in a single Link Layer Data Channel PDU. + * @param tx_time : [in] Preferred maximum number of microseconds that the local Controller should use to transmit a single Link Layer Data Channel PDU. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_data_length(uint16_t conn_handle_id, + uint16_t tx_octets, uint16_t tx_time); + +/** + * @brief allows the Host to read the initial MaxTxOctets and MaxTx-Time values for new connections it suggested to the Controller. + * + * @param sug_max_tx_octets : [out] used for new connections - connInitialMaxTxOctets. + * @param sug_max_tx_time : [out] used for new connections - connInitialMaxTx-Time. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_read_sugg_default_data_length(uint16_t *sug_max_tx_octets, + uint16_t *sug_max_tx_time); + +/** + * @brief allows the Host to suggest initial MaxTxOctets and MaxTxTime values for new connections. + * + * @param sug_max_tx_octets : [in] used for new connections - connInitialMaxTxOctets. + * @param sug_max_tx_time : [in] used for new connections - connInitialMaxTx-Time. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_wrt_sugg_default_data_length(uint16_t sug_max_tx_octets, + uint16_t sug_max_tx_time); + +/** + * @brief received data packets from host to controller. + * + * @param conn_handle_id : [in] Connection Handle ID. + * @param ptr_pkt : [in] Pointer to the data sent from host. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_acl_data_from_host_to_cntrlr(uint16_t conn_handle_id, + ble_buff_hdr_t *ptr_pkt); +#endif /* SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION */ +/** @} +*/ + +#if SUPPORT_LE_EXTENDED_ADVERTISING +#if (SUPPORT_EXPLCT_BROADCASTER_ROLE || SUPPORT_SLAVE_CONNECTION || SUPPORT_BRD_ISOCHRONOUS) +/** @ingroup adv_cfg + * @{ + */ +/*================ The extended advertising =====================*/ +/*================ LE Set Advertising Set Random Address Command =====================*/ +/** + * @brief Set Advertising Set Random Address Command, sent by the host, in the controller. + * + * @param adv_handle : [in] Advertising Handle used to identify an advertising set. + * @param ptr_random_adv_addrs : [in] pointer to the Random Device Address, This address is used in the Controller + * for the advertiser's address contained in the advertising PDUs for the + * advertising set specified by the adv_handle parameter. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_adv_set_random_addrs(uint8_t adv_handle, + uint8_t *ptr_random_adv_addrs); + +/* ================ LE Set Extended Advertising Parameters Command =====================*/ +/* + * @brief Set Extended Advertising Parameters Command , used by the Host to set the advertising parameters. . + * + * @param adv_handle : [in] Advertising Handle used to identify an advertising set. + * @param adv_properties : [in] describes the type of advertising event that is being configured and its basic properties. + * @param prim_adv_intrv_min : [in] Minimum advertising interval for undirected and low duty cycle directed advertising. + * @param prim_adv_intrv_max : [in] Maximum advertising interval for undirected and low duty cycle directed advertising. + * @param prim_adv_chnl_map : [in] indicates the advertising channels that shall be used when transmitting advertising packets.. + * @param own_addrs_type : [in] specifies the type of address being used in the advertising packets. + * @param peer_addrs_type : [in] specifies the type of the peer address being used in the advertising packets. + * @param ptr_peer_addrs : [in] pointer to the Peer Device Address, This address is used in the Controller + * for the advertiser's address contained in the advertising PDUs for the + * advertising set specified by the adv_handle parameter. + * @param adv_filter_policy : [in] Advertising Filter Policy to be used for the advertising set specified by the adv_handle parameter. + * @param prim_adv_phy : [in] indicates the PHY on which the + advertising packets are transmitted on the primary advertising channel. + * @param sec_adv_max_skip : [in] the maximum number of advertising events that can be skipped before the AUX_ADV_IND can be sent. + * @param sec_adv_phy : [in] indicates the PHY on which the advertising packets are be transmitted on the + * secondary advertising channel. + * @param adv_sid : [in] specifies the value to be transmitted in the Advertising SID subfield of the ADI field of the + * Extended Header of those advertising channel PDUs that have an ADI field.. + * @param scan_req_notfy : [in] indicates whether the Controller shall send notifications upon the receipt of a scan request PDU that + * is in response to an advertisement from the specified advertising set that contains its device address and is + * from a scanner that is allowed by the advertising filter policy. + * @param *selected_tx_pwr : [out] pointer to the selected TX power value to be set by link layer. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_extended_adv_params(uint8_t adv_handle, + uint16_t adv_properties, uint32_t prim_adv_intrv_min, + uint32_t prim_adv_intrv_max, uint8_t prim_adv_chnl_map, + uint8_t own_addrs_type, uint8_t peer_addrs_type, + uint8_t *ptr_peer_addrs, uint8_t adv_filter_policy, int8_t adv_tx_power, + uint8_t prim_adv_phy, uint8_t sec_adv_max_skip, uint8_t sec_adv_phy, + uint8_t adv_sid, uint8_t scan_req_notfy, int8_t *selected_tx_pwr); + +/*================ LE Set Extended Advertising Data Command =====================*/ +/** + * @brief Set Extended Advertising Data Command , used by the Host to set the advertising data. . + * + * @param adv_handle : [in] Advertising Handle used to identify an advertising set. + * @param adv_data_operation : [in] indicates if the data is intermediate fragment, first fragment , last fragment, or + * Complete extended advertising data, or unchanged data(just update the DID). + * @param fragmnt_preference : [in] provides a hint to the Controller as to whether advertising data should be fragmented. + * @param adv_data_length : [in] The number of octets in the Advertising Data parameter. + * @param ptr_adv_data : [in] pointer Advertising data formatted as defined in [Vol 3] Part C, Section 11 of the standard. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_extended_adv_data(uint8_t adv_handle, + uint8_t adv_data_operation, uint8_t fragmnt_preference, + uint8_t adv_data_length, uint8_t *ptr_adv_data); + +/*================ LE Set Extended Scan Response Data Command =====================*/ +/** + * @brief Set Extended Scan Response Data Command , used by the Host to set the Scan Responsedata. . + * + * @param adv_handle : [in] Advertising Handle used to identify an advertising set. + * @param scn_rsp_data_operation : [in] indicates if the data is intermediate fragment, first fragment , last fragment, or + * Complete extended scan response data, or unchanged data(just update the DID). + * @param fragmnt_preference : [in] provides a hint to the Controller as to whether scan response data should be fragmented. + * @param scn_rsp_data_length : [in] The number of octets in the scan response Data parameter. + * @param ptr_scn_rsp_data : [in] pointer scan response data formatted as defined in [Vol 3] Part C, Section 11 of the standard. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_extended_scn_rsp_data(uint8_t adv_handle, + uint8_t scn_rsp_data_operation, uint8_t fragmnt_preference, + uint8_t scn_rsp_data_length, uint8_t *ptr_scn_rsp_data); + +/*================ LE Set Extended Advertising Enable Command =====================*/ +/** + * @brief Set Extended Advertising Enable is used to request the + * Controller to enable or disable one or more advertising sets using the + * advertising sets identified by the Advertising handles . + * + * @param adv_enbl : [in] For disable the advertising set it to zero , for enable set it to one . + * @param num_of_sets : [in] the number of advertising sets contained in the parameter arrays. + * @param ptr_ext_adv_enable_params : [in] Pointer represents array of advertising enable structure. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_extended_adv_enable(uint8_t adv_enbl, + uint8_t num_of_sets, + st_ble_intf_ext_adv_enable_params* ptr_ext_adv_enable_params); + +/*================ LE Read Maximum Advertising Data Length Command =====================*/ +/** + * @brief is used to read the maximum length of data supported by the Controller for use as + * advertisement data or scan response data in an advertising event or as periodic advertisement data. + * + * @param ptr_max_adv_data_len : [out] pointer to the maximum length of advertisement data or scan response data. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_read_max_adv_data_len(uint16_t *ptr_max_adv_data_len); + +/*================ LE Read Maximum Advertising Data Length Command =====================*/ +/** + * @brief is used to read the maximum number of advertising sets supported by the advertising Controller at the same time. + * + * @param ptr_max_num_of_adv_sets : [out] pointer to the maximum number of advertising sets supported by the advertising + * Controller at the same time. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_read_max_num_of_adv_sets(uint8_t *ptr_max_num_of_adv_sets); + +/*================ LE Remove Advertising Set Command =====================*/ +/** + * @brief is used to remove an advertising set from the Controller. + * + * @param adv_hndl : [in] Used to identify an advertising set. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_rmv_adv_set(uint8_t adv_hndl); + +/*================ LE Clear Advertising Sets Command =====================*/ +/** + * @brief is used to remove all existing advertising sets from the Controller. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_clear_adv_sets(void); + +#if SUPPORT_LE_PERIODIC_ADVERTISING +/** + * @brief Set periodic advertising parameters. + * + * @param advertising_handle : [in] Advertising handle referring to an advertising instant. + * @param periodic_advertising_interval_min : [in] Minimum value for periodic advertising interval. + * @param periodic_advertising_interval_max : [in] Maximum value for periodic advertising interval. + * @param periodic_advertising_properties : [in] Indicates which fields should be included in the advertising packet. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_periodic_adv_params(uint8_t advertising_handle, + uint16_t periodic_advertising_interval_min, + uint16_t periodic_advertising_interval_max, + uint16_t periodic_advertising_properties); +/** + * @brief Set periodic advertising data. + * + * @param advertising_handle : [in] Advertising handle referring to an advertising instant. + * @param operation : [in] Information for Host fragmentation. + * @param advertising_data_length : [in] Length of Host advertising data. + * @param ptr_periodic_adv_data : [in] Pointer to Host advertising data. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_periodic_adv_data(uint8_t advertising_handle, + uint8_t operation, uint8_t advertising_data_length, + uint8_t *ptr_periodic_adv_data); + +/** + * @brief Enable/Disable periodic advertising. + * + * @param enable : [in] Enable/Disable advertising. + * @param advertising_handle : [in] Advertising handle referring to an advertising instant. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_periodic_adv_enable(uint8_t enable, + uint8_t advertising_handle); +#endif /* SUPPORT_LE_PERIODIC_ADVERTISING */ +#endif /* (SUPPORT_EXPLCT_BROADCASTER_ROLE || SUPPORT_SLAVE_CONNECTION || SUPPORT_BRD_ISOCHRONOUS) */ +/**@} +*/ + +/** @ingroup scn_cfg + * @{ + */ +#if (SUPPORT_MASTER_CONNECTION || SUPPORT_EXPLCT_OBSERVER_ROLE) +/** + * @brief Set extended scanning parameters. + * + * @param own_address_type : [in] Own (scanner) address type. + * @param scanning_filter_policy : [in] Filter policy used in scanning state. + * @param scanning_phys : [in] PHY(s) on which the advertising packets should be received on the primary advertising channel. + * @param ptr_ext_scn_params : [in] Pointer represents extended scanning parameters each PHY. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_extended_scan_params(uint8_t own_address_type, + uint8_t scanning_filter_policy, uint8_t scanning_phys, + st_ble_intf_ext_scn_params* ptr_ext_scn_params); + +/** + * @brief Enable/Disable extended scanning. + * + * @param scan_enable : [in] Scanning enable/disable flag. + * @param filter_duplicates : [in] Filter out duplicate advertising reports flag. + * @param durtion : [in] Scanning duration. + * @param period : [in] scanning period. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_extended_scan_enable(uint8_t scan_enable, + uint8_t filter_duplicates, uint16_t durtion, uint16_t period); +#endif /* (SUPPORT_MASTER_CONNECTION || SUPPORT_EXPLCT_OBSERVER_ROLE) */ +/**@} +*/ + +/** @ingroup Conn_cfg Connection Commands + * @{ + */ +#if (SUPPORT_MASTER_CONNECTION) +/** + * @brief Start initiating to create a connection. + * + * @param initiator_filter_policy : [in] Scanning enable/disable flag. + * @param own_addr_type : [in] Filter policy used in initiating state. + * @param peer_addr_type : [in] Peer address type. + * @param ptr_peer_address : [in] Pionter to peer address. + * @param initiating_phys : [in] PHY(s) on which the advertising packets should be received on the primary advertising channel.. + * @param ptr_ext_create_conn : [in] Pointer represents extended create connection structure. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_extended_create_conn(uint8_t initiator_filter_policy, + uint8_t own_addr_type, uint8_t peer_addr_type, + uint8_t* ptr_peer_address, uint8_t initiating_phys, + st_ble_intf_ext_create_conn* ptr_ext_create_conn); +#endif /* (SUPPORT_MASTER_CONNECTION) */ +/**@} +*/ + +#if (SUPPORT_MASTER_CONNECTION || SUPPORT_EXPLCT_OBSERVER_ROLE) && SUPPORT_LE_PERIODIC_ADVERTISING +/** @ingroup prdc_sync_cmds Periodic Synchronization Commands + * @{ + */ +/** + * @brief Set periodic advertising create sync. + * + * @param options : [in] Determine whether the Periodic Advertiser List is used. + * @param advertising_sid : [in] Advertiser set ID. + * @param advertising_address_type : [in] Advertiser address type. + * @param ptr_advertiser_address : [in] Pointer to advertiser address. + * @param skip : [in] Number of consecutive periodic advertising packets that the receiver may skip after successfully receiving a periodic advertising packet. + * @param sync_timeout : [in] Maximum permitted time between successful receives. + * @param cte_type : [in] Specifies whether to only sync to periodic advertising with certain types of Constant Tone Extension. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_periodic_adv_create_sync(uint8_t options, + uint8_t advertising_sid, uint8_t advertising_address_type, + uint8_t *ptr_advertiser_address, uint16_t skip, uint16_t sync_timeout,uint8_t cte_type); + +/** + * @brief Cancel periodic advertising create sync cancel. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_periodic_adv_create_sync_cancel(void); + +/** + * @brief Cancel periodic advertising terminate sync. + * + * @param sync_handle : Used to identify the periodic advertiser. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_periodic_adv_terminate_sync(uint16_t sync_handle); +/**@} +*/ + +/** @ingroup prdc_list_cfg Periodic list Commands + * @{ + */ +/** + * @brief Add device to periodic advertiser list. + * + * @param advertiser_address_type : [in] Advertiser address type. + * @param ptr_advertiser_address : [in] Pointer to advertiser address. + * @param advertising_sid : [in] Advertiser set ID. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_add_dev_to_periodic_adv_lst( + uint8_t advertiser_address_type, uint8_t* ptr_advertiser_address, + uint8_t advertising_sid); + +/** + * @brief Remove device from periodic advertiser list. + * + * @param advertiser_address_type : [in] Advertiser address type. + * @param ptr_advertiser_address : [in] Pointer to advertiser address. + * @param advertising_sid : [in] Advertiser set ID. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_rmv_dev_from_periodic_adv_lst( + uint8_t advertiser_address_type, uint8_t* ptr_advertiser_address, + uint8_t advertising_sid); + +/** + * @brief Clear periodic advertiser list. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_clr_periodic_adv_lst(void); + +/** + * @brief Read periodic advertiser list size. + * + * @param ptr_periodic_advertiser_list_size : [out] Pointer to advertiser list size. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_read_periodic_adv_lst_size( + uint8_t* ptr_periodic_advertiser_list_size); +/**@} +*/ +#endif /* (SUPPORT_MASTER_CONNECTION || SUPPORT_EXPLCT_OBSERVER_ROLE) && SUPPORT_LE_PERIODIC_ADVERTISING*/ +#endif /*SUPPORT_LE_EXTENDED_ADVERTISING*/ + +/** @ingroup tx_pwr_cfg Tx Power Commands + * @{ + */ +/** + * @brief Used to read the minimum and maximum transmit powers supported by the Controller. + * + * @param ptr_min_tx_pwr : [out] A pointer to the min TX power value to be set by the controller [Range: -127 dB to 20 dB] + * @param ptr_max_tx_pwr : [out] A pointer to the max TX power compensation value to be set by the controller [Range: -127 dB to 20.0 dB] + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_read_tx_pwr( + int8_t *ptr_min_tx_pwr, int8_t* ptr_max_tx_pwr); + +/** + * @brief Used to read the RF Path Compensation Values parameter used in the Tx Power Level and RSSI calculation. + * + * @param ptr_rf_tx_path_compnstn : [out] A pointer to the RF TX path compensation value to be set by the controller [Range: -128.0 dB (0xFB00) -> 128.0 dB (0x0500)] + * @param ptr_rf_rx_path_compnstn : [out] A pointer to the RF RX path compensation value to be set by the controller [Range: -128.0 dB (0xFB00) -> 128.0 dB (0x0500)] + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_read_rf_path_compensation( + int16_t *ptr_rf_tx_path_compnstn, int16_t* ptr_rf_rx_path_compnstn); + +/** + * @brief Used to indicate the RF path gain or loss between the RF transceiver and the antenna contributed by intermediate components. + * + * @param ptr_rf_tx_path_compnstn : [in] RF TX path compensation value sent by host [Range: -128.0 dB (0xFB00) -> 128.0 dB (0x0500)] + * @param ptr_rf_rx_path_compnstn : [in] RF RX path compensation value sent by host [Range: -128.0 dB (0xFB00) -> 128.0 dB (0x0500)] + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_write_rf_path_compensation( + int16_t ptr_rf_tx_path_compnstn, int16_t ptr_rf_rx_path_compnstn); +/**@} + */ + +/** @ingroup connless_cte_cfg Connectionless CTE Commands + * @{ + */ +/*================ AoA / AoD =====================*/ +/*================ LE Set Connectionless CTE Transmit Parameters Command =====================*/ +/** + * @brief Used to set the type, length, and antenna switching pattern for the transmission of the Constant Tone Extension field + * in any periodic advertising on the advertising set identified by the Advertising_Handle parameter. + * + * @param ptr_hci_cmd_params : [in] Pointer to the HCI command parameters. + * + * @retval ble_stat_t : Command status. + */ +#if (SUPPORT_AOA_AOD) +#if (SUPPORT_EXPLCT_BROADCASTER_ROLE && SUPPORT_LE_PERIODIC_ADVERTISING) +ble_stat_t ll_intf_le_set_connectionless_cte_tx_params(le_set_connless_cte_tx_params_cmd_st *ptr_hci_cmd_params); + +/*================ LE Set Connectionless CTE Transmit Enable Command =====================*/ +/** + * @brief Used to request that the Controller enables or disables the use of Constant Tone Extensions in any periodic + * advertising on the advertising set identified by Advertising_Handle. + * + * @param ptr_hci_cmd_params : [in] Pointer to the HCI command parameters. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_connless_cte_tx_enable(le_set_connless_cte_tx_enable_cmd_st *ptr_hci_cmd_params); +#endif /* (SUPPORT_EXPLCT_BROADCASTER_ROLE && SUPPORT_LE_PERIODIC_ADVERTISING) */ + +#if (SUPPORT_EXPLCT_OBSERVER_ROLE) +/*================ LE Set Connectionless IQ Sampling Enable Command =====================*/ +/** + * @brief Used to request that the Controller enables or disables capturing IQ samples from + * the Constant Tone Extension field of periodic advertising packets identified by the + * Sync_Handle parameter. + * + * @param ptr_hci_cmd_params : [in] Pointer to the HCI command parameters. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_connless_iq_sampling_enable(le_set_connless_iq_sampling_enable_cmd_st *ptr_hci_cmd_params); +#endif /* (SUPPORT_EXPLCT_OBSERVER_ROLE) */ +/**@} +*/ + +/** @ingroup conn_cte_cfg Connection CTE Commands + * @{ + */ +/*================ LE Set Connection CTE Receive Parameters Command =====================*/ +/** + * @brief Used to set the antenna switching pattern and switching and sampling slot durations for + * receiving the CTE field during connection. + * + * @param ptr_hci_cmd_params : [in] Pointer to the HCI command parameters. + * + * @retval ble_stat_t : Command status. + */ +#if ((SUPPORT_MASTER_CONNECTION) || (SUPPORT_SLAVE_CONNECTION)) +ble_stat_t ll_intf_le_set_conn_cte_rx_params(le_set_conn_cte_rx_params_cmd_st *ptr_hci_cmd_params); + +/*================ LE Set Connection CTE Transmit Parameters Command =====================*/ +/** + * @brief Used to set the antenna switching pattern and permitted CTE types used for transmitting the CTE field requested by the peer + * evice during connection. + * + * @param ptr_hci_cmd_params : [in] Pointer to the HCI command parameters. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_conn_cte_tx_params(le_set_conn_cte_tx_params_cmd_st *ptr_hci_cmd_params); + +/*================ LE Connection CTE Request Enable Command =====================*/ +/** + * @brief Used to request the Controller to start or stop sending one or more LL_CTE_REQ PDU(s) on a + * connection identified by the Connection_Handle parameter. + * + * @param ptr_hci_cmd_params : [in] Pointer to the HCI command parameters. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_conn_cte_req_enable(le_set_conn_cte_req_enable_cmd_st *ptr_hci_cmd_params); + +/*================ LE Connection CTE Response Enable Command =====================*/ +/** + * @brief Used to request the Controller to respond to LL_CTE_REQ PDUs with LL_CTE_RSP PDUs on the specified connection. + * + * @param ptr_hci_cmd_params : [in] Pointer to the HCI command parameters. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_conn_cte_rsp_enable(le_set_conn_cte_rsp_enable_cmd_st *ptr_hci_cmd_params); + +#endif /* (SUPPORT_MASTER_CONNECTION) || (SUPPORT_SLAVE_CONNECTION) */ +/**@} +*/ + +/** @ingroup antenna_cfg Antenna Commands +* @{ +*/ +/*================ LE Read Antenna Information Command =====================*/ +/** + * @brief Allow the Host to read the switching rates, the sampling rates, the number of antennae, and the maximum + * length of the Constant Tone Extension supported by the Controller. + * + * @param ptr_supprtd_switching_sampling_rates : [out] Antenna Switching and IQ Sampling rates supported by the controller. + * @param ptr_antenna_num : [out] The number of antennae supported by the Controller. + * @param ptr_switching_pattern_max_len : [out] Maximum length of antenna switching pattern supported by the Controller. + * @param ptr_cte_max_len : [out] Maximum length of Constant Tone Extension supported in 8 us units. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_read_antenna_info(uint8_t *ptr_supprtd_switching_sampling_rates, + uint8_t *ptr_antenna_num, + uint8_t *ptr_switching_pattern_max_len, + uint8_t *ptr_cte_max_len); +/**@} +*/ + +/** @ingroup vendor_cfg Vendor Specific Commands +* @{ +*/ +/*================ LE Set Default Antenna ID Command =====================*/ +/** + * @brief Allow the Host to set the default antenna ID to be used by the Controller. + * + * @param default_antenna_id : [in] Antenna ID value for the default antenna to be used by the controller, in case no antenna switching is required. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_set_default_antenna_id(uint8_t default_antenna_id); +/**@} + */ +#endif /* SUPPORT_AOA_AOD */ + +/** @ingroup phy_cfg PHY Commands + * @{ + */ +#if (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) +/** + * @brief The LE Read PHY command is sent by the host to read the current working PHY per connection. + * + * @param conn_handle_id : [in] Connection_Handle to be used to identify a connection.(Range:0x0000-0x0EFF) + * @param tx_phy : [out] The used PHY in the Tx + * @param rx_phy : [out] The used PHY in the Rx + * + * @retval status : [out] 0:SUCCESS, 0xXX:ERROR_CODE. + */ +ble_stat_t ll_intf_le_read_phy_cmd(uint16_t conn_handle_id, uint8_t *tx_phy, + uint8_t *rx_phy); + +/** + * @brief The LE Set Default PHY command is sent by the host to set the prefered working PHYs for Tx and Rx. + * + * @param all_phys : [in] The Host preferences (use prefered shown in tx_phys and rx_phys / no_preference) for the used PHYs in the TX or RX + * @param tx_phys : [in] The prefered used PHY in the Tx + * @param rx_phys : [in] The prefered used PHY in the Rx + * + * @retval status : [out] 0:SUCCESS, 0xXX:ERROR_CODE. + * + */ +ble_stat_t ll_intf_le_set_default_phy_cmd(uint8_t all_phys, uint8_t tx_phys, + uint8_t rx_phys); + +/** + * @brief The LE Set PHY command is used to request a change to the transmitter PHY and receiver PHY for a connection. + * + * @param conn_handle_id : [in] Connection_Handle to be used to identify a connection.(Range:0x0000-0x0EFF) + * @param all_phys : [in] The Host preferences (use prefered shown in tx_phys and rx_phys / no_preference) for the used PHYs in the TX or RX + * @param tx_phys : [in] The prefered used PHY in the Tx + * @param rx_phys : [in] The prefered used PHY in the Rx + * + * @retval status : [out] 0:SUCCESS, 0xXX:ERROR_CODE. + */ +ble_stat_t ll_intf_le_set_phy_cmd(uint16_t conn_handle_id, uint8_t all_phys, + uint8_t tx_phys, uint8_t rx_phys, uint16_t phy_options); +#endif /* (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) */ +/**@} + */ + +#if (SUPPORT_LE_PERIODIC_ADVERTISING) +/** @ingroup scn_cfg + * @{ + */ +#if (SUPPORT_EXPLCT_OBSERVER_ROLE || SUPPORT_MASTER_CONNECTION || SUPPORT_SYNC_ISOCHRONOUS) +/*=============== LE Set Periodic Advertising Receive Enable Command ===============*/ +/** + * @brief used to enable or disable reports for the periodic advertising identified by the Sync Handle parameter. + * + * @param sync_handle : [in] Used to identify the periodic advertiser. + * @param enable : [in] Enable/Disable sending reports + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_periodic_adv_receive_enable(uint16_t sync_handle , uint8_t enable); +#endif /* (SUPPORT_EXPLCT_OBSERVER_ROLE || SUPPORT_MASTER_CONNECTION || SUPPORT_SYNC_ISOCHRONOUS)*/ +/**@} + */ + +/** @ingroup prdc_sync_transfer_cfg Periodic Sync Transfer Commands + * @{ + */ +#if (SUPPORT_PERIODIC_SYNC_TRANSFER) +/*=============== LE Periodic Advertising Sync Transfer Command ===============*/ +/** + * @brief : used to instruct the Controller to send synchronization information about the periodic advertising + * identified by the Sync Handle parameter to a connected device. + * + * @param conn_handle : [in] Connection Handle Id to identify a connection. + * @param service_data : [in] A value provided by the Host + * @param sync_handle : [in] Used to identify the periodic advertiser. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_periodic_adv_sync_transfer( + uint16_t conn_handle, + uint16_t service_data, + uint16_t sync_handle); + +/*=============== LE Set Periodic Advertising Set Info Transfer Command ===============*/ +/** + * @brief : used to instruct the Controller to send synchronization information about the periodic advertising + * in an advertising set to a connected device. + * + * @param service_data : [in] A value provided by the Host. + * @param conn_handle : [in] Connection Handle Id to identify a connection. + * @param adv_handle : [in] Used to identify the periodic advertiser. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_periodic_adv_set_info_transfer( + uint16_t conn_handle, + uint16_t service_data, + uint8_t adv_handle); + +/*=============== LE Set Periodic Advertising Sync Transfer Parameters Command ===============*/ +/** + * @brief : used to specify how the Controller will process periodic advertising synchronization information + * received from the device identified by the Connection Handle parameter. + * + * @param conn_handle : [in] Connection Handle Id to identify a connection. + * @param mode : [in] Specifies the action to be taken when periodic advertising synchronization information is received. + * @param skip : [in] Number of consecutive periodic advertising packets that the receiver may skip after successfully receiving a periodic advertising packet. + * @param sync_timeout : [in] Maximum permitted time between successful receives. + * @param cte_type : [in] Specifies whether to only synchronize to periodic advertising with certain types of Constant Tone Extension. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_periodic_adv_sync_transfer_paramters( + uint16_t conn_handle,uint8_t mode , uint16_t skip , uint16_t sync_timeout,uint8_t cte_type); + +/*=============== LE Set Default Periodic Advertising Sync Transfer Parameters Command ===============*/ +/** + * @brief : used to specify the initial value for the mode, skip, timeout, and Constant Tone Extension type. + * + * @param mode : [in] Specifies the action to be taken when periodic advertising synchronization information is received. + * @param skip : [in] Number of consecutive periodic advertising packets that the receiver may skip after successfully receiving a periodic advertising packet. + * @param sync_timeout : [in] Maximum permitted time between successful receives. + * @param cte_type : [in] Specifies whether to only synchronize to periodic advertising with certain types of Constant Tone Extension. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_default_periodic_adv_sync_transfer_paramters( + uint8_t mode , uint16_t skip , uint16_t sync_timeout,uint8_t cte_type); + +#endif /* SUPPORT_PERIODIC_SYNC_TRANSFER */ +/**@} + */ +#endif /* SUPPORT_LE_PERIODIC_ADVERTISING */ + +#if (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) +/** @ingroup tx_pwr_cfg Tx Power Commands + * @{ + */ +/*================ LE Set Connection Transmit Power Level Command =====================*/ +/** + * @brief Used to Set the TX_Power level used by the local Controller on an ACL connection for a certain PHY. + * + * @param ptr_hci_cmd_params : [in] Pointer to the HCI command parameters. + * @param ptr_tx_power : [out] Used to report the new Tx_power after the change. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_set_conn_tx_power_level(le_set_conn_tx_pwr_lvl_cmd_st *ptr_hci_cmd_params, int8_t *ptr_tx_power); +/**@} + */ +#endif /* SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION */ + +/*================ LE Power Control =====================*/ +/*================ LE Enhanced Read Transmit Power Level Command =====================*/ +#if (SUPPORT_LE_POWER_CONTROL) +/** @ingroup power_control_cfg Power Control Commands + * @{ + */ +/** + * @brief Used to read the current and maximum TX_Power levels of the local Controller on an ACL connection for a certain PHY. + * + * @param ptr_hci_cmd_params : [in] Pointer to the HCI command parameters. + * @param ptr_curr_tx_power : [Out] Value of the local current TX_Power level to be set by the Controller. + * @param ptr_max_tx_power : [Out] Value of the local maximum TX_Power level to be set by the Controller. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_enhanced_read_tx_power_level(le_enhanced_read_tx_pwr_lvl_cmd_st *ptr_hci_cmd_params, + uint8_t *ptr_curr_tx_power, + uint8_t *ptr_max_tx_power); + +/*================ LE Read Remote Transmit Power Level Command =====================*/ +/** + * @brief Used to read the TX_Power level used by the remote Controller on an ACL connection for a certain PHY. + * + * @param ptr_hci_cmd_params : [in] Pointer to the HCI command parameters. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_read_remote_tx_power_level(le_read_remote_tx_pwr_lvl_cmd_st *ptr_hci_cmd_params); + +/*================ LE Set Path Loss Reporting Parameters Command =====================*/ +/** + * @brief Used to set the path loss threshold reporting parameters for an ACL connection. + * + * @param ptr_hci_cmd_params : [in] Pointer to the HCI command parameters. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_set_path_loss_reporting_params(le_set_path_loss_reporting_params_cmd_st *ptr_hci_cmd_params); + +/*================ LE Set Path Loss Reporting Enable Command =====================*/ +/** + * @brief Used to enable or disable path loss reporting for an ACL connection. + * + * @param ptr_hci_cmd_params : [in] Pointer to the HCI command parameters. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_set_path_loss_reporting_enable(le_set_path_loss_reporting_enable_cmd_st *ptr_hci_cmd_params); + +/*================ LE Set Transmit Power Reporting Enable Command =====================*/ +/** + * @brief Used to enable or disable the reporting to the local Host of TX_Power level changes in the local and remote Controllers for an ACL connection. + * + * @param ptr_hci_cmd_params : [in] Pointer to the HCI command parameters. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_set_tx_power_reporting_enable(le_set_tx_pwr_reporting_enable_cmd_st *ptr_hci_cmd_params); +/**@} + */ + +/** @ingroup dtm_cfg DTM Commands + * @{ + */ +/*================ LE transmitter Test [v4] Command =====================*/ +/** + * @brief Used to start a test where the DUT generates test reference packets at a fixed interval and including the LE Low Power feature. + * + * @param ptr_hci_cmd_params : [in] Pointer to the HCI command parameters. + * + * @retval status : [out] 0:SUCCESS, 0xXX:ERROR_CODE. + */ +ble_stat_t ll_intf_le_transmitter_test_v4(le_tx_test_v4_cmd_st *ptr_hci_cmd_params); +/**@} + */ +#endif /* SUPPORT_LE_POWER_CONTROL */ + +/*################# Vendor-Specific HCI Commands' Group ################# */ + +/** @ingroup vendor_cfg Vendor Specific Commands + * @{ + */ +/*=============== LE Write Transmit Power Command ===============*/ +/** + * @brief Set the minimum and maximum TX Power values to be supported by the controller. + * + * @param tx_pwr : [in] transmit power sent by host to be used by the controller + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_write_tx_pwr(int8_t tx_pwr); +/**@} + */ + + +#if (SUPPORT_SLEEP_CLOCK_ACCURCY_UPDATES) +/** @ingroup modify_slpclk_cfg Sleep Clock Accuracy Commands + * @{ + */ +/*=============== LE modify Sleep Clock Accuracy ===============*/ +/** + * @brief Modify Sleep Clock Accuracy. This should be used for testing purposes only. + * + * @param action : [in] specifies action more accurate or less accurate SCA + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_modify_sleep_clock_accuracy(uint8_t action); +/**@} + */ +#endif /* SUPPORT_SLEEP_CLOCK_ACCURCY_UPDATES */ + +/** @ingroup sleep_clk_acc_cfg Set Sleep Clock Accuracy Command + * @{ + */ +/*=============== LE Set Sleep Clock Accuracy ===============*/ +/** + * @brief Set Sleep Clock Acuuracy. + * + * @param slp_clk_acc : [in] sleep clock accuracy + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_sleep_clock_accuracy(uint8_t slp_clk_acc); +/**@} + */ + +/** @ingroup dpslp_cfg Deep Sleep Commands + * @{ + */ +/*=============== LE Set Deep Sleep Mode ===============*/ +/** + * @brief Used to configure linklayer to go to/back from deep sleep mode. + * + * @param dp_slp_mode : [in] 1 enable deep sleep mode , 0 go back to sleep mode + * + * @retval Status. + */ +ble_stat_t ll_intf_le_set_dp_slp_mode(uint8_t dp_slp_mode); +/**@} + */ + +/** @ingroup vendor_cfg Vendor Specific Commands + * @{ + */ +/*=============== LE Set PHY Calibration Event Parameters ===============*/ +/** + * @brief Used to configure the PHY calibration event parameters. + * + * @param phy_clbr_evnt_period : [in] Indicate the periodicity of the PHY calibration event. Periodicity = phy_clbr_evnt_period * 1s. + * @param phy_clbr_evnt_count : [in] Indicate the number of the PHY calibration events to be executed. + */ +void ll_intf_le_set_phy_clbr_params(uint32_t phy_clbr_evnt_period, uint32_t phy_clbr_evnt_count); + +#if ((SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS) || \ + (SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION))) +#if SUPPORT_HW_AUDIO_SYNC_SIGNAL +/** + * @brief Enable the audio sync signal for specific Stream + * @param conn_hndle : Connection handle for stream for which hw audio sync signal should be enabled + * @retval Status + */ +ble_stat_t ll_intf_enable_audio_sync_signal(uint16_t conn_hndle); +#if (SUPPORT_SYNC_ISOCHRONOUS) +/** + * @brief Force RTL to re-rx the first sub-event in the stream which is already enabled + * @param conn_hndle : Connection handle for stream for which hw audio sync signal should be enabled + * @param force_state : Switch control of force resync + * (1: means that the force mechanism is enabled, and the HW Audio signal + * is generated at the first sub-event of the stream that is already HW Audio signal is enabled + * 0: means that the force mechanism is disabled, and the HW Audio signal + * is generated at the last + * @retval Status + */ +ble_stat_t ll_intf_force_audio_sync_signal_resync(uint16_t conn_hndle, uint8_t force_state); +#endif /*SUPPORT_SYNC_ISOCHRONOUS*/ +#endif /*SUPPORT_HW_AUDIO_SYNC_SIGNAL*/ +#endif /*#if ((SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS) || \ + (SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION))) */ + +/*=============== LE Set Get Remaining Time For Next Event ===============*/ +/** + * @brief Used to Get Remaining Time For Next Event. + * + * @param remaing_time : [out] the value of remaining time for the next event in us. + * + * @retval Status. + */ +ble_stat_t ll_intf_le_get_remaining_time_for_next_event(uint32_t* remaing_time); + +/*=============== LE Set SETUP_TIME Time ===============*/ +/** + * @brief Used to Set SETUP_TIME Time For Next Event. + * + * @param setup_time : [in] the value of setup time in us to be used be the link layer scheduler . + * + * @retval Status. + */ +ble_stat_t ll_intf_le_set_scheduler_setup_time(uint32_t setup_time) ; + +#if (SUPPORT_AUGMENTED_BLE_MODE) +/**@} + */ +/** @ingroup aug_ble_cfg Augmented BLE Commands + * @{ + */ +/** + * @brief Used to Start BLE Augmented Mode. + * + * @param aug_access_address : [in] the value of access address to be used in augmented mode. + * @param aug_whitening_init : [in] the value of whitening initialization to be used in augmented mode. + * + * @retval Status. + */ +ble_stat_t ll_intf_le_start_augmented_mode(uint32_t aug_access_address, uint8_t aug_whitening_init); + +/** + * @brief Used to Stop BLE Augmented Mode + * + * @retval Status. + */ +ble_stat_t ll_intf_le_stop_augmented_mode(void); +/**@} + */ + +/** @ingroup vendor_cfg Vendor Specific Commands + * @{ + */ +/** + * @brief Used to Start Energy detection on a specific channel map + * + * @param chnnl_map : [in] bit mask of channel map. + * @param duration : [in] Duration of energy detection on each channel. + * + * @retval Status. + */ +ble_stat_t ll_intf_le_start_energy_detection(uint8_t * chnnl_map, uint32_t duration); +#endif /*(SUPPORT_AUGMENTED_BLE_MODE)*/ + +#if (USE_NON_ACCURATE_32K_SLEEP_CLK) +/*=============== LE Select Sleep Clock Source ===============*/ +/** + * @brief Used to select the source that drives the sleep clock, whether to use an external crystal oscillator or an integrated RC oscillator (RCO). + * + * @param slp_clk_src : [in] Indicate which source to drive the sleep clock. 0: Crystal Oscillator (default). 1: RC0 + * @param ptr_slp_clk_freq_value : [out] Indicate the nominal frequency value of the sleep clock. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_select_slp_clk_src(uint8_t slp_clk_src, uint16_t *ptr_slp_clk_freq_value); +#endif /* USE_NON_ACCURATE_32K_SLEEP_CLK */ + +#if (USE_NON_ACCURATE_32K_SLEEP_CLK) +/*=============== LE Set RCO Calibration Event Parameters ===============*/ +/** + * @brief Used to configure the runtime RCO calibration event parameters. + * + * @param rco_clbr_event_duration : [in] Indicate the number of sleep clock cycles for performing the RCO calibration process. + * @param rco_clbr_event_interval : [in] Indicate the periodicity of running the runtime RCO calibration event. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_set_rco_clbr_evnt_params(uint8_t rco_clbr_event_duration, uint32_t rco_clbr_event_interval); +#endif /* USE_NON_ACCURATE_32K_SLEEP_CLK */ + +/*=============== LE Select TX_Power Table ===============*/ +/** + * @brief Used to specify the used power table and its size based on the selected TX_Power table ID. + * + * @param tx_power_table_id : [in] Selected TX_Power table ID. + * + * @retval Status : 0: SUCCESS. Otherwise: Error code. + */ +uint8_t ll_intf_select_tx_power_table(uint8_t tx_power_table_id); + +#if(SUPPORT_CONNECTED_ISOCHRONOUS &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) || (SUPPORT_BRD_ISOCHRONOUS) +/*=============== LE Enable Sync Event ===============*/ +/** + * @brief Used to enable or disable generation of sync event and generation of calibration signal . + * + * @param group_id : [in] contain the identifier of the CIG or BIG. + * @param enable_sync : [in] enable or disable generation of sync event. + * @param enable_clbr_trigger : [in] enable or disable generation of calibration signal + * @param trigger_source : [in] identify trigger source (CIG or BIG) + */ +ble_stat_t ll_intf_le_enable_sync_evnt(uint8_t group_id ,uint8_t enable_sync, + uint8_t enable_clbr_trigger,uint8_t trigger_source); +#endif /* SUPPORT_CONNECTED_ISOCHRONOUS &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) */ +/**@} + */ + +/** @ingroup alloc_pkt_cfg Packet Allocation Commands + * @{ + */ +#if (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) +/*=============== ll_intf_alloc_ll_pkt ===============*/ +/** + * @brief Allocates LL packet that will be used for LL Tx/Rx. + * + * @retval void * : Pointer to the raw LL packet. + */ +void* ll_intf_alloc_ll_pkt(void); +#endif /* SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION */ + +/*=============== ll_intf_free_ll_pkt ===============*/ +/** + * @brief This function shall be called on any packets that has been passed from the LL to the host. + * + * @param pkt : [in] Pointer to the raw LL packet + */ +void ll_intf_free_ll_pkt(void* pkt); + +/*=============== ll_intf_free_ll_pkt_hndlr ===============*/ +/** + * @brief This function free both the LL packet and the handler asociated with it. + * + * @param pkt : [in] Pointer to ble_buff_hdr_t that points to the LL packet + */ +void ll_intf_free_ll_pkt_hndlr(ble_buff_hdr_t* pkt); +/**@} + */ + +#if (SUPPORT_SLEEP_CLOCK_ACCURCY_UPDATES&&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) +/** @ingroup modify_slpclk_cfg Sleep Clock Accuracy Commands + * @{ + */ +/*=============== LE Request Peer SCA Command ===============*/ +/** + * @brief : is used to read the Sleep Clock Accuracy (SCA) of the peer device. + * + * @param conn_hndl : contains the identifier of the Connection_handler of the ACL_Connection + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_req_peer_sca(uint16_t conn_hndl); +/**@} + */ +#endif /* Sleep Clock Accuracy update &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)*/ + +/*################################## Isochronous ################################## */ +/** @ingroup iso_cfg + * @{ + */ +#if((SUPPORT_CONNECTED_ISOCHRONOUS &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) || (SUPPORT_SYNC_ISOCHRONOUS)) +/*=============== LE Set from controller to host function path ===============*/ +/** + * @brief it sets the output path function in a CIS context + * + * @param conn_hndl :[IN] ISO handle + * @param ptr_func :[IN] output data path + * + * @retval ble_stat_t. + */ +ble_stat_t ll_intf_set_output_data_path(uint16_t conn_hndl ,vendor_specific_from_cntrl_to_host_cbk func_ptr); +#endif /*((SUPPORT_CONNECTED_ISOCHRONOUS &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) || (SUPPORT_SYNC_ISOCHRONOUS))*/ +#if(SUPPORT_CONNECTED_ISOCHRONOUS &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) +#if(SUPPORT_MASTER_CONNECTION) +/*=============== LE Set CIG Parameters Command ===============*/ +/** + * @brief : used to set the parameters of one or more CISes that are associated with a CIG in the Controller + * + * @param ptr_st_set_cig_params : [IN] pointer to ble_intf_set_cig_params_cmd_st that contains CIG parameters coming from the Host + * @param conn_hndl : [out] pointer to array of connection handles in the CIG + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_cig_params(ble_intf_set_cig_params_comman_cmd_st* ptr_st_set_cig_params, uint8_t* conn_hndl); + +/*=============== LE Set CIG Parameters Test Command ===============*/ +/** + * @brief : used to set the parameters of one or more CISes that are associated with a CIG in the Controller + * + * @param ptr_st_set_cig_params_test : [IN] pointer to ble_intf_set_cig_params_cmd_st that contains CIG parameters coming from the Host + * @param conn_hndl : [out] pointer to array of connection handles in the CIG + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_cig_params_test(ble_intf_set_cig_params_comman_cmd_st* ptr_st_set_cig_params_test, uint8_t* conn_hndl); + +/*=============== LE Create CIS Command ===============*/ +/** + * @brief : The HCI_LE_Create_CIS command is used by the master’s Host to create one or more CISes + * using the connections identified by the ACL_Connection_Handle[i] parameter array + * @param ptr_st_create_cis_params : pointer to ble_intf_create_cis_cmd_st that contains ACL_Connection_Handles, + * ISO_Connection_Handles and Number of CISes. + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_create_cis(ble_intf_create_cis_cmd_st* ptr_st_create_cis_params); +#endif /* SUPPORT_MASTER_CONNECTION */ + +/*=============== LE Accept CIS Request Command ===============*/ +/** + * @brief : is used by the slave’s Host to inform the Controller to accept + * the request for the CIS that is identified by the Connection_Handle. + * + * @param conn_hndl : contains the identifier of the Connection_handler of the master + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_accept_cis_req(uint16_t conn_hndl); + +/*=============== LE Reject CIS Request Command ===============*/ +/** + * @brief : is used by the slave’s Host to inform the Controller to reject + * the request for the CIS that is identified by the Connection_Handle. + * + * @param conn_hndl : contains the identifier of the Connection_handler of the master + * @param reason : the reason for rejection + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_reject_cis_req(uint16_t conn_hndl, uint8_t reason); + +/** + * @brief Used to set cis req event mask value . + * + * @param cis_req_evnt_mask : [in] event mask value. + */ +void ll_intf_set_cis_req_evnt_mask(uint32_t cis_req_evnt_mask); +/*=============== LE Remove CIG Command ===============*/ +/** + * @brief : is used by the master’s Host to remove all the CISes associated with the CIG identified by CIG_ID + * + * @param cig_id : contains the identifier of the CIG + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_rmv_cig(uint8_t cig_id); +/** @} +*/ + +typedef void (*ll_intf_clbr_cb_t)(uint32_t); + +/** @ingroup clbr_cbk_cfg Calibration Callback + * @{ + */ +/** + * @brief Registers a calibration function callback + * + * @param clbr_cb : Calibration function callback + */ +void ll_intf_rgstr_clbr_cbk(ll_intf_clbr_cb_t clbr_cb); +/**@} + */ + +/** @ingroup alloc_pkt_cfg Packet Allocation Commands + * @{ + */ +/** + * @brief Allocates an ISO packet + * + * @retval Pointer to the allocated ISO packet + */ +void* ll_intf_alloc_iso_pkt(void); +/**@} + */ + +/** @ingroup conn_cte_cfg Connection CTE Commands + * @{ + */ +#if (SUPPORT_LE_POWER_CONTROL) +/** + * @brief Custom command to read RSSI of CIS handle to be used in power control testing. + * + * @param conn_handle_id : [in] ACL_CONNECTION_ID + * @param ptr_cis_rssi_value : [out] CIS RSSI value + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_cis_read_rssi(uint16_t conn_handle_id, int8_t *ptr_cis_rssi_value); +#endif /* SUPPORT_LE_POWER_CONTROL */ +/**@} + */ +#endif/* SUPPORT_CONNECTED_ISOCHRONOUS &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) */ + +#if(SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS) +#if(SUPPORT_SYNC_ISOCHRONOUS) +/** @ingroup iso_cfg + * @{ + */ +/*=============== LE BIG Create Sync Command ===============*/ +/** + * @brief : is used to synchronize to a BIG described in the periodic advertising train specified by the Sync_Handle parameter. + * @param ptr_str_big_create_sync_cmd : pointer to ble_intf_big_create_sync_cmd_st that contains the command parameters + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_big_create_sync(ble_intf_big_create_sync_cmd_st * ptr_str_big_create_sync_cmd); + +/*=============== LE BIG Terminate Sync Command ===============*/ +/** + * @brief : is used to stop synchronizing or cancel the process of synchronizing to the BIG identified by the BIG_Handle parameter. + * destroys the associated connection handles of the BISes in the BIG and removes the data paths for all BISes + * in the BIG identified by BIG_Handle. + * @param big_hndle : contains the identifier of the BIG_Handler. + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_big_term_sync(uint8_t* big_hndle); + +#endif /* SUPPORT_SYNC_ISOCHRONOUS */ + +#if(SUPPORT_BRD_ISOCHRONOUS) +/*=============== LE Create BIG Command ===============*/ +/** + * @brief : is used to create a BIG with one or more BISes (All BISes in a BIG have the same value for all parameters) + * @param ptr_create_big_cmd_st : pointer to ble_intf_create_big_st that contains the parameters of create big / test command + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_create_big(ble_intf_create_big_st* ptr_create_big_cmd_st); + +/*=============== LE Create BIG Test Command ===============*/ +/** + * @brief : (should be used in the ISO Test mode) is used to create a BIG with one or more BISes (All BISes in a BIG have the same value for all parameters) + * @param ptr_create_big_test_cmd_st : pointer to ble_intf_create_big_st that contains the parameters of create big / test command + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_create_big_test(ble_intf_create_big_st* ptr_create_big_test_cmd_st); +#endif /* SUPPORT_BRD_ISOCHRONOUS */ + +/*=============== LE Terminate BIG Command ===============*/ +/** + * @brief : is used to terminate a BIG identified by the BIG_Handle parameter + * @param big_hndle : contains the identifier of the BIG_Handler. + * @param reason : indicate the reason why the BIG is to be terminated + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_term_big(uint8_t big_hndle, uint8_t reason); + +#endif /* SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS*/ + +#if(SUPPORT_CONNECTED_ISOCHRONOUS && SUPPORT_SLAVE_CONNECTION) +/*=============== LL write connection accept timeout Command ===============*/ +/** + * @brief :this command is used to write connection timeout for cis connection + * after that the cis is rejected + * @param accept_tout[in] : the accept timeout to be written + * + * @retval ble_stat_t : Command status. + */ + +ble_stat_t ll_intf_write_connection_accept_tout(uint16_t accept_tout); + +/*=============== LL read connection accept timeout Command ===============*/ +/** + * @brief :this command is used to read connection timeout for cis connection + * after that the cis is rejected + * @param ptr_accept_tout[out] : pointer to timeout to be read + * + * @retval ble_stat_t : Command status. + */ + +ble_stat_t ll_intf_read_connection_accept_tout(uint16_t *ptr_accept_tout); +#endif + +#if (SUPPORT_LE_POWER_CONTROL) +/** + * @brief Used for setting the custom golden range RSSI + * + * @param upper_limit : [in] + * @param lower_limit : [in] + * + * @retval Success + */ +ble_stat_t ll_intf_set_cstm_rssi_golden_range(int lower_limit , int upper_limit); +#endif /* (SUPPORT_LE_POWER_CONTROL) */ +#if ((SUPPORT_LE_ENHANCED_CONN_UPDATE || SUPPORT_CONNECTED_ISOCHRONOUS )&&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) +/** @} +*/ + +/** @ingroup controller_info + * @{ + */ +/*=============== LE Set Host Feature Command ===============*/ +/** + * @brief : The HCI_LE_Set_Host_Feature command is used by the Host to set or clear a bit controlled by the Host in the Link Layer FeatureSet stored in the Controller + * + * @param bit_num : bit number to be changed + * @param bit_value : value to be stored in the link_layer features + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_set_host_feature(uint8_t bit_num, uint8_t bit_value); +#endif /* #if ((SUPPORT_LE_ENHANCED_CONN_UPDATE || SUPPORT_CONNECTED_ISOCHRONOUS )&&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) */ +#if((SUPPORT_CONNECTED_ISOCHRONOUS &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) \ + ||(SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS)) + + +/*=============== LE Setup ISO Data Path Command ===============*/ +/** + * @brief : is used to identify and create the isochronous data path between the Host and the Controller + * for an established CIS or BIS identified by the Connection_Handle parameter. + * @param conn_hndl : contains the identifier of the Connection_Handler. + * @param ptr_st_setup_iso_data_path : pointer that carries the information parameters of setup_iso_data_path + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_setup_iso_data_path(uint16_t conn_hndl, ble_intf_setup_iso_data_path* ptr_st_setup_iso_data_path); + +/*=============== LE Remove ISO Data Path Command ===============*/ +/** + * @brief : is used to remove the input and/or output data path(s) associated + * with a CIS or BIS identified by the Connection_Handle parameter + * @param conn_hndl : contains the identifier of the Connection_Handler. + * @param data_path_dirc : ( w.r.t the controller) specifies the data path to be removed + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_rmv_iso_data_path(uint16_t conn_hndl, uint8_t data_path_dirc); + +/*=============== LE ISO Test End Command ===============*/ +/** + * @brief : (This command should only be used for testing purposes) is used to terminate the ISO Transmit and/or Receive Test mode for a CIS or BIS + * specified by the Connection_Handle parameter but does not terminate the CIS or BIS. + * @param conn_hndl : contains the identifier of the Connection_Handler. + * @param rcvd_pckt_cntr : number of received packets + * @param missed_pckt_cntr : number of missed packets + * @param failed_pckt_cntr : number of failed packets + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_iso_test_end(uint16_t conn_hndl, uint32_t* rcvd_pckt_cntr, + uint32_t * missed_pckt_cntr, uint32_t *failed_pckt_cntr); + + + +#if(SUPPORT_BRD_ISOCHRONOUS|| SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION || SUPPORT_SYNC_ISOCHRONOUS) + +/*=============== LE Read Buffer Size V2 Command ===============*/ +/** + * @brief : Read the maximum size of the data portion of HCI LE ACL Data Packets, ISO packets sent from the Host to the Controller . + * + * @param le_acl_data_pkt_length : Max length (in octets) of the data portion of each HCI ACL Data Packet that the controller is able to accept . + * @param total_num_le_acl_data_pkts : Total number of HCI ACL Data Packets that can be stored in the data buffers of the controller . + * @param iso_data_pkt_length : Max length (in octets) of the data portion of each HCI ISO Data Packet that the controller is able to accept . + * @param total_num_iso_data_pkts : Total number of HCI ISO Data Packets that can be stored in the data buffers of the controller . + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_read_buffer_size_v2(uint16_t *le_acl_data_pkt_length, + uint8_t *total_num_le_acl_data_pkts, uint16_t *iso_data_pkt_length, + uint8_t *total_num_iso_data_pkts); + +/** @} +*/ + +/** @ingroup iso_cfg + * @{ + */ +/*=============== LE Read ISO Tx Sync Command ===============*/ +/** + * @brief : is used to read the Time_Stamp and Time_Offset of a transmitted SDU identified + * by the Packet_Sequence_Number on a CIS or BIS identified by the Connection_Handle parameter on the master or slave. + * @param conn_hndl : contains the identifier of the Connection_Handler. + * @param pkt_seq_num : contains the sequence number of a transmitted SDU + * @param time_stamp : contains the time stamp of a transmitted SDU + * @param time_ofst : contains the time offset of a transmitted SDU + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_read_iso_tx_sync(uint16_t conn_hndl, uint16_t* pkt_seq_num, + uint32_t *time_stamp,uint32_t * time_ofst); + +/*=============== LE ISO Tx Test Command ===============*/ +/** + * @brief : is used to configure an established CIS or BIS specified by the Connection_Handle parameter, + * and transmit test payloads which are generated by the Controller + * @param conn_hndl : contains the identifier of the Connection_Handler. + * @param pyld_t : defines the configuration of SDUs in the payload + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_iso_tx_test(uint16_t conn_hndl, uint8_t pyld_t); +#endif /* (SUPPORT_EXPLCT_BROADCASTER_ROLE|| SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) */ + + +#if(SUPPORT_SYNC_ISOCHRONOUS || SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) + +/*=============== LE Read ISO Link Quality Command ===============*/ +/** + * @brief : Read the maximum size of the data portion of HCI LE ACL Data Packets, ISO packets sent from the Host to the Controller . + * + * @param conn_hndl : connection handle of CIS or BIS. + * @param ptr_read_iso_link_output : pointer to structure that contains counters to be filled in the specified CIS Identified by the cis_hndl . + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_read_iso_link_quality(uint16_t conn_hndl, ble_intf_read_iso_link_cmd_st * ptr_read_iso_link_output); + +/*=============== LE ISO Rx Test Command ===============*/ +/** + * @brief : (This command should only be used for testing purposes) is used to configure an established CIS + * or a synchronized BIG specified by the Connection_Handle parameter to receive payloads + * @param conn_hndl : contains the identifier of the Connection_Handler. + * @param pyld_t : defines the configuration of SDUs in the payload + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_iso_rx_test(uint16_t conn_hndl, uint8_t pyld_t); + +/*=============== LE ISO Rx Test Counetrs Command ===============*/ +/** + * @brief : (This command should only be used for testing purposes) is used to read the test counters ) in the Controller which is configured in + * ISO Receive Test mode for a CIS or BIS specified by the Connection_Handle. + * @param conn_hndl : contains the identifier of the Connection_Handler. + * @param rcvd_pckt_cntr : number of received packets + * @param missed_pckt_cntr : number of missed packets + * @param failed_pckt_cntr : number of failed packets + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_le_iso_read_test_cntrs(uint16_t conn_hndl, uint32_t* rcvd_pckt_cntr, uint32_t * missed_pckt_cntr, uint32_t *failed_pckt_cntr ); +#endif /* (SUPPORT_EXPLCT_OBSERVER_ROLE || SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION) */ + +#endif /* (SUPPORT_CONNECTED_ISOCHRONOUS &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) \ + ||(SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS) */ + +/*=============== LE Set EcoSystem Base Interval Command ===============*/ +/** + * @brief : TheSet EcoSystem Base Interval Command is used by the Host to hint the controller with the best radio period + * + * @param interval : hinted interval from the host + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_set_ecosystem_base_interval(uint16_t interval); +/** @} +*/ + +/*##### Curb Sleep State Commands Group #####*/ +/** @ingroup curb_sleep_ll_intf + * @{ + */ +/*=============== Curb Sleep State Command ===============*/ +/** + * @brief Forwards to llhwc_cmn to take decision whether to prevent device form + * entering sleep state + * + * @param state [in]: Enable/Disable preventing sleep state mode + * + * @retval ble_state_t : Command status + */ +ble_stat_t ll_intf_curb_sleep_state(uint8_t state); +/** @} +*/ + +/** @ingroup vendor_cfg Vendor Specific Commands + * @{ + */ +/*=============== Configure LL Context Control Command ===============*/ +/** + * @brief Used to configure the LL contexts, where: + * 1. For bare-metal: + * - High ISR is executed in the ISR context + * - Low ISR can be executed in the high ISR context, or switched to low ISR context + * 2. For RTOS: + * - High ISR is executed in the ISR context + * - Low ISR is executed in the thread of the "linkLayerHighPrioTask" + * + * @param allow_low_isr : [in] Configuration parameter for the context of the low ISR in the bare-metal model. Range is [0,1]. + * 0: Low ISR code is executed in the same context of the high ISR. + * 1: Low ISR code is executed in the context of the low ISR (by configuring a low priority interrupt that is triggered by FW). + * @param run_post_evnt_frm_isr : [in] Configuration parameter to decide whether the scheduling of the next BLE event is done in the low ISR context or to be handled by the LL main thread. Range is [0,1]. + * 0: BLE next event scheduling is handled in the LL main thread. + * 1: BLE next event scheduling is handled in the low ISR context. + * + * @retval ble_state_t : Command status + */ +ble_stat_t ll_intf_config_ll_ctx_params(uint8_t allow_low_isr, uint8_t run_post_evnt_frm_isr); + + + +/** +* @brief Get the value of link layer timer in microsecond aligned with sleep timer clock edge +* Microsecond timing can be calculated as Return value (steps) * Multiplier /divider taking into consideration to implement calculation in good accuracy +* +* @param multiplier : Value that should be multiplied by the return steps +* @param divider : the product of the steps and multiplier should be divided by this value +* +* @retval number of steps : Read number of steps. +* @note Caller should call it in a critical section to make sure the timing is not drifted by interrupt serving +*/ +uint32_t ll_intf_get_aligned_us_now(uint32_t* multiplier , uint32_t *divider); +/**@} + */ + +#if SUPPORT_PTA +/*##### Packet Traffic Arbitration (PTA) Commands Group #####*/ +/** @ingroup pta_ll_intf + * @{ + */ +/** + * @brief Initializes the PTA init + * + * @param request_to_event_time :[IN] Time between the request signal assertion + * and beginning of event on air. + * + * @retval INVALID_HCI_COMMAND_PARAMETERS: + * If request to event time is not in range 20us to MIN(Tx Config / Rx Config) + * @retval COMMAND_DISALLOWED: All other PTA error codes + * @retval SUCCESS: Otherwise + */ +ble_stat_t ll_intf_pta_init( + const uint8_t request_to_event_time); + +/** + * @brief Enables the PTA in the hardware + * + * @param enable: [IN] Enable/Disable Indicator + * + * @retval COMMAND_DISALLOWED: If events exist in the system or the pta_enable + * returns any error code. + * @retval SUCCESS: Otherwise + */ +ble_stat_t ll_intf_pta_enable( + const uint8_t enable); + +#if (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION || \ + (SUPPORT_LE_EXTENDED_ADVERTISING && SUPPORT_LE_PERIODIC_ADVERTISING && (SUPPORT_EXPLCT_OBSERVER_ROLE || SUPPORT_SYNC_ISOCHRONOUS))) +/** + * @brief Priority configuration function for the ACL and Periodic Scan events + * + * @param event_type :[IN] Either ACL or Periodic Scan event. + * @param handle :[IN] ACL Handle or Periodic Scan Handle. + * @param priority :[IN] Determines the state of each priority mode. + * @param priority_mask :[IN] Determines which priorities are in effect in + * the priority variable. + * @param acl_multi_slot_nbr_of_packets :[IN] Number of protected slots. + * @param link_loss_limit_timeout :[IN] Timeout percentage for link loss mode + * + * @retval COMMAND_DISALLOWED: If the PTA is not enabled. + * @retval INVALID_HCI_COMMAND_PARAMETERS: For all the other PTA error codes. + * @retval SUCCESS: Otherwise + */ +ble_stat_t ll_intf_pta_ble_set_link_coex_priority( + const pta_link_coex_event_type event_type, + const uint16_t handle, + const uint32_t priority, + const uint32_t priority_mask, + const uint8_t acl_multi_slot_nbr_of_packets, + const uint8_t link_loss_limit_timeout); +#endif /* (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION || \ + (SUPPORT_LE_EXTENDED_ADVERTISING && SUPPORT_LE_PERIODIC_ADVERTISING && (SUPPORT_EXPLCT_OBSERVER_ROLE || SUPPORT_SYNC_ISOCHRONOUS))) */ + +#if (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS || \ + (SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION))) + +/** + * @brief Priority configuration function for the BIG and CIG events. + * + * @param iso_type :[IN] Either BIG or CIG event. + * @param group_id :[IN] Isochronous Group ID. + * @param priority :[IN] Determines the state of each priority mode. + * @param priority_mask :[IN] Determines which priorities are in effect in + * the priority variable. + * @param link_loss_limit_timeout :[IN] Timeout percentage for link loss mode + * + * @retval COMMAND_DISALLOWED: If the PTA is not enabled. + * @retval INVALID_HCI_COMMAND_PARAMETERS: For all the other PTA error codes. + * @retval SUCCESS: Otherwise + */ +ble_stat_t ll_intf_pta_ble_set_iso_coex_priority( + const pta_iso_type iso_type, + const uint8_t group_id, + const uint32_t priority, + const uint32_t priority_mask, + const uint8_t link_loss_limit_timeout); +#endif /* (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS || \ + (SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION))) */ + +/** + * @brief Generic Priority configuration function. + * + * @param priority :[IN] Determines the state of each priority mode. + * @param priority_mask :[IN] Determines which priorities are in effect in + * the priority variable. + * + * @retval COMMAND_DISALLOWED: If the PTA is not enabled. + * @retval INVALID_HCI_COMMAND_PARAMETERS: For all the other PTA error codes. + * @retval SUCCESS: Otherwise + */ +ble_stat_t ll_intf_pta_ble_set_coex_priority( + const uint32_t priority, + const uint32_t priority_mask); +/** @} +*/ +#endif /* SUPPORT_PTA */ + +/** @ingroup vendor_cfg Vendor Specific Commands + * @{ + */ +/** + * @brief this function is used to Start unmodulated carrier Mode + * @param channel : input to selected channel from 0 to 39 + * @param offset : offset will have a step of 244 hz + * from -8196 steps(around -2Mhz) to 8196 steps(around 2Mhz) + * @param phy : rate to start unmodulated carrier mode on ( LE_1M , LE_2M ) + * @param Tx_power_level : indicate TX Power level. + * @retval status. + */ +ble_stat_t ll_init_start_unmod_carrier(uint8_t channel, int16_t offset , uint8_t phy, int8_t tx_power_level); +/*=========== End working phy mode (continuous modulation mode or unmodulated carrier mode) ============*/ +/** + * @brief function to check and stop the running phy mode in case of a new event is + * started while the continuous modulation mode or unmodulated carrier mode is running + * @retval status. + */ +ble_stat_t ll_init_stop_unmod_carrier(); + +/** + * @brief this function is used to Start continuous DTM Mode + * @param ch_index : Logical channel index of DTM . + * @param packet_payload : DTM pay-load type. + * @param phy : PHY type, 1M/2M/coded PHY. + * @param Tx_power_level : indicate TX Power level. + * @retval status. + */ +ble_stat_t ll_init_start_cont_dtm(uint8_t ch_index, uint8_t phy, uint8_t packet_payload, int8_t tx_power_level); +/** + * @brief this function is used to Read Register from Phy + * @param phy_reg : Address of register . + * @param value : Pointer to store value of register in it. + * @retval status. + * @note this APi should be called after curb sleep to have a proper + * functionality as it should be called after PHY is started + * ,otherwise, it will return COMMAND_DISALLOWED + */ +ble_stat_t ll_intf_le_read_phy_reg(uint8_t phy_reg, uint8_t* value); + +/** + * @brief this function is used to Write value in Register of Phy + * @param phy_reg : Address of register . + * @param value : value to be stored in register. + * @retval status. + * @note this APi should be called after curb sleep to have a proper + * functionality as it should be called after PHY is started + * ,otherwise, it will return COMMAND_DISALLOWED + */ +ble_stat_t ll_intf_le_write_phy_reg(uint8_t phy_reg, uint8_t value); + +/** + * @brief flag to the LL the existence of a temperature sensor + * @retval status + */ +void ll_intf_set_temperature_sensor_state(void); +/** + * @brief set the current temperature + * @param temperature : The current temperature + * @retval status + */ +uint32_t ll_intf_set_temperature_value(uint32_t temperature); +/** + * @brief This function returns the number of packets sent in Direct Test Mode. + * @param[out] packet_number : number of packets + * @retval ble_stat_t : Command status. + * @note the value will not be cleared until the next Direct TX test starts. + */ +ble_stat_t ll_intf_le_tx_test_packet_number(uint32_t* packet_number); + +/** + * @brief This function returns the value of rssi. + * @param[out] rssi : rssi value + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_read_raw_rssi(int32_t* rssi); + +/*=============== Set Tx Free Carrier Command ===============*/ +/** + * @brief Set Tx free carrier mode . + * This function is used ot disable or enable Transmit Free carrier on a given channel + * @note this API should only be called if there is no events registered ( for example , Advertising , Connection, etc..) + * + * @param enable : [in] input argument to control TX free carrier mode + * True --> start transmission of free carrier on specific channel + * False --> Stop transmission of free carrier if it is already started + * + * @param channel_idx : [in] RF channel index of the used channel + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_set_tx_free_carrier(uint8_t enable, uint8_t channel_idx); + +#if(END_OF_RADIO_ACTIVITY_REPORTING) +/** + * @brief This function sets the bitmask associated to END_OF_RADIO_ACTIVITY_EVENT. + * Only the radio activities enabled in the mask will be reported to application by + * END_OF_RADIO_ACTIVITY_EVENT. + * + * @param[in] mask : bitmask of the events, the mask can take one of the following + * values (or a bitwise OR of them in case of a mask for multiple events) + * (0x0001) idle + * (0x0002) advertising and extended advertising events + * (0x0004) peripeheral in connection state event + * (0x0008) scanning and extended scanning events + * (0x0020) central in connection state event + * (0x0200) periodic advertising event + * (0x0400) periodic scanning event + * (0x0800) isochronous broadcast advertising event + * (0x1000) isochronous broadcast scanning event + * (0x2000) peripheral in isochronous connection state event + * (0x4000) central in isochronous connection state event + * note that the following values are reserved and will be ignored upon recepient + * (0x0010, 0x0040, 0x0080, 0x0100, 0x8000) + * + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_set_end_of_activity_mask(uint16_t mask); +#endif /* END_OF_RADIO_ACTIVITY_REPORTING */ + +/** + * @brief This function returns the status of the 8 BLE links managed by the device. + * @param[out] sm_status : pointer to array of per running state machine status. + * @param[out] link_conn_handle : pointer to array of per running state machine handle. + * @retval ble_stat_t : Command status. + */ +ble_stat_t ll_intf_get_link_status(uint8_t *sm_status, uint8_t *link_conn_handle); + +#if (SUPPORT_MASTER_CONNECTION && SUPPORT_CHANNEL_CLASSIFICATION) +/** + * @brief this function is used control the channel reporting mode of the controller + * @param[in] conn_handle_id : identifier of the connection. + * @param[in] ptr_reporting_params : pointer to structure holding the reporting parameters as follows: + * report_mode : reporting mode value. + * 0 : disable + * 1 : enable + * min_spacing :min spacing value (min time between + * 2 consecutive LL_CHANNEL_STATUS + * "unit of 200 ms") + * 5 (1 sec) <= min_spacing <= 150 (30 sec) + * max_delay :max delay value (max time between + * channel classification change and + * LL_CHANNEL_STATUS sending "unit of 200 ms") + * 5 (1 sec) <= max_delay <= 150 (30 sec) + * @retval status. + */ +ble_stat_t ll_intf_cntrl_chnl_clsfction_report(uint16_t conn_handle_id, void *ptr_reporting_params); +#endif /* (SUPPORT_MASTER_CONNECTION && SUPPORT_CHANNEL_CLASSIFICATION) */ + +#if SUPPORT_LE_ENHANCED_CONN_UPDATE +/*=============== LE Set Default Subrate Parameters ===============*/ +/** + * @brief Used to save default subrate parameters to be used to test the future incoming subrate requests from the slave against them to decide whether to accept or reject them + * + * @param subrate_default_params : [in] pointer to structure includes all subrate default parameters from the host. + * + * @retval Status(0:SUCCESS, 0xXX:ERROR_CODE).. + */ +ble_stat_t ll_intf_le_set_default_subrate( + subrate_default_params_t * subrate_default_params + ); +/*=============== LE Subrate Request ===============*/ +/** + * @brief Used to process the subrate request from the host to start the subrate procedure based on the current controller role in the input connection. + * + * @param conn_handle_id : [in] the identifier of the ACL connection to start the subrate procedure on it. + * + * @param subrate_default_params : [in] structure includes all subrate parameters from the host to start the procedure based on them. + * + * @retval Status(0:SUCCESS, 0xXX:ERROR_CODE). + */ +ble_stat_t ll_intf_le_subrate_req( + uint16_t conn_handle , + subrate_default_params_t subrate_requested_param + ); +#endif /* SUPPORT_LE_ENHANCED_CONN_UPDATE */ + +/** @} +*/ + + +#if SUPPORT_HCI_EVENT_ONLY + +/* + * @brief register callback to be called on LL queue is full + * @param cbk: host callback + * @retval None + * */ +void ll_intf_rgstr_hst_cbk_ll_queue_full(hst_cbk_queue_full cbk); + +/* + * @brief register callback to be called sending data to host + * @param upper_layer_cbk: host callback + * @retval None + * */ +void ll_intf_rgstr_hst_cbk(hst_cbk upper_layer_cbk); + +typedef union _change_state_options_t +{ + uint8_t combined_value; + struct { + uint8_t allow_generic_event: 1; + uint8_t allow_acl_data: 1; + uint8_t allow_iso_data: 1; + uint8_t allow_reports: 1; + uint8_t rfu: 4; + } bitfield; +} change_state_options_t; +/** + * @brief This function is used to indicate to the LL that the host + * is ready to receive events as indicated by options parameter + * @param options: [In] bit-field to set specific events on + * @retval None + */ +void ll_intf_chng_evnt_hndlr_state(change_state_options_t options); + + + + +/* + * @brief sets the event mask in hci event only configuration + * @param event_mask : [In] an array of 8 bytes representing new event mask + * @retval: None + * */ +void ll_intf_set_event_mask(uint8_t event_mask[8]); + +/* + * @brief sets page2 event mask in hci event only configuration + * @param event_mask : [In] an array of 8 bytes representing new event mask + * @retval: None + * */ +void ll_intf_set_event_mask_page2(uint8_t event_mask[8]); + + +/* + * @brief sets the LE event mask in hci event only configuration + * @param event_mask : [In] an array of 8 bytes representing new event mask + * @retval: None + * */ +void ll_intf_set_le_event_mask(uint8_t event_mask[8]); + + +/* + * @brief Delete ACL/ISO data related to a specific connection handle + * @param : [In] ACL or Cis or Bis conenction handle + * @retval: UNKNOWN_CONNECTION_IDENTIF if conn_Handle doesn't belong to any state machine. False + * if no data was found for conn_Handle and True if any data was deleted. + * */ +ble_stat_t ll_intf_clear_event(uint16_t conn_Handle); + +/* + * @brief sets the custom event mask in hci event only configuration + * @param cstm_evnt_mask : [In] custom event mask bitfield + * @retval: None + * */ +void ll_intf_set_custom_event_mask(uint8_t cstm_evnt_mask); + +#endif /* SUPPORT_HCI_EVENT_ONLY */ +/** @ingroup iso_cfg + * @{ + */ +#if (SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) +/** + * @brief register a callback function to be called on missed cig events, + * the cbk reports the current cig id, number of accumulated missed + * events and the anchor point of the next scheduled cig event + * + * @param cbk : [in] pointer to the callback function to be registered + * + * @retval None + */ +void ll_intf_rgstr_missed_cig_evnts_cbk(hst_cig_missed_evnt_cbk cbk); + +#endif /* (SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) */ + +#if (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS) +/** + * @brief register a callback function to be called on missed big events, +* the cbk reports the current big handle, number of accumulated missed + * events and the anchor point of the next scheduled big event + * + * @param cbk : [in] pointer to the callback function to be registered + * + * @retval None + */ +void ll_intf_rgstr_missed_big_evnts_cbk(hst_big_missed_evnt_cbk cbk); + +#endif /* (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS) */ +/**@} +*/ +/** @ingroup vendor_cfg Vendor Specific Commands +* @{ +*/ +#if (SUPPORT_AOA_AOD) + +/** + * @brief Set the number of antennas to be used by the controller, number of + * antennas is used as an upper limit for antenna_id set by the host + * + * @param num_of_antennas: [in] number of antennas + * + * @retval status : [out] 0:SUCCESS, 0xXX:ERROR_CODE. + */ +ble_stat_t ll_intf_set_num_of_antennas(uint8_t num_of_antennas); + +/** + * @brief Get the number of antennas configured to the controller + * + * @param ptr_num_of_antennas: [out] pointer to a variable hold + * number of antennas retrived + * + * @retval status : [out] 0:SUCCESS, 0xXX:ERROR_CODE. + */ +ble_stat_t ll_intf_get_num_of_antennas(uint8_t *ptr_num_of_antennas); + +#endif /* SUPPORT_AOA_AOD */ + +/** + * @brief Set number of packets to be transmitted on DTM mode. + * + * @param pckt_count: [in] number of packets to be transmitter + * + * @note for non-zero values of pckt_count, DTM start on TX mode will trigger sending packets with the specified + * number (pckt_count), if the value of pckt_count is Zero, DTM start on TX mode will trigger sending + * indefinite number of packets untill subsequent DTM stop is called or HCI reset is sent. + * + * @retval status : [out] 0:SUCCESS, 0xXX:ERROR_CODE. + */ +ble_stat_t ll_intf_set_dtm_with_spcfc_pckt_count(uint16_t pckt_count); + +/** + * @brief used to update the event timing. + * + * @param p_evnt_timing[in]: pointer to structure containing the new Event timing requested from the Upper layer. + * + * @retval None + */ +void ll_intf_config_schdling_time(Evnt_timing_t * p_evnt_timing); +/**@} +*/ + +#endif /* INCLUDE_LL_INTF_H */ diff --git a/lib/stm32wba/hci/ll/mem_intf.h b/lib/stm32wba/hci/ll/mem_intf.h new file mode 100644 index 000000000..3a0caad9e --- /dev/null +++ b/lib/stm32wba/hci/ll/mem_intf.h @@ -0,0 +1,98 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.30a-SOW05PatchV6/firmware/public_inc/mem_intf.h#1 $*/ +/** + ******************************************************************************** + * @file mem_intf.h + * @brief This file contains all the functions prototypes for the mem_intf.c. + ****************************************************************************** + * @copy + * This Synopsys DWC Bluetooth Low Energy Combo Link Layer/MAC software and + * associated documentation ( hereinafter the "Software") is an unsupported + * proprietary work of Synopsys, Inc. unless otherwise expressly agreed to in + * writing between Synopsys and you. The Software IS NOT an item of Licensed + * Software or a Licensed Product under any End User Software License Agreement + * or Agreement for Licensed Products with Synopsys or any supplement thereto. + * Synopsys is a registered trademark of Synopsys, Inc. Other names included in + * the SOFTWARE may be the trademarks of their respective owners. + * + * Synopsys MIT License: + * Copyright (c) 2020-Present Synopsys, Inc + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * the Software), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE ARISING FROM, + * OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef MEM_INTF_H +#define MEM_INTF_H + +/* Includes ------------------------------------------------------------------*/ +#include +/* Defination ----------------------------------------------------------------*/ +/* Exported variables ------------------------------------------------------- */ +/* Exported types ------------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported types ------------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + +/** @addtogroup Memory_Interface_Exported_Functions + * @{ + */ + +/** + * @brief Coping memory from position to another. + * @param ptr_dstntion : pointer to the destination array where the content is to be copied. + * @param ptr_src : pointer to the source of data to be copied. + * @param n : the number of bytes to be copied. + * @retval pointer to destination. + */ +void *ble_memcpy( + void *ptr_dstntion, + const void *ptr_src, + uint16_t n); + +/** + * @brief Setting a certian block of memory with a certain value. + * @param ptr_mem : pointer to the block of memory to fill. + * @param value : the value to be set. The value is passed as an int. + * @param n : the number of bytes to be set to the value. + * @retval pointer to destination. + */ +void *ble_memset( + void *ptr_mem, + uint8_t value, + uint16_t n); + +/** + * @brief comparing a certain block of memory with another. + * @param ptr_dstntion : pointer to the destination array where the content is to be compared. + * @param ptr_src : pointer to the source of data to be compared. + * @param n : the number of bytes to be compared. + * @retval < 0 ptr_dstntion is less than ptr_src. + * > 0 ptr_src is less than ptr_dstntion. + * 0 ptr_dstntion is equal to ptr_src. + */ +int8_t ble_memcmp( + const void *ptr_dstntion, + const void *ptr_src, + uint16_t n); + +/** + * @} + */ +#endif /* MEM_INTF_H */ + + diff --git a/lib/stm32wba/hci/ll/os_wrapper.h b/lib/stm32wba/hci/ll/os_wrapper.h new file mode 100644 index 000000000..67a84b5d6 --- /dev/null +++ b/lib/stm32wba/hci/ll/os_wrapper.h @@ -0,0 +1,501 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.30a-SOW05PatchV6/firmware/public_inc/os_wrapper.h#1 $*/ +/** + ******************************************************************************** + * @file os_wrapper.h + * @brief Wrapper header for OS porting + ****************************************************************************** + * @copy + * This Synopsys DWC Bluetooth Low Energy Combo Link Layer/MAC software and + * associated documentation ( hereinafter the "Software") is an unsupported + * proprietary work of Synopsys, Inc. unless otherwise expressly agreed to in + * writing between Synopsys and you. The Software IS NOT an item of Licensed + * Software or a Licensed Product under any End User Software License Agreement + * or Agreement for Licensed Products with Synopsys or any supplement thereto. + * Synopsys is a registered trademark of Synopsys, Inc. Other names included in + * the SOFTWARE may be the trademarks of their respective owners. + * + * Synopsys MIT License: + * Copyright (c) 2020-Present Synopsys, Inc + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * the Software), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE ARISING FROM, + * OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * */ + +/* Define to prevent recursive inclusion */ +#ifndef INCLUDE_OS_WRAPPER_H_ +#define INCLUDE_OS_WRAPPER_H_ + +#include "stdint.h" + +/* Exported Defines -----------------------------------------------------------*/ + +#define os_Pool_Def(type) \ +os_pool_def_t os_pool_##type + +#define os_Pool(type) \ +&os_pool_##type + +#define os_Pool_Def_extern(type) \ +extern os_pool_def_t os_pool_##type + +/* Exported macros ------------------------------------------------------------*/ +/* Exported types -------------------------------------------------------------*/ + +/** + * @brief Interrupt status. + */ +typedef enum int_state { + NOT_ACTIVE, + LINK_LAYER_INTRPT, + LINK_LAYER_LOW_PRIORITY_INTRPT, + UART_READ_INTRPT, + UART_WRITE_INTRPT, + TIMER_INTRPT, + MAC_INTRPT, + TOTAL_INTERRUPTS +} int_state_e; + +/** + * @brief Priority used for thread control. + */ +typedef enum { + os_priority_high, + os_priority_normal, + os_priority_low, +} os_priority; + +/** + * @brief SW Timer Activity Status. + */ +typedef enum _sw_timer_activity_status_e { + SW_TIMER_NOT_ACTIVE = 0x00, + SW_TIMER_ACTIVE = 0x01, + SW_TIMER_MAY_BE_NOT_ACTIVE = 0x02 +} sw_timer_activity_status_e; + +/** + * @brief SW Timer Type. + */ +typedef enum { + os_timer_once = 0, ///< one-shot timer + os_timer_periodic = 1 ///< repeating timer +} os_timer_type; + + +/** + * @brief SW Timer Priority. + */ +typedef enum { + lw_prio_tmr = 0, // Low Priority Timer + hg_prio_tmr = 1 // High Priority Timer +} os_timer_prio; + + +/** + * @brief Software Timer State Active, Expired or Stopped + */ +typedef enum { + osTimerActive, /**< @brief Active timer : Timer in the list waiting for its time to fire */ + osTimerExpired, /**< @brief Expired timer: Timer fired and removed form the list, or created and not exist in the list */ + osTimerStopped /**< @brief Stopped timer: Timer stopped and removed form the list */ +} os_timer_state; + +// Thread Management +typedef void (*os_pthread) (void const *argument); +typedef void* os_thread_id; + +// Timer Management +typedef void (*t_timer_callbk)(const void*); +typedef void* os_timer_id; +typedef void (*os_timer_activity_cb_t)(sw_timer_activity_status_e timer_activity); +typedef struct sw_timer sw_timer_t; + +// Mutex Management +typedef void os_mutex_def_t; +typedef void * os_mutex_id; + +// Semaphore Management +typedef void os_semaphore_def_t; +typedef void * os_semaphore_id; + +/** + * @brief Software Timer structure. + */ +struct sw_timer { + sw_timer_t *stnext; /**< @brief Next timer in the timers list. */ + uint32_t vtime; /**< @brief value of timer */ + uint32_t rtime; /**< @brief remain time. */ + t_timer_callbk ptimer; /**< @brief Timer callback function pointer. */ + void *argument; /**< @brief Timer callback function arguments. */ + uint16_t overflow_flag : 1; + uint16_t frac_time : 5; /** < @brief fraction time of period [0:31] in terms of us */ + uint16_t cycles : 5; /** < @brief cycles [0:31] number of elapsed cycles of periodic timer */ + uint16_t rem_time : 5; /** < @brief remainder to be added to the fraction [0:31] in terms of us */ + uint8_t state; /**< @brief Timer State : Active or Expired or Stopped */ + uint8_t type:1 ; /**< @brief Timer Type : one-shot (0) or periodic (1) */ + uint8_t prio:1 ; /* used to indicate if this timer ISR should be handled from hg isr in case of allow_lw_isr==1 */ +}; + +/** + * @brief Memory Block Structure + */ +typedef struct _mem_blck_t { + /* 8 bits | 8 bits | 8 bits | 8 bits * + * Free memory chunk flag | sub-pool number | reserved | handle_id */ + uint32_t flag; + struct _mem_blck_t * next; +} mem_blck_t; + +/** + * @brief Memory Pool Block Structure + */ +typedef struct { + uint32_t blck_size; /* block size */ + mem_blck_t* next_blck; /* next free block */ +} os_pool_def_t; + +/* Exported functions ---------------------------------------------------------*/ + +/** + * @brief Creates a thread + * + * @param thread Pointer to a function to be executed by the thread + * @param name Thread's name + * @param pri Thread's priority + * @param argu Arguments to be passed to the function executed by the thread + * @param stack_size Thread stack size + * + * @retval Handle of the created task + */ +os_thread_id os_thread_create( + os_pthread thread, + char* name, + os_priority pri, + void* argu, + uint32_t stack_size); + +/** + * @brief Registers an interrupt function corresponding to the passed interrupt ID + * + * @param ptr_int_hndlr Interrupt function + * @param int_id Interrupt ID + */ +void intr_hndlr_reg( + void (*ptr_int_hndlr)(), + int_state_e int_id); + +/** + * @brief initialize function to to os_wrapper + */ +void os_wrapper_init(void); + +/** + * @brief reset function to os_wrapper component + */ +void os_wrapper_reset(void); + + +/** + * @brief initialize timer function + */ +void os_timer_init(void); + +/** + * @brief initialize timer function + */ +void os_timer_reset(void); + +/** @ingroup SW_TIMER + * @{ + */ +/** + * @brief create a new timer + * + * @param p_callbk pointer to the call_back function. + * @param type os_timer_once for one-shot or os_timer_periodic for periodic behavior. + * @param argument argument to the timer call back function. + * + * @retval timer ID for reference by other functions or NULL in case of error. + */ +void* os_timer_create( + t_timer_callbk p_callbk, + os_timer_type type, + void *argument); + + +/** + * @brief set the timer priority + * + * @param timer id + * @param tmr_prio: the new priority of the timer in case of allow_lw_isr==1 + * + * @retval None + */ +void os_timer_set_prio(os_timer_id timer_id , + os_timer_prio tmr_prio); + +/** + * @brief get the timer priority + * + * @retval get the priority of the SW timers head + */ +uint8_t os_timer_is_any_near_sw_timer_hg_prio(void); + + +/** + * @brief start a running timer. + * + * @param timer_id timer Id. + * @param steps number of steps in 31.25 us resolution + * + * @retval error code. + */ +int32_t os_timer_start( + os_timer_id timer_id, + uint32_t steps); + +/** + * @brief start a running timer. + * + * @param timer_id timer Id. + * @param time_us time in us + * + * @retval error code. + */ +int32_t os_timer_start_in_us( + os_timer_id timer_id, + uint32_t time_us); + +/** + * @brief stop a running timer. + * + * @param timer_id timer Id. + * + * @retval error code. + */ +int32_t os_timer_stop( + os_timer_id timer_id); + +/** + * @brief free an allocated timer. + * + * @param timer_id timer Id. + * + * @retval error code. + */ +int32_t os_timer_free( + os_timer_id timer_id); + +/** + * @brief Stop the timer if it is running and delete it. + * + * @param ptr_timer_id pointer to the timer ID obtained by os_timer_create. + * + * @retval status code that indicates the execution status of the function. + */ +int32_t os_timer_stop_free( + os_timer_id *ptr_timer_id); + +/** + * @brief Stop the timer if it is running and start it with the new value. + * + * @param timer timer ID obtained by \ref os_timer_create. + * @param steps steps to set the timer with. + * + * @retval status code that indicates the execution status of the function. + */ +int32_t os_timer_set( + os_timer_id timer, + uint32_t steps); + +/** + * @brief get the starte of the timer. + * + * @param timer_id timer Id. + * + * @retval os_timer_state. Active , Expired, or stopped + */ +os_timer_state os_get_tmr_state( + os_timer_id timer_id); +/**@} + * * + */ +/** + * @brief Get the number of active SW timers. + * + * @retval active_sw_timers_num: The number of currently active SW timers + */ +uint32_t os_timer_get_active_sw_timers_number(void); + +/** + * @brief Register a callback function to show whether the timer is in use or not. + * + * @param cbk : [in] Callback function. + */ +void os_timer_rgstr_timer_activity_cbk( + os_timer_activity_cb_t cbk); + +/** + * @brief Gets the remaining time of the first time set to fire, if exists + * + * @retval Remaining time. 0 if no timers exist. + */ +uint64_t os_timer_get_earliest_time(void); + +/** + * @brief This function calls the proper handling based on the incming interrupt + * + * @param intrpt_fired current interrupt to be served. + */ +void os_process_isr( + int_state_e intrpt_fired); + +/** +* @ingroup os_wrappers +* @{ +*/ +/** + * @brief disables system Interrupts + */ +void os_disable_isr(void); + +/** + * @brief enables system Interrupts, the imp. should respect the nested disable calls + */ +void os_enable_isr(void); + +// ==== Mutex Management ==== + +/** + * @brief create a new recursive mutex + * + * @retval handle to the created mutex + */ +os_mutex_id os_rcrsv_mutex_create(void); + +/** + * @brief Wait until a mutex becames available + * + * @param mutex_id mutex id. + * @param millisec time-out value, 0 for no time-out. + * + * @retval status code , 0 for success + */ +int32_t os_rcrsv_mutex_wait( + os_mutex_id mutex_id, + uint32_t millisec); + +/** + * @brief Release a mutex + * + * @param mutex_id mutex id. + * + * @retval status code, 0 for success + */ +int32_t os_rcrsv_mutex_release( + os_mutex_id mutex_id); + +// ==== Semaphore Management Functions ==== +/** + * @brief Create and initialize a semaphore + * + * @param max_count The max value to which the semaphore can count. + * @param initial_count initial value assigned to the count. + * + * @retval semaphore id for reference + */ +os_semaphore_id os_semaphore_create( + int32_t max_count, + int32_t initial_count); + +/** + * @brief Wait until a semaphore becomes available + * + * @param semaphore_id semaphore id. + * @param millisec time-out value, 0 for no time-out. + * + * @retval status code, 0 for success + */ +int32_t os_semaphore_wait( + os_semaphore_id semaphore_id, + uint32_t millisec); + +/** + * @brief Release a semaphore + * + * @param semaphore_id semaphore id. + * + * @retval status code, 0 for success + */ +int32_t os_semaphore_release( + os_semaphore_id semaphore_id); + +/** + * @brief Release an ISR semaphore + * + * @param semaphore_id semaphore id. + * + * @retval status code, 0 for success + */ +int32_t os_semaphore_release_isr( + os_semaphore_id semaphore_id); + +/** + * @} + */ +/* ==== Memory Pool Management Functions ==== */ + +/** + * @brief Allocates from the passed memory pool + * + * @param pool Pointer to the pool to allocate from + * + * @retval Pointer at the allocated block + */ +void * os_mem_pool_alloc( + os_pool_def_t * pool); + +/** + * @brief Frees from the passed memory pool + * + * @param block Pointer at the block that will be freed + */ +void os_mem_pool_free( + void *block); + +/** + * @brief Allocates from the shared memory pool + * + * @param pool Pointer to the pool to allocate from + * + * @retval Pointer at the allocated block + */ +void* os_shrd_mem_alloc( + os_pool_def_t * pool); + +/** + * @fn uint8_t os_wrapper_is_rtos_used() + * + * @brief This function used to detect whether RTOS configuration is enabled or not. + * @param None. + * @return is_rtos_enabled : TRUE: RTOS enabled. FALSE: otherwise + */ +uint8_t os_wrapper_is_rtos_used(void); + +#endif /* INCLUDE_CONN_MNGR_H_ */ + + diff --git a/lib/stm32wba/hci/ll/power_table.h b/lib/stm32wba/hci/ll/power_table.h new file mode 100644 index 000000000..7558549e4 --- /dev/null +++ b/lib/stm32wba/hci/ll/power_table.h @@ -0,0 +1,104 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.30a-SOW05PatchV6/firmware/public_inc/power_table.h#1 $*/ +/** + ****************************************************************************** + * @file power_table.h + * @brief This file contains APIs prototypes related to configuring the used power table and the external power amplifier (EPA) parameters + ****************************************************************************** + * @copy + * This Synopsys DWC Bluetooth Low Energy Combo Link Layer/MAC software and + * associated documentation ( hereinafter the "Software") is an unsupported + * proprietary work of Synopsys, Inc. unless otherwise expressly agreed to in + * writing between Synopsys and you. The Software IS NOT an item of Licensed + * Software or a Licensed Product under any End User Software License Agreement + * or Agreement for Licensed Products with Synopsys or any supplement thereto. + * Synopsys is a registered trademark of Synopsys, Inc. Other names included in + * the SOFTWARE may be the trademarks of their respective owners. + * + * Synopsys MIT License: + * Copyright (c) 2020-Present Synopsys, Inc + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * the Software), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE ARISING FROM, + * OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * */ + +#ifndef POWER_TABLE_H_ +#define POWER_TABLE_H_ + +#include "common_types.h" + +/* Private typedef -----------------------------------------------------------*/ + +typedef uint8_t (*epa_enable_cb_t)(uint8_t epa_enable); + +/** + * @brief Structure of one element of the power table. + */ +typedef struct { +const uint8_t vddh_pa; /* VDDHPA supply volatge level */ +const uint8_t internal_pa_code; /* Internal PA code */ +const uint8_t epa_bypass; /* External PA Bypass 1: enabled, 0 : disabled */ +const int8_t tx_pwr; /* TX Power level in dBm. */ +} power_table_entry; + +/** + * @brief Structure of the power table ID. + */ +typedef struct _power_table_id_t{ + const power_table_entry *ptr_tx_power_table; /* Pointer to the TX_Power table corresponding to the associated "power_table_id". */ + const uint8_t tx_power_levels_count; /* Number of TX_Power levels in the selected power table. */ + const uint8_t g_vdd_ldo_value_1; /* Value to be set in PHY register (address: 0x63) to select the TX_Power mode */ + const uint8_t g_vdd_ldo_value_2; /* Value to be set in PHY register (address: 0xEA) to select the TX_Power mode */ + const uint8_t power_table_id; /* TX_Power table ID */ +} power_table_id_t; + + +extern const power_table_id_t ll_tx_power_tables[]; +extern const uint8_t num_of_supported_power_tables; + + + +/* APIs ----------------------------------------------------------------------*/ +/** @ingroup power_control_functions + * @{ + */ +/** + * @brief Used to initialize the EPA parameters. Called during the initialization. + * Note: If an EPA is in use, then a valid callback function shall be passed to LL FW, otherwise the LL FW returns error status. + * + * @param use_epa : [in] 1: External PA exists. 0: There is no External PA. + * @param cbk : [in] Callback function to actually enable and disable the EPA. + * + * @retval Status : FW returns an error code, in case: + * 1. "use_epa" has wrong value + * 2. An EPA is in use and its enable callback function is set to NULL. + */ +uint8_t ll_tx_pwr_if_epa_init(uint8_t use_epa, epa_enable_cb_t cbk); + +/** + * @brief Used to specify the used power table and its size based on the selected power mode. + * + * @param tx_power_mode : [in] Parameter indicating the selected TX_Power mode + * + * @retval Status : 0: SUCCESS. Otherwise: Error code. + */ +uint8_t ll_tx_pwr_if_select_tx_power_mode(uint8_t tx_power_table_id); + +/** + * @} + */ + +#endif /* POWER_TABLE_H_ */ diff --git a/lib/stm32wba/hci/ll_sys.h b/lib/stm32wba/hci/ll_sys.h new file mode 100644 index 000000000..ba2ddbbf5 --- /dev/null +++ b/lib/stm32wba/hci/ll_sys.h @@ -0,0 +1,100 @@ +/** + ****************************************************************************** + * @file ll_sys.h + * @author MCD Application Team + * @brief Header for Link Layer system interface module + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + +#ifndef LL_SYS_H +#define LL_SYS_H + +#include "ll_intf.h" +#include "hci.h" +#include "cmsis_compiler.h" +#include + +#define LL_DP_SLP_NO_WAKEUP ((uint32_t) ~(0) ) +#define LL_INTERNAL_TMR_US_TO_STEPS(US) (((US)*4)/125) + +/** + * @brief Link Layer Status structure definition + */ +typedef enum +{ + LL_SYS_OK = 0x00, + LL_SYS_ERROR = 0x01, + LL_SYS_BUSY = 0x02, +} ll_sys_status_t; + +/** + * @brief Link Layer radio bus clock clients definition + */ +typedef enum +{ + LL_SYS_RADIO_HCLK_RADIO_ISR, /* Radio interrupt event */ + LL_SYS_RADIO_HCLK_LL_EVT, /* Link Layer event depending on radio activity */ + LL_SYS_RADIO_HCLK_LL_BG, /* Link Layer background task */ + LL_SYS_RADIO_HCLK_BLEHOST_BG, /* BLE Host background task */ + LL_SYS_RADIO_HCLK_PREIDLE, /* Link Layer PRE IDLE task */ +} ll_sys_radio_hclk_client_t; + +/** + * @brief Link Layer deep sleep state + */ +typedef enum +{ + LL_SYS_DP_SLP_DISABLED = 0x00, + LL_SYS_DP_SLP_ENABLED, +} ll_sys_dp_slp_state_t; + +/* Link Layer system interface general module functions ************************************************/ +void ll_sys_init(void); +void ll_sys_delay_us(uint32_t delay); +void ll_sys_assert(uint8_t condition); +void ll_sys_get_rng(uint8_t *ptr_rnd, uint32_t len); +void ll_sys_radio_ack_ctrl(uint8_t enable); +void ll_sys_radio_wait_for_busclkrdy(void); +void ll_sys_setup_radio_intr(void (*intr_cb)()); +void ll_sys_setup_radio_sw_low_intr(void (*intr_cb)()); +void ll_sys_radio_sw_low_intr_trigger(uint8_t priority); +void ll_sys_radio_evt_not(uint8_t start); +void ll_sys_request_temperature(void); +void ll_sys_schldr_timing_update_not(Evnt_timing_t * p_evnt_timing); + +extern int ll_intf_is_ptr_in_ble_mem(void* inp_ptr); +void HostStack_Process(void); + +/* Link Layer system interface synchronisation module functions ************************************************/ +void ll_sys_bg_process(void); +void ll_sys_bg_process_init(void); +void ll_sys_schedule_bg_process(void); +void ll_sys_schedule_bg_process_isr(void); +void ll_sys_config_params(void); + +/* Link Layer system interface critical sections module functions ************************************************/ +void ll_sys_enable_irq(void); +void ll_sys_disable_irq(void); +void ll_sys_enable_specific_irq(uint8_t isr_type); +void ll_sys_disable_specific_irq(uint8_t isr_type); +void ll_sys_enable_os_context_switch(void); +void ll_sys_disable_os_context_switch(void); + +/* Link Layer system interface deep sleep module functions ************************************************/ +ll_sys_status_t ll_sys_dp_slp_init(void); +ll_sys_status_t ll_sys_dp_slp_enter(uint32_t dp_slp_duration); +ll_sys_status_t ll_sys_dp_slp_exit(void); +ll_sys_dp_slp_state_t ll_sys_dp_slp_get_state(void); +void ll_sys_dp_slp_wakeup_evt_clbk(void const *ptr_arg); + +#endif /* LL_SYS_H */ \ No newline at end of file diff --git a/lib/stm32wba/hci/ll_sys_cs.c b/lib/stm32wba/hci/ll_sys_cs.c new file mode 100644 index 000000000..abd013b51 --- /dev/null +++ b/lib/stm32wba/hci/ll_sys_cs.c @@ -0,0 +1,70 @@ +/** + ****************************************************************************** + * @file ll_sys_cs.c + * @author MCD Application Team + * @brief Link Layer IP system interface critical sections management + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + +#include "linklayer_plat.h" +#include "ll_sys.h" +#include + +/** + * @brief Enable interrupts + * @param None + * @retval None + */ +void ll_sys_enable_irq(void) { + LINKLAYER_PLAT_EnableIRQ(); +} + +/** + * @brief Disable interrupts + * @param None + * @retval None + */ +void ll_sys_disable_irq(void) { + LINKLAYER_PLAT_DisableIRQ(); +} + +/** + * @brief Set the Current Interrupt Priority Mask. + * All interrupts with low priority level will be masked. + * @param None + * @retval None + */ +void ll_sys_enable_specific_irq(uint8_t isr_type) +{ + LINKLAYER_PLAT_EnableSpecificIRQ(isr_type); +} + +/** + * @brief Restore the previous interrupt priority level + * @param None + * @retval None + */ +void ll_sys_disable_specific_irq(uint8_t isr_type) +{ + LINKLAYER_PLAT_DisableSpecificIRQ(isr_type); +} + +void ll_sys_enable_os_context_switch(void) +{ + LINKLAYER_PLAT_EnableOSContextSwitch(); +} + +void ll_sys_disable_os_context_switch(void) +{ + LINKLAYER_PLAT_DisableOSContextSwitch(); +} diff --git a/lib/stm32wba/hci/ll_sys_dp_slp.c b/lib/stm32wba/hci/ll_sys_dp_slp.c new file mode 100644 index 000000000..aa19d36c4 --- /dev/null +++ b/lib/stm32wba/hci/ll_sys_dp_slp.c @@ -0,0 +1,177 @@ +/** + ****************************************************************************** + * @file ll_sys_dp_slp.c + * @author MCD Application Team + * @brief Link Layer IP system interface deep sleep management + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + +#include "linklayer_plat.h" +#include "ll_sys.h" +#include "ll_intf.h" +#if defined(MAC) +#include "platform.h" +#endif + +/* Link Layer deep sleep status */ +uint8_t is_Radio_DeepSleep = 0U; + +/* Link Layer deep sleep timer */ +os_timer_id radio_dp_slp_tmr_id = NULL; + +/* Link Layer deep sleep state */ +ll_sys_dp_slp_state_t linklayer_dp_slp_state = LL_SYS_DP_SLP_DISABLED; + +/** + * @brief Initialize resources to handle deep sleep entry/exit + * @param None + * @retval LL_SYS status + */ +ll_sys_status_t ll_sys_dp_slp_init(void) +{ + ll_sys_status_t return_status = LL_SYS_ERROR; + + /* Create link layer timer for handling IP DEEP SLEEP mode */ + radio_dp_slp_tmr_id = os_timer_create((t_timer_callbk)ll_sys_dp_slp_wakeup_evt_clbk, os_timer_once, NULL); + + if (radio_dp_slp_tmr_id != NULL) + { + return_status = LL_SYS_OK; + } + + return return_status; +} + +/** + * @brief Link Layer deep sleep status getter + * @param None + * @retval Link Layer deep sleep state + */ +ll_sys_dp_slp_state_t ll_sys_dp_slp_get_state(void) +{ + return linklayer_dp_slp_state; +} + +/** + * @brief The Link Layer IP enters deep sleep mode + * @param dp_slp_duration deep sleep duration in us + * @retval LL_SYS status + */ +ll_sys_status_t ll_sys_dp_slp_enter(uint32_t dp_slp_duration){ + ble_stat_t cmd_status = GENERAL_FAILURE; + int32_t os_status = GENERAL_FAILURE; + ll_sys_status_t return_status = LL_SYS_ERROR; + + /* Check if deep sleep timer has to be started */ + if(dp_slp_duration < LL_DP_SLP_NO_WAKEUP) + { + /* Start deep sleep timer */ + os_status = os_timer_start(radio_dp_slp_tmr_id, LL_INTERNAL_TMR_US_TO_STEPS(dp_slp_duration)); + } + + else + { + /* No timer started */ + os_status = SUCCESS; + } + + if(os_status == SUCCESS) + { + /* Switch Link Layer IP to DEEP SLEEP mode */ +#if defined(BLE) + /* BLE & Concurrent use case */ + cmd_status = ll_intf_le_set_dp_slp_mode(DEEP_SLEEP_ENABLE); +#elif defined(MAC) + if (radio_set_dp_slp_mode(DEEP_SLEEP_ENABLE) == OT_ERROR_NONE) + { + cmd_status = SUCCESS; + } +#else + #error "neither MAC not BLE defined" +#endif + if(cmd_status == SUCCESS){ + linklayer_dp_slp_state = LL_SYS_DP_SLP_ENABLED; + return_status = LL_SYS_OK; + } + } + + return return_status; +} + +/** + * @brief The Link Layer IP exits deep sleep mode + * @param None + * @retval LL_SYS status + */ +ll_sys_status_t ll_sys_dp_slp_exit(void){ + ble_stat_t cmd_status = GENERAL_FAILURE; + ll_sys_status_t return_status = LL_SYS_ERROR; + + /* Disable radio interrupt */ + LINKLAYER_PLAT_DisableRadioIT(); + + if(linklayer_dp_slp_state == LL_SYS_DP_SLP_DISABLED) + { + /* Radio not in sleep mode */ + return_status = LL_SYS_OK; + } + else + { + /* Stop the deep sleep wake-up timer if running */ + if(os_get_tmr_state(radio_dp_slp_tmr_id) != (os_timer_state)osTimerStopped) + { + os_timer_stop(radio_dp_slp_tmr_id); + } + + /* Switch Link Layer IP to SLEEP mode (by deactivate DEEP SLEEP mode) */ +#if defined(BLE) + /* BLE & Concurrent use case */ + cmd_status = ll_intf_le_set_dp_slp_mode(DEEP_SLEEP_DISABLE); +#elif defined(MAC) + if (radio_set_dp_slp_mode(DEEP_SLEEP_DISABLE) == OT_ERROR_NONE) + { + cmd_status = SUCCESS; + } +#else + #error "neither MAC not BLE defined" +#endif + if(cmd_status == SUCCESS) + { + linklayer_dp_slp_state = LL_SYS_DP_SLP_DISABLED; + return_status = LL_SYS_OK; + } + } + + /* Re-enable radio interrupt */ + LINKLAYER_PLAT_EnableRadioIT(); + + return return_status; +} + +/** + * @brief Link Layer deep sleep wake-up timer callback + * @param ptr_arg pointer passed through the callback + * @retval LL_SYS status + */ +void ll_sys_dp_slp_wakeup_evt_clbk(void const *ptr_arg){ + int32_t os_status = GENERAL_FAILURE; + + /* Stop the Link Layer IP DEEP SLEEP wake-up timer */ + os_status = os_timer_stop(radio_dp_slp_tmr_id); + if(os_status != SUCCESS){ + return; + } + + /* Link Layer IP exits from DEEP SLEEP mode */ + ll_sys_dp_slp_exit(); +} diff --git a/lib/stm32wba/hci/ll_sys_intf.c b/lib/stm32wba/hci/ll_sys_intf.c new file mode 100644 index 000000000..5c5710070 --- /dev/null +++ b/lib/stm32wba/hci/ll_sys_intf.c @@ -0,0 +1,172 @@ +/** + ****************************************************************************** + * @file ll_sys_intf.c + * @author MCD Application Team + * @brief Link Layer IP general system interface + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + +#include "linklayer_plat.h" +#include "ll_sys.h" +#include "event_manager.h" +#include "ll_intf.h" + +/** + * @brief Initialize the Link Layer SoC dependencies + * @param None + * @retval None + */ +void ll_sys_init() +{ + LINKLAYER_PLAT_ClockInit(); +} + +/** + * @brief Blocking delay in us + * @param None + * @retval None + */ +void ll_sys_delay_us(uint32_t delay) +{ + LINKLAYER_PLAT_DelayUs(delay); +} + +/** + * @brief Assert checking + * @param None + * @retval None + */ +void ll_sys_assert(uint8_t condition) +{ + LINKLAYER_PLAT_Assert(condition); +} + +/** + * @brief Radio active clock management + * @param None + * @retval None + */ +void ll_sys_radio_ack_ctrl(uint8_t enable) +{ + LINKLAYER_PLAT_AclkCtrl(enable); +} + +/** + * @brief Link Layer waits for radio bus clock ready + * @param None + * @retval None + */ +void ll_sys_radio_wait_for_busclkrdy(void) +{ + LINKLAYER_PLAT_WaitHclkRdy(); +} + +/** + * @brief Get RNG number for the Link Layer IP + * @param None + * @retval None + */ +void ll_sys_get_rng(uint8_t *ptr_rnd, uint32_t len) +{ + LINKLAYER_PLAT_GetRNG(ptr_rnd, len); +} + +/** + * @brief Initialize the main radio interrupt + * @param intr_cb radio interrupt callback to link with the radio IRQ + * @retval None + */ +void ll_sys_setup_radio_intr(void (*intr_cb)()) +{ + LINKLAYER_PLAT_SetupRadioIT(intr_cb); +} + +/** + * @brief Initialize the radio SW low interrupt + * @param intr_cb radio SW low interrupt interrupt callback to link + * with the defined interrupt vector + * @retval None + */ +void ll_sys_setup_radio_sw_low_intr(void (*intr_cb)()) +{ + LINKLAYER_PLAT_SetupSwLowIT(intr_cb); +} + +/** + * @brief Trigger the radio SW low interrupt + * @param None + * @retval None + */ +void ll_sys_radio_sw_low_intr_trigger(uint8_t priority) +{ + LINKLAYER_PLAT_TriggerSwLowIT(priority); +} + +/** + * @brief Link Layer radio activity event notification + * @param start start/end of radio event + * @retval None + */ +void ll_sys_radio_evt_not(uint8_t start) +{ + if(start) + { + LINKLAYER_PLAT_StartRadioEvt(); + } + + else + { + LINKLAYER_PLAT_StopRadioEvt(); + } +} + +/** + * @brief Link Layer temperature request + * @param None + * @retval None + */ +void ll_sys_request_temperature(void) +{ + LINKLAYER_PLAT_RequestTemperature(); +} + +/** + * @brief Link Layer background task pcoessing procedure + * @param None + * @retval None + */ +void ll_sys_bg_process(void) +{ + if(emngr_can_mcu_sleep() == 0) + { + ll_sys_dp_slp_exit(); + emngr_handle_all_events(); + + HostStack_Process(); + } + + if(emngr_can_mcu_sleep() == 0) + { + ll_sys_schedule_bg_process(); + } +} + +void ll_sys_schldr_timing_update_not(Evnt_timing_t * p_evnt_timing) +{ + LINKLAYER_PLAT_SCHLDR_TIMING_UPDATE_NOT(p_evnt_timing); +} + +__WEAK void HostStack_Process(void) +{ + +} diff --git a/lib/stm32wba/hci/ll_sys_startup.c b/lib/stm32wba/hci/ll_sys_startup.c new file mode 100644 index 000000000..61a7d9881 --- /dev/null +++ b/lib/stm32wba/hci/ll_sys_startup.c @@ -0,0 +1,98 @@ +/** + ****************************************************************************** + * @file ll_sys_startup.c + * @author MCD Application Team + * @brief Link Layer IP system interface startup module + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + +#include "ll_fw_config.h" +#include "ll_sys.h" +#include "ll_intf.h" +#include "ll_sys_startup.h" +#include "common_types.h" +#if defined(MAC) && (SUPPORT_OPENTHREAD_1_2 == 0) +/* Projects with MAC Layer (i.e. 15.4 except Thread) */ +#include "st_mac_802_15_4_sap.h" +#endif /* MAC */ + +static void ll_sys_dependencies_init(void); +#ifdef BLE +static void ll_sys_event_missed_cb( ble_buff_hdr_t* ptr_evnt_hdr ) +{ + +} + +/** + * @brief Initialize the Link Layer IP BLE controller + * @param None + * @retval None + */ +void ll_sys_ble_cntrl_init(hst_cbk hostCallback) +{ + const struct hci_dispatch_tbl* p_hci_dis_tbl; + hci_get_dis_tbl( &p_hci_dis_tbl ); + + ll_intf_init(p_hci_dis_tbl); + + ll_intf_rgstr_hst_cbk(hostCallback); + + ll_intf_rgstr_hst_cbk_ll_queue_full( ll_sys_event_missed_cb ); + + ll_sys_dependencies_init(); +} +#endif /* BLE */ +#if defined(MAC) && (SUPPORT_OPENTHREAD_1_2 == 0) +/** + * @brief Initialize the Link Layer IP 802.15.4 MAC controller + * @param None + * @retval None + */ +void ll_sys_mac_cntrl_init(void) +{ + ST_MAC_preInit(); + ll_sys_dependencies_init(); +} +#endif /* MAC */ + +/** + * @brief Start the Link Layer IP in OpenThread configuration + * @param None + * @retval None + */ +void ll_sys_thread_init(void) +{ + ll_sys_dependencies_init(); +} + +/** + * @brief Initialize the Link Layer resources for startup. + * This includes: - Deep Sleep feature resources + * - Link Layer background task + * @param None + * @retval None + */ +static void ll_sys_dependencies_init(void) +{ + ll_sys_status_t dp_slp_status = LL_SYS_ERROR; + + /* Deep sleep feature initialization */ + dp_slp_status = ll_sys_dp_slp_init(); + ll_sys_assert(dp_slp_status == LL_SYS_OK); + + /* Background task initialization */ + ll_sys_bg_process_init(); + + /* Link Layer user parameters application */ + ll_sys_config_params(); +} diff --git a/lib/stm32wba/hci/ll_sys_startup.h b/lib/stm32wba/hci/ll_sys_startup.h new file mode 100644 index 000000000..c9018f760 --- /dev/null +++ b/lib/stm32wba/hci/ll_sys_startup.h @@ -0,0 +1,29 @@ +/** + ****************************************************************************** + * @file ll_sys_startup.h + * @author MCD Application Team + * @brief Header for Link Layer startup interfaces + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + +#ifndef LL_SYS_STARTUP_H +#define LL_SYS_STARTUP_H + +/* Link Layer system interface startup module functions ************************************************/ +#if BLE +void ll_sys_ble_cntrl_init(hst_cbk hostCallback); +#endif +void ll_sys_mac_cntrl_init(void); +void ll_sys_thread_init(void); + +#endif /* LL_SYS_STARTUP_H */ \ No newline at end of file diff --git a/lib/stm32wba/hci/local_debug_tables.h b/lib/stm32wba/hci/local_debug_tables.h new file mode 100644 index 000000000..6a9bae35e --- /dev/null +++ b/lib/stm32wba/hci/local_debug_tables.h @@ -0,0 +1,1138 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file local_debug_tables.h + * @author MCD Application Team + * @brief Real Time Debug module System and Link Layer signal + correspondence tables + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ +#ifndef LOCAL_DEBUG_TABLES_H +#define LOCAL_DEBUG_TABLES_H + +#if(CFG_RT_DEBUG_GPIO_MODULE == 1) + +/*******************************/ +/** System local signal table **/ +/*******************************/ + +static const rt_debug_signal_t system_debug_table[] = { +#if (USE_RT_DEBUG_SCM_SETUP == 1) + [SCM_SETUP] = RT_DEBUG_SCM_SETUP, +#else + [SCM_SETUP] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_SCM_SETUP */ + +#if (USE_RT_DEBUG_SCM_SYSTEM_CLOCK_CONFIG == 1) + [SCM_SYSTEM_CLOCK_CONFIG] = RT_DEBUG_SCM_SYSTEM_CLOCK_CONFIG, +#else + [SCM_SYSTEM_CLOCK_CONFIG] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_SCM_SYSTEM_CLOCK_CONFIG */ + +#if (USE_RT_DEBUG_SCM_HSERDY_ISR == 1) + [SCM_HSERDY_ISR] = RT_DEBUG_SCM_HSERDY_ISR, +#else + [SCM_HSERDY_ISR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_SCM_HSERDY_ISR */ + +#if (USE_RT_DEBUG_ADC_ACTIVATION == 1) + [ADC_ACTIVATION] = RT_DEBUG_ADC_ACTIVATION, +#else + [ADC_ACTIVATION] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADC_ACTIVATION */ + +#if (USE_RT_DEBUG_ADC_DEACTIVATION == 1) + [ADC_DEACTIVATION] = RT_DEBUG_ADC_DEACTIVATION, +#else + [ADC_DEACTIVATION] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADC_DEACTIVATION */ + +#if (USE_RT_DEBUG_ADC_TEMPERATURE_ACQUISITION == 1) + [ADC_TEMPERATURE_ACQUISITION] = RT_DEBUG_ADC_TEMPERATURE_ACQUISITION, +#else + [ADC_TEMPERATURE_ACQUISITION] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADC_TEMPERATURE_ACQUISITION */ + +#if (USE_RT_DEBUG_RNG_ENABLE == 1) + [RNG_ENABLE] = RT_DEBUG_RNG_ENABLE, +#else + [RNG_ENABLE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RNG_ENABLE */ + +#if (USE_RT_DEBUG_RNG_DISABLE == 1) + [RNG_DISABLE] = RT_DEBUG_RNG_DISABLE, +#else + [RNG_DISABLE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RNG_DISABLE */ + +#if (USE_RT_DEBUG_RNG_GEN_RAND_NUM == 1) + [RNG_GEN_RAND_NUM] = RT_DEBUG_RNG_GEN_RAND_NUM, +#else + [RNG_GEN_RAND_NUM] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RNG_GEN_RAND_NUM */ + +#if (USE_RT_DEBUG_LOW_POWER_STOP_MODE_ENTER == 1) + [LOW_POWER_STOP_MODE_ENTER] = RT_DEBUG_LOW_POWER_STOP_MODE_ENTER, +#else + [LOW_POWER_STOP_MODE_ENTER] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LOW_POWER_STOP_MODE_ENTER */ + +#if (USE_RT_DEBUG_LOW_POWER_STOP_MODE_EXIT == 1) + [LOW_POWER_STOP_MODE_EXIT] = RT_DEBUG_LOW_POWER_STOP_MODE_EXIT, +#else + [LOW_POWER_STOP_MODE_EXIT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LOW_POWER_STOP_MODE_EXIT */ + +#if (USE_RT_DEBUG_LOW_POWER_STOP_MODE_ACTIVE == 1) + [LOW_POWER_STOP_MODE_ACTIVE] = RT_DEBUG_LOW_POWER_STOP_MODE_ACTIVE, +#else + [LOW_POWER_STOP_MODE_ACTIVE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LOW_POWER_STOP_MODE_ACTIVE */ + +#if (USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_ENTER == 1) + [LOW_POWER_STANDBY_MODE_ENTER] = RT_DEBUG_LOW_POWER_STANDBY_MODE_ENTER, +#else + [LOW_POWER_STANDBY_MODE_ENTER] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_ENTER */ + +#if (USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_EXIT == 1) + [LOW_POWER_STANDBY_MODE_EXIT] = RT_DEBUG_LOW_POWER_STANDBY_MODE_EXIT, +#else + [LOW_POWER_STANDBY_MODE_EXIT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_EXIT */ + +#if (USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_ACTIVE == 1) + [LOW_POWER_STANDBY_MODE_ACTIVE] = RT_DEBUG_LOW_POWER_STANDBY_MODE_ACTIVE, +#else + [LOW_POWER_STANDBY_MODE_ACTIVE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LOW_POWER_STANDBY_MODE_ACTIVE */ +}; + +/***********************************/ +/** Link Layer local signal table **/ +/***********************************/ + +static const rt_debug_signal_t linklayer_debug_table[] = { +#if (USE_RT_DEBUG_HCI_READ_DONE == 1) + [DBG_IO_HCI_READ_DONE] = RT_DEBUG_HCI_READ_DONE, +#else + [DBG_IO_HCI_READ_DONE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_HCI_READ_DONE */ + +#if (USE_RT_DEBUG_HCI_RCVD_CMD == 1) + [DBG_IO_HCI_RCVD_CMD] = RT_DEBUG_HCI_RCVD_CMD, +#else + [DBG_IO_HCI_RCVD_CMD] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_HCI_RCVD_CMD */ + +#if (USE_RT_DEBUG_HCI_WRITE_DONE == 1) + [DBG_IO_HCI_WRITE_DONE] = RT_DEBUG_HCI_WRITE_DONE, +#else + [DBG_IO_HCI_WRITE_DONE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_HCI_WRITE_DONE */ + +#if (USE_RT_DEBUG_SCHDLR_EVNT_UPDATE == 1) + [DBG_IO_SCHDLR_EVNT_UPDATE] = RT_DEBUG_SCHDLR_EVNT_UPDATE, +#else + [DBG_IO_SCHDLR_EVNT_UPDATE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_SCHDLR_EVNT_UPDATE */ + +#if (USE_RT_DEBUG_SCHDLR_TIMER_SET == 1) + [DBG_IO_SCHDLR_TIMER_SET] = RT_DEBUG_SCHDLR_TIMER_SET, +#else + [DBG_IO_SCHDLR_TIMER_SET] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_SCHDLR_TIMER_SET */ + +#if (USE_RT_DEBUG_SCHDLR_PHY_CLBR_TIMER == 1) + [DBG_IO_SCHDLR_PHY_CLBR_TIMER] = RT_DEBUG_SCHDLR_PHY_CLBR_TIMER, +#else + [DBG_IO_SCHDLR_PHY_CLBR_TIMER] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_SCHDLR_PHY_CLBR_TIMER */ + +#if (USE_RT_DEBUG_SCHDLR_EVNT_SKIPPED == 1) + [DBG_IO_SCHDLR_EVNT_SKIPPED] = RT_DEBUG_SCHDLR_EVNT_SKIPPED, +#else + [DBG_IO_SCHDLR_EVNT_SKIPPED] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_SCHDLR_EVNT_SKIPPED */ + +#if (USE_RT_DEBUG_SCHDLR_HNDL_NXT_TRACE == 1) + [DBG_IO_SCHDLR_HNDL_NXT_TRACE] = RT_DEBUG_SCHDLR_HNDL_NXT_TRACE, +#else + [DBG_IO_SCHDLR_HNDL_NXT_TRACE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_SCHDLR_HNDL_NXT_TRACE */ + +#if (USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_DETEDTED == 1) + [DBG_IO_ACTIVE_SCHDLR_NEAR_DETEDTED] = RT_DEBUG_ACTIVE_SCHDLR_NEAR_DETEDTED, +#else + [DBG_IO_ACTIVE_SCHDLR_NEAR_DETEDTED] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_DETEDTED */ + +#if (USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_GAP_CHECK == 1) + [DBG_IO_ACTIVE_SCHDLR_NEAR_GAP_CHECK] = RT_DEBUG_ACTIVE_SCHDLR_NEAR_GAP_CHECK, +#else + [DBG_IO_ACTIVE_SCHDLR_NEAR_GAP_CHECK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_GAP_CHECK */ + +#if (USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_TIME_CHECK == 1) + [DBG_IO_ACTIVE_SCHDLR_NEAR_TIME_CHECK] = RT_DEBUG_ACTIVE_SCHDLR_NEAR_TIME_CHECK, +#else + [DBG_IO_ACTIVE_SCHDLR_NEAR_TIME_CHECK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_TIME_CHECK */ + +#if (USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_TRACE == 1) + [DBG_IO_ACTIVE_SCHDLR_NEAR_TRACE] = RT_DEBUG_ACTIVE_SCHDLR_NEAR_TRACE, +#else + [DBG_IO_ACTIVE_SCHDLR_NEAR_TRACE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ACTIVE_SCHDLR_NEAR_TRACE */ + +#if (USE_RT_DEBUG_SCHDLR_EVNT_RGSTR == 1) + [DBG_IO_SCHDLR_EVNT_RGSTR] = RT_DEBUG_SCHDLR_EVNT_RGSTR, +#else + [DBG_IO_SCHDLR_EVNT_RGSTR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_SCHDLR_EVNT_RGSTR */ + +#if (USE_RT_DEBUG_SCHDLR_ADD_CONFLICT_Q == 1) + [DBG_IO_SCHDLR_ADD_CONFLICT_Q] = RT_DEBUG_SCHDLR_ADD_CONFLICT_Q, +#else + [DBG_IO_SCHDLR_ADD_CONFLICT_Q] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_SCHDLR_ADD_CONFLICT_Q */ + +#if (USE_RT_DEBUG_SCHDLR_HNDL_MISSED_EVNT == 1) + [DBG_IO_SCHDLR_HNDL_MISSED_EVNT] = RT_DEBUG_SCHDLR_HNDL_MISSED_EVNT, +#else + [DBG_IO_SCHDLR_HNDL_MISSED_EVNT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_SCHDLR_HNDL_MISSED_EVNT */ + +#if (USE_RT_DEBUG_SCHDLR_UNRGSTR_EVNT == 1) + [DBG_IO_SCHDLR_UNRGSTR_EVNT] = RT_DEBUG_SCHDLR_UNRGSTR_EVNT, +#else + [DBG_IO_SCHDLR_UNRGSTR_EVNT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_SCHDLR_UNRGSTR_EVNT */ + +#if (USE_RT_DEBUG_SCHDLR_EXEC_EVNT_TRACE == 1) + [DBG_IO_SCHDLR_EXEC_EVNT_TRACE] = RT_DEBUG_SCHDLR_EXEC_EVNT_TRACE, +#else + [DBG_IO_SCHDLR_EXEC_EVNT_TRACE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_SCHDLR_EXEC_EVNT_TRACE */ + +#if (USE_RT_DEBUG_SCHDLR_EXEC_EVNT_PROFILE == 1) + [DBG_IO_SCHDLR_EXEC_EVNT_PROFILE] = RT_DEBUG_SCHDLR_EXEC_EVNT_PROFILE, +#else + [DBG_IO_SCHDLR_EXEC_EVNT_PROFILE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_SCHDLR_EXEC_EVNT_PROFILE */ + +#if (USE_RT_DEBUG_SCHDLR_EXEC_EVNT_ERROR == 1) + [DBG_IO_SCHDLR_EXEC_EVNT_ERROR] = RT_DEBUG_SCHDLR_EXEC_EVNT_ERROR, +#else + [DBG_IO_SCHDLR_EXEC_EVNT_ERROR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_SCHDLR_EXEC_EVNT_ERROR */ + +#if (USE_RT_DEBUG_SCHDLR_EXEC_EVNT_WINDOW_WIDENING == 1) + [DBG_IO_SCHDLR_EXEC_EVNT_WINDOW_WIDENING] = RT_DEBUG_SCHDLR_EXEC_EVNT_WINDOW_WIDENING, +#else + [DBG_IO_SCHDLR_EXEC_EVNT_WINDOW_WIDENING] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_SCHDLR_EXEC_EVNT_WINDOW_WIDENING */ + +#if (USE_RT_DEBUG_LLHWC_CMN_CLR_ISR == 1) + [DBG_IO_LLHWC_CMN_CLR_ISR] = RT_DEBUG_LLHWC_CMN_CLR_ISR, +#else + [DBG_IO_LLHWC_CMN_CLR_ISR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_CMN_CLR_ISR */ + +#if (USE_RT_DEBUG_LLWCC_CMN_HG_ISR == 1) + [DBG_IO_LLWCC_CMN_HG_ISR] = RT_DEBUG_LLWCC_CMN_HG_ISR, +#else + [DBG_IO_LLWCC_CMN_HG_ISR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLWCC_CMN_HG_ISR */ + +#if (USE_RT_DEBUG_LLHWC_CMN_LW_ISR == 1) + [DBG_IO_LLHWC_CMN_LW_ISR] = RT_DEBUG_LLHWC_CMN_LW_ISR, +#else + [DBG_IO_LLHWC_CMN_LW_ISR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_CMN_LW_ISR */ + +#if (USE_RT_DEBUG_LLHWC_CMN_CLR_TIMER_ERROR == 1) + [DBG_IO_LLHWC_CMN_CLR_TIMER_ERROR] = RT_DEBUG_LLHWC_CMN_CLR_TIMER_ERROR, +#else + [DBG_IO_LLHWC_CMN_CLR_TIMER_ERROR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_CMN_CLR_TIMER_ERROR */ + +#if (USE_RT_DEBUG_LLHWC_LL_ISR == 1) + [DBG_IO_LLHWC_LL_ISR] = RT_DEBUG_LLHWC_LL_ISR, +#else + [DBG_IO_LLHWC_LL_ISR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_LL_ISR */ + +#if (USE_RT_DEBUG_LLHWC_SPLTMR_SET == 1) + [DBG_IO_LLHWC_SPLTMR_SET] = RT_DEBUG_LLHWC_SPLTMR_SET, +#else + [DBG_IO_LLHWC_SPLTMR_SET] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_SPLTMR_SET */ + +#if (USE_RT_DEBUG_LLHWC_SPLTMR_GET == 1) + [DBG_IO_LLHWC_SPLTMR_GET] = RT_DEBUG_LLHWC_SPLTMR_GET, +#else + [DBG_IO_LLHWC_SPLTMR_GET] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_SPLTMR_GET */ + +#if (USE_RT_DEBUG_LLHWC_LOW_ISR == 1) + [DBG_IO_LLHWC_LOW_ISR] = RT_DEBUG_LLHWC_LOW_ISR, +#else + [DBG_IO_LLHWC_LOW_ISR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_LOW_ISR */ + +#if (USE_RT_DEBUG_LLHWC_STOP_SCN == 1) + [DBG_IO_LLHWC_STOP_SCN] = RT_DEBUG_LLHWC_STOP_SCN, +#else + [DBG_IO_LLHWC_STOP_SCN] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_STOP_SCN */ + +#if (USE_RT_DEBUG_LLHWC_WAIT_ENVT_ON_AIR == 1) + [DBG_IO_LLHWC_WAIT_ENVT_ON_AIR] = RT_DEBUG_LLHWC_WAIT_ENVT_ON_AIR, +#else + [DBG_IO_LLHWC_WAIT_ENVT_ON_AIR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_WAIT_ENVT_ON_AIR */ + +#if (USE_RT_DEBUG_LLHWC_SET_CONN_EVNT_PARAM == 1) + [DBG_IO_LLHWC_SET_CONN_EVNT_PARAM] = RT_DEBUG_LLHWC_SET_CONN_EVNT_PARAM, +#else + [DBG_IO_LLHWC_SET_CONN_EVNT_PARAM] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_SET_CONN_EVNT_PARAM */ + +#if (USE_RT_DEBUG_POST_EVNT == 1) + [DBG_IO_POST_EVNT] = RT_DEBUG_POST_EVNT, +#else + [DBG_IO_POST_EVNT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_POST_EVNT */ + +#if (USE_RT_DEBUG_HNDL_ALL_EVNTS == 1) + [DBG_IO_HNDL_ALL_EVNTS] = RT_DEBUG_HNDL_ALL_EVNTS, +#else + [DBG_IO_HNDL_ALL_EVNTS] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_HNDL_ALL_EVNTS */ + +#if (USE_RT_DEBUG_PROCESS_EVNT == 1) + [DBG_IO_PROCESS_EVNT] = RT_DEBUG_PROCESS_EVNT, +#else + [DBG_IO_PROCESS_EVNT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PROCESS_EVNT */ + +#if (USE_RT_DEBUG_PROCESS_ISO_DATA == 1) + [DBG_IO_PROCESS_ISO_DATA] = RT_DEBUG_PROCESS_ISO_DATA, +#else + [DBG_IO_PROCESS_ISO_DATA] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PROCESS_ISO_DATA */ + +#if (USE_RT_DEBUG_ALLOC_TX_ISO_EMPTY_PKT == 1) + [DBG_IO_ALLOC_TX_ISO_EMPTY_PKT] = RT_DEBUG_ALLOC_TX_ISO_EMPTY_PKT, +#else + [DBG_IO_ALLOC_TX_ISO_EMPTY_PKT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ALLOC_TX_ISO_EMPTY_PKT */ + +#if (USE_RT_DEBUG_BIG_FREE_EMPTY_PKTS == 1) + [DBG_IO_BIG_FREE_EMPTY_PKTS] = RT_DEBUG_BIG_FREE_EMPTY_PKTS, +#else + [DBG_IO_BIG_FREE_EMPTY_PKTS] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_BIG_FREE_EMPTY_PKTS */ + +#if (USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_OK == 1) + [DBG_IO_RECOMBINE_UNFRMD_DATA_OK] = RT_DEBUG_RECOMBINE_UNFRMD_DATA_OK, +#else + [DBG_IO_RECOMBINE_UNFRMD_DATA_OK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_OK */ + +#if (USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_CRC == 1) + [DBG_IO_RECOMBINE_UNFRMD_DATA_CRC] = RT_DEBUG_RECOMBINE_UNFRMD_DATA_CRC, +#else + [DBG_IO_RECOMBINE_UNFRMD_DATA_CRC] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_CRC */ + +#if (USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_NoRX == 1) + [DBG_IO_RECOMBINE_UNFRMD_DATA_NoRX] = RT_DEBUG_RECOMBINE_UNFRMD_DATA_NoRX, +#else + [DBG_IO_RECOMBINE_UNFRMD_DATA_NoRX] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_NoRX */ + +#if (USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_TRACE == 1) + [DBG_IO_RECOMBINE_UNFRMD_DATA_TRACE] = RT_DEBUG_RECOMBINE_UNFRMD_DATA_TRACE, +#else + [DBG_IO_RECOMBINE_UNFRMD_DATA_TRACE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RECOMBINE_UNFRMD_DATA_TRACE */ + +#if (USE_RT_DEBUG_ISO_HNDL_SDU == 1) + [DBG_IO_ISO_HNDL_SDU] = RT_DEBUG_ISO_HNDL_SDU, +#else + [DBG_IO_ISO_HNDL_SDU] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ISO_HNDL_SDU */ + +#if (USE_RT_DEBUG_LL_INTF_INIT == 1) + [DBG_IO_LL_INTF_INIT] = RT_DEBUG_LL_INTF_INIT, +#else + [DBG_IO_LL_INTF_INIT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LL_INTF_INIT */ + +#if (USE_RT_DEBUG_DATA_TO_CNTRLR == 1) + [DBG_IO_DATA_TO_CNTRLR] = RT_DEBUG_DATA_TO_CNTRLR, +#else + [DBG_IO_DATA_TO_CNTRLR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_DATA_TO_CNTRLR */ + +#if (USE_RT_DEBUG_FREE_LL_PKT_HNDLR == 1) + [DBG_IO_FREE_LL_PKT_HNDLR] = RT_DEBUG_FREE_LL_PKT_HNDLR, +#else + [DBG_IO_FREE_LL_PKT_HNDLR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_FREE_LL_PKT_HNDLR */ + +#if (USE_RT_DEBUG_PHY_INIT_CLBR_TRACE == 1) + [DBG_IO_PHY_INIT_CLBR_TRACE] = RT_DEBUG_PHY_INIT_CLBR_TRACE, +#else + [DBG_IO_PHY_INIT_CLBR_TRACE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PHY_INIT_CLBR_TRACE */ + +#if (USE_RT_DEBUG_PHY_RUNTIME_CLBR_TRACE == 1) + [DBG_IO_PHY_RUNTIME_CLBR_TRACE] = RT_DEBUG_PHY_RUNTIME_CLBR_TRACE, +#else + [DBG_IO_PHY_RUNTIME_CLBR_TRACE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PHY_RUNTIME_CLBR_TRACE */ + +#if (USE_RT_DEBUG_PHY_CLBR_ISR == 1) + [DBG_IO_PHY_CLBR_ISR] = RT_DEBUG_PHY_CLBR_ISR, +#else + [DBG_IO_PHY_CLBR_ISR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PHY_CLBR_ISR */ + +#if (USE_RT_DEBUG_PHY_INIT_CLBR_SINGLE_CH == 1) + [DBG_IO_PHY_INIT_CLBR_SINGLE_CH] = RT_DEBUG_PHY_INIT_CLBR_SINGLE_CH, +#else + [DBG_IO_PHY_INIT_CLBR_SINGLE_CH] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PHY_INIT_CLBR_SINGLE_CH */ + +#if (USE_RT_DEBUG_PHY_CLBR_STRTD == 1) + [DBG_IO_PHY_CLBR_STRTD] = RT_DEBUG_PHY_CLBR_STRTD, +#else + [DBG_IO_PHY_CLBR_STRTD] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PHY_CLBR_STRTD */ + +#if (USE_RT_DEBUG_PHY_CLBR_EXEC == 1) + [DBG_IO_PHY_CLBR_EXEC] = RT_DEBUG_PHY_CLBR_EXEC, +#else + [DBG_IO_PHY_CLBR_EXEC] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PHY_CLBR_EXEC */ + +#if (USE_RT_DEBUG_RCO_STRT_STOP_RUNTIME_CLBR_ACTV == 1) + [DBG_IO_RCO_STRT_STOP_RUNTIME_CLBR_ACTV] = RT_DEBUG_RCO_STRT_STOP_RUNTIME_CLBR_ACTV, +#else + [DBG_IO_RCO_STRT_STOP_RUNTIME_CLBR_ACTV] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RCO_STRT_STOP_RUNTIME_CLBR_ACTV */ + +#if (USE_RT_DEBUG_RCO_STRT_STOP_RUNTIME_RCO_CLBR == 1) + [DBG_IO_RCO_STRT_STOP_RUNTIME_RCO_CLBR] = RT_DEBUG_RCO_STRT_STOP_RUNTIME_RCO_CLBR, +#else + [DBG_IO_RCO_STRT_STOP_RUNTIME_RCO_CLBR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RCO_STRT_STOP_RUNTIME_RCO_CLBR */ + +#if (USE_RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_SWT == 1) + [DBG_IO_STRT_STOP_RUNTIME_RCO_CLBR_SWT] = RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_SWT, +#else + [DBG_IO_STRT_STOP_RUNTIME_RCO_CLBR_SWT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_SWT */ + +#if (USE_RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_TRACE == 1) + [DBG_IO_STRT_STOP_RUNTIME_RCO_CLBR_TRACE] = RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_TRACE, +#else + [DBG_IO_STRT_STOP_RUNTIME_RCO_CLBR_TRACE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_STRT_STOP_RUNTIME_RCO_CLBR_TRACE */ + +#if (USE_RT_DEBUG_RCO_ISR_TRACE == 1) + [DBG_IO_RCO_ISR_TRACE] = RT_DEBUG_RCO_ISR_TRACE, +#else + [DBG_IO_RCO_ISR_TRACE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RCO_ISR_TRACE */ + +#if (USE_RT_DEBUG_RCO_ISR_COMPENDATE == 1) + [DBG_IO_RCO_ISR_COMPENDATE] = RT_DEBUG_RCO_ISR_COMPENDATE, +#else + [DBG_IO_RCO_ISR_COMPENDATE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RCO_ISR_COMPENDATE */ + +#if (USE_RT_DEBUG_RAL_STRT_TX == 1) + [DBG_IO_RAL_STRT_TX] = RT_DEBUG_RAL_STRT_TX, +#else + [DBG_IO_RAL_STRT_TX] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RAL_STRT_TX */ + +#if (USE_RT_DEBUG_RAL_ISR_TIMER_ERROR == 1) + [DBG_IO_RAL_ISR_TIMER_ERROR] = RT_DEBUG_RAL_ISR_TIMER_ERROR, +#else + [DBG_IO_RAL_ISR_TIMER_ERROR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RAL_ISR_TIMER_ERROR */ + +#if (USE_RT_DEBUG_RAL_ISR_TRACE == 1) + [DBG_IO_RAL_ISR_TRACE] = RT_DEBUG_RAL_ISR_TRACE, +#else + [DBG_IO_RAL_ISR_TRACE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RAL_ISR_TRACE */ + +#if (USE_RT_DEBUG_RAL_STOP_OPRTN == 1) + [DBG_IO_RAL_STOP_OPRTN] = RT_DEBUG_RAL_STOP_OPRTN, +#else + [DBG_IO_RAL_STOP_OPRTN] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RAL_STOP_OPRTN */ + +#if (USE_RT_DEBUG_RAL_STRT_RX == 1) + [DBG_IO_RAL_STRT_RX] = RT_DEBUG_RAL_STRT_RX, +#else + [DBG_IO_RAL_STRT_RX] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RAL_STRT_RX */ + +#if (USE_RT_DEBUG_RAL_DONE_CLBK_TX == 1) + [DBG_IO_RAL_DONE_CLBK_TX] = RT_DEBUG_RAL_DONE_CLBK_TX, +#else + [DBG_IO_RAL_DONE_CLBK_TX] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RAL_DONE_CLBK_TX */ + +#if (USE_RT_DEBUG_RAL_DONE_CLBK_RX == 1) + [DBG_IO_RAL_DONE_CLBK_RX] = RT_DEBUG_RAL_DONE_CLBK_RX, +#else + [DBG_IO_RAL_DONE_CLBK_RX] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RAL_DONE_CLBK_RX */ + +#if (USE_RT_DEBUG_RAL_DONE_CLBK_ED == 1) + [DBG_IO_RAL_DONE_CLBK_ED] = RT_DEBUG_RAL_DONE_CLBK_ED, +#else + [DBG_IO_RAL_DONE_CLBK_ED] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RAL_DONE_CLBK_ED */ + +#if (USE_RT_DEBUG_RAL_ED_SCAN == 1) + [DBG_IO_RAL_ED_SCAN] = RT_DEBUG_RAL_ED_SCAN, +#else + [DBG_IO_RAL_ED_SCAN] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RAL_ED_SCAN */ + +#if (USE_RT_DEBUG_ERROR_MEM_CAP_EXCED == 1) + [DBG_IO_ERROR_MEM_CAP_EXCED] = RT_DEBUG_ERROR_MEM_CAP_EXCED, +#else + [DBG_IO_ERROR_MEM_CAP_EXCED] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ERROR_MEM_CAP_EXCED */ + +#if (USE_RT_DEBUG_ERROR_COMMAND_DISALLOWED == 1) + [DBG_IO_ERROR_COMMAND_DISALLOWED] = RT_DEBUG_ERROR_COMMAND_DISALLOWED, +#else + [DBG_IO_ERROR_COMMAND_DISALLOWED] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ERROR_COMMAND_DISALLOWED */ + +#if (USE_RT_DEBUG_PTA_INIT == 1) + [DBG_IO_PTA_INIT] = RT_DEBUG_PTA_INIT, +#else + [DBG_IO_PTA_INIT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PTA_INIT */ + +#if (USE_RT_DEBUG_PTA_EN == 1) + [DBG_IO_PTA_EN] = RT_DEBUG_PTA_EN, +#else + [DBG_IO_PTA_EN] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PTA_EN */ + +#if (USE_RT_DEBUG_LLHWC_PTA_SET_EN == 1) + [DBG_IO_LLHWC_PTA_SET_EN] = RT_DEBUG_LLHWC_PTA_SET_EN, +#else + [DBG_IO_LLHWC_PTA_SET_EN] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_PTA_SET_EN */ + +#if (USE_RT_DEBUG_LLHWC_PTA_SET_PARAMS == 1) + [DBG_IO_LLHWC_PTA_SET_PARAMS] = RT_DEBUG_LLHWC_PTA_SET_PARAMS, +#else + [DBG_IO_LLHWC_PTA_SET_PARAMS] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_PTA_SET_PARAMS */ + +#if (USE_RT_DEBUG_COEX_STRT_ON_IDLE == 1) + [DBG_IO_COEX_STRT_ON_IDLE] = RT_DEBUG_COEX_STRT_ON_IDLE, +#else + [DBG_IO_COEX_STRT_ON_IDLE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_COEX_STRT_ON_IDLE */ + +#if (USE_RT_DEBUG_COEX_ASK_FOR_AIR == 1) + [DBG_IO_COEX_ASK_FOR_AIR] = RT_DEBUG_COEX_ASK_FOR_AIR, +#else + [DBG_IO_COEX_ASK_FOR_AIR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_COEX_ASK_FOR_AIR */ + +#if (USE_RT_DEBUG_COEX_TIMER_EVNT_CLBK == 1) + [DBG_IO_COEX_TIMER_EVNT_CLBK] = RT_DEBUG_COEX_TIMER_EVNT_CLBK, +#else + [DBG_IO_COEX_TIMER_EVNT_CLBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_COEX_TIMER_EVNT_CLBK */ + +#if (USE_RT_DEBUG_COEX_STRT_ONE_SHOT == 1) + [DBG_IO_COEX_STRT_ONE_SHOT] = RT_DEBUG_COEX_STRT_ONE_SHOT, +#else + [DBG_IO_COEX_STRT_ONE_SHOT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_COEX_STRT_ONE_SHOT */ + +#if (USE_RT_DEBUG_COEX_FORCE_STOP_RX == 1) + [DBG_IO_COEX_FORCE_STOP_RX] = RT_DEBUG_COEX_FORCE_STOP_RX, +#else + [DBG_IO_COEX_FORCE_STOP_RX] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_COEX_FORCE_STOP_RX */ + +#if (USE_RT_DEBUG_LLHWC_ADV_DONE == 1) + [DBG_IO_LLHWC_ADV_DONE] = RT_DEBUG_LLHWC_ADV_DONE, +#else + [DBG_IO_LLHWC_ADV_DONE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_ADV_DONE */ + +#if (USE_RT_DEBUG_LLHWC_SCN_DONE == 1) + [DBG_IO_LLHWC_SCN_DONE] = RT_DEBUG_LLHWC_SCN_DONE, +#else + [DBG_IO_LLHWC_SCN_DONE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_SCN_DONE */ + +#if (USE_RT_DEBUG_LLHWC_INIT_DONE == 1) + [DBG_IO_LLHWC_INIT_DONE] = RT_DEBUG_LLHWC_INIT_DONE, +#else + [DBG_IO_LLHWC_INIT_DONE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_INIT_DONE */ + +#if (USE_RT_DEBUG_LLHWC_CONN_DONE == 1) + [DBG_IO_LLHWC_CONN_DONE] = RT_DEBUG_LLHWC_CONN_DONE, +#else + [DBG_IO_LLHWC_CONN_DONE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_CONN_DONE */ + +#if (USE_RT_DEBUG_LLHWC_CIG_DONE == 1) + [DBG_IO_LLHWC_CIG_DONE] = RT_DEBUG_LLHWC_CIG_DONE, +#else + [DBG_IO_LLHWC_CIG_DONE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_CIG_DONE */ + +#if (USE_RT_DEBUG_LLHWC_BIG_DONE == 1) + [DBG_IO_LLHWC_BIG_DONE] = RT_DEBUG_LLHWC_BIG_DONE, +#else + [DBG_IO_LLHWC_BIG_DONE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_BIG_DONE */ + +#if (USE_RT_DEBUG_OS_TMR_CREATE == 1) + [DBG_IO_OS_TMR_CREATE] = RT_DEBUG_OS_TMR_CREATE, +#else + [DBG_IO_OS_TMR_CREATE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_OS_TMR_CREATE */ + +#if (USE_RT_DEBUG_ADV_EXT_TIMEOUT_CBK == 1) + [DBG_IO_ADV_EXT_TIMEOUT_CBK] = RT_DEBUG_ADV_EXT_TIMEOUT_CBK, +#else + [DBG_IO_ADV_EXT_TIMEOUT_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADV_EXT_TIMEOUT_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_SCN_DUR_CBK == 1) + [DBG_IO_ADV_EXT_SCN_DUR_CBK] = RT_DEBUG_ADV_EXT_SCN_DUR_CBK, +#else + [DBG_IO_ADV_EXT_SCN_DUR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADV_EXT_SCN_DUR_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_SCN_PERIOD_CBK == 1) + [DBG_IO_ADV_EXT_SCN_PERIOD_CBK] = RT_DEBUG_ADV_EXT_SCN_PERIOD_CBK, +#else + [DBG_IO_ADV_EXT_SCN_PERIOD_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADV_EXT_SCN_PERIOD_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_PRDC_SCN_TIMEOUT_CBK == 1) + [DBG_IO_ADV_EXT_PRDC_SCN_TIMEOUT_CBK] = RT_DEBUG_ADV_EXT_PRDC_SCN_TIMEOUT_CBK, +#else + [DBG_IO_ADV_EXT_PRDC_SCN_TIMEOUT_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADV_EXT_PRDC_SCN_TIMEOUT_CBK */ + +#if (USE_RT_DEBUG_BIS_SYNC_TIMEOUT_TMR_CBK == 1) + [DBG_IO_BIS_SYNC_TIMEOUT_TMR_CBK] = RT_DEBUG_BIS_SYNC_TIMEOUT_TMR_CBK, +#else + [DBG_IO_BIS_SYNC_TIMEOUT_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_BIS_SYNC_TIMEOUT_TMR_CBK */ + +#if (USE_RT_DEBUG_BIS_TERM_TMR_CBK == 1) + [DBG_IO_BIS_TERM_TMR_CBK] = RT_DEBUG_BIS_TERM_TMR_CBK, +#else + [DBG_IO_BIS_TERM_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_BIS_TERM_TMR_CBK */ + +#if (USE_RT_DEBUG_BIS_TST_MODE_CBK == 1) + [DBG_IO_BIS_TST_MODE_CBK] = RT_DEBUG_BIS_TST_MODE_CBK, +#else + [DBG_IO_BIS_TST_MODE_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_BIS_TST_MODE_CBK */ + +#if (USE_RT_DEBUG_BIS_TST_MODE_TMR_CBK == 1) + [DBG_IO_BIS_TST_MODE_TMR_CBK] = RT_DEBUG_BIS_TST_MODE_TMR_CBK, +#else + [DBG_IO_BIS_TST_MODE_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_BIS_TST_MODE_TMR_CBK */ + +#if (USE_RT_DEBUG_ISO_POST_TMR_CBK == 1) + [DBG_IO_ISO_POST_TMR_CBK] = RT_DEBUG_ISO_POST_TMR_CBK, +#else + [DBG_IO_ISO_POST_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ISO_POST_TMR_CBK */ + +#if (USE_RT_DEBUG_ISO_TST_MODE_TMR_CBK == 1) + [DBG_IO_ISO_TST_MODE_TMR_CBK] = RT_DEBUG_ISO_TST_MODE_TMR_CBK, +#else + [DBG_IO_ISO_TST_MODE_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ISO_TST_MODE_TMR_CBK */ + +#if (USE_RT_DEBUG_CONN_POST_TMR_CBK == 1) + [DBG_IO_CONN_POST_TMR_CBK] = RT_DEBUG_CONN_POST_TMR_CBK, +#else + [DBG_IO_CONN_POST_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_CONN_POST_TMR_CBK */ + +#if (USE_RT_DEBUG_EVNT_SCHDLR_TMR_CBK == 1) + [DBG_IO_EVNT_SCHDLR_TMR_CBK] = RT_DEBUG_EVNT_SCHDLR_TMR_CBK, +#else + [DBG_IO_EVNT_SCHDLR_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_EVNT_SCHDLR_TMR_CBK */ + +#if (USE_RT_DEBUG_HCI_POST_TMR_CBK == 1) + [DBG_IO_HCI_POST_TMR_CBK] = RT_DEBUG_HCI_POST_TMR_CBK, +#else + [DBG_IO_HCI_POST_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_HCI_POST_TMR_CBK */ + +#if (USE_RT_DEBUG_LLCP_POST_TMR_CBK == 1) + [DBG_IO_LLCP_POST_TMR_CBK] = RT_DEBUG_LLCP_POST_TMR_CBK, +#else + [DBG_IO_LLCP_POST_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLCP_POST_TMR_CBK */ + +#if (USE_RT_DEBUG_LLHWC_ENRGY_DETECT_CBK == 1) + [DBG_IO_LLHWC_ENRGY_DETECT_CBK] = RT_DEBUG_LLHWC_ENRGY_DETECT_CBK, +#else + [DBG_IO_LLHWC_ENRGY_DETECT_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_ENRGY_DETECT_CBK */ + +#if (USE_RT_DEBUG_PRVCY_POST_TMR_CBK == 1) + [DBG_IO_PRVCY_POST_TMR_CBK] = RT_DEBUG_PRVCY_POST_TMR_CBK, +#else + [DBG_IO_PRVCY_POST_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PRVCY_POST_TMR_CBK */ + +#if (USE_RT_DEBUG_ANT_PRPR_TMR_CBK == 1) + [DBG_IO_ANT_PRPR_TMR_CBK] = RT_DEBUG_ANT_PRPR_TMR_CBK, +#else + [DBG_IO_ANT_PRPR_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ANT_PRPR_TMR_CBK */ + +#if (USE_RT_DEBUG_COEX_TMR_FRC_STOP_AIR_GRANT_CBK == 1) + [DBG_IO_COEX_TMR_FRC_STOP_AIR_GRANT_CBK] = RT_DEBUG_COEX_TMR_FRC_STOP_AIR_GRANT_CBK, +#else + [DBG_IO_COEX_TMR_FRC_STOP_AIR_GRANT_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_COEX_TMR_FRC_STOP_AIR_GRANT_CBK */ + +#if (USE_RT_DEBUG_MLME_RX_EN_TMR_CBK == 1) + [DBG_IO_MLME_RX_EN_TMR_CBK] = RT_DEBUG_MLME_RX_EN_TMR_CBK, +#else + [DBG_IO_MLME_RX_EN_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_MLME_RX_EN_TMR_CBK */ + +#if (USE_RT_DEBUG_MLME_GNRC_TMR_CBK == 1) + [DBG_IO_MLME_GNRC_TMR_CBK] = RT_DEBUG_MLME_GNRC_TMR_CBK, +#else + [DBG_IO_MLME_GNRC_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_MLME_GNRC_TMR_CBK */ + +#if (USE_RT_DEBUG_MIB_JOIN_LST_TMR_CBK == 1) + [DBG_IO_MIB_JOIN_LST_TMR_CBK] = RT_DEBUG_MIB_JOIN_LST_TMR_CBK, +#else + [DBG_IO_MIB_JOIN_LST_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_MIB_JOIN_LST_TMR_CBK */ + +#if (USE_RT_DEBUG_MLME_PWR_PRES_TMR_CBK == 1) + [DBG_IO_MLME_PWR_PRES_TMR_CBK] = RT_DEBUG_MLME_PWR_PRES_TMR_CBK, +#else + [DBG_IO_MLME_PWR_PRES_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_MLME_PWR_PRES_TMR_CBK */ + +#if (USE_RT_DEBUG_PRESISTENCE_TMR_CBK == 1) + [DBG_IO_PRESISTENCE_TMR_CBK] = RT_DEBUG_PRESISTENCE_TMR_CBK, +#else + [DBG_IO_PRESISTENCE_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PRESISTENCE_TMR_CBK */ + +#if (USE_RT_DEBUG_RADIO_PHY_PRDC_CLBK_TMR_CBK == 1) + [DBG_IO_RADIO_PHY_PRDC_CLBK_TMR_CBK] = RT_DEBUG_RADIO_PHY_PRDC_CLBK_TMR_CBK, +#else + [DBG_IO_RADIO_PHY_PRDC_CLBK_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RADIO_PHY_PRDC_CLBK_TMR_CBK */ + +#if (USE_RT_DEBUG_RADIO_CSMA_TMR_CBK == 1) + [DBG_IO_RADIO_CSMA_TMR_CBK] = RT_DEBUG_RADIO_CSMA_TMR_CBK, +#else + [DBG_IO_RADIO_CSMA_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RADIO_CSMA_TMR_CBK */ + +#if (USE_RT_DEBUG_RADIO_CSL_RCV_TMR_CBK == 1) + [DBG_IO_RADIO_CSL_RCV_TMR_CBK] = RT_DEBUG_RADIO_CSL_RCV_TMR_CBK, +#else + [DBG_IO_RADIO_CSL_RCV_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RADIO_CSL_RCV_TMR_CBK */ + +#if (USE_RT_DEBUG_ED_TMR_CBK == 1) + [DBG_IO_ED_TMR_CBK] = RT_DEBUG_ED_TMR_CBK, +#else + [DBG_IO_ED_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ED_TMR_CBK */ + +#if (USE_RT_DEBUG_DIO_EXT_TMR_CBK == 1) + [DBG_IO_DIO_EXT_TMR_CBK] = RT_DEBUG_DIO_EXT_TMR_CBK, +#else + [DBG_IO_DIO_EXT_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_DIO_EXT_TMR_CBK */ + +#if (USE_RT_DEBUG_RCO_CLBR_TMR_CBK == 1) + [DBG_IO_RCO_CLBR_TMR_CBK] = RT_DEBUG_RCO_CLBR_TMR_CBK, +#else + [DBG_IO_RCO_CLBR_TMR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RCO_CLBR_TMR_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_ADV_CBK == 1) + [DBG_IO_ADV_EXT_MNGR_ADV_CBK] = RT_DEBUG_ADV_EXT_MNGR_ADV_CBK, +#else + [DBG_IO_ADV_EXT_MNGR_ADV_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_ADV_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_SCN_CBK == 1) + [DBG_IO_ADV_EXT_MNGR_SCN_CBK] = RT_DEBUG_ADV_EXT_MNGR_SCN_CBK, +#else + [DBG_IO_ADV_EXT_MNGR_SCN_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_SCN_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_SCN_ERR_CBK == 1) + [DBG_IO_ADV_EXT_MNGR_SCN_ERR_CBK] = RT_DEBUG_ADV_EXT_MNGR_SCN_ERR_CBK, +#else + [DBG_IO_ADV_EXT_MNGR_SCN_ERR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_SCN_ERR_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CBK == 1) + [DBG_IO_ADV_EXT_MNGR_PRDC_SCN_CBK] = RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CBK, +#else + [DBG_IO_ADV_EXT_MNGR_PRDC_SCN_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK == 1) + [DBG_IO_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK] = RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK, +#else + [DBG_IO_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_ERR_CBK */ + +#if (USE_RT_DEBUG_BIG_ADV_CBK == 1) + [DBG_IO_BIG_ADV_CBK] = RT_DEBUG_BIG_ADV_CBK, +#else + [DBG_IO_BIG_ADV_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_BIG_ADV_CBK */ + +#if (USE_RT_DEBUG_BIG_ADV_ERR_CBK == 1) + [DBG_IO_BIG_ADV_ERR_CBK] = RT_DEBUG_BIG_ADV_ERR_CBK, +#else + [DBG_IO_BIG_ADV_ERR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_BIG_ADV_ERR_CBK */ + +#if (USE_RT_DEBUG_BIG_SYNC_CBK == 1) + [DBG_IO_BIG_SYNC_CBK] = RT_DEBUG_BIG_SYNC_CBK, +#else + [DBG_IO_BIG_SYNC_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_BIG_SYNC_CBK */ + +#if (USE_RT_DEBUG_BIG_SYNC_ERR_CBK == 1) + [DBG_IO_BIG_SYNC_ERR_CBK] = RT_DEBUG_BIG_SYNC_ERR_CBK, +#else + [DBG_IO_BIG_SYNC_ERR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_BIG_SYNC_ERR_CBK */ + +#if (USE_RT_DEBUG_ISO_CIS_PKT_TRNSM_RECEIVED_CBK == 1) + [DBG_IO_ISO_CIS_PKT_TRNSM_RECEIVED_CBK] = RT_DEBUG_ISO_CIS_PKT_TRNSM_RECEIVED_CBK, +#else + [DBG_IO_ISO_CIS_PKT_TRNSM_RECEIVED_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ISO_CIS_PKT_TRNSM_RECEIVED_CBK */ + +#if (USE_RT_DEBUG_ISO_CIG_ERR_CBK == 1) + [DBG_IO_ISO_CIG_ERR_CBK] = RT_DEBUG_ISO_CIG_ERR_CBK, +#else + [DBG_IO_ISO_CIG_ERR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ISO_CIG_ERR_CBK */ + +#if (USE_RT_DEBUG_CONN_PKT_TRNSM_RECEIVED_CBK == 1) + [DBG_IO_CONN_PKT_TRNSM_RECEIVED_CBK] = RT_DEBUG_CONN_PKT_TRNSM_RECEIVED_CBK, +#else + [DBG_IO_CONN_PKT_TRNSM_RECEIVED_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_CONN_PKT_TRNSM_RECEIVED_CBK */ + +#if (USE_RT_DEBUG_PRDC_CLBR_EXTRL_CBK == 1) + [DBG_IO_PRDC_CLBR_EXTRL_CBK] = RT_DEBUG_PRDC_CLBR_EXTRL_CBK, +#else + [DBG_IO_PRDC_CLBR_EXTRL_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PRDC_CLBR_EXTRL_CBK */ + +#if (USE_RT_DEBUG_PTR_PRDC_ADV_SYNC_CBK == 1) + [DBG_IO_PTR_PRDC_ADV_SYNC_CBK] = RT_DEBUG_PTR_PRDC_ADV_SYNC_CBK, +#else + [DBG_IO_PTR_PRDC_ADV_SYNC_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PTR_PRDC_ADV_SYNC_CBK */ + +#if (USE_RT_DEBUG_NCONN_SCN_CBK == 1) + [DBG_IO_NCONN_SCN_CBK] = RT_DEBUG_NCONN_SCN_CBK, +#else + [DBG_IO_NCONN_SCN_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_NCONN_SCN_CBK */ + +#if (USE_RT_DEBUG_NCONN_ADV_CBK == 1) + [DBG_IO_NCONN_ADV_CBK] = RT_DEBUG_NCONN_ADV_CBK, +#else + [DBG_IO_NCONN_ADV_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_NCONN_ADV_CBK */ + +#if (USE_RT_DEBUG_NCONN_INIT_CBK == 1) + [DBG_IO_NCONN_INIT_CBK] = RT_DEBUG_NCONN_INIT_CBK, +#else + [DBG_IO_NCONN_INIT_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_NCONN_INIT_CBK */ + +#if (USE_RT_DEBUG_ANT_RADIO_CMPLT_EVNT_CBK == 1) + [DBG_IO_ANT_RADIO_CMPLT_EVNT_CBK] = RT_DEBUG_ANT_RADIO_CMPLT_EVNT_CBK, +#else + [DBG_IO_ANT_RADIO_CMPLT_EVNT_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ANT_RADIO_CMPLT_EVNT_CBK */ + +#if (USE_RT_DEBUG_ANT_STACK_EVNT_CBK == 1) + [DBG_IO_ANT_STACK_EVNT_CBK] = RT_DEBUG_ANT_STACK_EVNT_CBK, +#else + [DBG_IO_ANT_STACK_EVNT_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ANT_STACK_EVNT_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_PROCESS_TMOUT_EVNT_CBK == 1) + [DBG_IO_ADV_EXT_PROCESS_TMOUT_EVNT_CBK] = RT_DEBUG_ADV_EXT_PROCESS_TMOUT_EVNT_CBK, +#else + [DBG_IO_ADV_EXT_PROCESS_TMOUT_EVNT_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADV_EXT_PROCESS_TMOUT_EVNT_CBK */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_SCN_DUR_EVNT == 1) + [DBG_IO_ADV_EXT_MNGR_SCN_DUR_EVNT] = RT_DEBUG_ADV_EXT_MNGR_SCN_DUR_EVNT, +#else + [DBG_IO_ADV_EXT_MNGR_SCN_DUR_EVNT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_SCN_DUR_EVNT */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_SCN_PERIODIC_EVNT == 1) + [DBG_IO_ADV_EXT_MNGR_SCN_PERIODIC_EVNT] = RT_DEBUG_ADV_EXT_MNGR_SCN_PERIODIC_EVNT, +#else + [DBG_IO_ADV_EXT_MNGR_SCN_PERIODIC_EVNT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_SCN_PERIODIC_EVNT */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT == 1) + [DBG_IO_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT] = RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT, +#else + [DBG_IO_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_TMOUT_EVNT */ + +#if (USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT == 1) + [DBG_IO_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT] = RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT, +#else + [DBG_IO_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ADV_EXT_MNGR_PRDC_SCN_CNCEL_EVNT */ + +#if (USE_RT_DEBUG_BIS_MNGR_BIG_TERM_CBK == 1) + [DBG_IO_BIS_MNGR_BIG_TERM_CBK] = RT_DEBUG_BIS_MNGR_BIG_TERM_CBK, +#else + [DBG_IO_BIS_MNGR_BIG_TERM_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_BIS_MNGR_BIG_TERM_CBK */ + +#if (USE_RT_DEBUG_BIS_MNGR_SYNC_TMOUT_CBK == 1) + [DBG_IO_BIS_MNGR_SYNC_TMOUT_CBK] = RT_DEBUG_BIS_MNGR_SYNC_TMOUT_CBK, +#else + [DBG_IO_BIS_MNGR_SYNC_TMOUT_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_BIS_MNGR_SYNC_TMOUT_CBK */ + +#if (USE_RT_DEBUG_ISOAL_MNGR_SDU_GEN == 1) + [DBG_IO_ISOAL_MNGR_SDU_GEN] = RT_DEBUG_ISOAL_MNGR_SDU_GEN, +#else + [DBG_IO_ISOAL_MNGR_SDU_GEN] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ISOAL_MNGR_SDU_GEN */ + +#if (USE_RT_DEBUG_ISO_MNGR_CIS_PROCESS_EVNT_CBK == 1) + [DBG_IO_ISO_MNGR_CIS_PROCESS_EVNT_CBK] = RT_DEBUG_ISO_MNGR_CIS_PROCESS_EVNT_CBK, +#else + [DBG_IO_ISO_MNGR_CIS_PROCESS_EVNT_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ISO_MNGR_CIS_PROCESS_EVNT_CBK */ + +#if (USE_RT_DEBUG_CONN_MNGR_PROCESS_EVNT_CLBK == 1) + [DBG_IO_CONN_MNGR_PROCESS_EVNT_CLBK] = RT_DEBUG_CONN_MNGR_PROCESS_EVNT_CLBK, +#else + [DBG_IO_CONN_MNGR_PROCESS_EVNT_CLBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_CONN_MNGR_PROCESS_EVNT_CLBK */ + +#if (USE_RT_DEBUG_CONN_MNGR_UPDT_CONN_PARAM_CBK == 1) + [DBG_IO_CONN_MNGR_UPDT_CONN_PARAM_CBK] = RT_DEBUG_CONN_MNGR_UPDT_CONN_PARAM_CBK, +#else + [DBG_IO_CONN_MNGR_UPDT_CONN_PARAM_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_CONN_MNGR_UPDT_CONN_PARAM_CBK */ + +#if (USE_RT_DEBUG_EVNT_SCHDLR_HW_EVNT_CMPLT == 1) + [DBG_IO_EVNT_SCHDLR_HW_EVNT_CMPLT] = RT_DEBUG_EVNT_SCHDLR_HW_EVNT_CMPLT, +#else + [DBG_IO_EVNT_SCHDLR_HW_EVNT_CMPLT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_EVNT_SCHDLR_HW_EVNT_CMPLT */ + +#if (USE_RT_DEBUG_HCI_EVENT_HNDLR == 1) + [DBG_IO_HCI_EVENT_HNDLR] = RT_DEBUG_HCI_EVENT_HNDLR, +#else + [DBG_IO_HCI_EVENT_HNDLR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_HCI_EVENT_HNDLR */ + +#if (USE_RT_DEBUG_MLME_TMRS_CBK == 1) + [DBG_IO_MLME_TMRS_CBK] = RT_DEBUG_MLME_TMRS_CBK, +#else + [DBG_IO_MLME_TMRS_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_MLME_TMRS_CBK */ + +#if (USE_RT_DEBUG_DIRECT_TX_EVNT_CBK == 1) + [DBG_IO_DIRECT_TX_EVNT_CBK] = RT_DEBUG_DIRECT_TX_EVNT_CBK, +#else + [DBG_IO_DIRECT_TX_EVNT_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_DIRECT_TX_EVNT_CBK */ + +#if (USE_RT_DEBUG_INDIRECT_PKT_TOUR_CBK == 1) + [DBG_IO_INDIRECT_PKT_TOUR_CBK] = RT_DEBUG_INDIRECT_PKT_TOUR_CBK, +#else + [DBG_IO_INDIRECT_PKT_TOUR_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_INDIRECT_PKT_TOUR_CBK */ + +#if (USE_RT_DEBUG_RADIO_CSMA_TMR == 1) + [DBG_IO_RADIO_CSMA_TMR] = RT_DEBUG_RADIO_CSMA_TMR, +#else + [DBG_IO_RADIO_CSMA_TMR] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RADIO_CSMA_TMR */ + +#if (USE_RT_DEBUG_RAL_SM_DONE_EVNT_CBK == 1) + [DBG_IO_RAL_SM_DONE_EVNT_CBK] = RT_DEBUG_RAL_SM_DONE_EVNT_CBK, +#else + [DBG_IO_RAL_SM_DONE_EVNT_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RAL_SM_DONE_EVNT_CBK */ + +#if (USE_RT_DEBUG_ED_TMR_HNDL == 1) + [DBG_IO_ED_TMR_HNDL] = RT_DEBUG_ED_TMR_HNDL, +#else + [DBG_IO_ED_TMR_HNDL] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_ED_TMR_HNDL */ + +#if (USE_RT_DEBUG_OS_TMR_EVNT_CBK == 1) + [DBG_IO_OS_TMR_EVNT_CBK] = RT_DEBUG_OS_TMR_EVNT_CBK, +#else + [DBG_IO_OS_TMR_EVNT_CBK] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_OS_TMR_EVNT_CBK */ + +#if (USE_RT_DEBUG_PROFILE_MARKER_PHY_WAKEUP_TIME == 1) + [DBG_IO_PROFILE_MARKER_PHY_WAKEUP_TIME] = RT_DEBUG_PROFILE_MARKER_PHY_WAKEUP_TIME, +#else + [DBG_IO_PROFILE_MARKER_PHY_WAKEUP_TIME] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PROFILE_MARKER_PHY_WAKEUP_TIME */ + +#if (USE_RT_DEBUG_PROFILE_END_DRIFT_TIME == 1) + [DBG_IO_PROFILE_END_DRIFT_TIME] = RT_DEBUG_PROFILE_END_DRIFT_TIME, +#else + [DBG_IO_PROFILE_END_DRIFT_TIME] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PROFILE_END_DRIFT_TIME */ + +#if (USE_RT_DEBUG_PROC_RADIO_RCV == 1) + [DBG_IO_PROC_RADIO_RCV] = RT_DEBUG_PROC_RADIO_RCV, +#else + [DBG_IO_PROC_RADIO_RCV] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PROC_RADIO_RCV */ + +#if (USE_RT_DEBUG_EVNT_TIME_UPDT == 1) + [DBG_IO_EVNT_TIME_UPDT] = RT_DEBUG_EVNT_TIME_UPDT, +#else + [DBG_IO_EVNT_TIME_UPDT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_EVNT_TIME_UPDT */ + +#if (USE_RT_DEBUG_MAC_RECEIVE_DONE == 1) + [DBG_IO_MAC_RECEIVE_DONE] = RT_DEBUG_MAC_RECEIVE_DONE, +#else + [DBG_IO_MAC_RECEIVE_DONE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_MAC_RECEIVE_DONE */ + +#if (USE_RT_DEBUG_MAC_TX_DONE == 1) + [DBG_IO_MAC_TX_DONE] = RT_DEBUG_MAC_TX_DONE, +#else + [DBG_IO_MAC_TX_DONE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_MAC_TX_DONE */ + +#if (USE_RT_DEBUG_RADIO_APPLY_CSMA == 1) + [DBG_IO_RADIO_APPLY_CSMA] = RT_DEBUG_RADIO_APPLY_CSMA, +#else + [DBG_IO_RADIO_APPLY_CSMA] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RADIO_APPLY_CSMA */ + +#if (USE_RT_DEBUG_RADIO_TRANSMIT == 1) + [DBG_IO_RADIO_TRANSMIT] = RT_DEBUG_RADIO_TRANSMIT, +#else + [DBG_IO_RADIO_TRANSMIT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RADIO_TRANSMIT */ + +#if (USE_RT_DEBUG_PROC_RADIO_TX == 1) + [DBG_IO_PROC_RADIO_TX] = RT_DEBUG_PROC_RADIO_TX, +#else + [DBG_IO_PROC_RADIO_TX] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_PROC_RADIO_TX */ + +#if (USE_RT_DEBUG_RAL_TX_DONE == 1) + [DBG_IO_RAL_TX_DONE] = RT_DEBUG_RAL_TX_DONE, +#else + [DBG_IO_RAL_TX_DONE] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RAL_TX_DONE */ + +#if (USE_RT_DEBUG_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT == 1) + [DBG_IO_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT] = RT_DEBUG_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT, +#else + [DBG_IO_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RAL_TX_DONE_INCREMENT_BACKOFF_COUNT */ + +#if (USE_RT_DEBUG_RAL_TX_DONE_RST_BACKOFF_COUNT == 1) + [DBG_IO_RAL_TX_DONE_RST_BACKOFF_COUNT] = RT_DEBUG_RAL_TX_DONE_RST_BACKOFF_COUNT, +#else + [DBG_IO_RAL_TX_DONE_RST_BACKOFF_COUNT] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RAL_TX_DONE_RST_BACKOFF_COUNT */ + +#if (USE_RT_DEBUG_RAL_CONTINUE_RX == 1) + [DBG_IO_RAL_CONTINUE_RX] = RT_DEBUG_RAL_CONTINUE_RX, +#else + [DBG_IO_RAL_CONTINUE_RX] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RAL_CONTINUE_RX */ + +#if (USE_RT_DEBUG_RAL_PERFORM_CCA == 1) + [DBG_IO_RAL_PERFORM_CCA] = RT_DEBUG_RAL_PERFORM_CCA, +#else + [DBG_IO_RAL_PERFORM_CCA] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RAL_PERFORM_CCA */ + +#if (USE_RT_DEBUG_RAL_ENABLE_TRANSMITTER == 1) + [DBG_IO_RAL_ENABLE_TRANSMITTER] = RT_DEBUG_RAL_ENABLE_TRANSMITTER, +#else + [DBG_IO_RAL_ENABLE_TRANSMITTER] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_RAL_ENABLE_TRANSMITTER */ + +#if (USE_RT_DEBUG_LLHWC_GET_CH_IDX_ALGO_2 == 1) + [DBG_IO_LLHWC_GET_CH_IDX_ALGO_2] = RT_DEBUG_LLHWC_GET_CH_IDX_ALGO_2, +#else + [DBG_IO_LLHWC_GET_CH_IDX_ALGO_2] = RT_DEBUG_SIGNAL_UNUSED, +#endif /* USE_RT_DEBUG_LLHWC_GET_CH_IDX_ALGO_2 */ +}; + +#endif /* CFG_RT_DEBUG_GPIO_MODULE */ + +#endif /* LOCAL_DEBUG_TABLES_H*/ diff --git a/lib/stm32wba/hci/log_module.c b/lib/stm32wba/hci/log_module.c new file mode 100644 index 000000000..269bbcb45 --- /dev/null +++ b/lib/stm32wba/hci/log_module.c @@ -0,0 +1,318 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file log_module.c + * @author MCD Application Team + * @brief Source file of the log module. + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Includes ------------------------------------------------------------------*/ +#include /* vsnprintf */ + +#include "app_conf.h" +#include "log_module.h" +#include "stm32_adv_trace.h" +#include "utilities_conf.h" + +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* Private typedef -----------------------------------------------------------*/ +/* USER CODE BEGIN PTD */ + +/* USER CODE END PTD */ + +/* Private define ------------------------------------------------------------*/ +/* Definition of 'End Of Line' */ +#define ENDOFLINE_SIZE 0x01u +#define ENDOFLINE_CHAR '\n' +/* USER CODE BEGIN PD */ + +/* USER CODE END PD */ + +/* Private macro -------------------------------------------------------------*/ +/* USER CODE BEGIN PM */ + +/* USER CODE END PM */ + +/* Exported constants --------------------------------------------------------*/ +/* Global const struct variables to make the life of the user easier */ +const Log_Module_t LOG_MODULE_DEFAULT_CONFIGURATION = +{ + .verbose_level = LOG_VERBOSE_ERROR, + .region = LOG_REGION_ALL_REGIONS +}; +const Log_Verbose_Level_t LOG_VERBOSE_DEFAULT = LOG_VERBOSE_ERROR; +const Log_Region_t LOG_REGION_MASK_DEFAULT = LOG_REGION_ALL_REGIONS; +const Log_Color_t LOG_COLOR_DEFAULT_CONFIGURATION[] = +{ + LOG_COLOR_CODE_DEFAULT, // For Region BLE + LOG_COLOR_CODE_DEFAULT, // For Region System + LOG_COLOR_CODE_DEFAULT, // For Region APP + LOG_COLOR_CODE_RED, // For Region LinkLayer + LOG_COLOR_CODE_YELLOW, // For Region MAC + LOG_COLOR_CODE_GREEN, // For Region Zigbee + LOG_COLOR_CODE_GREEN, // For Region Thread + LOG_COLOR_CODE_DEFAULT, // For Region RTOS +}; + +/* USER CODE BEGIN EC */ + +/* USER CODE END EC */ + +/* Private variables ---------------------------------------------------------*/ +uint32_t lLogCurrentRegionMask; +Log_Verbose_Level_t eLogCurrentVerboseLevel; +Log_Color_t eLogCurrentColorList[32]; +CallBack_TimeStamp * pLogTimeStampFunc; + +/* USER CODE BEGIN PV */ + +/* USER CODE END PV */ + +/* Private function prototypes -----------------------------------------------*/ +static uint32_t Get_Region_Mask(Log_Region_t region); + +/* USER CODE BEGIN PFP */ + +/* USER CODE END PFP */ + +/* Functions Definition ------------------------------------------------------*/ + +#if ( LOG_INSERT_COLOR_INSIDE_THE_TRACE != 0 ) + +/** + * @brief Add the color (in function of Region) on the start of Log sentence. + * + * @param szBuffer Pointer on Log buffer + * @param eRegion Region of Log (listed in Log_Region_t) + * + * @return Length of the new Log. + */ +static uint16_t RegionToColor( char * szBuffer, Log_Region_t eRegion ) +{ + uint16_t iLength = 0; + Log_Color_t eColor; + static Log_Color_t ePreviousColor = LOG_COLOR_NONE; + + if ( eRegion != LOG_MODULE_ALL_REGION_MASK ) + { + eColor = eLogCurrentColorList[eRegion]; + } + else + { + eColor = LOG_COLOR_CODE_DEFAULT; + } + + /* Insert Color code only if previous is not the same */ + if ( eColor != ePreviousColor ) + { + if ( eColor == LOG_COLOR_CODE_DEFAULT ) + { sprintf( szBuffer, "\x1b[0m" ); } + else + { sprintf( szBuffer, "\x1b[0;%02dm", eColor ); } + + ePreviousColor = eColor; + iLength = strlen( szBuffer ); + } + + return( iLength ); +} + +#endif /* LOG_INSERT_COLOR_INSIDE_THE_TRACE */ + +/** + * + */ +void Log_Module_PrintWithArg( Log_Verbose_Level_t eVerboseLevel, Log_Region_t eRegion, const char * pText, va_list args ) +{ + uint16_t iTempSize, iBuffSize = 0u; + char szFullText[UTIL_ADV_TRACE_TMP_BUF_SIZE]; + + /** + * This user section can be used to insert a guard clauses design pattern + * if you want to modify how is handled the verbose. + * E.g. By sewwlecting ERROR, you only want ERROR logs and not ERROR + INFO logs. + * + * Example of how to do it : + * + * // If the log Level isn't matching the configured one, then we don't log, + * // excepted for LOG_VERBOSE_ALL_LOGS where we log in all cases. + * uint8_t current_verbose = UTIL_ADV_TRACE_GetVerboseLevel(); + * if ((log_configuration.verbose_level != current_verbose) && (current_verbose != (uint8_t)LOG_VERBOSE_ALL_LOGS)) { return; } + */ + /* USER CODE BEGIN Log_Module_PrintWithArg_1 */ + + /* USER CODE END Log_Module_PrintWithArg_1 */ + + /* Check verbose level */ + if ( eVerboseLevel > eLogCurrentVerboseLevel ) + { + return; + } + + /* Check Region */ + if ( ( Get_Region_Mask( eRegion ) & lLogCurrentRegionMask ) == 0u ) + { + return; + } + +#if ( LOG_INSERT_COLOR_INSIDE_THE_TRACE != 0 ) + /* Add Color in function of Region */ + iTempSize = RegionToColor( &szFullText[iBuffSize], eRegion ); + iBuffSize += iTempSize; +#endif /* LOG_INSERT_COLOR_INSIDE_THE_TRACE */ + +#if ( LOG_INSERT_TIME_STAMP_INSIDE_THE_TRACE != 0 ) + if ( pLogTimeStampFunc != NULL ) + { + pLogTimeStampFunc( &szFullText[iBuffSize], &iTempSize ); + iBuffSize += iTempSize; + } +#endif /* LOG_INSERT_TIME_STAMP_INSIDE_THE_TRACE */ + + /* Copy the data */ + iTempSize = (uint16_t)UTIL_ADV_TRACE_VSNPRINTF( &szFullText[iBuffSize], ( UTIL_ADV_TRACE_TMP_BUF_SIZE - iBuffSize ), pText, args ); + iBuffSize += iTempSize; + + /* USER CODE BEGIN Log_Module_PrintWithArg_2 */ + + /* USER CODE END Log_Module_PrintWithArg_2 */ + +#if ( LOG_INSERT_EOL_INSIDE_THE_TRACE != 0 ) + /* Add End Of Line if needed */ + if ( ( szFullText[iBuffSize - 1] != ENDOFLINE_CHAR ) && ( szFullText[iBuffSize - 2] != ENDOFLINE_CHAR ) ) + { + szFullText[iBuffSize++] = ENDOFLINE_CHAR; + szFullText[iBuffSize] = 0; + } +#endif /* LOG_INSERT_EOL_INSIDE_THE_TRACE */ + + /* Send full_text to ADV Traces */ + UTIL_ADV_TRACE_Send( (const uint8_t *)szFullText, iBuffSize ); +} + +/** + * + */ +void Log_Module_Print( Log_Verbose_Level_t eVerboseLevel, Log_Region_t eRegion, const char * pText, ...) +{ +#if (CFG_LOG_SUPPORTED != 0) + va_list variadic_args; + + va_start( variadic_args, pText ); + Log_Module_PrintWithArg( eVerboseLevel, eRegion, pText, variadic_args ); + va_end( variadic_args ); +#else /* (CFG_LOG_SUPPORTED != 0) */ + UNUSED(eVerboseLevel); + UNUSED(eRegion); + UNUSED(pText); +#endif /* (CFG_LOG_SUPPORTED != 0) */ +} + +/** + * + */ +void Log_Module_Init(Log_Module_t log_configuration) +{ + UTIL_ADV_TRACE_Init(); + + memcpy( &eLogCurrentColorList, &LOG_COLOR_DEFAULT_CONFIGURATION, sizeof(LOG_COLOR_DEFAULT_CONFIGURATION) ); + Log_Module_Set_Verbose_Level(log_configuration.verbose_level); + Log_Module_Set_Region(log_configuration.region); + pLogTimeStampFunc = NULL; +} + +/** + * + */ +void Log_Module_DeInit(void) +{ + UTIL_ADV_TRACE_DeInit(); +} + +/** + * + */ +void Log_Module_Set_Verbose_Level(Log_Verbose_Level_t new_verbose_level) +{ + eLogCurrentVerboseLevel = new_verbose_level; +} + +/** + * + */ +void Log_Module_Set_Region(Log_Region_t new_region) +{ + lLogCurrentRegionMask = Get_Region_Mask(new_region); +} + +/** + * + */ +void Log_Module_Add_Region(Log_Region_t new_region) +{ + lLogCurrentRegionMask |= Get_Region_Mask(new_region); +} + +/** + * + */ +void Log_Module_Enable_All_Regions(void) +{ + Log_Module_Set_Region(LOG_REGION_ALL_REGIONS); +} + +/** + * + */ +static uint32_t Get_Region_Mask(Log_Region_t region) +{ + if (region == LOG_REGION_ALL_REGIONS) + { + /* Return the full mask */ + return ((uint32_t)LOG_MODULE_ALL_REGION_MASK); + } + else + { + /* Return the bit matching the region */ + return ((uint32_t)(1U << ((uint32_t)region - 1U))); + } +} + +/** + * + */ +void Log_Module_Set_Color(Log_Region_t eRegion, Log_Color_t eNewColor ) +{ + if ( eRegion != LOG_MODULE_ALL_REGION_MASK ) + { + eLogCurrentColorList[eRegion] = eNewColor; + } +} + +/** + * + */ +void Log_Module_RegisterTimeStampFunction( CallBack_TimeStamp * pCallbackFunc ) +{ + pLogTimeStampFunc = pCallbackFunc; +} + +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ diff --git a/lib/stm32wba/hci/log_module.h b/lib/stm32wba/hci/log_module.h new file mode 100644 index 000000000..add5eb9a6 --- /dev/null +++ b/lib/stm32wba/hci/log_module.h @@ -0,0 +1,368 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file log_module.h + * @author MCD Application Team + * @brief Header file of the log module. + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef LOG_MODULE_H +#define LOG_MODULE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include +#include +#include + +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* Module configuration ------------------------------------------------------*/ +/** + * @brief When this define is set to 0, there is no time stamp insertion inside + * the trace data. When set to 1, there is. + */ +#define LOG_INSERT_TIME_STAMP_INSIDE_THE_TRACE CFG_LOG_INSERT_TIME_STAMP_INSIDE_THE_TRACE + +/** + * @brief When this define is set to 1, a color in function or region is inserted on + * the trace data. When set to 0, color is always the same. + */ +#define LOG_INSERT_COLOR_INSIDE_THE_TRACE CFG_LOG_INSERT_COLOR_INSIDE_THE_TRACE + +/** + * @brief When this define is set to 1, a End Of File is inserted at the end of + * the trace data. When set to 0, not EOF is inserted. + */ +#define LOG_INSERT_EOL_INSIDE_THE_TRACE CFG_LOG_INSERT_EOL_INSIDE_THE_TRACE + +/* USER CODE BEGIN Module configuration */ + +/* USER CODE END Module configuration */ + +/* Private defines -----------------------------------------------------------*/ +/* These defines are related to the UTIL_ADV_TRACE. Do not modify them please. */ +#define LOG_MODULE_MIN_VERBOSE_LEVEL (0) +#define LOG_MODULE_MAX_VERBOSE_LEVEL (0xFFFFFFFF) +#define LOG_MODULE_MIN_REGION_VALUE (0) +#define LOG_MODULE_ALL_REGION_MASK (0xFFFFFFFF) + +/* USER CODE BEGIN Private defines */ + +/* USER CODE END Private defines */ + +/* Exported types ------------------------------------------------------------*/ +/* Log module types */ +/** + * @brief Customizable enum describing the verbose levels used by the log module. + * The levels include the lower levels in the logs. + * E.g. LOG_VERBOSE_ERROR means LOG_VERBOSE_ERROR logs will be printed, + * as well as LOG_VERBOSE_INFO, but not the others with higher values. + * The min and max ranges are defined by LOG_MODULE_MIN_VERBOSE_LEVEL + * and LOG_MODULE_MAX_VERBOSE_LEVEL. + * The user can add its own levels but must NOT add a value to the said + * levels. Verbose levels are handled by ADV Trace. + */ +typedef enum +{ + LOG_VERBOSE_INFO = LOG_MODULE_MIN_VERBOSE_LEVEL, + /* USER CODE BEGIN Log_Verbose_Level_t_0 */ + + /* USER CODE END Log_Verbose_Level_t_0 */ + LOG_VERBOSE_ERROR, + /* USER CODE BEGIN Log_Verbose_Level_t_1 */ + + /* USER CODE END Log_Verbose_Level_t_1 */ + LOG_VERBOSE_WARNING, + /* USER CODE BEGIN Log_Verbose_Level_t_2 */ + + /* USER CODE END Log_Verbose_Level_t_2 */ + LOG_VERBOSE_DEBUG, + /* USER CODE BEGIN Log_Verbose_Level_t_3 */ + + /* USER CODE END Log_Verbose_Level_t_3 */ + LOG_VERBOSE_ALL_LOGS = LOG_MODULE_MAX_VERBOSE_LEVEL, +} Log_Verbose_Level_t; + +/** + * @brief Customizable enum describing the regions used by the log module. + * Regions are used to separate the logs into different places. + * Let's say you have a Task 1 and a Task 2. Both of them have Info and + * Debug logs. By using them as such, i.e. with the same regions, you'll + * print the logs of the 2 tasks as long as the verbose is Info or Debug. + * If you create a region for Task 1 and another for Task 2, you can + * split the logs between them, and, if needed, only print the Debug + * logs for Task 1 only (i.e. Task 1 logs for Info and Debug). + * Behind the scenes is a mask into which each region is a bit. + * The user can add its own regions but must NOT add a value to them. + * The log module handles the mask on its own. + */ +typedef enum +{ + LOG_REGION_BLE = LOG_MODULE_MIN_REGION_VALUE, + LOG_REGION_SYSTEM, + LOG_REGION_APP, + LOG_REGION_LINKLAYER, + LOG_REGION_MAC, + LOG_REGION_ZIGBEE, + LOG_REGION_THREAD, + LOG_REGION_RTOS, + /* USER CODE BEGIN Log_Region_t */ + + /* USER CODE END Log_Region_t */ + LOG_REGION_ALL_REGIONS = LOG_MODULE_ALL_REGION_MASK, +} Log_Region_t; + +typedef enum +{ + LOG_COLOR_NONE = 0, // Initialization. + LOG_COLOR_CODE_DEFAULT = 37, // White + LOG_COLOR_CODE_RED = 91, + LOG_COLOR_CODE_GREEN = 92, + LOG_COLOR_CODE_YELLOW = 93, + LOG_COLOR_CODE_CYAN = 96, + /* USER CODE BEGIN Log_Color_t */ + + /* USER CODE END Log_Color_t */ +} Log_Color_t; + +/** + * @brief Data type to initialize the module by calling Log_Module_Init. + */ +typedef struct +{ + Log_Verbose_Level_t verbose_level; + Log_Region_t region; +} Log_Module_t; + +/** + * @brief Callback function to insert Time Stamp. + * + * @param pData The location where insert the new TimeStamp + * @param piSize The size of the TimeStamp insert. + */ +typedef void CallBack_TimeStamp( uint8_t * pData, uint16_t * piSize ); + +/* USER CODE BEGIN ET */ + +/* USER CODE END ET */ + +/* Exported constants --------------------------------------------------------*/ +/* Global const struct variables to make the life of the user easier */ +/** + * @brief A const struct with default parameters for the log module. + * Its main use is to pass it as parameter to Log_Module_Init. + */ +extern const Log_Module_t LOG_MODULE_DEFAULT_CONFIGURATION; + +/** + * @brief A const enum variable with the verbose level set to LOG_VERBOSE_ERROR. + * The levels include the lower levels in the logs. + * E.g. LOG_VERBOSE_ERROR means LOG_VERBOSE_ERROR logs will be printed, + * as well as LOG_VERBOSE_INFO, but not the others with higher values. + */ +extern const Log_Verbose_Level_t LOG_VERBOSE_DEFAULT; + +/** + * @brief A const enum variable to include all regions in the logs. + */ +extern const Log_Region_t LOG_REGION_MASK_DEFAULT; + +/* USER CODE BEGIN EC */ + +/* USER CODE END EC */ + +/* Exported functions prototypes ---------------------------------------------*/ +/* Module API - Module configuration */ +/** + * @brief Initialization of the log module. + * @param The configuration of the log module, of type Log_Module_t. + * @return None. + */ +void Log_Module_Init(Log_Module_t log_configuration); + +/** + * @brief DeInitialization of the log module. + * @param None. + * @return None. + */ +void Log_Module_DeInit(void); + +/** + * @brief Set the verbose level of the log. + * The levels include the lower levels in the logs. + * E.g. LOG_VERBOSE_ERROR means LOG_VERBOSE_ERROR logs will be printed, + * as well as LOG_VERBOSE_INFO, but not the others with higher values. + * @param The new verbose level to be set, of type Log_Verbose_Level_t + * @return None + */ +void Log_Module_Set_Verbose_Level(Log_Verbose_Level_t new_verbose_level); + +/** + * @brief Replace the current region mask to use and set only the given region. + * @param The new region to use, of type Log_Region_t. + * @return None. + */ +void Log_Module_Set_Region(Log_Region_t new_region); + +/** + * @brief Add to the current region mask the given region. + * @param The new region to use, alongside the others, of type Log_Region_t. + * @return None. + */ +void Log_Module_Add_Region(Log_Region_t new_region); + +/** + * @brief Enable all the regions. + * @param None. + * @return None. + */ +void Log_Module_Enable_All_Regions(void); + +/** + * @brief Set/Replace the color for a region. + * @param eRegion The region where apply the color, type Log_Region_t. + * @param eNewColor The color to apply to selected region, type Log_Color_t. + * @return None. + */ +void Log_Module_Set_Color(Log_Region_t eRegion, Log_Color_t eNewColor ); + +/** + * @brief Register a callback function to insert the 'TimeStamp' to the log. + * + * @param pCallbackFunc Callback function to insert Time Stamp. + * This function is typedef void ( uint8_t * pData, uint16_t * piSize ); + * Where pData is the location where insert the new TimeStamp and piSize is the size of insert. + * @return None. + */ +void Log_Module_RegisterTimeStampFunction( CallBack_TimeStamp * pCallbackFunc ); + +/* Module API - Wrapper function */ +/** + * @brief Underlying function of all the LOG macros. + * + * @param eVerboseLevel The level of verbose for this Log. + * @param eRegion The stack where the log is issued + * @param pText Pointer to the text to be printed. + * @param Any other parameters to be printed with the text. + * E.g. an int variable. as 3rd parameter, as long as %d is in text. + * + * @return None. + */ +void Log_Module_Print( Log_Verbose_Level_t eVerboseLevel, Log_Region_t eRegion, const char * pText, ...); + +/** + * @brief Function of log with already a arg list. + * + * @param eVerboseLevel The level of verbose for this Log. + * @param eRegion The stack where the log is issued + * @param pText Pointer to the text to be printed. + * @param args Arguments list. + * + * @return None. + */ +void Log_Module_PrintWithArg( Log_Verbose_Level_t eVerboseLevel, Log_Region_t eRegion, const char * pText, va_list args ); + +/* USER CODE BEGIN EFP */ + +/* USER CODE END EFP */ + +/* Exported macro ------------------------------------------------------------*/ +/* Module API - Log macros for each region */ +/* LOG_REGION_BLE */ +#define LOG_INFO_BLE(...) Log_Module_Print( LOG_VERBOSE_INFO, LOG_REGION_BLE, __VA_ARGS__) +#define LOG_ERROR_BLE(...) Log_Module_Print( LOG_VERBOSE_ERROR, LOG_REGION_BLE, __VA_ARGS__) +#define LOG_WARNING_BLE(...) Log_Module_Print( LOG_VERBOSE_WARNING, LOG_REGION_BLE, __VA_ARGS__) +#define LOG_DEBUG_BLE(...) Log_Module_Print( LOG_VERBOSE_DEBUG, LOG_REGION_BLE, __VA_ARGS__) + +/* USER CODE BEGIN LOG_REGION_BLE */ +/** + * Add inside this user section your defines to match the new verbose levels you + * created into Log_Verbose_Level_t. + * Example : + * #define LOG_CUSTOM_BLE(...) { Log_Module_t _tmp = { .verbose_level = LOG_VERBOSE_CUSTOM, .region = LOG_REGION_BLE }; _Log(_tmp, __VA_ARGS__); } + * + * You don't need to update all regions with your custom values. + * Do it accordingly to your needs. E.g you might not need LOG_VERBOSE_CUSTOM + * for a System region. + */ + +/* USER CODE END LOG_REGION_BLE */ + +/* LOG_REGION_SYSTEM */ +#define LOG_INFO_SYSTEM(...) Log_Module_Print( LOG_VERBOSE_INFO, LOG_REGION_SYSTEM, __VA_ARGS__) +#define LOG_ERROR_SYSTEM(...) Log_Module_Print( LOG_VERBOSE_ERROR, LOG_REGION_SYSTEM, __VA_ARGS__) +#define LOG_WARNING_SYSTEM(...) Log_Module_Print( LOG_VERBOSE_WARNING, LOG_REGION_SYSTEM, __VA_ARGS__) +#define LOG_DEBUG_SYSTEM(...) Log_Module_Print( LOG_VERBOSE_DEBUG, LOG_REGION_SYSTEM, __VA_ARGS__) + +/* USER CODE BEGIN LOG_REGION_SYSTEM */ +/** + * Add inside this user section your defines to match the new verbose levels you + * created into Log_Verbose_Level_t. + * Example : + * #define LOG_CUSTOM_SYSTEM(...) { Log_Module_t _tmp = { .verbose_level = LOG_VERBOSE_CUSTOM, .region = LOG_REGION_SYSTEM }; _Log(_tmp, __VA_ARGS__); } + * + * You don't need to update all regions with your custom values. + * Do it accordingly to your needs. E.g you might not need LOG_VERBOSE_CUSTOM + * for a System region. + */ + +/* USER CODE END LOG_REGION_SYSTEM */ + +/* LOG_REGION_APP */ +#define LOG_INFO_APP(...) Log_Module_Print( LOG_VERBOSE_INFO, LOG_REGION_APP, __VA_ARGS__) +#define LOG_ERROR_APP(...) Log_Module_Print( LOG_VERBOSE_ERROR, LOG_REGION_APP, __VA_ARGS__) +#define LOG_WARNING_APP(...) Log_Module_Print( LOG_VERBOSE_WARNING, LOG_REGION_APP, __VA_ARGS__) +#define LOG_DEBUG_APP(...) Log_Module_Print( LOG_VERBOSE_DEBUG, LOG_REGION_APP, __VA_ARGS__) + +/* USER CODE BEGIN LOG_REGION_APP */ +/** + * Add inside this user section your defines to match the new verbose levels you + * created into Log_Verbose_Level_t. + * Example : + * #define LOG_CUSTOM_APP(...) { Log_Module_t _tmp = { .verbose_level = LOG_VERBOSE_CUSTOM, .region = LOG_REGION_APP }; _Log(_tmp, __VA_ARGS__); } + * + * You don't need to update all regions with your custom values. + * Do it accordingly to your needs. E.g you might not need LOG_VERBOSE_CUSTOM + * for a System region. + */ + +/* USER CODE END LOG_REGION_APP */ + +/* USER CODE BEGIN APP_LOG_USER_DEFINES */ +/** + * Add inside this user section your defines to match the new regions you + * created into Log_Region_t. + * Example : + * #define LOG_INFO_CUSTOM(...) { Log_Module_t _tmp = { .verbose_level = LOG_VERBOSE_INFO, .region = LOG_REGION_CUSTOM }; _Log(_tmp, __VA_ARGS__); } + * #define LOG_ERROR_CUSTOM(...) { Log_Module_t _tmp = { .verbose_level = LOG_VERBOSE_ERROR, .region = LOG_REGION_CUSTOM }; _Log(_tmp, __VA_ARGS__); } + * #define LOG_WARNING_CUSTOM(...) { Log_Module_t _tmp = { .verbose_level = LOG_VERBOSE_WARNING, .region = LOG_REGION_CUSTOM }; _Log(_tmp, __VA_ARGS__); } + * #define LOG_DEBUG_CUSTOM(...) { Log_Module_t _tmp = { .verbose_level = LOG_VERBOSE_DEBUG, .region = LOG_REGION_CUSTOM }; _Log(_tmp, __VA_ARGS__); } + */ + +/* USER CODE END APP_LOG_USER_DEFINES */ + +#ifdef __cplusplus +} +#endif + +#endif /* LOG_MODULE_H */ diff --git a/lib/stm32wba/hci/main.h b/lib/stm32wba/hci/main.h new file mode 100644 index 000000000..ce6a3f852 --- /dev/null +++ b/lib/stm32wba/hci/main.h @@ -0,0 +1,82 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file : main.h + * @brief : Header for main.c file. + * This file contains the common defines of the application. + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __MAIN_H +#define __MAIN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32wbaxx_hal.h" +#include "app_conf.h" +#include "app_entry.h" +#include "app_common.h" +#include "app_debug.h" + +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* Exported types ------------------------------------------------------------*/ +/* USER CODE BEGIN ET */ + +/* USER CODE END ET */ + +/* Exported constants --------------------------------------------------------*/ +/* USER CODE BEGIN EC */ + +/* USER CODE END EC */ + +/* Exported macro ------------------------------------------------------------*/ +/* USER CODE BEGIN EM */ + +/* USER CODE END EM */ + +/* Exported functions prototypes ---------------------------------------------*/ +void Error_Handler(void); +void MX_GPIO_Init(void); +void MX_GPDMA1_Init(void); +void MX_RAMCFG_Init(void); +void MX_RTC_Init(void); +void MX_USART1_UART_Init(void); +void MX_ADC4_Init(void); +void MX_RNG_Init(void); +void MX_CRC_Init(void); +void MX_ICACHE_Init(void); + +/* USER CODE BEGIN EFP */ + +/* USER CODE END EFP */ + +/* Private defines -----------------------------------------------------------*/ + +/* USER CODE BEGIN Private defines */ + +/* USER CODE END Private defines */ + +#ifdef __cplusplus +} +#endif + +#endif /* __MAIN_H */ diff --git a/lib/stm32wba/hci/pka_p256.c b/lib/stm32wba/hci/pka_p256.c new file mode 100644 index 000000000..45023a884 --- /dev/null +++ b/lib/stm32wba/hci/pka_p256.c @@ -0,0 +1,237 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file pka_p256.c + * @author MCD Application Team + * @brief This file is an optional part of the PKA driver for STM32WBA. + * It is dedicated to the P256 elliptic curve. + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +#include "app_common.h" +#include "stm32wbaxx_ll_pka.h" + +/*****************************************************************************/ + +static const uint32_t HW_PKA_P256_gfp[8] = +{ + 0xFFFFFFFF, /* LSB */ + 0xFFFFFFFF, + 0xFFFFFFFF, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000001, + 0xFFFFFFFF, +}; + +static const uint32_t HW_PKA_P256_r2[8] = +{ + 0x00000002, /* LSB */ + 0x00000005, + 0x00000003, + 0xFFFFFFFE, + 0xFFFFFFF9, + 0xFFFFFFFB, + 0xFFFFFFFC, + 0xFFFFFFFC, +}; + +static const uint32_t HW_PKA_P256_p_x[8] = +{ + 0xD898C296, /* LSB */ + 0xF4A13945, + 0x2DEB33A0, + 0x77037D81, + 0x63A440F2, + 0xF8BCE6E5, + 0xE12C4247, + 0x6B17D1F2, +}; + +static const uint32_t HW_PKA_P256_p_y[8] = +{ + 0x37BF51F5, /* LSB */ + 0xCBB64068, + 0x6B315ECE, + 0x2BCE3357, + 0x7C0F9E16, + 0x8EE7EB4A, + 0xFE1A7F9B, + 0x4FE342E2, +}; + +static const uint32_t HW_PKA_P256_a[8] = +{ + 0x00000003, /* LSB */ + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, +}; + +static const uint32_t HW_PKA_P256_b[8] = +{ + 0x27D2604B, /* LSB */ + 0x3BCE3C3E, + 0xCC53B0F6, + 0x651D06B0, + 0x769886BC, + 0xB3EBBD55, + 0xAA3A93E7, + 0x5AC635D8, +}; + +static const uint32_t HW_PKA_P256_n[8] = +{ + 0XFC632551, /* LSB */ + 0XF3B9CAC2, + 0XA7179E84, + 0XBCE6FAAD, + 0XFFFFFFFF, + 0XFFFFFFFF, + 0X00000000, + 0XFFFFFFFF +}; + +/*****************************************************************************/ + +void HW_PKA_P256_StartRangeCheck( const uint32_t* coord ) +{ + /* Set the muber of bits of P */ + HW_PKA_WriteSingleInput( PKA_COMPARISON_IN_OP_NB_BITS, 256 ); + + /* Set the coordinate */ + HW_PKA_WriteOperand( PKA_COMPARISON_IN_OP1, 8, coord ); + + /* Set the modulus value p */ + HW_PKA_WriteOperand( PKA_COMPARISON_IN_OP2, 8, HW_PKA_P256_gfp ); + + /* Start PKA hardware */ + HW_PKA_Start( LL_PKA_MODE_COMPARISON ); +} + +/*****************************************************************************/ + +uint32_t HW_PKA_P256_IsRangeCheckOk( void ) +{ + return (HW_PKA_ReadSingleOutput( PKA_COMPARISON_OUT_RESULT ) == 0x916AUL); +} + +/*****************************************************************************/ + +void HW_PKA_P256_StartPointCheck( const uint32_t* x, + const uint32_t* y ) +{ + /* Set the muber of bits of p */ + HW_PKA_WriteSingleInput( PKA_POINT_CHECK_IN_MOD_NB_BITS, 256 ); + + /* Set the coefficient a sign */ + HW_PKA_WriteSingleInput( PKA_POINT_CHECK_IN_A_COEFF_SIGN, 1 ); + + /* Set the coefficient |a| */ + HW_PKA_WriteOperand( PKA_POINT_CHECK_IN_A_COEFF, 8, HW_PKA_P256_a ); + + /* Set the coefficient b */ + HW_PKA_WriteOperand( PKA_POINT_CHECK_IN_B_COEFF, 8, HW_PKA_P256_b ); + + /* Set the modulus value p */ + HW_PKA_WriteOperand( PKA_POINT_CHECK_IN_MOD_GF, 8, HW_PKA_P256_gfp ); + + /* Set the point coordinate x */ + HW_PKA_WriteOperand( PKA_POINT_CHECK_IN_INITIAL_POINT_X, 8, x ); + + /* Set the point coordinate y */ + HW_PKA_WriteOperand( PKA_POINT_CHECK_IN_INITIAL_POINT_Y, 8, y ); + + /* Set the Montgomery parameter */ + HW_PKA_WriteOperand( PKA_POINT_CHECK_IN_MONTGOMERY_PARAM, + 8, HW_PKA_P256_r2 ); + + /* Start PKA hardware */ + HW_PKA_Start( LL_PKA_MODE_POINT_CHECK ); +} + +/*****************************************************************************/ + +uint32_t HW_PKA_P256_IsPointCheckOk( void ) +{ + return (HW_PKA_ReadSingleOutput( PKA_POINT_CHECK_OUT_ERROR ) == 0xD60DUL); +} + +/*****************************************************************************/ + +void HW_PKA_P256_StartEccScalarMul( const uint32_t* k, + const uint32_t* p_x, + const uint32_t* p_y ) +{ + /* Set the scalar multiplier k length */ + HW_PKA_WriteSingleInput( PKA_ECC_SCALAR_MUL_IN_EXP_NB_BITS, 256 ); + + /* Set the modulus length */ + HW_PKA_WriteSingleInput( PKA_ECC_SCALAR_MUL_IN_OP_NB_BITS, 256 ); + + /* Set the coefficient a sign */ + HW_PKA_WriteSingleInput( PKA_ECC_SCALAR_MUL_IN_A_COEFF_SIGN, 1 ); + + /* Set the coefficient |a| */ + HW_PKA_WriteOperand( PKA_ECC_SCALAR_MUL_IN_A_COEFF, 8, HW_PKA_P256_a ); + + /* Set the coefficient b */ + HW_PKA_WriteOperand( PKA_ECC_SCALAR_MUL_IN_B_COEFF, 8, HW_PKA_P256_b ); + + /* Set the modulus value p */ + HW_PKA_WriteOperand( PKA_ECC_SCALAR_MUL_IN_MOD_GF, 8, HW_PKA_P256_gfp ); + + /* Set the scalar multiplier k */ + HW_PKA_WriteOperand( PKA_ECC_SCALAR_MUL_IN_K, 8, k ); + + /* Set the point P coordinate x */ + HW_PKA_WriteOperand( PKA_ECC_SCALAR_MUL_IN_INITIAL_POINT_X, + 8, p_x ? p_x : HW_PKA_P256_p_x ); + + /* Set the point P coordinate y */ + HW_PKA_WriteOperand( PKA_ECC_SCALAR_MUL_IN_INITIAL_POINT_Y, + 8, p_y ? p_y : HW_PKA_P256_p_y ); + + /* Set the prime order n */ + HW_PKA_WriteOperand( PKA_ECC_SCALAR_MUL_IN_N_PRIME_ORDER, + 8, HW_PKA_P256_n ); + + /* Start PKA hardware */ + HW_PKA_Start( LL_PKA_MODE_ECC_MUL ); +} + +/*****************************************************************************/ + +void HW_PKA_P256_ReadEccScalarMul( uint32_t* p_x, + uint32_t* p_y ) +{ + /* Read the output point X */ + if ( p_x ) + { + HW_PKA_ReadResult( PKA_ECC_SCALAR_MUL_OUT_RESULT_X, 8, p_x ); + } + + /* Read the output point Y as the second half of the result */ + if ( p_y ) + { + HW_PKA_ReadResult( PKA_ECC_SCALAR_MUL_OUT_RESULT_Y, 8, p_y ); + } +} + +/*****************************************************************************/ diff --git a/lib/stm32wba/hci/power_table.c b/lib/stm32wba/hci/power_table.c new file mode 100644 index 000000000..3741b02d3 --- /dev/null +++ b/lib/stm32wba/hci/power_table.c @@ -0,0 +1,119 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file power_table.c + * @author MCD Application Team + * @brief This file contains supported power tables + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Includes ------------------------------------------------------------------*/ +#include "power_table.h" + +/* Private typedef -----------------------------------------------------------*/ + +/* VDD_LDO values to be written in PHY registers to select the TX_Power mode. + * g_vdd_ldo_value_1 : is to be set in PHY register address 0x63. + * g_vdd_ldo_value_2 : is to be set in PHY register address 0xEA. */ + +typedef enum _vdd_ldo_value_e { + VDD_LDO_VALUE_MAX_POWER = 0x70, + VDD_LDO_VALUE_LOW_POWER = 0x20, + VDD_LDO_VALUE_2_ID_0 = 0x00, +} vdd_ldo_value_e; + +/* Private defines -----------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ + +const power_table_entry ll_tx_power_table_max_power[] = { + {0x02, 0x02, 0x01, -20}, /* Actual_Power = -20.4 dBm */ + {0x02, 0x03, 0x01, -19}, /* Actual_Power = -19.4 dBm */ + {0x02, 0x04, 0x01, -18}, /* Actual_Power = -18.3 dBm */ + {0x02, 0x05, 0x01, -17}, /* Actual_Power = -17.3 dBm */ + {0x02, 0x06, 0x01, -16}, /* Actual_Power = -16.4 dBm */ + {0x02, 0x07, 0x01, -15}, /* Actual_Power = -15.4 dBm */ + {0x02, 0x08, 0x01, -14}, /* Actual_Power = -14.3 dBm */ + {0x02, 0x09, 0x01, -13}, /* Actual_Power = -13.3 dBm */ + {0x02, 0x0A, 0x01, -12}, /* Actual_Power = -12.3 dBm */ + {0x02, 0x0B, 0x01, -11}, /* Actual_Power = -11.4 dBm */ + {0x02, 0x0C, 0x01, -10}, /* Actual_Power = -10.4 dBm */ + {0x02, 0x0D, 0x01, -9}, /* Actual_Power = -9.5 dBm */ + {0x02, 0x0E, 0x01, -8}, /* Actual_Power = -8.4 dBm */ + {0x00, 0x0F, 0x01, -7}, /* Actual_Power = -7.5 dBm */ + {0x00, 0x10, 0x01, -6}, /* Actual_Power = -6.5 dBm */ + {0x00, 0x11, 0x01, -5}, /* Actual_Power = -5.4 dBm */ + {0x00, 0x12, 0x01, -4}, /* Actual_Power = -4.5 dBm */ + {0x00, 0x13, 0x01, -3}, /* Actual_Power = -3.5 dBm */ + {0x02, 0x14, 0x01, -2}, /* Actual_Power = -2.4 dBm */ + {0x00, 0x15, 0x01, -1}, /* Actual_Power = -1.5 dBm */ + {0x02, 0x16, 0x01, 0}, /* Actual_Power = -0.3 dBm */ + {0x00, 0x17, 0x01, 1}, /* Actual_Power = 0.9 dBm */ + {0x00, 0x18, 0x01, 2}, /* Actual_Power = 2.3 dBm */ + {0x02, 0x18, 0x01, 3}, /* Actual_Power = 2.8 dBm */ + {0x00, 0x19, 0x01, 4}, /* Actual_Power = 3.9 dBm */ + {0x02, 0x19, 0x01, 5}, /* Actual_Power = 4.8 dBm */ + {0x03, 0x19, 0x01, 6}, /* Actual_Power = 5.6 dBm */ + {0x05, 0x19, 0x01, 7}, /* Actual_Power = 6.9 dBm */ + {0x06, 0x19, 0x01, 8}, /* Actual_Power = 7.5 dBm */ + {0x08, 0x19, 0x01, 9}, /* Actual_Power = 8.5 dBm */ + {0x0D, 0x19, 0x01, 10}, /* Actual_Power = 10 dBm */ +}; + +const power_table_entry ll_tx_power_table_low_power[] = { + {0x02, 0x02, 0x01, -20}, /* Actual_Power = -20.5 dBm */ + {0x02, 0x03, 0x01, -19}, /* Actual_Power = -19.5 dBm */ + {0x00, 0x05, 0x01, -18}, /* Actual_Power = -17.9 dBm */ + {0x00, 0x06, 0x01, -17}, /* Actual_Power = -17.0 dBm */ + {0x00, 0x07, 0x01, -16}, /* Actual_Power = -16.0 dBm */ + {0x00, 0x08, 0x01, -15}, /* Actual_Power = -15.0 dBm */ + {0x00, 0x09, 0x01, -14}, /* Actual_Power = -14.1 dBm */ + {0x00, 0x0A, 0x01, -13}, /* Actual_Power = -13.1 dBm */ + {0x00, 0x0B, 0x01, -12}, /* Actual_Power = -12.2 dBm */ + {0x00, 0x0C, 0x01, -11}, /* Actual_Power = -11.3 dBm */ + {0x00, 0x0D, 0x01, -10}, /* Actual_Power = -10.4 dBm */ + {0x00, 0x0E, 0x01, -9}, /* Actual_Power = -9.4 dBm */ + {0x00, 0x0F, 0x01, -8}, /* Actual_Power = -8.3 dBm */ + {0x00, 0x10, 0x01, -7}, /* Actual_Power = -7.2 dBm */ + {0x00, 0x11, 0x01, -6}, /* Actual_Power = -6.2 dBm */ + {0x00, 0x12, 0x01, -5}, /* Actual_Power = -5.5 dBm */ + {0x00, 0x13, 0x01, -4}, /* Actual_Power = -4.5 dBm */ + {0x02, 0x14, 0x01, -3}, /* Actual_Power = -3.5 dBm */ + {0x02, 0x15, 0x01, -2}, /* Actual_Power = -2.5 dBm */ + {0x00, 0x17, 0x01, -1}, /* Actual_Power = -0.6 dBm */ + {0x02, 0x17, 0x01, 0}, /* Actual_Power = -0.4 dBm */ + {0x00, 0x18, 0x01, 1}, /* Actual_Power = 0.7 dBm */ + {0x00, 0x19, 0x01, 2}, /* Actual_Power = 2.0 dBm */ + {0x02, 0x19, 0x01, 3}, /* Actual_Power = 2.6 dBm */ +}; + +/* USER CODE BEGIN ll_tx_power_table */ + +/* USER CODE END ll_tx_power_table */ + +/* Supported TX_Power tables. */ +const power_table_id_t ll_tx_power_tables[] = { + {ll_tx_power_table_max_power, sizeof(ll_tx_power_table_max_power)/sizeof(ll_tx_power_table_max_power[0]), VDD_LDO_VALUE_MAX_POWER, VDD_LDO_VALUE_2_ID_0, 0}, + {ll_tx_power_table_low_power, sizeof(ll_tx_power_table_low_power)/sizeof(ll_tx_power_table_low_power[0]), VDD_LDO_VALUE_LOW_POWER, VDD_LDO_VALUE_2_ID_0, 1}, + /* USER CODE BEGIN ll_tx_power_tables */ + + /* USER CODE END ll_tx_power_tables */ +}; + +/* Number of supported TX_Power tables. */ +const uint8_t num_of_supported_power_tables = sizeof(ll_tx_power_tables)/sizeof(ll_tx_power_tables[0]); + +/* Functions Definition ------------------------------------------------------*/ +/* Private functions ----------------------------------------------------------*/ +/* Public functions ----------------------------------------------------------*/ diff --git a/lib/stm32wba/hci/scm.c b/lib/stm32wba/hci/scm.c new file mode 100644 index 000000000..dd8f223bb --- /dev/null +++ b/lib/stm32wba/hci/scm.c @@ -0,0 +1,848 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file scm.c + * @author MCD Application Team + * @brief Functions for the System Clock Manager. + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Includes ------------------------------------------------------------------*/ +#include "scm.h" +#include "RTDebug.h" + +#if (CFG_SCM_SUPPORTED == 1) + +__weak void SCM_HSI_CLK_ON(void) +{ + LL_RCC_HSI_Enable(); + while(LL_RCC_HSI_IsReady() == 0); +} + +__weak void SCM_HSI_CLK_OFF(void) +{ + LL_RCC_HSI_Disable(); +} + +/* Private typedef -----------------------------------------------------------*/ +#define PLL_INPUTRANGE0_FREQMAX 8000000u /* 8 MHz is maximum frequency for VCO input range 0 */ + +/* Private define ------------------------------------------------------------*/ + +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +RAMCFG_HandleTypeDef sram1_ns = +{ + RAMCFG_SRAM1, /* Instance */ + HAL_RAMCFG_STATE_READY, /* RAMCFG State */ + 0U, /* RAMCFG Error Code */ +}; + +RAMCFG_HandleTypeDef sram2_ns = +{ + RAMCFG_SRAM2, /* Instance */ + HAL_RAMCFG_STATE_READY, /* RAMCFG State */ + 0U, /* RAMCFG Error Code */ +}; + +static scm_system_clock_t scm_system_clock_config; +static scm_clockconfig_t scm_system_clock_requests[(scm_user_id_t)TOTAL_CLIENT_NUM] = {NO_CLOCK_CONFIG}; +static scm_radio_state_t RadioState; + +/* Private function prototypes -----------------------------------------------*/ +static scm_clockconfig_t scm_getmaxfreq(void); +static void scm_systemclockconfig(void); +static void ConfigStartPll(void); +static void ConfigHwPll(scm_pll_config_t *p_hw_config); +static void SwitchHsePre(scm_hse_hsepre_t hse_pre); +static void SwitchHse16toHse32(void); +static void SwitchHse32toHse16(void); +static void SwitchPlltoHse32(void); + +/* Private functions ---------------------------------------------------------*/ +static scm_clockconfig_t scm_getmaxfreq(void) +{ + uint8_t idx = 0; + scm_clockconfig_t max = NO_CLOCK_CONFIG; + + for(idx = 0; idx < sizeof(scm_system_clock_requests) ; idx++) + { + if(scm_system_clock_requests[idx] > max) + { + max = scm_system_clock_requests[idx]; + } + } + + return max; +} + +static void scm_systemclockconfig(void) +{ + SYSTEM_DEBUG_SIGNAL_SET(SCM_SYSTEM_CLOCK_CONFIG); + + switch (scm_system_clock_config.targeted_clock_freq) + { + case HSE_16MHZ: + + if(LL_RCC_GetSysClkSource() == LL_RCC_SYS_CLKSOURCE_STATUS_PLL1R) + { + /* currently running on PLL */ + SwitchPlltoHse32(); + } + + SwitchHse32toHse16(); + + /* Ensure time base clock coherency */ + SystemCoreClockUpdate(); + + break; + + case HSE_32MHZ: + + if (LL_RCC_HSE_IsEnabledPrescaler()) + { + /* currently running on HSE16 */ + SwitchHse16toHse32(); + + /* Ensure time base clock coherency */ + SystemCoreClockUpdate(); + } + else if(LL_RCC_GetSysClkSource() == LL_RCC_SYS_CLKSOURCE_STATUS_PLL1R) + { + /* currently running on PLL */ + SwitchPlltoHse32(); + + /* Ensure time base clock coherency */ + SystemCoreClockUpdate(); + } + else + { + /** + * The system is already running on HSE32 + * The only case is when the PLL has been requested and + * aborted before the system switched to PLL + */ + + /* Disable PLL */ + LL_RCC_PLL1_Disable(); + + /** + * Disable PLL1RDY interrupt + * No need to worry the case when the PLL interrupt + * may already be pending at this time + */ + __HAL_RCC_DISABLE_IT(RCC_IT_PLL1RDY); + } + + break; + + case SYS_PLL: + + if (LL_RCC_HSE_IsEnabledPrescaler()) + { + /* currently running on HSE16 */ + SwitchHse16toHse32(); + + /* Ensure time base clock coherency */ + SystemCoreClockUpdate(); + } + + ConfigStartPll(); + + break; + + default: + break; + } + + SYSTEM_DEBUG_SIGNAL_RESET(SCM_SYSTEM_CLOCK_CONFIG); +} + +static void SwitchHsePre(scm_hse_hsepre_t hse_pre) +{ + /* Start HSI */ + SCM_HSI_CLK_ON(); + + /* Set HSI as SYSCLK */ + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSI); + while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSI); + + /* Enable HSEON */ + LL_RCC_HSE_Enable(); + while(LL_RCC_HSE_IsReady() == 0); + + /* Set/Clear HSEPRE */ + if(hse_pre == HSEPRE_DISABLE) + { + LL_RCC_HSE_DisablePrescaler(); + } + else + { + LL_RCC_HSE_EnablePrescaler(); + } + + /* Set HSE as SYSCLK */ + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSE); + while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSE); + + /* Disable HSI */ + SCM_HSI_CLK_OFF(); +} + +static void SwitchHse16toHse32(void) +{ + /** + * Switch from HSE_16MHz to HSE_32MHz + * 1. Voltage Range1 + * 2. Disable prescaler ==> HSE16 to HSE32 + * 3. Change RAM/FLASH waitstates (no limitation in Rang1) + * 4. AHB5 Div 1 + */ + + /* first switch to VOS1 */ + LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1); + while (LL_PWR_IsActiveFlag_VOS() == 0); + + /* Switch to 32Mhz */ + SwitchHsePre(HSEPRE_DISABLE); + + /* Configure flash and SRAMs */ + scm_setwaitstates(HSE32); + + /* Need to set HDIV5 */ + LL_RCC_SetAHB5Divider(LL_RCC_AHB5_DIVIDER_1); /* divided by 1 */ +} + +static void SwitchHse32toHse16(void) +{ + /** + * Switch from HSE_16MHz to HSE_32MHz + * 1. AHB5 Div 2 + * 2. Change RAM/FLASH waitstates + * 3. Disable prescaler ==> HSE16 to HSE32 + * 4. Voltage Range2 + */ + + /* Divide HDIV5 by 2 */ + LL_RCC_SetAHB5Divider(LL_RCC_AHB5_DIVIDER_2); + + /* Configure flash and SRAMs before switching to VOS2 */ + scm_setwaitstates(HSE16); + + /* Switch to HSE 16 */ + SwitchHsePre(HSEPRE_ENABLE); + + LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE2); +} + +static void SwitchPlltoHse32(void) +{ + /** + * Switch from PLL to HSE_32MHz + * 1. Switch system clock source to HSE + * 2. Turn OFF PLL + * 3. Change RAM/FLASH waitstates (no limitation in Rang1) + */ + + /* Switch to HSE */ + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSE); + while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSE); + + /* Disable PLL */ + LL_RCC_PLL1_Disable(); + + /* Configure flash and SRAMs */ + scm_setwaitstates(HSE32); +} + +static void ConfigStartPll(void) +{ + /* Enable PLL1 output for SYSCLK (PLL1R) */ + LL_RCC_PLL1_EnableDomain_PLL1R(); + + /* Configure and start the PLL */ + LL_RCC_PLL1_SetMainSource(LL_RCC_PLL1SOURCE_HSE); + + /* Enable PLL1 */ + __HAL_RCC_PLL1_ENABLE(); + + /* PLL1RDY interrupt raised when PLL is enabled */ + __HAL_RCC_ENABLE_IT(RCC_IT_PLL1RDY); +} + +static void ConfigHwPll(scm_pll_config_t *p_hw_config) +{ + uint32_t freq_vco_in = 0; + + /* Apply user PLL mode */ + if(p_hw_config->pll_mode == PLL_FRACTIONAL_MODE) + { + scm_pll_fractional_update(p_hw_config->PLLFractional); + } + else + { + /* Integer configuration will be used for PLL mode */ + LL_RCC_PLL1FRACN_Disable(); + } + + /* Apply correct frequency range for VCO_IN */ + /* Note as PLL clock source is always HSE 32MHz, only PLL1M value impact VCO_IN */ + + freq_vco_in = 32000000UL/p_hw_config->PLLM; + if (freq_vco_in > PLL_INPUTRANGE0_FREQMAX) + { + freq_vco_in = RCC_PLL_VCOINPUT_RANGE1; + } + else + { + freq_vco_in = RCC_PLL_VCOINPUT_RANGE0; + } + __HAL_RCC_PLL1_VCOINPUTRANGE_CONFIG(freq_vco_in); + + __HAL_RCC_PLL1_CONFIG(RCC_PLLSOURCE_HSE, /* PLL clock source is always HSE 32MHz */ + p_hw_config->PLLM, + p_hw_config->PLLN, + p_hw_config->PLLP, + p_hw_config->PLLQ, + p_hw_config->PLLR + ); + + LL_RCC_SetAHB5Prescaler(p_hw_config->AHB5_PLL1_CLKDivider); + + /* PLL is now initialized */ + scm_system_clock_config.pll.are_pll_params_initialized = 1; +} + +/* Public functions ----------------------------------------------------------*/ + +/** + * @brief System Clock Manager init code + * @param None + * @retval None + */ +void scm_init() +{ + /* init scm_system_clock_config with LP config + * scm_system_clock_config SHALL BE UPDATED BY READING HW CONFIG FROM HAL APIs + * SHALL BE CALLED AFTER SystemClock_Config() + **/ + + /* Default PLL configuration => no configuration */ + memset(&(scm_system_clock_config.pll), 0, sizeof(scm_pll_config_t)); + + /* Reading FLASH and SRAMs waitstates from registers */ + scm_system_clock_config.flash_ws_cfg = __HAL_FLASH_GET_LATENCY(); + scm_system_clock_config.sram_ws_cfg = HAL_RAMCFG_GetWaitState(&sram1_ns); + + /* Link Layer is not active at this stage */ + RadioState = SCM_RADIO_NOT_ACTIVE; + + /* Enable RAMCFG clock */ + __HAL_RCC_RAMCFG_CLK_ENABLE(); + + /* Reading system core clock configuration from registers */ + + switch(LL_RCC_GetSysClkSource()) + { + case LL_RCC_SYS_CLKSOURCE_STATUS_HSI: + /* HSI system clock configuration is not supported on SCM module as radio activity is not possible. + * Switch to HSE_16MHz required. + */ + + /* Target system clock frequency is now HSE_16MHZ */ + scm_system_clock_config.targeted_clock_freq = HSE_16MHZ; + + /* Enable prescaler */ + LL_RCC_HSE_EnablePrescaler(); + + /* Set HDIV 5 */ + LL_RCC_SetAHB5Divider(LL_RCC_AHB5_DIVIDER_2); /* divided by 2 */ + + scm_setup(); + + /* Set VOS to range 2 */ + LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE2); + + break; + + case LL_RCC_SYS_CLKSOURCE_STATUS_HSE: + + /* Get AHB5 divider for HSE frequency */ + if (LL_RCC_HSE_IsEnabledPrescaler()) + { + /* System core clock is HSE_16MHz */ + scm_system_clock_config.targeted_clock_freq = HSE_16MHZ; + } + else + { + /* System core clock is HSE_32MHz */ + scm_system_clock_config.targeted_clock_freq = HSE_32MHZ; + } + + break; + + case LL_RCC_SYS_CLKSOURCE_STATUS_PLL1R: + scm_system_clock_config.targeted_clock_freq = SYS_PLL; + + /* Initial PLL configuration */ + scm_system_clock_config.pll.PLLM = LL_RCC_PLL1_GetDivider(); + scm_system_clock_config.pll.PLLN = LL_RCC_PLL1_GetN(); + scm_system_clock_config.pll.PLLP = LL_RCC_PLL1_GetP(); + scm_system_clock_config.pll.PLLQ = LL_RCC_PLL1_GetQ(); + scm_system_clock_config.pll.PLLR = LL_RCC_PLL1_GetR(); + scm_system_clock_config.pll.PLLFractional = LL_RCC_PLL1_GetFRACN(); + scm_system_clock_config.pll.AHB5_PLL1_CLKDivider = LL_RCC_GetAHB5Prescaler(); + if(scm_system_clock_config.pll.PLLFractional == PLL_FRACTIONAL_MODE) + { + scm_system_clock_config.pll.pll_mode = PLL_FRACTIONAL_MODE; + } + else + { + scm_system_clock_config.pll.pll_mode = PLL_INTEGER_MODE; + } + + break; + } +} + +/** + * @brief Setup the system clock source in usable configuration for Connectivity use cases. + * Called at startup or out of low power modes. + * @param None + * @retval None + */ +void scm_setup(void) +{ + SYSTEM_DEBUG_SIGNAL_SET(SCM_SETUP); + + /* System clock is now on HSI 16Mhz, as it exits from stop mode */ + + /* Start HSE */ + LL_RCC_HSE_Enable(); + + if ((LL_RCC_HSE_IsReady() != 0) && (RadioState == SCM_RADIO_ACTIVE)) + { + /** + * The current system configuration is: + * Range1, HDIV5 cleared, HSEPRE cleared + */ + + /* Switch System Clock on HSE32 */ + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSE); + + while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSE); + + scm_setwaitstates(HSE32); /* There is no limitation when in Range1 */ + + /* As system switched to HSE, disable HSI */ + LL_RCC_HSI_Disable(); + + /* Check if the clock system used PLL before low power mode entry */ + if(scm_system_clock_config.targeted_clock_freq == SYS_PLL) + { + /* Configure system clock to use PLL */ + ConfigStartPll(); + } + + /* Ensure time base clock coherency */ + SystemCoreClockUpdate(); + } + else + { + scm_setwaitstates(HSE16); + + /* Check if the system need to increase VOS range (clock frequency higher than HSE 16Mhz)*/ + if(scm_system_clock_config.targeted_clock_freq != HSE_16MHZ) + { + /* Set VOS to range 1 */ + LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1); + } + + if (LL_RCC_HSE_IsReady() != 0) + { + scm_hserdy_isr(); + } + else + { + /* Enable HSERDY interrupt */ + __HAL_RCC_ENABLE_IT(RCC_IT_HSERDY); + } + } + SYSTEM_DEBUG_SIGNAL_RESET(SCM_SETUP); +} + +/** + * @brief Configure the PLL mode and parameters before PLL selection as system clock. + * @param p_pll_config PLL coniguration to apply + * @retval None + * @note scm_pll_setconfig to be called before PLL activation (PLL set as system core clock) + */ +void scm_pll_setconfig(const scm_pll_config_t *p_pll_config) +{ + /* Initial PLL configuration */ + scm_system_clock_config.pll.PLLM = p_pll_config->PLLM; + scm_system_clock_config.pll.PLLN = p_pll_config->PLLN; + scm_system_clock_config.pll.PLLP = p_pll_config->PLLP; + scm_system_clock_config.pll.PLLQ = p_pll_config->PLLQ; + scm_system_clock_config.pll.PLLR = p_pll_config->PLLR; + scm_system_clock_config.pll.PLLFractional = p_pll_config->PLLFractional; + scm_system_clock_config.pll.pll_mode = p_pll_config->pll_mode; + scm_system_clock_config.pll.AHB5_PLL1_CLKDivider = p_pll_config->AHB5_PLL1_CLKDivider; + + ConfigHwPll(&scm_system_clock_config.pll); +} + +/** + * @brief Configure the PLL for switching fractional parameters on the fly. + * @param pll_frac Up to date fractional configuration. + * @retval None + * @note A PLL update is requested only when the system clock is + * running on the PLL with a different configuration that the + * one required + */ +void scm_pll_fractional_update(uint32_t pll_frac) +{ + /* PLL1FRACEN set to 0 */ + LL_RCC_PLL1FRACN_Disable(); + + /* Update PLL1FRACR register */ + LL_RCC_PLL1_SetFRACN(pll_frac); + + /* PLL1FRACEN set to 1 */ + LL_RCC_PLL1FRACN_Enable(); + + /* Ensure time base clock coherency */ + SystemCoreClockUpdate(); +} + +/** + * @brief Set the system clock to the requested frequency. + * @param user_id This parameter can be one of the following: + * @arg SCM_USER_APP + * @arg SCM_USER_LL_FW + * @param sysclockconfig This parameter can be one of the following: + * @arg HSE_16MHZ + * @arg HSE_32MHZ + * @arg SYS_PLL + * @retval None + */ +void scm_setsystemclock(scm_user_id_t user_id, scm_clockconfig_t sysclockconfig) +{ + scm_clockconfig_t max_freq_requested; + + UTILS_ENTER_LIMITED_CRITICAL_SECTION(RCC_INTR_PRIO<<4); + + /* Register the request by updating the requested frequency for this user */ + scm_system_clock_requests[user_id] = sysclockconfig; + + /* Get the higher frequency required by the clients */ + max_freq_requested = scm_getmaxfreq(); + + /* Check if we need to apply another clock frequency */ + if(scm_system_clock_config.targeted_clock_freq != max_freq_requested) + { + scm_system_clock_config.targeted_clock_freq = max_freq_requested; + + /* Check the current system clock source (HSI or HSE) */ + if(LL_RCC_GetSysClkSource() == LL_RCC_SYS_CLKSOURCE_STATUS_HSI) + { + /* HSI is still the system clock */ + + if(scm_system_clock_config.targeted_clock_freq == HSE_16MHZ) + { + /* The system clock target is HSE 16Mhz */ + + /* Clear VOS (Range 2) */ + LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE2); + } + else + { + /* The system clock target is higher than HSE 16Mhz */ + + /* Set VOS (Range 1) */ + LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1); + + if(RadioState != SCM_RADIO_NOT_ACTIVE) + { + /* Disable HSERDY interrupt */ + __HAL_RCC_DISABLE_IT(RCC_IT_HSERDY); + + /* Wait until VOS has changed */ + while (LL_PWR_IsActiveFlag_VOS() == 0); + + /* Wait until HSE is ready */ + while (LL_RCC_HSE_IsReady() == 0); + + LL_RCC_HSE_DisablePrescaler(); + + /* Switch to HSE */ + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSE); + while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSE); + + scm_setwaitstates(HSE32); /* There is no limitation when in Range1 */ + + LL_RCC_SetAHB5Divider(LL_RCC_AHB5_DIVIDER_1); + + LL_RCC_HSI_Disable(); + + /* Check if PLL is requested */ + if(scm_system_clock_config.targeted_clock_freq == SYS_PLL) + { + /* Configure system clock to use PLL */ + ConfigStartPll(); + } + + /* Ensure time base clock coherency */ + SystemCoreClockUpdate(); + } + } + + /* System clock is going to be configured in RCC HSERDY interrupt */ + } + else + { + /* HSE is already the system clock source */ + /* Configure the system clock */ + scm_systemclockconfig(); + } + } + else if(scm_system_clock_config.targeted_clock_freq == SYS_PLL) + { + /* PLL has requested but system clock is already on PLL */ + scm_pllready(); + } + + UTILS_EXIT_LIMITED_CRITICAL_SECTION(); +} + +/** + * @brief Called each time the PLL is ready + * @param None + * @retval None + * @note This function is defined as weak in SCM module. + * Can be overridden by user. + */ +__WEAK void scm_pllready(void) +{ + /* To be override by user */ +} + +/** + * @brief Configure the Flash and SRAMs wait cycle (when required for system clock source change) + * @param ws_lp_config: This parameter can be one of the following: + * @arg LP + * @arg RUN + * @arg HSE16 + * @arg HSE32 + * @arg PLL + * @retval None + */ +void scm_setwaitstates(const scm_ws_lp_t ws_lp_config) +{ + /* Configure flash and SRAMs */ + switch (ws_lp_config) { + case LP: + __HAL_FLASH_SET_LATENCY(FLASH_LATENCY_3); + while(__HAL_FLASH_GET_LATENCY() != FLASH_LATENCY_3); + HAL_RAMCFG_ConfigWaitState(&sram1_ns, RAMCFG_WAITSTATE_1); + HAL_RAMCFG_ConfigWaitState(&sram2_ns, RAMCFG_WAITSTATE_1); + break; + + case RUN: + __HAL_FLASH_SET_LATENCY(scm_system_clock_config.flash_ws_cfg); + while(__HAL_FLASH_GET_LATENCY() != scm_system_clock_config.flash_ws_cfg); + HAL_RAMCFG_ConfigWaitState(&sram1_ns, scm_system_clock_config.sram_ws_cfg); + HAL_RAMCFG_ConfigWaitState(&sram2_ns, scm_system_clock_config.sram_ws_cfg); + break; + + case HSE16: + __HAL_FLASH_SET_LATENCY(FLASH_LATENCY_1); + while(__HAL_FLASH_GET_LATENCY() != FLASH_LATENCY_1); + HAL_RAMCFG_ConfigWaitState(&sram1_ns, RAMCFG_WAITSTATE_1); + HAL_RAMCFG_ConfigWaitState(&sram2_ns, RAMCFG_WAITSTATE_1); + + scm_system_clock_config.flash_ws_cfg = FLASH_LATENCY_1; + scm_system_clock_config.sram_ws_cfg = RAMCFG_WAITSTATE_1; + + break; + + case HSE32: + __HAL_FLASH_SET_LATENCY(FLASH_LATENCY_0); + while(__HAL_FLASH_GET_LATENCY() != FLASH_LATENCY_0); + HAL_RAMCFG_ConfigWaitState(&sram1_ns, RAMCFG_WAITSTATE_0); + HAL_RAMCFG_ConfigWaitState(&sram2_ns, RAMCFG_WAITSTATE_0); + + scm_system_clock_config.flash_ws_cfg = FLASH_LATENCY_0; + scm_system_clock_config.sram_ws_cfg = RAMCFG_WAITSTATE_0; + + break; + + case PLL: + /* RAM latencies are alreadey set to 0WS */ + /* Set Flash LATENCY according to PLL configuration */ + /* BELOW CONFIGURATION IS WORST CASE, SHALL BE OPTIMIZED */ + __HAL_FLASH_SET_LATENCY(FLASH_LATENCY_3); + while(__HAL_FLASH_GET_LATENCY() != FLASH_LATENCY_3); + scm_system_clock_config.flash_ws_cfg = FLASH_LATENCY_3; + break; + + default: + break; + } +} + +/** + * @brief SCM HSERDY interrupt handler. + * Switch system clock on HSE. + * @param None + * @retval None + */ +void scm_hserdy_isr(void) +{ + SYSTEM_DEBUG_SIGNAL_SET(SCM_HSERDY_ISR); + + if(LL_RCC_GetSysClkSource() == LL_RCC_SYS_CLKSOURCE_STATUS_HSI) + { + /* Wait until VOS has changed */ + while (LL_PWR_IsActiveFlag_VOS() == 0); + + if(scm_system_clock_config.targeted_clock_freq == HSE_16MHZ) + { + /** + * The current system configuration is: + * Range2, HDIV5 set, Wait States compliant to HSE16 + */ + LL_RCC_HSE_EnablePrescaler(); + /* Switch to HSE */ + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSE); + while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSE); + } + else + { + /** + * The current system configuration is: + * Range1 + */ + + LL_RCC_HSE_DisablePrescaler(); + + /* Switch to HSE */ + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSE); + while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSE); + + scm_setwaitstates(HSE32); /* There is no limitation when in Range1 */ + + if(scm_system_clock_config.targeted_clock_freq == SYS_PLL) + { + /* The system clock target is based on PLL */ + + /* Configure and start PLL */ + ConfigStartPll(); + } + + /* Set HDIV 5 */ + LL_RCC_SetAHB5Divider(LL_RCC_AHB5_DIVIDER_1); /* divided by 1 */ + } + + /* As system switched to HSE, disable HSI */ + SCM_HSI_CLK_OFF(); + + /* Disable HSERDY interrupt */ + __HAL_RCC_DISABLE_IT(RCC_IT_HSERDY); + + /* Ensure time base clock coherency */ + SystemCoreClockUpdate(); + } + + SYSTEM_DEBUG_SIGNAL_RESET(SCM_HSERDY_ISR); +} + +/** + * @brief SCM PLLRDY interrupt handler. + * Switch system clock on PLL. + * @param None + * @retval None + */ +void scm_pllrdy_isr(void) +{ + if(scm_system_clock_config.targeted_clock_freq == SYS_PLL) + { + /* Set PLL compatible waitstates */ + scm_setwaitstates(PLL); + + /* Switch to PLL */ + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL1R); + while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL1R); + + /* Ensure time base clock coherency */ + SystemCoreClockUpdate(); + + scm_pllready(); + } + else + { + /** + * The PLL was enabled but is not used anymore as system clock + * The only case is when a request has been made and cancelled before + * the system had time to switch the system clock on PLL + */ + /* Disable PLL */ + LL_RCC_PLL1_Disable(); + + /* Disable PLL1RDY interrupt */ + __HAL_RCC_DISABLE_IT(RCC_IT_PLL1RDY); + } +} + +/** + * @brief Notify the state of the Radio + * @param radio_state: This parameter can be one of the following: + * @arg SCM_RADIO_ACTIVE + * @arg SCM_RADIO_NOT_ACTIVE + * @retval None + */ +void scm_notifyradiostate(const scm_radio_state_t radio_state) +{ + if(radio_state != SCM_RADIO_NOT_ACTIVE) + { + RadioState = SCM_RADIO_ACTIVE; /* shall be set before calling scm_setsystemclock() */ + scm_setsystemclock(SCM_USER_LL_FW, HSE_32MHZ); /* shall be set before calling scm_setsystemclock() */ + } + else + { + RadioState = SCM_RADIO_NOT_ACTIVE; + scm_setsystemclock(SCM_USER_LL_FW, HSE_16MHZ); + } +} + +/** + * @brief Restore system clock configuration when moving out of standby. + * @param None + * @retval None + */ +void scm_standbyexit(void) +{ + if(scm_system_clock_config.pll.are_pll_params_initialized == 1) + { + /* Restore PLL even if not yet used in case it has been setup upfron at initialization */ + ConfigHwPll(&scm_system_clock_config.pll); + } + + scm_setup(); +} + +#else /* CFG_SCM_SUPPORTED */ +void scm_pllrdy_isr(void){/* Intentionally enpty */} +void scm_hserdy_isr(void){/* Intentionally enpty */} +#endif /* CFG_SCM_SUPPORTED */ diff --git a/lib/stm32wba/hci/scm.h b/lib/stm32wba/hci/scm.h new file mode 100644 index 000000000..5981d21f6 --- /dev/null +++ b/lib/stm32wba/hci/scm.h @@ -0,0 +1,223 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file scm.h + * @author MCD Application Team + * @brief Header for scm.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef SCM_H +#define SCM_H + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" + +#if (CFG_SCM_SUPPORTED == 1) +#include "stm32wbaxx_hal.h" +#include "stm32wbaxx_ll_pwr.h" +#include "stm32wbaxx_ll_rcc.h" + +/* Exported types ------------------------------------------------------------*/ +typedef enum { + NO_CLOCK_CONFIG = 0, + HSE_16MHZ, + HSE_32MHZ, + SYS_PLL, +} scm_clockconfig_t; + +typedef enum { + LP, + RUN, + HSE16, + HSE32, + PLL, +} scm_ws_lp_t; + +typedef enum { + HSEPRE_DISABLE = 0, + HSEPRE_ENABLE +} scm_hse_hsepre_t; + +typedef enum { + SCM_USER_APP, + SCM_USER_LL_FW, + TOTAL_CLIENT_NUM, /* To be at the end of the enum */ +} scm_user_id_t; + +typedef enum { + NO_PLL, + PLL_INTEGER_MODE, + PLL_FRACTIONAL_MODE, +} scm_pll_mode_t; + +typedef enum { + SCM_RADIO_NOT_ACTIVE, + SCM_RADIO_ACTIVE, +} scm_radio_state_t; + +typedef struct { + uint8_t are_pll_params_initialized; + scm_pll_mode_t pll_mode; + uint32_t PLLM; + uint32_t PLLN; + uint32_t PLLP; + uint32_t PLLQ; + uint32_t PLLR; + uint32_t PLLFractional; + uint32_t AHB5_PLL1_CLKDivider; +} scm_pll_config_t; + +typedef struct{ + scm_clockconfig_t targeted_clock_freq; + uint32_t flash_ws_cfg; + uint32_t sram_ws_cfg; + scm_pll_config_t pll; +} scm_system_clock_t; + +/* Exported constants --------------------------------------------------------*/ +/* Exported variables --------------------------------------------------------*/ + +/* Exported macro ------------------------------------------------------------*/ +/* Exported functions prototypes ---------------------------------------------*/ + +/** + * @brief System Clock Manager init code + * @param None + * @retval None + */ +void scm_init(void); + +/** + * @brief Setup the system clock source in usable configuration for Connectivity use cases. + * Called at startup or out of low power modes. + * @param None + * @retval None + */ +void scm_setup(void); + +/** + * @brief Configure the PLL mode and parameters before PLL selection as system clock. + * @param p_pll_config PLL coniguration to apply + * @retval None + * @note scm_pll_setconfig to be called before PLL activation (PLL set as system core clock) + */ +void scm_pll_setconfig(const scm_pll_config_t *p_pll_config); + +/** + * @brief Restore system clock configuration when moving out of standby. + * @param None + * @retval None + */ +void scm_standbyexit(void); + +/** + * @brief Configure the PLL for switching fractional parameters on the fly. + * @param pll_frac Up to date fractional configuration. + * @retval None + * @note A PLL update is requested only when the system clock is + * running on the PLL with a different configuration that the + * one required. + */ +void scm_pll_fractional_update(uint32_t pll_frac); + +/** + * @brief Set the HSE clock to the requested frequency. + * @param user_id This parameter can be one of the following: + * @arg SCM_USER_APP + * @arg SCM_USER_LL_FW + * @param sysclockconfig This parameter can be one of the following: + * @arg HSE_16MHZ + * @arg HSE_32MHZ + * @arg SYS_PLL + * @retval None + */ +void scm_setsystemclock (scm_user_id_t user_id, scm_clockconfig_t sysclockconfig); + +/** + * @brief Called each time the PLL is ready + * @param None + * @retval None + * @note This function is defined as weak in SCM module. + * Can be overridden by user. + */ +void scm_pllready(void); + +/** + * @brief Configure the Flash and SRAMs wait cycle (when required for system clock source change) + * @param ws_lp_config: This parameter can be one of the following: + * @arg LP + * @arg RUN + * @arg HSE16 + * @arg HSE32 + * @arg PLL + * @retval None + */ +void scm_setwaitstates(const scm_ws_lp_t ws_lp_config); + +/** + * @brief Notify the state of the Radio + * @param radio_state: This parameter can be one of the following: + * @arg SCM_RADIO_ACTIVE + * @arg SCM_RADIO_NOT_ACTIVE + * @retval None + */ +void scm_notifyradiostate(const scm_radio_state_t radio_state); + +/** + * @brief SCM HSERDY interrupt handler. + * Switch system clock on HSE. + * @param None + * @retval None + */ +void scm_hserdy_isr(void); + +/** + * @brief SCM PLLRDY interrupt handler. + * Switch system clock on PLL. + * @param None + * @retval None + */ +void scm_pllrdy_isr(void); + +/* Exported functions - To be implemented by the user ------------------------- */ + +/** + * @brief SCM HSI clock enable + * @details A weak version is implemented in the module sources. + * @details It can be overridden by user. + * @param None + * @retval None + */ +extern void SCM_HSI_CLK_ON(void); + +/** + * @brief SCM HSI clock disable + * @details A weak version is implemented in the module sources. + * @details It can be overridden by user. + * @param None + * @retval None + */ +extern void SCM_HSI_CLK_OFF(void); + +#else /* CFG_SCM_SUPPORTED */ + +/* Unused empty functions */ +void scm_hserdy_isr(void); +void scm_pllrdy_isr(void); + +#endif /* CFG_SCM_SUPPORTED */ + +#endif /* SCM_H */ diff --git a/lib/stm32wba/hci/stm32_adv_trace.h b/lib/stm32wba/hci/stm32_adv_trace.h new file mode 100644 index 000000000..ee2b6fdb3 --- /dev/null +++ b/lib/stm32wba/hci/stm32_adv_trace.h @@ -0,0 +1,273 @@ +/** + ****************************************************************************** + * @file stm32_adv_trace.h + * @author MCD Application Team + * @brief Header for stm32_adv_trace.c +****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** +*/ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __ADV_TRACE_H +#define __ADV_TRACE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stdint.h" +#include "utilities_conf.h" + +/** @defgroup ADV_TRACE advanced tracer + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup ADV_TRACE_exported_TypeDef ADV_TRACE exported Typedef + * @{ + */ + +/** + * @brief prototype of the time stamp function. + */ +typedef void cb_timestamp(uint8_t *pData, uint16_t *Size); + +/** + * @brief prototype of the overrun function. + */ +typedef void cb_overrun(uint8_t **pData, uint16_t *size); +/** + * @brief List the Advanced trace function status. + * list of the returned status value, any negative value is corresponding to an error. + */ +typedef enum{ + UTIL_ADV_TRACE_OK = 0, /*!< Operation terminated successfully.*/ + UTIL_ADV_TRACE_INVALID_PARAM = -1, /*!< Invalid Parameter. */ + UTIL_ADV_TRACE_HW_ERROR = -2, /*!< Hardware Error. */ + UTIL_ADV_TRACE_MEM_FULL = -3, /*!< Memory fifo full. */ + UTIL_ADV_TRACE_UNKNOWN_ERROR = -4, /*!< Unknown Error. */ +#if defined(UTIL_ADV_TRACE_CONDITIONNAL) + UTIL_ADV_TRACE_GIVEUP = -5, /*!< trace give up */ + UTIL_ADV_TRACE_REGIONMASKED = -6 /*!< trace region masked */ +#endif +} UTIL_ADV_TRACE_Status_t; + +/** + * @brief Advanced trace driver definition + */ +typedef struct { + UTIL_ADV_TRACE_Status_t (* Init)(void (*cb)(void *ptr)); /*!< Media initialization. */ + UTIL_ADV_TRACE_Status_t (* DeInit)(void); /*!< Media Un-initialization. */ + UTIL_ADV_TRACE_Status_t (* StartRx)(void (*cb)(uint8_t *pdata, uint16_t size, uint8_t error)); /*!< Media to start RX process. */ + UTIL_ADV_TRACE_Status_t (* Send)(uint8_t *pdata, uint16_t size); /*!< Media to send data. */ +}UTIL_ADV_TRACE_Driver_s; + +/** + * @} + */ + +/* External variables --------------------------------------------------------*/ +/** @defgroup ADV_TRACE_exported_variables ADV_TRACE exported variables + * + * @{ + */ +/** + * @brief This structure is the linked with the IF layer implementation. + */ +extern const UTIL_ADV_TRACE_Driver_s UTIL_TraceDriver; + +/** + * @} + */ + +/* Exported constants --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +/** @defgroup ADV_TRACE_exported_function ADV_TRACE exported function + * @{ + */ + +/** + * @brief TraceInit Initializes Logging feature + * @retval Status based on @ref UTIL_ADV_TRACE_Status_t + */ +UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_Init(void); + +/** + * @brief TraceDeInit module DeInitializes. + * @retval Status based on @ref UTIL_ADV_TRACE_Status_t + */ +UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_DeInit(void); + +/** + * @brief this function check if the buffer is empty. + * @retval 1 if the buffer is empty else 0 + */ +uint8_t UTIL_ADV_TRACE_IsBufferEmpty(void); + +/** + * @brief start the RX process. + * @param UserCallback ptr function used to get the RX data + * @retval Status based on @ref UTIL_ADV_TRACE_Status_t + */ +UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_StartRxProcess(void (*UserCallback)(uint8_t *PData, uint16_t Size, uint8_t Error)); + +/** + * @brief TraceSend decode the strFormat and post it to the circular queue for printing + * @param strFormat Trace message and format + * @retval Status based on @ref UTIL_ADV_TRACE_Status_t + */ +UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_FSend(const char *strFormat, ...); + +/** + * @brief post data to the circular queue + * @param *pdata pointer to Data + * @param length length of data buffer to be sent + * @retval Status based on @ref UTIL_ADV_TRACE_Status_t + */ +UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_Send(const uint8_t *pdata, uint16_t length); + +/** + * @brief ZCSend_Allocation allocate the memory and return information to write the data + * @param Length trase size + * @param pData pointer on the fifo + * @param FifoSize size of the fifo + * @param WritePos write position of the fifo + * @retval Status based on @ref UTIL_ADV_TRACE_Status_t + */ +UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_ZCSend_Allocation(uint16_t Length, uint8_t **pData, uint16_t *FifoSize, uint16_t *WritePos); + +/** + * @brief ZCSend finalize the data transfer + * @retval Status based on @ref UTIL_ADV_TRACE_Status_t + */ +UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_ZCSend_Finalize(void); +/** + * @brief Trace send started hook + * @retval None + */ + +/** + * @brief Trace send pre hook function + */ +void UTIL_ADV_TRACE_PreSendHook(void); + +/** + * @brief Trace send post hook function + */ +void UTIL_ADV_TRACE_PostSendHook(void); + +#if defined(UTIL_ADV_TRACE_OVERRUN) +/** + * @brief Register a function used to add overrun info inside the trace + * @param cb pointer of function to return overrun information + */ +void UTIL_ADV_TRACE_RegisterOverRunFunction(cb_overrun *cb); +#endif + +#if defined(UTIL_ADV_TRACE_CONDITIONNAL) + +/** + * @brief conditional FSend decode the strFormat and post it to the circular queue for printing + * @param VerboseLevel verbose level of the trace + * @param Region region of the trace + * @param TimeStampState 0 no time stamp insertion, 1 time stamp inserted inside the trace data + * @param strFormat formatted string + * @retval Status based on @ref UTIL_ADV_TRACE_Status_t + */ +UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_COND_FSend(uint32_t VerboseLevel, uint32_t Region,uint32_t TimeStampState, const char *strFormat, ...); + +/** + * @brief conditional ZCSend Write user formatted data directly in the FIFO (Z-Cpy) + * @param VerboseLevel verbose level of the trace + * @param Region region of the trace + * @param TimeStampState 0 no time stamp insertion, 1 time stamp inserted inside the trace data + * @param length data length + * @param pData pointer on the fifo + * @param FifoSize size of the fifo + * @param WritePos write position of the fifo + * @retval Status based on @ref UTIL_ADV_TRACE_Status_t + */ +UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_COND_ZCSend_Allocation(uint32_t VerboseLevel, uint32_t Region, uint32_t TimeStampState, uint16_t length,uint8_t **pData, uint16_t *FifoSize, uint16_t *WritePos); + +/** + * @brief conditional ZCSend finalize the data transfer + * @retval Status based on @ref UTIL_ADV_TRACE_Status_t + */ +UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_COND_ZCSend_Finalize(void); + +/** + * @brief confitionnal Send post data to the circular queue + * @param VerboseLevel verbose level of the trace + * @param Region region of the trace + * @param TimeStampState 0 no time stamp insertion, 1 time stamp inserted inside the trace data + * @param *pdata pointer to Data + * @param length length of data buffer ro be sent + * @retval Status based on @ref UTIL_ADV_TRACE_Status_t + */ +UTIL_ADV_TRACE_Status_t UTIL_ADV_TRACE_COND_Send(uint32_t VerboseLevel, uint32_t Region, uint32_t TimeStampState, const uint8_t *pdata, uint16_t length); + +/** + * @brief Register a function used to add timestamp inside the trace + * @param cb pointer of function to return timestamp information + */ +void UTIL_ADV_TRACE_RegisterTimeStampFunction(cb_timestamp *cb); + +/** + * @brief Set the verbose level + * @param Level (0 to 255) + * @retval None + */ +void UTIL_ADV_TRACE_SetVerboseLevel(uint8_t Level); + +/** + * @brief Get the verbose level + * @retval verbose level + */ +uint8_t UTIL_ADV_TRACE_GetVerboseLevel(void); + +/** + * @brief add to the mask a bit field region. + * @param Region bit field of region to enable + * @retval None + */ +void UTIL_ADV_TRACE_SetRegion(uint32_t Region); + +/** + * @brief add to the mask a bit field region. + * @retval None + */ +uint32_t UTIL_ADV_TRACE_GetRegion(void); + +/** + * @brief remove from the mask a bit field region. + * @param Region Region bit field of region to disable + * @retval None + */ +void UTIL_ADV_TRACE_ResetRegion(uint32_t Region); + +#endif + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /*__ADV_TRACE_H */ diff --git a/lib/stm32wba/hci/stm32_mem.h b/lib/stm32wba/hci/stm32_mem.h new file mode 100644 index 000000000..dc64ed389 --- /dev/null +++ b/lib/stm32wba/hci/stm32_mem.h @@ -0,0 +1,70 @@ +/** + ****************************************************************************** + * @file stm32_mem.h + * @author MCD Application Team + * @brief standard memory operation + ****************************************************************************** + * @attention + * + * Copyright (c) 2019 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32_MEM_H__ +#define __STM32_MEM_H__ + +#ifdef __cplusplus +extern "C" +{ +#endif +/* Includes ------------------------------------------------------------------*/ +#include +#include "utilities_conf.h" + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/* ---- Memory mapping macros ----------------------------------------------- */ +#define UTIL_MEM_PLACE_IN_SECTION( __x__ ) UTIL_PLACE_IN_SECTION( __x__ ) +#define UTIL_MEM_ALIGN ALIGN + +/* Exported functions ------------------------------------------------------- */ +/** +* @brief This API copies one buffer to another +* @param dst: output buffer to be filled +* @param src: input buffer +* @param size: size of 8b data +* @retval None +*/ +void UTIL_MEM_cpy_8( void *dst, const void *src, uint16_t size ); + +/** +* @brief This API copies one buffer to another in reverse +* @param dst: output buffer to be filled +* @param src: input buffer +* @param size: size of 8b data +* @retval None +*/ +void UTIL_MEM_cpyr_8( void *dst, const void *src, uint16_t size ); + +/** +* @brief This API fills a buffer with value +* @param dst: output buffer to be filled +* @param value: value +* @param size: size of 8b data +* @retval None +*/ +void UTIL_MEM_set_8( void *dst, uint8_t value, uint16_t size ); + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32_MEM_H__ */ diff --git a/lib/stm32wba/hci/stm32_timer.h b/lib/stm32wba/hci/stm32_timer.h new file mode 100644 index 000000000..9256b7736 --- /dev/null +++ b/lib/stm32wba/hci/stm32_timer.h @@ -0,0 +1,303 @@ +/*! + * \file timer.h + * + * \brief Timer objects and scheduling management implementation + * + * \copyright Revised BSD License, see section \ref LICENSE. + * + * \code + * ______ _ + * / _____) _ | | + * ( (____ _____ ____ _| |_ _____ ____| |__ + * \____ \| ___ | (_ _) ___ |/ ___) _ \ + * _____) ) ____| | | || |_| ____( (___| | | | + * (______/|_____)_|_|_| \__)_____)\____)_| |_| + * (C)2013-2017 Semtech + * + * \endcode + * + * \author Miguel Luis ( Semtech ) + * + * \author Gregory Cristian ( Semtech ) + */ + +/****************************************************************************** + * @file stm32_timer.h + * @author MCD Application Team + * @brief This is the header of the timer server driver + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef UTIL_TIME_SERVER_H__ +#define UTIL_TIME_SERVER_H__ + +#ifdef __cplusplus + + extern "C" { +#endif + + /** @defgroup TIMER_SERVER timer server + * @{ + */ + +/* Includes ------------------------------------------------------------------*/ +#include +#include +#include +#include +#include "utilities_conf.h" + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup TIMER_SERVER_exported_TypeDef TIMER_SERVER exported Typedef + * @{ + */ + +/** + * @brief Timer mode + */ +typedef enum { + UTIL_TIMER_ONESHOT = 0, /*! +#include +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + +/** + * @brief Tiny implementation of vsnprintf() like function + * + * It has been adapted so that: + * - Tiny implementation, when defining TINY_PRINTF, is available. In such as case, + * not all the format are available. Instead, only %02X, %x, %d, %u, %s and %c are available. + * %f,, %+, %#, %- and others are excluded + * - Provide a snprintf like implementation. The size of the buffer is provided, + * and the length of the filled buffer is returned (not including the final '\0' char). + * The string may be truncated + * @param Pointer to a buffer where the resulting C-string is stored. The buffer should have a size of + * at least n characters. + * @param Maximum number of bytes to be used in the buffer. The generated string has a length of at + * most n-1, leaving space for the additional terminating null character. + * @param C string that contains a format string that follows the same specifications as format + * in printf (see printf for details). + * @param A value identifying a variable arguments list initialized with va_start. + * @retval The number of written char (note that this is different from vsnprintf() + */ +int tiny_vsnprintf_like(char *buf, const int size, const char *fmt, va_list args); + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32_TINY_VSNPRINTF_H__ */ diff --git a/lib/stm32wba/hci/stm32_wpan_common.h b/lib/stm32wba/hci/stm32_wpan_common.h new file mode 100644 index 000000000..19a4ccf3d --- /dev/null +++ b/lib/stm32wba/hci/stm32_wpan_common.h @@ -0,0 +1,130 @@ +/** + ****************************************************************************** + * @file stm32_wpan_common.h + * @author MCD Application Team + * @brief Common file to utilities + ***************************************************************************** + * @attention + * + * Copyright (c) 2018-2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ***************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32_WPAN_COMMON_H +#define __STM32_WPAN_COMMON_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include "cmsis_compiler.h" + + /* -------------------------------- * + * Basic definitions * + * -------------------------------- */ + +#undef NULL +#define NULL 0U + +#undef FALSE +#define FALSE 0U + +#undef TRUE +#define TRUE (!0U) + + /* -------------------------------- * + * Critical Section definition * + * -------------------------------- */ +#undef BACKUP_PRIMASK +#define BACKUP_PRIMASK() uint32_t primask_bit= __get_PRIMASK() + +#undef DISABLE_IRQ +#define DISABLE_IRQ() __disable_irq() + +#undef RESTORE_PRIMASK +#define RESTORE_PRIMASK() __set_PRIMASK(primask_bit) + + /* -------------------------------- * + * Macro delimiters * + * -------------------------------- */ +#undef M_BEGIN +#define M_BEGIN do { + +#undef M_END +#define M_END } while(0) + + /* -------------------------------- * + * Some useful macro definitions * + * -------------------------------- */ +#undef MAX +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) + +#undef MIN +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) + +#undef MODINC +#define MODINC( a, m ) M_BEGIN (a)++; if ((a)>=(m)) (a)=0; M_END + +#undef MODDEC +#define MODDEC( a, m ) M_BEGIN if ((a)==0) (a)=(m); (a)--; M_END + +#undef MODADD +#define MODADD( a, b, m ) M_BEGIN (a)+=(b); if ((a)>=(m)) (a)-=(m); M_END + +#undef MODSUB +#define MODSUB( a, b, m ) MODADD( a, (m)-(b), m ) + +#undef ALIGN +#ifdef WIN32 +#define ALIGN(n) +#else +#define ALIGN(n) __attribute__((aligned(n))) +#endif + +#undef PAUSE +#define PAUSE( t ) M_BEGIN \ + volatile int _i; \ + for ( _i = t; _i > 0; _i -- ); \ + M_END +#undef DIVF +#define DIVF( x, y ) ((x)/(y)) + +#undef DIVC +#define DIVC( x, y ) (((x)+(y)-1)/(y)) + +#undef DIVR +#define DIVR( x, y ) (((x)+((y)/2))/(y)) + +#undef SHRR +#define SHRR( x, n ) ((((x)>>((n)-1))+1)>>1) + +#undef BITN +#define BITN( w, n ) (((w)[(n)/32] >> ((n)%32)) & 1) + +#undef BITNSET +#define BITNSET( w, n, b ) M_BEGIN (w)[(n)/32] |= ((U32)(b))<<((n)%32); M_END + +/* -------------------------------- * + * Section attribute * + * -------------------------------- */ +#undef PLACE_IN_SECTION +#define PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__))) + +#ifdef __cplusplus +} +#endif + +#endif /*__STM32_WPAN_COMMON_H */ diff --git a/lib/stm32wba/hci/utilities_common.h b/lib/stm32wba/hci/utilities_common.h new file mode 100644 index 000000000..4a040c0d0 --- /dev/null +++ b/lib/stm32wba/hci/utilities_common.h @@ -0,0 +1,144 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file utilities_common.h + * @author MCD Application Team + * @brief Common file to utilities + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef UTILITIES_COMMON_H +#define UTILITIES_COMMON_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include + +#include "app_conf.h" + + /* -------------------------------- * + * Basic definitions * + * -------------------------------- */ + +#undef NULL +#define NULL 0 + +#undef FALSE +#define FALSE 0 + +#undef TRUE +#define TRUE (!0) + + /* -------------------------------- * + * Critical Section definition * + * -------------------------------- */ +#undef BACKUP_PRIMASK +#define BACKUP_PRIMASK() uint32_t primask_bit= __get_PRIMASK() + +#undef DISABLE_IRQ +#define DISABLE_IRQ() __disable_irq() + +#undef RESTORE_PRIMASK +#define RESTORE_PRIMASK() __set_PRIMASK(primask_bit) + + /* -------------------------------- * + * Macro delimiters * + * -------------------------------- */ +#undef M_BEGIN +#define M_BEGIN do { + +#undef M_END +#define M_END } while(0) + + /* -------------------------------- * + * Some useful macro definitions * + * -------------------------------- */ +#undef MAX +#define MAX( x, y ) (((x)>(y))?(x):(y)) + +#undef MIN +#define MIN( x, y ) (((x)<(y))?(x):(y)) + +#undef MODINC +#define MODINC( a, m ) M_BEGIN (a)++; if ((a)>=(m)) (a)=0; M_END + +#undef MODDEC +#define MODDEC( a, m ) M_BEGIN if ((a)==0) (a)=(m); (a)--; M_END + +#undef MODADD +#define MODADD( a, b, m ) M_BEGIN (a)+=(b); if ((a)>=(m)) (a)-=(m); M_END + +#undef MODSUB +#define MODSUB( a, b, m ) MODADD( a, (m)-(b), m ) + +#undef ALIGN +#ifdef WIN32 +#define ALIGN(n) +#else +#define ALIGN(n) __attribute__((aligned(n))) +#endif + +#undef PAUSE +#define PAUSE( t ) M_BEGIN \ + volatile int _i; \ + for ( _i = t; _i > 0; _i -- ); \ + M_END +#undef DIVF +#define DIVF( x, y ) ((x)/(y)) + +#undef DIVC +#define DIVC( x, y ) (((x)+(y)-1)/(y)) + +#undef DIVR +#define DIVR( x, y ) (((x)+((y)/2))/(y)) + +#undef SHRR +#define SHRR( x, n ) ((((x)>>((n)-1))+1)>>1) + +#undef BITN +#define BITN( w, n ) (((w)[(n)/32] >> ((n)%32)) & 1) + +#undef BITNSET +#define BITNSET( w, n, b ) M_BEGIN (w)[(n)/32] |= ((U32)(b))<<((n)%32); M_END + +/* -------------------------------- * + * Section attribute * + * -------------------------------- */ +#define PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__))) + +#ifdef __cplusplus +} +#endif + +#define SYS_WAITING_CYCLES_25() do {\ + __asm("mov r0, r0");__asm("mov r0, r0");__asm("mov r0, r0");__asm("mov r0, r0");__asm("mov r0, r0");\ + __asm("mov r0, r0");__asm("mov r0, r0");__asm("mov r0, r0");__asm("mov r0, r0");__asm("mov r0, r0");\ + __asm("mov r0, r0");__asm("mov r0, r0");__asm("mov r0, r0");__asm("mov r0, r0");__asm("mov r0, r0");\ + __asm("mov r0, r0");__asm("mov r0, r0");__asm("mov r0, r0");__asm("mov r0, r0");__asm("mov r0, r0");\ + __asm("mov r0, r0");__asm("mov r0, r0");__asm("mov r0, r0");__asm("mov r0, r0");__asm("mov r0, r0");\ + } while(0) + +#define SYS_WAITING_RNGCLK_DEACTIVATION() do {\ + for(volatile unsigned int cpt = 178 ; cpt!=0 ; --cpt);\ + } while(0) + +#endif /* UTILITIES_COMMON_H */ + diff --git a/lib/stm32wba/hci/utilities_conf.h b/lib/stm32wba/hci/utilities_conf.h new file mode 100644 index 000000000..56d7d6718 --- /dev/null +++ b/lib/stm32wba/hci/utilities_conf.h @@ -0,0 +1,170 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file utilities_conf.h + * @author MCD Application Team + * @brief Header for configuration file for STM32 Utilities. + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef UTILITIES_CONF_H +#define UTILITIES_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "cmsis_compiler.h" + +/* definitions to be provided to "sequencer" utility */ +#include "stm32_mem.h" +/* definition and callback for tiny_vsnprintf */ +#include "stm32_tiny_vsnprintf.h" + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* Exported types ------------------------------------------------------------*/ +/* USER CODE BEGIN ET */ + +/* USER CODE END ET */ + +/* Exported constants --------------------------------------------------------*/ + +#define VLEVEL_OFF 0 /*!< used to set UTIL_ADV_TRACE_SetVerboseLevel() (not as message param) */ +#define VLEVEL_ALWAYS 0 /*!< used as message params, if this level is given + trace will be printed even when UTIL_ADV_TRACE_SetVerboseLevel(OFF) */ +#define VLEVEL_L 1 /*!< just essential traces */ +#define VLEVEL_M 2 /*!< functional traces */ +#define VLEVEL_H 3 /*!< all traces */ + +#define TS_OFF 0 /*!< Log without TimeStamp */ +#define TS_ON 1 /*!< Log with TimeStamp */ + +#define T_REG_OFF 0 /*!< Log without bitmask */ + +/* USER CODE BEGIN EC */ + +/* USER CODE END EC */ +/* External variables --------------------------------------------------------*/ +/* USER CODE BEGIN EV */ + +/* USER CODE END EV */ + +/* Exported macros -----------------------------------------------------------*/ +/** + * @brief Memory placement macro + */ +#if defined(__CC_ARM) +#define UTIL_PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__), zero_init)) +#elif defined(__ICCARM__) +#define UTIL_PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__))) +#else /* __GNUC__ */ +#define UTIL_PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__))) +#endif /* __CC_ARM | __ICCARM__ | __GNUC__ */ + +/** + * @brief Memory alignment macro + */ +#undef ALIGN +#ifdef WIN32 +#define ALIGN(n) +#else +#define ALIGN(n) __attribute__((aligned(n))) +#endif /* WIN32 */ + +/** + * @brief macro used to initialize the critical section + */ +#define UTIL_SEQ_INIT_CRITICAL_SECTION( ) UTILS_INIT_CRITICAL_SECTION() + +/** + * @brief macro used to enter the critical section + */ +#define UTIL_SEQ_ENTER_CRITICAL_SECTION( ) UTILS_ENTER_CRITICAL_SECTION() + +/** + * @brief macro used to exit the critical section + */ +#define UTIL_SEQ_EXIT_CRITICAL_SECTION( ) UTILS_EXIT_CRITICAL_SECTION() + +/** + * @brief Memset utilities interface to application + */ +#define UTIL_SEQ_MEMSET8( dest, value, size ) UTIL_MEM_set_8( dest, value, size ) + +/** + * @brief macro used to initialize the critical section + */ +#define UTILS_INIT_CRITICAL_SECTION() + +/** + * @brief macro used to enter the critical section + */ +#define UTILS_ENTER_CRITICAL_SECTION() uint32_t primask_bit= __get_PRIMASK();\ + __disable_irq() + +/** + * @brief macro used to exit the critical section + */ +#define UTILS_EXIT_CRITICAL_SECTION() __set_PRIMASK(primask_bit) + +/** + * @brief macro used to enter the critical section + */ +#define UTILS_ENTER_LIMITED_CRITICAL_SECTION(x) uint32_t basepri_value= __get_BASEPRI();\ + __set_BASEPRI_MAX(x) + +/** + * @brief macro used to exit the critical section + */ +#define UTILS_EXIT_LIMITED_CRITICAL_SECTION() __set_BASEPRI(basepri_value) + +/****************************************************************************** + * trace\advanced + * the define option + * UTIL_ADV_TRACE_CONDITIONNAL shall be defined if you want use conditional function + * UTIL_ADV_TRACE_UNCHUNK_MODE shall be defined if you want use the unchunk mode + * + ******************************************************************************/ + +#define UTIL_ADV_TRACE_CONDITIONNAL /*!< not used */ +#define UTIL_ADV_TRACE_UNCHUNK_MODE /*!< not used */ +#define UTIL_ADV_TRACE_DEBUG(...) /*!< not used */ +#define UTIL_ADV_TRACE_INIT_CRITICAL_SECTION( ) UTILS_INIT_CRITICAL_SECTION() /*!< init the critical section in trace feature */ +#define UTIL_ADV_TRACE_ENTER_CRITICAL_SECTION( ) UTILS_ENTER_CRITICAL_SECTION() /*!< enter the critical section in trace feature */ +#define UTIL_ADV_TRACE_EXIT_CRITICAL_SECTION( ) UTILS_EXIT_CRITICAL_SECTION() /*!< exit the critical section in trace feature */ +#define UTIL_ADV_TRACE_TMP_BUF_SIZE (256U) /*!< default trace buffer size */ +#define UTIL_ADV_TRACE_TMP_MAX_TIMESTMAP_SIZE (15U) /*!< default trace timestamp size */ +#define UTIL_ADV_TRACE_FIFO_SIZE (4096U) /*!< default trace fifo size */ +#define UTIL_ADV_TRACE_MEMSET8( dest, value, size) UTIL_MEM_set_8((dest),(value),(size)) /*!< memset utilities interface to trace feature */ +#define UTIL_ADV_TRACE_VSNPRINTF(...) vsnprintf(__VA_ARGS__) /*!< vsnprintf utilities interface to trace feature */ + +/* USER CODE BEGIN EM */ + +/* USER CODE END EM */ + +/* Exported functions prototypes ---------------------------------------------*/ +/* USER CODE BEGIN EFP */ + +/* USER CODE END EFP */ + +#ifdef __cplusplus +} +#endif + +#endif /*UTILITIES_CONF_H */ diff --git a/zephyr/blobs/stm32wba/lib/license.md b/zephyr/blobs/stm32wba/lib/license.md new file mode 100644 index 000000000..1af523307 --- /dev/null +++ b/zephyr/blobs/stm32wba/lib/license.md @@ -0,0 +1,80 @@ +SLA0044 Rev5/February 2018 + +## Software license agreement + +### __ULTIMATE LIBERTY SOFTWARE LICENSE AGREEMENT__ + +BY INSTALLING, COPYING, DOWNLOADING, ACCESSING OR OTHERWISE USING THIS SOFTWARE +OR ANY PART THEREOF (AND THE RELATED DOCUMENTATION) FROM STMICROELECTRONICS +INTERNATIONAL N.V, SWISS BRANCH AND/OR ITS AFFILIATED COMPANIES +(STMICROELECTRONICS), THE RECIPIENT, ON BEHALF OF HIMSELF OR HERSELF, OR ON +BEHALF OF ANY ENTITY BY WHICH SUCH RECIPIENT IS EMPLOYED AND/OR ENGAGED AGREES +TO BE BOUND BY THIS SOFTWARE LICENSE AGREEMENT. + +Under STMicroelectronics’ intellectual property rights, the redistribution, +reproduction and use in source and binary forms of the software or any part +thereof, with or without modification, are permitted provided that the following +conditions are met: + +1. Redistribution of source code (modified or not) must retain any copyright +notice, this list of conditions and the disclaimer set forth below as items 10 +and 11. + +2. Redistributions in binary form, except as embedded into microcontroller or +microprocessor device manufactured by or for STMicroelectronics or a software +update for such device, must reproduce any copyright notice provided with the +binary code, this list of conditions, and the disclaimer set forth below as +items 10 and 11, in documentation and/or other materials provided with the +distribution. + +3. Neither the name of STMicroelectronics nor the names of other contributors to +this software may be used to endorse or promote products derived from this +software or part thereof without specific written permission. + +4. This software or any part thereof, including modifications and/or derivative +works of this software, must be used and execute solely and exclusively on or in +combination with a microcontroller or microprocessor device manufactured by or +for STMicroelectronics. + +5. No use, reproduction or redistribution of this software partially or totally +may be done in any manner that would subject this software to any Open Source +Terms. “Open Source Terms” shall mean any open source license which requires as +part of distribution of software that the source code of such software is +distributed therewith or otherwise made available, or open source license that +substantially complies with the Open Source definition specified at +www.opensource.org and any other comparable open source license such as for +example GNU General Public License (GPL), Eclipse Public License (EPL), Apache +Software License, BSD license or MIT license. + +6. STMicroelectronics has no obligation to provide any maintenance, support or +updates for the software. + +7. The software is and will remain the exclusive property of STMicroelectronics +and its licensors. The recipient will not take any action that jeopardizes +STMicroelectronics and its licensors' proprietary rights or acquire any rights +in the software, except the limited rights specified hereunder. + +8. The recipient shall comply with all applicable laws and regulations affecting +the use of the software or any part thereof including any applicable export +control law or regulation. + +9. Redistribution and use of this software or any part thereof other than as +permitted under this license is void and will automatically terminate your +rights under this license. + +10. THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY RIGHTS, WHICH ARE +DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT SHALL +STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +11. EXCEPT AS EXPRESSLY PERMITTED HEREUNDER, NO LICENSE OR OTHER RIGHTS, WHETHER +EXPRESS OR IMPLIED, ARE GRANTED UNDER ANY PATENT OR OTHER INTELLECTUAL PROPERTY +RIGHTS OF STMICROELECTRONICS OR ANY THIRD PARTY. diff --git a/zephyr/module.yml b/zephyr/module.yml index a1161c71f..e039355c7 100644 --- a/zephyr/module.yml +++ b/zephyr/module.yml @@ -2,3 +2,18 @@ build: cmake: . settings: dts_root: . +blobs: + - path: stm32wba/lib/LinkLayer_BLE_Full_lib.a + sha256: 92f5f3c7c5cb6a98a9fd9bd61db656a47569d1267999987cfc859d7357021e16 + type: lib + version: '1.2.0' + license-path: zephyr/blobs/stm32wba/lib/license.md + url: https://github.com/STMicroelectronics/STM32CubeWBA/raw/v1.2.0/Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/lib/LinkLayer_BLE_Full_lib.a + description: "Binary Link Layer library for the STM32WBA Bluetooth subsystem" + - path: stm32wba/lib/stm32wba_ble_stack_llo.a + sha256: d7f6053331539bc1353d2d9abf682caac89690bd480e1a637b29b94744132943 + type: lib + version: '1.2.0' + license-path: zephyr/blobs/stm32wba/lib/license.md + url: https://github.com/STMicroelectronics/STM32CubeWBA/raw/v1.2.0/Middlewares/ST/STM32_WPAN/ble/stack/lib/stm32wba_ble_stack_llo.a + description: "Binary Stack library for the STM32WBA Bluetooth subsystem" From 43311ad71c7a151ecd498980040220e196f47a31 Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Tue, 5 Dec 2023 16:15:20 +0100 Subject: [PATCH 2/3] lib: stm32wba: Minimize dependencies Add some minor tweaks to files extracted from STM32Cube package in order to minimize number of files to include. Signed-off-by: Erwan Gouriou --- lib/stm32wba/hci/app_conf.h | 2 +- lib/stm32wba/hci/main.h | 4 ++-- lib/stm32wba/hci/scm.c | 21 +++++++++++++++------ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/lib/stm32wba/hci/app_conf.h b/lib/stm32wba/hci/app_conf.h index bba699839..163009cf2 100644 --- a/lib/stm32wba/hci/app_conf.h +++ b/lib/stm32wba/hci/app_conf.h @@ -25,7 +25,7 @@ /* Includes ------------------------------------------------------------------*/ #include "hw_if.h" #include "utilities_conf.h" -#include "log_module.h" +/* #include "log_module.h" */ /* USER CODE BEGIN Includes */ diff --git a/lib/stm32wba/hci/main.h b/lib/stm32wba/hci/main.h index ce6a3f852..ed1537307 100644 --- a/lib/stm32wba/hci/main.h +++ b/lib/stm32wba/hci/main.h @@ -29,9 +29,9 @@ extern "C" { /* Includes ------------------------------------------------------------------*/ #include "stm32wbaxx_hal.h" #include "app_conf.h" -#include "app_entry.h" +/* #include "app_entry.h" */ #include "app_common.h" -#include "app_debug.h" +/* #include "app_debug.h" */ /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ diff --git a/lib/stm32wba/hci/scm.c b/lib/stm32wba/hci/scm.c index dd8f223bb..124fa66fc 100644 --- a/lib/stm32wba/hci/scm.c +++ b/lib/stm32wba/hci/scm.c @@ -20,9 +20,11 @@ /* Includes ------------------------------------------------------------------*/ #include "scm.h" +#if (RT_DEBUG_GPIO_MODULE==1) #include "RTDebug.h" +#endif -#if (CFG_SCM_SUPPORTED == 1) +#if (CFG_SCM_SUPPORTED==1) __weak void SCM_HSI_CLK_ON(void) { @@ -89,8 +91,9 @@ static scm_clockconfig_t scm_getmaxfreq(void) static void scm_systemclockconfig(void) { +#if (RT_DEBUG_GPIO_MODULE==1) SYSTEM_DEBUG_SIGNAL_SET(SCM_SYSTEM_CLOCK_CONFIG); - +#endif switch (scm_system_clock_config.targeted_clock_freq) { case HSE_16MHZ: @@ -165,8 +168,9 @@ static void scm_systemclockconfig(void) default: break; } - +#if (RT_DEBUG_GPIO_MODULE==1) SYSTEM_DEBUG_SIGNAL_RESET(SCM_SYSTEM_CLOCK_CONFIG); +#endif } static void SwitchHsePre(scm_hse_hsepre_t hse_pre) @@ -424,8 +428,9 @@ void scm_init() */ void scm_setup(void) { + #if (RT_DEBUG_GPIO_MODULE==1) SYSTEM_DEBUG_SIGNAL_SET(SCM_SETUP); - +#endif /* System clock is now on HSI 16Mhz, as it exits from stop mode */ /* Start HSE */ @@ -479,7 +484,9 @@ void scm_setup(void) __HAL_RCC_ENABLE_IT(RCC_IT_HSERDY); } } + #if (RT_DEBUG_GPIO_MODULE==1) SYSTEM_DEBUG_SIGNAL_RESET(SCM_SETUP); + #endif } /** @@ -710,8 +717,9 @@ void scm_setwaitstates(const scm_ws_lp_t ws_lp_config) */ void scm_hserdy_isr(void) { + #if (RT_DEBUG_GPIO_MODULE==1) SYSTEM_DEBUG_SIGNAL_SET(SCM_HSERDY_ISR); - +#endif if(LL_RCC_GetSysClkSource() == LL_RCC_SYS_CLKSOURCE_STATUS_HSI) { /* Wait until VOS has changed */ @@ -764,8 +772,9 @@ void scm_hserdy_isr(void) /* Ensure time base clock coherency */ SystemCoreClockUpdate(); } - +#if (RT_DEBUG_GPIO_MODULE==1) SYSTEM_DEBUG_SIGNAL_RESET(SCM_HSERDY_ISR); +#endif } /** From 768c7d2811b76a1d2eab08face35d720a7ac5ffe Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Tue, 5 Dec 2023 14:13:56 +0100 Subject: [PATCH 3/3] lib: stm32wba: Disable radio based calibration Radio based calibration is not yet available Signed-off-by: Erwan Gouriou --- lib/stm32wba/hci/README | 9 ++++++++- lib/stm32wba/hci/app_conf.h | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/stm32wba/hci/README b/lib/stm32wba/hci/README index 5c4a5b621..3258540f1 100644 --- a/lib/stm32wba/hci/README +++ b/lib/stm32wba/hci/README @@ -93,4 +93,11 @@ License Link: Patch List: - * NA + * Disable Temperature based radio calibration: + Impacted file: app_conf.h + + * Minimize dependency list + Impacted files: stm_list.h + main.h + app_conf.h + scm.c diff --git a/lib/stm32wba/hci/app_conf.h b/lib/stm32wba/hci/app_conf.h index 163009cf2..8c8d83e8c 100644 --- a/lib/stm32wba/hci/app_conf.h +++ b/lib/stm32wba/hci/app_conf.h @@ -442,7 +442,7 @@ typedef enum #define NEXT_EVENT_SCHEDULING_FROM_ISR (1) /* Link Layer uses temperature based calibration (0 --> NO ; 1 --> YES) */ -#define USE_TEMPERATURE_BASED_RADIO_CALIBRATION (1) +#define USE_TEMPERATURE_BASED_RADIO_CALIBRATION (0) #define RADIO_INTR_NUM RADIO_IRQn /* 2.4GHz RADIO global interrupt */ #define RADIO_INTR_PRIO_HIGH (0) /* 2.4GHz RADIO interrupt priority when radio is Active */