Eric Betts 10 месяцев назад
Родитель
Сommit
5a825e1e25
5 измененных файлов с 545 добавлено и 522 удалено
  1. 209 185
      ble_gatt_aci.h
  2. 54 56
      ble_vs_codes.h
  3. 1 2
      seos_service.c
  4. 77 63
      stm32_wpan_common.h
  5. 204 216
      tl.h

+ 209 - 185
ble_gatt_aci.h

@@ -18,7 +18,6 @@
 #ifndef BLE_GATT_ACI_H__
 #define BLE_GATT_ACI_H__
 
-
 //#include "ble_types.h"
 #include <ble/core/auto/ble_types.h>
 
@@ -32,7 +31,7 @@
  * 
  * @return Value indicating success or error code.
  */
-tBleStatus aci_gatt_init( void );
+tBleStatus aci_gatt_init(void);
 
 /**
  * @brief ACI_GATT_ADD_SERVICE
@@ -63,11 +62,12 @@ tBleStatus aci_gatt_init( void );
  *        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 );
+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
@@ -88,12 +88,13 @@ tBleStatus aci_gatt_add_service( uint8_t Service_UUID_Type,
  * @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 );
+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
@@ -161,16 +162,17 @@ tBleStatus aci_gatt_include_service( uint16_t Service_Handle,
  *        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 );
+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
@@ -224,19 +226,20 @@ tBleStatus aci_gatt_add_char( uint16_t Service_Handle,
  * @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 );
+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
@@ -283,11 +286,12 @@ tBleStatus aci_gatt_add_char_desc( uint16_t Service_Handle,
  * @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 );
+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
@@ -297,8 +301,7 @@ tBleStatus aci_gatt_update_char_value( uint16_t Service_Handle,
  * @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 );
+tBleStatus aci_gatt_del_char(uint16_t Serv_Handle, uint16_t Char_Handle);
 
 /**
  * @brief ACI_GATT_DEL_SERVICE
@@ -307,7 +310,7 @@ tBleStatus aci_gatt_del_char( uint16_t Serv_Handle,
  * @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 );
+tBleStatus aci_gatt_del_service(uint16_t Serv_Handle);
 
 /**
  * @brief ACI_GATT_DEL_INCLUDE_SERVICE
@@ -318,8 +321,7 @@ tBleStatus aci_gatt_del_service( uint16_t Serv_Handle );
  * @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 );
+tBleStatus aci_gatt_del_include_service(uint16_t Serv_Handle, uint16_t Include_Handle);
 
 /**
  * @brief ACI_GATT_SET_EVENT_MASK
@@ -352,7 +354,7 @@ tBleStatus aci_gatt_del_include_service( uint16_t Serv_Handle,
  *        - 0x00400000: ACI_GATT_NOTIFICATION_EXT_EVENT
  * @return Value indicating success or error code.
  */
-tBleStatus aci_gatt_set_event_mask( uint32_t GATT_Evt_Mask );
+tBleStatus aci_gatt_set_event_mask(uint32_t GATT_Evt_Mask);
 
 /**
  * @brief ACI_GATT_EXCHANGE_CONFIG
@@ -367,7 +369,7 @@ tBleStatus aci_gatt_set_event_mask( uint32_t GATT_Evt_Mask );
  *        - 0x0000 ... 0x0EFF
  * @return Value indicating success or error code.
  */
