Reformat long comments before clang-format

Test: mma -j32
Change-Id: I86a2a4af9dcd22d675ca1f764bb2c9623d63edcc
diff --git a/audio_a2dp_hw/audio_a2dp_hw.cc b/audio_a2dp_hw/audio_a2dp_hw.cc
index 473286f..7531209 100644
--- a/audio_a2dp_hw/audio_a2dp_hw.cc
+++ b/audio_a2dp_hw/audio_a2dp_hw.cc
@@ -78,7 +78,8 @@
     AUDIO_A2DP_STATE_STARTED,
     AUDIO_A2DP_STATE_STOPPING,
     AUDIO_A2DP_STATE_STOPPED,
-    AUDIO_A2DP_STATE_SUSPENDED, /* need explicit set param call to resume (suspend=false) */
+    /* need explicit set param call to resume (suspend=false) */
+    AUDIO_A2DP_STATE_SUSPENDED,
     AUDIO_A2DP_STATE_STANDBY    /* allows write to autoresume */
 } a2dp_state_t;
 
@@ -1294,8 +1295,8 @@
     }
 
     DEBUG("success");
-    /* Delay to ensure Headset is in proper state when START is initiated
-       from DUT immediately after the connection due to ongoing music playback. */
+    /* Delay to ensure Headset is in proper state when START is initiated from
+     * DUT immediately after the connection due to ongoing music playback. */
     usleep(250000);
     return 0;
 
diff --git a/audio_a2dp_hw/audio_a2dp_hw.h b/audio_a2dp_hw/audio_a2dp_hw.h
index fabe7d4..e6e7dde 100644
--- a/audio_a2dp_hw/audio_a2dp_hw.h
+++ b/audio_a2dp_hw/audio_a2dp_hw.h
@@ -45,32 +45,32 @@
 // sample rate rather than being constant.
 //
 // FIXME: The BT HAL should consume data at a constant rate.
-// AudioFlinger assumes that the HAL draws data at a constant rate, which is true
-// for most audio devices; however, the BT engine reads data at a variable rate
-// (over the short term), which confuses both AudioFlinger as well as applications
-// which deliver data at a (generally) fixed rate.
+// AudioFlinger assumes that the HAL draws data at a constant rate, which is
+// true for most audio devices; however, the BT engine reads data at a variable
+// rate (over the short term), which confuses both AudioFlinger as well as
+// applications which deliver data at a (generally) fixed rate.
 //
-// 20 * 512 is not sufficient size to smooth the variability for some BT devices,
+// 20 * 512 is not sufficient to smooth the variability for some BT devices,
 // resulting in mixer sleep and throttling. We increase this to 28 * 512 to help
 // reduce the effect of variable data consumption.
 #define AUDIO_STREAM_OUTPUT_BUFFER_SZ      (28*512)
 
 // AUDIO_STREAM_OUTPUT_BUFFER_PERIODS controls how the socket buffer is divided
-// for AudioFlinger data delivery. The AudioFlinger mixer delivers data in chunks
-// of AUDIO_STREAM_OUTPUT_BUFFER_SZ / AUDIO_STREAM_OUTPUT_BUFFER_PERIODS. If
-// the number of periods is 2, the socket buffer represents "double buffering"
-// of the AudioFlinger mixer buffer.
+// for AudioFlinger data delivery. The AudioFlinger mixer delivers data in
+// chunks of AUDIO_STREAM_OUTPUT_BUFFER_SZ / AUDIO_STREAM_OUTPUT_BUFFER_PERIODS.
+// If the number of periods is 2, the socket buffer represents "double
+// buffering" of the AudioFlinger mixer buffer.
 //
-// In general, AUDIO_STREAM_OUTPUT_BUFFER_PERIODS * 16 * 4 should be a divisor of
-// AUDIO_STREAM_OUTPUT_BUFFER_SZ.
+// In general, AUDIO_STREAM_OUTPUT_BUFFER_PERIODS * 16 * 4 should be a divisor
+// of AUDIO_STREAM_OUTPUT_BUFFER_SZ.
 //
 // These values should be chosen such that
 //
 // AUDIO_STREAM_BUFFER_SIZE * 1000 / (AUDIO_STREAM_OUTPUT_BUFFER_PERIODS
 //         * AUDIO_STREAM_DEFAULT_RATE * 4) > 20 (ms)
 //
-// to avoid introducing the FastMixer in AudioFlinger. Using the FastMixer results in
-// unnecessary latency and CPU overhead for Bluetooth.
+// to avoid introducing the FastMixer in AudioFlinger. Using the FastMixer
+// results in unnecessary latency and CPU overhead for Bluetooth.
 #define AUDIO_STREAM_OUTPUT_BUFFER_PERIODS 4
 
 #define AUDIO_SKT_DISCONNECTED             (-1)
diff --git a/bta/dm/bta_dm_sco.cc b/bta/dm/bta_dm_sco.cc
index aaa5c94..4757a53 100644
--- a/bta/dm/bta_dm_sco.cc
+++ b/bta/dm/bta_dm_sco.cc
@@ -86,7 +86,7 @@
       (x) = -32768;           \
   } while (0)
 
-////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
 //
 #define CONVERT_44100_TO_BLUETOOTH(pStart, pEnd)          \
   do {                                                    \
@@ -137,7 +137,7 @@
     }                                                     \
   } while (0)
 
-////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
 //
 #define CONVERT_22050_TO_BLUETOOTH(pStart, pEnd)         \
   do {                                                   \
@@ -187,7 +187,7 @@
     }                                                    \
   } while (0)
 
-////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
 //
 #define CONVERT_11025_TO_BLUETOOTH(pStart, pEnd)         \
   do {                                                   \
@@ -222,7 +222,7 @@
     }                                                    \
   } while (0)
 
-////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
 //
 #undef SRC_CHANNELS
 #undef SRC_SAMPLE
@@ -305,7 +305,7 @@
   return (psDst - (int16_t*)pDst);
 }
 
-////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
 //
 #undef SRC_CHANNELS
 #undef SRC_SAMPLE
@@ -378,7 +378,7 @@
   return (psDst - (int16_t*)pDst);
 }
 
-////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
 //
 #undef SRC_CHANNELS
 #undef SRC_SAMPLE
@@ -472,7 +472,7 @@
   return (psDst - (int16_t*)pDst);
 }
 
-////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
 //
 #undef SRC_CHANNELS
 #undef SRC_SAMPLE
diff --git a/bta/include/bta_ag_api.h b/bta/include/bta_ag_api.h
index 7088536..11dfae7 100644
--- a/bta/include/bta_ag_api.h
+++ b/bta/include/bta_ag_api.h
@@ -51,8 +51,7 @@
 
 /* AG feature masks */
 #define BTA_AG_FEAT_3WAY 0x00000001 /* Three-way calling */
-#define BTA_AG_FEAT_ECNR \
-  0x00000002 /* Echo cancellation and/or noise reduction */
+#define BTA_AG_FEAT_ECNR 0x00000002 /* Echo cancellation/noise reduction */
 #define BTA_AG_FEAT_VREC 0x00000004   /* Voice recognition */
 #define BTA_AG_FEAT_INBAND 0x00000008 /* In-band ring tone */
 #define BTA_AG_FEAT_VTAG 0x00000010   /* Attach a phone number to a voice tag */
@@ -62,8 +61,8 @@
 #define BTA_AG_FEAT_EXTERR 0x00000100 /* Extended error codes */
 #define BTA_AG_FEAT_CODEC 0x00000200  /* Codec Negotiation */
 
-#define HFP_1_6_FEAT_MASK \
-  0x000003FF /* Valid feature bit mask for HFP 1.6 (and below) */
+/* Valid feature bit mask for HFP 1.6 (and below) */
+#define HFP_1_6_FEAT_MASK 0x000003FF
 
 /* HFP 1.7+ */
 #define BTA_AG_FEAT_HF_IND 0x00000400 /* HF Indicators */
@@ -71,8 +70,7 @@
 
 /* Proprietary features: using 31 ~ 16 bits */
 #define BTA_AG_FEAT_BTRH 0x00010000 /* CCAP incoming call hold */
-#define BTA_AG_FEAT_UNAT \
-  0x00020000 /* Pass unknown AT commands to application */
+#define BTA_AG_FEAT_UNAT 0x00020000 /* Pass unknown AT commands to app */
 #define BTA_AG_FEAT_NOSCO 0x00040000   /* No SCO control performed by BTA AG */
 #define BTA_AG_FEAT_NO_ESCO 0x00080000 /* Do not allow or use eSCO */
 #define BTA_AG_FEAT_VOIP 0x00100000    /* VoIP call */
@@ -81,8 +79,9 @@
 
 /* AG parse mode */
 #define BTA_AG_PARSE 0 /* Perform AT command parsing in AG */
-#define BTA_AG_PASS_THROUGH \
-  1 /* Pass data directly to phone's AT command interpreter */
+
+/* Pass data directly to phone's AT command interpreter */
+#define BTA_AG_PASS_THROUGH 1
 
 typedef uint8_t tBTA_AG_PARSE_MODE;
 
@@ -90,7 +89,7 @@
 #define BTA_AG_SUCCESS 0        /* Connection successfully opened */
 #define BTA_AG_FAIL_SDP 1       /* Open failed due to SDP */
 #define BTA_AG_FAIL_RFCOMM 2    /* Open failed due to RFCOMM */
-#define BTA_AG_FAIL_RESOURCES 3 /* out of resources failure  */
+#define BTA_AG_FAIL_RESOURCES 3 /* out of resources failure */
 
 /* Status to disallow passing AT Events after BTIF */
 #define BTA_AG_DISALLOW_AT 5
@@ -133,11 +132,13 @@
 #define BTA_AG_IN_CALL_CONN_RES 12  /* Incoming phone call connected */
 #define BTA_AG_CALL_WAIT_RES 13     /* Call waiting notification */
 #define BTA_AG_OUT_CALL_ORIG_RES 14 /* Outgoing phone call origination */
-#define BTA_AG_OUT_CALL_ALERT_RES \
-  15 /* Outgoing phone call alerting remote party */
+
+/* Outgoing phone call alerting remote party */
+#define BTA_AG_OUT_CALL_ALERT_RES 15
 #define BTA_AG_OUT_CALL_CONN_RES 16 /* Outgoing phone call connected */
-#define BTA_AG_CALL_CANCEL_RES \
-  17 /* Incoming/outgoing 3-way canceled before connected */
+
+/* Incoming/outgoing 3-way canceled before connected */
+#define BTA_AG_CALL_CANCEL_RES 17
 #define BTA_AG_END_CALL_RES 18     /* End call */
 #define BTA_AG_IN_CALL_HELD_RES 19 /* Incoming call held */
 #define BTA_AG_UNAT_RES 20         /* Response to unknown AT command event */
@@ -147,8 +148,7 @@
 typedef uint8_t tBTA_AG_RES;
 
 /* HFP peer features */
-#define BTA_AG_PEER_FEAT_ECNR \
-  0x0001 /* Echo cancellation and/or noise reduction */
+#define BTA_AG_PEER_FEAT_ECNR 0x0001 /* Echo cancellation/noise reduction */
 #define BTA_AG_PEER_FEAT_3WAY 0x0002   /* Call waiting and three-way calling */
 #define BTA_AG_PEER_FEAT_CLI 0x0004    /* Caller ID presentation capability */
 #define BTA_AG_PEER_FEAT_VREC 0x0008   /* Voice recognition activation */
@@ -160,8 +160,9 @@
 #define BTA_AG_PEER_FEAT_ESCO 0x0200   /* eSCO S4 (and T2) setting supported */
 
 /* Proprietary features: using bits after 12 */
-#define BTA_AG_PEER_FEAT_UNAT \
-  0x1000 /* Pass unknown AT command responses to application */
+
+/* Pass unknown AT command responses to application */
+#define BTA_AG_PEER_FEAT_UNAT 0x1000
 #define BTA_AG_PEER_FEAT_VOIP 0x2000 /* VoIP call */
 
 typedef uint16_t tBTA_AG_PEER_FEAT;
@@ -197,10 +198,10 @@
 #define BTA_AG_ERR_INV_CHAR_IN_DSTR 27 /* Invalid characters in dial string */
 #define BTA_AG_ERR_NO_NETWORK_SERV 30  /* No network service */
 #define BTA_AG_ERR_NETWORK_TIME_OUT 31 /* Network timeout */
-#define BTA_AG_ERR_NO_NET_EMG_ONLY \
-  32 /* Network not allowed - emergency service only */
-#define BTA_AG_ERR_VOIP_CS_CALLS \
-  33 /* AG cannot create simultaneous VoIP and CS calls */
+/* Network not allowed - emergency service only */
+#define BTA_AG_ERR_NO_NET_EMG_ONLY 32
+/* AG cannot create simultaneous VoIP and CS calls */
+#define BTA_AG_ERR_VOIP_CS_CALLS 33
 #define BTA_AG_ERR_NOT_FOR_VOIP 34  /* Not supported on this call type(VoIP) */
 #define BTA_AG_ERR_SIP_RESP_CODE 35 /* SIP 3 digit response code */
 
@@ -213,35 +214,34 @@
 #define BTA_AG_ERR_NETWORK_TIMEOUT 31 /* Network timeout */
 #define BTA_AG_ERR_NET_PIN_REQ 40     /* Network personalization PIN required */
 #define BTA_AG_ERR_NET_PUK_REQ 41     /* Network personalization PUK required */
-#define BTA_AG_ERR_SUBSET_PIN_REQ \
-  42 /* Network subset personalization PIN required */
-#define BTA_AG_ERR_SUBSET_PUK_REQ \
-  43 /* Network subset personalization PUK required */
-#define BTA_AG_ERR_SERVPRO_PIN_REQ \
-  44 /* Service provider personalization PIN required */
-#define BTA_AG_ERR_SERVPRO_PUK_REQ \
-  45 /* Service provider personalization PUK required */
-#define BTA_AG_ERR_CORP_PIN_REQ                \
-  46 /* Corporate personalization PIN required \
-        */
-#define BTA_AG_ERR_CORP_PUK_REQ                                          \
-  47                           /* Corporate personalization PUK required \
-                                  */
+/* Network subset personalization PIN required */
+#define BTA_AG_ERR_SUBSET_PIN_REQ 42
+/* Network subset personalization PUK required */
+#define BTA_AG_ERR_SUBSET_PUK_REQ 43
+/* Service provider personalization PIN required */
+#define BTA_AG_ERR_SERVPRO_PIN_REQ 44
+/* Service provider personalization PUK required */
+#define BTA_AG_ERR_SERVPRO_PUK_REQ 45
+/* Corporate personalization PIN required */
+#define BTA_AG_ERR_CORP_PIN_REQ 46
+/* Corporate personalization PUK required */
+#define BTA_AG_ERR_CORP_PUK_REQ 47
 #define BTA_AG_ERR_UNKNOWN 100 /* Unknown error */
+
 /* GPRS-related errors */
 #define BTA_AG_ERR_ILL_MS 103  /* Illegal MS (#3) */
 #define BTA_AG_ERR_ILL_ME 106  /* Illegal ME (#6) */
 #define BTA_AG_ERR_GPRS_NOT_ALLOWED 107 /* GPRS services not allowed (#7) */
 #define BTA_AG_ERR_PLMN_NOT_ALLOWED 111 /* PLMN services not allowed (#11) */
 #define BTA_AG_ERR_LOC_NOT_ALLOWED 112  /* Location area not allowed (#12) */
-#define BTA_AG_ERR_ROAM_NOT_ALLOWED \
-  113                               /* Roaming not allowed in this location area (#13) */
+/* Roaming not allowed in this location area (#13) */
+#define BTA_AG_ERR_ROAM_NOT_ALLOWED 113
 /* Errors related to a failure to Activate a Context */
 #define BTA_AG_ERR_OPT_NOT_SUPP 132 /* Service option not supported (#32) */
-#define BTA_AG_ERR_OPT_NOT_SUBSCR \
-  133 /* Requested service option not subscribed (#33) */
-#define BTA_AG_ERR_OPT_OUT_OF_ORDER \
-  134 /* Service option temporarily out of order (#34) */
+/* Requested service option not subscribed (#33) */
+#define BTA_AG_ERR_OPT_NOT_SUBSCR 133
+/* Service option temporarily out of order (#34) */
+#define BTA_AG_ERR_OPT_OUT_OF_ORDER 134
 #define BTA_AG_ERR_PDP_AUTH_FAILURE 149 /* PDP authentication failure */
 /* Other GPRS errors */
 #define BTA_AG_ERR_INV_MOBILE_CLASS 150 /* Invalid mobile class */
@@ -295,7 +295,7 @@
 #define BTA_AG_SPK_EVT 7         /* Speaker volume changed */
 #define BTA_AG_MIC_EVT 8         /* Microphone volume changed */
 #define BTA_AG_AT_CKPD_EVT 9     /* CKPD from the HS */
-#define BTA_AG_DISABLE_EVT 30    /* AG disabled       */
+#define BTA_AG_DISABLE_EVT 30    /* AG disabled */
 #if (BTM_WBS_INCLUDED == TRUE)
 #define BTA_AG_WBS_EVT 31 /* SCO codec info */
 #endif
@@ -401,15 +401,14 @@
 #define BTA_AG_CALLSETUP_NONE 0     /* Not currently in call set up */
 #define BTA_AG_CALLSETUP_INCOMING 1 /* Incoming call process ongoing */
 #define BTA_AG_CALLSETUP_OUTGOING 2 /* Outgoing call set up is ongoing */
-#define BTA_AG_CALLSETUP_ALERTING \
-  3 /* Remote party being alerted in an outgoing call */
+/* Remote party being alerted in an outgoing call */
+#define BTA_AG_CALLSETUP_ALERTING 3
 
 /* service indicator values */
 #define BTA_AG_SERVICE_NONE 0 /* Neither CS nor VoIP service is available */
-#define BTA_AG_SERVICE_CS 1   /* Only CS service is available                 */
+#define BTA_AG_SERVICE_CS 1   /* Only CS service is available */
 #define BTA_AG_SERVICE_VOIP 2 /* Only VoIP service is available */
-#define BTA_AG_SERVICE_CS_VOIP \
-  3 /* Both CS and VoIP services available          */
+#define BTA_AG_SERVICE_CS_VOIP 3 /* Both CS and VoIP services available */
 
 /* callheld indicator values */
 #define BTA_AG_CALLHELD_INACTIVE 0 /* No held calls */
diff --git a/btcore/include/bdaddr.h b/btcore/include/bdaddr.h
index 70213e6..7bc88a5 100644
--- a/btcore/include/bdaddr.h
+++ b/btcore/include/bdaddr.h
@@ -48,16 +48,17 @@
 
 // Makes a string representation of |addr| and places it into |string|. |size|
 // refers to the size of |string|'s buffer and must be >= 18. On success, this
-// function returns |string|, otherwise it returns NULL. Neither |addr| nor |string|
-// may be NULL.
+// function returns |string|, otherwise it returns NULL. Neither |addr| nor
+// |string| may be NULL.
 const char *bdaddr_to_string(const bt_bdaddr_t *addr, char *string, size_t size);
 
 // Returns true if |string| represents a Bluetooth address. |string| may not be NULL.
 bool string_is_bdaddr(const char *string);
 
-// Converts |string| to bt_bdaddr_t and places it in |addr|. If |string| does not
-// represent a Bluetooth address, |addr| is not modified and this function returns
-// false. Otherwise, it returns true. Neither |string| nor |addr| may be NULL.
+// Converts |string| to bt_bdaddr_t and places it in |addr|. If |string| does
+// not represent a Bluetooth address, |addr| is not modified and this function
+// returns false. Otherwise, it returns true. Neither |string| nor |addr| may be
+// NULL.
 bool string_to_bdaddr(const char *string, bt_bdaddr_t *addr);
 
 #ifdef __cplusplus
diff --git a/btcore/include/device_class.h b/btcore/include/device_class.h
index 6887336..fa2b1a7 100644
--- a/btcore/include/device_class.h
+++ b/btcore/include/device_class.h
@@ -22,7 +22,8 @@
 #include <stdint.h>
 
 // Provides Class Of Device primitive as specified in the bluetooth spec.
-// [Class Of Device](https://www.bluetooth.org/en-us/specification/assigned-numbers/baseband)
+// [Class Of Device]
+// (https://www.bluetooth.org/en-us/specification/assigned-numbers/baseband)
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/btcore/include/iac.h b/btcore/include/iac.h
index c9254d2..2179b74 100644
--- a/btcore/include/iac.h
+++ b/btcore/include/iac.h
@@ -25,7 +25,8 @@
 #endif
 
 // Inquiry Access Code
-// [Bluetooth Baseband](https://www.bluetooth.org/en-us/specification/assigned-numbers/baseband)
+// [Bluetooth Baseband]
+// (https://www.bluetooth.org/en-us/specification/assigned-numbers/baseband)
 typedef struct {
   uint8_t iac[3];
 } __attribute__((packed))bt_inquiry_access_code_t;
diff --git a/btcore/src/device_class.cc b/btcore/src/device_class.cc
index f5711af..b4493ef 100644
--- a/btcore/src/device_class.cc
+++ b/btcore/src/device_class.cc
@@ -37,7 +37,8 @@
 // have equal size.
 COMPILE_ASSERT(sizeof(_bt_device_class_t) == sizeof(bt_device_class_t));
 
-// [Major Service Classes](https://www.bluetooth.org/en-us/specification/assigned-numbers/baseband)
+// [Major Service Classes]
+// (https://www.bluetooth.org/en-us/specification/assigned-numbers/baseband)
 enum {
   DC_LIMITED_DISCOVERABLE_MODE = 0x0001,
   DC_RESERVED14 = 0x0002,
diff --git a/btif/src/btif_hf_client.cc b/btif/src/btif_hf_client.cc
index aa40090..8be06b4 100644
--- a/btif/src/btif_hf_client.cc
+++ b/btif/src/btif_hf_client.cc
@@ -770,7 +770,8 @@
 
       HAL_CBACK(bt_hf_client_callbacks, connection_state_cb,
                 &btif_hf_client_cb.connected_bda,
-                btif_hf_client_cb.state, 0  /* peer feat */, 0  /* AT+CHLD feat */);
+                btif_hf_client_cb.state, 0, /* peer feat */
+                0  /* AT+CHLD feat */);
 
       if (btif_hf_client_cb.state == BTHF_CLIENT_CONNECTION_STATE_DISCONNECTED)
         bdsetany(btif_hf_client_cb.connected_bda.address);
diff --git a/embdrv/sbc/decoder/include/oi_assert.h b/embdrv/sbc/decoder/include/oi_assert.h
index 10980a0..c25ba85 100644
--- a/embdrv/sbc/decoder/include/oi_assert.h
+++ b/embdrv/sbc/decoder/include/oi_assert.h
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
diff --git a/embdrv/sbc/decoder/include/oi_bitstream.h b/embdrv/sbc/decoder/include/oi_bitstream.h
index c7e0b27..346e67c 100644
--- a/embdrv/sbc/decoder/include/oi_bitstream.h
+++ b/embdrv/sbc/decoder/include/oi_bitstream.h
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -61,7 +62,8 @@
                                             uint8_t datum);
 
 /*
- * Use knowledge that the bitstream is aligned to optimize the write pair of nibbles
+ * Use knowledge that the bitstream is aligned to optimize the writing of a
+ * pair of nibbles.
  */
 PRIVATE void OI_BITSTREAM_Write2xUINT4Aligned(OI_BITSTREAM *bs,
                                               uint8_t datum1,
diff --git a/embdrv/sbc/decoder/include/oi_bt_spec.h b/embdrv/sbc/decoder/include/oi_bt_spec.h
index f1b3b37..435a55b 100644
--- a/embdrv/sbc/decoder/include/oi_bt_spec.h
+++ b/embdrv/sbc/decoder/include/oi_bt_spec.h
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -58,7 +59,8 @@
  *  - array[5] contains bits 7-0.
  */
 typedef struct  {
-    uint8_t    addr[OI_BD_ADDR_BYTE_SIZE] ;   /**< Bluetooth device address represented as an array of 8-bit values */
+   /* Bluetooth device address represented as an array of 8-bit values */
+    uint8_t    addr[OI_BD_ADDR_BYTE_SIZE] ;
 } OI_BD_ADDR ;
 
 /**
@@ -101,8 +103,10 @@
  * stored as bytes in big-endian order.
  */
 typedef struct {
-    uint32_t ms32bits;                                    /**< most significant 32 bits of 128-bit UUID */
-    uint8_t base[OI_BT_UUID128_SIZE - sizeof(uint32_t)]; /**< remainder of 128-bit UUID, array of 8-bit values */
+    /* most significant 32 bits of 128-bit UUID */
+    uint32_t ms32bits;
+    /* remainder of 128-bit UUID, array of 8-bit values */
+    uint8_t base[OI_BT_UUID128_SIZE - sizeof(uint32_t)];
 } OI_UUID128;
 
 /** @} */
@@ -134,7 +138,8 @@
  *  - array[15] contains bits 120- 127.
  */
 typedef struct {
-    uint8_t    key[OI_BT_LINK_KEY_SIZE] ;   /**< link key represented as an array of 8-bit values */
+   /* link key represented as an array of 8-bit values */
+    uint8_t    key[OI_BT_LINK_KEY_SIZE] ;
 } OI_LINK_KEY ;
 
 
@@ -142,7 +147,8 @@
 #define OI_BT_OOB_NUM_BYTES     16
 
 typedef struct {
-    uint8_t    value[OI_BT_OOB_NUM_BYTES] ;   /**< same struct used for C and R values */
+   /* same struct used for C and R values */
+    uint8_t    value[OI_BT_OOB_NUM_BYTES] ;
 } OI_OOB_DATA ;
 
 
@@ -150,26 +156,27 @@
  * link key types
  */
 typedef enum  {
-    OI_LINK_KEY_TYPE_COMBO              = 0,    /**< combination key */
-    OI_LINK_KEY_TYPE_LOCAL_UNIT         = 1,    /**< local unit key */
-    OI_LINK_KEY_TYPE_REMOTE_UNIT        = 2,    /**< remote unit key */
-    OI_LINK_KEY_TYPE_DEBUG_COMBO        = 3,    /**< debug combination key */
-    OI_LINK_KEY_TYPE_UNAUTHENTICATED    = 4,    /**< Unauthenticated */
-    OI_LINK_KEY_TYPE_AUTHENTICATED      = 5,    /**< Authenticated */
-    OI_LINK_KEY_TYPE_CHANGED_COMBO      = 6     /**< Changed */
+    OI_LINK_KEY_TYPE_COMBO              = 0,    /* combination key */
+    OI_LINK_KEY_TYPE_LOCAL_UNIT         = 1,    /* local unit key */
+    OI_LINK_KEY_TYPE_REMOTE_UNIT        = 2,    /* remote unit key */
+    OI_LINK_KEY_TYPE_DEBUG_COMBO        = 3,    /* debug combination key */
+    OI_LINK_KEY_TYPE_UNAUTHENTICATED    = 4,    /* Unauthenticated */
+    OI_LINK_KEY_TYPE_AUTHENTICATED      = 5,    /* Authenticated */
+    OI_LINK_KEY_TYPE_CHANGED_COMBO      = 6     /* Changed */
 
 } OI_BT_LINK_KEY_TYPE ;
 
 
-/** amount of space allocated for a PIN (personal indentification number) in bytes */
+/* Number of bytes allocated for a PIN (personal indentification number) */
 #define OI_BT_PIN_CODE_SIZE    16
 
-/** data type for a PIN (PINs are treated as strings, so endianness does not apply.) */
+/* data type for a PIN (PINs are treated as strings.) */
 typedef struct  {
-    uint8_t    pin[OI_BT_PIN_CODE_SIZE] ; /**< PIN represented as an array of 8-bit values */
+    /* PIN represented as an array of 8-bit values */
+    uint8_t    pin[OI_BT_PIN_CODE_SIZE] ;
 } OI_PIN_CODE ;
 
-/** maximum number of SCO connections per device, which is 3 as of version 2.0+EDR
+/* maximum number of SCO connections per device: 3 as of version 2.0+EDR
     of the Bluetooth specification (see sec 4.3 of vol 2 part B) */
 #define OI_BT_MAX_SCO_CONNECTIONS  3
 
@@ -187,29 +194,35 @@
 
 /**
  * The Bluetooth device type is indicated by a 24-bit bitfield, represented as a
- * 32-bit number in the stack. The bit layout and values for device class are specified
- * in the file oi_bt_assigned_nos.h and in the Bluetooth "Assigned Numbers" specification
- * at http://www.bluetooth.org/assigned-numbers/.
+ * 32-bit number in the stack. The bit layout and values for device class are
+ * specified in the file oi_bt_assigned_nos.h and in the Bluetooth "Assigned
+ * Numbers" specification at http://www.bluetooth.org/assigned-numbers/.
  */
 typedef uint32_t   OI_BT_DEVICE_CLASS ;
-
-#define OI_BT_DEV_CLASS_FORMAT_MASK        0x000003    /**< Bits 0-1 contain format type. */
-#define OI_BT_DEV_CLASS_MINOR_DEVICE_MASK  0x0000FC    /**< Bits 2-7 contain minor device class value. */
-#define OI_BT_DEV_CLASS_MAJOR_DEVICE_MASK  0x001F00    /**< Bits 8-12 contain major device class value. */
-#define OI_BT_DEV_CLASS_MAJOR_SERVICE_MASK 0xFFE000    /**< Bits 13-23 contain major service class value. */
+/* Bits 0-1 contain format type. */
+#define OI_BT_DEV_CLASS_FORMAT_MASK        0x000003
+/* Bits 2-7 contain minor device class value. */
+#define OI_BT_DEV_CLASS_MINOR_DEVICE_MASK  0x0000FC
+/* Bits 8-12 contain major device class value. */
+#define OI_BT_DEV_CLASS_MAJOR_DEVICE_MASK  0x001F00
+/* Bits 13-23 contain major service class value. */
+#define OI_BT_DEV_CLASS_MAJOR_SERVICE_MASK 0xFFE000
 
 /** There is currently only one device class format defined, type 00. */
 #define OI_BT_DEV_CLASS_FORMAT_TYPE        00
 
-/** Bit 13 in device class indicates limited discoverability mode (GAP v2.0+EDR, section 4.1.2.2) */
+/* Bit 13 in device class indicates limited discoverability mode (GAP v2.0+EDR,
+ * section 4.1.2.2)
+ */
 #define OI_BT_DEV_CLASS_LIMITED_DISCO_BIT  BIT13
 
 /** macro to test validity of the Device Class Format */
 #define OI_BT_VALID_DEVICE_CLASS_FORMAT(class) (OI_BT_DEV_CLASS_FORMAT_TYPE == ((class) & OI_BT_DEV_CLASS_FORMAT_MASK))
 
-/** the time between baseband clock ticks, currently 625 microseconds (one slot) */
+/* the time between baseband clock ticks, currently 625 microseconds (one slot)
+ */
 #define OI_BT_TICK 625
-/** some macros to convert to/from baseband clock ticks - use no floating point! */
+/* some macros to convert to/from baseband clock ticks - no floating point! */
 #define OI_SECONDS_TO_BT_TICKS(secs)    ((secs)*1600)
 #define OI_BT_TICKS_TO_SECONDS(ticks)   ((ticks)/1600)
 #define OI_MSECS_TO_BT_TICKS(msecs)     (((msecs)*8)/5)
diff --git a/embdrv/sbc/decoder/include/oi_codec_sbc.h b/embdrv/sbc/decoder/include/oi_codec_sbc.h
index ac69df7..31ecb2c 100644
--- a/embdrv/sbc/decoder/include/oi_codec_sbc.h
+++ b/embdrv/sbc/decoder/include/oi_codec_sbc.h
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -53,8 +54,10 @@
 #define SBC_MAX_CHANNELS 2
 #define SBC_MAX_BANDS 8
 #define SBC_MAX_BLOCKS 16
-#define SBC_MIN_BITPOOL 2   /**< Minimum size of the bit allocation pool used to encode the stream */
-#define SBC_MAX_BITPOOL 250 /**< Maximum size of the bit allocation pool used to encode the stream */
+/* Minimum size of the bit allocation pool used to encode the stream */
+#define SBC_MIN_BITPOOL 2
+/* Maximum size of the bit allocation pool used to encode the stream */
+#define SBC_MAX_BITPOOL 250
 #define SBC_MAX_ONE_CHANNEL_BPS 320000
 #define SBC_MAX_TWO_CHANNEL_BPS 512000
 
@@ -79,38 +82,54 @@
 
 /**@name Sampling frequencies */
 /**@{*/
-#define SBC_FREQ_16000 0 /**< The sampling frequency is 16 kHz. One possible value for the @a frequency parameter of OI_CODEC_SBC_EncoderConfigure() */
-#define SBC_FREQ_32000 1 /**< The sampling frequency is 32 kHz. One possible value for the @a frequency parameter of OI_CODEC_SBC_EncoderConfigure() */
-#define SBC_FREQ_44100 2 /**< The sampling frequency is 44.1 kHz. One possible value for the @a frequency parameter of OI_CODEC_SBC_EncoderConfigure() */
-#define SBC_FREQ_48000 3 /**< The sampling frequency is 48 kHz. One possible value for the @a frequency parameter of OI_CODEC_SBC_EncoderConfigure() */
+/**< The sampling frequency is 16 kHz. One possible value for the @a frequency parameter of OI_CODEC_SBC_EncoderConfigure() */
+#define SBC_FREQ_16000 0
+/**< The sampling frequency is 32 kHz. One possible value for the @a frequency parameter of OI_CODEC_SBC_EncoderConfigure() */
+#define SBC_FREQ_32000 1
+/**< The sampling frequency is 44.1 kHz. One possible value for the @a frequency parameter of OI_CODEC_SBC_EncoderConfigure() */
+#define SBC_FREQ_44100 2
+/**< The sampling frequency is 48 kHz. One possible value for the @a frequency parameter of OI_CODEC_SBC_EncoderConfigure() */
+#define SBC_FREQ_48000 3
 /**@}*/
 
 /**@name Channel modes */
 /**@{*/
-#define SBC_MONO 0         /**< The mode of the encoded channel is mono. One possible value for the @a mode parameter of OI_CODEC_SBC_EncoderConfigure() */
-#define SBC_DUAL_CHANNEL 1 /**< The mode of the encoded channel is dual-channel. One possible value for the @a mode parameter of OI_CODEC_SBC_EncoderConfigure() */
-#define SBC_STEREO 2       /**< The mode of the encoded channel is stereo. One possible value for the @a mode parameter of OI_CODEC_SBC_EncoderConfigure() */
-#define SBC_JOINT_STEREO 3 /**< The mode of the encoded channel is joint stereo. One possible value for the @a mode parameter of OI_CODEC_SBC_EncoderConfigure() */
+/**< The mode of the encoded channel is mono. One possible value for the @a mode parameter of OI_CODEC_SBC_EncoderConfigure() */
+#define SBC_MONO 0
+/**< The mode of the encoded channel is dual-channel. One possible value for the @a mode parameter of OI_CODEC_SBC_EncoderConfigure() */
+#define SBC_DUAL_CHANNEL 1
+/**< The mode of the encoded channel is stereo. One possible value for the @a mode parameter of OI_CODEC_SBC_EncoderConfigure() */
+#define SBC_STEREO 2
+/**< The mode of the encoded channel is joint stereo. One possible value for the @a mode parameter of OI_CODEC_SBC_EncoderConfigure() */
+#define SBC_JOINT_STEREO 3
 /**@}*/
 
 /**@name Subbands */
 /**@{*/
-#define SBC_SUBBANDS_4  0 /**< The encoded stream has 4 subbands. One possible value for the @a subbands parameter of OI_CODEC_SBC_EncoderConfigure()*/
-#define SBC_SUBBANDS_8  1 /**< The encoded stream has 8 subbands. One possible value for the @a subbands parameter of OI_CODEC_SBC_EncoderConfigure() */
+/**< The encoded stream has 4 subbands. One possible value for the @a subbands parameter of OI_CODEC_SBC_EncoderConfigure()*/
+#define SBC_SUBBANDS_4  0
+/**< The encoded stream has 8 subbands. One possible value for the @a subbands parameter of OI_CODEC_SBC_EncoderConfigure() */
+#define SBC_SUBBANDS_8  1
 /**@}*/
 
 /**@name Block lengths */
 /**@{*/
-#define SBC_BLOCKS_4    0 /**< A block size of 4 blocks was used to encode the stream. One possible value for the @a blocks parameter of OI_CODEC_SBC_EncoderConfigure() */
-#define SBC_BLOCKS_8    1 /**< A block size of 8 blocks was used to encode the stream is. One possible value for the @a blocks parameter of OI_CODEC_SBC_EncoderConfigure() */
-#define SBC_BLOCKS_12   2 /**< A block size of 12 blocks was used to encode the stream. One possible value for the @a blocks parameter of OI_CODEC_SBC_EncoderConfigure() */
-#define SBC_BLOCKS_16   3 /**< A block size of 16 blocks was used to encode the stream. One possible value for the @a blocks parameter of OI_CODEC_SBC_EncoderConfigure() */
+/**< A block size of 4 blocks was used to encode the stream. One possible value for the @a blocks parameter of OI_CODEC_SBC_EncoderConfigure() */
+#define SBC_BLOCKS_4    0
+/**< A block size of 8 blocks was used to encode the stream is. One possible value for the @a blocks parameter of OI_CODEC_SBC_EncoderConfigure() */
+#define SBC_BLOCKS_8    1
+/**< A block size of 12 blocks was used to encode the stream. One possible value for the @a blocks parameter of OI_CODEC_SBC_EncoderConfigure() */
+#define SBC_BLOCKS_12   2
+/**< A block size of 16 blocks was used to encode the stream. One possible value for the @a blocks parameter of OI_CODEC_SBC_EncoderConfigure() */
+#define SBC_BLOCKS_16   3
 /**@}*/
 
 /**@name Bit allocation methods */
 /**@{*/
-#define SBC_LOUDNESS 0    /**< The bit allocation method. One possible value for the @a loudness parameter of OI_CODEC_SBC_EncoderConfigure() */
-#define SBC_SNR 1         /**< The bit allocation method. One possible value for the @a loudness parameter of OI_CODEC_SBC_EncoderConfigure() */
+/**< The bit allocation method. One possible value for the @a loudness parameter of OI_CODEC_SBC_EncoderConfigure() */
+#define SBC_LOUDNESS 0
+/**< The bit allocation method. One possible value for the @a loudness parameter of OI_CODEC_SBC_EncoderConfigure() */
+#define SBC_SNR 1
 /**@}*/
 
 /**
@@ -174,8 +193,9 @@
 
 
 /*
- * A smaller value reduces RAM usage at the expense of increased CPU usage. Values in the range
- * 27..50 are recommended, beyond 50 there is a diminishing return on reduced CPU usage.
+ * A smaller value reduces RAM usage at the expense of increased CPU usage.
+ * Values in the range 27..50 are recommended. Beyond 50 there is a diminishing
+ * return on reduced CPU usage.
  */
 #define SBC_CODEC_MIN_FILTER_BUFFERS 16
 #define SBC_CODEC_FAST_FILTER_BUFFERS 27
@@ -183,7 +203,8 @@
 /* Expands to the number of uint32_ts needed to ensure enough memory to encode
  * or decode streams of numChannels channels, using numBuffers buffers.
  * Example:
- * uint32_t decoderData[CODEC_DATA_WORDS(SBC_MAX_CHANNELS, SBC_DECODER_FAST_SYNTHESIS_BUFFERS)];
+ * uint32_t decoderData[CODEC_DATA_WORDS(SBC_MAX_CHANNELS,
+ *                                       SBC_DECODER_FAST_SYNTHESIS_BUFFERS)];
  * */
 #define CODEC_DATA_WORDS(numChannels, numBuffers) \
     ((\
@@ -195,7 +216,8 @@
 /** Opaque parameter to decoding functions; maintains decoder context. */
 typedef struct {
     OI_CODEC_SBC_COMMON_CONTEXT common;
-    uint8_t limitFrameFormat;              /* Boolean, set by OI_CODEC_SBC_DecoderLimit() */
+    /* Boolean, set by OI_CODEC_SBC_DecoderLimit() */
+    uint8_t limitFrameFormat;
     uint8_t restrictSubbands;
     uint8_t enhancedEnabled;
     uint8_t bufferedBlocks;
@@ -261,12 +283,12 @@
                                     uint8_t subbands);
 
 /**
- * This function sets the decoder parameters for a raw decode where the decoder parameters are not
- * available in the sbc data stream. OI_CODEC_SBC_DecoderReset must be called
- * prior to calling this function.
+ * This function sets the decoder parameters for a raw decode where the decoder
+ * parameters are not available in the sbc data stream.
+ * OI_CODEC_SBC_DecoderReset must be called prior to calling this function.
  *
- * @param context        Decoder context structure. This must be the context must be
- *                       used each time a frame is decoded.
+ * @param context        Decoder context structure. This must be the context
+ *                       must be used each time a frame is decoded.
  *
  * @param enhanced       Set to true to enable Qualcomm proprietary
  *                       quality enhancements.
@@ -296,22 +318,25 @@
                                            uint8_t maxBitpool);
 
 /**
- * Decode one SBC frame. The frame has no header bytes. The context must have been previously
- * initialized by calling  OI_CODEC_SBC_DecoderConfigureRaw().
+ * Decode one SBC frame. The frame has no header bytes. The context must have
+ * been previously initialized by calling  OI_CODEC_SBC_DecoderConfigureRaw().
  *
  * @param context       Pointer to a decoder context structure. The same context
- *                      must be used each time when decoding from the same stream.
+ *                      must be used each time when decoding from the same
+ *                      stream.
  *
- * @param bitpool       The actual bitpool size for this frame. Must be <= the maxbitpool specified
- *                      in the call to OI_CODEC_SBC_DecoderConfigureRaw(),
+ * @param bitpool       The actual bitpool size for this frame. Must be <= the
+ *                      maxbitpool specified in the call to
+ *                      OI_CODEC_SBC_DecoderConfigureRaw().
  *
  * @param frameData     Address of a pointer to the SBC data to decode. This
  *                      value will be updated to point to the next frame after
  *                      successful decoding.
  *
  * @param frameBytes    Pointer to a uint32_t containing the number of available
- *                      bytes of frame data. This value will be updated to reflect
- *                      the number of bytes remaining after a decoding operation.
+ *                      bytes of frame data. This value will be updated to
+ *                      reflect the number of bytes remaining after a decoding
+ *                      operation.
  *
  * @param pcmData       Address of an array of int16_t pairs, which will be
  *                      populated with the decoded audio data. This address
@@ -334,15 +359,17 @@
  * Decode one SBC frame.
  *
  * @param context       Pointer to a decoder context structure. The same context
- *                      must be used each time when decoding from the same stream.
+ *                      must be used each time when decoding from the same
+ *                      stream.
  *
  * @param frameData     Address of a pointer to the SBC data to decode. This
  *                      value will be updated to point to the next frame after
  *                      successful decoding.
  *
  * @param frameBytes    Pointer to a uint32_t containing the number of available
- *                      bytes of frame data. This value will be updated to reflect
- *                      the number of bytes remaining after a decoding operation.
+ *                      bytes of frame data. This value will be updated to
+ *                      reflect the number of bytes remaining after a decoding
+ *                      operation.
  *
  * @param pcmData       Address of an array of int16_t pairs, which will be
  *                      populated with the decoded audio data. This address
@@ -376,15 +403,17 @@
  * Analyze an SBC frame but don't do the decode.
  *
  * @param context       Pointer to a decoder context structure. The same context
- *                      must be used each time when decoding from the same stream.
+ *                      must be used each time when decoding from the same
+ *                      stream.
  *
  * @param frameData     Address of a pointer to the SBC data to decode. This
  *                      value will be updated to point to the next frame after
  *                      successful decoding.
  *
  * @param frameBytes    Pointer to a uint32_t containing the number of available
- *                      bytes of frame data. This value will be updated to reflect
- *                      the number of bytes remaining after a decoding operation.
+ *                      bytes of frame data. This value will be updated to
+ *                      reflect the number of bytes remaining after a decoding
+ *                      operation.
  *
  */
 OI_STATUS OI_CODEC_SBC_SkipFrame(OI_CODEC_SBC_DECODER_CONTEXT *context,
diff --git a/embdrv/sbc/decoder/include/oi_codec_sbc_private.h b/embdrv/sbc/decoder/include/oi_codec_sbc_private.h
index 4e445e7..c497ad0 100644
--- a/embdrv/sbc/decoder/include/oi_codec_sbc_private.h
+++ b/embdrv/sbc/decoder/include/oi_codec_sbc_private.h
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
diff --git a/embdrv/sbc/decoder/include/oi_common.h b/embdrv/sbc/decoder/include/oi_common.h
index 28b3a9e..0864ad2 100644
--- a/embdrv/sbc/decoder/include/oi_common.h
+++ b/embdrv/sbc/decoder/include/oi_common.h
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
diff --git a/embdrv/sbc/decoder/include/oi_cpu_dep.h b/embdrv/sbc/decoder/include/oi_cpu_dep.h
index c582ec9..2fc8127 100644
--- a/embdrv/sbc/decoder/include/oi_cpu_dep.h
+++ b/embdrv/sbc/decoder/include/oi_cpu_dep.h
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -30,10 +31,10 @@
  * CPU families. The preprocessor symbol 'CPU' must be defined to be an
  * appropriate value or this header will generate a compile-time error.
  *
- * @note The documentation for this header file uses the x86 family of processors
- * as an illustrative example for CPU/compiler-dependent data type definitions.
- * Go to the source code of this header file to see the details of primitive type
- * definitions for each platform.
+ * @note The documentation for this header file uses the x86 family of
+ * processors as an illustrative example for CPU/compiler-dependent data type
+ * definitions. Go to the source code of this header file to see the details of
+ * primitive type definitions for each platform.
  *
  * Additional information is available in the @ref data_types_docpage section.
  */
@@ -122,16 +123,18 @@
 /******************************************************************************/
 
 #if OI_CPU_TYPE==OI_CPU_ARM
-/* This CPU type is deprecated (removed from use). Instead, use OI_CPU_ARM7_LEND or OI_CPU_ARM7_BEND for
-   little-endian or big-endian configurations of the ARM7, respectively. */
+/* This CPU type is deprecated (removed from use). Instead, use OI_CPU_ARM7_LEND
+ * or OI_CPU_ARM7_BEND for little-endian or big-endian configurations of the
+ * ARM7, respectively. */
 #error OI_CPU_ARM is deprecated
 #endif
 
 /******************************************************************************/
 
-#if OI_CPU_TYPE==OI_CPU_ARC
-/* This CPU type is deprecated (removed from use). Instead, use OI_CPU_ARC_LEND or OI_CPU_ARC_BEND for
-   little-endian or big-endian configurations of the ARC, respectively. */
+#if OI_CPU_TYPE == OI_CPU_ARC
+/* This CPU type is deprecated (removed from use). Instead, use OI_CPU_ARC_LEND
+ * or OI_CPU_ARC_BEND for little-endian or big-endian configurations of the
+ * ARC, respectively. */
 #error OI_CPU_ARC is deprecated
 #endif
 
diff --git a/embdrv/sbc/decoder/include/oi_modules.h b/embdrv/sbc/decoder/include/oi_modules.h
index 2d21f81..f0c5b66 100644
--- a/embdrv/sbc/decoder/include/oi_modules.h
+++ b/embdrv/sbc/decoder/include/oi_modules.h
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -147,16 +148,16 @@
 } OI_MODULE;
 
 /**
- * This constant is the number of actual modules in the list.  ALL and UNKNOWN are
- * special values that are not actually modules.
+ * This constant is the number of actual modules in the list.  ALL and UNKNOWN
+ * are special values that are not actually modules.
  * Used for debug print and memmgr profiling
  */
 #define OI_NUM_MODULES  OI_MODULE_ALL
 
 
 /**
- * This constant is the number of profile and core components.  It is used to size
- * the initialization and configuration tables.
+ * This constant is the number of profile and core components.  It is used to
+ * size the initialization and configuration tables.
  */
 #define OI_NUM_STACK_MODULES    OI_MODULE_BHAPI
 
diff --git a/embdrv/sbc/decoder/include/oi_osinterface.h b/embdrv/sbc/decoder/include/oi_osinterface.h
index 1c37025..2f716e5 100644
--- a/embdrv/sbc/decoder/include/oi_osinterface.h
+++ b/embdrv/sbc/decoder/include/oi_osinterface.h
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -97,7 +98,8 @@
  * OI_Sleep. The use of OI_Sleep is limited to applications and
  * platform-specific code.
  *
- * If your port and applications never use OI_Sleep, this function can be left unimplemented.
+ * If your port and applications never use OI_Sleep, this function can be left
+ * unimplemented.
  *
  * @param milliseconds  Number of milliseconds to sleep
  */
@@ -136,8 +138,8 @@
 void OI_Print(OI_CHAR const *str);
 
 /**
- *  In cases where OI_Print() is sending output to a logfile in addition to console,
- *  it is desirable to also put console input into the logfile.
+ *  In cases where OI_Print() is sending output to a logfile in addition to
+ *  console, it is desirable to also put console input into the logfile.
  *  This function can be called by the console input process.
  *
  *  @note This is an optional API which is strictly
diff --git a/embdrv/sbc/decoder/include/oi_status.h b/embdrv/sbc/decoder/include/oi_status.h
index 868d8dc..4593dfb 100644
--- a/embdrv/sbc/decoder/include/oi_status.h
+++ b/embdrv/sbc/decoder/include/oi_status.h
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -36,7 +37,7 @@
    /** test it **/
 
 /**
- * OI_STATUS must fit in 16 bits, so status codes can range from 0 to 66535, inclusive.
+ * OI_STATUS is 16 bits, so status codes can range from 0 to 66535, inclusive.
  */
 
 typedef enum {
diff --git a/embdrv/sbc/decoder/include/oi_stddefs.h b/embdrv/sbc/decoder/include/oi_stddefs.h
index bee4dfc..f2522bc 100644
--- a/embdrv/sbc/decoder/include/oi_stddefs.h
+++ b/embdrv/sbc/decoder/include/oi_stddefs.h
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -91,7 +92,9 @@
 #define OI_UINT64_MIN { (uint32_t)0x00000000, (uint32_t)0x00000000 }
 #define OI_UINT64_MAX { (uint32_t)0XFFFFFFFF, (uint32_t)0XFFFFFFFF }
 
-/** signed 64-bit integer as a structure of one unsigned 32-bit integer and one signed 32-bit integer */
+/* signed 64-bit integer as a structure of one unsigned 32-bit integer and one
+ * signed 32-bit integer
+ */
 typedef struct {
     int32_t  I1; /**< most significant 32 bits  as a signed integer */
     uint32_t I2; /**< least significant 32 bits as an unsigned integer */
@@ -111,7 +114,8 @@
 #define OI_UINT128_MIN { (uint32_t)0x00000000, (uint32_t)0x00000000,  (uint32_t)0x00000000, (uint32_t)0x00000000 }
 #define OI_UINT128_MAX { (uint32_t)0XFFFFFFFF, (uint32_t)0XFFFFFFFF,  (uint32_t)0XFFFFFFFF, (uint32_t)0XFFFFFFFF }
 
-/** signed 128-bit integer as a structure of three unsigned 32-bit integers and one signed 32-bit integer */
+/* signed 128-bit integer as a structure of three unsigned 32-bit integers and
+ * one signed 32-bit integer */
 typedef struct {
     int32_t  I1;  /**< most significant 32 bits as a signed integer */
     uint32_t I2;  /**< second-most significant 32 bits as an unsigned integer */
@@ -148,14 +152,17 @@
 /**
  * @name Single-bit operation macros
  * @{
- * In these macros, x is the data item for which a bit is to be tested or set and y specifies which bit
- * is to be tested or set.
+ * In these macros, x is the data item for which a bit is to be tested or set
+ * and y specifies which bit is to be tested or set.
  */
 
-/** This macro's value is true if the bit specified by y is set in data item x. */
+/* This macro's value is true if the bit specified by y is set in data item x.
+ */
 #define OI_BIT_TEST(x,y)   ((x) & (y))
 
-/** This macro's value is true if the bit specified by y is not set in data item x. */
+/* This macro's value is true if the bit specified by y is not set in data item
+ * x.
+ */
 #define OI_BIT_CLEAR_TEST(x,y)  (((x) & (y)) == 0)
 
 /** This macro sets the bit specified by y in data item x. */
diff --git a/embdrv/sbc/decoder/include/oi_string.h b/embdrv/sbc/decoder/include/oi_string.h
index 4b15479..a876ac9 100644
--- a/embdrv/sbc/decoder/include/oi_string.h
+++ b/embdrv/sbc/decoder/include/oi_string.h
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
diff --git a/embdrv/sbc/decoder/include/oi_time.h b/embdrv/sbc/decoder/include/oi_time.h
index 40035f5..4c4996e 100644
--- a/embdrv/sbc/decoder/include/oi_time.h
+++ b/embdrv/sbc/decoder/include/oi_time.h
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -20,7 +21,7 @@
 #define _OI_TIME_H
 /** @file
  *
- * This file provides time type definitions and interfaces to time-related functions.
+ * This file provides time type definitions and time-related functions.
  *
  * The stack maintains a 64-bit real-time millisecond clock. The choice of
  * milliseconds is for convenience, not accuracy.
@@ -51,7 +52,8 @@
 
 
 /**
- * Within the core stack timeouts are specified in intervals of tenths of seconds
+ * Within the core stack, timeouts are specified in intervals of tenths of
+ * seconds.
  */
 
 typedef uint16_t OI_INTERVAL;
@@ -85,7 +87,8 @@
 
 /**
  * The stack depends on relative not absolute time. Any mapping between the
- * stack's real-time clock and absolute time and date is implementation-dependent.
+ * stack's real-time clock and absolute time and date is
+ * implementation-dependent.
  */
 
 typedef struct {
@@ -123,14 +126,15 @@
 
 
 /**
- * This function returns the interval between two times to a granularity of 0.1 seconds.
+ * This function returns the interval between two times to a granularity of 0.1
+ * seconds.
  *
  * @param Sooner a time value more recent that Later
  *
  * @param Later a time value later than Sooner
  *
- * @note The result is an OI_INTERVAL value so this function only works for time intervals
- * that are less than about 71 minutes.
+ * @note The result is an OI_INTERVAL value so this function only works for time
+ * intervals that are less than about 71 minutes.
  *
  * @return the time interval between the two times = (Later - Sooner)
  */
@@ -141,14 +145,15 @@
 
 
 /**
- * This function returns the interval between two times to a granularity of milliseconds.
+ * This function returns the interval between two times to a granularity of
+ * milliseconds.
  *
  * @param Sooner a time value more recent that Later
  *
  * @param Later a time value later than Sooner
  *
- * @note The result is an uint32_t value so this function only works for time intervals
- * that are less than about 50 days.
+ * @note The result is an uint32_t value so this function only works for time
+ * intervals that are less than about 50 days.
  *
  * @return the time interval between the two times = (Later - Sooner)
  */
@@ -159,7 +164,8 @@
 
 
 /**
- * This function answers the question, Have we reached or gone past the target time?
+ * This function answers this question:
+ *   "Have we reached or gone past the target time?"
  *
  * @param pTargetTime   target time
  *
diff --git a/embdrv/sbc/decoder/include/oi_utils.h b/embdrv/sbc/decoder/include/oi_utils.h
index 330f1fa..19f8b91 100644
--- a/embdrv/sbc/decoder/include/oi_utils.h
+++ b/embdrv/sbc/decoder/include/oi_utils.h
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -52,29 +53,34 @@
 /**
  * Function prototype for a timed procedure callback.
  *
- * @param arg                 Value that was passed into the OI_ScheduleCallback() function
+ * @param arg   Value that was passed into the OI_ScheduleCallback() function
  *
  */
 typedef void (*OI_SCHEDULED_CALLBACK)(void *arg);
 
 
 /**
- * Registers a function to be called when a timeout expires. This API uses BLUEmagic's internal
- * function dispatch mechanism, so applications that make extensive use of this facility may need to
- * increase the value of DispatchTableSize in the configuration block for the dispatcher (see
+ * Registers a function to be called when a timeout expires. This API uses
+ * BLUEmagic's internal function dispatch mechanism, so applications that make
+ * extensive use of this facility may need to increase the value of
+ * DispatchTableSize in the configuration block for the dispatcher (see
  * oi_bt_stack_config.h).
  *
- * @param callbackFunction    The function that will be called when the timeout expires
+ * @param callbackFunction    The function that will be called when the timeout
+ *                            expires
  *
- * @param arg                 Value that will be returned as the parameter to the callback function.
+ * @param arg                 Value that will be returned as the parameter to
+ *                            the callback function.
  *
- * @param timeout             A timeout expressed in OI_INTERVALs (tenths of seconds). This can be
- *                            zero in which case the callback function will be called as soon as
+ * @param timeout             A timeout expressed in OI_INTERVALs (tenths of
+ *                            seconds). This can be zero in which case the
+ *                            callback function will be called as soon as
  *                            possible.
  *
  * @param handle              NULL or a pointer receive the callback handle.
  *
- * @return                    OI_OK if the function was reqistered, or an error status.
+ * @return                    OI_OK if the function was registered, or an error
+ *                            status.
  */
 OI_STATUS OI_ScheduleCallbackFunction(OI_SCHEDULED_CALLBACK callbackFunction,
                                       void                 *arg,
@@ -83,39 +89,47 @@
 
 
 /**
- * Cancels a function registered with OI_ScheduleCallbackFunction() before its timer expires.
+ * Cancels a function registered with OI_ScheduleCallbackFunction() before its
+ * timer expires.
  *
  * @param handle              handle returned by  OI_ScheduleCallbackFunction().
  *
- * @return                    OI_OK if the function was cancelled, or an error status.
+ * @return                    OI_OK if the function was cancelled, or an error
+ *                            status.
  */
 OI_STATUS OI_CancelCallbackFunction(OI_CALLBACK_HANDLE handle);
 
 
 /**
- * Registers a function to be called when a timeout expires. This version does not return a handle
- * so can only be canceled by calling OI_CancelCallback().
+ * Registers a function to be called when a timeout expires. This version does
+ * not return a handle so can only be canceled by calling OI_CancelCallback().
  *
- * @param callbackFunction    The function that will be called when the timeout expires
+ * @param callbackFunction    The function that will be called when the timeout
+ *                            expires
  *
- * @param arg                 Value that will be returned as the parameter to the callback function.
+ * @param arg                 Value that will be returned as the parameter to
+ *                            the callback function.
  *
- * @param timeout             A timeout expressed in OI_INTERVALs (tenths of seconds). This can be
- *                            zero in which case the callback function will be called as soon as
+ * @param timeout             A timeout expressed in OI_INTERVALs (tenths of
+ *                            seconds). This can be zero in which case the
+ *                            callback function will be called as soon as
  *                            possible.
  *
- * @return                    OI_OK if the function was reqistered, or an error status.
+ * @return                    OI_OK if the function was reqistered, or an error
+ *                            status.
  */
 #define OI_ScheduleCallback(f, a, t)  OI_ScheduleCallbackFunction(f, a, t, NULL);
 
 
 /**
- * Cancels a function registered with OI_ScheduleCallback() before its timer expires. This
- * function will cancel the first entry matches the indicated callback function pointer.
+ * Cancels a function registered with OI_ScheduleCallback() before its timer
+ * expires. This function will cancel the first entry matches the indicated
+ * callback function pointer.
  *
  * @param callbackFunction    The function that was originally registered
  *
- * @return                    OI_OK if the function was cancelled, or an error status.
+ * @return                    OI_OK if the function was cancelled, or an error
+ *                            status.
  */
 OI_STATUS OI_CancelCallback(OI_SCHEDULED_CALLBACK callbackFunction);
 
@@ -145,7 +159,8 @@
  *       Requires a pointer to the buffer and a signed integer length
  *       (0 for default length). If the buffer is large, only an excerpt will
  *       be printed.
- *       @code OI_Printf("Contents of buffer %@", buffer, sizeof(buffer)); @endcode
+ *       @code OI_Printf("Contents of buffer %@", buffer, sizeof(buffer));
+ *       @endcode
  *
  * \%:   prints a Bluetooth address in the form "HH:HH:HH:HH:HH:HH".
  *       Requires a pointer to an #OI_BD_ADDR.
@@ -153,7 +168,8 @@
  *
  * \%^   decodes and prints a data element as formatted XML.
  *       Requires a pointer to an #OI_DATAELEM.
- *       @code OI_Printf("Service attribute list is:\n%^", &attributes); @endcode
+ *       @code OI_Printf("Service attribute list is:\n%^", &attributes);
+ *       @endcode
  *
  * \%/   prints the base file name of a path, that is, the final substring
  *       following a '/' or '\\' character. Requires a pointer to a null
@@ -220,8 +236,8 @@
 
 
 /**
- * Writes a formatted string to a buffer. This function supports the same format specifiers as
- * OI_Printf().
+ * Writes a formatted string to a buffer. This function supports the same format
+ * specifiers as OI_Printf().
  *
  * @param buffer   Destination buffer for the formatted string.
  *
@@ -259,7 +275,8 @@
  *
  * @param str  the string to parse
  *
- * @return the integer value of the string or 0 if the string could not be parsed
+ * @return the integer value of the string or 0 if the string could not be
+ *         parsed
  */
 OI_INT OI_atoi(const OI_CHAR *str);
 
@@ -267,15 +284,17 @@
 /**
  * Parse a signed integer in a string.
  *
- * Skips leading whitespace (space and tabs only) and parses a decimal or hex string. Hex string
- * must be prefixed by "0x". Returns pointer to first character following the integer. Returns the
- * pointer passed in if the string does not describe an integer.
+ * Skips leading whitespace (space and tabs only) and parses a decimal or hex
+ * string. Hex string must be prefixed by "0x". Returns pointer to first
+ * character following the integer. Returns the pointer passed in if the string
+ * does not describe an integer.
  *
  * @param str    String to parse.
  *
  * @param val    Pointer to receive the parsed integer value.
  *
- * @return       A pointer to the first character following the integer or the pointer passed in.
+ * @return       A pointer to the first character following the integer or the
+ *               pointer passed in.
  */
 const OI_CHAR* OI_ScanInt(const OI_CHAR *str,
                           int32_t *val);
@@ -284,15 +303,17 @@
 /**
  * Parse an unsigned integer in a string.
  *
- * Skips leading whitespace (space and tabs only) and parses a decimal or hex string. Hex string
- * must be prefixed by "0x". Returns pointer to first character following the integer. Returns the
- * pointer passed in if the string does not describe an integer.
+ * Skips leading whitespace (space and tabs only) and parses a decimal or hex
+ * string. Hex string must be prefixed by "0x". Returns pointer to first
+ * character following the integer. Returns the pointer passed in if the
+ * string does not describe an integer.
  *
  * @param str    String to parse.
  *
  * @param val    Pointer to receive the parsed unsigned integer value.
  *
- * @return       A pointer to the first character following the unsigned integer or the pointer passed in.
+ * @return       A pointer to the first character following the unsigned
+ *               integer or the pointer passed in.
  */
 const OI_CHAR* OI_ScanUInt(const OI_CHAR *str,
                            uint32_t *val);
@@ -305,7 +326,8 @@
  * @param len     Length of outStr
  *
  *
- * @return       A pointer to the first character following the substring or the pointer passed in.
+ * @return       A pointer to the first character following the substring or
+ *               the pointer passed in.
  */
 const OI_CHAR* OI_ScanStr(const OI_CHAR *str,
                           OI_CHAR *outStr,
@@ -313,34 +335,36 @@
 
 
 /**
- * Parse a string for one of a set of alternative value. Skips leading whitespace (space and tabs
- * only) and parses text matching one of the alternative strings. Returns pointer to first character
- * following the matched text.
+ * Parse a string for one of a set of alternative value. Skips leading
+ * whitespace (space and tabs only) and parses text matching one of the
+ * alternative strings. Returns pointer to first character following the
+ * matched text.
  *
  * @param str    String to parse.
  *
  * @param alts   Alternative matching strings separated by '|'
  *
- * @param index  Pointer to receive the index of the matching alternative, return value is -1 if
- *               there is no match.
+ * @param index  Pointer to receive the index of the matching alternative,
+ *               return value is -1 if there is no match.
  *
- * @return       A pointer to the first character following the matched value or the pointer passed in
- *               if there was no matching text.
+ * @return       A pointer to the first character following the matched value or
+ *               the pointer passed in if there was no matching text.
  */
 const OI_CHAR* OI_ScanAlt(const OI_CHAR *str,
                           const OI_CHAR *alts,
                           OI_INT *index);
 
 /**
- * Parse a string for a BD Addr. Skips leading whitespace (space and tabs only) and parses a
- * Bluetooth device address with nibbles optionally separated by colons. Return pointet to first
- * character following the BD Addr.
+ * Parse a string for a BD Addr. Skips leading whitespace (space and tabs only)
+ * and parses a Bluetooth device address with nibbles optionally separated by
+ * colons. Return pointet to first character following the BD Addr.
  *
  * @param str    String to parse.
  *
  * @param addr   Pointer to receive the Bluetooth device address
  *
- * @return       A pointer to the first character following the BD Addr or the pointer passed in.
+ * @return       A pointer to the first character following the BD Addr or the
+ *               pointer passed in.
  */
 const OI_CHAR* OI_ScanBdAddr(const OI_CHAR *str,
                              OI_BD_ADDR *addr);
diff --git a/embdrv/sbc/decoder/srce/alloc.c b/embdrv/sbc/decoder/srce/alloc.c
index bb1fb5e..aef79b1 100644
--- a/embdrv/sbc/decoder/srce/alloc.c
+++ b/embdrv/sbc/decoder/srce/alloc.c
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
diff --git a/embdrv/sbc/decoder/srce/bitalloc-sbc.c b/embdrv/sbc/decoder/srce/bitalloc-sbc.c
index 0d74283..ed381cd 100644
--- a/embdrv/sbc/decoder/srce/bitalloc-sbc.c
+++ b/embdrv/sbc/decoder/srce/bitalloc-sbc.c
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
diff --git a/embdrv/sbc/decoder/srce/bitalloc.c b/embdrv/sbc/decoder/srce/bitalloc.c
index 2ffddfd..4719cd8 100644
--- a/embdrv/sbc/decoder/srce/bitalloc.c
+++ b/embdrv/sbc/decoder/srce/bitalloc.c
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -96,15 +97,18 @@
 
 
 /*
- * Computes the bit need for each sample and as also returns a counts of bit needs that are greater
- * than one. This count is used in the first phase of bit allocation.
+ * Computes the bit need for each sample and as also returns a counts of bit
+ * needs that are greater than one. This count is used in the first phase of bit
+ * allocation.
  *
- * We also compute a preferred bitpool value that this is the minimum bitpool needed to guarantee
- * lossless representation of the audio data. The preferred bitpool may be larger than the bits
- * actually required but the only input we have are the scale factors. For example, it takes 2 bits
- * to represent values in the range -1 .. +1 but the scale factor is 0. To guarantee lossless
- * representation we add 2 to each scale factor and sum them to come up with the preferred bitpool.
- * This is not ideal because 0 requires 0 bits but we currently have no way of knowing this.
+ * We also compute a preferred bitpool value that this is the minimum bitpool
+ * needed to guarantee lossless representation of the audio data. The preferred
+ * bitpool may be larger than the bits actually required but the only input we
+ * have are the scale factors. For example, it takes 2 bits to represent values
+ * in the range -1 .. +1 but the scale factor is 0. To guarantee lossless
+ * representation we add 2 to each scale factor and sum them to come up with the
+ * preferred bitpool. This is not ideal because 0 requires 0 bits but we
+ * currently have no way of knowing this.
  *
  * @param bitneed       Array to return bitneeds for each subband
  *
@@ -231,11 +235,13 @@
  *
  * @param bitpool   The bitpool we have to work within
  *
- * @param bitneeds  An array of bit needs (more acturately allocation prioritities) for each
- *                  subband across all blocks in the SBC frame
+ * @param bitneeds  An array of bit needs (more acturately allocation
+ *                  prioritities) for each subband across all blocks in the SBC
+ *                  frame
  *
- * @param subbands  The number of subbands over which the adkustment is calculated. For mono and
- *                  dual mode this is 4 or 8, for stereo or joint stereo this is 8 or 16.
+ * @param subbands  The number of subbands over which the adkustment is
+ *                  calculated. For mono and dual mode this is 4 or 8, for
+ *                  stereo or joint stereo this is 8 or 16.
  *
  * @param bitcount  A starting point for the adjustment
  *
@@ -298,8 +304,9 @@
 
 
 /*
- * The bit allocator trys to avoid single bit allocations except as a last resort. So in the case
- * where a bitneed of 1 was passed over during the adsjustment phase 2 bits are now allocated.
+ * The bit allocator trys to avoid single bit allocations except as a last
+ * resort. So in the case where a bitneed of 1 was passed over during the
+ * adsjustment phase 2 bits are now allocated.
  */
 INLINE OI_INT allocAdjustedBits(uint8_t *dest,
                                 OI_INT bits,
diff --git a/embdrv/sbc/decoder/srce/bitstream-decode.c b/embdrv/sbc/decoder/srce/bitstream-decode.c
index c68d9a0..be0050b 100644
--- a/embdrv/sbc/decoder/srce/bitstream-decode.c
+++ b/embdrv/sbc/decoder/srce/bitstream-decode.c
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
diff --git a/embdrv/sbc/decoder/srce/decoder-private.c b/embdrv/sbc/decoder/srce/decoder-private.c
index eec3417..9a874e6 100644
--- a/embdrv/sbc/decoder/srce/decoder-private.c
+++ b/embdrv/sbc/decoder/srce/decoder-private.c
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -82,8 +83,9 @@
 
 
 /**
- * Read the SBC header up to but not including the joint stereo mask.  The syncword has already been
- * examined, and the enhanced mode flag set, by FindSyncword.
+ * Read the SBC header up to but not including the joint stereo mask. The
+ * syncword has already been examined, and the enhanced mode flag set, by
+ * FindSyncword.
  */
 INLINE void OI_SBC_ReadHeader(OI_CODEC_SBC_COMMON_CONTEXT *common, const OI_BYTE *data)
 {
diff --git a/embdrv/sbc/decoder/srce/dequant.c b/embdrv/sbc/decoder/srce/dequant.c
index 28e37e4..6647978 100644
--- a/embdrv/sbc/decoder/srce/dequant.c
+++ b/embdrv/sbc/decoder/srce/dequant.c
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
diff --git a/embdrv/sbc/decoder/srce/framing-sbc.c b/embdrv/sbc/decoder/srce/framing-sbc.c
index c367925..ca6f1a6 100644
--- a/embdrv/sbc/decoder/srce/framing-sbc.c
+++ b/embdrv/sbc/decoder/srce/framing-sbc.c
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
diff --git a/embdrv/sbc/decoder/srce/framing.c b/embdrv/sbc/decoder/srce/framing.c
index 48b1d97..cc2fe16 100644
--- a/embdrv/sbc/decoder/srce/framing.c
+++ b/embdrv/sbc/decoder/srce/framing.c
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
diff --git a/embdrv/sbc/decoder/srce/oi_codec_version.c b/embdrv/sbc/decoder/srce/oi_codec_version.c
index 8d0626d..b45d418 100644
--- a/embdrv/sbc/decoder/srce/oi_codec_version.c
+++ b/embdrv/sbc/decoder/srce/oi_codec_version.c
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2002 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -44,7 +45,7 @@
 #endif
 ;
 
-/** This function returns the version string for the BLUEmagic 3.0 protocol stack
+/* This function returns the version string for the BLUEmagic 3.0 protocol stack
     and profiles */
 OI_CHAR *OI_CODEC_Version(void) {
     return codecVersion;
diff --git a/embdrv/sbc/decoder/srce/readsamplesjoint.inc b/embdrv/sbc/decoder/srce/readsamplesjoint.inc
index 690cabe..79151ff 100644
--- a/embdrv/sbc/decoder/srce/readsamplesjoint.inc
+++ b/embdrv/sbc/decoder/srce/readsamplesjoint.inc
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
diff --git a/embdrv/sbc/decoder/srce/synthesis-8-generated.c b/embdrv/sbc/decoder/srce/synthesis-8-generated.c
index 71aba9e..91fff61 100644
--- a/embdrv/sbc/decoder/srce/synthesis-8-generated.c
+++ b/embdrv/sbc/decoder/srce/synthesis-8-generated.c
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
diff --git a/embdrv/sbc/decoder/srce/synthesis-dct8.c b/embdrv/sbc/decoder/srce/synthesis-dct8.c
index f263df6..8a17c54 100644
--- a/embdrv/sbc/decoder/srce/synthesis-dct8.c
+++ b/embdrv/sbc/decoder/srce/synthesis-dct8.c
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -164,8 +165,8 @@
 /*
  * This function calculates the AAN DCT. Its inputs are in S16.15 format, as
  * returned by OI_SBC_Dequant. In practice, abs(in[x]) < 52429.0 / 1.38
- * (1244918057 integer). The function it computes is an approximation to the array defined
- * by:
+ * (1244918057 integer). The function it computes is an approximation to the
+ * array defined by:
  *
  * diag(aan_s) * AAN= C2
  *
@@ -186,12 +187,13 @@
  * Without loss of generality, assume the input vector X consists of elements
  * between -1 and 1. The maximum possible value of a given output element occurs
  * with some particular combination of input vector elements each of which is -1
- * or 1. Consider the computation of Y[i]. Y[i] = sum t=0..7 of AAN[t,i]*X[i]. Y is
- * maximized if the sign of X[i] matches the sign of AAN[t,i], ensuring a
+ * or 1. Consider the computation of Y[i]. Y[i] = sum t=0..7 of AAN[t,i]*X[i]. Y
+ * is maximized if the sign of X[i] matches the sign of AAN[t,i], ensuring a
  * positive contribution to the sum. Equivalently, one may simply sum
  * abs(AAN)[t,i] over t to get the maximum possible value of Y[i].
  *
- * This yields approximately [8.00  10.05   9.66   8.52   8.00   5.70   4.00   2.00]
+ * This yields approximately:
+ *  [8.00  10.05   9.66   8.52   8.00   5.70   4.00   2.00]
  *
  * Given the maximum magnitude sensible input value of +/-37992, this yields the
  * following vector of maximum output magnitudes:
diff --git a/embdrv/sbc/decoder/srce/synthesis-sbc.c b/embdrv/sbc/decoder/srce/synthesis-sbc.c
index 37a4187..f8425d2 100644
--- a/embdrv/sbc/decoder/srce/synthesis-sbc.c
+++ b/embdrv/sbc/decoder/srce/synthesis-sbc.c
@@ -1,7 +1,8 @@
 /******************************************************************************
  *
  *  Copyright (C) 2014 The Android Open Source Project
- *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
+ *  Copyright 2003 - 2004 Open Interface North America, Inc. All rights
+ *                        reserved.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
diff --git a/embdrv/sbc/encoder/include/sbc_dct.h b/embdrv/sbc/encoder/include/sbc_dct.h
index df79018..84c8d42 100644
--- a/embdrv/sbc/encoder/include/sbc_dct.h
+++ b/embdrv/sbc/encoder/include/sbc_dct.h
@@ -40,7 +40,9 @@
 #define SBC_MULT_32_16_SIMPLIFIED(s16In2, s32In1 , s32OutLow) s32OutLow = SBC_Multiply_32_16_Simplified((int32_t)s16In2,s32In1);
 #else
 #if (SBC_IPAQ_OPT == TRUE)
-/*#define SBC_MULT_32_16_SIMPLIFIED(s16In2, s32In1 , s32OutLow) s32OutLow=(int32_t)((int32_t)(s16In2)*(int32_t)(s32In1>>15)); */
+/*
+#define SBC_MULT_32_16_SIMPLIFIED(s16In2, s32In1 , s32OutLow) s32OutLow=(int32_t)((int32_t)(s16In2)*(int32_t)(s32In1>>15));
+*/
 #define SBC_MULT_32_16_SIMPLIFIED(s16In2, s32In1 , s32OutLow) s32OutLow=(int32_t)(((int64_t)(s16In2)*(int64_t)(s32In1))>>15);
 #if (SBC_IS_64_MULT_IN_IDCT == TRUE)
 #define SBC_MULT_32_32(s32In2, s32In1, s32OutLow)                           \
diff --git a/embdrv/sbc/encoder/include/sbc_encoder.h b/embdrv/sbc/encoder/include/sbc_encoder.h
index 41ba0c1..6f038ad 100644
--- a/embdrv/sbc/encoder/include/sbc_encoder.h
+++ b/embdrv/sbc/encoder/include/sbc_encoder.h
@@ -86,37 +86,51 @@
 #define SBC_ARM_ASM_OPT FALSE
 #endif
 
-/* green hill compiler option -> Used to distinguish the syntax for inline assembly code*/
+/* green hill compiler option -> Used to distinguish the syntax for inline
+ * assembly code
+ */
 #ifndef SBC_GHS_COMPILER
 #define SBC_GHS_COMPILER FALSE
 #endif
 
-/* ARM compiler option -> Used to distinguish the syntax for inline assembly code */
+/* ARM compiler option -> Used to distinguish the syntax for inline assembly
+ * code */
 #ifndef SBC_ARM_COMPILER
 #define SBC_ARM_COMPILER TRUE
 #endif
 
 /* Set SBC_IPAQ_OPT to TRUE in case the target is an ARM */
-/* 32 and 64 bit mult will be performed using int64_t ( usualy __int64 ) cast that usualy give optimal performance if supported */
+/* 32 and 64 bit mult will be performed using int64_t ( usualy __int64 ) cast
+ * that usualy give optimal performance if supported
+ */
 #ifndef SBC_IPAQ_OPT
 #define SBC_IPAQ_OPT TRUE
 #endif
 
-/* Debug only: set SBC_IS_64_MULT_IN_WINDOW_ACCU to TRUE to use 64 bit multiplication in the windowing */
+/* Debug only: set SBC_IS_64_MULT_IN_WINDOW_ACCU to TRUE to use 64 bit
+ * multiplication in the windowing
+ */
 /* -> not recomended, more MIPS for the same restitution.  */
 #ifndef SBC_IS_64_MULT_IN_WINDOW_ACCU
 #define SBC_IS_64_MULT_IN_WINDOW_ACCU  FALSE
 #endif /*SBC_IS_64_MULT_IN_WINDOW_ACCU */
 
-/* Set SBC_IS_64_MULT_IN_IDCT to TRUE to use 64 bits multiplication in the DCT of Matrixing */
-/* -> more MIPS required for a better audio quality. comparasion with the SIG utilities shows a division by 10 of the RMS */
+/* Set SBC_IS_64_MULT_IN_IDCT to TRUE to use 64 bits multiplication in the DCT
+ * of Matrixing
+ */
+/* -> more MIPS required for a better audio quality. comparasion with the SIG
+ * utilities shows a division by 10 of the RMS
+ */
 /* CAUTION: It only apply in the if SBC_FAST_DCT is set to TRUE */
 #ifndef SBC_IS_64_MULT_IN_IDCT
 #define SBC_IS_64_MULT_IN_IDCT  FALSE
 #endif /*SBC_IS_64_MULT_IN_IDCT */
 
-/* set SBC_IS_64_MULT_IN_QUANTIZER to TRUE to use 64 bits multiplication in the quantizer */
-/* setting this flag to FALSE add whistling noise at 5.5 and 11 KHz usualy not perceptible by human's hears. */
+/* set SBC_IS_64_MULT_IN_QUANTIZER to TRUE to use 64 bits multiplication in the
+ * quantizer
+ */
+/* setting this flag to FALSE adds a whistling noise at 5.5 and 11 KHz usualy
+ * not perceptible by human's hears. */
 #ifndef SBC_IS_64_MULT_IN_QUANTIZER
 #define SBC_IS_64_MULT_IN_QUANTIZER  TRUE
 #endif /*SBC_IS_64_MULT_IN_IDCT */
@@ -126,7 +140,8 @@
 #define SBC_FAST_DCT  TRUE
 #endif /*SBC_FAST_DCT */
 
-/* In case we do not use joint stereo mode the flag save some RAM and ROM in case it is set to FALSE */
+/* In case we do not use joint stereo mode the flag save some RAM and ROM in
+ * case it is set to FALSE */
 #ifndef SBC_JOINT_STE_INCLUDED
 #define SBC_JOINT_STE_INCLUDED TRUE
 #endif
@@ -180,8 +195,8 @@
 extern "C" {
 #endif
 
-/* Encode the frame using SBC. The output is written into |output|. Return number of
- * bytes written. */
+/* Encode the frame using SBC. The output is written into |output|. Return
+ * number of bytes written. */
 extern uint32_t SBC_Encode(SBC_ENC_PARAMS *strEncParams, int16_t *input, uint8_t *output);
 extern void SBC_Encoder_Init(SBC_ENC_PARAMS *strEncParams);
 
diff --git a/embdrv/sbc/encoder/srce/sbc_analysis.c b/embdrv/sbc/encoder/srce/sbc_analysis.c
index e47c4b9..9541bf8 100644
--- a/embdrv/sbc/encoder/srce/sbc_analysis.c
+++ b/embdrv/sbc/encoder/srce/sbc_analysis.c
@@ -996,7 +996,7 @@
     }
 }
 
-/* //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// */
+/* ////////////////////////////////////////////////////////////////////////// */
 void SbcAnalysisFilter8 (SBC_ENC_PARAMS *pstrEncParams, int16_t *input)
 {
     int16_t *ps16PcmBuf;
diff --git a/hci/src/vendor.cc b/hci/src/vendor.cc
index 1c1ab8c..b8d510c 100644
--- a/hci/src/vendor.cc
+++ b/hci/src/vendor.cc
@@ -217,8 +217,7 @@
 }
 
 // Called back from vendor library when the a2dp offload machine has to report
-// status of
-// an a2dp offload command.
+// status of an a2dp offload command.
 static void a2dp_offload_cb(bt_vendor_op_result_t result, bt_vendor_opcode_t op,
                             uint8_t bta_av_handle) {
   tBTA_AV_STATUS status = (result == BT_VND_OP_RESULT_SUCCESS)
diff --git a/main/bte_logmsg.cc b/main/bte_logmsg.cc
index 32c99d3..e8d1bd6 100644
--- a/main/bte_logmsg.cc
+++ b/main/bte_logmsg.cc
@@ -186,7 +186,8 @@
       LOG_DEBUG(bt_layer_tags[trace_layer], "%s", buffer);
       break;
     default:
-      LOG_ERROR(bt_layer_tags[trace_layer], "%s", buffer);      /* we should never get this */
+      /* we should never get this */
+      LOG_ERROR(bt_layer_tags[trace_layer], "%s", buffer);
       break;
   }
 }
diff --git a/osi/include/array.h b/osi/include/array.h
index fa05d87..ecbb1bc 100644
--- a/osi/include/array.h
+++ b/osi/include/array.h
@@ -29,10 +29,8 @@
 typedef struct array_t array_t;
 
 // Returns a new array object that stores elements of size |element_size|. The
-// returned
-// object must be freed with |array_free|. |element_size| must be greater than
-// 0. Returns
-// NULL on failure.
+// returned object must be freed with |array_free|. |element_size| must be
+// greater than 0. Returns NULL on failure.
 array_t* array_new(size_t element_size);
 
 // Frees an array that was allocated with |array_new|. |array| may be NULL.
@@ -43,8 +41,7 @@
 void* array_ptr(const array_t* array);
 
 // Returns a pointer to the |index|th element of |array|. |index| must be less
-// than
-// the array's length. |array| must not be NULL.
+// than the array's length. |array| must not be NULL.
 void* array_at(const array_t* array, size_t index);
 
 // Returns the number of elements stored in |array|. |array| must not be NULL.
@@ -60,10 +57,8 @@
 
 // Inserts an element to the end of |array|. The value pointed to by |data| must
 // be at least |element_size| bytes long and will be copied into the array.
-// Neither
-// |array| nor |data| may be NULL. Returns true if the element could be inserted
-// into
-// the array, false on error.
+// Neither |array| nor |data| may be NULL. Returns true if the element could be
+// inserted into the array, false on error.
 bool array_append_ptr(array_t* array, void* data);
 
 #ifdef __cplusplus
diff --git a/osi/include/buffer.h b/osi/include/buffer.h
index 211f0d6..6589c70 100644
--- a/osi/include/buffer.h
+++ b/osi/include/buffer.h
@@ -36,8 +36,7 @@
 // from the original: writes to the original will be reflected in the reference
 // and vice versa. In other words, this function creates an alias to |buf|. The
 // caller must release the returned buffer with |buffer_free|. Note that
-// releasing
-// the returned buffer does not release |buf|. |buf| must not be NULL.
+// releasing the returned buffer does not release |buf|. |buf| must not be NULL.
 buffer_t* buffer_new_ref(const buffer_t* buf);
 
 // Creates a new reference to the last |slice_size| bytes of |buf|. See
diff --git a/osi/include/config.h b/osi/include/config.h
index 2243c27..1480151 100644
--- a/osi/include/config.h
+++ b/osi/include/config.h
@@ -123,19 +123,14 @@
 // The returned pointer must be treated as an opaque handle and must not be
 // freed.
 // The iterator is invalidated on any config mutating operation. |config| may
-// not
-// be NULL.
+// not be NULL.
 const config_section_node_t* config_section_begin(const config_t* config);
 
 // Returns an iterator to one past the last section in the config file. It does
-// not
-// represent a valid section, but can be used to determine if all sections have
-// been
-// iterated over. The returned pointer must be treated as an opaque handle and
-// must
-// not be freed and must not be iterated on (must not call |config_section_next|
-// on
-// it). |config| may not be NULL.
+// not represent a valid section, but can be used to determine if all sections
+// have been iterated over. The returned pointer must be treated as an opaque
+// handle and must not be freed and must not be iterated on (must not call
+// |config_section_next| on it). |config| may not be NULL.
 const config_section_node_t* config_section_end(const config_t* config);
 
 // Moves |iter| to the next section. If there are no more sections, |iter| will
@@ -145,24 +140,17 @@
     const config_section_node_t* iter);
 
 // Returns the name of the section referred to by |iter|. The returned pointer
-// is
-// owned by the config module and must not be freed by the caller. The pointer
-// will
-// remain valid until |config_free| is called. |iter| may not be NULL and must
-// not
-// equal the value returned by |config_section_end|.
+// is owned by the config module and must not be freed by the caller. The
+// pointer will remain valid until |config_free| is called. |iter| may not be
+// NULL and must not equal the value returned by |config_section_end|.
 const char* config_section_name(const config_section_node_t* iter);
 
 // Saves |config| to a file given by |filename|. Note that this could be a
-// destructive
-// operation: if |filename| already exists, it will be overwritten. The config
-// module does not preserve comments or formatting so if a config file was
-// opened
-// with |config_new| and subsequently overwritten with |config_save|, all
-// comments
-// and special formatting in the original file will be lost. Neither |config|
-// nor
-// |filename| may be NULL.
+// destructive operation: if |filename| already exists, it will be overwritten.
+// The config module does not preserve comments or formatting so if a config
+// file was opened with |config_new| and subsequently overwritten with
+// |config_save|, all comments and special formatting in the original file will
+// be lost. Neither |config| nor |filename| may be NULL.
 bool config_save(const config_t* config, const char* filename);
 
 #ifdef __cplusplus
diff --git a/osi/include/eager_reader.h b/osi/include/eager_reader.h
index ad4887b..6b8b25f 100644
--- a/osi/include/eager_reader.h
+++ b/osi/include/eager_reader.h
@@ -37,10 +37,9 @@
 // Creates a new eager reader object, which pulls data from |fd_to_read| into
 // buffers of size |buffer_size| allocated using |allocator|, and has an
 // internal read thread named |thread_name|. The returned object must be freed
-// using
-// |eager_reader_free|. |fd_to_read| must be valid, |buffer_size| and
-// |max_buffer_count|
-// must be greater than zero. |allocator| and |thread_name| may not be NULL.
+// using |eager_reader_free|. |fd_to_read| must be valid, |buffer_size| and
+// |max_buffer_count| must be greater than zero. |allocator| and |thread_name|
+// may not be NULL.
 eager_reader_t* eager_reader_new(int fd_to_read, const allocator_t* allocator,
                                  size_t buffer_size, size_t max_buffer_count,
                                  const char* thread_name);
@@ -58,8 +57,7 @@
                            eager_reader_cb read_cb, void* context);
 
 // Unregisters |reader| from whichever reactor it is registered with, if any.
-// This
-// function is idempotent.
+// This function is idempotent.
 void eager_reader_unregister(eager_reader_t* reader);
 
 // Reads up to |max_size| bytes into |buffer| from currently available bytes.
diff --git a/osi/include/fixed_queue.h b/osi/include/fixed_queue.h
index c067e63..dd8a273 100644
--- a/osi/include/fixed_queue.h
+++ b/osi/include/fixed_queue.h
@@ -126,12 +126,9 @@
 int fixed_queue_get_dequeue_fd(const fixed_queue_t* queue);
 
 // Registers |queue| with |reactor| for dequeue operations. When there is an
-// element
-// in the queue, ready_cb will be called. The |context| parameter is passed,
-// untouched,
-// to the callback routine. Neither |queue|, nor |reactor|, nor |read_cb| may be
-// NULL.
-// |context| may be NULL.
+// element in the queue, ready_cb will be called. The |context| parameter is
+// passed, untouched, to the callback routine. Neither |queue|, nor |reactor|,
+// nor |read_cb| may be NULL. |context| may be NULL.
 void fixed_queue_register_dequeue(fixed_queue_t* queue, reactor_t* reactor,
                                   fixed_queue_cb ready_cb, void* context);
 
diff --git a/osi/include/list.h b/osi/include/list.h
index 1ecded9..e38977b 100644
--- a/osi/include/list.h
+++ b/osi/include/list.h
@@ -40,15 +40,11 @@
 typedef bool (*list_iter_cb)(void* data, void* context);
 
 // Returns a new, empty list. Returns NULL if not enough memory could be
-// allocated
-// for the list structure. The returned list must be freed with |list_free|. The
-// |callback| specifies a function to be called whenever a list element is
-// removed
-// from the list. It can be used to release resources held by the list element,
-// e.g.
-// memory or file descriptor. |callback| may be NULL if no cleanup is necessary
-// on
-// element removal.
+// allocated for the list structure. The returned list must be freed with
+// |list_free|. The |callback| specifies a function to be called whenever a
+// list element is removed from the list. It can be used to release resources
+// held by the list element, e.g. memory or file descriptor. |callback| may
+// be NULL if no cleanup is necessary on element removal.
 list_t* list_new(list_free_cb callback);
 
 // Frees the list. This function accepts NULL as an argument, in which case it
@@ -103,12 +99,9 @@
 // Removes |data| from the list. Neither |list| nor |data| may be NULL. If
 // |data|
 // is inserted multiple times in the list, this function will only remove the
-// first
-// instance. If a free function was specified in |list_new|, it will be called
-// back
-// with |data|. This function returns true if |data| was found in the list and
-// removed,
-// false otherwise.
+// first instance. If a free function was specified in |list_new|, it will be
+// called back with |data|. This function returns true if |data| was found in
+// the list and removed, false otherwise.
 bool list_remove(list_t* list, void* data);
 
 // Removes all elements in the list. Calling this function will return the list
@@ -117,25 +110,20 @@
 void list_clear(list_t* list);
 
 // Iterates through the |list| and calls |callback| for each data element.
-// Iteration
-// continues until |callback| returns false. The function returns the pointer to
-// last
-// processed element, or NULL if the list is empty, or all calls to |callback|
-// returned
-// true. |context| is passed to |callback| on each iteration.
+// Iteration continues until |callback| returns false. The function returns the
+// pointer to last processed element, or NULL if the list is empty, or all calls
+// to |callback| returned true. |context| is passed to |callback| on each
+// iteration.
 // If the list is empty, |callback| will never be called. It is safe to mutate
-// the
-// list inside the callback. If an element is added before the node being
-// visited,
-// there will be no callback for the newly-inserted node. Neither |list| nor
-// |callback| may be NULL.
+// the list inside the callback. If an element is added before the node being
+// visited, there will be no callback for the newly-inserted node. Neither
+// |list| nor |callback| may be NULL.
 list_node_t* list_foreach(const list_t* list, list_iter_cb callback,
                           void* context);
 
 // Returns an iterator to the first element in |list|. |list| may not be NULL.
 // The returned iterator is valid as long as it does not equal the value
-// returned
-// by |list_end|.
+// returned by |list_end|.
 list_node_t* list_begin(const list_t* list);
 
 // Returns an iterator that points past the end of the list. In other words,
diff --git a/osi/include/reactor.h b/osi/include/reactor.h
index d3eca37..28af1f4 100644
--- a/osi/include/reactor.h
+++ b/osi/include/reactor.h
@@ -49,13 +49,11 @@
 void reactor_free(reactor_t* reactor);
 
 // Starts the reactor. This function blocks the caller until |reactor_stop| is
-// called
-// from another thread or in a callback. |reactor| may not be NULL.
+// called from another thread or in a callback. |reactor| may not be NULL.
 reactor_status_t reactor_start(reactor_t* reactor);
 
 // Runs one iteration of the reactor. This function blocks until at least one
-// registered object
-// becomes ready. |reactor| may not be NULL.
+// registered object becomes ready. |reactor| may not be NULL.
 reactor_status_t reactor_run_once(reactor_t* reactor);
 
 // Immediately unblocks the reactor. This function is safe to call from any
@@ -64,42 +62,32 @@
 void reactor_stop(reactor_t* reactor);
 
 // Registers a file descriptor with the reactor. The file descriptor, |fd|, must
-// be valid
-// when this function is called and its ownership is not transferred to the
-// reactor. The
-// |context| variable is a user-defined opaque handle that is passed back to the
-// |read_ready|
-// and |write_ready| functions. It is not copied or even dereferenced by the
-// reactor so it
-// may contain any value including NULL. The |read_ready| and |write_ready|
-// arguments are
-// optional and may be NULL. This function returns an opaque object that
-// represents the
-// file descriptor's registration with the reactor. When the caller is no longer
-// interested
-// in events on the |fd|, it must free the returned object by calling
+// be valid when this function is called and its ownership is not transferred
+// to the reactor. The |context| variable is a user-defined opaque handle that
+// is passed back to the |read_ready| and |write_ready| functions. It is not
+// copied or even dereferenced by the reactor so it may contain any value
+// including NULL. The |read_ready| and |write_ready| arguments are optional and
+// may be NULL. This function returns an opaque object that represents the file
+// descriptor's registration with the reactor. When the caller is no longer
+// interested in events on the |fd|, it must free the returned object by calling
 // |reactor_unregister|.
 reactor_object_t* reactor_register(reactor_t* reactor, int fd, void* context,
                                    void (*read_ready)(void* context),
                                    void (*write_ready)(void* context));
 
 // Changes the subscription mode for the file descriptor represented by
-// |object|. If the
-// caller has already registered a file descriptor with a reactor, has a valid
-// |object|,
-// and decides to change the |read_ready| and/or |write_ready| callback
-// routines, they
-// can call this routine. Returns true if the subscription was changed, false
-// otherwise.
+// |object|. If the caller has already registered a file descriptor with a
+// reactor, has a valid |object|, and decides to change the |read_ready| and/or
+// |write_ready| callback routines, they can call this routine. Returns true if
+// the subscription was changed, false otherwise.
 // |object| may not be NULL, |read_ready| and |write_ready| may be NULL.
 bool reactor_change_registration(reactor_object_t* object,
                                  void (*read_ready)(void* context),
                                  void (*write_ready)(void* context));
 
 // Unregisters a previously registered file descriptor with its reactor. |obj|
-// may not be NULL.
-// |obj| is invalid after calling this function so the caller must drop all
-// references to it.
+// may not be NULL. |obj| is invalid after calling this function so the caller
+// must drop all references to it.
 void reactor_unregister(reactor_object_t* obj);
 
 #ifdef __cplusplus
diff --git a/osi/include/semaphore.h b/osi/include/semaphore.h
index 29d03fd..a3d47ad 100644
--- a/osi/include/semaphore.h
+++ b/osi/include/semaphore.h
@@ -42,8 +42,7 @@
 
 // Tries to decrement the value of |semaphore|. Returns true if the value was
 // decremented, false if the value was 0. This function never blocks.
-// |semaphore|
-// may not be NULL.
+// |semaphore| may not be NULL.
 bool semaphore_try_wait(semaphore_t* semaphore);
 
 // Increments the value of |semaphore|. |semaphore| may not be NULL.
diff --git a/osi/include/socket.h b/osi/include/socket.h
index e5d4c8e..5b360b9 100644
--- a/osi/include/socket.h
+++ b/osi/include/socket.h
@@ -34,22 +34,19 @@
 typedef void (*socket_cb)(socket_t* socket, void* context);
 
 // Returns a new socket object. The socket is in an idle, disconnected state
-// when
-// it is returned by this function. The returned object must be freed by calling
-// |socket_free|. Returns NULL on failure.
+// when it is returned by this function. The returned object must be freed by
+// calling |socket_free|. Returns NULL on failure.
 socket_t* socket_new(void);
 
 // Returns a new socket object backed by |fd|. The socket object is in whichever
 // state |fd| is in when it was passed to this function. The returned object
-// must
-// be freed by calling |socket_free|. Returns NULL on failure. If this function
-// is successful, ownership of |fd| is transferred and the caller must not close
-// it.
+// must be freed by calling |socket_free|. Returns NULL on failure. If this
+// function is successful, ownership of |fd| is transferred and the caller must
+// not close it.
 socket_t* socket_new_from_fd(int fd);
 
 // Frees a socket object created by |socket_new| or |socket_accept|. |socket|
-// may
-// be NULL. If the socket was connected, it will be disconnected.
+// may be NULL. If the socket was connected, it will be disconnected.
 void socket_free(socket_t* socket);
 
 // Puts |socket| in listening mode for incoming TCP connections on the specified
@@ -58,9 +55,8 @@
 bool socket_listen(const socket_t* socket, port_t port);
 
 // Blocks on a listening socket, |socket|, until a client connects to it.
-// Returns
-// a connected socket on success, NULL on failure. The returned object must be
-// freed by calling |socket_free|. |socket| may not be NULL.
+// Returns a connected socket on success, NULL on failure. The returned object
+// must be freed by calling |socket_free|. |socket| may not be NULL.
 socket_t* socket_accept(const socket_t* socket);
 
 // Reads up to |count| bytes from |socket| into |buf|. This function will not
@@ -90,38 +86,30 @@
 // This function performs the same write operation as |socket_write| and also
 // sends the file descriptor |fd| over the socket to a remote process. Ownership
 // of |fd| transfers to this function and the descriptor must not be used any
-// longer.
-// If |fd| is INVALID_FD, this function behaves the same as |socket_write|.
+// longer. If |fd| is INVALID_FD, this function behaves the same as
+// |socket_write|.
 ssize_t socket_write_and_transfer_fd(const socket_t* socket, const void* buf,
                                      size_t count, int fd);
 
 // Returns the number of bytes that can be read from |socket| without blocking.
-// On error,
-// this function returns -1. |socket| may not be NULL.
+// On error, this function returns -1. |socket| may not be NULL.
 //
 // Note: this function should not be part of the socket interface. It is only
-// provided as
-//       a stop-gap until we can refactor away code that depends on a priori
-//       knowledge of
-//       the byte count. Do not use this function unless you need it while
-//       refactoring
-//       legacy bluedroid code.
+//       provided as a stop-gap until we can refactor away code that depends on
+//       a priori knowledge of the byte count. Do not use this function unless
+//       you need it while refactoring legacy bluedroid code.
 ssize_t socket_bytes_available(const socket_t* socket);
 
 // Registers |socket| with the |reactor|. When the socket becomes readable,
-// |read_cb|
-// will be called. When the socket becomes writeable, |write_cb| will be called.
-// The
-// |context| parameter is passed, untouched, to each of the callback routines.
-// Neither
-// |socket| nor |reactor| may be NULL. |read_cb|, |write_cb|, and |context| may
-// be NULL.
+// |read_cb| will be called. When the socket becomes writeable, |write_cb| will
+// be called. The |context| parameter is passed, untouched, to each of the
+// callback routines. Neither |socket| nor |reactor| may be NULL. |read_cb|,
+// |write_cb|, and |context| may be NULL.
 void socket_register(socket_t* socket, reactor_t* reactor, void* context,
                      socket_cb read_cb, socket_cb write_cb);
 
 // Unregisters |socket| from whichever reactor it is registered with, if any.
-// This
-// function is idempotent.
+// This function is idempotent.
 void socket_unregister(socket_t* socket);
 
 #ifdef __cplusplus
diff --git a/service/client/main.cc b/service/client/main.cc
index 442b751..9f9947d 100644
--- a/service/client/main.cc
+++ b/service/client/main.cc
@@ -98,8 +98,8 @@
 std::atomic_bool ble_registering(false);
 std::atomic_int ble_client_id(0);
 
-// The registered IBluetoothLeAdvertiser handle. If |ble_advertiser_registering| is
-// true then an operation to register the advertiser is in progress.
+// The registered IBluetoothLeAdvertiser handle. If |ble_advertiser_registering|
+// is true then an operation to register the advertiser is in progress.
 std::atomic_bool ble_advertiser_registering(false);
 std::atomic_int ble_advertiser_id(0);
 
diff --git a/service/ipc/binder/bluetooth_binder_server.h b/service/ipc/binder/bluetooth_binder_server.h
index 5bb794e..45cb018 100644
--- a/service/ipc/binder/bluetooth_binder_server.h
+++ b/service/ipc/binder/bluetooth_binder_server.h
@@ -101,8 +101,8 @@
   // first call to GetLowEnergyInterface().
   android::sp<IBluetoothLowEnergy> low_energy_interface_;
 
-  // The IBluetoothLeAdvertiser interface handle. This is lazily initialized on the
-  // first call to GetLeAdvertiserInterface().
+  // The IBluetoothLeAdvertiser interface handle. This is lazily initialized on
+  // the first call to GetLeAdvertiserInterface().
   android::sp<IBluetoothLeAdvertiser> le_advertiser_interface_;
 
   // The IBluetoothLeScanner interface handle. This is lazily initialized on the
diff --git a/stack/avct/avct_api.cc b/stack/avct/avct_api.cc
index 8359b50..d33bee4 100644
--- a/stack/avct/avct_api.cc
+++ b/stack/avct/avct_api.cc
@@ -121,7 +121,8 @@
  *                  create an initiator connection, an AVCTP connection to
  *                  the peer device is initiated if one does not already exist.
  *                  If an acceptor connection is created, the connection waits
- *                  passively for an incoming AVCTP connection from a peer device.
+ *                  passively for an incoming AVCTP connection from a peer
+ *                  device.
  *
  *
  * Returns          AVCT_SUCCESS if successful, otherwise error.
@@ -229,7 +230,8 @@
  *                  create an initiator connection, the Browse channel to
  *                  the peer device is initiated if one does not already exist.
  *                  If an acceptor connection is created, the connection waits
- *                  passively for an incoming AVCTP connection from a peer device.
+ *                  passively for an incoming AVCTP connection from a peer
+ *                  device.
  *
  *
  * Returns          AVCT_SUCCESS if successful, otherwise error.
@@ -299,10 +301,10 @@
  *
  * Function         AVCT_RemoveBrowse
  *
- * Description      Remove an AVCTP Browse channel.  This function is called when
- *                  the application is no longer using a connection.  If this
- *                  is the last connection to a peer the L2CAP channel for AVCTP
- *                  will be closed.
+ * Description      Remove an AVCTP Browse channel.  This function is called
+ *                  when the application is no longer using a connection.  If
+ *                  this is the last connection to a peer the L2CAP channel for
+ *                  AVCTP will be closed.
  *
  *
  * Returns          AVCT_SUCCESS if successful, otherwise error.
@@ -393,8 +395,9 @@
  *                  application calls AVCT_MsgReq() when AVCTP is congested
  *                  the message may be discarded.  The application may make its
  *                  first call to AVCT_MsgReq() after it receives an
- *                  AVCT_CONNECT_CFM_EVT or AVCT_CONNECT_IND_EVT on control channel or
- *                  AVCT_BROWSE_CONN_CFM_EVT or AVCT_BROWSE_CONN_IND_EVT on browsing channel.
+ *                  AVCT_CONNECT_CFM_EVT or AVCT_CONNECT_IND_EVT on control
+ *                  channel or AVCT_BROWSE_CONN_CFM_EVT or
+ *                  AVCT_BROWSE_CONN_IND_EVT on browsing channel.
  *
  *                  p_msg->layer_specific must be set to
  *                  AVCT_DATA_CTRL for control channel traffic;
diff --git a/stack/avct/avct_bcb_act.cc b/stack/avct/avct_bcb_act.cc
index cf4c99e..7e78402 100644
--- a/stack/avct/avct_bcb_act.cc
+++ b/stack/avct/avct_bcb_act.cc
@@ -144,9 +144,10 @@
  * Function         avct_bcb_open_ind
  *
  * Description      Handle an LL_OPEN event.
- *                  For the allocated ccb already bound to the bcb, send a connect event.
- *                  For the unbound ccb with a new PID, bind that ccb to the bcb with the
- *                  same bd_addr and send a connect event.
+ *                  For the allocated ccb already bound to the bcb, send a
+ *                  connect event. For the unbound ccb with a new PID, bind that
+ *                  ccb to the bcb with the same bd_addr and send a connect
+ *                  event.
  *
  *
  * Returns          Nothing.
@@ -286,7 +287,8 @@
 {
     tAVCT_CCB           *p_ccb = &avct_cb.ccb[0];
     uint8_t               event = 0;
-    bool             ch_close = p_bcb->ch_close;    /* Whether BCB initiated channel close */
+    /* Whether BCB initiated channel close */
+    bool             ch_close = p_bcb->ch_close;
     tAVCT_CTRL_CBACK    *p_cback;
 
     p_bcb->ch_close = false;
diff --git a/stack/avct/avct_l2c_br.cc b/stack/avct/avct_l2c_br.cc
index f1429d1..a6c326c 100644
--- a/stack/avct/avct_l2c_br.cc
+++ b/stack/avct/avct_l2c_br.cc
@@ -38,8 +38,8 @@
 #define AVCT_L2C_CFG_CFM_DONE   (1<<1)
 
 /* AVCTP Browsing channel FCR Option:
- * Size of the transmission window when using enhanced retransmission mode. Not used
- * in basic and streaming modes. Range: 1 - 63
+ * Size of the transmission window when using enhanced retransmission mode. Not
+ * used in basic and streaming modes. Range: 1 - 63
  */
 #define AVCT_BR_FCR_OPT_TX_WINDOW_SIZE      10
 
@@ -55,14 +55,16 @@
 
 /* AVCTP Browsing channel FCR Option: Retransmission Timeout
  * The AVRCP specification set a value in the range of 300 - 2000 ms
- * Timeout (in msecs) to detect Lost I-Frames. Only used in Enhanced retransmission mode.
+ * Timeout (in msecs) to detect Lost I-Frames. Only used in Enhanced
+ * retransmission mode.
  * Range: Minimum 2000 (2 secs) when supporting PBF.
  */
 #define AVCT_BR_FCR_OPT_RETX_TOUT           2000
 
 /* AVCTP Browsing channel FCR Option: Monitor Timeout
  * The AVRCP specification set a value in the range of 300 - 2000 ms
- * Timeout (in msecs) to detect Lost S-Frames. Only used in Enhanced retransmission mode.
+ * Timeout (in msecs) to detect Lost S-Frames. Only used in Enhanced
+ * retransmission mode.
  * Range: Minimum 12000 (12 secs) when supporting PBF.
  */
 #define AVCT_BR_FCR_OPT_MONITOR_TOUT        12000
diff --git a/stack/avct/avct_lcb.cc b/stack/avct/avct_lcb.cc
index 7db6f4b..2efe2bb 100644
--- a/stack/avct/avct_lcb.cc
+++ b/stack/avct/avct_lcb.cc
@@ -117,54 +117,54 @@
 
 /* state table for idle state */
 const uint8_t avct_lcb_st_idle[][AVCT_LCB_NUM_COLS] = {
-/* Event                Action 1                    Action 2                    Next state */
-/* UL_BIND_EVT */       {AVCT_LCB_CHNL_OPEN,        AVCT_LCB_IGNORE,            AVCT_LCB_OPENING_ST},
-/* UL_UNBIND_EVT */     {AVCT_LCB_UNBIND_DISC,      AVCT_LCB_IGNORE,            AVCT_LCB_IDLE_ST},
-/* UL_MSG_EVT */        {AVCT_LCB_DISCARD_MSG,      AVCT_LCB_IGNORE,            AVCT_LCB_IDLE_ST},
-/* INT_CLOSE_EVT */     {AVCT_LCB_IGNORE,           AVCT_LCB_IGNORE,            AVCT_LCB_IDLE_ST},
-/* LL_OPEN_EVT */       {AVCT_LCB_OPEN_IND,         AVCT_LCB_IGNORE,            AVCT_LCB_OPEN_ST},
-/* LL_CLOSE_EVT */      {AVCT_LCB_CLOSE_IND,        AVCT_LCB_DEALLOC,           AVCT_LCB_IDLE_ST},
-/* LL_MSG_EVT */        {AVCT_LCB_FREE_MSG_IND,     AVCT_LCB_IGNORE,            AVCT_LCB_IDLE_ST},
-/* LL_CONG_EVT */       {AVCT_LCB_IGNORE,           AVCT_LCB_IGNORE,            AVCT_LCB_IDLE_ST}
+/* Event        Action 1                Action 2             Next state */
+/* UL_BIND */   {AVCT_LCB_CHNL_OPEN,    AVCT_LCB_IGNORE,  AVCT_LCB_OPENING_ST},
+/* UL_UNBIND */ {AVCT_LCB_UNBIND_DISC,  AVCT_LCB_IGNORE,  AVCT_LCB_IDLE_ST},
+/* UL_MSG */    {AVCT_LCB_DISCARD_MSG,  AVCT_LCB_IGNORE,  AVCT_LCB_IDLE_ST},
+/* INT_CLOSE */ {AVCT_LCB_IGNORE,       AVCT_LCB_IGNORE,  AVCT_LCB_IDLE_ST},
+/* LL_OPEN */   {AVCT_LCB_OPEN_IND,     AVCT_LCB_IGNORE,  AVCT_LCB_OPEN_ST},
+/* LL_CLOSE */  {AVCT_LCB_CLOSE_IND,    AVCT_LCB_DEALLOC, AVCT_LCB_IDLE_ST},
+/* LL_MSG */    {AVCT_LCB_FREE_MSG_IND, AVCT_LCB_IGNORE,  AVCT_LCB_IDLE_ST},
+/* LL_CONG */   {AVCT_LCB_IGNORE,       AVCT_LCB_IGNORE,  AVCT_LCB_IDLE_ST}
 };
 
 /* state table for opening state */
 const uint8_t avct_lcb_st_opening[][AVCT_LCB_NUM_COLS] = {
-/* Event                Action 1                    Action 2                    Next state */
-/* UL_BIND_EVT */       {AVCT_LCB_IGNORE,           AVCT_LCB_IGNORE,            AVCT_LCB_OPENING_ST},
-/* UL_UNBIND_EVT */     {AVCT_LCB_UNBIND_DISC,      AVCT_LCB_IGNORE,            AVCT_LCB_OPENING_ST},
-/* UL_MSG_EVT */        {AVCT_LCB_DISCARD_MSG,      AVCT_LCB_IGNORE,            AVCT_LCB_OPENING_ST},
-/* INT_CLOSE_EVT */     {AVCT_LCB_CHNL_DISC,        AVCT_LCB_IGNORE,            AVCT_LCB_CLOSING_ST},
-/* LL_OPEN_EVT */       {AVCT_LCB_OPEN_IND,         AVCT_LCB_IGNORE,            AVCT_LCB_OPEN_ST},
-/* LL_CLOSE_EVT */      {AVCT_LCB_OPEN_FAIL,        AVCT_LCB_DEALLOC,           AVCT_LCB_IDLE_ST},
-/* LL_MSG_EVT */        {AVCT_LCB_FREE_MSG_IND,     AVCT_LCB_IGNORE,            AVCT_LCB_OPENING_ST},
-/* LL_CONG_EVT */       {AVCT_LCB_CONG_IND,         AVCT_LCB_IGNORE,            AVCT_LCB_OPENING_ST}
+/* Event        Action 1                Action 2             Next state */
+/* UL_BIND */   {AVCT_LCB_IGNORE,       AVCT_LCB_IGNORE,   AVCT_LCB_OPENING_ST},
+/* UL_UNBIND */ {AVCT_LCB_UNBIND_DISC,  AVCT_LCB_IGNORE,   AVCT_LCB_OPENING_ST},
+/* UL_MSG */    {AVCT_LCB_DISCARD_MSG,  AVCT_LCB_IGNORE,   AVCT_LCB_OPENING_ST},
+/* INT_CLOSE */ {AVCT_LCB_CHNL_DISC,    AVCT_LCB_IGNORE,   AVCT_LCB_CLOSING_ST},
+/* LL_OPEN */   {AVCT_LCB_OPEN_IND,     AVCT_LCB_IGNORE,   AVCT_LCB_OPEN_ST},
+/* LL_CLOSE */  {AVCT_LCB_OPEN_FAIL,    AVCT_LCB_DEALLOC,  AVCT_LCB_IDLE_ST},
+/* LL_MSG */    {AVCT_LCB_FREE_MSG_IND, AVCT_LCB_IGNORE,   AVCT_LCB_OPENING_ST},
+/* LL_CONG */   {AVCT_LCB_CONG_IND,     AVCT_LCB_IGNORE,   AVCT_LCB_OPENING_ST}
 };
 
 /* state table for open state */
 const uint8_t avct_lcb_st_open[][AVCT_LCB_NUM_COLS] = {
-/* Event                Action 1                    Action 2                    Next state */
-/* UL_BIND_EVT */       {AVCT_LCB_BIND_CONN,        AVCT_LCB_IGNORE,            AVCT_LCB_OPEN_ST},
-/* UL_UNBIND_EVT */     {AVCT_LCB_CHK_DISC,         AVCT_LCB_IGNORE,            AVCT_LCB_OPEN_ST},
-/* UL_MSG_EVT */        {AVCT_LCB_SEND_MSG,         AVCT_LCB_IGNORE,            AVCT_LCB_OPEN_ST},
-/* INT_CLOSE_EVT */     {AVCT_LCB_CHNL_DISC,        AVCT_LCB_IGNORE,            AVCT_LCB_CLOSING_ST},
-/* LL_OPEN_EVT */       {AVCT_LCB_IGNORE,           AVCT_LCB_IGNORE,            AVCT_LCB_OPEN_ST},
-/* LL_CLOSE_EVT */      {AVCT_LCB_CLOSE_IND,        AVCT_LCB_DEALLOC,           AVCT_LCB_IDLE_ST},
-/* LL_MSG_EVT */        {AVCT_LCB_MSG_IND,          AVCT_LCB_IGNORE,            AVCT_LCB_OPEN_ST},
-/* LL_CONG_EVT */       {AVCT_LCB_CONG_IND,         AVCT_LCB_IGNORE,            AVCT_LCB_OPEN_ST}
+/* Event         Action 1             Action 2             Next state */
+/* UL_BIND */   {AVCT_LCB_BIND_CONN,  AVCT_LCB_IGNORE,     AVCT_LCB_OPEN_ST},
+/* UL_UNBIND */ {AVCT_LCB_CHK_DISC,   AVCT_LCB_IGNORE,     AVCT_LCB_OPEN_ST},
+/* UL_MSG */    {AVCT_LCB_SEND_MSG,   AVCT_LCB_IGNORE,     AVCT_LCB_OPEN_ST},
+/* INT_CLOSE */ {AVCT_LCB_CHNL_DISC,  AVCT_LCB_IGNORE,     AVCT_LCB_CLOSING_ST},
+/* LL_OPEN */   {AVCT_LCB_IGNORE,     AVCT_LCB_IGNORE,     AVCT_LCB_OPEN_ST},
+/* LL_CLOSE */  {AVCT_LCB_CLOSE_IND,  AVCT_LCB_DEALLOC,    AVCT_LCB_IDLE_ST},
+/* LL_MSG */    {AVCT_LCB_MSG_IND,    AVCT_LCB_IGNORE,     AVCT_LCB_OPEN_ST},
+/* LL_CONG */   {AVCT_LCB_CONG_IND,   AVCT_LCB_IGNORE,     AVCT_LCB_OPEN_ST}
 };
 
 /* state table for closing state */
 const uint8_t avct_lcb_st_closing[][AVCT_LCB_NUM_COLS] = {
-/* Event                Action 1                    Action 2                    Next state */
-/* UL_BIND_EVT */       {AVCT_LCB_BIND_FAIL,        AVCT_LCB_IGNORE,            AVCT_LCB_CLOSING_ST},
-/* UL_UNBIND_EVT */     {AVCT_LCB_IGNORE,           AVCT_LCB_IGNORE,            AVCT_LCB_CLOSING_ST},
-/* UL_MSG_EVT */        {AVCT_LCB_DISCARD_MSG,      AVCT_LCB_IGNORE,            AVCT_LCB_CLOSING_ST},
-/* INT_CLOSE_EVT */     {AVCT_LCB_IGNORE,           AVCT_LCB_IGNORE,            AVCT_LCB_CLOSING_ST},
-/* LL_OPEN_EVT */       {AVCT_LCB_IGNORE,           AVCT_LCB_IGNORE,            AVCT_LCB_CLOSING_ST},
-/* LL_CLOSE_EVT */      {AVCT_LCB_CLOSE_CFM,        AVCT_LCB_DEALLOC,           AVCT_LCB_IDLE_ST},
-/* LL_MSG_EVT */        {AVCT_LCB_FREE_MSG_IND,     AVCT_LCB_IGNORE,            AVCT_LCB_CLOSING_ST},
-/* LL_CONG_EVT */       {AVCT_LCB_IGNORE,           AVCT_LCB_IGNORE,            AVCT_LCB_CLOSING_ST}
+/* Event         Action 1               Action 2          Next state */
+/* UL_BIND */   {AVCT_LCB_BIND_FAIL,    AVCT_LCB_IGNORE,  AVCT_LCB_CLOSING_ST},
+/* UL_UNBIND */ {AVCT_LCB_IGNORE,       AVCT_LCB_IGNORE,  AVCT_LCB_CLOSING_ST},
+/* UL_MSG */    {AVCT_LCB_DISCARD_MSG,  AVCT_LCB_IGNORE,  AVCT_LCB_CLOSING_ST},
+/* INT_CLOSE */ {AVCT_LCB_IGNORE,       AVCT_LCB_IGNORE,  AVCT_LCB_CLOSING_ST},
+/* LL_OPEN */   {AVCT_LCB_IGNORE,       AVCT_LCB_IGNORE,  AVCT_LCB_CLOSING_ST},
+/* LL_CLOSE */  {AVCT_LCB_CLOSE_CFM,    AVCT_LCB_DEALLOC, AVCT_LCB_IDLE_ST},
+/* LL_MSG */    {AVCT_LCB_FREE_MSG_IND, AVCT_LCB_IGNORE,  AVCT_LCB_CLOSING_ST},
+/* LL_CONG */   {AVCT_LCB_IGNORE,       AVCT_LCB_IGNORE,  AVCT_LCB_CLOSING_ST}
 };
 
 /* type for state table */
diff --git a/stack/avdt/avdt_ad.cc b/stack/avdt/avdt_ad.cc
index 5521492..cebc5e9 100644
--- a/stack/avdt/avdt_ad.cc
+++ b/stack/avdt/avdt_ad.cc
@@ -502,8 +502,9 @@
  *                  passes the data to L2CA_DataWrite().
  *
  *
- * Returns          AVDT_AD_SUCCESS, if data accepted, else false
- *                  AVDT_AD_CONGESTED, if data accepted and the channel is congested
+ * Returns          AVDT_AD_SUCCESS, if data accepted
+ *                  AVDT_AD_CONGESTED, if data accepted and the channel is
+ *                                     congested
  *                  AVDT_AD_FAILED, if error
  *
  ******************************************************************************/
diff --git a/stack/avdt/avdt_api.cc b/stack/avdt/avdt_api.cc
index b2f3fd5..28b8b7e 100644
--- a/stack/avdt/avdt_api.cc
+++ b/stack/avdt/avdt_api.cc
@@ -128,7 +128,8 @@
  * Description      This function is called to deregister use AVDTP protocol.
  *                  It is called when AVDTP is no longer being used by any
  *                  application in the system.  Before this function can be
- *                  called, all streams must be removed with AVDT_RemoveStream().
+ *                  called, all streams must be removed with
+ *                  AVDT_RemoveStream().
  *
  *
  * Returns          void
@@ -233,8 +234,8 @@
  *                  on the peer device, if not already present, and discovers
  *                  the stream endpoints on the peer device.  (Please note
  *                  that AVDTP discovery is unrelated to SDP discovery).
- *                  This function can be called at any time regardless of whether
- *                  there is an AVDTP connection to the peer device.
+ *                  This function can be called at any time regardless of
+ *                  whether there is an AVDTP connection to the peer device.
  *
  *                  When discovery is complete, an AVDT_DISCOVER_CFM_EVT
  *                  is sent to the application via its callback function.
@@ -452,7 +453,8 @@
  *                  on the peer device, if not already present, and connects
  *                  to a stream endpoint on a peer device.  When the connection
  *                  is completed, an AVDT_OPEN_CFM_EVT is sent to the
- *                  application via the control callback function for this handle.
+ *                  application via the control callback function for this
+ *                  handle.
  *
  * Returns          AVDT_SUCCESS if successful, otherwise error.
  *
@@ -563,7 +565,8 @@
  *                  transfer of media packets for the streams.  All stream
  *                  endpoints must previously be opened.  When the streams
  *                  are started, an AVDT_START_CFM_EVT is sent to the
- *                  application via the control callback function for each stream.
+ *                  application via the control callback function for each
+ *                  stream.
  *
  *
  * Returns          AVDT_SUCCESS if successful, otherwise error.
@@ -713,7 +716,8 @@
  *                  can only be called if the stream is opened but not started
  *                  or if the stream has been suspended.  When the procedure
  *                  is completed, an AVDT_RECONFIG_CFM_EVT is sent to the
- *                  application via the control callback function for this handle.
+ *                  application via the control callback function for this
+ *                  handle.
  *
  *
  * Returns          AVDT_SUCCESS if successful, otherwise error.
@@ -786,8 +790,8 @@
  * Description      Send a security request to the peer device.  When the
  *                  security procedure is completed, an AVDT_SECURITY_CFM_EVT
  *                  is sent to the application via the control callback function
- *                  for this handle.  (Please note that AVDTP security procedures
- *                  are unrelated to Bluetooth link level security.)
+ *                  for this handle.  (Please note that AVDTP security
+ *                  procedures are unrelated to Bluetooth link level security.)
  *
  *
  * Returns          AVDT_SUCCESS if successful, otherwise error.
@@ -872,7 +876,8 @@
  *                  to AVDT_WriteReq() after it receives an AVDT_START_CFM_EVT
  *                  or AVDT_START_IND_EVT.
  *
- *                  The application passes the packet using the BT_HDR structure.
+ *                  The application passes the packet using the BT_HDR
+ *                  structure.
  *                  This structure is described in section 2.1.  The offset
  *                  field must be equal to or greater than AVDT_MEDIA_OFFSET
  *                  (if NO_RTP is specified, L2CAP_MIN_OFFSET can be used).
@@ -932,7 +937,8 @@
  *                  to AVDT_WriteReq() after it receives an AVDT_START_CFM_EVT
  *                  or AVDT_START_IND_EVT.
  *
- *                  The application passes the packet using the BT_HDR structure.
+ *                  The application passes the packet using the BT_HDR
+ *                  structure.
  *                  This structure is described in section 2.1.  The offset
  *                  field must be equal to or greater than AVDT_MEDIA_OFFSET.
  *                  This allows enough space in the buffer for the L2CAP and
@@ -1069,7 +1075,8 @@
  *
  * Function         AVDT_GetSignalChannel
  *
- * Description      Get the L2CAP CID used by the signal channel of the given handle.
+ * Description      Get the L2CAP CID used by the signal channel of the given
+ *                  handle.
  *
  * Returns          CID if successful, otherwise 0.
  *
diff --git a/stack/avdt/avdt_ccb.cc b/stack/avdt/avdt_ccb.cc
index 3bfcec6..5fc06da 100644
--- a/stack/avdt/avdt_ccb.cc
+++ b/stack/avdt/avdt_ccb.cc
@@ -129,134 +129,250 @@
 
 /* state table for idle state */
 const uint8_t avdt_ccb_st_idle[][AVDT_CCB_NUM_COLS] = {
-/* Event                      Action 1                    Action 2                    Next state */
-/* API_DISCOVER_REQ_EVT */   {AVDT_CCB_SND_DISCOVER_CMD,  AVDT_CCB_CHAN_OPEN,         AVDT_CCB_OPENING_ST},
-/* API_GETCAP_REQ_EVT */     {AVDT_CCB_SND_GETCAP_CMD,    AVDT_CCB_CHAN_OPEN,         AVDT_CCB_OPENING_ST},
-/* API_START_REQ_EVT */      {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* API_SUSPEND_REQ_EVT */    {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* API_DISCOVER_RSP_EVT */   {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* API_GETCAP_RSP_EVT */     {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* API_START_RSP_EVT */      {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* API_SUSPEND_RSP_EVT */    {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* API_CONNECT_REQ_EVT */    {AVDT_CCB_SET_CONN,          AVDT_CCB_CHAN_OPEN,         AVDT_CCB_OPENING_ST},
-/* API_DISCONNECT_REQ_EVT */ {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* MSG_DISCOVER_CMD_EVT */   {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* MSG_GETCAP_CMD_EVT */     {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* MSG_START_CMD_EVT */      {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* MSG_SUSPEND_CMD_EVT */    {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* MSG_DISCOVER_RSP_EVT */   {AVDT_CCB_HDL_DISCOVER_RSP,  AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* MSG_GETCAP_RSP_EVT */     {AVDT_CCB_HDL_GETCAP_RSP,    AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* MSG_START_RSP_EVT */      {AVDT_CCB_HDL_START_RSP,     AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* MSG_SUSPEND_RSP_EVT */    {AVDT_CCB_HDL_SUSPEND_RSP,   AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* RCVRSP_EVT */             {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* SENDMSG_EVT */            {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* RET_TOUT_EVT */           {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* RSP_TOUT_EVT */           {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* IDLE_TOUT_EVT */          {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* UL_OPEN_EVT */            {AVDT_CCB_CHAN_OPEN,         AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* UL_CLOSE_EVT */           {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* LL_OPEN_EVT */            {AVDT_CCB_LL_OPENED,         AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
-/* LL_CLOSE_EVT */           {AVDT_CCB_LL_CLOSED,         AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* LL_CONG_EVT */            {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST}
+/* Event */
+/* Action 1                    Action 2                    Next state */
+/* API_DISCOVER_REQ_EVT */
+{AVDT_CCB_SND_DISCOVER_CMD,  AVDT_CCB_CHAN_OPEN,         AVDT_CCB_OPENING_ST},
+/* API_GETCAP_REQ_EVT */
+{AVDT_CCB_SND_GETCAP_CMD,    AVDT_CCB_CHAN_OPEN,         AVDT_CCB_OPENING_ST},
+/* API_START_REQ_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* API_SUSPEND_REQ_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* API_DISCOVER_RSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* API_GETCAP_RSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* API_START_RSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* API_SUSPEND_RSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* API_CONNECT_REQ_EVT */
+{AVDT_CCB_SET_CONN,          AVDT_CCB_CHAN_OPEN,         AVDT_CCB_OPENING_ST},
+/* API_DISCONNECT_REQ_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* MSG_DISCOVER_CMD_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* MSG_GETCAP_CMD_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* MSG_START_CMD_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* MSG_SUSPEND_CMD_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* MSG_DISCOVER_RSP_EVT */
+{AVDT_CCB_HDL_DISCOVER_RSP,  AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* MSG_GETCAP_RSP_EVT */
+{AVDT_CCB_HDL_GETCAP_RSP,    AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* MSG_START_RSP_EVT */
+{AVDT_CCB_HDL_START_RSP,     AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* MSG_SUSPEND_RSP_EVT */
+{AVDT_CCB_HDL_SUSPEND_RSP,   AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* RCVRSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* SENDMSG_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* RET_TOUT_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* RSP_TOUT_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* IDLE_TOUT_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* UL_OPEN_EVT */
+{AVDT_CCB_CHAN_OPEN,         AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* UL_CLOSE_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* LL_OPEN_EVT */
+{AVDT_CCB_LL_OPENED,         AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
+/* LL_CLOSE_EVT */
+{AVDT_CCB_LL_CLOSED,         AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* LL_CONG_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST}
 };
 
 /* state table for opening state */
 const uint8_t avdt_ccb_st_opening[][AVDT_CCB_NUM_COLS] = {
-/* Event                      Action 1                    Action 2                    Next state */
-/* API_DISCOVER_REQ_EVT */   {AVDT_CCB_SND_DISCOVER_CMD,  AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* API_GETCAP_REQ_EVT */     {AVDT_CCB_SND_GETCAP_CMD,    AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* API_START_REQ_EVT */      {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* API_SUSPEND_REQ_EVT */    {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* API_DISCOVER_RSP_EVT */   {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* API_GETCAP_RSP_EVT */     {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* API_START_RSP_EVT */      {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* API_SUSPEND_RSP_EVT */    {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* API_CONNECT_REQ_EVT */    {AVDT_CCB_SET_CONN,          AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* API_DISCONNECT_REQ_EVT */ {AVDT_CCB_SET_DISCONN,       AVDT_CCB_DO_DISCONN,        AVDT_CCB_CLOSING_ST},
-/* MSG_DISCOVER_CMD_EVT */   {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* MSG_GETCAP_CMD_EVT */     {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* MSG_START_CMD_EVT */      {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* MSG_SUSPEND_CMD_EVT */    {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* MSG_DISCOVER_RSP_EVT */   {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* MSG_GETCAP_RSP_EVT */     {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* MSG_START_RSP_EVT */      {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* MSG_SUSPEND_RSP_EVT */    {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* RCVRSP_EVT */             {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* SENDMSG_EVT */            {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* RET_TOUT_EVT */           {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* RSP_TOUT_EVT */           {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* IDLE_TOUT_EVT */          {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* UL_OPEN_EVT */            {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
-/* UL_CLOSE_EVT */           {AVDT_CCB_CLEAR_CMDS,        AVDT_CCB_CHAN_CLOSE,        AVDT_CCB_CLOSING_ST},
-/* LL_OPEN_EVT */            {AVDT_CCB_SND_CMD,           AVDT_CCB_LL_OPENED,         AVDT_CCB_OPEN_ST},
-/* LL_CLOSE_EVT */           {AVDT_CCB_LL_CLOSED,         AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* LL_CONG_EVT */            {AVDT_CCB_CONG_STATE,        AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST}
+/* Event */
+/* Action 1                    Action 2                    Next state */
+/* API_DISCOVER_REQ_EVT */
+{AVDT_CCB_SND_DISCOVER_CMD,  AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* API_GETCAP_REQ_EVT */
+{AVDT_CCB_SND_GETCAP_CMD,    AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* API_START_REQ_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* API_SUSPEND_REQ_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* API_DISCOVER_RSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* API_GETCAP_RSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* API_START_RSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* API_SUSPEND_RSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* API_CONNECT_REQ_EVT */
+{AVDT_CCB_SET_CONN,          AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* API_DISCONNECT_REQ_EVT */
+{AVDT_CCB_SET_DISCONN,       AVDT_CCB_DO_DISCONN,        AVDT_CCB_CLOSING_ST},
+/* MSG_DISCOVER_CMD_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* MSG_GETCAP_CMD_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* MSG_START_CMD_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* MSG_SUSPEND_CMD_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* MSG_DISCOVER_RSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* MSG_GETCAP_RSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* MSG_START_RSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* MSG_SUSPEND_RSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* RCVRSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* SENDMSG_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* RET_TOUT_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* RSP_TOUT_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* IDLE_TOUT_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* UL_OPEN_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST},
+/* UL_CLOSE_EVT */
+{AVDT_CCB_CLEAR_CMDS,        AVDT_CCB_CHAN_CLOSE,        AVDT_CCB_CLOSING_ST},
+/* LL_OPEN_EVT */
+{AVDT_CCB_SND_CMD,           AVDT_CCB_LL_OPENED,         AVDT_CCB_OPEN_ST},
+/* LL_CLOSE_EVT */
+{AVDT_CCB_LL_CLOSED,         AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* LL_CONG_EVT */
+{AVDT_CCB_CONG_STATE,        AVDT_CCB_IGNORE,            AVDT_CCB_OPENING_ST}
 };
 
 /* state table for open state */
 const uint8_t avdt_ccb_st_open[][AVDT_CCB_NUM_COLS] = {
-/* Event                      Action 1                    Action 2                    Next state */
-/* API_DISCOVER_REQ_EVT */   {AVDT_CCB_SND_DISCOVER_CMD,  AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
-/* API_GETCAP_REQ_EVT */     {AVDT_CCB_SND_GETCAP_CMD,    AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
-/* API_START_REQ_EVT */      {AVDT_CCB_SND_START_CMD,     AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
-/* API_SUSPEND_REQ_EVT */    {AVDT_CCB_SND_SUSPEND_CMD,   AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
-/* API_DISCOVER_RSP_EVT */   {AVDT_CCB_SND_DISCOVER_RSP,  AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
-/* API_GETCAP_RSP_EVT */     {AVDT_CCB_SND_GETCAP_RSP,    AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
-/* API_START_RSP_EVT */      {AVDT_CCB_SND_START_RSP,     AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
-/* API_SUSPEND_RSP_EVT */    {AVDT_CCB_SND_SUSPEND_RSP,   AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
-/* API_CONNECT_REQ_EVT */    {AVDT_CCB_SET_CONN,          AVDT_CCB_LL_OPENED,         AVDT_CCB_OPEN_ST},
-/* API_DISCONNECT_REQ_EVT */ {AVDT_CCB_SET_DISCONN,       AVDT_CCB_DO_DISCONN,        AVDT_CCB_CLOSING_ST},
-/* MSG_DISCOVER_CMD_EVT */   {AVDT_CCB_HDL_DISCOVER_CMD,  AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
-/* MSG_GETCAP_CMD_EVT */     {AVDT_CCB_HDL_GETCAP_CMD,    AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
-/* MSG_START_CMD_EVT */      {AVDT_CCB_HDL_START_CMD,     AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
-/* MSG_SUSPEND_CMD_EVT */    {AVDT_CCB_HDL_SUSPEND_CMD,   AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
-/* MSG_DISCOVER_RSP_EVT */   {AVDT_CCB_CHK_CLOSE,         AVDT_CCB_HDL_DISCOVER_RSP,  AVDT_CCB_OPEN_ST},
-/* MSG_GETCAP_RSP_EVT */     {AVDT_CCB_CHK_CLOSE,         AVDT_CCB_HDL_GETCAP_RSP,    AVDT_CCB_OPEN_ST},
-/* MSG_START_RSP_EVT */      {AVDT_CCB_HDL_START_RSP,     AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
-/* MSG_SUSPEND_RSP_EVT */    {AVDT_CCB_HDL_SUSPEND_RSP,   AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
-/* RCVRSP_EVT */             {AVDT_CCB_FREE_CMD,          AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
-/* SENDMSG_EVT */            {AVDT_CCB_SND_MSG,           AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
-/* RET_TOUT_EVT */           {AVDT_CCB_RET_CMD,           AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
-/* RSP_TOUT_EVT */           {AVDT_CCB_CMD_FAIL,          AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
-/* IDLE_TOUT_EVT */          {AVDT_CCB_CLEAR_CMDS,        AVDT_CCB_CHAN_CLOSE,        AVDT_CCB_CLOSING_ST},
-/* UL_OPEN_EVT */            {AVDT_CCB_CHK_TIMER,         AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
-/* UL_CLOSE_EVT */           {AVDT_CCB_CHK_CLOSE,         AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
-/* LL_OPEN_EVT */            {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
-/* LL_CLOSE_EVT */           {AVDT_CCB_LL_CLOSED,         AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* LL_CONG_EVT */            {AVDT_CCB_CONG_STATE,        AVDT_CCB_SND_MSG,           AVDT_CCB_OPEN_ST}
+/* Event */
+/* Action 1                    Action 2                    Next state */
+/* API_DISCOVER_REQ_EVT */
+{AVDT_CCB_SND_DISCOVER_CMD,  AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
+/* API_GETCAP_REQ_EVT */
+{AVDT_CCB_SND_GETCAP_CMD,    AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
+/* API_START_REQ_EVT */
+{AVDT_CCB_SND_START_CMD,     AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
+/* API_SUSPEND_REQ_EVT */
+{AVDT_CCB_SND_SUSPEND_CMD,   AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
+/* API_DISCOVER_RSP_EVT */
+{AVDT_CCB_SND_DISCOVER_RSP,  AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
+/* API_GETCAP_RSP_EVT */
+{AVDT_CCB_SND_GETCAP_RSP,    AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
+/* API_START_RSP_EVT */
+{AVDT_CCB_SND_START_RSP,     AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
+/* API_SUSPEND_RSP_EVT */
+{AVDT_CCB_SND_SUSPEND_RSP,   AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
+/* API_CONNECT_REQ_EVT */
+{AVDT_CCB_SET_CONN,          AVDT_CCB_LL_OPENED,         AVDT_CCB_OPEN_ST},
+/* API_DISCONNECT_REQ_EVT */
+{AVDT_CCB_SET_DISCONN,       AVDT_CCB_DO_DISCONN,        AVDT_CCB_CLOSING_ST},
+/* MSG_DISCOVER_CMD_EVT */
+{AVDT_CCB_HDL_DISCOVER_CMD,  AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
+/* MSG_GETCAP_CMD_EVT */
+{AVDT_CCB_HDL_GETCAP_CMD,    AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
+/* MSG_START_CMD_EVT */
+{AVDT_CCB_HDL_START_CMD,     AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
+/* MSG_SUSPEND_CMD_EVT */
+{AVDT_CCB_HDL_SUSPEND_CMD,   AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
+/* MSG_DISCOVER_RSP_EVT */
+{AVDT_CCB_CHK_CLOSE,         AVDT_CCB_HDL_DISCOVER_RSP,  AVDT_CCB_OPEN_ST},
+/* MSG_GETCAP_RSP_EVT */
+{AVDT_CCB_CHK_CLOSE,         AVDT_CCB_HDL_GETCAP_RSP,    AVDT_CCB_OPEN_ST},
+/* MSG_START_RSP_EVT */
+{AVDT_CCB_HDL_START_RSP,     AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
+/* MSG_SUSPEND_RSP_EVT */
+{AVDT_CCB_HDL_SUSPEND_RSP,   AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
+/* RCVRSP_EVT */
+{AVDT_CCB_FREE_CMD,          AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
+/* SENDMSG_EVT */
+{AVDT_CCB_SND_MSG,           AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
+/* RET_TOUT_EVT */
+{AVDT_CCB_RET_CMD,           AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
+/* RSP_TOUT_EVT */
+{AVDT_CCB_CMD_FAIL,          AVDT_CCB_SND_CMD,           AVDT_CCB_OPEN_ST},
+/* IDLE_TOUT_EVT */
+{AVDT_CCB_CLEAR_CMDS,        AVDT_CCB_CHAN_CLOSE,        AVDT_CCB_CLOSING_ST},
+/* UL_OPEN_EVT */
+{AVDT_CCB_CHK_TIMER,         AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
+/* UL_CLOSE_EVT */
+{AVDT_CCB_CHK_CLOSE,         AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
+/* LL_OPEN_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_OPEN_ST},
+/* LL_CLOSE_EVT */
+{AVDT_CCB_LL_CLOSED,         AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* LL_CONG_EVT */
+{AVDT_CCB_CONG_STATE,        AVDT_CCB_SND_MSG,           AVDT_CCB_OPEN_ST}
 };
 
 /* state table for closing state */
 const uint8_t avdt_ccb_st_closing[][AVDT_CCB_NUM_COLS] = {
-/* Event                      Action 1                    Action 2                    Next state */
-/* API_DISCOVER_REQ_EVT */   {AVDT_CCB_SET_RECONN,        AVDT_CCB_SND_DISCOVER_CMD,  AVDT_CCB_CLOSING_ST},
-/* API_GETCAP_REQ_EVT */     {AVDT_CCB_SET_RECONN,        AVDT_CCB_SND_GETCAP_CMD,    AVDT_CCB_CLOSING_ST},
-/* API_START_REQ_EVT */      {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* API_SUSPEND_REQ_EVT */    {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* API_DISCOVER_RSP_EVT */   {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* API_GETCAP_RSP_EVT */     {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* API_START_RSP_EVT */      {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* API_SUSPEND_RSP_EVT */    {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* API_CONNECT_REQ_EVT */    {AVDT_CCB_SET_RECONN,        AVDT_CCB_SET_CONN,          AVDT_CCB_CLOSING_ST},
-/* API_DISCONNECT_REQ_EVT */ {AVDT_CCB_CLR_RECONN,        AVDT_CCB_SET_DISCONN,       AVDT_CCB_CLOSING_ST},
-/* MSG_DISCOVER_CMD_EVT */   {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* MSG_GETCAP_CMD_EVT */     {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* MSG_START_CMD_EVT */      {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* MSG_SUSPEND_CMD_EVT */    {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* MSG_DISCOVER_RSP_EVT */   {AVDT_CCB_HDL_DISCOVER_RSP,  AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* MSG_GETCAP_RSP_EVT */     {AVDT_CCB_HDL_GETCAP_RSP,    AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* MSG_START_RSP_EVT */      {AVDT_CCB_HDL_START_RSP,     AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* MSG_SUSPEND_RSP_EVT */    {AVDT_CCB_HDL_SUSPEND_RSP,   AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* RCVRSP_EVT */             {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* SENDMSG_EVT */            {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* RET_TOUT_EVT */           {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* RSP_TOUT_EVT */           {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* IDLE_TOUT_EVT */          {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* UL_OPEN_EVT */            {AVDT_CCB_SET_RECONN,        AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* UL_CLOSE_EVT */           {AVDT_CCB_CLR_RECONN,        AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* LL_OPEN_EVT */            {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
-/* LL_CLOSE_EVT */           {AVDT_CCB_CHK_RECONN,        AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
-/* LL_CONG_EVT */            {AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST}
+/* Event */
+/* Action 1                    Action 2                    Next state */
+/* API_DISCOVER_REQ_EVT */
+{AVDT_CCB_SET_RECONN,        AVDT_CCB_SND_DISCOVER_CMD,  AVDT_CCB_CLOSING_ST},
+/* API_GETCAP_REQ_EVT */
+{AVDT_CCB_SET_RECONN,        AVDT_CCB_SND_GETCAP_CMD,    AVDT_CCB_CLOSING_ST},
+/* API_START_REQ_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* API_SUSPEND_REQ_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* API_DISCOVER_RSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* API_GETCAP_RSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* API_START_RSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* API_SUSPEND_RSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* API_CONNECT_REQ_EVT */
+{AVDT_CCB_SET_RECONN,        AVDT_CCB_SET_CONN,          AVDT_CCB_CLOSING_ST},
+/* API_DISCONNECT_REQ_EVT */
+{AVDT_CCB_CLR_RECONN,        AVDT_CCB_SET_DISCONN,       AVDT_CCB_CLOSING_ST},
+/* MSG_DISCOVER_CMD_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* MSG_GETCAP_CMD_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* MSG_START_CMD_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* MSG_SUSPEND_CMD_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* MSG_DISCOVER_RSP_EVT */
+{AVDT_CCB_HDL_DISCOVER_RSP,  AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* MSG_GETCAP_RSP_EVT */
+{AVDT_CCB_HDL_GETCAP_RSP,    AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* MSG_START_RSP_EVT */
+{AVDT_CCB_HDL_START_RSP,     AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* MSG_SUSPEND_RSP_EVT */
+{AVDT_CCB_HDL_SUSPEND_RSP,   AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* RCVRSP_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* SENDMSG_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* RET_TOUT_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* RSP_TOUT_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* IDLE_TOUT_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* UL_OPEN_EVT */
+{AVDT_CCB_SET_RECONN,        AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* UL_CLOSE_EVT */
+{AVDT_CCB_CLR_RECONN,        AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* LL_OPEN_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST},
+/* LL_CLOSE_EVT */
+{AVDT_CCB_CHK_RECONN,        AVDT_CCB_IGNORE,            AVDT_CCB_IDLE_ST},
+/* LL_CONG_EVT */
+{AVDT_CCB_IGNORE,            AVDT_CCB_IGNORE,            AVDT_CCB_CLOSING_ST}
 };
 
 /* type for state table */
diff --git a/stack/avdt/avdt_ccb_act.cc b/stack/avdt/avdt_ccb_act.cc
index b2bde55..4384aba 100644
--- a/stack/avdt/avdt_ccb_act.cc
+++ b/stack/avdt/avdt_ccb_act.cc
@@ -364,7 +364,8 @@
  * Description      This function is called when a suspend response or reject
  *                  is received from the peer.  Using the SEIDs stored in the
  *                  current command message, it sends a suspend response or
- *                  suspend reject event to each SCB associated with the command.
+ *                  suspend reject event to each SCB associated with the
+ *                  command.
  *
  *
  *
diff --git a/stack/avdt/avdt_defs.h b/stack/avdt/avdt_defs.h
index d618474..898c8f2 100644
--- a/stack/avdt/avdt_defs.h
+++ b/stack/avdt/avdt_defs.h
@@ -117,10 +117,14 @@
 #define AVDT_LEN_GEN_REJ            2
 
 /* recovery service capabilities information elements */
-#define AVDT_RECOV_MRWS_MIN         0x01    /* min value for maximum recovery window */
-#define AVDT_RECOV_MRWS_MAX         0x18    /* max value for maximum recovery window */
-#define AVDT_RECOV_MNMP_MIN         0x01    /* min value for maximum number of media packets */
-#define AVDT_RECOV_MNMP_MAX         0x18    /* max value for maximum number of media packets */
+/* min value for maximum recovery window */
+#define AVDT_RECOV_MRWS_MIN         0x01
+/* max value for maximum recovery window */
+#define AVDT_RECOV_MRWS_MAX         0x18
+/* min value for maximum number of media packets */
+#define AVDT_RECOV_MNMP_MIN         0x01
+/* max value for maximum number of media packets */
+#define AVDT_RECOV_MNMP_MAX         0x18
 
 /* SEID value range */
 #define AVDT_SEID_MIN               0x01
@@ -130,13 +134,19 @@
 #define AVDT_MEDIA_OCTET1           0x80
 
 /* for adaptation layer header */
-#define AVDT_ALH_LCODE_MASK     0x03    /* coding of length field */
-#define AVDT_ALH_LCODE_NONE     0x00    /* No length field present. Take length from l2cap */
-#define AVDT_ALH_LCODE_16BIT    0x01    /* 16bit length field */
-#define AVDT_ALH_LCODE_9BITM0   0x02    /* 9 bit length field, MSB = 0, 8 LSBs in 1 octet following */
-#define AVDT_ALH_LCODE_9BITM1   0x03    /* 9 bit length field, MSB = 1, 8 LSBs in 1 octet following */
+/* coding of length field */
+#define AVDT_ALH_LCODE_MASK     0x03
+/* No length field present. Take length from l2cap */
+#define AVDT_ALH_LCODE_NONE     0x00
+/* 16bit length field */
+#define AVDT_ALH_LCODE_16BIT    0x01
+/* 9 bit length field, MSB = 0, 8 LSBs in 1 octet following */
+#define AVDT_ALH_LCODE_9BITM0   0x02
+/* 9 bit length field, MSB = 1, 8 LSBs in 1 octet following */
+#define AVDT_ALH_LCODE_9BITM1   0x03
 
-#define AVDT_ALH_FRAG_MASK      0x04    /* set this for continuation packet */
+/* set this for continuation packet */
+#define AVDT_ALH_FRAG_MASK      0x04
 
 /*****************************************************************************
  * message parsing and building macros
diff --git a/stack/avdt/avdt_msg.cc b/stack/avdt/avdt_msg.cc
index 9910218..0d18e48 100644
--- a/stack/avdt/avdt_msg.cc
+++ b/stack/avdt/avdt_msg.cc
@@ -675,8 +675,8 @@
  *
  * Function         avdt_msg_prs_none
  *
- * Description      This message parsing function parses a message with no parameters.
-
+ * Description      This message parsing function parses a message with no
+ *                  parameters.
  *
  *
  * Returns          Error code or zero if no error.
@@ -1538,8 +1538,8 @@
  *
  * Function         avdt_msg_send_grej
  *
- * Description      This function is called to send a general reject message.  The
- *                  sig_id parameter indicates the message type.  It gets
+ * Description      This function is called to send a general reject message.
+ *                  The sig_id parameter indicates the message type.  It gets
  *                  a buffer from the AVDTP command pool and builds the
  *                  message based on the message type and the error code.
  *                  It then queues the message in the response queue for
diff --git a/stack/avdt/avdt_scb.cc b/stack/avdt/avdt_scb.cc
index f0bee25..b18f390 100644
--- a/stack/avdt/avdt_scb.cc
+++ b/stack/avdt/avdt_scb.cc
@@ -178,325 +178,621 @@
 
 /* state table for idle state */
 const uint8_t avdt_scb_st_idle[][AVDT_SCB_NUM_COLS] = {
-/* Event                     Action 1                       Action 2                    Next state */
-/* API_REMOVE_EVT */        {AVDT_SCB_DEALLOC,              AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* API_WRITE_REQ_EVT */     {AVDT_SCB_FREE_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_SND_SETCONFIG_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* API_OPEN_REQ_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* API_CLOSE_REQ_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* API_RECONFIG_REQ_EVT */  {AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* API_SECURITY_REQ_EVT */  {AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* API_ABORT_REQ_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_SND_SETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_SND_SETCONFIG_REJ,    AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* API_OPEN_RSP_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* API_CLOSE_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* API_RECONFIG_RSP_EVT */  {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* API_SECURITY_RSP_EVT */  {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* API_ABORT_RSP_EVT */     {AVDT_SCB_SND_ABORT_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_HDL_SETCONFIG_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_OPEN_CMD_EVT */      {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_START_CMD_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_SUSPEND_CMD_EVT */   {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_CLOSE_CMD_EVT */     {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_ABORT_CMD_EVT */     {AVDT_SCB_HDL_ABORT_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_RECONFIG_CMD_EVT */  {AVDT_SCB_REJ_NOT_IN_USE,       AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_SECURITY_CMD_EVT */  {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_SETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_OPEN_RSP_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_START_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_SUSPEND_RSP_EVT */   {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_CLOSE_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_ABORT_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_RECONFIG_RSP_EVT */  {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_SECURITY_RSP_EVT */  {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_HDL_SETCONFIG_REJ,    AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_OPEN_REJ_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_START_REJ_EVT */     {AVDT_SCB_HDL_START_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_SUSPEND_REJ_EVT */   {AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* TC_TOUT_EVT */           {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* TC_OPEN_EVT */           {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* TC_CLOSE_EVT */          {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* TC_CONG_EVT */           {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* TC_DATA_EVT */           {AVDT_SCB_DROP_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* CC_CLOSE_EVT */          {AVDT_SCB_CLR_VARS,             AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST}
+/* Event */
+/* Action 1                       Action 2                    Next state */
+/* API_REMOVE_EVT */
+{AVDT_SCB_DEALLOC,              AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* API_WRITE_REQ_EVT */
+{AVDT_SCB_FREE_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* API_GETCONFIG_REQ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* API_DELAY_RPT_REQ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* API_SETCONFIG_REQ_EVT */
+{AVDT_SCB_SND_SETCONFIG_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* API_OPEN_REQ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* API_CLOSE_REQ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* API_RECONFIG_REQ_EVT */
+{AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* API_SECURITY_REQ_EVT */
+{AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* API_ABORT_REQ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* API_GETCONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* API_SETCONFIG_RSP_EVT */
+{AVDT_SCB_SND_SETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* API_SETCONFIG_REJ_EVT */
+{AVDT_SCB_SND_SETCONFIG_REJ,    AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* API_OPEN_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* API_CLOSE_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* API_RECONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* API_SECURITY_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* API_ABORT_RSP_EVT */
+{AVDT_SCB_SND_ABORT_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_SETCONFIG_CMD_EVT */
+{AVDT_SCB_HDL_SETCONFIG_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_GETCONFIG_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_OPEN_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_START_CMD_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_SUSPEND_CMD_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_CLOSE_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_ABORT_CMD_EVT */
+{AVDT_SCB_HDL_ABORT_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_RECONFIG_CMD_EVT */
+{AVDT_SCB_REJ_NOT_IN_USE,       AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_SECURITY_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_DELAY_RPT_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_DELAY_RPT_RSP_EVT */
+{AVDT_SCB_HDL_DELAY_RPT_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_SETCONFIG_RSP_EVT */
+{AVDT_SCB_HDL_SETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_GETCONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_OPEN_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_START_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_SUSPEND_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_CLOSE_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_ABORT_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_RECONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_SECURITY_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_SETCONFIG_REJ_EVT */
+{AVDT_SCB_HDL_SETCONFIG_REJ,    AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_OPEN_REJ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_START_REJ_EVT */
+{AVDT_SCB_HDL_START_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_SUSPEND_REJ_EVT */
+{AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* TC_TOUT_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* TC_OPEN_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* TC_CLOSE_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* TC_CONG_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* TC_DATA_EVT */
+{AVDT_SCB_DROP_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* CC_CLOSE_EVT */
+{AVDT_SCB_CLR_VARS,             AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST}
 };
 
 /* state table for configured state */
 const uint8_t avdt_scb_st_conf[][AVDT_SCB_NUM_COLS] = {
-/* Event                     Action 1                       Action 2                    Next state */
-/* API_REMOVE_EVT */        {AVDT_SCB_SND_ABORT_REQ,        AVDT_SCB_SET_REMOVE,        AVDT_SCB_CONF_ST},
-/* API_WRITE_REQ_EVT */     {AVDT_SCB_FREE_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_SND_GETCONFIG_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_SND_DELAY_RPT_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* API_OPEN_REQ_EVT */      {AVDT_SCB_SND_OPEN_REQ,         AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* API_CLOSE_REQ_EVT */     {AVDT_SCB_SND_ABORT_REQ,        AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* API_RECONFIG_REQ_EVT */  {AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* API_SECURITY_REQ_EVT */  {AVDT_SCB_SND_SECURITY_REQ,     AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* API_ABORT_REQ_EVT */     {AVDT_SCB_SND_ABORT_REQ,        AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_SND_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* API_OPEN_RSP_EVT */      {AVDT_SCB_SND_OPEN_RSP,         AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* API_CLOSE_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* API_RECONFIG_RSP_EVT */  {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* API_SECURITY_RSP_EVT */  {AVDT_SCB_SND_SECURITY_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* API_ABORT_RSP_EVT */     {AVDT_SCB_SND_ABORT_RSP,        AVDT_SCB_HDL_TC_CLOSE,      AVDT_SCB_IDLE_ST},
-/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_IN_USE,           AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_HDL_GETCONFIG_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_OPEN_CMD_EVT */      {AVDT_SCB_HDL_OPEN_CMD,         AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_START_CMD_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_SUSPEND_CMD_EVT */   {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_CLOSE_CMD_EVT */     {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_ABORT_CMD_EVT */     {AVDT_SCB_HDL_ABORT_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_RECONFIG_CMD_EVT */  {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_SECURITY_CMD_EVT */  {AVDT_SCB_HDL_SECURITY_CMD,     AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_HDL_DELAY_RPT_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_OPEN_RSP_EVT */      {AVDT_SCB_HDL_OPEN_RSP,         AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_START_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_SUSPEND_RSP_EVT */   {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_CLOSE_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_ABORT_RSP_EVT */     {AVDT_SCB_HDL_ABORT_RSP,        AVDT_SCB_HDL_TC_CLOSE,      AVDT_SCB_IDLE_ST},
-/* MSG_RECONFIG_RSP_EVT */  {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_SECURITY_RSP_EVT */  {AVDT_SCB_HDL_SECURITY_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_OPEN_REJ_EVT */      {AVDT_SCB_HDL_OPEN_REJ,         AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_START_REJ_EVT */     {AVDT_SCB_HDL_START_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* MSG_SUSPEND_REJ_EVT */   {AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* TC_TOUT_EVT */           {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* TC_OPEN_EVT */           {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* TC_CLOSE_EVT */          {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* TC_CONG_EVT */           {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* TC_DATA_EVT */           {AVDT_SCB_DROP_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
-/* CC_CLOSE_EVT */          {AVDT_SCB_HDL_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST}
+/* Event */
+/* Action 1                       Action 2                    Next state */
+/* API_REMOVE_EVT */
+{AVDT_SCB_SND_ABORT_REQ,        AVDT_SCB_SET_REMOVE,        AVDT_SCB_CONF_ST},
+/* API_WRITE_REQ_EVT */
+{AVDT_SCB_FREE_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* API_GETCONFIG_REQ_EVT */
+{AVDT_SCB_SND_GETCONFIG_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* API_DELAY_RPT_REQ_EVT */
+{AVDT_SCB_SND_DELAY_RPT_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* API_SETCONFIG_REQ_EVT */
+{AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* API_OPEN_REQ_EVT */
+{AVDT_SCB_SND_OPEN_REQ,         AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* API_CLOSE_REQ_EVT */
+{AVDT_SCB_SND_ABORT_REQ,        AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* API_RECONFIG_REQ_EVT */
+{AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* API_SECURITY_REQ_EVT */
+{AVDT_SCB_SND_SECURITY_REQ,     AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* API_ABORT_REQ_EVT */
+{AVDT_SCB_SND_ABORT_REQ,        AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* API_GETCONFIG_RSP_EVT */
+{AVDT_SCB_SND_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* API_SETCONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* API_SETCONFIG_REJ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* API_OPEN_RSP_EVT */
+{AVDT_SCB_SND_OPEN_RSP,         AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* API_CLOSE_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* API_RECONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* API_SECURITY_RSP_EVT */
+{AVDT_SCB_SND_SECURITY_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* API_ABORT_RSP_EVT */
+{AVDT_SCB_SND_ABORT_RSP,        AVDT_SCB_HDL_TC_CLOSE,      AVDT_SCB_IDLE_ST},
+/* MSG_SETCONFIG_CMD_EVT */
+{AVDT_SCB_REJ_IN_USE,           AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_GETCONFIG_CMD_EVT */
+{AVDT_SCB_HDL_GETCONFIG_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_OPEN_CMD_EVT */
+{AVDT_SCB_HDL_OPEN_CMD,         AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_START_CMD_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_SUSPEND_CMD_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_CLOSE_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_ABORT_CMD_EVT */
+{AVDT_SCB_HDL_ABORT_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_RECONFIG_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_SECURITY_CMD_EVT */
+{AVDT_SCB_HDL_SECURITY_CMD,     AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_DELAY_RPT_CMD_EVT */
+{AVDT_SCB_HDL_DELAY_RPT_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_DELAY_RPT_RSP_EVT */
+{AVDT_SCB_HDL_DELAY_RPT_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_SETCONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_GETCONFIG_RSP_EVT */
+{AVDT_SCB_HDL_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_OPEN_RSP_EVT */
+{AVDT_SCB_HDL_OPEN_RSP,         AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_START_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_SUSPEND_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_CLOSE_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_ABORT_RSP_EVT */
+{AVDT_SCB_HDL_ABORT_RSP,        AVDT_SCB_HDL_TC_CLOSE,      AVDT_SCB_IDLE_ST},
+/* MSG_RECONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_SECURITY_RSP_EVT */
+{AVDT_SCB_HDL_SECURITY_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_SETCONFIG_REJ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_OPEN_REJ_EVT */
+{AVDT_SCB_HDL_OPEN_REJ,         AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_START_REJ_EVT */
+{AVDT_SCB_HDL_START_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* MSG_SUSPEND_REJ_EVT */
+{AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* TC_TOUT_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* TC_OPEN_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* TC_CLOSE_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* TC_CONG_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* TC_DATA_EVT */
+{AVDT_SCB_DROP_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_CONF_ST},
+/* CC_CLOSE_EVT */
+{AVDT_SCB_HDL_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST}
 };
 
 /* state table for opening state */
 const uint8_t avdt_scb_st_opening[][AVDT_SCB_NUM_COLS] = {
-/* Event                     Action 1                       Action 2                    Next state */
-/* API_REMOVE_EVT */        {AVDT_SCB_SND_CLOSE_REQ,        AVDT_SCB_SET_REMOVE,        AVDT_SCB_CLOSING_ST},
-/* API_WRITE_REQ_EVT */     {AVDT_SCB_FREE_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_SND_GETCONFIG_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_SND_DELAY_RPT_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* API_OPEN_REQ_EVT */      {AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* API_CLOSE_REQ_EVT */     {AVDT_SCB_SND_CLOSE_REQ,        AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_RECONFIG_REQ_EVT */  {AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* API_SECURITY_REQ_EVT */  {AVDT_SCB_SND_SECURITY_REQ,     AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* API_ABORT_REQ_EVT */     {AVDT_SCB_SND_ABORT_REQ,        AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_SND_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* API_OPEN_RSP_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* API_CLOSE_RSP_EVT */     {AVDT_SCB_SND_CLOSE_RSP,        AVDT_SCB_SND_TC_CLOSE,      AVDT_SCB_CLOSING_ST},
-/* API_RECONFIG_RSP_EVT */  {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* API_SECURITY_RSP_EVT */  {AVDT_SCB_SND_SECURITY_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* API_ABORT_RSP_EVT */     {AVDT_SCB_SND_ABORT_RSP,        AVDT_SCB_SND_TC_CLOSE,      AVDT_SCB_CLOSING_ST},
-/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_HDL_GETCONFIG_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_OPEN_CMD_EVT */      {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_START_CMD_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_SUSPEND_CMD_EVT */   {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_CLOSE_CMD_EVT */     {AVDT_SCB_HDL_CLOSE_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_ABORT_CMD_EVT */     {AVDT_SCB_HDL_ABORT_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_RECONFIG_CMD_EVT */  {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_SECURITY_CMD_EVT */  {AVDT_SCB_HDL_SECURITY_CMD,     AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_HDL_DELAY_RPT_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_OPEN_RSP_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_START_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_SUSPEND_RSP_EVT */   {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_CLOSE_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_ABORT_RSP_EVT */     {AVDT_SCB_SND_TC_CLOSE,         AVDT_SCB_HDL_ABORT_RSP,     AVDT_SCB_CLOSING_ST},
-/* MSG_RECONFIG_RSP_EVT */  {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_SECURITY_RSP_EVT */  {AVDT_SCB_HDL_SECURITY_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_OPEN_REJ_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_START_REJ_EVT */     {AVDT_SCB_HDL_START_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* MSG_SUSPEND_REJ_EVT */   {AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* TC_TOUT_EVT */           {AVDT_SCB_SND_ABORT_REQ,        AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* TC_OPEN_EVT */           {AVDT_SCB_HDL_TC_OPEN,          AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* TC_CLOSE_EVT */          {AVDT_SCB_HDL_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* TC_CONG_EVT */           {AVDT_SCB_CONG_STATE,           AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* TC_DATA_EVT */           {AVDT_SCB_DROP_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
-/* CC_CLOSE_EVT */          {AVDT_SCB_SND_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST}
+/* Event */
+/* Action 1                       Action 2                    Next state */
+/* API_REMOVE_EVT */
+{AVDT_SCB_SND_CLOSE_REQ,        AVDT_SCB_SET_REMOVE,        AVDT_SCB_CLOSING_ST},
+/* API_WRITE_REQ_EVT */
+{AVDT_SCB_FREE_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* API_GETCONFIG_REQ_EVT */
+{AVDT_SCB_SND_GETCONFIG_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* API_DELAY_RPT_REQ_EVT */
+{AVDT_SCB_SND_DELAY_RPT_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* API_SETCONFIG_REQ_EVT */
+{AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* API_OPEN_REQ_EVT */
+{AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* API_CLOSE_REQ_EVT */
+{AVDT_SCB_SND_CLOSE_REQ,        AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_RECONFIG_REQ_EVT */
+{AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* API_SECURITY_REQ_EVT */
+{AVDT_SCB_SND_SECURITY_REQ,     AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* API_ABORT_REQ_EVT */
+{AVDT_SCB_SND_ABORT_REQ,        AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_GETCONFIG_RSP_EVT */
+{AVDT_SCB_SND_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* API_SETCONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* API_SETCONFIG_REJ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* API_OPEN_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* API_CLOSE_RSP_EVT */
+{AVDT_SCB_SND_CLOSE_RSP,        AVDT_SCB_SND_TC_CLOSE,      AVDT_SCB_CLOSING_ST},
+/* API_RECONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* API_SECURITY_RSP_EVT */
+{AVDT_SCB_SND_SECURITY_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* API_ABORT_RSP_EVT */
+{AVDT_SCB_SND_ABORT_RSP,        AVDT_SCB_SND_TC_CLOSE,      AVDT_SCB_CLOSING_ST},
+/* MSG_SETCONFIG_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_GETCONFIG_CMD_EVT */
+{AVDT_SCB_HDL_GETCONFIG_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_OPEN_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_START_CMD_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_SUSPEND_CMD_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_CLOSE_CMD_EVT */
+{AVDT_SCB_HDL_CLOSE_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_ABORT_CMD_EVT */
+{AVDT_SCB_HDL_ABORT_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_RECONFIG_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_SECURITY_CMD_EVT */
+{AVDT_SCB_HDL_SECURITY_CMD,     AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_DELAY_RPT_CMD_EVT */
+{AVDT_SCB_HDL_DELAY_RPT_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_DELAY_RPT_RSP_EVT */
+{AVDT_SCB_HDL_DELAY_RPT_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_SETCONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_GETCONFIG_RSP_EVT */
+{AVDT_SCB_HDL_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_OPEN_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_START_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_SUSPEND_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_CLOSE_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_ABORT_RSP_EVT */
+{AVDT_SCB_SND_TC_CLOSE,         AVDT_SCB_HDL_ABORT_RSP,     AVDT_SCB_CLOSING_ST},
+/* MSG_RECONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_SECURITY_RSP_EVT */
+{AVDT_SCB_HDL_SECURITY_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_SETCONFIG_REJ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_OPEN_REJ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_START_REJ_EVT */
+{AVDT_SCB_HDL_START_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* MSG_SUSPEND_REJ_EVT */
+{AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* TC_TOUT_EVT */
+{AVDT_SCB_SND_ABORT_REQ,        AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* TC_OPEN_EVT */
+{AVDT_SCB_HDL_TC_OPEN,          AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* TC_CLOSE_EVT */
+{AVDT_SCB_HDL_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* TC_CONG_EVT */
+{AVDT_SCB_CONG_STATE,           AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* TC_DATA_EVT */
+{AVDT_SCB_DROP_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_OPENING_ST},
+/* CC_CLOSE_EVT */
+{AVDT_SCB_SND_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST}
 };
 
 /* state table for open state */
 const uint8_t avdt_scb_st_open[][AVDT_SCB_NUM_COLS] = {
-/* Event                     Action 1                       Action 2                    Next state */
-/* API_REMOVE_EVT */        {AVDT_SCB_SND_CLOSE_REQ,        AVDT_SCB_SET_REMOVE,        AVDT_SCB_CLOSING_ST},
-/* API_WRITE_REQ_EVT */     {AVDT_SCB_FREE_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_SND_GETCONFIG_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_SND_DELAY_RPT_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* API_OPEN_REQ_EVT */      {AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* API_CLOSE_REQ_EVT */     {AVDT_SCB_SND_CLOSE_REQ,        AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_RECONFIG_REQ_EVT */  {AVDT_SCB_SND_RECONFIG_REQ,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* API_SECURITY_REQ_EVT */  {AVDT_SCB_SND_SECURITY_REQ,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* API_ABORT_REQ_EVT */     {AVDT_SCB_SND_ABORT_REQ,        AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_SND_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* API_OPEN_RSP_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* API_CLOSE_RSP_EVT */     {AVDT_SCB_SND_CLOSE_RSP,        AVDT_SCB_TC_TIMER,          AVDT_SCB_CLOSING_ST},
-/* API_RECONFIG_RSP_EVT */  {AVDT_SCB_SND_RECONFIG_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* API_SECURITY_RSP_EVT */  {AVDT_SCB_SND_SECURITY_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* API_ABORT_RSP_EVT */     {AVDT_SCB_SND_ABORT_RSP,        AVDT_SCB_TC_TIMER,          AVDT_SCB_CLOSING_ST},
-/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_HDL_GETCONFIG_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_OPEN_CMD_EVT */      {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_START_CMD_EVT */     {AVDT_SCB_HDL_START_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_SUSPEND_CMD_EVT */   {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_CLOSE_CMD_EVT */     {AVDT_SCB_HDL_CLOSE_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_ABORT_CMD_EVT */     {AVDT_SCB_HDL_ABORT_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_RECONFIG_CMD_EVT */  {AVDT_SCB_HDL_RECONFIG_CMD,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_SECURITY_CMD_EVT */  {AVDT_SCB_HDL_SECURITY_CMD,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_HDL_DELAY_RPT_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_OPEN_RSP_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_START_RSP_EVT */     {AVDT_SCB_HDL_START_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_SUSPEND_RSP_EVT */   {AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_CLOSE_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_ABORT_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* MSG_RECONFIG_RSP_EVT */  {AVDT_SCB_HDL_RECONFIG_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_SECURITY_RSP_EVT */  {AVDT_SCB_HDL_SECURITY_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_OPEN_REJ_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_START_REJ_EVT */     {AVDT_SCB_HDL_START_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* MSG_SUSPEND_REJ_EVT */   {AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* TC_TOUT_EVT */           {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* Event */
+/* Action 1                       Action 2                    Next state */
+/* API_REMOVE_EVT */
+{AVDT_SCB_SND_CLOSE_REQ,        AVDT_SCB_SET_REMOVE,        AVDT_SCB_CLOSING_ST},
+/* API_WRITE_REQ_EVT */
+{AVDT_SCB_FREE_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* API_GETCONFIG_REQ_EVT */
+{AVDT_SCB_SND_GETCONFIG_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* API_DELAY_RPT_REQ_EVT */
+{AVDT_SCB_SND_DELAY_RPT_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* API_SETCONFIG_REQ_EVT */
+{AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* API_OPEN_REQ_EVT */
+{AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* API_CLOSE_REQ_EVT */
+{AVDT_SCB_SND_CLOSE_REQ,        AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_RECONFIG_REQ_EVT */
+{AVDT_SCB_SND_RECONFIG_REQ,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* API_SECURITY_REQ_EVT */
+{AVDT_SCB_SND_SECURITY_REQ,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* API_ABORT_REQ_EVT */
+{AVDT_SCB_SND_ABORT_REQ,        AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_GETCONFIG_RSP_EVT */
+{AVDT_SCB_SND_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* API_SETCONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* API_SETCONFIG_REJ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* API_OPEN_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* API_CLOSE_RSP_EVT */
+{AVDT_SCB_SND_CLOSE_RSP,        AVDT_SCB_TC_TIMER,          AVDT_SCB_CLOSING_ST},
+/* API_RECONFIG_RSP_EVT */
+{AVDT_SCB_SND_RECONFIG_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* API_SECURITY_RSP_EVT */
+{AVDT_SCB_SND_SECURITY_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* API_ABORT_RSP_EVT */
+{AVDT_SCB_SND_ABORT_RSP,        AVDT_SCB_TC_TIMER,          AVDT_SCB_CLOSING_ST},
+/* MSG_SETCONFIG_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_GETCONFIG_CMD_EVT */
+{AVDT_SCB_HDL_GETCONFIG_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_OPEN_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_START_CMD_EVT */
+{AVDT_SCB_HDL_START_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_SUSPEND_CMD_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_CLOSE_CMD_EVT */
+{AVDT_SCB_HDL_CLOSE_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_ABORT_CMD_EVT */
+{AVDT_SCB_HDL_ABORT_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_RECONFIG_CMD_EVT */
+{AVDT_SCB_HDL_RECONFIG_CMD,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_SECURITY_CMD_EVT */
+{AVDT_SCB_HDL_SECURITY_CMD,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_DELAY_RPT_CMD_EVT */
+{AVDT_SCB_HDL_DELAY_RPT_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_DELAY_RPT_RSP_EVT */
+{AVDT_SCB_HDL_DELAY_RPT_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_SETCONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_GETCONFIG_RSP_EVT */
+{AVDT_SCB_HDL_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_OPEN_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_START_RSP_EVT */
+{AVDT_SCB_HDL_START_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_SUSPEND_RSP_EVT */
+{AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_CLOSE_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_ABORT_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* MSG_RECONFIG_RSP_EVT */
+{AVDT_SCB_HDL_RECONFIG_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_SECURITY_RSP_EVT */
+{AVDT_SCB_HDL_SECURITY_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_SETCONFIG_REJ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_OPEN_REJ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_START_REJ_EVT */
+{AVDT_SCB_HDL_START_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_SUSPEND_REJ_EVT */
+{AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* TC_TOUT_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
 #if (AVDT_REPORTING == TRUE)
-/* TC_OPEN_EVT */           {AVDT_SCB_HDL_TC_OPEN_STO,      AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* TC_CLOSE_EVT */          {AVDT_SCB_HDL_TC_CLOSE_STO,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* TC_OPEN_EVT */
+{AVDT_SCB_HDL_TC_OPEN_STO,      AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* TC_CLOSE_EVT */
+{AVDT_SCB_HDL_TC_CLOSE_STO,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
 #else
-/* TC_OPEN_EVT */           {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* TC_CLOSE_EVT */          {AVDT_SCB_HDL_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* TC_OPEN_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* TC_CLOSE_EVT */
+{AVDT_SCB_HDL_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
 #endif
-/* TC_CONG_EVT */           {AVDT_SCB_CONG_STATE,           AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* TC_DATA_EVT */           {AVDT_SCB_DROP_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
-/* CC_CLOSE_EVT */          {AVDT_SCB_SND_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST}
+/* TC_CONG_EVT */
+{AVDT_SCB_CONG_STATE,           AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* TC_DATA_EVT */
+{AVDT_SCB_DROP_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* CC_CLOSE_EVT */
+{AVDT_SCB_SND_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST}
 };
 
 /* state table for streaming state */
 const uint8_t avdt_scb_st_stream[][AVDT_SCB_NUM_COLS] = {
-/* Event                     Action 1                       Action 2                    Next state */
-/* API_REMOVE_EVT */        {AVDT_SCB_SND_STREAM_CLOSE,     AVDT_SCB_SET_REMOVE,        AVDT_SCB_CLOSING_ST},
-/* API_WRITE_REQ_EVT */     {AVDT_SCB_HDL_WRITE_REQ,        AVDT_SCB_CHK_SND_PKT,       AVDT_SCB_STREAM_ST},
-/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_SND_GETCONFIG_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_SND_DELAY_RPT_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* API_OPEN_REQ_EVT */      {AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* API_CLOSE_REQ_EVT */     {AVDT_SCB_SND_STREAM_CLOSE,     AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_RECONFIG_REQ_EVT */  {AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* API_SECURITY_REQ_EVT */  {AVDT_SCB_SND_SECURITY_REQ,     AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* API_ABORT_REQ_EVT */     {AVDT_SCB_SND_ABORT_REQ,        AVDT_SCB_CLR_PKT,           AVDT_SCB_CLOSING_ST},
-/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_SND_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* API_OPEN_RSP_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* API_CLOSE_RSP_EVT */     {AVDT_SCB_SND_CLOSE_RSP,        AVDT_SCB_TC_TIMER,          AVDT_SCB_CLOSING_ST},
-/* API_RECONFIG_RSP_EVT */  {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* API_SECURITY_RSP_EVT */  {AVDT_SCB_SND_SECURITY_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* API_ABORT_RSP_EVT */     {AVDT_SCB_SND_ABORT_RSP,        AVDT_SCB_TC_TIMER,          AVDT_SCB_CLOSING_ST},
-/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_HDL_GETCONFIG_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_OPEN_CMD_EVT */      {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_START_CMD_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_SUSPEND_CMD_EVT */   {AVDT_SCB_HDL_SUSPEND_CMD,      AVDT_SCB_CLR_PKT,           AVDT_SCB_OPEN_ST},
-/* MSG_CLOSE_CMD_EVT */     {AVDT_SCB_HDL_CLOSE_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_ABORT_CMD_EVT */     {AVDT_SCB_HDL_ABORT_CMD,        AVDT_SCB_CLR_PKT,           AVDT_SCB_STREAM_ST},
-/* MSG_RECONFIG_CMD_EVT */  {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_SECURITY_CMD_EVT */  {AVDT_SCB_HDL_SECURITY_CMD,     AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_HDL_DELAY_RPT_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_OPEN_RSP_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_START_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_SUSPEND_RSP_EVT */   {AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_CLR_PKT,           AVDT_SCB_OPEN_ST},
-/* MSG_CLOSE_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_ABORT_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_RECONFIG_RSP_EVT */  {AVDT_SCB_HDL_RECONFIG_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_SECURITY_RSP_EVT */  {AVDT_SCB_HDL_SECURITY_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_OPEN_REJ_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_START_REJ_EVT */     {AVDT_SCB_HDL_START_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_SUSPEND_REJ_EVT */   {AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* TC_TOUT_EVT */           {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* TC_OPEN_EVT */           {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* TC_CLOSE_EVT */          {AVDT_SCB_HDL_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* TC_CONG_EVT */           {AVDT_SCB_CONG_STATE,           AVDT_SCB_CHK_SND_PKT,       AVDT_SCB_STREAM_ST},
-/* TC_DATA_EVT */           {AVDT_SCB_HDL_PKT,              AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* CC_CLOSE_EVT */          {AVDT_SCB_SND_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST}
+/* Event */
+/* Action 1                       Action 2                    Next state */
+/* API_REMOVE_EVT */
+{AVDT_SCB_SND_STREAM_CLOSE,     AVDT_SCB_SET_REMOVE,        AVDT_SCB_CLOSING_ST},
+/* API_WRITE_REQ_EVT */
+{AVDT_SCB_HDL_WRITE_REQ,        AVDT_SCB_CHK_SND_PKT,       AVDT_SCB_STREAM_ST},
+/* API_GETCONFIG_REQ_EVT */
+{AVDT_SCB_SND_GETCONFIG_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* API_DELAY_RPT_REQ_EVT */
+{AVDT_SCB_SND_DELAY_RPT_REQ,    AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* API_SETCONFIG_REQ_EVT */
+{AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* API_OPEN_REQ_EVT */
+{AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* API_CLOSE_REQ_EVT */
+{AVDT_SCB_SND_STREAM_CLOSE,     AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_RECONFIG_REQ_EVT */
+{AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* API_SECURITY_REQ_EVT */
+{AVDT_SCB_SND_SECURITY_REQ,     AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* API_ABORT_REQ_EVT */
+{AVDT_SCB_SND_ABORT_REQ,        AVDT_SCB_CLR_PKT,           AVDT_SCB_CLOSING_ST},
+/* API_GETCONFIG_RSP_EVT */
+{AVDT_SCB_SND_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* API_SETCONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* API_SETCONFIG_REJ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* API_OPEN_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* API_CLOSE_RSP_EVT */
+{AVDT_SCB_SND_CLOSE_RSP,        AVDT_SCB_TC_TIMER,          AVDT_SCB_CLOSING_ST},
+/* API_RECONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* API_SECURITY_RSP_EVT */
+{AVDT_SCB_SND_SECURITY_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* API_ABORT_RSP_EVT */
+{AVDT_SCB_SND_ABORT_RSP,        AVDT_SCB_TC_TIMER,          AVDT_SCB_CLOSING_ST},
+/* MSG_SETCONFIG_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_GETCONFIG_CMD_EVT */
+{AVDT_SCB_HDL_GETCONFIG_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_OPEN_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_START_CMD_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_SUSPEND_CMD_EVT */
+{AVDT_SCB_HDL_SUSPEND_CMD,      AVDT_SCB_CLR_PKT,           AVDT_SCB_OPEN_ST},
+/* MSG_CLOSE_CMD_EVT */
+{AVDT_SCB_HDL_CLOSE_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_ABORT_CMD_EVT */
+{AVDT_SCB_HDL_ABORT_CMD,        AVDT_SCB_CLR_PKT,           AVDT_SCB_STREAM_ST},
+/* MSG_RECONFIG_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_SECURITY_CMD_EVT */
+{AVDT_SCB_HDL_SECURITY_CMD,     AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_DELAY_RPT_CMD_EVT */
+{AVDT_SCB_HDL_DELAY_RPT_CMD,    AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_DELAY_RPT_RSP_EVT */
+{AVDT_SCB_HDL_DELAY_RPT_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_SETCONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_GETCONFIG_RSP_EVT */
+{AVDT_SCB_HDL_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_OPEN_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_START_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_SUSPEND_RSP_EVT */
+{AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_CLR_PKT,           AVDT_SCB_OPEN_ST},
+/* MSG_CLOSE_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_ABORT_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_RECONFIG_RSP_EVT */
+{AVDT_SCB_HDL_RECONFIG_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_SECURITY_RSP_EVT */
+{AVDT_SCB_HDL_SECURITY_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_SETCONFIG_REJ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_OPEN_REJ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_START_REJ_EVT */
+{AVDT_SCB_HDL_START_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* MSG_SUSPEND_REJ_EVT */
+{AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* TC_TOUT_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* TC_OPEN_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* TC_CLOSE_EVT */
+{AVDT_SCB_HDL_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* TC_CONG_EVT */
+{AVDT_SCB_CONG_STATE,           AVDT_SCB_CHK_SND_PKT,       AVDT_SCB_STREAM_ST},
+/* TC_DATA_EVT */
+{AVDT_SCB_HDL_PKT,              AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
+/* CC_CLOSE_EVT */
+{AVDT_SCB_SND_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST}
 };
 
 /* state table for closing state */
 const uint8_t avdt_scb_st_closing[][AVDT_SCB_NUM_COLS] = {
-/* Event                     Action 1                       Action 2                    Next state */
-/* API_REMOVE_EVT */        {AVDT_SCB_SET_REMOVE,           AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_WRITE_REQ_EVT */     {AVDT_SCB_FREE_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_OPEN_REQ_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_CLOSE_REQ_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_RECONFIG_REQ_EVT */  {AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_SECURITY_REQ_EVT */  {AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_ABORT_REQ_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_OPEN_RSP_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_CLOSE_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_RECONFIG_RSP_EVT */  {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_SECURITY_RSP_EVT */  {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* API_ABORT_RSP_EVT */     {AVDT_SCB_SND_ABORT_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_OPEN_CMD_EVT */      {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_START_CMD_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_SUSPEND_CMD_EVT */   {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_CLOSE_CMD_EVT */     {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_ABORT_CMD_EVT */     {AVDT_SCB_HDL_ABORT_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_RECONFIG_CMD_EVT */  {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_SECURITY_CMD_EVT */  {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_OPEN_RSP_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_START_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_SUSPEND_RSP_EVT */   {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_CLOSE_RSP_EVT */     {AVDT_SCB_SND_TC_CLOSE,         AVDT_SCB_HDL_CLOSE_RSP,     AVDT_SCB_CLOSING_ST},
-/* MSG_ABORT_RSP_EVT */     {AVDT_SCB_SND_TC_CLOSE,         AVDT_SCB_HDL_ABORT_RSP,     AVDT_SCB_CLOSING_ST},
-/* MSG_RECONFIG_RSP_EVT */  {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_SECURITY_RSP_EVT */  {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_OPEN_REJ_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_START_REJ_EVT */     {AVDT_SCB_HDL_START_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* MSG_SUSPEND_REJ_EVT */   {AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* TC_TOUT_EVT */           {AVDT_SCB_SND_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* TC_OPEN_EVT */           {AVDT_SCB_SND_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* TC_CLOSE_EVT */          {AVDT_SCB_HDL_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
-/* TC_CONG_EVT */           {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* TC_DATA_EVT */           {AVDT_SCB_DROP_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
-/* CC_CLOSE_EVT */          {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST}
+/* Event */
+/* Action 1                       Action 2                    Next state */
+/* API_REMOVE_EVT */
+{AVDT_SCB_SET_REMOVE,           AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_WRITE_REQ_EVT */
+{AVDT_SCB_FREE_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_GETCONFIG_REQ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_DELAY_RPT_REQ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_SETCONFIG_REQ_EVT */
+{AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_OPEN_REQ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_CLOSE_REQ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_RECONFIG_REQ_EVT */
+{AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_SECURITY_REQ_EVT */
+{AVDT_SCB_CB_ERR,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_ABORT_REQ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_GETCONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_SETCONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_SETCONFIG_REJ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_OPEN_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_CLOSE_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_RECONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_SECURITY_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* API_ABORT_RSP_EVT */
+{AVDT_SCB_SND_ABORT_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_SETCONFIG_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_GETCONFIG_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_OPEN_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_START_CMD_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_SUSPEND_CMD_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_CLOSE_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_ABORT_CMD_EVT */
+{AVDT_SCB_HDL_ABORT_CMD,        AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_RECONFIG_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_SECURITY_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_DELAY_RPT_CMD_EVT */
+{AVDT_SCB_REJ_STATE,            AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_DELAY_RPT_RSP_EVT */
+{AVDT_SCB_HDL_DELAY_RPT_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_SETCONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_GETCONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_OPEN_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_START_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_SUSPEND_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_CLOSE_RSP_EVT */
+{AVDT_SCB_SND_TC_CLOSE,         AVDT_SCB_HDL_CLOSE_RSP,     AVDT_SCB_CLOSING_ST},
+/* MSG_ABORT_RSP_EVT */
+{AVDT_SCB_SND_TC_CLOSE,         AVDT_SCB_HDL_ABORT_RSP,     AVDT_SCB_CLOSING_ST},
+/* MSG_RECONFIG_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_SECURITY_RSP_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_SETCONFIG_REJ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_OPEN_REJ_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_START_REJ_EVT */
+{AVDT_SCB_HDL_START_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* MSG_SUSPEND_REJ_EVT */
+{AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* TC_TOUT_EVT */
+{AVDT_SCB_SND_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* TC_OPEN_EVT */
+{AVDT_SCB_SND_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* TC_CLOSE_EVT */
+{AVDT_SCB_HDL_TC_CLOSE,         AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
+/* TC_CONG_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* TC_DATA_EVT */
+{AVDT_SCB_DROP_PKT,             AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST},
+/* CC_CLOSE_EVT */
+{AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_CLOSING_ST}
 };
 
 /* type for state table */
diff --git a/stack/avdt/avdt_scb_act.cc b/stack/avdt/avdt_scb_act.cc
index 5244721..9432346 100644
--- a/stack/avdt/avdt_scb_act.cc
+++ b/stack/avdt/avdt_scb_act.cc
@@ -562,7 +562,8 @@
             p_scb->peer_seid = p_data->msg.config_cmd.int_seid;
             memcpy(&p_scb->req_cfg, p_cfg, sizeof(tAVDT_CFG));
             /* call app callback */
-            (*p_scb->cs.p_ctrl_cback)(avdt_scb_to_hdl(p_scb), /* handle of scb- which is same as sep handle of bta_av_cb.p_scb*/
+            /* handle of scb- which is same as sep handle of bta_av_cb.p_scb*/
+            (*p_scb->cs.p_ctrl_cback)(avdt_scb_to_hdl(p_scb),
                                       p_scb->p_ccb ? p_scb->p_ccb->peer_addr : NULL,
                                       AVDT_CONFIG_IND_EVT,
                                       (tAVDT_CTRL *) &p_data->msg.config_cmd);
@@ -586,7 +587,8 @@
  * Function         avdt_scb_hdl_setconfig_rej
  *
  * Description      This function marks the SCB as not in use and calls the
- *                  application callback with an open confirm indicating failure.
+ *                  application callback with an open confirm indicating
+ *                  failure.
  *
  * Returns          Nothing.
  *
@@ -715,8 +717,9 @@
  *                  initializes certain SCB parameters.  It then sends
  *                  an AVDT_CCB_UL_CLOSE_EVT to the CCB if the SCB
  *                  initiated the close.  It then checks to see if the SCB
- *                  is to be removed.  If it is it deallocates the SCB.  Finally,
- *                  it calls the application callback with a close indication.
+ *                  is to be removed.  If it is it deallocates the SCB.
+ *                  Finally, it calls the application callback with a close
+ *                  indication.
  *
  * Returns          Nothing.
  *
diff --git a/stack/avrc/avrc_api.cc b/stack/avrc/avrc_api.cc
index 0870938..d69f1d9 100644
--- a/stack/avrc/avrc_api.cc
+++ b/stack/avrc/avrc_api.cc
@@ -59,8 +59,10 @@
     AVRC_BROWSE_UNCONG_IND_EVT /* AVCT_BROWSE_UNCONG_IND_EVT  */
 };
 
-#define AVRC_OP_DROP        0xFE    /* use this unused opcode to indication no need to call the callback function */
-#define AVRC_OP_DROP_N_FREE 0xFD    /* use this unused opcode to indication no need to call the callback function & free buffer */
+/* use this unused opcode to indication no need to call the callback function */
+#define AVRC_OP_DROP        0xFE
+/* use this unused opcode to indication no need to call the callback function & free buffer */
+#define AVRC_OP_DROP_N_FREE 0xFD
 
 #define AVRC_OP_UNIT_INFO_RSP_LEN       8
 #define AVRC_OP_SUB_UNIT_INFO_RSP_LEN   8
@@ -1045,8 +1047,8 @@
  * Description      This function is called to open a connection to AVCTP.
  *                  The connection can be either an initiator or acceptor, as
  *                  determined by the p_ccb->stream parameter.
- *                  The connection can be a target, a controller or for both role,
- *                  as determined by the p_ccb->control parameter.
+ *                  The connection can be a target, a controller or for both
+ *                  role, as determined by the p_ccb->control parameter.
  *                  By definition, a target connection is an acceptor connection
  *                  that waits for an incoming AVCTP connection from the peer.
  *                  The connection remains available to the application until
@@ -1057,9 +1059,11 @@
  *                  Input Parameters:
  *                      p_ccb->company_id: Company Identifier.
  *
- *                      p_ccb->p_ctrl_cback:  Pointer to control callback function.
+ *                      p_ccb->p_ctrl_cback:  Pointer to control callback
+ *                                            function.
  *
- *                      p_ccb->p_msg_cback:  Pointer to message callback function.
+ *                      p_ccb->p_msg_cback:  Pointer to message callback
+ *                                            function.
  *
  *                      p_ccb->conn: AVCTP connection role.  This is set to
  *                      AVCTP_INT for initiator connections and AVCTP_ACP
@@ -1067,7 +1071,8 @@
  *
  *                      p_ccb->control: Control role.  This is set to
  *                      AVRC_CT_TARGET for target connections, AVRC_CT_CONTROL
- *                      for control connections or (AVRC_CT_TARGET|AVRC_CT_CONTROL)
+ *                      for control connections or
+ *                      (AVRC_CT_TARGET|AVRC_CT_CONTROL)
  *                      for connections that support both roles.
  *
  *                      peer_addr: BD address of peer device.  This value is
@@ -1140,9 +1145,9 @@
  *
  * Function         AVRC_OpenBrowse
  *
- * Description      This function is called to open a browsing connection to AVCTP.
- *                  The connection can be either an initiator or acceptor, as
- *                  determined by the p_conn_role.
+ * Description      This function is called to open a browsing connection to
+ *                  AVCTP. The connection can be either an initiator or
+ *                  acceptor, as determined by the p_conn_role.
  *                  The handle is returned by a previous call to AVRC_Open.
  *
  * Returns          AVRC_SUCCESS if successful.
@@ -1179,10 +1184,13 @@
  * Description      This function is used to send the AVRCP byte stream in p_pkt
  *                  down to AVCTP.
  *
- *                  It is expected that p_pkt->offset is at least AVCT_MSG_OFFSET
+ *                  It is expected that p_pkt->offset is at least
+ *                  AVCT_MSG_OFFSET
  *                  p_pkt->layer_specific is AVCT_DATA_CTRL or AVCT_DATA_BROWSE
- *                  p_pkt->event is AVRC_OP_VENDOR, AVRC_OP_PASS_THRU or AVRC_OP_BROWSE
- *                  The above BT_HDR settings are set by the AVRC_Bld* functions.
+ *                  p_pkt->event is AVRC_OP_VENDOR, AVRC_OP_PASS_THRU or
+ *                  AVRC_OP_BROWSE
+ *                  The above BT_HDR settings are set by the AVRC_Bld*
+ *                  functions.
  *
  * Returns          AVRC_SUCCESS if successful.
  *                  AVRC_BAD_HANDLE if handle is invalid.
@@ -1421,7 +1429,8 @@
  *                      handle: Handle of this connection.
  *
  *                      label: Transaction label.  Must be the same value as
- *                      passed with the command message in the callback function.
+ *                      passed with the command message in the callback
+ *                      function.
  *
  *                      p_msg: Pointer to PASS THROUGH message structure.
  *
diff --git a/stack/avrc/avrc_bld_ct.cc b/stack/avrc/avrc_bld_ct.cc
index b54d98f..916b770 100644
--- a/stack/avrc/avrc_bld_ct.cc
+++ b/stack/avrc/avrc_bld_ct.cc
@@ -183,7 +183,8 @@
  *
  * Function         avrc_bld_get_current_player_app_values_cmd
  *
- * Description      This function builds the get current player app setting values command.
+ * Description      This function builds the get current player app setting
+ *                  values command.
  *
  * Returns          AVRC_STS_NO_ERROR, if the command is built successfully
  *                  Otherwise, the error code.
@@ -211,7 +212,8 @@
  *
  * Function         avrc_bld_set_current_player_app_values_cmd
  *
- * Description      This function builds the set current player app setting values command.
+ * Description      This function builds the set current player app setting
+ *                  values command.
  *
  * Returns          AVRC_STS_NO_ERROR, if the command is built successfully
  *                  Otherwise, the error code.
@@ -242,7 +244,8 @@
  *
  * Function         avrc_bld_get_player_app_setting_attr_text_cmd
  *
- * Description      This function builds the get player app setting attribute text command.
+ * Description      This function builds the get player app setting attribute
+ *                  text command.
  *
  * Returns          AVRC_STS_NO_ERROR, if the command is built successfully
  *                  Otherwise, the error code.
@@ -271,7 +274,8 @@
  *
  * Function         avrc_bld_get_player_app_setting_value_text_cmd
  *
- * Description      This function builds the get player app setting value text command.
+ * Description      This function builds the get player app setting value
+ *                  text command.
  *
  * Returns          AVRC_STS_NO_ERROR, if the command is built successfully
  *                  Otherwise, the error code.
@@ -499,7 +503,8 @@
  * Description      This function initializes the command buffer based on PDU
  *
  * Returns          NULL, if no GKI buffer or failure to build the message.
- *                  Otherwise, the GKI buffer that contains the initialized message.
+ *                  Otherwise, the GKI buffer that contains the initialized
+ *                  message.
  *
  ******************************************************************************/
 static BT_HDR *avrc_bld_init_cmd_buffer(tAVRC_COMMAND *p_cmd)
diff --git a/stack/avrc/avrc_bld_tg.cc b/stack/avrc/avrc_bld_tg.cc
index 30b8b53..fa0d175 100644
--- a/stack/avrc/avrc_bld_tg.cc
+++ b/stack/avrc/avrc_bld_tg.cc
@@ -35,8 +35,8 @@
                (((_p_player)->play_status <= AVRC_PLAYSTATE_REV_SEEK) || \
                 ((_p_player)->play_status == AVRC_PLAYSTATE_ERROR)) )
 
-
-#define AVRC_MIN_LEN_GET_FOLDER_ITEMS_RSP   17 /* 17 = item_type(1) + item len(2) + min item (14) */
+ /* 17 = item_type(1) + item len(2) + min item (14) */
+#define AVRC_MIN_LEN_GET_FOLDER_ITEMS_RSP   17
 
 /*******************************************************************************
  *
@@ -221,8 +221,8 @@
  *
  * Function         avrc_bld_get_cur_app_setting_value_rsp
  *
- * Description      This function builds the Get Current Application Setting Value
- *                  response.
+ * Description      This function builds the Get Current Application Setting
+ *                  Value response.
  *
  * Returns          AVRC_STS_NO_ERROR, if the response is built successfully
  *                  Otherwise, the error code.
@@ -299,8 +299,8 @@
  *
  * Function         avrc_bld_app_setting_text_rsp
  *
- * Description      This function builds the Get Application Settings Attribute Text
- *                  or Get Application Settings Value Text response.
+ * Description      This function builds the Get Application Settings Attribute
+ *                  Text or Get Application Settings Value Text response.
  *
  * Returns          AVRC_STS_NO_ERROR, if the response is built successfully
  *                  Otherwise, the error code.
@@ -376,8 +376,8 @@
  *
  * Function         avrc_bld_get_app_setting_attr_text_rsp
  *
- * Description      This function builds the Get Application Setting Attribute Text
- *                  response.
+ * Description      This function builds the Get Application Setting Attribute
+ *                  Text response.
  *
  * Returns          AVRC_STS_NO_ERROR, if the response is built successfully
  *                  Otherwise, the error code.
@@ -701,8 +701,8 @@
         break;
 
     case AVRC_EVT_ADDR_PLAYER_CHANGE:       /* 0x0b */
-        UINT16_TO_BE_STREAM(p_data, p_rsp->param.addr_player.player_id); /* player_id */
-        UINT16_TO_BE_STREAM(p_data, p_rsp->param.addr_player.uid_counter); /* uid counter */
+        UINT16_TO_BE_STREAM(p_data, p_rsp->param.addr_player.player_id);
+        UINT16_TO_BE_STREAM(p_data, p_rsp->param.addr_player.uid_counter);
         len = 5;
         break;
 
@@ -961,7 +961,8 @@
  *                  This message goes through the Browsing channel
  *
  * Returns          AVRC_STS_NO_ERROR, if the response is built successfully
- *                  AVRC_STS_INTERNAL_ERR, if the given buffer does not have enough room
+ *                  AVRC_STS_INTERNAL_ERR, if the given buffer does not have
+ *                  enough room
  *                  Otherwise, the error code.
  *
  ******************************************************************************/
@@ -1207,7 +1208,8 @@
  *                  Browsing channel (already specified in the |p_pkt|)
  *
  * Returns          AVRC_STS_NO_ERROR, if the response is built successfully
- *                  AVRC_STS_INTERNAL_ERR, if the given buffer does not have enough room
+ *                  AVRC_STS_INTERNAL_ERR, if the given buffer does not have
+ *                  enough room
  *                  Otherwise, the error code.
  *
  ******************************************************************************/
@@ -1283,7 +1285,8 @@
  *                  This message goes through the Browsing channel
  *
  * Returns          AVRC_STS_NO_ERROR, if the response is built successfully
- *                  AVRC_STS_INTERNAL_ERR, if the given buffer does not have enough room
+ *                  AVRC_STS_INTERNAL_ERR, if the given buffer does not have
+ *                  enough room
  *                  Otherwise, the error code.
  *
  ******************************************************************************/
diff --git a/stack/avrc/avrc_opt.cc b/stack/avrc/avrc_opt.cc
index 77c6844..fb3348f 100644
--- a/stack/avrc/avrc_opt.cc
+++ b/stack/avrc/avrc_opt.cc
@@ -203,7 +203,8 @@
  *                      handle: Handle of this connection.
  *
  *                      label: Transaction label.  Must be the same value as
- *                      passed with the command message in the callback function.
+ *                      passed with the command message in the callback
+ *                      function.
  *
  *                      p_msg: Pointer to VENDOR DEPENDENT message structure.
  *
diff --git a/stack/avrc/avrc_pars_ct.cc b/stack/avrc/avrc_pars_ct.cc
index 7d6454e..dc68688 100644
--- a/stack/avrc/avrc_pars_ct.cc
+++ b/stack/avrc/avrc_pars_ct.cc
@@ -37,7 +37,8 @@
  * Description      This function parses the vendor specific commands defined by
  *                  Bluetooth SIG
  *
- * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
+ * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
+ *                  successfully.
  *                  Otherwise, the error code defined by AVRCP 1.4
  *
  ******************************************************************************/
@@ -405,7 +406,8 @@
  * Description      This function parses the vendor specific commands defined by
  *                  Bluetooth SIG
  *
- * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
+ * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
+ *                  successfully.
  *                  Otherwise, the error code defined by AVRCP 1.4
  *
  ******************************************************************************/
@@ -639,7 +641,8 @@
  *
  * Description      This function is a parse response for AVRCP Controller.
  *
- * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
+ * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
+ *                  successfully.
  *                  Otherwise, the error code defined by AVRCP 1.4
  *
  ******************************************************************************/
@@ -672,9 +675,11 @@
  *
  * Function         AVRC_ParsResponse
  *
- * Description      This function is a superset of AVRC_ParsMetadata to parse the response.
+ * Description      This function is a superset of AVRC_ParsMetadata to parse
+ *                  the response.
  *
- * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
+ * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
+ *                  successfully.
  *                  Otherwise, the error code defined by AVRCP 1.4
  *
  ******************************************************************************/
diff --git a/stack/avrc/avrc_pars_tg.cc b/stack/avrc/avrc_pars_tg.cc
index a1a4161..c4dde79 100644
--- a/stack/avrc/avrc_pars_tg.cc
+++ b/stack/avrc/avrc_pars_tg.cc
@@ -34,7 +34,8 @@
  * Description      This function parses the vendor specific commands defined by
  *                  Bluetooth SIG for AVRCP Conroller.
  *
- * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
+ * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
+ *                  successfully.
  *                  Otherwise, the error code defined by AVRCP 1.4
  *
  ******************************************************************************/
@@ -93,7 +94,8 @@
  * Description      This function parses the vendor specific commands defined by
  *                  Bluetooth SIG
  *
- * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
+ * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
+ *                  successfully.
  *                  Otherwise, the error code defined by AVRCP 1.4
  *
  ******************************************************************************/
@@ -378,9 +380,11 @@
  * Function         AVRC_Ctrl_ParsCommand
  *
  * Description      This function is used to parse cmds received for CTRL
- *                  Currently it is for SetAbsVolume and Volume Change Notification..
+ *                  Currently it is for SetAbsVolume and Volume Change
+ *                  Notification..
  *
- * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
+ * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
+ *                  successfully.
  *                  Otherwise, the error code defined by AVRCP 1.4
  *
  ******************************************************************************/
@@ -414,7 +418,8 @@
  * Description      This function parses the commands that go through the
  *                  browsing channel
  *
- * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
+ * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
+ *                  successfully.
  *                  Otherwise, the error code defined by AVRCP+1
  *
  ******************************************************************************/
@@ -545,9 +550,11 @@
  *
  * Function         AVRC_ParsCommand
  *
- * Description      This function is a superset of AVRC_ParsMetadata to parse the command.
+ * Description      This function is a superset of AVRC_ParsMetadata to parse
+ *                  the command.
  *
- * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
+ * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
+ *                  successfully.
  *                  Otherwise, the error code defined by AVRCP 1.4
  *
  ******************************************************************************/
diff --git a/stack/avrc/avrc_sdp.cc b/stack/avrc/avrc_sdp.cc
index e345c32..3a63798 100644
--- a/stack/avrc/avrc_sdp.cc
+++ b/stack/avrc/avrc_sdp.cc
@@ -64,23 +64,24 @@
  *
  * Function         AVRC_FindService
  *
- * Description      This function is called by the application to perform service
- *                  discovery and retrieve AVRCP SDP record information from a
- *                  peer device.  Information is returned for the first service
- *                  record found on the server that matches the service UUID.
- *                  The callback function will be executed when service discovery
- *                  is complete.  There can only be one outstanding call to
- *                  AVRC_FindService() at a time; the application must wait for
- *                  the callback before it makes another call to the function.
- *                  The application is responsible for allocating memory for the
- *                  discovery database.  It is recommended that the size of the
- *                  discovery database be at least 300 bytes.  The application
- *                  can deallocate the memory after the callback function has
- *                  executed.
+ * Description      This function is called by the application to perform
+ *                  service discovery and retrieve AVRCP SDP record information
+ *                  from a peer device.  Information is returned for the first
+ *                  service record found on the server that matches the service
+ *                  UUID. The callback function will be executed when service
+ *                  discovery is complete.  There can only be one outstanding
+ *                  call to AVRC_FindService() at a time; the application must
+ *                  wait for the callback before it makes another call to the
+ *                  function.  The application is responsible for allocating
+ *                  memory for the discovery database.  It is recommended that
+ *                  the size of the discovery database be at least 300 bytes.
+ *                  The application can deallocate the memory after the
+ *                  callback function has executed.
  *
  *                  Input Parameters:
- *                      service_uuid: Indicates TG(UUID_SERVCLASS_AV_REM_CTRL_TARGET)
- *                                           or CT(UUID_SERVCLASS_AV_REMOTE_CONTROL)
+ *                      service_uuid: Indicates
+ *                                       TG(UUID_SERVCLASS_AV_REM_CTRL_TARGET)
+ *                                     r CT(UUID_SERVCLASS_AV_REMOTE_CONTROL)
  *
  *                      bd_addr:  BD address of the peer device.
  *
@@ -92,7 +93,8 @@
  *                      None.
  *
  * Returns          AVRC_SUCCESS if successful.
- *                  AVRC_BAD_PARAMS if discovery database parameters are invalid.
+ *                  AVRC_BAD_PARAMS if discovery database parameters are
+ *                  invalid.
  *                  AVRC_NO_RESOURCES if there are not enough resources to
  *                                    perform the service search.
  *
@@ -155,8 +157,9 @@
  *                  call SDP_CreateRecord() to create an SDP record.
  *
  *                  Input Parameters:
- *                      service_uuid:  Indicates TG(UUID_SERVCLASS_AV_REM_CTRL_TARGET)
- *                                            or CT(UUID_SERVCLASS_AV_REMOTE_CONTROL)
+ *                      service_uuid:  Indicates
+ *                                        TG(UUID_SERVCLASS_AV_REM_CTRL_TARGET)
+ *                                     or CT(UUID_SERVCLASS_AV_REMOTE_CONTROL)
  *
  *                      p_service_name:  Pointer to a null-terminated character
  *                      string containing the service name.
@@ -178,7 +181,8 @@
  *                      None.
  *
  * Returns          AVRC_SUCCESS if successful.
- *                  AVRC_NO_RESOURCES if not enough resources to build the SDP record.
+ *                  AVRC_NO_RESOURCES if not enough resources to build the SDP
+ *                                    record.
  *
  *****************************************************************************/
 uint16_t AVRC_AddRecord(uint16_t service_uuid, const char *p_service_name,
diff --git a/stack/avrc/avrc_utils.cc b/stack/avrc/avrc_utils.cc
index 78f2b11..fe65ead 100644
--- a/stack/avrc/avrc_utils.cc
+++ b/stack/avrc/avrc_utils.cc
@@ -168,7 +168,8 @@
  * Description      This function parses the pass thru commands defined by
  *                  Bluetooth SIG
  *
- * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
+ * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
+ *                                     successfully.
  *                  Otherwise, the error code defined by AVRCP 1.4
  *
  ******************************************************************************/
diff --git a/stack/bnep/bnep_api.cc b/stack/bnep/bnep_api.cc
index 1f7bae7..6c5b867 100644
--- a/stack/bnep/bnep_api.cc
+++ b/stack/bnep/bnep_api.cc
@@ -34,7 +34,8 @@
  * Function         BNEP_Init
  *
  * Description      This function initializes the BNEP unit. It should be called
- *                  before accessing any other APIs to initialize the control block
+ *                  before accessing any other APIs to initialize the control
+ *                  block.
  *
  * Returns          void
  *
@@ -125,7 +126,8 @@
  * Parameters:      p_rem_addr  - BD_ADDR of the peer
  *                  src_uuid    - source uuid for the connection
  *                  dst_uuid    - destination uuid for the connection
- *                  p_handle    - pointer to return the handle for the connection
+ *                  p_handle    - pointer to return the handle for the
+ *                                connection
  *
  * Returns          BNEP_SUCCESS                if connection started
  *                  BNEP_NO_RESOURCES           if no resources
@@ -344,12 +346,14 @@
  *                  p_dest_addr  - BD_ADDR/Ethernet addr of the destination
  *                  p_buf        - pointer to address of buffer with data
  *                  protocol     - protocol type of the packet
- *                  p_src_addr   - (optional) BD_ADDR/ethernet address of the source
+ *                  p_src_addr   - (optional) BD_ADDR/ethernet address of the
+ *                                 source
  *                                 (should be NULL if it is local BD Addr)
  *                  fw_ext_present - forwarded extensions present
  *
  * Returns:         BNEP_WRONG_HANDLE       - if passed handle is not valid
- *                  BNEP_MTU_EXCEDED        - If the data length is greater than MTU
+ *                  BNEP_MTU_EXCEDED        - If the data length is greater than
+ *                                            the MTU
  *                  BNEP_IGNORE_CMD         - If the packet is filtered out
  *                  BNEP_Q_SIZE_EXCEEDED    - If the Tx Q is full
  *                  BNEP_SUCCESS            - If written successfully
@@ -455,12 +459,14 @@
  *                  p_dest_addr  - BD_ADDR/Ethernet addr of the destination
  *                  p_data       - pointer to data start
  *                  protocol     - protocol type of the packet
- *                  p_src_addr   - (optional) BD_ADDR/ethernet address of the source
+ *                  p_src_addr   - (optional) BD_ADDR/ethernet address of the
+ *                                 source
  *                                 (should be NULL if it is local BD Addr)
  *                  fw_ext_present - forwarded extensions present
  *
  * Returns:         BNEP_WRONG_HANDLE       - if passed handle is not valid
- *                  BNEP_MTU_EXCEDED        - If the data length is greater than MTU
+ *                  BNEP_MTU_EXCEDED        - If the data length is greater than
+ *                                            the MTU
  *                  BNEP_IGNORE_CMD         - If the packet is filtered out
  *                  BNEP_Q_SIZE_EXCEEDED    - If the Tx Q is full
  *                  BNEP_NO_RESOURCES       - If not able to allocate a buffer
@@ -567,8 +573,10 @@
  *                  p_start_array - Array of beginings of all protocol ranges
  *                  p_end_array   - Array of ends of all protocol ranges
  *
- * Returns          BNEP_WRONG_HANDLE           - if the connection handle is not valid
- *                  BNEP_SET_FILTER_FAIL        - if the connection is in wrong state
+ * Returns          BNEP_WRONG_HANDLE           - if the connection handle is
+ *                                                not valid
+ *                  BNEP_SET_FILTER_FAIL        - if the connection is in wrong
+ *                                                state
  *                  BNEP_TOO_MANY_FILTERS       - if too many filters
  *                  BNEP_SUCCESS                - if request sent successfully
  *
@@ -617,7 +625,8 @@
  *
  * Function         BNEP_SetMulticastFilters
  *
- * Description      This function sets the filters for multicast addresses for BNEP.
+ * Description      This function sets the filters for multicast addresses for
+ *                  BNEP.
  *
  * Parameters:      handle        - Handle for the connection
  *                  num_filters   - total number of filter ranges
@@ -626,8 +635,10 @@
  *                  p_end_array   - Pointer to sequence of ends of all
  *                                         multicast address ranges
  *
- * Returns          BNEP_WRONG_HANDLE           - if the connection handle is not valid
- *                  BNEP_SET_FILTER_FAIL        - if the connection is in wrong state
+ * Returns          BNEP_WRONG_HANDLE           - if the connection handle is
+ *                                                not valid
+ *                  BNEP_SET_FILTER_FAIL        - if the connection is in wrong
+ *                                                state
  *                  BNEP_TOO_MANY_FILTERS       - if too many filters
  *                  BNEP_SUCCESS                - if request sent successfully
  *
@@ -697,10 +708,12 @@
  *
  * Function         BNEP_GetStatus
  *
- * Description      This function gets the status information for BNEP connection
+ * Description      This function gets the status information for BNEP
+ *                  connection
  *
  * Returns          BNEP_SUCCESS            - if the status is available
- *                  BNEP_NO_RESOURCES       - if no structure is passed for output
+ *                  BNEP_NO_RESOURCES       - if no structure is passed for
+ *                                            output
  *                  BNEP_WRONG_HANDLE       - if the handle is invalid
  *                  BNEP_WRONG_STATE        - if not in connected state
  *
diff --git a/stack/bnep/bnep_int.h b/stack/bnep/bnep_int.h
index 91d3dd1..438b357 100644
--- a/stack/bnep/bnep_int.h
+++ b/stack/bnep/bnep_int.h
@@ -81,10 +81,11 @@
 /* 802.1p protocol packet will have actual protocol field in side the payload */
 #define BNEP_802_1_P_PROTOCOL           0x8100
 
-/* Timeout definitions.
-*/
-#define BNEP_CONN_TIMEOUT_MS        (20 * 1000)      /* Connection related timeout */
-#define BNEP_HOST_TIMEOUT_MS        (200 * 1000)     /* host responce timeout */
+/* Timeout definitions.  */
+/* Connection related timeout */
+#define BNEP_CONN_TIMEOUT_MS        (20 * 1000)
+/* host response timeout */
+#define BNEP_HOST_TIMEOUT_MS        (200 * 1000)
 #define BNEP_FILTER_SET_TIMEOUT_MS  (10 * 1000)
 
 /* Define the Out-Flow default values. */
diff --git a/stack/bnep/bnep_main.cc b/stack/bnep/bnep_main.cc
index bd25d2b..caad414 100644
--- a/stack/bnep/bnep_main.cc
+++ b/stack/bnep/bnep_main.cc
@@ -50,14 +50,14 @@
 extern fixed_queue_t *btu_general_alarm_queue;
 
 /******************************************************************************/
-/*                       G L O B A L    B N E P       D A T A                   */
+/*                     G L O B A L    B N E P       D A T A                   */
 /******************************************************************************/
 tBNEP_CB bnep_cb;
 
 const uint16_t bnep_frame_hdr_sizes[] = {14, 1, 2, 8, 8};
 
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 static void bnep_connect_ind (BD_ADDR  bd_addr, uint16_t l2cap_cid, uint16_t psm, uint8_t l2cap_id);
 static void bnep_connect_cfm (uint16_t l2cap_cid, uint16_t result);
@@ -467,7 +467,7 @@
  *
  * Description      This function is called when data is received from L2CAP.
  *                  if we are the originator of the connection, we are the SDP
- *                  client, and the received message is queued up for the client.
+ *                  client, and the received message is queued for the client.
  *
  *                  If we are the destination of the connection, we are the SDP
  *                  server, so the message is passed to the server processing
diff --git a/stack/bnep/bnep_utils.cc b/stack/bnep/bnep_utils.cc
index 83627cf..ecae262 100644
--- a/stack/bnep/bnep_utils.cc
+++ b/stack/bnep/bnep_utils.cc
@@ -37,7 +37,7 @@
 extern fixed_queue_t *btu_general_alarm_queue;
 
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 static uint8_t *bnepu_init_hdr (BT_HDR *p_buf, uint16_t hdr_len, uint8_t pkt_type);
 
@@ -1349,9 +1349,9 @@
  *
  * Function         bnep_get_uuid32
  *
- * Description      This function returns the 32 bit equivalent of the given UUID
+ * Description      This function returns the 32-bit equivalent of the UUID
  *
- * Returns          uint32_t        - 32 bit equivalent of the UUID
+ * Returns          uint32_t - 32-bit equivalent of the UUID
  *
  ******************************************************************************/
 uint32_t bnep_get_uuid32 (tBT_UUID *src_uuid)
diff --git a/stack/btm/btm_acl.cc b/stack/btm/btm_acl.cc
index 757753c..cfe333b 100644
--- a/stack/btm/btm_acl.cc
+++ b/stack/btm/btm_acl.cc
@@ -78,15 +78,17 @@
 
 /*******************************************************************************
  *
- * Function         btm_bda_to_acl
+ * Function        btm_bda_to_acl
  *
- * Description      This function returns the FIRST acl_db entry for the passed BDA.
+ * Description     This function returns the FIRST acl_db entry for the passed
+ *                 BDA.
  *
  * Parameters      bda : BD address of the remote device
- *                 transport : Physical transport used for ACL connection (BR/EDR or LE)
+ *                 transport : Physical transport used for ACL connection
+ *                 (BR/EDR or LE)
  *
- * Returns          Returns pointer to the ACL DB for the requested BDA if found.
- *                  NULL if not found.
+ * Returns         Returns pointer to the ACL DB for the requested BDA if found.
+ *                 NULL if not found.
  *
  ******************************************************************************/
 tACL_CONN *btm_bda_to_acl (const BD_ADDR bda, tBT_TRANSPORT transport)
@@ -114,7 +116,8 @@
  *
  * Function         btm_handle_to_acl_index
  *
- * Description      This function returns the FIRST acl_db entry for the passed hci_handle.
+ * Description      This function returns the FIRST acl_db entry for the passed
+ *                  hci_handle.
  *
  * Returns          index to the acl_db or MAX_L2CAP_LINKS.
  *
@@ -464,8 +467,8 @@
  *
  * Function         btm_acl_update_busy_level
  *
- * Description      This function is called to update the busy level of the system
- *                  .
+ * Description      This function is called to update the busy level of the
+ *                  system.
  *
  * Returns          void
  *
@@ -567,9 +570,11 @@
  *
  * Returns          BTM_SUCCESS if already in specified role.
  *                  BTM_CMD_STARTED if command issued to controller.
- *                  BTM_NO_RESOURCES if couldn't allocate memory to issue command
+ *                  BTM_NO_RESOURCES if couldn't allocate memory to issue
+ *                                   command
  *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
- *                  BTM_MODE_UNSUPPORTED if local device does not support role switching
+ *                  BTM_MODE_UNSUPPORTED if local device does not support role
+ *                                       switching
  *                  BTM_BUSY if the previous command is not completed
  *
  ******************************************************************************/
@@ -782,8 +787,8 @@
 {
     tACL_CONN   *p;
     uint8_t     *localFeatures = BTM_ReadLocalFeatures();
-    BTM_TRACE_DEBUG ("BTM_SetLinkPolicy");
-/*    BTM_TRACE_API ("BTM_SetLinkPolicy: requested settings: 0x%04x", *settings ); */
+    BTM_TRACE_DEBUG ("%s", __func__);
+/*  BTM_TRACE_API ("%s: requested settings: 0x%04x", __func__, *settings ); */
 
     /* First, check if hold mode is supported */
     if (*settings != HCI_DISABLE_ALL_LM_MODES)
@@ -1002,8 +1007,8 @@
  *
  * Function         btm_read_remote_features
  *
- * Description      Local function called to send a read remote supported features/
- *                  remote extended features page[0].
+ * Description      Local function called to send a read remote supported
+ *                  features/remote extended features page[0].
  *
  * Returns          void
  *
@@ -1036,7 +1041,8 @@
  *
  * Function         btm_read_remote_ext_features
  *
- * Description      Local function called to send a read remote extended features
+ * Description      Local function called to send a read remote extended
+ *                  features
  *
  * Returns          void
  *
@@ -1211,7 +1217,8 @@
  * Function         btm_establish_continue
  *
  * Description      This function is called when the command complete message
- *                  is received from the HCI for the read local link policy request.
+ *                  is received from the HCI for the read local link policy
+ *                  request.
  *
  * Returns          void
  *
@@ -1255,7 +1262,8 @@
  *
  * Function         BTM_SetDefaultLinkSuperTout
  *
- * Description      Set the default value for HCI "Write Link Supervision Timeout"
+ * Description      Set the default value for HCI "Write Link Supervision
+ *                                                 Timeout"
  *                  command to use when an ACL link is created.
  *
  * Returns          void
@@ -1397,8 +1405,8 @@
  *
  * Function         BTM_GetHCIConnHandle
  *
- * Description      This function is called to get the handle for an ACL connection
- *                  to a specific remote BD Address.
+ * Description      This function is called to get the handle for an ACL
+ *                  connection to a specific remote BD Address.
  *
  * Returns          the handle of the connection, or 0xFFFF if none.
  *
@@ -1443,10 +1451,10 @@
  *
  * Function         btm_acl_role_changed
  *
- * Description      This function is called whan a link's master/slave role change
- *                  event or command status event (with error) is received.
- *                  It updates the link control block, and calls
- *                  the registered callback with status and role (if registered).
+ * Description      This function is called whan a link's master/slave role
+ *                  change event or command status event (with error) is
+ *                  received. It updates the link control block, and calls the
+ *                  registered callback with status and role (if registered).
  *
  * Returns          void
  *
@@ -1958,7 +1966,8 @@
  * Function         BTM_ReadRSSI
  *
  * Description      This function is called to read the link policy settings.
- *                  The address of link policy results are returned in the callback.
+ *                  The address of link policy results are returned in the
+ *                  callback.
  *                  (tBTM_RSSI_RESULTS)
  *
  * Returns          BTM_CMD_STARTED if successfully initiated or error code
@@ -2316,7 +2325,8 @@
  *
  * Description      This function is called to disconnect an ACL connection
  *
- * Returns          BTM_SUCCESS if successfully initiated, otherwise BTM_NO_RESOURCES.
+ * Returns          BTM_SUCCESS if successfully initiated, otherwise
+ *                  BTM_NO_RESOURCES.
  *
  ******************************************************************************/
 tBTM_STATUS btm_remove_acl (BD_ADDR bd_addr, tBT_TRANSPORT transport)
@@ -2452,7 +2462,8 @@
  *
  * Function         btm_acl_reset_paging
  *
- * Description      set paging to false and free the page queue - called at hci_reset
+ * Description      set paging to false and free the page queue - called at
+ *                  hci_reset
  *
  ******************************************************************************/
 void  btm_acl_reset_paging (void)
diff --git a/stack/btm/btm_ble.cc b/stack/btm/btm_ble.cc
index ff52bce..9753619 100644
--- a/stack/btm/btm_ble.cc
+++ b/stack/btm/btm_ble.cc
@@ -47,7 +47,7 @@
                                                  uint16_t tlen, uint8_t *p_signature);
 
 /******************************************************************************/
-/* External Function to be called by other modules                             */
+/* External Function to be called by other modules                            */
 /******************************************************************************/
 /********************************************************
  *
@@ -58,7 +58,7 @@
  *                  for a LE device stored in the NVRAM.
  *
  * Parameters:      bd_addr          - BD address of the peer
- *                  bd_name          - Name of the peer device.  NULL if unknown.
+ *                  bd_name          - Name of the peer device. NULL if unknown.
  *                  dev_type         - Remote device's device type.
  *                  addr_type        - LE device address type.
  *
@@ -165,10 +165,11 @@
  *
  * Description      Local local identity key, encryption root or sign counter.
  *
- * Parameters:      key_type: type of key, can be BTM_BLE_KEY_TYPE_ID, BTM_BLE_KEY_TYPE_ER
- *                            or BTM_BLE_KEY_TYPE_COUNTER.
+ * Parameters:      key_type: type of key, can be BTM_BLE_KEY_TYPE_ID,
+ *                                                BTM_BLE_KEY_TYPE_ER
+ *                                             or BTM_BLE_KEY_TYPE_COUNTER.
  *                  p_key: pointer to the key.
-*
+ *
  * Returns          non2.
  *
  ******************************************************************************/
@@ -250,8 +251,8 @@
  *
  * Function         BTM_ReadConnectionAddr
  *
- * Description      This function is called to get the local device address information
- *                  .
+ * Description      This function is called to get the local device address
+ *                  information.
  *
  * Returns          void
  *
@@ -300,15 +301,16 @@
 
 /*******************************************************************************
  *
- * Function         BTM_ReadRemoteConnectionAddr
+ * Function       BTM_ReadRemoteConnectionAddr
  *
- * Description      This function is read the remote device address currently used
+ * Description    This function is read the remote device address currently used
  *
  * Parameters     pseudo_addr: pseudo random address available
  *                conn_addr:connection address used
- *                p_addr_type : BD Address type, Public or Random of the address used
+ *                p_addr_type : BD Address type, Public or Random of the address
+ *                              used
  *
- * Returns          bool    , true if connection to remote device exists, else false
+ * Returns        bool, true if connection to remote device exists, else false
  *
  ******************************************************************************/
 bool    BTM_ReadRemoteConnectionAddr(BD_ADDR pseudo_addr, BD_ADDR conn_addr,
@@ -347,7 +349,8 @@
  *
  * Parameters       bd_addr - peer device bd address.
  *                  res     - result of the operation BTM_SUCCESS if success.
- *                            Otherwise, BTM_REPEATED_ATTEMPTS is too many attempts.
+ *                            Otherwise, BTM_REPEATED_ATTEMPTS if too many
+ *                            attempts.
  *
  * Returns          None
  *
@@ -366,11 +369,13 @@
  * Description      This function is called after Security Manager submitted
  *                  passkey request to the application.
  *
- * Parameters:      bd_addr      - Address of the device for which passkey was requested
- *                  res          - result of the operation BTM_SUCCESS if success
- *                  key_len      - length in bytes of the Passkey
- *                  p_passkey        - pointer to array with the passkey
- *                  trusted_mask - bitwise OR of trusted services (array of uint32_t)
+ * Parameters:      bd_addr - Address of the device for which passkey was
+ *                            requested
+ *                  res     - result of the operation BTM_SUCCESS if success
+ *                  key_len - length in bytes of the Passkey
+ *                  p_passkey    - pointer to array with the passkey
+ *                  trusted_mask - bitwise OR of trusted services (array of
+ *                                 uint32_t)
  *
  ******************************************************************************/
 void BTM_BlePasskeyReply (BD_ADDR bd_addr, uint8_t res, uint32_t passkey)
@@ -426,7 +431,8 @@
  *
  * Parameters:      bd_addr     - Address of the peer device
  *                  res         - result of the operation SMP_SUCCESS if success
- *                  p_data      - oob data, depending on transport and capabilities.
+ *                  p_data      - oob data, depending on transport and
+ *                                capabilities.
  *                                Might be "Simple Pairing Randomizer", or
  *                                "Security Manager TK Value".
  *
@@ -666,10 +672,11 @@
  *
  * Function         BTM_ReadConnectedTransportAddress
  *
- * Description      This function is called to read the paired device/address type of other device paired
- *                  corresponding to the BD_address
+ * Description      This function is called to read the paired device/address
+ *                  type of other device paired corresponding to the BD_address
  *
- * Parameter        remote_bda: remote device address, carry out the transport address
+ * Parameter        remote_bda: remote device address, carry out the transport
+ *                              address
  *                  transport: active transport
  *
  * Return           true if an active link is identified; false otherwise
@@ -735,7 +742,8 @@
  * Description      This function is called to start the LE Transmitter test
  *
  * Parameter       tx_freq - Frequency Range
- *                       test_data_len - Length in bytes of payload data in each packet
+ *                       test_data_len - Length in bytes of payload data in each
+ *                                       packet
  *                       packet_payload - Pattern to use in the payload
  *                       p_cmd_cmpl_cback - Command Complete callback
  *
@@ -751,7 +759,8 @@
  *
  * Function         BTM_BleTestEnd
  *
- * Description      This function is called to stop the in-progress TX or RX test
+ * Description      This function is called to stop the in-progress TX or RX
+ *                  test
  *
  * Parameter       p_cmd_cmpl_cback - Command complete callback
  *
@@ -782,7 +791,8 @@
  *
  * Function         BTM_UseLeLink
  *
- * Description      This function is to select the underneath physical link to use.
+ * Description      This function is to select the underlying physical link to
+ *                  use.
  *
  * Returns          true to use LE, false use BR/EDR.
  *
@@ -956,7 +966,8 @@
  *                  p_callback : Pointer to the callback function.
  *                  p_ref_data : Pointer to be returned along with the callback.
  *
- * Returns          true if link already meets the required security; otherwise false.
+ * Returns          true if link already meets the required security; otherwise
+ *                  false.
  *
  ******************************************************************************/
 bool    btm_ble_start_sec_check(BD_ADDR bd_addr, uint16_t psm, bool    is_originator,
@@ -1052,10 +1063,12 @@
             else
                 params.param_len = BT_OCTET16_LEN;
 
-            memcpy(p_dest, p, params.param_len);  /* Fetch return info from HCI event message */
+            /* Fetch return info from HCI event message */
+            memcpy(p_dest, p, params.param_len);
         }
         if (p_enc_cplt_cback)
-            (*p_enc_cplt_cback)(&params);  /* Call the Encryption complete callback function */
+            /* Call the Encryption complete callback function */
+            (*p_enc_cplt_cback)(&params);
     }
 }
 
@@ -1091,8 +1104,8 @@
  *
  * Function         btm_ble_get_enc_key_type
  *
- * Description      This function is to get the BLE key type that has been exchanged
- *                  in betweem local device and peer device.
+ * Description      This function is to get the BLE key type that has been
+ *                  exchanged betweem the local device and the peer device.
  *
  * Returns          p_key_type: output parameter to carry the key type value.
  *
@@ -1150,7 +1163,8 @@
  * Description      This function is called by the SMP to update
  *                  an  BLE key.  SMP is internal, whereas all the keys shall
  *                  be sent to the application.  The function is also called
- *                  when application passes ble key stored in NVRAM to the btm_sec.
+ *                  when application passes ble key stored in NVRAM to the
+ *                  btm_sec.
  *                  pass_to_application parameter is false in this case.
  *
  * Returns          void
@@ -1397,7 +1411,8 @@
         }
         else
         {
-            *p_sec_req_act = BTM_BLE_SEC_REQ_ACT_PAIR; /* start the pariring process to upgrade the keys*/
+            /* start the pariring process to upgrade the keys*/
+            *p_sec_req_act = BTM_BLE_SEC_REQ_ACT_PAIR;
         }
     }
 
@@ -1575,7 +1590,8 @@
  *
  * Function         btm_ble_link_encrypted
  *
- * Description      This function is called when LE link encrption status is changed.
+ * Description      This function is called when LE link encrption status is
+ *                  changed.
  *
  * Returns          void
  *
@@ -1619,7 +1635,8 @@
  *
  * Function         btm_ble_ltk_request_reply
  *
- * Description      This function is called to send a LTK request reply on a slave
+ * Description      This function is called to send a LTK request reply on a
+ *                  slave
  *                  device.
  *
  * Returns          void
@@ -1658,7 +1675,8 @@
  *
  * Function         btm_ble_io_capabilities_req
  *
- * Description      This function is called to handle SMP get IO capability request.
+ * Description      This function is called to handle SMP get IO capability
+ *                  request.
  *
  * Returns          void
  *
@@ -1766,7 +1784,8 @@
  *
  * Function         btm_ble_resolve_random_addr_on_conn_cmpl
  *
- * Description      resolve random address complete on connection complete event.
+ * Description      resolve random address complete on connection complete
+ *                  event.
  *
  * Returns          void
  *
@@ -2306,7 +2325,8 @@
  * Description      This function indicates if LE security procedure is
  *                  currently running with the peer.
  *
- * Returns          bool    true if security procedure is running, false otherwise.
+ * Returns          bool    true if security procedure is running, false
+ *                  otherwise.
  *
  ******************************************************************************/
 bool    BTM_BleSecurityProcedureIsRunning(BD_ADDR bd_addr)
@@ -2548,7 +2568,8 @@
  *
  * Function         btm_ble_process_ir2
  *
- * Description      This function is called when IR is generated, proceed to calculate
+ * Description      This function is called when IR is generated, proceed to
+ *                  calculate
  *                  DHK = Eir({0x03, 0, 0 ...})
  *
  *
@@ -2584,7 +2605,8 @@
  *
  * Function         btm_ble_process_ir
  *
- * Description      This function is called when IR is generated, proceed to calculate
+ * Description      This function is called when IR is generated, proceed to
+ *                  calculate
  *                  DHK = Eir({0x02, 0, 0 ...})
  *
  *
@@ -2626,7 +2648,7 @@
  *
  * Function         btm_ble_set_no_disc_if_pair_fail
  *
- * Description      This function indicates that whether no disconnect of the ACL
+ * Description      This function indicates whether no disconnect of the ACL
  *                  should be used if pairing failed
  *
  * Returns          void
diff --git a/stack/btm/btm_ble_addr.cc b/stack/btm/btm_ble_addr.cc
index 894c588..e54fe6f 100644
--- a/stack/btm/btm_ble_addr.cc
+++ b/stack/btm/btm_ble_addr.cc
@@ -255,7 +255,8 @@
  *
  * Function         btm_ble_addr_resolvable
  *
- * Description      This function checks if a RPA is resolvable by the device key.
+ * Description      This function checks if a RPA is resolvable by the device
+ *                  key.
  *
  * Returns          true is resolvable; false otherwise.
  *
@@ -299,9 +300,10 @@
  *
  * Function         btm_ble_match_random_bda
  *
- * Description      This function match the random address to the appointed device
- *                  record, starting from calculating IRK. If record index exceed
- *                  the maximum record number, matching failed and send callback.
+ * Description      This function match the random address to the appointed
+ *                  device record, starting from calculating IRK. If the record
+ *                  index exceeds the maximum record number, matching failed and
+ *                  send a callback.
  *
  * Returns          None.
  *
@@ -407,8 +409,8 @@
  *
  * Function         btm_identity_addr_to_random_pseudo
  *
- * Description      This function map a static BD address to a pseudo random address
- *                  in security database.
+ * Description      This function map a static BD address to a pseudo random
+ *                  address in security database.
  *
  ******************************************************************************/
 bool    btm_identity_addr_to_random_pseudo(BD_ADDR bd_addr, uint8_t *p_addr_type, bool    refresh)
@@ -439,8 +441,8 @@
  *
  * Function         btm_random_pseudo_to_identity_addr
  *
- * Description      This function map a random pseudo address to a public address
- *                  random_pseudo is input and output parameter
+ * Description      This function map a random pseudo address to a public
+ *                  address. random_pseudo is input and output parameter
  *
  ******************************************************************************/
 bool    btm_random_pseudo_to_identity_addr(BD_ADDR random_pseudo, uint8_t *p_static_addr_type)
@@ -467,8 +469,9 @@
  *
  * Function         btm_ble_refresh_peer_resolvable_private_addr
  *
- * Description      This function refresh the currently used resolvable remote private address into security
- *                  database and set active connection address.
+ * Description      This function refresh the currently used resolvable remote
+ *                  private address into security database and set active
+ *                  connection address.
  *
  ******************************************************************************/
 void btm_ble_refresh_peer_resolvable_private_addr(BD_ADDR pseudo_bda, BD_ADDR rpa,
@@ -542,8 +545,8 @@
  *
  * Function         btm_ble_refresh_local_resolvable_private_addr
  *
- * Description      This function refresh the currently used resolvable private address for the
- *                  active link to the remote device
+ * Description      This function refresh the currently used resolvable private
+ *                  address for the active link to the remote device
  *
  ******************************************************************************/
 void btm_ble_refresh_local_resolvable_private_addr(BD_ADDR pseudo_addr,
diff --git a/stack/btm/btm_ble_adv_filter.cc b/stack/btm/btm_ble_adv_filter.cc
index 8da4e71..85e3f68 100644
--- a/stack/btm/btm_ble_adv_filter.cc
+++ b/stack/btm/btm_ble_adv_filter.cc
@@ -101,8 +101,8 @@
  *
  * Function         btm_ble_advfilt_enq_op_q
  *
- * Description      enqueue an adv filter operation in q to check command complete
- *                  status
+ * Description      enqueue an adv filter operation in the q to check command
+ *                  complete status
  *
  * Returns          void
  *
@@ -246,7 +246,8 @@
  *
  * Function         btm_ble_scan_pf_cmpl_cback
  *
- * Description      the BTM BLE customer feature VSC complete callback for ADV PF filtering
+ * Description      the BTM BLE customer feature VSC complete callback for ADV
+ *                  PF filtering
  *
  * Returns          pointer to the counter if found; NULL otherwise.
  *
@@ -359,7 +360,8 @@
  *
  * Function         btm_ble_find_addr_filter_counter
  *
- * Description      find the per bd address ADV payload filter counter by BD_ADDR.
+ * Description      find the per bd address ADV payload filter counter by
+ *                  BD_ADDR.
  *
  * Returns          pointer to the counter if found; NULL otherwise.
  *
@@ -389,7 +391,8 @@
  *
  * Description      allocate the per device adv payload filter counter.
  *
- * Returns          pointer to the counter if allocation succeed; NULL otherwise.
+ * Returns          pointer to the counter if allocation succeed; NULL
+ *                  otherwise.
  *
  ******************************************************************************/
 tBTM_BLE_PF_COUNT * btm_ble_alloc_addr_filter_counter(BD_ADDR bd_addr)
@@ -445,7 +448,8 @@
  *
  * Function         btm_ble_update_pf_local_name
  *
- * Description      this function update(add,delete or clear) the adv lcoal name filtering condition.
+ * Description      this function update(add,delete or clear) the adv local
+ *                  name filtering condition.
  *
  *
  * Returns          BTM_SUCCESS if sucessful,
@@ -520,8 +524,8 @@
  *
  * Function         btm_ble_update_pf_manu_data
  *
- * Description      this function update(add,delete or clear) the adv manufacturer
- *                  data filtering condition.
+ * Description      this function update(add,delete or clear) the adv
+ *                  manufacturer data filtering condition.
  *
  *
  * Returns          BTM_SUCCESS if sucessful,
@@ -635,7 +639,8 @@
  *
  * Function         btm_ble_cs_update_pf_counter
  *
- * Description      this function is to update the adv data payload filter counter
+ * Description      this function is to update the adv data payload filter
+ *                  counter
  *
  * Returns          current number of the counter; BTM_BLE_INVALID_COUNTER if
  *                  counter update failed.
@@ -703,7 +708,8 @@
  *
  * Function         btm_ble_update_addr_filter
  *
- * Description      this function update(add,delete or clear) the address filter of adv.
+ * Description      this function updates(adds, deletes or clears) the address
+ *                  filter of adv.
  *
  *
  * Returns          BTM_CMD_STARTED if sucessful,
@@ -748,7 +754,8 @@
  *
  * Function         btm_ble_update_uuid_filter
  *
- * Description      this function update(add,delete or clear) service UUID filter.
+ * Description      this function updates(adds, deletes or clears) the service
+ *                  UUID filter.
  *
  *
  * Returns          BTM_CMD_STARTED if sucessful,
@@ -887,7 +894,8 @@
  *
  * Function         btm_ble_clear_scan_pf_filter
  *
- * Description      clear all adv payload filter by de-select all the adv pf feature bits
+ * Description      clear all adv payload filter by de-selecting all the adv pf
+ *                  feature bits
  *
  *
  * Returns          BTM_CMD_STARTED if sucessful,
@@ -1158,8 +1166,8 @@
  *
  * Function         BTM_BleCfgFilterCondition
  *
- * Description      This function is called to configure the adv data payload filter
- *                  condition.
+ * Description      This function is called to configure the adv data payload
+ *                  filter condition.
  *
  * Parameters       action: to read/write/clear
  *                  cond_type: filter condition type.
diff --git a/stack/btm/btm_ble_batchscan.cc b/stack/btm/btm_ble_batchscan.cc
index 327aa79..e590b61 100644
--- a/stack/btm/btm_ble_batchscan.cc
+++ b/stack/btm/btm_ble_batchscan.cc
@@ -160,8 +160,8 @@
  *
  * Function         btm_ble_batchscan_enq_rep_q
  *
- * Description      enqueue a batchscan report operation in q to check command complete
- *                  status
+ * Description      enqueue a batchscan report operation in q to check command
+ *                  complete status
  *
  * Returns          void
  *
@@ -311,7 +311,8 @@
  *
  * Description      This function reads the reports from controller
  *
- * Parameters       scan_mode - The mode for which the reports are to be read out from the controller
+ * Parameters       scan_mode - The mode for which the reports are to be read
+ *                              out from the controller
  *                  ref_value - Reference value
  *
  ******************************************************************************/
@@ -474,9 +475,12 @@
  *
  * Description      This function writes the storage configuration in controller
  *
- * Parameters       batch_scan_full_max -Max storage space (in %) allocated to full scanning
- *                  batch_scan_trunc_max -Max storage space (in %) allocated to truncated scanning
- *                  batch_scan_notify_threshold - Setup notification level based on total space
+ * Parameters       batch_scan_full_max - Max storage space (in %) allocated to
+ *                                        full scanning
+ *                  batch_scan_trunc_max - Max storage space (in %) allocated to
+ *                                         truncated scanning
+ *                  batch_scan_notify_threshold - Set up notification level
+ *                                                based on total space
  *
  ******************************************************************************/
 void btm_ble_set_storage_config(uint8_t batch_scan_full_max, uint8_t batch_scan_trunc_max,
@@ -539,7 +543,8 @@
  *
  * Function         btm_ble_enable_disable_batchscan
  *
- * Description      This function enables the customer specific feature in controller
+ * Description      This function enables the customer specific feature in
+ *                  controller
  *
  * Parameters       enable_disable: true - enable, false - disable
  *
@@ -581,9 +586,12 @@
  *
  * Description      This function is called to write storage config params.
  *
- * Parameters:      batch_scan_full_max - Max storage space (in %) allocated to full style
- *                  batch_scan_trunc_max - Max storage space (in %) allocated to trunc style
- *                  batch_scan_notify_threshold - Setup notification level based on total space
+ * Parameters:      batch_scan_full_max - Max storage space (in %) allocated to
+ *                                        full style
+ *                  batch_scan_trunc_max - Max storage space (in %) allocated to
+ *                                         trunc style
+ *                  batch_scan_notify_threshold - Setup notification level based
+ *                                                on total space
  *                  p_setup_cback - Setup callback pointer
  *                  p_thres_cback - Threshold callback pointer
  *                  p_rep_cback - Reports callback pointer
@@ -653,7 +661,8 @@
  *
  * Function         BTM_BleEnableBatchScan
  *
- * Description      This function is called to configure and enable batch scanning
+ * Description      This function is called to configure and enable batch
+ *                  scanning
  *
  * Parameters:      scan_mode -Batch scan mode
  *                  scan_interval - Scan interval value
@@ -820,7 +829,8 @@
  *
  * Function         BTM_BleTrackAdvertiser
  *
- * Description      This function is called to setup the callback for tracking advertisers
+ * Description      This function is called to setup the callback for tracking
+ *                  advertisers
  *
  * Parameters:      p_track_cback - Tracking callback pointer
  *                  ref_value - Reference value
diff --git a/stack/btm/btm_ble_bgconn.cc b/stack/btm/btm_ble_bgconn.cc
index b8eb031..fcf66aa 100644
--- a/stack/btm/btm_ble_bgconn.cc
+++ b/stack/btm/btm_ble_bgconn.cc
@@ -181,7 +181,8 @@
  *
  * Function         btm_execute_wl_dev_operation
  *
- * Description      execute the pending whitelist device operation(loading or removing)
+ * Description      execute the pending whitelist device operation (loading or
+ *                                                                  removing)
  ******************************************************************************/
 bool    btm_execute_wl_dev_operation(void)
 {
@@ -205,7 +206,8 @@
  *
  * Function         btm_enq_wl_dev_operation
  *
- * Description      enqueue the pending whitelist device operation(loading or removing).
+ * Description      enqueue the pending whitelist device operation (loading or
+ *                                                                  removing).
  ******************************************************************************/
 void btm_enq_wl_dev_operation(bool    to_add, BD_ADDR bd_addr)
 {
@@ -427,7 +429,8 @@
  *
  * Function         btm_ble_start_select_conn
  *
- * Description      This function is to start/stop selective connection procedure.
+ * Description      This function is to start/stop selective connection
+ *                  procedure.
  *
  * Parameters       start: true to start; false to stop.
  *                  p_select_cback: callback function to return application
@@ -514,7 +517,8 @@
  *
  * Function         btm_ble_initiate_select_conn
  *
- * Description      This function is to start/stop selective connection procedure.
+ * Description      This function is to start/stop selective connection
+ *                  procedure.
  *
  * Parameters       start: true to start; false to stop.
  *                  p_select_cback: callback function to return application
@@ -712,7 +716,8 @@
  *
  * Function         btm_send_pending_direct_conn
  *
- * Description      This function send the pending direct connection request in queue
+ * Description      This function send the pending direct connection request in
+ *                  queue
  *
  * Returns          true if started, false otherwise
  *
diff --git a/stack/btm/btm_ble_gap.cc b/stack/btm/btm_ble_gap.cc
index ecf3c6a..e7d5cf3 100644
--- a/stack/btm/btm_ble_gap.cc
+++ b/stack/btm/btm_ble_gap.cc
@@ -279,7 +279,8 @@
  *
  * Function         btm_ble_send_extended_scan_params
  *
- * Description      This function sends out the extended scan parameters command to the controller
+ * Description      This function sends out the extended scan parameters command
+ *                  to the controller
  *
  * Parameters       scan_type - Scan type
  *                  scan_int - Scan interval
@@ -511,7 +512,8 @@
  *
  * Description      Reads BLE specific controller features
  *
- * Parameters:      tBTM_BLE_CTRL_FEATURES_CBACK : Callback to notify when features are read
+ * Parameters:      tBTM_BLE_CTRL_FEATURES_CBACK : Callback to notify when
+ *                  features are read
  *
  * Returns          void
  *
@@ -614,7 +616,8 @@
  *
  * Function          BTM_BleMaxMultiAdvInstanceCount
  *
- * Description        Returns max number of multi adv instances supported by controller
+ * Description        Returns max number of multi adv instances supported by
+ *                  controller
  *
  * Returns          Max multi adv instance count
  *
@@ -695,9 +698,10 @@
  * Description      This function is called to set BLE connectable mode for a
  *                  peripheral device.
  *
- * Parameters       bg_conn_type: it can be auto connection, or selective connection.
- *                  p_select_cback: callback function when selective connection procedure
- *                              is being used.
+ * Parameters       bg_conn_type: it can be auto connection, or selective
+ *                                connection.
+ *                  p_select_cback: callback function when selective
+ *                                  connection procedure is being used.
  *
  * Returns          void
  *
@@ -799,8 +803,9 @@
  * Description      This function is called to set BLE connectable mode for a
  *                  peripheral device.
  *
- * Parameters       conn_mode:  directed connectable mode, or non-directed.It can
- *                              be BTM_BLE_CONNECT_EVT, BTM_BLE_CONNECT_DIR_EVT or
+ * Parameters       conn_mode:  directed connectable mode, or non-directed. It
+ *                              can be BTM_BLE_CONNECT_EVT,
+ *                              BTM_BLE_CONNECT_DIR_EVT or
  *                              BTM_BLE_CONNECT_LO_DUTY_DIR_EVT
  *
  * Returns          BTM_ILLEGAL_VALUE if controller does not support BLE.
@@ -835,8 +840,8 @@
  *
  * Function         btm_set_conn_mode_adv_init_addr
  *
- * Description      set initator address type and local address type based on adv
- *                  mode.
+ * Description      set initator address type and local address type based on
+ *                  adv mode.
  *
  *
  ******************************************************************************/
@@ -1129,8 +1134,8 @@
  *
  * Function         BTM__BLEReadDiscoverability
  *
- * Description      This function is called to read the current LE discoverability
- *                  mode of the device.
+ * Description      This function is called to read the current LE
+ *                  discoverability mode of the device.
  *
  * Returns          BTM_BLE_NON_DISCOVERABLE ,BTM_BLE_LIMITED_DISCOVERABLE or
  *                     BTM_BLE_GENRAL_DISCOVERABLE
@@ -1147,8 +1152,8 @@
  *
  * Function         BTM__BLEReadConnectability
  *
- * Description      This function is called to read the current LE connectibility
- *                  mode of the device.
+ * Description      This function is called to read the current LE
+ *                  connectability mode of the device.
  *
  * Returns          BTM_BLE_NON_CONNECTABLE or BTM_BLE_CONNECTABLE
  *
@@ -1208,9 +1213,10 @@
  *
  * Function         btm_ble_update_dmt_flag_bits
  *
- * Description      Obtain updated adv flag value based on connect and discoverability mode.
- *                  Also, setup DMT support value in the flag based on whether the controller
- *                  supports both LE and BR/EDR.
+ * Description      Obtain updated adv flag value based on connect and
+ *                  discoverability mode. Also, setup DMT support value in the
+ *                  flag based on whether the controller supports both LE and
+ *                  BR/EDR.
  *
  * Parameters:      flag_value (Input / Output) - flag value
  *                  connect_mode (Input) - Connect mode value
@@ -1470,11 +1476,13 @@
  * Function         btm_ble_start_inquiry
  *
  * Description      This function is called to start BLE inquiry procedure.
- *                  If the duration is zero, the periodic inquiry mode is cancelled.
+ *                  If the duration is zero, the periodic inquiry mode is
+ *                  cancelled.
  *
  * Parameters:      mode - GENERAL or LIMITED inquiry
  *                  p_inq_params - pointer to the BLE inquiry parameter.
- *                  p_results_cb - callback returning pointer to results (tBTM_INQ_RESULTS)
+ *                  p_results_cb - callback returning pointer to results
+ *                                 (tBTM_INQ_RESULTS)
  *                  p_cmpl_cb - callback indicating the end of an inquiry
  *
  *
@@ -1652,8 +1660,8 @@
  *
  * Function         btm_ble_update_adv_flag
  *
- * Description      This function update the limited discoverable flag in the adv
- *                  data.
+ * Description      This function update the limited discoverable flag in the
+ *                  adv data.
  *
  * Parameters:       None.
  *
@@ -2125,7 +2133,8 @@
  *
  * Description      This function is called when adv packet report events are
  *                  received from the device. It updates the inquiry database.
- *                  If the inquiry database is full, the oldest entry is discarded.
+ *                  If the inquiry database is full, the oldest entry is
+ *                  discarded.
  *
  * Parameters
  *
@@ -2585,8 +2594,8 @@
  * Function         btm_ble_read_remote_features_complete
  *
  * Description      This function is called when the command complete message
- *                  is received from the HCI for the read LE remote feature supported
- *                  complete event.
+ *                  is received from the HCI for the read LE remote feature
+ *                  supported complete event.
  *
  * Returns          void
  *
@@ -2730,8 +2739,8 @@
  *
  * Function         btm_ble_update_mode_operation
  *
- * Description      This function update the GAP role operation when a link status
- *                  is updated.
+ * Description      This function update the GAP role operation when a link
+ *                  status is updated.
  *
  * Returns          void
  *
@@ -2815,8 +2824,8 @@
  *
  * Function         btm_ble_topology_check
  *
- * Description      check to see requested state is supported. One state check at
- *                  a time is supported
+ * Description      check to see requested state is supported. One state check
+ *                  at a time is supported
  *
  * Returns          true is request is allowed, false otherwise.
  *
diff --git a/stack/btm/btm_ble_int_types.h b/stack/btm/btm_ble_int_types.h
index cb16b03..c282de6 100644
--- a/stack/btm/btm_ble_int_types.h
+++ b/stack/btm/btm_ble_int_types.h
@@ -46,40 +46,58 @@
 #define BTM_BLE_DUPLICATE_ENABLE        1
 #define BTM_BLE_DUPLICATE_DISABLE       0
 
-#define BTM_BLE_GAP_DISC_SCAN_INT      18         /* Interval(scan_int) = 11.25 ms= 0x0010 * 0.625 ms */
-#define BTM_BLE_GAP_DISC_SCAN_WIN      18         /* scan_window = 11.25 ms= 0x0010 * 0.625 ms */
-#define BTM_BLE_GAP_ADV_INT            512        /* Tgap(gen_disc) = 1.28 s= 512 * 0.625 ms */
-#define BTM_BLE_GAP_LIM_TIMEOUT_MS     (180 * 1000) /* Tgap(lim_timeout) = 180s max */
-#define BTM_BLE_LOW_LATENCY_SCAN_INT   8000       /* Interval(scan_int) = 5s= 8000 * 0.625 ms */
-#define BTM_BLE_LOW_LATENCY_SCAN_WIN   8000       /* scan_window = 5s= 8000 * 0.625 ms */
+/* Interval(scan_int) = 11.25 ms= 0x0010 * 0.625 ms */
+#define BTM_BLE_GAP_DISC_SCAN_INT      18
+/* scan_window = 11.25 ms= 0x0010 * 0.625 ms */
+#define BTM_BLE_GAP_DISC_SCAN_WIN      18
+/* Tgap(gen_disc) = 1.28 s= 512 * 0.625 ms */
+#define BTM_BLE_GAP_ADV_INT            512
+/* Tgap(lim_timeout) = 180s max */
+#define BTM_BLE_GAP_LIM_TIMEOUT_MS     (180 * 1000)
+/* Interval(scan_int) = 5s= 8000 * 0.625 ms */
+#define BTM_BLE_LOW_LATENCY_SCAN_INT   8000
+/* scan_window = 5s= 8000 * 0.625 ms */
+#define BTM_BLE_LOW_LATENCY_SCAN_WIN   8000
 
 
-#define BTM_BLE_GAP_ADV_FAST_INT_1         48         /* TGAP(adv_fast_interval1) = 30(used) ~ 60 ms  = 48 *0.625 */
-#define BTM_BLE_GAP_ADV_FAST_INT_2         160         /* TGAP(adv_fast_interval2) = 100(used) ~ 150 ms = 160 * 0.625 ms */
-#define BTM_BLE_GAP_ADV_SLOW_INT           2048         /* Tgap(adv_slow_interval) = 1.28 s= 512 * 0.625 ms */
-#define BTM_BLE_GAP_ADV_DIR_MAX_INT        800         /* Tgap(dir_conn_adv_int_max) = 500 ms = 800 * 0.625 ms */
-#define BTM_BLE_GAP_ADV_DIR_MIN_INT        400         /* Tgap(dir_conn_adv_int_min) = 250 ms = 400 * 0.625 ms */
+/* TGAP(adv_fast_interval1) = 30(used) ~ 60 ms  = 48 *0.625 */
+#define BTM_BLE_GAP_ADV_FAST_INT_1         48
+/* TGAP(adv_fast_interval2) = 100(used) ~ 150 ms = 160 * 0.625 ms */
+#define BTM_BLE_GAP_ADV_FAST_INT_2         160
+/* Tgap(adv_slow_interval) = 1.28 s= 512 * 0.625 ms */
+#define BTM_BLE_GAP_ADV_SLOW_INT           2048
+/* Tgap(dir_conn_adv_int_max) = 500 ms = 800 * 0.625 ms */
+#define BTM_BLE_GAP_ADV_DIR_MAX_INT        800
+/* Tgap(dir_conn_adv_int_min) = 250 ms = 400 * 0.625 ms */
+#define BTM_BLE_GAP_ADV_DIR_MIN_INT        400
 
 #define BTM_BLE_GAP_FAST_ADV_TIMEOUT_MS    (30 * 1000)
 
 #define BTM_BLE_SEC_REQ_ACT_NONE           0
-#define BTM_BLE_SEC_REQ_ACT_ENCRYPT        1 /* encrypt the link using current key or key refresh */
+/* encrypt the link using current key or key refresh */
+#define BTM_BLE_SEC_REQ_ACT_ENCRYPT        1
 #define BTM_BLE_SEC_REQ_ACT_PAIR           2
-#define BTM_BLE_SEC_REQ_ACT_DISCARD        3 /* discard the sec request while encryption is started but not completed */
+/* discard the sec request while encryption is started but not completed */
+#define BTM_BLE_SEC_REQ_ACT_DISCARD        3
 typedef uint8_t tBTM_BLE_SEC_REQ_ACT;
 
 #define BLE_STATIC_PRIVATE_MSB_MASK          0x3f
-#define BLE_RESOLVE_ADDR_MSB                 0x40   /*  most significant bit, bit7, bit6 is 01 to be resolvable random */
-#define BLE_RESOLVE_ADDR_MASK                0xc0   /* bit 6, and bit7 */
+/*  most significant bit, bit7, bit6 is 01 to be resolvable random */
+#define BLE_RESOLVE_ADDR_MSB                 0x40
+/* bit 6, and bit7 */
+#define BLE_RESOLVE_ADDR_MASK                0xc0
 #define BTM_BLE_IS_RESOLVE_BDA(x)           (((x)[0] & BLE_RESOLVE_ADDR_MASK) == BLE_RESOLVE_ADDR_MSB)
 
 #define BLE_PUBLIC_ADDR_MSB_MASK            0xC0
-#define BLE_PUBLIC_ADDR_MSB                 0x80   /*  most significant bit, bit7, bit6 is 10 to be public address*/
+/*  most significant bit, bit7, bit6 is 10 to be public address*/
+#define BLE_PUBLIC_ADDR_MSB                 0x80
 #define BTM_IS_PUBLIC_BDA(x)               (((x)[0]  & BLE_PUBLIC_ADDR_MSB_MASK) == BLE_PUBLIC_ADDR_MSB)
 
 /* LE scan activity bit mask, continue with LE inquiry bits */
-#define BTM_LE_SELECT_CONN_ACTIVE      0x40     /* selection connection is in progress */
-#define BTM_LE_OBSERVE_ACTIVE          0x80     /* observe is in progress */
+/* selection connection is in progress */
+#define BTM_LE_SELECT_CONN_ACTIVE      0x40
+/* observe is in progress */
+#define BTM_LE_OBSERVE_ACTIVE          0x80
 
 /* BLE scan activity mask checking */
 #define BTM_BLE_IS_SCAN_ACTIVE(x)   ((x) & BTM_BLE_SCAN_ACTIVE_MASK)
@@ -103,10 +121,10 @@
 
 typedef struct
 {
-    uint32_t        inq_count;          /* Used for determining if a response has already been      */
-                                        /* received for the current inquiry operation. (We do not   */
-                                        /* want to flood the caller with multiple responses from    */
-                                        /* the same device.                                         */
+    /* Used for determining if a response has already been received for the
+     * current inquiry operation. (We do not want to flood the caller with
+     * multiple responses from the same device. */
+    uint32_t        inq_count;
     bool            scan_rsp;
     tBLE_BD_ADDR    le_bda;
 } tINQ_LE_BDADDR;
diff --git a/stack/btm/btm_ble_privacy.cc b/stack/btm/btm_ble_privacy.cc
index 9b9d955..7ead70a 100644
--- a/stack/btm/btm_ble_privacy.cc
+++ b/stack/btm/btm_ble_privacy.cc
@@ -104,7 +104,8 @@
  *
  * Function         btm_ble_deq_resolving_pending
  *
- * Description      dequeue target address from resolving pending operation queue
+ * Description      dequeue target address from resolving pending operation
+ *                  queue
  *
  * Parameters       pseudo_addr: pseudo_addr device address
  *
@@ -378,7 +379,8 @@
         /* proprietary spec has extra bytes */
         if (evt_len > 8)
         {
-            p += (2 + 16 + 1 + 6); /* skip subcode, index, IRK value, address type, identity addr type */
+            /* skip subcode, index, IRK value, address type, identity addr type */
+            p += (2 + 16 + 1 + 6);
             STREAM_TO_BDADDR(rra, p);
 
             BTM_TRACE_ERROR("%s peer_addr: %02x:%02x:%02x:%02x:%02x:%02x",
@@ -553,9 +555,9 @@
  *
  * Function         btm_ble_suspend_resolving_list_activity
  *
- * Description      This function suspends all resolving list activity, including
- *                  scan, initiating, and advertising, if resolving list is being
- *                  enabled.
+ * Description      This function suspends all resolving list activity,
+ *                  including scanning, initiating, and advertising, if
+ *                  resolving list is being enabled.
  *
  * Parameters
  *
@@ -732,7 +734,8 @@
  *
  * Function         btm_ble_resolving_list_load_dev
  *
- * Description      This function add a device which is using RPA into white list
+ * Description      This function adds a device which is using RPA into the
+ *                  white list.
  *
  * Parameters       pointer to device security record
  *
diff --git a/stack/btm/btm_dev.cc b/stack/btm/btm_dev.cc
index 92f54c0..2bc87da 100644
--- a/stack/btm/btm_dev.cc
+++ b/stack/btm/btm_dev.cc
@@ -47,10 +47,12 @@
  *
  * Parameters:      bd_addr          - BD address of the peer
  *                  dev_class        - Device Class
- *                  bd_name          - Name of the peer device.  NULL if unknown.
- *                  features         - Remote device's features (up to 3 pages). NULL if not known
+ *                  bd_name          - Name of the peer device. NULL if unknown.
+ *                  features         - Remote device's features (up to 3 pages).
+ *                                     NULL if not known
  *                  trusted_mask     - Bitwise OR of services that do not
- *                                     require authorization. (array of uint32_t)
+ *                                     require authorization.
+ *                                     (array of uint32_t)
  *                  link_key         - Connection link key. NULL if unknown.
  *
  * Returns          true if added OK, else false
diff --git a/stack/btm/btm_devctl.cc b/stack/btm/btm_devctl.cc
index 75d84b0..ac983c4 100644
--- a/stack/btm/btm_devctl.cc
+++ b/stack/btm/btm_devctl.cc
@@ -47,7 +47,7 @@
 extern thread_t *bt_workqueue_thread;
 
 /******************************************************************************/
-/*                 L O C A L    D A T A    D E F I N I T I O N S                */
+/*               L O C A L    D A T A    D E F I N I T I O N S                */
 /******************************************************************************/
 
 #ifndef BTM_DEV_RESET_TIMEOUT
@@ -60,7 +60,7 @@
 #define BTM_INFO_TIMEOUT        5   /* 5 seconds for info response */
 
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 
 static void btm_decode_ext_features_page (uint8_t page_number, const BD_FEATURES p_features);
@@ -106,9 +106,9 @@
  *
  * Function         btm_db_reset
  *
- * Description      This function is called by BTM_DeviceReset and clears out any
- *                  pending callbacks for inquiries, discoveries, other pending
- *                  functions that may be in progress.
+ * Description      This function is called by BTM_DeviceReset and clears out
+ *                  any pending callbacks for inquiries, discoveries, other
+ *                  pending functions that may be in progress.
  *
  * Returns          void
  *
@@ -666,7 +666,7 @@
  *                  specific HCI events.
  *
  *                  If is_register=true, then the function will be registered;
- *                  if is_register=false, then the function will be deregistered.
+ *                  otherwise, the the function will be deregistered.
  *
  * Returns          BTM_SUCCESS if successful,
  *                  BTM_BUSY if maximum number of callbacks have already been
@@ -833,8 +833,8 @@
  * Function         BTM_DeleteStoredLinkKey
  *
  * Description      This function is called to delete link key for the specified
- *                  device addresses from the NVRAM storage attached to the Bluetooth
- *                  controller.
+ *                  device addresses from the NVRAM storage attached to the
+ *                  Bluetooth controller.
  *
  * Parameters:      bd_addr      - Addresses of the devices
  *                  p_cb         - Call back function to be called to return
@@ -873,7 +873,8 @@
  * Function         btm_delete_stored_link_key_complete
  *
  * Description      This function is called when the command complete message
- *                  is received from the HCI for the delete stored link key command.
+ *                  is received from the HCI for the delete stored link key
+ *                  command.
  *
  * Returns          void
  *
diff --git a/stack/btm/btm_inq.cc b/stack/btm/btm_inq.cc
index b0676ef..17f45c4 100644
--- a/stack/btm/btm_inq.cc
+++ b/stack/btm/btm_inq.cc
@@ -53,7 +53,7 @@
 extern fixed_queue_t *btu_general_alarm_queue;
 
 /******************************************************************************/
-/*                 L O C A L    D A T A    D E F I N I T I O N S                */
+/*               L O C A L    D A T A    D E F I N I T I O N S                */
 /******************************************************************************/
 static const LAP general_inq_lap = {0x9e,0x8b,0x33};
 static const LAP limited_inq_lap = {0x9e,0x8b,0x00};
@@ -132,7 +132,7 @@
 };
 
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 static void         btm_initiate_inquiry (tBTM_INQUIRY_VAR_ST *p_inq);
 static tBTM_STATUS  btm_set_inq_event_filter (uint8_t filter_cond_type, tBTM_INQ_FILT_COND *p_filt_cond);
@@ -150,8 +150,8 @@
  *
  * Description      This function is called to set the device into or out of
  *                  discoverable mode. Discoverable mode means inquiry
- *                  scans are enabled.  If a value of '0' is entered for window or
- *                  interval, the default values are used.
+ *                  scans are enabled.  If a value of '0' is entered for window
+ *                  or interval, the default values are used.
  *
  * Returns          BTM_SUCCESS if successful
  *                  BTM_BUSY if a setting of the filter is already in progress
@@ -419,22 +419,31 @@
  *
  * Function         BTM_SetPeriodicInquiryMode
  *
- * Description      This function is called to set the device periodic inquiry mode.
- *                  If the duration is zero, the periodic inquiry mode is cancelled.
+ * Description      This function is called to set the device periodic inquiry
+ *                  mode. If the duration is zero, the periodic inquiry mode is
+ *                  cancelled.
  *
- *                  Note: We currently do not allow concurrent inquiry and periodic inquiry.
+ *                  Note: We currently do not allow concurrent inquiry and
+ *                  periodic inquiry.
  *
  * Parameters:      p_inqparms - pointer to the inquiry information
  *                      mode - GENERAL or LIMITED inquiry
- *                      duration - length in 1.28 sec intervals (If '0', the inquiry is CANCELLED)
- *                      max_resps - maximum amount of devices to search for before ending the inquiry
- *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER, BTM_FILTER_COND_DEVICE_CLASS, or
+ *                      duration - length in 1.28 sec intervals (If '0', the
+ *                                 inquiry is CANCELLED)
+ *                      max_resps - maximum amount of devices to search for
+ *                                  before ending the inquiry
+ *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER,
+ *                                         BTM_FILTER_COND_DEVICE_CLASS, or
  *                                         BTM_FILTER_COND_BD_ADDR
- *                      filter_cond - value for the filter (based on filter_cond_type)
+ *                      filter_cond - value for the filter (based on
+ *                                                          filter_cond_type)
  *
- *                  max_delay - maximum amount of time between successive inquiries
- *                  min_delay - minimum amount of time between successive inquiries
- *                  p_results_cb - callback returning pointer to results (tBTM_INQ_RESULTS)
+ *                  max_delay - maximum amount of time between successive
+ *                              inquiries
+ *                  min_delay - minimum amount of time between successive
+ *                              inquiries
+ *                  p_results_cb - callback returning pointer to results
+ *                              (tBTM_INQ_RESULTS)
  *
  * Returns          BTM_CMD_STARTED if successfully started
  *                  BTM_ILLEGAL_VALUE if a bad parameter is detected
@@ -567,7 +576,8 @@
  * Function         BTM_SetConnectability
  *
  * Description      This function is called to set the device into or out of
- *                  connectable mode. Discoverable mode means page scans enabled.
+ *                  connectable mode. Discoverable mode means page scans are
+ *                  enabled.
  *
  * Returns          BTM_SUCCESS if successful
  *                  BTM_ILLEGAL_VALUE if a bad parameter is detected
@@ -677,7 +687,8 @@
  *
  * Function         BTM_IsInquiryActive
  *
- * Description      This function returns a bit mask of the current inquiry state
+ * Description      This function returns a bit mask of the current inquiry
+ *                  state
  *
  * Returns          BTM_INQUIRY_INACTIVE if inactive (0)
  *                  BTM_LIMITED_INQUIRY_ACTIVE if a limted inquiry is active
@@ -773,25 +784,33 @@
  * Description      This function is called to start an inquiry.
  *
  * Parameters:      p_inqparms - pointer to the inquiry information
- *                      mode - GENERAL or LIMITED inquiry, BR/LE bit mask seperately
- *                      duration - length in 1.28 sec intervals (If '0', the inquiry is CANCELLED)
- *                      max_resps - maximum amount of devices to search for before ending the inquiry
- *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER, BTM_FILTER_COND_DEVICE_CLASS, or
+ *                      mode - GENERAL or LIMITED inquiry, BR/LE bit mask
+ *                             seperately
+ *                      duration - length in 1.28 sec intervals (If '0', the
+ *                                 inquiry is CANCELLED)
+ *                      max_resps - maximum amount of devices to search for
+ *                                  before ending the inquiry
+ *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER,
+ *                                         BTM_FILTER_COND_DEVICE_CLASS, or
  *                                         BTM_FILTER_COND_BD_ADDR
- *                      filter_cond - value for the filter (based on filter_cond_type)
+ *                      filter_cond - value for the filter (based on
+ *                                                          filter_cond_type)
  *
- *                  p_results_cb   - Pointer to the callback routine which gets called
- *                                upon receipt of an inquiry result. If this field is
- *                                NULL, the application is not notified.
+ *                  p_results_cb   - Pointer to the callback routine which gets
+ *                                called upon receipt of an inquiry result. If
+ *                                this field is NULL, the application is not
+ *                                notified.
  *
- *                  p_cmpl_cb   - Pointer to the callback routine which gets called
- *                                upon completion.  If this field is NULL, the
- *                                application is not notified when completed.
+ *                  p_cmpl_cb   - Pointer to the callback routine which gets
+ *                                called upon completion.  If this field is
+ *                                NULL, the application is not notified when
+ *                                completed.
  * Returns          tBTM_STATUS
  *                  BTM_CMD_STARTED if successfully initiated
  *                  BTM_BUSY if already in progress
  *                  BTM_ILLEGAL_VALUE if parameter(s) are out of range
- *                  BTM_NO_RESOURCES if could not allocate resources to start the command
+ *                  BTM_NO_RESOURCES if could not allocate resources to start
+ *                                   the command
  *                  BTM_WRONG_MODE if the device is not up.
  *
  ******************************************************************************/
@@ -997,20 +1016,22 @@
  * Function         BTM_ReadRemoteDeviceName
  *
  * Description      This function initiates a remote device HCI command to the
- *                  controller and calls the callback when the process has completed.
+ *                  controller and calls the callback when the process has
+ *                  completed.
  *
  * Input Params:    remote_bda      - device address of name to retrieve
- *                  p_cb            - callback function called when BTM_CMD_STARTED
- *                                    is returned.
- *                                    A pointer to tBTM_REMOTE_DEV_NAME is passed to the
- *                                    callback.
+ *                  p_cb            - callback function called when
+ *                                    BTM_CMD_STARTED is returned.
+ *                                    A pointer to tBTM_REMOTE_DEV_NAME is
+ *                                    passed to the callback.
  *
  * Returns
- *                  BTM_CMD_STARTED is returned if the request was successfully sent
- *                                  to HCI.
+ *                  BTM_CMD_STARTED is returned if the request was successfully
+ *                                  sent to HCI.
  *                  BTM_BUSY if already in progress
  *                  BTM_UNKNOWN_ADDR if device address is bad
- *                  BTM_NO_RESOURCES if could not allocate resources to start the command
+ *                  BTM_NO_RESOURCES if could not allocate resources to start
+ *                                   the command
  *                  BTM_WRONG_MODE if the device is not up.
  *
  ******************************************************************************/
@@ -1056,10 +1077,12 @@
  * Input Params:    None
  *
  * Returns
- *                  BTM_CMD_STARTED is returned if the request was successfully sent
- *                                  to HCI.
- *                  BTM_NO_RESOURCES if could not allocate resources to start the command
- *                  BTM_WRONG_MODE if there is not an active remote name request.
+ *                  BTM_CMD_STARTED is returned if the request was successfully
+ *                                  sent to HCI.
+ *                  BTM_NO_RESOURCES if could not allocate resources to start
+ *                                   the command
+ *                  BTM_WRONG_MODE if there is not an active remote name
+ *                                 request.
  *
  ******************************************************************************/
 tBTM_STATUS  BTM_CancelRemoteDeviceName (void)
@@ -1092,7 +1115,8 @@
  *
  * Description      This function looks through the inquiry database for a match
  *                  based on Bluetooth Device Address. This is the application's
- *                  interface to get the inquiry details of a specific BD address.
+ *                  interface to get the inquiry details of a specific BD
+ *                  address.
  *
  * Returns          pointer to entry, or NULL if not found
  *
@@ -1114,8 +1138,9 @@
  *
  * Function         BTM_InqDbFirst
  *
- * Description      This function looks through the inquiry database for the first
- *                  used entry, and returns that. This is used in conjunction with
+ * Description      This function looks through the inquiry database for the
+ *                  first used entry, and returns that. This is used in
+ *                  conjunction with
  *                  BTM_InqDbNext by applications as a way to walk through the
  *                  inquiry database.
  *
@@ -1142,9 +1167,9 @@
  *
  * Function         BTM_InqDbNext
  *
- * Description      This function looks through the inquiry database for the next
- *                  used entry, and returns that.  If the input parameter is NULL,
- *                  the first entry is returned.
+ * Description      This function looks through the inquiry database for the
+ *                  next used entry, and returns that.  If the input parameter
+ *                  is NULL, the first entry is returned.
  *
  * Returns          pointer to next in-use entry, or NULL if no more found.
  *
@@ -1206,8 +1231,8 @@
  * Function         BTM_ReadInquiryRspTxPower
  *
  * Description      This command will read the inquiry Transmit Power level used
- *                  to transmit the FHS and EIR data packets.
- *                  This can be used directly in the Tx Power Level EIR data type.
+ *                  to transmit the FHS and EIR data packets. This can be used
+ *                  directly in the Tx Power Level EIR data type.
  *
  * Returns          BTM_SUCCESS if successful
  *
@@ -1229,9 +1254,9 @@
 
 /*******************************************************************************
  *******************************************************************************
- *                                                                              **
- *                      BTM Internal Inquiry Functions                          **
- *                                                                              **
+ *                                                                            **
+ *                    BTM Internal Inquiry Functions                          **
+ *                                                                            **
  *******************************************************************************
  ******************************************************************************/
 /*******************************************************************************
@@ -1513,8 +1538,9 @@
  *
  * Function         btm_inq_db_new
  *
- * Description      This function looks through the inquiry database for an unused
- *                  entry. If no entry is free, it allocates the oldest entry.
+ * Description      This function looks through the inquiry database for an
+ *                  unused entry. If no entry is free, it allocates the oldest
+ *                  entry.
  *
  * Returns          pointer to entry
  *
@@ -1559,18 +1585,20 @@
  * Function         btm_set_inq_event_filter
  *
  * Description      This function is called to set the inquiry event filter.
- *                  It is called by either internally, or by the external API function
- *                  (BTM_SetInqEventFilter).  It is used internally as part of the
- *                  inquiry processing.
+ *                  It is called by either internally, or by the external API
+ *                  function (BTM_SetInqEventFilter).  It is used internally as
+ *                  part of the inquiry processing.
  *
  * Input Params:
- *                  filter_cond_type - this is the type of inquiry filter to apply:
+ *                  filter_cond_type - this is the type of inquiry filter to
+ *                                     apply:
  *                          BTM_FILTER_COND_DEVICE_CLASS,
  *                          BTM_FILTER_COND_BD_ADDR, or
  *                          BTM_CLR_INQUIRY_FILTER
  *
- *                  p_filt_cond - this is either a BD_ADDR or DEV_CLASS depending on the
- *                          filter_cond_type  (See section 4.7.3 of Core Spec 1.0b).
+ *                  p_filt_cond - this is either a BD_ADDR or DEV_CLASS
+ *                                depending on the filter_cond_type
+ *                                (See section 4.7.3 of Core Spec 1.0b).
  *
  * Returns          BTM_CMD_STARTED if successfully initiated
  *                  BTM_NO_RESOURCES if couldn't get a memory pool buffer
@@ -1631,7 +1659,8 @@
  *
  * Function         btm_event_filter_complete
  *
- * Description      This function is called when a set event filter has completed.
+ * Description      This function is called when a set event filter has
+ *                  completed.
  *                  Note: This routine currently only handles inquiry filters.
  *                      Connection filters are ignored for now.
  *
@@ -1726,18 +1755,25 @@
  *
  * Function         btm_initiate_inquiry
  *
- * Description      This function is called to start an inquiry or periodic inquiry
- *                  upon completion of the setting and/or clearing of the inquiry filter.
+ * Description      This function is called to start an inquiry or periodic
+ *                  inquiry upon completion of the setting and/or clearing of
+ *                  the inquiry filter.
  *
- * Inputs:          p_inq (btm_cb.btm_inq_vars) - pointer to saved inquiry information
+ * Inputs:          p_inq (btm_cb.btm_inq_vars) - pointer to saved inquiry
+ *                                                information
  *                      mode - GENERAL or LIMITED inquiry
- *                      duration - length in 1.28 sec intervals (If '0', the inquiry is CANCELLED)
- *                      max_resps - maximum amount of devices to search for before ending the inquiry
- *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER, BTM_FILTER_COND_DEVICE_CLASS, or
+ *                      duration - length in 1.28 sec intervals
+ *                                 (If '0', the inquiry is CANCELLED)
+ *                      max_resps - maximum amount of devices to search for
+ *                                  before ending the inquiry
+ *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER,
+ *                                         BTM_FILTER_COND_DEVICE_CLASS, or
  *                                         BTM_FILTER_COND_BD_ADDR
- *                      filter_cond - value for the filter (based on filter_cond_type)
+ *                      filter_cond - value for the filter
+ *                                   (based on filter_cond_type)
  *
- * Returns          If an error occurs the initiator's callback is called with the error status.
+ * Returns          If an error occurs the initiator's callback is called with
+ *                  the error status.
  *
  ******************************************************************************/
 static void btm_initiate_inquiry (tBTM_INQUIRY_VAR_ST *p_inq)
@@ -1785,9 +1821,9 @@
  *
  * Function         btm_process_inq_results
  *
- * Description      This function is called when inquiry results are received from
- *                  the device. It updates the inquiry database. If the inquiry
- *                  database is full, the oldest entry is discarded.
+ * Description      This function is called when inquiry results are received
+ *                  from the device. It updates the inquiry database. If the
+ *                  inquiry database is full, the oldest entry is discarded.
  *
  * Parameters       inq_res_mode - BTM_INQ_RESULT_STANDARD
  *                                 BTM_INQ_RESULT_WITH_RSSI
@@ -2029,10 +2065,12 @@
  * Function         btm_process_inq_complete
  *
  * Description      This function is called when inquiry complete is received
- *                  from the device.  Call the callback if not in periodic inquiry
- *                  mode AND it is not NULL (The caller wants the event).
+ *                  from the device.  Call the callback if not in periodic
+ *                  inquiry mode AND it is not NULL
+ *                  (The caller wants the event).
  *
- *                  The callback pass back the status and the number of responses
+ *                  The callback pass back the status and the number of
+ *                  responses
  *
  * Returns          void
  *
@@ -2138,10 +2176,10 @@
  *
  * Function         btm_process_cancel_complete
  *
- * Description      This function is called when inquiry cancel complete is received
- *                  from the device.This function will also call the btm_process_inq_complete
- *                  This function is needed to differentiate a cancel_cmpl_evt from the
- *                  inq_cmpl_evt
+ * Description      This function is called when inquiry cancel complete is
+ *                  received from the device. This function will also call the
+ *                  btm_process_inq_complete. This function is needed to
+ *                  differentiate a cancel_cmpl_evt from the inq_cmpl_evt.
  *
  * Returns          void
  *
@@ -2155,19 +2193,22 @@
  *
  * Function         btm_initiate_rem_name
  *
- * Description      This function looks initiates a remote name request.  It is called
- *                  either by GAP or by the API call BTM_ReadRemoteDeviceName.
+ * Description      This function looks initiates a remote name request.  It is
+ *                  called either by GAP or by the API call
+ *                  BTM_ReadRemoteDeviceName.
  *
- * Input Params:    p_cur         - pointer to an inquiry result structure (NULL if nonexistent)
- *                  p_cb            - callback function called when BTM_CMD_STARTED
- *                                    is returned.
- *                                    A pointer to tBTM_REMOTE_DEV_NAME is passed to the
- *                                    callback.
+ * Input Params:    p_cur         - pointer to an inquiry result structure
+ *                                  (NULL if nonexistent)
+ *                  p_cb            - callback function called when
+ *                                    BTM_CMD_STARTED is returned.
+ *                                    A pointer to tBTM_REMOTE_DEV_NAME is
+ *                                    passed to the callback.
  *
  * Returns
  *                  BTM_CMD_STARTED is returned if the request was sent to HCI.
  *                  BTM_BUSY if already in progress
- *                  BTM_NO_RESOURCES if could not allocate resources to start the command
+ *                  BTM_NO_RESOURCES if could not allocate resources to start
+ *                                   the command
  *                  BTM_WRONG_MODE if the device is not up.
  *
  ******************************************************************************/
@@ -2235,8 +2276,8 @@
  * Function         btm_process_remote_name
  *
  * Description      This function is called when a remote name is received from
- *                  the device. If remote names are cached, it updates the inquiry
- *                  database.
+ *                  the device. If remote names are cached, it updates the
+ *                  inquiry database.
  *
  * Returns          void
  *
@@ -2431,7 +2472,8 @@
  *
  * Function         BTM_CheckEirData
  *
- * Description      This function is called to get EIR data from significant part.
+ * Description      This function is called to get EIR data from significant
+ *                  part.
  *
  * Parameters       p_eir - pointer of EIR significant part
  *                  type   - finding EIR data type
@@ -2519,7 +2561,8 @@
  *
  * Function         BTM_HasInquiryEirService
  *
- * Description      This function is called to know if UUID in bit map of UUID list.
+ * Description      This function is called to know if UUID in bit map of UUID
+ *                  list.
  *
  * Parameters       p_results - inquiry results
  *                  uuid16 - UUID 16-bit
@@ -2547,7 +2590,8 @@
  *
  * Function         BTM_AddEirService
  *
- * Description      This function is called to add a service in bit map of UUID list.
+ * Description      This function is called to add a service in bit map of UUID
+ *                  list.
  *
  * Parameters       p_eir_uuid - bit mask of UUID list for EIR
  *                  uuid16 - UUID 16-bit
@@ -2568,7 +2612,8 @@
  *
  * Function         BTM_RemoveEirService
  *
- * Description      This function is called to remove a service in bit map of UUID list.
+ * Description      This function is called to remove a service in bit map of
+ *                  UUID list.
  *
  * Parameters       p_eir_uuid - bit mask of UUID list for EIR
  *                  uuid16 - UUID 16-bit
@@ -2589,7 +2634,8 @@
  *
  * Function         BTM_GetEirSupportedServices
  *
- * Description      This function is called to get UUID list from bit map of UUID list.
+ * Description      This function is called to get UUID list from bit map of
+ *                  UUID list.
  *
  * Parameters       p_eir_uuid - bit mask of UUID list for EIR
  *                  p - reference of current pointer of EIR
@@ -2825,7 +2871,8 @@
  *
  * Function         btm_set_eir_uuid
  *
- * Description      This function is called to store received UUID into inquiry result.
+ * Description      This function is called to store received UUID into inquiry
+ *                  result.
  *
  * Parameters       p_eir - pointer of EIR significant part
  *                  p_results - pointer of inquiry result
diff --git a/stack/btm/btm_int_types.h b/stack/btm/btm_int_types.h
index 1346322..860bc4f 100644
--- a/stack/btm/btm_int_types.h
+++ b/stack/btm/btm_int_types.h
@@ -276,7 +276,7 @@
 #endif
 } tBTM_INQUIRY_VAR_ST;
 
-/* The MSB of the clock offset field indicates that the offset is valid if true */
+/* The MSB of the clock offset field indicates whether the offset is valid. */
 #define BTM_CLOCK_OFFSET_VALID      0x8000
 
 /* Define the structures needed by security management
diff --git a/stack/btm/btm_main.cc b/stack/btm/btm_main.cc
index c0e7d6a..ed3b4a9 100644
--- a/stack/btm/btm_main.cc
+++ b/stack/btm/btm_main.cc
@@ -38,8 +38,8 @@
  *
  * Description      This function is called at BTM startup to allocate the
  *                  control block (if using dynamic memory), and initializes the
- *                  tracing level.  It then initializes the various components of
- *                  btm.
+ *                  tracing level.  It then initializes the various components
+ *                  of btm.
  *
  * Returns          void
  *
diff --git a/stack/btm/btm_pm.cc b/stack/btm/btm_pm.cc
index 8896a0f..a275d2d 100644
--- a/stack/btm/btm_pm.cc
+++ b/stack/btm/btm_pm.cc
@@ -303,7 +303,7 @@
  *
  * Input Param      remote_bda - device address of desired ACL connection
  *
- * Output Param     pmState - address where the current  pm state is copied into.
+ * Output Param     pmState - address where the current pm state is copied.
  *                          BTM_PM_ST_ACTIVE
  *                          BTM_PM_ST_HOLD
  *                          BTM_PM_ST_SNIFF
@@ -531,8 +531,10 @@
 /*******************************************************************************
  *
  * Function     btm_pm_get_set_mode
- * Description  get the resulting mode from the registered parties, then compare it
- *              with the requested mode, if the command is from an unregistered party.
+ * Description  get the resulting mode from the registered parties, then compare
+ *              it with the requested mode, if the command is from an
+ *              unregistered party.
+ *
  * Returns      void
  *
  ******************************************************************************/
@@ -710,9 +712,9 @@
  *
  * Function         btm_pm_check_stored
  *
- * Description      This function is called when an HCI command status event occurs
- *                  to check if there's any PM command issued while waiting for
- *                  HCI command status.
+ * Description      This function is called when an HCI command status event
+ *                  occurs to check if there's any PM command issued while
+ *                  waiting for HCI command status.
  *
  * Returns          none.
  *
@@ -736,8 +738,8 @@
  *
  * Function         btm_pm_proc_cmd_status
  *
- * Description      This function is called when an HCI command status event occurs
- *                  for power manager related commands.
+ * Description      This function is called when an HCI command status event
+ *                  occurs for power manager related commands.
  *
  * Input Parms      status - status of the event (HCI_SUCCESS if no errors)
  *
@@ -788,12 +790,15 @@
  *
  * Function         btm_process_mode_change
  *
- * Description      This function is called when an HCI mode change event occurs.
+ * Description      This function is called when an HCI mode change event
+ *                  occurs.
  *
  * Input Parms      hci_status - status of the event (HCI_SUCCESS if no errors)
  *                  hci_handle - connection handle associated with the change
- *                  mode - HCI_MODE_ACTIVE, HCI_MODE_HOLD, HCI_MODE_SNIFF, or HCI_MODE_PARK
- *                  interval - number of baseband slots (meaning depends on mode)
+ *                  mode - HCI_MODE_ACTIVE, HCI_MODE_HOLD, HCI_MODE_SNIFF, or
+ *                         HCI_MODE_PARK
+ *                  interval - number of baseband slots (meaning depends on
+ *                                                       mode)
  *
  * Returns          none.
  *
@@ -886,7 +891,8 @@
  *
  * Function         btm_pm_proc_ssr_evt
  *
- * Description      This function is called when an HCI sniff subrating event occurs.
+ * Description      This function is called when an HCI sniff subrating event
+ *                  occurs.
  *
  * Returns          none.
  *
@@ -970,7 +976,8 @@
  *
  * Function         btm_pm_device_in_scan_state
  *
- * Description      This function is called to check if in paging, inquiry or connecting mode
+ * Description      This function is called to check if in paging, inquiry or
+ *                  connecting mode
  *
  * Returns          true, if in paging, inquiry or connecting mode
  *
@@ -1003,7 +1010,8 @@
  *
  * Description      This function is called to obtain the controller state
  *
- * Returns          Controller State-BTM_CONTRL_ACTIVE, BTM_CONTRL_SCAN, and BTM_CONTRL_IDLE
+ * Returns          Controller State-BTM_CONTRL_ACTIVE, BTM_CONTRL_SCAN, and
+ *                  BTM_CONTRL_IDLE
  *
  ******************************************************************************/
 tBTM_CONTRL_STATE BTM_PM_ReadControllerState(void)
diff --git a/stack/btm/btm_sco.cc b/stack/btm/btm_sco.cc
index ee0e026..8d2a389 100644
--- a/stack/btm/btm_sco.cc
+++ b/stack/btm/btm_sco.cc
@@ -41,7 +41,7 @@
 #if (BTM_SCO_INCLUDED == TRUE)
 
 /******************************************************************************/
-/*                 L O C A L    D A T A    D E F I N I T I O N S                */
+/*               L O C A L    D A T A    D E F I N I T I O N S                */
 /******************************************************************************/
 
 #define SCO_ST_UNUSED           0
@@ -55,7 +55,7 @@
 #define SCO_ST_PEND_MODECHANGE  8
 
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 
 static const tBTM_ESCO_PARAMS btm_esco_defaults =
@@ -77,7 +77,8 @@
  *
  * Function         btm_sco_flush_sco_data
  *
- * Description      This function is called to flush the SCO data for this channel.
+ * Description      This function is called to flush the SCO data for this
+ *                  channel.
  *
  * Returns          void
  *
@@ -295,20 +296,20 @@
  *
  * Function         BTM_WriteScoData
  *
- * Description      This function write SCO data to a specified instance. The data
- *                  to be written p_buf needs to carry an offset of
+ * Description      This function write SCO data to a specified instance. The
+ *                  data to be written p_buf needs to carry an offset of
  *                  HCI_SCO_PREAMBLE_SIZE bytes, and the data length can not
- *                  exceed BTM_SCO_DATA_SIZE_MAX bytes, whose default value is set
- *                  to 60 and is configurable. Data longer than the maximum bytes
- *                  will be truncated.
+ *                  exceed BTM_SCO_DATA_SIZE_MAX bytes, whose default value is
+ *                  set to 60 and is configurable. Data longer than the maximum
+ *                  bytes will be truncated.
  *
  * Returns          BTM_SUCCESS: data write is successful
  *                  BTM_ILLEGAL_VALUE: SCO data contains illegal offset value.
- *                  BTM_SCO_BAD_LENGTH: SCO data length exceeds the max SCO packet
- *                                      size.
+ *                  BTM_SCO_BAD_LENGTH: SCO data length exceeds the max SCO
+ *                                      packet size.
  *                  BTM_NO_RESOURCES: no resources.
- *                  BTM_UNKNOWN_ADDR: unknown SCO connection handle, or SCO is not
- *                                    routed via HCI.
+ *                  BTM_UNKNOWN_ADDR: unknown SCO connection handle, or SCO is
+ *                                    not routed via HCI.
  *
  *
  ******************************************************************************/
@@ -378,7 +379,8 @@
  *
  * Function         btm_send_connect_request
  *
- * Description      This function is called to respond to SCO connect indications
+ * Description      This function is called to respond to SCO connect
+ *                  indications
  *
  * Returns          void
  *
@@ -525,7 +527,8 @@
  *
  * Function         btm_reject_sco_link
  *
- * Description      This function is called to respond to SCO connect indications
+ * Description      This function is called to respond to SCO connect
+ *                  indications
  *
  * Returns          void
  *
@@ -719,7 +722,8 @@
  * Function         btm_sco_chk_pend_unpark
  *
  * Description      This function is called by BTIF when there is a mode change
- *                  event to see if there are SCO commands waiting for the unpark.
+ *                  event to see if there are SCO commands waiting for the
+ *                  unpark.
  *
  * Returns          void
  *
@@ -753,7 +757,8 @@
  * Function         btm_sco_chk_pend_rolechange
  *
  * Description      This function is called by BTIF when there is a role change
- *                  event to see if there are SCO commands waiting for the role change.
+ *                  event to see if there are SCO commands waiting for the role
+ *                  change.
  *
  * Returns          void
  *
@@ -785,7 +790,8 @@
  * Function        btm_sco_disc_chk_pend_for_modechange
  *
  * Description     This function is called by btm when there is a mode change
- *                 event to see if there are SCO  disconnect commands waiting for the mode change.
+ *                 event to see if there are SCO  disconnect commands waiting
+ *                 for the mode change.
  *
  * Returns         void
  *
@@ -1011,8 +1017,8 @@
  *
  * Function         btm_find_scb_by_handle
  *
- * Description      Look through all active SCO connection for a match based on the
- *                  HCI handle.
+ * Description      Look through all active SCO connection for a match based on
+ *                  the HCI handle.
  *
  * Returns          index to matched SCO connection CB, or BTM_MAX_SCO_LINKS if
  *                  no match.
@@ -1090,7 +1096,8 @@
  *
  * Function         btm_remove_sco_links
  *
- * Description      This function is called to remove all sco links for an ACL link.
+ * Description      This function is called to remove all sco links for an ACL
+ *                  link.
  *
  * Returns          void
  *
@@ -1320,8 +1327,8 @@
  *
  * Function         BTM_ReadScoHandle
  *
- * Description      This function is used to read the HCI handle used for a specific
- *                  SCO connection,
+ * Description      This function is used to read the HCI handle used for a
+ *                  specific SCO connection,
  *
  * Returns          handle for the connection, or 0xFFFF if invalid SCO index.
  *
@@ -1371,11 +1378,13 @@
  * Function         BTM_SetEScoMode
  *
  * Description      This function sets up the negotiated parameters for SCO or
- *                  eSCO, and sets as the default mode used for outgoing calls to
- *                  BTM_CreateSco.  It does not change any currently active (e)SCO links.
- *                  Note:  Incoming (e)SCO connections will always use packet types
- *                      supported by the controller.  If eSCO is not desired the
- *                      feature should be disabled in the controller's feature mask.
+ *                  eSCO, and sets as the default mode used for outgoing calls
+ *                  to BTM_CreateSco.  It does not change any currently active
+ *                  (e)SCO links.
+ *                  Note:  Incoming (e)SCO connections will always use packet
+ *                      types supported by the controller.  If eSCO is not
+ *                      desired the feature should be disabled in the
+ *                      controller's feature mask.
  *
  * Returns          BTM_SUCCESS if the successful.
  *                  BTM_BUSY if there are one or more active (e)SCO links.
@@ -1467,15 +1476,16 @@
  * Function         BTM_ReadEScoLinkParms
  *
  * Description      This function returns the current eSCO link parameters for
- *                  the specified handle.  This can be called anytime a connection
- *                  is active, but is typically called after receiving the SCO
- *                  opened callback.
+ *                  the specified handle.  This can be called anytime a
+ *                  connection is active, but is typically called after
+ *                  receiving the SCO opened callback.
  *
  *                  Note: If called over a 1.1 controller, only the packet types
  *                        field has meaning.
  *
  * Returns          BTM_SUCCESS if returned data is valid connection.
- *                  BTM_WRONG_MODE if no connection with a peer device or bad sco_inx.
+ *                  BTM_WRONG_MODE if no connection with a peer device or bad
+ *                                 sco_inx.
  *
  ******************************************************************************/
 tBTM_STATUS BTM_ReadEScoLinkParms (uint16_t sco_inx, tBTM_ESCO_DATA *p_parms)
@@ -1528,7 +1538,8 @@
  *
  * Returns          BTM_CMD_STARTED if command is successfully initiated.
  *                  BTM_NO_RESOURCES - not enough resources to initiate command.
- *                  BTM_WRONG_MODE if no connection with a peer device or bad sco_inx.
+ *                  BTM_WRONG_MODE if no connection with a peer device or bad
+ *                                 sco_inx.
  *
  ******************************************************************************/
 tBTM_STATUS BTM_ChangeEScoLinkParms (uint16_t sco_inx, tBTM_CHG_ESCO_PARAMS *p_parms)
@@ -1750,7 +1761,8 @@
  *
  * Function         btm_is_sco_active_by_bdaddr
  *
- * Description      This function is called to see if a SCO active to a bd address.
+ * Description      This function is called to see if a SCO connection is active
+ *                  for a bd address.
  *
  * Returns          bool
  *
diff --git a/stack/btm/btm_sec.cc b/stack/btm/btm_sec.cc
index c43bf39..614f117 100644
--- a/stack/btm/btm_sec.cc
+++ b/stack/btm/btm_sec.cc
@@ -51,7 +51,7 @@
 #endif
 
 /*******************************************************************************
- *              L O C A L    F U N C T I O N     P R O T O T Y P E S            *
+ *             L O C A L    F U N C T I O N     P R O T O T Y P E S            *
  ******************************************************************************/
 tBTM_SEC_SERV_REC *btm_sec_find_first_serv (bool    is_originator, uint16_t psm);
 static tBTM_SEC_SERV_REC *btm_sec_find_next_serv (tBTM_SEC_SERV_REC *p_cur);
@@ -216,8 +216,9 @@
  * Function         BTM_SecRegister
  *
  * Description      Application manager calls this function to register for
- *                  security services.  There can be one and only one application
- *                  saving link keys.  BTM allows only first registration.
+ *                  security services.  There can be one and only one
+ *                  application saving link keys.  BTM allows only first
+ *                  registration.
  *
  * Returns          true if registered OK, else false
  *
@@ -422,13 +423,14 @@
  *
  * Function         BTM_SetSecureConnectionsOnly
  *
- * Description      Enable or disable default treatment for Mode 4 Level 0 services
+ * Description      Enable or disable default treatment for Mode 4 Level 0
+ *                  services
  *
- * Parameter        secure_connections_only_mode - (true or false) whether or not the device
- *                  true means that the device should treat Mode 4 Level 0 services as
- *                  services of other levels. (Secure_connections_only_mode)
- *                  false means that the device should provide default treatment for
- *                  Mode 4 Level 0 services.
+ * Parameter        secure_connections_only_mode -
+ *                  true means that the device should treat Mode 4 Level 0
+ *                       services as services of other levels.
+ *                  false means that the device should provide default
+ *                        treatment for Mode 4 Level 0 services.
  *
  * Returns          void
  *
@@ -449,11 +451,12 @@
  *
  * Description      Register service security level with Security Manager
  *
- * Parameters:      is_originator - true if originating the connection, false if not
+ * Parameters:      is_originator - true if originating the connection
  *                  p_name      - Name of the service relevant only if
- *                                authorization will show this name to user. ignored
- *                                if BTM_SEC_SERVICE_NAME_LEN is 0.
- *                  service_id  - service ID for the service passed to authorization callback
+ *                                authorization will show this name to user.
+ *                                Ignored if BTM_SEC_SERVICE_NAME_LEN is 0.
+ *                  service_id  - service ID for the service passed to
+ *                                authorization callback
  *                  sec_level   - bit mask of the security features
  *                  psm         - L2CAP PSM
  *                  mx_proto_id - protocol ID of multiplexing proto below
@@ -488,11 +491,12 @@
  *
  * Description      Register service security level with Security Manager
  *
- * Parameters:      conn_type   - true if originating the connection, false if not
+ * Parameters:      conn_type   - true if originating the connection
  *                  p_name      - Name of the service relevant only if
- *                                authorization will show this name to user. ignored
- *                                if BTM_SEC_SERVICE_NAME_LEN is 0.
- *                  service_id  - service ID for the service passed to authorization callback
+ *                                authorization will show this name to user.
+ *                                Ignored if BTM_SEC_SERVICE_NAME_LEN is 0.
+ *                  service_id  - service ID for the service passed to
+ *                                authorization callback
  *                  sec_level   - bit mask of the security features
  *                  psm         - L2CAP PSM
  *                  mx_proto_id - protocol ID of multiplexing proto below
@@ -716,16 +720,16 @@
  *
  * Function         BTM_SecClrService
  *
- * Description      Removes specified service record(s) from the security database.
- *                  All service records with the specified name are removed.
- *                  Typically used only by devices with limited RAM so that it can
- *                  reuse an old security service record.
+ * Description      Removes specified service record(s) from the security
+ *                  database. All service records with the specified name are
+ *                  removed. Typically used only by devices with limited RAM so
+ *                  that it can reuse an old security service record.
  *
- *                  Note: Unpredictable results may occur if a service is cleared
- *                      that is still in use by an application/profile.
+ *                  Note: Unpredictable results may occur if a service is
+ *                      cleared that is still in use by an application/profile.
  *
- * Parameters       Service ID - Id of the service to remove. ('0' removes all service
- *                          records (except SDP).
+ * Parameters       Service ID - Id of the service to remove. '0' removes all
+ *                          service records (except SDP).
  *
  * Returns          Number of records that were freed.
  *
@@ -764,8 +768,8 @@
  *                  by dynamic PSM clients when the channel is closed.
  *                  The given psm must be a virtual psm.
  *
- * Parameters       Service ID - Id of the service to remove. ('0' removes all service
- *                          records (except SDP).
+ * Parameters       Service ID - Id of the service to remove. '0' removes all
+ *                          service records (except SDP).
  *
  * Returns          Number of records that were freed.
  *
@@ -831,11 +835,14 @@
  * Description      This function is called after Security Manager submitted
  *                  PIN code request to the UI.
  *
- * Parameters:      bd_addr      - Address of the device for which PIN was requested
- *                  res          - result of the operation BTM_SUCCESS if success
+ * Parameters:      bd_addr      - Address of the device for which PIN was
+ *                                 requested
+ *                  res          - result of the operation BTM_SUCCESS
+ *                                 if success
  *                  pin_len      - length in bytes of the PIN Code
  *                  p_pin        - pointer to array with the PIN Code
- *                  trusted_mask - bitwise OR of trusted services (array of uint32_t)
+ *                  trusted_mask - bitwise OR of trusted services
+ *                                 (array of uint32_t)
  *
  ******************************************************************************/
 void BTM_PINCodeReply (BD_ADDR bd_addr, uint8_t res, uint8_t pin_len, uint8_t *p_pin, uint32_t trusted_mask[])
@@ -954,7 +961,8 @@
  * Parameters:      bd_addr      - Address of the device to bond
  *                  pin_len      - length in bytes of the PIN Code
  *                  p_pin        - pointer to array with the PIN Code
- *                  trusted_mask - bitwise OR of trusted services (array of uint32_t)
+ *                  trusted_mask - bitwise OR of trusted services
+ *                                 (array of uint32_t)
  *
  *  Note: After 2.1 parameters are not used and preserved here not to change API
  ******************************************************************************/
@@ -1139,7 +1147,8 @@
  *                  transport    - doing SSP over BR/EDR or SMP over LE
  *                  pin_len      - length in bytes of the PIN Code
  *                  p_pin        - pointer to array with the PIN Code
- *                  trusted_mask - bitwise OR of trusted services (array of uint32_t)
+ *                  trusted_mask - bitwise OR of trusted services
+ *                                 (array of uint32_t)
  *
  *  Note: After 2.1 parameters are not used and preserved here not to change API
  ******************************************************************************/
@@ -1170,7 +1179,8 @@
  * Parameters:      bd_addr      - Address of the device to bond
  *                  pin_len      - length in bytes of the PIN Code
  *                  p_pin        - pointer to array with the PIN Code
- *                  trusted_mask - bitwise OR of trusted services (array of uint32_t)
+ *                  trusted_mask - bitwise OR of trusted services
+ *                                 (array of uint32_t)
  *
  *  Note: After 2.1 parameters are not used and preserved here not to change API
  ******************************************************************************/
@@ -1189,7 +1199,7 @@
  *                  with peer device.
  *
  * Parameters:      bd_addr      - Address of the peer device
- *                         transport    - false for BR/EDR link; true for LE link
+ *                  transport    - false for BR/EDR link; true for LE link
  *
  ******************************************************************************/
 tBTM_STATUS BTM_SecBondCancel (BD_ADDR bd_addr)
@@ -1330,11 +1340,11 @@
  *                  transport     - Link transport
  *                  p_callback    - Pointer to callback function called if
  *                                  this function returns PENDING after required
- *                                  procedures are completed.  Can be set to NULL
- *                                  if status is not desired.
- *                  p_ref_data    - pointer to any data the caller wishes to receive
- *                                  in the callback function upon completion.
- *                                  can be set to NULL if not used.
+ *                                  procedures are completed.  Can be set to
+ *                                  NULL if status is not desired.
+ *                  p_ref_data    - pointer to any data the caller wishes to
+ *                                  receive in the callback function upon
+ *                                  completion. can be set to NULL if not used.
  *                  sec_act       - LE security action, unused for BR/EDR
  *
  * Returns          BTM_SUCCESS   - already encrypted
@@ -1491,7 +1501,8 @@
  * Description      This function is called to confirm the numeric value for
  *                  Simple Pairing in response to BTM_SP_CFM_REQ_EVT
  *
- * Parameters:      res           - result of the operation BTM_SUCCESS if success
+ * Parameters:      res           - result of the operation BTM_SUCCESS if
+ *                                  success
  *                  bd_addr       - Address of the peer device
  *
  ******************************************************************************/
@@ -1542,7 +1553,8 @@
  * Parameters:      res     - result of the operation BTM_SUCCESS if success
  *                  bd_addr - Address of the peer device
  *                  passkey - numeric value in the range of
- *                  BTM_MIN_PASSKEY_VAL(0) - BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
+ *                  BTM_MIN_PASSKEY_VAL(0) -
+ *                  BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
  *
  ******************************************************************************/
 #if (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE)
@@ -1603,8 +1615,8 @@
  * Description      This function is used during the passkey entry model
  *                  by a device with KeyboardOnly IO capabilities
  *                  (very likely to be a HID Device).
- *                  It is called by a HID Device to inform the remote device when
- *                  a key has been entered or erased.
+ *                  It is called by a HID Device to inform the remote device
+ *                  when a key has been entered or erased.
  *
  * Parameters:      bd_addr - Address of the peer device
  *                  type - notification type
@@ -1624,9 +1636,9 @@
  * Function         BTM_IoCapRsp
  *
  * Description      This function is called in response to BTM_SP_IO_REQ_EVT
- *                  When the event data io_req.oob_data is set to BTM_OOB_UNKNOWN
- *                  by the tBTM_SP_CALLBACK implementation, this function is
- *                  called to provide the actual response
+ *                  When the event data io_req.oob_data is set to
+ *                  BTM_OOB_UNKNOWN by the tBTM_SP_CALLBACK implementation,
+ *                  this function is called to provide the actual response
  *
  * Parameters:      bd_addr - Address of the peer device
  *                  io_cap  - The IO capability of local device.
@@ -1797,14 +1809,14 @@
  *
  * Function         BTM_BothEndsSupportSecureConnections
  *
- * Description      This function is called to check if both the local device and the peer device
- *                  specified by bd_addr support BR/EDR Secure Connections.
+ * Description      This function is called to check if both the local device
+ *                  and the peer device specified by bd_addr support BR/EDR
+ *                  Secure Connections.
  *
  * Parameters:      bd_addr - address of the peer
  *
- * Returns          true if BR/EDR Secure Connections are supported by both local
- *                  and the remote device.
- *                  else false.
+ * Returns          true if BR/EDR Secure Connections are supported by both
+ *                  local and the remote device, else false.
  *
  ******************************************************************************/
 bool    BTM_BothEndsSupportSecureConnections(BD_ADDR bd_addr)
@@ -2821,7 +2833,8 @@
  * Function         btm_sec_check_pending_reqs
  *
  * Description      This function is called at the end of the security procedure
- *                  to let L2CAP and RFCOMM know to re-submit any pending requests
+ *                  to let L2CAP and RFCOMM know to re-submit any pending
+ *                  requests
  *
  * Returns          void
  *
@@ -4312,8 +4325,8 @@
  *
  * Function         btm_sec_connect_after_reject_timeout
  *
- * Description      Connection for bonding could not start because of the collision
- *                  Initiate outgoing connection
+ * Description      Connection for bonding could not start because of the
+ *                  collision. Initiate outgoing connection
  *
  * Returns          Pointer to the TLE struct
  *
@@ -4985,9 +4998,12 @@
 #endif
     uint8_t name[2];
 
-/* Coverity: FALSE-POSITIVE error from Coverity tool. Please do NOT remove following comment. */
-/* coverity[UNUSED_VALUE] pointer p_dev_rec is actually used several times... This is a Coverity false-positive, i.e. a fake issue.
-*/
+/* Coverity: FALSE-POSITIVE error from Coverity tool. Please do NOT remove
+ * the following comment.
+ */
+/* coverity[UNUSED_VALUE] pointer p_dev_rec is actually used several times...
+ * This is a Coverity false-positive, i.e. a fake issue.
+ */
     p_dev_rec = btm_find_dev (p_cb->pairing_bda);
 
     BTM_TRACE_EVENT ("%s  State: %s   Flags: %u", __func__,
@@ -6055,8 +6071,8 @@
  *
  * Function         btm_sec_is_serv_level0
  *
- * Description      This function is called to check if the service corresponding
- *                  to PSM is security mode 4 level 0 service.
+ * Description      This function is called to check if the service
+ *                  corresponding to PSM is security mode 4 level 0 service.
  *
  * Returns          true if the service is security mode 4 level 0 service
  *
@@ -6075,8 +6091,8 @@
  *
  * Function         btm_sec_check_pending_enc_req
  *
- * Description      This function is called to send pending encryption callback if
- *                  waiting
+ * Description      This function is called to send pending encryption callback
+ *                  if waiting
  *
  * Returns          void
  *
@@ -6114,7 +6130,8 @@
  *
  * Function         btm_sec_set_serv_level4_flags
  *
- * Description      This function is called to set security mode 4 level 4 flags.
+ * Description      This function is called to set security mode 4 level 4
+ *                  flags.
  *
  * Returns          service security requirements updated to include secure
  *                  connections only mode.
diff --git a/stack/btu/btu_hcif.cc b/stack/btu/btu_hcif.cc
index cffe3e1..2b23075 100644
--- a/stack/btu/btu_hcif.cc
+++ b/stack/btu/btu_hcif.cc
@@ -53,7 +53,7 @@
 extern void btm_ble_test_command_complete(uint8_t *p);
 
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 static void btu_hcif_inquiry_comp_evt (uint8_t *p);
 static void btu_hcif_inquiry_result_evt (uint8_t *p);
@@ -336,7 +336,8 @@
  *
  * Function         btu_hcif_send_cmd
  *
- * Description      This function is called to send commands to the Host Controller.
+ * Description      This function is called to send commands to the Host
+ *                  Controller.
  *
  * Returns          void
  *
diff --git a/stack/btu/btu_task.cc b/stack/btu/btu_task.cc
index 78914f1..81a1f83 100644
--- a/stack/btu/btu_task.cc
+++ b/stack/btu/btu_task.cc
@@ -214,7 +214,8 @@
  *
  * Function         btu_check_bt_sleep
  *
- * Description      This function is called to check if controller can go to sleep.
+ * Description      This function is called to check if controller can go to
+ *                  sleep.
  *
  * Returns          void
  *
diff --git a/stack/gap/gap_ble.cc b/stack/gap/gap_ble.cc
index 60a460a..e8f20ee 100644
--- a/stack/gap/gap_ble.cc
+++ b/stack/gap/gap_ble.cc
@@ -116,7 +116,8 @@
  *
  * Description      The function allocates a GAP  connection link control block
  *
- * Returns           NULL if not found. Otherwise pointer to the connection link block.
+ * Returns          NULL if not found. Otherwise pointer to the connection link
+ *                  block.
  *
  ******************************************************************************/
 tGAP_CLCB *gap_clcb_alloc (BD_ADDR bda)
@@ -488,7 +489,8 @@
  *
  * Function         gap_ble_send_cl_read_request
  *
- * Description      utility function to send a read request for a GAP charactersitic
+ * Description      utility function to send a read request for a GAP
+ *                  charactersitic
  *
  * Returns          true if read started, else false if GAP is busy
  *
@@ -726,7 +728,8 @@
  *
  * Function         GAP_BleReadPeerDevName
  *
- * Description      Start a process to read a connected peripheral's device name.
+ * Description      Start a process to read a connected peripheral's device
+ *                  name.
  *
  * Returns          true if request accepted
  *
diff --git a/stack/gap/gap_conn.cc b/stack/gap/gap_conn.cc
index 42697a0..2bab773 100644
--- a/stack/gap/gap_conn.cc
+++ b/stack/gap/gap_conn.cc
@@ -30,7 +30,7 @@
 #include "btm_int.h"
 
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 static void gap_connect_ind (BD_ADDR  bd_addr, uint16_t l2cap_cid, uint16_t psm, uint8_t l2cap_id);
 static void gap_connect_cfm (uint16_t l2cap_cid, uint16_t result);
@@ -51,7 +51,8 @@
  *
  * Function         gap_conn_init
  *
- * Description      This function is called to initialize GAP connection management
+ * Description      This function is called to initialize GAP connection
+ *                  management
  *
  * Returns          void
  *
@@ -116,12 +117,14 @@
  *                                be used.
  *
  *                  security    - security flags
- *                  chan_mode_mask - (GAP_FCR_CHAN_OPT_BASIC, GAP_FCR_CHAN_OPT_ERTM,
+ *                  chan_mode_mask - (GAP_FCR_CHAN_OPT_BASIC,
+ *                                    GAP_FCR_CHAN_OPT_ERTM,
  *                                    GAP_FCR_CHAN_OPT_STREAM)
  *
  *                  p_cb        - Pointer to callback function for events.
  *
- * Returns          handle of the connection if successful, else GAP_INVALID_HANDLE
+ * Returns          handle of the connection if successful, else
+ *                            GAP_INVALID_HANDLE
  *
  ******************************************************************************/
 uint16_t GAP_ConnOpen(const char *p_serv_name, uint8_t service_id, bool is_server,
@@ -298,7 +301,7 @@
  *
  * Description      This function is called to close a connection.
  *
- * Parameters:      handle      - Handle of the connection returned by GAP_ConnOpen
+ * Parameters:      handle - Handle of the connection returned by GAP_ConnOpen
  *
  * Returns          BT_PASS             - closed OK
  *                  GAP_ERR_BAD_HANDLE  - invalid handle
@@ -434,8 +437,8 @@
  *
  * Function         GAP_ConnBTRead
  *
- * Description      Bluetooth aware applications will call this function after receiving
- *                  GAP_EVT_RXDATA event.
+ * Description      Bluetooth-aware applications will call this function after
+ *                  receiving GAP_EVT_RXDATA event.
  *
  * Parameters:      handle      - Handle of the connection returned in the Open
  *                  pp_buf      - pointer to address of buffer with data,
@@ -549,7 +552,8 @@
  *
  * Function         GAP_ConnReconfig
  *
- * Description      Applications can call this function to reconfigure the connection.
+ * Description      Applications can call this function to reconfigure the
+ *                  connection.
  *
  * Parameters:      handle      - Handle of the connection
  *                  p_cfg       - Pointer to new configuration
@@ -580,16 +584,17 @@
  * Function         GAP_ConnSetIdleTimeout
  *
  * Description      Higher layers call this function to set the idle timeout for
- *                  a connection, or for all future connections. The "idle timeout"
- *                  is the amount of time that a connection can remain up with
- *                  no L2CAP channels on it. A timeout of zero means that the
- *                  connection will be torn down immediately when the last channel
- *                  is removed. A timeout of 0xFFFF means no timeout. Values are
- *                  in seconds.
+ *                  a connection, or for all future connections. The "idle
+ *                  timeout" is the amount of time that a connection can remain
+ *                  up with no L2CAP channels on it. A timeout of zero means
+ *                  that the connection will be torn down immediately when the
+ *                  last channel is removed. A timeout of 0xFFFF means no
+ *                  timeout. Values are in seconds.
  *
  * Parameters:      handle      - Handle of the connection
  *                  timeout     - in secs
- *                                0 = immediate disconnect when last channel is removed
+ *                                0 = immediate disconnect when last channel is
+ *                                    removed
  *                                0xFFFF = no idle timeout
  *
  * Returns          BT_PASS                 - config process started
@@ -619,7 +624,7 @@
  * Description      This function is called to get the remote BD address
  *                  of a connection.
  *
- * Parameters:      handle      - Handle of the connection returned by GAP_ConnOpen
+ * Parameters:      handle - Handle of the connection returned by GAP_ConnOpen
  *
  * Returns          BT_PASS             - closed OK
  *                  GAP_ERR_BAD_HANDLE  - invalid handle
@@ -654,7 +659,8 @@
  *
  * Parameters:      handle      - Handle of the connection
  *
- * Returns          uint16_t    - maximum size buffer that can be transmitted to the peer
+ * Returns          uint16_t    - maximum size buffer that can be transmitted to
+ *                                the peer
  *
  ******************************************************************************/
 uint16_t GAP_ConnGetRemMtuSize (uint16_t gap_handle)
diff --git a/stack/gap/gap_int.h b/stack/gap/gap_int.h
index 62ef397..29d9757 100644
--- a/stack/gap/gap_int.h
+++ b/stack/gap/gap_int.h
@@ -37,11 +37,12 @@
     bool           in_use;      /* True when structure is allocated */
 } tGAP_INFO;
 
-/* Define the control block for the FindAddrByName operation (Only 1 active at a time) */
+/* The control block for FindAddrByName (Only 1 active at a time) */
 typedef struct
 {
     tGAP_CALLBACK           *p_cback;
-    tBTM_INQ_INFO           *p_cur_inq; /* Pointer to the current inquiry database entry */
+    /* Pointer to the current inquiry database entry */
+    tBTM_INQ_INFO           *p_cur_inq;
     tGAP_FINDADDR_RESULTS    results;
     bool                     in_use;
 } tGAP_FINDADDR_CB;
@@ -65,24 +66,24 @@
 #define GAP_CCB_FLAGS_CONN_DONE         0x0E
     uint8_t           con_flags;
 
-    uint8_t           service_id;           /* Used by BTM                          */
-    uint16_t          gap_handle;           /* GAP handle                           */
-    uint16_t          connection_id;        /* L2CAP CID                            */
+    uint8_t           service_id;           /* Used by BTM */
+    uint16_t          gap_handle;           /* GAP handle */
+    uint16_t          connection_id;        /* L2CAP CID */
     bool              rem_addr_specified;
-    uint8_t           chan_mode_mask;       /* Supported channel modes (FCR)        */
+    uint8_t           chan_mode_mask;       /* Supported channel modes (FCR) */
     BD_ADDR           rem_dev_address;
     uint16_t          psm;
     uint16_t          rem_mtu_size;
 
     bool              is_congested;
-    fixed_queue_t     *tx_queue;            /* Queue of buffers waiting to be sent  */
-    fixed_queue_t     *rx_queue;            /* Queue of buffers waiting to be read  */
+    fixed_queue_t     *tx_queue;            /* Queue of buffers waiting to be sent */
+    fixed_queue_t     *rx_queue;            /* Queue of buffers waiting to be read */
 
-    uint32_t          rx_queue_size;        /* Total data count in rx_queue         */
+    uint32_t          rx_queue_size;        /* Total data count in rx_queue */
 
-    tGAP_CONN_CALLBACK *p_callback;         /* Users callback function              */
+    tGAP_CONN_CALLBACK *p_callback;         /* Users callback function */
 
-    tL2CAP_CFG_INFO   cfg;                  /* Configuration                        */
+    tL2CAP_CFG_INFO   cfg;                  /* Configuration */
     tL2CAP_ERTM_INFO  ertm_info;            /* Pools and modes for ertm */
     tBT_TRANSPORT     transport;            /* Transport channel BR/EDR or BLE */
     tL2CAP_LE_CFG_INFO local_coc_cfg;       /* local configuration for LE Coc */
diff --git a/stack/gatt/att_protocol.cc b/stack/gatt/att_protocol.cc
index 69a87c8..167d12c 100644
--- a/stack/gatt/att_protocol.cc
+++ b/stack/gatt/att_protocol.cc
@@ -411,8 +411,8 @@
  *
  * Function         attp_send_sr_msg
  *
- * Description      This function sends the server response or indication message
- *                  to client.
+ * Description      This function sends the server response or indication
+ *                  message to client.
  *
  * Parameter        p_tcb: pointer to the connecton control block.
  *                  p_msg: pointer to message parameters structure.
@@ -488,8 +488,8 @@
  *
  * Function         attp_send_cl_msg
  *
- * Description      This function sends the client request or confirmation message
- *                  to server.
+ * Description      This function sends the client request or confirmation
+ *                  message to server.
  *
  * Parameter        p_tcb: pointer to the connectino control block.
  *                  clcb_idx: clcb index
diff --git a/stack/gatt/gatt_api.cc b/stack/gatt/gatt_api.cc
index b68ca1b..f2747cf 100644
--- a/stack/gatt/gatt_api.cc
+++ b/stack/gatt/gatt_api.cc
@@ -68,8 +68,9 @@
  *
  * Function         GATTS_AddHandleRange
  *
- * Description      This function add the allocated handles range for the specifed
- *                  application UUID, service UUID and service instance
+ * Description      This function add the allocated handles range for the
+ *                  specified application UUID, service UUID and service
+ *                  instance
  *
  * Parameter        p_hndl_range:   pointer to allocated handles information
  *
@@ -368,7 +369,8 @@
  *                  p_svc_uuid    : service UUID
  *                  start_handle  : start handle of the service
  *
- * Returns          true if operation succeed, false if handle block was not found.
+ * Returns          true if the operation succeeded, false if the handle block
+ *                  was not found.
  *
  ******************************************************************************/
 bool    GATTS_DeleteService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid, uint16_t svc_inst)
@@ -457,11 +459,13 @@
  * Description      This function sends a handle value indication to a client.
  *
  * Parameter        conn_id: connection identifier.
- *                  attr_handle: Attribute handle of this handle value indication.
+ *                  attr_handle: Attribute handle of this handle value
+ *                               indication.
  *                  val_len: Length of the indicated attribute value.
  *                  p_val: Pointer to the indicated attribute value data.
  *
- * Returns          GATT_SUCCESS if sucessfully sent or queued; otherwise error code.
+ * Returns          GATT_SUCCESS if sucessfully sent or queued; otherwise error
+ *                  code.
  *
  ******************************************************************************/
 tGATT_STATUS GATTS_HandleValueIndication (uint16_t conn_id,  uint16_t attr_handle, uint16_t val_len, uint8_t *p_val)
@@ -531,7 +535,8 @@
  * Description      This function sends a handle value notification to a client.
  *
  * Parameter        conn_id: connection identifier.
- *                  attr_handle: Attribute handle of this handle value indication.
+ *                  attr_handle: Attribute handle of this handle value
+ *                               indication.
  *                  val_len: Length of the indicated attribute value.
  *                  p_val: Pointer to the indicated attribute value data.
  *
@@ -625,9 +630,9 @@
 /******************************************************************************/
 
 /******************************************************************************/
-/*                                                                             */
-/*                   GATT CLIENT APIs                                          */
-/*                                                                             */
+/*                                                                            */
+/*                  GATT CLIENT APIs                                          */
+/*                                                                            */
 /******************************************************************************/
 
 
@@ -688,7 +693,8 @@
  *
  * Function         GATTC_Discover
  *
- * Description      This function is called to do a discovery procedure on ATT server.
+ * Description      This function is called to do a discovery procedure on ATT
+ *                  server.
  *
  * Parameters       conn_id: connection identifier.
  *                  disc_type:discovery type.
@@ -757,8 +763,8 @@
  *
  * Function         GATTC_Read
  *
- * Description      This function is called to read the value of an attribute from
- *                  the server.
+ * Description      This function is called to read the value of an attribute
+ *                  from the server.
  *
  * Parameters       conn_id: connection identifier.
  *                  type    - attribute read type.
@@ -849,8 +855,8 @@
  *
  * Function         GATTC_Write
  *
- * Description      This function is called to write the value of an attribute to
- *                  the server.
+ * Description      This function is called to write the value of an attribute
+ *                  to the server.
  *
  * Parameters       conn_id: connection identifier.
  *                  type    - attribute write type.
@@ -919,7 +925,8 @@
  *                  the server.
  *
  * Parameters       conn_id: connection identifier.
- *                  is_execute - to execute or cancel the prepare write requet(s)
+ *                  is_execute - to execute or cancel the prepared write
+ *                               request(s)
  *
  * Returns          GATT_SUCCESS if command started successfully.
  *
@@ -1011,16 +1018,16 @@
 
 
 /******************************************************************************/
-/*                                                                             */
-/*                   GATT  APIs                                                */
-/*                                                                             */
+/*                                                                            */
+/*                  GATT  APIs                                                */
+/*                                                                            */
 /******************************************************************************/
 /*******************************************************************************
  *
  * Function         GATT_SetIdleTimeout
  *
- * Description      This function (common to both client and server) sets the idle
- *                  timeout for a tansport connection
+ * Description      This function (common to both client and server) sets the
+ *                  idle timeout for a tansport connection
  *
  * Parameter        bd_addr:   target device bd address.
  *                  idle_tout: timeout value in seconds.
@@ -1065,7 +1072,8 @@
  * Parameter        p_app_uuid128: Application UUID
  *                  p_cb_info: callback functions.
  *
- * Returns          0 for error, otherwise the index of the client registered with GATT
+ * Returns          0 for error, otherwise the index of the client registered
+ *                  with GATT
  *
  ******************************************************************************/
 tGATT_IF GATT_Register (tBT_UUID *p_app_uuid128, tGATT_CBACK *p_cb_info)
@@ -1187,9 +1195,9 @@
  *
  * Function         GATT_StartIf
  *
- * Description      This function is called after registration to start receiving
- *                  callbacks for registered interface.  Function may call back
- *                  with connection status and queued notifications
+ * Description      This function is called after registration to start
+ *                  receiving callbacks for registered interface.  Function may
+ *                  call back with connection status and queued notifications
  *
  * Parameter        gatt_if: applicaiton interface.
  *
@@ -1228,14 +1236,16 @@
  *
  * Function         GATT_Connect
  *
- * Description      This function initiate a connecttion to a remote device on GATT
- *                  channel.
+ * Description      This function initiate a connecttion to a remote device on
+ *                  GATT channel.
  *
  * Parameters       gatt_if: applicaiton interface
  *                  bd_addr: peer device address.
- *                  is_direct: is a direct conenection or a background auto connection
+ *                  is_direct: is a direct conenection or a background auto
+ *                             connection
  *
- * Returns          true if connection started; false if connection start failure.
+ * Returns          true if connection started; false if connection start
+ *                  failure.
  *
  ******************************************************************************/
 bool GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, bool is_direct,
@@ -1274,14 +1284,15 @@
  *
  * Function         GATT_CancelConnect
  *
- * Description      This function terminate the connection initaition to a remote
- *                  device on GATT channel.
+ * Description      This function terminate the connection initaition to a
+ *                  remote device on GATT channel.
  *
- * Parameters       gatt_if: client interface. If 0 used as unconditionally disconnect,
- *                          typically used for direct connection cancellation.
+ * Parameters       gatt_if: client interface. If 0 used as unconditionally
+ *                           disconnect, typically used for direct connection
+ *                           cancellation.
  *                  bd_addr: peer device address.
  *
- * Returns          true if connection started; false if connection start failure.
+ * Returns          true if the connection started; false otherwise.
  *
  ******************************************************************************/
 bool    GATT_CancelConnect (tGATT_IF gatt_if, BD_ADDR bd_addr, bool    is_direct){
@@ -1354,8 +1365,8 @@
  *
  * Function         GATT_Disconnect
  *
- * Description      This function disconnect the GATT channel for this registered
- *                  application.
+ * Description      This function disconnects the GATT channel for this
+ *                  registered application.
  *
  * Parameters       conn_id: connection identifier.
  *
@@ -1386,8 +1397,8 @@
  *
  * Function         GATT_GetConnectionInfor
  *
- * Description      This function use conn_id to find its associated BD address and applciation
- *                  interface
+ * Description      This function uses conn_id to find its associated BD address
+ *                  and application interface
  *
  * Parameters        conn_id: connection id  (input)
  *                   p_gatt_if: applicaiton interface (output)
@@ -1423,8 +1434,8 @@
  *
  * Function         GATT_GetConnIdIfConnected
  *
- * Description      This function find the conn_id if the logical link for BD address
- *                  and applciation interface is connected
+ * Description      This function find the conn_id if the logical link for BD
+ *                  address and applciation interface is connected
  *
  * Parameters        gatt_if: applicaiton interface (input)
  *                   bd_addr: peer device address. (input)
diff --git a/stack/gatt/gatt_attr.cc b/stack/gatt/gatt_attr.cc
index 194c9af..e2439ea 100644
--- a/stack/gatt/gatt_attr.cc
+++ b/stack/gatt/gatt_attr.cc
@@ -130,9 +130,11 @@
  *
  * Function         gatt_profile_clcb_alloc
  *
- * Description      The function allocates a GATT profile  connection link control block
+ * Description      The function allocates a GATT profile connection link
+ *                  control block
  *
- * Returns           NULL if not found. Otherwise pointer to the connection link block.
+ * Returns          NULL if not found. Otherwise pointer to the connection link
+ *                  block.
  *
  ******************************************************************************/
 tGATT_PROFILE_CLCB *gatt_profile_clcb_alloc (uint16_t conn_id, BD_ADDR bda, tBT_TRANSPORT tranport)
@@ -162,7 +164,8 @@
  *
  * Function         gatt_profile_clcb_dealloc
  *
- * Description      The function deallocates a GATT profile  connection link control block
+ * Description      The function deallocates a GATT profile connection link
+ *                  control block
  *
  * Returns          void
  *
diff --git a/stack/gatt/gatt_auth.cc b/stack/gatt/gatt_auth.cc
index 0bc02d3..1d50292 100644
--- a/stack/gatt/gatt_auth.cc
+++ b/stack/gatt/gatt_auth.cc
@@ -222,8 +222,8 @@
  *
  * Function         gatt_notify_enc_cmpl
  *
- * Description      link encryption complete notification for all encryption process
- *                  initiated outside GATT.
+ * Description      link encryption complete notification for all encryption
+ *                  process initiated outside GATT.
  *
  * Returns
  *
@@ -307,8 +307,8 @@
  *
  * Function         gatt_determine_sec_act
  *
- * Description      This routine determine the security action based on auth_request and
- *                  current link status
+ * Description      This routine determine the security action based on
+ *                  auth_request and current link status
  *
  * Returns          tGATT_SEC_ACTION security action
  *
@@ -438,9 +438,10 @@
 
 /*******************************************************************************
  *
- * Function          gatt_convert_sec_action
+ * Function         gatt_convert_sec_action
  *
- * Description      Convert GATT security action enum into equivalent BTM BLE security action enum
+ * Description      Convert GATT security action enum into equivalent
+ *                  BTM BLE security action enum
  *
  * Returns          bool    true - conversation is successful
  *
diff --git a/stack/gatt/gatt_cl.cc b/stack/gatt/gatt_cl.cc
index 42a0eb4..6a5ef88 100644
--- a/stack/gatt/gatt_cl.cc
+++ b/stack/gatt/gatt_cl.cc
@@ -43,7 +43,7 @@
 #define GATT_READ_BY_TYPE_RSP_MIN_LEN    1
 
 /*******************************************************************************
- *                       G L O B A L      G A T T       D A T A                 *
+ *                      G L O B A L      G A T T       D A T A                 *
  ******************************************************************************/
 void gatt_send_prepare_write(tGATT_TCB  *p_tcb, tGATT_CLCB *p_clcb);
 
@@ -404,7 +404,7 @@
  *
  * Function         gatt_process_find_type_value_rsp
  *
- * Description      This function is called to handle find by type value response.
+ * Description      This function handles the find by type value response.
  *
  *
  * Returns          void
@@ -504,8 +504,8 @@
  *
  * Function         gatt_proc_disc_error_rsp
  *
- * Description      This function process the read by type response and send another
- *                  request if needed.
+ * Description      Process the read by type response and send another request
+ *                  if needed.
  *
  * Returns          void.
  *
@@ -643,9 +643,7 @@
  *
  * Function         gatt_process_notification
  *
- * Description      This function is called to handle the handle value indication
- *                  or handle value notification.
- *
+ * Description      Handle the handle value indication/notification.
  *
  * Returns          void
  *
@@ -1033,7 +1031,7 @@
  *
  * Function         gatt_process_mtu_rsp
  *
- * Description      This function is called to process the configure MTU response.
+ * Description      Process the configure MTU response.
  *
  *
  * Returns          void
@@ -1064,7 +1062,7 @@
  *
  * Function         gatt_cmd_to_rsp_code
  *
- * Description      The function convert a ATT command op code into the corresponding
+ * Description      Convert an ATT command op code into the corresponding
  *                  response code assume no error occurs.
  *
  * Returns          response code.
diff --git a/stack/gatt/gatt_db.cc b/stack/gatt/gatt_db.cc
index c375179..d5a987c 100644
--- a/stack/gatt/gatt_db.cc
+++ b/stack/gatt/gatt_db.cc
@@ -35,7 +35,7 @@
 #include "osi/include/osi.h"
 
 /*******************************************************************************
- *              L O C A L    F U N C T I O N     P R O T O T Y P E S            *
+ *             L O C A L    F U N C T I O N     P R O T O T Y P E S            *
  ******************************************************************************/
 static bool allocate_svc_db_buf(tGATT_SVC_DB *p_db);
 static void *allocate_attr_in_db(tGATT_SVC_DB *p_db, tBT_UUID *p_uuid, tGATT_PERM perm);
@@ -51,7 +51,7 @@
  *
  * Function         gatts_init_service_db
  *
- * Description      This function initialize a memory space to be a service database.
+ * Description      Initialize a memory space to be a service database.
  *
  * Parameter        p_db: database pointer.
  *                  len: size of the memory space.
@@ -84,7 +84,7 @@
  *
  * Function         gatts_init_service_db
  *
- * Description      This function initialize a memory space to be a service database.
+ * Description      Initialize a memory space to be a service database.
  *
  * Parameter        p_db: database pointer.
  *                  len: size of the memory space.
@@ -515,7 +515,7 @@
  *
  * Function         gatt_convertchar_descr_type
  *
- * Description      This function convert a char descript UUID into descriptor type.
+ * Description      Convert a char descript UUID into descriptor type.
  *
  * Returns          descriptor type.
  *
@@ -1017,8 +1017,8 @@
  *
  * Function         copy_extra_byte_in_db
  *
- * Description      Utility function to allocate extra bytes memory in DB and copy
- *                  the value from a source place.
+ * Description      Utility function to allocate extra bytes memory in DB and
+ *                  copy the value from a source place.
  *
  *
  * Parameter        p_db: database pointer.
@@ -1055,7 +1055,8 @@
  *
  * Function         allocate_svc_db_buf
  *
- * Description      Utility function to allocate extra buffer for service database.
+ * Description      Utility function to allocate extra buffer for service
+ *                  database.
  *
  * Returns          true if allocation succeed, otherwise false.
  *
diff --git a/stack/gatt/gatt_main.cc b/stack/gatt/gatt_main.cc
index dd0d56d..43d3d3a 100644
--- a/stack/gatt/gatt_main.cc
+++ b/stack/gatt/gatt_main.cc
@@ -41,7 +41,7 @@
 #define GATT_MIN_BR_MTU_SIZE       48
 
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 static void gatt_le_connect_cback (uint16_t chan, BD_ADDR bd_addr, bool    connected,
         uint16_t reason, tBT_TRANSPORT transport);
@@ -180,7 +180,8 @@
  *
  * Function         gatt_connect
  *
- * Description      This function is called to initiate a connection to a peer device.
+ * Description      This function is called to initiate a connection to a peer
+ *                  device.
  *
  * Parameter        rem_bda: remote device address to connect to.
  *
@@ -297,8 +298,9 @@
  *
  * Function         gatt_update_app_use_link_flag
  *
- * Description      Update the application use link flag and optional to check the acl link
- *                  if the link is up then set the idle time out accordingly
+ * Description      Update the application use link flag and optional to check
+ *                  the acl link if the link is up then set the idle time out
+ *                  accordingly
  *
  * Returns          void.
  *
@@ -311,8 +313,8 @@
     if (!p_tcb)
         return;
 
-    // If we make no modification, i.e. kill app that was never connected to a device,
-    // skip updating the device state.
+    // If we make no modification, i.e. kill app that was never connected to a
+    // device, skip updating the device state.
     if (!gatt_update_app_hold_link_status(gatt_if, p_tcb, is_add))
         return;
 
@@ -554,7 +556,8 @@
  *
  * Description      This function is called when data is received from L2CAP.
  *                  if we are the originator of the connection, we are the ATT
- *                  client, and the received message is queued up for the client.
+ *                  client, and the received message is queued up for the
+ *                  client.
  *
  *                  If we are the destination of the connection, we are the ATT
  *                  server, so the message is passed to the server processing
@@ -981,7 +984,8 @@
  *
  * Description      This function is called when data is received from L2CAP.
  *                  if we are the originator of the connection, we are the ATT
- *                  client, and the received message is queued up for the client.
+ *                  client, and the received message is queued up for the
+ *                  client.
  *
  *                  If we are the destination of the connection, we are the ATT
  *                  server, so the message is passed to the server processing
@@ -1061,8 +1065,8 @@
  *
  * Function         gatt_send_srv_chg_ind
  *
- * Description      This function is called to send a service chnaged indication to
- *                  the specified bd address
+ * Description      This function is called to send a service chnaged indication
+ *                  to the specified bd address
  *
  * Returns          void
  *
diff --git a/stack/gatt/gatt_sr.cc b/stack/gatt/gatt_sr.cc
index 3da64f9..b0e5b87 100644
--- a/stack/gatt/gatt_sr.cc
+++ b/stack/gatt/gatt_sr.cc
@@ -76,7 +76,7 @@
  *
  * Function         gatt_sr_cmd_empty
  *
- * Description      This function check the server command queue is empty or not.
+ * Description      This function checks if the server command queue is empty.
  *
  * Returns          true if empty, false if there is pending command.
  *
@@ -247,8 +247,8 @@
  *
  * Function         gatt_sr_process_app_rsp
  *
- * Description      This function checks whether the response message from application
- *                  match any pending request or not.
+ * Description      This function checks whether the response message from
+ *                  application matches any pending request.
  *
  * Returns          void
  *
@@ -669,7 +669,8 @@
  *
  * Function         gatts_internal_read_by_type_req
  *
- * Description      check to see if the ReadByType request can be handled internally.
+ * Description      Check to see if the ReadByType request can be handled
+ *                  internally.
  *
  * Returns          void
  *
@@ -732,8 +733,9 @@
  *
  * Function         gatts_process_primary_service_req
  *
- * Description      process ReadByGroupType/ReadByTypeValue request, for discover
- *                  all primary services or discover primary service by UUID request.
+ * Description      Process ReadByGroupType/ReadByTypeValue request, for
+ *                  discovering all primary services or discover primary service
+ *                  by UUID request.
  *
  * Returns          void
  *
@@ -1197,8 +1199,8 @@
  *
  * Function         gatts_process_attribute_req
  *
- * Description      This function is called to process the per attribute handle request
- *                  from client.
+ * Description      This function is called to process the per attribute handle
+ *                  request from client.
  *
  * Returns          void
  *
@@ -1309,8 +1311,8 @@
  *
  * Function         gatts_chk_pending_ind
  *
- * Description      This function check any pending indication needs to be sent if
- *                  there is a pending indication then sent the indication
+ * Description      This function check any pending indication needs to be sent
+ *                  if there is a pending indication then sent the indication
  *
  * Returns          void
  *
@@ -1335,10 +1337,10 @@
  *
  * Function         gatts_proc_ind_ack
  *
- * Description      This function process the Indication ack
+ * Description      This function processes the Indication ack
  *
- * Returns          true continue to process the indication ack by the aaplication
- *                  if the ACk is not a Service Changed Indication Ack
+ * Returns          true continue to process the indication ack by the
+ *                  application if the ACK is not a Service Changed Indication
  *
  ******************************************************************************/
 static bool    gatts_proc_ind_ack(tGATT_TCB *p_tcb, uint16_t ack_handle)
@@ -1362,7 +1364,8 @@
  *
  * Function         gatts_process_value_conf
  *
- * Description      This function is called to process the handle value confirmation.
+ * Description      This function is called to process the handle value
+ *                  confirmation.
  *
  * Returns          void
  *
diff --git a/stack/gatt/gatt_utils.cc b/stack/gatt/gatt_utils.cc
index be49921..e1e3a9c 100644
--- a/stack/gatt/gatt_utils.cc
+++ b/stack/gatt/gatt_utils.cc
@@ -195,7 +195,8 @@
  *
  * Description  Add a pending indication
  *
- * Returns    Pointer to the current pending indication buffer, NULL no buffer available
+ * Returns    Pointer to the current pending indication buffer, NULL no buffer
+ *            available
  *
  ******************************************************************************/
 tGATT_VALUE *gatt_add_pending_ind(tGATT_TCB  *p_tcb, tGATT_VALUE *p_ind)
@@ -217,7 +218,8 @@
  *
  * Description  Add a service chnage client to the service change client queue
  *
- * Returns    Pointer to the service change client buffer; Null no buffer available
+ * Returns    Pointer to the service change client buffer; Null no buffer
+ *            available
  *
  ******************************************************************************/
 tGATTS_SRV_CHG *gatt_add_srv_chg_clt(tGATTS_SRV_CHG *p_srv_chg)
@@ -292,7 +294,8 @@
  *
  * Function     gatt_find_hdl_buffer_by_app_id
  *
- * Description  Find handle range buffer by app ID, service and service instance ID.
+ * Description  Find handle range buffer by app ID, service and service instance
+ *              ID.
  *
  * Returns    Pointer to the buffer, NULL no buffer available
  *
@@ -343,8 +346,8 @@
  *
  * Function         gatt_free_srvc_db_buffer_app_id
  *
- * Description      free the service attribute database buffers by the owner of the
- *                  service app ID.
+ * Description      free the service attribute database buffers by the owner of
+ *                  the service app ID.
  *
  * Returns       None
  *
@@ -370,11 +373,11 @@
 }
 /*******************************************************************************
  *
- * Function         gatt_is_last_attribute
+ * Function        gatt_is_last_attribute
  *
- * Description     Check this is the last attribute of the specified value or not
+ * Description     Check if this is the last attribute of the specified value
  *
- * Returns       true - yes this is the last attribute
+ * Returns         true - yes this is the last attribute
  *
  ******************************************************************************/
 bool    gatt_is_last_attribute(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ELEM *p_start, tBT_UUID value)
@@ -697,8 +700,8 @@
  *
  * Function         gatt_is_srv_chg_ind_pending
  *
- * Description      Check whether a service chnaged is in the indication pending queue
- *                  or waiting for an Ack already
+ * Description      Check whether a service chnaged is in the indication pending
+ *                  queue or waiting for an Ack already
  *
  * Returns         bool
  *
@@ -738,7 +741,8 @@
  *
  * Function         gatt_is_bda_in_the_srv_chg_clt_list
  *
- * Description      This function check the specified bda is in the srv chg clinet list or not
+ * Description      This function check the specified bda is in the srv chg
+ *                  client list or not
  *
  * Returns         pointer to the found elemenet otherwise NULL
  *
@@ -774,7 +778,7 @@
  *
  * Description
  *
- * Returns           GATT_INDEX_INVALID if not found. Otherwise index to the tcb.
+ * Returns          GATT_INDEX_INVALID if not found. Otherwise index to the tcb.
  *
  ******************************************************************************/
 bool    gatt_is_bda_connected(BD_ADDR bda)
@@ -798,9 +802,9 @@
  *
  * Function         gatt_find_i_tcb_by_addr
  *
- * Description      The function searches for an empty tcb entry, and return the index.
+ * Description      Search for an empty tcb entry, and return the index.
  *
- * Returns           GATT_INDEX_INVALID if not found. Otherwise index to the tcb.
+ * Returns          GATT_INDEX_INVALID if not found. Otherwise index to the tcb.
  *
  ******************************************************************************/
 uint8_t gatt_find_i_tcb_by_addr(BD_ADDR bda, tBT_TRANSPORT transport)
@@ -842,9 +846,9 @@
  *
  * Function         gatt_find_tcb_by_addr
  *
- * Description      The function searches for an empty tcb entry, and return pointer.
+ * Description      Search for an empty tcb entry, and return pointer.
  *
- * Returns           NULL if not found. Otherwise index to the tcb.
+ * Returns          NULL if not found. Otherwise index to the tcb.
  *
  ******************************************************************************/
 tGATT_TCB * gatt_find_tcb_by_addr(BD_ADDR bda, tBT_TRANSPORT transport)
@@ -862,9 +866,9 @@
  *
  * Function         gatt_find_i_tcb_free
  *
- * Description      The function searches for an empty tcb entry, and return the index.
+ * Description      Search for an empty tcb entry, and return the index.
  *
- * Returns           GATT_INDEX_INVALID if not found. Otherwise index to the tcb.
+ * Returns          GATT_INDEX_INVALID if not found. Otherwise index to the tcb.
  *
  ******************************************************************************/
 uint8_t gatt_find_i_tcb_free(void)
@@ -885,9 +889,9 @@
  *
  * Function         gatt_allocate_tcb_by_bdaddr
  *
- * Description      The function locate or allocate new tcb entry for matching bda.
+ * Description      Locate or allocate a new tcb entry for matching bda.
  *
- * Returns           GATT_INDEX_INVALID if not found. Otherwise index to the tcb.
+ * Returns          GATT_INDEX_INVALID if not found. Otherwise index to the tcb.
  *
  ******************************************************************************/
 tGATT_TCB * gatt_allocate_tcb_by_bdaddr(BD_ADDR bda, tBT_TRANSPORT transport)
@@ -1274,9 +1278,10 @@
  *
  * Function         gatt_sr_find_i_rcb_by_handle
  *
- * Description      The function searches for a service that owns a specific handle.
+ * Description      Search for a service that owns a specific handle.
  *
- * Returns          GATT_MAX_SR_PROFILES if not found. Otherwise index of th eservice.
+ * Returns          GATT_MAX_SR_PROFILES if not found. Otherwise the index of
+ *                  the service.
  *
  ******************************************************************************/
 uint8_t gatt_sr_find_i_rcb_by_handle(uint16_t handle)
@@ -1299,7 +1304,8 @@
  *
  * Function         gatt_sr_find_i_rcb_by_handle
  *
- * Description      The function searches for a service that owns a specific handle.
+ * Description      The function searches for a service that owns a specific
+ *                  handle.
  *
  * Returns          0 if not found. Otherwise index of th eservice.
  *
@@ -1334,7 +1340,8 @@
  *
  * Function         gatt_sr_find_i_rcb_by_handle
  *
- * Description      The function searches for a service that owns a specific handle.
+ * Description      The function searches for a service that owns a specific
+ *                  handle.
  *
  * Returns          0 if not found. Otherwise index of th eservice.
  *
@@ -1611,7 +1618,8 @@
  *
  * Description      The function allocates a GATT  connection link control block
  *
- * Returns           NULL if not found. Otherwise pointer to the connection link block.
+ * Returns          NULL if not found. Otherwise pointer to the connection link
+ *                  block.
  *
  ******************************************************************************/
 tGATT_CLCB *gatt_clcb_alloc (uint16_t conn_id)
@@ -1644,7 +1652,8 @@
  *
  * Function         gatt_clcb_dealloc
  *
- * Description      The function de allocates a GATT  connection link control block
+ * Description      The function de-allocates a GATT connection link control
+ *                  block
  *
  * Returns         None
  *
@@ -1691,7 +1700,8 @@
  *
  * Function         gatt_num_apps_hold_link
  *
- * Description      The function find the number of applcaitions is holding the link
+ * Description      The function find the number of applcaitions is holding the
+ *                  link
  *
  * Returns          total number of applications holding this acl link.
  *
@@ -2186,8 +2196,8 @@
  *
  * Function         gatt_cleanup_upon_disc
  *
- * Description      This function cleans up the control blocks when L2CAP channel
- *                  disconnect.
+ * Description      This function cleans up the control blocks when L2CAP
+ *                  channel disconnect.
  *
  * Returns          16 bits uuid.
  *
@@ -2324,9 +2334,9 @@
  *
  * Function         gatt_is_bg_dev_for_app
  *
- * Description      find is this one of the background devices for the application
+ * Description      Is this one of the background devices for the application
  *
- * Returns          true this is one of the background devices for the  application
+ * Returns          true if it is, otherwise false
  *
  ******************************************************************************/
 bool    gatt_is_bg_dev_for_app(tGATT_BG_CONN_DEV *p_dev, tGATT_IF gatt_if)
@@ -2396,7 +2406,7 @@
  *
  * Function         gatt_add_bg_dev_list
  *
- * Description      add/remove device from the back ground connection device list
+ * Description      Add/remove a device from the background connection list
  *
  * Returns          true if device added to the list; false failed
  *
@@ -2446,7 +2456,8 @@
  *
  * Function         gatt_remove_bg_dev_for_app
  *
- * Description      Remove the application interface for the specified background device
+ * Description      Remove the application interface for the specified
+ *                  background device
  *
  * Returns          Boolean
  *
@@ -2467,7 +2478,8 @@
  *
  * Function         gatt_get_num_apps_for_bg_dev
  *
- * Description      Gte the number of applciations for the specified background device
+ * Description      Get the number of applciations for the specified background
+ *                  device
  *
  * Returns          uint8_t total number fo applications
  *
@@ -2494,7 +2506,8 @@
  *
  * Function         gatt_find_app_for_bg_dev
  *
- * Description      find the application interface for the specified background device
+ * Description      Find the application interface for the specified background
+ *                  device
  *
  * Returns          Boolean
  *
@@ -2528,8 +2541,8 @@
  *
  * Function         gatt_remove_bg_dev_from_list
  *
- * Description      add/remove device from the back ground connection device list or
- *                  listening to advertising list.
+ * Description      add/remove device from the back ground connection device
+ *                  list or listening to advertising list.
  *
  * Returns          pointer to the device record
  *
@@ -2628,14 +2641,14 @@
  *
  * Function         gatt_update_auto_connect_dev
  *
- * Description      This function add or remove a device for background connection
- *                  procedure.
+ * Description      This function add or remove a device for background
+ *                  connection procedure.
  *
  * Parameters       gatt_if: Application ID.
  *                  add: add peer device
  *                  bd_addr: peer device address.
  *
- * Returns          true if connection started; false if connection start failure.
+ * Returns          true if connection started; false otherwise.
  *
  ******************************************************************************/
 bool    gatt_update_auto_connect_dev (tGATT_IF gatt_if, bool    add, BD_ADDR bd_addr)
diff --git a/stack/hid/hidh_api.cc b/stack/hid/hidh_api.cc
index b6f8dd2..4b4dd7e 100644
--- a/stack/hid/hidh_api.cc
+++ b/stack/hid/hidh_api.cc
@@ -234,7 +234,8 @@
  *
  * Function         HID_HostInit
  *
- * Description      This function initializes the control block and trace variable
+ * Description      This function initializes the control block and trace
+ *                  variable
  *
  * Returns          void
  *
@@ -259,8 +260,8 @@
  *
  * Function         HID_HostSetTraceLevel
  *
- * Description      This function sets the trace level for HID Host. If called with
- *                  a value of 0xFF, it simply reads the current trace level.
+ * Description      This function sets the trace level for HID Host. If called
+ *                  with 0xFF, it simply reads the current trace level.
  *
  * Returns          the new (current) trace level
  *
@@ -388,7 +389,8 @@
  *
  * Function         HID_HostRemoveDev
  *
- * Description      This removes the device from list devices that host has to manage.
+ * Description      This removes the device from the list of devices that the
+ *                  host has to manage.
  *
  * Returns          tHID_STATUS
  *
@@ -440,8 +442,8 @@
  *
  * Description      This function is called when the host has a report to send.
  *
- *                  report_id: is only used on GET_REPORT transaction if is specified.
- *                              only valid when it's a non-zero value.
+ *                  report_id: is only used on GET_REPORT transaction if is
+ *                              specified. only valid when it is non-zero.
  *
  * Returns          void
  *
diff --git a/stack/hid/hidh_conn.cc b/stack/hid/hidh_conn.cc
index f41c3e3..7a57202 100644
--- a/stack/hid/hidh_conn.cc
+++ b/stack/hid/hidh_conn.cc
@@ -52,7 +52,7 @@
 static void hidh_conn_retry (uint8_t dhandle);
 
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 static void hidh_l2cif_connect_ind (BD_ADDR  bd_addr, uint16_t l2cap_cid,
                                     uint16_t psm, uint8_t l2cap_id);
@@ -797,7 +797,8 @@
  *
  * Description      This function is called when data is received from L2CAP.
  *                  if we are the originator of the connection, we are the SDP
- *                  client, and the received message is queued up for the client.
+ *                  client, and the received message is queued up for the
+ *                  client.
  *
  *                  If we are the destination of the connection, we are the SDP
  *                  server, so the message is passed to the server processing
@@ -1018,7 +1019,8 @@
  *
  * Function         hidh_conn_initiate
  *
- * Description      This function is called by the management to create a connection.
+ * Description      This function is called by the management to create a
+ *                  connection.
  *
  * Returns          void
  *
diff --git a/stack/hid/hidh_int.h b/stack/hid/hidh_int.h
index 17bd1e0..0951b38 100644
--- a/stack/hid/hidh_int.h
+++ b/stack/hid/hidh_int.h
@@ -46,7 +46,7 @@
     			                 0x04- sdp_disable; */
     uint8_t        state;  /* Device state if in HOST-KNOWN mode */
     uint8_t        conn_substate;
-    uint8_t        conn_tries; /* Remembers to the number of connection attempts while CONNECTING */
+    uint8_t        conn_tries; /* Remembers the number of connection attempts while CONNECTING */
 
     tHID_CONN      conn; /* L2CAP channel info */
 } tHID_HOST_DEV_CTB;
diff --git a/stack/include/avct_api.h b/stack/include/avct_api.h
index 3c410a6..0d914b9 100644
--- a/stack/include/avct_api.h
+++ b/stack/include/avct_api.h
@@ -58,8 +58,10 @@
 #define AVCT_DATA_BROWSE            0x0002    /* for the browsing channel */
 #define AVCT_DATA_PARTIAL           0x0100    /* Only have room for a partial message */
 
-#define AVCT_MIN_CONTROL_MTU        48  /* Per the AVRC spec, minimum MTU for the control channel */
-#define AVCT_MIN_BROWSE_MTU         335 /* Per the AVRC spec, minimum MTU for the browsing channel */
+/* Per the AVRC spec, minimum MTU for the control channel */
+#define AVCT_MIN_CONTROL_MTU        48
+/* Per the AVRC spec, minimum MTU for the browsing channel */
+#define AVCT_MIN_BROWSE_MTU         335
 
 /* Message offset.  The number of bytes needed by the protocol stack for the
  * protocol headers of an AVCTP message packet.
@@ -167,7 +169,8 @@
  *                  create an initiator connection, an AVCTP connection to
  *                  the peer device is initiated if one does not already exist.
  *                  If an acceptor connection is created, the connection waits
- *                  passively for an incoming AVCTP connection from a peer device.
+ *                  passively for an incoming AVCTP connection from a peer
+ *                  device.
  *
  *
  * Returns          AVCT_SUCCESS if successful, otherwise error.
@@ -201,7 +204,8 @@
  *                  create an initiator connection, an AVCTP connection to
  *                  the peer device is initiated if one does not already exist.
  *                  If an acceptor connection is created, the connection waits
- *                  passively for an incoming AVCTP connection from a peer device.
+ *                  passively for an incoming AVCTP connection from a peer
+ *                  device.
  *
  *
  * Returns          AVCT_SUCCESS if successful, otherwise error.
@@ -259,8 +263,10 @@
  *                  application calls AVCT_MsgReq() when AVCTP is congested
  *                  the message may be discarded.  The application may make its
  *                  first call to AVCT_MsgReq() after it receives an
- *                  AVCT_CONNECT_CFM_EVT or AVCT_CONNECT_IND_EVT on control channel or
- *                  AVCT_BROWSE_CONN_CFM_EVT or AVCT_BROWSE_CONN_IND_EVT on browsing channel.
+ *                  AVCT_CONNECT_CFM_EVT or AVCT_CONNECT_IND_EVT on control
+ *                  channel or
+ *                  AVCT_BROWSE_CONN_CFM_EVT or AVCT_BROWSE_CONN_IND_EVT on
+ *                  browsing channel.
  *
  *                  p_msg->layer_specific must be set to
  *                  AVCT_DATA_CTRL for control channel traffic;
diff --git a/stack/include/avdt_api.h b/stack/include/avdt_api.h
index c009639..34755f9 100644
--- a/stack/include/avdt_api.h
+++ b/stack/include/avdt_api.h
@@ -91,10 +91,10 @@
 #define AVDT_MEDIA_TYPE_VIDEO   1       /* Video SEP */
 #define AVDT_MEDIA_TYPE_MULTI   2       /* Multimedia SEP */
 
-/* for reporting packets */
-#define AVDT_RTCP_PT_SR         200     /* the packet type - SR (Sender Report) */
-#define AVDT_RTCP_PT_RR         201     /* the packet type - RR (Receiver Report) */
-#define AVDT_RTCP_PT_SDES       202     /* the packet type - SDES (Source Description) */
+/* for reporting packets (packet types) */
+#define AVDT_RTCP_PT_SR         200     /* SR (Sender Report) */
+#define AVDT_RTCP_PT_RR         201     /* RR (Receiver Report) */
+#define AVDT_RTCP_PT_SDES       202     /* SDES (Source Description) */
 typedef uint8_t AVDT_REPORT_TYPE;
 
 #define AVDT_RTCP_SDES_CNAME    1       /* SDES item CNAME */
@@ -152,32 +152,58 @@
  * These error codes are unrelated to the result values returned by the
  * AVDTP API functions.
 */
-#define AVDT_ERR_HEADER             0x01    /* Bad packet header format */
-#define AVDT_ERR_LENGTH             0x11    /* Bad packet length */
-#define AVDT_ERR_SEID               0x12    /* Invalid SEID */
-#define AVDT_ERR_IN_USE             0x13    /* The SEP is in use */
-#define AVDT_ERR_NOT_IN_USE         0x14    /* The SEP is not in use */
-#define AVDT_ERR_CATEGORY           0x17    /* Bad service category */
-#define AVDT_ERR_PAYLOAD            0x18    /* Bad payload format */
-#define AVDT_ERR_NSC                0x19    /* Requested command not supported */
-#define AVDT_ERR_INVALID_CAP        0x1A    /* Reconfigure attempted invalid capabilities */
-#define AVDT_ERR_RECOV_TYPE         0x22    /* Requested recovery type not defined */
-#define AVDT_ERR_MEDIA_TRANS        0x23    /* Media transport capability not correct */
-#define AVDT_ERR_RECOV_FMT          0x25    /* Recovery service capability not correct */
-#define AVDT_ERR_ROHC_FMT           0x26    /* Header compression service capability not correct */
-#define AVDT_ERR_CP_FMT             0x27    /* Content protection service capability not correct */
-#define AVDT_ERR_MUX_FMT            0x28    /* Multiplexing service capability not correct */
-#define AVDT_ERR_UNSUP_CFG          0x29    /* Configuration not supported */
-#define AVDT_ERR_BAD_STATE          0x31    /* Message cannot be processed in this state */
-#define AVDT_ERR_REPORT_FMT         0x65    /* Report service capability not correct */
-#define AVDT_ERR_SERVICE            0x80    /* Invalid service category */
-#define AVDT_ERR_RESOURCE           0x81    /* Insufficient resources */
-#define AVDT_ERR_INVALID_MCT        0xC1    /* Invalid Media Codec Type */
-#define AVDT_ERR_UNSUP_MCT          0xC2    /* Unsupported Media Codec Type */
-#define AVDT_ERR_INVALID_LEVEL      0xC3    /* Invalid Level */
-#define AVDT_ERR_UNSUP_LEVEL        0xC4    /* Unsupported Level */
-#define AVDT_ERR_INVALID_CP         0xE0    /* Invalid Content Protection Type */
-#define AVDT_ERR_INVALID_FORMAT     0xE1    /* Invalid Content Protection format */
+/* Bad packet header format */
+#define AVDT_ERR_HEADER             0x01
+/* Bad packet length */
+#define AVDT_ERR_LENGTH             0x11
+/* Invalid SEID */
+#define AVDT_ERR_SEID               0x12
+/* The SEP is in use */
+#define AVDT_ERR_IN_USE             0x13
+/* The SEP is not in use */
+#define AVDT_ERR_NOT_IN_USE         0x14
+/* Bad service category */
+#define AVDT_ERR_CATEGORY           0x17
+/* Bad payload format */
+#define AVDT_ERR_PAYLOAD            0x18
+/* Requested command not supported */
+#define AVDT_ERR_NSC                0x19
+/* Reconfigure attempted invalid capabilities */
+#define AVDT_ERR_INVALID_CAP        0x1A
+/* Requested recovery type not defined */
+#define AVDT_ERR_RECOV_TYPE         0x22
+/* Media transport capability not correct */
+#define AVDT_ERR_MEDIA_TRANS        0x23
+/* Recovery service capability not correct */
+#define AVDT_ERR_RECOV_FMT          0x25
+/* Header compression service capability not correct */
+#define AVDT_ERR_ROHC_FMT           0x26
+/* Content protection service capability not correct */
+#define AVDT_ERR_CP_FMT             0x27
+/* Multiplexing service capability not correct */
+#define AVDT_ERR_MUX_FMT            0x28
+/* Configuration not supported */
+#define AVDT_ERR_UNSUP_CFG          0x29
+/* Message cannot be processed in this state */
+#define AVDT_ERR_BAD_STATE          0x31
+/* Report service capability not correct */
+#define AVDT_ERR_REPORT_FMT         0x65
+/* Invalid service category */
+#define AVDT_ERR_SERVICE            0x80
+/* Insufficient resources */
+#define AVDT_ERR_RESOURCE           0x81
+/* Invalid Media Codec Type */
+#define AVDT_ERR_INVALID_MCT        0xC1
+/* Unsupported Media Codec Type */
+#define AVDT_ERR_UNSUP_MCT          0xC2
+/* Invalid Level */
+#define AVDT_ERR_INVALID_LEVEL      0xC3
+/* Unsupported Level */
+#define AVDT_ERR_UNSUP_LEVEL        0xC4
+/* Invalid Content Protection Type */
+#define AVDT_ERR_INVALID_CP         0xE0
+/* Invalid Content Protection format */
+#define AVDT_ERR_INVALID_FORMAT     0xE1
 
 /* Additional error codes.  This indicates error codes used by AVDTP
  * in addition to the ones defined in the specifications.
@@ -307,7 +333,8 @@
     uint8_t         int_seid;           /* Stream endpoint ID of stream initiating the operation */
 } tAVDT_SETCONFIG;
 
-/* This data structure is associated with the AVDT_OPEN_IND_EVT and AVDT_OPEN_CFM_EVT. */
+/* This data structure is associated with the AVDT_OPEN_IND_EVT and
+ * AVDT_OPEN_CFM_EVT. */
 typedef struct {
     tAVDT_EVT_HDR   hdr;                /* Event header */
     uint16_t        peer_mtu;           /* Transport channel L2CAP MTU of the peer */
@@ -373,9 +400,9 @@
                                      uint32_t time_stamp, uint8_t m_pt);
 
 #if (AVDT_REPORTING == TRUE)
-/* This is the report callback function.  It is executed when AVDTP has a reporting
- * packet ready for the application.  This function is required for streams
- * created with AVDT_PSC_REPORT.
+/* This is the report callback function.  It is executed when AVDTP has a
+ * reporting packet ready for the application.  This function is required for
+ * streams created with AVDT_PSC_REPORT.
 */
 typedef void (tAVDT_REPORT_CBACK)(uint8_t handle, AVDT_REPORT_TYPE type,
                                 tAVDT_REPORT_DATA *p_data);
@@ -435,8 +462,7 @@
  * Description      This function is called to deregister use AVDTP protocol.
  *                  It is called when AVDTP is no longer being used by any
  *                  application in the system.  Before this function can be
- *                  called, all streams must be removed with AVDT_RemoveStream().
- *
+ *                  called, all streams must be removed with AVDT_RemoveStream.
  *
  * Returns          void
  *
@@ -495,8 +521,8 @@
  *                  on the peer device, if not already present, and discovers
  *                  the stream endpoints on the peer device.  (Please note
  *                  that AVDTP discovery is unrelated to SDP discovery).
- *                  This function can be called at any time regardless of whether
- *                  there is an AVDTP connection to the peer device.
+ *                  This function can be called at any time regardless of
+ *                  whether there is an AVDTP connection to the peer device.
  *
  *                  When discovery is complete, an AVDT_DISCOVER_CFM_EVT
  *                  is sent to the application via its callback function.
@@ -592,7 +618,8 @@
  *                  on the peer device, if not already present, and connects
  *                  to a stream endpoint on a peer device.  When the connection
  *                  is completed, an AVDT_OPEN_CFM_EVT is sent to the
- *                  application via the control callback function for this handle.
+ *                  application via the control callback function for this
+ *                  handle.
  *
  * Returns          AVDT_SUCCESS if successful, otherwise error.
  *
@@ -624,7 +651,8 @@
  *                  transfer of media packets for the streams.  All stream
  *                  endpoints must previously be opened.  When the streams
  *                  are started, an AVDT_START_CFM_EVT is sent to the
- *                  application via the control callback function for each stream.
+ *                  application via the control callback function for each
+ *                  stream.
  *
  *
  * Returns          AVDT_SUCCESS if successful, otherwise error.
@@ -675,7 +703,8 @@
  *                  can only be called if the stream is opened but not started
  *                  or if the stream has been suspended.  When the procedure
  *                  is completed, an AVDT_RECONFIG_CFM_EVT is sent to the
- *                  application via the control callback function for this handle.
+ *                  application via the control callback function for this
+ *                  handle.
  *
  *
  * Returns          AVDT_SUCCESS if successful, otherwise error.
@@ -705,8 +734,8 @@
  * Description      Send a security request to the peer device.  When the
  *                  security procedure is completed, an AVDT_SECURITY_CFM_EVT
  *                  is sent to the application via the control callback function
- *                  for this handle.  (Please note that AVDTP security procedures
- *                  are unrelated to Bluetooth link level security.)
+ *                  for this handle.  (Please note that AVDTP security
+ *                  procedures are unrelated to Bluetooth link level security.)
  *
  *
  * Returns          AVDT_SUCCESS if successful, otherwise error.
@@ -749,7 +778,8 @@
  *                  to AVDT_WriteReq() after it receives an AVDT_START_CFM_EVT
  *                  or AVDT_START_IND_EVT.
  *
- *                  The application passes the packet using the BT_HDR structure.
+ *                  The application passes the packet using the BT_HDR
+ *                  structure.
  *                  This structure is described in section 2.1.  The offset
  *                  field must be equal to or greater than AVDT_MEDIA_OFFSET.
  *                  This allows enough space in the buffer for the L2CAP and
@@ -852,7 +882,8 @@
  *
  * Function         AVDT_GetSignalChannel
  *
- * Description      Get the L2CAP CID used by the signal channel of the given handle.
+ * Description      Get the L2CAP CID used by the signal channel of the given
+ *                  handle.
  *
  * Returns          CID if successful, otherwise 0.
  *
diff --git a/stack/include/avdtc_api.h b/stack/include/avdtc_api.h
index 4c53add..c8c3bb6 100644
--- a/stack/include/avdtc_api.h
+++ b/stack/include/avdtc_api.h
@@ -36,17 +36,28 @@
 /* start AVDTC events here to distinguish from AVDT events */
 #define AVDTC_EVT_BEGIN             0x80
 
-#define AVDTC_DISCOVER_IND_EVT      (0 + AVDTC_EVT_BEGIN)   /* Discover indication */
-#define AVDTC_GETCAP_IND_EVT        (1 + AVDTC_EVT_BEGIN)   /* Get capabilities indication */
-#define AVDTC_SETCONFIG_CFM_EVT     (2 + AVDTC_EVT_BEGIN)   /* Set configuration confirm */
-#define AVDTC_GETCONFIG_IND_EVT     (3 + AVDTC_EVT_BEGIN)   /* Get configuration indication */
-#define AVDTC_GETCONFIG_CFM_EVT     (4 + AVDTC_EVT_BEGIN)   /* Get configuration confirm */
-#define AVDTC_OPEN_IND_EVT          (5 + AVDTC_EVT_BEGIN)   /* Open indication */
-#define AVDTC_START_IND_EVT         (6 + AVDTC_EVT_BEGIN)   /* Start indication */
-#define AVDTC_CLOSE_IND_EVT         (7 + AVDTC_EVT_BEGIN)   /* Close indication */
-#define AVDTC_SUSPEND_IND_EVT       (8 + AVDTC_EVT_BEGIN)   /* Suspend indication */
-#define AVDTC_ABORT_IND_EVT         (9 + AVDTC_EVT_BEGIN)   /* Abort indication */
-#define AVDTC_ABORT_CFM_EVT         (10 + AVDTC_EVT_BEGIN)  /* Abort confirm */
+/* Discover indication */
+#define AVDTC_DISCOVER_IND_EVT      (0 + AVDTC_EVT_BEGIN)
+/* Get capabilities indication */
+#define AVDTC_GETCAP_IND_EVT        (1 + AVDTC_EVT_BEGIN)
+/* Set configuration confirm */
+#define AVDTC_SETCONFIG_CFM_EVT     (2 + AVDTC_EVT_BEGIN)
+/* Get configuration indication */
+#define AVDTC_GETCONFIG_IND_EVT     (3 + AVDTC_EVT_BEGIN)
+/* Get configuration confirm */
+#define AVDTC_GETCONFIG_CFM_EVT     (4 + AVDTC_EVT_BEGIN)
+/* Open indication */
+#define AVDTC_OPEN_IND_EVT          (5 + AVDTC_EVT_BEGIN)
+/* Start indication */
+#define AVDTC_START_IND_EVT         (6 + AVDTC_EVT_BEGIN)
+/* Close indication */
+#define AVDTC_CLOSE_IND_EVT         (7 + AVDTC_EVT_BEGIN)
+/* Suspend indication */
+#define AVDTC_SUSPEND_IND_EVT       (8 + AVDTC_EVT_BEGIN)
+/* Abort indication */
+#define AVDTC_ABORT_IND_EVT         (9 + AVDTC_EVT_BEGIN)
+/* Abort confirm */
+#define AVDTC_ABORT_CFM_EVT         (10 + AVDTC_EVT_BEGIN)
 
 typedef struct {
     tAVDT_EVT_HDR   hdr;                        /* Event header */
diff --git a/stack/include/avrc_api.h b/stack/include/avrc_api.h
index 1245b10..14af632 100644
--- a/stack/include/avrc_api.h
+++ b/stack/include/avrc_api.h
@@ -37,23 +37,36 @@
  ****************************************************************************/
 
 /* API function return value result codes. */
-#define AVRC_SUCCESS        AVCT_SUCCESS        /* 0 Function successful */
-#define AVRC_NO_RESOURCES   AVCT_NO_RESOURCES   /* 1 Not enough resources */
-#define AVRC_BAD_HANDLE     AVCT_BAD_HANDLE     /* 2 Bad handle */
-#define AVRC_PID_IN_USE     AVCT_PID_IN_USE     /* 3 PID already in use */
-#define AVRC_NOT_OPEN       AVCT_NOT_OPEN       /* 4 Connection not open */
-#define AVRC_MSG_TOO_BIG    5                   /* 5 the message length exceed the MTU of the browsing channel */
-#define AVRC_FAIL           0x10                /* 0x10 generic failure */
-#define AVRC_BAD_PARAM      0x11                /* 0x11 bad parameter   */
+/* 0 Function successful */
+#define AVRC_SUCCESS        AVCT_SUCCESS
+/* 1 Not enough resources */
+#define AVRC_NO_RESOURCES   AVCT_NO_RESOURCES
+/* 2 Bad handle */
+#define AVRC_BAD_HANDLE     AVCT_BAD_HANDLE
+/* 3 PID already in use */
+#define AVRC_PID_IN_USE     AVCT_PID_IN_USE
+/* 4 Connection not open */
+#define AVRC_NOT_OPEN       AVCT_NOT_OPEN
+/* 5 the message length exceed the MTU of the browsing channel */
+#define AVRC_MSG_TOO_BIG    5
+/* 0x10 generic failure */
+#define AVRC_FAIL           0x10
+/* 0x11 bad parameter   */
+#define AVRC_BAD_PARAM      0x11
 
 /* Control role - same as AVCT_TARGET/AVCT_CONTROL */
-#define AVRC_CT_TARGET      1                   /* target  */
-#define AVRC_CT_CONTROL     2                   /* controller  */
-#define AVRC_CT_PASSIVE     4                   /* If conflict, allow the other side to succeed  */
+/* target  */
+#define AVRC_CT_TARGET      1
+/* controller  */
+#define AVRC_CT_CONTROL     2
+/* If conflict, allow the other side to succeed  */
+#define AVRC_CT_PASSIVE     4
 
 /* Connection role */
-#define AVRC_CONN_INT       AVCT_INT            /* initiator */
-#define AVRC_CONN_ACP       AVCT_ACP            /* Acceptor  */
+/* initiator */
+#define AVRC_CONN_INT       AVCT_INT
+/* Acceptor  */
+#define AVRC_CONN_ACP       AVCT_ACP
 
 
 /* AVRC CTRL events */
@@ -80,20 +93,21 @@
 #define AVRC_BROWSE_OPEN_IND_EVT       4
 
 /* AVRC_BROWSE_CLOSE_IND_EVT event is sent when a browse channel is closed.
- * This event can result from a call to AVRC_Close(), AVRC_CloseBrowse() or when the peer closes
- * the connection.  It is also sent when a connection attempted through
- * AVRC_OpenBrowse() fails. */
+ * This event can result from a call to AVRC_Close(), AVRC_CloseBrowse() or
+ * when the peer closes the connection.  It is also sent when a connection
+ * attempted through AVRC_OpenBrowse() fails. */
 #define AVRC_BROWSE_CLOSE_IND_EVT      5
 
-/* AVRC_BROWSE_CONG_IND_EVT event indicates that AVCTP browse channel is congested and cannot send
- * any more messages. */
+/* AVRC_BROWSE_CONG_IND_EVT event indicates that AVCTP browse channel is
+ * congested and cannot send any more messages. */
 #define AVRC_BROWSE_CONG_IND_EVT       6
 
-/* AVRC_BROWSE_UNCONG_IND_EVT event indicates that AVCTP browse channel is uncongested and ready to
- * send messages. */
+/* AVRC_BROWSE_UNCONG_IND_EVT event indicates that AVCTP browse channel is
+ * uncongested and ready to send messages. */
 #define AVRC_BROWSE_UNCONG_IND_EVT     7
 
-/* AVRC_CMD_TIMEOUT_EVT event indicates timeout waiting for AVRC command response from the peer */
+/* AVRC_CMD_TIMEOUT_EVT event indicates timeout waiting for AVRC command
+ * response from the peer */
 #define AVRC_CMD_TIMEOUT_EVT           8
 
 /* Supported categories */
@@ -104,9 +118,13 @@
 #define AVRC_SUPF_CT_APP_SETTINGS       0x0010      /* Player Application Settings */
 #define AVRC_SUPF_CT_GROUP_NAVI         0x0020      /* Group Navigation */
 #define AVRC_SUPF_CT_BROWSE             0x0040      /* Browsing */
-#define AVRC_SUPF_CT_COVER_ART_GET_IMAGE_PROP   0x0080  /* Cover Art, get image property */
-#define AVRC_SUPF_CT_COVER_ART_GET_IMAGE        0x0100  /* Cover Art, get image */
-#define AVRC_SUPF_CT_COVER_ART_GET_THUMBNAIL    0x0200  /* Cover Art, get Linked Thumbnail */
+
+/* Cover Art, get image property */
+#define AVRC_SUPF_CT_COVER_ART_GET_IMAGE_PROP   0x0080
+/* Cover Art, get image */
+#define AVRC_SUPF_CT_COVER_ART_GET_IMAGE        0x0100
+/* Cover Art, get Linked Thumbnail */
+#define AVRC_SUPF_CT_COVER_ART_GET_THUMBNAIL    0x0200
 
 #define AVRC_SUPF_TG_CAT1               0x0001      /* Category 1 */
 #define AVRC_SUPF_TG_CAT2               0x0002      /* Category 2 */
@@ -192,8 +210,9 @@
  *                  call SDP_CreateRecord() to create an SDP record.
  *
  *                  Input Parameters:
- *                      service_uuid:  Indicates TG(UUID_SERVCLASS_AV_REM_CTRL_TARGET)
- *                                            or CT(UUID_SERVCLASS_AV_REMOTE_CONTROL)
+ *                      service_uuid:  Indicates
+ *                                       TG(UUID_SERVCLASS_AV_REM_CTRL_TARGET)
+ *                                    or CT(UUID_SERVCLASS_AV_REMOTE_CONTROL)
  *
  *                      p_service_name:  Pointer to a null-terminated character
  *                      string containing the service name.
@@ -211,7 +230,8 @@
  *                      None.
  *
  * Returns          AVRC_SUCCESS if successful.
- *                  AVRC_NO_RESOURCES if not enough resources to build the SDP record.
+ *                  AVRC_NO_RESOURCES if not enough resources to build the SDP
+ *                                    record.
  *
  *****************************************************************************/
 extern uint16_t AVRC_AddRecord(uint16_t service_uuid,
@@ -225,23 +245,24 @@
  *
  * Function         AVRC_FindService
  *
- * Description      This function is called by the application to perform service
- *                  discovery and retrieve AVRCP SDP record information from a
- *                  peer device.  Information is returned for the first service
- *                  record found on the server that matches the service UUID.
- *                  The callback function will be executed when service discovery
- *                  is complete.  There can only be one outstanding call to
- *                  AVRC_FindService() at a time; the application must wait for
- *                  the callback before it makes another call to the function.
- *                  The application is responsible for allocating memory for the
- *                  discovery database.  It is recommended that the size of the
- *                  discovery database be at least 300 bytes.  The application
- *                  can deallocate the memory after the callback function has
- *                  executed.
+ * Description      This function is called by the application to perform
+ *                  service discovery and retrieve AVRCP SDP record information
+ *                  from a peer device.  Information is returned for the first
+ *                  service record found on the server that matches the service
+ *                  UUID. The callback function will be executed when service
+ *                  discovery is complete.  There can only be one outstanding
+ *                  call to AVRC_FindService() at a time; the application must
+ *                  wait for the callback before it makes another call to the
+ *                  function. The application is responsible for allocating
+ *                  memory for the discovery database.  It is recommended that
+ *                  the size of the discovery database be at least 300 bytes.
+ *                  The application can deallocate the memory after the
+ *                  callback function has executed.
  *
  *                  Input Parameters:
- *                      service_uuid: Indicates TG(UUID_SERVCLASS_AV_REM_CTRL_TARGET)
- *                                           or CT(UUID_SERVCLASS_AV_REMOTE_CONTROL)
+ *                      service_uuid: Indicates
+ *                                       TG(UUID_SERVCLASS_AV_REM_CTRL_TARGET)
+ *                                    or CT(UUID_SERVCLASS_AV_REMOTE_CONTROL)
  *
  *                      bd_addr:  BD address of the peer device.
  *
@@ -253,7 +274,8 @@
  *                      None.
  *
  * Returns          AVRC_SUCCESS if successful.
- *                  AVRC_BAD_PARAMS if discovery database parameters are invalid.
+ *                  AVRC_BAD_PARAMS if discovery database parameters are
+ *                                  invalid.
  *                  AVRC_NO_RESOURCES if there are not enough resources to
  *                                    perform the service search.
  *
@@ -268,8 +290,8 @@
  * Description      This function is called to open a connection to AVCTP.
  *                  The connection can be either an initiator or acceptor, as
  *                  determined by the p_ccb->stream parameter.
- *                  The connection can be a target, a controller or for both role,
- *                  as determined by the p_ccb->control parameter.
+ *                  The connection can be a target, a controller or for both
+ *                  roles, as determined by the p_ccb->control parameter.
  *                  By definition, a target connection is an acceptor connection
  *                  that waits for an incoming AVCTP connection from the peer.
  *                  The connection remains available to the application until
@@ -280,9 +302,11 @@
  *                  Input Parameters:
  *                      p_ccb->company_id: Company Identifier.
  *
- *                      p_ccb->p_ctrl_cback:  Pointer to control callback function.
+ *                      p_ccb->p_ctrl_cback:  Pointer to the control callback
+ *                                            function.
  *
- *                      p_ccb->p_msg_cback:  Pointer to message callback function.
+ *                      p_ccb->p_msg_cback:  Pointer to the message callback
+ *                                           function.
  *
  *                      p_ccb->conn: AVCTP connection role.  This is set to
  *                      AVCTP_INT for initiator connections and AVCTP_ACP
@@ -290,8 +314,9 @@
  *
  *                      p_ccb->control: Control role.  This is set to
  *                      AVRC_CT_TARGET for target connections, AVRC_CT_CONTROL
- *                      for control connections or (AVRC_CT_TARGET|AVRC_CT_CONTROL)
- *                      for connections that support both roles.
+ *                      for control connections or
+ *                      (AVRC_CT_TARGET|AVRC_CT_CONTROL) for connections that
+ *                      support both roles.
  *
  *                      peer_addr: BD address of peer device.  This value is
  *                      only used for initiator connections; for acceptor
@@ -333,9 +358,9 @@
  *
  * Function         AVRC_OpenBrowse
  *
- * Description      This function is called to open a browsing connection to AVCTP.
- *                  The connection can be either an initiator or acceptor, as
- *                  determined by the conn_role.
+ * Description      This function is called to open a browsing connection to
+ *                  AVCTP. The connection can be either an initiator or
+ *                  acceptor, as determined by the conn_role.
  *                  The handle is returned by a previous call to AVRC_Open.
  *
  * Returns          AVRC_SUCCESS if successful.
@@ -366,10 +391,13 @@
  * Description      This function is used to send the AVRCP byte stream in p_pkt
  *                  down to AVCTP.
  *
- *                  It is expected that p_pkt->offset is at least AVCT_MSG_OFFSET
+ *                  It is expected that:
+ *                  p_pkt->offset is at least AVCT_MSG_OFFSET
  *                  p_pkt->layer_specific is AVCT_DATA_CTRL or AVCT_DATA_BROWSE
- *                  p_pkt->event is AVRC_OP_VENDOR, AVRC_OP_PASS_THRU or AVRC_OP_BROWSING
- *                  The above BT_HDR settings are set by the AVRC_Bld* functions.
+ *                  p_pkt->event is AVRC_OP_VENDOR, AVRC_OP_PASS_THRU or
+ *                                  AVRC_OP_BROWSING
+ *                  The above BT_HDR settings are set by the AVRC_Bld*
+ *                  functions.
  *
  * Returns          AVRC_SUCCESS if successful.
  *                  AVRC_BAD_HANDLE if handle is invalid.
@@ -467,7 +495,8 @@
  *                      handle: Handle of this connection.
  *
  *                      label: Transaction label.  Must be the same value as
- *                      passed with the command message in the callback function.
+ *                      passed with the command message in the callback
+ *                      function.
  *
  *                      p_msg: Pointer to PASS THROUGH message structure.
  *
@@ -521,7 +550,8 @@
  *                      handle: Handle of this connection.
  *
  *                      label: Transaction label.  Must be the same value as
- *                      passed with the command message in the callback function.
+ *                      passed with the command message in the callback
+ *                      function.
  *
  *                      p_msg: Pointer to VENDOR DEPENDENT message structure.
  *
@@ -576,9 +606,11 @@
  * Function         AVRC_Ctrl_ParsCommand
  *
  * Description      This function is used to parse cmds received for CTRL
- *                  Currently it is for SetAbsVolume and Volume Change Notification..
+ *                  Currently it is for SetAbsVolume and Volume Change
+ *                      Notification..
  *
- * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
+ * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
+ *                      successfully.
  *                  Otherwise, the error code defined by AVRCP 1.4
  *
  ******************************************************************************/
@@ -590,7 +622,8 @@
  *
  * Description      This function is used to parse the received command.
  *
- * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
+ * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
+ *                      successfully.
  *                  Otherwise, the error code defined by AVRCP 1.4
  *
  ******************************************************************************/
@@ -603,7 +636,8 @@
  *
  * Description      This function is used to parse the received response.
  *
- * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
+ * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
+ *                      successfully.
  *                  Otherwise, the error code defined by AVRCP 1.4
  *
  ******************************************************************************/
@@ -616,7 +650,8 @@
  *
  * Description      This function is a parse response for AVRCP Controller.
  *
- * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
+ * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
+ *                      successfully.
  *                  Otherwise, the error code defined by AVRCP 1.4
  *
  ******************************************************************************/
diff --git a/stack/include/avrc_defs.h b/stack/include/avrc_defs.h
index 6a5e0ad..e4026ed 100644
--- a/stack/include/avrc_defs.h
+++ b/stack/include/avrc_defs.h
@@ -37,10 +37,11 @@
 #define AVRC_REV_1_5        0x0105
 #define AVRC_REV_1_6        0x0106
 
-#define AVRC_PACKET_LEN             512 /* Per the spec, you must support 512 byte RC packets */
+/* defines from the spec */
+#define AVRC_PACKET_LEN             512 /* You must support 512 byte RC packets */
 
-#define AVRC_MIN_CONTROL_MTU        48  /* Per the spec, minimum MTU for the control channel */
-#define AVRC_MIN_BROWSE_MTU         335 /* Per the spec, minimum MTU for the browsing channel */
+#define AVRC_MIN_CONTROL_MTU        48  /* Minimum MTU for the control channel */
+#define AVRC_MIN_BROWSE_MTU         335 /* Minimum MTU for the browsing channel */
 
 #define AVRC_META_PDU_OFFSET        4
 #define AVRC_SUB_TYPE_LEN           4
@@ -52,7 +53,7 @@
 #define AVRC_CMD_STATUS     1   /* Check a device's current status */
 #define AVRC_CMD_SPEC_INQ   2   /* Check whether a target supports a particular
                                    control command; all operands are included */
-#define AVRC_CMD_NOTIF      3   /* Used for receiving notification of a change in a device's state */
+#define AVRC_CMD_NOTIF      3   /* Notification of a change in a device's state */
 #define AVRC_CMD_GEN_INQ    4   /* Check whether a target supports a particular
                                    control command; operands are not included */
 
@@ -100,7 +101,7 @@
 #define AVRC_OP_SUB_INFO    0x31    /* Report subunit information */
 #define AVRC_OP_VENDOR      0x00    /* Vendor-dependent commands */
 #define AVRC_OP_PASS_THRU   0x7C    /* panel subunit opcode */
-/* opcodes 80-9F and E0-FF are not used by 1394ta.Sneak one for the browsing channel */
+/* opcodes 80-9F and E0-FF are not used by 1394ta.  Sneak one for browsing */
 #define AVRC_OP_BROWSE      0xFF    /* Browsing */
 #define AVRC_OP_INVALID     0xFE    /* invalid one */
 
@@ -214,7 +215,8 @@
 #define AVRC_PDU_CHANGE_PATH                    0x72
 #define AVRC_PDU_GET_ITEM_ATTRIBUTES            0x73
 #define AVRC_PDU_PLAY_ITEM                      0x74
-#define AVRC_PDU_GET_TOTAL_NUM_OF_ITEMS         0x75        /* Added in post 1.5 */
+/* Added in post 1.5 */
+#define AVRC_PDU_GET_TOTAL_NUM_OF_ITEMS         0x75
 #define AVRC_PDU_SEARCH                         0x80
 #define AVRC_PDU_ADD_TO_NOW_PLAYING             0x90
 #define AVRC_PDU_GENERAL_REJECT                 0xA0
@@ -223,35 +225,77 @@
 */
 #define AVRC_PDU_NEXT_GROUP                     0x00
 #define AVRC_PDU_PREV_GROUP                     0x01
-/* the only pass through vendor unique commands defined by AVRC is the group navigation commands
- * The len for vendor unique data is 5 */
+/* The only pass through vendor unique commands defined by AVRC are the group
+ *  navigation commands.
+ * The len for vendor unique data is 5
+ */
 #define AVRC_PASS_THRU_GROUP_LEN                5
 
 #define AVRC_PDU_INVALID                        0xff
 /* 6.15.3 error status code for general reject */
-#define AVRC_STS_BAD_CMD        0x00    /* Invalid command, sent if TG received a PDU that it did not understand. */
-#define AVRC_STS_BAD_PARAM      0x01    /* Invalid parameter, sent if the TG received a PDU with a parameter ID that it did not understand. Sent if there is only one parameter ID in the PDU. */
-#define AVRC_STS_NOT_FOUND      0x02    /* Specified parameter not found., sent if the parameter ID is understood, but content is wrong or corrupted. */
-#define AVRC_STS_INTERNAL_ERR   0x03    /* Internal Error, sent if there are error conditions not covered by a more specific error code. */
-#define AVRC_STS_NO_ERROR       0x04    /* Operation completed without error.  This is the status that should be returned if the operation was successful. */
-#define AVRC_STS_UID_CHANGED    0x05    /* UID Changed - The UIDs on the device have changed */
-/* #define AVRC_STS_GEN_ERROR      0x06    Unknown Error - this is changed to "reserved" */
-#define AVRC_STS_BAD_DIR        0x07    /* Invalid Direction - The Direction parameter is invalid - Change Path*/
-#define AVRC_STS_NOT_DIR        0x08    /* Not a Directory - The UID provided does not refer to a folder item  Change Path*/
-#define AVRC_STS_NOT_EXIST      0x09    /* Does Not Exist - The UID provided does not refer to any item    Change Path, PlayItem, AddToNowPlaying, GetItemAttributes*/
-#define AVRC_STS_BAD_SCOPE      0x0a    /* Invalid Scope - The scope parameter is invalid  GetFolderItems, PlayItem, AddToNowPlayer, GetItemAttributes, */
-#define AVRC_STS_BAD_RANGE      0x0b    /* Range Out of Bounds - The start of range provided is not valid  GetFolderItems*/
-#define AVRC_STS_UID_IS_DIR     0x0c    /* UID is a Directory - The UID provided refers to a directory, which cannot be handled by this media player   PlayItem, AddToNowPlaying */
-#define AVRC_STS_IN_USE         0x0d    /* Media in Use - The media is not able to be used for this operation at this time PlayItem, AddToNowPlaying */
-#define AVRC_STS_NOW_LIST_FULL  0x0e    /* Now Playing List Full - No more items can be added to the Now Playing List  AddToNowPlaying*/
-#define AVRC_STS_SEARCH_NOT_SUP 0x0f    /* Search Not Supported - The Browsed Media Player does not support search Search */
-#define AVRC_STS_SEARCH_BUSY    0x10    /* Search in Progress - A search operation is already in progress  Search*/
-#define AVRC_STS_BAD_PLAYER_ID  0x11    /* Invalid Player Id - The specified Player Id does not refer to a valid player    SetAddressedPlayer, SetBrowsedPlayer*/
-#define AVRC_STS_PLAYER_N_BR    0x12    /* Player Not Browsable - The Player Id supplied refers to a Media Player which does not support browsing. SetBrowsedPlayer */
-#define AVRC_STS_PLAYER_N_ADDR  0x13    /* Player Not Addressed.  The Player Id supplied refers to a player which is not currently addressed, and the command is not able to be performed if the player is not set as addressed.   Search, SetBrowsedPlayer*/
-#define AVRC_STS_BAD_SEARCH_RES 0x14    /* No valid Search Results - The Search result list does not contain valid entries, e.g. after being invalidated due to change of browsed player   GetFolderItems */
-#define AVRC_STS_NO_AVAL_PLAYER 0x15    /* No available players ALL */
-#define AVRC_STS_ADDR_PLAYER_CHG 0x16   /* Addressed Player Changed - Register Notification */
+/* Invalid command, sent if TG received a PDU that it did not understand. */
+#define AVRC_STS_BAD_CMD        0x00
+/* Invalid parameter, sent if the TG received a PDU with a parameter ID that it
+ * did not understand. Sent if there is only one parameter ID in the PDU. */
+#define AVRC_STS_BAD_PARAM      0x01
+/* Specified parameter not found., sent if the parameter ID is understood, but
+ * content is wrong or corrupted. */
+#define AVRC_STS_NOT_FOUND      0x02
+/* Internal Error, sent if there are error conditions not covered by a more
+ * specific error code. */
+#define AVRC_STS_INTERNAL_ERR   0x03
+/* Operation completed without error.  This is the status that should be
+ * returned if the operation was successful. */
+#define AVRC_STS_NO_ERROR       0x04
+/* UID Changed - The UIDs on the device have changed */
+#define AVRC_STS_UID_CHANGED    0x05
+/* #define AVRC_STS_GEN_ERROR   0x06    Unknown Error - now "reserved" */
+/* Invalid Direction - The Direction parameter is invalid - Change Path*/
+#define AVRC_STS_BAD_DIR        0x07
+/* Not a Directory - The UID provided does not refer to a folder item -
+ *      Change Path */
+#define AVRC_STS_NOT_DIR        0x08
+/* Does Not Exist - The UID provided does not refer to any item - Change Path,
+ *      PlayItem, AddToNowPlaying, GetItemAttributes */
+#define AVRC_STS_NOT_EXIST      0x09
+/* Invalid Scope - The scope parameter is invalid - GetFolderItems, PlayItem,
+ *      AddToNowPlayer, GetItemAttributes */
+#define AVRC_STS_BAD_SCOPE      0x0a
+/* Range Out of Bounds - The start of range provided is not valid
+ *      GetFolderItems*/
+#define AVRC_STS_BAD_RANGE      0x0b
+/* UID is a Directory - The UID provided refers to a directory, which cannot be
+ * handled by this media player -  PlayItem, AddToNowPlaying */
+#define AVRC_STS_UID_IS_DIR     0x0c
+/* Media in Use - The media is not able to be used for this operation at this
+ * time - PlayItem, AddToNowPlaying */
+#define AVRC_STS_IN_USE         0x0d
+/* Now Playing List Full - No more items can be added to the Now Playing List -
+ * AddToNowPlaying*/
+#define AVRC_STS_NOW_LIST_FULL  0x0e
+/* Search Not Supported - The Browsed Media Player does not support search -
+ * Search */
+#define AVRC_STS_SEARCH_NOT_SUP 0x0f
+/* Search in Progress - A search operation is already in progress - Search*/
+#define AVRC_STS_SEARCH_BUSY    0x10
+/* Invalid Player Id - The specified Player Id does not refer to a valid player
+ * - SetAddressedPlayer, SetBrowsedPlayer*/
+#define AVRC_STS_BAD_PLAYER_ID  0x11
+/* Player Not Browsable - The Player Id supplied refers to a Media Player which
+ * does not support browsing - SetBrowsedPlayer */
+#define AVRC_STS_PLAYER_N_BR    0x12
+/* Player Not Addressed.  The Player Id supplied refers to a player which is not
+ * currently addressed, and the command is not able to be performed if the
+ * player is not set as addressed - Search, SetBrowsedPlayer*/
+#define AVRC_STS_PLAYER_N_ADDR  0x13
+/* No valid Search Results - The Search result list does not contain valid
+ * entries, e.g. after being invalidated due to change of browsed player -
+ * GetFolderItems */
+#define AVRC_STS_BAD_SEARCH_RES 0x14
+/* No available players ALL */
+#define AVRC_STS_NO_AVAL_PLAYER 0x15
+/* Addressed Player Changed - Register Notification */
+#define AVRC_STS_ADDR_PLAYER_CHG 0x16
 typedef uint8_t tAVRC_STS;
 
 /* Define the Capability IDs
@@ -363,11 +407,14 @@
 #define AVRC_ITEM_FOLDER            0x02
 #define AVRC_ITEM_MEDIA             0x03
 
-#define AVRC_SCOPE_PLAYER_LIST      0x00  /* Media Player Item - Contains all available media players */
-#define AVRC_SCOPE_FILE_SYSTEM      0x01  /* Folder Item, Media Element Item
-                                             - The virtual filesystem containing the media content of the browsed player */
-#define AVRC_SCOPE_SEARCH           0x02  /* Media Element Item  The results of a search operation on the browsed player */
-#define AVRC_SCOPE_NOW_PLAYING      0x03  /* Media Element Item  The Now Playing list (or queue) of the addressed player */
+/* Media Player Item - Contains all available media players */
+#define AVRC_SCOPE_PLAYER_LIST      0x00
+/* Folder Item, Media Element Item - The virtual filesystem containing the media content of the browsed player */
+#define AVRC_SCOPE_FILE_SYSTEM      0x01
+/* Media Element Item  The results of a search operation on the browsed player */
+#define AVRC_SCOPE_SEARCH           0x02
+/* Media Element Item  The Now Playing list (or queue) of the addressed player */
+#define AVRC_SCOPE_NOW_PLAYING      0x03
 
 #define AVRC_FOLDER_ITEM_COUNT_NONE 0xFF
 
@@ -692,13 +739,15 @@
 #define AVRC_PF_VENDOR_OFF              7
 #define AVRC_PF_VENDOR_SUPPORTED(x)     ((x)[AVRC_PF_VENDOR_OFF] & AVRC_PF_VENDOR_MASK)
 
-/* Basic Group Navigation.  This overrules the SDP entry as it is set per player.7 */
+/* Basic Group Navigation.  This overrules the SDP entry as it is set per
+ * player.7 */
 #define AVRC_PF_GROUP_NAVI_BIT_NO       57
 #define AVRC_PF_GROUP_NAVI_MASK         0x02
 #define AVRC_PF_GROUP_NAVI_OFF          7
 #define AVRC_PF_GROUP_NAVI_SUPPORTED(x) ((x)[AVRC_PF_GROUP_NAVI_OFF] & AVRC_PF_GROUP_NAVI_MASK)
 
-/* Advanced Control Player.  This bit is set if the player supports at least AVRCP 1.4. */
+/* Advanced Control Player.  This bit is set if the player supports at least
+ * AVRCP 1.4. */
 #define AVRC_PF_ADV_CTRL_BIT_NO         58
 #define AVRC_PF_ADV_CTRL_MASK           0x04
 #define AVRC_PF_ADV_CTRL_OFF            7
@@ -716,43 +765,50 @@
 #define AVRC_PF_SEARCH_OFF              7
 #define AVRC_PF_SEARCH_SUPPORTED(x)     ((x)[AVRC_PF_SEARCH_OFF] & AVRC_PF_SEARCH_MASK)
 
-/* AddToNowPlaying.  This bit is set if the player supports the AddToNowPlaying command. */
+/* AddToNowPlaying.  This bit is set if the player supports the AddToNowPlaying
+ * command. */
 #define AVRC_PF_ADD2NOWPLAY_BIT_NO      61
 #define AVRC_PF_ADD2NOWPLAY_MASK        0x20
 #define AVRC_PF_ADD2NOWPLAY_OFF         7
 #define AVRC_PF_ADD2NOWPLAY_SUPPORTED(x) ((x)[AVRC_PF_ADD2NOWPLAY_OFF] & AVRC_PF_ADD2NOWPLAY_MASK)
 
-/* UIDs unique in player browse tree.  This bit is set if the player is able to maintain unique UIDs across the player browse tree. */
+/* UIDs unique in player browse tree.  This bit is set if the player is able to
+ * maintain unique UIDs across the player browse tree. */
 #define AVRC_PF_UID_UNIQUE_BIT_NO       62
 #define AVRC_PF_UID_UNIQUE_MASK         0x40
 #define AVRC_PF_UID_UNIQUE_OFF          7
 #define AVRC_PF_UID_UNIQUE_SUPPORTED(x) ((x)[AVRC_PF_UID_UNIQUE_OFF] & AVRC_PF_UID_UNIQUE_MASK)
 
-/* OnlyBrowsableWhenAddressed.  This bit is set if the player is only able to be browsed when it is set as the Addressed Player. */
+/* OnlyBrowsableWhenAddressed.  This bit is set if the player is only able to be
+ * browsed when it is set as the Addressed Player. */
 #define AVRC_PF_BR_WH_ADDR_BIT_NO       63
 #define AVRC_PF_BR_WH_ADDR_MASK         0x80
 #define AVRC_PF_BR_WH_ADDR_OFF          7
 #define AVRC_PF_BR_WH_ADDR_SUPPORTED(x) ((x)[AVRC_PF_BR_WH_ADDR_OFF] & AVRC_PF_BR_WH_ADDR_MASK)
 
-/* OnlySearchableWhenAddressed.  This bit is set if the player is only able to be searched when it is set as the Addressed player. */
+/* OnlySearchableWhenAddressed.  This bit is set if the player is only able to
+ * be searched when it is set as the Addressed player. */
 #define AVRC_PF_SEARCH_WH_ADDR_BIT_NO   64
 #define AVRC_PF_SEARCH_WH_ADDR_MASK     0x01
 #define AVRC_PF_SEARCH_WH_ADDR_OFF      8
 #define AVRC_PF_SEARCH_WH_ADDR_SUPPORTED(x) ((x)[AVRC_PF_SEARCH_WH_ADDR_OFF] & AVRC_PF_SEARCH_WH_ADDR_MASK)
 
-/* NowPlaying.  This bit is set if the player supports the NowPlaying folder.  Note that for all players that support browsing this bit shall be set */
+/* NowPlaying.  This bit is set if the player supports the NowPlaying folder.
+ * Note that for all players that support browsing this bit shall be set */
 #define AVRC_PF_NOW_PLAY_BIT_NO         65
 #define AVRC_PF_NOW_PLAY_MASK           0x02
 #define AVRC_PF_NOW_PLAY_OFF            8
 #define AVRC_PF_NOW_PLAY_SUPPORTED(x)   ((x)[AVRC_PF_NOW_PLAY_OFF] & AVRC_PF_NOW_PLAY_MASK)
 
-/* UIDPersistency.  This bit is set if the Player is able to persist UID values between AVRCP Browse Reconnect */
+/* UIDPersistency.  This bit is set if the Player is able to persist UID values
+ * between AVRCP Browse Reconnect */
 #define AVRC_PF_UID_PERSIST_BIT_NO      66
 #define AVRC_PF_UID_PERSIST_MASK        0x04
 #define AVRC_PF_UID_PERSIST_OFF         8
 #define AVRC_PF_UID_PERSIST_SUPPORTED(x) ((x)[AVRC_PF_UID_PERSIST_OFF] & AVRC_PF_UID_PERSIST_MASK)
 
-/* NumberOfItems. This bit is set if player supports the GetTotalNumberOfItems browsing command. */
+/* NumberOfItems. This bit is set if player supports the GetTotalNumberOfItems
+ * browsing command. */
 #define AVRC_PF_GET_NUM_OF_ITEMS_BIT_NO    67
 #define AVRC_PF_GET_NUM_OF_ITEMS_MASK      0x08
 #define AVRC_PF_GET_NUM_OF_ITEMS_OFF       8
diff --git a/stack/include/bnep_api.h b/stack/include/bnep_api.h
index 6a634d6..0355be4 100644
--- a/stack/include/bnep_api.h
+++ b/stack/include/bnep_api.h
@@ -114,8 +114,9 @@
  *              Dest BD/Ethernet address
  *              Protocol
  *              Pointer to the buffer
- *              Flag to indicate whether extension headers to be forwarded are present
-*/
+ *              Flag to indicate whether extension headers to be forwarded are
+ *                present
+ */
 typedef void (tBNEP_DATA_BUF_CB) (uint16_t handle,
                                   uint8_t *src,
                                   uint8_t *dst,
@@ -131,8 +132,9 @@
  *              Protocol
  *              Pointer to the beginning of the data
  *              Length of data
- *              Flag to indicate whether extension headers to be forwarded are present
-*/
+ *              Flag to indicate whether extension headers to be forwarded are
+ *                present
+ */
 typedef void (tBNEP_DATA_IND_CB) (uint16_t handle,
                                   uint8_t *src,
                                   uint8_t *dst,
@@ -267,10 +269,10 @@
  * Description      This function creates a BNEP connection to a remote
  *                  device.
  *
- * Parameters:      p_rem_addr  - BD_ADDR of the peer
- *                  src_uuid    - source uuid for the connection
- *                  dst_uuid    - destination uuid for the connection
- *                  p_handle    - pointer to return the handle for the connection
+ * Parameters:      p_rem_addr - BD_ADDR of the peer
+ *                  src_uuid   - source uuid for the connection
+ *                  dst_uuid   - destination uuid for the connection
+ *                  p_handle   - pointer to return the handle for the connection
  *
  * Returns          BNEP_SUCCESS                if connection started
  *                  BNEP_NO_RESOURCES           if no resources
@@ -322,12 +324,14 @@
  *                  p_dest_addr  - BD_ADDR/Ethernet addr of the destination
  *                  p_buf        - pointer to address of buffer with data
  *                  protocol     - protocol type of the packet
- *                  p_src_addr   - (optional) BD_ADDR/ethernet address of the source
- *                                 (should be NULL if it is local BD Addr)
+ *                  p_src_addr   - (optional) BD_ADDR/ethernet address of the
+ *                                 source (should be NULL if it is the local BD
+ *                                         Addr)
  *                  fw_ext_present - forwarded extensions present
  *
  * Returns:         BNEP_WRONG_HANDLE       - if passed handle is not valid
- *                  BNEP_MTU_EXCEDED        - If the data length is greater than MTU
+ *                  BNEP_MTU_EXCEDED        - If the data length is greater
+ *                                            than MTU
  *                  BNEP_IGNORE_CMD         - If the packet is filtered out
  *                  BNEP_Q_SIZE_EXCEEDED    - If the Tx Q is full
  *                  BNEP_SUCCESS            - If written successfully
@@ -350,12 +354,14 @@
  *                  p_dest_addr  - BD_ADDR/Ethernet addr of the destination
  *                  p_data       - pointer to data start
  *                  protocol     - protocol type of the packet
- *                  p_src_addr   - (optional) BD_ADDR/ethernet address of the source
- *                                 (should be NULL if it is local BD Addr)
+ *                  p_src_addr   - (optional) BD_ADDR/ethernet address of the
+ *                                 source (should be NULL if it is the local BD
+ *                                 Addr)
  *                  fw_ext_present - forwarded extensions present
  *
  * Returns:         BNEP_WRONG_HANDLE       - if passed handle is not valid
- *                  BNEP_MTU_EXCEDED        - If the data length is greater than MTU
+ *                  BNEP_MTU_EXCEDED        - If the data length is greater than
+ *                                            the MTU
  *                  BNEP_IGNORE_CMD         - If the packet is filtered out
  *                  BNEP_Q_SIZE_EXCEEDED    - If the Tx Q is full
  *                  BNEP_NO_RESOURCES       - If not able to allocate a buffer
@@ -381,8 +387,10 @@
  *                  p_start_array - Array of beginings of all protocol ranges
  *                  p_end_array   - Array of ends of all protocol ranges
  *
- * Returns          BNEP_WRONG_HANDLE           - if the connection handle is not valid
- *                  BNEP_SET_FILTER_FAIL        - if the connection is in wrong state
+ * Returns          BNEP_WRONG_HANDLE           - if the connection handle is
+ *                                                not valid
+ *                  BNEP_SET_FILTER_FAIL        - if the connection is in the
+ *                                                wrong state
  *                  BNEP_TOO_MANY_FILTERS       - if too many filters
  *                  BNEP_SUCCESS                - if request sent successfully
  *
@@ -396,7 +404,8 @@
  *
  * Function         BNEP_SetMulticastFilters
  *
- * Description      This function sets the filters for multicast addresses for BNEP.
+ * Description      This function sets the filters for multicast addresses for
+ *                  BNEP.
  *
  * Parameters:      handle        - Handle for the connection
  *                  num_filters   - total number of filter ranges
@@ -405,8 +414,10 @@
  *                  p_end_array   - Pointer to sequence of ends of all
  *                                         multicast address ranges
  *
- * Returns          BNEP_WRONG_HANDLE           - if the connection handle is not valid
- *                  BNEP_SET_FILTER_FAIL        - if the connection is in wrong state
+ * Returns          BNEP_WRONG_HANDLE           - if the connection handle is
+ *                                                not valid
+ *                  BNEP_SET_FILTER_FAIL        - if the connection is in the
+ *                                                wrong state
  *                  BNEP_TOO_MANY_FILTERS       - if too many filters
  *                  BNEP_SUCCESS                - if request sent successfully
  *
@@ -433,7 +444,8 @@
  * Function         BNEP_Init
  *
  * Description      This function initializes the BNEP unit. It should be called
- *                  before accessing any other APIs to initialize the control block
+ *                  before accessing any other APIs to initialize the control
+ *                  block
  *
  * Returns          void
  *
@@ -444,10 +456,12 @@
  *
  * Function         BNEP_GetStatus
  *
- * Description      This function gets the status information for BNEP connection
+ * Description      This function gets the status information for BNEP
+ *                  connection
  *
  * Returns          BNEP_SUCCESS            - if the status is available
- *                  BNEP_NO_RESOURCES       - if no structure is passed for output
+ *                  BNEP_NO_RESOURCES       - if no structure is passed for
+ *                                            output
  *                  BNEP_WRONG_HANDLE       - if the handle is invalid
  *                  BNEP_WRONG_STATE        - if not in connected state
  *
diff --git a/stack/include/bt_types.h b/stack/include/bt_types.h
index 1993656..f2a2dfb 100644
--- a/stack/include/bt_types.h
+++ b/stack/include/bt_types.h
@@ -50,47 +50,76 @@
 */
 #define BT_EVT_MASK                 0xFF00
 #define BT_SUB_EVT_MASK             0x00FF
-                                                /* To Bluetooth Upper Layers        */
-                                                /************************************/
-#define BT_EVT_TO_BTU_L2C_EVT       0x0900      /* L2CAP event */
-#define BT_EVT_TO_BTU_HCI_EVT       0x1000      /* HCI Event                        */
-#define BT_EVT_TO_BTU_HCI_BR_EDR_EVT (0x0000 | BT_EVT_TO_BTU_HCI_EVT)      /* event from BR/EDR controller */
-#define BT_EVT_TO_BTU_HCI_AMP1_EVT   (0x0001 | BT_EVT_TO_BTU_HCI_EVT)      /* event from local AMP 1 controller */
-#define BT_EVT_TO_BTU_HCI_AMP2_EVT   (0x0002 | BT_EVT_TO_BTU_HCI_EVT)      /* event from local AMP 2 controller */
-#define BT_EVT_TO_BTU_HCI_AMP3_EVT   (0x0003 | BT_EVT_TO_BTU_HCI_EVT)      /* event from local AMP 3 controller */
+/* To Bluetooth Upper Layers        */
+/************************************/
+/* L2CAP event */
+#define BT_EVT_TO_BTU_L2C_EVT       0x0900
+/* HCI Event                        */
+#define BT_EVT_TO_BTU_HCI_EVT       0x1000
+/* event from BR/EDR controller */
+#define BT_EVT_TO_BTU_HCI_BR_EDR_EVT (0x0000 | BT_EVT_TO_BTU_HCI_EVT)
+/* event from local AMP 1 controller */
+#define BT_EVT_TO_BTU_HCI_AMP1_EVT   (0x0001 | BT_EVT_TO_BTU_HCI_EVT)
+/* event from local AMP 2 controller */
+#define BT_EVT_TO_BTU_HCI_AMP2_EVT   (0x0002 | BT_EVT_TO_BTU_HCI_EVT)
+/* event from local AMP 3 controller */
+#define BT_EVT_TO_BTU_HCI_AMP3_EVT   (0x0003 | BT_EVT_TO_BTU_HCI_EVT)
 
-#define BT_EVT_TO_BTU_HCI_ACL       0x1100      /* ACL Data from HCI                */
-#define BT_EVT_TO_BTU_HCI_SCO       0x1200      /* SCO Data from HCI                */
-#define BT_EVT_TO_BTU_HCIT_ERR      0x1300      /* HCI Transport Error              */
+/* ACL Data from HCI                */
+#define BT_EVT_TO_BTU_HCI_ACL       0x1100
+/* SCO Data from HCI                */
+#define BT_EVT_TO_BTU_HCI_SCO       0x1200
+/* HCI Transport Error              */
+#define BT_EVT_TO_BTU_HCIT_ERR      0x1300
 
-#define BT_EVT_TO_BTU_SP_EVT        0x1400      /* Serial Port Event                */
-#define BT_EVT_TO_BTU_SP_DATA       0x1500      /* Serial Port Data                 */
+/* Serial Port Event                */
+#define BT_EVT_TO_BTU_SP_EVT        0x1400
+/* Serial Port Data                 */
+#define BT_EVT_TO_BTU_SP_DATA       0x1500
 
-#define BT_EVT_TO_BTU_HCI_CMD       0x1600      /* HCI command from upper layer     */
+/* HCI command from upper layer     */
+#define BT_EVT_TO_BTU_HCI_CMD       0x1600
 
 
-#define BT_EVT_TO_BTU_L2C_SEG_XMIT  0x1900      /* L2CAP segment(s) transmitted     */
+/* L2CAP segment(s) transmitted     */
+#define BT_EVT_TO_BTU_L2C_SEG_XMIT  0x1900
 
-#define BT_EVT_PROXY_INCOMING_MSG   0x1A00      /* BlueStackTester event: incoming message from target */
+/* BlueStackTester event: incoming message from target */
+#define BT_EVT_PROXY_INCOMING_MSG   0x1A00
 
-#define BT_EVT_BTSIM                0x1B00      /* Insight BTSIM event */
-#define BT_EVT_BTISE                0x1C00      /* Insight Script Engine event */
+/* Insight BTSIM event */
+#define BT_EVT_BTSIM                0x1B00
+/* Insight Script Engine event */
+#define BT_EVT_BTISE                0x1C00
 
-                                                /* To LM                            */
-                                                /************************************/
-#define BT_EVT_TO_LM_HCI_CMD        0x2000      /* HCI Command                      */
-#define BT_EVT_TO_LM_HCI_ACL        0x2100      /* HCI ACL Data                     */
-#define BT_EVT_TO_LM_HCI_SCO        0x2200      /* HCI SCO Data                     */
-#define BT_EVT_TO_LM_HCIT_ERR       0x2300      /* HCI Transport Error              */
-#define BT_EVT_TO_LM_LC_EVT         0x2400      /* LC event                         */
-#define BT_EVT_TO_LM_LC_LMP         0x2500      /* LC Received LMP command frame    */
-#define BT_EVT_TO_LM_LC_ACL         0x2600      /* LC Received ACL data             */
-#define BT_EVT_TO_LM_LC_SCO         0x2700      /* LC Received SCO data  (not used) */
-#define BT_EVT_TO_LM_LC_ACL_TX      0x2800      /* LMP data transmit complete       */
-#define BT_EVT_TO_LM_LC_LMPC_TX     0x2900      /* LMP Command transmit complete    */
-#define BT_EVT_TO_LM_LOCAL_ACL_LB   0x2a00      /* Data to be locally loopbacked    */
-#define BT_EVT_TO_LM_HCI_ACL_ACK    0x2b00      /* HCI ACL Data ack      (not used) */
-#define BT_EVT_TO_LM_DIAG           0x2c00      /* LM Diagnostics commands          */
+/* To LM                            */
+/************************************/
+/* HCI Command                      */
+#define BT_EVT_TO_LM_HCI_CMD        0x2000
+/* HCI ACL Data                     */
+#define BT_EVT_TO_LM_HCI_ACL        0x2100
+/* HCI SCO Data                     */
+#define BT_EVT_TO_LM_HCI_SCO        0x2200
+/* HCI Transport Error              */
+#define BT_EVT_TO_LM_HCIT_ERR       0x2300
+/* LC event                         */
+#define BT_EVT_TO_LM_LC_EVT         0x2400
+/* LC Received LMP command frame    */
+#define BT_EVT_TO_LM_LC_LMP         0x2500
+/* LC Received ACL data             */
+#define BT_EVT_TO_LM_LC_ACL         0x2600
+/* LC Received SCO data  (not used) */
+#define BT_EVT_TO_LM_LC_SCO         0x2700
+/* LMP data transmit complete       */
+#define BT_EVT_TO_LM_LC_ACL_TX      0x2800
+/* LMP Command transmit complete    */
+#define BT_EVT_TO_LM_LC_LMPC_TX     0x2900
+/* Data to be locally loopbacked    */
+#define BT_EVT_TO_LM_LOCAL_ACL_LB   0x2a00
+/* HCI ACL Data ack      (not used) */
+#define BT_EVT_TO_LM_HCI_ACL_ACK    0x2b00
+/* LM Diagnostics commands          */
+#define BT_EVT_TO_LM_DIAG           0x2c00
 
 
 #define BT_EVT_TO_BTM_CMDS          0x2f00
@@ -104,7 +133,8 @@
 #define BT_EVT_TO_FTP_SRVR_CMDS     0x3600
 #define BT_EVT_TO_FTP_CLNT_CMDS     0x3700
 
-#define BT_EVT_TO_BTU_SAP           0x3800       /* SIM Access Profile events */
+/* SIM Access Profile events */
+#define BT_EVT_TO_BTU_SAP           0x3800
 
 /* opp events */
 #define BT_EVT_TO_OPP_SRVR_CMDS     0x3900
@@ -114,13 +144,18 @@
 #define BT_EVT_TO_GAP_MSG           0x3b00
 
 /* for NFC                          */
-                                                /************************************/
-#define BT_EVT_TO_NFC_NCI           0x4000      /* NCI Command, Notification or Data*/
-#define BT_EVT_TO_NFC_INIT          0x4100      /* Initialization message */
-#define BT_EVT_TO_NCI_LP            0x4200      /* Low power */
-#define BT_EVT_TO_NFC_ERR           0x4300      /* Error notification to NFC Task */
+/************************************/
+/* NCI Command, Notification or Data*/
+#define BT_EVT_TO_NFC_NCI           0x4000
+/* Initialization message */
+#define BT_EVT_TO_NFC_INIT          0x4100
+/* Low power */
+#define BT_EVT_TO_NCI_LP            0x4200
+/* Error notification to NFC Task */
+#define BT_EVT_TO_NFC_ERR           0x4300
 
-#define BT_EVT_TO_NFCCSIM_NCI       0x4a00      /* events to NFCC simulation (NCI packets) */
+/* events to NFCC simulation (NCI packets) */
+#define BT_EVT_TO_NFCCSIM_NCI       0x4a00
 
 /* HCISU Events */
 
@@ -442,8 +477,8 @@
 
 /* Broadcom proprietary UUIDs and reserved PSMs
  *
- * The lowest 4 bytes byte of the UUID or GUID depends on the feature. Typically,
- * the value of those bytes will be the PSM or SCN, but it is up to the features.
+ * The lowest 4 bytes byte of the UUID or GUID depend on the feature. Typically,
+ * the value of those bytes will be the PSM or SCN.
 */
 #define BRCM_PROPRIETARY_UUID_BASE  0xDA, 0x23, 0x41, 0x02, 0xA3, 0xBB, 0xC1, 0x71, 0xBA, 0x09, 0x6f, 0x21
 #define BRCM_PROPRIETARY_GUID_BASE  0xda23, 0x4102, 0xa3, 0xbb, 0xc1, 0x71, 0xba, 0x09, 0x6f, 0x21
diff --git a/stack/include/btm_api.h b/stack/include/btm_api.h
index 98b16ee..9e99d31 100644
--- a/stack/include/btm_api.h
+++ b/stack/include/btm_api.h
@@ -53,9 +53,9 @@
  *
  * Function         BTM_DeviceReset
  *
- * Description      This function is called to reset the controller.The Callback function
- *                  if provided is called when startup of the device has
- *                  completed.
+ * Description      This function is called to reset the controller.  The
+ *                  Callback function if provided is called when startup of the
+ *                  device has completed.
  *
  * Returns          void
  *
@@ -155,8 +155,8 @@
  * Description      This function is called to register for device status
  *                  change notifications.
  *
- * Returns          pointer to previous caller's callback function or NULL if first
- *                  registration.
+ * Returns          pointer to previous caller's callback function or NULL if
+ *                  first registration.
  *
  ******************************************************************************/
 extern tBTM_DEV_STATUS_CB *BTM_RegisterForDeviceStatusNotif (tBTM_DEV_STATUS_CB *p_cb);
@@ -170,7 +170,7 @@
  *                  specific HCI events.
  *
  *                  If is_register=true, then the function will be registered;
- *                  if is_register=false, then the function will be deregistered.
+ *                  otherwise the function will be deregistered.
  *
  * Returns          BTM_SUCCESS if successful,
  *                  BTM_BUSY if maximum number of callbacks have already been
@@ -279,9 +279,9 @@
 extern tBTM_STATUS BTM_EnableTestMode(void);
 
 
-/*****************************************************************************
- *  DEVICE DISCOVERY FUNCTIONS - Inquiry, Remote Name, Discovery, Class of Device
- ****************************************************************************/
+/*******************************************************************************
+ * DEVICE DISCOVERY FUNCTIONS - Inquiry, Remote Name, Discovery, Class of Device
+ ******************************************************************************/
 
 /*******************************************************************************
  *
@@ -289,8 +289,8 @@
  *
  * Description      This function is called to set the device into or out of
  *                  discoverable mode. Discoverable mode means inquiry
- *                  scans are enabled.  If a value of '0' is entered for window or
- *                  interval, the default values are used.
+ *                  scans are enabled.  If a value of '0' is entered for window
+ *                  or interval, the default values are used.
  *
  * Returns          BTM_SUCCESS if successful
  *                  BTM_BUSY if a setting of the filter is already in progress
@@ -325,20 +325,28 @@
  *
  * Function         BTM_SetPeriodicInquiryMode
  *
- * Description      This function is called to set the device periodic inquiry mode.
- *                  If the duration is zero, the periodic inquiry mode is cancelled.
+ * Description      This function is called to set the device periodic inquiry
+ *                  mode. If the duration is zero, the periodic inquiry mode is
+ *                  cancelled.
  *
  * Parameters:      p_inqparms - pointer to the inquiry information
  *                      mode - GENERAL or LIMITED inquiry
- *                      duration - length in 1.28 sec intervals (If '0', the inquiry is CANCELLED)
- *                      max_resps - maximum amount of devices to search for before ending the inquiry
- *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER, BTM_FILTER_COND_DEVICE_CLASS, or
+ *                      duration - length in 1.28 sec intervals (If '0', the
+ *                                 inquiry is CANCELLED)
+ *                      max_resps - maximum amount of devices to search for
+ *                                  before ending the inquiry
+ *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER,
+ *                                         BTM_FILTER_COND_DEVICE_CLASS, or
  *                                         BTM_FILTER_COND_BD_ADDR
- *                      filter_cond - value for the filter (based on filter_cond_type)
+ *                      filter_cond - value for the filter (based on
+ *                                                          filter_cond_type)
  *
- *                  max_delay - maximum amount of time between successive inquiries
- *                  min_delay - minimum amount of time between successive inquiries
- *                  p_results_cb - callback returning pointer to results (tBTM_INQ_RESULTS)
+ *                  max_delay - maximum amount of time between successive
+ *                              inquiries
+ *                  min_delay - minimum amount of time between successive
+ *                              inquiries
+ *                  p_results_cb - callback returning pointer to results
+ *                              (tBTM_INQ_RESULTS)
  *
  * Returns          BTM_CMD_STARTED if successfully started
  *                  BTM_ILLEGAL_VALUE if a bad parameter is detected
@@ -361,24 +369,31 @@
  *
  * Parameters:      p_inqparms - pointer to the inquiry information
  *                      mode - GENERAL or LIMITED inquiry
- *                      duration - length in 1.28 sec intervals (If '0', the inquiry is CANCELLED)
- *                      max_resps - maximum amount of devices to search for before ending the inquiry
- *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER, BTM_FILTER_COND_DEVICE_CLASS, or
+ *                      duration - length in 1.28 sec intervals (If '0', the
+ *                                 inquiry is CANCELLED)
+ *                      max_resps - maximum amount of devices to search for
+ *                                  before ending the inquiry
+ *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER,
+ *                                         BTM_FILTER_COND_DEVICE_CLASS, or
  *                                         BTM_FILTER_COND_BD_ADDR
- *                      filter_cond - value for the filter (based on filter_cond_type)
+ *                      filter_cond - value for the filter (based on
+ *                                                          filter_cond_type)
  *
- *                  p_results_cb   - Pointer to the callback routine which gets called
- *                                upon receipt of an inquiry result. If this field is
- *                                NULL, the application is not notified.
+ *                  p_results_cb  - Pointer to the callback routine which gets
+ *                                called upon receipt of an inquiry result. If
+ *                                this field is NULL, the application is not
+ *                                notified.
  *
- *                  p_cmpl_cb   - Pointer to the callback routine which gets called
- *                                upon completion.  If this field is NULL, the
- *                                application is not notified when completed.
+ *                  p_cmpl_cb   - Pointer to the callback routine which gets
+ *                                called upon completion.  If this field is
+ *                                NULL, the application is not notified when
+ *                                completed.
  * Returns          tBTM_STATUS
  *                  BTM_CMD_STARTED if successfully initiated
  *                  BTM_BUSY if already in progress
  *                  BTM_ILLEGAL_VALUE if parameter(s) are out of range
- *                  BTM_NO_RESOURCES if could not allocate resources to start the command
+ *                  BTM_NO_RESOURCES if could not allocate resources to start
+ *                                   the command
  *                  BTM_WRONG_MODE if the device is not up.
  *
  ******************************************************************************/
@@ -391,7 +406,7 @@
  *
  * Function         BTM_IsInquiryActive
  *
- * Description      This function returns a bit mask of the current inquiry state
+ * Description      Return a bit mask of the current inquiry state
  *
  * Returns          BTM_INQUIRY_INACTIVE if inactive (0)
  *                  BTM_LIMITED_INQUIRY_ACTIVE if a limted inquiry is active
@@ -436,7 +451,8 @@
  * Function         BTM_SetConnectability
  *
  * Description      This function is called to set the device into or out of
- *                  connectable mode. Discoverable mode means page scans enabled.
+ *                  connectable mode. Discoverable mode means page scans are
+ *                  enabled.
  *
  * Returns          BTM_SUCCESS if successful
  *                  BTM_ILLEGAL_VALUE if a bad parameter is detected
@@ -519,20 +535,22 @@
  * Function         BTM_ReadRemoteDeviceName
  *
  * Description      This function initiates a remote device HCI command to the
- *                  controller and calls the callback when the process has completed.
+ *                  controller and calls the callback when the process has
+ *                  completed.
  *
  * Input Params:    remote_bda      - device address of name to retrieve
- *                  p_cb            - callback function called when BTM_CMD_STARTED
- *                                    is returned.
- *                                    A pointer to tBTM_REMOTE_DEV_NAME is passed to the
- *                                    callback.
+ *                  p_cb            - callback function called when
+ *                                    BTM_CMD_STARTED is returned.
+ *                                    A pointer to tBTM_REMOTE_DEV_NAME is
+ *                                    passed to the callback.
  *
  * Returns
- *                  BTM_CMD_STARTED is returned if the request was successfully sent
- *                                  to HCI.
+ *                  BTM_CMD_STARTED is returned if the request was successfully
+ *                                  sent to HCI.
  *                  BTM_BUSY if already in progress
  *                  BTM_UNKNOWN_ADDR if device address is bad
- *                  BTM_NO_RESOURCES if could not allocate resources to start the command
+ *                  BTM_NO_RESOURCES if resources could not be allocated to
+ *                                   start the command
  *                  BTM_WRONG_MODE if the device is not up.
  *
  ******************************************************************************/
@@ -551,10 +569,11 @@
  * Input Params:    None
  *
  * Returns
- *                  BTM_CMD_STARTED is returned if the request was successfully sent
- *                                  to HCI.
- *                  BTM_NO_RESOURCES if could not allocate resources to start the command
- *                  BTM_WRONG_MODE if there is not an active remote name request.
+ *                  BTM_CMD_STARTED is returned if the request was successfully
+ *                                  sent to HCI.
+ *                  BTM_NO_RESOURCES if resources could not be allocated to
+ *                                   start the command
+ *                  BTM_WRONG_MODE if there is no active remote name request.
  *
  ******************************************************************************/
 extern tBTM_STATUS  BTM_CancelRemoteDeviceName (void);
@@ -611,8 +630,8 @@
  *
  * Function         BTM_ReadNumberRemoteFeaturesPages
  *
- * Description      This function is called to retrieve the number of feature pages
- *                  read from the remote device
+ * Description      This function is called to retrieve the number of feature
+ *                  pages read from the remote device
  *
  * Returns          number of features pages read from the remote device
  *
@@ -623,13 +642,13 @@
  *
  * Function         BTM_ReadAllRemoteFeatures
  *
- * Description      This function is called to read all features of the remote device
+ * Description      Read all the features of the remote device
  *
  * Returns          pointer to the byte[0] of the page[0] of the remote device
  *                  feature mask.
  *
  * Note:            the function returns the pointer to the array of the size
- *                  BTM_FEATURE_BYTES_PER_PAGE * (BTM_EXT_FEATURES_PAGE_MAX + 1).
+ *                  BTM_FEATURE_BYTES_PER_PAGE * (BTM_EXT_FEATURES_PAGE_MAX + 1)
  *
  ******************************************************************************/
 extern uint8_t *BTM_ReadAllRemoteFeatures (BD_ADDR addr);
@@ -640,7 +659,8 @@
  *
  * Description      This function looks through the inquiry database for a match
  *                  based on Bluetooth Device Address. This is the application's
- *                  interface to get the inquiry details of a specific BD address.
+ *                  interface to get the inquiry details of a specific BD
+ *                  address.
  *
  * Returns          pointer to entry, or NULL if not found
  *
@@ -652,10 +672,10 @@
  *
  * Function         BTM_InqDbFirst
  *
- * Description      This function looks through the inquiry database for the first
- *                  used entry, and returns that. This is used in conjunction with
- *                  BTM_InqDbNext by applications as a way to walk through the
- *                  inquiry database.
+ * Description      This function looks through the inquiry database for the
+ *                  first used entry, and returns that. This is used in
+ *                  conjunction with BTM_InqDbNext by applications as a way to
+ *                  walk through the inquiry database.
  *
  * Returns          pointer to first in-use entry, or NULL if DB is empty
  *
@@ -667,9 +687,9 @@
  *
  * Function         BTM_InqDbNext
  *
- * Description      This function looks through the inquiry database for the next
- *                  used entry, and returns that.  If the input parameter is NULL,
- *                  the first entry is returned.
+ * Description      This function looks through the inquiry database for the
+ *                  next used entry, and returns that.  If the input parameter
+ *                  is NULL, the first entry is returned.
  *
  * Returns          pointer to next in-use entry, or NULL if no more found.
  *
@@ -699,7 +719,8 @@
  *
  * Description      This command will read the inquiry Transmit Power level used
  *                  to transmit the FHS and EIR data packets.
- *                  This can be used directly in the Tx Power Level EIR data type.
+ *                  This can be used directly in the Tx Power Level EIR data
+ *                  type.
  *
  * Returns          BTM_SUCCESS if successful
  *
@@ -759,9 +780,9 @@
  *
  * Function         BTM_SetDiscoveryParams
  *
- * Description      This function is called to set the BTM default discovery parameters.
- *                  These UUID and attribute filters are used during the call to
- *                  BTM_StartDiscovery.
+ * Description      This function is called to set the BTM default discovery
+ *                  parameters. These UUID and attribute filters are used during
+ *                  the call to BTM_StartDiscovery.
  *
  * Returns          void
  *
@@ -802,8 +823,8 @@
  *
  * Function         BTM_SetDefaultLinkSuperTout
  *
- * Description      Set the default value for HCI "Write Link Supervision Timeout"
- *                  command to use when an ACL link is created.
+ * Description      Set the default value for HCI "Write Link Supervision
+ *                  Timeout" command to use when an ACL link is created.
  *
  * Returns          void
  *
@@ -873,9 +894,11 @@
  *
  * Returns          BTM_SUCCESS if already in specified role.
  *                  BTM_CMD_STARTED if command issued to controller.
- *                  BTM_NO_RESOURCES if couldn't allocate memory to issue command
+ *                  BTM_NO_RESOURCES if memory couldn't be allocated to issue
+ *                                   the command
  *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
- *                  BTM_MODE_UNSUPPORTED if local device does not support role switching
+ *                  BTM_MODE_UNSUPPORTED if the local device does not support
+ *                                       role switching
  *
  ******************************************************************************/
 extern tBTM_STATUS BTM_SwitchRole (BD_ADDR remote_bd_addr,
@@ -887,11 +910,12 @@
  * Function         BTM_ReadRSSI
  *
  * Description      This function is called to read the link policy settings.
- *                  The address of link policy results are returned in the callback.
- *                  (tBTM_RSSI_RESULTS)
+ *                  The address of link policy results are returned in the
+ *                  callback. (tBTM_RSSI_RESULTS)
  *
  * Returns          BTM_CMD_STARTED if command issued to controller.
- *                  BTM_NO_RESOURCES if couldn't allocate memory to issue command
+ *                  BTM_NO_RESOURCES if memory couldn't be allocated to issue
+ *                                   the command
  *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
  *                  BTM_BUSY if command is already in progress
  *
@@ -909,7 +933,8 @@
  *                  (tBTM_RSSI_RESULTS)
  *
  * Returns          BTM_CMD_STARTED if command issued to controller.
- *                  BTM_NO_RESOURCES if couldn't allocate memory to issue command
+ *                  BTM_NO_RESOURCES if memory couldn't be allocated to issue
+ *                                   the command
  *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
  *                  BTM_BUSY if command is already in progress
  *
@@ -926,7 +951,8 @@
  *                  (tBTM_LINK_QUALITY_RESULTS)
  *
  * Returns          BTM_CMD_STARTED if command issued to controller.
- *                  BTM_NO_RESOURCES if couldn't allocate memory to issue command
+ *                  BTM_NO_RESOURCES if memory couldn't be allocated to issue
+ *                                   the command
  *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
  *                  BTM_BUSY if command is already in progress
  *
@@ -1082,8 +1108,7 @@
  *
  * Function         BTM_ReadScoHandle
  *
- * Description      This function is used to read the HCI handle used for a specific
- *                  SCO connection,
+ * Description      Reead the HCI handle used for a specific SCO connection,
  *
  * Returns          handle for the connection, or 0xFFFF if invalid SCO index.
  *
@@ -1168,15 +1193,15 @@
  * Function         BTM_ReadEScoLinkParms
  *
  * Description      This function returns the current eSCO link parameters for
- *                  the specified handle.  This can be called anytime a connection
- *                  is active, but is typically called after receiving the SCO
- *                  opened callback.
+ *                  the specified handle.  This can be called anytime a
+ *                  connection is active, but is typically called after
+ *                  receiving the SCO opened callback.
  *
  *                  Note: If called over a 1.1 controller, only the packet types
  *                        field has meaning.
  *                  Note: If the upper layer doesn't know the current sco index,
- *                  BTM_FIRST_ACTIVE_SCO_INDEX can be used as the first parameter to
- *                  find the first active SCO index
+ *                  BTM_FIRST_ACTIVE_SCO_INDEX can be used as the first
+ *                  parameter to find the first active SCO index
  *
  * Returns          BTM_SUCCESS if returned data is valid connection.
  *                  BTM_ILLEGAL_VALUE if no connection for specified sco_inx.
@@ -1249,8 +1274,9 @@
  * Function         BTM_SecRegister
  *
  * Description      Application manager calls this function to register for
- *                  security services.  There can be one and only one application
- *                  saving link keys.  BTM allows only first registration.
+ *                  security services.  There can be one and only one
+ *                  application saving link keys.  BTM allows only first
+ *                  registration.
  *
  * Returns          true if registered OK, else false
  *
@@ -1275,7 +1301,8 @@
  * Function         BTM_SecAddRmtNameNotifyCallback
  *
  * Description      Profiles can register to be notified when name of the
- *                  remote device is resolved (up to BTM_SEC_MAX_RMT_NAME_CALLBACKS).
+ *                  remote device is resolved (up to
+ *                  BTM_SEC_MAX_RMT_NAME_CALLBACKS).
  *
  * Returns          true if registered OK, else false
  *
@@ -1313,8 +1340,10 @@
  * Description      Get security flags for the device on a particular transport
  *
  * Parameters      bd_addr: BD address of remote device
- *                  p_sec_flags : Out parameter to be filled with security flags for the connection
- *                  transport :  Physical transport of the connection (BR/EDR or LE)
+ *                  p_sec_flags : Out parameter to be filled with security
+ *                                flags for the connection
+ *                  transport :  Physical transport of the connection
+ *                               (BR/EDR or LE)
  *
  * Returns          bool    true or false is device found
  *
@@ -1366,13 +1395,14 @@
  *
  * Function         BTM_SetSecureConnectionsOnly
  *
- * Description      Enable or disable default treatment for Mode 4 Level 0 services
+ * Description      Enable or disable default treatment for Mode 4 Level 0
+ *                  services
  *
  * Parameter        secure_connections_only_mode - (true or false)
- *                  true means that the device should treat Mode 4 Level 0 services as
- *                  services of other levels.
- *                  false means that the device should provide default treatment for
- *                  Mode 4 Level 0 services.
+ *                  true means that the device should treat Mode 4 Level 0
+ *                  services as services of other levels.
+ *                  false means that the device should provide default
+ *                  treatment for Mode 4 Level 0 services.
  *
  * Returns          void
  *
@@ -1385,8 +1415,8 @@
  *
  * Description      Register service security level with Security Manager.  Each
  *                  service must register its requirements regardless of the
- *                  security level that is used.  This API is called once for originators
- *                  nad again for acceptors of connections.
+ *                  security level that is used.  This API is called once for
+ *                  originators and again for acceptors of connections.
  *
  * Returns          true if registered OK, else false
  *
@@ -1412,11 +1442,10 @@
  *
  * Function         BTM_SecClrService
  *
- * Description      Removes specified service record(s) from the security database.
- *                  All service records with the specified name are removed.
- *                  Typically used only by devices with limited RAM so that it can
- *                  reuse an old security service record.
- *                          records (except SDP).
+ * Description      Removes specified service record(s) from the security
+ *                  database. All service records with the specified name are
+ *                  removed. Typically used only by devices with limited RAM
+ *                  so that it can reuse an old security service record.
  *
  * Returns          Number of records that were freed.
  *
@@ -1430,7 +1459,8 @@
  * Description      Add/modify device.  This function will be normally called
  *                  during host startup to restore all required information
  *                  stored in the NVRAM.
- *                  dev_class, bd_name, link_key, and features are NULL if unknown
+ *                  dev_class, bd_name, link_key, and features are NULL if
+ *                  unknown
  *
  * Returns          true if added OK, else false
  *
@@ -1502,11 +1532,14 @@
  * Description      This function is called after Security Manager submitted
  *                  PIN code request to the UI.
  *
- * Parameters:      bd_addr      - Address of the device for which PIN was requested
- *                  res          - result of the operation BTM_SUCCESS if success
+ * Parameters:      bd_addr      - Address of the device for which PIN was
+ *                                 requested
+ *                  res          - result of the operation BTM_SUCCESS if
+ *                                 success
  *                  pin_len      - length in bytes of the PIN Code
  *                  p_pin        - pointer to array with the PIN Code
- *                  trusted_mask - bitwise OR of trusted services (array of uint32_t)
+ *                  trusted_mask - bitwise OR of trusted services
+ *                                 (array of uint32_t)
  *
  * Returns          void
  *
@@ -1524,8 +1557,8 @@
  * Parameters:      bd_addr      - Address of the device to bond
  *                  pin_len      - length in bytes of the PIN Code
  *                  p_pin        - pointer to array with the PIN Code
- *                  trusted_mask - bitwise OR of trusted services (array of uint32_t)
-
+ *                  trusted_mask - bitwise OR of trusted services
+ *                                 (array of uint32_t)
  * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
  *
  ******************************************************************************/
@@ -1537,13 +1570,15 @@
  *
  * Function         BTM_SecBondByTransport
  *
- * Description      This function is called to perform bonding by designated transport
+ * Description      Perform bonding by designated transport
  *
  * Parameters:      bd_addr      - Address of the device to bond
  *                  pin_len      - length in bytes of the PIN Code
  *                  p_pin        - pointer to array with the PIN Code
- *                  trusted_mask - bitwise OR of trusted services (array of uint32_t)
- *                  transport :  Physical transport to use for bonding (BR/EDR or LE)
+ *                  trusted_mask - bitwise OR of trusted services
+ *                                 (array of uint32_t)
+ *                  transport :  Physical transport to use for bonding
+ *                               (BR/EDR or LE)
  *
  * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
  *
@@ -1578,10 +1613,11 @@
  *                  transport     - Link transport
  *                  p_callback    - Pointer to callback function called if
  *                                  this function returns PENDING after required
- *                                  procedures are completed.  Can be set to NULL
- *                                  if status is not desired.
- *                  p_ref_data    - pointer to any data the caller wishes to receive
- *                                  in the callback function upon completion.
+ *                                  procedures are completed.  Can be set to
+ *                                  NULL if status is not desired.
+ *                  p_ref_data    - pointer to any data the caller wishes to
+ *                                  receive in the callback function upon
+ *                                  completion.
  *                                  can be set to NULL if not used.
  *                  sec_act       - LE security action, unused for BR/EDR
  *
@@ -1603,7 +1639,8 @@
  * Description      This function is called to confirm the numeric value for
  *                  Simple Pairing in response to BTM_SP_CFM_REQ_EVT
  *
- * Parameters:      res           - result of the operation BTM_SUCCESS if success
+ * Parameters:      res           - result of the operation BTM_SUCCESS if
+ *                                  success
  *                  bd_addr       - Address of the peer device
  *
  ******************************************************************************/
@@ -1616,9 +1653,11 @@
  * Description      This function is called to provide the passkey for
  *                  Simple Pairing in response to BTM_SP_KEY_REQ_EVT
  *
- * Parameters:      res           - result of the operation BTM_SUCCESS if success
+ * Parameters:      res           - result of the operation BTM_SUCCESS if
+ *                                  success
  *                  bd_addr       - Address of the peer device
- *                  passkey       - numeric value in the range of 0 - 999999(0xF423F).
+ *                  passkey       - numeric value in the range of
+ *                                  0 - 999999(0xF423F).
  *
  ******************************************************************************/
 extern void BTM_PasskeyReqReply(tBTM_STATUS res, BD_ADDR bd_addr, uint32_t passkey);
@@ -1630,8 +1669,8 @@
  * Description      This function is used during the passkey entry model
  *                  by a device with KeyboardOnly IO capabilities
  *                  (very likely to be a HID Device).
- *                  It is called by a HID Device to inform the remote device when
- *                  a key has been entered or erased.
+ *                  It is called by a HID Device to inform the remote device
+ *                  when a key has been entered or erased.
  *
  * Parameters:      bd_addr - Address of the peer device
  *                  type - notification type
@@ -1644,9 +1683,9 @@
  * Function         BTM_IoCapRsp
  *
  * Description      This function is called in response to BTM_SP_IO_REQ_EVT
- *                  When the event data io_req.oob_data is set to BTM_OOB_UNKNOWN
- *                  by the tBTM_SP_CALLBACK implementation, this function is
- *                  called to provide the actual response
+ *                  When the event data io_req.oob_data is set to
+ *                  BTM_OOB_UNKNOWN by the tBTM_SP_CALLBACK implementation, this
+ *                  function is called to provide the actual response
  *
  * Parameters:      bd_addr - Address of the peer device
  *                  io_cap  - The IO capability of local device.
@@ -1707,13 +1746,14 @@
  *
  * Function         BTM_BothEndsSupportSecureConnections
  *
- * Description      This function is called to check if both the local device and the peer device
- *                   specified by bd_addr support BR/EDR Secure Connections.
+ * Description      This function is called to check if both the local device
+ *                  and the peer device specified by bd_addr support BR/EDR
+ *                  Secure Connections.
  *
  * Parameters:      bd_addr - address of the peer
  *
- * Returns          true if BR/EDR Secure Connections are supported by both local
- *                  and the remote device.
+ * Returns          true if BR/EDR Secure Connections are supported by both
+ *                  local and the remote device.
  *                  else false.
  *
  ******************************************************************************/
@@ -1845,8 +1885,8 @@
  *
  * Function         BTM_GetHCIConnHandle
  *
- * Description      This function is called to get the handle for an ACL connection
- *                  to a specific remote BD Address.
+ * Description      This function is called to get the handle for an ACL
+ *                  connection to a specific remote BD Address.
  *
  * Returns          the handle of the connection, or 0xFFFF if none.
  *
@@ -1858,8 +1898,8 @@
  * Function         BTM_DeleteStoredLinkKey
  *
  * Description      This function is called to delete link key for the specified
- *                  device addresses from the NVRAM storage attached to the Bluetooth
- *                  controller.
+ *                  device addresses from the NVRAM storage attached to the
+ *                  Bluetooth controller.
  *
  * Parameters:      bd_addr      - Addresses of the devices
  *                  p_cb         - Call back function to be called to return
@@ -1887,7 +1927,7 @@
  *
  * Function         BTM_CheckEirData
  *
- * Description      This function is called to get EIR data from significant part.
+ * Description      Get EIR data from the significant part.
  *
  * Parameters       p_eir - pointer of EIR significant part
  *                  type   - finding EIR data type
@@ -1917,13 +1957,13 @@
  *
  * Function         BTM_HasInquiryEirService
  *
- * Description      This function is called to know if UUID in bit map of UUID list.
+ * Description      Return if a UUID is in the bit map of a UUID list.
  *
  * Parameters       p_results - inquiry results
  *                  uuid16 - UUID 16-bit
  *
  * Returns          BTM_EIR_FOUND - if found
- *                  BTM_EIR_NOT_FOUND - if not found and it is complete list
+ *                  BTM_EIR_NOT_FOUND - if not found and it is a complete list
  *                  BTM_EIR_UNKNOWN - if not found and it is not complete list
  *
  ******************************************************************************/
@@ -1934,7 +1974,8 @@
  *
  * Function         BTM_AddEirService
  *
- * Description      This function is called to add a service in bit map of UUID list.
+ * Description      This function is called to add a service in the bit map UUID
+ *                  list.
  *
  * Parameters       p_eir_uuid - bit mask of UUID list for EIR
  *                  uuid16 - UUID 16-bit
@@ -1948,7 +1989,8 @@
  *
  * Function         BTM_RemoveEirService
  *
- * Description      This function is called to remove a service in bit map of UUID list.
+ * Description      This function is called to remove a service from the bit map
+ *                  UUID list.
  *
  * Parameters       p_eir_uuid - bit mask of UUID list for EIR
  *                  uuid16 - UUID 16-bit
@@ -1962,7 +2004,8 @@
  *
  * Function         BTM_GetEirSupportedServices
  *
- * Description      This function is called to get UUID list from bit map of UUID list.
+ * Description      This function is called to get UUID list from bit map UUID
+ *                  list.
  *
  * Parameters       p_eir_uuid - bit mask of UUID list for EIR
  *                  p - reference of current pointer of EIR
@@ -2013,17 +2056,18 @@
  * Parameter        path: SCO or HCI
  *                  p_sco_data_cb: callback function or SCO data if path is set
  *                                 to transport.
- *                  p_pcm_param: pointer to the PCM interface parameter. If a NULL
- *                               pointer is used, PCM parameter maintained in
- *                               the control block will be used; otherwise update
- *                               control block value.
- *                  err_data_rpt: Lisbon feature to enable the erronous data report
- *                                or not.
+ *                  p_pcm_param: pointer to the PCM interface parameter. If a
+ *                               NULL pointer is used, the PCM parameter
+ *                               maintained in the control block will be used;
+ *                               otherwise update the control block value.
+ *                  err_data_rpt: Lisbon feature to enable the erronous data
+ *                                report or not.
  *
  * Returns          BTM_SUCCESS if the successful.
  *                  BTM_NO_RESOURCES: no rsource to start the command.
  *                  BTM_ILLEGAL_VALUE: invalid callback function pointer.
- *                  BTM_CMD_STARTED :Command sent. Waiting for command cmpl event.
+ *                  BTM_CMD_STARTED : Command sent. Waiting for command
+ *                                    complete event.
  *
  *
  ******************************************************************************/
@@ -2036,20 +2080,20 @@
  *
  * Function         BTM_WriteScoData
  *
- * Description      This function write SCO data to a specified instance. The data
- *                  to be written p_buf needs to carry an offset of
+ * Description      This function write SCO data to a specified instance. The
+ *                  data to be written p_buf needs to carry an offset of
  *                  HCI_SCO_PREAMBLE_SIZE bytes, and the data length can not
- *                  exceed BTM_SCO_DATA_SIZE_MAX bytes, whose default value is set
- *                  to 60 and is configurable. Data longer than the maximum bytes
- *                  will be truncated.
+ *                  exceed BTM_SCO_DATA_SIZE_MAX bytes, whose default value is
+ *                  set to 60 and is configurable. Data longer than the maximum
+ *                  bytes will be truncated.
  *
  * Returns          BTM_SUCCESS: data write is successful
  *                  BTM_ILLEGAL_VALUE: SCO data contains illegal offset value.
- *                  BTM_SCO_BAD_LENGTH: SCO data length exceeds the max SCO packet
- *                                      size.
+ *                  BTM_SCO_BAD_LENGTH: SCO data length exceeds the max SCO
+ *                                      packet size.
  *                  BTM_NO_RESOURCES: no resources.
- *                  BTM_UNKNOWN_ADDR: unknown SCO connection handle, or SCO is not
- *                                    routed via HCI.
+ *                  BTM_UNKNOWN_ADDR: unknown SCO connection handle, or SCO is
+ *                                    not routed via HCI.
  *
  *
  ******************************************************************************/
@@ -2085,7 +2129,8 @@
  *
  * Description      This function is called to obtain the controller state
  *
- * Returns          Controller state (BTM_CONTRL_ACTIVE, BTM_CONTRL_SCAN, and BTM_CONTRL_IDLE)
+ * Returns          Controller state (BTM_CONTRL_ACTIVE, BTM_CONTRL_SCAN, and
+ *                                    BTM_CONTRL_IDLE)
  *
  ******************************************************************************/
 extern tBTM_CONTRL_STATE BTM_PM_ReadControllerState(void);
diff --git a/stack/include/btm_api_types.h b/stack/include/btm_api_types.h
index e961fa1..f26deb1 100644
--- a/stack/include/btm_api_types.h
+++ b/stack/include/btm_api_types.h
@@ -127,18 +127,20 @@
 
 
 /* General callback function for notifying an application that a synchronous
- * BTM function is complete. The pointer contains the address of any returned data.
-*/
+ * BTM function is complete. The pointer contains the address of any returned
+ * data.
+ */
 typedef void (tBTM_CMPL_CB) (void *p1);
 
 /* VSC callback function for notifying an application that a synchronous
- * BTM function is complete. The pointer contains the address of any returned data.
-*/
+ * BTM function is complete. The pointer contains the address of any returned
+ * data.
+ */
 typedef void (tBTM_VSC_CMPL_CB) (tBTM_VSC_CMPL *p1);
 
 /* Callback for apps to check connection and inquiry filters.
- * Parameters are the BD Address of remote and the Dev Class of remote.
- * If the app returns none zero, the connection or inquiry result will be dropped.
+ * Parameters are the BD Address of remote and the Dev Class of remote. If the
+ * app returns none zero, the connection or inquiry result will be dropped.
 */
 typedef uint8_t (tBTM_FILTER_CB) (BD_ADDR bd_addr, DEV_CLASS dc);
 
@@ -172,7 +174,8 @@
 #define BTM_BLE_CONNECTABLE_MASK    (BTM_BLE_NON_CONNECTABLE | BTM_BLE_CONNECTABLE)
 
 /* Inquiry modes
- * Note: These modes are associated with the inquiry active values (BTM_*ACTIVE) */
+ * Note: These modes are associated with the inquiry active values (BTM_*ACTIVE)
+ */
 #define BTM_INQUIRY_NONE            0
 #define BTM_GENERAL_INQUIRY         0x01
 #define BTM_LIMITED_INQUIRY         0x02
@@ -185,20 +188,32 @@
 #define BTM_BLE_INQUIRY_MASK         (BTM_BLE_GENERAL_INQUIRY|BTM_BLE_LIMITED_INQUIRY)
 
 /* BTM_IsInquiryActive return values (Bit Mask)
- * Note: These bit masks are associated with the inquiry modes (BTM_*_INQUIRY) */
-#define BTM_INQUIRY_INACTIVE        0x0     /* no inquiry in progress */
-#define BTM_GENERAL_INQUIRY_ACTIVE  BTM_GENERAL_INQUIRY     /* a general inquiry is in progress */
-#define BTM_LIMITED_INQUIRY_ACTIVE  BTM_LIMITED_INQUIRY     /* a limited inquiry is in progress */
-#define BTM_PERIODIC_INQUIRY_ACTIVE 0x8     /* a periodic inquiry is active */
-#define BTM_SSP_INQUIRY_ACTIVE      0x4     /* SSP is active, so inquiry is disallowed (work around for FW bug) */
-#define BTM_LE_GENERAL_INQUIRY_ACTIVE  BTM_BLE_GENERAL_INQUIRY     /* a general inquiry is in progress */
-#define BTM_LE_LIMITED_INQUIRY_ACTIVE  BTM_BLE_LIMITED_INQUIRY      /* a limited inquiry is in progress */
+ * Note: These bit masks are associated with the inquiry modes (BTM_*_INQUIRY)
+ */
+/* no inquiry in progress */
+#define BTM_INQUIRY_INACTIVE        0x0
+/* a general inquiry is in progress */
+#define BTM_GENERAL_INQUIRY_ACTIVE  BTM_GENERAL_INQUIRY
+/* a limited inquiry is in progress */
+#define BTM_LIMITED_INQUIRY_ACTIVE  BTM_LIMITED_INQUIRY
+/* a periodic inquiry is active */
+#define BTM_PERIODIC_INQUIRY_ACTIVE 0x8
+/* SSP is active, so inquiry is disallowed (work around for FW bug) */
+#define BTM_SSP_INQUIRY_ACTIVE      0x4
+/* a general inquiry is in progress */
+#define BTM_LE_GENERAL_INQUIRY_ACTIVE  BTM_BLE_GENERAL_INQUIRY
+/* a limited inquiry is in progress */
+#define BTM_LE_LIMITED_INQUIRY_ACTIVE  BTM_BLE_LIMITED_INQUIRY
 
 /* inquiry activity mask */
-#define BTM_BR_INQ_ACTIVE_MASK        (BTM_GENERAL_INQUIRY_ACTIVE|BTM_LIMITED_INQUIRY_ACTIVE|BTM_PERIODIC_INQUIRY_ACTIVE) /* BR/EDR inquiry activity mask */
-#define BTM_BLE_SCAN_ACTIVE_MASK      0xF0     /* LE scan activity mask */
-#define BTM_BLE_INQ_ACTIVE_MASK       (BTM_LE_GENERAL_INQUIRY_ACTIVE|BTM_LE_LIMITED_INQUIRY_ACTIVE) /* LE inquiry activity mask*/
-#define BTM_INQUIRY_ACTIVE_MASK       (BTM_BR_INQ_ACTIVE_MASK | BTM_BLE_INQ_ACTIVE_MASK) /* inquiry activity mask */
+/* BR/EDR inquiry activity mask */
+#define BTM_BR_INQ_ACTIVE_MASK        (BTM_GENERAL_INQUIRY_ACTIVE|BTM_LIMITED_INQUIRY_ACTIVE|BTM_PERIODIC_INQUIRY_ACTIVE)
+/* LE scan activity mask */
+#define BTM_BLE_SCAN_ACTIVE_MASK      0xF0
+/* LE inquiry activity mask*/
+#define BTM_BLE_INQ_ACTIVE_MASK       (BTM_LE_GENERAL_INQUIRY_ACTIVE|BTM_LE_LIMITED_INQUIRY_ACTIVE)
+/* inquiry activity mask */
+#define BTM_INQUIRY_ACTIVE_MASK       (BTM_BR_INQ_ACTIVE_MASK | BTM_BLE_INQ_ACTIVE_MASK)
 
 /* Define scan types */
 #define BTM_SCAN_TYPE_STANDARD      0
@@ -208,13 +223,16 @@
 #define BTM_INQ_RESULT_STANDARD     0
 #define BTM_INQ_RESULT_WITH_RSSI    1
 #define BTM_INQ_RESULT_EXTENDED     2
-
-#define BTM_INQ_RES_IGNORE_RSSI     0x7f    /* RSSI value not supplied (ignore it) */
+/* RSSI value not supplied (ignore it) */
+#define BTM_INQ_RES_IGNORE_RSSI     0x7f
 
 /* Inquiry Filter Condition types (see tBTM_INQ_PARMS) */
-#define BTM_CLR_INQUIRY_FILTER          0                   /* Inquiry Filtering is turned off */
-#define BTM_FILTER_COND_DEVICE_CLASS    HCI_FILTER_COND_DEVICE_CLASS /* Filter on device class */
-#define BTM_FILTER_COND_BD_ADDR         HCI_FILTER_COND_BD_ADDR /* Filter on device addr */
+/* Inquiry Filtering is turned off */
+#define BTM_CLR_INQUIRY_FILTER          0
+/* Filter on device class */
+#define BTM_FILTER_COND_DEVICE_CLASS    HCI_FILTER_COND_DEVICE_CLASS
+/* Filter on device addr */
+#define BTM_FILTER_COND_BD_ADDR         HCI_FILTER_COND_BD_ADDR
 
 /* State of the remote name retrieval during inquiry operations.
  * Used in the tBTM_INQ_INFO structure, and returned in the
@@ -252,7 +270,8 @@
 #define BTM_COD_MINOR_CELLULAR              0x04
 #define BTM_COD_MINOR_CORDLESS              0x08
 #define BTM_COD_MINOR_SMART_PHONE           0x0C
-#define BTM_COD_MINOR_WIRED_MDM_V_GTWY      0x10 /* wired modem or voice gatway */
+/* wired modem or voice gatway */
+#define BTM_COD_MINOR_WIRED_MDM_V_GTWY      0x10
 #define BTM_COD_MINOR_ISDN_ACCESS           0x14
 
 /* minor device class field for LAN Access Point Major Class */
@@ -480,25 +499,41 @@
 
 typedef uint8_t tBTM_EIR_SEARCH_RESULT;
 
-#define BTM_EIR_FLAGS_TYPE                  HCI_EIR_FLAGS_TYPE                  /* 0x01 */
-#define BTM_EIR_MORE_16BITS_UUID_TYPE       HCI_EIR_MORE_16BITS_UUID_TYPE       /* 0x02 */
-#define BTM_EIR_COMPLETE_16BITS_UUID_TYPE   HCI_EIR_COMPLETE_16BITS_UUID_TYPE   /* 0x03 */
-#define BTM_EIR_MORE_32BITS_UUID_TYPE       HCI_EIR_MORE_32BITS_UUID_TYPE       /* 0x04 */
-#define BTM_EIR_COMPLETE_32BITS_UUID_TYPE   HCI_EIR_COMPLETE_32BITS_UUID_TYPE   /* 0x05 */
-#define BTM_EIR_MORE_128BITS_UUID_TYPE      HCI_EIR_MORE_128BITS_UUID_TYPE      /* 0x06 */
-#define BTM_EIR_COMPLETE_128BITS_UUID_TYPE  HCI_EIR_COMPLETE_128BITS_UUID_TYPE  /* 0x07 */
-#define BTM_EIR_SHORTENED_LOCAL_NAME_TYPE   HCI_EIR_SHORTENED_LOCAL_NAME_TYPE   /* 0x08 */
-#define BTM_EIR_COMPLETE_LOCAL_NAME_TYPE    HCI_EIR_COMPLETE_LOCAL_NAME_TYPE    /* 0x09 */
-#define BTM_EIR_TX_POWER_LEVEL_TYPE         HCI_EIR_TX_POWER_LEVEL_TYPE         /* 0x0A */
-#define BTM_EIR_MANUFACTURER_SPECIFIC_TYPE  HCI_EIR_MANUFACTURER_SPECIFIC_TYPE  /* 0xFF */
+/* 0x01 */
+#define BTM_EIR_FLAGS_TYPE                  HCI_EIR_FLAGS_TYPE
+/* 0x02 */
+#define BTM_EIR_MORE_16BITS_UUID_TYPE       HCI_EIR_MORE_16BITS_UUID_TYPE
+/* 0x03 */
+#define BTM_EIR_COMPLETE_16BITS_UUID_TYPE   HCI_EIR_COMPLETE_16BITS_UUID_TYPE
+/* 0x04 */
+#define BTM_EIR_MORE_32BITS_UUID_TYPE       HCI_EIR_MORE_32BITS_UUID_TYPE
+/* 0x05 */
+#define BTM_EIR_COMPLETE_32BITS_UUID_TYPE   HCI_EIR_COMPLETE_32BITS_UUID_TYPE
+/* 0x06 */
+#define BTM_EIR_MORE_128BITS_UUID_TYPE      HCI_EIR_MORE_128BITS_UUID_TYPE
+/* 0x07 */
+#define BTM_EIR_COMPLETE_128BITS_UUID_TYPE  HCI_EIR_COMPLETE_128BITS_UUID_TYPE
+/* 0x08 */
+#define BTM_EIR_SHORTENED_LOCAL_NAME_TYPE   HCI_EIR_SHORTENED_LOCAL_NAME_TYPE
+/* 0x09 */
+#define BTM_EIR_COMPLETE_LOCAL_NAME_TYPE    HCI_EIR_COMPLETE_LOCAL_NAME_TYPE
+/* 0x0A */
+#define BTM_EIR_TX_POWER_LEVEL_TYPE         HCI_EIR_TX_POWER_LEVEL_TYPE
+/* 0xFF */
+#define BTM_EIR_MANUFACTURER_SPECIFIC_TYPE  HCI_EIR_MANUFACTURER_SPECIFIC_TYPE
 
 /* the following EIR tags are defined to OOB, not regular EIR data */
-#define BTM_EIR_OOB_BD_ADDR_TYPE            HCI_EIR_OOB_BD_ADDR_TYPE    /* 6 bytes */
-#define BTM_EIR_OOB_COD_TYPE                HCI_EIR_OOB_COD_TYPE        /* 3 bytes */
-#define BTM_EIR_OOB_SSP_HASH_C_TYPE         HCI_EIR_OOB_SSP_HASH_C_TYPE /* 16 bytes */
-#define BTM_EIR_OOB_SSP_RAND_R_TYPE         HCI_EIR_OOB_SSP_RAND_R_TYPE /* 16 bytes */
+/* 6 bytes */
+#define BTM_EIR_OOB_BD_ADDR_TYPE            HCI_EIR_OOB_BD_ADDR_TYPE
+/* 3 bytes */
+#define BTM_EIR_OOB_COD_TYPE                HCI_EIR_OOB_COD_TYPE
+/* 16 bytes */
+#define BTM_EIR_OOB_SSP_HASH_C_TYPE         HCI_EIR_OOB_SSP_HASH_C_TYPE
+/* 16 bytes */
+#define BTM_EIR_OOB_SSP_RAND_R_TYPE         HCI_EIR_OOB_SSP_RAND_R_TYPE
 
-#define BTM_OOB_MANDATORY_SIZE      8   /* include 2 bytes length & 6 bytes bd_addr */
+/* include 2 bytes length & 6 bytes bd_addr */
+#define BTM_OOB_MANDATORY_SIZE      8
 #define BTM_OOB_DATA_LEN_SIZE       2
 #define BTM_OOB_BD_ADDR_SIZE        6
 #define BTM_OOB_COD_SIZE            BT_OOB_COD_SIZE
@@ -506,7 +541,8 @@
 #define BTM_OOB_RAND_R_SIZE         BT_OOB_RAND_R_SIZE
 
 #define BTM_BLE_SEC_NONE                0
-#define BTM_BLE_SEC_ENCRYPT             1 /* encrypt the link using current key */
+/* encrypt the link using current key */
+#define BTM_BLE_SEC_ENCRYPT             1
 #define BTM_BLE_SEC_ENCRYPT_NO_MITM     2
 #define BTM_BLE_SEC_ENCRYPT_MITM        3
 typedef uint8_t tBTM_BLE_SEC_ACT;
@@ -532,7 +568,8 @@
 #define BTM_EIR_HAS_SERVICE(p, service)  ((((uint32_t *)(p))[(((uint32_t)(service)) / BTM_EIR_ARRAY_BITS)] &  \
                                     ((uint32_t)1 << (((uint32_t)(service)) % BTM_EIR_ARRAY_BITS))) >> (((uint32_t)(service)) % BTM_EIR_ARRAY_BITS))
 
-/* start of EIR in HCI buffer, 4 bytes = HCI Command(2) + Length(1) + FEC_Req(1) */
+/* start of EIR in HCI buffer, 4 bytes = HCI Command(2) + Length(1) + FEC_Req(1)
+ */
 #define BTM_HCI_EIR_OFFSET          (BT_HDR_SIZE + 4)
 
 /***************************
@@ -600,8 +637,9 @@
 } tBTM_INQ_RESULTS;
 
 
-/* This is the inquiry response information held in its database by BTM, and available
- * to applications via BTM_InqDbRead, BTM_InqDbFirst, and BTM_InqDbNext.
+/* This is the inquiry response information held in its database by BTM, and
+ * available to applications via BTM_InqDbRead, BTM_InqDbFirst, and
+ * BTM_InqDbNext.
 */
 typedef struct
 {
@@ -695,8 +733,8 @@
  *  ACL Types
  ***************/
 
-/* Structure returned with Role Switch information (in tBTM_CMPL_CB callback function)
- * in response to BTM_SwitchRole call.
+/* Structure returned with Role Switch information (in tBTM_CMPL_CB callback
+ * function) in response to BTM_SwitchRole call.
 */
 typedef struct
 {
@@ -727,8 +765,8 @@
     BD_ADDR     rem_bda;
 } tBTM_RSSI_RESULTS;
 
-/* Structure returned with read current TX power event (in tBTM_CMPL_CB callback function)
- * in response to BTM_ReadTxPower call.
+/* Structure returned with read current TX power event (in tBTM_CMPL_CB callback
+ * function) in response to BTM_ReadTxPower call.
 */
 typedef struct
 {
@@ -738,8 +776,8 @@
     BD_ADDR     rem_bda;
 } tBTM_TX_POWER_RESULTS;
 
-/* Structure returned with read link quality event (in tBTM_CMPL_CB callback function)
- * in response to BTM_ReadLinkQuality call.
+/* Structure returned with read link quality event (in tBTM_CMPL_CB callback
+ * function) in response to BTM_ReadLinkQuality call.
 */
 typedef struct
 {
@@ -749,8 +787,8 @@
     BD_ADDR     rem_bda;
 } tBTM_LINK_QUALITY_RESULTS;
 
-/* Structure returned with read inq tx power quality event (in tBTM_CMPL_CB callback function)
- * in response to BTM_ReadInquiryRspTxPower call.
+/* Structure returned with read inq tx power quality event (in tBTM_CMPL_CB
+ * callback function) in response to BTM_ReadInquiryRspTxPower call.
 */
 typedef struct
 {
@@ -1069,21 +1107,36 @@
 /* Security Service Levels [bit mask] (BTM_SetSecurityLevel)
  * Encryption should not be used without authentication
 */
-#define BTM_SEC_NONE               0x0000 /* Nothing required */
-#define BTM_SEC_IN_AUTHORIZE       0x0001 /* Inbound call requires authorization */
-#define BTM_SEC_IN_AUTHENTICATE    0x0002 /* Inbound call requires authentication */
-#define BTM_SEC_IN_ENCRYPT         0x0004 /* Inbound call requires encryption */
-#define BTM_SEC_OUT_AUTHORIZE      0x0008 /* Outbound call requires authorization */
-#define BTM_SEC_OUT_AUTHENTICATE   0x0010 /* Outbound call requires authentication */
-#define BTM_SEC_OUT_ENCRYPT        0x0020 /* Outbound call requires encryption */
-#define BTM_SEC_MODE4_LEVEL4       0x0040 /* Secure Connections Only Mode */
-#define BTM_SEC_FORCE_MASTER       0x0100 /* Need to switch connection to be master */
-#define BTM_SEC_ATTEMPT_MASTER     0x0200 /* Try to switch connection to be master */
-#define BTM_SEC_FORCE_SLAVE        0x0400 /* Need to switch connection to be master */
-#define BTM_SEC_ATTEMPT_SLAVE      0x0800 /* Try to switch connection to be slave */
-#define BTM_SEC_IN_MITM            0x1000 /* inbound Do man in the middle protection */
-#define BTM_SEC_OUT_MITM           0x2000 /* outbound Do man in the middle protection */
-#define BTM_SEC_IN_MIN_16_DIGIT_PIN 0x4000 /* enforce a minimum of 16 digit for sec mode 2 */
+/* Nothing required */
+#define BTM_SEC_NONE               0x0000
+/* Inbound call requires authorization */
+#define BTM_SEC_IN_AUTHORIZE       0x0001
+/* Inbound call requires authentication */
+#define BTM_SEC_IN_AUTHENTICATE    0x0002
+/* Inbound call requires encryption */
+#define BTM_SEC_IN_ENCRYPT         0x0004
+/* Outbound call requires authorization */
+#define BTM_SEC_OUT_AUTHORIZE      0x0008
+/* Outbound call requires authentication */
+#define BTM_SEC_OUT_AUTHENTICATE   0x0010
+/* Outbound call requires encryption */
+#define BTM_SEC_OUT_ENCRYPT        0x0020
+/* Secure Connections Only Mode */
+#define BTM_SEC_MODE4_LEVEL4       0x0040
+/* Need to switch connection to be master */
+#define BTM_SEC_FORCE_MASTER       0x0100
+/* Try to switch connection to be master */
+#define BTM_SEC_ATTEMPT_MASTER     0x0200
+/* Need to switch connection to be master */
+#define BTM_SEC_FORCE_SLAVE        0x0400
+/* Try to switch connection to be slave */
+#define BTM_SEC_ATTEMPT_SLAVE      0x0800
+/* inbound Do man in the middle protection */
+#define BTM_SEC_IN_MITM            0x1000
+/* outbound Do man in the middle protection */
+#define BTM_SEC_OUT_MITM           0x2000
+/* enforce a minimum of 16 digit for sec mode 2 */
+#define BTM_SEC_IN_MIN_16_DIGIT_PIN 0x4000
 
 /* Security Flags [bit mask] (BTM_GetSecurityFlags)
 */
@@ -1111,7 +1164,8 @@
 #define BTM_LKEY_TYPE_UNAUTH_COMB_P_256 HCI_LKEY_TYPE_UNAUTH_COMB_P_256
 #define BTM_LKEY_TYPE_AUTH_COMB_P_256   HCI_LKEY_TYPE_AUTH_COMB_P_256
 
-#define BTM_LTK_DERIVED_LKEY_OFFSET 0x20    /* "easy" requirements for LK derived from LTK */
+/* "easy" requirements for LK derived from LTK */
+#define BTM_LTK_DERIVED_LKEY_OFFSET 0x20
 #define BTM_LKEY_TYPE_IGNORE        0xff    /* used when event is response from
                                                hci return link keys request */
 
@@ -1129,7 +1183,7 @@
 #define BTM_SEC_PROTO_MCA           8
 
 /* Determine the number of uint32_t's necessary for security services */
-#define BTM_SEC_ARRAY_BITS          32          /* Number of bits in each array element */
+#define BTM_SEC_ARRAY_BITS         32 /* Number of bits in each array element */
 #define BTM_SEC_SERVICE_ARRAY_SIZE  (((uint32_t)BTM_SEC_MAX_SERVICES / BTM_SEC_ARRAY_BITS) + \
                                     (((uint32_t)BTM_SEC_MAX_SERVICES % BTM_SEC_ARRAY_BITS) ? 1 : 0))
 
@@ -1197,7 +1251,8 @@
 #endif
 
 /*******************************************************************************
- * Security Services MACROS handle array of uint32_t bits for more than 32 trusted services
+ * Security Services MACROS handle array of uint32_t bits for more than 32
+ * trusted services
  ******************************************************************************/
 /* MACRO to set the security service bit mask in a bit stream */
 #define BTM_SEC_SET_SERVICE(p, service)  (((uint32_t *)(p))[(((uint32_t)(service)) / BTM_SEC_ARRAY_BITS)] |=  \
@@ -1208,7 +1263,8 @@
 #define BTM_SEC_CLR_SERVICE(p, service)  (((uint32_t *)(p))[(((uint32_t)(service)) / BTM_SEC_ARRAY_BITS)] &=  \
                                     ~((uint32_t)1 << (((uint32_t)(service)) % BTM_SEC_ARRAY_BITS)))
 
-/* MACRO to check the security service bit mask in a bit stream (Returns true or false) */
+/* MACRO to check the security service bit mask in a bit stream (Returns true or
+ * false) */
 #define BTM_SEC_IS_SERVICE_TRUSTED(p, service)    (((((uint32_t *)(p))[(((uint32_t)(service)) / BTM_SEC_ARRAY_BITS)]) &   \
                                         (uint32_t)(((uint32_t)1 << (((uint32_t)(service)) % BTM_SEC_ARRAY_BITS)))) ? true : false)
 
@@ -1357,19 +1413,27 @@
 #define BTM_MAX_PASSKEY_VAL (999999)
 #define BTM_MIN_PASSKEY_VAL (0)
 
-#define BTM_AUTH_SP_NO      0   /* MITM Protection Not Required - Single Profile/non-bonding
-                                Numeric comparison with automatic accept allowed */
-#define BTM_AUTH_SP_YES     1   /* MITM Protection Required - Single Profile/non-bonding
-                                Use IO Capabilities to determine authentication procedure */
-#define BTM_AUTH_AP_NO      2   /* MITM Protection Not Required - All Profiles/dedicated bonding
-                                Numeric comparison with automatic accept allowed */
-#define BTM_AUTH_AP_YES     3   /* MITM Protection Required - All Profiles/dedicated bonding
-                                Use IO Capabilities to determine authentication procedure */
-#define BTM_AUTH_SPGB_NO    4   /* MITM Protection Not Required - Single Profiles/general bonding
-                                Numeric comparison with automatic accept allowed */
-#define BTM_AUTH_SPGB_YES   5   /* MITM Protection Required - Single Profiles/general bonding
-                                Use IO Capabilities to determine authentication procedure */
-#define BTM_AUTH_DD_BOND    2   /* this bit is ORed to the BTM_AUTH_SP_* when IO exchange for dedicated bonding */
+/* MITM Protection Not Required - Single Profile/non-bonding Numeric comparison
+ * with automatic accept allowed */
+#define BTM_AUTH_SP_NO      0
+/* MITM Protection Required - Single Profile/non-bonding. Use IO Capabilities to
+ * determine authentication procedure */
+#define BTM_AUTH_SP_YES     1
+/* MITM Protection Not Required - All Profiles/dedicated bonding Numeric
+ * comparison with automatic accept allowed */
+#define BTM_AUTH_AP_NO      2
+/* MITM Protection Required - All Profiles/dedicated bonding Use IO Capabilities
+ * to determine authentication procedure */
+#define BTM_AUTH_AP_YES     3
+/* MITM Protection Not Required - Single Profiles/general bonding Numeric
+ * comparison with automatic accept allowed */
+#define BTM_AUTH_SPGB_NO    4
+/* MITM Protection Required - Single Profiles/general bonding Use IO
+ * Capabilities to determine authentication procedure */
+#define BTM_AUTH_SPGB_YES   5
+
+/* this bit is ORed with BTM_AUTH_SP_* when IO exchange for dedicated bonding */
+#define BTM_AUTH_DD_BOND    2
 #define BTM_AUTH_GB_BIT     4   /* the genernal bonding bit */
 #define BTM_AUTH_BONDS      6   /* the general/dedicated bonding bits  */
 #define BTM_AUTH_YN_BIT     1   /* this is the Yes or No bit  */
@@ -1511,7 +1575,8 @@
 
 typedef void (tBTM_MKEY_CALLBACK) (BD_ADDR bd_addr, uint8_t status, uint8_t key_flag) ;
 
-/* Encryption enabled/disabled complete: Optionally passed with BTM_SetEncryption.
+/* Encryption enabled/disabled complete: Optionally passed with
+ * BTM_SetEncryption.
  * Parameters are
  *              BD Address of remote
  *              optional data passed in by BTM_SetEncryption
@@ -1526,34 +1591,50 @@
 */
 typedef void (tBTM_BOND_CANCEL_CMPL_CALLBACK) (tBTM_STATUS result);
 
-/* LE related event and data structure
-*/
-#define BTM_LE_IO_REQ_EVT       SMP_IO_CAP_REQ_EVT     /* received IO_CAPABILITY_REQUEST event */
-#define BTM_LE_SEC_REQUEST_EVT  SMP_SEC_REQUEST_EVT    /* security request event */
-#define BTM_LE_KEY_NOTIF_EVT    SMP_PASSKEY_NOTIF_EVT  /* received USER_PASSKEY_NOTIFY event */
-#define BTM_LE_KEY_REQ_EVT      SMP_PASSKEY_REQ_EVT    /* received USER_PASSKEY_REQUEST event */
-#define BTM_LE_OOB_REQ_EVT      SMP_OOB_REQ_EVT        /* OOB data request event */
-#define BTM_LE_NC_REQ_EVT       SMP_NC_REQ_EVT          /* Numeric Comparison request event */
-#define BTM_LE_PR_KEYPR_NOT_EVT SMP_PEER_KEYPR_NOT_EVT /* Peer keypress notification recd event */
-/* SC OOB request event (both local and peer OOB data) can be expected in response */
+/* LE related event and data structure */
+/* received IO_CAPABILITY_REQUEST event */
+#define BTM_LE_IO_REQ_EVT       SMP_IO_CAP_REQ_EVT
+/* security request event */
+#define BTM_LE_SEC_REQUEST_EVT  SMP_SEC_REQUEST_EVT
+/* received USER_PASSKEY_NOTIFY event */
+#define BTM_LE_KEY_NOTIF_EVT    SMP_PASSKEY_NOTIF_EVT
+/* received USER_PASSKEY_REQUEST event */
+#define BTM_LE_KEY_REQ_EVT      SMP_PASSKEY_REQ_EVT
+/* OOB data request event */
+#define BTM_LE_OOB_REQ_EVT      SMP_OOB_REQ_EVT
+/* Numeric Comparison request event */
+#define BTM_LE_NC_REQ_EVT       SMP_NC_REQ_EVT
+/* Peer keypress notification recd event */
+#define BTM_LE_PR_KEYPR_NOT_EVT SMP_PEER_KEYPR_NOT_EVT
+/* SC OOB request event (both local and peer OOB data) can be expected in
+ * response */
 #define BTM_LE_SC_OOB_REQ_EVT   SMP_SC_OOB_REQ_EVT
 /* SC OOB local data set is created (as result of SMP_CrLocScOobData(...)) */
 #define BTM_LE_SC_LOC_OOB_EVT   SMP_SC_LOC_OOB_DATA_UP_EVT
-#define BTM_LE_BR_KEYS_REQ_EVT  SMP_BR_KEYS_REQ_EVT     /* SMP over BR keys request event */
-#define BTM_LE_COMPLT_EVT       SMP_COMPLT_EVT         /* SMP complete event */
+/* SMP over BR keys request event */
+#define BTM_LE_BR_KEYS_REQ_EVT  SMP_BR_KEYS_REQ_EVT
+/* SMP complete event */
+#define BTM_LE_COMPLT_EVT       SMP_COMPLT_EVT
 #define BTM_LE_LAST_FROM_SMP    BTM_LE_BR_KEYS_REQ_EVT
-#define BTM_LE_KEY_EVT          (BTM_LE_LAST_FROM_SMP + 1) /* KEY update event */
+/* KEY update event */
+#define BTM_LE_KEY_EVT          (BTM_LE_LAST_FROM_SMP + 1)
 typedef uint8_t tBTM_LE_EVT;
 
 #define BTM_LE_KEY_NONE           0
-#define BTM_LE_KEY_PENC      SMP_SEC_KEY_TYPE_ENC        /* encryption information of peer device */
-#define BTM_LE_KEY_PID       SMP_SEC_KEY_TYPE_ID         /* identity key of the peer device */
-#define BTM_LE_KEY_PCSRK     SMP_SEC_KEY_TYPE_CSRK      /* peer SRK */
+/* encryption information of peer device */
+#define BTM_LE_KEY_PENC      SMP_SEC_KEY_TYPE_ENC
+/* identity key of the peer device */
+#define BTM_LE_KEY_PID       SMP_SEC_KEY_TYPE_ID
+/* peer SRK */
+#define BTM_LE_KEY_PCSRK     SMP_SEC_KEY_TYPE_CSRK
 #define BTM_LE_KEY_PLK       SMP_SEC_KEY_TYPE_LK
 #define BTM_LE_KEY_LLK       (SMP_SEC_KEY_TYPE_LK << 4)
-#define BTM_LE_KEY_LENC      (SMP_SEC_KEY_TYPE_ENC << 4)  /* master role security information:div */
-#define BTM_LE_KEY_LID       (SMP_SEC_KEY_TYPE_ID << 4)   /* master device ID key */
-#define BTM_LE_KEY_LCSRK     (SMP_SEC_KEY_TYPE_CSRK << 4) /* local CSRK has been deliver to peer */
+/* master role security information:div */
+#define BTM_LE_KEY_LENC      (SMP_SEC_KEY_TYPE_ENC << 4)
+/* master device ID key */
+#define BTM_LE_KEY_LID       (SMP_SEC_KEY_TYPE_ID << 4)
+/* local CSRK has been deliver to peer */
+#define BTM_LE_KEY_LCSRK     (SMP_SEC_KEY_TYPE_CSRK << 4)
 typedef uint8_t tBTM_LE_KEY_TYPE;
 
 #define BTM_LE_AUTH_REQ_NO_BOND SMP_AUTH_NO_BOND   /* 0 */
@@ -1578,9 +1659,13 @@
 
 typedef struct
 {
-    tBTM_IO_CAP         io_cap;         /* local IO capabilities */
-    uint8_t             oob_data;       /* OOB data present (locally) for the peer device */
-    tBTM_LE_AUTH_REQ    auth_req;       /* Authentication request (for local device) contain bonding and MITM info */
+    /* local IO capabilities */
+    tBTM_IO_CAP         io_cap;
+    /* OOB data present (locally) for the peer device */
+    uint8_t             oob_data;
+    /* Authentication request (for local device) containing bonding and MITM
+     * info */
+    tBTM_LE_AUTH_REQ    auth_req;
     uint8_t             max_key_size;   /* max encryption key size */
     tBTM_LE_KEY_TYPE    init_keys;      /* keys to be distributed, bit mask */
     tBTM_LE_KEY_TYPE    resp_keys;      /* keys to be distributed, bit mask */
@@ -1643,7 +1728,8 @@
     tBTM_LE_PENC_KEYS   penc_key;       /* received peer encryption key */
     tBTM_LE_PCSRK_KEYS  pcsrk_key;      /* received peer device SRK */
     tBTM_LE_PID_KEYS    pid_key;        /* peer device ID key */
-    tBTM_LE_LENC_KEYS   lenc_key;       /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/
+    tBTM_LE_LENC_KEYS   lenc_key;       /* local encryption reproduction keys
+                                         * LTK = = d1(ER,DIV,0) */
     tBTM_LE_LCSRK_KEYS   lcsrk_key;     /* local device CSRK = d1(ER,DIV,1)*/
 }tBTM_LE_KEY_VALUE;
 
@@ -1658,8 +1744,9 @@
     tBTM_LE_IO_REQ      io_req;     /* BTM_LE_IO_REQ_EVT      */
     uint32_t            key_notif;  /* BTM_LE_KEY_NOTIF_EVT   */
                                     /* BTM_LE_NC_REQ_EVT */
-                                    /* no callback data for BTM_LE_KEY_REQ_EVT */
-                                    /* and BTM_LE_OOB_REQ_EVT  */
+                                    /* no callback data for
+                                     * BTM_LE_KEY_REQ_EVT
+                                     * and BTM_LE_OOB_REQ_EVT  */
     tBTM_LE_COMPLT      complt;     /* BTM_LE_COMPLT_EVT      */
     tSMP_OOB_DATA_TYPE  req_oob_type;
     tBTM_LE_KEY         key;
@@ -1728,7 +1815,7 @@
     BTM_PM_STS_HOLD   = HCI_MODE_HOLD,
     BTM_PM_STS_SNIFF  = HCI_MODE_SNIFF,
     BTM_PM_STS_PARK   = HCI_MODE_PARK,
-    BTM_PM_STS_SSR,     /* report the SSR parameters in HCI_SNIFF_SUB_RATE_EVT */
+    BTM_PM_STS_SSR,   /* report the SSR parameters in HCI_SNIFF_SUB_RATE_EVT */
     BTM_PM_STS_PENDING,   /* when waiting for status from controller */
     BTM_PM_STS_ERROR   /* when HCI command status returns error */
 };
@@ -1748,9 +1835,12 @@
 #define BTM_PM_SET_ONLY_ID  0x80
 
 /* Operation codes */
-#define BTM_PM_REG_SET      1 /* The module wants to set the desired power mode */
-#define BTM_PM_REG_NOTIF    2 /* The module wants to receive mode change event */
-#define BTM_PM_DEREG        4 /* The module does not want to involve with PM anymore */
+/* The module wants to set the desired power mode */
+#define BTM_PM_REG_SET      1
+/* The module wants to receive mode change event */
+#define BTM_PM_REG_NOTIF    2
+/* The module does not want to involve with PM anymore */
+#define BTM_PM_DEREG        4
 
 /************************
  *  Power Manager Types
@@ -1822,13 +1912,13 @@
 {
     tBTM_MIP_EVT    event;
     BD_ADDR         bd_addr;
-    uint8_t         data[11];       /* data[0] shows Vender-specific device type */
+    uint8_t         data[11];   /* data[0] shows Vender-specific device type */
 } tBTM_MIP_EIR_HANDSHAKE;
 
 typedef struct
 {
     tBTM_MIP_EVT    event;
-    uint16_t        num_sent;       /* Number of packets completed at the controller */
+    uint16_t        num_sent; /* Completed packet count at the controller */
 } tBTM_MIP_PKTS_COMPL;
 
 typedef union
@@ -1847,9 +1937,12 @@
 /* MIP Device query callback function  */
 typedef bool    (tBTM_MIP_QUERY_CB) (BD_ADDR dev_addr, uint8_t *p_mode, LINK_KEY link_key);
 
-#define BTM_CONTRL_ACTIVE  1       /* ACL link on, SCO link ongoing, sniff mode */
-#define BTM_CONTRL_SCAN    2       /* Scan state - paging/inquiry/trying to connect*/
-#define BTM_CONTRL_IDLE    3       /* Idle state - page scan, LE advt, inquiry scan */
+/* ACL link on, SCO link ongoing, sniff mode */
+#define BTM_CONTRL_ACTIVE  1
+/* Scan state - paging/inquiry/trying to connect*/
+#define BTM_CONTRL_SCAN    2
+/* Idle state - page scan, LE advt, inquiry scan */
+#define BTM_CONTRL_IDLE    3
 
 typedef uint8_t tBTM_CONTRL_STATE;
 
diff --git a/stack/include/btm_ble_api.h b/stack/include/btm_ble_api.h
index 734e21f..bbe1ec2 100644
--- a/stack/include/btm_ble_api.h
+++ b/stack/include/btm_ble_api.h
@@ -49,7 +49,7 @@
  *                  for a LE device stored in the NVRAM.
  *
  * Parameters:      bd_addr          - BD address of the peer
- *                  bd_name          - Name of the peer device.  NULL if unknown.
+ *                  bd_name          - Name of the peer device. NULL if unknown.
  *                  dev_type         - Remote device's device type.
  *                  addr_type        - LE device address type.
  *
@@ -139,7 +139,8 @@
  *
  * Function         BTM_BleSetStorageConfig
  *
- * Description      This function is called to setup storage configuration and setup callbacks.
+ * Description      This function is called to setup storage configuration and
+ *                  setup callbacks.
  *
  * Parameters       uint8_t batch_scan_full_max -Batch scan full maximum
                     uint8_t batch_scan_trunc_max - Batch scan truncated value maximum
@@ -297,7 +298,8 @@
  *
  * Parameters       bd_addr - peer device bd address.
  *                  res     - result of the operation BTM_SUCCESS if success.
- *                            Otherwise, BTM_REPEATED_ATTEMPTS is too many attempts.
+ *                            Otherwise, BTM_REPEATED_ATTEMPTS is too many
+ *                            attempts.
  *
  * Returns          None
  *
@@ -311,10 +313,12 @@
  * Description      This function is called after Security Manager submitted
  *                  passkey request to the application.
  *
- * Parameters:      bd_addr      - Address of the device for which passkey was requested
- *                  res          - result of the operation SMP_SUCCESS if success
+ * Parameters:      bd_addr - Address of the device for which passkey was
+ *                            requested
+ *                  res     - result of the operation SMP_SUCCESS if success
  *                  passkey - numeric value in the range of
- *                  BTM_MIN_PASSKEY_VAL(0) - BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
+ *                               BTM_MIN_PASSKEY_VAL(0) -
+ *                               BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
  *
  ******************************************************************************/
 extern void BTM_BlePasskeyReply (BD_ADDR bd_addr, uint8_t res, uint32_t passkey);
@@ -406,8 +410,7 @@
  *
  * Function         BTM_ReadConnectionAddr
  *
- * Description      This function is called to set the local device random address
- *                  .
+ * Description      Read the local device random address.
  *
  * Returns          void
  *
@@ -421,8 +424,7 @@
  *
  * Function         BTM_ReadRemoteConnectionAddr
  *
- * Description      This function is read the remote device address currently used
- *                  .
+ * Description      Read the remote device address currently used.
  *
  * Returns          void
  *
@@ -437,7 +439,8 @@
  *
  * Description      Local local identity key, encryption root or sign counter.
  *
- * Parameters:      key_type: type of key, can be BTM_BLE_KEY_TYPE_ID, BTM_BLE_KEY_TYPE_ER
+ * Parameters:      key_type: type of key, can be BTM_BLE_KEY_TYPE_ID,
+ *                            BTM_BLE_KEY_TYPE_ER
  *                            or BTM_BLE_KEY_TYPE_COUNTER.
  *                  p_key: pointer to the key.
 *
@@ -452,11 +455,13 @@
  * Function         BTM_BleSetBgConnType
  *
  * Description      This function is called to set BLE background connection
- *                  procedure type. It can be auto connection, or selective connection.
+ *                  procedure type. It can be auto connection, or selective
+ *                  connection.
  *
- * Parameters       conn_type: it can be auto connection, or selective connection.
- *                  p_select_cback: callback function when selective connection procedure
- *                              is being used.
+ * Parameters       conn_type: it can be auto connection, or selective
+ *                             connection.
+ *                  p_select_cback: callback function when selective connection
+ *                                  procedure is being used.
  *
  * Returns          void
  *
@@ -538,7 +543,8 @@
  *
  * Description      Reads BLE specific controller features
  *
- * Parameters:      tBTM_BLE_CTRL_FEATURES_CBACK : Callback to notify when features are read
+ * Parameters:      tBTM_BLE_CTRL_FEATURES_CBACK : Callback to notify when
+ *                  features are read
  *
  * Returns          void
  *
@@ -564,8 +570,8 @@
  *
  * Function         BTM__BLEReadDiscoverability
  *
- * Description      This function is called to read the current LE discoverability
- *                  mode of the device.
+ * Description      This function is called to read the current LE
+ *                  discoverability mode of the device.
  *
  * Returns          BTM_BLE_NON_DISCOVERABLE ,BTM_BLE_LIMITED_DISCOVERABLE or
  *                     BTM_BLE_GENRAL_DISCOVERABLE
@@ -577,8 +583,8 @@
  *
  * Function         BTM__BLEReadConnectability
  *
- * Description      This function is called to read the current LE connectibility
- *                  mode of the device.
+ * Description      This function is called to read the current LE
+ *                  connectibility mode of the device.
  *
  * Returns          BTM_BLE_NON_CONNECTABLE or BTM_BLE_CONNECTABLE
  *
@@ -605,10 +611,11 @@
  *
  * Function         BTM_ReadConnectedTransportAddress
  *
- * Description      This function is called to read the paired device/address type of other device paired
- *                  corresponding to the BD_address
+ * Description      This function is called to read the paired device/address
+ *                  type of other device paired corresponding to the BD_address
  *
- * Parameter        remote_bda: remote device address, carry out the transport address
+ * Parameter        remote_bda: remote device address, carry out the transport
+ *                              address
  *                  transport: active transport
  *
  * Return           true if an active link is identified; false otherwise
@@ -660,7 +667,8 @@
  *
  * Function          BTM_BleMaxMultiAdvInstanceCount
  *
- * Description        Returns max number of multi adv instances  supported by controller
+ * Description      Returns the maximum number of multi adv instances supported
+ *                  by the controller.
  *
  * Returns          Max multi adv instance count
  *
@@ -674,9 +682,11 @@
  * Description      This function is called to set BLE connectable mode for a
  *                  peripheral device.
  *
- * Parameters       connectable_mode:  directed connectable mode, or non-directed.It can
- *                              be BTM_BLE_CONNECT_EVT, BTM_BLE_CONNECT_DIR_EVT or
- *                              BTM_BLE_CONNECT_LO_DUTY_DIR_EVT
+ * Parameters       connectable_mode:  directed connectable mode, or
+ *                                     non-directed. It can be
+ *                                     BTM_BLE_CONNECT_EVT,
+ *                                     BTM_BLE_CONNECT_DIR_EVT or
+ *                                     BTM_BLE_CONNECT_LO_DUTY_DIR_EVT
  *
  * Returns          BTM_ILLEGAL_VALUE if controller does not support BLE.
  *                  BTM_SUCCESS is status set successfully; otherwise failure.
@@ -688,8 +698,8 @@
  *
  * Function         BTM_BleTurnOnPrivacyOnRemote
  *
- * Description      This function is called to enable or disable the privacy on the
- *                  remote device.
+ * Description      This function is called to enable or disable the privacy on
+ *                  the remote device.
  *
  * Parameters       bd_addr: remote device address.
  *                  privacy_on: true to enable it; false to disable it.
@@ -732,7 +742,8 @@
  * Description      This function is called to start the LE Transmitter test
  *
  * Parameter       tx_freq - Frequency Range
- *                       test_data_len - Length in bytes of payload data in each packet
+ *                       test_data_len - Length in bytes of payload data in each
+ *                                       packet
  *                       packet_payload - Pattern to use in the payload
  *                       p_cmd_cmpl_cback - Command Complete callback
  *
@@ -744,7 +755,7 @@
  *
  * Function         BTM_BleTestEnd
  *
- * Description      This function is called to stop the in-progress TX or RX test
+ * Description     This function is called to stop the in-progress TX or RX test
  *
  * Parameter       p_cmd_cmpl_cback - Command complete callback
  *
@@ -755,7 +766,7 @@
  *
  * Function         BTM_UseLeLink
  *
- * Description      This function is to select the underneath physical link to use.
+ * Description      Select the underlying physical link to use.
  *
  * Returns          true to use LE, false use BR/EDR.
  *
@@ -766,8 +777,8 @@
  *
  * Function         BTM_BleStackEnable
  *
- * Description      Enable/Disable BLE functionality on stack regarless controller
- *                  capability.
+ * Description      Enable/Disable BLE functionality on stack regardless of
+ *                  controller capability.
  *
  * Parameters:      enable: true to enable, false to disable.
  *
@@ -797,7 +808,7 @@
  * Description      This function indicates if LE security procedure is
  *                  currently running with the peer.
  *
- * Returns          bool    true if security procedure is running, false otherwise.
+ * Returns          bool true if security procedure is running, false otherwise.
  *
  ******************************************************************************/
 extern bool    BTM_BleSecurityProcedureIsRunning (BD_ADDR bd_addr);
@@ -822,8 +833,8 @@
  * Description      This function is called to setup the adv data payload filter
  *                  condition.
  *
- * Parameters       p_target: enabble the filter condition on a target device; if NULL
- *                            enable the generic scan condition.
+ * Parameters       p_target: enabble the filter condition on a target device;
+ *                            if NULL enable the generic scan condition.
  *                  enable: enable or disable the filter condition
  *
  * Returns          void
@@ -839,8 +850,8 @@
  *
  * Function         BTM_BleCfgFilterCondition
  *
- * Description      This function is called to configure the adv data payload filter
- *                  condition.
+ * Description      This function is called to configure the adv data payload
+ *                  filter condition.
  *
  * Parameters       action: to read/write/clear
  *                  cond_type: filter condition type.
@@ -860,9 +871,9 @@
  *
  * Function         BTM_BleEnableDisableFilterFeature
  *
- * Description      This function is called to enable or disable the APCF feature
+ * Description      Enable or disable the APCF feature
  *
- * Parameters       enable - true - enables the APCF, false - disables the APCF
+ * Parameters       enable - true - enables APCF, false - disables APCF
  *                       ref_value - Ref value
  *
  * Returns          tBTM_STATUS
@@ -889,7 +900,7 @@
  *
  * Function         BTM_SetBleDataLength
  *
- * Description      This function is called to set maximum BLE transmission packet size
+ * Description      Set the maximum BLE transmission packet size
  *
  * Returns          BTM_SUCCESS if success; otherwise failed.
  *
diff --git a/stack/include/btm_ble_api_types.h b/stack/include/btm_ble_api_types.h
index 01ecbe8..a23a564 100644
--- a/stack/include/btm_ble_api_types.h
+++ b/stack/include/btm_ble_api_types.h
@@ -29,14 +29,16 @@
 typedef uint8_t tBTM_BLE_CHNL_MAP[CHNL_MAP_LEN];
 
 /* 0x00-0x04 only used for set advertising parameter command */
-#define BTM_BLE_CONNECT_EVT     0x00   /* 0x00-0x04 only used for set advertising
-                                            parameter command */
-#define BTM_BLE_CONNECT_DIR_EVT 0x01   /* Connectable directed advertising */
-#define BTM_BLE_DISCOVER_EVT    0x02  /* Scannable undirected advertising */
-#define BTM_BLE_NON_CONNECT_EVT 0x03  /* Non connectable undirected advertising */
-#define BTM_BLE_CONNECT_LO_DUTY_DIR_EVT 0x04        /* Connectable low duty
-                                                       cycle directed advertising  */
-    /* 0x00 - 0x05 can be received on adv event type */
+#define BTM_BLE_CONNECT_EVT     0x00
+/* Connectable directed advertising */
+#define BTM_BLE_CONNECT_DIR_EVT 0x01
+/* Scannable undirected advertising */
+#define BTM_BLE_DISCOVER_EVT    0x02
+/* Non connectable undirected advertising */
+#define BTM_BLE_NON_CONNECT_EVT 0x03
+/* Connectable low duty cycle directed advertising  */
+#define BTM_BLE_CONNECT_LO_DUTY_DIR_EVT 0x04
+/* 0x00 - 0x05 can be received on adv event type */
 #define BTM_BLE_SCAN_RSP_EVT    0x04
 #define BTM_BLE_SCAN_REQ_EVT    0x05
 #define BTM_BLE_UNKNOWN_EVT     0xff
@@ -85,15 +87,19 @@
 #endif
 
 /* scanning filter policy */
-#define SP_ADV_ALL     0x00     /* 0: accept adv packet from all, directed adv pkt not directed */
-                                /* to local device is ignored */
-#define SP_ADV_WL      0x01     /* 1: accept adv packet from device in white list, directed adv */
-                                /* packet not directed to local device is ignored */
-#define SP_ADV_ALL_RPA_DIR_ADV 0x02  /* 2: accept adv packet from all, directed adv pkt */
-                                     /* not directed to me is ignored except direct adv with RPA */
-#define SP_ADV_WL_RPA_DIR_ADV  0x03  /* 3: accept adv packet from device in white list, directed */
-                                     /* adv pkt not directed to me is ignored except direct adv */
-                                     /* with RPA */
+/* 0: accept adv packet from all, directed adv pkt not directed */
+/*    to local device is ignored */
+#define SP_ADV_ALL     0x00
+/* 1: accept adv packet from device in white list, directed adv */
+/*    packet not directed to local device is ignored */
+#define SP_ADV_WL      0x01
+/* 2: accept adv packet from all, directed adv pkt */
+/*    not directed to me is ignored except direct adv with RPA */
+#define SP_ADV_ALL_RPA_DIR_ADV 0x02
+/* 3: accept adv packet from device in white list, directed */
+/*    adv pkt not directed to me is ignored except direct adv with RPA */
+#define SP_ADV_WL_RPA_DIR_ADV  0x03
+
 typedef uint8_t tBTM_BLE_SFP;
 
 #ifndef BTM_BLE_DEFAULT_SFP
@@ -128,15 +134,18 @@
 #define BTM_BLE_CONN_LATENCY_MAX        500
 #define BTM_BLE_CONN_SUP_TOUT_MIN       0x000A
 #define BTM_BLE_CONN_SUP_TOUT_MAX       0x0C80
-#define BTM_BLE_CONN_PARAM_UNDEF        0xffff      /* use this value when a specific value not to be overwritten */
+/* use this value when a specific value not to be overwritten */
+#define BTM_BLE_CONN_PARAM_UNDEF        0xffff
 #define BTM_BLE_SCAN_PARAM_UNDEF        0xffffffff
 
-/* default connection parameters if not configured, use GAP recommend value for auto/selective connection */
+/* default connection parameters if not configured, use GAP recommended value
+ * for auto/selective connection */
 /* default scan interval */
 #ifndef BTM_BLE_SCAN_FAST_INT
 #define BTM_BLE_SCAN_FAST_INT    96    /* 30 ~ 60 ms (use 60)  = 96 *0.625 */
 #endif
-/* default scan window for background connection, applicable for auto connection or selective conenction */
+/* default scan window for background connection, applicable for auto connection
+ * or selective connection */
 #ifndef BTM_BLE_SCAN_FAST_WIN
 #define BTM_BLE_SCAN_FAST_WIN   48      /* 30 ms = 48 *0.625 */
 #endif
@@ -159,12 +168,14 @@
 
 /* default connection interval min */
 #ifndef BTM_BLE_CONN_INT_MIN_DEF
-#define BTM_BLE_CONN_INT_MIN_DEF     24      /* recommended min: 30ms  = 24 * 1.25 */
+/* recommended min: 30ms  = 24 * 1.25 */
+#define BTM_BLE_CONN_INT_MIN_DEF     24
 #endif
 
 /* default connectino interval max */
 #ifndef BTM_BLE_CONN_INT_MAX_DEF
-#define BTM_BLE_CONN_INT_MAX_DEF     40      /* recommended max: 50 ms = 56 * 1.25 */
+/* recommended max: 50 ms = 56 * 1.25 */
+#define BTM_BLE_CONN_INT_MAX_DEF     40
 #endif
 
 /* default slave latency */
@@ -268,7 +279,8 @@
 } tBTM_RAND_ENC;
 
 /* General callback function for notifying an application that a synchronous
- * BTM function is complete. The pointer contains the address of any returned data.
+ * BTM function is complete. The pointer contains the address of any returned
+ * data.
 */
 typedef void (tBTM_RAND_ENC_CB) (tBTM_RAND_ENC *p1);
 
@@ -424,7 +436,8 @@
 #define BTM_BLE_PF_LOCAL_NAME           4
 #define BTM_BLE_PF_MANU_DATA            5
 #define BTM_BLE_PF_SRVC_DATA_PATTERN    6
-#define BTM_BLE_PF_TYPE_ALL             7  /* when passed in payload filter type all, only clear action is applicable */
+/* when passed in payload filter type all, only clear action is applicable */
+#define BTM_BLE_PF_TYPE_ALL             7
 #define BTM_BLE_PF_TYPE_MAX             8
 
 /* max number of filter spot for different filter type */
@@ -588,7 +601,8 @@
     uint8_t next_idx;
 }tBTM_BLE_ADV_FILTER_ADV_OPQ;
 
-#define BTM_BLE_MAX_FILTER_COUNTER  (BTM_BLE_MAX_ADDR_FILTER + 1) /* per device filter + one generic filter indexed by 0 */
+/* per device filter + one generic filter indexed by 0 */
+#define BTM_BLE_MAX_FILTER_COUNTER  (BTM_BLE_MAX_ADDR_FILTER + 1)
 
 #ifndef BTM_CS_IRK_LIST_MAX
 #define BTM_CS_IRK_LIST_MAX 0x20
@@ -685,7 +699,8 @@
 typedef bool    (tBTM_BLE_SEL_CBACK)(BD_ADDR random_bda,     uint8_t *p_remote_name);
 typedef void (tBTM_BLE_CTRL_FEATURES_CBACK)(tBTM_STATUS status);
 
-/* callback function for SMP signing algorithm, signed data in little endian order with tlen bits long */
+/* callback function for SMP signing algorithm, signed data in little endian
+ * order with tlen bits long */
 typedef void (tBTM_BLE_SIGN_CBACK)(void *p_ref_data, uint8_t *p_signing_data);
 typedef void (tBTM_BLE_VERIFY_CBACK)(void *p_ref_data, bool    match);
 /* random address set complete callback */
diff --git a/stack/include/gap_api.h b/stack/include/gap_api.h
index f4d6046..b2cb3e8 100644
--- a/stack/include/gap_api.h
+++ b/stack/include/gap_api.h
@@ -31,29 +31,50 @@
  *  Constants
  ****************************************************************************/
 /*** GAP Error and Status Codes ***/
-#define GAP_UNSUPPORTED     (GAP_ERR_GRP + 0x01)    /* Unsupported call */
-#define GAP_EOINQDB         (GAP_ERR_GRP + 0x02)    /* End of inquiry database marker */
-#define GAP_ERR_BUSY        (GAP_ERR_GRP + 0x03)    /* The requested function was busy */
-#define GAP_ERR_NO_CTRL_BLK (GAP_ERR_GRP + 0x04)    /* No control blocks available */
-#define GAP_ERR_STARTING_CMD (GAP_ERR_GRP + 0x05)   /* Error occurred while initiating the command */
-#define GAP_NO_BDADDR_REC   (GAP_ERR_GRP + 0x06)    /* No Inquiry DB record for BD_ADDR */
-#define GAP_ERR_ILL_MODE    (GAP_ERR_GRP + 0x07)    /* An illegal mode parameter was detected */
-#define GAP_ERR_ILL_INQ_TIME (GAP_ERR_GRP + 0x08)   /* An illegal time parameter was detected */
-#define GAP_ERR_ILL_PARM     (GAP_ERR_GRP + 0x09)   /* An illegal parameter was detected */
-#define GAP_ERR_REM_NAME    (GAP_ERR_GRP + 0x0a)    /* Error starting the remote device name request */
-#define GAP_CMD_INITIATED   (GAP_ERR_GRP + 0x0b)    /* The GAP command was started (result pending) */
-#define GAP_DEVICE_NOT_UP   (GAP_ERR_GRP + 0x0c)    /* The device was not up; the request was not executed */
-#define GAP_BAD_BD_ADDR     (GAP_ERR_GRP + 0x0d)    /* The bd addr passed in was not found or invalid */
+/* Unsupported call */
+#define GAP_UNSUPPORTED     (GAP_ERR_GRP + 0x01)
+/* End of inquiry database marker */
+#define GAP_EOINQDB         (GAP_ERR_GRP + 0x02)
+/* The requested function was busy */
+#define GAP_ERR_BUSY        (GAP_ERR_GRP + 0x03)
+/* No control blocks available */
+#define GAP_ERR_NO_CTRL_BLK (GAP_ERR_GRP + 0x04)
+/* Error occurred while initiating the command */
+#define GAP_ERR_STARTING_CMD (GAP_ERR_GRP + 0x05)
+/* No Inquiry DB record for BD_ADDR */
+#define GAP_NO_BDADDR_REC   (GAP_ERR_GRP + 0x06)
+/* An illegal mode parameter was detected */
+#define GAP_ERR_ILL_MODE    (GAP_ERR_GRP + 0x07)
+/* An illegal time parameter was detected */
+#define GAP_ERR_ILL_INQ_TIME (GAP_ERR_GRP + 0x08)
+/* An illegal parameter was detected */
+#define GAP_ERR_ILL_PARM     (GAP_ERR_GRP + 0x09)
+/* Error starting the remote device name request */
+#define GAP_ERR_REM_NAME    (GAP_ERR_GRP + 0x0a)
+/* The GAP command was started (result pending) */
+#define GAP_CMD_INITIATED   (GAP_ERR_GRP + 0x0b)
+/* The device was not up; the request was not executed */
+#define GAP_DEVICE_NOT_UP   (GAP_ERR_GRP + 0x0c)
+/* The bd addr passed in was not found or invalid */
+#define GAP_BAD_BD_ADDR     (GAP_ERR_GRP + 0x0d)
 
-#define GAP_ERR_BAD_HANDLE  (GAP_ERR_GRP + 0x0e)    /* Bad GAP handle                       */
-#define GAP_ERR_BUF_OFFSET  (GAP_ERR_GRP + 0x0f)    /* Buffer offset invalid                */
-#define GAP_ERR_BAD_STATE   (GAP_ERR_GRP + 0x10)    /* Connection is in invalid state       */
-#define GAP_NO_DATA_AVAIL   (GAP_ERR_GRP + 0x11)    /* No data available                    */
-#define GAP_ERR_CONGESTED   (GAP_ERR_GRP + 0x12)    /* BT stack is congested                */
-#define GAP_ERR_SECURITY    (GAP_ERR_GRP + 0x13)    /* Security failed                      */
+/* Bad GAP handle */
+#define GAP_ERR_BAD_HANDLE  (GAP_ERR_GRP + 0x0e)
+/* Buffer offset invalid */
+#define GAP_ERR_BUF_OFFSET  (GAP_ERR_GRP + 0x0f)
+/* Connection is in invalid state */
+#define GAP_ERR_BAD_STATE   (GAP_ERR_GRP + 0x10)
+/* No data available */
+#define GAP_NO_DATA_AVAIL   (GAP_ERR_GRP + 0x11)
+/* BT stack is congested */
+#define GAP_ERR_CONGESTED   (GAP_ERR_GRP + 0x12)
+/* Security failed */
+#define GAP_ERR_SECURITY    (GAP_ERR_GRP + 0x13)
 
-#define GAP_ERR_PROCESSING  (GAP_ERR_GRP + 0x14)    /* General error processing BTM request */
-#define GAP_ERR_TIMEOUT     (GAP_ERR_GRP + 0x15)    /* Timeout occurred while processing cmd */
+/* General error processing BTM request */
+#define GAP_ERR_PROCESSING  (GAP_ERR_GRP + 0x14)
+/* Timeout occurred while processing cmd */
+#define GAP_ERR_TIMEOUT     (GAP_ERR_GRP + 0x15)
 #define GAP_EVT_CONN_OPENED         0x0100
 #define GAP_EVT_CONN_CLOSED         0x0101
 #define GAP_EVT_CONN_DATA_AVAIL     0x0102
@@ -69,7 +90,7 @@
 /*** used in connection variables and functions ***/
 #define GAP_INVALID_HANDLE      0xFFFF
 
-/* This is used to change the criteria for AMP  */
+/* This is used to change the criteria for AMP */
 #define GAP_PROTOCOL_ID         (UUID_PROTOCOL_UDP)
 
 
@@ -145,7 +166,8 @@
  *
  * Description      This function is called to open a generic L2CAP connection.
  *
- * Returns          handle of the connection if successful, else GAP_INVALID_HANDLE
+ * Returns          handle of the connection if successful, else
+ *                  GAP_INVALID_HANDLE
  *
  ******************************************************************************/
 extern uint16_t GAP_ConnOpen(const char *p_serv_name, uint8_t service_id, bool is_server,
@@ -215,8 +237,8 @@
  * Function         GAP_ConnWriteData
  *
  * Description      GKI buffer unaware application will call this function
- *                  to send data to the connection. A data copy is made into a GKI
- *                  buffer.
+ *                  to send data to the connection. A data copy is made into a
+ *                  GKI buffer.
  *
  * Returns          BT_PASS                 - data read
  *                  GAP_ERR_BAD_HANDLE      - invalid handle
@@ -231,7 +253,8 @@
  *
  * Function         GAP_ConnReconfig
  *
- * Description      Applications can call this function to reconfigure the connection.
+ * Description      Applications can call this function to reconfigure the
+ *                  connection.
  *
  * Returns          BT_PASS                 - config process started
  *                  GAP_ERR_BAD_HANDLE      - invalid handle
@@ -244,12 +267,12 @@
  * Function         GAP_ConnSetIdleTimeout
  *
  * Description      Higher layers call this function to set the idle timeout for
- *                  a connection, or for all future connections. The "idle timeout"
- *                  is the amount of time that a connection can remain up with
- *                  no L2CAP channels on it. A timeout of zero means that the
- *                  connection will be torn down immediately when the last channel
- *                  is removed. A timeout of 0xFFFF means no timeout. Values are
- *                  in seconds.
+ *                  a connection, or for all future connections. The "idle
+ *                  timeout" is the amount of time that a connection can remain
+ *                  up with no L2CAP channels on it. A timeout of zero means
+ *                  that the connection will be torn down immediately when the
+ *                  last channel is removed. A timeout of 0xFFFF means no
+ *                  timeout. Values are in seconds.
  *
  * Returns          BT_PASS                 - config process started
  *                  GAP_ERR_BAD_HANDLE      - invalid handle
@@ -276,7 +299,8 @@
  *
  * Description      Returns the remote device's MTU size.
  *
- * Returns          uint16_t - maximum size buffer that can be transmitted to the peer
+ * Returns          uint16_t - maximum size buffer that can be transmitted to
+ *                             the peer
  *
  ******************************************************************************/
 extern uint16_t GAP_ConnGetRemMtuSize (uint16_t gap_handle);
@@ -348,7 +372,8 @@
  *
  * Function         GAP_BleReadPeerDevName
  *
- * Description      Start a process to read a connected peripheral's device name.
+ * Description      Start a process to read a connected peripheral's device
+ *                  name.
  *
  * Returns          true if request accepted
  *
diff --git a/stack/include/gatt_api.h b/stack/include/gatt_api.h
index 4db2843..e12a9d7 100644
--- a/stack/include/gatt_api.h
+++ b/stack/include/gatt_api.h
@@ -68,10 +68,14 @@
 #define  GATT_NOT_ENCRYPTED                  0x8e
 #define  GATT_CONGESTED                      0x8f
 
-                                             /* 0xE0 ~ 0xFC reserved for future use */
-#define  GATT_CCC_CFG_ERR                    0xFD /* Client Characteristic Configuration Descriptor Improperly Configured */
-#define  GATT_PRC_IN_PROGRESS                0xFE /* Procedure Already in progress */
-#define  GATT_OUT_OF_RANGE                   0xFF /* Attribute value out of range */
+/* 0xE0 ~ 0xFC reserved for future use */
+
+/* Client Characteristic Configuration Descriptor Improperly Configured */
+#define  GATT_CCC_CFG_ERR                    0xFD
+/* Procedure Already in progress */
+#define  GATT_PRC_IN_PROGRESS                0xFE
+/* Attribute value out of range */
+#define  GATT_OUT_OF_RANGE                   0xFF
 typedef uint8_t tGATT_STATUS;
 
 
@@ -92,9 +96,11 @@
 #define  GATT_RSP_READ_MULTI                 0x0F
 #define  GATT_REQ_READ_BY_GRP_TYPE           0x10
 #define  GATT_RSP_READ_BY_GRP_TYPE           0x11
-#define  GATT_REQ_WRITE                      0x12 /*                 0001-0010 (write)*/
+/*                 0001-0010 (write)*/
+#define  GATT_REQ_WRITE                      0x12
 #define  GATT_RSP_WRITE                      0x13
-#define  GATT_CMD_WRITE                      0x52 /* changed in V4.0 01001-0010(write cmd)*/
+/* changed in V4.0 01001-0010(write cmd)*/
+#define  GATT_CMD_WRITE                      0x52
 #define  GATT_REQ_PREPARE_WRITE              0x16
 #define  GATT_RSP_PREPARE_WRITE              0x17
 #define  GATT_REQ_EXEC_WRITE                 0x18
@@ -102,20 +108,29 @@
 #define  GATT_HANDLE_VALUE_NOTIF             0x1B
 #define  GATT_HANDLE_VALUE_IND               0x1D
 #define  GATT_HANDLE_VALUE_CONF              0x1E
-#define  GATT_SIGN_CMD_WRITE                 0xD2 /* changed in V4.0 1101-0010 (signed write)  see write cmd above*/
-#define  GATT_OP_CODE_MAX                    (GATT_HANDLE_VALUE_CONF + 1) /* 0x1E = 30 + 1 = 31*/
+/* changed in V4.0 1101-0010 (signed write)  see write cmd above*/
+#define  GATT_SIGN_CMD_WRITE                 0xD2
+/* 0x1E = 30 + 1 = 31*/
+#define  GATT_OP_CODE_MAX                    (GATT_HANDLE_VALUE_CONF + 1)
 
 
 #define  GATT_HANDLE_IS_VALID(x) ((x) != 0)
 
 #define GATT_CONN_UNKNOWN                   0
-#define GATT_CONN_L2C_FAILURE               1                               /* general L2cap failure  */
-#define GATT_CONN_TIMEOUT                   HCI_ERR_CONNECTION_TOUT         /* 0x08 connection timeout  */
-#define GATT_CONN_TERMINATE_PEER_USER       HCI_ERR_PEER_USER               /* 0x13 connection terminate by peer user  */
-#define GATT_CONN_TERMINATE_LOCAL_HOST      HCI_ERR_CONN_CAUSE_LOCAL_HOST   /* 0x16 connectionterminated by local host  */
-#define GATT_CONN_FAIL_ESTABLISH            HCI_ERR_CONN_FAILED_ESTABLISHMENT/* 0x03E connection fail to establish  */
-#define GATT_CONN_LMP_TIMEOUT               HCI_ERR_LMP_RESPONSE_TIMEOUT     /* 0x22 connection fail for LMP response tout */
-#define GATT_CONN_CANCEL                    L2CAP_CONN_CANCEL                /* 0x0100 L2CAP connection cancelled  */
+/* general L2cap failure  */
+#define GATT_CONN_L2C_FAILURE               1
+/* 0x08 connection timeout  */
+#define GATT_CONN_TIMEOUT                   HCI_ERR_CONNECTION_TOUT
+/* 0x13 connection terminate by peer user  */
+#define GATT_CONN_TERMINATE_PEER_USER       HCI_ERR_PEER_USER
+/* 0x16 connectionterminated by local host  */
+#define GATT_CONN_TERMINATE_LOCAL_HOST      HCI_ERR_CONN_CAUSE_LOCAL_HOST
+/* 0x03E connection fail to establish  */
+#define GATT_CONN_FAIL_ESTABLISH            HCI_ERR_CONN_FAILED_ESTABLISHMENT
+/* 0x22 connection fail for LMP response tout */
+#define GATT_CONN_LMP_TIMEOUT               HCI_ERR_LMP_RESPONSE_TIMEOUT
+/* 0x0100 L2CAP connection cancelled  */
+#define GATT_CONN_CANCEL                    L2CAP_CONN_CANCEL
 typedef uint16_t tGATT_DISCONN_REASON;
 
 /* MAX GATT MTU size
@@ -169,7 +184,8 @@
 #define GATT_PERM_WRITE_SIGNED_MITM (1 << 8) /* bit 8 */
 typedef uint16_t tGATT_PERM;
 
-#define GATT_ENCRYPT_KEY_SIZE_MASK  (0xF000) /* the MS nibble of tGATT_PERM; key size 7=0; size 16=9 */
+/* the MS nibble of tGATT_PERM; key size 7=0; size 16=9 */
+#define GATT_ENCRYPT_KEY_SIZE_MASK  (0xF000)
 
 #define GATT_READ_ALLOWED           (GATT_PERM_READ | GATT_PERM_READ_ENCRYPTED | GATT_PERM_READ_ENC_MITM)
 #define GATT_READ_AUTH_REQUIRED     (GATT_PERM_READ_ENCRYPTED)
@@ -278,8 +294,10 @@
 
 /* Characteristic descriptor: Extended Properties value
 */
-#define GATT_CHAR_BIT_REL_WRITE    0x0001       /* permits reliable writes of the Characteristic Value */
-#define GATT_CHAR_BIT_WRITE_AUX    0x0002       /* permits writes to the characteristic descriptor */
+/* permits reliable writes of the Characteristic Value */
+#define GATT_CHAR_BIT_REL_WRITE    0x0001
+/* permits writes to the characteristic descriptor */
+#define GATT_CHAR_BIT_WRITE_AUX    0x0002
 
 
 /* characteristic descriptor: client configuration value
@@ -298,8 +316,10 @@
 
 /* Characteristic descriptor: Extended Properties value
 */
-#define GATT_CHAR_BIT_REL_WRITE    0x0001       /* permits reliable writes of the Characteristic Value */
-#define GATT_CHAR_BIT_WRITE_AUX    0x0002       /* permits writes to the characteristic descriptor */
+/* permits reliable writes of the Characteristic Value */
+#define GATT_CHAR_BIT_REL_WRITE    0x0001
+/* permits writes to the characteristic descriptor */
+#define GATT_CHAR_BIT_WRITE_AUX    0x0002
 
 /* authentication requirement
 */
@@ -322,7 +342,8 @@
     uint8_t         value[GATT_MAX_ATTR_LEN];  /* the actual attribute value */
 } tGATT_VALUE;
 
-/* Union of the event data which is used in the server respond API to carry the server response information
+/* Union of the event data which is used in the server respond API to carry the
+ * server response information
 */
 typedef union
 {
@@ -570,7 +591,8 @@
 /* discover complete callback function */
 typedef void (tGATT_DISC_CMPL_CB) (uint16_t conn_id, tGATT_DISC_TYPE disc_type, tGATT_STATUS status);
 
-/* Define a callback function for when read/write/disc/config operation is completed. */
+/* Define a callback function for when read/write/disc/config operation is
+ * completed. */
 typedef void (tGATT_CMPL_CBACK) (uint16_t conn_id, tGATTC_OPTYPE op, tGATT_STATUS status,
                 tGATT_CL_COMPLETE *p_data);
 
@@ -604,9 +626,7 @@
     tGATT_CONGESTION_CBACK          *p_congestion_cb;
 } tGATT_CBACK;
 
-/***********************  Start Handle Management Definitions   **********************
-*/
-
+/*****************  Start Handle Management Definitions   *********************/
 
 typedef struct
 {
@@ -657,12 +677,11 @@
     tGATTS_NV_SRV_CHG_CBACK    *p_srv_chg_callback;
 } tGATT_APPL_INFO;
 
-/*
- **********************  End Handle Management Definitions   **********************/
+/********************  End Handle Management Definitions   ********************/
 
-/*****************************************************************************
+/*******************************************************************************
  *  External Function Declarations
- ****************************************************************************/
+ ******************************************************************************/
 
 /*******************************************************************************
  *
@@ -686,8 +705,9 @@
  *
  * Function         GATTS_AddHandleRange
  *
- * Description      This function add the allocated handles range for the specifed
- *                  application UUID, service UUID and service instance
+ * Description      This function add the allocated handles range for the
+ *                  specified application UUID, service UUID and service
+ *                  instance
  *
  * Parameter        p_hndl_range:   pointer to allocated handles information
  *
@@ -743,9 +763,10 @@
  *
  * Parameter        gatt_if       : application interface
  *                  p_svc_uuid    : service UUID
- *                  svc_inst      : instance of the service inside the application
+ *                  svc_inst      : instance of the service inside the
+ *                                  application
  *
- * Returns          true if operation succeed, false if handle block was not found.
+ * Returns          true if operation succeed, else false
  *
  ******************************************************************************/
 extern bool GATTS_DeleteService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid, uint16_t svc_inst);
@@ -772,11 +793,13 @@
  * Description      This function sends a handle value indication to a client.
  *
  * Parameter        conn_id: connection identifier.
- *                  attr_handle: Attribute handle of this handle value indication.
+ *                  attr_handle: Attribute handle of this handle value
+ *                               indication.
  *                  val_len: Length of the indicated attribute value.
  *                  p_val: Pointer to the indicated attribute value data.
  *
- * Returns          GATT_SUCCESS if sucessfully sent or queued; otherwise error code.
+ * Returns          GATT_SUCCESS if sucessfully sent or queued; otherwise error
+ *                               code.
  *
  ******************************************************************************/
 extern  tGATT_STATUS GATTS_HandleValueIndication (uint16_t conn_id,
@@ -790,7 +813,8 @@
  * Description      This function sends a handle value notification to a client.
  *
  * Parameter       conn_id: connection identifier.
- *                  attr_handle: Attribute handle of this handle value indication.
+ *                  attr_handle: Attribute handle of this handle value
+ *                               indication.
  *                  val_len: Length of the indicated attribute value.
  *                  p_val: Pointer to the indicated attribute value data.
  *
@@ -842,7 +866,8 @@
  *
  * Function         GATTC_Discover
  *
- * Description      This function is called to do a discovery procedure on ATT server.
+ * Description      This function is called to do a discovery procedure on ATT
+ *                  server.
  *
  * Parameters       conn_id: connection identifier.
  *                  disc_type:discovery type.
@@ -858,8 +883,8 @@
  *
  * Function         GATTC_Read
  *
- * Description      This function is called to read the value of an attribute from
- *                  the server.
+ * Description      This function is called to read the value of an attribute
+ *                  from the server.
  *
  * Parameters       conn_id: connection identifier.
  *                  type    - attribute read type.
@@ -875,8 +900,8 @@
  *
  * Function         GATTC_Write
  *
- * Description      This function is called to read the value of an attribute from
- *                  the server.
+ * Description      This function is called to read the value of an attribute
+ *                  from the server.
  *
  * Parameters       conn_id: connection identifier.
  *                  type    - attribute write type.
@@ -897,7 +922,8 @@
  *                  the server.
  *
  * Parameters       conn_id: connection identifier.
- *                  is_execute - to execute or cancel the prepare write requet(s)
+ *                  is_execute - to execute or cancel the prepare write
+ *                               request(s)
  *
  * Returns          GATT_SUCCESS if command started successfully.
  *
@@ -924,8 +950,8 @@
  *
  * Function         GATT_SetIdleTimeout
  *
- * Description      This function (common to both client and server) sets the idle
- *                  timeout for a tansport connection
+ * Description      This function (common to both client and server) sets the
+ *                  idle timeout for a tansport connection
  *
  * Parameter        bd_addr:   target device bd address.
  *                  idle_tout: timeout value in seconds.
@@ -948,7 +974,8 @@
  * Parameter        p_app_uuid128: Application UUID
  *                  p_cb_info: callback functions.
  *
- * Returns          0 for error, otherwise the index of the client registered with GATT
+ * Returns          0 for error, otherwise the index of the client registered
+ *                  with GATT
  *
  ******************************************************************************/
 extern  tGATT_IF GATT_Register (tBT_UUID *p_app_uuid128, tGATT_CBACK *p_cb_info);
@@ -970,9 +997,9 @@
  *
  * Function         GATT_StartIf
  *
- * Description      This function is called after registration to start receiving
- *                  callbacks for registered interface.  Function may call back
- *                  with connection status and queued notifications
+ * Description      This function is called after registration to start
+ *                  receiving callbacks for registered interface.  Function may
+ *                  call back with connection status and queued notifications
  *
  * Parameter        gatt_if: applicaiton interface.
  *
@@ -985,18 +1012,20 @@
  *
  * Function         GATT_Connect
  *
- * Description      This function initiate a connecttion to a remote device on GATT
- *                  channel.
+ * Description      This function initiate a connecttion to a remote device on
+ *                  GATT channel.
  *
  * Parameters       gatt_if: applicaiton interface
  *                  bd_addr: peer device address.
- *                  is_direct: is a direct connection or a background auto connection
- *                  transport : Physical transport for GATT connection (BR/EDR or LE)
+ *                  is_direct: is a direct connection or a background auto
+ *                             connection
+ *                  transport : Physical transport for GATT connection
+ *                              (BR/EDR or LE)
  *                  opportunistic: will not keep device connected if other apps
  *                      disconnect, will not update connected apps counter, when
  *                      disconnected won't cause physical disconnection.
  *
- * Returns          true if connection started; false if connection start failure.
+ * Returns          true if connection started; else false
  *
  ******************************************************************************/
 extern bool GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr,
@@ -1008,15 +1037,17 @@
  *
  * Function         GATT_CancelConnect
  *
- * Description      This function terminate the connection initaition to a remote
- *                  device on GATT channel.
+ * Description      Terminate the connection initiation to a remote device on a
+ *                  GATT channel.
  *
- * Parameters       gatt_if: client interface. If 0 used as unconditionally disconnect,
- *                          typically used for direct connection cancellation.
+ * Parameters       gatt_if: client interface. If 0 used as unconditionally
+ *                           disconnect, typically used for direct connection
+ *                           cancellation.
  *                  bd_addr: peer device address.
- *                  is_direct: is a direct conenection or a background auto connection
+ *                  is_direct: is a direct conenection or a background auto
+ *                             connection
  *
- * Returns          true if connection started; false if connection start failure.
+ * Returns          true if connection started; else false
  *
  ******************************************************************************/
 extern bool    GATT_CancelConnect (tGATT_IF gatt_if, BD_ADDR bd_addr,
@@ -1026,8 +1057,7 @@
  *
  * Function         GATT_Disconnect
  *
- * Description      This function disconnect the GATT channel for this registered
- *                  application.
+ * Description      Disconnect the GATT channel for this registered application.
  *
  * Parameters       conn_id: connection identifier.
  *
@@ -1042,13 +1072,14 @@
  *
  * Function         GATT_GetConnectionInfor
  *
- * Description      This function use conn_id to find its associated BD address and applciation
- *                  interface
+ * Description      Use conn_id to find its associated BD address and
+ *                  application interface
  *
  * Parameters        conn_id: connection id  (input)
  *                   p_gatt_if: applicaiton interface (output)
  *                   bd_addr: peer device address. (output)
- *                   transport :  physical transport of the GATT connection (BR/EDR or LE)
+ *                   transport : physical transport of the GATT connection
+ *                                (BR/EDR or LE)
  *
  * Returns          true the ligical link information is found for conn_id
  *
@@ -1061,13 +1092,14 @@
  *
  * Function         GATT_GetConnIdIfConnected
  *
- * Description      This function find the conn_id if the logical link for BD address
- *                  and applciation interface is connected
+ * Description      Find the conn_id if the logical link for a BD address
+ *                  and application interface is connected
  *
  * Parameters        gatt_if: applicaiton interface (input)
  *                   bd_addr: peer device address. (input)
  *                   p_conn_id: connection id  (output)
- *                   transport :  physical transport of the GATT connection (BR/EDR or LE)
+ *                   transport :  physical transport of the GATT connection
+ *                               (BR/EDR or LE)
  *
  * Returns          true the ligical link is connected
  *
diff --git a/stack/include/gattdefs.h b/stack/include/gattdefs.h
index 3edfa8b..4cd22f8 100644
--- a/stack/include/gattdefs.h
+++ b/stack/include/gattdefs.h
@@ -32,15 +32,23 @@
 #define GATT_UUID_PRI_SERVICE           0x2800
 #define GATT_UUID_SEC_SERVICE           0x2801
 #define GATT_UUID_INCLUDE_SERVICE       0x2802
-#define GATT_UUID_CHAR_DECLARE          0x2803      /*  Characteristic Declaration*/
+/*  Characteristic Declaration*/
+#define GATT_UUID_CHAR_DECLARE          0x2803
 
-#define GATT_UUID_CHAR_EXT_PROP         0x2900      /*	Characteristic Extended Properties */
-#define GATT_UUID_CHAR_DESCRIPTION      0x2901      /*  Characteristic User Description*/
-#define GATT_UUID_CHAR_CLIENT_CONFIG    0x2902      /*  Client Characteristic Configuration */
-#define GATT_UUID_CHAR_SRVR_CONFIG      0x2903      /*  Server Characteristic Configuration */
-#define GATT_UUID_CHAR_PRESENT_FORMAT   0x2904      /*  Characteristic Presentation Format*/
-#define GATT_UUID_CHAR_AGG_FORMAT       0x2905      /*  Characteristic Aggregate Format*/
-#define GATT_UUID_CHAR_VALID_RANGE       0x2906      /*  Characteristic Valid Range */
+/*	Characteristic Extended Properties */
+#define GATT_UUID_CHAR_EXT_PROP         0x2900
+/*  Characteristic User Description*/
+#define GATT_UUID_CHAR_DESCRIPTION      0x2901
+/*  Client Characteristic Configuration */
+#define GATT_UUID_CHAR_CLIENT_CONFIG    0x2902
+/*  Server Characteristic Configuration */
+#define GATT_UUID_CHAR_SRVR_CONFIG      0x2903
+/*  Characteristic Presentation Format*/
+#define GATT_UUID_CHAR_PRESENT_FORMAT   0x2904
+/*  Characteristic Aggregate Format*/
+#define GATT_UUID_CHAR_AGG_FORMAT       0x2905
+/*  Characteristic Valid Range */
+#define GATT_UUID_CHAR_VALID_RANGE       0x2906
 #define GATT_UUID_EXT_RPT_REF_DESCR     0x2907
 #define GATT_UUID_RPT_REF_DESCR         0x2908
 
diff --git a/stack/include/hcidefs.h b/stack/include/hcidefs.h
index f2d3a8d..1d48972 100644
--- a/stack/include/hcidefs.h
+++ b/stack/include/hcidefs.h
@@ -220,7 +220,8 @@
 #define HCI_WRITE_FLOW_CONTROL_MODE           (0x0067 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
 #define HCI_READ_BE_FLUSH_TOUT                (0x0069 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
 #define HCI_WRITE_BE_FLUSH_TOUT               (0x006A | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
-#define HCI_SHORT_RANGE_MODE                  (0x006B | HCI_GRP_HOST_CONT_BASEBAND_CMDS) /* 802.11 only */
+/* 802.11 only */
+#define HCI_SHORT_RANGE_MODE                  (0x006B | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
 #define HCI_READ_LE_HOST_SUPPORT              (0x006C | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
 #define HCI_WRITE_LE_HOST_SUPPORT             (0x006D | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
 
@@ -328,7 +329,7 @@
 #define HCI_BLE_LTK_REQ_REPLY           (0x001A | HCI_GRP_BLE_CMDS)
 #define HCI_BLE_LTK_REQ_NEG_REPLY       (0x001B | HCI_GRP_BLE_CMDS)
 #define HCI_BLE_READ_SUPPORTED_STATES   (0x001C | HCI_GRP_BLE_CMDS)
-                            /*0x001D, 0x001E and 0x001F are reserved*/
+                            /* 0x001D, 0x001E and 0x001F are reserved */
 #define HCI_BLE_RECEIVER_TEST           (0x001D | HCI_GRP_BLE_CMDS)
 #define HCI_BLE_TRANSMITTER_TEST        (0x001E | HCI_GRP_BLE_CMDS)
 /* BLE TEST COMMANDS */
@@ -381,7 +382,8 @@
 #define BTM_BLE_MULTI_ADV_ENB                           0x05
 
 /* multi adv VSE subcode */
-#define HCI_VSE_SUBCODE_BLE_MULTI_ADV_ST_CHG       0x55 /* multi adv instance state change */
+/* multi adv instance state change */
+#define HCI_VSE_SUBCODE_BLE_MULTI_ADV_ST_CHG       0x55
 
 /* subcode for batch scan feature */
 #define BTM_BLE_BATCH_SCAN_ENB_DISAB_CUST_FEATURE      0x01
@@ -415,7 +417,7 @@
 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_OFF           0
 #define HCI_LE_STATES_NON_CONN_ADV_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_NON_CONN_ADV_OFF] & HCI_SUPP_LE_STATES_NON_CONN_ADV_MASK)
 
-/*Scanneable Connectable Adv state  is supported. 0x0000000000000002 */
+/* Scanneable Connectable Adv state  is supported. 0x0000000000000002 */
 #define HCI_SUPP_LE_STATES_SCAN_ADV_MASK          0x02
 #define HCI_SUPP_LE_STATESSCAN_ADV_OFF           0
 #define HCI_LE_STATES_SCAN_ADV_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATESSCAN_ADV_OFF] & HCI_SUPP_LE_STATES_SCAN_ADV_MASK)
@@ -440,149 +442,170 @@
 #define HCI_SUPP_LE_STATES_ACTIVE_SCAN_OFF           0
 #define HCI_LE_STATES_ACTIVE_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_ACTIVE_SCAN_OFF] & HCI_SUPP_LE_STATES_ACTIVE_SCAN_MASK)
 
-/* Initiating state is supported. 0x0000000000000040 (or connection state in master role is also supported) */
+/* Initiating state is supported. 0x0000000000000040 (or connection state in
+ * master role is also supported) */
 #define HCI_SUPP_LE_STATES_INIT_MASK          0x40
 #define HCI_SUPP_LE_STATES_INIT_OFF           0
 #define HCI_LE_STATES_INIT_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_INIT_OFF] & HCI_SUPP_LE_STATES_INIT_MASK)
 
-/*connection state in slave  role is also supported. 0x0000000000000080 */
+/* connection state in slave  role is also supported. 0x0000000000000080 */
 #define HCI_SUPP_LE_STATES_SLAVE_MASK          0x80
 #define HCI_SUPP_LE_STATES_SLAVE_OFF           0
 #define HCI_LE_STATES_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_SLAVE_OFF] & HCI_SUPP_LE_STATES_SLAVE_MASK)
 
-/* Non Connectable Adv state and Passive Scanning State combination is supported. 0x0000000000000100 */
+/* Non Connectable Adv state and Passive Scanning State combination is
+ * supported. 0x0000000000000100 */
 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_PASS_SCAN_MASK          0x01
 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_PASS_SCAN_OFF           1
 #define HCI_LE_STATES_NON_CONN_ADV_PASS_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_NON_CONN_ADV_PASS_SCAN_OFF] & HCI_SUPP_LE_STATES_NON_CONN_ADV_PASS_SCAN_MASK)
 
-/*Scannable Adv state and Passive Scanning State combination is supported. 0x0000000000000200 */
+/* Scannable Adv state and Passive Scanning State combination is supported.
+ * 0x0000000000000200 */
 #define HCI_SUPP_LE_STATES_SCAN_ADV_PASS_SCAN_MASK          0x02
 #define HCI_SUPP_LE_STATES_SCAN_ADV_PASS_SCAN_OFF           1
 #define HCI_LE_STATES_SCAN_ADV_PASS_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_SCAN_ADV_PASS_SCAN_OFF] & HCI_SUPP_LE_STATES_SCAN_ADV_PASS_SCAN_MASK)
 
-/*Connectable Adv state and Passive Scanning State combination is supported. 0x0000000000000400 */
+/* Connectable Adv state and Passive Scanning State combination is supported.
+ * 0x0000000000000400 */
 #define HCI_SUPP_LE_STATES_CONN_ADV_PASS_SCAN_MASK          0x04
 #define HCI_SUPP_LE_STATES_CONN_ADV_PASS_SCAN_OFF           1
 #define HCI_LE_STATES_CONN_ADV_PASS_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_CONN_ADV_PASS_SCAN_OFF] & HCI_SUPP_LE_STATES_CONN_ADV_PASS_SCAN_MASK)
 
-/*High Duty Cycl Directed ADv and Passive Scanning State combination is supported. 0x0000000000000800 */
+/* High Duty Cycl Directed ADv and Passive Scanning State combination is
+ * supported. 0x0000000000000800 */
 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_PASS_SCAN_MASK          0x08
 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_PASS_SCAN_OFF           1
 #define HCI_LE_STATES_HI_DUTY_DIR_ADV_PASS_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_PASS_SCAN_MASK] & HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_PASS_SCAN_OFF)
 
-/*Non Connectable Adv state and Passive Scanning State combination is supported. 0x0000000000001000 */
+/* Non Connectable Adv state and Passive Scanning State combination is
+ * supported. 0x0000000000001000 */
 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_ACTIVE_SCAN_MASK          0x10
 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_ACTIVE_SCAN_OFF           1
 #define HCI_LE_STATES_NON_CONN_ADV_ACTIVE_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_NON_CONN_ADV_ACTIVE_SCAN_OFF] & HCI_SUPP_LE_STATES_NON_CONN_ADV_ACTIVE_SCAN_MASK)
 
-/*Scannable Adv state and Active Scanning State combination is supported. 0x0000000000002000 */
+/* Scannable Adv state and Active Scanning State combination is supported.
+ * 0x0000000000002000 */
 #define HCI_SUPP_LE_STATES_SCAN_ADV_ACTIVE_SCAN_MASK          0x20
 #define HCI_SUPP_LE_STATES_SCAN_ADV_ACTIVE_SCAN_OFF           1
 #define HCI_LE_STATES_SCAN_ADV_ACTIVE_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_SCAN_ADV_ACTIVE_SCAN_OFF] & HCI_SUPP_LE_STATES_SCAN_ADV_ACTIVE_SCAN_MASK)
 
-/*Connectable Adv state and Active Scanning State combination is supported. 0x0000000000004000 */
+/* Connectable Adv state and Active Scanning State combination is supported.
+ * 0x0000000000004000 */
 #define HCI_SUPP_LE_STATES_CONN_ADV_ACTIVE_SCAN_MASK          0x40
 #define HCI_SUPP_LE_STATES_CONN_ADV_ACTIVE_SCAN_OFF           1
 #define HCI_LE_STATES_CONN_ADV_ACTIVE_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_CONN_ADV_ACTIVE_SCAN_OFF] & HCI_SUPP_LE_STATES_CONN_ADV_ACTIVE_SCAN_MASK)
 
-/*High Duty Cycl Directed ADv and ACtive Scanning State combination is supported. 0x0000000000008000 */
+/* High Duty Cycl Directed ADv and ACtive Scanning State combination is
+ * supported. 0x0000000000008000 */
 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_ACTIVE_SCAN_MASK          0x80
 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_ACTIVE_SCAN_OFF           1
 #define HCI_LE_STATES_HI_DUTY_DIR_ADV_ACTIVE_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_ACTIVE_SCAN_MASK] & HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_ACTIVE_SCAN_OFF)
 
-/*Non-Connectable Adv state and Initiating State combination is supported. 0x0000000000010000 */
+/* Non-Connectable Adv state and Initiating State combination is supported.
+ * 0x0000000000010000 */
 #define HCI_SUPP_LE_STATES_NON_CONN_INIT_MASK          0x01
 #define HCI_SUPP_LE_STATES_NON_CONN_INIT_OFF           2
 #define HCI_LE_STATES_NON_CONN_INIT_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_NON_CONN_INIT_OFF] & HCI_SUPP_LE_STATES_NON_CONN_INIT_MASK)
 
-/* Scannable Adv state and Initiating State combination is supported. 0x0000000000020000 */
+/* Scannable Adv state and Initiating State combination is supported.
+ * 0x0000000000020000 */
 #define HCI_SUPP_LE_STATES_SCAN_ADV_INIT_MASK          0x02
 #define HCI_SUPP_LE_STATES_SCAN_ADV_INIT_OFF           2
 #define HCI_LE_STATES_SCAN_ADV_INIT_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_SCAN_ADV_INIT_OFF] & HCI_SUPP_LE_STATES_SCAN_ADV_INIT_MASK)
 
-/* Non-Connectable Adv state and Master Role combination is supported. 0x0000000000040000 */
+/* Non-Connectable Adv state and Master Role combination is supported.
+ * 0x0000000000040000 */
 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_MASTER_MASK          0x04
 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_MASTER_OFF           2
 #define HCI_LE_STATES_NON_CONN_ADV_MASTER_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_NON_CONN_ADV_MASTER_OFF] & HCI_SUPP_LE_STATES_NON_CONN_ADV_MASTER_MASK)
 
-/*Scannable Adv state and Master Role combination is supported. 0x0000000000040000 */
+/* Scannable Adv state and Master Role combination is supported.
+ * 0x0000000000040000 */
 #define HCI_SUPP_LE_STATES_SCAN_ADV_MASTER_MASK          0x08
 #define HCI_SUPP_LE_STATES_SCAN_ADV_MASTER_OFF           2
 #define HCI_LE_STATES_SCAN_ADV_MASTER_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_SCAN_ADV_MASTER_OFF] & HCI_SUPP_LE_STATES_SCAN_ADV_MASTER_MASK)
 
-/* Non-Connectable Adv and Slave Role combination is supported. 0x000000000100000 */
+/* Non-Connectable Adv and Slave Role combination is supported.
+ * 0x000000000100000 */
 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_SLAVE_MASK          0x10
 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_SLAVE_OFF           2
 #define HCI_LE_STATES_NON_CONN_ADV_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_NON_CONN_ADV_SLAVE_OFF] & HCI_SUPP_LE_STATES_NON_CONN_ADV_SLAVE_MASK)
 
-/*Scannable Adv and Slave Role combination is supported. 0x000000000200000 */
+/* Scannable Adv and Slave Role combination is supported. 0x000000000200000 */
 #define HCI_SUPP_LE_STATES_SCAN_ADV_SLAVE_MASK          0x20
 #define HCI_SUPP_LE_STATES_SCAN_ADV_SLAVE_OFF           2
 #define HCI_LE_STATES_SCAN_ADV_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_SCAN_ADV_SLAVE_OFF] & HCI_SUPP_LE_STATES_SCAN_ADV_SLAVE_MASK)
 
-/*Passive Scan and Initiating State combination is supported. 0x000000000400000 */
+/* Passive Scan and Initiating State combination is supported.
+ * 0x000000000400000 */
 #define HCI_SUPP_LE_STATES_PASS_SCAN_INIT_MASK          0x40
 #define HCI_SUPP_LE_STATES_PASS_SCAN_INIT_OFF           2
 #define HCI_LE_STATES_PASS_SCAN_INIT_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_PASS_SCAN_INIT_OFF] & HCI_SUPP_LE_STATES_PASS_SCAN_INIT_MASK)
 
-/*Active Scan and Initiating State combination is supported. 0x000000000800000 */
+/* Active Scan and Initiating State combination is supported.
+ * 0x000000000800000 */
 #define HCI_SUPP_LE_STATES_ACTIVE_SCAN_INIT_MASK          0x80
 #define HCI_SUPP_LE_STATES_ACTIVE_SCAN_INIT_OFF           2
 #define HCI_LE_STATES_ACTIVE_SCAN_INIT_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_ACTIVE_SCAN_INIT_OFF] & HCI_SUPP_LE_STATES_ACTIVE_SCAN_INIT_MASK)
 
-/*Passive Scan and Master Role combination is supported. 0x000000001000000 */
+/* Passive Scan and Master Role combination is supported. 0x000000001000000 */
 #define HCI_SUPP_LE_STATES_PASS_SCAN_MASTER_MASK          0x01
 #define HCI_SUPP_LE_STATES_PASS_SCAN_MASTER_OFF           3
 #define HCI_LE_STATES_PASS_SCAN_MASTER_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_PASS_SCAN_MASTER_OFF] & HCI_SUPP_LE_STATES_PASS_SCAN_MASTER_MASK)
 
-/*Active Scan and Master Role combination is supported. 0x000000002000000 */
+/* Active Scan and Master Role combination is supported. 0x000000002000000 */
 #define HCI_SUPP_LE_STATES_ACTIVE_SCAN_MASTER_MASK          0x02
 #define HCI_SUPP_LE_STATES_ACTIVE_SCAN_MASTER_OFF           3
 #define HCI_LE_STATES_ACTIVE_SCAN_MASTER_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_ACTIVE_SCAN_MASTER_OFF] & HCI_SUPP_LE_STATES_ACTIVE_SCAN_MASTER_MASK)
 
-/*Passive Scan and Slave Role combination is supported. 0x000000004000000 */
+/* Passive Scan and Slave Role combination is supported. 0x000000004000000 */
 #define HCI_SUPP_LE_STATES_PASS_SCAN_SLAVE_MASK          0x04
 #define HCI_SUPP_LE_STATES_PASS_SCAN_SLAVE_OFF           3
 #define HCI_LE_STATES_PASS_SCAN_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_PASS_SCAN_SLAVE_OFF] & HCI_SUPP_LE_STATES_PASS_SCAN_SLAVE_MASK)
 
-/*Active Scan and Slave Role combination is supported. 0x000000008000000 */
+/* Active Scan and Slave Role combination is supported. 0x000000008000000 */
 #define HCI_SUPP_LE_STATES_ACTIVE_SCAN_SLAVE_MASK          0x08
 #define HCI_SUPP_LE_STATES_ACTIVE_SCAN_SLAVE_OFF           3
 #define HCI_LE_STATES_ACTIVE_SCAN_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_ACTIVE_SCAN_SLAVE_OFF] & HCI_SUPP_LE_STATES_ACTIVE_SCAN_SLAVE_MASK)
 
-/*Link Layer Topology Added States Combo */
-/*Initiating State and Master Role combination supported.
+/* Link Layer Topology Added States Combo */
+/* Initiating State and Master Role combination supported.
   Master Role and Master Role combination is also supported. 0x0000000010000000 */
 #define HCI_SUPP_LE_STATES_INIT_MASTER_MASK          0x10
 #define HCI_SUPP_LE_STATES_INIT_MASTER_OFF           3
 #define HCI_LE_STATES_INIT_MASTER_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_INIT_MASTER_OFF] & HCI_SUPP_LE_STATES_INIT_MASTER_MASK)
 
-/*Low Duty Cycle Directed Advertising State . 0x0000000020000000 */
+/* Low Duty Cycle Directed Advertising State . 0x0000000020000000 */
 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_MASK          0x20
 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_OFF           3
 #define HCI_LE_STATES_LOW_DUTY_DIR_ADV_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_LOW_DUTY_DIR_ADV_OFF] & HCI_SUPP_LE_STATES_LOW_DUTY_DIR_ADV_MASK)
 
-/*Low Duty Cycle Directed Advertising State and Passive scan combination. 0x0000000040000000 */
+/* Low Duty Cycle Directed Advertising State and Passive scan combination.
+ * 0x0000000040000000 */
 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_PASS_SCAN_MASK          0x40
 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_PASS_SCAN_OFF           3
 #define HCI_LE_STATES_LO_DUTY_DIR_ADV_PASS_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_PASS_SCAN_OFF] & HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_PASS_SCAN_MASK)
 
-/*Low Duty Cycle Directed Advertising State and Active scan combination . 0x0000000080000000 */
+/* Low Duty Cycle Directed Advertising State and Active scan combination.
+ * 0x0000000080000000 */
 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_ACTIVE_SCAN_MASK          0x80
 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_ACTIVE_SCAN_OFF           3
 #define HCI_LE_STATES_LO_DUTY_DIR_ADV_ACTIVE_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_ACTIVE_SCAN_OFF] & HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_ACTIVE_SCAN_MASK)
 
-/* Connectable Advertising State and Initiating State combination supported. 0x0000000100000000 */
+/* Connectable Advertising State and Initiating State combination supported.
+ * 0x0000000100000000 */
 #define HCI_SUPP_LE_STATES_CONN_ADV_INIT_MASK          0x01
 #define HCI_SUPP_LE_STATES_CONN_ADV_INIT_OFF           4
 #define HCI_LE_STATES_CONN_ADV_INIT_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_CONN_ADV_INIT_OFF] & HCI_SUPP_LE_STATES_CONN_ADV_INIT_MASK)
 
-/* High Duty Cycle Directed Advertising State and Initiating State combination supported. */
+/* High Duty Cycle Directed Advertising State and Initiating State combination
+ * supported. */
 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_INIT_MASK          0x02
 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_INIT_OFF           4
 #define HCI_LE_STATES_HI_DUTY_DIR_ADV_INIT_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_INIT_OFF] & HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_INIT_MASK)
 
-/* Low Duty Cycle Directed Advertising State and Initiating State combination supported.*/
+/* Low Duty Cycle Directed Advertising State and Initiating State combination
+ * supported.*/
 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_INIT_MASK          0x04
 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_INIT_OFF           4
 #define HCI_LE_STATES_LO_DUTY_DIR_ADV_INIT_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_INIT_OFF] & HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_INIT_MASK)
@@ -592,12 +615,14 @@
 #define HCI_SUPP_LE_STATES_CONN_ADV_MASTER_OFF           4
 #define HCI_LE_STATES_CONN_ADV_MASTER_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_CONN_ADV_MASTER_OFF] & HCI_SUPP_LE_STATES_CONN_ADV_MASTER_MASK)
 
-/* High Duty Cycle Directed Advertising State and Master Role combination supported.*/
+/* High Duty Cycle Directed Advertising State and Master Role combination
+ * supported.*/
 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_MASTER_MASK          0x10
 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_MASTER_OFF           4
 #define HCI_LE_STATES_HI_DUTY_DIR_ADV_MASTER_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_MASTER_OFF] & HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_MASTER_MASK)
 
-/* Low Duty Cycle Directed Advertising State and Master Role combination supported.*/
+/* Low Duty Cycle Directed Advertising State and Master Role combination
+ * supported.*/
 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_MASTER_MASK          0x20
 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_MASTER_OFF           4
 #define HCI_LE_STATES_LO_DUTY_DIR_ADV_MASTER_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_MASTER_OFF] & HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_MASTER_MASK)
@@ -607,12 +632,14 @@
 #define HCI_SUPP_LE_STATES_CONN_ADV_SLAVE_OFF           4
 #define HCI_LE_STATES_CONN_ADV_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_CONN_ADV_SLAVE_OFF] & HCI_SUPP_LE_STATES_CONN_ADV_SLAVE_MASK)
 
-/* High Duty Cycle Directed Advertising State and slave Role combination supported.*/
+/* High Duty Cycle Directed Advertising State and slave Role combination
+ * supported.*/
 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_SLAVE_MASK          0x80
 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_SLAVE_OFF           4
 #define HCI_LE_STATES_HI_DUTY_DIR_ADV_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_SLAVE_OFF] & HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_SLAVE_MASK)
 
-/* Low Duty Cycle Directed Advertising State and slave Role combination supported.*/
+/* Low Duty Cycle Directed Advertising State and slave Role combination
+ * supported.*/
 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_SLAVE_MASK          0x01
 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_SLAVE_OFF           5
 #define HCI_LE_STATES_LO_DUTY_DIR_ADV_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_SLAVE_OFF] & HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_SLAVE_MASK)
@@ -962,11 +989,12 @@
 #define HCI_ESCO_PKT_TYPES_MASK_NO_2_EV5    0x0100
 #define HCI_ESCO_PKT_TYPES_MASK_NO_3_EV5    0x0200
 
-/* Packet type should be one of valid but at least one should be specified for 1.2 */
+/* Packet type should be one of valid but at least one should be specified for
+ * 1.2 */
 #define HCI_VALID_ESCO_PKT_TYPE(t) (((((t) & ~(HCI_ESCO_PKT_TYPES_MASK_EV3       \
                                            |   HCI_ESCO_PKT_TYPES_MASK_EV4       \
                                            |   HCI_ESCO_PKT_TYPES_MASK_EV5)) == 0)) \
-                                    && ((t) != 0))/* Packet type should be one of valid but at least one should be specified */
+                                    && ((t) != 0))
 
 #define HCI_VALID_ESCO_SCOPKT_TYPE(t) (((((t) & ~(HCI_ESCO_PKT_TYPES_MASK_HV1       \
                                            |      HCI_ESCO_PKT_TYPES_MASK_HV2       \
@@ -1142,8 +1170,10 @@
 #define HCI_FILTER_COND_BD_ADDR         0x02
 
 #define HCI_DO_NOT_AUTO_ACCEPT_CONNECT  1
-#define HCI_DO_AUTO_ACCEPT_CONNECT      2   /* role switch disabled */
-#define HCI_DO_AUTO_ACCEPT_CONNECT_RS   3   /* role switch enabled (1.1 errata 1115) */
+/* role switch disabled */
+#define HCI_DO_AUTO_ACCEPT_CONNECT      2
+/* role switch enabled (1.1 errata 1115) */
+#define HCI_DO_AUTO_ACCEPT_CONNECT_RS   3
 
 /* Auto accept flags */
 #define HCI_AUTO_ACCEPT_OFF             0x00
@@ -1669,7 +1699,8 @@
 #define HCI_FEATURE_NON_FLUSHABLE_PB_MASK      0x40
 #define HCI_FEATURE_NON_FLUSHABLE_PB_OFF       6
 
-/* This feature is causing frequent link drops when doing call switch with certain av/hfp headsets */
+/* This feature is causing frequent link drops when doing call switch with
+ * certain av/hfp headsets */
 #define HCI_NON_FLUSHABLE_PB_SUPPORTED(x)      (0)//((x)[HCI_FEATURE_NON_FLUSHABLE_PB_OFF] & HCI_FEATURE_NON_FLUSHABLE_PB_MASK)
 
 #define HCI_FEATURE_LINK_SUP_TO_EVT_MASK 0x01
diff --git a/stack/include/hcimsgs.h b/stack/include/hcimsgs.h
index ec99c74..5322222 100644
--- a/stack/include/hcimsgs.h
+++ b/stack/include/hcimsgs.h
@@ -640,7 +640,8 @@
 
 /*******************************************************************************
  * BLE Commands
- *      Note: "local_controller_id" is for transport, not counted in HCI message size
+ *      Note: "local_controller_id" is for transport, not counted in HCI
+ *             message size
  ******************************************************************************/
 #define HCIC_BLE_RAND_DI_SIZE                   8
 #define HCIC_BLE_ENCRYT_KEY_SIZE                16
diff --git a/stack/include/hidh_api.h b/stack/include/hidh_api.h
index b906be7..83bee77 100644
--- a/stack/include/hidh_api.h
+++ b/stack/include/hidh_api.h
@@ -56,17 +56,23 @@
 typedef void (tHID_HOST_SDP_CALLBACK) (uint16_t result, uint16_t attr_mask,
                                        tHID_DEV_SDP_INFO *sdp_rec );
 
-/* HID-HOST returns the events in the following table to the application via tHID_HOST_DEV_CALLBACK
-HID_HDEV_EVT_OPEN   Connected to device with Interrupt and Control Channels in OPEN state.
-                                                        Data = NA
-HID_HDEV_EVT_CLOSE  Connection with device is closed.   Data=reason code.
-HID_HDEV_EVT_RETRYING   Lost connection is being re-connected.
-                                                        Data=Retrial number
-HID_HDEV_EVT_IN_REPORT  Device sent an input report     Data=Report Type pdata= pointer to BT_HDR
-                                                        (GKI buffer having report data.)
-HID_HDEV_EVT_HANDSHAKE  Device sent SET_REPORT          Data=Result-code pdata=NA.
-HID_HDEV_EVT_VC_UNPLUG  Device sent Virtual Unplug      Data=NA. pdata=NA.
-*/
+/* HID-HOST returns the events in the following table to the application via
+ * tHID_HOST_DEV_CALLBACK
+ * HID_HDEV_EVT_OPEN  Connected to device with Interrupt and Control Channels
+ *                    in OPEN state.
+ *                                                      Data = NA
+ * HID_HDEV_EVT_CLOSE Connection with device is closed. Data = reason code.
+ * HID_HDEV_EVT_RETRYING   Lost connection is being re-connected.
+ *                                                      Data = Retrial number
+ * HID_HDEV_EVT_IN_REPORT  Device sent an input report  Data = Report Type
+ *                                                      pdata = pointer to
+ *                                                              BT_HDR
+ *                                                      (GKI buffer with report
+ *                                                       data.)
+ * HID_HDEV_EVT_HANDSHAKE  Device sent SET_REPORT       Data = Result-code
+ *                                                      pdata = NA.
+ * HID_HDEV_EVT_VC_UNPLUG  Device sent Virtual Unplug   Data = NA. pdata = NA.
+ */
 
 enum
 {
@@ -143,7 +149,8 @@
  *
  * Function         HID_HostRemoveDev
  *
- * Description      This removes the device from list devices that host has to manage.
+ * Description      Removes the device from the list of devices that the host
+ *                  has to manage.
  *
  * Returns          tHID_STATUS
  *
@@ -189,7 +196,7 @@
 /*******************************************************************************
  * Function         HID_HostInit
  *
- * Description      This function initializes the control block and trace variable
+ * Description      Initialize the control block and trace variable
  *
  * Returns          void
  ******************************************************************************/
@@ -221,8 +228,8 @@
  *
  * Function         HID_HostSetTraceLevel
  *
- * Description      This function sets the trace level for HID Host. If called with
- *                  a value of 0xFF, it simply reads the current trace level.
+ * Description      Set the trace level for HID Host. If called with the value
+ *                  0xFF, it simply reads the current trace level.
  *
  * Returns          the new (current) trace level
  *
diff --git a/stack/include/l2c_api.h b/stack/include/l2c_api.h
index 086fb98..a2ba8aa 100644
--- a/stack/include/l2c_api.h
+++ b/stack/include/l2c_api.h
@@ -99,7 +99,8 @@
 #define L2CAP_MULTI_AV_PADDING_LEN  2
 
 /* length of the HCI header block with padding for FCR */
-/* HCI header(4) + SNK count(1) + FCR bits(1) + AV data length(2) + padding(2) */
+/* HCI header(4) + SNK count(1) + FCR bits(1) + AV data length(2) + padding(2)
+ */
 #define L2CAP_MULTI_AV_HCI_HDR_LEN_WITH_PADDING	10
 
 /* length of the L2CAP header block */
@@ -109,8 +110,10 @@
 /* definition used for L2CA_SetDesireRole */
 #define L2CAP_ROLE_SLAVE            HCI_ROLE_SLAVE
 #define L2CAP_ROLE_MASTER           HCI_ROLE_MASTER
-#define L2CAP_ROLE_ALLOW_SWITCH     0x80    /* set this bit to allow switch at create conn */
-#define L2CAP_ROLE_DISALLOW_SWITCH  0x40    /* set this bit to disallow switch at create conn */
+/* set this bit to allow switch at create conn */
+#define L2CAP_ROLE_ALLOW_SWITCH     0x80
+/* set this bit to disallow switch at create conn */
+#define L2CAP_ROLE_DISALLOW_SWITCH  0x40
 #define L2CAP_ROLE_CHECK_SWITCH     0xC0
 
 
@@ -172,8 +175,8 @@
     uint16_t    flags;                  /* bit 0: 0-no continuation, 1-continuation */
 } tL2CAP_CFG_INFO;
 
-/* Define a structure to hold the configuration parameter for LE L2CAP connection
- * oriented channels.
+/* Define a structure to hold the configuration parameter for LE L2CAP
+ * connection oriented channels.
 */
 typedef struct
 {
@@ -384,8 +387,8 @@
  *
  * Function         L2CA_AllocatePSM
  *
- * Description      Other layers call this function to find an unused PSM for L2CAP
- *                  services.
+ * Description      Other layers call this function to find an unused PSM for
+ *                  L2CAP services.
  *
  * Returns          PSM to use.
  *
@@ -396,9 +399,10 @@
  *
  * Function         L2CA_ConnectReq
  *
- * Description      Higher layers call this function to create an L2CAP connection.
- *                  Note that the connection is not established at this time, but
- *                  connection establishment gets started. The callback function
+ * Description      Higher layers call this function to create an L2CAP
+ *                  connection.
+ *                  Note that the connection is not established at this time,
+ *                  but connection establishment gets started. The callback
  *                  will be invoked when connection establishes or fails.
  *
  * Returns          the CID of the connection, or 0 if it failed to start
@@ -424,10 +428,10 @@
  *
  * Function         L2CA_ErtmConnectReq
  *
- * Description      Higher layers call this function to create an L2CAP connection
- *                  that needs to use Enhanced Retransmission Mode.
- *                  Note that the connection is not established at this time, but
- *                  connection establishment gets started. The callback function
+ * Description      Higher layers call this function to create an L2CAP
+ *                  connection that needs to use Enhanced Retransmission Mode.
+ *                  Note that the connection is not established at this time,
+ *                  but connection establishment gets started. The callback
  *                  will be invoked when connection establishes or fails.
  *
  * Returns          the CID of the connection, or 0 if it failed to start
@@ -469,8 +473,8 @@
  * Function         L2CA_ConnectLECocReq
  *
  * Description      Higher layers call this function to create an L2CAP LE COC.
- *                  Note that the connection is not established at this time, but
- *                  connection establishment gets started. The callback function
+ *                  Note that the connection is not established at this time,
+ *                  but connection establishment gets started. The callback
  *                  will be invoked when connection establishes or fails.
  *
  * Returns          the CID of the connection, or 0 if it failed to start
@@ -483,7 +487,7 @@
  * Function         L2CA_ConnectLECocRsp
  *
  * Description      Higher layers call this function to accept an incoming
- *                  L2CAP LE COC connection, for which they had gotten an connect
+ *                  L2CAP LE COC connection, for which they had gotten a connect
  *                  indication callback.
  *
  * Returns          true for success, false for failure
@@ -503,11 +507,11 @@
  ******************************************************************************/
 extern bool    L2CA_GetPeerLECocConfig (uint16_t lcid, tL2CAP_LE_CFG_INFO* peer_cfg);
 
-// This function sets the callback routines for the L2CAP connection referred to by
-// |local_cid|. The callback routines can only be modified for outgoing connections
-// established by |L2CA_ConnectReq| or accepted incoming connections. |callbacks|
-// must not be NULL. This function returns true if the callbacks could be updated,
-// false if not (e.g. |local_cid| was not found).
+// This function sets the callback routines for the L2CAP connection referred to
+// by |local_cid|. The callback routines can only be modified for outgoing
+// connections established by |L2CA_ConnectReq| or accepted incoming
+// connections. |callbacks| must not be NULL. This function returns true if the
+// callbacks could be updated, false if not (e.g. |local_cid| was not found).
 bool L2CA_SetConnectionCallbacks(uint16_t local_cid, const tL2CAP_APPL_INFO *callbacks);
 
 /*******************************************************************************
@@ -579,7 +583,8 @@
  * Description      Higher layers call this function to write data.
  *
  * Returns          L2CAP_DW_SUCCESS, if data accepted, else false
- *                  L2CAP_DW_CONGESTED, if data accepted and the channel is congested
+ *                  L2CAP_DW_CONGESTED, if data accepted and the channel is
+ *                                      congested
  *                  L2CAP_DW_FAILED, if error
  *
  ******************************************************************************/
@@ -608,10 +613,11 @@
  ******************************************************************************/
 extern bool     L2CA_Echo (BD_ADDR p_bd_addr, BT_HDR *p_data, tL2CA_ECHO_DATA_CB *p_callback);
 
-// Given a local channel identifier, |lcid|, this function returns the bound remote
-// channel identifier, |rcid|, and the ACL link handle, |handle|. If |lcid| is not
-// known or is invalid, this function returns false and does not modify the values
-// pointed at by |rcid| and |handle|. |rcid| and |handle| may be NULL.
+// Given a local channel identifier, |lcid|, this function returns the bound
+// remote channel identifier, |rcid|, and the ACL link handle, |handle|. If
+// |lcid| is not known or is invalid, this function returns false and does not
+// modify the values pointed at by |rcid| and |handle|. |rcid| and |handle| may
+// be NULL.
 bool L2CA_GetIdentifiers(uint16_t lcid, uint16_t *rcid, uint16_t *handle);
 
 /*******************************************************************************
@@ -619,12 +625,12 @@
  * Function         L2CA_SetIdleTimeout
  *
  * Description      Higher layers call this function to set the idle timeout for
- *                  a connection, or for all future connections. The "idle timeout"
- *                  is the amount of time that a connection can remain up with
- *                  no L2CAP channels on it. A timeout of zero means that the
- *                  connection will be torn down immediately when the last channel
- *                  is removed. A timeout of 0xFFFF means no timeout. Values are
- *                  in seconds.
+ *                  a connection, or for all future connections. The "idle
+ *                  timeout" is the amount of time that a connection can remain
+ *                  up with no L2CAP channels on it. A timeout of zero means
+ *                  that the connection will be torn down immediately when the
+ *                  last channel is removed. A timeout of 0xFFFF means no
+ *                  timeout. Values are in seconds.
  *
  * Returns          true if command succeeded, false if failed
  *
@@ -673,11 +679,12 @@
  * Description  This function sets the desire role for L2CAP.
  *              If the new role is L2CAP_ROLE_ALLOW_SWITCH, allow switch on
  *              HciCreateConnection.
- *              If the new role is L2CAP_ROLE_DISALLOW_SWITCH, do not allow switch on
- *              HciCreateConnection.
+ *              If the new role is L2CAP_ROLE_DISALLOW_SWITCH, do not allow
+ *              switch on HciCreateConnection.
  *
- *              If the new role is a valid role (HCI_ROLE_MASTER or HCI_ROLE_SLAVE),
- *              the desire role is set to the new value. Otherwise, it is not changed.
+ *              If the new role is a valid role (HCI_ROLE_MASTER or
+ *              HCI_ROLE_SLAVE), the desire role is set to the new value.
+ *              Otherwise, it is not changed.
  *
  * Returns      the new (current) role
  *
@@ -794,20 +801,23 @@
  *
  * Description      This function set the automatic flush time out in Baseband
  *                  for ACL-U packets.
- *                  BdAddr : the remote BD address of ACL link. If it is BT_DB_ANY
- *                           then the flush time out will be applied to all ACL link.
+ *                  BdAddr : the remote BD address of ACL link. If it is
+ *                           BT_DB_ANY then the flush time out will be applied
+ *                           to all ACL link.
  *                  FlushTimeout: flush time out in ms
  *                           0x0000 : No automatic flush
  *                           L2CAP_NO_RETRANSMISSION : No retransmission
- *                           0x0002 - 0xFFFE : flush time out, if (flush_tout*8)+3/5)
- *                                    <= HCI_MAX_AUTO_FLUSH_TOUT (in 625us slot).
+ *                           0x0002 - 0xFFFE : flush time out, if
+ *                                             (flush_tout * 8) + 3 / 5)
+ *                                               <= HCI_MAX_AUTO_FLUSH_TOUT
+ *                                             (in 625us slot).
  *                                    Otherwise, return false.
  *                           L2CAP_NO_AUTOMATIC_FLUSH : No automatic flush
  *
  * Returns          true if command succeeded, false if failed
  *
- * NOTE             This flush timeout applies to all logical channels active on the
- *                  ACL link.
+ * NOTE             This flush timeout applies to all logical channels active on
+ *                  the ACL link.
  ******************************************************************************/
 extern bool    L2CA_SetFlushTimeout (BD_ADDR bd_addr, uint16_t flush_tout);
 
@@ -822,7 +832,8 @@
  *                          L2CAP_NON_FLUSHABLE_PKT
  *
  * Returns          L2CAP_DW_SUCCESS, if data accepted, else false
- *                  L2CAP_DW_CONGESTED, if data accepted and the channel is congested
+ *                  L2CAP_DW_CONGESTED, if data accepted and the channel is
+ *                                      congested
  *                  L2CAP_DW_FAILED, if error
  *
  ******************************************************************************/
@@ -1118,9 +1129,9 @@
  * Function         L2CA_SetFixedChannelTout
  *
  * Description      Higher layers call this function to set the idle timeout for
- *                  a fixed channel. The "idle timeout" is the amount of time that
- *                  a connection can remain up with no L2CAP channels on it.
- *                  A timeout of zero means that the connection will be torn
+ *                  a fixed channel. The "idle timeout" is the amount of time
+ *                  that a connection can remain up with no L2CAP channels on
+ *                  it. A timeout of zero means that the connection will be torn
  *                  down immediately when the last channel is removed.
  *                  A timeout of 0xFFFF means no timeout. Values are in seconds.
  *                  A bd_addr is the remote BD address. If bd_addr = BT_BD_ANY,
@@ -1222,7 +1233,7 @@
  * Description      This function returns the disconnect reason code.
  *
  *  Parameters:     BD Address of remote
- *                         Physical transport for the L2CAP connection (BR/EDR or LE)
+ *                  Physical transport for the L2CAP connection (BR/EDR or LE)
  *
  * Returns          disconnect reason
  *
diff --git a/stack/include/l2cap_client.h b/stack/include/l2cap_client.h
index b995d5e..22644a4 100644
--- a/stack/include/l2cap_client.h
+++ b/stack/include/l2cap_client.h
@@ -38,37 +38,39 @@
 // when it is no longer needed.
 buffer_t *l2cap_buffer_new(size_t size);
 
-// Creates and returns a new L2CAP client object. |callbacks| must not be NULL and
-// must specify a set of functions that should be called back when events occur
-// on the L2CAP connection. |context| may be NULL and will be passed as the argument
-// to all callbacks in |l2cap_client_callbacks_t|. The returned object must be freed
-// with |l2cap_client_free|.
+// Creates and returns a new L2CAP client object. |callbacks| must not be NULL
+// and must specify a set of functions that should be called back when events
+// occur on the L2CAP connection. |context| may be NULL and will be passed as
+// the argument to all callbacks in |l2cap_client_callbacks_t|. The returned
+// object must be freed with |l2cap_client_free|.
 l2cap_client_t *l2cap_client_new(const l2cap_client_callbacks_t *callbacks, void *context);
 
 // Frees the L2CAP client object allocated with |l2cap_client_new|. |client| may be NULL.
 void l2cap_client_free(l2cap_client_t *client);
 
-// Attempts to connect the |client| to a peer device specified by |remote_bdaddr|
-// using the |psm| protocol specifier. This function returns true if the connect
-// operation could be started and will indicate completion with either a 'connected'
-// callback (success) or a 'disconnected' callback (failure).
+// Attempts to connect the |client| to a peer device specified by
+// |remote_bdaddr| using the |psm| protocol specifier. This function returns
+// true if the connect operation could be started and will indicate completion
+// with either a 'connected' callback (success) or a 'disconnected' callback
+// (failure).
 //
 // This function must not be called while a connect operation is in progress or
-// while |l2cap_client_is_connected|. |client| and |remote_bdaddr| must not be NULL.
-// |psm| must be greater than zero.
+// while |l2cap_client_is_connected|. |client| and |remote_bdaddr| must not be
+// NULL. |psm| must be greater than zero.
 bool l2cap_client_connect(l2cap_client_t *client, const bt_bdaddr_t *remote_bdaddr, uint16_t psm);
 
-// Disconnects a connected |client|. This function is asynchronous and idempotent. It
-// will indicate completion with a 'disconnected' callback. |client| must not be NULL.
+// Disconnects a connected |client|. This function is asynchronous and
+// idempotent. It will indicate completion with a 'disconnected' callback.
+// |client| must not be NULL.
 void l2cap_client_disconnect(l2cap_client_t *client);
 
-// Returns true if |client| is connected and is ready to accept data written to it.
-// |client| must not be NULL.
+// Returns true if |client| is connected and is ready to accept data written
+// to it. |client| must not be NULL.
 bool l2cap_client_is_connected(const l2cap_client_t *client);
 
-// Writes data contained in |packet| to a connected |client|. This function returns
-// true if the packet was successfully queued for delivery, false if the client cannot
-// accept more data at this time. If this function returns false, the caller must wait
-// for the 'write_ready' callback to write additional data to the client. Neither
-// |client| nor |packet| may be NULL.
+// Writes data contained in |packet| to a connected |client|. This function
+// returns true if the packet was successfully queued for delivery, false if the
+// client cannot accept more data at this time. If this function returns false,
+// the caller must wait for the 'write_ready' callback to write additional data
+// to the client. Neither |client| nor |packet| may be NULL.
 bool l2cap_client_write(l2cap_client_t *client, buffer_t *packet);
diff --git a/stack/include/l2cdefs.h b/stack/include/l2cdefs.h
index 4037dc7..5c3899e 100644
--- a/stack/include/l2cdefs.h
+++ b/stack/include/l2cdefs.h
@@ -46,33 +46,57 @@
 
 /* Define some packet and header lengths
 */
-#define L2CAP_PKT_OVERHEAD      4           /* Length and CID                       */
-#define L2CAP_CMD_OVERHEAD      4           /* Cmd code, Id and length              */
-#define L2CAP_CMD_REJECT_LEN    2           /* Reason (data is optional)            */
-#define L2CAP_CONN_REQ_LEN      4           /* PSM and source CID                   */
-#define L2CAP_CONN_RSP_LEN      8           /* Dest CID, source CID, reason, status */
-#define L2CAP_CONFIG_REQ_LEN    4           /* Dest CID, flags (data is optional)   */
-#define L2CAP_CONFIG_RSP_LEN    6           /* Dest CID, flags, result,data optional*/
-#define L2CAP_DISC_REQ_LEN      4           /* Dest CID, source CID                 */
-#define L2CAP_DISC_RSP_LEN      4           /* Dest CID, source CID                 */
-#define L2CAP_ECHO_REQ_LEN      0           /* Data is optional                     */
-#define L2CAP_ECHO_RSP_LEN      0           /* Data is optional                     */
-#define L2CAP_INFO_REQ_LEN      2           /* Info type                            */
-#define L2CAP_INFO_RSP_LEN      4           /* Info type, result (data is optional) */
-#define L2CAP_UCD_OVERHEAD      2           /* Additional connectionless packet overhead */
+/* Length and CID                       */
+#define L2CAP_PKT_OVERHEAD      4
+/* Cmd code, Id and length              */
+#define L2CAP_CMD_OVERHEAD      4
+/* Reason (data is optional)            */
+#define L2CAP_CMD_REJECT_LEN    2
+/* PSM and source CID                   */
+#define L2CAP_CONN_REQ_LEN      4
+/* Dest CID, source CID, reason, status */
+#define L2CAP_CONN_RSP_LEN      8
+/* Dest CID, flags (data is optional)   */
+#define L2CAP_CONFIG_REQ_LEN    4
+/* Dest CID, flags, result,data optional*/
+#define L2CAP_CONFIG_RSP_LEN    6
+/* Dest CID, source CID                 */
+#define L2CAP_DISC_REQ_LEN      4
+/* Dest CID, source CID                 */
+#define L2CAP_DISC_RSP_LEN      4
+/* Data is optional                     */
+#define L2CAP_ECHO_REQ_LEN      0
+/* Data is optional                     */
+#define L2CAP_ECHO_RSP_LEN      0
+/* Info type                            */
+#define L2CAP_INFO_REQ_LEN      2
+/* Info type, result (data is optional) */
+#define L2CAP_INFO_RSP_LEN      4
+/* Additional connectionless packet overhead */
+#define L2CAP_UCD_OVERHEAD      2
 
-#define L2CAP_AMP_CONN_REQ_LEN  5           /* PSM, CID, and remote controller ID   */
-#define L2CAP_AMP_MOVE_REQ_LEN  3           /* CID and remote controller ID         */
-#define L2CAP_AMP_MOVE_RSP_LEN  4           /* CID and result                       */
-#define L2CAP_AMP_MOVE_CFM_LEN  4           /* CID and result                       */
-#define L2CAP_AMP_MOVE_CFM_RSP_LEN  2       /* CID                                  */
+/* PSM, CID, and remote controller ID   */
+#define L2CAP_AMP_CONN_REQ_LEN  5
+/* CID and remote controller ID         */
+#define L2CAP_AMP_MOVE_REQ_LEN  3
+/* CID and result                       */
+#define L2CAP_AMP_MOVE_RSP_LEN  4
+/* CID and result                       */
+#define L2CAP_AMP_MOVE_CFM_LEN  4
+/* CID                                  */
+#define L2CAP_AMP_MOVE_CFM_RSP_LEN  2
 
-#define L2CAP_CMD_BLE_UPD_REQ_LEN   8       /* Min and max interval, latency, tout  */
-#define L2CAP_CMD_BLE_UPD_RSP_LEN   2       /* Result                               */
+/* Min and max interval, latency, tout  */
+#define L2CAP_CMD_BLE_UPD_REQ_LEN   8
+/* Result                               */
+#define L2CAP_CMD_BLE_UPD_RSP_LEN   2
 
-#define L2CAP_CMD_BLE_CREDIT_BASED_CONN_REQ_LEN 10 /* LE_PSM, SCID, MTU, MPS, Init Credit */
-#define L2CAP_CMD_BLE_CREDIT_BASED_CONN_RES_LEN 10 /* DCID, MTU, MPS, Init credit, Result */
-#define L2CAP_CMD_BLE_FLOW_CTRL_CREDIT_LEN      4  /* CID, Credit */
+/* LE_PSM, SCID, MTU, MPS, Init Credit */
+#define L2CAP_CMD_BLE_CREDIT_BASED_CONN_REQ_LEN 10
+/* DCID, MTU, MPS, Init credit, Result */
+#define L2CAP_CMD_BLE_CREDIT_BASED_CONN_RES_LEN 10
+/* CID, Credit */
+#define L2CAP_CMD_BLE_FLOW_CTRL_CREDIT_LEN      4
 
 /* Define the packet boundary flags
 */
@@ -80,7 +104,7 @@
 #define L2CAP_PKT_START_FLUSHABLE       2
 #define L2CAP_PKT_START_NON_FLUSHABLE   0
 #endif
-#define L2CAP_COMPLETE_AMP_PKT          3       /* complete L2CAP packet on AMP HCI */
+#define L2CAP_COMPLETE_AMP_PKT          3 /* complete L2CAP packet on AMP HCI */
 #define L2CAP_PKT_START                 2
 #define L2CAP_PKT_CONTINUE              1
 #define L2CAP_MASK_FLAG            0x0FFF
@@ -98,7 +122,8 @@
 #define L2CAP_CONN_BAD_CTLR_ID       5              /* AMP related */
 #define L2CAP_CONN_TIMEOUT           0xEEEE
 #define L2CAP_CONN_AMP_FAILED        254
-#define L2CAP_CONN_NO_LINK           255        /* Add a couple of our own for internal use */
+/* Add a couple of our own for internal use */
+#define L2CAP_CONN_NO_LINK           255
 #define L2CAP_CONN_CANCEL            256        /* L2CAP connection cancelled */
 
 /* Define the LE L2CAP connection result codes
@@ -110,7 +135,8 @@
 #define L2CAP_LE_INSUFFICIENT_AUTHORIZATION     6
 #define L2CAP_LE_INSUFFICIENT_ENCRYP_KEY_SIZE   7
 #define L2CAP_LE_INSUFFICIENT_ENCRYP            8
-#define L2CAP_LE_INVALID_SOURCE_CID             9   /* We don't like peer device response */
+/* We don't like peer device response */
+#define L2CAP_LE_INVALID_SOURCE_CID             9
 
 /* Define L2CAP Move Channel Response result codes
 */
@@ -241,32 +267,48 @@
 /* Define the info-type fields of information request & response
 */
 #define L2CAP_CONNLESS_MTU_INFO_TYPE      0x0001
-#define L2CAP_EXTENDED_FEATURES_INFO_TYPE 0x0002    /* Used in Information Req/Response */
-#define L2CAP_FIXED_CHANNELS_INFO_TYPE    0x0003    /* Used in AMP                      */
+/* Used in Information Req/Response */
+#define L2CAP_EXTENDED_FEATURES_INFO_TYPE 0x0002
+/* Used in AMP                      */
+#define L2CAP_FIXED_CHANNELS_INFO_TYPE    0x0003
 
-#define L2CAP_CONNLESS_MTU_INFO_SIZE           2    /* Connectionless MTU size          */
-#define L2CAP_EXTENDED_FEATURES_ARRAY_SIZE     4    /* Extended features array size     */
-#define L2CAP_FIXED_CHNL_ARRAY_SIZE            8    /* Fixed channel array size         */
+/* Connectionless MTU size          */
+#define L2CAP_CONNLESS_MTU_INFO_SIZE           2
+/* Extended features array size     */
+#define L2CAP_EXTENDED_FEATURES_ARRAY_SIZE     4
+/* Fixed channel array size         */
+#define L2CAP_FIXED_CHNL_ARRAY_SIZE            8
 
 /* Extended features mask bits
 */
-#define L2CAP_EXTFEA_RTRANS         0x00000001    /* Retransmission Mode (Not Supported)    */
-#define L2CAP_EXTFEA_FC             0x00000002    /* Flow Control Mode   (Not Supported)    */
+/* Retransmission Mode (Not Supported)    */
+#define L2CAP_EXTFEA_RTRANS         0x00000001
+/* Flow Control Mode   (Not Supported)    */
+#define L2CAP_EXTFEA_FC             0x00000002
 #define L2CAP_EXTFEA_QOS            0x00000004
-#define L2CAP_EXTFEA_ENH_RETRANS    0x00000008    /* Enhanced retransmission mode           */
-#define L2CAP_EXTFEA_STREAM_MODE    0x00000010    /* Streaming Mode                         */
-#define L2CAP_EXTFEA_NO_CRC         0x00000020    /* Optional FCS (if set No FCS desired)   */
-#define L2CAP_EXTFEA_EXT_FLOW_SPEC  0x00000040    /* Extended flow spec                     */
-#define L2CAP_EXTFEA_FIXED_CHNLS    0x00000080    /* Fixed channels                         */
-#define L2CAP_EXTFEA_EXT_WINDOW     0x00000100    /* Extended Window Size                   */
-#define L2CAP_EXTFEA_UCD_RECEPTION  0x00000200    /* Unicast Connectionless Data Reception  */
+/* Enhanced retransmission mode           */
+#define L2CAP_EXTFEA_ENH_RETRANS    0x00000008
+/* Streaming Mode                         */
+#define L2CAP_EXTFEA_STREAM_MODE    0x00000010
+/* Optional FCS (if set No FCS desired)   */
+#define L2CAP_EXTFEA_NO_CRC         0x00000020
+/* Extended flow spec                     */
+#define L2CAP_EXTFEA_EXT_FLOW_SPEC  0x00000040
+/* Fixed channels                         */
+#define L2CAP_EXTFEA_FIXED_CHNLS    0x00000080
+/* Extended Window Size                   */
+#define L2CAP_EXTFEA_EXT_WINDOW     0x00000100
+/* Unicast Connectionless Data Reception  */
+#define L2CAP_EXTFEA_UCD_RECEPTION  0x00000200
 
-/* Mask for locally supported features used in Information Response (default to none) */
+/* Mask for locally supported features used in Information Response
+ * (default to none) */
 #ifndef L2CAP_EXTFEA_SUPPORTED_MASK
 #define L2CAP_EXTFEA_SUPPORTED_MASK 0
 #endif
 
-/* Mask for LE supported features used in Information Response (default to none) */
+/* Mask for LE supported features used in Information Response
+ * (default to none) */
 #ifndef L2CAP_BLE_EXTFEA_MASK
 #define L2CAP_BLE_EXTFEA_MASK 0
 #endif
@@ -281,11 +323,12 @@
 #define L2CAP_SDU_LEN_OVERHEAD     2   /* SDU length field is 2 bytes */
 #define L2CAP_SDU_LEN_OFFSET       2   /* SDU length offset is 2 bytes */
 #define L2CAP_EXT_CONTROL_OVERHEAD 4   /* Extended Control Field       */
+/* length(2), channel(2), control(4), SDU length(2) FCS(2) */
 #define L2CAP_MAX_HEADER_FCS       (L2CAP_PKT_OVERHEAD + L2CAP_EXT_CONTROL_OVERHEAD + L2CAP_SDU_LEN_OVERHEAD + L2CAP_FCS_LEN)
-                                   /* length(2), channel(2), control(4), SDU length(2) FCS(2) */
 
-/* To optimize this, it must be a multiplum of the L2CAP PDU length AND match the 3DH5 air
- * including the l2cap headers in each packet - to match the latter - the -5 is added
+/* To optimize this, it must be a multiple of the L2CAP PDU length AND match
+ * the 3DH5 air including the l2cap headers in each packet. To match the latter,
+ * the -5 is added.
  * Changed it to  8087 to have same value between BTIF and L2cap layers
  */
 #define L2CAP_MAX_SDU_LENGTH     (8080 + 26 - (L2CAP_MIN_OFFSET + 6))
@@ -297,38 +340,59 @@
 
 /* SAR bits in the control word
 */
-#define L2CAP_FCR_UNSEG_SDU    0x0000   /* Control word to begin with for unsegmented PDU*/
-#define L2CAP_FCR_START_SDU    0x4000   /* ...for Starting PDU of a semented SDU */
-#define L2CAP_FCR_END_SDU      0x8000   /* ...for ending PDU of a segmented SDU */
-#define L2CAP_FCR_CONT_SDU     0xc000   /* ...for continuation PDU of a segmented SDU */
+/* Control word to begin with for unsegmented PDU*/
+#define L2CAP_FCR_UNSEG_SDU    0x0000
+/* ...for Starting PDU of a semented SDU */
+#define L2CAP_FCR_START_SDU    0x4000
+/* ...for ending PDU of a segmented SDU */
+#define L2CAP_FCR_END_SDU      0x8000
+/* ...for continuation PDU of a segmented SDU */
+#define L2CAP_FCR_CONT_SDU     0xc000
 
-/* Supervisory frame types
-*/
-#define L2CAP_FCR_SUP_RR        0x0000   /* Supervisory frame - RR                          */
-#define L2CAP_FCR_SUP_REJ       0x0001   /* Supervisory frame - REJ                         */
-#define L2CAP_FCR_SUP_RNR       0x0002   /* Supervisory frame - RNR                         */
-#define L2CAP_FCR_SUP_SREJ      0x0003   /* Supervisory frame - SREJ                        */
+/* Supervisory frame types */
+/* Supervisory frame - RR                          */
+#define L2CAP_FCR_SUP_RR        0x0000
+/* Supervisory frame - REJ                         */
+#define L2CAP_FCR_SUP_REJ       0x0001
+/* Supervisory frame - RNR                         */
+#define L2CAP_FCR_SUP_RNR       0x0002
+/* Supervisory frame - SREJ                        */
+#define L2CAP_FCR_SUP_SREJ      0x0003
 
-#define L2CAP_FCR_SAR_BITS           0xC000    /* Mask to get the SAR bits from control word */
-#define L2CAP_FCR_SAR_BITS_SHIFT     14        /* Bits to shift right to get the SAR bits from ctrl-word */
+/* Mask to get the SAR bits from control word */
+#define L2CAP_FCR_SAR_BITS           0xC000
+/* Bits to shift right to get the SAR bits from ctrl-word */
+#define L2CAP_FCR_SAR_BITS_SHIFT     14
 
-#define L2CAP_FCR_S_FRAME_BIT         0x0001   /* Mask to check if a PDU is S-frame */
-#define L2CAP_FCR_REQ_SEQ_BITS        0x3F00   /* Mask to get the req-seq from control word */
-#define L2CAP_FCR_REQ_SEQ_BITS_SHIFT  8        /* Bits to shift right to get the req-seq from ctrl-word */
-#define L2CAP_FCR_TX_SEQ_BITS         0x007E   /* Mask on get the tx-seq from control word */
-#define L2CAP_FCR_TX_SEQ_BITS_SHIFT   1        /* Bits to shift right to get the tx-seq from ctrl-word */
+/* Mask to check if a PDU is S-frame */
+#define L2CAP_FCR_S_FRAME_BIT         0x0001
+/* Mask to get the req-seq from control word */
+#define L2CAP_FCR_REQ_SEQ_BITS        0x3F00
+/* Bits to shift right to get the req-seq from ctrl-word */
+#define L2CAP_FCR_REQ_SEQ_BITS_SHIFT  8
+/* Mask on get the tx-seq from control word */
+#define L2CAP_FCR_TX_SEQ_BITS         0x007E
+/* Bits to shift right to get the tx-seq from ctrl-word */
+#define L2CAP_FCR_TX_SEQ_BITS_SHIFT   1
 
-#define L2CAP_FCR_F_BIT               0x0080   /* F-bit in the control word (Sup and I frames)  */
-#define L2CAP_FCR_P_BIT               0x0010   /* P-bit in the control word (Sup frames only)   */
+/* F-bit in the control word (Sup and I frames)  */
+#define L2CAP_FCR_F_BIT               0x0080
+/* P-bit in the control word (Sup frames only)   */
+#define L2CAP_FCR_P_BIT               0x0010
 
 #define L2CAP_FCR_F_BIT_SHIFT         7
 #define L2CAP_FCR_P_BIT_SHIFT         4
 
-#define L2CAP_FCR_SEG_BITS            0xC000   /* Mask to get the segmentation bits from ctrl-word */
-#define L2CAP_FCR_SUP_SHIFT           2        /* Bits to shift right to get the S-bits from ctrl-word */
-#define L2CAP_FCR_SUP_BITS            0x000C   /* Mask to get the supervisory bits from ctrl-word */
+/* Mask to get the segmentation bits from ctrl-word */
+#define L2CAP_FCR_SEG_BITS            0xC000
+/* Bits to shift right to get the S-bits from ctrl-word */
+#define L2CAP_FCR_SUP_SHIFT           2
+/* Mask to get the supervisory bits from ctrl-word */
+#define L2CAP_FCR_SUP_BITS            0x000C
 
-#define L2CAP_FCR_INIT_CRC            0   /* Initial state of the CRC register */
-#define L2CAP_FCR_SEQ_MODULO          0x3F     /* Mask for sequence numbers (range 0 - 63) */
+/* Initial state of the CRC register */
+#define L2CAP_FCR_INIT_CRC            0
+/* Mask for sequence numbers (range 0 - 63) */
+#define L2CAP_FCR_SEQ_MODULO          0x3F
 
 #endif
diff --git a/stack/include/mca_api.h b/stack/include/mca_api.h
index 72fcf2c..e070f24 100644
--- a/stack/include/mca_api.h
+++ b/stack/include/mca_api.h
@@ -34,8 +34,10 @@
 
 /* move the following to bt_target.h or other place later */
 #define MCA_NUM_TC_TBL  ((MCA_NUM_REGS)*(MCA_NUM_LINKS)*(MCA_NUM_MDLS+1))
-#define MCA_NUM_CCBS	((MCA_NUM_REGS)*(MCA_NUM_LINKS))    /* Number of control channel control blocks	*/
-#define MCA_NUM_DCBS	((MCA_NUM_REGS)*(MCA_NUM_LINKS)*(MCA_NUM_MDLS)) /* Number of data channel control blocks */
+/* Number of control channel control blocks	*/
+#define MCA_NUM_CCBS	((MCA_NUM_REGS)*(MCA_NUM_LINKS))
+/* Number of data channel control blocks */
+#define MCA_NUM_DCBS	((MCA_NUM_REGS)*(MCA_NUM_LINKS)*(MCA_NUM_MDLS))
 
 
 /*****************************************************************************
@@ -66,11 +68,14 @@
 #define MCA_DELETE_IND_EVT          7       /* delete mdl indication */
 #define MCA_DELETE_CFM_EVT          8       /* delete mdl confirm */
 
-#define MCA_SYNC_CAP_IND_EVT        0x11   /* request sync capabilities & requirements */
+/* request sync capabilities & requirements */
+#define MCA_SYNC_CAP_IND_EVT        0x11
 #define MCA_SYNC_CAP_CFM_EVT        0x12   /* indicate completion */
-#define MCA_SYNC_SET_IND_EVT        0x13   /* request to set the time-stamp clock */
+/* request to set the time-stamp clock */
+#define MCA_SYNC_SET_IND_EVT        0x13
 #define MCA_SYNC_SET_CFM_EVT        0x14   /* indicate completion */
-#define MCA_SYNC_INFO_IND_EVT       0x15   /* update of the actual time-stamp clock instant from the sync slave */
+/* update of the actual time-stamp clock instant from the sync slave */
+#define MCA_SYNC_INFO_IND_EVT       0x15
 
 #define MCA_CONNECT_IND_EVT         0x20    /* Control channel connected */
 #define MCA_DISCONNECT_IND_EVT      0x21    /* Control channel disconnected */
@@ -169,14 +174,14 @@
     uint16_t        reason;     /* disconnect reason given by L2CAP */
 } tMCA_DISCONNECT_IND;
 
-/* This data structure is associated with MCA_OPEN_IND_EVT, and MCA_OPEN_CFM_EVT. */
+/* This data structure is for MCA_OPEN_IND_EVT, and MCA_OPEN_CFM_EVT. */
 typedef struct {
     uint16_t        mdl_id;     /* The associated MDL ID */
     tMCA_DL         mdl;        /* The handle for the data channel */
     uint16_t        mtu;        /* peer mtu */
 } tMCA_DL_OPEN;
 
-/* This data structure is associated with MCA_CLOSE_IND_EVT and MCA_CLOSE_CFM_EVT. */
+/* This data structure is for MCA_CLOSE_IND_EVT and MCA_CLOSE_CFM_EVT. */
 typedef struct {
     uint16_t        mdl_id;     /* The associated MDL ID */
     tMCA_DL         mdl;        /* The handle for the data channel */
@@ -271,9 +276,9 @@
  *
  * Function         MCA_Deregister
  *
- * Description      This function is called to deregister an MCAP implementation.
- *                  Before this function can be called, all control and data
- *                  channels must be removed with MCA_DisconnectReq and MCA_CloseReq.
+ * Description      Deregister an MCAP implementation. Before this function can
+ *                  be called, all control and data channels must be removed
+ *                  with MCA_DisconnectReq and MCA_CloseReq.
  *
  * Returns          void
  *
@@ -284,10 +289,11 @@
  *
  * Function         MCA_CreateDep
  *
- * Description      Create a data endpoint.  If the MDEP is created successfully,
- *                  the MDEP ID is returned in *p_dep. After a data endpoint is
- *                  created, an application can initiate a connection between this
- *                  endpoint and an endpoint on a peer device.
+ * Description      Create a data endpoint.  If the MDEP is created
+ *                  successfully, the MDEP ID is returned in *p_dep. After a
+ *                  data endpoint is created, an application can initiate a
+ *                  connection between this endpoint and an endpoint on a peer
+ *                  device.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -318,9 +324,9 @@
  *                  MCA_CONNECT_IND_EVT is reported to the application via its
  *                  control callback function.
  *                  This control channel is identified by tMCA_CL.
- *                  If the connection attempt fails, an MCA_DISCONNECT_IND_EVT is
- *                  reported. The security mask parameter overrides the outgoing
- *                  security mask set in MCA_Register().
+ *                  If the connection attempt fails, an MCA_DISCONNECT_IND_EVT
+ *                  is reported. The security mask parameter overrides the
+ *                  outgoing security mask set in MCA_Register().
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -337,7 +343,8 @@
  *                  to the peer device.
  *                  If associated data channel exists, they are disconnected.
  *                  When the MCL is disconnected an MCA_DISCONNECT_IND_EVT is
- *                  reported to the application via its control callback function.
+ *                  reported to the application via its control callback
+ *                  function.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -349,12 +356,13 @@
  * Function         MCA_CreateMdl
  *
  * Description      This function sends a CREATE_MDL request to the peer device.
- *                  When the response is received, a MCA_CREATE_CFM_EVT is reported
- *                  with the given MDL ID.
+ *                  When the response is received, a MCA_CREATE_CFM_EVT is
+ *                  reported with the given MDL ID.
  *                  If the response is successful, a data channel is open
  *                  with the given p_chnl_cfg
- *                  When the data channel is open successfully, a MCA_OPEN_CFM_EVT
- *                  is reported. This data channel is identified as tMCA_DL.
+ *                  When the data channel is open successfully, a
+ *                  MCA_OPEN_CFM_EVT is reported. This data channel is
+ *                  identified as tMCA_DL.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -371,8 +379,9 @@
  *                  in response to a received MCA_CREATE_IND_EVT.
  *                  If the rsp_code is successful, a data channel is open
  *                  with the given p_chnl_cfg
- *                  When the data channel is open successfully, a MCA_OPEN_IND_EVT
- *                  is reported. This data channel is identified as tMCA_DL.
+ *                  When the data channel is open successfully, a
+ *                  MCA_OPEN_IND_EVT is reported. This data channel is
+ *                  identified as tMCA_DL.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -398,11 +407,11 @@
  *
  * Function         MCA_ReconnectMdl
  *
- * Description      This function sends a RECONNECT_MDL request to the peer device.
- *                  When the response is received, a MCA_RECONNECT_CFM_EVT is reported.
- *                  If the response is successful, a data channel is open.
- *                  When the data channel is open successfully, a MCA_OPEN_CFM_EVT
- *                  is reported.
+ * Description      This function sends a RECONNECT_MDL request to the peer
+ *                  device. When the response is received, a
+ *                  MCA_RECONNECT_CFM_EVT is reported. If the response is
+ *                  successful, a data channel is open. When the data channel is
+ *                  open successfully, a MCA_OPEN_CFM_EVT is reported.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -414,11 +423,11 @@
  *
  * Function         MCA_ReconnectMdlRsp
  *
- * Description      This function sends a RECONNECT_MDL response to the peer device
- *                  in response to a MCA_RECONNECT_IND_EVT event.
+ * Description      Send a RECONNECT_MDL response to the peer device in response
+ *                  to a MCA_RECONNECT_IND_EVT event.
  *                  If the response is successful, a data channel is open.
- *                  When the data channel is open successfully, a MCA_OPEN_IND_EVT
- *                  is reported.
+ *                  When the data channel is open successfully, a
+ *                  MCA_OPEN_IND_EVT is reported.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -433,8 +442,9 @@
  *
  * Description      This function initiates a data channel connection toward the
  *                  connected peer device.
- *                  When the data channel is open successfully, a MCA_OPEN_CFM_EVT
- *                  is reported. This data channel is identified as tMCA_DL.
+ *                  When the data channel is open successfully, a
+ *                  MCA_OPEN_CFM_EVT is reported. This data channel is
+ *                  identified as tMCA_DL.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -446,7 +456,8 @@
  * Function         MCA_Abort
  *
  * Description      This function sends a ABORT_MDL request to the peer device.
- *                  When the response is received, a MCA_ABORT_CFM_EVT is reported.
+ *                  When the response is received, a MCA_ABORT_CFM_EVT is
+ *                  reported.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -458,7 +469,8 @@
  * Function         MCA_Delete
  *
  * Description      This function sends a DELETE_MDL request to the peer device.
- *                  When the response is received, a MCA_DELETE_CFM_EVT is reported.
+ *                  When the response is received, a MCA_DELETE_CFM_EVT is
+ *                  reported.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -471,9 +483,10 @@
  *
  * Description      Send a data packet to the peer device.
  *
- *                  The application passes the packet using the BT_HDR structure.
- *                  The offset field must be equal to or greater than L2CAP_MIN_OFFSET.
- *                  This allows enough space in the buffer for the L2CAP header.
+ *                  The application passes the packet using the BT_HDR
+ *                  structure. The offset field must be equal to or greater than
+ *                  L2CAP_MIN_OFFSET. This allows enough space in the buffer for
+ *                  the L2CAP header.
  *
  *                  The memory pointed to by p_pkt must be a GKI buffer
  *                  allocated by the application.  This buffer will be freed
diff --git a/stack/include/mca_defs.h b/stack/include/mca_defs.h
index aa0905a..fd52a85 100644
--- a/stack/include/mca_defs.h
+++ b/stack/include/mca_defs.h
@@ -31,56 +31,83 @@
 #define MCA_MIN_MTU                 48
 
 /* standard op codes */
-#define MCA_OP_ERROR_RSP            0x00   /* invalid opcode response */
-#define MCA_OP_MDL_CREATE_REQ       0x01   /* create an MDL, wait for an associated data channel connection */
-#define MCA_OP_MDL_CREATE_RSP       0x02   /* response to above request */
-#define MCA_OP_MDL_RECONNECT_REQ    0x03   /* req to prepare to rvc a data channel conn associated with a prev MDL */
-#define MCA_OP_MDL_RECONNECT_RSP    0x04   /* response to above request */
-#define MCA_OP_MDL_ABORT_REQ        0x05   /* stop waiting for a data channel connection */
-#define MCA_OP_MDL_ABORT_RSP        0x06   /* response to above request */
-#define MCA_OP_MDL_DELETE_REQ       0x07   /* delete an MDL */
-#define MCA_OP_MDL_DELETE_RSP       0x08   /* response to above request */
+/* invalid opcode response */
+#define MCA_OP_ERROR_RSP            0x00
+/* create an MDL, wait for an associated data channel connection */
+#define MCA_OP_MDL_CREATE_REQ       0x01
+/* response to above request */
+#define MCA_OP_MDL_CREATE_RSP       0x02
+/* req to prepare to rvc a data channel conn associated with a prev MDL */
+#define MCA_OP_MDL_RECONNECT_REQ    0x03
+/* response to above request */
+#define MCA_OP_MDL_RECONNECT_RSP    0x04
+/* stop waiting for a data channel connection */
+#define MCA_OP_MDL_ABORT_REQ        0x05
+/* response to above request */
+#define MCA_OP_MDL_ABORT_RSP        0x06
+/* delete an MDL */
+#define MCA_OP_MDL_DELETE_REQ       0x07
+/* response to above request */
+#define MCA_OP_MDL_DELETE_RSP       0x08
 #define MCA_NUM_STANDARD_OPCODE     (1+MCA_OP_MDL_DELETE_RSP)
 
 /* clock synchronization op codes */
-#define MCA_OP_SYNC_CAP_REQ         0x11   /* request sync capabilities & requirements */
-#define MCA_OP_SYNC_CAP_RSP         0x12   /* indicate completion */
-#define MCA_OP_SYNC_SET_REQ         0x13   /* request to set the time-stamp clock */
-#define MCA_OP_SYNC_SET_RSP         0x14   /* indicate completion */
-#define MCA_OP_SYNC_INFO_IND        0x15   /* update of the actual time-stamp clock instant from the sync slave */
+/* request sync capabilities & requirements */
+#define MCA_OP_SYNC_CAP_REQ         0x11
+/* indicate completion */
+#define MCA_OP_SYNC_CAP_RSP         0x12
+/* request to set the time-stamp clock */
+#define MCA_OP_SYNC_SET_REQ         0x13
+/* indicate completion */
+#define MCA_OP_SYNC_SET_RSP         0x14
+/* update of the actual time-stamp clock instant from the sync slave */
+#define MCA_OP_SYNC_INFO_IND        0x15
 
 #define MCA_FIRST_SYNC_OP          MCA_OP_SYNC_CAP_REQ
 #define MCA_LAST_SYNC_OP           MCA_OP_SYNC_INFO_IND
 
 /* response code */
-#define MCA_RSP_SUCCESS     0x00    /* The corresponding request was received and processed successfully. */
-#define MCA_RSP_BAD_OPCODE  0x01    /* The Op Code received is not valid (i.e. neither a Standard Op Code nor a Clock Synchronization Protocol Op Code). */
-#define MCA_RSP_BAD_PARAM   0x02    /* One or more of the values in the received request is invalid. */
+/* The corresponding request was received and processed successfully. */
+#define MCA_RSP_SUCCESS     0x00
+/* The Op Code received is not valid (i.e. neither a Standard Op Code nor a Clock Synchronization Protocol Op Code). */
+#define MCA_RSP_BAD_OPCODE  0x01
+/* One or more of the values in the received request is invalid. */
+#define MCA_RSP_BAD_PARAM   0x02
 /* MCA_RSP_BAD_PARAM shall be used when:
 - The request length is invalid
 - Some of the parameters have invalid values and none of the other defined Response Codes are more appropriate.
 */
-#define MCA_RSP_BAD_MDEP    0x03    /* The MDEP ID referenced does not exist on this device. */
-#define MCA_RSP_MDEP_BUSY   0x04    /* The requested MDEP currently has as many active MDLs as it can manage simultaneously. */
-#define MCA_RSP_BAD_MDL     0x05    /* The MDL ID referenced is invalid. */
+/* The MDEP ID referenced does not exist on this device. */
+#define MCA_RSP_BAD_MDEP    0x03
+/* The requested MDEP currently has as many active MDLs as it can manage simultaneously. */
+#define MCA_RSP_MDEP_BUSY   0x04
+/* The MDL ID referenced is invalid. */
+#define MCA_RSP_BAD_MDL     0x05
 /* MCA_RSP_BAD_MDL shall be used when:
 - A reserved or invalid value for MDL ID was used.
 - The MDL ID referenced is not available (was never created, has been deleted, or was otherwise lost),
 - The MDL ID referenced in the Abort request is not the same value that was used to initiate the PENDING state
 */
-#define MCA_RSP_MDL_BUSY    0x06    /* The device is temporarily unable to complete the request. This is intended for reasons not related to the physical sensor (e.g. communication resources unavailable). */
-#define MCA_RSP_BAD_OP      0x07    /* The received request is invalid in the current state. */
+/* The device is temporarily unable to complete the request. This is intended for reasons not related to the physical sensor (e.g. communication resources unavailable). */
+#define MCA_RSP_MDL_BUSY    0x06
+/* The received request is invalid in the current state. */
+#define MCA_RSP_BAD_OP      0x07
 /* MCA_RSP_BAD_OP is used when
 - Abort request was received while not in the PENDING state.
 - Create, Reconnect, or Delete request was received while in the PENDING state.
 - A response is received when a request is expected
 */
-#define MCA_RSP_NO_RESOURCE 0x08    /* The device is temporarily unable to complete the request. This is intended for reasons relating to the physical sensor (e.g. hardware fault, low battery), or when processing resources are temporarily committed to other processes. */
-#define MCA_RSP_ERROR       0x09    /* An internal error other than those listed in this table was encountered while processing the request. */
-#define MCA_RSP_NO_SUPPORT  0x0A    /* The Op Code that was used in this request is not supported. */
-#define MCA_RSP_CFG_REJ     0x0B    /* A configuration required by a MD_CREATE_MDL or MD_RECONNECT_MDL operation has been rejected. */
+/* The device is temporarily unable to complete the request. This is intended for reasons relating to the physical sensor (e.g. hardware fault, low battery), or when processing resources are temporarily committed to other processes. */
+#define MCA_RSP_NO_RESOURCE 0x08
+/* An internal error other than those listed in this table was encountered while processing the request. */
+#define MCA_RSP_ERROR       0x09
+/* The Op Code that was used in this request is not supported. */
+#define MCA_RSP_NO_SUPPORT  0x0A
+/* A configuration required by a MD_CREATE_MDL or MD_RECONNECT_MDL operation has been rejected. */
+#define MCA_RSP_CFG_REJ     0x0B
 
-#define MCA_MAX_MDEP_ID     0x7F    /* the valid range for MDEP ID is 1-0x7F */
+/* the valid range for MDEP ID is 1-0x7F */
+#define MCA_MAX_MDEP_ID     0x7F
 #define MCA_IS_VALID_MDL_ID(xxx)    (((xxx)>0) && ((xxx)<=0xFEFF))
 #define MCA_ALL_MDL_ID      0xFFFF
 
diff --git a/stack/include/pan_api.h b/stack/include/pan_api.h
index c734e37..32fdc22 100644
--- a/stack/include/pan_api.h
+++ b/stack/include/pan_api.h
@@ -266,12 +266,14 @@
  *                                      PAN_ROLE_GN_SERVER is for GN role
  *                                      PAN_ROLE_NAP_SERVER is for NAP role
  *                  sec_mask    - Security mask for different roles
- *                                      It is array of uint8_t. The byte represent the
- *                                      security for roles PANU, GN and NAP in order
+ *                                      It is array of uint8_t. The bytes
+ *                                      represent the security for roles PANU,
+ *                                      GN and NAP in order
+ *
  *                  p_user_name - Service name for PANU role
  *                  p_gn_name   - Service name for GN role
  *                  p_nap_name  - Service name for NAP role
- *                                      Can be NULL if user wants it to be default
+ *                                  Can be NULL if user wants it to be default
  *
  * Returns          PAN_SUCCESS     - if the role is set successfully
  *                  PAN_FAILURE     - if the role is not valid
@@ -298,12 +300,12 @@
  *                                      PAN_ROLE_NAP_SERVER is for NAP role
  *                  *handle     - Pointer for returning Handle to the connection
  *
- * Returns          PAN_SUCCESS      - if the connection is initiated successfully
+ * Returns          PAN_SUCCESS - if the connection is initiated successfully
  *                  PAN_NO_RESOURCES - resources are not sufficent
  *                  PAN_FAILURE      - if the connection cannot be initiated
- *                                           this can be because of the combination of
- *                                           src and dst roles may not be valid or
- *                                           allowed at that point of time
+ *                                     this can be because of the combination of
+ *                                     src and dst roles may not be valid or
+ *                                     allowed at that point of time
  *
  ******************************************************************************/
 extern tPAN_RESULT PAN_Connect (BD_ADDR rem_bda, uint8_t src_role, uint8_t dst_role, uint16_t *handle);
@@ -330,9 +332,9 @@
  * Description      This sends data over the PAN connections. If this is called
  *                  on GN or NAP side and the packet is multicast or broadcast
  *                  it will be sent on all the links. Otherwise the correct link
- *                  is found based on the destination address and forwarded on it
- *                  If the return value is not PAN_SUCCESS the application should
- *                  take care of releasing the message buffer
+ *                  is found based on the destination address and forwarded on
+ *                  it. If the return value is not PAN_SUCCESS the application
+ *                  should take care of releasing the message buffer
  *
  * Parameters:      dst      - MAC or BD Addr of the destination device
  *                  src      - MAC or BD Addr of the source who sent this packet
@@ -361,9 +363,9 @@
  * Description      This sends data over the PAN connections. If this is called
  *                  on GN or NAP side and the packet is multicast or broadcast
  *                  it will be sent on all the links. Otherwise the correct link
- *                  is found based on the destination address and forwarded on it
- *                  If the return value is not PAN_SUCCESS the application should
- *                  take care of releasing the message buffer
+ *                  is found based on the destination address and forwarded on
+ *                  it. If the return value is not PAN_SUCCESS the application
+ *                  should take care of releasing the message buffer
  *
  * Parameters:      dst      - MAC or BD Addr of the destination device
  *                  src      - MAC or BD Addr of the source who sent this packet
@@ -395,8 +397,8 @@
  *                  end         - array of ending protocol numbers
  *
  *
- * Returns          PAN_SUCCESS        if protocol filters are set successfully
- *                  PAN_FAILURE        if connection not found or error in setting
+ * Returns          PAN_SUCCESS     if protocol filters are set successfully
+ *                  PAN_FAILURE     if connection not found or error in setting
  *
  ******************************************************************************/
 extern tPAN_RESULT PAN_SetProtocolFilters (uint16_t handle,
@@ -418,8 +420,8 @@
  *                                         multicast address ranges
  *
  *
- * Returns          PAN_SUCCESS        if multicast filters are set successfully
- *                  PAN_FAILURE        if connection not found or error in setting
+ * Returns          PAN_SUCCESS     if multicast filters are set successfully
+ *                  PAN_FAILURE     if connection not found or error in setting
  *
  ******************************************************************************/
 extern tBNEP_RESULT PAN_SetMulticastFilters (uint16_t handle,
diff --git a/stack/include/port_api.h b/stack/include/port_api.h
index 8ece9ef..3b89f2c 100644
--- a/stack/include/port_api.h
+++ b/stack/include/port_api.h
@@ -128,11 +128,14 @@
 #define PORT_EV_OVERRUN 0x00002000   /* receiver buffer overrun */
 #define PORT_EV_TXCHAR  0x00004000   /* Any character transmitted */
 
-#define PORT_EV_CONNECTED    0x00000200  /* RFCOMM connection established */
-#define PORT_EV_CONNECT_ERR  0x00008000  /* Was not able to establish connection */
-                                     /* or disconnected */
-#define PORT_EV_FC      0x00010000   /* data flow enabled flag changed by remote */
-#define PORT_EV_FCS     0x00020000   /* data flow enable status true = enabled */
+/* RFCOMM connection established */
+#define PORT_EV_CONNECTED    0x00000200
+/* Unable to establish connection  or disconnected */
+#define PORT_EV_CONNECT_ERR  0x00008000
+/* data flow enabled flag changed by remote */
+#define PORT_EV_FC      0x00010000
+/* data flow enable status true = enabled */
+#define PORT_EV_FCS     0x00020000
 
 /*
  * To register for events application should provide bitmask with
@@ -189,8 +192,8 @@
  *
  * Function         RFCOMM_CreateConnection
  *
- * Description      RFCOMM_CreateConnection function is used from the application
- *                  to establish serial port connection to the peer device,
+ * Description      RFCOMM_CreateConnection is used from the application to
+ *                  establish a serial port connection to the peer device,
  *                  or allow RFCOMM to accept a connection from the peer
  *                  application.
  *
@@ -265,8 +268,9 @@
  *
  * Function         PORT_ClearKeepHandleFlag
  *
- * Description      This function is called to clear the keep handle flag
- *                  which will cause not to keep the port handle open when closed
+ * Description      Called to clear the keep handle flag, which will cause
+ *                  not to keep the port handle open when closed
+ *
  * Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
  *
  ******************************************************************************/
@@ -444,7 +448,7 @@
 #define PORT_DCD_ON             0x08
 
 /*
- * Define default initial local modem signals state set after connection established
+ * Define default initial local modem signals state after connection established
 */
 #define PORT_OBEX_DEFAULT_SIGNAL_STATE  (PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON)
 #define PORT_SPP_DEFAULT_SIGNAL_STATE   (PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON)
@@ -644,7 +648,7 @@
  *
  * Function         PORT_SetTraceLevel
  *
- * Description      This function sets the trace level for RFCOMM. If called with
+ * Description      Set the trace level for RFCOMM. If called with
  *                  a value of 0xFF, it simply reads the current trace level.
  *
  * Returns          the new (current) trace level
diff --git a/stack/include/profiles_api.h b/stack/include/profiles_api.h
index 2b152d1..5bcc124 100644
--- a/stack/include/profiles_api.h
+++ b/stack/include/profiles_api.h
@@ -43,13 +43,20 @@
 #define BT_SEC_MODE_LINK            BTM_SEC_MODE_LINK
 
 /* security mask definitions (tBT_SECURITY) */
-/* The following definitions are OR'd together to form the security requirements */
-#define BT_SEC_IN_AUTHORIZE         BTM_SEC_IN_AUTHORIZE         /* Inbound call requires authorization */
-#define BT_SEC_IN_AUTHENTICATE      BTM_SEC_IN_AUTHENTICATE      /* Inbound call requires authentication */
-#define BT_SEC_IN_ENCRYPT           BTM_SEC_IN_ENCRYPT           /* Inbound call requires encryption */
-#define BT_SEC_OUT_AUTHORIZE        BTM_SEC_OUT_AUTHORIZE        /* Outbound call requires authorization */
-#define BT_SEC_OUT_AUTHENTICATE     BTM_SEC_OUT_AUTHENTICATE     /* Outbound call requires authentication */
-#define BT_SEC_OUT_ENCRYPT          BTM_SEC_OUT_ENCRYPT          /* Outbound call requires encryption */
+/* The following definitions are OR'd together to form the security
+ * requirements */
+/* Inbound call requires authorization */
+#define BT_SEC_IN_AUTHORIZE         BTM_SEC_IN_AUTHORIZE
+/* Inbound call requires authentication */
+#define BT_SEC_IN_AUTHENTICATE      BTM_SEC_IN_AUTHENTICATE
+/* Inbound call requires encryption */
+#define BT_SEC_IN_ENCRYPT           BTM_SEC_IN_ENCRYPT
+/* Outbound call requires authorization */
+#define BT_SEC_OUT_AUTHORIZE        BTM_SEC_OUT_AUTHORIZE
+/* Outbound call requires authentication */
+#define BT_SEC_OUT_AUTHENTICATE     BTM_SEC_OUT_AUTHENTICATE
+/* Outbound call requires encryption */
+#define BT_SEC_OUT_ENCRYPT          BTM_SEC_OUT_ENCRYPT
 
 
 /*****************************************************************************
diff --git a/stack/include/sdp_api.h b/stack/include/sdp_api.h
index ddd4ee4..c560e72 100644
--- a/stack/include/sdp_api.h
+++ b/stack/include/sdp_api.h
@@ -203,7 +203,8 @@
  *
  * Description      This function cancels an active query to an SDP server.
  *
- * Returns          true if discovery cancelled, false if a matching activity is not found.
+ * Returns          true if discovery cancelled, false if a matching activity is
+ *                  not found.
  *
  ******************************************************************************/
 bool    SDP_CancelServiceSearch (tSDP_DISCOVERY_DB *p_db);
@@ -263,10 +264,10 @@
  *
  * Function         SDP_FindAttributeInDb
  *
- * Description      This function queries an SDP database for a specific attribute.
- *                  If the p_start_rec pointer is NULL, it looks from the beginning
- *                  of the database, else it continues from the next record after
- *                  p_start_rec.
+ * Description      This function queries an SDP database for a specific
+ *                  attribute. If the p_start_rec pointer is NULL, it looks from
+ *                  the beginning of the database, else it continues from the
+ *                  next record after p_start_rec.
  *
  * Returns          Pointer to matching record, or NULL
  *
@@ -294,10 +295,10 @@
  *
  * Function         SDP_FindServiceInDb
  *
- * Description      This function queries an SDP database for a specific service.
- *                  If the p_start_rec pointer is NULL, it looks from the beginning
- *                  of the database, else it continues from the next record after
- *                  p_start_rec.
+ * Description      This function queries an SDP database for a specific
+ *                  service. If the p_start_rec pointer is NULL, it looks from
+ *                  the beginning of the database, else it continues from the
+ *                  next record after p_start_rec.
  *
  * Returns          Pointer to record containing service class, or NULL
  *
@@ -311,10 +312,10 @@
  *
  * Function         SDP_FindServiceUUIDInDb
  *
- * Description      This function queries an SDP database for a specific service.
- *                  If the p_start_rec pointer is NULL, it looks from the beginning
- *                  of the database, else it continues from the next record after
- *                  p_start_rec.
+ * Description      This function queries an SDP database for a specific
+ *                  service. If the p_start_rec pointer is NULL, it looks from
+ *                  the beginning of the database, else it continues from the
+ *                  next record after p_start_rec.
  *
  * NOTE             the only difference between this function and the previous
  *                  function "SDP_FindServiceInDb()" is that this function takes
@@ -331,7 +332,7 @@
  *
  * Function         SDP_FindServiceUUIDInRec_128bit
  *
- * Description      This function is called to read the 128-bit service UUID within a record
+ * Description      Read the 128-bit service UUID within a record,
  *                  if there is any.
  *
  * Parameters:      p_rec      - pointer to a SDP record.
@@ -346,9 +347,9 @@
  *
  * Function         SDP_FindServiceInDb_128bit
  *
- * Description      This function queries an SDP database for a specific service.
- *                  If the p_start_rec pointer is NULL, it looks from the beginning
- *                  of the database, else it continues from the next record after
+ * Description      Query an SDP database for a specific service.
+ *                  If the p_start_rec pointer is NULL, look from the beginning
+ *                  of the database, else continue from the next record after
  *                  p_start_rec.
  *
  * Returns          Pointer to record containing service class, or NULL
@@ -399,8 +400,8 @@
  *                  an 8-bit minor version.
  *
  * Returns          true if found, false if not
- *                  If found, the major and minor version numbers that were passed
- *                  in are filled in.
+ *                  If found, the major and minor version numbers that were
+ *                  passed in are filled in.
  *
  ******************************************************************************/
 bool    SDP_FindProfileVersionInRec (tSDP_DISC_REC *p_rec,
@@ -462,8 +463,8 @@
  *
  * Description      This function is called to add an attribute to a record.
  *                  This would be through the SDP database maintenance API.
- *                  If the attribute already exists in the record, it is replaced
- *                  with the new value.
+ *                  If the attribute already exists in the record, it is
+ *                  replaced with the new value.
  *
  * NOTE             Attribute values must be passed as a Big Endian stream.
  *
@@ -515,9 +516,9 @@
  * Function         SDP_AddProtocolList
  *
  * Description      This function is called to add a protocol descriptor list to
- *                  a record. This would be through the SDP database maintenance API.
- *                  If the protocol list already exists in the record, it is replaced
- *                  with the new list.
+ *                  a record. This would be through the SDP database
+ *                  maintenance API. If the protocol list already exists in the
+ *                  record, it is replaced with the new list.
  *
  * Returns          true if added OK, else false
  *
@@ -531,9 +532,9 @@
  * Function         SDP_AddAdditionProtoLists
  *
  * Description      This function is called to add a protocol descriptor list to
- *                  a record. This would be through the SDP database maintenance API.
- *                  If the protocol list already exists in the record, it is replaced
- *                  with the new list.
+ *                  a record. This would be through the SDP database maintenance
+ *                  API. If the protocol list already exists in the record, it
+ *                  is replaced with the new list.
  *
  * Returns          true if added OK, else false
  *
@@ -547,9 +548,9 @@
  * Function         SDP_AddProfileDescriptorList
  *
  * Description      This function is called to add a profile descriptor list to
- *                  a record. This would be through the SDP database maintenance API.
- *                  If the version already exists in the record, it is replaced
- *                  with the new one.
+ *                  a record. This would be through the SDP database maintenance
+ *                  API. If the version already exists in the record, it is
+ *                  replaced with the new one.
  *
  * Returns          true if added OK, else false
  *
@@ -563,9 +564,9 @@
  * Function         SDP_AddLanguageBaseAttrIDList
  *
  * Description      This function is called to add a language base attr list to
- *                  a record. This would be through the SDP database maintenance API.
- *                  If the version already exists in the record, it is replaced
- *                  with the new one.
+ *                  a record. This would be through the SDP database maintenance
+ *                  API. If the version already exists in the record, it is
+ *                  replaced with the new one.
  *
  * Returns          true if added OK, else false
  *
@@ -580,8 +581,8 @@
  *
  * Description      This function is called to add a service list to a record.
  *                  This would be through the SDP database maintenance API.
- *                  If the service list already exists in the record, it is replaced
- *                  with the new list.
+ *                  If the service list already exists in the record, it is
+ *                  replaced with the new list.
  *
  * Returns          true if added OK, else false
  *
@@ -594,7 +595,7 @@
  *
  * Function         SDP_DeleteAttribute
  *
- * Description      This function is called to delete an attribute from a record.
+ * Description      Delete an attribute from a record.
  *                  This would be through the SDP database maintenance API.
  *
  * Returns          true if deleted OK, else false if not found
@@ -670,7 +671,7 @@
  *
  * Function         SDP_FindServiceUUIDInRec
  *
- * Description      This function is called to read the service UUID within a record
+ * Description      Read the service UUID within a record,
  *                  if there is any.
  *
  * Parameters:      p_rec      - pointer to a SDP record.
diff --git a/stack/include/sdpdefs.h b/stack/include/sdpdefs.h
index 07dfa5e..7985bc2 100644
--- a/stack/include/sdpdefs.h
+++ b/stack/include/sdpdefs.h
@@ -194,10 +194,14 @@
 #define UUID_SERVCLASS_CORDLESS_TELEPHONY       0X1109
 #define UUID_SERVCLASS_AUDIO_SOURCE             0X110A
 #define UUID_SERVCLASS_AUDIO_SINK               0X110B
-#define UUID_SERVCLASS_AV_REM_CTRL_TARGET       0X110C  /* Audio/Video Control profile */
-#define UUID_SERVCLASS_ADV_AUDIO_DISTRIBUTION   0X110D  /* Advanced Audio Distribution profile */
-#define UUID_SERVCLASS_AV_REMOTE_CONTROL        0X110E  /* Audio/Video Control profile */
-#define UUID_SERVCLASS_AV_REM_CTRL_CONTROL      0X110F  /* Audio/Video Control profile */
+/* Audio/Video Control profile */
+#define UUID_SERVCLASS_AV_REM_CTRL_TARGET       0X110C
+/* Advanced Audio Distribution profile */
+#define UUID_SERVCLASS_ADV_AUDIO_DISTRIBUTION   0X110D
+/* Audio/Video Control profile */
+#define UUID_SERVCLASS_AV_REMOTE_CONTROL        0X110E
+/* Audio/Video Control profile */
+#define UUID_SERVCLASS_AV_REM_CTRL_CONTROL      0X110F
 #define UUID_SERVCLASS_INTERCOM                 0X1110
 #define UUID_SERVCLASS_FAX                      0X1111
 #define UUID_SERVCLASS_HEADSET_AUDIO_GATEWAY    0X1112
@@ -222,10 +226,14 @@
 #define UUID_SERVCLASS_CABLE_REPLACEMENT        0X1125  /* HCRP profile */
 #define UUID_SERVCLASS_HCRP_PRINT               0X1126  /* HCRP profile */
 #define UUID_SERVCLASS_HCRP_SCAN                0X1127  /* HCRP profile */
-#define UUID_SERVCLASS_COMMON_ISDN_ACCESS       0X1128  /* CAPI Message Transport Protocol*/
-#define UUID_SERVCLASS_VIDEO_CONFERENCING_GW    0X1129  /* Video Conferencing profile */
-#define UUID_SERVCLASS_UDI_MT                   0X112A  /* Unrestricted Digital Information profile */
-#define UUID_SERVCLASS_UDI_TA                   0X112B  /* Unrestricted Digital Information profile */
+/* CAPI Message Transport Protocol*/
+#define UUID_SERVCLASS_COMMON_ISDN_ACCESS       0X1128
+/* Video Conferencing profile */
+#define UUID_SERVCLASS_VIDEO_CONFERENCING_GW    0X1129
+/* Unrestricted Digital Information profile */
+#define UUID_SERVCLASS_UDI_MT                   0X112A
+/* Unrestricted Digital Information profile */
+#define UUID_SERVCLASS_UDI_TA                   0X112B
 #define UUID_SERVCLASS_VCP                      0X112C  /* Video Conferencing profile */
 #define UUID_SERVCLASS_SAP                      0X112D  /* SIM Access profile */
 #define UUID_SERVCLASS_PBAP_PCE                 0X112E  /* Phonebook Access - PCE */
@@ -242,15 +250,18 @@
 #define UUID_SERVCLASS_ESDP_UPNP_IP_PAN         0X1300  /* UPNP_IP_PAN [ESDP] */
 #define UUID_SERVCLASS_ESDP_UPNP_IP_LAP         0X1301  /* UPNP_IP_LAP [ESDP] */
 #define UUID_SERVCLASS_ESDP_UPNP_IP_L2CAP       0X1302  /* UPNP_L2CAP [ESDP] */
-#define UUID_SERVCLASS_VIDEO_SOURCE             0X1303  /* Video Distribution Profile (VDP) */
-#define UUID_SERVCLASS_VIDEO_SINK               0X1304  /* Video Distribution Profile (VDP) */
-#define UUID_SERVCLASS_VIDEO_DISTRIBUTION       0X1305  /* Video Distribution Profile (VDP) */
+
+/* Video Distribution Profile (VDP) */
+#define UUID_SERVCLASS_VIDEO_SOURCE             0X1303
+#define UUID_SERVCLASS_VIDEO_SINK               0X1304
+#define UUID_SERVCLASS_VIDEO_DISTRIBUTION       0X1305
+
 #define UUID_SERVCLASS_HDP_PROFILE              0X1400  /* Health Device profile (HDP) */
 #define UUID_SERVCLASS_HDP_SOURCE               0X1401  /* Health Device profile (HDP) */
 #define UUID_SERVCLASS_HDP_SINK                 0X1402  /* Health Device profile (HDP) */
-#define UUID_SERVCLASS_MAP_PROFILE              0X1134  /* MAP profile UUID */
-#define UUID_SERVCLASS_MESSAGE_ACCESS           0X1132  /* Message Access Service UUID */
-#define UUID_SERVCLASS_MESSAGE_NOTIFICATION     0X1133  /* Message Notification Service UUID */
+#define UUID_SERVCLASS_MAP_PROFILE              0X1134  /* MAP profile */
+#define UUID_SERVCLASS_MESSAGE_ACCESS           0X1132  /* Message Access Service */
+#define UUID_SERVCLASS_MESSAGE_NOTIFICATION     0X1133  /* Message Notification Service */
 
 #define UUID_SERVCLASS_GAP_SERVER               0x1800
 #define UUID_SERVCLASS_GATT_SERVER              0x1801
@@ -267,7 +278,7 @@
 #define UUID_SERVCLASS_PHALERT                  0x180E      /* phone alert service */
 #define UUID_SERVCLASS_BATTERY                  0x180F     /* battery service */
 #define UUID_SERVCLASS_BPM                      0x1810      /*  blood pressure service */
-#define UUID_SERVCLASS_ALERT_NOTIFICATION       0x1811      /* alert notification service */
+#define UUID_SERVCLASS_ALERT_NOTIFICATION       0x1811
 #define UUID_SERVCLASS_LE_HID                   0x1812     /*  HID over LE */
 #define UUID_SERVCLASS_SCAN_PARAM               0x1813      /* Scan Parameter service */
 #define UUID_SERVCLASS_GLUCOSE                  0x1808      /* Glucose Meter Service */
@@ -281,8 +292,8 @@
 #define UUID_CODEC_MSBC                         0x0002   /* mSBC */
 #endif
 
-#define UUID_HF_IND_ENHANCED_DRIVER_SAFETY      0x0001   /* Assigned number for Enhanced Safety */
-#define UUID_HF_IND_BATTERY_LEVEL_STATUS        0x0002   /* Assigned number for Battery Status */
+#define UUID_HF_IND_ENHANCED_DRIVER_SAFETY      0x0001   /* Enhanced Safety */
+#define UUID_HF_IND_BATTERY_LEVEL_STATUS        0x0002   /* Battery Status */
 
 /* Define all the 'Descriptor Type' values.
 */
@@ -311,7 +322,8 @@
 #define LANG_ID_CODE_ENGLISH            ((uint16_t) 0x656e)   /* "en" */
 #define LANG_ID_CHAR_ENCODE_UTF8        ((uint16_t) 0x006a)   /* UTF-8 */
 
-/* Constants used for display purposes only.  These define ovelapping attribute values */
+/* Constants used for display purposes only.  These define overlapping attribute
+ * values */
 #define  ATTR_ID_VERS_OR_GRP_OR_DRELNUM_OR_IPSUB_OR_SPECID  0x0200
 #define  ATTR_ID_VEND_ID_OR_SERVICE_DB_STATE_OR_PARSE_VER   0x0201
 #define  ATTR_ID_PROD_ID_OR_HID_DEV_SUBCLASS                0x0202
diff --git a/stack/include/smp_api.h b/stack/include/smp_api.h
index e41e3da..e238281 100644
--- a/stack/include/smp_api.h
+++ b/stack/include/smp_api.h
@@ -87,7 +87,8 @@
  *
  * Description      This function is called to start a SMP pairing over BR/EDR.
  *
- * Returns          SMP_STARTED if pairing started, otherwise reason for failure.
+ * Returns          SMP_STARTED if pairing started, otherwise the reason for the
+ *                  failure.
  *
  ******************************************************************************/
 extern tSMP_STATUS SMP_BR_PairWith (BD_ADDR bd_addr);
@@ -111,7 +112,8 @@
  *
  * Parameters       bd_addr - peer device bd address.
  *                  res     - result of the operation SMP_SUCCESS if success.
- *                            Otherwise, SMP_REPEATED_ATTEMPTS is too many attempts.
+ *                            Otherwise, SMP_REPEATED_ATTEMPTS is too many
+ *                            attempts.
  *
  * Returns          None
  *
@@ -125,10 +127,11 @@
  * Description      This function is called after Security Manager submitted
  *                  Passkey request to the application.
  *
- * Parameters:      bd_addr      - Address of the device for which PIN was requested
- *                  res          - result of the operation SMP_SUCCESS if success
- *                  passkey      - numeric value in the range of
- *                  BTM_MIN_PASSKEY_VAL(0) - BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
+ * Parameters:      bd_addr  - Address of the device for which PIN was requested
+ *                  res      - result of the operation SMP_SUCCESS if success
+ *                  passkey  - numeric value in the range of
+ *                             BTM_MIN_PASSKEY_VAL(0) -
+ *                             BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
  *
  ******************************************************************************/
 extern void SMP_PasskeyReply (BD_ADDR bd_addr, uint8_t res, uint32_t passkey);
@@ -178,8 +181,7 @@
  *
  * Function         SMP_Encrypt
  *
- * Description      This function is called to encrypt the data with the specified
- *                  key
+ * Description      Encrypt the data with the specified key.
  *
  * Parameters:      key                 - Pointer to key key[0] conatins the MSB
  *                  key_len             - key length
@@ -198,7 +200,7 @@
  *
  * Function         SMP_KeypressNotification
  *
- * Description      This function is called to notify SM about Keypress Notification.
+ * Description      Notify SM about Keypress Notification.
  *
  * Parameters:      bd_addr      - Address of the device to send keypress
  *                                 notification to
diff --git a/stack/include/smp_api_types.h b/stack/include/smp_api_types.h
index e3f08f7..9813cb2 100644
--- a/stack/include/smp_api_types.h
+++ b/stack/include/smp_api_types.h
@@ -55,11 +55,12 @@
 #define SMP_OOB_REQ_EVT         5       /* OOB request event */
 #define SMP_NC_REQ_EVT          6       /* Numeric Comparison request event */
 #define SMP_COMPLT_EVT          7       /* SMP complete event */
-#define SMP_PEER_KEYPR_NOT_EVT  8       /* Peer keypress notification received event */
-#define SMP_SC_OOB_REQ_EVT      9       /* SC OOB request event (both local and peer OOB data */
-                                        /* can be expected in response) */
-#define SMP_SC_LOC_OOB_DATA_UP_EVT  10  /* SC OOB local data set is created */
-                                        /* (as result of SMP_CrLocScOobData(...)) */
+#define SMP_PEER_KEYPR_NOT_EVT  8       /* Peer keypress notification */
+
+/* SC OOB request event (both local and peer OOB data can be expected in response) */
+#define SMP_SC_OOB_REQ_EVT      9
+/* SC OOB local data set is created (as result of SMP_CrLocScOobData(...)) */
+#define SMP_SC_LOC_OOB_DATA_UP_EVT  10
 #define SMP_BR_KEYS_REQ_EVT     12      /* SMP over BR keys request event */
 typedef uint8_t tSMP_EVT;
 
@@ -157,7 +158,8 @@
 /* No MITM, General Bonding, Encryption only */
 #define SMP_AUTH_GB_ENC_ONLY    (SMP_AUTH_GEN_BOND )
 
-/* MITM, General Bonding, Use IO Capability to determine authentication procedure */
+/* MITM, General Bonding, Use IO Capability to determine authentication
+ * procedure */
 #define SMP_AUTH_GB_IOCAP       (SMP_AUTH_GEN_BOND | SMP_AUTH_YN_BIT)
 
 /* Secure Connections, no MITM, no Bonding */
@@ -283,7 +285,8 @@
     uint8_t  param_buf[BT_OCTET16_LEN];
 } tSMP_ENC;
 
-/* Security Manager events - Called by the stack when Security Manager related events occur.*/
+/* Security Manager events - Called by the stack when Security Manager related
+ * events occur.*/
 typedef uint8_t (tSMP_CALLBACK) (tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data);
 
 /* callback function for CMAC algorithm
diff --git a/stack/include/srvc_api.h b/stack/include/srvc_api.h
index f585a00..0b34cae 100644
--- a/stack/include/srvc_api.h
+++ b/stack/include/srvc_api.h
@@ -137,8 +137,8 @@
  *
  * Function         srvc_eng_init
  *
- * Description      Initializa the GATT Service engine, register a GATT application
- *                  as for a central service management.
+ * Description      Initializa the GATT Service engine, register a GATT
+ *                  application as for a central service management.
  *
  ******************************************************************************/
 extern tGATT_STATUS srvc_eng_init (void);
diff --git a/stack/l2cap/l2c_api.cc b/stack/l2cap/l2c_api.cc
index c47e024..cba856a 100644
--- a/stack/l2cap/l2c_api.cc
+++ b/stack/l2cap/l2c_api.cc
@@ -169,8 +169,8 @@
  *
  * Function         L2CA_AllocatePSM
  *
- * Description      Other layers call this function to find an unused PSM for L2CAP
- *                  services.
+ * Description      Other layers call this function to find an unused PSM for
+ *                  L2CAP services.
  *
  * Returns          PSM to use.
  *
@@ -211,10 +211,11 @@
  *
  * Function         L2CA_ConnectReq
  *
- * Description      Higher layers call this function to create an L2CAP connection.
- *                  Note that the connection is not established at this time, but
- *                  connection establishment gets started. The callback function
- *                  will be invoked when connection establishes or fails.
+ * Description      Higher layers call this function to create an L2CAP
+ *                  connection. Note that the connection is not established at
+ *                  this time, but connection establishment gets started. The
+ *                  callback function will be invoked when connection
+ *                  establishes or fails.
  *
  * Returns          the CID of the connection, or 0 if it failed to start
  *
@@ -228,10 +229,11 @@
  *
  * Function         L2CA_ErtmConnectReq
  *
- * Description      Higher layers call this function to create an L2CAP connection.
- *                  Note that the connection is not established at this time, but
- *                  connection establishment gets started. The callback function
- *                  will be invoked when connection establishes or fails.
+ * Description      Higher layers call this function to create an L2CAP
+ *                  connection. Note that the connection is not established at
+ *                  this time, but connection establishment gets started. The
+ *                  callback function will be invoked when connection
+ *                  establishes or fails.
  *
  *  Parameters:       PSM: L2CAP PSM for the connection
  *                    BD address of the peer
@@ -459,10 +461,11 @@
  *
  * Function         L2CA_ConnectLECocReq
  *
- * Description      Higher layers call this function to create an L2CAP connection.
- *                  Note that the connection is not established at this time, but
- *                  connection establishment gets started. The callback function
- *                  will be invoked when connection establishes or fails.
+ * Description      Higher layers call this function to create an L2CAP
+ *                  connection. Note that the connection is not established at
+ *                  this time, but connection establishment gets started. The
+ *                  callback function will be invoked when connection
+ *                  establishes or fails.
  *
  *  Parameters:     PSM: L2CAP PSM for the connection
  *                  BD address of the peer
@@ -616,7 +619,8 @@
  *
  *  Function         L2CA_GetPeerLECocConfig
  *
- *  Description      Get a peers configuration for LE Connection Oriented Channel.
+ *  Description      Get a peers configuration for LE Connection Oriented
+ *                   Channel.
  *
  *  Parameters:      local channel id
  *                   Pointers to peers configuration storage area
@@ -659,10 +663,10 @@
     return false;
   }
 
-  // We're making a connection-specific registration control block so we check if
-  // we already have a private one allocated to us on the heap. If not, we make a
-  // new allocation, mark it as heap-allocated, and inherit the fields from the old
-  // control block.
+  // We're making a connection-specific registration control block so we check
+  // if we already have a private one allocated to us on the heap. If not, we
+  // make a new allocation, mark it as heap-allocated, and inherit the fields
+  // from the old control block.
   tL2C_RCB *registration_control_block = channel_control_block->p_rcb;
   if (!channel_control_block->should_free_rcb) {
     registration_control_block = (tL2C_RCB *)osi_calloc(sizeof(tL2C_RCB));
@@ -1079,12 +1083,12 @@
  * Function         L2CA_SetIdleTimeout
  *
  * Description      Higher layers call this function to set the idle timeout for
- *                  a connection, or for all future connections. The "idle timeout"
- *                  is the amount of time that a connection can remain up with
- *                  no L2CAP channels on it. A timeout of zero means that the
- *                  connection will be torn down immediately when the last channel
- *                  is removed. A timeout of 0xFFFF means no timeout. Values are
- *                  in seconds.
+ *                  a connection, or for all future connections. The "idle
+ *                  timeout" is the amount of time that a connection can remain
+ *                  up with no L2CAP channels on it. A timeout of zero means
+ *                  that the connection will be torn down immediately when the
+ *                  last channel is removed. A timeout of 0xFFFF means no
+ *                  timeout. Values are in seconds.
  *
  * Returns          true if command succeeded, false if failed
  *
@@ -1204,11 +1208,12 @@
  * Description  This function sets the desire role for L2CAP.
  *              If the new role is L2CAP_ROLE_ALLOW_SWITCH, allow switch on
  *              HciCreateConnection.
- *              If the new role is L2CAP_ROLE_DISALLOW_SWITCH, do not allow switch on
- *              HciCreateConnection.
+ *              If the new role is L2CAP_ROLE_DISALLOW_SWITCH, do not allow
+ *              switch on HciCreateConnection.
  *
- *              If the new role is a valid role (HCI_ROLE_MASTER or HCI_ROLE_SLAVE),
- *              the desire role is set to the new value. Otherwise, it is not changed.
+ *              If the new role is a valid role (HCI_ROLE_MASTER or
+ *              HCI_ROLE_SLAVE), the desire role is set to the new value.
+ *              Otherwise, it is not changed.
  *
  * Returns      the new (current) role
  *
@@ -1464,20 +1469,23 @@
  *
  * Description      This function set the automatic flush time out in Baseband
  *                  for ACL-U packets.
- *                  BdAddr : the remote BD address of ACL link. If it is BT_DB_ANY
- *                           then the flush time out will be applied to all ACL link.
+ *                  BdAddr : the remote BD address of ACL link. If it is
+ *                          BT_DB_ANY then the flush time out will be applied to
+ *                          all ACL links.
  *                  FlushTimeout: flush time out in ms
  *                           0x0000 : No automatic flush
  *                           L2CAP_NO_RETRANSMISSION : No retransmission
- *                           0x0002 - 0xFFFE : flush time out, if (flush_tout*8)+3/5)
- *                                    <= HCI_MAX_AUTO_FLUSH_TOUT (in 625us slot).
+ *                           0x0002 - 0xFFFE : flush time out, if
+ *                                            (flush_tout * 8) + 3 / 5) <=
+ *                                             HCI_MAX_AUTO_FLUSH_TOUT
+ *                                            (in 625us slot).
  *                                    Otherwise, return false.
  *                           L2CAP_NO_AUTOMATIC_FLUSH : No automatic flush
  *
  * Returns          true if command succeeded, false if failed
  *
- * NOTE             This flush timeout applies to all logical channels active on the
- *                  ACL link.
+ * NOTE             This flush timeout applies to all logical channels active on
+ *                  the ACL link.
  ******************************************************************************/
 bool    L2CA_SetFlushTimeout (BD_ADDR bd_addr, uint16_t flush_tout)
 {
@@ -1951,12 +1959,12 @@
     p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL] = NULL;
     p_lcb->disc_reason = HCI_ERR_CONN_CAUSE_LOCAL_HOST;
 
-    // Retain the link for a few more seconds after SMP pairing is done, since the Android
-    // platform always does service discovery after pairing is complete. This will avoid
-    // the link down (pairing is complete) and an immediate re-connection for service
-    // discovery.
-    // Some devices do not do auto advertising when link is dropped, thus fail the second
-    // connection and service discovery.
+    // Retain the link for a few more seconds after SMP pairing is done, since
+    // the Android platform always does service discovery after pairing is
+    // complete. This will avoid the link down (pairing is complete) and an
+    // immediate re-connection for service discovery.
+    // Some devices do not do auto advertising when link is dropped, thus fail
+    // the second connection and service discovery.
     if ((fixed_cid == L2CAP_ATT_CID ) && !p_lcb->ccb_queue.p_first_ccb)
         p_lcb->idle_timeout = 0;
 
@@ -1970,9 +1978,9 @@
  * Function         L2CA_SetFixedChannelTout
  *
  * Description      Higher layers call this function to set the idle timeout for
- *                  a fixed channel. The "idle timeout" is the amount of time that
- *                  a connection can remain up with no L2CAP channels on it.
- *                  A timeout of zero means that the connection will be torn
+ *                  a fixed channel. The "idle timeout" is the amount of time
+ *                  that a connection can remain up with no L2CAP channels on
+ *                  it. A timeout of zero means that the connection will be torn
  *                  down immediately when the last channel is removed.
  *                  A timeout of 0xFFFF means no timeout. Values are in seconds.
  *                  A bd_addr is the remote BD address. If bd_addr = BT_BD_ANY,
@@ -2132,7 +2140,8 @@
  * Description      Higher layers call this function to write data.
  *
  * Returns          L2CAP_DW_SUCCESS, if data accepted, else false
- *                  L2CAP_DW_CONGESTED, if data accepted and the channel is congested
+ *                  L2CAP_DW_CONGESTED, if data accepted and the channel is
+ *                                      congested
  *                  L2CAP_DW_FAILED, if error
  *
  ******************************************************************************/
@@ -2186,7 +2195,8 @@
  *                          L2CAP_NON_FLUSHABLE_PKT
  *
  * Returns          L2CAP_DW_SUCCESS, if data accepted, else false
- *                  L2CAP_DW_CONGESTED, if data accepted and the channel is congested
+ *                  L2CAP_DW_CONGESTED, if data accepted and the channel is
+ *                                      congested
  *                  L2CAP_DW_FAILED, if error
  *
  ******************************************************************************/
diff --git a/stack/l2cap/l2c_ble.cc b/stack/l2cap/l2c_ble.cc
index 80a1a57..50d3f6e 100644
--- a/stack/l2cap/l2c_ble.cc
+++ b/stack/l2cap/l2c_ble.cc
@@ -347,7 +347,8 @@
  * Function         l2cble_advertiser_conn_comp
  *
  * Description      This function is called when an HCI Connection Complete
- *                  event is received while we are an advertiser (so we are slave).
+ *                  event is received while we are an advertiser (so we are
+ *                  slave).
  *
  * Returns          void
  *
@@ -449,7 +450,8 @@
  *
  *  Function        l2cble_start_conn_update
  *
- *  Description     start BLE connection parameter update process based on status
+ *  Description     Start the BLE connection parameter update process based on
+ *                  status.
  *
  *  Parameters:     lcb : l2cap link control block
  *
@@ -534,8 +536,9 @@
  *
  * Function         l2cble_process_conn_update_evt
  *
- * Description      This function enables the connection update request from remote
- *                  after a successful connection update response is received.
+ * Description      This function enables the connection update request from
+ *                  remote after a successful connection update response is
+ *                  received.
  *
  * Returns          void
  *
@@ -1212,7 +1215,8 @@
  *
  * Function         l2cble_set_fixed_channel_tx_data_length
  *
- * Description      This function update max fixed channel tx data length if applicable
+ * Description      This function update max fixed channel tx data length if
+ *                  applicable
  *
  * Returns          void
  *
@@ -1351,8 +1355,8 @@
  *
  * Function         l2cble_sec_comp
  *
- * Description      This function is called when security procedure for an LE COC
- *                  link is done
+ * Description      This function is called when security procedure for an LE
+ *                  COC link is done
  *
  * Returns          void
  *
diff --git a/stack/l2cap/l2c_csm.cc b/stack/l2cap/l2c_csm.cc
index 258326c..989cf0a 100644
--- a/stack/l2cap/l2c_csm.cc
+++ b/stack/l2cap/l2c_csm.cc
@@ -40,7 +40,7 @@
 extern fixed_queue_t *btu_general_alarm_queue;
 
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 static void l2c_csm_closed (tL2C_CCB *p_ccb, uint16_t event, void *p_data);
 static void l2c_csm_orig_w4_sec_comp (tL2C_CCB *p_ccb, uint16_t event, void *p_data);
diff --git a/stack/l2cap/l2c_fcr.cc b/stack/l2cap/l2c_fcr.cc
index 566454f..478b960 100644
--- a/stack/l2cap/l2c_fcr.cc
+++ b/stack/l2cap/l2c_fcr.cc
@@ -41,7 +41,8 @@
 
 extern fixed_queue_t *btu_general_alarm_queue;
 
-/* Flag passed to retransmit_i_frames() when all packets should be retransmitted */
+/* Flag passed to retransmit_i_frames() when all packets should be retransmitted
+ */
 #define L2C_FCR_RETX_ALL_PKTS   0xFF
 
 /* this is the minimal offset required by OBX to process incoming packets */
@@ -212,7 +213,8 @@
  *
  * Function         l2c_fcr_cleanup
  *
- * Description      This function cleans up the variable used for flow-control/retrans.
+ * Description      This function cleans up the variable used for
+ *                  flow-control/retrans.
  *
  * Returns          -
  *
@@ -316,8 +318,8 @@
  *
  * Function         l2c_fcr_clone_buf
  *
- * Description      This function allocates and copies requested part of a buffer
- *                  at a new-offset.
+ * Description      This function allocates and copies requested part of a
+ *                  buffer at a new-offset.
  *
  * Returns          pointer to new buffer
  *
@@ -581,7 +583,8 @@
  * Function         l2c_fcr_proc_pdu
  *
  * Description      This function is the entry point for processing of a
- *                  received PDU when in flow control and/or retransmission modes.
+ *                  received PDU when in flow control and/or retransmission
+ *                  modes.
  *
  * Returns          -
  *
@@ -1829,7 +1832,8 @@
  *
  * Function         l2c_lcc_get_next_xmit_sdu_seg
  *
- * Description      Get the next SDU segment to transmit for LE connection oriented channel
+ * Description      Get the next SDU segment to transmit for LE connection
+ *                  oriented channel
  *
  * Returns          pointer to buffer with segment or NULL
  *
@@ -1941,7 +1945,8 @@
  *                  Note: This assumes peer EXT Features have been received.
  *                      Basic mode is used if FCR Options have not been received
  *
- * Returns          uint8_t - nonzero if can continue, '0' if no compatible channels
+ * Returns          uint8_t - nonzero if can continue, '0' if no compatible
+ *                            channels
  *
  ******************************************************************************/
 uint8_t l2c_fcr_chk_chan_modes (tL2C_CCB *p_ccb)
diff --git a/stack/l2cap/l2c_int.h b/stack/l2cap/l2c_int.h
index f3d263e..47ff36d 100644
--- a/stack/l2cap/l2c_int.h
+++ b/stack/l2cap/l2c_int.h
@@ -74,15 +74,15 @@
 */
 typedef enum
 {
-    CST_CLOSED,                           /* Channel is in closed state           */
-    CST_ORIG_W4_SEC_COMP,                 /* Originator waits security clearence  */
-    CST_TERM_W4_SEC_COMP,                 /* Acceptor waits security clearence    */
-    CST_W4_L2CAP_CONNECT_RSP,             /* Waiting for peer conenct response    */
-    CST_W4_L2CA_CONNECT_RSP,              /* Waiting for upper layer connect rsp  */
-    CST_CONFIG,                           /* Negotiating configuration            */
-    CST_OPEN,                             /* Data transfer state                  */
-    CST_W4_L2CAP_DISCONNECT_RSP,          /* Waiting for peer disconnect rsp      */
-    CST_W4_L2CA_DISCONNECT_RSP            /* Waiting for upper layer disc rsp     */
+    CST_CLOSED,                           /* Channel is in closed state */
+    CST_ORIG_W4_SEC_COMP,                 /* Originator waits security clearence */
+    CST_TERM_W4_SEC_COMP,                 /* Acceptor waits security clearence */
+    CST_W4_L2CAP_CONNECT_RSP,             /* Waiting for peer conenct response */
+    CST_W4_L2CA_CONNECT_RSP,              /* Waiting for upper layer connect rsp */
+    CST_CONFIG,                           /* Negotiating configuration */
+    CST_OPEN,                             /* Data transfer state */
+    CST_W4_L2CAP_DISCONNECT_RSP,          /* Waiting for peer disconnect rsp */
+    CST_W4_L2CA_DISCONNECT_RSP            /* Waiting for upper layer disc rsp */
 } tL2C_CHNL_STATE;
 
 /* Define the possible L2CAP link states
@@ -103,45 +103,52 @@
  * of the events may seem a bit strange, but they are taken from
  * the Bluetooth specification.
 */
-#define L2CEVT_LP_CONNECT_CFM          0          /* Lower layer connect confirm          */
-#define L2CEVT_LP_CONNECT_CFM_NEG      1          /* Lower layer connect confirm (failed) */
-#define L2CEVT_LP_CONNECT_IND          2          /* Lower layer connect indication       */
-#define L2CEVT_LP_DISCONNECT_IND       3          /* Lower layer disconnect indication    */
-#define L2CEVT_LP_QOS_CFM              4          /* Lower layer QOS confirmation         */
-#define L2CEVT_LP_QOS_CFM_NEG          5          /* Lower layer QOS confirmation (failed)*/
-#define L2CEVT_LP_QOS_VIOLATION_IND    6          /* Lower layer QOS violation indication */
+/* Lower layer */
+#define L2CEVT_LP_CONNECT_CFM          0          /* connect confirm */
+#define L2CEVT_LP_CONNECT_CFM_NEG      1          /* connect confirm (failed) */
+#define L2CEVT_LP_CONNECT_IND          2          /* connect indication */
+#define L2CEVT_LP_DISCONNECT_IND       3          /* disconnect indication */
+#define L2CEVT_LP_QOS_CFM              4          /* QOS confirmation */
+#define L2CEVT_LP_QOS_CFM_NEG          5          /* QOS confirmation (failed)*/
+#define L2CEVT_LP_QOS_VIOLATION_IND    6          /* QOS violation indication */
 
-#define L2CEVT_SEC_COMP                7          /* Security cleared successfully        */
-#define L2CEVT_SEC_COMP_NEG            8          /* Security procedure failed            */
+/* Security */
+#define L2CEVT_SEC_COMP                7          /* cleared successfully */
+#define L2CEVT_SEC_COMP_NEG            8          /* procedure failed */
 
-#define L2CEVT_L2CAP_CONNECT_REQ      10          /* Peer connection request              */
-#define L2CEVT_L2CAP_CONNECT_RSP      11          /* Peer connection response             */
-#define L2CEVT_L2CAP_CONNECT_RSP_PND  12          /* Peer connection response pending     */
-#define L2CEVT_L2CAP_CONNECT_RSP_NEG  13          /* Peer connection response (failed)    */
-#define L2CEVT_L2CAP_CONFIG_REQ       14          /* Peer configuration request           */
-#define L2CEVT_L2CAP_CONFIG_RSP       15          /* Peer configuration response          */
-#define L2CEVT_L2CAP_CONFIG_RSP_NEG   16          /* Peer configuration response (failed) */
-#define L2CEVT_L2CAP_DISCONNECT_REQ   17          /* Peer disconnect request              */
-#define L2CEVT_L2CAP_DISCONNECT_RSP   18          /* Peer disconnect response             */
-#define L2CEVT_L2CAP_INFO_RSP         19          /* Peer information response            */
-#define L2CEVT_L2CAP_DATA             20          /* Peer data                            */
+/* Peer connection */
+#define L2CEVT_L2CAP_CONNECT_REQ      10          /* request */
+#define L2CEVT_L2CAP_CONNECT_RSP      11          /* response */
+#define L2CEVT_L2CAP_CONNECT_RSP_PND  12          /* response pending */
+#define L2CEVT_L2CAP_CONNECT_RSP_NEG  13          /* response (failed) */
 
-#define L2CEVT_L2CA_CONNECT_REQ       21          /* Upper layer connect request          */
-#define L2CEVT_L2CA_CONNECT_RSP       22          /* Upper layer connect response         */
-#define L2CEVT_L2CA_CONNECT_RSP_NEG   23          /* Upper layer connect response (failed)*/
-#define L2CEVT_L2CA_CONFIG_REQ        24          /* Upper layer config request           */
-#define L2CEVT_L2CA_CONFIG_RSP        25          /* Upper layer config response          */
-#define L2CEVT_L2CA_CONFIG_RSP_NEG    26          /* Upper layer config response (failed) */
-#define L2CEVT_L2CA_DISCONNECT_REQ    27          /* Upper layer disconnect request       */
-#define L2CEVT_L2CA_DISCONNECT_RSP    28          /* Upper layer disconnect response      */
-#define L2CEVT_L2CA_DATA_READ         29          /* Upper layer data read                */
-#define L2CEVT_L2CA_DATA_WRITE        30          /* Upper layer data write               */
-#define L2CEVT_L2CA_FLUSH_REQ         31          /* Upper layer flush                    */
+/* Peer configuration */
+#define L2CEVT_L2CAP_CONFIG_REQ       14          /* request */
+#define L2CEVT_L2CAP_CONFIG_RSP       15          /* response */
+#define L2CEVT_L2CAP_CONFIG_RSP_NEG   16          /* response (failed) */
 
-#define L2CEVT_TIMEOUT                32          /* Timeout                              */
-#define L2CEVT_SEC_RE_SEND_CMD        33          /* btm_sec has enough info to proceed   */
+#define L2CEVT_L2CAP_DISCONNECT_REQ   17          /* Peer disconnect request */
+#define L2CEVT_L2CAP_DISCONNECT_RSP   18          /* Peer disconnect response */
+#define L2CEVT_L2CAP_INFO_RSP         19          /* Peer information response */
+#define L2CEVT_L2CAP_DATA             20          /* Peer data */
 
-#define L2CEVT_ACK_TIMEOUT            34          /* RR delay timeout                     */
+/* Upper layer */
+#define L2CEVT_L2CA_CONNECT_REQ       21          /* connect request */
+#define L2CEVT_L2CA_CONNECT_RSP       22          /* connect response */
+#define L2CEVT_L2CA_CONNECT_RSP_NEG   23          /* connect response (failed)*/
+#define L2CEVT_L2CA_CONFIG_REQ        24          /* config request */
+#define L2CEVT_L2CA_CONFIG_RSP        25          /* config response */
+#define L2CEVT_L2CA_CONFIG_RSP_NEG    26          /* config response (failed) */
+#define L2CEVT_L2CA_DISCONNECT_REQ    27          /* disconnect request */
+#define L2CEVT_L2CA_DISCONNECT_RSP    28          /* disconnect response */
+#define L2CEVT_L2CA_DATA_READ         29          /* data read */
+#define L2CEVT_L2CA_DATA_WRITE        30          /* data write */
+#define L2CEVT_L2CA_FLUSH_REQ         31          /* flush */
+
+#define L2CEVT_TIMEOUT                32          /* Timeout */
+#define L2CEVT_SEC_RE_SEND_CMD        33          /* btm_sec has enough info to proceed */
+
+#define L2CEVT_ACK_TIMEOUT            34          /* RR delay timeout */
 
 #define L2CEVT_L2CA_SEND_FLOW_CONTROL_CREDIT     35    /* Upper layer credit packet */
 #define L2CEVT_L2CAP_RECV_FLOW_CONTROL_CREDIT    36    /* Peer credit packet */
@@ -158,8 +165,10 @@
 #define L2CAP_PEER_CFG_DISCONNECT       2
 
 /* eL2CAP option constants */
-#define L2CAP_MIN_RETRANS_TOUT          2000    /* Min retransmission timeout if no flush timeout or PBF */
-#define L2CAP_MIN_MONITOR_TOUT          12000   /* Min monitor timeout if no flush timeout or PBF */
+/* Min retransmission timeout if no flush timeout or PBF */
+#define L2CAP_MIN_RETRANS_TOUT          2000
+/* Min monitor timeout if no flush timeout or PBF */
+#define L2CAP_MIN_MONITOR_TOUT          12000
 
 #define L2CAP_MAX_FCR_CFG_TRIES         2       /* Config attempts before disconnecting */
 
@@ -167,44 +176,44 @@
 
 typedef struct
 {
-    uint8_t     next_tx_seq;                /* Next sequence number to be Tx'ed         */
-    uint8_t     last_rx_ack;                /* Last sequence number ack'ed by the peer  */
-    uint8_t     next_seq_expected;          /* Next peer sequence number expected       */
-    uint8_t     last_ack_sent;              /* Last peer sequence number ack'ed         */
-    uint8_t     num_tries;                  /* Number of retries to send a packet       */
-    uint8_t     max_held_acks;              /* Max acks we can hold before sending      */
+    uint8_t     next_tx_seq;                /* Next sequence number to be Tx'ed */
+    uint8_t     last_rx_ack;                /* Last sequence number ack'ed by the peer */
+    uint8_t     next_seq_expected;          /* Next peer sequence number expected */
+    uint8_t     last_ack_sent;              /* Last peer sequence number ack'ed */
+    uint8_t     num_tries;                  /* Number of retries to send a packet */
+    uint8_t     max_held_acks;              /* Max acks we can hold before sending */
 
-    bool        remote_busy;                /* true if peer has flowed us off           */
-    bool        local_busy;                 /* true if we have flowed off the peer      */
+    bool        remote_busy;                /* true if peer has flowed us off */
+    bool        local_busy;                 /* true if we have flowed off the peer */
 
-    bool        rej_sent;                   /* Reject was sent                          */
-    bool        srej_sent;                  /* Selective Reject was sent                */
-    bool        wait_ack;                   /* Transmitter is waiting ack (poll sent)   */
-    bool        rej_after_srej;             /* Send a REJ when SREJ clears              */
+    bool        rej_sent;                   /* Reject was sent */
+    bool        srej_sent;                  /* Selective Reject was sent */
+    bool        wait_ack;                   /* Transmitter is waiting ack (poll sent) */
+    bool        rej_after_srej;             /* Send a REJ when SREJ clears */
 
-    bool        send_f_rsp;                 /* We need to send an F-bit response        */
+    bool        send_f_rsp;                 /* We need to send an F-bit response */
 
-    uint16_t    rx_sdu_len;                 /* Length of the SDU being received         */
-    BT_HDR      *p_rx_sdu;                  /* Buffer holding the SDU being received    */
+    uint16_t    rx_sdu_len;                 /* Length of the SDU being received */
+    BT_HDR      *p_rx_sdu;                  /* Buffer holding the SDU being received */
     fixed_queue_t *waiting_for_ack_q;       /* Buffers sent and waiting for peer to ack */
-    fixed_queue_t *srej_rcv_hold_q;         /* Buffers rcvd but held pending SREJ rsp   */
-    fixed_queue_t *retrans_q;               /* Buffers being retransmitted              */
+    fixed_queue_t *srej_rcv_hold_q;         /* Buffers rcvd but held pending SREJ rsp */
+    fixed_queue_t *retrans_q;               /* Buffers being retransmitted */
 
-    alarm_t       *ack_timer;                /* Timer delaying RR                        */
-    alarm_t       *mon_retrans_timer;       /* Timer Monitor or Retransmission          */
+    alarm_t       *ack_timer;                /* Timer delaying RR */
+    alarm_t       *mon_retrans_timer;       /* Timer Monitor or Retransmission */
 
 #if (L2CAP_ERTM_STATS == TRUE)
-    uint32_t    connect_tick_count;         /* Time channel was established             */
-    uint32_t    ertm_pkt_counts[2];         /* Packets sent and received                */
-    uint32_t    ertm_byte_counts[2];        /* Bytes   sent and received                */
-    uint32_t    s_frames_sent[4];           /* S-frames sent (RR, REJ, RNR, SREJ)       */
-    uint32_t    s_frames_rcvd[4];           /* S-frames rcvd (RR, REJ, RNR, SREJ)       */
-    uint32_t    xmit_window_closed;         /* # of times the xmit window was closed    */
+    uint32_t    connect_tick_count;         /* Time channel was established */
+    uint32_t    ertm_pkt_counts[2];         /* Packets sent and received */
+    uint32_t    ertm_byte_counts[2];        /* Bytes   sent and received */
+    uint32_t    s_frames_sent[4];           /* S-frames sent (RR, REJ, RNR, SREJ) */
+    uint32_t    s_frames_rcvd[4];           /* S-frames rcvd (RR, REJ, RNR, SREJ) */
+    uint32_t    xmit_window_closed;         /* # of times the xmit window was closed */
     uint32_t    controller_idle;            /* # of times less than 2 packets in controller */
-                                            /* when the xmit window was closed          */
-    uint32_t    pkts_retransmitted;         /* # of packets that were retransmitted     */
-    uint32_t    retrans_touts;              /* # of retransmission timouts              */
-    uint32_t    xmit_ack_touts;             /* # of xmit ack timouts                    */
+                                            /* when the xmit window was closed */
+    uint32_t    pkts_retransmitted;         /* # of packets that were retransmitted */
+    uint32_t    retrans_touts;              /* # of retransmission timouts */
+    uint32_t    xmit_ack_touts;             /* # of xmit ack timouts */
 
 #define L2CAP_ERTM_STATS_NUM_AVG 10
 #define L2CAP_ERTM_STATS_AVG_NUM_SAMPLES 100
@@ -244,7 +253,7 @@
     bool                    in_use;
     uint16_t                psm;
     uint16_t                real_psm;               /* This may be a dummy RCB for an o/b connection but */
-                                                    /* this is the real PSM that we need to connect to   */
+                                                    /* this is the real PSM that we need to connect to */
 #if (L2CAP_UCD_INCLUDED == TRUE)
     tL2C_UCD_REG            ucd;
 #endif
@@ -269,26 +278,26 @@
     void                    *p_ref_data;
 }tL2CAP_SEC_DATA;
 
-/* Define a channel control block (CCB). There may be many channel control blocks
- * between the same two Bluetooth devices (i.e. on the same link).
+/* Define a channel control block (CCB). There may be many channel control
+ * blocks between the same two Bluetooth devices (i.e. on the same link).
  * Each CCB has unique local and remote CIDs. All channel control blocks on
  * the same physical link and are chained together.
 */
 typedef struct t_l2c_ccb
 {
     bool                in_use;                 /* true when in use, false when not */
-    tL2C_CHNL_STATE     chnl_state;             /* Channel state                    */
+    tL2C_CHNL_STATE     chnl_state;             /* Channel state */
     tL2CAP_LE_CFG_INFO  local_conn_cfg;         /* Our config for ble conn oriented channel */
     tL2CAP_LE_CFG_INFO  peer_conn_cfg;          /* Peer device config ble conn oriented channel */
     bool                is_first_seg;           /* Dtermine whether the received packet is the first segment or not */
     BT_HDR*             ble_sdu;                /* Buffer for storing unassembled sdu*/
     uint16_t            ble_sdu_length;         /* Length of unassembled sdu length*/
-    struct t_l2c_ccb    *p_next_ccb;            /* Next CCB in the chain            */
-    struct t_l2c_ccb    *p_prev_ccb;            /* Previous CCB in the chain        */
-    struct t_l2c_linkcb *p_lcb;                 /* Link this CCB is assigned to     */
+    struct t_l2c_ccb    *p_next_ccb;            /* Next CCB in the chain */
+    struct t_l2c_ccb    *p_prev_ccb;            /* Previous CCB in the chain */
+    struct t_l2c_linkcb *p_lcb;                 /* Link this CCB is assigned to */
 
-    uint16_t            local_cid;              /* Local CID                        */
-    uint16_t            remote_cid;             /* Remote CID                       */
+    uint16_t            local_cid;              /* Local CID */
+    uint16_t            remote_cid;             /* Remote CID */
 
     alarm_t             *l2c_ccb_timer;         /* CCB Timer Entry */
 
@@ -300,25 +309,25 @@
 #define RECONFIG_FLAG   0x04                    /* True after initial configuration */
 #define CFG_DONE_MASK   (IB_CFG_DONE | OB_CFG_DONE)
 
-    uint8_t             config_done;            /* Configuration flag word         */
-    uint8_t             local_id;               /* Transaction ID for local trans  */
-    uint8_t             remote_id;              /* Transaction ID for local  */
+    uint8_t             config_done;            /* Configuration flag word */
+    uint8_t             local_id;               /* Transaction ID for local trans */
+    uint8_t             remote_id;              /* Transaction ID for local */
 
 #define CCB_FLAG_NO_RETRY       0x01            /* no more retry */
 #define CCB_FLAG_SENT_PENDING   0x02            /* already sent pending response */
     uint8_t             flags;
 
-    tL2CAP_CFG_INFO     our_cfg;                /* Our saved configuration options    */
+    tL2CAP_CFG_INFO     our_cfg;                /* Our saved configuration options */
     tL2CAP_CH_CFG_BITS  peer_cfg_bits;          /* Store what peer wants to configure */
     tL2CAP_CFG_INFO     peer_cfg;               /* Peer's saved configuration options */
 
-    fixed_queue_t       *xmit_hold_q;            /* Transmit data hold queue         */
-    bool                cong_sent;              /* Set when congested status sent   */
-    uint16_t            buff_quota;             /* Buffer quota before sending congestion   */
+    fixed_queue_t       *xmit_hold_q;            /* Transmit data hold queue */
+    bool                cong_sent;              /* Set when congested status sent */
+    uint16_t            buff_quota;             /* Buffer quota before sending congestion */
 
-    tL2CAP_CHNL_PRIORITY ccb_priority;          /* Channel priority                 */
-    tL2CAP_CHNL_DATA_RATE tx_data_rate;         /* Channel Tx data rate             */
-    tL2CAP_CHNL_DATA_RATE rx_data_rate;         /* Channel Rx data rate             */
+    tL2CAP_CHNL_PRIORITY ccb_priority;          /* Channel priority */
+    tL2CAP_CHNL_DATA_RATE tx_data_rate;         /* Channel Tx data rate */
+    tL2CAP_CHNL_DATA_RATE rx_data_rate;         /* Channel Rx data rate */
 
     /* Fields used for eL2CAP */
     tL2CAP_ERTM_INFO    ertm_info;
@@ -335,11 +344,11 @@
     uint8_t             bypass_fcs;
 
 #if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
-    bool                is_flushable;                   /* true if channel is flushable     */
+    bool                is_flushable;                   /* true if channel is flushable */
 #endif
 
 #if (L2CAP_NUM_FIXED_CHNLS > 0 || L2CAP_UCD_INCLUDED == TRUE)
-    uint16_t            fixed_chnl_idle_tout;   /* Idle timeout to use for the fixed channel       */
+    uint16_t            fixed_chnl_idle_tout;   /* Idle timeout to use for the fixed channel */
 #endif
     uint16_t            tx_data_len;
 } tL2C_CCB;
@@ -360,10 +369,11 @@
 #define L2CAP_CHNL_PRIORITY_WEIGHT  5           /* weight per priority for burst transmission quota */
 #define L2CAP_GET_PRIORITY_QUOTA(pri) ((L2CAP_NUM_CHNL_PRIORITY - (pri)) * L2CAP_CHNL_PRIORITY_WEIGHT)
 
-/* CCBs within the same LCB are served in round robin with priority                       */
-/* It will make sure that low priority channel (for example, HF signaling on RFCOMM)      */
-/* can be sent to headset even if higher priority channel (for example, AV media channel) */
-/* is congested.                                                                          */
+/* CCBs within the same LCB are served in round robin with priority It will make
+ * sure that low priority channel (for example, HF signaling on RFCOMM) can be
+ * sent to the headset even if higher priority channel (for example, AV media
+ * channel) is congested.
+ */
 
 typedef struct
 {
@@ -384,44 +394,44 @@
     tL2C_LINK_STATE     link_state;
 
     alarm_t             *l2c_lcb_timer;             /* Timer entry for timeout evt */
-    uint16_t            handle;                     /* The handle used with LM          */
+    uint16_t            handle;                     /* The handle used with LM */
 
-    tL2C_CCB_Q          ccb_queue;                  /* Queue of CCBs on this LCB        */
+    tL2C_CCB_Q          ccb_queue;                  /* Queue of CCBs on this LCB */
 
     tL2C_CCB            *p_pending_ccb;             /* ccb of waiting channel during link disconnect */
     alarm_t             *info_resp_timer;           /* Timer entry for info resp timeout evt */
-    BD_ADDR             remote_bd_addr;             /* The BD address of the remote     */
+    BD_ADDR             remote_bd_addr;             /* The BD address of the remote */
 
-    uint8_t             link_role;                  /* Master or slave                  */
+    uint8_t             link_role;                  /* Master or slave */
     uint8_t             id;
     uint8_t             cur_echo_id;                /* Current id value for echo request */
-    tL2CA_ECHO_RSP_CB   *p_echo_rsp_cb;             /* Echo response callback           */
-    uint16_t            idle_timeout;               /* Idle timeout                     */
+    tL2CA_ECHO_RSP_CB   *p_echo_rsp_cb;             /* Echo response callback */
+    uint16_t            idle_timeout;               /* Idle timeout */
     bool                is_bonding;                 /* True - link active only for bonding */
 
-    uint16_t            link_flush_tout;            /* Flush timeout used               */
+    uint16_t            link_flush_tout;            /* Flush timeout used */
 
-    uint16_t            link_xmit_quota;            /* Num outstanding pkts allowed     */
-    uint16_t            sent_not_acked;             /* Num packets sent but not acked   */
+    uint16_t            link_xmit_quota;            /* Num outstanding pkts allowed */
+    uint16_t            sent_not_acked;             /* Num packets sent but not acked */
 
-    bool                partial_segment_being_sent; /* Set true when a partial segment  */
-                                                    /* is being sent.                   */
+    bool                partial_segment_being_sent; /* Set true when a partial segment */
+                                                    /* is being sent. */
     bool                w4_info_rsp;                /* true when info request is active */
     uint8_t             info_rx_bits;               /* set 1 if received info type */
-    uint32_t            peer_ext_fea;               /* Peer's extended features mask    */
-    list_t              *link_xmit_data_q;          /* Link transmit data buffer queue  */
+    uint32_t            peer_ext_fea;               /* Peer's extended features mask */
+    list_t              *link_xmit_data_q;          /* Link transmit data buffer queue */
 
     uint8_t             peer_chnl_mask[L2CAP_FIXED_CHNL_ARRAY_SIZE];
 #if (L2CAP_UCD_INCLUDED == TRUE)
     uint16_t            ucd_mtu;                    /* peer MTU on UCD */
-    fixed_queue_t       *ucd_out_sec_pending_q;     /* Security pending outgoing UCD packet  */
-    fixed_queue_t       *ucd_in_sec_pending_q;       /* Security pending incoming UCD packet  */
+    fixed_queue_t       *ucd_out_sec_pending_q;     /* Security pending outgoing UCD packet */
+    fixed_queue_t       *ucd_in_sec_pending_q;       /* Security pending incoming UCD packet */
 #endif
 
-    BT_HDR              *p_hcit_rcv_acl;            /* Current HCIT ACL buf being rcvd  */
-    uint16_t            idle_timeout_sv;            /* Save current Idle timeout        */
+    BT_HDR              *p_hcit_rcv_acl;            /* Current HCIT ACL buf being rcvd */
+    uint16_t            idle_timeout_sv;            /* Save current Idle timeout */
     uint8_t             acl_priority;               /* L2C_PRIORITY_NORMAL or L2C_PRIORITY_HIGH */
-    tL2CA_NOCP_CB       *p_nocp_cb;                 /* Num Cmpl pkts callback           */
+    tL2CA_NOCP_CB       *p_nocp_cb;                 /* Num Cmpl pkts callback */
 
 #if (L2CAP_NUM_FIXED_CHNLS > 0)
     tL2C_CCB            *p_fixed_ccbs[L2CAP_NUM_FIXED_CHNLS];
@@ -445,7 +455,7 @@
     uint16_t            timeout;
 
 #if (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE)
-    /* each priority group is limited burst transmission  */
+    /* each priority group is limited burst transmission */
     /* round robin service for the same priority channels */
     tL2C_RR_SERV        rr_serv[L2CAP_NUM_CHNL_PRIORITY];
     uint8_t             rr_pri;                             /* current serving priority group */
@@ -458,31 +468,31 @@
 typedef struct
 {
     uint8_t         l2cap_trace_level;
-    uint16_t        controller_xmit_window;         /* Total ACL window for all links   */
+    uint16_t        controller_xmit_window;         /* Total ACL window for all links */
 
-    uint16_t        round_robin_quota;              /* Round-robin link quota           */
-    uint16_t        round_robin_unacked;            /* Round-robin unacked              */
-    bool            check_round_robin;              /* Do a round robin check           */
+    uint16_t        round_robin_quota;              /* Round-robin link quota */
+    uint16_t        round_robin_unacked;            /* Round-robin unacked */
+    bool            check_round_robin;              /* Do a round robin check */
 
     bool            is_cong_cback_context;
 
-    tL2C_LCB        lcb_pool[MAX_L2CAP_LINKS];      /* Link Control Block pool          */
-    tL2C_CCB        ccb_pool[MAX_L2CAP_CHANNELS];   /* Channel Control Block pool       */
-    tL2C_RCB        rcb_pool[MAX_L2CAP_CLIENTS];    /* Registration info pool           */
+    tL2C_LCB        lcb_pool[MAX_L2CAP_LINKS];      /* Link Control Block pool */
+    tL2C_CCB        ccb_pool[MAX_L2CAP_CHANNELS];   /* Channel Control Block pool */
+    tL2C_RCB        rcb_pool[MAX_L2CAP_CLIENTS];    /* Registration info pool */
 
-    tL2C_CCB        *p_free_ccb_first;              /* Pointer to first free CCB        */
-    tL2C_CCB        *p_free_ccb_last;               /* Pointer to last  free CCB        */
+    tL2C_CCB        *p_free_ccb_first;              /* Pointer to first free CCB */
+    tL2C_CCB        *p_free_ccb_last;               /* Pointer to last  free CCB */
 
     uint8_t         desire_role;                    /* desire to be master/slave when accepting a connection */
     bool            disallow_switch;                /* false, to allow switch at create conn */
-    uint16_t        num_lm_acl_bufs;                /* # of ACL buffers on controller   */
-    uint16_t        idle_timeout;                   /* Idle timeout                     */
+    uint16_t        num_lm_acl_bufs;                /* # of ACL buffers on controller */
+    uint16_t        idle_timeout;                   /* Idle timeout */
 
-    list_t          *rcv_pending_q;                 /* Recv pending queue               */
-    alarm_t         *receive_hold_timer;            /* Timer entry for rcv hold    */
+    list_t          *rcv_pending_q;                 /* Recv pending queue */
+    alarm_t         *receive_hold_timer;            /* Timer entry for rcv hold */
 
-    tL2C_LCB        *p_cur_hcit_lcb;                /* Current HCI Transport buffer     */
-    uint16_t        num_links_active;               /* Number of links active           */
+    tL2C_LCB        *p_cur_hcit_lcb;                /* Current HCI Transport buffer */
+    uint16_t        num_links_active;               /* Number of links active */
 
 #if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
     uint16_t        non_flushable_pbf;              /* L2CAP_PKT_START_NON_FLUSHABLE if controller supports */
@@ -498,16 +508,16 @@
     tL2CAP_FIXED_CHNL_REG   fixed_reg[L2CAP_NUM_FIXED_CHNLS];   /* Reg info for fixed channels */
 #endif
 
-    uint16_t                 num_ble_links_active;               /* Number of LE links active           */
+    uint16_t                 num_ble_links_active;               /* Number of LE links active */
     bool                     is_ble_connecting;
     BD_ADDR                  ble_connecting_bda;
-    uint16_t                 controller_le_xmit_window;         /* Total ACL window for all links   */
+    uint16_t                 controller_le_xmit_window;         /* Total ACL window for all links */
     tL2C_BLE_FIXED_CHNLS_MASK l2c_ble_fixed_chnls_mask;         // LE fixed channels mask
-    uint16_t                 num_lm_ble_bufs;                   /* # of ACL buffers on controller   */
-    uint16_t                 ble_round_robin_quota;              /* Round-robin link quota           */
-    uint16_t                 ble_round_robin_unacked;            /* Round-robin unacked              */
-    bool                     ble_check_round_robin;              /* Do a round robin check           */
-    tL2C_RCB                 ble_rcb_pool[BLE_MAX_L2CAP_CLIENTS]; /* Registration info pool           */
+    uint16_t                 num_lm_ble_bufs;                   /* # of ACL buffers on controller */
+    uint16_t                 ble_round_robin_quota;              /* Round-robin link quota */
+    uint16_t                 ble_round_robin_unacked;            /* Round-robin unacked */
+    bool                     ble_check_round_robin;              /* Do a round robin check */
+    tL2C_RCB                 ble_rcb_pool[BLE_MAX_L2CAP_CLIENTS]; /* Registration info pool */
 
     tL2CA_ECHO_DATA_CB      *p_echo_data_cb;                /* Echo data callback */
 
@@ -526,12 +536,12 @@
 */
 typedef struct
 {
-    BD_ADDR         bd_addr;                        /* Remote BD address        */
-    uint8_t         status;                         /* Connection status        */
-    uint16_t        psm;                            /* PSM of the connection    */
-    uint16_t        l2cap_result;                   /* L2CAP result             */
-    uint16_t        l2cap_status;                   /* L2CAP status             */
-    uint16_t        remote_cid;                     /* Remote CID               */
+    BD_ADDR         bd_addr;                        /* Remote BD address */
+    uint8_t         status;                         /* Connection status */
+    uint16_t        psm;                            /* PSM of the connection */
+    uint16_t        l2cap_result;                   /* L2CAP result */
+    uint16_t        l2cap_status;                   /* L2CAP status */
+    uint16_t        remote_cid;                     /* Remote CID */
 } tL2C_CONN_INFO;
 
 
diff --git a/stack/l2cap/l2c_link.cc b/stack/l2cap/l2c_link.cc
index 657c145..1194c5a 100644
--- a/stack/l2cap/l2c_link.cc
+++ b/stack/l2cap/l2c_link.cc
@@ -846,12 +846,12 @@
  *
  * Function         l2c_link_adjust_chnl_allocation
  *
- * Description      This function is called to calculate the amount of packets each
- *                  non-F&EC channel may have outstanding.
+ * Description      This function is called to calculate the amount of packets
+ *                  each non-F&EC channel may have outstanding.
  *
  *                  Currently, this is a simple allocation, dividing the number
- *                  of packets allocated to the link by the number of channels. In
- *                  the future, QOS configuration should be examined.
+ *                  of packets allocated to the link by the number of channels.
+ *                  In the future, QOS configuration should be examined.
  *
  * Returns          void
  *
@@ -903,10 +903,10 @@
  *
  * Function         l2c_link_pkts_rcvd
  *
- * Description      This function is called from the HCI transport when it is time
- *                  tto send a "Host ready for packets" command. This is only when
- *                  host to controller flow control is used. If fills in the arrays
- *                  of numbers of packets and handles.
+ * Description      This function is called from the HCI transport when it is
+ *                  time to send a "Host ready for packets" command. This is
+ *                  only when host to controller flow control is used. It fills
+ *                  in the arrays of numbers of packets and handles.
  *
  * Returns          count of number of entries filled in
  *
@@ -923,8 +923,9 @@
  *
  * Function         l2c_link_role_changed
  *
- * Description      This function is called whan a link's master/slave role change
- *                  event is received. It simply updates the link control block.
+ * Description      This function is called whan a link's master/slave role
+ *                  change event is received. It simply updates the link control
+ *                  block.
  *
  * Returns          void
  *
diff --git a/stack/l2cap/l2c_main.cc b/stack/l2cap/l2c_main.cc
index 7413a13..a921aa0 100644
--- a/stack/l2cap/l2c_main.cc
+++ b/stack/l2cap/l2c_main.cc
@@ -44,12 +44,12 @@
 extern fixed_queue_t *btu_general_alarm_queue;
 
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 static void process_l2cap_cmd (tL2C_LCB *p_lcb, uint8_t *p, uint16_t pkt_len);
 
 /******************************************************************************/
-/*                 G L O B A L      L 2 C A P       D A T A                     */
+/*               G L O B A L      L 2 C A P       D A T A                     */
 /******************************************************************************/
 tL2C_CB l2cb;
 
@@ -753,9 +753,9 @@
  *
  * Function         l2c_process_held_packets
  *
- * Description      This function processes any L2CAP packets that arrived before
- *                  the HCI connection complete arrived. It is a work around for
- *                  badly behaved controllers.
+ * Description      This function processes any L2CAP packets that arrived
+ *                  before the HCI connection complete arrived. It is a work
+ *                  around for badly behaved controllers.
  *
  * Returns          void
  *
@@ -895,7 +895,8 @@
  * Description      API functions call this function to write data.
  *
  * Returns          L2CAP_DW_SUCCESS, if data accepted, else false
- *                  L2CAP_DW_CONGESTED, if data accepted and the channel is congested
+ *                  L2CAP_DW_CONGESTED, if data accepted and the channel is
+ *                                      congested
  *                  L2CAP_DW_FAILED, if error
  *
  ******************************************************************************/
diff --git a/stack/l2cap/l2c_ucd.cc b/stack/l2cap/l2c_ucd.cc
index 575a010..90d8e86 100644
--- a/stack/l2cap/l2c_ucd.cc
+++ b/stack/l2cap/l2c_ucd.cc
@@ -154,7 +154,7 @@
  *
  * Function         l2c_ucd_disconnect_ind_cback
  *
- * Description      UCD disconnect callback (This prevent to access null pointer)
+ * Description      UCD disconnect callback (Prevent to access null pointer)
  *
  * Returns          void
  *
@@ -949,11 +949,12 @@
  *
  *  Function        l2c_ucd_process_event
  *
- *  Description     This is called from main state machine when LCID is connectionless
- *                  Process the event if it is for UCD.
+ *  Description     This is called from main state machine when LCID is
+ *                  connectionless. Process the event if it is for UCD.
  *
  *  Return          true if the event is consumed by UCD
- *                  false if the event needs to be processed by main state machine
+ *                  false if the event needs to be processed by the main state
+ *                        machine
  *
  ******************************************************************************/
 bool    l2c_ucd_process_event(tL2C_CCB *p_ccb, uint16_t event, void *p_data)
diff --git a/stack/l2cap/l2c_utils.cc b/stack/l2cap/l2c_utils.cc
index d0f0ced..0c65fc7 100644
--- a/stack/l2cap/l2c_utils.cc
+++ b/stack/l2cap/l2c_utils.cc
@@ -291,8 +291,8 @@
  *
  * Description      Determine the desired role (master or slave) of a link.
  *                  If already got a slave link, this one must be a master. If
- *                  already got at least 1 link where we are the master, make this
- *                  also a master.
+ *                  already got at least 1 link where we are the master, make
+ *                  this also a master.
  *
  * Returns          HCI_ROLE_MASTER or HCI_ROLE_SLAVE
  *
@@ -308,7 +308,8 @@
  *
  * Description      Checks if cmd_code is command or response
  *                  If a command it will be rejected per spec.
- *                  This function is used when a illegal packet length is detected
+ *                  This function is used when a illegal packet length is
+ *                  detected.
  *
  * Returns          bool    - true if cmd_code is a command and it is rejected,
  *                            false if response code. (command not rejected)
@@ -1610,8 +1611,8 @@
  *                  This timer can be longer than the normal link inactivity
  *                  timer for some platforms.
  *
- * Returns          bool     - true if idle timer started or disconnect initiated
- *                             false if there's one or more pending CCB's exist
+ * Returns          bool  - true if idle timer started or disconnect initiated
+ *                          false if there's one or more pending CCB's exist
  *
  ******************************************************************************/
 bool    l2cu_start_post_bond_timer (uint16_t handle)
@@ -1652,8 +1653,8 @@
  * Function         l2cu_release_ccb
  *
  * Description      This function releases a Channel Control Block. The timer
- *                  is stopped, any attached buffers freed, and the CCB is removed
- *                  from the link control block.
+ *                  is stopped, any attached buffers freed, and the CCB is
+ *                  removed from the link control block.
  *
  * Returns          void
  *
@@ -1856,7 +1857,8 @@
  * Function         l2cu_disconnect_chnl
  *
  * Description      Disconnect a channel. Typically, this is due to either
- *                  receiving a bad configuration,  bad packet or max_retries expiring.
+ *                  receiving a bad configuration,  bad packet or max_retries
+ *                  expiring.
  *
  ******************************************************************************/
 void l2cu_disconnect_chnl (tL2C_CCB *p_ccb)
@@ -1937,19 +1939,21 @@
  *
  * Function         l2cu_process_peer_cfg_req
  *
- * Description      This function is called when the peer sends us a "config request"
- *                  message. It extracts the configuration of interest and saves
- *                  it in the CCB.
+ * Description      This function is called when the peer sends us a "config
+ *                  request" message. It extracts the configuration of interest
+ *                  and saves it in the CCB.
  *
- *                  Note:  Negotiation of the FCR channel type is handled internally,
- *                         all others are passed to the upper layer.
+ *                  Note:  Negotiation of the FCR channel type is handled
+ *                         internally, all others are passed to the upper layer.
  *
  * Returns          uint8_t - L2CAP_PEER_CFG_OK if passed to upper layer,
- *                          L2CAP_PEER_CFG_UNACCEPTABLE if automatically responded to
- *                              because parameters are unnacceptable from a specification
- *                              point of view.
- *                          L2CAP_PEER_CFG_DISCONNECT if no compatible channel modes
- *                              between the two devices, and shall be closed.
+ *                            L2CAP_PEER_CFG_UNACCEPTABLE if automatically
+ *                                      responded to because parameters are
+ *                                      unnacceptable from a specification point
+ *                                      of view.
+ *                            L2CAP_PEER_CFG_DISCONNECT if no compatible channel
+ *                                      modes between the two devices, and shall
+ *                                      be closed.
  *
  ******************************************************************************/
 uint8_t l2cu_process_peer_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg)
@@ -2079,9 +2083,9 @@
  *
  * Function         l2cu_process_peer_cfg_rsp
  *
- * Description      This function is called when the peer sends us a "config response"
- *                  message. It extracts the configuration of interest and saves
- *                  it in the CCB.
+ * Description      This function is called when the peer sends us a "config
+ *                  response" message. It extracts the configuration of interest
+ *                  and saves it in the CCB.
  *
  * Returns          void
  *
@@ -2209,9 +2213,9 @@
  *
  * Function         l2cu_process_our_cfg_rsp
  *
- * Description      This function is called when we send the peer a "config response"
- *                  message. It extracts the configuration of interest and saves
- *                  it in the CCB.
+ * Description      This function is called when we send the peer a "config
+ *                  response" message. It extracts the configuration of interest
+ *                  and saves it in the CCB.
  *
  * Returns          void
  *
@@ -2776,9 +2780,10 @@
  *
  * Function         l2cu_no_dynamic_ccbs
  *
- * Description      Handles the case when there are no more dynamic CCBs. If there
- *                  are any fixed CCBs, start the longest of the fixed CCB timeouts,
- *                  otherwise start the default link idle timeout or disconnect.
+ * Description      Handles the case when there are no more dynamic CCBs. If
+ *                  there are any fixed CCBs, start the longest of the fixed CCB
+ *                  timeouts, otherwise start the default link idle timeout or
+ *                  disconnect.
  *
  * Returns          void
  *
@@ -2909,8 +2914,8 @@
  *
  * Function         l2cu_process_fixed_disc_cback
  *
- * Description      send l2cap fixed channel disconnection callback to application
- *
+ * Description      send l2cap fixed channel disconnection callback to the
+ *                  application
  *
  * Returns          void
  *
@@ -3020,8 +3025,8 @@
  *
  * Function         l2cu_send_peer_ble_credit_based_conn_req
  *
- * Description      Build and send a BLE packet to establish LE connection oriented
- *                  L2CAP channel.
+ * Description      Build and send a BLE packet to establish LE connection
+ *                  oriented L2CAP channel.
  *
  * Returns          void
  *
@@ -3076,8 +3081,9 @@
  *
  * Function         l2cu_reject_ble_connection
  *
- * Description      Build and send an L2CAP "Credit based connection res" message
- *                  to the peer. This function is called for non-success cases.
+ * Description      Build and send an L2CAP "Credit based connection res"
+ *                  message to the peer. This function is called for non-success
+ *                  cases.
  *
  * Returns          void
  *
@@ -3110,8 +3116,9 @@
  *
  * Function         l2cu_send_peer_ble_credit_based_conn_res
  *
- * Description      Build and send an L2CAP "Credit based connection res" message
- *                  to the peer. This function is called in case of success.
+ * Description      Build and send an L2CAP "Credit based connection res"
+ *                  message to the peer. This function is called in case of
+ *                  success.
  *
  * Returns          void
  *
@@ -3187,8 +3194,8 @@
  *
  * Function         l2cu_send_peer_ble_credit_based_conn_req
  *
- * Description      Build and send a BLE packet to disconnect LE connection oriented
- *                  L2CAP channel.
+ * Description      Build and send a BLE packet to disconnect LE connection
+ *                  oriented L2CAP channel.
  *
  * Returns          void
  *
diff --git a/stack/l2cap/l2cap_client.cc b/stack/l2cap/l2cap_client.cc
index 3699763..639e63c 100755
--- a/stack/l2cap/l2cap_client.cc
+++ b/stack/l2cap/l2cap_client.cc
@@ -214,8 +214,8 @@
   response.result = L2CAP_CFG_OK;
 
   if (requested_parameters->mtu_present) {
-    // Make sure the peer chose an MTU at least as large as the minimum L2CAP MTU defined
-    // by the Bluetooth Core spec.
+    // Make sure the peer chose an MTU at least as large as the minimum L2CAP
+    // MTU defined by the Bluetooth Core spec.
     if (requested_parameters->mtu < L2CAP_MTU_MINIMUM) {
       response.mtu = L2CAP_MTU_MINIMUM;
       response.mtu_present = true;
diff --git a/stack/mcap/mca_api.cc b/stack/mcap/mca_api.cc
index de97f90..937d8f4 100644
--- a/stack/mcap/mca_api.cc
+++ b/stack/mcap/mca_api.cc
@@ -178,9 +178,9 @@
  *
  * Function         MCA_Deregister
  *
- * Description      This function is called to deregister an MCAP implementation.
- *                  Before this function can be called, all control and data
- *                  channels must be removed with MCA_DisconnectReq and MCA_CloseReq.
+ * Description      Deregister an MCAP implementation.  Before this function can
+ *                  be called, all control and data channels must be removed
+ *                  with MCA_DisconnectReq and MCA_CloseReq.
  *
  * Returns          void
  *
@@ -205,10 +205,10 @@
  *
  * Function         MCA_CreateDep
  *
- * Description      Create a data endpoint.  If the MDEP is created successfully,
+ * Description      Create a data endpoint. If the MDEP is created successfully,
  *                  the MDEP ID is returned in *p_dep. After a data endpoint is
- *                  created, an application can initiate a connection between this
- *                  endpoint and an endpoint on a peer device.
+ *                  created, an application can initiate a connection between
+ *                  this endpoint and an endpoint on a peer device.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -324,9 +324,9 @@
  *                  MCA_CONNECT_IND_EVT is reported to the application via its
  *                  control callback function.
  *                  This control channel is identified by the tMCA_CL.
- *                  If the connection attempt fails, an MCA_DISCONNECT_IND_EVT is
- *                  reported. The security mask parameter overrides the outgoing
- *                  security mask set in MCA_Register().
+ *                  If the connection attempt fails, an MCA_DISCONNECT_IND_EVT
+ *                  is reported. The security mask parameter overrides the
+ *                  outgoing security mask set in MCA_Register().
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -383,7 +383,8 @@
  *                  to the peer device.
  *                  If associated data channel exists, they are disconnected.
  *                  When the MCL is disconnected an MCA_DISCONNECT_IND_EVT is
- *                  reported to the application via its control callback function.
+ *                  reported to the application via its control callback
+ *                  function.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -408,14 +409,15 @@
  * Function         MCA_CreateMdl
  *
  * Description      This function sends a CREATE_MDL request to the peer device.
- *                  When the response is received, a MCA_CREATE_CFM_EVT is reported
- *                  with the given MDL ID.
+ *                  When the response is received, a MCA_CREATE_CFM_EVT is
+ *                  reported with the given MDL ID.
  *                  If the response is successful, a data channel is open
  *                  with the given p_chnl_cfg
- *                  If p_chnl_cfg is NULL, the data channel is not initiated until
- *                  MCA_DataChnlCfg is called to provide the p_chnl_cfg.
- *                  When the data channel is open successfully, a MCA_OPEN_CFM_EVT
- *                  is reported. This data channel is identified as tMCA_DL.
+ *                  If p_chnl_cfg is NULL, the data channel is not initiated
+ *                  until MCA_DataChnlCfg is called to provide the p_chnl_cfg.
+ *                  When the data channel is open successfully, a
+ *                  MCA_OPEN_CFM_EVT is reported. This data channel is
+ *                  identified as tMCA_DL.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -489,7 +491,8 @@
  *                  in response to a received MCA_CREATE_IND_EVT.
  *                  If the rsp_code is successful, a data channel is open
  *                  with the given p_chnl_cfg
- *                  When the data channel is open successfully, a MCA_OPEN_IND_EVT
+ *                  When the data channel is open successfully, a
+ *                  MCA_OPEN_IND_EVT
  *                  is reported. This data channel is identified as tMCA_DL.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
@@ -582,13 +585,13 @@
  *
  * Function         MCA_ReconnectMdl
  *
- * Description      This function sends a RECONNECT_MDL request to the peer device.
- *                  When the response is received, a MCA_RECONNECT_CFM_EVT is reported.
- *                  If p_chnl_cfg is NULL, the data channel is not initiated until
- *                  MCA_DataChnlCfg is called to provide the p_chnl_cfg.
- *                  If the response is successful, a data channel is open.
- *                  When the data channel is open successfully, a MCA_OPEN_CFM_EVT
- *                  is reported.
+ * Description      This function sends a RECONNECT_MDL request to the peer
+ *                  device. When the response is received, a
+ *                  MCA_RECONNECT_CFM_EVT is reported. If p_chnl_cfg is NULL,
+ *                  the data channel is not initiated until MCA_DataChnlCfg is
+ *                  called to provide the p_chnl_cfg. If the response is
+ *                  successful, a data channel is open. When the data channel is
+ *                  open successfully, a MCA_OPEN_CFM_EVT is reported.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -648,11 +651,11 @@
  *
  * Function         MCA_ReconnectMdlRsp
  *
- * Description      This function sends a RECONNECT_MDL response to the peer device
- *                  in response to a MCA_RECONNECT_IND_EVT event.
+ * Description      This function sends a RECONNECT_MDL response to the peer
+ *                  device in response to a MCA_RECONNECT_IND_EVT event.
  *                  If the response is successful, a data channel is open.
- *                  When the data channel is open successfully, a MCA_OPEN_IND_EVT
- *                  is reported.
+ *                  When the data channel is open successfully, a
+ *                  MCA_OPEN_IND_EVT is reported.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -718,8 +721,9 @@
  *
  * Description      This function initiates a data channel connection toward the
  *                  connected peer device.
- *                  When the data channel is open successfully, a MCA_OPEN_CFM_EVT
- *                  is reported. This data channel is identified as tMCA_DL.
+ *                  When the data channel is open successfully, a
+ *                  MCA_OPEN_CFM_EVT is reported. This data channel is
+ *                  identified as tMCA_DL.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -766,7 +770,8 @@
  * Function         MCA_Abort
  *
  * Description      This function sends a ABORT_MDL request to the peer device.
- *                  When the response is received, a MCA_ABORT_CFM_EVT is reported.
+ *                  When the response is received, a MCA_ABORT_CFM_EVT is
+ *                  reported.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -811,7 +816,8 @@
  * Function         MCA_Delete
  *
  * Description      This function sends a DELETE_MDL request to the peer device.
- *                  When the response is received, a MCA_DELETE_CFM_EVT is reported.
+ *                  When the response is received, a MCA_DELETE_CFM_EVT is
+ *                  reported.
  *
  * Returns          MCA_SUCCESS if successful, otherwise error.
  *
@@ -851,9 +857,10 @@
  *
  * Description      Send a data packet to the peer device.
  *
- *                  The application passes the packet using the BT_HDR structure.
- *                  The offset field must be equal to or greater than L2CAP_MIN_OFFSET.
- *                  This allows enough space in the buffer for the L2CAP header.
+ *                  The application passes the packet using the BT_HDR
+ *                  structure. The offset field must be equal to or greater than
+ *                  L2CAP_MIN_OFFSET. This allows enough space in the buffer for
+ *                  the L2CAP header.
  *
  *                  The memory pointed to by p_pkt must be a GKI buffer
  *                  allocated by the application.  This buffer will be freed
diff --git a/stack/mcap/mca_cact.cc b/stack/mcap/mca_cact.cc
index 0f49e06..0df370e 100644
--- a/stack/mcap/mca_cact.cc
+++ b/stack/mcap/mca_cact.cc
@@ -441,9 +441,9 @@
  *
  * Function         mca_ccb_hdl_rsp
  *
- * Description      This function is called when a MCAP response is received from
- *                  the peer.  It calls the application callback function with
- *                  the results.
+ * Description      This function is called when a MCAP response is received
+ *                  from the peer.  It calls the application callback function
+ *                  with the results.
  *
  * Returns          void.
  *
@@ -562,8 +562,8 @@
  *
  * Function         mca_ccb_dl_open
  *
- * Description      This function is called when data channel is open.
- *                  It clears p_tx_req to allow other message exchage on this CL.
+ * Description      This function is called when data channel is open. It clears
+ *                  p_tx_req to allow other message exchage on this CL.
  *
  * Returns          void.
  *
diff --git a/stack/mcap/mca_dact.cc b/stack/mcap/mca_dact.cc
index 60782f4..d93974b 100644
--- a/stack/mcap/mca_dact.cc
+++ b/stack/mcap/mca_dact.cc
@@ -133,7 +133,7 @@
  *
  * Function         mca_dcb_snd_data
  *
- * Description      This function sends the data from application to the peer device.
+ * Description      Send the data from application to the peer device.
  *
  * Returns          void.
  *
diff --git a/stack/mcap/mca_dsm.cc b/stack/mcap/mca_dsm.cc
index 3a59a1e..9a308a0 100644
--- a/stack/mcap/mca_dsm.cc
+++ b/stack/mcap/mca_dsm.cc
@@ -275,7 +275,7 @@
  *
  * Function         mca_dcb_to_hdl
  *
- * Description      This function converts a pointer to an DCB to a handle (tMCA_DL).
+ * Description      Convert a pointer to a DCB to a handle (tMCA_DL).
  *                  It returns the handle.
  *
  * Returns          tMCA_DL.
diff --git a/stack/mcap/mca_int.h b/stack/mcap/mca_int.h
index de90c6b..7673ee1 100644
--- a/stack/mcap/mca_int.h
+++ b/stack/mcap/mca_int.h
@@ -56,7 +56,7 @@
     tMCA_DL         dcb_idx;    /* For internal use only */
 } tMCA_CCB_MSG;
 
-/* This data structure is associated with the AVDT_OPEN_IND_EVT and AVDT_OPEN_CFM_EVT. */
+/* This data structure is for AVDT_OPEN_IND_EVT and AVDT_OPEN_CFM_EVT. */
 typedef struct {
     BT_HDR          hdr;                /* Event header */
     uint16_t        peer_mtu;           /* Transport channel L2CAP MTU of the peer */
@@ -115,6 +115,7 @@
     BT_HDR          *p_pkt;
     bool            llcong;
     uint16_t        mdl_id;     /* the MDL ID associated with this request/response */
+
     /* tMCA_HANDLE     rcb_idx;    For internal use only */
     /* tMCA_CL         ccb_idx;    For internal use only */
     /* tMCA_DL         dcb_idx;    For internal use only */
@@ -238,9 +239,12 @@
  * dcb[MCA_NUM_MDLS*2]...dcb[MCA_NUM_MDLS*3-1] -> ccb[2]
  *
  * the dcbs association with the rcbs
- * dcb[0]                             ...dcb[MCA_NUM_MDLS*1*MCA_NUM_LINKS*1-1] -> rcb[0]
- * dcb[MCA_NUM_MDLS*1*MCA_NUM_LINKS*1]...dcb[MCA_NUM_MDLS*2*MCA_NUM_LINKS*2-1] -> rcb[1]
- * dcb[MCA_NUM_MDLS*2*MCA_NUM_LINKS*2]...dcb[MCA_NUM_MDLS*3*MCA_NUM_LINKS*3-1] -> rcb[2]
+ * dcb[0]
+ *                    ...dcb[MCA_NUM_MDLS*1*MCA_NUM_LINKS*1-1] -> rcb[0]
+ * dcb[MCA_NUM_MDLS*1*MCA_NUM_LINKS*1]
+ *                    ...dcb[MCA_NUM_MDLS*2*MCA_NUM_LINKS*2-1] -> rcb[1]
+ * dcb[MCA_NUM_MDLS*2*MCA_NUM_LINKS*2]
+ *                    ...dcb[MCA_NUM_MDLS*3*MCA_NUM_LINKS*3-1] -> rcb[2]
  */
 typedef struct {
     tMCA_CCB            *p_ccb;         /* the associated control control block */
diff --git a/stack/mcap/mca_l2c.cc b/stack/mcap/mca_l2c.cc
index 17aeba0..c9f81af 100644
--- a/stack/mcap/mca_l2c.cc
+++ b/stack/mcap/mca_l2c.cc
@@ -564,7 +564,8 @@
  *
  * Function         mca_l2c_open_req
  *
- * Description      This function calls L2CA_ConnectReq() to initiate a L2CAP channel.
+ * Description      This function calls L2CA_ConnectReq() to initiate a L2CAP
+ *                  channel.
  *
  * Returns          void.
  *
diff --git a/stack/pan/pan_api.cc b/stack/pan/pan_api.cc
index 412caa7..a340c3a 100644
--- a/stack/pan/pan_api.cc
+++ b/stack/pan/pan_api.cc
@@ -120,12 +120,13 @@
  *                                      PAN_ROLE_GN_SERVER is for GN role
  *                                      PAN_ROLE_NAP_SERVER is for NAP role
  *                  sec_mask    - Security mask for different roles
- *                                      It is array of uint8_t. The byte represent the
- *                                      security for roles PANU, GN and NAP in order
+ *                                      It is array of uint8_t. The bytes
+ *                                      represent the security for roles PANU,
+ *                                      GN and NAP in order
  *                  p_user_name - Service name for PANU role
  *                  p_gn_name   - Service name for GN role
  *                  p_nap_name  - Service name for NAP role
- *                                      Can be NULL if user wants it to be default
+ *                                      Can be NULL if user wants the default
  *
  * Returns          PAN_SUCCESS     - if the role is set successfully
  *                  PAN_FAILURE     - if the role is not valid
@@ -274,12 +275,13 @@
  *                                      PAN_ROLE_NAP_SERVER is for NAP role
  *                  *handle     - Pointer for returning Handle to the connection
  *
- * Returns          PAN_SUCCESS      - if the connection is initiated successfully
+ * Returns          PAN_SUCCESS      - if the connection is initiated
+ *                                     successfully
  *                  PAN_NO_RESOURCES - resources are not sufficent
  *                  PAN_FAILURE      - if the connection cannot be initiated
- *                                           this can be because of the combination of
- *                                           src and dst roles may not be valid or
- *                                           allowed at that point of time
+ *                                     this can be because of the combination of
+ *                                     src and dst roles may not be valid or
+ *                                     allowed at that point of time
  *
  ******************************************************************************/
 tPAN_RESULT PAN_Connect (BD_ADDR rem_bda, uint8_t src_role, uint8_t dst_role, uint16_t *handle)
@@ -474,7 +476,8 @@
  * Description      This sends data over the PAN connections. If this is called
  *                  on GN or NAP side and the packet is multicast or broadcast
  *                  it will be sent on all the links. Otherwise the correct link
- *                  is found based on the destination address and forwarded on it.
+ *                  is found based on the destination address and forwarded on
+ *                  it.
  *
  * Parameters:      handle   - handle for the connection
  *                  dst      - MAC or BD Addr of the destination device
@@ -525,9 +528,9 @@
  * Description      This sends data over the PAN connections. If this is called
  *                  on GN or NAP side and the packet is multicast or broadcast
  *                  it will be sent on all the links. Otherwise the correct link
- *                  is found based on the destination address and forwarded on it
- *                  If the return value is not PAN_SUCCESS the application should
- *                  take care of releasing the message buffer
+ *                  is found based on the destination address and forwarded on
+ *                  it. If the return value is not PAN_SUCCESS, the application
+ *                  should take care of releasing the message buffer.
  *
  * Parameters:      handle   - handle for the connection
  *                  dst      - MAC or BD Addr of the destination device
@@ -645,8 +648,8 @@
  *                  end         - array of ending protocol numbers
  *
  *
- * Returns          PAN_SUCCESS        if protocol filters are set successfully
- *                  PAN_FAILURE        if connection not found or error in setting
+ * Returns          PAN_SUCCESS    if protocol filters are set successfully
+ *                  PAN_FAILURE    if connection not found or error in setting
  *
  ******************************************************************************/
 tPAN_RESULT PAN_SetProtocolFilters (uint16_t handle,
@@ -690,8 +693,8 @@
  *                  end         - array of ending multicast filter addresses
  *
  *
- * Returns          PAN_SUCCESS        if multicast filters are set successfully
- *                  PAN_FAILURE        if connection not found or error in setting
+ * Returns          PAN_SUCCESS    if multicast filters are set successfully
+ *                  PAN_FAILURE    if connection not found or error in setting
  *
  ******************************************************************************/
 tBNEP_RESULT PAN_SetMulticastFilters (uint16_t handle,
diff --git a/stack/pan/pan_main.cc b/stack/pan/pan_main.cc
index 8e563de..72777fa 100644
--- a/stack/pan/pan_main.cc
+++ b/stack/pan/pan_main.cc
@@ -76,15 +76,17 @@
  *
  * Function         pan_conn_ind_cb
  *
- * Description      This function is registered with BNEP as connection indication
- *                  callback. BNEP will call this when there is connection
- *                  request from the peer. PAN should call BNEP_ConnectResp to
- *                  indicate whether to accept the connection or reject
+ * Description      This function is registered with BNEP as connection
+ *                  indication callback. BNEP will call this when there is
+ *                  connection request from the peer. PAN should call
+ *                  BNEP_ConnectResp to indicate whether to accept the
+ *                  connection or reject
  *
- * Parameters:      handle          - handle for the connection
- *                  p_bda           - BD Addr of the peer requesting the connection
+ * Parameters:      handle      - handle for the connection
+ *                  p_bda       - BD Addr of the peer requesting the connection
  *                  remote_uuid     - UUID of the source role (peer device role)
- *                  local_uuid      - UUID of the destination role (local device role)
+ *                  local_uuid      - UUID of the destination role (local device
+ *                                                                  role)
  *                  is_role_change  - Flag to indicate that it is a role change
  *
  * Returns          none
@@ -316,12 +318,12 @@
  *                  change callback. BNEP will call this when the connection
  *                  is established successfully or terminated
  *
- * Parameters:      handle      - handle for the connection given in the connection
- *                                      indication callback
- *                  rem_bda     - remote device bd addr
- *                  result      - indicates whether the connection is up or down
- *                                      BNEP_SUCCESS if the connection is up
- *                                      all other values indicates appropriate errors
+ * Parameters:      handle  - handle for the connection given in the connection
+ *                            indication callback
+ *                  rem_bda - remote device bd addr
+ *                  result  - indicates whether the connection is up or down
+ *                            BNEP_SUCCESS if the connection is up all other
+ *                            values indicate appropriate errors.
  *                  is_role_change - flag to indicate that it is a role change
  *
  * Returns          none
@@ -520,9 +522,10 @@
  *
  * Function         pan_data_buf_ind_cb
  *
- * Description      This function is registered with BNEP as data buffer indication
- *                  callback. BNEP will call this when the peer sends any data
- *                  on this connection. PAN is responsible to release the buffer
+ * Description      This function is registered with BNEP as data buffer
+ *                  indication callback. BNEP will call this when the peer sends
+ *                  any data on this connection. PAN is responsible to release
+ *                  the buffer
  *
  * Parameters:      handle      - handle for the connection
  *                  src         - source BD Addr
@@ -660,16 +663,17 @@
  *
  * Function         pan_proto_filt_ind_cb
  *
- * Description      This function is registered with BNEP as proto filter indication
- *                  callback. BNEP will call this when the peer sends any protocol
- *                  filter set for the connection or to indicate the result of the
- *                  protocol filter set by the local device
+ * Description      This function is registered with BNEP as proto filter
+ *                  indication callback. BNEP will call this when the peer sends
+ *                  any protocol filter set for the connection or to indicate
+ *                  the result of the protocol filter set by the local device
  *
  * Parameters:      handle      - handle for the connection
  *                  indication  - true if this is indication
- *                                false if it is called to give the result of local
- *                                      device protocol filter set
- *                  result      - This gives the result of the filter set operation
+ *                                false if it is called to give the result of
+ *                                      local device protocol filter set
+ *                  result      - This gives the result of the filter set
+ *                                      operation
  *                  num_filters - number of filters set by the peer device
  *                  p_filters   - pointer to the filters set by the peer device
  *
@@ -694,16 +698,17 @@
  *
  * Function         pan_mcast_filt_ind_cb
  *
- * Description      This function is registered with BNEP as mcast filter indication
- *                  callback. BNEP will call this when the peer sends any multicast
- *                  filter set for the connection or to indicate the result of the
- *                  multicast filter set by the local device
+ * Description      This function is registered with BNEP as mcast filter
+ *                  indication callback. BNEP will call this when the peer sends
+ *                  any multicast filter set for the connection or to indicate
+ *                  the result of the multicast filter set by the local device
  *
  * Parameters:      handle      - handle for the connection
  *                  indication  - true if this is indication
- *                                false if it is called to give the result of local
- *                                      device multicast filter set
- *                  result      - This gives the result of the filter set operation
+ *                                false if it is called to give the result of
+ *                                      local device multicast filter set
+ *                  result      - This gives the result of the filter set
+ *                                operation
  *                  num_filters - number of filters set by the peer device
  *                  p_filters   - pointer to the filters set by the peer device
  *
diff --git a/stack/rfcomm/port_api.cc b/stack/rfcomm/port_api.cc
index cfec6a8..bba94ce 100644
--- a/stack/rfcomm/port_api.cc
+++ b/stack/rfcomm/port_api.cc
@@ -82,9 +82,9 @@
  *
  * Function         RFCOMM_CreateConnection
  *
- * Description      RFCOMM_CreateConnection function is used from the application
- *                  to establish serial port connection to the peer device,
- *                  or allow RFCOMM to accept a connection from the peer
+ * Description      RFCOMM_CreateConnection function is used from the
+ *                  application to establish serial port connection to the peer
+ *                  device, or allow RFCOMM to accept a connection from the peer
  *                  application.
  *
  * Parameters:      scn          - Service Channel Number as registered with
@@ -353,8 +353,8 @@
  *
  * Function         PORT_ClearKeepHandleFlag
  *
- * Description      This function is called to clear the keep handle flag
- *                  which will cause not to keep the port handle open when closed
+ * Description      Clear the keep handle flag, which will cause not to keep the
+ *                  port handle open when closed
  * Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
  *
  ******************************************************************************/
@@ -1837,8 +1837,8 @@
  *
  * Function         PORT_SetTraceLevel
  *
- * Description      This function sets the trace level for RFCOMM. If called with
- *                  a value of 0xFF, it simply reads the current trace level.
+ * Description      Set the trace level for RFCOMM. If called with 0xFF, it
+ *                  simply reads the current trace level.
  *
  * Returns          the new (current) trace level
  *
diff --git a/stack/rfcomm/rfc_int.h b/stack/rfcomm/rfc_int.h
index 630c5bb..9826557 100644
--- a/stack/rfcomm/rfc_int.h
+++ b/stack/rfcomm/rfc_int.h
@@ -207,12 +207,17 @@
 #define RFC_EVENT_DATA                  14
 #define RFC_EVENT_SEC_COMPLETE          15
 
-#define RFC_T1_TIMEOUT                  20   /* seconds to wait for reply with Poll bit */
-#define RFC_PORT_T1_TIMEOUT             60   /* seconds to wait for reply with Poll bit other than MX */
-#define RFC_T2_TIMEOUT                  20   /* timeout to wait for Mx UIH */
-#define RFC_DISC_TIMEOUT                3    /* If something goes wrong and we send DISC we should not wait for min */
+/* seconds to wait for reply with Poll bit */
+#define RFC_T1_TIMEOUT                  20
+/* seconds to wait for reply with Poll bit other than MX */
+#define RFC_PORT_T1_TIMEOUT             60
+/* timeout to wait for Mx UIH */
+#define RFC_T2_TIMEOUT                  20
+/* If something goes wrong and we send DISC we should not wait for min */
+#define RFC_DISC_TIMEOUT                3
 #define RFC_CLOSE_TIMEOUT               10
-#define RFCOMM_CONN_TIMEOUT            120   /* first connection to be established on Mx */
+/* first connection to be established on Mx */
+#define RFCOMM_CONN_TIMEOUT            120
 
 
 /* Define RFComm control block
@@ -221,7 +226,9 @@
 {
     MX_FRAME  rx_frame;
     tL2CAP_APPL_INFO  reg_info;              /* L2CAP Registration info */
-    tRFC_MCB *p_rfc_lcid_mcb[MAX_L2CAP_CHANNELS];     /* MCB based on the L2CAP's lcid */
+
+    /* MCB based on the L2CAP's lcid */
+    tRFC_MCB *p_rfc_lcid_mcb[MAX_L2CAP_CHANNELS];
     bool      peer_rx_disabled;              /* If true peer sent FCOFF */
     uint8_t   last_mux;                      /* Last mux allocated */
     uint8_t   last_port;                     /* Last port allocated */
@@ -238,7 +245,7 @@
 
 extern tRFC_CB rfc_cb;
 
-/* Timer running on the multiplexor channel while no DLCI connection is opened */
+/* Timer running on the multiplexor channel while no DLCI connection is open */
 #define RFC_MCB_INIT_INACT_TIMER    60  /* in seconds */
 
 /* Timer running on the multiplexor channel after last DLCI is released */
diff --git a/stack/rfcomm/rfc_l2cap_if.cc b/stack/rfcomm/rfc_l2cap_if.cc
index 746e208..614cc96 100644
--- a/stack/rfcomm/rfc_l2cap_if.cc
+++ b/stack/rfcomm/rfc_l2cap_if.cc
@@ -85,8 +85,8 @@
  * Function         RFCOMM_ConnectInd
  *
  * Description      This is a callback function called by L2CAP when
- *                  L2CA_ConnectInd received.  Allocate multiplexer control block
- *                  and dispatch the event to it.
+ *                  L2CA_ConnectInd received.  Allocate multiplexer control
+ *                  block and dispatch the event to it.
  *
  ******************************************************************************/
 void RFCOMM_ConnectInd (BD_ADDR bd_addr, uint16_t lcid,
@@ -259,7 +259,8 @@
  * Function         RFCOMM_QoSViolationInd
  *
  * Description      This is a callback function called by L2CAP when
- *                  L2CA_QoSViolationIndInd received.  Dispatch event to the FSM.
+ *                  L2CA_QoSViolationIndInd received.  Dispatch event to the
+ *                  FSM.
  *
  ******************************************************************************/
 void RFCOMM_QoSViolationInd (UNUSED_ATTR BD_ADDR bd_addr)
diff --git a/stack/rfcomm/rfc_mx_fsm.cc b/stack/rfcomm/rfc_mx_fsm.cc
index de64d22..808b127 100644
--- a/stack/rfcomm/rfc_mx_fsm.cc
+++ b/stack/rfcomm/rfc_mx_fsm.cc
@@ -39,7 +39,7 @@
 
 
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 static void rfc_mx_sm_state_idle (tRFC_MCB *p_mcb, uint16_t event, void *p_data);
 static void rfc_mx_sm_state_wait_conn_cnf (tRFC_MCB *p_mcb, uint16_t event, void *p_data);
diff --git a/stack/rfcomm/rfc_port_fsm.cc b/stack/rfcomm/rfc_port_fsm.cc
index 4727429..d048989 100644
--- a/stack/rfcomm/rfc_port_fsm.cc
+++ b/stack/rfcomm/rfc_port_fsm.cc
@@ -35,7 +35,7 @@
 #include "osi/include/osi.h"
 
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 static void rfc_port_sm_state_closed (tPORT *p_port, uint16_t event, void *p_data);
 static void rfc_port_sm_sabme_wait_ua (tPORT *p_port, uint16_t event, void *p_data);
@@ -840,8 +840,8 @@
  *
  * Function         rfc_process_fcoff
  *
- * Description      This function handles FCOFF frame.  The peer entity is unable
- *                  to receive new information
+ * Description      This function handles FCOFF frame.  The peer entity is
+ *                  unable to receive new information
  *
  ******************************************************************************/
 void rfc_process_fcoff (tRFC_MCB *p_mcb, bool    is_command)
@@ -887,7 +887,8 @@
  *
  * Function         rfc_set_port_pars
  *
- * Description      This function sets the tPORT_STATE structure given a p_frame.
+ * Description      This function sets the tPORT_STATE structure given a
+ *                  p_frame.
  *
  ******************************************************************************/
 
diff --git a/stack/sdp/sdp_api.cc b/stack/sdp/sdp_api.cc
index 094fc5e..35addb6 100644
--- a/stack/sdp/sdp_api.cc
+++ b/stack/sdp/sdp_api.cc
@@ -52,7 +52,8 @@
  * Parameters:      p_db        - (input) address of an area of memory where the
  *                                        discovery database is managed.
  *                  len         - (input) size (in bytes) of the memory
- *                                  NOTE: This must be larger than sizeof(tSDP_DISCOVERY_DB)
+ *                                 NOTE: This must be larger than
+ *                                       sizeof(tSDP_DISCOVERY_DB)
  *                  num_uuid    - (input) number of UUID filters applied
  *                  p_uuid_list - (input) list of UUID filters
  *                  num_attr    - (input) number of attribute filters applied
@@ -111,7 +112,8 @@
  *
  * Description      This function cancels an active query to an SDP server.
  *
- * Returns          true if discovery cancelled, false if a matching activity is not found.
+ * Returns          true if discovery cancelled, false if a matching activity is
+ *                  not found.
  *
  ******************************************************************************/
 bool    SDP_CancelServiceSearch (tSDP_DISCOVERY_DB *p_db)
@@ -248,10 +250,10 @@
  *
  * Function         SDP_FindAttributeInDb
  *
- * Description      This function queries an SDP database for a specific attribute.
- *                  If the p_start_rec pointer is NULL, it looks from the beginning
- *                  of the database, else it continues from the next record after
- *                  p_start_rec.
+ * Description      This function queries an SDP database for a specific
+ *                  attribute. If the p_start_rec pointer is NULL, it looks from
+ *                  the beginning of the database, else it continues from the
+ *                  next record after p_start_rec.
  *
  * Returns          Pointer to matching record, or NULL
  *
@@ -295,8 +297,8 @@
  *
  * Function         SDP_FindAttributeInRec
  *
- * Description      This function searches an SDP discovery record for a specific
- *                  attribute.
+ * Description      This function searches an SDP discovery record for a
+ *                  specific attribute.
  *
  * Returns          Pointer to matching attribute entry, or NULL
  *
@@ -323,8 +325,8 @@
  *
  * Function         SDP_FindServiceUUIDInRec
  *
- * Description      This function is called to read the service UUID within a record
- *                  if there is any.
+ * Description      This function is called to read the service UUID within a
+ *                  record if there is any.
  *
  * Parameters:      p_rec      - pointer to a SDP record.
  *                  p_uuid     - output parameter to save the UUID found.
@@ -415,8 +417,8 @@
  *
  * Function         SDP_FindServiceUUIDInRec_128bit
  *
- * Description      This function is called to read the 128-bit service UUID within a record
- *                  if there is any.
+ * Description      This function is called to read the 128-bit service UUID
+ *                  within a record if there is any.
  *
  * Parameters:      p_rec      - pointer to a SDP record.
  *                  p_uuid     - output parameter to save the UUID found.
@@ -474,10 +476,10 @@
  *
  * Function         SDP_FindServiceInDb
  *
- * Description      This function queries an SDP database for a specific service.
- *                  If the p_start_rec pointer is NULL, it looks from the beginning
- *                  of the database, else it continues from the next record after
- *                  p_start_rec.
+ * Description      This function queries an SDP database for a specific
+ *                  service. If the p_start_rec pointer is NULL, it looks from
+ *                  the beginning of the database, else it continues from the
+ *                  next record after p_start_rec.
  *
  * Returns          Pointer to record containing service class, or NULL
  *
@@ -579,13 +581,13 @@
  *
  * Function         SDP_FindServiceInDb_128bit
  *
- * Description      This function queries an SDP database for a specific service.
- *                  If the p_start_rec pointer is NULL, it looks from the beginning
- *                  of the database, else it continues from the next record after
+ * Description      Query an SDP database for a specific service. If the
+ *                  p_start_rec pointer is NULL, it looks from the beginning of
+ *                  the database, else it continues from the next record after
  *                  p_start_rec.
  *
- *                  This function is kept separate from SDP_FindServiceInDb since
- *                  that API is expected to return only 16-bit UUIDs
+ *                  This function is kept separate from SDP_FindServiceInDb
+ *                  since that API is expected to return only 16-bit UUIDs
  *
  * Returns          Pointer to record containing service class, or NULL
  *
@@ -645,13 +647,14 @@
  *
  * Function         SDP_FindServiceUUIDInDb
  *
- * Description      This function queries an SDP database for a specific service.
- *                  If the p_start_rec pointer is NULL, it looks from the beginning
- *                  of the database, else it continues from the next record after
+ * Description      Query an SDP database for a specific service. If the
+ *                  p_start_rec pointer is NULL, it looks from the beginning of
+ *                  the database, else it continues from the next record after
  *                  p_start_rec.
  *
- * NOTE             the only difference between this function and the previous function
- *                  "SDP_FindServiceInDb()" is that this function takes a tBT_UUID input
+ * NOTE             the only difference between this function and the previous
+ *                  function "SDP_FindServiceInDb()" is that this function takes
+ *                  a tBT_UUID input
  *
  * Returns          Pointer to record containing service class, or NULL
  *
@@ -772,8 +775,8 @@
  *
  * Function         SDP_FindProtocolListElemInRec
  *
- * Description      This function looks at a specific discovery record for a protocol
- *                  list element.
+ * Description      This function looks at a specific discovery record for a
+ *                  protocol list element.
  *
  * Returns          true if found, false if not
  *                  If found, the passed protocol list element is filled in.
@@ -805,8 +808,8 @@
  *
  * Function         SDP_FindAddProtoListsElemInRec
  *
- * Description      This function looks at a specific discovery record for a protocol
- *                  list element.
+ * Description      This function looks at a specific discovery record for a
+ *                  protocol list element.
  *
  * Returns          true if found, false if not
  *                  If found, the passed protocol list element is filled in.
@@ -855,8 +858,8 @@
  *                  an 8-bit minor version.
  *
  * Returns          true if found, false if not
- *                  If found, the major and minor version numbers that were passed
- *                  in are filled in.
+ *                  If found, the major and minor version numbers that were
+ *                  passed in are filled in.
  *
  ******************************************************************************/
 bool    SDP_FindProfileVersionInRec (tSDP_DISC_REC *p_rec, uint16_t profile_uuid, uint16_t *p_version)
@@ -982,7 +985,8 @@
  *
  * Function         SDP_AttrStringCopy
  *
- * Description      This function copy given attribute to specified buffer as a string
+ * Description      This function copy given attribute to specified buffer as a
+ *                  string
  *
  * Returns          none
  *
diff --git a/stack/sdp/sdp_db.cc b/stack/sdp/sdp_db.cc
index 434479d..d74df52 100644
--- a/stack/sdp/sdp_db.cc
+++ b/stack/sdp/sdp_db.cc
@@ -39,7 +39,7 @@
 
 #if (SDP_SERVER_ENABLED == TRUE)
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 static bool    find_uuid_in_seq (uint8_t *p , uint32_t seq_len, uint8_t *p_his_uuid,
                                  uint16_t his_len, int nest_level);
@@ -384,8 +384,8 @@
  *
  * Description      This function is called to add an attribute to a record.
  *                  This would be through the SDP database maintenance API.
- *                  If the attribute already exists in the record, it is replaced
- *                  with the new value.
+ *                  If the attribute already exists in the record, it is
+ *                  replaced with the new value.
  *
  * NOTE             Attribute values must be passed as a Big Endian stream.
  *
@@ -638,9 +638,9 @@
  * Function         SDP_AddProtocolList
  *
  * Description      This function is called to add a protocol descriptor list to
- *                  a record. This would be through the SDP database maintenance API.
- *                  If the protocol list already exists in the record, it is replaced
- *                  with the new list.
+ *                  a record. This would be through the SDP database
+ *                  maintenance API. If the protocol list already exists in the
+ *                  record, it is replaced with the new list.
  *
  * Returns          true if added OK, else false
  *
@@ -668,9 +668,9 @@
  * Function         SDP_AddAdditionProtoLists
  *
  * Description      This function is called to add a protocol descriptor list to
- *                  a record. This would be through the SDP database maintenance API.
- *                  If the protocol list already exists in the record, it is replaced
- *                  with the new list.
+ *                  a record. This would be through the SDP database maintenance
+ *                  API. If the protocol list already exists in the record, it
+ *                  is replaced with the new list.
  *
  * Returns          true if added OK, else false
  *
@@ -715,9 +715,9 @@
  * Function         SDP_AddProfileDescriptorList
  *
  * Description      This function is called to add a profile descriptor list to
- *                  a record. This would be through the SDP database maintenance API.
- *                  If the version already exists in the record, it is replaced
- *                  with the new one.
+ *                  a record. This would be through the SDP database maintenance
+ *                  API. If the version already exists in the record, it is
+ *                  replaced with the new one.
  *
  * Returns          true if added OK, else false
  *
@@ -759,9 +759,9 @@
  * Function         SDP_AddLanguageBaseAttrIDList
  *
  * Description      This function is called to add a language base attr list to
- *                  a record. This would be through the SDP database maintenance API.
- *                  If the version already exists in the record, it is replaced
- *                  with the new one.
+ *                  a record. This would be through the SDP database maintenance
+ *                  API. If the version already exists in the record, it is
+ *                  replaced with the new one.
  *
  * Returns          true if added OK, else false
  *
@@ -803,8 +803,8 @@
  *
  * Description      This function is called to add a service list to a record.
  *                  This would be through the SDP database maintenance API.
- *                  If the service list already exists in the record, it is replaced
- *                  with the new list.
+ *                  If the service list already exists in the record, it is
+ *                  replaced with the new list.
  *
  * Returns          true if added OK, else false
  *
@@ -840,8 +840,9 @@
  *
  * Function         SDP_DeleteAttribute
  *
- * Description      This function is called to delete an attribute from a record.
- *                  This would be through the SDP database maintenance API.
+ * Description      This function is called to delete an attribute from a
+ *                  record. This would be through the SDP database maintenance
+ *                  API.
  *
  * Returns          true if deleted OK, else false if not found
  *
diff --git a/stack/sdp/sdp_discovery.cc b/stack/sdp/sdp_discovery.cc
index e6a7373..cbffd8d 100644
--- a/stack/sdp/sdp_discovery.cc
+++ b/stack/sdp/sdp_discovery.cc
@@ -42,7 +42,7 @@
 #endif
 
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 #if (SDP_CLIENT_ENABLED == TRUE)
 static void          process_service_search_rsp (tCONN_CB *p_ccb, uint8_t *p_reply);
@@ -389,8 +389,8 @@
  *
  * Function         process_service_attr_rsp
  *
- * Description      This function is called when there is a attribute response from
- *                  the server.
+ * Description      This function is called when there is a attribute response
+ *                  from the server.
  *
  * Returns          void
  *
diff --git a/stack/sdp/sdp_main.cc b/stack/sdp/sdp_main.cc
index dc635aa..2a0d5cf 100644
--- a/stack/sdp/sdp_main.cc
+++ b/stack/sdp/sdp_main.cc
@@ -47,12 +47,12 @@
 extern fixed_queue_t *btu_general_alarm_queue;
 
 /******************************************************************************/
-/*                       G L O B A L      S D P       D A T A                   */
+/*                     G L O B A L      S D P       D A T A                   */
 /******************************************************************************/
 tSDP_CB  sdp_cb;
 
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 static void sdp_connect_ind (BD_ADDR  bd_addr, uint16_t l2cap_cid, UNUSED_ATTR uint16_t psm,
                              uint8_t l2cap_id);
@@ -501,7 +501,7 @@
  *
  * Description      This function is called when data is received from L2CAP.
  *                  if we are the originator of the connection, we are the SDP
- *                  client, and the received message is queued up for the client.
+ *                  client, and the received message is queued for the client.
  *
  *                  If we are the destination of the connection, we are the SDP
  *                  server, so the message is passed to the server processing
diff --git a/stack/sdp/sdp_server.cc b/stack/sdp/sdp_server.cc
index ba24567..ae50003 100644
--- a/stack/sdp/sdp_server.cc
+++ b/stack/sdp/sdp_server.cc
@@ -51,7 +51,7 @@
 #define SDP_MAX_ATTR_RSPHDR_LEN         10
 
 /******************************************************************************/
-/*              L O C A L    F U N C T I O N     P R O T O T Y P E S            */
+/*            L O C A L    F U N C T I O N     P R O T O T Y P E S            */
 /******************************************************************************/
 static void process_service_search (tCONN_CB *p_ccb, uint16_t trans_num,
                                     uint16_t param_len, uint8_t *p_req,
@@ -67,10 +67,10 @@
 
 
 /******************************************************************************/
-/*                  E R R O R   T E X T   S T R I N G S                         */
-/*                                                                              */
-/* The default is to have no text string, but we allow the strings to be        */
-/* configured in target.h if people want them.                                  */
+/*                E R R O R   T E X T   S T R I N G S                         */
+/*                                                                            */
+/* The default is to have no text string, but we allow the strings to be      */
+/* configured in target.h if people want them.                                */
 /******************************************************************************/
 #ifndef SDP_TEXT_BAD_HEADER
 #define SDP_TEXT_BAD_HEADER     NULL
@@ -168,8 +168,8 @@
  * Function         process_service_search
  *
  * Description      This function handles a service search request from the
- *                  client. It builds a reply message with info from the database,
- *                  and sends the reply back to the client.
+ *                  client. It builds a reply message with info from the
+ *                  database, and sends the reply back to the client.
  *
  * Returns          void
  *
@@ -274,7 +274,7 @@
     UINT16_TO_BE_STREAM (p_rsp, num_rsp_handles);
     UINT16_TO_BE_STREAM (p_rsp, cur_handles);
 
-/*    SDP_TRACE_DEBUG("SDP Service Rsp: tothdl %d, curhdlr %d, start %d, end %d, cont %d",
+/*  SDP_TRACE_DEBUG("SDP Service Rsp: tothdl %d, curhdlr %d, start %d, end %d, cont %d",
                      num_rsp_handles, cur_handles, cont_offset,
                      cont_offset + cur_handles-1, is_cont); */
     for (xx = cont_offset; xx < cont_offset + cur_handles; xx++)
@@ -534,9 +534,10 @@
  *
  * Function         process_service_search_attr_req
  *
- * Description      This function handles a combined service search and attribute
- *                  read request from the client. It builds a reply message with
- *                  info from the database, and sends the reply back to the client.
+ * Description      This function handles a combined service search and
+ *                  attribute read request from the client. It builds a reply
+ *                  message with info from the database, and sends the reply
+ *                  back to the client.
  *
  * Returns          void
  *
@@ -736,20 +737,25 @@
     len_to_send = (uint16_t) (p_rsp - &p_ccb->rsp_list[0]);
     cont_offset = 0;
 
-    // The current SDP server design has a critical flaw where it can run into an infinite
-    // request/response loop with the client. Here's the scenario:
+    // The current SDP server design has a critical flaw where it can run into
+    // an infinite request/response loop with the client. Here's the scenario:
     // - client makes SDP request
-    // - server returns the first fragment of the response with a continuation token
+    // - server returns the first fragment of the response with a continuation
+    //   token
     // - an SDP record is deleted from the server
     // - client issues another request with previous continuation token
-    // - server has nothing to send back because the record is unavailable but in the
-    //   first fragment, it had specified more response bytes than are now available
-    // - server sends back no additional response bytes and returns the same continuation token
-    // - client issues another request with the continuation token, and the process repeats
+    // - server has nothing to send back because the record is unavailable but
+    //   in the first fragment, it had specified more response bytes than are
+    //   now available
+    // - server sends back no additional response bytes and returns the same
+    //   continuation token
+    // - client issues another request with the continuation token, and the
+    //   process repeats
     //
-    // We work around this design flaw here by checking if we will make forward progress
-    // (i.e. we will send > 0 response bytes) on a continued request. If not, we must have
-    // run into the above situation and we tell the peer an error occurred.
+    // We work around this design flaw here by checking if we will make forward
+    // progress (i.e. we will send > 0 response bytes) on a continued request.
+    // If not, we must have run into the above situation and we tell the peer an
+    // error occurred.
     //
     // TODO(sharvil): rewrite SDP server.
     if (is_cont && len_to_send == 0) {
diff --git a/stack/sdp/sdp_utils.cc b/stack/sdp/sdp_utils.cc
index acfc6e3..c92bd49 100644
--- a/stack/sdp/sdp_utils.cc
+++ b/stack/sdp/sdp_utils.cc
@@ -164,8 +164,8 @@
  * Function         sdpu_build_attrib_seq
  *
  * Description      This function builds an attribute sequence from the list of
- *                  passed attributes. It is also passed the address of the output
- *                  buffer.
+ *                  passed attributes. It is also passed the address of the
+ *                  output buffer.
  *
  * Returns          Pointer to next byte in the output buffer.
  *
@@ -218,8 +218,8 @@
  * Function         sdpu_build_attrib_entry
  *
  * Description      This function builds an attribute entry from the passed
- *                  attribute record. It is also passed the address of the output
- *                  buffer.
+ *                  attribute record. It is also passed the address of the
+ *                  output buffer.
  *
  * Returns          Pointer to next byte in the output buffer.
  *
@@ -645,8 +645,8 @@
  *
  * Function         sdpu_compare_uuid_arrays
  *
- * Description      This function compares 2 BE UUIDs. If needed, they are expanded
- *                  to 128-bit UUIDs, then compared.
+ * Description      This function compares 2 BE UUIDs. If needed, they are
+ *                  expanded to 128-bit UUIDs, then compared.
  *
  * NOTE             it is assumed that the arrays are in Big Endian format
  *
@@ -757,9 +757,9 @@
  *
  * Function         sdpu_compare_uuid_with_attr
  *
- * Description      This function compares a BT UUID structure with the UUID in an
- *                  SDP attribute record. If needed, they are expanded to 128-bit
- *                  UUIDs, then compared.
+ * Description      This function compares a BT UUID structure with the UUID in
+ *                  an SDP attribute record. If needed, they are expanded to
+ *                  128-bit UUIDs, then compared.
  *
  * NOTE           - it is assumed that BT UUID structures are compressed to the
  *                  smallest possible UUIDs (by removing the base SDP UUID).
@@ -991,7 +991,8 @@
  *                  p_out: output buffer
  *                  p_attr: attribute to be copied partially into p_out
  *                  rem_len: num bytes to copy into p_out
- *                  offset: current start offset within the attr that needs to be copied
+ *                  offset: current start offset within the attr that needs to
+ *                          be copied
  *
  * Returns          Pointer to next byte in the output buffer.
  *                  offset is also updated
@@ -1024,7 +1025,8 @@
  *
  * Function         sdpu_uuid16_to_uuid128
  *
- * Description      This function converts UUID-16 to UUID-128 by including the base UUID
+ * Description      This function converts UUID-16 to UUID-128 by including the
+ *                  base UUID
  *
  *                  uuid16: 2-byte UUID
  *                  p_uuid128: Expanded 128-bit UUID
diff --git a/stack/smp/aes.cc b/stack/smp/aes.cc
index 1665fcc..c9e5283 100644
--- a/stack/smp/aes.cc
+++ b/stack/smp/aes.cc
@@ -45,7 +45,8 @@
 
 #include <stdlib.h>
 
-/* add the target configuration to allow using internal data types and compilation options */
+/* add the target configuration to allow using internal data types and
+ * compilation options */
 #include "bt_target.h"
 
 /* define if you have fast 32-bit types on your system */
diff --git a/stack/smp/p_256_curvepara.cc b/stack/smp/p_256_curvepara.cc
index 9d2c942..3a8ef30 100644
--- a/stack/smp/p_256_curvepara.cc
+++ b/stack/smp/p_256_curvepara.cc
@@ -16,11 +16,11 @@
  *
  ******************************************************************************/
 
- /******************************************************************************
-  *
-  *  This file contains simple pairing algorithms
-  *
-  ******************************************************************************/
+/*******************************************************************************
+ *
+ *  This file contains simple pairing algorithms
+ *
+ ******************************************************************************/
 
 #include <string.h>
 #include "p_256_ecc_pp.h"
diff --git a/stack/smp/p_256_ecc_pp.cc b/stack/smp/p_256_ecc_pp.cc
index 0b12b6c..3fc1a5b 100644
--- a/stack/smp/p_256_ecc_pp.cc
+++ b/stack/smp/p_256_ecc_pp.cc
@@ -16,11 +16,12 @@
  *
  ******************************************************************************/
 
- /******************************************************************************
-  *
-  *  This file contains simple pairing algorithms using Elliptic Curve Cryptography for private public key
-  *
-  ******************************************************************************/
+/*******************************************************************************
+ *
+ *  This file contains simple pairing algorithms using Elliptic Curve
+ *  Cryptography for private public key
+ *
+ ******************************************************************************/
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/stack/smp/p_256_ecc_pp.h b/stack/smp/p_256_ecc_pp.h
index ebbb479..186dd29 100644
--- a/stack/smp/p_256_ecc_pp.h
+++ b/stack/smp/p_256_ecc_pp.h
@@ -16,11 +16,11 @@
  *
  ******************************************************************************/
 
- /******************************************************************************
-  *
-  *  This file contains simple pairing algorithms using Elliptic Curve Cryptography for private public key
-  *
-  ******************************************************************************/
+/******************************************************************************
+ *
+ *  This file contains simple pairing algorithms using Elliptic Curve Cryptography for private public key
+ *
+ ******************************************************************************/
 
 #pragma once
 
diff --git a/stack/smp/p_256_multprecision.cc b/stack/smp/p_256_multprecision.cc
index 9610ae3..2ad1a88 100644
--- a/stack/smp/p_256_multprecision.cc
+++ b/stack/smp/p_256_multprecision.cc
@@ -16,11 +16,11 @@
  *
  ******************************************************************************/
 
- /******************************************************************************
-  *
-  *  This file contains simple pairing algorithms
-  *
-  ******************************************************************************/
+/*******************************************************************************
+ *
+ *  This file contains simple pairing algorithms
+ *
+ ******************************************************************************/
 
 #include <string.h>
 #include "bt_target.h"
diff --git a/stack/smp/p_256_multprecision.h b/stack/smp/p_256_multprecision.h
index ce87ef3..009f6f0 100644
--- a/stack/smp/p_256_multprecision.h
+++ b/stack/smp/p_256_multprecision.h
@@ -16,11 +16,11 @@
  *
  ******************************************************************************/
 
- /******************************************************************************
-  *
-  *  This file contains simple pairing algorithms
-  *
-  ******************************************************************************/
+/*******************************************************************************
+ *
+ *  This file contains simple pairing algorithms
+ *
+ ******************************************************************************/
 #pragma once
 
 #include "bt_types.h"
diff --git a/stack/smp/smp_act.cc b/stack/smp/smp_act.cc
index 25dae2e..b17f0d2 100644
--- a/stack/smp/smp_act.cc
+++ b/stack/smp/smp_act.cc
@@ -123,7 +123,8 @@
 
 /*******************************************************************************
  * Function     smp_send_app_cback
- * Description  notifies application about the events the application is interested in
+ * Description  notifies application about the events the application is
+ *              interested in
  ******************************************************************************/
 void smp_send_app_cback(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
@@ -1463,7 +1464,8 @@
 
 /*******************************************************************************
  * Function     smp_br_send_pair_response
- * Description  actions related to sending pairing response over BR/EDR transport.
+ * Description  actions related to sending pairing response over BR/EDR
+ *              transport.
  ******************************************************************************/
 void smp_br_send_pair_response(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
@@ -1477,8 +1479,8 @@
 
 /*******************************************************************************
  * Function         smp_pairing_cmpl
- * Description      This function is called to send the pairing complete callback
- *                  and remove the connection if needed.
+ * Description      This function is called to send the pairing complete
+ *                  callback and remove the connection if needed.
  ******************************************************************************/
 void smp_pairing_cmpl(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
@@ -1491,8 +1493,8 @@
 
 /*******************************************************************************
  * Function         smp_pair_terminate
- * Description      This function is called to send the pairing complete callback
- *                  and remove the connection if needed.
+ * Description      This function is called to send the pairing complete
+ *                  callback and remove the connection if needed.
  ******************************************************************************/
 void smp_pair_terminate(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
@@ -1503,8 +1505,8 @@
 
 /*******************************************************************************
  * Function         smp_idle_terminate
- * Description      This function calledin idle state to determine to send authentication
- *                  complete or not.
+ * Description      This function calledin idle state to determine to send
+ *                  authentication complete or not.
  ******************************************************************************/
 void smp_idle_terminate(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
@@ -1554,9 +1556,10 @@
 
 /*******************************************************************************
  * Function     smp_start_secure_connection_phase1
- * Description  The function starts Secure Connection phase1 i.e. invokes initialization of Secure Connection
- *              phase 1 parameters and starts building/sending to the peer
- *              messages appropriate for the role and association model.
+ * Description  Start Secure Connection phase1 i.e. invokes initialization of
+ *              Secure Connection phase 1 parameters and starts building/sending
+ *              to the peer messages appropriate for the role and association
+ *              model.
  ******************************************************************************/
 void smp_start_secure_connection_phase1(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
@@ -1672,8 +1675,9 @@
 
 /*******************************************************************************
  * Function     smp_process_peer_nonce
- * Description  The function processes newly received and saved in CB peer nonce.
- *              The actions depend on the selected association model and the role.
+ * Description  The function processes newly received and saved in CB peer
+ *              nonce. The actions depend on the selected association model and
+ *              the role.
  *
  * Note         It is supposed to be called in SC phase1.
  ******************************************************************************/
@@ -1816,10 +1820,12 @@
 
 /*******************************************************************************
  * Function     smp_phase_2_dhkey_checks_are_present
- * Description  generates event if dhkey check from the peer is already received.
+ * Description  generates event if dhkey check from the peer is already
+ *              received.
  *
  * Note         It is supposed to be used on slave to prevent race condition.
- *              It is supposed to be called after slave dhkey check is calculated.
+ *              It is supposed to be called after slave dhkey check is
+ *              calculated.
  ******************************************************************************/
 void smp_phase_2_dhkey_checks_are_present(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
@@ -1831,8 +1837,8 @@
 
 /*******************************************************************************
  * Function     smp_wait_for_both_public_keys
- * Description  generates SMP_BOTH_PUBL_KEYS_RCVD_EVT event when both local and master
- *              public keys are available.
+ * Description  generates SMP_BOTH_PUBL_KEYS_RCVD_EVT event when both local and
+ *              master public keys are available.
  *
  * Note         on the slave it is used to prevent race condition.
  *
@@ -1929,8 +1935,8 @@
 
 /*******************************************************************************
  * Function     smp_set_local_oob_keys
- * Description  Saves calculated private/public keys in sc_oob_data.loc_oob_data,
- *              starts nonce generation
+ * Description  Saves calculated private/public keys in
+ *              sc_oob_data.loc_oob_data, starts nonce generation
  *              (to be saved in sc_oob_data.loc_oob_data.randomizer).
  ******************************************************************************/
 void smp_set_local_oob_keys(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
@@ -1945,8 +1951,9 @@
 
 /*******************************************************************************
  * Function     smp_set_local_oob_random_commitment
- * Description  Saves calculated randomizer and commitment in sc_oob_data.loc_oob_data,
- *              passes sc_oob_data.loc_oob_data up for safekeeping.
+ * Description  Saves calculated randomizer and commitment in
+ *              sc_oob_data.loc_oob_data, passes sc_oob_data.loc_oob_data up
+ *              for safekeeping.
  ******************************************************************************/
 void smp_set_local_oob_random_commitment(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
@@ -1994,9 +2001,9 @@
  *
  * Function         smp_link_encrypted
  *
- * Description      This function is called when link is encrypted and notified to
- *                  slave device. Proceed to to send LTK, DIV and ER to master if
- *                  bonding the devices.
+ * Description      This function is called when link is encrypted and notified
+ *                  to the slave device. Proceed to to send LTK, DIV and ER to
+ *                  master if bonding the devices.
  *
  *
  * Returns          void
@@ -2172,8 +2179,8 @@
 
 /*******************************************************************************
  * Function         smp_br_pairing_complete
- * Description      This function is called to send the pairing complete callback
- *                  and remove the connection if needed.
+ * Description      This function is called to send the pairing complete
+ *                  callback and remove the connection if needed.
  ******************************************************************************/
 void smp_br_pairing_complete(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
diff --git a/stack/smp/smp_api.cc b/stack/smp/smp_api.cc
index 97cdd73..8c55161 100644
--- a/stack/smp/smp_api.cc
+++ b/stack/smp/smp_api.cc
@@ -127,8 +127,8 @@
  *
  * Function         SMP_Pair
  *
- * Description      This function call to perform a SMP pairing with peer device.
- *                  Device support one SMP pairing at one time.
+ * Description      This function call to perform a SMP pairing with peer
+ *                  device. Device support one SMP pairing at one time.
  *
  * Parameters       bd_addr - peer device bd address.
  *
@@ -174,7 +174,8 @@
  *
  * Parameters       bd_addr - peer device bd address.
  *
- * Returns          SMP_STARTED if pairing started, otherwise reason for failure.
+ * Returns          SMP_STARTED if pairing started, otherwise the reason for
+ *                  failure.
  *
  ******************************************************************************/
 tSMP_STATUS SMP_BR_PairWith (BD_ADDR bd_addr)
@@ -252,7 +253,8 @@
  *
  * Parameters       bd_addr - peer device bd address.
  *                  res     - result of the operation SMP_SUCCESS if success.
- *                            Otherwise, SMP_REPEATED_ATTEMPTS is too many attempts.
+ *                            Otherwise, SMP_REPEATED_ATTEMPTS if too many
+ *                            attempts.
  *
  * Returns          None
  *
@@ -294,10 +296,12 @@
  * Description      This function is called after Security Manager submitted
  *                  passkey request to the application.
  *
- * Parameters:      bd_addr      - Address of the device for which passkey was requested
- *                  res          - result of the operation SMP_SUCCESS if success
+ * Parameters:      bd_addr - Address of the device for which passkey was
+ *                            requested
+ *                  res     - result of the operation SMP_SUCCESS if success
  *                  passkey - numeric value in the range of
- *                  BTM_MIN_PASSKEY_VAL(0) - BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
+ *                            BTM_MIN_PASSKEY_VAL(0) -
+ *                            BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
  *
  ******************************************************************************/
 void SMP_PasskeyReply (BD_ADDR bd_addr, uint8_t res, uint32_t passkey)
@@ -505,8 +509,8 @@
  *
  * Function         SMP_Encrypt
  *
- * Description      This function is called to encrypt the data with the specified
- *                  key
+ * Description      This function is called to encrypt the data with the
+ *                  specified key
  *
  * Parameters:      key                 - Pointer to key key[0] conatins the MSB
  *                  key_len             - key length
@@ -531,9 +535,11 @@
  *
  * Function         SMP_KeypressNotification
  *
- * Description      This function is called to notify Security Manager about Keypress Notification.
+ * Description      This function is called to notify Security Manager about
+ *                  Keypress Notification.
  *
- * Parameters:     bd_addr      Address of the device to send keypress notification to
+ * Parameters:     bd_addr      Address of the device to send keypress
+ *                              notification to
  *                 value        Keypress notification parameter value
  *
  ******************************************************************************/
@@ -555,8 +561,7 @@
         return;
     }
 
-    /* Keypress Notification is used by a device with KeyboardOnly IO capabilities */
-    /* during the passkey entry protocol */
+    /* Keypress Notification is used by a device with KeyboardOnly IO capabilities during the passkey entry protocol */
     if (p_cb->local_io_capability != SMP_IO_CAP_IN)
     {
         SMP_TRACE_ERROR ("%s() - wrong local IO capabilities %d",
@@ -581,7 +586,7 @@
  * Description      This function is called to start creation of local SC OOB
  *                  data set (tSMP_LOC_OOB_DATA).
  *
- * Parameters:      bd_addr      - Address of the device to send OOB data block to
+ * Parameters:      bd_addr - Address of the device to send OOB data block to
  *
  *  Returns         Boolean - true: creation of local SC OOB data set started.
  ******************************************************************************/
diff --git a/stack/smp/smp_br_main.cc b/stack/smp/smp_br_main.cc
index 24b8c78..b14e9a5 100644
--- a/stack/smp/smp_br_main.cc
+++ b/stack/smp/smp_br_main.cc
@@ -114,10 +114,13 @@
 
 static const uint8_t smp_br_all_table[][SMP_BR_SM_NUM_COLS] =
 {
-/*                               Event                    Action           Next State */
-/* BR_PAIRING_FAILED        */  {SMP_PROC_PAIR_FAIL,  SMP_BR_PAIRING_COMPLETE, SMP_BR_STATE_IDLE},
-/* BR_AUTH_CMPL             */  {SMP_SEND_PAIR_FAIL,  SMP_BR_PAIRING_COMPLETE, SMP_BR_STATE_IDLE},
-/* BR_L2CAP_DISCONN         */  {SMP_PAIR_TERMINATE,  SMP_BR_SM_NO_ACTION, SMP_BR_STATE_IDLE}
+/* Event              Action                   Next State */
+/* BR_PAIRING_FAILED */
+{SMP_PROC_PAIR_FAIL, SMP_BR_PAIRING_COMPLETE, SMP_BR_STATE_IDLE},
+/* BR_AUTH_CMPL */
+{SMP_SEND_PAIR_FAIL, SMP_BR_PAIRING_COMPLETE, SMP_BR_STATE_IDLE},
+/* BR_L2CAP_DISCONN */
+{SMP_PAIR_TERMINATE, SMP_BR_SM_NO_ACTION,     SMP_BR_STATE_IDLE}
 };
 
 /************ SMP Master FSM State/Event Indirection Table **************/
@@ -154,30 +157,38 @@
 
 static const uint8_t smp_br_master_idle_table[][SMP_BR_SM_NUM_COLS] =
 {
-/*                                Event               Action               Next State */
-/* BR_L2CAP_CONN        */  {SMP_SEND_APP_CBACK, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_WAIT_APP_RSP},
-/* BR_L2CAP_DISCONN   */  {SMP_IDLE_TERMINATE,  SMP_BR_SM_NO_ACTION, SMP_BR_STATE_IDLE}
+/* Event               Action               Next State */
+/* BR_L2CAP_CONN */
+{SMP_SEND_APP_CBACK, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_WAIT_APP_RSP},
+/* BR_L2CAP_DISCONN */
+{SMP_IDLE_TERMINATE,  SMP_BR_SM_NO_ACTION, SMP_BR_STATE_IDLE}
 };
 
 static const uint8_t smp_br_master_wait_appln_response_table[][SMP_BR_SM_NUM_COLS] =
 {
-/*                                Event               Action              Next State */
-/* BR_KEYS_RSP           */{SMP_SEND_PAIR_REQ, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_PAIR_REQ_RSP}
+/* Event               Action              Next State */
+/* BR_KEYS_RSP */
+{SMP_SEND_PAIR_REQ, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_PAIR_REQ_RSP}
 };
 
 static const uint8_t smp_br_master_pair_request_response_table [][SMP_BR_SM_NUM_COLS] =
 {
-/*                        Event               Action                  Next State */
-/* BR_PAIRING_RSP   */  {SMP_BR_PROC_PAIR_CMD, SMP_BR_CHECK_AUTH_REQ, SMP_BR_STATE_PAIR_REQ_RSP},
-/* BR_BOND_REQ      */  {SMP_BR_SM_NO_ACTION, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING}
+/* Event                Action                 Next State */
+/* BR_PAIRING_RSP */
+{SMP_BR_PROC_PAIR_CMD, SMP_BR_CHECK_AUTH_REQ, SMP_BR_STATE_PAIR_REQ_RSP},
+/* BR_BOND_REQ */
+{SMP_BR_SM_NO_ACTION,  SMP_BR_SM_NO_ACTION,   SMP_BR_STATE_BOND_PENDING}
 };
 
 static const uint8_t smp_br_master_bond_pending_table[][SMP_BR_SM_NUM_COLS] =
 {
-/*                                Event               Action              Next State */
-/* BR_ID_INFO               */{SMP_PROC_ID_INFO, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING},
-/* BR_ID_ADDR               */{SMP_PROC_ID_ADDR, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING},
-/* BR_SIGN_INFO             */{SMP_PROC_SRK_INFO, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING}
+/* Event            Action               Next State */
+/* BR_ID_INFO */
+{SMP_PROC_ID_INFO,  SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING},
+/* BR_ID_ADDR */
+{SMP_PROC_ID_ADDR,  SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING},
+/* BR_SIGN_INFO */
+{SMP_PROC_SRK_INFO, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING}
 };
 
 static const uint8_t smp_br_slave_entry_map[][SMP_BR_STATE_MAX] =
@@ -213,24 +224,31 @@
 
 static const uint8_t smp_br_slave_idle_table[][SMP_BR_SM_NUM_COLS] =
 {
-/*                               Event                Action              Next State */
-/* BR_PAIRING_REQ    */ {SMP_BR_PROC_PAIR_CMD, SMP_SEND_APP_CBACK, SMP_BR_STATE_WAIT_APP_RSP}
+/* Event                Action              Next State */
+/* BR_PAIRING_REQ */
+{SMP_BR_PROC_PAIR_CMD, SMP_SEND_APP_CBACK, SMP_BR_STATE_WAIT_APP_RSP}
 };
 
 static const uint8_t smp_br_slave_wait_appln_response_table [][SMP_BR_SM_NUM_COLS] =
 {
-/*                               Event                 Action             Next State */
-/* BR_API_SEC_GRANT */ {SMP_BR_PROC_SEC_GRANT, SMP_SEND_APP_CBACK, SMP_BR_STATE_WAIT_APP_RSP},
-/* BR_KEYS_RSP     */{SMP_BR_PROC_SL_KEYS_RSP, SMP_BR_CHECK_AUTH_REQ,SMP_BR_STATE_WAIT_APP_RSP},
-/* BR_BOND_REQ        */ {SMP_BR_KEY_DISTRIBUTION, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING}
+/* Event                 Action             Next State */
+/* BR_API_SEC_GRANT */
+{SMP_BR_PROC_SEC_GRANT, SMP_SEND_APP_CBACK, SMP_BR_STATE_WAIT_APP_RSP},
+/* BR_KEYS_RSP */
+{SMP_BR_PROC_SL_KEYS_RSP, SMP_BR_CHECK_AUTH_REQ,SMP_BR_STATE_WAIT_APP_RSP},
+/* BR_BOND_REQ */
+{SMP_BR_KEY_DISTRIBUTION, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING}
 };
 
 static const uint8_t smp_br_slave_bond_pending_table[][SMP_BR_SM_NUM_COLS] =
 {
-/*                                Event               Action               Next State */
-/* BR_ID_INFO               */  {SMP_PROC_ID_INFO, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING},
-/* BR_ID_ADDR               */  {SMP_PROC_ID_ADDR, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING},
-/* BR_SIGN_INFO             */  {SMP_PROC_SRK_INFO, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING}
+/* Event               Action               Next State */
+/* BR_ID_INFO */
+{SMP_PROC_ID_INFO, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING},
+/* BR_ID_ADDR */
+{SMP_PROC_ID_ADDR, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING},
+/* BR_SIGN_INFO */
+{SMP_PROC_SRK_INFO, SMP_BR_SM_NO_ACTION, SMP_BR_STATE_BOND_PENDING}
 };
 
 static const tSMP_BR_SM_TBL smp_br_state_table[][2] =
@@ -320,10 +338,10 @@
  *
  * Description  Handle events to the state machine. It looks up the entry
  *              in the smp_br_entry_table array.
- *              If it is a valid entry, it gets the state table.Set the next state,
- *              if not NULL state. Execute the action function according to the
- *              state table. If the state returned by action function is not NULL
- *              state, adjust the new state to the returned state.
+ *              If it is a valid entry, it gets the state table. Set the next
+ *              state, if not NULL state. Execute the action function according
+ *              to the state table. If the state returned by action function is
+ *              not NULL state, adjust the new state to the returned state.
  *
  * Returns      void.
  *
diff --git a/stack/smp/smp_cmac.cc b/stack/smp/smp_cmac.cc
index 0354524..2170082 100644
--- a/stack/smp/smp_cmac.cc
+++ b/stack/smp/smp_cmac.cc
@@ -123,7 +123,8 @@
  *
  * Function         cmac_aes_k_calculate
  *
- * Description      This function is the calculation of block cipher using AES-128.
+ * Description      This function is the calculation of block cipher using
+ *                  AES-128.
  *
  * Returns          void
  *
@@ -204,7 +205,8 @@
  *
  * Function         cmac_subkey_cont
  *
- * Description      This is the callback function when CIPHk(0[128]) is completed.
+ * Description      This is the callback function when CIPHk(0[128]) is
+ *                  completed.
  *
  * Returns          void
  *
@@ -276,13 +278,16 @@
  *
  * Function         aes_cipher_msg_auth_code
  *
- * Description      This is the AES-CMAC Generation Function with tlen implemented.
+ * Description      This is the AES-CMAC Generation Function with tlen
+ *                  implemented.
  *
- * Parameters       key - CMAC key in little endian order, expect SRK when used by SMP.
+ * Parameters       key - CMAC key in little endian order, expect SRK when used
+ *                        by SMP.
  *                  input - text to be signed in little endian byte order.
  *                  length - length of the input in byte.
  *                  tlen - lenth of mac desired
- *                  p_signature - data pointer to where signed data to be stored, tlen long.
+ *                  p_signature - data pointer to where signed data to be
+ *                                stored, tlen long.
  *
  * Returns          false if out of resources, true in other cases.
  *
diff --git a/stack/smp/smp_int.h b/stack/smp/smp_int.h
index c706a83..d121af4 100644
--- a/stack/smp/smp_int.h
+++ b/stack/smp/smp_int.h
@@ -33,15 +33,17 @@
 extern "C" {
 #endif
 
-#define SMP_MODEL_ENCRYPTION_ONLY  0   /* Legacy mode, Just Works model */
-#define SMP_MODEL_PASSKEY       1   /* Legacy mode, Passkey Entry model, this side inputs the key */
-#define SMP_MODEL_OOB           2   /* Legacy mode, OOB model */
-#define SMP_MODEL_KEY_NOTIF     3   /* Legacy mode, Passkey Entry model, this side displays the key */
-#define SMP_MODEL_SEC_CONN_JUSTWORKS  4  /* Secure Connections mode, Just Works model */
-#define SMP_MODEL_SEC_CONN_NUM_COMP   5  /* Secure Connections mode, Numeric Comparison model */
-#define SMP_MODEL_SEC_CONN_PASSKEY_ENT 6 /* Secure Connections mode, Passkey Entry model, */
+/* Legacy mode */
+#define SMP_MODEL_ENCRYPTION_ONLY  0   /* Just Works model */
+#define SMP_MODEL_PASSKEY       1   /* Passkey Entry model, input the key */
+#define SMP_MODEL_OOB           2   /* OOB model */
+#define SMP_MODEL_KEY_NOTIF     3   /* Passkey Entry model, display the key */
+/* Secure connections mode */
+#define SMP_MODEL_SEC_CONN_JUSTWORKS  4  /* Just Works model */
+#define SMP_MODEL_SEC_CONN_NUM_COMP   5  /* Numeric Comparison model */
+#define SMP_MODEL_SEC_CONN_PASSKEY_ENT 6 /* Passkey Entry model, */
                                     /* this side inputs the key */
-#define SMP_MODEL_SEC_CONN_PASSKEY_DISP 7   /* Secure Connections mode, Passkey Entry model, */
+#define SMP_MODEL_SEC_CONN_PASSKEY_DISP 7   /* Passkey Entry model, */
                                     /* this side displays the key */
 #define SMP_MODEL_SEC_CONN_OOB  8   /* Secure Connections mode, OOB model */
 #define SMP_MODEL_OUT_OF_RANGE  9
@@ -90,49 +92,53 @@
 
 #define SMP_PAIR_DHKEY_CHCK_EVT         SMP_OPCODE_PAIR_DHKEY_CHECK
 
-#define SMP_PUBL_KEY_EXCH_REQ_EVT       (SMP_SELF_DEF_EVT + 11) /* request to start public */
-                                                                /* key exchange */
+/* request to start public  key exchange */
+#define SMP_PUBL_KEY_EXCH_REQ_EVT       (SMP_SELF_DEF_EVT + 11)
 
-#define SMP_LOC_PUBL_KEY_CRTD_EVT       (SMP_SELF_DEF_EVT + 12) /* local public key created */
+/* local public key created */
+#define SMP_LOC_PUBL_KEY_CRTD_EVT       (SMP_SELF_DEF_EVT + 12)
 
-#define SMP_BOTH_PUBL_KEYS_RCVD_EVT     (SMP_SELF_DEF_EVT + 13) /* both local and peer public */
-                                                                /* keys are saved in cb */
+/* both local and peer public keys are saved in cb */
+#define SMP_BOTH_PUBL_KEYS_RCVD_EVT     (SMP_SELF_DEF_EVT + 13)
 
-#define SMP_SC_DHKEY_CMPLT_EVT          (SMP_SELF_DEF_EVT + 14) /* DHKey computation is completed,*/
-                                                                /* time to start SC phase1 */
+/* DHKey computation is completed, time to start SC phase1 */
+#define SMP_SC_DHKEY_CMPLT_EVT          (SMP_SELF_DEF_EVT + 14)
 
-#define SMP_HAVE_LOC_NONCE_EVT          (SMP_SELF_DEF_EVT + 15) /* new local nonce is generated */
-                                                                /*and saved in p_cb->rand */
+/* new local nonce is generated and saved in p_cb->rand */
+#define SMP_HAVE_LOC_NONCE_EVT          (SMP_SELF_DEF_EVT + 15)
 
-#define SMP_SC_PHASE1_CMPLT_EVT         (SMP_SELF_DEF_EVT + 16) /* time to start SC phase2 */
+/* time to start SC phase2 */
+#define SMP_SC_PHASE1_CMPLT_EVT         (SMP_SELF_DEF_EVT + 16)
 
-#define SMP_SC_CALC_NC_EVT              (SMP_SELF_DEF_EVT + 17) /* request to calculate number */
-                                                             /* for user check. Used only in the */
-                                                             /* numeric compare protocol */
+/* request to calculate number for user check. Used only in the numeric compare protocol */
+#define SMP_SC_CALC_NC_EVT              (SMP_SELF_DEF_EVT + 17)
 
 /* Request to display the number for user check to the user.*/
 /* Used only in the numeric compare protocol */
 #define SMP_SC_DSPL_NC_EVT              (SMP_SELF_DEF_EVT + 18)
 
-#define SMP_SC_NC_OK_EVT                (SMP_SELF_DEF_EVT + 19) /* user confirms 'OK' numeric */
-                                                                /*comparison request */
+/* user confirms 'OK' numeric comparison request */
+#define SMP_SC_NC_OK_EVT                (SMP_SELF_DEF_EVT + 19)
 
-/* both local and peer DHKey Checks are already present - it is used on slave to prevent race condition */
+/* both local and peer DHKey Checks are already present - it is used on slave to
+ * prevent a race condition */
 #define SMP_SC_2_DHCK_CHKS_PRES_EVT     (SMP_SELF_DEF_EVT + 20)
 
-/* same meaning as SMP_KEY_READY_EVT to separate between SC and legacy actions */
+/* same meaning as SMP_KEY_READY_EVT to separate between SC and legacy actions
+ */
 #define SMP_SC_KEY_READY_EVT            (SMP_SELF_DEF_EVT + 21)
 #define SMP_KEYPRESS_NOTIFICATION_EVENT (SMP_SELF_DEF_EVT + 22)
 
-#define SMP_SC_OOB_DATA_EVT             (SMP_SELF_DEF_EVT + 23) /* SC OOB data from some */
-                                                                /* repository is provided */
+/* SC OOB data from some repository is provided */
+#define SMP_SC_OOB_DATA_EVT             (SMP_SELF_DEF_EVT + 23)
 
 #define SMP_CR_LOC_SC_OOB_DATA_EVT      (SMP_SELF_DEF_EVT + 24)
 #define SMP_MAX_EVT                      SMP_CR_LOC_SC_OOB_DATA_EVT
 
 typedef uint8_t tSMP_EVENT;
 
-/* Assumption it's only using the low 8 bits, if bigger than that, need to expand it to 16 bits */
+/* Assumption it's only using the low 8 bits, if bigger than that, need to
+ * expand it to 16 bits */
 #define SMP_SEC_KEY_MASK                    0x00ff
 
 /* SMP pairing state */
@@ -162,18 +168,18 @@
 /* SMP over BR/EDR events */
 #define SMP_BR_PAIRING_REQ_EVT              SMP_OPCODE_PAIRING_REQ
 #define SMP_BR_PAIRING_RSP_EVT              SMP_OPCODE_PAIRING_RSP
-#define SMP_BR_CONFIRM_EVT                  SMP_OPCODE_CONFIRM    /* not expected over BR/EDR */
-#define SMP_BR_RAND_EVT                     SMP_OPCODE_RAND       /* not expected over BR/EDR */
+#define SMP_BR_CONFIRM_EVT                  SMP_OPCODE_CONFIRM    /* not over BR/EDR */
+#define SMP_BR_RAND_EVT                     SMP_OPCODE_RAND       /* not over BR/EDR */
 #define SMP_BR_PAIRING_FAILED_EVT           SMP_OPCODE_PAIRING_FAILED
-#define SMP_BR_ENCRPTION_INFO_EVT           SMP_OPCODE_ENCRYPT_INFO /* not expected over BR/EDR */
-#define SMP_BR_MASTER_ID_EVT                SMP_OPCODE_MASTER_ID    /* not expected over BR/EDR */
+#define SMP_BR_ENCRPTION_INFO_EVT           SMP_OPCODE_ENCRYPT_INFO /* not over BR/EDR */
+#define SMP_BR_MASTER_ID_EVT                SMP_OPCODE_MASTER_ID    /* not over BR/EDR */
 #define SMP_BR_ID_INFO_EVT                  SMP_OPCODE_IDENTITY_INFO
 #define SMP_BR_ID_ADDR_EVT                  SMP_OPCODE_ID_ADDR
 #define SMP_BR_SIGN_INFO_EVT                SMP_OPCODE_SIGN_INFO
-#define SMP_BR_SECURITY_REQ_EVT          SMP_OPCODE_SEC_REQ          /* not expected over BR/EDR */
-#define SMP_BR_PAIR_PUBLIC_KEY_EVT       SMP_OPCODE_PAIR_PUBLIC_KEY  /* not expected over BR/EDR */
-#define SMP_BR_PAIR_DHKEY_CHCK_EVT       SMP_OPCODE_PAIR_DHKEY_CHECK /* not expected over BR/EDR */
-#define SMP_BR_PAIR_KEYPR_NOTIF_EVT      SMP_OPCODE_PAIR_KEYPR_NOTIF /* not expected over BR/EDR */
+#define SMP_BR_SECURITY_REQ_EVT          SMP_OPCODE_SEC_REQ          /* not over BR/EDR */
+#define SMP_BR_PAIR_PUBLIC_KEY_EVT       SMP_OPCODE_PAIR_PUBLIC_KEY  /* not over BR/EDR */
+#define SMP_BR_PAIR_DHKEY_CHCK_EVT       SMP_OPCODE_PAIR_DHKEY_CHECK /* not over BR/EDR */
+#define SMP_BR_PAIR_KEYPR_NOTIF_EVT      SMP_OPCODE_PAIR_KEYPR_NOTIF /* not over BR/EDR */
 #define SMP_BR_SELF_DEF_EVT              SMP_BR_PAIR_KEYPR_NOTIF_EVT
 #define SMP_BR_KEY_READY_EVT                (SMP_BR_SELF_DEF_EVT + 1)
 #define SMP_BR_ENCRYPTED_EVT                (SMP_BR_SELF_DEF_EVT + 2)
diff --git a/stack/smp/smp_keys.cc b/stack/smp/smp_keys.cc
index 1fec7e6..16f7383 100644
--- a/stack/smp/smp_keys.cc
+++ b/stack/smp/smp_keys.cc
@@ -241,9 +241,9 @@
  *
  * Function         smp_generate_stk
  *
- * Description      This function is called to generate STK calculated by running
- *                  AES with the TK value as key and a concatenation of the random
- *                  values.
+ * Description      This function is called to generate STK calculated by
+ *                  running AES with the TK value as key and a concatenation of
+ *                  the random values.
  *
  * Returns          void
  *
@@ -299,8 +299,8 @@
  *
  * Function         smp_generate_rand_cont
  *
- * Description      This function is called to generate another 64 bits random for
- *                  MRand or Srand.
+ * Description      This function is called to generate another 64 bits random
+ *                  for MRand or Srand.
  *
  * Returns          void
  *
@@ -321,10 +321,10 @@
  * Description      This function is called:
  *                  - in legacy pairing - to calculate LTK, starting with DIV
  *                    generation;
- *                  - in LE Secure Connections pairing over LE transport - to process LTK
- *                    already generated to encrypt LE link;
- *                  - in LE Secure Connections pairing over BR/EDR transport - to start
- *                    BR/EDR Link Key processing.
+ *                  - in LE Secure Connections pairing over LE transport - to
+ *                    process LTK already generated to encrypt LE link;
+ *                  - in LE Secure Connections pairing over BR/EDR transport -
+ *                    to start BR/EDR Link Key processing.
  *
  * Returns          void
  *
@@ -670,8 +670,9 @@
  *
  * Function         smp_generate_confirm
  *
- * Description      This function is called when a 48 bits random number is generated
- *                  as SRand or MRand, continue to calculate Sconfirm or MConfirm.
+ * Description      This function is called when a 48 bits random number is
+ *                  generated as SRand or MRand, continue to calculate Sconfirm
+ *                  or MConfirm.
  *
  * Returns          void
  *
@@ -689,9 +690,10 @@
  *
  * Function         smp_generate_compare
  *
- * Description      This function is called to generate SConfirm for Slave device,
- *                  or MSlave for Master device. This function can be also used for
- *                  generating Compare number for confirm value check.
+ * Description      This function is called to generate SConfirm for Slave
+ *                  device, or MSlave for Master device. This function can be
+ *                  also used for generating Compare number for confirm value
+ *                  check.
  *
  * Returns          void
  *
@@ -787,7 +789,7 @@
  *
  * Function         smp_generate_ltk_cont
  *
- * Description      This function is to calculate LTK = d1(ER, DIV, 0)= e(ER, DIV)
+ * Description      Calculate LTK = d1(ER, DIV, 0)= e(ER, DIV)
  *
  * Returns          void
  *
@@ -856,8 +858,8 @@
  *
  * Function         smp_generate_rand_vector
  *
- * Description      This function is called when LTK is generated, send state machine
- *                  event to SMP.
+ * Description      This function is called when an LTK is generated, send state
+ *                  machine event to SMP.
  *
  * Returns          void
  *
@@ -943,8 +945,8 @@
  *
  * Description      This function is called to create private key used to
  *                  calculate public key and DHKey.
- *                  The function starts private key creation requesting controller
- *                  to generate [0-7] octets of private key.
+ *                  The function starts private key creation requesting
+ *                  for the controller to generate [0-7] octets of private key.
  *
  * Returns          void
  *
@@ -961,8 +963,8 @@
  * Function         smp_use_oob_private_key
  *
  * Description      This function is called
- *                  - to save the secret key used to calculate the public key used
- *                    in calculations of commitment sent OOB to a peer
+ *                  - to save the secret key used to calculate the public key
+ *                    used in calculations of commitment sent OOB to a peer
  *                  - to use this secret key to recalculate the public key and
  *                    start the process of sending this public key to the peer
  *                  if secret/public keys have to be reused.
@@ -1276,8 +1278,8 @@
  *
  * Function         smp_calculate_numeric_comparison_display_number
  *
- * Description      The function calculates and saves number to display in numeric
- *                  comparison association mode.
+ * Description      The function calculates and saves number to display in
+ *                  numeric comparison association mode.
  *
  * Returns          void
  *
@@ -1330,7 +1332,8 @@
  *                          Y     is 128 bit,
  *
  * Returns          Vres.
- *                  Expected value has to be in the range [0 - 999999] i.e. [0 - 0xF423F].
+ *                  Expected value has to be in the range [0 - 999999] i.e.
+ *                        [0 - 0xF423F].
  *                  Vres = 1000000 means that the calculation fails.
  *
  * Note             The LSB is the first octet, the MSB is the last octet of
@@ -1408,9 +1411,10 @@
  *
  * Function         smp_calculate_f5
  *
- * Description      The function provides two AES-CMAC that are supposed to be used as
- *                  - MacKey (MacKey is used in pairing DHKey check calculation);
- *                  - LTK (LTK is used to ecrypt the link after completion of Phase 2
+ * Description      The function provides two AES-CMAC that are supposed to be
+ *                    used as
+ *                  - MacKey (used in pairing DHKey check calculation);
+ *                  - LTK (used to ecrypt the link after completion of Phase 2
  *                    and on reconnection, to derive BR/EDR LK).
  *                  The function inputs are W, N1, N2, A1, A2.
  *                  F5 rules:
@@ -1419,22 +1423,26 @@
  *                    The formula is:
  *                          T = AES-CMAC    (W)
  *                                      salt
- *                    where salt is internal parameter of smp_calculate_f5_key(...).
- *                  - MacKey and LTK are calculated as AES-MAC values received with the
- *                    key T calculated in the previous step and the plaintext message
- *                    built from the external parameters N1, N2, A1, A2 and the internal
- *                    parameters counter, keyID, length.
- *                    The function smp_calculate_f5_mackey_or_long_term_key(...) is used in the
- *                    calculations.
- *                    The same formula is used in calculation of MacKey and LTK and the
- *                    same parameter values except the value of the internal parameter
- *                    counter:
+ *                    where salt is internal parameter of
+ *                    smp_calculate_f5_key(...).
+ *                  - MacKey and LTK are calculated as AES-MAC values received
+ *                    with the key T calculated in the previous step and the
+ *                    plaintext message built from the external parameters N1,
+ *                    N2, A1, A2 and the internal parameters counter, keyID,
+ *                    length.
+ *                    The function smp_calculate_f5_mackey_or_long_term_key(...)
+ *                    is used in the calculations.
+ *                    The same formula is used in calculation of MacKey and LTK
+ *                    and the same parameter values except the value of the
+ *                    internal parameter counter:
  *                    - in MacKey calculations the value is 0;
  *                    - in LTK calculations the value is 1.
- *                      MacKey  = AES-CMAC (Counter=0||keyID||N1||N2||A1||A2||Length=256)
- *                                        T
- *                      LTK     = AES-CMAC (Counter=1||keyID||N1||N2||A1||A2||Length=256)
- *                                        T
+ *                      MacKey  =
+ *                       AES-CMAC (Counter=0||keyID||N1||N2||A1||A2||Length=256)
+ *                               T
+ *                      LTK     =
+ *                       AES-CMAC (Counter=1||keyID||N1||N2||A1||A2||Length=256)
+ *                               T
  *                  The parameters are
  *                  input:
  *                          W       is 256 bits,
@@ -1537,8 +1545,8 @@
  *
  * Function         smp_calculate_f5_mackey_or_long_term_key
  *
- * Description      The function calculates the value of MacKey or LTK by the rules
- *                  defined for f5 function.
+ * Description      The function calculates the value of MacKey or LTK by the
+ *                  rules defined for f5 function.
  *                  At the moment exactly the same formula is used to calculate
  *                  LTK and MacKey.
  *                  The difference is the value of input parameter Counter:
@@ -1716,7 +1724,8 @@
  *
  * Description      The function calculates and saves local device DHKey check
  *                  value in CB.
- *                  Before doing this it calls smp_calculate_f5_mackey_and_long_term_key(...).
+ *                  Before doing this it calls
+ *                  smp_calculate_f5_mackey_and_long_term_key(...).
  *                  to calculate MacKey and LTK.
  *                  MacKey is used in dhkey calculation.
  *
@@ -1790,8 +1799,9 @@
  * Function         smp_calculate_f6
  *
  * Description      The function calculates
- *                  C = f6(W, N1, N2, R, IOcap, A1, A2) = AES-CMAC (N1||N2||R||IOcap||A1||A2)
- *                                                                W
+ *                  C = f6(W, N1, N2, R, IOcap, A1, A2) =
+ *                      AES-CMAC (N1||N2||R||IOcap||A1||A2)
+ *                              W
  *                  where
  *                  input:  W is 128 bit,
  *                          N1 is 128 bit,
@@ -1881,8 +1891,8 @@
  *
  * Function         smp_calculate_link_key_from_long_term_key
  *
- * Description      The function calculates and saves BR/EDR link key derived from
- *                  LE SC LTK.
+ * Description      The function calculates and saves BR/EDR link key derived
+ *                  from LE SC LTK.
  *
  * Returns          false if out of resources, true in other cases.
  *
diff --git a/stack/smp/smp_main.cc b/stack/smp/smp_main.cc
index 6d601d2..93615c1 100644
--- a/stack/smp/smp_main.cc
+++ b/stack/smp/smp_main.cc
@@ -232,426 +232,629 @@
 /************ SMP Master FSM State/Event Indirection Table **************/
 static const uint8_t smp_master_entry_map[][SMP_STATE_MAX] =
 {
-/* state name:             Idle WaitApp SecReq Pair   Wait Confirm Rand PublKey SCPhs1  Wait  Wait  SCPhs2  Wait   DHKChk Enc   Bond  CrLocSc
-                                 Rsp    Pend   ReqRsp Cfm               Exch    Strt    Cmtm  Nonce Strt    DHKChk        Pend  Pend  OobData   */
-/* PAIR_REQ             */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* PAIR_RSP             */{ 0,    0,     0,      1,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* CONFIRM              */{ 0,    0,     0,      0,     0,   1,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* RAND                 */{ 0,    0,     0,      0,     0,   0,    1,   0,      0,      0,    1,    0,      0,     0,     0,    0,     0   },
-/* PAIR_FAIL            */{ 0,    0x81,  0,      0x81,  0x81,0x81, 0x81,0x81,   0x81,   0x81, 0x81, 0x81,   0x81,  0x81,  0,    0x81,  0   },
-/* ENC_INFO             */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    1,     0   },
-/* MASTER_ID            */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    4,     0   },
-/* ID_INFO              */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    2,     0   },
-/* ID_ADDR              */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    5,     0   },
-/* SIGN_INFO            */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    3,     0   },
-/* SEC_REQ              */{ 2,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* PAIR_PUBLIC_KEY      */{ 0,    0,     0,      0,     0,   0,    0,   2,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* PAIR_DHKEY_CHCK      */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      1,     0,     0,    0,     0   },
-/* PAIR_KEYPR_NOTIF     */{ 0,    8,     0,      0,     0,   0,    0,   0,      5,      2,    0,    0,      0,     0,     0,    0,     0   },
-/* PAIR_COMMITM         */{ 0,    0,     0,      0,     0,   0,    0,   0,      6,      1,    0,    0,      0,     0,     0,    0,     0   },
-/* KEY_READY            */{ 0,    3,     0,      3,     1,   0,    2,   0,      4,      0,    0,    0,      0,     0,     1,    6,     0   },
-/* ENC_CMPL             */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     2,    0,     0   },
-/* L2C_CONN             */{ 1,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* L2C_DISC             */{ 3,    0x83,  0,      0x83,  0x83,0x83, 0x83,0x83,   0x83,   0x83, 0x83, 0x83,   0x83,  0x83,  0x83, 0x83,  0   },
-/* IO_RSP               */{ 0,    2,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* SEC_GRANT            */{ 0,    1,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* TK_REQ               */{ 0,    0,     0,      2,     0,   0,    0,   0,      3,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* AUTH_CMPL            */{ 4,    0x82,  0,      0x82,  0x82,0x82, 0x82,0x82,   0x82,   0x82, 0x82, 0x82,   0x82,  0x82,  0x82, 0x82,  0   },
-/* ENC_REQ              */{ 0,    4,     0,      0,     0,   0,    3,   0,      0,      0,    0,    0,      0,     2,     0,    0,     0   },
-/* BOND_REQ             */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     3,    0,     0   },
-/* DISCARD_SEC_REQ      */{ 0,    5,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     3,    0,     0   },
-/* PUBL_KEY_EXCH_REQ    */{ 0,    0,     0,      4,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* LOC_PUBL_KEY_CRTD    */{ 0,    0,     0,      0,     0,   0,    0,   1,      0,      0,    0,    0,      0,     0,     0,    0,     1   },
-/* BOTH_PUBL_KEYS_RCVD  */{ 0,    0,     0,      0,     0,   0,    0,   3,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* SC_DHKEY_CMPLT       */{ 0,    0,     0,      0,     0,   0,    0,   0,      1,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* HAVE_LOC_NONCE       */{ 0,    0,     0,      0,     0,   0,    0,   0,      2,      0,    0,    0,      0,     0,     0,    0,     2   },
-/* SC_PHASE1_CMPLT      */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    1,      0,     0,     0,    0,     0   },
-/* SC_CALC_NC           */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    2,    0,      0,     0,     0,    0,     0   },
-/* SC_DSPL_NC           */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    3,    0,      0,     0,     0,    0,     0   },
-/* SC_NC_OK             */{ 0,    6,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* SC_2_DHCK_CHKS_PRES  */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* SC_KEY_READY         */{ 0,    7,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     1,     0,    0,     0   },
-/* KEYPR_NOTIF          */{ 0,    9,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* SC_OOB_DATA          */{ 0,    10,    0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* CR_LOC_SC_OOB_DATA   */{ 5,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* state name: */
+/* Idle, WaitApp Rsp, SecReq Pend, Pair ReqRsp, Wait Cfm, Confirm, Rand, PublKey Exch, SCPhs1 Strt, Wait Cmtm, Wait Nonce, SCPhs2 Strt, Wait DHKChk, DHKChk, Enc Pend, Bond Pend, CrLocSc OobData */
+/* PAIR_REQ */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* PAIR_RSP */
+{ 0,    0,     0,      1,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* CONFIRM */
+{ 0,    0,     0,      0,     0,   1,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* RAND */
+{ 0,    0,     0,      0,     0,   0,    1,   0,      0,      0,    1,    0,      0,     0,     0,    0,     0   },
+/* PAIR_FAIL */
+{ 0,    0x81,  0,      0x81,  0x81,0x81, 0x81,0x81,   0x81,   0x81, 0x81, 0x81,   0x81,  0x81,  0,    0x81,  0   },
+/* ENC_INFO */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    1,     0   },
+/* MASTER_ID */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    4,     0   },
+/* ID_INFO */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    2,     0   },
+/* ID_ADDR */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    5,     0   },
+/* SIGN_INFO */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    3,     0   },
+/* SEC_REQ */
+{ 2,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* PAIR_PUBLIC_KEY */
+{ 0,    0,     0,      0,     0,   0,    0,   2,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* PAIR_DHKEY_CHCK */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      1,     0,     0,    0,     0   },
+/* PAIR_KEYPR_NOTIF */
+{ 0,    8,     0,      0,     0,   0,    0,   0,      5,      2,    0,    0,      0,     0,     0,    0,     0   },
+/* PAIR_COMMITM */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      6,      1,    0,    0,      0,     0,     0,    0,     0   },
+/* KEY_READY */
+{ 0,    3,     0,      3,     1,   0,    2,   0,      4,      0,    0,    0,      0,     0,     1,    6,     0   },
+/* ENC_CMPL */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     2,    0,     0   },
+/* L2C_CONN */
+{ 1,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* L2C_DISC */
+{ 3,    0x83,  0,      0x83,  0x83,0x83, 0x83,0x83,   0x83,   0x83, 0x83, 0x83,   0x83,  0x83,  0x83, 0x83,  0   },
+/* IO_RSP */
+{ 0,    2,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* SEC_GRANT */
+{ 0,    1,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* TK_REQ */
+{ 0,    0,     0,      2,     0,   0,    0,   0,      3,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* AUTH_CMPL */
+{ 4,    0x82,  0,      0x82,  0x82,0x82, 0x82,0x82,   0x82,   0x82, 0x82, 0x82,   0x82,  0x82,  0x82, 0x82,  0   },
+/* ENC_REQ */
+{ 0,    4,     0,      0,     0,   0,    3,   0,      0,      0,    0,    0,      0,     2,     0,    0,     0   },
+/* BOND_REQ */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     3,    0,     0   },
+/* DISCARD_SEC_REQ */
+{ 0,    5,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     3,    0,     0   },
+/* PUBL_KEY_EXCH_REQ */
+{ 0,    0,     0,      4,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* LOC_PUBL_KEY_CRTD */
+{ 0,    0,     0,      0,     0,   0,    0,   1,      0,      0,    0,    0,      0,     0,     0,    0,     1   },
+/* BOTH_PUBL_KEYS_RCVD */
+{ 0,    0,     0,      0,     0,   0,    0,   3,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* SC_DHKEY_CMPLT */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      1,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* HAVE_LOC_NONCE */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      2,      0,    0,    0,      0,     0,     0,    0,     2   },
+/* SC_PHASE1_CMPLT */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    1,      0,     0,     0,    0,     0   },
+/* SC_CALC_NC */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    2,    0,      0,     0,     0,    0,     0   },
+/* SC_DSPL_NC */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    3,    0,      0,     0,     0,    0,     0   },
+/* SC_NC_OK */
+{ 0,    6,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* SC_2_DHCK_CHKS_PRES */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* SC_KEY_READY */
+{ 0,    7,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     1,     0,    0,     0   },
+/* KEYPR_NOTIF */
+{ 0,    9,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* SC_OOB_DATA */
+{ 0,    10,    0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* CR_LOC_SC_OOB_DATA */
+{ 5,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
 };
 
 static const uint8_t smp_all_table[][SMP_SM_NUM_COLS] =
 {
-/*                       Event                     Action                 Next State */
-/* PAIR_FAIL */          {SMP_PROC_PAIR_FAIL,      SMP_PAIRING_CMPL, SMP_STATE_IDLE},
-/* AUTH_CMPL */          {SMP_SEND_PAIR_FAIL,      SMP_PAIRING_CMPL, SMP_STATE_IDLE},
-/* L2C_DISC  */          {SMP_PAIR_TERMINATE,      SMP_SM_NO_ACTION, SMP_STATE_IDLE}
+/* Event                  Action             Next State */
+/* PAIR_FAIL */
+{SMP_PROC_PAIR_FAIL,      SMP_PAIRING_CMPL, SMP_STATE_IDLE},
+/* AUTH_CMPL */
+{SMP_SEND_PAIR_FAIL,      SMP_PAIRING_CMPL, SMP_STATE_IDLE},
+/* L2C_DISC */
+{SMP_PAIR_TERMINATE,      SMP_SM_NO_ACTION, SMP_STATE_IDLE}
 };
 
 static const uint8_t smp_master_idle_table[][SMP_SM_NUM_COLS] =
 {
-/*                   Event                  Action               Next State */
-/* L2C_CONN */      {SMP_SEND_APP_CBACK,     SMP_SM_NO_ACTION,   SMP_STATE_WAIT_APP_RSP},
-/* SEC_REQ  */      {SMP_PROC_SEC_REQ,       SMP_SEND_APP_CBACK, SMP_STATE_WAIT_APP_RSP},
-/* L2C_DISC  */     {SMP_IDLE_TERMINATE,     SMP_SM_NO_ACTION, SMP_STATE_IDLE},
-/* AUTH_CMPL */     {SMP_PAIRING_CMPL,       SMP_SM_NO_ACTION, SMP_STATE_IDLE}
-/* CR_LOC_SC_OOB_DATA   */ ,{SMP_CREATE_PRIVATE_KEY, SMP_SM_NO_ACTION, SMP_STATE_CREATE_LOCAL_SEC_CONN_OOB_DATA}
+/* Event                  Action               Next State */
+/* L2C_CONN */
+{SMP_SEND_APP_CBACK,     SMP_SM_NO_ACTION,   SMP_STATE_WAIT_APP_RSP},
+/* SEC_REQ */
+{SMP_PROC_SEC_REQ,       SMP_SEND_APP_CBACK, SMP_STATE_WAIT_APP_RSP},
+/* L2C_DISC */
+{SMP_IDLE_TERMINATE,     SMP_SM_NO_ACTION, SMP_STATE_IDLE},
+/* AUTH_CMPL */
+{SMP_PAIRING_CMPL,       SMP_SM_NO_ACTION, SMP_STATE_IDLE},
+/* CR_LOC_SC_OOB_DATA */
+{SMP_CREATE_PRIVATE_KEY, SMP_SM_NO_ACTION, SMP_STATE_CREATE_LOCAL_SEC_CONN_OOB_DATA}
 
 };
 
 static const uint8_t smp_master_wait_for_app_response_table[][SMP_SM_NUM_COLS] =
 {
-/*                            Event                Action               Next State */
-/* SEC_GRANT            */ {SMP_PROC_SEC_GRANT, SMP_SEND_APP_CBACK, SMP_STATE_WAIT_APP_RSP},
-/* IO_RSP               */ {SMP_SEND_PAIR_REQ, SMP_FAST_CONN_PARAM, SMP_STATE_PAIR_REQ_RSP},
+/* Event                Action               Next State */
+/* SEC_GRANT */
+{SMP_PROC_SEC_GRANT, SMP_SEND_APP_CBACK, SMP_STATE_WAIT_APP_RSP},
+/* IO_RSP */
+{SMP_SEND_PAIR_REQ, SMP_FAST_CONN_PARAM, SMP_STATE_PAIR_REQ_RSP},
 
                     /* TK ready */
-/* KEY_READY            */ {SMP_GENERATE_CONFIRM, SMP_SM_NO_ACTION,   SMP_STATE_WAIT_CONFIRM},
+/* KEY_READY */
+{SMP_GENERATE_CONFIRM, SMP_SM_NO_ACTION,   SMP_STATE_WAIT_CONFIRM},
 
                     /* start enc mode setup */
-/* ENC_REQ              */ { SMP_START_ENC, SMP_FAST_CONN_PARAM, SMP_STATE_ENCRYPTION_PENDING},
-/* DISCARD_SEC_REQ      */ { SMP_PROC_DISCARD, SMP_SM_NO_ACTION, SMP_STATE_IDLE}
+/* ENC_REQ */
+{ SMP_START_ENC, SMP_FAST_CONN_PARAM, SMP_STATE_ENCRYPTION_PENDING},
+/* DISCARD_SEC_REQ */
+{ SMP_PROC_DISCARD, SMP_SM_NO_ACTION, SMP_STATE_IDLE}
 /* user confirms NC 'OK', i.e. phase 1 is completed */
-/* SC_NC_OK             */,{ SMP_MOVE_TO_SEC_CONN_PHASE2, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS2_START},
+/* SC_NC_OK */,
+{ SMP_MOVE_TO_SEC_CONN_PHASE2, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS2_START},
 /* user-provided passkey is rcvd */
-/* SC_KEY_READY  */ { SMP_START_PASSKEY_VERIFICATION, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
-/* PAIR_KEYPR_NOTIF */ { SMP_PROCESS_KEYPRESS_NOTIFICATION, SMP_SEND_APP_CBACK, SMP_STATE_WAIT_APP_RSP},
-/* KEYPR_NOTIF          */ { SMP_SEND_KEYPRESS_NOTIFICATION, SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
-/* SC_OOB_DATA      */ { SMP_USE_OOB_PRIVATE_KEY, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH}
+/* SC_KEY_READY */
+{ SMP_START_PASSKEY_VERIFICATION, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
+/* PAIR_KEYPR_NOTIF */
+{ SMP_PROCESS_KEYPRESS_NOTIFICATION, SMP_SEND_APP_CBACK, SMP_STATE_WAIT_APP_RSP},
+/* KEYPR_NOTIF */
+{ SMP_SEND_KEYPRESS_NOTIFICATION, SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
+/* SC_OOB_DATA */
+{ SMP_USE_OOB_PRIVATE_KEY, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH}
 };
 
 static const uint8_t smp_master_pair_request_response_table[][SMP_SM_NUM_COLS] =
 {
-/*               Event                  Action                  Next State */
-/* PAIR_RSP */ { SMP_PROC_PAIR_CMD,     SMP_SM_NO_ACTION, SMP_STATE_PAIR_REQ_RSP},
-/* TK_REQ   */ { SMP_SEND_APP_CBACK,    SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
+/* Event                  Action            Next State */
+/* PAIR_RSP */
+{ SMP_PROC_PAIR_CMD,     SMP_SM_NO_ACTION, SMP_STATE_PAIR_REQ_RSP},
+/* TK_REQ */
+{ SMP_SEND_APP_CBACK,    SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
 
                     /* TK ready */
-/* KEY_READY */{ SMP_GENERATE_CONFIRM,  SMP_SM_NO_ACTION, SMP_STATE_WAIT_CONFIRM}
-/* PUBL_KEY_EXCH_REQ    */,{ SMP_CREATE_PRIVATE_KEY, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH}
+/* KEY_READY */
+{ SMP_GENERATE_CONFIRM,  SMP_SM_NO_ACTION, SMP_STATE_WAIT_CONFIRM}
+/* PUBL_KEY_EXCH_REQ */,
+{ SMP_CREATE_PRIVATE_KEY, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH}
 };
 
 static const uint8_t smp_master_wait_for_confirm_table[][SMP_SM_NUM_COLS] =
 {
-/*              Event                   Action          Next State */
-/* KEY_READY*/ {SMP_SEND_CONFIRM,     SMP_SM_NO_ACTION, SMP_STATE_CONFIRM}/* CONFIRM ready */
+/* Event                Action            Next State */
+/* KEY_READY*/
+/* CONFIRM ready */
+{SMP_SEND_CONFIRM,     SMP_SM_NO_ACTION, SMP_STATE_CONFIRM}
 };
 
 static const uint8_t smp_master_confirm_table[][SMP_SM_NUM_COLS] =
 {
-/*               Event                  Action                 Next State */
-/* CONFIRM  */ { SMP_PROC_CONFIRM, SMP_SEND_RAND, SMP_STATE_RAND}
+/* Event            Action         Next State */
+/* CONFIRM */
+{ SMP_PROC_CONFIRM, SMP_SEND_RAND, SMP_STATE_RAND}
 };
 
 static const uint8_t smp_master_rand_table[][SMP_SM_NUM_COLS] =
 {
 /*               Event                  Action                   Next State */
-/* RAND     */ { SMP_PROC_RAND,         SMP_GENERATE_COMPARE, SMP_STATE_RAND},
-/* KEY_READY*/ { SMP_PROC_COMPARE,      SMP_SM_NO_ACTION,   SMP_STATE_RAND},  /* Compare ready */
-/* ENC_REQ  */ { SMP_GENERATE_STK,      SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING}
+/* RAND */
+{ SMP_PROC_RAND,         SMP_GENERATE_COMPARE, SMP_STATE_RAND},
+/* KEY_READY */
+{ SMP_PROC_COMPARE,      SMP_SM_NO_ACTION,   SMP_STATE_RAND},  /* Compare ready */
+/* ENC_REQ */
+{ SMP_GENERATE_STK,      SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING}
 };
 
 static const uint8_t smp_master_public_key_exchange_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                        Action              Next State */
-/* LOC_PUBL_KEY_CRTD    */{ SMP_SEND_PAIR_PUBLIC_KEY, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH},
-/* PAIR_PUBLIC_KEY      */{ SMP_PROCESS_PAIR_PUBLIC_KEY, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH},
-/* BOTH_PUBL_KEYS_RCVD  */{ SMP_HAVE_BOTH_PUBLIC_KEYS, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
+/* Event                        Action              Next State */
+/* LOC_PUBL_KEY_CRTD */
+{ SMP_SEND_PAIR_PUBLIC_KEY, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH},
+/* PAIR_PUBLIC_KEY */
+{ SMP_PROCESS_PAIR_PUBLIC_KEY, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH},
+/* BOTH_PUBL_KEYS_RCVD */
+{ SMP_HAVE_BOTH_PUBLIC_KEYS, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
 };
 
 static const uint8_t smp_master_sec_conn_phs1_start_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                Next State */
-/* SC_DHKEY_CMPLT       */{ SMP_START_SEC_CONN_PHASE1, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
-/* HAVE_LOC_NONCE       */{ SMP_PROCESS_LOCAL_NONCE, SMP_SM_NO_ACTION, SMP_STATE_WAIT_COMMITMENT},
-/* TK_REQ               */{ SMP_SEND_APP_CBACK,    SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
+/* Event                  Action                Next State */
+/* SC_DHKEY_CMPLT */
+{ SMP_START_SEC_CONN_PHASE1, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
+/* HAVE_LOC_NONCE */
+{ SMP_PROCESS_LOCAL_NONCE, SMP_SM_NO_ACTION, SMP_STATE_WAIT_COMMITMENT},
+/* TK_REQ */
+{ SMP_SEND_APP_CBACK,    SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
 /* SMP_MODEL_SEC_CONN_PASSKEY_DISP model, passkey is sent up to display,*/
 /* It's time to start commitment calculation */
-/* KEY_READY            */{ SMP_START_PASSKEY_VERIFICATION, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
-/* PAIR_KEYPR_NOTIF  */{ SMP_PROCESS_KEYPRESS_NOTIFICATION,  SMP_SEND_APP_CBACK, SMP_STATE_SEC_CONN_PHS1_START},
-/* PAIR_COMMITM  */{ SMP_PROCESS_PAIRING_COMMITMENT, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
+/* KEY_READY */
+{ SMP_START_PASSKEY_VERIFICATION, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
+/* PAIR_KEYPR_NOTIF */
+{ SMP_PROCESS_KEYPRESS_NOTIFICATION,  SMP_SEND_APP_CBACK, SMP_STATE_SEC_CONN_PHS1_START},
+/* PAIR_COMMITM */
+{ SMP_PROCESS_PAIRING_COMMITMENT, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
 };
 
 static const uint8_t smp_master_wait_commitment_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* PAIR_COMMITM         */{ SMP_PROCESS_PAIRING_COMMITMENT, SMP_SEND_RAND, SMP_STATE_WAIT_NONCE},
-/* PAIR_KEYPR_NOTIF */{ SMP_PROCESS_KEYPRESS_NOTIFICATION, SMP_SEND_APP_CBACK, SMP_STATE_WAIT_COMMITMENT},
+/* Event                  Action                 Next State */
+/* PAIR_COMMITM */
+{ SMP_PROCESS_PAIRING_COMMITMENT, SMP_SEND_RAND, SMP_STATE_WAIT_NONCE},
+/* PAIR_KEYPR_NOTIF */
+{ SMP_PROCESS_KEYPRESS_NOTIFICATION, SMP_SEND_APP_CBACK, SMP_STATE_WAIT_COMMITMENT},
 };
 
 static const uint8_t smp_master_wait_nonce_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
+/* Event                  Action                 Next State */
 /* peer nonce is received */
-/* RAND                 */{SMP_PROC_RAND,  SMP_PROCESS_PEER_NONCE, SMP_STATE_SEC_CONN_PHS2_START},
+/* RAND */
+{SMP_PROC_RAND,  SMP_PROCESS_PEER_NONCE, SMP_STATE_SEC_CONN_PHS2_START},
 /* NC model, time to calculate number for NC */
-/* SC_CALC_NC           */{SMP_CALCULATE_NUMERIC_COMPARISON_DISPLAY_NUMBER, SMP_SM_NO_ACTION, SMP_STATE_WAIT_NONCE},
+/* SC_CALC_NC */
+{SMP_CALCULATE_NUMERIC_COMPARISON_DISPLAY_NUMBER, SMP_SM_NO_ACTION, SMP_STATE_WAIT_NONCE},
 /* NC model, time to display calculated number for NC to the user */
-/* SC_DSPL_NC           */{SMP_SEND_APP_CBACK, SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
+/* SC_DSPL_NC */
+{SMP_SEND_APP_CBACK, SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
 };
 
 static const uint8_t smp_master_sec_conn_phs2_start_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* SC_PHASE1_CMPLT */{SMP_CALCULATE_LOCAL_DHKEY_CHECK, SMP_SEND_DHKEY_CHECK, SMP_STATE_WAIT_DHK_CHECK},
+/* Event                           Action                 Next State */
+/* SC_PHASE1_CMPLT */
+{SMP_CALCULATE_LOCAL_DHKEY_CHECK, SMP_SEND_DHKEY_CHECK, SMP_STATE_WAIT_DHK_CHECK},
 };
 
 static const uint8_t smp_master_wait_dhk_check_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* PAIR_DHKEY_CHCK  */{SMP_PROCESS_DHKEY_CHECK, SMP_CALCULATE_PEER_DHKEY_CHECK, SMP_STATE_DHK_CHECK},
+/* Event                  Action                          Next State */
+/* PAIR_DHKEY_CHCK */
+{SMP_PROCESS_DHKEY_CHECK, SMP_CALCULATE_PEER_DHKEY_CHECK, SMP_STATE_DHK_CHECK},
 };
 
 static const uint8_t smp_master_dhk_check_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* locally calculated peer dhkey check is ready -> compare it withs DHKey Check actually received from peer */
-/* SC_KEY_READY         */{SMP_MATCH_DHKEY_CHECKS, SMP_SM_NO_ACTION, SMP_STATE_DHK_CHECK},
-/* locally calculated peer dhkey check is ready -> calculate STK, go to sending */
+/* Event                  Action                 Next State */
+/* locally calculated peer dhkey check is ready -> compare it withs DHKey Check
+ * actually received from peer */
+/* SC_KEY_READY */
+{SMP_MATCH_DHKEY_CHECKS, SMP_SM_NO_ACTION, SMP_STATE_DHK_CHECK},
+/* locally calculated peer dhkey check is ready -> calculate STK, go to sending
+ */
 /* HCI LE Start Encryption command */
-/* ENC_REQ              */{SMP_GENERATE_STK, SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
+/* ENC_REQ */
+{SMP_GENERATE_STK, SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
 };
 
 static const uint8_t smp_master_enc_pending_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
+/* Event                  Action                 Next State */
 /* STK ready */
-/* KEY_READY */ { SMP_START_ENC,        SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
-/* ENCRYPTED */ { SMP_CHECK_AUTH_REQ,   SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
-/* BOND_REQ  */ { SMP_KEY_DISTRIBUTE,   SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING}
+/* KEY_READY */
+{ SMP_START_ENC,        SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
+/* ENCRYPTED */
+{ SMP_CHECK_AUTH_REQ,   SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
+/* BOND_REQ */
+{ SMP_KEY_DISTRIBUTE,   SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING}
 };
 static const uint8_t smp_master_bond_pending_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* ENC_INFO */ { SMP_PROC_ENC_INFO,     SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
-/* ID_INFO  */ { SMP_PROC_ID_INFO,      SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
-/* SIGN_INFO*/ { SMP_PROC_SRK_INFO,     SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
-/* MASTER_ID*/ { SMP_PROC_MASTER_ID,    SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
-/* ID_ADDR  */ { SMP_PROC_ID_ADDR,      SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
-/* KEY_READY */{SMP_SEND_ENC_INFO,      SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING} /* LTK ready */
+/* Event                  Action                 Next State */
+/* ENC_INFO */
+{ SMP_PROC_ENC_INFO,     SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
+/* ID_INFO */
+{ SMP_PROC_ID_INFO,      SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
+/* SIGN_INFO */
+{ SMP_PROC_SRK_INFO,     SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
+/* MASTER_ID */
+{ SMP_PROC_MASTER_ID,    SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
+/* ID_ADDR */
+{ SMP_PROC_ID_ADDR,      SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
+/* KEY_READY */
+/* LTK ready */
+{SMP_SEND_ENC_INFO,      SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING}
 };
 
 static const uint8_t smp_master_create_local_sec_conn_oob_data[][SMP_SM_NUM_COLS] =
 {
-/*                       Event                   Action            Next State */
-/* LOC_PUBL_KEY_CRTD */ {SMP_SET_LOCAL_OOB_KEYS,   SMP_SM_NO_ACTION, SMP_STATE_CREATE_LOCAL_SEC_CONN_OOB_DATA},
-/* HAVE_LOC_NONCE    */ {SMP_SET_LOCAL_OOB_RAND_COMMITMENT, SMP_SM_NO_ACTION, SMP_STATE_IDLE}
+/* Event                   Action            Next State */
+/* LOC_PUBL_KEY_CRTD */
+{SMP_SET_LOCAL_OOB_KEYS,   SMP_SM_NO_ACTION, SMP_STATE_CREATE_LOCAL_SEC_CONN_OOB_DATA},
+/* HAVE_LOC_NONCE */
+{SMP_SET_LOCAL_OOB_RAND_COMMITMENT, SMP_SM_NO_ACTION, SMP_STATE_IDLE}
 };
 
 
 /************ SMP Slave FSM State/Event Indirection Table **************/
 static const uint8_t smp_slave_entry_map[][SMP_STATE_MAX] =
 {
-/* state name:             Idle WaitApp SecReq Pair   Wait Confirm Rand PublKey SCPhs1  Wait  Wait  SCPhs2  Wait   DHKChk Enc   Bond  CrLocSc
-                                 Rsp    Pend   ReqRsp Cfm               Exch    Strt    Cmtm  Nonce Strt    DHKChk        Pend  Pend  OobData   */
-/* PAIR_REQ             */{ 2,    0,     1,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* PAIR_RSP             */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* CONFIRM              */{ 0,    4,     0,      1,     1,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* RAND                 */{ 0,    0,     0,      0,     0,   1,    2,   0,      0,      0,    1,    0,      0,     0,     0,    0,     0   },
-/* PAIR_FAIL            */{ 0,    0x81,  0x81,   0x81,  0x81,0x81, 0x81,0x81,   0x81,   0x81, 0x81, 0x81,   0x81,  0x81,  0x81, 0,     0   },
-/* ENC_INFO             */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    3,     0   },
-/* MASTER_ID            */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    5,     0   },
-/* ID_INFO              */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    4,     0   },
-/* ID_ADDR              */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    6,     0   },
-/* SIGN_INFO            */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    2,     0   },
-/* SEC_REQ              */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* PAIR_PUBLIC_KEY      */{ 0,    0,     0,      5,     0,   0,    0,   2,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* PAIR_DHKEY_CHCK      */{ 0,    5,     0,      0,     0,   0,    0,   0,      0,      0,    0,    2,      1,     2,     0,    0,     0   },
-/* PAIR_KEYPR_NOTIF     */{ 0,    9,     0,      0,     0,   0,    0,   0,      5,      2,    0,    0,      0,     0,     0,    0,     0   },
-/* PAIR_COMMITM         */{ 0,    8,     0,      0,     0,   0,    0,   0,      6,      1,    0,    0,      0,     0,     0,    0,     0   },
-/* KEY_READY            */{ 0,    3,     0,      3,     2,   2,    1,   0,      4,      0,    0,    0,      0,     0,     2,    1,     0   },
-/* ENC_CMPL             */{ 0,    0,     2,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     3,    0,     0   },
-/* L2C_CONN             */{ 1,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* L2C_DISC             */{ 0,    0x83,  0x83,   0x83,  0x83,0x83, 0x83,0x83,   0x83,   0x83, 0x83, 0x83,   0x83,  0x83,  0x83, 0x83,  0   },
-/* IO_RSP               */{ 0,    1,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* SEC_GRANT            */{ 0,    2,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* TK_REQ               */{ 0,    0,     0,      2,     0,   0,    0,   0,      3,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* AUTH_CMPL            */{ 0,    0x82,  0x82,   0x82,  0x82,0x82, 0x82,0x82,   0x82,   0x82, 0x82, 0x82,   0x82,  0x82,  0x82, 0x82,  0   },
-/* ENC_REQ              */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     1,    0,     0   },
-/* BOND_REQ             */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     4,    0,     0   },
-/* DISCARD_SEC_REQ      */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* PUBL_KEY_EXCH_REQ    */{ 0,    0,     0,      4,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* LOC_PUBL_KEY_CRTD    */{ 0,    0,     0,      0,     0,   0,    0,   1,      0,      0,    0,    0,      0,     0,     0,    0,     1   },
-/* BOTH_PUBL_KEYS_RCVD  */{ 0,    0,     0,      0,     0,   0,    0,   3,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* SC_DHKEY_CMPLT       */{ 0,    0,     0,      0,     0,   0,    0,   0,      1,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* HAVE_LOC_NONCE       */{ 0,    0,     0,      0,     0,   0,    0,   0,      2,      0,    0,    0,      0,     0,     0,    0,     2   },
-/* SC_PHASE1_CMPLT      */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    1,      0,     0,     0,    0,     0   },
-/* SC_CALC_NC           */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    2,    0,      0,     0,     0,    0,     0   },
-/* SC_DSPL_NC           */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    3,    0,      0,     0,     0,    0,     0   },
-/* SC_NC_OK             */{ 0,    6,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* SC_2_DHCK_CHKS_PRES  */{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      2,     0,     0,    0,     0   },
-/* SC_KEY_READY         */{ 0,    7,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     1,     0,    0,     0   },
-/* KEYPR_NOTIF          */{ 0,    10,    0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* SC_OOB_DATA          */{ 0,    11,    0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
-/* CR_LOC_SC_OOB_DATA   */{ 3,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* state name: */
+/* Idle, WaitApp Rsp, SecReq Pend, Pair ReqRsp, Wait Cfm, Confirm, Rand, PublKey Exch, SCPhs1 Strt, Wait Cmtm, Wait Nonce, SCPhs2 Strt, Wait DHKChk, DHKChk, Enc Pend, Bond Pend, CrLocSc OobData */
+/* PAIR_REQ */
+{ 2,    0,     1,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* PAIR_RSP */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* CONFIRM */
+{ 0,    4,     0,      1,     1,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* RAND */
+{ 0,    0,     0,      0,     0,   1,    2,   0,      0,      0,    1,    0,      0,     0,     0,    0,     0   },
+/* PAIR_FAIL */
+{ 0,    0x81,  0x81,   0x81,  0x81,0x81, 0x81,0x81,   0x81,   0x81, 0x81, 0x81,   0x81,  0x81,  0x81, 0,     0   },
+/* ENC_INFO */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    3,     0   },
+/* MASTER_ID */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    5,     0   },
+/* ID_INFO */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    4,     0   },
+/* ID_ADDR */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    6,     0   },
+/* SIGN_INFO */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    2,     0   },
+/* SEC_REQ */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* PAIR_PUBLIC_KEY */
+{ 0,    0,     0,      5,     0,   0,    0,   2,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* PAIR_DHKEY_CHCK */
+{ 0,    5,     0,      0,     0,   0,    0,   0,      0,      0,    0,    2,      1,     2,     0,    0,     0   },
+/* PAIR_KEYPR_NOTIF */
+{ 0,    9,     0,      0,     0,   0,    0,   0,      5,      2,    0,    0,      0,     0,     0,    0,     0   },
+/* PAIR_COMMITM */
+{ 0,    8,     0,      0,     0,   0,    0,   0,      6,      1,    0,    0,      0,     0,     0,    0,     0   },
+/* KEY_READY */
+{ 0,    3,     0,      3,     2,   2,    1,   0,      4,      0,    0,    0,      0,     0,     2,    1,     0   },
+/* ENC_CMPL */
+{ 0,    0,     2,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     3,    0,     0   },
+/* L2C_CONN */
+{ 1,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* L2C_DISC */
+{ 0,    0x83,  0x83,   0x83,  0x83,0x83, 0x83,0x83,   0x83,   0x83, 0x83, 0x83,   0x83,  0x83,  0x83, 0x83,  0   },
+/* IO_RSP */
+{ 0,    1,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* SEC_GRANT */
+{ 0,    2,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* TK_REQ */
+{ 0,    0,     0,      2,     0,   0,    0,   0,      3,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* AUTH_CMPL */
+{ 0,    0x82,  0x82,   0x82,  0x82,0x82, 0x82,0x82,   0x82,   0x82, 0x82, 0x82,   0x82,  0x82,  0x82, 0x82,  0   },
+/* ENC_REQ */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     1,    0,     0   },
+/* BOND_REQ */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     4,    0,     0   },
+/* DISCARD_SEC_REQ */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* PUBL_KEY_EXCH_REQ */
+{ 0,    0,     0,      4,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* LOC_PUBL_KEY_CRTD */
+{ 0,    0,     0,      0,     0,   0,    0,   1,      0,      0,    0,    0,      0,     0,     0,    0,     1   },
+/* BOTH_PUBL_KEYS_RCVD */
+{ 0,    0,     0,      0,     0,   0,    0,   3,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* SC_DHKEY_CMPLT */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      1,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* HAVE_LOC_NONCE */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      2,      0,    0,    0,      0,     0,     0,    0,     2   },
+/* SC_PHASE1_CMPLT */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    1,      0,     0,     0,    0,     0   },
+/* SC_CALC_NC */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    2,    0,      0,     0,     0,    0,     0   },
+/* SC_DSPL_NC */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    3,    0,      0,     0,     0,    0,     0   },
+/* SC_NC_OK */
+{ 0,    6,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* SC_2_DHCK_CHKS_PRES */
+{ 0,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      2,     0,     0,    0,     0   },
+/* SC_KEY_READY */
+{ 0,    7,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     1,     0,    0,     0   },
+/* KEYPR_NOTIF */
+{ 0,    10,    0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* SC_OOB_DATA */
+{ 0,    11,    0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
+/* CR_LOC_SC_OOB_DATA */
+{ 3,    0,     0,      0,     0,   0,    0,   0,      0,      0,    0,    0,      0,     0,     0,    0,     0   },
 };
 
 static const uint8_t smp_slave_idle_table[][SMP_SM_NUM_COLS] =
 {
-/*                   Event                 Action                Next State */
-/* L2C_CONN */      {SMP_SEND_APP_CBACK,  SMP_SM_NO_ACTION,      SMP_STATE_WAIT_APP_RSP},
-/* PAIR_REQ */      {SMP_PROC_PAIR_CMD,   SMP_SEND_APP_CBACK,     SMP_STATE_WAIT_APP_RSP}
-/* CR_LOC_SC_OOB_DATA   */ ,{SMP_CREATE_PRIVATE_KEY, SMP_SM_NO_ACTION, SMP_STATE_CREATE_LOCAL_SEC_CONN_OOB_DATA}
+/* Event                 Action                Next State */
+/* L2C_CONN */
+{SMP_SEND_APP_CBACK,  SMP_SM_NO_ACTION,      SMP_STATE_WAIT_APP_RSP},
+/* PAIR_REQ */
+{SMP_PROC_PAIR_CMD,   SMP_SEND_APP_CBACK,     SMP_STATE_WAIT_APP_RSP},
+/* CR_LOC_SC_OOB_DATA */
+{SMP_CREATE_PRIVATE_KEY, SMP_SM_NO_ACTION, SMP_STATE_CREATE_LOCAL_SEC_CONN_OOB_DATA}
 };
 
 static const uint8_t smp_slave_wait_for_app_response_table [][SMP_SM_NUM_COLS] =
 {
-/*               Event                   Action                 Next State */
-/* IO_RSP    */ {SMP_PROC_IO_RSP,       SMP_FAST_CONN_PARAM, SMP_STATE_PAIR_REQ_RSP},
-/* SEC_GRANT */ {SMP_PROC_SEC_GRANT,    SMP_SEND_APP_CBACK, SMP_STATE_WAIT_APP_RSP},
+/* Event                   Action                 Next State */
+/* IO_RSP */
+{SMP_PROC_IO_RSP,       SMP_FAST_CONN_PARAM, SMP_STATE_PAIR_REQ_RSP},
+/* SEC_GRANT */
+{SMP_PROC_SEC_GRANT,    SMP_SEND_APP_CBACK, SMP_STATE_WAIT_APP_RSP},
 
                         /* TK ready */
-/* KEY_READY */ {SMP_PROC_SL_KEY,   SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
-/* CONFIRM   */ {SMP_PROC_CONFIRM,   SMP_SM_NO_ACTION, SMP_STATE_CONFIRM}
+/* KEY_READY */
+{SMP_PROC_SL_KEY,   SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
+/* CONFIRM */
+{SMP_PROC_CONFIRM,   SMP_SM_NO_ACTION, SMP_STATE_CONFIRM},
 /* DHKey Check from master is received before phase 1 is completed - race */
-/* PAIR_DHKEY_CHCK      */,{SMP_PROCESS_DHKEY_CHECK, SMP_SM_NO_ACTION,  SMP_STATE_WAIT_APP_RSP},
+/* PAIR_DHKEY_CHCK */
+{SMP_PROCESS_DHKEY_CHECK, SMP_SM_NO_ACTION,  SMP_STATE_WAIT_APP_RSP},
 /* user confirms NC 'OK', i.e. phase 1 is completed */
-/* SC_NC_OK             */ {SMP_MOVE_TO_SEC_CONN_PHASE2, SMP_SM_NO_ACTION,  SMP_STATE_SEC_CONN_PHS2_START},
+/* SC_NC_OK */
+{SMP_MOVE_TO_SEC_CONN_PHASE2, SMP_SM_NO_ACTION,  SMP_STATE_SEC_CONN_PHS2_START},
 /* user-provided passkey is rcvd */
-/* SC_KEY_READY   */ {SMP_START_PASSKEY_VERIFICATION, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
-/* PAIR_COMMITM   */ {SMP_PROCESS_PAIRING_COMMITMENT, SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
-/* PAIR_KEYPR_NOTIF */ {SMP_PROCESS_KEYPRESS_NOTIFICATION, SMP_SEND_APP_CBACK, SMP_STATE_WAIT_APP_RSP},
-/* KEYPR_NOTIF */ {SMP_SEND_KEYPRESS_NOTIFICATION, SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
-/* SC_OOB_DATA          */ {SMP_SEND_PAIR_RSP,    SMP_SM_NO_ACTION,    SMP_STATE_PAIR_REQ_RSP},
+/* SC_KEY_READY */
+{SMP_START_PASSKEY_VERIFICATION, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
+/* PAIR_COMMITM */
+{SMP_PROCESS_PAIRING_COMMITMENT, SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
+/* PAIR_KEYPR_NOTIF */
+{SMP_PROCESS_KEYPRESS_NOTIFICATION, SMP_SEND_APP_CBACK, SMP_STATE_WAIT_APP_RSP},
+/* KEYPR_NOTIF */
+{SMP_SEND_KEYPRESS_NOTIFICATION, SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
+/* SC_OOB_DATA */
+{SMP_SEND_PAIR_RSP,    SMP_SM_NO_ACTION,    SMP_STATE_PAIR_REQ_RSP},
 };
 
 static const uint8_t smp_slave_sec_request_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* PAIR_REQ */{SMP_PROC_PAIR_CMD,       SMP_SM_NO_ACTION,       SMP_STATE_PAIR_REQ_RSP},
-/* ENCRYPTED*/{SMP_ENC_CMPL,            SMP_SM_NO_ACTION,       SMP_STATE_PAIR_REQ_RSP},
+/* Event                  Action                 Next State */
+/* PAIR_REQ */
+{SMP_PROC_PAIR_CMD,       SMP_SM_NO_ACTION,       SMP_STATE_PAIR_REQ_RSP},
+/* ENCRYPTED*/
+{SMP_ENC_CMPL,            SMP_SM_NO_ACTION,       SMP_STATE_PAIR_REQ_RSP},
 };
 
 static const uint8_t smp_slave_pair_request_response_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* CONFIRM  */ {SMP_PROC_CONFIRM,       SMP_SM_NO_ACTION,   SMP_STATE_CONFIRM},
-/* TK_REQ   */ {SMP_SEND_APP_CBACK,     SMP_SM_NO_ACTION,   SMP_STATE_WAIT_APP_RSP},
+/* Event                  Action                 Next State */
+/* CONFIRM */
+{SMP_PROC_CONFIRM,       SMP_SM_NO_ACTION,   SMP_STATE_CONFIRM},
+/* TK_REQ */
+{SMP_SEND_APP_CBACK,     SMP_SM_NO_ACTION,   SMP_STATE_WAIT_APP_RSP},
 
                     /* TK/Confirm ready */
-/* KEY_READY */{SMP_PROC_SL_KEY,        SMP_SM_NO_ACTION,   SMP_STATE_PAIR_REQ_RSP}
-/* PUBL_KEY_EXCH_REQ    */,{ SMP_CREATE_PRIVATE_KEY, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH},
-/* PAIR_PUBLIC_KEY      */ { SMP_PROCESS_PAIR_PUBLIC_KEY, SMP_SM_NO_ACTION,   SMP_STATE_PAIR_REQ_RSP},
+/* KEY_READY */
+{SMP_PROC_SL_KEY,        SMP_SM_NO_ACTION,   SMP_STATE_PAIR_REQ_RSP},
+/* PUBL_KEY_EXCH_REQ */
+{ SMP_CREATE_PRIVATE_KEY, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH},
+/* PAIR_PUBLIC_KEY */
+{ SMP_PROCESS_PAIR_PUBLIC_KEY, SMP_SM_NO_ACTION,   SMP_STATE_PAIR_REQ_RSP},
 };
 
 static const uint8_t smp_slave_wait_confirm_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* CONFIRM  */ {SMP_PROC_CONFIRM,       SMP_SEND_CONFIRM,   SMP_STATE_CONFIRM},
-/* KEY_READY*/ {SMP_PROC_SL_KEY,        SMP_SM_NO_ACTION,   SMP_STATE_WAIT_CONFIRM}
+/* Event                  Action                 Next State */
+/* CONFIRM */
+{SMP_PROC_CONFIRM,       SMP_SEND_CONFIRM,   SMP_STATE_CONFIRM},
+/* KEY_READY*/
+{SMP_PROC_SL_KEY,        SMP_SM_NO_ACTION,   SMP_STATE_WAIT_CONFIRM}
 };
 
 static const uint8_t smp_slave_confirm_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* RAND     */ {SMP_PROC_RAND,          SMP_GENERATE_COMPARE,   SMP_STATE_RAND},
+/* Event                  Action                 Next State */
+/* RAND */
+{SMP_PROC_RAND,          SMP_GENERATE_COMPARE,   SMP_STATE_RAND},
 
                     /* TK/Confirm ready */
-/* KEY_READY*/ {SMP_PROC_SL_KEY,        SMP_SM_NO_ACTION,       SMP_STATE_CONFIRM}
+/* KEY_READY*/
+{SMP_PROC_SL_KEY,        SMP_SM_NO_ACTION,       SMP_STATE_CONFIRM}
 };
 
 static const uint8_t smp_slave_rand_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* KEY_READY */ {SMP_PROC_COMPARE,      SMP_SM_NO_ACTION,   SMP_STATE_RAND}, /* compare match */
-/* RAND      */ {SMP_SEND_RAND,         SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING}
+/* Event                  Action                 Next State */
+/* KEY_READY */
+{SMP_PROC_COMPARE,      SMP_SM_NO_ACTION,   SMP_STATE_RAND}, /* compare match */
+/* RAND */
+{SMP_SEND_RAND,         SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING}
 };
 
 static const uint8_t smp_slave_public_key_exch_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* LOC_PUBL_KEY_CRTD  */{ SMP_WAIT_FOR_BOTH_PUBLIC_KEYS, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH},
-/* PAIR_PUBLIC_KEY      */{ SMP_PROCESS_PAIR_PUBLIC_KEY, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH},
-/* BOTH_PUBL_KEYS_RCVD */{ SMP_HAVE_BOTH_PUBLIC_KEYS, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
+/* Event                  Action                 Next State */
+/* LOC_PUBL_KEY_CRTD */
+{ SMP_WAIT_FOR_BOTH_PUBLIC_KEYS, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH},
+/* PAIR_PUBLIC_KEY */
+{ SMP_PROCESS_PAIR_PUBLIC_KEY, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH},
+/* BOTH_PUBL_KEYS_RCVD */
+{ SMP_HAVE_BOTH_PUBLIC_KEYS, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
 };
 
 static const uint8_t smp_slave_sec_conn_phs1_start_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* SC_DHKEY_CMPLT       */{ SMP_START_SEC_CONN_PHASE1, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
-/* HAVE_LOC_NONCE       */{ SMP_PROCESS_LOCAL_NONCE,SMP_SM_NO_ACTION, SMP_STATE_WAIT_COMMITMENT},
-/* TK_REQ               */{ SMP_SEND_APP_CBACK,      SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
-/* SMP_MODEL_SEC_CONN_PASSKEY_DISP model, passkey is sent up to display, it's time to start */
+/* Event                  Action                 Next State */
+/* SC_DHKEY_CMPLT */
+{ SMP_START_SEC_CONN_PHASE1, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
+/* HAVE_LOC_NONCE */
+{ SMP_PROCESS_LOCAL_NONCE,SMP_SM_NO_ACTION, SMP_STATE_WAIT_COMMITMENT},
+/* TK_REQ */
+{ SMP_SEND_APP_CBACK,      SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
+/* SMP_MODEL_SEC_CONN_PASSKEY_DISP model, passkey is sent up to display, it's
+ * time to start */
 /* commitment calculation */
-/* KEY_READY */{ SMP_START_PASSKEY_VERIFICATION, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
-/* PAIR_KEYPR_NOTIF  */{ SMP_PROCESS_KEYPRESS_NOTIFICATION,SMP_SEND_APP_CBACK, SMP_STATE_SEC_CONN_PHS1_START},
-/*COMMIT*/{SMP_PROCESS_PAIRING_COMMITMENT, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
+/* KEY_READY */
+{ SMP_START_PASSKEY_VERIFICATION, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
+/* PAIR_KEYPR_NOTIF */
+{ SMP_PROCESS_KEYPRESS_NOTIFICATION,SMP_SEND_APP_CBACK, SMP_STATE_SEC_CONN_PHS1_START},
+/*COMMIT*/
+{SMP_PROCESS_PAIRING_COMMITMENT, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS1_START},
 };
 
 static const uint8_t smp_slave_wait_commitment_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* PAIR_COMMITM  */{SMP_PROCESS_PAIRING_COMMITMENT, SMP_SEND_COMMITMENT,  SMP_STATE_WAIT_NONCE},
-/* PAIR_KEYPR_NOTIF */{SMP_PROCESS_KEYPRESS_NOTIFICATION, SMP_SEND_APP_CBACK, SMP_STATE_WAIT_COMMITMENT},
+/* Event                  Action                 Next State */
+/* PAIR_COMMITM */
+{SMP_PROCESS_PAIRING_COMMITMENT, SMP_SEND_COMMITMENT,  SMP_STATE_WAIT_NONCE},
+/* PAIR_KEYPR_NOTIF */
+{SMP_PROCESS_KEYPRESS_NOTIFICATION, SMP_SEND_APP_CBACK, SMP_STATE_WAIT_COMMITMENT},
 };
 
 static const uint8_t smp_slave_wait_nonce_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
+/* Event                  Action                 Next State */
 /* peer nonce is received */
-/* RAND           */{SMP_PROC_RAND, SMP_PROCESS_PEER_NONCE, SMP_STATE_SEC_CONN_PHS2_START},
+/* RAND */
+{SMP_PROC_RAND, SMP_PROCESS_PEER_NONCE, SMP_STATE_SEC_CONN_PHS2_START},
 /* NC model, time to calculate number for NC */
-/* SC_CALC_NC  */{SMP_CALCULATE_NUMERIC_COMPARISON_DISPLAY_NUMBER, SMP_SM_NO_ACTION, SMP_STATE_WAIT_NONCE},
+/* SC_CALC_NC */
+{SMP_CALCULATE_NUMERIC_COMPARISON_DISPLAY_NUMBER, SMP_SM_NO_ACTION, SMP_STATE_WAIT_NONCE},
 /* NC model, time to display calculated number for NC to the user */
-/* SC_DSPL_NC   */{SMP_SEND_APP_CBACK, SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
+/* SC_DSPL_NC */
+{SMP_SEND_APP_CBACK, SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
 };
 
 static const uint8_t smp_slave_sec_conn_phs2_start_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* SC_PHASE1_CMPLT */{SMP_CALCULATE_LOCAL_DHKEY_CHECK, SMP_PH2_DHKEY_CHECKS_ARE_PRESENT, SMP_STATE_WAIT_DHK_CHECK},
-/* DHKey Check from master is received before slave DHKey calculation is completed - race */
-/* PAIR_DHKEY_CHCK  */{SMP_PROCESS_DHKEY_CHECK, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS2_START},
+/* Event                  Action                 Next State */
+/* SC_PHASE1_CMPLT */
+{SMP_CALCULATE_LOCAL_DHKEY_CHECK, SMP_PH2_DHKEY_CHECKS_ARE_PRESENT, SMP_STATE_WAIT_DHK_CHECK},
+/* DHKey Check from master is received before slave DHKey calculation is
+ * completed - race */
+/* PAIR_DHKEY_CHCK */
+{SMP_PROCESS_DHKEY_CHECK, SMP_SM_NO_ACTION, SMP_STATE_SEC_CONN_PHS2_START},
 };
 
 static const uint8_t smp_slave_wait_dhk_check_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* PAIR_DHKEY_CHCK      */{SMP_PROCESS_DHKEY_CHECK, SMP_CALCULATE_PEER_DHKEY_CHECK, SMP_STATE_DHK_CHECK},
+/* Event                  Action                 Next State */
+/* PAIR_DHKEY_CHCK */
+{SMP_PROCESS_DHKEY_CHECK, SMP_CALCULATE_PEER_DHKEY_CHECK, SMP_STATE_DHK_CHECK},
 /* DHKey Check from master was received before slave came to this state */
-/* SC_2_DHCK_CHKS_PRES  */{SMP_CALCULATE_PEER_DHKEY_CHECK, SMP_SM_NO_ACTION, SMP_STATE_DHK_CHECK},
+/* SC_2_DHCK_CHKS_PRES */
+{SMP_CALCULATE_PEER_DHKEY_CHECK, SMP_SM_NO_ACTION, SMP_STATE_DHK_CHECK},
 };
 
 static const uint8_t smp_slave_dhk_check_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
+/* Event                  Action                 Next State */
 
-/* locally calculated peer dhkey check is ready -> compare it withs DHKey Check */
+/* locally calculated peer dhkey check is ready -> compare it withs DHKey Check
+ */
 /* actually received from peer */
-/* SC_KEY_READY         */{SMP_MATCH_DHKEY_CHECKS, SMP_SM_NO_ACTION, SMP_STATE_DHK_CHECK},
+/* SC_KEY_READY */
+{SMP_MATCH_DHKEY_CHECKS, SMP_SM_NO_ACTION, SMP_STATE_DHK_CHECK},
 
-/* dhkey checks match -> send local dhkey check to master, go to wait for HCI LE */
+/* dhkey checks match -> send local dhkey check to master, go to wait for HCI LE
+ */
 /* Long Term Key Request Event */
-/* PAIR_DHKEY_CHCK      */{SMP_SEND_DHKEY_CHECK, SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
+/* PAIR_DHKEY_CHCK */
+{SMP_SEND_DHKEY_CHECK, SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
 };
 
 static const uint8_t smp_slave_enc_pending_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* ENC_REQ   */ {SMP_GENERATE_STK,      SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
+/* Event                  Action                 Next State */
+/* ENC_REQ */
+{SMP_GENERATE_STK,      SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
 
                     /* STK ready */
-/* KEY_READY */ {SMP_SEND_LTK_REPLY,    SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
-/* ENCRYPTED */ {SMP_CHECK_AUTH_REQ,    SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
-/* BOND_REQ  */ {SMP_KEY_DISTRIBUTE,    SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING}
+/* KEY_READY */
+{SMP_SEND_LTK_REPLY,    SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
+/* ENCRYPTED */
+{SMP_CHECK_AUTH_REQ,    SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
+/* BOND_REQ */
+{SMP_KEY_DISTRIBUTE,    SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING}
 };
 static const uint8_t smp_slave_bond_pending_table[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
+/* Event                  Action                 Next State */
 
                 /* LTK ready */
-/* KEY_READY */{ SMP_SEND_ENC_INFO,     SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
+/* KEY_READY */
+{ SMP_SEND_ENC_INFO,     SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
 
                 /* rev SRK */
-/* SIGN_INFO */{ SMP_PROC_SRK_INFO,     SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
-/* ENC_INFO */ { SMP_PROC_ENC_INFO,     SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
-/* ID_INFO  */ { SMP_PROC_ID_INFO,      SMP_SM_NO_ACTION,  SMP_STATE_BOND_PENDING},
-/* MASTER_ID*/ { SMP_PROC_MASTER_ID,    SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
-/* ID_ADDR  */ { SMP_PROC_ID_ADDR,      SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING}
+/* SIGN_INFO */
+{ SMP_PROC_SRK_INFO,     SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
+/* ENC_INFO */
+{ SMP_PROC_ENC_INFO,     SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
+/* ID_INFO */
+{ SMP_PROC_ID_INFO,      SMP_SM_NO_ACTION,  SMP_STATE_BOND_PENDING},
+/* MASTER_ID*/
+{ SMP_PROC_MASTER_ID,    SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING},
+/* ID_ADDR */
+{ SMP_PROC_ID_ADDR,      SMP_SM_NO_ACTION, SMP_STATE_BOND_PENDING}
 
 };
 
 static const uint8_t smp_slave_create_local_sec_conn_oob_data[][SMP_SM_NUM_COLS] =
 {
-/*                          Event                  Action                 Next State */
-/* LOC_PUBL_KEY_CRTD */ {SMP_SET_LOCAL_OOB_KEYS, SMP_SM_NO_ACTION, SMP_STATE_CREATE_LOCAL_SEC_CONN_OOB_DATA},
-/* HAVE_LOC_NONCE    */ {SMP_SET_LOCAL_OOB_RAND_COMMITMENT, SMP_SM_NO_ACTION, SMP_STATE_IDLE}
+/* Event                  Action                 Next State */
+/* LOC_PUBL_KEY_CRTD */
+{SMP_SET_LOCAL_OOB_KEYS, SMP_SM_NO_ACTION, SMP_STATE_CREATE_LOCAL_SEC_CONN_OOB_DATA},
+/* HAVE_LOC_NONCE */
+{SMP_SET_LOCAL_OOB_RAND_COMMITMENT, SMP_SM_NO_ACTION, SMP_STATE_IDLE}
 };
 
 static const tSMP_SM_TBL smp_state_table[][2] =
@@ -753,11 +956,11 @@
  *
  * Description  Handle events to the state machine. It looks up the entry
  *              in the smp_entry_table array.
- *              If it is a valid entry, it gets the state table.Set the next state,
- *              if not NULL state.Execute the action function according to the
- *              state table. If the state returned by action function is not NULL
- *              state, adjust the new state to the returned state.If (api_evt != MAX),
- *              call callback function.
+ *              If it is a valid entry, it gets the state table. Set the next
+ *              state, if not NULL state. Execute the action function according
+ *              to the state table. If the state returned by action function is
+ *              not NULL state, adjust the new state to the returned state. If
+ *              (api_evt != MAX), call callback function.
  *
  * Returns      void.
  *
diff --git a/stack/smp/smp_utils.cc b/stack/smp/smp_utils.cc
index c0963e6..75c1655 100644
--- a/stack/smp/smp_utils.cc
+++ b/stack/smp/smp_utils.cc
@@ -377,8 +377,8 @@
  *
  * Function         smp_delayed_auth_complete_timeout
  *
- * Description      Called when no pairing failed command received within timeout
- *                  period.
+ * Description      Called when no pairing failed command received within
+ *                  timeout period.
  *
  * Returns          void
  *
@@ -884,8 +884,8 @@
  *
  * Function         smp_reset_control_value
  *
- * Description      This function is called to reset the control block value when
- *                  pairing procedure finished.
+ * Description      This function is called to reset the control block value
+ *                  when the pairing procedure finished.
  *
  *
  * Returns          void
@@ -954,9 +954,9 @@
  *
  * Function         smp_command_has_invalid_parameters
  *
- * Description      Checks if the received SMP command has invalid parameters i.e.
- *                  if the command length is valid and the command parameters are
- *                  inside specified range.
+ * Description      Checks if the received SMP command has invalid parameters
+ *                  i.e. if the command length is valid and the command
+ *                  parameters are inside specified range.
  *                  It returns true if the command has invalid parameters.
  *
  * Returns          true if the command has invalid parameters, false otherwise.
@@ -1023,7 +1023,8 @@
  *                  OOB data flag,
  *                  Bonding_flags in AuthReq
  *                  Maximum encryption key size.
- *                  Returns false if at least one of these parameters is out of range.
+ *                  Returns false if at least one of these parameters is out of
+ *                  range.
  *
  ******************************************************************************/
 bool    smp_pairing_request_response_parameters_are_valid(tSMP_CB *p_cb)
@@ -1074,8 +1075,8 @@
  *
  * Function         smp_pairing_keypress_notification_is_valid
  *
- * Description      Validates Notification Type parameter range in the received SMP command
- *                  pairing keypress notification.
+ * Description      Validates Notification Type parameter range in the received
+ *                  SMP command pairing keypress notification.
  *                  Returns false if this parameter is out of range.
  *
  ******************************************************************************/
@@ -1156,9 +1157,10 @@
  *                  oob data flag and authentication request.
  *
  * Note             If Secure Connections Only mode is required locally then we
- *                  come to this point only if both sides support Secure Connections
- *                  mode, i.e. if p_cb->secure_connections_only_mode_required = true then we come
- *                  to this point only if
+ *                  come to this point only if both sides support Secure
+ *                  Connections mode, i.e.
+ *                  if p_cb->secure_connections_only_mode_required = true
+ *                  then we come to this point only if
  *                      (p_cb->peer_auth_req & SMP_SC_SUPPORT_BIT) ==
  *                      (p_cb->loc_auth_req & SMP_SC_SUPPORT_BIT) ==
  *                      SMP_SC_SUPPORT_BIT
@@ -1201,8 +1203,8 @@
 /*******************************************************************************
  * Function         smp_select_legacy_association_model
  *
- * Description      This function is called to select association mode if at least
- *                  one side doesn't support secure connections.
+ * Description      This function is called to select association mode if at
+ *                  least one side doesn't support secure connections.
  *
  ******************************************************************************/
 tSMP_ASSO_MODEL smp_select_legacy_association_model(tSMP_CB *p_cb)
@@ -1297,8 +1299,8 @@
 /*******************************************************************************
  * Function         smp_calculate_random_input
  *
- * Description      This function returns random input value to be used in commitment
- *                  calculation for SC passkey entry association mode
+ * Description      This function returns random input value to be used in
+ *                  commitment calculation for SC passkey entry association mode
  *                  (if bit["round"] in "random" array == 1 then returns 0x81
  *                   else returns 0x80).
  *
@@ -1356,7 +1358,7 @@
 /*******************************************************************************
  * Function         smp_collect_local_ble_address
  *
- * Description      This function puts into le_addr array local device le address:
+ * Description      Put the the local device LE address into the le_addr array:
  *                  le_addr[0-5] = local BD ADDR,
  *                  le_addr[6] = local le address type (PUBLIC/RANDOM).
  *
@@ -1379,7 +1381,7 @@
 /*******************************************************************************
  * Function         smp_collect_peer_ble_address
  *
- * Description      This function puts into le_addr array peer device le address:
+ * Description      Put the peer device LE addr into the le_addr array:
  *                  le_addr[0-5] = peer BD ADDR,
  *                  le_addr[6] = peer le address type (PUBLIC/RANDOM).
  *
diff --git a/stack/srvc/srvc_battery.cc b/stack/srvc/srvc_battery.cc
index dd6f133..06030d3 100644
--- a/stack/srvc/srvc_battery.cc
+++ b/stack/srvc/srvc_battery.cc
@@ -26,7 +26,9 @@
 #include "osi/include/osi.h"
 
 #define BA_MAX_CHAR_NUM          1
-#define BA_MAX_ATTR_NUM          (BA_MAX_CHAR_NUM * 5 + 1) /* max 3 descriptors, 1 desclration and 1 value */
+
+/* max 3 descriptors, 1 desclration and 1 value */
+#define BA_MAX_ATTR_NUM          (BA_MAX_CHAR_NUM * 5 + 1)
 
 #ifndef BATTER_LEVEL_PROP
 #define BATTER_LEVEL_PROP           (GATT_CHAR_PROP_BIT_READ|GATT_CHAR_PROP_BIT_NOTIFY)
diff --git a/stack/srvc/srvc_dis.cc b/stack/srvc/srvc_dis.cc
index 05a9eec..addebaa 100644
--- a/stack/srvc/srvc_dis.cc
+++ b/stack/srvc/srvc_dis.cc
@@ -422,10 +422,13 @@
             if (dis_attr_bit & (uint16_t)(1 << i))
             {
                 osi_free(dis_cb.dis_value.data_string[i - 1]);
-/* coverity[OVERRUN-STATIC] False-positive : when i = 8, (1 << i) == DIS_ATTR_PNP_ID_BIT, and it will never come down here
-CID 49902: Out-of-bounds read (OVERRUN_STATIC)
-Overrunning static array "dis_cb.dis_value.data_string", with 7 elements, at position 7 with index variable "i".
-*/
+/* coverity[OVERRUN-STATIC] False-positive :
+ * when i = 8, (1 << i) == DIS_ATTR_PNP_ID_BIT,
+ * and it will never come down here
+ * CID 49902: Out-of-bounds read (OVERRUN_STATIC)
+ * Overrunning static array "dis_cb.dis_value.data_string", with 7 elements, at
+ * position 7 with index variable "i".
+ */
                 dis_cb.dis_value.data_string[i - 1] = (uint8_t *)osi_malloc(p_info->data_str.len + 1);
                 memcpy(dis_cb.dis_value.data_string[i - 1], p_info->data_str.p_data, p_info->data_str.len);
                 dis_cb.dis_value.data_string[i - 1][p_info->data_str.len] = 0; /* make sure null terminate */
diff --git a/stack/srvc/srvc_eng.cc b/stack/srvc/srvc_eng.cc
index 0111a90..ebd063a 100644
--- a/stack/srvc/srvc_eng.cc
+++ b/stack/srvc/srvc_eng.cc
@@ -154,9 +154,10 @@
  *
  * Function         srvc_eng_clcb_alloc
  *
- * Description      The function allocates a GATT profile  connection link control block
+ * Description      Allocate a GATT profile connection link control block
  *
- * Returns           NULL if not found. Otherwise pointer to the connection link block.
+ * Returns          NULL if not found. Otherwise pointer to the connection link
+ *                  block.
  *
  ******************************************************************************/
 tSRVC_CLCB *srvc_eng_clcb_alloc (uint16_t conn_id, BD_ADDR bda)
@@ -181,9 +182,9 @@
  *
  * Function         srvc_eng_clcb_dealloc
  *
- * Description      The function deallocates a GATT profile  connection link control block
+ * Description      De-allocate a GATT profile connection link control block
  *
- * Returns           True the deallocation is successful
+ * Returns          True the deallocation is successful
  *
  ******************************************************************************/
 bool    srvc_eng_clcb_dealloc (uint16_t conn_id)
diff --git a/udrv/ulinux/uipc.cc b/udrv/ulinux/uipc.cc
index 270e33a..235f388 100644
--- a/udrv/ulinux/uipc.cc
+++ b/udrv/ulinux/uipc.cc
@@ -745,8 +745,8 @@
         return 0;
     }
 
-    //BTIF_TRACE_DEBUG("UIPC_Read : ch_id %d, len %d, fd %d, polltmo %d", ch_id, len,
-    //        fd, uipc_main.ch[ch_id].read_poll_tmo_ms);
+    //BTIF_TRACE_DEBUG("UIPC_Read : ch_id %d, len %d, fd %d, polltmo %d",
+    //                 ch_id, len, fd, uipc_main.ch[ch_id].read_poll_tmo_ms);
 
     while (n_read < (int)len)
     {
diff --git a/utils/src/bt_utils.cc b/utils/src/bt_utils.cc
index ba6c489..399b452 100644
--- a/utils/src/bt_utils.cc
+++ b/utils/src/bt_utils.cc
@@ -162,9 +162,10 @@
  *
  * Function        adjust_priority_a2dp
  *
- * Description     increase the a2dp consumer task priority temporarily when start
- *                 audio playing, to avoid overflow the audio packet queue, restore
- *                 the a2dp consumer task priority when stop audio playing.
+ * Description     Increase the a2dp consumer task priority temporarily when
+ *                 audio starts playing to avoid overflowing the audio packet
+ *                 queue. Restore the a2dp consumer task priority when audio
+ *                 is not playing.
  *
  * Returns         void
  *