From dc6c1387f8435e7bafd231ff545efaefbf49411f Mon Sep 17 00:00:00 2001 From: Alessandro Manganaro Date: Wed, 16 Oct 2024 16:12:00 +0200 Subject: [PATCH] lib/stm32wba/hci Adding ll_intf_cmn.h Adding interfaces of MAC only and BLE/Coexistence API Missing file after cube stm32wba version 1.4.1 update Signed-off-by: Alessandro Manganaro --- lib/stm32wba/hci/README | 1 + lib/stm32wba/hci/ll_intf_cmn.h | 169 +++++++++++++++++++++++++++++++++ scripts/ble_library.py | 1 + 3 files changed, 171 insertions(+) create mode 100644 lib/stm32wba/hci/ll_intf_cmn.h diff --git a/lib/stm32wba/hci/README b/lib/stm32wba/hci/README index 97522bd7e..ece382c50 100644 --- a/lib/stm32wba/hci/README +++ b/lib/stm32wba/hci/README @@ -116,6 +116,7 @@ Patch List: main.h app_conf.h scm.c + ll_intf_cmn.h * Changes from official delivery: - dos2unix applied diff --git a/lib/stm32wba/hci/ll_intf_cmn.h b/lib/stm32wba/hci/ll_intf_cmn.h new file mode 100644 index 000000000..540dce6d3 --- /dev/null +++ b/lib/stm32wba/hci/ll_intf_cmn.h @@ -0,0 +1,169 @@ +/*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.32a-LCA00/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 + * This Synopsys DWC Bluetooth Low Energy Combo Link Layer/MAC software and + * associated documentation ( hereinafter the "Software") is an unsupported + * proprietary work of Synopsys, Inc. unless otherwise expressly agreed to in + * writing between Synopsys and you. The Software IS NOT an item of Licensed + * Software or a Licensed Product under any End User Software License Agreement + * or Agreement for Licensed Products with Synopsys or any supplement thereto. + * Synopsys is a registered trademark of Synopsys, Inc. Other names included in + * the SOFTWARE may be the trademarks of their respective owners. + * + * Synopsys MIT License: + * Copyright (c) 2020-Present Synopsys, Inc + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * the Software), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE ARISING FROM, + * OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * */ + +#ifndef INCLUDE_LL_INTF_CMN_H_ +#define INCLUDE_LL_INTF_CMN_H_ + +#include "common_types.h" + + +/*========================================================================================================*/ +/*================================ Configure LL Context Control Command =================================*/ +/*========================================================================================================*/ + +/** + * @brief Used to configure the LL contexts, where: + * 1. For bare-metal: + * - High ISR is executed in the ISR context + * - Low ISR can be executed in the high ISR context, or switched to low ISR context + * 2. For RTOS: + * - High ISR is executed in the ISR context + * - Low ISR is executed in the thread of the "linkLayerHighPrioTask" + * + * @param allow_low_isr : [in] Configuration parameter for the context of the low ISR in the bare-metal model. Range is [0,1]. + * 0: Low ISR code is executed in the same context of the high ISR. + * 1: Low ISR code is executed in the context of the low ISR (by configuring a low priority interrupt that is triggered by FW). + * @param run_post_evnt_frm_isr : [in] Configuration parameter to decide whether the scheduling of the next BLE event is done in the low ISR context or to be handled by the LL main thread. Range is [0,1]. + * 0: BLE next event scheduling is handled in the LL main thread. + * 1: BLE next event scheduling is handled in the low ISR context. + * + * @retval ble_state_t : Command status + */ +ble_stat_t ll_intf_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). + * + * @param slp_clk_src : [in] Indicate which source to drive the sleep clock. 0: Crystal Oscillator (default). 1: RC0 + * @param ptr_slp_clk_freq_value : [out] Indicate the nominal frequency value of the sleep clock. + * + * @retval ble_stat_t : Command status to be sent to the Host. + */ +ble_stat_t ll_intf_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. + * + * @param rco_clbr_event_duration : [in] Indicate the number of sleep clock cycles for performing the RCO calibration process. + * @param rco_clbr_event_interval : [in] Indicate the periodicity of running the runtime RCO calibration event. + * + * @retval 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. + * + * @param tx_power_table_id : [in] Selected TX_Power table ID. + * + * @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. + * + * @param ptr_rnd : Pointer to the output random bytes . + * @param len : Number of required random bytes. + * + * @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 + * + * @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 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); + +ble_stat_t ll_intf_cmn_le_set_dp_slp_mode(uint8_t dp_slp_mode); + +#endif /* INCLUDE_LL_INTF_CMN_H_ */ diff --git a/scripts/ble_library.py b/scripts/ble_library.py index 4a908ffa8..5ec14a1b8 100644 --- a/scripts/ble_library.py +++ b/scripts/ble_library.py @@ -74,6 +74,7 @@ "Middlewares/ST/STM32_WPAN/link_layer/ll_sys/src/ll_sys_startup.c", "Middlewares/ST/STM32_WPAN/link_layer/ll_sys/inc/ll_sys_startup.h", "Middlewares/ST/STM32_WPAN/stm32_wpan_common.h", + "Middlewares/ST/STM32_WPAN/ll_intf_cmn.h", ble_heartrate_app_path + "/Core/Inc/app_common.h", ble_heartrate_app_path + "/Core/Inc/app_conf.h", ble_heartrate_app_path + "/Core/Inc/app_entry.h",