-tBleStatus aci_gatt_exchange_config( uint16_t Connection_Handle );
+tBleStatus aci_gatt_exchange_config(uint16_t Connection_Handle);
 
 /**
  * @brief ACI_ATT_FIND_INFO_REQ
@@ -384,9 +386,8 @@ tBleStatus aci_gatt_exchange_config( uint16_t Connection_Handle );
  * @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 );
+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
@@ -409,12 +410,13 @@ tBleStatus aci_att_find_info_req( uint16_t Connection_Handle,
  * @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 );
+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
@@ -432,11 +434,12 @@ tBleStatus aci_att_find_by_type_value_req( uint16_t Connection_Handle,
  * @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 );
+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
@@ -458,11 +461,12 @@ tBleStatus aci_att_read_by_type_req( uint16_t Connection_Handle,
  * @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 );
+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
@@ -483,11 +487,12 @@ tBleStatus aci_att_read_by_group_type_req( uint16_t Connection_Handle,
  * @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 );
+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
@@ -509,8 +514,7 @@ tBleStatus aci_att_prepare_write_req( uint16_t Connection_Handle,
  *        - 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 );
+tBleStatus aci_att_execute_write_req(uint16_t Connection_Handle, uint8_t Execute);
 
 /**
  * @brief ACI_GATT_DISC_ALL_PRIMARY_SERVICES
@@ -528,7 +532,7 @@ tBleStatus aci_att_execute_write_req( uint16_t Connection_Handle,
  *          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 );
+tBleStatus aci_gatt_disc_all_primary_services(uint16_t Connection_Handle);
 
 /**
  * @brief ACI_GATT_DISC_PRIMARY_SERVICE_BY_UUID
@@ -550,9 +554,10 @@ tBleStatus aci_gatt_disc_all_primary_services( uint16_t Connection_Handle );
  * @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 );
+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
@@ -573,9 +578,10 @@ tBleStatus aci_gatt_disc_primary_service_by_uuid( uint16_t Connection_Handle,
  * @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 );
+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
@@ -595,9 +601,10 @@ tBleStatus aci_gatt_find_included_services( uint16_t Connection_Handle,
  * @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 );
+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
@@ -620,11 +627,12 @@ tBleStatus aci_gatt_disc_all_char_of_service( uint16_t Connection_Handle,
  * @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 );
+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
@@ -645,9 +653,10 @@ tBleStatus aci_gatt_disc_char_by_uuid( uint16_t Connection_Handle,
  * @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 );
+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
@@ -666,8 +675,7 @@ tBleStatus aci_gatt_disc_all_char_desc( uint16_t Connection_Handle,
  * @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 );
+tBleStatus aci_gatt_read_char_value(uint16_t Connection_Handle, uint16_t Attr_Handle);
 
 /**
  * @brief ACI_GATT_READ_USING_CHAR_UUID
@@ -694,11 +702,12 @@ tBleStatus aci_gatt_read_char_value( uint16_t Connection_Handle,
  * @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 );
+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
@@ -718,9 +727,10 @@ tBleStatus aci_gatt_read_using_char_uuid( uint16_t Connection_Handle,
  * @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 );
+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
@@ -744,9 +754,10 @@ tBleStatus aci_gatt_read_long_char_value( uint16_t Connection_Handle,
  * @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 );
+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
@@ -769,10 +780,11 @@ tBleStatus aci_gatt_read_multiple_char_value( uint16_t Connection_Handle,
  * @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 );
+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
@@ -796,11 +808,12 @@ tBleStatus aci_gatt_write_char_value( uint16_t Connection_Handle,
  * @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 );
+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
@@ -824,11 +837,12 @@ tBleStatus aci_gatt_write_long_char_value( uint16_t Connection_Handle,
  * @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 );
+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
@@ -852,11 +866,12 @@ tBleStatus aci_gatt_write_char_reliable( uint16_t Connection_Handle,
  * @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 );
+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
@@ -876,9 +891,10 @@ tBleStatus aci_gatt_write_long_char_desc( uint16_t Connection_Handle,
  * @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 );
+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
@@ -901,10 +917,11 @@ tBleStatus aci_gatt_read_long_char_desc( uint16_t Connection_Handle,
  * @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 );
+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
@@ -924,8 +941,7 @@ tBleStatus aci_gatt_write_char_desc( uint16_t Connection_Handle,
  * @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 );
+tBleStatus aci_gatt_read_char_desc(uint16_t Connection_Handle, uint16_t Attr_Handle);
 
 /**
  * @brief ACI_GATT_WRITE_WITHOUT_RESP
@@ -948,10 +964,11 @@ tBleStatus aci_gatt_read_char_desc( uint16_t Connection_Handle,
  * @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 );
+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
@@ -971,10 +988,11 @@ tBleStatus aci_gatt_write_without_resp( uint16_t Connection_Handle,
  * @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 );
+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
@@ -990,7 +1008,7 @@ tBleStatus aci_gatt_signed_write_without_resp( uint16_t Connection_Handle,
  *          parameter is the connection-oriented channel index)
  * @return Value indicating success or error code.
  */
