Use standard types, consistent ifdef style everywhere

Remove the typedefs in stack/include/bt_types.h

Use standard types everywhere.
Use standard style for #if statements:
 - #if (VAR_NAME == TRUE)
 - #if (VAR_NAME1 == TRUE && VAR_NAME2 == TRUE)
Use __func__ instead of __FUNCTION__
Fix some debug statements to use __func__

Update script to be less disruptive to aligned assignment blocks.

Change-Id: I8f8f068e6c26ce74fd3b3707e1e31fd0b919cdd0
diff --git a/stack/l2cap/l2c_api.c b/stack/l2cap/l2c_api.c
index 62012c6..608250c 100644
--- a/stack/l2cap/l2c_api.c
+++ b/stack/l2cap/l2c_api.c
@@ -57,10 +57,10 @@
 **                  L2CA_ErtmConnectReq() and L2CA_Deregister()
 **
 *******************************************************************************/
-UINT16 L2CA_Register (UINT16 psm, tL2CAP_APPL_INFO *p_cb_info)
+uint16_t L2CA_Register (uint16_t psm, tL2CAP_APPL_INFO *p_cb_info)
 {
     tL2C_RCB    *p_rcb;
-    UINT16      vpsm = psm;
+    uint16_t    vpsm = psm;
 
     L2CAP_TRACE_API ("L2CAP - L2CA_Register() called for PSM: 0x%04x", psm);
 
@@ -124,7 +124,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void L2CA_Deregister (UINT16 psm)
+void L2CA_Deregister (uint16_t psm)
 {
     tL2C_RCB    *p_rcb;
     tL2C_CCB    *p_ccb;
@@ -171,10 +171,10 @@
 ** Returns          PSM to use.
 **
 *******************************************************************************/
-UINT16 L2CA_AllocatePSM(void)
+uint16_t L2CA_AllocatePSM(void)
 {
-    BOOLEAN done = FALSE;
-    UINT16 psm = l2cb.dyn_psm;
+    bool    done = false;
+    uint16_t psm = l2cb.dyn_psm;
 
     L2CAP_TRACE_API( "L2CA_AllocatePSM");
     while (!done)
@@ -196,7 +196,7 @@
 
         /* make sure the newlly allocated psm is not used right now */
         if ((l2cu_find_rcb_by_psm (psm)) == NULL)
-            done = TRUE;
+            done = true;
     }
     l2cb.dyn_psm = psm;
 
@@ -215,7 +215,7 @@
 ** Returns          the CID of the connection, or 0 if it failed to start
 **
 *******************************************************************************/
-UINT16 L2CA_ConnectReq (UINT16 psm, BD_ADDR p_bd_addr)
+uint16_t L2CA_ConnectReq (uint16_t psm, BD_ADDR p_bd_addr)
 {
     return L2CA_ErtmConnectReq (psm, p_bd_addr, NULL);
 }
@@ -236,7 +236,7 @@
 ** Returns          the CID of the connection, or 0 if it failed to start
 **
 *******************************************************************************/
-UINT16 L2CA_ErtmConnectReq (UINT16 psm, BD_ADDR p_bd_addr, tL2CAP_ERTM_INFO *p_ertm_info)
+uint16_t L2CA_ErtmConnectReq (uint16_t psm, BD_ADDR p_bd_addr, tL2CAP_ERTM_INFO *p_ertm_info)
 {
     tL2C_LCB        *p_lcb;
     tL2C_CCB        *p_ccb;
@@ -266,9 +266,9 @@
     if ((p_lcb = l2cu_find_lcb_by_bd_addr (p_bd_addr, BT_TRANSPORT_BR_EDR)) == NULL)
     {
         /* No link. Get an LCB and start link establishment */
-        if ( ((p_lcb = l2cu_allocate_lcb (p_bd_addr, FALSE, BT_TRANSPORT_BR_EDR)) == NULL)
+        if ( ((p_lcb = l2cu_allocate_lcb (p_bd_addr, false, BT_TRANSPORT_BR_EDR)) == NULL)
              /* currently use BR/EDR for ERTM mode l2cap connection */
-         ||  (l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR) == FALSE) )
+         ||  (l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR) == false) )
         {
             L2CAP_TRACE_WARNING ("L2CAP - conn not started for PSM: 0x%04x  p_lcb: 0x%08x", psm, p_lcb);
             return (0);
@@ -346,7 +346,7 @@
 **                  and L2CA_DeregisterLECoc()
 **
 *******************************************************************************/
-UINT16 L2CA_RegisterLECoc(UINT16 psm, tL2CAP_APPL_INFO *p_cb_info)
+uint16_t L2CA_RegisterLECoc(uint16_t psm, tL2CAP_APPL_INFO *p_cb_info)
 {
     L2CAP_TRACE_API("%s called for LE PSM: 0x%04x", __func__, psm);
 
@@ -370,7 +370,7 @@
     }
 
     tL2C_RCB    *p_rcb;
-    UINT16      vpsm = psm;
+    uint16_t    vpsm = psm;
 
     /* Check if this is a registration for an outgoing-only connection to */
     /* a dynamic PSM. If so, allocate a "virtual" PSM for the app to use. */
@@ -415,7 +415,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void L2CA_DeregisterLECoc(UINT16 psm)
+void L2CA_DeregisterLECoc(uint16_t psm)
 {
     L2CAP_TRACE_API("%s called for PSM: 0x%04x", __func__, psm);
 
@@ -464,7 +464,7 @@
 ** Returns          the CID of the connection, or 0 if it failed to start
 **
 *******************************************************************************/
-UINT16 L2CA_ConnectLECocReq(UINT16 psm, BD_ADDR p_bd_addr, tL2CAP_LE_CFG_INFO *p_cfg)
+uint16_t L2CA_ConnectLECocReq(uint16_t psm, BD_ADDR p_bd_addr, tL2CAP_LE_CFG_INFO *p_cfg)
 {
     L2CAP_TRACE_API("%s PSM: 0x%04x BDA: %02x:%02x:%02x:%02x:%02x:%02x", __func__, psm,
         p_bd_addr[0], p_bd_addr[1], p_bd_addr[2], p_bd_addr[3], p_bd_addr[4], p_bd_addr[5]);
@@ -489,10 +489,10 @@
     if (p_lcb == NULL)
     {
         /* No link. Get an LCB and start link establishment */
-        p_lcb = l2cu_allocate_lcb(p_bd_addr, FALSE, BT_TRANSPORT_LE);
+        p_lcb = l2cu_allocate_lcb(p_bd_addr, false, BT_TRANSPORT_LE);
         if ((p_lcb == NULL)
              /* currently use BR/EDR for ERTM mode l2cap connection */
-         || (l2cu_create_conn(p_lcb, BT_TRANSPORT_LE) == FALSE) )
+         || (l2cu_create_conn(p_lcb, BT_TRANSPORT_LE) == false) )
         {
             L2CAP_TRACE_WARNING("%s conn not started for PSM: 0x%04x  p_lcb: 0x%08x",
                 __func__, psm, p_lcb);
@@ -553,11 +553,11 @@
 **                  L2CAP COC connection, for which they had gotten an connect
 **                  indication callback.
 **
-** Returns          TRUE for success, FALSE for failure
+** Returns          true for success, false for failure
 **
 *******************************************************************************/
-BOOLEAN L2CA_ConnectLECocRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid, UINT16 result,
-                             UINT16 status, tL2CAP_LE_CFG_INFO *p_cfg)
+bool    L2CA_ConnectLECocRsp (BD_ADDR p_bd_addr, uint8_t id, uint16_t lcid, uint16_t result,
+                             uint16_t status, tL2CAP_LE_CFG_INFO *p_cfg)
 {
     L2CAP_TRACE_API("%s CID: 0x%04x Result: %d Status: %d BDA: %02x:%02x:%02x:%02x:%02x:%02x",
         __func__, lcid, result, status,
@@ -570,7 +570,7 @@
     {
         /* No link. Get an LCB and start link establishment */
         L2CAP_TRACE_WARNING("%s no LCB", __func__);
-        return FALSE;
+        return false;
     }
 
     /* Now, find the channel control block */
@@ -578,14 +578,14 @@
     if (p_ccb == NULL)
     {
         L2CAP_TRACE_WARNING("%s no CCB", __func__);
-        return FALSE;
+        return false;
     }
 
     /* The IDs must match */
     if (p_ccb->remote_id != id)
     {
         L2CAP_TRACE_WARNING("%s bad id. Expected: %d  Got: %d", __func__, p_ccb->remote_id, id);
-        return FALSE;
+        return false;
     }
 
     if (p_cfg)
@@ -602,7 +602,7 @@
         l2c_csm_execute(p_ccb, L2CEVT_L2CA_CONNECT_RSP_NEG, &conn_info);
     }
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -614,10 +614,10 @@
 **  Parameters:      local channel id
 **                   Pointers to peers configuration storage area
 **
-**  Return value:    TRUE if peer is connected
+**  Return value:    true if peer is connected
 **
 *******************************************************************************/
-BOOLEAN L2CA_GetPeerLECocConfig (UINT16 lcid, tL2CAP_LE_CFG_INFO* peer_cfg)
+bool    L2CA_GetPeerLECocConfig (uint16_t lcid, tL2CAP_LE_CFG_INFO* peer_cfg)
 {
     L2CAP_TRACE_API ("%s CID: 0x%04x", __func__, lcid);
 
@@ -625,13 +625,13 @@
     if (p_ccb == NULL)
     {
         L2CAP_TRACE_ERROR("%s No CCB for CID:0x%04x", __func__, lcid);
-        return FALSE;
+        return false;
     }
 
     if (peer_cfg != NULL)
         memcpy(peer_cfg, &p_ccb->peer_conn_cfg, sizeof(tL2CAP_LE_CFG_INFO));
 
-    return TRUE;
+    return true;
 }
 
 bool L2CA_SetConnectionCallbacks(uint16_t local_cid, const tL2CAP_APPL_INFO *callbacks) {
@@ -677,11 +677,11 @@
 **                  L2CAP connection, for which they had gotten an connect
 **                  indication callback.
 **
-** Returns          TRUE for success, FALSE for failure
+** Returns          true for success, false for failure
 **
 *******************************************************************************/
-BOOLEAN L2CA_ConnectRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid,
-                              UINT16 result, UINT16 status)
+bool    L2CA_ConnectRsp (BD_ADDR p_bd_addr, uint8_t id, uint16_t lcid,
+                              uint16_t result, uint16_t status)
 {
     return L2CA_ErtmConnectRsp (p_bd_addr, id, lcid, result, status, NULL);
 }
@@ -694,11 +694,11 @@
 **                  L2CAP connection, for which they had gotten an connect
 **                  indication callback.
 **
-** Returns          TRUE for success, FALSE for failure
+** Returns          true for success, false for failure
 **
 *******************************************************************************/
-BOOLEAN L2CA_ErtmConnectRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid, UINT16 result,
-                             UINT16 status, tL2CAP_ERTM_INFO *p_ertm_info)
+bool    L2CA_ErtmConnectRsp (BD_ADDR p_bd_addr, uint8_t id, uint16_t lcid, uint16_t result,
+                             uint16_t status, tL2CAP_ERTM_INFO *p_ertm_info)
 {
     tL2C_LCB        *p_lcb;
     tL2C_CCB        *p_ccb;
@@ -713,21 +713,21 @@
     {
         /* No link. Get an LCB and start link establishment */
         L2CAP_TRACE_WARNING ("L2CAP - no LCB for L2CA_conn_rsp");
-        return (FALSE);
+        return (false);
     }
 
     /* Now, find the channel control block */
     if ((p_ccb = l2cu_find_ccb_by_cid (p_lcb, lcid)) == NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - no CCB for L2CA_conn_rsp");
-        return (FALSE);
+        return (false);
     }
 
     /* The IDs must match */
     if (p_ccb->remote_id != id)
     {
         L2CAP_TRACE_WARNING ("L2CAP - bad id in L2CA_conn_rsp. Exp: %d  Got: %d", p_ccb->remote_id, id);
-        return (FALSE);
+        return (false);
     }
 
     if (p_ertm_info)
@@ -768,7 +768,7 @@
             l2c_csm_execute (p_ccb, L2CEVT_L2CA_CONNECT_RSP_NEG, &conn_info);
     }
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -779,10 +779,10 @@
 **
 **                  Note:  The FCR options of p_cfg are not used.
 **
-** Returns          TRUE if configuration sent, else FALSE
+** Returns          true if configuration sent, else false
 **
 *******************************************************************************/
-BOOLEAN L2CA_ConfigReq (UINT16 cid, tL2CAP_CFG_INFO *p_cfg)
+bool    L2CA_ConfigReq (uint16_t cid, tL2CAP_CFG_INFO *p_cfg)
 {
     tL2C_CCB        *p_ccb;
 
@@ -793,19 +793,19 @@
     if ((p_ccb = l2cu_find_ccb_by_cid (NULL, cid)) == NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - no CCB for L2CA_cfg_req, CID: %d", cid);
-        return (FALSE);
+        return (false);
     }
 
     /* We need to have at least one mode type common with the peer */
     if (!l2c_fcr_adj_our_req_options(p_ccb, p_cfg))
-        return (FALSE);
+        return (false);
 
     /* Don't adjust FCR options if not used */
     if ((!p_cfg->fcr_present)||(p_cfg->fcr.mode == L2CAP_FCR_BASIC_MODE))
     {
         /* FCR and FCS options are not used in basic mode */
-        p_cfg->fcs_present = FALSE;
-        p_cfg->ext_flow_spec_present = FALSE;
+        p_cfg->fcs_present = false;
+        p_cfg->ext_flow_spec_present = false;
 
         if ( (p_cfg->mtu_present) && (p_cfg->mtu > L2CAP_MTU_SIZE) )
         {
@@ -819,7 +819,7 @@
 
     l2c_csm_execute (p_ccb, L2CEVT_L2CA_CONFIG_REQ, p_cfg);
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -829,10 +829,10 @@
 ** Description      Higher layers call this function to send a configuration
 **                  response.
 **
-** Returns          TRUE if configuration response sent, else FALSE
+** Returns          true if configuration response sent, else false
 **
 *******************************************************************************/
-BOOLEAN L2CA_ConfigRsp (UINT16 cid, tL2CAP_CFG_INFO *p_cfg)
+bool    L2CA_ConfigRsp (uint16_t cid, tL2CAP_CFG_INFO *p_cfg)
 {
     tL2C_CCB        *p_ccb;
 
@@ -843,27 +843,27 @@
     if ((p_ccb = l2cu_find_ccb_by_cid (NULL, cid)) == NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - no CCB for L2CA_cfg_rsp, CID: %d", cid);
-        return (FALSE);
+        return (false);
     }
 
     if ( (p_cfg->result == L2CAP_CFG_OK) || (p_cfg->result == L2CAP_CFG_PENDING) )
         l2c_csm_execute (p_ccb, L2CEVT_L2CA_CONFIG_RSP, p_cfg);
     else
     {
-        p_cfg->fcr_present = FALSE; /* FCR options already negotiated before this point */
+        p_cfg->fcr_present = false; /* FCR options already negotiated before this point */
 
         /* Clear out any cached options that are being returned as an error (excluding FCR) */
         if (p_cfg->mtu_present)
-            p_ccb->peer_cfg.mtu_present = FALSE;
+            p_ccb->peer_cfg.mtu_present = false;
         if (p_cfg->flush_to_present)
-            p_ccb->peer_cfg.flush_to_present = FALSE;
+            p_ccb->peer_cfg.flush_to_present = false;
         if (p_cfg->qos_present)
-            p_ccb->peer_cfg.qos_present = FALSE;
+            p_ccb->peer_cfg.qos_present = false;
 
         l2c_csm_execute (p_ccb, L2CEVT_L2CA_CONFIG_RSP_NEG, p_cfg);
     }
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -872,10 +872,10 @@
 **
 ** Description      Higher layers call this function to disconnect a channel.
 **
-** Returns          TRUE if disconnect sent, else FALSE
+** Returns          true if disconnect sent, else false
 **
 *******************************************************************************/
-BOOLEAN L2CA_DisconnectReq (UINT16 cid)
+bool    L2CA_DisconnectReq (uint16_t cid)
 {
     tL2C_CCB        *p_ccb;
 
@@ -885,12 +885,12 @@
     if ((p_ccb = l2cu_find_ccb_by_cid (NULL, cid)) == NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - no CCB for L2CA_disc_req, CID: %d", cid);
-        return (FALSE);
+        return (false);
     }
 
     l2c_csm_execute (p_ccb, L2CEVT_L2CA_DISCONNECT_REQ, NULL);
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -903,7 +903,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN L2CA_DisconnectRsp (UINT16 cid)
+bool    L2CA_DisconnectRsp (uint16_t cid)
 {
     tL2C_CCB        *p_ccb;
 
@@ -913,12 +913,12 @@
     if ((p_ccb = l2cu_find_ccb_by_cid (NULL, cid)) == NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - no CCB for L2CA_disc_rsp, CID: %d", cid);
-        return (FALSE);
+        return (false);
     }
 
     l2c_csm_execute (p_ccb, L2CEVT_L2CA_DISCONNECT_RSP, NULL);
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -927,10 +927,10 @@
 **
 ** Description      Higher layers call this function to send an echo request.
 **
-** Returns          TRUE if echo request sent, else FALSE.
+** Returns          true if echo request sent, else false.
 **
 *******************************************************************************/
-BOOLEAN  L2CA_Ping (BD_ADDR p_bd_addr, tL2CA_ECHO_RSP_CB *p_callback)
+bool     L2CA_Ping (BD_ADDR p_bd_addr, tL2CA_ECHO_RSP_CB *p_callback)
 {
     tL2C_LCB        *p_lcb;
 
@@ -939,39 +939,39 @@
 
     /* Fail if we have not established communications with the controller */
     if (!BTM_IsDeviceUp())
-        return (FALSE);
+        return (false);
 
     /* First, see if we already have a link to the remote */
     if ((p_lcb = l2cu_find_lcb_by_bd_addr (p_bd_addr, BT_TRANSPORT_BR_EDR)) == NULL)
     {
         /* No link. Get an LCB and start link establishment */
-        if ((p_lcb = l2cu_allocate_lcb (p_bd_addr, FALSE, BT_TRANSPORT_BR_EDR)) == NULL)
+        if ((p_lcb = l2cu_allocate_lcb (p_bd_addr, false, BT_TRANSPORT_BR_EDR)) == NULL)
         {
             L2CAP_TRACE_WARNING ("L2CAP - no LCB for L2CA_ping");
-            return (FALSE);
+            return (false);
         }
-        if (l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR) == FALSE)
+        if (l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR) == false)
         {
-            return (FALSE);
+            return (false);
         }
 
         p_lcb->p_echo_rsp_cb = p_callback;
 
-        return (TRUE);
+        return (true);
     }
 
     /* We only allow 1 ping outstanding at a time */
     if (p_lcb->p_echo_rsp_cb != NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - rejected second L2CA_ping");
-        return (FALSE);
+        return (false);
     }
 
     /* Have a link control block. If link is disconnecting, tell user to retry later */
     if (p_lcb->link_state == LST_DISCONNECTING)
     {
         L2CAP_TRACE_WARNING ("L2CAP - L2CA_ping rejected - link disconnecting");
-        return (FALSE);
+        return (false);
     }
 
     /* Save address of callback */
@@ -987,7 +987,7 @@
                            btu_general_alarm_queue);
     }
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -997,13 +997,13 @@
 ** Description      Higher layers call this function to send an echo request
 **                  with application-specific data.
 **
-** Returns          TRUE if echo request sent, else FALSE.
+** Returns          true if echo request sent, else false.
 **
 *******************************************************************************/
-BOOLEAN  L2CA_Echo (BD_ADDR p_bd_addr, BT_HDR *p_data, tL2CA_ECHO_DATA_CB *p_callback)
+bool     L2CA_Echo (BD_ADDR p_bd_addr, BT_HDR *p_data, tL2CA_ECHO_DATA_CB *p_callback)
 {
     tL2C_LCB    *p_lcb;
-    UINT8       *pp;
+    uint8_t     *pp;
 
     L2CAP_TRACE_API ("L2CA_Echo() BDA: %08X%04X",
             ((p_bd_addr[0] << 24) + (p_bd_addr[1] << 16) + (p_bd_addr[2] <<  8) + (p_bd_addr[3])),
@@ -1011,37 +1011,37 @@
 
     /* Fail if we have not established communications with the controller */
     if (!BTM_IsDeviceUp())
-        return (FALSE);
+        return (false);
 
     if ((memcmp(BT_BD_ANY, p_bd_addr, BD_ADDR_LEN) == 0) && (p_data == NULL))
     {
         /* Only register callback without sending message. */
         l2cb.p_echo_data_cb = p_callback;
-        return TRUE;
+        return true;
     }
 
     /* We assume the upper layer will call this function only when the link is established. */
     if ((p_lcb = l2cu_find_lcb_by_bd_addr (p_bd_addr, BT_TRANSPORT_BR_EDR)) == NULL)
     {
         L2CAP_TRACE_ERROR ("L2CA_Echo ERROR : link not established");
-        return FALSE;
+        return false;
     }
 
     if (p_lcb->link_state != LST_CONNECTED)
     {
         L2CAP_TRACE_ERROR ("L2CA_Echo ERROR : link is not connected");
-        return FALSE;
+        return false;
     }
 
     /* Save address of callback */
     l2cb.p_echo_data_cb = p_callback;
 
     /* Set the pointer to the beginning of the data */
-    pp = (UINT8 *)(p_data + 1) + p_data->offset;
+    pp = (uint8_t *)(p_data + 1) + p_data->offset;
     l2cu_adj_id(p_lcb, L2CAP_ADJ_BRCM_ID);  /* Make sure not using Broadcom ID */
     l2cu_send_peer_echo_req (p_lcb, pp, p_data->len);
 
-    return (TRUE);
+    return (true);
 
 }
 
@@ -1070,14 +1070,14 @@
 **                  is removed. A timeout of 0xFFFF means no timeout. Values are
 **                  in seconds.
 **
-** Returns          TRUE if command succeeded, FALSE if failed
+** Returns          true if command succeeded, false if failed
 **
 ** NOTE             This timeout takes effect after at least 1 channel has been
 **                  established and removed. L2CAP maintains its own timer from
 **                  whan a connection is established till the first channel is
 **                  set up.
 *******************************************************************************/
-BOOLEAN L2CA_SetIdleTimeout (UINT16 cid, UINT16 timeout, BOOLEAN is_global)
+bool    L2CA_SetIdleTimeout (uint16_t cid, uint16_t timeout, bool    is_global)
 {
     tL2C_CCB        *p_ccb;
     tL2C_LCB        *p_lcb;
@@ -1092,7 +1092,7 @@
         if ((p_ccb = l2cu_find_ccb_by_cid (NULL, cid)) == NULL)
         {
             L2CAP_TRACE_WARNING ("L2CAP - no CCB for L2CA_SetIdleTimeout, CID: %d", cid);
-            return (FALSE);
+            return (false);
         }
 
         p_lcb = p_ccb->p_lcb;
@@ -1100,10 +1100,10 @@
         if ((p_lcb) && (p_lcb->in_use) && (p_lcb->link_state == LST_CONNECTED))
             p_lcb->idle_timeout = timeout;
         else
-            return (FALSE);
+            return (false);
     }
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -1120,12 +1120,12 @@
 **                  then the idle timeouts for all active l2cap links will be
 **                  changed.
 **
-** Returns          TRUE if command succeeded, FALSE if failed
+** Returns          true if command succeeded, false if failed
 **
 ** NOTE             This timeout applies to all logical channels active on the
 **                  ACL link.
 *******************************************************************************/
-BOOLEAN L2CA_SetIdleTimeoutByBdAddr(BD_ADDR bd_addr, UINT16 timeout, tBT_TRANSPORT transport)
+bool    L2CA_SetIdleTimeoutByBdAddr(BD_ADDR bd_addr, uint16_t timeout, tBT_TRANSPORT transport)
 {
     tL2C_LCB        *p_lcb;
 
@@ -1140,7 +1140,7 @@
                 l2cu_no_dynamic_ccbs (p_lcb);
         }
         else
-            return FALSE;
+            return false;
     }
     else
     {
@@ -1159,7 +1159,7 @@
         }
     }
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -1172,7 +1172,7 @@
 ** Returns          the new (current) trace level
 **
 *******************************************************************************/
-UINT8 L2CA_SetTraceLevel (UINT8 new_level)
+uint8_t L2CA_SetTraceLevel (uint8_t new_level)
 {
     if (new_level != 0xFF)
         l2cb.l2cap_trace_level = new_level;
@@ -1196,7 +1196,7 @@
 ** Returns      the new (current) role
 **
 *******************************************************************************/
-UINT8 L2CA_SetDesireRole (UINT8 new_role)
+uint8_t L2CA_SetDesireRole (uint8_t new_role)
 {
     L2CAP_TRACE_API ("L2CA_SetDesireRole() new:x%x, disallow_switch:%d",
         new_role, l2cb.disallow_switch);
@@ -1206,11 +1206,11 @@
         /* do not process the allow_switch when both bits are set */
         if (new_role & L2CAP_ROLE_ALLOW_SWITCH)
         {
-            l2cb.disallow_switch = FALSE;
+            l2cb.disallow_switch = false;
         }
         if (new_role & L2CAP_ROLE_DISALLOW_SWITCH)
         {
-            l2cb.disallow_switch = TRUE;
+            l2cb.disallow_switch = true;
         }
     }
 
@@ -1229,7 +1229,7 @@
 ** Returns      CID of 0 if none.
 **
 *******************************************************************************/
-UINT16 L2CA_LocalLoopbackReq (UINT16 psm, UINT16 handle, BD_ADDR p_bd_addr)
+uint16_t L2CA_LocalLoopbackReq (uint16_t psm, uint16_t handle, BD_ADDR p_bd_addr)
 {
     tL2C_LCB        *p_lcb;
     tL2C_CCB        *p_ccb;
@@ -1251,7 +1251,7 @@
         return (0);
     }
 
-    if ((p_lcb = l2cu_allocate_lcb (p_bd_addr, FALSE, BT_TRANSPORT_BR_EDR)) == NULL)
+    if ((p_lcb = l2cu_allocate_lcb (p_bd_addr, false, BT_TRANSPORT_BR_EDR)) == NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - no LCB for L2CA_conn_req");
         return (0);
@@ -1285,16 +1285,16 @@
 **                  (For initial implementation only two values are valid.
 **                  L2CAP_PRIORITY_NORMAL and L2CAP_PRIORITY_HIGH).
 **
-** Returns          TRUE if a valid channel, else FALSE
+** Returns          true if a valid channel, else false
 **
 *******************************************************************************/
-BOOLEAN L2CA_SetAclPriority (BD_ADDR bd_addr, UINT8 priority)
+bool    L2CA_SetAclPriority (BD_ADDR bd_addr, uint8_t priority)
 {
     L2CAP_TRACE_API ("L2CA_SetAclPriority()  bdaddr: %02x%02x%02x%02x%04x, priority:%d",
                     bd_addr[0], bd_addr[1], bd_addr[2],
                     bd_addr[3], (bd_addr[4] << 8) + bd_addr[5], priority);
 
-    return (l2cu_set_acl_priority(bd_addr, priority, FALSE));
+    return (l2cu_set_acl_priority(bd_addr, priority, false));
 }
 
 /*******************************************************************************
@@ -1303,15 +1303,15 @@
 **
 ** Description      Higher layers call this function to flow control a channel.
 **
-**                  data_enabled - TRUE data flows, FALSE data is stopped
+**                  data_enabled - true data flows, false data is stopped
 **
-** Returns          TRUE if valid channel, else FALSE
+** Returns          true if valid channel, else false
 **
 *******************************************************************************/
-BOOLEAN L2CA_FlowControl (UINT16 cid, BOOLEAN data_enabled)
+bool    L2CA_FlowControl (uint16_t cid, bool    data_enabled)
 {
     tL2C_CCB  *p_ccb;
-    BOOLEAN   on_off = !data_enabled;
+    bool      on_off = !data_enabled;
 
     L2CAP_TRACE_API ("L2CA_FlowControl(%d)  CID: 0x%04x", on_off, cid);
 
@@ -1319,13 +1319,13 @@
     if ((p_ccb = l2cu_find_ccb_by_cid (NULL, cid)) == NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - no CCB for L2CA_FlowControl, CID: 0x%04x  data_enabled: %d", cid, data_enabled);
-        return (FALSE);
+        return (false);
     }
 
     if (p_ccb->peer_cfg.fcr.mode != L2CAP_FCR_ERTM_MODE)
     {
         L2CAP_TRACE_EVENT ("L2CA_FlowControl()  invalid mode:%d", p_ccb->peer_cfg.fcr.mode);
-        return (FALSE);
+        return (false);
     }
     if (p_ccb->fcrb.local_busy != on_off)
     {
@@ -1340,7 +1340,7 @@
         }
     }
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -1349,10 +1349,10 @@
 **
 ** Description      Higher layers call this function to send a test S-frame.
 **
-** Returns          TRUE if valid Channel, else FALSE
+** Returns          true if valid Channel, else false
 **
 *******************************************************************************/
-BOOLEAN L2CA_SendTestSFrame (UINT16 cid, UINT8 sup_type, UINT8 back_track)
+bool    L2CA_SendTestSFrame (uint16_t cid, uint8_t sup_type, uint8_t back_track)
 {
     tL2C_CCB        *p_ccb;
 
@@ -1362,17 +1362,17 @@
     if ((p_ccb = l2cu_find_ccb_by_cid (NULL, cid)) == NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - no CCB for L2CA_SendTestSFrame, CID: %d", cid);
-        return (FALSE);
+        return (false);
     }
 
     if ( (p_ccb->chnl_state != CST_OPEN) || (p_ccb->peer_cfg.fcr.mode != L2CAP_FCR_ERTM_MODE) )
-        return (FALSE);
+        return (false);
 
     p_ccb->fcrb.next_seq_expected -= back_track;
 
-    l2c_fcr_send_S_frame (p_ccb, (UINT16)(sup_type & 3), (UINT16)(sup_type & (L2CAP_FCR_P_BIT | L2CAP_FCR_F_BIT)));
+    l2c_fcr_send_S_frame (p_ccb, (uint16_t)(sup_type & 3), (uint16_t)(sup_type & (L2CAP_FCR_P_BIT | L2CAP_FCR_F_BIT)));
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -1381,10 +1381,10 @@
 **
 ** Description      Sets the transmission priority for a channel.
 **
-** Returns          TRUE if a valid channel, else FALSE
+** Returns          true if a valid channel, else false
 **
 *******************************************************************************/
-BOOLEAN L2CA_SetTxPriority (UINT16 cid, tL2CAP_CHNL_PRIORITY priority)
+bool    L2CA_SetTxPriority (uint16_t cid, tL2CAP_CHNL_PRIORITY priority)
 {
     tL2C_CCB        *p_ccb;
 
@@ -1394,13 +1394,13 @@
     if ((p_ccb = l2cu_find_ccb_by_cid (NULL, cid)) == NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - no CCB for L2CA_SetTxPriority, CID: %d", cid);
-        return (FALSE);
+        return (false);
     }
 
     /* it will update the order of CCB in LCB by priority and update round robin service variables */
     l2cu_change_pri_ccb (p_ccb, priority);
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -1409,10 +1409,10 @@
 **
 ** Description      Sets the tx/rx data rate for a channel.
 **
-** Returns          TRUE if a valid channel, else FALSE
+** Returns          true if a valid channel, else false
 **
 *******************************************************************************/
-BOOLEAN L2CA_SetChnlDataRate (UINT16 cid, tL2CAP_CHNL_DATA_RATE tx, tL2CAP_CHNL_DATA_RATE rx)
+bool    L2CA_SetChnlDataRate (uint16_t cid, tL2CAP_CHNL_DATA_RATE tx, tL2CAP_CHNL_DATA_RATE rx)
 {
     tL2C_CCB        *p_ccb;
 
@@ -1422,7 +1422,7 @@
     if ((p_ccb = l2cu_find_ccb_by_cid (NULL, cid)) == NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - no CCB for L2CA_SetChnlDataRate, CID: %d", cid);
-        return (FALSE);
+        return (false);
     }
 
     p_ccb->tx_data_rate = tx;
@@ -1431,7 +1431,7 @@
     /* Adjust channel buffer allocation */
     l2c_link_adjust_chnl_allocation ();
 
-    return(TRUE);
+    return(true);
 }
 
 /*******************************************************************************
@@ -1447,19 +1447,19 @@
 **                           L2CAP_NO_RETRANSMISSION : No retransmission
 **                           0x0002 - 0xFFFE : flush time out, if (flush_tout*8)+3/5)
 **                                    <= HCI_MAX_AUTO_FLUSH_TOUT (in 625us slot).
-**                                    Otherwise, return FALSE.
+**                                    Otherwise, return false.
 **                           L2CAP_NO_AUTOMATIC_FLUSH : No automatic flush
 **
-** Returns          TRUE if command succeeded, FALSE if failed
+** Returns          true if command succeeded, false if failed
 **
 ** NOTE             This flush timeout applies to all logical channels active on the
 **                  ACL link.
 *******************************************************************************/
-BOOLEAN L2CA_SetFlushTimeout (BD_ADDR bd_addr, UINT16 flush_tout)
+bool    L2CA_SetFlushTimeout (BD_ADDR bd_addr, uint16_t flush_tout)
 {
     tL2C_LCB    *p_lcb;
-    UINT16      hci_flush_to;
-    UINT32      temp;
+    uint16_t    hci_flush_to;
+    uint32_t    temp;
 
     /* no automatic flush (infinite timeout) */
     if (flush_tout == 0x0000)
@@ -1483,17 +1483,17 @@
     else
     {
         /* convert L2CAP flush_to to 0.625 ms units, with round */
-        temp = (((UINT32)flush_tout * 8) + 3) / 5;
+        temp = (((uint32_t)flush_tout * 8) + 3) / 5;
 
         /* if L2CAP flush_to within range of HCI, set HCI flush timeout */
         if (temp > HCI_MAX_AUTO_FLUSH_TOUT)
         {
             L2CAP_TRACE_WARNING("WARNING L2CA_SetFlushTimeout timeout(0x%x) is out of range", flush_tout);
-            return FALSE;
+            return false;
         }
         else
         {
-            hci_flush_to = (UINT16)temp;
+            hci_flush_to = (uint16_t)temp;
         }
     }
 
@@ -1511,14 +1511,14 @@
                                   flush_tout, bd_addr[3], bd_addr[4], bd_addr[5]);
 
                 if (!btsnd_hcic_write_auto_flush_tout (p_lcb->handle, hci_flush_to))
-                    return (FALSE);
+                    return (false);
             }
         }
         else
         {
             L2CAP_TRACE_WARNING ("WARNING L2CA_SetFlushTimeout No lcb for bd_addr [...;%02x%02x%02x]",
                                   bd_addr[3], bd_addr[4], bd_addr[5]);
-            return (FALSE);
+            return (false);
         }
     }
     else
@@ -1539,13 +1539,13 @@
                                       p_lcb->remote_bd_addr[4], p_lcb->remote_bd_addr[5]);
 
                     if (!btsnd_hcic_write_auto_flush_tout(p_lcb->handle, hci_flush_to))
-                        return (FALSE);
+                        return (false);
                 }
             }
         }
     }
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -1557,10 +1557,10 @@
 **  Parameters:      BD address of the peer
 **                   Pointers to features and channel mask storage area
 **
-**  Return value:    TRUE if peer is connected
+**  Return value:    true if peer is connected
 **
 *******************************************************************************/
-BOOLEAN L2CA_GetPeerFeatures (BD_ADDR bd_addr, UINT32 *p_ext_feat, UINT8 *p_chnl_mask)
+bool    L2CA_GetPeerFeatures (BD_ADDR bd_addr, uint32_t *p_ext_feat, uint8_t *p_chnl_mask)
 {
     tL2C_LCB        *p_lcb;
 
@@ -1570,7 +1570,7 @@
         L2CAP_TRACE_WARNING ("L2CA_GetPeerFeatures() No BDA: %08x%04x",
                               (bd_addr[0]<<24)+(bd_addr[1]<<16)+(bd_addr[2]<<8)+bd_addr[3],
                               (bd_addr[4]<<8)+bd_addr[5]);
-        return (FALSE);
+        return (false);
     }
 
     L2CAP_TRACE_API ("L2CA_GetPeerFeatures() BDA: %08x%04x  ExtFea: 0x%08x  Chnl_Mask[0]: 0x%02x",
@@ -1581,7 +1581,7 @@
 
     memcpy (p_chnl_mask, p_lcb->peer_chnl_mask, L2CAP_FIXED_CHNL_ARRAY_SIZE);
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -1593,18 +1593,18 @@
 **  Parameters:      HCI handle
 **                   BD address of the peer
 **
-**  Return value:    TRUE if found lcb for the given handle, FALSE otherwise
+**  Return value:    true if found lcb for the given handle, false otherwise
 **
 *******************************************************************************/
-BOOLEAN L2CA_GetBDAddrbyHandle (UINT16 handle, BD_ADDR bd_addr)
+bool    L2CA_GetBDAddrbyHandle (uint16_t handle, BD_ADDR bd_addr)
 {
     tL2C_LCB *p_lcb = NULL;
-    BOOLEAN found_dev = FALSE;
+    bool    found_dev = false;
 
     p_lcb = l2cu_find_lcb_by_handle (handle);
     if (p_lcb)
     {
-        found_dev = TRUE;
+        found_dev = true;
         memcpy (bd_addr, p_lcb->remote_bd_addr, BD_ADDR_LEN);
     }
 
@@ -1622,7 +1622,7 @@
 **  Return value:    Channel mode
 **
 *******************************************************************************/
-UINT8 L2CA_GetChnlFcrMode (UINT16 lcid)
+uint8_t L2CA_GetChnlFcrMode (uint16_t lcid)
 {
     tL2C_CCB    *p_ccb = l2cu_find_ccb_by_cid (NULL, lcid);
 
@@ -1649,17 +1649,17 @@
 **  Return value:   -
 **
 *******************************************************************************/
-BOOLEAN  L2CA_RegisterFixedChannel (UINT16 fixed_cid, tL2CAP_FIXED_CHNL_REG *p_freg)
+bool     L2CA_RegisterFixedChannel (uint16_t fixed_cid, tL2CAP_FIXED_CHNL_REG *p_freg)
 {
     if ( (fixed_cid < L2CAP_FIRST_FIXED_CHNL) || (fixed_cid > L2CAP_LAST_FIXED_CHNL) )
     {
         L2CAP_TRACE_ERROR ("L2CA_RegisterFixedChannel()  Invalid CID: 0x%04x", fixed_cid);
 
-        return (FALSE);
+        return (false);
     }
 
     l2cb.fixed_reg[fixed_cid - L2CAP_FIRST_FIXED_CHNL] = *p_freg;
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -1671,10 +1671,10 @@
 **  Parameters:     Fixed CID
 **                  BD Address of remote
 **
-**  Return value:   TRUE if connection started
+**  Return value:   true if connection started
 **
 *******************************************************************************/
-BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda)
+bool    L2CA_ConnectFixedChnl (uint16_t fixed_cid, BD_ADDR rem_bda)
 {
     tL2C_LCB *p_lcb;
     tBT_TRANSPORT transport = BT_TRANSPORT_BR_EDR;
@@ -1687,17 +1687,17 @@
      ||  (l2cb.fixed_reg[fixed_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb == NULL) )
     {
         L2CAP_TRACE_ERROR ("%s() Invalid CID: 0x%04x", __func__, fixed_cid);
-        return (FALSE);
+        return (false);
     }
 
     // Fail if BT is not yet up
     if (!BTM_IsDeviceUp())
     {
         L2CAP_TRACE_WARNING ("%s(0x%04x) - BTU not ready", __func__, fixed_cid);
-        return (FALSE);
+        return (false);
     }
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     if (fixed_cid >= L2CAP_ATT_CID && fixed_cid <= L2CAP_SMP_CID)
         transport = BT_TRANSPORT_LE;
 #endif
@@ -1710,7 +1710,7 @@
         // Fixed channels are mandatory on LE transports so ignore the received
         // channel mask and use the locally cached LE channel mask.
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         if (transport == BT_TRANSPORT_LE)
             peer_channel_mask = l2cb.l2c_ble_fixed_chnls_mask;
         else
@@ -1723,7 +1723,7 @@
             L2CAP_TRACE_EVENT  ("%s() CID:0x%04x  BDA: %08x%04x not supported", __func__,
                 fixed_cid,(rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3],
                 (rem_bda[4]<<8)+rem_bda[5]);
-            return FALSE;
+            return false;
         }
 
         // Get a CCB and link the lcb to it
@@ -1731,7 +1731,7 @@
             &l2cb.fixed_reg[fixed_cid - L2CAP_FIRST_FIXED_CHNL].fixed_chnl_opts))
         {
             L2CAP_TRACE_WARNING ("%s(0x%04x) - LCB but no CCB", __func__, fixed_cid);
-            return FALSE;
+            return false;
         }
 
         // racing with disconnecting, queue the connection request
@@ -1740,24 +1740,24 @@
             L2CAP_TRACE_DEBUG ("$s() - link disconnecting: RETRY LATER", __func__);
             /* Save ccb so it can be started after disconnect is finished */
             p_lcb->p_pending_ccb = p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL];
-            return TRUE;
+            return true;
         }
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         (*l2cb.fixed_reg[fixed_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedConn_Cb)
-        (fixed_cid,p_lcb->remote_bd_addr, TRUE, 0, p_lcb->transport);
+        (fixed_cid,p_lcb->remote_bd_addr, true, 0, p_lcb->transport);
 #else
         (*l2cb.fixed_reg[fixed_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedConn_Cb)
-        (fixed_cid, p_lcb->remote_bd_addr, TRUE, 0, BT_TRANSPORT_BR_EDR);
+        (fixed_cid, p_lcb->remote_bd_addr, true, 0, BT_TRANSPORT_BR_EDR);
 #endif
-        return TRUE;
+        return true;
     }
 
     // No link. Get an LCB and start link establishment
-    if ((p_lcb = l2cu_allocate_lcb (rem_bda, FALSE, transport)) == NULL)
+    if ((p_lcb = l2cu_allocate_lcb (rem_bda, false, transport)) == NULL)
     {
         L2CAP_TRACE_WARNING ("%s(0x%04x) - no LCB", __func__, fixed_cid);
-        return FALSE;
+        return false;
     }
 
     // Get a CCB and link the lcb to it
@@ -1767,16 +1767,16 @@
         p_lcb->disc_reason = L2CAP_CONN_NO_RESOURCES;
         L2CAP_TRACE_WARNING ("%s(0x%04x) - no CCB", __func__, fixed_cid);
         l2cu_release_lcb (p_lcb);
-        return FALSE;
+        return false;
     }
 
     if (!l2cu_create_conn(p_lcb, transport))
     {
         L2CAP_TRACE_WARNING ("%s() - create_conn failed", __func__);
         l2cu_release_lcb (p_lcb);
-        return FALSE;
+        return false;
     }
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -1793,7 +1793,7 @@
 **                  L2CAP_DW_FAILED,  if error
 **
 *******************************************************************************/
-UINT16 L2CA_SendFixedChnlData (UINT16 fixed_cid, BD_ADDR rem_bda, BT_HDR *p_buf)
+uint16_t L2CA_SendFixedChnlData (uint16_t fixed_cid, BD_ADDR rem_bda, BT_HDR *p_buf)
 {
     tL2C_LCB        *p_lcb;
     tBT_TRANSPORT   transport = BT_TRANSPORT_BR_EDR;
@@ -1801,7 +1801,7 @@
     L2CAP_TRACE_API ("L2CA_SendFixedChnlData()  CID: 0x%04x  BDA: %08x%04x", fixed_cid,
                      (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5]);
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     if (fixed_cid >= L2CAP_ATT_CID && fixed_cid <= L2CAP_SMP_CID)
         transport = BT_TRANSPORT_LE;
 #endif
@@ -1836,7 +1836,7 @@
     tL2C_BLE_FIXED_CHNLS_MASK peer_channel_mask;
 
     // Select peer channels mask to use depending on transport
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     if (transport == BT_TRANSPORT_LE)
         peer_channel_mask = l2cb.l2c_ble_fixed_chnls_mask;
     else
@@ -1900,10 +1900,10 @@
 **                  BD Address of remote
 **                  Idle timeout to use (or 0xFFFF if don't care)
 **
-**  Return value:   TRUE if channel removed
+**  Return value:   true if channel removed
 **
 *******************************************************************************/
-BOOLEAN L2CA_RemoveFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda)
+bool    L2CA_RemoveFixedChnl (uint16_t fixed_cid, BD_ADDR rem_bda)
 {
     tL2C_LCB    *p_lcb;
     tL2C_CCB    *p_ccb;
@@ -1914,10 +1914,10 @@
      ||  (l2cb.fixed_reg[fixed_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb == NULL) )
     {
         L2CAP_TRACE_ERROR ("L2CA_RemoveFixedChnl()  Invalid CID: 0x%04x", fixed_cid);
-        return (FALSE);
+        return (false);
     }
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     if (fixed_cid >= L2CAP_ATT_CID && fixed_cid <= L2CAP_SMP_CID)
         transport = BT_TRANSPORT_LE;
 #endif
@@ -1929,7 +1929,7 @@
     {
         L2CAP_TRACE_WARNING ("L2CA_RemoveFixedChnl()  CID: 0x%04x  BDA: %08x%04x not connected", fixed_cid,
                              (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5]);
-        return (FALSE);
+        return (false);
     }
 
     L2CAP_TRACE_API ("L2CA_RemoveFixedChnl()  CID: 0x%04x  BDA: %08x%04x", fixed_cid,
@@ -1941,7 +1941,7 @@
     p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL] = NULL;
     p_lcb->disc_reason = HCI_ERR_CONN_CAUSE_LOCAL_HOST;
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     // 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
@@ -1954,7 +1954,7 @@
 
     l2cu_release_ccb (p_ccb);
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -1971,15 +1971,15 @@
 **                  then the idle timeouts for all active l2cap links will be
 **                  changed.
 **
-** Returns          TRUE if command succeeded, FALSE if failed
+** Returns          true if command succeeded, false if failed
 **
 *******************************************************************************/
-BOOLEAN L2CA_SetFixedChannelTout (BD_ADDR rem_bda, UINT16 fixed_cid, UINT16 idle_tout)
+bool    L2CA_SetFixedChannelTout (BD_ADDR rem_bda, uint16_t fixed_cid, uint16_t idle_tout)
 {
     tL2C_LCB        *p_lcb;
     tBT_TRANSPORT   transport = BT_TRANSPORT_BR_EDR;
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     if (fixed_cid >= L2CAP_ATT_CID && fixed_cid <= L2CAP_SMP_CID)
         transport = BT_TRANSPORT_LE;
 #endif
@@ -1990,7 +1990,7 @@
     {
         L2CAP_TRACE_WARNING ("L2CA_SetFixedChannelTout()  CID: 0x%04x  BDA: %08x%04x not connected", fixed_cid,
                              (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5]);
-        return (FALSE);
+        return (false);
     }
 
     p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]->fixed_chnl_idle_tout = idle_tout;
@@ -2001,7 +2001,7 @@
         l2cu_no_dynamic_ccbs (p_lcb);
     }
 
-    return TRUE;
+    return true;
 }
 
 #endif /* #if (L2CAP_NUM_FIXED_CHNLS > 0) */
@@ -2016,10 +2016,10 @@
 **              pp_peer_cfg: pointer of peer's saved configuration options
 **              p_peer_cfg_bits : valid config in bitmap
 **
-** Returns      TRUE if successful
+** Returns      true if successful
 **
 *******************************************************************************/
-BOOLEAN L2CA_GetCurrentConfig (UINT16 lcid,
+bool    L2CA_GetCurrentConfig (uint16_t lcid,
                                tL2CAP_CFG_INFO **pp_our_cfg,  tL2CAP_CH_CFG_BITS *p_our_cfg_bits,
                                tL2CAP_CFG_INFO **pp_peer_cfg, tL2CAP_CH_CFG_BITS *p_peer_cfg_bits)
 {
@@ -2051,12 +2051,12 @@
         *pp_peer_cfg = &(p_ccb->peer_cfg);
         *p_peer_cfg_bits = p_ccb->peer_cfg_bits;
 
-        return TRUE;
+        return true;
     }
     else
     {
         L2CAP_TRACE_ERROR ("No CCB for CID:0x%04x", lcid);
-        return FALSE;
+        return false;
     }
 }
 
@@ -2067,10 +2067,10 @@
 ** Description  This function returns configurations of L2CAP channel
 **              pp_l2c_ccb : pointer to this channels L2CAP ccb data.
 **
-** Returns      TRUE if successful
+** Returns      true if successful
 **
 *******************************************************************************/
-BOOLEAN L2CA_GetConnectionConfig(UINT16 lcid, UINT16 *mtu, UINT16 *rcid, UINT16 *handle)
+bool    L2CA_GetConnectionConfig(uint16_t lcid, uint16_t *mtu, uint16_t *rcid, uint16_t *handle)
 {
     tL2C_CCB *p_ccb = l2cu_find_ccb_by_cid(NULL, lcid);;
 
@@ -2084,11 +2084,11 @@
 
         *rcid  = p_ccb->remote_cid;
         *handle= p_ccb->p_lcb->handle;
-        return TRUE;
+        return true;
     }
 
     L2CAP_TRACE_ERROR ("%s No CCB for CID:0x%04x", __func__, lcid);
-    return FALSE;
+    return false;
 }
 
 /*******************************************************************************
@@ -2100,10 +2100,10 @@
 ** Input Param      p_cb - callback for Number of completed packets event
 **                  p_bda - BT address of remote device
 **
-** Returns          TRUE if registered OK, else FALSE
+** Returns          true if registered OK, else false
 **
 *******************************************************************************/
-BOOLEAN L2CA_RegForNoCPEvt(tL2CA_NOCP_CB *p_cb, BD_ADDR p_bda)
+bool    L2CA_RegForNoCPEvt(tL2CA_NOCP_CB *p_cb, BD_ADDR p_bda)
 {
     tL2C_LCB        *p_lcb;
 
@@ -2112,11 +2112,11 @@
 
     /* If no link for this handle, nothing to do. */
     if (!p_lcb)
-        return FALSE;
+        return false;
 
     p_lcb->p_nocp_cb = p_cb;
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -2125,12 +2125,12 @@
 **
 ** Description      Higher layers call this function to write data.
 **
-** Returns          L2CAP_DW_SUCCESS, if data accepted, else FALSE
+** Returns          L2CAP_DW_SUCCESS, if data accepted, else false
 **                  L2CAP_DW_CONGESTED, if data accepted and the channel is congested
 **                  L2CAP_DW_FAILED, if error
 **
 *******************************************************************************/
-UINT8 L2CA_DataWrite (UINT16 cid, BT_HDR *p_data)
+uint8_t L2CA_DataWrite (uint16_t cid, BT_HDR *p_data)
 {
     L2CAP_TRACE_API ("L2CA_DataWrite()  CID: 0x%04x  Len: %d", cid, p_data->len);
     return l2c_data_write (cid, p_data, L2CAP_FLUSHABLE_CH_BASED);
@@ -2143,10 +2143,10 @@
 ** Description      Higher layers call this function to set a channels
 **                  flushability flags
 **
-** Returns          TRUE if CID found, else FALSE
+** Returns          true if CID found, else false
 **
 *******************************************************************************/
-BOOLEAN L2CA_SetChnlFlushability (UINT16 cid, BOOLEAN is_flushable)
+bool    L2CA_SetChnlFlushability (uint16_t cid, bool    is_flushable)
 {
 #if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
 
@@ -2156,7 +2156,7 @@
     if ((p_ccb = l2cu_find_ccb_by_cid (NULL, cid)) == NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - no CCB for L2CA_SetChnlFlushability, CID: %d", cid);
-        return (FALSE);
+        return (false);
     }
 
     p_ccb->is_flushable = is_flushable;
@@ -2165,7 +2165,7 @@
 
 #endif
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -2178,12 +2178,12 @@
 **                          L2CAP_FLUSHABLE_PKT
 **                          L2CAP_NON_FLUSHABLE_PKT
 **
-** Returns          L2CAP_DW_SUCCESS, if data accepted, else FALSE
+** Returns          L2CAP_DW_SUCCESS, if data accepted, else false
 **                  L2CAP_DW_CONGESTED, if data accepted and the channel is congested
 **                  L2CAP_DW_FAILED, if error
 **
 *******************************************************************************/
-UINT8 L2CA_DataWriteEx (UINT16 cid, BT_HDR *p_data, UINT16 flags)
+uint8_t L2CA_DataWriteEx (uint16_t cid, BT_HDR *p_data, uint16_t flags)
 {
     L2CAP_TRACE_API ("L2CA_DataWriteEx()  CID: 0x%04x  Len: %d Flags:0x%04X",
                        cid, p_data->len, flags);
@@ -2204,11 +2204,11 @@
 ** Returns      Number of buffers left queued for that CID
 **
 *******************************************************************************/
-UINT16 L2CA_FlushChannel (UINT16 lcid, UINT16 num_to_flush)
+uint16_t L2CA_FlushChannel (uint16_t lcid, uint16_t num_to_flush)
 {
     tL2C_CCB        *p_ccb;
     tL2C_LCB        *p_lcb;
-    UINT16          num_left = 0,
+    uint16_t        num_left = 0,
                     num_flushed1 = 0,
                     num_flushed2 = 0;
 
@@ -2235,16 +2235,16 @@
     /* Cannot flush eRTM buffers once they have a sequence number */
     if (p_ccb->peer_cfg.fcr.mode != L2CAP_FCR_ERTM_MODE)
     {
-#if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
+#if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
         if (num_to_flush != L2CAP_FLUSH_CHANS_GET)
         {
             /* If the controller supports enhanced flush, flush the data queued at the controller */
             if ( (HCI_NON_FLUSHABLE_PB_SUPPORTED(BTM_ReadLocalFeatures ()))
              && (BTM_GetNumScoLinks() == 0) )
             {
-                if ( l2cb.is_flush_active == FALSE )
+                if ( l2cb.is_flush_active == false )
                 {
-                    l2cb.is_flush_active = TRUE;
+                    l2cb.is_flush_active = true;
 
                     /* The only packet type defined - 0 - Automatically-Flushable Only */
                     btsnd_hcic_enhanced_flush (p_lcb->handle, 0);
diff --git a/stack/l2cap/l2c_ble.c b/stack/l2cap/l2c_ble.c
index fc2261e..1eb50f1 100644
--- a/stack/l2cap/l2c_ble.c
+++ b/stack/l2cap/l2c_ble.c
@@ -47,10 +47,10 @@
 **
 **  Parameters:     BD Address of remote
 **
-**  Return value:   TRUE if connection was cancelled
+**  Return value:   true if connection was cancelled
 **
 *******************************************************************************/
-BOOLEAN L2CA_CancelBleConnectReq (BD_ADDR rem_bda)
+bool    L2CA_CancelBleConnectReq (BD_ADDR rem_bda)
 {
     tL2C_LCB *p_lcb;
 
@@ -58,7 +58,7 @@
     if (btm_ble_get_conn_st() == BLE_CONN_IDLE)
     {
         L2CAP_TRACE_WARNING ("L2CA_CancelBleConnectReq - no connection pending");
-        return(FALSE);
+        return(false);
     }
 
     if (memcmp (rem_bda, l2cb.ble_connecting_bda, BD_ADDR_LEN))
@@ -68,7 +68,7 @@
                               (l2cb.ble_connecting_bda[4]<<8)+l2cb.ble_connecting_bda[5],
                               (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5]);
 
-        return(FALSE);
+        return(false);
     }
 
     if (btsnd_hcic_ble_create_conn_cancel())
@@ -84,10 +84,10 @@
         /* update state to be cancel, wait for connection cancel complete */
         btm_ble_set_conn_st (BLE_CONN_CANCEL);
 
-        return(TRUE);
+        return(true);
     }
     else
-        return(FALSE);
+        return(false);
 }
 
 /*******************************************************************************
@@ -98,11 +98,11 @@
 **
 **  Parameters:     BD Address of remote
 **
-**  Return value:   TRUE if update started
+**  Return value:   true if update started
 **
 *******************************************************************************/
-BOOLEAN L2CA_UpdateBleConnParams (BD_ADDR rem_bda, UINT16 min_int, UINT16 max_int,
-                                            UINT16 latency, UINT16 timeout)
+bool    L2CA_UpdateBleConnParams (BD_ADDR rem_bda, uint16_t min_int, uint16_t max_int,
+                                            uint16_t latency, uint16_t timeout)
 {
     tL2C_LCB            *p_lcb;
     tACL_CONN           *p_acl_cb = btm_bda_to_acl(rem_bda, BT_TRANSPORT_LE);
@@ -116,7 +116,7 @@
         L2CAP_TRACE_WARNING ("L2CA_UpdateBleConnParams - unknown BD_ADDR %08x%04x",
                               (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3],
                               (rem_bda[4]<<8)+rem_bda[5]);
-        return(FALSE);
+        return(false);
     }
 
     if (p_lcb->transport != BT_TRANSPORT_LE)
@@ -124,7 +124,7 @@
         L2CAP_TRACE_WARNING ("L2CA_UpdateBleConnParams - BD_ADDR %08x%04x not LE",
                               (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3],
                               (rem_bda[4]<<8)+rem_bda[5]);
-        return(FALSE);
+        return(false);
     }
 
     p_lcb->min_interval = min_int;
@@ -135,7 +135,7 @@
 
     l2cble_start_conn_update(p_lcb);
 
-    return(TRUE);
+    return(true);
 }
 
 
@@ -147,10 +147,10 @@
 **
 **  Parameters:     BD Address of remote
 **
-**  Return value:   TRUE if update started
+**  Return value:   true if update started
 **
 *******************************************************************************/
-BOOLEAN L2CA_EnableUpdateBleConnParams (BD_ADDR rem_bda, BOOLEAN enable)
+bool    L2CA_EnableUpdateBleConnParams (BD_ADDR rem_bda, bool    enable)
 {
     if (stack_config_get_interface()->get_pts_conn_updates_disabled())
         return false;
@@ -165,19 +165,19 @@
         L2CAP_TRACE_WARNING ("L2CA_EnableUpdateBleConnParams - unknown BD_ADDR %08x%04x",
             (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3],
             (rem_bda[4]<<8)+rem_bda[5]);
-        return (FALSE);
+        return (false);
     }
 
-    L2CAP_TRACE_API ("%s - BD_ADDR %08x%04x enable %d current upd state 0x%02x",__FUNCTION__,
+    L2CAP_TRACE_API ("%s - BD_ADDR %08x%04x enable %d current upd state 0x%02x",__func__,
         (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3],
         (rem_bda[4]<<8)+rem_bda[5], enable, p_lcb->conn_update_mask);
 
     if (p_lcb->transport != BT_TRANSPORT_LE)
     {
-        L2CAP_TRACE_WARNING ("%s - BD_ADDR %08x%04x not LE (link role %d)", __FUNCTION__,
+        L2CAP_TRACE_WARNING ("%s - BD_ADDR %08x%04x not LE (link role %d)", __func__,
                               (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3],
                               (rem_bda[4]<<8)+rem_bda[5], p_lcb->link_role);
-        return (FALSE);
+        return (false);
     }
 
     if (enable)
@@ -187,7 +187,7 @@
 
     l2cble_start_conn_update(p_lcb);
 
-    return (TRUE);
+    return (true);
 }
 
 
@@ -200,9 +200,9 @@
 ** Returns          link role.
 **
 *******************************************************************************/
-UINT8 L2CA_GetBleConnRole (BD_ADDR bd_addr)
+uint8_t L2CA_GetBleConnRole (BD_ADDR bd_addr)
 {
-    UINT8       role = HCI_ROLE_UNKNOWN;
+    uint8_t     role = HCI_ROLE_UNKNOWN;
 
     tL2C_LCB *p_lcb;
 
@@ -220,10 +220,10 @@
 ** Returns          disconnect reason
 **
 *******************************************************************************/
-UINT16 L2CA_GetDisconnectReason (BD_ADDR remote_bda, tBT_TRANSPORT transport)
+uint16_t L2CA_GetDisconnectReason (BD_ADDR remote_bda, tBT_TRANSPORT transport)
 {
     tL2C_LCB            *p_lcb;
-    UINT16              reason = 0;
+    uint16_t            reason = 0;
 
     if ((p_lcb = l2cu_find_lcb_by_bd_addr (remote_bda, transport)) != NULL)
         reason = p_lcb->disc_reason;
@@ -313,8 +313,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cble_scanner_conn_comp (UINT16 handle, BD_ADDR bda, tBLE_ADDR_TYPE type,
-                               UINT16 conn_interval, UINT16 conn_latency, UINT16 conn_timeout)
+void l2cble_scanner_conn_comp (uint16_t handle, BD_ADDR bda, tBLE_ADDR_TYPE type,
+                               uint16_t conn_interval, uint16_t conn_latency, uint16_t conn_timeout)
 {
     tL2C_LCB            *p_lcb;
     tBTM_SEC_DEV_REC    *p_dev_rec = btm_find_or_alloc_dev (bda);
@@ -322,7 +322,7 @@
     L2CAP_TRACE_DEBUG ("l2cble_scanner_conn_comp: HANDLE=%d addr_type=%d conn_interval=%d slave_latency=%d supervision_tout=%d",
                         handle,  type, conn_interval, conn_latency, conn_timeout);
 
-    l2cb.is_ble_connecting = FALSE;
+    l2cb.is_ble_connecting = false;
 
     /* See if we have a link control block for the remote device */
     p_lcb = l2cu_find_lcb_by_bd_addr (bda, BT_TRANSPORT_LE);
@@ -330,7 +330,7 @@
     /* If we don't have one, create one. this is auto connection complete. */
     if (!p_lcb)
     {
-        p_lcb = l2cu_allocate_lcb (bda, FALSE, BT_TRANSPORT_LE);
+        p_lcb = l2cu_allocate_lcb (bda, false, BT_TRANSPORT_LE);
         if (!p_lcb)
         {
             btm_sec_disconnect (handle, HCI_ERR_NO_CONNECTION);
@@ -374,8 +374,8 @@
 
     btm_ble_set_conn_st(BLE_CONN_IDLE);
 
-#if BLE_PRIVACY_SPT == TRUE
-    btm_ble_disable_resolving_list(BTM_BLE_RL_INIT, TRUE);
+#if (BLE_PRIVACY_SPT == TRUE)
+    btm_ble_disable_resolving_list(BTM_BLE_RL_INIT, true);
 #endif
 }
 
@@ -390,8 +390,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cble_advertiser_conn_comp (UINT16 handle, BD_ADDR bda, tBLE_ADDR_TYPE type,
-                                  UINT16 conn_interval, UINT16 conn_latency, UINT16 conn_timeout)
+void l2cble_advertiser_conn_comp (uint16_t handle, BD_ADDR bda, tBLE_ADDR_TYPE type,
+                                  uint16_t conn_interval, uint16_t conn_latency, uint16_t conn_timeout)
 {
     tL2C_LCB            *p_lcb;
     tBTM_SEC_DEV_REC    *p_dev_rec;
@@ -406,7 +406,7 @@
     /* If we don't have one, create one and accept the connection. */
     if (!p_lcb)
     {
-        p_lcb = l2cu_allocate_lcb (bda, FALSE, BT_TRANSPORT_LE);
+        p_lcb = l2cu_allocate_lcb (bda, false, BT_TRANSPORT_LE);
         if (!p_lcb)
         {
             btm_sec_disconnect (handle, HCI_ERR_NO_CONNECTION);
@@ -442,8 +442,8 @@
 
     btm_acl_created (bda, NULL, p_dev_rec->sec_bd_name, handle, p_lcb->link_role, BT_TRANSPORT_LE);
 
-#if BLE_PRIVACY_SPT == TRUE
-    btm_ble_disable_resolving_list(BTM_BLE_RL_ADV, TRUE);
+#if (BLE_PRIVACY_SPT == TRUE)
+    btm_ble_disable_resolving_list(BTM_BLE_RL_ADV, true);
 #endif
 
     p_lcb->peer_chnl_mask[0] = L2CAP_FIXED_CHNL_ATT_BIT | L2CAP_FIXED_CHNL_BLE_SIG_BIT | L2CAP_FIXED_CHNL_SMP_BIT;
@@ -471,10 +471,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cble_conn_comp(UINT16 handle, UINT8 role, BD_ADDR bda, tBLE_ADDR_TYPE type,
-                      UINT16 conn_interval, UINT16 conn_latency, UINT16 conn_timeout)
+void l2cble_conn_comp(uint16_t handle, uint8_t role, BD_ADDR bda, tBLE_ADDR_TYPE type,
+                      uint16_t conn_interval, uint16_t conn_latency, uint16_t conn_timeout)
 {
-    btm_ble_update_link_topology_mask(role, TRUE);
+    btm_ble_update_link_topology_mask(role, true);
 
     if (role == HCI_ROLE_MASTER)
     {
@@ -499,7 +499,7 @@
 *******************************************************************************/
 static void l2cble_start_conn_update (tL2C_LCB *p_lcb)
 {
-    UINT16 min_conn_int, max_conn_int, slave_latency, supervision_tout;
+    uint16_t min_conn_int, max_conn_int, slave_latency, supervision_tout;
     tACL_CONN *p_acl_cb = btm_bda_to_acl(p_lcb->remote_bd_addr, BT_TRANSPORT_LE);
 
     // TODO(armansito): The return value of this call wasn't being used but the
@@ -525,7 +525,7 @@
 
             /* if both side 4.1, or we are master device, send HCI command */
             if (p_lcb->link_role == HCI_ROLE_MASTER
-#if (defined BLE_LLT_INCLUDED) && (BLE_LLT_INCLUDED == TRUE)
+#if (BLE_LLT_INCLUDED == TRUE)
                 || (HCI_LE_CONN_PARAM_REQ_SUPPORTED(controller_get_interface()->get_features_ble()->as_array) &&
                     HCI_LE_CONN_PARAM_REQ_SUPPORTED(p_acl_cb->peer_le_features))
 #endif
@@ -550,7 +550,7 @@
         {
              /* if both side 4.1, or we are master device, send HCI command */
             if (p_lcb->link_role == HCI_ROLE_MASTER
-#if (defined BLE_LLT_INCLUDED) && (BLE_LLT_INCLUDED == TRUE)
+#if (BLE_LLT_INCLUDED == TRUE)
                 || (HCI_LE_CONN_PARAM_REQ_SUPPORTED(controller_get_interface()->get_features_ble()->as_array) &&
                     HCI_LE_CONN_PARAM_REQ_SUPPORTED(p_acl_cb->peer_le_features))
 #endif
@@ -581,8 +581,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cble_process_conn_update_evt (UINT16 handle, UINT8 status,
-                  UINT16 interval, UINT16 latency, UINT16 timeout)
+void l2cble_process_conn_update_evt (uint16_t handle, uint8_t status,
+                  uint16_t interval, uint16_t latency, uint16_t timeout)
 {
     L2CAP_TRACE_DEBUG("%s", __func__);
 
@@ -616,17 +616,17 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cble_process_sig_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len)
+void l2cble_process_sig_cmd (tL2C_LCB *p_lcb, uint8_t *p, uint16_t pkt_len)
 {
-    UINT8           *p_pkt_end;
-    UINT8           cmd_code, id;
-    UINT16          cmd_len;
-    UINT16          min_interval, max_interval, latency, timeout;
+    uint8_t         *p_pkt_end;
+    uint8_t         cmd_code, id;
+    uint16_t        cmd_len;
+    uint16_t        min_interval, max_interval, latency, timeout;
     tL2C_CONN_INFO  con_info;
-    UINT16          lcid = 0, rcid = 0, mtu = 0, mps = 0, initial_credit = 0;
+    uint16_t        lcid = 0, rcid = 0, mtu = 0, mps = 0, initial_credit = 0;
     tL2C_CCB        *p_ccb = NULL, *temp_p_ccb = NULL;
     tL2C_RCB        *p_rcb;
-    UINT16          credit;
+    uint16_t        credit;
     p_pkt_end = p + pkt_len;
 
     STREAM_TO_UINT8  (cmd_code, p);
@@ -757,7 +757,7 @@
             p_ccb->tx_mps = mps;
             p_ccb->ble_sdu = NULL;
             p_ccb->ble_sdu_length = 0;
-            p_ccb->is_first_seg = TRUE;
+            p_ccb->is_first_seg = true;
             p_ccb->peer_cfg.fcr.mode = L2CAP_FCR_LE_COC_MODE;
 
             l2c_csm_execute(p_ccb, L2CEVT_L2CAP_CONNECT_REQ, &con_info);
@@ -806,7 +806,7 @@
                 p_ccb->tx_mps = p_ccb->peer_conn_cfg.mps;
                 p_ccb->ble_sdu = NULL;
                 p_ccb->ble_sdu_length = 0;
-                p_ccb->is_first_seg = TRUE;
+                p_ccb->is_first_seg = true;
                 p_ccb->peer_cfg.fcr.mode = L2CAP_FCR_LE_COC_MODE;
 
                 if (con_info.l2cap_result == L2CAP_LE_CONN_OK)
@@ -876,24 +876,24 @@
 **
 ** Description      This function is to initate a direct connection
 **
-** Returns          TRUE connection initiated, FALSE otherwise.
+** Returns          true connection initiated, false otherwise.
 **
 *******************************************************************************/
-BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb)
+bool    l2cble_init_direct_conn (tL2C_LCB *p_lcb)
 {
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_or_alloc_dev (p_lcb->remote_bd_addr);
     tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
-    UINT16 scan_int;
-    UINT16 scan_win;
+    uint16_t scan_int;
+    uint16_t scan_win;
     BD_ADDR peer_addr;
-    UINT8 peer_addr_type = BLE_ADDR_PUBLIC;
-    UINT8 own_addr_type = BLE_ADDR_PUBLIC;
+    uint8_t peer_addr_type = BLE_ADDR_PUBLIC;
+    uint8_t own_addr_type = BLE_ADDR_PUBLIC;
 
     /* There can be only one BLE connection request outstanding at a time */
     if (p_dev_rec == NULL)
     {
         L2CAP_TRACE_WARNING ("unknown device, can not initate connection");
-        return(FALSE);
+        return(false);
     }
 
     scan_int = (p_cb->scan_int == BTM_BLE_SCAN_PARAM_UNDEF) ? BTM_BLE_SCAN_FAST_INT : p_cb->scan_int;
@@ -902,7 +902,7 @@
     peer_addr_type = p_lcb->ble_addr_type;
     memcpy(peer_addr, p_lcb->remote_bd_addr, BD_ADDR_LEN);
 
-#if ( (defined BLE_PRIVACY_SPT) && (BLE_PRIVACY_SPT == TRUE))
+#if (BLE_PRIVACY_SPT == TRUE)
     own_addr_type = btm_cb.ble_ctr_cb.privacy_mode ? BLE_ADDR_RANDOM : BLE_ADDR_PUBLIC;
     if (p_dev_rec->ble.in_controller_list & BTM_RESOLVING_LIST_BIT)
     {
@@ -912,7 +912,7 @@
         btm_ble_enable_resolving_list(BTM_BLE_RL_INIT);
         btm_random_pseudo_to_identity_addr(peer_addr, &peer_addr_type);
     } else {
-        btm_ble_disable_resolving_list(BTM_BLE_RL_INIT, TRUE);
+        btm_ble_disable_resolving_list(BTM_BLE_RL_INIT, true);
 
         // If we have a current RPA, use that instead.
         if (!bdaddr_is_empty((const bt_bdaddr_t *)p_dev_rec->ble.cur_rand_addr)) {
@@ -925,34 +925,34 @@
     {
         l2cu_release_lcb (p_lcb);
         L2CAP_TRACE_ERROR("initate direct connection fail, topology limitation");
-        return FALSE;
+        return false;
     }
 
-    if (!btsnd_hcic_ble_create_ll_conn (scan_int,/* UINT16 scan_int      */
-                                        scan_win, /* UINT16 scan_win      */
-                                        FALSE,                   /* UINT8 white_list     */
-                                        peer_addr_type,          /* UINT8 addr_type_peer */
+    if (!btsnd_hcic_ble_create_ll_conn (scan_int,/* uint16_t scan_int      */
+                                        scan_win, /* uint16_t scan_win      */
+                                        false,                   /* uint8_t white_list     */
+                                        peer_addr_type,          /* uint8_t addr_type_peer */
                                         peer_addr,               /* BD_ADDR bda_peer     */
-                                        own_addr_type,         /* UINT8 addr_type_own  */
-        (UINT16) ((p_dev_rec->conn_params.min_conn_int != BTM_BLE_CONN_PARAM_UNDEF) ?
-        p_dev_rec->conn_params.min_conn_int : BTM_BLE_CONN_INT_MIN_DEF),  /* UINT16 conn_int_min  */
-        (UINT16) ((p_dev_rec->conn_params.max_conn_int != BTM_BLE_CONN_PARAM_UNDEF) ?
-        p_dev_rec->conn_params.max_conn_int : BTM_BLE_CONN_INT_MAX_DEF),  /* UINT16 conn_int_max  */
-        (UINT16) ((p_dev_rec->conn_params.slave_latency != BTM_BLE_CONN_PARAM_UNDEF) ?
-        p_dev_rec->conn_params.slave_latency : BTM_BLE_CONN_SLAVE_LATENCY_DEF), /* UINT16 conn_latency  */
-        (UINT16) ((p_dev_rec->conn_params.supervision_tout != BTM_BLE_CONN_PARAM_UNDEF) ?
+                                        own_addr_type,         /* uint8_t addr_type_own  */
+        (uint16_t) ((p_dev_rec->conn_params.min_conn_int != BTM_BLE_CONN_PARAM_UNDEF) ?
+        p_dev_rec->conn_params.min_conn_int : BTM_BLE_CONN_INT_MIN_DEF),  /* uint16_t conn_int_min  */
+        (uint16_t) ((p_dev_rec->conn_params.max_conn_int != BTM_BLE_CONN_PARAM_UNDEF) ?
+        p_dev_rec->conn_params.max_conn_int : BTM_BLE_CONN_INT_MAX_DEF),  /* uint16_t conn_int_max  */
+        (uint16_t) ((p_dev_rec->conn_params.slave_latency != BTM_BLE_CONN_PARAM_UNDEF) ?
+        p_dev_rec->conn_params.slave_latency : BTM_BLE_CONN_SLAVE_LATENCY_DEF), /* uint16_t conn_latency  */
+        (uint16_t) ((p_dev_rec->conn_params.supervision_tout != BTM_BLE_CONN_PARAM_UNDEF) ?
         p_dev_rec->conn_params.supervision_tout : BTM_BLE_CONN_TIMEOUT_DEF), /* conn_timeout */
-                                        0,                       /* UINT16 min_len       */
-                                        0))                      /* UINT16 max_len       */
+                                        0,                       /* uint16_t min_len       */
+                                        0))                      /* uint16_t max_len       */
     {
         l2cu_release_lcb (p_lcb);
         L2CAP_TRACE_ERROR("initate direct connection fail, no resources");
-        return (FALSE);
+        return (false);
     }
     else
     {
         p_lcb->link_state = LST_CONNECTING;
-        l2cb.is_ble_connecting = TRUE;
+        l2cb.is_ble_connecting = true;
         memcpy (l2cb.ble_connecting_bda, p_lcb->remote_bd_addr, BD_ADDR_LEN);
         alarm_set_on_queue(p_lcb->l2c_lcb_timer,
                            L2CAP_BLE_LINK_CONNECT_TIMEOUT_MS,
@@ -960,7 +960,7 @@
                            btu_general_alarm_queue);
         btm_ble_set_conn_st (BLE_DIR_CONN);
 
-        return (TRUE);
+        return (true);
     }
 }
 
@@ -970,13 +970,13 @@
 **
 ** Description      This function initiates an acl connection via HCI
 **
-** Returns          TRUE if successful, FALSE if connection not started.
+** Returns          true if successful, false if connection not started.
 **
 *******************************************************************************/
-BOOLEAN l2cble_create_conn (tL2C_LCB *p_lcb)
+bool    l2cble_create_conn (tL2C_LCB *p_lcb)
 {
     tBTM_BLE_CONN_ST     conn_st = btm_ble_get_conn_st();
-    BOOLEAN         rt = FALSE;
+    bool            rt = false;
 
     /* There can be only one BLE connection request outstanding at a time */
     if (conn_st == BLE_CONN_IDLE)
@@ -992,7 +992,7 @@
         if (conn_st == BLE_BG_CONN)
             btm_ble_suspend_bg_conn();
 
-        rt = TRUE;
+        rt = true;
     }
     return rt;
 }
@@ -1008,7 +1008,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2c_link_processs_ble_num_bufs (UINT16 num_lm_ble_bufs)
+void l2c_link_processs_ble_num_bufs (uint16_t num_lm_ble_bufs)
 {
     if (num_lm_ble_bufs == 0)
     {
@@ -1036,13 +1036,13 @@
 *******************************************************************************/
 void l2c_ble_link_adjust_allocation (void)
 {
-    UINT16      qq, yy, qq_remainder;
+    uint16_t    qq, yy, qq_remainder;
     tL2C_LCB    *p_lcb;
-    UINT16      hi_quota, low_quota;
-    UINT16      num_lowpri_links = 0;
-    UINT16      num_hipri_links  = 0;
-    UINT16      controller_xmit_quota = l2cb.num_lm_ble_bufs;
-    UINT16      high_pri_link_quota = L2CAP_HIGH_PRI_MIN_XMIT_QUOTA_A;
+    uint16_t    hi_quota, low_quota;
+    uint16_t    num_lowpri_links = 0;
+    uint16_t    num_hipri_links  = 0;
+    uint16_t    controller_xmit_quota = l2cb.num_lm_ble_bufs;
+    uint16_t    high_pri_link_quota = L2CAP_HIGH_PRI_MIN_XMIT_QUOTA_A;
 
     /* If no links active, reset buffer quotas and controller buffers */
     if (l2cb.num_ble_links_active == 0)
@@ -1147,7 +1147,7 @@
     }
 }
 
-#if (defined BLE_LLT_INCLUDED) && (BLE_LLT_INCLUDED == TRUE)
+#if (BLE_LLT_INCLUDED == TRUE)
 /*******************************************************************************
 **
 ** Function         l2cble_process_rc_param_request_evt
@@ -1157,8 +1157,8 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cble_process_rc_param_request_evt(UINT16 handle, UINT16 int_min, UINT16 int_max,
-                                     UINT16 latency, UINT16 timeout)
+void l2cble_process_rc_param_request_evt(uint16_t handle, uint16_t int_min, uint16_t int_max,
+                                     uint16_t latency, uint16_t timeout)
 {
     tL2C_LCB    *p_lcb = l2cu_find_lcb_by_handle (handle);
 
@@ -1200,10 +1200,10 @@
 *******************************************************************************/
 void l2cble_update_data_length(tL2C_LCB *p_lcb)
 {
-    UINT16 tx_mtu = 0;
-    UINT16 i = 0;
+    uint16_t tx_mtu = 0;
+    uint16_t i = 0;
 
-    L2CAP_TRACE_DEBUG("%s", __FUNCTION__);
+    L2CAP_TRACE_DEBUG("%s", __func__);
 
     /* See if we have a link control block for the connection */
     if (p_lcb == NULL)
@@ -1237,11 +1237,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cble_process_data_length_change_event(UINT16 handle, UINT16 tx_data_len, UINT16 rx_data_len)
+void l2cble_process_data_length_change_event(uint16_t handle, uint16_t tx_data_len, uint16_t rx_data_len)
 {
     tL2C_LCB *p_lcb = l2cu_find_lcb_by_handle(handle);
 
-    L2CAP_TRACE_DEBUG("%s TX data len = %d", __FUNCTION__, tx_data_len);
+    L2CAP_TRACE_DEBUG("%s TX data len = %d", __func__, tx_data_len);
     if (p_lcb == NULL)
         return;
 
@@ -1260,16 +1260,16 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cble_set_fixed_channel_tx_data_length(BD_ADDR remote_bda, UINT16 fix_cid, UINT16 tx_mtu)
+void l2cble_set_fixed_channel_tx_data_length(BD_ADDR remote_bda, uint16_t fix_cid, uint16_t tx_mtu)
 {
     tL2C_LCB *p_lcb = l2cu_find_lcb_by_bd_addr(remote_bda, BT_TRANSPORT_LE);
-    UINT16 cid = fix_cid - L2CAP_FIRST_FIXED_CHNL;
+    uint16_t cid = fix_cid - L2CAP_FIRST_FIXED_CHNL;
 
-    L2CAP_TRACE_DEBUG("%s TX MTU = %d", __FUNCTION__, tx_mtu);
+    L2CAP_TRACE_DEBUG("%s TX MTU = %d", __func__, tx_mtu);
 
     if (!controller_get_interface()->supports_ble_packet_extension())
     {
-        L2CAP_TRACE_WARNING("%s, request not supported", __FUNCTION__);
+        L2CAP_TRACE_WARNING("%s, request not supported", __func__);
         return;
     }
 
@@ -1323,7 +1323,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cble_credit_based_conn_res (tL2C_CCB *p_ccb, UINT16 result)
+void l2cble_credit_based_conn_res (tL2C_CCB *p_ccb, uint16_t result)
 {
     if (!p_ccb)
         return;
@@ -1348,7 +1348,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cble_send_flow_control_credit(tL2C_CCB *p_ccb, UINT16 credit_value)
+void l2cble_send_flow_control_credit(tL2C_CCB *p_ccb, uint16_t credit_value)
 {
     if (!p_ccb)
         return;
@@ -1400,12 +1400,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-void  l2cble_sec_comp(BD_ADDR p_bda, tBT_TRANSPORT transport, void *p_ref_data, UINT8 status)
+void  l2cble_sec_comp(BD_ADDR p_bda, tBT_TRANSPORT transport, void *p_ref_data, uint8_t status)
 {
     tL2C_LCB *p_lcb = l2cu_find_lcb_by_bd_addr(p_bda, BT_TRANSPORT_LE);
     tL2CAP_SEC_DATA *p_buf = NULL;
-    UINT8 sec_flag;
-    UINT8 sec_act;
+    uint8_t sec_flag;
+    uint8_t sec_act;
 
     if (!p_lcb)
     {
@@ -1481,20 +1481,20 @@
 ** Description      This function is called by LE COC link to meet the
 **                  security requirement for the link
 **
-** Returns          TRUE - security procedures are started
-**                  FALSE - failure
+** Returns          true - security procedures are started
+**                  false - failure
 **
 *******************************************************************************/
-BOOLEAN l2ble_sec_access_req(BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_originator, tL2CAP_SEC_CBACK *p_callback, void *p_ref_data)
+bool    l2ble_sec_access_req(BD_ADDR bd_addr, uint16_t psm, bool    is_originator, tL2CAP_SEC_CBACK *p_callback, void *p_ref_data)
 {
     L2CAP_TRACE_DEBUG ("%s", __func__);
-    BOOLEAN status;
+    bool    status;
     tL2C_LCB *p_lcb = NULL;
 
     if (!p_callback)
     {
         L2CAP_TRACE_ERROR("%s No callback function", __func__);
-        return FALSE;
+        return false;
     }
 
     p_lcb = l2cu_find_lcb_by_bd_addr(bd_addr, BT_TRANSPORT_LE);
@@ -1503,14 +1503,14 @@
     {
         L2CAP_TRACE_ERROR ("%s Security check for unknown device", __func__);
         p_callback(bd_addr, BT_TRANSPORT_LE, p_ref_data, BTM_UNKNOWN_ADDR);
-        return FALSE;
+        return false;
     }
 
-    tL2CAP_SEC_DATA *p_buf = (tL2CAP_SEC_DATA*) osi_malloc((UINT16)sizeof(tL2CAP_SEC_DATA));
+    tL2CAP_SEC_DATA *p_buf = (tL2CAP_SEC_DATA*) osi_malloc((uint16_t)sizeof(tL2CAP_SEC_DATA));
     if (!p_buf)
     {
         p_callback(bd_addr, BT_TRANSPORT_LE, p_ref_data, BTM_NO_RESOURCES);
-        return FALSE;
+        return false;
     }
 
     p_buf->psm = psm;
diff --git a/stack/l2cap/l2c_csm.c b/stack/l2cap/l2c_csm.c
index 9eac5d5..ea53827 100644
--- a/stack/l2cap/l2c_csm.c
+++ b/stack/l2cap/l2c_csm.c
@@ -42,18 +42,18 @@
 /********************************************************************************/
 /*              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 event, void *p_data);
-static void l2c_csm_orig_w4_sec_comp (tL2C_CCB *p_ccb, UINT16 event, void *p_data);
-static void l2c_csm_term_w4_sec_comp (tL2C_CCB *p_ccb, UINT16 event, void *p_data);
-static void l2c_csm_w4_l2cap_connect_rsp (tL2C_CCB *p_ccb, UINT16 event, void *p_data);
-static void l2c_csm_w4_l2ca_connect_rsp (tL2C_CCB *p_ccb, UINT16 event, void *p_data);
-static void l2c_csm_config (tL2C_CCB *p_ccb, UINT16 event, void *p_data);
-static void l2c_csm_open (tL2C_CCB *p_ccb, UINT16 event, void *p_data);
-static void l2c_csm_w4_l2cap_disconnect_rsp (tL2C_CCB *p_ccb, UINT16 event, void *p_data);
-static void l2c_csm_w4_l2ca_disconnect_rsp (tL2C_CCB *p_ccb, UINT16 event, void *p_data);
+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);
+static void l2c_csm_term_w4_sec_comp (tL2C_CCB *p_ccb, uint16_t event, void *p_data);
+static void l2c_csm_w4_l2cap_connect_rsp (tL2C_CCB *p_ccb, uint16_t event, void *p_data);
+static void l2c_csm_w4_l2ca_connect_rsp (tL2C_CCB *p_ccb, uint16_t event, void *p_data);
+static void l2c_csm_config (tL2C_CCB *p_ccb, uint16_t event, void *p_data);
+static void l2c_csm_open (tL2C_CCB *p_ccb, uint16_t event, void *p_data);
+static void l2c_csm_w4_l2cap_disconnect_rsp (tL2C_CCB *p_ccb, uint16_t event, void *p_data);
+static void l2c_csm_w4_l2ca_disconnect_rsp (tL2C_CCB *p_ccb, uint16_t event, void *p_data);
 
 #if (BT_TRACE_VERBOSE == TRUE)
-static char *l2c_csm_get_event_name (UINT16 event);
+static char *l2c_csm_get_event_name (uint16_t event);
 #endif
 
 /*******************************************************************************
@@ -65,7 +65,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2c_csm_execute (tL2C_CCB *p_ccb, UINT16 event, void *p_data)
+void l2c_csm_execute (tL2C_CCB *p_ccb, uint16_t event, void *p_data)
 {
     if (!l2cu_is_ccb_active(p_ccb)) {
         L2CAP_TRACE_WARNING("%s CCB not in use, event (%d) cannot be processed", __func__, event);
@@ -127,10 +127,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void l2c_csm_closed (tL2C_CCB *p_ccb, UINT16 event, void *p_data)
+static void l2c_csm_closed (tL2C_CCB *p_ccb, uint16_t event, void *p_data)
 {
     tL2C_CONN_INFO          *p_ci = (tL2C_CONN_INFO *)p_data;
-    UINT16                  local_cid = p_ccb->local_cid;
+    uint16_t                local_cid = p_ccb->local_cid;
     tL2CA_DISCONNECT_IND_CB *disconnect_ind;
     tL2CA_CONNECT_CFM_CB    *connect_cfm;
 
@@ -170,21 +170,21 @@
     case L2CEVT_LP_DISCONNECT_IND:                  /* Link was disconnected */
         L2CAP_TRACE_API ("L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x%04x  No Conf Needed", p_ccb->local_cid);
         l2cu_release_ccb (p_ccb);
-        (*disconnect_ind)(local_cid, FALSE);
+        (*disconnect_ind)(local_cid, false);
         break;
 
     case L2CEVT_LP_CONNECT_CFM:                         /* Link came up         */
         if (p_ccb->p_lcb->transport == BT_TRANSPORT_LE)
         {
             p_ccb->chnl_state = CST_ORIG_W4_SEC_COMP;
-            l2ble_sec_access_req(p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, TRUE,
+            l2ble_sec_access_req(p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, true,
                     &l2c_link_sec_comp, p_ccb);
         }
         else
         {
             p_ccb->chnl_state = CST_ORIG_W4_SEC_COMP;
             btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm,
-                                      p_ccb->p_lcb->handle, TRUE, &l2c_link_sec_comp, p_ccb);
+                                      p_ccb->p_lcb->handle, true, &l2c_link_sec_comp, p_ccb);
         }
         break;
 
@@ -203,7 +203,7 @@
         if (p_ccb->p_lcb->transport == BT_TRANSPORT_LE)
         {
             p_ccb->chnl_state = CST_ORIG_W4_SEC_COMP;
-            l2ble_sec_access_req(p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, TRUE,
+            l2ble_sec_access_req(p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, true,
                     &l2c_link_sec_comp, p_ccb);
         }
         else
@@ -217,7 +217,7 @@
 Event uninit_use_in_call: Using uninitialized value "settings" (field "settings".timeout uninitialized) in call to function "BTM_SetPowerMode" [details]
 Event uninit_use_in_call: Using uninitialized value "settings.max" in call to function "BTM_SetPowerMode" [details]
 Event uninit_use_in_call: Using uninitialized value "settings.min" in call to function "BTM_SetPowerMode"
-// FALSE-POSITIVE error from Coverity test-tool. Please do NOT remove following comment.
+// false-POSITIVE error from Coverity test-tool. Please do NOT remove following comment.
 // coverity[uninit_use_in_call] False-positive: setting the mode to BTM_PM_MD_ACTIVE only uses settings.mode the other data members of tBTM_PM_PWR_MD are ignored
 */
                 BTM_SetPowerMode (BTM_PM_SET_ONLY_ID, p_ccb->p_lcb->remote_bd_addr, &settings);
@@ -225,7 +225,7 @@
 
             /* If sec access does not result in started SEC_COM or COMP_NEG are already processed */
             if (btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm,
-                                          p_ccb->p_lcb->handle, TRUE, &l2c_link_sec_comp, p_ccb) == BTM_CMD_STARTED)
+                                          p_ccb->p_lcb->handle, true, &l2c_link_sec_comp, p_ccb) == BTM_CMD_STARTED)
                 p_ccb->chnl_state = CST_ORIG_W4_SEC_COMP;
         }
         break;
@@ -266,7 +266,7 @@
         if (p_ccb->p_lcb->transport == BT_TRANSPORT_LE)
         {
             p_ccb->chnl_state = CST_TERM_W4_SEC_COMP;
-             l2ble_sec_access_req(p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, FALSE,
+             l2ble_sec_access_req(p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, false,
                     &l2c_link_sec_comp, p_ccb);
         }
         else
@@ -280,7 +280,7 @@
 Event uninit_use_in_call: Using uninitialized value "settings" (field "settings".timeout uninitialized) in call to function "BTM_SetPowerMode" [details]
 Event uninit_use_in_call: Using uninitialized value "settings.max" in call to function "BTM_SetPowerMode" [details]
 Event uninit_use_in_call: Using uninitialized value "settings.min" in call to function "BTM_SetPowerMode"
-// FALSE-POSITIVE error from Coverity test-tool. Please do NOT remove following comment.
+// false-POSITIVE error from Coverity test-tool. Please do NOT remove following comment.
 // coverity[uninit_use_in_call] False-positive: setting the mode to BTM_PM_MD_ACTIVE only uses settings.mode the other data members of tBTM_PM_PWR_MD are ignored
 */
                 BTM_SetPowerMode (BTM_PM_SET_ONLY_ID, p_ccb->p_lcb->remote_bd_addr, &settings);
@@ -288,7 +288,7 @@
 
             p_ccb->chnl_state = CST_TERM_W4_SEC_COMP;
             if (btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm,
-                                      p_ccb->p_lcb->handle, FALSE, &l2c_link_sec_comp, p_ccb) == BTM_CMD_STARTED)
+                                      p_ccb->p_lcb->handle, false, &l2c_link_sec_comp, p_ccb) == BTM_CMD_STARTED)
             {
                 /* started the security process, tell the peer to set a longer timer */
                 l2cu_send_peer_connect_rsp(p_ccb, L2CAP_CONN_PENDING, 0);
@@ -329,11 +329,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void l2c_csm_orig_w4_sec_comp (tL2C_CCB *p_ccb, UINT16 event, void *p_data)
+static void l2c_csm_orig_w4_sec_comp (tL2C_CCB *p_ccb, uint16_t event, void *p_data)
 {
     tL2CA_DISCONNECT_IND_CB *disconnect_ind = p_ccb->p_rcb->api.pL2CA_DisconnectInd_Cb;
     tL2CA_CONNECT_CFM_CB    *connect_cfm = p_ccb->p_rcb->api.pL2CA_ConnectCfm_Cb;
-    UINT16                  local_cid = p_ccb->local_cid;
+    uint16_t                local_cid = p_ccb->local_cid;
 
 #if (BT_TRACE_VERBOSE == TRUE)
     L2CAP_TRACE_EVENT ("L2CAP - LCID: 0x%04x  st: ORIG_W4_SEC_COMP  evt: %s", p_ccb->local_cid, l2c_csm_get_event_name (event));
@@ -358,20 +358,20 @@
     case L2CEVT_LP_DISCONNECT_IND:                   /* Link was disconnected */
         L2CAP_TRACE_API ("L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x%04x  No Conf Needed", p_ccb->local_cid);
         l2cu_release_ccb (p_ccb);
-        (*disconnect_ind)(local_cid, FALSE);
+        (*disconnect_ind)(local_cid, false);
         break;
 
     case L2CEVT_SEC_RE_SEND_CMD:                    /* BTM has enough info to proceed */
     case L2CEVT_LP_CONNECT_CFM:                     /* Link came up         */
         if (p_ccb->p_lcb->transport == BT_TRANSPORT_LE)
         {
-             l2ble_sec_access_req(p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, FALSE,
+             l2ble_sec_access_req(p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, false,
                     &l2c_link_sec_comp, p_ccb);
         }
         else
         {
             btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm,
-                                  p_ccb->p_lcb->handle, TRUE, &l2c_link_sec_comp, p_ccb);
+                                  p_ccb->p_lcb->handle, true, &l2c_link_sec_comp, p_ccb);
         }
         break;
 
@@ -447,7 +447,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void l2c_csm_term_w4_sec_comp (tL2C_CCB *p_ccb, UINT16 event, void *p_data)
+static void l2c_csm_term_w4_sec_comp (tL2C_CCB *p_ccb, uint16_t event, void *p_data)
 {
 #if (BT_TRACE_VERBOSE == TRUE)
     L2CAP_TRACE_EVENT ("L2CAP - LCID: 0x%04x  st: TERM_W4_SEC_COMP  evt: %s", p_ccb->local_cid, l2c_csm_get_event_name (event));
@@ -558,7 +558,7 @@
 
     case L2CEVT_SEC_RE_SEND_CMD:                    /* BTM has enough info to proceed */
         btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm,
-                                  p_ccb->p_lcb->handle, FALSE, &l2c_link_sec_comp, p_ccb);
+                                  p_ccb->p_lcb->handle, false, &l2c_link_sec_comp, p_ccb);
         break;
     }
 }
@@ -574,12 +574,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void l2c_csm_w4_l2cap_connect_rsp (tL2C_CCB *p_ccb, UINT16 event, void *p_data)
+static void l2c_csm_w4_l2cap_connect_rsp (tL2C_CCB *p_ccb, uint16_t event, void *p_data)
 {
     tL2C_CONN_INFO          *p_ci = (tL2C_CONN_INFO *)p_data;
     tL2CA_DISCONNECT_IND_CB *disconnect_ind = p_ccb->p_rcb->api.pL2CA_DisconnectInd_Cb;
     tL2CA_CONNECT_CFM_CB    *connect_cfm = p_ccb->p_rcb->api.pL2CA_ConnectCfm_Cb;
-    UINT16                  local_cid = p_ccb->local_cid;
+    uint16_t                local_cid = p_ccb->local_cid;
 
 #if (BT_TRACE_VERBOSE == TRUE)
     L2CAP_TRACE_EVENT ("L2CAP - LCID: 0x%04x  st: W4_L2CAP_CON_RSP  evt: %s", p_ccb->local_cid, l2c_csm_get_event_name (event));
@@ -591,14 +591,14 @@
     {
     case L2CEVT_LP_DISCONNECT_IND:                  /* Link was disconnected */
         /* Send disc indication unless peer to peer race condition AND normal disconnect */
-        /* *((UINT8 *)p_data) != HCI_ERR_PEER_USER happens when peer device try to disconnect for normal reason */
+        /* *((uint8_t *)p_data) != HCI_ERR_PEER_USER happens when peer device try to disconnect for normal reason */
         p_ccb->chnl_state = CST_CLOSED;
-        if ((p_ccb->flags & CCB_FLAG_NO_RETRY) || !p_data || (*((UINT8 *)p_data) != HCI_ERR_PEER_USER))
+        if ((p_ccb->flags & CCB_FLAG_NO_RETRY) || !p_data || (*((uint8_t *)p_data) != HCI_ERR_PEER_USER))
         {
             L2CAP_TRACE_API ("L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x%04x  No Conf Needed",
                               p_ccb->local_cid);
             l2cu_release_ccb (p_ccb);
-            (*disconnect_ind)(local_cid, FALSE);
+            (*disconnect_ind)(local_cid, false);
         }
         p_ccb->flags |= CCB_FLAG_NO_RETRY;
         break;
@@ -704,11 +704,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void l2c_csm_w4_l2ca_connect_rsp (tL2C_CCB *p_ccb, UINT16 event, void *p_data)
+static void l2c_csm_w4_l2ca_connect_rsp (tL2C_CCB *p_ccb, uint16_t event, void *p_data)
 {
     tL2C_CONN_INFO          *p_ci;
     tL2CA_DISCONNECT_IND_CB *disconnect_ind = p_ccb->p_rcb->api.pL2CA_DisconnectInd_Cb;
-    UINT16                  local_cid = p_ccb->local_cid;
+    uint16_t                local_cid = p_ccb->local_cid;
 
 #if (BT_TRACE_VERBOSE == TRUE)
     L2CAP_TRACE_EVENT ("L2CAP - LCID: 0x%04x  st: W4_L2CA_CON_RSP  evt: %s", p_ccb->local_cid, l2c_csm_get_event_name (event));
@@ -721,7 +721,7 @@
     case L2CEVT_LP_DISCONNECT_IND:                  /* Link was disconnected */
         L2CAP_TRACE_API ("L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x%04x  No Conf Needed", p_ccb->local_cid);
         l2cu_release_ccb (p_ccb);
-        (*disconnect_ind)(local_cid, FALSE);
+        (*disconnect_ind)(local_cid, false);
         break;
 
     case L2CEVT_L2CA_CONNECT_RSP:
@@ -778,7 +778,7 @@
         l2cu_send_peer_connect_rsp (p_ccb, L2CAP_CONN_NO_PSM, 0);
         L2CAP_TRACE_API ("L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x%04x  No Conf Needed", p_ccb->local_cid);
         l2cu_release_ccb (p_ccb);
-        (*disconnect_ind)(local_cid, FALSE);
+        (*disconnect_ind)(local_cid, false);
         break;
 
     case L2CEVT_L2CA_DATA_WRITE:                    /* Upper layer data to send */
@@ -822,12 +822,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void l2c_csm_config (tL2C_CCB *p_ccb, UINT16 event, void *p_data)
+static void l2c_csm_config (tL2C_CCB *p_ccb, uint16_t event, void *p_data)
 {
     tL2CAP_CFG_INFO         *p_cfg = (tL2CAP_CFG_INFO *)p_data;
     tL2CA_DISCONNECT_IND_CB *disconnect_ind = p_ccb->p_rcb->api.pL2CA_DisconnectInd_Cb;
-    UINT16                  local_cid = p_ccb->local_cid;
-    UINT8                   cfg_result;
+    uint16_t                local_cid = p_ccb->local_cid;
+    uint8_t                 cfg_result;
 
 #if (BT_TRACE_VERBOSE == TRUE)
     L2CAP_TRACE_EVENT ("L2CAP - LCID: 0x%04x  st: CONFIG  evt: %s", p_ccb->local_cid, l2c_csm_get_event_name (event));
@@ -840,7 +840,7 @@
     case L2CEVT_LP_DISCONNECT_IND:                  /* Link was disconnected */
         L2CAP_TRACE_API ("L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x%04x  No Conf Needed", p_ccb->local_cid);
         l2cu_release_ccb (p_ccb);
-        (*disconnect_ind)(local_cid, FALSE);
+        (*disconnect_ind)(local_cid, false);
         break;
 
     case L2CEVT_L2CAP_CONFIG_REQ:                  /* Peer config request   */
@@ -884,7 +884,7 @@
                     l2cu_send_peer_disc_req (p_ccb);
                     L2CAP_TRACE_WARNING ("L2CAP - Calling Disconnect_Ind_Cb(Incompatible CFG), CID: 0x%04x  No Conf Needed", p_ccb->local_cid);
                     l2cu_release_ccb (p_ccb);
-                    (*disconnect_ind)(local_cid, FALSE);
+                    (*disconnect_ind)(local_cid, false);
                     break;
                 }
 
@@ -927,7 +927,7 @@
          alarm_cancel(p_ccb->l2c_ccb_timer);
 
         /* If failure was channel mode try to renegotiate */
-        if (l2c_fcr_renegotiate_chan(p_ccb, p_cfg) == FALSE)
+        if (l2c_fcr_renegotiate_chan(p_ccb, p_cfg) == false)
         {
             L2CAP_TRACE_API ("L2CAP - Calling Config_Rsp_Cb(), CID: 0x%04x, Failure: %d", p_ccb->local_cid, p_cfg->result);
             (*p_ccb->p_rcb->api.pL2CA_ConfigCfm_Cb)(p_ccb->local_cid, p_cfg);
@@ -941,7 +941,7 @@
                            btu_general_alarm_queue);
         p_ccb->chnl_state = CST_W4_L2CA_DISCONNECT_RSP;
         L2CAP_TRACE_API ("L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x%04x  Conf Needed", p_ccb->local_cid);
-        (*p_ccb->p_rcb->api.pL2CA_DisconnectInd_Cb)(p_ccb->local_cid, TRUE);
+        (*p_ccb->p_rcb->api.pL2CA_DisconnectInd_Cb)(p_ccb->local_cid, true);
         break;
 
     case L2CEVT_L2CA_CONFIG_REQ:                   /* Upper layer config req   */
@@ -965,9 +965,9 @@
         }
 
         /* Local config done; clear cached configuration in case reconfig takes place later */
-        p_ccb->peer_cfg.mtu_present = FALSE;
-        p_ccb->peer_cfg.flush_to_present = FALSE;
-        p_ccb->peer_cfg.qos_present = FALSE;
+        p_ccb->peer_cfg.mtu_present = false;
+        p_ccb->peer_cfg.flush_to_present = false;
+        p_ccb->peer_cfg.qos_present = false;
 
         p_ccb->config_done |= IB_CFG_DONE;
 
@@ -979,7 +979,7 @@
                 l2cu_send_peer_disc_req (p_ccb);
                 L2CAP_TRACE_WARNING ("L2CAP - Calling Disconnect_Ind_Cb(Incompatible CFG), CID: 0x%04x  No Conf Needed", p_ccb->local_cid);
                 l2cu_release_ccb (p_ccb);
-                (*disconnect_ind)(local_cid, FALSE);
+                (*disconnect_ind)(local_cid, false);
                 break;
             }
 
@@ -1056,7 +1056,7 @@
         L2CAP_TRACE_API ("L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x%04x  No Conf Needed",
                 p_ccb->local_cid);
         l2cu_release_ccb (p_ccb);
-        (*disconnect_ind)(local_cid, FALSE);
+        (*disconnect_ind)(local_cid, false);
         break;
     }
 }
@@ -1072,14 +1072,14 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void l2c_csm_open (tL2C_CCB *p_ccb, UINT16 event, void *p_data)
+static void l2c_csm_open (tL2C_CCB *p_ccb, uint16_t event, void *p_data)
 {
-    UINT16                  local_cid = p_ccb->local_cid;
+    uint16_t                local_cid = p_ccb->local_cid;
     tL2CAP_CFG_INFO         *p_cfg;
     tL2C_CHNL_STATE         tempstate;
-    UINT8                   tempcfgdone;
-    UINT8                   cfg_result;
-    UINT16                  *credit;
+    uint8_t                 tempcfgdone;
+    uint8_t                 cfg_result;
+    uint16_t                *credit;
 
 #if (BT_TRACE_VERBOSE == TRUE)
     L2CAP_TRACE_EVENT ("L2CAP - LCID: 0x%04x  st: OPEN  evt: %s",
@@ -1107,7 +1107,7 @@
                 p_ccb->local_cid);
         l2cu_release_ccb (p_ccb);
         if (p_ccb->p_rcb)
-            (*p_ccb->p_rcb->api.pL2CA_DisconnectInd_Cb)(local_cid, FALSE);
+            (*p_ccb->p_rcb->api.pL2CA_DisconnectInd_Cb)(local_cid, false);
         break;
 
     case L2CEVT_LP_QOS_VIOLATION_IND:               /* QOS violation         */
@@ -1170,7 +1170,7 @@
                            l2c_ccb_timer_timeout, p_ccb,
                            btu_general_alarm_queue);
         L2CAP_TRACE_API ("L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x%04x  Conf Needed", p_ccb->local_cid);
-        (*p_ccb->p_rcb->api.pL2CA_DisconnectInd_Cb)(p_ccb->local_cid, TRUE);
+        (*p_ccb->p_rcb->api.pL2CA_DisconnectInd_Cb)(p_ccb->local_cid, true);
         break;
 
     case L2CEVT_L2CAP_DATA:                         /* Peer data packet rcvd    */
@@ -1230,12 +1230,12 @@
 
     case L2CEVT_L2CA_SEND_FLOW_CONTROL_CREDIT:
         L2CAP_TRACE_DEBUG("%s Sending credit",__func__);
-        credit = (UINT16*)p_data;
+        credit = (uint16_t*)p_data;
         l2cble_send_flow_control_credit(p_ccb, *credit);
         break;
 
     case L2CEVT_L2CAP_RECV_FLOW_CONTROL_CREDIT:
-        credit = (UINT16*)p_data;
+        credit = (uint16_t*)p_data;
         L2CAP_TRACE_DEBUG("%s Credits received %d",__func__, *credit);
         if((p_ccb->peer_conn_cfg.credits + *credit) > L2CAP_LE_MAX_CREDIT)
         {
@@ -1264,10 +1264,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void l2c_csm_w4_l2cap_disconnect_rsp (tL2C_CCB *p_ccb, UINT16 event, void *p_data)
+static void l2c_csm_w4_l2cap_disconnect_rsp (tL2C_CCB *p_ccb, uint16_t event, void *p_data)
 {
     tL2CA_DISCONNECT_CFM_CB *disconnect_cfm = p_ccb->p_rcb->api.pL2CA_DisconnectCfm_Cb;
-    UINT16                  local_cid = p_ccb->local_cid;
+    uint16_t                local_cid = p_ccb->local_cid;
 
 #if (BT_TRACE_VERBOSE == TRUE)
     L2CAP_TRACE_EVENT ("L2CAP - LCID: 0x%04x  st: W4_L2CAP_DISC_RSP  evt: %s", p_ccb->local_cid, l2c_csm_get_event_name (event));
@@ -1329,10 +1329,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void l2c_csm_w4_l2ca_disconnect_rsp (tL2C_CCB *p_ccb, UINT16 event, void *p_data)
+static void l2c_csm_w4_l2ca_disconnect_rsp (tL2C_CCB *p_ccb, uint16_t event, void *p_data)
 {
     tL2CA_DISCONNECT_IND_CB *disconnect_ind = p_ccb->p_rcb->api.pL2CA_DisconnectInd_Cb;
-    UINT16                  local_cid = p_ccb->local_cid;
+    uint16_t                local_cid = p_ccb->local_cid;
 
 #if (BT_TRACE_VERBOSE == TRUE)
     L2CAP_TRACE_EVENT ("L2CAP - LCID: 0x%04x  st: W4_L2CA_DISC_RSP  evt: %s", p_ccb->local_cid, l2c_csm_get_event_name (event));
@@ -1345,14 +1345,14 @@
     case L2CEVT_LP_DISCONNECT_IND:                  /* Link was disconnected */
         L2CAP_TRACE_API ("L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x%04x  No Conf Needed", p_ccb->local_cid);
         l2cu_release_ccb (p_ccb);
-        (*disconnect_ind)(local_cid, FALSE);
+        (*disconnect_ind)(local_cid, false);
         break;
 
     case L2CEVT_TIMEOUT:
         l2cu_send_peer_disc_rsp (p_ccb->p_lcb, p_ccb->remote_id, p_ccb->local_cid, p_ccb->remote_cid);
         L2CAP_TRACE_API ("L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x%04x  No Conf Needed", p_ccb->local_cid);
         l2cu_release_ccb (p_ccb);
-        (*disconnect_ind)(local_cid, FALSE);
+        (*disconnect_ind)(local_cid, false);
         break;
 
     case L2CEVT_L2CA_DISCONNECT_REQ:                /* Upper disconnect request */
@@ -1381,7 +1381,7 @@
 ** Returns          pointer to the name
 **
 *******************************************************************************/
-static char *l2c_csm_get_event_name (UINT16 event)
+static char *l2c_csm_get_event_name (uint16_t event)
 {
     switch (event)
     {
@@ -1478,7 +1478,7 @@
 *******************************************************************************/
 void l2c_enqueue_peer_data (tL2C_CCB *p_ccb, BT_HDR *p_buf)
 {
-    UINT8       *p;
+    uint8_t     *p;
 
     if (p_ccb->peer_cfg.fcr.mode != L2CAP_FCR_BASIC_MODE)
     {
@@ -1494,7 +1494,7 @@
         p_buf->len    += L2CAP_PKT_OVERHEAD;
 
         /* Set the pointer to the beginning of the data */
-        p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+        p = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
         /* Now the L2CAP header */
         UINT16_TO_STREAM (p, p_buf->len - L2CAP_PKT_OVERHEAD);
@@ -1522,7 +1522,7 @@
 
     /* if we are doing a round robin scheduling, set the flag */
     if (p_ccb->p_lcb->link_xmit_quota == 0)
-        l2cb.check_round_robin = TRUE;
+        l2cb.check_round_robin = true;
 }
 
 
diff --git a/stack/l2cap/l2c_fcr.c b/stack/l2cap/l2c_fcr.c
index 5ba8b56..6cb0bd0 100644
--- a/stack/l2cap/l2c_fcr.c
+++ b/stack/l2cap/l2c_fcr.c
@@ -47,7 +47,7 @@
 /* this is the minimal offset required by OBX to process incoming packets */
 static const uint16_t OBX_BUF_MIN_OFFSET = 4;
 
-#if BT_TRACE_VERBOSE == TRUE
+#if (BT_TRACE_VERBOSE == TRUE)
 static char *SAR_types[] = { "Unsegmented", "Start", "End", "Continuation" };
 static char *SUP_types[] = { "RR", "REJ", "RNR", "SREJ" };
 #endif
@@ -92,16 +92,16 @@
 /*******************************************************************************
 **  Static local functions
 */
-static BOOLEAN process_reqseq (tL2C_CCB *p_ccb, UINT16 ctrl_word);
-static void    process_s_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word);
-static void    process_i_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word, BOOLEAN delay_ack);
-static BOOLEAN retransmit_i_frames (tL2C_CCB *p_ccb, UINT8 tx_seq);
-static void    prepare_I_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, BOOLEAN is_retransmission);
+static bool    process_reqseq (tL2C_CCB *p_ccb, uint16_t ctrl_word);
+static void    process_s_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, uint16_t ctrl_word);
+static void    process_i_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, uint16_t ctrl_word, bool    delay_ack);
+static bool    retransmit_i_frames (tL2C_CCB *p_ccb, uint8_t tx_seq);
+static void    prepare_I_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, bool    is_retransmission);
 static void    process_stream_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf);
-static BOOLEAN do_sar_reassembly (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word);
+static bool    do_sar_reassembly (tL2C_CCB *p_ccb, BT_HDR *p_buf, uint16_t ctrl_word);
 
 #if (L2CAP_ERTM_STATS == TRUE)
-static void l2c_fcr_collect_ack_delay (tL2C_CCB *p_ccb, UINT8 num_bufs_acked);
+static void l2c_fcr_collect_ack_delay (tL2C_CCB *p_ccb, uint8_t num_bufs_acked);
 #endif
 
 /*******************************************************************************
@@ -137,9 +137,9 @@
 ** Returns          CRC
 **
 *******************************************************************************/
-static UINT16 l2c_fcr_tx_get_fcs (BT_HDR *p_buf)
+static uint16_t l2c_fcr_tx_get_fcs (BT_HDR *p_buf)
 {
-    UINT8   *p = ((UINT8 *) (p_buf + 1)) + p_buf->offset;
+    uint8_t *p = ((uint8_t *) (p_buf + 1)) + p_buf->offset;
 
     return (l2c_fcr_updcrc (L2CAP_FCR_INIT_CRC, p, p_buf->len));
 }
@@ -153,9 +153,9 @@
 ** Returns          CRC
 **
 *******************************************************************************/
-static UINT16 l2c_fcr_rx_get_fcs (BT_HDR *p_buf)
+static uint16_t l2c_fcr_rx_get_fcs (BT_HDR *p_buf)
 {
-    UINT8   *p = ((UINT8 *) (p_buf + 1)) + p_buf->offset;
+    uint8_t *p = ((uint8_t *) (p_buf + 1)) + p_buf->offset;
 
     /* offset points past the L2CAP header, but the CRC check includes it */
     p -= L2CAP_PKT_OVERHEAD;
@@ -175,16 +175,16 @@
 void l2c_fcr_start_timer (tL2C_CCB *p_ccb)
 {
     assert(p_ccb != NULL);
-    UINT32  tout;
+    uint32_t tout;
 
     /* The timers which are in milliseconds */
     if (p_ccb->fcrb.wait_ack)
     {
-        tout = (UINT32)p_ccb->our_cfg.fcr.mon_tout;
+        tout = (uint32_t)p_ccb->our_cfg.fcr.mon_tout;
     }
     else
     {
-        tout = (UINT32)p_ccb->our_cfg.fcr.rtrans_tout;
+        tout = (uint32_t)p_ccb->our_cfg.fcr.rtrans_tout;
     }
 
     /* Only start a timer that was not started */
@@ -243,10 +243,10 @@
 #if (L2CAP_ERTM_STATS == TRUE)
     if ( (p_ccb->local_cid >= L2CAP_BASE_APPL_CID) && (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) )
     {
-        UINT32  dur = time_get_os_boottime_ms() - p_ccb->fcrb.connect_tick_count;
+        uint32_t dur = time_get_os_boottime_ms() - p_ccb->fcrb.connect_tick_count;
         char    *p_str = (char *)osi_malloc(120);
-        UINT16  i;
-        UINT32  throughput_avg, ack_delay_avg, ack_q_count_avg;
+        uint16_t i;
+        uint32_t throughput_avg, ack_delay_avg, ack_q_count_avg;
 
         BT_TRACE(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI , TRACE_TYPE_GENERIC,
                    "---  L2CAP ERTM  Stats for CID: 0x%04x   Duration: %08ums", p_ccb->local_cid, dur);
@@ -323,7 +323,7 @@
 ** Returns          pointer to new buffer
 **
 *******************************************************************************/
-BT_HDR *l2c_fcr_clone_buf(BT_HDR *p_buf, UINT16 new_offset, UINT16 no_of_bytes)
+BT_HDR *l2c_fcr_clone_buf(BT_HDR *p_buf, uint16_t new_offset, uint16_t no_of_bytes)
 {
     assert(p_buf != NULL);
     /*
@@ -342,8 +342,8 @@
 
     p_buf2->offset = new_offset;
     p_buf2->len = no_of_bytes;
-    memcpy(((UINT8 *)(p_buf2 + 1)) + p_buf2->offset,
-           ((UINT8 *)(p_buf + 1))  + p_buf->offset,
+    memcpy(((uint8_t *)(p_buf2 + 1)) + p_buf2->offset,
+           ((uint8_t *)(p_buf + 1))  + p_buf->offset,
            no_of_bytes);
 
     return (p_buf2);
@@ -358,13 +358,13 @@
 ** Returns          The control word
 **
 *******************************************************************************/
-BOOLEAN l2c_fcr_is_flow_controlled (tL2C_CCB *p_ccb)
+bool    l2c_fcr_is_flow_controlled (tL2C_CCB *p_ccb)
 {
     assert(p_ccb != NULL);
     if (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE)
     {
         /* Check if remote side flowed us off or the transmit window is full */
-        if ( (p_ccb->fcrb.remote_busy == TRUE)
+        if ( (p_ccb->fcrb.remote_busy == true)
          ||  (fixed_queue_length(p_ccb->fcrb.waiting_for_ack_q) >= p_ccb->peer_cfg.fcr.tx_win_sz) )
         {
 #if (L2CAP_ERTM_STATS == TRUE)
@@ -376,10 +376,10 @@
                     p_ccb->fcrb.controller_idle++;
             }
 #endif
-            return (TRUE);
+            return (true);
         }
     }
-    return (FALSE);
+    return (false);
 }
 
 /*******************************************************************************
@@ -393,22 +393,22 @@
 ** Returns          -
 **
 *******************************************************************************/
-static void prepare_I_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, BOOLEAN is_retransmission)
+static void prepare_I_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, bool    is_retransmission)
 {
     assert(p_ccb != NULL);
     assert(p_buf != NULL);
     tL2C_FCRB   *p_fcrb = &p_ccb->fcrb;
-    UINT8       *p;
-    UINT16      fcs;
-    UINT16      ctrl_word;
-    BOOLEAN     set_f_bit = p_fcrb->send_f_rsp;
+    uint8_t     *p;
+    uint16_t    fcs;
+    uint16_t    ctrl_word;
+    bool        set_f_bit = p_fcrb->send_f_rsp;
 
-    p_fcrb->send_f_rsp = FALSE;
+    p_fcrb->send_f_rsp = false;
 
     if (is_retransmission)
     {
         /* Get the old control word and clear out the old req_seq and F bits */
-        p = ((UINT8 *) (p_buf+1)) + p_buf->offset + L2CAP_PKT_OVERHEAD;
+        p = ((uint8_t *) (p_buf+1)) + p_buf->offset + L2CAP_PKT_OVERHEAD;
 
         STREAM_TO_UINT16 (ctrl_word, p);
 
@@ -436,7 +436,7 @@
     }
 
     /* Set the control word */
-    p = ((UINT8 *) (p_buf+1)) + p_buf->offset + L2CAP_PKT_OVERHEAD;
+    p = ((uint8_t *) (p_buf+1)) + p_buf->offset + L2CAP_PKT_OVERHEAD;
 
     UINT16_TO_STREAM (p, ctrl_word);
 
@@ -444,7 +444,7 @@
     if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS)
     {
         /* length field in l2cap header has to include FCS length */
-        p = ((UINT8 *) (p_buf+1)) + p_buf->offset;
+        p = ((uint8_t *) (p_buf+1)) + p_buf->offset;
         UINT16_TO_STREAM (p, p_buf->len + L2CAP_FCS_LEN - L2CAP_PKT_OVERHEAD);
 
         /* Calculate the FCS */
@@ -455,14 +455,14 @@
          * NOTE: Here we assume the allocated buffer is large enough
          * to include extra L2CAP_FCS_LEN octets at the end.
          */
-        p = ((UINT8 *) (p_buf+1)) + p_buf->offset + p_buf->len;
+        p = ((uint8_t *) (p_buf+1)) + p_buf->offset + p_buf->len;
 
         UINT16_TO_STREAM (p, fcs);
 
         p_buf->len += L2CAP_FCS_LEN;
     }
 
-#if BT_TRACE_VERBOSE == TRUE
+#if (BT_TRACE_VERBOSE == TRUE)
     if (is_retransmission)
     {
         L2CAP_TRACE_EVENT ("L2CAP eRTM ReTx I-frame  CID: 0x%04x  Len: %u  SAR: %s  TxSeq: %u  ReqSeq: %u  F: %u",
@@ -497,12 +497,12 @@
 ** Returns          -
 **
 *******************************************************************************/
-void l2c_fcr_send_S_frame (tL2C_CCB *p_ccb, UINT16 function_code, UINT16 pf_bit)
+void l2c_fcr_send_S_frame (tL2C_CCB *p_ccb, uint16_t function_code, uint16_t pf_bit)
 {
     assert(p_ccb != NULL);
-    UINT8       *p;
-    UINT16      ctrl_word;
-    UINT16      fcs;
+    uint8_t     *p;
+    uint16_t    ctrl_word;
+    uint16_t    fcs;
 
     if ((!p_ccb->in_use) || (p_ccb->chnl_state != CST_OPEN))
         return;
@@ -513,7 +513,7 @@
 
     if (pf_bit == L2CAP_FCR_P_BIT)
     {
-        p_ccb->fcrb.wait_ack = TRUE;
+        p_ccb->fcrb.wait_ack = true;
 
         l2c_fcr_stop_timer (p_ccb);         /* Restart the monitor timer */
         l2c_fcr_start_timer (p_ccb);
@@ -529,7 +529,7 @@
     p_buf->len    = L2CAP_PKT_OVERHEAD + L2CAP_FCR_OVERHEAD;
 
     /* Set the pointer to the beginning of the data */
-    p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     /* Put in the L2CAP header */
     UINT16_TO_STREAM(p, L2CAP_FCR_OVERHEAD + L2CAP_FCS_LEN);
@@ -552,7 +552,7 @@
     p_buf->layer_specific = L2CAP_NON_FLUSHABLE_PKT;
     l2cu_set_acl_hci_header (p_buf, p_ccb);
 
-#if BT_TRACE_VERBOSE == TRUE
+#if (BT_TRACE_VERBOSE == TRUE)
     if ((((ctrl_word & L2CAP_FCR_SUP_BITS) >> L2CAP_FCR_SUP_SHIFT) == 1)
         || (((ctrl_word & L2CAP_FCR_SUP_BITS) >> L2CAP_FCR_SUP_SHIFT) == 3)) {
         L2CAP_TRACE_WARNING("L2CAP eRTM Tx S-frame  CID: 0x%04x  ctrlword: 0x%04x  Type: %s  ReqSeq: %u  P: %u  F: %u",
@@ -595,14 +595,14 @@
 {
     assert(p_ccb != NULL);
     assert(p_buf != NULL);
-    UINT8       *p;
-    UINT16      fcs;
-    UINT16      min_pdu_len;
-    UINT16      ctrl_word;
+    uint8_t     *p;
+    uint16_t    fcs;
+    uint16_t    min_pdu_len;
+    uint16_t    ctrl_word;
 
     /* Check the length */
     min_pdu_len = (p_ccb->bypass_fcs == L2CAP_BYPASS_FCS) ?
-                  (UINT16)L2CAP_FCR_OVERHEAD : (UINT16)(L2CAP_FCS_LEN + L2CAP_FCR_OVERHEAD);
+                  (uint16_t)L2CAP_FCR_OVERHEAD : (uint16_t)(L2CAP_FCS_LEN + L2CAP_FCR_OVERHEAD);
 
     if (p_buf->len < min_pdu_len)
     {
@@ -617,9 +617,9 @@
         return;
     }
 
-#if BT_TRACE_VERBOSE == TRUE
+#if (BT_TRACE_VERBOSE == TRUE)
     /* Get the control word */
-    p = ((UINT8 *)(p_buf+1)) + p_buf->offset;
+    p = ((uint8_t *)(p_buf+1)) + p_buf->offset;
     STREAM_TO_UINT16 (ctrl_word, p);
 
     if (ctrl_word & L2CAP_FCR_S_FRAME_BIT)
@@ -667,7 +667,7 @@
     /* Verify FCS if using */
     if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS)
     {
-        p = ((UINT8 *)(p_buf+1)) + p_buf->offset + p_buf->len - L2CAP_FCS_LEN;
+        p = ((uint8_t *)(p_buf+1)) + p_buf->offset + p_buf->len - L2CAP_FCS_LEN;
 
         /* Extract and drop the FCS from the packet */
         STREAM_TO_UINT16 (fcs, p);
@@ -682,7 +682,7 @@
     }
 
     /* Get the control word */
-    p = ((UINT8 *)(p_buf+1)) + p_buf->offset;
+    p = ((uint8_t *)(p_buf+1)) + p_buf->offset;
 
     STREAM_TO_UINT16 (ctrl_word, p);
 
@@ -717,7 +717,7 @@
             return;
         }
 
-        p_ccb->fcrb.wait_ack  = FALSE;
+        p_ccb->fcrb.wait_ack  = false;
 
         /* P and F are mutually exclusive */
         if (ctrl_word & L2CAP_FCR_S_FRAME_BIT)
@@ -745,7 +745,7 @@
     if (ctrl_word & L2CAP_FCR_S_FRAME_BIT)
         process_s_frame (p_ccb, p_buf, ctrl_word);
     else
-        process_i_frame (p_ccb, p_buf, ctrl_word, FALSE);
+        process_i_frame (p_ccb, p_buf, ctrl_word, false);
 
     /* Return if the channel got disconnected by a bad packet or max retransmissions */
     if ( (!p_ccb->in_use) || (p_ccb->chnl_state != CST_OPEN) )
@@ -763,7 +763,7 @@
             if (p_ccb->in_use && (p_ccb->chnl_state == CST_OPEN))
             {
                 /* Get the control word */
-                p = ((UINT8 *)(p_buf+1)) + p_buf->offset - L2CAP_FCR_OVERHEAD;
+                p = ((uint8_t *)(p_buf+1)) + p_buf->offset - L2CAP_FCR_OVERHEAD;
 
                 STREAM_TO_UINT16 (ctrl_word, p);
 
@@ -772,7 +772,7 @@
                                     p_ccb->fcrb.next_seq_expected);
 
                 /* Process the SREJ held I-frame, but do not send an RR for each individual frame */
-                process_i_frame (p_ccb, p_buf, ctrl_word, TRUE);
+                process_i_frame (p_ccb, p_buf, ctrl_word, true);
             }
             else
                 osi_free(p_buf);
@@ -780,8 +780,8 @@
             /* If more frames were lost during SREJ, send a REJ */
             if (p_ccb->fcrb.rej_after_srej)
             {
-                p_ccb->fcrb.rej_after_srej = FALSE;
-                p_ccb->fcrb.rej_sent       = TRUE;
+                p_ccb->fcrb.rej_after_srej = false;
+                p_ccb->fcrb.rej_sent       = true;
 
                 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_REJ, 0);
             }
@@ -803,8 +803,8 @@
     /* If a window has opened, check if we can send any more packets */
     if ( (!fixed_queue_is_empty(p_ccb->fcrb.retrans_q) ||
           !fixed_queue_is_empty(p_ccb->xmit_hold_q))
-      && (p_ccb->fcrb.wait_ack == FALSE)
-      && (l2c_fcr_is_flow_controlled (p_ccb) == FALSE) )
+      && (p_ccb->fcrb.wait_ack == false)
+      && (l2c_fcr_is_flow_controlled (p_ccb) == false) )
     {
         l2c_link_check_send_pkts (p_ccb->p_lcb, NULL, NULL);
     }
@@ -825,8 +825,8 @@
 
     assert(p_ccb != NULL);
     assert(p_buf != NULL);
-    UINT8  *p = (UINT8*)(p_buf + 1) + p_buf->offset;
-    UINT16 sdu_length;
+    uint8_t *p = (uint8_t*)(p_buf + 1) + p_buf->offset;
+    uint16_t sdu_length;
     BT_HDR *p_data = NULL;
 
     /* Buffer length should not exceed local mps */
@@ -867,19 +867,19 @@
     else
         p_data = p_ccb->ble_sdu;
 
-    memcpy((UINT8*)(p_data + 1) + p_data->offset + p_data->len, (UINT8*)(p_buf + 1) + p_buf->offset, p_buf->len);
+    memcpy((uint8_t*)(p_data + 1) + p_data->offset + p_data->len, (uint8_t*)(p_buf + 1) + p_buf->offset, p_buf->len);
     p_data->len += p_buf->len;
-    p = (UINT8*)(p_data+1) + p_data->offset;
+    p = (uint8_t*)(p_data+1) + p_data->offset;
     if (p_data->len == p_ccb->ble_sdu_length)
     {
         l2c_csm_execute (p_ccb, L2CEVT_L2CAP_DATA, p_data);
-        p_ccb->is_first_seg = TRUE;
+        p_ccb->is_first_seg = true;
         p_ccb->ble_sdu = NULL;
         p_ccb->ble_sdu_length = 0;
     }
     else if (p_data->len < p_ccb->ble_sdu_length)
     {
-        p_ccb->is_first_seg = FALSE;
+        p_ccb->is_first_seg = false;
     }
     else
     {
@@ -968,13 +968,13 @@
 ** Returns          -
 **
 *******************************************************************************/
-static BOOLEAN process_reqseq (tL2C_CCB *p_ccb, UINT16 ctrl_word)
+static bool    process_reqseq (tL2C_CCB *p_ccb, uint16_t ctrl_word)
 {
     assert(p_ccb != NULL);
     tL2C_FCRB   *p_fcrb = &p_ccb->fcrb;
-    UINT8       req_seq, num_bufs_acked, xx;
-    UINT16      ls;
-    UINT16      full_sdus_xmitted;
+    uint8_t     req_seq, num_bufs_acked, xx;
+    uint16_t    ls;
+    uint16_t    full_sdus_xmitted;
 
     /* Receive sequence number does not ack anything for SREJ with P-bit set to zero */
     if ( (ctrl_word & L2CAP_FCR_S_FRAME_BIT)
@@ -985,7 +985,7 @@
         if (!fixed_queue_is_empty(p_fcrb->waiting_for_ack_q))
             l2c_fcr_start_timer(p_ccb);
 
-        return (TRUE);
+        return (true);
     }
 
     /* Extract the receive sequence number from the control word */
@@ -1002,7 +1002,7 @@
                              fixed_queue_length(p_fcrb->waiting_for_ack_q));
 
         l2cu_disconnect_chnl (p_ccb);
-        return (FALSE);
+        return (false);
     }
 
     p_fcrb->last_rx_ack = req_seq;
@@ -1048,7 +1048,7 @@
     /* If anything still waiting for ack, restart the timer if it was stopped */
     if (!fixed_queue_is_empty(p_fcrb->waiting_for_ack_q))
         l2c_fcr_start_timer(p_ccb);
-    return (TRUE);
+    return (true);
 }
 
 
@@ -1061,15 +1061,15 @@
 ** Returns          -
 **
 *******************************************************************************/
-static void process_s_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word)
+static void process_s_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, uint16_t ctrl_word)
 {
     assert(p_ccb != NULL);
     assert(p_buf != NULL);
 
     tL2C_FCRB   *p_fcrb      = &p_ccb->fcrb;
-    UINT16      s_frame_type = (ctrl_word & L2CAP_FCR_SUP_BITS) >> L2CAP_FCR_SUP_SHIFT;
-    BOOLEAN     remote_was_busy;
-    BOOLEAN     all_ok = TRUE;
+    uint16_t    s_frame_type = (ctrl_word & L2CAP_FCR_SUP_BITS) >> L2CAP_FCR_SUP_SHIFT;
+    bool        remote_was_busy;
+    bool        all_ok = true;
 
     if (p_buf->len != 0)
     {
@@ -1084,33 +1084,33 @@
 
     if (ctrl_word & L2CAP_FCR_P_BIT)
     {
-        p_fcrb->rej_sent   = FALSE;             /* After checkpoint, we can send anoher REJ */
-        p_fcrb->send_f_rsp = TRUE;              /* Set a flag in case an I-frame is pending */
+        p_fcrb->rej_sent   = false;             /* After checkpoint, we can send anoher REJ */
+        p_fcrb->send_f_rsp = true;              /* Set a flag in case an I-frame is pending */
     }
 
     switch (s_frame_type)
     {
     case L2CAP_FCR_SUP_RR:
         remote_was_busy     = p_fcrb->remote_busy;
-        p_fcrb->remote_busy = FALSE;
+        p_fcrb->remote_busy = false;
 
         if ( (ctrl_word & L2CAP_FCR_F_BIT) || (remote_was_busy) )
             all_ok = retransmit_i_frames (p_ccb, L2C_FCR_RETX_ALL_PKTS);
         break;
 
     case L2CAP_FCR_SUP_REJ:
-        p_fcrb->remote_busy = FALSE;
+        p_fcrb->remote_busy = false;
         all_ok = retransmit_i_frames (p_ccb, L2C_FCR_RETX_ALL_PKTS);
         break;
 
     case L2CAP_FCR_SUP_RNR:
-        p_fcrb->remote_busy = TRUE;
+        p_fcrb->remote_busy = true;
         l2c_fcr_stop_timer (p_ccb);
         break;
 
     case L2CAP_FCR_SUP_SREJ:
-        p_fcrb->remote_busy = FALSE;
-        all_ok = retransmit_i_frames (p_ccb, (UINT8)((ctrl_word & L2CAP_FCR_REQ_SEQ_BITS) >> L2CAP_FCR_REQ_SEQ_BITS_SHIFT));
+        p_fcrb->remote_busy = false;
+        all_ok = retransmit_i_frames (p_ccb, (uint8_t)((ctrl_word & L2CAP_FCR_REQ_SEQ_BITS) >> L2CAP_FCR_REQ_SEQ_BITS_SHIFT));
         break;
     }
 
@@ -1126,7 +1126,7 @@
             else
                 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RR, L2CAP_FCR_F_BIT);
 
-            p_fcrb->send_f_rsp = FALSE;
+            p_fcrb->send_f_rsp = false;
         }
     }
     else
@@ -1147,13 +1147,13 @@
 ** Returns          -
 **
 *******************************************************************************/
-static void process_i_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word, BOOLEAN delay_ack)
+static void process_i_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, uint16_t ctrl_word, bool    delay_ack)
 {
     assert(p_ccb != NULL);
     assert(p_buf != NULL);
 
     tL2C_FCRB   *p_fcrb = &p_ccb->fcrb;
-    UINT8       tx_seq, num_lost, num_to_ack, next_srej;
+    uint8_t     tx_seq, num_lost, num_to_ack, next_srej;
 
     /* If we were doing checkpoint recovery, first retransmit all unacked I-frames */
     if (ctrl_word & L2CAP_FCR_F_BIT)
@@ -1237,7 +1237,7 @@
                     L2CAP_TRACE_WARNING ("process_i_frame() CID: 0x%04x  frame dropped in Srej Sent next_srej:%u  hold_q.count:%u  win_sz:%u",
                                          p_ccb->local_cid, next_srej, fixed_queue_length(p_fcrb->srej_rcv_hold_q), p_ccb->our_cfg.fcr.tx_win_sz);
 
-                    p_fcrb->rej_after_srej = TRUE;
+                    p_fcrb->rej_after_srej = true;
                     osi_free(p_buf);
                 }
             }
@@ -1258,7 +1258,7 @@
                 if (num_lost > 1)
                 {
                     osi_free(p_buf);
-                    p_fcrb->rej_sent = TRUE;
+                    p_fcrb->rej_sent = true;
                     l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_REJ, 0);
                 }
                 else
@@ -1270,7 +1270,7 @@
                     }
                     p_buf->layer_specific = tx_seq;
                     fixed_queue_enqueue(p_fcrb->srej_rcv_hold_q, p_buf);
-                    p_fcrb->srej_sent = TRUE;
+                    p_fcrb->srej_sent = true;
                     l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_SREJ, 0);
                 }
                 alarm_cancel(p_ccb->fcrb.ack_timer);
@@ -1280,7 +1280,7 @@
     }
 
     /* Seq number is the next expected. Clear possible reject exception in case it occured */
-    p_fcrb->rej_sent = p_fcrb->srej_sent = FALSE;
+    p_fcrb->rej_sent = p_fcrb->srej_sent = false;
 
     /* Adjust the next_seq, so that if the upper layer sends more data in the callback
        context, the received frame is acked by an I-frame. */
@@ -1298,7 +1298,7 @@
     num_to_ack = (p_fcrb->next_seq_expected - p_fcrb->last_ack_sent) & L2CAP_FCR_SEQ_MODULO;
 
     if ( (num_to_ack < p_ccb->fcrb.max_held_acks) && (!p_fcrb->local_busy) )
-        delay_ack = TRUE;
+        delay_ack = true;
 
     /* We should neve never ack frame if we are not in OPEN state */
     if ((num_to_ack != 0) && p_ccb->in_use && (p_ccb->chnl_state == CST_OPEN))
@@ -1341,15 +1341,15 @@
     assert(p_ccb != NULL);
     assert(p_buf != NULL);
 
-    UINT16      ctrl_word;
-    UINT16      fcs;
-    UINT8       *p;
-    UINT8       tx_seq;
+    uint16_t    ctrl_word;
+    uint16_t    fcs;
+    uint8_t     *p;
+    uint8_t     tx_seq;
 
     /* Verify FCS if using */
     if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS)
     {
-        p = ((UINT8 *)(p_buf+1)) + p_buf->offset + p_buf->len - L2CAP_FCS_LEN;
+        p = ((uint8_t *)(p_buf+1)) + p_buf->offset + p_buf->len - L2CAP_FCS_LEN;
 
         /* Extract and drop the FCS from the packet */
         STREAM_TO_UINT16 (fcs, p);
@@ -1364,7 +1364,7 @@
     }
 
     /* Get the control word */
-    p = ((UINT8 *)(p_buf+1)) + p_buf->offset;
+    p = ((uint8_t *)(p_buf+1)) + p_buf->offset;
 
     STREAM_TO_UINT16 (ctrl_word, p);
 
@@ -1379,7 +1379,7 @@
         return;
     }
 
-#if BT_TRACE_VERBOSE == TRUE
+#if (BT_TRACE_VERBOSE == TRUE)
     L2CAP_TRACE_EVENT ("L2CAP eRTM Rx I-frame: cid: 0x%04x  Len: %u  SAR: %-12s  TxSeq: %u  ReqSeq: %u  F: %u",
                         p_ccb->local_cid, p_buf->len,
                         SAR_types[(ctrl_word & L2CAP_FCR_SAR_BITS) >> L2CAP_FCR_SAR_BITS_SHIFT],
@@ -1417,18 +1417,18 @@
 **
 ** Description      Process SAR bits and re-assemble frame
 **
-** Returns          TRUE if all OK, else FALSE
+** Returns          true if all OK, else false
 **
 *******************************************************************************/
-static BOOLEAN do_sar_reassembly (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word)
+static bool    do_sar_reassembly (tL2C_CCB *p_ccb, BT_HDR *p_buf, uint16_t ctrl_word)
 {
     assert(p_ccb != NULL);
     assert(p_buf != NULL);
 
     tL2C_FCRB   *p_fcrb = &p_ccb->fcrb;
-    UINT16      sar_type = ctrl_word & L2CAP_FCR_SEG_BITS;
-    BOOLEAN     packet_ok = TRUE;
-    UINT8       *p;
+    uint16_t    sar_type = ctrl_word & L2CAP_FCR_SEG_BITS;
+    bool        packet_ok = true;
+    uint8_t     *p;
 
     /* Check if the SAR state is correct */
     if ((sar_type == L2CAP_FCR_UNSEG_SDU) || (sar_type == L2CAP_FCR_START_SDU))
@@ -1438,13 +1438,13 @@
             L2CAP_TRACE_WARNING ("SAR - got unexpected unsegmented or start SDU  Expected len: %u  Got so far: %u",
                                   p_fcrb->rx_sdu_len, p_fcrb->p_rx_sdu->len);
 
-            packet_ok = FALSE;
+            packet_ok = false;
         }
         /* Check the length of the packet */
         if ( (sar_type == L2CAP_FCR_START_SDU) && (p_buf->len < L2CAP_SDU_LEN_OVERHEAD) )
         {
             L2CAP_TRACE_WARNING ("SAR start packet too short: %u", p_buf->len);
-            packet_ok = FALSE;
+            packet_ok = false;
         }
     }
     else
@@ -1452,13 +1452,13 @@
         if (p_fcrb->p_rx_sdu == NULL)
         {
             L2CAP_TRACE_WARNING ("SAR - got unexpected cont or end SDU");
-            packet_ok = FALSE;
+            packet_ok = false;
         }
     }
 
     if ( (packet_ok) && (sar_type != L2CAP_FCR_UNSEG_SDU) )
     {
-        p = ((UINT8 *)(p_buf + 1)) + p_buf->offset;
+        p = ((uint8_t *)(p_buf + 1)) + p_buf->offset;
 
         /* For start SDU packet, extract the SDU length */
         if (sar_type == L2CAP_FCR_START_SDU)
@@ -1471,7 +1471,7 @@
             if (p_fcrb->rx_sdu_len > p_ccb->max_rx_mtu)
             {
                 L2CAP_TRACE_WARNING ("SAR - SDU len: %u  larger than MTU: %u", p_fcrb->rx_sdu_len, p_fcrb->rx_sdu_len);
-                packet_ok = FALSE;
+                packet_ok = false;
             } else {
                 p_fcrb->p_rx_sdu = (BT_HDR *)osi_malloc(L2CAP_MAX_BUF_SIZE);
                 p_fcrb->p_rx_sdu->offset = OBX_BUF_MIN_OFFSET;
@@ -1485,17 +1485,17 @@
             {
                 L2CAP_TRACE_ERROR ("SAR - SDU len exceeded  Type: %u   Lengths: %u %u %u",
                                     sar_type, p_fcrb->p_rx_sdu->len, p_buf->len, p_fcrb->rx_sdu_len);
-                packet_ok = FALSE;
+                packet_ok = false;
             }
             else if ( (sar_type == L2CAP_FCR_END_SDU) && ((p_fcrb->p_rx_sdu->len + p_buf->len) != p_fcrb->rx_sdu_len) )
             {
                 L2CAP_TRACE_WARNING ("SAR - SDU end rcvd but SDU incomplete: %u %u %u",
                                       p_fcrb->p_rx_sdu->len, p_buf->len, p_fcrb->rx_sdu_len);
-                packet_ok = FALSE;
+                packet_ok = false;
             }
             else
             {
-                memcpy (((UINT8 *) (p_fcrb->p_rx_sdu + 1)) + p_fcrb->p_rx_sdu->offset + p_fcrb->p_rx_sdu->len, p, p_buf->len);
+                memcpy (((uint8_t *) (p_fcrb->p_rx_sdu + 1)) + p_fcrb->p_rx_sdu->offset + p_fcrb->p_rx_sdu->len, p, p_buf->len);
 
                 p_fcrb->p_rx_sdu->len += p_buf->len;
 
@@ -1511,7 +1511,7 @@
         }
     }
 
-    if (packet_ok == FALSE)
+    if (packet_ok == false)
     {
         osi_free(p_buf);
     }
@@ -1540,17 +1540,17 @@
 **
 ** Description      This function retransmits i-frames awaiting acks.
 **
-** Returns          BOOLEAN - TRUE if retransmitted
+** Returns          bool    - true if retransmitted
 **
 *******************************************************************************/
-static BOOLEAN retransmit_i_frames (tL2C_CCB *p_ccb, UINT8 tx_seq)
+static bool    retransmit_i_frames (tL2C_CCB *p_ccb, uint8_t tx_seq)
 {
     assert(p_ccb != NULL);
 
     BT_HDR      *p_buf = NULL;
-    UINT8       *p;
-    UINT8       buf_seq;
-    UINT16      ctrl_word;
+    uint8_t     *p;
+    uint8_t     buf_seq;
+    uint16_t    ctrl_word;
 
     if ( (!fixed_queue_is_empty(p_ccb->fcrb.waiting_for_ack_q))
      &&  (p_ccb->peer_cfg.fcr.max_transmit != 0)
@@ -1561,7 +1561,7 @@
                 fixed_queue_length(p_ccb->fcrb.waiting_for_ack_q));
 
         l2cu_disconnect_chnl (p_ccb);
-        return (FALSE);
+        return (false);
     }
 
     /* tx_seq indicates whether to retransmit a specific sequence or all (if == L2C_FCR_RETX_ALL_PKTS) */
@@ -1579,7 +1579,7 @@
             for ( ; node_ack != list_end(list_ack); node_ack = list_next(node_ack)) {
                 p_buf = (BT_HDR *)list_node(node_ack);
                 /* Get the old control word */
-                p = ((UINT8 *) (p_buf+1)) + p_buf->offset + L2CAP_PKT_OVERHEAD;
+                p = ((uint8_t *) (p_buf+1)) + p_buf->offset + L2CAP_PKT_OVERHEAD;
 
                 STREAM_TO_UINT16 (ctrl_word, p);
 
@@ -1597,7 +1597,7 @@
             L2CAP_TRACE_ERROR ("retransmit_i_frames() UNKNOWN seq: %u  q_count: %u",
                                tx_seq,
                                fixed_queue_length(p_ccb->fcrb.waiting_for_ack_q));
-            return (TRUE);
+            return (true);
         }
     }
     else
@@ -1651,7 +1651,7 @@
         l2c_fcr_start_timer (p_ccb);
     }
 
-    return (TRUE);
+    return (true);
 }
 
 
@@ -1664,17 +1664,17 @@
 ** Returns          pointer to buffer with segment or NULL
 **
 *******************************************************************************/
-BT_HDR *l2c_fcr_get_next_xmit_sdu_seg (tL2C_CCB *p_ccb, UINT16 max_packet_length)
+BT_HDR *l2c_fcr_get_next_xmit_sdu_seg (tL2C_CCB *p_ccb, uint16_t max_packet_length)
 {
     assert(p_ccb != NULL);
 
-    BOOLEAN     first_seg    = FALSE,       /* The segment is the first part of data  */
-                mid_seg      = FALSE,       /* The segment is the middle part of data */
-                last_seg     = FALSE;       /* The segment is the last part of data   */
-    UINT16      sdu_len = 0;
+    bool        first_seg    = false,       /* The segment is the first part of data  */
+                mid_seg      = false,       /* The segment is the middle part of data */
+                last_seg     = false;       /* The segment is the last part of data   */
+    uint16_t    sdu_len = 0;
     BT_HDR      *p_buf, *p_xmit;
-    UINT8       *p;
-    UINT16      max_pdu = p_ccb->tx_mps /* Needed? - L2CAP_MAX_HEADER_FCS*/;
+    uint8_t     *p;
+    uint16_t    max_pdu = p_ccb->tx_mps /* Needed? - L2CAP_MAX_HEADER_FCS*/;
 
     /* If there is anything in the retransmit queue, that goes first
     */
@@ -1682,7 +1682,7 @@
     if (p_buf != NULL)
     {
         /* Update Rx Seq and FCS if we acked some packets while this one was queued */
-        prepare_I_frame (p_ccb, p_buf, TRUE);
+        prepare_I_frame (p_ccb, p_buf, true);
 
         p_buf->event = p_ccb->local_cid;
 
@@ -1710,11 +1710,11 @@
         /* We are using the "event" field to tell is if we already started segmentation */
         if (p_buf->event == 0)
         {
-            first_seg = TRUE;
+            first_seg = true;
             sdu_len   = p_buf->len;
         }
         else
-            mid_seg = TRUE;
+            mid_seg = true;
 
         /* Get a new buffer and copy the data that can be sent in a PDU */
         p_xmit = l2c_fcr_clone_buf(p_buf, L2CAP_MIN_OFFSET + L2CAP_SDU_LEN_OFFSET,
@@ -1742,7 +1742,7 @@
         p_xmit = (BT_HDR *)fixed_queue_try_dequeue(p_ccb->xmit_hold_q);
 
         if (p_xmit->event != 0)
-            last_seg = TRUE;
+            last_seg = true;
 
         p_xmit->event = p_ccb->local_cid;
     }
@@ -1758,7 +1758,7 @@
     }
 
     /* Set the pointer to the beginning of the data */
-    p = (UINT8 *)(p_xmit + 1) + p_xmit->offset;
+    p = (uint8_t *)(p_xmit + 1) + p_xmit->offset;
 
     /* Now the L2CAP header */
 
@@ -1777,7 +1777,7 @@
         /* layer_specific is shared with flushable flag(bits 0-1), don't clear it */
         p_xmit->layer_specific |= L2CAP_FCR_START_SDU;
 
-        first_seg = FALSE;
+        first_seg = false;
     }
     else if (mid_seg)
         p_xmit->layer_specific |= L2CAP_FCR_CONT_SDU;
@@ -1786,7 +1786,7 @@
     else
         p_xmit->layer_specific |= L2CAP_FCR_UNSEG_SDU;
 
-    prepare_I_frame (p_ccb, p_xmit, FALSE);
+    prepare_I_frame (p_ccb, p_xmit, false);
 
     if (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE)
     {
@@ -1813,7 +1813,7 @@
              * NOTE: Here we assume the allocate buffer is large enough
              * to include extra 4 octets at the end.
              */
-            p = ((UINT8 *) (p_wack+1)) + p_wack->offset + p_wack->len;
+            p = ((uint8_t *) (p_wack+1)) + p_wack->offset + p_wack->len;
             UINT32_TO_STREAM (p, time_get_os_boottime_ms());
 #endif
             /* We will not save the FCS in case we reconfigure and change options */
@@ -1843,26 +1843,26 @@
 ** Returns          pointer to buffer with segment or NULL
 **
 *******************************************************************************/
-BT_HDR *l2c_lcc_get_next_xmit_sdu_seg (tL2C_CCB *p_ccb, UINT16 max_packet_length)
+BT_HDR *l2c_lcc_get_next_xmit_sdu_seg (tL2C_CCB *p_ccb, uint16_t max_packet_length)
 {
-    BOOLEAN     first_seg    = FALSE;       /* The segment is the first part of data  */
-    BOOLEAN     last_seg     = FALSE;       /* The segment is the last part of data  */
-    UINT16      no_of_bytes_to_send = 0;
-    UINT16      sdu_len = 0;
+    bool        first_seg    = false;       /* The segment is the first part of data  */
+    bool        last_seg     = false;       /* The segment is the last part of data  */
+    uint16_t    no_of_bytes_to_send = 0;
+    uint16_t    sdu_len = 0;
     BT_HDR      *p_buf, *p_xmit;
-    UINT8       *p;
-    UINT16      max_pdu = p_ccb->peer_conn_cfg.mps;
+    uint8_t     *p;
+    uint16_t    max_pdu = p_ccb->peer_conn_cfg.mps;
 
     p_buf = (BT_HDR *)fixed_queue_try_peek_first(p_ccb->xmit_hold_q);
 
     /* We are using the "event" field to tell is if we already started segmentation */
     if (p_buf->event == 0)
     {
-        first_seg = TRUE;
+        first_seg = true;
         sdu_len   = p_buf->len;
         if (p_buf->len <= (max_pdu - L2CAP_LCC_SDU_LENGTH))
         {
-            last_seg = TRUE;
+            last_seg = true;
             no_of_bytes_to_send = p_buf->len;
         }
         else
@@ -1870,7 +1870,7 @@
     }
     else if (p_buf->len <= max_pdu)
     {
-        last_seg = TRUE;
+        last_seg = true;
         no_of_bytes_to_send = p_buf->len;
     }
     else
@@ -1880,7 +1880,7 @@
     }
 
     /* Get a new buffer and copy the data that can be sent in a PDU */
-    if (first_seg == TRUE)
+    if (first_seg == true)
         p_xmit = l2c_fcr_clone_buf (p_buf, L2CAP_LCC_OFFSET,
                     no_of_bytes_to_send);
     else
@@ -1892,10 +1892,10 @@
         p_buf->event  = p_ccb->local_cid;
         p_xmit->event = p_ccb->local_cid;
 
-        if (first_seg == TRUE)
+        if (first_seg == true)
         {
             p_xmit->offset -= L2CAP_LCC_SDU_LENGTH;  /* for writing the SDU length. */
-            p = (UINT8 *)(p_xmit + 1) + p_xmit->offset;
+            p = (uint8_t *)(p_xmit + 1) + p_xmit->offset;
             UINT16_TO_STREAM(p, sdu_len);
             p_xmit->len += L2CAP_LCC_SDU_LENGTH;
         }
@@ -1913,7 +1913,7 @@
         return (NULL);
     }
 
-    if (last_seg == TRUE)
+    if (last_seg == true)
     {
         p_buf = (BT_HDR *)fixed_queue_try_dequeue(p_ccb->xmit_hold_q);
         osi_free(p_buf);
@@ -1924,7 +1924,7 @@
     p_xmit->len    += L2CAP_PKT_OVERHEAD ;
 
     /* Set the pointer to the beginning of the data */
-    p = (UINT8 *)(p_xmit + 1) + p_xmit->offset;
+    p = (uint8_t *)(p_xmit + 1) + p_xmit->offset;
 
     /* Note: if FCS has to be included then the length is recalculated later */
     UINT16_TO_STREAM (p, p_xmit->len - L2CAP_PKT_OVERHEAD);
@@ -1950,10 +1950,10 @@
 **                  Note: This assumes peer EXT Features have been received.
 **                      Basic mode is used if FCR Options have not been received
 **
-** Returns          UINT8 - nonzero if can continue, '0' if no compatible channels
+** Returns          uint8_t - nonzero if can continue, '0' if no compatible channels
 **
 *******************************************************************************/
-UINT8 l2c_fcr_chk_chan_modes (tL2C_CCB *p_ccb)
+uint8_t l2c_fcr_chk_chan_modes (tL2C_CCB *p_ccb)
 {
     assert(p_ccb != NULL);
 
@@ -1980,10 +1980,10 @@
 ** Description      Validates and sets up the FCR options passed in from
 **                  L2CA_ConfigReq based on remote device's features.
 **
-** Returns          TRUE if no errors, Otherwise FALSE
+** Returns          true if no errors, Otherwise false
 **
 *******************************************************************************/
-BOOLEAN l2c_fcr_adj_our_req_options (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg)
+bool    l2c_fcr_adj_our_req_options (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg)
 {
     assert(p_ccb != NULL);
     assert(p_cfg != NULL);
@@ -2019,16 +2019,16 @@
         {
             /* Two channels have incompatible supported types */
             l2cu_disconnect_chnl (p_ccb);
-            return (FALSE);
+            return (false);
         }
 
         /* Basic is the only common channel mode between the two devices */
         else if (p_ccb->ertm_info.allowed_modes == L2CAP_FCR_CHAN_OPT_BASIC)
         {
             /* We only want to try Basic, so bypass sending the FCR options entirely */
-            p_cfg->fcr_present = FALSE;
-            p_cfg->fcs_present = FALSE;             /* Illegal to use FCS option in basic mode */
-            p_cfg->ext_flow_spec_present = FALSE;   /* Illegal to use extended flow spec in basic mode */
+            p_cfg->fcr_present = false;
+            p_cfg->fcs_present = false;             /* Illegal to use FCS option in basic mode */
+            p_cfg->ext_flow_spec_present = false;   /* Illegal to use extended flow spec in basic mode */
         }
 
         /* We have at least one non-basic mode available
@@ -2057,7 +2057,7 @@
             if ( (p_cfg->mtu_present) && (p_cfg->mtu > p_ccb->max_rx_mtu) )
             {
                 L2CAP_TRACE_WARNING ("L2CAP - MTU: %u  larger than buf size: %u", p_cfg->mtu, p_ccb->max_rx_mtu);
-                return (FALSE);
+                return (false);
             }
 
             /* application want to use the default MPS */
@@ -2069,7 +2069,7 @@
             else if (p_fcr->mps > p_ccb->max_rx_mtu)
             {
                 L2CAP_TRACE_WARNING ("L2CAP - MPS  %u  invalid  MTU: %u", p_fcr->mps, p_ccb->max_rx_mtu);
-                return (FALSE);
+                return (false);
             }
 
             /* We always initially read into the HCI buffer pool, so make sure it fits */
@@ -2078,18 +2078,18 @@
         }
         else
         {
-            p_cfg->fcs_present = FALSE;             /* Illegal to use FCS option in basic mode */
-            p_cfg->ext_flow_spec_present = FALSE;   /* Illegal to use extended flow spec in basic mode */
+            p_cfg->fcs_present = false;             /* Illegal to use FCS option in basic mode */
+            p_cfg->ext_flow_spec_present = false;   /* Illegal to use extended flow spec in basic mode */
         }
 
         p_ccb->our_cfg.fcr = *p_fcr;
     }
     else    /* Not sure how to send a reconfiguration(??) should fcr be included? */
     {
-        p_ccb->our_cfg.fcr_present = FALSE;
+        p_ccb->our_cfg.fcr_present = false;
     }
 
-    return (TRUE);
+    return (true);
 }
 
 
@@ -2158,7 +2158,7 @@
         /* Note: peer is not guaranteed to obey our adjustment */
         if (p_ccb->peer_cfg.fcr.tx_win_sz > p_ccb->our_cfg.fcr.tx_win_sz)
         {
-            L2CAP_TRACE_DEBUG ("%s: adjusting requested tx_win_sz from %i to %i", __FUNCTION__, p_ccb->peer_cfg.fcr.tx_win_sz, p_ccb->our_cfg.fcr.tx_win_sz);
+            L2CAP_TRACE_DEBUG ("%s: adjusting requested tx_win_sz from %i to %i", __func__, p_ccb->peer_cfg.fcr.tx_win_sz, p_ccb->our_cfg.fcr.tx_win_sz);
             p_ccb->peer_cfg.fcr.tx_win_sz = p_ccb->our_cfg.fcr.tx_win_sz;
         }
 
@@ -2179,21 +2179,21 @@
 **                  If the error is because of the channel mode, it will try
 **                  to resend using another supported optional channel.
 **
-** Returns          TRUE if resent configuration, False if channel matches or
+** Returns          true if resent configuration, False if channel matches or
 **                  cannot match.
 **
 *******************************************************************************/
-BOOLEAN l2c_fcr_renegotiate_chan(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg)
+bool    l2c_fcr_renegotiate_chan(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg)
 {
     assert(p_ccb != NULL);
     assert(p_cfg != NULL);
 
-    UINT8   peer_mode = p_ccb->our_cfg.fcr.mode;
-    BOOLEAN can_renegotiate;
+    uint8_t peer_mode = p_ccb->our_cfg.fcr.mode;
+    bool    can_renegotiate;
 
     /* Skip if this is a reconfiguration from OPEN STATE or if FCR is not returned */
     if (!p_cfg->fcr_present || (p_ccb->config_done & RECONFIG_FLAG))
-        return (FALSE);
+        return (false);
 
     /* Only retry if there are more channel options to try */
     if (p_cfg->result == L2CAP_CFG_UNACCEPTABLE_PARAMS)
@@ -2209,7 +2209,7 @@
                 L2CAP_TRACE_WARNING ("l2c_fcr_renegotiate_chan (Max retries exceeded)");
             }
 
-            can_renegotiate = FALSE;
+            can_renegotiate = false;
 
             /* Try another supported mode if available based on our last attempted channel */
             switch (p_ccb->our_cfg.fcr.mode)
@@ -2221,7 +2221,7 @@
                 {
                     L2CAP_TRACE_DEBUG ("l2c_fcr_renegotiate_chan(Trying ERTM)");
                     p_ccb->our_cfg.fcr.mode = L2CAP_FCR_ERTM_MODE;
-                    can_renegotiate = TRUE;
+                    can_renegotiate = true;
                 }
                 else    /* Falls through */
 
@@ -2231,7 +2231,7 @@
                     if (p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_BASIC)
                     {
                         L2CAP_TRACE_DEBUG ("l2c_fcr_renegotiate_chan(Trying Basic)");
-                        can_renegotiate = TRUE;
+                        can_renegotiate = true;
                         p_ccb->our_cfg.fcr.mode = L2CAP_FCR_BASIC_MODE;
                     }
                 }
@@ -2244,12 +2244,12 @@
 
             if (can_renegotiate)
             {
-                p_ccb->our_cfg.fcr_present = TRUE;
+                p_ccb->our_cfg.fcr_present = true;
 
                 if (p_ccb->our_cfg.fcr.mode == L2CAP_FCR_BASIC_MODE)
                 {
-                    p_ccb->our_cfg.fcs_present = FALSE;
-                    p_ccb->our_cfg.ext_flow_spec_present = FALSE;
+                    p_ccb->our_cfg.fcs_present = false;
+                    p_ccb->our_cfg.ext_flow_spec_present = false;
 
                     /* Basic Mode uses ACL Data Pool, make sure the MTU fits */
                     if ( (p_cfg->mtu_present) && (p_cfg->mtu > L2CAP_MTU_SIZE) )
@@ -2265,7 +2265,7 @@
                                    L2CAP_CHNL_CFG_TIMEOUT_MS,
                                    l2c_ccb_timer_timeout, p_ccb,
                                    btu_general_alarm_queue);
-                return (TRUE);
+                return (true);
             }
         }
     }
@@ -2278,7 +2278,7 @@
         l2cu_disconnect_chnl (p_ccb);
     }
 
-    return (FALSE);
+    return (false);
 }
 
 
@@ -2289,19 +2289,19 @@
 ** Description      This function is called to process the FCR options passed
 **                  in the peer's configuration request.
 **
-** Returns          UINT8 - L2CAP_PEER_CFG_OK, L2CAP_PEER_CFG_UNACCEPTABLE,
+** Returns          uint8_t - L2CAP_PEER_CFG_OK, L2CAP_PEER_CFG_UNACCEPTABLE,
 **                          or L2CAP_PEER_CFG_DISCONNECT.
 **
 *******************************************************************************/
-UINT8 l2c_fcr_process_peer_cfg_req(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg)
+uint8_t l2c_fcr_process_peer_cfg_req(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg)
 {
     assert(p_ccb != NULL);
     assert(p_cfg != NULL);
 
-    UINT16 max_retrans_size;
-    UINT8  fcr_ok = L2CAP_PEER_CFG_OK;
+    uint16_t max_retrans_size;
+    uint8_t fcr_ok = L2CAP_PEER_CFG_OK;
 
-    p_ccb->p_lcb->w4_info_rsp = FALSE;      /* Handles T61x SonyEricsson Bug in Info Request */
+    p_ccb->p_lcb->w4_info_rsp = false;      /* Handles T61x SonyEricsson Bug in Info Request */
 
     L2CAP_TRACE_EVENT ("l2c_fcr_process_peer_cfg_req() CFG fcr_present:%d fcr.mode:%d CCB FCR mode:%d preferred: %u allowed:%u",
                         p_cfg->fcr_present, p_cfg->fcr.mode, p_ccb->our_cfg.fcr.mode, p_ccb->ertm_info.preferred_mode,
@@ -2355,7 +2355,7 @@
     if (fcr_ok == L2CAP_PEER_CFG_OK)
     {
         /* by default don't need to send params in the response */
-        p_ccb->out_cfg_fcr_present = FALSE;
+        p_ccb->out_cfg_fcr_present = false;
 
         /* Make any needed adjustments for the response to the peer */
         if (p_cfg->fcr_present && p_cfg->fcr.mode != L2CAP_FCR_BASIC_MODE)
@@ -2376,7 +2376,7 @@
             if ( (p_cfg->fcr.mps == 0) || (p_cfg->fcr.mps > p_ccb->peer_cfg.mtu) )
             {
                 p_cfg->fcr.mps = p_ccb->peer_cfg.mtu;
-                p_ccb->out_cfg_fcr_present = TRUE;
+                p_ccb->out_cfg_fcr_present = true;
             }
 
             /* Ensure the MPS is not bigger than our retransmission buffer */
@@ -2385,13 +2385,13 @@
                 L2CAP_TRACE_DEBUG("CFG: Overriding MPS to %d (orig %d)", max_retrans_size, p_cfg->fcr.mps);
 
                 p_cfg->fcr.mps = max_retrans_size;
-                p_ccb->out_cfg_fcr_present = TRUE;
+                p_ccb->out_cfg_fcr_present = true;
             }
 
             if (p_cfg->fcr.mode == L2CAP_FCR_ERTM_MODE || p_cfg->fcr.mode == L2CAP_FCR_STREAM_MODE)
             {
                 /* Always respond with FCR ERTM parameters */
-                p_ccb->out_cfg_fcr_present = TRUE;
+                p_ccb->out_cfg_fcr_present = true;
             }
         }
 
@@ -2407,7 +2407,7 @@
         if (p_ccb->peer_cfg_already_rejected)
             fcr_ok = L2CAP_PEER_CFG_DISCONNECT;
         else
-            p_ccb->peer_cfg_already_rejected = TRUE;
+            p_ccb->peer_cfg_already_rejected = true;
     }
 
     return (fcr_ok);
@@ -2426,14 +2426,14 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void l2c_fcr_collect_ack_delay (tL2C_CCB *p_ccb, UINT8 num_bufs_acked)
+static void l2c_fcr_collect_ack_delay (tL2C_CCB *p_ccb, uint8_t num_bufs_acked)
 {
-    UINT32  index;
+    uint32_t index;
     BT_HDR *p_buf;
-    UINT8  *p;
-    UINT32  timestamp, delay;
-    UINT8   xx;
-    UINT8   str[120];
+    uint8_t *p;
+    uint32_t timestamp, delay;
+    uint8_t xx;
+    uint8_t str[120];
 
     index = p_ccb->fcrb.ack_delay_avg_index;
 
@@ -2462,7 +2462,7 @@
             if ( xx == num_bufs_acked - 1 )
             {
                 /* get timestamp from tx I-frame that receiver is acking */
-                p = ((UINT8 *) (p_buf+1)) + p_buf->offset + p_buf->len;
+                p = ((uint8_t *) (p_buf+1)) + p_buf->offset + p_buf->len;
                 if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS)
                 {
                     p += L2CAP_FCS_LEN;
diff --git a/stack/l2cap/l2c_int.h b/stack/l2cap/l2c_int.h
index 18fd93e..41393f6 100644
--- a/stack/l2cap/l2c_int.h
+++ b/stack/l2cap/l2c_int.h
@@ -167,24 +167,24 @@
 
 typedef struct
 {
-    UINT8       next_tx_seq;                /* Next sequence number to be Tx'ed         */
-    UINT8       last_rx_ack;                /* Last sequence number ack'ed by the peer  */
-    UINT8       next_seq_expected;          /* Next peer sequence number expected       */
-    UINT8       last_ack_sent;              /* Last peer sequence number ack'ed         */
-    UINT8       num_tries;                  /* Number of retries to send a packet       */
-    UINT8       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      */
 
-    BOOLEAN     remote_busy;                /* TRUE if peer has flowed us off           */
-    BOOLEAN     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      */
 
-    BOOLEAN     rej_sent;                   /* Reject was sent                          */
-    BOOLEAN     srej_sent;                  /* Selective Reject was sent                */
-    BOOLEAN     wait_ack;                   /* Transmitter is waiting ack (poll sent)   */
-    BOOLEAN     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              */
 
-    BOOLEAN     send_f_rsp;                 /* We need to send an F-bit response        */
+    bool        send_f_rsp;                 /* We need to send an F-bit response        */
 
-    UINT16      rx_sdu_len;                 /* Length of 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   */
@@ -194,30 +194,30 @@
     alarm_t       *mon_retrans_timer;       /* Timer Monitor or Retransmission          */
 
 #if (L2CAP_ERTM_STATS == TRUE)
-    UINT32      connect_tick_count;         /* Time channel was established             */
-    UINT32      ertm_pkt_counts[2];         /* Packets sent and received                */
-    UINT32      ertm_byte_counts[2];        /* Bytes   sent and received                */
-    UINT32      s_frames_sent[4];           /* S-frames sent (RR, REJ, RNR, SREJ)       */
-    UINT32      s_frames_rcvd[4];           /* S-frames rcvd (RR, REJ, RNR, SREJ)       */
-    UINT32      xmit_window_closed;         /* # of times the xmit window was closed    */
-    UINT32      controller_idle;            /* # of times less than 2 packets in controller */
+    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      pkts_retransmitted;         /* # of packets that were retransmitted     */
-    UINT32      retrans_touts;              /* # of retransmission timouts              */
-    UINT32      xmit_ack_touts;             /* # of xmit ack timouts                    */
+    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
-    UINT32      ack_delay_avg_count;
-    UINT32      ack_delay_avg_index;
-    UINT32      throughput_start;
-    UINT32      throughput[L2CAP_ERTM_STATS_NUM_AVG];
-    UINT32      ack_delay_avg[L2CAP_ERTM_STATS_NUM_AVG];
-    UINT32      ack_delay_min[L2CAP_ERTM_STATS_NUM_AVG];
-    UINT32      ack_delay_max[L2CAP_ERTM_STATS_NUM_AVG];
-    UINT32      ack_q_count_avg[L2CAP_ERTM_STATS_NUM_AVG];
-    UINT32      ack_q_count_min[L2CAP_ERTM_STATS_NUM_AVG];
-    UINT32      ack_q_count_max[L2CAP_ERTM_STATS_NUM_AVG];
+    uint32_t    ack_delay_avg_count;
+    uint32_t    ack_delay_avg_index;
+    uint32_t    throughput_start;
+    uint32_t    throughput[L2CAP_ERTM_STATS_NUM_AVG];
+    uint32_t    ack_delay_avg[L2CAP_ERTM_STATS_NUM_AVG];
+    uint32_t    ack_delay_min[L2CAP_ERTM_STATS_NUM_AVG];
+    uint32_t    ack_delay_max[L2CAP_ERTM_STATS_NUM_AVG];
+    uint32_t    ack_q_count_avg[L2CAP_ERTM_STATS_NUM_AVG];
+    uint32_t    ack_q_count_min[L2CAP_ERTM_STATS_NUM_AVG];
+    uint32_t    ack_q_count_max[L2CAP_ERTM_STATS_NUM_AVG];
 #endif
 } tL2C_FCRB;
 
@@ -234,16 +234,16 @@
 
 typedef struct
 {
-    UINT8               state;
+    uint8_t             state;
     tL2CAP_UCD_CB_INFO  cb_info;
 } tL2C_UCD_REG;
 #endif
 
 typedef struct
 {
-    BOOLEAN                 in_use;
-    UINT16                  psm;
-    UINT16                  real_psm;               /* This may be a dummy RCB for an o/b connection but */
+    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   */
 #if (L2CAP_UCD_INCLUDED == TRUE)
     tL2C_UCD_REG            ucd;
@@ -262,9 +262,9 @@
 
 typedef struct
 {
-    UINT16                  psm;
+    uint16_t                psm;
     tBT_TRANSPORT           transport;
-    BOOLEAN                 is_originator;
+    bool                    is_originator;
     tL2CAP_SEC_CBACK        *p_callback;
     void                    *p_ref_data;
 }tL2CAP_SEC_DATA;
@@ -276,19 +276,19 @@
 */
 typedef struct t_l2c_ccb
 {
-    BOOLEAN             in_use;                 /* TRUE when in use, FALSE when not */
+    bool                in_use;                 /* true when in use, false when not */
     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 */
-    BOOLEAN             is_first_seg;           /* Dtermine whether the received packet is the first segment or not */
+    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              ble_sdu_length;         /* Length of unassembled sdu length*/
+    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     */
 
-    UINT16              local_cid;              /* Local CID                        */
-    UINT16              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,21 +300,21 @@
 #define RECONFIG_FLAG   0x04                    /* True after initial configuration */
 #define CFG_DONE_MASK   (IB_CFG_DONE | OB_CFG_DONE)
 
-    UINT8               config_done;            /* Configuration flag word         */
-    UINT8               local_id;               /* Transaction ID for local trans  */
-    UINT8               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               flags;
+    uint8_t             flags;
 
     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         */
-    BOOLEAN             cong_sent;              /* Set when congested status sent   */
-    UINT16              buff_quota;             /* Buffer quota before sending congestion   */
+    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             */
@@ -323,25 +323,25 @@
     /* Fields used for eL2CAP */
     tL2CAP_ERTM_INFO    ertm_info;
     tL2C_FCRB           fcrb;
-    UINT16              tx_mps;                 /* TX MPS adjusted based on current controller */
-    UINT16              max_rx_mtu;
-    UINT8               fcr_cfg_tries;          /* Max number of negotiation attempts */
-    BOOLEAN             peer_cfg_already_rejected; /* If mode rejected once, set to TRUE */
-    BOOLEAN             out_cfg_fcr_present;    /* TRUE if cfg response shoulkd include fcr options */
+    uint16_t            tx_mps;                 /* TX MPS adjusted based on current controller */
+    uint16_t            max_rx_mtu;
+    uint8_t             fcr_cfg_tries;          /* Max number of negotiation attempts */
+    bool                peer_cfg_already_rejected; /* If mode rejected once, set to true */
+    bool                out_cfg_fcr_present;    /* true if cfg response shoulkd include fcr options */
 
 #define L2CAP_CFG_FCS_OUR   0x01                /* Our desired config FCS option */
 #define L2CAP_CFG_FCS_PEER  0x02                /* Peer's desired config FCS option */
 #define L2CAP_BYPASS_FCS    (L2CAP_CFG_FCS_OUR | L2CAP_CFG_FCS_PEER)
-    UINT8               bypass_fcs;
+    uint8_t             bypass_fcs;
 
 #if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
-    BOOLEAN             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              fixed_chnl_idle_tout;   /* Idle timeout to use for the fixed channel       */
+#if (L2CAP_NUM_FIXED_CHNLS > 0 || L2CAP_UCD_INCLUDED == TRUE)
+    uint16_t            fixed_chnl_idle_tout;   /* Idle timeout to use for the fixed channel       */
 #endif
-    UINT16              tx_data_len;
+    uint16_t            tx_data_len;
 } tL2C_CCB;
 
 /***********************************************************************
@@ -369,8 +369,8 @@
 {
     tL2C_CCB        *p_serve_ccb;               /* current serving ccb within priority group */
     tL2C_CCB        *p_first_ccb;               /* first ccb of priority group */
-    UINT8           num_ccb;                    /* number of channels in priority group */
-    UINT8           quota;                      /* burst transmission quota */
+    uint8_t         num_ccb;                    /* number of channels in priority group */
+    uint8_t         quota;                      /* burst transmission quota */
 } tL2C_RR_SERV;
 
 #endif /* (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE) */
@@ -380,11 +380,11 @@
 */
 typedef struct t_l2c_linkcb
 {
-    BOOLEAN             in_use;                     /* TRUE when in use, FALSE when not */
+    bool                in_use;                     /* true when in use, false when not */
     tL2C_LINK_STATE     link_state;
 
     alarm_t             *l2c_lcb_timer;             /* Timer entry for timeout evt */
-    UINT16              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        */
 
@@ -392,58 +392,58 @@
     alarm_t             *info_resp_timer;           /* Timer entry for info resp timeout evt */
     BD_ADDR             remote_bd_addr;             /* The BD address of the remote     */
 
-    UINT8               link_role;                  /* Master or slave                  */
-    UINT8               id;
-    UINT8               cur_echo_id;                /* Current id value for echo request */
+    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              idle_timeout;               /* Idle timeout                     */
-    BOOLEAN             is_bonding;                 /* True - link active only for bonding */
+    uint16_t            idle_timeout;               /* Idle timeout                     */
+    bool                is_bonding;                 /* True - link active only for bonding */
 
-    UINT16              link_flush_tout;            /* Flush timeout used               */
+    uint16_t            link_flush_tout;            /* Flush timeout used               */
 
-    UINT16              link_xmit_quota;            /* Num outstanding pkts allowed     */
-    UINT16              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   */
 
-    BOOLEAN             partial_segment_being_sent; /* Set TRUE when a partial segment  */
+    bool                partial_segment_being_sent; /* Set true when a partial segment  */
                                                     /* is being sent.                   */
-    BOOLEAN             w4_info_rsp;                /* TRUE when info request is active */
-    UINT8               info_rx_bits;               /* set 1 if received info type */
-    UINT32              peer_ext_fea;               /* Peer's extended features mask    */
+    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  */
 
-    UINT8               peer_chnl_mask[L2CAP_FIXED_CHNL_ARRAY_SIZE];
+    uint8_t             peer_chnl_mask[L2CAP_FIXED_CHNL_ARRAY_SIZE];
 #if (L2CAP_UCD_INCLUDED == TRUE)
-    UINT16              ucd_mtu;                    /* peer MTU on UCD */
+    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  */
 #endif
 
     BT_HDR              *p_hcit_rcv_acl;            /* Current HCIT ACL buf being rcvd  */
-    UINT16              idle_timeout_sv;            /* Save current Idle timeout        */
-    UINT8               acl_priority;               /* L2C_PRIORITY_NORMAL or L2C_PRIORITY_HIGH */
+    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           */
 
 #if (L2CAP_NUM_FIXED_CHNLS > 0)
     tL2C_CCB            *p_fixed_ccbs[L2CAP_NUM_FIXED_CHNLS];
-    UINT16              disc_reason;
+    uint16_t            disc_reason;
 #endif
 
     tBT_TRANSPORT       transport;
 #if (BLE_INCLUDED == TRUE)
     tBLE_ADDR_TYPE      ble_addr_type;
-    UINT16              tx_data_len;            /* tx data length used in data length extension */
+    uint16_t            tx_data_len;            /* tx data length used in data length extension */
     fixed_queue_t       *le_sec_pending_q;      /* LE coc channels waiting for security check completion */
-    UINT8               sec_act;
+    uint8_t             sec_act;
 #define L2C_BLE_CONN_UPDATE_DISABLE 0x1  /* disable update connection parameters */
 #define L2C_BLE_NEW_CONN_PARAM      0x2  /* new connection parameter to be set */
 #define L2C_BLE_UPDATE_PENDING      0x4  /* waiting for connection update finished */
 #define L2C_BLE_NOT_DEFAULT_PARAM   0x8  /* not using default connection parameters */
-    UINT8               conn_update_mask;
+    uint8_t             conn_update_mask;
 
-    UINT16              min_interval; /* parameters as requested by peripheral */
-    UINT16              max_interval;
-    UINT16              latency;
-    UINT16              timeout;
+    uint16_t            min_interval; /* parameters as requested by peripheral */
+    uint16_t            max_interval;
+    uint16_t            latency;
+    uint16_t            timeout;
 
 #endif
 
@@ -451,7 +451,7 @@
     /* 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               rr_pri;                             /* current serving priority group */
+    uint8_t             rr_pri;                             /* current serving priority group */
 #endif
 
 } tL2C_LCB;
@@ -460,14 +460,14 @@
 */
 typedef struct
 {
-    UINT8           l2cap_trace_level;
-    UINT16          controller_xmit_window;         /* Total ACL window for all links   */
+    uint8_t         l2cap_trace_level;
+    uint16_t        controller_xmit_window;         /* Total ACL window for all links   */
 
-    UINT16          round_robin_quota;              /* Round-robin link quota           */
-    UINT16          round_robin_unacked;            /* Round-robin unacked              */
-    BOOLEAN         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           */
 
-    BOOLEAN         is_cong_cback_context;
+    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       */
@@ -476,25 +476,25 @@
     tL2C_CCB        *p_free_ccb_first;              /* Pointer to first free CCB        */
     tL2C_CCB        *p_free_ccb_last;               /* Pointer to last  free CCB        */
 
-    UINT8           desire_role;                    /* desire to be master/slave when accepting a connection */
-    BOOLEAN         disallow_switch;                /* FALSE, to allow switch at create conn */
-    UINT16          num_lm_acl_bufs;                /* # of ACL buffers on controller   */
-    UINT16          idle_timeout;                   /* Idle timeout                     */
+    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                     */
 
     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          num_links_active;               /* Number of links active           */
+    uint16_t        num_links_active;               /* Number of links active           */
 
 #if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
-    UINT16          non_flushable_pbf;              /* L2CAP_PKT_START_NON_FLUSHABLE if controller supports */
+    uint16_t        non_flushable_pbf;              /* L2CAP_PKT_START_NON_FLUSHABLE if controller supports */
                                                     /* Otherwise, L2CAP_PKT_START */
-    BOOLEAN         is_flush_active;                /* TRUE if an HCI_Enhanced_Flush has been sent */
+    bool            is_flush_active;                /* true if an HCI_Enhanced_Flush has been sent */
 #endif
 
-#if L2CAP_CONFORMANCE_TESTING == TRUE
-    UINT32          test_info_resp;                 /* Conformance testing needs a dynamic response */
+#if (L2CAP_CONFORMANCE_TESTING == TRUE)
+    uint32_t        test_info_resp;                 /* Conformance testing needs a dynamic response */
 #endif
 
 #if (L2CAP_NUM_FIXED_CHNLS > 0)
@@ -502,25 +502,25 @@
 #endif
 
 #if (BLE_INCLUDED == TRUE)
-    UINT16                   num_ble_links_active;               /* Number of LE links active           */
-    BOOLEAN                  is_ble_connecting;
+    uint16_t                 num_ble_links_active;               /* Number of LE links active           */
+    bool                     is_ble_connecting;
     BD_ADDR                  ble_connecting_bda;
-    UINT16                   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                   num_lm_ble_bufs;                   /* # of ACL buffers on controller   */
-    UINT16                   ble_round_robin_quota;              /* Round-robin link quota           */
-    UINT16                   ble_round_robin_unacked;            /* Round-robin unacked              */
-    BOOLEAN                  ble_check_round_robin;              /* Do a round robin check           */
+    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           */
 #endif
 
     tL2CA_ECHO_DATA_CB      *p_echo_data_cb;                /* Echo data callback */
 
-#if (defined(L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE) && (L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE == TRUE))
-    UINT16              high_pri_min_xmit_quota;    /* Minimum number of ACL credit for high priority link */
+#if (L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE == TRUE)
+    uint16_t            high_pri_min_xmit_quota;    /* Minimum number of ACL credit for high priority link */
 #endif /* (L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE == TRUE) */
 
-    UINT16          dyn_psm;
+    uint16_t        dyn_psm;
 } tL2C_CB;
 
 
@@ -532,15 +532,15 @@
 typedef struct
 {
     BD_ADDR         bd_addr;                        /* Remote BD address        */
-    UINT8           status;                         /* Connection status        */
-    UINT16          psm;                            /* PSM of the connection    */
-    UINT16          l2cap_result;                   /* L2CAP result             */
-    UINT16          l2cap_status;                   /* L2CAP status             */
-    UINT16          remote_cid;                     /* Remote CID               */
+    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;
 
 
-typedef void (tL2C_FCR_MGMT_EVT_HDLR) (UINT8, tL2C_CCB *);
+typedef void (tL2C_FCR_MGMT_EVT_HDLR) (uint8_t, tL2C_CCB *);
 
 /* The offset in a buffer that L2CAP will use when building commands.
 */
@@ -549,7 +549,7 @@
 
 /* Number of ACL buffers to use for high priority channel
 */
-#if (!defined(L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE) || (L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE == FALSE))
+#if (L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE == FALSE)
 #define L2CAP_HIGH_PRI_MIN_XMIT_QUOTA_A     (L2CAP_HIGH_PRI_MIN_XMIT_QUOTA)
 #else
 #define L2CAP_HIGH_PRI_MIN_XMIT_QUOTA_A     (l2cb.high_pri_min_xmit_quota)
@@ -558,7 +558,7 @@
 /* L2CAP global data
 ************************************
 */
-#if (!defined L2C_DYNAMIC_MEMORY) || (L2C_DYNAMIC_MEMORY == FALSE)
+#if (L2C_DYNAMIC_MEMORY == FALSE)
 extern tL2C_CB  l2cb;
 #else
 extern tL2C_CB *l2c_cb_ptr;
@@ -576,70 +576,70 @@
 extern void     l2c_ccb_timer_timeout(void *data);
 extern void     l2c_lcb_timer_timeout(void *data);
 extern void     l2c_fcrb_ack_timer_timeout(void *data);
-extern UINT8    l2c_data_write (UINT16 cid, BT_HDR *p_data, UINT16 flag);
+extern uint8_t  l2c_data_write (uint16_t cid, BT_HDR *p_data, uint16_t flag);
 extern void     l2c_rcv_acl_data (BT_HDR *p_msg);
-extern void     l2c_process_held_packets (BOOLEAN timed_out);
+extern void     l2c_process_held_packets (bool    timed_out);
 
 /* Functions provided by l2c_utils.c
 ************************************
 */
-extern tL2C_LCB *l2cu_allocate_lcb (BD_ADDR p_bd_addr, BOOLEAN is_bonding, tBT_TRANSPORT transport);
-extern BOOLEAN  l2cu_start_post_bond_timer (UINT16 handle);
+extern tL2C_LCB *l2cu_allocate_lcb (BD_ADDR p_bd_addr, bool    is_bonding, tBT_TRANSPORT transport);
+extern bool     l2cu_start_post_bond_timer (uint16_t handle);
 extern void     l2cu_release_lcb (tL2C_LCB *p_lcb);
 extern tL2C_LCB *l2cu_find_lcb_by_bd_addr (BD_ADDR p_bd_addr, tBT_TRANSPORT transport);
-extern tL2C_LCB *l2cu_find_lcb_by_handle (UINT16 handle);
-extern void     l2cu_update_lcb_4_bonding (BD_ADDR p_bd_addr, BOOLEAN is_bonding);
+extern tL2C_LCB *l2cu_find_lcb_by_handle (uint16_t handle);
+extern void     l2cu_update_lcb_4_bonding (BD_ADDR p_bd_addr, bool    is_bonding);
 
-extern UINT8    l2cu_get_conn_role (tL2C_LCB *p_this_lcb);
-extern BOOLEAN  l2cu_set_acl_priority (BD_ADDR bd_addr, UINT8 priority, BOOLEAN reset_after_rs);
+extern uint8_t  l2cu_get_conn_role (tL2C_LCB *p_this_lcb);
+extern bool     l2cu_set_acl_priority (BD_ADDR bd_addr, uint8_t priority, bool    reset_after_rs);
 
 extern void     l2cu_enqueue_ccb (tL2C_CCB *p_ccb);
 extern void     l2cu_dequeue_ccb (tL2C_CCB *p_ccb);
 extern void     l2cu_change_pri_ccb (tL2C_CCB *p_ccb, tL2CAP_CHNL_PRIORITY priority);
 
-extern tL2C_CCB *l2cu_allocate_ccb (tL2C_LCB *p_lcb, UINT16 cid);
+extern tL2C_CCB *l2cu_allocate_ccb (tL2C_LCB *p_lcb, uint16_t cid);
 extern void     l2cu_release_ccb (tL2C_CCB *p_ccb);
-extern tL2C_CCB *l2cu_find_ccb_by_cid (tL2C_LCB *p_lcb, UINT16 local_cid);
-extern tL2C_CCB *l2cu_find_ccb_by_remote_cid (tL2C_LCB *p_lcb, UINT16 remote_cid);
-extern void     l2cu_adj_id (tL2C_LCB *p_lcb, UINT8 adj_mask);
-extern BOOLEAN  l2c_is_cmd_rejected (UINT8 cmd_code, UINT8 id, tL2C_LCB *p_lcb);
+extern tL2C_CCB *l2cu_find_ccb_by_cid (tL2C_LCB *p_lcb, uint16_t local_cid);
+extern tL2C_CCB *l2cu_find_ccb_by_remote_cid (tL2C_LCB *p_lcb, uint16_t remote_cid);
+extern void     l2cu_adj_id (tL2C_LCB *p_lcb, uint8_t adj_mask);
+extern bool     l2c_is_cmd_rejected (uint8_t cmd_code, uint8_t id, tL2C_LCB *p_lcb);
 
-extern void     l2cu_send_peer_cmd_reject (tL2C_LCB *p_lcb, UINT16 reason,
-                                           UINT8 rem_id,UINT16 p1, UINT16 p2);
+extern void     l2cu_send_peer_cmd_reject (tL2C_LCB *p_lcb, uint16_t reason,
+                                           uint8_t rem_id,uint16_t p1, uint16_t p2);
 extern void     l2cu_send_peer_connect_req (tL2C_CCB *p_ccb);
-extern void     l2cu_send_peer_connect_rsp (tL2C_CCB *p_ccb, UINT16 result, UINT16 status);
+extern void     l2cu_send_peer_connect_rsp (tL2C_CCB *p_ccb, uint16_t result, uint16_t status);
 extern void     l2cu_send_peer_config_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
 extern void     l2cu_send_peer_config_rsp (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
-extern void     l2cu_send_peer_config_rej (tL2C_CCB *p_ccb, UINT8 *p_data, UINT16 data_len, UINT16 rej_len);
+extern void     l2cu_send_peer_config_rej (tL2C_CCB *p_ccb, uint8_t *p_data, uint16_t data_len, uint16_t rej_len);
 extern void     l2cu_send_peer_disc_req (tL2C_CCB *p_ccb);
-extern void     l2cu_send_peer_disc_rsp (tL2C_LCB *p_lcb, UINT8 remote_id, UINT16 local_cid, UINT16 remote_cid);
-extern void     l2cu_send_peer_echo_req (tL2C_LCB *p_lcb, UINT8 *p_data, UINT16 data_len);
-extern void     l2cu_send_peer_echo_rsp (tL2C_LCB *p_lcb, UINT8 id, UINT8 *p_data, UINT16 data_len);
-extern void     l2cu_send_peer_info_rsp (tL2C_LCB *p_lcb, UINT8 id, UINT16 info_type);
-extern void     l2cu_reject_connection (tL2C_LCB *p_lcb, UINT16 remote_cid, UINT8 rem_id, UINT16 result);
-extern void     l2cu_send_peer_info_req (tL2C_LCB *p_lcb, UINT16 info_type);
+extern void     l2cu_send_peer_disc_rsp (tL2C_LCB *p_lcb, uint8_t remote_id, uint16_t local_cid, uint16_t remote_cid);
+extern void     l2cu_send_peer_echo_req (tL2C_LCB *p_lcb, uint8_t *p_data, uint16_t data_len);
+extern void     l2cu_send_peer_echo_rsp (tL2C_LCB *p_lcb, uint8_t id, uint8_t *p_data, uint16_t data_len);
+extern void     l2cu_send_peer_info_rsp (tL2C_LCB *p_lcb, uint8_t id, uint16_t info_type);
+extern void     l2cu_reject_connection (tL2C_LCB *p_lcb, uint16_t remote_cid, uint8_t rem_id, uint16_t result);
+extern void     l2cu_send_peer_info_req (tL2C_LCB *p_lcb, uint16_t info_type);
 extern void     l2cu_set_acl_hci_header (BT_HDR *p_buf, tL2C_CCB *p_ccb);
 extern void     l2cu_check_channel_congestion (tL2C_CCB *p_ccb);
 extern void     l2cu_disconnect_chnl (tL2C_CCB *p_ccb);
 
 #if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
-extern void     l2cu_set_non_flushable_pbf(BOOLEAN);
+extern void     l2cu_set_non_flushable_pbf(bool   );
 #endif
 
 #if (BLE_INCLUDED == TRUE)
-extern void l2cu_send_peer_ble_par_req (tL2C_LCB *p_lcb, UINT16 min_int, UINT16 max_int, UINT16 latency, UINT16 timeout);
-extern void l2cu_send_peer_ble_par_rsp (tL2C_LCB *p_lcb, UINT16 reason, UINT8 rem_id);
-extern void l2cu_reject_ble_connection (tL2C_LCB *p_lcb, UINT8 rem_id, UINT16 result);
-extern void l2cu_send_peer_ble_credit_based_conn_res (tL2C_CCB *p_ccb, UINT16 result);
+extern void l2cu_send_peer_ble_par_req (tL2C_LCB *p_lcb, uint16_t min_int, uint16_t max_int, uint16_t latency, uint16_t timeout);
+extern void l2cu_send_peer_ble_par_rsp (tL2C_LCB *p_lcb, uint16_t reason, uint8_t rem_id);
+extern void l2cu_reject_ble_connection (tL2C_LCB *p_lcb, uint8_t rem_id, uint16_t result);
+extern void l2cu_send_peer_ble_credit_based_conn_res (tL2C_CCB *p_ccb, uint16_t result);
 extern void l2cu_send_peer_ble_credit_based_conn_req (tL2C_CCB *p_ccb);
-extern void l2cu_send_peer_ble_flow_control_credit(tL2C_CCB *p_ccb, UINT16 credit_value);
+extern void l2cu_send_peer_ble_flow_control_credit(tL2C_CCB *p_ccb, uint16_t credit_value);
 extern void l2cu_send_peer_ble_credit_based_disconn_req(tL2C_CCB *p_ccb);
 #endif
 
-extern BOOLEAN l2cu_initialize_fixed_ccb (tL2C_LCB *p_lcb, UINT16 fixed_cid, tL2CAP_FCR_OPTS *p_fcr);
+extern bool    l2cu_initialize_fixed_ccb (tL2C_LCB *p_lcb, uint16_t fixed_cid, tL2CAP_FCR_OPTS *p_fcr);
 extern void    l2cu_no_dynamic_ccbs (tL2C_LCB *p_lcb);
 extern void    l2cu_process_fixed_chnl_resp (tL2C_LCB *p_lcb);
-extern BOOLEAN l2cu_is_ccb_active (tL2C_CCB *p_ccb);
+extern bool    l2cu_is_ccb_active (tL2C_CCB *p_ccb);
 
 /* Functions provided by l2c_ucd.c
 ************************************
@@ -647,41 +647,41 @@
 #if (L2CAP_UCD_INCLUDED == TRUE)
 void l2c_ucd_delete_sec_pending_q(tL2C_LCB  *p_lcb);
 void l2c_ucd_enqueue_pending_out_sec_q(tL2C_CCB  *p_ccb, void *p_data);
-BOOLEAN l2c_ucd_check_pending_info_req(tL2C_CCB  *p_ccb);
-BOOLEAN l2c_ucd_check_pending_out_sec_q(tL2C_CCB  *p_ccb);
+bool    l2c_ucd_check_pending_info_req(tL2C_CCB  *p_ccb);
+bool    l2c_ucd_check_pending_out_sec_q(tL2C_CCB  *p_ccb);
 void l2c_ucd_send_pending_out_sec_q(tL2C_CCB  *p_ccb);
 void l2c_ucd_discard_pending_out_sec_q(tL2C_CCB  *p_ccb);
-BOOLEAN l2c_ucd_check_pending_in_sec_q(tL2C_CCB  *p_ccb);
+bool    l2c_ucd_check_pending_in_sec_q(tL2C_CCB  *p_ccb);
 void l2c_ucd_send_pending_in_sec_q(tL2C_CCB  *p_ccb);
 void l2c_ucd_discard_pending_in_sec_q(tL2C_CCB  *p_ccb);
-BOOLEAN l2c_ucd_check_rx_pkts(tL2C_LCB  *p_lcb, BT_HDR *p_msg);
-BOOLEAN l2c_ucd_process_event(tL2C_CCB *p_ccb, UINT16 event, void *p_data);
+bool    l2c_ucd_check_rx_pkts(tL2C_LCB  *p_lcb, BT_HDR *p_msg);
+bool    l2c_ucd_process_event(tL2C_CCB *p_ccb, uint16_t event, void *p_data);
 #endif
 
 /* Functions provided for Broadcom Aware
 ****************************************
 */
-extern BOOLEAN  l2cu_check_feature_req (tL2C_LCB *p_lcb, UINT8 id, UINT8 *p_data, UINT16 data_len);
-extern void     l2cu_check_feature_rsp (tL2C_LCB *p_lcb, UINT8 id, UINT8 *p_data, UINT16 data_len);
+extern bool     l2cu_check_feature_req (tL2C_LCB *p_lcb, uint8_t id, uint8_t *p_data, uint16_t data_len);
+extern void     l2cu_check_feature_rsp (tL2C_LCB *p_lcb, uint8_t id, uint8_t *p_data, uint16_t data_len);
 extern void     l2cu_send_feature_req (tL2C_CCB *p_ccb);
 
-extern tL2C_RCB *l2cu_allocate_rcb (UINT16 psm);
-extern tL2C_RCB *l2cu_find_rcb_by_psm (UINT16 psm);
+extern tL2C_RCB *l2cu_allocate_rcb (uint16_t psm);
+extern tL2C_RCB *l2cu_find_rcb_by_psm (uint16_t psm);
 extern void     l2cu_release_rcb (tL2C_RCB *p_rcb);
-extern tL2C_RCB *l2cu_allocate_ble_rcb (UINT16 psm);
-extern tL2C_RCB *l2cu_find_ble_rcb_by_psm (UINT16 psm);
+extern tL2C_RCB *l2cu_allocate_ble_rcb (uint16_t psm);
+extern tL2C_RCB *l2cu_find_ble_rcb_by_psm (uint16_t psm);
 
-extern UINT8    l2cu_process_peer_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
+extern uint8_t  l2cu_process_peer_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
 extern void     l2cu_process_peer_cfg_rsp (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
 extern void     l2cu_process_our_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
 extern void     l2cu_process_our_cfg_rsp (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
 
 extern void     l2cu_device_reset (void);
 extern tL2C_LCB *l2cu_find_lcb_by_state (tL2C_LINK_STATE state);
-extern BOOLEAN  l2cu_lcb_disconnecting (void);
+extern bool     l2cu_lcb_disconnecting (void);
 
-extern BOOLEAN l2cu_create_conn (tL2C_LCB *p_lcb, tBT_TRANSPORT transport);
-extern BOOLEAN l2cu_create_conn_after_switch (tL2C_LCB *p_lcb);
+extern bool    l2cu_create_conn (tL2C_LCB *p_lcb, tBT_TRANSPORT transport);
+extern bool    l2cu_create_conn_after_switch (tL2C_LCB *p_lcb);
 extern BT_HDR *l2cu_get_next_buffer_to_send (tL2C_LCB *p_lcb);
 extern void    l2cu_resubmit_pending_sec_req (BD_ADDR p_bda);
 extern void    l2cu_initialize_amp_ccb (tL2C_LCB *p_lcb);
@@ -690,44 +690,44 @@
 /* Functions provided by l2c_link.c
 ************************************
 */
-extern BOOLEAN  l2c_link_hci_conn_req (BD_ADDR bd_addr);
-extern BOOLEAN  l2c_link_hci_conn_comp (UINT8 status, UINT16 handle, BD_ADDR p_bda);
-extern BOOLEAN  l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason);
-extern BOOLEAN  l2c_link_hci_qos_violation (UINT16 handle);
+extern bool     l2c_link_hci_conn_req (BD_ADDR bd_addr);
+extern bool     l2c_link_hci_conn_comp (uint8_t status, uint16_t handle, BD_ADDR p_bda);
+extern bool     l2c_link_hci_disc_comp (uint16_t handle, uint8_t reason);
+extern bool     l2c_link_hci_qos_violation (uint16_t handle);
 extern void     l2c_link_timeout (tL2C_LCB *p_lcb);
 extern void     l2c_info_resp_timer_timeout(void *data);
 extern void     l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf);
 extern void     l2c_link_adjust_allocation (void);
-extern void     l2c_link_process_num_completed_pkts (UINT8 *p);
-extern void     l2c_link_process_num_completed_blocks (UINT8 controller_id, UINT8 *p, UINT16 evt_len);
-extern void     l2c_link_processs_num_bufs (UINT16 num_lm_acl_bufs);
-extern UINT8    l2c_link_pkts_rcvd (UINT16 *num_pkts, UINT16 *handles);
-extern void     l2c_link_role_changed (BD_ADDR bd_addr, UINT8 new_role, UINT8 hci_status);
-extern void     l2c_link_sec_comp (BD_ADDR p_bda, tBT_TRANSPORT trasnport, void *p_ref_data, UINT8 status);
+extern void     l2c_link_process_num_completed_pkts (uint8_t *p);
+extern void     l2c_link_process_num_completed_blocks (uint8_t controller_id, uint8_t *p, uint16_t evt_len);
+extern void     l2c_link_processs_num_bufs (uint16_t num_lm_acl_bufs);
+extern uint8_t  l2c_link_pkts_rcvd (uint16_t *num_pkts, uint16_t *handles);
+extern void     l2c_link_role_changed (BD_ADDR bd_addr, uint8_t new_role, uint8_t hci_status);
+extern void     l2c_link_sec_comp (BD_ADDR p_bda, tBT_TRANSPORT trasnport, void *p_ref_data, uint8_t status);
 extern void     l2c_link_segments_xmitted (BT_HDR *p_msg);
 extern void     l2c_pin_code_request (BD_ADDR bd_addr);
 extern void     l2c_link_adjust_chnl_allocation (void);
 
 #if (BLE_INCLUDED == TRUE)
-extern void     l2c_link_processs_ble_num_bufs (UINT16 num_lm_acl_bufs);
+extern void     l2c_link_processs_ble_num_bufs (uint16_t num_lm_acl_bufs);
 #endif
 
-#if L2CAP_WAKE_PARKED_LINK == TRUE
-extern BOOLEAN  l2c_link_check_power_mode ( tL2C_LCB *p_lcb );
+#if (L2CAP_WAKE_PARKED_LINK == TRUE)
+extern bool     l2c_link_check_power_mode ( tL2C_LCB *p_lcb );
 #define L2C_LINK_CHECK_POWER_MODE(x) l2c_link_check_power_mode ((x))
 #else  // L2CAP_WAKE_PARKED_LINK
-#define L2C_LINK_CHECK_POWER_MODE(x) (FALSE)
+#define L2C_LINK_CHECK_POWER_MODE(x) (false)
 #endif  // L2CAP_WAKE_PARKED_LINK
 
-#if L2CAP_CONFORMANCE_TESTING == TRUE
+#if (L2CAP_CONFORMANCE_TESTING == TRUE)
 /* Used only for conformance testing */
-extern void l2cu_set_info_rsp_mask (UINT32 mask);
+extern void l2cu_set_info_rsp_mask (uint32_t mask);
 #endif
 
 /* Functions provided by l2c_csm.c
 ************************************
 */
-extern void l2c_csm_execute (tL2C_CCB *p_ccb, UINT16 event, void *p_data);
+extern void l2c_csm_execute (tL2C_CCB *p_ccb, uint16_t event, void *p_data);
 
 extern void l2c_enqueue_peer_data (tL2C_CCB *p_ccb, BT_HDR *p_buf);
 
@@ -739,20 +739,20 @@
 extern void     l2c_fcr_proc_pdu (tL2C_CCB *p_ccb, BT_HDR *p_buf);
 extern void     l2c_fcr_proc_tout (tL2C_CCB *p_ccb);
 extern void     l2c_fcr_proc_ack_tout (tL2C_CCB *p_ccb);
-extern void     l2c_fcr_send_S_frame (tL2C_CCB *p_ccb, UINT16 function_code, UINT16 pf_bit);
-extern BT_HDR   *l2c_fcr_clone_buf(BT_HDR *p_buf, UINT16 new_offset, UINT16 no_of_bytes);
-extern BOOLEAN  l2c_fcr_is_flow_controlled (tL2C_CCB *p_ccb);
-extern BT_HDR   *l2c_fcr_get_next_xmit_sdu_seg (tL2C_CCB *p_ccb, UINT16 max_packet_length);
+extern void     l2c_fcr_send_S_frame (tL2C_CCB *p_ccb, uint16_t function_code, uint16_t pf_bit);
+extern BT_HDR   *l2c_fcr_clone_buf(BT_HDR *p_buf, uint16_t new_offset, uint16_t no_of_bytes);
+extern bool     l2c_fcr_is_flow_controlled (tL2C_CCB *p_ccb);
+extern BT_HDR   *l2c_fcr_get_next_xmit_sdu_seg (tL2C_CCB *p_ccb, uint16_t max_packet_length);
 extern void     l2c_fcr_start_timer (tL2C_CCB *p_ccb);
 extern void     l2c_lcc_proc_pdu (tL2C_CCB *p_ccb, BT_HDR *p_buf);
-extern BT_HDR   *l2c_lcc_get_next_xmit_sdu_seg (tL2C_CCB *p_ccb, UINT16 max_packet_length);
+extern BT_HDR   *l2c_lcc_get_next_xmit_sdu_seg (tL2C_CCB *p_ccb, uint16_t max_packet_length);
 
 /* Configuration negotiation */
-extern UINT8    l2c_fcr_chk_chan_modes (tL2C_CCB *p_ccb);
-extern BOOLEAN  l2c_fcr_adj_our_req_options (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
+extern uint8_t  l2c_fcr_chk_chan_modes (tL2C_CCB *p_ccb);
+extern bool     l2c_fcr_adj_our_req_options (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
 extern void     l2c_fcr_adj_our_rsp_options (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_peer_cfg);
-extern BOOLEAN  l2c_fcr_renegotiate_chan(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
-extern UINT8    l2c_fcr_process_peer_cfg_req(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
+extern bool     l2c_fcr_renegotiate_chan(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
+extern uint8_t  l2c_fcr_process_peer_cfg_req(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
 extern void     l2c_fcr_adj_monitor_retran_timeout (tL2C_CCB *p_ccb);
 extern void     l2c_fcr_stop_timer (tL2C_CCB *p_ccb);
 
@@ -760,32 +760,32 @@
 ************************************
 */
 #if (BLE_INCLUDED == TRUE)
-extern BOOLEAN l2cble_create_conn (tL2C_LCB *p_lcb);
-extern void l2cble_process_sig_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len);
-extern void l2cble_conn_comp (UINT16 handle, UINT8 role, BD_ADDR bda, tBLE_ADDR_TYPE type,
-                              UINT16 conn_interval, UINT16 conn_latency, UINT16 conn_timeout);
-extern BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb);
+extern bool    l2cble_create_conn (tL2C_LCB *p_lcb);
+extern void l2cble_process_sig_cmd (tL2C_LCB *p_lcb, uint8_t *p, uint16_t pkt_len);
+extern void l2cble_conn_comp (uint16_t handle, uint8_t role, BD_ADDR bda, tBLE_ADDR_TYPE type,
+                              uint16_t conn_interval, uint16_t conn_latency, uint16_t conn_timeout);
+extern bool    l2cble_init_direct_conn (tL2C_LCB *p_lcb);
 extern void l2cble_notify_le_connection (BD_ADDR bda);
 extern void l2c_ble_link_adjust_allocation (void);
-extern void l2cble_process_conn_update_evt (UINT16 handle, UINT8 status,
-                        UINT16 interval, UINT16 latency, UINT16 timeout);
+extern void l2cble_process_conn_update_evt (uint16_t handle, uint8_t status,
+                        uint16_t interval, uint16_t latency, uint16_t timeout);
 
 extern void l2cble_credit_based_conn_req (tL2C_CCB *p_ccb);
-extern void l2cble_credit_based_conn_res (tL2C_CCB *p_ccb, UINT16 result);
+extern void l2cble_credit_based_conn_res (tL2C_CCB *p_ccb, uint16_t result);
 extern void l2cble_send_peer_disc_req(tL2C_CCB *p_ccb);
-extern void l2cble_send_flow_control_credit(tL2C_CCB *p_ccb, UINT16 credit_value);
-extern BOOLEAN l2ble_sec_access_req(BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_originator, tL2CAP_SEC_CBACK *p_callback, void *p_ref_data);
+extern void l2cble_send_flow_control_credit(tL2C_CCB *p_ccb, uint16_t credit_value);
+extern bool    l2ble_sec_access_req(BD_ADDR bd_addr, uint16_t psm, bool    is_originator, tL2CAP_SEC_CBACK *p_callback, void *p_ref_data);
 
-#if (defined BLE_LLT_INCLUDED) && (BLE_LLT_INCLUDED == TRUE)
-extern void l2cble_process_rc_param_request_evt(UINT16 handle, UINT16 int_min, UINT16 int_max,
-                                                        UINT16 latency, UINT16 timeout);
+#if (BLE_LLT_INCLUDED == TRUE)
+extern void l2cble_process_rc_param_request_evt(uint16_t handle, uint16_t int_min, uint16_t int_max,
+                                                        uint16_t latency, uint16_t timeout);
 #endif
 
 extern void l2cble_update_data_length(tL2C_LCB *p_lcb);
-extern void l2cble_set_fixed_channel_tx_data_length(BD_ADDR remote_bda, UINT16 fix_cid,
-                                                                UINT16 tx_mtu);
-extern void l2cble_process_data_length_change_event(UINT16 handle, UINT16 tx_data_len,
-                                                                UINT16 rx_data_len);
+extern void l2cble_set_fixed_channel_tx_data_length(BD_ADDR remote_bda, uint16_t fix_cid,
+                                                                uint16_t tx_mtu);
+extern void l2cble_process_data_length_change_event(uint16_t handle, uint16_t tx_data_len,
+                                                                uint16_t rx_data_len);
 
 #endif
 extern void l2cu_process_fixed_disc_cback (tL2C_LCB *p_lcb);
diff --git a/stack/l2cap/l2c_link.c b/stack/l2cap/l2c_link.c
index 2fefd13..5e7720a 100644
--- a/stack/l2cap/l2c_link.c
+++ b/stack/l2cap/l2c_link.c
@@ -45,7 +45,7 @@
 
 extern fixed_queue_t *btu_general_alarm_queue;
 
-static BOOLEAN l2c_link_send_to_lower (tL2C_LCB *p_lcb, BT_HDR *p_buf);
+static bool    l2c_link_send_to_lower (tL2C_LCB *p_lcb, BT_HDR *p_buf);
 
 /*******************************************************************************
 **
@@ -54,15 +54,15 @@
 ** Description      This function is called when an HCI Connection Request
 **                  event is received.
 **
-** Returns          TRUE, if accept conn
+** Returns          true, if accept conn
 **
 *******************************************************************************/
-BOOLEAN l2c_link_hci_conn_req (BD_ADDR bd_addr)
+bool    l2c_link_hci_conn_req (BD_ADDR bd_addr)
 {
     tL2C_LCB        *p_lcb;
     tL2C_LCB        *p_lcb_cur;
     int             xx;
-    BOOLEAN         no_links;
+    bool            no_links;
 
     /* See if we have a link control block for the remote device */
     p_lcb = l2cu_find_lcb_by_bd_addr (bd_addr, BT_TRANSPORT_BR_EDR);
@@ -70,15 +70,15 @@
     /* If we don't have one, create one and accept the connection. */
     if (!p_lcb)
     {
-        p_lcb = l2cu_allocate_lcb (bd_addr, FALSE, BT_TRANSPORT_BR_EDR);
+        p_lcb = l2cu_allocate_lcb (bd_addr, false, BT_TRANSPORT_BR_EDR);
         if (!p_lcb)
         {
             btsnd_hcic_reject_conn (bd_addr, HCI_ERR_HOST_REJECT_RESOURCES);
             L2CAP_TRACE_ERROR ("L2CAP failed to allocate LCB");
-            return FALSE;
+            return false;
         }
 
-        no_links = TRUE;
+        no_links = true;
 
         /* If we already have connection, accept as a master */
         for (xx = 0, p_lcb_cur = &l2cb.lcb_pool[0]; xx < MAX_L2CAP_LINKS; xx++, p_lcb_cur++)
@@ -88,7 +88,7 @@
 
             if (p_lcb_cur->in_use)
             {
-                no_links = FALSE;
+                no_links = false;
                 p_lcb->link_role = HCI_ROLE_MASTER;
                 break;
             }
@@ -112,7 +112,7 @@
         alarm_set_on_queue(p_lcb->l2c_lcb_timer, L2CAP_LINK_CONNECT_TIMEOUT_MS,
                            l2c_lcb_timer_timeout, p_lcb,
                            btu_general_alarm_queue);
-        return (TRUE);
+        return (true);
     }
 
     /* We already had a link control block to the guy. Check what state it is in */
@@ -128,7 +128,7 @@
         btsnd_hcic_accept_conn (bd_addr, p_lcb->link_role);
 
         p_lcb->link_state = LST_CONNECTING;
-        return (TRUE);
+        return (true);
     }
     else if (p_lcb->link_state == LST_DISCONNECTING)
     {
@@ -142,7 +142,7 @@
         /* Reject the connection with ACL Connection Already exist reason */
         btsnd_hcic_reject_conn (bd_addr, HCI_ERR_CONNECTION_EXISTS);
     }
-    return (FALSE);
+    return (false);
 }
 
 /*******************************************************************************
@@ -155,7 +155,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-BOOLEAN l2c_link_hci_conn_comp (UINT8 status, UINT16 handle, BD_ADDR p_bda)
+bool    l2c_link_hci_conn_comp (uint8_t status, uint16_t handle, BD_ADDR p_bda)
 {
     tL2C_CONN_INFO       ci;
     tL2C_LCB            *p_lcb;
@@ -175,7 +175,7 @@
     if (!p_lcb)
     {
         L2CAP_TRACE_WARNING ("L2CAP got conn_comp for unknown BD_ADDR");
-        return (FALSE);
+        return (false);
     }
 
     if (p_lcb->link_state != LST_CONNECTING)
@@ -185,7 +185,7 @@
         if (status != HCI_SUCCESS)
             l2c_link_hci_disc_comp (p_lcb->handle, status);
 
-        return (FALSE);
+        return (false);
     }
 
     /* Save the handle */
@@ -213,11 +213,11 @@
         if (p_lcb->is_bonding)
         {
             if (l2cu_start_post_bond_timer(handle))
-                return (TRUE);
+                return (true);
         }
 
         /* Update the timeouts in the hold queue */
-        l2c_process_held_packets(FALSE);
+        l2c_process_held_packets(false);
 
         alarm_cancel(p_lcb->l2c_lcb_timer);
 
@@ -283,7 +283,7 @@
             }
         }
     }
-    return (TRUE);
+    return (true);
 }
 
 
@@ -297,13 +297,13 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2c_link_sec_comp (BD_ADDR p_bda, tBT_TRANSPORT transport, void *p_ref_data, UINT8 status)
+void l2c_link_sec_comp (BD_ADDR p_bda, tBT_TRANSPORT transport, void *p_ref_data, uint8_t status)
 {
     tL2C_CONN_INFO  ci;
     tL2C_LCB        *p_lcb;
     tL2C_CCB        *p_ccb;
     tL2C_CCB        *p_next_ccb;
-    UINT8           event;
+    uint8_t         event;
 
     UNUSED(transport);
 
@@ -363,15 +363,15 @@
 ** Description      This function is called when an HCI Disconnect Complete
 **                  event is received.
 **
-** Returns          TRUE if the link is known about, else FALSE
+** Returns          true if the link is known about, else false
 **
 *******************************************************************************/
-BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
+bool    l2c_link_hci_disc_comp (uint16_t handle, uint8_t reason)
 {
     tL2C_LCB    *p_lcb;
     tL2C_CCB    *p_ccb;
-    BOOLEAN     status = TRUE;
-    BOOLEAN     lcb_is_free = TRUE;
+    bool        status = true;
+    bool        lcb_is_free = true;
     tBT_TRANSPORT   transport = BT_TRANSPORT_BR_EDR;
 
     /* See if we have a link control block for the connection */
@@ -380,7 +380,7 @@
     /* If we don't have one, maybe an SCO link. Send to MM */
     if (!p_lcb)
     {
-        status = FALSE;
+        status = false;
     }
     else
     {
@@ -397,7 +397,7 @@
 #if (BLE_INCLUDED == TRUE)
         /* Check for BLE and handle that differently */
         if (p_lcb->transport == BT_TRANSPORT_LE)
-            btm_ble_update_link_topology_mask(p_lcb->link_role, FALSE);
+            btm_ble_update_link_topology_mask(p_lcb->link_role, false);
 #endif
         /* Link is disconnected. For all channels, send the event through */
         /* their FSMs. The CCBs should remove themselves from the LCB     */
@@ -434,11 +434,11 @@
         {
             L2CAP_TRACE_DEBUG("l2c_link_hci_disc_comp: Restarting pending ACL request");
             transport = p_lcb->transport;
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
             /* for LE link, always drop and re-open to ensure to get LE remote feature */
             if (p_lcb->transport == BT_TRANSPORT_LE)
             {
-                l2cb.is_ble_connecting = FALSE;
+                l2cb.is_ble_connecting = false;
                 btm_acl_removed (p_lcb->remote_bd_addr, p_lcb->transport);
                 /* Release any held buffers */
                 BT_HDR *p_buf;
@@ -460,12 +460,12 @@
           {
               if (p_lcb->p_fixed_ccbs[xx] && p_lcb->p_fixed_ccbs[xx] != p_lcb->p_pending_ccb)
               {
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
                   (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(xx + L2CAP_FIRST_FIXED_CHNL,
-                          p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, p_lcb->transport);
+                          p_lcb->remote_bd_addr, false, p_lcb->disc_reason, p_lcb->transport);
 #else
                   (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(xx + L2CAP_FIRST_FIXED_CHNL,
-                          p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, BT_TRANSPORT_BR_EDR);
+                          p_lcb->remote_bd_addr, false, p_lcb->disc_reason, BT_TRANSPORT_BR_EDR);
 #endif
                     if (p_lcb->p_fixed_ccbs[xx] == NULL) {
                       bdstr_t bd_addr_str = {0};
@@ -488,7 +488,7 @@
 #endif
         }
             if (l2cu_create_conn(p_lcb, transport))
-                lcb_is_free = FALSE; /* still using this lcb */
+                lcb_is_free = false; /* still using this lcb */
         }
 
         p_lcb->p_pending_ccb = NULL;
@@ -516,10 +516,10 @@
 ** Description      This function is called when an HCI QOS Violation
 **                  event is received.
 **
-** Returns          TRUE if the link is known about, else FALSE
+** Returns          true if the link is known about, else false
 **
 *******************************************************************************/
-BOOLEAN l2c_link_hci_qos_violation (UINT16 handle)
+bool    l2c_link_hci_qos_violation (uint16_t handle)
 {
     tL2C_LCB        *p_lcb;
     tL2C_CCB        *p_ccb;
@@ -529,7 +529,7 @@
 
     /* If we don't have one, maybe an SCO link. */
     if (!p_lcb)
-        return (FALSE);
+        return (false);
 
     /* For all channels, tell the upper layer about it */
     for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; p_ccb = p_ccb->p_next_ccb)
@@ -538,7 +538,7 @@
             l2c_csm_execute (p_ccb, L2CEVT_LP_QOS_VIOLATION_IND, NULL);
     }
 
-    return (TRUE);
+    return (true);
 }
 
 
@@ -580,7 +580,7 @@
         }
 #if (BLE_INCLUDED == TRUE)
         if (p_lcb->link_state == LST_CONNECTING &&
-            l2cb.is_ble_connecting == TRUE)
+            l2cb.is_ble_connecting == true)
         {
             L2CA_CancelBleConnectReq(l2cb.ble_connecting_bda);
         }
@@ -704,7 +704,7 @@
             }
         }
 
-        p_lcb->w4_info_rsp = FALSE;
+        p_lcb->w4_info_rsp = false;
 
         /* If link is in process of being brought up */
         if ((p_lcb->link_state != LST_DISCONNECTED) &&
@@ -742,13 +742,13 @@
 *******************************************************************************/
 void l2c_link_adjust_allocation (void)
 {
-    UINT16      qq, yy, qq_remainder;
+    uint16_t    qq, yy, qq_remainder;
     tL2C_LCB    *p_lcb;
-    UINT16      hi_quota, low_quota;
-    UINT16      num_lowpri_links = 0;
-    UINT16      num_hipri_links  = 0;
-    UINT16      controller_xmit_quota = l2cb.num_lm_acl_bufs;
-    UINT16      high_pri_link_quota = L2CAP_HIGH_PRI_MIN_XMIT_QUOTA_A;
+    uint16_t    hi_quota, low_quota;
+    uint16_t    num_lowpri_links = 0;
+    uint16_t    num_hipri_links  = 0;
+    uint16_t    controller_xmit_quota = l2cb.num_lm_acl_bufs;
+    uint16_t    high_pri_link_quota = L2CAP_HIGH_PRI_MIN_XMIT_QUOTA_A;
 
     /* If no links active, reset buffer quotas and controller buffers */
     if (l2cb.num_links_active == 0)
@@ -869,7 +869,7 @@
 *******************************************************************************/
 void l2c_link_adjust_chnl_allocation (void)
 {
-    UINT8       xx;
+    uint8_t     xx;
 
     L2CAP_TRACE_DEBUG("%s", __func__);
 
@@ -904,7 +904,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2c_link_processs_num_bufs (UINT16 num_lm_acl_bufs)
+void l2c_link_processs_num_bufs (uint16_t num_lm_acl_bufs)
 {
     l2cb.num_lm_acl_bufs = l2cb.controller_xmit_window = num_lm_acl_bufs;
 
@@ -922,9 +922,9 @@
 ** Returns          count of number of entries filled in
 **
 *******************************************************************************/
-UINT8 l2c_link_pkts_rcvd (UINT16 *num_pkts, UINT16 *handles)
+uint8_t l2c_link_pkts_rcvd (uint16_t *num_pkts, uint16_t *handles)
 {
-    UINT8       num_found = 0;
+    uint8_t     num_found = 0;
 
     UNUSED(num_pkts);
     UNUSED(handles);
@@ -942,7 +942,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2c_link_role_changed (BD_ADDR bd_addr, UINT8 new_role, UINT8 hci_status)
+void l2c_link_role_changed (BD_ADDR bd_addr, uint8_t new_role, uint8_t hci_status)
 {
     tL2C_LCB *p_lcb;
     int      xx;
@@ -958,7 +958,7 @@
 
             /* Reset high priority link if needed */
             if (hci_status == HCI_SUCCESS)
-                l2cu_set_acl_priority(bd_addr, p_lcb->acl_priority, TRUE);
+                l2cu_set_acl_priority(bd_addr, p_lcb->acl_priority, true);
         }
     }
 
@@ -998,22 +998,22 @@
     }
 }
 
-#if L2CAP_WAKE_PARKED_LINK == TRUE
+#if (L2CAP_WAKE_PARKED_LINK == TRUE)
 /*******************************************************************************
 **
 ** Function         l2c_link_check_power_mode
 **
 ** Description      This function is called to check power mode.
 **
-** Returns          TRUE if link is going to be active from park
-**                  FALSE if nothing to send or not in park mode
+** Returns          true if link is going to be active from park
+**                  false if nothing to send or not in park mode
 **
 *******************************************************************************/
-BOOLEAN l2c_link_check_power_mode (tL2C_LCB *p_lcb)
+bool    l2c_link_check_power_mode (tL2C_LCB *p_lcb)
 {
     tBTM_PM_MODE     mode;
     tL2C_CCB    *p_ccb;
-    BOOLEAN need_to_active = FALSE;
+    bool    need_to_active = false;
 
     /*
      * We only switch park to active only if we have unsent packets
@@ -1024,13 +1024,13 @@
         {
             if (!fixed_queue_is_empty(p_ccb->xmit_hold_q))
             {
-                need_to_active = TRUE;
+                need_to_active = true;
                 break;
             }
         }
     }
     else
-        need_to_active = TRUE;
+        need_to_active = true;
 
     /* if we have packets to send */
     if ( need_to_active )
@@ -1042,11 +1042,11 @@
             {
                 L2CAP_TRACE_DEBUG ("LCB(0x%x) is in PM pending state", p_lcb->handle);
 
-                return TRUE;
+                return true;
             }
         }
     }
-    return FALSE;
+    return false;
 }
 #endif /* L2CAP_WAKE_PARKED_LINK == TRUE) */
 
@@ -1064,7 +1064,7 @@
 void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf)
 {
     int         xx;
-    BOOLEAN     single_write = FALSE;
+    bool        single_write = false;
 
     /* Save the channel ID for faster counting */
     if (p_buf)
@@ -1072,7 +1072,7 @@
         if (p_ccb != NULL)
         {
             p_buf->event = p_ccb->local_cid;
-            single_write = TRUE;
+            single_write = true;
         }
         else
             p_buf->event = 0;
@@ -1082,12 +1082,12 @@
 
         if (p_lcb->link_xmit_quota == 0)
         {
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
             if (p_lcb->transport == BT_TRANSPORT_LE)
-                l2cb.ble_check_round_robin = TRUE;
+                l2cb.ble_check_round_robin = true;
             else
 #endif
-                l2cb.check_round_robin = TRUE;
+                l2cb.check_round_robin = true;
         }
     }
 
@@ -1161,13 +1161,13 @@
           && (p_lcb->transport == BT_TRANSPORT_BR_EDR)
 #endif
           )
-            l2cb.check_round_robin = FALSE;
+            l2cb.check_round_robin = false;
 
 #if (BLE_INCLUDED == TRUE)
         if ( (l2cb.controller_le_xmit_window > 0)
           && (l2cb.ble_round_robin_unacked < l2cb.ble_round_robin_quota)
           && (p_lcb->transport == BT_TRANSPORT_LE))
-            l2cb.ble_check_round_robin = FALSE;
+            l2cb.ble_check_round_robin = false;
 #endif
     }
     else /* if this is not round-robin service */
@@ -1234,13 +1234,13 @@
 **
 ** Description      This function queues the buffer for HCI transmission
 **
-** Returns          TRUE for success, FALSE for fail
+** Returns          true for success, false for fail
 **
 *******************************************************************************/
-static BOOLEAN l2c_link_send_to_lower (tL2C_LCB *p_lcb, BT_HDR *p_buf)
+static bool    l2c_link_send_to_lower (tL2C_LCB *p_lcb, BT_HDR *p_buf)
 {
-    UINT16      num_segs;
-    UINT16      xmit_window, acl_data_size;
+    uint16_t    num_segs;
+    uint16_t    xmit_window, acl_data_size;
     const controller_t *controller = controller_get_interface();
 
     if ((p_buf->len <= controller->get_acl_packet_size_classic()
@@ -1268,7 +1268,7 @@
         if (p_lcb->transport == BT_TRANSPORT_LE)
         {
             l2cb.controller_le_xmit_window--;
-            bte_main_hci_send(p_buf, (UINT16)(BT_EVT_TO_LM_HCI_ACL|LOCAL_BLE_CONTROLLER_ID));
+            bte_main_hci_send(p_buf, (uint16_t)(BT_EVT_TO_LM_HCI_ACL|LOCAL_BLE_CONTROLLER_ID));
         }
         else
 #endif
@@ -1279,7 +1279,7 @@
     }
     else
     {
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         if (p_lcb->transport == BT_TRANSPORT_LE)
         {
             acl_data_size = controller->get_acl_data_size_ble();
@@ -1299,7 +1299,7 @@
         if (p_lcb->link_xmit_quota == 0)
         {
             num_segs = 1;
-            p_lcb->partial_segment_being_sent = TRUE;
+            p_lcb->partial_segment_being_sent = true;
         }
         else
         {
@@ -1307,18 +1307,18 @@
             if (num_segs > xmit_window)
             {
                 num_segs = xmit_window;
-                p_lcb->partial_segment_being_sent = TRUE;
+                p_lcb->partial_segment_being_sent = true;
             }
 
             if (num_segs > (p_lcb->link_xmit_quota - p_lcb->sent_not_acked))
             {
                 num_segs = (p_lcb->link_xmit_quota - p_lcb->sent_not_acked);
-                p_lcb->partial_segment_being_sent = TRUE;
+                p_lcb->partial_segment_being_sent = true;
             }
         }
 
         p_buf->layer_specific        = num_segs;
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         if (p_lcb->transport == BT_TRANSPORT_LE)
         {
             l2cb.controller_le_xmit_window -= num_segs;
@@ -1335,10 +1335,10 @@
         }
 
         p_lcb->sent_not_acked += num_segs;
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         if (p_lcb->transport == BT_TRANSPORT_LE)
         {
-            bte_main_hci_send(p_buf, (UINT16)(BT_EVT_TO_LM_HCI_ACL|LOCAL_BLE_CONTROLLER_ID));
+            bte_main_hci_send(p_buf, (uint16_t)(BT_EVT_TO_LM_HCI_ACL|LOCAL_BLE_CONTROLLER_ID));
         }
         else
 #endif
@@ -1368,7 +1368,7 @@
     }
 #endif
 
-    return TRUE;
+    return true;
 }
 
 /*******************************************************************************
@@ -1382,11 +1382,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2c_link_process_num_completed_pkts (UINT8 *p)
+void l2c_link_process_num_completed_pkts (uint8_t *p)
 {
-    UINT8       num_handles, xx;
-    UINT16      handle;
-    UINT16      num_sent;
+    uint8_t     num_handles, xx;
+    uint16_t    handle;
+    uint16_t    num_sent;
     tL2C_LCB    *p_lcb;
 
     STREAM_TO_UINT8 (num_handles, p);
@@ -1420,7 +1420,7 @@
             /* If doing round-robin, adjust communal counts */
             if (p_lcb->link_xmit_quota == 0)
             {
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
                 if (p_lcb->transport == BT_TRANSPORT_LE)
                 {
                    /* Don't go negative */
@@ -1455,7 +1455,7 @@
             {
               l2c_link_check_send_pkts (NULL, NULL, NULL);
             }
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
             if ((p_lcb->transport == BT_TRANSPORT_LE)
                 && (p_lcb->acl_priority == L2CAP_PRIORITY_HIGH)
                 && ((l2cb.ble_check_round_robin)
@@ -1505,7 +1505,7 @@
 #endif
     }
 
-#if (defined(HCILP_INCLUDED) && HCILP_INCLUDED == TRUE)
+#if (HCILP_INCLUDED == TRUE)
     /* only full stack can enable sleep mode */
     btu_check_bt_sleep ();
 #endif
@@ -1523,8 +1523,8 @@
 *******************************************************************************/
 void l2c_link_segments_xmitted (BT_HDR *p_msg)
 {
-    UINT8       *p = (UINT8 *)(p_msg + 1) + p_msg->offset;
-    UINT16      handle;
+    uint8_t     *p = (uint8_t *)(p_msg + 1) + p_msg->offset;
+    uint16_t    handle;
     tL2C_LCB    *p_lcb;
 
     /* Extract the handle */
@@ -1545,7 +1545,7 @@
         /* if we can transmit anything more.                             */
         list_prepend(p_lcb->link_xmit_data_q, p_msg);
 
-        p_lcb->partial_segment_being_sent = FALSE;
+        p_lcb->partial_segment_being_sent = false;
 
         l2c_link_check_send_pkts (p_lcb, NULL, NULL);
     }
diff --git a/stack/l2cap/l2c_main.c b/stack/l2cap/l2c_main.c
index dab56a2..7849f1b 100644
--- a/stack/l2cap/l2c_main.c
+++ b/stack/l2cap/l2c_main.c
@@ -45,12 +45,12 @@
 /********************************************************************************/
 /*              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 *p, UINT16 pkt_len);
+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                     */
 /********************************************************************************/
-#if L2C_DYNAMIC_MEMORY == FALSE
+#if (L2C_DYNAMIC_MEMORY == FALSE)
 tL2C_CB l2cb;
 #endif
 
@@ -66,13 +66,13 @@
 *******************************************************************************/
 void l2c_rcv_acl_data (BT_HDR *p_msg)
 {
-    UINT8       *p = (UINT8 *)(p_msg + 1) + p_msg->offset;
-    UINT16      handle, hci_len;
-    UINT8       pkt_type;
+    uint8_t     *p = (uint8_t *)(p_msg + 1) + p_msg->offset;
+    uint16_t    handle, hci_len;
+    uint8_t     pkt_type;
     tL2C_LCB    *p_lcb;
     tL2C_CCB    *p_ccb = NULL;
-    UINT16      l2cap_len, rcv_cid, psm;
-    UINT16      credit;
+    uint16_t    l2cap_len, rcv_cid, psm;
+    uint16_t    credit;
 
     /* Extract the handle */
     STREAM_TO_UINT16 (handle, p);
@@ -86,7 +86,7 @@
         /* Find the LCB based on the handle */
         if ((p_lcb = l2cu_find_lcb_by_handle (handle)) == NULL)
         {
-            UINT8       cmd_code;
+            uint8_t     cmd_code;
 
             /* There is a slight possibility (specifically with USB) that we get an */
             /* L2CAP connection request before we get the HCI connection complete.  */
@@ -136,7 +136,7 @@
     STREAM_TO_UINT16 (l2cap_len, p);
     STREAM_TO_UINT16 (rcv_cid, p);
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
    /* for BLE channel, always notify connection when ACL data received on the link */
    if (p_lcb && p_lcb->transport == BT_TRANSPORT_LE && p_lcb->link_state != LST_DISCONNECTING)
       /* only process fixed channel data as channel open indication when link is not in disconnecting mode */
@@ -268,21 +268,21 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len)
+static void process_l2cap_cmd (tL2C_LCB *p_lcb, uint8_t *p, uint16_t pkt_len)
 {
-    UINT8           *p_pkt_end, *p_next_cmd, *p_cfg_end, *p_cfg_start;
-    UINT8           cmd_code, cfg_code, cfg_len, id;
+    uint8_t         *p_pkt_end, *p_next_cmd, *p_cfg_end, *p_cfg_start;
+    uint8_t         cmd_code, cfg_code, cfg_len, id;
     tL2C_CONN_INFO  con_info;
     tL2CAP_CFG_INFO cfg_info;
-    UINT16          rej_reason, rej_mtu, lcid, rcid, info_type;
+    uint16_t        rej_reason, rej_mtu, lcid, rcid, info_type;
     tL2C_CCB        *p_ccb;
     tL2C_RCB        *p_rcb;
-    BOOLEAN         cfg_rej, pkt_size_rej = FALSE;
-    UINT16          cfg_rej_len, cmd_len;
-    UINT16          result;
+    bool            cfg_rej, pkt_size_rej = false;
+    uint16_t        cfg_rej_len, cmd_len;
+    uint16_t        result;
     tL2C_CONN_INFO  ci;
 
-#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE)
+#if (BLE_INCLUDED == TRUE)
     /* if l2cap command received in CID 1 on top of an LE link, ignore this command */
     if (p_lcb->transport == BT_TRANSPORT_LE)
         return;
@@ -295,7 +295,7 @@
         ** L2cap packet.  If only responses in the packet, then it will be ignored.
         ** Here we simply mark the bad packet and decide which cmd ID to reject later
         */
-        pkt_size_rej = TRUE;
+        pkt_size_rej = true;
         L2CAP_TRACE_ERROR ("L2CAP SIG MTU Pkt Len Exceeded (672) -> pkt_len: %d", pkt_len);
     }
 
@@ -305,7 +305,7 @@
     memset (&cfg_info, 0, sizeof(cfg_info));
 
     /* An L2CAP packet may contain multiple commands */
-    while (TRUE)
+    while (true)
     {
         /* Smallest command is 4 bytes */
         if ((p = p_next_cmd) > (p_pkt_end - 4))
@@ -368,7 +368,7 @@
             {
                 alarm_cancel(p_lcb->info_resp_timer);
 
-                p_lcb->w4_info_rsp = FALSE;
+                p_lcb->w4_info_rsp = false;
                 ci.status = HCI_SUCCESS;
                 memcpy (ci.bd_addr, p_lcb->remote_bd_addr, sizeof(BD_ADDR));
 
@@ -441,7 +441,7 @@
 
         case L2CAP_CMD_CONFIG_REQ:
             p_cfg_end = p + cmd_len;
-            cfg_rej = FALSE;
+            cfg_rej = false;
             cfg_rej_len = 0;
 
             STREAM_TO_UINT16 (lcid, p);
@@ -450,7 +450,7 @@
             p_cfg_start = p;
 
             cfg_info.flush_to_present = cfg_info.mtu_present = cfg_info.qos_present =
-                cfg_info.fcr_present = cfg_info.fcs_present = FALSE;
+                cfg_info.fcr_present = cfg_info.fcs_present = false;
 
             while (p < p_cfg_end)
             {
@@ -460,17 +460,17 @@
                 switch (cfg_code & 0x7F)
                 {
                 case L2CAP_CFG_TYPE_MTU:
-                    cfg_info.mtu_present = TRUE;
+                    cfg_info.mtu_present = true;
                     STREAM_TO_UINT16 (cfg_info.mtu, p);
                     break;
 
                 case L2CAP_CFG_TYPE_FLUSH_TOUT:
-                    cfg_info.flush_to_present = TRUE;
+                    cfg_info.flush_to_present = true;
                     STREAM_TO_UINT16 (cfg_info.flush_to, p);
                     break;
 
                 case L2CAP_CFG_TYPE_QOS:
-                    cfg_info.qos_present = TRUE;
+                    cfg_info.qos_present = true;
                     STREAM_TO_UINT8  (cfg_info.qos.qos_flags, p);
                     STREAM_TO_UINT8  (cfg_info.qos.service_type, p);
                     STREAM_TO_UINT32 (cfg_info.qos.token_rate, p);
@@ -481,7 +481,7 @@
                     break;
 
                 case L2CAP_CFG_TYPE_FCR:
-                    cfg_info.fcr_present = TRUE;
+                    cfg_info.fcr_present = true;
                     STREAM_TO_UINT8 (cfg_info.fcr.mode, p);
                     STREAM_TO_UINT8 (cfg_info.fcr.tx_win_sz, p);
                     STREAM_TO_UINT8 (cfg_info.fcr.max_transmit, p);
@@ -491,12 +491,12 @@
                     break;
 
                 case L2CAP_CFG_TYPE_FCS:
-                    cfg_info.fcs_present = TRUE;
+                    cfg_info.fcs_present = true;
                     STREAM_TO_UINT8 (cfg_info.fcs, p);
                     break;
 
                 case L2CAP_CFG_TYPE_EXT_FLOW:
-                    cfg_info.ext_flow_spec_present = TRUE;
+                    cfg_info.ext_flow_spec_present = true;
                     STREAM_TO_UINT8  (cfg_info.ext_flow_spec.id, p);
                     STREAM_TO_UINT8  (cfg_info.ext_flow_spec.stype, p);
                     STREAM_TO_UINT16 (cfg_info.ext_flow_spec.max_sdu_size, p);
@@ -513,14 +513,14 @@
                         if ((cfg_code & 0x80) == 0)
                         {
                             cfg_rej_len += cfg_len + L2CAP_CFG_OPTION_OVERHEAD;
-                            cfg_rej = TRUE;
+                            cfg_rej = true;
                         }
                     }
                     /* bad length; force loop exit */
                     else
                     {
                         p = p_cfg_end;
-                        cfg_rej = TRUE;
+                        cfg_rej = true;
                     }
                     break;
                 }
@@ -531,7 +531,7 @@
                 p_ccb->remote_id = id;
                 if (cfg_rej)
                 {
-                    l2cu_send_peer_config_rej (p_ccb, p_cfg_start, (UINT16) (cmd_len - L2CAP_CONFIG_REQ_LEN), cfg_rej_len);
+                    l2cu_send_peer_config_rej (p_ccb, p_cfg_start, (uint16_t) (cmd_len - L2CAP_CONFIG_REQ_LEN), cfg_rej_len);
                 }
                 else
                 {
@@ -552,7 +552,7 @@
             STREAM_TO_UINT16 (cfg_info.result, p);
 
             cfg_info.flush_to_present = cfg_info.mtu_present = cfg_info.qos_present =
-                cfg_info.fcr_present = cfg_info.fcs_present = FALSE;
+                cfg_info.fcr_present = cfg_info.fcs_present = false;
 
             while (p < p_cfg_end)
             {
@@ -562,17 +562,17 @@
                 switch (cfg_code & 0x7F)
                 {
                 case L2CAP_CFG_TYPE_MTU:
-                    cfg_info.mtu_present = TRUE;
+                    cfg_info.mtu_present = true;
                     STREAM_TO_UINT16 (cfg_info.mtu, p);
                     break;
 
                 case L2CAP_CFG_TYPE_FLUSH_TOUT:
-                    cfg_info.flush_to_present = TRUE;
+                    cfg_info.flush_to_present = true;
                     STREAM_TO_UINT16 (cfg_info.flush_to, p);
                     break;
 
                 case L2CAP_CFG_TYPE_QOS:
-                    cfg_info.qos_present = TRUE;
+                    cfg_info.qos_present = true;
                     STREAM_TO_UINT8  (cfg_info.qos.qos_flags, p);
                     STREAM_TO_UINT8  (cfg_info.qos.service_type, p);
                     STREAM_TO_UINT32 (cfg_info.qos.token_rate, p);
@@ -583,7 +583,7 @@
                     break;
 
                 case L2CAP_CFG_TYPE_FCR:
-                    cfg_info.fcr_present = TRUE;
+                    cfg_info.fcr_present = true;
                     STREAM_TO_UINT8 (cfg_info.fcr.mode, p);
                     STREAM_TO_UINT8 (cfg_info.fcr.tx_win_sz, p);
                     STREAM_TO_UINT8 (cfg_info.fcr.max_transmit, p);
@@ -593,12 +593,12 @@
                     break;
 
                 case L2CAP_CFG_TYPE_FCS:
-                    cfg_info.fcs_present = TRUE;
+                    cfg_info.fcs_present = true;
                     STREAM_TO_UINT8 (cfg_info.fcs, p);
                     break;
 
                 case L2CAP_CFG_TYPE_EXT_FLOW:
-                    cfg_info.ext_flow_spec_present = TRUE;
+                    cfg_info.ext_flow_spec_present = true;
                     STREAM_TO_UINT8  (cfg_info.ext_flow_spec.id, p);
                     STREAM_TO_UINT8  (cfg_info.ext_flow_spec.stype, p);
                     STREAM_TO_UINT16 (cfg_info.ext_flow_spec.max_sdu_size, p);
@@ -684,7 +684,7 @@
             if (p_lcb->w4_info_rsp)
             {
                 alarm_cancel(p_lcb->info_resp_timer);
-                p_lcb->w4_info_rsp = FALSE;
+                p_lcb->w4_info_rsp = false;
             }
 
             STREAM_TO_UINT16 (info_type, p);
@@ -758,7 +758,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2c_process_held_packets(BOOLEAN timed_out) {
+void l2c_process_held_packets(bool    timed_out) {
     if (list_is_empty(l2cb.rcv_pending_q))
         return;
 
@@ -800,7 +800,7 @@
 *******************************************************************************/
 void l2c_init (void)
 {
-    INT16  xx;
+    int16_t xx;
 
     memset (&l2cb, 0, sizeof (tL2C_CB));
     /* the psm is increased by 2 before being used */
@@ -835,17 +835,17 @@
     l2cb.l2cap_trace_level = BT_TRACE_LEVEL_NONE;    /* No traces */
 #endif
 
-#if L2CAP_CONFORMANCE_TESTING == TRUE
+#if (L2CAP_CONFORMANCE_TESTING == TRUE)
      /* Conformance testing needs a dynamic response */
     l2cb.test_info_resp = L2CAP_EXTFEA_SUPPORTED_MASK;
 #endif
 
     /* Number of ACL buffers to use for high priority channel */
-#if (defined(L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE) && (L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE == TRUE))
+#if (L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE == TRUE)
     l2cb.high_pri_min_xmit_quota = L2CAP_HIGH_PRI_MIN_XMIT_QUOTA;
 #endif
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     l2cb.l2c_ble_fixed_chnls_mask =
          L2CAP_FIXED_CHNL_ATT_BIT | L2CAP_FIXED_CHNL_BLE_SIG_BIT | L2CAP_FIXED_CHNL_SMP_BIT;
 #endif
@@ -864,7 +864,7 @@
 void l2c_receive_hold_timer_timeout(UNUSED_ATTR void *data)
 {
     /* Update the timeouts in the hold queue */
-    l2c_process_held_packets(TRUE);
+    l2c_process_held_packets(true);
 }
 
 void l2c_ccb_timer_timeout(void *data)
@@ -894,12 +894,12 @@
 **
 ** Description      API functions call this function to write data.
 **
-** Returns          L2CAP_DW_SUCCESS, if data accepted, else FALSE
+** Returns          L2CAP_DW_SUCCESS, if data accepted, else false
 **                  L2CAP_DW_CONGESTED, if data accepted and the channel is congested
 **                  L2CAP_DW_FAILED, if error
 **
 *******************************************************************************/
-UINT8 l2c_data_write (UINT16 cid, BT_HDR *p_data, UINT16 flags)
+uint8_t l2c_data_write (uint16_t cid, BT_HDR *p_data, uint16_t flags)
 {
     tL2C_CCB        *p_ccb;
 
@@ -913,7 +913,7 @@
 
 #ifndef TESTER /* Tester may send any amount of data. otherwise sending message
                   bigger than mtu size of peer is a violation of protocol */
-    UINT16 mtu;
+    uint16_t mtu;
 
     if (p_ccb->p_lcb->transport == BT_TRANSPORT_LE)
         mtu = p_ccb->peer_conn_cfg.mtu;
diff --git a/stack/l2cap/l2c_ucd.c b/stack/l2cap/l2c_ucd.c
index 6a4c3ec..9407da5 100644
--- a/stack/l2cap/l2c_ucd.c
+++ b/stack/l2cap/l2c_ucd.c
@@ -40,7 +40,7 @@
 
 extern fixed_queue_t *btu_bta_alarm_queue;
 
-static BOOLEAN l2c_ucd_connect ( BD_ADDR rem_bda );
+static bool    l2c_ucd_connect ( BD_ADDR rem_bda );
 
 /*******************************************************************************
 **
@@ -51,10 +51,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void l2c_ucd_discover_cback (BD_ADDR rem_bda, UINT8 info_type, UINT32 data)
+static void l2c_ucd_discover_cback (BD_ADDR rem_bda, uint8_t info_type, uint32_t data)
 {
     tL2C_RCB    *p_rcb = &l2cb.rcb_pool[0];
-    UINT16      xx;
+    uint16_t    xx;
 
     L2CAP_TRACE_DEBUG ("L2CAP - l2c_ucd_discover_cback");
 
@@ -92,13 +92,13 @@
 *******************************************************************************/
 static void l2c_ucd_data_ind_cback (BD_ADDR rem_bda, BT_HDR *p_buf)
 {
-    UINT8 *p;
-    UINT16 psm;
+    uint8_t *p;
+    uint16_t psm;
     tL2C_RCB    *p_rcb;
 
     L2CAP_TRACE_DEBUG ("L2CAP - l2c_ucd_data_ind_cback");
 
-    p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p = (uint8_t *)(p_buf + 1) + p_buf->offset;
     STREAM_TO_UINT16(psm, p)
 
     p_buf->offset += L2CAP_UCD_OVERHEAD;
@@ -124,10 +124,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void l2c_ucd_congestion_status_cback (BD_ADDR rem_bda, BOOLEAN is_congested)
+static void l2c_ucd_congestion_status_cback (BD_ADDR rem_bda, bool    is_congested)
 {
     tL2C_RCB    *p_rcb = &l2cb.rcb_pool[0];
-    UINT16      xx;
+    uint16_t    xx;
 
     L2CAP_TRACE_DEBUG ("L2CAP - l2c_ucd_congestion_status_cback");
 
@@ -158,7 +158,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void l2c_ucd_disconnect_ind_cback (UINT16 cid, BOOLEAN result)
+static void l2c_ucd_disconnect_ind_cback (uint16_t cid, bool    result)
 {
     /* do nothing */
 }
@@ -172,7 +172,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void l2c_ucd_config_ind_cback (UINT16 cid, tL2CAP_CFG_INFO *p_cfg)
+static void l2c_ucd_config_ind_cback (uint16_t cid, tL2CAP_CFG_INFO *p_cfg)
 {
     /* do nothing */
 }
@@ -186,7 +186,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-static void l2c_ucd_config_cfm_cback (UINT16 cid, tL2CAP_CFG_INFO *p_cfg)
+static void l2c_ucd_config_cfm_cback (uint16_t cid, tL2CAP_CFG_INFO *p_cfg)
 {
     /* do nothing */
 }
@@ -199,10 +199,10 @@
 **
 **  Parameters:     tL2CAP_UCD_CB_INFO
 **
-**  Return value:   TRUE if successs
+**  Return value:   true if successs
 **
 *******************************************************************************/
-BOOLEAN L2CA_UcdRegister ( UINT16 psm, tL2CAP_UCD_CB_INFO *p_cb_info )
+bool    L2CA_UcdRegister ( uint16_t psm, tL2CAP_UCD_CB_INFO *p_cb_info )
 {
     tL2C_RCB             *p_rcb;
 
@@ -212,13 +212,13 @@
      || (!p_cb_info->pL2CA_UCD_Data_Cb))
     {
         L2CAP_TRACE_ERROR ("L2CAP - no callback registering PSM(0x%04x) on UCD", psm);
-        return (FALSE);
+        return (false);
     }
 
     if ((p_rcb = l2cu_find_rcb_by_psm (psm)) == NULL)
     {
         L2CAP_TRACE_ERROR ("L2CAP - no RCB for L2CA_UcdRegister, PSM: 0x%04x", psm);
-        return (FALSE);
+        return (false);
     }
 
     p_rcb->ucd.state   = L2C_UCD_STATE_W4_DATA;
@@ -230,7 +230,7 @@
         if ((p_rcb = l2cu_allocate_rcb (L2C_UCD_RCB_ID)) == NULL)
         {
             L2CAP_TRACE_ERROR ("L2CAP - no RCB available for L2CA_UcdRegister");
-            return (FALSE);
+            return (false);
         }
         else
         {
@@ -251,7 +251,7 @@
         }
     }
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -262,21 +262,21 @@
 **
 **  Parameters:     PSM
 **
-**  Return value:   TRUE if successs
+**  Return value:   true if successs
 **
 *******************************************************************************/
-BOOLEAN L2CA_UcdDeregister ( UINT16 psm )
+bool    L2CA_UcdDeregister ( uint16_t psm )
 {
     tL2C_CCB    *p_ccb;
     tL2C_RCB    *p_rcb;
-    UINT16      xx;
+    uint16_t    xx;
 
     L2CAP_TRACE_API  ("L2CA_UcdDeregister()  PSM: 0x%04x", psm);
 
     if ((p_rcb = l2cu_find_rcb_by_psm (psm)) == NULL)
     {
         L2CAP_TRACE_ERROR ("L2CAP - no RCB for L2CA_UcdDeregister, PSM: 0x%04x", psm);
-        return (FALSE);
+        return (false);
     }
 
     p_rcb->ucd.state = L2C_UCD_STATE_UNUSED;
@@ -287,7 +287,7 @@
     for (xx = 0; xx < MAX_L2CAP_CLIENTS; xx++, p_rcb++)
     {
         if ((p_rcb->in_use) && (p_rcb->ucd.state != L2C_UCD_STATE_UNUSED))
-            return (TRUE);
+            return (true);
     }
 
     /* delete master rcb for UCD */
@@ -308,7 +308,7 @@
         p_ccb++;
     }
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -323,10 +323,10 @@
 **                              L2CAP_UCD_INFO_TYPE_MTU
 **
 **
-**  Return value:   TRUE if successs
+**  Return value:   true if successs
 **
 *******************************************************************************/
-BOOLEAN L2CA_UcdDiscover ( UINT16 psm, BD_ADDR rem_bda, UINT8 info_type )
+bool    L2CA_UcdDiscover ( uint16_t psm, BD_ADDR rem_bda, uint8_t info_type )
 {
     tL2C_LCB        *p_lcb;
     tL2C_CCB        *p_ccb;
@@ -341,7 +341,7 @@
         ||( p_rcb->ucd.state == L2C_UCD_STATE_UNUSED ))
     {
         L2CAP_TRACE_WARNING ("L2CAP - no RCB for L2CA_UcdDiscover, PSM: 0x%04x", psm);
-        return (FALSE);
+        return (false);
     }
 
     /* First, see if we already have a link to the remote */
@@ -349,9 +349,9 @@
     if (((p_lcb = l2cu_find_lcb_by_bd_addr (rem_bda, BT_TRANSPORT_BR_EDR)) == NULL)
       ||((p_ccb = l2cu_find_ccb_by_cid (p_lcb, L2CAP_CONNECTIONLESS_CID)) == NULL))
     {
-        if ( l2c_ucd_connect (rem_bda) == FALSE )
+        if ( l2c_ucd_connect (rem_bda) == false )
         {
-            return (FALSE);
+            return (false);
         }
     }
 
@@ -372,7 +372,7 @@
         }
         l2c_ucd_check_pending_info_req(p_ccb);
     }
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -392,12 +392,12 @@
 **                  L2CAP_DW_FAILED,  if error
 **
 *******************************************************************************/
-UINT16 L2CA_UcdDataWrite (UINT16 psm, BD_ADDR rem_bda, BT_HDR *p_buf, UINT16 flags)
+uint16_t L2CA_UcdDataWrite (uint16_t psm, BD_ADDR rem_bda, BT_HDR *p_buf, uint16_t flags)
 {
     tL2C_LCB        *p_lcb;
     tL2C_CCB        *p_ccb;
     tL2C_RCB        *p_rcb;
-    UINT8           *p;
+    uint8_t         *p;
 
     L2CAP_TRACE_API ("L2CA_UcdDataWrite()  PSM: 0x%04x  BDA: %08x%04x", psm,
                       (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3],
@@ -417,7 +417,7 @@
     if (((p_lcb = l2cu_find_lcb_by_bd_addr (rem_bda, BT_TRANSPORT_BR_EDR)) == NULL)
       ||((p_ccb = l2cu_find_ccb_by_cid (p_lcb, L2CAP_CONNECTIONLESS_CID)) == NULL))
     {
-        if ( l2c_ucd_connect (rem_bda) == FALSE )
+        if ( l2c_ucd_connect (rem_bda) == false )
         {
             osi_free(p_buf);
             return (L2CAP_DW_FAILED);
@@ -435,7 +435,7 @@
     /* write PSM */
     p_buf->offset -= L2CAP_UCD_OVERHEAD;
     p_buf->len += L2CAP_UCD_OVERHEAD;
-    p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+    p = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
     UINT16_TO_STREAM (p, psm);
 
@@ -480,10 +480,10 @@
 **  Parameters:     BD Addr
 **                  Timeout in second
 **
-**  Return value:   TRUE if successs
+**  Return value:   true if successs
 **
 *******************************************************************************/
-BOOLEAN L2CA_UcdSetIdleTimeout ( BD_ADDR rem_bda, UINT16 timeout )
+bool    L2CA_UcdSetIdleTimeout ( BD_ADDR rem_bda, uint16_t timeout )
 {
     tL2C_LCB        *p_lcb;
     tL2C_CCB        *p_ccb;
@@ -498,12 +498,12 @@
       ||((p_ccb = l2cu_find_ccb_by_cid (p_lcb, L2CAP_CONNECTIONLESS_CID)) == NULL))
     {
         L2CAP_TRACE_WARNING ("L2CAP - no UCD channel");
-        return (FALSE);
+        return (false);
     }
     else
     {
         p_ccb->fixed_chnl_idle_tout = timeout;
-        return (TRUE);
+        return (true);
     }
 }
 
@@ -513,10 +513,10 @@
 **
 ** Description      Sets the transmission priority for a connectionless channel.
 **
-** Returns          TRUE if a valid channel, else FALSE
+** Returns          true if a valid channel, else false
 **
 *******************************************************************************/
-BOOLEAN L2CA_UCDSetTxPriority ( BD_ADDR rem_bda, tL2CAP_CHNL_PRIORITY priority )
+bool    L2CA_UCDSetTxPriority ( BD_ADDR rem_bda, tL2CAP_CHNL_PRIORITY priority )
 {
     tL2C_LCB        *p_lcb;
     tL2C_CCB        *p_ccb;
@@ -528,20 +528,20 @@
     if ((p_lcb = l2cu_find_lcb_by_bd_addr (rem_bda, BT_TRANSPORT_BR_EDR)) == NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - no LCB for L2CA_UCDSetTxPriority");
-        return (FALSE);
+        return (false);
     }
 
     /* Find the channel control block */
     if ((p_ccb = l2cu_find_ccb_by_cid (p_lcb, L2CAP_CONNECTIONLESS_CID)) == NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - no CCB for L2CA_UCDSetTxPriority");
-        return (FALSE);
+        return (false);
     }
 
     /* it will update the order of CCB in LCB by priority and update round robin service variables */
     l2cu_change_pri_ccb (p_ccb, priority);
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -552,10 +552,10 @@
 **
 **  Parameters:     BD_ADDR of remote device
 **
-**  Return value:   TRUE if successs
+**  Return value:   true if successs
 **
 *******************************************************************************/
-static BOOLEAN l2c_ucd_connect ( BD_ADDR rem_bda )
+static bool    l2c_ucd_connect ( BD_ADDR rem_bda )
 {
     tL2C_LCB        *p_lcb;
     tL2C_CCB        *p_ccb;
@@ -569,18 +569,18 @@
     if (!BTM_IsDeviceUp())
     {
         L2CAP_TRACE_WARNING ("l2c_ucd_connect - BTU not ready");
-        return (FALSE);
+        return (false);
     }
 
     /* First, see if we already have a link to the remote */
     if ((p_lcb = l2cu_find_lcb_by_bd_addr (rem_bda, BT_TRANSPORT_BR_EDR)) == NULL)
     {
         /* No link. Get an LCB and start link establishment */
-        if ( ((p_lcb = l2cu_allocate_lcb (rem_bda, FALSE, BT_TRANSPORT_BR_EDR)) == NULL)
-         ||  (l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR) == FALSE) )
+        if ( ((p_lcb = l2cu_allocate_lcb (rem_bda, false, BT_TRANSPORT_BR_EDR)) == NULL)
+         ||  (l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR) == false) )
         {
             L2CAP_TRACE_WARNING ("L2CAP - conn not started l2c_ucd_connect");
-            return (FALSE);
+            return (false);
         }
     }
     else if ( p_lcb->info_rx_bits & (1 << L2CAP_EXTENDED_FEATURES_INFO_TYPE) )
@@ -588,7 +588,7 @@
         if (!(p_lcb->peer_ext_fea & L2CAP_EXTFEA_UCD_RECEPTION))
         {
             L2CAP_TRACE_WARNING ("L2CAP - UCD is not supported by peer, l2c_ucd_connect");
-            return (FALSE);
+            return (false);
         }
     }
 
@@ -599,7 +599,7 @@
         if ((p_ccb = l2cu_allocate_ccb (p_lcb, 0)) == NULL)
         {
             L2CAP_TRACE_WARNING ("L2CAP - no CCB for l2c_ucd_connect");
-            return (FALSE);
+            return (false);
         }
         else
         {
@@ -616,7 +616,7 @@
             if ((p_rcb = l2cu_find_rcb_by_psm (L2C_UCD_RCB_ID)) == NULL)
             {
                 L2CAP_TRACE_WARNING ("L2CAP - no UCD registered, l2c_ucd_connect");
-                return (FALSE);
+                return (false);
             }
             /* Save UCD registration info */
             p_ccb->p_rcb = p_rcb;
@@ -629,7 +629,7 @@
         }
     }
 
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -661,19 +661,19 @@
 **
 ** Description      check if any application is waiting for UCD information
 **
-**  Return          TRUE if any pending UCD info request
+**  Return          true if any pending UCD info request
 **
 *******************************************************************************/
-BOOLEAN l2c_ucd_check_pending_info_req(tL2C_CCB  *p_ccb)
+bool    l2c_ucd_check_pending_info_req(tL2C_CCB  *p_ccb)
 {
     tL2C_RCB    *p_rcb = &l2cb.rcb_pool[0];
-    UINT16      xx;
-    BOOLEAN     pending = FALSE;
+    uint16_t    xx;
+    bool        pending = false;
 
     if (p_ccb == NULL)
     {
         L2CAP_TRACE_ERROR ("L2CAP - NULL p_ccb in l2c_ucd_check_pending_info_req");
-        return (FALSE);
+        return (false);
     }
 
     for (xx = 0; xx < MAX_L2CAP_CLIENTS; xx++, p_rcb++)
@@ -700,8 +700,8 @@
                 }
                 else
                 {
-                    pending = TRUE;
-                    if (p_ccb->p_lcb->w4_info_rsp == FALSE)
+                    pending = true;
+                    if (p_ccb->p_lcb->w4_info_rsp == false)
                     {
                         l2cu_send_peer_info_req (p_ccb->p_lcb, L2CAP_EXTENDED_FEATURES_INFO_TYPE);
                     }
@@ -720,8 +720,8 @@
                 }
                 else
                 {
-                    pending = TRUE;
-                    if (p_ccb->p_lcb->w4_info_rsp == FALSE)
+                    pending = true;
+                    if (p_ccb->p_lcb->w4_info_rsp == false)
                     {
                         l2cu_send_peer_info_req (p_ccb->p_lcb, L2CAP_CONNLESS_MTU_INFO_TYPE);
                     }
@@ -754,17 +754,17 @@
 **
 **  Description     check outgoing security
 **
-**  Return          TRUE if any UCD packet for security
+**  Return          true if any UCD packet for security
 **
 *******************************************************************************/
-BOOLEAN l2c_ucd_check_pending_out_sec_q(tL2C_CCB  *p_ccb)
+bool    l2c_ucd_check_pending_out_sec_q(tL2C_CCB  *p_ccb)
 {
     BT_HDR *p_buf = (BT_HDR*)fixed_queue_try_peek_first(p_ccb->p_lcb->ucd_out_sec_pending_q);
 
     if (p_buf != NULL)
     {
-        UINT16 psm;
-        UINT8 *p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+        uint16_t psm;
+        uint8_t *p = (uint8_t *)(p_buf + 1) + p_buf->offset;
 
         STREAM_TO_UINT16(psm, p)
 
@@ -772,9 +772,9 @@
         btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, psm,
                                   p_ccb->p_lcb->handle, CONNLESS_ORIG, &l2c_link_sec_comp, p_ccb);
 
-        return (TRUE);
+        return (true);
     }
-    return (FALSE);
+    return (false);
 }
 
 /*******************************************************************************
@@ -822,26 +822,26 @@
 **
 **  Description     check incoming security
 **
-**  Return          TRUE if any UCD packet for security
+**  Return          true if any UCD packet for security
 **
 *******************************************************************************/
-BOOLEAN l2c_ucd_check_pending_in_sec_q(tL2C_CCB  *p_ccb)
+bool    l2c_ucd_check_pending_in_sec_q(tL2C_CCB  *p_ccb)
 {
     BT_HDR *p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->p_lcb->ucd_in_sec_pending_q);
 
     if (p_buf != NULL)
     {
-        UINT16 psm;
-        UINT8 *p = (UINT8 *)(p_buf + 1) + p_buf->offset;
+        uint16_t psm;
+        uint8_t *p = (uint8_t *)(p_buf + 1) + p_buf->offset;
         STREAM_TO_UINT16(psm, p)
 
         p_ccb->chnl_state = CST_TERM_W4_SEC_COMP;
         btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, psm,
                                   p_ccb->p_lcb->handle, CONNLESS_TERM, &l2c_link_sec_comp, p_ccb);
 
-        return (TRUE);
+        return (true);
     }
-    return (FALSE);
+    return (false);
 }
 
 /*******************************************************************************
@@ -887,10 +887,10 @@
 **  Description     Check if UCD reception is registered.
 **                  Process received UCD packet if application is expecting.
 **
-**  Return          TRUE if UCD reception is registered
+**  Return          true if UCD reception is registered
 **
 *******************************************************************************/
-BOOLEAN l2c_ucd_check_rx_pkts(tL2C_LCB  *p_lcb, BT_HDR *p_msg)
+bool    l2c_ucd_check_rx_pkts(tL2C_LCB  *p_lcb, BT_HDR *p_msg)
 {
     tL2C_CCB   *p_ccb;
     tL2C_RCB   *p_rcb;
@@ -905,7 +905,7 @@
             {
                 L2CAP_TRACE_WARNING ("L2CAP - no CCB for UCD reception");
                 osi_free(p_msg);
-                return TRUE;
+                return true;
             }
             else
             {
@@ -926,10 +926,10 @@
             }
         }
         l2c_csm_execute(p_ccb, L2CEVT_L2CAP_DATA, p_msg);
-        return TRUE;
+        return true;
     }
     else
-        return FALSE;
+        return false;
 }
 
 /*******************************************************************************
@@ -939,14 +939,14 @@
 **  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
+**  Return          true if the event is consumed by UCD
+**                  false if the event needs to be processed by main state machine
 **
 *******************************************************************************/
-BOOLEAN l2c_ucd_process_event(tL2C_CCB *p_ccb, UINT16 event, void *p_data)
+bool    l2c_ucd_process_event(tL2C_CCB *p_ccb, uint16_t event, void *p_data)
 {
-    /* if the event is not processed by this function, this variable will be set to FALSE */
-    BOOLEAN done = TRUE;
+    /* if the event is not processed by this function, this variable will be set to false */
+    bool    done = true;
 
     switch (p_ccb->chnl_state)
     {
@@ -986,7 +986,7 @@
             break;
 
         default:
-            done = FALSE;   /* main state machine continues to process event */
+            done = false;   /* main state machine continues to process event */
             break;
         }
         break;
@@ -1049,7 +1049,7 @@
             break;
 
         default:
-            done = FALSE;   /* main state machine continues to process event */
+            done = false;   /* main state machine continues to process event */
             break;
         }
         break;
@@ -1083,7 +1083,7 @@
         case L2CEVT_SEC_COMP_NEG:
             if (((tL2C_CONN_INFO *)p_data)->status == BTM_DELAY_CHECK)
             {
-                done = FALSE;
+                done = false;
                 break;
             }
             p_ccb->chnl_state = CST_OPEN;
@@ -1118,7 +1118,7 @@
             break;
 
         default:
-            done = FALSE;   /* main state machine continues to process event */
+            done = false;   /* main state machine continues to process event */
             break;
         }
         break;
@@ -1160,13 +1160,13 @@
             break;
 
         default:
-            done = FALSE;   /* main state machine continues to process event */
+            done = false;   /* main state machine continues to process event */
             break;
         }
         break;
 
     default:
-        done = FALSE;   /* main state machine continues to process event */
+        done = false;   /* main state machine continues to process event */
         break;
     }
 
diff --git a/stack/l2cap/l2c_utils.c b/stack/l2cap/l2c_utils.c
index 4fd5f64..674565d 100644
--- a/stack/l2cap/l2c_utils.c
+++ b/stack/l2cap/l2c_utils.c
@@ -51,7 +51,7 @@
 ** Returns          LCB address or NULL if none found
 **
 *******************************************************************************/
-tL2C_LCB *l2cu_allocate_lcb (BD_ADDR p_bd_addr, BOOLEAN is_bonding, tBT_TRANSPORT transport)
+tL2C_LCB *l2cu_allocate_lcb (BD_ADDR p_bd_addr, bool    is_bonding, tBT_TRANSPORT transport)
 {
     int         xx;
     tL2C_LCB    *p_lcb = &l2cb.lcb_pool[0];
@@ -66,7 +66,7 @@
 
             memcpy (p_lcb->remote_bd_addr, p_bd_addr, BD_ADDR_LEN);
 
-            p_lcb->in_use          = TRUE;
+            p_lcb->in_use          = true;
             p_lcb->link_state      = LST_DISCONNECTED;
             p_lcb->handle          = HCI_INVALID_HANDLE;
             p_lcb->link_flush_tout = 0xFFFF;
@@ -114,7 +114,7 @@
 ** Returns          Nothing
 **
 *******************************************************************************/
-void l2cu_update_lcb_4_bonding (BD_ADDR p_bd_addr, BOOLEAN is_bonding)
+void l2cu_update_lcb_4_bonding (BD_ADDR p_bd_addr, bool    is_bonding)
 {
     tL2C_LCB    *p_lcb = l2cu_find_lcb_by_bd_addr (p_bd_addr, BT_TRANSPORT_BR_EDR);
 
@@ -141,8 +141,8 @@
 {
     tL2C_CCB    *p_ccb;
 
-    p_lcb->in_use     = FALSE;
-    p_lcb->is_bonding = FALSE;
+    p_lcb->in_use     = false;
+    p_lcb->is_bonding = false;
 
     /* Stop and free timers */
     alarm_free(p_lcb->l2c_lcb_timer);
@@ -153,7 +153,7 @@
     /* Release any unfinished L2CAP packet on this link */
     osi_free_and_reset((void **)&p_lcb->p_hcit_rcv_acl);
 
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
 #if (BLE_INCLUDED == TRUE)
         if (p_lcb->transport == BT_TRANSPORT_BR_EDR)
 #endif
@@ -186,7 +186,7 @@
 #if (BLE_INCLUDED == TRUE)
     // Reset BLE connecting flag only if the address matches
     if (!memcmp(l2cb.ble_connecting_bda, p_lcb->remote_bd_addr, BD_ADDR_LEN))
-        l2cb.is_ble_connecting = FALSE;
+        l2cb.is_ble_connecting = false;
 #endif
 
 #if (L2CAP_NUM_FIXED_CHNLS > 0)
@@ -224,7 +224,7 @@
     l2c_ucd_delete_sec_pending_q(p_lcb);
 #endif
 
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
     /* Re-adjust flow control windows make sure it does not go negative */
     if (p_lcb->transport == BT_TRANSPORT_LE)
     {
@@ -287,7 +287,7 @@
     for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_lcb++)
     {
         if ((p_lcb->in_use) &&
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
             p_lcb->transport == transport &&
 #endif
             (!memcmp (p_lcb->remote_bd_addr, p_bd_addr, BD_ADDR_LEN)))
@@ -312,7 +312,7 @@
 ** Returns          HCI_ROLE_MASTER or HCI_ROLE_SLAVE
 **
 *******************************************************************************/
-UINT8 l2cu_get_conn_role (tL2C_LCB *p_this_lcb)
+uint8_t l2cu_get_conn_role (tL2C_LCB *p_this_lcb)
 {
     return l2cb.desire_role;
 }
@@ -325,11 +325,11 @@
 **                  If a command it will be rejected per spec.
 **                  This function is used when a illegal packet length is detected
 **
-** Returns          BOOLEAN - TRUE if cmd_code is a command and it is rejected,
-**                            FALSE if response code. (command not rejected)
+** Returns          bool    - true if cmd_code is a command and it is rejected,
+**                            false if response code. (command not rejected)
 **
 *******************************************************************************/
-BOOLEAN l2c_is_cmd_rejected (UINT8 cmd_code, UINT8 id, tL2C_LCB *p_lcb)
+bool    l2c_is_cmd_rejected (uint8_t cmd_code, uint8_t id, tL2C_LCB *p_lcb)
 {
     switch(cmd_code)
     {
@@ -343,10 +343,10 @@
     case L2CAP_CMD_BLE_UPDATE_REQ:
         l2cu_send_peer_cmd_reject (p_lcb, L2CAP_CMD_REJ_MTU_EXCEEDED, id, L2CAP_DEFAULT_MTU, 0);
         L2CAP_TRACE_WARNING ("Dumping first Command (%d)", cmd_code);
-        return TRUE;
+        return true;
 
     default:    /* Otherwise a response */
-        return FALSE;
+        return false;
     }
 }
 
@@ -359,14 +359,14 @@
 ** Returns          Pointer to allocated packet or NULL if no resources
 **
 *******************************************************************************/
-BT_HDR *l2cu_build_header (tL2C_LCB *p_lcb, UINT16 len, UINT8 cmd, UINT8 id)
+BT_HDR *l2cu_build_header (tL2C_LCB *p_lcb, uint16_t len, uint8_t cmd, uint8_t id)
 {
     BT_HDR  *p_buf = (BT_HDR *)osi_malloc(L2CAP_CMD_BUF_SIZE);
-    UINT8   *p;
+    uint8_t *p;
 
     p_buf->offset = L2CAP_SEND_CMD_OFFSET;
     p_buf->len = len + HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET;
 
     /* Put in HCI header - handle + pkt boundary */
 #if (BLE_INCLUDED == TRUE)
@@ -417,7 +417,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cu_adj_id (tL2C_LCB *p_lcb, UINT8 adj_mask)
+void l2cu_adj_id (tL2C_LCB *p_lcb, uint8_t adj_mask)
 {
     if ((adj_mask & L2CAP_ADJ_ZERO_ID) && !p_lcb->id)
     {
@@ -435,12 +435,12 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cu_send_peer_cmd_reject (tL2C_LCB *p_lcb, UINT16 reason, UINT8 rem_id,
-                                UINT16 p1, UINT16 p2)
+void l2cu_send_peer_cmd_reject (tL2C_LCB *p_lcb, uint16_t reason, uint8_t rem_id,
+                                uint16_t p1, uint16_t p2)
 {
-    UINT16  param_len;
+    uint16_t param_len;
     BT_HDR  *p_buf;
-    UINT8   *p;
+    uint8_t *p;
 
     /* Put in L2CAP packet header */
     if (reason == L2CAP_CMD_REJ_MTU_EXCEEDED)
@@ -450,13 +450,13 @@
     else
         param_len = 0;
 
-    if ((p_buf = l2cu_build_header (p_lcb, (UINT16) (L2CAP_CMD_REJECT_LEN + param_len), L2CAP_CMD_REJECT, rem_id)) == NULL )
+    if ((p_buf = l2cu_build_header (p_lcb, (uint16_t) (L2CAP_CMD_REJECT_LEN + param_len), L2CAP_CMD_REJECT, rem_id)) == NULL )
     {
         L2CAP_TRACE_WARNING ("L2CAP - no buffer cmd_rej");
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
                                L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     UINT16_TO_STREAM (p, reason);
@@ -484,7 +484,7 @@
 void l2cu_send_peer_connect_req (tL2C_CCB *p_ccb)
 {
     BT_HDR  *p_buf;
-    UINT8   *p;
+    uint8_t *p;
 
     /* Create an identifier for this packet */
     p_ccb->p_lcb->id++;
@@ -499,7 +499,7 @@
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET+HCI_DATA_PREAMBLE_SIZE +
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET+HCI_DATA_PREAMBLE_SIZE +
         L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     UINT16_TO_STREAM (p, p_ccb->p_rcb->real_psm);
@@ -519,10 +519,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cu_send_peer_connect_rsp (tL2C_CCB *p_ccb, UINT16 result, UINT16 status)
+void l2cu_send_peer_connect_rsp (tL2C_CCB *p_ccb, uint16_t result, uint16_t status)
 {
     BT_HDR  *p_buf;
-    UINT8   *p;
+    uint8_t *p;
 
     if (result == L2CAP_CONN_PENDING)
     {
@@ -539,7 +539,7 @@
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET+HCI_DATA_PREAMBLE_SIZE +
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET+HCI_DATA_PREAMBLE_SIZE +
         L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     UINT16_TO_STREAM (p, p_ccb->local_cid);
@@ -562,10 +562,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cu_reject_connection (tL2C_LCB *p_lcb, UINT16 remote_cid, UINT8 rem_id, UINT16 result)
+void l2cu_reject_connection (tL2C_LCB *p_lcb, uint16_t remote_cid, uint8_t rem_id, uint16_t result)
 {
     BT_HDR  *p_buf;
-    UINT8   *p;
+    uint8_t *p;
 
     if ((p_buf = l2cu_build_header(p_lcb, L2CAP_CONN_RSP_LEN, L2CAP_CMD_CONN_RSP, rem_id)) == NULL )
     {
@@ -573,7 +573,7 @@
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET+HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET+HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     UINT16_TO_STREAM (p, 0);                    /* Local CID of 0   */
     UINT16_TO_STREAM (p, remote_cid);
@@ -596,8 +596,8 @@
 void l2cu_send_peer_config_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg)
 {
     BT_HDR  *p_buf;
-    UINT16  cfg_len=0;
-    UINT8   *p;
+    uint16_t cfg_len=0;
+    uint8_t *p;
 
     /* Create an identifier for this packet */
     p_ccb->p_lcb->id++;
@@ -618,14 +618,14 @@
     if (p_cfg->ext_flow_spec_present)
         cfg_len += L2CAP_CFG_EXT_FLOW_OPTION_LEN + L2CAP_CFG_OPTION_OVERHEAD;
 
-    if ((p_buf = l2cu_build_header (p_ccb->p_lcb, (UINT16) (L2CAP_CONFIG_REQ_LEN + cfg_len),
+    if ((p_buf = l2cu_build_header (p_ccb->p_lcb, (uint16_t) (L2CAP_CONFIG_REQ_LEN + cfg_len),
         L2CAP_CMD_CONFIG_REQ, p_ccb->local_id)) == NULL )
     {
         L2CAP_TRACE_WARNING ("L2CAP - no buffer for conn_req");
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
                                L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     UINT16_TO_STREAM (p, p_ccb->remote_cid);
@@ -703,8 +703,8 @@
 void l2cu_send_peer_config_rsp (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg)
 {
     BT_HDR  *p_buf;
-    UINT16  cfg_len = 0;
-    UINT8   *p;
+    uint16_t cfg_len = 0;
+    uint8_t *p;
 
     /* Create an identifier for this packet */
     if (p_cfg->mtu_present)
@@ -718,14 +718,14 @@
     if (p_cfg->ext_flow_spec_present)
         cfg_len += L2CAP_CFG_EXT_FLOW_OPTION_LEN + L2CAP_CFG_OPTION_OVERHEAD;
 
-    if ((p_buf = l2cu_build_header (p_ccb->p_lcb, (UINT16)(L2CAP_CONFIG_RSP_LEN + cfg_len),
+    if ((p_buf = l2cu_build_header (p_ccb->p_lcb, (uint16_t)(L2CAP_CONFIG_RSP_LEN + cfg_len),
                                     L2CAP_CMD_CONFIG_RSP, p_ccb->remote_id)) == NULL )
     {
         L2CAP_TRACE_WARNING ("L2CAP - no buffer for conn_req");
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET+HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET+HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     UINT16_TO_STREAM (p, p_ccb->remote_cid);
     UINT16_TO_STREAM (p, p_cfg->flags);           /* Flags (continuation) Must match request */
@@ -793,11 +793,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cu_send_peer_config_rej (tL2C_CCB *p_ccb, UINT8 *p_data, UINT16 data_len, UINT16 rej_len)
+void l2cu_send_peer_config_rej (tL2C_CCB *p_ccb, uint8_t *p_data, uint16_t data_len, uint16_t rej_len)
 {
-    UINT16  len, cfg_len, buf_space, len1;
-    UINT8   *p, *p_hci_len, *p_data_end;
-    UINT8   cfg_code;
+    uint16_t len, cfg_len, buf_space, len1;
+    uint8_t *p, *p_hci_len, *p_data_end;
+    uint8_t cfg_code;
 
     L2CAP_TRACE_DEBUG("l2cu_send_peer_config_rej: data_len=%d, rej_len=%d", data_len, rej_len);
 
@@ -812,7 +812,7 @@
 
     BT_HDR *p_buf = (BT_HDR *)osi_malloc(len + rej_len);
     p_buf->offset = L2CAP_SEND_CMD_OFFSET;
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET;
 
     /* Put in HCI header - handle + pkt boundary */
 #if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
@@ -893,7 +893,7 @@
         }
     }
 
-    len = (UINT16) (p - p_hci_len - 2);
+    len = (uint16_t) (p - p_hci_len - 2);
     UINT16_TO_STREAM (p_hci_len, len);
 
     p_buf->len = len + 4;
@@ -917,7 +917,7 @@
 void l2cu_send_peer_disc_req (tL2C_CCB *p_ccb)
 {
     BT_HDR  *p_buf, *p_buf2;
-    UINT8   *p;
+    uint8_t *p;
 
     if ((!p_ccb) || (p_ccb->p_lcb == NULL))
     {
@@ -937,7 +937,7 @@
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     UINT16_TO_STREAM (p, p_ccb->remote_cid);
     UINT16_TO_STREAM (p, p_ccb->local_cid);
@@ -972,11 +972,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cu_send_peer_disc_rsp (tL2C_LCB *p_lcb, UINT8 remote_id, UINT16 local_cid,
-                              UINT16 remote_cid)
+void l2cu_send_peer_disc_rsp (tL2C_LCB *p_lcb, uint8_t remote_id, uint16_t local_cid,
+                              uint16_t remote_cid)
 {
     BT_HDR  *p_buf;
-    UINT8   *p;
+    uint8_t *p;
 
     if ((p_buf=l2cu_build_header(p_lcb, L2CAP_DISC_RSP_LEN, L2CAP_CMD_DISC_RSP, remote_id)) == NULL)
     {
@@ -984,7 +984,7 @@
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     UINT16_TO_STREAM (p, local_cid);
     UINT16_TO_STREAM (p, remote_cid);
@@ -1004,21 +1004,21 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cu_send_peer_echo_req (tL2C_LCB *p_lcb, UINT8 *p_data, UINT16 data_len)
+void l2cu_send_peer_echo_req (tL2C_LCB *p_lcb, uint8_t *p_data, uint16_t data_len)
 {
     BT_HDR  *p_buf;
-    UINT8   *p;
+    uint8_t *p;
 
     p_lcb->id++;
     l2cu_adj_id(p_lcb, L2CAP_ADJ_ZERO_ID);  /* check for wrap to '0' */
 
-    if ((p_buf = l2cu_build_header(p_lcb, (UINT16) (L2CAP_ECHO_REQ_LEN + data_len), L2CAP_CMD_ECHO_REQ, p_lcb->id)) == NULL)
+    if ((p_buf = l2cu_build_header(p_lcb, (uint16_t) (L2CAP_ECHO_REQ_LEN + data_len), L2CAP_CMD_ECHO_REQ, p_lcb->id)) == NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - no buffer for echo_req");
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     if (data_len)
     {
@@ -1039,11 +1039,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cu_send_peer_echo_rsp (tL2C_LCB *p_lcb, UINT8 id, UINT8 *p_data, UINT16 data_len)
+void l2cu_send_peer_echo_rsp (tL2C_LCB *p_lcb, uint8_t id, uint8_t *p_data, uint16_t data_len)
 {
     BT_HDR  *p_buf;
-    UINT8   *p;
-    UINT16   maxlen;
+    uint8_t *p;
+    uint16_t maxlen;
     /* Filter out duplicate IDs or if available buffers are low (intruder checking) */
     if (!id || id == p_lcb->cur_echo_id)
     {
@@ -1058,20 +1058,20 @@
     uint16_t acl_packet_size = controller_get_interface()->get_acl_packet_size_classic();
     /* Don't return data if it does not fit in ACL and L2CAP MTU */
     maxlen = (L2CAP_CMD_BUF_SIZE > acl_packet_size) ?
-               acl_data_size : (UINT16)L2CAP_CMD_BUF_SIZE;
-    maxlen -= (UINT16)(BT_HDR_SIZE + HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD +
+               acl_data_size : (uint16_t)L2CAP_CMD_BUF_SIZE;
+    maxlen -= (uint16_t)(BT_HDR_SIZE + HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD +
                 L2CAP_CMD_OVERHEAD + L2CAP_ECHO_RSP_LEN);
 
     if (data_len > maxlen)
         data_len = 0;
 
-    if ((p_buf = l2cu_build_header (p_lcb, (UINT16)(L2CAP_ECHO_RSP_LEN + data_len), L2CAP_CMD_ECHO_RSP, id)) == NULL)
+    if ((p_buf = l2cu_build_header (p_lcb, (uint16_t)(L2CAP_ECHO_RSP_LEN + data_len), L2CAP_CMD_ECHO_RSP, id)) == NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - no buffer for echo_rsp");
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
                                L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     if (data_len)
@@ -1091,10 +1091,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cu_send_peer_info_req (tL2C_LCB *p_lcb, UINT16 info_type)
+void l2cu_send_peer_info_req (tL2C_LCB *p_lcb, uint16_t info_type)
 {
     BT_HDR  *p_buf;
-    UINT8   *p;
+    uint8_t *p;
 
     /* check for wrap and/or BRCM ID */
     p_lcb->id++;
@@ -1108,12 +1108,12 @@
 
     L2CAP_TRACE_EVENT ("l2cu_send_peer_info_req: type 0x%04x", info_type);
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET+HCI_DATA_PREAMBLE_SIZE +
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET+HCI_DATA_PREAMBLE_SIZE +
         L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     UINT16_TO_STREAM (p, info_type);
 
-    p_lcb->w4_info_rsp = TRUE;
+    p_lcb->w4_info_rsp = true;
     alarm_set_on_queue(p_lcb->info_resp_timer, L2CAP_WAIT_INFO_RSP_TIMEOUT_MS,
                        l2c_info_resp_timer_timeout, p_lcb,
                        btu_general_alarm_queue);
@@ -1132,11 +1132,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cu_send_peer_info_rsp (tL2C_LCB *p_lcb, UINT8 remote_id, UINT16 info_type)
+void l2cu_send_peer_info_rsp (tL2C_LCB *p_lcb, uint8_t remote_id, uint16_t info_type)
 {
     BT_HDR  *p_buf;
-    UINT8   *p;
-    UINT16   len = L2CAP_INFO_RSP_LEN;
+    uint8_t *p;
+    uint16_t len = L2CAP_INFO_RSP_LEN;
 
 #if (L2CAP_CONFORMANCE_TESTING == TRUE)
     if ((info_type == L2CAP_EXTENDED_FEATURES_INFO_TYPE)
@@ -1168,7 +1168,7 @@
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
                                L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     UINT16_TO_STREAM (p, info_type);
@@ -1193,7 +1193,7 @@
         else
 #endif
         {
-#if L2CAP_CONFORMANCE_TESTING == TRUE
+#if (L2CAP_CONFORMANCE_TESTING == TRUE)
         UINT32_TO_STREAM (p, l2cb.test_info_resp);
 #else
 #if (L2CAP_NUM_FIXED_CHNLS > 0)
@@ -1476,7 +1476,7 @@
 ** Returns          pointer to CCB, or NULL if none
 **
 *******************************************************************************/
-tL2C_CCB *l2cu_allocate_ccb (tL2C_LCB *p_lcb, UINT16 cid)
+tL2C_CCB *l2cu_allocate_ccb (tL2C_LCB *p_lcb, uint16_t cid)
 {
     tL2C_CCB    *p_ccb;
     tL2C_CCB    *p_prev;
@@ -1524,10 +1524,10 @@
 
     p_ccb->p_next_ccb = p_ccb->p_prev_ccb = NULL;
 
-    p_ccb->in_use = TRUE;
+    p_ccb->in_use = true;
 
     /* Get a CID for the connection */
-    p_ccb->local_cid = L2CAP_BASE_APPL_CID + (UINT16)(p_ccb - l2cb.ccb_pool);
+    p_ccb->local_cid = L2CAP_BASE_APPL_CID + (uint16_t)(p_ccb - l2cb.ccb_pool);
 
     p_ccb->p_lcb = p_lcb;
     p_ccb->p_rcb = NULL;
@@ -1558,7 +1558,7 @@
 
     p_ccb->bypass_fcs = 0;
     memset (&p_ccb->ertm_info, 0, sizeof(tL2CAP_ERTM_INFO));
-    p_ccb->peer_cfg_already_rejected = FALSE;
+    p_ccb->peer_cfg_already_rejected = false;
     p_ccb->fcr_cfg_tries         = L2CAP_MAX_FCR_CFG_TRIES;
 
     alarm_free(p_ccb->fcrb.ack_timer);
@@ -1584,7 +1584,7 @@
     p_ccb->fcrb.retrans_q = fixed_queue_new(SIZE_MAX);
     p_ccb->fcrb.waiting_for_ack_q = fixed_queue_new(SIZE_MAX);
 
-    p_ccb->cong_sent    = FALSE;
+    p_ccb->cong_sent    = false;
     p_ccb->buff_quota   = 2;                /* This gets set after config */
 
     /* If CCB was reserved Config_Done can already have some value */
@@ -1601,7 +1601,7 @@
     p_ccb->rx_data_rate = L2CAP_CHNL_DATA_RATE_LOW;
 
 #if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
-    p_ccb->is_flushable = FALSE;
+    p_ccb->is_flushable = false;
 #endif
 
     alarm_free(p_ccb->l2c_ccb_timer);
@@ -1621,22 +1621,22 @@
 **                  This timer can be longer than the normal link inactivity
 **                  timer for some platforms.
 **
-** Returns          BOOLEAN  - 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
 **
 *******************************************************************************/
-BOOLEAN l2cu_start_post_bond_timer (UINT16 handle)
+bool    l2cu_start_post_bond_timer (uint16_t handle)
 {
     tL2C_LCB *p_lcb = l2cu_find_lcb_by_handle(handle);
 
     if (!p_lcb)
-        return (TRUE);
+        return (true);
 
-    p_lcb->is_bonding = FALSE;
+    p_lcb->is_bonding = false;
 
     /* Only start timer if no control blocks allocated */
     if (p_lcb->ccb_queue.p_first_ccb != NULL)
-        return (FALSE);
+        return (false);
 
     /* If no channels on the connection, start idle timeout */
     if ((p_lcb->link_state == LST_CONNECTED) ||
@@ -1655,10 +1655,10 @@
         alarm_set_on_queue(p_lcb->l2c_lcb_timer, timeout_ms,
                            l2c_lcb_timer_timeout, p_lcb,
                            btu_general_alarm_queue);
-        return (TRUE);
+        return (true);
     }
 
-    return (FALSE);
+    return (false);
 }
 
 /*******************************************************************************
@@ -1738,7 +1738,7 @@
     }
 
     /* Flag as not in use */
-    p_ccb->in_use = FALSE;
+    p_ccb->in_use = false;
 
     /* If no channels on the connection, start idle timeout */
     if ((p_lcb) && p_lcb->in_use && (p_lcb->link_state == LST_CONNECTED))
@@ -1765,7 +1765,7 @@
 ** Returns          pointer to matched CCB, or NULL if no match
 **
 *******************************************************************************/
-tL2C_CCB *l2cu_find_ccb_by_remote_cid (tL2C_LCB *p_lcb, UINT16 remote_cid)
+tL2C_CCB *l2cu_find_ccb_by_remote_cid (tL2C_LCB *p_lcb, uint16_t remote_cid)
 {
     tL2C_CCB    *p_ccb;
 
@@ -1795,16 +1795,16 @@
 ** Returns          Pointer to the RCB or NULL if not found
 **
 *******************************************************************************/
-tL2C_RCB *l2cu_allocate_rcb (UINT16 psm)
+tL2C_RCB *l2cu_allocate_rcb (uint16_t psm)
 {
     tL2C_RCB    *p_rcb = &l2cb.rcb_pool[0];
-    UINT16      xx;
+    uint16_t    xx;
 
     for (xx = 0; xx < MAX_L2CAP_CLIENTS; xx++, p_rcb++)
     {
         if (!p_rcb->in_use)
         {
-            p_rcb->in_use = TRUE;
+            p_rcb->in_use = true;
             p_rcb->psm    = psm;
 #if (L2CAP_UCD_INCLUDED == TRUE)
             p_rcb->ucd.state = L2C_UCD_STATE_UNUSED;
@@ -1827,16 +1827,16 @@
 ** Returns          Pointer to the BLE RCB or NULL if not found
 **
 *******************************************************************************/
-tL2C_RCB *l2cu_allocate_ble_rcb (UINT16 psm)
+tL2C_RCB *l2cu_allocate_ble_rcb (uint16_t psm)
 {
     tL2C_RCB    *p_rcb = &l2cb.ble_rcb_pool[0];
-    UINT16      xx;
+    uint16_t    xx;
 
     for (xx = 0; xx < BLE_MAX_L2CAP_CLIENTS; xx++, p_rcb++)
     {
         if (!p_rcb->in_use)
         {
-            p_rcb->in_use = TRUE;
+            p_rcb->in_use = true;
             p_rcb->psm    = psm;
 #if (L2CAP_UCD_INCLUDED == TRUE)
             p_rcb->ucd.state = L2C_UCD_STATE_UNUSED;
@@ -1860,7 +1860,7 @@
 *******************************************************************************/
 void l2cu_release_rcb (tL2C_RCB *p_rcb)
 {
-    p_rcb->in_use = FALSE;
+    p_rcb->in_use = false;
     p_rcb->psm    = 0;
 }
 
@@ -1875,7 +1875,7 @@
 *******************************************************************************/
 void l2cu_disconnect_chnl (tL2C_CCB *p_ccb)
 {
-    UINT16      local_cid = p_ccb->local_cid;
+    uint16_t    local_cid = p_ccb->local_cid;
 
     if (local_cid >= L2CAP_BASE_APPL_CID)
     {
@@ -1887,7 +1887,7 @@
 
         l2cu_release_ccb (p_ccb);
 
-        (*p_disc_cb)(local_cid, FALSE);
+        (*p_disc_cb)(local_cid, false);
     }
     else
     {
@@ -1907,10 +1907,10 @@
 ** Returns          Pointer to the RCB or NULL if not found
 **
 *******************************************************************************/
-tL2C_RCB *l2cu_find_rcb_by_psm (UINT16 psm)
+tL2C_RCB *l2cu_find_rcb_by_psm (uint16_t psm)
 {
     tL2C_RCB    *p_rcb = &l2cb.rcb_pool[0];
-    UINT16      xx;
+    uint16_t    xx;
 
     for (xx = 0; xx < MAX_L2CAP_CLIENTS; xx++, p_rcb++)
     {
@@ -1932,10 +1932,10 @@
 ** Returns          Pointer to the BLE RCB or NULL if not found
 **
 *******************************************************************************/
-tL2C_RCB *l2cu_find_ble_rcb_by_psm (UINT16 psm)
+tL2C_RCB *l2cu_find_ble_rcb_by_psm (uint16_t psm)
 {
     tL2C_RCB    *p_rcb = &l2cb.ble_rcb_pool[0];
-    UINT16      xx;
+    uint16_t    xx;
 
     for (xx = 0; xx < BLE_MAX_L2CAP_CLIENTS; xx++, p_rcb++)
     {
@@ -1958,7 +1958,7 @@
 **                  Note:  Negotiation of the FCR channel type is handled internally,
 **                         all others are passed to the upper layer.
 **
-** Returns          UINT8 - L2CAP_PEER_CFG_OK if passed to 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.
@@ -1966,13 +1966,13 @@
 **                              between the two devices, and shall be closed.
 **
 *******************************************************************************/
-UINT8 l2cu_process_peer_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg)
+uint8_t l2cu_process_peer_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg)
 {
-    BOOLEAN  mtu_ok      = TRUE;
-    BOOLEAN  qos_type_ok = TRUE;
-    BOOLEAN  flush_to_ok = TRUE;
-    BOOLEAN  fcr_ok      = TRUE;
-    UINT8    fcr_status;
+    bool     mtu_ok      = true;
+    bool     qos_type_ok = true;
+    bool     flush_to_ok = true;
+    bool     fcr_ok      = true;
+    uint8_t  fcr_status;
 
     /* Ignore FCR parameters for basic mode */
     if (!p_cfg->fcr_present)
@@ -1985,24 +1985,24 @@
         if (p_cfg->mtu >= L2CAP_MIN_MTU)
         {
             /* In basic mode, limit the MTU to our buffer size */
-            if ( (p_cfg->fcr_present == FALSE) && (p_cfg->mtu > L2CAP_MTU_SIZE) )
+            if ( (p_cfg->fcr_present == false) && (p_cfg->mtu > L2CAP_MTU_SIZE) )
                 p_cfg->mtu = L2CAP_MTU_SIZE;
 
             /* Save the accepted value in case of renegotiation */
             p_ccb->peer_cfg.mtu = p_cfg->mtu;
-            p_ccb->peer_cfg.mtu_present = TRUE;
+            p_ccb->peer_cfg.mtu_present = true;
             p_ccb->peer_cfg_bits |= L2CAP_CH_CFG_MASK_MTU;
         }
         else    /* Illegal MTU value */
         {
             p_cfg->mtu = L2CAP_MIN_MTU;
-            mtu_ok     = FALSE;
+            mtu_ok     = false;
         }
     }
     /* Reload mtu from a previously accepted config request */
     else if (p_ccb->peer_cfg.mtu_present)
     {
-        p_cfg->mtu_present = TRUE;
+        p_cfg->mtu_present = true;
         p_cfg->mtu = p_ccb->peer_cfg.mtu;
     }
 
@@ -2012,11 +2012,11 @@
         if (!p_cfg->flush_to)
         {
             p_cfg->flush_to = 0xFFFF;   /* Infinite retransmissions (spec default) */
-            flush_to_ok     = FALSE;
+            flush_to_ok     = false;
         }
         else    /* Save the accepted value in case of renegotiation */
         {
-            p_ccb->peer_cfg.flush_to_present = TRUE;
+            p_ccb->peer_cfg.flush_to_present = true;
             p_ccb->peer_cfg.flush_to = p_cfg->flush_to;
             p_ccb->peer_cfg_bits |= L2CAP_CH_CFG_MASK_FLUSH_TO;
         }
@@ -2024,7 +2024,7 @@
     /* Reload flush_to from a previously accepted config request */
     else if (p_ccb->peer_cfg.flush_to_present)
     {
-        p_cfg->flush_to_present = TRUE;
+        p_cfg->flush_to_present = true;
         p_cfg->flush_to = p_ccb->peer_cfg.flush_to;
     }
 
@@ -2037,19 +2037,19 @@
         if (p_cfg->qos.service_type <= GUARANTEED)
         {
             p_ccb->peer_cfg.qos         = p_cfg->qos;
-            p_ccb->peer_cfg.qos_present = TRUE;
+            p_ccb->peer_cfg.qos_present = true;
             p_ccb->peer_cfg_bits |= L2CAP_CH_CFG_MASK_QOS;
         }
         else    /* Illegal service type value */
         {
             p_cfg->qos.service_type = BEST_EFFORT;
-            qos_type_ok             = FALSE;
+            qos_type_ok             = false;
         }
     }
     /* Reload QOS from a previously accepted config request */
     else if (p_ccb->peer_cfg.qos_present)
     {
-        p_cfg->qos_present = TRUE;
+        p_cfg->qos_present = true;
         p_cfg->qos         = p_ccb->peer_cfg.qos;
     }
 
@@ -2075,13 +2075,13 @@
         p_cfg->result = L2CAP_CFG_UNACCEPTABLE_PARAMS;
 
         if (mtu_ok)
-            p_cfg->mtu_present = FALSE;
+            p_cfg->mtu_present = false;
         if (flush_to_ok)
-            p_cfg->flush_to_present = FALSE;
+            p_cfg->flush_to_present = false;
         if (qos_type_ok)
-            p_cfg->qos_present = FALSE;
+            p_cfg->qos_present = false;
         if (fcr_ok)
-            p_cfg->fcr_present = FALSE;
+            p_cfg->fcr_present = false;
 
         return (L2CAP_PEER_CFG_UNACCEPTABLE);
     }
@@ -2139,12 +2139,12 @@
 void l2cu_process_our_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg)
 {
     tL2C_LCB    *p_lcb;
-    UINT16      hci_flush_to;
+    uint16_t    hci_flush_to;
 
     /* Save the QOS settings we are using for transmit */
     if (p_cfg->qos_present)
     {
-        p_ccb->our_cfg.qos_present = TRUE;
+        p_ccb->our_cfg.qos_present = true;
         p_ccb->our_cfg.qos         = p_cfg->qos;
     }
 
@@ -2175,7 +2175,7 @@
                 p_ccb->bypass_fcs |= L2CAP_CFG_FCS_OUR;
         }
         else
-            p_cfg->fcs_present = FALSE;
+            p_cfg->fcs_present = false;
     }
     else
     {
@@ -2194,7 +2194,7 @@
             /* don't send invalid flush timeout */
             /* SPEC: The sender of the Request shall specify its flush timeout value */
             /*       if it differs from the default value of 0xFFFF                  */
-            p_cfg->flush_to_present = FALSE;
+            p_cfg->flush_to_present = false;
         }
         else
         {
@@ -2235,7 +2235,7 @@
     if ( (p_cfg->qos_present) && (p_ccb->peer_cfg.qos_present) )
         p_ccb->peer_cfg.qos = p_cfg->qos;
     else
-        p_cfg->qos_present = FALSE;
+        p_cfg->qos_present = false;
 
     l2c_fcr_adj_our_rsp_options (p_ccb, p_cfg);
 }
@@ -2260,11 +2260,11 @@
     {
         if ((p_lcb->in_use) && (p_lcb->handle != HCI_INVALID_HANDLE))
         {
-            l2c_link_hci_disc_comp (p_lcb->handle, (UINT8) -1);
+            l2c_link_hci_disc_comp (p_lcb->handle, (uint8_t) -1);
         }
     }
 #if (BLE_INCLUDED == TRUE)
-    l2cb.is_ble_connecting = FALSE;
+    l2cb.is_ble_connecting = false;
 #endif
 }
 
@@ -2274,15 +2274,15 @@
 **
 ** Description      This function initiates an acl connection via HCI
 **
-** Returns          TRUE if successful, FALSE if get buffer fails.
+** Returns          true if successful, false if get buffer fails.
 **
 *******************************************************************************/
-BOOLEAN l2cu_create_conn (tL2C_LCB *p_lcb, tBT_TRANSPORT transport)
+bool    l2cu_create_conn (tL2C_LCB *p_lcb, tBT_TRANSPORT transport)
 {
     int             xx;
     tL2C_LCB        *p_lcb_cur = &l2cb.lcb_pool[0];
-#if BTM_SCO_INCLUDED == TRUE
-    BOOLEAN         is_sco_active;
+#if (BTM_SCO_INCLUDED == TRUE)
+    bool            is_sco_active;
 #endif
 
 #if (BLE_INCLUDED == TRUE)
@@ -2295,7 +2295,7 @@
     if (transport == BT_TRANSPORT_LE)
     {
         if (!controller_get_interface()->supports_ble())
-            return FALSE;
+            return false;
 
         p_lcb->ble_addr_type = addr_type;
         p_lcb->transport = BT_TRANSPORT_LE;
@@ -2314,7 +2314,7 @@
         if ((p_lcb_cur->in_use) && (p_lcb_cur->link_role == HCI_ROLE_SLAVE))
         {
 
-#if BTM_SCO_INCLUDED == TRUE
+#if (BTM_SCO_INCLUDED == TRUE)
             /* The LMP_switch_req shall be sent only if the ACL logical transport
             is in active mode, when encryption is disabled, and all synchronous
             logical transports on the same physical link are disabled." */
@@ -2323,9 +2323,9 @@
             is_sco_active = btm_is_sco_active_by_bdaddr(p_lcb_cur->remote_bd_addr);
 
             L2CAP_TRACE_API ("l2cu_create_conn - btm_is_sco_active_by_bdaddr() is_sco_active = %s", \
-                (is_sco_active == TRUE) ? "TRUE":"FALSE");
+                (is_sco_active == true) ? "true":"false");
 
-            if (is_sco_active == TRUE)
+            if (is_sco_active == true)
                 continue; /* No Master Slave switch not allowed when SCO Active */
 #endif
             /*4_1_TODO check  if btm_cb.devcb.local_features to be used instead */
@@ -2342,7 +2342,7 @@
                                        L2CAP_LINK_ROLE_SWITCH_TIMEOUT_MS,
                                        l2c_lcb_timer_timeout, p_lcb,
                                        btu_general_alarm_queue);
-                    return (TRUE);
+                    return (true);
                 }
             }
         }
@@ -2362,9 +2362,9 @@
 ** Returns
 **
 *******************************************************************************/
-UINT8 l2cu_get_num_hi_priority (void)
+uint8_t l2cu_get_num_hi_priority (void)
 {
-    UINT8       no_hi = 0;
+    uint8_t     no_hi = 0;
     int         xx;
     tL2C_LCB    *p_lcb = &l2cb.lcb_pool[0];
 
@@ -2386,21 +2386,21 @@
 ** Description      This function initiates an acl connection via HCI
 **                  If switch required to create connection it is already done.
 **
-** Returns          TRUE if successful, FALSE if get buffer fails.
+** Returns          true if successful, false if get buffer fails.
 **
 *******************************************************************************/
 
-BOOLEAN l2cu_create_conn_after_switch (tL2C_LCB *p_lcb)
+bool    l2cu_create_conn_after_switch (tL2C_LCB *p_lcb)
 {
-    UINT8            allow_switch = HCI_CR_CONN_ALLOW_SWITCH;
+    uint8_t          allow_switch = HCI_CR_CONN_ALLOW_SWITCH;
     tBTM_INQ_INFO    *p_inq_info;
-    UINT8            page_scan_rep_mode;
-    UINT8            page_scan_mode;
-    UINT16           clock_offset;
-    UINT8            *p_features;
-    UINT16           num_acl = BTM_GetNumAclLinks();
+    uint8_t          page_scan_rep_mode;
+    uint8_t          page_scan_mode;
+    uint16_t         clock_offset;
+    uint8_t          *p_features;
+    uint16_t         num_acl = BTM_GetNumAclLinks();
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (p_lcb->remote_bd_addr);
-    UINT8            no_hi_prio_chs = l2cu_get_num_hi_priority();
+    uint8_t          no_hi_prio_chs = l2cu_get_num_hi_priority();
 
     p_features = BTM_ReadLocalFeatures();
 
@@ -2422,7 +2422,7 @@
     {
         page_scan_rep_mode = p_inq_info->results.page_scan_rep_mode;
         page_scan_mode = p_inq_info->results.page_scan_mode;
-        clock_offset = (UINT16)(p_inq_info->results.clock_offset);
+        clock_offset = (uint16_t)(p_inq_info->results.clock_offset);
     }
     else
     {
@@ -2445,7 +2445,7 @@
     {
         L2CAP_TRACE_ERROR ("L2CAP - no buffer for l2cu_create_conn");
         l2cu_release_lcb (p_lcb);
-        return (FALSE);
+        return (false);
     }
 
     btm_acl_update_busy_level (BTM_BLI_PAGE_EVT);
@@ -2455,7 +2455,7 @@
                        l2c_lcb_timer_timeout, p_lcb,
                        btu_general_alarm_queue);
 
-    return (TRUE);
+    return (true);
 }
 
 
@@ -2471,7 +2471,7 @@
 *******************************************************************************/
 tL2C_LCB *l2cu_find_lcb_by_state (tL2C_LINK_STATE state)
 {
-    UINT16      i;
+    uint16_t    i;
     tL2C_LCB    *p_lcb = &l2cb.lcb_pool[0];
 
     for (i = 0; i < MAX_L2CAP_LINKS; i++, p_lcb++)
@@ -2496,15 +2496,15 @@
                     idle timeout is running), or if last ccb on the link
                     is in disconnecting state.
 **
-** Returns          TRUE if any of above conditions met, FALSE otherwise
+** Returns          true if any of above conditions met, false otherwise
 **
 *******************************************************************************/
-BOOLEAN l2cu_lcb_disconnecting (void)
+bool    l2cu_lcb_disconnecting (void)
 {
     tL2C_LCB    *p_lcb;
     tL2C_CCB    *p_ccb;
-    UINT16      i;
-    BOOLEAN     status = FALSE;
+    uint16_t    i;
+    bool        status = false;
 
     p_lcb = &l2cb.lcb_pool[0];
 
@@ -2515,7 +2515,7 @@
             /* no ccbs on lcb, or lcb is in disconnecting state */
             if ((!p_lcb->ccb_queue.p_first_ccb) || (p_lcb->link_state == LST_DISCONNECTING))
             {
-                status = TRUE;
+                status = true;
                 break;
             }
             /* only one ccb left on lcb */
@@ -2527,7 +2527,7 @@
                     ((p_ccb->chnl_state == CST_W4_L2CAP_DISCONNECT_RSP) ||
                      (p_ccb->chnl_state == CST_W4_L2CA_DISCONNECT_RSP)))
                 {
-                    status = TRUE;
+                    status = true;
                     break;
                 }
             }
@@ -2545,16 +2545,16 @@
 **                  (For initial implementation only two values are valid.
 **                  L2CAP_PRIORITY_NORMAL and L2CAP_PRIORITY_HIGH).
 **
-** Returns          TRUE if a valid channel, else FALSE
+** Returns          true if a valid channel, else false
 **
 *******************************************************************************/
 
-BOOLEAN l2cu_set_acl_priority (BD_ADDR bd_addr, UINT8 priority, BOOLEAN reset_after_rs)
+bool    l2cu_set_acl_priority (BD_ADDR bd_addr, uint8_t priority, bool    reset_after_rs)
 {
     tL2C_LCB            *p_lcb;
-    UINT8               *pp;
-    UINT8                command[HCI_BRCM_ACL_PRIORITY_PARAM_SIZE];
-    UINT8                vs_param;
+    uint8_t             *pp;
+    uint8_t              command[HCI_BRCM_ACL_PRIORITY_PARAM_SIZE];
+    uint8_t              vs_param;
 
     APPL_TRACE_EVENT("SET ACL PRIORITY %d", priority);
 
@@ -2562,7 +2562,7 @@
     if ((p_lcb = l2cu_find_lcb_by_bd_addr(bd_addr, BT_TRANSPORT_BR_EDR)) == NULL)
     {
         L2CAP_TRACE_WARNING ("L2CAP - no LCB for L2CA_SetAclPriority");
-        return (FALSE);
+        return (false);
     }
 
     if (BTM_IS_BRCM_CONTROLLER())
@@ -2589,7 +2589,7 @@
             }
         }
     }
-    return(TRUE);
+    return(true);
 }
 
 #if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
@@ -2602,7 +2602,7 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cu_set_non_flushable_pbf (BOOLEAN is_supported)
+void l2cu_set_non_flushable_pbf (bool    is_supported)
 {
     if (is_supported)
         l2cb.non_flushable_pbf = (L2CAP_PKT_START_NON_FLUSHABLE << L2CAP_PKT_TYPE_SHIFT);
@@ -2668,7 +2668,7 @@
     }
 }
 
-#if L2CAP_CONFORMANCE_TESTING == TRUE
+#if (L2CAP_CONFORMANCE_TESTING == TRUE)
 /*******************************************************************************
 **
 ** Function         l2cu_set_info_rsp_mask
@@ -2679,7 +2679,7 @@
 ** Returns          pointer to CCB, or NULL if none
 **
 *******************************************************************************/
-void l2cu_set_info_rsp_mask (UINT32 mask)
+void l2cu_set_info_rsp_mask (uint32_t mask)
 {
     l2cb.test_info_resp = mask;
 }
@@ -2696,7 +2696,7 @@
 *******************************************************************************/
 void l2cu_adjust_out_mps (tL2C_CCB *p_ccb)
 {
-    UINT16 packet_size;
+    uint16_t packet_size;
 
     /* on the tx side MTU is selected based on packet size of the controller */
     packet_size = btm_get_max_packet_size (p_ccb->p_lcb->remote_bd_addr);
@@ -2736,10 +2736,10 @@
 **
 ** Description      Initialize a fixed channel's CCB
 **
-** Returns          TRUE or FALSE
+** Returns          true or false
 **
 *******************************************************************************/
-BOOLEAN l2cu_initialize_fixed_ccb (tL2C_LCB *p_lcb, UINT16 fixed_cid, tL2CAP_FCR_OPTS *p_fcr)
+bool    l2cu_initialize_fixed_ccb (tL2C_LCB *p_lcb, uint16_t fixed_cid, tL2CAP_FCR_OPTS *p_fcr)
 {
 #if (L2CAP_NUM_FIXED_CHNLS > 0)
     tL2C_CCB    *p_ccb;
@@ -2751,11 +2751,11 @@
          * NOTE: The "in_use" check is needed to ignore leftover entries
          * that have been already released by l2cu_release_ccb().
          */
-        return (TRUE);
+        return (true);
     }
 
     if ((p_ccb = l2cu_allocate_ccb (NULL, 0)) == NULL)
-        return (FALSE);
+        return (false);
 
     alarm_cancel(p_lcb->l2c_lcb_timer);
 
@@ -2763,7 +2763,7 @@
     p_ccb->local_cid  = fixed_cid;
     p_ccb->remote_cid = fixed_cid;
 
-    p_ccb->is_flushable = FALSE;
+    p_ccb->is_flushable = false;
 
     if (p_fcr)
     {
@@ -2789,7 +2789,7 @@
     /* Set the default idle timeout value to use */
     p_ccb->fixed_chnl_idle_tout = l2cb.fixed_reg[fixed_cid - L2CAP_FIRST_FIXED_CHNL].default_idle_tout;
 #endif
-    return (TRUE);
+    return (true);
 }
 
 /*******************************************************************************
@@ -2895,7 +2895,7 @@
     /* Tell all registered fixed channels about the connection */
     for (int xx = 0; xx < L2CAP_NUM_FIXED_CHNLS; xx++)
     {
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
         /* skip sending LE fix channel callbacks on BR/EDR links */
         if (p_lcb->transport == BT_TRANSPORT_BR_EDR &&
             xx + L2CAP_FIRST_FIXED_CHNL >= L2CAP_ATT_CID &&
@@ -2909,22 +2909,22 @@
             {
                 if (p_lcb->p_fixed_ccbs[xx])
                     p_lcb->p_fixed_ccbs[xx]->chnl_state = CST_OPEN;
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
                 (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(xx + L2CAP_FIRST_FIXED_CHNL,
-                        p_lcb->remote_bd_addr, TRUE, 0, p_lcb->transport);
+                        p_lcb->remote_bd_addr, true, 0, p_lcb->transport);
 #else
                 (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(xx + L2CAP_FIRST_FIXED_CHNL,
-                        p_lcb->remote_bd_addr, TRUE, 0, BT_TRANSPORT_BR_EDR);
+                        p_lcb->remote_bd_addr, true, 0, BT_TRANSPORT_BR_EDR);
 #endif
             }
             else
             {
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
                 (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(xx + L2CAP_FIRST_FIXED_CHNL,
-                        p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, p_lcb->transport);
+                        p_lcb->remote_bd_addr, false, p_lcb->disc_reason, p_lcb->transport);
 #else
                 (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(xx + L2CAP_FIRST_FIXED_CHNL,
-                        p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, BT_TRANSPORT_BR_EDR);
+                        p_lcb->remote_bd_addr, false, p_lcb->disc_reason, BT_TRANSPORT_BR_EDR);
 #endif
 
                 if (p_lcb->p_fixed_ccbs[xx])
@@ -2954,7 +2954,7 @@
 #if (L2CAP_NUM_FIXED_CHNLS > 0)
 
     /* Select peer channels mask to use depending on transport */
-    UINT8 peer_channel_mask = p_lcb->peer_chnl_mask[0];
+    uint8_t peer_channel_mask = p_lcb->peer_chnl_mask[0];
 
     // For LE, reset the stored peer channel mask
     if (p_lcb->transport == BT_TRANSPORT_LE)
@@ -2970,23 +2970,23 @@
                 p_l2c_chnl_ctrl_block = p_lcb->p_fixed_ccbs[xx];
                 p_lcb->p_fixed_ccbs[xx] = NULL;
                 l2cu_release_ccb(p_l2c_chnl_ctrl_block);
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
             (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(xx + L2CAP_FIRST_FIXED_CHNL,
-                    p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, p_lcb->transport);
+                    p_lcb->remote_bd_addr, false, p_lcb->disc_reason, p_lcb->transport);
 #else
             (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(xx + L2CAP_FIRST_FIXED_CHNL,
-                    p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, BT_TRANSPORT_BR_EDR);
+                    p_lcb->remote_bd_addr, false, p_lcb->disc_reason, BT_TRANSPORT_BR_EDR);
 #endif
            }
         }
         else if ( (peer_channel_mask & (1 << (xx + L2CAP_FIRST_FIXED_CHNL)))
                && (l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb != NULL) )
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE)
             (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(xx + L2CAP_FIRST_FIXED_CHNL,
-                    p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, p_lcb->transport);
+                    p_lcb->remote_bd_addr, false, p_lcb->disc_reason, p_lcb->transport);
 #else
             (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(xx + L2CAP_FIRST_FIXED_CHNL,
-                    p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, BT_TRANSPORT_BR_EDR);
+                    p_lcb->remote_bd_addr, false, p_lcb->disc_reason, BT_TRANSPORT_BR_EDR);
 #endif
     }
 #endif
@@ -3003,11 +3003,11 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cu_send_peer_ble_par_req (tL2C_LCB *p_lcb, UINT16 min_int, UINT16 max_int,
-        UINT16 latency, UINT16 timeout)
+void l2cu_send_peer_ble_par_req (tL2C_LCB *p_lcb, uint16_t min_int, uint16_t max_int,
+        uint16_t latency, uint16_t timeout)
 {
     BT_HDR  *p_buf;
-    UINT8   *p;
+    uint8_t *p;
 
     /* Create an identifier for this packet */
     p_lcb->id++;
@@ -3020,7 +3020,7 @@
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
                                L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     UINT16_TO_STREAM (p, min_int);
@@ -3041,10 +3041,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cu_send_peer_ble_par_rsp (tL2C_LCB *p_lcb, UINT16 reason, UINT8 rem_id)
+void l2cu_send_peer_ble_par_rsp (tL2C_LCB *p_lcb, uint16_t reason, uint8_t rem_id)
 {
     BT_HDR  *p_buf;
-    UINT8   *p;
+    uint8_t *p;
 
     if ((p_buf = l2cu_build_header (p_lcb, L2CAP_CMD_BLE_UPD_RSP_LEN,
                     L2CAP_CMD_BLE_UPDATE_RSP, rem_id)) == NULL )
@@ -3053,7 +3053,7 @@
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
                                L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     UINT16_TO_STREAM (p, reason);
@@ -3074,11 +3074,11 @@
 void l2cu_send_peer_ble_credit_based_conn_req (tL2C_CCB *p_ccb)
 {
     BT_HDR  *p_buf;
-    UINT8   *p;
+    uint8_t *p;
     tL2C_LCB *p_lcb = NULL;
-    UINT16 mtu;
-    UINT16 mps;
-    UINT16 initial_credit;
+    uint16_t mtu;
+    uint16_t mps;
+    uint16_t initial_credit;
 
     if (!p_ccb)
         return;
@@ -3097,7 +3097,7 @@
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
                                L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     mtu = p_ccb->local_conn_cfg.mtu;
@@ -3127,10 +3127,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cu_reject_ble_connection (tL2C_LCB *p_lcb, UINT8 rem_id, UINT16 result)
+void l2cu_reject_ble_connection (tL2C_LCB *p_lcb, uint8_t rem_id, uint16_t result)
 {
     BT_HDR  *p_buf;
-    UINT8   *p;
+    uint8_t *p;
 
     if ((p_buf = l2cu_build_header(p_lcb, L2CAP_CMD_BLE_CREDIT_BASED_CONN_RES_LEN,
                     L2CAP_CMD_BLE_CREDIT_BASED_CONN_RES, rem_id)) == NULL )
@@ -3139,7 +3139,7 @@
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
                                L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     UINT16_TO_STREAM (p, 0);                    /* Local CID of 0   */
@@ -3161,10 +3161,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cu_send_peer_ble_credit_based_conn_res (tL2C_CCB *p_ccb, UINT16 result)
+void l2cu_send_peer_ble_credit_based_conn_res (tL2C_CCB *p_ccb, uint16_t result)
 {
     BT_HDR  *p_buf;
-    UINT8   *p;
+    uint8_t *p;
 
     L2CAP_TRACE_DEBUG ("l2cu_send_peer_ble_credit_based_conn_res");
     if ((p_buf = l2cu_build_header(p_ccb->p_lcb, L2CAP_CMD_BLE_CREDIT_BASED_CONN_RES_LEN,
@@ -3174,7 +3174,7 @@
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
                                L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     UINT16_TO_STREAM (p, p_ccb->local_cid);                      /* Local CID */
@@ -3196,10 +3196,10 @@
 ** Returns          void
 **
 *******************************************************************************/
-void l2cu_send_peer_ble_flow_control_credit(tL2C_CCB *p_ccb, UINT16 credit_value)
+void l2cu_send_peer_ble_flow_control_credit(tL2C_CCB *p_ccb, uint16_t credit_value)
 {
     BT_HDR  *p_buf;
-    UINT8   *p;
+    uint8_t *p;
     tL2C_LCB *p_lcb = NULL;
 
     if (!p_ccb)
@@ -3219,7 +3219,7 @@
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
                                L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     UINT16_TO_STREAM (p, p_ccb->local_cid);
@@ -3241,7 +3241,7 @@
 void l2cu_send_peer_ble_credit_based_disconn_req(tL2C_CCB *p_ccb)
 {
     BT_HDR  *p_buf;
-    UINT8   *p;
+    uint8_t *p;
     tL2C_LCB *p_lcb = NULL;
     L2CAP_TRACE_DEBUG ("%s",__func__);
 
@@ -3261,7 +3261,7 @@
         return;
     }
 
-    p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
+    p = (uint8_t *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
                                L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;
 
     UINT16_TO_STREAM (p, p_ccb->remote_cid);
@@ -3286,7 +3286,7 @@
 ** Returns          pointer to matched LCB, or NULL if no match
 **
 *******************************************************************************/
-tL2C_LCB  *l2cu_find_lcb_by_handle (UINT16 handle)
+tL2C_LCB  *l2cu_find_lcb_by_handle (uint16_t handle)
 {
     int         xx;
     tL2C_LCB    *p_lcb = &l2cb.lcb_pool[0];
@@ -3314,11 +3314,11 @@
 ** Returns          pointer to matched CCB, or NULL if no match
 **
 *******************************************************************************/
-tL2C_CCB *l2cu_find_ccb_by_cid (tL2C_LCB *p_lcb, UINT16 local_cid)
+tL2C_CCB *l2cu_find_ccb_by_cid (tL2C_LCB *p_lcb, uint16_t local_cid)
 {
     tL2C_CCB    *p_ccb = NULL;
 #if (L2CAP_UCD_INCLUDED == TRUE)
-    UINT8 xx;
+    uint8_t xx;
 #endif
 
     if (local_cid >= L2CAP_BASE_APPL_CID)
@@ -3656,10 +3656,10 @@
 *******************************************************************************/
 void l2cu_set_acl_hci_header (BT_HDR *p_buf, tL2C_CCB *p_ccb)
 {
-    UINT8       *p;
+    uint8_t     *p;
 
     /* Set the pointer to the beginning of the data minus 4 bytes for the packet header */
-    p = (UINT8 *)(p_buf + 1) + p_buf->offset - HCI_DATA_PREAMBLE_SIZE;
+    p = (uint8_t *)(p_buf + 1) + p_buf->offset - HCI_DATA_PREAMBLE_SIZE;
 
 #if (BLE_INCLUDED == TRUE)
     if (p_ccb->p_lcb->transport == BT_TRANSPORT_LE)
@@ -3738,40 +3738,40 @@
             /* If the channel is not congested now, tell the app */
             if (q_count <= (p_ccb->buff_quota / 2))
             {
-                p_ccb->cong_sent = FALSE;
+                p_ccb->cong_sent = false;
                 if (p_ccb->p_rcb && p_ccb->p_rcb->api.pL2CA_CongestionStatus_Cb)
                 {
-                    L2CAP_TRACE_DEBUG ("L2CAP - Calling CongestionStatus_Cb (FALSE), CID: 0x%04x  xmit_hold_q.count: %u  buff_quota: %u",
+                    L2CAP_TRACE_DEBUG ("L2CAP - Calling CongestionStatus_Cb (false), CID: 0x%04x  xmit_hold_q.count: %u  buff_quota: %u",
                                       p_ccb->local_cid, q_count, p_ccb->buff_quota);
 
                     /* Prevent recursive calling */
-                    l2cb.is_cong_cback_context = TRUE;
-                    (*p_ccb->p_rcb->api.pL2CA_CongestionStatus_Cb)(p_ccb->local_cid, FALSE);
-                    l2cb.is_cong_cback_context = FALSE;
+                    l2cb.is_cong_cback_context = true;
+                    (*p_ccb->p_rcb->api.pL2CA_CongestionStatus_Cb)(p_ccb->local_cid, false);
+                    l2cb.is_cong_cback_context = false;
                 }
 #if (L2CAP_UCD_INCLUDED == TRUE)
                 else if ( p_ccb->p_rcb && p_ccb->local_cid == L2CAP_CONNECTIONLESS_CID )
                 {
                     if ( p_ccb->p_rcb->ucd.cb_info.pL2CA_UCD_Congestion_Status_Cb )
                     {
-                        L2CAP_TRACE_DEBUG ("L2CAP - Calling UCD CongestionStatus_Cb (FALSE), SecPendingQ:%u,XmitQ:%u,Quota:%u",
+                        L2CAP_TRACE_DEBUG ("L2CAP - Calling UCD CongestionStatus_Cb (false), SecPendingQ:%u,XmitQ:%u,Quota:%u",
                                            fixed_queue_length(p_ccb->p_lcb->ucd_out_sec_pending_q),
                                            fixed_queue_length(p_ccb->xmit_hold_q),
                                            p_ccb->buff_quota);
-                        p_ccb->p_rcb->ucd.cb_info.pL2CA_UCD_Congestion_Status_Cb( p_ccb->p_lcb->remote_bd_addr, FALSE );
+                        p_ccb->p_rcb->ucd.cb_info.pL2CA_UCD_Congestion_Status_Cb( p_ccb->p_lcb->remote_bd_addr, false );
                     }
                 }
 #endif
 #if (L2CAP_NUM_FIXED_CHNLS > 0)
                 else
                 {
-                    UINT8 xx;
+                    uint8_t xx;
                     for (xx = 0; xx < L2CAP_NUM_FIXED_CHNLS; xx ++)
                     {
                         if (p_ccb->p_lcb->p_fixed_ccbs[xx] == p_ccb)
                         {
                             if (l2cb.fixed_reg[xx].pL2CA_FixedCong_Cb != NULL)
-                                (* l2cb.fixed_reg[xx].pL2CA_FixedCong_Cb)(p_ccb->p_lcb->remote_bd_addr, FALSE);
+                                (* l2cb.fixed_reg[xx].pL2CA_FixedCong_Cb)(p_ccb->p_lcb->remote_bd_addr, false);
                             break;
                         }
                     }
@@ -3784,37 +3784,37 @@
             /* If this channel was not congested but it is congested now, tell the app */
             if (q_count > p_ccb->buff_quota)
             {
-                p_ccb->cong_sent = TRUE;
+                p_ccb->cong_sent = true;
                 if (p_ccb->p_rcb && p_ccb->p_rcb->api.pL2CA_CongestionStatus_Cb)
                 {
-                    L2CAP_TRACE_DEBUG ("L2CAP - Calling CongestionStatus_Cb (TRUE),CID:0x%04x,XmitQ:%u,Quota:%u",
+                    L2CAP_TRACE_DEBUG ("L2CAP - Calling CongestionStatus_Cb (true),CID:0x%04x,XmitQ:%u,Quota:%u",
                         p_ccb->local_cid, q_count, p_ccb->buff_quota);
 
-                    (*p_ccb->p_rcb->api.pL2CA_CongestionStatus_Cb)(p_ccb->local_cid, TRUE);
+                    (*p_ccb->p_rcb->api.pL2CA_CongestionStatus_Cb)(p_ccb->local_cid, true);
                 }
 #if (L2CAP_UCD_INCLUDED == TRUE)
                 else if ( p_ccb->p_rcb && p_ccb->local_cid == L2CAP_CONNECTIONLESS_CID )
                 {
                     if ( p_ccb->p_rcb->ucd.cb_info.pL2CA_UCD_Congestion_Status_Cb )
                     {
-                        L2CAP_TRACE_DEBUG("L2CAP - Calling UCD CongestionStatus_Cb (TRUE), SecPendingQ:%u,XmitQ:%u,Quota:%u",
+                        L2CAP_TRACE_DEBUG("L2CAP - Calling UCD CongestionStatus_Cb (true), SecPendingQ:%u,XmitQ:%u,Quota:%u",
                                           fixed_queue_length(p_ccb->p_lcb->ucd_out_sec_pending_q),
                                           fixed_queue_length(p_ccb->xmit_hold_q),
                                           p_ccb->buff_quota);
-                        p_ccb->p_rcb->ucd.cb_info.pL2CA_UCD_Congestion_Status_Cb( p_ccb->p_lcb->remote_bd_addr, TRUE );
+                        p_ccb->p_rcb->ucd.cb_info.pL2CA_UCD_Congestion_Status_Cb( p_ccb->p_lcb->remote_bd_addr, true );
                     }
                 }
 #endif
 #if (L2CAP_NUM_FIXED_CHNLS > 0)
                 else
                 {
-                    UINT8 xx;
+                    uint8_t xx;
                     for (xx = 0; xx < L2CAP_NUM_FIXED_CHNLS; xx ++)
                     {
                         if (p_ccb->p_lcb->p_fixed_ccbs[xx] == p_ccb)
                         {
                             if (l2cb.fixed_reg[xx].pL2CA_FixedCong_Cb != NULL)
-                                (* l2cb.fixed_reg[xx].pL2CA_FixedCong_Cb)(p_ccb->p_lcb->remote_bd_addr, TRUE);
+                                (* l2cb.fixed_reg[xx].pL2CA_FixedCong_Cb)(p_ccb->p_lcb->remote_bd_addr, true);
                             break;
                         }
                     }
@@ -3831,11 +3831,11 @@
 **
 ** Description      Check if Channel Control Block is in use or released
 **
-** Returns          BOOLEAN - TRUE if Channel Control Block is in use
-**                            FALSE if p_ccb is null or is released.
+** Returns          bool    - true if Channel Control Block is in use
+**                            false if p_ccb is null or is released.
 **
 *******************************************************************************/
-BOOLEAN l2cu_is_ccb_active (tL2C_CCB *p_ccb)
+bool    l2cu_is_ccb_active (tL2C_CCB *p_ccb)
 {
     return (p_ccb && p_ccb->in_use);
 }