summaryrefslogtreecommitdiff
path: root/firmware/memory_chip_gone/Middlewares/ST
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/memory_chip_gone/Middlewares/ST')
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/ble.h88
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/ble_common.h117
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_events.h2008
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_gap_aci.c1661
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_gap_aci.h1931
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_gatt_aci.c1521
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_gatt_aci.h1281
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_hal_aci.c519
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_hal_aci.h478
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_hci_le.c2008
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_hci_le.h2263
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_l2cap_aci.c306
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_l2cap_aci.h304
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_types.h3459
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_vs_codes.h200
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_bufsize.h182
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_core.h42
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_defs.h507
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_legacy.h282
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_std.h387
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/template/ble_const.h129
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/template/compiler.h160
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/template/osal.c50
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/template/osal.h65
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/bas.h62
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/bls.h102
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/crs_stm.h72
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/dis.h52
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/eds_stm.h79
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hids.h79
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hrs.h99
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hts.h113
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/ias.h62
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/lls.h63
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/mesh.h43
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/motenv_stm.h177
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/otas_stm.h108
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/p2p_stm.h73
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/svc_ctl.h171
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/template_stm.h73
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/tps.h46
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/uuid.h328
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/zdd_stm.h100
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/common_blesvc.h54
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/p2p_stm.c295
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/svc_ctl.c330
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/hw.h105
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/shci/shci.c762
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/shci/shci.h1411
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/hci_tl.c308
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/hci_tl.h196
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/hci_tl_if.c30
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/mbox_def.h280
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl.c254
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl.h173
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl_if.c30
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/tl.h372
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/tl_mbox.c877
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/stm32_wpan_common.h171
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/dbg_trace.c360
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/dbg_trace.h103
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/otp.c52
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/otp.h65
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/stm_list.c207
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/stm_list.h63
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/stm_queue.c383
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/stm_queue.h59
-rw-r--r--firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/utilities_common.h159
68 files changed, 28949 insertions, 0 deletions
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/ble.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/ble.h
new file mode 100644
index 0000000..378a14c
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/ble.h
@@ -0,0 +1,88 @@
+/**
+ ******************************************************************************
+ * @file ble.h
+ * @author MCD Application Team
+ * @brief BLE interface
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __BLE_H
+#define __BLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "ble_conf.h"
+#include "ble_dbg_conf.h"
+
+/**< core */
+#include "core/ble_core.h"
+#include "core/ble_bufsize.h"
+#include "core/ble_defs.h"
+#include "core/auto/ble_vs_codes.h"
+#include "core/ble_legacy.h"
+#include "core/ble_std.h"
+
+/**< blesvc */
+#include "svc/Inc/bas.h"
+#include "svc/Inc/bls.h"
+#include "svc/Inc/crs_stm.h"
+#include "svc/Inc/dis.h"
+#include "svc/Inc/eds_stm.h"
+#include "svc/Inc/hids.h"
+#include "svc/Inc/hrs.h"
+#include "svc/Inc/hts.h"
+#include "svc/Inc/ias.h"
+#include "svc/Inc/lls.h"
+#include "svc/Inc/tps.h"
+#include "svc/Inc/motenv_stm.h"
+#include "svc/Inc/p2p_stm.h"
+#include "svc/Inc/zdd_stm.h"
+#include "svc/Inc/otas_stm.h"
+#include "svc/Inc/mesh.h"
+#include "svc/Inc/template_stm.h"
+
+#include "svc/Inc/svc_ctl.h"
+
+#include "svc/Inc/uuid.h"
+
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+ /* -------------------------------- *
+ * [retrieved from ble_legacy file]
+ * Macro to get RSSI from advertising report #0.
+ * "p" must be a pointer to the event parameters buffer
+ * -------------------------------- */
+#define HCI_LE_ADVERTISING_REPORT_RSSI_0(p) \
+ (*(int8_t*)((&((hci_le_advertising_report_event_rp0*)(p))-> \
+ Advertising_Report[0].Length_Data) + 1 + \
+ ((hci_le_advertising_report_event_rp0*)(p))-> \
+ Advertising_Report[0].Length_Data))
+
+/* Exported functions ------------------------------------------------------- */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__BLE_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/ble_common.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/ble_common.h
new file mode 100644
index 0000000..d4bb83c
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/ble_common.h
@@ -0,0 +1,117 @@
+/**
+ ******************************************************************************
+ * @file ble_common.h
+ * @author MCD Application Team
+ * @brief Common file to BLE Middleware
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __BLE_COMMON_H
+#define __BLE_COMMON_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include "ble_conf.h"
+#include "ble_dbg_conf.h"
+
+/* Event types copied from MW Legacy file*/
+#include "tl.h"
+
+/* -------------------------------- *
+ * Basic definitions *
+ * -------------------------------- */
+
+#undef NULL
+#define NULL 0
+
+#undef FALSE
+#define FALSE 0
+
+#undef TRUE
+#define TRUE (!0)
+
+
+/* -------------------------------- *
+ * Macro delimiters *
+ * -------------------------------- */
+
+#define M_BEGIN do {
+
+#define M_END } while(0)
+
+
+/* -------------------------------- *
+ * Some useful macro definitions *
+ * -------------------------------- */
+
+#ifndef MAX
+#define MAX( a, b ) (((a) > (b)) ? (a) : (b))
+#endif
+
+#ifndef MIN
+#define MIN( a, b ) (((a) < (b)) ? (a) : (b))
+#endif
+
+#define MODINC( a, m ) M_BEGIN (a)++; if ((a)>=(m)) (a)=0; M_END
+
+#define MODDEC( a, m ) M_BEGIN if ((a)==0) (a)=(m); (a)--; M_END
+
+#define MODADD( a, b, m ) M_BEGIN (a)+=(b); if ((a)>=(m)) (a)-=(m); M_END
+
+#define MODSUB( a, b, m ) MODADD( a, (m)-(b), m )
+
+#ifdef WIN32
+#define ALIGN(n)
+#else
+#define ALIGN(n) __attribute__((aligned(n)))
+#endif
+
+#define PAUSE( t ) M_BEGIN \
+ volatile int _i; \
+ for ( _i = t; _i > 0; _i -- ); \
+ M_END
+
+#define DIVF( x, y ) ((x)/(y))
+
+#define DIVC( x, y ) (((x)+(y)-1)/(y))
+
+#define DIVR( x, y ) (((x)+((y)/2))/(y))
+
+#define SHRR( x, n ) ((((x)>>((n)-1))+1)>>1)
+
+#define BITN( w, n ) (((w)[(n)/32] >> ((n)%32)) & 1)
+
+#define BITNSET( w, n, b ) M_BEGIN (w)[(n)/32] |= ((U32)(b))<<((n)%32); M_END
+
+ /* -------------------------------- *
+ * Compiler *
+ * -------------------------------- */
+#define PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__)))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__BLE_COMMON_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_events.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_events.h
new file mode 100644
index 0000000..b9a1a5a
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_events.h
@@ -0,0 +1,2008 @@
+/*****************************************************************************
+ * @file ble_events.h
+ * @brief STM32WB BLE API (event callbacks)
+ * Auto-generated file: do not edit!
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#ifndef BLE_EVENTS_H__
+#define BLE_EVENTS_H__
+
+
+#include "auto/ble_types.h"
+
+#define HCI_EVENT_TABLE_SIZE 6
+#define HCI_LE_EVENT_TABLE_SIZE 16
+#define HCI_VS_EVENT_TABLE_SIZE 54
+
+typedef struct
+{
+ uint16_t evt_code;
+ void (*process)( const uint8_t* in );
+} hci_event_table_t;
+
+extern const hci_event_table_t hci_event_table[HCI_EVENT_TABLE_SIZE];
+extern const hci_event_table_t hci_le_event_table[HCI_LE_EVENT_TABLE_SIZE];
+extern const hci_event_table_t hci_vs_event_table[HCI_VS_EVENT_TABLE_SIZE];
+
+/* HCI events */
+
+/**
+ * @brief HCI_DISCONNECTION_COMPLETE_EVENT
+ * This event occurs when a connection is terminated. The status parameter
+ * indicates if the disconnection was successful or not. The reason parameter
+ * indicates the reason for the disconnection if the disconnection was
+ * successful. If the disconnection was not successful, the value of the reason
+ * parameter shall be ignored by the Host.
+ * Note: if the connection is terminated by the remote device, the reason
+ * parameter of this event is set to the reason specified by the remote device
+ * only if it has an allowed value, otherwise the reason is forced to Remote
+ * User Terminated Connection error code (0x13). Allowed remote reason values
+ * are: Authentication Failure error code (0x05), Other End Terminated
+ * Connection error codes (0x13 to 0x15), Unsupported Remote Feature error code
+ * (0x1A), and Unacceptable Connection Parameters error code (0x3B).
+ * See Core Specification [Vol 4, Part E, 7.7.5].
+ *
+ * @param Status Status error code.
+ * @param Connection_Handle Connection handle for which the event applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Reason Reason for disconnection (see Core Specification [Vol 1, Part
+ * F] Error Codes).
+ * @return None
+ */
+void hci_disconnection_complete_event( uint8_t Status,
+ uint16_t Connection_Handle,
+ uint8_t Reason );
+
+/**
+ * @brief HCI_ENCRYPTION_CHANGE_EVENT
+ * The Encryption Change event is used to indicate that the change of the
+ * encryption mode has been completed. The Connection_Handle will be a
+ * Connection_Handle for an ACL connection. The Encryption_Enabled event
+ * parameter specifies the new Encryption_Enabled parameter for the
+ * Connection_Handle specified by the Connection_Handle event parameter. This
+ * event will occur on both devices to notify the Hosts when Encryption has
+ * changed for the specified Connection_Handle between two devices. Note: This
+ * event shall not be generated if encryption is paused or resumed; during a
+ * role switch, for example.
+ * The meaning of the Encryption_Enabled parameter depends on whether the Host
+ * has indicated support for Secure Connections in the
+ * Secure_Connections_Host_Support parameter. When
+ * Secure_Connections_Host_Support is 'disabled' or the Connection_Handle
+ * refers to an LE link, the Controller shall only use Encryption_Enabled
+ * values 0x00 (OFF) and 0x01 (ON).
+ * See Core Specification [Vol 4, Part E, 7.7.8].
+ *
+ * @param Status Status error code.
+ * @param Connection_Handle Connection handle for which the event applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Encryption_Enabled Link Level Encryption.
+ * Values:
+ * - 0x00: Link Level Encryption OFF
+ * - 0x01: Link Level Encryption is ON with AES-CCM
+ * @return None
+ */
+void hci_encryption_change_event( uint8_t Status,
+ uint16_t Connection_Handle,
+ uint8_t Encryption_Enabled );
+
+/**
+ * @brief HCI_READ_REMOTE_VERSION_INFORMATION_COMPLETE_EVENT
+ * The Read Remote Version Information Complete event is used to indicate the
+ * completion of the process obtaining the version information of the remote
+ * Controller specified by the Connection_Handle event parameter. The
+ * Connection_Handle shall be for an ACL connection.
+ * The Version event parameter defines the specification version of the LE
+ * Controller.
+ * The Manufacturer_Name event parameter indicates the manufacturer of the
+ * remote Controller. The Subversion event parameter is controlled by the
+ * manufacturer and is implementation dependent. The Subversion event parameter
+ * defines the various revisions that each version of the BLE hardware will go
+ * through as design processes change and errors are fixed. This allows the
+ * software to determine what BLE hardware is being used and, if necessary, to
+ * work around various bugs in the hardware.
+ * When the Connection_Handle is associated with an LE-U logical link, the
+ * Version event parameter shall be Link Layer VersNr parameter, the
+ * Manufacturer_Name event parameter shall be the CompId parameter, and the
+ * Subversion event parameter shall be the SubVersNr parameter.
+ * See Core Specification [Vol 4, Part E, 7.7.12].
+ *
+ * @param Status Status error code.
+ * @param Connection_Handle Connection handle for which the event applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Version Version of the Current LMP in the remote Controller
+ * @param Manufacturer_Name Manufacturer Name of the remote Controller
+ * @param Subversion Subversion of the LMP in the remote Controller
+ * @return None
+ */
+void hci_read_remote_version_information_complete_event( uint8_t Status,
+ uint16_t Connection_Handle,
+ uint8_t Version,
+ uint16_t Manufacturer_Name,
+ uint16_t Subversion );
+
+/**
+ * @brief HCI_HARDWARE_ERROR_EVENT
+ * This event is used to notify the Host that a hardware failure has occurred
+ * in the Controller.
+ * Refer to Annex for details on the possible values of Hardware_Code.
+ *
+ * @param Hardware_Code Implementation-specific hardware code.
+ * @return None
+ */
+void hci_hardware_error_event( uint8_t Hardware_Code );
+
+/**
+ * @brief HCI_NUMBER_OF_COMPLETED_PACKETS_EVENT
+ * This event is used by the Controller to indicate to the Host how many HCI
+ * Data Packets have been completed (transmitted or flushed) for each
+ * Connection_Handle since the previous Number Of Completed Packets event was
+ * sent to the Host. This means that the corresponding buffer space has been
+ * freed in the Controller. Based on this information, and the
+ * HC_Total_Num_ACL_Data_Packets and HC_Total_Num_Synchronous_Data_Packets
+ * return parameter of the Read_Buffer_Size command, the Host can determine for
+ * which Connection_Handles the following HCI Data Packets should be sent to
+ * the Controller. The Number Of Completed Packets event must not be sent
+ * before the corresponding Connection Complete event. While the Controller has
+ * HCI data packets in its buffer, it must keep sending the Number Of Completed
+ * Packets event to the Host at least periodically, until it finally reports
+ * that all the pending ACL Data Packets have been transmitted or flushed.
+ *
+ * @param Number_of_Handles The number of Connection_Handles and
+ * Num_HCI_Data_Packets parameters pairs contained in this event
+ * @param Handle_Packets_Pair_Entry See @ref Handle_Packets_Pair_Entry_t
+ * @return None
+ */
+void hci_number_of_completed_packets_event( uint8_t Number_of_Handles,
+ const Handle_Packets_Pair_Entry_t* Handle_Packets_Pair_Entry );
+
+/**
+ * @brief HCI_ENCRYPTION_KEY_REFRESH_COMPLETE_EVENT
+ * This event is used to indicate to the Host that the encryption key was
+ * refreshed on the given Connection_Handle. The Controller sends this event
+ * when the encryption key has been refreshed due to encryption being started
+ * or resumed.
+ *
+ * @param Status Status error code.
+ * @param Connection_Handle Connection handle for which the event applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @return None
+ */
+void hci_encryption_key_refresh_complete_event( uint8_t Status,
+ uint16_t Connection_Handle );
+
+/* HCI LE events */
+
+/**
+ * @brief HCI_LE_CONNECTION_COMPLETE_EVENT
+ * This event indicates to both of the Hosts forming the connection that a new
+ * connection has been created. Upon the creation of the connection a
+ * Connection_Handle shall be assigned by the Controller, and passed to the
+ * Host in this event. If the connection establishment fails this event shall
+ * be provided to the Host that had issued the LE_Create_Connection command.
+ * This event indicates to the Host which issued a LE_Create_Connection command
+ * and received a Command Status event if the connection establishment failed
+ * or was successful.
+ * The Central_Clock_Accuracy parameter is only valid for a Peripheral. On a
+ * Central, this parameter is set to 0x00.
+ * See Core Specification [Vol 4, Part E, 7.7.65.1].
+ *
+ * @param Status Status error code.
+ * @param Connection_Handle Connection handle for which the event applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Role Role of the local device in the connection.
+ * Values:
+ * - 0x00: Central
+ * - 0x01: Peripheral
+ * @param Peer_Address_Type The address type of the peer device.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * @param Peer_Address Public Device Address or Random Device Address of the
+ * peer device
+ * @param Conn_Interval Connection interval used on this connection.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Latency Maximum Peripheral latency for the connection in number
+ * of connection events.
+ * Values:
+ * - 0x0000 ... 0x01F3
+ * @param Supervision_Timeout Supervision timeout for the LE Link.
+ * It shall be a multiple of 10 ms and larger than (1 +
+ * connPeripheralLatency) * connInterval * 2.
+ * Time = N * 10 ms.
+ * Values:
+ * - 0x000A (100 ms) ... 0x0C80 (32000 ms)
+ * @param Central_Clock_Accuracy Central clock accuracy. Only valid for a
+ * Peripheral.
+ * Values:
+ * - 0x00: 500 ppm
+ * - 0x01: 250 ppm
+ * - 0x02: 150 ppm
+ * - 0x03: 100 ppm
+ * - 0x04: 75 ppm
+ * - 0x05: 50 ppm
+ * - 0x06: 30 ppm
+ * - 0x07: 20 ppm
+ * @return None
+ */
+void hci_le_connection_complete_event( uint8_t Status,
+ uint16_t Connection_Handle,
+ uint8_t Role,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint16_t Conn_Interval,
+ uint16_t Conn_Latency,
+ uint16_t Supervision_Timeout,
+ uint8_t Central_Clock_Accuracy );
+
+/**
+ * @brief HCI_LE_ADVERTISING_REPORT_EVENT
+ * This event indicates that a device or multiple devices have responded to an
+ * active scan or received some information during a passive scan. The
+ * Controller may queue these advertising reports and send information from
+ * multiple devices in one LE Advertising Report event.
+ * See Core Specification [Vol 4, Part E, 7.7.65.2].
+ * Note: in the current BLE stack version, only one report is sent per event
+ * (Num_Reports = 1).
+ *
+ * @param Num_Reports Number of responses in this event.
+ * Values:
+ * - 0x01
+ * @param Advertising_Report See @ref Advertising_Report_t
+ * @return None
+ */
+void hci_le_advertising_report_event( uint8_t Num_Reports,
+ const Advertising_Report_t* Advertising_Report );
+
+/**
+ * @brief HCI_LE_CONNECTION_UPDATE_COMPLETE_EVENT
+ * This event is used to indicate that the Controller process to update the
+ * connection has completed.
+ * See Core Specification [Vol 4, Part E, 7.7.65.3].
+ *
+ * @param Status Status error code.
+ * @param Connection_Handle Connection handle for which the event applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Conn_Interval Connection interval used on this connection.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Latency Maximum Peripheral latency for the connection in number
+ * of connection events.
+ * Values:
+ * - 0x0000 ... 0x01F3
+ * @param Supervision_Timeout Supervision timeout for the LE Link.
+ * It shall be a multiple of 10 ms and larger than (1 +
+ * connPeripheralLatency) * connInterval * 2.
+ * Time = N * 10 ms.
+ * Values:
+ * - 0x000A (100 ms) ... 0x0C80 (32000 ms)
+ * @return None
+ */
+void hci_le_connection_update_complete_event( uint8_t Status,
+ uint16_t Connection_Handle,
+ uint16_t Conn_Interval,
+ uint16_t Conn_Latency,
+ uint16_t Supervision_Timeout );
+
+/**
+ * @brief HCI_LE_READ_REMOTE_FEATURES_PAGE_0_COMPLETE_EVENT
+ * This event is used to indicate the completion of the process of the
+ * Controller obtaining page 0 of the features used on the connection and the
+ * features supported by the remote BLE device specified by the
+ * Connection_Handle parameter.
+ * See Core Specification [Vol 4, Part E, 7.7.65.4].
+ *
+ * @param Status Status error code.
+ * @param Connection_Handle Connection handle for which the event applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param LE_Features Bit Mask List of page 0 of the supported LE features. See
+ * Core Specification [Vol 6, Part B, 4.6].
+ * @return None
+ */
+void hci_le_read_remote_features_page_0_complete_event( uint8_t Status,
+ uint16_t Connection_Handle,
+ const uint8_t* LE_Features );
+
+/**
+ * @brief HCI_LE_LONG_TERM_KEY_REQUEST_EVENT
+ * This event indicates that the Central is attempting to encrypt or re-encrypt
+ * the link and is requesting the Long Term Key from the Host.
+ * See Core Specification [Vol 6, Part B, 5.1.3] and [Vol 4, Part E, 7.7.65.5].
+ *
+ * @param Connection_Handle Connection handle for which the event applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Random_Number 64-bit random number
+ * @param Encrypted_Diversifier 16-bit encrypted diversifier
+ * @return None
+ */
+void hci_le_long_term_key_request_event( uint16_t Connection_Handle,
+ const uint8_t* Random_Number,
+ uint16_t Encrypted_Diversifier );
+
+/**
+ * @brief HCI_LE_DATA_LENGTH_CHANGE_EVENT
+ * This event notifies the Host of a change to either the maximum Payload
+ * length or the maximum transmission time of packets in either direction. The
+ * values reported are the maximum that will actually be used on the connection
+ * following the change, except that on the LE Coded PHY a packet taking up to
+ * 2704 us to transmit may be sent even though the corresponding parameter has
+ * a lower value.
+ * See Core Specification [Vol 4, Part E, 7.7.65.7] and [Vol 6, Part B,
+ * 4.5.10].
+ *
+ * @param Connection_Handle Connection handle for which the event applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param MaxTxOctets The maximum number of payload octets in a Link Layer
+ * packet that the local Controller will send on this connection
+ * (connEffectiveMaxTxOctets).
+ * Values:
+ * - 0x001B ... 0x00FB
+ * @param MaxTxTime The maximum time that the local Controller will take to
+ * send a Link Layer packet on this connection (connEffectiveMaxTxTime).
+ * Values:
+ * - 0x0148 ... 0x4290
+ * @param MaxRxOctets The maximum number of payload octets in a Link Layer
+ * packet that the local Controller expects to receive on this
+ * connection (connEffectiveMaxRxOctets).
+ * Values:
+ * - 0x001B ... 0x00FB
+ * @param MaxRxTime The maximum time that the local Controller expects to take
+ * to receive a Link Layer packet on this connection
+ * (connEffectiveMaxRxTime).
+ * Values:
+ * - 0x0148 ... 0x4290
+ * @return None
+ */
+void hci_le_data_length_change_event( uint16_t Connection_Handle,
+ uint16_t MaxTxOctets,
+ uint16_t MaxTxTime,
+ uint16_t MaxRxOctets,
+ uint16_t MaxRxTime );
+
+/**
+ * @brief HCI_LE_READ_LOCAL_P256_PUBLIC_KEY_COMPLETE_EVENT
+ * This event is generated when local P-256 key generation is complete.
+ * See Core Specification [Vol 4, Part E, 7.7.65.8].
+ *
+ * @param Status Status error code.
+ * @param Local_P256_Public_Key Local P-256 public key.
+ * @return None
+ */
+void hci_le_read_local_p256_public_key_complete_event( uint8_t Status,
+ const uint8_t* Local_P256_Public_Key );
+
+/**
+ * @brief HCI_LE_GENERATE_DHKEY_COMPLETE_EVENT
+ * This event indicates that LE Diffie Hellman key generation has been
+ * completed by the Controller.
+ * See Core Specification [Vol 4, Part E, 7.7.65.9].
+ *
+ * @param Status Status error code.
+ * @param DHKey Diffie Hellman Key
+ * @return None
+ */
+void hci_le_generate_dhkey_complete_event( uint8_t Status,
+ const uint8_t* DHKey );
+
+/**
+ * @brief HCI_LE_ENHANCED_CONNECTION_COMPLETE_EVENT
+ * This event indicates to both of the Hosts forming the connection that a new
+ * connection has been created. Upon the creation of the connection a
+ * Connection_Handle shall be assigned by the Controller, and passed to the
+ * Host in this event. If the connection establishment fails, this event shall
+ * be provided to the Host that had issued the LE_Create_Connection command.
+ * If this event is unmasked and LE Connection Complete event is unmasked, only
+ * the LE Enhanced Connection Complete event is sent when a new connection has
+ * been completed.
+ * This event indicates to the Host that issued a LE_Create_Connection command
+ * and received a Command Status event if the connection establishment failed
+ * or was successful.
+ * The Central_Clock_Accuracy parameter is only valid for a Peripheral. On a
+ * Central, this parameter is set to 0x00.
+ * See Core Specification [Vol 4, Part E, 7.7.65.10].
+ *
+ * @param Status Status error code.
+ * @param Connection_Handle Connection handle for which the event applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Role Role of the local device in the connection.
+ * Values:
+ * - 0x00: Central
+ * - 0x01: Peripheral
+ * @param Peer_Address_Type Address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * - 0x02: Public Identity Address (corresponds to the Resolved Private
+ * Address)
+ * - 0x03: Random (static) Identity Address (corresponds to the Resolved
+ * Private Address)
+ * @param Peer_Address Public Device Address, Random Device Address, Public
+ * Identity Address or Random (static) Identity Address of the device to
+ * be connected.
+ * @param Local_Resolvable_Private_Address Resolvable Private Address being
+ * used by the local device for this connection.
+ * This is only valid when the Own_Address_Type is set to 0x02 or 0x03.
+ * For other Own_Address_Type values, the Controller shall return all
+ * zeros.
+ * @param Peer_Resolvable_Private_Address Resolvable Private Address being used
+ * by the peer device for this connection.
+ * This is only valid for Peer_Address_Type 0x02 and 0x03. For other
+ * Peer_Address_Type values, the Controller shall return all zeros.
+ * @param Conn_Interval Connection interval used on this connection.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Latency Maximum Peripheral latency for the connection in number
+ * of connection events.
+ * Values:
+ * - 0x0000 ... 0x01F3
+ * @param Supervision_Timeout Supervision timeout for the LE Link.
+ * It shall be a multiple of 10 ms and larger than (1 +
+ * connPeripheralLatency) * connInterval * 2.
+ * Time = N * 10 ms.
+ * Values:
+ * - 0x000A (100 ms) ... 0x0C80 (32000 ms)
+ * @param Central_Clock_Accuracy Central clock accuracy. Only valid for a
+ * Peripheral.
+ * Values:
+ * - 0x00: 500 ppm
+ * - 0x01: 250 ppm
+ * - 0x02: 150 ppm
+ * - 0x03: 100 ppm
+ * - 0x04: 75 ppm
+ * - 0x05: 50 ppm
+ * - 0x06: 30 ppm
+ * - 0x07: 20 ppm
+ * @return None
+ */
+void hci_le_enhanced_connection_complete_event( uint8_t Status,
+ uint16_t Connection_Handle,
+ uint8_t Role,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ const uint8_t* Local_Resolvable_Private_Address,
+ const uint8_t* Peer_Resolvable_Private_Address,
+ uint16_t Conn_Interval,
+ uint16_t Conn_Latency,
+ uint16_t Supervision_Timeout,
+ uint8_t Central_Clock_Accuracy );
+
+/**
+ * @brief HCI_LE_DIRECTED_ADVERTISING_REPORT_EVENT
+ * This event indicates that directed advertisements have been received where
+ * the advertiser is using a resolvable private address for the InitA field in
+ * the ADV_DIRECT_IND PDU and the Scanning_Filter_Policy is equal to 0x02 or
+ * 0x03, see HCI_LE_Set_Scan_Parameters.
+ * Direct_Address_Type and Direct_Address specify the address the directed
+ * advertisements are being directed to. Address_Type and Address specify the
+ * address of the advertiser sending the directed advertisements.
+ * See Core Specification [Vol 4, Part E, 7.7.65.11].
+ *
+ * @param Num_Reports Number of responses in this event.
+ * Values:
+ * - 0x01
+ * @param Direct_Advertising_Report See @ref Direct_Advertising_Report_t
+ * @return None
+ */
+void hci_le_directed_advertising_report_event( uint8_t Num_Reports,
+ const Direct_Advertising_Report_t* Direct_Advertising_Report );
+
+/**
+ * @brief HCI_LE_PHY_UPDATE_COMPLETE_EVENT
+ * This event is used to indicate that the Controller has changed the
+ * transmitter PHY or receiver PHY in use.
+ * If the Controller changes the transmitter PHY, the receiver PHY, or both
+ * PHYs, this event shall be issued.
+ * If an LE_Set_PHY command was sent and the Controller determines that neither
+ * PHY will change as a result, it issues this event immediately.
+ * See Core Specification [Vol 4, Part E, 7.7.65.12].
+ *
+ * @param Status Status error code.
+ * @param Connection_Handle Connection handle for which the event applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param TX_PHY Transmitter PHY in use.
+ * Values:
+ * - 0x01: The transmitter PHY for the connection is LE 1M
+ * - 0x02: The transmitter PHY for the connection is LE 2M
+ * @param RX_PHY Receiver PHY in use.
+ * Values:
+ * - 0x01: The receiver PHY for the connection is LE 1M
+ * - 0x02: The receiver PHY for the connection is LE 2M
+ * @return None
+ */
+void hci_le_phy_update_complete_event( uint8_t Status,
+ uint16_t Connection_Handle,
+ uint8_t TX_PHY,
+ uint8_t RX_PHY );
+
+/**
+ * @brief HCI_LE_EXTENDED_ADVERTISING_REPORT_EVENT
+ * This event indicates that a BLE device has responded to an active scan or
+ * has broadcast advertisements that were received during a passive scan.
+ * See Core Specification [Vol 4, Part E, 7.7.65.13].
+ *
+ * @param Num_Reports Number of responses in this event.
+ * Values:
+ * - 0x01
+ * @param Event_Type Event type.
+ * Flags:
+ * - 0x0001: Connectable advertising
+ * - 0x0002: Scannable advertising
+ * - 0x0004: Directed advertising
+ * - 0x0008: Scan response
+ * - 0x0010: Legacy advertising PDUs used
+ * - 0x0020: Incomplete, more data to come
+ * - 0x0040: Incomplete, data truncated, no more to come
+ * @param Address_Type Address type of the advertising device.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * - 0x02: Public Identity Address (corresponds to Resolved Private
+ * Address)
+ * - 0x03: Random (static) Identity Address (corresponds to Resolved
+ * Private Address)
+ * - 0xFF: No address provided (anonymous advertisement)
+ * @param Address Public Device Address, Random Device Address, Public Identity
+ * Address, or Random (static) Identity Address of the advertising
+ * device.
+ * @param Primary_PHY Primary advertising PHY.
+ * Values:
+ * - 0x01: Advertiser PHY is LE 1M
+ * @param Secondary_PHY Secondary advertising PHY.
+ * Values:
+ * - 0x00: No packets on the secondary advertising physical channel
+ * - 0x01: Advertiser PHY is LE 1M
+ * - 0x02: Advertiser PHY is LE 2M
+ * - 0x03: Advertiser PHY is LE Coded
+ * @param Advertising_SID Value of the Advertising SID subfield in the ADI
+ * field of the PDU or, for scan responses, in the ADI field of the
+ * original scannable.
+ * Values:
+ * - 0xFF: No ADI field provided
+ * - 0x00 ... 0x0F: Advertising SID subfield
+ * @param TX_Power Tx Power (signed integer).
+ * Units: dBm.
+ * Values:
+ * - 127: Tx power information not available
+ * - -127 ... 20: Tx power
+ * @param RSSI RSSI (signed integer).
+ * Units: dBm.
+ * Values:
+ * - 127: RSSI not available
+ * - -127 ... 20
+ * @param Periodic_Adv_Interval Interval of the periodic advertising.
+ * Values:
+ * - 0x0000: No periodic advertising
+ * @param Direct_Address_Type Target device address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * - 0x02: Public Identity Address (Corresponds to Resolved Private
+ * Address)
+ * - 0x03: Random (static) Identity Address (Corresponds to Resolved
+ * Private Address)
+ * - 0xFE: Random Device Address (Controller unable to resolve)
+ * @param Direct_Address Public Device Address, Random Device Address, Public
+ * Identity Address, or Random (static) Identity Address of the target
+ * device.
+ * @param Data_Length Length of Data
+ * @param Data Octets of advertising or scan response data formatted as defined
+ * in Core Specification [Vol 3, Part C, 11].
+ * @return None
+ */
+void hci_le_extended_advertising_report_event( uint8_t Num_Reports,
+ uint16_t Event_Type,
+ uint8_t Address_Type,
+ const uint8_t* Address,
+ uint8_t Primary_PHY,
+ uint8_t Secondary_PHY,
+ uint8_t Advertising_SID,
+ uint8_t TX_Power,
+ uint8_t RSSI,
+ uint16_t Periodic_Adv_Interval,
+ uint8_t Direct_Address_Type,
+ const uint8_t* Direct_Address,
+ uint8_t Data_Length,
+ const uint8_t* Data );
+
+/**
+ * @brief HCI_LE_SCAN_TIMEOUT_EVENT
+ * This event indicates that scanning has ended because the duration has
+ * expired.
+ * See Core Specification [Vol 4, Part E, 7.7.65.17].
+ *
+ * @return None
+ */
+void hci_le_scan_timeout_event( void );
+
+/**
+ * @brief HCI_LE_ADVERTISING_SET_TERMINATED_EVENT
+ * This event indicates that the Controller has terminated advertising in the
+ * advertising sets specified by the Advertising_Handle parameter.
+ * See Core Specification [Vol 4, Part E, 7.7.65.18].
+ *
+ * @param Status Status error code.
+ * @param Advertising_Handle Used to identify an advertising set.
+ * Values:
+ * - 0x00 ... 0xEF
+ * @param Connection_Handle Connection handle for which the event applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Num_Completed_Ext_Adv_Events Number of completed extended advertising
+ * events transmitted by the Controller.
+ * Values:
+ * - 0x00 ... 0xFF
+ * @return None
+ */
+void hci_le_advertising_set_terminated_event( uint8_t Status,
+ uint8_t Advertising_Handle,
+ uint16_t Connection_Handle,
+ uint8_t Num_Completed_Ext_Adv_Events );
+
+/**
+ * @brief HCI_LE_SCAN_REQUEST_RECEIVED_EVENT
+ * This event indicates that a SCAN_REQ PDU or an AUX_SCAN_REQ PDU has been
+ * received by the advertiser. The request contains a device address from a
+ * scanner that is allowed by the advertising filter policy. The advertising
+ * set is identified by Advertising_Handle.
+ * See Core Specification [Vol 4, Part E, 7.7.65.19].
+ *
+ * @param Advertising_Handle Used to identify an advertising set.
+ * Values:
+ * - 0x00 ... 0xEF
+ * @param Scanner_Address_Type Scanner address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * - 0x02: Public Identity Address (corresponds to Resolved Private
+ * Address)
+ * - 0x03: Random (static) Identity Address (corresponds to Resolved
+ * Private Address)
+ * @param Scanner_Address Public Device Address, Random Device Address, Public
+ * Identity Address, or Random (static) Identity Address of the scanner
+ * device.
+ * @return None
+ */
+void hci_le_scan_request_received_event( uint8_t Advertising_Handle,
+ uint8_t Scanner_Address_Type,
+ const uint8_t* Scanner_Address );
+
+/**
+ * @brief HCI_LE_CHANNEL_SELECTION_ALGORITHM_EVENT
+ * This event indicates which channel selection algorithm is used on a data
+ * physical channel connection.
+ * See Core Specification [Vol 4, Part E, 7.7.65.20].
+ *
+ * @param Connection_Handle Connection handle for which the event applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Channel_Selection_Algorithm LE Channel Selection Algorithm.
+ * Values:
+ * - 0x00: Algorithm #1 is used
+ * - 0x01: Algorithm #2 is used
+ * @return None
+ */
+void hci_le_channel_selection_algorithm_event( uint16_t Connection_Handle,
+ uint8_t Channel_Selection_Algorithm );
+
+/* ACI General events */
+
+/**
+ * @brief ACI_WARNING_EVENT
+ * This event is generated to report warning information.
+ *
+ * @param Warning_Type Warning type
+ * Values:
+ * - 0x01: L2CAP recombination failure
+ * - 0x02: GATT unexpected peer message
+ * - 0x03: NVM almost full
+ * - 0x04: COC RX data length too large
+ * - 0x05: COC already assigned DCID
+ * - 0x06: SMP unexpected LTK request
+ * - 0x07: GATT bearer not allocated
+ * @param Data_Length Length of Data in octets
+ * @param Data Debug information.
+ * @return None
+ */
+void aci_warning_event( uint8_t Warning_Type,
+ uint8_t Data_Length,
+ const uint8_t* Data );
+
+/* ACI GAP events */
+
+/**
+ * @brief ACI_GAP_LIMITED_DISCOVERABLE_EVENT
+ * This event is generated by the controller when the limited discoverable mode
+ * ends due to timeout. The timeout is 180 seconds.
+ *
+ * @return None
+ */
+void aci_gap_limited_discoverable_event( void );
+
+/**
+ * @brief ACI_GAP_PAIRING_COMPLETE_EVENT
+ * This event is generated when the pairing process has completed successfully
+ * or a pairing procedure timeout has occurred or the pairing has failed. This
+ * is to notify the application that we have paired with a remote device so
+ * that it can take further actions or to notify that a timeout has occurred so
+ * that the upper layer can decide to disconnect the link.
+ *
+ * @param Connection_Handle Handle of the connection where this event occurred.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Status Pairing status
+ * Values:
+ * - 0x00: Success
+ * - 0x01: SMP timeout
+ * - 0x02: Pairing failed
+ * - 0x03: Encryption failed
+ * @param Reason Pairing failed reason code (valid in case of pairing failed
+ * status)
+ * Values:
+ * - 0x01: Passkey Entry Failed
+ * - 0x02: OOB Not Available
+ * - 0x03: Authentication Requirements
+ * - 0x04: Confirm Value Failed
+ * - 0x05: Pairing Not Supported
+ * - 0x06: Encryption Key Size
+ * - 0x07: Command Not Supported
+ * - 0x08: Unspecified Reason
+ * - 0x09: Repeated Attempts
+ * - 0x0A: Invalid Parameters
+ * - 0x0B: DHKey Check Failed
+ * - 0x0C: Numeric Comparison Failed
+ * - 0x0F: Key Rejected
+ * - 0x10: Busy
+ * @return None
+ */
+void aci_gap_pairing_complete_event( uint16_t Connection_Handle,
+ uint8_t Status,
+ uint8_t Reason );
+
+/**
+ * @brief ACI_GAP_PASS_KEY_REQ_EVENT
+ * This event is generated by the Security manager to the application when a
+ * passkey is required for pairing. When this event is received, the
+ * application has to respond with the ACI_GAP_PASS_KEY_RESP command.
+ *
+ * @param Connection_Handle Handle of the connection where this event occurred.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @return None
+ */
+void aci_gap_pass_key_req_event( uint16_t Connection_Handle );
+
+/**
+ * @brief ACI_GAP_AUTHORIZATION_REQ_EVENT
+ * This event is generated by the Security manager to the application when the
+ * application has set that authorization is required for reading/writing of
+ * attributes. This event will be generated as soon as the pairing is complete.
+ * When this event is received, ACI_GAP_AUTHORIZATION_RESP command should be
+ * used to respond by the application.
+ *
+ * @param Connection_Handle Handle of the connection where this event occurred.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @return None
+ */
+void aci_gap_authorization_req_event( uint16_t Connection_Handle );
+
+/**
+ * @brief ACI_GAP_BOND_LOST_EVENT
+ * This event is generated when a pairing request is issued in response to a
+ * Peripheral Security Request from a Central which has previously bonded with
+ * the Peripheral. When this event is received, the upper layer has to issue
+ * the command ACI_GAP_ALLOW_REBOND in order to allow the Peripheral to
+ * continue the pairing process with the Central.
+ *
+ * @param Connection_Handle Handle of the connection where this event occurred.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @return None
+ */
+void aci_gap_bond_lost_event( uint16_t Connection_Handle );
+
+/**
+ * @brief ACI_GAP_PROC_COMPLETE_EVENT
+ * This event is sent by the GAP to the upper layers when a procedure
+ * previously started has been terminated by the upper layer or has completed
+ * for any other reason
+ *
+ * @param Procedure_Code Terminated procedure.
+ * Values:
+ * - 0x01: GAP_LIMITED_DISCOVERY_PROC
+ * - 0x02: GAP_GENERAL_DISCOVERY_PROC
+ * - 0x08: GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC
+ * - 0x10: GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC
+ * - 0x20: GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC
+ * - 0x40: GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC
+ * - 0x80: GAP_OBSERVATION_PROC
+ * @param Status Status error code.
+ * @param Data_Length Length of Data in octets
+ * @param Data Procedure Specific Data.
+ * @return None
+ */
+void aci_gap_proc_complete_event( uint8_t Procedure_Code,
+ uint8_t Status,
+ uint8_t Data_Length,
+ const uint8_t* Data );
+
+/**
+ * @brief ACI_GAP_ADDR_NOT_RESOLVED_EVENT
+ * This event is sent only by a privacy enabled peripheral with a non-empty
+ * bonded device list. The event is sent to the application when the peripheral
+ * is unsuccessful in resolving the resolvable address of the peer device after
+ * connecting to it.
+ *
+ * @param Connection_Handle Handle of the connection where this event occurred.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @return None
+ */
+void aci_gap_addr_not_resolved_event( uint16_t Connection_Handle );
+
+/**
+ * @brief ACI_GAP_NUMERIC_COMPARISON_VALUE_EVENT
+ * This event is sent only during SC Pairing, when Numeric Comparison
+ * Association model is selected, in order to show the Numeric Value generated,
+ * and to ask for Confirmation to the User. When this event is received, the
+ * application has to respond with the ACI_GAP_NUMERIC_COMPARISON_RESP command.
+ *
+ * @param Connection_Handle Handle of the connection where this event occurred.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Numeric_Value Generated numeric value.
+ * @return None
+ */
+void aci_gap_numeric_comparison_value_event( uint16_t Connection_Handle,
+ uint32_t Numeric_Value );
+
+/**
+ * @brief ACI_GAP_KEYPRESS_NOTIFICATION_EVENT
+ * This event is sent only during SC Pairing, when Keypress Notifications are
+ * supported, in order to show the input type signaled by the peer device,
+ * having Keyboard only I/O capabilities. When this event is received, no
+ * action is required to the User.
+ *
+ * @param Connection_Handle Handle of the connection where this event occurred.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Notification_Type Type of Keypress input notified/signaled by peer
+ * device (having Keyboard only I/O capabilities.
+ * @return None
+ */
+void aci_gap_keypress_notification_event( uint16_t Connection_Handle,
+ uint8_t Notification_Type );
+
+/**
+ * @brief ACI_GAP_PAIRING_REQUEST_EVENT
+ * This event is sent only when SMP mode bit 3 is configured to 1. With this
+ * configuration, it is generated in two cases:
+ * - in Peripheral case, when a Pairing Request is received;
+ * - in Central case, when a Security Request is received that leads to the
+ * sending of a Pairing Request.
+ * The application shall respond to this event with
+ * ACI_GAP_PAIRING_REQUEST_REPLY command.
+ *
+ * @param Connection_Handle Handle of the connection where this event occurred.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Bonded Indicates if the peer device is already bonded or not.
+ * Values:
+ * - 0x00: The device is not already bonded
+ * - 0x01: The device is already bonded
+ * @param Auth_Req AuthReq field from Pairing Request (see Core Specification
+ * [Vol 3, Part H, 3.5.1]) or Security Request (see Core Specification
+ * [Vol 3, Part H, 3.6.7]).
+ * @return None
+ */
+void aci_gap_pairing_request_event( uint16_t Connection_Handle,
+ uint8_t Bonded,
+ uint8_t Auth_Req );
+
+/* ACI GATT/ATT events */
+
+/**
+ * @brief ACI_GATT_ATTRIBUTE_MODIFIED_EVENT
+ * This event is generated to the application by the GATT server when a client
+ * modifies any attribute on the server, as consequence of one of the following
+ * GATT procedures:
+ * - write without response
+ * - signed write without response
+ * - write characteristic value
+ * - write long characteristic value
+ * - reliable write.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attr_Handle Handle of the attribute that was modified.
+ * @param Offset Bits 14-0: offset from which the write has been performed by
+ * the peer device. Bit 15 is used as flag: when set to 1 it indicates
+ * that more data are to come (fragmented event in case of long
+ * attribute data).
+ * @param Attr_Data_Length Length of Attr_Data in octets
+ * @param Attr_Data The modified value
+ * @return None
+ */
+void aci_gatt_attribute_modified_event( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint16_t Offset,
+ uint16_t Attr_Data_Length,
+ const uint8_t* Attr_Data );
+
+/**
+ * @brief ACI_GATT_PROC_TIMEOUT_EVENT
+ * This event is generated by the client/server to the application on a GATT
+ * timeout (30 seconds). This is a critical event that should not happen during
+ * normal operating conditions. It is an indication of either a major
+ * disruption in the communication link or a mistake in the application which
+ * does not provide a reply to GATT procedures. After this event, the GATT
+ * channel is closed and no more GATT communication can be performed. The
+ * application is expected to issue an ACI_GAP_TERMINATE to disconnect from the
+ * peer device. It is important to leave a 100 ms blank window before sending
+ * the ACI_GAP_TERMINATE, since immediately after this event, system could save
+ * important information in non-volatile memory.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @return None
+ */
+void aci_gatt_proc_timeout_event( uint16_t Connection_Handle );
+
+/**
+ * @brief ACI_ATT_EXCHANGE_MTU_RESP_EVENT
+ * This event is generated in response to an Exchange MTU request. See
+ * ACI_GATT_EXCHANGE_CONFIG.
+ *
+ * @param Connection_Handle Connection handle for which the event applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Server_RX_MTU Attribute server receive MTU size
+ * @return None
+ */
+void aci_att_exchange_mtu_resp_event( uint16_t Connection_Handle,
+ uint16_t Server_RX_MTU );
+
+/**
+ * @brief ACI_ATT_FIND_INFO_RESP_EVENT
+ * This event is generated in response to a Find Information Request. See
+ * ACI_ATT_FIND_INFO_REQ and Find Information Response in Core Specification.
+ * This event is also generated in response to ACI_GATT_DISC_ALL_CHAR_DESC
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Format Format of the handle-UUID pairs
+ * @param Event_Data_Length Length of Handle_UUID_Pair in octets
+ * @param Handle_UUID_Pair A sequence of handle-uuid pairs. if format=1, each
+ * pair is:[2 octets for handle, 2 octets for UUIDs], if format=2, each
+ * pair is:[2 octets for handle, 16 octets for UUIDs]
+ * @return None
+ */
+void aci_att_find_info_resp_event( uint16_t Connection_Handle,
+ uint8_t Format,
+ uint8_t Event_Data_Length,
+ const uint8_t* Handle_UUID_Pair );
+
+/**
+ * @brief ACI_ATT_FIND_BY_TYPE_VALUE_RESP_EVENT
+ * This event is generated in response to a ACI_ATT_FIND_BY_TYPE_VALUE_REQ
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Num_of_Handle_Pair Number of attribute, group handle pairs
+ * @param Attribute_Group_Handle_Pair See @ref Attribute_Group_Handle_Pair_t
+ * @return None
+ */
+void aci_att_find_by_type_value_resp_event( uint16_t Connection_Handle,
+ uint8_t Num_of_Handle_Pair,
+ const Attribute_Group_Handle_Pair_t* Attribute_Group_Handle_Pair );
+
+/**
+ * @brief ACI_ATT_READ_BY_TYPE_RESP_EVENT
+ * This event is generated in response to a ACI_ATT_READ_BY_TYPE_REQ. See
+ * ACI_GATT_FIND_INCLUDED_SERVICES and ACI_GATT_DISC_ALL_CHAR_DESC.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Handle_Value_Pair_Length The size of each attribute handle-value pair
+ * @param Data_Length Length of Handle_Value_Pair_Data in octets
+ * @param Handle_Value_Pair_Data Attribute Data List as defined in Core
+ * Specification. A sequence of handle-value pairs: [2 octets for
+ * Attribute Handle, (Handle_Value_Pair_Length - 2 octets) for Attribute
+ * Value]
+ * @return None
+ */
+void aci_att_read_by_type_resp_event( uint16_t Connection_Handle,
+ uint8_t Handle_Value_Pair_Length,
+ uint8_t Data_Length,
+ const uint8_t* Handle_Value_Pair_Data );
+
+/**
+ * @brief ACI_ATT_READ_RESP_EVENT
+ * This event is generated in response to a Read Request. See
+ * ACI_GATT_READ_CHAR_VALUE.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Event_Data_Length Length of following data
+ * @param Attribute_Value The value of the attribute.
+ * @return None
+ */
+void aci_att_read_resp_event( uint16_t Connection_Handle,
+ uint8_t Event_Data_Length,
+ const uint8_t* Attribute_Value );
+
+/**
+ * @brief ACI_ATT_READ_BLOB_RESP_EVENT
+ * This event can be generated during a read long characteristic value
+ * procedure. See ACI_GATT_READ_LONG_CHAR_VALUE.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Event_Data_Length Length of following data
+ * @param Attribute_Value Part of the attribute value.
+ * @return None
+ */
+void aci_att_read_blob_resp_event( uint16_t Connection_Handle,
+ uint8_t Event_Data_Length,
+ const uint8_t* Attribute_Value );
+
+/**
+ * @brief ACI_ATT_READ_MULTIPLE_RESP_EVENT
+ * This event is generated in response to a Read Multiple Characteristic Values
+ * Request or a Read Multiple Variable Length Characteristic Values Request.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Event_Data_Length Length of following data
+ * @param Set_Of_Values A set of two or more values.
+ * A concatenation of attribute values for each of the attribute handles
+ * in the request in the order that they were requested.
+ * @return None
+ */
+void aci_att_read_multiple_resp_event( uint16_t Connection_Handle,
+ uint8_t Event_Data_Length,
+ const uint8_t* Set_Of_Values );
+
+/**
+ * @brief ACI_ATT_READ_BY_GROUP_TYPE_RESP_EVENT
+ * This event is generated in response to a Read By Group Type Request. See
+ * ACI_GATT_DISC_ALL_PRIMARY_SERVICES.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attribute_Data_Length The size of each attribute data
+ * @param Data_Length Length of Attribute_Data_List in octets
+ * @param Attribute_Data_List Attribute Data List as defined in Core
+ * Specification. A sequence of attribute handle, end group handle,
+ * attribute value tuples: [2 octets for Attribute Handle, 2 octets End
+ * Group Handle, (Attribute_Data_Length - 4 octets) for Attribute Value]
+ * @return None
+ */
+void aci_att_read_by_group_type_resp_event( uint16_t Connection_Handle,
+ uint8_t Attribute_Data_Length,
+ uint8_t Data_Length,
+ const uint8_t* Attribute_Data_List );
+
+/**
+ * @brief ACI_ATT_PREPARE_WRITE_RESP_EVENT
+ * This event is generated in response to a ACI_ATT_PREPARE_WRITE_REQ.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attribute_Handle The handle of the attribute to be written
+ * @param Offset The offset of the first octet to be written.
+ * @param Part_Attribute_Value_Length Length of Part_Attribute_Value in octets
+ * @param Part_Attribute_Value The value of the attribute to be written
+ * @return None
+ */
+void aci_att_prepare_write_resp_event( uint16_t Connection_Handle,
+ uint16_t Attribute_Handle,
+ uint16_t Offset,
+ uint8_t Part_Attribute_Value_Length,
+ const uint8_t* Part_Attribute_Value );
+
+/**
+ * @brief ACI_ATT_EXEC_WRITE_RESP_EVENT
+ * This event is generated in response to an Execute Write Request.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @return None
+ */
+void aci_att_exec_write_resp_event( uint16_t Connection_Handle );
+
+/**
+ * @brief ACI_GATT_INDICATION_EVENT
+ * This event is generated when an indication is received from the server.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attribute_Handle The handle of the attribute
+ * @param Attribute_Value_Length Length of Attribute_Value in octets
+ * @param Attribute_Value The current value of the attribute
+ * @return None
+ */
+void aci_gatt_indication_event( uint16_t Connection_Handle,
+ uint16_t Attribute_Handle,
+ uint8_t Attribute_Value_Length,
+ const uint8_t* Attribute_Value );
+
+/**
+ * @brief ACI_GATT_NOTIFICATION_EVENT
+ * This event is generated when a notification is received from the server.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attribute_Handle The handle of the attribute
+ * @param Attribute_Value_Length Length of Attribute_Value in octets
+ * @param Attribute_Value The current value of the attribute
+ * @return None
+ */
+void aci_gatt_notification_event( uint16_t Connection_Handle,
+ uint16_t Attribute_Handle,
+ uint8_t Attribute_Value_Length,
+ const uint8_t* Attribute_Value );
+
+/**
+ * @brief ACI_GATT_PROC_COMPLETE_EVENT
+ * This event is generated when a GATT client procedure completes either with
+ * error or successfully.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Error_Code Indicates whether the procedure completed with an error or
+ * was successful (see "Status error codes" section)
+ * @return None
+ */
+void aci_gatt_proc_complete_event( uint16_t Connection_Handle,
+ uint8_t Error_Code );
+
+/**
+ * @brief ACI_GATT_ERROR_RESP_EVENT
+ * This event is generated when an Error Response is received from the server.
+ * The error response can be given by the server at the end of one of the GATT
+ * discovery procedures. This does not mean that the procedure ended with an
+ * error, but this error event is part of the procedure itself.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Req_Opcode The request that generated this error response
+ * @param Attribute_Handle The attribute handle that generated this error
+ * response
+ * @param Error_Code The reason why the request has generated an error response
+ * (ATT error codes)
+ * Values:
+ * - 0x01: Invalid handle
+ * - 0x02: Read not permitted
+ * - 0x03: Write not permitted
+ * - 0x04: Invalid PDU
+ * - 0x05: Insufficient authentication
+ * - 0x06: Request not supported
+ * - 0x07: Invalid offset
+ * - 0x08: Insufficient authorization
+ * - 0x09: Prepare queue full
+ * - 0x0A: Attribute not found
+ * - 0x0B: Attribute not long
+ * - 0x0C: Insufficient encryption key size
+ * - 0x0D: Invalid attribute value length
+ * - 0x0E: Unlikely error
+ * - 0x0F: Insufficient encryption
+ * - 0x10: Unsupported group type
+ * - 0x11: Insufficient resources
+ * - 0x12: Database Out Of Sync
+ * - 0x13: Value Not Allowed
+ * @return None
+ */
+void aci_gatt_error_resp_event( uint16_t Connection_Handle,
+ uint8_t Req_Opcode,
+ uint16_t Attribute_Handle,
+ uint8_t Error_Code );
+
+/**
+ * @brief ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_EVENT
+ * This event can be generated during a "Discover Characteristics By UUID"
+ * procedure or a "Read using Characteristic UUID" procedure.
+ * The attribute value will be a service declaration as defined in Core
+ * Specification [Vol 3, Part G, 3.3.1], when a "Discover Characteristics By
+ * UUID" has been started. It will be the value of the Characteristic if a*
+ * "Read using Characteristic UUID" has been performed.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attribute_Handle The handle of the attribute
+ * @param Attribute_Value_Length Length of Attribute_Value in octets
+ * @param Attribute_Value The attribute value will be a service declaration as
+ * defined in Core Specification [Vol 3, Part G, 3.3.1], when a
+ * "Discover Characteristics By UUID" has been started.
+ * It will be the value of the Characteristic if a "Read using
+ * Characteristic UUID" has been performed.
+ * @return None
+ */
+void aci_gatt_disc_read_char_by_uuid_resp_event( uint16_t Connection_Handle,
+ uint16_t Attribute_Handle,
+ uint8_t Attribute_Value_Length,
+ const uint8_t* Attribute_Value );
+
+/**
+ * @brief ACI_GATT_WRITE_PERMIT_REQ_EVENT
+ * This event is given to the application when a write request, write command
+ * or signed write command is received by the server from the client. This
+ * event will be given to the application only if the event bit for this event
+ * generation is set when the characteristic was added.
+ * When this event is received, the application has to check whether the value
+ * being requested for write can be allowed to be written and respond with the
+ * command ACI_GATT_WRITE_RESP.
+ * The details of the parameters of the command can be found. Based on the
+ * response from the application, the attribute value will be modified by the
+ * stack. If the write is rejected by the application, then the value of the
+ * attribute will not be modified. In case of a write REQ, an error response
+ * will be sent to the client, with the error code as specified by the
+ * application.
+ * In case of write/signed write commands, no response is sent to the client
+ * but the attribute is not modified.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attribute_Handle The handle of the attribute
+ * @param Data_Length Length of Data field
+ * @param Data The data that the client has requested to write
+ * @return None
+ */
+void aci_gatt_write_permit_req_event( uint16_t Connection_Handle,
+ uint16_t Attribute_Handle,
+ uint8_t Data_Length,
+ const uint8_t* Data );
+
+/**
+ * @brief ACI_GATT_READ_PERMIT_REQ_EVENT
+ * This event is given to the application when a read request or read blob
+ * request is received by the server from the client. This event will be given
+ * to the application only if the event bit for this event generation is set
+ * when the characteristic was added.
+ * On receiving this event, the application can update the value of the handle
+ * if it desires and when done, it must send the ACI_GATT_ALLOW_READ command to
+ * indicate to the stack that it can send the response to the client.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attribute_Handle The handle of the attribute
+ * @param Offset Contains the offset from which the read has been requested
+ * @return None
+ */
+void aci_gatt_read_permit_req_event( uint16_t Connection_Handle,
+ uint16_t Attribute_Handle,
+ uint16_t Offset );
+
+/**
+ * @brief ACI_GATT_READ_MULTI_PERMIT_REQ_EVENT
+ * This event is given to the application when a read multiple request or read
+ * by type request is received by the server from the client. This event will
+ * be given to the application only if the event bit for this event generation
+ * is set when the characteristic was added.
+ * On receiving this event, the application can update the values of the
+ * handles if it desires and when done, it must send the ACI_GATT_ALLOW_READ
+ * command to indicate to the stack that it can send the response to the
+ * client.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Handle_Item See @ref Handle_Item_t
+ * @return None
+ */
+void aci_gatt_read_multi_permit_req_event( uint16_t Connection_Handle,
+ uint8_t Number_of_Handles,
+ const Handle_Item_t* Handle_Item );
+
+/**
+ * @brief ACI_GATT_TX_POOL_AVAILABLE_EVENT
+ * Each time one of the following GATT commands raises the error code
+ * BLE_STATUS_INSUFFICIENT_RESOURCES, the ACI_GATT_TX_POOL_AVAILABLE_EVENT
+ * event is generated as soon as there is at least one buffer (with a size of
+ * ATT_MTU) available in the TX pool:
+ * - ACI_GATT_UPDATE_CHAR_VALUE,
+ * - ACI_GATT_UPDATE_CHAR_VALUE_EXT,
+ * - ACI_GATT_SEND_MULT_NOTIFICATION,
+ * - ACI_GATT_WRITE_WITHOUT_RESP,
+ * - ACI_GATT_SIGNED_WRITE_WITHOUT_RESP.
+ *
+ * @param Connection_Handle Not used.
+ * @param Available_Buffers Number of buffers available.
+ * @return None
+ */
+void aci_gatt_tx_pool_available_event( uint16_t Connection_Handle,
+ uint16_t Available_Buffers );
+
+/**
+ * @brief ACI_GATT_SERVER_CONFIRMATION_EVENT
+ * This event is generated when the client has sent the confirmation to a
+ * previously sent indication
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @return None
+ */
+void aci_gatt_server_confirmation_event( uint16_t Connection_Handle );
+
+/**
+ * @brief ACI_GATT_PREPARE_WRITE_PERMIT_REQ_EVENT
+ * This event is given to the application when a prepare write request is
+ * received by the server from the client. This event will be given to the
+ * application only if the event bit for this event generation is set when the
+ * characteristic was added.
+ * When this event is received, the application has to check whether the value
+ * being requested for write can be allowed to be written and respond with the
+ * command ACI_GATT_WRITE_RESP. Based on the response from the application, the
+ * attribute value will be modified by the stack.
+ * If the write is rejected by the application, then the value of the attribute
+ * will not be modified and an error response will be sent to the client, with
+ * the error code as specified by the application.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attribute_Handle The handle of the attribute
+ * @param Offset The offset from which the prepare write has been requested
+ * @param Data_Length Length of Data field
+ * @param Data The data that the client has requested to write
+ * @return None
+ */
+void aci_gatt_prepare_write_permit_req_event( uint16_t Connection_Handle,
+ uint16_t Attribute_Handle,
+ uint16_t Offset,
+ uint8_t Data_Length,
+ const uint8_t* Data );
+
+/**
+ * @brief ACI_GATT_EATT_BEARER_EVENT
+ * This event informs the application of a change in status of the Enhanced ATT
+ * bearer handled by the specified L2CAP channel.
+ *
+ * @param Connection_Handle Connection handle for which the event applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Channel_Index Index of the connection-oriented channel for which the
+ * primitive applies.
+ * @param EAB_State Enhanced ATT bearer state.
+ * Values:
+ * - 0x00: Enhanced ATT bearer created
+ * - 0x01: Enhanced ATT bearer terminated
+ * - 0x02: Enhanced ATT bearer reconfigured
+ * @param MTU ATT_MTU value used on the bearer.
+ * Values:
+ * - 64 ... 246
+ * @return None
+ */
+void aci_gatt_eatt_bearer_event( uint16_t Connection_Handle,
+ uint8_t Channel_Index,
+ uint8_t EAB_State,
+ uint16_t MTU );
+
+/**
+ * @brief ACI_GATT_MULT_NOTIFICATION_EVENT
+ * This event is generated when a Multiple Handle Value notification is
+ * received from the server.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Offset Bits 14-0: offset in octets from which Attribute_Value data
+ * starts. Bit 15 is used as flag: when set to 1 it indicates that more
+ * data are to come (fragmented event in case of long attribute data).
+ * @param Data_Length Length of Data in bytes
+ * @param Data List of "Handle Length Value" tuples as defined in Core
+ * Specification
+ * @return None
+ */
+void aci_gatt_mult_notification_event( uint16_t Connection_Handle,
+ uint16_t Offset,
+ uint16_t Data_Length,
+ const uint8_t* Data );
+
+/**
+ * @brief ACI_GATT_NOTIFICATION_COMPLETE_EVENT
+ * This event is generated on server side after the transmission of all
+ * notifications linked with a local update of a characteristic value (if it is
+ * enabled at the creation of the characteristic with
+ * GATT_NOTIFY_NOTIFICATION_COMPLETION mask and if the characteristic supports
+ * notifications).
+ *
+ * @param Attr_Handle Handle of the updated characteristic value
+ * @return None
+ */
+void aci_gatt_notification_complete_event( uint16_t Attr_Handle );
+
+/**
+ * @brief ACI_GATT_READ_EXT_EVENT
+ * When it is enabled with ACI_GATT_SET_EVENT_MASK, this event is generated
+ * instead of ACI_ATT_READ_RESP_EVENT / ACI_ATT_READ_BLOB_RESP_EVENT /
+ * ACI_ATT_READ_MULTIPLE_RESP_EVENT.
+ * This event should be used instead of those events when ATT_MTU >
+ * (BLE_EVT_MAX_PARAM_LEN - 4) i.e. ATT_MTU > 251 for BLE_EVT_MAX_PARAM_LEN
+ * default value.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Offset Bits 14-0: offset in octets from which Attribute_Value data
+ * starts. Bit 15 is used as flag: when set to 1 it indicates that more
+ * data are to come (fragmented event in case of long attribute data).
+ * @param Event_Data_Length Length of following data
+ * @param Attribute_Value The value of the attribute(s).
+ * @return None
+ */
+void aci_gatt_read_ext_event( uint16_t Connection_Handle,
+ uint16_t Offset,
+ uint16_t Event_Data_Length,
+ const uint8_t* Attribute_Value );
+
+/**
+ * @brief ACI_GATT_INDICATION_EXT_EVENT
+ * When it is enabled with ACI_GATT_SET_EVENT_MASK and when an indication is
+ * received from the server, this event is generated instead of
+ * ACI_GATT_INDICATION_EVENT.
+ * This event should be used instead of ACI_GATT_INDICATION_EVENT when ATT_MTU
+ * > (BLE_EVT_MAX_PARAM_LEN - 4) i.e. ATT_MTU > 251 for BLE_EVT_MAX_PARAM_LEN
+ * default value.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attribute_Handle The handle of the attribute
+ * @param Offset Bits 14-0: offset in octets from which Attribute_Value data
+ * starts. Bit 15 is used as flag: when set to 1 it indicates that more
+ * data are to come (fragmented event in case of long attribute data).
+ * @param Attribute_Value_Length Length of Attribute_Value in octets
+ * @param Attribute_Value The current value of the attribute
+ * @return None
+ */
+void aci_gatt_indication_ext_event( uint16_t Connection_Handle,
+ uint16_t Attribute_Handle,
+ uint16_t Offset,
+ uint16_t Attribute_Value_Length,
+ const uint8_t* Attribute_Value );
+
+/**
+ * @brief ACI_GATT_NOTIFICATION_EXT_EVENT
+ * When it is enabled with ACI_GATT_SET_EVENT_MASK and when a notification is
+ * received from the server, this event is generated instead of
+ * ACI_GATT_NOTIFICATION_EVENT.
+ * This event should be used instead of ACI_GATT_NOTIFICATION_EVENT when
+ * ATT_MTU > (BLE_EVT_MAX_PARAM_LEN - 4) i.e. ATT_MTU > 251 for
+ * BLE_EVT_MAX_PARAM_LEN default value.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the event
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attribute_Handle The handle of the attribute
+ * @param Offset Bits 14-0: offset in octets from which Attribute_Value data
+ * starts. Bit 15 is used as flag: when set to 1 it indicates that more
+ * data are to come (fragmented event in case of long attribute data).
+ * @param Attribute_Value_Length Length of Attribute_Value in octets
+ * @param Attribute_Value The current value of the attribute
+ * @return None
+ */
+void aci_gatt_notification_ext_event( uint16_t Connection_Handle,
+ uint16_t Attribute_Handle,
+ uint16_t Offset,
+ uint16_t Attribute_Value_Length,
+ const uint8_t* Attribute_Value );
+
+/* ACI L2CAP events */
+
+/**
+ * @brief ACI_L2CAP_CONNECTION_UPDATE_RESP_EVENT
+ * This event is generated when the Central responds to the connection update
+ * request packet with a connection update response packet.
+ *
+ * @param Connection_Handle Handle of the connection where this event occurred.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Result Result field from the response packet.
+ * Values:
+ * - 0x0000: Connection Parameters accepted
+ * - 0x0001: Connection Parameters rejected
+ * @return None
+ */
+void aci_l2cap_connection_update_resp_event( uint16_t Connection_Handle,
+ uint16_t Result );
+
+/**
+ * @brief ACI_L2CAP_PROC_TIMEOUT_EVENT
+ * This event is generated when the Central does not respond to the connection
+ * update request packet with a connection update response packet or a command
+ * reject packet within 30 seconds.
+ *
+ * @param Connection_Handle Handle of the connection where this event occurred.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Data_Length Length of following data
+ * Values:
+ * - 0x00
+ * @param Data Not used
+ * @return None
+ */
+void aci_l2cap_proc_timeout_event( uint16_t Connection_Handle,
+ uint8_t Data_Length,
+ const uint8_t* Data );
+
+/**
+ * @brief ACI_L2CAP_CONNECTION_UPDATE_REQ_EVENT
+ * The event is given by the L2CAP layer when a connection update request is
+ * received from the Peripheral. The upper layer which receives this event has
+ * to respond by sending a ACI_L2CAP_CONNECTION_PARAMETER_UPDATE_RESP command.
+ *
+ * @param Connection_Handle Handle of the connection where this event occurred.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Identifier Received identifier.
+ * @param L2CAP_Length Length of the L2CAP connection update request.
+ * @param Interval_Min Minimum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Interval_Max Maximum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Latency Maximum Peripheral latency for the connection in number of
+ * connection events.
+ * Values:
+ * - 0x0000 ... 0x01F3
+ * @param Timeout_Multiplier Defines connection timeout parameter in the
+ * following manner: Timeout Multiplier * 10ms.
+ * @return None
+ */
+void aci_l2cap_connection_update_req_event( uint16_t Connection_Handle,
+ uint8_t Identifier,
+ uint16_t L2CAP_Length,
+ uint16_t Interval_Min,
+ uint16_t Interval_Max,
+ uint16_t Latency,
+ uint16_t Timeout_Multiplier );
+
+/**
+ * @brief ACI_L2CAP_COMMAND_REJECT_EVENT
+ * This event is generated upon receipt of a valid L2CAP Command Reject packet
+ * (e.g. when the Central responds to the Connection Update Request packet with
+ * a L2CAP Command Reject packet).
+ *
+ * @param Connection_Handle Handle of the connection where this event occurred.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Identifier Received identifier.
+ * @param Reason Describes why the request packet was rejected.
+ * Values:
+ * - 0x0000: Command not understood
+ * - 0x0001: Signaling MTU exceeded
+ * - 0x0002: Invalid CID in request
+ * @param Data_Length Length of following data
+ * @param Data Data field associated with Reason (see Core Specification [Vol
+ * 3, Part A, 4.1])
+ * @return None
+ */
+void aci_l2cap_command_reject_event( uint16_t Connection_Handle,
+ uint8_t Identifier,
+ uint16_t Reason,
+ uint8_t Data_Length,
+ const uint8_t* Data );
+
+/**
+ * @brief ACI_L2CAP_COC_CONNECT_EVENT
+ * This event is generated when receiving a valid Credit Based Connection
+ * Request packet.
+ * See Core Specification [Vol 3, Part A].
+ *
+ * @param Connection_Handle Handle of the connection where this event occurred.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param SPSM Simplified Protocol/Service Multiplexer.
+ * Values:
+ * - 0x0001 ... 0x00FF
+ * @param MTU Maximum Transmission Unit.
+ * Values:
+ * - 23 ... 65535
+ * - 64 ... 246: for Enhanced ATT
+ * @param MPS Maximum payload size (in octets).
+ * Values:
+ * - 23 ... 248
+ * - 64 ... 248: for Enhanced ATT
+ * @param Initial_Credits Number of K-frames that can be received on the
+ * created channel(s) by the L2CAP layer entity sending this packet.
+ * Values:
+ * - 0 ... 65535
+ * @param Channel_Number Number of channels to be created. If this parameter is
+ * set to 0, it requests the creation of one LE credit based connection-
+ * oriented channel. Otherwise, it requests the creation of one or more
+ * enhanced credit based connection-oriented channels.
+ * Values:
+ * - 0 ... 5
+ * @return None
+ */
+void aci_l2cap_coc_connect_event( uint16_t Connection_Handle,
+ uint16_t SPSM,
+ uint16_t MTU,
+ uint16_t MPS,
+ uint16_t Initial_Credits,
+ uint8_t Channel_Number );
+
+/**
+ * @brief ACI_L2CAP_COC_CONNECT_CONFIRM_EVENT
+ * This event is generated when receiving a valid Credit Based Connection
+ * Response packet.
+ * See Core Specification [Vol 3, Part A].
+ *
+ * @param Connection_Handle Handle of the connection where this event occurred.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param MTU Maximum Transmission Unit.
+ * Values:
+ * - 23 ... 65535
+ * - 64 ... 246: for Enhanced ATT
+ * @param MPS Maximum payload size (in octets).
+ * Values:
+ * - 23 ... 248
+ * - 64 ... 248: for Enhanced ATT
+ * @param Initial_Credits Number of K-frames that can be received on the
+ * created channel(s) by the L2CAP layer entity sending this packet.
+ * Values:
+ * - 0 ... 65535
+ * @param Result Indicates the outcome of the request. See Core Specification
+ * [Vol 3, Part A, Table 4.16] for LE credit based connection-oriented
+ * channels, or [Vol 3, Part A, Table 4.17] for enhanced credit based
+ * connection-oriented channels.
+ * Values:
+ * - 0x0000 ... 0x000F
+ * @param Channel_Number Number of created channels. It is the length of
+ * Channel_Index_List.
+ * Values:
+ * - 0 ... 5
+ * @param Channel_Index_List List of channel indexes for which the primitive
+ * applies.
+ * @return None
+ */
+void aci_l2cap_coc_connect_confirm_event( uint16_t Connection_Handle,
+ uint16_t MTU,
+ uint16_t MPS,
+ uint16_t Initial_Credits,
+ uint16_t Result,
+ uint8_t Channel_Number,
+ const uint8_t* Channel_Index_List );
+
+/**
+ * @brief ACI_L2CAP_COC_RECONF_EVENT
+ * This event is generated when receiving a valid Credit Based Reconfigure
+ * Request packet.
+ * See Core Specification [Vol 3, Part A].
+ *
+ * @param Connection_Handle Handle of the connection where this event occurred.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param MTU Maximum Transmission Unit.
+ * Values:
+ * - 23 ... 65535
+ * - 64 ... 246: for Enhanced ATT
+ * @param MPS Maximum payload size (in octets).
+ * Values:
+ * - 23 ... 248
+ * - 64 ... 248: for Enhanced ATT
+ * @param Channel_Number Number of created channels. It is the length of
+ * Channel_Index_List.
+ * Values:
+ * - 1 ... 5
+ * @param Channel_Index_List List of channel indexes for which the primitive
+ * applies.
+ * @return None
+ */
+void aci_l2cap_coc_reconf_event( uint16_t Connection_Handle,
+ uint16_t MTU,
+ uint16_t MPS,
+ uint8_t Channel_Number,
+ const uint8_t* Channel_Index_List );
+
+/**
+ * @brief ACI_L2CAP_COC_RECONF_CONFIRM_EVENT
+ * This event is generated when receiving a valid Credit Based Reconfigure
+ * Response packet.
+ * See Core Specification [Vol 3, Part A].
+ *
+ * @param Connection_Handle Handle of the connection where this event occurred.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Result Indicates the outcome of the request. See Core Specification
+ * [Vol 3, Part A, Table 4.18].
+ * Values:
+ * - 0x0000 ... 0x0004
+ * @return None
+ */
+void aci_l2cap_coc_reconf_confirm_event( uint16_t Connection_Handle,
+ uint16_t Result );
+
+/**
+ * @brief ACI_L2CAP_COC_DISCONNECT_EVENT
+ * This event is generated when a connection-oriented channel is disconnected
+ * following an L2CAP channel termination procedure.
+ * See Core Specification [Vol 3, Part A].
+ *
+ * @param Channel_Index Index of the connection-oriented channel for which the
+ * primitive applies.
+ * @return None
+ */
+void aci_l2cap_coc_disconnect_event( uint8_t Channel_Index );
+
+/**
+ * @brief ACI_L2CAP_COC_FLOW_CONTROL_EVENT
+ * This event is generated when receiving a valid Flow Control Credit signaling
+ * packet.
+ * See Core Specification [Vol 3, Part A].
+ *
+ * @param Channel_Index Index of the connection-oriented channel for which the
+ * primitive applies.
+ * @param Credits Number of credits the receiving device can increment,
+ * corresponding to the number of K-frames that can be sent to the peer
+ * device sending the Flow Control Credit packet.
+ * Values:
+ * - 1 ... 65535
+ * @return None
+ */
+void aci_l2cap_coc_flow_control_event( uint8_t Channel_Index,
+ uint16_t Credits );
+
+/**
+ * @brief ACI_L2CAP_COC_RX_DATA_EVENT
+ * This event is generated when receiving a valid K-frame packet on a
+ * connection-oriented channel.
+ * See Core Specification [Vol 3, Part A].
+ * Note: for the first K-frame of the SDU, the Information data contains the
+ * L2CAP SDU Length coded on two octets followed by the K-frame information
+ * payload. For the next K-frames of the SDU, the Information data only
+ * contains the K-frame information payload.
+ *
+ * @param Channel_Index Index of the connection-oriented channel for which the
+ * primitive applies.
+ * @param Length Length of Data (in octets)
+ * @param Data Information data
+ * @return None
+ */
+void aci_l2cap_coc_rx_data_event( uint8_t Channel_Index,
+ uint16_t Length,
+ const uint8_t* Data );
+
+/**
+ * @brief ACI_L2CAP_COC_TX_POOL_AVAILABLE_EVENT
+ * Each time ACI_L2CAP_COC_TX_DATA raises the error code
+ * BLE_STATUS_INSUFFICIENT_RESOURCES, the ACI_L2CAP_COC_TX_POOL_AVAILABLE_EVENT
+ * event is generated as soon as there is a free buffer available for sending
+ * K-frames.
+ *
+ * @return None
+ */
+void aci_l2cap_coc_tx_pool_available_event( void );
+
+/* ACI HAL events */
+
+/**
+ * @brief ACI_HAL_END_OF_RADIO_ACTIVITY_EVENT
+ * This event is generated when the device completes a radio activity and
+ * provide information when a new radio activity will be performed.
+ * Information provided includes type of radio activity and absolute time in
+ * system ticks when a new radio activity is schedule, if any. Application can
+ * use this information to schedule user activities synchronous to selected
+ * radio activities. A command ACI_HAL_SET_RADIO_ACTIVITY_MASK is provided to
+ * enable radio activity events of user interests, by default no events are
+ * enabled.
+ * User should take into account that enabling radio events in application with
+ * intense radio activity could lead to a fairly high rate of events generated.
+ * Application use cases includes synchronizing notification with connection
+ * interval, switching antenna at the end of advertising or performing flash
+ * erase operation while radio is idle.
+ *
+ * @param Last_State Completed radio event
+ * Values:
+ * - 0x00: Idle
+ * - 0x01: Advertising
+ * - 0x02: Peripheral connection
+ * - 0x03: Scanning
+ * - 0x05: Central connection
+ * - 0x06: TX test mode
+ * - 0x07: RX test mode
+ * @param Next_State Incoming radio event
+ * Values:
+ * - 0x00: Idle
+ * - 0x01: Advertising
+ * - 0x02: Peripheral connection
+ * - 0x03: Scanning
+ * - 0x05: Central connection
+ * - 0x06: TX test mode
+ * - 0x07: RX test mode
+ * @param Next_State_SysTime 32-bit absolute current time expressed in internal
+ * time units.
+ * @param Last_State_Slot Slot number of completed radio event.
+ * Values:
+ * - 0xFF: Idle
+ * - 0x00 ... 0x07
+ * @param Next_State_Slot Slot number of incoming radio event.
+ * Values:
+ * - 0xFF: Idle
+ * - 0x00 ... 0x07
+ * @return None
+ */
+void aci_hal_end_of_radio_activity_event( uint8_t Last_State,
+ uint8_t Next_State,
+ uint32_t Next_State_SysTime,
+ uint8_t Last_State_Slot,
+ uint8_t Next_State_Slot );
+
+/**
+ * @brief ACI_HAL_SCAN_REQ_REPORT_EVENT
+ * This event is reported to the application after a scan request is received
+ * and a scan response is scheduled to be transmitted.
+ * Note: RSSI in this event is valid only when privacy is not used.
+ *
+ * @param RSSI RSSI (signed integer).
+ * Units: dBm.
+ * Values:
+ * - 127: RSSI not available
+ * - -127 ... 20
+ * @param Peer_Address_Type Address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * - 0x02: Public Identity Address (corresponds to the Resolved Private
+ * Address)
+ * - 0x03: Random (static) Identity Address (corresponds to the Resolved
+ * Private Address)
+ * @param Peer_Address Public Device Address or Random Device Address of the
+ * peer device
+ * @return None
+ */
+void aci_hal_scan_req_report_event( uint8_t RSSI,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address );
+
+
+#endif /* BLE_EVENTS_H__ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_gap_aci.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_gap_aci.c
new file mode 100644
index 0000000..0ab1958
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_gap_aci.c
@@ -0,0 +1,1661 @@
+/*****************************************************************************
+ * @file ble_gap_aci.c
+ * @brief STM32WB BLE API (gap_aci)
+ * Auto-generated file: do not edit!
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#include "auto/ble_gap_aci.h"
+
+tBleStatus aci_gap_set_non_discoverable( void )
+{
+ struct hci_request rq;
+ tBleStatus status = 0;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x081;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_set_limited_discoverable( uint8_t Advertising_Type,
+ uint16_t Advertising_Interval_Min,
+ uint16_t Advertising_Interval_Max,
+ uint8_t Own_Address_Type,
+ uint8_t Advertising_Filter_Policy,
+ uint8_t Local_Name_Length,
+ const uint8_t* Local_Name,
+ uint8_t Service_Uuid_length,
+ const uint8_t* Service_Uuid_List,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_set_limited_discoverable_cp0 *cp0 = (aci_gap_set_limited_discoverable_cp0*)(cmd_buffer);
+ aci_gap_set_limited_discoverable_cp1 *cp1 = (aci_gap_set_limited_discoverable_cp1*)(cmd_buffer + 1 + 2 + 2 + 1 + 1 + 1 + Local_Name_Length * (sizeof(uint8_t)));
+ aci_gap_set_limited_discoverable_cp2 *cp2 = (aci_gap_set_limited_discoverable_cp2*)(cmd_buffer + 1 + 2 + 2 + 1 + 1 + 1 + Local_Name_Length * (sizeof(uint8_t)) + 1 + Service_Uuid_length * (sizeof(uint8_t)));
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Advertising_Type = Advertising_Type;
+ index_input += 1;
+ cp0->Advertising_Interval_Min = Advertising_Interval_Min;
+ index_input += 2;
+ cp0->Advertising_Interval_Max = Advertising_Interval_Max;
+ index_input += 2;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Advertising_Filter_Policy = Advertising_Filter_Policy;
+ index_input += 1;
+ cp0->Local_Name_Length = Local_Name_Length;
+ index_input += 1;
+ /* var_len_data input */
+ {
+ Osal_MemCpy( (void*)&cp0->Local_Name, (const void*)Local_Name, Local_Name_Length );
+ index_input += Local_Name_Length;
+ {
+ cp1->Service_Uuid_length = Service_Uuid_length;
+ }
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp1->Service_Uuid_List, (const void*)Service_Uuid_List, Service_Uuid_length );
+ index_input += Service_Uuid_length;
+ {
+ cp2->Conn_Interval_Min = Conn_Interval_Min;
+ }
+ index_input += 2;
+ {
+ cp2->Conn_Interval_Max = Conn_Interval_Max;
+ }
+ index_input += 2;
+ }
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x082;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_set_discoverable( uint8_t Advertising_Type,
+ uint16_t Advertising_Interval_Min,
+ uint16_t Advertising_Interval_Max,
+ uint8_t Own_Address_Type,
+ uint8_t Advertising_Filter_Policy,
+ uint8_t Local_Name_Length,
+ const uint8_t* Local_Name,
+ uint8_t Service_Uuid_length,
+ const uint8_t* Service_Uuid_List,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_set_discoverable_cp0 *cp0 = (aci_gap_set_discoverable_cp0*)(cmd_buffer);
+ aci_gap_set_discoverable_cp1 *cp1 = (aci_gap_set_discoverable_cp1*)(cmd_buffer + 1 + 2 + 2 + 1 + 1 + 1 + Local_Name_Length * (sizeof(uint8_t)));
+ aci_gap_set_discoverable_cp2 *cp2 = (aci_gap_set_discoverable_cp2*)(cmd_buffer + 1 + 2 + 2 + 1 + 1 + 1 + Local_Name_Length * (sizeof(uint8_t)) + 1 + Service_Uuid_length * (sizeof(uint8_t)));
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Advertising_Type = Advertising_Type;
+ index_input += 1;
+ cp0->Advertising_Interval_Min = Advertising_Interval_Min;
+ index_input += 2;
+ cp0->Advertising_Interval_Max = Advertising_Interval_Max;
+ index_input += 2;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Advertising_Filter_Policy = Advertising_Filter_Policy;
+ index_input += 1;
+ cp0->Local_Name_Length = Local_Name_Length;
+ index_input += 1;
+ /* var_len_data input */
+ {
+ Osal_MemCpy( (void*)&cp0->Local_Name, (const void*)Local_Name, Local_Name_Length );
+ index_input += Local_Name_Length;
+ {
+ cp1->Service_Uuid_length = Service_Uuid_length;
+ }
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp1->Service_Uuid_List, (const void*)Service_Uuid_List, Service_Uuid_length );
+ index_input += Service_Uuid_length;
+ {
+ cp2->Conn_Interval_Min = Conn_Interval_Min;
+ }
+ index_input += 2;
+ {
+ cp2->Conn_Interval_Max = Conn_Interval_Max;
+ }
+ index_input += 2;
+ }
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x083;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_set_direct_connectable( uint8_t Own_Address_Type,
+ uint8_t Directed_Advertising_Type,
+ uint8_t Direct_Address_Type,
+ const uint8_t* Direct_Address,
+ uint16_t Advertising_Interval_Min,
+ uint16_t Advertising_Interval_Max )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_set_direct_connectable_cp0 *cp0 = (aci_gap_set_direct_connectable_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Directed_Advertising_Type = Directed_Advertising_Type;
+ index_input += 1;
+ cp0->Direct_Address_Type = Direct_Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Direct_Address, (const void*)Direct_Address, 6 );
+ index_input += 6;
+ cp0->Advertising_Interval_Min = Advertising_Interval_Min;
+ index_input += 2;
+ cp0->Advertising_Interval_Max = Advertising_Interval_Max;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x084;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_set_io_capability( uint8_t IO_Capability )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_set_io_capability_cp0 *cp0 = (aci_gap_set_io_capability_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->IO_Capability = IO_Capability;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x085;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_set_authentication_requirement( uint8_t Bonding_Mode,
+ uint8_t MITM_Mode,
+ uint8_t SC_Support,
+ uint8_t KeyPress_Notification_Support,
+ uint8_t Min_Encryption_Key_Size,
+ uint8_t Max_Encryption_Key_Size,
+ uint8_t Use_Fixed_Pin,
+ uint32_t Fixed_Pin,
+ uint8_t Identity_Address_Type )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_set_authentication_requirement_cp0 *cp0 = (aci_gap_set_authentication_requirement_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Bonding_Mode = Bonding_Mode;
+ index_input += 1;
+ cp0->MITM_Mode = MITM_Mode;
+ index_input += 1;
+ cp0->SC_Support = SC_Support;
+ index_input += 1;
+ cp0->KeyPress_Notification_Support = KeyPress_Notification_Support;
+ index_input += 1;
+ cp0->Min_Encryption_Key_Size = Min_Encryption_Key_Size;
+ index_input += 1;
+ cp0->Max_Encryption_Key_Size = Max_Encryption_Key_Size;
+ index_input += 1;
+ cp0->Use_Fixed_Pin = Use_Fixed_Pin;
+ index_input += 1;
+ cp0->Fixed_Pin = Fixed_Pin;
+ index_input += 4;
+ cp0->Identity_Address_Type = Identity_Address_Type;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x086;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_set_authorization_requirement( uint16_t Connection_Handle,
+ uint8_t Authorization_Enable )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_set_authorization_requirement_cp0 *cp0 = (aci_gap_set_authorization_requirement_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Authorization_Enable = Authorization_Enable;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x087;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_pass_key_resp( uint16_t Connection_Handle,
+ uint32_t Pass_Key )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_pass_key_resp_cp0 *cp0 = (aci_gap_pass_key_resp_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Pass_Key = Pass_Key;
+ index_input += 4;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x088;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_authorization_resp( uint16_t Connection_Handle,
+ uint8_t Authorize )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_authorization_resp_cp0 *cp0 = (aci_gap_authorization_resp_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Authorize = Authorize;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x089;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_init( uint8_t Role,
+ uint8_t privacy_enabled,
+ uint8_t device_name_char_len,
+ uint16_t* Service_Handle,
+ uint16_t* Dev_Name_Char_Handle,
+ uint16_t* Appearance_Char_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_init_cp0 *cp0 = (aci_gap_init_cp0*)(cmd_buffer);
+ aci_gap_init_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Role = Role;
+ index_input += 1;
+ cp0->privacy_enabled = privacy_enabled;
+ index_input += 1;
+ cp0->device_name_char_len = device_name_char_len;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x08a;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Service_Handle = resp.Service_Handle;
+ *Dev_Name_Char_Handle = resp.Dev_Name_Char_Handle;
+ *Appearance_Char_Handle = resp.Appearance_Char_Handle;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_gap_set_non_connectable( uint8_t Advertising_Event_Type,
+ uint8_t Own_Address_Type )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_set_non_connectable_cp0 *cp0 = (aci_gap_set_non_connectable_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Advertising_Event_Type = Advertising_Event_Type;
+ index_input += 1;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x08b;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_set_undirected_connectable( uint16_t Advertising_Interval_Min,
+ uint16_t Advertising_Interval_Max,
+ uint8_t Own_Address_Type,
+ uint8_t Adv_Filter_Policy )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_set_undirected_connectable_cp0 *cp0 = (aci_gap_set_undirected_connectable_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Advertising_Interval_Min = Advertising_Interval_Min;
+ index_input += 2;
+ cp0->Advertising_Interval_Max = Advertising_Interval_Max;
+ index_input += 2;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Adv_Filter_Policy = Adv_Filter_Policy;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x08c;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_peripheral_security_req( uint16_t Connection_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_peripheral_security_req_cp0 *cp0 = (aci_gap_peripheral_security_req_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x08d;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_update_adv_data( uint8_t AdvDataLen,
+ const uint8_t* AdvData )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_update_adv_data_cp0 *cp0 = (aci_gap_update_adv_data_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->AdvDataLen = AdvDataLen;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->AdvData, (const void*)AdvData, AdvDataLen );
+ index_input += AdvDataLen;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x08e;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_delete_ad_type( uint8_t ADType )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_delete_ad_type_cp0 *cp0 = (aci_gap_delete_ad_type_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->ADType = ADType;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x08f;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_get_security_level( uint16_t Connection_Handle,
+ uint8_t* Security_Mode,
+ uint8_t* Security_Level )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_get_security_level_cp0 *cp0 = (aci_gap_get_security_level_cp0*)(cmd_buffer);
+ aci_gap_get_security_level_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x090;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Security_Mode = resp.Security_Mode;
+ *Security_Level = resp.Security_Level;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_gap_set_event_mask( uint16_t GAP_Evt_Mask )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_set_event_mask_cp0 *cp0 = (aci_gap_set_event_mask_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->GAP_Evt_Mask = GAP_Evt_Mask;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x091;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_configure_filter_accept_list( void )
+{
+ struct hci_request rq;
+ tBleStatus status = 0;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x092;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_terminate( uint16_t Connection_Handle,
+ uint8_t Reason )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_terminate_cp0 *cp0 = (aci_gap_terminate_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Reason = Reason;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x093;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_clear_security_db( void )
+{
+ struct hci_request rq;
+ tBleStatus status = 0;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x094;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_allow_rebond( uint16_t Connection_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_allow_rebond_cp0 *cp0 = (aci_gap_allow_rebond_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x095;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_start_limited_discovery_proc( uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t Own_Address_Type,
+ uint8_t Filter_Duplicates )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_start_limited_discovery_proc_cp0 *cp0 = (aci_gap_start_limited_discovery_proc_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->LE_Scan_Interval = LE_Scan_Interval;
+ index_input += 2;
+ cp0->LE_Scan_Window = LE_Scan_Window;
+ index_input += 2;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Filter_Duplicates = Filter_Duplicates;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x096;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_start_general_discovery_proc( uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t Own_Address_Type,
+ uint8_t Filter_Duplicates )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_start_general_discovery_proc_cp0 *cp0 = (aci_gap_start_general_discovery_proc_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->LE_Scan_Interval = LE_Scan_Interval;
+ index_input += 2;
+ cp0->LE_Scan_Window = LE_Scan_Window;
+ index_input += 2;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Filter_Duplicates = Filter_Duplicates;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x097;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_start_auto_connection_establish_proc( uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t Own_Address_Type,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max,
+ uint16_t Conn_Latency,
+ uint16_t Supervision_Timeout,
+ uint16_t Minimum_CE_Length,
+ uint16_t Maximum_CE_Length,
+ uint8_t Num_of_Peer_Entries,
+ const Peer_Entry_t* Peer_Entry )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_start_auto_connection_establish_proc_cp0 *cp0 = (aci_gap_start_auto_connection_establish_proc_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->LE_Scan_Interval = LE_Scan_Interval;
+ index_input += 2;
+ cp0->LE_Scan_Window = LE_Scan_Window;
+ index_input += 2;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Conn_Interval_Min = Conn_Interval_Min;
+ index_input += 2;
+ cp0->Conn_Interval_Max = Conn_Interval_Max;
+ index_input += 2;
+ cp0->Conn_Latency = Conn_Latency;
+ index_input += 2;
+ cp0->Supervision_Timeout = Supervision_Timeout;
+ index_input += 2;
+ cp0->Minimum_CE_Length = Minimum_CE_Length;
+ index_input += 2;
+ cp0->Maximum_CE_Length = Maximum_CE_Length;
+ index_input += 2;
+ cp0->Num_of_Peer_Entries = Num_of_Peer_Entries;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Peer_Entry, (const void*)Peer_Entry, Num_of_Peer_Entries * (sizeof(Peer_Entry_t)) );
+ index_input += Num_of_Peer_Entries * (sizeof(Peer_Entry_t));
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x099;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_start_general_connection_establish_proc( uint8_t LE_Scan_Type,
+ uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t Own_Address_Type,
+ uint8_t Scanning_Filter_Policy,
+ uint8_t Filter_Duplicates )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_start_general_connection_establish_proc_cp0 *cp0 = (aci_gap_start_general_connection_establish_proc_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->LE_Scan_Type = LE_Scan_Type;
+ index_input += 1;
+ cp0->LE_Scan_Interval = LE_Scan_Interval;
+ index_input += 2;
+ cp0->LE_Scan_Window = LE_Scan_Window;
+ index_input += 2;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Scanning_Filter_Policy = Scanning_Filter_Policy;
+ index_input += 1;
+ cp0->Filter_Duplicates = Filter_Duplicates;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x09a;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_start_selective_connection_establish_proc( uint8_t LE_Scan_Type,
+ uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t Own_Address_Type,
+ uint8_t Scanning_Filter_Policy,
+ uint8_t Filter_Duplicates,
+ uint8_t Num_of_Peer_Entries,
+ const Peer_Entry_t* Peer_Entry )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_start_selective_connection_establish_proc_cp0 *cp0 = (aci_gap_start_selective_connection_establish_proc_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->LE_Scan_Type = LE_Scan_Type;
+ index_input += 1;
+ cp0->LE_Scan_Interval = LE_Scan_Interval;
+ index_input += 2;
+ cp0->LE_Scan_Window = LE_Scan_Window;
+ index_input += 2;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Scanning_Filter_Policy = Scanning_Filter_Policy;
+ index_input += 1;
+ cp0->Filter_Duplicates = Filter_Duplicates;
+ index_input += 1;
+ cp0->Num_of_Peer_Entries = Num_of_Peer_Entries;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Peer_Entry, (const void*)Peer_Entry, Num_of_Peer_Entries * (sizeof(Peer_Entry_t)) );
+ index_input += Num_of_Peer_Entries * (sizeof(Peer_Entry_t));
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x09b;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_create_connection( uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint8_t Own_Address_Type,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max,
+ uint16_t Conn_Latency,
+ uint16_t Supervision_Timeout,
+ uint16_t Minimum_CE_Length,
+ uint16_t Maximum_CE_Length )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_create_connection_cp0 *cp0 = (aci_gap_create_connection_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->LE_Scan_Interval = LE_Scan_Interval;
+ index_input += 2;
+ cp0->LE_Scan_Window = LE_Scan_Window;
+ index_input += 2;
+ cp0->Peer_Address_Type = Peer_Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Peer_Address, (const void*)Peer_Address, 6 );
+ index_input += 6;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Conn_Interval_Min = Conn_Interval_Min;
+ index_input += 2;
+ cp0->Conn_Interval_Max = Conn_Interval_Max;
+ index_input += 2;
+ cp0->Conn_Latency = Conn_Latency;
+ index_input += 2;
+ cp0->Supervision_Timeout = Supervision_Timeout;
+ index_input += 2;
+ cp0->Minimum_CE_Length = Minimum_CE_Length;
+ index_input += 2;
+ cp0->Maximum_CE_Length = Maximum_CE_Length;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x09c;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_terminate_gap_proc( uint8_t Procedure_Code )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_terminate_gap_proc_cp0 *cp0 = (aci_gap_terminate_gap_proc_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Procedure_Code = Procedure_Code;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x09d;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_start_connection_update( uint16_t Connection_Handle,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max,
+ uint16_t Conn_Latency,
+ uint16_t Supervision_Timeout,
+ uint16_t Minimum_CE_Length,
+ uint16_t Maximum_CE_Length )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_start_connection_update_cp0 *cp0 = (aci_gap_start_connection_update_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Conn_Interval_Min = Conn_Interval_Min;
+ index_input += 2;
+ cp0->Conn_Interval_Max = Conn_Interval_Max;
+ index_input += 2;
+ cp0->Conn_Latency = Conn_Latency;
+ index_input += 2;
+ cp0->Supervision_Timeout = Supervision_Timeout;
+ index_input += 2;
+ cp0->Minimum_CE_Length = Minimum_CE_Length;
+ index_input += 2;
+ cp0->Maximum_CE_Length = Maximum_CE_Length;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x09e;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_send_pairing_req( uint16_t Connection_Handle,
+ uint8_t Force_Rebond )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_send_pairing_req_cp0 *cp0 = (aci_gap_send_pairing_req_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Force_Rebond = Force_Rebond;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x09f;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_set_broadcast_mode( uint16_t Advertising_Interval_Min,
+ uint16_t Advertising_Interval_Max,
+ uint8_t Advertising_Type,
+ uint8_t Own_Address_Type,
+ uint8_t Adv_Data_Length,
+ const uint8_t* Adv_Data,
+ uint8_t Num_of_Peer_Entries,
+ const Peer_Entry_t* Peer_Entry )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_set_broadcast_mode_cp0 *cp0 = (aci_gap_set_broadcast_mode_cp0*)(cmd_buffer);
+ aci_gap_set_broadcast_mode_cp1 *cp1 = (aci_gap_set_broadcast_mode_cp1*)(cmd_buffer + 2 + 2 + 1 + 1 + 1 + Adv_Data_Length * (sizeof(uint8_t)));
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Advertising_Interval_Min = Advertising_Interval_Min;
+ index_input += 2;
+ cp0->Advertising_Interval_Max = Advertising_Interval_Max;
+ index_input += 2;
+ cp0->Advertising_Type = Advertising_Type;
+ index_input += 1;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Adv_Data_Length = Adv_Data_Length;
+ index_input += 1;
+ /* var_len_data input */
+ {
+ Osal_MemCpy( (void*)&cp0->Adv_Data, (const void*)Adv_Data, Adv_Data_Length );
+ index_input += Adv_Data_Length;
+ {
+ cp1->Num_of_Peer_Entries = Num_of_Peer_Entries;
+ }
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp1->Peer_Entry, (const void*)Peer_Entry, Num_of_Peer_Entries * (sizeof(Peer_Entry_t)) );
+ index_input += Num_of_Peer_Entries * (sizeof(Peer_Entry_t));
+ }
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0a1;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_start_observation_proc( uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t LE_Scan_Type,
+ uint8_t Own_Address_Type,
+ uint8_t Filter_Duplicates,
+ uint8_t Scanning_Filter_Policy )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_start_observation_proc_cp0 *cp0 = (aci_gap_start_observation_proc_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->LE_Scan_Interval = LE_Scan_Interval;
+ index_input += 2;
+ cp0->LE_Scan_Window = LE_Scan_Window;
+ index_input += 2;
+ cp0->LE_Scan_Type = LE_Scan_Type;
+ index_input += 1;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Filter_Duplicates = Filter_Duplicates;
+ index_input += 1;
+ cp0->Scanning_Filter_Policy = Scanning_Filter_Policy;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0a2;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_get_bonded_devices( uint8_t* Num_of_Addresses,
+ Bonded_Device_Entry_t* Bonded_Device_Entry )
+{
+ struct hci_request rq;
+ aci_gap_get_bonded_devices_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0a3;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Num_of_Addresses = resp.Num_of_Addresses;
+ Osal_MemCpy( (void*)Bonded_Device_Entry, (const void*)resp.Bonded_Device_Entry, *Num_of_Addresses * (sizeof(Bonded_Device_Entry_t)) );
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_gap_check_bonded_device( uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint8_t* Id_Address_Type,
+ uint8_t* Id_Address )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_check_bonded_device_cp0 *cp0 = (aci_gap_check_bonded_device_cp0*)(cmd_buffer);
+ aci_gap_check_bonded_device_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Peer_Address_Type = Peer_Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Peer_Address, (const void*)Peer_Address, 6 );
+ index_input += 6;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0a4;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Id_Address_Type = resp.Id_Address_Type;
+ Osal_MemCpy( (void*)Id_Address, (const void*)resp.Id_Address, 6 );
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_gap_numeric_comparison_value_confirm_yesno( uint16_t Connection_Handle,
+ uint8_t Confirm_Yes_No )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_numeric_comparison_value_confirm_yesno_cp0 *cp0 = (aci_gap_numeric_comparison_value_confirm_yesno_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Confirm_Yes_No = Confirm_Yes_No;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0a5;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_passkey_input( uint16_t Connection_Handle,
+ uint8_t Input_Type )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_passkey_input_cp0 *cp0 = (aci_gap_passkey_input_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Input_Type = Input_Type;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0a6;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_get_oob_data( uint8_t OOB_Data_Type,
+ uint8_t* Address_Type,
+ uint8_t* Address,
+ uint8_t* OOB_Data_Len,
+ uint8_t* OOB_Data )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_get_oob_data_cp0 *cp0 = (aci_gap_get_oob_data_cp0*)(cmd_buffer);
+ aci_gap_get_oob_data_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->OOB_Data_Type = OOB_Data_Type;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0a7;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Address_Type = resp.Address_Type;
+ Osal_MemCpy( (void*)Address, (const void*)resp.Address, 6 );
+ *OOB_Data_Len = resp.OOB_Data_Len;
+ Osal_MemCpy( (void*)OOB_Data, (const void*)resp.OOB_Data, 16 );
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_gap_set_oob_data( uint8_t Device_Type,
+ uint8_t Address_Type,
+ const uint8_t* Address,
+ uint8_t OOB_Data_Type,
+ uint8_t OOB_Data_Len,
+ const uint8_t* OOB_Data )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_set_oob_data_cp0 *cp0 = (aci_gap_set_oob_data_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Device_Type = Device_Type;
+ index_input += 1;
+ cp0->Address_Type = Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Address, (const void*)Address, 6 );
+ index_input += 6;
+ cp0->OOB_Data_Type = OOB_Data_Type;
+ index_input += 1;
+ cp0->OOB_Data_Len = OOB_Data_Len;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->OOB_Data, (const void*)OOB_Data, 16 );
+ index_input += 16;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0a8;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_remove_bonded_device( uint8_t Peer_Identity_Address_Type,
+ const uint8_t* Peer_Identity_Address )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_remove_bonded_device_cp0 *cp0 = (aci_gap_remove_bonded_device_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Peer_Identity_Address_Type = Peer_Identity_Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Peer_Identity_Address, (const void*)Peer_Identity_Address, 6 );
+ index_input += 6;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0aa;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_add_devices_to_list( uint8_t Num_of_List_Entries,
+ const List_Entry_t* List_Entry,
+ uint8_t Mode )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_add_devices_to_list_cp0 *cp0 = (aci_gap_add_devices_to_list_cp0*)(cmd_buffer);
+ aci_gap_add_devices_to_list_cp1 *cp1 = (aci_gap_add_devices_to_list_cp1*)(cmd_buffer + 1 + Num_of_List_Entries * (sizeof(List_Entry_t)));
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Num_of_List_Entries = Num_of_List_Entries;
+ index_input += 1;
+ /* var_len_data input */
+ {
+ Osal_MemCpy( (void*)&cp0->List_Entry, (const void*)List_Entry, Num_of_List_Entries * (sizeof(List_Entry_t)) );
+ index_input += Num_of_List_Entries * (sizeof(List_Entry_t));
+ {
+ cp1->Mode = Mode;
+ }
+ index_input += 1;
+ }
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0ab;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_pairing_request_reply( uint16_t Connection_Handle,
+ uint8_t Accept )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_pairing_request_reply_cp0 *cp0 = (aci_gap_pairing_request_reply_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Accept = Accept;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0ad;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_additional_beacon_start( uint16_t Adv_Interval_Min,
+ uint16_t Adv_Interval_Max,
+ uint8_t Adv_Channel_Map,
+ uint8_t Own_Address_Type,
+ const uint8_t* Own_Address,
+ uint8_t PA_Level )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_additional_beacon_start_cp0 *cp0 = (aci_gap_additional_beacon_start_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Adv_Interval_Min = Adv_Interval_Min;
+ index_input += 2;
+ cp0->Adv_Interval_Max = Adv_Interval_Max;
+ index_input += 2;
+ cp0->Adv_Channel_Map = Adv_Channel_Map;
+ index_input += 1;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Own_Address, (const void*)Own_Address, 6 );
+ index_input += 6;
+ cp0->PA_Level = PA_Level;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0b0;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_additional_beacon_stop( void )
+{
+ struct hci_request rq;
+ tBleStatus status = 0;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0b1;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_additional_beacon_set_data( uint8_t Adv_Data_Length,
+ const uint8_t* Adv_Data )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_additional_beacon_set_data_cp0 *cp0 = (aci_gap_additional_beacon_set_data_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Adv_Data_Length = Adv_Data_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Adv_Data, (const void*)Adv_Data, Adv_Data_Length );
+ index_input += Adv_Data_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0b2;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_adv_set_configuration( uint8_t Adv_Mode,
+ uint8_t Advertising_Handle,
+ uint16_t Adv_Event_Properties,
+ uint32_t Primary_Adv_Interval_Min,
+ uint32_t Primary_Adv_Interval_Max,
+ uint8_t Primary_Adv_Channel_Map,
+ uint8_t Own_Address_Type,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint8_t Adv_Filter_Policy,
+ uint8_t Adv_TX_Power,
+ uint8_t Secondary_Adv_Max_Skip,
+ uint8_t Secondary_Adv_PHY,
+ uint8_t Adv_SID,
+ uint8_t Scan_Req_Notification_Enable )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_adv_set_configuration_cp0 *cp0 = (aci_gap_adv_set_configuration_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Adv_Mode = Adv_Mode;
+ index_input += 1;
+ cp0->Advertising_Handle = Advertising_Handle;
+ index_input += 1;
+ cp0->Adv_Event_Properties = Adv_Event_Properties;
+ index_input += 2;
+ cp0->Primary_Adv_Interval_Min = Primary_Adv_Interval_Min;
+ index_input += 4;
+ cp0->Primary_Adv_Interval_Max = Primary_Adv_Interval_Max;
+ index_input += 4;
+ cp0->Primary_Adv_Channel_Map = Primary_Adv_Channel_Map;
+ index_input += 1;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Peer_Address_Type = Peer_Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Peer_Address, (const void*)Peer_Address, 6 );
+ index_input += 6;
+ cp0->Adv_Filter_Policy = Adv_Filter_Policy;
+ index_input += 1;
+ cp0->Adv_TX_Power = Adv_TX_Power;
+ index_input += 1;
+ cp0->Secondary_Adv_Max_Skip = Secondary_Adv_Max_Skip;
+ index_input += 1;
+ cp0->Secondary_Adv_PHY = Secondary_Adv_PHY;
+ index_input += 1;
+ cp0->Adv_SID = Adv_SID;
+ index_input += 1;
+ cp0->Scan_Req_Notification_Enable = Scan_Req_Notification_Enable;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0c0;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_adv_set_enable( uint8_t Enable,
+ uint8_t Num_Sets,
+ const Adv_Set_t* Adv_Set )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_adv_set_enable_cp0 *cp0 = (aci_gap_adv_set_enable_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Enable = Enable;
+ index_input += 1;
+ cp0->Num_Sets = Num_Sets;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Adv_Set, (const void*)Adv_Set, Num_Sets * (sizeof(Adv_Set_t)) );
+ index_input += Num_Sets * (sizeof(Adv_Set_t));
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0c1;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_adv_set_adv_data( uint8_t Advertising_Handle,
+ uint8_t Operation,
+ uint8_t Fragment_Preference,
+ uint8_t Advertising_Data_Length,
+ const uint8_t* Advertising_Data )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_adv_set_adv_data_cp0 *cp0 = (aci_gap_adv_set_adv_data_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Advertising_Handle = Advertising_Handle;
+ index_input += 1;
+ cp0->Operation = Operation;
+ index_input += 1;
+ cp0->Fragment_Preference = Fragment_Preference;
+ index_input += 1;
+ cp0->Advertising_Data_Length = Advertising_Data_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Advertising_Data, (const void*)Advertising_Data, Advertising_Data_Length );
+ index_input += Advertising_Data_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0c2;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_adv_set_scan_resp_data( uint8_t Advertising_Handle,
+ uint8_t Operation,
+ uint8_t Fragment_Preference,
+ uint8_t Scan_Response_Data_Length,
+ const uint8_t* Scan_Response_Data )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_adv_set_scan_resp_data_cp0 *cp0 = (aci_gap_adv_set_scan_resp_data_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Advertising_Handle = Advertising_Handle;
+ index_input += 1;
+ cp0->Operation = Operation;
+ index_input += 1;
+ cp0->Fragment_Preference = Fragment_Preference;
+ index_input += 1;
+ cp0->Scan_Response_Data_Length = Scan_Response_Data_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Scan_Response_Data, (const void*)Scan_Response_Data, Scan_Response_Data_Length );
+ index_input += Scan_Response_Data_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0c3;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_adv_remove_set( uint8_t Advertising_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_adv_remove_set_cp0 *cp0 = (aci_gap_adv_remove_set_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Advertising_Handle = Advertising_Handle;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0c4;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_adv_clear_sets( void )
+{
+ struct hci_request rq;
+ tBleStatus status = 0;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0c5;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_adv_set_random_address( uint8_t Advertising_Handle,
+ const uint8_t* Random_Address )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_adv_set_random_address_cp0 *cp0 = (aci_gap_adv_set_random_address_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Advertising_Handle = Advertising_Handle;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Random_Address, (const void*)Random_Address, 6 );
+ index_input += 6;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0c6;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_ext_start_scan( uint8_t Scan_Mode,
+ uint8_t Procedure,
+ uint8_t Own_Address_Type,
+ uint8_t Filter_Duplicates,
+ uint16_t Duration,
+ uint16_t Period,
+ uint8_t Scanning_Filter_Policy,
+ uint8_t Scanning_PHYs,
+ const Scan_Param_Phy_t* Scan_Param_Phy )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_ext_start_scan_cp0 *cp0 = (aci_gap_ext_start_scan_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Scan_Mode = Scan_Mode;
+ index_input += 1;
+ cp0->Procedure = Procedure;
+ index_input += 1;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Filter_Duplicates = Filter_Duplicates;
+ index_input += 1;
+ cp0->Duration = Duration;
+ index_input += 2;
+ cp0->Period = Period;
+ index_input += 2;
+ cp0->Scanning_Filter_Policy = Scanning_Filter_Policy;
+ index_input += 1;
+ cp0->Scanning_PHYs = Scanning_PHYs;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Scan_Param_Phy, (const void*)Scan_Param_Phy, 10 );
+ index_input += 10;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0d0;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gap_ext_create_connection( uint8_t Initiating_Mode,
+ uint8_t Procedure,
+ uint8_t Own_Address_Type,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint8_t Advertising_Handle,
+ uint8_t Subevent,
+ uint8_t Initiator_Filter_Policy,
+ uint8_t Initiating_PHYs,
+ const Init_Param_Phy_t* Init_Param_Phy )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gap_ext_create_connection_cp0 *cp0 = (aci_gap_ext_create_connection_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Initiating_Mode = Initiating_Mode;
+ index_input += 1;
+ cp0->Procedure = Procedure;
+ index_input += 1;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Peer_Address_Type = Peer_Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Peer_Address, (const void*)Peer_Address, 6 );
+ index_input += 6;
+ cp0->Advertising_Handle = Advertising_Handle;
+ index_input += 1;
+ cp0->Subevent = Subevent;
+ index_input += 1;
+ cp0->Initiator_Filter_Policy = Initiator_Filter_Policy;
+ index_input += 1;
+ cp0->Initiating_PHYs = Initiating_PHYs;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Init_Param_Phy, (const void*)Init_Param_Phy, 48 );
+ index_input += 48;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x0d1;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_gap_aci.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_gap_aci.h
new file mode 100644
index 0000000..76a451e
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_gap_aci.h
@@ -0,0 +1,1931 @@
+/*****************************************************************************
+ * @file ble_gap_aci.h
+ * @brief STM32WB BLE API (GAP_ACI)
+ * Auto-generated file: do not edit!
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#ifndef BLE_GAP_ACI_H__
+#define BLE_GAP_ACI_H__
+
+
+#include "auto/ble_types.h"
+
+/**
+ * @brief ACI_GAP_SET_NON_DISCOVERABLE
+ * This command stops advertising.
+ * Note: this command only supports legacy advertising. For extended
+ * advertising, refer to ACI_GAP_ADV_SET_ENABLE.
+ *
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_set_non_discoverable( void );
+
+/**
+ * @brief ACI_GAP_SET_LIMITED_DISCOVERABLE
+ * Puts the device in limited discoverable mode (as defined in Core
+ * Specification [Vol 3, Part C, 9.2.3]). The device will be discoverable for
+ * maximum period of TGAP (lim_adv_timeout) = 180 seconds (from errata). The
+ * advertising can be disabled at any time by issuing
+ * ACI_GAP_SET_NON_DISCOVERABLE command.
+ * The Adv_Interval_Min and Adv_Interval_Max parameters are optional. If both
+ * are set to 0, the GAP will use default values for adv intervals for limited
+ * discoverable mode (250 ms and 500 ms respectively).
+ * To allow a fast connection, the host can set Local_Name, Service_Uuid_List,
+ * Conn_Interval_Min and Conn_Interval_Max. If provided, these data will be
+ * inserted into the advertising packet payload as AD data. These parameters
+ * are optional in this command. These values can be set in advertised data
+ * using ACI_GAP_UPDATE_ADV_DATA command separately.
+ * The total size of data in advertising packet cannot exceed 31 bytes.
+ * With this command, the BLE Stack will also add automatically the following
+ * standard AD types:
+ * - AD Flags
+ * - Power Level
+ * When advertising timeout happens (i.e. limited discovery period has
+ * elapsed), controller generates ACI_GAP_LIMITED_DISCOVERABLE_EVENT event.
+ * Note: this command only supports legacy advertising For extended
+ * advertising, refer to ACI_GAP_ADV_SET_CONFIGURATION and
+ * ACI_GAP_ADV_SET_ENABLE..
+ *
+ * @param Advertising_Type Advertising type
+ * Values:
+ * - 0x00: ADV_IND (Connectable undirected advertising)
+ * - 0x02: ADV_SCAN_IND (Scannable undirected advertising)
+ * - 0x03: ADV_NONCONN_IND (Non connectable undirected advertising)
+ * @param Advertising_Interval_Min Minimum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
+ * @param Advertising_Interval_Max Maximum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
+ * @param Own_Address_Type Own address type: if Privacy is disabled, the
+ * address can be public or static random; otherwise, it can be a
+ * resolvable private address or a non-resolvable private address.
+ * Values:
+ * - 0x00: Public address
+ * - 0x01: Static random address
+ * - 0x02: Resolvable private address
+ * - 0x03: Non-resolvable private address
+ * @param Advertising_Filter_Policy Advertising filter policy: not applicable
+ * (the value of Advertising_Filter_Policy parameter is not used inside
+ * the Stack)
+ * @param Local_Name_Length Length of the local_name field in octets.
+ * If length is set to 0x00, Local_Name parameter is not used.
+ * @param Local_Name Local name of the device. First byte must be 0x08 for
+ * Shortened Local Name or 0x09 for Complete Local Name. No NULL
+ * character at the end.
+ * @param Service_Uuid_length Length of the Service Uuid List in octets.
+ * If there is no service to be advertised, set this field to 0x00.
+ * @param Service_Uuid_List This is the list of the UUIDs as defined in Volume
+ * 3, Section 11 of GAP Specification. First byte is the AD Type.
+ * @param Conn_Interval_Min Connection interval minimum value suggested by
+ * Peripheral.
+ * If Conn_Interval_Min and Conn_Interval_Max are not 0x0000, Peripheral
+ * Connection Interval Range AD structure will be added in advertising
+ * data.
+ * Connection interval is defined in the following manner:
+ * connIntervalmin = Conn_Interval_Min x 1.25ms.
+ * Values:
+ * - 0x0000 (NaN)
+ * - 0xFFFF (NaN) : No specific minimum
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Interval_Max Connection interval maximum value suggested by
+ * Peripheral.
+ * If Conn_Interval_Min and Conn_Interval_Max are not 0x0000, Peripheral
+ * Connection Interval Range AD structure will be added in advertising
+ * data.
+ * Connection interval is defined in the following manner:
+ * connIntervalmax = Conn_Interval_Max x 1.25ms
+ * Values:
+ * - 0x0000 (NaN)
+ * - 0xFFFF (NaN) : No specific maximum
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_set_limited_discoverable( uint8_t Advertising_Type,
+ uint16_t Advertising_Interval_Min,
+ uint16_t Advertising_Interval_Max,
+ uint8_t Own_Address_Type,
+ uint8_t Advertising_Filter_Policy,
+ uint8_t Local_Name_Length,
+ const uint8_t* Local_Name,
+ uint8_t Service_Uuid_length,
+ const uint8_t* Service_Uuid_List,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max );
+
+/**
+ * @brief ACI_GAP_SET_DISCOVERABLE
+ * Puts the device in general discoverable mode (as defined in Core
+ * Specification [Vol 3, Part C, 9.2.4]). The device will be discoverable until
+ * the host issues the ACI_GAP_SET_NON_DISCOVERABLE command. The
+ * Adv_Interval_Min and Adv_Interval_Max parameters are optional. If both are
+ * set to 0, the GAP uses the default values for adv intervals for general
+ * discoverable mode.
+ * When using connectable undirected advertising events:
+ * - Adv_Interval_Min = 30 ms
+ * - Adv_Interval_Max = 60 ms
+ * When using non-connectable advertising events or scannable undirected
+ * advertising events:
+ * - Adv_Interval_Min = 100 ms
+ * - Adv_Interval_Max = 150 ms
+ * Host can set the Local Name, a Service UUID list and the Peripheral
+ * Connection Interval Range.
+ * If provided, these data will be inserted into the advertising packet payload
+ * as AD data.
+ * These parameters are optional in this command. These values can be also set
+ * using ACI_GAP_UPDATE_ADV_DATA command separately.
+ * The total size of data in advertising packet cannot exceed 31 bytes.
+ * With this command, the BLE Stack will also add automatically the following
+ * standard AD types:
+ * - AD Flags
+ * - TX Power Level
+ * Note: this command only supports legacy advertising. For extended
+ * advertising, refer to ACI_GAP_ADV_SET_CONFIGURATION and
+ * ACI_GAP_ADV_SET_ENABLE.
+ *
+ * @param Advertising_Type Advertising type
+ * Values:
+ * - 0x00: ADV_IND (Connectable undirected advertising)
+ * - 0x02: ADV_SCAN_IND (Scannable undirected advertising)
+ * - 0x03: ADV_NONCONN_IND (Non connectable undirected advertising)
+ * @param Advertising_Interval_Min Minimum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
+ * @param Advertising_Interval_Max Maximum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
+ * @param Own_Address_Type Own address type: if Privacy is disabled, the
+ * address can be public or static random; otherwise, it can be a
+ * resolvable private address or a non-resolvable private address.
+ * Values:
+ * - 0x00: Public address
+ * - 0x01: Static random address
+ * - 0x02: Resolvable private address
+ * - 0x03: Non-resolvable private address
+ * @param Advertising_Filter_Policy Advertising filter policy: not applicable
+ * (the value of Advertising_Filter_Policy parameter is not used inside
+ * the Stack)
+ * @param Local_Name_Length Length of the local_name field in octets.
+ * If length is set to 0x00, Local_Name parameter is not used.
+ * @param Local_Name Local name of the device. First byte must be 0x08 for
+ * Shortened Local Name or 0x09 for Complete Local Name. No NULL
+ * character at the end.
+ * @param Service_Uuid_length Length of the Service Uuid List in octets.
+ * If there is no service to be advertised, set this field to 0x00.
+ * @param Service_Uuid_List This is the list of the UUIDs as defined in Volume
+ * 3, Section 11 of GAP Specification. First byte is the AD Type.
+ * @param Conn_Interval_Min Connection interval minimum value suggested by
+ * Peripheral.
+ * If Conn_Interval_Min and Conn_Interval_Max are not 0x0000, Peripheral
+ * Connection Interval Range AD structure will be added in advertising
+ * data.
+ * Connection interval is defined in the following manner:
+ * connIntervalmin = Conn_Interval_Min x 1.25ms.
+ * Values:
+ * - 0x0000 (NaN)
+ * - 0xFFFF (NaN) : No specific minimum
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Interval_Max Connection interval maximum value suggested by
+ * Peripheral.
+ * If Conn_Interval_Min and Conn_Interval_Max are not 0x0000, Peripheral
+ * Connection Interval Range AD structure will be added in advertising
+ * data.
+ * Connection interval is defined in the following manner:
+ * connIntervalmax = Conn_Interval_Max x 1.25ms
+ * Values:
+ * - 0x0000 (NaN)
+ * - 0xFFFF (NaN) : No specific maximum
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_set_discoverable( uint8_t Advertising_Type,
+ uint16_t Advertising_Interval_Min,
+ uint16_t Advertising_Interval_Max,
+ uint8_t Own_Address_Type,
+ uint8_t Advertising_Filter_Policy,
+ uint8_t Local_Name_Length,
+ const uint8_t* Local_Name,
+ uint8_t Service_Uuid_length,
+ const uint8_t* Service_Uuid_List,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max );
+
+/**
+ * @brief ACI_GAP_SET_DIRECT_CONNECTABLE
+ * Sets the device in directed connectable mode (as defined in Core
+ * Specification [Vol 3, Part C, 9.3.3]). In this mode, the device advertises
+ * using high duty cycle connectable directed advertising events or low duty
+ * cycle connectable directed advertising events.
+ * The device's own address used in advertising packets is defined by the
+ * Own_Address_Type parameter depending on whether privacy is enabled or not.
+ * When using high duty cycle connectable directed advertising events, the
+ * device stays in directed connectable mode only for 1.28 seconds. If no
+ * connection is established within this duration, the device enters non
+ * discoverable mode and advertising has to be again enabled explicitly.
+ * The controller generates a HCI_LE_CONNECTION_COMPLETE_EVENT event with the
+ * status set to HCI_ADVERTISING_TIMEOUT_ERR_CODE if the connection was not
+ * established and BLE_STATUS_SUCCESS (0x00) if the connection was successfully
+ * established.
+ * Note: this command only supports legacy advertising. For extended
+ * advertising, refer to ACI_GAP_ADV_SET_CONFIGURATION and
+ * ACI_GAP_ADV_SET_ENABLE.
+ *
+ * @param Own_Address_Type Own address type: if Privacy is disabled, the
+ * address can be public or static random; otherwise, it can be a
+ * resolvable private address.
+ * Values:
+ * - 0x00: Public address
+ * - 0x01: Static random address
+ * - 0x02: Resolvable private address
+ * @param Directed_Advertising_Type Advertising type
+ * Values:
+ * - 0x01: High Duty Cycle Directed Advertising
+ * - 0x04: Low Duty Cycle Directed Advertising
+ * @param Direct_Address_Type The address type of the peer device.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * @param Direct_Address Initiator address
+ * @param Advertising_Interval_Min Minimum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0006 (3.750 ms) : for High Duty Cycle Directed Advertising
+ * - 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms) : for Low Duty Cycle
+ * Directed Advertising
+ * @param Advertising_Interval_Max Maximum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0006 (3.750 ms) : for High Duty Cycle Directed Advertising
+ * - 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms) : for Low Duty Cycle
+ * Directed Advertising
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_set_direct_connectable( uint8_t Own_Address_Type,
+ uint8_t Directed_Advertising_Type,
+ uint8_t Direct_Address_Type,
+ const uint8_t* Direct_Address,
+ uint16_t Advertising_Interval_Min,
+ uint16_t Advertising_Interval_Max );
+
+/**
+ * @brief ACI_GAP_SET_IO_CAPABILITY
+ * Sets the IO capabilities of the device. This command has to be given only
+ * when the device is not in a connected state.
+ *
+ * @param IO_Capability IO capability of the device.
+ * Values:
+ * - 0x00: IO_CAP_DISPLAY_ONLY
+ * - 0x01: IO_CAP_DISPLAY_YES_NO
+ * - 0x02: IO_CAP_KEYBOARD_ONLY
+ * - 0x03: IO_CAP_NO_INPUT_NO_OUTPUT
+ * - 0x04: IO_CAP_KEYBOARD_DISPLAY
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_set_io_capability( uint8_t IO_Capability );
+
+/**
+ * @brief ACI_GAP_SET_AUTHENTICATION_REQUIREMENT
+ * Sets the authentication requirements for the device. This command has to be
+ * given only when the device is not in a connected state.
+ *
+ * @param Bonding_Mode Bonding mode.
+ * Only if bonding is enabled (0x01), the bonding information is stored
+ * in flash
+ * Values:
+ * - 0x00: No-bonding mode
+ * - 0x01: Bonding mode
+ * @param MITM_Mode MITM mode.
+ * Values:
+ * - 0x00: MITM protection not required
+ * - 0x01: MITM protection required
+ * @param SC_Support LE Secure connections support
+ * Values:
+ * - 0x00: Secure Connections Pairing not supported
+ * - 0x01: Secure Connections Pairing supported but optional
+ * - 0x02: Secure Connections Pairing supported and mandatory (SC Only
+ * Mode)
+ * @param KeyPress_Notification_Support Keypress notification support
+ * Values:
+ * - 0x00: Keypress notification not supported
+ * - 0x01: Keypress notification supported
+ * @param Min_Encryption_Key_Size Minimum encryption key size to be used during
+ * pairing.
+ * @param Max_Encryption_Key_Size Maximum encryption key size to be used during
+ * pairing.
+ * @param Use_Fixed_Pin Use or not fixed pin. If set to 0x00, then during the
+ * pairing process the application will not be requested for a pin
+ * (Fixed_Pin will be used).
+ * If set to 0x01, then during pairing process if a passkey is required
+ * the application will be notified
+ * Values:
+ * - 0x00: use a fixed pin
+ * - 0x01: do not use a fixed pin
+ * @param Fixed_Pin Fixed pin to be used during pairing if MITM protection is
+ * enabled.
+ * Any random value between 0 to 999999
+ * Values:
+ * - 0 ... 999999
+ * @param Identity_Address_Type Identity address type
+ * Values:
+ * - 0x00: Public Identity Address
+ * - 0x01: Random (static) Identity Address
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_set_authentication_requirement( uint8_t Bonding_Mode,
+ uint8_t MITM_Mode,
+ uint8_t SC_Support,
+ uint8_t KeyPress_Notification_Support,
+ uint8_t Min_Encryption_Key_Size,
+ uint8_t Max_Encryption_Key_Size,
+ uint8_t Use_Fixed_Pin,
+ uint32_t Fixed_Pin,
+ uint8_t Identity_Address_Type );
+
+/**
+ * @brief ACI_GAP_SET_AUTHORIZATION_REQUIREMENT
+ * Sets the authorization requirements of the device. This command has to be
+ * given when connected to a device if authorization is required to access
+ * services which require authorization.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Authorization_Enable Enable the authorization in the device and when
+ * a remote device tries to read/write a characteristic with
+ * authorization requirements, the stack will send back an error
+ * response with "Insufficient authorization" error code. After pairing
+ * is complete an ACI_GAP_AUTHORIZATION_REQ_EVENT will be sent to the
+ * Host.
+ * Values:
+ * - 0x00: Authorization not required
+ * - 0x01: Authorization required
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_set_authorization_requirement( uint16_t Connection_Handle,
+ uint8_t Authorization_Enable );
+
+/**
+ * @brief ACI_GAP_PASS_KEY_RESP
+ * This command should be sent by the host in response to
+ * ACI_GAP_PASS_KEY_REQ_EVENT event. The command parameter contains the pass
+ * key which will be used during the pairing process.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Pass_Key Pass key that will be used during the pairing process.
+ * Must be a six-digit decimal number.
+ * Values:
+ * - 0 ... 999999
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_pass_key_resp( uint16_t Connection_Handle,
+ uint32_t Pass_Key );
+
+/**
+ * @brief ACI_GAP_AUTHORIZATION_RESP
+ * Authorizes a device to access attributes. This command should be sent by the
+ * host in response to ACI_GAP_AUTHORIZATION_REQ_EVENT event.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Authorize Authorization response.
+ * Values:
+ * - 0x01: Authorize
+ * - 0x02: Reject
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_authorization_resp( uint16_t Connection_Handle,
+ uint8_t Authorize );
+
+/**
+ * @brief ACI_GAP_INIT
+ * Initializes the GAP layer. Register the GAP service with the GATT.
+ * All the standard GAP characteristics will also be added:
+ * - Device Name
+ * - Appearance
+ * - Peripheral Preferred Connection Parameters (peripheral role only).
+ * Note that if the Peripheral Preferred Connection Parameters characteristic
+ * is added, its handle is equal to the Appearance characteristic handle plus
+ * 2.
+ * Note also that if privacy is enabled, this command automatically unmasks the
+ * HCI_LE_ENHANCED_CONNECTION_COMPLETE_EVENT event.
+ *
+ * @param Role Bitmap of allowed roles.
+ * Flags:
+ * - 0x01: Peripheral
+ * - 0x02: Broadcaster
+ * - 0x04: Central
+ * - 0x08: Observer
+ * @param privacy_enabled This parameter specifies if Privacy is enabled or
+ * not. N.B.: only Controller Privacy is supported.
+ * Values:
+ * - 0x00: Privacy disabled
+ * - 0x02: Privacy enabled
+ * @param device_name_char_len Length of the device name characteristic
+ * @param[out] Service_Handle Handle of the GAP service
+ * @param[out] Dev_Name_Char_Handle Device Name Characteristic handle
+ * @param[out] Appearance_Char_Handle Appearance Characteristic handle
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_init( uint8_t Role,
+ uint8_t privacy_enabled,
+ uint8_t device_name_char_len,
+ uint16_t* Service_Handle,
+ uint16_t* Dev_Name_Char_Handle,
+ uint16_t* Appearance_Char_Handle );
+
+/**
+ * @brief ACI_GAP_SET_NON_CONNECTABLE
+ * This command starts advertising in non connectable mode (i.e., this mode
+ * does not support connection).
+ * Advertiser filter policy is internally set to 0 (i.e., the Filter Accept
+ * List is not in use).
+ * Note: this command only supports legacy advertising. For extended
+ * advertising, refer to ACI_GAP_ADV_SET_CONFIGURATION and
+ * ACI_GAP_ADV_SET_ENABLE.
+ *
+ * @param Advertising_Event_Type Advertising type
+ * Values:
+ * - 0x02: ADV_SCAN_IND (Scannable undirected advertising)
+ * - 0x03: ADV_NONCONN_IND (Non connectable undirected advertising)
+ * @param Own_Address_Type Own address type: if Privacy is disabled, the
+ * address can be public or static random; otherwise, it can be a
+ * resolvable private address or a non-resolvable private address.
+ * Values:
+ * - 0x00: Public address
+ * - 0x01: Static random address
+ * - 0x02: Resolvable private address
+ * - 0x03: Non-resolvable private address
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_set_non_connectable( uint8_t Advertising_Event_Type,
+ uint8_t Own_Address_Type );
+
+/**
+ * @brief ACI_GAP_SET_UNDIRECTED_CONNECTABLE
+ * This command starts advertising in undirected connectable mode.
+ * If privacy is enabled in the device, a resolvable private address is
+ * generated and used as the advertiser's address. If not, the address of the
+ * type specified in Own_Address_Type is used for advertising.
+ * Note: this command only supports legacy advertising. For extended
+ * advertising, refer to ACI_GAP_ADV_SET_CONFIGURATION and
+ * ACI_GAP_ADV_SET_ENABLE.
+ *
+ * @param Advertising_Interval_Min Minimum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
+ * @param Advertising_Interval_Max Maximum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
+ * @param Own_Address_Type Own address type: if Privacy is disabled, the
+ * address can be public or static random; otherwise, it can be a
+ * resolvable private address.
+ * Values:
+ * - 0x00: Public address
+ * - 0x01: Static random address
+ * - 0x02: Resolvable private address
+ * @param Adv_Filter_Policy Advertising filter policy.
+ * Values:
+ * - 0x00: Allow Scan Request from Any, Allow Connect Request from Any
+ * - 0x03: Allow Scan Request from Filter Accept List Only, Allow
+ * Connect Request from Filter Accept List Only
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_set_undirected_connectable( uint16_t Advertising_Interval_Min,
+ uint16_t Advertising_Interval_Max,
+ uint8_t Own_Address_Type,
+ uint8_t Adv_Filter_Policy );
+
+/**
+ * @brief ACI_GAP_PERIPHERAL_SECURITY_REQ
+ * Sends a Peripheral Security Request to the Central.
+ * This command has to be issued to notify the Central of the security
+ * requirements of the Peripheral. The Central may encrypt the link, initiate
+ * the pairing procedure, or reject the request.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_peripheral_security_req( uint16_t Connection_Handle );
+
+/**
+ * @brief ACI_GAP_UPDATE_ADV_DATA
+ * This command can be used to update the advertising data for particular AD
+ * types. The data argument shall consist of valid advertising data composed of
+ * one or more AD types. If one of the specified AD types does not exist in the
+ * current advertising data, then it is added to the advertising data; while
+ * the AD types already present in the current advertising data are updated
+ * with the new values. If the overall advertising data length is more than 31
+ * octets after the update, then the command is rejected and the old data is
+ * retained.
+ * Note: this command only supports legacy advertising. For extended
+ * advertising, refer to ACI_GAP_ADV_SET_ADV_DATA.
+ *
+ * @param AdvDataLen Length of AdvData in octets
+ * @param AdvData Advertising data used by the device while advertising.
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_update_adv_data( uint8_t AdvDataLen,
+ const uint8_t* AdvData );
+
+/**
+ * @brief ACI_GAP_DELETE_AD_TYPE
+ * This command can be used to delete the specified AD type from the
+ * advertisement data if present.
+ * Note: this command only supports legacy advertising. For extended
+ * advertising, refer to ACI_GAP_ADV_SET_ADV_DATA.
+ *
+ * @param ADType One of the AD types as in Core Specification [Vol 3, Part C,
+ * 11].
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_delete_ad_type( uint8_t ADType );
+
+/**
+ * @brief ACI_GAP_GET_SECURITY_LEVEL
+ * This command can be used to get the current security settings of the device.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param[out] Security_Mode Security mode.
+ * Values:
+ * - 0x01: Security Mode 1
+ * @param[out] Security_Level Security Level.
+ * Values:
+ * - 0x01: Security Level 1
+ * - 0x02: Security Level 2
+ * - 0x03: Security Level 3
+ * - 0x04: Security Level 4
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_get_security_level( uint16_t Connection_Handle,
+ uint8_t* Security_Mode,
+ uint8_t* Security_Level );
+
+/**
+ * @brief ACI_GAP_SET_EVENT_MASK
+ * It allows masking events from the GAP. If the bit in the GAP_Evt_Mask is set
+ * to a one, then the event associated with that bit will be enabled.
+ *
+ * @param GAP_Evt_Mask ACI GAP/L2CAP event mask. Default: 0xFFFF.
+ * Flags:
+ * - 0x0000: No events
+ * - 0x0001: ACI_GAP_LIMITED_DISCOVERABLE_EVENT
+ * - 0x0002: ACI_GAP_PAIRING_COMPLETE_EVENT
+ * - 0x0004: ACI_GAP_PASS_KEY_REQ_EVENT
+ * - 0x0008: ACI_GAP_AUTHORIZATION_REQ_EVENT
+ * - 0x0020: ACI_GAP_BOND_LOST_EVENT
+ * - 0x0080: ACI_GAP_PROC_COMPLETE_EVENT
+ * - 0x0100: ACI_L2CAP_CONNECTION_UPDATE_REQ_EVENT
+ * - 0x0200: ACI_L2CAP_CONNECTION_UPDATE_RESP_EVENT
+ * - 0x0400: ACI_L2CAP_PROC_TIMEOUT_EVENT
+ * - 0x0800: ACI_GAP_ADDR_NOT_RESOLVED_EVENT
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_set_event_mask( uint16_t GAP_Evt_Mask );
+
+/**
+ * @brief ACI_GAP_CONFIGURE_FILTER_ACCEPT_LIST
+ * This command adds addresses of bonded devices into the controller's Filter
+ * Accept List, which is cleared first. It returns an error if it was unable to
+ * add all bonded devices into the Filter Accept List.
+ * This command shall not be used when the device is advertising, scanning or
+ * initiating with a filter policy using the Filter Accept List.
+ *
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_configure_filter_accept_list( void );
+
+/**
+ * @brief ACI_GAP_TERMINATE
+ * Commands the controller to terminate the connection. A
+ * HCI_DISCONNECTION_COMPLETE_EVENT event is generated when the link is
+ * disconnected.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Reason The reason for ending the connection.
+ * Values:
+ * - 0x05: Authentication Failure
+ * - 0x13: Remote User Terminated Connection
+ * - 0x14: Remote Device Terminated Connection due to Low Resources
+ * - 0x15: Remote Device Terminated Connection due to Power Off
+ * - 0x1A: Unsupported Remote Feature
+ * - 0x3B: Unacceptable Connection Parameters
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_terminate( uint16_t Connection_Handle,
+ uint8_t Reason );
+
+/**
+ * @brief ACI_GAP_CLEAR_SECURITY_DB
+ * Clears the bonding table. All the devices in the bonding table are removed.
+ * See also ACI_GAP_REMOVE_BONDED_DEVICE to remove only one device.
+ * Note: as a fallback mode, in case the bonding table is full, the BLE stack
+ * automatically clears the bonding table just before putting into it
+ * information about a new bonded device.
+ *
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_clear_security_db( void );
+
+/**
+ * @brief ACI_GAP_ALLOW_REBOND
+ * Allows the security manager to complete the pairing procedure and re-bond
+ * with the Central. This command should be given by the application when it
+ * receives the ACI_GAP_BOND_LOST_EVENT if it wants the re-bonding to happen
+ * successfully. If this command is not given on receiving the event, the
+ * bonding procedure will timeout.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_allow_rebond( uint16_t Connection_Handle );
+
+/**
+ * @brief ACI_GAP_START_LIMITED_DISCOVERY_PROC
+ * Starts the limited discovery procedure. The controller is commanded to start
+ * active scanning.
+ * When this procedure is started, only the devices in limited discoverable
+ * mode are returned to the upper layers.
+ * The procedure is terminated when either the upper layers issue a command to
+ * terminate the procedure by issuing the command ACI_GAP_TERMINATE_GAP_PROC
+ * with the procedure code set to 0x01 or a timeout happens (the timeout value
+ * is fixed at 10.24 s.). When the procedure is terminated due to any of the
+ * above reasons, ACI_GAP_PROC_COMPLETE_EVENT event is returned with the
+ * procedure code set to 0x01.
+ * The device found when the procedure is ongoing is returned to the upper
+ * layers through the event HCI_LE_ADVERTISING_REPORT_EVENT (or via
+ * HCI_LE_EXTENDED_ADVERTISING_REPORT_EVENT when the extended advertising
+ * feature is supported).
+ *
+ * @param LE_Scan_Interval This is defined as the time interval from when the
+ * Controller started its last LE scan until it begins the subsequent LE
+ * scan.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
+ * @param LE_Scan_Window Amount of time for the duration of the LE scan.
+ * LE_Scan_Window shall be less than or equal to LE_Scan_Interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
+ * @param Own_Address_Type Own address type: if Privacy is disabled, the
+ * address can be public or static random; otherwise, it can be a
+ * resolvable private address or a non-resolvable private address.
+ * Values:
+ * - 0x00: Public address
+ * - 0x01: Static random address
+ * - 0x02: Resolvable private address
+ * - 0x03: Non-resolvable private address
+ * @param Filter_Duplicates Enable/disable duplicate filtering.
+ * Values:
+ * - 0x00: Duplicate filtering disabled
+ * - 0x01: Duplicate filtering enabled
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_start_limited_discovery_proc( uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t Own_Address_Type,
+ uint8_t Filter_Duplicates );
+
+/**
+ * @brief ACI_GAP_START_GENERAL_DISCOVERY_PROC
+ * Starts the general discovery procedure. The controller is commanded to start
+ * active scanning. The procedure is terminated when either the upper layers
+ * issue a command to terminate the procedure by issuing the command
+ * ACI_GAP_TERMINATE_GAP_PROC with the procedure code set to 0x02 or a timeout
+ * happens (the timeout value is fixed at 10.24 s.). When the procedure is
+ * terminated due to any of the above reasons, ACI_GAP_PROC_COMPLETE_EVENT
+ * event is returned with the procedure code set to 0x02.
+ * The devices found when the procedure is ongoing are returned via
+ * HCI_LE_ADVERTISING_REPORT_EVENT (or via
+ * HCI_LE_EXTENDED_ADVERTISING_REPORT_EVENT when the extended advertising
+ * feature is supported).
+ *
+ * @param LE_Scan_Interval This is defined as the time interval from when the
+ * Controller started its last LE scan until it begins the subsequent LE
+ * scan.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
+ * @param LE_Scan_Window Amount of time for the duration of the LE scan.
+ * LE_Scan_Window shall be less than or equal to LE_Scan_Interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
+ * @param Own_Address_Type Own address type: if Privacy is disabled, the
+ * address can be public or static random; otherwise, it can be a
+ * resolvable private address or a non-resolvable private address.
+ * Values:
+ * - 0x00: Public address
+ * - 0x01: Static random address
+ * - 0x02: Resolvable private address
+ * - 0x03: Non-resolvable private address
+ * @param Filter_Duplicates Enable/disable duplicate filtering.
+ * Values:
+ * - 0x00: Duplicate filtering disabled
+ * - 0x01: Duplicate filtering enabled
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_start_general_discovery_proc( uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t Own_Address_Type,
+ uint8_t Filter_Duplicates );
+
+/**
+ * @brief ACI_GAP_START_AUTO_CONNECTION_ESTABLISH_PROC
+ * Starts the auto connection establishment procedure. The devices specified
+ * are added to the Filter Accept List of the controller and a
+ * LE_Create_Connection call will be made to the controller by GAP with the
+ * initiator filter policy set to "Filter Accept List is used to determine
+ * which advertiser to connect to". When a command is issued to terminate the
+ * procedure by upper layer, a LE_Create_Connection_Cancel call will be made to
+ * the controller by GAP.
+ * The procedure is terminated when either a connection is successfully
+ * established with one of the specified devices in the Filter Accept List or
+ * the procedure is explicitly terminated by issuing the command
+ * ACI_GAP_TERMINATE_GAP_PROC with the procedure code set to 0x08. A
+ * ACI_GAP_PROC_COMPLETE_EVENT event is returned with the procedure code set to
+ * 0x08.
+ * If privacy is enabled and the peer device (advertiser) is in the resolving
+ * list then the link layer generates a RPA.
+ *
+ * @param LE_Scan_Interval This is defined as the time interval from when the
+ * Controller started its last LE scan until it begins the subsequent LE
+ * scan.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms) : legacy advertising
+ * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : extended advertising
+ * @param LE_Scan_Window Amount of time for the duration of the LE scan.
+ * LE_Scan_Window shall be less than or equal to LE_Scan_Interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms) : legacy advertising
+ * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : extended advertising
+ * @param Own_Address_Type Own address type: if Privacy is disabled, the
+ * address can be public or static random; otherwise, it can be a
+ * resolvable private address.
+ * Values:
+ * - 0x00: Public address
+ * - 0x01: Static random address
+ * - 0x02: Resolvable private address
+ * @param Conn_Interval_Min Minimum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Interval_Max Maximum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Latency Maximum Peripheral latency for the connection in number
+ * of connection events.
+ * Values:
+ * - 0x0000 ... 0x01F3
+ * @param Supervision_Timeout Supervision timeout for the LE Link.
+ * It shall be a multiple of 10 ms and larger than (1 +
+ * connPeripheralLatency) * connInterval * 2.
+ * Time = N * 10 ms.
+ * Values:
+ * - 0x000A (100 ms) ... 0x0C80 (32000 ms)
+ * @param Minimum_CE_Length Information parameter about the minimum length of
+ * connection needed for this LE connection.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
+ * @param Maximum_CE_Length Information parameter about the maximum length of
+ * connection needed for this LE connection.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
+ * @param Num_of_Peer_Entries Number of devices that have to be added to the
+ * Filter Accept List. Each device is defined by Peer_Address_Type and
+ * Peer_Address.
+ * @param Peer_Entry See @ref Peer_Entry_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_start_auto_connection_establish_proc( uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t Own_Address_Type,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max,
+ uint16_t Conn_Latency,
+ uint16_t Supervision_Timeout,
+ uint16_t Minimum_CE_Length,
+ uint16_t Maximum_CE_Length,
+ uint8_t Num_of_Peer_Entries,
+ const Peer_Entry_t* Peer_Entry );
+
+/**
+ * @brief ACI_GAP_START_GENERAL_CONNECTION_ESTABLISH_PROC
+ * Starts a general connection establishment procedure. The host enables
+ * scanning in the controller with the scanner filter policy set to "accept all
+ * advertising packets" and from the scanning results, all the devices are sent
+ * to the upper layer by the event HCI_LE_ADVERTISING_REPORT_EVENT (or by the
+ * event HCI_LE_EXTENDED_ADVERTISING_REPORT_EVENT when the extended advertising
+ * feature is supported). The upper layer then has to select one of the devices
+ * to which it wants to connect by issuing the command
+ * ACI_GAP_CREATE_CONNECTION. If privacy is enabled, then either a private
+ * resolvable address or a non-resolvable address, based on the address type
+ * specified in the command is set as the scanner address but the gap create
+ * connection always uses a private resolvable address if the general
+ * connection establishment procedure is active.
+ * Before the call to ACI_GAP_CREATE_CONNECTION, the procedure can be
+ * terminated by issuing the command ACI_GAP_TERMINATE_GAP_PROC with the
+ * procedure code set to 0x10.
+ * After the call to ACI_GAP_CREATE_CONNECTION, the procedure is terminated
+ * when a connection is established, or the upper layer terminates the
+ * procedure by issuing the command ACI_GAP_TERMINATE_GAP_PROC with the
+ * procedure code set to 0x40. On completion of the procedure a
+ * ACI_GAP_PROC_COMPLETE_EVENT event is generated with the procedure code set
+ * to 0x40.
+ * If privacy is enabled and the peer device (advertiser) is in the resolving
+ * list then the link layer generates a RPA.
+ *
+ * @param LE_Scan_Type Passive or active scanning. With passive scanning, no
+ * scan request PDUs are sent.
+ * Values:
+ * - 0x00: Passive scanning
+ * - 0x01: Active scanning
+ * @param LE_Scan_Interval This is defined as the time interval from when the
+ * Controller started its last LE scan until it begins the subsequent LE
+ * scan.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms) : legacy advertising
+ * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : extended advertising
+ * @param LE_Scan_Window Amount of time for the duration of the LE scan.
+ * LE_Scan_Window shall be less than or equal to LE_Scan_Interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms) : legacy advertising
+ * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : extended advertising
+ * @param Own_Address_Type Own address type: if Privacy is disabled, the
+ * address can be public or static random; otherwise, it can be a
+ * resolvable private address or a non-resolvable private address.
+ * Values:
+ * - 0x00: Public address
+ * - 0x01: Static random address
+ * - 0x02: Resolvable private address
+ * - 0x03: Non-resolvable private address
+ * @param Scanning_Filter_Policy The scanning filter policy determines how the
+ * scanner's Link Layer processes advertising and scan response PDUs.
+ * There is a choice of two primary filter policies: unfiltered and
+ * filtered.
+ * Unfiltered: the Link Layer processes all advertising and scan
+ * response PDUs (i.e., the Filter Accept List is not used).
+ * Filtered: the Link Layer processes advertising and scan response PDUs
+ * only from devices in the Filter Accept List.
+ * With extended scanning filter policies, a directed advertising PDU
+ * accepted by the primary filter policy shall nevertheless be ignored
+ * unless either the TargetA field is identical to the scanner's device
+ * address, or TargetA field is a resolvable private address.
+ * Values:
+ * - 0x00: Basic unfiltered scanning filter policy
+ * - 0x01: Basic filtered scanning filter policy
+ * - 0x02: Extended unfiltered scanning filter policy
+ * - 0x03: Extended filtered scanning filter policy
+ * @param Filter_Duplicates Enable/disable duplicate filtering.
+ * Values:
+ * - 0x00: Duplicate filtering disabled
+ * - 0x01: Duplicate filtering enabled
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_start_general_connection_establish_proc( uint8_t LE_Scan_Type,
+ uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t Own_Address_Type,
+ uint8_t Scanning_Filter_Policy,
+ uint8_t Filter_Duplicates );
+
+/**
+ * @brief ACI_GAP_START_SELECTIVE_CONNECTION_ESTABLISH_PROC
+ * Starts a selective connection establishment procedure. The GAP adds the
+ * specified device addresses into Filter Accept List and enables scanning in
+ * the controller with a scanning filter policy that should be set to
+ * "filtered". All the devices found are sent to the upper layer by the event
+ * HCI_LE_ADVERTISING_REPORT_EVENT (or by the event
+ * HCI_LE_EXTENDED_ADVERTISING_REPORT_EVENT when the extended advertising
+ * feature is supported). The upper layer then has to select one of the devices
+ * to which it wants to connect by issuing the command
+ * ACI_GAP_CREATE_CONNECTION.
+ * Before the call to ACI_GAP_CREATE_CONNECTION, the procedure can be
+ * terminated by issuing the command ACI_GAP_TERMINATE_GAP_PROC with the
+ * procedure code set to 0x20.
+ * After the call to ACI_GAP_CREATE_CONNECTION, the procedure is terminated
+ * when a connection is established, or the upper layer terminates the
+ * procedure by issuing the command ACI_GAP_TERMINATE_GAP_PROC with the
+ * procedure code set to 0x40. On completion of the procedure a
+ * ACI_GAP_PROC_COMPLETE_EVENT event is generated with the procedure code set
+ * to 0x40.
+ * If privacy is enabled and the peer device (advertiser) is in the resolving
+ * list then the link layer generates a RPA.
+ *
+ * @param LE_Scan_Type Passive or active scanning. With passive scanning, no
+ * scan request PDUs are sent.
+ * Values:
+ * - 0x00: Passive scanning
+ * - 0x01: Active scanning
+ * @param LE_Scan_Interval This is defined as the time interval from when the
+ * Controller started its last LE scan until it begins the subsequent LE
+ * scan.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms) : legacy advertising
+ * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : extended advertising
+ * @param LE_Scan_Window Amount of time for the duration of the LE scan.
+ * LE_Scan_Window shall be less than or equal to LE_Scan_Interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms) : legacy advertising
+ * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : extended advertising
+ * @param Own_Address_Type Own address type: if Privacy is disabled, the
+ * address can be public or static random; otherwise, it can be a
+ * resolvable private address or a non-resolvable private address.
+ * Values:
+ * - 0x00: Public address
+ * - 0x01: Static random address
+ * - 0x02: Resolvable private address
+ * - 0x03: Non-resolvable private address
+ * @param Scanning_Filter_Policy The scanning filter policy determines how the
+ * scanner's Link Layer processes advertising and scan response PDUs.
+ * There is a choice of two primary filter policies: unfiltered and
+ * filtered.
+ * Unfiltered: the Link Layer processes all advertising and scan
+ * response PDUs (i.e., the Filter Accept List is not used).
+ * Filtered: the Link Layer processes advertising and scan response PDUs
+ * only from devices in the Filter Accept List.
+ * With extended scanning filter policies, a directed advertising PDU
+ * accepted by the primary filter policy shall nevertheless be ignored
+ * unless either the TargetA field is identical to the scanner's device
+ * address, or TargetA field is a resolvable private address.
+ * Values:
+ * - 0x00: Basic unfiltered scanning filter policy
+ * - 0x01: Basic filtered scanning filter policy
+ * - 0x02: Extended unfiltered scanning filter policy
+ * - 0x03: Extended filtered scanning filter policy
+ * @param Filter_Duplicates Enable/disable duplicate filtering.
+ * Values:
+ * - 0x00: Duplicate filtering disabled
+ * - 0x01: Duplicate filtering enabled
+ * @param Num_of_Peer_Entries Number of devices that have to be added to the
+ * Filter Accept List. Each device is defined by Peer_Address_Type and
+ * Peer_Address.
+ * @param Peer_Entry See @ref Peer_Entry_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_start_selective_connection_establish_proc( uint8_t LE_Scan_Type,
+ uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t Own_Address_Type,
+ uint8_t Scanning_Filter_Policy,
+ uint8_t Filter_Duplicates,
+ uint8_t Num_of_Peer_Entries,
+ const Peer_Entry_t* Peer_Entry );
+
+/**
+ * @brief ACI_GAP_CREATE_CONNECTION
+ * Starts the direct connection establishment procedure. A LE_Create_Connection
+ * call will be made to the controller by GAP with the initiator filter policy
+ * set to "Filter Accept List is not used to determine which advertiser to
+ * connect to". The procedure can be terminated explicitly by the upper layer
+ * by issuing the command ACI_GAP_TERMINATE_GAP_PROC. When a command is issued
+ * to terminate the procedure by upper layer, a HCI_LE_CREATE_CONNECTION_CANCEL
+ * call will be made to the controller by GAP.
+ * On termination of the procedure, a HCI_LE_CONNECTION_COMPLETE_EVENT (or
+ * HCI_LE_ENHANCED_CONNECTION_COMPLETE_EVENT if privacy or extended advertising
+ * is used) is returned. The procedure can be explicitly terminated by the
+ * upper layer by issuing the command ACI_GAP_TERMINATE_GAP_PROC with the
+ * Procedure_Code set to 0x40.
+ * If privacy is enabled and the peer device (advertiser) is in the resolving
+ * list then the link layer generates a RPA.
+ *
+ * @param LE_Scan_Interval This is defined as the time interval from when the
+ * Controller started its last LE scan until it begins the subsequent LE
+ * scan.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms) : legacy advertising
+ * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : extended advertising
+ * @param LE_Scan_Window Amount of time for the duration of the LE scan.
+ * LE_Scan_Window shall be less than or equal to LE_Scan_Interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms) : legacy advertising
+ * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : extended advertising
+ * @param Peer_Address_Type The address type of the peer device.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * @param Peer_Address Public Device Address or Random Device Address of the
+ * device to be connected.
+ * @param Own_Address_Type Own address type: if Privacy is disabled, the
+ * address can be public or static random; otherwise, it can be a
+ * resolvable private address.
+ * Values:
+ * - 0x00: Public address
+ * - 0x01: Static random address
+ * - 0x02: Resolvable private address
+ * @param Conn_Interval_Min Minimum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Interval_Max Maximum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Latency Maximum Peripheral latency for the connection in number
+ * of connection events.
+ * Values:
+ * - 0x0000 ... 0x01F3
+ * @param Supervision_Timeout Supervision timeout for the LE Link.
+ * It shall be a multiple of 10 ms and larger than (1 +
+ * connPeripheralLatency) * connInterval * 2.
+ * Time = N * 10 ms.
+ * Values:
+ * - 0x000A (100 ms) ... 0x0C80 (32000 ms)
+ * @param Minimum_CE_Length Information parameter about the minimum length of
+ * connection needed for this LE connection.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
+ * @param Maximum_CE_Length Information parameter about the maximum length of
+ * connection needed for this LE connection.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_create_connection( uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint8_t Own_Address_Type,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max,
+ uint16_t Conn_Latency,
+ uint16_t Supervision_Timeout,
+ uint16_t Minimum_CE_Length,
+ uint16_t Maximum_CE_Length );
+
+/**
+ * @brief ACI_GAP_TERMINATE_GAP_PROC
+ * Terminates the specified GAP procedure. An ACI_GAP_PROC_COMPLETE_EVENT event
+ * is returned with the procedure code set to the corresponding procedure.
+ * Note: in case of GAP procedure started with ACI_GAP_CREATE_CONNECTION or
+ * ACI_GAP_START_AUTO_CONNECTION_ESTABLISH_PROC, a
+ * HCI_LE_CREATE_CONNECTION_CANCEL is issued to the Controller.
+ *
+ * @param Procedure_Code GAP procedure bitmap.
+ * Values:
+ * - 0x00: No events
+ * - 0x01: GAP_LIMITED_DISCOVERY_PROC
+ * - 0x02: GAP_GENERAL_DISCOVERY_PROC
+ * - 0x08: GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC
+ * - 0x10: GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC
+ * - 0x20: GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC
+ * - 0x40: GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC
+ * - 0x80: GAP_OBSERVATION_PROC
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_terminate_gap_proc( uint8_t Procedure_Code );
+
+/**
+ * @brief ACI_GAP_START_CONNECTION_UPDATE
+ * Starts the connection update procedure (only when role is Central). A
+ * HCI_LE_CONNECTION_UPDATE is called.
+ * On completion of the procedure, an HCI_LE_CONNECTION_UPDATE_COMPLETE_EVENT
+ * event is returned to the upper layer.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Conn_Interval_Min Minimum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Interval_Max Maximum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Latency Maximum Peripheral latency for the connection in number
+ * of connection events.
+ * Values:
+ * - 0x0000 ... 0x01F3
+ * @param Supervision_Timeout Supervision timeout for the LE Link.
+ * It shall be a multiple of 10 ms and larger than (1 +
+ * connPeripheralLatency) * connInterval * 2.
+ * Time = N * 10 ms.
+ * Values:
+ * - 0x000A (100 ms) ... 0x0C80 (32000 ms)
+ * @param Minimum_CE_Length Information parameter about the minimum length of
+ * connection needed for this LE connection.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
+ * @param Maximum_CE_Length Information parameter about the maximum length of
+ * connection needed for this LE connection.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_start_connection_update( uint16_t Connection_Handle,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max,
+ uint16_t Conn_Latency,
+ uint16_t Supervision_Timeout,
+ uint16_t Minimum_CE_Length,
+ uint16_t Maximum_CE_Length );
+
+/**
+ * @brief ACI_GAP_SEND_PAIRING_REQ
+ * Sends the SM pairing request to start a pairing process. The authentication
+ * requirements and IO capabilities should be set before issuing this command
+ * using the ACI_GAP_SET_IO_CAPABILITY and
+ * ACI_GAP_SET_AUTHENTICATION_REQUIREMENT commands.
+ * A ACI_GAP_PAIRING_COMPLETE_EVENT event is returned after the pairing process
+ * is completed.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Force_Rebond If 1, Pairing request will be sent even if the device
+ * was previously bonded, otherwise pairing request is not sent.
+ * Values:
+ * - 0x00: NO
+ * - 0x01: YES
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_send_pairing_req( uint16_t Connection_Handle,
+ uint8_t Force_Rebond );
+
+/**
+ * @brief ACI_GAP_SET_BROADCAST_MODE
+ * This command puts the device into broadcast mode. A privacy enabled device
+ * uses either a resolvable private address or a non-resolvable private address
+ * as specified in the Own_Address_Type parameter of the command.
+ * Note: this command only supports legacy advertising. For extended
+ * advertising, refer to ACI_GAP_ADV_SET_CONFIGURATION and
+ * ACI_GAP_ADV_SET_ENABLE.
+ *
+ * @param Advertising_Interval_Min Minimum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
+ * @param Advertising_Interval_Max Maximum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
+ * @param Advertising_Type Advertising type
+ * Values:
+ * - 0x02: ADV_SCAN_IND (Scannable undirected advertising)
+ * - 0x03: ADV_NONCONN_IND (Non connectable undirected advertising)
+ * @param Own_Address_Type Own address type: if Privacy is disabled, the
+ * address can be public or static random; otherwise, it can be a
+ * resolvable private address or a non-resolvable private address.
+ * Values:
+ * - 0x00: Public address
+ * - 0x01: Static random address
+ * - 0x02: Resolvable private address
+ * - 0x03: Non-resolvable private address
+ * @param Adv_Data_Length Length of the advertising data in the advertising
+ * packet.
+ * @param Adv_Data Advertising data used by the device while advertising.
+ * @param Num_of_Peer_Entries Number of devices that have to be added to the
+ * Filter Accept List. Each device is defined by Peer_Address_Type and
+ * Peer_Address.
+ * @param Peer_Entry See @ref Peer_Entry_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_set_broadcast_mode( uint16_t Advertising_Interval_Min,
+ uint16_t Advertising_Interval_Max,
+ uint8_t Advertising_Type,
+ uint8_t Own_Address_Type,
+ uint8_t Adv_Data_Length,
+ const uint8_t* Adv_Data,
+ uint8_t Num_of_Peer_Entries,
+ const Peer_Entry_t* Peer_Entry );
+
+/**
+ * @brief ACI_GAP_START_OBSERVATION_PROC
+ * Starts an Observation procedure when the device is in Observer Role. The
+ * host enables scanning in the controller. The advertising reports are sent to
+ * the upper layer using standard LE Advertising Report Event.
+ * If privacy is enabled and the peer device (advertiser) is in the resolving
+ * list then the link layer will generate a RPA, if it is not then the RPA/NRPA
+ * generated by the Host will be used.
+ *
+ * @param LE_Scan_Interval This is defined as the time interval from when the
+ * Controller started its last LE scan until it begins the subsequent LE
+ * scan.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms) : legacy advertising
+ * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : extended advertising
+ * @param LE_Scan_Window Amount of time for the duration of the LE scan.
+ * LE_Scan_Window shall be less than or equal to LE_Scan_Interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms) : legacy advertising
+ * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : extended advertising
+ * @param LE_Scan_Type Passive or active scanning. With passive scanning, no
+ * scan request PDUs are sent.
+ * Values:
+ * - 0x00: Passive scanning
+ * - 0x01: Active scanning
+ * @param Own_Address_Type Own address type: if Privacy is disabled, the
+ * address can be public or static random; otherwise, it can be a
+ * resolvable private address or a non-resolvable private address.
+ * Values:
+ * - 0x00: Public address
+ * - 0x01: Static random address
+ * - 0x02: Resolvable private address
+ * - 0x03: Non-resolvable private address
+ * @param Filter_Duplicates Enable/disable duplicate filtering.
+ * Values:
+ * - 0x00: Duplicate filtering disabled
+ * - 0x01: Duplicate filtering enabled
+ * @param Scanning_Filter_Policy The scanning filter policy determines how the
+ * scanner's Link Layer processes advertising and scan response PDUs.
+ * There is a choice of two primary filter policies: unfiltered and
+ * filtered.
+ * Unfiltered: the Link Layer processes all advertising and scan
+ * response PDUs (i.e., the Filter Accept List is not used).
+ * Filtered: the Link Layer processes advertising and scan response PDUs
+ * only from devices in the Filter Accept List.
+ * With extended scanning filter policies, a directed advertising PDU
+ * accepted by the primary filter policy shall nevertheless be ignored
+ * unless either the TargetA field is identical to the scanner's device
+ * address, or TargetA field is a resolvable private address.
+ * Values:
+ * - 0x00: Basic unfiltered scanning filter policy
+ * - 0x01: Basic filtered scanning filter policy
+ * - 0x02: Extended unfiltered scanning filter policy
+ * - 0x03: Extended filtered scanning filter policy
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_start_observation_proc( uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t LE_Scan_Type,
+ uint8_t Own_Address_Type,
+ uint8_t Filter_Duplicates,
+ uint8_t Scanning_Filter_Policy );
+
+/**
+ * @brief ACI_GAP_GET_BONDED_DEVICES
+ * This command gets the list of the devices which are present in the bonding
+ * table. It returns the number of addresses and the corresponding address
+ * types and values.
+ *
+ * @param[out] Num_of_Addresses The number of bonded devices
+ * @param[out] Bonded_Device_Entry See @ref Bonded_Device_Entry_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_get_bonded_devices( uint8_t* Num_of_Addresses,
+ Bonded_Device_Entry_t* Bonded_Device_Entry );
+
+/**
+ * @brief ACI_GAP_CHECK_BONDED_DEVICE
+ * The command finds whether the device, whose address is specified in the
+ * command, is present in the bonding table. If the device is found, the
+ * command returns "Success".
+ * Note: the specified address can be a Resolvable Private Address (RPA). In
+ * this case, even if privacy is not enabled, this address is resolved to check
+ * the presence of the peer device in the bonding table. If the address is
+ * resolved successfully with any one of the IRKs present in the database, the
+ * command returns success and also the corresponding public or static random
+ * address stored with the IRK in the database (i.e. the peer device identity
+ * address distributed during bonding).
+ *
+ * @param Peer_Address_Type The address type of the peer device.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * @param Peer_Address Public Device Address or Random Device Address of the
+ * peer device
+ * @param[out] Id_Address_Type The address type of the peer device, distributed
+ * during pairing phase.
+ * @param[out] Id_Address The public or static random address of the peer
+ * device, distributed during pairing phase.
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_check_bonded_device( uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint8_t* Id_Address_Type,
+ uint8_t* Id_Address );
+
+/**
+ * @brief ACI_GAP_NUMERIC_COMPARISON_VALUE_CONFIRM_YESNO
+ * This command allows the User to validate/confirm or not the Numeric
+ * Comparison value showed through the ACI_GAP_NUMERIC_COMPARISON_VALUE_EVENT.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Confirm_Yes_No Indicates if the numeric values showed on both local
+ * and peer device are different or equal
+ * Values:
+ * - 0x00: No (numeric values are different)
+ * - 0x01: Yes (numeric values are equal)
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_numeric_comparison_value_confirm_yesno( uint16_t Connection_Handle,
+ uint8_t Confirm_Yes_No );
+
+/**
+ * @brief ACI_GAP_PASSKEY_INPUT
+ * This command permits to signal to the Stack the input type detected during
+ * Passkey input.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Input_Type Passkey input type detected
+ * Values:
+ * - 0x00: Passkey entry started
+ * - 0x01: Passkey digit entered
+ * - 0x02: Passkey digit erased
+ * - 0x03: Passkey cleared
+ * - 0x04: Passkey entry completed
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_passkey_input( uint16_t Connection_Handle,
+ uint8_t Input_Type );
+
+/**
+ * @brief ACI_GAP_GET_OOB_DATA
+ * This command is sent by the User to get (i.e. to extract from the Stack) the
+ * OOB data generated by the Stack itself.
+ *
+ * @param OOB_Data_Type Type of OOB data
+ * Values:
+ * - 0x00: TK (Legacy pairing)
+ * - 0x01: Random (SC)
+ * - 0x02: Confirm (SC)
+ * @param[out] Address_Type Identity address type
+ * Values:
+ * - 0x00: Public Identity Address
+ * - 0x01: Random (static) Identity Address
+ * @param[out] Address Public or Random (static) address of this device
+ * @param[out] OOB_Data_Len Length of OOB data
+ * Values:
+ * - 16
+ * @param[out] OOB_Data Local OOB data
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_get_oob_data( uint8_t OOB_Data_Type,
+ uint8_t* Address_Type,
+ uint8_t* Address,
+ uint8_t* OOB_Data_Len,
+ uint8_t* OOB_Data );
+
+/**
+ * @brief ACI_GAP_SET_OOB_DATA
+ * This command is sent (by the User) to input the OOB data arrived via OOB
+ * communication.
+ *
+ * @param Device_Type OOB Device type
+ * Values:
+ * - 0x00: Local device (Address_Type and Address are not used)
+ * - 0x01: Remote device
+ * @param Address_Type Identity address type
+ * Values:
+ * - 0x00: Public Identity Address
+ * - 0x01: Random (static) Identity Address
+ * @param Address Public or Random (static) Identity Address of the peer device
+ * @param OOB_Data_Type Type of OOB data
+ * Values:
+ * - 0x00: TK (Legacy pairing)
+ * - 0x01: Random (SC)
+ * - 0x02: Confirm (SC)
+ * @param OOB_Data_Len Length of OOB data
+ * Values:
+ * - 0: SC Random/Confirm generation (OOB_Data and OOB_Data_Type are not
+ * used)
+ * - 16
+ * @param OOB_Data Either local OOB data or remote OOB data received through
+ * OOB from peer device (see Device_Type)
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_set_oob_data( uint8_t Device_Type,
+ uint8_t Address_Type,
+ const uint8_t* Address,
+ uint8_t OOB_Data_Type,
+ uint8_t OOB_Data_Len,
+ const uint8_t* OOB_Data );
+
+/**
+ * @brief ACI_GAP_REMOVE_BONDED_DEVICE
+ * This command removes a specified device from bonding table; i.e. it removes
+ * from bonding table all security and GATT information related to the
+ * specified device.
+ *
+ * @param Peer_Identity_Address_Type Identity address type
+ * Values:
+ * - 0x00: Public Identity Address
+ * - 0x01: Random (static) Identity Address
+ * @param Peer_Identity_Address Public or Random (static) Identity Address of
+ * the peer device
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_remove_bonded_device( uint8_t Peer_Identity_Address_Type,
+ const uint8_t* Peer_Identity_Address );
+
+/**
+ * @brief ACI_GAP_ADD_DEVICES_TO_LIST
+ * This command is used to add specific device addresses to the Filter Accept
+ * List and/or resolving list.
+ *
+ * @param Num_of_List_Entries Number of devices that have to be added to the
+ * list.
+ * @param List_Entry See @ref List_Entry_t
+ * @param Mode Mode used for adding devices in the lists.
+ * Values:
+ * - 0x00: Append to the resolving list only
+ * - 0x01: Clear and set the resolving list only
+ * - 0x02: Append to the Filter Accept List only
+ * - 0x03: Clear and set the Filter Accept List only
+ * - 0x04: Append to both resolving list and Filter Accept List
+ * - 0x05: Clear and set both resolving list and Filter Accept List
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_add_devices_to_list( uint8_t Num_of_List_Entries,
+ const List_Entry_t* List_Entry,
+ uint8_t Mode );
+
+/**
+ * @brief ACI_GAP_PAIRING_REQUEST_REPLY
+ * This command is used to reply to ACI_GAP_PAIRING_REQUEST_EVENT. It enables
+ * to allow or reject either the Pairing Request from the Central or the
+ * Security Request from the Peripheral.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Accept Enables to accept or reject the pairing request.
+ * Values:
+ * - 0x00: Reject
+ * - 0x01: Accept
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_pairing_request_reply( uint16_t Connection_Handle,
+ uint8_t Accept );
+
+/**
+ * @brief ACI_GAP_ADDITIONAL_BEACON_START
+ * This command starts an advertising beacon. It allows additional advertising
+ * packets to be transmitted independently of the packets transmitted with GAP
+ * advertising commands such as ACI_GAP_SET_DISCOVERABLE or
+ * ACI_GAP_SET_LIMITED_DISCOVERABLE.
+ *
+ * @param Adv_Interval_Min Minimum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
+ * @param Adv_Interval_Max Maximum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
+ * @param Adv_Channel_Map Advertising channel map.
+ * Flags:
+ * - 0x01: Channel 37 shall be used
+ * - 0x02: Channel 38 shall be used
+ * - 0x04: Channel 39 shall be used
+ * @param Own_Address_Type Own address type: public or static random.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * @param Own_Address Public Device Address or Random Device Address.
+ * @param PA_Level Power amplifier output level.
+ * Values:
+ * - 0x00 ... 0x23
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_additional_beacon_start( uint16_t Adv_Interval_Min,
+ uint16_t Adv_Interval_Max,
+ uint8_t Adv_Channel_Map,
+ uint8_t Own_Address_Type,
+ const uint8_t* Own_Address,
+ uint8_t PA_Level );
+
+/**
+ * @brief ACI_GAP_ADDITIONAL_BEACON_STOP
+ * This command stops the advertising beacon started with
+ * ACI_GAP_ADDITIONAL_BEACON_START.
+ *
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_additional_beacon_stop( void );
+
+/**
+ * @brief ACI_GAP_ADDITIONAL_BEACON_SET_DATA
+ * This command sets the data transmitted by the advertising beacon started
+ * with ACI_GAP_ADDITIONAL_BEACON_START. If the advertising beacon is already
+ * started, the new data is used in subsequent beacon advertising events.
+ *
+ * @param Adv_Data_Length Length of Adv_Data in octets
+ * @param Adv_Data Advertising data used by the device while advertising.
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_additional_beacon_set_data( uint8_t Adv_Data_Length,
+ const uint8_t* Adv_Data );
+
+/**
+ * @brief ACI_GAP_ADV_SET_CONFIGURATION
+ * This command is used to set the extended advertising configuration for one
+ * advertising set.
+ * This command, in association with ACI_GAP_ADV_SET_SCAN_RESP_DATA,
+ * ACI_GAP_ADV_SET_ADV_DATA and ACI_GAP_ADV_SET_ENABLE, enables to start
+ * extended advertising. These commands must be used in replacement of
+ * ACI_GAP_SET_DISCOVERABLE, ACI_GAP_SET_LIMITED_DISCOVERABLE,
+ * ACI_GAP_SET_DIRECT_CONNECTABLE, ACI_GAP_SET_NON_CONNECTABLE,
+ * ACI_GAP_SET_UNDIRECTED_CONNECTABLE and ACI_GAP_SET_BROADCAST_MODE that only
+ * support legacy advertising.
+ * If bit 0 of Adv_Mode is set, the Own_Address_Type parameter is ignored and
+ * the own address shall be set with the ACI_GAP_ADV_SET_RANDOM_ADDRESS
+ * command. This mode is only valid for non-connectable advertising.
+ *
+ * @param Adv_Mode Bitmap of extended advertising modes
+ * Flags:
+ * - 0x01: Use specific random address
+ * @param Advertising_Handle Used to identify an advertising set.
+ * Values:
+ * - 0x00 ... 0xEF
+ * @param Adv_Event_Properties Type of advertising event.
+ * Flags:
+ * - 0x0001: Connectable advertising
+ * - 0x0002: Scannable advertising
+ * - 0x0004: Directed advertising
+ * - 0x0008: High Duty Cycle Directed Connectable advertising
+ * - 0x0010: Use legacy advertising PDUs
+ * - 0x0020: Anonymous advertising
+ * - 0x0040: Include TxPower in at least one advertising PDU
+ * @param Primary_Adv_Interval_Min Minimum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x00000020 (20.000 ms) ... 0x00FFFFFF (10485759.375 ms)
+ * @param Primary_Adv_Interval_Max Maximum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x00000020 (20.000 ms) ... 0x00FFFFFF (10485759.375 ms)
+ * @param Primary_Adv_Channel_Map Advertising channel map.
+ * Flags:
+ * - 0x01: Channel 37 shall be used
+ * - 0x02: Channel 38 shall be used
+ * - 0x04: Channel 39 shall be used
+ * @param Own_Address_Type Own address type: if Privacy is disabled, the
+ * address can be public or static random; otherwise, it can be a
+ * resolvable private address or a non-resolvable private address.
+ * Values:
+ * - 0x00: Public address
+ * - 0x01: Static random address
+ * - 0x02: Resolvable private address
+ * - 0x03: Non-resolvable private address
+ * @param Peer_Address_Type Address type of the peer device.
+ * Values:
+ * - 0x00: Public Device Address or Public Identity Address
+ * - 0x01: Random Device Address or Random (static) Identity Address
+ * @param Peer_Address Public Device Address, Random Device Address, Public
+ * Identity Address, or Random (static) Identity Address of the device
+ * to be connected.
+ * @param Adv_Filter_Policy Advertising filter policy
+ * Values:
+ * - 0x00: Process scan and connection requests from all devices (i.e.,
+ * the Filter Accept List is not in use)
+ * - 0x01: Process connection requests from all devices and scan
+ * requests only from devices that are in the Filter Accept List.
+ * - 0x02: Process scan requests from all devices and connection
+ * requests only from devices that are in the Filter Accept List.
+ * - 0x03: Process scan and connection requests only from devices in the
+ * Filter Accept List.
+ * @param Adv_TX_Power Advertising TX power. Units: dBm.
+ * Values:
+ * - 127: Host has no preference
+ * - -127 ... 20
+ * @param Secondary_Adv_Max_Skip Secondary advertising maximum skip.
+ * Values:
+ * - 0x00: AUX_ADV_IND shall be sent prior to the next advertising event
+ * - 0x01 ... 0xFF: Maximum advertising events the Controller can skip
+ * before sending the AUX_ADV_IND packets on the secondary advertising
+ * physical channel
+ * @param Secondary_Adv_PHY Secondary advertising PHY.
+ * Values:
+ * - 0x01: Secondary advertisement PHY is LE 1M
+ * - 0x02: Secondary advertisement PHY is LE 2M
+ * @param Adv_SID Value of the Advertising SID subfield in the ADI field of the
+ * PDU.
+ * Values:
+ * - 0x00 ... 0x0F
+ * @param Scan_Req_Notification_Enable Scan request notifications.
+ * Values:
+ * - 0x00: Scan request notifications disabled
+ * - 0x01: Scan request notifications enabled
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_adv_set_configuration( uint8_t Adv_Mode,
+ uint8_t Advertising_Handle,
+ uint16_t Adv_Event_Properties,
+ uint32_t Primary_Adv_Interval_Min,
+ uint32_t Primary_Adv_Interval_Max,
+ uint8_t Primary_Adv_Channel_Map,
+ uint8_t Own_Address_Type,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint8_t Adv_Filter_Policy,
+ uint8_t Adv_TX_Power,
+ uint8_t Secondary_Adv_Max_Skip,
+ uint8_t Secondary_Adv_PHY,
+ uint8_t Adv_SID,
+ uint8_t Scan_Req_Notification_Enable );
+
+/**
+ * @brief ACI_GAP_ADV_SET_ENABLE
+ * This command is used to request the Controller to enable or disable one or
+ * more extended advertising sets.
+ *
+ * @param Enable Enable/disable advertising.
+ * Values:
+ * - 0x00: Advertising is disabled
+ * - 0x01: Advertising is enabled
+ * @param Num_Sets Number of advertising sets.
+ * Values:
+ * - 0x00: Disable all advertising sets
+ * - 0x01 ... 0x3F: Number of advertising sets to enable or disable
+ * @param Adv_Set See @ref Adv_Set_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_adv_set_enable( uint8_t Enable,
+ uint8_t Num_Sets,
+ const Adv_Set_t* Adv_Set );
+
+/**
+ * @brief ACI_GAP_ADV_SET_ADV_DATA
+ * This command is used to set the data used in extended advertising PDUs that
+ * have a data field.
+ *
+ * @param Advertising_Handle Used to identify an advertising set.
+ * Values:
+ * - 0x00 ... 0xEF
+ * @param Operation Advertising operation.
+ * Values:
+ * - 0x00: Intermediate fragment of fragmented extended advertising data
+ * - 0x01: First fragment of fragmented extended advertising data
+ * - 0x02: Last fragment of fragmented extended advertising data
+ * - 0x03: Complete extended advertising data
+ * - 0x04: Unchanged data (just update the Advertising DID)
+ * @param Fragment_Preference Fragment preference.
+ * Values:
+ * - 0x00: The Controller may fragment all data
+ * - 0x01: The Controller should not fragment or should minimize
+ * fragmentation of data
+ * @param Advertising_Data_Length Length of Advertising_Data in octets
+ * @param Advertising_Data Data formatted as defined in Core Specification [Vol
+ * 3, Part C, 11].
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_adv_set_adv_data( uint8_t Advertising_Handle,
+ uint8_t Operation,
+ uint8_t Fragment_Preference,
+ uint8_t Advertising_Data_Length,
+ const uint8_t* Advertising_Data );
+
+/**
+ * @brief ACI_GAP_ADV_SET_SCAN_RESP_DATA
+ * This command is used to provide scan response data used during extended
+ * advertising.
+ *
+ * @param Advertising_Handle Used to identify an advertising set.
+ * Values:
+ * - 0x00 ... 0xEF
+ * @param Operation Scan response operation.
+ * Values:
+ * - 0x00: Intermediate fragment of fragmented scan response data
+ * - 0x01: First fragment of fragmented scan response data
+ * - 0x02: Last fragment of fragmented scan response data
+ * - 0x03: Complete scan response data
+ * @param Fragment_Preference Fragment preference.
+ * Values:
+ * - 0x00: The Controller may fragment all data
+ * - 0x01: The Controller should not fragment or should minimize
+ * fragmentation of data
+ * @param Scan_Response_Data_Length Length of Scan_Response_Data in octets
+ * @param Scan_Response_Data Data formatted as defined in Core Specification
+ * [Vol 3, Part C, 11].
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_adv_set_scan_resp_data( uint8_t Advertising_Handle,
+ uint8_t Operation,
+ uint8_t Fragment_Preference,
+ uint8_t Scan_Response_Data_Length,
+ const uint8_t* Scan_Response_Data );
+
+/**
+ * @brief ACI_GAP_ADV_REMOVE_SET
+ * This command is used to remove an advertising set from the Controller.
+ *
+ * @param Advertising_Handle Used to identify an advertising set.
+ * Values:
+ * - 0x00 ... 0xEF
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_adv_remove_set( uint8_t Advertising_Handle );
+
+/**
+ * @brief ACI_GAP_ADV_CLEAR_SETS
+ * This command is used to remove all existing advertising sets from the
+ * Controller.
+ *
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_adv_clear_sets( void );
+
+/**
+ * @brief ACI_GAP_ADV_SET_RANDOM_ADDRESS
+ * This command is used to set the random device address of an advertising set
+ * configured to use specific random address.
+ *
+ * @param Advertising_Handle Used to identify an advertising set.
+ * Values:
+ * - 0x00 ... 0xEF
+ * @param Random_Address Random Device Address.
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_adv_set_random_address( uint8_t Advertising_Handle,
+ const uint8_t* Random_Address );
+
+/**
+ * @brief ACI_GAP_EXT_START_SCAN
+ * This command is used to start a scanning procedure when the extended
+ * advertising feature is supported.
+ * The Scanning_PHYs and subsequent parameters are used to specify the scanning
+ * parameters as defined for HCI_LE_SET_EXTENDED_SCAN_PARAMETERS: for more
+ * details, refer to Core Specification [Vol 4, Part E, 7.8.64].
+ * Note: this more generic command can be used instead of
+ * ACI_GAP_START_LIMITED_DISCOVERY_PROC, ACI_GAP_START_GENERAL_DISCOVERY_PROC,
+ * ACI_GAP_START_GENERAL_CONNECTION_ESTABLISH_PROC,
+ * ACI_GAP_START_SELECTIVE_CONNECTION_ESTABLISH_PROC or
+ * ACI_GAP_START_OBSERVATION_PROC.
+ *
+ * @param Scan_Mode Reserved, shall be set to 0.
+ * Values:
+ * - 0x00
+ * @param Procedure Scan procedure.
+ * Values:
+ * - 0x01: GAP_LIMITED_DISCOVERY_PROC
+ * - 0x02: GAP_GENERAL_DISCOVERY_PROC
+ * - 0x10: GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC
+ * - 0x20: GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC
+ * - 0x80: GAP_OBSERVATION_PROC
+ * @param Own_Address_Type Own address type: if Privacy is disabled, the
+ * address can be public or static random; otherwise, it can be a
+ * resolvable private address or a non-resolvable private address.
+ * Values:
+ * - 0x00: Public address
+ * - 0x01: Static random address
+ * - 0x02: Resolvable private address
+ * - 0x03: Non-resolvable private address
+ * @param Filter_Duplicates Duplicate filtering.
+ * Values:
+ * - 0x00: Duplicate filtering disabled
+ * - 0x01: Duplicate filtering enabled
+ * - 0x02: Duplicate filtering enabled, reset for each scan period
+ * @param Duration Scan duration.
+ * Time = N * 10 ms.
+ * Values:
+ * - 0x0000 (0 ms) : Scan continuously until explicitly disable
+ * - 0x0001 (10 ms) ... 0xFFFF (655350 ms) : Scan duration
+ * @param Period Scan period.
+ * Time = N * 1.28 s.
+ * Values:
+ * - 0x0000 (0 ms) : Scan continuously
+ * - 0x0001 (1280 ms) ... 0xFFFF (83884800 ms) : Time interval from
+ * when the Controller started its last Scan_Duration until it begins
+ * the subsequent Scan_Duration
+ * @param Scanning_Filter_Policy The scanning filter policy determines how the
+ * scanner's Link Layer processes advertising and scan response PDUs.
+ * There is a choice of two primary filter policies: unfiltered and
+ * filtered.
+ * Unfiltered: the Link Layer processes all advertising and scan
+ * response PDUs (i.e., the Filter Accept List is not used).
+ * Filtered: the Link Layer processes advertising and scan response PDUs
+ * only from devices in the Filter Accept List.
+ * With extended scanning filter policies, a directed advertising PDU
+ * accepted by the primary filter policy shall nevertheless be ignored
+ * unless either the TargetA field is identical to the scanner's device
+ * address, or TargetA field is a resolvable private address.
+ * Values:
+ * - 0x00: Basic unfiltered scanning filter policy
+ * - 0x01: Basic filtered scanning filter policy
+ * - 0x02: Extended unfiltered scanning filter policy
+ * - 0x03: Extended filtered scanning filter policy
+ * @param Scanning_PHYs Scan PHYs.
+ * Flags:
+ * - 0x01: Scan advertisements on the LE 1M PHY
+ * @param Scan_Param_Phy See @ref Scan_Param_Phy_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_ext_start_scan( uint8_t Scan_Mode,
+ uint8_t Procedure,
+ uint8_t Own_Address_Type,
+ uint8_t Filter_Duplicates,
+ uint16_t Duration,
+ uint16_t Period,
+ uint8_t Scanning_Filter_Policy,
+ uint8_t Scanning_PHYs,
+ const Scan_Param_Phy_t* Scan_Param_Phy );
+
+/**
+ * @brief ACI_GAP_EXT_CREATE_CONNECTION
+ * This command is used to create a connection with the local device in the
+ * Central role to an advertiser when the extended advertising feature is
+ * supported.
+ * The Advertising_Handle and Subevent parameters are ignored.
+ * The Initiating_PHYs and subsequent parameters are used to specify the
+ * initiating parameters as defined for HCI_LE_EXTENDED_CREATE_CONNECTION: for
+ * more details, refer to Core Specification [Vol 4, Part E, 7.8.66].
+ * Note: this more generic command can be used instead of
+ * ACI_GAP_CREATE_CONNECTION or ACI_GAP_START_AUTO_CONNECTION_ESTABLISH_PROC.
+ *
+ * @param Initiating_Mode Reserved, shall be set to 0.
+ * Values:
+ * - 0x00
+ * @param Procedure Connection procedure.
+ * Values:
+ * - 0x08: GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC
+ * - 0x40: GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC
+ * @param Own_Address_Type Own address type: if Privacy is disabled, the
+ * address can be public or static random; otherwise, it can be a
+ * resolvable private address.
+ * Values:
+ * - 0x00: Public address
+ * - 0x01: Static random address
+ * - 0x02: Resolvable private address
+ * @param Peer_Address_Type The address type of the peer device.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * @param Peer_Address Public Device Address or Random Device Address of the
+ * device to be connected.
+ * @param Advertising_Handle Used to identify the subevent where a connection
+ * request shall be initiated from a periodic advertising train.
+ * Values:
+ * - 0xFF: Parameter not used
+ * - 0x00 ... 0xEF
+ * @param Subevent Subevent where the connection request is to be sent.
+ * Values:
+ * - 0xFF: Parameter not used
+ * - 0x00 ... 0x7F
+ * @param Initiator_Filter_Policy Initiator filter policy.
+ * Values:
+ * - 0x00: Filter Accept List is not used to determine which advertiser
+ * to connect to
+ * - 0x01: Filter Accept List is used to determine which advertiser to
+ * connect to (Peer_Address_Type and Peer_Address are ignored)
+ * @param Initiating_PHYs Initiating PHYs.
+ * Flags:
+ * - 0x01: Scan connectable advertisements on the LE 1M PHY- Connection
+ * parameters for the LE 1M PHY
+ * - 0x02: Connection parameters for the LE 2M PHY
+ * @param Init_Param_Phy See @ref Init_Param_Phy_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gap_ext_create_connection( uint8_t Initiating_Mode,
+ uint8_t Procedure,
+ uint8_t Own_Address_Type,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint8_t Advertising_Handle,
+ uint8_t Subevent,
+ uint8_t Initiator_Filter_Policy,
+ uint8_t Initiating_PHYs,
+ const Init_Param_Phy_t* Init_Param_Phy );
+
+
+#endif /* BLE_GAP_ACI_H__ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_gatt_aci.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_gatt_aci.c
new file mode 100644
index 0000000..90d18ef
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_gatt_aci.c
@@ -0,0 +1,1521 @@
+/*****************************************************************************
+ * @file ble_gatt_aci.c
+ * @brief STM32WB BLE API (gatt_aci)
+ * Auto-generated file: do not edit!
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#include "auto/ble_gatt_aci.h"
+
+tBleStatus aci_gatt_init( void )
+{
+ struct hci_request rq;
+ tBleStatus status = 0;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x101;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_add_service( uint8_t Service_UUID_Type,
+ const Service_UUID_t* Service_UUID,
+ uint8_t Service_Type,
+ uint8_t Max_Attribute_Records,
+ uint16_t* Service_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_add_service_cp0 *cp0 = (aci_gatt_add_service_cp0*)(cmd_buffer);
+ aci_gatt_add_service_cp1 *cp1 = (aci_gatt_add_service_cp1*)(cmd_buffer + 1 + (Service_UUID_Type == 1 ? 2 : (Service_UUID_Type == 2 ? 16 : 0)));
+ aci_gatt_add_service_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Service_UUID_Type = Service_UUID_Type;
+ index_input += 1;
+ /* var_len_data input */
+ {
+ uint8_t size;
+ switch ( Service_UUID_Type )
+ {
+ case 1: size = 2; break;
+ case 2: size = 16; break;
+ default: return BLE_STATUS_ERROR;
+ }
+ Osal_MemCpy( (void*)&cp0->Service_UUID, (const void*)Service_UUID, size );
+ index_input += size;
+ {
+ cp1->Service_Type = Service_Type;
+ }
+ index_input += 1;
+ {
+ cp1->Max_Attribute_Records = Max_Attribute_Records;
+ }
+ index_input += 1;
+ }
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x102;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Service_Handle = resp.Service_Handle;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_gatt_include_service( uint16_t Service_Handle,
+ uint16_t Include_Start_Handle,
+ uint16_t Include_End_Handle,
+ uint8_t Include_UUID_Type,
+ const Include_UUID_t* Include_UUID,
+ uint16_t* Include_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_include_service_cp0 *cp0 = (aci_gatt_include_service_cp0*)(cmd_buffer);
+ aci_gatt_include_service_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ int uuid_size = (Include_UUID_Type == 2) ? 16 : 2;
+ cp0->Service_Handle = Service_Handle;
+ index_input += 2;
+ cp0->Include_Start_Handle = Include_Start_Handle;
+ index_input += 2;
+ cp0->Include_End_Handle = Include_End_Handle;
+ index_input += 2;
+ cp0->Include_UUID_Type = Include_UUID_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Include_UUID, (const void*)Include_UUID, uuid_size );
+ index_input += uuid_size;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x103;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Include_Handle = resp.Include_Handle;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_gatt_add_char( uint16_t Service_Handle,
+ uint8_t Char_UUID_Type,
+ const Char_UUID_t* Char_UUID,
+ uint16_t Char_Value_Length,
+ uint8_t Char_Properties,
+ uint8_t Security_Permissions,
+ uint8_t GATT_Evt_Mask,
+ uint8_t Enc_Key_Size,
+ uint8_t Is_Variable,
+ uint16_t* Char_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_add_char_cp0 *cp0 = (aci_gatt_add_char_cp0*)(cmd_buffer);
+ aci_gatt_add_char_cp1 *cp1 = (aci_gatt_add_char_cp1*)(cmd_buffer + 2 + 1 + (Char_UUID_Type == 1 ? 2 : (Char_UUID_Type == 2 ? 16 : 0)));
+ aci_gatt_add_char_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Service_Handle = Service_Handle;
+ index_input += 2;
+ cp0->Char_UUID_Type = Char_UUID_Type;
+ index_input += 1;
+ /* var_len_data input */
+ {
+ uint8_t size;
+ switch ( Char_UUID_Type )
+ {
+ case 1: size = 2; break;
+ case 2: size = 16; break;
+ default: return BLE_STATUS_ERROR;
+ }
+ Osal_MemCpy( (void*)&cp0->Char_UUID, (const void*)Char_UUID, size );
+ index_input += size;
+ {
+ cp1->Char_Value_Length = Char_Value_Length;
+ }
+ index_input += 2;
+ {
+ cp1->Char_Properties = Char_Properties;
+ }
+ index_input += 1;
+ {
+ cp1->Security_Permissions = Security_Permissions;
+ }
+ index_input += 1;
+ {
+ cp1->GATT_Evt_Mask = GATT_Evt_Mask;
+ }
+ index_input += 1;
+ {
+ cp1->Enc_Key_Size = Enc_Key_Size;
+ }
+ index_input += 1;
+ {
+ cp1->Is_Variable = Is_Variable;
+ }
+ index_input += 1;
+ }
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x104;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Char_Handle = resp.Char_Handle;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_gatt_add_char_desc( uint16_t Service_Handle,
+ uint16_t Char_Handle,
+ uint8_t Char_Desc_Uuid_Type,
+ const Char_Desc_Uuid_t* Char_Desc_Uuid,
+ uint8_t Char_Desc_Value_Max_Len,
+ uint8_t Char_Desc_Value_Length,
+ const uint8_t* Char_Desc_Value,
+ uint8_t Security_Permissions,
+ uint8_t Access_Permissions,
+ uint8_t GATT_Evt_Mask,
+ uint8_t Enc_Key_Size,
+ uint8_t Is_Variable,
+ uint16_t* Char_Desc_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_add_char_desc_cp0 *cp0 = (aci_gatt_add_char_desc_cp0*)(cmd_buffer);
+ aci_gatt_add_char_desc_cp1 *cp1 = (aci_gatt_add_char_desc_cp1*)(cmd_buffer + 2 + 2 + 1 + (Char_Desc_Uuid_Type == 1 ? 2 : (Char_Desc_Uuid_Type == 2 ? 16 : 0)));
+ aci_gatt_add_char_desc_cp2 *cp2 = (aci_gatt_add_char_desc_cp2*)(cmd_buffer + 2 + 2 + 1 + (Char_Desc_Uuid_Type == 1 ? 2 : (Char_Desc_Uuid_Type == 2 ? 16 : 0)) + 1 + 1 + Char_Desc_Value_Length * (sizeof(uint8_t)));
+ aci_gatt_add_char_desc_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Service_Handle = Service_Handle;
+ index_input += 2;
+ cp0->Char_Handle = Char_Handle;
+ index_input += 2;
+ cp0->Char_Desc_Uuid_Type = Char_Desc_Uuid_Type;
+ index_input += 1;
+ /* var_len_data input */
+ {
+ uint8_t size;
+ switch ( Char_Desc_Uuid_Type )
+ {
+ case 1: size = 2; break;
+ case 2: size = 16; break;
+ default: return BLE_STATUS_ERROR;
+ }
+ Osal_MemCpy( (void*)&cp0->Char_Desc_Uuid, (const void*)Char_Desc_Uuid, size );
+ index_input += size;
+ {
+ cp1->Char_Desc_Value_Max_Len = Char_Desc_Value_Max_Len;
+ }
+ index_input += 1;
+ {
+ cp1->Char_Desc_Value_Length = Char_Desc_Value_Length;
+ }
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp1->Char_Desc_Value, (const void*)Char_Desc_Value, Char_Desc_Value_Length );
+ index_input += Char_Desc_Value_Length;
+ {
+ cp2->Security_Permissions = Security_Permissions;
+ }
+ index_input += 1;
+ {
+ cp2->Access_Permissions = Access_Permissions;
+ }
+ index_input += 1;
+ {
+ cp2->GATT_Evt_Mask = GATT_Evt_Mask;
+ }
+ index_input += 1;
+ {
+ cp2->Enc_Key_Size = Enc_Key_Size;
+ }
+ index_input += 1;
+ {
+ cp2->Is_Variable = Is_Variable;
+ }
+ index_input += 1;
+ }
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x105;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Char_Desc_Handle = resp.Char_Desc_Handle;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_gatt_update_char_value( uint16_t Service_Handle,
+ uint16_t Char_Handle,
+ uint8_t Val_Offset,
+ uint8_t Char_Value_Length,
+ const uint8_t* Char_Value )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_update_char_value_cp0 *cp0 = (aci_gatt_update_char_value_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Service_Handle = Service_Handle;
+ index_input += 2;
+ cp0->Char_Handle = Char_Handle;
+ index_input += 2;
+ cp0->Val_Offset = Val_Offset;
+ index_input += 1;
+ cp0->Char_Value_Length = Char_Value_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Char_Value, (const void*)Char_Value, Char_Value_Length );
+ index_input += Char_Value_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x106;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_del_char( uint16_t Serv_Handle,
+ uint16_t Char_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_del_char_cp0 *cp0 = (aci_gatt_del_char_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Serv_Handle = Serv_Handle;
+ index_input += 2;
+ cp0->Char_Handle = Char_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x107;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_del_service( uint16_t Serv_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_del_service_cp0 *cp0 = (aci_gatt_del_service_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Serv_Handle = Serv_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x108;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_del_include_service( uint16_t Serv_Handle,
+ uint16_t Include_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_del_include_service_cp0 *cp0 = (aci_gatt_del_include_service_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Serv_Handle = Serv_Handle;
+ index_input += 2;
+ cp0->Include_Handle = Include_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x109;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_set_event_mask( uint32_t GATT_Evt_Mask )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_set_event_mask_cp0 *cp0 = (aci_gatt_set_event_mask_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->GATT_Evt_Mask = GATT_Evt_Mask;
+ index_input += 4;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x10a;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_exchange_config( uint16_t Connection_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_exchange_config_cp0 *cp0 = (aci_gatt_exchange_config_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x10b;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_att_find_info_req( uint16_t Connection_Handle,
+ uint16_t Start_Handle,
+ uint16_t End_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_att_find_info_req_cp0 *cp0 = (aci_att_find_info_req_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Start_Handle = Start_Handle;
+ index_input += 2;
+ cp0->End_Handle = End_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x10c;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_att_find_by_type_value_req( uint16_t Connection_Handle,
+ uint16_t Start_Handle,
+ uint16_t End_Handle,
+ uint16_t UUID,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_att_find_by_type_value_req_cp0 *cp0 = (aci_att_find_by_type_value_req_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Start_Handle = Start_Handle;
+ index_input += 2;
+ cp0->End_Handle = End_Handle;
+ index_input += 2;
+ cp0->UUID = UUID;
+ index_input += 2;
+ cp0->Attribute_Val_Length = Attribute_Val_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Attribute_Val, (const void*)Attribute_Val, Attribute_Val_Length );
+ index_input += Attribute_Val_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x10d;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_att_read_by_type_req( uint16_t Connection_Handle,
+ uint16_t Start_Handle,
+ uint16_t End_Handle,
+ uint8_t UUID_Type,
+ const UUID_t* UUID )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_att_read_by_type_req_cp0 *cp0 = (aci_att_read_by_type_req_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ int uuid_size = (UUID_Type == 2) ? 16 : 2;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Start_Handle = Start_Handle;
+ index_input += 2;
+ cp0->End_Handle = End_Handle;
+ index_input += 2;
+ cp0->UUID_Type = UUID_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->UUID, (const void*)UUID, uuid_size );
+ index_input += uuid_size;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x10e;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_att_read_by_group_type_req( uint16_t Connection_Handle,
+ uint16_t Start_Handle,
+ uint16_t End_Handle,
+ uint8_t UUID_Type,
+ const UUID_t* UUID )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_att_read_by_group_type_req_cp0 *cp0 = (aci_att_read_by_group_type_req_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ int uuid_size = (UUID_Type == 2) ? 16 : 2;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Start_Handle = Start_Handle;
+ index_input += 2;
+ cp0->End_Handle = End_Handle;
+ index_input += 2;
+ cp0->UUID_Type = UUID_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->UUID, (const void*)UUID, uuid_size );
+ index_input += uuid_size;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x10f;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_att_prepare_write_req( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint16_t Val_Offset,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_att_prepare_write_req_cp0 *cp0 = (aci_att_prepare_write_req_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Attr_Handle = Attr_Handle;
+ index_input += 2;
+ cp0->Val_Offset = Val_Offset;
+ index_input += 2;
+ cp0->Attribute_Val_Length = Attribute_Val_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Attribute_Val, (const void*)Attribute_Val, Attribute_Val_Length );
+ index_input += Attribute_Val_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x110;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_att_execute_write_req( uint16_t Connection_Handle,
+ uint8_t Execute )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_att_execute_write_req_cp0 *cp0 = (aci_att_execute_write_req_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Execute = Execute;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x111;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_disc_all_primary_services( uint16_t Connection_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_disc_all_primary_services_cp0 *cp0 = (aci_gatt_disc_all_primary_services_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x112;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_disc_primary_service_by_uuid( uint16_t Connection_Handle,
+ uint8_t UUID_Type,
+ const UUID_t* UUID )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_disc_primary_service_by_uuid_cp0 *cp0 = (aci_gatt_disc_primary_service_by_uuid_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ int uuid_size = (UUID_Type == 2) ? 16 : 2;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->UUID_Type = UUID_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->UUID, (const void*)UUID, uuid_size );
+ index_input += uuid_size;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x113;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_find_included_services( uint16_t Connection_Handle,
+ uint16_t Start_Handle,
+ uint16_t End_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_find_included_services_cp0 *cp0 = (aci_gatt_find_included_services_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Start_Handle = Start_Handle;
+ index_input += 2;
+ cp0->End_Handle = End_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x114;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_disc_all_char_of_service( uint16_t Connection_Handle,
+ uint16_t Start_Handle,
+ uint16_t End_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_disc_all_char_of_service_cp0 *cp0 = (aci_gatt_disc_all_char_of_service_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Start_Handle = Start_Handle;
+ index_input += 2;
+ cp0->End_Handle = End_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x115;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_disc_char_by_uuid( uint16_t Connection_Handle,
+ uint16_t Start_Handle,
+ uint16_t End_Handle,
+ uint8_t UUID_Type,
+ const UUID_t* UUID )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_disc_char_by_uuid_cp0 *cp0 = (aci_gatt_disc_char_by_uuid_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ int uuid_size = (UUID_Type == 2) ? 16 : 2;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Start_Handle = Start_Handle;
+ index_input += 2;
+ cp0->End_Handle = End_Handle;
+ index_input += 2;
+ cp0->UUID_Type = UUID_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->UUID, (const void*)UUID, uuid_size );
+ index_input += uuid_size;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x116;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_disc_all_char_desc( uint16_t Connection_Handle,
+ uint16_t Char_Handle,
+ uint16_t End_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_disc_all_char_desc_cp0 *cp0 = (aci_gatt_disc_all_char_desc_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Char_Handle = Char_Handle;
+ index_input += 2;
+ cp0->End_Handle = End_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x117;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_read_char_value( uint16_t Connection_Handle,
+ uint16_t Attr_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_read_char_value_cp0 *cp0 = (aci_gatt_read_char_value_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Attr_Handle = Attr_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x118;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_read_using_char_uuid( uint16_t Connection_Handle,
+ uint16_t Start_Handle,
+ uint16_t End_Handle,
+ uint8_t UUID_Type,
+ const UUID_t* UUID )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_read_using_char_uuid_cp0 *cp0 = (aci_gatt_read_using_char_uuid_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ int uuid_size = (UUID_Type == 2) ? 16 : 2;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Start_Handle = Start_Handle;
+ index_input += 2;
+ cp0->End_Handle = End_Handle;
+ index_input += 2;
+ cp0->UUID_Type = UUID_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->UUID, (const void*)UUID, uuid_size );
+ index_input += uuid_size;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x119;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_read_long_char_value( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint16_t Val_Offset )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_read_long_char_value_cp0 *cp0 = (aci_gatt_read_long_char_value_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Attr_Handle = Attr_Handle;
+ index_input += 2;
+ cp0->Val_Offset = Val_Offset;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x11a;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_read_multiple_char_value( uint16_t Connection_Handle,
+ uint8_t Number_of_Handles,
+ const Handle_Entry_t* Handle_Entry )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_read_multiple_char_value_cp0 *cp0 = (aci_gatt_read_multiple_char_value_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Number_of_Handles = Number_of_Handles;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Handle_Entry, (const void*)Handle_Entry, Number_of_Handles * (sizeof(Handle_Entry_t)) );
+ index_input += Number_of_Handles * (sizeof(Handle_Entry_t));
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x11b;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_write_char_value( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_write_char_value_cp0 *cp0 = (aci_gatt_write_char_value_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Attr_Handle = Attr_Handle;
+ index_input += 2;
+ cp0->Attribute_Val_Length = Attribute_Val_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Attribute_Val, (const void*)Attribute_Val, Attribute_Val_Length );
+ index_input += Attribute_Val_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x11c;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_write_long_char_value( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint16_t Val_Offset,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_write_long_char_value_cp0 *cp0 = (aci_gatt_write_long_char_value_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Attr_Handle = Attr_Handle;
+ index_input += 2;
+ cp0->Val_Offset = Val_Offset;
+ index_input += 2;
+ cp0->Attribute_Val_Length = Attribute_Val_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Attribute_Val, (const void*)Attribute_Val, Attribute_Val_Length );
+ index_input += Attribute_Val_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x11d;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_write_char_reliable( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint16_t Val_Offset,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_write_char_reliable_cp0 *cp0 = (aci_gatt_write_char_reliable_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Attr_Handle = Attr_Handle;
+ index_input += 2;
+ cp0->Val_Offset = Val_Offset;
+ index_input += 2;
+ cp0->Attribute_Val_Length = Attribute_Val_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Attribute_Val, (const void*)Attribute_Val, Attribute_Val_Length );
+ index_input += Attribute_Val_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x11e;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_write_long_char_desc( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint16_t Val_Offset,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_write_long_char_desc_cp0 *cp0 = (aci_gatt_write_long_char_desc_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Attr_Handle = Attr_Handle;
+ index_input += 2;
+ cp0->Val_Offset = Val_Offset;
+ index_input += 2;
+ cp0->Attribute_Val_Length = Attribute_Val_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Attribute_Val, (const void*)Attribute_Val, Attribute_Val_Length );
+ index_input += Attribute_Val_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x11f;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_read_long_char_desc( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint16_t Val_Offset )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_read_long_char_desc_cp0 *cp0 = (aci_gatt_read_long_char_desc_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Attr_Handle = Attr_Handle;
+ index_input += 2;
+ cp0->Val_Offset = Val_Offset;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x120;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_write_char_desc( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_write_char_desc_cp0 *cp0 = (aci_gatt_write_char_desc_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Attr_Handle = Attr_Handle;
+ index_input += 2;
+ cp0->Attribute_Val_Length = Attribute_Val_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Attribute_Val, (const void*)Attribute_Val, Attribute_Val_Length );
+ index_input += Attribute_Val_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x121;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_read_char_desc( uint16_t Connection_Handle,
+ uint16_t Attr_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_read_char_desc_cp0 *cp0 = (aci_gatt_read_char_desc_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Attr_Handle = Attr_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x122;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_write_without_resp( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_write_without_resp_cp0 *cp0 = (aci_gatt_write_without_resp_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Attr_Handle = Attr_Handle;
+ index_input += 2;
+ cp0->Attribute_Val_Length = Attribute_Val_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Attribute_Val, (const void*)Attribute_Val, Attribute_Val_Length );
+ index_input += Attribute_Val_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x123;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_signed_write_without_resp( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_signed_write_without_resp_cp0 *cp0 = (aci_gatt_signed_write_without_resp_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Attr_Handle = Attr_Handle;
+ index_input += 2;
+ cp0->Attribute_Val_Length = Attribute_Val_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Attribute_Val, (const void*)Attribute_Val, Attribute_Val_Length );
+ index_input += Attribute_Val_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x124;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_confirm_indication( uint16_t Connection_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_confirm_indication_cp0 *cp0 = (aci_gatt_confirm_indication_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x125;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_write_resp( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint8_t Write_status,
+ uint8_t Error_Code,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_write_resp_cp0 *cp0 = (aci_gatt_write_resp_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Attr_Handle = Attr_Handle;
+ index_input += 2;
+ cp0->Write_status = Write_status;
+ index_input += 1;
+ cp0->Error_Code = Error_Code;
+ index_input += 1;
+ cp0->Attribute_Val_Length = Attribute_Val_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Attribute_Val, (const void*)Attribute_Val, Attribute_Val_Length );
+ index_input += Attribute_Val_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x126;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_allow_read( uint16_t Connection_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_allow_read_cp0 *cp0 = (aci_gatt_allow_read_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x127;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_set_security_permission( uint16_t Serv_Handle,
+ uint16_t Attr_Handle,
+ uint8_t Security_Permissions )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_set_security_permission_cp0 *cp0 = (aci_gatt_set_security_permission_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Serv_Handle = Serv_Handle;
+ index_input += 2;
+ cp0->Attr_Handle = Attr_Handle;
+ index_input += 2;
+ cp0->Security_Permissions = Security_Permissions;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x128;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_set_desc_value( uint16_t Serv_Handle,
+ uint16_t Char_Handle,
+ uint16_t Char_Desc_Handle,
+ uint16_t Val_Offset,
+ uint8_t Char_Desc_Value_Length,
+ const uint8_t* Char_Desc_Value )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_set_desc_value_cp0 *cp0 = (aci_gatt_set_desc_value_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Serv_Handle = Serv_Handle;
+ index_input += 2;
+ cp0->Char_Handle = Char_Handle;
+ index_input += 2;
+ cp0->Char_Desc_Handle = Char_Desc_Handle;
+ index_input += 2;
+ cp0->Val_Offset = Val_Offset;
+ index_input += 2;
+ cp0->Char_Desc_Value_Length = Char_Desc_Value_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Char_Desc_Value, (const void*)Char_Desc_Value, Char_Desc_Value_Length );
+ index_input += Char_Desc_Value_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x129;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_read_handle_value( uint16_t Attr_Handle,
+ uint16_t Offset,
+ uint16_t Value_Length_Requested,
+ uint16_t* Length,
+ uint16_t* Value_Length,
+ uint8_t* Value )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_read_handle_value_cp0 *cp0 = (aci_gatt_read_handle_value_cp0*)(cmd_buffer);
+ aci_gatt_read_handle_value_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Attr_Handle = Attr_Handle;
+ index_input += 2;
+ cp0->Offset = Offset;
+ index_input += 2;
+ cp0->Value_Length_Requested = Value_Length_Requested;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x12a;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Length = resp.Length;
+ *Value_Length = resp.Value_Length;
+ Osal_MemCpy( (void*)Value, (const void*)resp.Value, *Value_Length);
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_gatt_update_char_value_ext( uint16_t Conn_Handle_To_Notify,
+ uint16_t Service_Handle,
+ uint16_t Char_Handle,
+ uint8_t Update_Type,
+ uint16_t Char_Length,
+ uint16_t Value_Offset,
+ uint8_t Value_Length,
+ const uint8_t* Value )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_update_char_value_ext_cp0 *cp0 = (aci_gatt_update_char_value_ext_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Conn_Handle_To_Notify = Conn_Handle_To_Notify;
+ index_input += 2;
+ cp0->Service_Handle = Service_Handle;
+ index_input += 2;
+ cp0->Char_Handle = Char_Handle;
+ index_input += 2;
+ cp0->Update_Type = Update_Type;
+ index_input += 1;
+ cp0->Char_Length = Char_Length;
+ index_input += 2;
+ cp0->Value_Offset = Value_Offset;
+ index_input += 2;
+ cp0->Value_Length = Value_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Value, (const void*)Value, Value_Length );
+ index_input += Value_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x12c;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_deny_read( uint16_t Connection_Handle,
+ uint8_t Error_Code )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_deny_read_cp0 *cp0 = (aci_gatt_deny_read_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Error_Code = Error_Code;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x12d;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_set_access_permission( uint16_t Serv_Handle,
+ uint16_t Attr_Handle,
+ uint8_t Access_Permissions )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_set_access_permission_cp0 *cp0 = (aci_gatt_set_access_permission_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Serv_Handle = Serv_Handle;
+ index_input += 2;
+ cp0->Attr_Handle = Attr_Handle;
+ index_input += 2;
+ cp0->Access_Permissions = Access_Permissions;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x12e;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_store_db( void )
+{
+ struct hci_request rq;
+ tBleStatus status = 0;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x130;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_send_mult_notification( uint16_t Connection_Handle,
+ uint8_t Number_of_Handles,
+ const Handle_Entry_t* Handle_Entry )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_send_mult_notification_cp0 *cp0 = (aci_gatt_send_mult_notification_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Number_of_Handles = Number_of_Handles;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Handle_Entry, (const void*)Handle_Entry, Number_of_Handles * (sizeof(Handle_Entry_t)) );
+ index_input += Number_of_Handles * (sizeof(Handle_Entry_t));
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x131;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_gatt_read_multiple_var_char_value( uint16_t Connection_Handle,
+ uint8_t Number_of_Handles,
+ const Handle_Entry_t* Handle_Entry )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_gatt_read_multiple_var_char_value_cp0 *cp0 = (aci_gatt_read_multiple_var_char_value_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Number_of_Handles = Number_of_Handles;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Handle_Entry, (const void*)Handle_Entry, Number_of_Handles * (sizeof(Handle_Entry_t)) );
+ index_input += Number_of_Handles * (sizeof(Handle_Entry_t));
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x132;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_gatt_aci.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_gatt_aci.h
new file mode 100644
index 0000000..302a53a
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_gatt_aci.h
@@ -0,0 +1,1281 @@
+/*****************************************************************************
+ * @file ble_gatt_aci.h
+ * @brief STM32WB BLE API (GATT_ACI)
+ * Auto-generated file: do not edit!
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#ifndef BLE_GATT_ACI_H__
+#define BLE_GATT_ACI_H__
+
+
+#include "auto/ble_types.h"
+
+/**
+ * @brief ACI_GATT_INIT
+ * Initializes the GATT layer for server and client roles. It also adds the
+ * GATT service with Service Changed Characteristic.
+ * Until this command is issued the GATT channel does not process any commands
+ * even if the connection is opened. This command has to be given before using
+ * any of the GAP features.
+ *
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_init( void );
+
+/**
+ * @brief ACI_GATT_ADD_SERVICE
+ * Add a service to GATT Server. When a service is created in the server, the
+ * host needs to reserve the handle ranges for this service using
+ * Max_Attribute_Records parameter. This parameter specifies the maximum number
+ * of attribute records that can be added to this service (including the
+ * service attribute, include attribute, characteristic attribute,
+ * characteristic value attribute and characteristic descriptor attribute).
+ * Handle of the created service is returned in command complete event. Service
+ * declaration is taken from the service pool.
+ * The attributes for characteristics and descriptors are allocated from the
+ * attribute pool.
+ *
+ * @param Service_UUID_Type UUID type: 0x01 = 16 bits UUID while 0x02 = 128
+ * bits UUID
+ * @param Service_UUID See @ref Service_UUID_t
+ * @param Service_Type Service type.
+ * Values:
+ * - 0x01: Primary Service
+ * - 0x02: Secondary Service
+ * @param Max_Attribute_Records Maximum number of attribute records that can be
+ * added to this service
+ * @param[out] Service_Handle Handle of the Service.
+ * When this service is added, a handle is allocated by the server for
+ * this service.
+ * Server also allocates a range of handles for this service from
+ * serviceHandle to <serviceHandle + max_attr_records - 1>
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_add_service( uint8_t Service_UUID_Type,
+ const Service_UUID_t* Service_UUID,
+ uint8_t Service_Type,
+ uint8_t Max_Attribute_Records,
+ uint16_t* Service_Handle );
+
+/**
+ * @brief ACI_GATT_INCLUDE_SERVICE
+ * Include a service given by Include_Start_Handle and Include_End_Handle to
+ * another service given by Service_Handle. Attribute server creates an INCLUDE
+ * definition attribute and return the handle of this attribute in
+ * Included_handle.
+ *
+ * @param Service_Handle Handle of the Service to which another service has to
+ * be included.
+ * @param Include_Start_Handle Start Handle of the Service which has to be
+ * included in service
+ * @param Include_End_Handle End Handle of the Service which has to be included
+ * in service
+ * @param Include_UUID_Type UUID type: 0x01 = 16 bits UUID while 0x02 = 128
+ * bits UUID
+ * @param Include_UUID See @ref Include_UUID_t
+ * @param[out] Include_Handle Handle of the include declaration
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_include_service( uint16_t Service_Handle,
+ uint16_t Include_Start_Handle,
+ uint16_t Include_End_Handle,
+ uint8_t Include_UUID_Type,
+ const Include_UUID_t* Include_UUID,
+ uint16_t* Include_Handle );
+
+/**
+ * @brief ACI_GATT_ADD_CHAR
+ * Adds a characteristic to a service.
+ * The command returns the handle of the declaration attribute. The attribute
+ * that holds the Characteristic Value is always allocated at the next handle
+ * (Char_Handle + 1). The Characteristic Value is immediately followed, in
+ * order, by:
+ * - the Server Characteristic Configuration descriptor if CHAR_PROP_BROADCAST
+ * is selected;
+ * - the Client Characteristic Configuration descriptor if CHAR_PROP_NOTIFY or
+ * CHAR_PROP_INDICATE properties is selected;
+ * - the Characteristic Extended Properties descriptor if CHAR_PROP_EXT is
+ * selected.
+ * For instance, if CHAR_PROP_NOTIFY is selected but not CHAR_PROP_BROADCAST
+ * nor CHAR_PROP_EXT, then the Client Characteristic Configuration attribute
+ * handle is Char_Handle + 2.
+ * Additional descriptors can be added to the characteristic by calling the
+ * ACI_GATT_ADD_CHAR_DESC command immediately after calling this command.
+ *
+ * @param Service_Handle Handle of the Service to which the characteristic will
+ * be added
+ * @param Char_UUID_Type UUID type: 0x01 = 16 bits UUID while 0x02 = 128 bits
+ * UUID
+ * @param Char_UUID See @ref Char_UUID_t
+ * @param Char_Value_Length Maximum length of the characteristic value.
+ * @param Char_Properties Characteristic Properties (Core Specification [Vol 3,
+ * Part G, 3.3.1.1])
+ * Flags:
+ * - 0x00: CHAR_PROP_NONE
+ * - 0x01: CHAR_PROP_BROADCAST (Broadcast)
+ * - 0x02: CHAR_PROP_READ (Read)
+ * - 0x04: CHAR_PROP_WRITE_WITHOUT_RESP (Write w/o resp)
+ * - 0x08: CHAR_PROP_WRITE (Write)
+ * - 0x10: CHAR_PROP_NOTIFY (Notify)
+ * - 0x20: CHAR_PROP_INDICATE (Indicate)
+ * - 0x40: CHAR_PROP_SIGNED_WRITE (Authenticated Signed Writes)
+ * - 0x80: CHAR_PROP_EXT (Extended Properties)
+ * @param Security_Permissions Security permission flags.
+ * Flags:
+ * - 0x00: None
+ * - 0x01: AUTHEN_READ (Need authentication to read)
+ * - 0x02: AUTHOR_READ (Need authorization to read)
+ * - 0x04: ENCRY_READ (Need encryption to read)
+ * - 0x08: AUTHEN_WRITE (need authentication to write)
+ * - 0x10: AUTHOR_WRITE (need authorization to write)
+ * - 0x20: ENCRY_WRITE (need encryption to write)
+ * @param GATT_Evt_Mask GATT event mask.
+ * Flags:
+ * - 0x00: GATT_DONT_NOTIFY_EVENTS
+ * - 0x01: GATT_NOTIFY_ATTRIBUTE_WRITE
+ * - 0x02: GATT_NOTIFY_WRITE_REQ_AND_WAIT_FOR_APPL_RESP
+ * - 0x04: GATT_NOTIFY_READ_REQ_AND_WAIT_FOR_APPL_RESP
+ * - 0x08: GATT_NOTIFY_NOTIFICATION_COMPLETION
+ * @param Enc_Key_Size Minimum encryption key size required to read the
+ * characteristic.
+ * Values:
+ * - 0x07 ... 0x10
+ * @param Is_Variable Specify if the characteristic value has a fixed length or
+ * a variable length.
+ * Values:
+ * - 0x00: Fixed length
+ * - 0x01: Variable length
+ * @param[out] Char_Handle Handle of the characteristic that has been added (it
+ * is the handle of the characteristic declaration).
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_add_char( uint16_t Service_Handle,
+ uint8_t Char_UUID_Type,
+ const Char_UUID_t* Char_UUID,
+ uint16_t Char_Value_Length,
+ uint8_t Char_Properties,
+ uint8_t Security_Permissions,
+ uint8_t GATT_Evt_Mask,
+ uint8_t Enc_Key_Size,
+ uint8_t Is_Variable,
+ uint16_t* Char_Handle );
+
+/**
+ * @brief ACI_GATT_ADD_CHAR_DESC
+ * Adds a characteristic descriptor to a service.
+ * Note that this command allocates the new handle for the descriptor after the
+ * currently allocated handles. It is therefore advisable to call this command
+ * following the call of the command ACI_GATT_ADD_CHAR which created the
+ * characteristic containing this descriptor.
+ *
+ * @param Service_Handle Handle of service to which the characteristic belongs
+ * @param Char_Handle Handle of the characteristic to which description has to
+ * be added
+ * @param Char_Desc_Uuid_Type UUID type: 0x01 = 16 bits UUID while 0x02 = 128
+ * bits UUID
+ * @param Char_Desc_Uuid See @ref Char_Desc_Uuid_t
+ * @param Char_Desc_Value_Max_Len The maximum length of the descriptor value
+ * @param Char_Desc_Value_Length Current Length of the characteristic
+ * descriptor value
+ * @param Char_Desc_Value Value of the characteristic description
+ * @param Security_Permissions Security permission flags.
+ * Flags:
+ * - 0x00: None
+ * - 0x01: AUTHEN_READ (Need authentication to read)
+ * - 0x02: AUTHOR_READ (Need authorization to read)
+ * - 0x04: ENCRY_READ (Need encryption to read)
+ * - 0x08: AUTHEN_WRITE (need authentication to write)
+ * - 0x10: AUTHOR_WRITE (need authorization to write)
+ * - 0x20: ENCRY_WRITE (need encryption to write)
+ * @param Access_Permissions Access permission
+ * Flags:
+ * - 0x00: None
+ * - 0x01: READ
+ * - 0x02: WRITE
+ * - 0x04: WRITE_WO_RESP
+ * - 0x08: SIGNED_WRITE
+ * @param GATT_Evt_Mask GATT event mask.
+ * Flags:
+ * - 0x00: GATT_DONT_NOTIFY_EVENTS
+ * - 0x01: GATT_NOTIFY_ATTRIBUTE_WRITE
+ * - 0x02: GATT_NOTIFY_WRITE_REQ_AND_WAIT_FOR_APPL_RESP
+ * - 0x04: GATT_NOTIFY_READ_REQ_AND_WAIT_FOR_APPL_RESP
+ * @param Enc_Key_Size Minimum encryption key size required to read the
+ * characteristic.
+ * Values:
+ * - 0x07 ... 0x10
+ * @param Is_Variable Specify if the characteristic value has a fixed length or
+ * a variable length.
+ * Values:
+ * - 0x00: Fixed length
+ * - 0x01: Variable length
+ * @param[out] Char_Desc_Handle Handle of the characteristic descriptor
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_add_char_desc( uint16_t Service_Handle,
+ uint16_t Char_Handle,
+ uint8_t Char_Desc_Uuid_Type,
+ const Char_Desc_Uuid_t* Char_Desc_Uuid,
+ uint8_t Char_Desc_Value_Max_Len,
+ uint8_t Char_Desc_Value_Length,
+ const uint8_t* Char_Desc_Value,
+ uint8_t Security_Permissions,
+ uint8_t Access_Permissions,
+ uint8_t GATT_Evt_Mask,
+ uint8_t Enc_Key_Size,
+ uint8_t Is_Variable,
+ uint16_t* Char_Desc_Handle );
+
+/**
+ * @brief ACI_GATT_UPDATE_CHAR_VALUE
+ * Updates a characteristic value in a service. If notifications (or
+ * indications) are enabled on that characteristic, a notification (or
+ * indication) is sent to any client that has registered for notifications (or
+ * indications) via the Client Characteristic Configuration.
+ * Notes:
+ * - The command is disallowed if it would cause the generation of an
+ * indication on a bearer which is still awaiting confirmation of a previous
+ * indication.
+ * - The command does not execute and returns BLE_STATUS_BUSY if notifications
+ * from a previous call are not completed. The application can enable and wait
+ * for the event ACI_GATT_NOTIFICATION_COMPLETE_EVENT to avoid this case.
+ * - The command does not execute and returns BLE_STATUS_INSUFFICIENT_RESOURCES
+ * if there is no more room in the TX pool to allocate notification (or
+ * indication) packets. This happens if notifications (or indications) are
+ * enabled and the application calls this command at an higher rate than what
+ * is allowed by the link. Throughput on BLE link depends on connection
+ * interval and connection length parameters (decided by the Central, see
+ * ACI_L2CAP_CONNECTION_PARAMETER_UPDATE_REQ for more information on how to
+ * suggest new connection parameters from a Peripheral). The application can
+ * wait for the event ACI_GATT_TX_POOL_AVAILABLE_EVENT before retrying a call
+ * to this command. It can also retry the call until it does not return
+ * BLE_STATUS_INSUFFICIENT_RESOURCES anymore.
+ * - When calling this command, the characteristic value is updated only if the
+ * command returns BLE_STATUS_SUCCESS or BLE_STATUS_SEC_PERMISSION_ERROR. The
+ * security permission error means that at least one client has not been
+ * notified due to security requirements not met.
+ *
+ * @param Service_Handle Handle of service to which the characteristic belongs
+ * @param Char_Handle Handle of the characteristic declaration
+ * @param Val_Offset The offset from which the attribute value has to be
+ * updated.
+ * If this is set to 0 and the attribute value is of variable length,
+ * then the length of the attribute will be set to the
+ * Char_Value_Length.
+ * If the Val_Offset is set to a value greater than 0, then the length
+ * of the attribute will be set to the maximum length as specified for
+ * the attribute while adding the characteristic.
+ * @param Char_Value_Length Length of the Char_Value parameter in octets.
+ * This value must not exceed (BLE_CMD_MAX_PARAM_LEN - 6) i.e. 249 for
+ * BLE_CMD_MAX_PARAM_LEN default value.
+ * @param Char_Value Characteristic value
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_update_char_value( uint16_t Service_Handle,
+ uint16_t Char_Handle,
+ uint8_t Val_Offset,
+ uint8_t Char_Value_Length,
+ const uint8_t* Char_Value );
+
+/**
+ * @brief ACI_GATT_DEL_CHAR
+ * Deletes the specified characteristic from the service.
+ *
+ * @param Serv_Handle Handle of service to which the characteristic belongs
+ * @param Char_Handle Handle of the characteristic which has to be deleted
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_del_char( uint16_t Serv_Handle,
+ uint16_t Char_Handle );
+
+/**
+ * @brief ACI_GATT_DEL_SERVICE
+ * Deletes the specified service from the GATT server database.
+ *
+ * @param Serv_Handle Handle of the service to be deleted
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_del_service( uint16_t Serv_Handle );
+
+/**
+ * @brief ACI_GATT_DEL_INCLUDE_SERVICE
+ * Deletes the Include definition from the service.
+ *
+ * @param Serv_Handle Handle of the service to which the include service
+ * belongs
+ * @param Include_Handle Handle of the included service which has to be deleted
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_del_include_service( uint16_t Serv_Handle,
+ uint16_t Include_Handle );
+
+/**
+ * @brief ACI_GATT_SET_EVENT_MASK
+ * Masks events from the GATT. If the bit in the GATT_Evt_Mask is set to a one,
+ * then the event associated with that bit will be enabled.
+ *
+ * @param GATT_Evt_Mask ACI GATT/ATT event mask. Default: 0x000FFFFF.
+ * Values:
+ * - 0x00000001: ACI_GATT_ATTRIBUTE_MODIFIED_EVENT
+ * - 0x00000002: ACI_GATT_PROC_TIMEOUT_EVENT
+ * - 0x00000004: ACI_ATT_EXCHANGE_MTU_RESP_EVENT
+ * - 0x00000008: ACI_ATT_FIND_INFO_RESP_EVENT
+ * - 0x00000010: ACI_ATT_FIND_BY_TYPE_VALUE_RESP_EVENT
+ * - 0x00000020: ACI_ATT_READ_BY_TYPE_RESP_EVENT
+ * - 0x00000040: ACI_ATT_READ_RESP_EVENT
+ * - 0x00000080: ACI_ATT_READ_BLOB_RESP_EVENT
+ * - 0x00000100: ACI_ATT_READ_MULTIPLE_RESP_EVENT
+ * - 0x00000200: ACI_ATT_READ_BY_GROUP_TYPE_RESP_EVENT
+ * - 0x00000800: ACI_ATT_PREPARE_WRITE_RESP_EVENT
+ * - 0x00001000: ACI_ATT_EXEC_WRITE_RESP_EVENT
+ * - 0x00002000: ACI_GATT_INDICATION_EVENT
+ * - 0x00004000: ACI_GATT_NOTIFICATION_EVENT
+ * - 0x00008000: ACI_GATT_ERROR_RESP_EVENT
+ * - 0x00010000: ACI_GATT_PROC_COMPLETE_EVENT
+ * - 0x00020000: ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_EVENT
+ * - 0x00040000: ACI_GATT_TX_POOL_AVAILABLE_EVENT
+ * - 0x00100000: ACI_GATT_READ_EXT_EVENT
+ * - 0x00200000: ACI_GATT_INDICATION_EXT_EVENT
+ * - 0x00400000: ACI_GATT_NOTIFICATION_EXT_EVENT
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_set_event_mask( uint32_t GATT_Evt_Mask );
+
+/**
+ * @brief ACI_GATT_EXCHANGE_CONFIG
+ * Performs an ATT MTU exchange procedure.
+ * When the ATT MTU exchange procedure is completed, a
+ * ACI_ATT_EXCHANGE_MTU_RESP_EVENT event is generated. A
+ * ACI_GATT_PROC_COMPLETE_EVENT event is also generated to indicate the end of
+ * the procedure.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_exchange_config( uint16_t Connection_Handle );
+
+/**
+ * @brief ACI_ATT_FIND_INFO_REQ
+ * Sends a Find Information Request.
+ * This command is used to obtain the mapping of attribute handles with their
+ * associated types. The responses of the procedure are given through the
+ * ACI_ATT_FIND_INFO_RESP_EVENT event. The end of the procedure is indicated by
+ * a ACI_GATT_PROC_COMPLETE_EVENT event.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Start_Handle First requested handle number
+ * @param End_Handle Last requested handle number
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_att_find_info_req( uint16_t Connection_Handle,
+ uint16_t Start_Handle,
+ uint16_t End_Handle );
+
+/**
+ * @brief ACI_ATT_FIND_BY_TYPE_VALUE_REQ
+ * Sends a Find By Type Value Request
+ * The Find By Type Value Request is used to obtain the handles of attributes
+ * that have a given 16-bit UUID attribute type and a given attribute value.
+ * The responses of the procedure are given through the
+ * ACI_ATT_FIND_BY_TYPE_VALUE_RESP_EVENT event.
+ * The end of the procedure is indicated by a ACI_GATT_PROC_COMPLETE_EVENT
+ * event.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Start_Handle First requested handle number
+ * @param End_Handle Last requested handle number
+ * @param UUID 2 octet UUID to find (little-endian)
+ * @param Attribute_Val_Length Length of attribute value (maximum value is
+ * ATT_MTU - 7).
+ * @param Attribute_Val Attribute value to find
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_att_find_by_type_value_req( uint16_t Connection_Handle,
+ uint16_t Start_Handle,
+ uint16_t End_Handle,
+ uint16_t UUID,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val );
+
+/**
+ * @brief ACI_ATT_READ_BY_TYPE_REQ
+ * Sends a Read By Type Request.
+ * The Read By Type Request is used to obtain the values of attributes where
+ * the attribute type is known but the handle is not known.
+ * The responses are given through the ACI_ATT_READ_BY_TYPE_RESP_EVENT event.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Start_Handle First requested handle number
+ * @param End_Handle Last requested handle number
+ * @param UUID_Type UUID type: 0x01 = 16 bits UUID while 0x02 = 128 bits UUID
+ * @param UUID See @ref UUID_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_att_read_by_type_req( uint16_t Connection_Handle,
+ uint16_t Start_Handle,
+ uint16_t End_Handle,
+ uint8_t UUID_Type,
+ const UUID_t* UUID );
+
+/**
+ * @brief ACI_ATT_READ_BY_GROUP_TYPE_REQ
+ * Sends a Read By Group Type Request.
+ * The Read By Group Type Request is used to obtain the values of grouping
+ * attributes where the attribute type is known but the handle is not known.
+ * Grouping attributes are defined at GATT layer. The grouping attribute types
+ * are: "Primary Service", "Secondary Service" and "Characteristic".
+ * The responses of the procedure are given through the
+ * ACI_ATT_READ_BY_GROUP_TYPE_RESP_EVENT event.
+ * The end of the procedure is indicated by a ACI_GATT_PROC_COMPLETE_EVENT.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Start_Handle First requested handle number
+ * @param End_Handle Last requested handle number
+ * @param UUID_Type UUID type: 0x01 = 16 bits UUID while 0x02 = 128 bits UUID
+ * @param UUID See @ref UUID_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_att_read_by_group_type_req( uint16_t Connection_Handle,
+ uint16_t Start_Handle,
+ uint16_t End_Handle,
+ uint8_t UUID_Type,
+ const UUID_t* UUID );
+
+/**
+ * @brief ACI_ATT_PREPARE_WRITE_REQ
+ * Sends a Prepare Write Request.
+ * The Prepare Write Request is used to request the server to prepare to write
+ * the value of an attribute.
+ * The responses of the procedure are given through the
+ * ACI_ATT_PREPARE_WRITE_RESP_EVENT event.
+ * The end of the procedure is indicated by a ACI_GATT_PROC_COMPLETE_EVENT.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Attr_Handle Handle of the attribute to be written
+ * @param Val_Offset The offset of the first octet to be written
+ * @param Attribute_Val_Length Length of attribute value (maximum value is
+ * ATT_MTU - 5).
+ * @param Attribute_Val The value of the attribute to be written
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_att_prepare_write_req( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint16_t Val_Offset,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val );
+
+/**
+ * @brief ACI_ATT_EXECUTE_WRITE_REQ
+ * Sends an Execute Write Request.
+ * The Execute Write Request is used to request the server to write or cancel
+ * the write of all the prepared values currently held in the prepare queue
+ * from this client.
+ * The result of the procedure is given through the
+ * ACI_ATT_EXEC_WRITE_RESP_EVENT event.
+ * The end of the procedure is indicated by a ACI_GATT_PROC_COMPLETE_EVENT
+ * event.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Execute Execute or cancel writes.
+ * Values:
+ * - 0x00: Cancel all prepared writes
+ * - 0x01: Immediately write all pending prepared values
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_att_execute_write_req( uint16_t Connection_Handle,
+ uint8_t Execute );
+
+/**
+ * @brief ACI_GATT_DISC_ALL_PRIMARY_SERVICES
+ * Starts the GATT client procedure to discover all primary services on the
+ * server.
+ * The responses of the procedure are given through the
+ * ACI_ATT_READ_BY_GROUP_TYPE_RESP_EVENT event.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_disc_all_primary_services( uint16_t Connection_Handle );
+
+/**
+ * @brief ACI_GATT_DISC_PRIMARY_SERVICE_BY_UUID
+ * Starts the procedure to discover the primary services of the specified UUID
+ * on the server.
+ * The responses of the procedure are given through the
+ * ACI_ATT_FIND_BY_TYPE_VALUE_RESP_EVENT event.
+ * The end of the procedure is indicated by a ACI_GATT_PROC_COMPLETE_EVENT
+ * event.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param UUID_Type UUID type: 0x01 = 16 bits UUID while 0x02 = 128 bits UUID
+ * @param UUID See @ref UUID_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_disc_primary_service_by_uuid( uint16_t Connection_Handle,
+ uint8_t UUID_Type,
+ const UUID_t* UUID );
+
+/**
+ * @brief ACI_GATT_FIND_INCLUDED_SERVICES
+ * Starts the procedure to find all included services.
+ * The responses of the procedure are given through the
+ * ACI_ATT_READ_BY_TYPE_RESP_EVENT event.
+ * The end of the procedure is indicated by a ACI_GATT_PROC_COMPLETE_EVENT
+ * event.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Start_Handle Start attribute handle of the service
+ * @param End_Handle End attribute handle of the service
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_find_included_services( uint16_t Connection_Handle,
+ uint16_t Start_Handle,
+ uint16_t End_Handle );
+
+/**
+ * @brief ACI_GATT_DISC_ALL_CHAR_OF_SERVICE
+ * Starts the procedure to discover all the characteristics of a given service.
+ * When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is
+ * generated. Before procedure completion the response packets are given
+ * through ACI_ATT_READ_BY_TYPE_RESP_EVENT event.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Start_Handle Start attribute handle of the service
+ * @param End_Handle End attribute handle of the service
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_disc_all_char_of_service( uint16_t Connection_Handle,
+ uint16_t Start_Handle,
+ uint16_t End_Handle );
+
+/**
+ * @brief ACI_GATT_DISC_CHAR_BY_UUID
+ * Starts the procedure to discover all the characteristics specified by a
+ * UUID.
+ * When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is
+ * generated. Before procedure completion the response packets are given
+ * through ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_EVENT event.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Start_Handle Start attribute handle of the service
+ * @param End_Handle End attribute handle of the service
+ * @param UUID_Type UUID type: 0x01 = 16 bits UUID while 0x02 = 128 bits UUID
+ * @param UUID See @ref UUID_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_disc_char_by_uuid( uint16_t Connection_Handle,
+ uint16_t Start_Handle,
+ uint16_t End_Handle,
+ uint8_t UUID_Type,
+ const UUID_t* UUID );
+
+/**
+ * @brief ACI_GATT_DISC_ALL_CHAR_DESC
+ * Starts the procedure to discover all characteristic descriptors within a
+ * characteristic definition.
+ * When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is
+ * generated. Before procedure completion the response packets are given
+ * through ACI_ATT_FIND_INFO_RESP_EVENT event.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Char_Handle Handle of the characteristic value
+ * @param End_Handle End handle of the characteristic
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_disc_all_char_desc( uint16_t Connection_Handle,
+ uint16_t Char_Handle,
+ uint16_t End_Handle );
+
+/**
+ * @brief ACI_GATT_READ_CHAR_VALUE
+ * Starts the procedure to read the attribute value.
+ * When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is
+ * generated. Before procedure completion the response packet is given through
+ * ACI_ATT_READ_RESP_EVENT event.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attr_Handle Handle of the characteristic value to be read
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_read_char_value( uint16_t Connection_Handle,
+ uint16_t Attr_Handle );
+
+/**
+ * @brief ACI_GATT_READ_USING_CHAR_UUID
+ * This command sends a Read By Type Request packet to the server in order to
+ * read the value attribute of the characteristics specified by the UUID.
+ * When the procedure is completed, an ACI_GATT_PROC_COMPLETE_EVENT event is
+ * generated. Before procedure completion, the response packet is given through
+ * one ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_EVENT event per reported attribute.
+ * Note: the number of bytes of a value reported by
+ * ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_EVENT event cannot exceed
+ * BLE_EVT_MAX_PARAM_LEN - 7 i.e. 248 bytes for default value of
+ * BLE_EVT_MAX_PARAM_LEN.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Start_Handle Starting handle of the range to be searched
+ * @param End_Handle End handle of the range to be searched
+ * @param UUID_Type UUID type: 0x01 = 16 bits UUID while 0x02 = 128 bits UUID
+ * @param UUID See @ref UUID_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_read_using_char_uuid( uint16_t Connection_Handle,
+ uint16_t Start_Handle,
+ uint16_t End_Handle,
+ uint8_t UUID_Type,
+ const UUID_t* UUID );
+
+/**
+ * @brief ACI_GATT_READ_LONG_CHAR_VALUE
+ * Starts the procedure to read a long characteristic value.
+ * When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is
+ * generated. Before procedure completion the response packets are given
+ * through ACI_ATT_READ_BLOB_RESP_EVENT event.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attr_Handle Handle of the characteristic value to be read
+ * @param Val_Offset Offset from which the value needs to be read
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_read_long_char_value( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint16_t Val_Offset );
+
+/**
+ * @brief ACI_GATT_READ_MULTIPLE_CHAR_VALUE
+ * Starts a procedure to read multiple characteristic values from a server.
+ * The command must specify the handles of the characteristic values to be
+ * read.
+ * When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is
+ * generated. Before procedure completion the response packets are given
+ * through ACI_ATT_READ_MULTIPLE_RESP_EVENT event.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Number_of_Handles Number of handles in the following table
+ * Values:
+ * - 0x02 ... 0x7E
+ * @param Handle_Entry See @ref Handle_Entry_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_read_multiple_char_value( uint16_t Connection_Handle,
+ uint8_t Number_of_Handles,
+ const Handle_Entry_t* Handle_Entry );
+
+/**
+ * @brief ACI_GATT_WRITE_CHAR_VALUE
+ * Starts the procedure to write a characteristic value.
+ * When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is
+ * generated.
+ * The length of the value to be written must not exceed (ATT_MTU - 3).
+ * It must also not exceed (BLE_CMD_MAX_PARAM_LEN - 5) i.e. 250 for
+ * BLE_CMD_MAX_PARAM_LEN default value.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attr_Handle Handle of the characteristic value to be written
+ * @param Attribute_Val_Length Length of the value to be written
+ * @param Attribute_Val Value to be written
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_write_char_value( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val );
+
+/**
+ * @brief ACI_GATT_WRITE_LONG_CHAR_VALUE
+ * Starts the procedure to write a long characteristic value.
+ * When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is
+ * generated. During the procedure, ACI_ATT_PREPARE_WRITE_RESP_EVENT and
+ * ACI_ATT_EXEC_WRITE_RESP_EVENT events are raised.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attr_Handle Handle of the characteristic value to be written
+ * @param Val_Offset Offset at which the attribute has to be written
+ * @param Attribute_Val_Length Length of the value to be written.
+ * This value must not exceed (BLE_CMD_MAX_PARAM_LEN - 7) i.e. 248 for
+ * BLE_CMD_MAX_PARAM_LEN default value.
+ * @param Attribute_Val Value to be written
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_write_long_char_value( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint16_t Val_Offset,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val );
+
+/**
+ * @brief ACI_GATT_WRITE_CHAR_RELIABLE
+ * Starts the procedure to write a characteristic reliably.
+ * When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is
+ * generated. During the procedure, ACI_ATT_PREPARE_WRITE_RESP_EVENT and
+ * ACI_ATT_EXEC_WRITE_RESP_EVENT events are raised.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attr_Handle Handle of the attribute to be written
+ * @param Val_Offset Offset at which the attribute has to be written
+ * @param Attribute_Val_Length Length of the value to be written.
+ * This value must not exceed (BLE_CMD_MAX_PARAM_LEN - 7) i.e. 248 for
+ * BLE_CMD_MAX_PARAM_LEN default value.
+ * @param Attribute_Val Value to be written
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_write_char_reliable( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint16_t Val_Offset,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val );
+
+/**
+ * @brief ACI_GATT_WRITE_LONG_CHAR_DESC
+ * Starts the procedure to write a long characteristic descriptor.
+ * When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is
+ * generated. During the procedure, ACI_ATT_PREPARE_WRITE_RESP_EVENT and
+ * ACI_ATT_EXEC_WRITE_RESP_EVENT events are raised.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attr_Handle Handle of the attribute to be written
+ * @param Val_Offset Offset at which the attribute has to be written
+ * @param Attribute_Val_Length Length of the value to be written.
+ * This value must not exceed (BLE_CMD_MAX_PARAM_LEN - 7) i.e. 248 for
+ * BLE_CMD_MAX_PARAM_LEN default value.
+ * @param Attribute_Val Value to be written
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_write_long_char_desc( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint16_t Val_Offset,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val );
+
+/**
+ * @brief ACI_GATT_READ_LONG_CHAR_DESC
+ * Starts the procedure to read a long characteristic value.
+ * When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is
+ * generated. Before procedure completion the response packets are given
+ * through ACI_ATT_READ_BLOB_RESP_EVENT event.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attr_Handle Handle of the characteristic descriptor
+ * @param Val_Offset Offset from which the value needs to be read
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_read_long_char_desc( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint16_t Val_Offset );
+
+/**
+ * @brief ACI_GATT_WRITE_CHAR_DESC
+ * Starts the procedure to write a characteristic descriptor.
+ * When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is
+ * generated.
+ * The length of the value to be written must not exceed (ATT_MTU - 3).
+ * It must also not exceed (BLE_CMD_MAX_PARAM_LEN - 5) i.e. 250 for
+ * BLE_CMD_MAX_PARAM_LEN default value.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attr_Handle Handle of the attribute to be written
+ * @param Attribute_Val_Length Length of the value to be written
+ * @param Attribute_Val Value to be written
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_write_char_desc( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val );
+
+/**
+ * @brief ACI_GATT_READ_CHAR_DESC
+ * Starts the procedure to read the descriptor specified.
+ * When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is
+ * generated.
+ * Before procedure completion the response packet is given through
+ * ACI_ATT_READ_RESP_EVENT event.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attr_Handle Handle of the descriptor to be read
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_read_char_desc( uint16_t Connection_Handle,
+ uint16_t Attr_Handle );
+
+/**
+ * @brief ACI_GATT_WRITE_WITHOUT_RESP
+ * Starts the procedure to write a characteristic value without waiting for any
+ * response from the server. No events are generated after this command is
+ * executed.
+ * The length of the value to be written must not exceed (ATT_MTU - 3).
+ * It must also not exceed (BLE_CMD_MAX_PARAM_LEN - 5) i.e. 250 for
+ * BLE_CMD_MAX_PARAM_LEN default value.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attr_Handle Handle of the characteristic value to be written
+ * @param Attribute_Val_Length Length of the value to be written
+ * @param Attribute_Val Value to be written
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_write_without_resp( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val );
+
+/**
+ * @brief ACI_GATT_SIGNED_WRITE_WITHOUT_RESP
+ * Starts a signed write without response from the server.
+ * The procedure is used to write a characteristic value with an authentication
+ * signature without waiting for any response from the server. It cannot be
+ * used when the link is encrypted.
+ * The length of the value to be written must not exceed (ATT_MTU - 15).
+ * It must also not exceed (BLE_CMD_MAX_PARAM_LEN - 5) i.e. 250 for
+ * BLE_CMD_MAX_PARAM_LEN default value.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Attr_Handle Handle of the characteristic value to be written
+ * @param Attribute_Val_Length Length of the value to be written
+ * @param Attribute_Val Value to be written
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_signed_write_without_resp( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val );
+
+/**
+ * @brief ACI_GATT_CONFIRM_INDICATION
+ * Allow application to confirm indication. This command has to be sent when
+ * the application receives the event ACI_GATT_INDICATION_EVENT.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_confirm_indication( uint16_t Connection_Handle );
+
+/**
+ * @brief ACI_GATT_WRITE_RESP
+ * Allow or reject a write request from a client.
+ * This command has to be sent by the application when it receives the
+ * ACI_GATT_WRITE_PERMIT_REQ_EVENT. If the write can be allowed, then the
+ * status and error code have to be set to 0. If the write cannot be allowed,
+ * then the status has to be set to 1 and the error code has to be set to the
+ * error code that has to be passed to the client.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Attr_Handle Handle of the attribute that was passed in the event
+ * ACI_GATT_WRITE_PERMIT_REQ_EVENT
+ * @param Write_status If the value can be written or not.
+ * Values:
+ * - 0x00: The value can be written to the attribute specified by
+ * attr_handle
+ * - 0x01: The value cannot be written to the attribute specified by the
+ * attr_handle
+ * @param Error_Code The error code that has to be passed to the client in case
+ * the write has to be rejected
+ * @param Attribute_Val_Length Length of the value to be written as passed in
+ * the event ACI_GATT_WRITE_PERMIT_REQ_EVENT
+ * @param Attribute_Val Value as passed in the event
+ * ACI_GATT_WRITE_PERMIT_REQ_EVENT
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_write_resp( uint16_t Connection_Handle,
+ uint16_t Attr_Handle,
+ uint8_t Write_status,
+ uint8_t Error_Code,
+ uint8_t Attribute_Val_Length,
+ const uint8_t* Attribute_Val );
+
+/**
+ * @brief ACI_GATT_ALLOW_READ
+ * Allow the GATT server to send a response to a read request from a client.
+ * The application has to send this command when it receives the
+ * ACI_GATT_READ_PERMIT_REQ_EVENT or ACI_GATT_READ_MULTI_PERMIT_REQ_EVENT. This
+ * command indicates to the stack that the response can be sent to the client.
+ * So if the application wishes to update any of the attributes before they are
+ * read by the client, it must update the characteristic values using the
+ * ACI_GATT_UPDATE_CHAR_VALUE and then give this command. The application
+ * should perform the required operations within 30 seconds. Otherwise the GATT
+ * procedure will be timeout.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_allow_read( uint16_t Connection_Handle );
+
+/**
+ * @brief ACI_GATT_SET_SECURITY_PERMISSION
+ * This command sets the security permission flags for the attribute handle
+ * specified. It can be used to change the default value of these flags after
+ * an attribute has been created.
+ *
+ * @param Serv_Handle Handle of the service which contains the attribute whose
+ * permission has to be modified
+ * @param Attr_Handle Handle of the attribute whose permission has to be
+ * modified
+ * @param Security_Permissions Security permission flags.
+ * Flags:
+ * - 0x00: None
+ * - 0x01: AUTHEN_READ (Need authentication to read)
+ * - 0x02: AUTHOR_READ (Need authorization to read)
+ * - 0x04: ENCRY_READ (Need encryption to read)
+ * - 0x08: AUTHEN_WRITE (need authentication to write)
+ * - 0x10: AUTHOR_WRITE (need authorization to write)
+ * - 0x20: ENCRY_WRITE (need encryption to write)
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_set_security_permission( uint16_t Serv_Handle,
+ uint16_t Attr_Handle,
+ uint8_t Security_Permissions );
+
+/**
+ * @brief ACI_GATT_SET_DESC_VALUE
+ * This command sets the value of the descriptor specified by Char_Desc_Handle.
+ *
+ * @param Serv_Handle Handle of the service which contains the characteristic
+ * descriptor
+ * @param Char_Handle Handle of the characteristic which contains the
+ * descriptor
+ * @param Char_Desc_Handle Handle of the descriptor whose value has to be set
+ * @param Val_Offset Offset from which the descriptor value has to be updated
+ * @param Char_Desc_Value_Length Length of the descriptor value
+ * @param Char_Desc_Value Descriptor value
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_set_desc_value( uint16_t Serv_Handle,
+ uint16_t Char_Handle,
+ uint16_t Char_Desc_Handle,
+ uint16_t Val_Offset,
+ uint8_t Char_Desc_Value_Length,
+ const uint8_t* Char_Desc_Value );
+
+/**
+ * @brief ACI_GATT_READ_HANDLE_VALUE
+ * Reads the value of the attribute handle specified from the local GATT
+ * database.
+ *
+ * @param Attr_Handle Handle of the attribute to read
+ * @param Offset Offset from which the value needs to be read
+ * @param Value_Length_Requested Maximum number of octets to be returned as
+ * attribute value
+ * @param[out] Length Length of the attribute value
+ * @param[out] Value_Length Length in octets of the Value parameter
+ * @param[out] Value Attribute value
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_read_handle_value( uint16_t Attr_Handle,
+ uint16_t Offset,
+ uint16_t Value_Length_Requested,
+ uint16_t* Length,
+ uint16_t* Value_Length,
+ uint8_t* Value );
+
+/**
+ * @brief ACI_GATT_UPDATE_CHAR_VALUE_EXT
+ * This command is a more flexible version of ACI_GATT_UPDATE_CHAR_VALUE to
+ * support update of long attribute up to 512 bytes and indicate selectively
+ * the generation of Indication/Notification.
+ * The description notes for the ACI_GATT_UPDATE_CHAR_VALUE command also apply
+ * here.
+ *
+ * @param Conn_Handle_To_Notify Specifies the client(s) to be notified.
+ * Values:
+ * - 0x0000: Notify all subscribed clients on their unenhanced ATT
+ * bearer
+ * - 0x0001 ... 0x0EFF: Notify one client on the specified unenhanced
+ * ATT bearer (the parameter is the connection handle)
+ * - 0xEA00 ... 0xEA3F: Notify one client on the specified enhanced ATT
+ * bearer (the LSB-byte of the parameter is the connection-oriented
+ * channel index)
+ * @param Service_Handle Handle of service to which the characteristic belongs
+ * @param Char_Handle Handle of the characteristic declaration
+ * @param Update_Type Allow Notification or Indication generation, if enabled
+ * in the client characteristic configuration descriptor
+ * Flags:
+ * - 0x00: Do not notify
+ * - 0x01: Notification
+ * - 0x02: Indication
+ * @param Char_Length Total length of the characteristic value.
+ * In case of a variable size characteristic, this field specifies the
+ * new length of the characteristic value after the update; in case of
+ * fixed length characteristic this field is ignored.
+ * @param Value_Offset The offset from which the attribute value has to be
+ * updated.
+ * @param Value_Length Length of the Value parameter in octets.
+ * This value must not exceed (BLE_CMD_MAX_PARAM_LEN - 12) i.e. 243 for
+ * BLE_CMD_MAX_PARAM_LEN default value.
+ * @param Value Updated characteristic value
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_update_char_value_ext( uint16_t Conn_Handle_To_Notify,
+ uint16_t Service_Handle,
+ uint16_t Char_Handle,
+ uint8_t Update_Type,
+ uint16_t Char_Length,
+ uint16_t Value_Offset,
+ uint8_t Value_Length,
+ const uint8_t* Value );
+
+/**
+ * @brief ACI_GATT_DENY_READ
+ * This command is used to deny the GATT server to send a response to a read
+ * request from a client.
+ * The application may send this command when it receives the
+ * ACI_GATT_READ_PERMIT_REQ_EVENT or ACI_GATT_READ_MULTI_PERMIT_REQ_EVENT.
+ * This command indicates to the stack that the client is not allowed to read
+ * the requested characteristic due to e.g. application restrictions.
+ * The Error code shall be either 0x08 (Insufficient Authorization) or a value
+ * in the range 0x80-0x9F (Application Error).
+ * The application should issue the ACI_GATT_DENY_READ or ACI_GATT_ALLOW_READ
+ * command within 30 seconds from the reception of the
+ * ACI_GATT_READ_PERMIT_REQ_EVENT or ACI_GATT_READ_MULTI_PERMIT_REQ_EVENT
+ * events; otherwise the GATT procedure issues a timeout.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Error_Code Error code for the command
+ * Values:
+ * - 0x08: Insufficient Authorization
+ * - 0x80 ... 0x9F: Application Error
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_deny_read( uint16_t Connection_Handle,
+ uint8_t Error_Code );
+
+/**
+ * @brief ACI_GATT_SET_ACCESS_PERMISSION
+ * This command sets the access permission for the attribute handle specified.
+ *
+ * @param Serv_Handle Handle of the service which contains the attribute whose
+ * permission has to be modified
+ * @param Attr_Handle Handle of the attribute whose permission has to be
+ * modified
+ * @param Access_Permissions Access permission
+ * Flags:
+ * - 0x00: None
+ * - 0x01: READ
+ * - 0x02: WRITE
+ * - 0x04: WRITE_WO_RESP
+ * - 0x08: SIGNED_WRITE
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_set_access_permission( uint16_t Serv_Handle,
+ uint16_t Attr_Handle,
+ uint8_t Access_Permissions );
+
+/**
+ * @brief ACI_GATT_STORE_DB
+ * This command forces the saving of the GATT database for all active
+ * connections. Note that, by default, the GATT database is saved per active
+ * connection at the time of disconnection.
+ *
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_store_db( void );
+
+/**
+ * @brief ACI_GATT_SEND_MULT_NOTIFICATION
+ * This command sends a Multiple Handle Value Notification over the ATT bearer
+ * specified in parameter. The handles provided as parameters must be the
+ * handles of the characteristic declarations.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Number_of_Handles Number of handles in the following table
+ * Values:
+ * - 0x02 ... 0x7E
+ * @param Handle_Entry See @ref Handle_Entry_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_send_mult_notification( uint16_t Connection_Handle,
+ uint8_t Number_of_Handles,
+ const Handle_Entry_t* Handle_Entry );
+
+/**
+ * @brief ACI_GATT_READ_MULTIPLE_VAR_CHAR_VALUE
+ * Starts a procedure to read multiple variable length characteristic values
+ * from a server.
+ * The command must specify the handles of the characteristic values to be
+ * read.
+ * When the procedure is completed, a ACI_GATT_PROC_COMPLETE_EVENT event is
+ * generated. Before procedure completion the response packets are given
+ * through ACI_ATT_READ_MULTIPLE_RESP_EVENT event.
+ *
+ * @param Connection_Handle Specifies the ATT bearer for which the command
+ * applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF: Unenhanced ATT bearer (the parameter is the
+ * connection handle)
+ * - 0xEA00 ... 0xEA3F: Enhanced ATT bearer (the LSB-byte of the
+ * parameter is the connection-oriented channel index)
+ * @param Number_of_Handles Number of handles in the following table
+ * Values:
+ * - 0x02 ... 0x7E
+ * @param Handle_Entry See @ref Handle_Entry_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_gatt_read_multiple_var_char_value( uint16_t Connection_Handle,
+ uint8_t Number_of_Handles,
+ const Handle_Entry_t* Handle_Entry );
+
+
+#endif /* BLE_GATT_ACI_H__ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_hal_aci.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_hal_aci.c
new file mode 100644
index 0000000..eeb59f0
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_hal_aci.c
@@ -0,0 +1,519 @@
+/*****************************************************************************
+ * @file ble_hal_aci.c
+ * @brief STM32WB BLE API (hal_aci)
+ * Auto-generated file: do not edit!
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#include "auto/ble_hal_aci.h"
+
+tBleStatus aci_hal_write_config_data( uint8_t Offset,
+ uint8_t Length,
+ const uint8_t* Value )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_hal_write_config_data_cp0 *cp0 = (aci_hal_write_config_data_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Offset = Offset;
+ index_input += 1;
+ cp0->Length = Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Value, (const void*)Value, Length );
+ index_input += Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x00c;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_hal_read_config_data( uint8_t Offset,
+ uint8_t* Data_Length,
+ uint8_t* Data )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_hal_read_config_data_cp0 *cp0 = (aci_hal_read_config_data_cp0*)(cmd_buffer);
+ aci_hal_read_config_data_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Offset = Offset;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x00d;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Data_Length = resp.Data_Length;
+ Osal_MemCpy( (void*)Data, (const void*)resp.Data, *Data_Length);
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_hal_set_tx_power_level( uint8_t En_High_Power,
+ uint8_t PA_Level )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_hal_set_tx_power_level_cp0 *cp0 = (aci_hal_set_tx_power_level_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->En_High_Power = En_High_Power;
+ index_input += 1;
+ cp0->PA_Level = PA_Level;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x00f;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_hal_le_tx_test_packet_number( uint32_t* Number_Of_Packets )
+{
+ struct hci_request rq;
+ aci_hal_le_tx_test_packet_number_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x014;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Number_Of_Packets = resp.Number_Of_Packets;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_hal_tone_start( uint8_t RF_Channel,
+ uint8_t Freq_offset )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_hal_tone_start_cp0 *cp0 = (aci_hal_tone_start_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->RF_Channel = RF_Channel;
+ index_input += 1;
+ cp0->Freq_offset = Freq_offset;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x015;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_hal_tone_stop( void )
+{
+ struct hci_request rq;
+ tBleStatus status = 0;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x016;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_hal_get_link_status( uint8_t* Link_Status,
+ uint16_t* Link_Connection_Handle )
+{
+ struct hci_request rq;
+ aci_hal_get_link_status_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x017;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ Osal_MemCpy( (void*)Link_Status, (const void*)resp.Link_Status, 8 );
+ Osal_MemCpy( (void*)Link_Connection_Handle, (const void*)resp.Link_Connection_Handle, 16 );
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_hal_set_radio_activity_mask( uint16_t Radio_Activity_Mask )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_hal_set_radio_activity_mask_cp0 *cp0 = (aci_hal_set_radio_activity_mask_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Radio_Activity_Mask = Radio_Activity_Mask;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x018;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_hal_get_anchor_period( uint32_t* Anchor_Period,
+ uint32_t* Max_Free_Slot )
+{
+ struct hci_request rq;
+ aci_hal_get_anchor_period_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x019;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Anchor_Period = resp.Anchor_Period;
+ *Max_Free_Slot = resp.Max_Free_Slot;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_hal_set_event_mask( uint32_t Event_Mask )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_hal_set_event_mask_cp0 *cp0 = (aci_hal_set_event_mask_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Event_Mask = Event_Mask;
+ index_input += 4;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x01a;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_hal_set_peripheral_latency( uint8_t Enable )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_hal_set_peripheral_latency_cp0 *cp0 = (aci_hal_set_peripheral_latency_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Enable = Enable;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x020;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_hal_read_rssi( uint8_t* RSSI )
+{
+ struct hci_request rq;
+ aci_hal_read_rssi_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x022;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *RSSI = resp.RSSI;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_hal_ead_encrypt_decrypt( uint8_t Mode,
+ const uint8_t* Key,
+ const uint8_t* IV,
+ uint16_t In_Data_Length,
+ const uint8_t* In_Data,
+ uint16_t* Out_Data_Length,
+ uint8_t* Out_Data )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_hal_ead_encrypt_decrypt_cp0 *cp0 = (aci_hal_ead_encrypt_decrypt_cp0*)(cmd_buffer);
+ aci_hal_ead_encrypt_decrypt_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Mode = Mode;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Key, (const void*)Key, 16 );
+ index_input += 16;
+ Osal_MemCpy( (void*)&cp0->IV, (const void*)IV, 8 );
+ index_input += 8;
+ cp0->In_Data_Length = In_Data_Length;
+ index_input += 2;
+ Osal_MemCpy( (void*)&cp0->In_Data, (const void*)In_Data, In_Data_Length );
+ index_input += In_Data_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x02f;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Out_Data_Length = resp.Out_Data_Length;
+ Osal_MemCpy( (void*)Out_Data, (const void*)resp.Out_Data, *Out_Data_Length);
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_hal_read_radio_reg( uint8_t Register_Address,
+ uint8_t* reg_val )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_hal_read_radio_reg_cp0 *cp0 = (aci_hal_read_radio_reg_cp0*)(cmd_buffer);
+ aci_hal_read_radio_reg_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Register_Address = Register_Address;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x030;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *reg_val = resp.reg_val;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_hal_write_radio_reg( uint8_t Register_Address,
+ uint8_t Register_Value )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_hal_write_radio_reg_cp0 *cp0 = (aci_hal_write_radio_reg_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Register_Address = Register_Address;
+ index_input += 1;
+ cp0->Register_Value = Register_Value;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x031;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_hal_read_raw_rssi( uint8_t* Value )
+{
+ struct hci_request rq;
+ aci_hal_read_raw_rssi_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x032;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ Osal_MemCpy( (void*)Value, (const void*)resp.Value, 3 );
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_hal_rx_start( uint8_t RF_Channel )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_hal_rx_start_cp0 *cp0 = (aci_hal_rx_start_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->RF_Channel = RF_Channel;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x033;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_hal_rx_stop( void )
+{
+ struct hci_request rq;
+ tBleStatus status = 0;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x034;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_reset( uint8_t Mode,
+ uint32_t Options )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_reset_cp0 *cp0 = (aci_reset_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Mode = Mode;
+ index_input += 1;
+ cp0->Options = Options;
+ index_input += 4;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x300;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_get_information( uint32_t* Version,
+ uint32_t* Options,
+ uint32_t* Debug_Info )
+{
+ struct hci_request rq;
+ aci_get_information_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x301;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ Osal_MemCpy( (void*)Version, (const void*)resp.Version, 8 );
+ *Options = resp.Options;
+ Osal_MemCpy( (void*)Debug_Info, (const void*)resp.Debug_Info, 12 );
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_write_config_data( uint8_t Offset,
+ uint8_t Length,
+ const uint8_t* Value )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_write_config_data_cp0 *cp0 = (aci_write_config_data_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Offset = Offset;
+ index_input += 1;
+ cp0->Length = Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Value, (const void*)Value, Length );
+ index_input += Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x302;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_read_config_data( uint8_t Offset,
+ uint8_t* Data_Length,
+ uint8_t* Data )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_read_config_data_cp0 *cp0 = (aci_read_config_data_cp0*)(cmd_buffer);
+ aci_read_config_data_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Offset = Offset;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x303;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Data_Length = resp.Data_Length;
+ Osal_MemCpy( (void*)Data, (const void*)resp.Data, *Data_Length);
+ return BLE_STATUS_SUCCESS;
+}
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_hal_aci.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_hal_aci.h
new file mode 100644
index 0000000..fd2660d
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_hal_aci.h
@@ -0,0 +1,478 @@
+/*****************************************************************************
+ * @file ble_hal_aci.h
+ * @brief STM32WB BLE API (HAL_ACI)
+ * Auto-generated file: do not edit!
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#ifndef BLE_HAL_ACI_H__
+#define BLE_HAL_ACI_H__
+
+
+#include "auto/ble_types.h"
+
+/**
+ * @brief ACI_HAL_WRITE_CONFIG_DATA
+ * This command writes a value to a configure data structure. It is useful to
+ * setup directly some parameters for the BLE stack.
+ * Refer to Annex for details on the different parameters that can be
+ * configured.
+ * Note: this command is an alias of ACI_WRITE_CONFIG_DATA.
+ *
+ * @param Offset Offset of the element in the configuration data structure
+ * which has to be written.
+ * Values:
+ * - 0x00: CONFIG_DATA_PUBLIC_ADDRESS_OFFSET;
+ * Bluetooth public address; 6 bytes
+ * - 0x08: CONFIG_DATA_ER_OFFSET;
+ * Encryption root key; 16 bytes
+ * - 0x18: CONFIG_DATA_IR_OFFSET;
+ * Identity root key; 16 bytes
+ * - 0x2E: CONFIG_DATA_RANDOM_ADDRESS_OFFSET;
+ * Static Random Address; 6 bytes
+ * - 0x34: CONFIG_DATA_GAP_ADD_REC_NBR_OFFSET;
+ * GAP service additional record number; 1 byte
+ * - 0x35: CONFIG_DATA_SC_KEY_TYPE_OFFSET;
+ * Secure Connections key type; 1 byte
+ * - 0xB0: CONFIG_DATA_SMP_MODE_OFFSET;
+ * SMP mode; 1 byte
+ * - 0xC0: CONFIG_DATA_LL_SCAN_CHAN_MAP_OFFSET;
+ * LL scan channel map; 1 byte
+ * - 0xC1: CONFIG_DATA_LL_BG_SCAN_MODE_OFFSET;
+ * LL background scan mode; 1 byte
+ * - 0xC3: CONFIG_DATA_LL_RPA_MODE_OFFSET;
+ * LL RPA mode; 1 byte
+ * - 0xD1: CONFIG_DATA_LL_MAX_DATA_EXT_OFFSET [only for full stack];
+ * LL maximum data length extension; 8 bytes
+ * @param Length Length of data to be written
+ * @param Value Data to be written
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_write_config_data( uint8_t Offset,
+ uint8_t Length,
+ const uint8_t* Value );
+
+/**
+ * @brief ACI_HAL_READ_CONFIG_DATA
+ * This command requests the value in the configure data structure. The number
+ * of read bytes changes for different Offset.
+ * Note: this command is an alias of ACI_READ_CONFIG_DATA.
+ *
+ * @param Offset Offset of the element in the configuration data structure
+ * which has to be read.
+ * Values:
+ * - 0x00: CONFIG_DATA_PUBLIC_ADDRESS_OFFSET;
+ * Bluetooth public address; 6 bytes
+ * - 0x08: CONFIG_DATA_ER_OFFSET;
+ * Encryption root key used to derive LTK (legacy) and CSRK; 16 bytes
+ * - 0x18: CONFIG_DATA_IR_OFFSET
+ * Identity root key used to derive DHK (legacy) and IRK; 16 bytes
+ * - 0x2E: CONFIG_DATA_RANDOM_ADDRESS_OFFSET;
+ * Static Random Address; 6 bytes
+ * @param[out] Data_Length Length of Data in octets
+ * @param[out] Data Data field associated with Offset parameter
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_read_config_data( uint8_t Offset,
+ uint8_t* Data_Length,
+ uint8_t* Data );
+
+/**
+ * @brief ACI_HAL_SET_TX_POWER_LEVEL
+ * This command sets the TX power level of the device. By controlling the PA
+ * level, that determines the output power level (dBm) at the IC pin.
+ * When the system starts up or reboots, the default TX power level is used,
+ * which is the maximum value. Once this command is given, the output power
+ * changes instantly, regardless if there is BLE communication going on or not.
+ * For example, for debugging purpose, the device can be set to advertise all
+ * the time. By using this command, one can then observe the evolution of the
+ * TX signal strength.
+ * The system keeps the last received TX power level from the command, i.e. the
+ * 2nd command overwrites the previous TX power level. The new TX power level
+ * remains until another ACI_HAL_SET_TX_POWER_LEVEL command, or the system
+ * reboots. However, note that the advertising extensions commands allow, per
+ * advertising set, to override the value of TX power determined by
+ * ACI_HAL_SET_TX_POWER_LEVEL command (e.g. see ACI_GAP_ADV_SET_CONFIGURATION).
+ * Refer to Annex for the dBm corresponding values of PA_Level parameter.
+ *
+ * @param En_High_Power Enable High Power mode - Deprecated and ignored
+ * Values:
+ * - 0x00: Standard Power
+ * - 0x01: High Power
+ * @param PA_Level Power amplifier output level.
+ * Values:
+ * - 0x00 ... 0x23
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_set_tx_power_level( uint8_t En_High_Power,
+ uint8_t PA_Level );
+
+/**
+ * @brief ACI_HAL_LE_TX_TEST_PACKET_NUMBER
+ * This command returns the number of packets sent in Direct Test Mode.
+ * When the Direct TX test is started, a 16-bit counter is used to count how
+ * many packets have been transmitted.
+ * This command can be used to check how many packets have been sent during the
+ * Direct TX test.
+ * The counter starts from 0 and counts upwards. The counter can wrap and start
+ * from 0 again. The counter is not cleared until the next Direct TX test
+ * starts.
+ *
+ * @param[out] Number_Of_Packets Number of packets sent during the last Direct
+ * TX test.
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_le_tx_test_packet_number( uint32_t* Number_Of_Packets );
+
+/**
+ * @brief ACI_HAL_TONE_START
+ * This command starts a carrier frequency, i.e. a tone, on a specific channel.
+ * The frequency sine wave at the specific channel may be used for debugging
+ * purpose only. The channel ID is a parameter from 0x00 to 0x27 for the 40 BLE
+ * channels, e.g. 0x00 for 2.402 GHz, 0x01 for 2.404 GHz etc.
+ * This command should not be used when normal BLE activities are ongoing.
+ * The tone should be stopped by ACI_HAL_TONE_STOP command.
+ *
+ * @param RF_Channel BLE Channel ID, from 0x00 to 0x27 meaning (2.402 +
+ * 0.002*0xXX) GHz
+ * Device will continuously emit 0s, that means that the tone will be at
+ * the channel center frequency minus the maximum frequency deviation
+ * (250 kHz).
+ * Values:
+ * - 0x00 ... 0x27
+ * @param Freq_offset Frequency Offset for tone channel
+ * Values:
+ * - 0x00 ... 0xFF
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_tone_start( uint8_t RF_Channel,
+ uint8_t Freq_offset );
+
+/**
+ * @brief ACI_HAL_TONE_STOP
+ * This command is used to stop the previously started ACI_HAL_TONE_START
+ * command.
+ *
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_tone_stop( void );
+
+/**
+ * @brief ACI_HAL_GET_LINK_STATUS
+ * This command returns the status of the 8 BLE links managed by the device.
+ *
+ * @param[out] Link_Status Array of link status (8 links). Each link status is
+ * 1 byte.
+ * Values:
+ * - 0x00: Idle
+ * - 0x01: Advertising
+ * - 0x02: Connected in Peripheral role
+ * - 0x03: Scanning
+ * - 0x04: Reserved
+ * - 0x05: Connected in Central role
+ * - 0x06: TX test mode
+ * - 0x07: RX test mode
+ * - 0x81: Advertising with Additional Beacon
+ * @param[out] Link_Connection_Handle Array of connection handles (2 bytes) for
+ * 8 links. Valid only if the link status is "connected" (0x02 or 0x05)
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_get_link_status( uint8_t* Link_Status,
+ uint16_t* Link_Connection_Handle );
+
+/**
+ * @brief ACI_HAL_SET_RADIO_ACTIVITY_MASK
+ * This command set the bitmask associated to
+ * ACI_HAL_END_OF_RADIO_ACTIVITY_EVENT.
+ * Only the radio activities enabled in the mask will be reported to
+ * application by ACI_HAL_END_OF_RADIO_ACTIVITY_EVENT
+ *
+ * @param Radio_Activity_Mask Bitmask of radio events
+ * Flags:
+ * - 0x0001: Idle
+ * - 0x0002: Advertising
+ * - 0x0004: Peripheral connection
+ * - 0x0008: Scanning
+ * - 0x0020: Central connection
+ * - 0x0040: TX test mode
+ * - 0x0080: RX test mode
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_set_radio_activity_mask( uint16_t Radio_Activity_Mask );
+
+/**
+ * @brief ACI_HAL_GET_ANCHOR_PERIOD
+ * This command returns information about the Anchor Period to help application
+ * in selecting slot timings when operating in multi-link scenarios.
+ *
+ * @param[out] Anchor_Period Current anchor period.
+ * T = N * 0.625 ms.
+ * @param[out] Max_Free_Slot Maximum available time that can be allocated for a
+ * new slot.
+ * T = N * 0.625 ms.
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_get_anchor_period( uint32_t* Anchor_Period,
+ uint32_t* Max_Free_Slot );
+
+/**
+ * @brief ACI_HAL_SET_EVENT_MASK
+ * This command is used to enable/disable the generation of HAL events. If the
+ * bit in the Event_Mask is set to a one, then the event associated with that
+ * bit will be enabled.
+ *
+ * @param Event_Mask ACI HAL event mask. Default: 0x00000000.
+ * Flags:
+ * - 0x00000000: No events specified (Default)
+ * - 0x00000001: ACI_HAL_SCAN_REQ_REPORT_EVENT
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_set_event_mask( uint32_t Event_Mask );
+
+/**
+ * @brief ACI_HAL_SET_PERIPHERAL_LATENCY
+ * This command is used to disable/enable the Peripheral latency feature during
+ * a connection. Note that, by default, the Peripheral latency is enabled at
+ * connection time.
+ *
+ * @param Enable Enable/disable Peripheral latency.
+ * Values:
+ * - 0x00: Peripheral latency is disabled
+ * - 0x01: Peripheral latency is enabled
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_set_peripheral_latency( uint8_t Enable );
+
+/**
+ * @brief ACI_HAL_READ_RSSI
+ * This command returns the value of the RSSI.
+ *
+ * @param[out] RSSI RSSI (signed integer).
+ * Units: dBm.
+ * Values:
+ * - 127: RSSI not available
+ * - -127 ... 20
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_read_rssi( uint8_t* RSSI );
+
+/**
+ * @brief ACI_HAL_EAD_ENCRYPT_DECRYPT
+ * This command encrypts or decrypts data following the Encrypted Advertising
+ * Data scheme.
+ * When encryption mode is selected, In_Data shall only contain the Payload
+ * field to encrypt. The command adds the Randomizer and MIC fields in the
+ * result. The result data length (Out_Data_Length) is equal to the input
+ * length plus 9.
+ * When decryption mode is selected, In_Data shall contain the full Encrypted
+ * Data (Randomizer + Payload + MIC). The result data length (Out_Data_Length)
+ * is equal to the input length minus 9.
+ * If the decryption fails, the returned status is BLE_STATUS_FAILED, otherwise
+ * it is BLE_STATUS_SUCCESS.
+ * Note: the In_Data_Length value must not exceed (BLE_CMD_MAX_PARAM_LEN - 27)
+ * i.e. 228 for BLE_CMD_MAX_PARAM_LEN default value.
+ *
+ * @param Mode EAD operation mode: encryption or decryption.
+ * Values:
+ * - 0x00: Encryption
+ * - 0x01: Decryption
+ * @param Key Session key used for EAD operation (in Little Endian format).
+ * @param IV Initialization vector used for EAD operation (in Little Endian
+ * format).
+ * @param In_Data_Length Length of input data
+ * @param In_Data Input data
+ * @param[out] Out_Data_Length Length of result data
+ * @param[out] Out_Data Result data
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_ead_encrypt_decrypt( uint8_t Mode,
+ const uint8_t* Key,
+ const uint8_t* IV,
+ uint16_t In_Data_Length,
+ const uint8_t* In_Data,
+ uint16_t* Out_Data_Length,
+ uint8_t* Out_Data );
+
+/**
+ * @brief ACI_HAL_READ_RADIO_REG
+ * This command Reads Register value from the RF module.
+ *
+ * @param Register_Address Address of the register to be read
+ * @param[out] reg_val Register value
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_read_radio_reg( uint8_t Register_Address,
+ uint8_t* reg_val );
+
+/**
+ * @brief ACI_HAL_WRITE_RADIO_REG
+ * This command writes Register value to the RF module.
+ *
+ * @param Register_Address Address of the register to be written
+ * @param Register_Value Value to be written
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_write_radio_reg( uint8_t Register_Address,
+ uint8_t Register_Value );
+
+/**
+ * @brief ACI_HAL_READ_RAW_RSSI
+ * This command returns the raw value of the RSSI.
+ *
+ * @param[out] Value RAW RSSI value
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_read_raw_rssi( uint8_t* Value );
+
+/**
+ * @brief ACI_HAL_RX_START
+ * This command does set up the RF to listen to a specific RF channel.
+ *
+ * @param RF_Channel BLE Channel ID, from 0x00 to 0x27 meaning (2.402 +
+ * 0.002*0xXX) GHz
+ * Device will continuously emit 0s, that means that the tone will be at
+ * the channel center frequency minus the maximum frequency deviation
+ * (250 kHz).
+ * Values:
+ * - 0x00 ... 0x27
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_rx_start( uint8_t RF_Channel );
+
+/**
+ * @brief ACI_HAL_RX_STOP
+ * This command stops a previous ACI_HAL_RX_START command.
+ *
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_hal_rx_stop( void );
+
+/**
+ * @brief ACI_RESET
+ * This command resets the BLE stack (Host and LE Controller).
+ *
+ * @param Mode ACI reset mode.
+ * Values:
+ * - 0x00: Reset without BLE stack options change
+ * - 0x01: Reset with BLE stack option changes
+ * @param Options New BLE stack options to set at ACI reset (a bit set to 1
+ * means that the corresponding optional feature is activated).
+ * Flags:
+ * - 0x00000001: LL only mode
+ * - 0x00000002: No service change description
+ * - 0x00000004: Device Name is read-only
+ * - 0x00000008: Support of Extended Advertising
+ * - 0x00000010: Support of Channel Selection Algorithm #2
+ * - 0x00000020: Reduced GATT database in NVM
+ * - 0x00000040: Support of GATT caching
+ * - 0x00000080: Support of LE Power Class 1 (flag not available in RCP
+ * mode)
+ * - 0x00000100: Appearance is writable
+ * - 0x00000200: Support of Enhanced ATT
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_reset( uint8_t Mode,
+ uint32_t Options );
+
+/**
+ * @brief ACI_GET_INFORMATION
+ * This command reads the local ACI information.
+ *
+ * @param[out] Version BLE stack version.
+ * @param[out] Options Current BLE stack options (a bit set to 1 means that the
+ * corresponding optional feature is activated).
+ * Flags:
+ * - 0x00000001: LL only mode
+ * - 0x00000002: No service change description
+ * - 0x00000004: Device Name is read-only
+ * - 0x00000008: Support of Extended Advertising
+ * - 0x00000010: Support of Channel Selection Algorithm #2
+ * - 0x00000020: Reduced GATT database in NVM
+ * - 0x00000040: Support of GATT caching
+ * - 0x00000080: Support of LE Power Class 1 (flag not available in RCP
+ * mode)
+ * - 0x00000100: Appearance is writable
+ * - 0x00000200: Support of Enhanced ATT
+ * @param[out] Debug_Info BLE stack debug information.
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_get_information( uint32_t* Version,
+ uint32_t* Options,
+ uint32_t* Debug_Info );
+
+/**
+ * @brief ACI_WRITE_CONFIG_DATA
+ * This command writes a value to a configure data structure. It is useful to
+ * setup directly some parameters for the BLE stack.
+ * Refer to Annex for details on the different parameters that can be
+ * configured.
+ *
+ * @param Offset Offset of the element in the configuration data structure
+ * which has to be written.
+ * Values:
+ * - 0x00: CONFIG_DATA_PUBLIC_ADDRESS_OFFSET;
+ * Bluetooth public address; 6 bytes
+ * - 0x08: CONFIG_DATA_ER_OFFSET;
+ * Encryption root key; 16 bytes
+ * - 0x18: CONFIG_DATA_IR_OFFSET;
+ * Identity root key; 16 bytes
+ * - 0x2E: CONFIG_DATA_RANDOM_ADDRESS_OFFSET;
+ * Static Random Address; 6 bytes
+ * - 0x34: CONFIG_DATA_GAP_ADD_REC_NBR_OFFSET;
+ * GAP service additional record number; 1 byte
+ * - 0x35: CONFIG_DATA_SC_KEY_TYPE_OFFSET;
+ * Secure Connections key type; 1 byte
+ * - 0xB0: CONFIG_DATA_SMP_MODE_OFFSET;
+ * SMP mode; 1 byte
+ * - 0xC0: CONFIG_DATA_LL_SCAN_CHAN_MAP_OFFSET;
+ * LL scan channel map; 1 byte
+ * - 0xC1: CONFIG_DATA_LL_BG_SCAN_MODE_OFFSET;
+ * LL background scan mode; 1 byte
+ * - 0xC3: CONFIG_DATA_LL_RPA_MODE_OFFSET;
+ * LL RPA mode; 1 byte
+ * - 0xD1: CONFIG_DATA_LL_MAX_DATA_EXT_OFFSET [only for full stack];
+ * LL maximum data length extension; 8 bytes
+ * @param Length Length of data to be written
+ * @param Value Data to be written
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_write_config_data( uint8_t Offset,
+ uint8_t Length,
+ const uint8_t* Value );
+
+/**
+ * @brief ACI_READ_CONFIG_DATA
+ * This command requests the value in the configure data structure. The number
+ * of read bytes changes for different Offset.
+ *
+ * @param Offset Offset of the element in the configuration data structure
+ * which has to be read.
+ * Values:
+ * - 0x00: CONFIG_DATA_PUBLIC_ADDRESS_OFFSET;
+ * Bluetooth public address; 6 bytes
+ * - 0x08: CONFIG_DATA_ER_OFFSET;
+ * Encryption root key used to derive LTK (legacy) and CSRK; 16 bytes
+ * - 0x18: CONFIG_DATA_IR_OFFSET
+ * Identity root key used to derive DHK (legacy) and IRK; 16 bytes
+ * - 0x2E: CONFIG_DATA_RANDOM_ADDRESS_OFFSET;
+ * Static Random Address; 6 bytes
+ * @param[out] Data_Length Length of Data in octets
+ * @param[out] Data Data field associated with Offset parameter
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_read_config_data( uint8_t Offset,
+ uint8_t* Data_Length,
+ uint8_t* Data );
+
+
+#endif /* BLE_HAL_ACI_H__ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_hci_le.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_hci_le.c
new file mode 100644
index 0000000..56572a3
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_hci_le.c
@@ -0,0 +1,2008 @@
+/*****************************************************************************
+ * @file ble_hci_le.c
+ * @brief STM32WB BLE API (hci_le)
+ * Auto-generated file: do not edit!
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#include "auto/ble_hci_le.h"
+
+tBleStatus hci_disconnect( uint16_t Connection_Handle,
+ uint8_t Reason )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_disconnect_cp0 *cp0 = (hci_disconnect_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Reason = Reason;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x01;
+ rq.ocf = 0x006;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_read_remote_version_information( uint16_t Connection_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_read_remote_version_information_cp0 *cp0 = (hci_read_remote_version_information_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x01;
+ rq.ocf = 0x01d;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_set_event_mask( const uint8_t* Event_Mask )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_set_event_mask_cp0 *cp0 = (hci_set_event_mask_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ Osal_MemCpy( (void*)&cp0->Event_Mask, (const void*)Event_Mask, 8 );
+ index_input += 8;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x03;
+ rq.ocf = 0x001;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_reset( void )
+{
+ struct hci_request rq;
+ tBleStatus status = 0;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x03;
+ rq.ocf = 0x003;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_read_transmit_power_level( uint16_t Connection_Handle,
+ uint8_t Type,
+ uint8_t* Transmit_Power_Level )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_read_transmit_power_level_cp0 *cp0 = (hci_read_transmit_power_level_cp0*)(cmd_buffer);
+ hci_read_transmit_power_level_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Type = Type;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x03;
+ rq.ocf = 0x02d;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Transmit_Power_Level = resp.Transmit_Power_Level;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_set_controller_to_host_flow_control( uint8_t Flow_Control_Enable )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_set_controller_to_host_flow_control_cp0 *cp0 = (hci_set_controller_to_host_flow_control_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Flow_Control_Enable = Flow_Control_Enable;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x03;
+ rq.ocf = 0x031;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_host_buffer_size( uint16_t Host_ACL_Data_Packet_Length,
+ uint8_t Host_Synchronous_Data_Packet_Length,
+ uint16_t Host_Total_Num_ACL_Data_Packets,
+ uint16_t Host_Total_Num_Synchronous_Data_Packets )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_host_buffer_size_cp0 *cp0 = (hci_host_buffer_size_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Host_ACL_Data_Packet_Length = Host_ACL_Data_Packet_Length;
+ index_input += 2;
+ cp0->Host_Synchronous_Data_Packet_Length = Host_Synchronous_Data_Packet_Length;
+ index_input += 1;
+ cp0->Host_Total_Num_ACL_Data_Packets = Host_Total_Num_ACL_Data_Packets;
+ index_input += 2;
+ cp0->Host_Total_Num_Synchronous_Data_Packets = Host_Total_Num_Synchronous_Data_Packets;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x03;
+ rq.ocf = 0x033;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_host_number_of_completed_packets( uint8_t Number_Of_Handles,
+ const Host_Nb_Of_Completed_Pkt_Pair_t* Host_Nb_Of_Completed_Pkt_Pair )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_host_number_of_completed_packets_cp0 *cp0 = (hci_host_number_of_completed_packets_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Number_Of_Handles = Number_Of_Handles;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Host_Nb_Of_Completed_Pkt_Pair, (const void*)Host_Nb_Of_Completed_Pkt_Pair, Number_Of_Handles * (sizeof(Host_Nb_Of_Completed_Pkt_Pair_t)) );
+ index_input += Number_Of_Handles * (sizeof(Host_Nb_Of_Completed_Pkt_Pair_t));
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x03;
+ rq.ocf = 0x035;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_read_local_version_information( uint8_t* HCI_Version,
+ uint16_t* HCI_Subversion,
+ uint8_t* LMP_Version,
+ uint16_t* Company_Identifier,
+ uint16_t* LMP_Subversion )
+{
+ struct hci_request rq;
+ hci_read_local_version_information_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x04;
+ rq.ocf = 0x001;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *HCI_Version = resp.HCI_Version;
+ *HCI_Subversion = resp.HCI_Subversion;
+ *LMP_Version = resp.LMP_Version;
+ *Company_Identifier = resp.Company_Identifier;
+ *LMP_Subversion = resp.LMP_Subversion;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_read_local_supported_commands( uint8_t* Supported_Commands )
+{
+ struct hci_request rq;
+ hci_read_local_supported_commands_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x04;
+ rq.ocf = 0x002;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ Osal_MemCpy( (void*)Supported_Commands, (const void*)resp.Supported_Commands, 64 );
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_read_local_supported_features( uint8_t* LMP_Features )
+{
+ struct hci_request rq;
+ hci_read_local_supported_features_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x04;
+ rq.ocf = 0x003;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ Osal_MemCpy( (void*)LMP_Features, (const void*)resp.LMP_Features, 8 );
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_read_bd_addr( uint8_t* BD_ADDR )
+{
+ struct hci_request rq;
+ hci_read_bd_addr_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x04;
+ rq.ocf = 0x009;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ Osal_MemCpy( (void*)BD_ADDR, (const void*)resp.BD_ADDR, 6 );
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_read_rssi( uint16_t Connection_Handle,
+ uint8_t* RSSI )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_read_rssi_cp0 *cp0 = (hci_read_rssi_cp0*)(cmd_buffer);
+ hci_read_rssi_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x05;
+ rq.ocf = 0x005;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *RSSI = resp.RSSI;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_set_event_mask( const uint8_t* LE_Event_Mask )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_event_mask_cp0 *cp0 = (hci_le_set_event_mask_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ Osal_MemCpy( (void*)&cp0->LE_Event_Mask, (const void*)LE_Event_Mask, 8 );
+ index_input += 8;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x001;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_read_buffer_size( uint16_t* HC_LE_ACL_Data_Packet_Length,
+ uint8_t* HC_Total_Num_LE_ACL_Data_Packets )
+{
+ struct hci_request rq;
+ hci_le_read_buffer_size_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x002;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *HC_LE_ACL_Data_Packet_Length = resp.HC_LE_ACL_Data_Packet_Length;
+ *HC_Total_Num_LE_ACL_Data_Packets = resp.HC_Total_Num_LE_ACL_Data_Packets;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_read_local_supported_features_page_0( uint8_t* LE_Features )
+{
+ struct hci_request rq;
+ hci_le_read_local_supported_features_page_0_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x003;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ Osal_MemCpy( (void*)LE_Features, (const void*)resp.LE_Features, 8 );
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_set_random_address( const uint8_t* Random_Address )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_random_address_cp0 *cp0 = (hci_le_set_random_address_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ Osal_MemCpy( (void*)&cp0->Random_Address, (const void*)Random_Address, 6 );
+ index_input += 6;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x005;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_set_advertising_parameters( uint16_t Advertising_Interval_Min,
+ uint16_t Advertising_Interval_Max,
+ uint8_t Advertising_Type,
+ uint8_t Own_Address_Type,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint8_t Advertising_Channel_Map,
+ uint8_t Advertising_Filter_Policy )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_advertising_parameters_cp0 *cp0 = (hci_le_set_advertising_parameters_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Advertising_Interval_Min = Advertising_Interval_Min;
+ index_input += 2;
+ cp0->Advertising_Interval_Max = Advertising_Interval_Max;
+ index_input += 2;
+ cp0->Advertising_Type = Advertising_Type;
+ index_input += 1;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Peer_Address_Type = Peer_Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Peer_Address, (const void*)Peer_Address, 6 );
+ index_input += 6;
+ cp0->Advertising_Channel_Map = Advertising_Channel_Map;
+ index_input += 1;
+ cp0->Advertising_Filter_Policy = Advertising_Filter_Policy;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x006;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_read_advertising_physical_channel_tx_power( uint8_t* Transmit_Power_Level )
+{
+ struct hci_request rq;
+ hci_le_read_advertising_physical_channel_tx_power_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x007;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Transmit_Power_Level = resp.Transmit_Power_Level;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_set_advertising_data( uint8_t Advertising_Data_Length,
+ const uint8_t* Advertising_Data )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_advertising_data_cp0 *cp0 = (hci_le_set_advertising_data_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Advertising_Data_Length = Advertising_Data_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Advertising_Data, (const void*)Advertising_Data, 31 );
+ index_input += 31;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x008;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_set_scan_response_data( uint8_t Scan_Response_Data_Length,
+ const uint8_t* Scan_Response_Data )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_scan_response_data_cp0 *cp0 = (hci_le_set_scan_response_data_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Scan_Response_Data_Length = Scan_Response_Data_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Scan_Response_Data, (const void*)Scan_Response_Data, 31 );
+ index_input += 31;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x009;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_set_advertising_enable( uint8_t Advertising_Enable )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_advertising_enable_cp0 *cp0 = (hci_le_set_advertising_enable_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Advertising_Enable = Advertising_Enable;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x00a;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_set_scan_parameters( uint8_t LE_Scan_Type,
+ uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t Own_Address_Type,
+ uint8_t Scanning_Filter_Policy )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_scan_parameters_cp0 *cp0 = (hci_le_set_scan_parameters_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->LE_Scan_Type = LE_Scan_Type;
+ index_input += 1;
+ cp0->LE_Scan_Interval = LE_Scan_Interval;
+ index_input += 2;
+ cp0->LE_Scan_Window = LE_Scan_Window;
+ index_input += 2;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Scanning_Filter_Policy = Scanning_Filter_Policy;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x00b;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_set_scan_enable( uint8_t LE_Scan_Enable,
+ uint8_t Filter_Duplicates )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_scan_enable_cp0 *cp0 = (hci_le_set_scan_enable_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->LE_Scan_Enable = LE_Scan_Enable;
+ index_input += 1;
+ cp0->Filter_Duplicates = Filter_Duplicates;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x00c;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_create_connection( uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t Initiator_Filter_Policy,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint8_t Own_Address_Type,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max,
+ uint16_t Conn_Latency,
+ uint16_t Supervision_Timeout,
+ uint16_t Minimum_CE_Length,
+ uint16_t Maximum_CE_Length )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_create_connection_cp0 *cp0 = (hci_le_create_connection_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->LE_Scan_Interval = LE_Scan_Interval;
+ index_input += 2;
+ cp0->LE_Scan_Window = LE_Scan_Window;
+ index_input += 2;
+ cp0->Initiator_Filter_Policy = Initiator_Filter_Policy;
+ index_input += 1;
+ cp0->Peer_Address_Type = Peer_Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Peer_Address, (const void*)Peer_Address, 6 );
+ index_input += 6;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Conn_Interval_Min = Conn_Interval_Min;
+ index_input += 2;
+ cp0->Conn_Interval_Max = Conn_Interval_Max;
+ index_input += 2;
+ cp0->Conn_Latency = Conn_Latency;
+ index_input += 2;
+ cp0->Supervision_Timeout = Supervision_Timeout;
+ index_input += 2;
+ cp0->Minimum_CE_Length = Minimum_CE_Length;
+ index_input += 2;
+ cp0->Maximum_CE_Length = Maximum_CE_Length;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x00d;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_create_connection_cancel( void )
+{
+ struct hci_request rq;
+ tBleStatus status = 0;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x00e;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_read_filter_accept_list_size( uint8_t* Filter_Accept_List_Size )
+{
+ struct hci_request rq;
+ hci_le_read_filter_accept_list_size_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x00f;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Filter_Accept_List_Size = resp.Filter_Accept_List_Size;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_clear_filter_accept_list( void )
+{
+ struct hci_request rq;
+ tBleStatus status = 0;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x010;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_add_device_to_filter_accept_list( uint8_t Address_Type,
+ const uint8_t* Address )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_add_device_to_filter_accept_list_cp0 *cp0 = (hci_le_add_device_to_filter_accept_list_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Address_Type = Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Address, (const void*)Address, 6 );
+ index_input += 6;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x011;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_remove_device_from_filter_accept_list( uint8_t Address_Type,
+ const uint8_t* Address )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_remove_device_from_filter_accept_list_cp0 *cp0 = (hci_le_remove_device_from_filter_accept_list_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Address_Type = Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Address, (const void*)Address, 6 );
+ index_input += 6;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x012;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_connection_update( uint16_t Connection_Handle,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max,
+ uint16_t Conn_Latency,
+ uint16_t Supervision_Timeout,
+ uint16_t Minimum_CE_Length,
+ uint16_t Maximum_CE_Length )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_connection_update_cp0 *cp0 = (hci_le_connection_update_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Conn_Interval_Min = Conn_Interval_Min;
+ index_input += 2;
+ cp0->Conn_Interval_Max = Conn_Interval_Max;
+ index_input += 2;
+ cp0->Conn_Latency = Conn_Latency;
+ index_input += 2;
+ cp0->Supervision_Timeout = Supervision_Timeout;
+ index_input += 2;
+ cp0->Minimum_CE_Length = Minimum_CE_Length;
+ index_input += 2;
+ cp0->Maximum_CE_Length = Maximum_CE_Length;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x013;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_set_host_channel_classification( const uint8_t* LE_Channel_Map )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_host_channel_classification_cp0 *cp0 = (hci_le_set_host_channel_classification_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ Osal_MemCpy( (void*)&cp0->LE_Channel_Map, (const void*)LE_Channel_Map, 5 );
+ index_input += 5;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x014;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_read_channel_map( uint16_t Connection_Handle,
+ uint8_t* LE_Channel_Map )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_read_channel_map_cp0 *cp0 = (hci_le_read_channel_map_cp0*)(cmd_buffer);
+ hci_le_read_channel_map_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x015;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ Osal_MemCpy( (void*)LE_Channel_Map, (const void*)resp.LE_Channel_Map, 5 );
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_read_remote_features_page_0( uint16_t Connection_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_read_remote_features_page_0_cp0 *cp0 = (hci_le_read_remote_features_page_0_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x016;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_encrypt( const uint8_t* Key,
+ const uint8_t* Plaintext_Data,
+ uint8_t* Encrypted_Data )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_encrypt_cp0 *cp0 = (hci_le_encrypt_cp0*)(cmd_buffer);
+ hci_le_encrypt_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ Osal_MemCpy( (void*)&cp0->Key, (const void*)Key, 16 );
+ index_input += 16;
+ Osal_MemCpy( (void*)&cp0->Plaintext_Data, (const void*)Plaintext_Data, 16 );
+ index_input += 16;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x017;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ Osal_MemCpy( (void*)Encrypted_Data, (const void*)resp.Encrypted_Data, 16 );
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_rand( uint8_t* Random_Number )
+{
+ struct hci_request rq;
+ hci_le_rand_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x018;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ Osal_MemCpy( (void*)Random_Number, (const void*)resp.Random_Number, 8 );
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_enable_encryption( uint16_t Connection_Handle,
+ const uint8_t* Random_Number,
+ uint16_t Encrypted_Diversifier,
+ const uint8_t* Long_Term_Key )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_enable_encryption_cp0 *cp0 = (hci_le_enable_encryption_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ Osal_MemCpy( (void*)&cp0->Random_Number, (const void*)Random_Number, 8 );
+ index_input += 8;
+ cp0->Encrypted_Diversifier = Encrypted_Diversifier;
+ index_input += 2;
+ Osal_MemCpy( (void*)&cp0->Long_Term_Key, (const void*)Long_Term_Key, 16 );
+ index_input += 16;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x019;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_long_term_key_request_reply( uint16_t Connection_Handle,
+ const uint8_t* Long_Term_Key )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_long_term_key_request_reply_cp0 *cp0 = (hci_le_long_term_key_request_reply_cp0*)(cmd_buffer);
+ hci_le_long_term_key_request_reply_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ Osal_MemCpy( (void*)&cp0->Long_Term_Key, (const void*)Long_Term_Key, 16 );
+ index_input += 16;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x01a;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_long_term_key_request_negative_reply( uint16_t Connection_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_long_term_key_request_negative_reply_cp0 *cp0 = (hci_le_long_term_key_request_negative_reply_cp0*)(cmd_buffer);
+ hci_le_long_term_key_request_negative_reply_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x01b;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_read_supported_states( uint8_t* LE_States )
+{
+ struct hci_request rq;
+ hci_le_read_supported_states_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x01c;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ Osal_MemCpy( (void*)LE_States, (const void*)resp.LE_States, 8 );
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_receiver_test( uint8_t RX_Frequency )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_receiver_test_cp0 *cp0 = (hci_le_receiver_test_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->RX_Frequency = RX_Frequency;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x01d;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_transmitter_test( uint8_t TX_Frequency,
+ uint8_t Length_Of_Test_Data,
+ uint8_t Packet_Payload )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_transmitter_test_cp0 *cp0 = (hci_le_transmitter_test_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->TX_Frequency = TX_Frequency;
+ index_input += 1;
+ cp0->Length_Of_Test_Data = Length_Of_Test_Data;
+ index_input += 1;
+ cp0->Packet_Payload = Packet_Payload;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x01e;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_test_end( uint16_t* Number_Of_Packets )
+{
+ struct hci_request rq;
+ hci_le_test_end_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x01f;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Number_Of_Packets = resp.Number_Of_Packets;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_set_data_length( uint16_t Connection_Handle,
+ uint16_t TxOctets,
+ uint16_t TxTime )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_data_length_cp0 *cp0 = (hci_le_set_data_length_cp0*)(cmd_buffer);
+ hci_le_set_data_length_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->TxOctets = TxOctets;
+ index_input += 2;
+ cp0->TxTime = TxTime;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x022;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_read_suggested_default_data_length( uint16_t* SuggestedMaxTxOctets,
+ uint16_t* SuggestedMaxTxTime )
+{
+ struct hci_request rq;
+ hci_le_read_suggested_default_data_length_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x023;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *SuggestedMaxTxOctets = resp.SuggestedMaxTxOctets;
+ *SuggestedMaxTxTime = resp.SuggestedMaxTxTime;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_write_suggested_default_data_length( uint16_t SuggestedMaxTxOctets,
+ uint16_t SuggestedMaxTxTime )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_write_suggested_default_data_length_cp0 *cp0 = (hci_le_write_suggested_default_data_length_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->SuggestedMaxTxOctets = SuggestedMaxTxOctets;
+ index_input += 2;
+ cp0->SuggestedMaxTxTime = SuggestedMaxTxTime;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x024;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_read_local_p256_public_key( void )
+{
+ struct hci_request rq;
+ tBleStatus status = 0;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x025;
+ rq.event = 0x0F;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_generate_dhkey( const uint8_t* Remote_P256_Public_Key )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_generate_dhkey_cp0 *cp0 = (hci_le_generate_dhkey_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ Osal_MemCpy( (void*)&cp0->Remote_P256_Public_Key, (const void*)Remote_P256_Public_Key, 64 );
+ index_input += 64;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x026;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_add_device_to_resolving_list( uint8_t Peer_Identity_Address_Type,
+ const uint8_t* Peer_Identity_Address,
+ const uint8_t* Peer_IRK,
+ const uint8_t* Local_IRK )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_add_device_to_resolving_list_cp0 *cp0 = (hci_le_add_device_to_resolving_list_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Peer_Identity_Address_Type = Peer_Identity_Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Peer_Identity_Address, (const void*)Peer_Identity_Address, 6 );
+ index_input += 6;
+ Osal_MemCpy( (void*)&cp0->Peer_IRK, (const void*)Peer_IRK, 16 );
+ index_input += 16;
+ Osal_MemCpy( (void*)&cp0->Local_IRK, (const void*)Local_IRK, 16 );
+ index_input += 16;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x027;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_remove_device_from_resolving_list( uint8_t Peer_Identity_Address_Type,
+ const uint8_t* Peer_Identity_Address )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_remove_device_from_resolving_list_cp0 *cp0 = (hci_le_remove_device_from_resolving_list_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Peer_Identity_Address_Type = Peer_Identity_Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Peer_Identity_Address, (const void*)Peer_Identity_Address, 6 );
+ index_input += 6;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x028;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_clear_resolving_list( void )
+{
+ struct hci_request rq;
+ tBleStatus status = 0;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x029;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_read_resolving_list_size( uint8_t* Resolving_List_Size )
+{
+ struct hci_request rq;
+ hci_le_read_resolving_list_size_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x02a;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Resolving_List_Size = resp.Resolving_List_Size;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_read_peer_resolvable_address( uint8_t Peer_Identity_Address_Type,
+ const uint8_t* Peer_Identity_Address,
+ uint8_t* Peer_Resolvable_Address )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_read_peer_resolvable_address_cp0 *cp0 = (hci_le_read_peer_resolvable_address_cp0*)(cmd_buffer);
+ hci_le_read_peer_resolvable_address_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Peer_Identity_Address_Type = Peer_Identity_Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Peer_Identity_Address, (const void*)Peer_Identity_Address, 6 );
+ index_input += 6;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x02b;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ Osal_MemCpy( (void*)Peer_Resolvable_Address, (const void*)resp.Peer_Resolvable_Address, 6 );
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_read_local_resolvable_address( uint8_t Peer_Identity_Address_Type,
+ const uint8_t* Peer_Identity_Address,
+ uint8_t* Local_Resolvable_Address )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_read_local_resolvable_address_cp0 *cp0 = (hci_le_read_local_resolvable_address_cp0*)(cmd_buffer);
+ hci_le_read_local_resolvable_address_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Peer_Identity_Address_Type = Peer_Identity_Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Peer_Identity_Address, (const void*)Peer_Identity_Address, 6 );
+ index_input += 6;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x02c;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ Osal_MemCpy( (void*)Local_Resolvable_Address, (const void*)resp.Local_Resolvable_Address, 6 );
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_set_address_resolution_enable( uint8_t Address_Resolution_Enable )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_address_resolution_enable_cp0 *cp0 = (hci_le_set_address_resolution_enable_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Address_Resolution_Enable = Address_Resolution_Enable;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x02d;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_set_resolvable_private_address_timeout( uint16_t RPA_Timeout )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_resolvable_private_address_timeout_cp0 *cp0 = (hci_le_set_resolvable_private_address_timeout_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->RPA_Timeout = RPA_Timeout;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x02e;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_read_maximum_data_length( uint16_t* supportedMaxTxOctets,
+ uint16_t* supportedMaxTxTime,
+ uint16_t* supportedMaxRxOctets,
+ uint16_t* supportedMaxRxTime )
+{
+ struct hci_request rq;
+ hci_le_read_maximum_data_length_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x02f;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *supportedMaxTxOctets = resp.supportedMaxTxOctets;
+ *supportedMaxTxTime = resp.supportedMaxTxTime;
+ *supportedMaxRxOctets = resp.supportedMaxRxOctets;
+ *supportedMaxRxTime = resp.supportedMaxRxTime;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_read_phy( uint16_t Connection_Handle,
+ uint8_t* TX_PHY,
+ uint8_t* RX_PHY )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_read_phy_cp0 *cp0 = (hci_le_read_phy_cp0*)(cmd_buffer);
+ hci_le_read_phy_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x030;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *TX_PHY = resp.TX_PHY;
+ *RX_PHY = resp.RX_PHY;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_set_default_phy( uint8_t ALL_PHYS,
+ uint8_t TX_PHYS,
+ uint8_t RX_PHYS )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_default_phy_cp0 *cp0 = (hci_le_set_default_phy_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->ALL_PHYS = ALL_PHYS;
+ index_input += 1;
+ cp0->TX_PHYS = TX_PHYS;
+ index_input += 1;
+ cp0->RX_PHYS = RX_PHYS;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x031;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_set_phy( uint16_t Connection_Handle,
+ uint8_t ALL_PHYS,
+ uint8_t TX_PHYS,
+ uint8_t RX_PHYS,
+ uint16_t PHY_options )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_phy_cp0 *cp0 = (hci_le_set_phy_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->ALL_PHYS = ALL_PHYS;
+ index_input += 1;
+ cp0->TX_PHYS = TX_PHYS;
+ index_input += 1;
+ cp0->RX_PHYS = RX_PHYS;
+ index_input += 1;
+ cp0->PHY_options = PHY_options;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x032;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_receiver_test_v2( uint8_t RX_Frequency,
+ uint8_t PHY,
+ uint8_t Modulation_Index )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_receiver_test_v2_cp0 *cp0 = (hci_le_receiver_test_v2_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->RX_Frequency = RX_Frequency;
+ index_input += 1;
+ cp0->PHY = PHY;
+ index_input += 1;
+ cp0->Modulation_Index = Modulation_Index;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x033;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_transmitter_test_v2( uint8_t TX_Frequency,
+ uint8_t Length_Of_Test_Data,
+ uint8_t Packet_Payload,
+ uint8_t PHY )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_transmitter_test_v2_cp0 *cp0 = (hci_le_transmitter_test_v2_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->TX_Frequency = TX_Frequency;
+ index_input += 1;
+ cp0->Length_Of_Test_Data = Length_Of_Test_Data;
+ index_input += 1;
+ cp0->Packet_Payload = Packet_Payload;
+ index_input += 1;
+ cp0->PHY = PHY;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x034;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_set_advertising_set_random_address( uint8_t Advertising_Handle,
+ const uint8_t* Random_Address )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_advertising_set_random_address_cp0 *cp0 = (hci_le_set_advertising_set_random_address_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Advertising_Handle = Advertising_Handle;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Random_Address, (const void*)Random_Address, 6 );
+ index_input += 6;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x035;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_set_extended_advertising_parameters( uint8_t Advertising_Handle,
+ uint16_t Adv_Event_Properties,
+ const uint8_t* Primary_Adv_Interval_Min,
+ const uint8_t* Primary_Adv_Interval_Max,
+ uint8_t Primary_Adv_Channel_Map,
+ uint8_t Own_Address_Type,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint8_t Adv_Filter_Policy,
+ uint8_t Adv_TX_Power,
+ uint8_t Primary_Adv_PHY,
+ uint8_t Secondary_Adv_Max_Skip,
+ uint8_t Secondary_Adv_PHY,
+ uint8_t Adv_SID,
+ uint8_t Scan_Req_Notification_Enable,
+ uint8_t* Selected_TX_Power )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_extended_advertising_parameters_cp0 *cp0 = (hci_le_set_extended_advertising_parameters_cp0*)(cmd_buffer);
+ hci_le_set_extended_advertising_parameters_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Advertising_Handle = Advertising_Handle;
+ index_input += 1;
+ cp0->Adv_Event_Properties = Adv_Event_Properties;
+ index_input += 2;
+ Osal_MemCpy( (void*)&cp0->Primary_Adv_Interval_Min, (const void*)Primary_Adv_Interval_Min, 3 );
+ index_input += 3;
+ Osal_MemCpy( (void*)&cp0->Primary_Adv_Interval_Max, (const void*)Primary_Adv_Interval_Max, 3 );
+ index_input += 3;
+ cp0->Primary_Adv_Channel_Map = Primary_Adv_Channel_Map;
+ index_input += 1;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Peer_Address_Type = Peer_Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Peer_Address, (const void*)Peer_Address, 6 );
+ index_input += 6;
+ cp0->Adv_Filter_Policy = Adv_Filter_Policy;
+ index_input += 1;
+ cp0->Adv_TX_Power = Adv_TX_Power;
+ index_input += 1;
+ cp0->Primary_Adv_PHY = Primary_Adv_PHY;
+ index_input += 1;
+ cp0->Secondary_Adv_Max_Skip = Secondary_Adv_Max_Skip;
+ index_input += 1;
+ cp0->Secondary_Adv_PHY = Secondary_Adv_PHY;
+ index_input += 1;
+ cp0->Adv_SID = Adv_SID;
+ index_input += 1;
+ cp0->Scan_Req_Notification_Enable = Scan_Req_Notification_Enable;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x036;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Selected_TX_Power = resp.Selected_TX_Power;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_set_extended_advertising_data( uint8_t Advertising_Handle,
+ uint8_t Operation,
+ uint8_t Fragment_Preference,
+ uint8_t Advertising_Data_Length,
+ const uint8_t* Advertising_Data )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_extended_advertising_data_cp0 *cp0 = (hci_le_set_extended_advertising_data_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Advertising_Handle = Advertising_Handle;
+ index_input += 1;
+ cp0->Operation = Operation;
+ index_input += 1;
+ cp0->Fragment_Preference = Fragment_Preference;
+ index_input += 1;
+ cp0->Advertising_Data_Length = Advertising_Data_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Advertising_Data, (const void*)Advertising_Data, Advertising_Data_Length );
+ index_input += Advertising_Data_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x037;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_set_extended_scan_response_data( uint8_t Advertising_Handle,
+ uint8_t Operation,
+ uint8_t Fragment_Preference,
+ uint8_t Scan_Response_Data_Length,
+ const uint8_t* Scan_Response_Data )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_extended_scan_response_data_cp0 *cp0 = (hci_le_set_extended_scan_response_data_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Advertising_Handle = Advertising_Handle;
+ index_input += 1;
+ cp0->Operation = Operation;
+ index_input += 1;
+ cp0->Fragment_Preference = Fragment_Preference;
+ index_input += 1;
+ cp0->Scan_Response_Data_Length = Scan_Response_Data_Length;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Scan_Response_Data, (const void*)Scan_Response_Data, Scan_Response_Data_Length );
+ index_input += Scan_Response_Data_Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x038;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_set_extended_advertising_enable( uint8_t Enable,
+ uint8_t Num_Sets,
+ const Adv_Set_t* Adv_Set )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_extended_advertising_enable_cp0 *cp0 = (hci_le_set_extended_advertising_enable_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Enable = Enable;
+ index_input += 1;
+ cp0->Num_Sets = Num_Sets;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Adv_Set, (const void*)Adv_Set, Num_Sets * (sizeof(Adv_Set_t)) );
+ index_input += Num_Sets * (sizeof(Adv_Set_t));
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x039;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_read_maximum_advertising_data_length( uint16_t* Max_Advertising_Data_Length )
+{
+ struct hci_request rq;
+ hci_le_read_maximum_advertising_data_length_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x03a;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Max_Advertising_Data_Length = resp.Max_Advertising_Data_Length;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_read_number_of_supported_advertising_sets( uint8_t* Num_Supported_Advertising_Sets )
+{
+ struct hci_request rq;
+ hci_le_read_number_of_supported_advertising_sets_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x03b;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Num_Supported_Advertising_Sets = resp.Num_Supported_Advertising_Sets;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_remove_advertising_set( uint8_t Advertising_Handle )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_remove_advertising_set_cp0 *cp0 = (hci_le_remove_advertising_set_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Advertising_Handle = Advertising_Handle;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x03c;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_clear_advertising_sets( void )
+{
+ struct hci_request rq;
+ tBleStatus status = 0;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x03d;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_set_extended_scan_parameters( uint8_t Own_Address_Type,
+ uint8_t Scanning_Filter_Policy,
+ uint8_t Scanning_PHYs,
+ const Scan_Param_Phy_t* Scan_Param_Phy )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_extended_scan_parameters_cp0 *cp0 = (hci_le_set_extended_scan_parameters_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Scanning_Filter_Policy = Scanning_Filter_Policy;
+ index_input += 1;
+ cp0->Scanning_PHYs = Scanning_PHYs;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Scan_Param_Phy, (const void*)Scan_Param_Phy, 10 );
+ index_input += 10;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x041;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_set_extended_scan_enable( uint8_t Enable,
+ uint8_t Filter_Duplicates,
+ uint16_t Duration,
+ uint16_t Period )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_extended_scan_enable_cp0 *cp0 = (hci_le_set_extended_scan_enable_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Enable = Enable;
+ index_input += 1;
+ cp0->Filter_Duplicates = Filter_Duplicates;
+ index_input += 1;
+ cp0->Duration = Duration;
+ index_input += 2;
+ cp0->Period = Period;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x042;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_extended_create_connection( uint8_t Initiator_Filter_Policy,
+ uint8_t Own_Address_Type,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint8_t Initiating_PHYs,
+ const Init_Param_Phy_t* Init_Param_Phy )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_extended_create_connection_cp0 *cp0 = (hci_le_extended_create_connection_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Initiator_Filter_Policy = Initiator_Filter_Policy;
+ index_input += 1;
+ cp0->Own_Address_Type = Own_Address_Type;
+ index_input += 1;
+ cp0->Peer_Address_Type = Peer_Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Peer_Address, (const void*)Peer_Address, 6 );
+ index_input += 6;
+ cp0->Initiating_PHYs = Initiating_PHYs;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Init_Param_Phy, (const void*)Init_Param_Phy, 48 );
+ index_input += 48;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x043;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_read_transmit_power( uint8_t* Min_TX_Power,
+ uint8_t* Max_TX_Power )
+{
+ struct hci_request rq;
+ hci_le_read_transmit_power_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x04b;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Min_TX_Power = resp.Min_TX_Power;
+ *Max_TX_Power = resp.Max_TX_Power;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_read_rf_path_compensation( uint16_t* RF_TX_Path_Compensation,
+ uint16_t* RF_RX_Path_Compensation )
+{
+ struct hci_request rq;
+ hci_le_read_rf_path_compensation_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x04c;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *RF_TX_Path_Compensation = resp.RF_TX_Path_Compensation;
+ *RF_RX_Path_Compensation = resp.RF_RX_Path_Compensation;
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus hci_le_write_rf_path_compensation( uint16_t RF_TX_Path_Compensation,
+ uint16_t RF_RX_Path_Compensation )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_write_rf_path_compensation_cp0 *cp0 = (hci_le_write_rf_path_compensation_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->RF_TX_Path_Compensation = RF_TX_Path_Compensation;
+ index_input += 2;
+ cp0->RF_RX_Path_Compensation = RF_RX_Path_Compensation;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x04d;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_set_privacy_mode( uint8_t Peer_Identity_Address_Type,
+ const uint8_t* Peer_Identity_Address,
+ uint8_t Privacy_Mode )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_privacy_mode_cp0 *cp0 = (hci_le_set_privacy_mode_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Peer_Identity_Address_Type = Peer_Identity_Address_Type;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Peer_Identity_Address, (const void*)Peer_Identity_Address, 6 );
+ index_input += 6;
+ cp0->Privacy_Mode = Privacy_Mode;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x04e;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_generate_dhkey_v2( const uint8_t* Remote_P256_Public_Key,
+ uint8_t Key_Type )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_generate_dhkey_v2_cp0 *cp0 = (hci_le_generate_dhkey_v2_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ Osal_MemCpy( (void*)&cp0->Remote_P256_Public_Key, (const void*)Remote_P256_Public_Key, 64 );
+ index_input += 64;
+ cp0->Key_Type = Key_Type;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x05e;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus hci_le_set_resolvable_private_address_timeout_v2( uint16_t RPA_Timeout_Min,
+ uint16_t RPA_Timeout_Max )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ hci_le_set_resolvable_private_address_timeout_v2_cp0 *cp0 = (hci_le_set_resolvable_private_address_timeout_v2_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->RPA_Timeout_Min = RPA_Timeout_Min;
+ index_input += 2;
+ cp0->RPA_Timeout_Max = RPA_Timeout_Max;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x08;
+ rq.ocf = 0x09e;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_hci_le.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_hci_le.h
new file mode 100644
index 0000000..501d24b
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_hci_le.h
@@ -0,0 +1,2263 @@
+/*****************************************************************************
+ * @file ble_hci_le.h
+ * @brief STM32WB BLE API (HCI_LE)
+ * Auto-generated file: do not edit!
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#ifndef BLE_HCI_LE_H__
+#define BLE_HCI_LE_H__
+
+
+#include "auto/ble_types.h"
+
+/**
+ * @brief HCI_DISCONNECT
+ * The HCI_DISCONNECT is used to terminate an existing connection. The
+ * Connection_Handle command parameter indicates which connection is to be
+ * disconnected. The Reason command parameter indicates the reason for ending
+ * the connection. The remote Controller will receive the Reason command
+ * parameter in the HCI_DISCONNECTION_COMPLETE_EVENT event. All synchronous
+ * connections on a physical link should be disconnected before the ACL
+ * connection on the same physical connection is disconnected.
+ * See Core Specification [Vol 4, Part E, 7.1.6].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Reason The reason for ending the connection.
+ * Values:
+ * - 0x05: Authentication Failure
+ * - 0x13: Remote User Terminated Connection
+ * - 0x14: Remote Device Terminated Connection due to Low Resources
+ * - 0x15: Remote Device Terminated Connection due to Power Off
+ * - 0x1A: Unsupported Remote Feature
+ * - 0x3B: Unacceptable Connection Parameters
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_disconnect( uint16_t Connection_Handle,
+ uint8_t Reason );
+
+/**
+ * @brief HCI_READ_REMOTE_VERSION_INFORMATION
+ * This command will obtain the values for the version information for the
+ * remote device identified by the Connection_Handle parameter. The
+ * Connection_Handle must be a Connection_Handle for an ACL or LE connection.
+ * See Core Specification [Vol 4, Part E, 7.1.23].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_read_remote_version_information( uint16_t Connection_Handle );
+
+/**
+ * @brief HCI_SET_EVENT_MASK
+ * The Set_Event_Mask command is used to control which events are generated by
+ * the HCI for the Host. If the bit in the Event_Mask is set to a one, then the
+ * event associated with that bit will be enabled. For an LE Controller, the LE
+ * Meta Event bit in the Event_Mask shall enable or disable all LE events in
+ * the LE Meta Event. The Host has to deal with each event that occurs. The
+ * event mask allows the Host to control how much it is interrupted.
+ * See Core Specification [Vol 4, Part E, 7.3.1].
+ *
+ * @param Event_Mask Event mask. Default: 0x2000FFFFFFFFFFFF
+ * Flags:
+ * - 0x0000000000000000: No events specified
+ * - 0x0000000000000010: Disconnection Complete Event
+ * - 0x0000000000000080: Encryption Change Event
+ * - 0x0000000000000800: Read Remote Version Information Complete Event
+ * - 0x0000000000008000: Hardware Error Event
+ * - 0x0000800000000000: Encryption Key Refresh Complete Event
+ * - 0x2000000000000000: LE Meta-Event
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_set_event_mask( const uint8_t* Event_Mask );
+
+/**
+ * @brief HCI_RESET
+ * The Reset command resets the Link Layer on an LE Controller. The Reset
+ * command shall not affect the used HCI transport layer since the HCI
+ * transport layers may have reset mechanisms of their own. After the reset is
+ * completed, the current operational state is lost, the Controller enters
+ * standby mode and the Controller automatically reverts to the default values
+ * for the parameters for which default values are defined in the
+ * specification.
+ * Note: The Reset command does not necessarily perform a hardware reset. This
+ * is implementation defined.
+ * The Host shall not send additional HCI commands before the Command Complete
+ * event related to the Reset command has been received.
+ * See Core Specification [Vol 4, Part E, 7.3.2].
+ *
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_reset( void );
+
+/**
+ * @brief HCI_READ_TRANSMIT_POWER_LEVEL
+ * This command reads the values for the Transmit_Power_Level parameter for the
+ * specified Connection_Handle. The Connection_Handle shall be a
+ * Connection_Handle for an ACL connection.
+ * See Core Specification [Vol 4, Part E, 7.3.35].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Type Current or maximum transmit power level.
+ * Values:
+ * - 0x00: Read Current Transmit Power Level.
+ * - 0x01: Read Maximum Transmit Power Level.
+ * @param[out] Transmit_Power_Level Size: 1 Octet (signed integer).
+ * Units: dBm.
+ * Values:
+ * - -30 ... 20
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_read_transmit_power_level( uint16_t Connection_Handle,
+ uint8_t Type,
+ uint8_t* Transmit_Power_Level );
+
+/**
+ * @brief HCI_SET_CONTROLLER_TO_HOST_FLOW_CONTROL
+ * This command is used by the Host to turn flow control on or off for data
+ * and/or voice sent in the direction from the Controller to the Host. If flow
+ * control is turned off, the Host should not send the
+ * Host_Number_Of_Completed_Packets command. That command will be ignored by
+ * the Controller if it is sent by the Host and flow control is off. If flow
+ * control is turned on for HCI ACL Data Packets and off for HCI synchronous
+ * Data Packets, Host_Number_Of_Completed_Packets commands sent by the Host
+ * should only contain Connection_Handles for ACL connections. If flow control
+ * is turned off for HCI ACL Data Packets and on for HCI synchronous Data
+ * Packets, Host_Number_Of_Completed_Packets commands sent by the Host should
+ * only contain Connection_Handles for synchronous connections. If flow control
+ * is turned on for HCI ACL Data Packets and HCI synchronous Data Packets, the
+ * Host will send Host_Number_Of_Completed_Packets commands both for ACL
+ * connections and synchronous connections.
+ * The Flow_Control_Enable parameter shall only be changed if no connections
+ * exist.
+ * See Core Specification [Vol 4, Part E, 7.3.38].
+ *
+ * @param Flow_Control_Enable Enable/Disable the Flow Control
+ * Values:
+ * - 0x00: Flow control off in direction from Controller to Host.
+ * Default.
+ * - 0x01: Flow control on for HCI ACL Data Packets and off for HCI
+ * synchronous.Data Packets in direction from Controller to Host.
+ * - 0x02: Flow control off for HCI ACL Data Packets and on for HCI
+ * synchronous.Data Packets in direction from Controller to Host.
+ * - 0x03: Flow control on both for HCI ACL Data Packets and HCI
+ * synchronous.Data Packets in direction from Controller to Host.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_set_controller_to_host_flow_control( uint8_t Flow_Control_Enable );
+
+/**
+ * @brief HCI_HOST_BUFFER_SIZE
+ * The Host_Buffer_Size command is used by the Host to notify the Controller
+ * about the maximum size of the data portion of HCI ACL and synchronous Data
+ * Packets sent from the Controller to the Host. The Controller shall segment
+ * the data to be transmitted from the Controller to the Host according to
+ * these sizes, so that the HCI Data Packets will contain data with up to these
+ * sizes. The Host_Buffer_Size command also notifies the Controller about the
+ * total number of HCI ACL and synchronous Data Packets that can be stored in
+ * the data buffers of the Host. If flow control from the Controller to the
+ * Host is turned off, and the Host_Buffer_Size command has not been issued by
+ * the Host, this means that the Controller will send HCI Data Packets to the
+ * Host with any lengths the Controller wants to use, and it is assumed that
+ * the data buffer sizes of the Host are unlimited. If flow control from the
+ * Controller to the Host is turned on, the Host_Buffer_Size command shall
+ * after a power-on or a reset always be sent by the Host before the first
+ * Host_Number_Of_Completed_Packets command is sent.
+ * The Set Controller To Host Flow Control Command is used to turn flow control
+ * on or off.
+ * The Host_ACL_Data_Packet_Length command parameter will be used to determine
+ * the size of the L2CAP segments contained in ACL Data Packets, which are
+ * transferred from the Controller to the Host.
+ * The Host_Synchronous_Data_Packet_Length command parameter is used to
+ * determine the maximum size of HCI synchronous Data Packets. Both the Host
+ * and the Controller shall support command and event packets, where the data
+ * portion (excluding header) contained in the packets is 255 octets in size.
+ * The Host_Total_Num_ACL_Data_Packets command parameter contains the total
+ * number of HCI ACL Data Packets that can be stored in the data buffers of the
+ * Host. The Controller will determine how the buffers are to be divided
+ * between different Connection_Handles.
+ * The Host_Total_Num_Synchronous_Data_Packets command parameter gives the same
+ * information for HCI synchronous Data Packets.
+ * Note: The Host_ACL_Data_Packet_Length and
+ * Host_Synchronous_Data_Packet_Length command parameters do not include the
+ * length of the HCI Data Packet header.
+ * See Core Specification [Vol 4, Part E, 7.3.39].
+ *
+ * @param Host_ACL_Data_Packet_Length Maximum length (in octets) of the data
+ * portion of each HCI ACL Data Packet that the Host is able to accept.
+ * Values:
+ * - 251 ... 65535
+ * @param Host_Synchronous_Data_Packet_Length Maximum length (in octets) of the
+ * data portion of each HCI synchronous Data Packet that the Host is
+ * able to accept. Not used.
+ * @param Host_Total_Num_ACL_Data_Packets Total number of HCI ACL Data Packets
+ * that can be stored in the data buffers of the Host.
+ * Values:
+ * - 1 ... 65535
+ * @param Host_Total_Num_Synchronous_Data_Packets Total number of HCI
+ * synchronous Data Packets that can be stored in the data buffers of
+ * the Host. Not used.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_host_buffer_size( uint16_t Host_ACL_Data_Packet_Length,
+ uint8_t Host_Synchronous_Data_Packet_Length,
+ uint16_t Host_Total_Num_ACL_Data_Packets,
+ uint16_t Host_Total_Num_Synchronous_Data_Packets );
+
+/**
+ * @brief HCI_HOST_NUMBER_OF_COMPLETED_PACKETS
+ * The Host_Number_Of_Completed_Packets command is used by the Host to indicate
+ * to the Controller the number of HCI Data Packets that have been completed
+ * for each Connection_Handle since the previous
+ * Host_Number_Of_Completed_Packets command was sent to the Controller. This
+ * means that the corresponding buffer space has been freed in the Host. Based
+ * on this information, and the Host_Total_Num_ACL_Data_Packets and
+ * Host_Total_Num_Synchronous_Data_Packets command parameters of the
+ * Host_Buffer_Size command, the Controller can determine for which
+ * Connection_Handles the following HCI Data Packets should be sent to the
+ * Host. The command should only be issued by the Host if flow control in the
+ * direction from the Controller to the Host is on and there is at least one
+ * connection, or if the Controller is in local loopback mode. Otherwise, the
+ * command will be ignored by the Controller. When the Host has completed one
+ * or more HCI Data Packet(s) it shall send a Host_Number_Of_Completed_Packets
+ * command to the Controller, until it finally reports that all pending HCI
+ * Data Packets have been completed. The frequency at which this command is
+ * sent is manufacturer specific.
+ * The Set Controller To Host Flow Control Command is used to turn flow control
+ * on or off. If flow control from the Controller to the Host is turned on, the
+ * Host_Buffer_Size command shall always be sent by the Host after a power-on
+ * or a reset before the first Host_Number_Of_Completed_Packets command is
+ * sent.
+ * Note: The Host_Number_Of_Completed_Packets command is a special command in
+ * the sense that no event is normally generated after the command has
+ * completed. The command may be sent at any time by the Host when there is at
+ * least one connection, or if the Controller is in local loopback mode
+ * independent of other commands. The normal flow control for commands is not
+ * used for the Host_Number_Of_Completed_Packets command.
+ * See Core Specification [Vol 4, Part E, 7.3.40].
+ *
+ * @param Number_Of_Handles The number of Connection_Handles and
+ * Host_Num_Of_Completed_Packets parameters pairs contained in this
+ * command.
+ * Values:
+ * - 0 ... 255
+ * @param Host_Nb_Of_Completed_Pkt_Pair See @ref
+ * Host_Nb_Of_Completed_Pkt_Pair_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_host_number_of_completed_packets( uint8_t Number_Of_Handles,
+ const Host_Nb_Of_Completed_Pkt_Pair_t* Host_Nb_Of_Completed_Pkt_Pair );
+
+/**
+ * @brief HCI_READ_LOCAL_VERSION_INFORMATION
+ * This command reads the values for the version information for the local
+ * Controller.
+ * See Core Specification [Vol 4, Part E, 7.4.1].
+ *
+ * @param[out] HCI_Version Version of the HCI Specification supported by the
+ * Controller. See Bluetooth Assigned Numbers.
+ * @param[out] HCI_Subversion Revision of the HCI implementation in the
+ * Controller. This value is vendor-specific.
+ * @param[out] LMP_Version Version of the Current LMP supported by the
+ * Controller. See Bluetooth Assigned Numbers.
+ * @param[out] Company_Identifier Company identifier for the manufacturer of
+ * the Controller. See Bluetooth Assigned Numbers.
+ * @param[out] LMP_Subversion Subversion of the Current LMP in the Controller.
+ * This value is vendor-specific.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_read_local_version_information( uint8_t* HCI_Version,
+ uint16_t* HCI_Subversion,
+ uint8_t* LMP_Version,
+ uint16_t* Company_Identifier,
+ uint16_t* LMP_Subversion );
+
+/**
+ * @brief HCI_READ_LOCAL_SUPPORTED_COMMANDS
+ * This command reads the list of HCI commands supported for the local
+ * Controller. This command shall return the Supported_Commands configuration
+ * parameter. It is implied that if a command is listed as supported, the
+ * feature underlying that command is also supported.
+ * See Core Specification [Vol 4, Part E, 7.4.2].
+ *
+ * @param[out] Supported_Commands Bit mask for each HCI Command. If a bit is 1,
+ * the Controller supports the corresponding command and the features
+ * required for the command.
+ * Unsupported or undefined commands shall be set to 0.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_read_local_supported_commands( uint8_t* Supported_Commands );
+
+/**
+ * @brief HCI_READ_LOCAL_SUPPORTED_FEATURES
+ * This command requests a list of the supported features for the local
+ * Controller. This command will return a list of the LMP features. For details
+ * see Part C, Link Manager Protocol Specification.
+ * See Core Specification [Vol 4, Part E, 7.4.3].
+ *
+ * @param[out] LMP_Features Bit Mask List of LMP features.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_read_local_supported_features( uint8_t* LMP_Features );
+
+/**
+ * @brief HCI_READ_BD_ADDR
+ * On an LE Controller, this command shall read the Public Device Address.
+ * See Core Specification [Vol 4, Part E, 7.4.6].
+ *
+ * @param[out] BD_ADDR BD_ADDR (Bluetooth Device Address) of the device.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_read_bd_addr( uint8_t* BD_ADDR );
+
+/**
+ * @brief HCI_READ_RSSI
+ * This command reads the Received Signal Strength Indication (RSSI) value from
+ * a Controller. For an LE transport, a Connection_Handle is used as the Handle
+ * command parameter and return parameter. The meaning of the RSSI metric is an
+ * absolute receiver signal strength value in dBm to +/- 6 dB accuracy. If the
+ * RSSI cannot be read, the RSSI metric shall be set to 127.
+ * See Core Specification [Vol 4, Part E, 7.5.4].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param[out] RSSI RSSI (signed integer).
+ * Units: dBm.
+ * Values:
+ * - 127: RSSI not available
+ * - -127 ... 20
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_read_rssi( uint16_t Connection_Handle,
+ uint8_t* RSSI );
+
+/**
+ * @brief HCI_LE_SET_EVENT_MASK
+ * The LE_Set_Event_Mask command is used to control which LE events are
+ * generated by the HCI for the Host. If the bit in the LE_Event_Mask is set to
+ * a one, then the event associated with that bit will be enabled. The Host has
+ * to deal with each event that is generated by an LE Controller. The event
+ * mask allows the Host to control which events will interrupt it.
+ * For LE events to be generated, the LE Meta-Event bit in the Event_Mask shall
+ * also be set. If that bit is not set, then LE events shall not be generated,
+ * regardless of how the LE_Event_Mask is set.
+ * See Core Specification [Vol 4, Part E, 7.8.1].
+ *
+ * @param LE_Event_Mask LE event mask. Default: 0x000000C7FFF7F85F. Note that
+ * the BLE stack ignores the bits which represent events it does not
+ * support (according to its variant).
+ * Flags:
+ * - 0x0000000000000000: No LE events specified
+ * - 0x0000000000000001: LE Connection Complete event
+ * - 0x0000000000000002: LE Advertising Report event
+ * - 0x0000000000000004: LE Connection Update Complete event
+ * - 0x0000000000000008: LE Read Remote Features Complete event
+ * - 0x0000000000000010: LE Long Term Key Request event
+ * - 0x0000000000000020: LE Remote Connection Parameter Request event
+ * - 0x0000000000000040: LE Data Length Change event
+ * - 0x0000000000000080: LE Read Local P-256 Public Key Complete event
+ * - 0x0000000000000100: LE Generate DHKey Complete event
+ * - 0x0000000000000200: LE Enhanced Connection Complete event
+ * - 0x0000000000000400: LE Directed Advertising Report event
+ * - 0x0000000000000800: LE PHY Update Complete event
+ * - 0x0000000000001000: LE Extended Advertising Report event
+ * - 0x0000000000002000: LE Periodic Advertising Sync Established event
+ * - 0x0000000000004000: LE Periodic Advertising Report event
+ * - 0x0000000000008000: LE Periodic Advertising Sync Lost event
+ * - 0x0000000000010000: LE Scan Timeout event
+ * - 0x0000000000020000: LE Advertising Set Terminated event
+ * - 0x0000000000040000: LE Scan Request Received event
+ * - 0x0000000000080000: LE Channel Selection Algorithm event
+ * - 0x0000000000100000: LE Connectionless IQ Report event
+ * - 0x0000000000200000: LE Connection IQ Report event
+ * - 0x0000000000400000: LE CTE Request Failed event
+ * - 0x0000000000800000: LE Periodic Advertising Sync Transfer Received
+ * event
+ * - 0x0000000001000000: LE CIS Established event
+ * - 0x0000000002000000: LE CIS Request event
+ * - 0x0000000004000000: LE Create BIG Complete event
+ * - 0x0000000008000000: LE Terminate BIG Complete event
+ * - 0x0000000010000000: LE BIG Sync Established event
+ * - 0x0000000020000000: LE BIG Sync Lost event
+ * - 0x0000000040000000: LE Request Peer SCA Complete event
+ * - 0x0000000080000000: LE Path Loss Threshold event
+ * - 0x0000000100000000: LE Transmit Power Reporting event
+ * - 0x0000000200000000: LE BIGInfo Advertising Report event
+ * - 0x0000000400000000: LE Subrate Change event
+ * - 0x0000000800000000: LE Periodic Advertising Sync Established event
+ * [v2]
+ * - 0x0000001000000000: LE Periodic Advertising Report event [v2]
+ * - 0x0000002000000000: LE Periodic Advertising Sync Transfer Received
+ * event [v2]
+ * - 0x0000004000000000: LE Periodic Advertising Subevent Data Request
+ * event
+ * - 0x0000008000000000: LE Periodic Advertising Response Report event
+ * - 0x0000010000000000: LE Enhanced Connection Complete event [v2]
+ * - 0x0000020000000000: LE CIS Established event [v2]
+ * - 0x0000040000000000: LE Read All Remote Features Complete event
+ * - 0x0000080000000000: LE CS Read Remote Supported Capabilities
+ * Complete event
+ * - 0x0000100000000000: LE CS Read Remote FAE Table Complete event
+ * - 0x0000200000000000: LE CS Security Enable Complete event
+ * - 0x0000400000000000: LE CS Config Complete event
+ * - 0x0000800000000000: LE CS Procedure Enable Complete event
+ * - 0x0001000000000000: LE CS Subevent Result event
+ * - 0x0002000000000000: LE CS Subevent Result Continue event
+ * - 0x0004000000000000: LE CS Test End Complete event
+ * - 0x0008000000000000: LE Monitored Advertisers Report event
+ * - 0x0010000000000000: LE Frame Space Update Complete event
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_event_mask( const uint8_t* LE_Event_Mask );
+
+/**
+ * @brief HCI_LE_READ_BUFFER_SIZE
+ * The LE_Read_Buffer_Size command is used to read the maximum size of the data
+ * portion of HCI LE ACL Data Packets sent from the Host to the Controller.
+ * The Host will segment the data transmitted to the Controller according to
+ * these values, so that the HCI Data Packets will contain data with up to this
+ * size. The LE_Read_Buffer_Size command also returns the total number of HCI
+ * LE ACL Data Packets that can be stored in the data buffers of the
+ * Controller. The LE_Read_Buffer_Size command must be issued by the Host
+ * before it sends any data to an LE Controller (see Section 4.1.1).
+ * If the Controller returns a length value of zero, the Host shall use the
+ * Read_Buffer_Size command to determine the size of the data buffers.
+ * Note: Both the Read_Buffer_Size and LE_Read_Buffer_Size commands may return
+ * buffer length and number of packets parameter values that are nonzero.
+ * The HC_LE_ACL_Data_Packet_Length return parameter shall be used to determine
+ * the size of the L2CAP PDU segments contained in ACL Data Packets, which are
+ * transferred from the Host to the Controller to be broken up into packets by
+ * the Link Layer. Both the Host and the Controller shall support command and
+ * event packets, where the data portion (excluding header) contained in the
+ * packets is 255 octets in size. The HC_Total_Num_LE_ACL_Data_Packets return
+ * parameter contains the total number of HCI ACL Data Packets that can be
+ * stored in the data buffers of the Controller. The Host determines how the
+ * buffers are to be divided between different Connection Handles.
+ * Note: The HC_LE_ACL_Data_Packet_Length return parameter does not include the
+ * length of the HCI Data Packet header.
+ * See Core Specification [Vol 4, Part E, 7.8.2].
+ *
+ * @param[out] HC_LE_ACL_Data_Packet_Length Used to determine the maximum size
+ * of the L2CAP PDU segments that are contained in ACL data packets, and
+ * which are transferred from the Host to the Controller to be broken up
+ * into packets by the Link Layer.
+ * Values:
+ * - 0x0000: No dedicated LE Buffer exists.
+ * - 0x001B ... 0x00FF: Maximum length (in octets) of the data portion
+ * of each HCI ACL data packet.
+ * @param[out] HC_Total_Num_LE_ACL_Data_Packets Contains the total number of
+ * HCI ACL Data packets that can be stored in the data buffers of the
+ * Controller.
+ * Values:
+ * - 0x00: No dedicated LE Buffer exists.
+ * - 0x01 ... 0xFF: The total number of HCI ACL data packets that can be
+ * stored in the data buffers of the Controller.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_buffer_size( uint16_t* HC_LE_ACL_Data_Packet_Length,
+ uint8_t* HC_Total_Num_LE_ACL_Data_Packets );
+
+/**
+ * @brief HCI_LE_READ_LOCAL_SUPPORTED_FEATURES_PAGE_0
+ * This command requests page 0 of the list of the supported LE features for
+ * the Controller.
+ * See Core Specification [Vol 4, Part E, 7.8.3].
+ *
+ * @param[out] LE_Features Bit Mask List of page 0 of the supported LE
+ * features. See Core Specification [Vol 6, Part B, 4.6].
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_local_supported_features_page_0( uint8_t* LE_Features );
+
+/**
+ * @brief HCI_LE_SET_RANDOM_ADDRESS
+ * The LE_Set_Random_Address command is used by the Host to set the LE Random
+ * Device Address in the Controller (see [Vol 6] Part B, Section 1.3).
+ * See Core Specification [Vol 4, Part E, 7.8.4].
+ *
+ * @param Random_Address Random Device Address.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_random_address( const uint8_t* Random_Address );
+
+/**
+ * @brief HCI_LE_SET_ADVERTISING_PARAMETERS
+ * The LE_Set_Advertising_Parameters command is used by the Host to set the
+ * advertising parameters.
+ * The Advertising_Interval_Min shall be less than or equal to the
+ * Advertising_Interval_Max.
+ * The Advertising_Interval_Min and Advertising_Interval_Max should not be the
+ * same value to enable the Controller to determine the best advertising
+ * interval given other activities.
+ * For high duty cycle directed advertising, i.e. when Advertising_Type is 0x01
+ * (ADV_DIRECT_IND, high duty cycle), the Advertising_Interval_Min and
+ * Advertising_Interval_Max parameters are not used and shall be ignored.
+ * The Advertising_Type is used to determine the packet type that is used for
+ * advertising when advertising is enabled.
+ * The Advertising_Interval_Min and Advertising_Interval_Max shall not be set
+ * to less than 0x00A0 (100 ms) if the Advertising_Type is set to 0x02
+ * (ADV_SCAN_IND) or 0x03 (ADV_NONCONN_IND). The Own_Address_Type determines if
+ * the advertising packets are identified with the Public Device Address of the
+ * device, or a Random Device Address as written by the LE_Set_Random_Address
+ * command.
+ * If directed advertising is performed, i.e. when Advertising_Type is set to
+ * 0x01 (ADV_DIRECT_IND, high duty cycle) or 0x04 (ADV_DIRECT_IND, low duty
+ * cycle mode), then the Direct_Address_Type and Direct_Address shall be valid,
+ * otherwise they shall be ignored by the Controller and not used.
+ * The Advertising_Channel_Map is a bit field that indicates the advertising
+ * channels that shall be used when transmitting advertising packets. At least
+ * one channel bit shall be set in the Advertising_Channel_Map parameter.
+ * The Advertising_Filter_Policy parameter shall be ignored when directed
+ * advertising is enabled.
+ * The Host shall not issue this command when advertising is enabled in the
+ * Controller; if it is the Command Disallowed error code shall be used.
+ * See Core Specification [Vol 4, Part E, 7.8.5].
+ *
+ * @param Advertising_Interval_Min Minimum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
+ * @param Advertising_Interval_Max Maximum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0020 (20.000 ms) ... 0x4000 (10240.000 ms)
+ * @param Advertising_Type Advertising type.
+ * Values:
+ * - 0x00: ADV_IND (Connectable undirected advertising)
+ * - 0x01: ADV_DIRECT_IND, high duty cycle (Connectable high duty cycle
+ * directed advertising)
+ * - 0x02: ADV_SCAN_IND (Scannable undirected advertising)
+ * - 0x03: ADV_NONCONN_IND (Non connectable undirected advertising)
+ * - 0x04: ADV_DIRECT_IND_LDC, low duty cycle (Connectable low duty
+ * cycle directed advertising)
+ * @param Own_Address_Type Own address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * - 0x02: Resolvable Private Address if available, otherwise Public
+ * Address
+ * - 0x03: Resolvable Private Address if available, otherwise Random
+ * Address
+ * @param Peer_Address_Type Address type of the peer device.
+ * Values:
+ * - 0x00: Public Device Address or Public Identity Address
+ * - 0x01: Random Device Address or Random (static) Identity Address
+ * @param Peer_Address Public Device Address, Random Device Address, Public
+ * Identity Address, or Random (static) Identity Address of the device
+ * to be connected.
+ * @param Advertising_Channel_Map Advertising channel map.
+ * Flags:
+ * - 0x01: Channel 37 shall be used
+ * - 0x02: Channel 38 shall be used
+ * - 0x04: Channel 39 shall be used
+ * @param Advertising_Filter_Policy Advertising filter policy.
+ * Values:
+ * - 0x00: Allow Scan Request from Any, Allow Connect Request from Any
+ * - 0x01: Allow Scan Request from Filter Accept List Only, Allow
+ * Connect Request from Any
+ * - 0x02: Allow Scan Request from Any, Allow Connect Request from
+ * Filter Accept List Only
+ * - 0x03: Allow Scan Request from Filter Accept List Only, Allow
+ * Connect Request from Filter Accept List Only
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_advertising_parameters( uint16_t Advertising_Interval_Min,
+ uint16_t Advertising_Interval_Max,
+ uint8_t Advertising_Type,
+ uint8_t Own_Address_Type,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint8_t Advertising_Channel_Map,
+ uint8_t Advertising_Filter_Policy );
+
+/**
+ * @brief HCI_LE_READ_ADVERTISING_PHYSICAL_CHANNEL_TX_POWER
+ * The LE_Read_Advertising_Physical_Channel_Tx_Power command is used by the
+ * Host to read the transmit power level used for LE advertising physical
+ * channel packets.
+ * See Core Specification [Vol 4, Part E, 7.8.6].
+ *
+ * @param[out] Transmit_Power_Level Size: 1 Octet (signed integer)
+ * Units: dBm
+ * Accuracy: +/- 4 dBm
+ * Values:
+ * - -20 ... 10
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_advertising_physical_channel_tx_power( uint8_t* Transmit_Power_Level );
+
+/**
+ * @brief HCI_LE_SET_ADVERTISING_DATA
+ * The LE_Set_Advertising_Data command is used to set the data used in
+ * advertising packets that have a data field.
+ * Only the significant part of the Advertising_Data is transmitted in the
+ * advertising packets, as defined in [Vol 3] Part C, Section 11.,
+ * See Core Specification [Vol 4, Part E, 7.8.7].
+ *
+ * @param Advertising_Data_Length The number of significant octets in the
+ * following data field
+ * @param Advertising_Data 31 octets of data formatted as defined in [Vol 3]
+ * Part C, Section 11.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_advertising_data( uint8_t Advertising_Data_Length,
+ const uint8_t* Advertising_Data );
+
+/**
+ * @brief HCI_LE_SET_SCAN_RESPONSE_DATA
+ * This command is used to provide data used in Scanning Packets that have a
+ * data field.
+ * Only the significant part of the Scan_Response_Data is transmitted in the
+ * Scanning Packets, as defined in [Vol 3] Part C, Section 11.
+ * See Core Specification [Vol 4, Part E, 7.8.8].
+ *
+ * @param Scan_Response_Data_Length The number of significant octets in the
+ * following data field
+ * @param Scan_Response_Data 31 octets of data formatted as defined in [Vol 3]
+ * Part C, Section 11.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_scan_response_data( uint8_t Scan_Response_Data_Length,
+ const uint8_t* Scan_Response_Data );
+
+/**
+ * @brief HCI_LE_SET_ADVERTISING_ENABLE
+ * The LE_Set_Advertising_Enable command is used to request the Controller to
+ * start or stop advertising. The Controller manages the timing of
+ * advertisements as per the advertising parameters given in the
+ * LE_Set_Advertising_Parameters command.
+ * The Controller shall continue advertising until the Host issues an
+ * LE_Set_Advertising_Enable command with Advertising_Enable set to 0x00
+ * (Advertising is disabled) or until a connection is created or until the
+ * Advertising is timed out due to high duty cycle Directed Advertising. In
+ * these cases, advertising is then disabled.
+ * See Core Specification [Vol 4, Part E, 7.8.9].
+ *
+ * @param Advertising_Enable Enable/disable advertising.
+ * Values:
+ * - 0x00: Advertising is disabled
+ * - 0x01: Advertising is enabled
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_advertising_enable( uint8_t Advertising_Enable );
+
+/**
+ * @brief HCI_LE_SET_SCAN_PARAMETERS
+ * The LE_Set_Scan_Parameters command is used to set the scan parameters.
+ * The LE_Scan_Type parameter controls the type of scan to perform.
+ * The LE_Scan_Interval and LE_Scan_Window parameters are recommendations from
+ * the Host on how long (LE_Scan_Window) and how frequently (LE_Scan_Interval)
+ * the Controller should scan (See [Vol 6] Part B, Section 4.4.3). The
+ * LE_Scan_Window parameter shall always be set to a value smaller or equal to
+ * the value set for the LE_Scan_Interval parameter. If they are set to the
+ * same value scanning should be run continuously.
+ * The Own_Address_Type parameter determines the address used (Public or Random
+ * Device Address) when performing active scan.
+ * The Host shall not issue this command when scanning is enabled in the
+ * Controller; if it is the Command Disallowed error code shall be used.
+ * See Core Specification [Vol 4, Part E, 7.8.10].
+ *
+ * @param LE_Scan_Type Passive or active scanning. With passive scanning, no
+ * scan request PDUs are sent.
+ * Values:
+ * - 0x00: Passive scanning
+ * - 0x01: Active scanning
+ * @param LE_Scan_Interval This is defined as the time interval from when the
+ * Controller started its last LE scan until it begins the subsequent LE
+ * scan.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
+ * @param LE_Scan_Window Amount of time for the duration of the LE scan.
+ * LE_Scan_Window shall be less than or equal to LE_Scan_Interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
+ * @param Own_Address_Type Own address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * - 0x02: Resolvable Private Address if available, otherwise Public
+ * Address
+ * - 0x03: Resolvable Private Address if available, otherwise Random
+ * Address
+ * @param Scanning_Filter_Policy The scanning filter policy determines how the
+ * scanner's Link Layer processes advertising and scan response PDUs.
+ * There is a choice of two primary filter policies: unfiltered and
+ * filtered.
+ * Unfiltered: the Link Layer processes all advertising and scan
+ * response PDUs (i.e., the Filter Accept List is not used).
+ * Filtered: the Link Layer processes advertising and scan response PDUs
+ * only from devices in the Filter Accept List.
+ * With extended scanning filter policies, a directed advertising PDU
+ * accepted by the primary filter policy shall nevertheless be ignored
+ * unless either the TargetA field is identical to the scanner's device
+ * address, or TargetA field is a resolvable private address.
+ * Values:
+ * - 0x00: Basic unfiltered scanning filter policy
+ * - 0x01: Basic filtered scanning filter policy
+ * - 0x02: Extended unfiltered scanning filter policy
+ * - 0x03: Extended filtered scanning filter policy
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_scan_parameters( uint8_t LE_Scan_Type,
+ uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t Own_Address_Type,
+ uint8_t Scanning_Filter_Policy );
+
+/**
+ * @brief HCI_LE_SET_SCAN_ENABLE
+ * The LE_Set_Scan_Enable command is used to start scanning. Scanning is used
+ * to discover advertising devices nearby.
+ * The Filter_Duplicates parameter controls whether the Link Layer shall filter
+ * duplicate advertising reports to the Host, or if the Link Layer should
+ * generate advertising reports for each packet received.
+ * See Core Specification [Vol 4, Part E, 7.8.11].
+ *
+ * @param LE_Scan_Enable Enable/disable scan.
+ * Values:
+ * - 0x00: Scanning disabled
+ * - 0x01: Scanning enabled
+ * @param Filter_Duplicates Enable/disable duplicate filtering.
+ * Values:
+ * - 0x00: Duplicate filtering disabled
+ * - 0x01: Duplicate filtering enabled
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_scan_enable( uint8_t LE_Scan_Enable,
+ uint8_t Filter_Duplicates );
+
+/**
+ * @brief HCI_LE_CREATE_CONNECTION
+ * The LE_Create_Connection command is used to create a Link Layer connection
+ * to a connectable advertiser.
+ * The LE_Scan_Interval and LE_Scan_Window parameters are recommendations from
+ * the Host on how long (LE_Scan_Window) and how frequently (LE_Scan_Interval)
+ * the Controller should scan. The LE_Scan_Window parameter shall be set to a
+ * value smaller or equal to the value set for the LE_Scan_Interval parameter.
+ * If both are set to the same value, scanning should run continuously.
+ * The Initiator_Filter_Policy is used to determine whether the Filter Accept
+ * List is used. If the Filter Accept List is not used, the Peer_Address_Type
+ * and the Peer_Address parameters specify the address type and address of the
+ * advertising device to connect to.
+ * The Link Layer shall set the address in the CONNECT_REQ packets to either
+ * the Public Device Address or the Random Device Addressed based on the
+ * Own_Address_Type parameter.
+ * The Conn_Interval_Min and Conn_Interval_Max parameters define the minimum
+ * and maximum allowed connection interval. The Conn_Interval_Min parameter
+ * shall not be greater than the Conn_Interval_Max parameter.
+ * The Conn_Latency parameter defines the maximum allowed connection latency.
+ * The Supervision_Timeout parameter defines the link supervision timeout for
+ * the connection. The Supervision_Timeout in milliseconds shall be larger than
+ * (1 + Conn_Latency) * Conn_Interval_Max * 2, where Conn_Interval_Max is given
+ * in milliseconds.
+ * The Minimum_CE_Length and Maximum_CE_Length parameters are informative
+ * parameters providing the Controller with the expected minimum and maximum
+ * length of the connection events. The Minimum_CE_Length parameter shall be
+ * less than or equal to the Maximum_CE_Length parameter.
+ * The Host shall not issue this command when another LE_Create_Connection is
+ * pending in the Controller; if this does occur the Controller shall return
+ * the Command Disallowed error code shall be used.
+ * See Core Specification [Vol 4, Part E, 7.8.12].
+ *
+ * @param LE_Scan_Interval This is defined as the time interval from when the
+ * Controller started its last LE scan until it begins the subsequent LE
+ * scan.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
+ * @param LE_Scan_Window Amount of time for the duration of the LE scan.
+ * LE_Scan_Window shall be less than or equal to LE_Scan_Interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x4000 (10240.000 ms)
+ * @param Initiator_Filter_Policy Initiator filter policy.
+ * Values:
+ * - 0x00: Filter Accept List is not used to determine which advertiser
+ * to connect to
+ * - 0x01: Filter Accept List is used to determine which advertiser to
+ * connect to (Peer_Address_Type and Peer_Address are ignored)
+ * @param Peer_Address_Type Address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * - 0x02: Public Identity Address (corresponds to the Resolved Private
+ * Address)
+ * - 0x03: Random (static) Identity Address (corresponds to the Resolved
+ * Private Address)
+ * @param Peer_Address Public Device Address or Random Device Address of the
+ * device to be connected.
+ * @param Own_Address_Type Own address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * - 0x02: Resolvable Private Address if available, otherwise Public
+ * Address
+ * - 0x03: Resolvable Private Address if available, otherwise Random
+ * Address
+ * @param Conn_Interval_Min Minimum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Interval_Max Maximum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Latency Maximum Peripheral latency for the connection in number
+ * of connection events.
+ * Values:
+ * - 0x0000 ... 0x01F3
+ * @param Supervision_Timeout Supervision timeout for the LE Link.
+ * It shall be a multiple of 10 ms and larger than (1 +
+ * connPeripheralLatency) * connInterval * 2.
+ * Time = N * 10 ms.
+ * Values:
+ * - 0x000A (100 ms) ... 0x0C80 (32000 ms)
+ * @param Minimum_CE_Length Information parameter about the minimum length of
+ * connection needed for this LE connection.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
+ * @param Maximum_CE_Length Information parameter about the maximum length of
+ * connection needed for this LE connection.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_create_connection( uint16_t LE_Scan_Interval,
+ uint16_t LE_Scan_Window,
+ uint8_t Initiator_Filter_Policy,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint8_t Own_Address_Type,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max,
+ uint16_t Conn_Latency,
+ uint16_t Supervision_Timeout,
+ uint16_t Minimum_CE_Length,
+ uint16_t Maximum_CE_Length );
+
+/**
+ * @brief HCI_LE_CREATE_CONNECTION_CANCEL
+ * The LE_Create_Connection_Cancel command is used to cancel the
+ * LE_Create_Connection command. This command shall only be issued after the
+ * LE_Create_Connection command has been issued, a Command Status event has
+ * been received for the LE Create Connection command and before the LE
+ * Connection Complete event.
+ * See Core Specification [Vol 4, Part E, 7.8.13].
+ *
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_create_connection_cancel( void );
+
+/**
+ * @brief HCI_LE_READ_FILTER_ACCEPT_LIST_SIZE
+ * This command is used to read the total number of Filter Accept List entries
+ * that can be stored in the Controller.
+ * See Core Specification [Vol 4, Part E, 7.8.14].
+ *
+ * @param[out] Filter_Accept_List_Size Total number of Filter Accept List
+ * entries that can be stored in the Controller.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_filter_accept_list_size( uint8_t* Filter_Accept_List_Size );
+
+/**
+ * @brief HCI_LE_CLEAR_FILTER_ACCEPT_LIST
+ * This command is used to clear the Filter Accept List stored in the
+ * Controller.
+ * This command can be used at any time except when:
+ * - the advertising filter policy uses the Filter Accept List and advertising
+ * is enabled.
+ * - the scanning filter policy uses the Filter Accept List and scanning is
+ * enabled.
+ * - the initiator filter policy uses the Filter Accept List and an
+ * HCI_LE_Create_Connection or HCI_LE_Extended_Create_Connection command is
+ * pending.
+ * See Core Specification [Vol 4, Part E, 7.8.15].
+ *
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_clear_filter_accept_list( void );
+
+/**
+ * @brief HCI_LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST
+ * This command is used to add a single device to the Filter Accept List stored
+ * in the Controller.
+ * This command can be used at any time except when:
+ * - the advertising filter policy uses the Filter Accept List and advertising
+ * is enabled.
+ * - the scanning filter policy uses the Filter Accept List and scanning is
+ * enabled.
+ * - the initiator filter policy uses the Filter Accept List and an
+ * HCI_LE_Create_Connection or HCI_LE_Extended_Create_Connection command is
+ * pending.
+ * See Core Specification [Vol 4, Part E, 7.8.16].
+ *
+ * @param Address_Type Address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * - 0xFF: Devices sending anonymous advertisements
+ * @param Address Public Device Address or Random Device Address.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_add_device_to_filter_accept_list( uint8_t Address_Type,
+ const uint8_t* Address );
+
+/**
+ * @brief HCI_LE_REMOVE_DEVICE_FROM_FILTER_ACCEPT_LIST
+ * This command is used to remove a single device from the Filter Accept List
+ * stored in the Controller.
+ * This command can be used at any time except when:
+ * - the advertising filter policy uses the Filter Accept List and advertising
+ * is enabled.
+ * - the scanning filter policy uses the Filter Accept List and scanning is
+ * enabled.
+ * - the initiator filter policy uses the Filter Accept List and an
+ * HCI_LE_Create_Connection or HCI_LE_Extended_Create_Connection command is
+ * pending.
+ * See Core Specification [Vol 4, Part E, 7.8.17].
+ *
+ * @param Address_Type Address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * - 0xFF: Devices sending anonymous advertisements
+ * @param Address Public Device Address or Random Device Address.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_remove_device_from_filter_accept_list( uint8_t Address_Type,
+ const uint8_t* Address );
+
+/**
+ * @brief HCI_LE_CONNECTION_UPDATE
+ * The LE_Connection_Update command is used to change the Link Layer connection
+ * parameters of a connection. This command is supported only on Central side.
+ * The Conn_Interval_Min and Conn_Interval_Max parameters are used to define
+ * the minimum and maximum allowed connection interval. The Conn_Interval_Min
+ * parameter shall not be greater than the Conn_Interval_Max parameter.
+ * The Conn_Latency parameter shall define the maximum allowed connection
+ * latency.
+ * The Supervision_Timeout parameter shall define the link supervision timeout
+ * for the LE link. The Supervision_Timeout in milliseconds shall be larger
+ * than (1 + Conn_Latency) * Conn_Interval_Max * 2, where Conn_Interval_Max is
+ * given in milliseconds.
+ * The Minimum_CE_Length and Maximum_CE_Length are information parameters
+ * providing the Controller with a hint about the expected minimum and maximum
+ * length of the connection events. The Minimum_CE_Length shall be less than or
+ * equal to the Maximum_CE_Length.
+ * The actual parameter values selected by the Link Layer may be different from
+ * the parameter values provided by the Host through this command.
+ * See Core Specification [Vol 4, Part E, 7.8.18].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Conn_Interval_Min Minimum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Interval_Max Maximum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Latency Maximum Peripheral latency for the connection in number
+ * of connection events.
+ * Values:
+ * - 0x0000 ... 0x01F3
+ * @param Supervision_Timeout Supervision timeout for the LE Link.
+ * It shall be a multiple of 10 ms and larger than (1 +
+ * connPeripheralLatency) * connInterval * 2.
+ * Time = N * 10 ms.
+ * Values:
+ * - 0x000A (100 ms) ... 0x0C80 (32000 ms)
+ * @param Minimum_CE_Length Information parameter about the minimum length of
+ * connection needed for this LE connection.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
+ * @param Maximum_CE_Length Information parameter about the maximum length of
+ * connection needed for this LE connection.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_connection_update( uint16_t Connection_Handle,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max,
+ uint16_t Conn_Latency,
+ uint16_t Supervision_Timeout,
+ uint16_t Minimum_CE_Length,
+ uint16_t Maximum_CE_Length );
+
+/**
+ * @brief HCI_LE_SET_HOST_CHANNEL_CLASSIFICATION
+ * The LE_Set_Host_Channel_Classification command allows the Host to specify a
+ * channel classification for data channels based on its "local information".
+ * This classification persists until overwritten with a subsequent
+ * LE_Set_Host_Channel_Classification command or until the Controller is reset
+ * using the Reset command (see [Vol 6] Part B, Section 4.5.8.1).
+ * If this command is used, the Host should send it within 10 seconds of
+ * knowing that the channel classification has changed. The interval between
+ * two successive commands sent shall be at least one second.
+ * This command shall only be used when the local device supports the Central
+ * role.
+ * See Core Specification [Vol 4, Part E, 7.8.19].
+ *
+ * @param LE_Channel_Map This parameter contains 37 1-bit fields.
+ * The nth such field (in the range 0 to 36) contains the value for the
+ * link layer channel index n.
+ * Channel n is bad = 0.
+ * Channel n is unknown = 1.
+ * The most significant bits are reserved and shall be set to 0.
+ * At least one channel shall be marked as unknown.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_host_channel_classification( const uint8_t* LE_Channel_Map );
+
+/**
+ * @brief HCI_LE_READ_CHANNEL_MAP
+ * The LE_Read_Channel_Map command returns the current Channel_Map for the
+ * specified Connection_Handle. The returned value indicates the state of the
+ * Channel_Map specified by the last transmitted or received Channel_Map (in a
+ * CONNECT_REQ or LL_CHANNEL_MAP_REQ message) for the specified
+ * Connection_Handle, regardless of whether the Central has received an
+ * acknowledgment.
+ * See Core Specification [Vol 4, Part E, 7.8.20].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param[out] LE_Channel_Map This parameter contains 37 1-bit fields.
+ * The nth such field (in the range 0 to 36) contains the value for the
+ * link layer channel index n.
+ * Channel n is unused = 0.
+ * Channel n is used = 1.
+ * The most significant bits are reserved and shall be set to 0.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_channel_map( uint16_t Connection_Handle,
+ uint8_t* LE_Channel_Map );
+
+/**
+ * @brief HCI_LE_READ_REMOTE_FEATURES_PAGE_0
+ * This command requests, from the remote device identified by the
+ * Connection_Handle, page 0 of the features used on the connection and the
+ * features supported by the remote device.
+ * This command may be issued on both the Central and Peripheral.
+ * See Core Specification [Vol 4, Part E, 7.8.21].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_remote_features_page_0( uint16_t Connection_Handle );
+
+/**
+ * @brief HCI_LE_ENCRYPT
+ * The LE_Encrypt command is used to request the Controller to encrypt the
+ * Plaintext_Data in the command using the Key given in the command and returns
+ * the Encrypted_Data to the Host. The AES-128 bit block cypher is defined in
+ * NIST Publication FIPS-197
+ * (http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf).
+ * See Core Specification [Vol 4, Part E, 7.8.22].
+ *
+ * @param Key 128 bit key for the encryption of the data given in the command.
+ * @param Plaintext_Data 128 bit data block that is requested to be encrypted.
+ * @param[out] Encrypted_Data 128 bit encrypted data block.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_encrypt( const uint8_t* Key,
+ const uint8_t* Plaintext_Data,
+ uint8_t* Encrypted_Data );
+
+/**
+ * @brief HCI_LE_RAND
+ * The LE_Rand command is used to request the Controller to generate 8 octets
+ * of random data to be sent to the Host. The Random_Number shall be generated
+ * according to [Vol 2] Part H, Section 2 if the LE Feature (LL Encryption) is
+ * supported.
+ * See Core Specification [Vol 4, Part E, 7.8.23].
+ *
+ * @param[out] Random_Number Random Number
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_rand( uint8_t* Random_Number );
+
+/**
+ * @brief HCI_LE_ENABLE_ENCRYPTION
+ * The LE_Enable_Encryption command is used to authenticate the given
+ * encryption key associated with the remote device specified by the connection
+ * handle, and once authenticated will encrypt the connection. The parameters
+ * are as defined in [Vol 3] Part H, Section 2.4.4.
+ * If the connection is already encrypted then the Controller shall pause
+ * connection encryption before attempting to authenticate the given encryption
+ * key, and then re-encrypt the connection. While encryption is paused no user
+ * data shall be transmitted.
+ * On an authentication failure, the connection shall be automatically
+ * disconnected by the Link Layer. If this command succeeds, then the
+ * connection shall be encrypted.
+ * This command shall only be used when the local device's role is Central.
+ * See Core Specification [Vol 4, Part E, 7.8.24].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Random_Number 64 bit random number.
+ * @param Encrypted_Diversifier 16 bit encrypted diversifier.
+ * @param Long_Term_Key 128 bit long term key.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_enable_encryption( uint16_t Connection_Handle,
+ const uint8_t* Random_Number,
+ uint16_t Encrypted_Diversifier,
+ const uint8_t* Long_Term_Key );
+
+/**
+ * @brief HCI_LE_LONG_TERM_KEY_REQUEST_REPLY
+ * The LE_Long_Term_Key_Request_Reply command is used to reply to an LE Long
+ * Term Key Request event from the Controller, and specifies the Long_Term_Key
+ * parameter that shall be used for this Connection_Handle. The Long_Term_Key
+ * is used as defined in [Vol 6] Part B, Section 5.1.3.
+ * See Core Specification [Vol 4, Part E, 7.8.25].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Long_Term_Key 128 bit long term key.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_long_term_key_request_reply( uint16_t Connection_Handle,
+ const uint8_t* Long_Term_Key );
+
+/**
+ * @brief HCI_LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY
+ * The LE_Long_Term_Key_Request_Negative_Reply command is used to reply to an
+ * LE Long Term Key Request event from the Controller if the Host cannot
+ * provide a Long Term Key for this Connection_Handle.
+ * See Core Specification [Vol 4, Part E, 7.8.26].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_long_term_key_request_negative_reply( uint16_t Connection_Handle );
+
+/**
+ * @brief HCI_LE_READ_SUPPORTED_STATES
+ * The LE_Read_Supported_States command reads the states and state combinations
+ * that the link layer supports. See [Vol 6] Part B, Section 1.1.1.
+ * LE_States is an 8-octet bit field. If a bit is set to 1 then this state or
+ * state combination is supported by the Controller. Multiple bits in LE_States
+ * may be set to 1 to indicate support for multiple state and state
+ * combinations.
+ * All the Advertising type with the Initiate State combinations shall be set
+ * only if the corresponding Advertising types and Central role combination are
+ * set.
+ * All the Scanning types and the Initiate State combinations shall be set only
+ * if the corresponding Scanning types and Central role combination are set.
+ * See Core Specification [Vol 4, Part E, 7.8.27].
+ *
+ * @param[out] LE_States State or state combination is supported by the
+ * Controller.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_supported_states( uint8_t* LE_States );
+
+/**
+ * @brief HCI_LE_RECEIVER_TEST
+ * This command is used to start a test where the DUT receives test reference
+ * packets at a fixed interval. The tester generates the test reference
+ * packets.
+ * See Core Specification [Vol 4, Part E, 7.8.28].
+ *
+ * @param RX_Frequency N = (F - 2402) / 2
+ * Frequency Range : 2402 MHz to 2480 MHz
+ * Values:
+ * - 0x00 ... 0x27
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_receiver_test( uint8_t RX_Frequency );
+
+/**
+ * @brief HCI_LE_TRANSMITTER_TEST
+ * This command is used to start a test where the DUT generates test reference
+ * packets at a fixed interval.
+ * See Core Specification [Vol 4, Part E, 7.8.29].
+ *
+ * @param TX_Frequency N = (F - 2402) / 2
+ * Frequency Range : 2402 MHz to 2480 MHz
+ * Values:
+ * - 0x00 ... 0x27
+ * @param Length_Of_Test_Data Length in bytes of payload data in each packet.
+ * Values:
+ * - 0x00 ... 0x25: for BO variant
+ * - 0x00 ... 0xFF: otherwise
+ * @param Packet_Payload Type of packet payload.
+ * Values:
+ * - 0x00: Pseudo-Random bit sequence 9
+ * - 0x01: Pattern of alternating bits '11110000'
+ * - 0x02: Pattern of alternating bits '10101010'
+ * - 0x03: Pseudo-Random bit sequence 15
+ * - 0x04: Pattern of All '1' bits
+ * - 0x05: Pattern of All '0' bits
+ * - 0x06: Pattern of alternating bits '00001111'
+ * - 0x07: Pattern of alternating bits '0101'
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_transmitter_test( uint8_t TX_Frequency,
+ uint8_t Length_Of_Test_Data,
+ uint8_t Packet_Payload );
+
+/**
+ * @brief HCI_LE_TEST_END
+ * This command is used to stop any test which is in progress. The
+ * Number_Of_Packets for a transmitter test is reported as 0x0000. The
+ * Number_Of_Packets is an unsigned number and contains the number of received
+ * packets.
+ * See Core Specification [Vol 4, Part E, 7.8.30].
+ *
+ * @param[out] Number_Of_Packets Number of packets received
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_test_end( uint16_t* Number_Of_Packets );
+
+/**
+ * @brief HCI_LE_SET_DATA_LENGTH
+ * The LE_Set_Data_Length command allows the Host to suggest maximum
+ * transmission packet size and maximum packet transmission time
+ * (connMaxTxOctets and connMaxTxTime - see Core Specification [Vol 6, Part B,
+ * 4.5.10]) to be used for a given connection. The Controller may use smaller
+ * or larger values based on local information.
+ * See Core Specification [Vol 4, Part E, 7.8.33].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param TxOctets Preferred maximum number of payload octets that the local
+ * Controller should include in a single Link Layer packet on this
+ * connection.
+ * Values:
+ * - 0x001B ... 0x00FB
+ * @param TxTime Preferred maximum number of microseconds that the local
+ * Controller should use to transmit a single Link Layer packet on this
+ * connection.
+ * Values:
+ * - 0x0148 ... 0x4290
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_data_length( uint16_t Connection_Handle,
+ uint16_t TxOctets,
+ uint16_t TxTime );
+
+/**
+ * @brief HCI_LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH
+ * This command allows the Host to read the Host's suggested values
+ * (SuggestedMaxTxOctets and SuggestedMaxTxTime) for the Controller's maximum
+ * transmitted number of payload octets and maximum packet transmission time to
+ * be used for new connections.
+ * See Core Specification [Vol 4, Part E, 7.8.34].
+ *
+ * @param[out] SuggestedMaxTxOctets The Host's suggested value for the
+ * Controller's maximum transmitted number of payload octets to be used
+ * for new connections.
+ * Values:
+ * - 0x001B ... 0x00FB
+ * @param[out] SuggestedMaxTxTime The Host's suggested value for the
+ * Controller's maximum packet transmission time to be used for new
+ * connections.
+ * Values:
+ * - 0x0148 ... 0x4290
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_suggested_default_data_length( uint16_t* SuggestedMaxTxOctets,
+ uint16_t* SuggestedMaxTxTime );
+
+/**
+ * @brief HCI_LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH
+ * This command allows the Host to specify its suggested values for the
+ * Controller's maximum transmission number of payload octets and maximum
+ * packet transmission time to be used for new connections. The Controller may
+ * use smaller or larger values for connInitialMaxTxOctets and
+ * connInitialMaxTxTime based on local information.
+ * See Core Specification [Vol 4, Part E, 7.8.35].
+ *
+ * @param SuggestedMaxTxOctets The Host's suggested value for the Controller's
+ * maximum transmitted number of payload octets to be used for new
+ * connections.
+ * Values:
+ * - 0x001B ... 0x00FB
+ * @param SuggestedMaxTxTime The Host's suggested value for the Controller's
+ * maximum packet transmission time to be used for new connections.
+ * Values:
+ * - 0x0148 ... 0x4290
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_write_suggested_default_data_length( uint16_t SuggestedMaxTxOctets,
+ uint16_t SuggestedMaxTxTime );
+
+/**
+ * @brief HCI_LE_READ_LOCAL_P256_PUBLIC_KEY
+ * This command is used to return the local P-256 public key from the
+ * Controller. The Controller shall generate a new P-256 public/private key
+ * pair upon receipt of this command.
+ * See Core Specification [Vol 4, Part E, 7.8.36].
+ *
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_local_p256_public_key( void );
+
+/**
+ * @brief HCI_LE_GENERATE_DHKEY
+ * This command is used to initiate generation of a Diffie-Hellman key in the
+ * Controller for use over the LE transport. This command takes the remote
+ * P-256 public key as input. The Diffie-Hellman key generation uses the
+ * private key generated by LE_Read_Local_P256_Public_Key command.
+ * See Core Specification [Vol 4, Part E, 7.8.37].
+ *
+ * @param Remote_P256_Public_Key The remote P-256 public key in X, Y format:
+ * Octets 31-0: X coordinate
+ * Octets 63-32: Y coordinate
+ * Little Endian Format
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_generate_dhkey( const uint8_t* Remote_P256_Public_Key );
+
+/**
+ * @brief HCI_LE_ADD_DEVICE_TO_RESOLVING_LIST
+ * This command is used to add one device to the list of address translations
+ * used to resolve Resolvable Private Addresses in the Controller.
+ * This command cannot be used when address translation is enabled in the
+ * Controller and:
+ * - Advertising is enabled
+ * - Scanning is enabled
+ * - Create connection command is outstanding
+ * This command can be used at any time when address translation is disabled in
+ * the Controller.
+ * When a Controller cannot add a device to the resolving list because the list
+ * is full, it shall respond with error code 0x07 (Memory Capacity Exceeded).
+ * See Core Specification [Vol 4, Part E, 7.8.38].
+ *
+ * @param Peer_Identity_Address_Type Identity address type
+ * Values:
+ * - 0x00: Public Identity Address
+ * - 0x01: Random (static) Identity Address
+ * @param Peer_Identity_Address Public or Random (static) Identity Address of
+ * the peer device
+ * @param Peer_IRK IRK of the peer device
+ * @param Local_IRK IRK of the local device
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_add_device_to_resolving_list( uint8_t Peer_Identity_Address_Type,
+ const uint8_t* Peer_Identity_Address,
+ const uint8_t* Peer_IRK,
+ const uint8_t* Local_IRK );
+
+/**
+ * @brief HCI_LE_REMOVE_DEVICE_FROM_RESOLVING_LIST
+ * This command is used to remove one device from the list of address
+ * translations used to resolve Resolvable Private Addresses in the controller.
+ * This command cannot be used when address translation is enabled in the
+ * Controller and:
+ * - Advertising is enabled
+ * - Scanning is enabled
+ * - Create connection command is outstanding
+ * This command can be used at any time when address translation is disabled in
+ * the Controller.
+ * When a Controller cannot remove a device from the resolving list because it
+ * is not found, it shall respond with error code 0x02 (Unknown Connection
+ * Identifier).
+ * See Core Specification [Vol 4, Part E, 7.8.39].
+ *
+ * @param Peer_Identity_Address_Type Identity address type
+ * Values:
+ * - 0x00: Public Identity Address
+ * - 0x01: Random (static) Identity Address
+ * @param Peer_Identity_Address Public or Random (static) Identity Address of
+ * the peer device
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_remove_device_from_resolving_list( uint8_t Peer_Identity_Address_Type,
+ const uint8_t* Peer_Identity_Address );
+
+/**
+ * @brief HCI_LE_CLEAR_RESOLVING_LIST
+ * This command is used to remove all devices from the list of address
+ * translations used to resolve Resolvable Private Addresses in the Controller.
+ * This command cannot be used when address translation is enabled in the
+ * Controller and:
+ * - Advertising is enabled
+ * - Scanning is enabled
+ * - Create connection command is outstanding
+ * This command can be used at any time when address translation is disabled in
+ * the Controller.
+ * See Core Specification [Vol 4, Part E, 7.8.40].
+ *
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_clear_resolving_list( void );
+
+/**
+ * @brief HCI_LE_READ_RESOLVING_LIST_SIZE
+ * This command is used to read the total number of address translation entries
+ * in the resolving list that can be stored in the Controller.
+ * See Core Specification [Vol 4, Part E, 7.8.41].
+ *
+ * @param[out] Resolving_List_Size Number of address translation entries in the
+ * resolving list
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_resolving_list_size( uint8_t* Resolving_List_Size );
+
+/**
+ * @brief HCI_LE_READ_PEER_RESOLVABLE_ADDRESS
+ * This command is used to get the current peer Resolvable Private Address
+ * being used for the corresponding peer Public and Random (static) Identity
+ * Address. The peer's resolvable address being used may change after the
+ * command is called.
+ * This command can be used at any time.
+ * When a Controller cannot find a Resolvable Private Address associated with
+ * the Peer Identity Address, it shall respond with error code 0x02 (Unknown
+ * Connection Identifier).
+ * See Core Specification [Vol 4, Part E, 7.8.42].
+ *
+ * @param Peer_Identity_Address_Type Identity address type
+ * Values:
+ * - 0x00: Public Identity Address
+ * - 0x01: Random (static) Identity Address
+ * @param Peer_Identity_Address Public or Random (static) Identity Address of
+ * the peer device
+ * @param[out] Peer_Resolvable_Address Resolvable Private Address being used by
+ * the peer device
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_peer_resolvable_address( uint8_t Peer_Identity_Address_Type,
+ const uint8_t* Peer_Identity_Address,
+ uint8_t* Peer_Resolvable_Address );
+
+/**
+ * @brief HCI_LE_READ_LOCAL_RESOLVABLE_ADDRESS
+ * This command is used to get the current local Resolvable Private Address
+ * being used for the corresponding peer Identity Address. The local's
+ * resolvable address being used may change after the command is called.
+ * This command can be used at any time.
+ * When a Controller cannot find a Resolvable Private Address associated with
+ * the Peer Identity Address, it shall respond with error code 0x02 (Unknown
+ * Connection Identifier).
+ * See Core Specification [Vol 4, Part E, 7.8.43].
+ *
+ * @param Peer_Identity_Address_Type Identity address type
+ * Values:
+ * - 0x00: Public Identity Address
+ * - 0x01: Random (static) Identity Address
+ * @param Peer_Identity_Address Public or Random (static) Identity Address of
+ * the peer device
+ * @param[out] Local_Resolvable_Address Resolvable Private Address being used
+ * by the local device
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_local_resolvable_address( uint8_t Peer_Identity_Address_Type,
+ const uint8_t* Peer_Identity_Address,
+ uint8_t* Local_Resolvable_Address );
+
+/**
+ * @brief HCI_LE_SET_ADDRESS_RESOLUTION_ENABLE
+ * This command is used to enable resolution of Resolvable Private Addresses in
+ * the Controller. This causes the Controller to use the resolving list
+ * whenever the Controller receives a local or peer Resolvable Private Address.
+ * This command can be used at any time except when:
+ * - Advertising is enabled
+ * - Scanning is enabled
+ * - Create connection command is outstanding
+ * See Core Specification [Vol 4, Part E, 7.8.44].
+ *
+ * @param Address_Resolution_Enable Enable/disable address resolution in the
+ * controller.
+ * 0x00: Address Resolution in controller disabled (default),
+ * 0x01: Address Resolution in controller enabled
+ * Values:
+ * - 0x00: Address Resolution in controller disabled (default)
+ * - 0x01: Address Resolution in controller enabled
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_address_resolution_enable( uint8_t Address_Resolution_Enable );
+
+/**
+ * @brief HCI_LE_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT
+ * This command sets the length of time the Controller uses a Resolvable
+ * Private Address before a new Resolvable Private Address is generated and
+ * starts being used. This timeout applies to all resolvable private addresses
+ * generated by the Controller.
+ * See Core Specification [Vol 4, Part E, 7.8.45].
+ *
+ * @param RPA_Timeout RPA_Timeout in seconds.
+ * Time range: 1 s to 1 hour.
+ * Default: 0x0384 (900 s or 15 minutes)
+ * Values:
+ * - 0x0001 ... 0x0E10
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_resolvable_private_address_timeout( uint16_t RPA_Timeout );
+
+/**
+ * @brief HCI_LE_READ_MAXIMUM_DATA_LENGTH
+ * This command allows the Host to read the Controller's maximum supported
+ * payload octets and packet duration times for transmission and reception
+ * (supportedMaxTxOctets and supportedMaxTxTime, supportedMaxRxOctets, and
+ * supportedMaxRxTime.
+ * See Core Specification [Vol 4, Part E, 7.8.46].
+ *
+ * @param[out] supportedMaxTxOctets Maximum number of payload octets that the
+ * local Controller supports for transmission of a single Link Layer
+ * packet on a data connection.
+ * Values:
+ * - 0x001B ... 0x00FB
+ * @param[out] supportedMaxTxTime Maximum time, in microseconds, that the local
+ * Controller supports for transmission of a single Link Layer packet on
+ * a data connection.
+ * Values:
+ * - 0x0148 ... 0x4290
+ * @param[out] supportedMaxRxOctets Maximum number of payload octets that the
+ * local Controller supports for reception of a single Link Layer packet
+ * on a data connection.
+ * Values:
+ * - 0x001B ... 0x00FB
+ * @param[out] supportedMaxRxTime Maximum time, in microseconds, that the local
+ * Controller supports for reception of a single Link Layer packet on a
+ * data connection.
+ * Values:
+ * - 0x0148 ... 0x4290
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_maximum_data_length( uint16_t* supportedMaxTxOctets,
+ uint16_t* supportedMaxTxTime,
+ uint16_t* supportedMaxRxOctets,
+ uint16_t* supportedMaxRxTime );
+
+/**
+ * @brief HCI_LE_READ_PHY
+ * This command is used to read the current transmitter PHY and receiver PHY on
+ * the connection identified by the Connection_Handle.
+ * See Core Specification [Vol 4, Part E, 7.8.47].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param[out] TX_PHY Transmitter PHY in use.
+ * Values:
+ * - 0x01: The transmitter PHY for the connection is LE 1M
+ * - 0x02: The transmitter PHY for the connection is LE 2M
+ * @param[out] RX_PHY Receiver PHY in use.
+ * Values:
+ * - 0x01: The receiver PHY for the connection is LE 1M
+ * - 0x02: The receiver PHY for the connection is LE 2M
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_phy( uint16_t Connection_Handle,
+ uint8_t* TX_PHY,
+ uint8_t* RX_PHY );
+
+/**
+ * @brief HCI_LE_SET_DEFAULT_PHY
+ * This command allows the Host to specify its preferred values for the
+ * transmitter PHY and receiver PHY to be used for all subsequent connections
+ * over the LE transport.
+ * The ALL_PHYS parameter is a bit field that allows the Host to specify, for
+ * each
+ * direction, whether it has no preference among the PHYs that the Controller
+ * supports in a given direction or whether it has specified particular PHYs
+ * that it prefers in the TX_PHYS or RX_PHYS parameter.
+ * The TX_PHYS parameter is a bit field that indicates the transmitter PHYs
+ * that the Host prefers the Controller to use. If the ALL_PHYS parameter
+ * specifies that the Host has no preference, the TX_PHYS parameter is ignored;
+ * otherwise at least one bit shall be set to 1.
+ * The RX_PHYS parameter is a bit field that indicates the receiver PHYs that
+ * the Host prefers the Controller to use. If the ALL_PHYS parameter specifies
+ * that the Host has no preference, the RX_PHYS parameter is ignored; otherwise
+ * at least one bit shall be set to 1.
+ * See Core Specification [Vol 4, Part E, 7.8.48].
+ *
+ * @param ALL_PHYS Preferences for TX PHY and RX PHY.
+ * Flags:
+ * - 0x01: The Host has no preference among the transmitter PHYs
+ * supported by the Controller
+ * - 0x02: The Host has no preference among the receiver PHYs supported
+ * by the Controller
+ * @param TX_PHYS Preferences for TX PHY.
+ * Flags:
+ * - 0x01: The Host prefers to use the LE 1M transmitter PHY (possibly
+ * among others)
+ * - 0x02: The Host prefers to use the LE 2M transmitter PHY (possibly
+ * among others)
+ * @param RX_PHYS Preferences for RX PHY.
+ * Flags:
+ * - 0x01: The Host prefers to use the LE 1M receiver PHY (possibly
+ * among others)
+ * - 0x02: The Host prefers to use the LE 2M receiver PHY (possibly
+ * among others)
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_default_phy( uint8_t ALL_PHYS,
+ uint8_t TX_PHYS,
+ uint8_t RX_PHYS );
+
+/**
+ * @brief HCI_LE_SET_PHY
+ * This command is used to set the PHY preferences for the connection
+ * identified by the Connection_Handle. The Controller might not be able to
+ * make the change (e.g. because the peer does not support the requested PHY)
+ * or may decide that the current PHY is preferable.
+ * The ALL_PHYS parameter is a bit field that allows the Host to specify, for
+ * each direction, whether it has no preference among the PHYs that the
+ * Controller supports in a given direction or whether it has specified
+ * particular PHYs that it prefers in the TX_PHYS or RX_PHYS parameter.
+ * The TX_PHYS parameter is a bit field that indicates the transmitter PHYs
+ * that the Host prefers the Controller to use. If the ALL_PHYS parameter
+ * specifies that the Host has no preference, the TX_PHYS parameter is ignored;
+ * otherwise at least one bit shall be set to 1.
+ * The RX_PHYS parameter is a bit field that indicates the receiver PHYs that
+ * the Host prefers the Controller to use. If the ALL_PHYS parameter specifies
+ * that the Host has no preference, the RX_PHYS parameter is ignored; otherwise
+ * at least one bit shall be set to 1.
+ * If, for at least one direction, the Host has specified a preference and the
+ * current PHY is not one of those preferred, the Controller shall request a
+ * change. Otherwise the Controller may, but need not, request a change.
+ * The PHY preferences provided by the LE Set PHY command override those
+ * provided via the LE Set Default PHY command (Section 7.8.48) or any
+ * preferences previously set using the LE Set PHY command on the same
+ * connection.
+ * The PHY_options parameter is a bit field that allows the Host to specify
+ * options for PHYs. The default value for a new connection shall be all zero
+ * bits. The Controller may override any preferred coding for transmitting on
+ * the LE Coded PHY.
+ * The Host may specify a preferred coding even if it prefers not to use the LE
+ * Coded transmitter PHY since the Controller may override the PHY preference.
+ * See Core Specification [Vol 4, Part E, 7.8.49].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param ALL_PHYS Preferences for TX PHY and RX PHY.
+ * Flags:
+ * - 0x01: The Host has no preference among the transmitter PHYs
+ * supported by the Controller
+ * - 0x02: The Host has no preference among the receiver PHYs supported
+ * by the Controller
+ * @param TX_PHYS Preferences for TX PHY.
+ * Flags:
+ * - 0x01: The Host prefers to use the LE 1M transmitter PHY (possibly
+ * among others)
+ * - 0x02: The Host prefers to use the LE 2M transmitter PHY (possibly
+ * among others)
+ * @param RX_PHYS Preferences for RX PHY.
+ * Flags:
+ * - 0x01: The Host prefers to use the LE 1M receiver PHY (possibly
+ * among others)
+ * - 0x02: The Host prefers to use the LE 2M receiver PHY (possibly
+ * among others)
+ * @param PHY_options Not used.
+ * Values:
+ * - 0x0000: the Host has no preferred coding when transmitting on the
+ * LE Coded PHY
+ * - 0x0001: the Host prefers that S=2 coding be used when transmitting
+ * on the LE Coded PHY
+ * - 0x0002: the Host prefers that S=8 coding be used when transmitting
+ * on the LE Coded PHY
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_phy( uint16_t Connection_Handle,
+ uint8_t ALL_PHYS,
+ uint8_t TX_PHYS,
+ uint8_t RX_PHYS,
+ uint16_t PHY_options );
+
+/**
+ * @brief HCI_LE_RECEIVER_TEST_V2
+ * This command is used to start a test where the DUT receives test reference
+ * packets at a fixed interval. The tester generates the test reference
+ * packets.
+ * See Core Specification [Vol 4, Part E, 7.8.28].
+ *
+ * @param RX_Frequency N = (F - 2402) / 2
+ * Frequency Range : 2402 MHz to 2480 MHz
+ * Values:
+ * - 0x00 ... 0x27
+ * @param PHY PHY to be used by the receiver.
+ * Values:
+ * - 0x01: Receiver set to use the LE 1M PHY
+ * - 0x02: Receiver set to use the LE 2M PHY
+ * @param Modulation_Index Modulation index capability of the transmitter
+ * Values:
+ * - 0x00: Assume transmitter will have a standard modulation index
+ * - 0x01: Assume transmitter will have a stable modulation index
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_receiver_test_v2( uint8_t RX_Frequency,
+ uint8_t PHY,
+ uint8_t Modulation_Index );
+
+/**
+ * @brief HCI_LE_TRANSMITTER_TEST_V2
+ * This command is used to start a test where the DUT generates test reference
+ * packets at a fixed interval.
+ * See Core Specification [Vol 4, Part E, 7.8.29].
+ *
+ * @param TX_Frequency N = (F - 2402) / 2
+ * Frequency Range : 2402 MHz to 2480 MHz
+ * Values:
+ * - 0x00 ... 0x27
+ * @param Length_Of_Test_Data Length in bytes of payload data in each packet.
+ * Values:
+ * - 0x00 ... 0x25: for BO variant
+ * - 0x00 ... 0xFF: otherwise
+ * @param Packet_Payload Type of packet payload.
+ * Values:
+ * - 0x00: Pseudo-Random bit sequence 9
+ * - 0x01: Pattern of alternating bits '11110000'
+ * - 0x02: Pattern of alternating bits '10101010'
+ * - 0x03: Pseudo-Random bit sequence 15
+ * - 0x04: Pattern of All '1' bits
+ * - 0x05: Pattern of All '0' bits
+ * - 0x06: Pattern of alternating bits '00001111'
+ * - 0x07: Pattern of alternating bits '0101'
+ * @param PHY PHY to use for test packet
+ * Values:
+ * - 0x01: Transmitter set to use the LE 1M PHY
+ * - 0x02: Transmitter set to use the LE 2M PHY
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_transmitter_test_v2( uint8_t TX_Frequency,
+ uint8_t Length_Of_Test_Data,
+ uint8_t Packet_Payload,
+ uint8_t PHY );
+
+/**
+ * @brief HCI_LE_SET_ADVERTISING_SET_RANDOM_ADDRESS
+ * This command is used by the Host to set the random device address specified
+ * by the Random_Address parameter.
+ * See Core Specification [Vol 4, Part E, 7.8.52].
+ *
+ * @param Advertising_Handle Used to identify an advertising set.
+ * Values:
+ * - 0x00 ... 0xEF
+ * @param Random_Address Random Device Address.
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_advertising_set_random_address( uint8_t Advertising_Handle,
+ const uint8_t* Random_Address );
+
+/**
+ * @brief HCI_LE_SET_EXTENDED_ADVERTISING_PARAMETERS
+ * This command is used by the Host to set the extended advertising parameters.
+ * See Core Specification [Vol 4, Part E, 7.8.53].
+ *
+ * @param Advertising_Handle Used to identify an advertising set.
+ * Values:
+ * - 0x00 ... 0xEF
+ * @param Adv_Event_Properties Type of advertising event.
+ * Flags:
+ * - 0x0001: Connectable advertising
+ * - 0x0002: Scannable advertising
+ * - 0x0004: Directed advertising
+ * - 0x0008: High Duty Cycle Directed Connectable advertising
+ * - 0x0010: Use legacy advertising PDUs
+ * - 0x0020: Anonymous advertising
+ * - 0x0040: Include TxPower in at least one advertising PDU
+ * @param Primary_Adv_Interval_Min Minimum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x000020 (20.000 ms) ... 0xFFFFFF (10485759.375 ms)
+ * @param Primary_Adv_Interval_Max Maximum advertising interval.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x000020 (20.000 ms) ... 0xFFFFFF (10485759.375 ms)
+ * @param Primary_Adv_Channel_Map Advertising channel map.
+ * Flags:
+ * - 0x01: Channel 37 shall be used
+ * - 0x02: Channel 38 shall be used
+ * - 0x04: Channel 39 shall be used
+ * @param Own_Address_Type Own address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * - 0x02: Resolvable Private Address if available, otherwise Public
+ * Address
+ * - 0x03: Resolvable Private Address if available, otherwise Random
+ * Address
+ * @param Peer_Address_Type Address type of the peer device.
+ * Values:
+ * - 0x00: Public Device Address or Public Identity Address
+ * - 0x01: Random Device Address or Random (static) Identity Address
+ * @param Peer_Address Public Device Address, Random Device Address, Public
+ * Identity Address, or Random (static) Identity Address of the device
+ * to be connected.
+ * @param Adv_Filter_Policy Advertising filter policy
+ * Values:
+ * - 0x00: Process scan and connection requests from all devices (i.e.,
+ * the Filter Accept List is not in use)
+ * - 0x01: Process connection requests from all devices and scan
+ * requests only from devices that are in the Filter Accept List.
+ * - 0x02: Process scan requests from all devices and connection
+ * requests only from devices that are in the Filter Accept List.
+ * - 0x03: Process scan and connection requests only from devices in the
+ * Filter Accept List.
+ * @param Adv_TX_Power Advertising TX power. Units: dBm.
+ * Values:
+ * - 127: Host has no preference
+ * - -127 ... 20
+ * @param Primary_Adv_PHY Primary advertising PHY.
+ * Values:
+ * - 0x01: Primary advertisement PHY is LE 1M
+ * @param Secondary_Adv_Max_Skip Secondary advertising maximum skip.
+ * Values:
+ * - 0x00: AUX_ADV_IND shall be sent prior to the next advertising event
+ * - 0x01 ... 0xFF: Maximum advertising events the Controller can skip
+ * before sending the AUX_ADV_IND packets on the secondary advertising
+ * physical channel
+ * @param Secondary_Adv_PHY Secondary advertising PHY.
+ * Values:
+ * - 0x01: Secondary advertisement PHY is LE 1M
+ * - 0x02: Secondary advertisement PHY is LE 2M
+ * @param Adv_SID Value of the Advertising SID subfield in the ADI field of the
+ * PDU.
+ * Values:
+ * - 0x00 ... 0x0F
+ * @param Scan_Req_Notification_Enable Scan request notifications.
+ * Values:
+ * - 0x00: Scan request notifications disabled
+ * - 0x01: Scan request notifications enabled
+ * @param[out] Selected_TX_Power Power level selected by the Controller. Units:
+ * dBm.
+ * Values:
+ * - -127 ... 20
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_extended_advertising_parameters( uint8_t Advertising_Handle,
+ uint16_t Adv_Event_Properties,
+ const uint8_t* Primary_Adv_Interval_Min,
+ const uint8_t* Primary_Adv_Interval_Max,
+ uint8_t Primary_Adv_Channel_Map,
+ uint8_t Own_Address_Type,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint8_t Adv_Filter_Policy,
+ uint8_t Adv_TX_Power,
+ uint8_t Primary_Adv_PHY,
+ uint8_t Secondary_Adv_Max_Skip,
+ uint8_t Secondary_Adv_PHY,
+ uint8_t Adv_SID,
+ uint8_t Scan_Req_Notification_Enable,
+ uint8_t* Selected_TX_Power );
+
+/**
+ * @brief HCI_LE_SET_EXTENDED_ADVERTISING_DATA
+ * This command is used to set the data used in extended advertising PDUs that
+ * have a data field.
+ * See Core Specification [Vol 4, Part E, 7.8.54].
+ *
+ * @param Advertising_Handle Used to identify an advertising set.
+ * Values:
+ * - 0x00 ... 0xEF
+ * @param Operation Advertising operation.
+ * Values:
+ * - 0x00: Intermediate fragment of fragmented extended advertising data
+ * - 0x01: First fragment of fragmented extended advertising data
+ * - 0x02: Last fragment of fragmented extended advertising data
+ * - 0x03: Complete extended advertising data
+ * - 0x04: Unchanged data (just update the Advertising DID)
+ * @param Fragment_Preference Fragment preference.
+ * Values:
+ * - 0x00: The Controller may fragment all data
+ * - 0x01: The Controller should not fragment or should minimize
+ * fragmentation of data
+ * @param Advertising_Data_Length Length of Advertising_Data in octets
+ * @param Advertising_Data Data formatted as defined in Core Specification [Vol
+ * 3, Part C, 11].
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_extended_advertising_data( uint8_t Advertising_Handle,
+ uint8_t Operation,
+ uint8_t Fragment_Preference,
+ uint8_t Advertising_Data_Length,
+ const uint8_t* Advertising_Data );
+
+/**
+ * @brief HCI_LE_SET_EXTENDED_SCAN_RESPONSE_DATA
+ * This command is used to provide scan response data used in scanning response
+ * PDUs during extended advertising.
+ * See Core Specification [Vol 4, Part E, 7.8.55].
+ *
+ * @param Advertising_Handle Used to identify an advertising set.
+ * Values:
+ * - 0x00 ... 0xEF
+ * @param Operation Scan response operation.
+ * Values:
+ * - 0x00: Intermediate fragment of fragmented scan response data
+ * - 0x01: First fragment of fragmented scan response data
+ * - 0x02: Last fragment of fragmented scan response data
+ * - 0x03: Complete scan response data
+ * @param Fragment_Preference Fragment preference.
+ * Values:
+ * - 0x00: The Controller may fragment all data
+ * - 0x01: The Controller should not fragment or should minimize
+ * fragmentation of data
+ * @param Scan_Response_Data_Length Length of Scan_Response_Data in octets
+ * @param Scan_Response_Data Data formatted as defined in Core Specification
+ * [Vol 3, Part C, 11].
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_extended_scan_response_data( uint8_t Advertising_Handle,
+ uint8_t Operation,
+ uint8_t Fragment_Preference,
+ uint8_t Scan_Response_Data_Length,
+ const uint8_t* Scan_Response_Data );
+
+/**
+ * @brief HCI_LE_SET_EXTENDED_ADVERTISING_ENABLE
+ * This command is used to request the Controller to enable or disable one or
+ * more advertising sets using the advertising sets identified by the
+ * Advertising_Handle[i] parameter.
+ * See Core Specification [Vol 4, Part E, 7.8.56].
+ *
+ * @param Enable Enable/disable advertising.
+ * Values:
+ * - 0x00: Advertising is disabled
+ * - 0x01: Advertising is enabled
+ * @param Num_Sets Number of advertising sets.
+ * Values:
+ * - 0x00: Disable all advertising sets
+ * - 0x01 ... 0x3F: Number of advertising sets to enable or disable
+ * @param Adv_Set See @ref Adv_Set_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_extended_advertising_enable( uint8_t Enable,
+ uint8_t Num_Sets,
+ const Adv_Set_t* Adv_Set );
+
+/**
+ * @brief HCI_LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH
+ * This command is used to read the maximum length of data supported by the
+ * Controller for use as advertisement data or scan response data in an
+ * extended advertising event.
+ * See Core Specification [Vol 4, Part E, 7.8.57].
+ *
+ * @param[out] Max_Advertising_Data_Length Maximum supported advertising data
+ * length.
+ * Values:
+ * - 0x001F ... 0x0672
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_maximum_advertising_data_length( uint16_t* Max_Advertising_Data_Length );
+
+/**
+ * @brief HCI_LE_READ_NUMBER_OF_SUPPORTED_ADVERTISING_SETS
+ * This command is used to read the maximum number of advertising sets
+ * supported by the Controller at the same time during extended advertising.
+ * See Core Specification [Vol 4, Part E, 7.8.58].
+ *
+ * @param[out] Num_Supported_Advertising_Sets Number of advertising sets
+ * supported at the same time.
+ * Values:
+ * - 0x01 ... 0xF0
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_number_of_supported_advertising_sets( uint8_t* Num_Supported_Advertising_Sets );
+
+/**
+ * @brief HCI_LE_REMOVE_ADVERTISING_SET
+ * This command is used to remove an advertising set from the Controller.
+ * See Core Specification [Vol 4, Part E, 7.8.59].
+ *
+ * @param Advertising_Handle Used to identify an advertising set.
+ * Values:
+ * - 0x00 ... 0xEF
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_remove_advertising_set( uint8_t Advertising_Handle );
+
+/**
+ * @brief HCI_LE_CLEAR_ADVERTISING_SETS
+ * This command is used to remove all existing advertising sets from the
+ * Controller.
+ * See Core Specification [Vol 4, Part E, 7.8.60].
+ *
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_clear_advertising_sets( void );
+
+/**
+ * @brief HCI_LE_SET_EXTENDED_SCAN_PARAMETERS
+ * This command is used to set the extended scan parameters to be used on the
+ * advertising physical channels.
+ * See Core Specification [Vol 4, Part E, 7.8.64].
+ *
+ * @param Own_Address_Type Own address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * - 0x02: Resolvable Private Address if available, otherwise Public
+ * Address
+ * - 0x03: Resolvable Private Address if available, otherwise Random
+ * Address
+ * @param Scanning_Filter_Policy The scanning filter policy determines how the
+ * scanner's Link Layer processes advertising and scan response PDUs.
+ * There is a choice of two primary filter policies: unfiltered and
+ * filtered.
+ * Unfiltered: the Link Layer processes all advertising and scan
+ * response PDUs (i.e., the Filter Accept List is not used).
+ * Filtered: the Link Layer processes advertising and scan response PDUs
+ * only from devices in the Filter Accept List.
+ * With extended scanning filter policies, a directed advertising PDU
+ * accepted by the primary filter policy shall nevertheless be ignored
+ * unless either the TargetA field is identical to the scanner's device
+ * address, or TargetA field is a resolvable private address.
+ * Flags:
+ * - 0x01: 0 = unfiltered scanning policy; 1 = filtered scanning policy
+ * - 0x02: 0 = Basic filter policy; 1 = Extended filter policy
+ * - 0x04: Decision scanning filter policy mode - bit 0 (not supported)
+ * - 0x08: Decision scanning filter policy mode - bit 1 (not supported)
+ * @param Scanning_PHYs Scan PHYs.
+ * Flags:
+ * - 0x01: Scan advertisements on the LE 1M PHY
+ * @param Scan_Param_Phy See @ref Scan_Param_Phy_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_extended_scan_parameters( uint8_t Own_Address_Type,
+ uint8_t Scanning_Filter_Policy,
+ uint8_t Scanning_PHYs,
+ const Scan_Param_Phy_t* Scan_Param_Phy );
+
+/**
+ * @brief HCI_LE_SET_EXTENDED_SCAN_ENABLE
+ * This command is used to enable or disable extended scanning.
+ * See Core Specification [Vol 4, Part E, 7.8.65].
+ *
+ * @param Enable Enable/disable scan.
+ * Values:
+ * - 0x00: Scanning disabled
+ * - 0x01: Scanning enabled
+ * @param Filter_Duplicates Duplicate filtering.
+ * Values:
+ * - 0x00: Duplicate filtering disabled
+ * - 0x01: Duplicate filtering enabled
+ * - 0x02: Duplicate filtering enabled, reset for each scan period
+ * @param Duration Scan duration.
+ * Time = N * 10 ms.
+ * Values:
+ * - 0x0000 (0 ms) : Scan continuously until explicitly disable
+ * - 0x0001 (10 ms) ... 0xFFFF (655350 ms) : Scan duration
+ * @param Period Scan period.
+ * Time = N * 1.28 s.
+ * Values:
+ * - 0x0000 (0 ms) : Scan continuously
+ * - 0x0001 (1280 ms) ... 0xFFFF (83884800 ms) : Time interval from
+ * when the Controller started its last Scan_Duration until it begins
+ * the subsequent Scan_Duration
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_extended_scan_enable( uint8_t Enable,
+ uint8_t Filter_Duplicates,
+ uint16_t Duration,
+ uint16_t Period );
+
+/**
+ * @brief HCI_LE_EXTENDED_CREATE_CONNECTION
+ * This command is used to create an ACL connection to a connectable advertiser
+ * by means of extended scanning.
+ * See Core Specification [Vol 4, Part E, 7.8.66].
+ *
+ * @param Initiator_Filter_Policy Initiator filter policy.
+ * Values:
+ * - 0x00: Filter Accept List is not used to determine which advertiser
+ * to connect to
+ * - 0x01: Filter Accept List is used to determine which advertiser to
+ * connect to (Peer_Address_Type and Peer_Address are ignored)
+ * @param Own_Address_Type Own address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * - 0x02: Resolvable Private Address if available, otherwise Public
+ * Address
+ * - 0x03: Resolvable Private Address if available, otherwise Random
+ * Address
+ * @param Peer_Address_Type Address type of the peer device.
+ * Values:
+ * - 0x00: Public Device Address or Public Identity Address
+ * - 0x01: Random Device Address or Random (static) Identity Address
+ * @param Peer_Address Public Device Address, Random Device Address, Public
+ * Identity Address, or Random (static) Identity Address of the device
+ * to be connected.
+ * @param Initiating_PHYs Initiating PHYs.
+ * Flags:
+ * - 0x01: Scan connectable advertisements on the LE 1M PHY- Connection
+ * parameters for the LE 1M PHY
+ * - 0x02: Connection parameters for the LE 2M PHY
+ * @param Init_Param_Phy See @ref Init_Param_Phy_t
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_extended_create_connection( uint8_t Initiator_Filter_Policy,
+ uint8_t Own_Address_Type,
+ uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address,
+ uint8_t Initiating_PHYs,
+ const Init_Param_Phy_t* Init_Param_Phy );
+
+/**
+ * @brief HCI_LE_READ_TRANSMIT_POWER
+ * This command is used to read the minimum and maximum transmit powers
+ * supported by the Controller.
+ * See Core Specification [Vol 4, Part E, 7.8.74].
+ *
+ * @param[out] Min_TX_Power Signed integer.
+ * Units: dBm.
+ * Values:
+ * - -127 ... 20
+ * @param[out] Max_TX_Power Signed integer.
+ * Units: dBm.
+ * Values:
+ * - -127 ... 20
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_transmit_power( uint8_t* Min_TX_Power,
+ uint8_t* Max_TX_Power );
+
+/**
+ * @brief HCI_LE_READ_RF_PATH_COMPENSATION
+ * This command is used to read the RF path compensation value parameters used
+ * in the Tx power level and RSSI calculation.
+ * See Core Specification [Vol 4, Part E, 7.8.75].
+ *
+ * @param[out] RF_TX_Path_Compensation RF TX Path Compensation Value (16-bit
+ * signed integer).
+ * Units: 0.1 dB.
+ * Values:
+ * - -1280 ... 1280
+ * @param[out] RF_RX_Path_Compensation RF RX Path Compensation Value (16-bit
+ * signed integer).
+ * Units: 0.1 dB.
+ * Values:
+ * - -1280 ... 1280
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_read_rf_path_compensation( uint16_t* RF_TX_Path_Compensation,
+ uint16_t* RF_RX_Path_Compensation );
+
+/**
+ * @brief HCI_LE_WRITE_RF_PATH_COMPENSATION
+ * This command is used to indicate the RF path gain or loss between the RF
+ * transceiver and the antenna contributed by intermediate components. A
+ * positive value means a net RF path gain and a negative value means a net RF
+ * path loss.
+ * See Core Specification [Vol 4, Part E, 7.8.76].
+ *
+ * @param RF_TX_Path_Compensation RF TX Path Compensation Value (16-bit signed
+ * integer).
+ * Units: 0.1 dB.
+ * Values:
+ * - -1280 ... 1280
+ * @param RF_RX_Path_Compensation RF RX Path Compensation Value (16-bit signed
+ * integer).
+ * Units: 0.1 dB.
+ * Values:
+ * - -1280 ... 1280
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_write_rf_path_compensation( uint16_t RF_TX_Path_Compensation,
+ uint16_t RF_RX_Path_Compensation );
+
+/**
+ * @brief HCI_LE_SET_PRIVACY_MODE
+ * This command is used to allow the Host to specify the privacy mode to be
+ * used for a given entry on the resolving list.
+ * See Core Specification [Vol 4, Part E, 7.8.77].
+ *
+ * @param Peer_Identity_Address_Type Identity address type
+ * Values:
+ * - 0x00: Public Identity Address
+ * - 0x01: Random (static) Identity Address
+ * @param Peer_Identity_Address Public or Random (static) Identity Address of
+ * the peer device
+ * @param Privacy_Mode Privacy Mode.
+ * Values:
+ * - 0x00: Use Network Privacy Mode
+ * - 0x01: Use Device Privacy Mode
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_privacy_mode( uint8_t Peer_Identity_Address_Type,
+ const uint8_t* Peer_Identity_Address,
+ uint8_t Privacy_Mode );
+
+/**
+ * @brief HCI_LE_GENERATE_DHKEY_V2
+ * This command is used to initiate generation of a Diffie-Hellman key in the
+ * Controller for use over the LE transport. This command takes the remote
+ * P-256 public key as input. The Diffie-Hellman key generation uses the
+ * private key generated by the HCI_LE_Read_Local_P-256_Public_Key command or
+ * the private debug key.
+ * See Core Specification [Vol 4, Part E, 7.8.37].
+ *
+ * @param Remote_P256_Public_Key The remote P-256 public key in X, Y format:
+ * Octets 31-0: X coordinate
+ * Octets 63-32: Y coordinate
+ * Little Endian Format
+ * @param Key_Type Type of private key used for the Diffie-Hellman key
+ * generation.
+ * Values:
+ * - 0x00: Use the generated private key
+ * - 0x01: Use the debug private key
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_generate_dhkey_v2( const uint8_t* Remote_P256_Public_Key,
+ uint8_t Key_Type );
+
+/**
+ * @brief HCI_LE_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT_V2
+ * This command sets the range of time the Controller uses a Resolvable Private
+ * Address before a new Resolvable Private Address is generated and starts
+ * being used.
+ * After a call to this command, when the BLE stack needs to set a new timeout
+ * (e.g., when the RPA is set for the first time, or when the current timeout
+ * expires), the new timeout is set as a random value between RPA_Timeout_Min
+ * and RPA_Timeout_Max.
+ * See Core Specification [Vol 4, Part E, 7.8.45].
+ *
+ * @param RPA_Timeout_Min Minimum RPA timeout, in seconds.
+ * Time range: 1 s to 1 hour.
+ * Default: 0x01E0 (480 s or 8 minutes)
+ * Values:
+ * - 0x0001 ... 0x0E10
+ * @param RPA_Timeout_Max Maximum RPA timeout, in seconds.
+ * Time range: 1 s to 1 hour.
+ * Default: 0x0384 (900 s or 15 minutes)
+ * Values:
+ * - 0x0001 ... 0x0E10
+ * @return Value indicating success or error code.
+ */
+tBleStatus hci_le_set_resolvable_private_address_timeout_v2( uint16_t RPA_Timeout_Min,
+ uint16_t RPA_Timeout_Max );
+
+
+#endif /* BLE_HCI_LE_H__ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_l2cap_aci.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_l2cap_aci.c
new file mode 100644
index 0000000..5360484
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_l2cap_aci.c
@@ -0,0 +1,306 @@
+/*****************************************************************************
+ * @file ble_l2cap_aci.c
+ * @brief STM32WB BLE API (l2cap_aci)
+ * Auto-generated file: do not edit!
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#include "auto/ble_l2cap_aci.h"
+
+tBleStatus aci_l2cap_connection_parameter_update_req( uint16_t Connection_Handle,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max,
+ uint16_t Latency,
+ uint16_t Timeout_Multiplier )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_l2cap_connection_parameter_update_req_cp0 *cp0 = (aci_l2cap_connection_parameter_update_req_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Conn_Interval_Min = Conn_Interval_Min;
+ index_input += 2;
+ cp0->Conn_Interval_Max = Conn_Interval_Max;
+ index_input += 2;
+ cp0->Latency = Latency;
+ index_input += 2;
+ cp0->Timeout_Multiplier = Timeout_Multiplier;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x181;
+ rq.event = 0x0F;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_l2cap_connection_parameter_update_resp( uint16_t Connection_Handle,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max,
+ uint16_t Latency,
+ uint16_t Timeout_Multiplier,
+ uint16_t Minimum_CE_Length,
+ uint16_t Maximum_CE_Length,
+ uint8_t Identifier,
+ uint8_t Accept )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_l2cap_connection_parameter_update_resp_cp0 *cp0 = (aci_l2cap_connection_parameter_update_resp_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Conn_Interval_Min = Conn_Interval_Min;
+ index_input += 2;
+ cp0->Conn_Interval_Max = Conn_Interval_Max;
+ index_input += 2;
+ cp0->Latency = Latency;
+ index_input += 2;
+ cp0->Timeout_Multiplier = Timeout_Multiplier;
+ index_input += 2;
+ cp0->Minimum_CE_Length = Minimum_CE_Length;
+ index_input += 2;
+ cp0->Maximum_CE_Length = Maximum_CE_Length;
+ index_input += 2;
+ cp0->Identifier = Identifier;
+ index_input += 1;
+ cp0->Accept = Accept;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x182;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_l2cap_coc_connect( uint16_t Connection_Handle,
+ uint16_t SPSM,
+ uint16_t MTU,
+ uint16_t MPS,
+ uint16_t Initial_Credits,
+ uint8_t Channel_Number )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_l2cap_coc_connect_cp0 *cp0 = (aci_l2cap_coc_connect_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->SPSM = SPSM;
+ index_input += 2;
+ cp0->MTU = MTU;
+ index_input += 2;
+ cp0->MPS = MPS;
+ index_input += 2;
+ cp0->Initial_Credits = Initial_Credits;
+ index_input += 2;
+ cp0->Channel_Number = Channel_Number;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x188;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_l2cap_coc_connect_confirm( uint16_t Connection_Handle,
+ uint16_t MTU,
+ uint16_t MPS,
+ uint16_t Initial_Credits,
+ uint16_t Result,
+ uint8_t Max_Channel_Number,
+ uint8_t* Channel_Number,
+ uint8_t* Channel_Index_List )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_l2cap_coc_connect_confirm_cp0 *cp0 = (aci_l2cap_coc_connect_confirm_cp0*)(cmd_buffer);
+ aci_l2cap_coc_connect_confirm_rp0 resp;
+ Osal_MemSet( &resp, 0, sizeof(resp) );
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->MTU = MTU;
+ index_input += 2;
+ cp0->MPS = MPS;
+ index_input += 2;
+ cp0->Initial_Credits = Initial_Credits;
+ index_input += 2;
+ cp0->Result = Result;
+ index_input += 2;
+ cp0->Max_Channel_Number = Max_Channel_Number;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x189;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &resp;
+ rq.rlen = sizeof(resp);
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ if ( resp.Status )
+ return resp.Status;
+ *Channel_Number = resp.Channel_Number;
+ Osal_MemCpy( (void*)Channel_Index_List, (const void*)resp.Channel_Index_List, *Channel_Number);
+ return BLE_STATUS_SUCCESS;
+}
+
+tBleStatus aci_l2cap_coc_reconf( uint16_t Connection_Handle,
+ uint16_t MTU,
+ uint16_t MPS,
+ uint8_t Channel_Number,
+ const uint8_t* Channel_Index_List )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_l2cap_coc_reconf_cp0 *cp0 = (aci_l2cap_coc_reconf_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->MTU = MTU;
+ index_input += 2;
+ cp0->MPS = MPS;
+ index_input += 2;
+ cp0->Channel_Number = Channel_Number;
+ index_input += 1;
+ Osal_MemCpy( (void*)&cp0->Channel_Index_List, (const void*)Channel_Index_List, Channel_Number );
+ index_input += Channel_Number;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x18a;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_l2cap_coc_reconf_confirm( uint16_t Connection_Handle,
+ uint16_t Result )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_l2cap_coc_reconf_confirm_cp0 *cp0 = (aci_l2cap_coc_reconf_confirm_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Connection_Handle = Connection_Handle;
+ index_input += 2;
+ cp0->Result = Result;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x18b;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_l2cap_coc_disconnect( uint8_t Channel_Index )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_l2cap_coc_disconnect_cp0 *cp0 = (aci_l2cap_coc_disconnect_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Channel_Index = Channel_Index;
+ index_input += 1;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x18c;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_l2cap_coc_flow_control( uint8_t Channel_Index,
+ uint16_t Credits )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_l2cap_coc_flow_control_cp0 *cp0 = (aci_l2cap_coc_flow_control_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Channel_Index = Channel_Index;
+ index_input += 1;
+ cp0->Credits = Credits;
+ index_input += 2;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x18d;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
+tBleStatus aci_l2cap_coc_tx_data( uint8_t Channel_Index,
+ uint16_t Length,
+ const uint8_t* Data )
+{
+ struct hci_request rq;
+ uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
+ aci_l2cap_coc_tx_data_cp0 *cp0 = (aci_l2cap_coc_tx_data_cp0*)(cmd_buffer);
+ tBleStatus status = 0;
+ int index_input = 0;
+ cp0->Channel_Index = Channel_Index;
+ index_input += 1;
+ cp0->Length = Length;
+ index_input += 2;
+ Osal_MemCpy( (void*)&cp0->Data, (const void*)Data, Length );
+ index_input += Length;
+ Osal_MemSet( &rq, 0, sizeof(rq) );
+ rq.ogf = 0x3f;
+ rq.ocf = 0x18e;
+ rq.cparam = cmd_buffer;
+ rq.clen = index_input;
+ rq.rparam = &status;
+ rq.rlen = 1;
+ if ( hci_send_req(&rq, FALSE) < 0 )
+ return BLE_STATUS_TIMEOUT;
+ return status;
+}
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_l2cap_aci.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_l2cap_aci.h
new file mode 100644
index 0000000..1613c58
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_l2cap_aci.h
@@ -0,0 +1,304 @@
+/*****************************************************************************
+ * @file ble_l2cap_aci.h
+ * @brief STM32WB BLE API (L2CAP_ACI)
+ * Auto-generated file: do not edit!
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#ifndef BLE_L2CAP_ACI_H__
+#define BLE_L2CAP_ACI_H__
+
+
+#include "auto/ble_types.h"
+
+/**
+ * @brief ACI_L2CAP_CONNECTION_PARAMETER_UPDATE_REQ
+ * Sends an L2CAP connection parameter update request from the Peripheral to
+ * the Central.
+ * An ACI_L2CAP_CONNECTION_UPDATE_RESP_EVENT event is raised when the Central
+ * responds to the request (accepts or rejects).
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Conn_Interval_Min Minimum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Interval_Max Maximum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Latency Maximum Peripheral latency for the connection in number of
+ * connection events.
+ * Values:
+ * - 0x0000 ... 0x01F3
+ * @param Timeout_Multiplier Defines connection timeout parameter in the
+ * following manner: Timeout Multiplier * 10ms.
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_l2cap_connection_parameter_update_req( uint16_t Connection_Handle,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max,
+ uint16_t Latency,
+ uint16_t Timeout_Multiplier );
+
+/**
+ * @brief ACI_L2CAP_CONNECTION_PARAMETER_UPDATE_RESP
+ * Accepts or rejects a connection update. This command should be sent in
+ * response to an ACI_L2CAP_CONNECTION_UPDATE_REQ_EVENT event from the
+ * controller. The accept parameter has to be set if the connection parameters
+ * given in the event are acceptable.
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Conn_Interval_Min Minimum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Conn_Interval_Max Maximum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ * @param Latency Maximum Peripheral latency for the connection in number of
+ * connection events.
+ * Values:
+ * - 0x0000 ... 0x01F3
+ * @param Timeout_Multiplier Defines connection timeout parameter in the
+ * following manner: Timeout Multiplier * 10ms.
+ * @param Minimum_CE_Length Information parameter about the minimum length of
+ * connection needed for this LE connection.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
+ * @param Maximum_CE_Length Information parameter about the maximum length of
+ * connection needed for this LE connection.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
+ * @param Identifier Received identifier.
+ * @param Accept Specify if connection update parameters are acceptable or not.
+ * Values:
+ * - 0x00: Reject
+ * - 0x01: Accept
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_l2cap_connection_parameter_update_resp( uint16_t Connection_Handle,
+ uint16_t Conn_Interval_Min,
+ uint16_t Conn_Interval_Max,
+ uint16_t Latency,
+ uint16_t Timeout_Multiplier,
+ uint16_t Minimum_CE_Length,
+ uint16_t Maximum_CE_Length,
+ uint8_t Identifier,
+ uint8_t Accept );
+
+/**
+ * @brief ACI_L2CAP_COC_CONNECT
+ * This command sends a Credit Based Connection Request packet on the specified
+ * connection. See Core Specification [Vol 3, Part A].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param SPSM Simplified Protocol/Service Multiplexer.
+ * Values:
+ * - 0x0001 ... 0x00FF
+ * @param MTU Maximum Transmission Unit.
+ * Values:
+ * - 23 ... 65535
+ * - 64 ... 246: for Enhanced ATT
+ * @param MPS Maximum payload size (in octets).
+ * Values:
+ * - 23 ... 248
+ * - 64 ... 248: for Enhanced ATT
+ * @param Initial_Credits Number of K-frames that can be received on the
+ * created channel(s) by the L2CAP layer entity sending this packet.
+ * Values:
+ * - 0 ... 65535
+ * @param Channel_Number Number of channels to be created. If this parameter is
+ * set to 0, it requests the creation of one LE credit based connection-
+ * oriented channel. Otherwise, it requests the creation of one or more
+ * enhanced credit based connection-oriented channels.
+ * Values:
+ * - 0 ... 5
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_l2cap_coc_connect( uint16_t Connection_Handle,
+ uint16_t SPSM,
+ uint16_t MTU,
+ uint16_t MPS,
+ uint16_t Initial_Credits,
+ uint8_t Channel_Number );
+
+/**
+ * @brief ACI_L2CAP_COC_CONNECT_CONFIRM
+ * This command sends a Credit Based Connection Response packet. It must be
+ * used upon receipt of a connection request through an
+ * ACI_L2CAP_COC_CONNECT_EVENT event.
+ * By setting the Result parameter to 0x0000, the application can accept all
+ * connections or only some. In this case, the number of accepted connections
+ * depends on the Max_Channel_Number parameter. Note that if some connections
+ * are refused, the Result parameter is automatically modified by the BLE
+ * stack.
+ * By setting the Result parameter to a non-zero value, the application can
+ * refuse all connections. The Result value shall then be one of the
+ * "Connection refused" or "All connections refused" values.
+ * See Core Specification [Vol 3, Part A].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param MTU Maximum Transmission Unit.
+ * Values:
+ * - 23 ... 65535
+ * - 64 ... 246: for Enhanced ATT
+ * @param MPS Maximum payload size (in octets).
+ * Values:
+ * - 23 ... 248
+ * - 64 ... 248: for Enhanced ATT
+ * @param Initial_Credits Number of K-frames that can be received on the
+ * created channel(s) by the L2CAP layer entity sending this packet.
+ * Values:
+ * - 0 ... 65535
+ * @param Result Indicates the outcome of the request. See Core Specification
+ * [Vol 3, Part A, Table 4.16] for LE credit based connection-oriented
+ * channels, or [Vol 3, Part A, Table 4.17] for enhanced credit based
+ * connection-oriented channels.
+ * Values:
+ * - 0x0000 ... 0x000F
+ * @param Max_Channel_Number Indicates the maximum number of channels that can
+ * be created.
+ * Values:
+ * - 0x01 ... 0x05
+ * @param[out] Channel_Number Number of created channels. It is the length of
+ * Channel_Index_List.
+ * Values:
+ * - 0 ... 5
+ * @param[out] Channel_Index_List List of channel indexes for which the
+ * primitive applies.
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_l2cap_coc_connect_confirm( uint16_t Connection_Handle,
+ uint16_t MTU,
+ uint16_t MPS,
+ uint16_t Initial_Credits,
+ uint16_t Result,
+ uint8_t Max_Channel_Number,
+ uint8_t* Channel_Number,
+ uint8_t* Channel_Index_List );
+
+/**
+ * @brief ACI_L2CAP_COC_RECONF
+ * This command sends a Credit Based Reconfigure Request packet on the
+ * specified connection. See Core Specification [Vol 3, Part A].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param MTU Maximum Transmission Unit.
+ * Values:
+ * - 23 ... 65535
+ * - 64 ... 246: for Enhanced ATT
+ * @param MPS Maximum payload size (in octets).
+ * Values:
+ * - 23 ... 248
+ * - 64 ... 248: for Enhanced ATT
+ * @param Channel_Number Number of created channels. It is the length of
+ * Channel_Index_List.
+ * Values:
+ * - 1 ... 5
+ * @param Channel_Index_List List of channel indexes for which the primitive
+ * applies.
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_l2cap_coc_reconf( uint16_t Connection_Handle,
+ uint16_t MTU,
+ uint16_t MPS,
+ uint8_t Channel_Number,
+ const uint8_t* Channel_Index_List );
+
+/**
+ * @brief ACI_L2CAP_COC_RECONF_CONFIRM
+ * This command sends a Credit Based Reconfigure Response packet. It must be
+ * used upon receipt of a Credit Based Reconfigure Request through an
+ * ACI_L2CAP_COC_RECONF_EVENT event. A Result value of 0x0000 indicates success
+ * while a non-zero value indicates the request is refused.
+ * See Core Specification [Vol 3, Part A].
+ *
+ * @param Connection_Handle Connection handle for which the command applies.
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ * @param Result Indicates the outcome of the request. See Core Specification
+ * [Vol 3, Part A, Table 4.18].
+ * Values:
+ * - 0x0000 ... 0x0004
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_l2cap_coc_reconf_confirm( uint16_t Connection_Handle,
+ uint16_t Result );
+
+/**
+ * @brief ACI_L2CAP_COC_DISCONNECT
+ * This command sends a Disconnection Request signaling packet on the specified
+ * connection-oriented channel. See Core Specification [Vol 3, Part A].
+ * The ACI_L2CAP_COC_DISCONNECT_EVENT event is received when the disconnection
+ * of the channel is effective.
+ *
+ * @param Channel_Index Index of the connection-oriented channel for which the
+ * primitive applies.
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_l2cap_coc_disconnect( uint8_t Channel_Index );
+
+/**
+ * @brief ACI_L2CAP_COC_FLOW_CONTROL
+ * This command sends a Flow Control Credit signaling packet on the specified
+ * connection-oriented channel. See Core Specification [Vol 3, Part A].
+ *
+ * @param Channel_Index Index of the connection-oriented channel for which the
+ * primitive applies.
+ * @param Credits Number of credits the receiving device can increment,
+ * corresponding to the number of K-frames that can be sent to the peer
+ * device sending the Flow Control Credit packet.
+ * Values:
+ * - 1 ... 65535
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_l2cap_coc_flow_control( uint8_t Channel_Index,
+ uint16_t Credits );
+
+/**
+ * @brief ACI_L2CAP_COC_TX_DATA
+ * This command sends a K-frame packet on the specified connection-oriented
+ * channel. See Core Specification [Vol 3, Part A].
+ * Note: for the first K-frame of the SDU, the Information data shall contain
+ * the L2CAP SDU Length coded on two octets followed by the K-frame information
+ * payload. For the next K-frames of the SDU, the Information data shall only
+ * contain the K-frame information payload.
+ * The Length value must not exceed (BLE_CMD_MAX_PARAM_LEN - 3) i.e. 252 for
+ * BLE_CMD_MAX_PARAM_LEN default value.
+ *
+ * @param Channel_Index Index of the connection-oriented channel for which the
+ * primitive applies.
+ * @param Length Length of Data (in octets)
+ * @param Data Information data
+ * @return Value indicating success or error code.
+ */
+tBleStatus aci_l2cap_coc_tx_data( uint8_t Channel_Index,
+ uint16_t Length,
+ const uint8_t* Data );
+
+
+#endif /* BLE_L2CAP_ACI_H__ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_types.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_types.h
new file mode 100644
index 0000000..673803a
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_types.h
@@ -0,0 +1,3459 @@
+/*****************************************************************************
+ * @file ble_types.h
+ * @brief STM32WB BLE command/event types
+ * Auto-generated file: do not edit!
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#ifndef BLE_TYPES_H__
+#define BLE_TYPES_H__
+
+
+#include <stdint.h>
+#include "ble_const.h"
+
+/* Type used for function return value */
+typedef uint8_t tBleStatus;
+
+/* Definition of Host_Nb_Of_Completed_Pkt_Pair_t */
+typedef __PACKED_STRUCT
+{
+ /**
+ * Connection_Handle[i].
+ * Values:
+ * - 0x0000 ... 0x0EFF
+ */
+ uint16_t Connection_Handle;
+ /**
+ * The number of HCI Data Packets [i] that have been completed for the
+ * associated Connection_Handle since the previous time the event was
+ * returned.
+ * Values:
+ * - 0x0000 ... 0xFFFF
+ */
+ uint16_t Host_Num_Of_Completed_Packets;
+} Host_Nb_Of_Completed_Pkt_Pair_t;
+
+/* Definition of Adv_Set_t */
+typedef __PACKED_STRUCT
+{
+ /**
+ * Used to identify an advertising set.
+ * Values:
+ * - 0x00 ... 0xEF
+ */
+ uint8_t Advertising_Handle;
+ /**
+ * Duration of advertising set.
+ * Time = N * 10 ms.
+ * Values:
+ * - 0x0000 (0 ms) : No advertising duration.
+ * - 0x0001 (10 ms) ... 0xFFFF (655350 ms) : Advertising duration
+ */
+ uint16_t Duration;
+ /**
+ * Maximum number of advertising events.
+ * Values:
+ * - 0x00: No maximum number of advertising events
+ * - 0x01 ... 0xFF: Maximum number of extended advertising events the
+ * Controller shall attempt to send prior to terminating the extended
+ * advertising
+ */
+ uint8_t Max_Extended_Advertising_Events;
+} Adv_Set_t;
+
+/* Definition of Scan_Param_Phy_t */
+typedef __PACKED_STRUCT
+{
+ /**
+ * Passive or active scanning. With passive scanning, no scan request PDUs
+ * are sent.
+ * Values:
+ * - 0x00: Passive scanning
+ * - 0x01: Active scanning
+ */
+ uint8_t Scan_Type;
+ /**
+ * Time interval from when the Controller started its last scan until it
+ * begins the subsequent scan on the primary advertising physical channel.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : only supported range
+ */
+ uint16_t Scan_Interval;
+ /**
+ * Duration of the scan on the primary advertising physical channel.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : only supported range
+ */
+ uint16_t Scan_Window;
+} Scan_Param_Phy_t;
+
+/* Definition of Init_Param_Phy_t */
+typedef __PACKED_STRUCT
+{
+ /**
+ * Time interval from when the Controller started its last scan until it
+ * begins the subsequent scan on the primary advertising physical channel.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : only supported range
+ */
+ uint16_t Scan_Interval;
+ /**
+ * Duration of the scan on the primary advertising physical channel.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0004 (2.500 ms) ... 0x5DC0 (15000.000 ms) : only supported range
+ */
+ uint16_t Scan_Window;
+ /**
+ * Minimum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ */
+ uint16_t Conn_Interval_Min;
+ /**
+ * Maximum value for the connection event interval.
+ * Time = N * 1.25 ms.
+ * Values:
+ * - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms)
+ */
+ uint16_t Conn_Interval_Max;
+ /**
+ * Maximum Peripheral latency for the connection in number of connection
+ * events.
+ * Values:
+ * - 0x0000 ... 0x01F3
+ */
+ uint16_t Conn_Latency;
+ /**
+ * Supervision timeout for the LE Link.
+ * It shall be a multiple of 10 ms and larger than (1 +
+ * connPeripheralLatency) * connInterval * 2.
+ * Time = N * 10 ms.
+ * Values:
+ * - 0x000A (100 ms) ... 0x0C80 (32000 ms)
+ */
+ uint16_t Supervision_Timeout;
+ /**
+ * Information parameter about the minimum length of connection needed for
+ * this LE connection.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
+ */
+ uint16_t Min_CE_Length;
+ /**
+ * Information parameter about the maximum length of connection needed for
+ * this LE connection.
+ * Time = N * 0.625 ms.
+ * Values:
+ * - 0x0000 (0.000 ms) ... 0xFFFF (40959.375 ms)
+ */
+ uint16_t Max_CE_Length;
+} Init_Param_Phy_t;
+
+/* Definition of Peer_Entry_t */
+typedef __PACKED_STRUCT
+{
+ /**
+ * Address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ */
+ uint8_t Peer_Address_Type;
+ /**
+ * Public Device Address or Random Device Address.
+ */
+ uint8_t Peer_Address[6];
+} Peer_Entry_t;
+
+/* Definition of Bonded_Device_Entry_t */
+typedef __PACKED_STRUCT
+{
+ /**
+ * Address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ */
+ uint8_t Address_Type;
+ /**
+ * Public Device Address or Random Device Address.
+ */
+ uint8_t Address[6];
+} Bonded_Device_Entry_t;
+
+/* Definition of List_Entry_t */
+typedef __PACKED_STRUCT
+{
+ /**
+ * Address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ */
+ uint8_t Address_Type;
+ /**
+ * Public Device Address or Random Device Address.
+ */
+ uint8_t Address[6];
+} List_Entry_t;
+
+/* Definition of Service_UUID_t */
+typedef __PACKED_UNION
+{
+ /**
+ * 16-bit UUID
+ */
+ uint16_t Service_UUID_16;
+ /**
+ * 128-bit UUID
+ */
+ uint8_t Service_UUID_128[16];
+} Service_UUID_t;
+
+/* Definition of Include_UUID_t */
+typedef __PACKED_UNION
+{
+ /**
+ * 16-bit UUID
+ */
+ uint16_t Include_UUID_16;
+ /**
+ * 128-bit UUID
+ */
+ uint8_t Include_UUID_128[16];
+} Include_UUID_t;
+
+/* Definition of Char_UUID_t */
+typedef __PACKED_UNION
+{
+ /**
+ * 16-bit UUID
+ */
+ uint16_t Char_UUID_16;
+ /**
+ * 128-bit UUID
+ */
+ uint8_t Char_UUID_128[16];
+} Char_UUID_t;
+
+/* Definition of Char_Desc_Uuid_t */
+typedef __PACKED_UNION
+{
+ /**
+ * 16-bit UUID
+ */
+ uint16_t Char_UUID_16;
+ /**
+ * 128-bit UUID
+ */
+ uint8_t Char_UUID_128[16];
+} Char_Desc_Uuid_t;
+
+/* Definition of UUID_t */
+typedef __PACKED_UNION
+{
+ /**
+ * 16-bit UUID
+ */
+ uint16_t UUID_16;
+ /**
+ * 128-bit UUID
+ */
+ uint8_t UUID_128[16];
+} UUID_t;
+
+/* Definition of Handle_Entry_t */
+typedef __PACKED_STRUCT
+{
+ /**
+ * Attribute handle
+ */
+ uint16_t Handle;
+} Handle_Entry_t;
+
+/* Definition of Handle_Packets_Pair_Entry_t */
+typedef __PACKED_STRUCT
+{
+ /**
+ * Connection handle
+ */
+ uint16_t Connection_Handle;
+ /**
+ * The number of HCI Data Packets that have been completed (transmitted or
+ * flushed) for the associated Connection_Handle since the previous time the
+ * event was returned.
+ */
+ uint16_t HC_Num_Of_Completed_Packets;
+} Handle_Packets_Pair_Entry_t;
+
+/* Definition of Advertising_Report_t */
+typedef __PACKED_STRUCT
+{
+ /**
+ * Type of advertising report event:
+ * ADV_IND: Connectable undirected advertising',
+ * ADV_DIRECT_IND: Connectable directed advertising,
+ * ADV_SCAN_IND: Scannable undirected advertising,
+ * ADV_NONCONN_IND: Non connectable undirected advertising,
+ * SCAN_RSP: Scan response.
+ * Values:
+ * - 0x00: ADV_IND
+ * - 0x01: ADV_DIRECT_IND
+ * - 0x02: ADV_SCAN_IND
+ * - 0x03: ADV_NONCONN_IND
+ * - 0x04: SCAN_RSP
+ */
+ uint8_t Event_Type;
+ /**
+ * Address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * - 0x02: Public Identity Address (corresponds to the Resolved Private
+ * Address)
+ * - 0x03: Random (static) Identity Address (corresponds to the Resolved
+ * Private Address)
+ */
+ uint8_t Address_Type;
+ /**
+ * Public Device Address or Random Device Address of the device to be
+ * connected.
+ */
+ uint8_t Address[6];
+ /**
+ * Length of the Data field for each device which responded.
+ * Values:
+ * - 0 ... 31
+ */
+ uint8_t Length_Data;
+ /**
+ * Octets of advertising or scan response data formatted as defined in Core
+ * Specification [Vol 3, Part C, 11].
+ */
+ const uint8_t* Data;
+ /**
+ * RSSI (signed integer).
+ * Units: dBm.
+ * Values:
+ * - 127: RSSI not available
+ * - -127 ... 20
+ */
+ uint8_t RSSI;
+} Advertising_Report_t;
+
+/* Definition of Direct_Advertising_Report_t */
+typedef __PACKED_STRUCT
+{
+ /**
+ * Advertising type
+ * Values:
+ * - 0x01: Connectable directed advertising (ADV_DIRECT_IND)
+ */
+ uint8_t Event_Type;
+ /**
+ * Address type.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * - 0x02: Public Identity Address (corresponds to the Resolved Private
+ * Address)
+ * - 0x03: Random (static) Identity Address (corresponds to the Resolved
+ * Private Address)
+ */
+ uint8_t Address_Type;
+ /**
+ * Public Device Address, Random Device Address, Public Identity Address or
+ * Random (static) Identity Address of the advertising device.
+ */
+ uint8_t Address[6];
+ /**
+ * 0x01 Random Device Address
+ * Values:
+ * - 0x01: Random Device Address
+ */
+ uint8_t Direct_Address_Type;
+ /**
+ * Random Device Address
+ */
+ uint8_t Direct_Address[6];
+ /**
+ * RSSI (signed integer).
+ * Units: dBm.
+ * Values:
+ * - 127: RSSI not available
+ * - -127 ... 20
+ */
+ uint8_t RSSI;
+} Direct_Advertising_Report_t;
+
+/* Definition of Attribute_Group_Handle_Pair_t */
+typedef __PACKED_STRUCT
+{
+ /**
+ * Found Attribute handle
+ */
+ uint16_t Found_Attribute_Handle;
+ /**
+ * Group End handle
+ */
+ uint16_t Group_End_Handle;
+} Attribute_Group_Handle_Pair_t;
+
+/* Definition of Handle_Item_t */
+typedef __PACKED_STRUCT
+{
+ uint16_t Handle;
+} Handle_Item_t;
+
+/* Internal types used by process functions */
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Reason;
+} hci_disconnect_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_disconnect_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} hci_read_remote_version_information_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_read_remote_version_information_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Event_Mask[8];
+} hci_set_event_mask_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_set_event_mask_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_reset_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Type;
+} hci_read_transmit_power_level_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Connection_Handle;
+ uint8_t Transmit_Power_Level;
+} hci_read_transmit_power_level_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Flow_Control_Enable;
+} hci_set_controller_to_host_flow_control_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_set_controller_to_host_flow_control_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Host_ACL_Data_Packet_Length;
+ uint8_t Host_Synchronous_Data_Packet_Length;
+ uint16_t Host_Total_Num_ACL_Data_Packets;
+ uint16_t Host_Total_Num_Synchronous_Data_Packets;
+} hci_host_buffer_size_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_host_buffer_size_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Number_Of_Handles;
+ Host_Nb_Of_Completed_Pkt_Pair_t Host_Nb_Of_Completed_Pkt_Pair[(BLE_CMD_MAX_PARAM_LEN - 1)/sizeof(Host_Nb_Of_Completed_Pkt_Pair_t)];
+} hci_host_number_of_completed_packets_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_host_number_of_completed_packets_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t HCI_Version;
+ uint16_t HCI_Subversion;
+ uint8_t LMP_Version;
+ uint16_t Company_Identifier;
+ uint16_t LMP_Subversion;
+} hci_read_local_version_information_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Supported_Commands[64];
+} hci_read_local_supported_commands_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t LMP_Features[8];
+} hci_read_local_supported_features_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t BD_ADDR[6];
+} hci_read_bd_addr_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} hci_read_rssi_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Connection_Handle;
+ uint8_t RSSI;
+} hci_read_rssi_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t LE_Event_Mask[8];
+} hci_le_set_event_mask_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_event_mask_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t HC_LE_ACL_Data_Packet_Length;
+ uint8_t HC_Total_Num_LE_ACL_Data_Packets;
+} hci_le_read_buffer_size_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t LE_Features[8];
+} hci_le_read_local_supported_features_page_0_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Random_Address[6];
+} hci_le_set_random_address_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_random_address_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Advertising_Interval_Min;
+ uint16_t Advertising_Interval_Max;
+ uint8_t Advertising_Type;
+ uint8_t Own_Address_Type;
+ uint8_t Peer_Address_Type;
+ uint8_t Peer_Address[6];
+ uint8_t Advertising_Channel_Map;
+ uint8_t Advertising_Filter_Policy;
+} hci_le_set_advertising_parameters_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_advertising_parameters_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Transmit_Power_Level;
+} hci_le_read_advertising_physical_channel_tx_power_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Advertising_Data_Length;
+ uint8_t Advertising_Data[31];
+} hci_le_set_advertising_data_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_advertising_data_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Scan_Response_Data_Length;
+ uint8_t Scan_Response_Data[31];
+} hci_le_set_scan_response_data_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_scan_response_data_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Advertising_Enable;
+} hci_le_set_advertising_enable_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_advertising_enable_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t LE_Scan_Type;
+ uint16_t LE_Scan_Interval;
+ uint16_t LE_Scan_Window;
+ uint8_t Own_Address_Type;
+ uint8_t Scanning_Filter_Policy;
+} hci_le_set_scan_parameters_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_scan_parameters_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t LE_Scan_Enable;
+ uint8_t Filter_Duplicates;
+} hci_le_set_scan_enable_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_scan_enable_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t LE_Scan_Interval;
+ uint16_t LE_Scan_Window;
+ uint8_t Initiator_Filter_Policy;
+ uint8_t Peer_Address_Type;
+ uint8_t Peer_Address[6];
+ uint8_t Own_Address_Type;
+ uint16_t Conn_Interval_Min;
+ uint16_t Conn_Interval_Max;
+ uint16_t Conn_Latency;
+ uint16_t Supervision_Timeout;
+ uint16_t Minimum_CE_Length;
+ uint16_t Maximum_CE_Length;
+} hci_le_create_connection_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_create_connection_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_create_connection_cancel_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Filter_Accept_List_Size;
+} hci_le_read_filter_accept_list_size_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_clear_filter_accept_list_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Address_Type;
+ uint8_t Address[6];
+} hci_le_add_device_to_filter_accept_list_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_add_device_to_filter_accept_list_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Address_Type;
+ uint8_t Address[6];
+} hci_le_remove_device_from_filter_accept_list_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_remove_device_from_filter_accept_list_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Conn_Interval_Min;
+ uint16_t Conn_Interval_Max;
+ uint16_t Conn_Latency;
+ uint16_t Supervision_Timeout;
+ uint16_t Minimum_CE_Length;
+ uint16_t Maximum_CE_Length;
+} hci_le_connection_update_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_connection_update_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t LE_Channel_Map[5];
+} hci_le_set_host_channel_classification_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_host_channel_classification_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} hci_le_read_channel_map_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Connection_Handle;
+ uint8_t LE_Channel_Map[5];
+} hci_le_read_channel_map_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} hci_le_read_remote_features_page_0_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_read_remote_features_page_0_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Key[16];
+ uint8_t Plaintext_Data[16];
+} hci_le_encrypt_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Encrypted_Data[16];
+} hci_le_encrypt_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Random_Number[8];
+} hci_le_rand_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Random_Number[8];
+ uint16_t Encrypted_Diversifier;
+ uint8_t Long_Term_Key[16];
+} hci_le_enable_encryption_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_enable_encryption_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Long_Term_Key[16];
+} hci_le_long_term_key_request_reply_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Connection_Handle;
+} hci_le_long_term_key_request_reply_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} hci_le_long_term_key_request_negative_reply_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Connection_Handle;
+} hci_le_long_term_key_request_negative_reply_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t LE_States[8];
+} hci_le_read_supported_states_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t RX_Frequency;
+} hci_le_receiver_test_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_receiver_test_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t TX_Frequency;
+ uint8_t Length_Of_Test_Data;
+ uint8_t Packet_Payload;
+} hci_le_transmitter_test_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_transmitter_test_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Number_Of_Packets;
+} hci_le_test_end_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t TxOctets;
+ uint16_t TxTime;
+} hci_le_set_data_length_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Connection_Handle;
+} hci_le_set_data_length_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t SuggestedMaxTxOctets;
+ uint16_t SuggestedMaxTxTime;
+} hci_le_read_suggested_default_data_length_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t SuggestedMaxTxOctets;
+ uint16_t SuggestedMaxTxTime;
+} hci_le_write_suggested_default_data_length_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_write_suggested_default_data_length_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_read_local_p256_public_key_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Remote_P256_Public_Key[64];
+} hci_le_generate_dhkey_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_generate_dhkey_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Peer_Identity_Address_Type;
+ uint8_t Peer_Identity_Address[6];
+ uint8_t Peer_IRK[16];
+ uint8_t Local_IRK[16];
+} hci_le_add_device_to_resolving_list_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_add_device_to_resolving_list_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Peer_Identity_Address_Type;
+ uint8_t Peer_Identity_Address[6];
+} hci_le_remove_device_from_resolving_list_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_remove_device_from_resolving_list_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_clear_resolving_list_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Resolving_List_Size;
+} hci_le_read_resolving_list_size_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Peer_Identity_Address_Type;
+ uint8_t Peer_Identity_Address[6];
+} hci_le_read_peer_resolvable_address_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Peer_Resolvable_Address[6];
+} hci_le_read_peer_resolvable_address_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Peer_Identity_Address_Type;
+ uint8_t Peer_Identity_Address[6];
+} hci_le_read_local_resolvable_address_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Local_Resolvable_Address[6];
+} hci_le_read_local_resolvable_address_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Address_Resolution_Enable;
+} hci_le_set_address_resolution_enable_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_address_resolution_enable_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t RPA_Timeout;
+} hci_le_set_resolvable_private_address_timeout_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_resolvable_private_address_timeout_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t supportedMaxTxOctets;
+ uint16_t supportedMaxTxTime;
+ uint16_t supportedMaxRxOctets;
+ uint16_t supportedMaxRxTime;
+} hci_le_read_maximum_data_length_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} hci_le_read_phy_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Connection_Handle;
+ uint8_t TX_PHY;
+ uint8_t RX_PHY;
+} hci_le_read_phy_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t ALL_PHYS;
+ uint8_t TX_PHYS;
+ uint8_t RX_PHYS;
+} hci_le_set_default_phy_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_default_phy_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t ALL_PHYS;
+ uint8_t TX_PHYS;
+ uint8_t RX_PHYS;
+ uint16_t PHY_options;
+} hci_le_set_phy_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_phy_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t RX_Frequency;
+ uint8_t PHY;
+ uint8_t Modulation_Index;
+} hci_le_receiver_test_v2_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_receiver_test_v2_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t TX_Frequency;
+ uint8_t Length_Of_Test_Data;
+ uint8_t Packet_Payload;
+ uint8_t PHY;
+} hci_le_transmitter_test_v2_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_transmitter_test_v2_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Advertising_Handle;
+ uint8_t Random_Address[6];
+} hci_le_set_advertising_set_random_address_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_advertising_set_random_address_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Advertising_Handle;
+ uint16_t Adv_Event_Properties;
+ uint8_t Primary_Adv_Interval_Min[3];
+ uint8_t Primary_Adv_Interval_Max[3];
+ uint8_t Primary_Adv_Channel_Map;
+ uint8_t Own_Address_Type;
+ uint8_t Peer_Address_Type;
+ uint8_t Peer_Address[6];
+ uint8_t Adv_Filter_Policy;
+ uint8_t Adv_TX_Power;
+ uint8_t Primary_Adv_PHY;
+ uint8_t Secondary_Adv_Max_Skip;
+ uint8_t Secondary_Adv_PHY;
+ uint8_t Adv_SID;
+ uint8_t Scan_Req_Notification_Enable;
+} hci_le_set_extended_advertising_parameters_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Selected_TX_Power;
+} hci_le_set_extended_advertising_parameters_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Advertising_Handle;
+ uint8_t Operation;
+ uint8_t Fragment_Preference;
+ uint8_t Advertising_Data_Length;
+ uint8_t Advertising_Data[BLE_CMD_MAX_PARAM_LEN - 4];
+} hci_le_set_extended_advertising_data_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_extended_advertising_data_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Advertising_Handle;
+ uint8_t Operation;
+ uint8_t Fragment_Preference;
+ uint8_t Scan_Response_Data_Length;
+ uint8_t Scan_Response_Data[BLE_CMD_MAX_PARAM_LEN - 4];
+} hci_le_set_extended_scan_response_data_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_extended_scan_response_data_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Enable;
+ uint8_t Num_Sets;
+ Adv_Set_t Adv_Set[(BLE_CMD_MAX_PARAM_LEN - 2)/sizeof(Adv_Set_t)];
+} hci_le_set_extended_advertising_enable_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_extended_advertising_enable_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Max_Advertising_Data_Length;
+} hci_le_read_maximum_advertising_data_length_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Num_Supported_Advertising_Sets;
+} hci_le_read_number_of_supported_advertising_sets_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Advertising_Handle;
+} hci_le_remove_advertising_set_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_remove_advertising_set_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_clear_advertising_sets_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Own_Address_Type;
+ uint8_t Scanning_Filter_Policy;
+ uint8_t Scanning_PHYs;
+ Scan_Param_Phy_t Scan_Param_Phy[2];
+} hci_le_set_extended_scan_parameters_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_extended_scan_parameters_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Enable;
+ uint8_t Filter_Duplicates;
+ uint16_t Duration;
+ uint16_t Period;
+} hci_le_set_extended_scan_enable_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_extended_scan_enable_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Initiator_Filter_Policy;
+ uint8_t Own_Address_Type;
+ uint8_t Peer_Address_Type;
+ uint8_t Peer_Address[6];
+ uint8_t Initiating_PHYs;
+ Init_Param_Phy_t Init_Param_Phy[3];
+} hci_le_extended_create_connection_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_extended_create_connection_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Min_TX_Power;
+ uint8_t Max_TX_Power;
+} hci_le_read_transmit_power_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t RF_TX_Path_Compensation;
+ uint16_t RF_RX_Path_Compensation;
+} hci_le_read_rf_path_compensation_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t RF_TX_Path_Compensation;
+ uint16_t RF_RX_Path_Compensation;
+} hci_le_write_rf_path_compensation_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_write_rf_path_compensation_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Peer_Identity_Address_Type;
+ uint8_t Peer_Identity_Address[6];
+ uint8_t Privacy_Mode;
+} hci_le_set_privacy_mode_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_privacy_mode_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Remote_P256_Public_Key[64];
+ uint8_t Key_Type;
+} hci_le_generate_dhkey_v2_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_generate_dhkey_v2_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t RPA_Timeout_Min;
+ uint16_t RPA_Timeout_Max;
+} hci_le_set_resolvable_private_address_timeout_v2_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} hci_le_set_resolvable_private_address_timeout_v2_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Offset;
+ uint8_t Length;
+ uint8_t Value[BLE_CMD_MAX_PARAM_LEN - 2];
+} aci_hal_write_config_data_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_hal_write_config_data_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Offset;
+} aci_hal_read_config_data_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Data_Length;
+ uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 3) - 2];
+} aci_hal_read_config_data_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t En_High_Power;
+ uint8_t PA_Level;
+} aci_hal_set_tx_power_level_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_hal_set_tx_power_level_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint32_t Number_Of_Packets;
+} aci_hal_le_tx_test_packet_number_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t RF_Channel;
+ uint8_t Freq_offset;
+} aci_hal_tone_start_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_hal_tone_start_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_hal_tone_stop_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Link_Status[8];
+ uint16_t Link_Connection_Handle[8];
+} aci_hal_get_link_status_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Radio_Activity_Mask;
+} aci_hal_set_radio_activity_mask_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_hal_set_radio_activity_mask_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint32_t Anchor_Period;
+ uint32_t Max_Free_Slot;
+} aci_hal_get_anchor_period_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint32_t Event_Mask;
+} aci_hal_set_event_mask_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_hal_set_event_mask_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Enable;
+} aci_hal_set_peripheral_latency_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_hal_set_peripheral_latency_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t RSSI;
+} aci_hal_read_rssi_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Mode;
+ uint8_t Key[16];
+ uint8_t IV[8];
+ uint16_t In_Data_Length;
+ uint8_t In_Data[BLE_CMD_MAX_PARAM_LEN - 27];
+} aci_hal_ead_encrypt_decrypt_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Out_Data_Length;
+ uint8_t Out_Data[(BLE_EVT_MAX_PARAM_LEN - 3) - 3];
+} aci_hal_ead_encrypt_decrypt_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Register_Address;
+} aci_hal_read_radio_reg_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t reg_val;
+} aci_hal_read_radio_reg_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Register_Address;
+ uint8_t Register_Value;
+} aci_hal_write_radio_reg_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_hal_write_radio_reg_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Value[3];
+} aci_hal_read_raw_rssi_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t RF_Channel;
+} aci_hal_rx_start_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_hal_rx_start_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_hal_rx_stop_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_set_non_discoverable_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Advertising_Type;
+ uint16_t Advertising_Interval_Min;
+ uint16_t Advertising_Interval_Max;
+ uint8_t Own_Address_Type;
+ uint8_t Advertising_Filter_Policy;
+ uint8_t Local_Name_Length;
+ uint8_t Local_Name[BLE_CMD_MAX_PARAM_LEN - 13];
+} aci_gap_set_limited_discoverable_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Service_Uuid_length;
+ uint8_t Service_Uuid_List[BLE_CMD_MAX_PARAM_LEN - 13];
+} aci_gap_set_limited_discoverable_cp1;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Conn_Interval_Min;
+ uint16_t Conn_Interval_Max;
+} aci_gap_set_limited_discoverable_cp2;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_set_limited_discoverable_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Advertising_Type;
+ uint16_t Advertising_Interval_Min;
+ uint16_t Advertising_Interval_Max;
+ uint8_t Own_Address_Type;
+ uint8_t Advertising_Filter_Policy;
+ uint8_t Local_Name_Length;
+ uint8_t Local_Name[BLE_CMD_MAX_PARAM_LEN - 13];
+} aci_gap_set_discoverable_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Service_Uuid_length;
+ uint8_t Service_Uuid_List[BLE_CMD_MAX_PARAM_LEN - 13];
+} aci_gap_set_discoverable_cp1;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Conn_Interval_Min;
+ uint16_t Conn_Interval_Max;
+} aci_gap_set_discoverable_cp2;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_set_discoverable_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Own_Address_Type;
+ uint8_t Directed_Advertising_Type;
+ uint8_t Direct_Address_Type;
+ uint8_t Direct_Address[6];
+ uint16_t Advertising_Interval_Min;
+ uint16_t Advertising_Interval_Max;
+} aci_gap_set_direct_connectable_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_set_direct_connectable_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t IO_Capability;
+} aci_gap_set_io_capability_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_set_io_capability_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Bonding_Mode;
+ uint8_t MITM_Mode;
+ uint8_t SC_Support;
+ uint8_t KeyPress_Notification_Support;
+ uint8_t Min_Encryption_Key_Size;
+ uint8_t Max_Encryption_Key_Size;
+ uint8_t Use_Fixed_Pin;
+ uint32_t Fixed_Pin;
+ uint8_t Identity_Address_Type;
+} aci_gap_set_authentication_requirement_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_set_authentication_requirement_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Authorization_Enable;
+} aci_gap_set_authorization_requirement_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_set_authorization_requirement_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint32_t Pass_Key;
+} aci_gap_pass_key_resp_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_pass_key_resp_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Authorize;
+} aci_gap_authorization_resp_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_authorization_resp_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Role;
+ uint8_t privacy_enabled;
+ uint8_t device_name_char_len;
+} aci_gap_init_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Service_Handle;
+ uint16_t Dev_Name_Char_Handle;
+ uint16_t Appearance_Char_Handle;
+} aci_gap_init_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Advertising_Event_Type;
+ uint8_t Own_Address_Type;
+} aci_gap_set_non_connectable_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_set_non_connectable_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Advertising_Interval_Min;
+ uint16_t Advertising_Interval_Max;
+ uint8_t Own_Address_Type;
+ uint8_t Adv_Filter_Policy;
+} aci_gap_set_undirected_connectable_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_set_undirected_connectable_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} aci_gap_peripheral_security_req_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_peripheral_security_req_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t AdvDataLen;
+ uint8_t AdvData[BLE_CMD_MAX_PARAM_LEN - 1];
+} aci_gap_update_adv_data_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_update_adv_data_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t ADType;
+} aci_gap_delete_ad_type_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_delete_ad_type_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} aci_gap_get_security_level_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Security_Mode;
+ uint8_t Security_Level;
+} aci_gap_get_security_level_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t GAP_Evt_Mask;
+} aci_gap_set_event_mask_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_set_event_mask_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_configure_filter_accept_list_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Reason;
+} aci_gap_terminate_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_terminate_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_clear_security_db_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} aci_gap_allow_rebond_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_allow_rebond_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t LE_Scan_Interval;
+ uint16_t LE_Scan_Window;
+ uint8_t Own_Address_Type;
+ uint8_t Filter_Duplicates;
+} aci_gap_start_limited_discovery_proc_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_start_limited_discovery_proc_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t LE_Scan_Interval;
+ uint16_t LE_Scan_Window;
+ uint8_t Own_Address_Type;
+ uint8_t Filter_Duplicates;
+} aci_gap_start_general_discovery_proc_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_start_general_discovery_proc_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t LE_Scan_Interval;
+ uint16_t LE_Scan_Window;
+ uint8_t Own_Address_Type;
+ uint16_t Conn_Interval_Min;
+ uint16_t Conn_Interval_Max;
+ uint16_t Conn_Latency;
+ uint16_t Supervision_Timeout;
+ uint16_t Minimum_CE_Length;
+ uint16_t Maximum_CE_Length;
+ uint8_t Num_of_Peer_Entries;
+ Peer_Entry_t Peer_Entry[(BLE_CMD_MAX_PARAM_LEN - 18)/sizeof(Peer_Entry_t)];
+} aci_gap_start_auto_connection_establish_proc_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_start_auto_connection_establish_proc_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t LE_Scan_Type;
+ uint16_t LE_Scan_Interval;
+ uint16_t LE_Scan_Window;
+ uint8_t Own_Address_Type;
+ uint8_t Scanning_Filter_Policy;
+ uint8_t Filter_Duplicates;
+} aci_gap_start_general_connection_establish_proc_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_start_general_connection_establish_proc_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t LE_Scan_Type;
+ uint16_t LE_Scan_Interval;
+ uint16_t LE_Scan_Window;
+ uint8_t Own_Address_Type;
+ uint8_t Scanning_Filter_Policy;
+ uint8_t Filter_Duplicates;
+ uint8_t Num_of_Peer_Entries;
+ Peer_Entry_t Peer_Entry[(BLE_CMD_MAX_PARAM_LEN - 9)/sizeof(Peer_Entry_t)];
+} aci_gap_start_selective_connection_establish_proc_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_start_selective_connection_establish_proc_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t LE_Scan_Interval;
+ uint16_t LE_Scan_Window;
+ uint8_t Peer_Address_Type;
+ uint8_t Peer_Address[6];
+ uint8_t Own_Address_Type;
+ uint16_t Conn_Interval_Min;
+ uint16_t Conn_Interval_Max;
+ uint16_t Conn_Latency;
+ uint16_t Supervision_Timeout;
+ uint16_t Minimum_CE_Length;
+ uint16_t Maximum_CE_Length;
+} aci_gap_create_connection_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_create_connection_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Procedure_Code;
+} aci_gap_terminate_gap_proc_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_terminate_gap_proc_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Conn_Interval_Min;
+ uint16_t Conn_Interval_Max;
+ uint16_t Conn_Latency;
+ uint16_t Supervision_Timeout;
+ uint16_t Minimum_CE_Length;
+ uint16_t Maximum_CE_Length;
+} aci_gap_start_connection_update_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_start_connection_update_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Force_Rebond;
+} aci_gap_send_pairing_req_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_send_pairing_req_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Advertising_Interval_Min;
+ uint16_t Advertising_Interval_Max;
+ uint8_t Advertising_Type;
+ uint8_t Own_Address_Type;
+ uint8_t Adv_Data_Length;
+ uint8_t Adv_Data[BLE_CMD_MAX_PARAM_LEN - 8];
+} aci_gap_set_broadcast_mode_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Num_of_Peer_Entries;
+ Peer_Entry_t Peer_Entry[(BLE_CMD_MAX_PARAM_LEN - 8)/sizeof(Peer_Entry_t)];
+} aci_gap_set_broadcast_mode_cp1;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_set_broadcast_mode_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t LE_Scan_Interval;
+ uint16_t LE_Scan_Window;
+ uint8_t LE_Scan_Type;
+ uint8_t Own_Address_Type;
+ uint8_t Filter_Duplicates;
+ uint8_t Scanning_Filter_Policy;
+} aci_gap_start_observation_proc_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_start_observation_proc_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Num_of_Addresses;
+ Bonded_Device_Entry_t Bonded_Device_Entry[((BLE_EVT_MAX_PARAM_LEN - 3) - 2)/sizeof(Bonded_Device_Entry_t)];
+} aci_gap_get_bonded_devices_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Peer_Address_Type;
+ uint8_t Peer_Address[6];
+} aci_gap_check_bonded_device_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Id_Address_Type;
+ uint8_t Id_Address[6];
+} aci_gap_check_bonded_device_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Confirm_Yes_No;
+} aci_gap_numeric_comparison_value_confirm_yesno_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_numeric_comparison_value_confirm_yesno_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Input_Type;
+} aci_gap_passkey_input_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_passkey_input_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t OOB_Data_Type;
+} aci_gap_get_oob_data_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Address_Type;
+ uint8_t Address[6];
+ uint8_t OOB_Data_Type;
+ uint8_t OOB_Data_Len;
+ uint8_t OOB_Data[16];
+} aci_gap_get_oob_data_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Device_Type;
+ uint8_t Address_Type;
+ uint8_t Address[6];
+ uint8_t OOB_Data_Type;
+ uint8_t OOB_Data_Len;
+ uint8_t OOB_Data[16];
+} aci_gap_set_oob_data_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_set_oob_data_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Peer_Identity_Address_Type;
+ uint8_t Peer_Identity_Address[6];
+} aci_gap_remove_bonded_device_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_remove_bonded_device_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Num_of_List_Entries;
+ List_Entry_t List_Entry[(BLE_CMD_MAX_PARAM_LEN - 2)/sizeof(List_Entry_t)];
+} aci_gap_add_devices_to_list_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Mode;
+} aci_gap_add_devices_to_list_cp1;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_add_devices_to_list_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Accept;
+} aci_gap_pairing_request_reply_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_pairing_request_reply_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Adv_Interval_Min;
+ uint16_t Adv_Interval_Max;
+ uint8_t Adv_Channel_Map;
+ uint8_t Own_Address_Type;
+ uint8_t Own_Address[6];
+ uint8_t PA_Level;
+} aci_gap_additional_beacon_start_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_additional_beacon_start_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_additional_beacon_stop_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Adv_Data_Length;
+ uint8_t Adv_Data[BLE_CMD_MAX_PARAM_LEN - 1];
+} aci_gap_additional_beacon_set_data_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_additional_beacon_set_data_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Adv_Mode;
+ uint8_t Advertising_Handle;
+ uint16_t Adv_Event_Properties;
+ uint32_t Primary_Adv_Interval_Min;
+ uint32_t Primary_Adv_Interval_Max;
+ uint8_t Primary_Adv_Channel_Map;
+ uint8_t Own_Address_Type;
+ uint8_t Peer_Address_Type;
+ uint8_t Peer_Address[6];
+ uint8_t Adv_Filter_Policy;
+ uint8_t Adv_TX_Power;
+ uint8_t Secondary_Adv_Max_Skip;
+ uint8_t Secondary_Adv_PHY;
+ uint8_t Adv_SID;
+ uint8_t Scan_Req_Notification_Enable;
+} aci_gap_adv_set_configuration_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_adv_set_configuration_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Enable;
+ uint8_t Num_Sets;
+ Adv_Set_t Adv_Set[(BLE_CMD_MAX_PARAM_LEN - 2)/sizeof(Adv_Set_t)];
+} aci_gap_adv_set_enable_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_adv_set_enable_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Advertising_Handle;
+ uint8_t Operation;
+ uint8_t Fragment_Preference;
+ uint8_t Advertising_Data_Length;
+ uint8_t Advertising_Data[BLE_CMD_MAX_PARAM_LEN - 4];
+} aci_gap_adv_set_adv_data_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_adv_set_adv_data_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Advertising_Handle;
+ uint8_t Operation;
+ uint8_t Fragment_Preference;
+ uint8_t Scan_Response_Data_Length;
+ uint8_t Scan_Response_Data[BLE_CMD_MAX_PARAM_LEN - 4];
+} aci_gap_adv_set_scan_resp_data_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_adv_set_scan_resp_data_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Advertising_Handle;
+} aci_gap_adv_remove_set_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_adv_remove_set_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_adv_clear_sets_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Advertising_Handle;
+ uint8_t Random_Address[6];
+} aci_gap_adv_set_random_address_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_adv_set_random_address_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Scan_Mode;
+ uint8_t Procedure;
+ uint8_t Own_Address_Type;
+ uint8_t Filter_Duplicates;
+ uint16_t Duration;
+ uint16_t Period;
+ uint8_t Scanning_Filter_Policy;
+ uint8_t Scanning_PHYs;
+ Scan_Param_Phy_t Scan_Param_Phy[2];
+} aci_gap_ext_start_scan_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_ext_start_scan_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Initiating_Mode;
+ uint8_t Procedure;
+ uint8_t Own_Address_Type;
+ uint8_t Peer_Address_Type;
+ uint8_t Peer_Address[6];
+ uint8_t Advertising_Handle;
+ uint8_t Subevent;
+ uint8_t Initiator_Filter_Policy;
+ uint8_t Initiating_PHYs;
+ Init_Param_Phy_t Init_Param_Phy[3];
+} aci_gap_ext_create_connection_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gap_ext_create_connection_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_init_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Service_UUID_Type;
+ Service_UUID_t Service_UUID;
+} aci_gatt_add_service_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Service_Type;
+ uint8_t Max_Attribute_Records;
+} aci_gatt_add_service_cp1;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Service_Handle;
+} aci_gatt_add_service_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Service_Handle;
+ uint16_t Include_Start_Handle;
+ uint16_t Include_End_Handle;
+ uint8_t Include_UUID_Type;
+ Include_UUID_t Include_UUID;
+} aci_gatt_include_service_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Include_Handle;
+} aci_gatt_include_service_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Service_Handle;
+ uint8_t Char_UUID_Type;
+ Char_UUID_t Char_UUID;
+} aci_gatt_add_char_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Char_Value_Length;
+ uint8_t Char_Properties;
+ uint8_t Security_Permissions;
+ uint8_t GATT_Evt_Mask;
+ uint8_t Enc_Key_Size;
+ uint8_t Is_Variable;
+} aci_gatt_add_char_cp1;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Char_Handle;
+} aci_gatt_add_char_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Service_Handle;
+ uint16_t Char_Handle;
+ uint8_t Char_Desc_Uuid_Type;
+ Char_Desc_Uuid_t Char_Desc_Uuid;
+} aci_gatt_add_char_desc_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Char_Desc_Value_Max_Len;
+ uint8_t Char_Desc_Value_Length;
+ uint8_t Char_Desc_Value[BLE_CMD_MAX_PARAM_LEN - 12];
+} aci_gatt_add_char_desc_cp1;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Security_Permissions;
+ uint8_t Access_Permissions;
+ uint8_t GATT_Evt_Mask;
+ uint8_t Enc_Key_Size;
+ uint8_t Is_Variable;
+} aci_gatt_add_char_desc_cp2;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Char_Desc_Handle;
+} aci_gatt_add_char_desc_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Service_Handle;
+ uint16_t Char_Handle;
+ uint8_t Val_Offset;
+ uint8_t Char_Value_Length;
+ uint8_t Char_Value[BLE_CMD_MAX_PARAM_LEN - 6];
+} aci_gatt_update_char_value_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_update_char_value_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Serv_Handle;
+ uint16_t Char_Handle;
+} aci_gatt_del_char_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_del_char_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Serv_Handle;
+} aci_gatt_del_service_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_del_service_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Serv_Handle;
+ uint16_t Include_Handle;
+} aci_gatt_del_include_service_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_del_include_service_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint32_t GATT_Evt_Mask;
+} aci_gatt_set_event_mask_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_set_event_mask_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} aci_gatt_exchange_config_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_exchange_config_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Start_Handle;
+ uint16_t End_Handle;
+} aci_att_find_info_req_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_att_find_info_req_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Start_Handle;
+ uint16_t End_Handle;
+ uint16_t UUID;
+ uint8_t Attribute_Val_Length;
+ uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 9];
+} aci_att_find_by_type_value_req_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_att_find_by_type_value_req_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Start_Handle;
+ uint16_t End_Handle;
+ uint8_t UUID_Type;
+ UUID_t UUID;
+} aci_att_read_by_type_req_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_att_read_by_type_req_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Start_Handle;
+ uint16_t End_Handle;
+ uint8_t UUID_Type;
+ UUID_t UUID;
+} aci_att_read_by_group_type_req_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_att_read_by_group_type_req_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attr_Handle;
+ uint16_t Val_Offset;
+ uint8_t Attribute_Val_Length;
+ uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 7];
+} aci_att_prepare_write_req_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_att_prepare_write_req_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Execute;
+} aci_att_execute_write_req_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_att_execute_write_req_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} aci_gatt_disc_all_primary_services_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_disc_all_primary_services_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t UUID_Type;
+ UUID_t UUID;
+} aci_gatt_disc_primary_service_by_uuid_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_disc_primary_service_by_uuid_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Start_Handle;
+ uint16_t End_Handle;
+} aci_gatt_find_included_services_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_find_included_services_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Start_Handle;
+ uint16_t End_Handle;
+} aci_gatt_disc_all_char_of_service_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_disc_all_char_of_service_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Start_Handle;
+ uint16_t End_Handle;
+ uint8_t UUID_Type;
+ UUID_t UUID;
+} aci_gatt_disc_char_by_uuid_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_disc_char_by_uuid_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Char_Handle;
+ uint16_t End_Handle;
+} aci_gatt_disc_all_char_desc_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_disc_all_char_desc_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attr_Handle;
+} aci_gatt_read_char_value_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_read_char_value_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Start_Handle;
+ uint16_t End_Handle;
+ uint8_t UUID_Type;
+ UUID_t UUID;
+} aci_gatt_read_using_char_uuid_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_read_using_char_uuid_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attr_Handle;
+ uint16_t Val_Offset;
+} aci_gatt_read_long_char_value_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_read_long_char_value_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Number_of_Handles;
+ Handle_Entry_t Handle_Entry[(BLE_CMD_MAX_PARAM_LEN - 3)/sizeof(Handle_Entry_t)];
+} aci_gatt_read_multiple_char_value_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_read_multiple_char_value_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attr_Handle;
+ uint8_t Attribute_Val_Length;
+ uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 5];
+} aci_gatt_write_char_value_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_write_char_value_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attr_Handle;
+ uint16_t Val_Offset;
+ uint8_t Attribute_Val_Length;
+ uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 7];
+} aci_gatt_write_long_char_value_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_write_long_char_value_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attr_Handle;
+ uint16_t Val_Offset;
+ uint8_t Attribute_Val_Length;
+ uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 7];
+} aci_gatt_write_char_reliable_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_write_char_reliable_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attr_Handle;
+ uint16_t Val_Offset;
+ uint8_t Attribute_Val_Length;
+ uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 7];
+} aci_gatt_write_long_char_desc_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_write_long_char_desc_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attr_Handle;
+ uint16_t Val_Offset;
+} aci_gatt_read_long_char_desc_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_read_long_char_desc_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attr_Handle;
+ uint8_t Attribute_Val_Length;
+ uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 5];
+} aci_gatt_write_char_desc_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_write_char_desc_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attr_Handle;
+} aci_gatt_read_char_desc_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_read_char_desc_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attr_Handle;
+ uint8_t Attribute_Val_Length;
+ uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 5];
+} aci_gatt_write_without_resp_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_write_without_resp_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attr_Handle;
+ uint8_t Attribute_Val_Length;
+ uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 5];
+} aci_gatt_signed_write_without_resp_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_signed_write_without_resp_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} aci_gatt_confirm_indication_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_confirm_indication_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attr_Handle;
+ uint8_t Write_status;
+ uint8_t Error_Code;
+ uint8_t Attribute_Val_Length;
+ uint8_t Attribute_Val[BLE_CMD_MAX_PARAM_LEN - 7];
+} aci_gatt_write_resp_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_write_resp_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} aci_gatt_allow_read_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_allow_read_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Serv_Handle;
+ uint16_t Attr_Handle;
+ uint8_t Security_Permissions;
+} aci_gatt_set_security_permission_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_set_security_permission_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Serv_Handle;
+ uint16_t Char_Handle;
+ uint16_t Char_Desc_Handle;
+ uint16_t Val_Offset;
+ uint8_t Char_Desc_Value_Length;
+ uint8_t Char_Desc_Value[BLE_CMD_MAX_PARAM_LEN - 9];
+} aci_gatt_set_desc_value_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_set_desc_value_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Attr_Handle;
+ uint16_t Offset;
+ uint16_t Value_Length_Requested;
+} aci_gatt_read_handle_value_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Length;
+ uint16_t Value_Length;
+ uint8_t Value[(BLE_EVT_MAX_PARAM_LEN - 3) - 5];
+} aci_gatt_read_handle_value_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Conn_Handle_To_Notify;
+ uint16_t Service_Handle;
+ uint16_t Char_Handle;
+ uint8_t Update_Type;
+ uint16_t Char_Length;
+ uint16_t Value_Offset;
+ uint8_t Value_Length;
+ uint8_t Value[BLE_CMD_MAX_PARAM_LEN - 12];
+} aci_gatt_update_char_value_ext_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_update_char_value_ext_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Error_Code;
+} aci_gatt_deny_read_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_deny_read_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Serv_Handle;
+ uint16_t Attr_Handle;
+ uint8_t Access_Permissions;
+} aci_gatt_set_access_permission_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_set_access_permission_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_store_db_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Number_of_Handles;
+ Handle_Entry_t Handle_Entry[(BLE_CMD_MAX_PARAM_LEN - 3)/sizeof(Handle_Entry_t)];
+} aci_gatt_send_mult_notification_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_send_mult_notification_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Number_of_Handles;
+ Handle_Entry_t Handle_Entry[(BLE_CMD_MAX_PARAM_LEN - 3)/sizeof(Handle_Entry_t)];
+} aci_gatt_read_multiple_var_char_value_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_gatt_read_multiple_var_char_value_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Conn_Interval_Min;
+ uint16_t Conn_Interval_Max;
+ uint16_t Latency;
+ uint16_t Timeout_Multiplier;
+} aci_l2cap_connection_parameter_update_req_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_l2cap_connection_parameter_update_req_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Conn_Interval_Min;
+ uint16_t Conn_Interval_Max;
+ uint16_t Latency;
+ uint16_t Timeout_Multiplier;
+ uint16_t Minimum_CE_Length;
+ uint16_t Maximum_CE_Length;
+ uint8_t Identifier;
+ uint8_t Accept;
+} aci_l2cap_connection_parameter_update_resp_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_l2cap_connection_parameter_update_resp_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t SPSM;
+ uint16_t MTU;
+ uint16_t MPS;
+ uint16_t Initial_Credits;
+ uint8_t Channel_Number;
+} aci_l2cap_coc_connect_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_l2cap_coc_connect_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t MTU;
+ uint16_t MPS;
+ uint16_t Initial_Credits;
+ uint16_t Result;
+ uint8_t Max_Channel_Number;
+} aci_l2cap_coc_connect_confirm_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Channel_Number;
+ uint8_t Channel_Index_List[(BLE_EVT_MAX_PARAM_LEN - 3) - 2];
+} aci_l2cap_coc_connect_confirm_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t MTU;
+ uint16_t MPS;
+ uint8_t Channel_Number;
+ uint8_t Channel_Index_List[BLE_CMD_MAX_PARAM_LEN - 7];
+} aci_l2cap_coc_reconf_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_l2cap_coc_reconf_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Result;
+} aci_l2cap_coc_reconf_confirm_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_l2cap_coc_reconf_confirm_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Channel_Index;
+} aci_l2cap_coc_disconnect_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_l2cap_coc_disconnect_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Channel_Index;
+ uint16_t Credits;
+} aci_l2cap_coc_flow_control_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_l2cap_coc_flow_control_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Channel_Index;
+ uint16_t Length;
+ uint8_t Data[BLE_CMD_MAX_PARAM_LEN - 3];
+} aci_l2cap_coc_tx_data_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_l2cap_coc_tx_data_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Mode;
+ uint32_t Options;
+} aci_reset_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_reset_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint32_t Version[2];
+ uint32_t Options;
+ uint32_t Debug_Info[3];
+} aci_get_information_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Offset;
+ uint8_t Length;
+ uint8_t Value[BLE_CMD_MAX_PARAM_LEN - 2];
+} aci_write_config_data_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+} aci_write_config_data_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Offset;
+} aci_read_config_data_cp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Data_Length;
+ uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 3) - 2];
+} aci_read_config_data_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Connection_Handle;
+ uint8_t Reason;
+} hci_disconnection_complete_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Connection_Handle;
+ uint8_t Encryption_Enabled;
+} hci_encryption_change_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Connection_Handle;
+ uint8_t Version;
+ uint16_t Manufacturer_Name;
+ uint16_t Subversion;
+} hci_read_remote_version_information_complete_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Hardware_Code;
+} hci_hardware_error_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Number_of_Handles;
+ Handle_Packets_Pair_Entry_t Handle_Packets_Pair_Entry[(BLE_EVT_MAX_PARAM_LEN - 1)/sizeof(Handle_Packets_Pair_Entry_t)];
+} hci_number_of_completed_packets_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Connection_Handle;
+} hci_encryption_key_refresh_complete_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Connection_Handle;
+ uint8_t Role;
+ uint8_t Peer_Address_Type;
+ uint8_t Peer_Address[6];
+ uint16_t Conn_Interval;
+ uint16_t Conn_Latency;
+ uint16_t Supervision_Timeout;
+ uint8_t Central_Clock_Accuracy;
+} hci_le_connection_complete_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Num_Reports;
+ Advertising_Report_t Advertising_Report[((BLE_EVT_MAX_PARAM_LEN - 1) - 1)/sizeof(Advertising_Report_t)];
+} hci_le_advertising_report_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Connection_Handle;
+ uint16_t Conn_Interval;
+ uint16_t Conn_Latency;
+ uint16_t Supervision_Timeout;
+} hci_le_connection_update_complete_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Connection_Handle;
+ uint8_t LE_Features[8];
+} hci_le_read_remote_features_page_0_complete_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Random_Number[8];
+ uint16_t Encrypted_Diversifier;
+} hci_le_long_term_key_request_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t MaxTxOctets;
+ uint16_t MaxTxTime;
+ uint16_t MaxRxOctets;
+ uint16_t MaxRxTime;
+} hci_le_data_length_change_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Local_P256_Public_Key[64];
+} hci_le_read_local_p256_public_key_complete_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t DHKey[32];
+} hci_le_generate_dhkey_complete_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Connection_Handle;
+ uint8_t Role;
+ uint8_t Peer_Address_Type;
+ uint8_t Peer_Address[6];
+ uint8_t Local_Resolvable_Private_Address[6];
+ uint8_t Peer_Resolvable_Private_Address[6];
+ uint16_t Conn_Interval;
+ uint16_t Conn_Latency;
+ uint16_t Supervision_Timeout;
+ uint8_t Central_Clock_Accuracy;
+} hci_le_enhanced_connection_complete_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Num_Reports;
+ Direct_Advertising_Report_t Direct_Advertising_Report[((BLE_EVT_MAX_PARAM_LEN - 1) - 1)/sizeof(Direct_Advertising_Report_t)];
+} hci_le_directed_advertising_report_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint16_t Connection_Handle;
+ uint8_t TX_PHY;
+ uint8_t RX_PHY;
+} hci_le_phy_update_complete_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Num_Reports;
+ uint16_t Event_Type;
+ uint8_t Address_Type;
+ uint8_t Address[6];
+ uint8_t Primary_PHY;
+ uint8_t Secondary_PHY;
+ uint8_t Advertising_SID;
+ uint8_t TX_Power;
+ uint8_t RSSI;
+ uint16_t Periodic_Adv_Interval;
+ uint8_t Direct_Address_Type;
+ uint8_t Direct_Address[6];
+ uint8_t Data_Length;
+ uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 1) - 25];
+} hci_le_extended_advertising_report_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Status;
+ uint8_t Advertising_Handle;
+ uint16_t Connection_Handle;
+ uint8_t Num_Completed_Ext_Adv_Events;
+} hci_le_advertising_set_terminated_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Advertising_Handle;
+ uint8_t Scanner_Address_Type;
+ uint8_t Scanner_Address[6];
+} hci_le_scan_request_received_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Channel_Selection_Algorithm;
+} hci_le_channel_selection_algorithm_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Last_State;
+ uint8_t Next_State;
+ uint32_t Next_State_SysTime;
+ uint8_t Last_State_Slot;
+ uint8_t Next_State_Slot;
+} aci_hal_end_of_radio_activity_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t RSSI;
+ uint8_t Peer_Address_Type;
+ uint8_t Peer_Address[6];
+} aci_hal_scan_req_report_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Warning_Type;
+ uint8_t Data_Length;
+ uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 2];
+} aci_warning_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Status;
+ uint8_t Reason;
+} aci_gap_pairing_complete_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} aci_gap_pass_key_req_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} aci_gap_authorization_req_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} aci_gap_bond_lost_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Procedure_Code;
+ uint8_t Status;
+ uint8_t Data_Length;
+ uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 3];
+} aci_gap_proc_complete_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} aci_gap_addr_not_resolved_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint32_t Numeric_Value;
+} aci_gap_numeric_comparison_value_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Notification_Type;
+} aci_gap_keypress_notification_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Bonded;
+ uint8_t Auth_Req;
+} aci_gap_pairing_request_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Result;
+} aci_l2cap_connection_update_resp_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Data_Length;
+ uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 3];
+} aci_l2cap_proc_timeout_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Identifier;
+ uint16_t L2CAP_Length;
+ uint16_t Interval_Min;
+ uint16_t Interval_Max;
+ uint16_t Latency;
+ uint16_t Timeout_Multiplier;
+} aci_l2cap_connection_update_req_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Identifier;
+ uint16_t Reason;
+ uint8_t Data_Length;
+ uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 6];
+} aci_l2cap_command_reject_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t SPSM;
+ uint16_t MTU;
+ uint16_t MPS;
+ uint16_t Initial_Credits;
+ uint8_t Channel_Number;
+} aci_l2cap_coc_connect_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t MTU;
+ uint16_t MPS;
+ uint16_t Initial_Credits;
+ uint16_t Result;
+ uint8_t Channel_Number;
+ uint8_t Channel_Index_List[(BLE_EVT_MAX_PARAM_LEN - 2) - 11];
+} aci_l2cap_coc_connect_confirm_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t MTU;
+ uint16_t MPS;
+ uint8_t Channel_Number;
+ uint8_t Channel_Index_List[(BLE_EVT_MAX_PARAM_LEN - 2) - 7];
+} aci_l2cap_coc_reconf_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Result;
+} aci_l2cap_coc_reconf_confirm_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Channel_Index;
+} aci_l2cap_coc_disconnect_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Channel_Index;
+ uint16_t Credits;
+} aci_l2cap_coc_flow_control_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint8_t Channel_Index;
+ uint16_t Length;
+ uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 3];
+} aci_l2cap_coc_rx_data_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attr_Handle;
+ uint16_t Offset;
+ uint16_t Attr_Data_Length;
+ uint8_t Attr_Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 8];
+} aci_gatt_attribute_modified_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} aci_gatt_proc_timeout_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Server_RX_MTU;
+} aci_att_exchange_mtu_resp_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Format;
+ uint8_t Event_Data_Length;
+ uint8_t Handle_UUID_Pair[(BLE_EVT_MAX_PARAM_LEN - 2) - 4];
+} aci_att_find_info_resp_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Num_of_Handle_Pair;
+ Attribute_Group_Handle_Pair_t Attribute_Group_Handle_Pair[((BLE_EVT_MAX_PARAM_LEN - 2) - 3)/sizeof(Attribute_Group_Handle_Pair_t)];
+} aci_att_find_by_type_value_resp_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Handle_Value_Pair_Length;
+ uint8_t Data_Length;
+ uint8_t Handle_Value_Pair_Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 4];
+} aci_att_read_by_type_resp_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Event_Data_Length;
+ uint8_t Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 3];
+} aci_att_read_resp_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Event_Data_Length;
+ uint8_t Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 3];
+} aci_att_read_blob_resp_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Event_Data_Length;
+ uint8_t Set_Of_Values[(BLE_EVT_MAX_PARAM_LEN - 2) - 3];
+} aci_att_read_multiple_resp_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Attribute_Data_Length;
+ uint8_t Data_Length;
+ uint8_t Attribute_Data_List[(BLE_EVT_MAX_PARAM_LEN - 2) - 4];
+} aci_att_read_by_group_type_resp_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attribute_Handle;
+ uint16_t Offset;
+ uint8_t Part_Attribute_Value_Length;
+ uint8_t Part_Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 7];
+} aci_att_prepare_write_resp_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} aci_att_exec_write_resp_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attribute_Handle;
+ uint8_t Attribute_Value_Length;
+ uint8_t Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 5];
+} aci_gatt_indication_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attribute_Handle;
+ uint8_t Attribute_Value_Length;
+ uint8_t Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 5];
+} aci_gatt_notification_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Error_Code;
+} aci_gatt_proc_complete_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Req_Opcode;
+ uint16_t Attribute_Handle;
+ uint8_t Error_Code;
+} aci_gatt_error_resp_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attribute_Handle;
+ uint8_t Attribute_Value_Length;
+ uint8_t Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 5];
+} aci_gatt_disc_read_char_by_uuid_resp_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attribute_Handle;
+ uint8_t Data_Length;
+ uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 5];
+} aci_gatt_write_permit_req_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attribute_Handle;
+ uint16_t Offset;
+} aci_gatt_read_permit_req_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Number_of_Handles;
+ Handle_Item_t Handle_Item[((BLE_EVT_MAX_PARAM_LEN - 2) - 3)/sizeof(Handle_Item_t)];
+} aci_gatt_read_multi_permit_req_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Available_Buffers;
+} aci_gatt_tx_pool_available_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+} aci_gatt_server_confirmation_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attribute_Handle;
+ uint16_t Offset;
+ uint8_t Data_Length;
+ uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 7];
+} aci_gatt_prepare_write_permit_req_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint8_t Channel_Index;
+ uint8_t EAB_State;
+ uint16_t MTU;
+} aci_gatt_eatt_bearer_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Offset;
+ uint16_t Data_Length;
+ uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 6];
+} aci_gatt_mult_notification_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Attr_Handle;
+} aci_gatt_notification_complete_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Offset;
+ uint16_t Event_Data_Length;
+ uint8_t Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 6];
+} aci_gatt_read_ext_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attribute_Handle;
+ uint16_t Offset;
+ uint16_t Attribute_Value_Length;
+ uint8_t Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 8];
+} aci_gatt_indication_ext_event_rp0;
+
+typedef __PACKED_STRUCT
+{
+ uint16_t Connection_Handle;
+ uint16_t Attribute_Handle;
+ uint16_t Offset;
+ uint16_t Attribute_Value_Length;
+ uint8_t Attribute_Value[(BLE_EVT_MAX_PARAM_LEN - 2) - 8];
+} aci_gatt_notification_ext_event_rp0;
+
+
+#endif /* BLE_TYPES_H__ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_vs_codes.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_vs_codes.h
new file mode 100644
index 0000000..9dd46b0
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/auto/ble_vs_codes.h
@@ -0,0 +1,200 @@
+/*****************************************************************************
+ * @file ble_vs_codes.h
+ * @brief STM32WB BLE API (vendor specific event codes)
+ * Auto-generated file: do not edit!
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#ifndef BLE_VS_CODES_H__
+#define BLE_VS_CODES_H__
+
+
+/* Vendor specific codes of ACI General events
+ */
+
+/* ACI_WARNING_EVENT code */
+#define ACI_WARNING_VSEVT_CODE 0x0006U
+
+/* Vendor specific codes of ACI GAP events
+ */
+
+/* ACI_GAP_LIMITED_DISCOVERABLE_EVENT code */
+#define ACI_GAP_LIMITED_DISCOVERABLE_VSEVT_CODE 0x0400U
+
+/* ACI_GAP_PAIRING_COMPLETE_EVENT code */
+#define ACI_GAP_PAIRING_COMPLETE_VSEVT_CODE 0x0401U
+
+/* ACI_GAP_PASS_KEY_REQ_EVENT code */
+#define ACI_GAP_PASS_KEY_REQ_VSEVT_CODE 0x0402U
+
+/* ACI_GAP_AUTHORIZATION_REQ_EVENT code */
+#define ACI_GAP_AUTHORIZATION_REQ_VSEVT_CODE 0x0403U
+
+/* ACI_GAP_BOND_LOST_EVENT code */
+#define ACI_GAP_BOND_LOST_VSEVT_CODE 0x0405U
+
+/* ACI_GAP_PROC_COMPLETE_EVENT code */
+#define ACI_GAP_PROC_COMPLETE_VSEVT_CODE 0x0407U
+
+/* ACI_GAP_ADDR_NOT_RESOLVED_EVENT code */
+#define ACI_GAP_ADDR_NOT_RESOLVED_VSEVT_CODE 0x0408U
+
+/* ACI_GAP_NUMERIC_COMPARISON_VALUE_EVENT code */
+#define ACI_GAP_NUMERIC_COMPARISON_VALUE_VSEVT_CODE 0x0409U
+
+/* ACI_GAP_KEYPRESS_NOTIFICATION_EVENT code */
+#define ACI_GAP_KEYPRESS_NOTIFICATION_VSEVT_CODE 0x040AU
+
+/* ACI_GAP_PAIRING_REQUEST_EVENT code */
+#define ACI_GAP_PAIRING_REQUEST_VSEVT_CODE 0x040BU
+
+/* Vendor specific codes of ACI GATT/ATT events
+ */
+
+/* ACI_GATT_ATTRIBUTE_MODIFIED_EVENT code */
+#define ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE 0x0C01U
+
+/* ACI_GATT_PROC_TIMEOUT_EVENT code */
+#define ACI_GATT_PROC_TIMEOUT_VSEVT_CODE 0x0C02U
+
+/* ACI_ATT_EXCHANGE_MTU_RESP_EVENT code */
+#define ACI_ATT_EXCHANGE_MTU_RESP_VSEVT_CODE 0x0C03U
+
+/* ACI_ATT_FIND_INFO_RESP_EVENT code */
+#define ACI_ATT_FIND_INFO_RESP_VSEVT_CODE 0x0C04U
+
+/* ACI_ATT_FIND_BY_TYPE_VALUE_RESP_EVENT code */
+#define ACI_ATT_FIND_BY_TYPE_VALUE_RESP_VSEVT_CODE 0x0C05U
+
+/* ACI_ATT_READ_BY_TYPE_RESP_EVENT code */
+#define ACI_ATT_READ_BY_TYPE_RESP_VSEVT_CODE 0x0C06U
+
+/* ACI_ATT_READ_RESP_EVENT code */
+#define ACI_ATT_READ_RESP_VSEVT_CODE 0x0C07U
+
+/* ACI_ATT_READ_BLOB_RESP_EVENT code */
+#define ACI_ATT_READ_BLOB_RESP_VSEVT_CODE 0x0C08U
+
+/* ACI_ATT_READ_MULTIPLE_RESP_EVENT code */
+#define ACI_ATT_READ_MULTIPLE_RESP_VSEVT_CODE 0x0C09U
+
+/* ACI_ATT_READ_BY_GROUP_TYPE_RESP_EVENT code */
+#define ACI_ATT_READ_BY_GROUP_TYPE_RESP_VSEVT_CODE 0x0C0AU
+
+/* ACI_ATT_PREPARE_WRITE_RESP_EVENT code */
+#define ACI_ATT_PREPARE_WRITE_RESP_VSEVT_CODE 0x0C0CU
+
+/* ACI_ATT_EXEC_WRITE_RESP_EVENT code */
+#define ACI_ATT_EXEC_WRITE_RESP_VSEVT_CODE 0x0C0DU
+
+/* ACI_GATT_INDICATION_EVENT code */
+#define ACI_GATT_INDICATION_VSEVT_CODE 0x0C0EU
+
+/* ACI_GATT_NOTIFICATION_EVENT code */
+#define ACI_GATT_NOTIFICATION_VSEVT_CODE 0x0C0FU
+
+/* ACI_GATT_PROC_COMPLETE_EVENT code */
+#define ACI_GATT_PROC_COMPLETE_VSEVT_CODE 0x0C10U
+
+/* ACI_GATT_ERROR_RESP_EVENT code */
+#define ACI_GATT_ERROR_RESP_VSEVT_CODE 0x0C11U
+
+/* ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_EVENT code */
+#define ACI_GATT_DISC_READ_CHAR_BY_UUID_RESP_VSEVT_CODE 0x0C12U
+
+/* ACI_GATT_WRITE_PERMIT_REQ_EVENT code */
+#define ACI_GATT_WRITE_PERMIT_REQ_VSEVT_CODE 0x0C13U
+
+/* ACI_GATT_READ_PERMIT_REQ_EVENT code */
+#define ACI_GATT_READ_PERMIT_REQ_VSEVT_CODE 0x0C14U
+
+/* ACI_GATT_READ_MULTI_PERMIT_REQ_EVENT code */
+#define ACI_GATT_READ_MULTI_PERMIT_REQ_VSEVT_CODE 0x0C15U
+
+/* ACI_GATT_TX_POOL_AVAILABLE_EVENT code */
+#define ACI_GATT_TX_POOL_AVAILABLE_VSEVT_CODE 0x0C16U
+
+/* ACI_GATT_SERVER_CONFIRMATION_EVENT code */
+#define ACI_GATT_SERVER_CONFIRMATION_VSEVT_CODE 0x0C17U
+
+/* ACI_GATT_PREPARE_WRITE_PERMIT_REQ_EVENT code */
+#define ACI_GATT_PREPARE_WRITE_PERMIT_REQ_VSEVT_CODE 0x0C18U
+
+/* ACI_GATT_EATT_BEARER_EVENT code */
+#define ACI_GATT_EATT_BEARER_VSEVT_CODE 0x0C19U
+
+/* ACI_GATT_MULT_NOTIFICATION_EVENT code */
+#define ACI_GATT_MULT_NOTIFICATION_VSEVT_CODE 0x0C1AU
+
+/* ACI_GATT_NOTIFICATION_COMPLETE_EVENT code */
+#define ACI_GATT_NOTIFICATION_COMPLETE_VSEVT_CODE 0x0C1BU
+
+/* ACI_GATT_READ_EXT_EVENT code */
+#define ACI_GATT_READ_EXT_VSEVT_CODE 0x0C1DU
+
+/* ACI_GATT_INDICATION_EXT_EVENT code */
+#define ACI_GATT_INDICATION_EXT_VSEVT_CODE 0x0C1EU
+
+/* ACI_GATT_NOTIFICATION_EXT_EVENT code */
+#define ACI_GATT_NOTIFICATION_EXT_VSEVT_CODE 0x0C1FU
+
+/* Vendor specific codes of ACI L2CAP events
+ */
+
+/* ACI_L2CAP_CONNECTION_UPDATE_RESP_EVENT code */
+#define ACI_L2CAP_CONNECTION_UPDATE_RESP_VSEVT_CODE 0x0800U
+
+/* ACI_L2CAP_PROC_TIMEOUT_EVENT code */
+#define ACI_L2CAP_PROC_TIMEOUT_VSEVT_CODE 0x0801U
+
+/* ACI_L2CAP_CONNECTION_UPDATE_REQ_EVENT code */
+#define ACI_L2CAP_CONNECTION_UPDATE_REQ_VSEVT_CODE 0x0802U
+
+/* ACI_L2CAP_COMMAND_REJECT_EVENT code */
+#define ACI_L2CAP_COMMAND_REJECT_VSEVT_CODE 0x080AU
+
+/* ACI_L2CAP_COC_CONNECT_EVENT code */
+#define ACI_L2CAP_COC_CONNECT_VSEVT_CODE 0x0810U
+
+/* ACI_L2CAP_COC_CONNECT_CONFIRM_EVENT code */
+#define ACI_L2CAP_COC_CONNECT_CONFIRM_VSEVT_CODE 0x0811U
+
+/* ACI_L2CAP_COC_RECONF_EVENT code */
+#define ACI_L2CAP_COC_RECONF_VSEVT_CODE 0x0812U
+
+/* ACI_L2CAP_COC_RECONF_CONFIRM_EVENT code */
+#define ACI_L2CAP_COC_RECONF_CONFIRM_VSEVT_CODE 0x0813U
+
+/* ACI_L2CAP_COC_DISCONNECT_EVENT code */
+#define ACI_L2CAP_COC_DISCONNECT_VSEVT_CODE 0x0814U
+
+/* ACI_L2CAP_COC_FLOW_CONTROL_EVENT code */
+#define ACI_L2CAP_COC_FLOW_CONTROL_VSEVT_CODE 0x0815U
+
+/* ACI_L2CAP_COC_RX_DATA_EVENT code */
+#define ACI_L2CAP_COC_RX_DATA_VSEVT_CODE 0x0816U
+
+/* ACI_L2CAP_COC_TX_POOL_AVAILABLE_EVENT code */
+#define ACI_L2CAP_COC_TX_POOL_AVAILABLE_VSEVT_CODE 0x0817U
+
+/* Vendor specific codes of ACI HAL events
+ */
+
+/* ACI_HAL_END_OF_RADIO_ACTIVITY_EVENT code */
+#define ACI_HAL_END_OF_RADIO_ACTIVITY_VSEVT_CODE 0x0004U
+
+/* ACI_HAL_SCAN_REQ_REPORT_EVENT code */
+#define ACI_HAL_SCAN_REQ_REPORT_VSEVT_CODE 0x0005U
+
+
+#endif /* BLE_VS_CODES_H__ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_bufsize.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_bufsize.h
new file mode 100644
index 0000000..a46a9dd
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_bufsize.h
@@ -0,0 +1,182 @@
+/*****************************************************************************
+ * @file ble_bufsize.h
+ *
+ * @brief Definition of BLE stack buffers size
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#ifndef BLE_BUFSIZE_H__
+#define BLE_BUFSIZE_H__
+
+
+/*
+ * BLE_DEFAULT_ATT_MTU: minimum MTU value that GATT must support.
+ */
+#define BLE_DEFAULT_ATT_MTU 23
+
+/*
+ * BLE_DEFAULT_MAX_ATT_SIZE: maximum attribute size.
+ */
+#define BLE_DEFAULT_MAX_ATT_SIZE 512
+
+/*
+ * BLE_PREP_WRITE_X_ATT: compute how many Prepare Write Request are needed to
+ * write a characteristic with size 'max_att' when the used ATT_MTU value is
+ * equal to BLE_DEFAULT_ATT_MTU (23).
+ */
+#define BLE_PREP_WRITE_X_ATT(max_att) \
+ (DIVC(max_att, BLE_DEFAULT_ATT_MTU - 5) * 2)
+
+/*
+ * BLE_DEFAULT_PREP_WRITE_LIST_SIZE: default minimum Prepare Write List size.
+ */
+#define BLE_DEFAULT_PREP_WRITE_LIST_SIZE \
+ BLE_PREP_WRITE_X_ATT(BLE_DEFAULT_MAX_ATT_SIZE)
+
+/*
+ * BLE_MEM_BLOCK_X_MTU: compute how many memory blocks are needed to compose
+ * an ATT packet with ATT_MTU=mtu.
+ */
+#define BLE_MEM_BLOCK_SIZE 32
+
+#if (SLAVE_ONLY != 0) || (BASIC_FEATURES != 0)
+#define BLE_MEM_BLOCK_X_PTX(n_link) 0
+#else
+#define BLE_MEM_BLOCK_X_PTX(n_link) (n_link)
+#endif
+
+#define BLE_MEM_BLOCK_X_TX(mtu) \
+ (DIVC((mtu) + 4U, BLE_MEM_BLOCK_SIZE) + 1)
+
+#define BLE_MEM_BLOCK_X_RX(mtu, n_link) \
+ ((DIVC((mtu) + 4U, BLE_MEM_BLOCK_SIZE) + 2U) * (n_link) + 1)
+
+#define BLE_MEM_BLOCK_X_MTU(mtu, n_link) \
+ (BLE_MEM_BLOCK_X_TX(mtu) + BLE_MEM_BLOCK_X_PTX(n_link) + \
+ BLE_MEM_BLOCK_X_RX(mtu, n_link))
+
+/*
+ * BLE_MBLOCKS_SECURE_CONNECTIONS: minimum number of blocks required for
+ * secure connections
+ */
+#define BLE_MBLOCKS_SECURE_CONNECTIONS 4
+
+/*
+ * BLE_MBLOCKS_CALC: minimum number of buffers needed by the stack.
+ * This is the minimum racomanded value and depends on:
+ * - pw: size of Prepare Write List
+ * - mtu: ATT_MTU size
+ * - n_link: maximum number of simultaneous connections
+ */
+#define BLE_MBLOCKS_CALC(pw, mtu, n_link) \
+ ((pw) + MAX(BLE_MEM_BLOCK_X_MTU(mtu, n_link), \
+ BLE_MBLOCKS_SECURE_CONNECTIONS))
+
+/*
+ * BLE_FIXED_BUFFER_SIZE_BYTES:
+ * A part of the RAM, is dynamically allocated by initializing all the pointers
+ * defined in a global context variable "mem_alloc_ctx_p".
+ * This initialization is made in the Dynamic_allocator functions, which
+ * assign a portion of RAM given by the external application to the above
+ * mentioned "global pointers".
+ *
+ * The size of this Dynamic RAM is made of 2 main components:
+ * - a part that is parameters-dependent (num of links, GATT buffers, ...),
+ * and which value is made explicit by the following macro;
+ * - a part, that may be considered "fixed", i.e. independent from the above
+ * mentioned parameters.
+*/
+#if (BEACON_ONLY != 0)
+#define BLE_FIXED_BUFFER_SIZE_BYTES 4200 /* Beacon only */
+#elif (LL_ONLY_BASIC != 0)
+#define BLE_FIXED_BUFFER_SIZE_BYTES 5960 /* LL only Basic*/
+#elif (LL_ONLY != 0)
+#define BLE_FIXED_BUFFER_SIZE_BYTES 6288 /* LL only Full */
+#elif (SLAVE_ONLY != 0)
+#define BLE_FIXED_BUFFER_SIZE_BYTES 6408 /* Peripheral only */
+#elif (BASIC_FEATURES != 0)
+#define BLE_FIXED_BUFFER_SIZE_BYTES 7184 /* Basic Features */
+#else
+#define BLE_FIXED_BUFFER_SIZE_BYTES 7468 /* Full stack */
+#endif
+
+/*
+ * BLE_PER_LINK_SIZE_BYTES: additional memory size used per link
+ */
+#if (BEACON_ONLY != 0)
+#define BLE_PER_LINK_SIZE_BYTES 76 /* Beacon only */
+#elif (LL_ONLY_BASIC != 0)
+#define BLE_PER_LINK_SIZE_BYTES 244 /* LL only Basic */
+#elif (LL_ONLY != 0)
+#define BLE_PER_LINK_SIZE_BYTES 244 /* LL only Full */
+#elif (SLAVE_ONLY != 0)
+#define BLE_PER_LINK_SIZE_BYTES 392 /* Peripheral only */
+#elif (BASIC_FEATURES != 0)
+#define BLE_PER_LINK_SIZE_BYTES 420 /* Basic Features */
+#else
+#define BLE_PER_LINK_SIZE_BYTES 432 /* Full stack */
+#endif
+
+/*
+ * BLE_TOTAL_BUFFER_SIZE: this macro returns the amount of memory, in bytes,
+ * needed for the storage of data structures (except GATT database elements)
+ * whose size depends on the number of supported connections.
+ *
+ * @param n_link: Maximum number of simultaneous connections that the device
+ * will support. Valid values are from 1 to 8.
+ *
+ * @param mblocks_count: Number of memory blocks allocated for packets.
+ */
+#define BLE_TOTAL_BUFFER_SIZE(n_link, mblocks_count) \
+ (16 + BLE_FIXED_BUFFER_SIZE_BYTES + \
+ (BLE_PER_LINK_SIZE_BYTES * (n_link)) + \
+ ((BLE_MEM_BLOCK_SIZE + 8) * (mblocks_count)))
+
+/*
+ * BLE_EXT_ADV_BUFFER_SIZE
+ * additional memory size used for Extended advertising;
+ * It has to be added to BLE_TOTAL_BUFFER_SIZE() if the Extended advertising
+ * feature is used.
+ *
+ * @param set_nbr: Maximum number of advertising sets.
+ * Valid values are from 1 to 8.
+ *
+ * @param data_len: Maximum size of advertising data.
+ * Valid values are from 31 to 1650.
+ */
+#define BLE_EXT_ADV_BUFFER_SIZE(set_nbr, data_len) \
+ (2512 + ((892 + (DIVC(data_len, 207) * 244)) * (set_nbr)))
+
+/*
+ * BLE_TOTAL_BUFFER_SIZE_GATT: this macro returns the amount of memory,
+ * in bytes, needed for the storage of GATT database elements.
+ *
+ * @param num_gatt_attributes: Maximum number of Attributes (i.e. the number
+ * of characteristic + the number of characteristic values + the number of
+ * descriptors, excluding the services) that can be stored in the GATT
+ * database. Note that certain characteristics and relative descriptors are
+ * added automatically during device initialization so this parameters should
+ * be 9 plus the number of user Attributes
+ *
+ * @param num_gatt_services: Maximum number of Services that can be stored in
+ * the GATT database. Note that the GAP and GATT services are automatically
+ * added so this parameter should be 2 plus the number of user services
+ *
+ * @param att_value_array_size: Size of the storage area for Attribute values.
+ */
+#define BLE_TOTAL_BUFFER_SIZE_GATT(num_gatt_attributes, num_gatt_services, att_value_array_size) \
+ (((((att_value_array_size) - 1) | 3) + 1) + \
+ (40 * (num_gatt_attributes)) + (48 * (num_gatt_services)))
+
+
+#endif /* BLE_BUFSIZE_H__ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_core.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_core.h
new file mode 100644
index 0000000..a0cba9e
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_core.h
@@ -0,0 +1,42 @@
+/*****************************************************************************
+ * @file ble_core.h
+ *
+ * @brief This file contains the definitions for BLE stack
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#ifndef BLE_CORE_H__
+#define BLE_CORE_H__
+
+
+/* BLE standard definitions */
+#include "ble_std.h"
+
+/* BLE stack API definitions */
+#include "ble_defs.h"
+#include "auto/ble_vs_codes.h"
+#include "auto/ble_gap_aci.h"
+#include "auto/ble_gatt_aci.h"
+#include "auto/ble_hal_aci.h"
+#include "auto/ble_hci_le.h"
+#include "auto/ble_l2cap_aci.h"
+#include "auto/ble_events.h"
+
+/* BLE stack buffer size definitions */
+#include "ble_bufsize.h"
+
+/* BLE stack legacy definitions */
+#include "ble_legacy.h"
+
+
+#endif /* BLE_CORE_H__ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_defs.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_defs.h
new file mode 100644
index 0000000..76dc75b
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_defs.h
@@ -0,0 +1,507 @@
+/*****************************************************************************
+ * @file ble_defs.h
+ *
+ * @brief This file contains definitions used for BLE Stack interface.
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#ifndef BLE_DEFS_H__
+#define BLE_DEFS_H__
+
+
+/* ------------------------------------------------------------------------- */
+
+/* Status codes */
+
+/* Returned when the command has completed with success
+ */
+#define BLE_STATUS_SUCCESS 0x00U
+
+/* The remote device in in the Blacklist and the pairing operation it requested
+ * cannot be performed.
+ */
+#define BLE_STATUS_DEV_IN_BLACKLIST 0x59U
+
+/* CSRK not found during validation of an incoming signed packet
+ */
+#define BLE_STATUS_CSRK_NOT_FOUND 0x5AU
+
+/* IRK not found (Currently not used)
+ */
+#define BLE_STATUS_IRK_NOT_FOUND 0x5BU
+
+/* A search for a specific remote device was unsuccessful because no entry
+ * exists either into NVM Database or in volatile database.
+ */
+#define BLE_STATUS_DEV_NOT_FOUND 0x5CU
+
+/* The remote device is not bonded, and no operations related to bonded devices
+ * may be performed (e.g. writing Gatt Client data).
+ */
+#define BLE_STATUS_DEV_NOT_BONDED 0x5EU
+
+/* The attribute handle is invalid.
+ */
+#define BLE_STATUS_INVALID_HANDLE 0x60U
+
+/* There aren't sufficient Attributes handles available for allocation during
+ * creation of Services, Characteristics or Descriptors.
+ */
+#define BLE_STATUS_OUT_OF_HANDLE 0x61U
+
+/* The requested GATT operation is not allowed in this context/status or using
+ * the provided parameters.
+ * This is a specific GATT error, different from generic Not Allowed error,
+ * because it refers to specific GATT specifications/rules.
+ */
+#define BLE_STATUS_INVALID_OPERATION 0x62U
+
+/* The requested operation failed for a temporary lack of resources
+ * (e.g. packet pool or timers), but it may be retried later when resources may
+ * become available (packets or timers may have been released by other
+ * consumers).
+ */
+#define BLE_STATUS_INSUFFICIENT_RESOURCES 0x64U
+
+/* Notification/Indication can't be sent to the requested remote device because
+ * it doesn't satisfy the needed security permission.
+ */
+#define BLE_STATUS_SEC_PERMISSION_ERROR 0x65U
+
+/* The address of the device could not be resolved using the IRK stored\n
+ */
+#define BLE_STATUS_ADDRESS_NOT_RESOLVED 0x70U
+
+/* Returned when no valid slots are available
+ * (e.g. when there are no available state machines).
+ */
+#define BLE_STATUS_NO_VALID_SLOT 0x82U
+
+/* The only slot available is not long enough to satisfy scan window request.
+ */
+#define BLE_STATUS_SCAN_WINDOW_SHORT 0x83U
+
+/* Returned when the maximum requested interval to be allocated is shorter
+ * then the current anchor period and there is no submultiple for the
+ * current anchor period that is between the minimum and the maximum requested
+ * intervals.
+ */
+#define BLE_STATUS_NEW_INTERVAL_FAILED 0x84U
+
+/* Returned when the maximum requested interval to be allocated is greater
+ * than the current anchor period and there is no multiple of the anchor
+ * period that is between the minimum and the maximum requested intervals.
+ */
+#define BLE_STATUS_INTERVAL_TOO_LARGE 0x85U
+
+/* Returned when the current anchor period or a new one can be found that
+ * is compatible to the interval range requested by the new slot but the
+ * maximum available length that can be allocated is less than the minimum
+ * requested slot length.
+ */
+#define BLE_STATUS_LENGTH_FAILED 0x86U
+
+/* The Host failed while performing the requested operation.
+ */
+#define BLE_STATUS_FAILED 0x91U
+
+/* Invalid parameters in Host commands
+ */
+#define BLE_STATUS_INVALID_PARAMS 0x92U
+
+/* The Host is already processing another request received in advance.
+ */
+#define BLE_STATUS_BUSY 0x93U
+
+/* The operation requested cannot be completed immediately by the Host
+ * (usually because of lack of resources).
+ * The operation is generally put on hold by the caller and it's usually
+ * retried on later time.
+ */
+#define BLE_STATUS_PENDING 0x95U
+
+/* The requested operation violates the logic of the called layer/function or
+ * the format of the data to be processed during the operation.
+ */
+#define BLE_STATUS_ERROR 0x97U
+
+/* The requested operation failed because of lack of memory.
+ * Out of memory shall be returned for situations where memory will never
+ * become available again (e.g. ATT database)
+ */
+#define BLE_STATUS_OUT_OF_MEMORY 0x98U
+
+/* Returned when a timeout occurs at BLE application interface
+ */
+#define BLE_STATUS_TIMEOUT 0xFFU
+
+/* ------------------------------------------------------------------------- */
+
+/* BLE stack options (Options)
+ * (ACI_RESET)
+ */
+#define BLE_OPTIONS_LL_ONLY 0x00000001UL
+#define BLE_OPTIONS_NO_SVC_CHANGE_DESC 0x00000002UL
+#define BLE_OPTIONS_DEV_NAME_READ_ONLY 0x00000004UL
+#define BLE_OPTIONS_EXTENDED_ADV 0x00000008UL
+#define BLE_OPTIONS_CS_ALGO_2 0x00000010UL
+#define BLE_OPTIONS_REDUCED_DB_IN_NVM 0x00000020UL
+#define BLE_OPTIONS_GATT_CACHING 0x00000040UL
+#define BLE_OPTIONS_POWER_CLASS_1 0x00000080UL
+#define BLE_OPTIONS_APPEARANCE_WRITABLE 0x00000100UL
+#define BLE_OPTIONS_ENHANCED_ATT 0x00000200UL
+
+/* ------------------------------------------------------------------------- */
+
+/* Characteristic value lengths
+ */
+#define DEVICE_NAME_CHARACTERISTIC_LEN 8
+#define APPEARANCE_CHARACTERISTIC_LEN 2
+#define PERIPHERAL_PRIVACY_CHARACTERISTIC_LEN 1
+#define RECONNECTION_ADDR_CHARACTERISTIC_LEN 6
+#define PERIPHERAL_PREF_CONN_PARAMS_CHARACTERISTIC_LEN 8
+
+/* Adv. lengths
+ */
+#define MAX_ADV_DATA_LEN 31
+#define BD_ADDR_SIZE 6
+
+/* Privacy flag values
+ */
+#define PRIVACY_DISABLED 0x00
+#define PRIVACY_ENABLED 0x02
+
+/* Intervals in terms of 625 micro sec
+ */
+#define DIR_CONN_ADV_INT_MIN 0x190U /* 250 ms */
+#define DIR_CONN_ADV_INT_MAX 0x320U /* 500 ms */
+#define UNDIR_CONN_ADV_INT_MIN 0x800U /* 1.28 s */
+#define UNDIR_CONN_ADV_INT_MAX 0x1000U /* 2.56 s */
+#define LIM_DISC_ADV_INT_MIN 0x190U /* 250 ms */
+#define LIM_DISC_ADV_INT_MAX 0x320U /* 500 ms */
+#define GEN_DISC_ADV_INT_MIN 0x800U /* 1.28 s */
+#define GEN_DISC_ADV_INT_MAX 0x1000U /* 2.56 s */
+
+/* GAP Roles
+ */
+#define GAP_PERIPHERAL_ROLE 0x01U
+#define GAP_BROADCASTER_ROLE 0x02U
+#define GAP_CENTRAL_ROLE 0x04U
+#define GAP_OBSERVER_ROLE 0x08U
+
+/* GAP procedure codes
+ * Procedure codes for ACI_GAP_PROC_COMPLETE_EVENT event
+ * and ACI_GAP_TERMINATE_GAP_PROC command.
+ */
+#define GAP_LIMITED_DISCOVERY_PROC 0x01U
+#define GAP_GENERAL_DISCOVERY_PROC 0x02U
+#define GAP_PERIODIC_ADVERTISING_CONNECTION_PROC 0x04U
+#define GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC 0x08U
+#define GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC 0x10U
+#define GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC 0x20U
+#define GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC 0x40U
+#define GAP_OBSERVATION_PROC 0x80U
+
+/* GAP Address Type
+ */
+#define GAP_PUBLIC_ADDR 0x00U
+#define GAP_STATIC_RANDOM_ADDR 0x01U
+#define GAP_RESOLVABLE_PRIVATE_ADDR 0x02U
+#define GAP_NON_RESOLVABLE_PRIVATE_ADDR 0x03U
+
+/* Bitmap definitions for Mode of ACI_GAP_ADD_DEVICES_TO_LIST
+ */
+#define GAP_ADD_DEV_MODE_RESOLVING_LIST_ONLY 0x00U
+#define GAP_ADD_DEV_MODE_CLEAR 0x01U
+#define GAP_ADD_DEV_MODE_FILTER_ACC_LIST_ONLY 0x02U
+#define GAP_ADD_DEV_MODE_BOTH_LISTS 0x04U
+
+/* ------------------------------------------------------------------------- */
+
+/* IO capabilities
+ * (ACI_GAP_SET_IO_CAPABILITY)
+ */
+#define IO_CAP_DISPLAY_ONLY 0x00U
+#define IO_CAP_DISPLAY_YES_NO 0x01U
+#define IO_CAP_KEYBOARD_ONLY 0x02U
+#define IO_CAP_NO_INPUT_NO_OUTPUT 0x03U
+#define IO_CAP_KEYBOARD_DISPLAY 0x04U
+
+/* Bonding mode
+ * (ACI_GAP_SET_AUTHENTICATION_REQUIREMENT)
+ */
+#define NO_BONDING 0x00U
+#define BONDING 0x01U
+
+/* MITM protection
+ * (ACI_GAP_SET_AUTHENTICATION_REQUIREMENT)
+ */
+#define MITM_PROTECTION_NOT_REQUIRED 0x00U
+#define MITM_PROTECTION_REQUIRED 0x01U
+
+/* LE Secure Connections support
+ * (ACI_GAP_SET_AUTHENTICATION_REQUIREMENT)
+ */
+#define SC_PAIRING_UNSUPPORTED 0x00U
+#define SC_PAIRING_OPTIONAL 0x01U
+#define SC_PAIRING_ONLY 0x02U
+
+/* Keypress notification support
+ * (ACI_GAP_SET_AUTHENTICATION_REQUIREMENT)
+ */
+#define KEYPRESS_NOT_SUPPORTED 0x00U
+#define KEYPRESS_SUPPORTED 0x01U
+
+/* Use fixed pin
+ * (ACI_GAP_SET_AUTHENTICATION_REQUIREMENT)
+ */
+#define USE_FIXED_PIN_FOR_PAIRING_ALLOWED 0x00U
+#define USE_FIXED_PIN_FOR_PAIRING_FORBIDDEN 0x01U
+
+/* Authorization requirements
+ * (ACI_GAP_SET_AUTHORIZATION_REQUIREMENT)
+ */
+#define AUTHORIZATION_NOT_REQUIRED 0x00U
+#define AUTHORIZATION_REQUIRED 0x01U
+
+/* Connection authorization response
+ * (ACI_GAP_AUTHORIZATION_RESP)
+ */
+#define CONNECTION_AUTHORIZED 0x01U
+#define CONNECTION_REJECTED 0x02U
+
+/* SMP pairing status
+ * (ACI_GAP_PAIRING_COMPLETE_EVENT)
+ */
+#define SMP_PAIRING_STATUS_SUCCESS 0x00U
+#define SMP_PAIRING_STATUS_SMP_TIMEOUT 0x01U
+#define SMP_PAIRING_STATUS_PAIRING_FAILED 0x02U
+#define SMP_PAIRING_STATUS_ENCRYPT_FAILED 0x03U
+
+/* SMP pairing failed reason code
+ * (ACI_GAP_PAIRING_COMPLETE_EVENT)
+ */
+#define REASON_PASSKEY_ENTRY_FAILED 0x01U
+#define REASON_OOB_NOT_AVAILABLE 0x02U
+#define REASON_AUTHENTICATION_REQ 0x03U
+#define REASON_CONFIRM_VALUE_FAILED 0x04U
+#define REASON_PAIRING_NOT_SUPPORTED 0x05U
+#define REASON_ENCRYPTION_KEY_SIZE 0x06U
+#define REASON_COMMAND_NOT_SUPPORTED 0x07U
+#define REASON_UNSPECIFIED_REASON 0x08U
+#define REASON_REPEATED_ATTEMPTS 0x09U
+#define REASON_INVALID_PARAMETERS 0x0AU
+#define REASON_DHKEY_CHECK_FAILED 0x0BU
+#define REASON_NUM_COMPARISON_FAILED 0x0CU
+#define REASON_KEY_REJECTED 0x0FU
+#define REASON_BUSY 0x10U
+
+/* Passkey input type detected
+ * (ACI_GAP_PASSKEY_INPUT)
+ */
+#define PASSKEY_ENTRY_STARTED 0x00U
+#define PASSKEY_DIGIT_ENTERED 0x01U
+#define PASSKEY_DIGIT_ERASED 0x02U
+#define PASSKEY_CLEARED 0x03U
+#define PASSKEY_ENTRY_COMPLETED 0x04U
+
+/* Numeric Comparison Confirm Value
+ * (ACI_GAP_NUMERIC_COMPARISON_VALUE_CONFIRM_YESNO)
+ */
+#define NUMERIC_COMPARISON_CONFIRM_NO 0x00U
+#define NUMERIC_COMPARISON_CONFIRM_YES 0x01U
+
+/* OOB Device Type
+ * (ACI_GAP_SET_OOB_DATA)
+ */
+#define OOB_DEVICE_TYPE_LOCAL 0x00U
+#define OOB_DEVICE_TYPE_REMOTE 0x01U
+
+/* OOB Data Type
+ * (ACI_GAP_GET_OOB_DATA, ACI_GAP_SET_OOB_DATA)
+ */
+#define OOB_DATA_TYPE_LP_TK 0x00U
+#define OOB_DATA_TYPE_SC_RANDOM 0x01U
+#define OOB_DATA_TYPE_SC_CONFIRM 0x02U
+
+/* ------------------------------------------------------------------------- */
+
+/* Access permissions for an attribute
+ */
+#define ATTR_NO_ACCESS 0x00U
+#define ATTR_ACCESS_READ_ONLY 0x01U
+#define ATTR_ACCESS_WRITE_REQ_ONLY 0x02U
+#define ATTR_ACCESS_READ_WRITE 0x03U
+#define ATTR_ACCESS_WRITE_WITHOUT_RESPONSE 0x04U
+#define ATTR_ACCESS_SIGNED_WRITE_ALLOWED 0x08U
+#define ATTR_ACCESS_WRITE_ANY 0x0EU
+#define ATTR_ACCESS_ANY 0x0FU
+
+/* Characteristic properties
+ */
+#define CHAR_PROP_NONE 0x00U
+#define CHAR_PROP_BROADCAST 0x01U
+#define CHAR_PROP_READ 0x02U
+#define CHAR_PROP_WRITE_WITHOUT_RESP 0x04U
+#define CHAR_PROP_WRITE 0x08U
+#define CHAR_PROP_NOTIFY 0x10u
+#define CHAR_PROP_INDICATE 0x20U
+#define CHAR_PROP_SIGNED_WRITE 0x40U
+#define CHAR_PROP_EXT 0x80U
+
+/* Security permissions for an attribute
+ */
+#define ATTR_PERMISSION_NONE 0x00U /* No security. */
+#define ATTR_PERMISSION_AUTHEN_READ 0x01U /* Need authentication to read */
+#define ATTR_PERMISSION_AUTHOR_READ 0x02U /* Need authorization to read */
+#define ATTR_PERMISSION_ENCRY_READ 0x04U /* Need encryption to read */
+#define ATTR_PERMISSION_AUTHEN_WRITE 0x08U /* Need authentication to write */
+#define ATTR_PERMISSION_AUTHOR_WRITE 0x10U /* Need authorization to write */
+#define ATTR_PERMISSION_ENCRY_WRITE 0x20U /* Need encryption to write */
+
+/* Type of UUID (16 bit or 128 bit)
+ */
+#define UUID_TYPE_16 0x01U
+#define UUID_TYPE_128 0x02U
+
+/* Type of service (primary or secondary)
+ */
+#define PRIMARY_SERVICE 0x01U
+#define SECONDARY_SERVICE 0x02U
+
+/* Gatt Event Mask
+ * Type of event generated by GATT server
+ * See aci_gatt_add_char.
+ */
+#define GATT_DONT_NOTIFY_EVENTS 0x00U
+#define GATT_NOTIFY_ATTRIBUTE_WRITE 0x01U
+#define GATT_NOTIFY_WRITE_REQ_AND_WAIT_FOR_APPL_RESP 0x02U
+#define GATT_NOTIFY_READ_REQ_AND_WAIT_FOR_APPL_RESP 0x04U
+#define GATT_NOTIFY_NOTIFICATION_COMPLETION 0x08U
+
+/* Type of characteristic length (see ACI_GATT_ADD_CHAR)
+ */
+#define CHAR_VALUE_LEN_CONSTANT 0x00
+#define CHAR_VALUE_LEN_VARIABLE 0x01
+
+/* Encryption key size
+ */
+#define MIN_ENCRY_KEY_SIZE 7
+#define MAX_ENCRY_KEY_SIZE 16
+
+/* Format
+ */
+#define FORMAT_UINT8 0x04U
+#define FORMAT_UINT16 0x06U
+#define FORMAT_SINT16 0x0EU
+#define FORMAT_SINT24 0x0FU
+
+/* Unit
+ */
+#define UNIT_UNITLESS 0x2700
+#define UNIT_TEMP_CELSIUS 0x272F
+#define UNIT_PRESSURE_BAR 0x2780
+
+/* Update_Type definitions for ACI_GATT_UPDATE_CHAR_VALUE_EXT
+ */
+#define GATT_CHAR_UPDATE_LOCAL_ONLY 0x00U
+#define GATT_CHAR_UPDATE_SEND_NOTIFICATION 0x01U
+#define GATT_CHAR_UPDATE_SEND_INDICATION 0x02U
+
+/* ------------------------------------------------------------------------- */
+
+/* Advertising Type
+ */
+#define ADV_IND 0
+#define ADV_DIRECT_IND 1
+#define ADV_SCAN_IND 2
+#define ADV_NONCONN_IND 3
+#define ADV_DIRECT_IND_LDC 4
+#define SCAN_RSP 4
+
+/* Advertising channels
+ */
+#define ADV_CH_37 0x01
+#define ADV_CH_38 0x02
+#define ADV_CH_39 0x04
+
+/* ------------------------------------------------------------------------- */
+
+/* Definitions for Radio_Activity_Mask
+ * (ACI_HAL_SET_RADIO_ACTIVITY_MASK)
+ */
+#define RADIO_ACT_MASK_IDLE 0x0001U
+#define RADIO_ACT_MASK_ADVERTISING 0x0002U
+#define RADIO_ACT_MASK_PERIPH_CONNECT 0x0004U
+#define RADIO_ACT_MASK_SCANNING 0x0008U
+#define RADIO_ACT_MASK_CENTR_CONNECT 0x0020U
+#define RADIO_ACT_MASK_TX_TEST 0x0040U
+#define RADIO_ACT_MASK_RX_TEST 0x0080U
+#define RADIO_ACT_MASK_PERIOD_ADVERTISING 0x0200U
+#define RADIO_ACT_MASK_PERIOD_SYNC 0x0400U
+#define RADIO_ACT_MASK_ISO_BROADCAST 0x0800U
+#define RADIO_ACT_MASK_ISO_SYNC 0x1000U
+#define RADIO_ACT_MASK_ISO_PERIPH_CONNECT 0x2000U
+#define RADIO_ACT_MASK_ISO_CENTR_CONNECT 0x4000U
+
+/* ------------------------------------------------------------------------- */
+
+/* Definitions for Warning_Type
+ * (ACI_WARNING_EVENT)
+ */
+#define WARNING_L2CAP_RECOMBINATION_FAILURE 0x01U
+#define WARNING_GATT_UNEXPECTED_PEER_MESSAGE 0x02U
+#define WARNING_NVM_ALMOST_FULL 0x03U
+#define WARNING_COC_RX_DATA_LENGTH_TOO_LARGE 0x04U
+#define WARNING_COC_ALREADY_ASSIGNED_DCID 0x05U
+#define WARNING_SMP_UNEXPECTED_LTK_REQUEST 0x06U
+#define WARNING_GATT_BEARER_NOT_ALLOCATED 0x07U
+
+/* ------------------------------------------------------------------------- */
+
+/* Offset for configuration values (see ACI_HAL_WRITE_CONFIG_DATA)
+ */
+#define CONFIG_DATA_PUBLIC_ADDRESS_OFFSET 0x00U
+#define CONFIG_DATA_ER_OFFSET 0x08U
+#define CONFIG_DATA_IR_OFFSET 0x18U
+#define CONFIG_DATA_RANDOM_ADDRESS_OFFSET 0x2EU
+#define CONFIG_DATA_GAP_ADD_REC_NBR_OFFSET 0x34U
+#define CONFIG_DATA_SC_KEY_TYPE_OFFSET 0x35U
+#define CONFIG_DATA_SMP_MODE_OFFSET 0xB0U
+#define CONFIG_DATA_LL_SCAN_CHAN_MAP_OFFSET 0xC0U
+#define CONFIG_DATA_LL_BG_SCAN_MODE_OFFSET 0xC1U
+#define CONFIG_DATA_LL_RSSI_GOLDEN_RANGE_OFFSET 0xC2U
+#define CONFIG_DATA_LL_RPA_MODE_OFFSET 0xC3U
+#define CONFIG_DATA_LL_RX_ACL_CTRL_OFFSET 0xC4U
+#define CONFIG_DATA_LL_MAX_DATA_EXT_OFFSET 0xD1U
+
+/* Length for configuration values (see ACI_HAL_WRITE_CONFIG_DATA)
+ */
+#define CONFIG_DATA_PUBLIC_ADDRESS_LEN 6
+#define CONFIG_DATA_ER_LEN 16
+#define CONFIG_DATA_IR_LEN 16
+#define CONFIG_DATA_RANDOM_ADDRESS_LEN 6
+#define CONFIG_DATA_GAP_ADD_REC_NBR_LEN 1
+#define CONFIG_DATA_SC_KEY_TYPE_LEN 1
+#define CONFIG_DATA_SMP_MODE_LEN 1
+#define CONFIG_DATA_LL_SCAN_CHAN_MAP_LEN 1
+#define CONFIG_DATA_LL_BG_SCAN_MODE_LEN 1
+#define CONFIG_DATA_LL_RSSI_GOLDEN_RANGE_LEN 2
+#define CONFIG_DATA_LL_RPA_MODE_LEN 1
+#define CONFIG_DATA_LL_RX_ACL_CTRL_LEN 2
+#define CONFIG_DATA_LL_MAX_DATA_EXT_LEN 8
+
+/* ------------------------------------------------------------------------- */
+
+
+#endif /* BLE_DEFS_H__ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_legacy.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_legacy.h
new file mode 100644
index 0000000..3b197b8
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_legacy.h
@@ -0,0 +1,282 @@
+/*****************************************************************************
+ * @file ble_legacy.h
+ *
+ * @brief This file contains legacy definitions used for BLE.
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#ifndef BLE_LEGACY_H__
+#define BLE_LEGACY_H__
+
+
+/* Various obsolete definitions
+ */
+
+#define PERIPHERAL_PRIVACY_FLAG_UUID 0x2A02U
+#define RECONNECTION_ADDR_UUID 0x2A03U
+
+#define OOB_AUTH_DATA_ABSENT 0x00U
+#define OOB_AUTH_DATA_PRESENT 0x01U
+
+#define BLE_STATUS_SEC_DB_FULL 0x5DU
+#define BLE_STATUS_INSUFFICIENT_ENC_KEYSIZE 0x5FU
+#define BLE_STATUS_CHARAC_ALREADY_EXISTS 0x63U
+
+#define GAP_NAME_DISCOVERY_PROC 0x04U
+
+/* Deprecated names for ACI/HCI commands and events
+ */
+
+#define hci_le_read_local_supported_features \
+ hci_le_read_local_supported_features_page_0
+#define hci_le_read_remote_features \
+ hci_le_read_remote_features_page_0
+
+#define aci_gap_configure_whitelist \
+ aci_gap_configure_filter_accept_list
+#define aci_gap_slave_security_req \
+ aci_gap_peripheral_security_req
+#define aci_hal_set_slave_latency \
+ aci_hal_set_peripheral_latency
+#define aci_gap_slave_security_initiated_event \
+ aci_gap_peripheral_security_initiated_event
+
+typedef __PACKED_STRUCT
+{
+ /**
+ * Identity address type
+ * Values:
+ * - 0x00: Public Identity Address
+ * - 0x01: Random (static) Identity Address
+ */
+ uint8_t Peer_Identity_Address_Type;
+ /**
+ * Public or Random (static) Identity Address of the peer device
+ */
+ uint8_t Peer_Identity_Address[6];
+} Identity_Entry_t;
+
+#define Whitelist_Entry_t \
+ Peer_Entry_t
+#define Whitelist_Identity_Entry_t \
+ Identity_Entry_t
+
+#define HCI_LE_READ_REMOTE_FEATURES_COMPLETE_SUBEVT_CODE \
+ HCI_LE_READ_REMOTE_FEATURES_PAGE_0_COMPLETE_SUBEVT_CODE
+
+#define hci_le_read_remote_features_complete_event_rp0 \
+ hci_le_read_remote_features_page_0_complete_event_rp0
+
+#define ACI_GAP_SLAVE_SECURITY_INITIATED_VSEVT_CODE \
+ ACI_GAP_PERIPHERAL_SECURITY_INITIATED_VSEVT_CODE
+
+#define ACI_HAL_FW_ERROR_VSEVT_CODE \
+ ACI_WARNING_VSEVT_CODE
+
+#define ACI_HAL_WARNING_VSEVT_CODE \
+ ACI_WARNING_VSEVT_CODE
+
+typedef __PACKED_STRUCT
+{
+ uint8_t FW_Error_Type;
+ uint8_t Data_Length;
+ uint8_t Data[(BLE_EVT_MAX_PARAM_LEN - 2) - 2];
+} aci_hal_fw_error_event_rp0;
+
+#define aci_hal_warning_event_rp0 \
+ aci_warning_event_rp0
+
+#define aci_hal_warning_event \
+ aci_warning_event
+
+/* Other deprecated names
+ */
+
+#define HCI_ADV_FILTER_WHITELIST_SCAN \
+ HCI_ADV_FILTER_ACC_LIST_USED_FOR_SCAN
+#define HCI_ADV_FILTER_WHITELIST_CONNECT \
+ HCI_ADV_FILTER_ACC_LIST_USED_FOR_CONNECT
+#define HCI_ADV_FILTER_WHITELIST_SCAN_CONNECT \
+ HCI_ADV_FILTER_ACC_LIST_USED_FOR_ALL
+#define NO_WHITE_LIST_USE \
+ HCI_ADV_FILTER_NO
+#define WHITE_LIST_FOR_ONLY_SCAN \
+ HCI_ADV_FILTER_ACC_LIST_USED_FOR_SCAN
+#define WHITE_LIST_FOR_ONLY_CONN \
+ HCI_ADV_FILTER_ACC_LIST_USED_FOR_CONNECT
+#define WHITE_LIST_FOR_ALL \
+ HCI_ADV_FILTER_ACC_LIST_USED_FOR_ALL
+
+#define HCI_SCAN_FILTER_WHITELIST \
+ HCI_SCAN_FILTER_ACC_LIST_USED
+#define HCI_SCAN_FILTER_NO_EVEN_RPA \
+ HCI_SCAN_FILTER_NO_EXT
+#define HCI_SCAN_FILTER_WHITELIST_BUT_RPA \
+ HCI_SCAN_FILTER_ACC_LIST_USED_EXT
+
+#define HCI_INIT_FILTER_WHITELIST \
+ HCI_INIT_FILTER_ACC_LIST_USED
+
+#define AD_TYPE_SLAVE_CONN_INTERVAL \
+ AD_TYPE_PERIPHERAL_CONN_INTERVAL
+
+#define OOB_NOT_AVAILABLE REASON_OOB_NOT_AVAILABLE
+#define AUTH_REQ_CANNOT_BE_MET REASON_AUTHENTICATION_REQ
+#define CONFIRM_VALUE_FAILED REASON_CONFIRM_VALUE_FAILED
+#define PAIRING_NOT_SUPPORTED REASON_PAIRING_NOT_SUPPORTED
+#define INSUFF_ENCRYPTION_KEY_SIZE REASON_ENCRYPTION_KEY_SIZE
+#define CMD_NOT_SUPPORTED REASON_COMMAND_NOT_SUPPORTED
+#define UNSPECIFIED_REASON REASON_UNSPECIFIED_REASON
+#define VERY_EARLY_NEXT_ATTEMPT REASON_REPEATED_ATTEMPTS
+#define SM_INVALID_PARAMS REASON_INVALID_PARAMETERS
+#define SMP_SC_DHKEY_CHECK_FAILED REASON_DHKEY_CHECK_FAILED
+#define SMP_SC_NUMCOMPARISON_FAILED REASON_NUM_COMPARISON_FAILED
+
+#define CONFIG_DATA_PUBADDR_OFFSET CONFIG_DATA_PUBLIC_ADDRESS_OFFSET
+#define CONFIG_DATA_PUBADDR_LEN CONFIG_DATA_PUBLIC_ADDRESS_LEN
+
+#define FW_L2CAP_RECOMBINATION_ERROR 0x01U
+#define FW_GATT_UNEXPECTED_PEER_MESSAGE 0x02U
+#define FW_NVM_LEVEL_WARNING 0x03U
+#define FW_COC_RX_DATA_LENGTH_TOO_LARGE 0x04U
+#define FW_ECOC_CONN_RSP_ALREADY_ASSIGNED_DCID 0x05U
+
+/* Deprecated commands
+ */
+
+/**
+ * @brief ACI_GAP_RESOLVE_PRIVATE_ADDR
+ * This command tries to resolve the address provided with the IRKs present in
+ * its database. If the address is resolved successfully with any one of the
+ * IRKs present in the database, it returns success and also the corresponding
+ * public/static random address stored with the IRK in the database.
+ *
+ * @param Address Address to be resolved
+ * @param[out] Actual_Address The public or static random address of the peer
+ * device, distributed during pairing phase.
+ * @return Value indicating success or error code.
+ */
+__STATIC_INLINE
+tBleStatus aci_gap_resolve_private_addr( const uint8_t* Address,
+ uint8_t* Actual_Address )
+{
+ uint8_t type;
+ return aci_gap_check_bonded_device( 1, Address, &type, Actual_Address );
+}
+
+/**
+ * @brief ACI_GAP_IS_DEVICE_BONDED
+ * The command finds whether the device, whose address is specified in the
+ * command, is present in the bonding table. If the device is found, the
+ * command returns "Success".
+ * Note: the specified address can be a RPA. In this case, even if privacy is
+ * not enabled, this address is resolved to check the presence of the peer
+ * device in the bonding table.
+ *
+ * @param Peer_Address_Type The address type of the peer device.
+ * Values:
+ * - 0x00: Public Device Address
+ * - 0x01: Random Device Address
+ * @param Peer_Address Public Device Address or Random Device Address of the
+ * peer device
+ * @return Value indicating success or error code.
+ */
+__STATIC_INLINE
+tBleStatus aci_gap_is_device_bonded( uint8_t Peer_Address_Type,
+ const uint8_t* Peer_Address )
+{
+ uint8_t type, address[6];
+ return aci_gap_check_bonded_device( Peer_Address_Type, Peer_Address,
+ &type, address );
+}
+
+/**
+ * @brief ACI_GAP_ADD_DEVICES_TO_RESOLVING_LIST
+ * This command is used to add devices to the list of address translations
+ * used to resolve Resolvable Private Addresses in the Controller.
+ *
+ * @param Num_of_Resolving_list_Entries Number of devices that have to be added
+ * to the list.
+ * @param Identity_Entry See @ref Identity_Entry_t
+ * @param Clear_Resolving_List Clear the resolving list
+ * Values:
+ * - 0x00: Do not clear
+ * - 0x01: Clear before adding
+ * @return Value indicating success or error code.
+ */
+__STATIC_INLINE
+tBleStatus aci_gap_add_devices_to_resolving_list( uint8_t Num_of_Resolving_list_Entries,
+ const Identity_Entry_t* Identity_Entry,
+ uint8_t Clear_Resolving_List )
+{
+ return aci_gap_add_devices_to_list( Num_of_Resolving_list_Entries,
+ (const List_Entry_t*)Identity_Entry,
+ Clear_Resolving_List );
+}
+
+/**
+ * @brief ACI_HAL_GET_FW_BUILD_NUMBER
+ * This command returns the build number associated with the firmware version
+ * currently running
+ *
+ * @param[out] Build_Number Build number of the firmware.
+ * @return Value indicating success or error code.
+ */
+__STATIC_INLINE
+tBleStatus aci_hal_get_fw_build_number( uint16_t* Build_Number )
+{
+ uint32_t version[2], options[1], debug_info[3];
+ tBleStatus status = aci_get_information( version, options, debug_info );
+ *Build_Number = (uint16_t)(version[1] >> 16);
+ return status;
+}
+
+/**
+ * @brief ACI_HAL_GET_PM_DEBUG_INFO
+ * This command is used to retrieve TX, RX and total buffer count allocated for
+ * ACL packets.
+ *
+ * @param[out] Allocated_For_TX MBlocks allocated for TXing
+ * @param[out] Allocated_For_RX MBlocks allocated for RXing
+ * @param[out] Allocated_MBlocks Overall allocated MBlocks
+ * @return Value indicating success or error code.
+ */
+__STATIC_INLINE
+tBleStatus aci_hal_get_pm_debug_info( uint8_t* Allocated_For_TX,
+ uint8_t* Allocated_For_RX,
+ uint8_t* Allocated_MBlocks )
+{
+ uint32_t version[2], options[1], debug_info[3];
+ tBleStatus status = aci_get_information( version, options, debug_info );
+ *Allocated_For_TX = ((uint8_t)(((uint16_t*)debug_info)[2]) +
+ (uint8_t)(((uint16_t*)debug_info)[3]));
+ *Allocated_For_RX = (uint8_t)(((uint16_t*)debug_info)[1]);
+ *Allocated_MBlocks = (*Allocated_For_TX) + (*Allocated_For_RX);
+ return status;
+}
+
+/**
+ * @brief ACI_HAL_STACK_RESET
+ * This command is equivalent to HCI_RESET but ensures the sleep mode is
+ * entered immediately after its completion.
+ *
+ * @return Value indicating success or error code.
+ */
+__STATIC_INLINE
+tBleStatus aci_hal_stack_reset( void )
+{
+ return aci_reset( 0, 0 );
+}
+
+
+#endif /* BLE_LEGACY_H__ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_std.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_std.h
new file mode 100644
index 0000000..a39c233
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/ble_std.h
@@ -0,0 +1,387 @@
+/******************************************************************************
+ * @file ble_std.h
+ *
+ * @brief BLE standard definitions
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#ifndef BLE_STD_H__
+#define BLE_STD_H__
+
+
+/* HCI packet type */
+#define HCI_COMMAND_PKT_TYPE 0x01U
+#define HCI_ACLDATA_PKT_TYPE 0x02U
+#define HCI_EVENT_PKT_TYPE 0x04U
+#define HCI_ISODATA_PKT_TYPE 0x05U
+
+/* HCI packet header size */
+#define HCI_COMMAND_HDR_SIZE 4
+#define HCI_ACLDATA_HDR_SIZE 5
+#define HCI_EVENT_HDR_SIZE 3
+#define HCI_ISODATA_HDR_SIZE 5
+
+/* HCI parameters length */
+#define HCI_COMMAND_MAX_PARAM_LEN 255
+#define HCI_ACLDATA_MAX_DATA_LEN 251 /* LE_ACL_Data_Packet_Length */
+#define HCI_EVENT_MAX_PARAM_LEN 255
+#define HCI_ISODATA_MAX_DATA_LEN 300 /* ISO_Data_Packet_Length */
+
+/* HCI packet maximum size */
+#define HCI_COMMAND_PKT_MAX_SIZE \
+ (HCI_COMMAND_HDR_SIZE + HCI_COMMAND_MAX_PARAM_LEN)
+#define HCI_ACLDATA_PKT_MAX_SIZE \
+ (HCI_ACLDATA_HDR_SIZE + HCI_ACLDATA_MAX_DATA_LEN)
+#define HCI_EVENT_PKT_MAX_SIZE \
+ (HCI_EVENT_HDR_SIZE + HCI_EVENT_MAX_PARAM_LEN)
+#define HCI_ISODATA_PKT_MAX_SIZE \
+ (HCI_ISODATA_HDR_SIZE + HCI_ISODATA_MAX_DATA_LEN)
+
+/* HCI event code */
+#define HCI_DISCONNECTION_COMPLETE_EVT_CODE 0x05U
+#define HCI_ENCRYPTION_CHANGE_EVT_CODE 0x08U
+#define HCI_READ_REMOTE_VERSION_INFORMATION_COMPLETE_EVT_CODE 0x0CU
+#define HCI_COMMAND_COMPLETE_EVT_CODE 0x0EU
+#define HCI_COMMAND_STATUS_EVT_CODE 0x0FU
+#define HCI_HARDWARE_ERROR_EVT_CODE 0x10U
+#define HCI_NUMBER_OF_COMPLETED_PACKETS_EVT_CODE 0x13U
+#define HCI_DATA_BUFFER_OVERFLOW_EVT_CODE 0x1AU
+#define HCI_ENCRYPTION_KEY_REFRESH_COMPLETE_EVT_CODE 0x30U
+#define HCI_LE_META_EVT_CODE 0x3EU
+#define HCI_AUTHENTICATED_PAYLOAD_TIMEOUT_EXPIRED_EVT_CODE 0x57U
+#define HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE 0xFFU
+
+/* HCI LE subevent code */
+#define HCI_LE_CONNECTION_COMPLETE_SUBEVT_CODE 0x01U
+#define HCI_LE_ADVERTISING_REPORT_SUBEVT_CODE 0x02U
+#define HCI_LE_CONNECTION_UPDATE_COMPLETE_SUBEVT_CODE 0x03U
+#define HCI_LE_READ_REMOTE_FEATURES_PAGE_0_COMPLETE_SUBEVT_CODE 0x04U
+#define HCI_LE_LONG_TERM_KEY_REQUEST_SUBEVT_CODE 0x05U
+#define HCI_LE_REMOTE_CONNECTION_PARAMETER_REQUEST_SUBEVT_CODE 0x06U
+#define HCI_LE_DATA_LENGTH_CHANGE_SUBEVT_CODE 0x07U
+#define HCI_LE_READ_LOCAL_P256_PUBLIC_KEY_COMPLETE_SUBEVT_CODE 0x08U
+#define HCI_LE_GENERATE_DHKEY_COMPLETE_SUBEVT_CODE 0x09U
+#define HCI_LE_ENHANCED_CONNECTION_COMPLETE_SUBEVT_CODE 0x0AU
+#define HCI_LE_DIRECTED_ADVERTISING_REPORT_SUBEVT_CODE 0x0BU
+#define HCI_LE_PHY_UPDATE_COMPLETE_SUBEVT_CODE 0x0CU
+#define HCI_LE_EXTENDED_ADVERTISING_REPORT_SUBEVT_CODE 0x0DU
+#define HCI_LE_PERIODIC_ADVERTISING_SYNC_ESTABLISHED_SUBEVT_CODE 0x0EU
+#define HCI_LE_PERIODIC_ADVERTISING_REPORT_SUBEVT_CODE 0x0FU
+#define HCI_LE_PERIODIC_ADVERTISING_SYNC_LOST_SUBEVT_CODE 0x10U
+#define HCI_LE_SCAN_TIMEOUT_SUBEVT_CODE 0x11U
+#define HCI_LE_ADVERTISING_SET_TERMINATED_SUBEVT_CODE 0x12U
+#define HCI_LE_SCAN_REQUEST_RECEIVED_SUBEVT_CODE 0x13U
+#define HCI_LE_CHANNEL_SELECTION_ALGORITHM_SUBEVT_CODE 0x14U
+#define HCI_LE_CONNECTIONLESS_IQ_REPORT_SUBEVT_CODE 0x15U
+#define HCI_LE_CONNECTION_IQ_REPORT_SUBEVT_CODE 0x16U
+#define HCI_LE_CTE_REQUEST_FAILED_SUBEVT_CODE 0x17U
+#define HCI_LE_PERIODIC_ADVERTISING_SYNC_TRANSFER_RECEIVED_SUBEVT_CODE 0x18U
+#define HCI_LE_CIS_ESTABLISHED_SUBEVT_CODE 0x19U
+#define HCI_LE_CIS_REQUEST_SUBEVT_CODE 0x1AU
+#define HCI_LE_CREATE_BIG_COMPLETE_SUBEVT_CODE 0x1BU
+#define HCI_LE_TERMINATE_BIG_COMPLETE_SUBEVT_CODE 0x1CU
+#define HCI_LE_BIG_SYNC_ESTABLISHED_SUBEVT_CODE 0x1DU
+#define HCI_LE_BIG_SYNC_LOST_SUBEVT_CODE 0x1EU
+#define HCI_LE_REQUEST_PEER_SCA_COMPLETE_SUBEVT_CODE 0x1FU
+#define HCI_LE_PATH_LOSS_THRESHOLD_SUBEVT_CODE 0x20U
+#define HCI_LE_TRANSMIT_POWER_REPORTING_SUBEVT_CODE 0x21U
+#define HCI_LE_BIGINFO_ADVERTISING_REPORT_SUBEVT_CODE 0x22U
+#define HCI_LE_SUBRATE_CHANGE_SUBEVT_CODE 0x23U
+#define HCI_LE_PERIODIC_ADVERTISING_SYNC_ESTABLISHED_V2_SUBEVT_CODE 0x24U
+#define HCI_LE_PERIODIC_ADVERTISING_REPORT_V2_SUBEVT_CODE 0x25U
+#define HCI_LE_PERIODIC_ADVERTISING_SYNC_TRANSFER_RECEIVED_V2_SUBEVT_CODE 0x26U
+#define HCI_LE_PERIODIC_ADVERTISING_SUBEVENT_DATA_REQUEST_SUBEVT_CODE 0x27U
+#define HCI_LE_PERIODIC_ADVERTISING_RESPONSE_REPORT_SUBEVT_CODE 0x28U
+#define HCI_LE_ENHANCED_CONNECTION_COMPLETE_V2_SUBEVT_CODE 0x29U
+#define HCI_LE_CIS_ESTABLISHED_V2_SUBEVT_CODE 0x2AU
+#define HCI_LE_READ_ALL_REMOTE_FEATURES_COMPLETE_SUBEVT_CODE 0x2BU
+#define HCI_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMPLETE_SUBEVT_CODE 0x2CU
+#define HCI_LE_CS_READ_REMOTE_FAE_TABLE_COMPLETE_SUBEVT_CODE 0x2DU
+#define HCI_LE_CS_SECURITY_ENABLE_COMPLETE_SUBEVT_CODE 0x2EU
+#define HCI_LE_CS_CONFIG_COMPLETE_SUBEVT_CODE 0x2FU
+#define HCI_LE_CS_PROCEDURE_ENABLE_COMPLETE_SUBEVT_CODE 0x30U
+#define HCI_LE_CS_SUBEVENT_RESULT_SUBEVT_CODE 0x31U
+#define HCI_LE_CS_SUBEVENT_RESULT_CONTINUE_SUBEVT_CODE 0x32U
+#define HCI_LE_CS_TEST_END_COMPLETE_SUBEVT_CODE 0x33U
+#define HCI_LE_MONITORED_ADVERTISERS_REPORT_SUBEVT_CODE 0x34U
+#define HCI_LE_FRAME_SPACE_UPDATE_COMPLETE_SUBEVT_CODE 0x35U
+
+/* HCI error code */
+#define HCI_SUCCESS_ERR_CODE 0x00U
+#define HCI_UNKNOWN_HCI_COMMAND_ERR_CODE 0x01U
+#define HCI_UNKNOWN_CONNECTION_IDENTIFIER_ERR_CODE 0x02U
+#define HCI_HARDWARE_FAILURE_ERR_CODE 0x03U
+#define HCI_AUTHENTICATION_FAILURE_ERR_CODE 0x05U
+#define HCI_PIN_OR_KEY_MISSING_ERR_CODE 0x06U
+#define HCI_MEMORY_CAPACITY_EXCEEDED_ERR_CODE 0x07U
+#define HCI_CONNECTION_TIMEOUT_ERR_CODE 0x08U
+#define HCI_CONNECTION_LIMIT_EXCEEDED_ERR_CODE 0x09U
+#define HCI_CONNECTION_ALREADY_EXISTS_ERR_CODE 0x0BU
+#define HCI_COMMAND_DISALLOWED_ERR_CODE 0x0CU
+#define HCI_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE_ERR_CODE 0x11U
+#define HCI_INVALID_HCI_COMMAND_PARAMETERS_ERR_CODE 0x12U
+#define HCI_REMOTE_USER_TERMINATED_CONNECTION_ERR_CODE 0x13U
+#define HCI_REMOTE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES_ERR_CODE 0x14U
+#define HCI_REMOTE_TERMINATED_CONNECTION_DUE_TO_POWER_OFF_ERR_CODE 0x15U
+#define HCI_CONNECTION_TERMINATED_BY_LOCAL_HOST_ERR_CODE 0x16U
+#define HCI_UNSUPPORTED_REMOTE_FEATURE_ERR_CODE 0x1AU
+#define HCI_INVALID_LL_PARAMETERS_ERR_CODE 0x1EU
+#define HCI_UNSPECIFIED_ERROR_ERR_CODE 0x1FU
+#define HCI_UNSUPPORTED_LL_PARAMETER_VALUE_ERR_CODE 0x20U
+#define HCI_LL_RESPONSE_TIMEOUT_ERR_CODE 0x22U
+#define HCI_LL_PROCEDURE_COLLISION_ERR_CODE 0x23U
+#define HCI_LMP_PDU_NOT_ALLOWED_ERR_CODE 0x24U
+#define HCI_INSTANT_PASSED_ERR_CODE 0x28U
+#define HCI_DIFFERENT_TRANSACTION_COLLISION_ERR_CODE 0x2AU
+#define HCI_PARAMETER_OUT_OF_MANDATORY_RANGE_ERR_CODE 0x30U
+#define HCI_HOST_BUSY_PAIRING_ERR_CODE 0x38U
+#define HCI_CONTROLLER_BUSY_ERR_CODE 0x3AU
+#define HCI_UNACCEPTABLE_CONNECTION_PARAMETERS_ERR_CODE 0x3BU
+#define HCI_ADVERTISING_TIMEOUT_ERR_CODE 0x3CU
+#define HCI_CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE_ERR_CODE 0x3DU
+#define HCI_CONNECTION_FAILED_TO_BE_ESTABLISHED_ERR_CODE 0x3EU
+#define HCI_UNKNOWN_ADVERTISING_IDENTIFIER_ERR_CODE 0x42U
+#define HCI_ADVERTISING_LIMIT_REACHED_ERR_CODE 0x43U
+#define HCI_PACKET_TOO_LONG_ERR_CODE 0x45U
+
+/* HCI_LE_Set_Advertising_Parameters: Advertising_Type */
+#define HCI_ADV_TYPE_ADV_IND 0x00U
+#define HCI_ADV_TYPE_ADV_DIRECT_IND_HDC 0x01U
+#define HCI_ADV_TYPE_ADV_SCAN_IND 0x02U
+#define HCI_ADV_TYPE_ADV_NONCONN_IND 0x03U
+#define HCI_ADV_TYPE_ADV_DIRECT_IND_LDC 0x04U
+
+/* HCI_LE_Set_Advertising_Parameters: Advertising_Filter_Policy */
+#define HCI_ADV_FILTER_NO 0x00U
+#define HCI_ADV_FILTER_ACC_LIST_USED_FOR_SCAN 0x01U
+#define HCI_ADV_FILTER_ACC_LIST_USED_FOR_CONNECT 0x02U
+#define HCI_ADV_FILTER_ACC_LIST_USED_FOR_ALL 0x03U
+
+/* HCI_LE_Set_[Advertising/Scan]_Parameters: Own_Address_Type */
+#define HCI_OWN_ADDR_TYPE_PUBLIC 0x00U
+#define HCI_OWN_ADDR_TYPE_RANDOM 0x01U
+#define HCI_OWN_ADDR_TYPE_RP_OR_PUBLIC 0x02U
+#define HCI_OWN_ADDR_TYPE_RP_OR_RANDOM 0x03U
+
+/* HCI_LE_Set_Scan_Parameters: LE_Scan_Type */
+#define HCI_SCAN_TYPE_PASSIVE 0x00U
+#define HCI_SCAN_TYPE_ACTIVE 0x01U
+
+/* HCI_LE_Set_Scan_Parameters: Scanning_Filter_Policy */
+#define HCI_SCAN_FILTER_NO 0x00U
+#define HCI_SCAN_FILTER_ACC_LIST_USED 0x01U
+#define HCI_SCAN_FILTER_NO_EXT 0x02U
+#define HCI_SCAN_FILTER_ACC_LIST_USED_EXT 0x03U
+
+/* HCI_LE_Create_Connection: Initiator_Filter_Policy */
+#define HCI_INIT_FILTER_NO 0x00U
+#define HCI_INIT_FILTER_ACC_LIST_USED 0x01U
+
+/* HCI_LE_Read_PHY: TX_PHY */
+#define HCI_TX_PHY_LE_1M 0x01U
+#define HCI_TX_PHY_LE_2M 0x02U
+#define HCI_TX_PHY_LE_CODED 0x03U
+
+/* HCI_LE_Read_PHY: RX_PHY */
+#define HCI_RX_PHY_LE_1M 0x01U
+#define HCI_RX_PHY_LE_2M 0x02U
+#define HCI_RX_PHY_LE_CODED 0x03U
+
+/* HCI_LE_Set_PHY: ALL_PHYS */
+#define HCI_ALL_PHYS_TX_NO_PREF 0x01U
+#define HCI_ALL_PHYS_RX_NO_PREF 0x02U
+
+/* HCI_LE_Set_PHY: TX_PHYS */
+#define HCI_TX_PHYS_LE_1M_PREF 0x01U
+#define HCI_TX_PHYS_LE_2M_PREF 0x02U
+#define HCI_TX_PHYS_LE_CODED_PREF 0x04U
+
+/* HCI_LE_Set_PHY: RX_PHYS */
+#define HCI_RX_PHYS_LE_1M_PREF 0x01U
+#define HCI_RX_PHYS_LE_2M_PREF 0x02U
+#define HCI_RX_PHYS_LE_CODED_PREF 0x04U
+
+/* HCI_LE_Set_Extended_Advertising_Parameters: Advertising_Event_Properties */
+#define HCI_ADV_EVENT_PROP_CONNECTABLE 0x0001U
+#define HCI_ADV_EVENT_PROP_SCANNABLE 0x0002U
+#define HCI_ADV_EVENT_PROP_DIRECTED 0x0004U
+#define HCI_ADV_EVENT_PROP_HDC_DIRECTED 0x0008U
+#define HCI_ADV_EVENT_PROP_LEGACY 0x0010U
+#define HCI_ADV_EVENT_PROP_ANONYMOUS 0x0020U
+#define HCI_ADV_EVENT_PROP_TXPOWER_INC 0x0040U
+
+/* HCI_LE_Set_Extended_Advertising_Parameters: Primary_Advertising_PHY */
+#define HCI_PRIMARY_ADV_PHY_LE_1M 0x01U
+#define HCI_PRIMARY_ADV_PHY_LE_CODED 0x03U
+
+/* HCI_LE_Set_Extended_Advertising_Data: Operation */
+#define HCI_SET_ADV_DATA_OPERATION_INTERMEDIATE 0x00U
+#define HCI_SET_ADV_DATA_OPERATION_FIRST 0x01U
+#define HCI_SET_ADV_DATA_OPERATION_LAST 0x02U
+#define HCI_SET_ADV_DATA_OPERATION_COMPLETE 0x03U
+#define HCI_SET_ADV_DATA_OPERATION_UNCHANGED 0x04U
+
+/* HCI_LE_Advertising_Report: Event_Type */
+#define HCI_ADV_EVT_TYPE_ADV_IND 0x00U
+#define HCI_ADV_EVT_TYPE_ADV_DIRECT_IND 0x01U
+#define HCI_ADV_EVT_TYPE_ADV_SCAN_IND 0x02U
+#define HCI_ADV_EVT_TYPE_ADV_NONCONN_IND 0x03U
+#define HCI_ADV_EVT_TYPE_SCAN_RSP 0x04U
+
+/* HCI_LE_Set_Extended_Scan_Parameters: Scanning_PHYs */
+#define HCI_SCANNING_PHYS_LE_1M 0x01U
+#define HCI_SCANNING_PHYS_LE_CODED 0x04U
+
+/* HCI_LE_Extended_Create_Connection: Initiating_PHYs */
+#define HCI_INIT_PHYS_SCAN_CONN_LE_1M 0x01U
+#define HCI_INIT_PHYS_CONN_LE_2M 0x02U
+#define HCI_INIT_PHYS_SCAN_CONN_LE_CODED 0x04U
+
+/* HCI_LE_Receiver_Test/HCI_LE_Transmitter_Test [v2]: PHY */
+#define HCI_TEST_PHY_LE_1M 0x01U
+#define HCI_TEST_PHY_LE_2M 0x02U
+
+/* HCI_LE_Connection_Complete/HCI_LE_Enhanced_Connection_Complete: Role */
+#define HCI_ROLE_CENTRAL 0x00U
+#define HCI_ROLE_PERIPHERAL 0x01U
+
+/* HCI_LE_Set_Privacy_Mode: Privacy_Mode */
+#define HCI_PRIV_MODE_NETWORK 0x00U
+#define HCI_PRIV_MODE_DEVICE 0x01U
+
+/* Bluetooth Core Specification versions
+ */
+#define BLE_CORE_5_2 11
+#define BLE_CORE_5_3 12
+#define BLE_CORE_5_4 13
+#define BLE_CORE_6_0 14
+#define BLE_CORE_6_1 15
+
+/* AD types for advertising data and scan response data
+ */
+#define AD_TYPE_FLAGS 0x01U
+#define AD_TYPE_16_BIT_SERV_UUID 0x02U
+#define AD_TYPE_16_BIT_SERV_UUID_CMPLT_LIST 0x03U
+#define AD_TYPE_32_BIT_SERV_UUID 0x04U
+#define AD_TYPE_32_BIT_SERV_UUID_CMPLT_LIST 0x05U
+#define AD_TYPE_128_BIT_SERV_UUID 0x06U
+#define AD_TYPE_128_BIT_SERV_UUID_CMPLT_LIST 0x07U
+#define AD_TYPE_SHORTENED_LOCAL_NAME 0x08U
+#define AD_TYPE_COMPLETE_LOCAL_NAME 0x09U
+#define AD_TYPE_TX_POWER_LEVEL 0x0AU
+#define AD_TYPE_CLASS_OF_DEVICE 0x0DU
+#define AD_TYPE_SEC_MGR_TK_VALUE 0x10U
+#define AD_TYPE_SEC_MGR_OOB_FLAGS 0x11U
+#define AD_TYPE_PERIPHERAL_CONN_INTERVAL 0x12U
+#define AD_TYPE_SERV_SOLICIT_16_BIT_UUID_LIST 0x14U
+#define AD_TYPE_SERV_SOLICIT_128_BIT_UUID_LIST 0x15U
+#define AD_TYPE_SERVICE_DATA 0x16U
+#define AD_TYPE_APPEARANCE 0x19U
+#define AD_TYPE_ADVERTISING_INTERVAL 0x1AU
+#define AD_TYPE_LE_ROLE 0x1CU
+#define AD_TYPE_SERV_SOLICIT_32_BIT_UUID_LIST 0x1FU
+#define AD_TYPE_URI 0x24U
+#define AD_TYPE_MANUFACTURER_SPECIFIC_DATA 0xFFU
+
+/* Flag bits for Flags AD Type
+ */
+#define FLAG_BIT_LE_LIMITED_DISCOVERABLE_MODE 0x01U
+#define FLAG_BIT_LE_GENERAL_DISCOVERABLE_MODE 0x02U
+#define FLAG_BIT_BR_EDR_NOT_SUPPORTED 0x04U
+#define FLAG_BIT_LE_BR_EDR_CONTROLLER 0x08U
+#define FLAG_BIT_LE_BR_EDR_HOST 0x10U
+
+/* Appearance values
+ */
+#define GAP_APPEARANCE_UNKNOWN 0x0000
+#define GAP_APPEARANCE_GENERIC_PHONE 0x0040
+#define GAP_APPEARANCE_GENERIC_COMPUTER 0x0080
+#define GAP_APPEARANCE_GENERIC_WATCH 0x00C0
+#define GAP_APPEARANCE_WATCH_SPORT_WATCH 0x00C1
+#define GAP_APPEARANCE_GENERIC_CLOCK 0x0100
+#define GAP_APPEARANCE_GENERIC_DISPLAY 0x0140
+#define GAP_APPEARANCE_GENERIC_REMOTE_CONTROL 0x0180
+#define GAP_APPEARANCE_GENERIC_EYE_GLASSES 0x01C0
+#define GAP_APPEARANCE_GENERIC_TAG 0x0200
+#define GAP_APPEARANCE_GENERIC_KEYRING 0x0240
+#define GAP_APPEARANCE_GENERIC_MEDIA_PLAYER 0x0280
+#define GAP_APPEARANCE_GENERIC_BARCODE_SCANNER 0x02C0
+#define GAP_APPEARANCE_GENERIC_THERMOMETER 0x0300
+#define GAP_APPEARANCE_THERMOMETER_EAR 0x0301
+#define GAP_APPEARANCE_GENERIC_HEART_RATE_SENSOR 0x0340
+#define GAP_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT 0x0341
+#define GAP_APPEARANCE_GENERIC_BLOOD_PRESSURE 0x0380
+#define GAP_APPEARANCE_BLOOD_PRESSURE_ARM 0x0381
+#define GAP_APPEARANCE_BLOOD_PRESSURE_WRIST 0x0382
+#define GAP_APPEARANCE_HUMAN_INTERFACE_DEVICE 0x03C0
+#define GAP_APPEARANCE_KEYBOARD 0x03C1
+#define GAP_APPEARANCE_MOUSE 0x03C2
+#define GAP_APPEARANCE_JOYSTICK 0x03C3
+#define GAP_APPEARANCE_GAMEPAD 0x03C4
+#define GAP_APPEARANCE_DIGITIZER_TABLET 0x03C5
+#define GAP_APPEARANCE_CARD_READER 0x03C6
+#define GAP_APPEARANCE_DIGITAL_PEN 0x03C7
+#define GAP_APPEARANCE_BARCODE_SCANNER 0x03C8
+#define GAP_APPEARANCE_GENERIC_GLUCOSE_METER 0x0400
+#define GAP_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR 0x0440
+#define GAP_APPEARANCE_RUNNING_WALKING_IN_SHOE 0x0441
+#define GAP_APPEARANCE_RUNNING_WALKING_ON_SHOE 0x0442
+#define GAP_APPEARANCE_RUNNING_WALKING_ON_HIP 0x0443
+#define GAP_APPEARANCE_GENERIC_CYCLING 0x0480
+#define GAP_APPEARANCE_CYCLING_CYCLING_COMPUTER 0x0481
+#define GAP_APPEARANCE_CYCLING_SPEED_SENSOR 0x0482
+#define GAP_APPEARANCE_CYCLING_CADENCE_SENSOR 0x0483
+#define GAP_APPEARANCE_CYCLING_POWER_SENSOR 0x0484
+#define GAP_APPEARANCE_CYCLING_SPEED_AND_CADENCE_SENSOR 0x0485
+#define GAP_APPEARANCE_GENERIC_PULSE_OXYMETER 0x0C40
+#define GAP_APPEARANCE_FINGERTIP 0x0C41
+#define GAP_APPEARANCE_WRIST_WORN 0x0C42
+#define GAP_APPEARANCE_GENERIC_WEIGHT_SCALE 0x0C80
+#define GAP_APPEARANCE_GENERIC_OUTDOOR_SPORT_ACTIVITY 0x1440
+#define GAP_APPEARANCE_LOCATION_DISPLAY_DEVICE 0x1441
+#define GAP_APPEARANCE_LOCATION_AND_NAVIGATION_DISPLAY_DEVICE 0x1442
+#define GAP_APPEARANCE_LOCATION_POD 0x1443
+#define GAP_APPEARANCE_LOCATION_AND_NAVIGATION_POD 0x1444
+#define GAP_APPEARANCE_GENERIC_ENVIRONMENTAL_SENSOR 0x1640
+
+/* GATT UUIDs
+ */
+#define GATT_SERVICE_UUID 0x1801U
+#define PRIMARY_SERVICE_UUID 0x2800U
+#define SECONDARY_SERVICE_UUID 0x2801U
+#define INCLUDE_SERVICE_UUID 0x2802U
+#define CHARACTERISTIC_UUID 0x2803U
+#define CHAR_EXTENDED_PROP_DESC_UUID 0x2900U
+#define CHAR_USER_DESC_UUID 0x2901U
+#define CHAR_CLIENT_CONFIG_DESC_UUID 0x2902U
+#define CHAR_SERVER_CONFIG_DESC_UUID 0x2903U
+#define CHAR_FORMAT_DESC_UUID 0x2904U
+#define CHAR_AGGR_FMT_DESC_UUID 0x2905U
+#define SERVICE_CHANGED_UUID 0x2A05U
+#define CLIENT_SUPPORTED_FEATURES_UUID 0X2B29U
+#define DATABASE_HASH_UUID 0X2B2AU
+#define SERVER_SUPPORTED_FEATURES_UUID 0X2B3AU
+
+/* GAP UUIDs
+ */
+#define GAP_SERVICE_UUID 0x1800U
+#define DEVICE_NAME_UUID 0x2A00U
+#define APPEARANCE_UUID 0x2A01U
+#define PERIPHERAL_PREFERRED_CONN_PARAMS_UUID 0x2A04U
+#define CENTRAL_ADDRESS_RESOLUTION_UUID 0x2AA6U
+#define RESOLVABLE_PRIVATE_ADDRESS_ONLY_UUID 0x2AC9U
+#define ENCRYPTED_DATA_KEY_MATERIAL_UUID 0x2B88U
+#define LE_GATT_SECURITY_LEVELS_UUID 0x2BF5U
+
+
+#endif /* BLE_STD_H__ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/template/ble_const.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/template/ble_const.h
new file mode 100644
index 0000000..92baada
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/template/ble_const.h
@@ -0,0 +1,129 @@
+/*****************************************************************************
+ * @file ble_const.h
+ *
+ * @brief This file contains the definitions which are compiler dependent.
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#ifndef BLE_CONST_H__
+#define BLE_CONST_H__
+
+
+#include <stdint.h>
+#include <string.h>
+#include "ble_std.h"
+#include "ble_defs.h"
+#include "osal.h"
+#include "compiler.h"
+
+
+/* Default BLE variant */
+#ifndef BASIC_FEATURES
+#define BASIC_FEATURES 0
+#endif
+#ifndef SLAVE_ONLY
+#define SLAVE_ONLY 0
+#endif
+#ifndef LL_ONLY
+#define LL_ONLY 0
+#endif
+#ifndef LL_ONLY_BASIC
+#define LL_ONLY_BASIC 0
+#endif
+#ifndef BEACON_ONLY
+#define BEACON_ONLY 0
+#endif
+
+/* Defintion to determine BLE Host stack presence */
+#define BLE_HOST_PRESENT (!(LL_ONLY || LL_ONLY_BASIC || BEACON_ONLY))
+
+
+/* Size of command/events buffers:
+ *
+ * To change the size of commands and events parameters used in the
+ * auto-generated files, you need to update 2 defines:
+ *
+ * - BLE_CMD_MAX_PARAM_LEN
+ * - BLE_EVT_MAX_PARAM_LEN
+ *
+ * These 2 defines are set below with default values and can be changed.
+ *
+ * To compute the value to support a characteristic of 512 bytes for a specific
+ * command or an event, you need to look in "ble_types.h".
+ *
+ * Here are 2 examples, one with a command and one with an event:
+ *
+ * - aci_gatt_update_char_value_ext_cp0
+ * ----------------------------------
+ *
+ * we have in the structure:
+ *
+ * uint8_t Value[(BLE_CMD_MAX_PARAM_LEN- 12)/sizeof(uint8_t)];
+ *
+ * so to support a 512 byte value, we need to have
+ *
+ * BLE_CMD_MAX_PARAM_LEN at least equal to: 512 + 12 = 524
+ *
+ * - aci_gatt_read_handle_value_rp0
+ * ------------------------------
+ *
+ * we have in the structure:
+ *
+ * uint8_t Value[((BLE_EVT_MAX_PARAM_LEN - 3) - 5)/sizeof(uint8_t)];
+ *
+ * so to support a 512 byte value, we need to have
+ *
+ * BLE_EVT_MAX_PARAM_LEN at least equal to: 512 + 3 + 5 = 520
+ *
+ * If you need several events or commands with 512-size values, you need to
+ * take the maximum values for BLE_EVT_MAX_PARAM_LEN and BLE_CMD_MAX_PARAM_LEN.
+ *
+ */
+
+/* Maximum parameter size of BLE commands.
+ * Change this value if needed. */
+#define BLE_CMD_MAX_PARAM_LEN HCI_COMMAND_MAX_PARAM_LEN
+
+/* Maximum parameter size of BLE responses/events.
+ * Change this value if needed. */
+#define BLE_EVT_MAX_PARAM_LEN HCI_EVENT_MAX_PARAM_LEN
+
+
+/* Callback function to send command and receive response */
+struct hci_request
+{
+ uint16_t ogf;
+ uint16_t ocf;
+ int event;
+ void* cparam;
+ int clen;
+ void* rparam;
+ int rlen;
+};
+extern int hci_send_req( struct hci_request* req, uint8_t async );
+
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef MIN
+#define MIN( a, b ) (((a) < (b)) ? (a) : (b))
+#endif
+
+#ifndef MAX
+#define MAX( a, b ) (((a) > (b)) ? (a) : (b))
+#endif
+
+
+#endif /* BLE_CONST_H__ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/template/compiler.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/template/compiler.h
new file mode 100644
index 0000000..c147bbb
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/template/compiler.h
@@ -0,0 +1,160 @@
+/*****************************************************************************
+ * @file compiler.h
+ *
+ * @brief This file contains the definitions which are compiler dependent.
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 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 COMPILER_H__
+#define COMPILER_H__
+
+
+#ifndef __PACKED_STRUCT
+#define __PACKED_STRUCT PACKED(struct)
+#endif
+
+#ifndef __PACKED_UNION
+#define __PACKED_UNION PACKED(union)
+#endif
+
+/**
+ * @brief This is the section dedicated to IAR toolchain
+ */
+#if defined(__ICCARM__) || defined(__IAR_SYSTEMS_ASM__)
+
+#ifndef __WEAK
+#define __WEAK __weak
+#endif
+
+#define QUOTE_(a) #a
+
+/**
+ * @brief PACKED
+ * Use the PACKED macro for variables that needs to be packed.
+ * Usage: PACKED(struct) myStruct_s
+ * PACKED(union) myStruct_s
+ */
+#define PACKED(decl) __packed decl
+
+/**
+ * @brief SECTION
+ * Use the SECTION macro to assign data or code in a specific section.
+ * Usage: SECTION(".my_section")
+ */
+#define SECTION(name) _Pragma(QUOTE_(location=name))
+
+/**
+ * @brief ALIGN_DEF
+ * Use the ALIGN_DEF macro to specify the alignment of a variable.
+ * Usage: ALIGN_DEF(4)
+ */
+#define ALIGN_DEF(v) _Pragma(QUOTE_(data_alignment=v))
+
+/**
+ * @brief NO_INIT
+ * Use the NO_INIT macro to declare a not initialized variable.
+ * Usage: NO_INIT(int my_no_init_var)
+ * Usage: NO_INIT(uint16_t my_no_init_array[10])
+ */
+#define NO_INIT(var) __no_init var
+
+/**
+ * @brief This is the section dedicated to GNU toolchain
+ */
+#else
+#ifdef __GNUC__
+
+#ifndef __WEAK
+#define __WEAK __attribute__((weak))
+#endif
+
+/**
+ * @brief PACKED
+ * Use the PACKED macro for variables that needs to be packed.
+ * Usage: PACKED(struct) myStruct_s
+ * PACKED(union) myStruct_s
+ */
+#define PACKED(decl) decl __attribute__((packed))
+
+/**
+ * @brief SECTION
+ * Use the SECTION macro to assign data or code in a specific section.
+ * Usage: SECTION(".my_section")
+ */
+#define SECTION(name) __attribute__((section(name)))
+
+/**
+ * @brief ALIGN_DEF
+ * Use the ALIGN_DEF macro to specify the alignment of a variable.
+ * Usage: ALIGN_DEF(4)
+ */
+#define ALIGN_DEF(N) __attribute__((aligned(N)))
+
+/**
+ * @brief NO_INIT
+ * Use the NO_INIT macro to declare a not initialized variable.
+ * Usage: NO_INIT(int my_no_init_var)
+ * Usage: NO_INIT(uint16_t my_no_init_array[10])
+ */
+#define NO_INIT(var) var __attribute__((section(".noinit")))
+
+/**
+ * @brief This is the section dedicated to Keil toolchain
+ */
+#else
+#ifdef __CC_ARM
+
+#ifndef __WEAK
+#define __WEAK __weak
+#endif
+
+/**
+ * @brief PACKED
+ * Use the PACKED macro for variables that needs to be packed.
+ * Usage: PACKED(struct) myStruct_s
+ * PACKED(union) myStruct_s
+ */
+#define PACKED(decl) decl __attribute__((packed))
+
+/**
+ * @brief SECTION
+ * Use the SECTION macro to assign data or code in a specific section.
+ * Usage: SECTION(".my_section")
+ */
+#define SECTION(name) __attribute__((section(name)))
+
+/**
+ * @brief ALIGN_DEF
+ * Use the ALIGN_DEF macro to specify the alignment of a variable.
+ * Usage: ALIGN_DEF(4)
+ */
+#define ALIGN_DEF(N) __attribute__((aligned(N)))
+
+/**
+ * @brief NO_INIT
+ * Use the NO_INIT macro to declare a not initialized variable.
+ * Usage: NO_INIT(int my_no_init_var)
+ * Usage: NO_INIT(uint16_t my_no_init_array[10])
+ */
+#define NO_INIT(var) var __attribute__((section("NoInit")))
+
+#else
+
+#error Neither ICCARM, CC ARM nor GNUC C detected. Define your macros.
+
+#endif
+#endif
+#endif
+
+
+#endif /* COMPILER_H__ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/template/osal.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/template/osal.c
new file mode 100644
index 0000000..803fae8
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/template/osal.c
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * @file osal.c
+ *
+ * @brief Implements the interface defined in "osal.h" needed by the stack.
+ * Actually, only memset, memcpy and memcmp wrappers are implemented.
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ *****************************************************************************
+ */
+
+#include <string.h>
+#include "osal.h"
+
+
+/**
+ * Osal_MemCpy
+ *
+ */
+
+void* Osal_MemCpy( void *dest, const void *src, unsigned int size )
+{
+ return memcpy( dest, src, size );
+}
+
+/**
+ * Osal_MemSet
+ *
+ */
+
+void* Osal_MemSet( void *ptr, int value, unsigned int size )
+{
+ return memset( ptr, value, size );
+}
+
+/**
+ * Osal_MemCmp
+ *
+ */
+int Osal_MemCmp( const void *s1, const void *s2, unsigned int size )
+{
+ return memcmp( s1, s2, size );
+}
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/template/osal.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/template/osal.h
new file mode 100644
index 0000000..d8485d0
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/core/template/osal.h
@@ -0,0 +1,65 @@
+/*****************************************************************************
+ * @file osal.h
+ *
+ * @brief This header file defines the OS abstraction layer used by
+ * the BLE stack. OSAL defines the set of functions which needs to be
+ * ported to target operating system and target platform.
+ * Actually, only memset, memcpy and memcmp wrappers are defined.
+ *****************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2025 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 OSAL_H__
+#define OSAL_H__
+
+
+/**
+ * This function copies size number of bytes from a
+ * memory location pointed by src to a destination
+ * memory location pointed by dest
+ *
+ * @param[in] dest Destination address
+ * @param[in] src Source address
+ * @param[in] size size in the bytes
+ *
+ * @return Address of the destination
+ */
+
+extern void* Osal_MemCpy( void *dest, const void *src, unsigned int size );
+
+/**
+ * This function sets first number of bytes, specified
+ * by size, to the destination memory pointed by ptr
+ * to the specified value
+ *
+ * @param[in] ptr Destination address
+ * @param[in] value Value to be set
+ * @param[in] size Size in the bytes
+ *
+ * @return Address of the destination
+ */
+
+extern void* Osal_MemSet( void *ptr, int value, unsigned int size );
+
+/**
+ * This function compares n bytes of two regions of memory
+ *
+ * @param[in] s1 First buffer to compare.
+ * @param[in] s2 Second buffer to compare.
+ * @param[in] size Number of bytes to compare.
+ *
+ * @return 0 if the two buffers are equal, 1 otherwise
+ */
+extern int Osal_MemCmp( const void *s1, const void *s2, unsigned int size );
+
+
+#endif /* OSAL_H__ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/bas.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/bas.h
new file mode 100644
index 0000000..34b581c
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/bas.h
@@ -0,0 +1,62 @@
+/**
+ ******************************************************************************
+ * @file bas.h
+ * @author MCD Application Team
+ * @brief Header for bas.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __BAS_H
+#define __BAS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+/* Exported types ------------------------------------------------------------*/
+typedef enum
+{
+ BAS_LEVEL_NOT_ENABLED_EVT,
+ BAS_LEVEL_NOT_DISABLED_EVT,
+ BAS_LEVEL_READ_EVT
+} BAS_Opcode_Notification_evt_t;
+
+typedef struct
+{
+ BAS_Opcode_Notification_evt_t BAS_Evt_Opcode;
+ uint8_t ServiceInstance;
+}BAS_Notification_evt_t;
+
+
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+#define BAS_LEVEL_NOTIFICATION_OPTION 1
+
+
+/* Exported functions ------------------------------------------------------- */
+void BAS_Init(void);
+void BAS_Update_Char(uint16_t UUID, uint8_t service_instance, uint8_t *pPayload);
+void BAS_Notification(BAS_Notification_evt_t * pNotification);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__BAS_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/bls.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/bls.h
new file mode 100644
index 0000000..fa11cee
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/bls.h
@@ -0,0 +1,102 @@
+/**
+ ******************************************************************************
+ * @file bls.h
+ * @author MCD Application Team
+ * @brief Header for bls.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __BLS_H
+#define __BLS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+/* Exported types ------------------------------------------------------------*/
+typedef enum
+{
+ NO_FLAG = 0,
+ VALUE_UNIT_KILO_PASCAL = (1<<0), /*0 -> Blood pressure systolic, diastolic & Mean values in units of mmHg - if 1 -> in units of kPa*/
+ TIME_STAMP_PRESENT = (1<<1),
+ PULSE_RATE_PRESENT = (1<<2),
+ USER_ID_PRESENT = (1<<3),
+ MEASUREMENT_STATUS_PRESENT = (1<<4)
+} BLS_Measurement_Flags_t;
+
+typedef enum
+{
+ BLS_MEASUREMENT_IND_ENABLED_EVT,
+ BLS_MEASUREMENT_IND_DISABLED_EVT,
+#if (BLE_CFG_BLS_INTERMEDIATE_CUFF_PRESSURE != 0)
+ BLS_INTERMEDIATE_CUFF_PRESSURE_NOTIF_ENABLED_EVT,
+ BLS_INTERMEDIATE_CUFF_PRESSURE_NOTIF_DISABLED_EVT,
+#endif
+} BLS_App_Opcode_Notification_evt_t;
+
+typedef struct
+{
+ BLS_App_Opcode_Notification_evt_t BLS_Evt_Opcode;
+}BLS_App_Notification_evt_t;
+
+typedef struct
+{
+ uint16_t Year;
+ uint8_t Month;
+ uint8_t Day;
+ uint8_t Hours;
+ uint8_t Minutes;
+ uint8_t Seconds;
+}BLS_TimeStamp_t;
+
+typedef struct
+{
+ uint16_t MeasurementValue_Systolic;
+ uint16_t MeasurementValue_Diastolic;
+ uint16_t MeasurementValue_Mean;
+#if (BLE_CFG_BLS_TIME_STAMP_FLAG != 0)
+ BLS_TimeStamp_t TimeStamp;
+#endif
+#if (BLE_CFG_BLS_PULSE_RATE_FLAG != 0)
+ uint16_t PulseRate;
+#endif
+#if (BLE_CFG_BLS_USER_ID_FLAG != 0)
+ uint8_t UserID;
+#endif
+#if (BLE_CFG_BLS_MEASUREMENT_STATUS_FLAG != 0)
+ uint16_t MeasurementStatus;
+#endif
+ uint8_t Flags;
+}BLS_Value_t;
+
+
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+void BLS_Init(void);
+void BLS_Update_Char(uint16_t UUID, uint8_t *pPayload);
+void BLS_App_Notification(BLS_App_Notification_evt_t * pNotification);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__BLS_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/crs_stm.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/crs_stm.h
new file mode 100644
index 0000000..9761856
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/crs_stm.h
@@ -0,0 +1,72 @@
+
+/**
+ ******************************************************************************
+ * @file crs_stm.h
+ * @author MCD Application Team
+ * @brief Header for crs_stm.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __STM32XX_CRS_H
+#define __STM32XX_CRS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+/* Exported types ------------------------------------------------------------*/
+typedef enum
+{
+ CRS_NOTIFY_ENABLED_EVT,
+ CRS_NOTIFY_DISABLED_EVT,
+ CRS_READ_EVT,
+ CRS_WRITE_EVT,
+} CRS_Opcode_evt_t;
+
+typedef struct
+{
+ uint8_t * pPayload;
+ uint8_t Length;
+}CRS_Data_t;
+
+typedef struct
+{
+ CRS_Opcode_evt_t CRS_Evt_Opcode;
+ CRS_Data_t DataTransfered;
+ uint16_t ConnectionHandle;
+ uint8_t ServiceInstance;
+}CRS_STM_Notification_evt_t;
+
+
+/* Exported constants --------------------------------------------------------*/
+#define CRS_MAX_DATA_LEN (BLE_DEFAULT_ATT_MTU - 3) /**< Maximum length of data (in bytes) that can be transmitted to the peer. */
+
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+void CRS_STM_Init(void);
+void CRS_STM_Notification(CRS_STM_Notification_evt_t *p_Notification);
+tBleStatus CRS_STM_Update_Char(uint16_t UUID, uint8_t *p_Payload);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__STM32XX_CRS_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/dis.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/dis.h
new file mode 100644
index 0000000..4b430eb
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/dis.h
@@ -0,0 +1,52 @@
+/**
+ ******************************************************************************
+ * @file dis.h
+ * @author MCD Application Team
+ * @brief Header for dis.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __DIS_H
+#define __DIS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+/* Exported types ------------------------------------------------------------*/
+typedef struct
+{
+ uint8_t *pPayload;
+ uint8_t Length;
+}DIS_Data_t;
+
+
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+void DIS_Init(void);
+tBleStatus DIS_UpdateChar(uint16_t uuid, DIS_Data_t *p_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__DIS_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/eds_stm.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/eds_stm.h
new file mode 100644
index 0000000..eee5867
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/eds_stm.h
@@ -0,0 +1,79 @@
+
+/**
+ ******************************************************************************
+ * @file eds_stm.h
+ * @author MCD Application Team
+ * @brief Header for stm32xx_enddevicemanagement.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __EDS_STM_H
+#define __EDS_STM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+
+
+/* Exported types ------------------------------------------------------------*/
+typedef enum
+{
+ EDS_STM_NOTIFY_DISABLED_EVT,
+ EDS_STM_NOTIFY_ENABLED_EVT,
+} EDS_STM_Opcode_evt_t;
+
+typedef struct
+{
+ uint8_t Device1_Status;
+ uint8_t Device2_Status;
+ uint8_t Device3_Status;
+ uint8_t Device4_Status;
+ uint8_t Device5_Status;
+ uint8_t Device6_Status;
+ }EDS_STM_Status_t;
+
+typedef struct
+{
+ uint8_t * pPayload;
+ uint8_t Length;
+}EDS_STM_Data_t;
+
+typedef struct
+{
+ EDS_STM_Opcode_evt_t EDS_Evt_Opcode;
+ EDS_STM_Data_t DataTransfered;
+ uint16_t ConnectionHandle;
+ }EDS_STM_App_Notification_evt_t;
+
+
+
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+void EDS_STM_Init( void );
+void EDS_STM_App_Notification(EDS_STM_App_Notification_evt_t * pNotification);
+tBleStatus EDS_STM_Update_Char(uint16_t UUID, uint8_t *pPayload);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__EDS_STM_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hids.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hids.h
new file mode 100644
index 0000000..02af660
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hids.h
@@ -0,0 +1,79 @@
+/**
+ ******************************************************************************
+ * @file hids.h
+ * @author MCD Application Team
+ * @brief Header for hids.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __HIDS_H
+#define __HIDS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+
+
+/* Exported types ------------------------------------------------------------*/
+typedef enum
+{
+ HIDS_REPORT_NOTIFICATION_ENABLED,
+ HIDS_REPORT_NOTIFICATION_DISABLED,
+ HIDS_KEYB_INPUT_NOTIFY_ENABLED,
+ HIDS_KEYB_INPUT_NOTIFY_DISABLED,
+ HIDS_MOUSE_INPUT_NOTIFY_ENABLED,
+ HIDS_MOUSE_INPUT_NOTIFY_DISABLED,
+ HIDS_OUTPUT_REPORT,
+ HIDS_KEYBOARD_INPUT_REPORT,
+ HIDS_KEYBOARD_OUTPUT_REPORT,
+ HIDS_MOUSE_INPUT_REPORT,
+ HIDS_CONN_HANDLE_EVT,
+ HIDS_DISCON_HANDLE_EVT
+} HIDS_Opcode_Notification_evt_t;
+
+typedef struct
+{
+ HIDS_Opcode_Notification_evt_t HIDS_Evt_Opcode;
+ uint8_t Instance;
+ uint8_t Index;
+ uint8_t ReportLength;
+ uint8_t *pReport;
+} HIDS_App_Notification_evt_t;
+
+
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+void HIDS_Init(void);
+tBleStatus HIDS_Update_Char(uint16_t UUID,
+ uint8_t service_instance,
+ uint8_t Report_Index,
+ uint8_t report_size,
+ uint8_t *pPayload);
+void HIDS_Notification(HIDS_App_Notification_evt_t *pNotification);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__HIDS_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hrs.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hrs.h
new file mode 100644
index 0000000..741951d
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hrs.h
@@ -0,0 +1,99 @@
+/**
+ ******************************************************************************
+ * @file hrs.h
+ * @author MCD Application Team
+ * @brief Header for stm32xx_heartrate.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __HRS_H
+#define __HRS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /* Includes ------------------------------------------------------------------*/
+ /* Exported types ------------------------------------------------------------*/
+ typedef enum
+ {
+ HRS_HRM_VALUE_FORMAT_UINT16 = 1,
+ HRS_HRM_SENSOR_CONTACTS_PRESENT = 2,
+ HRS_HRM_SENSOR_CONTACTS_SUPPORTED = 4,
+ HRS_HRM_ENERGY_EXPENDED_PRESENT = 8,
+ HRS_HRM_RR_INTERVAL_PRESENT = 0x10
+ } HRS_HrmFlags_t;
+
+ typedef enum
+ {
+ HRS_BODY_SENSOR_LOCATION_OTHER = 0,
+ HRS_BODY_SENSOR_LOCATION_CHEST = 1,
+ HRS_BODY_SENSOR_LOCATION_WRIST = 2,
+ HRS_BODY_SENSOR_LOCATION_FINGER = 3,
+ HRS_BODY_SENSOR_LOCATION_HAND = 4,
+ HRS_BODY_SENSOR_LOCATION_EAR_LOBE = 5,
+ HRS_BODY_SENSOR_LOCATION_FOOT = 6
+ } HRS_BodySensorLocation_t;
+
+ typedef enum
+ {
+ HRS_RESET_ENERGY_EXPENDED_EVT,
+ HRS_NOTIFICATION_ENABLED,
+ HRS_NOTIFICATION_DISABLED,
+ HRS_STM_BOOT_REQUEST_EVT,
+ } HRS_NotCode_t;
+
+ typedef struct
+{
+ uint8_t * pPayload;
+ uint8_t Length;
+}HRS_Data_t;
+
+typedef struct
+{
+ HRS_NotCode_t HRS_Evt_Opcode;
+ HRS_Data_t DataTransfered;
+ uint16_t ConnectionHandle;
+ uint8_t ServiceInstance;
+}HRS_App_Notification_evt_t;
+
+ typedef struct{
+ uint16_t MeasurementValue;
+#if (BLE_CFG_HRS_ENERGY_EXPENDED_INFO_FLAG == 1)
+ uint16_t EnergyExpended;
+#endif
+#if (BLE_CFG_HRS_ENERGY_RR_INTERVAL_FLAG != 0)
+ uint16_t aRRIntervalValues[BLE_CFG_HRS_ENERGY_RR_INTERVAL_FLAG + BLE_CFG_HRS_ENERGY_EXPENDED_INFO_FLAG];
+ uint8_t NbreOfValidRRIntervalValues;
+#endif
+ uint8_t Flags;
+ }HRS_MeasVal_t;
+
+ /* Exported constants --------------------------------------------------------*/
+ /* External variables --------------------------------------------------------*/
+ /* Exported macros -----------------------------------------------------------*/
+ /* Exported functions ------------------------------------------------------- */
+ void HRS_Init(void);
+ tBleStatus HRS_UpdateChar(uint16_t uuid, uint8_t *p_payload);
+ void HRS_Notification(HRS_App_Notification_evt_t *pNotification);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__HRS_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hts.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hts.h
new file mode 100644
index 0000000..b41f188
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hts.h
@@ -0,0 +1,113 @@
+
+/**
+ ******************************************************************************
+ * @file hts.h
+ * @author MCD Application Team
+ * @brief Header for shst.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __HTS_H
+#define __HTS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+
+/* Exported types ------------------------------------------------------------*/
+typedef enum
+{
+ NO_FLAGS = 0,
+ VALUE_UNIT_FAHRENHEIT = (1<<0),
+ SENSOR_TIME_STAMP_PRESENT = (1<<1),
+ SENSOR_TEMPERATURE_TYPE_PRESENT = (1<<2),
+} HTS_TM_Flags_t;
+
+typedef enum
+{
+ TT_Armpit = 1,
+ TT_Body = 2,
+ TT_Ear = 3,
+ TT_Finger = 4,
+ TT_Gastro_intestinal_Tract = 5,
+ TT_Mouth = 6,
+ TT_Rectum = 7,
+ TT_Toe = 8,
+ TT_Tympanum = 9
+} HTS_Temperature_Type_t;
+
+typedef enum
+{
+ HTS_MEASUREMENT_INTERVAL_RECEIVED_EVT,
+ HTS_MEASUREMENT_IND_ENABLED_EVT,
+ HTS_MEASUREMENT_IND_DISABLED_EVT,
+ HTS_MEASUREMENT_INTERVAL_IND_ENABLED_EVT,
+ HTS_MEASUREMENT_INTERVAL_IND_DISABLED_EVT,
+ HTS_INTERMEDIATE_TEMPERATURE_NOT_ENABLED_EVT,
+ HTS_INTERMEDIATE_TEMPERATURE_NOT_DISABLED_EVT,
+} HTS_App_Opcode_Notification_evt_t;
+
+typedef struct
+{
+ HTS_App_Opcode_Notification_evt_t HTS_Evt_Opcode;
+#if (BLE_CFG_HTS_MEASUREMENT_INTERVAL != 0)
+ uint16_t RangeInterval;
+#endif
+}HTS_App_Notification_evt_t;
+
+#if (BLE_CFG_HTS_TIME_STAMP_FLAG != 0)
+typedef struct
+{
+ uint16_t Year;
+ uint8_t Month;
+ uint8_t Day;
+ uint8_t Hours;
+ uint8_t Minutes;
+ uint8_t Seconds;
+}HTS_TimeStamp_t;
+#endif
+
+typedef struct
+{
+ uint32_t MeasurementValue;
+#if (BLE_CFG_HTS_TIME_STAMP_FLAG != 0)
+ HTS_TimeStamp_t TimeStamp;
+#endif
+#if (BLE_CFG_HTS_TEMPERATURE_TYPE_VALUE_STATIC == 0)
+ HTS_Temperature_Type_t TemperatureType;
+#endif
+ uint8_t Flags;
+}HTS_TemperatureValue_t;
+
+
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+void HTS_Init(void);
+tBleStatus HTS_Update_Char(uint16_t UUID,
+ uint8_t *pPayload);
+void HTS_App_Notification(HTS_App_Notification_evt_t * pNotification);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__HTS_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/ias.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/ias.h
new file mode 100644
index 0000000..076af5a
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/ias.h
@@ -0,0 +1,62 @@
+/**
+ ******************************************************************************
+ * @file ias.h
+ * @author MCD Application Team
+ * @brief Header for ias.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __IAS_H
+#define __IAS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/* Includes ------------------------------------------------------------------*/
+
+/* Exported types ------------------------------------------------------------*/
+typedef enum
+{
+ IAS_NO_ALERT_EVT,
+ IAS_MID_ALERT_EVT,
+ IAS_HIGH_ALERT_EVT
+} IAS_App_Opcode_Notification_evt_t;
+
+typedef struct
+{
+ IAS_App_Opcode_Notification_evt_t IAS_Evt_Opcode;
+}IAS_App_Notification_evt_t;
+
+
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+void IAS_Init(void);
+tBleStatus IAS_Update_Char(uint16_t UUID, uint8_t *pPayload);
+void IAS_App_Notification(IAS_App_Notification_evt_t *pNotification);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__IAS_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/lls.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/lls.h
new file mode 100644
index 0000000..244af4d
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/lls.h
@@ -0,0 +1,63 @@
+/**
+ ******************************************************************************
+ * @file lls.h
+ * @author MCD Application Team
+ * @brief Header for lls.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __LLS_H
+#define __LLS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+
+/* Exported types ------------------------------------------------------------*/
+typedef enum
+{
+ LLS_NO_ALERT_EVT,
+ LLS_MID_ALERT_EVT,
+ LLS_HIGH_ALERT_EVT,
+ LLS_DISCONNECT_EVT,
+ LLS_CONNECT_EVT
+} LLS_App_Opcode_Notification_evt_t;
+
+typedef struct
+{
+ LLS_App_Opcode_Notification_evt_t LLS_Evt_Opcode;
+}LLS_App_Notification_evt_t;
+
+
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+void LLS_Init(void);
+tBleStatus LLS_Update_Char(uint16_t UUID, uint8_t *pPayload);
+void LLS_App_Notification(LLS_App_Notification_evt_t *pNotification);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__LLS_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/mesh.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/mesh.h
new file mode 100644
index 0000000..03a1cad
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/mesh.h
@@ -0,0 +1,43 @@
+/**
+ ******************************************************************************
+ * @file mesh.h
+ * @author MCD Application Team
+ * @brief Header for mesh.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __MESH_H
+#define __MESH_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /* Includes ------------------------------------------------------------------*/
+ /* Exported types ------------------------------------------------------------*/
+ /* Exported constants --------------------------------------------------------*/
+ /* External variables --------------------------------------------------------*/
+ /* Exported macros -----------------------------------------------------------*/
+ /* Exported functions ------------------------------------------------------- */
+ void MESH_Init(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__MESH_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/motenv_stm.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/motenv_stm.h
new file mode 100644
index 0000000..df9f1b3
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/motenv_stm.h
@@ -0,0 +1,177 @@
+
+/**
+ ******************************************************************************
+ * @file motenv_stm.h
+ * @author SRA/AST
+ * @brief Header for motenv_stm.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-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.
+ *
+ ******************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef MOTENV_STM_H
+#define MOTENV_STM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+
+/* Exported types ------------------------------------------------------------*/
+/**
+ * @brief MOTENV Event Opcode definition
+ */
+typedef enum
+{
+ /* HW Service Chars related events */
+ HW_MOTION_NOTIFY_ENABLED_EVT,
+ HW_MOTION_NOTIFY_DISABLED_EVT,
+ HW_ENV_NOTIFY_ENABLED_EVT,
+ HW_ENV_NOTIFY_DISABLED_EVT,
+ HW_ENV_READ_EVT,
+ HW_ACC_EVENT_NOTIFY_ENABLED_EVT,
+ HW_ACC_EVENT_NOTIFY_DISABLED_EVT,
+ HW_ACC_EVENT_READ_EVT,
+ HW_TOF_NOTIFY_ENABLED_EVT,
+ HW_TOF_NOTIFY_DISABLED_EVT,
+ HW_TOF_WRITE_EVT,
+ /* SW Service Chars related events */
+ SW_MOTIONFX_NOTIFY_ENABLED_EVT,
+ SW_MOTIONFX_NOTIFY_DISABLED_EVT,
+ SW_ECOMPASS_NOTIFY_ENABLED_EVT,
+ SW_ECOMPASS_NOTIFY_DISABLED_EVT,
+ SW_ACTIVITY_REC_NOTIFY_ENABLED_EVT,
+ SW_ACTIVITY_REC_NOTIFY_DISABLED_EVT,
+ SW_ACTIVITY_REC_READ_EVT,
+ SW_CARRY_POSITION_NOTIFY_ENABLED_EVT,
+ SW_CARRY_POSITION_NOTIFY_DISABLED_EVT,
+ SW_CARRY_POSITION_READ_EVT,
+ SW_GESTURE_REC_NOTIFY_ENABLED_EVT,
+ SW_GESTURE_REC_NOTIFY_DISABLED_EVT,
+ SW_GESTURE_REC_READ_EVT,
+ SW_PEDOMETER_NOTIFY_ENABLED_EVT,
+ SW_PEDOMETER_NOTIFY_DISABLED_EVT,
+ SW_PEDOMETER_READ_EVT,
+ SW_INTENSITY_DET_NOTIFY_ENABLED_EVT,
+ SW_INTENSITY_DET_NOTIFY_DISABLED_EVT,
+ MOTENV_STM_BOOT_REQUEST_EVT,
+ /* Config Service Chars related events */
+ CONFIG_NOTIFY_ENABLED_EVT,
+ CONFIG_NOTIFY_DISABLED_EVT,
+ CONFIG_WRITE_EVT,
+ /* Console Service Chars related events */
+ CONSOLE_TERM_NOTIFY_ENABLED_EVT,
+ CONSOLE_TERM_NOTIFY_DISABLED_EVT,
+ CONSOLE_STDERR_NOTIFY_ENABLED_EVT,
+ CONSOLE_STDERR_NOTIFY_DISABLED_EVT,
+ CONSOLE_TERM_READ_EVT,
+ CONSOLE_STDERR_READ_EVT
+} MOTENV_STM_Opcode_evt_t;
+
+/**
+ * @brief MOTENV Event data structure definition
+ */
+typedef struct
+{
+ uint8_t *pPayload;
+ uint8_t Length;
+} MOTENV_STM_Data_t;
+
+/**
+ * @brief MOTENV Notification structure definition
+ */
+typedef struct
+{
+ MOTENV_STM_Opcode_evt_t Motenv_Evt_Opcode;
+ MOTENV_STM_Data_t DataTransfered;
+ uint16_t ConnectionHandle;
+ uint8_t ServiceInstance;
+} MOTENV_STM_App_Notification_evt_t;
+
+
+/* Exported constants --------------------------------------------------------*/
+/* Exported Variables ------------------------------------------------------- */
+extern uint8_t ToF_BoardPresent;
+
+/* Exported macros -----------------------------------------------------------*/
+/**
+ * @brief Motion (Acc-Gyro-Magneto) Char shortened UUID
+ */
+#define MOTION_CHAR_UUID (0xE000)
+/**
+ * @brief Environmental (Temp-Humidity-Pressure) Char shortened UUID
+ */
+#define ENV_CHAR_UUID (0x1D00)
+/**
+ * @brief ToF Char shortened UUID
+ */
+#define TOF_CHAR_UUID (0x0000)
+/**
+ * @brief Acceleration event Char shortened UUID
+ */
+#define ACC_EVENT_CHAR_UUID (0x0004)
+/**
+ * @brief Sensor Fusion Char shortened UUID
+ */
+#define MOTION_FX_CHAR_UUID (0x0100)
+/**
+ * @brief E-Compass event Char shortened UUID
+ */
+#define ECOMPASS_CHAR_UUID (0x0040)
+/**
+ * @brief Activity Recognition Char event Char shortened UUID
+ */
+#define ACTIVITY_REC_CHAR_UUID (0x0010)
+/**
+ * @brief Carry Position event Char shortened UUID
+ */
+#define CARRY_POSITION_CHAR_UUID (0x0008)
+/**
+ * @brief Gesture Recognition event Char shortened UUID
+ */
+#define GESTURE_REC_CHAR_UUID (0x0200)
+/**
+ * @brief Pedometer Char shortened UUID
+ */
+#define PEDOMETER_CHAR_UUID (0x0001)
+/**
+ * @brief Intensity Detection Char shortened UUID
+ */
+#define INTENSITY_DET_CHAR_UUID (0x0020)
+/**
+ * @brief Config Char shortened UUID
+ */
+#define CONFIG_CHAR_UUID (0x0002)
+/**
+ * @brief Console Terminal Char shortened UUID
+ */
+#define CONSOLE_TERM_CHAR_UUID (0x010E)
+/**
+ * @brief Cosnole Stderr Char shortened UUID
+ */
+#define CONSOLE_STDERR_CHAR_UUID (0x020E)
+
+/* Exported functions ------------------------------------------------------- */
+void MOTENV_STM_Init(void);
+void MOTENV_STM_App_Notification(MOTENV_STM_App_Notification_evt_t *pNotification);
+tBleStatus MOTENV_STM_App_Update_Char(uint16_t UUID, uint8_t payloadLen, uint8_t *pPayload);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MOTENV_STM_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/otas_stm.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/otas_stm.h
new file mode 100644
index 0000000..627d593
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/otas_stm.h
@@ -0,0 +1,108 @@
+/**
+ ******************************************************************************
+ * @file otas_stm.h
+ * @author MCD Application Team
+ * @brief Interface to OTA BLE service
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __OTAS_STM_H
+#define __OTAS_STM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /* Includes ------------------------------------------------------------------*/
+#include "stm32_wpan_common.h"
+
+ /* Exported defines -----------------------------------------------------------*/
+#define OTAS_STM_RAW_DATA_SIZE (248)
+
+ /* Exported types ------------------------------------------------------------*/
+ typedef enum
+ {
+ OTAS_STM_BASE_ADDR_ID,
+ OTAS_STM_RAW_DATA_ID,
+ OTAS_STM_CONF_ID,
+ OTAS_STM_CONF_EVENT_ID,
+ } OTAS_STM_ChardId_t;
+
+ typedef enum
+ {
+ OTAS_STM_STOP_ALL_UPLOAD = 0x00,
+ OTAS_STM_WIRELESS_FW_UPLOAD = 0x01,
+ OTAS_STM_APPLICATION_UPLOAD = 0x02,
+ OTAS_STM_UPLOAD_FINISHED = 0x07,
+ OTAS_STM_CANCEL_UPLOAD = 0x08,
+ } OTAS_STM_Command_t;
+
+ typedef enum
+ {
+ OTAS_STM_REBOOT_CONFIRMED = 0x01,
+ } OTAS_STM_Indication_Msg_t;
+
+ typedef struct{
+ uint8_t *pPayload;
+ OTAS_STM_ChardId_t ChardId;
+ uint8_t ValueLength;
+ } OTA_STM_Notification_t;
+
+ typedef PACKED_STRUCT{
+ OTAS_STM_Command_t Command; /**< [0:7] */
+ uint8_t Base_Addr[3]; /**< [8:31] */
+ } OTA_STM_Base_Addr_Event_Format_t;
+
+ typedef PACKED_STRUCT{
+ uint8_t Raw_Data[OTAS_STM_RAW_DATA_SIZE];
+ } OTA_STM_Raw_Data_Event_Format_t;
+
+ typedef PACKED_STRUCT{
+ aci_gatt_server_confirmation_event_rp0 Conf_Event;
+ } OTA_STM_Conf_Event_Format_t;
+
+ typedef PACKED_STRUCT{
+ OTAS_STM_Indication_Msg_t Conf_Msg;
+ } OTA_STM_Conf_Char_Format_t;
+
+ /* Exported constants --------------------------------------------------------*/
+ /* External variables --------------------------------------------------------*/
+ /* Exported macros -----------------------------------------------------------*/
+ /* Exported functions ------------------------------------------------------- */
+ void OTAS_STM_Notification( OTA_STM_Notification_t *p_notification );
+
+ /**
+ * @brief Service initialization
+ * @param None
+ * @retval None
+ */
+ void OTAS_STM_Init(void);
+
+ /**
+ * @brief Characteristic update
+ * @param ChardId: Id of the characteristic to be written
+ * @param p_payload: The new value to be written
+ * @retval Command status
+ */
+ tBleStatus OTAS_STM_UpdateChar(OTAS_STM_ChardId_t ChardId, uint8_t *p_payload);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__OTAS_STM_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/p2p_stm.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/p2p_stm.h
new file mode 100644
index 0000000..11c4606
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/p2p_stm.h
@@ -0,0 +1,73 @@
+
+/**
+ ******************************************************************************
+ * @file p2p_stm.h
+ * @author MCD Application Team
+ * @brief Header for p2p_stm.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __P2PS_STM_H
+#define __P2PS_STM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+
+
+
+/* Exported types ------------------------------------------------------------*/
+typedef enum
+{
+ P2PS_STM__NOTIFY_ENABLED_EVT,
+ P2PS_STM_NOTIFY_DISABLED_EVT,
+ P2PS_STM_READ_EVT,
+ P2PS_STM_WRITE_EVT,
+ P2PS_STM_BOOT_REQUEST_EVT,
+} P2PS_STM_Opcode_evt_t;
+
+typedef struct
+{
+ uint8_t * pPayload;
+ uint8_t Length;
+}P2PS_STM_Data_t;
+
+typedef struct
+{
+ P2PS_STM_Opcode_evt_t P2P_Evt_Opcode;
+ P2PS_STM_Data_t DataTransfered;
+ uint16_t ConnectionHandle;
+ uint8_t ServiceInstance;
+}P2PS_STM_App_Notification_evt_t;
+
+
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+void P2PS_STM_Init( void );
+void P2PS_STM_App_Notification(P2PS_STM_App_Notification_evt_t *pNotification);
+tBleStatus P2PS_STM_App_Update_Char(uint16_t UUID, uint8_t *pPayload);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__P2PS_STM_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/svc_ctl.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/svc_ctl.h
new file mode 100644
index 0000000..01e921d
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/svc_ctl.h
@@ -0,0 +1,171 @@
+
+/**
+ ******************************************************************************
+ * @file svc_ctl.h
+ * @author MCD Application Team
+ * @brief Header for ble_controller.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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.
+ *
+ ******************************************************************************
+ */
+
+
+/**
+ * The BLE Controller supports the application to handle services and clients.
+ * It provides an API to initialize the BLE core Device and a handler mechanism to rout the GATT/GAP events to the
+ * application. When the ble_controller is used (recommended), the application shall register a callback for each
+ * Service and each Client implemented. This is already done with the Services and Clients provided in that delivery.
+ * + A GATT event is relevant to only one Service and/or one Client. When a GATT event is received, it is notified to
+ * the registered handlers to the BLE controller. When no registered handler acknowledges positively the GATT event,
+ * it is reported to the application.
+ * + A GAP event is not relevant to either a Service or a Client. It is sent to the application
+ * + In case the application does not want to take benefit from the ble_controller, it could bypass it. In that case,
+ * the application shall:
+ * - call SVCCTL_Init() to initialize the BLE core device (or implement on its own what is inside that function
+ * - implement TLHCI_UserEvtRx() which is the notification from the HCI layer to report all events (GATT/GAP).
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __SVCCTL_H
+#define __SVCCTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /* Includes ------------------------------------------------------------------*/
+ /* Exported types ------------------------------------------------------------*/
+ typedef enum
+ {
+ SVCCTL_EvtNotAck,
+ SVCCTL_EvtAckFlowEnable,
+ SVCCTL_EvtAckFlowDisable,
+ } SVCCTL_EvtAckStatus_t;
+
+ typedef enum
+ {
+ SVCCTL_UserEvtFlowDisable,
+ SVCCTL_UserEvtFlowEnable,
+ } SVCCTL_UserEvtFlowStatus_t;
+
+ typedef SVCCTL_EvtAckStatus_t (*SVC_CTL_p_EvtHandler_t)(void *p_evt);
+
+ /* Exported constants --------------------------------------------------------*/
+ /* External variables --------------------------------------------------------*/
+ /* Exported macros -----------------------------------------------------------*/
+
+ /* Exported functions ------------------------------------------------------- */
+ /**
+ * @brief It initializes the BLE core Driver and sends some commands to initialize the BLE core device
+ * It shall be called before any BLE operation
+ *
+ * @param None
+ * @retval None
+ */
+ void SVCCTL_Init( void );
+
+ /**
+ * @brief This API registers a handler to be called when a GATT user event is received from the BLE core device. When
+ * a Service is created, it shall register a callback to be notified when a GATT event is received from the
+ * BLE core device. When a GATT event is received, it shall be checked in the handler if the GATT events belongs
+ * to the Service or not. The handler shall return the correct status depending on the result. As soon as one
+ * Service handler registered acknowledges positively the GATT event, the ble_controller stops calling the
+ * registered Service handlers.
+ * This handler is called in the TL_BLE_HCI_UserEvtProc() context
+ *
+ * @param pfBLE_SVC_Service_Event_Handler: This is the Service handler that the ble_controller calls to report a GATT
+ * event received. If the GATT event belongs to that Service, the callback shall return positively with
+ * SVCCTL_EvtAckFlowEnable.
+ * @retval None
+ */
+ void SVCCTL_RegisterSvcHandler( SVC_CTL_p_EvtHandler_t pfBLE_SVC_Service_Event_Handler );
+
+ /**
+ * @brief This API registers a handler to be called when a GATT user event is received from the BLE core device. When
+ * a Client is created, it shall register a callback to be notified when a GATT event is received from the
+ * BLE core device. When a GATT event is received, it shall be checked in the handler if the GATT events belongs
+ * to the Client or not. The handler shall return the correct status depending on the result. As soon as one
+ * Client handler registered acknowledges positively the GATT event, the ble_controller stops calling the
+ * registered Client handlers.
+ * This handler is called in the TL_BLE_HCI_UserEvtProc() context
+ *
+ * @param pfBLE_SVC_Client_Event_Handler: This is the Client handler that the ble_controller calls to report a GATT
+ * event received. If the GATT event belongs to that Client, the callback shall return positively with
+ * SVCCTL_EvtAckFlowEnable.
+ * @retval None
+ */
+ void SVCCTL_RegisterCltHandler( SVC_CTL_p_EvtHandler_t pfBLE_SVC_Client_Event_Handler );
+
+ /**
+ * @brief This API is used to resume the User Event Flow that has been stopped in return of SVCCTL_UserEvtRx()
+ *
+ * @param None
+ * @retval None
+ */
+ void SVCCTL_ResumeUserEventFlow( void );
+
+
+ /**
+ * @brief This callback is triggered when either
+ * + a GAP event is received from the BLE core device.
+ * + a GATT event that has not been positively acknowledged by the registered handler is received from the
+ * BLE core device.
+ * The event is returned in a HCI packet. The full HCI packet is stored in a single buffer and is available when
+ * this callback is triggered. However, an ACI event may be longer than a HCI packet and could be fragmented over
+ * several HCI packets. The HCI layer only handles HCI packets so when an ACI packet is split over several HCI
+ * packets, this callback is triggered for each HCI fragment. It is the responsibility of the application to
+ * reassemble the ACI event.
+ * This callback is triggered in the TL_BLE_HCI_UserEvtProc() context
+ *
+ * @param pckt: The user event received from the BLE core device
+ * @retval None
+ */
+ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification( void *pckt );
+
+ /**
+ * @brief
+ *
+ *
+ * @param pckt: The user event received from the BLE core device
+ * @retval SVCCTL_UserEvtFlowStatus_t: SVCCTL_UserEvtFlowEnable when the packet has been processed
+ * SVCCTL_UserEvtFlowDisable otherwise (the packet is kept in the queue)
+ */
+ SVCCTL_UserEvtFlowStatus_t SVCCTL_UserEvtRx( void *pckt );
+
+ /**
+ * @brief This API may be used by the application when the Service Controller is used to add a custom service
+ *
+ *
+ * @param None
+ * @retval None
+ */
+ void SVCCTL_InitCustomSvc( void );
+
+ /**
+ * @brief This API may be overloaded by the application to select a limited list of ble services to initialize.
+ * It is called by SVCCTL_Init()
+ * By default, SVCCTL_SvcInit() is implemented to initialize all BLE services which are included in the
+ * application at build time
+ * If it is required to initialize only limited part of the BLE service available in the application,
+ * this API may be used to call the initialization API of the subset of needed services at run time.
+ *
+ * @param None
+ * @retval None
+ */
+ void SVCCTL_SvcInit( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__SVCCTL_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/template_stm.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/template_stm.h
new file mode 100644
index 0000000..c7c5c03
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/template_stm.h
@@ -0,0 +1,73 @@
+
+/**
+ ******************************************************************************
+ * @file template_stm.h
+ * @author MCD Application Team
+ * @brief Header for template_stm.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __TEMPLATE_STM_H
+#define __TEMPLATE_STM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+
+
+
+/* Exported types ------------------------------------------------------------*/
+typedef enum
+{
+ TEMPLATE_STM_NOTIFY_ENABLED_EVT,
+ TEMPLATE_STM_NOTIFY_DISABLED_EVT,
+ TEMPLATE_STM_READ_EVT,
+ TEMPLATE_STM_WRITE_EVT,
+ TEMPLATE_STM_BOOT_REQUEST_EVT,
+} TEMPLATE_STM_Opcode_evt_t;
+
+typedef struct
+{
+ uint8_t * pPayload;
+ uint8_t Length;
+}TEMPLATE_STM_Data_t;
+
+typedef struct
+{
+ TEMPLATE_STM_Opcode_evt_t Template_Evt_Opcode;
+ TEMPLATE_STM_Data_t DataTransfered;
+ uint16_t ConnectionHandle;
+ uint8_t ServiceInstance;
+}TEMPLATE_STM_App_Notification_evt_t;
+
+
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+void TEMPLATE_STM_Init( void );
+void TEMPLATE_STM_App_Notification(TEMPLATE_STM_App_Notification_evt_t *pNotification);
+tBleStatus TEMPLATE_STM_App_Update_Char(uint16_t UUID, uint8_t *pPayload);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__TEMPLATE_STM_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/tps.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/tps.h
new file mode 100644
index 0000000..0e0ebea
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/tps.h
@@ -0,0 +1,46 @@
+/**
+ ******************************************************************************
+ * @file tps.h
+ * @author MCD Application Team
+ * @brief Header for tps.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __TPS_H
+#define __TPS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /* Includes ------------------------------------------------------------------*/
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+void TPS_Init(void);
+tBleStatus TPS_Update_Char(uint16_t UUID, uint8_t *pPayload);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__TPS_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/uuid.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/uuid.h
new file mode 100644
index 0000000..0ffb875
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/uuid.h
@@ -0,0 +1,328 @@
+/**
+ ******************************************************************************
+ * @file uuid.h.h
+ * @author MCD Application Team
+ * @brief Header containing the UUIDs of all the services and caharcteristics
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 _UUID_H_
+#define _UUID_H_
+
+/* Descriptor UUIDs */
+#define CHAR_EXTENDED_PROPERTIES_DESCRIPTOR_UUID (0x2900)
+#define CHAR_USER_DESCRIPTION_DESCRIPTOR_UUID (0x2901)
+#define CLIENT_CHAR_CONFIG_DESCRIPTOR_UUID (0x2902)
+#define SERVER_CHAR_CONFIG_DESCRIPTOR_UUID (0x2903)
+#define CHAR_PRESENTATION_FORMAT_DESCRIPTOR_UUID (0x2904)
+#define CHAR_AGGREGATE_FORMAT_DESCRIPTOR_UUID (0x2905)
+#define VALID_RANGE_DESCRIPTOR_UUID (0x2906)
+#define EXTERNAL_REPORT_REFERENCE_DESCRIPTOR_UUID (0x2907)
+#define REPORT_REFERENCE_DESCRIPTOR_UUID (0x2908)
+#define NUMBER_OF_DIGITALS_DESCRIPTOR_UUID (0x2909)
+#define VALUE_TRIGGER_SETTING_DESCRIPTOR_UUID (0x290A)
+#define ES_CONFIGURATION_DESCRIPTOR_UUID (0x290B)
+#define ES_MEASUREMENT_DESCRIPTOR_UUID (0x290C)
+#define ES_TRIGGER_SETTING_DESCRIPTOR_UUID (0x290D)
+#define TIME_TRIGGER_SETTING_DESCRIPTOR_UUID (0x290E)
+
+/* UUIDs of Generic Attribute service */
+#define GENERIC_ATTRIBUTE_SERVICE_UUID (0x1801)
+#define SERVICE_CHANGED_CHARACTERISTIC_UUID (0x2A05)
+
+/* UUIDs of immediate alert service */
+#define IMMEDIATE_ALERT_SERVICE_UUID (0x1802)
+#define ALERT_LEVEL_CHARACTERISTIC_UUID (0x2A06)
+
+/* UUIDs for Link Loss service */
+#define LINK_LOSS_SERVICE_UUID (0x1803)
+#define LINK_LOSS_ALERT_LEVEL_CHARACTERISTIC_UUID (0x2A06)
+
+/* UUIDs for TX Power service */
+#define TX_POWER_SERVICE_UUID (0x1804)
+#define TX_POWER_LEVEL_CHARACTERISTIC_UUID (0x2A07)
+
+/* UUIDs for Time service */
+#define CURRENT_TIME_SERVICE_UUID (0x1805)
+#define CURRENT_TIME_CHAR_UUID (0x2A2B)
+#define LOCAL_TIME_INFORMATION_CHAR_UUID (0x2A0F)
+#define REFERENCE_TIME_INFORMATION_CHAR_UUID (0x2A14)
+
+/* UUIDs for Reference Time Update service */
+#define REFERENCE_UPDATE_TIME_SERVICE_UUID (0x1806)
+#define TIME_UPDATE_CONTROL_POINT_CHAR_UUID (0x2A16)
+#define TIME_UPDATE_STATE_CHAR_UUID (0x2A17)
+
+/* UUIDs for Next DST Change service */
+#define NEXT_DST_CHANGE_SERVICE_UUID (0x1807)
+#define TIME_WITH_DST_CHAR_UUID (0x2A11)
+
+/* UUIDs for glucose profile */
+#define GLUCOSE_SERVICE_UUID (0x1808)
+#define GLUCOSE_MEASUREMENT_CHAR_UUID (0x2A18)
+#define GLUCOSE_MEASUREMENT_CONTEXT_CHAR_UUID (0x2A34)
+#define GLUCOSE_FEATURE_CHAR_UUID (0x2A51)
+/* Record Access Control Point (RACP) */
+#define GLUCOSE_RACP_CHAR_UUID (0x2A52)
+
+/* UUIDs for health thermometer profile */
+#define HEALTH_THERMOMETER_SERVICE_UUID (0x1809)
+#define TEMPERATURE_MEASUREMENT_CHAR_UUID (0x2A1C)
+#define TEMPERATURE_TYPE_CHAR_UUID (0x2A1D)
+#define INTERMEDIATE_TEMPERATURE_CHAR_UUID (0x2A1E)
+#define MEASUREMENT_INTERVAL_CHAR_UUID (0x2A21)
+
+/* UUIDs for Device Information Service */
+#define DEVICE_INFORMATION_SERVICE_UUID (0x180A)
+#define SYSTEM_ID_UUID (0x2A23)
+#define MODEL_NUMBER_UUID (0x2A24)
+#define SERIAL_NUMBER_UUID (0x2A25)
+#define FIRMWARE_REVISION_UUID (0x2A26)
+#define HARDWARE_REVISION_UUID (0x2A27)
+#define SOFTWARE_REVISION_UUID (0x2A28)
+#define MANUFACTURER_NAME_UUID (0x2A29)
+#define IEEE_CERTIFICATION_UUID (0x2A2A)
+#define PNP_ID_UUID (0x2A50)
+
+/* UUIDs for Heart Rate Service */
+#define HEART_RATE_SERVICE_UUID (0x180D)
+#define CLIENT_CHARACTERISTIC_CONFIG_DESCRIPTOR_UUID (0x2902)
+#define HEART_RATE_MEASURMENT_UUID (0x2A37)
+#define SENSOR_LOCATION_UUID (0x2A38)
+#define CONTROL_POINT_UUID (0x2A39)
+
+/* UUIDs for Phone Alert status profile */
+#define PHONE_ALERT_SERVICE_UUID (0x180E)
+#define PHONE_ALERT_STATUS_CHARAC_UUID (0x2A3F)
+#define RINGER_CNTRL_POINT_CHARAC_UUID (0x2A40)
+#define RINGER_SETTING_CHARAC_UUID (0x2A41)
+
+/* UUIDs for battery service */
+#define BATTERY_SERVICE_UUID (0x180F)
+#define BATTERY_LEVEL_CHAR_UUID (0x2A19)
+
+/* UUIDs for Blood Pressure profile */
+#define BLOOD_PRESSURE_SERVICE_UUID (0x1810)
+#define BLOOD_PRESSURE_MEASUREMENT_CHAR_UUID (0x2A35)
+#define INTERMEDIATE_CUFF_PRESSURE_CHAR_UUID (0x2A36)
+#define BLOOD_PRESSURE_FEATURE_CHAR_UUID (0x2A49)
+
+/* UUIDs for alert notification profile */
+#define ALERT_NOTIFICATION_SERVICE_UUID (0x1811)
+#define SUPPORTED_NEW_ALERT_CATEGORY_CHAR_UUID (0x2A47)
+#define NEW_ALERT_CHAR_UUID (0x2A46)
+#define SUPPORTED_UNREAD_ALERT_CATEGORY_CHAR_UUID (0x2A48)
+#define UNREAD_ALERT_STATUS_CHAR_UUID (0x2A45)
+#define ALERT_NOTIFICATION_CONTROL_POINT_CHAR_UUID (0x2A44)
+
+/* UUIDs for human interface device */
+#define HUMAN_INTERFACE_DEVICE_SERVICE_UUID (0x1812)
+#define PROTOCOL_MODE_CHAR_UUID (0x2A4E)
+#define REPORT_CHAR_UUID (0x2A4D)
+#define REPORT_MAP_CHAR_UUID (0x2A4B)
+#define BOOT_KEYBOARD_INPUT_REPORT_CHAR_UUID (0x2A22)
+#define BOOT_KEYBOARD_OUTPUT_REPORT_CHAR_UUID (0x2A32)
+#define BOOT_MOUSE_INPUT_REPORT_CHAR_UUID (0x2A33)
+#define HID_INFORMATION_CHAR_UUID (0x2A4A)
+#define HID_CONTROL_POINT_CHAR_UUID (0x2A4C)
+
+/* UUIDs for scan parameter service */
+#define SCAN_PARAMETER_SERVICE_UUID (0x1813)
+#define SCAN_INTERVAL_WINDOW_CHAR_UUID (0x2A4F)
+#define SCAN_REFRESH_CHAR_UUID (0x2A31)
+
+/* UUIDs for running speed and cadence service */
+#define RUNNING_SPEED_CADENCE_SERVICE_UUID (0x1814)
+#define RUNNING_SPEED_CADENCE_MEASUREMENT_CHAR_UUID (0x2A53)
+#define RUNNING_SPEED_CADENCE_FEATURE_CHAR_UUID (0x2A54)
+
+/* UUIDs for automation IO service */
+#define AUTOMATION_IO_SERVICE_UUID (0x1815)
+#define AUTOMATION_IO_DIGITAL_CHAR_UUID (0x2A56)
+#define AUTOMATION_IO_ANALOG_CHAR_UUID (0x2A58)
+#define AUTOMATION_IO_AGGREGATE_CHAR_UUID (0x2A5A)
+
+/* UUIDs for cycling speed and cadence service */
+#define CYCLING_SPEED_CADENCE_SERVICE_UUID (0x1816)
+#define CYCLING_SPEED_CADENCE_MEASUREMENT_CHAR_UUID (0x2A5B)
+#define CYCLING_SPEED_CADENCE_FEATURE_CHAR_UUID (0x2A5C)
+
+/* UUIDs for cycling power service */
+#define CYCLING_POWER_SERVICE_UUID (0x1818)
+#define CYCLING_POWER_MEASUREMENT_CHAR_UUID (0x2A63)
+#define CYCLING_POWER_FEATURE_CHAR_UUID (0x2A65)
+#define CYCLING_POWER_SENSOR_LOCATION_CHAR_UUID (0x2A5D)
+
+/* UUIDs for location and navigation device */
+#define LOCATION_NAVIGATION_SERVICE_UUID (0x1819)
+#define LN_FEATURE_UUID (0x2A6A)
+#define LOCATION_SPEED_UUID (0x2A67)
+#define POSITION_QUALITY_UUID (0x2A69)
+#define LN_CONTROL_POINT_UUID (0x2A6B)
+#define NAVIGATION_UUID (0x2A68)
+
+/* UUIDs for environmental sensing profile */
+#define ENVIRONMENTAL_SENSING_SERVICE_UUID (0x181A)
+#define DESCRIPTOR_VALUE_CHANGED_UUID (0x2A7D)
+#define APPARENT_WIND_DIRECTION_UUID (0x2A73)
+#define APPARENT_WIND_SPEED_UUID (0x2A72)
+#define DEW_POINT_UUID (0x2A7B)
+#define ELEVATION_UUID (0x2A6C)
+#define GUST_FACTOR_UUID (0x2A74)
+#define HEAT_INDEX_UUID (0x2A7A)
+#define HUMIDITY_UUID (0x2A6F)
+#define IRRADIANCE_UUID (0x2A77)
+#define POLLEN_CONCENTRATION_UUID (0x2A75)
+#define RAINFALL_UUID (0x2A78)
+#define PRESSURE_UUID (0x2A6D)
+#define TEMPERATURE_UUID (0x2A6E)
+#define TRUE_WIND_DIRECTION_UUID (0x2A71)
+#define TRUE_WIND_SPEED_UUID (0x2A70)
+#define UV_INDEX_UUID (0x2A76)
+#define WIND_CHILL_UUID (0x2A79)
+#define BAROMETRIC_PRESSURE_TREND_UUID (0x2AA3)
+#define MAGNETIC_DECLINATION_UUID (0x2A2C)
+#define MAGNETIC_FLUX_DENSITY_2D_UUID (0x2AA0)
+#define MAGNETIC_FLUX_DENSITY_3D_UUID (0x2AA1)
+
+/* UUIDs for body composition service */
+#define BODY_COMPOSITION_SERVICE_UUID (0x181B)
+#define BODY_COMPOSITION_MEASUREMENT_CHAR_UUID (0x2A9C)
+#define BODY_COMPOSITION_FEATURE_CHARAC (0x2A9B)
+
+/* UUIDs for user data service */
+#define USER_DATA_SERVICE_UUID (0x181C)
+#define AERO_HR_LOWER_LIMIT_CHAR_UUID (0x2A7E)
+#define AEROBIC_THRESHOLD_CHAR_UUID (0x2A7F)
+#define AGE_CHAR_UUID (0x2A80)
+#define ANAERO_HR_LOWER_LIMIT_CHAR_UUID (0x2A81)
+#define ANAERO_HR_UPPER_LIMIT_CHAR_UUID (0x2A82)
+#define ANAEROBIC_THRESHOLD_CHAR_UUID (0x2A83)
+#define AERO_HR_UPPER_LIMIT_CHAR_UUID (0x2A84)
+#define BIRTH_DATE_CHAR_UUID (0x2A85)
+#define DATE_THRESHOLD_ASSESSMENT_CHAR_UUID (0x2A86)
+#define EMAIL_ADDRESS_CHAR_UUID (0x2A87)
+#define FAT_BURN_HR_LOWER_LIMIT_CHAR_UUID (0x2A88)
+#define FAT_BURN_HR_UPPER_LIMIT_CHAR_UUID (0x2A89)
+#define FIRST_NAME_CHAR_UUID (0x2A8A)
+#define FIVE_ZONE_HR_LIMIT_CHAR_UUID (0x2A8B)
+#define GENDER_CHAR_UUID (0x2A8C)
+#define HEART_RATE_MAX_CHAR_UUID (0x2A8D)
+#define HEIGHT_CHAR_UUID (0x2A8E)
+#define HIP_CIRC_CHAR_UUID (0x2A8F)
+#define LAST_NAME_CHAR_UUID (0x2A90)
+#define MAX_RECO_HEART_RATE_CHAR_UUID (0x2A91)
+#define RESTING_HEART_RATE_CHAR_UUID (0x2A92)
+#define SPORT_TYPE_CHAR_UUID (0x2A93)
+#define THREE_ZONE_HR_LIMIT_CHAR_UUID (0x2A94)
+#define TWO_ZONE_HR_LIMIT_CHAR_UUID (0x2A95)
+#define VO2_MAX_CHAR_UUID (0x2A96)
+#define WAIST_CIRC_CHAR_UUID (0x2A97)
+#define WEIGHT_CHAR_UUID (0x2A98)
+#define DATABASE_CHANGE_INCREMENT_CHAR_UUID (0x2A99)
+#define USER_INDEX_CHAR_UUID (0x2A9A)
+#define USER_CONTROL_POINT_CHAR_UUID (0x2A9F)
+#define LANGUAGE_CHAR_UUID (0x2AA2)
+
+/* UUIDs for weight scale profile */
+#define WEIGHT_SCALE_SERVICE_UUID (0x181D)
+#define WEIGHT_SCALE_MEASUREMENT_CHAR_UUID (0x2A9D)
+#define WEIGHT_SCALE_FEATURE_CHAR_UUID (0x2A9E)
+
+/* UUIDs for weight scale profile */
+#define BOND_MANAGEMENT_SERVICE_UUID (0x181E)
+#define BM_CONTROL_POINT_CHAR_UUID (0x2AA4)
+#define BM_FEATURE_CHAR_UUID (0x2AA5)
+
+/* UUIDs for Internet Support Service */
+#define INTERNET_SUPPORT_SERVICE_UUID (0x1820)
+
+/* UUIDs for Indoor Positioning Service */
+#define INDOOR_POSITIONING_SERVICE_UUID (0x1821)
+#define IP_CONFIGURATION_CHAR_UUID (0x2AAD)
+#define IP_LATITUDE_CHAR_UUID (0x2AAE)
+#define IP_LONGITUDE_CHAR_UUID (0x2AAF)
+
+/* UUIDs for HTTP proxy Service */
+#define HTTP_PROXY_SERVICE_UUID (0x1823)
+#define HTTP_URI_CHAR_UUID (0x2AB6)
+#define HTTP_HEADERS_CHAR_UUID (0x2AB7)
+#define HTTP_STATUS_CODE_CHAR_UUID (0x2AB8)
+#define HTTP_ENTITY_BODY_CHAR_UUID (0x2AB9)
+#define HTTP_CONTROL_POINT_CHAR_UUID (0x2ABA)
+#define HTTP_SECURITY_CHAR_UUID (0x2ABB)
+
+/* UUIDs for Object Transfer Service */
+#define OBJECT_TRANSFER_SERVICE_UUID (0x1825)
+#define OTS_FEATURE_CHAR_UUID (0x2ABD)
+#define OBJECT_NAME_CHAR_UUID (0x2ABE)
+#define OBJECT_TYPE_CHAR_UUID (0x2ABF)
+#define OBJECT_SIZE_CHAR_UUID (0x2AC0)
+#define OBJECT_PROPERTIES_CHAR_UUID (0x2AC4)
+#define OBJECT_ACTION_CONTROL_POINT_CHAR_UUID (0x2AC5)
+#define OBJECT_LIST_CONTROL_POINT_CHAR_UUID (0x2AC6)
+
+/* UUIDs for Zigbee Direct Service */
+#define ZIGBEE_DIRECT_COMM_SERVICE_UUID (0xFFF7)
+
+/* Custom Services*/
+/* UUIDs for data transfer service */
+#define DT_SERVICE_UUID (0xFE80)
+#define DT_TX_CHAR_UUID (0xFE81)
+#define DT_RX_CHAR_UUID (0xFE82)
+#define DT_THROUGHPUT_CHAR_UUID (0xFE83)
+
+/* UUIDs for custom battery service */
+#define CUSTOM_BATTERY_SERVICE_UUID (0xF2F0)
+#define CUSTOM_BATTERY_LEVEL_CHAR_UUID (0xF2F1)
+
+/* Custom Services*/
+/* UUIDs for data transfer service */
+#define LED_BUTTON_SERVICE_UUID (0x1A30)
+#define LED_CHAR_UUID (0x2B50)
+#define BUTTON_CHAR_UUID (0x2B51)
+/*UUIDs for End Device Management Service*/
+#define END_DEVICE_MGT_SERVICE_UUID (0x1A40)
+#define END_DEVICE_STATUS_CHAR_UUID (0x2B60)
+
+#define P2P_SERVICE_UUID (0xFE40)
+#define P2P_WRITE_CHAR_UUID (0xFE41)
+#define P2P_NOTIFY_CHAR_UUID (0xFE42)
+
+#define HOME_SERVICE_UUID (0xFE90)
+#define HOME_WRITE_CHAR_UUID (0xFE91)
+#define HOME_NOTIFY_CHAR_UUID (0xFE92)
+
+#define CAM_SERVICE_UUID (0xFEA0)
+#define CAM_WRITE_CHAR_UUID (0xFEA1)
+#define CAM_NOTIFY_CHAR_UUID (0xFEA2)
+
+/* UUIDs for Cable Replacement Service */
+#define CRS_SERVICE_UUID (0xFE60)
+#define CRS_TX_CHAR_UUID (0xFE61)
+#define CRS_RX_CHAR_UUID (0xFE62)
+
+/* UUIDs for Apple Notification Center Service */
+#define ANCS_SERVICE_UUID (0xF431)
+#define ANCS_NOTIFICATION_SOURCE_CHAR_UUID (0x120D)
+#define ANCS_CONTROL_POINT_CHAR_UUID (0xD8F3)
+#define ANCS_DATA_SOURCE_CHAR_UUID (0xC6E9)
+
+/* UUIDs for Apple Media Service start from iOS 8*/
+#define AMS_SERVICE_UUID (0x502B)
+#define AMS_REMOTE_COMMAND_CHAR_UUID (0x81D8)
+#define AMS_ENTITY_UPDATE_CHAR_UUID (0xABCE)
+#define AMS_ENTITY_ATTRIBUTE_CHAR_UUID (0xF38C)
+#endif /* _UUID_H_ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/zdd_stm.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/zdd_stm.h
new file mode 100644
index 0000000..5d9aa5a
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/zdd_stm.h
@@ -0,0 +1,100 @@
+
+/**
+ ******************************************************************************
+ * @file zdd_stm.h
+ * @author MCD Application Team
+ * @brief Header for zdd_stm.c module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __ZDD_STM_H
+#define __ZDD_STM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+
+
+
+/* Exported types ------------------------------------------------------------*/
+typedef enum
+{
+ /* ZDD P2P Events */
+ ZDD_P2P_STM__NOTIFY_ENABLED_EVT,
+ ZDD_P2P_STM_NOTIFY_DISABLED_EVT,
+ ZDD_P2P_STM_READ_EVT,
+ ZDD_P2P_STM_WRITE_EVT,
+ ZDD_P2P_STM_BOOT_REQUEST_EVT,
+ /* ZDD Security Events */
+ ZDD_SEC_P_256_INDICATE_ENABLED_EVT,
+ ZDD_SEC_P_256_INDICATE_DISABLED_EVT,
+ ZDD_SEC_P_256_WRITE_EVT,
+ ZDD_SEC_CURVE25519_INDICATE_ENABLED_EVT,
+ ZDD_SEC_CURVE25519_INDICATE_DISABLED_EVT,
+ ZDD_SEC_CURVE25519_WRITE_EVT,
+ /* ZDD Commissioning Events */
+ ZDD_COMM_FORM_NWK_WRITE_EVT,
+ ZDD_COMM_JOIN_NWK_WRITE_EVT,
+ ZDD_COMM_PERMIT_JOIN_WRITE_EVT,
+ ZDD_COMM_LEAVE_NWK_WRITE_EVT,
+ ZDD_COMM_STATUS_NOTIFY_ENABLED_EVT,
+ ZDD_COMM_STATUS_NOTIFY_DISABLED_EVT,
+ ZDD_COMM_STATUS_READ_EVT,
+ /* ZDD Tunnelling Events */
+ ZDD_TUNN_ZDTS_NPDU_INDICATE_ENABLED_EVT,
+ ZDD_TUNN_ZDTS_NPDU_INDICATE_DISABLED_EVT,
+ ZDD_TUNN_ZDTS_NPDU_WRITE_EVT
+
+} ZDD_STM_Opcode_evt_t;
+
+typedef struct
+{
+ uint8_t * pPayload;
+ uint8_t Length;
+}ZDD_STM_Data_t;
+
+typedef struct
+{
+ ZDD_STM_Opcode_evt_t ZDD_Evt_Opcode;
+ ZDD_STM_Data_t DataTransfered;
+ uint16_t ConnectionHandle;
+ uint8_t ServiceInstance;
+}ZDD_STM_App_Notification_evt_t;
+
+
+/* Exported constants --------------------------------------------------------*/
+#define ZDD_P2P_NOTIFY_CHAR_UUID P2P_NOTIFY_CHAR_UUID /* Temp */
+#define ZDD_SEC_P_256_CHAR_UUID (0xAF42) /* P-256 */
+#define ZDD_SEC_CURVE25519_CHAR_UUID (0xAF43) /* Curve25519 */
+#define ZDD_COMM_STATUS_CHAR_UUID (0x377D) /* Commissioning Status */
+#define ZDD_TUNN_ZDTS_NPDU_CHAR_UUID (0x78FD) /* ZDTS-NPDU */
+
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+void ZDD_STM_Init( void );
+void ZDD_STM_App_Notification(ZDD_STM_App_Notification_evt_t *pNotification);
+tBleStatus ZDD_STM_App_Update_Char(uint16_t UUID, uint8_t payloadLen, uint8_t *pPayload);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__ZDD_STM_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/common_blesvc.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/common_blesvc.h
new file mode 100644
index 0000000..2cf1552
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/common_blesvc.h
@@ -0,0 +1,54 @@
+
+/**
+ ******************************************************************************
+ * @file common_blesvc.h
+ * @author MCD Application Team
+ * @brief Header for ble modules
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __COMMON_BLESVC_H
+#define __COMMON_BLESVC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "ble_common.h"
+#include "ble.h"
+#include "dbg_trace.h"
+
+
+
+/* Exported types ------------------------------------------------------------*/
+typedef enum
+{
+ COMSVC_Notification = ( 1 << 0 ),
+ COMSVC_Indication = ( 1 << 1 ),
+} COMSVC_ClientCharConfMask_t;
+
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__COMMON_BLESVC_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/p2p_stm.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/p2p_stm.c
new file mode 100644
index 0000000..15ec975
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/p2p_stm.c
@@ -0,0 +1,295 @@
+/**
+ ******************************************************************************
+ * @file p2p_stm.c
+ * @author MCD Application Team
+ * @brief Peer to Peer Service (Custom STM)
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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.
+ *
+ ******************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "common_blesvc.h"
+
+/* Private typedef -----------------------------------------------------------*/
+typedef struct{
+ uint16_t PeerToPeerSvcHdle; /**< Service handle */
+ uint16_t P2PWriteClientToServerCharHdle; /**< Characteristic handle */
+ uint16_t P2PNotifyServerToClientCharHdle; /**< Characteristic handle */
+#if(BLE_CFG_OTA_REBOOT_CHAR != 0)
+ uint16_t RebootReqCharHdle; /**< Characteristic handle */
+#endif
+}PeerToPeerContext_t;
+
+/* Private defines -----------------------------------------------------------*/
+#define UUID_128_SUPPORTED 1
+
+#if (UUID_128_SUPPORTED == 1)
+#define BM_UUID_LENGTH UUID_TYPE_128
+#else
+#define BM_UUID_LENGTH UUID_TYPE_16
+#endif
+
+#define BM_REQ_CHAR_SIZE (3)
+
+
+/* Private macros ------------------------------------------------------------*/
+
+/* Private variables ---------------------------------------------------------*/
+/**
+ * Reboot Characteristic UUID
+ * 0000fe11-8e22-4541-9d4c-21edae82ed19
+ */
+#if(BLE_CFG_OTA_REBOOT_CHAR != 0)
+#if (UUID_128_SUPPORTED == 1)
+static const uint8_t BM_REQ_CHAR_UUID[16] = {0x19, 0xed, 0x82, 0xae,
+ 0xed, 0x21, 0x4c, 0x9d,
+ 0x41, 0x45, 0x22, 0x8e,
+ 0x11, 0xFE, 0x00, 0x00};
+#else
+static const uint8_t BM_REQ_CHAR_UUID[2] = {0x11, 0xFE};
+#endif
+#endif
+
+/**
+ * START of Section BLE_DRIVER_CONTEXT
+ */
+PLACE_IN_SECTION("BLE_DRIVER_CONTEXT") static PeerToPeerContext_t aPeerToPeerContext;
+
+/**
+ * END of Section BLE_DRIVER_CONTEXT
+ */
+/* Private function prototypes -----------------------------------------------*/
+static SVCCTL_EvtAckStatus_t PeerToPeer_Event_Handler(void *Event);
+
+
+/* Functions Definition ------------------------------------------------------*/
+/* Private functions ----------------------------------------------------------*/
+
+#define COPY_UUID_128(uuid_struct, uuid_15, uuid_14, uuid_13, uuid_12, uuid_11, uuid_10, uuid_9, uuid_8, uuid_7, uuid_6, uuid_5, uuid_4, uuid_3, uuid_2, uuid_1, uuid_0) \
+do {\
+ uuid_struct[0] = uuid_0; uuid_struct[1] = uuid_1; uuid_struct[2] = uuid_2; uuid_struct[3] = uuid_3; \
+ uuid_struct[4] = uuid_4; uuid_struct[5] = uuid_5; uuid_struct[6] = uuid_6; uuid_struct[7] = uuid_7; \
+ uuid_struct[8] = uuid_8; uuid_struct[9] = uuid_9; uuid_struct[10] = uuid_10; uuid_struct[11] = uuid_11; \
+ uuid_struct[12] = uuid_12; uuid_struct[13] = uuid_13; uuid_struct[14] = uuid_14; uuid_struct[15] = uuid_15; \
+}while(0)
+
+/* Hardware Characteristics Service */
+/*
+ The following 128bits UUIDs have been generated from the random UUID
+ generator:
+ D973F2E0-B19E-11E2-9E96-0800200C9A66: Service 128bits UUID
+ D973F2E1-B19E-11E2-9E96-0800200C9A66: Characteristic_1 128bits UUID
+ D973F2E2-B19E-11E2-9E96-0800200C9A66: Characteristic_2 128bits UUID
+ */
+#define COPY_P2P_SERVICE_UUID(uuid_struct) COPY_UUID_128(uuid_struct,0x00,0x00,0xfe,0x40,0xcc,0x7a,0x48,0x2a,0x98,0x4a,0x7f,0x2e,0xd5,0xb3,0xe5,0x8f)
+#define COPY_P2P_WRITE_CHAR_UUID(uuid_struct) COPY_UUID_128(uuid_struct,0x00,0x00,0xfe,0x41,0x8e,0x22,0x45,0x41,0x9d,0x4c,0x21,0xed,0xae,0x82,0xed,0x19)
+#define COPY_P2P_NOTIFY_UUID(uuid_struct) COPY_UUID_128(uuid_struct,0x00,0x00,0xfe,0x42,0x8e,0x22,0x45,0x41,0x9d,0x4c,0x21,0xed,0xae,0x82,0xed,0x19)
+
+
+
+/**
+ * @brief Event handler
+ * @param Event: Address of the buffer holding the Event
+ * @retval Ack: Return whether the Event has been managed or not
+ */
+static SVCCTL_EvtAckStatus_t PeerToPeer_Event_Handler(void *Event)
+{
+ SVCCTL_EvtAckStatus_t return_value;
+ hci_event_pckt *event_pckt;
+ evt_blecore_aci *blecore_evt;
+ aci_gatt_attribute_modified_event_rp0 * attribute_modified;
+ P2PS_STM_App_Notification_evt_t Notification;
+
+ return_value = SVCCTL_EvtNotAck;
+ event_pckt = (hci_event_pckt *)(((hci_uart_pckt*)Event)->data);
+
+ switch(event_pckt->evt)
+ {
+ case HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE:
+ {
+ blecore_evt = (evt_blecore_aci*)event_pckt->data;
+ switch(blecore_evt->ecode)
+ {
+ case ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE:
+ {
+ attribute_modified = (aci_gatt_attribute_modified_event_rp0*)blecore_evt->data;
+ if(attribute_modified->Attr_Handle == (aPeerToPeerContext.P2PNotifyServerToClientCharHdle + 2))
+ {
+ /**
+ * Descriptor handle
+ */
+ return_value = SVCCTL_EvtAckFlowEnable;
+ /**
+ * Notify to application
+ */
+ if(attribute_modified->Attr_Data[0] & COMSVC_Notification)
+ {
+ Notification.P2P_Evt_Opcode = P2PS_STM__NOTIFY_ENABLED_EVT;
+ P2PS_STM_App_Notification(&Notification);
+ }
+ else
+ {
+ Notification.P2P_Evt_Opcode = P2PS_STM_NOTIFY_DISABLED_EVT;
+ P2PS_STM_App_Notification(&Notification);
+ }
+ }
+
+ else if(attribute_modified->Attr_Handle == (aPeerToPeerContext.P2PWriteClientToServerCharHdle + 1))
+ {
+ BLE_DBG_P2P_STM_MSG("-- GATT : LED CONFIGURATION RECEIVED\n");
+ Notification.P2P_Evt_Opcode = P2PS_STM_WRITE_EVT;
+ Notification.DataTransfered.Length=attribute_modified->Attr_Data_Length;
+ Notification.DataTransfered.pPayload=attribute_modified->Attr_Data;
+ P2PS_STM_App_Notification(&Notification);
+ }
+#if(BLE_CFG_OTA_REBOOT_CHAR != 0)
+ else if(attribute_modified->Attr_Handle == (aPeerToPeerContext.RebootReqCharHdle + 1))
+ {
+ BLE_DBG_P2P_STM_MSG("-- GATT : REBOOT REQUEST RECEIVED\n");
+ Notification.P2P_Evt_Opcode = P2PS_STM_BOOT_REQUEST_EVT;
+ Notification.DataTransfered.Length=attribute_modified->Attr_Data_Length;
+ Notification.DataTransfered.pPayload=attribute_modified->Attr_Data;
+ P2PS_STM_App_Notification(&Notification);
+ }
+#endif
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ break; /* HCI_HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE_SPECIFIC */
+
+ default:
+ break;
+ }
+
+ return(return_value);
+}/* end SVCCTL_EvtAckStatus_t */
+
+
+/* Public functions ----------------------------------------------------------*/
+
+/**
+ * @brief Service initialization
+ * @param None
+ * @retval None
+ */
+void P2PS_STM_Init(void)
+{
+
+ Char_UUID_t uuid16;
+
+ /**
+ * Register the event handler to the BLE controller
+ */
+ SVCCTL_RegisterSvcHandler(PeerToPeer_Event_Handler);
+
+ /**
+ * Peer To Peer Service
+ *
+ * Max_Attribute_Records = 2*no_of_char + 1
+ * service_max_attribute_record = 1 for Peer To Peer service +
+ * 2 for P2P Write characteristic +
+ * 2 for P2P Notify characteristic +
+ * 1 for client char configuration descriptor +
+ *
+ */
+ COPY_P2P_SERVICE_UUID(uuid16.Char_UUID_128);
+ aci_gatt_add_service(UUID_TYPE_128,
+ (Service_UUID_t *) &uuid16,
+ PRIMARY_SERVICE,
+#if (BLE_CFG_OTA_REBOOT_CHAR != 0)
+ 2+
+#endif
+ 6,
+ &(aPeerToPeerContext.PeerToPeerSvcHdle));
+
+ /**
+ * Add LED Characteristic
+ */
+ COPY_P2P_WRITE_CHAR_UUID(uuid16.Char_UUID_128);
+ aci_gatt_add_char(aPeerToPeerContext.PeerToPeerSvcHdle,
+ UUID_TYPE_128, &uuid16,
+ 2,
+ CHAR_PROP_WRITE_WITHOUT_RESP|CHAR_PROP_READ,
+ ATTR_PERMISSION_NONE,
+ GATT_NOTIFY_ATTRIBUTE_WRITE, /* gattEvtMask */
+ 10, /* encryKeySize */
+ 1, /* isVariable */
+ &(aPeerToPeerContext.P2PWriteClientToServerCharHdle));
+
+ /**
+ * Add Button Characteristic
+ */
+ COPY_P2P_NOTIFY_UUID(uuid16.Char_UUID_128);
+ aci_gatt_add_char(aPeerToPeerContext.PeerToPeerSvcHdle,
+ UUID_TYPE_128, &uuid16,
+ 2,
+ CHAR_PROP_NOTIFY,
+ ATTR_PERMISSION_NONE,
+ GATT_NOTIFY_ATTRIBUTE_WRITE, /* gattEvtMask */
+ 10, /* encryKeySize */
+ 1, /* isVariable: 1 */
+ &(aPeerToPeerContext.P2PNotifyServerToClientCharHdle));
+
+#if(BLE_CFG_OTA_REBOOT_CHAR != 0)
+ /**
+ * Add Boot Request Characteristic
+ */
+ aci_gatt_add_char(aPeerToPeerContext.PeerToPeerSvcHdle,
+ BM_UUID_LENGTH,
+ (Char_UUID_t *)BM_REQ_CHAR_UUID,
+ BM_REQ_CHAR_SIZE,
+ CHAR_PROP_WRITE_WITHOUT_RESP,
+ ATTR_PERMISSION_NONE,
+ GATT_NOTIFY_ATTRIBUTE_WRITE,
+ 10,
+ 0,
+ &(aPeerToPeerContext.RebootReqCharHdle));
+#endif
+
+
+ return;
+}
+
+/**
+ * @brief Characteristic update
+ * @param UUID: UUID of the characteristic
+ * @param Service_Instance: Instance of the service to which the characteristic belongs
+ *
+ */
+tBleStatus P2PS_STM_App_Update_Char(uint16_t UUID, uint8_t *pPayload)
+{
+ tBleStatus result = BLE_STATUS_INVALID_PARAMS;
+ switch(UUID)
+ {
+ case P2P_NOTIFY_CHAR_UUID:
+
+ result = aci_gatt_update_char_value(aPeerToPeerContext.PeerToPeerSvcHdle,
+ aPeerToPeerContext.P2PNotifyServerToClientCharHdle,
+ 0, /* charValOffset */
+ 2, /* charValueLen */
+ (uint8_t *) pPayload);
+
+ break;
+
+ default:
+ break;
+ }
+
+ return result;
+}/* end P2PS_STM_Init() */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/svc_ctl.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/svc_ctl.c
new file mode 100644
index 0000000..bde8a37
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/svc_ctl.c
@@ -0,0 +1,330 @@
+/**
+ ******************************************************************************
+ * @file svc_ctl.c
+ * @author MCD Application Team
+ * @brief BLE Controller
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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.
+ *
+ ******************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "common_blesvc.h"
+#include "cmsis_compiler.h"
+
+/* Private typedef -----------------------------------------------------------*/
+typedef struct
+{
+#if (BLE_CFG_SVC_MAX_NBR_CB > 0)
+SVC_CTL_p_EvtHandler_t SVCCTL__SvcHandlerTab[BLE_CFG_SVC_MAX_NBR_CB];
+#endif
+uint8_t NbreOfRegisteredHandler;
+} SVCCTL_EvtHandler_t;
+
+typedef struct
+{
+#if (BLE_CFG_CLT_MAX_NBR_CB > 0)
+SVC_CTL_p_EvtHandler_t SVCCTL_CltHandlerTable[BLE_CFG_CLT_MAX_NBR_CB];
+#endif
+uint8_t NbreOfRegisteredHandler;
+} SVCCTL_CltHandler_t;
+
+/* Private defines -----------------------------------------------------------*/
+#define SVCCTL_EGID_EVT_MASK 0xFF00
+#define SVCCTL_GATT_EVT_TYPE 0x0C00
+#define SVCCTL_GAP_DEVICE_NAME_LENGTH 7
+
+/* Private macros ------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/**
+ * START of Section BLE_DRIVER_CONTEXT
+ */
+
+PLACE_IN_SECTION("BLE_DRIVER_CONTEXT") SVCCTL_EvtHandler_t SVCCTL_EvtHandler;
+PLACE_IN_SECTION("BLE_DRIVER_CONTEXT") SVCCTL_CltHandler_t SVCCTL_CltHandler;
+
+/**
+ * END of Section BLE_DRIVER_CONTEXT
+ */
+
+/* Private functions ----------------------------------------------------------*/
+/* Weak functions ----------------------------------------------------------*/
+void BVOPUS_STM_Init(void);
+
+__WEAK void BAS_Init( void )
+{
+ return;
+}
+
+__WEAK void BLS_Init( void )
+{
+ return;
+}
+__WEAK void CRS_STM_Init( void )
+{
+ return;
+}
+__WEAK void DIS_Init( void )
+{
+ return;
+}
+__WEAK void EDS_STM_Init( void )
+{
+ return;
+}
+__WEAK void HIDS_Init( void )
+{
+ return;
+}
+__WEAK void HRS_Init( void )
+{
+ return;
+}
+__WEAK void HTS_Init( void )
+{
+ return;
+}
+__WEAK void IAS_Init( void )
+{
+ return;
+}
+__WEAK void LLS_Init( void )
+{
+ return;
+}
+__WEAK void TPS_Init( void )
+{
+ return;
+}
+__WEAK void MOTENV_STM_Init( void )
+{
+ return;
+}
+__WEAK void P2PS_STM_Init( void )
+{
+ return;
+}
+__WEAK void ZDD_STM_Init( void )
+{
+ return;
+}
+__WEAK void OTAS_STM_Init( void )
+{
+ return;
+}
+__WEAK void MESH_Init( void )
+{
+ return;
+}
+__WEAK void BVOPUS_STM_Init( void )
+{
+ return;
+}
+__WEAK void SVCCTL_InitCustomSvc( void )
+{
+ return;
+}
+
+/* Functions Definition ------------------------------------------------------*/
+
+void SVCCTL_Init( void )
+{
+
+ /**
+ * Initialize the number of registered Handler
+ */
+ SVCCTL_EvtHandler.NbreOfRegisteredHandler = 0;
+ SVCCTL_CltHandler.NbreOfRegisteredHandler = 0;
+
+ /**
+ * Add and Initialize requested services
+ */
+ SVCCTL_SvcInit();
+
+ return;
+}
+
+__WEAK void SVCCTL_SvcInit(void)
+{
+ BAS_Init();
+
+ BLS_Init();
+
+ CRS_STM_Init();
+
+ DIS_Init();
+
+ EDS_STM_Init();
+
+ HIDS_Init();
+
+ HRS_Init();
+
+ HTS_Init();
+
+ IAS_Init();
+
+ LLS_Init();
+
+ TPS_Init();
+
+ MOTENV_STM_Init();
+
+ P2PS_STM_Init();
+
+ ZDD_STM_Init();
+
+ OTAS_STM_Init();
+
+ BVOPUS_STM_Init();
+
+ MESH_Init();
+
+ SVCCTL_InitCustomSvc();
+
+ return;
+}
+
+/**
+ * @brief BLE Controller initialization
+ * @param None
+ * @retval None
+ */
+void SVCCTL_RegisterSvcHandler( SVC_CTL_p_EvtHandler_t pfBLE_SVC_Service_Event_Handler )
+{
+#if (BLE_CFG_SVC_MAX_NBR_CB > 0)
+ SVCCTL_EvtHandler.SVCCTL__SvcHandlerTab[SVCCTL_EvtHandler.NbreOfRegisteredHandler] = pfBLE_SVC_Service_Event_Handler;
+ SVCCTL_EvtHandler.NbreOfRegisteredHandler++;
+#else
+ (void)(pfBLE_SVC_Service_Event_Handler);
+#endif
+
+ return;
+}
+
+/**
+ * @brief BLE Controller initialization
+ * @param None
+ * @retval None
+ */
+void SVCCTL_RegisterCltHandler( SVC_CTL_p_EvtHandler_t pfBLE_SVC_Client_Event_Handler )
+{
+#if (BLE_CFG_CLT_MAX_NBR_CB > 0)
+ SVCCTL_CltHandler.SVCCTL_CltHandlerTable[SVCCTL_CltHandler.NbreOfRegisteredHandler] = pfBLE_SVC_Client_Event_Handler;
+ SVCCTL_CltHandler.NbreOfRegisteredHandler++;
+#else
+ (void)(pfBLE_SVC_Client_Event_Handler);
+#endif
+
+ return;
+}
+
+__WEAK SVCCTL_UserEvtFlowStatus_t SVCCTL_UserEvtRx( void *pckt )
+{
+ hci_event_pckt *event_pckt;
+ evt_blecore_aci *blecore_evt;
+ SVCCTL_EvtAckStatus_t event_notification_status;
+ SVCCTL_UserEvtFlowStatus_t return_status;
+ uint8_t index;
+
+ event_pckt = (hci_event_pckt*) ((hci_uart_pckt *) pckt)->data;
+ event_notification_status = SVCCTL_EvtNotAck;
+
+ switch (event_pckt->evt)
+ {
+ case HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE:
+ {
+ blecore_evt = (evt_blecore_aci*) event_pckt->data;
+
+ switch ((blecore_evt->ecode) & SVCCTL_EGID_EVT_MASK)
+ {
+ case SVCCTL_GATT_EVT_TYPE:
+#if (BLE_CFG_SVC_MAX_NBR_CB > 0)
+ /* For Service event handler */
+ for (index = 0; index < SVCCTL_EvtHandler.NbreOfRegisteredHandler; index++)
+ {
+ event_notification_status = SVCCTL_EvtHandler.SVCCTL__SvcHandlerTab[index](pckt);
+ /**
+ * When a GATT event has been acknowledged by a Service, there is no need to call the other registered handlers
+ * a GATT event is relevant for only one Service
+ */
+ if (event_notification_status != SVCCTL_EvtNotAck)
+ {
+ /**
+ * The event has been managed. The Event processing should be stopped
+ */
+ break;
+ }
+ }
+#endif
+#if (BLE_CFG_CLT_MAX_NBR_CB > 0)
+ /* For Client event handler */
+ event_notification_status = SVCCTL_EvtNotAck;
+ for(index = 0; index <SVCCTL_CltHandler.NbreOfRegisteredHandler; index++)
+ {
+ event_notification_status = SVCCTL_CltHandler.SVCCTL_CltHandlerTable[index](pckt);
+ /**
+ * When a GATT event has been acknowledged by a Client, there is no need to call the other registered handlers
+ * a GATT event is relevant for only one Client
+ */
+ if (event_notification_status != SVCCTL_EvtNotAck)
+ {
+ /**
+ * The event has been managed. The Event processing should be stopped
+ */
+ break;
+ }
+ }
+#endif
+ break;
+
+ default:
+ break;
+ }
+ }
+ break; /* HCI_HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE_SPECIFIC */
+
+ default:
+ break;
+ }
+
+ /**
+ * When no registered handlers (either Service or Client) has acknowledged the GATT event, it is reported to the application
+ * a GAP event is always reported to the application.
+ */
+ switch (event_notification_status)
+ {
+ case SVCCTL_EvtNotAck:
+ /**
+ * The event has NOT been managed.
+ * It shall be passed to the application for processing
+ */
+ return_status = SVCCTL_App_Notification(pckt);
+ break;
+
+ case SVCCTL_EvtAckFlowEnable:
+ return_status = SVCCTL_UserEvtFlowEnable;
+ break;
+
+ case SVCCTL_EvtAckFlowDisable:
+ return_status = SVCCTL_UserEvtFlowDisable;
+ break;
+
+ default:
+ return_status = SVCCTL_UserEvtFlowEnable;
+ break;
+ }
+
+ return (return_status);
+}
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/hw.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/hw.h
new file mode 100644
index 0000000..e754555
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/hw.h
@@ -0,0 +1,105 @@
+/**
+ ******************************************************************************
+ * @file hw.h
+ * @author MCD Application Team
+ * @brief Hardware
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __HW_H
+#define __HW_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /* Includes ------------------------------------------------------------------*/
+
+ /******************************************************************************
+ * HW IPCC
+ ******************************************************************************/
+ void HW_IPCC_Enable( void );
+ void HW_IPCC_Init( void );
+ void HW_IPCC_Rx_Handler( void );
+ void HW_IPCC_Tx_Handler( void );
+
+ void HW_IPCC_BLE_Init( void );
+ void HW_IPCC_BLE_SendCmd( void );
+ void HW_IPCC_MM_SendFreeBuf( void (*cb)( void ) );
+ void HW_IPCC_BLE_RxEvtNot( void );
+ void HW_IPCC_BLE_SendAclData( void );
+ void HW_IPCC_BLE_AclDataAckNot( void );
+
+ void HW_IPCC_SYS_Init( void );
+ void HW_IPCC_SYS_SendCmd( void );
+ void HW_IPCC_SYS_CmdEvtNot( void );
+ void HW_IPCC_SYS_EvtNot( void );
+
+ void HW_IPCC_THREAD_Init( void );
+ void HW_IPCC_OT_SendCmd( void );
+ void HW_IPCC_CLI_SendCmd( void );
+ void HW_IPCC_THREAD_SendAck( void );
+ void HW_IPCC_OT_CmdEvtNot( void );
+ void HW_IPCC_CLI_CmdEvtNot( void );
+ void HW_IPCC_THREAD_EvtNot( void );
+ void HW_IPCC_THREAD_CliSendAck( void );
+ void HW_IPCC_THREAD_CliEvtNot( void );
+
+
+ void HW_IPCC_LLDTESTS_Init( void );
+ void HW_IPCC_LLDTESTS_SendCliCmd( void );
+ void HW_IPCC_LLDTESTS_ReceiveCliRsp( void );
+ void HW_IPCC_LLDTESTS_SendCliRspAck( void );
+ void HW_IPCC_LLDTESTS_ReceiveM0Cmd( void );
+ void HW_IPCC_LLDTESTS_SendM0CmdAck( void );
+
+
+ void HW_IPCC_BLE_LLD_Init( void );
+ void HW_IPCC_BLE_LLD_SendCliCmd( void );
+ void HW_IPCC_BLE_LLD_ReceiveCliRsp( void );
+ void HW_IPCC_BLE_LLD_SendCliRspAck( void );
+ void HW_IPCC_BLE_LLD_ReceiveM0Cmd( void );
+ void HW_IPCC_BLE_LLD_SendM0CmdAck( void );
+ void HW_IPCC_BLE_LLD_SendCmd( void );
+ void HW_IPCC_BLE_LLD_ReceiveRsp( void );
+ void HW_IPCC_BLE_LLD_SendRspAck( void );
+
+
+ void HW_IPCC_TRACES_Init( void );
+ void HW_IPCC_TRACES_EvtNot( void );
+
+ void HW_IPCC_MAC_802_15_4_Init( void );
+ void HW_IPCC_MAC_802_15_4_SendCmd( void );
+ void HW_IPCC_MAC_802_15_4_SendAck( void );
+ void HW_IPCC_MAC_802_15_4_CmdEvtNot( void );
+ void HW_IPCC_MAC_802_15_4_EvtNot( void );
+
+ void HW_IPCC_ZIGBEE_Init( void );
+
+ void HW_IPCC_ZIGBEE_SendM4RequestToM0(void); /* M4 Request to M0 */
+ void HW_IPCC_ZIGBEE_RecvAppliAckFromM0(void); /* Request ACK from M0 */
+
+ void HW_IPCC_ZIGBEE_RecvM0NotifyToM4(void); /* M0 Notify to M4 */
+ void HW_IPCC_ZIGBEE_SendM4AckToM0Notify(void); /* Notify ACK from M4 */
+ void HW_IPCC_ZIGBEE_RecvM0RequestToM4(void); /* M0 Request to M4 */
+ void HW_IPCC_ZIGBEE_SendM4AckToM0Request(void); /* Request ACK from M4 */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__HW_H */
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/shci/shci.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/shci/shci.c
new file mode 100644
index 0000000..727a9e6
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/shci/shci.c
@@ -0,0 +1,762 @@
+/**
+ ******************************************************************************
+ * @file shci.c
+ * @author MCD Application Team
+ * @brief HCI command for the system channel
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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.
+ *
+ ******************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32_wpan_common.h"
+
+#include "shci_tl.h"
+#include "shci.h"
+#include "stm32wbxx.h"
+
+/* Private typedef -----------------------------------------------------------*/
+/* Private defines -----------------------------------------------------------*/
+/* Private macros ------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/* Global variables ----------------------------------------------------------*/
+/* Private function prototypes -----------------------------------------------*/
+/* Local Functions Definition ------------------------------------------------------*/
+/* Public Functions Definition ------------------------------------------------------*/
+
+/**
+ * C2 COMMAND
+ * These commands are sent to the CPU2
+ */
+uint8_t SHCI_C2_FUS_GetState( SHCI_FUS_GetState_ErrorCode_t *p_error_code )
+{
+ /**
+ * Buffer is large enough to hold command complete with payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE + 1];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_FUS_GET_STATE,
+ 0,
+ 0,
+ p_rsp );
+
+ if(p_error_code != 0)
+ {
+ *p_error_code = (SHCI_FUS_GetState_ErrorCode_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[1]);
+ }
+
+ return (((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_FUS_FwUpgrade( uint32_t fw_src_add, uint32_t fw_dest_add )
+{
+ /**
+ * TL_BLEEVT_CC_BUFFER_SIZE is 16 bytes so it is large enough to hold the 8 bytes of command parameters
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+ uint32_t *p_cmd;
+ uint8_t cmd_length;
+
+ p_cmd = (uint32_t*)local_buffer;
+ cmd_length = 0;
+
+ if(fw_src_add != 0)
+ {
+ *p_cmd = fw_src_add;
+ cmd_length += 4;
+ }
+
+ if(fw_dest_add != 0)
+ {
+ *(p_cmd+1) = fw_dest_add;
+ cmd_length += 4;
+ }
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_FUS_FW_UPGRADE,
+ cmd_length,
+ local_buffer,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_FUS_FwDelete( void )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_FUS_FW_DELETE,
+ 0,
+ 0,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_FUS_UpdateAuthKey( SHCI_C2_FUS_UpdateAuthKey_Cmd_Param_t *pParam )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_FUS_UPDATE_AUTH_KEY,
+ sizeof( SHCI_C2_FUS_UpdateAuthKey_Cmd_Param_t ),
+ (uint8_t*)pParam,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_FUS_LockAuthKey( void )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_FUS_LOCK_AUTH_KEY,
+ 0,
+ 0,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_FUS_StoreUsrKey( SHCI_C2_FUS_StoreUsrKey_Cmd_Param_t *pParam, uint8_t *p_key_index )
+{
+ /**
+ * Buffer is large enough to hold command complete with payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE + 1];
+ TL_EvtPacket_t * p_rsp;
+ uint8_t local_payload_len;
+
+ if(pParam->KeyType == KEYTYPE_ENCRYPTED)
+ {
+ /**
+ * When the key is encrypted, the 12 bytes IV Key is included in the payload as well
+ * The IV key is always 12 bytes
+ */
+ local_payload_len = pParam->KeySize + 2 + 12;
+ }
+ else
+ {
+ local_payload_len = pParam->KeySize + 2;
+ }
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_FUS_STORE_USR_KEY,
+ local_payload_len ,
+ (uint8_t*)pParam,
+ p_rsp );
+
+ *p_key_index = (((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[1]);
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_FUS_LoadUsrKey( uint8_t key_index )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ local_buffer[0] = key_index;
+
+ shci_send( SHCI_OPCODE_C2_FUS_LOAD_USR_KEY,
+ 1,
+ local_buffer,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_FUS_StartWs( void )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_FUS_START_WS,
+ 0,
+ 0,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_FUS_LockUsrKey( uint8_t key_index )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ local_buffer[0] = key_index;
+
+ shci_send( SHCI_OPCODE_C2_FUS_LOCK_USR_KEY,
+ 1,
+ local_buffer,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_FUS_UnloadUsrKey( uint8_t key_index )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ local_buffer[0] = key_index;
+
+ shci_send( SHCI_OPCODE_C2_FUS_UNLOAD_USR_KEY,
+ 1,
+ local_buffer,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_FUS_ActivateAntiRollback( void )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_FUS_ACTIVATE_ANTIROLLBACK,
+ 0,
+ 0,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_BLE_Init( SHCI_C2_Ble_Init_Cmd_Packet_t *pCmdPacket )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_BLE_INIT,
+ sizeof( SHCI_C2_Ble_Init_Cmd_Param_t ),
+ (uint8_t*)&pCmdPacket->Param,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_THREAD_Init( void )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_THREAD_INIT,
+ 0,
+ 0,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_LLDTESTS_Init( uint8_t param_size, uint8_t * p_param )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_LLD_TESTS_INIT,
+ param_size,
+ p_param,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_BLE_LLD_Init( uint8_t param_size, uint8_t * p_param )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_BLE_LLD_INIT,
+ param_size,
+ p_param,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_ZIGBEE_Init( void )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_ZIGBEE_INIT,
+ 0,
+ 0,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_DEBUG_Init( SHCI_C2_DEBUG_Init_Cmd_Packet_t *pCmdPacket )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_DEBUG_INIT,
+ sizeof( SHCI_C2_DEBUG_init_Cmd_Param_t ),
+ (uint8_t*)&pCmdPacket->Param,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_FLASH_EraseActivity( SHCI_EraseActivity_t erase_activity )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ local_buffer[0] = erase_activity;
+
+ shci_send( SHCI_OPCODE_C2_FLASH_ERASE_ACTIVITY,
+ 1,
+ local_buffer,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_CONCURRENT_SetMode( SHCI_C2_CONCURRENT_Mode_Param_t Mode )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ local_buffer[0] = Mode;
+
+ shci_send( SHCI_OPCODE_C2_CONCURRENT_SET_MODE,
+ 1,
+ local_buffer,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_CONCURRENT_GetNextBleEvtTime( SHCI_C2_CONCURRENT_GetNextBleEvtTime_Param_t *pParam )
+{
+ /**
+ * Buffer is large enough to hold command complete with payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE+4];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_CONCURRENT_GET_NEXT_BLE_EVT_TIME,
+ 0,
+ 0,
+ p_rsp );
+
+ memcpy((void*)&(pParam->relative_time), (void*)&((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[1], sizeof(pParam->relative_time));
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_CONCURRENT_EnableNext_802154_EvtNotification( void )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_CONCURRENT_ENABLE_NEXT_802154_EVT_NOTIFICATION,
+ 0,
+ 0,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_FLASH_StoreData( SHCI_C2_FLASH_Ip_t Ip )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ local_buffer[0] = Ip;
+
+ shci_send( SHCI_OPCODE_C2_FLASH_STORE_DATA,
+ 1,
+ local_buffer,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_FLASH_EraseData( SHCI_C2_FLASH_Ip_t Ip )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ local_buffer[0] = Ip;
+
+ shci_send( SHCI_OPCODE_C2_FLASH_ERASE_DATA,
+ 1,
+ local_buffer,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_RADIO_AllowLowPower( SHCI_C2_FLASH_Ip_t Ip,uint8_t FlagRadioLowPowerOn)
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ local_buffer[0] = Ip;
+ local_buffer[1] = FlagRadioLowPowerOn;
+
+ shci_send( SHCI_OPCODE_C2_RADIO_ALLOW_LOW_POWER,
+ 2,
+ local_buffer,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_MAC_802_15_4_Init( void )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_MAC_802_15_4_INIT,
+ 0,
+ 0,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_Reinit( void )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_REINIT,
+ 0,
+ 0,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_ExtpaConfig(uint32_t gpio_port, uint16_t gpio_pin_number, uint8_t gpio_polarity, uint8_t gpio_status)
+{
+ /**
+ * TL_BLEEVT_CC_BUFFER_SIZE is 16 bytes so it is large enough to hold the 8 bytes of command parameters
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ ((SHCI_C2_EXTPA_CONFIG_Cmd_Param_t*)local_buffer)->gpio_port = gpio_port;
+ ((SHCI_C2_EXTPA_CONFIG_Cmd_Param_t*)local_buffer)->gpio_pin_number = gpio_pin_number;
+ ((SHCI_C2_EXTPA_CONFIG_Cmd_Param_t*)local_buffer)->gpio_polarity = gpio_polarity;
+ ((SHCI_C2_EXTPA_CONFIG_Cmd_Param_t*)local_buffer)->gpio_status = gpio_status;
+
+ shci_send( SHCI_OPCODE_C2_EXTPA_CONFIG,
+ 8,
+ local_buffer,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_SetFlashActivityControl(SHCI_C2_SET_FLASH_ACTIVITY_CONTROL_Source_t Source)
+{
+ /**
+ * TL_BLEEVT_CC_BUFFER_SIZE is 16 bytes so it is large enough to hold the 1 byte of command parameter
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ local_buffer[0] = (uint8_t)Source;
+
+ shci_send( SHCI_OPCODE_C2_SET_FLASH_ACTIVITY_CONTROL,
+ 1,
+ local_buffer,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_Config(SHCI_C2_CONFIG_Cmd_Param_t *pCmdPacket)
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_CONFIG,
+ sizeof(SHCI_C2_CONFIG_Cmd_Param_t),
+ (uint8_t*)pCmdPacket,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_802_15_4_DeInit( void )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ shci_send( SHCI_OPCODE_C2_802_15_4_DEINIT,
+ 0,
+ 0,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+SHCI_CmdStatus_t SHCI_C2_SetSystemClock( SHCI_C2_SET_SYSTEM_CLOCK_Cmd_Param_t clockSel )
+{
+ /**
+ * Buffer is large enough to hold command complete without payload
+ */
+ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
+ TL_EvtPacket_t * p_rsp;
+
+ p_rsp = (TL_EvtPacket_t *)local_buffer;
+
+ local_buffer[0] = (uint8_t)clockSel;
+
+ shci_send( SHCI_OPCODE_C2_SET_SYSTEM_CLOCK,
+ 1,
+ local_buffer,
+ p_rsp );
+
+ return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
+}
+
+/**
+ * Local System COMMAND
+ * These commands are NOT sent to the CPU2
+ */
+
+SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo )
+{
+ uint32_t ipccdba = 0;
+ MB_RefTable_t * p_RefTable = NULL;
+ uint32_t wireless_firmware_version = 0;
+ uint32_t wireless_firmware_memorySize = 0;
+ uint32_t wireless_firmware_infoStack = 0;
+ MB_FUS_DeviceInfoTable_t * p_fus_device_info_table = NULL;
+ uint32_t fus_version = 0;
+ uint32_t fus_memorySize = 0;
+
+ ipccdba = READ_BIT( FLASH->IPCCBR, FLASH_IPCCBR_IPCCDBA );
+
+ /**
+ * The Device Info Table mapping depends on which firmware is running on CPU2.
+ * If the FUS is running on CPU2, FUS_DEVICE_INFO_TABLE_VALIDITY_KEYWORD shall be written in the table.
+ * Otherwise, it means the Wireless Firmware is running on the CPU2
+ */
+ p_fus_device_info_table = (MB_FUS_DeviceInfoTable_t*)(*(uint32_t*)((ipccdba<<2) + SRAM2A_BASE));
+
+ if(p_fus_device_info_table->DeviceInfoTableState == FUS_DEVICE_INFO_TABLE_VALIDITY_KEYWORD)
+ {
+ /* The FUS is running on CPU2 */
+ /**
+ * Retrieve the WirelessFwInfoTable
+ * This table is stored in RAM at startup during the TL (transport layer) initialization
+ */
+ wireless_firmware_version = p_fus_device_info_table->WirelessStackVersion;
+ wireless_firmware_memorySize = p_fus_device_info_table->WirelessStackMemorySize;
+ wireless_firmware_infoStack = p_fus_device_info_table->WirelessFirmwareBleInfo;
+
+ /**
+ * Retrieve the FusInfoTable
+ * This table is stored in RAM at startup during the TL (transport layer) initialization
+ */
+ fus_version = p_fus_device_info_table->FusVersion;
+ fus_memorySize = p_fus_device_info_table->FusMemorySize;
+ }
+ else
+ {
+ /* The Wireless Firmware is running on CPU2 */
+ p_RefTable = (MB_RefTable_t*)((ipccdba<<2) + SRAM2A_BASE);
+
+ /**
+ * Retrieve the WirelessFwInfoTable
+ * This table is stored in RAM at startup during the TL (transport layer) initialization
+ */
+ wireless_firmware_version = p_RefTable->p_device_info_table->WirelessFwInfoTable.Version;
+ wireless_firmware_memorySize = p_RefTable->p_device_info_table->WirelessFwInfoTable.MemorySize;
+ wireless_firmware_infoStack = p_RefTable->p_device_info_table->WirelessFwInfoTable.InfoStack;
+
+ /**
+ * Retrieve the FusInfoTable
+ * This table is stored in RAM at startup during the TL (transport layer) initialization
+ */
+ fus_version = p_RefTable->p_device_info_table->FusInfoTable.Version;
+ fus_memorySize = p_RefTable->p_device_info_table->FusInfoTable.MemorySize;
+ }
+
+ /**
+ * Retrieve the WirelessFwInfoTable
+ * This table is stored in RAM at startup during the TL (transport layer) initialization
+ */
+ pWirelessInfo->VersionMajor = ((wireless_firmware_version & INFO_VERSION_MAJOR_MASK) >> INFO_VERSION_MAJOR_OFFSET);
+ pWirelessInfo->VersionMinor = ((wireless_firmware_version & INFO_VERSION_MINOR_MASK) >> INFO_VERSION_MINOR_OFFSET);
+ pWirelessInfo->VersionSub = ((wireless_firmware_version & INFO_VERSION_SUB_MASK) >> INFO_VERSION_SUB_OFFSET);
+ pWirelessInfo->VersionBranch = ((wireless_firmware_version & INFO_VERSION_BRANCH_MASK) >> INFO_VERSION_BRANCH_OFFSET);
+ pWirelessInfo->VersionReleaseType = ((wireless_firmware_version & INFO_VERSION_TYPE_MASK) >> INFO_VERSION_TYPE_OFFSET);
+
+ pWirelessInfo->MemorySizeSram2B = ((wireless_firmware_memorySize & INFO_SIZE_SRAM2B_MASK) >> INFO_SIZE_SRAM2B_OFFSET);
+ pWirelessInfo->MemorySizeSram2A = ((wireless_firmware_memorySize & INFO_SIZE_SRAM2A_MASK) >> INFO_SIZE_SRAM2A_OFFSET);
+ pWirelessInfo->MemorySizeSram1 = ((wireless_firmware_memorySize & INFO_SIZE_SRAM1_MASK) >> INFO_SIZE_SRAM1_OFFSET);
+ pWirelessInfo->MemorySizeFlash = ((wireless_firmware_memorySize & INFO_SIZE_FLASH_MASK) >> INFO_SIZE_FLASH_OFFSET);
+
+ pWirelessInfo->StackType = ((wireless_firmware_infoStack & INFO_STACK_TYPE_MASK) >> INFO_STACK_TYPE_OFFSET);
+
+ /**
+ * Retrieve the FusInfoTable
+ * This table is stored in RAM at startup during the TL (transport layer) initialization
+ */
+ pWirelessInfo->FusVersionMajor = ((fus_version & INFO_VERSION_MAJOR_MASK) >> INFO_VERSION_MAJOR_OFFSET);
+ pWirelessInfo->FusVersionMinor = ((fus_version & INFO_VERSION_MINOR_MASK) >> INFO_VERSION_MINOR_OFFSET);
+ pWirelessInfo->FusVersionSub = ((fus_version & INFO_VERSION_SUB_MASK) >> INFO_VERSION_SUB_OFFSET);
+
+ pWirelessInfo->FusMemorySizeSram2B = ((fus_memorySize & INFO_SIZE_SRAM2B_MASK) >> INFO_SIZE_SRAM2B_OFFSET);
+ pWirelessInfo->FusMemorySizeSram2A = ((fus_memorySize & INFO_SIZE_SRAM2A_MASK) >> INFO_SIZE_SRAM2A_OFFSET);
+ pWirelessInfo->FusMemorySizeFlash = ((fus_memorySize & INFO_SIZE_FLASH_MASK) >> INFO_SIZE_FLASH_OFFSET);
+
+ return (SHCI_Success);
+}
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/shci/shci.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/shci/shci.h
new file mode 100644
index 0000000..438d4b6
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/shci/shci.h
@@ -0,0 +1,1411 @@
+/**
+ ******************************************************************************
+ * @file shci.h
+ * @author MCD Application Team
+ * @brief HCI command for the system channel
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __SHCI_H
+#define __SHCI_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /* Includes ------------------------------------------------------------------*/
+#include "mbox_def.h" /* Requested to expose the MB_WirelessFwInfoTable_t structure */
+
+ /* Exported types ------------------------------------------------------------*/
+
+ /* SYSTEM EVENT */
+ typedef enum
+ {
+ WIRELESS_FW_RUNNING = 0x00,
+ FUS_FW_RUNNING = 0x01,
+ } SHCI_SysEvt_Ready_Rsp_t;
+
+ /* ERROR CODES
+ *
+ * These error codes are detected on CPU2 side and are send back to the CPU1 via a system
+ * notification message. It is up to the application running on CPU1 to manage these errors
+ *
+ * These errors can be generated by all layers (low level driver, stack, framework infrastructure, etc..)
+ */
+ typedef enum
+ {
+ ERR_BLE_INIT = 0, /* This event is currently not reported by the CPU2 */
+ ERR_THREAD_LLD_FATAL_ERROR = 125, /* The LLD driver used on 802_15_4 detected a fatal error */
+ ERR_THREAD_UNKNOWN_CMD = 126, /* The command send by the CPU1 to control the Thread stack is unknown */
+ ERR_ZIGBEE_UNKNOWN_CMD = 200, /* The command send by the CPU1 to control the Zigbee stack is unknown */
+ } SCHI_SystemErrCode_t;
+
+#define SHCI_EVTCODE ( 0xFF )
+#define SHCI_SUB_EVT_CODE_BASE ( 0x9200 )
+
+ /**
+ * THE ORDER SHALL NOT BE CHANGED TO GUARANTEE COMPATIBILITY WITH THE CPU1 DEFINITION
+ */
+ typedef enum
+ {
+ SHCI_SUB_EVT_CODE_READY = SHCI_SUB_EVT_CODE_BASE,
+ SHCI_SUB_EVT_ERROR_NOTIF,
+ SHCI_SUB_EVT_BLE_NVM_RAM_UPDATE,
+ SHCI_SUB_EVT_THREAD_NVM_RAM_UPDATE,
+ SHCI_SUB_EVT_NVM_START_WRITE,
+ SHCI_SUB_EVT_NVM_END_WRITE,
+ SHCI_SUB_EVT_NVM_START_ERASE,
+ SHCI_SUB_EVT_NVM_END_ERASE,
+ SHCI_SUB_EVT_CODE_CONCURRENT_802154_EVT,
+ } SHCI_SUB_EVT_CODE_t;
+
+ /**
+ * SHCI_SUB_EVT_CODE_READY
+ * This notifies the CPU1 that the CPU2 is now ready to receive commands
+ * It reports as well which firmware is running on CPU2 : The wireless stack of the FUS (previously named RSS)
+ */
+ typedef PACKED_STRUCT{
+ SHCI_SysEvt_Ready_Rsp_t sysevt_ready_rsp;
+ } SHCI_C2_Ready_Evt_t;
+
+ /**
+ * SHCI_SUB_EVT_ERROR_NOTIF
+ * This reports to the CPU1 some error form the CPU2
+ */
+ typedef PACKED_STRUCT{
+ SCHI_SystemErrCode_t errorCode;
+ } SHCI_C2_ErrorNotif_Evt_t;
+
+ /**
+ * SHCI_SUB_EVT_BLE_NVM_RAM_UPDATE
+ * This notifies the CPU1 which part of the BLE NVM RAM has been updated so that only the modified
+ * section could be written in Flash/NVM
+ * StartAddress : Start address of the section that has been modified
+ * Size : Size (in bytes) of the section that has been modified
+ */
+ typedef PACKED_STRUCT{
+ uint32_t StartAddress;
+ uint32_t Size;
+ } SHCI_C2_BleNvmRamUpdate_Evt_t;
+
+ /**
+ * SHCI_SUB_EVT_THREAD_NVM_RAM_UPDATE
+ * This notifies the CPU1 which part of the OT NVM RAM has been updated so that only the modified
+ * section could be written in Flash/NVM
+ * StartAddress : Start address of the section that has been modified
+ * Size : Size (in bytes) of the section that has been modified
+ */
+ typedef PACKED_STRUCT{
+ uint32_t StartAddress;
+ uint32_t Size;
+ } SHCI_C2_ThreadNvmRamUpdate_Evt_t;
+
+ /**
+ * SHCI_SUB_EVT_NVM_START_WRITE
+ * This notifies the CPU1 that the CPU2 has started a write procedure in Flash
+ * NumberOfWords : The number of 64bits data the CPU2 needs to write in Flash.
+ * For each 64bits data, the algorithm as described in AN5289 is executed.
+ * When this number is reported to 0, it means the Number of 64bits to be written
+ * was unknown when the procedure has started.
+ * When all data are written, the SHCI_SUB_EVT_NVM_END_WRITE event is reported
+ */
+ typedef PACKED_STRUCT{
+ uint32_t NumberOfWords;
+ } SHCI_C2_NvmStartWrite_Evt_t;
+
+ /**
+ * SHCI_SUB_EVT_NVM_END_WRITE
+ * This notifies the CPU1 that the CPU2 has written all expected data in Flash
+ */
+
+ /**
+ * SHCI_SUB_EVT_NVM_START_ERASE
+ * This notifies the CPU1 that the CPU2 has started a erase procedure in Flash
+ * NumberOfSectors : The number of sectors the CPU2 needs to erase in Flash.
+ * For each sector, the algorithm as described in AN5289 is executed.
+ * When this number is reported to 0, it means the Number of sectors to be erased
+ * was unknown when the procedure has started.
+ * When all sectors are erased, the SHCI_SUB_EVT_NVM_END_ERASE event is reported
+ */
+ typedef PACKED_STRUCT{
+ uint32_t NumberOfSectors;
+ } SHCI_C2_NvmStartErase_Evt_t;
+
+ /**
+ * SHCI_SUB_EVT_NVM_END_ERASE
+ * This notifies the CPU1 that the CPU2 has erased all expected flash sectors
+ */
+
+ /* SYSTEM COMMAND */
+ typedef PACKED_STRUCT
+ {
+ /**
+ * MetaData holds :
+ * 2*32bits for chaining list
+ * 1*32bits with BLE header (type + Opcode + Length)
+ */
+ uint32_t MetaData[3];
+ } SHCI_Header_t;
+
+ typedef enum
+ {
+ SHCI_Success = 0x00,
+ SHCI_UNKNOWN_CMD = 0x01,
+ SHCI_MEMORY_CAPACITY_EXCEEDED_ERR_CODE= 0x07,
+ SHCI_ERR_UNSUPPORTED_FEATURE = 0x11,
+ SHCI_ERR_INVALID_HCI_CMD_PARAMS = 0x12,
+ SHCI_ERR_INVALID_PARAMS = 0x42, /* only used for release < v1.13.0 */
+ SHCI_ERR_INVALID_PARAMS_V2 = 0x92, /* available for release >= v1.13.0 */
+ SHCI_FUS_CMD_NOT_SUPPORTED = 0xFF,
+ } SHCI_CmdStatus_t;
+
+ typedef enum
+ {
+ SHCI_8BITS = 0x01,
+ SHCI_16BITS = 0x02,
+ SHCI_32BITS = 0x04,
+ } SHCI_Busw_t;
+
+#define SHCI_OGF ( 0x3F )
+#define SHCI_OCF_BASE ( 0x50 )
+
+ /**
+ * THE ORDER SHALL NOT BE CHANGED TO GUARANTEE COMPATIBILITY WITH THE CPU2 DEFINITION
+ */
+ typedef enum
+ {
+ SHCI_OCF_C2_RESERVED1 = SHCI_OCF_BASE,
+ SHCI_OCF_C2_RESERVED2,
+ SHCI_OCF_C2_FUS_GET_STATE,
+ SHCI_OCF_C2_FUS_RESERVED1,
+ SHCI_OCF_C2_FUS_FW_UPGRADE,
+ SHCI_OCF_C2_FUS_FW_DELETE,
+ SHCI_OCF_C2_FUS_UPDATE_AUTH_KEY,
+ SHCI_OCF_C2_FUS_LOCK_AUTH_KEY,
+ SHCI_OCF_C2_FUS_STORE_USR_KEY,
+ SHCI_OCF_C2_FUS_LOAD_USR_KEY,
+ SHCI_OCF_C2_FUS_START_WS,
+ SHCI_OCF_C2_FUS_RESERVED2,
+ SHCI_OCF_C2_FUS_RESERVED3,
+ SHCI_OCF_C2_FUS_LOCK_USR_KEY,
+ SHCI_OCF_C2_FUS_UNLOAD_USR_KEY,
+ SHCI_OCF_C2_FUS_ACTIVATE_ANTIROLLBACK,
+ SHCI_OCF_C2_FUS_RESERVED7,
+ SHCI_OCF_C2_FUS_RESERVED8,
+ SHCI_OCF_C2_FUS_RESERVED9,
+ SHCI_OCF_C2_FUS_RESERVED10,
+ SHCI_OCF_C2_FUS_RESERVED11,
+ SHCI_OCF_C2_FUS_RESERVED12,
+ SHCI_OCF_C2_BLE_INIT,
+ SHCI_OCF_C2_THREAD_INIT,
+ SHCI_OCF_C2_DEBUG_INIT,
+ SHCI_OCF_C2_FLASH_ERASE_ACTIVITY,
+ SHCI_OCF_C2_CONCURRENT_SET_MODE,
+ SHCI_OCF_C2_FLASH_STORE_DATA,
+ SHCI_OCF_C2_FLASH_ERASE_DATA,
+ SHCI_OCF_C2_RADIO_ALLOW_LOW_POWER,
+ SHCI_OCF_C2_MAC_802_15_4_INIT,
+ SHCI_OCF_C2_REINIT,
+ SHCI_OCF_C2_ZIGBEE_INIT,
+ SHCI_OCF_C2_LLD_TESTS_INIT,
+ SHCI_OCF_C2_EXTPA_CONFIG,
+ SHCI_OCF_C2_SET_FLASH_ACTIVITY_CONTROL,
+ SHCI_OCF_C2_BLE_LLD_INIT,
+ SHCI_OCF_C2_CONFIG,
+ SHCI_OCF_C2_CONCURRENT_GET_NEXT_BLE_EVT_TIME,
+ SHCI_OCF_C2_CONCURRENT_ENABLE_NEXT_802154_EVT_NOTIFICATION,
+ SHCI_OCF_C2_802_15_4_DEINIT,
+ SHCI_OCF_C2_SET_SYSTEM_CLOCK,
+ } SHCI_OCF_t;
+
+#define SHCI_OPCODE_C2_FUS_GET_STATE (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_GET_STATE)
+/** No command parameters */
+/** Response parameters*/
+/** It responds a 1 byte value holding FUS State error code when the FUS State value is 0xFF (FUS_STATE_VALUE_ERROR) */
+ typedef enum
+ {
+ FUS_STATE_ERROR_NO_ERROR = 0x00,
+ FUS_STATE_ERROR_IMG_NOT_FOUND = 0x01,
+ FUS_STATE_ERROR_IMG_CORRUPT = 0x02,
+ FUS_STATE_ERROR_IMG_NOT_AUTHENTIC = 0x03,
+ FUS_STATE_ERROR_IMG_NOT_ENOUGH_SPACE = 0x04,
+ FUS_STATE_ERROR_IMAGE_USRABORT = 0x05,
+ FUS_STATE_ERROR_IMAGE_ERSERROR = 0x06,
+ FUS_STATE_ERROR_IMAGE_WRTERROR = 0x07,
+ FUS_STATE_ERROR_AUTH_TAG_ST_NOTFOUND = 0x08,
+ FUS_STATE_ERROR_AUTH_TAG_CUST_NOTFOUND = 0x09,
+ FUS_STATE_ERROR_AUTH_KEY_LOCKED = 0x0A,
+ FUS_STATE_ERROR_FW_ROLLBACK_ERROR = 0x11,
+ FUS_STATE_ERROR_STATE_NOT_RUNNING = 0xFE,
+ FUS_STATE_ERROR_ERR_UNKNOWN = 0xFF,
+ } SHCI_FUS_GetState_ErrorCode_t;
+
+ enum
+ {
+ FUS_STATE_VALUE_IDLE = 0x00,
+ FUS_STATE_VALUE_FW_UPGRD_ONGOING = 0x10,
+ FUS_STATE_VALUE_FW_UPGRD_ONGOING_END = 0x1F, /* All values between 0x10 and 0x1F has the same meaning */
+ FUS_STATE_VALUE_FUS_UPGRD_ONGOING = 0x20,
+ FUS_STATE_VALUE_FUS_UPGRD_ONGOING_END = 0x2F, /* All values between 0x20 and 0x2F has the same meaning */
+ FUS_STATE_VALUE_SERVICE_ONGOING = 0x30,
+ FUS_STATE_VALUE_SERVICE_ONGOING_END = 0x3F, /* All values between 0x30 and 0x3F has the same meaning */
+ FUS_STATE_VALUE_ERROR = 0xFF,
+ };
+
+#define SHCI_OPCODE_C2_FUS_RESERVED1 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED1)
+/** No command parameters */
+/** No response parameters*/
+
+#define SHCI_OPCODE_C2_FUS_FW_UPGRADE (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_FW_UPGRADE)
+ /** No structure for command parameters */
+ /** No response parameters*/
+
+#define SHCI_OPCODE_C2_FUS_FW_DELETE (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_FW_DELETE)
+/** No command parameters */
+/** No response parameters*/
+
+#define SHCI_OPCODE_C2_FUS_UPDATE_AUTH_KEY (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_UPDATE_AUTH_KEY)
+ typedef PACKED_STRUCT{
+ uint8_t KeySize;
+ uint8_t KeyData[64];
+ } SHCI_C2_FUS_UpdateAuthKey_Cmd_Param_t;
+
+ /** No response parameters*/
+
+#define SHCI_OPCODE_C2_FUS_LOCK_AUTH_KEY (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_LOCK_AUTH_KEY)
+/** No command parameters */
+/** No response parameters*/
+
+#define SHCI_OPCODE_C2_FUS_STORE_USR_KEY (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_STORE_USR_KEY)
+ /** Command parameters */
+ /* List of supported key type */
+ enum
+ {
+ KEYTYPE_NONE = 0x00,
+ KEYTYPE_SIMPLE = 0x01,
+ KEYTYPE_MASTER = 0x02,
+ KEYTYPE_ENCRYPTED = 0x03,
+ };
+
+ /* List of supported key size */
+ enum
+ {
+ KEYSIZE_16 = 16,
+ KEYSIZE_32 = 32,
+ };
+
+ typedef PACKED_STRUCT{
+ uint8_t KeyType;
+ uint8_t KeySize;
+ uint8_t KeyData[32 + 12];
+ } SHCI_C2_FUS_StoreUsrKey_Cmd_Param_t;
+
+ /** Response parameters*/
+ /** It responds a 1 byte value holding the index given for the stored key */
+
+#define SHCI_OPCODE_C2_FUS_LOAD_USR_KEY (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_LOAD_USR_KEY)
+ /** Command parameters */
+ /** 1 byte holding the key index value */
+
+ /** No response parameters*/
+
+#define SHCI_OPCODE_C2_FUS_START_WS (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_START_WS)
+/** No command parameters */
+/** No response parameters*/
+
+#define SHCI_OPCODE_C2_FUS_RESERVED2 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED2)
+/** No command parameters */
+/** No response parameters*/
+
+#define SHCI_OPCODE_C2_FUS_RESERVED3 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED3)
+/** No command parameters */
+/** No response parameters*/
+
+#define SHCI_OPCODE_C2_FUS_LOCK_USR_KEY (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_LOCK_USR_KEY)
+ /** Command parameters */
+ /** 1 byte holding the key index value */
+
+ /** No response parameters*/
+
+#define SHCI_OPCODE_C2_FUS_UNLOAD_USR_KEY (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_UNLOAD_USR_KEY)
+/** No command parameters */
+/** 1 byte holding the key index value */
+
+#define SHCI_OPCODE_C2_FUS_ACTIVATE_ANTIROLLBACK (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_ACTIVATE_ANTIROLLBACK)
+/** No command parameters */
+/** No response parameters*/
+
+#define SHCI_OPCODE_C2_FUS_RESERVED7 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED7)
+/** No command parameters */
+/** No response parameters*/
+
+#define SHCI_OPCODE_C2_FUS_RESERVED8 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED8)
+/** No command parameters */
+/** No response parameters*/
+
+#define SHCI_OPCODE_C2_FUS_RESERVED9 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED9)
+/** No command parameters */
+/** No response parameters*/
+
+#define SHCI_OPCODE_C2_FUS_RESERVED10 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED10)
+/** No command parameters */
+/** No response parameters*/
+
+#define SHCI_OPCODE_C2_FUS_RESERVED11 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED11)
+/** No command parameters */
+/** No response parameters*/
+
+#define SHCI_OPCODE_C2_FUS_RESERVED12 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED12)
+/** No command parameters */
+/** No response parameters*/
+
+#define SHCI_OPCODE_C2_BLE_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_BLE_INIT)
+ /** THE ORDER SHALL NOT BE CHANGED */
+ typedef PACKED_STRUCT{
+ uint8_t* pBleBufferAddress; /**< NOT USED - shall be set to 0 */
+ uint32_t BleBufferSize; /**< NOT USED - shall be set to 0 */
+
+ /**
+ * NumAttrRecord
+ * Maximum number of attribute records related to all the required characteristics (excluding the services)
+ * that can be stored in the GATT database, for the specific BLE user application.
+ * For each characteristic, the number of attribute records goes from two to five depending on the characteristic properties:
+ * - minimum of two (one for declaration and one for the value)
+ * - add one more record for each additional property: notify or indicate, broadcast, extended property.
+ * The total calculated value must be increased by 9, due to the records related to the standard attribute profile and
+ * GAP service characteristics, and automatically added when initializing GATT and GAP layers
+ * - Min value: <number of user attributes> + 9
+ * - Max value: depending on the GATT database defined by user application
+ */
+ uint16_t NumAttrRecord;
+
+ /**
+ * NumAttrServ
+ * Defines the maximum number of services that can be stored in the GATT database. Note that the GAP and GATT services
+ * are automatically added at initialization so this parameter must be the number of user services increased by two.
+ * - Min value: <number of user service> + 2
+ * - Max value: depending GATT database defined by user application
+ */
+ uint16_t NumAttrServ;
+
+ /**
+ * AttrValueArrSize
+ * NOTE: This parameter is ignored by the CPU2 when the parameter "Options" is set to "LL_only" ( see Options description in that structure )
+ *
+ * Size of the storage area for the attribute values.
+ * Each characteristic contributes to the attrValueArrSize value as follows:
+ * - Characteristic value length plus:
+ * + 5 bytes if characteristic UUID is 16 bits
+ * + 19 bytes if characteristic UUID is 128 bits
+ * + 2 bytes if characteristic has a server configuration descriptor
+ * + 2 bytes * NumOfLinks if the characteristic has a client configuration descriptor
+ * + 2 bytes if the characteristic has extended properties
+ * Each descriptor contributes to the attrValueArrSize value as follows:
+ * - Descriptor length
+ */
+ uint16_t AttrValueArrSize;
+
+ /**
+ * NumOfLinks
+ * Maximum number of BLE links supported
+ * - Min value: 1
+ * - Max value: 8
+ */
+ uint8_t NumOfLinks;
+
+ /**
+ * ExtendedPacketLengthEnable
+ * Disable/enable the extended packet length BLE 5.0 feature
+ * - Disable: 0
+ * - Enable: 1
+ */
+ uint8_t ExtendedPacketLengthEnable;
+
+ /**
+ * PrWriteListSize
+ * NOTE: This parameter is ignored by the CPU2 when the parameter "Options" is set to "LL_only" ( see Options description in that structure )
+ *
+ * Maximum number of supported "prepare write request"
+ * - Min value: given by the macro DEFAULT_PREP_WRITE_LIST_SIZE
+ * - Max value: a value higher than the minimum required can be specified, but it is not recommended
+ */
+ uint8_t PrWriteListSize;
+
+ /**
+ * MblockCount
+ * NOTE: This parameter is overwritten by the CPU2 with an hardcoded optimal value when the parameter "Options" is set to "LL_only"
+ * ( see Options description in that structure )
+ *
+ * Number of allocated memory blocks for the BLE stack
+ * - Min value: given by the macro MBLOCKS_CALC
+ * - Max value: a higher value can improve data throughput performance, but uses more memory
+ */
+ uint8_t MblockCount;
+
+ /**
+ * AttMtu
+ * NOTE: This parameter is ignored by the CPU2 when the parameter "Options" is set to "LL_only" ( see Options description in that structure )
+ *
+ * Maximum ATT MTU size supported
+ * - Min value: 23
+ * - Max value: 512
+ */
+ uint16_t AttMtu;
+
+ /**
+ * PeripheralSca
+ * The sleep clock accuracy (ppm value) that used in BLE connected Peripheral mode to calculate the window widening
+ * (in combination with the sleep clock accuracy sent by master in CONNECT_REQ PDU),
+ * refer to BLE 5.0 specifications - Vol 6 - Part B - chap 4.5.7 and 4.2.2
+ * - Min value: 0
+ * - Max value: 500 (worst possible admitted by specification)
+ */
+ uint16_t PeripheralSca;
+
+ /**
+ * CentralSca
+ * The sleep clock accuracy handled in Central mode. It is used to determine the connection and advertising events timing.
+ * It is transmitted to the slave in CONNEC_REQ PDU used by the slave to calculate the window widening,
+ * see PeripheralSca and Bluetooth Core Specification v5.0 Vol 6 - Part B - chap 4.5.7 and 4.2.2
+ * Possible values:
+ * - 251 ppm to 500 ppm: 0
+ * - 151 ppm to 250 ppm: 1
+ * - 101 ppm to 150 ppm: 2
+ * - 76 ppm to 100 ppm: 3
+ * - 51 ppm to 75 ppm: 4
+ * - 31 ppm to 50 ppm: 5
+ * - 21 ppm to 30 ppm: 6
+ * - 0 ppm to 20 ppm: 7
+ */
+ uint8_t CentralSca;
+
+ /**
+ * LsSource
+ * Some information for Low speed clock mapped in bits field
+ * - bit 0: 1: Calibration for the RF system wakeup clock source 0: No calibration for the RF system wakeup clock source
+ * - bit 1: 1: STM32W5M Module device 0: Other devices as STM32WBxx SOC, STM32WB1M module
+ * - bit 2: 1: HSE/1024 Clock config 0: LSE Clock config
+ */
+ uint8_t LsSource;
+
+ /**
+ * MaxConnEventLength
+ * This parameter determines the maximum duration of a slave connection event. When this duration is reached the slave closes
+ * the current connections event (whatever is the CE_length parameter specified by the master in HCI_CREATE_CONNECTION HCI command),
+ * expressed in units of 625/256 us (~2.44 us)
+ * - Min value: 0 (if 0 is specified, the master and slave perform only a single TX-RX exchange per connection event)
+ * - Max value: 1638400 (4000 ms). A higher value can be specified (max 0xFFFFFFFF) but results in a maximum connection time
+ * of 4000 ms as specified. In this case the parameter is not applied, and the predicted CE length calculated on slave is not shortened
+ */
+ uint32_t MaxConnEventLength;
+
+ /**
+ * HsStartupTime
+ * Startup time of the high speed (16 or 32 MHz) crystal oscillator in units of 625/256 us (~2.44 us).
+ * - Min value: 0
+ * - Max value: 820 (~2 ms). A higher value can be specified, but the value that implemented in stack is forced to ~2 ms
+ */
+ uint16_t HsStartupTime;
+
+ /**
+ * ViterbiEnable
+ * Viterbi implementation in BLE LL reception.
+ * - 0: Enable
+ * - 1: Disable
+ */
+ uint8_t ViterbiEnable;
+
+ /**
+ * Options flags
+ * - bit 0: 1: LL only 0: LL + host
+ * - bit 1: 1: no service change desc. 0: with service change desc.
+ * - bit 2: 1: device name Read-Only 0: device name R/W
+ * - bit 3: 1: extended advertizing supported 0: extended advertizing not supported
+ * - bit 4: 1: CS Algo #2 supported 0: CS Algo #2 not supported
+ * - bit 5: 1: Reduced GATT database in NVM 0: Full GATT database in NVM
+ * - bit 6: 1: GATT caching is used 0: GATT caching is not used
+ * - bit 7: 1: LE Power Class 1 0: LE Power Class 2-3
+ * - other bits: complete with Options_extension flag
+ */
+ uint8_t Options;
+
+ /**
+ * HwVersion
+ * Reserved for future use - shall be set to 0
+ */
+ uint8_t HwVersion;
+
+ /**
+ * Maximum number of connection-oriented channels in initiator mode.
+ * Range: 0 .. 64
+ */
+ uint8_t max_coc_initiator_nbr;
+
+ /**
+ * Minimum transmit power in dBm supported by the Controller.
+ * Range: -127 .. 20
+ */
+ int8_t min_tx_power;
+
+ /**
+ * Maximum transmit power in dBm supported by the Controller.
+ * Range: -127 .. 20
+ */
+ int8_t max_tx_power;
+
+ /**
+ * RX model configuration
+ * - bit 0: 1: agc_rssi model improved vs RF blockers 0: Legacy agc_rssi model
+ * - other bits: reserved ( shall be set to 0)
+ */
+ uint8_t rx_model_config;
+
+ /** Maximum number of advertising sets.
+ * Range: 1 .. 8 with limitation:
+ * This parameter is linked to max_adv_data_len such as both compliant with allocated Total memory computed with BLE_EXT_ADV_BUFFER_SIZE based
+ * on Max Extended advertising configuration supported.
+ * This parameter is considered by the CPU2 when Options has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set
+ */
+ uint8_t max_adv_set_nbr;
+
+ /** Maximum advertising data length (in bytes)
+ * Range: 31 .. 1650 with limitation:
+ * This parameter is linked to max_adv_set_nbr such as both compliant with allocated Total memory computed with BLE_EXT_ADV_BUFFER_SIZE based
+ * on Max Extended advertising configuration supported.
+ * This parameter is considered by the CPU2 when Options has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set
+ */
+ uint16_t max_adv_data_len;
+
+ /** RF TX Path Compensation Value (16-bit signed integer). Units: 0.1 dB.
+ * Range: -1280 .. 1280
+ */
+ int16_t tx_path_compens;
+
+ /** RF RX Path Compensation Value (16-bit signed integer). Units: 0.1 dB.
+ * Range: -1280 .. 1280
+ */
+ int16_t rx_path_compens;
+
+ /** BLE core specification version (8-bit unsigned integer).
+ * values as: 11(5.2), 12(5.3), 13(5.4)
+ */
+ uint8_t ble_core_version;
+
+ /**
+ * Options flags extension
+ * - bit 0: 1: appearance Writable 0: appearance Read-Only
+ * - bit 1: 1: Enhanced ATT supported 0: Enhanced ATT not supported
+ * - other bits: reserved ( shall be set to 0)
+ */
+ uint8_t Options_extension;
+
+ /**
+ * MaxAddEattBearers
+ *
+ * Maximum number of bearers that can be created for Enhanced ATT
+ * in addition to the number of links
+ * - Range: 0 .. 4
+ */
+ uint8_t MaxAddEattBearers;
+
+ } SHCI_C2_Ble_Init_Cmd_Param_t;
+
+ typedef PACKED_STRUCT{
+ SHCI_Header_t Header; /** Does not need to be initialized by the user */
+ SHCI_C2_Ble_Init_Cmd_Param_t Param;
+ } SHCI_C2_Ble_Init_Cmd_Packet_t;
+
+ /**
+ * Options
+ * Each definition below may be added together to build the Options value
+ * WARNING : Only one definition per bit shall be added to build the Options value
+ */
+#define SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY (1<<0)
+#define SHCI_C2_BLE_INIT_OPTIONS_LL_HOST (0<<0)
+
+#define SHCI_C2_BLE_INIT_OPTIONS_NO_SVC_CHANGE_DESC (1<<1)
+#define SHCI_C2_BLE_INIT_OPTIONS_WITH_SVC_CHANGE_DESC (0<<1)
+
+#define SHCI_C2_BLE_INIT_OPTIONS_DEVICE_NAME_RO (1<<2)
+#define SHCI_C2_BLE_INIT_OPTIONS_DEVICE_NAME_RW (0<<2)
+
+#define SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV (1<<3)
+#define SHCI_C2_BLE_INIT_OPTIONS_NO_EXT_ADV (0<<3)
+
+#define SHCI_C2_BLE_INIT_OPTIONS_CS_ALGO2 (1<<4)
+#define SHCI_C2_BLE_INIT_OPTIONS_NO_CS_ALGO2 (0<<4)
+
+#define SHCI_C2_BLE_INIT_OPTIONS_REDUC_GATTDB_NVM (1<<5)
+#define SHCI_C2_BLE_INIT_OPTIONS_FULL_GATTDB_NVM (0<<5)
+
+#define SHCI_C2_BLE_INIT_OPTIONS_GATT_CACHING_USED (1<<6)
+#define SHCI_C2_BLE_INIT_OPTIONS_GATT_CACHING_NOTUSED (0<<6)
+
+#define SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_1 (1<<7)
+#define SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_2_3 (0<<7)
+
+ /**
+ * Options extension
+ * Each definition below may be added together to build the Options value
+ * WARNING : Only one definition per bit shall be added to build the Options value
+ */
+#define SHCI_C2_BLE_INIT_OPTIONS_APPEARANCE_WRITABLE (1<<0)
+#define SHCI_C2_BLE_INIT_OPTIONS_APPEARANCE_READONLY (0<<0)
+
+#define SHCI_C2_BLE_INIT_OPTIONS_ENHANCED_ATT_SUPPORTED (1<<1)
+#define SHCI_C2_BLE_INIT_OPTIONS_ENHANCED_ATT_NOTSUPPORTED (0<<1)
+
+ /**
+ * RX models configuration
+ */
+#define SHCI_C2_BLE_INIT_RX_MODEL_AGC_RSSI_LEGACY (0<<0)
+#define SHCI_C2_BLE_INIT_RX_MODEL_AGC_RSSI_BLOCKER (1<<0)
+
+ /**
+ * BLE core version
+ */
+#define SHCI_C2_BLE_INIT_BLE_CORE_5_2 11
+#define SHCI_C2_BLE_INIT_BLE_CORE_5_3 12
+#define SHCI_C2_BLE_INIT_BLE_CORE_5_4 13
+
+ /**
+ * LsSource information
+ */
+#define SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB (0<<0)
+#define SHCI_C2_BLE_INIT_CFG_BLE_LS_CALIB (1<<0)
+#define SHCI_C2_BLE_INIT_CFG_BLE_LS_OTHER_DEV (0<<1)
+#define SHCI_C2_BLE_INIT_CFG_BLE_LS_MOD5MM_DEV (1<<1)
+#define SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE (0<<2)
+#define SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_HSE_1024 (1<<2)
+
+#define SHCI_OPCODE_C2_THREAD_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_THREAD_INIT)
+/** No command parameters */
+/** No response parameters*/
+
+#define SHCI_OPCODE_C2_DEBUG_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_DEBUG_INIT)
+ /** Command parameters */
+ typedef PACKED_STRUCT
+ {
+ uint8_t thread_config;
+ uint8_t ble_config;
+ uint8_t mac_802_15_4_config;
+ uint8_t zigbee_config;
+ } SHCI_C2_DEBUG_TracesConfig_t;
+
+ typedef PACKED_STRUCT
+ {
+ uint8_t ble_dtb_cfg;
+ /**
+ * sys_dbg_cfg1 options flag
+ * - bit 0: 0: IP BLE core in LP mode 1: IP BLE core in run mode (no LP supported)
+ * - bit 1: 0: CPU2 STOP mode Enable 1: CPU2 STOP mode Disable
+ * - bit [2-7]: bits reserved ( shall be set to 0)
+ */
+ uint8_t sys_dbg_cfg1;
+ uint8_t reserved[2];
+ uint16_t STBY_DebugGpioaPinList;
+ uint16_t STBY_DebugGpiobPinList;
+ uint16_t STBY_DebugGpiocPinList;
+ uint16_t STBY_DtbGpioaPinList;
+ uint16_t STBY_DtbGpiobPinList;
+ } SHCI_C2_DEBUG_GeneralConfig_t;
+
+ typedef PACKED_STRUCT{
+ uint8_t *pGpioConfig;
+ uint8_t *pTracesConfig;
+ uint8_t *pGeneralConfig;
+ uint8_t GpioConfigSize;
+ uint8_t TracesConfigSize;
+ uint8_t GeneralConfigSize;
+ } SHCI_C2_DEBUG_init_Cmd_Param_t;
+
+ typedef PACKED_STRUCT{
+ SHCI_Header_t Header; /** Does not need to be initialized by the user */
+ SHCI_C2_DEBUG_init_Cmd_Param_t Param;
+ } SHCI_C2_DEBUG_Init_Cmd_Packet_t;
+ /** No response parameters*/
+
+ /**
+ * Options
+ * Each definition below may be added together to build the Options value
+ * WARNING : Only one definition per bit shall be added to build the Options value
+ */
+#define SHCI_C2_DEBUG_OPTIONS_IPCORE_LP (0<<0)
+#define SHCI_C2_DEBUG_OPTIONS_IPCORE_NO_LP (1<<0)
+
+#define SHCI_C2_DEBUG_OPTIONS_CPU2_STOP_EN (0<<1)
+#define SHCI_C2_DEBUG_OPTIONS_CPU2_STOP_DIS (1<<1)
+
+
+#define SHCI_OPCODE_C2_FLASH_ERASE_ACTIVITY (( SHCI_OGF << 10) + SHCI_OCF_C2_FLASH_ERASE_ACTIVITY)
+ /** Command parameters */
+ typedef enum
+ {
+ ERASE_ACTIVITY_OFF = 0x00,
+ ERASE_ACTIVITY_ON = 0x01,
+ } SHCI_EraseActivity_t;
+
+ /** No response parameters*/
+
+#define SHCI_OPCODE_C2_CONCURRENT_SET_MODE (( SHCI_OGF << 10) + SHCI_OCF_C2_CONCURRENT_SET_MODE)
+/** command parameters */
+ typedef enum
+ {
+ BLE_ENABLE,
+ THREAD_ENABLE,
+ ZIGBEE_ENABLE,
+ MAC_ENABLE,
+ } SHCI_C2_CONCURRENT_Mode_Param_t;
+ /** No response parameters*/
+
+#define SHCI_OPCODE_C2_CONCURRENT_GET_NEXT_BLE_EVT_TIME (( SHCI_OGF << 10) + SHCI_OCF_C2_CONCURRENT_GET_NEXT_BLE_EVT_TIME)
+/** command parameters */
+ typedef PACKED_STRUCT
+ {
+ uint32_t relative_time;
+ } SHCI_C2_CONCURRENT_GetNextBleEvtTime_Param_t;
+ /** No response parameters*/
+
+#define SHCI_OPCODE_C2_CONCURRENT_ENABLE_NEXT_802154_EVT_NOTIFICATION (( SHCI_OGF << 10) + SHCI_OCF_C2_CONCURRENT_ENABLE_NEXT_802154_EVT_NOTIFICATION)
+ /** No command parameters */
+ /** No response parameters*/
+
+#define SHCI_OPCODE_C2_FLASH_STORE_DATA (( SHCI_OGF << 10) + SHCI_OCF_C2_FLASH_STORE_DATA)
+#define SHCI_OPCODE_C2_FLASH_ERASE_DATA (( SHCI_OGF << 10) + SHCI_OCF_C2_FLASH_ERASE_DATA)
+/** command parameters */
+ typedef enum
+ {
+ BLE_IP,
+ THREAD_IP,
+ ZIGBEE_IP,
+ } SHCI_C2_FLASH_Ip_t;
+ /** No response parameters*/
+
+#define SHCI_OPCODE_C2_RADIO_ALLOW_LOW_POWER (( SHCI_OGF << 10) + SHCI_OCF_C2_RADIO_ALLOW_LOW_POWER)
+
+#define SHCI_OPCODE_C2_MAC_802_15_4_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_MAC_802_15_4_INIT)
+
+#define SHCI_OPCODE_C2_REINIT (( SHCI_OGF << 10) + SHCI_OCF_C2_REINIT)
+
+#define SHCI_OPCODE_C2_ZIGBEE_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_ZIGBEE_INIT)
+
+#define SHCI_OPCODE_C2_LLD_TESTS_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_LLD_TESTS_INIT)
+
+#define SHCI_OPCODE_C2_BLE_LLD_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_BLE_LLD_INIT)
+
+#define SHCI_OPCODE_C2_EXTPA_CONFIG (( SHCI_OGF << 10) + SHCI_OCF_C2_EXTPA_CONFIG)
+ /** Command parameters */
+ enum
+ {
+ EXT_PA_ENABLED_LOW,
+ EXT_PA_ENABLED_HIGH,
+ }/* gpio_polarity */;
+
+ enum
+ {
+ EXT_PA_DISABLED,
+ EXT_PA_ENABLED,
+ }/* gpio_status */;
+
+ typedef PACKED_STRUCT{
+ uint32_t gpio_port;
+ uint16_t gpio_pin_number;
+ uint8_t gpio_polarity;
+ uint8_t gpio_status;
+ } SHCI_C2_EXTPA_CONFIG_Cmd_Param_t;
+
+ /** No response parameters*/
+
+#define SHCI_OPCODE_C2_SET_FLASH_ACTIVITY_CONTROL (( SHCI_OGF << 10) + SHCI_OCF_C2_SET_FLASH_ACTIVITY_CONTROL)
+ /** Command parameters */
+ typedef enum
+ {
+ FLASH_ACTIVITY_CONTROL_PES,
+ FLASH_ACTIVITY_CONTROL_SEM7,
+ }SHCI_C2_SET_FLASH_ACTIVITY_CONTROL_Source_t;
+
+ /** No response parameters*/
+
+#define SHCI_OPCODE_C2_CONFIG (( SHCI_OGF << 10) + SHCI_OCF_C2_CONFIG)
+
+ /** Command parameters */
+ typedef PACKED_STRUCT{
+ uint8_t PayloadCmdSize;
+ uint8_t Config1;
+ uint8_t EvtMask1;
+ uint8_t Spare1;
+ uint32_t BleNvmRamAddress;
+ uint32_t ThreadNvmRamAddress;
+ uint16_t RevisionID;
+ uint16_t DeviceID;
+ } SHCI_C2_CONFIG_Cmd_Param_t;
+
+#define SHCI_OPCODE_C2_802_15_4_DEINIT (( SHCI_OGF << 10) + SHCI_OCF_C2_802_15_4_DEINIT)
+
+#define SHCI_OPCODE_C2_SET_SYSTEM_CLOCK (( SHCI_OGF << 10) + SHCI_OCF_C2_SET_SYSTEM_CLOCK)
+ /** Command parameters */
+ typedef enum
+ {
+ SET_SYSTEM_CLOCK_HSE_TO_PLL,
+ SET_SYSTEM_CLOCK_PLL_ON_TO_HSE,
+ SET_SYSTEM_CLOCK_PLL_OFF_TO_HSE,
+ }SHCI_C2_SET_SYSTEM_CLOCK_Cmd_Param_t;
+
+/**
+ * PayloadCmdSize
+ * Value that shall be used
+ */
+#define SHCI_C2_CONFIG_PAYLOAD_CMD_SIZE (sizeof(SHCI_C2_CONFIG_Cmd_Param_t) - 1)
+
+/**
+ * Device revision ID
+ */
+#define SHCI_C2_CONFIG_CUT2_0 (0x2000)
+#define SHCI_C2_CONFIG_CUT2_1 (0x2001)
+#define SHCI_C2_CONFIG_CUT2_2 (0x2003)
+
+/**
+ * Device ID
+ */
+#define SHCI_C2_CONFIG_STM32WB55xx (0x495)
+#define SHCI_C2_CONFIG_STM32WB15xx (0x494)
+
+/**
+ * Config1
+ * Each definition below may be added together to build the Config1 value
+ * WARNING : Only one definition per bit shall be added to build the Config1 value
+ */
+#define SHCI_C2_CONFIG_CONFIG1_BIT0_BLE_NVM_DATA_TO_INTERNAL_FLASH (0<<0)
+#define SHCI_C2_CONFIG_CONFIG1_BIT0_BLE_NVM_DATA_TO_SRAM (1<<0)
+#define SHCI_C2_CONFIG_CONFIG1_BIT1_THREAD_NVM_DATA_TO_INTERNAL_FLASH (0<<1)
+#define SHCI_C2_CONFIG_CONFIG1_BIT1_THREAD_NVM_DATA_TO_SRAM (1<<1)
+#define SHCI_C2_CONFIG_CONFIG1_BIT2_SET_EUI64_FORMAT (1<<2)
+
+/**
+ * EvtMask1
+ * Each definition below may be added together to build the EvtMask1 value
+ */
+#define SHCI_C2_CONFIG_EVTMASK1_BIT0_ERROR_NOTIF_ENABLE (1<<0)
+#define SHCI_C2_CONFIG_EVTMASK1_BIT1_BLE_NVM_RAM_UPDATE_ENABLE (1<<1)
+#define SHCI_C2_CONFIG_EVTMASK1_BIT2_THREAD_NVM_RAM_UPDATE_ENABLE (1<<2)
+#define SHCI_C2_CONFIG_EVTMASK1_BIT3_NVM_START_WRITE_ENABLE (1<<3)
+#define SHCI_C2_CONFIG_EVTMASK1_BIT4_NVM_END_WRITE_ENABLE (1<<4)
+#define SHCI_C2_CONFIG_EVTMASK1_BIT5_NVM_START_ERASE_ENABLE (1<<5)
+#define SHCI_C2_CONFIG_EVTMASK1_BIT6_NVM_END_ERASE_ENABLE (1<<6)
+
+/**
+ * BleNvmRamAddress
+ * The buffer shall have a size of BLE_NVM_SRAM_SIZE number of 32bits
+ * The buffer shall be allocated in SRAM2
+ */
+#define BLE_NVM_SRAM_SIZE (507)
+
+/**
+ * ThreadNvmRamAddress
+ * The buffer shall have a size of THREAD_NVM_SRAM_SIZE number of 32bits
+ * The buffer shall be allocated in SRAM2
+ */
+#define THREAD_NVM_SRAM_SIZE (1016)
+
+
+ /** No response parameters*/
+
+ /* Exported type --------------------------------------------------------*/
+#define FUS_DEVICE_INFO_TABLE_VALIDITY_KEYWORD (0xA94656B9)
+
+/*
+ * At startup, the information relative to the wireless binary are stored in RAM through a structure defined by
+ * MB_WirelessFwInfoTable_t.This structure contains 4 fields (Version,MemorySize, Stack_info and a reserved part)
+ * each of those coded on 32 bits as shown on the table below:
+ *
+ *
+ * |7 |6 |5 |4 |3 |2 |1 |0 |7 |6 |5 |4 |3 |2 |1 |0 |7 |6 |5 |4 |3 |2 |1 |0 |7 |6 |5 |4 |3 |2 |1 |0 |
+ * -------------------------------------------------------------------------------------------------
+ * Version | Major version | Minor version | Sub version | Branch |ReleaseType|
+ * -------------------------------------------------------------------------------------------------
+ * MemorySize | SRAM2B (kB) | SRAM2A (kB) | SRAM1 (kB) | FLASH (4kb) |
+ * -------------------------------------------------------------------------------------------------
+ * Info stack | Reserved | Reserved | Reserved | Type (MAC,Thread,BLE) |
+ * -------------------------------------------------------------------------------------------------
+ * Reserved | Reserved | Reserved | Reserved | Reserved |
+ * -------------------------------------------------------------------------------------------------
+ *
+ */
+
+/* Field Version */
+#define INFO_VERSION_MAJOR_OFFSET 24
+#define INFO_VERSION_MAJOR_MASK 0xff000000
+#define INFO_VERSION_MINOR_OFFSET 16
+#define INFO_VERSION_MINOR_MASK 0x00ff0000
+#define INFO_VERSION_SUB_OFFSET 8
+#define INFO_VERSION_SUB_MASK 0x0000ff00
+#define INFO_VERSION_BRANCH_OFFSET 4
+#define INFO_VERSION_BRANCH_MASK 0x0000000f0
+#define INFO_VERSION_TYPE_OFFSET 0
+#define INFO_VERSION_TYPE_MASK 0x00000000f
+
+#define INFO_VERSION_TYPE_RELEASE 1
+
+/* Field Memory */
+#define INFO_SIZE_SRAM2B_OFFSET 24
+#define INFO_SIZE_SRAM2B_MASK 0xff000000
+#define INFO_SIZE_SRAM2A_OFFSET 16
+#define INFO_SIZE_SRAM2A_MASK 0x00ff0000
+#define INFO_SIZE_SRAM1_OFFSET 8
+#define INFO_SIZE_SRAM1_MASK 0x0000ff00
+#define INFO_SIZE_FLASH_OFFSET 0
+#define INFO_SIZE_FLASH_MASK 0x000000ff
+
+/* Field stack information */
+#define INFO_STACK_TYPE_OFFSET 0
+#define INFO_STACK_TYPE_MASK 0x000000ff
+#define INFO_STACK_TYPE_NONE 0
+
+#define INFO_STACK_TYPE_BLE_FULL 0x01
+#define INFO_STACK_TYPE_BLE_HCI 0x02
+#define INFO_STACK_TYPE_BLE_LIGHT 0x03
+#define INFO_STACK_TYPE_BLE_BEACON 0x04
+#define INFO_STACK_TYPE_BLE_BASIC 0x05
+#define INFO_STACK_TYPE_BLE_FULL_EXT_ADV 0x06
+#define INFO_STACK_TYPE_BLE_HCI_EXT_ADV 0x07
+#define INFO_STACK_TYPE_THREAD_FTD 0x10
+#define INFO_STACK_TYPE_THREAD_MTD 0x11
+#define INFO_STACK_TYPE_ZIGBEE_FFD 0x30
+#define INFO_STACK_TYPE_ZIGBEE_RFD 0x31
+#define INFO_STACK_TYPE_MAC 0x40
+#define INFO_STACK_TYPE_BLE_THREAD_FTD_STATIC 0x50
+#define INFO_STACK_TYPE_BLE_THREAD_FTD_DYNAMIC 0x51
+#define INFO_STACK_TYPE_BLE_THREAD_LIGHT_DYNAMIC 0x52
+#define INFO_STACK_TYPE_802154_LLD_TESTS 0x60
+#define INFO_STACK_TYPE_802154_PHY_VALID 0x61
+#define INFO_STACK_TYPE_BLE_PHY_VALID 0x62
+#define INFO_STACK_TYPE_BLE_LLD_TESTS 0x63
+#define INFO_STACK_TYPE_BLE_RLV 0x64
+#define INFO_STACK_TYPE_802154_RLV 0x65
+#define INFO_STACK_TYPE_BLE_ZIGBEE_FFD_STATIC 0x70
+#define INFO_STACK_TYPE_BLE_ZIGBEE_RFD_STATIC 0x71
+#define INFO_STACK_TYPE_BLE_ZIGBEE_FFD_DYNAMIC 0x78
+#define INFO_STACK_TYPE_BLE_ZIGBEE_RFD_DYNAMIC 0x79
+#define INFO_STACK_TYPE_RLV 0x80
+#define INFO_STACK_TYPE_BLE_MAC_STATIC 0x90
+
+typedef struct {
+/**
+ * Wireless Info
+ */
+ uint8_t VersionMajor;
+ uint8_t VersionMinor;
+ uint8_t VersionSub;
+ uint8_t VersionBranch;
+ uint8_t VersionReleaseType;
+ uint8_t MemorySizeSram2B; /*< Multiple of 1K */
+ uint8_t MemorySizeSram2A; /*< Multiple of 1K */
+ uint8_t MemorySizeSram1; /*< Multiple of 1K */
+ uint8_t MemorySizeFlash; /*< Multiple of 4K */
+ uint8_t StackType;
+/**
+ * Fus Info
+ */
+ uint8_t FusVersionMajor;
+ uint8_t FusVersionMinor;
+ uint8_t FusVersionSub;
+ uint8_t FusMemorySizeSram2B; /*< Multiple of 1K */
+ uint8_t FusMemorySizeSram2A; /*< Multiple of 1K */
+ uint8_t FusMemorySizeFlash; /*< Multiple of 4K */
+}WirelessFwInfo_t;
+
+
+/* Exported functions ------------------------------------------------------- */
+
+ /**
+ * SHCI_C2_FUS_GetState
+ * @brief Read the FUS State
+ * If the user is not interested by the Error code response, a null value may
+ * be passed as parameter
+ *
+ * Note: This command is fully supported only by the FUS.
+ * When the wireless firmware receives that command, it responds SHCI_FUS_CMD_NOT_SUPPORTED the first time.
+ * When the wireless firmware receives that command a second time, it reboots the full device with the FUS running on CPU2
+ *
+ * @param p_rsp : return the error code when the FUS State Value = 0xFF
+ * @retval FUS State Values
+ */
+ uint8_t SHCI_C2_FUS_GetState( SHCI_FUS_GetState_ErrorCode_t *p_rsp );
+
+ /**
+ * SHCI_C2_FUS_FwUpgrade
+ * @brief Request the FUS to install the CPU2 firmware update
+ * Note: This command is only supported by the FUS.
+ *
+ * @param fw_src_add: Address of the firmware image location
+ * @param fw_dest_add: Address of the firmware destination
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_FUS_FwUpgrade( uint32_t fw_src_add, uint32_t fw_dest_add );
+
+ /**
+ * SHCI_C2_FUS_FwDelete
+ * @brief Delete the wireless stack on CPU2
+ * Note: This command is only supported by the FUS.
+ *
+ * @param None
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_FUS_FwDelete( void );
+
+ /**
+ * SHCI_C2_FUS_UpdateAuthKey
+ * @brief Request the FUS to update the authentication key
+ * Note: This command is only supported by the FUS.
+ *
+ * @param pCmdPacket
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_FUS_UpdateAuthKey( SHCI_C2_FUS_UpdateAuthKey_Cmd_Param_t *pParam );
+
+ /**
+ * SHCI_C2_FUS_LockAuthKey
+ * @brief Request the FUS to prevent any future update of the authentication key
+ * Note: This command is only supported by the FUS.
+ *
+ * @param None
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_FUS_LockAuthKey( void );
+
+ /**
+ * SHCI_C2_FUS_StoreUsrKey
+ * @brief Request the FUS to store the user key
+ * Note: This command is supported by both the FUS and the wireless stack.
+ *
+ * @param pParam : command parameter
+ * @param p_key_index : Index allocated by the FUS to the stored key
+ *
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_FUS_StoreUsrKey( SHCI_C2_FUS_StoreUsrKey_Cmd_Param_t *pParam, uint8_t *p_key_index );
+
+ /**
+ * SHCI_C2_FUS_LoadUsrKey
+ * @brief Request the FUS to load the user key into the AES
+ * Note: This command is supported by both the FUS and the wireless stack.
+ *
+ * @param key_index : index of the user key to load in AES1
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_FUS_LoadUsrKey( uint8_t key_index );
+
+ /**
+ * SHCI_C2_FUS_StartWs
+ * @brief Request the FUS to reboot on the wireless stack
+ * Note: This command is only supported by the FUS.
+ *
+ * @param None
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_FUS_StartWs( void );
+
+ /**
+ * SHCI_C2_FUS_LockUsrKey
+ * @brief Request the FUS to lock the user key so that it cannot be updated later on
+ * Note: This command is supported by both the FUS and the wireless stack.
+ *
+ * @param key_index : index of the user key to lock
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_FUS_LockUsrKey( uint8_t key_index );
+
+ /**
+ * SHCI_C2_FUS_UnloadUsrKey
+ * @brief Request the FUS to Unload the user key so that the CPU1 may use the AES with another Key
+ * Note: This command is supported by both the FUS and the wireless stack.
+ *
+ * @param key_index : index of the user key to unload
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_FUS_UnloadUsrKey( uint8_t key_index );
+
+ /**
+ * SHCI_C2_FUS_ActivateAntiRollback
+ * @brief Request the FUS to enable the AntiRollback feature so that it is not possible to update the wireless firmware
+ * with an older version than the current one.
+ * Note:
+ * - This command is only supported by the FUS.
+ * - Once this feature is enabled, it is not possible anymore to disable it.
+ *
+ * @param None
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_FUS_ActivateAntiRollback( void );
+
+ /**
+ * SHCI_C2_BLE_Init
+ * @brief Provides parameters and starts the BLE Stack
+ *
+ * @param pCmdPacket : Parameters are described SHCI_C2_Ble_Init_Cmd_Packet_t declaration
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_BLE_Init( SHCI_C2_Ble_Init_Cmd_Packet_t *pCmdPacket );
+
+ /**
+ * SHCI_C2_THREAD_Init
+ * @brief Starts the THREAD Stack
+ *
+ * @param None
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_THREAD_Init( void );
+
+ /**
+ * SHCI_C2_LLDTESTS_Init
+ * @brief Starts the LLD tests CLI
+ *
+ * @param param_size : Nb of bytes
+ * @param p_param : pointer with data to give from M4 to M0
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_LLDTESTS_Init( uint8_t param_size, uint8_t * p_param );
+
+ /**
+ * SHCI_C2_BLE_LLD_Init
+ * @brief Starts the LLD tests BLE
+ *
+ * @param param_size : Nb of bytes
+ * @param p_param : pointer with data to give from M4 to M0
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_BLE_LLD_Init( uint8_t param_size, uint8_t * p_param );
+
+ /**
+ * SHCI_C2_ZIGBEE_Init
+ * @brief Starts the Zigbee Stack
+ *
+ * @param None
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_ZIGBEE_Init( void );
+
+ /**
+ * SHCI_C2_DEBUG_Init
+ * @brief Starts the Traces
+ *
+ * @param None
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_DEBUG_Init( SHCI_C2_DEBUG_Init_Cmd_Packet_t *pCmdPacket );
+
+ /**
+ * SHCI_C2_FLASH_EraseActivity
+ * @brief Provides the information of the start and the end of a flash erase window on the CPU1
+ * The protection will be active until next end of radio event.
+ *
+ * @param erase_activity: Start/End of erase activity
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_FLASH_EraseActivity( SHCI_EraseActivity_t erase_activity );
+
+ /**
+ * SHCI_C2_CONCURRENT_SetMode
+ * @brief Enable/Disable Thread on CPU2 (M0+)
+ *
+ * @param Mode: BLE or Thread enable flag
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_CONCURRENT_SetMode( SHCI_C2_CONCURRENT_Mode_Param_t Mode );
+
+ /**
+ * SHCI_C2_CONCURRENT_GetNextBleEvtTime
+ * @brief Get the next BLE event date (relative time)
+ *
+ * @param Command Packet
+ * @retval None
+ */
+ SHCI_CmdStatus_t SHCI_C2_CONCURRENT_GetNextBleEvtTime( SHCI_C2_CONCURRENT_GetNextBleEvtTime_Param_t *pParam );
+
+ /**
+ * SHCI_C2_CONCURRENT_EnableNext_802154_EvtNotification
+ * @brief Activate the next 802.15.4 event notification (one shot)
+ *
+ * @param None
+ * @retval None
+ */
+ SHCI_CmdStatus_t SHCI_C2_CONCURRENT_EnableNext_802154_EvtNotification( void );
+
+ /**
+ * SHCI_C2_FLASH_StoreData
+ * @brief Store Data in Flash
+ *
+ * @param Ip: BLE or THREAD
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_FLASH_StoreData( SHCI_C2_FLASH_Ip_t Ip );
+
+ /**
+ * SHCI_C2_FLASH_EraseData
+ * @brief Erase Data in Flash
+ *
+ * @param Ip: BLE or THREAD
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_FLASH_EraseData( SHCI_C2_FLASH_Ip_t Ip );
+
+ /**
+ * SHCI_C2_RADIO_AllowLowPower
+ * @brief Allow or forbid IP_radio (802_15_4 or BLE) to enter in low power mode.
+ *
+ * @param Ip: BLE or 802_15_5
+ * @param FlagRadioLowPowerOn: True or false
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_RADIO_AllowLowPower( SHCI_C2_FLASH_Ip_t Ip,uint8_t FlagRadioLowPowerOn);
+
+
+ /**
+ * SHCI_C2_MAC_802_15_4_Init
+ * @brief Starts the MAC 802.15.4 on M0
+ *
+ * @param None
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_MAC_802_15_4_Init( void );
+
+ /**
+ * SHCI_GetWirelessFwInfo
+ * @brief This function read back the information relative to the wireless binary loaded.
+ * Refer yourself to MB_WirelessFwInfoTable_t structure to get the significance
+ * of the different parameters returned.
+ * @param pWirelessInfo : Pointer to WirelessFwInfo_t.
+ *
+ * @retval SHCI_Success
+ */
+ SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo );
+
+ /**
+ * SHCI_C2_Reinit
+ * @brief This is required to allow the CPU1 to fake a set C2BOOT when it has already been set.
+ * In order to fake a C2BOOT, the CPU1 shall :
+ * - Send SHCI_C2_Reinit()
+ * - call SEV instruction
+ * WARNING:
+ * This function is intended to be used by the SBSFU
+ *
+ * @param None
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_Reinit( void );
+
+ /**
+ * SHCI_C2_ExtpaConfig
+ * @brief Send the Ext PA configuration
+ * When the CPU2 receives the command, it controls the Ext PA as requested by the configuration
+ * This configures only which IO is used to enable/disable the ExtPA and the associated polarity
+ * This command has no effect on the other IO that is used to control the mode of the Ext PA (Rx/Tx)
+ *
+ * @param gpio_port: GPIOx where x can be (A..F) to select the GPIO peripheral for STM32WBxx family
+ * @param gpio_pin_number: This parameter can be one of GPIO_PIN_x (= LL_GPIO_PIN_x) where x can be (0..15).
+ * @param gpio_polarity: This parameter can be either
+ * - EXT_PA_ENABLED_LOW: ExtPA is enabled when GPIO is low
+ * - EXT_PA_ENABLED_HIGH: ExtPA is enabled when GPIO is high
+ * @param gpio_status: This parameter can be either
+ * - EXT_PA_DISABLED: Stop driving the ExtPA
+ * - EXT_PA_ENABLED: Drive the ExtPA according to radio activity
+ * (ON before the Event and OFF at the end of the event)
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_ExtpaConfig(uint32_t gpio_port, uint16_t gpio_pin_number, uint8_t gpio_polarity, uint8_t gpio_status);
+
+ /**
+ * SHCI_C2_SetFlashActivityControl
+ * @brief Set the mechanism to be used on CPU2 to prevent the CPU1 to either write or erase in flash
+ *
+ * @param Source: It can be one of the following list
+ * - FLASH_ACTIVITY_CONTROL_PES : The CPU2 set the PES bit to prevent the CPU1 to either read or write in flash
+ * - FLASH_ACTIVITY_CONTROL_SEM7 : The CPU2 gets the semaphore 7 to prevent the CPU1 to either read or write in flash.
+ * This requires the CPU1 to first get semaphore 7 before erasing or writing the flash.
+ *
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_SetFlashActivityControl(SHCI_C2_SET_FLASH_ACTIVITY_CONTROL_Source_t Source);
+
+ /**
+ * SHCI_C2_Config
+ * @brief Send the system configuration to the CPU2
+ *
+ * @param pCmdPacket: address of the buffer holding following parameters
+ * uint8_t PayloadCmdSize : Size of the payload - shall be SHCI_C2_CONFIG_PAYLOAD_CMD_SIZE
+ * uint8_t Config1 :
+ * - bit0 : 0 - BLE NVM Data data are flushed in internal secure flash
+ * 1 - BLE NVM Data are written in SRAM cache pointed by BleNvmRamAddress
+ * - bit1 : 0 - THREAD NVM Data data are flushed in internal secure flash
+ * 1 - THREAD NVM Data are written in SRAM cache pointed by ThreadNvmRamAddress
+ * - bit2 : 0 - Thread EUI64 is set to new (and current) format
+ * 1 - Thread EUI64 is set to old format
+ * - bit3 to bit7 : Unused, shall be set to 0
+ * uint8_t EvtMask1 :
+ * When a bit is set to 0, the event is not reported
+ * bit0 : Asynchronous Event with Sub Evt Code 0x9201 (= SHCI_SUB_EVT_ERROR_NOTIF)
+ * ...
+ * bit31 : Asynchronous Event with Sub Evt Code 0x9220
+ * uint8_t Spare1 : Unused, shall be set to 0
+ * uint32_t BleNvmRamAddress :
+ * Only considered when Config1.bit0 = 1
+ * When set to 0, data are kept in internal SRAM on CPU2
+ * Otherwise, data are copied in the cache pointed by BleNvmRamAddress
+ * The size of the buffer shall be BLE_NVM_SRAM_SIZE (number of 32bits)
+ * The buffer shall be allocated in SRAM2
+ * uint32_t ThreadNvmRamAddress :
+ * Only considered when Config1.bit1 = 1
+ * When set to 0, data are kept in internal SRAM on CPU2
+ * Otherwise, data are copied in the cache pointed by ThreadNvmRamAddress
+ * The size of the buffer shall be THREAD_NVM_SRAM_SIZE (number of 32bits)
+ * The buffer shall be allocated in SRAM1
+ *
+ * Please check macro definition to be used for this function
+ * They are defined in this file next to the definition of SHCI_OPCODE_C2_CONFIG
+ *
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_Config(SHCI_C2_CONFIG_Cmd_Param_t *pCmdPacket);
+
+ /**
+ * SHCI_C2_802_15_4_DeInit
+ * @brief Deinit 802.15.4 layer (to be used before entering StandBy mode)
+ *
+ * @param None
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_802_15_4_DeInit( void );
+
+ /**
+ * SHCI_C2_SetSystemClock
+ * @brief Request CPU2 to change system clock
+ *
+ * @param clockSel: It can be one of the following list
+ * - SET_SYSTEM_CLOCK_HSE_TO_PLL : CPU2 set system clock to PLL, PLL must be configured and started before.
+ * - SET_SYSTEM_CLOCK_PLL_ON_TO_HSE : CPU2 set System clock to HSE, PLL is still ON after command execution.
+ * - SET_SYSTEM_CLOCK_PLL_OFF_TO_HSE : CPU2 set System clock to HSE, PLL is turned OFF after command execution.
+ *
+ * @retval Status
+ */
+ SHCI_CmdStatus_t SHCI_C2_SetSystemClock( SHCI_C2_SET_SYSTEM_CLOCK_Cmd_Param_t clockSel );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__SHCI_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/hci_tl.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/hci_tl.c
new file mode 100644
index 0000000..2786e14
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/hci_tl.c
@@ -0,0 +1,308 @@
+/**
+ ******************************************************************************
+ * @file hci_tl.c
+ * @author MCD Application Team
+ * @brief Function for managing HCI interface.
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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.
+ *
+ ******************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "ble_common.h"
+#include "ble_const.h"
+
+#include "stm_list.h"
+#include "tl.h"
+#include "hci_tl.h"
+
+/* Private typedef -----------------------------------------------------------*/
+typedef enum
+{
+ HCI_TL_CMD_RESP_RELEASE,
+ HCI_TL_CMD_RESP_WAIT,
+} HCI_TL_CmdRespStatus_t;
+
+/* Private defines -----------------------------------------------------------*/
+
+/**
+ * The default HCI layer timeout is set to 33s
+ */
+#define HCI_TL_DEFAULT_TIMEOUT (33000)
+
+/* Private macros ------------------------------------------------------------*/
+/* Public variables ---------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/**
+ * START of Section BLE_DRIVER_CONTEXT
+ */
+PLACE_IN_SECTION("BLE_DRIVER_CONTEXT") static volatile uint8_t hci_timer_id;
+PLACE_IN_SECTION("BLE_DRIVER_CONTEXT") static tListNode HciAsynchEventQueue;
+PLACE_IN_SECTION("BLE_DRIVER_CONTEXT") static TL_CmdPacket_t *pCmdBuffer;
+PLACE_IN_SECTION("BLE_DRIVER_CONTEXT") HCI_TL_UserEventFlowStatus_t UserEventFlow;
+/**
+ * END of Section BLE_DRIVER_CONTEXT
+ */
+
+static tHciContext hciContext;
+static tListNode HciCmdEventQueue;
+static void (* StatusNotCallBackFunction) (HCI_TL_CmdStatus_t status);
+static volatile HCI_TL_CmdRespStatus_t CmdRspStatusFlag;
+
+/* Private function prototypes -----------------------------------------------*/
+static void NotifyCmdStatus(HCI_TL_CmdStatus_t hcicmdstatus);
+static void SendCmd(uint16_t opcode, uint8_t plen, void *param);
+static void TlEvtReceived(TL_EvtPacket_t *hcievt);
+static void TlInit( TL_CmdPacket_t * p_cmdbuffer );
+
+/* Interface ------- ---------------------------------------------------------*/
+void hci_init(void(* UserEvtRx)(void* pData), void* pConf)
+{
+ StatusNotCallBackFunction = ((HCI_TL_HciInitConf_t *)pConf)->StatusNotCallBack;
+ hciContext.UserEvtRx = UserEvtRx;
+
+ hci_register_io_bus (&hciContext.io);
+
+ TlInit((TL_CmdPacket_t *)(((HCI_TL_HciInitConf_t *)pConf)->p_cmdbuffer));
+
+ return;
+}
+
+void hci_user_evt_proc(void)
+{
+ TL_EvtPacket_t *phcievtbuffer;
+ tHCI_UserEvtRxParam UserEvtRxParam;
+
+ /**
+ * Up to release version v1.2.0, a while loop was implemented to read out events from the queue as long as
+ * it is not empty. However, in a bare metal implementation, this leads to calling in a "blocking" mode
+ * hci_user_evt_proc() as long as events are received without giving the opportunity to run other tasks
+ * in the background.
+ * From now, the events are reported one by one. When it is checked there is still an event pending in the queue,
+ * a request to the user is made to call again hci_user_evt_proc().
+ * This gives the opportunity to the application to run other background tasks between each event.
+ */
+
+ /**
+ * It is more secure to use LST_remove_head()/LST_insert_head() compare to LST_get_next_node()/LST_remove_node()
+ * in case the user overwrite the header where the next/prev pointers are located
+ */
+
+ if((LST_is_empty(&HciAsynchEventQueue) == FALSE) && (UserEventFlow != HCI_TL_UserEventFlow_Disable))
+ {
+ LST_remove_head ( &HciAsynchEventQueue, (tListNode **)&phcievtbuffer );
+
+ if (hciContext.UserEvtRx != NULL)
+ {
+ UserEvtRxParam.pckt = phcievtbuffer;
+ UserEvtRxParam.status = HCI_TL_UserEventFlow_Enable;
+ hciContext.UserEvtRx((void *)&UserEvtRxParam);
+ UserEventFlow = UserEvtRxParam.status;
+ }
+ else
+ {
+ UserEventFlow = HCI_TL_UserEventFlow_Enable;
+ }
+
+ if(UserEventFlow != HCI_TL_UserEventFlow_Disable)
+ {
+ TL_MM_EvtDone( phcievtbuffer );
+ }
+ else
+ {
+ /**
+ * put back the event in the queue
+ */
+ LST_insert_head ( &HciAsynchEventQueue, (tListNode *)phcievtbuffer );
+ }
+ }
+
+ if((LST_is_empty(&HciAsynchEventQueue) == FALSE) && (UserEventFlow != HCI_TL_UserEventFlow_Disable))
+ {
+ hci_notify_asynch_evt((void*) &HciAsynchEventQueue);
+ }
+
+
+ return;
+}
+
+void hci_resume_flow( void )
+{
+ UserEventFlow = HCI_TL_UserEventFlow_Enable;
+
+ /**
+ * It is better to go through the background process as it is not sure from which context this API may
+ * be called
+ */
+ hci_notify_asynch_evt((void*) &HciAsynchEventQueue);
+
+ return;
+}
+
+int hci_send_req(struct hci_request *p_cmd, uint8_t async)
+{
+ (void)(async);
+ uint16_t opcode;
+ TL_CcEvt_t *pcommand_complete_event;
+ TL_CsEvt_t *pcommand_status_event;
+ TL_EvtPacket_t *pevtpacket;
+ uint8_t hci_cmd_complete_return_parameters_length;
+ HCI_TL_CmdStatus_t local_cmd_status;
+
+ NotifyCmdStatus(HCI_TL_CmdBusy);
+ local_cmd_status = HCI_TL_CmdBusy;
+ opcode = ((p_cmd->ocf) & 0x03ff) | ((p_cmd->ogf) << 10);
+
+ CmdRspStatusFlag = HCI_TL_CMD_RESP_WAIT;
+ SendCmd(opcode, p_cmd->clen, p_cmd->cparam);
+
+ while(local_cmd_status == HCI_TL_CmdBusy)
+ {
+ hci_cmd_resp_wait(HCI_TL_DEFAULT_TIMEOUT);
+
+ /**
+ * Process Cmd Event
+ */
+ while(LST_is_empty(&HciCmdEventQueue) == FALSE)
+ {
+ LST_remove_head (&HciCmdEventQueue, (tListNode **)&pevtpacket);
+
+ if(pevtpacket->evtserial.evt.evtcode == TL_BLEEVT_CS_OPCODE)
+ {
+ pcommand_status_event = (TL_CsEvt_t*)pevtpacket->evtserial.evt.payload;
+ if(pcommand_status_event->cmdcode == opcode)
+ {
+ *(uint8_t *)(p_cmd->rparam) = pcommand_status_event->status;
+ }
+
+ if(pcommand_status_event->numcmd != 0)
+ {
+ local_cmd_status = HCI_TL_CmdAvailable;
+ }
+ }
+ else
+ {
+ pcommand_complete_event = (TL_CcEvt_t*)pevtpacket->evtserial.evt.payload;
+
+ if(pcommand_complete_event->cmdcode == opcode)
+ {
+ hci_cmd_complete_return_parameters_length = pevtpacket->evtserial.evt.plen - TL_EVT_HDR_SIZE;
+ p_cmd->rlen = MIN(hci_cmd_complete_return_parameters_length, p_cmd->rlen);
+ memcpy(p_cmd->rparam, pcommand_complete_event->payload, p_cmd->rlen);
+ }
+
+ if(pcommand_complete_event->numcmd != 0)
+ {
+ local_cmd_status = HCI_TL_CmdAvailable;
+ }
+ }
+ }
+ }
+
+ NotifyCmdStatus(HCI_TL_CmdAvailable);
+
+ return 0;
+}
+
+/* Private functions ---------------------------------------------------------*/
+static void TlInit( TL_CmdPacket_t * p_cmdbuffer )
+{
+ TL_BLE_InitConf_t Conf;
+
+ /**
+ * Always initialize the command event queue
+ */
+ LST_init_head (&HciCmdEventQueue);
+
+ pCmdBuffer = p_cmdbuffer;
+
+ LST_init_head (&HciAsynchEventQueue);
+
+ UserEventFlow = HCI_TL_UserEventFlow_Enable;
+
+ /* Initialize low level driver */
+ if (hciContext.io.Init)
+ {
+
+ Conf.p_cmdbuffer = (uint8_t *)p_cmdbuffer;
+ Conf.IoBusEvtCallBack = TlEvtReceived;
+ hciContext.io.Init(&Conf);
+ }
+
+ return;
+}
+
+static void SendCmd(uint16_t opcode, uint8_t plen, void *param)
+{
+ pCmdBuffer->cmdserial.cmd.cmdcode = opcode;
+ pCmdBuffer->cmdserial.cmd.plen = plen;
+ memcpy( pCmdBuffer->cmdserial.cmd.payload, param, plen );
+
+ hciContext.io.Send(0,0);
+
+ return;
+}
+
+static void NotifyCmdStatus(HCI_TL_CmdStatus_t hcicmdstatus)
+{
+ if(hcicmdstatus == HCI_TL_CmdBusy)
+ {
+ if(StatusNotCallBackFunction != 0)
+ {
+ StatusNotCallBackFunction(HCI_TL_CmdBusy);
+ }
+ }
+ else
+ {
+ if(StatusNotCallBackFunction != 0)
+ {
+ StatusNotCallBackFunction(HCI_TL_CmdAvailable);
+ }
+ }
+
+ return;
+}
+
+static void TlEvtReceived(TL_EvtPacket_t *hcievt)
+{
+ if ( ((hcievt->evtserial.evt.evtcode) == TL_BLEEVT_CS_OPCODE) || ((hcievt->evtserial.evt.evtcode) == TL_BLEEVT_CC_OPCODE ) )
+ {
+ LST_insert_tail(&HciCmdEventQueue, (tListNode *)hcievt);
+ hci_cmd_resp_release(0); /**< Notify the application a full Cmd Event has been received */
+ }
+ else
+ {
+ LST_insert_tail(&HciAsynchEventQueue, (tListNode *)hcievt);
+ hci_notify_asynch_evt((void*) &HciAsynchEventQueue); /**< Notify the application a full HCI event has been received */
+ }
+
+ return;
+}
+
+/* Weak implementation ----------------------------------------------------------------*/
+__WEAK void hci_cmd_resp_wait(uint32_t timeout)
+{
+ (void)timeout;
+
+ while(CmdRspStatusFlag != HCI_TL_CMD_RESP_RELEASE);
+
+ return;
+}
+
+__WEAK void hci_cmd_resp_release(uint32_t flag)
+{
+ (void)flag;
+
+ CmdRspStatusFlag = HCI_TL_CMD_RESP_RELEASE;
+
+ return;
+}
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/hci_tl.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/hci_tl.h
new file mode 100644
index 0000000..c43c9e0
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/hci_tl.h
@@ -0,0 +1,196 @@
+/**
+ ******************************************************************************
+ * @file hci_tl.h
+ * @author MCD Application Team
+ * @brief Constants and functions for HCI layer. See Bluetooth Core
+ * v 4.0, Vol. 2, Part E.
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __HCI_TL_H_
+#define __HCI_TL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "stm32_wpan_common.h"
+#include "tl.h"
+
+/* Exported defines -----------------------------------------------------------*/
+typedef enum
+{
+ HCI_TL_UserEventFlow_Disable,
+ HCI_TL_UserEventFlow_Enable,
+} HCI_TL_UserEventFlowStatus_t;
+
+typedef enum
+{
+ HCI_TL_CmdBusy,
+ HCI_TL_CmdAvailable
+} HCI_TL_CmdStatus_t;
+
+/**
+ * @brief Structure used to manage the BUS IO operations.
+ * All the structure fields will point to functions defined at user level.
+ * @{
+ */
+typedef struct
+{
+ int32_t (* Init) (void* pConf); /**< Pointer to HCI TL function for the IO Bus initialization */
+ int32_t (* DeInit) (void); /**< Pointer to HCI TL function for the IO Bus de-initialization */
+ int32_t (* Reset) (void); /**< Pointer to HCI TL function for the IO Bus reset */
+ int32_t (* Receive) (uint8_t*, uint16_t); /**< Pointer to HCI TL function for the IO Bus data reception */
+ int32_t (* Send) (uint8_t*, uint16_t); /**< Pointer to HCI TL function for the IO Bus data transmission */
+ int32_t (* DataAck) (uint8_t*, uint16_t* len); /**< Pointer to HCI TL function for the IO Bus data ack reception */
+ int32_t (* GetTick) (void); /**< Pointer to BSP function for getting the HAL time base timestamp */
+} tHciIO;
+/**
+ * @}
+ */
+
+/**
+ * @brief Contain the HCI context
+ * @{
+ */
+typedef struct
+{
+ tHciIO io; /**< Manage the BUS IO operations */
+ void (* UserEvtRx) (void * pData); /**< ACI events callback function pointer */
+} tHciContext;
+
+typedef struct
+{
+ HCI_TL_UserEventFlowStatus_t status;
+ TL_EvtPacket_t *pckt;
+} tHCI_UserEvtRxParam;
+
+typedef struct
+{
+ uint8_t *p_cmdbuffer;
+ void (* StatusNotCallBack) (HCI_TL_CmdStatus_t status);
+} HCI_TL_HciInitConf_t;
+
+/**
+ * @brief Register IO bus services.
+ * @param fops The HCI IO structure managing the IO BUS
+ * @retval None
+ */
+void hci_register_io_bus(tHciIO* fops);
+
+/**
+ * @brief This callback is called from either
+ * - IPCC RX interrupt context
+ * - hci_user_evt_proc() context.
+ * - hci_resume_flow() context
+ * It requests hci_user_evt_proc() to be executed.
+ *
+ * @param pdata Packet or event pointer
+ * @retval None
+ */
+void hci_notify_asynch_evt(void* pdata);
+
+/**
+ * @brief This function resume the User Event Flow which has been stopped on return
+ * from UserEvtRx() when the User Event has not been processed.
+ *
+ * @param None
+ * @retval None
+ */
+void hci_resume_flow(void);
+
+
+/**
+ * @brief This function is called when an ACI/HCI command is sent to the CPU2 and the response is waited.
+ * It is called from the same context the HCI command has been sent.
+ * It shall not return until the command response notified by hci_cmd_resp_release() is received.
+ * A weak implementation is available in hci_tl.c based on polling mechanism
+ * The user may re-implement this function in the application to improve performance :
+ * - It may use UTIL_SEQ_WaitEvt() API when using the Sequencer
+ * - It may use a semaphore when using cmsis_os interface
+ *
+ * @param timeout: Waiting timeout
+ * @retval None
+ */
+void hci_cmd_resp_wait(uint32_t timeout);
+
+/**
+ * @brief This function is called when an ACI/HCI command response is received from the CPU2.
+ * A weak implementation is available in hci_tl.c based on polling mechanism
+ * The user may re-implement this function in the application to improve performance :
+ * - It may use UTIL_SEQ_SetEvt() API when using the Sequencer
+ * - It may use a semaphore when using cmsis_os interface
+ *
+ * @param flag: Release flag
+ * @retval None
+ */
+void hci_cmd_resp_release(uint32_t flag);
+
+
+
+/**
+ * END OF SECTION - FUNCTIONS TO BE IMPLEMENTED BY THE APPLICATION
+ *********************************************************************************************************************
+ */
+
+
+/**
+ *********************************************************************************************************************
+ * START OF SECTION - PROCESS TO BE CALLED BY THE SCHEDULER
+ */
+
+/**
+ * @brief This process shall be called by the scheduler each time it is requested with hci_notify_asynch_evt()
+ * This process may send an ACI/HCI command when the svc_ctl.c module is used
+ *
+ * @param None
+ * @retval None
+ */
+
+void hci_user_evt_proc(void);
+
+/**
+ * END OF SECTION - PROCESS TO BE CALLED BY THE SCHEDULER
+ *********************************************************************************************************************
+ */
+
+
+/**
+ *********************************************************************************************************************
+ * START OF SECTION - INTERFACES USED BY THE BLE DRIVER
+ */
+
+/**
+ * @brief Initialize the Host Controller Interface.
+ * This function must be called before any data can be received
+ * from BLE controller.
+ *
+ * @param pData: ACI events callback function pointer
+ * This callback is triggered when an user event is received from
+ * the BLE core device.
+ * @param pConf: Configuration structure pointer
+ * @retval None
+ */
+void hci_init(void(* UserEvtRx)(void* pData), void* pConf);
+
+/**
+ * END OF SECTION - INTERFACES USED BY THE BLE DRIVER
+ *********************************************************************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TL_BLE_HCI_H_ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/hci_tl_if.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/hci_tl_if.c
new file mode 100644
index 0000000..8e57045
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/hci_tl_if.c
@@ -0,0 +1,30 @@
+/**
+ ******************************************************************************
+ * @file hci_tl_if.c
+ * @author MCD Application Team
+ * @brief Transport layer interface to BLE
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ ******************************************************************************
+ */
+
+#include "hci_tl.h"
+#include "tl.h"
+
+
+void hci_register_io_bus(tHciIO* fops)
+{
+ /* Register IO bus services */
+ fops->Init = TL_BLE_Init;
+ fops->Send = TL_BLE_SendCmd;
+
+ return;
+}
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/mbox_def.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/mbox_def.h
new file mode 100644
index 0000000..68b71f9
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/mbox_def.h
@@ -0,0 +1,280 @@
+/**
+ ******************************************************************************
+ * @file mbox_def.h
+ * @author MCD Application Team
+ * @brief Mailbox definition
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __MBOX_H
+#define __MBOX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "stm32_wpan_common.h"
+
+ /**
+ * This file shall be identical between the CPU1 and the CPU2
+ */
+
+ /**
+ *********************************************************************************
+ * TABLES
+ *********************************************************************************
+ */
+
+ /**
+ * Version
+ * [0:3] = Build - 0: Untracked - 15:Released - x: Tracked version
+ * [4:7] = branch - 0: Mass Market - x: ...
+ * [8:15] = Subversion
+ * [16:23] = Version minor
+ * [24:31] = Version major
+ *
+ * Memory Size
+ * [0:7] = Flash ( Number of 4k sector)
+ * [8:15] = Reserved ( Shall be set to 0 - may be used as flash extension )
+ * [16:23] = SRAM2b ( Number of 1k sector)
+ * [24:31] = SRAM2a ( Number of 1k sector)
+ */
+ typedef PACKED_STRUCT
+ {
+ uint32_t Version;
+ } MB_SafeBootInfoTable_t;
+
+ typedef PACKED_STRUCT
+ {
+ uint32_t Version;
+ uint32_t MemorySize;
+ uint32_t FusInfo;
+ } MB_FusInfoTable_t;
+
+ typedef PACKED_STRUCT
+ {
+ uint32_t Version;
+ uint32_t MemorySize;
+ uint32_t InfoStack;
+ uint32_t Reserved;
+ } MB_WirelessFwInfoTable_t;
+
+ typedef struct
+ {
+ MB_SafeBootInfoTable_t SafeBootInfoTable;
+ MB_FusInfoTable_t FusInfoTable;
+ MB_WirelessFwInfoTable_t WirelessFwInfoTable;
+ } MB_DeviceInfoTable_t;
+
+ typedef struct
+ {
+ uint8_t *pcmd_buffer;
+ uint8_t *pcs_buffer;
+ uint8_t *pevt_queue;
+ uint8_t *phci_acl_data_buffer;
+ } MB_BleTable_t;
+
+ typedef struct
+ {
+ uint8_t *notack_buffer;
+ uint8_t *clicmdrsp_buffer;
+ uint8_t *otcmdrsp_buffer;
+ uint8_t *clinot_buffer;
+ } MB_ThreadTable_t;
+
+ typedef struct
+ {
+ uint8_t *clicmdrsp_buffer;
+ uint8_t *m0cmd_buffer;
+ } MB_LldTestsTable_t;
+
+ typedef struct
+ {
+ uint8_t *cmdrsp_buffer;
+ uint8_t *m0cmd_buffer;
+ } MB_BleLldTable_t;
+
+ typedef struct
+ {
+ uint8_t *notifM0toM4_buffer;
+ uint8_t *appliCmdM4toM0_buffer;
+ uint8_t *requestM0toM4_buffer;
+ } MB_ZigbeeTable_t;
+ /**
+ * msg
+ * [0:7] = cmd/evt
+ * [8:31] = Reserved
+ */
+ typedef struct
+ {
+ uint8_t *pcmd_buffer;
+ uint8_t *sys_queue;
+ } MB_SysTable_t;
+
+ typedef struct
+ {
+ uint8_t *spare_ble_buffer;
+ uint8_t *spare_sys_buffer;
+ uint8_t *blepool;
+ uint32_t blepoolsize;
+ uint8_t *pevt_free_buffer_queue;
+ uint8_t *traces_evt_pool;
+ uint32_t tracespoolsize;
+ } MB_MemManagerTable_t;
+
+ typedef struct
+ {
+ uint8_t *traces_queue;
+ } MB_TracesTable_t;
+
+ typedef struct
+ {
+ uint8_t *p_cmdrsp_buffer;
+ uint8_t *p_notack_buffer;
+ uint8_t *evt_queue;
+ } MB_Mac_802_15_4_t;
+
+ typedef struct
+ {
+ MB_DeviceInfoTable_t *p_device_info_table;
+ MB_BleTable_t *p_ble_table;
+ MB_ThreadTable_t *p_thread_table;
+ MB_SysTable_t *p_sys_table;
+ MB_MemManagerTable_t *p_mem_manager_table;
+ MB_TracesTable_t *p_traces_table;
+ MB_Mac_802_15_4_t *p_mac_802_15_4_table;
+ MB_ZigbeeTable_t *p_zigbee_table;
+ MB_LldTestsTable_t *p_lld_tests_table;
+ MB_BleLldTable_t *p_ble_lld_table;
+} MB_RefTable_t;
+
+/**
+ * This table shall be used only in the case the CPU2 runs the FUS.
+ * It is used by the command SHCI_GetWirelessFwInfo()
+ */
+typedef struct
+{
+ uint32_t DeviceInfoTableState;
+ uint8_t Reserved1;
+ uint8_t LastFusActiveState;
+ uint8_t LastWirelessStackState;
+ uint8_t CurrentWirelessStackType;
+ uint32_t SafeBootVersion;
+ uint32_t FusVersion;
+ uint32_t FusMemorySize;
+ uint32_t WirelessStackVersion;
+ uint32_t WirelessStackMemorySize;
+ uint32_t WirelessFirmwareBleInfo;
+ uint32_t WirelessFirmwareThreadInfo;
+ uint32_t Reserved2;
+ uint64_t UID64;
+ uint16_t DeviceId;
+} MB_FUS_DeviceInfoTable_t ;
+
+#ifdef __cplusplus
+}
+#endif
+
+/**
+ *********************************************************************************
+ * IPCC CHANNELS
+ *********************************************************************************
+ */
+
+/* CPU1 CPU2
+ * | (SYSTEM) |
+ * |----HW_IPCC_SYSTEM_CMD_RSP_CHANNEL-------------->|
+ * | |
+ * |<---HW_IPCC_SYSTEM_EVENT_CHANNEL-----------------|
+ * | |
+ * | (ZIGBEE) |
+ * |----HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL------------>|
+ * | |
+ * |----HW_IPCC_ZIGBEE_CMD_CLI_CHANNEL-------------->|
+ * | |
+ * |<---HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL-------|
+ * | |
+ * |<---HW_IPCC_ZIGBEE_CLI_NOTIF_ACK_CHANNEL---------|
+ * | |
+ * | (THREAD) |
+ * |----HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL----------->|
+ * | |
+ * |----HW_IPCC_THREAD_CLI_CMD_CHANNEL-------------->|
+ * | |
+ * |<---HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL------|
+ * | |
+ * |<---HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL--|
+ * | |
+ * | (BLE) |
+ * |----HW_IPCC_BLE_CMD_CHANNEL--------------------->|
+ * | |
+ * |----HW_IPCC_HCI_ACL_DATA_CHANNEL---------------->|
+ * | |
+ * |<---HW_IPCC_BLE_EVENT_CHANNEL--------------------|
+ * | |
+ * | (BLE LLD) |
+ * |----HW_IPCC_BLE_LLD_CMD_CHANNEL----------------->|
+ * | |
+ * |<---HW_IPCC_BLE_LLD_RSP_CHANNEL------------------|
+ * | |
+ * |<---HW_IPCC_BLE_LLD_M0_CMD_CHANNEL---------------|
+ * | |
+ * | (MAC) |
+ * |----HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL-------->|
+ * | |
+ * |<---HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL|
+ * | |
+ * | (BUFFER) |
+ * |----HW_IPCC_MM_RELEASE_BUFFER_CHANNE------------>|
+ * | |
+ * | (TRACE) |
+ * |<----HW_IPCC_TRACES_CHANNEL----------------------|
+ * | |
+ *
+ *
+ *
+ */
+
+
+
+/** CPU1 */
+#define HW_IPCC_BLE_CMD_CHANNEL LL_IPCC_CHANNEL_1
+#define HW_IPCC_SYSTEM_CMD_RSP_CHANNEL LL_IPCC_CHANNEL_2
+#define HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL LL_IPCC_CHANNEL_3
+#define HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL LL_IPCC_CHANNEL_3
+#define HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL LL_IPCC_CHANNEL_3
+#define HW_IPCC_MM_RELEASE_BUFFER_CHANNEL LL_IPCC_CHANNEL_4
+#define HW_IPCC_THREAD_CLI_CMD_CHANNEL LL_IPCC_CHANNEL_5
+#define HW_IPCC_LLDTESTS_CLI_CMD_CHANNEL LL_IPCC_CHANNEL_5
+#define HW_IPCC_BLE_LLD_CLI_CMD_CHANNEL LL_IPCC_CHANNEL_5
+#define HW_IPCC_BLE_LLD_CMD_CHANNEL LL_IPCC_CHANNEL_5
+#define HW_IPCC_HCI_ACL_DATA_CHANNEL LL_IPCC_CHANNEL_6
+
+/** CPU2 */
+#define HW_IPCC_BLE_EVENT_CHANNEL LL_IPCC_CHANNEL_1
+#define HW_IPCC_SYSTEM_EVENT_CHANNEL LL_IPCC_CHANNEL_2
+#define HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL LL_IPCC_CHANNEL_3
+#define HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL LL_IPCC_CHANNEL_3
+#define HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL LL_IPCC_CHANNEL_3
+#define HW_IPCC_LLDTESTS_M0_CMD_CHANNEL LL_IPCC_CHANNEL_3
+#define HW_IPCC_BLE_LLD_M0_CMD_CHANNEL LL_IPCC_CHANNEL_3
+#define HW_IPCC_TRACES_CHANNEL LL_IPCC_CHANNEL_4
+#define HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL LL_IPCC_CHANNEL_5
+#define HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL LL_IPCC_CHANNEL_5
+#define HW_IPCC_BLE_LLD_CLI_RSP_CHANNEL LL_IPCC_CHANNEL_5
+#define HW_IPCC_BLE_LLD_RSP_CHANNEL LL_IPCC_CHANNEL_5
+#define HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL LL_IPCC_CHANNEL_5
+#endif /*__MBOX_H */
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl.c
new file mode 100644
index 0000000..0936f32
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl.c
@@ -0,0 +1,254 @@
+/**
+ ******************************************************************************
+ * @file shci.c
+ * @author MCD Application Team
+ * @brief System HCI command implementation
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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.
+ *
+ ******************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32_wpan_common.h"
+
+#include "stm_list.h"
+#include "shci_tl.h"
+
+/* Private typedef -----------------------------------------------------------*/
+typedef enum
+{
+ SHCI_TL_CMD_RESP_RELEASE,
+ SHCI_TL_CMD_RESP_WAIT,
+} SHCI_TL_CmdRespStatus_t;
+
+/* Private defines -----------------------------------------------------------*/
+/**
+ * The default System HCI layer timeout is set to 33s
+ */
+#define SHCI_TL_DEFAULT_TIMEOUT (33000)
+
+/* Private macros ------------------------------------------------------------*/
+/* Public variables ---------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/**
+ * START of Section SYSTEM_DRIVER_CONTEXT
+ */
+PLACE_IN_SECTION("SYSTEM_DRIVER_CONTEXT") static tListNode SHciAsynchEventQueue;
+PLACE_IN_SECTION("SYSTEM_DRIVER_CONTEXT") static volatile SHCI_TL_CmdStatus_t SHCICmdStatus;
+PLACE_IN_SECTION("SYSTEM_DRIVER_CONTEXT") static TL_CmdPacket_t *pCmdBuffer;
+PLACE_IN_SECTION("SYSTEM_DRIVER_CONTEXT") SHCI_TL_UserEventFlowStatus_t SHCI_TL_UserEventFlow;
+/**
+ * END of Section SYSTEM_DRIVER_CONTEXT
+ */
+
+static tSHciContext shciContext;
+static void (* StatusNotCallBackFunction) (SHCI_TL_CmdStatus_t status);
+
+static volatile SHCI_TL_CmdRespStatus_t CmdRspStatusFlag;
+
+/* Private function prototypes -----------------------------------------------*/
+static void Cmd_SetStatus(SHCI_TL_CmdStatus_t shcicmdstatus);
+static void TlCmdEvtReceived(TL_EvtPacket_t *shcievt);
+static void TlUserEvtReceived(TL_EvtPacket_t *shcievt);
+static void TlInit( TL_CmdPacket_t * p_cmdbuffer );
+
+/* Interface ------- ---------------------------------------------------------*/
+void shci_init(void(* UserEvtRx)(void* pData), void* pConf)
+{
+ StatusNotCallBackFunction = ((SHCI_TL_HciInitConf_t *)pConf)->StatusNotCallBack;
+ shciContext.UserEvtRx = UserEvtRx;
+
+ shci_register_io_bus (&shciContext.io);
+
+ TlInit((TL_CmdPacket_t *)(((SHCI_TL_HciInitConf_t *)pConf)->p_cmdbuffer));
+
+ return;
+}
+
+void shci_user_evt_proc(void)
+{
+ TL_EvtPacket_t *phcievtbuffer;
+ tSHCI_UserEvtRxParam UserEvtRxParam;
+
+ /**
+ * Up to release version v1.2.0, a while loop was implemented to read out events from the queue as long as
+ * it is not empty. However, in a bare metal implementation, this leads to calling in a "blocking" mode
+ * shci_user_evt_proc() as long as events are received without giving the opportunity to run other tasks
+ * in the background.
+ * From now, the events are reported one by one. When it is checked there is still an event pending in the queue,
+ * a request to the user is made to call again shci_user_evt_proc().
+ * This gives the opportunity to the application to run other background tasks between each event.
+ */
+
+ /**
+ * It is more secure to use LST_remove_head()/LST_insert_head() compare to LST_get_next_node()/LST_remove_node()
+ * in case the user overwrite the header where the next/prev pointers are located
+ */
+ if((LST_is_empty(&SHciAsynchEventQueue) == FALSE) && (SHCI_TL_UserEventFlow != SHCI_TL_UserEventFlow_Disable))
+ {
+ LST_remove_head ( &SHciAsynchEventQueue, (tListNode **)&phcievtbuffer );
+
+ if (shciContext.UserEvtRx != NULL)
+ {
+ UserEvtRxParam.pckt = phcievtbuffer;
+ UserEvtRxParam.status = SHCI_TL_UserEventFlow_Enable;
+ shciContext.UserEvtRx((void *)&UserEvtRxParam);
+ SHCI_TL_UserEventFlow = UserEvtRxParam.status;
+ }
+ else
+ {
+ SHCI_TL_UserEventFlow = SHCI_TL_UserEventFlow_Enable;
+ }
+
+ if(SHCI_TL_UserEventFlow != SHCI_TL_UserEventFlow_Disable)
+ {
+ TL_MM_EvtDone( phcievtbuffer );
+ }
+ else
+ {
+ /**
+ * put back the event in the queue
+ */
+ LST_insert_head ( &SHciAsynchEventQueue, (tListNode *)phcievtbuffer );
+ }
+ }
+
+ if((LST_is_empty(&SHciAsynchEventQueue) == FALSE) && (SHCI_TL_UserEventFlow != SHCI_TL_UserEventFlow_Disable))
+ {
+ shci_notify_asynch_evt((void*) &SHciAsynchEventQueue);
+ }
+
+
+ return;
+}
+
+void shci_resume_flow( void )
+{
+ SHCI_TL_UserEventFlow = SHCI_TL_UserEventFlow_Enable;
+
+ /**
+ * It is better to go through the background process as it is not sure from which context this API may
+ * be called
+ */
+ shci_notify_asynch_evt((void*) &SHciAsynchEventQueue);
+
+ return;
+}
+
+void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payload, TL_EvtPacket_t * p_rsp )
+{
+ Cmd_SetStatus(SHCI_TL_CmdBusy);
+
+ pCmdBuffer->cmdserial.cmd.cmdcode = cmd_code;
+ pCmdBuffer->cmdserial.cmd.plen = len_cmd_payload;
+
+ memcpy(pCmdBuffer->cmdserial.cmd.payload, p_cmd_payload, len_cmd_payload );
+ CmdRspStatusFlag = SHCI_TL_CMD_RESP_WAIT;
+ shciContext.io.Send(0,0);
+
+ shci_cmd_resp_wait(SHCI_TL_DEFAULT_TIMEOUT);
+
+ /**
+ * The command complete of a system command does not have the header
+ * It starts immediately with the evtserial field
+ */
+ memcpy( &(p_rsp->evtserial), pCmdBuffer, ((TL_EvtSerial_t*)pCmdBuffer)->evt.plen + TL_EVT_HDR_SIZE );
+
+ Cmd_SetStatus(SHCI_TL_CmdAvailable);
+
+ return;
+}
+
+/* Private functions ---------------------------------------------------------*/
+static void TlInit( TL_CmdPacket_t * p_cmdbuffer )
+{
+ TL_SYS_InitConf_t Conf;
+
+ pCmdBuffer = p_cmdbuffer;
+
+ LST_init_head (&SHciAsynchEventQueue);
+
+ Cmd_SetStatus(SHCI_TL_CmdAvailable);
+
+ SHCI_TL_UserEventFlow = SHCI_TL_UserEventFlow_Enable;
+
+ /* Initialize low level driver */
+ if (shciContext.io.Init)
+ {
+
+ Conf.p_cmdbuffer = (uint8_t *)p_cmdbuffer;
+ Conf.IoBusCallBackCmdEvt = TlCmdEvtReceived;
+ Conf.IoBusCallBackUserEvt = TlUserEvtReceived;
+ shciContext.io.Init(&Conf);
+ }
+
+ return;
+}
+
+static void Cmd_SetStatus(SHCI_TL_CmdStatus_t shcicmdstatus)
+{
+ if(shcicmdstatus == SHCI_TL_CmdBusy)
+ {
+ if(StatusNotCallBackFunction != 0)
+ {
+ StatusNotCallBackFunction( SHCI_TL_CmdBusy );
+ }
+ SHCICmdStatus = SHCI_TL_CmdBusy;
+ }
+ else
+ {
+ SHCICmdStatus = SHCI_TL_CmdAvailable;
+ if(StatusNotCallBackFunction != 0)
+ {
+ StatusNotCallBackFunction( SHCI_TL_CmdAvailable );
+ }
+ }
+
+ return;
+}
+
+static void TlCmdEvtReceived(TL_EvtPacket_t *shcievt)
+{
+ (void)(shcievt);
+ shci_cmd_resp_release(0); /**< Notify the application the Cmd response has been received */
+
+ return;
+}
+
+static void TlUserEvtReceived(TL_EvtPacket_t *shcievt)
+{
+ LST_insert_tail(&SHciAsynchEventQueue, (tListNode *)shcievt);
+ shci_notify_asynch_evt((void*) &SHciAsynchEventQueue); /**< Notify the application a full HCI event has been received */
+
+ return;
+}
+
+/* Weak implementation ----------------------------------------------------------------*/
+__WEAK void shci_cmd_resp_wait(uint32_t timeout)
+{
+ (void)timeout;
+
+ while(CmdRspStatusFlag != SHCI_TL_CMD_RESP_RELEASE);
+
+ return;
+}
+
+__WEAK void shci_cmd_resp_release(uint32_t flag)
+{
+ (void)flag;
+
+ CmdRspStatusFlag = SHCI_TL_CMD_RESP_RELEASE;
+
+ return;
+}
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl.h
new file mode 100644
index 0000000..74d0ff3
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl.h
@@ -0,0 +1,173 @@
+/**
+ ******************************************************************************
+ * @file shci_tl.h
+ * @author MCD Application Team
+ * @brief System HCI command header for the system channel
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __SHCI_TL_H_
+#define __SHCI_TL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "tl.h"
+
+/* Exported defines -----------------------------------------------------------*/
+typedef enum
+{
+ SHCI_TL_UserEventFlow_Disable,
+ SHCI_TL_UserEventFlow_Enable,
+} SHCI_TL_UserEventFlowStatus_t;
+
+typedef enum
+{
+ SHCI_TL_CmdBusy,
+ SHCI_TL_CmdAvailable
+} SHCI_TL_CmdStatus_t;
+
+/**
+ * @brief Structure used to manage the BUS IO operations.
+ * All the structure fields will point to functions defined at user level.
+ * @{
+ */
+typedef struct
+{
+ int32_t (* Init) (void* pConf); /**< Pointer to SHCI TL function for the IO Bus initialization */
+ int32_t (* DeInit) (void); /**< Pointer to SHCI TL function for the IO Bus de-initialization */
+ int32_t (* Reset) (void); /**< Pointer to SHCI TL function for the IO Bus reset */
+ int32_t (* Receive) (uint8_t*, uint16_t); /**< Pointer to SHCI TL function for the IO Bus data reception */
+ int32_t (* Send) (uint8_t*, uint16_t); /**< Pointer to SHCI TL function for the IO Bus data transmission */
+ int32_t (* DataAck) (uint8_t*, uint16_t* len); /**< Pointer to SHCI TL function for the IO Bus data ack reception */
+ int32_t (* GetTick) (void); /**< Pointer to BSP function for getting the HAL time base timestamp */
+} tSHciIO;
+/**
+ * @}
+ */
+
+/**
+ * @brief Contain the SHCI context
+ * @{
+ */
+typedef struct
+{
+ tSHciIO io; /**< Manage the BUS IO operations */
+ void (* UserEvtRx) (void * pData); /**< User System events callback function pointer */
+} tSHciContext;
+
+typedef struct
+{
+ SHCI_TL_UserEventFlowStatus_t status;
+ TL_EvtPacket_t *pckt;
+} tSHCI_UserEvtRxParam;
+
+typedef struct
+{
+ uint8_t *p_cmdbuffer;
+ void (* StatusNotCallBack) (SHCI_TL_CmdStatus_t status);
+} SHCI_TL_HciInitConf_t;
+
+/**
+ * shci_send
+ * @brief Send an System HCI Command
+ *
+ * @param : cmd_code = Opcode of the command
+ * @param : len_cmd_payload = Length of the command payload
+ * @param : p_cmd_payload = Address of the command payload
+ * @param : p_rsp_status = Address of the full buffer holding the command complete event
+ * @retval : None
+ */
+void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payload, TL_EvtPacket_t * p_rsp_status );
+
+/**
+ * @brief Register IO bus services.
+ * @param fops The SHCI IO structure managing the IO BUS
+ * @retval None
+ */
+void shci_register_io_bus(tSHciIO* fops);
+
+/**
+ * @brief Interrupt service routine that must be called when the system channel
+ * reports a packet has been received
+ *
+ * @param pdata Packet or event pointer
+ * @retval None
+ */
+void shci_notify_asynch_evt(void* pdata);
+
+/**
+ * @brief This function resume the User Event Flow which has been stopped on return
+ * from UserEvtRx() when the User Event has not been processed.
+ *
+ * @param None
+ * @retval None
+ */
+void shci_resume_flow(void);
+
+
+/**
+ * @brief This function is called when an System HCI Command is sent to the CPU2 and the response is waited.
+ * It is called from the same context the System HCI command has been sent.
+ * It shall not return until the command response notified by shci_cmd_resp_release() is received.
+ * A weak implementation is available in shci_tl.c based on polling mechanism
+ * The user may re-implement this function in the application to improve performance :
+ * - It may use UTIL_SEQ_WaitEvt() API when using the Sequencer
+ * - It may use a semaphore when using cmsis_os interface
+ *
+ * @param timeout: Waiting timeout
+ * @retval None
+ */
+void shci_cmd_resp_wait(uint32_t timeout);
+
+/**
+ * @brief This function is called when an System HCI command is received from the CPU2.
+ * A weak implementation is available in shci_tl.c based on polling mechanism
+ * The user may re-implement this function in the application to improve performance :
+ * - It may use UTIL_SEQ_SetEvt() API when using the Sequencer
+ * - It may use a semaphore when using cmsis_os interface
+ *
+ *
+ * @param flag: Release flag
+ * @retval None
+ */
+void shci_cmd_resp_release(uint32_t flag);
+
+
+/**
+ * @brief This process shall be called each time the shci_notify_asynch_evt notification is received
+ *
+ * @param None
+ * @retval None
+ */
+
+void shci_user_evt_proc(void);
+
+/**
+ * @brief Initialize the System Host Controller Interface.
+ * This function must be called before any communication on the System Channel
+ *
+ * @param UserEvtRx: System events callback function pointer
+ * This callback is triggered when an user event is received on
+ * the System Channel from CPU2.
+ * @param pConf: Configuration structure pointer
+ * @retval None
+ */
+void shci_init(void(* UserEvtRx)(void* pData), void* pConf);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SHCI_TL_H_ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl_if.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl_if.c
new file mode 100644
index 0000000..70a6a2c
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl_if.c
@@ -0,0 +1,30 @@
+/**
+ ******************************************************************************
+ * @file shci_tl_if.c
+ * @author MCD Application Team
+ * @brief Transport layer interface to the system channel
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ ******************************************************************************
+ */
+
+#include "shci_tl.h"
+#include "tl.h"
+
+
+void shci_register_io_bus(tSHciIO* fops)
+{
+ /* Register IO bus services */
+ fops->Init = TL_SYS_Init;
+ fops->Send = TL_SYS_SendCmd;
+
+ return;
+}
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/tl.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/tl.h
new file mode 100644
index 0000000..280600a
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/tl.h
@@ -0,0 +1,372 @@
+/**
+ ******************************************************************************
+ * @file tl.h
+ * @author MCD Application Team
+ * @brief Header for tl module
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __TL_H
+#define __TL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32_wpan_common.h"
+
+/* Exported defines -----------------------------------------------------------*/
+#define TL_BLECMD_PKT_TYPE ( 0x01 )
+#define TL_ACL_DATA_PKT_TYPE ( 0x02 )
+#define TL_BLEEVT_PKT_TYPE ( 0x04 )
+#define TL_OTCMD_PKT_TYPE ( 0x08 )
+#define TL_OTRSP_PKT_TYPE ( 0x09 )
+#define TL_CLICMD_PKT_TYPE ( 0x0A )
+#define TL_OTNOT_PKT_TYPE ( 0x0C )
+#define TL_OTACK_PKT_TYPE ( 0x0D )
+#define TL_CLINOT_PKT_TYPE ( 0x0E )
+#define TL_CLIACK_PKT_TYPE ( 0x0F )
+#define TL_SYSCMD_PKT_TYPE ( 0x10 )
+#define TL_SYSRSP_PKT_TYPE ( 0x11 )
+#define TL_SYSEVT_PKT_TYPE ( 0x12 )
+#define TL_CLIRESP_PKT_TYPE ( 0x15 )
+#define TL_M0CMD_PKT_TYPE ( 0x16 )
+#define TL_LOCCMD_PKT_TYPE ( 0x20 )
+#define TL_LOCRSP_PKT_TYPE ( 0x21 )
+#define TL_TRACES_APP_PKT_TYPE ( 0x40 )
+#define TL_TRACES_WL_PKT_TYPE ( 0x41 )
+
+#define TL_CMD_HDR_SIZE (4)
+#define TL_EVT_HDR_SIZE (3)
+#define TL_EVT_CS_PAYLOAD_SIZE (4)
+
+#define TL_BLEEVT_CC_OPCODE (0x0E)
+#define TL_BLEEVT_CS_OPCODE (0x0F)
+#define TL_BLEEVT_VS_OPCODE (0xFF)
+
+#define TL_BLEEVT_CC_PACKET_SIZE (TL_EVT_HDR_SIZE + sizeof(TL_CcEvt_t))
+#define TL_BLEEVT_CC_BUFFER_SIZE (sizeof(TL_PacketHeader_t) + TL_BLEEVT_CC_PACKET_SIZE)
+/* Exported types ------------------------------------------------------------*/
+/**< Packet header */
+typedef PACKED_STRUCT
+{
+ uint32_t *next;
+ uint32_t *prev;
+} TL_PacketHeader_t;
+
+/*******************************************************************************
+ * Event type
+ */
+
+/**
+ * This the payload of TL_Evt_t for a command status event
+ */
+typedef PACKED_STRUCT
+{
+ uint8_t status;
+ uint8_t numcmd;
+ uint16_t cmdcode;
+} TL_CsEvt_t;
+
+/**
+ * This the payload of TL_Evt_t for a command complete event, only used a pointer
+ */
+typedef PACKED_STRUCT
+{
+ uint8_t numcmd;
+ uint16_t cmdcode;
+ uint8_t payload[2];
+} TL_CcEvt_t;
+
+/**
+ * This the payload of TL_Evt_t for an asynchronous event, only used a pointer
+ */
+typedef PACKED_STRUCT
+{
+ uint16_t subevtcode;
+ uint8_t payload[2];
+} TL_AsynchEvt_t;
+
+/**
+ * This the payload of TL_Evt_t, only used a pointer
+ */
+typedef PACKED_STRUCT
+{
+ uint8_t evtcode;
+ uint8_t plen;
+ uint8_t payload[2];
+} TL_Evt_t;
+
+typedef PACKED_STRUCT
+{
+ uint8_t type;
+ TL_Evt_t evt;
+} TL_EvtSerial_t;
+
+/**
+ * This format shall be used for all events (asynchronous and command response) reported
+ * by the CPU2 except for the command response of a system command where the header is not there
+ * and the format to be used shall be TL_EvtSerial_t.
+ * Note: Be careful that the asynchronous events reported by the CPU2 on the system channel do
+ * include the header and shall use TL_EvtPacket_t format. Only the command response format on the
+ * system channel is different.
+ */
+typedef PACKED_STRUCT
+{
+ TL_PacketHeader_t header;
+ TL_EvtSerial_t evtserial;
+} TL_EvtPacket_t;
+
+/*****************************************************************************************
+ * Command type
+ */
+
+typedef PACKED_STRUCT
+{
+ uint16_t cmdcode;
+ uint8_t plen;
+ uint8_t payload[255];
+} TL_Cmd_t;
+
+typedef PACKED_STRUCT
+{
+ uint8_t type;
+ TL_Cmd_t cmd;
+} TL_CmdSerial_t;
+
+typedef PACKED_STRUCT
+{
+ TL_PacketHeader_t header;
+ TL_CmdSerial_t cmdserial;
+} TL_CmdPacket_t;
+
+/*****************************************************************************************
+ * HCI ACL DATA type
+ */
+typedef PACKED_STRUCT
+{
+ uint8_t type;
+ uint16_t handle;
+ uint16_t length;
+ uint8_t acl_data[1];
+} TL_AclDataSerial_t;
+
+typedef PACKED_STRUCT
+{
+ TL_PacketHeader_t header;
+ TL_AclDataSerial_t AclDataSerial;
+} TL_AclDataPacket_t;
+
+typedef struct
+{
+ uint8_t *p_BleSpareEvtBuffer;
+ uint8_t *p_SystemSpareEvtBuffer;
+ uint8_t *p_AsynchEvtPool;
+ uint32_t AsynchEvtPoolSize;
+ uint8_t *p_TracesEvtPool;
+ uint32_t TracesEvtPoolSize;
+} TL_MM_Config_t;
+
+typedef struct
+{
+ uint8_t *p_ThreadOtCmdRspBuffer;
+ uint8_t *p_ThreadCliRspBuffer;
+ uint8_t *p_ThreadNotAckBuffer;
+ uint8_t *p_ThreadCliNotBuffer;
+} TL_TH_Config_t;
+
+typedef struct
+{
+ uint8_t *p_LldTestsCliCmdRspBuffer;
+ uint8_t *p_LldTestsM0CmdBuffer;
+} TL_LLD_tests_Config_t;
+
+typedef struct
+{
+ uint8_t *p_BleLldCmdRspBuffer;
+ uint8_t *p_BleLldM0CmdBuffer;
+} TL_BLE_LLD_Config_t;
+
+typedef struct
+{
+ uint8_t *p_Mac_802_15_4_CmdRspBuffer;
+ uint8_t *p_Mac_802_15_4_NotAckBuffer;
+} TL_MAC_802_15_4_Config_t;
+
+typedef struct
+{
+ uint8_t *p_ZigbeeOtCmdRspBuffer;
+ uint8_t *p_ZigbeeNotAckBuffer;
+ uint8_t *p_ZigbeeNotifRequestBuffer;
+} TL_ZIGBEE_Config_t;
+
+/**
+ * @brief Contain the BLE HCI Init Configuration
+ * @{
+ */
+typedef struct
+{
+ void (* IoBusEvtCallBack) ( TL_EvtPacket_t *phcievt );
+ void (* IoBusAclDataTxAck) ( void );
+ uint8_t *p_cmdbuffer;
+ uint8_t *p_AclDataBuffer;
+} TL_BLE_InitConf_t;
+
+/**
+ * @brief Contain the SYSTEM HCI Init Configuration
+ * @{
+ */
+typedef struct
+{
+ void (* IoBusCallBackCmdEvt) (TL_EvtPacket_t *phcievt);
+ void (* IoBusCallBackUserEvt) (TL_EvtPacket_t *phcievt);
+ uint8_t *p_cmdbuffer;
+} TL_SYS_InitConf_t;
+
+/*****************************************************************************************
+ * Event type copied from ble_legacy.h
+ */
+
+typedef PACKED_STRUCT
+{
+ uint8_t type;
+ uint8_t data[1];
+} hci_uart_pckt;
+
+typedef PACKED_STRUCT
+{
+ uint8_t evt;
+ uint8_t plen;
+ uint8_t data[1];
+} hci_event_pckt;
+
+typedef PACKED_STRUCT
+{
+ uint8_t subevent;
+ uint8_t data[1];
+} evt_le_meta_event;
+
+/**
+ * Vendor specific event for BLE core.
+ */
+typedef PACKED_STRUCT
+{
+ uint16_t ecode; /**< One of the BLE core event codes. */
+ uint8_t data[1];
+} evt_blecore_aci;
+
+/* Bluetooth 48 bit address (in little-endian order).
+ */
+typedef uint8_t tBDAddr[6];
+
+
+/* Exported constants --------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+
+/******************************************************************************
+ * GENERAL
+ ******************************************************************************/
+void TL_Enable( void );
+void TL_Init( void );
+
+/******************************************************************************
+ * BLE
+ ******************************************************************************/
+int32_t TL_BLE_Init( void* pConf );
+int32_t TL_BLE_SendCmd( uint8_t* buffer, uint16_t size );
+int32_t TL_BLE_SendAclData( uint8_t* buffer, uint16_t size );
+
+/******************************************************************************
+ * SYSTEM
+ ******************************************************************************/
+int32_t TL_SYS_Init( void* pConf );
+int32_t TL_SYS_SendCmd( uint8_t* buffer, uint16_t size );
+
+/******************************************************************************
+ * THREAD
+ ******************************************************************************/
+void TL_THREAD_Init( TL_TH_Config_t *p_Config );
+void TL_OT_SendCmd( void );
+void TL_CLI_SendCmd( void );
+void TL_OT_CmdEvtReceived( TL_EvtPacket_t * Otbuffer );
+void TL_THREAD_NotReceived( TL_EvtPacket_t * Notbuffer );
+void TL_THREAD_SendAck ( void );
+void TL_THREAD_CliSendAck ( void );
+void TL_THREAD_CliNotReceived( TL_EvtPacket_t * Notbuffer );
+
+/******************************************************************************
+ * LLD TESTS
+ ******************************************************************************/
+void TL_LLDTESTS_Init( TL_LLD_tests_Config_t *p_Config );
+void TL_LLDTESTS_SendCliCmd( void );
+void TL_LLDTESTS_ReceiveCliRsp( TL_CmdPacket_t * Notbuffer );
+void TL_LLDTESTS_SendCliRspAck( void );
+void TL_LLDTESTS_ReceiveM0Cmd( TL_CmdPacket_t * Notbuffer );
+void TL_LLDTESTS_SendM0CmdAck( void );
+
+/******************************************************************************
+ * BLE LLD
+ ******************************************************************************/
+void TL_BLE_LLD_Init( TL_BLE_LLD_Config_t *p_Config );
+void TL_BLE_LLD_SendCliCmd( void );
+void TL_BLE_LLD_ReceiveCliRsp( TL_CmdPacket_t * Notbuffer );
+void TL_BLE_LLD_SendCliRspAck( void );
+void TL_BLE_LLD_ReceiveM0Cmd( TL_CmdPacket_t * Notbuffer );
+void TL_BLE_LLD_SendM0CmdAck( void );
+void TL_BLE_LLD_SendCmd( void );
+void TL_BLE_LLD_ReceiveRsp( TL_CmdPacket_t * Notbuffer );
+void TL_BLE_LLD_SendRspAck( void );
+/******************************************************************************
+ * MEMORY MANAGER
+ ******************************************************************************/
+void TL_MM_Init( TL_MM_Config_t *p_Config );
+void TL_MM_EvtDone( TL_EvtPacket_t * hcievt );
+
+/******************************************************************************
+ * TRACES
+ ******************************************************************************/
+void TL_TRACES_Init( void );
+void TL_TRACES_EvtReceived( TL_EvtPacket_t * hcievt );
+
+/******************************************************************************
+ * MAC 802.15.4
+ ******************************************************************************/
+void TL_MAC_802_15_4_Init( TL_MAC_802_15_4_Config_t *p_Config );
+void TL_MAC_802_15_4_SendCmd( void );
+void TL_MAC_802_15_4_CmdEvtReceived( TL_EvtPacket_t * Otbuffer );
+void TL_MAC_802_15_4_NotReceived( TL_EvtPacket_t * Notbuffer );
+void TL_MAC_802_15_4_SendAck ( void );
+
+/******************************************************************************
+ * ZIGBEE
+ ******************************************************************************/
+void TL_ZIGBEE_Init( TL_ZIGBEE_Config_t *p_Config );
+void TL_ZIGBEE_SendM4RequestToM0( void );
+void TL_ZIGBEE_SendM4AckToM0Notify ( void );
+void TL_ZIGBEE_NotReceived( TL_EvtPacket_t * Notbuffer );
+void TL_ZIGBEE_CmdEvtReceived( TL_EvtPacket_t * Otbuffer );
+void TL_ZIGBEE_M0RequestReceived(TL_EvtPacket_t * Otbuffer );
+void TL_ZIGBEE_SendM4AckToM0Request(void);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__TL_H */
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/tl_mbox.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/tl_mbox.c
new file mode 100644
index 0000000..9659ee6
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/tl_mbox.c
@@ -0,0 +1,877 @@
+/**
+ ******************************************************************************
+ * @file tl_mbox.c
+ * @author MCD Application Team
+ * @brief Transport layer for the mailbox interface
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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.
+ *
+ ******************************************************************************
+ */
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32_wpan_common.h"
+#include "hw.h"
+
+#include "stm_list.h"
+#include "tl.h"
+#include "mbox_def.h"
+#include "tl_dbg_conf.h"
+
+/* Private typedef -----------------------------------------------------------*/
+typedef enum
+{
+ TL_MB_MM_RELEASE_BUFFER,
+ TL_MB_BLE_CMD,
+ TL_MB_BLE_CMD_RSP,
+ TL_MB_ACL_DATA,
+ TL_MB_ACL_DATA_RSP,
+ TL_MB_BLE_ASYNCH_EVT,
+ TL_MB_SYS_CMD,
+ TL_MB_SYS_CMD_RSP,
+ TL_MB_SYS_ASYNCH_EVT,
+} TL_MB_PacketType_t;
+
+/* Private defines -----------------------------------------------------------*/
+/* Private macros ------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+
+/**< reference table */
+PLACE_IN_SECTION("MAPPING_TABLE") static volatile MB_RefTable_t TL_RefTable;
+PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_DeviceInfoTable_t TL_DeviceInfoTable;
+PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_BleTable_t TL_BleTable;
+PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_ThreadTable_t TL_ThreadTable;
+PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_LldTestsTable_t TL_LldTestsTable;
+PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_BleLldTable_t TL_BleLldTable;
+PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_SysTable_t TL_SysTable;
+PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_MemManagerTable_t TL_MemManagerTable;
+PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_TracesTable_t TL_TracesTable;
+PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_Mac_802_15_4_t TL_Mac_802_15_4_Table;
+PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_ZigbeeTable_t TL_Zigbee_Table;
+
+/**< tables */
+PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode FreeBufQueue;
+PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode TracesEvtQueue;
+PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static uint8_t CsBuffer[sizeof(TL_PacketHeader_t) + TL_EVT_HDR_SIZE + sizeof(TL_CsEvt_t)];
+PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode EvtQueue;
+PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode SystemEvtQueue;
+
+
+static tListNode LocalFreeBufQueue;
+static void (* BLE_IoBusEvtCallBackFunction) (TL_EvtPacket_t *phcievt);
+static void (* BLE_IoBusAclDataTxAck) ( void );
+static void (* SYS_CMD_IoBusCallBackFunction) (TL_EvtPacket_t *phcievt);
+static void (* SYS_EVT_IoBusCallBackFunction) (TL_EvtPacket_t *phcievt);
+
+
+/* Global variables ----------------------------------------------------------*/
+/* Private function prototypes -----------------------------------------------*/
+static void SendFreeBuf( void );
+static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer);
+
+/* Public Functions Definition ------------------------------------------------------*/
+
+/******************************************************************************
+ * GENERAL - refer to AN5289 for functions description.
+ ******************************************************************************/
+void TL_Enable( void )
+{
+ HW_IPCC_Enable();
+
+ return;
+}
+
+
+void TL_Init( void )
+{
+ TL_RefTable.p_device_info_table = &TL_DeviceInfoTable;
+ TL_RefTable.p_ble_table = &TL_BleTable;
+ TL_RefTable.p_thread_table = &TL_ThreadTable;
+ TL_RefTable.p_lld_tests_table = &TL_LldTestsTable;
+ TL_RefTable.p_ble_lld_table = &TL_BleLldTable;
+ TL_RefTable.p_sys_table = &TL_SysTable;
+ TL_RefTable.p_mem_manager_table = &TL_MemManagerTable;
+ TL_RefTable.p_traces_table = &TL_TracesTable;
+ TL_RefTable.p_mac_802_15_4_table = &TL_Mac_802_15_4_Table;
+ TL_RefTable.p_zigbee_table = &TL_Zigbee_Table;
+ HW_IPCC_Init();
+
+ return;
+}
+
+/******************************************************************************
+ * BLE
+ ******************************************************************************/
+int32_t TL_BLE_Init( void* pConf )
+{
+ MB_BleTable_t * p_bletable;
+
+ TL_BLE_InitConf_t *pInitHciConf = (TL_BLE_InitConf_t *) pConf;
+
+ LST_init_head (&EvtQueue);
+
+ p_bletable = TL_RefTable.p_ble_table;
+
+ p_bletable->pcmd_buffer = pInitHciConf->p_cmdbuffer;
+ p_bletable->phci_acl_data_buffer = pInitHciConf->p_AclDataBuffer;
+ p_bletable->pcs_buffer = (uint8_t*)CsBuffer;
+ p_bletable->pevt_queue = (uint8_t*)&EvtQueue;
+
+ HW_IPCC_BLE_Init();
+
+ BLE_IoBusEvtCallBackFunction = pInitHciConf->IoBusEvtCallBack;
+ BLE_IoBusAclDataTxAck = pInitHciConf->IoBusAclDataTxAck;
+
+ return 0;
+}
+
+int32_t TL_BLE_SendCmd( uint8_t* buffer, uint16_t size )
+{
+ (void)(buffer);
+ (void)(size);
+
+ ((TL_CmdPacket_t*)(TL_RefTable.p_ble_table->pcmd_buffer))->cmdserial.type = TL_BLECMD_PKT_TYPE;
+
+ OutputDbgTrace(TL_MB_BLE_CMD, TL_RefTable.p_ble_table->pcmd_buffer);
+
+ HW_IPCC_BLE_SendCmd();
+
+ return 0;
+}
+
+void HW_IPCC_BLE_RxEvtNot(void)
+{
+ TL_EvtPacket_t *phcievt;
+
+ while(LST_is_empty(&EvtQueue) == FALSE)
+ {
+ LST_remove_head (&EvtQueue, (tListNode **)&phcievt);
+
+ if ( ((phcievt->evtserial.evt.evtcode) == TL_BLEEVT_CS_OPCODE) || ((phcievt->evtserial.evt.evtcode) == TL_BLEEVT_CC_OPCODE ) )
+ {
+ OutputDbgTrace(TL_MB_BLE_CMD_RSP, (uint8_t*)phcievt);
+ }
+ else
+ {
+ OutputDbgTrace(TL_MB_BLE_ASYNCH_EVT, (uint8_t*)phcievt);
+ }
+
+ BLE_IoBusEvtCallBackFunction(phcievt);
+ }
+
+ return;
+}
+
+int32_t TL_BLE_SendAclData( uint8_t* buffer, uint16_t size )
+{
+ (void)(buffer);
+ (void)(size);
+
+ ((TL_AclDataPacket_t *)(TL_RefTable.p_ble_table->phci_acl_data_buffer))->AclDataSerial.type = TL_ACL_DATA_PKT_TYPE;
+
+ OutputDbgTrace(TL_MB_ACL_DATA, TL_RefTable.p_ble_table->phci_acl_data_buffer);
+
+ HW_IPCC_BLE_SendAclData();
+
+ return 0;
+}
+
+void HW_IPCC_BLE_AclDataAckNot(void)
+{
+ OutputDbgTrace(TL_MB_ACL_DATA_RSP, (uint8_t*)NULL);
+
+ BLE_IoBusAclDataTxAck( );
+
+ return;
+}
+
+/******************************************************************************
+ * SYSTEM
+ ******************************************************************************/
+int32_t TL_SYS_Init( void* pConf )
+{
+ MB_SysTable_t * p_systable;
+
+ TL_SYS_InitConf_t *pInitHciConf = (TL_SYS_InitConf_t *) pConf;
+
+ LST_init_head (&SystemEvtQueue);
+ p_systable = TL_RefTable.p_sys_table;
+ p_systable->pcmd_buffer = pInitHciConf->p_cmdbuffer;
+ p_systable->sys_queue = (uint8_t*)&SystemEvtQueue;
+
+ HW_IPCC_SYS_Init();
+
+ SYS_CMD_IoBusCallBackFunction = pInitHciConf->IoBusCallBackCmdEvt;
+ SYS_EVT_IoBusCallBackFunction = pInitHciConf->IoBusCallBackUserEvt;
+
+ return 0;
+}
+
+int32_t TL_SYS_SendCmd( uint8_t* buffer, uint16_t size )
+{
+ (void)(buffer);
+ (void)(size);
+
+ ((TL_CmdPacket_t *)(TL_RefTable.p_sys_table->pcmd_buffer))->cmdserial.type = TL_SYSCMD_PKT_TYPE;
+
+ OutputDbgTrace(TL_MB_SYS_CMD, TL_RefTable.p_sys_table->pcmd_buffer);
+
+ HW_IPCC_SYS_SendCmd();
+
+ return 0;
+}
+
+void HW_IPCC_SYS_CmdEvtNot(void)
+{
+ OutputDbgTrace(TL_MB_SYS_CMD_RSP, (uint8_t*)(TL_RefTable.p_sys_table->pcmd_buffer) );
+
+ SYS_CMD_IoBusCallBackFunction( (TL_EvtPacket_t*)(TL_RefTable.p_sys_table->pcmd_buffer) );
+
+ return;
+}
+
+void HW_IPCC_SYS_EvtNot( void )
+{
+ TL_EvtPacket_t *p_evt;
+
+ while(LST_is_empty(&SystemEvtQueue) == FALSE)
+ {
+ LST_remove_head (&SystemEvtQueue, (tListNode **)&p_evt);
+
+ OutputDbgTrace(TL_MB_SYS_ASYNCH_EVT, (uint8_t*)p_evt );
+
+ SYS_EVT_IoBusCallBackFunction( p_evt );
+ }
+
+ return;
+}
+
+/******************************************************************************
+ * THREAD
+ ******************************************************************************/
+#ifdef THREAD_WB
+void TL_THREAD_Init( TL_TH_Config_t *p_Config )
+{
+ MB_ThreadTable_t * p_thread_table;
+
+ p_thread_table = TL_RefTable.p_thread_table;
+
+ p_thread_table->clicmdrsp_buffer = p_Config->p_ThreadCliRspBuffer;
+ p_thread_table->otcmdrsp_buffer = p_Config->p_ThreadOtCmdRspBuffer;
+ p_thread_table->notack_buffer = p_Config->p_ThreadNotAckBuffer;
+ p_thread_table->clinot_buffer = p_Config->p_ThreadCliNotBuffer;
+
+ HW_IPCC_THREAD_Init();
+
+ return;
+}
+
+void TL_OT_SendCmd( void )
+{
+ ((TL_CmdPacket_t *)(TL_RefTable.p_thread_table->otcmdrsp_buffer))->cmdserial.type = TL_OTCMD_PKT_TYPE;
+
+ HW_IPCC_OT_SendCmd();
+
+ return;
+}
+
+void TL_CLI_SendCmd( void )
+{
+ ((TL_CmdPacket_t *)(TL_RefTable.p_thread_table->clicmdrsp_buffer))->cmdserial.type = TL_CLICMD_PKT_TYPE;
+
+ HW_IPCC_CLI_SendCmd();
+
+ return;
+}
+
+void TL_THREAD_SendAck ( void )
+{
+ ((TL_CmdPacket_t *)(TL_RefTable.p_thread_table->notack_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE;
+
+ HW_IPCC_THREAD_SendAck();
+
+ return;
+}
+
+void TL_THREAD_CliSendAck ( void )
+{
+ ((TL_CmdPacket_t *)(TL_RefTable.p_thread_table->notack_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE;
+
+ HW_IPCC_THREAD_CliSendAck();
+
+ return;
+}
+
+void HW_IPCC_OT_CmdEvtNot(void)
+{
+ TL_OT_CmdEvtReceived( (TL_EvtPacket_t*)(TL_RefTable.p_thread_table->otcmdrsp_buffer) );
+
+ return;
+}
+
+void HW_IPCC_THREAD_EvtNot( void )
+{
+ TL_THREAD_NotReceived( (TL_EvtPacket_t*)(TL_RefTable.p_thread_table->notack_buffer) );
+
+ return;
+}
+
+void HW_IPCC_THREAD_CliEvtNot( void )
+{
+ TL_THREAD_CliNotReceived( (TL_EvtPacket_t*)(TL_RefTable.p_thread_table->clinot_buffer) );
+
+ return;
+}
+
+__WEAK void TL_OT_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ){};
+__WEAK void TL_THREAD_NotReceived( TL_EvtPacket_t * Notbuffer ){};
+__WEAK void TL_THREAD_CliNotReceived( TL_EvtPacket_t * Notbuffer ){};
+
+#endif /* THREAD_WB */
+
+/******************************************************************************
+ * LLD TESTS
+ ******************************************************************************/
+#ifdef LLD_TESTS_WB
+void TL_LLDTESTS_Init( TL_LLD_tests_Config_t *p_Config )
+{
+ MB_LldTestsTable_t * p_lld_tests_table;
+
+ p_lld_tests_table = TL_RefTable.p_lld_tests_table;
+ p_lld_tests_table->clicmdrsp_buffer = p_Config->p_LldTestsCliCmdRspBuffer;
+ p_lld_tests_table->m0cmd_buffer = p_Config->p_LldTestsM0CmdBuffer;
+ HW_IPCC_LLDTESTS_Init();
+ return;
+}
+
+void TL_LLDTESTS_SendCliCmd( void )
+{
+ ((TL_CmdPacket_t *)(TL_RefTable.p_lld_tests_table->clicmdrsp_buffer))->cmdserial.type = TL_CLICMD_PKT_TYPE;
+ HW_IPCC_LLDTESTS_SendCliCmd();
+ return;
+}
+
+void HW_IPCC_LLDTESTS_ReceiveCliRsp( void )
+{
+ TL_LLDTESTS_ReceiveCliRsp( (TL_CmdPacket_t*)(TL_RefTable.p_lld_tests_table->clicmdrsp_buffer) );
+ return;
+}
+
+void TL_LLDTESTS_SendCliRspAck( void )
+{
+ HW_IPCC_LLDTESTS_SendCliRspAck();
+ return;
+}
+
+void HW_IPCC_LLDTESTS_ReceiveM0Cmd( void )
+{
+ TL_LLDTESTS_ReceiveM0Cmd( (TL_CmdPacket_t*)(TL_RefTable.p_lld_tests_table->m0cmd_buffer) );
+ return;
+}
+
+
+void TL_LLDTESTS_SendM0CmdAck( void )
+{
+ HW_IPCC_LLDTESTS_SendM0CmdAck();
+ return;
+}
+
+__WEAK void TL_LLDTESTS_ReceiveCliRsp( TL_CmdPacket_t * Notbuffer ){};
+__WEAK void TL_LLDTESTS_ReceiveM0Cmd( TL_CmdPacket_t * Notbuffer ){};
+#endif /* LLD_TESTS_WB */
+
+/******************************************************************************
+ * BLE LLD
+ ******************************************************************************/
+#ifdef BLE_LLD_WB
+void TL_BLE_LLD_Init( TL_BLE_LLD_Config_t *p_Config )
+{
+ MB_BleLldTable_t * p_ble_lld_table;
+
+ p_ble_lld_table = TL_RefTable.p_ble_lld_table;
+ p_ble_lld_table->cmdrsp_buffer = p_Config->p_BleLldCmdRspBuffer;
+ p_ble_lld_table->m0cmd_buffer = p_Config->p_BleLldM0CmdBuffer;
+ HW_IPCC_BLE_LLD_Init();
+ return;
+}
+
+void TL_BLE_LLD_SendCliCmd( void )
+{
+ ((TL_CmdPacket_t *)(TL_RefTable.p_ble_lld_table->cmdrsp_buffer))->cmdserial.type = TL_CLICMD_PKT_TYPE;
+ HW_IPCC_BLE_LLD_SendCliCmd();
+ return;
+}
+
+void HW_IPCC_BLE_LLD_ReceiveCliRsp( void )
+{
+ TL_BLE_LLD_ReceiveCliRsp( (TL_CmdPacket_t*)(TL_RefTable.p_ble_lld_table->cmdrsp_buffer) );
+ return;
+}
+
+void TL_BLE_LLD_SendCliRspAck( void )
+{
+ HW_IPCC_BLE_LLD_SendCliRspAck();
+ return;
+}
+
+void HW_IPCC_BLE_LLD_ReceiveM0Cmd( void )
+{
+ TL_BLE_LLD_ReceiveM0Cmd( (TL_CmdPacket_t*)(TL_RefTable.p_ble_lld_table->m0cmd_buffer) );
+ return;
+}
+
+
+void TL_BLE_LLD_SendM0CmdAck( void )
+{
+ HW_IPCC_BLE_LLD_SendM0CmdAck();
+ return;
+}
+
+__WEAK void TL_BLE_LLD_ReceiveCliRsp( TL_CmdPacket_t * Notbuffer ){};
+__WEAK void TL_BLE_LLD_ReceiveM0Cmd( TL_CmdPacket_t * Notbuffer ){};
+
+/* Transparent Mode */
+void TL_BLE_LLD_SendCmd( void )
+{
+ ((TL_CmdPacket_t *)(TL_RefTable.p_ble_lld_table->cmdrsp_buffer))->cmdserial.type = TL_CLICMD_PKT_TYPE;
+ HW_IPCC_BLE_LLD_SendCmd();
+ return;
+}
+
+void HW_IPCC_BLE_LLD_ReceiveRsp( void )
+{
+ TL_BLE_LLD_ReceiveRsp( (TL_CmdPacket_t*)(TL_RefTable.p_ble_lld_table->cmdrsp_buffer) );
+ return;
+}
+
+void TL_BLE_LLD_SendRspAck( void )
+{
+ HW_IPCC_BLE_LLD_SendRspAck();
+ return;
+}
+#endif /* BLE_LLD_WB */
+
+#ifdef MAC_802_15_4_WB
+/******************************************************************************
+ * MAC 802.15.4
+ ******************************************************************************/
+void TL_MAC_802_15_4_Init( TL_MAC_802_15_4_Config_t *p_Config )
+{
+ MB_Mac_802_15_4_t * p_mac_802_15_4_table;
+
+ p_mac_802_15_4_table = TL_RefTable.p_mac_802_15_4_table;
+
+ p_mac_802_15_4_table->p_cmdrsp_buffer = p_Config->p_Mac_802_15_4_CmdRspBuffer;
+ p_mac_802_15_4_table->p_notack_buffer = p_Config->p_Mac_802_15_4_NotAckBuffer;
+
+ HW_IPCC_MAC_802_15_4_Init();
+
+ return;
+}
+
+void TL_MAC_802_15_4_SendCmd( void )
+{
+ ((TL_CmdPacket_t *)(TL_RefTable.p_mac_802_15_4_table->p_cmdrsp_buffer))->cmdserial.type = TL_OTCMD_PKT_TYPE;
+
+ HW_IPCC_MAC_802_15_4_SendCmd();
+
+ return;
+}
+
+void TL_MAC_802_15_4_SendAck ( void )
+{
+ ((TL_CmdPacket_t *)(TL_RefTable.p_mac_802_15_4_table->p_notack_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE;
+
+ HW_IPCC_MAC_802_15_4_SendAck();
+
+ return;
+}
+
+void HW_IPCC_MAC_802_15_4_CmdEvtNot(void)
+{
+ TL_MAC_802_15_4_CmdEvtReceived( (TL_EvtPacket_t*)(TL_RefTable.p_mac_802_15_4_table->p_cmdrsp_buffer) );
+
+ return;
+}
+
+void HW_IPCC_MAC_802_15_4_EvtNot( void )
+{
+ TL_MAC_802_15_4_NotReceived( (TL_EvtPacket_t*)(TL_RefTable.p_mac_802_15_4_table->p_notack_buffer) );
+
+ return;
+}
+
+__WEAK void TL_MAC_802_15_4_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ){};
+__WEAK void TL_MAC_802_15_4_NotReceived( TL_EvtPacket_t * Notbuffer ){};
+#endif
+
+#ifdef ZIGBEE_WB
+/******************************************************************************
+ * ZIGBEE
+ ******************************************************************************/
+void TL_ZIGBEE_Init( TL_ZIGBEE_Config_t *p_Config )
+{
+ MB_ZigbeeTable_t * p_zigbee_table;
+
+ p_zigbee_table = TL_RefTable.p_zigbee_table;
+ p_zigbee_table->appliCmdM4toM0_buffer = p_Config->p_ZigbeeOtCmdRspBuffer;
+ p_zigbee_table->notifM0toM4_buffer = p_Config->p_ZigbeeNotAckBuffer;
+ p_zigbee_table->requestM0toM4_buffer = p_Config->p_ZigbeeNotifRequestBuffer;
+
+ HW_IPCC_ZIGBEE_Init();
+
+ return;
+}
+
+/* Zigbee M4 to M0 Request */
+void TL_ZIGBEE_SendM4RequestToM0( void )
+{
+ ((TL_CmdPacket_t *)(TL_RefTable.p_zigbee_table->appliCmdM4toM0_buffer))->cmdserial.type = TL_OTCMD_PKT_TYPE;
+
+ HW_IPCC_ZIGBEE_SendM4RequestToM0();
+
+ return;
+}
+
+/* Used to receive an ACK from the M0 */
+void HW_IPCC_ZIGBEE_RecvAppliAckFromM0(void)
+{
+ TL_ZIGBEE_CmdEvtReceived( (TL_EvtPacket_t*)(TL_RefTable.p_zigbee_table->appliCmdM4toM0_buffer) );
+
+ return;
+}
+
+/* Zigbee notification from M0 to M4 */
+void HW_IPCC_ZIGBEE_RecvM0NotifyToM4( void )
+{
+ TL_ZIGBEE_NotReceived( (TL_EvtPacket_t*)(TL_RefTable.p_zigbee_table->notifM0toM4_buffer) );
+
+ return;
+}
+
+/* Send an ACK to the M0 for a Notification */
+void TL_ZIGBEE_SendM4AckToM0Notify ( void )
+{
+ ((TL_CmdPacket_t *)(TL_RefTable.p_zigbee_table->notifM0toM4_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE;
+
+ HW_IPCC_ZIGBEE_SendM4AckToM0Notify();
+
+ return;
+}
+
+/* Zigbee M0 to M4 Request */
+void HW_IPCC_ZIGBEE_RecvM0RequestToM4( void )
+{
+ TL_ZIGBEE_M0RequestReceived( (TL_EvtPacket_t*)(TL_RefTable.p_zigbee_table->requestM0toM4_buffer) );
+
+ return;
+}
+
+/* Send an ACK to the M0 for a Request */
+void TL_ZIGBEE_SendM4AckToM0Request(void)
+{
+ ((TL_CmdPacket_t *)(TL_RefTable.p_zigbee_table->requestM0toM4_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE;
+
+ HW_IPCC_ZIGBEE_SendM4AckToM0Request();
+
+ return;
+}
+
+
+__WEAK void TL_ZIGBEE_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ){};
+__WEAK void TL_ZIGBEE_NotReceived( TL_EvtPacket_t * Notbuffer ){};
+#endif
+
+
+
+/******************************************************************************
+ * MEMORY MANAGER
+ ******************************************************************************/
+void TL_MM_Init( TL_MM_Config_t *p_Config )
+{
+ static MB_MemManagerTable_t * p_mem_manager_table;
+
+ LST_init_head (&FreeBufQueue);
+ LST_init_head (&LocalFreeBufQueue);
+
+ p_mem_manager_table = TL_RefTable.p_mem_manager_table;
+
+ p_mem_manager_table->blepool = p_Config->p_AsynchEvtPool;
+ p_mem_manager_table->blepoolsize = p_Config->AsynchEvtPoolSize;
+ p_mem_manager_table->pevt_free_buffer_queue = (uint8_t*)&FreeBufQueue;
+ p_mem_manager_table->spare_ble_buffer = p_Config->p_BleSpareEvtBuffer;
+ p_mem_manager_table->spare_sys_buffer = p_Config->p_SystemSpareEvtBuffer;
+ p_mem_manager_table->traces_evt_pool = p_Config->p_TracesEvtPool;
+ p_mem_manager_table->tracespoolsize = p_Config->TracesEvtPoolSize;
+
+ return;
+}
+
+void TL_MM_EvtDone(TL_EvtPacket_t * phcievt)
+{
+ LST_insert_tail(&LocalFreeBufQueue, (tListNode *)phcievt);
+
+ OutputDbgTrace(TL_MB_MM_RELEASE_BUFFER, (uint8_t*)phcievt);
+
+ HW_IPCC_MM_SendFreeBuf( SendFreeBuf );
+
+ return;
+}
+
+static void SendFreeBuf( void )
+{
+ tListNode *p_node;
+
+ while ( FALSE == LST_is_empty (&LocalFreeBufQueue) )
+ {
+ LST_remove_head( &LocalFreeBufQueue, (tListNode **)&p_node );
+ LST_insert_tail( (tListNode*)(TL_RefTable.p_mem_manager_table->pevt_free_buffer_queue), p_node );
+ }
+
+ return;
+}
+
+/******************************************************************************
+ * TRACES
+ ******************************************************************************/
+void TL_TRACES_Init( void )
+{
+ LST_init_head (&TracesEvtQueue);
+
+ TL_RefTable.p_traces_table->traces_queue = (uint8_t*)&TracesEvtQueue;
+
+ HW_IPCC_TRACES_Init();
+
+ return;
+}
+
+void HW_IPCC_TRACES_EvtNot(void)
+{
+ TL_EvtPacket_t *phcievt;
+
+ while(LST_is_empty(&TracesEvtQueue) == FALSE)
+ {
+ LST_remove_head (&TracesEvtQueue, (tListNode **)&phcievt);
+ TL_TRACES_EvtReceived( phcievt );
+ }
+
+ return;
+}
+
+__WEAK void TL_TRACES_EvtReceived( TL_EvtPacket_t * hcievt )
+{
+ (void)(hcievt);
+}
+
+/******************************************************************************
+* DEBUG INFORMATION
+******************************************************************************/
+static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer)
+{
+ TL_EvtPacket_t *p_evt_packet;
+ TL_CmdPacket_t *p_cmd_packet;
+ TL_AclDataPacket_t *p_acldata_packet;
+ TL_EvtSerial_t *p_cmd_rsp_packet;
+
+ switch(packet_type)
+ {
+ case TL_MB_MM_RELEASE_BUFFER:
+ p_evt_packet = (TL_EvtPacket_t*)buffer;
+ switch(p_evt_packet->evtserial.evt.evtcode)
+ {
+ case TL_BLEEVT_CS_OPCODE:
+ TL_MM_DBG_MSG("mm evt released: 0x%02X", p_evt_packet->evtserial.evt.evtcode);
+ TL_MM_DBG_MSG(" cmd opcode: 0x%04X", ((TL_CsEvt_t*)(p_evt_packet->evtserial.evt.payload))->cmdcode);
+ TL_MM_DBG_MSG(" buffer addr: 0x%08X", p_evt_packet);
+ break;
+
+ case TL_BLEEVT_CC_OPCODE:
+ TL_MM_DBG_MSG("mm evt released: 0x%02X", p_evt_packet->evtserial.evt.evtcode);
+ TL_MM_DBG_MSG(" cmd opcode: 0x%04X", ((TL_CcEvt_t*)(p_evt_packet->evtserial.evt.payload))->cmdcode);
+ TL_MM_DBG_MSG(" buffer addr: 0x%08X", p_evt_packet);
+ break;
+
+ case TL_BLEEVT_VS_OPCODE:
+ TL_MM_DBG_MSG("mm evt released: 0x%02X", p_evt_packet->evtserial.evt.evtcode);
+ TL_MM_DBG_MSG(" subevtcode: 0x%04X", ((TL_AsynchEvt_t*)(p_evt_packet->evtserial.evt.payload))->subevtcode);
+ TL_MM_DBG_MSG(" buffer addr: 0x%08X", p_evt_packet);
+ break;
+
+ default:
+ TL_MM_DBG_MSG("mm evt released: 0x%02X", p_evt_packet->evtserial.evt.evtcode);
+ TL_MM_DBG_MSG(" buffer addr: 0x%08X", p_evt_packet);
+ break;
+ }
+
+ TL_MM_DBG_MSG("\r\n");
+ break;
+
+ case TL_MB_BLE_CMD:
+ p_cmd_packet = (TL_CmdPacket_t*)buffer;
+ TL_HCI_CMD_DBG_MSG("ble cmd: 0x%04X", p_cmd_packet->cmdserial.cmd.cmdcode);
+ if(p_cmd_packet->cmdserial.cmd.plen != 0)
+ {
+ TL_HCI_CMD_DBG_MSG(" payload:");
+ TL_HCI_CMD_DBG_BUF(p_cmd_packet->cmdserial.cmd.payload, p_cmd_packet->cmdserial.cmd.plen, "");
+ }
+ TL_HCI_CMD_DBG_MSG("\r\n");
+
+ TL_HCI_CMD_DBG_RAW(&p_cmd_packet->cmdserial, p_cmd_packet->cmdserial.cmd.plen+TL_CMD_HDR_SIZE);
+ break;
+
+ case TL_MB_ACL_DATA:
+ (void)p_acldata_packet;
+ p_acldata_packet = (TL_AclDataPacket_t*)buffer;
+ TL_HCI_CMD_DBG_MSG("acl_data: 0x%02X", p_acldata_packet->AclDataSerial.type);
+ TL_HCI_CMD_DBG_MSG("acl_data: 0x%04X", p_acldata_packet->AclDataSerial.handle);
+ TL_HCI_CMD_DBG_MSG("acl_data: 0x%04X", p_acldata_packet->AclDataSerial.length);
+ /*if(p_acldata_packet->AclDataSerial.length != 0)
+ {
+ TL_HCI_CMD_DBG_MSG(" payload:");
+ TL_HCI_CMD_DBG_BUF(p_acldata_packet->AclDataSerial.acl_data, p_acldata_packet->AclDataSerial.length, "");
+ }*/
+ TL_HCI_CMD_DBG_MSG("\r\n");
+ /*TL_HCI_CMD_DBG_RAW(&p_acldata_packet->AclDataSerial, p_acldata_packet->AclDataSerial.length+TL_CMD_HDR_SIZE);*/
+ break;
+
+ case TL_MB_ACL_DATA_RSP:
+ TL_HCI_CMD_DBG_MSG(" ACL Data Tx Ack received")
+ TL_HCI_CMD_DBG_MSG("\r\n");
+ break;
+
+ case TL_MB_BLE_CMD_RSP:
+ p_evt_packet = (TL_EvtPacket_t*)buffer;
+ switch(p_evt_packet->evtserial.evt.evtcode)
+ {
+ case TL_BLEEVT_CS_OPCODE:
+ TL_HCI_CMD_DBG_MSG("ble rsp: 0x%02X", p_evt_packet->evtserial.evt.evtcode);
+ TL_HCI_CMD_DBG_MSG(" cmd opcode: 0x%04X", ((TL_CsEvt_t*)(p_evt_packet->evtserial.evt.payload))->cmdcode);
+ TL_HCI_CMD_DBG_MSG(" numhci: 0x%02X", ((TL_CsEvt_t*)(p_evt_packet->evtserial.evt.payload))->numcmd);
+ TL_HCI_CMD_DBG_MSG(" status: 0x%02X", ((TL_CsEvt_t*)(p_evt_packet->evtserial.evt.payload))->status);
+ break;
+
+ case TL_BLEEVT_CC_OPCODE:
+ TL_HCI_CMD_DBG_MSG("ble rsp: 0x%02X", p_evt_packet->evtserial.evt.evtcode);
+ TL_HCI_CMD_DBG_MSG(" cmd opcode: 0x%04X", ((TL_CcEvt_t*)(p_evt_packet->evtserial.evt.payload))->cmdcode);
+ TL_HCI_CMD_DBG_MSG(" numhci: 0x%02X", ((TL_CcEvt_t*)(p_evt_packet->evtserial.evt.payload))->numcmd);
+ TL_HCI_CMD_DBG_MSG(" status: 0x%02X", ((TL_CcEvt_t*)(p_evt_packet->evtserial.evt.payload))->payload[0]);
+ if((p_evt_packet->evtserial.evt.plen-4) != 0)
+ {
+ TL_HCI_CMD_DBG_MSG(" payload:");
+ TL_HCI_CMD_DBG_BUF(&((TL_CcEvt_t*)(p_evt_packet->evtserial.evt.payload))->payload[1], p_evt_packet->evtserial.evt.plen-4, "");
+ }
+ break;
+
+ default:
+ TL_HCI_CMD_DBG_MSG("unknown ble rsp received: %02X", p_evt_packet->evtserial.evt.evtcode);
+ break;
+ }
+
+ TL_HCI_CMD_DBG_MSG("\r\n");
+
+ TL_HCI_CMD_DBG_RAW(&p_evt_packet->evtserial, p_evt_packet->evtserial.evt.plen+TL_EVT_HDR_SIZE);
+ break;
+
+ case TL_MB_BLE_ASYNCH_EVT:
+ p_evt_packet = (TL_EvtPacket_t*)buffer;
+ if(p_evt_packet->evtserial.evt.evtcode != TL_BLEEVT_VS_OPCODE)
+ {
+ TL_HCI_EVT_DBG_MSG("ble evt: 0x%02X", p_evt_packet->evtserial.evt.evtcode);
+ if((p_evt_packet->evtserial.evt.plen) != 0)
+ {
+ TL_HCI_EVT_DBG_MSG(" payload:");
+ TL_HCI_EVT_DBG_BUF(p_evt_packet->evtserial.evt.payload, p_evt_packet->evtserial.evt.plen, "");
+ }
+ }
+ else
+ {
+ TL_HCI_EVT_DBG_MSG("ble evt: 0x%02X", p_evt_packet->evtserial.evt.evtcode);
+ TL_HCI_EVT_DBG_MSG(" subevtcode: 0x%04X", ((TL_AsynchEvt_t*)(p_evt_packet->evtserial.evt.payload))->subevtcode);
+ if((p_evt_packet->evtserial.evt.plen-2) != 0)
+ {
+ TL_HCI_EVT_DBG_MSG(" payload:");
+ TL_HCI_EVT_DBG_BUF(((TL_AsynchEvt_t*)(p_evt_packet->evtserial.evt.payload))->payload, p_evt_packet->evtserial.evt.plen-2, "");
+ }
+ }
+
+ TL_HCI_EVT_DBG_MSG("\r\n");
+
+ TL_HCI_EVT_DBG_RAW(&p_evt_packet->evtserial, p_evt_packet->evtserial.evt.plen+TL_EVT_HDR_SIZE);
+ break;
+
+ case TL_MB_SYS_CMD:
+ p_cmd_packet = (TL_CmdPacket_t*)buffer;
+
+ TL_SHCI_CMD_DBG_MSG("sys cmd: 0x%04X", p_cmd_packet->cmdserial.cmd.cmdcode);
+
+ if(p_cmd_packet->cmdserial.cmd.plen != 0)
+ {
+ TL_SHCI_CMD_DBG_MSG(" payload:");
+ TL_SHCI_CMD_DBG_BUF(p_cmd_packet->cmdserial.cmd.payload, p_cmd_packet->cmdserial.cmd.plen, "");
+ }
+ TL_SHCI_CMD_DBG_MSG("\r\n");
+
+ TL_SHCI_CMD_DBG_RAW(&p_cmd_packet->cmdserial, p_cmd_packet->cmdserial.cmd.plen+TL_CMD_HDR_SIZE);
+ break;
+
+ case TL_MB_SYS_CMD_RSP:
+ p_cmd_rsp_packet = (TL_EvtSerial_t*)buffer;
+ switch(p_cmd_rsp_packet->evt.evtcode)
+ {
+ case TL_BLEEVT_CC_OPCODE:
+ TL_SHCI_CMD_DBG_MSG("sys rsp: 0x%02X", p_cmd_rsp_packet->evt.evtcode);
+ TL_SHCI_CMD_DBG_MSG(" cmd opcode: 0x%02X", ((TL_CcEvt_t*)(p_cmd_rsp_packet->evt.payload))->cmdcode);
+ TL_SHCI_CMD_DBG_MSG(" status: 0x%02X", ((TL_CcEvt_t*)(p_cmd_rsp_packet->evt.payload))->payload[0]);
+ if((p_cmd_rsp_packet->evt.plen-4) != 0)
+ {
+ TL_SHCI_CMD_DBG_MSG(" payload:");
+ TL_SHCI_CMD_DBG_BUF(&((TL_CcEvt_t*)(p_cmd_rsp_packet->evt.payload))->payload[1], p_cmd_rsp_packet->evt.plen-4, "");
+ }
+ break;
+
+ default:
+ TL_SHCI_CMD_DBG_MSG("unknown sys rsp received: %02X", p_cmd_rsp_packet->evt.evtcode);
+ break;
+ }
+
+ TL_SHCI_CMD_DBG_MSG("\r\n");
+
+ TL_SHCI_CMD_DBG_RAW(&p_cmd_rsp_packet->evt, p_cmd_rsp_packet->evt.plen+TL_EVT_HDR_SIZE);
+ break;
+
+ case TL_MB_SYS_ASYNCH_EVT:
+ p_evt_packet = (TL_EvtPacket_t*)buffer;
+ if(p_evt_packet->evtserial.evt.evtcode != TL_BLEEVT_VS_OPCODE)
+ {
+ TL_SHCI_EVT_DBG_MSG("unknown sys evt received: %02X", p_evt_packet->evtserial.evt.evtcode);
+ }
+ else
+ {
+ TL_SHCI_EVT_DBG_MSG("sys evt: 0x%02X", p_evt_packet->evtserial.evt.evtcode);
+ TL_SHCI_EVT_DBG_MSG(" subevtcode: 0x%04X", ((TL_AsynchEvt_t*)(p_evt_packet->evtserial.evt.payload))->subevtcode);
+ if((p_evt_packet->evtserial.evt.plen-2) != 0)
+ {
+ TL_SHCI_EVT_DBG_MSG(" payload:");
+ TL_SHCI_EVT_DBG_BUF(((TL_AsynchEvt_t*)(p_evt_packet->evtserial.evt.payload))->payload, p_evt_packet->evtserial.evt.plen-2, "");
+ }
+ }
+
+ TL_SHCI_EVT_DBG_MSG("\r\n");
+
+ TL_SHCI_EVT_DBG_RAW(&p_evt_packet->evtserial, p_evt_packet->evtserial.evt.plen+TL_EVT_HDR_SIZE);
+ break;
+
+ default:
+ break;
+ }
+
+ return;
+}
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/stm32_wpan_common.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/stm32_wpan_common.h
new file mode 100644
index 0000000..f407bb9
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/stm32_wpan_common.h
@@ -0,0 +1,171 @@
+/**
+ ******************************************************************************
+ * @file stm32_wpan_common.h
+ * @author MCD Application Team
+ * @brief Common file to utilities
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ ******************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __STM32_WPAN_COMMON_H
+#define __STM32_WPAN_COMMON_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined ( __CC_ARM )||defined (__ARMCC_VERSION)
+ #define __ASM __asm /*!< asm keyword for ARM Compiler */
+ #define __INLINE __inline /*!< inline keyword for ARM Compiler */
+ #define __STATIC_INLINE static __inline
+#elif defined ( __ICCARM__ )
+ #define __ASM __asm /*!< asm keyword for IAR Compiler */
+ #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
+ #define __STATIC_INLINE static inline
+#elif defined ( __GNUC__ )
+ #define __ASM __asm /*!< asm keyword for GNU Compiler */
+ #define __INLINE inline /*!< inline keyword for GNU Compiler */
+ #define __STATIC_INLINE static inline
+#endif
+
+#include <stdint.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include "cmsis_compiler.h"
+
+ /* -------------------------------- *
+ * Basic definitions *
+ * -------------------------------- */
+
+#undef NULL
+#define NULL 0U
+
+#undef FALSE
+#define FALSE 0U
+
+#undef TRUE
+#define TRUE (!0U)
+
+ /* -------------------------------- *
+ * Critical Section definition *
+ * -------------------------------- */
+#undef BACKUP_PRIMASK
+#define BACKUP_PRIMASK() uint32_t primask_bit= __get_PRIMASK()
+
+#undef DISABLE_IRQ
+#define DISABLE_IRQ() __disable_irq()
+
+#undef RESTORE_PRIMASK
+#define RESTORE_PRIMASK() __set_PRIMASK(primask_bit)
+
+ /* -------------------------------- *
+ * Macro delimiters *
+ * -------------------------------- */
+#undef M_BEGIN
+#define M_BEGIN do {
+
+#undef M_END
+#define M_END } while(0)
+
+ /* -------------------------------- *
+ * Some useful macro definitions *
+ * -------------------------------- */
+#undef MAX
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+
+#undef MIN
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+
+#undef MODINC
+#define MODINC( a, m ) M_BEGIN (a)++; if ((a)>=(m)) (a)=0; M_END
+
+#undef MODDEC
+#define MODDEC( a, m ) M_BEGIN if ((a)==0) (a)=(m); (a)--; M_END
+
+#undef MODADD
+#define MODADD( a, b, m ) M_BEGIN (a)+=(b); if ((a)>=(m)) (a)-=(m); M_END
+
+#undef MODSUB
+#define MODSUB( a, b, m ) MODADD( a, (m)-(b), m )
+
+#undef ALIGN
+#ifdef WIN32
+#define ALIGN(n)
+#else
+#define ALIGN(n) __attribute__((aligned(n)))
+#endif
+
+#undef PAUSE
+#define PAUSE( t ) M_BEGIN \
+ volatile int _i; \
+ for ( _i = t; _i > 0; _i -- ); \
+ M_END
+#undef DIVF
+#define DIVF( x, y ) ((x)/(y))
+
+#undef DIVC
+#define DIVC( x, y ) (((x)+(y)-1)/(y))
+
+#undef DIVR
+#define DIVR( x, y ) (((x)+((y)/2))/(y))
+
+#undef SHRR
+#define SHRR( x, n ) ((((x)>>((n)-1))+1)>>1)
+
+#undef BITN
+#define BITN( w, n ) (((w)[(n)/32] >> ((n)%32)) & 1)
+
+#undef BITNSET
+#define BITNSET( w, n, b ) M_BEGIN (w)[(n)/32] |= ((U32)(b))<<((n)%32); M_END
+
+/* -------------------------------- *
+ * Section attribute *
+ * -------------------------------- */
+#undef PLACE_IN_SECTION
+#define PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__)))
+
+/* ----------------------------------- *
+ * Packed usage (compiler dependent) *
+ * ----------------------------------- */
+#undef PACKED__
+#undef PACKED_STRUCT
+
+#if defined ( __CC_ARM )
+ #if defined ( __GNUC__ )
+ /* GNU extension */
+ #define PACKED__ __attribute__((packed))
+ #define PACKED_STRUCT struct PACKED__
+ #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050U)
+ #define PACKED__ __attribute__((packed))
+ #define PACKED_STRUCT struct PACKED__
+ #else
+ #define PACKED__(TYPE) __packed TYPE
+ #define PACKED_STRUCT PACKED__(struct)
+ #endif
+#elif defined ( __GNUC__ )
+ #define PACKED__ __attribute__((packed))
+ #define PACKED_STRUCT struct PACKED__
+#elif defined (__ICCARM__)
+ #define PACKED_STRUCT __packed struct
+#else
+ #define PACKED_STRUCT __packed struct
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__STM32_WPAN_COMMON_H */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/dbg_trace.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/dbg_trace.c
new file mode 100644
index 0000000..371cfdb
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/dbg_trace.c
@@ -0,0 +1,360 @@
+/**
+ ******************************************************************************
+ * @file dbg_trace.c
+ * @author MCD Application Team
+ * @brief This file contains the Interface with BLE Drivers functions.
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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.
+ *
+ ******************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "utilities_common.h"
+#include "stm_queue.h"
+#include "dbg_trace.h"
+
+/* Definition of the function */
+#if !defined(__GNUC__) /* SW4STM32 */
+size_t __write(int handle, const unsigned char * buf, size_t bufSize);
+#endif
+
+/** @addtogroup TRACE
+ * @{
+ */
+
+
+/** @defgroup TRACE_LOG
+ * @brief TRACE Logging functions
+ * @{
+ */
+
+/* Private typedef -----------------------------------------------------------*/
+/** @defgroup TRACE Log private typedef
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/* Private defines -----------------------------------------------------------*/
+/** @defgroup TRACE Log private defines
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/* Private macros ------------------------------------------------------------*/
+/** @defgroup TRACE Log private macros
+ * @{
+ */
+/**
+ * @}
+ */
+
+/* Private variables ---------------------------------------------------------*/
+/** @defgroup TRACE Log private variables
+ * @{
+ */
+#if (( CFG_DEBUG_TRACE_FULL != 0 ) || ( CFG_DEBUG_TRACE_LIGHT != 0 ))
+#if (DBG_TRACE_USE_CIRCULAR_QUEUE != 0)
+static queue_t MsgDbgTraceQueue;
+static uint8_t MsgDbgTraceQueueBuff[DBG_TRACE_MSG_QUEUE_SIZE];
+#endif
+__IO ITStatus DbgTracePeripheralReady = SET;
+#endif
+/**
+ * @}
+ */
+
+/* Global variables ----------------------------------------------------------*/
+/** @defgroup TRACE Log Global variable
+ * @{
+ */
+/**
+ * @}
+ */
+
+/* Private function prototypes -----------------------------------------------*/
+/** @defgroup TRACE Log private function prototypes
+ * @{
+ */
+#if (( CFG_DEBUG_TRACE_FULL != 0 ) || ( CFG_DEBUG_TRACE_LIGHT != 0 ))
+static void DbgTrace_TxCpltCallback(void);
+#endif
+
+
+/**
+ * @}
+ */
+
+
+/* Private Functions Definition ------------------------------------------------------*/
+/** @defgroup TRACE Log Private function
+ * @{
+ */
+
+
+/* Functions Definition ------------------------------------------------------*/
+/** @defgroup TRACE Log APIs
+ * @{
+ */
+
+/**
+ * @brief DbgTraceGetFileName: Return filename string extracted from full path information
+ * @param *fullPath Fullpath string (path + filename)
+ * @retval char* Pointer on filename string
+ */
+
+const char *DbgTraceGetFileName(const char *fullpath)
+{
+ const char *ret = fullpath;
+
+ if (strrchr(fullpath, '\\') != NULL)
+ {
+ ret = strrchr(fullpath, '\\') + 1;
+ }
+ else if (strrchr(fullpath, '/') != NULL)
+ {
+ ret = strrchr(fullpath, '/') + 1;
+ }
+
+ return ret;
+}
+
+/**
+ * @brief DbgTraceBuffer: Output buffer content information to output Stream
+ * @param *pBuffer Pointer on buffer to be output
+ * @param u32Length buffer Size
+ * @paramt strFormat string as expected by "printf" function. Used to desrcibe buffer content information.
+ * @param ... Parameters to be "formatted" in strFormat string (if any)
+ * @retval None
+ */
+
+void DbgTraceBuffer(const void *pBuffer, uint32_t u32Length, const char *strFormat, ...)
+{
+ va_list vaArgs;
+ uint32_t u32Index;
+ va_start(vaArgs, strFormat);
+ vprintf(strFormat, vaArgs);
+ va_end(vaArgs);
+ for (u32Index = 0; u32Index < u32Length; u32Index ++)
+ {
+ printf(" %02X", ((const uint8_t *) pBuffer)[u32Index]);
+ }
+}
+
+#if (( CFG_DEBUG_TRACE_FULL != 0 ) || ( CFG_DEBUG_TRACE_LIGHT != 0 ))
+/**
+ * @brief DBG_TRACE USART Tx Transfer completed callback
+ * @param UartHandle: UART handle.
+ * @note Indicate the end of the transmission of a DBG_TRACE trace buffer to DBG_TRACE USART. If queue
+ * contains new trace data to transmit, start a new transmission.
+ * @retval None
+ */
+static void DbgTrace_TxCpltCallback(void)
+{
+#if (DBG_TRACE_USE_CIRCULAR_QUEUE != 0)
+ uint8_t* buf;
+ uint16_t bufSize;
+
+ BACKUP_PRIMASK();
+
+ DISABLE_IRQ(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
+ /* Remove element just sent to UART */
+ CircularQueue_Remove(&MsgDbgTraceQueue,&bufSize);
+
+ /* Sense if new data to be sent */
+ buf=CircularQueue_Sense(&MsgDbgTraceQueue,&bufSize);
+
+
+ if ( buf != NULL)
+ {
+ RESTORE_PRIMASK();
+ DbgOutputTraces((uint8_t*)buf, bufSize, DbgTrace_TxCpltCallback);
+ }
+ else
+ {
+ DbgTracePeripheralReady = SET;
+ RESTORE_PRIMASK();
+ }
+
+#else
+ BACKUP_PRIMASK();
+
+ DISABLE_IRQ(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
+
+ DbgTracePeripheralReady = SET;
+
+ RESTORE_PRIMASK();
+#endif
+}
+#endif
+
+void DbgTraceInit( void )
+{
+#if (( CFG_DEBUG_TRACE_FULL != 0 ) || ( CFG_DEBUG_TRACE_LIGHT != 0 ))
+ DbgOutputInit();
+#if (DBG_TRACE_USE_CIRCULAR_QUEUE != 0)
+ CircularQueue_Init(&MsgDbgTraceQueue, MsgDbgTraceQueueBuff, DBG_TRACE_MSG_QUEUE_SIZE, 0, CIRCULAR_QUEUE_SPLIT_IF_WRAPPING_FLAG);
+#endif
+#endif
+ return;
+}
+
+
+#if (( CFG_DEBUG_TRACE_FULL != 0 ) || ( CFG_DEBUG_TRACE_LIGHT != 0 ))
+#if defined(__GNUC__) /* SW4STM32 (GCC) */
+/**
+ * @brief _write: override the __write standard lib function to redirect printf to USART.
+ * @param handle output handle (STDIO, STDERR...)
+ * @param buf buffer to write
+ * @param bufsize buffer size
+ * @param ...: arguments to be formatted in format string
+ * @retval none
+ */
+size_t _write(int handle, const unsigned char * buf, size_t bufSize)
+{
+ return ( DbgTraceWrite(handle, buf, bufSize) );
+}
+
+#else
+/**
+ * @brief __write: override the _write standard lib function to redirect printf to USART.
+ * @param handle output handle (STDIO, STDERR...)
+ * @param buf buffer to write
+ * @param bufsize buffer size
+ * @param ...: arguments to be formatted in format string
+ * @retval none
+ */
+size_t __write(int handle, const unsigned char * buf, size_t bufSize)
+{
+ return ( DbgTraceWrite(handle, buf, bufSize) );
+}
+#endif /* #if defined(__GNUC__) */
+
+/**
+ * @brief Override the standard lib function to redirect printf to USART.
+ * @param handle output handle (STDIO, STDERR...)
+ * @param buf buffer to write
+ * @param bufsize buffer size
+ * @retval Number of elements written
+ */
+size_t DbgTraceWrite(int handle, const unsigned char * buf, size_t bufSize)
+{
+ size_t chars_written = 0;
+ uint8_t* buffer;
+
+ BACKUP_PRIMASK();
+
+ /* Ignore flushes */
+ if ( handle == -1 )
+ {
+ chars_written = ( size_t ) 0;
+ }
+ /* Only allow stdout/stderr output */
+ else if ( ( handle != 1 ) && ( handle != 2 ) )
+ {
+ chars_written = ( size_t ) - 1;
+ }
+ /* Parameters OK, call the low-level character output routine */
+ else if (bufSize != 0)
+ {
+ chars_written = bufSize;
+ /* If queue emepty and TX free, send directly */
+ /* CS Start */
+
+#if (DBG_TRACE_USE_CIRCULAR_QUEUE != 0)
+ DISABLE_IRQ(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
+ buffer=CircularQueue_Add(&MsgDbgTraceQueue,(uint8_t*)buf, bufSize,1);
+ if (buffer && DbgTracePeripheralReady)
+ {
+ DbgTracePeripheralReady = RESET;
+ RESTORE_PRIMASK();
+ DbgOutputTraces((uint8_t*)buffer, bufSize, DbgTrace_TxCpltCallback);
+ }
+ else
+ {
+ RESTORE_PRIMASK();
+ }
+#else
+ DISABLE_IRQ(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
+ DbgTracePeripheralReady = RESET;
+ RESTORE_PRIMASK();
+
+ DbgOutputTraces((uint8_t*)buf, bufSize, DbgTrace_TxCpltCallback);
+ while (!DbgTracePeripheralReady);
+#endif
+ /* CS END */
+ }
+ return ( chars_written );
+}
+
+#if defined ( __CC_ARM ) || defined (__ARMCC_VERSION) /* Keil */
+
+/**
+ Called from assert() and prints a message on stderr and calls abort().
+
+ \param[in] expr assert expression that was not TRUE
+ \param[in] file source file of the assertion
+ \param[in] line source line of the assertion
+*/
+__attribute__((weak,noreturn))
+void __aeabi_assert (const char *expr, const char *file, int line) {
+ char str[12], *p;
+
+ fputs("*** assertion failed: ", stderr);
+ fputs(expr, stderr);
+ fputs(", file ", stderr);
+ fputs(file, stderr);
+ fputs(", line ", stderr);
+
+ p = str + sizeof(str);
+ *--p = '\0';
+ *--p = '\n';
+ while (line > 0) {
+ *--p = '0' + (line % 10);
+ line /= 10;
+ }
+ fputs(p, stderr);
+
+ abort();
+}
+
+/* For KEIL re-implement our own version of fputc */
+int fputc(int ch, FILE *f)
+{
+ /* temp char avoids endianness issue */
+ char tempch = ch;
+ /* Write one character to Debug Circular Queue */
+ DbgTraceWrite(1U, (const unsigned char *) &tempch, 1);
+ return ch;
+}
+
+#endif /* #if defined ( __CC_ARM ) */
+
+#endif /* #if (( CFG_DEBUG_TRACE_FULL != 0 ) || ( CFG_DEBUG_TRACE_LIGHT != 0 )) */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/dbg_trace.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/dbg_trace.h
new file mode 100644
index 0000000..bf08e3d
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/dbg_trace.h
@@ -0,0 +1,103 @@
+/**
+ ******************************************************************************
+ * @file dbg_trace.h
+ * @author MCD Application Team
+ * @brief Header for dbg_trace.c
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __DBG_TRACE_H
+#define __DBG_TRACE_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Exported types ------------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+#if ( ( CFG_DEBUG_TRACE_FULL != 0 ) || ( CFG_DEBUG_TRACE_LIGHT != 0 ) )
+#define PRINT_LOG_BUFF_DBG(...) DbgTraceBuffer(__VA_ARGS__)
+#if ( CFG_DEBUG_TRACE_FULL != 0 )
+#define PRINT_MESG_DBG(...) do{printf("\r\n [%s][%s][%d] ", DbgTraceGetFileName(__FILE__),__FUNCTION__,__LINE__);printf(__VA_ARGS__);}while(0);
+#else
+#define PRINT_MESG_DBG printf
+#endif
+#else
+#define PRINT_LOG_BUFF_DBG(...)
+#define PRINT_MESG_DBG(...)
+#endif
+
+#define PRINT_NO_MESG(...)
+
+/* Exported functions ------------------------------------------------------- */
+
+ /**
+ * @brief Request the user to initialize the peripheral to output traces
+ *
+ * @param None
+ * @retval None
+ */
+extern void DbgOutputInit( void );
+
+/**
+ * @brief Request the user to sent the traces on the output peripheral
+ *
+ * @param p_data: Address of the buffer to be sent
+ * @param size: Size of the data to be sent
+ * @param cb: Function to be called when the data has been sent
+ * @retval None
+ */
+extern void DbgOutputTraces( uint8_t *p_data, uint16_t size, void (*cb)(void) );
+
+/**
+ * @brief DbgTraceInit Initialize Logging feature.
+ *
+ * @param: None
+ * @retval: None
+ */
+void DbgTraceInit( void );
+
+/**********************************************************************************************************************/
+/** This function outputs into the log the buffer (in hex) and the provided format string and arguments.
+ ***********************************************************************************************************************
+ *
+ * @param pBuffer Buffer to be output into the logs.
+ * @param u32Length Length of the buffer, in bytes.
+ * @param strFormat The format string in printf() style.
+ * @param ... Arguments of the format string.
+ *
+ **********************************************************************************************************************/
+void DbgTraceBuffer( const void *pBuffer , uint32_t u32Length , const char *strFormat , ... );
+
+const char *DbgTraceGetFileName( const char *fullpath );
+
+/**
+ * @brief Override the standard lib function to redirect printf to USART.
+ * @param handle output handle (STDIO, STDERR...)
+ * @param buf buffer to write
+ * @param bufsize buffer size
+ * @retval Number of elements written
+ */
+size_t DbgTraceWrite(int handle, const unsigned char * buf, size_t bufSize);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__DBG_TRACE_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/otp.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/otp.c
new file mode 100644
index 0000000..2471bf7
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/otp.c
@@ -0,0 +1,52 @@
+/**
+ ******************************************************************************
+ * @file otp.c
+ * @author MCD Application Team
+ * @brief OTP manager
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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.
+ *
+ ******************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "utilities_common.h"
+
+#include "otp.h"
+
+/* Private typedef -----------------------------------------------------------*/
+/* Private defines -----------------------------------------------------------*/
+/* Private macros ------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/* Global variables ----------------------------------------------------------*/
+/* Private function prototypes -----------------------------------------------*/
+/* Functions Definition ------------------------------------------------------*/
+
+uint8_t * OTP_Read( uint8_t id )
+{
+ uint8_t *p_id;
+
+ p_id = (uint8_t*)(CFG_OTP_END_ADRESS - 7) ;
+
+ while( ((*( p_id + 7 )) != id) && ( p_id != (uint8_t*)CFG_OTP_BASE_ADDRESS) )
+ {
+ p_id -= 8 ;
+ }
+
+ if((*( p_id + 7 )) != id)
+ {
+ p_id = 0 ;
+ }
+
+ return p_id ;
+}
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/otp.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/otp.h
new file mode 100644
index 0000000..c4f2a40
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/otp.h
@@ -0,0 +1,65 @@
+/**
+ ******************************************************************************
+ * @file otp.h
+ * @author MCD Application Team
+ * @brief OTP manager interface
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __OTP_H
+#define __OTP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /* Includes ------------------------------------------------------------------*/
+#include "utilities_common.h"
+
+ /* Exported types ------------------------------------------------------------*/
+ typedef PACKED_STRUCT
+ {
+ uint8_t bd_address[6];
+ uint8_t hse_tuning;
+ uint8_t id;
+ } OTP_ID0_t;
+
+ /* Exported constants --------------------------------------------------------*/
+ /* External variables --------------------------------------------------------*/
+ /* Exported macros -----------------------------------------------------------*/
+ /* Exported functions ------------------------------------------------------- */
+
+ /**
+ * @brief This API return the address (64 bits aligned) of the ID parameter in the OTP
+ * It returns the first ID declaration found from the higher address down to the base address
+ * The user shall fill the OTP from the base address to the top of the OTP so that the more recent
+ * declaration is returned by the API
+ * The OTP manager handles only 64bits parameter
+ * | Id | Parameter |
+ * | 8bits | 58bits |
+ * | MSB | LSB |
+ *
+ * @param id: ID of the parameter to read from OTP
+ * @retval Address of the ID in the OTP - returns 0 when no ID found
+ */
+ uint8_t * OTP_Read( uint8_t id );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__OTP_H */
+
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/stm_list.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/stm_list.c
new file mode 100644
index 0000000..69c8c06
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/stm_list.c
@@ -0,0 +1,207 @@
+/**
+ ******************************************************************************
+ * @file stm_list.c
+ * @author MCD Application Team
+ * @brief TCircular Linked List Implementation.
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ ******************************************************************************
+ */
+
+
+/******************************************************************************
+ * Include Files
+ ******************************************************************************/
+#include "utilities_common.h"
+
+#include "stm_list.h"
+
+/******************************************************************************
+ * Function Definitions
+ ******************************************************************************/
+void LST_init_head (tListNode * listHead)
+{
+ listHead->next = listHead;
+ listHead->prev = listHead;
+}
+
+uint8_t LST_is_empty (tListNode * listHead)
+{
+ uint32_t primask_bit;
+ uint8_t return_value;
+
+ primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
+ __disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
+ if(listHead->next == listHead)
+ {
+ return_value = TRUE;
+ }
+ else
+ {
+ return_value = FALSE;
+ }
+ __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
+
+ return return_value;
+}
+
+void LST_insert_head (tListNode * listHead, tListNode * node)
+{
+ uint32_t primask_bit;
+
+ primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
+ __disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
+
+ node->next = listHead->next;
+ node->prev = listHead;
+ listHead->next = node;
+ (node->next)->prev = node;
+
+ __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
+}
+
+
+void LST_insert_tail (tListNode * listHead, tListNode * node)
+{
+ uint32_t primask_bit;
+
+ primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
+ __disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
+
+ node->next = listHead;
+ node->prev = listHead->prev;
+ listHead->prev = node;
+ (node->prev)->next = node;
+
+ __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
+}
+
+
+void LST_remove_node (tListNode * node)
+{
+ uint32_t primask_bit;
+
+ primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
+ __disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
+
+ (node->prev)->next = node->next;
+ (node->next)->prev = node->prev;
+
+ __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
+}
+
+
+void LST_remove_head (tListNode * listHead, tListNode ** node )
+{
+ uint32_t primask_bit;
+
+ primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
+ __disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
+
+ *node = listHead->next;
+ LST_remove_node (listHead->next);
+
+ __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
+}
+
+
+void LST_remove_tail (tListNode * listHead, tListNode ** node )
+{
+ uint32_t primask_bit;
+
+ primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
+ __disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
+
+ *node = listHead->prev;
+ LST_remove_node (listHead->prev);
+
+ __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
+}
+
+
+void LST_insert_node_after (tListNode * node, tListNode * ref_node)
+{
+ uint32_t primask_bit;
+
+ primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
+ __disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
+
+ node->next = ref_node->next;
+ node->prev = ref_node;
+ ref_node->next = node;
+ (node->next)->prev = node;
+
+ __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
+}
+
+
+void LST_insert_node_before (tListNode * node, tListNode * ref_node)
+{
+ uint32_t primask_bit;
+
+ primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
+ __disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
+
+ node->next = ref_node;
+ node->prev = ref_node->prev;
+ ref_node->prev = node;
+ (node->prev)->next = node;
+
+ __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
+}
+
+
+int LST_get_size (tListNode * listHead)
+{
+ int size = 0;
+ tListNode * temp;
+ uint32_t primask_bit;
+
+ primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
+ __disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
+
+ temp = listHead->next;
+ while (temp != listHead)
+ {
+ size++;
+ temp = temp->next;
+ }
+
+ __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
+
+ return (size);
+}
+
+void LST_get_next_node (tListNode * ref_node, tListNode ** node)
+{
+ uint32_t primask_bit;
+
+ primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
+ __disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
+
+ *node = ref_node->next;
+
+ __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
+}
+
+
+void LST_get_prev_node (tListNode * ref_node, tListNode ** node)
+{
+ uint32_t primask_bit;
+
+ primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
+ __disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
+
+ *node = ref_node->prev;
+
+ __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
+}
+
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/stm_list.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/stm_list.h
new file mode 100644
index 0000000..83bbe54
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/stm_list.h
@@ -0,0 +1,63 @@
+/**
+ ******************************************************************************
+ * @file stm_list.h
+ * @author MCD Application Team
+ * @brief Header file for linked list library.
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 _STM_LIST_H_
+#define _STM_LIST_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32_wpan_common.h"
+
+typedef PACKED_STRUCT _tListNode {
+ struct _tListNode * next;
+ struct _tListNode * prev;
+} tListNode;
+
+void LST_init_head (tListNode * listHead);
+
+uint8_t LST_is_empty (tListNode * listHead);
+
+void LST_insert_head (tListNode * listHead, tListNode * node);
+
+void LST_insert_tail (tListNode * listHead, tListNode * node);
+
+void LST_remove_node (tListNode * node);
+
+void LST_remove_head (tListNode * listHead, tListNode ** node );
+
+void LST_remove_tail (tListNode * listHead, tListNode ** node );
+
+void LST_insert_node_after (tListNode * node, tListNode * ref_node);
+
+void LST_insert_node_before (tListNode * node, tListNode * ref_node);
+
+int LST_get_size (tListNode * listHead);
+
+void LST_get_next_node (tListNode * ref_node, tListNode ** node);
+
+void LST_get_prev_node (tListNode * ref_node, tListNode ** node);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _STM_LIST_H_ */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/stm_queue.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/stm_queue.c
new file mode 100644
index 0000000..3054812
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/stm_queue.c
@@ -0,0 +1,383 @@
+/**
+ ******************************************************************************
+ * @file stm_queue.c
+ * @author MCD Application Team
+ * @brief Queue management
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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.
+ *
+ ******************************************************************************
+ */
+
+/* Includes ------------------------------------------------------------------*/
+
+/* Includes ------------------------------------------------------------------*/
+#include "utilities_common.h"
+
+#include "stm_queue.h"
+
+/* Private define ------------------------------------------------------------*/
+/* Private typedef -------------------------------------------------------------*/
+/* Private macro -------------------------------------------------------------*/
+#define MOD(X,Y) (((X) >= (Y)) ? ((X)-(Y)) : (X))
+
+/* Private variables ---------------------------------------------------------*/
+/* Global variables ----------------------------------------------------------*/
+/* Extern variables ----------------------------------------------------------*/
+/* Private function prototypes -----------------------------------------------*/
+/* Private functions ---------------------------------------------------------*/
+/* Public functions ----------------------------------------------------------*/
+
+/**
+ * @brief Initilaiilze queue structure .
+ * @note This function is used to initialize the global queue structure.
+ * @param q: pointer on queue structure to be initialised
+ * @param queueBuffer: pointer on Queue Buffer
+ * @param queueSize: Size of Queue Buffer
+ * @param elementSize: Size of an element in the queue. if =0, the queue will manage variable sizze elements
+ * @retval always 0
+ */
+int CircularQueue_Init(queue_t *q, uint8_t* queueBuffer, uint32_t queueSize, uint16_t elementSize, uint8_t optionFlags)
+{
+ q->qBuff = queueBuffer;
+ q->first = 0;
+ q->last = 0; /* queueSize-1; */
+ q->byteCount = 0;
+ q->elementCount = 0;
+ q->queueMaxSize = queueSize;
+ q->elementSize = elementSize;
+ q->optionFlags = optionFlags;
+
+ if ((optionFlags & CIRCULAR_QUEUE_SPLIT_IF_WRAPPING_FLAG) && q-> elementSize)
+ {
+ /* can not deal with splitting at the end of buffer with fixed size element */
+ return -1;
+ }
+ return 0;
+}
+
+/**
+ * @brief Add element to the queue .
+ * @note This function is used to add one or more element(s) to the Circular Queue .
+ * @param q: pointer on queue structure to be handled
+ * @param X; pointer on element(s) to be added
+ * @param elementSize: Size of element to be added to the queue. Only used if the queue manage variable size elements
+ * @param nbElements: number of elements in the in buffer pointed by x
+ * @retval pointer on last element just added to the queue, NULL if the element to be added do not fit in the queue (too big)
+ */
+uint8_t* CircularQueue_Add(queue_t *q, uint8_t* x, uint16_t elementSize, uint32_t nbElements)
+{
+
+ uint8_t* ptr = NULL; /* fct return ptr to the element freshly added, if no room fct return NULL */
+ uint16_t curElementSize = 0; /* the size of the element currently stored at q->last position */
+ uint8_t elemSizeStorageRoom = 0 ; /* Indicate the header (which contain only size) of element in case of varaibale size element (q->elementsize == 0) */
+ uint32_t curBuffPosition; /* the current position in the queue buffer */
+ uint32_t i; /* loop counter */
+ uint32_t NbBytesToCopy = 0, NbCopiedBytes = 0 ; /* Indicators for copying bytes in queue */
+ uint32_t eob_free_size; /* Eof End of Quque Buffer Free Size */
+ uint8_t wrap_will_occur = 0; /* indicate if a wrap around will occurs */
+ uint8_t wrapped_element_eob_size; /* In case of Wrap around, indicate size of parta of element that fit at thened of the queuue buffer */
+ uint16_t overhead = 0; /* In case of CIRCULAR_QUEUE_SPLIT_IF_WRAPPING_FLAG or CIRCULAR_QUEUE_NO_WRAP_FLAG options,
+ indcate the size overhead that will be generated by adding the element with wrap management (split or no wrap ) */
+
+
+ elemSizeStorageRoom = (q->elementSize == 0) ? 2 : 0;
+ /* retrieve the size of last element sored: the value stored at the beginning of the queue element if element size is variable otherwise take it from fixed element Size member */
+ if (q->byteCount)
+ {
+ curElementSize = (q->elementSize == 0) ? q->qBuff[q->last] + ((q->qBuff[MOD((q->last+1), q->queueMaxSize)])<<8) + 2 : q->elementSize;
+ }
+ /* if queue element have fixed size , reset the elementSize arg with fixed element size value */
+ if (q->elementSize > 0)
+ {
+ elementSize = q->elementSize;
+ }
+
+ eob_free_size = (q->last >= q->first) ? q->queueMaxSize - (q->last + curElementSize) : 0;
+
+ /* check how many bytes of wrapped element (if anay) are at end of buffer */
+ wrapped_element_eob_size = (((elementSize + elemSizeStorageRoom )*nbElements) < eob_free_size) ? 0 : (eob_free_size % (elementSize + elemSizeStorageRoom));
+ wrap_will_occur = wrapped_element_eob_size > elemSizeStorageRoom;
+
+ overhead = (wrap_will_occur && (q->optionFlags & CIRCULAR_QUEUE_NO_WRAP_FLAG)) ? wrapped_element_eob_size : overhead;
+ overhead = (wrap_will_occur && (q->optionFlags & CIRCULAR_QUEUE_SPLIT_IF_WRAPPING_FLAG)) ? elemSizeStorageRoom : overhead;
+
+
+ /* Store now the elements if ennough room for all elements */
+ if (elementSize && ((q->byteCount + ((elementSize + elemSizeStorageRoom )*nbElements) + overhead) <= q->queueMaxSize))
+ {
+ /* loop to add all elements */
+ for (i=0; i < nbElements; i++)
+ {
+ q->last = MOD ((q->last + curElementSize),q->queueMaxSize);
+ curBuffPosition = q->last;
+
+ /* store the element */
+ /* store first the element size if element size is variable */
+ if (q->elementSize == 0)
+ {
+ q->qBuff[curBuffPosition++]= elementSize & 0xFF;
+ curBuffPosition = MOD(curBuffPosition, q->queueMaxSize);
+ q->qBuff[curBuffPosition++]= (elementSize & 0xFF00) >> 8 ;
+ curBuffPosition = MOD(curBuffPosition, q->queueMaxSize);
+ q->byteCount += 2;
+ }
+
+ /* Identify number of bytes of copy takeing account possible wrap, in this case NbBytesToCopy will contains size that fit at end of the queue buffer */
+ NbBytesToCopy = MIN((q->queueMaxSize-curBuffPosition),elementSize);
+ /* check if no wrap (NbBytesToCopy == elementSize) or if Wrap and no spsicf option;
+ In this case part of data will copied at the end of the buffer and the rest a the beginning */
+ if ((NbBytesToCopy == elementSize) || ((NbBytesToCopy < elementSize) && (q->optionFlags == CIRCULAR_QUEUE_NO_FLAG)))
+ {
+ /* Copy First part (or emtire buffer ) from current position up to the end of the buffer queue (or before if enough room) */
+ memcpy(&q->qBuff[curBuffPosition],&x[i*elementSize],NbBytesToCopy);
+ /* Adjust bytes count */
+ q->byteCount += NbBytesToCopy;
+ /* Wrap */
+ curBuffPosition = 0;
+ /* set NbCopiedBytes bytes with ampount copied */
+ NbCopiedBytes = NbBytesToCopy;
+ /* set the rest to copy if wrao , if no wrap will be 0 */
+ NbBytesToCopy = elementSize - NbBytesToCopy;
+ /* set the current element Size, will be used to calaculate next last position at beginning of loop */
+ curElementSize = (elementSize) + elemSizeStorageRoom ;
+ }
+ else if (NbBytesToCopy) /* We have a wrap to manage */
+ {
+ /* case of CIRCULAR_QUEUE_NO_WRAP_FLAG option */
+ if (q->optionFlags & CIRCULAR_QUEUE_NO_WRAP_FLAG)
+ {
+ /* if element size are variable and NO_WRAP option, Invalidate end of buffer setting 0xFFFF size*/
+ if (q->elementSize == 0)
+ {
+ q->qBuff[curBuffPosition-2] = 0xFF;
+ q->qBuff[curBuffPosition-1] = 0xFF;
+ }
+ q->byteCount += NbBytesToCopy; /* invalid data at the end of buffer are take into account in byteCount */
+ /* No bytes coped a the end of buffer */
+ NbCopiedBytes = 0;
+ /* all element to be copied at the begnning of buffer */
+ NbBytesToCopy = elementSize;
+ /* Wrap */
+ curBuffPosition = 0;
+ /* if variable size element, invalidate end of buffer setting OxFFFF in element header (size) */
+ if (q->elementSize == 0)
+ {
+ q->qBuff[curBuffPosition++] = NbBytesToCopy & 0xFF;
+ q->qBuff[curBuffPosition++] = (NbBytesToCopy & 0xFF00) >> 8 ;
+ q->byteCount += 2;
+ }
+
+ }
+ /* case of CIRCULAR_QUEUE_SPLIT_IF_WRAPPING_FLAG option */
+ else if (q->optionFlags & CIRCULAR_QUEUE_SPLIT_IF_WRAPPING_FLAG)
+ {
+ if (q->elementSize == 0)
+ {
+ /* reset the size of current element to the nb bytes fitting at the end of buffer */
+ q->qBuff[curBuffPosition-2] = NbBytesToCopy & 0xFF;
+ q->qBuff[curBuffPosition-1] = (NbBytesToCopy & 0xFF00) >> 8 ;
+ /* copy the bytes */
+ memcpy(&q->qBuff[curBuffPosition],&x[i*elementSize],NbBytesToCopy);
+ q->byteCount += NbBytesToCopy;
+ /* set the number of copied bytes */
+ NbCopiedBytes = NbBytesToCopy;
+ /* set rest of data to be copied to begnning of buffer */
+ NbBytesToCopy = elementSize - NbBytesToCopy;
+ /* one element more dur to split in 2 elements */
+ q->elementCount++;
+ /* Wrap */
+ curBuffPosition = 0;
+ /* Set new size for rest of data */
+ q->qBuff[curBuffPosition++] = NbBytesToCopy & 0xFF;
+ q->qBuff[curBuffPosition++] = (NbBytesToCopy & 0xFF00) >> 8 ;
+ q->byteCount += 2;
+ }
+ else
+ {
+ /* Should not occur */
+ /* can not manage split Flag on Fixed size element */
+ /* Buffer is corrupted */
+ return NULL;
+ }
+ }
+ curElementSize = (NbBytesToCopy) + elemSizeStorageRoom ;
+ q->last = 0;
+ }
+
+ /* some remaining byte to copy */
+ if (NbBytesToCopy)
+ {
+ memcpy(&q->qBuff[curBuffPosition],&x[(i*elementSize)+NbCopiedBytes],NbBytesToCopy);
+ q->byteCount += NbBytesToCopy;
+ }
+
+ /* One more element */
+ q->elementCount++;
+ }
+
+ ptr = q->qBuff + (MOD((q->last+elemSizeStorageRoom ),q->queueMaxSize));
+ }
+ /* for Breakpoint only...to remove */
+ else
+ {
+ return NULL;
+ }
+ return ptr;
+}
+
+
+/**
+ * @brief Remove element from the queue and copy it in provided buffer
+ * @note This function is used to remove and element from the Circular Queue .
+ * @param q: pointer on queue structure to be handled
+ * @param elementSize: Pointer to return Size of element to be removed
+ * @param buffer: destination buffer where to copy element
+ * @retval Pointer on removed element. NULL if queue was empty
+ */
+uint8_t* CircularQueue_Remove_Copy(queue_t *q, uint16_t* elementSize, uint8_t* buffer)
+{
+ return NULL;
+}
+
+
+
+/**
+ * @brief Remove element from the queue.
+ * @note This function is used to remove and element from the Circular Queue .
+ * @param q: pointer on queue structure to be handled
+ * @param elementSize: Pointer to return Size of element to be removed (ignored if NULL)
+ * @retval Pointer on removed element. NULL if queue was empty
+ */
+uint8_t* CircularQueue_Remove(queue_t *q, uint16_t* elementSize)
+{
+ uint8_t elemSizeStorageRoom = 0;
+ uint8_t* ptr= NULL;
+ elemSizeStorageRoom = (q->elementSize == 0) ? 2 : 0;
+ uint16_t eltSize = 0;
+ if (q->byteCount > 0)
+ {
+ /* retrieve element Size */
+ eltSize = (q->elementSize == 0) ? q->qBuff[q->first] + ((q->qBuff[MOD((q->first+1), q->queueMaxSize)])<<8) : q->elementSize;
+
+ if ((q->optionFlags & CIRCULAR_QUEUE_NO_WRAP_FLAG) && !(q->optionFlags & CIRCULAR_QUEUE_SPLIT_IF_WRAPPING_FLAG))
+ {
+ if (((eltSize == 0xFFFF) && q->elementSize == 0 ) ||
+ ((q->first > q->last) && q->elementSize && ((q->queueMaxSize - q->first) < q->elementSize)))
+ {
+ /* all data from current position up to the end of buffer are invalid */
+ q->byteCount -= (q->queueMaxSize - q->first);
+ /* Adjust first element pos */
+ q->first = 0;
+ /* retrieve the right size after the wrap [if variable size element] */
+ eltSize = (q->elementSize == 0) ? q->qBuff[q->first] + ((q->qBuff[MOD((q->first+1), q->queueMaxSize)])<<8) : q->elementSize;
+ }
+ }
+
+ /* retrieve element */
+ ptr = q->qBuff + (MOD((q->first + elemSizeStorageRoom), q->queueMaxSize));
+
+ /* adjust byte count */
+ q->byteCount -= (eltSize + elemSizeStorageRoom) ;
+
+ /* Adjust q->first */
+ if (q->byteCount > 0)
+ {
+ q->first = MOD((q->first+ eltSize + elemSizeStorageRoom ), q->queueMaxSize);
+ }
+ /* adjust element count */
+ --q->elementCount;
+ }
+ if (elementSize != NULL)
+ {
+ *elementSize = eltSize;
+ }
+ return ptr;
+}
+
+
+/**
+ * @brief "Sense" first element of the queue, without removing it and copy it in provided buffer
+ * @note This function is used to return a pointer on the first element of the queue without removing it.
+ * @param q: pointer on queue structure to be handled
+ * @param elementSize: Pointer to return Size of element to be removed
+ * @param buffer: destination buffer where to copy element
+ * @retval Pointer on sensed element. NULL if queue was empty
+ */
+
+uint8_t* CircularQueue_Sense_Copy(queue_t *q, uint16_t* elementSize, uint8_t* buffer)
+{
+ return NULL;
+}
+
+
+/**
+ * @brief "Sense" first element of the queue, without removing it.
+ * @note This function is used to return a pointer on the first element of the queue without removing it.
+ * @param q: pointer on queue structure to be handled
+ * @param elementSize: Pointer to return Size of element to be removed (ignored if NULL)
+ * @retval Pointer on sensed element. NULL if queue was empty
+ */
+uint8_t* CircularQueue_Sense(queue_t *q, uint16_t* elementSize)
+{
+ uint8_t elemSizeStorageRoom = 0;
+ uint8_t* x= NULL;
+ elemSizeStorageRoom = (q->elementSize == 0) ? 2 : 0;
+ uint16_t eltSize = 0;
+ uint32_t FirstElemetPos = 0;
+
+ if (q->byteCount > 0)
+ {
+ FirstElemetPos = q->first;
+ eltSize = (q->elementSize == 0) ? q->qBuff[q->first] + ((q->qBuff[MOD((q->first+1), q->queueMaxSize)])<<8) : q->elementSize;
+
+ if ((q->optionFlags & CIRCULAR_QUEUE_NO_WRAP_FLAG) && !(q->optionFlags & CIRCULAR_QUEUE_SPLIT_IF_WRAPPING_FLAG))
+ {
+ if (((eltSize == 0xFFFF) && q->elementSize == 0 ) ||
+ ((q->first > q->last) && q->elementSize && ((q->queueMaxSize - q->first) < q->elementSize)))
+
+ {
+ /* all data from current position up to the end of buffer are invalid */
+ FirstElemetPos = 0; /* wrap to the begiining of buffer */
+
+ /* retrieve the right size after the wrap [if variable size element] */
+ eltSize = (q->elementSize == 0) ? q->qBuff[FirstElemetPos]+ ((q->qBuff[MOD((FirstElemetPos+1), q->queueMaxSize)])<<8) : q->elementSize;
+ }
+ }
+ /* retrieve element */
+ x = q->qBuff + (MOD((FirstElemetPos + elemSizeStorageRoom), q->queueMaxSize));
+ }
+ if (elementSize != NULL)
+ {
+ *elementSize = eltSize;
+ }
+ return x;
+}
+
+/**
+ * @brief Check if queue is empty.
+ * @note This function is used to to check if the queue is empty.
+ * @param q: pointer on queue structure to be handled
+ * @retval TRUE (!0) if the queue is empyu otherwise FALSE (0)
+ */
+int CircularQueue_Empty(queue_t *q)
+{
+ int ret=FALSE;
+ if (q->byteCount <= 0)
+ {
+ ret=TRUE;
+ }
+ return ret;
+}
+
+int CircularQueue_NbElement(queue_t *q)
+{
+ return q->elementCount;
+}
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/stm_queue.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/stm_queue.h
new file mode 100644
index 0000000..5c0e9e5
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/stm_queue.h
@@ -0,0 +1,59 @@
+/**
+ ******************************************************************************
+ * @file stm_queue.h
+ * @author MCD Application Team
+ * @brief Header for stm_queue.c
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __STM_QUEUE_H
+#define __STM_QUEUE_H
+
+/* Includes ------------------------------------------------------------------*/
+/* Exported define -----------------------------------------------------------*/
+/* Options flags */
+#define CIRCULAR_QUEUE_NO_FLAG 0
+#define CIRCULAR_QUEUE_NO_WRAP_FLAG 1
+#define CIRCULAR_QUEUE_SPLIT_IF_WRAPPING_FLAG 2
+
+
+/* Exported types ------------------------------------------------------------*/
+typedef struct {
+ uint8_t* qBuff; /* queue buffer, , provided by init fct */
+ uint32_t queueMaxSize; /* size of the queue, provided by init fct (in bytes)*/
+ uint16_t elementSize; /* -1 variable. If variable element size the size is stored in the 4 first of the queue element */
+ uint32_t first; /* position of first element */
+ uint32_t last; /* position of last element */
+ uint32_t byteCount; /* number of bytes in the queue */
+ uint32_t elementCount; /* number of element in the queue */
+ uint8_t optionFlags; /* option to enable specific features */
+} queue_t;
+
+/* Exported constants --------------------------------------------------------*/
+
+/* Exported macro ------------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+int CircularQueue_Init(queue_t *q, uint8_t* queueBuffer, uint32_t queueSize, uint16_t elementSize, uint8_t optionlags);
+uint8_t* CircularQueue_Add(queue_t *q, uint8_t* x, uint16_t elementSize, uint32_t nbElements);
+uint8_t* CircularQueue_Remove(queue_t *q, uint16_t* elementSize);
+uint8_t* CircularQueue_Sense(queue_t *q, uint16_t* elementSize);
+int CircularQueue_Empty(queue_t *q);
+int CircularQueue_NbElement(queue_t *q);
+uint8_t* CircularQueue_Remove_Copy(queue_t *q, uint16_t* elementSize, uint8_t* buffer);
+uint8_t* CircularQueue_Sense_Copy(queue_t *q, uint16_t* elementSize, uint8_t* buffer);
+
+
+#endif /* __STM_QUEUE_H */
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/utilities_common.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/utilities_common.h
new file mode 100644
index 0000000..b0d0cc1
--- /dev/null
+++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/utilities/utilities_common.h
@@ -0,0 +1,159 @@
+/**
+ ******************************************************************************
+ * @file utilities_common.h
+ * @author MCD Application Team
+ * @brief Common file to utilities
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2018-2021 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 __UTILITIES_COMMON_H
+#define __UTILITIES_COMMON_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include "app_conf.h"
+
+ /* -------------------------------- *
+ * Basic definitions *
+ * -------------------------------- */
+
+#undef NULL
+#define NULL 0
+
+#undef FALSE
+#define FALSE 0
+
+#undef TRUE
+#define TRUE (!0)
+
+ /* -------------------------------- *
+ * Critical Section definition *
+ * -------------------------------- */
+#undef BACKUP_PRIMASK
+#define BACKUP_PRIMASK() uint32_t primask_bit= __get_PRIMASK()
+
+#undef DISABLE_IRQ
+#define DISABLE_IRQ() __disable_irq()
+
+#undef RESTORE_PRIMASK
+#define RESTORE_PRIMASK() __set_PRIMASK(primask_bit)
+
+ /* -------------------------------- *
+ * Macro delimiters *
+ * -------------------------------- */
+#undef M_BEGIN
+#define M_BEGIN do {
+
+#undef M_END
+#define M_END } while(0)
+
+ /* -------------------------------- *
+ * Some useful macro definitions *
+ * -------------------------------- */
+#undef MAX
+#define MAX( x, y ) (((x)>(y))?(x):(y))
+
+#undef MIN
+#define MIN( x, y ) (((x)<(y))?(x):(y))
+
+#undef MODINC
+#define MODINC( a, m ) M_BEGIN (a)++; if ((a)>=(m)) (a)=0; M_END
+
+#undef MODDEC
+#define MODDEC( a, m ) M_BEGIN if ((a)==0) (a)=(m); (a)--; M_END
+
+#undef MODADD
+#define MODADD( a, b, m ) M_BEGIN (a)+=(b); if ((a)>=(m)) (a)-=(m); M_END
+
+#undef MODSUB
+#define MODSUB( a, b, m ) MODADD( a, (m)-(b), m )
+
+#undef ALIGN
+#ifdef WIN32
+#define ALIGN(n)
+#else
+#define ALIGN(n) __attribute__((aligned(n)))
+#endif
+
+#undef PAUSE
+#define PAUSE( t ) M_BEGIN \
+ volatile int _i; \
+ for ( _i = t; _i > 0; _i -- ); \
+ M_END
+#undef DIVF
+#define DIVF( x, y ) ((x)/(y))
+
+#undef DIVC
+#define DIVC( x, y ) (((x)+(y)-1)/(y))
+
+#undef DIVR
+#define DIVR( x, y ) (((x)+((y)/2))/(y))
+
+#undef SHRR
+#define SHRR( x, n ) ((((x)>>((n)-1))+1)>>1)
+
+#undef BITN
+#define BITN( w, n ) (((w)[(n)/32] >> ((n)%32)) & 1)
+
+#undef BITNSET
+#define BITNSET( w, n, b ) M_BEGIN (w)[(n)/32] |= ((U32)(b))<<((n)%32); M_END
+
+/* -------------------------------- *
+ * Section attribute *
+ * -------------------------------- */
+#define PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__)))
+
+/* ----------------------------------- *
+ * Packed usage (compiler dependent) *
+ * ----------------------------------- */
+#undef PACKED__
+#undef PACKED_STRUCT
+
+#if defined ( __CC_ARM )
+ #if defined ( __GNUC__ )
+ /* GNU extension */
+ #define PACKED__ __attribute__((packed))
+ #define PACKED_STRUCT struct PACKED__
+ #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050U)
+ #define PACKED__ __attribute__((packed))
+ #define PACKED_STRUCT struct PACKED__
+ #else
+ #define PACKED__(TYPE) __packed TYPE
+ #define PACKED_STRUCT PACKED__(struct)
+ #endif
+#elif defined ( __GNUC__ )
+ #define PACKED__ __attribute__((packed))
+ #define PACKED_STRUCT struct PACKED__
+#elif defined (__ICCARM__)
+ #define PACKED_STRUCT __packed struct
+#else
+ #define PACKED_STRUCT __packed struct
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__UTILITIES_COMMON_H */
+
+