-tBleStatus aci_gatt_confirm_indication( uint16_t Connection_Handle );
+tBleStatus aci_gatt_confirm_indication(uint16_t Connection_Handle);
 
 /**
  * @brief ACI_GATT_WRITE_RESP
@@ -1024,12 +1042,13 @@ tBleStatus aci_gatt_confirm_indication( uint16_t Connection_Handle );
  *        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 );
+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
@@ -1052,7 +1071,7 @@ tBleStatus aci_gatt_write_resp( uint16_t Connection_Handle,
  *          parameter is the connection-oriented channel index)
  * @return Value indicating success or error code.
  */
-tBleStatus aci_gatt_allow_read( uint16_t Connection_Handle );
+tBleStatus aci_gatt_allow_read(uint16_t Connection_Handle);
 
 /**
  * @brief ACI_GATT_SET_SECURITY_PERMISSION
@@ -1075,9 +1094,10 @@ tBleStatus aci_gatt_allow_read( uint16_t Connection_Handle );
  *        - 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 );
+tBleStatus aci_gatt_set_security_permission(
+    uint16_t Serv_Handle,
+    uint16_t Attr_Handle,
+    uint8_t Security_Permissions);
 
 /**
  * @brief ACI_GATT_SET_DESC_VALUE
@@ -1093,12 +1113,13 @@ tBleStatus aci_gatt_set_security_permission( uint16_t Serv_Handle,
  * @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 );
+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
@@ -1114,12 +1135,13 @@ tBleStatus aci_gatt_set_desc_value( uint16_t Serv_Handle,
  * @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 );
+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
@@ -1158,14 +1180,15 @@ tBleStatus aci_gatt_read_handle_value( uint16_t Attr_Handle,
  * @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 );
+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
@@ -1195,8 +1218,7 @@ tBleStatus aci_gatt_update_char_value_ext( uint16_t Conn_Handle_To_Notify,
  *        - 0x80 ... 0x9F: Application Error
  * @return Value indicating success or error code.
  */
-tBleStatus aci_gatt_deny_read( uint16_t Connection_Handle,
-                               uint8_t Error_Code );
+tBleStatus aci_gatt_deny_read(uint16_t Connection_Handle, uint8_t Error_Code);
 
 /**
  * @brief ACI_GATT_SET_ACCESS_PERMISSION
@@ -1215,9 +1237,10 @@ tBleStatus aci_gatt_deny_read( uint16_t Connection_Handle,
  *        - 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 );
+tBleStatus aci_gatt_set_access_permission(
+    uint16_t Serv_Handle,
+    uint16_t Attr_Handle,
+    uint8_t Access_Permissions);
 
 /**
  * @brief ACI_GATT_STORE_DB
@@ -1227,7 +1250,7 @@ tBleStatus aci_gatt_set_access_permission( uint16_t Serv_Handle,
  * 
  * @return Value indicating success or error code.
  */
-tBleStatus aci_gatt_store_db( void );
+tBleStatus aci_gatt_store_db(void);
 
 /**
  * @brief ACI_GATT_SEND_MULT_NOTIFICATION
@@ -1248,9 +1271,10 @@ tBleStatus aci_gatt_store_db( void );
  * @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 );
+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
@@ -1275,9 +1299,9 @@ tBleStatus aci_gatt_send_mult_notification( uint16_t Connection_Handle,
  * @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 );
-
+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__ */

+ 54 - 56
ble_vs_codes.h

@@ -18,180 +18,178 @@
 #ifndef BLE_VS_CODES_H__
 #define BLE_VS_CODES_H__
 
-
 /* Vendor specific codes of ACI GAP events
  */
 
 /* ACI_GAP_LIMITED_DISCOVERABLE_EVENT code */
