diff --git a/lib/stm32wba/BLE_TransparentMode/System/Config/Log/log_module_conf.h b/lib/stm32wba/BLE_TransparentMode/System/Config/Log/log_module_conf.h deleted file mode 100644 index 67134f788..000000000 --- a/lib/stm32wba/BLE_TransparentMode/System/Config/Log/log_module_conf.h +++ /dev/null @@ -1,294 +0,0 @@ -/* USER CODE BEGIN Header */ -/** - ****************************************************************************** - * @file log_module_conf.h - * @author MCD Application Team - * @brief Header file of the log module. - ****************************************************************************** - * @attention - * - * Copyright (c) 2024 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_CONF_H -#define LOG_MODULE_CONF_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "app_conf.h" - -/* 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 added to the trace data. - * When this define is set to 1, the time stamp is added to the trace data, - * according to the function registered with Log_Module_RegisterTimeStampFunction. - */ -#define LOG_INSERT_TIME_STAMP_INSIDE_THE_TRACE CFG_LOG_INSERT_TIME_STAMP_INSIDE_THE_TRACE - -/** - * @brief When this define is set to 0, the color of the trace data remains the same for all regions. - * When this define is set to 1, the color added to the trace data is based on LOG_COLOR_DEFAULT_CONFIGURATION. - */ -#define LOG_INSERT_COLOR_INSIDE_THE_TRACE CFG_LOG_INSERT_COLOR_INSIDE_THE_TRACE - -/** - * @brief When this define is set to 0, the trace data is not modified. - * When this define is set to 1, if there is no ENDOFLINE_CHAR as last - * character in the trace data, then one is added. - */ -#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 PD */ - -/* USER CODE END PD */ - -/* 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 the UTIL_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; - -/* USER CODE BEGIN ET */ - -/* USER CODE END ET */ - -/* Exported macro ------------------------------------------------------------*/ -/* Display 64 bits number for all compiler. */ -/* Example : LOG_INFO_APP( "New Device : " LOG_DISPLAY64() " installed in %d seconds", LOG_NUMBER64( dlDevice ), iTime ); */ -#define LOG_DISPLAY64() "0x%08X%08X" -#define LOG_NUMBER64( number ) (uint32_t)( number >> 32u ), (uint32_t)( number ) - -/* Module API - Log macros for each region */ -/* LOG_REGION_BLE */ -#if (CFG_LOG_SUPPORTED != 0) -#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__) -#else /* (CFG_LOG_SUPPORTED != 0) */ -#define LOG_INFO_BLE(...) do {} while(0) -#define LOG_ERROR_BLE(...) do {} while(0) -#define LOG_WARNING_BLE(...) do {} while(0) -#define LOG_DEBUG_BLE(...) do {} while(0) -#endif /* (CFG_LOG_SUPPORTED != 0) */ - -/* 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_Print( LOG_VERBOSE_CUSTOM, LOG_REGION_BLE, __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 */ -#if (CFG_LOG_SUPPORTED != 0) -#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__) -#else /* (CFG_LOG_SUPPORTED != 0) */ -#define LOG_INFO_SYSTEM(...) do {} while(0) -#define LOG_ERROR_SYSTEM(...) do {} while(0) -#define LOG_WARNING_SYSTEM(...) do {} while(0) -#define LOG_DEBUG_SYSTEM(...) do {} while(0) -#endif /* (CFG_LOG_SUPPORTED != 0) */ - -/* 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_Print( LOG_VERBOSE_CUSTOM, LOG_REGION_SYSTEM, __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 */ -#if (CFG_LOG_SUPPORTED != 0) -#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__) -#else /* (CFG_LOG_SUPPORTED != 0) */ -#define LOG_INFO_APP(...) do {} while(0) -#define LOG_ERROR_APP(...) do {} while(0) -#define LOG_WARNING_APP(...) do {} while(0) -#define LOG_DEBUG_APP(...) do {} while(0) -#endif /* (CFG_LOG_SUPPORTED != 0) */ - -/* 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_Print( LOG_VERBOSE_CUSTOM, LOG_REGION_APP, __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 */ - -/* LOG_REGION_LINKLAYER */ -#if (CFG_LOG_SUPPORTED != 0) -#define LOG_INFO_LINKLAYER(...) Log_Module_Print( LOG_VERBOSE_INFO, LOG_REGION_LINKLAYER, __VA_ARGS__) -#define LOG_ERROR_LINKLAYER(...) Log_Module_Print( LOG_VERBOSE_ERROR, LOG_REGION_LINKLAYER, __VA_ARGS__) -#define LOG_WARNING_LINKLAYER(...)Log_Module_Print( LOG_VERBOSE_WARNING, LOG_REGION_LINKLAYER, __VA_ARGS__) -#define LOG_DEBUG_LINKLAYER(...) Log_Module_Print( LOG_VERBOSE_DEBUG, LOG_REGION_LINKLAYER, __VA_ARGS__) -#else /* (CFG_LOG_SUPPORTED != 0) */ -#define LOG_INFO_LINKLAYER(...) do {} while(0) -#define LOG_ERROR_LINKLAYER(...) do {} while(0) -#define LOG_WARNING_LINKLAYER(...)do {} while(0) -#define LOG_DEBUG_LINKLAYER(...) do {} while(0) -#endif /* (CFG_LOG_SUPPORTED != 0) */ - -/* USER CODE BEGIN LOG_REGION_LINKLAYER */ -/** - * Add inside this user section your defines to match the new verbose levels you - * created into Log_Verbose_Level_t. - * Example : - * #define LOG_CUSTOM_LINKLAYER(...) Log_Module_Print( LOG_VERBOSE_CUSTOM, LOG_REGION_LINKLAYER, __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_LINKLAYER */ - -/* 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 : -#if (CFG_LOG_SUPPORTED != 0) -#define LOG_INFO_CUSTOM(...) Log_Module_Print( LOG_VERBOSE_INFO, LOG_REGION_CUSTOM, __VA_ARGS__) -#define LOG_ERROR_CUSTOM(...) Log_Module_Print( LOG_VERBOSE_ERROR, LOG_REGION_CUSTOM, __VA_ARGS__) -#define LOG_WARNING_CUSTOM(...) Log_Module_Print( LOG_VERBOSE_WARNING, LOG_REGION_CUSTOM, __VA_ARGS__) -#define LOG_DEBUG_CUSTOM(...) Log_Module_Print( LOG_VERBOSE_DEBUG, LOG_REGION_CUSTOM, __VA_ARGS__) -#else -#define LOG_INFO_CUSTOM(...) do {} while(0) -#define LOG_ERROR_CUSTOM(...) do {} while(0) -#define LOG_WARNING_CUSTOM(...) do {} while(0) -#define LOG_DEBUG_CUSTOM(...) do {} while(0) -#endif - */ -/* USER CODE END APP_LOG_USER_DEFINES */ - -#ifdef __cplusplus -} -#endif - -#endif /* LOG_MODULE_CONF_H */ diff --git a/lib/stm32wba/CMakeLists.txt b/lib/stm32wba/CMakeLists.txt index 6dddb8c7c..1f829576b 100644 --- a/lib/stm32wba/CMakeLists.txt +++ b/lib/stm32wba/CMakeLists.txt @@ -7,7 +7,6 @@ zephyr_compile_definitions( -DBLE ) zephyr_include_directories(BLE_TransparentMode/Core/Inc) zephyr_include_directories(BLE_TransparentMode/STM32_WPAN/Target) zephyr_include_directories(BLE_TransparentMode/System/Config/Debug_GPIO) -zephyr_include_directories(BLE_TransparentMode/System/Config/Log) zephyr_include_directories(Common/WPAN/Interfaces) zephyr_include_directories(Common/WPAN/Modules) zephyr_include_directories(Common/WPAN/Modules/Flash) @@ -22,13 +21,11 @@ zephyr_include_directories(STM32_WPAN/link_layer/ll_cmd_lib/inc/_40nm_reg_files) zephyr_include_directories(STM32_WPAN/link_layer/ll_sys/inc) zephyr_include_directories(Utilities/misc) zephyr_include_directories(Utilities/tim_serv) -zephyr_include_directories(Utilities/trace/adv_trace) zephyr_sources(BLE_TransparentMode/STM32_WPAN/Target/bpka.c) zephyr_sources(BLE_TransparentMode/STM32_WPAN/Target/linklayer_plat.c) zephyr_sources(BLE_TransparentMode/STM32_WPAN/Target/ll_sys_if.c) zephyr_sources(BLE_TransparentMode/STM32_WPAN/Target/power_table.c) -zephyr_sources(Common/WPAN/Modules/Log/log_module.c) zephyr_sources(Common/WPAN/Interfaces/hw_pka.c) zephyr_sources(Common/WPAN/Interfaces/hw_pka_p256.c) zephyr_sources(Common/WPAN/Modules/scm.c) diff --git a/lib/stm32wba/Common/WPAN/Modules/Flash/flash_manager.c b/lib/stm32wba/Common/WPAN/Modules/Flash/flash_manager.c index 5c3ff0680..769ad6e02 100644 --- a/lib/stm32wba/Common/WPAN/Modules/Flash/flash_manager.c +++ b/lib/stm32wba/Common/WPAN/Modules/Flash/flash_manager.c @@ -112,6 +112,7 @@ static FM_FlashOpConfig_t fm_flashop_parameters; */ static FM_BackGround_States_t FM_CurrentBackGroundState; +LOG_MODULE_REGISTER(flash_manager); /* Private function prototypes -----------------------------------------------*/ static FM_Cmd_Status_t FM_CheckFlashManagerState(FM_CallbackNode_t *CallbackNode); diff --git a/lib/stm32wba/Common/WPAN/Modules/Log/log_module.c b/lib/stm32wba/Common/WPAN/Modules/Log/log_module.c deleted file mode 100644 index 5ccfa5392..000000000 --- a/lib/stm32wba/Common/WPAN/Modules/Log/log_module.c +++ /dev/null @@ -1,298 +0,0 @@ -/* USER CODE BEGIN Header */ -/** - ****************************************************************************** - * @file log_module.c - * @author MCD Application Team - * @brief Source file of the log module. - ****************************************************************************** - * @attention - * - * Copyright (c) 2024 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 "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_mask = (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 LOG_COLOR_DEFAULT_CONFIGURATION */ - - /* USER CODE END LOG_COLOR_DEFAULT_CONFIGURATION */ -}; -/* USER CODE BEGIN EC */ - -/* USER CODE END EC */ - -/* Private variables ---------------------------------------------------------*/ -static uint32_t current_region_mask; -static Log_Verbose_Level_t current_verbose_level; -static Log_Color_t current_color_list[32]; -CallBack_TimeStamp * log_timestamp_function; -/* USER CODE BEGIN PV */ - -/* USER CODE END PV */ - -/* Private function prototypes -----------------------------------------------*/ -static uint32_t Get_Region_Mask(Log_Region_t Region); - -#if (LOG_INSERT_COLOR_INSIDE_THE_TRACE != 0) -static uint16_t RegionToColor(char * TextBuffer, uint16_t SizeMax, Log_Region_t Region); -#endif /* LOG_INSERT_COLOR_INSIDE_THE_TRACE != 0 */ -/* 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 TextBuffer Pointer on the log buffer - * @param SizeMax The maximum number of bytes that will be written to the buffer. - * @param Region Region of the log to apply its corresponding color. - * - * @return Length of the new Log. - */ -static uint16_t RegionToColor(char * TextBuffer, uint16_t SizeMax, Log_Region_t Region) -{ - uint16_t text_length = 0; - Log_Color_t color; - static Log_Color_t previous_color = LOG_COLOR_NONE; - - if (Region != LOG_MODULE_ALL_REGION_MASK) - { - color = current_color_list[Region]; - } - else - { - color = LOG_COLOR_CODE_DEFAULT; - } - - /* Insert Color code only if previous is not the same */ - if (color != previous_color) - { - if (color == LOG_COLOR_CODE_DEFAULT) - { - snprintf(TextBuffer, SizeMax, "\x1b[0m"); - } - else - { - snprintf(TextBuffer, SizeMax, "\x1b[0;%02dm", color); - } - - previous_color = color; - text_length = strlen(TextBuffer); - } - - return text_length; -} -#endif /* LOG_INSERT_COLOR_INSIDE_THE_TRACE != 0 */ - -void Log_Module_PrintWithArg(Log_Verbose_Level_t VerboseLevel, Log_Region_t Region, const char * Text, va_list Args) -{ - uint16_t tmp_size = 0; - uint16_t buffer_size = 0; - char full_text[UTIL_ADV_TRACE_TMP_BUF_SIZE + 1u]; - - /* USER CODE BEGIN Log_Module_PrintWithArg_1 */ - - /* USER CODE END Log_Module_PrintWithArg_1 */ - - /* If the verbose level of the given log is not enabled, then we do not print the log */ - if (VerboseLevel > current_verbose_level) - { - return; - } - - /* If the region for the given log is not enabled, then we do not print the log */ - if ((Get_Region_Mask(Region) & current_region_mask) == 0u) - { - return; - } - -#if (LOG_INSERT_COLOR_INSIDE_THE_TRACE != 0) - /* Add to full_text the color matching the region */ - tmp_size = RegionToColor(&full_text[buffer_size], (UTIL_ADV_TRACE_TMP_BUF_SIZE - buffer_size), Region); - buffer_size += tmp_size; -#endif /* LOG_INSERT_COLOR_INSIDE_THE_TRACE != 0 */ - -#if (LOG_INSERT_TIME_STAMP_INSIDE_THE_TRACE != 0) - if (log_timestamp_function != NULL) - { - tmp_size = UTIL_ADV_TRACE_TMP_BUF_SIZE - buffer_size; - log_timestamp_function(&full_text[buffer_size], tmp_size, &tmp_size); - buffer_size += tmp_size; - } -#endif /* LOG_INSERT_TIME_STAMP_INSIDE_THE_TRACE != 0 */ - - /* Copy the data */ - tmp_size = (uint16_t)vsnprintf(&full_text[buffer_size], (UTIL_ADV_TRACE_TMP_BUF_SIZE - buffer_size), Text, Args); - buffer_size += tmp_size; - - /* 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 (buffer_size > 1) - { - if ((full_text[buffer_size - 1] != ENDOFLINE_CHAR) && (full_text[buffer_size - 2] != ENDOFLINE_CHAR)) - { - full_text[buffer_size++] = ENDOFLINE_CHAR; - full_text[buffer_size] = 0; - } - } -#endif /* LOG_INSERT_EOL_INSIDE_THE_TRACE != 0 */ - - /* USER CODE BEGIN Log_Module_PrintWithArg_3 */ - - /* USER CODE END Log_Module_PrintWithArg_3 */ - - /* Send full_text to ADV Traces */ - UTIL_ADV_TRACE_Send((const uint8_t *)full_text, buffer_size); -} - -void Log_Module_Print(Log_Verbose_Level_t VerboseLevel, Log_Region_t Region, const char * Text, ...) -{ -#if (CFG_LOG_SUPPORTED != 0) - va_list variadic_args; - - va_start(variadic_args, Text); - Log_Module_PrintWithArg(VerboseLevel, Region, Text, variadic_args); - va_end(variadic_args); -#else /* (CFG_LOG_SUPPORTED != 0) */ - UNUSED(VerboseLevel); - UNUSED(Region); - UNUSED(Text); -#endif /* (CFG_LOG_SUPPORTED != 0) */ -} - -void Log_Module_Init(Log_Module_t LogConfiguration) -{ - UTIL_ADV_TRACE_Init(); - - memcpy(¤t_color_list, &LOG_COLOR_DEFAULT_CONFIGURATION, sizeof(LOG_COLOR_DEFAULT_CONFIGURATION)); - Log_Module_Set_Verbose_Level(LogConfiguration.verbose_level); - Log_Module_Set_Multiple_Regions(LogConfiguration.region_mask); - log_timestamp_function = NULL; -} - -void Log_Module_DeInit(void) -{ - UTIL_ADV_TRACE_DeInit(); -} - -void Log_Module_Set_Verbose_Level(Log_Verbose_Level_t NewVerboseLevel) -{ - current_verbose_level = NewVerboseLevel; -} - -void Log_Module_Set_Region(Log_Region_t NewRegion) -{ - current_region_mask = Get_Region_Mask(NewRegion); -} - -void Log_Module_Add_Region(Log_Region_t NewRegion) -{ - current_region_mask |= Get_Region_Mask(NewRegion); -} - -void Log_Module_Remove_Region(Log_Region_t Region) -{ - current_region_mask &= ~Get_Region_Mask(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))); - } -} - -void Log_Module_Set_Multiple_Regions(uint32_t NewRegionMask) -{ - current_region_mask = NewRegionMask; -} - -void Log_Module_Set_Color(Log_Region_t Region, Log_Color_t Color) -{ - if ( Region != LOG_MODULE_ALL_REGION_MASK ) - { - current_color_list[Region] = Color; - } -} - -void Log_Module_RegisterTimeStampFunction(CallBack_TimeStamp * TimeStampFunction) -{ - log_timestamp_function = TimeStampFunction; -} - -/* USER CODE BEGIN 0 */ - -/* USER CODE END 0 */ diff --git a/lib/stm32wba/Common/WPAN/Modules/Log/log_module.h b/lib/stm32wba/Common/WPAN/Modules/Log/log_module.h index 9b5d86463..5e8b68021 100644 --- a/lib/stm32wba/Common/WPAN/Modules/Log/log_module.h +++ b/lib/stm32wba/Common/WPAN/Modules/Log/log_module.h @@ -1,4 +1,3 @@ -/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file log_module.h @@ -16,7 +15,6 @@ * ****************************************************************************** */ -/* USER CODE END Header */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef LOG_MODULE_H @@ -27,191 +25,46 @@ extern "C" { #endif /* Includes ------------------------------------------------------------------*/ -#include -#include -#include -#include "log_module_conf.h" +#include /* Private includes ----------------------------------------------------------*/ -/* USER CODE BEGIN Includes */ -/* USER CODE END Includes */ - -/* Exported types ------------------------------------------------------------*/ -/* Log module types */ -/** - * @brief Data type to initialize the module by calling Log_Module_Init. - * verbose_level : A value of type Log_Verbose_Level_t. - * region_mask : A mask based on Log_Region_t. - * You can directly assign it to LOG_REGION_ALL_REGIONS, - * or select only some regions : - * (1U << LOG_REGION_BLE | 1U << LOG_REGION_APP) - */ -typedef struct -{ - Log_Verbose_Level_t verbose_level; - uint32_t region_mask; -} Log_Module_t; - -/** - * @brief Callback function to insert Time Stamp. - * - * @param Data The data into which to insert the TimeStamp. - * @param SizeMax The maximum size for the TimeStamp insert. - * @param TimeStampSize Pointer to update with the size of the TimeStamp inserted into data. - */ -typedef void CallBack_TimeStamp(char * Data, uint16_t SizeMax, uint16_t * TimeStampSize); - -/* 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 LogConfiguration The configuration of the log module, of type Log_Module_t. - * @return None. - */ -void Log_Module_Init(Log_Module_t LogConfiguration); - -/** - * @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 NewVerboseLevel 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 NewVerboseLevel); - -/** - * @brief Replace the current regions in use and only set the given region. - * - * @param NewRegion The new region to use, of type Log_Region_t. - * @return None. - */ -void Log_Module_Set_Region(Log_Region_t NewRegion); - -/** - * @brief Replace the current regions in use and set one or several as replacement. - * - * @param NewRegionMask A mask, of type uint32_t, where each bit corresponds to a region. - * You can directly assign it to LOG_REGION_ALL_REGIONS to enable all of them, - * or select only some regions, e.g. (1U << LOG_REGION_BLE | 1U << LOG_REGION_APP) - * @return None. - */ -void Log_Module_Set_Multiple_Regions(uint32_t NewRegionMask); - -/** - * @brief Add to the current region mask the given region. - * - * @param NewRegion The new region to use, alongside the others, of type Log_Region_t. - * @return None. - */ -void Log_Module_Add_Region(Log_Region_t NewRegion); - -/** - * @brief Remove from the current region mask the given region. - * - * @param Region The region to remove, of type Log_Region_t. - * @return None. - */ -void Log_Module_Remove_Region(Log_Region_t Region); - -/** - * @brief Enable all the regions. - * - * @param None. - * @return None. - */ -void Log_Module_Enable_All_Regions(void); - -/** - * @brief Set the color for a region. - * - * @param Region The region where apply the color, type Log_Region_t. - * @param Color The color to apply to selected region, of type Log_Color_t. - * @return None. - */ -void Log_Module_Set_Color(Log_Region_t Region, Log_Color_t Color); - -/** - * @brief Register a callback function to insert the TimeStamp into the data. - * - * @param TimeStampFunction Callback function to insert TimeStamp. - * This function is typedef void (char * data, uint16_t size_max, uint16_t * timestamp_size); - * Where data is the location where to insert the new TimeStamp, and timestamp_size is the size of this insertion. - * @return None. - */ -void Log_Module_RegisterTimeStampFunction(CallBack_TimeStamp * TimeStampFunction); - -/* Module API - Wrapper function */ -/** - * @brief Underlying function of all the LOG_xxx macros. - * - * @param VerboseLevel The level of verbose used for this Log, of type Log_Verbose_Level_t. - * @param Region The region set for this log, of type Log_Region_t. - * @param Text 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 VerboseLevel, Log_Region_t Region, const char * Text, ...); - -/** - * @brief Function of log with already a arg list. - * - * @param VerboseLevel The level of verbose used for this Log, of type Log_Verbose_Level_t. - * @param Region The region set for this log, of type Log_Region_t. - * @param Text The text to be printed - * @param Args Arguments list, of type va_list. - * - * @return None. - */ -void Log_Module_PrintWithArg(Log_Verbose_Level_t VerboseLevel, Log_Region_t Region, const char * Text, va_list Args); - -/* USER CODE BEGIN EFP */ - -/* USER CODE END EFP */ +/* Exported macro ------------------------------------------------------------*/ +/* Display 64 bits number for all compiler. */ +#define LOG_DISPLAY64() "0x%08X%08X" +#define LOG_NUMBER64( number ) (uint32_t)( number >> 32u ), (uint32_t)( number ) + +/* Module API - Log macros for each region */ +/* LOG_REGION_BLE */ +#define LOG_INFO_BLE(...) LOG_INF(__VA_ARGS__) +#define LOG_ERROR_BLE(...) LOG_ERR(__VA_ARGS__) +#define LOG_WARNING_BLE(...) LOG_WRN(__VA_ARGS__) +#define LOG_DEBUG_BLE(...) LOG_DBG(__VA_ARGS__) + +/* LOG_REGION_MAC */ +#define LOG_INFO_MAC(...) LOG_INF(__VA_ARGS__) +#define LOG_ERROR_MAC(...) LOG_ERR(__VA_ARGS__) +#define LOG_WARNING_MAC(...) LOG_WRN(__VA_ARGS__) +#define LOG_DEBUG_MAC(...) LOG_DBG(__VA_ARGS__) + +/* LOG_REGION_SYSTEM */ +#define LOG_INFO_SYSTEM(...) LOG_INF(__VA_ARGS__) +#define LOG_ERROR_SYSTEM(...) LOG_ERR(__VA_ARGS__) +#define LOG_WARNING_SYSTEM(...) LOG_WRN(__VA_ARGS__) +#define LOG_DEBUG_SYSTEM(...) LOG_DBG(__VA_ARGS__) + +/* LOG_REGION_APP */ +#define LOG_INFO_APP(...) LOG_INF(__VA_ARGS__) +#define LOG_ERROR_APP(...) LOG_ERR(__VA_ARGS__) +#define LOG_WARNING_APP(...) LOG_WRN(__VA_ARGS__) +#define LOG_DEBUG_APP(...) LOG_DBG(__VA_ARGS__) +#define LOG_ZIG_DBG(...) LOG_DBG(__VA_ARGS__) + +/* LOG_REGION_LINKLAYER */ +#define LOG_INFO_LINKLAYER(...) LOG_INF(__VA_ARGS__) +#define LOG_ERROR_LINKLAYER(...) LOG_ERR(__VA_ARGS__) +#define LOG_WARNING_LINKLAYER(...) LOG_WRN(__VA_ARGS__) +#define LOG_DEBUG_LINKLAYER(...) LOG_DBG(__VA_ARGS__) #ifdef __cplusplus } diff --git a/lib/stm32wba/Common/WPAN/Modules/scm.h b/lib/stm32wba/Common/WPAN/Modules/scm.h index 450e3a305..9cea11377 100644 --- a/lib/stm32wba/Common/WPAN/Modules/scm.h +++ b/lib/stm32wba/Common/WPAN/Modules/scm.h @@ -1,4 +1,3 @@ -/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file scm.h @@ -16,7 +15,6 @@ * ****************************************************************************** */ -/* USER CODE END Header */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef SCM_H @@ -56,9 +54,6 @@ typedef enum { SCM_USER_APP, SCM_USER_LL_FW, SCM_USER_LL_HW_RCO_CLBR, - /* USER CODE BEGIN SCM_USER */ - - /* USER CODE END SCM_USER */ TOTAL_CLIENT_NUM, /* To be at the end of the enum */ } scm_user_id_t; diff --git a/lib/stm32wba/Common/WPAN/Modules/stm_list.h b/lib/stm32wba/Common/WPAN/Modules/stm_list.h index 7e057f6ba..39465a514 100644 --- a/lib/stm32wba/Common/WPAN/Modules/stm_list.h +++ b/lib/stm32wba/Common/WPAN/Modules/stm_list.h @@ -1,4 +1,3 @@ -/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file stm_list.h @@ -16,7 +15,6 @@ * ****************************************************************************** */ -/* USER CODE END Header */ #ifndef STM_LIST_H #define STM_LIST_H diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/config/ble_full/ll_fw_config.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/config/ble_full/ll_fw_config.h index a0948915f..5e581f086 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/config/ble_full/ll_fw_config.h +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/config/ble_full/ll_fw_config.h @@ -5,25 +5,33 @@ * @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 and - * associated documentation files (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. - * + * 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. + * 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 diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/_40nm_reg_files/DWC_ble154combo.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/_40nm_reg_files/DWC_ble154combo.h index 98fba5515..7e5cc48da 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/_40nm_reg_files/DWC_ble154combo.h +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/_40nm_reg_files/DWC_ble154combo.h @@ -6,25 +6,33 @@ * ****************************************************************************** * @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 and - * associated documentation files (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. - * + * 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. + * 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. * * */ diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/bsp.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/bsp.h index 053626e75..2ca0e0292 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/bsp.h +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/bsp.h @@ -1,4 +1,4 @@ -/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.32a-lca02/firmware/public_inc/bsp.h#2 $*/ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/2.00a-lca01/firmware/public_inc/bsp.h#1 $*/ /** ******************************************************************************** @@ -6,25 +6,33 @@ * @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 and - * associated documentation files (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. - * + * 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. + * 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. * * */ @@ -39,7 +47,7 @@ #define PRIORITY_LEVEL_MASK 0x0F /** - * This macros specify the different combinations that can be used to enable or disable + * This macros specify the different combinations that can be used to enable or disable * a specific ISR */ @@ -280,6 +288,7 @@ typedef enum Debug_GPIO_e{ DBG_IO_ED_TMR_HNDL , DBG_IO_OS_TMR_EVNT_CBK , DBG_IO_PROFILE_MARKER_PHY_WAKEUP_TIME , + DBG_IO_PROFILE_MARKER_BLOCKING_PHY_WAKEUP_TIME , DBG_IO_PROFILE_END_DRIFT_TIME , DBG_IO_PROC_RADIO_RCV , DBG_IO_EVNT_TIME_UPDT , @@ -513,7 +522,7 @@ void bsp_mcu_slp(void); * @retval None. */ -void bsp_gpio_clear(uint8_t gpio_num); +void bsp_gpio_clear(uint8_t gpio_num); /** @@ -523,7 +532,7 @@ void bsp_gpio_clear(uint8_t gpio_num); * * @retval None. */ -void bsp_gpio_set(uint8_t gpio_num); +void bsp_gpio_set(uint8_t gpio_num); /** @@ -591,7 +600,7 @@ void bsp_switch_to_lw_isr(uint8_t priority); 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() . + * 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 diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/common_types.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/common_types.h index 3663b8d86..1235cff32 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/common_types.h +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/common_types.h @@ -1,29 +1,37 @@ -/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.32a-lca02/firmware/public_inc/common_types.h#3 $*/ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/2.00a-lca01/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 and - * associated documentation files (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. - * + * 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. + * 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. * * */ @@ -101,10 +109,6 @@ /****************** User configuration **********************************/ #define CS_TESTING TRUE -#ifndef SUPPORT_GNRC_SCHDLR_IF -#define SUPPORT_GNRC_SCHDLR_IF 1 /* Enable\Disable event EXTRNL_GNRC in Ble event manager. Enable:1 - Disable:0 */ -#endif /* SUPPORT_GNRC_SCHDLR_IF */ - /********************* Macros **********************************/ #ifndef SUCCESS @@ -192,6 +196,10 @@ typedef enum { LE_2M = 0x02, LE_CODED_S8 = 0x03, LE_CODED = 0x04, +/*=============== Channel Sounding ===============*/ +#if (SUPPORT_CHANNEL_SOUNDING &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) + LE_2M_2BT = 0x08, +#endif /*SUPPORT_CHANNEL_SOUNDING &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)*/ #if (SUPPORT_LE_POWER_CONTROL) LE_PHY_UNDEFINED = 0xFC, NEW_PHY_CODED_S2 = 0xFD, @@ -216,6 +224,7 @@ typedef struct time_st { 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 @@ -309,8 +318,8 @@ typedef enum ant_intrv_type_enum { * @brief structure that hold antenna diversity parameters information. */ typedef struct _antenna_diversity_st{ - ant_intrv_type_enum_t ant_intrv_type; /* antenna interval type: FIXED_TIME(us) or PACKETS_NUMBER(n) */ - uint32_t ant_intrv_value; /* antenna interval value based on type; us for FIXED_TIME, n for PACKETS_NUMBER */ + ant_intrv_type_enum_t ant_intrv_type; /* antenna interval type: FIXED_TIME(us) or PACKETS_NUMBER(n) */ + uint32_t ant_intrv_value; /* antenna interval value based on type; us for FIXED_TIME, n for PACKETS_NUMBER */ uint16_t wntd_coord_shrt_addr; /* wanted coordinator/router short address */ uint8_t wntd_coord_ext_addr[EXT_ADDRESS_LENGTH]; /* wanted coordinator/router extended address */ uint8_t max_rx_ack_retries; /* max number of retries to receive ack in case of ack error reception*/ @@ -391,7 +400,7 @@ typedef enum { 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, @@ -445,7 +454,9 @@ typedef enum { /** * The default PHY periodic calibration period in second. this Macro can be set to any value , Zero means that phy periodic calibration is disabled */ +#ifndef DEFAULT_PHY_CALIBRATION_PERIOD #define DEFAULT_PHY_CALIBRATION_PERIOD 10 /* Time period for PHY calibration = 10s */ +#endif /* DEFAULT_PHY_CALIBRATION_PERIOD */ #if defined(PHY_40nm_3_00_a) || defined(PHY_40nm_3_40_a) #define SUPPORT_MAC_PHY_CONT_TESTING_CMDS 1 @@ -459,8 +470,9 @@ typedef enum { #ifndef EXTERNAL_CUSTOM_CMDS #define EXTERNAL_CUSTOM_CMDS 0 /* Indicates that an external custom HCI commands module exists */ #endif /* EXTERNAL_CUSTOM_CMDS */ +#ifndef SUPPORT_ZIGBEE_PHY_CERTIFICATION #define SUPPORT_ZIGBEE_PHY_CERTIFICATION 0 /* 0 disable , 1 enable .. used to enable support of hci command required to implement zigbee phy Test cases*/ - +#endif /* SUPPORT_ZIGBEE_PHY_CERTIFICATION */ #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 @@ -476,7 +488,9 @@ typedef enum { #define SUPPORT_HCI_EVENT_ONLY_TESTING 0 #endif /* SUPPORT_HCI_EVENT_ONLY_TESTING */ +#ifndef SUPPORT_HW_AUDIO_SYNC_SIGNAL #define SUPPORT_HW_AUDIO_SYNC_SIGNAL 0 +#endif /* SUPPORT_HW_AUDIO_SYNC_SIGNAL */ #if SUPPORT_LE_PAWR_SYNC_ROLE #define SUPPORT_PAWR_CUSTOM_SYNC 1 @@ -491,9 +505,13 @@ typedef enum { +#ifndef SUPPORT_TIM_UPDT #define SUPPORT_TIM_UPDT 1 +#endif /* SUPPORT_TIM_UPDT */ +#ifndef SUPPORT_RX_DTP_CONTROL #define SUPPORT_RX_DTP_CONTROL 1 /* Enable\Disable ACL Rx data throughput feature */ +#endif /* SUPPORT_RX_DTP_CONTROL */ #ifndef SUPPORT_CUSTOM_ADV_SCAN_TESTING #define SUPPORT_CUSTOM_ADV_SCAN_TESTING 0 @@ -508,4 +526,67 @@ typedef enum { #endif /* SUPPORT_EXT_FEATURE_SET */ +#ifndef SUPPORT_CONFIGURABLE_GAIN_FIX +#define SUPPORT_CONFIGURABLE_GAIN_FIX 0 /* Enable\Disable configurable gain fix support */ +#endif /* SUPPORT_CONFIGURABLE_GAIN_FIX */ + +#if SUPPORT_CONFIGURABLE_GAIN_FIX +#define PREEMPH_GAIN_COEFF_STEP_SIZE 10 /* percentage margin of single step */ +#define GAIN_FIX_WAKEUP_TIME_OVERHEAD 4 /* in sleep timer units, the added time overhead from patching all pre-emphasis coefficients */ +#else +#define GAIN_FIX_WAKEUP_TIME_OVERHEAD 0 +#endif /* SUPPORT_CONFIGURABLE_GAIN_FIX */ + +#ifndef SUPPORT_PHY_SHUTDOWN_MODE +#if defined(PHY_40nm_3_60_a_tc) || defined(PHY_40nm_3_00_a) || defined(PHY_40nm_3_40_a) +#define SUPPORT_PHY_SHUTDOWN_MODE 1 /* Enable\Disable phpy shutdown mode support */ +#else +#define SUPPORT_PHY_SHUTDOWN_MODE 0 +#endif /* defined(PHY_40nm_3_60_a_tc) || defined(PHY_40nm_3_00_a) || defined(PHY_40nm_3_40_a) */ +#endif /* SUPPORT_PHY_SHUTDOWN_MODE */ + +#if SUPPORT_PHY_SHUTDOWN_MODE +#define PHY_SHUTDOWN_WAKEUP_TIME_OVERHEAD 2 /* in sleep timer units, the added time overhead from executing override seqeuences needed in phy shutdown mode */ +#else +#define PHY_SHUTDOWN_WAKEUP_TIME_OVERHEAD 0 +#endif /* SUPPORT_PHY_SHUTDOWN_MODE */ + +#ifndef SUPPORT_GNRC_SCHDLR_IF +#define SUPPORT_GNRC_SCHDLR_IF 1 +#endif +#ifndef NEAR_AUX_AFTER_EXT_SLEEP_TIMER_SCHEDULING +#define NEAR_AUX_AFTER_EXT_SLEEP_TIMER_SCHEDULING 0 +#endif /* NEAR_AUX_AFTER_EXT_SLEEP_TIMER_SCHEDULING */ + +#if (SUPPORT_CHANNEL_SOUNDING &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) +/** + * @brief holds the possible values for cs roles + */ +typedef enum _cs_role_e +{ + CS_ROLE_INITIATOR, + CS_ROLE_REFLECTOR +} cs_role_e; + +/** + * @brief holds the possible values for cs step mode types + */ +typedef enum _cs_step_mode_type_e +{ + CS_STEP_MODE_0, + CS_STEP_MODE_1, + CS_STEP_MODE_2, + CS_STEP_MODE_3, + CS_STEP_MODE_NONE = 0xFF +} cs_step_mode_type_e; + +/** + * @brief cs host buffer structure + */ +typedef struct _cs_host_buffer { + uint8_t buffer[257]; /*CS_HOST_BUFFER_DATA_MAX (255) + HCI_EVENT_HEADER_LEN(2)*/ +}cs_host_buffer; + +#endif /*SUPPORT_CHANNEL_SOUNDING &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)*/ + #endif /*COMMON_TYPES_H_*/ diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/dtm.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/dtm.h new file mode 100644 index 000000000..47e96b885 --- /dev/null +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/dtm.h @@ -0,0 +1,237 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/2.00a-lca01/firmware/public_inc/dtm.h#1 $*/ +/** + ******************************************************************************** + * @file dtm.h + * @brief header file for Synopsys zigbee phy testing APIs + * + * + ****************************************************************************** + * @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 MAC_CONTROLLER_INC_DTM_H_ +#define MAC_CONTROLLER_INC_DTM_H_ + +/******************************************************************************************** + * Includes + *********************************************************************************************/ + +#include "ral.h" + +/*=========================================== MACROS ======================================*/ +#define aMaxSIFSFrameSize 18 +#define macMinSIFSPeriod 192 +#define macMinLIFSPeriod 640 +#define MAX_PHY_PACKET_SIZE 127 +#define macMaxIFSPeriod 1000 +#define MAX_ERROR_PER_SINGLE_TX 5 +/*============================= Enumerations ================================*/ +/** + * @brief: Current DTM State + */ +typedef enum z_dtm_mode { + Z_DTM_STOPPED = 0, + Z_DTM_TX = 1, + Z_DTM_RX = 2, + Z_DTM_TX_ACK = 3, + Z_DTM_CHECK_TX_ERROR = 4 +} z_dtm_mode_e; + +/*============================= Structures ================================*/ +/** + * @brief: type to represent the current state of DTM TX. + */ +typedef struct Tx_Info +{ + uint16_t TxTotal; // Total number of transmitted Frames (with/without errors) + uint16_t NoErr; // Number of frames that are transmitted successfully + uint16_t ErrNoAck; // Number of frames that are requesting ack and no Ack is received after transmission + uint16_t ErrOther; // Number of frames that are transmitted with errors excluding the no ack error +} TxInfo_s; + +/** + * @brief: type to represent the current state of DTM RX. + */ +typedef struct Rx_Info +{ + uint16_t RxTotal;// Total number of received Frames (with/without errors) + uint16_t NoErr; // Number of frames that are successfully received + uint16_t ErrFcs; // Number of frames that are received with invalid FCS + uint16_t ErrOther; // Number of frames that are received with errors excluding the invalid FCS error + uint8_t lqi; // LQI of the received Frame +} RxInfo_s; + +/** + * @brief: structure to store all information related to DTM. + */ +typedef struct dtmInfo_st +{ + z_dtm_mode_e curr_mode; // Current State (TX,RX,STopped) + + union{ + TxInfo_s TxInfo; // DTM information in case of TX and TX_ACK + RxInfo_s RxInfo; // DTM information in case of RX + } tx_rx_info_u; + +} dtmInfo_t; + +/** @ingroup mac_dtm +* @{ +*/ +/*=========================================== API ============================================*/ +/** + * @brief this function is used to initialize or rest DTM , it also stops the current running DTM + * @retval None. + */ +void dtmReset(void); + +/** + * @brief get the the state of DTM (running or stopped) + * @retval uin8_t . TRUE if DTM is running , + * FALSE if DTM is stopped + */ +uint8_t dtmIsEnabled(void); + + +/** + * @brief this function is used to start continuous DTM transmission with the given input parameters until the dtmStop() API is called + * @param mPsdu [in] : pointer to MAC DTM FRame including MAC header. + * @param mLength [in] : Length of the frame to be transmitted. + * @param mChannel [in] : Channel to transmit the frame on . + * @param IFS [in] : Interframe spacing in us + * @retval mac_status_enum_t. MAC error State of starting transmission + */ +mac_status_enum_t dtmStartTransmit(uint8_t * mPsdu, uint8_t mLength, uint8_t mChannel, uint16_t IFS); + +/** + * @brief this function is used to start transmission of a single DTM Frame that is requesting ACK with the given input parameters + * @param mPsdu [in] : pointer to MAC DTM FRame including MAC header. + * @param mLength [in] : Length of the frame to be transmitted. + * @param mChannel [in] : Channel to transmit the frame on . + * @param IFS [in] : Interframe spacing in us + * @retval mac_status_enum_t. MAC error State of starting transmission + */ +mac_status_enum_t dtmStartTransmitwithAck(uint8_t * mPsdu, uint8_t mLength, uint8_t mChannel, uint16_t IFS); +/** + * @brief this function is used to stop the current Running DTM (TX or RX) + * @retval mac_status_enum_t. MAC error State of stopping DTM + */ +mac_status_enum_t dtmStop(uint16_t *num_rec_pckts, uint8_t *lqi); + +/** + * @brief this function is used to start continuous DTM reception on the given channel + * @param mChannel [in] : Channel to receive on . + * @retval mac_status_enum_t. MAC error State of starting transmission + */ +mac_status_enum_t dtmStartReceive(uint8_t aChannel); + +/** + * @brief this function is used to start CCA on the given channel + * @param mChannel [in] : Channel to perform CCA on . + * @retval mac_status_enum_t. MAC error State of starting reception + */ +mac_status_enum_t dtmPerformCCA(uint8_t channel); + + +/** + * @brief get the current LQI of the last received packet + * @retval uint8_t. LQI value + */ +uint8_t dtmGetLQIValue(void); +/** + * @} + */ +/** + * @brief check if there is more DTM frames to transmit + * @retval uin8_t . TRUE Continue DTM transmission , + * FALSE Stop DTM transmission + */ +uint8_t dtmCheckMoreTx(void); + +/** + * @brief check if that dtm is in reception state + * @retval uin8_t . TRUE DTM in reception mode , + * FALSE DTM is not in reception mode + */ +uint8_t dtmCheckRxState(void); + +/** + * @brief Done function that should be called after each DTM event + * @param aFrame : [in] pointer to MAC transmitted/Received Frame. + * @param aError : [in] status error of overall transmission (success , No_ack, and other errors). + * @retval None. + */ +void dtmRadioDone(otRadioFrame *aFrame, otError aError); + +/** +* @brief check if in Z_DTM_CHECK_TX_ERROR transmission mode or not +* @param None. +* @retval uin8_t . TRUE in Z_DTM_CHECK_TX_ERROR transmission mode , +* FALSE Not in Z_DTM_CHECK_TX_ERROR transmission mode +*/ +uint8_t dtmCheckTxErrorState(void); +/** +* @brief count errors which happens in single tx in Z_DTM_CHECK_TX_ERROR transmission mode +* @param tx_error : [in] type of error to be counted for this trial +* @retval None. +*/ +void dtmCheckTxErrorCount(otError tx_error); +/** +* @brief gives stored errors and its count that happens in single tx in Z_DTM_CHECK_TX_ERROR transmission mode +* @param errors : [in] pointer to array to point to array of stored errors in Z_DTM_CHECK_TX_ERROR transmission mode +* @param error_count : [in] pointer that will have number of errors that stored in errors array +* @retval None. +*/ +void dtmTxCheckErrorCountDone(uint8_t ** errors, uint8_t *error_count); +/** +* @brief start transmission in Z_DTM_CHECK_TX_ERROR transmission mode +* @param mac_hndl : [in] MAC instance handle +* @param mPsdu : [in] pointer to tx packet +* @param mLength : [in] length of tx packet +* @param mChannel : [in] channel that packet will be sent on +* @param IFS : [in] used Inter-frame-spacing +* @param csma_en : [in] flag to indicate to apply csma in this transmission if max_csma_retry_count != 0 +* @param backoff_count_max : [in] maximum number of tx trials in every full csma trial +* @param frame_retry : [in] maximum number of trials after failure that not related to cca_failure +* @param ack_req : [in] indicate if this packet require ack or not +* @retval mac_status_enum_t. +*/ +mac_status_enum_t dtmTxSpecificErrorCount(uint32_t mac_hndl, uint8_t * mPsdu, uint8_t mLength, uint8_t mChannel, uint16_t IFS, + uint8_t csma_en, uint8_t backoff_count_max, uint8_t frame_retry, uint8_t ack_req); + +/** +* @brief reset tx_check_err_arr array and its counter for Z_DTM_CHECK_TX_ERROR mode +* @param None. +* @retval None. +*/ +void dtmTxErrorCountReset(void); + +#endif /* MAC_CONTROLLER_INC_DTM_H_ */ diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/event_manager.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/event_manager.h index 66a7e1fc7..944742feb 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/event_manager.h +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/event_manager.h @@ -1,32 +1,39 @@ -/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.32a-lca02/firmware/public_inc/event_manager.h#2 $*/ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/2.00a-lca01/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 and - * associated documentation files (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. - * + * 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. + * 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_ @@ -126,6 +133,9 @@ typedef enum { HCI_RADIO_ACTIVITY_EVENT, #endif /* END_OF_RADIO_ACTIVITY_REPORTING */ #endif /* SUPPORT_HCI_EVENT_ONLY */ +#if (SUPPORT_CHANNEL_SOUNDING &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) + CS_EVENT_REMOVE, +#endif /*(SUPPORT_CHANNEL_SOUNDING &&( SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION))*/ #if ((SUPPORT_MAC) && (MAC_LAYER_BUILD)) MLME_TIMER_EVENT, DIRECT_DATA_TX_EVENT, @@ -356,3 +366,4 @@ uint8_t emngr_process_conditional_event( uint8_t id, uint8_t only_one_event, */ #endif /* INCLUDE_EVENT_MANAGER_H_ */ + diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/evnt_schdlr_gnrc_if.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/evnt_schdlr_gnrc_if.h index 2b4277fb1..50dd888d1 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/evnt_schdlr_gnrc_if.h +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/evnt_schdlr_gnrc_if.h @@ -1,4 +1,4 @@ -/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.32a-lca02/firmware/public_inc/evnt_schdlr_gnrc_if.h#2 $*/ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/2.00a-lca01/firmware/public_inc/evnt_schdlr_gnrc_if.h#1 $*/ /** ******************************************************************************** * @file evnt_schdlr_gnrc_if.h @@ -6,25 +6,33 @@ * 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 and - * associated documentation files (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. - * + * 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. + * 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. * * */ @@ -195,3 +203,4 @@ uint8_t evnt_schdlr_confrm_grant(void * evnt_hndl); /** * @} */ + diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/hci.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/hci.h index c8fe0935c..3751516d4 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/hci.h +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/hci.h @@ -1,29 +1,37 @@ -/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.32a-lca02/firmware/public_inc/hci.h#2 $*/ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/2.00a-lca01/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 and - * associated documentation files (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. - * + * 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. + * 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. * * */ @@ -223,3 +231,5 @@ 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/STM32_WPAN/link_layer/ll_cmd_lib/inc/ll_error.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/ll_error.h new file mode 100644 index 000000000..38bf08783 --- /dev/null +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/ll_error.h @@ -0,0 +1,234 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/2.00a-lca01/firmware/public_inc/ll_error.h#1 $*/ +/** + ******************************************************************************** + * @file error.h + * @brief This file contains error defines across 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 ERROR_H_ +#define ERROR_H_ + +typedef enum _HW_ERROR_CODES +{ + HW_ERROR_CODE_UNDEFINED_ERROR, + HW_ERROR_CODE_BL_SEARCH, /* this error code indicates an issue while searching in the HW Black list */ + HW_ERROR_CODE_RL_SEARCH, /* this error code indicates an issue while searching in the HW Resolving list */ + HW_ERROR_CODE_WL_SEARCH, /* this error code indicates an issue while searching in the HW White list */ + HW_ERROR_CODE_PDU_PARSING, /* this error code indicates an issue while Parsing PDU */ + HW_ERROR_CODE_PDU_RECEIVING, /* this error code indicates an unexpected PDU type received */ + HW_ERROR_CODE_SM_UPDATE, /* this error code indicates an update in the state machine */ + HW_ERROR_CODE_UNREGISTERING_EVENT, /* this error code indicates an issue while unregistering an event */ + HW_ERROR_CODE_STARTING_CONNECTION, /* this error code indicates an issue while starting a connection */ + HW_ERROR_CODE_MEMORY_EXCEEDED, /* this error code indicates an issue in allocating */ + HW_ERROR_CODE_UNEXPECTED_ADV_STATE /* this error code indicates unexpected adv state */ +}HW_ERROR_CODES; + +/* Includes ---------------------------------------------------------------------*/ + +/* Exported Defines -----------------------------------------------------------*/ +#ifndef SUCCESS +#define SUCCESS 0x00 +#endif +#define UNKNOWN_HCI_COMMAND 0x01 +#define UNKNOWN_CONNECTION_IDENTIF 0x02 +#define HARDWARE_FAILURE 0x03 +#define PAGE_TIMEOUT 0x04 +#define AUTHENTICATION_FAILURE 0x05 +#define PIN_OR_KEY_MISSING 0x06 +#define MEMORY_CAPACITY_EXCEEDED 0x07 +#define CONNECTION_TIMEOUT 0x08 +#define CONNECTION_LIMIT_EXCEEDED 0x09 +#define SYNCHRONOUS_CONNECTION_LIMIT_TO_A_DEVICE_EXCEEDED 0x0A +#define ACL_CONNECTION_ALREADY_EXISTS 0x0B +#define COMMAND_DISALLOWED 0x0C +#define CONNECTION_REJECTED_DUE_TO_LIMITED_RESOURCES 0x0D +#define CONNECTION_REJECTED_DUE_TO_SECURITY_REASONS 0x0E +#define CONNECTION_REJECTED_DUE_TO_UNACCEPTABLE_BD_ADDR 0x0F +#define CONNECTION_ACCEPT_TIMEOUT_EXCEEDED 0x10 +#define UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE 0x11 +#define INVALID_HCI_COMMAND_PARAMETERS 0x12 +#define REMOTE_USER_TERMINATED_CONNECTION 0x13 +#define REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES 0x14 +#define REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_POWER_OFF 0x15 +#define CONNECTION_TERMINATED_BY_LOCAL_HOST 0x16 +#define REPEATED_ATTEMPTS 0x17 +#define PAIRING_NOT_ALLOWED 0x18 +#define UNKNOWN_LMP_PDU 0x19 +#define UNSUPPORTED_REMOTE_FEATURE 0x1A +#define SCO_OFFSET_REJECTED 0x1B +#define SCO_INTERVAL_REJECTED 0x1C +#define SCO_AIR_MODE_REJECTED 0x1D +#define INVALID_LMP_PARAMETERS_INVALID_LL_PARAMETERS 0x1E +#define UNSPECIFIED_ERROR 0x1F +#define UNSUPPORTED_LMP_PARAMETER_VALUE_UNSUPPORTED_LL_PARAMETER_VALUE 0x20 +#define ROLE_CHANGE_NOT_ALLOWED 0x21 +#define LMP_RESPONSE_TIMEOUT_LL_RESPONSE_TIMEOUT 0x22 +#define LMP_ERROR_TRANSACTION_COLLISION 0x23 +#define LMP_PDU_NOT_ALLOWED 0x24 +#define ENCRYPTION_MODE_NOT_ACCEPTABLE 0x25 +#define LINK_KEY_CANNOT_BE_CHANGED 0x26 +#define REQUESTED_QOS_NOT_SUPPORTED 0x27 +#define INSTANT_PASSED 0x28 +#define PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED 0x29 +#define DIFFERENT_TRANSACTION_COLLISION 0x2A +#define RESERVED_FOR_FUTURE_1 0x2B +#define QOS_UNACCEPTABLE_PARAMETER 0x2C +#define QOS_REJECTED 0x2D +#define CHANNEL_ASSESSMENT_NOT_SUPPORTED 0x2E +#define INSUFFICIENT_SECURITY 0x2F +#define PARAMETER_OUT_OF_MANDATORY_RANGE 0x30 +#define RESERVED_FOR_FUTURE_2 0x31 +#define ROLE_SWITCH_PENDING 0x32 +#define RESERVED_FOR_FUTURE_3 0x33 +#define RESERVED_SLOT_VIOLATION 0x34 +#define ROLE_SWITCH_FAILED 0x35 +#define EXTENDED_INQUIRY_RESPONSE_TOO_LARGE 0x36 +#define SECURE_SIMPLE_PAIRING_NOT_SUPPORTED_BY_HOST 0x37 +#define HOST_BUSY_PAIRING 0x38 +#define CONNECTION_REJECTED_DUE_TO_NO_SUITABLE_CHANNEL_FOUND 0x39 +#define CONTROLLER_BUSY 0x3A +#define UNACCEPTABLE_CONNECTION_PARAMETERS 0x3B +#define DIRECTED_ADVERTISING_TIMEOUT 0x3C +#define CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE 0x3D +#define CONNECTION_FAILED_TO_BE_ESTABLISHED 0x3E +#define SYNCHRONIZATION_TIMEOUT 0X3E +#define MAC_CONNECTION_FAILED 0x3F +#define COARSE_CLOCK_ADJUSTMENT_REJECTED_BUT_WILL_TRY_TO_ADJUST_USING_CLOCK_DRAGGING 0x40 + +#define UNKNOWN_ADVERTISING_IDENTIFIER 0x42 +#define LIMIT_REACHED 0x43 +#define OPERATION_CANCELLED_BY_HOST 0x44 +#define PACKET_TOO_LONG 0x45 +#define TOO_LATE 0x46 +#define INSUFFICIENT_CHANNELS 0x48 +#if SUPPORT_BLE + +#if ((MAX_NUM_CNCRT_STAT_MCHNS > 1) && !((SUPPORT_MASTER_CONNECTION) || (SUPPORT_SLAVE_CONNECTION)||(SUPPORT_LE_EXTENDED_ADVERTISING))) +#error define at least either master or slave role +#endif + +#if (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION || SUPPORT_LE_EXTENDED_ADVERTISING) && (MAX_NUM_CNCRT_STAT_MCHNS == 0) +#error define at least one state machine in order to support slave or master role or extended advertising +#endif /* SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION */ + +#if ((SUPPORT_LE_ENCRYPTION) && (!SUPPORT_MASTER_CONNECTION && !SUPPORT_SLAVE_CONNECTION)) +#error Encryption feature shall be enabled only when the master role or slave role is enabled +#endif /* #error */ + +#if ((SUPPORT_LE_PERIODIC_ADVERTISING) && (!SUPPORT_LE_EXTENDED_ADVERTISING)) +#error Since controller supports periodic advertising feature, then it shall support Extended advertising feature +#endif /* #error */ + +#if (SUPPORT_PERIODIC_SYNC_TRANSFER && (!SUPPORT_MASTER_CONNECTION && !SUPPORT_SLAVE_CONNECTION)) +#error Sending PAST IND shall be enabled only when the master role or slave role is enabled +#endif /* #error */ + +#if (SUPPORT_PERIODIC_SYNC_TRANSFER && (!SUPPORT_LE_PERIODIC_ADVERTISING)) +#error Sending PAST IND shall be enabled only when the Periodic ADV is enabled +#endif /* #error */ + +#if ((SUPPORT_LE_POWER_CONTROL) && (!SUPPORT_MASTER_CONNECTION && !SUPPORT_SLAVE_CONNECTION)) +#error LE Power Control feature shall be enabled only when the master role or slave role is enabled +#endif /* #error */ + +#if ((SUPPORT_AOA_AOD) && (!SUPPORT_MASTER_CONNECTION && !SUPPORT_SLAVE_CONNECTION && !SUPPORT_LE_PERIODIC_ADVERTISING)) +#error CTE feature shall be enabled only when the master role or slave role or periodic advertising is enabled +#endif /* #error */ + +#if ((SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS) && (!SUPPORT_LE_PERIODIC_ADVERTISING)) +#error Broadcast Isochronous feature shall be enabled only when periodic advertisng is enabled +#endif /* #error */ + +#if ((SUPPORT_CONNECTED_ISOCHRONOUS) && (!SUPPORT_MASTER_CONNECTION && !SUPPORT_SLAVE_CONNECTION)) +#error Connection Isochronous feature shall be enabled when at least one the master role or slave role is enabled +#endif /* #error */ + +#if (SUPPORT_PERIODIC_ADV_ADI && (!SUPPORT_LE_PERIODIC_ADVERTISING)) +#error Periodic Advertising ADI feature shall be enabled only when periodic advertisng is enabled +#endif /* #error */ + +#if ((SUPPORT_CHANNEL_CLASSIFICATION) && (!SUPPORT_MASTER_CONNECTION && !SUPPORT_SLAVE_CONNECTION)) +#error Channel Classification feature shall be enabled only when the master role or slave role is enabled +#endif /* #error */ + +#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 /* #error */ + +#if ((SUPPORT_CSSA) && (!SUPPORT_LE_EXTENDED_ADVERTISING)) +#error If controller supports Code Scheme selection feature , then it shall support Extended advertising feature +#endif /* ((SUPPORT_CSSA) && (!SUPPORT_LE_EXTENDED_ADVERTISING)) */ + +#if ((SUPPORT_LE_PAWR_ADVERTISER_ROLE) && (!SUPPORT_PERIODIC_SYNC_TRANSFER || !SUPPORT_EXPLCT_BROADCASTER_ROLE)) +#error PAWR feature shall be enabled only if PAST transmitter feature is enabled +#endif /* #error */ + +#if ((SUPPORT_LE_PAWR_SYNC_ROLE) && (!SUPPORT_PERIODIC_SYNC_TRANSFER || !SUPPORT_EXPLCT_OBSERVER_ROLE)) +#error PAWR feature shall be enabled only if PAST recipient feature is enabled +#endif /* #error */ + +#if ((SUPPORT_FRAME_SPACE_UPDATE) && (!SUPPORT_MASTER_CONNECTION && !SUPPORT_SLAVE_CONNECTION)) +#error Frame Space update feature shall be enabled only when the master role or slave role is enabled +#endif /* #error */ + +#if ((SUPPORT_FRAME_SPACE_UPDATE) && (!SUPPORT_EXT_FEATURE_SET)) +#error Frame Space update feature shall be enabled only when the extended feature set is enabled. +#endif /* #error */ + +#if (SUPPORT_CHANNEL_SOUNDING && (!SUPPORT_MASTER_CONNECTION && !SUPPORT_SLAVE_CONNECTION)) +#error Channel Sounding feature can be enabled only if the master role or slave role is enabled +#endif /* #error */ + +#if (SUPPORT_EXT_FEATURE_SET && (!SUPPORT_MASTER_CONNECTION && !SUPPORT_SLAVE_CONNECTION)) +#error Extended Feature Set Exchange feature can be enabled only if the master role or slave role is enabled +#endif /* #error */ + +#if ((SUPPORT_LE_ADVERTISERS_MONITORING) && (!SUPPORT_EXPLCT_OBSERVER_ROLE)) +#error Advertisers Monitoring feature can be enabled when the device is an observer. +#endif /* ((SUPPORT_LE_ADVERTISERS_MONITORING) && (!SUPPORT_EXPLCT_OBSERVER_ROLE)) */ + +#if ((SUPPORT_PHY_SHUTDOWN_MODE) && !(defined(PHY_40nm_3_60_a_tc) || defined(PHY_40nm_3_00_a) || defined(PHY_40nm_3_40_a))) +#error Phy Shutdown feature is only supported on PHY_40nm_3_60_a_tc, PHY_40nm_3_00_a and PHY_40nm_3_40_a +#endif /* ((SUPPORT_PHY_SHUTDOWN_MODE) && !(defined(PHY_40nm_3_60_a_tc) || defined(PHY_40nm_3_00_a) || defined(PHY_40nm_3_40_a))) */ + +/* Exported macros ------------------------------------------------------------*/ + +/* Exported types -------------------------------------------------------------*/ + +/* Exported functions ---------------------------------------------------------*/ +#endif /* SUPPORT_BLE */ +#endif /* ERROR_H_ */ + +/******************* (C) (C) COPYRIGHT 2024 SYNOPSYS, INC. *****END OF FILE****/ diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/ll_intf.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/ll_intf.h index 394a8dbcc..e23260144 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/ll_intf.h +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/ll_intf.h @@ -1,29 +1,37 @@ -/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.32a-lca02/firmware/public_inc/ll_intf.h#3 $*/ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/2.00a-lca01/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 + * @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 and - * associated documentation files (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. - * + * 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. + * 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. * * */ @@ -41,6 +49,14 @@ */ typedef uint32_t ble_stat_t; +#if (SUPPORT_CHANNEL_SOUNDING && \ +(SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) +/** + * @brief type definition for pointer to per cs step data type + */ +typedef void * cs_step_data_t; + +#endif /* (SUPPORT_CHANNEL_SOUNDING && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) */ #ifndef ADDRESS_SIZE @@ -49,6 +65,11 @@ typedef uint32_t ble_stat_t; #define LE_FEATURES_BYTES_NO 8 +#if SUPPORT_EXT_FEATURE_SET +#define MAX_ALLOWED_EXT_FEATURE_SET_PAGES 10 +#define MAX_SUPPORTED_EXT_FEATURE_SET_PAGES 1 +#define EXT_FEATURE_SET_BYTES_NO 24 +#endif /* SUPPORT_EXT_FEATURE_SET */ #define ISO_CODEC_ID_SIZE 5 @@ -61,17 +82,17 @@ typedef uint32_t ble_stat_t; #define RX_DATA_OFFSET 0 /** - * This defined value is used on Link Status custom command as + * 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) + * 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 + * 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 @@ -84,6 +105,17 @@ typedef uint32_t ble_stat_t; #define CHANNEL_CLASSIFICATION_REPORTING_TIMING_PARAM_MAX 150 +#define MAX_IFS_VALUE (10000) /* 10ms */ +#define SUPPORTED_TIFS_TYPES (0x1F) + +#if (SUPPORT_CHANNEL_SOUNDING && \ +(SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) + +#define CS_CHANNEL_MAP_BYTES_NO 10 +#define CS_SYNC_PAYLOAD_BYTES_NO 16 +#define CS_SYNC_USER_PAYLOAD 0x80 /* for user specified payload to be used on cs_test command */ +#define CS_NUM_CHANNELS 72 +#endif /* (SUPPORT_CHANNEL_SOUNDING && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) */ /* Maximum number of supported sleep clock accuracy */ #define MAXIMUM_SLP_CLK_ACCURACY 1 @@ -185,6 +217,15 @@ enum _sm_status_e { SM_STATUS_CENT_CIG = 14, }; +#if SUPPORT_LE_ADVERTISERS_MONITORING + +typedef enum _mntrd_adv_rssi_condition_e { + RSSI_LOWER_THAN_RSSI_LOW_LONGER_THAN_TIMEOUT = 0x00, + RSSI_EQUAL_OR_GREATER_THAN_RSSI_HIGH = 0x01 +} mntrd_adv_rssi_condition_e; + +#endif /* SUPPORT_LE_ADVERTISERS_MONITORING */ + /*================================= Structures =====================================*/ /** @@ -296,6 +337,11 @@ typedef struct _ble_intf_cis_estblshd_evnt_st{ 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; + uint32_t sub_intrv; + uint32_t sdu_intrv_m_to_s; + uint32_t sdu_intrv_s_to_m; + uint16_t max_sdu_m_to_s; + uint16_t max_sdu_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; @@ -308,6 +354,7 @@ typedef struct _ble_intf_cis_estblshd_evnt_st{ uint8_t bn_s_to_m; uint8_t ft_m_to_s; /* flush timeout */ uint8_t ft_s_to_m; + uint8_t framing; } ble_intf_cis_estblshd_evnt_st; /** @@ -369,6 +416,9 @@ typedef struct _ble_intf_create_big_common_param_cmd_st{ 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)*/ +#if SUPPORT_ISO_UNSEG_MODE + uint8_t seg_mode; /* indicates the framing mode: Segmented Framed or Unsegmented Framed */ +#endif /* SUPPORT_ISO_UNSEG_MODE */ 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; @@ -507,6 +557,16 @@ typedef struct _le_subrate_change_evnt_st{ }le_subrate_change_evnt_st; #endif /* SUPPORT_LE_ENHANCED_CONN_UPDATE */ +#if SUPPORT_FRAME_SPACE_UPDATE +typedef struct _le_frame_updt_cmplt_st{ + uint16_t conn_handle; + uint16_t frame_space_value; + uint16_t spacing_type; + uint8_t phys; + uint8_t initiator; + uint8_t status; +}le_frame_updt_cmplt_st; +#endif /* SUPPORT_FRAME_SPACE_UPDATE */ typedef enum _enum_ext_create_conn_verison { @@ -672,6 +732,23 @@ typedef struct _ble_prdc_adv_rsp_rprt_st }ble_prdc_adv_rsp_rprt_st; #endif/*SUPPORT_LE_PAWR_ADVERTISER_ROLE*/ +#if SUPPORT_LE_ADVERTISERS_MONITORING + +typedef enum _ble_mntrd_adv_device_type_e +{ + MNTRD_ADV_PUBLIC, MNTRD_ADV_RANDOM +} ble_mntrd_adv_device_type_e; + +typedef struct _ble_mntrd_add_adv_device_st +{ + uint8_t addr[ADDRESS_SIZE]; + uint8_t signal_loss_timeout; + int8_t rssi_low_threshold; + int8_t rssi_high_threshold; + ble_mntrd_adv_device_type_e addr_type; +} ble_mntrd_add_adv_device_st; +#endif /* SUPPORT_LE_ADVERTISERS_MONITORING */ + /* HCI Commands Parameters Structures */ #if (SUPPORT_AOA_AOD) #if (SUPPORT_EXPLCT_BROADCASTER_ROLE) @@ -938,6 +1015,304 @@ typedef struct _le_rmt_conn_param_req_rply_cmd_st { uint16_t max_ce_length; /*Range: 0x0000 0xFFFF, Time = N * 0.625 msec.*/ } le_rmt_conn_param_req_rply_cmd_st; +#if SUPPORT_FRAME_SPACE_UPDATE +typedef struct _le_frame_space_updt_cmd_st +{ + uint16_t conn_handle_id ; + uint16_t frame_space_min ; + uint16_t frame_space_max ; + uint16_t spacing_type ; + uint8_t phys ; +}le_frame_space_updt_cmd_st; +#endif /* SUPPORT_FRAME_SPACE_UPDATE */ + +/* BLE 6.0 Channel Sounding */ + +#if (SUPPORT_CHANNEL_SOUNDING && \ +(SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) + +/* BLE_6.0 Channel Sounding Commands */ + +/** + * @brief CS capability exchange parameters (hold the local/peer device capabilites) + * used on the following commands/events: + * LE_CS_Read_Local_Supported_Capabilities command + * LE_CS_Write_Cached_Remote_Supported_Capabilities command + * LE_CS_Read_Remote_supported_Capabilities_Complete event + */ +typedef struct _ble_cs_capabilities_cmd_st { + uint16_t max_consecutive_procedures_supported; /* maximum number of consecutive CS procedures that the controller can run in a back-to-back fashion (range 0x0001 to 0xFFFF, 0x0000 indicates indifinite number) */ + uint16_t optional_nadm_sounding_capability; /* indicates the support of Normalized Attack Detector Metric (NADM) when CS SYNC packet with sounding sequence is received (bit 0: NADM support) */ + uint16_t optional_nadm_random_capability; /* indicates the support of Normalized Attack Detector Metric (NADM) when CS SYNC packet with random sequence is received (bit 0: NADM support) */ + uint16_t subfeatures_supported; /* indicates the optional subfeatures supported by the controller (bit 0: companion signal support, bit 1: FAE of zero relative to mode-0 tx on reflector role support, bit 2: channel selection algorithm 3c support, bit 3: phase-based ranging for sounding sequence support) */ + uint16_t optional_t_ip1_supported; /* indicates the supported optional T_IP1 values by the controller (bit 0: 10 us support, bit 1: 20 us support, bit 2: 30 us support, bit 3: 40 us support, bit 4: 50 us support, bit 5: 60 us support, bit 6: 80 us support) */ + uint16_t optional_t_ip2_supported; /* indicates the supported optional T_IP2 values by the controller (bit 0: 10 us support, bit 1: 20 us support, bit 2: 30 us support, bit 3: 40 us support, bit 4: 50 us support, bit 5: 60 us support, bit 6: 80 us support) */ + uint16_t optional_t_fcs_supported; /* indicates the supported optional T_FCS values by the controller (bit 0: 15 us support, bit 1: 20 us support, bit 2: 30 us support, bit 3: 40 us support, bit 4: 50 us support, bit 5: 60 us support, bit 6: 80 us support, bit 7: 100 us support, bit 8: 120 us support) */ + uint16_t optional_t_pm_supported; /* indicates the supported optional T_PM values by the controller (bit 0: 10 us support, bit 1: 20 us support) */ + uint8_t num_config_supported; /* number of supported configurations on the controller per connection (range: 0x01 to 0x04) */ + uint8_t num_antennas_supported; /* number of supported antennas on the controller (range: 0x01 to 0x04) */ + uint8_t max_antenna_paths_supported; /* max number of antenna paths supported by the controller (range: 0x01 to 0x04) */ + uint8_t roles_supported; /* indicates the supported roles by the controller (bit 0: Initiator, bit 1: Reflector) */ + uint8_t optional_modes_supported; /* indicates the support for optional mode (mode_3) by the controller (bit 0: mode-3) */ + uint8_t rtt_capability; /* indicates the time-of-flight measurement precision for each of the following methods (bit 0: AA_Only, bit 1: Sounding, bit 2: Random_Payload) */ + uint8_t rtt_aa_only_n; /* number of CS SYNC packets needed to fulfill the precision specified on rtt_capability for CS SYNC packets with access address only (range: 0x01 to 0xFF, 0x00 inidicates that RTT coarse is unsupported) */ + uint8_t rtt_sounding_n; /* number of CS SYNC packets needed to fulfill the precision specified on rtt_capability for CS SYNC packets with sounding sequence (range: 0x01 to 0xFF, 0x00 inidicates that RTT sounding sequence is unsupported) */ + uint8_t rtt_random_payload_n; /* number of CS SYNC packets needed to fulfill the precision specified on rtt_capability for CS SYNC packets with random sequence (range: 0x01 to 0xFF, 0x00 inidicates that RTT random sequence is unsupported) */ + uint8_t optional_cs_sync_phys_supported; /* indicates the support for optional phy for CS SYNC packets (LE 2M PHY) by the controller (bit 1: LE 2M PHY support) */ + uint8_t t_sw_supported; /* indicates the supported T_SW values by the controller (supported values: 0x01 [1 us], 0x02 [2 us], 0x04 [4 us], 0x0A [10 us]) */ + uint8_t tx_snr_capability; +} ble_cs_capabilities_cmd_st; + +/** + * @brief CS Procedure parameters (hold cs procedure parameters) + * used on the following commands/events: + * LE_CS_Set_Procedure_Parameters command + */ +typedef struct _ble_cs_prcdr_params_cmd_st { + uint32_t min_subevent_len; /* indicates the suggested minimum subevent duration in microseconds (range: 0x0004E2 [1250 us] to 0x3D0900 [4 s]) */ + uint32_t max_subevent_len; /* indicates the suggested maximun subevent duration in microseconds (range: 0x0004E2 [1250 us] to 0x3D0900 [4 s]) */ + uint16_t max_procedure_len; /* indicates the maximum duration of a single cs procedure in 0.625 ms units (range: 0x0001 [0.625 ms] to 0xFFFF [40.959375 s]) */ + uint16_t min_procedure_interval; /* indicates the minimum number of connection events for consecuitive cs procedure interval (range: 0x0001 to 0xFFFF, 0x0000 is ignored in case of max_procedure_count = 1 else 0x0000 is RFU) */ + uint16_t max_procedure_interval; /* indicates the maximum number of connection events for consecuitive cs procedure interval (range: 0x0001 to 0xFFFF, 0x0000 is ignored in case of max_procedure_count = 1 else 0x0000 is RFU) */ + uint16_t max_procedure_count; /* indicates the maximum number of scheduled cs procedure (range: 0x0001 to 0xFFFF, 0x0000 indicates continuous cs procedures untill disabled) */ + uint8_t config_id; /* indicates the configuration identifier to be used for the current cs procedure (range: 0 to 3) */ + uint8_t tone_ant_cfg_slct; /* indicates the antenna configuration index (range: 0x00 to 0x07) */ + uint8_t phy; /* indicates the phy constrained with tx_pwr_delta parameter (0x01: LE_1M_PHY, 0x02: LE_2M_PHY) */ + uint8_t preferred_peer_antenna; /* indicates the local device preferred antenna elements to be used by the remote device in antenna configuration index selection (bitfield of 4 bits, range: 0x00 to 0x0F) */ + int8_t tx_pwr_delta; /* indicates the recomended difference between remote device power and the output power level of the phy specified in dB (range: 0x81 [-127 dB] to 0x7F [127 dB], 0x80 indicates that no recommended difference) */ + uint8_t snr_ctrl_init; /* indicates the SNR control adjustment for the CS_SYNC transmissions of the initiator. (supported values: 0x00 (18db), 0x01 (21db), 0x02 (24db), 0x03 (27db), 0x04 (30db), 0xFF (Not Applied))*/ + uint8_t snr_ctrl_refl; /* indicates the SNR control adjustment for the CS_SYNC transmissions of the reflector. (supported values: 0x00 (18db), 0x01 (21db), 0x02 (24db), 0x03 (27db), 0x04 (30db), 0xFF (Not Applied))*/ +} ble_cs_prcdr_params_cmd_st; + +/** + * @brief CS Configuration parameters (hold the parameters for + * a cs configuration identified by config_id) + * used on the following commands/events: + * LE_CS_Create_Config command + * LE_CS_Remove_Config command + * LE_CS_Create_Config_Complete event + */ +typedef struct _ble_cs_config_cmd_st { + uint8_t create_context; /* indicates the context of the configuration to be created and whether CHANNEL_SOUNDING_CONFIGURATION_PROCEDURE is needed to start to exchange configurations or not (0: local context, 1: global context) */ + uint8_t main_mode_type; /* indicates the type of the cs main mode step (0x01: Mode-1, 0x02: Mode-2, 0x03: Mode-3) */ + uint8_t sub_mode_type; /* indicates the type of the cs sub mode step (0x01: Mode-1, 0x02: Mode-2, 0x03: Mode-3) */ + uint8_t min_main_mode_steps; /* indicates lower bound for Main_Mode_Steps which is number of main mode steps that is used before using 1 sub mode step (not including main_mode_repetition) */ + uint8_t max_main_mode_steps; /* indicates upper bound for Main_Mode_Steps which is number of main mode steps that is used before using 1 sub mode step (not including main_mode_repetition) */ + uint8_t main_mode_repetition; /* indicates number of main mode steps from subevent that is repeated on subsequent subevent after the initial mode-0 steps */ + uint8_t mode_0_steps; /* indicates number of mode-0 steps at the beginning of a subevent */ + uint8_t role; /* indicates the role that is used by the local device for the current configuration (cs_role_e 0x00 CS_ROLE_INITIATOR, 0x01 CS_ROLE_REFLECTOR) */ + uint8_t rtt_type; /* indicates the type of RTT used on all mode-1 and mode-3 CS_SYNC packets */ + uint8_t cs_sync_phy; /* indicates the type of the phy used for CS_SYNC packets exchange (0x01: LE_1M_PHY, 0x02: LE_1M_PHY) */ + uint8_t channel_map[CS_CHANNEL_MAP_BYTES_NO]; /* per-channel bit array holding used and unused cs channels for the current cs configuration */ + uint8_t channel_map_repetition; /* indicates number of times the given channel mapping is used to generate the cs channel mapping to be used for non-mode 0 steps using either channel selection algorithm 3b or 3c */ + uint8_t channel_selection_type; /* indicates the channel selection algorithm to be used on non-mode 0 steps (0x00: algo_3b, 0x01: algo_3c) */ + uint8_t ch3c_shape; /* in case of channel_selection_type=0x01: indicates the channel sequence shape to be used (0x00: Hat shape, 0x01: X shape) */ + uint8_t ch3c_jump; /* in case of channel_selection_type=0x01: indicates the number of channels to be skipped in generating channel map using channel selection algorithm 3c */ + uint8_t companion_signal_enable; /* indicates whether the local controller shall request the remote controller to enable or disable the companion signal being sent during the subsequent CS procedures */ +} ble_cs_config_cmd_st; + + +/* CS TEST COMMAND */ + +/** + * @brief CS Test command Override Parameters Data + * Per config overridden + * used on the following commands/events: + * LE_CS_Test command + */ +typedef union _ble_cs_test_chnl_hop_patrn_un { + struct + { + uint8_t *chnl_map; /* array holding list of channels to be used on the current CS test */ + uint8_t chnl_sel_type; /* indicates which Channel Selection Algorithm to use when calculating the channel sequence for the CS procedure (range: 0 (3A/3B), 1 (3C)) */ + uint8_t ch3c_shape; /* indicates which shape to use when calculating Channel Selection Algorithm #3c. Ignored otherwise. (range: 0 (Hat Shape), 1 (X Shape)) */ + uint8_t ch3c_jump; /* indicate which CSChannelJump value to use when calculating Channel Selection Algorithm #3c. Ignored otherwise. (range: 1 to 110) */ + }default_params; + struct + { + uint8_t *chnl_list; /* array holding list of channels to be used on the current CS test */ + uint8_t chnl_length; /* indicates number of channels on channel parameter (range: 1 to 72) */ + }override_params; +} ble_cs_test_chnl_hop_patrn_un; + +typedef struct _ble_cs_test_access_addr_st { + uint8_t aa_init[4]; /* indicates the access address used by inititor on CS SYNC packets on the current CS test */ + uint8_t aa_refl[4]; /* indicates the access address used by reflector on CS SYNC packets on the current CS test */ +} ble_cs_test_access_addr_st; + +typedef struct _ble_cs_test_ss_marker_pos_st { + uint8_t ss_marker1_position; /* indicates the position of the first marker of 32-bit or 96-bit sounding sequence */ + uint8_t ss_marker2_position; /* indicates the position of the second marker of a 96-bit sounding sequence */ +} ble_cs_test_ss_marker_pos_st; + +typedef struct _ble_cs_test_rand_seq_st { + uint8_t cs_sync_payload_pattern; /* indicates the pattern used for CS SYNC packet payload (range: 0x00 to 0x07, 0x80 value indicates that a user specified value will be used, using cs_sync_user_payload parameter) */ + uint8_t cs_sync_custom_payload[CS_SYNC_PAYLOAD_BYTES_NO]; /* 16 byte user specified CS SYNC packet payload if cs_sync_payload_pattern parameter indicates user payload (0x80) otherwise all bytes are set to Zero */ + uint8_t cs_sync_seq_size; /*indicates the payload size according to the random sequence type.*/ +} ble_cs_test_rand_seq_st; + +/** + * @brief CS Test command Override Parameters Data + * used on the following commands/events: + * LE_CS_Test command + */ +typedef struct _ble_cs_test_ovrde_param_st { + ble_cs_test_access_addr_st access_addr; /* structure that holds access address */ + ble_cs_test_chnl_hop_patrn_un chnl_hop_patrn; /* structure that holds channel hopping pattern */ + ble_cs_test_ss_marker_pos_st ss_marker_pos; /* structure that holds sounding sequence marker position */ + ble_cs_test_rand_seq_st rand_seq; /* structure that holds random sequence */ + uint8_t main_mode_steps; /* holds number of main mode steps to be shceduled before a sub-mode step being scheduled (not including main_mode_repetition) */ + uint8_t tpm_ext_slots; /* holds a flag to indicate the presence of tone extention slots */ + uint8_t ant_perm_idx; /* holds the antenna permutation index which is used to indicate the antenna switching pattern for CS steps that contains CS tones */ + uint8_t ss_marker_val; /* holds the value of sounding sequence marker value */ +} ble_cs_test_ovrde_param_st; + +typedef struct _ble_cs_ovrde_cfg_st { + uint16_t chnl_hop_patrn :1; /* channel hopping pattern DRBG override flag */ + uint16_t rfu_1 :1; + uint16_t main_mode_steps :1; /* main mode steps DRBG override flag */ + uint16_t tpm_ext_slots :1; /* extension slot presence DRBG override flag */ + uint16_t ant_perm_idx :1; /* antenna permutation index DRBG override flag */ + uint16_t access_addr :1; /* access address DRBG override flag */ + uint16_t ss_marker_pos :1; /* souding sequence markar position DRBG override flag */ + uint16_t ss_marker_val :1; /* souding sequence markar value DRBG override flag */ + uint16_t rand_seq :1; /* random sequence DRBG override flag */ + uint16_t rfu_2 :1; + uint16_t stbl_phase_test :1; /* this bit's value indicates that a stable phase test should be ran. */ + uint16_t rfu_3 :5; +} ble_cs_ovrde_cfg_st; + +typedef struct _ble_cs_step_time_param_st { + uint8_t t_ip1_time; /* indicates the cs packets interlude period to be used in microseconds (supported values: 10 us, 20 us, 30 us, 40 us, 50 us, 60 us, 80 us, 145 us) */ + uint8_t t_ip2_time; /* indicates the cs tone interlude period to be used in microseconds (supported values: 10 us, 20 us, 30 us, 40 us, 50 us, 60 us, 80 us, 145 us) */ + uint8_t t_fcs_time; /* indicates the frequency change spacing period to be used in microseconds (supported values: 10 us, 20 us, 30 us, 40 us, 50 us, 60 us, 80 us, 100 us, 120 us, 150 us) */ + uint8_t t_pm_time; /* indicates the phase measurement period of cs tones to be used in microseconds (supported values: 10 us, 20 us, 40 us) */ +} ble_cs_step_time_param_st; +/** + * @brief CS Test command parameter + * used on the following commands/events: + * LE_CS_Test command + */ +typedef struct _ble_cs_test_cmd_st { + ble_cs_test_ovrde_param_st override_params_data; /* structure holding the CS parameters the is not derived from DRBG based on override_config bitfield */ + uint32_t subevent_len; /* indicates the maximum subevent duration in microseconds (range: 0x0004E2 [1250 us] to 0x3D0900 [4 s]) */ + ble_cs_ovrde_cfg_st override_config; /* bitfield indicates whether the corresponding CS parameter is derived from DRBG or from hci parameter override_params_data */ + uint16_t subevent_interval; /* indicates the gap between 2 consecutive CS subevent in 0.625 ms units (range: 0x0001 [0.625 ms] to 0xFFFF [40.959375 s], 0x0000 value indicates that only 1 subevent will be executed) */ + uint16_t drbg_nonce; /* indicates the 14th and 15th octet of the drbg nonce used (other octets are padded with 0) the most significant octet is the 14th octet and the least significant octet is the 15th octet */ + uint8_t main_mode_type; /* indicates the type of the cs main mode step (0x01: Mode-1, 0x02: Mode-2, 0x03: Mode-3) */ + uint8_t sub_mode_type; /* indicates the type of the cs sub mode step (0x01: Mode-1, 0x02: Mode-2, 0x03: Mode-3) */ + uint8_t main_mode_repetition; /* indicates number of main mode steps from subevent that is repeated on subsequent subevent after the initial mode-0 steps (range: 0x00 to 0x03) */ + uint8_t mode_0_steps; /* indicates number of mode-0 steps at the beginning of a subevent (range: 0x01 to 0x03) */ + uint8_t role; /* indicates the role that is used by the local device for the current configuration (cs_role_e 0x00 CS_ROLE_INITIATOR, 0x01 CS_ROLE_REFLECTOR) */ + uint8_t rtt_type; /* indicates the type of RTT used on all mode-1 and mode-3 CS_SYNC packets (range: 0x00 to 0x06) */ + uint8_t cs_sync_phy; /* indicates the type of the phy used for CS_SYNC packets exchange (0x01: LE_1M_PHY, 0x02: LE_1M_PHY) */ + uint8_t cs_sync_ant_slct; /* indicates the select antenna identifier for CS_SYNC packets exchange (range: 0x01 to 0x04) */ + uint8_t max_num_subevents; /* indicates the maximum number of subevents in the procedure. (range: 0x00 to 0x20, where 0x00 signifies that this value should be ignored.) */ + uint8_t t_ip1_time; /* indicates the cs packets interlude period to be used in microseconds (supported values: 10 us, 20 us, 30 us, 40 us, 50 us, 60 us, 80 us, 145 us) */ + uint8_t t_ip2_time; /* indicates the cs tone interlude period to be used in microseconds (supported values: 10 us, 20 us, 30 us, 40 us, 50 us, 60 us, 80 us, 145 us) */ + uint8_t t_fcs_time; /* indicates the frequency change spacing period to be used in microseconds (supported values: 10 us, 20 us, 30 us, 40 us, 50 us, 60 us, 80 us, 100 us, 120 us, 150 us) */ + uint8_t t_pm_time; /* indicates the phase measurement period of cs tones to be used in microseconds (supported values: 10 us, 20 us, 40 us) */ + uint8_t t_sw_time; /* indicates the antenna switching period to be used in microseconds (supported values: 0x00, 1 us, 2 us, 4 us, 10 us) */ + uint8_t ant_cfg_idx; /* indicates the antenna configuration index used during the cs tone phase (range: 0 to 7) */ + uint8_t companion_signal_enable; /* indicates whether the local controller shall enable or disable the companion signal being used and the type of the companion signal in case of being enabled (ranges: 0x00 to 0x03) */ + uint8_t snr_ctrl_init; /* indicates the SNR control adjustment for the CS_SYNC transmissions of the initiator. (supported values: 0x00 (18db), 0x01 (21db), 0x02 (24db), 0x03 (27db), 0x04 (30db), 0xFF (Not Applied))*/ + uint8_t snr_ctrl_refl; /* indicates the SNR control adjustment for the CS_SYNC transmissions of the reflector. (supported values: 0x00 (18db), 0x01 (21db), 0x02 (24db), 0x03 (27db), 0x04 (30db), 0xFF (Not Applied))*/ + uint8_t chnl_map_rep; /* indicates the number of times the channels indicated by the Channel_Map or the Channel field in the Override Parameters is cycled through for non-mode‑0 steps within a CS procedure. (range: 0x01 to 0xFF)*/ + int8_t tx_pwr_lvl; /* indicates the transmit power level specified (or the nearest supported level) in dbm (range: 0x81 [-127 dbm] to 0x14 [20 dbm], 0x7E and 0x7F are used to set transmitter to minimum and maximum available power level respectively) */ + uint8_t override_params_length; /* inidicates override_params_data paramter size in bytes (range: 0 to 255) */ +} ble_cs_test_cmd_st; + +/* BLE_6.0 Channel Sounding Events */ + +/** + * @brief CS Procedure Enable Complete event parameter + * + */ +typedef struct _ble_cs_prcdr_en_cmplt_evnt_st { + uint32_t subevent_len; /* holds cs subevent duration in microseconds (range: 0x0004E2 [1250 us] to 0x3D0900 [4 s]) */ + uint16_t conn_handle; /* holds the connection handle identifier (range: 0x0000 to 0x0EFF) */ + uint16_t subevent_interval; /* holds time between consecutive subevents anchored off the same ACL anchor point in units of 0.625 ms (range: 0x0000 [0 ms] to 0xFFFF [40.959375 s]) */ + uint16_t event_interval; /* holds number of ACL connection events between 2 consecutive cs events (range: 0x0000 to 0xFFFF) */ + uint16_t procedure_interval; /* holds number of ACL connection events between 2 consecutive cs procedures (range: 0x0000 to 0xFFFF) */ + uint16_t procedure_count; /* holds number of procedures executed (range: 0x0001 to 0xFFFF, 0x000 indicates indefinite number of cs procedures until disabled by host) */ + uint16_t max_procedure_length; /* holds the selected maximum duration of each CS procedure */ + uint8_t config_id; /* holds the cs configuration identifier (range: 0 to 3) */ + uint8_t status; /* holds event status (0x00: successful, else: failed) */ + uint8_t state; /* holds cs state (0x00: disabled [all subsequent parameters shall be ignored], 0x01: enabled) */ + uint8_t tone_ant_cfg_slct; /* holds antenna configuration inex using on the current cs procedure (range: 0 to 7) */ + int8_t slctd_tx_pwr; /* holds the select tx power level (or estimated tx power level in case of a varying one) in dbm of the current cs procedure (range: 0x81 [-127 dbm] to 0x14 [20 dbm], 0x7F indicates that tx power level is unavailable) */ + uint8_t subevents_per_event; /* holds number of subevents anchored off the same ACL anchor point (range: 0x01 to 0x10) */ +} ble_cs_prcdr_en_cmplt_evnt_st; + +/** + * @brief holds mode- and role- specific step data object type + * used on the following commands/events: + * LE_CS_Subevent_Result event + * LE_CS_Subevent_Result_Continue event + */ +typedef struct _ble_cs_subevent_result_mode_0_st { + int16_t measured_freq_offset; /* indicates the frequency offset measured in units of 0.01 ppm (15 signed bits meaningful, range: 0xD8F0 [-100 ppm] to 0x2710 [100 ppm]) */ + uint8_t packet_quality; /* indicates the quality of packet (4 bits for the CS AA error check + 4 bits for CS payload number of error bits) */ + int8_t packet_rssi; /* indicates the packet rssi in dB (8 signed bits, range: 0x81 [-127 dB] to 0x14 [20 dB], 0x7F indicates that rssi is unavailable) * */ + uint8_t packet_antenna; /* indicates the antenna identifier for the antenna used on RTT packet */ +} ble_cs_subevent_result_mode_0_st; + +typedef struct _ble_cs_subevent_result_mode_1_st { + uint32_t packet_pct1; /* indicates the Phase Correction Term for IQ samples (3 Octets meaningful, 12 bits I sample + 12 bits Q sample, 0xFFFFFF: indicates no PCT) */ + uint32_t packet_pct2; /* indicates the Phase Correction Term for IQ samples (3 Octets meaningful, 12 bits I sample + 12 bits Q sample, 0xFFFFFF: indicates no PCT) */ + int16_t toa_tod_differnece; /* indicates the time difference between time of arrival and time of departure in case of initiator role or time of departure and time of arrival in case of reflector role during a CS step execluding the known nominal offsets in units of 0.5 ns (16 signed bits, range: 0x8001 [-16.3835 us] to 0x7FFF [16.3835 us], 0x8000 indicates no time difference) */ + uint8_t packet_quality; /* indicates the quality of packet (4 bits for the CS AA error check + 4 bits for CS payload number of error bits) */ + uint8_t packet_nadm; /* indicates the likelihood of an attack being detected from a random or sounding sequence */ + int8_t packet_rssi; /* indicates the packet rssi in dB (8 signed bits, range: 0x81 [-127 dB] to 0x14 [20 dB], 0x7F indicates that rssi is unavailable) * */ + uint8_t packet_antenna; /* indicates the antenna identifier for the antenna used on RTT packet */ +} ble_cs_subevent_result_mode_1_st; + +typedef struct _ble_cs_subevent_result_mode_2_st { + uint32_t *tone_pct; /* array holding the per antenna path tone Phase Correction Term (tone_pct[num_ant_paths+1], tone_pct[i] has 3 Octets meaningful, 12 bits I sample + 12 bits Q sample) */ + uint8_t *tone_quality_indicator; /* array holding the per antenna path tone quality (tone_quality_indicator[num_ant_paths+1], tone_pct[i] has 4 bits for the tone quality + 4 bits tone extension slot) */ + uint8_t antenna_perm_idx; /* indicates the permutation index for the selected number of antenna paths (range: 0x00 to 0x17) */ +} ble_cs_subevent_result_mode_2_st; + +typedef struct _ble_cs_subevent_result_mode_3_st { + uint32_t *tone_pct; /* array holding the per antenna path tone Phase Correction Term (tone_pct[num_ant_paths+1], tone_pct[i] has 3 Octets meaningful, 12 bits I sample + 12 bits Q sample) */ + uint32_t packet_pct1; /* indicates the Phase Correction Term for IQ samples (3 Octets meaningful, 12 bits I sample + 12 bits Q sample, 0xFFFFFF: indicates no PCT) */ + uint32_t packet_pct2; /* indicates the Phase Correction Term for IQ samples (3 Octets meaningful, 12 bits I sample + 12 bits Q sample, 0xFFFFFF: indicates no PCT) */ + uint8_t *tone_quality_indicator; /* array holding the per antenna path tone quality (tone_quality_indicator[num_ant_paths+1], tone_pct[i] has 4 bits for the tone quality + 4 bits tone extension slot) */ + int16_t toa_tod_differnece; /* indicates the time difference between time of arrival and time of departure in case of initiator role or time of departure and time of arrival in case of reflector role during a CS step execluding the known nominal offsets in units of 0.5 ns (16 signed bits, range: 0x8001 [-16.3835 us] to 0x7FFF [16.3835 us], 0x8000 indicates no time difference) */ + uint8_t packet_quality; /* indicates the quality of packet (4 bits for the CS AA error check + 4 bits for CS payload number of error bits) */ + uint8_t packet_nadm; /* indicates the likelihood of an attack being detected from a random or sounding sequence */ + int8_t packet_rssi; /* indicates the packet rssi in dB (8 signed bits, range: 0x81 [-127 dB] to 0x14 [20 dB], 0x7F indicates that rssi is unavailable) * */ + uint8_t packet_antenna; /* indicates the antenna identifier for the antenna used on RTT packet */ + uint8_t antenna_perm_idx; /* indicates the permutation index for the selected number of antenna paths (range: 0x00 to 0x17) */ +} ble_cs_subevent_result_mode_3_st; + +/** + * @brief CS Subevent Result event parameter + * used on the following commands/events: + * LE_CS_Subevent_Result event + * LE_CS_Subevent_Result_Continue event + * + */ +typedef struct _ble_cs_subevent_result_evnt_st { + uint8_t *step_mode; /* array holding per-step mode (step_mode[num_steps_reported], range of step_mode[i]: 0x00 to 0x03) */ + uint8_t *step_channel; /* array holding per-step channel (step_channel[num_steps_reported], range of step_channel[i]: 0x00 to 0x4E, [0x00, 0x01, 0x17, 0x18, 0x19, 0x4D, 0x4E] are invalid channel indices, others are RFU) */ + uint8_t *step_data_len; /* array holding per-step data length in bytes (step_data_len[num_steps_reported], range of step_data_len[i]: 0x00 to 0xFF) */ + cs_step_data_t *step_data; /* array holding cs_step_data_t pointers that points to per-mode and role data object (step_data[num_steps_reported]) */ + uint16_t conn_handle; /* holds the connection handle identifier (range: 0x0000 to 0x0EFF, 0xFFFF indicates CS test) */ + uint16_t conn_event_counter; /* holds the ACL connection event counter that the current CS result is anchored from */ + uint16_t procedure_counter; /* holds number of completed cs procedures since cs security start procedure (range: 0x0000 to 0xFFFF) */ + int16_t freq_compensation; /* holds the frequency compensation value in units of 0.01 ppm (15 signed bits meaningful, range: 0xD8F0 [-100 ppm] to 0x2710 [100 ppm], 0xC000 frequency compensation is unavailable) */ + uint8_t config_id; /* holds the cs configuration identifier (range: 0 to 3) */ + int8_t ref_power_level; /* holds the reference power level in dBm (8 signed bits, range: 0x81 [-127 dBm] to 0x14 [20 dBm], 0x7F indicates that reference power level isn't applicable) * */ + uint8_t prcdr_done_status; /* holds the status of the current cs procedure (4 bits for status + 4 bits RFU) */ + uint8_t subevnt_done_status; /* holds the status of the current cs subevent (4 bits for status + 4 bits RFU) */ + uint8_t abort_reason; /* holds the abort reason for the current procedure and subevent (4 bits for procedure done status + 4 bits for subevent done status) */ + uint8_t num_ant_paths; /* holds number of antenna paths used during the current cs steps to be reported (range: 0x01 to 0x04, 0x00 indicates that no phase measurement during the current cs steps) */ + uint8_t num_steps_reported; /* holds number of cs steps to be reported (range: 0x01 to 0xA0) */ +} ble_cs_subevent_result_evnt_st; + +#endif /* (SUPPORT_CHANNEL_SOUNDING && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) */ + #if SUPPORT_RX_DTP_CONTROL @@ -951,6 +1326,16 @@ typedef struct _ctrl_rx_dtp_st { #endif /* SUPPORT_RX_DTP_CONTROL */ +#if SUPPORT_LE_ADVERTISERS_MONITORING + +typedef struct _ble_intf_mntrd_adv_report_evnt { + uint8_t addr[ADDRESS_SIZE]; + uint8_t addr_type; + mntrd_adv_rssi_condition_e condition; +} ble_intf_mntrd_adv_report_evnt_st; + +#endif /* SUPPORT_LE_ADVERTISERS_MONITORING */ + /** * @brief HCI Dispatch table containing callback event functions */ @@ -1596,6 +1981,134 @@ struct hci_dispatch_tbl { #endif/*SUPPORT_LE_PAWR_ADVERTISER_ROLE*/ +#if SUPPORT_FRAME_SPACE_UPDATE +/** + * @brief this API for the frame_space_complete event based on the parameters passed + * + * @param[in] evnt_param pointer to struct of type le_frame_updt_cmplt_st that holds the parameters + * + * @return void + */ + void (*ll_intf_le_frame_space_updt_cmplt_evnt)(le_frame_updt_cmplt_st* evnt_param); +#endif /* SUPPORT_FRAME_SPACE_UPDATE */ + +#if (SUPPORT_CHANNEL_SOUNDING && \ +(SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) + +/** + * @brief Send the cs remote supported capabilities complete event to host. + * + * @param status : [in] return status of the event + * @param conn_handle_id : [in] connection handle identifier + * @param remote_capabilities : [in] remote capabilities to be reported + * + * @retval None + */ + void (*ll_intf_cs_read_remote_supported_capabilities_cmplt_evnt)( + ble_stat_t status, + uint16_t conn_handle_id, + ble_cs_capabilities_cmd_st *remote_capabilities); + +/** + * @brief Send the cs security enable complete event to host. + * + * @param status : [in] return status of the event + * @param conn_handle_id : [in] connection handle identifier + * + * @retval None + */ + void (*ll_intf_cs_security_enable_cmplt_evnt)( + ble_stat_t status, uint16_t conn_handle_id); + +/** + * @brief Send the cs read remote FAE table complete event to host. + * + * @param status : [in] return status of the event + * @param conn_handle_id : [in] connection handle identifier + * @param fae_table : [in] pointer to array holding remote FAE table content + * + * @retval None + */ + void (*ll_intf_cs_read_remote_fae_table_cmplt_evnt)( + ble_stat_t status, uint16_t conn_handle_id, int8_t *fae_table); + + +/** + * @brief Send the cs config complete event to host as a response for + * cs_create_config command or cs_remove_config command. + * + * @param status : [in] return status of the event + * @param conn_handle_id : [in] connection handle identifier + * @param config_id : [in] configuration identifier + * @param action : [in] the retuned state of the configuration reported (0x00: remove/diable, 0x01: create/enable) + * @param ptr_cs_config : [in] pointer to structure hold the config parameters (in case the config is created action=0x01) + * @param ptr_cs_step_time : [in] pointer to structure hold CS step timing parameters (T_IP1, T_IP2, T_FCS and T_PM) + * + * @retval None + */ + void (*ll_intf_cs_config_cmplt_evnt)( + uint8_t status, uint16_t conn_handle_id, + uint8_t config_id, uint8_t action, + ble_cs_config_cmd_st *ptr_cs_config, + ble_cs_step_time_param_st *ptr_cs_step_time); + +/** + * @brief Send the CS Procedure Enable complete event to host. + * + * @param ptr_evnt_params : [in] pointer to struct holding procedure enable + * + * @retval None + */ + void (*ll_intf_cs_procedure_enable_cmplt_evnt)(ble_cs_prcdr_en_cmplt_evnt_st *ptr_evnt_params); + + +/** + * @brief Send the CS Subevent Result event to host. + * @param [in] evnt_pckt_p : pointer to the host buffer. + * @param [in] data_length : length of data expected to be found in the buffer. + * @retval None + */ + void (*ll_intf_cs_subevent_result_evnt)(cs_host_buffer* evnt_pckt_p, uint8_t data_length); + +/** + * @brief Send the CS Subevent Result Continue event to host. + * @param [in] evnt_pckt_p : pointer to the host buffer. + * @param [in] data_length : length of data expected to be found in the buffer. + * @retval None + */ + void (*ll_intf_cs_subevent_result_continue_evnt)(cs_host_buffer* evnt_pckt_p, uint8_t data_length); + +/** + * @brief Send the cs test end complete event to host as a + * response for cs_test_end command. + * + * @param status : [in] return status of the event + * + * @retval None + */ + void (*ll_intf_cs_test_end_cmplt_evnt)(uint8_t status); + +#endif /* (SUPPORT_CHANNEL_SOUNDING && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) */ + + +#if SUPPORT_EXT_FEATURE_SET + /** + * @brief used to indicate the completion of the process of the local Controller obtaining the used features of the remote device. + * + * @param status : [in] indicate whether the LE Read Remote Used Features command has successfully completed. + * @param conn_handle_id : [in] connection handle of the connection for which the LE Read Remote Used Features command is applied. + * @param le_features : [in] Bit Mask List of used LE features. + */ + void (*ll_intf_le_read_all_remote_features_cmplt_evnt)( + const ble_stat_t status, const uint16_t conn_handle_id, + const uint8_t max_remote_page, const uint8_t max_valid_page, + const uint8_t page_0_features[LE_FEATURES_BYTES_NO], + uint8_t ext_pages_features[MAX_ALLOWED_EXT_FEATURE_SET_PAGES] [EXT_FEATURE_SET_BYTES_NO]); +#endif /* SUPPORT_EXT_FEATURE_SET */ + +#if SUPPORT_LE_ADVERTISERS_MONITORING + void (*ll_intf_le_mntrd_adv_report_evnt)(const ble_intf_mntrd_adv_report_evnt_st* const report_params); +#endif /* SUPPORT_LE_ADVERTISERS_MONITORING */ }; @@ -1613,6 +2126,9 @@ typedef struct _ble_intf_cig_host_param{ 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 */ +#if SUPPORT_ISO_UNSEG_MODE + uint8_t seg_mode; /* Segmented or Unsegmented Framed Mode */ +#endif /* SUPPORT_ISO_UNSEG_MODE */ 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 */ @@ -1657,7 +2173,7 @@ typedef struct _ble_intf_cis_host_param_test{ * @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; @@ -1816,6 +2332,9 @@ typedef union _hci_cmds_params_un le_set_conn_tx_pwr_lvl_cmd_st le_set_conn_tx_pwr_lvl_cmd; #endif /* SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION */ +#if SUPPORT_FRAME_SPACE_UPDATE + le_frame_space_updt_cmd_st le_frame_space_updt_cmd; +#endif /* SUPPORT_FRAME_SPACE_UPDATE */ } hci_cmds_params_un; @@ -1951,7 +2470,20 @@ ble_stat_t ll_intf_read_local_supported_cmds(uint8_t supported_cmds[64]); * * @retval ble_stat_t : Command status to be sent to the Host. */ -ble_stat_t ll_intf_read_local_supported_features_page_0(uint8_t lmp_features[8]); +ble_stat_t ll_intf_read_local_supported_features(uint8_t lmp_features[8]); + +#if SUPPORT_EXT_FEATURE_SET +/** + * @brief Set the return parameters of the "Read Local Extended Features" HCI command in the event packet that to be sent to the Host. + * + * @param page_number : [in/out] Requested Page Number/Returned Page Number. + * @param lmp_features : [out] LMP Features to be reported + * @param max_page_number : [out] Max Supported Pages for LMP Features + * + * @retval None. + */ +ble_stat_t ll_intf_read_local_extended_features(uint8_t* page_number, uint8_t lmp_features[8], uint8_t* max_page_number); +#endif /* SUPPORT_EXT_FEATURE_SET */ /** * @brief Read the list of the supported LE features for the Controller . @@ -3665,7 +4197,7 @@ uint8_t ll_intf_select_tx_power_table(uint8_t tx_power_table_id); * @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) + * @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); @@ -4335,7 +4867,7 @@ void ll_intf_set_temperature_sensor_state(void); 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 + * @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. */ @@ -4343,7 +4875,7 @@ 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 + * @param[out] rssi : rssi value * @retval ble_stat_t : Command status. */ ble_stat_t ll_intf_read_raw_rssi(int32_t* rssi); @@ -4367,9 +4899,9 @@ 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 + * 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 @@ -4385,7 +4917,7 @@ ble_stat_t ll_intf_set_tx_free_carrier(uint8_t enable, uint8_t channel_idx); * (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); @@ -4408,11 +4940,11 @@ ble_stat_t ll_intf_get_link_status(uint8_t *sm_status, uint8_t *link_conn_handle * 0 : disable * 1 : enable * min_spacing :min spacing value (min time between - * 2 consecutive LL_CHANNEL_STATUS + * 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 + * channel classification change and * LL_CHANNEL_STATUS sending "unit of 200 ms") * 5 (1 sec) <= max_delay <= 150 (30 sec) * @retval status. @@ -4530,10 +5062,254 @@ ble_stat_t ll_intf_le_set_prdc_adv_subevnt_data( * @{ */ +#if SUPPORT_FRAME_SPACE_UPDATE +/* + * @brief used to set the inter frame space(TIFS) value on a specific connection + * + * @param[in] frame_Space_update_cmd_param structure hold the host parameters + * @return ble_stat_t + */ +ble_stat_t ll_intf_le_frame_space_update(le_frame_space_updt_cmd_st* frame_Space_update_cmd_param); +#endif /* SUPPORT_FRAME_SPACE_UPDATE */ + + + +/* BLE 6.0 Channel Sounding link layer */ +#if (SUPPORT_CHANNEL_SOUNDING && \ +(SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) + +/** + * @brief Used to get the local supported cpabilities by controller + * + * @param capabilities : [out] pointer to struct that will hold the capabalities + * read from controller + * + * @retval ble_stat_t + */ +ble_stat_t ll_intf_cs_read_local_supported_capabilities(ble_cs_capabilities_cmd_st *capabilities); + +/** + * @brief Used to get the remote supported cpabilities, in case a cached copy exist (if exchanged before with + * the peer device or set by the host through cs_write_cached_remote_supported_capabilites command) then use + * the cached copy, else initiate cs capabilities exchange procedure. + * + * @param conn_handle_id: [IN] connection identifier + * + * @retval ble_stat_t + */ +ble_stat_t ll_intf_cs_read_remote_supported_capabilities(uint16_t conn_handle_id); + +/** + * @brief Used to write a cached copy of the remote device supported cpabilities provided by the host. + * + * @param conn_handle_id: [IN] connection identifier + * @param remote_capabilities: [IN] pointer to remote supported capabilities + * provided by the host + * + * @retval ble_stat_t + */ +ble_stat_t ll_intf_cs_write_cached_remote_supported_capabilities( + uint16_t conn_handle_id, + ble_cs_capabilities_cmd_st *remote_capabilities); +/** + * @brief Used to set start or restart cs security start procedure. + * + * @param conn_handle_id: [IN] connection identifier + * + * @retval ble_stat_t + */ +ble_stat_t ll_intf_cs_security_enable(uint16_t conn_handle_id); +/** + * @brief Used to Set the default Settings to be used for the local device. + * + * @param conn_handle_id: [IN] connection identifier + * @param role_enable: [IN] roles enabled by the local device + * 0b00: both devices are disabled by default + * 0b01: initiator is enabled by default + * 0b10: reflector is enabled by default + * 0b11: both devices are enabled by default + * @param CS_SYNC_ant_slct: [IN] default antenna identifier to be + * used by default (range: 1 to 4) + * @param max_tx_pwr: [IN] max power to be used in cs transmissions + * + * @retval ble_stat_t + */ +ble_stat_t ll_intf_cs_set_default_settings(uint16_t conn_handle_id, + uint8_t role_enable, + uint8_t CS_SYNC_ant_slct, + int8_t max_tx_pwr); +/** + * @brief Used to read per channel Frequency Actuation Error relative to mode-0 of the remote device. + * + * @param conn_handle_id: [IN] connection identifier. + * + * @retval ble_stat_t + */ +ble_stat_t ll_intf_cs_read_remote_fae_table(uint16_t conn_handle_id); + +/** + * @brief Used to write a cached copy of the per channel Frequency Actuation Error + * relative to mode-0 of the remote device provided by the host. + * + * @param conn_handle_id: [IN] connection identifier. + * @param remote_fae_table: [IN] pointer to array holding the + * remote FAE values to be stored on the connection context. + * + * @retval ble_stat_t + */ +ble_stat_t ll_intf_cs_write_cached_remote_fae_table(uint16_t conn_handle_id, int8_t *remote_fae_table); +/** + * @brief Used to create and update configuration identified by config_id. + * + * @param conn_handle_id: [IN] connection identifier. + * @param config_id: [IN] configuration identifier. + * @param config_params: [IN] pointer to struct that will hold the + * configuration parameters. + * + * @retval ble_stat_t + */ +ble_stat_t ll_intf_cs_create_config(uint16_t conn_handle_id, uint8_t config_id, ble_cs_config_cmd_st *config_params); + +/** + * @brief Used to remove cs configuration identified by config_id. + * + * @param conn_handle_id: [IN] connection identifier. + * @param config_id: [IN] configuration identifier. + * + * @retval ble_stat_t + */ +ble_stat_t ll_intf_cs_remove_config(uint16_t conn_handle_id, uint8_t config_id); + +/** + * @brief Used to set the cs channel classification to be used + * to figure out the channel map to be used on subseqent + * CS procedures. + * + * @param channel_classification: [IN] pointer to array holding + * the channel classification. + * + * @retval ble_stat_t + */ +ble_stat_t ll_intf_cs_set_channel_classification(uint8_t *channel_classification); + +/** + * @brief Used to set the CS procedure parameters. + * @param conn_handle_id: [IN] connection identifier. + * @param cs_prcdr_params: [IN] pointer to struct that holds + * the cs procedure parameters + * + * @retval ble_stat_t + */ +ble_stat_t ll_intf_cs_set_procedure_parameters(uint16_t conn_handle_id, ble_cs_prcdr_params_cmd_st *cs_prcdr_params); + +/** + * @brief enable and disable CS Procedure. + * + * @param conn_handle_id: [IN] connection handle identifier. + * @param config_id: [IN] configuration identifier. + * @param enable: [IN] procedure state (0x00: disable - 0x01: enable). + * + * @retval ble_stat_t + */ +ble_stat_t ll_intf_cs_procedure_enable(uint16_t conn_handle_id, uint8_t config_id, uint8_t enable); + +/** + * @brief Start CS Test procedure given the passed parameters. + * + * @param cs_test_params_p: [IN] pointer to struct the holds CS test parameters. + * + * @retval ble_stat_t + */ +ble_stat_t ll_intf_cs_test(ble_cs_test_cmd_st *cs_test_params_p); + +/** + * @brief End CS Test procedure. + * + * @param None + * + * @retval ble_stat_t + */ +ble_stat_t ll_intf_cs_test_end(void); + +#endif /* (SUPPORT_CHANNEL_SOUNDING && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION)) */ + + +#if SUPPORT_EXT_FEATURE_SET +/** + * @brief Read All pages of the supported LE features for the Controller . + * + * @param all_features : [out] Bit Mask List of supported LE Page 0 to 10 features. + * @param max_page : [out] max pages supported by the controller. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_le_read_all_local_supported_features( + uint8_t* all_features, uint8_t* max_page); + +/** + * @brief Read all features [Pages 0 to 10] 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_all_remote_features(uint16_t conn_handle_id); + +#endif /* SUPPORT_EXT_FEATURE_SET */ + + +#if SUPPORT_LE_ADVERTISERS_MONITORING +/** + * @brief Enables and disables the Advertisers Monitoring Feature. + * + * @param[in] enable Enable/Disable . + * + * @retval SUCCESS always. + */ +ble_stat_t ll_intf_le_enable_mntrd_adv(uint8_t enable); + +/** + * @brief Adds an advertiser to the advertisers monitored list. + * + * @param[in] mntrd_adv_info Advertisers Info. + * + * @retval COMMAND_DISALLOWED if legacy command is issued before this command. + * INVALID_HCI_COMMAND_PARAMETERS if RSSI high is lower than RSSI low. + * MEMORY_CAPACITY_EXCEEDED if all the monitored list is occupied. + * SUCCESS Otherwise. + */ +ble_stat_t ll_intf_le_add_device_to_mntrd_adv_list(ble_mntrd_add_adv_device_st * mntrd_adv_info); + +/** + * @brief Removes an advertiser from the advertisers monitored list. + * + * @param[in] addr Advertiser Address. + * @param[in] addr_type Advertiser Address Type (Public or Random). + * + * @retval INVALID_HCI_COMMAND_PARAMETERS if the device is not found in the monitored list. + * SUCCESS otherwise. + */ +ble_stat_t ll_intf_le_rmv_device_from_mntrd_adv_list(uint8_t* addr, ble_mntrd_adv_device_type_e addr_type); + +/** + * @brief Clears all the advertisers from the advertisers monitored list. + * + * @retval None + */ +ble_stat_t ll_intf_le_clr_mntrd_adv_list(void); + +/** + * @brief Reads the advertisers monitored list size. + * + * @retval Advertisers monitored list size. + */ +uint8_t ll_intf_le_read_mntrd_adv_list(void); + +#endif /** * @} @@ -4627,7 +5403,7 @@ void ll_intf_set_custom_event_mask(uint8_t cstm_evnt_mask); * 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 + * @param cbk : [in] pointer to the callback function to be registered * * @retval None */ @@ -4641,7 +5417,7 @@ void ll_intf_rgstr_missed_cig_evnts_cbk(hst_cig_missed_evnt_cbk cbk); * 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 + * @param cbk : [in] pointer to the callback function to be registered * * @retval None */ @@ -4656,21 +5432,21 @@ void ll_intf_rgstr_missed_big_evnts_cbk(hst_big_missed_evnt_cbk cbk); #if (SUPPORT_AOA_AOD) /** - * @brief Set the number of antennas to be used by the controller, number of + * @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); @@ -4682,7 +5458,7 @@ ble_stat_t ll_intf_get_num_of_antennas(uint8_t *ptr_num_of_antennas); * * @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 + * @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. * @@ -4722,6 +5498,27 @@ ble_stat_t ll_intf_ctrl_rx_dtp(uint8_t rx_pckt_count, uint8_t rx_pckt_len); #endif /* SUPPORT_RX_DTP_CONTROL */ +#if SUPPORT_CONFIGURABLE_GAIN_FIX +/** + * @brief initialize rssi gain fix region and select resistor measured + * percentage that affects pre-emphasis sequence. + * + * @param region_0x1f_val: absolute gain fix for region 0x1F in dbm. + * @param region_0x0f_val: absolute gain fix for region 0x0F in dbm. + * @param region_0x0b_val: absolute gain fix for region 0x0B in dbm. + * @param region_0x09_val: absolute gain fix for region 0x09 in dbm. + * @param r_msur_percent: percentage of the measured resistor value that will be used + * to select the update values in pre-emphasis sequence (range: 0 to 99). + * + * @retval None. + */ +void ll_intf_gain_fix_init( + uint8_t region_0x1f_val, uint8_t region_0x0f_val, + uint8_t region_0x0b_val, uint8_t region_0x09_val, + uint8_t r_msur_percent); + +#endif /* SUPPORT_CONFIGURABLE_GAIN_FIX */ + /**@} */ diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/ll_intf_cmn.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/ll_intf_cmn.h index 718ea5d90..0155d22a9 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/ll_intf_cmn.h +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/ll_intf_cmn.h @@ -1,42 +1,48 @@ -/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.32a-lca02/firmware/public_inc/ll_intf_cmn.h#1 $*/ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/2.00a-lca01/firmware/public_inc/ll_intf_cmn.h#1 $*/ /** ******************************************************************************** * @file ll_intf_cmn.h * @brief This file includes declaration of common interfaces of MAC only and BLE/COEXISTENCE APIs. ****************************************************************************** - * @copy + * @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 and - * associated documentation files (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. - * + * 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. + * 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_CMN_H_ #define INCLUDE_LL_INTF_CMN_H_ - #include "common_types.h" - - /*========================================================================================================*/ /*================================ Configure LL Context Control Command =================================*/ /*========================================================================================================*/ - +/** @ingroup ll_common_interface_functions + * @{ + */ /** * @brief Used to configure the LL contexts, where: * 1. For bare-metal: @@ -56,12 +62,9 @@ * @retval ble_state_t : Command status */ ble_stat_t ll_intf_cmn_config_ll_ctx_params(uint8_t allow_low_isr, uint8_t run_post_evnt_frm_isr); - - /*========================================================================================================*/ /*================================== LE Select Sleep Clock Source =======================================*/ /*========================================================================================================*/ - #if (USE_NON_ACCURATE_32K_SLEEP_CLK) /** * @brief Used to select the source that drives the sleep clock, whether to use an external crystal oscillator or an integrated RC oscillator (RCO). @@ -72,11 +75,9 @@ ble_stat_t ll_intf_cmn_config_ll_ctx_params(uint8_t allow_low_isr, uint8_t run_p * @retval ble_stat_t : Command status to be sent to the Host. */ ble_stat_t ll_intf_cmn_le_select_slp_clk_src(uint8_t slp_clk_src, uint16_t *ptr_slp_clk_freq_value); - /*========================================================================================================*/ /*=============================== LE Set RCO Calibration Event Parameters ===============================*/ /*========================================================================================================*/ - /** * @brief Used to configure the runtime RCO calibration event parameters. * @@ -85,15 +86,11 @@ ble_stat_t ll_intf_cmn_le_select_slp_clk_src(uint8_t slp_clk_src, uint16_t *ptr_ * * @retval None. */ - ble_stat_t ll_intf_cmn_le_set_rco_clbr_evnt_params(uint8_t rco_clbr_event_duration, uint32_t rco_clbr_event_interval); - #endif - /*========================================================================================================*/ /*====================================== LE Select TX_Power Table =======================================*/ /*========================================================================================================*/ - /** * @brief Used to specify the used power table and its size based on the selected TX_Power table ID. * @@ -102,25 +99,20 @@ ble_stat_t ll_intf_cmn_le_set_rco_clbr_evnt_params(uint8_t rco_clbr_event_durati * @retval Status : 0: SUCCESS. Otherwise: Error code. */ uint8_t ll_intf_cmn_select_tx_power_table(uint8_t tx_power_table_id); - - /** * @brief flag to the LL the existence of a temperature sensor * @retval None */ void ll_intf_cmn_set_temperature_sensor_state(void); - /** * @brief set the current temperature * @param temperature : The current temperature * @retval None */ uint32_t ll_intf_cmn_set_temperature_value(uint32_t temperature); - /*========================================================================================================*/ /*==================================== Random Number Generation Group ===================================*/ /*========================================================================================================*/ - /** * @brief Request new random number. * @@ -129,9 +121,7 @@ uint32_t ll_intf_cmn_set_temperature_value(uint32_t temperature); * * @retval Status. */ - uint32_t ll_intf_cmn_gen_rnd_num(uint8_t *ptr_rnd, uint32_t len); - /** * * @brief A common wrapper for BLE-ECB and MAC-CCM security modes @@ -155,7 +145,35 @@ uint32_t ll_intf_cmn_crypto(uint8_t *ptr_pckt, const uint8_t *ptr_key, uint8_t *ptr_nonce, uint32_t mic_len, uint32_t ad_len, uint32_t md_len, crypto_endian_enum_t key_endian, crypto_endian_enum_t data_endian, security_mode_enum_t security_mode); - +/*=============== LL Common Interface LE Set Deep Sleep Mode ===============*/ +/** + * @brief Switches the controller to and from Deep Sleep mode. + * @param [in] dp_slp_mode: Input according to dpslp_state_e. + * DEEP_SLEEP_ENABLE -> Activate Deep Sleep. + * DEEP_SLEEP_DISABLE -> Deactivate Deep Sleep. + * @retval Status. + */ ble_stat_t ll_intf_cmn_le_set_dp_slp_mode(uint8_t dp_slp_mode); +#if SUPPORT_CONFIGURABLE_GAIN_FIX +/** + * @brief initialize rssi gain fix region and select resistor measured + * percentage that affects pre-emphasis sequence. + * + * @param region_0x1f_val: absolute gain fix for region 0x1F in dbm. + * @param region_0x0f_val: absolute gain fix for region 0x0F in dbm. + * @param region_0x0b_val: absolute gain fix for region 0x0B in dbm. + * @param region_0x09_val: absolute gain fix for region 0x09 in dbm. + * @param r_msur_percent: percentage of the measured resistor value that will be used + * to select the update values in pre-emphasis sequence (range: 0 to 99). + * + * @retval None. + */ +void ll_intf_cmn_gain_fix_init( + uint8_t region_0x1f_val, uint8_t region_0x0f_val, + uint8_t region_0x0b_val, uint8_t region_0x09_val, + uint8_t r_msur_percent); +#endif /* SUPPORT_CONFIGURABLE_GAIN_FIX */ +/** @} +*/ #endif /* INCLUDE_LL_INTF_CMN_H_ */ diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/mem_intf.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/mem_intf.h index 5284311e6..fc4f11035 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/mem_intf.h +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/mem_intf.h @@ -1,29 +1,37 @@ -/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.32a-lca02/firmware/public_inc/mem_intf.h#1 $*/ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/2.00a-lca01/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 and - * associated documentation files (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. - * + * 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. + * 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. * * */ @@ -108,3 +116,4 @@ void ble_memcpy_n_bytes(uint8_t *destination, * @} */ #endif /* MEM_INTF_H */ + diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/os_wrapper.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/os_wrapper.h index f0b241a18..98bed2349 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/os_wrapper.h +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/os_wrapper.h @@ -1,29 +1,37 @@ -/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.32a-lca02/firmware/public_inc/os_wrapper.h#1 $*/ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/2.00a-lca01/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 and - * associated documentation files (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. - * + * 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. + * 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. * * */ @@ -69,9 +77,9 @@ typedef enum int_state { * @brief Priority used for thread control. */ typedef enum { - os_priority_high, - os_priority_normal, - os_priority_low, + os_priority_high, + os_priority_normal, + os_priority_low, } os_priority; /** @@ -391,7 +399,7 @@ os_mutex_id os_rcrsv_mutex_create(void); * @param mutex_id mutex id. * @param millisec time-out value, 0 for no time-out. * - * @retval status code , 0 for success + * @retval status code , 0 for success */ int32_t os_rcrsv_mutex_wait( os_mutex_id mutex_id, @@ -495,3 +503,5 @@ void* os_shrd_mem_alloc( uint8_t os_wrapper_is_rtos_used(void); #endif /* INCLUDE_CONN_MNGR_H_ */ + + diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/platform.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/platform.h new file mode 100644 index 000000000..6d8064cdc --- /dev/null +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/platform.h @@ -0,0 +1,564 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/2.00a-lca01/firmware/public_inc/platform.h#1 $*/ +/** + ******************************************************************************** + * @file platform.h + * @brief this file include all helper functions in radio.c which is not described in Openthread + * + * + ****************************************************************************** + * @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_PLATFORM_H_ +#define INCLUDE_PLATFORM_H_ + +#include "radio.h" +#include "common_types.h" + +/*==================================== MACROS =======================================*/ +/* + * The following macros are used for testing purpose only + */ +#define RADIO_TEST 0 +#define ACK_FRAME_TYPE 0x2 +#define MAC_ACK_WAIT 864 +#define ACK_LNGTH 5 +/******************************************************************************************//** + * Enums + *********************************************************************************************/ +/** + * @enum radio_state_enum_t + * @brief the states of the Radio event it is used for coexistence + * + */ +typedef enum _radio_evnt_type_enum +{ + TX_PCKT_STATE, ///< Sending packet (not ACK) + TX_ACK_STATE, ///< Sending ACK + RX_PCKT_STATE, ///< Receiving packet (not ACK) + RX_ACK_STATE, ///< Receiving Ack + RADIO_ED, ///< Energy detection + RADIO_SLEEP_STATE, ///< Sleep state + RADIO_DISABLED_STATE,///< Disable state +#if(SUPPORT_COEXISTENCE) + TX_AT_STATE , ///< Tx at specific time + RX_AT_STATE , ///< Rx at specific time +#endif /* SUPPORT_COEXISTENCE */ + +}radio_event_enum_t; +/******************************************************************************************//** + * Structures + *********************************************************************************************/ +/** @ingroup systm_layer +* @{ +*/ +/** + * @struct mac_cbk_dispatch_tbl + * + * @brief structure of all callback functions used to notify mac layer after specific event compeletion + */ +struct mac_cbk_dispatch_tbl{ + /** + * @brief callback function called after the end of Energy detection operation + * + * @param aInstance: radio instance + * @param aEnergyScanMaxRssi: the result for ED operation which is RSSI value + * + * @retval none + * + * @note This function is called after handling SM_DONE event in ral through a sequence of calls + * ral_sm_done() -> ral_ed_scan_done() -> callback + */ + void (*mac_ed_scan_done)(otInstance *aInstance, int8_t aEnergyScanMaxRssi); + /** + * @brief callback function called after the end of transmission operation + * + * @param aInstance: radio instance + * @param aFrame: pointer to the transmitted frame + * @param aAckFrame: pointer to the received ack frame (in case of AR bit is detected in aFrame) + * @param aError: Error code if happens in Transmission + * + * @retval none + * @note This function is called after handling SM_DONE event in ral through a sequence of calls + * ral_sm_done() -> ral_tx_done() -> callback + */ + void (*mac_tx_done)(otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError); + /** + * @brief callback function called after the end of Reception operation + * + * @param aInstance: radio instance + * @param aFrame: pointer to the received frame + * @param aError: Error code if happens in transmission + * + * @retval none + * @note This function is called after handling SM_DONE event in ral through a sequence of calls + * ral_sm_done() -> ral_rx_done() -> callback + */ + void (*mac_rx_done)(otInstance *aInstance, otRadioFrame *aFrame, otError aError); + /** + * @brief callback function called after successful start of transmission in ral + * + * @param aInstance: radio instance + * @param aFrame: pointer to the transmitted frame + * @param aError: Error code if happens in transmission + * + * @retval none + * @note This function is called after calling proc_radio_tx which is called with calling of otplatRadioTransmit + * in case of no error returned. These errors may be (CCA channel access failure, ral busy due to ongoing transmission ...etc ) + */ + void (*mac_tx_strtd)(otInstance *aInstance, otRadioFrame *aFrame); + + void (*mac_frm_updtd)(otInstance *aInstance, otRadioFrame *aFrame); + +}; +/** + * @} + * + */ +/******************************************************************************************//** + * APIs + *********************************************************************************************/ +/** @ingroup systm_layer_cmn_proc +* @{ +*/ +/** + * @brief this function is used to initialize radio layer including registeration for ral callbacks, + * some filter configurations, some automatic configurations like auto_sleep and auto_ack...etc + * + * @retval none + */ +void radio_init(void); +/** + * @brief This function called from upper layer init function (mac_init in case of mac integration e.g. Zigbee stack) + * to register the upper layer callback functions + * + * @param ptr_cbk_dispatch_tbl: pointer to callback function to be registered + * + * @retval none + * + */ +void radio_call_back_funcs_init(struct mac_cbk_dispatch_tbl * ptr_cbk_dispatch_tbl); +/** + * @} + * + */ + +void otDispatch_tbl_init(otInstance *sInstance); +/** + * @} + * + */ + +/** @ingroup systm_layer_enc +* @{ +*/ +/** + * @brief This function is used to encrypt frame pointed to by ptr_pckt + * + * @param ptr_pckt: pointer to the frame to be encrypted + * @param ptr_session_key: pointer to used session key + * @param ptr_ccm_nonce: pointer to the nonce + * @param mic_len: mic length + * @param ad_len: a data length + * @param md_len: m data length + * + * @retval status of the encryption process + * + */ +uint32_t radio_encrypt_pckts( uint8_t *ptr_pckt, + const uint8_t *ptr_session_key, + uint8_t *ptr_ccm_nonce, + uint32_t mic_len, + uint32_t ad_len, + uint32_t md_len); +/** + * @} + * + */ +/** @ingroup systm_layer_cmn_config +* @{ +*/ +/** + * @brief This function is used to configure automatic ack response by ral layer + * including AIFS, ack frame timeout.. etc + * + * @param auto_ack_state: Enabled or disabled + * + * @retval otError status of configuration + * + */ +otError radio_set_auto_Ack_state(uint8_t auto_ack_state); +/** + * @} + * + */ +/** @ingroup systm_layer_cmn_proc +* @{ +*/ +/** + * @fn uint32_t radio_reset() + * @brief This API is used to reset radio layer operation which in turns stop all running operations + */ +uint32_t radio_reset(void); +/** + * @} + * + */ +/** + * @fn proc_radio_rcv(uint8_t aChannel, uint32_t duration) + * @brief This API is used to control ral setup for reception. + * @param aChannel: channel to receive on + * @param duration: reception duration in microsecond , 0 means receive forever + */ +otError proc_radio_rcv(uint8_t aChannel ,uint32_t duration); +/** + * @fn otError proc_radio_tx(otRadioFrame *aFrame, ble_time_t* strt_time) + * @brief This API is used to control ral setup for transmission based on CCA procedure. + * @param aFrame: pointer to the Tx frame + * @param strt_time: pointer to Tx request time + */ +otError proc_radio_tx(otRadioFrame *aFrame , ble_time_t* strt_time); +/** + * @fn otError proc_radio_ed(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration) + * @brief This API is used to control ral setup for energy scan. + */ +otError proc_radio_ed(uint8_t aScanChannel, uint16_t aScanDuration); +/** @ingroup systm_layer_cmn_config +* @{ +*/ +/** + * @fn void setPANcoordinator (uint8_t aEnable) + * @brief This API is used to set Pan coordinator role in HW to be used while applying MAC 802.15.4 filter policies. + */ +void setPANcoordinator(uint8_t aEnable); +/** + * @fn void setContRecp (uint8_t aEnable) + * @brief This API is used to notify ral layer of rx on when idle state. + */ +void setContRecp(uint8_t aEnable); +/** + * @fn void enableScanFilters(otInstance *aInstance) + * @brief This API is used to disable filter policy while performing scan. + */ +void enableScanFilters(otInstance *aInstance); +/** + * @fn void disableScanFilters(otInstance *aInstance) + * @brief This API is used to restore filter policy after the scan is complete. + */ +void disableScanFilters(otInstance *aInstance); + +/** + * @} + * + */ +/** @ingroup systm_layer_cmn_proc +* @{ +*/ +/** + * @brief get the latest LQI value + * @retval uint8_t. LQI value + */ +uint8_t radio_GetLQIValue(void); +/** + * @} + * + */ +#if RADIO_CSMA +/** @ingroup systm_layer_cmn_config +* @{ +*/ +/** + * @fn void set_min_csma_be(uint8_t value) + * @brief This API is used to set min csma backoff exponent + * @param value: value for minimum csma backoff exponent + * + * @retval none + */ +void set_min_csma_be(uint8_t value); +/** + * @fn void set_max_csma_be(uint8_t value) + * @brief This API is used to set max csma backoff exponent + * @param value: value for maximum csma backoff exponent + * + * @retval none + */ +void set_max_csma_be(uint8_t value); +/** + * @fn void set_max_csma_backoff(uint8_t value) + * @brief This API is used to set max csma backoff counter + * @param value: value for maximum csma backoff counter + * + * @retval none + */ +void set_max_csma_backoff(uint8_t value); +/** + * @fn void set_max_full_csma_frm_retries(uint8_t value) + * @brief This API is used to set custom max full csma frame retries + * @param value: value for maximum full csma retrials + * + * @retval none + */ +void set_max_full_csma_frm_retries(uint8_t value); +#endif /*end of RADIO_CSMA*/ +/** + * @fn void set_max_frm_retries(uint8_t value) + * @brief This API is used to set max frame retries + * @param value: value for maximum frame retries + * + * @retval none + */ +void set_max_frm_retries(uint8_t value); +/** + * @} + * + */ +/** @ingroup systm_layer_cmn_proc +* @{ +*/ +/** + * @fn uint32_t mac_gen_rnd_num(uint8_t *ptr_rnd, uint8_t len, uint8_t check_cont_rx) + * @brief This API is used to generate random number + * + * @param ptr_rnd : Pointer to the output random bytes . + * @param len : Number of required random bytes. + * @param check_cont_rx : this flag is set to check continuous reception . + */ +uint32_t mac_gen_rnd_num(uint8_t *ptr_rnd, uint16_t len, uint8_t check_cont_rx); +/** + * @} + * + */ +/** @ingroup systm_layer_enc +* @{ +*/ +/** + * @brief This function is used to decrypt frame pointed to by ptr_pckt + * + * @param ptr_pckt: pointer to the frame to be encrypted + * @param ptr_session_key: pointer to used session key + * @param ptr_ccm_nonce: pointer to the nonce + * @param mic_len: mic length + * @param ad_len: a data length + * @param md_len: m data length + * + * @retval status of the decryption process + * + */ +uint32_t radio_decrypt_pckts( uint8_t *ptr_pckt, + uint8_t *ptr_session_key, + uint8_t *ptr_ccm_nonce, + uint32_t mic_len, + uint32_t ad_len, + uint32_t md_len); +/** + * @} + * + */ +/** + * @fn void radio_mac_rx_done( otRadioFrame *aFrame, otError aError) + * @brief This API is used to call mac Radio rx done callback after end of reception. + * @param aFrame: pointer to the received frame + * @param aError: reception error + */ +void radio_mac_rx_done(otRadioFrame *aFrame, otError aError); + +#if (SUPPORT_ENH_ACK_LINK_METRICS_PROBING_OT_1_2) +/** + * This method set the Link Metrics noise floor value needed to calculate the link margine + * + * @param[in] noise_floor The noise floor used by Link Metrics. It should be set to the platform's + * noise floor (measured noise floor, receiver sensitivity or a constant). + * + */ +void radio_link_metrics_set_noise_floor(int8_t noise_floor); +#endif +#if(SUPPORT_OPENTHREAD_1_2 && CONFIG_MAC_CSL_TRANSMITTER_ENABLE) +/** + * @fn void radio_mac_tx_done_error( otRadioFrame *aFrame, otError aError) + * @brief This API is used to call mac Radio tx done + * @param tx_frame: pointer to the Tx frame + * @param aError: Tx error + */ +void radio_mac_tx_done_error(otRadioFrame * tx_frame,otError aError); +#endif /*(SUPPORT_OPENTHREAD_1_2 && CONFIG_MAC_CSL_TRANSMITTER_ENABLE)*/ +#if !SUPPORT_COEXISTENCE +/*##### Random Number Generation Group #####*/ +/** @ingroup rnd_gen_functions + * @{ + */ + /** + * @brief Request new random number. + * + * @param ptr_rnd : Pointer to the output random bytes . + * @param len : Number of required random bytes. + * + * @retval Status. + */ + uint32_t platform_gen_rnd_num( + uint8_t *ptr_rnd, + uint32_t len); +/** @} +*/ +/** + * + * @brief A common wrapper for BLE-ECB and MAC-CCM security modes + * + * @param ptr_pckt : Pointer to the data buffer (variable length + * in case of CCM mode, 16 bytes in case of ECB mode). The resulting + * Encrypted/Decrypted data overwrites this buffer. + * @param ptr_key[in] : Pointer to the security key buffer (16 bytes). + * @param ptr_nonce[in] : Pointer to the security nonce buffer (13 bytes + * in case of CCM mode, a Null pointer in case of ECB mode). + * @param mic_len[in] : Length of MIC, supported values are 0, 4, 6, + * 8, 10, 12, 14, and 16 in case of CCM, 0 only in case of ECB. + * @param ad_len[in] : Length of Data to be authenticated. + * @param md_len[in] : Length of Data to be encrypted. + * @param key_endian[in] : Represents the format of the security key. + * @param data_endian[in] : Represents the endian format of the data. + * @param security_mode[in]: Hardware security mode. + * @retval Status + */ +uint32_t platform_crypto(uint8_t *ptr_pckt, const uint8_t *ptr_key, + uint8_t *ptr_nonce, uint32_t mic_len, uint32_t ad_len, uint32_t md_len, + crypto_endian_enum_t key_endian, crypto_endian_enum_t data_endian, + security_mode_enum_t security_mode); + +/** + * + * @brief radio function that will be called to run periodic calibration if tempature has changed + * + * @retval Nonr + */ +void radio_run_phy_clbr_on_temp_change(void); +#endif /*!SUPPORT_COEXISTENCE*/ + +#if (!SUPPORT_COEXISTENCE) +/** + * + * @brief enable or disable LinkLayer Deep sleep mode + * + * @param dp_slp_mode : @ref DEEP_SLEEP_ENABLE enable deep sleep mode ,@ref DEEP_SLEEP_DISABLE go back to sleep mode + * + * @retval Status . + */ +otError radio_set_dp_slp_mode(dpslp_state_e dp_slp_mode); +#endif /*end of (!SUPPORT_COEXISTENCE)*/ +#if SUPPORT_MAC_PHY_CONT_TESTING_CMDS +/** + * + * @brief set the phy continuous modulation and continuous wave modes upon enable + * + * @param type[in] : the type of the modulation (0: modulation, 1: wave) + * @param enable_mode[in] : if true then enable the selected mode otherwise disable it + * @param chnl_num[in] : channel number to be used in modulation (range: 0 to 15) + * @param pwr[in] : The used power in dBm. + * @retval Status + */ +otError platform_zigbee_set_phy_cont_modul_mode(uint8_t type, uint8_t enable_mode, uint8_t chnl_num, int8_t pwr); +#endif /*end of SUPPORT_MAC_PHY_CONT_TESTING_CMDS */ +#if SUPPORT_ANT_DIV +/** + * + * @brief set antenna diversity parameters + * + * @param aInstance[in] : radio instance + * @param ptr_ant_div_params[in] : pointer to antenna diversity params structure + * @retval Status + */ +otError radio_set_ant_div_params(otInstance *aInstance, antenna_diversity_st* ptr_ant_div_params); + +/** + * + * @brief get antenna diversity parameters + * + * @param aInstance[in] : radio instance + * @param ptr_ant_div_params[out] : pointer to antenna diversity params structure + * @retval None + */ +void radio_get_ant_div_params(otInstance *aInstance, antenna_diversity_st* ptr_ant_div_params); + +/** + * + * @brief enable/disable antenna diversity + * + * @param aInstance[in] : radio instance + * @param enable[in] : enable:1 / disable:0 + * @retval Status + */ +otError radio_set_ant_div_enable(otInstance *aInstance, uint8_t enable); + +/** + * + * @brief set the default antenna id to be used for transmission and reception + * + * @param aInstance[in] : radio instance + * @param default_ant_id[in] : default antenna id + * @retval Status + */ +otError radio_set_default_ant_id(otInstance *aInstance, uint8_t default_ant_id); + +/** + * + * @brief set antenna diversity rssi threshold + * + * @param aInstance[in] : radio instance + * @param rssi_threshold[in] : rssi threshold to compare with during antenna diversity measurements + * @retval Status + */ +otError radio_set_ant_div_rssi_threshold(otInstance *aInstance, int8_t rssi_threshold); +#endif /* SUPPORT_ANT_DIV */ + +#if SUPPORT_CONFIGURABLE_GAIN_FIX +/** + * @brief initialize rssi gain fix region and select resistor measured percentage that affects pre-emphasis sequence. + * + * @param[in] region_0x1f_val: absolute gain fix for region 0x1F in dbm. + * @param[in] region_0x0f_val: absolute gain fix for region 0x0F in dbm. + * @param[in] region_0x0b_val: absolute gain fix for region 0x0B in dbm. + * @param[in] region_0x09_val: absolute gain fix for region 0x09 in dbm. + * @param[in] r_msur_percent: percentage of the measured resistor value that will be used + * to select the update values in pre-emphasis sequence (range: 0 to 99). + * + * @retval NONE + */ +void radio_gain_fix_init( + uint8_t region_0x1f_val, uint8_t region_0x0f_val, + uint8_t region_0x0b_val, uint8_t region_0x09_val, + uint8_t r_msur_percent); + +#endif /* SUPPORT_CONFIGURABLE_GAIN_FIX */ + +#endif /* INCLUDE_PLATFORM_H_ */ +/** + * @} + * + */ diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/power_table.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/power_table.h index d3a1e3e49..156b3dc0b 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/power_table.h +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/power_table.h @@ -1,29 +1,37 @@ -/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.32a-lca02/firmware/public_inc/power_table.h#1 $*/ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/2.00a-lca01/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 and - * associated documentation files (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. - * + * 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. + * 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. * * */ diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/pta.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/pta.h index 8fc7cc8a6..390051432 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/pta.h +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/pta.h @@ -1,29 +1,37 @@ -/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.32a-lca02/firmware/public_inc/pta.h#1 $*/ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/2.00a-lca01/firmware/public_inc/pta.h#1 $*/ /** ****************************************************************************** * @file pta.h * @brief This file contains all prototypes for the public PTA APIs ****************************************************************************** * @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 and - * associated documentation files (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. - * + * 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. + * 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. * * */ @@ -39,8 +47,8 @@ * @brief Enumeration holding the PTA enable and disable. */ typedef enum { - PTA_DISABLED = 0, - PTA_ENABLED, + PTA_DISABLED = 0, + PTA_ENABLED, } pta_state; #if (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION || (SUPPORT_LE_PERIODIC_ADVERTISING && (SUPPORT_EXPLCT_OBSERVER_ROLE || SUPPORT_SYNC_ISOCHRONOUS))) @@ -48,42 +56,42 @@ typedef enum { * @brief Enumeration holding the event types passed to the BLE_SetLinkCoexPriority(). */ typedef enum { - PTA_LINK_COEX_CONN, - PTA_LINK_COEX_PRDC_SCAN, + PTA_LINK_COEX_CONN, + PTA_LINK_COEX_PRDC_SCAN, } pta_link_coex_event_type; #endif /* (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION || \ - (SUPPORT_LE_PERIODIC_ADVERTISING && (SUPPORT_EXPLCT_OBSERVER_ROLE || SUPPORT_SYNC_ISOCHRONOUS))) */ + (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 Enumeration holding the event types passed to the BLE_SetISOCoexPriority(). */ typedef enum { - PTA_ISO_CIG, - PTA_ISO_BIG, + PTA_ISO_CIG, + PTA_ISO_BIG, } pta_iso_type; #endif /* (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS || \ - (SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION))) */ + (SUPPORT_CONNECTED_ISOCHRONOUS && (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION))) */ /** * @brief Enumeration holding all the error codes for the PTA interfaces */ typedef enum pta_error { - PTA_ERROR_SUCCESS, - PTA_ERROR_PTA_NOT_ENABLED, - PTA_ERROR_INVALID_PRIORITY_CONF, - PTA_ERROR_UNKNOWN_CONN_HANDLE, - PTA_ERROR_UNKNOWN_PRDC_SYNC_HANDLE, - PTA_ERROR_UNKNOWN_CIG_HANDLE, - PTA_ERROR_UNKNOWN_BIG_HANDLE, - PTA_ERROR_INVALID_NBR_OF_PKTS, - PTA_ERROR_INVALID_TIMEOUT, - PTA_ERROR_INVALID_REQUEST_TO_EVENT_TIME, - PTA_ERROR_INVALID_PTA_STATE, - PTA_ERROR_INIT_ALREADY_CALLED, - PTA_ERROR_PTA_ENABLED_IN_INIT, - PTA_ERROR_PTA_INIT_NOT_CALLED, + PTA_ERROR_SUCCESS, + PTA_ERROR_PTA_NOT_ENABLED, + PTA_ERROR_INVALID_PRIORITY_CONF, + PTA_ERROR_UNKNOWN_CONN_HANDLE, + PTA_ERROR_UNKNOWN_PRDC_SYNC_HANDLE, + PTA_ERROR_UNKNOWN_CIG_HANDLE, + PTA_ERROR_UNKNOWN_BIG_HANDLE, + PTA_ERROR_INVALID_NBR_OF_PKTS, + PTA_ERROR_INVALID_TIMEOUT, + PTA_ERROR_INVALID_REQUEST_TO_EVENT_TIME, + PTA_ERROR_INVALID_PTA_STATE, + PTA_ERROR_INIT_ALREADY_CALLED, + PTA_ERROR_PTA_ENABLED_IN_INIT, + PTA_ERROR_PTA_INIT_NOT_CALLED, } pta_error; /***************************** Functions Prototypes *****************************/ @@ -105,7 +113,7 @@ typedef enum pta_error { * PTA_ERROR_SUCCESS : Otherwise. */ pta_error pta_enable( - pta_state enable); + pta_state enable); /** * @brief Used to initialize the PTA feature. The PHY sequences are configured with @@ -121,12 +129,12 @@ pta_error pta_enable( * PTA_ERROR_SUCCESS : Otherwise. */ pta_error pta_init( - uint8_t request_to_event_time); + uint8_t request_to_event_time); /***************************** BLE Functions *****************************/ #if (SUPPORT_BLE) #if (SUPPORT_MASTER_CONNECTION || SUPPORT_SLAVE_CONNECTION || \ - (SUPPORT_LE_EXTENDED_ADVERTISING && SUPPORT_LE_PERIODIC_ADVERTISING && (SUPPORT_EXPLCT_OBSERVER_ROLE || SUPPORT_SYNC_ISOCHRONOUS))) + (SUPPORT_LE_EXTENDED_ADVERTISING && SUPPORT_LE_PERIODIC_ADVERTISING && (SUPPORT_EXPLCT_OBSERVER_ROLE || SUPPORT_SYNC_ISOCHRONOUS))) /** * @brief Used to configure the priority of the ACL and Periodic Scan events. * @note This API can be called directly to configure the priority of the ACL and Periodic Scan events. In case the BLE controller is supported, beside this API, @@ -155,14 +163,14 @@ pta_error pta_init( * PTA_ERROR_SUCCESS : Otherwise. */ pta_error pta_set_link_coex_priority( - pta_link_coex_event_type event_type, - uint16_t handle, - uint32_t priority, - uint32_t priority_mask, - uint8_t acl_multi_slot_nbr_of_packets, - uint8_t link_loss_limit_timeout); + pta_link_coex_event_type event_type, + uint16_t handle, + uint32_t priority, + uint32_t priority_mask, + uint8_t acl_multi_slot_nbr_of_packets, + 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))) */ + (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) /** @@ -191,11 +199,11 @@ pta_error pta_set_link_coex_priority( * PTA_ERROR_SUCCESS : Otherwise. */ pta_error pta_set_iso_coex_priority( - pta_iso_type iso_type, - uint8_t group_id, - uint32_t priority, - uint32_t priority_mask, - uint8_t link_loss_limit_timeout); + pta_iso_type iso_type, + uint8_t group_id, + uint32_t priority, + uint32_t priority_mask, + uint8_t link_loss_limit_timeout); #endif /* (SUPPORT_BRD_ISOCHRONOUS || SUPPORT_SYNC_ISOCHRONOUS || SUPPORT_CONNECTED_ISOCHRONOUS) */ #endif /* SUPPORT_BLE */ @@ -216,8 +224,8 @@ pta_error pta_set_iso_coex_priority( * PTA_ERROR_SUCCESS : Otherwise. */ pta_error pta_set_coex_priority( - uint32_t priority, - uint32_t priority_mask); + uint32_t priority, + uint32_t priority_mask); /***************************** MAC Functions *****************************/ #if (SUPPORT_MAC) @@ -238,8 +246,8 @@ pta_error pta_set_coex_priority( * PTA_ERROR_SUCCESS : Otherwise. */ pta_error pta_set_mac_coex_priority( - uint32_t priority, - uint32_t priority_mask); + uint32_t priority, + uint32_t priority_mask); #endif /* SUPPORT_MAC */ /** @} */ diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/ral.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/ral.h new file mode 100644 index 000000000..b8ca8cb07 --- /dev/null +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/ral.h @@ -0,0 +1,1551 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/2.00a-lca01/firmware/public_inc/ral.h#1 $*/ +/** + ******************************************************************************** + * @file ral.h + * @brief The file include description for the RAL (Radio Abstraction Layer) interfaces and call backs, + * RAL provides functionalities to start, stop and manage different types of events [Transmission - Reception - Energy scanning]. + * + * + * + ****************************************************************************** + * @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_RAL_H_ +#define INCLUDE_RAL_H_ + +#include "common_types.h" +#include "os_wrapper.h" +#include "mac_host_intf.h" +#include "instance.h" +#include "radio.h" +#if SUPPORT_ENH_ACK_LINK_METRICS_PROBING_OT_1_2 +#include "platform.h" +#endif +/* Defines */ +/* @brief: An index used in multi-instance for specifying which instance to perform operation on */ +typedef uint8_t ral_instance_t; +/* @brief: Defined for each ral event to identify event's current state + * + * + * ral event allocation + * ============== + *ral_add_tx_fifo() _ _ _ = RAL_IDLE = + * ============== + * + * ============== + * _ _(Requires ack)_ _ _ _ _ _ _= RAL_RX_ACK = + * ral event allocation / ============== + * ============= / + * ral_start_tx() _ _ _ _ = RAL_TX_PKT =_ _ ral_isr()_ _/ + * ============= \ + * \ ============== + * \_ _(Doesn't require ack)_ _ _ _= RAL_TX_PKT = + * ============== + * + * ============== + * _ _(Requires ack)_ _ _ _ _ _ _= RAL_TX_ACK = + * ral event allocation / ============== + * ============= / + * ral_start_rx() _ _ _ _ = RAL_RX_PKT =_ _ ral_isr()_ _/ + * ============= \ + * \ ============== + * \_ _(Doesn't require ack)_ _ _ _= RAL_RX_PKT = + * ============== + * ral event allocation + * ============== + *ral_ed_scan() _ _ _ _ _ = RAL_ED = + * ============== + * + * + * + * */ +typedef enum ral_event_state_enum { + RAL_IDLE, + RAL_RX_PKT, + RAL_TX_PKT, + RAL_RX_ACK, + RAL_TX_ACK, + RAL_ED +} ral_event_state_enum_t; +/* @brief: used for ral configuration assignment */ +typedef enum ral_state_enum { + RAL_DISABLE = 0, + RAL_ENABLE = 1 +} ral_state_enum_t; + +/* @brief: Error codes defined in ral casted to Openthread codes in radio */ +typedef enum ral_error_enum { + RAL_ERROR_NONE = 0, + RAL_ERROR_FAILED = 1, + RAL_ERROR_DROP = 2, + RAL_ERROR_NO_BUFS = 3, + RAL_ERROR_BUSY = 5, + RAL_ERROR_INVALID_PARAMETERS = 7, + RAL_ERROR_SECURITY = 8, + RAL_ERROR_NO_ADDRESS = 10, + RAL_ERROR_ABORT = 11, + RAL_ERROR_NOT_SUPPORTED = 12, + RAL_ERROR_INVALID_STATE = 13, + RAL_ERROR_NO_ACK = 14, + RAL_ERROR_CCA_FAILURE = 15, + RAL_ERROR_FCS = 17, + RAL_ERROR_NO_FRAME_RECEIVED = 18, + RAL_ERROR_INVALID_SOURCE_ADDRESS = 20, + RAL_ERROR_DESTINATION_ADDRESS_FILTERED = 22, + RAL_ERROR_TIMER_ISR = 23, +#if SUPPORT_ENH_ACK_LINK_METRICS_PROBING_OT_1_2 + RAL_ERROR_LINK_METRICS_INVALID_ARGS, + RAL_ERROR_LINK_METRICS_NOT_FOUND, + RAL_ERROR_LINK_METRICS_NO_BUF, +#endif /* SUPPORT_ENH_ACK_LINK_METRICS_PROBING_OT_1_2 */ +#if SUPPORT_ANT_DIV + RAL_ERROR_AD_NOT_IN_CONFIG_STATE, +#endif /* SUPPORT_ANT_DIV */ + RAL_ERROR_GENERIC = 255 +} ral_error_enum_t; + +/* @brief: Define power states for ral where: + * + * RAL_POWER_SLEEP: power state of the ral when not executing any event. + * RAL_POWER_ACTIVE: power state of the ral before starting of any event. + * */ +typedef enum ral_power_state_enum { + RAL_POWER_SLEEP, + RAL_POWER_ACTIVE +} ral_power_state_enum_t; + +/* @brief: Define new TX retry type: + * + * CONTINUE_CSMA_RETRY: continue of CSMA retry from csma_backoff_count. + * START_NEW_FULL_TX_RETRY: start new TX retry from frm_retries_count. + * */ +typedef enum tx_new_retry_enum { + CONTINUE_CSMA_RETRY, + START_NEW_FULL_TX_RETRY +}tx_new_retry_enum_t; + +/* @brief: Define pkt source for transmission when call ral_start_tx() to be added properly in ral pkt. + * + * RAL_SOURCE_PACKET: used in case of single packet transmission mode the pkt is passed in ral_start_tx() and then copied to the allocated event. + * + * */ +typedef enum ral_pkt_src_enum { +#if SUPPORT_A_MAC +/* RAL_SOURCE_FIFO: this mode is defined only for A_MAC. And used in case of burst transmission each packet is copied to a ral event using ral_add_tx_fifo(). + * all ral events linked to each other in a linked list which is attached to the ral instance initialized by the application. + */ + RAL_SOURCE_FIFO, +#endif + RAL_SOURCE_PACKET +} ral_pkt_src_enum_t; +/* @brief: Define type of acknowledgment packet used in MAC 802.15.4.*/ +typedef enum ral_ack_type_enum { + RAL_NO_ACK, +#if SUPPORT_A_MAC + RAL_ACK_CUSTOM, +#endif + RAL_ACK_MAC +} ral_ack_type_enum_t; +/* @brief: Define ral time structure that contains fine and base */ +typedef ble_time_t ral_time_st; + +/** + * @struct ral_pkt_st + * @brief ral packet structure + * + * This structure contains the parameters of the sent/received ral packet + * + */ +typedef struct _ral_pkt_st { + uint8_t * ptr_pyld; /* pointer to packet */ + ral_time_st time_stamp; /* exact time in which the packet transmitted/received */ + uint16_t pyld_len; /* packet length */ + uint8_t channel; /* channel at which the packet will be transmitted */ + uint8_t rxchannelaftertxdone; /* The RX channel after frame TX is done (after all frame retries - ack received, or timeout, or abort).*/ + union + { + struct + { + ral_pkt_src_enum_t pkt_src; /* source of transmitted packet */ +#if SUPPORT_RADIO_SECURITY_OT_1_2 + uint8_t *sec_key; /* pointer to the security key used in sec processing */ + uint8_t is_sec_proc_by_radio; /* flag to mark if security processed by radio or not*/ +#endif + int8_t tx_power; /* power of transmitted packet */ + uint8_t last_tx_pkt; /* last transmitted packet flag */ + uint8_t csl_frame; /* True only if the current TX frame is a CSL frame */ + } tx_info; + + struct + { +#if SUPPORT_RADIO_SECURITY_OT_1_2 + uint32_t ack_frm_cntr; /* frame counter used for secured Enhanced ack */ + uint8_t ack_key_id; /* key index used for secured Enhanced ack */ + uint8_t is_sec_enh_ack; /* flag to mark usage of secured Enhanced ack */ +#endif + int8_t rssi; /* received signal strength indicator */ + uint8_t lqi; /* link quality indicator */ + uint8_t ackFrmPending; /* This indicates if this frame was acknowledged with frame pending set */ + } rx_info; + } tx_rx_u; +} ral_pkt_st; + +/** + * @struct ral_evnt_info_st + * @brief event information for RAL + * + * This structure contains the full information of the transmitted/received event + */ +typedef struct _ral_evnt_info_st{ + struct _ral_evnt_info_st * ptr_nxt_evnt; /* pointer to next event, used in case of FIFO transmission */ + union + { + struct + { + ral_pkt_st * ptr_pkt; /* pointer to data packet */ + ral_pkt_st * ptr_ack_pkt; /* pointer to ack packet used by this event */ + } pkt_info; + struct + { + uint32_t ed_scn_durn; /* Energy detection scan duration */ + int8_t ed_max_rssi; /* Energy detection max rssi value */ + } ed_info; + } ral_evnt_info_u; + uint32_t ral_status_mask; /* HW error mask of the received packet */ + ral_instance_t ral_instance; /* ral identifier of this event */ + ral_event_state_enum_t event_state; /* event type */ + ral_error_enum_t evnt_error; /* event error passed to higher layers */ +#if (SUPPORT_PTA) + uint8_t tx_pta_counter; /* Either the PTA Tx or Rx reject counter depending on the packet type */ + uint8_t rx_pta_counter; /* Either the PTA Tx or Rx reject counter depending on the packet type */ +#endif /* SUPPORT_PTA */ +} ral_evnt_info_st; + +/** + * @struct ral_mac_fltr_confg_st + * @brief MAC filteration parameters + * + * MAC filteration parameters used by HW to filter received packets. + * Used only by MAC 802.15.4 + * */ +typedef struct _ral_mac_fltr_confg_st { + uint8_t ext_addr[EXT_ADDRESS_LENGTH]; /* the device extended address to compare the received address with */ + uint16_t short_addr; /* the device short address to compare the received address with */ + uint16_t pan_id; /* the device pan id to compare the received pan id in the packet with */ + ral_state_enum_t mac_fltr_state; /* MAC filter state. If disabled so the promiscuous mode is enabled */ + uint8_t mac_implicit_broadcast; /* MAC ImplictBoradcast PIB that is set in MAC layer */ + uint8_t is_pan_coord; /* the first bit used to determine if the device is pan coordinator or not + the second bit is indicating if this instance is currently performing scanning or not */ +} ral_mac_fltr_confg_st; + +/** + * @struct ral_ack_rspnd_fltr_confg_st + * @brief filter before sending ack configuration + * + * this structure contains the parameters used to filter the received packet. + * and respond to this packet with ack or not + * */ +typedef struct _ral_ack_rspnd_fltr_confg_st { +#if SUPPORT_A_MAC + uint8_t * ptr_comp_value; /* Pointer to value to be compared with received data */ + uint8_t byte_index; /* Position of the byte start to be compared in the received data */ + uint8_t byte_len; /* Number of bytes to be compared in the received data */ +#endif + ral_state_enum_t ack_fltr_state; /* Enable/Disable packet filtration before sending ack */ +} ral_ack_rspnd_fltr_confg_st; +/** + * @struct ral_ack_req_confg_st + * @brief ack request bit configuration + * + * this structure contains information of ack request bit configuration + * */ +typedef struct _ral_ack_req_confg_st { + ral_state_enum_t ack_req_bit_state; /* Enable/Disable Ack request bit check */ + uint8_t byte_index; /* Byte index of Ack request bit in tx/rx packet */ + uint8_t bit_index; /* Bit index of Ack request bit in tx/rx packet */ +} ral_ack_req_confg_st; + +/** + * @struct ral_auto_ack_confg_st + * @brief RAL ack data + * + * this structure contains the parameters of the acknowledgment configuration. + * Configure of the received ack (in case of transmission) or configure the transmitted ack (in case of data reception) + * */ +typedef struct _ral_auto_ack_confg_st { + ral_ack_rspnd_fltr_confg_st rspnd_fltr_confg; /* Contains configured filters applied to received packet to determine whether to send ack or not */ + ral_ack_req_confg_st ack_req_confg; /* Contains configured ack request bit configuration*/ + uint16_t auto_tx_ack_turnaround; /*time in micro second between rcvd packet and tx ack */ + uint16_t auto_rx_ack_turnaround; /*time in micro second between tx packet and rcvd ack */ + uint16_t auto_rx_ack_timeout; /*timeout in microseconds to wait for rcvd ack*/ + uint16_t auto_rx_enh_ack_timeout; /*timeout in microseconds to wait for rcvd enhanced ack*/ + ral_ack_type_enum_t ack_type; /*ACK type*/ + ral_state_enum_t auto_tx_ack_state; /*Enable/Disable automatic transmitted ack*/ + ral_state_enum_t auto_rx_ack_state; /*Enable/Disable automatic rcvd ack*/ +} ral_auto_ack_confg_st; + +#if SUPPORT_A_MAC +typedef struct _ral_a_mac_params_st { + ral_auto_ack_confg_st auto_ack_config; + uint16_t ifs; + ral_phy_rate_enum_t phy_rate; +}ral_a_mac_params_st; +#endif /*SUPPORT_A_MAC*/ +/** + * @struct ral_coex_info_st + * @brief RAL event infomration in case of coexistence + * */ +typedef struct _ral_coex_info_st { + void * evnt_hndl; /* pointer to RAL event handle given from event scheduler after registration */ + ble_time_t grant_end_time; /* end time in sleep timer steps of grant given from event scheduler */ +} ral_coex_info_st; + +#if SUPPORT_ENH_ACK_LINK_METRICS_PROBING_OT_1_2 || CONFIG_MAC_CSL_RECEIVER_ENABLE +/** + * @struct mac_address_st + * @brief structure carrying information about address and address mode of a device + * */ +typedef struct mac_address_{ + uint8_t * ptr_address; + mac_addrs_mode_enum_t address_mode; +} mac_address_st; + +#if SUPPORT_ENH_ACK_LINK_METRICS_PROBING_OT_1_2 +/** + * @struct link_metrics_info_st + * @brief RAL Copy of radio otLinkMetrics structure + * */ +typedef struct link_metrics_info_ +{ + uint8_t mPduCount : 1; ///< Pdu count. + uint8_t mLqi : 1; ///< Link Quality Indicator. + uint8_t mLinkMargin : 1; ///< Link Margin. + uint8_t mRssi : 1; ///< Received Signal Strength Indicator. + uint8_t mReserved : 1; ///< Reserved, this is for reference device. +} link_metrics_info_st; + +typedef struct link_metric_data_info_st_* p_link_metric_data_info_st; +/** + * @struct link_metric_data_info_st + * @brief Link metrics initiator node + * */ +typedef struct link_metric_data_info_st_{ + + p_link_metric_data_info_st ptr_nxt_node; + // Initiator Info + struct{ + uint8_t extended_address[EXT_ADDRESS_LENGTH]; + uint16_t short_address; + } initiator_address_field_st; + link_metrics_info_st initiator_link_metrics; + +} link_metric_data_info_st; +#endif // SUPPORT_ENH_ACK_LINK_METRICS_PROBING_OT_1_2 +#endif // SUPPORT_ENH_ACK_LINK_METRICS_PROBING_OT_1_2 || CONFIG_MAC_CSL_RECEIVER_ENABLE + +/* Callback API */ +/** + * @struct ral_cbk_dispatch_tbl_st + * @brief call back functions + * + * This structure contains pointer to call back functions which should be called in ISR after Tx/Rx/ED is done + * */ +typedef struct _ral_cbk_dispatch_tbl_st { + void (*ral_tx_done)(ral_instance_t ral_instance, ral_pkt_st * ptr_tx_pkt, ral_pkt_st * ptr_ack_pkt, ral_error_enum_t tx_error); + void (*ral_rx_done)(ral_instance_t ral_instance, ral_pkt_st * ptr_rx_pkt, ral_error_enum_t rx_error); + void (*ral_ed_scan_done)(ral_instance_t ral_instance, uint32_t scan_durn, int8_t max_rssi); +#if (!SUPPORT_COEXISTENCE) + void (*ral_resume_rx_after_tmr_err)(void); +#endif /*end of (!SUPPORT_COEXISTENCE)*/ +#if SUPPORT_A_MAC + /*This callback will be called when device receives packet that require custom ack*/ + void (*ral_configure_custom_ack)(ral_instance_t ral_instance, uint8_t *ptr_ack_pkt, uint16_t*ack_len,uint8_t * ptr_rx_pkt); +#endif /*end of SUPPORT_A_MAC*/ +} ral_cbk_dispatch_tbl_st; +/* Definition for hardware control flags */ +//-------------------------------------------- +/* + * Tx PHY Rate: + * 0:125k + * 1:250k + * 2:1M + * 3:2M + * + * */ +#define DEFAULT_PHY_RATE 1 +/* : + * */ +#define DEFAULT_PHY_TX_LOWLTNCY 0 +/* : + * */ +#define DEFAULT_PHY_RX_LOWLTNCY 0 +/* + * Bypass CRC check [used for testing purpose] + * 1'b1 : Bypassing CRC check on the received packet. + * 1'b0 : perform CRC check on the received packet. + * */ +#define DEFAULT_TXPP_BYPASS_CRC 0 +/* : + * */ +#define DEFAULT_SCAN_BCN 0 +/* + * Packet processor configuration + * 1'b1 : RX PP will discard packet when mac_prmsicsmode is FALSE and generate error flags + * 1'b0 : RX PP will not discard packet when mac_prmiscsmode is FALSE and will only generate error flags + * */ +#define DEFAULT_DROP_ON_ERR 1 +/* +* PAN Coordinator identifier (used in third-level filtering when only source PAN ID is present in the received packet): +* 1'b1 - The device is PAN coordinator +* 1'b0 - The device is not PAN coordinator + * + * */ +#define DEFAULT_PANCOORD 0 +/* +* Indicates whether frames without a destination PAN ID and a destination address are to treated +* as though they are addressed to the broadcast PAN ID and broadcast short address. + * + * */ +#define DEFAULT_MACIMPLICITBROADCAST 0 +/* : + * */ +#define DEFAULT_MACGRPRXMODE 0 +/* + * MAC Promiscuous Mode - Indication of whether the MAC sublayer is in a promiscuous (receive all) mode. + * A value of TRUE indicates that the MAC sublayer accepts all frames received from the PHY. + * Shall be used for reception second-level filtering requirements + * */ +#define DEFAULT_MAC_PRMISCMOD 0 +//-------------------------------------------- +/*@enum + *@breif: enumerator that defines bit shift amount for control flags used to configure HW + * */ +enum control_flags_shift { + PHY_RATE_SHIFT, + PHY_TX_LOWLTNCY_SHIFT=2, + PHY_RX_LOWLTNCY_SHIFT, + TXPP_BYPASS_CRC_SHIFT, + SCAN_BCN_SHIFT, + DROP_ON_ERR_SHIFT, + PANCOORD_SHIFT, + MACIMPLICITBROADCAST_SHIFT, + MACGRPRXMODE_SHIFT, + MAC_PRMISCMOD_SHIFT, + VDDH_PA_SHIFT, + EPA_DISABLE_SHIFT = 15 +}; +/*@enum + *@breif: enumerator that defines bit shift amount for errors returned after event completion + * */ +enum error_flags_shift{ + TIMEOUT_FLAG_SHIFT = 2, /* bit location for timeout flag reception error */ + ADDMODE_ERR_SHIFT, /* bit location for Address Mode reception error. asserted when either of the following is asserted (dstaddr_err,srcpanid_err,dstpanid_err)*/ + RX_ERR_SHIFT, /* bit location for rx operation error. asserted when either rx_err or ppdu_err is asserted */ + PPDU_ERR_SHIFT, /* bit location for PPDU reception error. asserted when any of the following is asserted + (ack_err, crc_err,dstaddr_err,srcpanid_err,dstpanid_err,frmvrsn_err,frmtype_err,frmlngth_err)*/ + FRMLNGTH_ERR_SHIFT, /* bit location for Frame Length reception error. Asserted when received frame length is one of the reserved values mac_prmiscmode=0 and + decoded MAC header indicates MAC frame longer than received frame length*/ + FRMTYPE_ERR_SHIFT, /* bit location for Frame type reception error asserted when received frame type is one of the reserved values. + Available only when mac_prmiscmode=0 */ + FRMVRSN_ERR_SHIFT, /* bit location for Frame version reception error asserted when received frame version is neither 2'b00 not 2'b01. + Available only when mac_prmiscmode=0 */ + DSTPANID_ERR_SHIFT, /* bit location for Destination PAN ID reception error. Available only when mac_prmiscmode=0 */ + SRCPANID_ERR_SHIFT, /* bit location for Source PAN ID reception error. Available only when mac_prmiscmode=0 */ + ACK_OK_SHIFT, /* bit location for Acknowledgment received correctly flag */ + ACK_ERR_SHIFT, /* bit location for Acknowledgment received with errors flag */ + CRC_ERR_SHIFT, /* bit location for CRC error indicator flag*/ + DSTADDR_ERR_SHIFT, /* bit location for Destination Address reception error. Available only when mac_prmiscmode=0 */ + SEC_ERR_SHIFT = 30 /* bit location for security processing error occurred in case of secured Enhanced Ack */ +}; + + +/* Start of frame delimiter length as defined in OQPSK phy in MAC 802.15.4 std*/ +#define DEFAULT_MAC_SFD_LENGTH 1 +/* Preample length as defined in OQPSK phy in MAC 802.15.4 std*/ +#define DEFAULT_MAC_PREAMBLE_LENGTH 4 +/* Start of frame delimiter value as defined in OQPSK phy in MAC 802.15.4 std*/ +#define DEFAULT_MAC_SFD_VALUE 0xA7 +/* Preample value as defined in OQPSK phy in MAC 802.15.4 std*/ +#define DEFAULT_MAC_PEAMBLE_VALUE 0x0 + +#if(SUPPORT_A_MAC) +/* 1M preamble and SFD used only in A_MAC */ +/* Custom start of frame delimiter length used in 1M phy_rate*/ +#define DEFAULT_A_MAC_SFD_LENGTH_1M 4 +/* Custom preample length used in 1M phy rate*/ +#define DEFAULT_A_MAC_PREAMBLE_LENGTH_1M 1 +/* Custom start of frame delimiter value used in 1M phy_rate*/ +#define DEFAULT_A_MAC_SFD_VALUE_1M 0x71764129 +/* Custom preample value used in 1M phy rate*/ +#define DEFAULT_A_MAC_PEAMBLE_VALUE_1M 0xAA + +/* 2M preamble and SFD used only in A_MAC */ +/* Custom start of frame delimiter length used in 2M phy_rate*/ +#define DEFAULT_A_MAC_SFD_LENGTH_2M 4 +/* Custom preample length used in 2M phy rate*/ +#define DEFAULT_A_MAC_PREAMBLE_LENGTH_2M 2 +/* Custom start of frame delimiter value used in 2M phy_rate*/ +#define DEFAULT_A_MAC_SFD_VALUE_2M 0x71764129 +/* Custom preample value used in 2M phy rate*/ +#define DEFAULT_A_MAC_PEAMBLE_VALUE_2M 0xAAAA +#endif + +/* Bitfield sizes defined for MAC descriptor */ +#define MAC_SFD_VALUE_SIZE 32 +#define MAC_PREAMBLE_VAL_SIZE 32 +#define MAC_PANID_SIZE 16 +#define MAC_SHORTADDR_SIZE 16 +#define EUI64ADD_LSW_SIZE 32 +#define EUI64ADD_MSW_SIZE 32 +#define MAC_EXTADDR_LSW_SIZE 32 +#define MAC_EXTADDR_MSW_SIZE 32 +#define ERROR_FLAGS_SIZE 15 +#define RX_FRAME_LEN_SIZE 7 +#define DEBUG_PORTS_SIZE 5 +#define POINTER_TO_CURRENT_TX_SIZE 16 +#define POINTER_TO_CURRENT_RX_SIZE 16 +#define FRMLNGTH_SIZE 7 +#define MAC_SFD_LEN_SIZE 3 +#define MAC_PREAMBLE_LEN_SIZE 3 +#define SEQNUM_SIZE 8 +#define TX_MAC_LATENCY_SIZE 6 +#define CONTROL_FLAGS_SIZE 16 +#define PHY_DRV_SEQ_STRT_ADDR_SIZE 7 +#define PHY_DRV_SEQ_END_ADDR_SIZE 7 +#define PHY_DRV_RSSI_VALUE_SIZE 16 +#define PHY_DRV_LQI_VALUE_SIZE 8 +/* + * @struct + * @brief: contains Hardware descriptor fields that: + * 1- required to be filled before start of event. + * 2- need to be checked after the end of event. + * */ +typedef struct llhwc_mac_evnt_info_mem_st { + uint32_t mac_sfd_value :MAC_SFD_VALUE_SIZE; /* Start of frame delimiter value used by serializer and deserializer*/ + uint32_t mac_preamble_val :MAC_PREAMBLE_VAL_SIZE; /* Preamble value used by serializer */ + uint32_t mac_panid :MAC_PANID_SIZE; /* The identifier of the PAN on which the device is operating.used for third-level filtering */ + uint32_t mac_shortaddr :MAC_SHORTADDR_SIZE; /* The address that the device uses to communicate in the PAN.used for fourth-level filtering */ + uint32_t eui64add_LSW :EUI64ADD_LSW_SIZE; /* Least significant word for EUI Extended address defined in 2015 */ + uint32_t eui64add_MSW :EUI64ADD_MSW_SIZE; /* Most significant word for EUI Extended address defined in 2015 */ + uint32_t mac_extaddr_LSW :MAC_EXTADDR_LSW_SIZE; /* Least significant word for device Extended address */ + uint32_t mac_extaddr_MSW :MAC_EXTADDR_MSW_SIZE; /* Most significant word for device Extended address */ + uint32_t error_flags :ERROR_FLAGS_SIZE; /* Error flags set by hardware to indicate filteration errors*/ + uint32_t :1; + uint32_t rx_frm_len :RX_FRAME_LEN_SIZE; /* length of the received frame */ + uint32_t debug_ports :DEBUG_PORTS_SIZE; /* debugging ports defined for ST */ + uint32_t :4; + uint32_t rssi_out :PHY_DRV_RSSI_VALUE_SIZE; + uint32_t LQI :PHY_DRV_LQI_VALUE_SIZE; + uint32_t :8; + uint32_t frmlngth :FRMLNGTH_SIZE; /* length of the transmitted MAC frame */ + uint32_t :1; + uint32_t mac_sfd_len :MAC_SFD_LEN_SIZE; /* SFD length: 1 octet */ + uint32_t mac_preamble_len :MAC_PREAMBLE_LEN_SIZE; /* Preamble length: 4 octets */ + uint32_t :2; + uint32_t seqnum :SEQNUM_SIZE; /* Sequence number compared against sequence number extracted from mac header of a received ACK frame*/ + uint32_t tx_latency :TX_MAC_LATENCY_SIZE; /* This field sets the required time for the TX path to flush the last bit on the air */ + uint32_t :2; + uint32_t control_flags :CONTROL_FLAGS_SIZE; /* Flags used to Enable/Disable features in HW */ + uint32_t phy_drv_seq_strt_addr :PHY_DRV_SEQ_STRT_ADDR_SIZE;/* pointer to start address for sequencer ram */ + uint32_t :1; + uint32_t phy_drv_seq_end_addr :PHY_DRV_SEQ_END_ADDR_SIZE;/* pointer to end address for sequencer ram */ + uint32_t :1; + uint32_t Pointer_To_current_TX :POINTER_TO_CURRENT_TX_SIZE; /* pointer to the packet in shared memory to be transmitted */ + uint32_t Pointer_To_current_RX :POINTER_TO_CURRENT_RX_SIZE; /* pointer to shared memory place at which the packet will be received */ + +}llhwc_mac_evnt_info_mem_t; +#if SUPPORT_RADIO_SECURITY_OT_1_2 +typedef struct sec_update_desc_st_{ + uint8_t * ptr_key; + uint32_t frm_cntr; + uint32_t hdr_len; + uint8_t mic_len; + uint8_t sec_lvl; +} sec_update_desc_st; +#endif +/* + * brief: pointer to mac descriptor + * */ +extern llhwc_mac_evnt_info_mem_t* g_mac_event_info; + +/** @ingroup ral_intf_cmn +* @{ +*/ +/* Generic APIs ----------------------------------------------------------------------------------- */ +/** + * + * + * @brief radio abstraction layer initialize + * + * @param ptr_cbk_dispatch_tbl : [in] pointer to callbacks dispatch table + * + * @retval ral instance associated to this context that should be used with any ral interface + */ +ral_instance_t ral_init(ral_cbk_dispatch_tbl_st * ptr_cbk_dispatch_tbl); + +/** + * + * + * @brief ral power switch either sleep or active + * + * @param ral_instance : [in] ral instance + * @param power_state : [in] new power state + * @param ptr_coex_info : [in] pointer to current coexistence parameters + * + * @retval RAL_ERROR_NONE if power state changed successfully + */ +ral_error_enum_t ral_power_switch(ral_instance_t ral_instance, + ral_power_state_enum_t power_state, ral_coex_info_st * ptr_coex_info); + +/** + * + * + * @brief get current power state + * + * @param ral_instance : [in] ral instance + * + * @retval current power state RAL_POWER_SLEEP or RAL_POWER_ACTIVE + */ +ral_power_state_enum_t ral_get_power_state(ral_instance_t ral_instance); + +/** + * + * + * @brief get current event state and current channel if not idle + * + * @param curr_ral_instance : [out] current ral instance if not idle + * @param curr_event_channel : [out] current event channel if not idle + * + * @retval current event state RX, TX, ED, IDLE + */ +ral_event_state_enum_t ral_get_current_event_state(ral_instance_t * curr_ral_instance, uint8_t * curr_event_channel); + +#if SUPPORT_ANT_DIV +/** + * @fn ral_set_ant_div_params + * + * @brief set antenna diversity feature parameters + * + * @param ral_instance : [in] used ral instance + * @param ptr_ant_div_params : [in] pointer to antenna diversity parameters structure + * + * @retval RAL_ERROR_NONE if antenna diversity parameters are set correctly + */ +ral_error_enum_t ral_set_ant_div_params(ral_instance_t ral_instance, antenna_diversity_st* ptr_ant_div_params); + +/** + * @fn ral_get_ant_div_params + * + * @brief get antenna diversity feature parameters + * + * @param ral_instance : [in] used ral instance + * @param ptr_ant_div_params : [out] pointer to antenna diversity parameters structure + * + * @retval None + */ +void ral_get_ant_div_params(ral_instance_t ral_instance, antenna_diversity_st* ptr_ant_div_params); + +/** + * @fn ral_set_ant_div_enable + * + * @brief enable/disable antenna diversity + * + * @param ral_instance : [in] used ral instance + * @param enable : [in] enable:1 / disable:0 + * + * @retval RAL_ERROR_NONE if antenna diversity is enabled/disabled correctly + */ +ral_error_enum_t ral_set_ant_div_enable(ral_instance_t ral_instance, uint8_t enable); + +/** + * @fn ral_set_default_ant_id + * + * @brief set the default antenna id to be used for transmission and reception + * + * @param ral_instance : [in] used ral instance + * @param default_ant_id : [in] the antenna id to be used as default + * + * @retval RAL_ERROR_NONE if default antenna ID is set correctly + */ +ral_error_enum_t ral_set_default_ant_id(ral_instance_t ral_instance, uint8_t default_ant_id); + +/** + * @fn ral_set_ant_div_rssi_threshold + * + * @brief set antenna diversity rssi threshold + * + * @param ral_instance : [in] used ral instance + * @param rssi_threshold : [in] rssi threshold to compare with during antenna diversity measurements + * + * @retval RAL_ERROR_NONE if antenna diversity RSSI threshold is set correctly + */ +ral_error_enum_t ral_set_ant_div_rssi_threshold(ral_instance_t ral_instance, int8_t rssi_threshold); +#endif /* SUPPORT_ANT_DIV */ + +/** + * @} + */ +#if((!SUPPORT_COEXISTENCE && DEFAULT_PHY_CALIBRATION_PERIOD)) +/** + * + * + * @brief Execute PHY periodic calibration + * + * + * @retval NONE + */ +void ral_exec_phy_prdc_clbr(void); +#endif +/** @ingroup ral_intf_cmn +* @{ +*/ +#if SUPPORT_MAC +#if SUPPORT_A_MAC +/** + * + * + * @brief set phy rate for transmission/reception + * + * @param ral_instance : [in] used ral instance + * @param phy_rate : [in] new phy rate [1M/2M/256K/125K] + * + * @retval RAL_ERROR_NONE if phy rate changed successfully + */ +ral_error_enum_t ral_set_rate(ral_instance_t ral_instance, ral_phy_rate_enum_t phy_rate); +/** + * + * @brief set minimum interframe spacing between successive transmission/reception + * + * @param ral_instance : [in] used ral instance + * @param min_ifs : [in] new minimum interframe spacing in microsecond + * + * @retval None. + */ +void ral_set_min_ifs(ral_instance_t ral_instance, uint16_t min_ifs); +#endif + + +/** + * + * + * @brief set interframe spacing between successive transmission/reception + * + * @param ral_instance : [in] used ral instance + * @param ifs : [in] new interframe spacing in microsecond + * + * @retval RAL_ERROR_NONE if interframe spacing changed successfully + */ +#if SUPPORT_A_MAC +ral_error_enum_t ral_set_ifs(ral_instance_t ral_instance, uint16_t ifs); +#else +#if SUPPORT_ZIGBEE_PHY_CERTIFICATION +ral_error_enum_t ral_set_ifs(ral_instance_t ral_instance, uint16_t ifs); +#endif /* SUPPORT_ZIGBEE_PHY_CERTIFICATION */ +#endif +#endif +/** + * @} + */ +/** @ingroup ral_intf_tx +* @{ +*/ +/* Transmission APIs ----------------------------------------------------------------------------------- */ +/** + * + * + * @brief start packet transmission + * This function responsible for preparation for transmission of a packet by allocating and preparing a new ral event/ral pkt to be executed by HW. + * After completion of the Transmission event or if stop operation ral_tx_done() will be called carrying the status of event. + * + * @param ral_instance : [in] ral instance + * @param pkt_src : [in] transmission packet source, FIFO based or Packet based + * @param ptr_pkt : [in] pointer to transmitted packet if packet source is Packet based only + * @param ptr_start_time : [in] pointer to start time structure which contains start time of transmission + * if NULL function will use the current time get from llhwc_slptmr_get + * @param periodic_interval : [in] periodic interval in microsecond, 0 means not periodic + * @param ptr_coex_info : [in] pointer to current coexistence parameters + * + * @retval RAL_ERROR_NONE if transmission started successfully + * RAL_ERROR_INVALID_PARAMETERS if the passed parameters doesn't make sense e.g. starting fifo mode but ptr_fifo_head = NULL + * RAL_ERROR_BUSY if there is a transmission event that already started and not ended yet + * + * @note: ral_tx_done won't be called unless emngr_handle_all_events() is called to call ral_sm_done which will call the ral_tx_done call back + * + */ +ral_error_enum_t ral_start_tx(ral_instance_t ral_instance, ral_pkt_src_enum_t pkt_src, ral_pkt_st * ptr_pkt, + ral_time_st * ptr_start_time, uint32_t periodic_interval, ral_coex_info_st * ptr_coex_info); + +/** + * + * + * @brief abort current transmission + * This function is used for testing purpose + * + * @param ral_instance : [in] ral instance + * + * @retval RAL_ERROR_NONE if transmission aborted successfully + */ +ral_error_enum_t ral_abort_tx(ral_instance_t ral_instance); + +#if SUPPORT_A_MAC +/** + * + * + * @brief add packet to transmission FIFO + * + * @param ral_instance : [in] ral instance + * @param ptr_pkt : [in] pointer to input packet allocated by user application + * + * @retval RAL_ERROR_NONE if packet added to FIFO successfully + */ +ral_error_enum_t ral_add_tx_fifo(ral_instance_t ral_instance, ral_pkt_st * ptr_pkt); + +/** + * @brief flush current transmission FIFO + * + * @param ral_instance : [in] ral instance + * + * @retval RAL_ERROR_NONE if FIFO flushed successfully + */ +ral_error_enum_t ral_flush_fifo(ral_instance_t ral_instance); +#endif + +/** + * @brief get transmission packet to prepare data in before starting transmission + * must be used in case of packet transmission mode, The packet is allocated from TX/RX shared memory. + * + * @param ral_instance : [in] ral instance + * + * @retval pointer to allocated ral packet + */ +ral_pkt_st * ral_get_tx_buf(ral_instance_t ral_instance); +/** + * @} + */ +/** @ingroup ral_intf_ed +* @{ +*/ +/** + * @brief perform Clear Channel Assessment on selected channel + * + * @param channel : [in] channel to perform CCA on. + * @param ptr_coex_info : [in] pointer to current coexistence parameters + * @param energyThreshold : [in] the minimum value of RSSI to mark the channel busy , + * it used only in case of phy 2.00a_tc. defined by cca_change_threshold_seq for other phys. + * @param ral_instance : [in] ral instance + * @retval RAL_ERROR_NONE if no traffic on air, RAL_ERROR_CCA_FAILURE otherwise + */ +ral_error_enum_t ral_perform_cca(uint8_t channel, ral_coex_info_st * ptr_coex_info, int8_t energyThreshold + , ral_instance_t ral_instance +); +/** + * @} + */ +/** @ingroup ral_intf_rx +* @{ +*/ +/* Reception APIs ----------------------------------------------------------------------------------- */ +/** + * @brief start packet reception + * This function responsible for preparation for reception of a packet by allocating and preparing a new ral event/ral pkt to be executed by HW. + * After completion of the Reception event or if stop operation ral_rx_done() will be called carrying the status of event and the packet received. + * + * + * @param ral_instance : [in] ral instance + * @param rx_channel : [in] channel to receive on + * @param ptr_start_time : [in] pointer to start time structure which contains start time of reception + * @param timeout : [in] timeout of reception in microsecond from the start of reception + * @param periodic_interval : [in] periodic interval in microsecond, 0 means not periodic + * @param ptr_coex_info : [in] pointer to current coexistence parameters + * + * @retval RAL_ERROR_NONE if reception started successfully + * RAL_ERROR_INVALID_PARAMETERS if the passed parameters doesn't make sense e.g. if the reception channel out of MAC band + * RAL_ERROR_BUSY if there is a transmission event that already started and not ended yet + * + * @note: ral_rx_done won't be called unless emngr_handle_all_events() is called to call ral_sm_done which will call the ral_rx_done call back + */ +ral_error_enum_t ral_start_rx(ral_instance_t ral_instance, uint8_t rx_channel, ral_time_st * ptr_start_time, + uint32_t timeout, uint32_t periodic_interval, ral_coex_info_st * ptr_coex_info); + +/** + * @brief abort current reception + * This function is used for tseting purpose + * + * @param ral_instance : [in] ral instance + * + * @retval RAL_ERROR_NONE if reception aborted successfully + */ +ral_error_enum_t ral_abort_rx(ral_instance_t ral_instance); +/** + * @} + */ +/** @ingroup ral_intf_cmn +* @{ +*/ +/** + * @brief set automatic continuous reception after each event state + * + * @param ral_instance : [in] ral instance + * @param cont_recp_state : [in] continuous reception state, Enable or Disable + * Enable: means that when no transmission device will always receive + * + * @retval RAL_ERROR_NONE if new state saved successfully + */ +ral_error_enum_t ral_set_cont_recp_state(ral_instance_t ral_instance, ral_state_enum_t cont_recp_state); + +/** + * @brief This function used to Enable/Disable automatic switching to sleep mode after finish each event. + * set automatic sleep after each event state in case of continuous reception is disabled as if enabled + * ral shall schedule reception event from ral_isr() using active timer + * + * @param ral_instance : [in] ral instance + * @param auto_sleep_state : [in] automatic sleep state, Enable or Disable + * + * @retval RAL_ERROR_NONE if new state saved successfully + */ +ral_error_enum_t ral_set_auto_sleep_state(ral_instance_t ral_instance, ral_state_enum_t auto_sleep_state); +/** + * @brief This function used to get the state of automatic switching to sleep mode + * + * @param ral_instance : [in] ral instance + * + * @retval automatic sleep state, Enable or Disable + */ +ral_state_enum_t ral_get_auto_sleep_state(ral_instance_t ral_instance); +/** + * @brief configure mac filter in rtl while reception. + * when filter is disabled means reception in promiscuous mode. + * + * @param ral_instance : [in] ral instance + * @param ptr_mac_fltr_confg : [in] pointer to mac filter configuration + * + * @retval RAL_ERROR_NONE if new configuration saved successfully + */ +ral_error_enum_t ral_confg_mac_fltr(ral_instance_t ral_instance, ral_mac_fltr_confg_st * ptr_mac_fltr_confg); +/** + * @brief configure mac filter in scan mode + * + * + * @param ral_instance : [in] ral instance + * @param Enable : [in] set or clear scan mode + * + * @retval RAL_ERROR_NONE if new configuration saved successfully + */ +ral_error_enum_t ral_set_scan_filter(ral_instance_t ral_instance, uint8_t Enable); + +/* Auto Acknowledge APIs ----------------------------------------------------------------------------------- */ +/** + * @brief configure automatic ack after packet transmission/reception + * + * @param ral_instance : [in] ral instance + * @param ptr_auto_ack_confg : [in] pointer to new automatic ack configuration + * + * @retval RAL_ERROR_NONE if new configuration saved successfully + */ +ral_error_enum_t ral_confg_auto_ack(ral_instance_t ral_instance, ral_auto_ack_confg_st * ptr_auto_ack_confg); + +/** + * @brief temporary pause/resume automatic ack state only after transmission/reception + * this function is used for testing and custom purposes. + * + * @param ral_instance : [in] ral instance + * @param auto_tx_ack_state : [in] new state of automatic ack transmission + * @param auto_rx_ack_state : [in] new state of automatic ack reception + * + * @retval RAL_ERROR_NONE if new configuration saved successfully + */ +ral_error_enum_t ral_pause_auto_ack(ral_instance_t ral_instance, ral_state_enum_t auto_tx_ack_state, ral_state_enum_t auto_rx_ack_state); +/** + * @} + */ + +/** + * @brief set enhanced ack Header IE data + * + * @param ral_instance : [in] ral instance + * @param ptr_hdr_ie : [in] pointer to header IE data to be included in enhanced ack + * @param hdr_ie_len : [in] header IE data length + * + * @retval RAL_ERROR_NONE if new configuration saved successfully + */ +ral_error_enum_t ral_set_enh_ack_hdr_ie(ral_instance_t ral_instance, uint8_t * ptr_hdr_ie, uint8_t hdr_ie_len); + + +/** @ingroup ral_intf_cmn +* @{ +*/ +/** + * @brief Enable/Disable source address match feature. + * If disabled, the ral must set the "frame pending" on all acks to data request commands. + * If enabled, the ral uses the source address match table to determine whether to set or clear the + * "frame pending" bit in an ack to a data request command. + * + * @param ral_instance : [in] ral instance + * @param src_match_state : [in] source address match state + * + * @retval void + */ +void ral_set_src_match_state(ral_instance_t ral_instance, ral_state_enum_t src_match_state); + +/** + * @brief Add a short address to the source address match table + * + * @param ral_instance : [in] ral instance + * @param short_address : [in] short address to be added + * + * @retval RAL_ERROR_NONE if added successfully + */ +ral_error_enum_t ral_add_src_match_short(ral_instance_t ral_instance, const uint16_t short_address); + +/** + * @brief Add an extended address to the source address match table + * + * @param ral_instance : [in] ral instance + * @param ptr_ext_addr : [in] pointer to extended address to be added + * + * @retval RAL_ERROR_NONE if added successfully + */ +ral_error_enum_t ral_add_src_match_ext(ral_instance_t ral_instance, const uint8_t * ptr_ext_addr); + +/** + * @brief Remove a short address from the source address match table + * + * @param ral_instance : [in] ral instance + * @param short_address : [in] short address to be removed + * + * @retval RAL_ERROR_NONE if removed successfully + */ +ral_error_enum_t ral_clr_src_match_short(ral_instance_t ral_instance, const uint16_t short_address); + +/** + * @brief Remove an extended address from the source address match table + * + * @param ral_instance : [in] ral instance + * @param ptr_ext_addr : [in] pointer to extended address to be removed + * + * @retval RAL_ERROR_NONE if removed successfully + */ +ral_error_enum_t ral_clr_src_match_ext(ral_instance_t ral_instance, const uint8_t * ptr_ext_addr); + +/** + * @brief Remove all short addresses from the source address match table + * + * @param ral_instance : [in] used ral instance + * + * @retval void + */ +void ral_clr_all_src_match_short(ral_instance_t ral_instance); + +/** + * @brief Remove all extended addresses from the source address match table + * + * @param ral_instance : [in] used ral instance + * + * @retval void + */ +void ral_clr_all_src_match_ext(ral_instance_t ral_instance); +/** + * @} + */ +/* Energy Detect API ----------------------------------------------------------------------------------- */ +/** @ingroup ral_intf_ed +* @{ +*/ +/** + * + * @brief This function is used to terminate the ED + + * @retval None + * + */ +void ral_reset_ed(void); +/** + * @brief start energy detection scan on specific channel, + * ral_ed_scan_done callback is called to notify upper layer that the energy scan is complete. + * + * @param ral_instance : [in] ral instance + * @param scan_channel : [in] The channel to perform the energy scan on + * @param scan_duration : [in] scan duration in microsecond + * @param ptr_coex_info : [in] pointer to current coexistence parameters + * + * @retval RAL_ERROR_NONE if energy detection scanning started successfully + * + * @note: ral_ed_scan_done won't be called unless emngr_handle_all_events() is called to call ral_sm_done_cbk which will call ral_ed_scan_done + */ +ral_error_enum_t ral_ed_scan(ral_instance_t ral_instance, uint8_t scan_channel, uint32_t scan_duration, + ral_coex_info_st * ptr_coex_info); +/** + * @} + */ +#if SUPPORT_ZIGBEE_PHY_CERTIFICATION +/** + * @brief get the current LQI of the last received packet + * @param last_rssi : [in] RSSI of the last received packet + * @retval uint8_t. LQI value + */ +uint8_t ral_dtmGetLQIValue(int8_t last_rssi); +#endif /*SUPPORT_ZIGBEE_PHY_CERTIFICATION*/ + +/** + * + * @brief This function is used check whether the ral is about to transmit ack or not + * it will return true only if the state machine dine interrupt is set and the frame header is parsed and it indicates that the ack is requested + * @retval 1: Ack is about to be transmitted + * @retval 0: No Ack is to be transmitted + * + */ +uint8_t ral_is_about_to_transmit_ack(void); +/** + * + * @brief This function is used start the triggering of pre tx sequence from sequence ram as early as possible to save time in case of transmitting ack + + * @retval None + * + */ +void ral_early_perpare_phy_to_tx_ack(void); +/** + * + * @brief This function is the phy driver isr handler in case of mac event , + it is used restore the phy state after triggering of the pre interpact sequence from sequence ram + + * @retval None + * + */ +void ral_handle_phy_driver_isr(void); +#if SUPPORT_RADIO_SECURITY_OT_1_2 +/** + * @brief This function is used to update frame counter sustained in ral instance + * This function is called only in case of radio support OT_RADIO_CAPS_TRANSMIT_SEC + * is called from otPlatRadioSetMacFrameCounter() + * + * @param instance : Ral instance + * @param mac_frm_cntr : frame counter passed by upper layers + * + * @retval None + */ +void ral_update_mac_frm_cntr(ral_instance_t instance, uint32_t mac_frm_cntr); +/** + * @brief This function is used to update frame counter sustained in ral instance only if the new value larger than the old one + * This function is called only in case of radio support OT_RADIO_CAPS_TRANSMIT_SEC + * is called from otPlatRadioSetMacFrameCounterIfLarger() + * + * @param instance : Ral instance + * @param mac_frm_cntr : frame counter passed by upper layers + * + * @retval None + */ +void ral_update_larger_mac_frm_cntr(ral_instance_t instance, uint32_t mac_frm_cntr); +/** + * @brief This function is used to update keys and keyId sustained in ral instance + * This function is called only in case of radio support OT_RADIO_CAPS_TRANSMIT_SEC + * is called from otPlatRadioSetMacKey() + * + * @param instance : Ral instance + * @param aKeyId : Key index is used for comparison in case of keyId mode '1' + * To select between different keys. + * ------------ + * for example: + * ------------ + * if keyId (key index) equivalent to the received in MHR + * Then the used key is the current key. + * + * But if it isn't equivalent due to any connected neighbor's key index + * mismatch the key generator in upper layers shall be notified to take action + * based on the relation between the different key index + * + * ------------ + * for example: + * ----------- + * if keyId (key index) less than the received in MHR. this means that the + * communicating device has already generate a new key and started to rotate keys. + * so the next key is the key that shall be used in this situation. + * + * This kind of process synchronization beside another timing triggered events for + * new key generation and rotation allows a difference of only one between keyIds. + * + * see thread specification under security section subsection of "Key Rotation" + * + * @param aPrevKey : key used in case of keyid of received MHR less than the keyid sustained by ral_instance by one. + * @param aCurrKey : key used in case of keyid of received MHR equivalent to the keyid sustained by ral_instance. + * @param aNextKey : key used in case of keyid of received MHR greater than the keyid sustained by ral_instance by one. + * + * @retval None + */ +void ral_update_mac_keys( ral_instance_t instance, + uint8_t aKeyId, + const uint8_t *aPrevKey, + const uint8_t *aCurrKey, + const uint8_t *aNextKey ); +/** + * @brief This function is used to get the current key of an instance + * This function is called only in case of radio support OT_RADIO_CAPS_TRANSMIT_SEC + * + * @param instance : Ral instance + * + * @retval uint8_t* : pointer to the current key + */ +const otMacKeyMaterial * ral_get_inst_curr_key(ral_instance_t ral_instance); +/** + * @brief This function is used to get the previous key of an instance + * This function is called only in case of radio support OT_RADIO_CAPS_TRANSMIT_SEC + * + * @param instance : Ral instance + * + * @retval uint8_t* : pointer to the previous key sustained by ral layer + */ +uint8_t * ral_get_inst_prev_key(ral_instance_t ral_instance); +/** + * @brief This function is used to get the frame counter of an instance + * This function is called only in case of radio support OT_RADIO_CAPS_TRANSMIT_SEC + * + * @param instance : Ral instance + * + * @retval uint32_t : frame counter value sustained by ral layer + */ +uint32_t ral_get_inst_frm_cntr(ral_instance_t ral_instance); +/** + * @brief This function is used to get the key index of an instance + * This function is called only in case of radio support OT_RADIO_CAPS_TRANSMIT_SEC + * + * @param instance : Ral instance + * + * @retval uint8_t : key index sustained by ral layer + */ +uint8_t ral_get_inst_keyId(ral_instance_t ral_instance); + +#endif /*SUPPORT_RADIO_SECURITY_OT_1_2*/ +#if SUPPORT_ENH_ACK_LINK_METRICS_PROBING_OT_1_2 +/** + * @brief This function is used to configure [remove / add / modify] initiator device. + * + * @param short_addr :[in] mac_address_st carries address and adress mode for initiator + * @param ptr_ext_addr :[in] pointer to the matching node + * @param link_metrics :[in] pointer to the matching node + * + * @retval ral_error_enum_t : status + * RAL_ERROR_NONE : successfully configured. + * RAL_ERROR_LINK_METRICS_INVALID_ARGS : in case of ptr_ext_addr NULL. + * RAL_ERROR_LINK_METRICS_NOT_FOUND : in case of remove non-existing node. + * RAL_ERROR_LINK_METRICS_NO_BUF : in case of not enough supported nodes. + */ +ral_error_enum_t ral_config_enh_ack_probing(uint16_t short_addr, const uint8_t * ptr_ext_addr, void* link_metrics); +/** + * This method set the Link Metrics noise floor value needed to calculate the link margine + * + * @param[in] noise_floor The noise floor used by Link Metrics. It should be set to the platform's + * noise floor (measured noise floor, receiver sensitivity or a constant). + * + */ +void ral_link_metrics_set_noise_floor(int8_t noise_floor); +#endif /*SUPPORT_ENH_ACK_LINK_METRICS_PROBING_OT_1_2*/ +/** + * @brief set the value of the openthread base time. this value will be subtracted from all timing values sent / received to openthread + * @param [in] : base time value + * @retval None + */ + +void ral_set_ot_base_slp_time_value(uint32_t time); +/** + * @brief get the value of the openthread base time, the value nay be set through @ref ral_set_ot_base_slp_time_value + * @param None + * @retval uint64_t. base time value + */ + +uint64_t ral_get_ot_base_slp_time_value(void); +/** + * @brief Convert the value of sleep timer to openthread time + * @param time [in] : sleep timer value to be converted to openthread time + * @note if openthread is not integrated, @ref ral_ot_base_slp_time is set to zero, no conversion will take place + * @retval uint64_t. the converted time value + */ + +uint64_t ral_cnvert_slp_tim_to_ot_tim(uint32_t time); +/** + * @brief Convert the value of openthread time to sleep timer value + * @param time [in] : openthread time value to be converted to sleep timer + * @note if openthread is not integrated, @ref ral_ot_base_slp_time is set to zero, no conversion will take place + * @retval uint32_t. the converted time value + */ + +uint32_t ral_cnvert_ot_tim_to_slp_tim(uint64_t time); + +#if SUPPORT_OPENTHREAD_1_2 +/** + * @brief Convert the microsecond time to the proper value the should be set for teh sleep timer to start the event + * @param curr_time [in] : current sleep timer value to be converted to openthread time + * @param base_time [in] : base time in microsecond to be be converted + * @param delay_time [in] : microsecond delay from the base time + * @retval uint32_t. the converted sleep timer set point to be used in setting active timer + */ +uint32_t ral_cnvrt_req_time_to_set_point(uint32_t curr_time, uint32_t base_tim , uint32_t delay_time); +#if CONFIG_MAC_CSL_RECEIVER_ENABLE +/** + * @brief set CSL receiver parameters to enable/ Disable CSL. + * + * @param ral_instance : [in] ral instance + * @param cslPeriod : [in] CSL period to be included in CSL header IE or , 0 to disable CSL + * @param csl_short_addr : [in] The short source address of CSL receiver's peer. + * @param ptr_csl_ext_addr : [in] pointer to the parent extended address + * + * @retval None + * + */ +void ral_set_csl_rcv_param(ral_instance_t ral_instance, uint32_t cslPeriod ,uint16_t csl_short_addr, uint8_t* ptr_csl_ext_addr); +/** + * @brief set CSL receiver next sample time to be used in calculating phase. the sample time points to the time of he next sample window + * + * @param ral_instance : [in] ral instance + * @param cslSampleTime : [in] the lsb part of sample time in us + * + * @retval None + * + */ +void ral_set_csl_sample_time(ral_instance_t ral_instance, uint32_t cslSampleTime); +/** + * @brief check whether the RAL is receiving within the CSL sample window + * + * @param None + * + * @retval uint8_t TRUE 1 if the receiving in CSL window + * @retval uint8_t FALSE 0 if not receiving in CSL windoe + * + */ +uint8_t ral_is_rcv_in_csl_smple_wndw(void); +/** + * @brief check and add CSL header ie to any outgoing frame if csl receiver is enabled. + * + * @param ral_instance : [in] ral instance + * @param frame_ptr : [in] pointer the frame to be transmitted , either enhanced ack or any other frame. + * @param ie_index : [in,out] index of there first byte of CSL header IE. if the CSL header IE will be included , It will be incremented with the length of csl header ie + * @param data_ptr : [in] data pointer it point to the parent address in case of enhanced ack , and frame total length for TX frames + * @param enh_ack_flag : [in] flag to indicate whether enhanced ack or new Tx Frame + * @param addr_mode : [in] if enhanced ack then indicate the parent address is short or extendded + * + * @retval None + * + */ +void ral_hndl_csl_hdr_ie(ral_instance_t ral_instance, uint8_t *frame_ptr,uint8_t *ie_index, uint8_t * data_ptr , uint8_t enh_ack_flag, uint8_t addr_mode); +#endif /*CONFIG_MAC_CSL_RECEIVER_ENABLE*/ +#endif /* SUPPORT_OPENTHREAD_1_2 */ +/** + * @brief Set the CCA Energy Detection threshold in phy + * + * @param threshold : the CCA Energy Detection threshold value to be set + * + * @retval OT_ERROR_NONE if the the threshold is successfully set + * @retval OT_ERROR_FAILED if the given value is out of range + * + */ +otError ral_set_cca_ed_threshold(int8_t threshold); +/** + * @brief Get the CCA Energy Detection threshold in phy + * + * @param None. + * + * @retval int8_t CCA Energy Detection threshold value + * + */ +int8_t ral_get_cca_ed_threshold(void); +#if (SUPPORT_COEXISTENCE) +/** + * @brief radio csma error callback. + * + * @param tx_error : [in] status error returned from this transmission + * + * @retval None + * + */ +void radio_coex_tx_error_cbk(uint32_t error); +#endif /*end of (SUPPORT_COEXISTENCE)*/ +#if (RADIO_CSMA) &&(!SUPPORT_COEXISTENCE) +/** + * @brief set maximum time to start csma + * + * @param rx_timeout : [in] rx timeout time when there's RX while waiting csma backoff delay to fire (value in slp_tmr) + * @param max_csma_delay : [in] max start time to start csma in slp_tmr + * + * @retval None + * + */ +void ral_set_csma_time( +#if ENHANCED_RX_WHILE_CSMA_BACKOFF_DELAY + ble_time_t rx_timeout, +#endif /*end of ENHANCED_RX_WHILE_CSMA_BACKOFF_DELAY*/ + ble_time_t max_csma_delay); +#endif /*end of (RADIO_CSMA) &&(!SUPPORT_COEXISTENCE)*/ +/** + * @brief flag indication used to handle frame pending bit in ACK of all packets (set to true) or for ACK of data request command only (set to false) + * + * @param hndle_frm_pending_bit_for_acks : [in] TRUE means handle pending frame bit in ACK for all frame types, FALSE means handle frame pending bit in ACK for data request command only + * + * @retval None + * + */ +void ral_set_frm_pend_bit_for_acks(uint8_t hndle_frm_pending_bit_for_acks); + +#if RADIO_CSMA +/** + * + * @brief set csma enable flag + * + * @param csma_en : [in] value for csma enable flag to be set + * + * @retval None . + */ +void radio_set_csma_en(uint8_t csma_en); +/** + * + * @brief get csma enable flag + * + * @param None + * + * @retval uint8_t csma enable flag . + */ +uint8_t radio_get_csma_en(void); +#endif /*end of RADIO_CSMA*/ +/** + * + * @brief set cca enable flag + * + * @param cca_en : [in] value for cca enable flag to be set + * + * @retval None . + */ +void radio_set_cca_en(uint8_t cca_en); +/** + * + * @brief get cca enable flag + * + * @param None + * + * @retval uint8_t cca enable flag . + */ +uint8_t radio_get_cca_en(void); +/** + * + * @brief set pending TX retry flags + * + * @param evnt_type : [in] type of new retry (CONTINUE_CSMA_RETRY , START_NEW_FULL_TX_RETRY) + * @param radio_error : [in] error returned from previous TX trial + * + * @retval None . + */ +void radio_set_tx_retry_pending(tx_new_retry_enum_t evnt_type, otError radio_error); +/** + * + * @brief handle pending tx retry event + * + * @param None + * + * @retval None . + */ +void radio_handle_pnding_tx_retry_event(void); +/** + * + * @brief check if there's pending TX retry waiting to be executed + * + * @param None + * + * @retval uint8_t value of pending_tx_retry_flag . + */ +uint8_t radio_is_tx_retry_event_pending(void); +/** + * + * @brief Set MAC implicit boradcast PIB from MAC layer to be used in filteration + * + * @param ImplicitBroadcast: [in] Value for MAC implicit boradcast PIB to be set + * + * @retval None . + */ +void radio_set_implicitbroadcast(uint8_t ImplicitBroadcast); +/** + * + * @brief Set MAC implicit boradcast PIB from radio layer to be used in filteration + * + * @param ImplicitBroadcast: [in] Value for MAC implicit boradcast PIB to be set + * + * @retval None . + */ +void ral_set_implicitbroadcast(ral_instance_t ral_instance, uint8_t ImplicitBroadcast); +/** + * @fn ed_timer_hndl + * + * @brief energy detection timer event handle + * + * @param ptr_info : [in] pointer to current ral context + * + * @retval void + */ +void ed_timer_hndl(void* ptr_info); + +#if SUPPORT_MAC_PHY_CONT_TESTING_CMDS +/** + * + * @brief set the phy continuous modulation and continuous wave modes + * upon enable, if the selected mode is already enabled and likewise + * in disabling, the change will take no effect + * + * @param ral_instance : [in] ral instance + * + * @param type[in] : the type of the modulation (0: modulation, 1: wave) + * + * @param enable_mode[in] : if true then enable the selected mode otherwise disable it + * + * @param chnl_num[in] : channel number to be used in modulation (range: 0 to 15) + * + * @param tx_pwr[in] : The used power in dBm. + * + * @retval Status + */ +void ral_phy_set_zigbee_phy_cont_test_mode(ral_instance_t instance, uint8_t type, uint8_t enable_mode, uint8_t chnl_num, int8_t tx_pwr); +#endif /*end of SUPPORT_MAC_PHY_CONT_TESTING_CMDS */ + +#if SUPPORT_A_MAC +/** + * + * @fn ral_get_a_mac_params + * + * @brief get parameters used in augmented MAC (IFS, phy_rate, auto_ACK_config) + * + * @param ral_instance : [in] ral instance + * + * @param a_mac_params : [out] current augmented MAC parameters + * + * @retval Status + */ +ral_error_enum_t ral_get_a_mac_params(ral_instance_t ral_instance,ral_a_mac_params_st* a_mac_params); +#endif /*SUPPORT_A_MAC*/ + +#endif /* INCLUDE_RAL_H_ */ +/** + * @} + */ diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/rfd_dev_config.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/rfd_dev_config.h new file mode 100644 index 000000000..16e368bd4 --- /dev/null +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_cmd_lib/inc/rfd_dev_config.h @@ -0,0 +1,62 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/2.00a-lca01/firmware/public_inc/rfd_dev_config.h#1 $*/ +/** + ******************************************************************************** + * @file rfd_dev_config.h + * @brief Configurations for reduced function device and full function device + * + * + ****************************************************************************** + * @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 MAC_CONTROLLER_INC_RFD_DEV_CONFIG_H_ +#define MAC_CONTROLLER_INC_RFD_DEV_CONFIG_H_ + +#include "ll_fw_config.h" + + +#if (!FFD_DEVICE_CONFIG) /* RFD Device Configuration */ + +#define RFD_SUPPORT_ACTIVE_SCAN 1 /* Enable\Disable :RFD supports Active Scanning Enable:1 - Disable:0 */ +#define RFD_SUPPORT_ENERGY_DETECT 1 /* Enable\Disable :RFD supports Energy Detection Enable:1 - Disable:0 */ +#define RFD_SUPPORT_DATA_PURGE 0 /* Enable\Disable :RFD supports Data Purge Primitive Enable:1 - Disable:0 */ +#define RFD_SUPPORT_ASSOCIATION_IND_RSP 0 /* Enable\Disable :RFD supports Association Indication and Response Primitives Enable:1 - Disable:0 */ +#define RFD_SUPPORT_ORPHAN_IND_RSP 1 /* Enable\Disable :RFD supports Orphan Indication and Response Primitives Enable:1 - Disable:0 */ +#define RFD_SUPPORT_START_PRIM 1 /* Enable\Disable :RFD supports Start Primitive Enable:1 - Disable:0 */ +#define RFD_SUPPORT_PROMISCUOUS_MODE 1 /* Enable\Disable :RFD supports Promiscuous Mode Enable:1 - Disable:0 */ +#define RFD_SUPPORT_SEND_BEACON 1 /* Enable\Disable :RFD supports Sending Beacons if Coordinator Enable:1 - Disable:0 */ +#define RFD_SUPPORT_PANID_CONFLICT_RSLN 1 /* Enable\Disable :RFD supports Pan Id conflict detection and resolution Enable:1 - Disable:0 */ + +#endif + + +#endif /* MAC_CONTROLLER_INC_RFD_DEV_CONFIG_H_ */ diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/inc/ll_sys_sequencer.h b/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/inc/ll_sys_sequencer.h new file mode 100644 index 000000000..a34f4a9ac --- /dev/null +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/inc/ll_sys_sequencer.h @@ -0,0 +1,25 @@ +/** + ****************************************************************************** + * @file ll_sys_sequencer.h + * @author MCD Application Team + * @brief Header for template.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. + * + ****************************************************************************** + */ + +#ifndef LL_SYS_SEQUENCER_H +#define LL_SYS_SEQUENCER_H + +void ll_sys_sequencer_bg_process_init(void); +void ll_sys_sequencer_schedule_bg_process(void); + +#endif /* LL_SYS_SEQUENCER_H */ \ No newline at end of file diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/src/ll_sys_cs.c b/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/src/ll_sys_cs.c index 93f424d95..847121c67 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/src/ll_sys_cs.c +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/src/ll_sys_cs.c @@ -39,7 +39,7 @@ void ll_sys_disable_irq(void) { } /** - * @brief Set the Current Interrupt Priority Mask. + * @brief Set the Current Interrupt Priority Mask. * All interrupts with low priority level will be masked. * @param None * @retval None diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/src/ll_sys_dp_slp.c b/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/src/ll_sys_dp_slp.c index 891d40755..4ed3d4d4c 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/src/ll_sys_dp_slp.c +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/src/ll_sys_dp_slp.c @@ -20,14 +20,11 @@ #include "ll_sys.h" #include "ll_intf_cmn.h" -/* 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; +static 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; +static ll_sys_dp_slp_state_t linklayer_dp_slp_state = LL_SYS_DP_SLP_DISABLED; /** * @brief Initialize resources to handle deep sleep entry/exit @@ -37,10 +34,10 @@ ll_sys_dp_slp_state_t linklayer_dp_slp_state = LL_SYS_DP_SLP_DISABLED; 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); - + /* Set priority of deep sleep timer */ os_timer_set_prio(radio_dp_slp_tmr_id, hg_prio_tmr); @@ -48,7 +45,7 @@ ll_sys_status_t ll_sys_dp_slp_init(void) { return_status = LL_SYS_OK; } - + return return_status; } @@ -71,20 +68,20 @@ ll_sys_status_t ll_sys_dp_slp_enter(uint32_t dp_slp_duration){ ble_stat_t cmd_status; 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 + + else { /* No timer started */ os_status = SUCCESS; } - + if(os_status == SUCCESS) { /* Switch Link Layer IP to DEEP SLEEP mode */ @@ -117,12 +114,6 @@ ll_sys_status_t ll_sys_dp_slp_exit(void){ } 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) */ cmd_status = ll_intf_cmn_le_set_dp_slp_mode(DEEP_SLEEP_DISABLE); if(cmd_status == SUCCESS) @@ -130,11 +121,17 @@ ll_sys_status_t ll_sys_dp_slp_exit(void){ linklayer_dp_slp_state = LL_SYS_DP_SLP_DISABLED; return_status = LL_SYS_OK; } + + /* 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); + } } - + /* Re-enable radio interrupt */ LINKLAYER_PLAT_EnableRadioIT(); - + return return_status; } @@ -144,14 +141,8 @@ ll_sys_status_t ll_sys_dp_slp_exit(void){ * @retval LL_SYS status */ void ll_sys_dp_slp_wakeup_evt_clbk(void const *ptr_arg){ - int32_t os_status; - - /* 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/STM32_WPAN/link_layer/ll_sys/src/ll_sys_intf.c b/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/src/ll_sys_intf.c index e8151693d..28eb9624b 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/src/ll_sys_intf.c +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/src/ll_sys_intf.c @@ -28,7 +28,7 @@ */ void ll_sys_init() { - LINKLAYER_PLAT_ClockInit(); + LINKLAYER_PLAT_ClockInit(); } /** @@ -93,7 +93,7 @@ void ll_sys_setup_radio_intr(void (*intr_cb)()) /** * @brief Initialize the radio SW low interrupt - * @param intr_cb radio SW low interrupt interrupt callback to link + * @param intr_cb radio SW low interrupt interrupt callback to link * with the defined interrupt vector * @retval None */ @@ -123,7 +123,7 @@ void ll_sys_radio_evt_not(uint8_t start) { LINKLAYER_PLAT_StartRadioEvt(); } - + else { LINKLAYER_PLAT_StopRadioEvt(); @@ -141,7 +141,7 @@ void ll_sys_rco_clbr_not(uint8_t start) { LINKLAYER_PLAT_RCOStartClbr(); } - + else { LINKLAYER_PLAT_RCOStopClbr(); @@ -166,10 +166,10 @@ void ll_sys_request_temperature(void) void ll_sys_bg_process(void) { if(emngr_can_mcu_sleep() == 0) - { + { ll_sys_dp_slp_exit(); emngr_handle_all_events(); - + HostStack_Process(); } @@ -187,7 +187,7 @@ void ll_sys_schldr_timing_update_not(Evnt_timing_t * p_evnt_timing) /** * @brief Get the number of concurrent state machines for the Link Layer * @param None - * @retval Supported number of concurrent state machines + * @retval Supported number of concurrent state machines */ uint8_t ll_sys_get_concurrent_state_machines_num(void) { @@ -196,5 +196,5 @@ uint8_t ll_sys_get_concurrent_state_machines_num(void) __WEAK void HostStack_Process(void) { - + } diff --git a/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/src/ll_sys_startup.c b/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/src/ll_sys_startup.c index 4c8f071dc..d44bcd5ab 100644 --- a/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/src/ll_sys_startup.c +++ b/lib/stm32wba/STM32_WPAN/link_layer/ll_sys/src/ll_sys_startup.c @@ -44,11 +44,11 @@ static void ll_sys_event_missed_cb( ble_buff_hdr_t* ptr_evnt_hdr ) * @retval None */ void ll_sys_ble_cntrl_init(hst_cbk hostCallback) -{ +{ const struct hci_dispatch_tbl* p_hci_dis_tbl = NULL; - + hci_get_dis_tbl( &p_hci_dis_tbl ); - + ll_intf_init(p_hci_dis_tbl); ll_intf_rgstr_hst_cbk(hostCallback); @@ -67,7 +67,7 @@ void ll_sys_ble_cntrl_init(hst_cbk hostCallback) void ll_sys_mac_cntrl_init(void) { ST_MAC_preInit(); - ll_sys_dependencies_init(); + ll_sys_dependencies_init(); } #endif /* MAC */ @@ -92,20 +92,20 @@ static void ll_sys_dependencies_init(void) { static uint8_t is_ll_initialized = 0; ll_sys_status_t dp_slp_status; - + /* Ensure Link Layer resources are created only once */ if (is_ll_initialized == 1) { return; } is_ll_initialized = 1; - + /* Deep sleep feature initialization */ dp_slp_status = ll_sys_dp_slp_init(); - ll_sys_assert(dp_slp_status == LL_SYS_OK); - + 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(); } \ No newline at end of file diff --git a/lib/stm32wba/Utilities/trace/adv_trace/stm32_adv_trace.h b/lib/stm32wba/Utilities/trace/adv_trace/stm32_adv_trace.h deleted file mode 100644 index ee2b6fdb3..000000000 --- a/lib/stm32wba/Utilities/trace/adv_trace/stm32_adv_trace.h +++ /dev/null @@ -1,273 +0,0 @@ -/** - ****************************************************************************** - * @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/scripts/ble_library.py b/scripts/ble_library.py index cdf63a9e6..300e2d958 100644 --- a/scripts/ble_library.py +++ b/scripts/ble_library.py @@ -48,15 +48,21 @@ + "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/dtm.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/ll_error.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/ll_intf_cmn.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/platform.h", "Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/power_table.h", "Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/pta.h", + "Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/ral.h", + "Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/rfd_dev_config.h", + "Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/ll_sys_sequencer.h", "Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/config/ble_full/" + "ll_fw_config.h", "Middlewares/ST/STM32_WPAN/ble/stack/include/ble_bufsize.h",