-#define ACI_GAP_LIMITED_DISCOVERABLE_VSEVT_CODE           0x0400U
+#define ACI_GAP_LIMITED_DISCOVERABLE_VSEVT_CODE 0x0400U
 
 /* ACI_GAP_PAIRING_COMPLETE_EVENT code */
-#define ACI_GAP_PAIRING_COMPLETE_VSEVT_CODE               0x0401U
+#define ACI_GAP_PAIRING_COMPLETE_VSEVT_CODE 0x0401U
 
 /* ACI_GAP_PASS_KEY_REQ_EVENT code */
-#define ACI_GAP_PASS_KEY_REQ_VSEVT_CODE                   0x0402U
+#define ACI_GAP_PASS_KEY_REQ_VSEVT_CODE 0x0402U
 
 /* ACI_GAP_AUTHORIZATION_REQ_EVENT code */
-#define ACI_GAP_AUTHORIZATION_REQ_VSEVT_CODE              0x0403U
+#define ACI_GAP_AUTHORIZATION_REQ_VSEVT_CODE 0x0403U
 
 /* ACI_GAP_PERIPHERAL_SECURITY_INITIATED_EVENT code */
-#define ACI_GAP_PERIPHERAL_SECURITY_INITIATED_VSEVT_CODE  0x0404U
+#define ACI_GAP_PERIPHERAL_SECURITY_INITIATED_VSEVT_CODE 0x0404U
 
 /* ACI_GAP_BOND_LOST_EVENT code */
-#define ACI_GAP_BOND_LOST_VSEVT_CODE                      0x0405U
+#define ACI_GAP_BOND_LOST_VSEVT_CODE 0x0405U
 
 /* ACI_GAP_PROC_COMPLETE_EVENT code */
-#define ACI_GAP_PROC_COMPLETE_VSEVT_CODE                  0x0407U
+#define ACI_GAP_PROC_COMPLETE_VSEVT_CODE 0x0407U
 
 /* ACI_GAP_ADDR_NOT_RESOLVED_EVENT code */
-#define ACI_GAP_ADDR_NOT_RESOLVED_VSEVT_CODE              0x0408U
+#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
+#define ACI_GAP_NUMERIC_COMPARISON_VALUE_VSEVT_CODE 0x0409U
 
 /* ACI_GAP_KEYPRESS_NOTIFICATION_EVENT code */
-#define ACI_GAP_KEYPRESS_NOTIFICATION_VSEVT_CODE          0x040AU
+#define ACI_GAP_KEYPRESS_NOTIFICATION_VSEVT_CODE 0x040AU
 
 /* Vendor specific codes of ACI GATT/ATT events
  */
 
 /* ACI_GATT_ATTRIBUTE_MODIFIED_EVENT code */
-#define ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE            0x0C01U
+#define ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE 0x0C01U
 
 /* ACI_GATT_PROC_TIMEOUT_EVENT code */
-#define ACI_GATT_PROC_TIMEOUT_VSEVT_CODE                  0x0C02U
+#define ACI_GATT_PROC_TIMEOUT_VSEVT_CODE 0x0C02U
 
 /* ACI_ATT_EXCHANGE_MTU_RESP_EVENT code */
-#define ACI_ATT_EXCHANGE_MTU_RESP_VSEVT_CODE              0x0C03U
+#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
+#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
+#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
+#define ACI_ATT_READ_BY_TYPE_RESP_VSEVT_CODE 0x0C06U
 
 /* ACI_ATT_READ_RESP_EVENT code */
-#define ACI_ATT_READ_RESP_VSEVT_CODE                      0x0C07U
+#define ACI_ATT_READ_RESP_VSEVT_CODE 0x0C07U
 
 /* ACI_ATT_READ_BLOB_RESP_EVENT code */
-#define ACI_ATT_READ_BLOB_RESP_VSEVT_CODE                 0x0C08U
+#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
+#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
+#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
+#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
+#define ACI_ATT_EXEC_WRITE_RESP_VSEVT_CODE 0x0C0DU
 
 /* ACI_GATT_INDICATION_EVENT code */
-#define ACI_GATT_INDICATION_VSEVT_CODE                    0x0C0EU
+#define ACI_GATT_INDICATION_VSEVT_CODE 0x0C0EU
 
 /* ACI_GATT_NOTIFICATION_EVENT code */
-#define ACI_GATT_NOTIFICATION_VSEVT_CODE                  0x0C0FU
+#define ACI_GATT_NOTIFICATION_VSEVT_CODE 0x0C0FU
 
 /* ACI_GATT_PROC_COMPLETE_EVENT code */
-#define ACI_GATT_PROC_COMPLETE_VSEVT_CODE                 0x0C10U
+#define ACI_GATT_PROC_COMPLETE_VSEVT_CODE 0x0C10U
 
 /* ACI_GATT_ERROR_RESP_EVENT code */
-#define ACI_GATT_ERROR_RESP_VSEVT_CODE                    0x0C11U
+#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
+#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
+#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
+#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
+#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
+#define ACI_GATT_TX_POOL_AVAILABLE_VSEVT_CODE 0x0C16U
 
 /* ACI_GATT_SERVER_CONFIRMATION_EVENT code */
-#define ACI_GATT_SERVER_CONFIRMATION_VSEVT_CODE           0x0C17U
+#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
+#define ACI_GATT_PREPARE_WRITE_PERMIT_REQ_VSEVT_CODE 0x0C18U
 
 /* ACI_GATT_EATT_BEARER_EVENT code */
-#define ACI_GATT_EATT_BEARER_VSEVT_CODE                   0x0C19U
+#define ACI_GATT_EATT_BEARER_VSEVT_CODE 0x0C19U
 
 /* ACI_GATT_MULT_NOTIFICATION_EVENT code */
-#define ACI_GATT_MULT_NOTIFICATION_VSEVT_CODE             0x0C1AU
+#define ACI_GATT_MULT_NOTIFICATION_VSEVT_CODE 0x0C1AU
 
 /* ACI_GATT_NOTIFICATION_COMPLETE_EVENT code */
-#define ACI_GATT_NOTIFICATION_COMPLETE_VSEVT_CODE         0x0C1BU
+#define ACI_GATT_NOTIFICATION_COMPLETE_VSEVT_CODE 0x0C1BU
 
 /* ACI_GATT_READ_EXT_EVENT code */
-#define ACI_GATT_READ_EXT_VSEVT_CODE                      0x0C1DU
+#define ACI_GATT_READ_EXT_VSEVT_CODE 0x0C1DU
 
 /* ACI_GATT_INDICATION_EXT_EVENT code */
-#define ACI_GATT_INDICATION_EXT_VSEVT_CODE                0x0C1EU
+#define ACI_GATT_INDICATION_EXT_VSEVT_CODE 0x0C1EU
 
 /* ACI_GATT_NOTIFICATION_EXT_EVENT code */
-#define ACI_GATT_NOTIFICATION_EXT_VSEVT_CODE              0x0C1FU
+#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
+#define ACI_L2CAP_CONNECTION_UPDATE_RESP_VSEVT_CODE 0x0800U
 
 /* ACI_L2CAP_PROC_TIMEOUT_EVENT code */
-#define ACI_L2CAP_PROC_TIMEOUT_VSEVT_CODE                 0x0801U
+#define ACI_L2CAP_PROC_TIMEOUT_VSEVT_CODE 0x0801U
 
 /* ACI_L2CAP_CONNECTION_UPDATE_REQ_EVENT code */
-#define ACI_L2CAP_CONNECTION_UPDATE_REQ_VSEVT_CODE        0x0802U
+#define ACI_L2CAP_CONNECTION_UPDATE_REQ_VSEVT_CODE 0x0802U
 
 /* ACI_L2CAP_COMMAND_REJECT_EVENT code */
-#define ACI_L2CAP_COMMAND_REJECT_VSEVT_CODE               0x080AU
+#define ACI_L2CAP_COMMAND_REJECT_VSEVT_CODE 0x080AU
 
 /* ACI_L2CAP_COC_CONNECT_EVENT code */
-#define ACI_L2CAP_COC_CONNECT_VSEVT_CODE                  0x0810U
+#define ACI_L2CAP_COC_CONNECT_VSEVT_CODE 0x0810U
 
 /* ACI_L2CAP_COC_CONNECT_CONFIRM_EVENT code */
-#define ACI_L2CAP_COC_CONNECT_CONFIRM_VSEVT_CODE          0x0811U
+#define ACI_L2CAP_COC_CONNECT_CONFIRM_VSEVT_CODE 0x0811U
 
 /* ACI_L2CAP_COC_RECONF_EVENT code */
-#define ACI_L2CAP_COC_RECONF_VSEVT_CODE                   0x0812U
+#define ACI_L2CAP_COC_RECONF_VSEVT_CODE 0x0812U
 
 /* ACI_L2CAP_COC_RECONF_CONFIRM_EVENT code */
-#define ACI_L2CAP_COC_RECONF_CONFIRM_VSEVT_CODE           0x0813U
+#define ACI_L2CAP_COC_RECONF_CONFIRM_VSEVT_CODE 0x0813U
 
 /* ACI_L2CAP_COC_DISCONNECT_EVENT code */
-#define ACI_L2CAP_COC_DISCONNECT_VSEVT_CODE               0x0814U
+#define ACI_L2CAP_COC_DISCONNECT_VSEVT_CODE 0x0814U
 
 /* ACI_L2CAP_COC_FLOW_CONTROL_EVENT code */
-#define ACI_L2CAP_COC_FLOW_CONTROL_VSEVT_CODE             0x0815U
+#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
+#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
+#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
+#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
+#define ACI_HAL_SCAN_REQ_REPORT_VSEVT_CODE 0x0005U
 
 /* ACI_HAL_FW_ERROR_EVENT code */
-#define ACI_HAL_FW_ERROR_VSEVT_CODE                       0x0006U
-
+#define ACI_HAL_FW_ERROR_VSEVT_CODE 0x0006U
 
 #endif /* BLE_VS_CODES_H__ */

+ 1 - 2
seos_service.c

@@ -120,8 +120,7 @@ typedef enum {
     SeosServiceRpcStatusActive = 1UL,
 } SeosServiceRpcStatus;
 
-static void
-    ble_svc_seos_update_rpc_char(BleServiceSeos* seos_svc, SeosServiceRpcStatus status) {
+static void ble_svc_seos_update_rpc_char(BleServiceSeos* seos_svc, SeosServiceRpcStatus status) {
     ble_gatt_characteristic_update(
         seos_svc->svc_handle, &seos_svc->chars[SeosSvcGattCharacteristicStatus], &status);
 }

+ 77 - 63
stm32_wpan_common.h

@@ -16,7 +16,6 @@
  ******************************************************************************
  */
 
-
 /* Define to prevent recursive inclusion -------------------------------------*/
 #ifndef __STM32_WPAN_COMMON_H
 #define __STM32_WPAN_COMMON_H
@@ -25,18 +24,19 @@
 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
+#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>
@@ -46,96 +46,110 @@ extern "C" {
 #include <stdarg.h>
 #include "cmsis_compiler.h"
 
-  /* -------------------------------- *
+/* -------------------------------- *
    *  Basic definitions               *
    * -------------------------------- */
 
 #undef NULL
-#define NULL                    0U
+#define NULL 0U
 
 #undef FALSE
-#define FALSE                   0U
+#define FALSE 0U
 
 #undef TRUE
-#define TRUE                    (!0U)
+#define TRUE (!0U)
 
-  /* -------------------------------- *
+/* -------------------------------- *
    *  Critical Section definition     *
    * -------------------------------- */
 #undef BACKUP_PRIMASK
-#define BACKUP_PRIMASK()    uint32_t primask_bit= __get_PRIMASK()
+#define BACKUP_PRIMASK() uint32_t primask_bit = __get_PRIMASK()
 
 #undef DISABLE_IRQ
-#define DISABLE_IRQ()       __disable_irq()
+#define DISABLE_IRQ() __disable_irq()
 
 #undef RESTORE_PRIMASK
-#define RESTORE_PRIMASK()   __set_PRIMASK(primask_bit)
+#define RESTORE_PRIMASK() __set_PRIMASK(primask_bit)
 
-  /* -------------------------------- *
+/* -------------------------------- *
    *  Macro delimiters                *
    * -------------------------------- */
 #undef M_BEGIN
-#define M_BEGIN     do {
+#define M_BEGIN do {
+#undef M_END
+#define M_END \
+    }         \
+    while(0)
 
-#undef  M_END
-#define M_END       } while(0)
-
-  /* -------------------------------- *
+/* -------------------------------- *
    *  Some useful macro definitions   *
    * -------------------------------- */
 #undef MAX
-#define MAX(a, b)  (((a) > (b)) ? (a) : (b))
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
 
 #undef MIN
-#define MIN(a, b)  (((a) < (b)) ? (a) : (b))
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
 
 #undef MODINC
-#define MODINC( a, m )       M_BEGIN  (a)++;  if ((a)>=(m)) (a)=0;  M_END
+#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
+#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
+#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 )
+#define MODSUB(a, b, m) MODADD(a, (m) - (b), m)
 
 #undef ALIGN
 #ifdef WIN32
 #define ALIGN(n)
 #else
-#define ALIGN(n)             __attribute__((aligned(n)))
+#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
+#define PAUSE(t)              \
+    M_BEGIN                   \
+    volatile int _i;          \
+    for(_i = t; _i > 0; _i--) \
+        ;                     \
+    M_END
 #undef DIVF
-#define DIVF( x, y )         ((x)/(y))
+#define DIVF(x, y) ((x) / (y))
 
 #undef DIVC
-#define DIVC( x, y )         (((x)+(y)-1)/(y))
+#define DIVC(x, y) (((x) + (y) - 1) / (y))
 
 #undef DIVR
-#define DIVR( x, y )         (((x)+((y)/2))/(y))
+#define DIVR(x, y) (((x) + ((y) / 2)) / (y))
 
 #undef SHRR
-#define SHRR( x, n )         ((((x)>>((n)-1))+1)>>1)
+#define SHRR(x, n) ((((x) >> ((n) - 1)) + 1) >> 1)
 
 #undef BITN
-#define BITN( w, n )         (((w)[(n)/32] >> ((n)%32)) & 1)
+#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
+#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__)))
+#define PLACE_IN_SECTION(__x__) __attribute__((section(__x__)))
 
 /* ----------------------------------- *
  *  Packed usage (compiler dependent)  *
@@ -143,25 +157,25 @@ extern "C" {
 #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
+#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
+#define PACKED_STRUCT __packed struct
 #endif
 
 #ifdef __cplusplus

+ 204 - 216
tl.h

@@ -16,7 +16,6 @@
  ******************************************************************************
  */
 
-
 /* Define to prevent recursive inclusion -------------------------------------*/
 #ifndef __TL_H
 #define __TL_H
@@ -25,48 +24,47 @@
 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)
+#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;
+typedef PACKED_STRUCT {
+    uint32_t* next;
+    uint32_t* prev;
+}
+TL_PacketHeader_t;
 
 /*******************************************************************************
  * Event type
@@ -75,47 +73,47 @@ typedef PACKED_STRUCT
 /**
  * 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;
+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;
+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;
+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;
+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
@@ -125,154 +123,145 @@ typedef PACKED_STRUCT
  * 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;
+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;
+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;
+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;
+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;
+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;
+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;
+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;
+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;
+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;
+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;
+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;
+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];
-
+typedef uint8_t tBDAddr[6];
 
 /* Exported constants --------------------------------------------------------*/
 /* External variables --------------------------------------------------------*/
@@ -282,86 +271,86 @@ typedef	uint8_t	tBDAddr[6];
 /******************************************************************************
  * GENERAL
  ******************************************************************************/
-void TL_Enable( void );
-void TL_Init( void );
+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 );
+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 );
+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 );
+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 );
+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 );
+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 );
+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 );
+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 );
+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_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
@@ -369,4 +358,3 @@ void TL_ZIGBEE_SendM4AckToM0Request(void);
 #endif
 
 #endif /*__TL_H */
-